Frontend: - Replace Tailwind CSS with ChakraUI v3 (react, recharts, fontsource) - 24 themes (12 Dune factions x day/night variants) - Collapsible sidebar navigation with 6 groups - Recharts AreaChart/PieChart for CPU/RAM/metrics - New Experimental page (ports legacy admin_experimental.html) - Common components: DataTable, Modal, Badge, Toaster Backend: - Fix services to use direct SQL (dune.* schema) instead of stored procedures - PlayerService, EconomyService, GuildService, WorldService rewritten - Auto-login for SPA development in factory.py - Fix settings.yaml path resolution Launcher: - Add option [7] Start New Dashboard in launcher.ps1 and start.sh - Auto-installs pip + npm dependencies - Sets up SSH tunnels + kubectl port-forwards - Starts backend API + frontend Vite dev server Security: - Sanitize hardcoded RMQ password in config.py - Add frontend/dist/ to .gitignore
46 lines
1.5 KiB
Python
46 lines
1.5 KiB
Python
# World service — partitions, spice, teleport.
|
|
|
|
import logging
|
|
|
|
from app.services.database import DatabaseService
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
class WorldService:
|
|
def __init__(self, db: DatabaseService):
|
|
self.db = db
|
|
|
|
def get_partitions(self, map_name: str = "") -> list[dict]:
|
|
try:
|
|
if map_name:
|
|
return self.db.execute_readonly(
|
|
"""SELECT partition_id as id, map, dimension_index,
|
|
label, partition_definition::text as definition
|
|
FROM dune.partitions WHERE map = %s ORDER BY partition_id""",
|
|
[map_name],
|
|
)
|
|
return self.db.execute_readonly(
|
|
"""SELECT partition_id as id, map, dimension_index,
|
|
label, partition_definition::text as definition
|
|
FROM dune.partitions ORDER BY partition_id"""
|
|
)
|
|
except Exception:
|
|
return []
|
|
|
|
def teleport(self, fls_id: str, partition_id: int, x: float, y: float, z: float) -> bool:
|
|
try:
|
|
self.db.execute_mutation(
|
|
"SELECT dune.admin_move_offline_player_to_partition(%s, %s, (%s, %s, %s))",
|
|
[fls_id, partition_id, x, y, z],
|
|
)
|
|
return True
|
|
except Exception:
|
|
return False
|
|
|
|
def reset_spice(self, map_name: str, dimension_index: int) -> bool:
|
|
return False
|
|
|
|
def force_spice_spawn(self, server_id: str, spicefield_type_id: int) -> bool:
|
|
return False
|