Namespace Cleanup, and some fun toys in the admin portal
This commit is contained in:
@@ -2,8 +2,8 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using DataServer.Data;
|
||||
using DataServer.Data.Entities;
|
||||
using Server.Services.Auth;
|
||||
using Server.Game.Dungeon;
|
||||
using GameServices.Auth;
|
||||
using GameServer.Dungeon;
|
||||
|
||||
namespace Server.Api;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using DataServer.Data;
|
||||
using Server.Services.Auth;
|
||||
using GameServices.Auth;
|
||||
|
||||
namespace Server.Api;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Server.Services;
|
||||
using GameServices;
|
||||
|
||||
namespace Server.Api;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Server.Game.Dungeon;
|
||||
namespace GameServer.Dungeon;
|
||||
|
||||
public class ChestInstance
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using DataServer.Data.Entities;
|
||||
|
||||
namespace Server.Game.Dungeon;
|
||||
namespace GameServer.Dungeon;
|
||||
|
||||
/// <summary>
|
||||
/// Handles damage calculations with stats, gear, and resistances
|
||||
|
||||
@@ -7,7 +7,7 @@ using Server.Networking;
|
||||
using Server.Networking.Messages;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Server.Game.Dungeon;
|
||||
namespace GameServer.Dungeon;
|
||||
|
||||
/// <summary>
|
||||
/// Handles crafting operations including recipe discovery, crafting, and skill progression
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Server.Game.Dungeon;
|
||||
namespace GameServer.Dungeon;
|
||||
|
||||
public class DungeonChestSpawn
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Server.Game.Dungeon;
|
||||
namespace GameServer.Dungeon;
|
||||
|
||||
/// <summary>
|
||||
/// Procedural dungeon generator using BSP (Binary Space Partition) + room placement
|
||||
|
||||
@@ -3,7 +3,7 @@ using DataServer.Data.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Server.Game.Dungeon;
|
||||
namespace GameServer.Dungeon;
|
||||
|
||||
/// <summary>
|
||||
/// Procedural dungeon generator using room templates from database
|
||||
|
||||
@@ -3,7 +3,7 @@ using DataServer.Data.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Server.Game.Dungeon;
|
||||
namespace GameServer.Dungeon;
|
||||
|
||||
/// <summary>
|
||||
/// Dungeon Generator V3 - Uses the DungeonBuilder system
|
||||
|
||||
@@ -10,10 +10,10 @@ using Server.Networking;
|
||||
using Server.Networking.Handling;
|
||||
using Server.Networking.Messages;
|
||||
using Server.Redis;
|
||||
using Server.Services;
|
||||
using Server.Services.Auth;
|
||||
using GameServices;
|
||||
using GameServices.Auth;
|
||||
|
||||
namespace Server.Game.Dungeon;
|
||||
namespace GameServer.Dungeon;
|
||||
|
||||
/// <summary>
|
||||
/// Handles dungeon crawler game messages via the server's message router
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
namespace Server.Game.Dungeon;
|
||||
namespace GameServer.Dungeon;
|
||||
|
||||
/// <summary>
|
||||
/// Admin/management extensions for DungeonHandler
|
||||
@@ -42,7 +42,7 @@ public partial class DungeonHandler
|
||||
// Note: This is a simplified version - in production you'd want to
|
||||
// properly handle player state transitions
|
||||
//dungeon.Simulation.RemovePlayer(player.CharacterId);
|
||||
Console.WriteLine("Force Close Dungeon -- Needs Implemented");
|
||||
Console.WriteLine("Remove Player - Not Implemented.");
|
||||
}
|
||||
catch { /* Ignore errors during cleanup */ }
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Server.Game.Dungeon;
|
||||
namespace GameServer.Dungeon;
|
||||
|
||||
/// <summary>
|
||||
/// Represents an active dungeon instance
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Server.Game.Dungeon;
|
||||
namespace GameServer.Dungeon;
|
||||
|
||||
/// <summary>
|
||||
/// Contains the generated dungeon layout data
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using DataServer.Data.Entities;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Server.Game.Dungeon;
|
||||
namespace GameServer.Dungeon;
|
||||
|
||||
/// <summary>
|
||||
/// Enhanced dungeon layout with full tile visual information
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Server.Game.Dungeon;
|
||||
namespace GameServer.Dungeon;
|
||||
|
||||
public class DungeonMobSpawn
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
public enum DungeonPhase
|
||||
namespace GameServer.Dungeon;
|
||||
public enum DungeonPhase
|
||||
{
|
||||
Active,
|
||||
Cleared,
|
||||
|
||||
@@ -2,7 +2,7 @@ using DataServer.Data.Entities;
|
||||
using DataServer.Data.Enums;
|
||||
using Server.Networking;
|
||||
|
||||
namespace Server.Game.Dungeon;
|
||||
namespace GameServer.Dungeon;
|
||||
|
||||
/// <summary>
|
||||
/// Tracks a player's dungeon session state
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Server.Game.Dungeon;
|
||||
namespace GameServer.Dungeon;
|
||||
|
||||
public struct DungeonPoint
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Server.Game.Dungeon;
|
||||
namespace GameServer.Dungeon;
|
||||
|
||||
public class DungeonRoom
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using DataServer.Data.Entities;
|
||||
|
||||
namespace Server.Game.Dungeon;
|
||||
namespace GameServer.Dungeon;
|
||||
|
||||
/// <summary>
|
||||
/// Extended room with template info
|
||||
|
||||
@@ -2,7 +2,7 @@ using System.Collections.Concurrent;
|
||||
using DataServer.Data.Entities;
|
||||
using DataServer.Data.Enums;
|
||||
|
||||
namespace Server.Game.Dungeon;
|
||||
namespace GameServer.Dungeon;
|
||||
|
||||
/// <summary>
|
||||
/// Runtime simulation for an active dungeon instance
|
||||
@@ -1050,6 +1050,7 @@ public partial class DungeonSimulation
|
||||
float dy = y2 - y1;
|
||||
return MathF.Sqrt(dx * dx + dy * dy);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Server.Game.Dungeon;
|
||||
namespace GameServer.Dungeon;
|
||||
|
||||
/// <summary>
|
||||
/// Admin extensions for DungeonSimulation
|
||||
|
||||
@@ -3,7 +3,7 @@ using DataServer.Data.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Server.Game.Dungeon;
|
||||
namespace GameServer.Dungeon;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for visual tile data
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Server.Game.Dungeon;
|
||||
namespace GameServer.Dungeon;
|
||||
|
||||
/// <summary>
|
||||
/// Runtime instance of a personal loot chest (from death overflow)
|
||||
|
||||
@@ -4,7 +4,7 @@ using Microsoft.Extensions.Logging;
|
||||
using DataServer.Data;
|
||||
using DataServer.Data.Entities;
|
||||
|
||||
namespace Server.Game.Dungeon;
|
||||
namespace GameServer.Dungeon;
|
||||
|
||||
/// <summary>
|
||||
/// Generated loot result - an item with quantity
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using DataServer.Data.Entities;
|
||||
using DataServer.Data.Enums;
|
||||
|
||||
namespace Server.Game.Dungeon;
|
||||
namespace GameServer.Dungeon;
|
||||
|
||||
/// <summary>
|
||||
/// Handles mob AI behavior and decision making
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using DataServer.Data.Entities;
|
||||
using DataServer.Data.Enums;
|
||||
|
||||
namespace Server.Game.Dungeon;
|
||||
namespace GameServer.Dungeon;
|
||||
|
||||
/// <summary>
|
||||
/// Loot carried by a mob from killing a player
|
||||
|
||||
@@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using DataServer.Data;
|
||||
using DataServer.Data.Entities;
|
||||
|
||||
namespace Server.Game.Dungeon;
|
||||
namespace GameServer.Dungeon;
|
||||
|
||||
/// <summary>
|
||||
/// Builds sprite configuration JSON for mobs from the database animation system
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Server.Game.Dungeon
|
||||
namespace GameServer.Dungeon
|
||||
{
|
||||
/// <summary>
|
||||
/// Placed tile with details
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Server.Game.Dungeon;
|
||||
namespace GameServer.Dungeon;
|
||||
|
||||
/// <summary>
|
||||
/// Runtime instance of a player in a dungeon
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Server.Game.Dungeon;
|
||||
namespace GameServer.Dungeon;
|
||||
|
||||
/// <summary>
|
||||
/// Runtime instance of a portal in a dungeon
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Server.Game.Dungeon;
|
||||
namespace GameServer.Dungeon;
|
||||
|
||||
/// <summary>
|
||||
/// A projectile in flight
|
||||
|
||||
@@ -7,7 +7,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Server.Game.Dungeon
|
||||
namespace GameServer.Dungeon
|
||||
{
|
||||
/// <summary>
|
||||
/// Normalized tag info: supports comma/space separated tokens + key:value tags.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Server.Game.Dungeon;
|
||||
namespace GameServer.Dungeon;
|
||||
|
||||
public class TickResult
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Server.Game.Dungeon
|
||||
namespace GameServer.Dungeon
|
||||
{
|
||||
/// <summary>
|
||||
/// Tilemap sheet info for client
|
||||
|
||||
@@ -5,7 +5,7 @@ using System.Net.WebSockets;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Server.Redis;
|
||||
using Server.Services.Auth;
|
||||
using GameServices.Auth;
|
||||
using StackExchange.Redis;
|
||||
|
||||
namespace Server.Networking;
|
||||
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using Server.Game.Dungeon;
|
||||
using GameServer.Dungeon;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@@ -12,9 +12,9 @@ using Server.Networking;
|
||||
using Server.Networking.Handling;
|
||||
using Server.Networking.Messages;
|
||||
using Server.Redis;
|
||||
using Server.Services;
|
||||
using Server.Services.Auth;
|
||||
using Server.Game;
|
||||
using GameServices;
|
||||
using GameServices.Auth;
|
||||
using GameServer;
|
||||
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
@@ -4,7 +4,7 @@ using DataServer.Data;
|
||||
using DataServer.Data.Entities;
|
||||
using DataServer.Data.Enums;
|
||||
|
||||
namespace Server.Services.Admin.Pages.Abilities;
|
||||
namespace GameServices.Admin.Pages.Abilities;
|
||||
|
||||
public class EditModel : AdminPageModel
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ using DataServer.Data;
|
||||
using DataServer.Data.Entities;
|
||||
using DataServer.Data.Enums;
|
||||
|
||||
namespace Server.Services.Admin.Pages.Abilities;
|
||||
namespace GameServices.Admin.Pages.Abilities;
|
||||
|
||||
public class IndexModel : AdminPageModel
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
namespace Server.Services.Admin.Pages;
|
||||
namespace GameServices.Admin.Pages;
|
||||
|
||||
/// <summary>
|
||||
/// Base class for all admin pages that require authentication
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using Server.Game.Dungeon;
|
||||
using GameServer.Dungeon;
|
||||
|
||||
namespace Server.Services.Admin.Pages;
|
||||
namespace GameServices.Admin.Pages;
|
||||
|
||||
public class ApiModel : AdminPageModel
|
||||
{
|
||||
|
||||
@@ -2,11 +2,11 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using DataServer.Data;
|
||||
using DataServer.Data.Entities;
|
||||
using Server.Services;
|
||||
using GameServices;
|
||||
using System.Net.Http;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace Server.Services.Admin.Pages.Assets;
|
||||
namespace GameServices.Admin.Pages.Assets;
|
||||
|
||||
public class IndexModel : AdminPageModel
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Server.Redis;
|
||||
|
||||
namespace Server.Services.Admin.Pages.Broadcast;
|
||||
namespace GameServices.Admin.Pages.Broadcast;
|
||||
|
||||
public class IndexModel : AdminPageModel
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@ using DataServer.Data.Entities;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Server.Services.Admin.Pages.DungeonBuilder;
|
||||
namespace GameServices.Admin.Pages.DungeonBuilder;
|
||||
|
||||
public class IndexModel : AdminPageModel
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@ using DataServer.Data.Entities;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Server.Services.Admin.Pages.DungeonBuilder;
|
||||
namespace GameServices.Admin.Pages.DungeonBuilder;
|
||||
|
||||
public class ObjectEditModel : AdminPageModel
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@ using DataServer.Data.Entities;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Server.Services.Admin.Pages.DungeonBuilder;
|
||||
namespace GameServices.Admin.Pages.DungeonBuilder;
|
||||
|
||||
public class ObjectsModel : AdminPageModel
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Server.Services.Admin.Pages.DungeonBuilder;
|
||||
namespace GameServices.Admin.Pages.DungeonBuilder;
|
||||
|
||||
public class PaletteEditModel : AdminPageModel
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@ using DataServer.Data.Entities;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Server.Services.Admin.Pages.DungeonBuilder;
|
||||
namespace GameServices.Admin.Pages.DungeonBuilder;
|
||||
|
||||
public class PalettesModel : AdminPageModel
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Server.Services.Admin.Pages.DungeonBuilder;
|
||||
namespace GameServices.Admin.Pages.DungeonBuilder;
|
||||
|
||||
public class RoomEditModel : AdminPageModel
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@ using DataServer.Data.Entities;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Server.Services.Admin.Pages.DungeonBuilder;
|
||||
namespace GameServices.Admin.Pages.DungeonBuilder;
|
||||
|
||||
public class RoomsModel : AdminPageModel
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Server.Services.Admin.Pages.DungeonBuilder;
|
||||
namespace GameServices.Admin.Pages.DungeonBuilder;
|
||||
|
||||
public class TestGenModel : AdminPageModel
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Server.Services.Admin.Pages.DungeonBuilder;
|
||||
namespace GameServices.Admin.Pages.DungeonBuilder;
|
||||
|
||||
public class TileEditModel : AdminPageModel
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Server.Services.Admin.Pages.DungeonBuilder;
|
||||
namespace GameServices.Admin.Pages.DungeonBuilder;
|
||||
|
||||
public class TilesModel : AdminPageModel
|
||||
{
|
||||
|
||||
@@ -91,9 +91,9 @@
|
||||
<div>
|
||||
<label class="text-xs text-gray-400 mb-1 block">Status</label>
|
||||
<select name="status" class="input text-sm">
|
||||
<option value="">All Status</option>
|
||||
<option value="active" selected="@(Model.StatusFilter == "active")">Active</option>
|
||||
<option value="completed" selected="@(Model.StatusFilter == "completed")">Completed</option>
|
||||
<option value="">Active Only</option>
|
||||
<option value="completed" selected="@(Model.StatusFilter == "completed")">Completed/Cleared</option>
|
||||
<option value="all" selected="@(Model.StatusFilter == "all")">All Dungeons</option>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
@@ -126,7 +126,11 @@
|
||||
<div class="space-y-4">
|
||||
<h2 class="text-xl font-semibold text-white flex items-center gap-2">
|
||||
<div class="live-indicator"></div>
|
||||
Active Dungeons (@Model.Dungeons.Count)
|
||||
Dungeons (@Model.Dungeons.Count)
|
||||
@if (string.IsNullOrEmpty(Model.StatusFilter) || Model.StatusFilter == "active")
|
||||
{
|
||||
<span class="text-sm font-normal text-gray-500">(active only)</span>
|
||||
}
|
||||
</h2>
|
||||
|
||||
@if (Model.Dungeons.Count > 0)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Server.Game.Dungeon;
|
||||
using GameServer.Dungeon;
|
||||
|
||||
namespace Server.Services.Admin.Pages.Dungeons;
|
||||
namespace GameServices.Admin.Pages.Dungeons;
|
||||
|
||||
public class IndexModel : AdminPageModel
|
||||
{
|
||||
@@ -37,12 +37,20 @@ public class IndexModel : AdminPageModel
|
||||
// Apply filters
|
||||
var filtered = allDungeons.AsEnumerable();
|
||||
|
||||
if (!string.IsNullOrEmpty(status))
|
||||
// By default, show only active dungeons (exclude cleared/completed)
|
||||
if (string.IsNullOrEmpty(status))
|
||||
{
|
||||
if (status == "active")
|
||||
filtered = filtered.Where(d => d.Simulation.Phase == DungeonPhase.Active);
|
||||
else if (status == "completed")
|
||||
filtered = filtered.Where(d => d.Simulation.Phase == DungeonPhase.Cleared);
|
||||
// Default: Active only
|
||||
filtered = filtered.Where(d => d.Simulation.Phase == DungeonPhase.Active);
|
||||
}
|
||||
else if (status == "cleared")
|
||||
{
|
||||
// Show completed and cleared
|
||||
filtered = filtered.Where(d => d.Simulation.Phase == DungeonPhase.Cleared || d.Simulation.Phase == DungeonPhase.Cleared);
|
||||
}
|
||||
else if (status == "all")
|
||||
{
|
||||
// Show all - no filter
|
||||
}
|
||||
|
||||
if (tier.HasValue)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
@page "/admin/dungeons/view"
|
||||
@model Admin.Pages.Dungeons.ViewModel
|
||||
@model GameServices.Admin.Pages.Dungeons.ViewModel
|
||||
@{
|
||||
ViewData["Title"] = $"Dungeon View - Tier {Model.Dungeon?.Tier}";
|
||||
}
|
||||
@@ -19,7 +19,12 @@
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
pointer-events: none;
|
||||
cursor: pointer;
|
||||
transition: transform 0.1s;
|
||||
}
|
||||
.entity-dot:hover {
|
||||
transform: translate(-50%, -50%) scale(1.5);
|
||||
z-index: 100;
|
||||
}
|
||||
.player-dot {
|
||||
background: #4ade80;
|
||||
@@ -29,8 +34,11 @@
|
||||
}
|
||||
.mob-dot {
|
||||
background: #f87171;
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
}
|
||||
.mob-dot:hover {
|
||||
box-shadow: 0 0 8px #f87171;
|
||||
}
|
||||
.boss-dot {
|
||||
background: #fbbf24;
|
||||
@@ -38,6 +46,10 @@
|
||||
height: 12px;
|
||||
box-shadow: 0 0 8px #fbbf24;
|
||||
}
|
||||
.mob-dot.selected, .boss-dot.selected {
|
||||
outline: 2px solid white;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
.stat-card {
|
||||
background: rgba(30, 30, 50, 0.8);
|
||||
border: 1px solid #374151;
|
||||
@@ -64,6 +76,22 @@
|
||||
background: linear-gradient(90deg, #ef4444, #22c55e);
|
||||
transition: width 0.3s ease;
|
||||
}
|
||||
.mob-inspector {
|
||||
background: rgba(20, 20, 40, 0.95);
|
||||
border: 1px solid #4f46e5;
|
||||
border-radius: 8px;
|
||||
padding: 16px;
|
||||
min-width: 280px;
|
||||
}
|
||||
.inspector-stat {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 4px 0;
|
||||
border-bottom: 1px solid rgba(255,255,255,0.1);
|
||||
}
|
||||
.inspector-stat:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="mb-4">
|
||||
@@ -89,7 +117,7 @@ else
|
||||
<h2 class="text-xl font-semibold text-white">Live Dungeon Map</h2>
|
||||
<div class="flex items-center gap-2 text-sm text-gray-400">
|
||||
<div class="w-2 h-2 bg-green-400 rounded-full animate-pulse"></div>
|
||||
<span>Live</span>
|
||||
<span id="refreshRate">500ms</span>
|
||||
<button onclick="toggleAutoRefresh()" id="autoRefreshBtn" class="btn btn-sm btn-ghost ml-2">
|
||||
Auto: ON
|
||||
</button>
|
||||
@@ -108,7 +136,7 @@ else
|
||||
</div>
|
||||
<div class="flex items-center gap-1">
|
||||
<div class="w-2 h-2 rounded-full bg-red-400"></div>
|
||||
<span>Mobs</span>
|
||||
<span>Mobs (click to inspect)</span>
|
||||
</div>
|
||||
<div class="flex items-center gap-1">
|
||||
<div class="w-3 h-3 rounded-full bg-yellow-400"></div>
|
||||
@@ -118,10 +146,32 @@ else
|
||||
<div class="w-3 h-3 bg-blue-400"></div>
|
||||
<span>Floor</span>
|
||||
</div>
|
||||
<div class="flex items-center gap-1">
|
||||
<div class="w-3 h-3 bg-gray-700"></div>
|
||||
<span>Wall</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Mob Inspector (shown when mob is selected) -->
|
||||
<div id="mobInspector" class="mob-inspector mt-4 hidden">
|
||||
<div class="flex items-center justify-between mb-3">
|
||||
<h3 class="text-lg font-semibold text-white" id="inspectorMobName">Mob Name</h3>
|
||||
<button onclick="closeMobInspector()" class="text-gray-400 hover:text-white">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
<div id="inspectorContent" class="space-y-1 text-sm">
|
||||
<!-- Populated by JS -->
|
||||
</div>
|
||||
<div class="flex gap-2 mt-4">
|
||||
<button onclick="killSelectedMob()" class="btn btn-danger btn-sm flex-1">
|
||||
<svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/>
|
||||
</svg>
|
||||
Kill Mob
|
||||
</button>
|
||||
<button onclick="teleportToMob()" class="btn btn-secondary btn-sm flex-1">
|
||||
📍 Copy Position
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -150,7 +200,7 @@ else
|
||||
</div>
|
||||
<div class="flex justify-between">
|
||||
<span class="text-gray-400">Phase</span>
|
||||
<span class="@(Model.Dungeon.Simulation.Phase == DungeonPhase.Active ? "text-green-400" : "text-blue-400")">
|
||||
<span class="@(Model.Dungeon.Simulation.Phase == GameServer.Dungeon.DungeonPhase.Active ? "text-green-400" : "text-blue-400")">
|
||||
@Model.Dungeon.Simulation.Phase
|
||||
</span>
|
||||
</div>
|
||||
@@ -194,6 +244,37 @@ else
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Spawn Mob -->
|
||||
<div class="stat-card">
|
||||
<h3 class="text-lg font-semibold text-white mb-3">Spawn Mob</h3>
|
||||
<div class="space-y-2">
|
||||
<select id="spawnMobSelect" class="input text-sm w-full">
|
||||
<option value="">Select a mob...</option>
|
||||
@foreach (var mob in Model.MobDefinitions)
|
||||
{
|
||||
<option value="@mob.Id">@mob.Name (T@mob.MinTier-@mob.MaxTier)</option>
|
||||
}
|
||||
</select>
|
||||
<div class="grid grid-cols-2 gap-2">
|
||||
<div>
|
||||
<label class="text-xs text-gray-400">X</label>
|
||||
<input type="number" id="spawnX" class="input text-sm" placeholder="X pos" value="@(Model.MapWidth / 2 * 32)" />
|
||||
</div>
|
||||
<div>
|
||||
<label class="text-xs text-gray-400">Y</label>
|
||||
<input type="number" id="spawnY" class="input text-sm" placeholder="Y pos" value="@(Model.MapHeight / 2 * 32)" />
|
||||
</div>
|
||||
</div>
|
||||
<button onclick="spawnMob()" class="btn btn-success w-full text-sm">
|
||||
<svg class="w-4 h-4 mr-1 inline" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6"/>
|
||||
</svg>
|
||||
Spawn Mob
|
||||
</button>
|
||||
<p class="text-xs text-gray-500">Click on map to set spawn position</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Players -->
|
||||
<div class="stat-card">
|
||||
<h3 class="text-lg font-semibold text-white mb-3">Players (@Model.Dungeon.Simulation.Players.Count)</h3>
|
||||
@@ -256,9 +337,13 @@ else
|
||||
const mapWidth = @(Model.MapWidth);
|
||||
const mapHeight = @(Model.MapHeight);
|
||||
const walkableData = @Html.Raw(Model.WalkableJson);
|
||||
const tileSize = 32;
|
||||
|
||||
let autoRefresh = true;
|
||||
let refreshInterval;
|
||||
let selectedMobId = null;
|
||||
let currentMobs = [];
|
||||
let mapScale = 4;
|
||||
|
||||
function initMap() {
|
||||
const canvas = document.getElementById('mapCanvas');
|
||||
@@ -266,14 +351,14 @@ else
|
||||
if (!canvas || !container) return;
|
||||
|
||||
const ctx = canvas.getContext('2d');
|
||||
const scale = Math.min(
|
||||
mapScale = Math.min(
|
||||
(container.clientWidth - 20) / mapWidth,
|
||||
(container.clientHeight - 20) / mapHeight,
|
||||
8 // Max scale
|
||||
);
|
||||
|
||||
canvas.width = mapWidth * scale;
|
||||
canvas.height = mapHeight * scale;
|
||||
canvas.width = mapWidth * mapScale;
|
||||
canvas.height = mapHeight * mapScale;
|
||||
canvas.style.width = canvas.width + 'px';
|
||||
canvas.style.height = canvas.height + 'px';
|
||||
|
||||
@@ -284,16 +369,25 @@ else
|
||||
const walkable = walkableData[idx];
|
||||
|
||||
ctx.fillStyle = walkable ? '#1e3a5f' : '#1a1a2e';
|
||||
ctx.fillRect(x * scale, y * scale, scale, scale);
|
||||
ctx.fillRect(x * mapScale, y * mapScale, mapScale, mapScale);
|
||||
|
||||
// Grid lines
|
||||
ctx.strokeStyle = 'rgba(255,255,255,0.05)';
|
||||
ctx.strokeRect(x * scale, y * scale, scale, scale);
|
||||
ctx.strokeRect(x * mapScale, y * mapScale, mapScale, mapScale);
|
||||
}
|
||||
}
|
||||
|
||||
// Store scale for entity positioning
|
||||
canvas.dataset.scale = scale;
|
||||
canvas.dataset.scale = mapScale;
|
||||
|
||||
// Click handler for spawn position
|
||||
canvas.onclick = function(e) {
|
||||
const rect = canvas.getBoundingClientRect();
|
||||
const x = Math.floor((e.clientX - rect.left) / mapScale) * tileSize + tileSize / 2;
|
||||
const y = Math.floor((e.clientY - rect.top) / mapScale) * tileSize + tileSize / 2;
|
||||
document.getElementById('spawnX').value = Math.round(x);
|
||||
document.getElementById('spawnY').value = Math.round(y);
|
||||
};
|
||||
}
|
||||
|
||||
function updateEntities(players, mobs) {
|
||||
@@ -301,18 +395,16 @@ else
|
||||
const overlay = document.getElementById('entityOverlay');
|
||||
if (!canvas || !overlay) return;
|
||||
|
||||
const scale = parseFloat(canvas.dataset.scale) || 4;
|
||||
const tileSize = 32; // Game tile size
|
||||
|
||||
currentMobs = mobs;
|
||||
overlay.innerHTML = '';
|
||||
|
||||
// Draw players
|
||||
players.forEach(p => {
|
||||
const div = document.createElement('div');
|
||||
div.className = 'entity-dot player-dot';
|
||||
div.style.left = (p.x / tileSize * scale) + 'px';
|
||||
div.style.top = (p.y / tileSize * scale) + 'px';
|
||||
div.title = p.name;
|
||||
div.style.left = (p.x / tileSize * mapScale) + 'px';
|
||||
div.style.top = (p.y / tileSize * mapScale) + 'px';
|
||||
div.title = `${p.name} (${Math.round(p.x)}, ${Math.round(p.y)})`;
|
||||
overlay.appendChild(div);
|
||||
});
|
||||
|
||||
@@ -321,13 +413,105 @@ else
|
||||
if (!m.alive) return;
|
||||
const div = document.createElement('div');
|
||||
div.className = 'entity-dot ' + (m.isBoss ? 'boss-dot' : 'mob-dot');
|
||||
div.style.left = (m.x / tileSize * scale) + 'px';
|
||||
div.style.top = (m.y / tileSize * scale) + 'px';
|
||||
div.title = m.name;
|
||||
if (m.id === selectedMobId) div.classList.add('selected');
|
||||
div.style.left = (m.x / tileSize * mapScale) + 'px';
|
||||
div.style.top = (m.y / tileSize * mapScale) + 'px';
|
||||
div.title = `${m.name} - Click to inspect`;
|
||||
div.dataset.mobId = m.id;
|
||||
div.onclick = (e) => {
|
||||
e.stopPropagation();
|
||||
selectMob(m);
|
||||
};
|
||||
overlay.appendChild(div);
|
||||
});
|
||||
}
|
||||
|
||||
function selectMob(mob) {
|
||||
selectedMobId = mob.id;
|
||||
|
||||
// Update selection visual
|
||||
document.querySelectorAll('.entity-dot').forEach(d => d.classList.remove('selected'));
|
||||
document.querySelector(`[data-mob-id="${mob.id}"]`)?.classList.add('selected');
|
||||
|
||||
// Show inspector
|
||||
const inspector = document.getElementById('mobInspector');
|
||||
inspector.classList.remove('hidden');
|
||||
|
||||
document.getElementById('inspectorMobName').textContent = mob.name + (mob.isBoss ? ' ⭐' : '');
|
||||
|
||||
document.getElementById('inspectorContent').innerHTML = `
|
||||
<div class="inspector-stat"><span class="text-gray-400">ID</span><span class="text-white font-mono text-xs">${mob.id}</span></div>
|
||||
<div class="inspector-stat"><span class="text-gray-400">Type</span><span class="text-white">${mob.type || 'Normal'}</span></div>
|
||||
<div class="inspector-stat"><span class="text-gray-400">Health</span><span class="text-white">${mob.health} / ${mob.maxHealth}</span></div>
|
||||
<div class="inspector-stat"><span class="text-gray-400">Position</span><span class="text-white">${Math.round(mob.x)}, ${Math.round(mob.y)}</span></div>
|
||||
<div class="inspector-stat"><span class="text-gray-400">State</span><span class="text-white">${mob.state || 'Unknown'}</span></div>
|
||||
<div class="inspector-stat"><span class="text-gray-400">Definition ID</span><span class="text-white">${mob.definitionId || 'N/A'}</span></div>
|
||||
`;
|
||||
}
|
||||
|
||||
function closeMobInspector() {
|
||||
selectedMobId = null;
|
||||
document.getElementById('mobInspector').classList.add('hidden');
|
||||
document.querySelectorAll('.entity-dot').forEach(d => d.classList.remove('selected'));
|
||||
}
|
||||
|
||||
async function killSelectedMob() {
|
||||
if (!selectedMobId) return;
|
||||
|
||||
try {
|
||||
const resp = await fetch(`/admin/dungeons/view?handler=KillMob&id=${dungeonId}&mobId=${selectedMobId}`, {
|
||||
method: 'POST',
|
||||
headers: { 'RequestVerificationToken': document.querySelector('[name="__RequestVerificationToken"]').value }
|
||||
});
|
||||
|
||||
if (resp.ok) {
|
||||
closeMobInspector();
|
||||
fetchUpdate();
|
||||
} else {
|
||||
alert('Failed to kill mob');
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Failed to kill mob:', e);
|
||||
alert('Error killing mob');
|
||||
}
|
||||
}
|
||||
|
||||
function teleportToMob() {
|
||||
const mob = currentMobs.find(m => m.id === selectedMobId);
|
||||
if (mob) {
|
||||
navigator.clipboard.writeText(`${Math.round(mob.x)}, ${Math.round(mob.y)}`);
|
||||
alert(`Position copied: ${Math.round(mob.x)}, ${Math.round(mob.y)}`);
|
||||
}
|
||||
}
|
||||
|
||||
async function spawnMob() {
|
||||
const mobDefId = document.getElementById('spawnMobSelect').value;
|
||||
const x = document.getElementById('spawnX').value;
|
||||
const y = document.getElementById('spawnY').value;
|
||||
|
||||
if (!mobDefId) {
|
||||
alert('Please select a mob to spawn');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const resp = await fetch(`/admin/dungeons/view?handler=SpawnMob&id=${dungeonId}&mobDefId=${mobDefId}&x=${x}&y=${y}`, {
|
||||
method: 'POST',
|
||||
headers: { 'RequestVerificationToken': document.querySelector('[name="__RequestVerificationToken"]').value }
|
||||
});
|
||||
|
||||
if (resp.ok) {
|
||||
fetchUpdate();
|
||||
} else {
|
||||
const text = await resp.text();
|
||||
alert('Failed to spawn mob: ' + text);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Failed to spawn mob:', e);
|
||||
alert('Error spawning mob');
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchUpdate() {
|
||||
try {
|
||||
const resp = await fetch(`/admin/dungeons/view?handler=Status&id=${dungeonId}`);
|
||||
@@ -337,6 +521,16 @@ else
|
||||
document.getElementById('mobCount').textContent = data.mobsAlive;
|
||||
document.getElementById('duration').textContent = data.duration;
|
||||
updateEntities(data.players, data.mobs);
|
||||
|
||||
// Update selected mob info if still selected
|
||||
if (selectedMobId) {
|
||||
const mob = data.mobs.find(m => m.id === selectedMobId);
|
||||
if (mob && mob.alive) {
|
||||
selectMob(mob);
|
||||
} else {
|
||||
closeMobInspector();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Failed to fetch update:', e);
|
||||
@@ -348,7 +542,7 @@ else
|
||||
document.getElementById('autoRefreshBtn').textContent = 'Auto: ' + (autoRefresh ? 'ON' : 'OFF');
|
||||
|
||||
if (autoRefresh) {
|
||||
refreshInterval = setInterval(fetchUpdate, 2000);
|
||||
refreshInterval = setInterval(fetchUpdate, 500);
|
||||
} else {
|
||||
clearInterval(refreshInterval);
|
||||
}
|
||||
@@ -363,8 +557,8 @@ else
|
||||
const initialMobs = @Html.Raw(Model.MobsJson);
|
||||
updateEntities(initialPlayers, initialMobs);
|
||||
|
||||
// Start auto-refresh
|
||||
refreshInterval = setInterval(fetchUpdate, 2000);
|
||||
// Start auto-refresh at 500ms (faster updates)
|
||||
refreshInterval = setInterval(fetchUpdate, 500);
|
||||
});
|
||||
|
||||
// Handle resize
|
||||
|
||||
@@ -1,19 +1,24 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Server.Game.Dungeon;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using GameServer.Dungeon;
|
||||
using DataServer.Data;
|
||||
using DataServer.Data.Entities;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Server.Services.Admin.Pages.Dungeons;
|
||||
namespace GameServices.Admin.Pages.Dungeons;
|
||||
|
||||
public class ViewModel : AdminPageModel
|
||||
{
|
||||
private readonly DungeonHandler _dungeonHandler;
|
||||
private readonly GameDbContext _db;
|
||||
|
||||
public ViewModel(DungeonHandler dungeonHandler)
|
||||
public ViewModel(DungeonHandler dungeonHandler, GameDbContext db)
|
||||
{
|
||||
_dungeonHandler = dungeonHandler;
|
||||
_db = db;
|
||||
}
|
||||
|
||||
public DungeonInstance? Dungeon { get; set; }
|
||||
public GameServer.Dungeon.DungeonInstance? Dungeon { get; set; }
|
||||
public string Duration { get; set; } = "";
|
||||
public int RoomCount { get; set; }
|
||||
public int MapWidth { get; set; }
|
||||
@@ -21,18 +26,25 @@ public class ViewModel : AdminPageModel
|
||||
public string WalkableJson { get; set; } = "[]";
|
||||
public string PlayersJson { get; set; } = "[]";
|
||||
public string MobsJson { get; set; } = "[]";
|
||||
public List<DungeonMobDefinition> MobDefinitions { get; set; } = new();
|
||||
|
||||
public void OnGet(Guid id)
|
||||
public async Task OnGetAsync(Guid id)
|
||||
{
|
||||
Dungeon = _dungeonHandler.GetDungeon(id);
|
||||
|
||||
// Load mob definitions for spawn dropdown
|
||||
MobDefinitions = await _db.DungeonMobDefinitions
|
||||
.Where(m => m.IsEnabled)
|
||||
.OrderBy(m => m.Name)
|
||||
.ToListAsync();
|
||||
|
||||
if (Dungeon == null) return;
|
||||
|
||||
Duration = FormatDuration(DateTime.UtcNow - Dungeon.CreatedAt);
|
||||
RoomCount = Dungeon.LayoutV2?.Rooms?.Count ?? Dungeon.Simulation.Layout.Rooms.Count;
|
||||
|
||||
// Get map dimensions
|
||||
var layout = Dungeon.LayoutV2 ?? (DungeonLayoutV2?)null;
|
||||
var layout = Dungeon.LayoutV2;
|
||||
if (layout != null)
|
||||
{
|
||||
MapWidth = layout.Width;
|
||||
@@ -72,11 +84,17 @@ public class ViewModel : AdminPageModel
|
||||
MobsJson = JsonSerializer.Serialize(
|
||||
Dungeon.Simulation.Mobs.Values.Select(m => new
|
||||
{
|
||||
id = m.Id.ToString(),
|
||||
name = m.Name,
|
||||
x = m.X,
|
||||
y = m.Y,
|
||||
health = m.Health,
|
||||
maxHealth = m.MaxHealth,
|
||||
alive = m.IsAlive,
|
||||
isBoss = m.Type == DataServer.Data.Enums.MobType.Boss
|
||||
isBoss = m.Type == DataServer.Data.Enums.MobType.Boss,
|
||||
type = m.Type.ToString(),
|
||||
state = m.State.ToString() ?? "Idle",
|
||||
definitionId = m.DefinitionId
|
||||
})
|
||||
);
|
||||
}
|
||||
@@ -98,17 +116,84 @@ public class ViewModel : AdminPageModel
|
||||
x = p.X,
|
||||
y = p.Y
|
||||
}),
|
||||
mobs = dungeon.Simulation.Mobs.Values.Where(m => m.IsAlive).Select(m => new
|
||||
mobs = dungeon.Simulation.Mobs.Values.Select(m => new
|
||||
{
|
||||
id = m.Id.ToString(),
|
||||
name = m.Name,
|
||||
x = m.X,
|
||||
y = m.Y,
|
||||
health = m.Health,
|
||||
maxHealth = m.MaxHealth,
|
||||
alive = m.IsAlive,
|
||||
isBoss = m.Type == DataServer.Data.Enums.MobType.Boss
|
||||
isBoss = m.Type == DataServer.Data.Enums.MobType.Boss,
|
||||
type = m.Type.ToString(),
|
||||
state = m.State.ToString() ?? "Idle",
|
||||
definitionId = m.DefinitionId
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
public IActionResult OnPostKillMob(Guid id, string mobId)
|
||||
{
|
||||
var dungeon = _dungeonHandler.GetDungeon(id);
|
||||
if (dungeon == null)
|
||||
return new JsonResult(new { error = "Dungeon not found" }) { StatusCode = 404 };
|
||||
|
||||
if (!int.TryParse(mobId, out var mobInt))
|
||||
return new JsonResult(new { error = "Invalid mob ID" }) { StatusCode = 400 };
|
||||
|
||||
if (dungeon.Simulation.Mobs.TryGetValue(mobInt, out var mob))
|
||||
{
|
||||
mob.Health = 0;
|
||||
mob.IsAlive = false;
|
||||
return new JsonResult(new { success = true });
|
||||
}
|
||||
|
||||
return new JsonResult(new { error = "Mob not found" }) { StatusCode = 404 };
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnPostSpawnMob(Guid id, int mobDefId, float x, float y)
|
||||
{
|
||||
var dungeon = _dungeonHandler.GetDungeon(id);
|
||||
if (dungeon == null)
|
||||
return new JsonResult(new { error = "Dungeon not found" }) { StatusCode = 404 };
|
||||
|
||||
var mobDef = await _db.DungeonMobDefinitions.FindAsync(mobDefId);
|
||||
if (mobDef == null)
|
||||
return new JsonResult(new { error = "Mob definition not found" }) { StatusCode = 404 };
|
||||
int mobId = dungeon.Simulation.Mobs.Count + 1;
|
||||
var stats = mobDef.GetStatsForBracket(dungeon.LevelBracketMin);
|
||||
// Create a new mob instance
|
||||
var mob = new MobInstance
|
||||
{
|
||||
Id = mobId,
|
||||
DefinitionId = mobDef.Id,
|
||||
Name = mobDef.Name,
|
||||
Type = mobDef.Type,
|
||||
X = x,
|
||||
Y = y,
|
||||
Health = stats.MaxHealth,
|
||||
MaxHealth = stats.MaxHealth,
|
||||
Mana = mobDef.BaseMana,
|
||||
MaxMana = mobDef.BaseMana,
|
||||
Stats = stats,
|
||||
State = MobState.Idle,
|
||||
SpriteConfigJson = mobDef.SpriteConfigJson,
|
||||
TintColor = mobDef.TintColor,
|
||||
Scale = mobDef.Scale,
|
||||
Behavior = mobDef.Behavior,
|
||||
PreferredRange = mobDef.PreferredRange,
|
||||
FleeThreshold = mobDef.FleeThreshold,
|
||||
Phases = mobDef.Phases,
|
||||
CurrentAnimation = "idle_down",
|
||||
FacingDirection = "down"
|
||||
};
|
||||
|
||||
dungeon.Simulation.Mobs[mob.Id] = mob;
|
||||
|
||||
return new JsonResult(new { success = true, mobId = mob.Id });
|
||||
}
|
||||
|
||||
public IActionResult OnPostKillAllMobs(Guid id)
|
||||
{
|
||||
var dungeon = _dungeonHandler.GetDungeon(id);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using DataServer.Data;
|
||||
|
||||
namespace Server.Services.Admin.Pages;
|
||||
namespace GameServices.Admin.Pages;
|
||||
|
||||
public class IndexModel : AdminPageModel
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ using DataServer.Data.Entities;
|
||||
using DataServer.Data.Enums;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Server.Services.Admin.Pages.Items;
|
||||
namespace GameServices.Admin.Pages.Items;
|
||||
|
||||
public class EditModel : AdminPageModel
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ using DataServer.Data;
|
||||
using DataServer.Data.Entities;
|
||||
using DataServer.Data.Enums;
|
||||
|
||||
namespace Server.Services.Admin.Pages.Items;
|
||||
namespace GameServices.Admin.Pages.Items;
|
||||
|
||||
public class IndexModel : AdminPageModel
|
||||
{
|
||||
|
||||
@@ -2,9 +2,9 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using DataServer.Data;
|
||||
using Server.Services.Auth;
|
||||
using GameServices.Auth;
|
||||
|
||||
namespace Server.Services.Admin.Pages;
|
||||
namespace GameServices.Admin.Pages;
|
||||
|
||||
public class LoginModel : PageModel
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
namespace Server.Services.Admin.Pages;
|
||||
namespace GameServices.Admin.Pages;
|
||||
|
||||
public class LogoutModel : PageModel
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using DataServer.Data;
|
||||
using DataServer.Data.Entities;
|
||||
|
||||
namespace Server.Services.Admin.Pages.LootTables;
|
||||
namespace GameServices.Admin.Pages.LootTables;
|
||||
|
||||
public class EditModel : AdminPageModel
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using DataServer.Data;
|
||||
using DataServer.Data.Entities;
|
||||
|
||||
namespace Server.Services.Admin.Pages.LootTables;
|
||||
namespace GameServices.Admin.Pages.LootTables;
|
||||
|
||||
public class IndexModel : AdminPageModel
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ using DataServer.Data.Entities;
|
||||
using DataServer.Data.Enums;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Server.Services.Admin.Pages.Mobs;
|
||||
namespace GameServices.Admin.Pages.Mobs;
|
||||
|
||||
// Helper class for sprite configuration (legacy - keeping for backwards compatibility)
|
||||
public class MobSpriteConfig
|
||||
|
||||
@@ -4,7 +4,7 @@ using DataServer.Data;
|
||||
using DataServer.Data.Entities;
|
||||
using DataServer.Data.Enums;
|
||||
|
||||
namespace Server.Services.Admin.Pages.Mobs;
|
||||
namespace GameServices.Admin.Pages.Mobs;
|
||||
|
||||
public class IndexModel : AdminPageModel
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using DataServer.Data;
|
||||
using DataServer.Data.Entities;
|
||||
|
||||
namespace Server.Services.Admin.Pages.Players;
|
||||
namespace GameServices.Admin.Pages.Players;
|
||||
|
||||
public class CharacterModel : AdminPageModel
|
||||
{
|
||||
|
||||
@@ -2,10 +2,10 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using DataServer.Data;
|
||||
using DataServer.Data.Entities;
|
||||
using Server.Services.Auth;
|
||||
using GameServices.Auth;
|
||||
using Server.Redis;
|
||||
|
||||
namespace Server.Services.Admin.Pages.Players;
|
||||
namespace GameServices.Admin.Pages.Players;
|
||||
|
||||
public class EditModel : AdminPageModel
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using DataServer.Data;
|
||||
|
||||
namespace Server.Services.Admin.Pages.Players;
|
||||
namespace GameServices.Admin.Pages.Players;
|
||||
|
||||
public class IndexModel : AdminPageModel
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using DataServer.Data;
|
||||
using DataServer.Data.Entities;
|
||||
|
||||
namespace Server.Services.Admin.Pages.Recipes;
|
||||
namespace GameServices.Admin.Pages.Recipes;
|
||||
|
||||
public class EditModel : AdminPageModel
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using DataServer.Data;
|
||||
using DataServer.Data.Entities;
|
||||
|
||||
namespace Server.Services.Admin.Pages.Recipes;
|
||||
namespace GameServices.Admin.Pages.Recipes;
|
||||
|
||||
public class IndexModel : AdminPageModel
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using DataServer.Data;
|
||||
using DataServer.Data.Entities;
|
||||
|
||||
namespace Server.Services.Admin.Pages.Resistances;
|
||||
namespace GameServices.Admin.Pages.Resistances;
|
||||
|
||||
public class IndexModel : AdminPageModel
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ using DataServer.Data;
|
||||
using Server.Redis;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Server.Services.Admin.Pages.Server;
|
||||
namespace GameServices.Admin.Pages.Server;
|
||||
|
||||
public class IndexModel : AdminPageModel
|
||||
{
|
||||
|
||||
@@ -159,12 +159,6 @@
|
||||
TileMaps
|
||||
</a>
|
||||
|
||||
<a href="/admin/roomtemplates" class="sidebar-link @(ViewContext.RouteData.Values["page"]?.ToString()?.StartsWith("/RoomTemplates") == true ? "active" : "")" onclick="closeMobileMenu()">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4"/>
|
||||
</svg>
|
||||
Room Templates
|
||||
</a>
|
||||
|
||||
<a href="/admin/dungeonbuilder" class="sidebar-link @(ViewContext.RouteData.Values["page"]?.ToString()?.Contains("DungeonBuilder") == true ? "active" : "")" onclick="closeMobileMenu()">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
@@ -198,6 +192,13 @@
|
||||
<p class="px-4 text-xs font-semibold text-gray-500 uppercase tracking-wider">Management</p>
|
||||
</div>
|
||||
|
||||
<a href="/admin/dungeons" class="sidebar-link @(ViewContext.RouteData.Values["page"]?.ToString()?.StartsWith("/Dungeons") == true ? "active" : "")" onclick="closeMobileMenu()">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4"/>
|
||||
</svg>
|
||||
Dungeons
|
||||
</a>
|
||||
|
||||
<a href="/admin/players" class="sidebar-link @(ViewContext.RouteData.Values["page"]?.ToString()?.StartsWith("/Players") == true ? "active" : "")" onclick="closeMobileMenu()">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z"/>
|
||||
|
||||
@@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using DataServer.Data;
|
||||
using DataServer.Data.Entities;
|
||||
|
||||
namespace Server.Services.Admin.Pages.SpriteSheets;
|
||||
namespace GameServices.Admin.Pages.SpriteSheets;
|
||||
|
||||
public class EditModel : AdminPageModel
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using DataServer.Data;
|
||||
using DataServer.Data.Entities;
|
||||
|
||||
namespace Server.Services.Admin.Pages.SpriteSheets;
|
||||
namespace GameServices.Admin.Pages.SpriteSheets;
|
||||
|
||||
public class IndexModel : AdminPageModel
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using DataServer.Data;
|
||||
using DataServer.Data.Entities;
|
||||
|
||||
namespace Server.Services.Admin.Pages.TileMaps;
|
||||
namespace GameServices.Admin.Pages.TileMaps;
|
||||
|
||||
public class EditModel : AdminPageModel
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using DataServer.Data;
|
||||
using DataServer.Data.Entities;
|
||||
|
||||
namespace Server.Services.Admin.Pages.TileMaps;
|
||||
namespace GameServices.Admin.Pages.TileMaps;
|
||||
|
||||
public class IndexModel : AdminPageModel
|
||||
{
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
@namespace Server.Services.Admin.Pages
|
||||
@namespace GameServices.Admin.Pages
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using DataServer.Data;
|
||||
|
||||
namespace Server.Services.Auth;
|
||||
namespace GameServices.Auth;
|
||||
|
||||
public sealed class AccountsRepository : IAccountsRepository
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@ using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using DataServer.Data;
|
||||
|
||||
namespace Server.Services.Auth;
|
||||
namespace GameServices.Auth;
|
||||
|
||||
/// <summary>
|
||||
/// Service for validating admin authentication via session tokens
|
||||
|
||||
@@ -7,7 +7,7 @@ using Server.Networking;
|
||||
using Server.Networking.Handling;
|
||||
using Server.Networking.Messages;
|
||||
|
||||
namespace Server.Services.Auth;
|
||||
namespace GameServices.Auth;
|
||||
|
||||
public sealed class AuthHandler : IClientMessageHandler
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ using DataServer.Data;
|
||||
using Server.Redis;
|
||||
using StackExchange.Redis;
|
||||
|
||||
namespace Server.Services.Auth;
|
||||
namespace GameServices.Auth;
|
||||
|
||||
public interface IAuthService
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using DataServer.Data;
|
||||
|
||||
namespace Server.Services.Auth;
|
||||
namespace GameServices.Auth;
|
||||
|
||||
public interface IAccountsRepository
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Server.Services.Auth;
|
||||
namespace GameServices.Auth;
|
||||
|
||||
public interface IPasswordHasher
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Server.Services.Auth;
|
||||
namespace GameServices.Auth;
|
||||
|
||||
public interface ISessionAudit
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Server.Services.Auth;
|
||||
namespace GameServices.Auth;
|
||||
|
||||
public interface ISessionRegistry
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace Server.Services.Auth;
|
||||
namespace GameServices.Auth;
|
||||
|
||||
public sealed class Pbkdf2PasswordHasher : IPasswordHasher
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using DataServer.Data;
|
||||
|
||||
namespace Server.Services.Auth;
|
||||
namespace GameServices.Auth;
|
||||
|
||||
public sealed class SessionAudit : ISessionAudit
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
namespace Server.Services.Auth;
|
||||
namespace GameServices.Auth;
|
||||
|
||||
public sealed class SessionRegistry : ISessionRegistry
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Minio;
|
||||
using Minio.DataModel.Args;
|
||||
|
||||
namespace Server.Services;
|
||||
namespace GameServices;
|
||||
|
||||
public class MinioConfig
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
namespace Server.Services;
|
||||
namespace GameServices;
|
||||
|
||||
/// <summary>
|
||||
/// Service for broadcasting messages to connected game clients
|
||||
|
||||
Reference in New Issue
Block a user