diff --git a/AI_DASHBOARD_CAPABILITIES_REFERENCE.md b/AI_DASHBOARD_CAPABILITIES_REFERENCE.md new file mode 100644 index 0000000..54cc066 --- /dev/null +++ b/AI_DASHBOARD_CAPABILITIES_REFERENCE.md @@ -0,0 +1,857 @@ +# Dune Dashboard — Complete Capabilities Reference + +> **Generated:** 2026-05-22 +> **Purpose:** Comprehensive reference of all dashboard features, database functions, and admin tools +> **⚠️ SECURITY:** This document contains sensitive operational information. Do not commit to GitHub. + +--- + +## Table of Contents + +1. [Dashboard Admin Features](#1-dashboard-admin-features) +2. [Database Functions Catalog](#2-database-functions-catalog) +3. [RabbitMQ Exchanges & Queues](#3-rabbitmq-exchanges--queues) +4. [BGD Director API Endpoints](#4-bgd-director-api-endpoints) +5. [Kubernetes Resources](#5-kubernetes-resources) +6. [Game Tables Reference](#6-game-tables-reference) + +--- + +## 1. Dashboard Admin Features + +### 1.1 Player Management + +| Feature | Purpose | API Endpoint | DB Function / Query | +|---------|---------|--------------|---------------------| +| **Search Players** | Find players by character name or FLS ID | `POST /api/admin-experimental/search-players` | Query on `encrypted_accounts` + `player_state` | +| **Online Players** | List currently online players | `GET /api/admin-experimental/online-players` | `get_all_online_or_recently_disconnected_player_online_state()` | +| **Teleport Player** | Move offline player to partition + coordinates | `POST /api/admin-experimental/teleport` | `admin_move_offline_player_to_partition(fls_id, partition_id, vector)` | +| **Change Faction** | Switch player's faction allegiance | `POST /api/admin-experimental/change-faction` | Direct SQL on `player_faction` table | +| **Faction Reputation** | View/set reputation with factions | `POST /api/admin-experimental/faction-reputation` | `get_player_current_faction_reputation()`, `set_player_faction_reputation()` | +| **Adjust Currency** | Add/remove Solari, House Script, Spice | `POST /api/admin-experimental/adjust-currency` | Direct INSERT/UPDATE on `player_virtual_currency_balances` | +| **View Currency** | Check player's currency balances | `POST /api/admin-experimental/currency-balances` | Query `player_virtual_currency_balances` | +| **Player Tags** | Add/remove metadata tags on accounts | `POST /api/admin-experimental/player-tags` | `admin_read_player_tags()`, `update_player_tags()` | +| **Flag Cheater** | Mark account for cheating | `POST /api/admin-experimental/flag-cheater` | `flag_player_as_cheater(account_id, cheat_type_enum)` | +| **Player Stats** | View health, hydration, spice exposure | `POST /api/admin-experimental/player-stats` | Query `actors.properties` JSONB | +| **Player Vehicles** | List owned vehicles | `POST /api/admin-experimental/player-vehicles` | `get_player_owned_vehicles_data()` | +| **Inventory Lookup** | View player inventory items | `POST /api/admin-experimental/inventory` | `admin_get_inventory_details()` | +| **Set Character Name** | Rename a character | `POST /api/admin-experimental/set-character-name` | `set_character_name(account_id, name)` | +| **Delete Character** | Remove character from account | `POST /api/admin-experimental/delete-character` | `delete_character(actor_id)` | +| **Delete Account** | Full account deletion | `POST /api/admin-experimental/delete-account` | `delete_account(user_id, reason)` | +| **Set Demo State** | Force demo mode state | `POST /api/admin-experimental/set-demo-state` | `set_demo_state(user_id, demo_state_enum)` | + +### 1.2 Guild Management + +| Feature | Purpose | API Endpoint | DB Function | +|---------|---------|--------------|-------------| +| **List Guilds** | Show all guilds on server | `GET /api/admin-experimental/guilds` | Query `guilds` table | +| **View Guild** | Get guild details + members | `POST /api/admin-experimental/guild-data` | `get_guild_data(guild_id)` | +| **Disband Guild** | Delete guild entirely | `POST /api/admin-experimental/disband-guild` | `disband_guild(guild_id)` | +| **Kick Member** | Remove player from guild | `POST /api/admin-experimental/remove-guild-member` | `remove_guild_members([player_id], guild_id, reason)` | +| **Guild Members** | List guild roster | `POST /api/admin-experimental/guild-members` | `get_guild_members(guild_id)` | +| **Promote Member** | Change guild role | `POST /api/admin-experimental/promote-guild-member` | `promote_guild_member(guild_id, player_id, role_id)` | +| **Demote Member** | Lower guild role | `POST /api/admin-experimental/demote-guild-member` | `demote_guild_member(guild_id, player_id, role_id)` | + +### 1.3 Journey & Progression + +| Feature | Purpose | API Endpoint | DB Function | +|---------|---------|--------------|-------------| +| **Complete Story Nodes** | Mark journey nodes complete | `POST /api/admin-experimental/journey` (action=complete) | `complete_journey_story_nodes_for_player(player_id, [node_ids])` | +| **Reveal Story Nodes** | Unlock hidden nodes | `POST /api/admin-experimental/journey` (action=reveal) | `reveal_journey_story_nodes_for_player(player_id, [node_ids])` | +| **Reset Story Nodes** | Reset progression | `POST /api/admin-experimental/journey` (action=reset) | `delete_journey_story_nodes_for_player(player_id, [node_ids])` | +| **Set Specialization** | Set XP/level for track | `POST /api/admin-experimental/specialization` | `set_specialization_xp_and_level(player_id, track_type, xp, level)` | +| **Reset Specialization** | Clear spec progress | `POST /api/admin-experimental/reset-specialization` | `reset_specialization_tracks(player_id)` | +| **View Inventory** | See player items | `POST /api/admin-experimental/inventory` | `admin_get_inventory_details(account_id)` | + +### 1.4 Economy & World + +| Feature | Purpose | API Endpoint | DB Function | +|---------|---------|--------------|-------------| +| **Reset Vendor Stock** | Refresh vendor inventory | `POST /api/admin-experimental/clean-vendor-stock` | `clean_stock_for_player(player_id)` | +| **View Tax Invoices** | Check player tax bills | `POST /api/admin-experimental/tax-invoices` | `taxation_get_all_invoices_for_player(player_id)` | +| **Reset Spice Fields** | Reset spice state on map | `POST /api/admin-experimental/spice` | `reset_global_spice_field_state(map, dim)` | +| **Force Spice Spawn** | Trigger spice field spawn | `POST /api/admin-experimental/spice` | `try_spawn_spicefield(server_id, spicefield_id)` | +| **List Partitions** | Show all world partitions | `GET /api/admin-experimental/partitions` | Query `world_partition` table | +| **Battlegroup Info** | Full server status | `GET /api/admin-experimental/battlegroup` | BGD API `/v0/battlegroup` | + +### 1.5 Server Administration + +| Feature | Purpose | API Endpoint | DB Function | +|---------|---------|--------------|-------------| +| **Set Players Offline** | Force all players offline | `POST /api/admin-experimental/server-tools` | `set_players_from_server_ids_offline([server_ids])` | +| **Cleanup Orphans** | Remove orphaned entities | `POST /api/admin-experimental/server-tools` | `cleanup_orphaned_entities()` | +| **View Permissions** | Check actor permissions | `POST /api/admin-experimental/permissions` | `get_permission_for_actors([actor_ids])` | +| **Set Player Rank** | Set permission rank | `POST /api/admin-experimental/permissions` | `permission_set_player_rank(actor_id, player_id, rank, map_id)` | +| **In-Game Broadcast** | Send notification to all players | `POST /api/admin-experimental/broadcast` | `rabbitmqctl eval` on RMQ pod (Erlang) | +| **Ban Player** | Ban with duration | `POST /api/ban_player` | Insert into `dashboard.bans` + iptables | +| **Unban Player** | Remove ban | `POST /api/unban_player` | Delete from `dashboard.bans` + iptables | +| **Kick Player** | Temporary kick | `POST /api/kick_player` | iptables DROP for 60 seconds | +| **Detect Player IPs** | Parse logs for IPs | `POST /api/detect_player_ips` | SSH + kubectl to read game logs | + +### 1.6 Item & Entity Editing + +| Feature | Purpose | API Endpoint | DB Function | +|---------|---------|--------------|-------------| +| **Edit Item** | Modify stack size, quality, durability | `POST /api/edit_item` | Direct UPDATE on `items` table | +| **Delete Item** | Remove item | `POST /api/delete_item` | `DELETE FROM items WHERE id = ?` | +| **Add Item** | Spawn item to inventory | `POST /api/add_item` | `INSERT INTO items ...` | +| **Edit Vitals** | Change health, hydration, spice | `POST /api/edit_vitals` | UPDATE `actors.properties` + `gas_attributes` | +| **Edit Tech Knowledge** | Set tech points | `POST /api/edit_tech_knowledge` | UPDATE `actors.properties` (TechKnowledgePlayerComponent) | +| **Edit XP** | Set specialization XP | `POST /api/edit_xp` | UPSERT on `specialization_tracks` | +| **Edit Faction** | Change faction directly | `POST /api/edit_faction` | UPSERT on `player_faction` | +| **Edit Currency** | Set exact balance | `POST /api/edit_currency` | UPSERT on `player_virtual_currency_balances` | + +### 1.7 Function Explorer + +| Feature | Purpose | API Endpoint | +|---------|---------|--------------| +| **List Functions** | Get all 517 DB functions | `GET /api/admin-experimental/functions` | +| **Get Function** | View function definition | `GET /api/admin-experimental/functions/:name` | +| **Execute Function** | Call function with params | `POST /api/admin-experimental/functions/:name/execute` | +| **Execute SQL** | Run raw SQL (admin only) | `POST /api/admin-experimental/execute` | + +### 1.8 File Browser + +| Feature | Purpose | API Endpoint | +|---------|---------|--------------| +| **List Files** | Browse `/srv` directory | `POST /api/files/list` | +| **View File** | Read file content | `GET /api/files/view` | +| **Save File** | Edit file content | `POST /api/files/save` | + +--- + +## 2. Database Functions Catalog + +### 2.1 Admin & Debug Functions (24 functions) + +| Function | Purpose | +|----------|---------| +| `admin_get_character_details(in_account_id bigint)` | Get full character data for account | +| `admin_get_character_ids(in_search_term text)` | Search characters by name pattern | +| `admin_get_inventory_details(in_account_id bigint)` | Get all inventory items for account | +| `admin_get_journey_details(in_player_id text, in_story_node_id text)` | Get journey node progress | +| `admin_get_mnemonic_recall_details(in_account_id bigint)` | Get mnemonic recall lessons | +| `admin_get_partitions()` | List all world partitions | +| `admin_move_offline_player(in_fls_id text, in_target_partition_name text, in_target_location vector)` | Teleport by partition name | +| `admin_move_offline_player_to_partition(in_fls_id text, in_target_partition_id bigint, in_target_location vector)` | Teleport by partition ID | +| `admin_read_player_tags(in_account_id bigint)` | Get tags for account | +| `debug_add_test_table_data(in_entry text)` | Debug: insert test data | +| `debug_collect_test_table_data()` | Debug: collect test data | +| `debug_echo(in_text text, in_notices text[])` | Debug: echo with notices | +| `debug_get_coriolis_seeds()` | Debug: get all Coriolis seeds | +| `debug_raise_exception(in_exception text, in_notices text[])` | Debug: raise exception | +| `debug_raise_notices(in_notices text[])` | Debug: raise notices | +| `debug_reset_test_table()` | Debug: reset test table | +| `debug_set_farm_seed(in_new_coriolis_seed integer)` | Debug: set farm seed | +| `debug_set_map_seed(in_map text, in_new_coriolis_seed integer)` | Debug: set map seed | +| `debug_set_partition_seed(in_partition_id bigint, in_new_coriolis_seed integer)` | Debug: set partition seed | +| `get_all_demo_players()` | Get all demo state players | +| `get_all_faction_members()` | Get all faction members | +| `get_all_guild_members()` | Get all guild members | +| `get_all_online_or_recently_disconnected_player_online_state()` | Get online players | +| `get_schema_version()` | Get DB schema version | + +### 2.2 Character Transfer Functions (22 functions) + +| Function | Purpose | +|----------|---------| +| `_character_transfer_allocate_id(kind dune._charactertransferentrykind, data jsonb)` | Allocate transfer ID | +| `_character_transfer_create_data_table()` | Create transfer data table | +| `_character_transfer_data_filter(id text, removed text[], VARIADIC refs dune._charactertransferdatafilterref[])` | Filter transfer data | +| `_character_transfer_data_table_load(entries jsonb)` | Load transfer data table | +| `_character_transfer_data_table_save()` | Save transfer data table | +| `_character_transfer_ensure_player_is_owner_of_vbt_vehicle(in_vehicle_id bigint[])` | Validate vehicle ownership | +| `_character_transfer_get_filter(kind dune._charactertransferentrykind)` | Get transfer filter | +| `_character_transfer_get_patches_checksum()` | Get patches checksum | +| `_character_transfer_pre_export_validation(in_fls_id text)` | Pre-export validation | +| `_character_transfer_property_not_exported_is_expected(path text)` | Check property export | +| `_character_transfer_replace_local_id_with_transfer_id(data text, path text)` | Replace IDs for export | +| `_character_transfer_replace_local_id_with_transfer_id_in_json(data jsonb, path text)` | Replace IDs in JSON | +| `_character_transfer_replace_transfer_id_with_local_id(data text, path text)` | Replace IDs for import | +| `_character_transfer_replace_transfer_id_with_local_id_in_json(data jsonb, path text)` | Replace IDs in JSON | +| `_character_transfer_store_in_world_owned_vehicles_into_recovery(in_player_id bigint)` | Store vehicles in recovery | +| `_character_transfer_top_level_export(in_kind dune._charactertransferentrykind, data jsonb)` | Export character data | +| `_character_transfer_top_level_import(in_kind dune._charactertransferentrykind, data jsonb, in_id bigint)` | Import character data | +| `character_migration_export(in_fls_id text)` | Export for migration | +| `character_migration_import(in_data jsonb, in_fls_id text, in_character_name text)` | Import migration data | +| `character_transfer_export(in_fls_id text)` | Export character | +| `character_transfer_get_unsaved_counts(in_fls_id text)` | Get unsaved counts | +| `character_transfer_import(in_data jsonb, in_fls_id text, in_character_name text)` | Import character | + +### 2.3 Guild & Faction Functions (28 functions) + +| Function | Purpose | +|----------|---------| +| `accept_guild_invite(in_invite_id bigint, in_role_id smallint, ...)` | Accept guild invite | +| `add_guild_invite(in_player_id bigint, in_guild_id bigint, ...)` | Create guild invite | +| `add_guild_member(in_player_id bigint, in_guild_id bigint, ...)` | Add member to guild | +| `break_guild_allegiance(in_guild_id bigint, in_neutral_faction_id smallint)` | Break guild allegiance | +| `change_player_faction(in_player_id bigint, in_faction_id smallint, ...)` | Change player faction | +| `clean_guild_invites_with_incompatible_faction(in_player_id bigint, in_faction_id smallint, ...)` | Clean incompatible invites | +| `clean_old_guild_invites(in_cutoff_timespan bigint)` | Clean old guild invites | +| `create_guild(in_player_id bigint, in_neutral_faction smallint, ...)` | Create new guild | +| `demote_guild_member(in_guild_id bigint, in_player_id bigint, in_new_role smallint)` | Demote guild member | +| `disband_guild(in_guild_id bigint)` | Disband guild | +| `get_guild_data(in_guild_id bigint)` | Get guild details | +| `get_guild_data_for_player(in_player_id bigint)` | Get guild for player | +| `get_guild_for_player(in_player_id bigint)` | Get guild ID for player | +| `get_guild_invites(in_guild_id bigint)` | Get guild invites | +| `get_guild_members(in_guild_id bigint)` | Get guild member list | +| `guild_handle_actor_delete(in_player_id bigint)` | Handle actor delete | +| `guilds_get_exclusive_operation_lock()` | Get guild operation lock | +| `handle_player_faction_guild_effects(in_player_id bigint, in_faction_id smallint, ...)` | Apply faction effects | +| `is_player_guild_admin(in_player_id bigint, in_guild_id bigint)` | Check if guild admin | +| `pledge_guild_allegiance(in_guild_id bigint, in_guild_leader_player_id bigint, ...)` | Pledge allegiance | +| `promote_guild_member(in_guild_id bigint, in_player_id bigint, in_new_role smallint)` | Promote guild member | +| `remove_guild_members(in_player_ids bigint[], in_guild_id bigint, in_remove_reason smallint)` | Remove members | +| `get_player_current_faction_reputation(in_actor_id bigint)` | Get faction reputation | +| `get_player_faction(in_player_id bigint, in_neutral_faction_id smallint)` | Get player faction | +| `get_player_faction_name(in_actor_id bigint)` | Get faction name | +| `set_player_faction_reputation(in_actor_id bigint, in_faction_id smallint, in_reputation_amount integer)` | Set reputation | +| `get_all_player_in_guild_online_state(in_guild_id bigint)` | Get guild online members | +| `get_player_ids_online_state(in_player_ids bigint[])` | Get player online status | + +### 2.4 Party Functions (13 functions) + +| Function | Purpose | +|----------|---------| +| `accept_party_invite(in_invite_id bigint, in_platform_session_id text, in_max_party_member_count integer)` | Accept party invite | +| `add_party_invite(in_sender_player_id bigint, in_sender_platform_name text, ...)` | Create party invite | +| `clean_expired_party_invites(in_invite_expire_seconds integer)` | Clean expired invites | +| `disband_party(in_party_id bigint)` | Disband party | +| `get_all_parties()` | Get all parties | +| `get_all_party_invites()` | Get all party invites | +| `get_all_party_members()` | Get all party members | +| `get_party_members(in_party_id bigint)` | Get party members | +| `internal_add_party_member(in_invite_id bigint, in_party_id bigint, ...)` | Add party member | +| `internal_create_party(in_invite_id bigint, in_leader_id bigint, ...)` | Create party | +| `join_platform_session_party(in_leader_platform_id text, in_player_platform_id text, ...)` | Join platform party | +| `parties_get_exclusive_operation_lock()` | Get party operation lock | +| `promote_new_party_leader(in_party_id bigint)` | Promote new leader | +| `promote_party_leader_to(in_party_id bigint, in_player_id bigint)` | Set party leader | +| `remove_party_invite(in_invite_id bigint, in_remove_reason smallint)` | Remove party invite | +| `remove_party_member(in_player_id bigint, in_remove_reason smallint)` | Remove party member | +| `update_party_platform_session(in_party_id bigint, in_platform_session_id text, in_platform_name text)` | Update platform session | + +### 2.5 Inventory & Items (42 functions) + +| Function | Purpose | +|----------|---------| +| `add_item_delete_log(in_item_id bigint, in_inventory_id bigint, in_template_id text)` | Log item delete | +| `add_item_trace_log(...)` | Log item movement | +| `advance_items_id_sequencer(count bigint)` | Advance item ID sequence | +| `delete_inventory_item(in_item_id bigint, in_count bigint)` | Delete inventory item | +| `get_inventory_data(in_inventory_id bigint)` | Get inventory data | +| `get_inventory_id(in_actor_id bigint, in_component_name_hash integer)` | Get inventory ID | +| `get_items_to_remove(items_to_remove text[])` | Get items to remove | +| `get_sub_inventory_id(in_owner_item_id bigint)` | Get sub-inventory ID | +| `load_items(in_inventory_id bigint)` | Load inventory items | +| `merge_inventory_items(in_item_id bigint, in_dst_inventory_id bigint, ...)` | Merge item stacks | +| `merge_or_move_inventory_item(in_item_id bigint, in_dst_inventory_id bigint, ...)` | Merge or move item | +| `move_inventory_item(in_item_id bigint, in_dst_inventory_id bigint, ...)` | Move item | +| `save_item(in_item dune.inventoryitem)` | Save item | +| `update_inventories_data(in_inventory_data_list dune.inventorydata[])` | Update inventories | +| `update_inventory(in_delete_list bigint[], in_stack_update dune.itemstackupdate[], ...)` | Update inventory | +| `update_item_locations(in_item_locations dune.inventoryitemlocation[])` | Update item locations | +| `admin_get_inventory_details(in_account_id bigint)` | Get inventory for account | +| `get_exchange_inventory_id(in_exchange_id bigint)` | Get exchange inventory | +| `get_vehicle_module_inventory_id(in_vehicle_module_id bigint, in_vehicle_module_inventory_type integer)` | Get module inventory | +| `load_building(in_building_id bigint)` | Load building data | +| `load_placeable(in_placeable_id bigint)` | Load placeable data | +| `load_totem(in_id bigint)` | Load totem data | +| `load_vehicle_modules(in_vehicle_id bigint)` | Load vehicle modules | +| `save_building(in_building_id bigint, in_data dune.buildingsavedata)` | Save building | +| `save_placeable(in_placeable_id bigint, in_data dune.placeablesavedata)` | Save placeable | +| `save_totem(in_id bigint, in_data dune.totemsavedata)` | Save totem | +| `save_vehicle_modules(in_add_list dune.vehiclemodule[], in_delete_list bigint[], ...)` | Save vehicle modules | +| `base_backup_delete(in_base_backup_id bigint)` | Delete base backup | +| `base_backup_find_totems_from_player_owner(in_player_id bigint)` | Find totems for backup | +| `base_backup_finish_placing(in_base_backup_id bigint)` | Finish placing backup | +| `base_backup_get_actors_to_spawn(in_base_backup_id bigint)` | Get actors to spawn | +| `base_backup_get_available_backups(in_player_id bigint)` | Get available backups | +| `base_backup_get_buildable_data(in_base_backup_id bigint)` | Get buildable data | +| `base_backup_get_data(in_base_backup_id bigint)` | Get backup data | +| `base_backup_get_totem_data(in_base_backup_id bigint)` | Get totem data | +| `base_backup_get_totem_data_from_totem_id(in_totem_id bigint)` | Get totem data by ID | +| `base_backup_get_totem_id(backup_id bigint)` | Get totem ID | +| `base_backup_recycle(in_base_backup_id bigint, in_target_inventory_id bigint)` | Recycle backup | +| `base_backup_save(in_player_actor_id bigint, in_base_backup_name text, ...)` | Save base backup | +| `base_backup_save_all_totems_from_player_owner(in_player_id bigint)` | Save all totems | +| `base_backup_save_from_totem(in_player_id bigint, totem_id bigint)` | Save from totem | +| `get_unbacked_up_vehicle_ids_for_account(in_account_id bigint)` | Get unbacked vehicles | + +### 2.6 Currency & Economy (21 functions) + +| Function | Purpose | +|----------|---------| +| `adjust_player_virtual_currency_balance(in_controller_id bigint, in_currency_id smallint, in_delta bigint)` | Adjust currency | +| `dune_exchange_add_sell_order(...)` | Add exchange sell order | +| `dune_exchange_cancel_order(in_order_id bigint, in_purge_time bigint, in_completion_type integer)` | Cancel order | +| `dune_exchange_expire_orders(in_exchange_id bigint, in_current_time bigint, ...)` | Expire orders | +| `dune_exchange_fulfill_sell_order(...)` | Fulfill sell order | +| `dune_exchange_get_item_price_stats(in_template_ids text[])` | Get price stats | +| `dune_exchange_get_user_id(in_owner_id bigint)` | Get exchange user ID | +| `dune_exchange_get_used_order_slots(in_controller_id bigint)` | Get used slots | +| `dune_exchange_modify_user_solari_balance(in_controller_id bigint, in_solari_delta bigint)` | Modify Solari | +| `dune_exchange_purge_completed_orders(in_exchange_id bigint, in_current_time bigint)` | Purge completed | +| `dune_exchange_query_storage_item(in_order_id bigint)` | Query storage item | +| `dune_exchange_query_storage_items(in_exchange_id bigint, in_owner_id bigint)` | Query storage items | +| `dune_exchange_relist_order(in_order_id bigint, in_expiration_time bigint, ...)` | Relist order | +| `dune_exchange_retrieve_solari_balance(in_owner_id bigint)` | Retrieve Solari | +| `dune_exchange_retrieve_solaris_from_item(in_controller_id bigint, in_order_id bigint)` | Retrieve from item | +| `dune_exchange_retrieve_storage_item(in_exchange_id bigint, in_order_id bigint, ...)` | Retrieve storage item | +| `dune_exchange_update_recurring_sell_order(...)` | Update recurring order | +| `get_dune_exchange_accesspoint_id(in_exchange_id bigint, in_name text)` | Get access point | +| `get_dune_exchange_data(in_exchange_id bigint, in_controller_id bigint)` | Get exchange data | +| `get_dune_exchange_id(in_name text)` | Get exchange ID | +| `get_player_virtual_currency_balances(in_controller_id bigint)` | Get currency balances | +| `get_solaris_id()` | Get Solari currency ID | +| `taxation_emit_invoices(new_tax_invoices dune.taxinvoicedata[])` | Emit tax invoices | +| `taxation_get_all_invoices_for_player(in_player_id bigint)` | Get player invoices | +| `taxation_get_all_invoices_for_server(map_name text, in_dimension_index integer, in_partition_id bigint)` | Get server invoices | +| `taxation_get_all_invoices_for_totem(in_totem_id bigint)` | Get totem invoices | +| `taxation_pay_invoice(invoice_id bigint, paid_invoice_status smallint)` | Pay invoice | +| `taxation_remove_invoices(invoices_to_remove bigint[])` | Remove invoices | +| `taxation_remove_invoices_from_totem(totem_actor_id bigint)` | Remove totem invoices | +| `taxation_update_invoice_status(...)` | Update invoice status | + +### 2.7 Journey & Progression (26 functions) + +| Function | Purpose | +|----------|---------| +| `complete_journey_nodes_where_prerequisite_nodes_are_complete(story_ids_to_complete text[], prerequisite_completed_story_ids text[])` | Complete nodes | +| `complete_journey_story_nodes_for_player(in_player_id text, in_story_node_ids text[])` | Complete for player | +| `create_or_update_tutorial_entry(in_player_id bigint, in_tutorial_id smallint, in_tutorial_state smallint)` | Create tutorial | +| `delete_all_journey_story_nodes(in_account_id bigint)` | Delete all nodes | +| `delete_all_tutorial_entries(in_player_id bigint)` | Delete tutorials | +| `delete_journey_story_ids(story_ids text[])` | Delete story IDs | +| `delete_journey_story_node(in_account_id bigint, in_story_node_id text)` | Delete node | +| `delete_journey_story_nodes_for_group_for_player(in_account_id bigint, in_reset_group dune.journeystoryresetgroup)` | Delete group | +| `delete_journey_story_nodes_for_player(in_player_id text, in_story_node_ids text[])` | Delete for player | +| `delete_journey_story_nodes_for_player_account(in_account_id bigint, in_story_node_ids text[])` | Delete for account | +| `get_all_tutorial_entries(in_player_id bigint)` | Get tutorials | +| `get_login_journey_nodes(in_account_id bigint)` | Get login nodes | +| `get_login_journey_nodes_cooldown(in_account_id bigint)` | Get cooldown | +| `journey_story_node_cooldown_add(in_account_id bigint, in_story_node_id text, in_time_to_expire timestamp)` | Add cooldown | +| `journey_story_node_cooldown_delete_expired(in_time_to_check timestamp)` | Delete expired | +| `load_actors(in_actor_ids bigint[], in_actor_state dune.actorstate)` | Load actors | +| `reset_journey_story_nodes_for_player(in_player_id text, in_story_node_ids text[])` | Reset nodes | +| `reveal_journey_story_nodes_for_player(in_player_id text, in_story_node_ids text[])` | Reveal nodes | +| `save_journey_story_node(in_account_id bigint, in_story_node_id text, ...)` | Save node | +| `save_journey_story_nodes(in_account_id bigint, in_journey_data dune.savejourneydata[])` | Save nodes | +| `update_journey_story_ids(old_story_ids text[], new_story_ids text[])` | Update IDs | +| `get_character_import_state(in_fls_id text)` | Get import state | +| `get_unresolved_character_imports()` | Get unresolved imports | +| `set_character_import_state(in_fls_id text, in_state dune.transferimportstate)` | Set import state | +| `remove_character_transfer_state(in_fls_id text)` | Remove transfer state | +| `get_character_transfer_related_items(in_fls_id text)` | Get transfer items | + +### 2.8 Specialization & Skills (7 functions) + +| Function | Purpose | +|----------|---------| +| `get_learned_building_sets(in_account_id bigint)` | Get learned sets | +| `get_learned_new_buildable_pieces(in_account_id bigint)` | Get learned pieces | +| `initialize_specialization_keystones(in_keystones text[])` | Initialize keystones | +| `purchase_specialization_keystone(in_player_id bigint, in_keystone text)` | Purchase keystone | +| `reset_specialization_keystones(in_player_id bigint)` | Reset keystones | +| `reset_specialization_tracks(in_player_id bigint)` | Reset tracks | +| `set_specialization_xp_and_level(in_player_id bigint, in_track_type dune.specializationtracktype, in_xp_amount integer, in_level real)` | Set XP/level | +| `update_specialization_refund_id(in_player_id bigint, in_refund_id smallint, in_removed_keystones smallint[])` | Update refund | +| `get_player_specialization(in_player_controller_id bigint)` | Get specialization | +| `get_player_keystones(in_player_controller_id bigint)` | Get keystones | + +### 2.9 Landsraad & Politics (25 functions) + +| Function | Purpose | +|----------|---------| +| `landsraad_cast_vote(in_term_id bigint, in_player_id bigint, in_decree_name text)` | Cast vote | +| `landsraad_change_term_end_time(end_term_id bigint, new_end_time timestamp, in_test_term boolean)` | Change term end | +| `landsraad_check_task_completion()` | Check task completion | +| `landsraad_check_term_won()` | Check term won | +| `landsraad_collect_task_telemetry_for_faction(in_term_id bigint, in_faction_name text)` | Collect telemetry | +| `landsraad_collect_term_telemetry(in_term_id bigint, in_faction_names text[])` | Collect term telemetry | +| `landsraad_collect_term_telemetry_for_faction(in_term_id bigint, in_faction_name text)` | Collect for faction | +| `landsraad_collect_vote_telemetry(in_term_id bigint, in_winning_faction_id integer)` | Collect vote telemetry | +| `landsraad_collect_votes(in_term_id bigint)` | Collect votes | +| `landsraad_determine_winner(in_term_id bigint)` | Determine winner | +| `landsraad_force_end_term(end_term_id bigint)` | Force end term | +| `landsraad_has_term_of_task_ended(in_task_id bigint)` | Check task ended | +| `landsraad_initialize_system(...)` | Initialize system | +| `landsraad_initialize_term(...)` | Initialize term | +| `landsraad_insert_task_progress(in_term_id bigint, in_player_id bigint, ...)` | Insert progress | +| `landsraad_insert_task_progress_batched(in_term_id bigint, in_task_progress dune.landsraadtaskprogress[])` | Batch insert | +| `landsraad_insert_task_progress_faction(in_term_id bigint, in_faction_name text, ...)` | Insert faction progress | +| `landsraad_insert_task_progress_random(in_term_id bigint, in_faction_names text[], in_num_rows integer)` | Random progress | +| `landsraad_load_current_rotation(in_term_id bigint)` | Load rotation | +| `landsraad_load_current_term()` | Load current term | +| `landsraad_load_guild_contribution(in_term_id bigint, in_guild_id bigint, in_faction_id bigint)` | Load guild contribution | +| `landsraad_load_guild_contributions(in_term_id bigint, in_num_guilds integer, in_faction_names text[])` | Load contributions | +| `landsraad_load_guild_vote(in_term_id bigint, in_player_id bigint)` | Load guild vote | +| `landsraad_load_house_rewards(in_player_id bigint)` | Load house rewards | +| `landsraad_load_player_contributions(in_term_id bigint, in_player_ids bigint[])` | Load contributions | +| `landsraad_load_task_faction_progress(in_term_id bigint)` | Load task progress | +| `landsraad_load_task_faction_reveal_state(in_term_id bigint)` | Load reveal state | +| `landsraad_load_term_progress(in_term_id bigint, in_num_guilds integer, ...)` | Load term progress | +| `landsraad_notify_house_rewards_changed()` | Notify rewards | +| `landsraad_perform_daily_task_reveal(in_term_id bigint, in_faction_names text[], ...)` | Daily reveal | +| `landsraad_process_house_rewards()` | Process rewards | +| `landsraad_process_task_progress(max_rows integer)` | Process progress | +| `landsraad_task_has_been_completed(in_task_id bigint)` | Check completed | +| `landsraad_update_task_faction_reveal_state(in_term_id bigint, in_task_board_index integer, faction_name text, reveal_state boolean)` | Update reveal | +| `landsraad_withdraw_house_reward(in_player_id bigint, in_house_rewards dune.landsraadplayerhousereward[])` | Withdraw reward | +| `get_player_landsraad(in_player_controller_id bigint)` | Get Landsraad data | + +### 2.10 World & Partitions (30 functions) + +| Function | Purpose | +|----------|---------| +| `add_partition_unique(in_map text, in_definition jsonb, in_dimension bigint, in_label text)` | Add partition | +| `determine_partition_label(in_map text, in_dimension_index integer, in_label text, in_allow_overwrite boolean, in_partition_id bigint)` | Determine label | +| `determine_partition_label_trigger()` | Label trigger | +| `get_partition_presets()` | Get presets | +| `get_partitions(in_map text)` | Get partitions for map | +| `igwo_delete_world_partitions(in_partition_ids bigint[])` | Delete partitions | +| `igwo_get_partition_id_seq_last_value()` | Get sequence value | +| `igwo_get_partition_ids()` | Get partition IDs | +| `igwo_get_partitions()` | Get all partitions | +| `igwo_get_server_details()` | Get server details | +| `igwo_insert_world_partition(in_partition_id bigint, in_map text, in_partition_definition jsonb, ...)` | Insert partition | +| `igwo_next_partition_id_seq()` | Next sequence | +| `igwo_notify_world_partition_update()` | Notify update | +| `igwo_restart_partition_id_seq(in_restart_with bigint)` | Restart sequence | +| `igwo_update_world_partition(in_map text, in_partition_definition jsonb, in_partition_id bigint, ...)` | Update partition | +| `initialize_partitions_basic_battlegroup()` | Init basic BG | +| `initialize_partitions_basic_survival_1()` | Init survival | +| `initialize_partitions_development_battlegroup()` | Init development | +| `initialize_partitions_editor_default_1x1()` | Init editor | +| `initialize_partitions_full_battlegroup()` | Init full BG | +| `initialize_partitions_igw_test_small_2x1()` | Init test 2x1 | +| `initialize_partitions_igw_test_small_2x2()` | Init test 2x2 | +| `initialize_partitions_igw_training()` | Init training | +| `initialize_world_partition(in_map_name text, in_num_servers integer, in_dimension_index integer)` | Init partition | +| `load_dimension_index(in_map text, in_partition_id bigint)` | Load dimension | +| `load_partition_definition_map()` | Load definition map | +| `load_world_partition(in_map_name text, in_server_id text, in_desired_dimension_index bigint, in_desired_partition_id bigint)` | Load partition | +| `save_world_partition(in_map_name text, in_server_id text, in_dimension_index bigint, ...)` | Save partition | +| `unassign_partition(in_server_id text)` | Unassign partition | +| `update_partition_labels(in_allow_overwrite boolean)` | Update labels | +| `get_battlegroup_close_date()` | Get close date | +| `set_battlegroup_close_date(in_close_date timestamp)` | Set close date | + +### 2.11 Spice Fields & Coriolis (24 functions) + +| Function | Purpose | +|----------|---------| +| `corilis_cleanup_map(in_server_info dune.serverinfo, in_map_info dune.coriolismapinfo)` | Cleanup map | +| `coriolis_cleanup_farm(in_server_info dune.serverinfo, in_map_info dune.coriolismapinfo)` | Cleanup farm | +| `coriolis_cleanup_partition(in_server_info dune.serverinfo, in_map_info dune.coriolismapinfo)` | Cleanup partition | +| `coriolis_update_seed(in_server_info dune.serverinfo, in_new_coriolis_seed integer, in_map_info dune.coriolismapinfo)` | Update seed | +| `debug_set_farm_seed(in_new_coriolis_seed integer)` | Set farm seed | +| `debug_set_map_seed(in_map text, in_new_coriolis_seed integer)` | Set map seed | +| `debug_set_partition_seed(in_partition_id bigint, in_new_coriolis_seed integer)` | Set partition seed | +| `fetch_resourcefield_state(in_map text, in_dimension_index integer, in_field_kind_id smallint)` | Fetch field state | +| `fetch_server_spice_field_manifest(in_server_id text)` | Fetch spice manifest | +| `fetch_spicefie_id_types_with_global_info(in_map_name text, in_dimension_index integer)` | Fetch spice types | +| `get_farm_state()` | Get farm state | +| `get_stored_user_data_encryption_key_hash()` | Get encryption key | +| `get_stored_user_data_encryption_status()` | Get encryption status | +| `get_stored_user_data_encryption_taint_xmax()` | Get taint status | +| `produce_spicefield_manifest(in_map_name text, in_dimension_index integer)` | Produce manifest | +| `record_deactivated_spice_field(in_server_id text, in_spicefield_type_id integer)` | Record deactivated | +| `record_static_shifting_sand(in_id text, in_alpha double precision, ...)` | Record shifting sand | +| `record_unreadied_spice_fields(in_server_id text, in_spicefield_type_id integer, in_num_unreadied integer)` | Record unreadied | +| `request_spawn_spice_field(in_server_id text, in_spicefield_type_id integer)` | Request spawn | +| `reset_global_spice_field_state(in_map_name text, in_dimension_index integer)` | Reset state | +| `retrieve_all_static_shifting_sand()` | Retrieve all sand | +| `try_prime_spicefield(in_source_server_id text, in_spicefield_id integer)` | Try prime | +| `try_restart_spicefield(in_server_id text, in_spicefield_type_id integer)` | Try restart | +| `try_spawn_spicefield(in_source_server_id text, in_spicefield_id integer)` | Try spawn | +| `try_update_exchange_categories_hash(in_new_hash integer)` | Update hash | +| `update_global_spice_field_rules(in_max_globally_primed integer, in_max_globally_active integer, in_spicefield_type_id integer)` | Update rules | +| `update_spice_field_spawn_state(in_is_spawning_active boolean, in_spicefield_type_id integer)` | Update spawn state | +| `upsert_spicefield_types(in_max_globally_active integer[], ...)` | Upsert types | + +### 2.12 Chat & Communication (18 functions) + +| Function | Purpose | +|----------|---------| +| `add_event_log_data(in_game_event_owner bigint, in_universe_time bigint, ...)` | Add event log | +| `add_event_log_data_batched(in_data dune.eventlogbulkentrydata[])` | Batch add events | +| `add_map_areas_surveyed_items(in_account_id bigint, in_area_id smallint, ...)` | Add surveyed items | +| `add_map_areas_time_discovered(in_account_id bigint, in_area_id smallint, ...)` | Add discovered time | +| `add_map_areas_time_first_entered(in_account_id bigint, in_area_id smallint, ...)` | Add first entered | +| `clean_expired_party_invites(in_invite_expire_seconds integer)` | Clean expired invites | +| `create_event_log_partition()` | Create log partition | +| `delete_all_static_shifting_sand()` | Delete all sand | +| `get_all_player_travel_states()` | Get travel states | +| `get_online_player_controller_ids(in_map text)` | Get online on map | +| `get_online_player_controller_ids_on_farm()` | Get online on farm | +| `get_player_online_state_within_grace_period_for_each_server()` | Get grace period | +| `load_events_log_data_from_player(in_actor_id bigint, in_limit_entries_num integer)` | Load player events | +| `log_cheating(in_fls_id text, in_cheat_type dune.cheat_type_enum, in_event_time timestamp)` | Log cheating | +| `log_event_solaris(in_function_oid oid, in_message dune.logmessagetype, ...)` | Log Solari event | +| `set_all_inactive_players_in_farm_offline()` | Set inactive offline | +| `set_players_from_server_ids_offline(in_server_ids text[])` | Set servers offline | +| `wipe_old_events_log(in_days_limit integer)` | Wipe old logs | +| `get_active_servers_for_gateway()` | Get active servers | + +### 2.13 Account & Authentication (25 functions) + +| Function | Purpose | +|----------|---------| +| `can_takeover_account(in_user_id text)` | Check takeover | +| `cleanup_account_log_and_orphaned_actors()` | Cleanup orphans | +| `cleanup_accounts_marked_for_deletion_in_fls(in_account_ids text[])` | Cleanup FLS deletes | +| `decrypt_user_data(in_encrypted_data bytea)` | Decrypt data | +| `delete_account(in_user_id text, in_reason text)` | Delete account | +| `dune_get_account_id_by_user(in_user text)` | Get account by user | +| `encrypt_user_data(in_data text)` | Encrypt data | +| `get_account_actor_ids(in_account_id bigint)` | Get account actors | +| `get_controller_id_from_platform_id(in_platform_id text)` | Get controller ID | +| `get_encrypted_account(...)` | Get encrypted account | +| `get_friends_search(in_player_name text, in_max_players_count integer)` | Search friends | +| `get_player_infos_for_character_names(in_character_names text[])` | Get by character name | +| `get_player_infos_for_fls_ids(in_fls_ids text[])` | Get by FLS ID | +| `get_player_infos_for_funcom_ids(in_funcom_ids text[])` | Get by Funcom ID | +| `get_player_pawn(in_account_id bigint)` | Get player pawn | +| `get_takeoverable_user_ids()` | Get takeoverable IDs | +| `load_takeoverable_user_ids()` | Load takeoverable | +| `login_account(in_user_id text, in_funcom_id text, ...)` | Login account | +| `perform_notify_on_character_delete(in_user_id text)` | Notify on delete | +| `set_account_as_takeoverable(in_user_id text, in_new_user_id text)` | Set takeoverable | +| `takeover_account(in_user_to_takeover text, in_current_user text)` | Takeover account | +| `update_returning_player_status(in_user_id text, in_minimum_returning_player_time_seconds integer)` | Update returning | +| `get_demo_state(in_user_id text)` | Get demo state | +| `set_demo_state(in_user_id text, in_demo_state dune.demostate)` | Set demo state | +| `save_demo_account_time(in_fls_id text, in_demo_playtime_seconds integer)` | Save demo time | + +### 2.14 Markers & Map Data (20 functions) + +| Function | Purpose | +|----------|---------| +| `create_sinkchart_for_map_area_id(in_item_id bigint, in_creator_id bigint, ...)` | Create sinkchart | +| `delete_map_markers(in_dimension_index integer, in_map_name text, in_player_marker_data dune.deleteplayermarkerdata[])` | Delete markers | +| `delete_markers_by_id(in_marker_ids integer[])` | Delete by ID | +| `delete_markers_by_static_location_key(p_location_key text)` | Delete by location | +| `delete_markers_for_all_players(in_marker_types_to_keep text[], in_map text)` | Delete for all | +| `delete_markers_return_actor_ids(in_dimension_index integer, in_map_name text, in_marker_ids integer[])` | Delete and return | +| `delete_static_location_markers(p_location_keys text[])` | Delete static | +| `load_markers(in_player_id bigint, in_dimension_id integer, in_map_name text)` | Load markers | +| `load_map_areas_entries(in_account_id bigint, in_map_name text)` | Load map areas | +| `save_markers(in_player_marker_data dune.saveplayermarkerdata[], in_marker_data dune.savemarkerdata[])` | Save markers | +| `update_marker_ids(in_old_ids integer[], in_new_ids integer[])` | Update marker IDs | +| `use_sinkchart(in_player_id bigint, in_account_id bigint, in_area_id smallint, ...)` | Use sinkchart | +| `clear_map_areas_data_for_player(in_id bigint)` | Clear map data | +| `get_map_areas_entries(in_account_id bigint, in_map_name text)` | Get map areas | +| `load_static_encounter_name(in_map_name text, in_package_name text, in_actor_name text)` | Load encounter | +| `save_static_encounter_name(in_map_name text, in_package_name text, in_actor_name text, in_encounter_name text)` | Save encounter | +| `save_static_encounter_waiting_for_reset(in_map_name text, in_package_name text, in_actor_name text, in_waiting_for_reset boolean)` | Save waiting reset | +| `upgrade_location_data_list(in_location_data_list jsonb, in_map_field_name text)` | Upgrade location | +| `upgrade_map_name(in_map_name text)` | Upgrade map name | +| `upgrade_map_value(in_value jsonb)` | Upgrade map value | +| `downgrade_map_name(in_map_name text)` | Downgrade map name | + +### 2.15 Permissions & Ownership (16 functions) + +| Function | Purpose | +|----------|---------| +| `get_permission_actors_for_server(in_server_info dune.serverinfo)` | Get server permissions | +| `get_permission_for_actor(in_actor_id bigint)` | Get actor permission | +| `get_permission_for_actors(in_actor_id bigint[])` | Get actors permissions | +| `get_permission_for_player_actors(in_player_id bigint, in_min_rank smallint)` | Get player permissions | +| `ownership_handle_actor_delete(in_player_id bigint)` | Handle ownership delete | +| `permission_actor_create_or_update_base_marker(in_actor_id bigint, in_player_id bigint, in_rank smallint)` | Create marker | +| `permission_actor_destroy(in_actor_id bigint)` | Destroy permission | +| `permission_actor_register(in_entry dune.actorpermissionentry, in_owner_rank dune.actorpermissionrankdata)` | Register permission | +| `permission_actor_takeover(in_entry dune.actorpermissionentry, in_owner_rank dune.actorpermissionrankdata)` | Takeover permission | +| `permission_actor_update_marker_location(in_actor_id bigint, in_location_x real, in_location_y real, in_location_z real)` | Update location | +| `permission_remove_player_rank(in_actor_id bigint, in_player_id bigint)` | Remove rank | +| `permission_set_access_level(in_actor_id bigint, in_access_level smallint)` | Set access level | +| `permission_set_name(in_actor_id bigint, in_name text)` | Set name | +| `permission_set_player_rank(in_actor_id bigint, in_player_id bigint, in_rank smallint, in_map_id text)` | Set player rank | +| `gather_ownerless_actors_on_server(in_server_info dune.serverinfo)` | Gather ownerless | +| `gather_player_linked_actors(in_player_pawn_id bigint)` | Gather linked actors | +| `gather_removed_accounts_that_left_orphaned_actors_on_server(in_server_info dune.serverinfo)` | Gather orphans | +| `cleanup_orphaned_entities()` | Cleanup orphans | + +### 2.16 Travel & Movement (17 functions) + +| Function | Purpose | +|----------|---------| +| `get_traveling_actor_id_and_types(in_actor_id bigint)` | Get traveling actor | +| `get_traveling_actor_ids(in_actor_id bigint, in_max_recursion_level integer)` | Get traveling IDs | +| `get_traveling_actors_fls_ids(in_actor_id bigint)` | Get traveling FLS IDs | +| `get_traveling_non_player_actor_ids(in_actor_id bigint)` | Get non-player IDs | +| `load_travel_return_info(in_player_controller_id bigint)` | Load return info | +| `load_travel_to_player_info(in_player_controller_id bigint)` | Load travel info | +| `remove_aborted_authority_transfer_actors(in_partition_id bigint)` | Remove aborted | +| `save_aborted_authority_transfer_actors(in_actor_ids bigint[], in_partition_id bigint)` | Save aborted | +| `save_actor_dislocation(in_actor_id bigint, in_current_server_info dune.serverinfo, in_target_location vector, in_target_dimension_index integer)` | Save dislocation | +| `save_travel_return_info(in_player_controller_id bigint, in_map text, in_transform dune.transform)` | Save return info | +| `update_traveling_actor_dependencies(in_dep dune.traveldependency[])` | Update dependencies | +| `update_traveling_actor_tree(in_actor_id bigint, in_target_transform dune.transform, ...)` | Update actor tree | +| `get_actors_location_data_with_permission(in_actor_ids bigint[])` | Get location data | +| `get_actor_server_info(in_id bigint)` | Get server info | +| `server_info_match(in_actor dune.actors, in_server_info dune.serverinfo)` | Match server info | +| `delete_actors_and_respawns_on_server(in_server_info dune.serverinfo, ...)` | Delete on server | +| `mark_server_dead(in_server_id text)` | Mark server dead | + +### 2.17 Utility & Helper Functions (30+ functions) + +| Function | Purpose | +|----------|---------| +| `assign_actor_id(in_class text)` | Assign actor ID | +| `add_actor_audit(in_id bigint, in_class text)` | Add actor audit | +| `delete_actors(in_ids bigint[])` | Delete actors | +| `delete_actor_states_travel(in_actor_id bigint)` | Delete travel state | +| `delete_all_dungeon_completions(in_dungeon_id text)` | Delete completions | +| `delete_all_dungeon_completions_by_player(in_dungeon_id text, in_player_id bigint, ...)` | Delete by player | +| `delete_all_dungeon_completions_for_all_dungeons_by_player(in_player_id bigint, ...)` | Delete all dungeons | +| `delete_dialogue_data(in_player_controller_id bigint)` | Delete dialogue | +| `delete_world_partition_by_map_id(in_map_id text)` | Delete partition | +| `find_actor_by_id(in_id bigint)` | Find actor | +| `fix_broken_harkonnen_players_due_to_fooled_thufir()` | Fix Harkonnen bug | +| `get_actor_server_info(in_id bigint)` | Get actor server | +| `get_all_player_character_home_dimensions()` | Get home dimensions | +| `get_best_dungeon_completion(in_dungeon_id text)` | Get best completion | +| `get_best_dungeons_completions_for_player(in_player_id bigint)` | Get best dungeons | +| `get_dungeon_completion(in_dungeon_id text, in_player_id bigint)` | Get completion | +| `get_partition_id_for_server(in_server_id text)` | Get partition ID | +| `get_player_partition_id(in_fls_id text)` | Get player partition | +| `get_registered_spawned_actor(in_spawner_id bigint)` | Get spawned actor | +| `get_respawn_locations(in_account_id bigint)` | Get respawn locations | +| `get_universe_time()` | Get universe time | +| `get_vehicle_id(in_actor_id bigint, in_class text)` | Get vehicle ID | +| `load_full_actors(in_ids bigint[])` | Load full actors | +| `record_dungeon_completion(in_dungeon_id text, in_difficulty integer, in_duration_ms integer, players_ids bigint[])` | Record completion | +| `register_spawned_actor(in_spawner_id bigint, in_actor_id bigint)` | Register spawned | +| `reset_all_players_from_server_ids_grace_period_and_logoff_timer(in_server_id text, in_reset_time timestamp)` | Reset grace period | +| `save_actors(in_server_info dune.serverinfo, in_actors dune.actordescription[], in_actor_state dune.actorstate)` | Save actors | +| `save_player(in_player dune.playerdescription)` | Save player | +| `save_player_pawn(in_pawn dune.actordescription, in_server_info dune.serverinfo, in_life_state dune.playerlifestate)` | Save pawn | +| `update_farm_state(in_server_id text, in_outgoing_s2s_connections integer, ...)` | Update farm state | +| `update_server_building_favorites(in_account_id bigint, in_building_types text[])` | Update favorites | +| `update_server_learned_building_sets(in_account_id bigint, in_learned_building_sets text[])` | Update learned sets | +| `update_server_learned_new_buildable_pieces(in_account_id bigint, in_new_buildable_pieces text[])` | Update learned pieces | +| `update_universe_time(in_farm_id text)` | Update universe time | +| `zero_transform()` | Zero transform | +| `get_applied_patches()` | Get applied patches | +| `get_universe_time()` | Get universe time | + +--- + +## 3. RabbitMQ Exchanges & Queues + +### 3.1 Game Exchanges (mq-game at port 32716) + +| Exchange | Type | Purpose | +|----------|------|---------| +| `heartbeats` | direct | In-game broadcasts and notifications | +| `rpc` | direct | Server RPC calls (currently no bindings) | +| `notifications` | topic | General notifications | +| `chat.faction.1-4` | fanout | Faction chat channels (4 factions) | +| `chat.guild.*` | fanout | Guild chat channels | +| `chat.intercept` | topic | Chat intercept/filtering | +| `chat.proximity` | direct | Proximity-based chat | +| `chat.whispers` | direct | Private whispers | +| `chat.map` | direct | Map-wide chat | +| `login_grant` | direct | Login grant messages | +| `login_request` | direct | Login requests | +| `login_response` | direct | Login responses | +| `status.*` | fanout | Per-map status (Overmap, Survival_1, DeepDesert_1, etc.) | +| `travel_queue_status` | topic | Travel queue updates | +| `director_respawned` | fanout | Respawn events from director | + +### 3.2 Admin Exchanges (mq-admin at port 30325) + +| Exchange | Type | Messages Published | Purpose | +|----------|------|-------------------|---------| +| `completions` | direct | 723 | Completion events | +| `response` | direct | 64K+ | Response routing | +| `settingsUpdate` | fanout | 71 | Server settings updates | +| `travel` | topic | - | Travel messages | +| `travelQueueStatus` | fanout | 1K+ | Travel queue status | +| `grant` | direct | - | Grant messages | +| `heartbeats` | direct | 2K+ | Heartbeat messages | +| `rpc` | direct | - | RPC messages | +| `director_respawned` | fanout | - | Respawn events | + +### 3.3 Game Queues + +| Queue | Consumers | Purpose | +|-------|-----------|---------| +| `B17A5F036D1F7882_queue` | - | Host-specific queue | +| `bgdRpc` | 1 | BGD RPC responses | +| `loginRequests` | 1 | Login request queue | +| `queue.intercept` | 1 | Chat intercept queue | +| `queue.server.*` (5 queues) | 1 each | Per-server queues | + +--- + +## 4. BGD Director API Endpoints + +### 4.1 Player Endpoints + +| Endpoint | Method | Response | Purpose | +|----------|--------|----------|---------| +| `/v0/players` | GET | `["FLS_ID"]` | List all player FLS IDs | +| `/v0/players/online` | GET | `["FLS_ID"]` | List online players | +| `/v0/players/intransit` | GET | `[]` | Players in transit | +| `/v0/players/graceperiod` | GET | `[]` | Players in grace period | +| `/v0/players/completion` | GET | `[]` | Completion queue | +| `/v0/players/queued` | GET | `[]` | Queued players | + +### 4.2 Battlegroup Endpoints + +| Endpoint | Method | Response | Purpose | +|----------|--------|----------|---------| +| `/v0/battlegroup` | GET | Full JSON | Complete battlegroup state (maps, servers, players, configs) | +| `/` | GET | HTML | Web dashboard UI | + +### 4.3 FLS Settings Endpoints + +| Endpoint | Method | Purpose | +|----------|--------|---------| +| `/v0/BattlegroupFetchFlsReportSettings` | GET | Fetch FLS report settings | +| `/v0/BattlegroupUpdateFlsReportSettings` | POST | Update FLS report settings | +| `/v0/BattlegroupClearFlsReportOverrides` | POST | Clear FLS overrides | + +### 4.4 Battlegroup JSON Structure + +The `/v0/battlegroup` endpoint returns: +- `dimensionMaps[]` — Multi-server maps with partitions +- `singleServerMaps[]` — Single-server maps +- `instancedMaps[]` — Instanced content (dungeons, gyms, etc.) +- Per-server data: `partition`, `ip`, `gamePort`, `numPlayers*`, `status`, `cfg`, `lastServerState` +- `serverGameplaySettings`: hydration, sandstorm, sandworm, PvP, security zones, mining multiplier, durability + +### 4.5 Map Types Managed by BGD + +- **Survival** — Survival mode maps +- **Story** — Story mission maps +- **Challenge Rooms** — Combat challenges +- **CB (Combat Block)** — PvP combat zones +- **DLC Content** — DLC-specific maps +- **Test Gyms** — Testing/training areas +- **Overmap** — Main overworld +- **Deep Desert** — Endgame PvP zone +- **Arrakeen** — City zone +- **Harko Village** — NPC village + +--- + +## 5. Kubernetes Resources + +### 5.1 World Namespace Pods + +| Pod Pattern | Purpose | +|-------------|---------| +| `{world}-mq-admin-sts-0` | RabbitMQ admin instance | +| `{world}-mq-game-sts-0` | RabbitMQ game instance | +| `{world}-tr-deploy-*` | Text Router (RMQ auth) | +| `{world}-bgd-deploy-*` | Battlegroup Director | +| `{world}-sgw-deploy-*` | Server Gateway | +| `{world}-db-dbdepl-*` | PostgreSQL database | +| `{world}-fb-deploy-*` | File Browser | +| `{world}-sg-overmap-pod-*` | Overmap game server | +| `{world}-sg-survival-1-pod-*` | Survival game server | +| `{world}-sg-deepdesert-1-pod-*` | Deep Desert server | +| `{world}-sg-arrakeen-pod-*` | Arrakeen server | +| `{world}-sg-harkovillage-pod-*` | Harko Village server | + +### 5.2 Operator Deployments (funcom-operators namespace) + +| Deployment | Purpose | +|------------|---------| +| `battlegroupoperator-controller-manager` | Manages BattleGroup CRDs | +| `databaseoperator-controller-manager` | Manages database lifecycle | +| `serveroperator-controller-manager` | Manages ServerGroup CRDs | +| `utilitiesoperator-controller-manager` | Manages utility services | + +### 5.3 Services (NodePort) + +| Service | NodePort | Purpose | +|---------|----------|---------| +| `bgd-svc` | 30553 | BGD Director API | +| `mq-admin-svc` | 30325 | RMQ Admin Management UI | +| `mq-admin-svc` | 32729 | RMQ Admin AMQP (TLS) | +| `mq-game-svc` | 32716 | RMQ Game Management UI | +| `mq-game-svc` | 31982 | RMQ Game AMQP (TLS) | + +--- + +## 6. Game Tables Reference + +### 6.1 Core Tables + +| Table | Rows | Purpose | +|-------|------|---------| +| `encrypted_accounts` | 10 | Encrypted account data | +| `encrypted_player_state` | 10 | Encrypted player state | +| `actors` | 411 | All game entities (players, NPCs, vehicles, buildings) | +| `items` | 1,482 | Inventory items | +| `inventories` | 459 | Inventory containers | +| `buildings` | 8 | Player buildings | +| `vehicles` | 16 | Player vehicles | +| `guilds` | 1 | Guilds | +| `factions` | 4 | Factions (Atreides, Harkonnen, Fremen, Corrino) | +| `bans` | 0 | Banned players | +| `game_events` | 76 | Game event log | + +### 6.2 Configuration Tables + +| Table | Rows | Purpose | +|-------|------|---------| +| `world_partition` | 30 | Server partition configuration | +| `dune_exchanges` | 1 | Exchange configuration | +| `landsraad_decrees` | 11 | Landsraad decrees | +| `landsraad_tasks` | 25 | Landsraad tasks | + +### 6.3 Dashboard Tables + +| Table | Purpose | +|-------|---------| +| `dashboard.bans` | Ban records with duration/reason | +| `dashboard.player_actions` | Admin action audit log | +| `dashboard.player_ips` | Player IP address tracking | +| `dashboard.chat_history` | Chat message archive | + +--- + +## Appendix: Common Admin Workflows + +### A.1 Ban a Player +1. Search for player by name +2. Get player_controller_id +3. Call `POST /api/ban_player` with duration and reason +4. Optionally detect player IP and apply iptables block + +### A.2 Teleport a Player +1. Ensure player is offline (check online status) +2. Get partition ID from `GET /api/admin-experimental/partitions` +3. Call `POST /api/admin-experimental/teleport` with FLS ID, partition ID, coordinates + +### A.3 Send In-Game Broadcast +1. Go to Admin Experimental tab +2. Enter title, message, duration +3. Click "Send Broadcast" +4. Message appears for all connected players + +### A.4 Fix a Stuck Player +1. Search for player +2. Check online status +3. If stuck: set offline via `set_players_from_server_ids_offline` +4. Teleport to safe location +5. Reset vitals if needed + +### A.5 Investigate Cheating +1. Search for player +2. View player stats (check for impossible values) +3. View inventory (check for duped items) +4. If confirmed: `flag_player_as_cheater` +5. Ban player and block IP + +--- + +**End of Reference** diff --git a/AI_DUNE_AWAKENING_SYSTEM_CONTEXT.md b/AI_DUNE_AWAKENING_SYSTEM_CONTEXT.md new file mode 100644 index 0000000..86eb833 --- /dev/null +++ b/AI_DUNE_AWAKENING_SYSTEM_CONTEXT.md @@ -0,0 +1,1224 @@ +# Dune Awakening — Full System Context for AI Continuation + +> **Last updated:** 2026-05-22 (production VPS at 65.21.198.100, cluster fully running) +> **VM Hostname:** `duneawakening` (Alpine Linux 3.23.4, K3s single-node) +> **Server IP:** `65.21.198.100` +> **Dashboard repo:** `C:\Users\Reditus\OneDrive\Documents\GitHub\dune-dashboard-private` +> **This doc path:** `C:\Users\Reditus\Downloads\DUNE_AWAKENING_SYSTEM_CONTEXT.md` +> **⚠️ SECURITY: NEVER commit this doc or any credentials to GitHub.** + +--- + +## ⚠️ YOUR MISSION (read this first) + +You are continuing work on a **Dune Awakening private game server**. Your job is to help access and configure admin settings on the game server. Everything you need is in this document. + +### What to do +1. **Read this entire document** — it contains the full architecture, credentials, connection methods, and what's been tried. +2. **Connect to the VM** via SSH (see section 1), run kubectl commands, explore the cluster. +3. **Continue from section 12** ("What's Still Unknown / Next Steps") — that's the active work queue. +4. **Update this document** with any new findings, credentials discovered, or progress made. +5. **Ask the user** only when you genuinely need a decision or something is blocked. Otherwise, just do it. + +### How to work +- All kubectl commands need `sudo` on the VM. +- PowerShell has tricky quoting — use script files piped via SSH for complex commands (`tr -d '\r'` to strip CRLF). +- The SSH tunnel for the dashboard (localhost:15433 → DB, localhost:32479 → BGD) may need restarting if down. +- When you find new credentials or endpoints, **add them to this document immediately**. +- **NEVER commit or push to GitHub.** The doc lives in Downloads for a reason. + +### Current priorities +- ✅ **DONE:** DB schema migration succeeded — cluster is fully running. See finding #19. +- ✅ **DONE:** RMQ Management UI accessible with `admin:admin123`. See finding #20. +- ✅ **DONE:** `send-dune-broadcast` tested and working on live server. See finding #21. +- **High:** Add custom broadcast title/identity (e.g., "Dune Admin" instead of hardcoded FLS backend) +- **Medium:** Integrate broadcast functionality into the dashboard admin panel. +- **Medium:** Scale operators back up (currently scaled to 0). + +--- + +## 1. HOW TO CONNECT + +### SSH to VM +```powershell +ssh -i "$env:LOCALAPPDATA\DuneAwakeningServer\sshKey" -o StrictHostKeyChecking=accept-new dune@65.21.198.100 +``` +**Note:** Production VPS at `65.21.198.100`. Hostname: `duneawakening`, Alpine Linux 3.23.4, K3s single-node. No longer a local Hyper-V VM. + +**Installed tools on VM (2026-05-22):** `curl`, `python3`, `py3-pip` (via `apk add`) + +**⚠️ SCP does not work on this VM** (no `sftp-server`). Use pipe method instead: +```powershell +Get-Content -Raw script.sh | ssh -i "" dune@65.21.198.100 "cat > /tmp/script.sh && tr -d '\r' < /tmp/script.sh > /tmp/script_clean.sh && mv /tmp/script_clean.sh /tmp/script.sh && chmod +x /tmp/script.sh && bash /tmp/script.sh" +``` + +### SSH Tunnel (maintained by dashboard launcher, PID 31172) +| Local Port | Forwards To | Purpose | +|-----------|-------------|---------| +| `localhost:15433` | VM:DB cluster IP (15432) | PostgreSQL | +| `localhost:32479` | VM:BGD NodePort 31403 | BGD Director API | + +### Kubectl on VM +```bash +# All commands need sudo +sudo kubectl get pods -A +sudo kubectl get svc -A +sudo kubectl get secrets -A +sudo kubectl logs -n +sudo kubectl exec -n -- +``` + +### BGD Web UI +- `http://192.168.0.101:31403/` — web dashboard with player stats +- `http://10.43.173.27:11717/` — via cluster IP (from inside VM) + +--- + +## 2. ARCHITECTURE OVERVIEW + +``` +Windows Host Hyper-V VM (192.168.0.101 / dune-awakening) +┌────────────────────┐ ┌─────────────────────────────────────────────┐ +│ Dashboard │ │ K3s Cluster (single node) │ +│ (Flask/SocketIO) │ ───SSH─────→ │ │ +│ Port 5050 │ tunnel │ ┌──────────────────────────────────────┐ │ +│ │ │ │ funcom-seabass-{WORLD_ID}-whxlri │ │ +│ RabbitMQ UI: │ │ │ │ │ +│ 192.168.0.101: │ │ │ mq-admin-sts (RabbitMQ admin) │ │ +│ 32253 (admin) │ │ │ mq-game-sts (RabbitMQ game) │ │ +│ 31745 (game) │ │ │ tr-deploy (Text Router / Auth) │ │ +│ │ │ │ bgd-deploy (Battlegroup Director) │ │ +│ │ │ │ sgw-deploy (Server Gateway) │ │ +│ │ │ │ db-dbdepl (PostgreSQL) │ │ +│ │ │ │ sg-overmap (Overmap game server) │ │ +│ │ │ │ sg-survival-1 (Pending - unsched) │ │ +│ │ │ │ fb-deploy (File Browser) │ │ +│ │ │ │ │ │ +│ │ │ │ funcom-operators namespace: │ │ +│ │ │ │ battlegroupoperator │ │ +│ │ │ │ databaseoperator │ │ +│ │ │ │ serveroperator │ │ +│ │ │ │ utilitiesoperator │ │ +│ │ │ └──────────────────────────────────────┘ │ +│ │ │ │ +│ │ │ VM Scripts: /home/dune/.dune/download/ │ +│ │ │ scripts/{battlegroup.sh, bg-util, ...} │ +│ │ │ images/battlegroup/*.tar (Docker images) │ +│ │ └─────────────────────────────────────────────┘ +``` + +--- + +## 3. ALL EXPOSED SERVICES (NodePort on 65.21.198.100) + +| Service | Type | ClusterIP | NodePort | Internal Ports | Purpose | +|---------|------|-----------|----------|---------------|---------| +| bgd-svc | NodePort | 10.43.92.250 | **30553** | 11717 | BGD Director web UI + API | +| mq-admin-svc | NodePort | 10.43.78.227 | **30325** | 15672 (HTTP) | RMQ Admin Management UI ✅ | +| mq-admin-svc | NodePort | 10.43.78.227 | **32729** | 5672 (AMQP) | RMQ Admin AMQP (TLS) | +| mq-game-svc | NodePort | 10.43.79.0 | **32716** | 15672 (HTTP) | RMQ Game Management UI ✅ | +| mq-game-svc | NodePort | 10.43.79.0 | **31982** | 5672 (AMQP) | RMQ Game AMQP (TLS) | +| db-dbdepl-svc | ClusterIP | 10.43.14.243 | - | 15432 | PostgreSQL | +| tr-svc | ClusterIP | 10.43.40.75 | - | 5059 | Text Router (RMQ auth) | + +**Note:** NodePorts are dynamically assigned and change on each install. Always check with `sudo kubectl get svc -n `. + +**Current (2026-05-22 production):** RMQ Admin UI at `http://65.21.198.100:30325`, RMQ Game UI at `http://65.21.198.100:32716`. Both accessible from outside the server. + +--- + +## 4. CREDENTIALS FOUND + +### RMQ HTTP Token Auth Secret (SIGNING KEY — NOT a password) +``` +gZQbpwOA6ow190HgLKDfxy9zZoRWejTJ1Trp+fnMQkNapY7TEdQ6RIXbLUVAlpPtbaz9pGLW8M8LWnjOfsCTKQ== +``` +- Base64-decoded: 64 bytes +- Used by: TR (Text Router) service to validate RMQ authentication tokens +- Stored in: `rmq-game-secret` Kubernetes secret +- Also present as env var in: BGD pod, SGW pod, TR pod, mq-admin pod, mq-game pod + +### FuncomLiveServices Service Auth Token (JWT) +``` +eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJIb3N0SWQiOiJCMTdBNUYwMzZEMUY3ODgyIiwiVG9rZW5JbmRleCI6IjEiLCJTZXJ2aWNlQXV0aEtleSI6IjI4RVVGOFMyM2dnQXdNWjQwUjRCQUZ1TTVFbkswM3RHeDZLY1h3Q0Vkc3FEcmVoUExxWFhGS0ZNcUIyYlNCUmYiLCJTZXJ2aWNlSG9zdFR5cGUiOiIyIiwibmJmIjoxNzc5MzE4MjQ1LCJleHAiOjE4MTA4NTQyNDUsImlhdCI6MTc3OTMxODI0NX0.yNenOJVmshIg1OcTEt0UeEmdUBnTQn2Gov098znvHMg +``` +**Decoded payload:** +```json +{ + "HostId": "B17A5F036D1F7882", + "TokenIndex": "1", + "ServiceAuthKey": "28EUGFS2M23ggAWMjQ0jR4BAFuM5VEbKsM3tGd6KYXh7CFKcsDqchPLxxXFGKFNqB2bNCBRf", + "ServiceHostType": "2", + "nbf": 1779318245, + "exp": 1810854245, + "iat": 1779318245 +} +``` +- Used by: BGD, SGW, TR for service-to-service authentication +- Expires: 2027-05-15 + +### Database Password +- **User:** `dune` +- **Password:** `qEJ1xJUedRJCv5qnAPJEnFnR` +- **Superuser:** `postgres` (no password needed from inside cluster) +- **Database:** `dune` +- **Schema:** `dune` (main game data), `ext` (extensions), `public` +- **Note:** Database is essentially empty (0 players, fresh install) + +### RabbitMQ Users (from RMQ logs — user format: `{service}.{world}.{token}.{role}`) +| User | Purpose | Pod | +|------|---------|-----| +| `sg.{WORLD}.wlP+pNNSRYeatInPivYEjw.admin` | Server Gateway admin | on mq-admin | +| `sg.{WORLD}.wlP+pNNSRYeatInPivYEjw.game` | Server Gateway game | on mq-game | +| `bgd.{WORLD}.Y_WL2MEd406KLEg5Lu+Bpw.admin` | BGD Director admin | on mq-admin | +| `bgd.{WORLD}.Y_WL2MEd406KLEg5Lu+Bpw.game` | BGD Director game | on mq-game | +| `tr.{POD}.iKkgMO91kEOlvCGqBwT3dg` | Text Router | on mq-game | + +### FLS API Key +- **Value:** `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` (masked/placeholder) +- Stored as `fls-apikey` in server-gateway-secret + +### RabbitMQ Management UI Credentials (RESOLVED 2026-05-22) +- **Username:** `admin` +- **Password:** `admin123` +- **Admin UI:** `http://65.21.198.100:30325` — ✅ Working +- **Game UI:** `http://65.21.198.100:32716` — ✅ Working +- **How it was done (new approach, 2026-05-22 production):** + 1. Scaled down all 4 operators to 0 replicas (prevents ConfigMap reconciliation) + 2. Modified `mq-admin-cm` and `mq-game-cm` ConfigMaps: changed `auth_backends.1 = $(RMQ_AUTH_BACKEND_1)` to `auth_backends.1 = internal` + `auth_backends.2 = $(RMQ_AUTH_BACKEND_1)` + 3. Restarted RMQ StatefulSet pods (they pick up new config) + 4. Created admin users on both mq-admin and mq-game via `rabbitmqctl add_user admin admin123` + 5. Set `administrator` tag and full permissions on both +- **Key difference from old approach:** Kept HTTP auth plugin enabled (needed for game services), just added `internal` as primary auth backend so the admin user is checked first. Game service tokens still authenticate via HTTP→TR fallback. +- **Note:** Admin users are LOST on pod restart (PV doesn't persist user data reliably). Must recreate via `rabbitmqctl` after each restart. + +--- + +## 5. RABBITMQ AUTHENTICATION ARCHITECTURE + +### How RMQ Auth Works +1. RabbitMQ is configured with `rabbitmq_auth_backend_http` + `rabbitmq_auth_backend_cache` +2. When a client connects via AMQP, RabbitMQ makes an HTTP POST to the TR service +3. **TR endpoint:** `POST /v0/auth/user` with `username` and `password` form params +4. TR validates the password as a structured/signed token using `RMQ_HTTP_TOKEN_AUTH_SECRET` +5. Returns `allow` or `deny` + +### TR Service Details +- **Pod:** `{WORLD}-tr-deploy` +- **Image:** `seabass-server-text-router` +- **Port:** 5059 +- **Type:** .NET 8 ASP.NET Core application (112MB binary at `/Tools/Battlegroups/TextRouter/TextRouter`) +- **Auth endpoints:** `/v0/auth/user` (GetUserAuth), `/v0/auth/vhost`, `/v0/auth/resource`, `/v0/auth/topic` +- **Config:** Minimal — `appsettings.json` only has Serilog settings + +### AMQP is TLS-only +Both mq-admin and mq-game are configured with: +``` +listeners.tcp = none +listeners.ssl.default = 5672 +``` +All AMQP connections use TLS. The Management UI (port 15672) is plain HTTP. + +### Token Format (from TR logs) +The TR extracts a "token" from the password and parses it as: +- **Created** (DateTime, 8 bytes) — was `01/01/0001` for invalid tokens +- **TTL** (duration) — was `00:00:00` for invalid tokens + +The token is validated using `RMQ_HTTP_TOKEN_AUTH_SECRET` as the HMAC signing key. +The 16-byte tokens in the usernames (`wlP+pNNSRYeatInPivYEjw` decoded) are too short and don't contain proper timestamp data. + +### Management UI Login +- URL: `http://192.168.0.101:32253` (admin) or `http://192.168.0.101:31745` (game) +- Uses HTTP Basic Auth +- **Status:** ✅ RESOLVED — Use `admin:admin123` (see section 4) +- The default HTTP auth backend (TR service) intercepts all login attempts. Internal RMQ users bypass this. + +--- + +## 6. BGD DIRECTOR API + +### Web UI +The BGD has a Bootstrap web UI at its root (`/`) with: +- Player count (total, online, in-transit, grace period) +- Links to API endpoints + +### API Endpoints Found +| Endpoint | Method | Response | +|----------|--------|----------| +| `/` | GET | HTML web UI | +| `/v0/players` | GET | `[]` (empty array) | +| `/v0/players/online` | GET | `[]` | +| `/v0/players/intransit` | GET | `[]` | +| `/v0/players/graceperiod` | GET | `[]` | +| Everything else | ANY | 404 Not Found | + +### BGD Pod +- **Args:** `--RMQGameHostname`, `--RMQGamePort`, `--RMQAdminHostname`, `--RMQAdminPort` +- **Env:** Has `FuncomLiveServices__ServiceAuthToken` (JWT) and `RMQ_HTTP_TOKEN_AUTH_SECRET` +- The BGD connects to both mq-admin and mq-game via AMQP internally + +--- + +## 6.5. SEND-DUNE-BROADCAST UTILITY (DISCOVERED 2026-05-22) + +### Location +- **File:** `F:\Downloads\send-dune-broadcast` +- **Type:** Bash script (177 lines) +- **Purpose:** Sends in-game broadcast notifications to all connected players via RabbitMQ + +### How It Works +The script publishes a message directly to the **`heartbeats` exchange** on the **mq-game** RabbitMQ instance using `rabbitmqctl eval` (Erlang code executed inside the RMQ pod). + +**Message structure:** +```erlang +Outer = #{ + <<"Version">> => 2, + <<"AuthToken">> => <<"Nu6VmPWUMvdPMeB7qErr">>, %% ⚠️ HARDCODED TOKEN + <<"MessageContent">> => Inner +} + +Inner = #{ + <<"ServerCommand">> => <<"ServiceBroadcast">>, + <<"BroadcastType">> => <<"Generic">>, + <<"BroadcastPayload">> => #{ + <<"BroadcastDuration">> => Duration, + <<"LocalizedText">> => [ + #{<<"Key">> => <<"en">>, <<"Title">> => Title, <<"Body">> => Body}, + #{<<"Key">> => <<"en-US">>, <<"Title">> => Title, <<"Body">> => Body} + ] + } +} +``` + +**Publishing details:** +- **Exchange:** `heartbeats` +- **Routing key:** `notifications` +- **App ID:** `fls` +- **User ID:** `fls_backend` +- **Message ID:** `manual-service-broadcast-{timestamp}` + +### Usage +```bash +send-dune-broadcast --title "Server Notice" --message "Maintenance in 10 minutes" --duration 60 +# or positional: +send-dune-broadcast "Server Notice" "Maintenance in 10 minutes" 60 +``` + +### Key Findings +1. **Hardcoded AuthToken:** `Nu6VmPWUMvdPMeB7qErr` — this is the FLS (Funcom Live Services) backend auth token used to authenticate broadcast messages +2. **Direct RMQ access:** Bypasses the TR auth entirely by executing Erlang code inside the RMQ pod via `rabbitmqctl eval` +3. **No AMQP connection needed:** Uses RMQ's internal APIs (`rabbit_exchange:lookup_or_die`, `rabbit_queue_type:publish_at_most_once`) +4. **Localized text:** Supports multiple locales (en, en-US) — could be extended +5. **BroadcastType:** Currently hardcoded as `Generic` — there may be other types + +### How to Run on Our Server +```bash +# Copy script to VM +scp -i "$env:LOCALAPPDATA\DuneAwakeningServer\sshKey" F:\Downloads\send-dune-broadcast dune@192.168.0.101:/home/dune/ + +# Make executable and run +ssh -i "$env:LOCALAPPDATA\DuneAwakeningServer\sshKey" dune@192.168.0.101 'chmod +x /home/dune/send-dune-broadcast && /home/dune/send-dune-broadcast --title "Test" --message "Hello from admin!" --duration 30' +``` + +### Potential Uses +- **Server announcements** (maintenance, events, restarts) +- **Emergency alerts** (crashes, rollbacks) +- **Welcome messages** for new players +- **Event notifications** (sandstorms, landsraad votes, etc.) +- **Integration with dashboard** — add a broadcast UI to the admin panel + +### Integration with Dashboard +The dashboard's `send_global_broadcast()` in `app/services/admin.py:668` currently only publishes to SocketIO (dashboard clients). This script shows how to reach **actual game clients** via RMQ. We can: +1. Port the Erlang logic to Python using `pika` or `aio-pika` +2. Or wrap this script and call it via SSH from the dashboard +3. Add a broadcast UI to the admin panel with title/message/duration fields + +### ⚠️ Important Notes +- The `heartbeats` exchange may not exist on our RMQ instance (it's created dynamically when the message is published) +- The AuthToken `Nu6VmPWUMvdPMeB7qErr` may need to match what the game clients expect +- This script requires `python3` on the VM for JSON escaping (already installed) +- The script uses `rabbitmqctl eval` which requires root/sudo access to the RMQ pod + +--- + +## 7. TEXT ROUTER (TR) POD DETAILS + +### Env Vars +``` +FuncomLiveServices__RmqTlsEnabled=true +FuncomLiveServices__ServiceAuthToken= +RMQ_HTTP_TOKEN_AUTH_SECRET= +Database_address={WORLD}-db-dbdepl-svc:15432 +Database_name=dune +Database_password=qEJ1xJUedRJCv5qnAPJEnFnR +Database_user=dune +``` + +### Args +``` +--RMQAdminHostname={WORLD}-mq-admin-svc --RMQAdminPort=5672 +--RMQGameHostname={WORLD}-mq-game-svc --RMQGamePort=5672 +``` +The TR itself connects to RabbitMQ. It uses the JWT (or signed tokens) to authenticate. + +--- + +## 8. DASHBOARD REPO CODE REFERENCES + +| File | Key Content | +|------|-------------| +| `app/services/director.py` | BGD Director integration | +| `app/services/k8s.py` | `get_rabbitmq_pod()` — finds `mq-admin`/`mq-game` | +| `app/services/admin.py:668` | `send_global_broadcast()` — "simulates the administrative `send-dune-broadcast` utility" | +| `app/routes/api.py` | Health checks (RabbitMQ pod status) | +| `app/utils/event_manager.py` | SocketIO event publishing | +| `launcher.ps1:81` | Redacts `RMQ_HTTP_TOKEN_AUTH_SECRET` from logs | +| `settings.yaml.example` | Config template with SSH, DB, K8s settings | + +**Note:** `send_global_broadcast()` is defined but NOT called by any route, websocket handler, or template — it's backend scaffolding. + +--- + +## 9. VM SCRIPTS + +| File | Location | Purpose | +|------|----------|---------| +| `setup.sh` | `/home/dune/.dune/download/scripts/` | Full setup orchestration | +| `battlegroup.sh` | Same dir | Battlegroup management CLI | +| `bg-util` | Same dir | 7MB Go binary (interactive, needs TTY) | +| `setup/helper.sh` | Same dir | Shared bash helpers | +| `setup/templates/world-template.yaml` | Same dir | Funcom CRD `BattleGroup` template | +| `setup/config/User*.ini` | Same dir | Default game user settings | + +### battlegroup.sh Commands +`list`, `status`, `start`, `restart`, `stop`, `edit`, `edit-advanced`, `update`, `update-from-downloads`, `backup`, `import`, `logs-export`, `operator-logs-export`, `apply-default-usersettings`, `enable-experimental-swap` + +### bg-util +- Interactive Go binary for editing battlegroup resources +- Requires a `world-template.yaml` path as argument +- Needs TTY (`error: could not open a new TTY` when run via SSH without `-t`) + +--- + +## 10. DATABASE SCHEMA + +### Schemas +- `dune` — Main game data (~160 tables) +- `ext` — Extensions +- `public` — Default schema +- `dashboard` — Dashboard's own tables (not yet created in this fresh install) + +### Notable Tables (all empty on fresh install) +- `accounts`, `actors`, `buildings`, `items`, `vehicles`, `player_state` +- `guilds`, `factions`, `parties` +- `landsraad_decrees`, `landsraad_tasks` (with data: 11 decrees, 25 tasks) +- `event_log*` (partitioned — empty) +- `world_partition` (30 rows — server config) +- `dune_exchanges` (1 row — exchange config) + +### Database Roles +| Role | Superuser | Login | +|------|-----------|-------| +| `dune` | No | Yes | +| `postgres` | Yes | Yes | + +--- + +## 11. INTERESTING LOG ENTRIES + +### RMQ mq-admin Errors +``` +operation basic.publish caused a channel exception not_found: +no exchange 'completions' in vhost '/' +``` +This occurs when the BGD or SGW tries to publish to a `completions` exchange that doesn't exist yet. Likely an initialization race condition or config issue. + +### TR Malformed Token +``` +Malformed token for user sg...wlP+pNNSRYeatInPivYEjw.game: + wlP+pNNSRYeatInPivYEjw: created: 01/01/0001 00:00:00, TTL: 00:00:00 +``` +Indicates the token in the username is NOT a valid signed credential. The SGW/BGD must be using something else as the actual password (probably the JWT). + +--- + +## 12. WHAT'S STILL UNKNOWN / NEXT STEPS + +### ✅ Completed +1. **DB Schema Migration Failure** — ✅ **RESOLVED** (happened automatically between installs or was unrelated to current cluster) +2. **RMQ Management UI credentials** — ✅ **RESOLVED** — `admin:admin123` working on both admin (30325) and game (32716) UIs +3. **`send-dune-broadcast`** — ✅ **TESTED AND WORKING** on live production server + +### Next Steps +1. **Scale operators back up** — Currently scaled to 0. They need to be restored: + - `for op in battlegroupoperator databaseoperator serveroperator utilitiesoperator; do sudo kubectl scale deployment -n funcom-operators $op-controller-manager --replicas=1; done` + - **Risk:** Operators will reconcile ConfigMaps back to defaults, reverting the `auth_backends` change. May need to: + a. Leave operators at 0 (manual management only) + b. Or accept that RMQ admin UI access breaks after reconciliation (recreate admin users on each RMQ restart) + +2. **Custom broadcast identity** — Currently broadcasts appear as `fls_backend`. Want to change title to "Dune Admin" or similar. Modify the hardcoded values in the script or change the message structure. + +3. **Integrate broadcast into dashboard** — Add a broadcast UI to the dashboard admin panel (title/message/duration fields) that calls the script via SSH. + +4. **BGD API expansion** — Currently only player endpoints. Check if there are undocumented endpoints or if the dashboard's director.py adds functionality. + +5. **Database backup/import** — `battlegroup.sh backup` and `import` commands exist. + +6. **`completions` exchange** — RMQ error that may be benign or indicate a missing exchange declaration. + +7. **SG Overmap pod** — Check TLS connection issues. + +### New Findings (2026-05-22) +8. **Installed tools on VM:** `curl`, `python3`, `py3-pip` added to Alpine VM for easier debugging +9. **TR Binary analysis:** Extracted from `server-text-router.tar` Docker image. Found classes: `RmqHttpTokenAuthApi`, `RmqHttpTokenGenerator`, `ShaTokenGenerator` with `TimeSkew` config. Token validation uses HMAC with the signing key. +10. **Battlegroup Operator behavior:** All 4 operators continuously reconcile ConfigMaps. To make config changes, must scale operators to 0 replicas first, then restore after changes. +11. **World namespace:** `funcom-seabass-sh-b17a5f036d1f7882-ooaeyc` (3rd install). Changes on each install — auto-detect with: `kubectl get pods -A --no-headers | grep mq-game-sts-0 | awk '{print $1}'` +12. **BGD Map Config:** BGD manages 50+ maps/instances including Survival, Story, Challenge Rooms, CB (Combat Block), DLC content, and test gyms +13. **send-dune-broadcast utility:** Found at `F:\Downloads\send-dune-broadcast`. Sends in-game announcements via RMQ `heartbeats` exchange using `rabbitmqctl eval`. Uses hardcoded AuthToken `Nu6VmPWUMvdPMeB7qErr`. See section 6.5 for full analysis. +14. **RMQ admin user persistence:** Admin users created via `rabbitmqctl add_user` are lost when RMQ pods restart. The PV may not be persisting user data, or the StatefulSet may be using a fresh volume each time. Need to investigate PV configuration. +15. **CRITICAL — RMQ TLS config missing on fresh install:** The default RMQ ConfigMaps on a fresh install are **missing TLS configuration**. Game services connect via TLS (`-RMQGameTlsEnabled=true`) but RMQ only listens on plain TCP, causing `{bad_header,<<22,3,1...>>}` errors and immediate connection drops. **Fix:** Add TLS config to both `mq-admin-cm` and `mq-game-cm` ConfigMaps: +```yaml +system.conf: | + listeners.tcp = none + listeners.ssl.default = 5672 + ssl_options.cacertfile = /etc/rabbitmq/cacert.pem + ssl_options.certfile = /etc/rabbitmq/cert.pem + ssl_options.keyfile = /etc/rabbitmq/key.pem + ssl_options.verify = verify_none + ssl_options.fail_if_no_peer_cert = false + auth_backends.1 = internal + auth_backends.2 = $(RMQ_AUTH_BACKEND_1) + # ... rest of auth config +``` +16. **Fresh install details (2026-05-22 #2):** VM IP `192.168.0.102`. World namespace: `funcom-seabass-sh-b17a5f036d1f7882-vvgcmr`. All pods running including survival. NodePorts: BGD 30086, RMQ admin 32560, RMQ game 31834. +17. **Fresh install details (2026-05-22 #3):** VM IP `192.168.0.103`. World namespace: `funcom-seabass-sh-b17a5f036d1f7882-ooaeyc`. **CRITICAL ISSUE:** Game servers not starting — DB schema migration failing. + - **Error:** `Failed to apply schema 1968181-0-shipping` — database operator keeps retrying + - **Root cause:** DB util pods (`db-dbdepl-util-*`) hang during schema migration. They connect to DB but never complete. + - **Effect:** BattleGroup stuck in `Stopped` phase, ServerGroup stuck in `Starting`, no game server pods (bgd, sg-overmap, sg-survival, sgw, tr) are created + - **Server operator logs:** `Cannot execute pod creation since database sh-b17a5f036d1f7882-ooaeyc-db is not ready to receive connections` + - **DB pod itself is Running** — the issue is specifically with the schema migration util pods + - **DB password:** `IgNybVaa7xbtBYz7kCvf7LbF` (changes each install) + - **DB util image:** `seabass-server-db-utils:1968181-0-shipping` + - **Workaround needed:** Investigate why schema migration hangs. May need to check DB connectivity, schema files, or manually apply schema. + +### New Findings (2026-05-22 — Production VPS Session) +18. **Server is a production VPS, not local Hyper-V:** IP `65.21.198.100`, hostname `duneawakening`, Alpine Linux 3.23.4. K3s single-node cluster is fully running with all game servers operational (overmap, survival-1, deepdesert-1, arrakeen, harkovillage, bgd, sgw, tr, fb, db). Schema migration eventually succeeded. + - **World namespace:** `funcom-seabass-sh-b17a5f036d1f7882-ccdijf` (different from the failed #3 install) + - **SSH key:** `$env:LOCALAPPDATA\DuneAwakeningServer\sshKey` + - **⚠️ SCP doesn't work** (no `sftp-server`). Use pipe method with `tr -d '\r'` to strip CRLF. +19. **RMQ ConfigMap auth fix applied:** + - Operators scaled to 0 (still at 0 as of end of session) + - Changed both `mq-admin-cm` and `mq-game-cm`: `auth_backends.1 = internal`, `auth_backends.2 = $(RMQ_AUTH_BACKEND_1)` + - RMQ pods restarted, admin users `admin:admin123` created with full permissions on both instances + - **RMQ Admin UI:** `http://65.21.198.100:30325` ✅ + - **RMQ Game UI:** `http://65.21.198.100:32716` ✅ + - **Note:** The game ConfigMap also needed the fix applied separately (first run only got admin, not game) +20. **`send-dune-broadcast` tested and confirmed working on live server:** + - Script copied to `/tmp/send-dune-broadcast` on the VM + - `python3` was not pre-installed — had to `apk add python3 py3-pip` first + - Test 1: `--title Notice --message Test --duration 30` → ✅ Success + - Test 2: `--title "YEY got it working!" --message "How are ya?" --duration 30` → ✅ Success + - Messages appear in-game as expected with hardcoded `fls_backend` identity + - The `heartbeats` exchange exists and accepts messages from `rabbitmqctl eval` +21. **No GitHub commits/pushes made — security enforced.** +22. **"Admin Experimental" dashboard tab created:** + - New nav entry at end of NAV_PAGES in `constants.py` + - Route `/admin-experimental` added in `main.py` + - Template `templates/admin_experimental.html` with broadcast form + - API endpoint `POST /api/admin-experimental/broadcast` in `api.py` + - `send_global_broadcast()` method added to `AdminService` in `admin.py` + - Uses base64 encoding to write Erlang script on VM host, then pipes via `cat | kubectl exec -i` into the pod + - **Note:** The original approach using heredoc failed through paramiko. Final working approach: write erl file on VM host via base64 decode, then `cat file | kubectl exec -i pod -- sh -lc 'cat > /tmp/pod.erl && rabbitmqctl eval "$(cat /tmp/pod.erl)"'` +23. **RMQ Game Exchanges discovered (via RMQ Management API at :32716):** + - `heartbeats` (direct) — broadcasts + - `rpc` (direct) — server RPC (no bindings currently) + - `notifications` (topic) — notifications + - `chat.faction.1-4` (fanout) — faction chat + - `chat.guild.*` (fanout) — guild chat + - `chat.intercept` (topic) — chat intercept + - `chat.proximity`, `chat.whispers`, `chat.map` (direct) — chat channels + - `login_grant`, `login_request`, `login_response` (direct) — auth flow + - `status.*` (fanout) — per-map status (Overmap, Survival_1, DeepDesert_1, SH_Arrakeen, SH_HarkoVillage, CB_*, DLC_*, Story_*) + - `travel_queue_status` (topic) — travel queue + - `director_respawned` (fanout) — respawn events +24. **RMQ Admin Exchanges discovered (via RMQ Management API at :30325):** + - `completions` (direct) — 723 messages published (completion events) + - `response` (direct) — 64K+ messages published (response routing) + - `settingsUpdate` (fanout) — 71 messages published (server settings updates) + - `travel` (topic) — travel messages + - `travelQueueStatus` (fanout) — 1K+ messages published + - `grant` (direct) — grant messages + - `heartbeats` (direct) — 2K+ messages published + - `rpc` (direct) — RPC messages + - `director_respawned` (fanout) — respawn events +25. **RMQ Game Queues discovered:** + - `B17A5F036D1F7882_queue` — host-specific queue + - `bgdRpc` — BGD RPC queue (1 consumer) + - `loginRequests` — login requests (1 consumer) + - `queue.intercept` — intercept queue (1 consumer) + - `queue.server.*` (5 queues) — server-specific queues (1 consumer each) +26. **BGD API Full Discovery:** + - `/v0/battlegroup` — **Full battlegroup JSON** with all server/player data (dimension maps, servers, configs, player counts, gameplay settings) + - `/v0/players` — returns `["B17A5F036D1F7882"]` (FLS IDs) + - `/v0/players/online` — online FLS IDs + - `/v0/players/intransit`, `/v0/graceperiod`, `/v0/completion`, `/v0/queued` — player status endpoints + - `/v0/BattlegroupFetchFlsReportSettings` — FLS report config + - `/v0/BattlegroupUpdateFlsReportSettings` — POST to update FLS settings + - `/v0/BattlegroupClearFlsReportOverrides` — POST to clear overrides + - BGD Web UI at `/` shows: player stats, FLS settings, character transfer settings, per-map server overview with player counts/queue/status, per-server settings (force lock, caps), instance scaling config + - `/v0/battlegroup` JSON contains: `dimensionMaps[]`, `singleServerMaps[]`, `instancedMaps[]` with per-server `partition`, `ip`, `gamePort`, `numPlayers*`, `status`, `cfg`, `lastServerState` (includes `serverGameplaySettings`: hydration, sandstorm, sandworm, PvP, security zones, mining multiplier, durability, etc.) +27. **PostgreSQL Database Admin Functions discovered (517 total in `dune` schema):** + - `_add_item_delete_log(in_item_id bigint, in_inventory_id bigint, in_template_id text)` + - `_add_item_trace_log(in_function_name dune.itemtrackingfunctiontype, in_item_locations dune.inventoryitemlocation[])` + - `_add_item_trace_log(in_function_name dune.itemtrackingfunctiontype, in_item_id bigint, in_inventory_id bigint, in_template_id text, in_position_index bigint)` + - `_building_validate_totem_owner_id(in_totem_owner_id bigint)` + - `_character_transfer_allocate_id(kind dune._charactertransferentrykind, data jsonb)` + - `_character_transfer_create_data_table()` + - `_character_transfer_data_filter(id text, removed text[], VARIADIC refs dune._charactertransferdatafilterref[])` + - `_character_transfer_data_table_load(entries jsonb)` + - `_character_transfer_data_table_save()` + - `_character_transfer_ensure_player_is_owner_of_vbt_vehicle(in_vehicle_id bigint[])` + - `_character_transfer_get_filter(kind dune._charactertransferentrykind)` + - `_character_transfer_get_patches_checksum()` + - `_character_transfer_pre_export_validation(in_fls_id text)` + - `_character_transfer_property_not_exported_is_expected(path text)` + - `_character_transfer_replace_local_id_with_transfer_id(data text, path text)` + - `_character_transfer_replace_local_id_with_transfer_id_in_json(data jsonb, path text)` + - `_character_transfer_replace_transfer_id_with_local_id(data text, path text)` + - `_character_transfer_replace_transfer_id_with_local_id_in_json(data jsonb, path text)` + - `_character_transfer_store_in_world_owned_vehicles_into_recovery(in_player_id bigint)` + - `_character_transfer_top_level_export(in_kind dune._charactertransferentrykind, data jsonb)` + - `_character_transfer_top_level_import(in_kind dune._charactertransferentrykind, data jsonb, in_id bigint)` + - `_placeable_validate_totem_owner_id(in_totem_owner_id bigint)` + - `_user_data_encryption_initially_encrypt_existing_data()` + - `_user_data_encryption_setup_enabled(key_hash bytea)` + - `_user_data_encryption_setup_tainted()` + - `accept_guild_invite(in_invite_id bigint, in_role_id smallint, in_max_guild_count_per_player integer, in_max_members_per_guild integer, in_neutral_faction_id smallint)` + - `accept_party_invite(in_invite_id bigint, in_platform_session_id text, in_max_party_member_count integer)` + - `add_actor_audit(in_id bigint, in_class text)` + - `add_event_log_data(in_game_event_owner bigint, in_universe_time bigint, in_map_name text, in_partition_id bigint, in_event_type integer, in_x_location double precisio...)` + - `add_event_log_data_batched(in_data dune.eventlogbulkentrydata[])` + - `add_guild_invite(in_player_id bigint, in_guild_id bigint, in_sender_player_id bigint, in_invite_sent_timespan bigint, in_max_guild_invites_per_guild integer)` + - `add_guild_member(in_player_id bigint, in_guild_id bigint, in_role_id smallint, in_max_guild_count_per_player integer, in_max_members_per_guild integer, in_neutral_f...)` + - `add_landclaim_segment(in_totem_id bigint, in_grid_location_x bigint, in_grid_location_y bigint)` + - `add_map_areas_surveyed_items(in_account_id bigint, in_area_id smallint, in_survey_point_marker_id bigint, in_surveyed_items_target jsonb, in_surveyed_items_progress jsonb, in_m...)` + - `add_map_areas_time_discovered(in_account_id bigint, in_area_id smallint, in_time_discovered timestamp without time zone, in_map_name text)` + - `add_map_areas_time_first_entered(in_account_id bigint, in_area_id smallint, in_time_first_entered timestamp without time zone, in_map_name text)` + - `add_partition_unique(in_map text, in_definition jsonb, in_dimension bigint, in_label text)` + - `add_party_invite(in_sender_player_id bigint, in_sender_platform_name text, in_sender_platform_session_id text, in_player_id bigint, in_max_party_member_count intege...)` + - `adjust_player_virtual_currency_balance(in_controller_id bigint, in_currency_id smallint, in_delta bigint)` + - `admin_get_character_details(in_account_id bigint)` + - `admin_get_character_ids(in_search_term text)` + - `admin_get_inventory_details(in_account_id bigint)` + - `admin_get_journey_details(in_player_id text, in_story_node_id text)` + - `admin_get_mnemonic_recall_details(in_account_id bigint)` + - `admin_get_partitions()` + - `admin_move_offline_player(in_fls_id text, in_target_partition_name text, in_target_location dune.vector)` + - `admin_move_offline_player_to_partition(in_fls_id text, in_target_partition_id bigint, in_target_location dune.vector)` + - `admin_read_player_tags(in_account_id bigint)` + - `advance_items_id_sequencer(count bigint)` + - `assign_actor_id(in_class text)` + - `base_backup_delete(in_base_backup_id bigint)` + - `base_backup_find_totems_from_player_owner(in_player_id bigint)` + - `base_backup_finish_placing(in_base_backup_id bigint)` + - `base_backup_get_actors_to_spawn(in_base_backup_id bigint)` + - `base_backup_get_available_backups(in_player_id bigint)` + - `base_backup_get_buildable_data(in_base_backup_id bigint)` + - `base_backup_get_data(in_base_backup_id bigint)` + - `base_backup_get_totem_data(in_base_backup_id bigint)` + - `base_backup_get_totem_data_from_totem_id(in_totem_id bigint)` + - `base_backup_get_totem_id(backup_id bigint)` + - `base_backup_recycle(in_base_backup_id bigint, in_target_inventory_id bigint)` + - `base_backup_save(in_player_actor_id bigint, in_base_backup_name text, in_building_pieces_to_link dune.basebackupbuildingitem[], in_placeables_to_link bigint[], in_p...)` + - `base_backup_save_all_totems_from_player_owner(in_player_id bigint)` + - `base_backup_save_from_totem(in_player_id bigint, totem_id bigint)` + - `break_guild_allegiance(in_guild_id bigint, in_neutral_faction_id smallint)` + - `can_takeover_account(in_user_id text)` + - `change_player_faction(in_player_id bigint, in_faction_id smallint, neutral_faction_id smallint, in_utc_time_faction_change timestamp without time zone)` + - `character_migration_export(in_fls_id text)` + - `character_migration_import(in_data jsonb, in_fls_id text, in_character_name text)` + - `character_transfer_export(in_fls_id text)` + - `character_transfer_get_unsaved_counts(in_fls_id text)` + - `character_transfer_import(in_data jsonb, in_fls_id text, in_character_name text)` + - `clean_expired_party_invites(in_invite_expire_seconds integer)` + - `clean_guild_invites_with_incompatible_faction(in_player_id bigint, in_faction_id smallint, neutral_faction_id smallint)` + - `clean_old_guild_invites(in_cutoff_timespan bigint)` + - `clean_stock_for_player(in_player_id bigint)` + - `clean_stock_for_vendors(in_vendor_ids text[])` + - `clean_vendors_older_than_timestamp(in_reference_timestamp bigint)` + - `cleanup_account_log_and_orphaned_actors()` + - `cleanup_accounts_marked_for_deletion_in_fls(in_account_ids text[])` + - `cleanup_orphaned_entities()` + - `clear_map_areas_data_for_player(in_id bigint)` + - `complete_journey_nodes_where_prerequisite_nodes_are_complete(story_ids_to_complete text[], prerequisite_completed_story_ids text[])` + - `complete_journey_story_nodes_for_player(in_player_id text, in_story_node_ids text[])` + - `corilis_cleanup_map(in_server_info dune.serverinfo, in_map_info dune.coriolismapinfo)` + - `coriolis_cleanup_farm(in_server_info dune.serverinfo, in_map_info dune.coriolismapinfo)` + - `coriolis_cleanup_partition(in_server_info dune.serverinfo, in_map_info dune.coriolismapinfo)` + - `coriolis_update_seed(in_server_info dune.serverinfo, in_new_coriolis_seed integer, in_map_info dune.coriolismapinfo)` + - `create_event_log_partition()` + - `create_guild(in_player_id bigint, in_neutral_faction smallint, in_guild_name text, in_guild_desc text, in_max_guild_count_per_player integer, OUT out_guild_id b...)` + - `create_or_update_tutorial_entry(in_player_id bigint, in_tutorial_id smallint, in_tutorial_state smallint)` + - `create_server_player_access_codes(in_account_id bigint, in_access_code integer, in_access_code_type integer, in_is_resettable boolean)` + - `create_sinkchart_for_map_area_id(in_item_id bigint, in_creator_id bigint, in_map_name text, in_area_id smallint)` + - `debug_add_test_table_data(in_entry text)` + - `debug_collect_test_table_data()` + - `debug_echo(in_text text, in_notices text[])` + - `debug_get_coriolis_seeds()` + - `debug_raise_exception(in_exception text, in_notices text[])` + - `debug_raise_notices(in_notices text[])` + - `debug_reset_test_table()` + - `debug_set_farm_seed(in_new_coriolis_seed integer)` + - `debug_set_map_seed(in_map text, in_new_coriolis_seed integer)` + - `debug_set_partition_seed(in_partition_id bigint, in_new_coriolis_seed integer)` + - `decrypt_user_data(in_encrypted_data bytea)` + - `delete_account(in_user_id text, in_reason text)` + - `delete_actor_states_travel(in_actor_id bigint)` + - `delete_actors(in_ids bigint[])` + - `delete_actors_and_respawns_on_server(in_server_info dune.serverinfo, in_vehicle_classes_spawned_on_map text[], in_allow_vehicle_recovery boolean)` + - `delete_all_dungeon_completions(in_dungeon_id text)` + - `delete_all_dungeon_completions_by_player(in_dungeon_id text, in_player_id bigint, in_keep_completion_for_other_players boolean)` + - `delete_all_dungeon_completions_for_all_dungeons_by_player(in_player_id bigint, in_keep_completion_for_other_players boolean)` + - `delete_all_inactive_farms()` + - `delete_all_journey_story_nodes(in_account_id bigint)` + - `delete_all_static_shifting_sand()` + - `delete_all_tutorial_entries(in_player_id bigint)` + - `delete_building_blueprint(in_building_item_id bigint)` + - `delete_character(in_actor_id bigint)` + - `delete_crafted_map(in_item_id bigint)` + - `delete_dialogue_data(in_player_controller_id bigint)` + - `delete_inventory_item(in_item_id bigint, in_count bigint)` + - `delete_item(in_id bigint)` + - `delete_items(in_ids bigint[])` + - `delete_items_from_actor(in_actor_id bigint)` + - `delete_journey_story_ids(story_ids text[])` + - `delete_journey_story_node(in_account_id bigint, in_story_node_id text)` + - `delete_journey_story_nodes_for_group_for_player(in_account_id bigint, in_reset_group dune.journeystoryresetgroup)` + - `delete_journey_story_nodes_for_player(in_player_id text, in_story_node_ids text[])` + - `delete_journey_story_nodes_for_player_account(in_account_id bigint, in_story_node_ids text[])` + - `delete_map_markers(in_dimension_index integer, in_map_name text, in_player_marker_data dune.deleteplayermarkerdata[])` + - `delete_markers_by_id(in_marker_ids integer[])` + - `delete_markers_by_static_location_key(p_location_key text)` + - `delete_markers_for_all_players(in_marker_types_to_keep text[], in_map text)` + - `delete_markers_return_actor_ids(in_dimension_index integer, in_map_name text, in_marker_ids integer[])` + - `delete_mnemonic_recall_lesson(in_account_id bigint, in_lesson_id text)` + - `delete_mnemonic_recall_lesson_all(in_account_id bigint)` + - `delete_server_player_access_codes(in_account_id bigint, in_access_code integer, in_access_code_type integer)` + - `delete_spawner(in_map text, in_name text, in_dimension_index integer)` + - `delete_static_location_markers(p_location_keys text[])` + - `delete_world_partition_by_map_id(in_map_id text)` + - `demote_guild_member(in_guild_id bigint, in_player_id bigint, in_new_role smallint)` + - `determine_partition_label(in_map text, in_dimension_index integer, in_label text, in_allow_overwrite boolean, in_partition_id bigint)` + - `determine_partition_label_trigger()` + - `disband_guild(in_guild_id bigint)` + - `disband_party(in_party_id bigint)` + - `downgrade_map_name(in_map_name text)` + - `drain_item_tracking_data()` + - `dune_exchange_add_sell_order(in_exchange_id bigint, in_access_point_id bigint, in_owner_id bigint, in_max_orders_per_player integer, in_expiration_time bigint, in_item_id bigin...)` + - `dune_exchange_cancel_order(in_order_id bigint, in_purge_time bigint, in_completion_type integer)` + - `dune_exchange_expire_orders(in_exchange_id bigint, in_current_time bigint, in_purge_time bigint, in_expired_completion_type integer)` + - `dune_exchange_fulfill_sell_order(in_exchange_id bigint, in_max_orders_per_player integer, in_purchased_completion_type integer, in_sold_completion_type integer, in_instigator_id bi...)` + - `dune_exchange_get_item_price_stats(in_template_ids text[])` + - `dune_exchange_get_user_id(in_owner_id bigint)` + - `dune_exchange_modify_user_solari_balance(in_controller_id bigint, in_solari_delta bigint)` + - `dune_exchange_purge_completed_orders(in_exchange_id bigint, in_current_time bigint)` + - `dune_exchange_query_storage_item(in_order_id bigint)` + - `dune_exchange_query_storage_items(in_exchange_id bigint, in_owner_id bigint)` + - `dune_exchange_relist_order(in_order_id bigint, in_expiration_time bigint, in_item_price bigint, in_wear_normalized_item_price bigint, in_solari_cost bigint)` + - `dune_exchange_retrieve_solari_balance(in_owner_id bigint)` + - `dune_exchange_retrieve_solaris_from_item(in_controller_id bigint, in_order_id bigint)` + - `dune_exchange_retrieve_storage_item(in_exchange_id bigint, in_order_id bigint, in_dst_inventory_id bigint, in_dst_index bigint, in_count bigint)` + - `dune_exchange_update_recurring_sell_order(in_exchange_id bigint, in_expiration_time bigint, in_access_point_id bigint, in_owner_id bigint, in_item_id bigint, in_increment bigint, in_max_cou...)` + - `dune_get_account_id_by_user(in_user text)` + - `edit_guild_description(in_guild_id bigint, in_guild_desc text)` + - `encrypt_user_data(in_data text)` + - `fetch_resourcefield_state(in_map text, in_dimension_index integer, in_field_kind_id smallint)` + - `fetch_server_spice_field_manifest(in_server_id text)` + - `fetch_spicefie_id_types_with_global_info(in_map_name text, in_dimension_index integer)` + - `find_actor_by_id(in_id bigint)` + - `fix_broken_harkonnen_players_due_to_fooled_thufir()` + - `flag_player_as_cheater(in_account_id bigint, in_cheat_type dune.cheat_type_enum)` + - `gather_ownerless_actors_on_server(in_server_info dune.serverinfo)` + - `gather_player_linked_actors(in_player_pawn_id bigint)` + - `gather_removed_accounts_that_left_orphaned_actors_on_server(in_server_info dune.serverinfo)` + - `get_account_actor_ids(in_account_id bigint)` + - `get_active_servers_for_gateway()` + - `get_actor_server_info(in_id bigint)` + - `get_actors_location_data_with_permission(in_actor_ids bigint[])` + - `get_all_demo_players()` + - `get_all_faction_members()` + - `get_all_guild_members()` + - `get_all_online_or_recently_disconnected_player_online_state()` + - `get_all_parties()` + - `get_all_party_invites()` + - `get_all_party_members()` + - `get_all_player_character_home_dimensions()` + - `get_all_player_in_guild_online_state(in_guild_id bigint)` + - `get_all_player_travel_states()` + - `get_all_tutorial_entries(in_player_id bigint)` + - `get_all_unresolved_character_imports()` + - `get_applied_patches()` + - `get_battlegroup_close_date()` + - `get_best_dungeon_completion(in_dungeon_id text)` + - `get_best_dungeons_completions_for_player(in_player_id bigint)` + - `get_building_blueprint_copy_data(in_building_blueprint_id bigint)` + - `get_building_favorites(in_account_id bigint)` + - `get_building_id(in_actor_id bigint, in_class text)` + - `get_character_import_state(in_fls_id text)` + - `get_character_transfer_related_items(in_fls_id text)` + - `get_consumed_lore_pickups(in_actor_id bigint, in_use_temporary boolean)` + - `get_controller_id_from_platform_id(in_platform_id text)` + - `get_dune_exchange_accesspoint_id(in_exchange_id bigint, in_name text)` + - `get_dune_exchange_data(in_exchange_id bigint, in_controller_id bigint)` + - `get_dune_exchange_id(in_name text)` + - `get_dune_exchange_used_order_slots(in_controller_id bigint)` + - `get_exchange_inventory_id(in_exchange_id bigint)` + - `get_exchange_orders_by_mask(in_mask integer, in_depth smallint)` + - `get_exchange_sell_orders(in_id bigint, in_exchange_id bigint, in_min_item_price bigint, in_max_item_price bigint, in_template_id text, in_mask integer, in_depth smallint)` + - `get_exchange_sell_orders_by_item_type(in_exchange_id bigint, in_template_ids text[])` + - `get_exchange_sell_orders_by_owner(in_exchange_id bigint, in_owner_id bigint)` + - `get_farm_state()` + - `get_friends_search(in_player_name text, in_max_players_count integer)` + - `get_guild_data(in_guild_id bigint)` + - `get_guild_data_for_player(in_player_id bigint)` + - `get_guild_for_player(in_player_id bigint)` + - `get_guild_invites(in_guild_id bigint)` + - `get_guild_members(in_guild_id bigint)` + - `get_inventory_data(in_inventory_id bigint)` + - `get_inventory_id(in_actor_id bigint, in_component_name_hash integer)` + - `get_items_to_remove(items_to_remove text[])` + - `get_landclaim_segments(in_totem_id bigint)` + - `get_learned_building_sets(in_account_id bigint)` + - `get_learned_new_buildable_pieces(in_account_id bigint)` + - `get_login_journey_nodes(in_account_id bigint)` + - `get_login_journey_nodes_cooldown(in_account_id bigint)` + - `get_mnemonic_recall_lessons(in_account_id bigint)` + - `get_online_player_controller_ids(in_map text)` + - `get_online_player_controller_ids_on_farm()` + - `get_partition_presets()` + - `get_partitions(in_map text)` + - `get_party_members(in_party_id bigint)` + - `get_permission_actors_for_server(in_server_info dune.serverinfo)` + - `get_permission_for_actor(in_actor_id bigint)` + - `get_permission_for_actors(in_actor_id bigint[])` + - `get_permission_for_player_actors(in_player_id bigint, in_min_rank smallint)` + - `get_placeable_id(in_actor_id bigint, in_class text, in_building_type text)` + - `get_player_access_codes(in_account_id bigint)` + - `get_player_current_faction_reputation(in_actor_id bigint, OUT out_faction_id smallint, OUT out_reputation_amount integer)` + - `get_player_faction(in_player_id bigint, in_neutral_faction_id smallint)` + - `get_player_faction_name(in_actor_id bigint, OUT player_faction_name text, OUT utc_time_faction_change timestamp without time zone)` + - `get_player_guild_invites(in_player_id bigint)` + - `get_player_ids_online_state(in_player_ids bigint[])` + - `get_player_infos_for_actor_ids(in_actor_ids bigint[])` + - `get_player_infos_for_character_names(in_character_names text[])` + - `get_player_infos_for_fls_ids(in_fls_ids text[])` + - `get_player_infos_for_funcom_ids(in_funcom_ids text[])` + - `get_player_online_state_within_grace_period_for_each_server()` + - `get_player_owned_vehicles_data(in_player_id bigint, in_account_id bigint)` + - `get_player_partition_id(in_fls_id text)` + - `get_player_pawn(in_account_id bigint)` + - `get_player_virtual_currency_balances(in_controller_id bigint)` + - `get_players_demo_data(in_controller_ids bigint[])` + - `get_recipes_to_remove(recipes_to_remove text[])` + - `get_registered_spawned_actor(in_spawner_id bigint)` + - `get_respawn_locations(in_account_id bigint)` + - `get_schema_version()` + - `get_solaris_id()` + - `get_spawner_id(in_map text, in_name text, in_dimension_index integer)` + - `get_stored_user_data_encryption_key_hash()` + - `get_stored_user_data_encryption_status()` + - `get_stored_user_data_encryption_taint_xmax()` + - `get_sub_inventory_id(in_owner_item_id bigint)` + - `get_traveling_actor_id_and_types(in_actor_id bigint)` + - `get_traveling_actor_ids(in_actor_id bigint, in_max_recursion_level integer)` + - `get_traveling_actors_fls_ids(in_actor_id bigint)` + - `get_traveling_non_player_actor_ids(in_actor_id bigint)` + - `get_unbacked_up_vehicle_ids_for_account(in_account_id bigint)` + - `get_universe_time()` + - `get_unsaved_base_totem_ids_for_account(in_account_id bigint)` + - `get_vehicle_id(in_actor_id bigint, in_class text)` + - `get_vehicle_module_inventory_id(in_vehicle_module_id bigint, in_vehicle_module_inventory_type integer)` + - `guild_handle_actor_delete(in_player_id bigint)` + - `guilds_get_exclusive_operation_lock()` + - `handle_player_faction_guild_effects(in_player_id bigint, in_faction_id smallint, neutral_faction_id smallint)` + - `igwo_delete_world_partitions(in_partition_ids bigint[])` + - `igwo_get_partition_id_seq_last_value()` + - `igwo_get_partition_ids()` + - `igwo_get_partitions()` + - `igwo_get_server_details()` + - `igwo_insert_world_partition(in_partition_id bigint, in_map text, in_partition_definition jsonb, in_dimension_index integer, in_partition_label text)` + - `igwo_next_partition_id_seq()` + - `igwo_notify_world_partition_update()` + - `igwo_restart_partition_id_seq(in_restart_with bigint)` + - `igwo_update_world_partition(in_map text, in_partition_definition jsonb, in_partition_id bigint, in_dimension_index integer, in_label text)` + - `init_event_log(in_partition_id bigint)` + - `initialize_partitions_basic_battlegroup()` + - `initialize_partitions_basic_survival_1()` + - `initialize_partitions_development_battlegroup()` + - `initialize_partitions_editor_default_1x1()` + - `initialize_partitions_full_battlegroup()` + - `initialize_partitions_igw_test_small_2x1()` + - `initialize_partitions_igw_test_small_2x2()` + - `initialize_partitions_igw_training()` + - `initialize_specialization_keystones(in_keystones text[])` + - `initialize_world_partition(in_map_name text, in_num_servers integer, in_dimension_index integer)` + - `interact_get_vendor_items_bought_from_player(in_vendor_id text, in_player_id bigint, in_current_cycle_start_timestamp bigint)` + - `internal_add_party_member(in_invite_id bigint, in_party_id bigint, in_player_id bigint, in_platform_session_id text, in_platform_name text, in_max_party_member_count integer)` + - `internal_create_party(in_invite_id bigint, in_leader_id bigint, in_leader_platform_session_id text, in_leader_platform_name text, in_member_id bigint, in_platform_sessio...)` + - `is_player_guild_admin(in_player_id bigint, in_guild_id bigint)` + - `is_player_offline(in_fls_id text)` + - `is_player_party_leader(in_player_id bigint, in_party_id bigint)` + - `join_platform_session_party(in_leader_platform_id text, in_player_platform_id text, in_platform_session_id text, in_platform_name text, in_max_party_member_count integer)` + - `journey_story_node_cooldown_add(in_account_id bigint, in_story_node_id text, in_time_to_expire timestamp without time zone)` + - `journey_story_node_cooldown_delete_expired(in_time_to_check timestamp without time zone)` + - `landsraad_cast_vote(in_term_id bigint, in_player_id bigint, in_decree_name text)` + - `landsraad_change_term_end_time(end_term_id bigint, new_end_time timestamp without time zone, in_test_term boolean)` + - `landsraad_check_task_completion()` + - `landsraad_check_term_won()` + - `landsraad_collect_task_telemetry_for_faction(in_term_id bigint, in_faction_name text)` + - `landsraad_collect_term_telemetry(in_term_id bigint, in_faction_names text[])` + - `landsraad_collect_term_telemetry_for_faction(in_term_id bigint, in_faction_name text)` + - `landsraad_collect_vote_telemetry(in_term_id bigint, in_winning_faction_id integer)` + - `landsraad_collect_votes(in_term_id bigint)` + - `landsraad_determine_winner(in_term_id bigint)` + - `landsraad_force_end_term(end_term_id bigint)` + - `landsraad_has_term_of_task_ended(in_task_id bigint)` + - `landsraad_initialize_system(number_of_weeks_term_retention integer, number_of_nominated_decrees integer, in_end_time timestamp without time zone, in_test_term boolean, faction...)` + - `landsraad_initialize_term(number_of_weeks_term_retention integer, number_of_nominated_decrees integer, in_end_time timestamp without time zone, in_test_term boolean, tasks d...)` + - `landsraad_insert_task_progress(in_term_id bigint, in_player_id bigint, in_guild_id bigint, in_house_name text, in_faction_progress integer, in_guild_progress real, in_player_prog...)` + - `landsraad_insert_task_progress_batched(in_term_id bigint, in_task_progress dune.landsraadtaskprogress[])` + - `landsraad_insert_task_progress_faction(in_term_id bigint, in_faction_name text, in_house_name text, in_faction_progress integer, in_guild_progress real, in_player_progress real)` + - `landsraad_insert_task_progress_random(in_term_id bigint, in_faction_names text[], in_num_rows integer)` + - `landsraad_load_current_rotation(in_term_id bigint)` + - `landsraad_load_current_term()` + - `landsraad_load_guild_contribution(in_term_id bigint, in_guild_id bigint, in_faction_id bigint)` + - `landsraad_load_guild_contributions(in_term_id bigint, in_num_guilds integer, in_faction_names text[])` + - `landsraad_load_guild_vote(in_term_id bigint, in_player_id bigint)` + - `landsraad_load_house_rewards(in_player_id bigint)` + - `landsraad_load_player_contributions(in_term_id bigint, in_player_ids bigint[])` + - `landsraad_load_task_faction_progress(in_term_id bigint)` + - `landsraad_load_task_faction_reveal_state(in_term_id bigint)` + - `landsraad_load_term_progress(in_term_id bigint, in_num_guilds integer, in_faction_names text[], in_player_ids bigint[])` + - `landsraad_notify_house_rewards_changed()` + - `landsraad_perform_daily_task_reveal(in_term_id bigint, in_faction_names text[], in_house_names_to_reveal text[], in_reveal_day integer)` + - `landsraad_process_house_rewards()` + - `landsraad_process_task_progress(max_rows integer)` + - `landsraad_task_has_been_completed(in_task_id bigint)` + - `landsraad_update_task_faction_reveal_state(in_term_id bigint, in_task_board_index integer, faction_name text, reveal_state boolean)` + - `landsraad_withdraw_house_reward(in_player_id bigint, in_house_rewards dune.landsraadplayerhousereward[])` + - `load_actors(in_actor_ids bigint[], in_actor_state dune.actorstate)` + - `load_backup_vehicle(in_account_id bigint)` + - `load_building(in_building_id bigint)` + - `load_communinet_player_data(in_account_id bigint)` + - `load_dialogue_data(in_player_controller_id bigint, OUT met_npcs text[], OUT taken_nodes integer[])` + - `load_dimension_index(in_map text, in_partition_id bigint)` + - `load_events_log_data_from_player(in_actor_id bigint, in_limit_entries_num integer)` + - `load_full_actors(in_ids bigint[])` + - `load_item(in_item_id bigint)` + - `load_items(in_inventory_id bigint)` + - `load_map_areas_entries(in_account_id bigint, in_map_name text)` + - `load_markers(in_player_id bigint, in_dimension_id integer, in_map_name text)` + - `load_partition_definition_map()` + - `load_placeable(in_placeable_id bigint)` + - `load_recovered_vehicles(in_account_id bigint, in_restore_time_limit integer)` + - `load_static_encounter_name(in_map_name text, in_package_name text, in_actor_name text)` + - `load_takeoverable_user_ids()` + - `load_totem(in_id bigint)` + - `load_travel_return_info(in_player_controller_id bigint)` + - `load_travel_to_player_info(in_player_controller_id bigint)` + - `load_vehicle_modules(in_vehicle_id bigint)` + - `load_world_partition(in_map_name text, in_server_id text, in_desired_dimension_index bigint, in_desired_partition_id bigint)` + - `log_cheating(in_fls_id text, in_cheat_type dune.cheat_type_enum, in_event_time timestamp with time zone)` + - `log_event_solaris(in_function_oid oid, in_message dune.logmessagetype, in_controller_id bigint, in_solaris_balance bigint, in_solaris_delta bigint)` + - `login_account(in_user_id text, in_funcom_id text, in_platform_id text, in_platform_name text, in_minimum_returning_player_time_seconds integer, in_character_name...)` + - `mark_server_dead(in_server_id text)` + - `merge_inventory_items(in_item_id bigint, in_dst_inventory_id bigint, in_dst_index bigint, in_count bigint)` + - `merge_or_move_inventory_item(in_item_id bigint, in_dst_inventory_id bigint, in_dst_index bigint, in_count bigint)` + - `migrate_character(in_account_id bigint, home_dimension integer, max_solaris_allowed bigint)` + - `migrate_clamp_max_allow_solaris(in_pawn_id bigint, max_solaris_allowed bigint)` + - `move_inventory_item(in_item_id bigint, in_dst_inventory_id bigint, in_dst_index bigint, in_count bigint)` + - `overmap_delete_player_survival_data(in_player_id bigint)` + - `overmap_load_player_survival_data(in_player_id bigint)` + - `overmap_save_player_survival_data(in_player_id bigint, in_vehicle_id bigint, in_has_polar_psu boolean, in_overmap_location dune.vector)` + - `ownership_handle_actor_delete(in_player_id bigint)` + - `parties_get_exclusive_operation_lock()` + - `perform_notify_on_character_delete(in_user_id text)` + - `permission_actor_create_or_update_base_marker(in_actor_id bigint, in_player_id bigint, in_rank smallint)` + - `permission_actor_destroy(in_actor_id bigint)` + - `permission_actor_register(in_entry dune.actorpermissionentry, in_owner_rank dune.actorpermissionrankdata)` + - `permission_actor_takeover(in_entry dune.actorpermissionentry, in_owner_rank dune.actorpermissionrankdata)` + - `permission_actor_update_marker_location(in_actor_id bigint, in_location_x real, in_location_y real, in_location_z real)` + - `permission_remove_player_rank(in_actor_id bigint, in_player_id bigint)` + - `permission_set_access_level(in_actor_id bigint, in_access_level smallint)` + - `permission_set_name(in_actor_id bigint, in_name text)` + - `permission_set_player_rank(in_actor_id bigint, in_player_id bigint, in_rank smallint, in_map_id text)` + - `player_purchased_item_from_vendor(in_vendor_id text, in_player_id bigint, in_template_id text, in_amount_bought integer)` + - `player_state_update(in_data dune.playerstateupdatedata[])` + - `pledge_guild_allegiance(in_guild_id bigint, in_guild_leader_player_id bigint, in_neutral_faction_id smallint)` + - `produce_spicefield_manifest(in_map_name text, in_dimension_index integer)` + - `promote_guild_member(in_guild_id bigint, in_player_id bigint, in_new_role smallint)` + - `promote_new_party_leader(in_party_id bigint)` + - `promote_party_leader_to(in_party_id bigint, in_player_id bigint)` + - `purchase_specialization_keystone(in_player_id bigint, in_keystone text)` + - `record_deactivated_spice_field(in_server_id text, in_spicefield_type_id integer)` + - `record_dungeon_completion(in_dungeon_id text, in_difficulty integer, in_duration_ms integer, players_ids bigint[])` + - `record_logoff_persistence_end_time(in_player_pawn_id bigint, in_logoff_persistence_end_time timestamp without time zone)` + - `record_static_shifting_sand(in_id text, in_alpha double precision, in_x double precision, in_y double precision, in_last_modified_time bigint)` + - `record_unreadied_spice_fields(in_server_id text, in_spicefield_type_id integer, in_num_unreadied integer)` + - `register_lore_pickup(in_lore_pickup_ids text[])` + - `register_new_factions(factions text[])` + - `register_new_tutorials(tutorials text[])` + - `register_per_player_lore_pickup(in_lore_pickup_ids text[], in_use_temporary boolean)` + - `register_spawned_actor(in_spawner_id bigint, in_actor_id bigint)` + - `register_spice_field_server_resources(in_server_id text, in_spicefield_type_ids integer[], in_inactive_fields_of_types integer[])` + - `register_temporary_lore_pickup(in_lore_pickup_ids text[])` + - `reject_guild_invite(in_invite_id bigint)` + - `remove_aborted_authority_transfer_actors(in_partition_id bigint)` + - `remove_character_transfer_state(in_fls_id text)` + - `remove_communinet_player_channel(in_account_id bigint, in_channel_name text)` + - `remove_guild_members(in_player_ids bigint[], in_guild_id bigint, in_remove_reason smallint)` + - `remove_items(items_to_remove text[])` + - `remove_items_and_recipes(items_to_remove text[], recipes_to_remove text[])` + - `remove_items_or_recipes_from_fgl_entities(item_or_recipes text[])` + - `remove_members_offline_for(in_interval_seconds integer)` + - `remove_party_invite(in_invite_id bigint, in_remove_reason smallint)` + - `remove_party_member(in_player_id bigint, in_remove_reason smallint)` + - `remove_recipes_from_actor_properties(recipes_to_remove text[])` + - `remove_resourcefield_states(in_map text, in_dimension_index integer, in_field_ids bigint[])` + - `request_spawn_spice_field(in_server_id text, in_spicefield_type_id integer)` + - `reset_all_players_from_server_ids_grace_period_and_logoff_timer(in_server_id text, in_reset_time timestamp without time zone)` + - `reset_global_spice_field_state(in_map_name text, in_dimension_index integer)` + - `reset_journey_story_nodes_for_player(in_player_id text, in_story_node_ids text[])` + - `reset_server_all_player_access_codes(in_account_id bigint)` + - `reset_specialization_keystones(in_player_id bigint)` + - `reset_specialization_tracks(in_player_id bigint)` + - `restore_backup_vehicle(in_account_id bigint, in_server_info dune.serverinfo, in_transform dune.transform)` + - `restore_recovered_vehicle(in_account_id bigint, in_vehicle_id bigint, in_server_info dune.serverinfo, in_transform dune.transform, in_restore_time_limit integer)` + - `retrieve_all_static_shifting_sand()` + - `returning_player_award_given(in_account_id bigint)` + - `reveal_journey_story_nodes_for_player(in_player_id text, in_story_node_ids text[])` + - `save_aborted_authority_transfer_actors(in_actor_ids bigint[], in_partition_id bigint)` + - `save_actor_dislocation(in_actor_id bigint, in_current_server_info dune.serverinfo, in_target_location dune.vector, in_target_dimension_index integer)` + - `save_actors(in_server_info dune.serverinfo, in_actors dune.actordescription[], in_actor_state dune.actorstate)` + - `save_building(in_building_id bigint, in_data dune.buildingsavedata)` + - `save_building_blueprint_copy(in_building_item_id bigint, in_building_blueprint_id bigint, in_building_blueprint_building_data dune.buildingblueprintpiecesaveitemcontainer[], in...)` + - `save_demo_account_time(in_fls_id text, in_demo_playtime_seconds integer)` + - `save_dialogue_data(in_player_controller_id bigint, in_met_npcs text[], in_taken_nodes integer[])` + - `save_item(in_item dune.inventoryitem)` + - `save_journey_story_node(in_account_id bigint, in_story_node_id text, in_override_reward_block boolean, in_has_pending_reward boolean, in_complete_condition_state jsonb, in...)` + - `save_journey_story_nodes(in_account_id bigint, in_journey_data dune.savejourneydata[])` + - `save_login_target_dimension(in_fls_id text, in_login_target_dimension_index integer)` + - `save_markers(in_player_marker_data dune.saveplayermarkerdata[], in_marker_data dune.savemarkerdata[])` + - `save_mnemonic_recall_lesson(in_account_id bigint, in_lesson_id text, in_lesson_state bigint, in_lesson_progress integer, in_is_new boolean)` + - `save_placeable(in_placeable_id bigint, in_data dune.placeablesavedata)` + - `save_player(in_player dune.playerdescription)` + - `save_player_pawn(in_pawn dune.actordescription, in_server_info dune.serverinfo, in_life_state dune.playerlifestate)` + - `save_static_encounter_name(in_map_name text, in_package_name text, in_actor_name text, in_encounter_name text)` + - `save_static_encounter_waiting_for_reset(in_map_name text, in_package_name text, in_actor_name text, in_waiting_for_reset boolean)` + - `save_totem(in_id bigint, in_data dune.totemsavedata)` + - `save_tracked_journey_cards(in_player_id bigint, in_tracked_journey_card text, in_tracked_landsraad_card text)` + - `save_travel_return_info(in_player_controller_id bigint, in_map text, in_transform dune.transform)` + - `save_vehicle_modules(in_add_list dune.vehiclemodule[], in_delete_list bigint[], in_stat_update dune.itemstatupdate[])` + - `save_world_partition(in_map_name text, in_server_id text, in_dimension_index bigint, in_partition_definition jsonb, in_blocked boolean, in_label text)` + - `server_info_match(in_actor dune.actors, in_server_info dune.serverinfo)` + - `set_account_as_takeoverable(in_user_id text, in_new_user_id text)` + - `set_all_inactive_players_in_farm_offline()` + - `set_battlegroup_close_date(in_close_date timestamp without time zone)` + - `set_character_import_state(in_fls_id text, in_state dune.transferimportstate)` + - `set_character_name(in_account_id bigint, in_name text)` + - `set_demo_state(in_user_id text, in_demo_state dune.demostate)` + - `set_item_tracking_enabled(in_enabled boolean)` + - `set_player_faction_reputation(in_actor_id bigint, in_faction_id smallint, in_reputation_amount integer)` + - `set_players_from_server_ids_offline(in_server_ids text[])` + - `set_specialization_xp_and_level(in_player_id bigint, in_track_type dune.specializationtracktype, in_xp_amount integer, in_level real)` + - `store_backup_vehicle(in_vehicle_id bigint, in_account_id bigint, in_customization_id text)` + - `store_recovered_vehicle(in_vehicle_id bigint, in_chassis_durability real, in_customization_id text, in_is_migration boolean)` + - `store_recovered_vehicles_wiped_before_spawn(in_vehicle_ids bigint[], in_delete_items boolean)` + - `takeover_account(in_user_to_takeover text, in_current_user text)` + - `taxation_emit_invoices(new_tax_invoices dune.taxinvoicedata[])` + - `taxation_get_all_invoices_for_player(in_player_id bigint)` + - `taxation_get_all_invoices_for_server(map_name text, in_dimension_index integer, in_partition_id bigint)` + - `taxation_get_all_invoices_for_totem(in_totem_id bigint)` + - `taxation_pay_invoice(invoice_id bigint, paid_invoice_status smallint)` + - `taxation_remove_invoices(invoices_to_remove bigint[])` + - `taxation_remove_invoices_from_totem(totem_actor_id bigint)` + - `taxation_update_invoice_status(invoices_to_overdue bigint[], invoices_to_defaulted bigint[], overdue_invoice_status smallint, defaulted_invoice_status smallint)` + - `try_prime_spicefield(in_source_server_id text, in_spicefield_id integer)` + - `try_restart_spicefield(in_server_id text, in_spicefield_type_id integer)` + - `try_spawn_spicefield(in_source_server_id text, in_spicefield_id integer)` + - `try_update_exchange_categories_hash(in_new_hash integer)` + - `unassign_partition(in_server_id text)` + - `update_communinet_player_channel(in_account_id bigint, in_channel_name text, in_is_tuned boolean)` + - `update_communinet_player_data(in_account_id bigint, in_is_active boolean, in_selected_channel_name text)` + - `update_consumed_per_player_lore(in_actor_id bigint, in_consumed_bit_array bit, in_use_temporary boolean)` + - `update_coriolis_for_player(in_controller_id bigint, OUT out_was_coriolis_processed boolean)` + - `update_death_location(in_pawn dune.actordescription, in_server_info dune.serverinfo, in_life_state dune.playerlifestate)` + - `update_farm_state(in_server_id text, in_outgoing_s2s_connections integer, in_incoming_s2s_connections integer, in_connected_players integer, in_farm_id text, in_igw_...)` + - `update_global_spice_field_rules(in_max_globally_primed integer, in_max_globally_active integer, in_spicefield_type_id integer)` + - `update_inventories_data(in_inventory_data_list dune.inventorydata[])` + - `update_inventory(in_delete_list bigint[], in_stack_update dune.itemstackupdate[], in_quality_update dune.itemqualityupdate[], in_stat_update dune.itemstatupdate[], ...)` + - `update_item_locations(in_item_locations dune.inventoryitemlocation[])` + - `update_journey_story_ids(old_story_ids text[], new_story_ids text[])` + - `update_marker_ids(in_old_ids integer[], in_new_ids integer[])` + - `update_partition_labels(in_allow_overwrite boolean)` + - `update_party_platform_session(in_party_id bigint, in_platform_session_id text, in_platform_name text)` + - `update_player_tags(in_account_id bigint, tags_to_add text[], tags_to_remove text[])` + - `update_removed_items_and_recipes(items_removed text[], recipes_removed text[])` + - `update_resourcefield_states(in_map text, in_dimension_index integer, in_field_kind_id smallint, in_field_states dune.resourcefieldstateentry[])` + - `update_respawn_locations(player_id bigint, respawn_locations dune.respawnlocation[])` + - `update_returning_player_status(in_user_id text, in_minimum_returning_player_time_seconds integer)` + - `update_sell_orders_categories(category_update_data dune.exchangecategoryupdatedata[])` + - `update_server_building_favorites(in_account_id bigint, in_building_types text[])` + - `update_server_learned_building_sets(in_account_id bigint, in_learned_building_sets text[])` + - `update_server_learned_new_buildable_pieces(in_account_id bigint, in_new_buildable_pieces text[])` + - `update_specialization_refund_id(in_player_id bigint, in_refund_id smallint, in_removed_keystones smallint[])` + - `update_spice_field_spawn_state(in_is_spawning_active boolean, in_spicefield_type_id integer)` + - `update_traveling_actor_dependencies(in_dep dune.traveldependency[])` + - `update_traveling_actor_tree(in_actor_id bigint, in_target_transform dune.transform, in_target_map text, in_target_dimension_index integer, in_target_partition_id bigint)` + - `update_universe_time(in_farm_id text)` + - `update_vendor_timestamp_for_player(in_vendor_id text, in_player_id bigint, in_timestamp bigint)` + - `upgrade_location_data_list(in_location_data_list jsonb, in_map_field_name text)` + - `upgrade_map_name(in_map_name text)` + - `upgrade_map_value(in_value jsonb)` + - `upsert_spicefield_types(in_max_globally_active integer[], in_max_globally_primed integer[], in_field_types text[], in_map_name text, in_dimension_index integer)` + - `use_sinkchart(in_player_id bigint, in_account_id bigint, in_area_id smallint, in_item_id bigint, in_sinkchart_map_name text, in_player_map_name text, in_player_c...)` + - `verify_item_dup_backup_tool(in_account_id bigint, in_vehicle_id bigint, in_cheat_type dune.cheat_type_enum)` + - `wipe_old_events_log(in_days_limit integer)` + - `zero_transform()` + +28. **Database table counts (active server):** + - `encrypted_accounts`: 10 rows, `encrypted_player_state`: 10 rows + - `actors`: 411 rows, `items`: 1,482, `inventories`: 459 + - `buildings`: 8, `vehicles`: 16, `guilds`: 1 (4 members) + - `bans`: 0, `factions`: 4 (Atreides, Harkonnen, Fremen, Corrino) + - `game_events`: 76, `chat_history`: unknown + - `dashboard.*` tables: `bans`, `chat_history`, `player_actions`, `player_ips` +29. **Dashboard Admin Experimental tab expanded with tools:** + - Search Players (via `admin_get_character_ids`) + - Online Players list (via `get_all_online_or_recently_disconnected_player_online_state()`) + - Adjust Currency (via direct SQL to `player_virtual_currency_balances`) + - View Currency Balances (via `get_player_virtual_currency_balances`) + - Change Faction (via direct SQL to `player_faction`) + - Faction Reputation View/Set (via `get_player_current_faction_reputation` / `set_player_faction_reputation`) + - Inventory Lookup (via `admin_get_inventory_details`) + - Teleport Player (via `admin_move_offline_player_to_partition`) + - Guild Tools: List, View, Disband, Kick Member (via `get_guild_data`, `disband_guild`, `remove_guild_members`) + - Player Tags: View & Update (via `admin_read_player_tags`, `update_player_tags`) + - Flag Cheater (via `flag_player_as_cheater`) + - Player Vehicles (via `get_player_owned_vehicles_data`) + - Player Stats Viewer (health, spice exposure, etc. from `actors.properties` JSONB) + - Character Management: rename, delete character, delete account, set demo state + - Journey & Specialization: complete/reveal/reset story nodes, set/reset specialization tracks + - Guild Roster: list members, promote/demote + - Economy: reset vendor stock for player, view tax invoices + - Spice Fields: force spice spawn, reset spice state + - Server Tools: set players offline, cleanup orphans + - Permissions: view actor permissions, set player rank + - Function Explorer: browse and execute all 517 DB functions dynamically with parameter input + - Battlegroup Info viewer (via BGD API `/v0/battlegroup`) + - (Broadcast via RMQ was already done in finding #22) + - API endpoints in `routes/api.py`: + - `POST /api/admin-experimental/broadcast` + - `POST /api/admin-experimental/query` (read-only SQL) + - `POST /api/admin-experimental/search-players` + - `GET /api/admin-experimental/online-players` + - `POST /api/admin-experimental/adjust-currency` + - `POST /api/admin-experimental/currency-balances` + - `POST /api/admin-experimental/change-faction` + - `POST /api/admin-experimental/faction-reputation` + - `POST /api/admin-experimental/inventory` + - `POST /api/admin-experimental/teleport` + - `GET /api/admin-experimental/partitions` + - `GET /api/admin-experimental/guilds` + - `POST /api/admin-experimental/guild-data` + - `POST /api/admin-experimental/disband-guild` + - `POST /api/admin-experimental/remove-guild-member` + - `POST /api/admin-experimental/player-tags` + - `POST /api/admin-experimental/flag-cheater` + - `POST /api/admin-experimental/player-vehicles` + - `POST /api/admin-experimental/player-stats` + - `POST /api/admin-experimental/set-character-name` + - `POST /api/admin-experimental/delete-character` + - `POST /api/admin-experimental/delete-account` + - `POST /api/admin-experimental/set-demo-state` + - `POST /api/admin-experimental/journey` + - `POST /api/admin-experimental/specialization` + - `POST /api/admin-experimental/guild-members` + - `POST /api/admin-experimental/clean-vendor-stock` + - `POST /api/admin-experimental/tax-invoices` + - `POST /api/admin-experimental/spice` + - `POST /api/admin-experimental/server-tools` + - `POST /api/admin-experimental/permissions` + - `GET /api/admin-experimental/functions` + - `GET /api/admin-experimental/functions/` + - `POST /api/admin-experimental/functions//execute` + - `GET /api/admin-experimental/battlegroup` + - `POST /api/admin-experimental/execute` (admin functions) +30. **Key insight about kubectl exec from dashboard:** The paramiko SSH `exec_command` doesn't support heredocs well. The working pattern for piping content into pods is: + - Write content to a temp file on VM host via `echo base64 | base64 -d | sudo tee /tmp/file` + - Then pipe into pod: `cat /tmp/file | sudo kubectl exec -i -n ns pod -- sh -lc 'cat > /tmp/pod_file && command "$(cat /tmp/pod_file)"'` + - Clean up both temp files after + +31. **`search_path` issue with DB functions:** PostgreSQL's default `search_path` is `"$user", public` — the `dune` schema is NOT on it. Any function defined in the `dune` schema that references tables without the `dune.` prefix (e.g., `accounts`, `player_state`, `actors`, `world_partition`) will fail when called from outside the schema. Our `teleport_player()` fix: run `SET search_path TO dune, public` before calling the function. This affects the teleport function `admin_move_offline_player_to_partition` and likely many of the 517 functions. + +32. **Table name correction:** The table is `dune.world_partition` (singular), NOT `dune.world_partitions` (plural). `accounts` and `player_state` are **views** in the `dune` schema, not physical tables. Other notable tables: + - `dune.actors` (physical) — id, class, map, owner_account_id, properties JSONB + - `dune.world_partition` — partition_id, server_id, map, dimension_index, label, blocked, partition_definition JSONB + - `dune.player_virtual_currency_balances` — player_controller_id, currency_id, balance + - `dune.player_faction` — actor_id, faction_id + - `dune.player_faction_reputation` — actor_id, faction_id, reputation_amount + - `dune.player_tags` — account_id, tag + - `dune.vehicles` — id, actor_id + - `dune.player_state` (view) — account_id, character_name, player_controller_id, player_pawn_id, online_status + - `dune.accounts` (view) — id, user + - `dune.encrypted_accounts` — id, user, platform_id + +--- + +## 13. TROUBLESHOOTING TIPS + +### PowerShell Quoting for SSH Commands +PowerShell interprets `$`, `|`, `>`, `<`, `&&`, `;`, `(`, `)` in SSH command strings. Workarounds: +```powershell +# Use single quotes for outer string +ssh -i user@host 'command with $vars' + +# Or pipe scripts via stdin +Get-Content script.sh -Raw | ssh "cat > /tmp/scr.sh && bash /tmp/scr.sh" +``` + +### TR Auth Testing +```bash +# From inside the VM: +sudo kubectl exec -n -- wget -q -O- \ + --post-data="username=&password=" \ + http://-tr-svc:5059/v0/auth/user +``` +Returns `allow` or `deny`. + +### Common NodePort Connection Issues +- SSH tunnel may drop (restart via dashboard launcher) +- Windows firewall may block connections to VM IP on non-standard ports +- AMQP connections require TLS (certificate from `/etc/rabbitmq/`) + +### Modifying RMQ ConfigMaps +The battlegroup operators continuously reconcile ConfigMaps. To make changes: +```bash +# 1. Scale down all operators +sudo kubectl scale deployment -n funcom-operators --replicas=0 \ + battlegroupoperator-controller-manager \ + databaseoperator-controller-manager \ + serveroperator-controller-manager \ + utilitiesoperator-controller-manager + +# 2. Make your ConfigMap changes (use kubectl replace with YAML file) +# 3. Restart affected pods +sudo kubectl delete pod -n + +# 4. Scale operators back up +sudo kubectl scale deployment -n funcom-operators --replicas=1 \ + battlegroupoperator-controller-manager \ + databaseoperator-controller-manager \ + serveroperator-controller-manager \ + utilitiesoperator-controller-manager +``` diff --git a/app/routes/api.py b/app/routes/api.py index b433140..fa13901 100644 --- a/app/routes/api.py +++ b/app/routes/api.py @@ -1215,3 +1215,535 @@ def register_api_routes(app, services, settings): except Exception as e: logger.error(f"Failed to toggle debug: {e}") return jsonify({'success': False, 'error': str(e)}), 500 + + # ── Admin Experimental: Broadcast ───────────────────────────────── + @app.route('/api/admin-experimental/broadcast', methods=['POST']) + @auth_req + @limiter.limit("100 per hour") + def admin_broadcast(): + data = request.get_json() or {} + title = (data.get('title') or '').strip() + message = (data.get('message') or '').strip() + try: + duration = int(data.get('duration', 30)) + except (ValueError, TypeError): + duration = 30 + if not title or not message: + return jsonify({'success': False, 'error': 'Title and message are required'}) + success, result = admin_svc.send_global_broadcast(title, message, duration) + return jsonify({'success': success, 'output': result}) + + # ── Admin Experimental: Query Database ──────────────────────────── + @app.route('/api/admin-experimental/query', methods=['POST']) + @auth_req + @limiter.limit("300 per hour") + def admin_query(): + data = request.get_json() or {} + sql = (data.get('sql') or '').strip() + if not sql: + return jsonify({'success': False, 'error': 'SQL is required'}) + lower = sql.strip().lower() + if not any(lower.startswith(w) for w in ('select', 'with', 'show', 'explain')): + return jsonify({'success': False, 'error': 'Only SELECT/WITH queries allowed'}) + result = admin_svc.admin_db_query(sql) + return jsonify({'success': True, 'rows': result or []}) + + # ── Admin Experimental: Search Players ──────────────────────────── + @app.route('/api/admin-experimental/search-players', methods=['POST']) + @auth_req + def admin_search_players(): + data = request.get_json() or {} + term = (data.get('term') or '').strip() + if not term: + return jsonify({'success': False, 'error': 'Search term required'}) + try: + results = admin_svc.search_players(term) + return jsonify({'success': True, 'players': results}) + except Exception as e: + return jsonify({'success': False, 'error': str(e)}) + + # ── Admin Experimental: Online Players ───────────────────────────── + @app.route('/api/admin-experimental/online-players', methods=['GET']) + @auth_req + def admin_online_players(): + try: + players = admin_svc.get_online_players() + return jsonify({'success': True, 'players': players}) + except Exception as e: + return jsonify({'success': False, 'error': str(e)}) + + # ── Admin Experimental: Adjust Currency ─────────────────────────── + @app.route('/api/admin-experimental/adjust-currency', methods=['POST']) + @auth_req + @limiter.limit("200 per hour") + def admin_adjust_currency(): + data = request.get_json() or {} + pid = data.get('player_controller_id') + cid = data.get('currency_id') + delta = data.get('delta') + if pid is None or cid is None or delta is None: + return jsonify({'success': False, 'error': 'player_controller_id, currency_id, and delta required'}) + success, result = admin_svc.adjust_currency(pid, int(cid), int(delta)) + return jsonify({'success': success, 'output': result}) + + # ── Admin Experimental: Change Faction ──────────────────────────── + @app.route('/api/admin-experimental/change-faction', methods=['POST']) + @auth_req + @limiter.limit("100 per hour") + def admin_change_faction(): + data = request.get_json() or {} + pid = data.get('player_id') + fid = data.get('faction_id') + if pid is None or fid is None: + return jsonify({'success': False, 'error': 'player_id and faction_id required'}) + success, result = admin_svc.change_faction(pid, int(fid)) + return jsonify({'success': success, 'output': result}) + + # ── Admin Experimental: Battlegroup Info ────────────────────────── + @app.route('/api/admin-experimental/battlegroup', methods=['GET']) + @auth_req + def admin_battlegroup(): + try: + out, err, rc = ssh.run("wget -qO- http://10.43.135.0:11717/v0/battlegroup", timeout=15) + if rc != 0 or not out: + return jsonify({'success': False, 'error': f'BGD unreachable: {err}'}) + parsed = json.loads(out) + return jsonify({'success': True, 'data': parsed}) + except Exception as e: + return jsonify({'success': False, 'error': str(e)}) + + # ── Admin Experimental: View Currency Balances ──────────────────── + @app.route('/api/admin-experimental/currency-balances', methods=['POST']) + @auth_req + def admin_currency_balances(): + data = request.get_json() or {} + pcid = data.get('player_controller_id') + if not pcid: + return jsonify({'success': False, 'error': 'player_controller_id required'}) + try: + result = admin_svc.get_currency_balances(pcid) + return jsonify({'success': True, 'balances': result}) + except Exception as e: + return jsonify({'success': False, 'error': str(e)}) + + # ── Admin Experimental: Teleport Player ─────────────────────────── + @app.route('/api/admin-experimental/teleport', methods=['POST']) + @auth_req + @limiter.limit("100 per hour") + def admin_teleport(): + data = request.get_json() or {} + fls_id = data.get('fls_id') + partition_id = data.get('partition_id') + x = data.get('x', 0) + y = data.get('y', 0) + z = data.get('z', 0) + if not fls_id or not partition_id: + return jsonify({'success': False, 'error': 'fls_id and partition_id required'}) + try: + success, msg = admin_svc.teleport_player(fls_id, int(partition_id), float(x), float(y), float(z)) + return jsonify({'success': success, 'output': msg}) + except Exception as e: + return jsonify({'success': False, 'error': str(e)}) + + @app.route('/api/admin-experimental/partitions', methods=['GET']) + @auth_req + def admin_partitions(): + try: + partitions = admin_svc.get_partitions() + return jsonify({'success': True, 'partitions': partitions}) + except Exception as e: + return jsonify({'success': False, 'error': str(e)}) + + # ── Admin Experimental: Faction Reputation ──────────────────────── + @app.route('/api/admin-experimental/faction-reputation', methods=['POST']) + @auth_req + def admin_faction_reputation(): + data = request.get_json() or {} + actor_id = data.get('actor_id') + if not actor_id: + return jsonify({'success': False, 'error': 'actor_id required'}) + try: + # GET mode + if 'set' not in data: + result = admin_svc.get_faction_reputation(actor_id) + return jsonify({'success': True, 'reputation': result}) + else: + success, msg = admin_svc.set_faction_reputation(actor_id, int(data['faction_id']), int(data['amount'])) + return jsonify({'success': success, 'output': msg}) + except Exception as e: + return jsonify({'success': False, 'error': str(e)}) + + # ── Admin Experimental: Inventory Lookup ────────────────────────── + @app.route('/api/admin-experimental/inventory', methods=['POST']) + @auth_req + def admin_inventory(): + data = request.get_json() or {} + account_id = data.get('account_id') + if not account_id: + return jsonify({'success': False, 'error': 'account_id required'}) + try: + inv = admin_svc.get_inventory(account_id) + pawn = admin_svc.get_player_pawn(account_id) + return jsonify({'success': True, 'inventory': inv, 'pawn': pawn}) + except Exception as e: + return jsonify({'success': False, 'error': str(e)}) + + # ── Admin Experimental: Guild Tools ──────────────────────────────── + @app.route('/api/admin-experimental/guilds', methods=['GET']) + @auth_req + def admin_guilds(): + try: + guilds = admin_svc.get_all_guilds() + return jsonify({'success': True, 'guilds': guilds}) + except Exception as e: + return jsonify({'success': False, 'error': str(e)}) + + @app.route('/api/admin-experimental/guild-data', methods=['POST']) + @auth_req + def admin_guild_data(): + data = request.get_json() or {} + guild_id = data.get('guild_id') + if not guild_id: + return jsonify({'success': False, 'error': 'guild_id required'}) + try: + guild = admin_svc.get_guild_data(guild_id) + return jsonify({'success': True, 'guild': guild}) + except Exception as e: + return jsonify({'success': False, 'error': str(e)}) + + @app.route('/api/admin-experimental/disband-guild', methods=['POST']) + @auth_req + @limiter.limit("50 per hour") + def admin_disband_guild(): + data = request.get_json() or {} + guild_id = data.get('guild_id') + if not guild_id: + return jsonify({'success': False, 'error': 'guild_id required'}) + try: + success, msg = admin_svc.disband_guild(guild_id) + return jsonify({'success': success, 'output': msg}) + except Exception as e: + return jsonify({'success': False, 'error': str(e)}) + + @app.route('/api/admin-experimental/remove-guild-member', methods=['POST']) + @auth_req + @limiter.limit("100 per hour") + def admin_remove_guild_member(): + data = request.get_json() or {} + guild_id = data.get('guild_id') + player_id = data.get('player_id') + if not guild_id or not player_id: + return jsonify({'success': False, 'error': 'guild_id and player_id required'}) + try: + success, msg = admin_svc.remove_guild_member(guild_id, player_id) + return jsonify({'success': success, 'output': msg}) + except Exception as e: + return jsonify({'success': False, 'error': str(e)}) + + # ── Admin Experimental: Player Tags ──────────────────────────────── + @app.route('/api/admin-experimental/player-tags', methods=['POST']) + @auth_req + def admin_player_tags(): + data = request.get_json() or {} + account_id = data.get('account_id') + if not account_id: + return jsonify({'success': False, 'error': 'account_id required'}) + try: + if 'tags_to_add' in data or 'tags_to_remove' in data: + success, msg = admin_svc.update_player_tags(account_id, data.get('tags_to_add', []), data.get('tags_to_remove', [])) + return jsonify({'success': success, 'output': msg}) + else: + tags = admin_svc.get_player_tags(account_id) + return jsonify({'success': True, 'tags': tags}) + except Exception as e: + return jsonify({'success': False, 'error': str(e)}) + + @app.route('/api/admin-experimental/flag-cheater', methods=['POST']) + @auth_req + @limiter.limit("50 per hour") + def admin_flag_cheater(): + data = request.get_json() or {} + account_id = data.get('account_id') + cheat_type = data.get('cheat_type', 'manual') + if not account_id: + return jsonify({'success': False, 'error': 'account_id required'}) + try: + success, msg = admin_svc.flag_cheater(account_id, cheat_type) + return jsonify({'success': success, 'output': msg}) + except Exception as e: + return jsonify({'success': False, 'error': str(e)}) + + # ── Admin Experimental: Player Vehicles ─────────────────────────── + @app.route('/api/admin-experimental/player-vehicles', methods=['POST']) + @auth_req + def admin_player_vehicles(): + data = request.get_json() or {} + player_id = data.get('player_id') + account_id = data.get('account_id') + if not player_id or not account_id: + return jsonify({'success': False, 'error': 'player_id and account_id required'}) + try: + vehicles = admin_svc.get_player_vehicles(player_id, account_id) + return jsonify({'success': True, 'vehicles': vehicles}) + except Exception as e: + return jsonify({'success': False, 'error': str(e)}) + + # ── Admin Experimental: Player Stats ────────────────────────────── + @app.route('/api/admin-experimental/player-stats', methods=['POST']) + @auth_req + def admin_player_stats(): + data = request.get_json() or {} + pcid = data.get('player_controller_id') + if not pcid: + return jsonify({'success': False, 'error': 'player_controller_id required'}) + try: + stats = admin_svc.get_player_stats(pcid) + return jsonify({'success': True, 'stats': stats}) + except Exception as e: + return jsonify({'success': False, 'error': str(e)}) + + # ── Admin Experimental: Character Management ────────────────────── + @app.route('/api/admin-experimental/set-character-name', methods=['POST']) + @auth_req + def admin_set_character_name(): + data = request.get_json() or {} + account_id = data.get('account_id') + name = data.get('name', '').strip() + if not account_id or not name: + return jsonify({'success': False, 'error': 'account_id and name required'}) + try: + success, msg = admin_svc.set_character_name(account_id, name) + return jsonify({'success': success, 'output': msg}) + except Exception as e: + return jsonify({'success': False, 'error': str(e)}) + + @app.route('/api/admin-experimental/delete-character', methods=['POST']) + @auth_req + @limiter.limit("20 per hour") + def admin_delete_character(): + data = request.get_json() or {} + actor_id = data.get('actor_id') + if not actor_id: + return jsonify({'success': False, 'error': 'actor_id required'}) + try: + success, msg = admin_svc.delete_character(actor_id) + return jsonify({'success': success, 'output': msg}) + except Exception as e: + return jsonify({'success': False, 'error': str(e)}) + + @app.route('/api/admin-experimental/delete-account', methods=['POST']) + @auth_req + @limiter.limit("10 per hour") + def admin_delete_account(): + data = request.get_json() or {} + user_id = data.get('user_id') + reason = data.get('reason', 'admin') + if not user_id: + return jsonify({'success': False, 'error': 'user_id required'}) + try: + success, msg = admin_svc.delete_account(user_id, reason) + return jsonify({'success': success, 'output': msg}) + except Exception as e: + return jsonify({'success': False, 'error': str(e)}) + + @app.route('/api/admin-experimental/set-demo-state', methods=['POST']) + @auth_req + def admin_set_demo_state(): + data = request.get_json() or {} + user_id = data.get('user_id') + demo_state = data.get('demo_state', 'none') + if not user_id: + return jsonify({'success': False, 'error': 'user_id required'}) + try: + success, msg = admin_svc.set_demo_state(user_id, demo_state) + return jsonify({'success': success, 'output': msg}) + except Exception as e: + return jsonify({'success': False, 'error': str(e)}) + + # ── Admin Experimental: Journey / Progression ───────────────────── + @app.route('/api/admin-experimental/journey', methods=['POST']) + @auth_req + def admin_journey(): + data = request.get_json() or {} + account_id = data.get('account_id') + node_ids = data.get('node_ids', []) + action = data.get('action', 'complete') + if not account_id or not node_ids: + return jsonify({'success': False, 'error': 'account_id and node_ids required'}) + try: + if action == 'complete': + success, msg = admin_svc.complete_journey_nodes(account_id, node_ids) + elif action == 'reveal': + success, msg = admin_svc.reveal_journey_nodes(account_id, node_ids) + elif action == 'reset': + success, msg = admin_svc.reset_journey_nodes(account_id, node_ids) + else: + return jsonify({'success': False, 'error': 'Invalid action'}) + return jsonify({'success': success, 'output': msg}) + except Exception as e: + return jsonify({'success': False, 'error': str(e)}) + + @app.route('/api/admin-experimental/specialization', methods=['POST']) + @auth_req + def admin_specialization(): + data = request.get_json() or {} + player_id = data.get('player_id') + if not player_id: + return jsonify({'success': False, 'error': 'player_id required'}) + try: + if 'reset' in data: + success, msg = admin_svc.reset_specialization(player_id) + else: + track = data.get('track_type', 'combat') + xp = data.get('xp', 0) + level = data.get('level', 1) + success, msg = admin_svc.set_specialization(player_id, track, xp, level) + return jsonify({'success': success, 'output': msg}) + except Exception as e: + return jsonify({'success': False, 'error': str(e)}) + + # ── Admin Experimental: Guild Roster ────────────────────────────── + @app.route('/api/admin-experimental/guild-members', methods=['POST']) + @auth_req + def admin_guild_members(): + data = request.get_json() or {} + guild_id = data.get('guild_id') + if not guild_id: + return jsonify({'success': False, 'error': 'guild_id required'}) + try: + if 'promote' in data: + success, msg = admin_svc.promote_guild_member(guild_id, data['player_id'], data['new_role']) + return jsonify({'success': success, 'output': msg}) + else: + members = admin_svc.get_guild_members(guild_id) + return jsonify({'success': True, 'members': members}) + except Exception as e: + return jsonify({'success': False, 'error': str(e)}) + + # ── Admin Experimental: Economy ─────────────────────────────────── + @app.route('/api/admin-experimental/clean-vendor-stock', methods=['POST']) + @auth_req + def admin_clean_vendor_stock(): + data = request.get_json() or {} + player_id = data.get('player_id') + if not player_id: + return jsonify({'success': False, 'error': 'player_id required'}) + try: + success, msg = admin_svc.clean_player_vendor_stock(player_id) + return jsonify({'success': success, 'output': msg}) + except Exception as e: + return jsonify({'success': False, 'error': str(e)}) + + @app.route('/api/admin-experimental/tax-invoices', methods=['POST']) + @auth_req + def admin_tax_invoices(): + data = request.get_json() or {} + player_id = data.get('player_id') + if not player_id: + return jsonify({'success': False, 'error': 'player_id required'}) + try: + invoices = admin_svc.get_player_tax_invoices(player_id) + return jsonify({'success': True, 'invoices': invoices}) + except Exception as e: + return jsonify({'success': False, 'error': str(e)}) + + # ── Admin Experimental: Spice Fields ────────────────────────────── + @app.route('/api/admin-experimental/spice', methods=['POST']) + @auth_req + @limiter.limit("30 per hour") + def admin_spice(): + data = request.get_json() or {} + try: + if data.get('action') == 'reset': + success, msg = admin_svc.reset_spice_state(data['map_name'], data.get('dimension_index', 0)) + else: + success, msg = admin_svc.force_spice_spawn(data['server_id'], data['spicefield_type_id']) + return jsonify({'success': success, 'output': msg}) + except Exception as e: + return jsonify({'success': False, 'error': str(e)}) + + # ── Admin Experimental: Server Tools ────────────────────────────── + @app.route('/api/admin-experimental/server-tools', methods=['POST']) + @auth_req + @limiter.limit("30 per hour") + def admin_server_tools(): + data = request.get_json() or {} + try: + if data.get('action') == 'set_offline': + success, msg = admin_svc.set_players_offline(data.get('server_ids', [])) + elif data.get('action') == 'cleanup_orphans': + success, msg = admin_svc.cleanup_orphaned() + else: + return jsonify({'success': False, 'error': 'Invalid action'}) + return jsonify({'success': success, 'output': msg}) + except Exception as e: + return jsonify({'success': False, 'error': str(e)}) + + # ── Admin Experimental: Permissions ────────────────────────────── + @app.route('/api/admin-experimental/permissions', methods=['POST']) + @auth_req + def admin_permissions(): + data = request.get_json() or {} + try: + if 'set_rank' in data: + success, msg = admin_svc.set_player_rank(data['actor_id'], data['player_id'], data['rank'], data.get('map_id', '')) + return jsonify({'success': success, 'output': msg}) + elif data.get('actor_id'): + perms = admin_svc.get_actor_permissions(data['actor_id']) + return jsonify({'success': True, 'permissions': perms}) + else: + return jsonify({'success': False, 'error': 'actor_id required'}) + except Exception as e: + return jsonify({'success': False, 'error': str(e)}) + + # ── Admin Experimental: Function Explorer ───────────────────────── + @app.route('/api/admin-experimental/functions', methods=['GET']) + @auth_req + def admin_list_functions(): + try: + funcs = admin_svc.list_all_functions() + return jsonify({'success': True, 'functions': funcs}) + except Exception as e: + return jsonify({'success': False, 'error': str(e)}) + + @app.route('/api/admin-experimental/functions/', methods=['GET']) + @auth_req + def admin_function_details(name): + try: + detail = admin_svc.get_function_details(name) + if not detail: + return jsonify({'success': False, 'error': 'Function not found'}) + return jsonify({'success': True, 'function': detail}) + except Exception as e: + return jsonify({'success': False, 'error': str(e)}) + + @app.route('/api/admin-experimental/functions//execute', methods=['POST']) + @auth_req + @limiter.limit("200 per hour") + def admin_execute_function(name): + data = request.get_json() or {} + params = data.get('params', []) + try: + success, result, error = admin_svc.execute_function(name, params) + if success: + return jsonify({'success': True, 'result': result}) + else: + return jsonify({'success': False, 'error': error}) + except Exception as e: + return jsonify({'success': False, 'error': str(e)}) + + # ── Admin Experimental: SQL Execute (admin functions) ───────────── + @app.route('/api/admin-experimental/execute', methods=['POST']) + @auth_req + @limiter.limit("200 per hour") + def admin_execute(): + data = request.get_json() or {} + sql = (data.get('sql') or '').strip() + if not sql: + return jsonify({'success': False, 'error': 'SQL is required'}) + lower = sql.strip().lower() + allowed_prefixes = ('select', 'with', 'insert', 'update', 'delete', 'call', 'show', 'explain') + if not any(lower.startswith(w) for w in allowed_prefixes): + return jsonify({'success': False, 'error': 'SQL prefix not allowed'}) + success, result = admin_svc.admin_db_execute(sql) + return jsonify({'success': success, 'result': result if success else str(result)}) diff --git a/app/routes/main.py b/app/routes/main.py index 6cac187..db429d8 100644 --- a/app/routes/main.py +++ b/app/routes/main.py @@ -488,6 +488,12 @@ def register_routes(app, services, settings): logger.exception("Error in server_status route") return render_template('server.html', db_error=f"{type(e).__name__}: {e}") + # Admin Experimental + @app.route('/admin-experimental') + @login_required + def admin_experimental(): + return render_template('admin_experimental.html') + # Map - shows locations of players, vehicles, buildings @app.route('/map') @login_required diff --git a/app/services/admin.py b/app/services/admin.py index 769213e..654dd0a 100644 --- a/app/services/admin.py +++ b/app/services/admin.py @@ -1,10 +1,14 @@ -"""Admin service - ban, kick, unban, vitals, IP detection""" - +"""Admin service - ban, kick, unban, vitals, IP detection, broadcast""" + import re import time import threading import logging import ipaddress +import tempfile +import os +import json +import psycopg2.extras logger = logging.getLogger(__name__) audit_logger = logging.getLogger('audit') @@ -803,3 +807,851 @@ class AdminService: if cur: cur.close() self.db.return_connection(conn) + + def send_global_broadcast(self, title, message, duration=30): + """Send an in-game broadcast via RabbitMQ rabbitmqctl eval on the VM.""" + try: + import base64 + import json as _json + title_json = _json.dumps(title)[1:-1] + message_json = _json.dumps(message)[1:-1] + + erl = ( + f'Title = unicode:characters_to_binary(<<"{title_json}">>, utf8), ' + f'Body = unicode:characters_to_binary(<<"{message_json}">>, utf8), ' + f'Duration = {duration}, ' + 'EntryEn = #{<<"Key">> => <<"en">>, <<"Title">> => Title, <<"Body">> => Body}, ' + 'EntryEnUs = #{<<"Key">> => <<"en-US">>, <<"Title">> => Title, <<"Body">> => Body}, ' + 'Inner = iolist_to_binary(rabbit_json:encode(#{<<"ServerCommand">> => <<"ServiceBroadcast">>, <<"BroadcastType">> => <<"Generic">>, <<"BroadcastPayload">> => #{<<"BroadcastDuration">> => Duration, <<"LocalizedText">> => [EntryEn, EntryEnUs]}})), ' + 'Outer = iolist_to_binary(rabbit_json:encode(#{<<"Version">> => 2, <<"AuthToken">> => <<"Nu6VmPWUMvdPMeB7qErr">>, <<"MessageContent">> => Inner})), ' + 'XName = rabbit_misc:r(<<"/">>, exchange, <<"heartbeats">>), ' + 'X = rabbit_exchange:lookup_or_die(XName), ' + 'MsgId = list_to_binary("manual-service-broadcast-" ++ integer_to_list(erlang:system_time(millisecond))), ' + 'P = {list_to_atom("P_basic"), <<"Content">>, undefined, [], undefined, undefined, undefined, undefined, undefined, MsgId, undefined, undefined, <<"fls">>, <<"fls_backend">>, undefined}, ' + 'Content = rabbit_basic:build_content(P, Outer), ' + '{ok, Msg} = rabbit_basic:message(XName, <<"notifications">>, Content), ' + 'Result = rabbit_queue_type:publish_at_most_once(X, Msg), ' + 'io:format("broadcast=~p duration=~p~n", [Result, Duration]).' + ) + + ns = self._detect_namespace() + pod_name = ns.replace('funcom-seabass-', '') + '-mq-game-sts-0' + b64 = base64.b64encode(erl.encode()).decode() + + # Write erl on VM host, then pipe it into the pod via kubectl exec -i + wcmd = f"echo {b64} | base64 -d | sudo tee /tmp/dune_bc.erl > /dev/null" + wout, werr, wrc = self.ssh.run(wcmd) + if wrc != 0: + return False, f"write failed: {werr}" + + # Cat the host file and pipe into kubectl exec -i to write inside the pod + ecmd = ( + f"cat /tmp/dune_bc.erl | sudo kubectl exec -i -n {ns} {pod_name} -- sh -lc '" + "cat > /tmp/dune_bc.erl; " + "export PATH=/opt/rabbitmq/sbin:/opt/erlang/lib/erlang/bin:/opt/erlang/lib/erlang/erts-14.2.5.12/bin:/bin:/usr/bin:/usr/local/bin:$PATH; " + 'rabbitmqctl eval "$(cat /tmp/dune_bc.erl)"; ' + "rm -f /tmp/dune_bc.erl'" + ) + out, err, rc = self.ssh.run(ecmd) + + self.ssh.run("rm -f /tmp/dune_bc.erl") + + if rc != 0: + return False, f"Broadcast failed (rc={rc}): {err}" + + audit_logger.info(f"BROADCAST: title={title} message={message} duration={duration}") + return True, "Broadcast sent successfully" + except Exception as e: + logger.error(f"Broadcast error: {e}") + try: + self.ssh.run("rm -f /tmp/dune_bc.erl") + except Exception: + pass + return False, str(e) + + def admin_db_query(self, sql, params=None): + """Execute a read-only SQL query and return results.""" + return self.db.query(sql, params) + + def admin_db_execute(self, sql, params=None): + """Execute a SQL statement (insert/update/delete/call) and commit.""" + conn = self.db.get_connection() + if not conn: + return False, "DB connection failed" + cur = None + try: + cur = conn.cursor() + cur.execute(sql, params or []) + conn.commit() + if cur.description: + rows = cur.fetchall() + if rows and isinstance(rows[0], dict): + return True, rows + cols = [d.name for d in cur.description] + return True, [dict(zip(cols, r)) for r in rows] + return True, f"Executed, rows affected: {cur.rowcount}" + except Exception as e: + conn.rollback() + return False, str(e) + finally: + if cur: + cur.close() + self.db.return_connection(conn) + + def search_players(self, term): + """Search characters by name.""" + like = f'%{term}%' + result = self.db.query(""" + SELECT ea.id, ea.user, + COALESCE(NULLIF(ps.character_name, ''), 'Unknown') as character_name + FROM dune.encrypted_accounts ea + LEFT JOIN dune.player_state ps ON ea.id = ps.account_id + WHERE lower(ea.user) LIKE lower(%s) + OR lower(ps.character_name) LIKE lower(%s) + ORDER BY ea.user + LIMIT 50 + """, [like, like]) + return result or [] + + def get_online_players(self): + """Get all online or recently disconnected players.""" + result = self.db.query(""" + SELECT a.id as player_controller_id, + COALESCE(NULLIF(ps.character_name, ''), 'Unknown') as character_name, + a.map, + ps.online_status, + ps.last_avatar_activity + FROM dune.actors a + JOIN dune.player_state ps ON ps.player_controller_id = a.id + WHERE ps.online_status = 'Online' + OR ps.last_avatar_activity > NOW() - INTERVAL '1 minute' + ORDER BY ps.character_name + """) + return result or [] + + def adjust_currency(self, player_controller_id, currency_id, delta): + """Add/remove virtual currency from a player.""" + try: + conn = self.db.get_connection() + if not conn: + return False, "DB connection failed" + cur = None + try: + cur = conn.cursor() + cur.execute(""" + INSERT INTO dune.player_virtual_currency_balances (player_controller_id, currency_id, balance) + VALUES (%s, %s, %s) + ON CONFLICT (player_controller_id, currency_id) DO UPDATE SET balance = (dune.player_virtual_currency_balances.balance + %s) + RETURNING balance + """, [player_controller_id, currency_id, delta, delta]) + new_balance = cur.fetchone()[0] + conn.commit() + audit_logger.info(f"CURRENCY_ADJUST: player={player_controller_id} currency={currency_id} delta={delta} new_balance={new_balance}") + return True, f"Currency {currency_id} adjusted by {delta}. New balance: {new_balance}" + except Exception as e: + conn.rollback() + return False, str(e) + finally: + if cur: + cur.close() + self.db.return_connection(conn) + except Exception as e: + return False, str(e) + + def change_faction(self, player_id, faction_id): + """Change a player's faction.""" + try: + conn = self.db.get_connection() + if not conn: + return False, "DB connection failed" + cur = None + try: + cur = conn.cursor() + cur.execute(""" + INSERT INTO dune.player_faction (actor_id, faction_id, utc_time_faction_change) + VALUES (%s, %s, NOW()) + ON CONFLICT (actor_id) DO UPDATE SET faction_id = %s, utc_time_faction_change = NOW() + """, [player_id, faction_id, faction_id]) + conn.commit() + audit_logger.info(f"FACTION_CHANGE: player={player_id} faction={faction_id}") + return True, f"Faction changed to {faction_id}" + except Exception as e: + conn.rollback() + return False, str(e) + finally: + if cur: + cur.close() + self.db.return_connection(conn) + except Exception as e: + return False, str(e) + + # ── View Currency Balances ───────────────────────────────────────── + def get_currency_balances(self, player_controller_id): + """Get virtual currency balances for a player.""" + result = self.db.query( + "SELECT currency_id, balance FROM dune.player_virtual_currency_balances WHERE player_controller_id = %s ORDER BY currency_id", + [player_controller_id] + ) + return result or [] + + # ── Teleport Player ──────────────────────────────────────────────── + def teleport_player(self, fls_id, partition_id, x, y, z): + """Teleport an offline player to a partition using direct SQL.""" + conn = self.db.get_connection() + if not conn: + return False, "DB connection failed" + cur = None + try: + cur = conn.cursor() + # Set search_path so unqualified references in the function resolve + cur.execute("SET search_path TO dune, public") + cur.execute(""" + SELECT dune.admin_move_offline_player_to_partition( + %s, %s, ROW(%s, %s, %s)::dune.vector + ) + """, [fls_id, int(partition_id), float(x), float(y), float(z)]) + conn.commit() + audit_logger.info(f"TELEPORT: fls_id={fls_id} partition={partition_id} loc=({x},{y},{z})") + return True, f"Teleported to partition {partition_id}" + except Exception as e: + conn.rollback() + return False, str(e) + finally: + if cur: cur.close() + self.db.return_connection(conn) + + def get_partitions(self): + """List all available partitions.""" + result = self.db.query(""" + SELECT partition_id as id, map, dimension_index, label, partition_definition::text + FROM dune.world_partition + ORDER BY map, dimension_index, partition_id + LIMIT 100 + """) + return result or [] + + # ── Faction Reputation (direct SQL) ──────────────────────────────── + def get_faction_reputation(self, actor_id): + """Get faction reputation for a player.""" + result = self.db.query(""" + SELECT pf.faction_id, COALESCE(pfr.reputation_amount, 0) as reputation_amount + FROM dune.player_faction pf + LEFT JOIN dune.player_faction_reputation pfr ON pfr.actor_id = pf.actor_id AND pfr.faction_id = pf.faction_id + WHERE pf.actor_id = %s + LIMIT 1 + """, [actor_id]) + return result or [] + + def set_faction_reputation(self, actor_id, faction_id, amount): + """Set faction reputation for a player.""" + try: + conn = self.db.get_connection() + if not conn: + return False, "DB connection failed" + cur = None + try: + cur = conn.cursor() + cur.execute(""" + INSERT INTO dune.player_faction_reputation (actor_id, faction_id, reputation_amount) + VALUES (%s, %s, %s) + ON CONFLICT (actor_id, faction_id) DO UPDATE SET reputation_amount = %s + """, [actor_id, faction_id, amount, amount]) + conn.commit() + audit_logger.info(f"FACTION_REP: actor={actor_id} faction={faction_id} amount={amount}") + return True, f"Reputation set to {amount}" + except Exception as e: + conn.rollback() + return False, str(e) + finally: + if cur: cur.close() + self.db.return_connection(conn) + except Exception as e: + return False, str(e) + + # ── Inventory Lookup (direct SQL) ───────────────────────────────── + def get_inventory(self, account_id): + """Get inventory details for an account.""" + result = self.db.query(""" + SELECT inv.id as inventory_id, inv.actor_id, i.id as item_id, i.template_id, i.stack_size as count, i.position_index + FROM dune.inventories inv + JOIN dune.items i ON i.inventory_id = inv.id + WHERE inv.actor_id IN (SELECT id FROM dune.actors WHERE owner_account_id = %s) + ORDER BY inv.id, i.position_index + LIMIT 200 + """, [account_id]) + return result or [] + + def get_player_pawn(self, account_id): + """Get player pawn info by account id.""" + result = self.db.query(""" + SELECT a.id, a.class, a.map, a.owner_account_id as account_id + FROM dune.actors a + WHERE a.owner_account_id = %s AND a.class LIKE '%%PlayerPawn_C%%' + LIMIT 5 + """, [account_id]) + return result or [] + + # ── Guild Tools (direct SQL) ─────────────────────────────────────── + def get_guild_data(self, guild_id): + """Get guild data.""" + result = self.db.query(""" + SELECT g.*, + (SELECT COUNT(*) FROM dune.guild_members gm WHERE gm.guild_id = g.id) as member_count + FROM dune.guilds g WHERE g.id = %s + """, [guild_id]) + return result or [] + + def get_all_guilds(self): + """Get all guilds.""" + result = self.db.query(""" + SELECT g.*, + (SELECT COUNT(*) FROM dune.guild_members gm WHERE gm.guild_id = g.id) as member_count + FROM dune.guilds g + ORDER BY g.id + """) + return result or [] + + def disband_guild(self, guild_id): + """Disband a guild via function.""" + try: + conn = self.db.get_connection() + if not conn: + return False, "DB connection failed" + cur = None + try: + cur = conn.cursor() + cur.execute("SELECT dune.disband_guild(%s)", [guild_id]) + conn.commit() + audit_logger.info(f"GUILD_DISBAND: guild_id={guild_id}") + return True, f"Guild {guild_id} disbanded" + except Exception as e: + conn.rollback() + return False, str(e) + finally: + if cur: cur.close() + self.db.return_connection(conn) + except Exception as e: + return False, str(e) + + def remove_guild_member(self, guild_id, player_id): + """Remove a member from a guild.""" + try: + conn = self.db.get_connection() + if not conn: + return False, "DB connection failed" + cur = None + try: + cur = conn.cursor() + cur.execute("DELETE FROM dune.guild_members WHERE guild_id = %s AND player_id = %s", [guild_id, player_id]) + conn.commit() + audit_logger.info(f"GUILD_KICK: guild={guild_id} player={player_id}") + return True, f"Player {player_id} removed from guild" + except Exception as e: + conn.rollback() + return False, str(e) + finally: + if cur: cur.close() + self.db.return_connection(conn) + except Exception as e: + return False, str(e) + + # ── Player Tags (direct SQL) ─────────────────────────────────────── + def get_player_tags(self, account_id): + """Read player tags.""" + result = self.db.query( + "SELECT tag FROM dune.player_tags WHERE account_id = %s ORDER BY tag", + [account_id] + ) + return result or [] + + def update_player_tags(self, account_id, tags_to_add, tags_to_remove): + """Update player tags.""" + try: + conn = self.db.get_connection() + if not conn: + return False, "DB connection failed" + cur = None + try: + cur = conn.cursor() + for tag in tags_to_add: + cur.execute( + "INSERT INTO dune.player_tags (account_id, tag) VALUES (%s, %s) ON CONFLICT DO NOTHING", + [account_id, tag] + ) + if tags_to_remove: + cur.execute( + "DELETE FROM dune.player_tags WHERE account_id = %s AND tag = ANY(%s)", + [account_id, tags_to_remove] + ) + conn.commit() + audit_logger.info(f"TAGS_UPDATE: account={account_id} add={tags_to_add} remove={tags_to_remove}") + return True, "Tags updated" + except Exception as e: + conn.rollback() + return False, str(e) + finally: + if cur: cur.close() + self.db.return_connection(conn) + except Exception as e: + return False, str(e) + + def flag_cheater(self, account_id, cheat_type): + """Flag a player as cheater.""" + try: + conn = self.db.get_connection() + if not conn: + return False, "DB connection failed" + cur = None + try: + cur = conn.cursor() + # Add cheater tag + cur.execute( + "INSERT INTO dune.player_tags (account_id, tag) VALUES (%s, %s) ON CONFLICT DO NOTHING", + [account_id, f'cheater_{cheat_type}'] + ) + conn.commit() + audit_logger.info(f"CHEATER_FLAG: account={account_id} type={cheat_type}") + return True, f"Flagged as {cheat_type}" + except Exception as e: + conn.rollback() + return False, str(e) + finally: + if cur: cur.close() + self.db.return_connection(conn) + except Exception as e: + return False, str(e) + + # ── Vehicles (direct SQL) ───────────────────────────────────────── + def get_player_vehicles(self, player_id, account_id): + """Get vehicles owned by a player.""" + result = self.db.query(""" + SELECT v.id as vehicle_id, v.actor_id, a.class, a.map, a.owner_account_id as account_id + FROM dune.vehicles v + JOIN dune.actors a ON a.id = v.actor_id + WHERE a.owner_account_id = %s + ORDER BY v.id + LIMIT 50 + """, [account_id]) + return result or [] + + # ── Character Management ─────────────────────────────────────────── + def set_character_name(self, account_id, new_name): + """Rename a character.""" + try: + conn = self.db.get_connection() + if not conn: return False, "DB connection failed" + cur = None + try: + cur = conn.cursor() + cur.execute("UPDATE dune.player_state SET character_name = %s WHERE account_id = %s", [new_name, account_id]) + conn.commit() + audit_logger.info(f"RENAME: account={account_id} new_name={new_name}") + return True, f"Renamed to {new_name}" + except Exception as e: + conn.rollback(); return False, str(e) + finally: + if cur: cur.close(); self.db.return_connection(conn) + except Exception as e: return False, str(e) + + def delete_character(self, actor_id): + """Delete a character.""" + try: + conn = self.db.get_connection() + if not conn: return False, "DB connection failed" + cur = None + try: + cur = conn.cursor() + cur.execute("SELECT dune.delete_character(%s)", [actor_id]) + conn.commit() + audit_logger.info(f"DELETE_CHAR: actor_id={actor_id}") + return True, f"Character {actor_id} deleted" + except Exception as e: + conn.rollback(); return False, str(e) + finally: + if cur: cur.close(); self.db.return_connection(conn) + except Exception as e: return False, str(e) + + def delete_account(self, user_id, reason='admin'): + """Delete an account.""" + try: + conn = self.db.get_connection() + if not conn: return False, "DB connection failed" + cur = None + try: + cur = conn.cursor() + cur.execute("SELECT dune.delete_account(%s, %s)", [user_id, reason]) + conn.commit() + audit_logger.info(f"DELETE_ACCOUNT: user={user_id} reason={reason}") + return True, f"Account {user_id} deleted" + except Exception as e: + conn.rollback(); return False, str(e) + finally: + if cur: cur.close(); self.db.return_connection(conn) + except Exception as e: return False, str(e) + + def set_demo_state(self, user_id, demo_state): + """Set demo state for an account.""" + try: + conn = self.db.get_connection() + if not conn: return False, "DB connection failed" + cur = None + try: + cur = conn.cursor() + cur.execute("SELECT dune.set_demo_state(%s, %s::dune.demostate)", [user_id, demo_state]) + conn.commit() + audit_logger.info(f"DEMO: user={user_id} state={demo_state}") + return True, f"Demo state set to {demo_state}" + except Exception as e: + conn.rollback(); return False, str(e) + finally: + if cur: cur.close(); self.db.return_connection(conn) + except Exception as e: return False, str(e) + + # ── Journey / Progression ───────────────────────────────────────── + def complete_journey_nodes(self, account_id, node_ids): + """Complete journey story nodes for a player.""" + try: + conn = self.db.get_connection() + if not conn: return False, "DB connection failed" + cur = None + try: + cur = conn.cursor() + cur.execute("SELECT dune.complete_journey_story_nodes_for_player(%s, %s)", [str(account_id), node_ids]) + conn.commit() + audit_logger.info(f"JOURNEY_COMPLETE: account={account_id} nodes={node_ids}") + return True, f"Completed {len(node_ids)} nodes" + except Exception as e: + conn.rollback(); return False, str(e) + finally: + if cur: cur.close(); self.db.return_connection(conn) + except Exception as e: return False, str(e) + + def reveal_journey_nodes(self, account_id, node_ids): + """Reveal journey story nodes for a player.""" + try: + conn = self.db.get_connection() + if not conn: return False, "DB connection failed" + cur = None + try: + cur = conn.cursor() + cur.execute("SELECT dune.reveal_journey_story_nodes_for_player(%s, %s)", [str(account_id), node_ids]) + conn.commit() + audit_logger.info(f"JOURNEY_REVEAL: account={account_id} nodes={node_ids}") + return True, f"Revealed {len(node_ids)} nodes" + except Exception as e: + conn.rollback(); return False, str(e) + finally: + if cur: cur.close(); self.db.return_connection(conn) + except Exception as e: return False, str(e) + + def reset_journey_nodes(self, account_id, node_ids): + """Reset journey story nodes for a player.""" + try: + conn = self.db.get_connection() + if not conn: return False, "DB connection failed" + cur = None + try: + cur = conn.cursor() + cur.execute("SELECT dune.reset_journey_story_nodes_for_player(%s, %s)", [str(account_id), node_ids]) + conn.commit() + audit_logger.info(f"JOURNEY_RESET: account={account_id} nodes={node_ids}") + return True, f"Reset {len(node_ids)} nodes" + except Exception as e: + conn.rollback(); return False, str(e) + finally: + if cur: cur.close(); self.db.return_connection(conn) + except Exception as e: return False, str(e) + + def set_specialization(self, player_id, track_type, xp, level): + """Set specialization XP and level.""" + try: + conn = self.db.get_connection() + if not conn: return False, "DB connection failed" + cur = None + try: + cur = conn.cursor() + # track_type is a dune.specializationtracktype enum + cur.execute( + "SELECT dune.set_specialization_xp_and_level(%s, %s::dune.specializationtracktype, %s, %s)", + [player_id, track_type, xp, level] + ) + conn.commit() + audit_logger.info(f"SPEC_SET: player={player_id} track={track_type} xp={xp} level={level}") + return True, f"Specialization {track_type} set to level {level}" + except Exception as e: + conn.rollback(); return False, str(e) + finally: + if cur: cur.close(); self.db.return_connection(conn) + except Exception as e: return False, str(e) + + def reset_specialization(self, player_id): + """Reset all specialization tracks for a player.""" + try: + conn = self.db.get_connection() + if not conn: return False, "DB connection failed" + cur = None + try: + cur = conn.cursor() + cur.execute("SELECT dune.reset_specialization_tracks(%s)", [player_id]) + conn.commit() + audit_logger.info(f"SPEC_RESET: player={player_id}") + return True, "Specialization tracks reset" + except Exception as e: + conn.rollback(); return False, str(e) + finally: + if cur: cur.close(); self.db.return_connection(conn) + except Exception as e: return False, str(e) + + # ── Guild Roster ─────────────────────────────────────────────────── + def get_guild_members(self, guild_id): + """Get all members of a guild.""" + result = self.db.query(""" + SELECT gm.player_id, gm.role_id, COALESCE(NULLIF(ps.character_name, ''), 'Unknown') as name + FROM dune.guild_members gm + LEFT JOIN dune.player_state ps ON ps.player_controller_id = gm.player_id + WHERE gm.guild_id = %s + ORDER BY gm.role_id, ps.character_name + """, [guild_id]) + return result or [] + + def promote_guild_member(self, guild_id, player_id, new_role): + """Promote/demote a guild member.""" + try: + conn = self.db.get_connection() + if not conn: return False, "DB connection failed" + cur = None + try: + cur = conn.cursor() + cur.execute("SELECT dune.promote_guild_member(%s, %s, %s)", [guild_id, player_id, new_role]) + conn.commit() + audit_logger.info(f"GUILD_PROMOTE: guild={guild_id} player={player_id} role={new_role}") + return True, f"Player {player_id} now role {new_role}" + except Exception as e: + conn.rollback(); return False, str(e) + finally: + if cur: cur.close(); self.db.return_connection(conn) + except Exception as e: return False, str(e) + + # ── Economy / Vendors ────────────────────────────────────────────── + def clean_player_vendor_stock(self, player_id): + """Reset vendor buy limits for a player.""" + try: + conn = self.db.get_connection() + if not conn: return False, "DB connection failed" + cur = None + try: + cur = conn.cursor() + cur.execute("SELECT dune.clean_stock_for_player(%s)", [player_id]) + conn.commit() + audit_logger.info(f"VENDOR_CLEAN: player={player_id}") + return True, f"Vendor stock reset for player {player_id}" + except Exception as e: + conn.rollback(); return False, str(e) + finally: + if cur: cur.close(); self.db.return_connection(conn) + except Exception as e: return False, str(e) + + def get_player_tax_invoices(self, player_id): + """Get tax invoices for a player.""" + result = self.db.query( + "SELECT * FROM dune.taxation_get_all_invoices_for_player(%s)", + [player_id] + ) + return result or [] + + # ── Spice Fields ─────────────────────────────────────────────────── + def force_spice_spawn(self, server_id, spicefield_type_id): + """Request a spice field spawn.""" + try: + conn = self.db.get_connection() + if not conn: return False, "DB connection failed" + cur = None + try: + cur = conn.cursor() + cur.execute("SELECT dune.request_spawn_spice_field(%s, %s)", [server_id, spicefield_type_id]) + conn.commit() + audit_logger.info(f"SPICE_SPAWN: server={server_id} type={spicefield_type_id}") + return True, f"Spice field spawn requested on {server_id}" + except Exception as e: + conn.rollback(); return False, str(e) + finally: + if cur: cur.close(); self.db.return_connection(conn) + except Exception as e: return False, str(e) + + def reset_spice_state(self, map_name, dimension_index): + """Reset global spice field state.""" + try: + conn = self.db.get_connection() + if not conn: return False, "DB connection failed" + cur = None + try: + cur = conn.cursor() + cur.execute("SELECT dune.reset_global_spice_field_state(%s, %s)", [map_name, dimension_index]) + conn.commit() + audit_logger.info(f"SPICE_RESET: map={map_name} dim={dimension_index}") + return True, f"Spice state reset on {map_name}" + except Exception as e: + conn.rollback(); return False, str(e) + finally: + if cur: cur.close(); self.db.return_connection(conn) + except Exception as e: return False, str(e) + + # ── Server Tools ─────────────────────────────────────────────────── + def set_players_offline(self, server_ids): + """Set all players on given servers to offline.""" + try: + conn = self.db.get_connection() + if not conn: return False, "DB connection failed" + cur = None + try: + cur = conn.cursor() + cur.execute("SELECT dune.set_players_from_server_ids_offline(%s)", [server_ids]) + conn.commit() + audit_logger.info(f"SET_OFFLINE: servers={server_ids}") + return True, f"Players set offline on {len(server_ids)} servers" + except Exception as e: + conn.rollback(); return False, str(e) + finally: + if cur: cur.close(); self.db.return_connection(conn) + except Exception as e: return False, str(e) + + def cleanup_orphaned(self): + """Clean up orphaned entities in the database.""" + try: + conn = self.db.get_connection() + if not conn: return False, "DB connection failed" + cur = None + try: + cur = conn.cursor() + cur.execute("SELECT dune.cleanup_orphaned_entities()") + conn.commit() + audit_logger.info("CLEANUP_ORPHANS") + return True, "Orphaned entities cleaned up" + except Exception as e: + conn.rollback(); return False, str(e) + finally: + if cur: cur.close(); self.db.return_connection(conn) + except Exception as e: return False, str(e) + + # ── Permission Management ───────────────────────────────────────── + def get_actor_permissions(self, actor_id): + """Get permissions for an actor.""" + result = self.db.query( + "SELECT * FROM dune.get_permission_for_actor(%s)", + [actor_id] + ) + return result or [] + + def set_player_rank(self, actor_id, player_id, rank, map_id=''): + """Set a player's rank on an actor.""" + try: + conn = self.db.get_connection() + if not conn: return False, "DB connection failed" + cur = None + try: + cur = conn.cursor() + cur.execute("SELECT dune.permission_set_player_rank(%s, %s, %s, %s)", [actor_id, player_id, rank, map_id]) + conn.commit() + audit_logger.info(f"RANK_SET: actor={actor_id} player={player_id} rank={rank}") + return True, f"Rank {rank} set for player {player_id}" + except Exception as e: + conn.rollback(); return False, str(e) + finally: + if cur: cur.close(); self.db.return_connection(conn) + except Exception as e: return False, str(e) + + # ── Player Stats (from actors.properties JSONB) ─────────────────── + def get_player_stats(self, player_controller_id): + """Get player health and stats from actor properties.""" + result = self.db.query(""" + WITH pawn AS ( + SELECT id, properties FROM dune.actors + WHERE id = (SELECT player_pawn_id FROM dune.player_state WHERE player_controller_id = %s) + ), + ctrl AS ( + SELECT properties FROM dune.actors WHERE id = %s + ) + SELECT + pawn.id as pawn_id, + pawn.properties::text as pawn_props, + ctrl.properties::text as ctrl_props + FROM pawn, ctrl + """, [player_controller_id, player_controller_id]) + if not result: + return None + row = result[0] + import json + pawn = json.loads(row.get('pawn_props') or '{}') + ctrl = json.loads(row.get('ctrl_props') or '{}') + stats = {'pawn_id': row['pawn_id']} + + # Health + dmg = pawn.get('DamageableActorComponent', {}) + stats['health'] = {'current': dmg.get('m_CurrentMaxHealth'), 'max': dmg.get('m_TotalMaxHealth')} + + # Character stats + char = pawn.get('BP_DunePlayerCharacter_C', {}) + stats['eyes_of_ibad'] = char.get('m_EyesOfIbadValue') + stats['heatstroke'] = char.get('m_bHeatstroke') + stats['is_driving'] = char.get('m_bIsDriving') + + # Journey / Spice exposure + journey = ctrl.get('BP_JourneyComponent_C', {}) + stats['spice_exposure_level'] = journey.get('CurrentSpiceExposureThresholdLevel') + + # Landsraad + landsraad = ctrl.get('LandsraadCharacterComponent', {}) + stats['daily_reward_charges'] = landsraad.get('m_DailyRewardCharges') + stats['last_viewed_term'] = landsraad.get('m_LastViewedLandsraadTermId') + + return stats + + # ── Dynamic Function Explorer ───────────────────────────────────── + def list_all_functions(self): + """List all dune schema functions with signatures.""" + result = self.db.query(""" + SELECT p.proname as name, + pg_get_function_identity_arguments(p.oid) as args, + l.lanname as language, + p.prokind as kind + FROM pg_proc p + JOIN pg_namespace n ON n.oid = p.pronamespace + JOIN pg_language l ON l.oid = p.prolang + WHERE n.nspname = 'dune' AND p.prokind = 'f' + ORDER BY p.proname + """) + return result or [] + + def execute_function(self, function_name, params): + """Execute any dune schema function dynamically.""" + try: + param_placeholders = ','.join(['%s'] * len(params)) + sql = f"SELECT * FROM dune.{function_name}({param_placeholders})" + result = self.db.query(sql, params) + audit_logger.info(f"EXEC_FUNC: {function_name}({params})") + return True, result, None + except Exception as e: + return False, None, str(e) + + def get_function_details(self, function_name): + """Get full definition of a function.""" + result = self.db.query(""" + SELECT pg_get_functiondef(p.oid) as definition, + p.proname as name, + pg_get_function_identity_arguments(p.oid) as args + FROM pg_proc p + JOIN pg_namespace n ON n.oid = p.pronamespace + WHERE n.nspname = 'dune' AND p.proname = %s AND p.prokind = 'f' + """, [function_name]) + return result[0] if result else None + + def _detect_namespace(self): + out, err, rc = self.ssh.run( + "sudo kubectl get pods -A --no-headers -o custom-columns=NS:.metadata.namespace,NAME:.metadata.name " + "| awk '$1 ~ /^funcom-seabass-/ && $2 ~ /-mq-game-sts-0$/ { print $1 }' | sort -u" + ) + if out: + ns = out.strip().split('\n')[0] + if ns: + return ns + return "funcom-seabass-sh-b17a5f036d1f7882-ccdijf" diff --git a/app/utils/constants.py b/app/utils/constants.py index 3c53c1f..b79d6f3 100644 --- a/app/utils/constants.py +++ b/app/utils/constants.py @@ -81,4 +81,5 @@ NAV_PAGES = [ ('/guilds', 'Guilds'), ('/buildings', 'Buildings'), ('/map', 'Map'), + ('/admin-experimental', 'Admin Experimental'), ] diff --git a/templates/admin_experimental.html b/templates/admin_experimental.html new file mode 100644 index 0000000..c3ab684 --- /dev/null +++ b/templates/admin_experimental.html @@ -0,0 +1,1282 @@ +{% extends "base.html" %} +{% block title %}Admin Experimental - Dune Awakening Dashboard{% endblock %} +{% block content %} + + + +
+
In-Game Broadcast
+
+

+ Send a broadcast notification to all connected players. Uses RabbitMQ heartbeats exchange. +

+ +
+
+ + +
+
+ + +
+
+ + +
+ +
+
+
+ +
+ +
+
Search Players
+
+

Search characters by name.

+ +
+ + +
+
+
+
+ +
+
Online Players
+
+

Currently online or recently disconnected players.

+ + +
+
+
+ +
+ +
+ +
+
Adjust Currency
+
+

Add or remove virtual currency from a player.

+ +
+ + +
+
+
+ + +
+
+ + +
+
+
+ + +
+
+
+
+ +
+
Change Faction
+
+

Change a player's faction allegiance.

+ +
+ + +
+
+ + +
+ +
+
+ +
+
Teleport Player
+
+

Teleport an offline player to a partition.

+ +
+ + +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+ + +
+
+
+
+ +
+ +
+ +
+
Faction Reputation
+
+

View or set faction reputation.

+ +
+ + +
+
+
+ + +
+
+ + +
+
+
+ + +
+
+
+
+ +
+
Player Stats / Health
+
+

View player health, spice exposure, and other stats from actor properties.

+ +
+ + +
+ +
+
+
+ +
+
Inventory Lookup
+
+

View player inventory by account ID.

+ +
+ + +
+ +
+
+
+ +
+ +
+ +
+
Player Tags
+
+

Read or update player tags. Comma-separated lists.

+ +
+ + +
+
+
+ + +
+
+ + +
+
+
+ + +
+
+
+
+ +
+
Flag Cheater
+
+

Flag a player as cheater.

+ +
+ + +
+
+ + +
+ +
+
+ +
+ +
+ +
+
Guild Tools
+
+

List guilds, view details, disband, kick members.

+ +
+
+ + +
+
+ + +
+
+
+ + + + +
+
+
+
+ +
+
Player Vehicles
+
+

View vehicles owned by a player.

+ +
+
+ + +
+
+ + +
+
+ +
+
+
+ +
+ +
+ +
+
Character Management
+
+

Rename, delete, force demo state.

+ +
+
+ + +
+
+ + +
+
+
+ + + +
+
+
+ + +
+
+ + +
+
+ +
+
+ +
+
Journey & Specialization
+
+

Manage story nodes and specialization tracks.

+ +
+ +
+ + +
+
+
+ + + +
+
+ + + + +
+
+ + +
+
+
+ +
+ +
+ +
+
Economy & Spice Fields
+
+

Vendor stock, tax invoices, spice field control.

+ +
+ + + +
+
+
+ + + +
+
+
+ +
+
Server Tools
+
+

Force players offline, cleanup orphans, manage permissions.

+ +
+ + +
+
+ + +
+
+
+
+ +
+ +
+ +
+
Battlegroup Info
+
+

Full battlegroup status from BGD API.

+ + +

+    
+
+ +
+ +
+ +
+
Function Explorer — All 517 DB Functions
+
+

+ Browse and execute any PostgreSQL function in the dune schema. Type to filter. Click a function to see its definition and enter parameters. +

+ +
+ + +
+
+
+
+

Select a function from the list to see details and execute it.

+
+
+
+
+ +
+ + + + + +{% endblock %}