From bcb130cb69ab00224282ec2ca147adf618ac40c6 Mon Sep 17 00:00:00 2001 From: dingo Date: Thu, 1 Jan 2026 17:15:07 -0500 Subject: [PATCH] Tile changes --- Game/Dungeon/DungeonGeneratorV2.cs | 835 +++--- Game/Dungeon/DungeonLayoutV2.cs | 15 +- Game/Dungeon/DungeonRoomV2.cs | 48 + Game/Dungeon/PlacedTile.cs | 18 + Game/Dungeon/TileMapSheetInfo.cs | 17 + .../20260101221446_TileChanges.Designer.cs | 2580 +++++++++++++++++ Migrations/20260101221446_TileChanges.cs | 110 + Migrations/GameDbContextModelSnapshot.cs | 28 + Services/Admin/Pages/TileMaps/Edit.cshtml | 191 +- Services/Admin/Pages/TileMaps/Edit.cshtml.cs | 91 +- data/entities/TileMap.cs | 328 ++- 11 files changed, 3657 insertions(+), 604 deletions(-) create mode 100644 Game/Dungeon/DungeonRoomV2.cs create mode 100644 Game/Dungeon/PlacedTile.cs create mode 100644 Game/Dungeon/TileMapSheetInfo.cs create mode 100644 Migrations/20260101221446_TileChanges.Designer.cs create mode 100644 Migrations/20260101221446_TileChanges.cs diff --git a/Game/Dungeon/DungeonGeneratorV2.cs b/Game/Dungeon/DungeonGeneratorV2.cs index 877826c..8e35c63 100644 --- a/Game/Dungeon/DungeonGeneratorV2.cs +++ b/Game/Dungeon/DungeonGeneratorV2.cs @@ -39,16 +39,54 @@ public class DungeonGeneratorV2 private List _normalTemplates = new(); private List _hallwayTemplates = new(); - - // Tile definitions cache private Dictionary _tileDefinitions = new(); private TileMapSheet? _defaultSheet; private Dictionary> _tileGroups = new(); private Dictionary> _tileTags = new(); + + // Legacy tag-based socket system (kept for fallback) private Dictionary> _tileSockets = new(); private Dictionary>> _tileSocketTypes = new(); + + // ========================================================================= + // NEW COLUMN-BASED SOCKET SYSTEM + // ========================================================================= + + /// + /// Simple struct to hold socket data for a tile from database columns + /// + private struct TileSocketInfo + { + public SocketType N, E, S, W; + public string? NCustom, ECustom, SCustom, WCustom; + + public string GetSocketId(string dir) => dir.ToUpperInvariant() switch + { + "N" => N == SocketType.Custom ? $"Custom:{NCustom}" : N.ToString(), + "E" => E == SocketType.Custom ? $"Custom:{ECustom}" : E.ToString(), + "S" => S == SocketType.Custom ? $"Custom:{SCustom}" : S.ToString(), + "W" => W == SocketType.Custom ? $"Custom:{WCustom}" : W.ToString(), + _ => "Closed" + }; + + public bool IsAllOpen => N == SocketType.Open && E == SocketType.Open && + S == SocketType.Open && W == SocketType.Open; + + public bool IsAllClosed => N == SocketType.Closed && E == SocketType.Closed && + S == SocketType.Closed && W == SocketType.Closed; + } + + /// + /// Column-based socket cache - maps tile ID to socket info + /// + private Dictionary _tileSocketsStrict = new(); + + /// + /// Whether to use strict column-based sockets (true) or legacy tag-based (false) + /// + private bool _useStrictSockets = false; private static HashSet ParseTags(string? tags) { @@ -72,8 +110,6 @@ public class DungeonGeneratorV2 { if (_hallwayTemplates.Count == 0) return null; - // Require a hallway to support the travel direction (and its opposite) via connection points. - // If template JSON is missing, we still allow it as a fallback. static string Opp(string dir) => dir.ToLower() switch { "north" => "south", @@ -105,10 +141,7 @@ public class DungeonGeneratorV2 && cps.Any(c => c.Direction.Equals(needB, StringComparison.OrdinalIgnoreCase)); } } - catch - { - // ignore parse failures - } + catch { } } if (!supports) continue; @@ -134,7 +167,6 @@ public class DungeonGeneratorV2 int fallbackSheetId, int fallbackFrameIndex) { - // Only supports straight runs. bool horizontal = y1 == y2; bool vertical = x1 == x2; if (!horizontal && !vertical) return false; @@ -156,7 +188,6 @@ public class DungeonGeneratorV2 int dir = horizontal ? Math.Sign(x2 - x1) : Math.Sign(y2 - y1); if (dir == 0) dir = 1; - // Align hallway chunk to the corridor centerline. int baseX = horizontal ? Math.Min(x1, x2) : x1 - (hallway.Width / 2); int baseY = vertical ? Math.Min(y1, y2) : y1 - (hallway.Height / 2); @@ -175,7 +206,6 @@ public class DungeonGeneratorV2 int wy = originY + p.Y; if (wx < 0 || wx >= MapWidth || wy < 0 || wy >= MapHeight) continue; - // Stop stamping once we collide with an existing walkable area (usually a room). if (layout.IsWalkable(wx, wy)) continue; int tileId = p.TileDefinitionId; @@ -186,14 +216,12 @@ public class DungeonGeneratorV2 tileDef = _tileDefinitions.GetValueOrDefault(tileId); } - // Remove any previous visuals at this location. layout.TileDetails.RemoveAll(t => t.X == wx && t.Y == wy); layout.Tiles[wx, wy] = tileId; if (layout.Walkable != null) layout.Walkable[wx, wy] = tileDef?.IsWalkable ?? true; - // Add visual if (tileId > 0) { layout.TileDetails.Add(new PlacedTile @@ -225,7 +253,6 @@ public class DungeonGeneratorV2 public async Task GenerateAsync() { - // Load templates from database await LoadTemplatesAsync(); var layout = new DungeonLayoutV2 @@ -237,19 +264,15 @@ public class DungeonGeneratorV2 TileSize = _tileSize }; - // Initialize tile map with detailed tile info - // 0 = void/wall, positive = tile definition ID layout.Tiles = new int[MapWidth, MapHeight]; - layout.Walkable = new bool[MapWidth, MapHeight]; // All false by default + layout.Walkable = new bool[MapWidth, MapHeight]; layout.TileDetails = new List(); - // Generate rooms int roomCount = _rng.Next(MinRooms, MaxRooms + 1); var rooms = new List(); int attempts = 0; int maxAttempts = roomCount * 30; - // Always place entrance first var entrance = await PlaceRoomAsync(layout, rooms, RoomType.Entrance, 5, 5); if (entrance != null) { @@ -257,15 +280,12 @@ public class DungeonGeneratorV2 Console.WriteLine($"[DungeonGenV2] Placed entrance room: {entrance.TemplateName ?? "fallback"} at ({entrance.X},{entrance.Y})"); } - // Place other rooms while (rooms.Count < roomCount && attempts < maxAttempts) { attempts++; - // Determine room type based on current room count RoomType type = DetermineNextRoomType(rooms, roomCount); - // Try to place near existing room (for connectivity) var baseRoom = rooms[_rng.Next(rooms.Count)]; int offsetX = _rng.Next(-20, 21); int offsetY = _rng.Next(-20, 21); @@ -282,32 +302,26 @@ public class DungeonGeneratorV2 Console.WriteLine($"[DungeonGenV2] Placed {rooms.Count}/{roomCount} rooms after {attempts} attempts"); - // Ensure we have an exit/boss room var bossRoom = rooms.FirstOrDefault(r => r.Type == RoomType.Boss); if (bossRoom == null && rooms.Count > 1) { - // Convert last room to boss rooms[^1].Type = RoomType.Boss; } - // Sort rooms by distance from entrance for corridor generation var entranceRoom = rooms.FirstOrDefault(r => r.Type == RoomType.Entrance) ?? rooms[0]; rooms = rooms.OrderBy(r => Distance(entranceRoom, r)).ToList(); - // Connect rooms with corridors - entrance MUST be connected var connected = new HashSet { 0 }; Console.WriteLine($"[DungeonGenV2] Connecting {rooms.Count} rooms..."); for (int i = 1; i < rooms.Count; i++) { - // Find closest connected room int closestIdx = connected.OrderBy(c => Distance(rooms[c], rooms[i])).First(); await ConnectRoomsAsync(layout, rooms[closestIdx], rooms[i]); connected.Add(i); Console.WriteLine($"[DungeonGenV2] Connected room {i} ({rooms[i].Type}) to room {closestIdx}"); } - // Add some extra connections for loops for (int i = 0; i < rooms.Count / 4; i++) { int a = _rng.Next(rooms.Count); @@ -318,19 +332,14 @@ public class DungeonGeneratorV2 } } - // Set spawn point layout.SpawnPoint = new DungeonPoint(entranceRoom.CenterX, entranceRoom.CenterY); - // Generate mob and chest spawns based on room templates GenerateSpawns(rooms, layout); - // Store rooms layout.Rooms = rooms.Cast().ToList(); - // Auto-generate walls around floor tiles GenerateAutoWalls(layout); - // Build tile data for client layout.BuildClientTileData(_tileDefinitions, _defaultSheet); Console.WriteLine($"[DungeonGenV2] Generation complete: {rooms.Count} rooms, {layout.TileDetails.Count} visual tiles, {layout.TileMapSheets.Count} sheets"); @@ -354,10 +363,8 @@ public class DungeonGeneratorV2 Console.WriteLine($"[DungeonGenV2] Loaded templates for tier {_tier}: Entrance={_entranceTemplates.Count}, Exit={_exitTemplates.Count}, Boss={_bossTemplates.Count}, Treasure={_treasureTemplates.Count}, Normal={_normalTemplates.Count}, Hallway={_hallwayTemplates.Count}"); - // Start clean each generation. _tileDefinitions = new Dictionary(); - // 1) Pull tile IDs referenced by templates (if any) var templateTileIds = templates .Where(t => !string.IsNullOrEmpty(t.TileDataJson)) .SelectMany(t => @@ -385,7 +392,6 @@ public class DungeonGeneratorV2 foreach (var tile in templateTiles) _tileDefinitions[tile.Id] = tile; - // Pick a sheet for rendering defaults if we got one from template tiles _defaultSheet = templateTiles.FirstOrDefault()?.TileMapSheet; Console.WriteLine($"[DungeonGenV2] Loaded {templateTiles.Count} tile definitions referenced by templates"); @@ -395,7 +401,6 @@ public class DungeonGeneratorV2 Console.WriteLine($"[DungeonGenV2] No template tile references found (templates may be disabled or missing TileDataJson)"); } - // 2) Always load a default sheet for fallback generation (and merge its tiles) if (_defaultSheet == null) { _defaultSheet = await _db.TileMapSheets @@ -410,8 +415,8 @@ public class DungeonGeneratorV2 { foreach (var tile in _defaultSheet.Tiles) { - tile.TileMapSheet = _defaultSheet; // ensure nav prop set for client data building - _tileDefinitions[tile.Id] = tile; // merge/overwrite if already present + tile.TileMapSheet = _defaultSheet; + _tileDefinitions[tile.Id] = tile; } Console.WriteLine($"[DungeonGenV2] Loaded {_defaultSheet.Tiles.Count} tiles from default sheet '{_defaultSheet.Name}'"); @@ -419,7 +424,6 @@ public class DungeonGeneratorV2 Console.WriteLine($"[DungeonGenV2] Total tile definitions merged: {_tileDefinitions.Count}"); - // 3) ALWAYS build indexes/caches after all tiles are merged if (_tileDefinitions.Count > 0) { _tagIndex = new TileTagIndex(_tileDefinitions.Values); @@ -435,29 +439,260 @@ public class DungeonGeneratorV2 ); Console.WriteLine($"[DungeonGenV2] Built tag caches: tileTags={_tileTags.Count} socketTypes={_tileSocketTypes.Count}"); + + // ========================================================================= + // BUILD COLUMN-BASED SOCKET CACHE + // ========================================================================= + _tileSocketsStrict = _tileDefinitions.Values.ToDictionary( + t => t.Id, + t => new TileSocketInfo + { + N = t.SocketN, + E = t.SocketE, + S = t.SocketS, + W = t.SocketW, + NCustom = t.SocketNCustom, + ECustom = t.SocketECustom, + SCustom = t.SocketSCustom, + WCustom = t.SocketWCustom + } + ); + + Console.WriteLine($"[DungeonGenV2] Built strict socket cache for {_tileSocketsStrict.Count} tiles"); + + // Log socket distribution + var openCount = _tileSocketsStrict.Values.Count(s => s.IsAllOpen); + var closedCount = _tileSocketsStrict.Values.Count(s => s.IsAllClosed); + var mixedCount = _tileSocketsStrict.Count - openCount - closedCount; + Console.WriteLine($"[DungeonGenV2] Socket distribution: AllOpen={openCount}, AllClosed={closedCount}, Mixed={mixedCount}"); + + // Determine if we should use strict sockets + // Use strict if we have tiles with non-default socket configurations + _useStrictSockets = openCount > 0 || mixedCount > 0; + Console.WriteLine($"[DungeonGenV2] Using strict socket matching: {_useStrictSockets}"); + + // Validate floor tile configuration + if (_useStrictSockets) + { + ValidateTileSocketConfiguration(); + } } else { _tagIndex = null; _tileTags = new Dictionary>(); _tileSocketTypes = new Dictionary>>(); + _tileSocketsStrict = new Dictionary(); + _useStrictSockets = false; Console.WriteLine($"[DungeonGenV2] WARNING: No tile definitions available; tag index/caches not built."); } + ChooseDungeonFamilyFromSheet(); } + + // ========================================================================= + // STRICT SOCKET MATCHING METHODS (Column-based) + // ========================================================================= + + /// + /// Get socket ID for a tile edge using column-based system + /// + private string GetSocketIdStrict(int tileId, string edge) + { + if (!_tileSocketsStrict.TryGetValue(tileId, out var sockets)) + return "Closed"; // Unknown tile = Closed + + return sockets.GetSocketId(edge); + } + + /// + /// Check if two tile edges are compatible using strict column-based matching + /// + private bool AreSocketsCompatibleStrict(int tileAId, string edgeA, int tileBId, string edgeB) + { + var socketA = GetSocketIdStrict(tileAId, edgeA); + var socketB = GetSocketIdStrict(tileBId, edgeB); + + // STRICT: Must match exactly + return socketA.Equals(socketB, StringComparison.OrdinalIgnoreCase); + } + + /// + /// Check if a tile is compatible with all placed neighbors using strict matching + /// + private bool IsCompatibleWithNeighborsStrict(DungeonLayoutV2 layout, int x, int y, int tileId) + { + // Check North neighbor (their S edge vs our N edge) + if (y > 0 && layout.IsWalkable(x, y - 1)) + { + int neighborId = layout.Tiles[x, y - 1]; + if (!AreSocketsCompatibleStrict(tileId, "N", neighborId, "S")) + return false; + } + + // Check South neighbor (their N edge vs our S edge) + if (y < layout.Height - 1 && layout.IsWalkable(x, y + 1)) + { + int neighborId = layout.Tiles[x, y + 1]; + if (!AreSocketsCompatibleStrict(tileId, "S", neighborId, "N")) + return false; + } + + // Check West neighbor (their E edge vs our W edge) + if (x > 0 && layout.IsWalkable(x - 1, y)) + { + int neighborId = layout.Tiles[x - 1, y]; + if (!AreSocketsCompatibleStrict(tileId, "W", neighborId, "E")) + return false; + } + + // Check East neighbor (their W edge vs our E edge) + if (x < layout.Width - 1 && layout.IsWalkable(x + 1, y)) + { + int neighborId = layout.Tiles[x + 1, y]; + if (!AreSocketsCompatibleStrict(tileId, "E", neighborId, "W")) + return false; + } + + return true; + } + + /// + /// Build required socket types from neighbors using strict matching + /// + private Dictionary GetRequiredSocketsStrict(DungeonLayoutV2 layout, int x, int y) + { + var required = new Dictionary(StringComparer.OrdinalIgnoreCase); + + // North neighbor's S edge determines our N requirement + if (y > 0 && layout.IsWalkable(x, y - 1)) + { + required["N"] = GetSocketIdStrict(layout.Tiles[x, y - 1], "S"); + } + + // South neighbor's N edge determines our S requirement + if (y < layout.Height - 1 && layout.IsWalkable(x, y + 1)) + { + required["S"] = GetSocketIdStrict(layout.Tiles[x, y + 1], "N"); + } + + // West neighbor's E edge determines our W requirement + if (x > 0 && layout.IsWalkable(x - 1, y)) + { + required["W"] = GetSocketIdStrict(layout.Tiles[x - 1, y], "E"); + } + + // East neighbor's W edge determines our E requirement + if (x < layout.Width - 1 && layout.IsWalkable(x + 1, y)) + { + required["E"] = GetSocketIdStrict(layout.Tiles[x + 1, y], "W"); + } + + return required; + } + + /// + /// Check if a tile satisfies strict socket requirements + /// + private bool SatisfiesSocketRequirementsStrict(int tileId, Dictionary required) + { + foreach (var (edge, reqSocket) in required) + { + var tileSocket = GetSocketIdStrict(tileId, edge); + if (!tileSocket.Equals(reqSocket, StringComparison.OrdinalIgnoreCase)) + return false; + } + return true; + } + + /// + /// Pick a random floor tile using strict socket matching + /// + private TileDefinition? PickRandomFloorTileStrict( + DungeonLayoutV2 layout, + int x, int y, + int familyId, + double varianceChance = 0.25) + { + var required = GetRequiredSocketsStrict(layout, x, y); + + string primaryTag = $"TileBaseCore_{familyId}"; + string varianceTag = $"TileBase_{familyId}"; + + var primary = _tileDefinitions.Values + .Where(t => t.Type == TileType.Floor) + .Where(t => HasTag(t, primaryTag)) + .Where(t => SatisfiesSocketRequirementsStrict(t.Id, required)) + .ToList(); + + var variance = _tileDefinitions.Values + .Where(t => t.Type == TileType.Floor) + .Where(t => HasTag(t, varianceTag)) + .Where(t => SatisfiesSocketRequirementsStrict(t.Id, required)) + .ToList(); + + if (primary.Count == 0 && variance.Count == 0) + { + if (required.Count > 0) + { + Console.WriteLine($"[Socket] No compatible tile at ({x},{y}) - Required: {string.Join(", ", required.Select(kv => $"{kv.Key}={kv.Value}"))}"); + } + return null; + } + + bool pickVariance = _rng.NextDouble() < varianceChance; + var pool = pickVariance ? variance : primary; + if (pool.Count == 0) pool = pickVariance ? primary : variance; + + return pool[_rng.Next(pool.Count)]; + } + + /// + /// Validate tile socket configuration on startup + /// + private void ValidateTileSocketConfiguration() + { + var floors = _tileDefinitions.Values.Where(t => t.Type == TileType.Floor).ToList(); + + int allOpenCount = 0; + int allClosedCount = 0; + int mixedCount = 0; + + foreach (var tile in floors) + { + if (!_tileSocketsStrict.TryGetValue(tile.Id, out var sockets)) + { + Console.WriteLine($"[Socket] WARNING: Floor tile {tile.Id} '{tile.Name}' has no socket info!"); + continue; + } + + if (sockets.IsAllOpen) allOpenCount++; + else if (sockets.IsAllClosed) allClosedCount++; + else mixedCount++; + + if (sockets.IsAllClosed) + { + Console.WriteLine($"[Socket] WARNING: Floor tile {tile.Id} '{tile.Name}' has ALL Closed sockets - cannot connect!"); + } + } + + Console.WriteLine($"[Socket] Floor tile validation: {allOpenCount} all-open, {allClosedCount} all-closed, {mixedCount} mixed"); + + if (allOpenCount == 0) + { + Console.WriteLine($"[Socket] WARNING: No floor tiles with Open sockets - dungeon generation may fail!"); + } + } private RoomType DetermineNextRoomType(List existing, int targetCount) { - // Ensure we have at least one of certain types bool hasBoss = existing.Any(r => r.Type == RoomType.Boss); bool hasTreasure = existing.Any(r => r.Type == RoomType.Treasure); - // If near the end and no boss, force boss if (!hasBoss && existing.Count >= targetCount - 2) return RoomType.Boss; - // Weighted random selection int roll = _rng.Next(100); if (roll < 5 && !hasBoss) return RoomType.Boss; @@ -469,7 +704,6 @@ public class DungeonGeneratorV2 private async Task PlaceRoomAsync(DungeonLayoutV2 layout, List existing, RoomType type, int preferX, int preferY) { - // Get templates for this type var templates = type switch { RoomType.Entrance => _entranceTemplates, @@ -478,20 +712,17 @@ public class DungeonGeneratorV2 _ => _normalTemplates }; - // If no templates, use fallback generation if (templates.Count == 0) { return PlaceFallbackRoom(layout, existing, type, preferX, preferY); } - // Weighted random selection var template = SelectWeightedTemplate(templates); if (template == null) { return PlaceFallbackRoom(layout, existing, type, preferX, preferY); } - // Try to place at preferred position int x = Math.Clamp(preferX - template.Width / 2, 2, MapWidth - template.Width - 2); int y = Math.Clamp(preferY - template.Height / 2, 2, MapHeight - template.Height - 2); @@ -503,10 +734,8 @@ public class DungeonGeneratorV2 TemplateTags = ParseTags(template.Tags) }; - // Check overlap if (existing.Any(r => room.Intersects(r, padding: 3))) { - // Try random position for (int attempt = 0; attempt < 10; attempt++) { x = _rng.Next(2, MapWidth - template.Width - 2); @@ -527,7 +756,6 @@ public class DungeonGeneratorV2 return null; } - // Place tiles from template if (!string.IsNullOrEmpty(template.TileDataJson)) { try @@ -544,10 +772,8 @@ public class DungeonGeneratorV2 { layout.Tiles[worldX, worldY] = p.TileDefinitionId; - // Look up tile definition for sheet info and walkability var tileDef = _tileDefinitions.GetValueOrDefault(p.TileDefinitionId); - // Set walkability based on tile definition if (layout.Walkable != null && tileDef != null) { layout.Walkable[worldX, worldY] = tileDef.IsWalkable; @@ -569,10 +795,9 @@ public class DungeonGeneratorV2 } } } - catch { /* Invalid JSON, fall through to basic carve */ } + catch { } } - // Parse connection points from template if (!string.IsNullOrEmpty(template.ConnectionPointsJson)) { try @@ -583,22 +808,16 @@ public class DungeonGeneratorV2 room.ConnectionPoints = connections; } } - catch { /* Invalid JSON */ } + catch { } } - // If no connection points defined, create default ones on each edge - // These are positioned AT the room edge (not inside) if (room.ConnectionPoints.Count == 0) { room.ConnectionPoints = new List { - // North: center of top edge, Y=0 is top of room new() { X = room.Width / 2, Y = 0, Direction = "north", Width = 3 }, - // South: center of bottom edge new() { X = room.Width / 2, Y = room.Height - 1, Direction = "south", Width = 3 }, - // West: center of left edge new() { X = 0, Y = room.Height / 2, Direction = "west", Width = 3 }, - // East: center of right edge new() { X = room.Width - 1, Y = room.Height / 2, Direction = "east", Width = 3 } }; Console.WriteLine($"[DungeonGenV2] Created default connection points for room at ({x},{y})"); @@ -612,7 +831,6 @@ public class DungeonGeneratorV2 } } - // If no tiles were placed, do basic carve if (!layout.TileDetails.Any(t => t.X >= x && t.X < x + room.Width && t.Y >= y && t.Y < y + room.Height)) { CarveBasicRoom(layout, room); @@ -632,7 +850,6 @@ public class DungeonGeneratorV2 if (existing.Any(r => room.Intersects(r, padding: 3))) { - // Try random positions for (int attempt = 0; attempt < 20; attempt++) { x = _rng.Next(2, MapWidth - w - 2); @@ -654,156 +871,89 @@ public class DungeonGeneratorV2 private void CarveBasicRoom(DungeonLayoutV2 layout, DungeonRoomV2 room) { - // Toggle this if you want to silence per-cell spam quickly. - const bool VerboseFloorLogging = true; + const bool VerboseFloorLogging = false; // Set to true for detailed debugging - // 1) Decide which TileBase family to use for this room. int familyId = _activeFamilyId; - Console.WriteLine($"[DungeonGenV2][Floors] CarveBasicRoom START room=({room.X},{room.Y}) size=({room.Width}x{room.Height}) familyId={familyId} tags=[{string.Join(",", room.TemplateTags ?? new HashSet())}]"); + if (VerboseFloorLogging) + Console.WriteLine($"[DungeonGenV2][Floors] CarveBasicRoom START room=({room.X},{room.Y}) size=({room.Width}x{room.Height}) familyId={familyId} useStrict={_useStrictSockets}"); - // 2) Choose a primary tile for the room (varianceChance=0 => strongly prefers core tiles). - // NOTE: This does NOT mean every tile will be the same; it's just a "material anchor". - TileDefinition? roomPrimary = PickRandomFloorTile(layout, room.X, room.Y, familyId, varianceChance: 0.0); + TileDefinition? roomPrimary = _useStrictSockets + ? PickRandomFloorTileStrict(layout, room.X, room.Y, familyId, varianceChance: 0.0) + : PickRandomFloorTile(layout, room.X, room.Y, familyId, varianceChance: 0.0); - if (roomPrimary != null) + if (VerboseFloorLogging && roomPrimary != null) { - Console.WriteLine($"[DungeonGenV2][Floors] roomPrimary chosen id={roomPrimary.Id} name='{roomPrimary.Name}' sheet={roomPrimary.TileMapSheetId} frame={roomPrimary.FrameIndex} tags='{roomPrimary.Tags ?? ""}'"); - } - else - { - Console.WriteLine($"[DungeonGenV2][Floors] roomPrimary chosen = null (will rely on per-cell picking)"); + Console.WriteLine($"[DungeonGenV2][Floors] roomPrimary chosen id={roomPrimary.Id} name='{roomPrimary.Name}'"); } int placedCount = 0; - int primaryCount = 0; - int varianceCount = 0; - int perCellPickCount = 0; - int primaryRejectedBySockets = 0; - int fallbackAnyFloorCount = 0; - int forcedVariancePickNullCount = 0; - int cellPickNullCount = 0; for (int x = room.X; x < room.X + room.Width; x++) { for (int y = room.Y; y < room.Y + room.Height; y++) { if (x < 0 || x >= MapWidth || y < 0 || y >= MapHeight) - { - if (VerboseFloorLogging) - Console.WriteLine($"[DungeonGenV2][Floors] skip OOB ({x},{y})"); continue; - } - // Always carve as walkable space. if (layout.Walkable != null) layout.Walkable[x, y] = true; - // Remove any previous visuals at this location layout.TileDetails.RemoveAll(t => t.X == x && t.Y == y); - // Log neighborhood + required sockets (N/W scan-order) - var req = BuildRequiredSocketTags(layout, x, y); - if (VerboseFloorLogging) - { - int nId = (y > 0) ? layout.Tiles[x, y - 1] : -999; - int wId = (x > 0) ? layout.Tiles[x - 1, y] : -999; - - string nInfo = (y > 0 && _tileDefinitions.TryGetValue(nId, out var nd)) - ? $"N=({x},{y - 1}) id={nId} '{nd.Name}' walk={layout.IsWalkable(x, y - 1)}" - : $"N=({x},{y - 1}) id={nId} walk={(y > 0 ? layout.IsWalkable(x, y - 1) : false)}"; - - string wInfo = (x > 0 && _tileDefinitions.TryGetValue(wId, out var wd)) - ? $"W=({x - 1},{y}) id={wId} '{wd.Name}' walk={layout.IsWalkable(x - 1, y)}" - : $"W=({x - 1},{y}) id={wId} walk={(x > 0 ? layout.IsWalkable(x - 1, y) : false)}"; - - Console.WriteLine($"[DungeonGenV2][Floors] cell=({x},{y}) reqSockets=[{string.Join(",", req)}] {nInfo} {wInfo}"); - } - TileDefinition? chosen = null; - bool usedPrimary = false; - bool usedVariance = false; - // 3) 85% primary, 15% variance, constrained by required sockets. - // Important: The old behavior that "only uses one tile" happens if: - // - roomPrimary always fits and variance never succeeds (or isn't present) - // - or varianceChance logic never triggers/always returns same candidate list - // We'll log every decision so you can see why. - - bool primaryFits = roomPrimary != null && SatisfiesSocketRequirements(layout, x, y, roomPrimary); - - if (roomPrimary != null && !primaryFits) - primaryRejectedBySockets++; - - // Roll for variance (we roll first, then attempt primary/variance accordingly) - double roll = _rng.NextDouble(); - bool wantVariance = roll < 0.25; - - if (VerboseFloorLogging) - Console.WriteLine($"[DungeonGenV2][Floors] cell=({x},{y}) roll={roll:0.000} wantVariance={wantVariance} primaryFits={primaryFits}"); - - if (primaryFits) + if (_useStrictSockets) { - // If we want variance, try to pick variance; if that fails, use primary. - if (wantVariance) + // Use strict socket matching + var required = GetRequiredSocketsStrict(layout, x, y); + bool primaryFits = roomPrimary != null && SatisfiesSocketRequirementsStrict(roomPrimary.Id, required); + + double roll = _rng.NextDouble(); + bool wantVariance = roll < 0.25; + + if (primaryFits && !wantVariance) { - chosen = PickRandomFloorTile(layout, x, y, familyId, varianceChance: 1.0); // force variance pool - if (chosen == null) - { - forcedVariancePickNullCount++; - if (VerboseFloorLogging) - Console.WriteLine($"[DungeonGenV2][Floors] cell=({x},{y}) forced variance returned NULL -> using roomPrimary"); - chosen = roomPrimary; - usedPrimary = true; - } - else - { - usedVariance = true; - if (VerboseFloorLogging) - Console.WriteLine($"[DungeonGenV2][Floors] cell=({x},{y}) picked VARIANCE id={chosen.Id} '{chosen.Name}' tags='{chosen.Tags ?? ""}'"); - } + chosen = roomPrimary; } else { - chosen = roomPrimary; - usedPrimary = true; - if (VerboseFloorLogging) - Console.WriteLine($"[DungeonGenV2][Floors] cell=({x},{y}) used PRIMARY id={chosen.Id} '{chosen.Name}'"); + chosen = PickRandomFloorTileStrict(layout, x, y, familyId, wantVariance ? 1.0 : 0.25); + if (chosen == null && primaryFits) + chosen = roomPrimary; } } else { - // Primary doesn't fit or doesn't exist: do full per-cell pick (85/15 inside the picker) - chosen = PickRandomFloorTile(layout, x, y, familyId, varianceChance: 0.25); - perCellPickCount++; + // Use legacy tag-based socket matching + bool primaryFits = roomPrimary != null && SatisfiesSocketRequirements(layout, x, y, roomPrimary); + + double roll = _rng.NextDouble(); + bool wantVariance = roll < 0.25; - if (chosen == null) + if (primaryFits) { - cellPickNullCount++; - if (VerboseFloorLogging) - Console.WriteLine($"[DungeonGenV2][Floors] cell=({x},{y}) per-cell pick returned NULL"); + if (wantVariance) + { + chosen = PickRandomFloorTile(layout, x, y, familyId, varianceChance: 1.0); + if (chosen == null) + chosen = roomPrimary; + } + else + { + chosen = roomPrimary; + } } else { - // classify - if (_tileTags.TryGetValue(chosen.Id, out var tags)) - { - if (tags.Contains($"TileBaseCore_{familyId}")) usedPrimary = true; - else if (tags.Contains($"TileBase_{familyId}")) usedVariance = true; - } - - if (VerboseFloorLogging) - Console.WriteLine($"[DungeonGenV2][Floors] cell=({x},{y}) per-cell picked id={chosen.Id} '{chosen.Name}' tags='{chosen.Tags ?? ""}'"); + chosen = PickRandomFloorTile(layout, x, y, familyId, varianceChance: 0.25); } } - // Hard fallback: any floor + // Hard fallback if (chosen == null) { - fallbackAnyFloorCount++; chosen = _tileDefinitions.Values.FirstOrDefault(t => t.Type == TileType.Floor); - if (VerboseFloorLogging) - Console.WriteLine($"[DungeonGenV2][Floors] cell=({x},{y}) HARD FALLBACK any-floor => {(chosen != null ? $"{chosen.Id} '{chosen.Name}'" : "NULL")}"); } int floorId = chosen?.Id ?? -1; @@ -821,30 +971,16 @@ public class DungeonGeneratorV2 Layer = 0 }); placedCount++; - - if (usedPrimary) primaryCount++; - if (usedVariance) varianceCount++; - } - - if (VerboseFloorLogging && chosen != null) - { - Console.WriteLine($"[DungeonGenV2][Floors] cell=({x},{y}) FINAL id={chosen.Id} '{chosen.Name}' primary={usedPrimary} variance={usedVariance}"); } } } - Console.WriteLine($"[DungeonGenV2][Floors] CarveBasicRoom END placed={placedCount} primary={primaryCount} variance={varianceCount} perCellPick={perCellPickCount} primaryRejectedBySockets={primaryRejectedBySockets} forcedVarNull={forcedVariancePickNullCount} perCellNull={cellPickNullCount} hardFallbackAnyFloor={fallbackAnyFloorCount}"); + if (VerboseFloorLogging) + Console.WriteLine($"[DungeonGenV2][Floors] CarveBasicRoom END placed={placedCount}"); - // Repair pass logs (you can also add verbosity inside RepairRoomFloorSockets if needed) - Console.WriteLine($"[DungeonGenV2][Floors] RepairRoomFloorSockets START room=({room.X},{room.Y}) size=({room.Width}x{room.Height})"); RepairRoomFloorSockets(layout, room); - Console.WriteLine($"[DungeonGenV2][Floors] RepairRoomFloorSockets END room=({room.X},{room.Y})"); } - /// - /// Returns true if the given tile satisfies the required socket tags derived from already-placed neighbors. - /// This uses the same neighbor logic as PickRandomFloorTile (typically N/W scan order). - /// private bool SatisfiesSocketRequirements(DungeonLayoutV2 layout, int x, int y, TileDefinition candidate) { var required = BuildRequiredSocketTags(layout, x, y); @@ -857,10 +993,6 @@ public class DungeonGeneratorV2 return true; } - /// - /// Second-pass repair: ensures mutual socket compatibility with E/S neighbors too, - /// replacing tiles that don't agree. This makes the result look "locked in" rather than scan-order dependent. - /// private void RepairRoomFloorSockets(DungeonLayoutV2 layout, DungeonRoomV2 room) { int familyId = _activeFamilyId; @@ -879,19 +1011,29 @@ public class DungeonGeneratorV2 if (!_tileDefinitions.TryGetValue(id, out var cur)) continue; - // Build full constraints (N/E/S/W) based on existing neighbors - var required = BuildRequiredSocketTags_AllDirs(layout, x, y); + TileDefinition? replacement = null; + + if (_useStrictSockets) + { + // Use strict socket checking for all 4 directions + if (!IsCompatibleWithNeighborsStrict(layout, x, y, id)) + { + replacement = PickRandomFloorTileStrict(layout, x, y, familyId, varianceChance: 0.25); + } + } + else + { + // Use legacy tag-based checking + var required = BuildRequiredSocketTags_AllDirs(layout, x, y); + if (!HasAllTags(cur, required)) + { + replacement = PickRandomFloorTile_AllDirs(layout, x, y, familyId, varianceChance: 0.25); + } + } - // If current tile already satisfies, keep it. - if (HasAllTags(cur, required)) - continue; - - // Try to find a better fitting tile from the same family - var replacement = PickRandomFloorTile_AllDirs(layout, x, y, familyId, varianceChance: 0.25); if (replacement == null || replacement.Id == cur.Id) continue; - // Apply replacement layout.Tiles[x, y] = replacement.Id; if (layout.Walkable != null) @@ -911,15 +1053,10 @@ public class DungeonGeneratorV2 } } - /// - /// Build required socket tags from ALL directions (N/E/S/W), used for repair. - /// Typed socket tags are respected (SocketN_Lava etc.). - /// private List BuildRequiredSocketTags_AllDirs(DungeonLayoutV2 layout, int x, int y) { var req = new List(); - // North neighbor => our N must match neighbor's S if (y > 0 && layout.IsWalkable(x, y - 1)) { int nid = layout.Tiles[x, y - 1]; @@ -927,7 +1064,6 @@ public class DungeonGeneratorV2 if (r != null) req.Add(r); } - // South neighbor => our S must match neighbor's N if (y < MapHeight - 1 && layout.IsWalkable(x, y + 1)) { int sid = layout.Tiles[x, y + 1]; @@ -935,7 +1071,6 @@ public class DungeonGeneratorV2 if (r != null) req.Add(r); } - // West neighbor => our W must match neighbor's E if (x > 0 && layout.IsWalkable(x - 1, y)) { int wid = layout.Tiles[x - 1, y]; @@ -943,7 +1078,6 @@ public class DungeonGeneratorV2 if (r != null) req.Add(r); } - // East neighbor => our E must match neighbor's W if (x < MapWidth - 1 && layout.IsWalkable(x + 1, y)) { int eid = layout.Tiles[x + 1, y]; @@ -954,9 +1088,6 @@ public class DungeonGeneratorV2 return req; } - /// - /// A stricter picker used by the repair pass: filters candidates using ALL-direction socket constraints. - /// private TileDefinition? PickRandomFloorTile_AllDirs( DungeonLayoutV2 layout, int x, int y, @@ -1017,7 +1148,6 @@ public class DungeonGeneratorV2 private async Task ConnectRoomsAsync(DungeonLayoutV2 layout, DungeonRoomV2 a, DungeonRoomV2 b) { - // Determine tag requirements for this connection. var requiredTags = new HashSet( a.TemplateTags ?? new HashSet(StringComparer.OrdinalIgnoreCase), StringComparer.OrdinalIgnoreCase); @@ -1033,7 +1163,6 @@ public class DungeonGeneratorV2 requiredTags.UnionWith(b.TemplateTags ?? new HashSet(StringComparer.OrdinalIgnoreCase)); } - // Decide best connection directions based on relative positions string aDirection, bDirection; int deltaX = b.CenterX - a.CenterX; int deltaY = b.CenterY - a.CenterY; @@ -1049,7 +1178,6 @@ public class DungeonGeneratorV2 bDirection = deltaY > 0 ? "north" : "south"; } - // Get connection points (or fall back to edge center) var cpA = a.GetConnectionPoint(aDirection); var cpB = b.GetConnectionPoint(bDirection); @@ -1088,10 +1216,11 @@ public class DungeonGeneratorV2 int familyId = _activeFamilyId; - // Pick based on start position (or midpoint - either is fine) - var floorTile = - PickRandomFloorTile(layout, startX, startY, familyId, varianceChance: 0.15) - ?? _tileDefinitions.Values.FirstOrDefault(t => t.Type == TileType.Floor); + var floorTile = _useStrictSockets + ? PickRandomFloorTileStrict(layout, startX, startY, familyId, varianceChance: 0.15) + : PickRandomFloorTile(layout, startX, startY, familyId, varianceChance: 0.15); + + floorTile ??= _tileDefinitions.Values.FirstOrDefault(t => t.Type == TileType.Floor); int floorId = floorTile?.Id ?? 1; int sheetId = floorTile?.TileMapSheetId ?? 0; @@ -1099,32 +1228,25 @@ public class DungeonGeneratorV2 Console.WriteLine($"[DungeonGenV2][Corridors] using floorId={floorId} '{floorTile?.Name}' familyId={familyId} sheet={sheetId} frame={frameIndex}"); - // Clear the connection point area (carve through template walls) - // (Now uses the same chosen floor) if (cpA != null) ClearConnectionPoint(layout, startX, startY, cpA.Width, aDirection, floorId, sheetId, frameIndex); if (cpB != null) ClearConnectionPoint(layout, endX, endY, cpB.Width, bDirection, floorId, sheetId, frameIndex); - // L-shaped corridor from connection point to connection point if (_rng.Next(2) == 0) { - // Horizontal segment var hallH = SelectHallwayTemplate(requiredTags, startX <= endX ? "east" : "west"); if (hallH == null || !TryStampHallwayRun(layout, hallH, startX, startY, endX, startY, floorId, sheetId, frameIndex)) CarveHorizontalCorridor(layout, startX, endX, startY, floorId, sheetId, frameIndex, corridorWidth); - // Vertical segment var hallV = SelectHallwayTemplate(requiredTags, startY <= endY ? "south" : "north"); if (hallV == null || !TryStampHallwayRun(layout, hallV, endX, startY, endX, endY, floorId, sheetId, frameIndex)) CarveVerticalCorridor(layout, startY, endY, endX, floorId, sheetId, frameIndex, corridorWidth); } else { - // Vertical segment var hallV = SelectHallwayTemplate(requiredTags, startY <= endY ? "south" : "north"); if (hallV == null || !TryStampHallwayRun(layout, hallV, startX, startY, startX, endY, floorId, sheetId, frameIndex)) CarveVerticalCorridor(layout, startY, endY, startX, floorId, sheetId, frameIndex, corridorWidth); - // Horizontal segment var hallH = SelectHallwayTemplate(requiredTags, startX <= endX ? "east" : "west"); if (hallH == null || !TryStampHallwayRun(layout, hallH, startX, endY, endX, endY, floorId, sheetId, frameIndex)) CarveHorizontalCorridor(layout, startX, endX, endY, floorId, sheetId, frameIndex, corridorWidth); @@ -1132,20 +1254,14 @@ public class DungeonGeneratorV2 } - /// - /// Clear tiles at a connection point to allow corridor entry - /// This aggressively clears walls in both directions to ensure passage - /// private void ClearConnectionPoint(DungeonLayoutV2 layout, int x, int y, int width, string direction, int floorId, int sheetId, int frameIndex) { - int depth = 5; // How far to clear in each direction + int depth = 5; int halfWidth = Math.Max(width, 2); Console.WriteLine($"[DungeonGenV2] Clearing connection at ({x},{y}) direction={direction} width={width}"); int clearedCount = 0; - // Clear in a cross/plus pattern centered on the connection point - // This ensures we punch through walls regardless of direction for (int d = -depth; d <= depth; d++) { for (int w = -halfWidth; w <= halfWidth; w++) @@ -1156,14 +1272,12 @@ public class DungeonGeneratorV2 { case "north": case "south": - // Vertical corridor - d goes vertical, w goes horizontal cx = x + w; cy = y + d; break; case "east": case "west": default: - // Horizontal corridor - d goes horizontal, w goes vertical cx = x + d; cy = y + w; break; @@ -1171,21 +1285,17 @@ public class DungeonGeneratorV2 if (cx >= 0 && cx < MapWidth && cy >= 0 && cy < MapHeight) { - // Track if we're actually changing something bool hadTile = layout.Tiles[cx, cy] != 0; bool wasBlocked = layout.Walkable != null && !layout.Walkable[cx, cy]; - // Remove existing tile visuals layout.TileDetails.RemoveAll(t => t.X == cx && t.Y == cy); - // Set as walkable floor layout.Tiles[cx, cy] = floorId; if (layout.Walkable != null) { layout.Walkable[cx, cy] = true; } - // Add floor tile visual if (floorId > 0 && sheetId > 0) { layout.TileDetails.Add(new PlacedTile @@ -1217,14 +1327,12 @@ public class DungeonGeneratorV2 { for (int dy = 0; dy < width; dy++) { - int ty = y + dy - width / 2; // Center the corridor + int ty = y + dy - width / 2; if (x >= 0 && x < MapWidth && ty >= 0 && ty < MapHeight && !layout.IsWalkable(x, ty)) { - // Remove any existing visual (walls, void decorations, etc.) layout.TileDetails.RemoveAll(t => t.X == x && t.Y == ty); layout.Tiles[x, ty] = floorId; - // Set walkability for corridors if (layout.Walkable != null) { layout.Walkable[x, ty] = true; @@ -1256,14 +1364,12 @@ public class DungeonGeneratorV2 { for (int dx = 0; dx < width; dx++) { - int tx = x + dx - width / 2; // Center the corridor + int tx = x + dx - width / 2; if (tx >= 0 && tx < MapWidth && y >= 0 && y < MapHeight && !layout.IsWalkable(tx, y)) { - // Remove any existing visual (walls, void decorations, etc.) layout.TileDetails.RemoveAll(t => t.X == tx && t.Y == y); layout.Tiles[tx, y] = floorId; - // Set walkability for corridors if (layout.Walkable != null) { layout.Walkable[tx, y] = true; @@ -1286,12 +1392,8 @@ public class DungeonGeneratorV2 } } - /// - /// Automatically generate wall tiles around floor tiles that border void - /// private void GenerateAutoWalls(DungeonLayoutV2 layout) { - // Find wall tiles for each direction var wallTiles = _tileDefinitions.Values.Where(t => t.Type == TileType.Wall).ToList(); if (wallTiles.Count == 0) { @@ -1300,14 +1402,7 @@ public class DungeonGeneratorV2 } Console.WriteLine($"[DungeonGenV2] Found {wallTiles.Count} wall tiles for auto-wall generation"); - foreach (var wt in wallTiles) - { - Console.WriteLine($" - {wt.Id}: {wt.Name} (tags: {wt.Tags ?? "none"})"); - } - // Helper to match tags. - // NOTE: Some of your data has tags separated by commas *and/or* whitespace (e.g. "corner_nw void"), - // so we split on both to be resilient. bool HasTag(TileDefinition t, string tag) { if (string.IsNullOrWhiteSpace(t.Tags)) return false; @@ -1316,14 +1411,11 @@ public class DungeonGeneratorV2 .Any(s => s.Equals(tag, StringComparison.OrdinalIgnoreCase)); } - // Try to find directional walls by tags, fall back to first wall var wallNorth = wallTiles.FirstOrDefault(t => HasTag(t, "north")) ?? wallTiles[0]; var wallSouth = wallTiles.FirstOrDefault(t => HasTag(t, "south")) ?? wallTiles[0]; var wallEast = wallTiles.FirstOrDefault(t => HasTag(t, "east")) ?? wallTiles[0]; var wallWest = wallTiles.FirstOrDefault(t => HasTag(t, "west")) ?? wallTiles[0]; - // Corner tiles: - // - corner_* indicates which *quadrant of the tile contains the wall mass* (tile itself lives in void space) - // - many sets also include "void"-tagged corner variants meant specifically for outside/diagonal void corners. + var wallCornerNE = wallTiles.FirstOrDefault(t => HasTag(t, "corner_ne") && !HasTag(t, "void")) ?? wallTiles.FirstOrDefault(t => HasTag(t, "corner_ne")) ?? wallTiles[0]; @@ -1337,7 +1429,6 @@ public class DungeonGeneratorV2 ?? wallTiles.FirstOrDefault(t => HasTag(t, "corner_sw")) ?? wallTiles[0]; - // Prefer these when a corner tile borders void on TWO orthogonal sides (classic outside corner). var wallCornerNEVoid = wallTiles.FirstOrDefault(t => HasTag(t, "corner_ne") && HasTag(t, "void")); var wallCornerNWVoid = wallTiles.FirstOrDefault(t => HasTag(t, "corner_nw") && HasTag(t, "void")); var wallCornerSEVoid = wallTiles.FirstOrDefault(t => HasTag(t, "corner_se") && HasTag(t, "void")); @@ -1345,7 +1436,6 @@ public class DungeonGeneratorV2 TileDefinition PickCorner(string cornerTag, bool preferVoid) { - // cornerTag is one of: corner_ne, corner_nw, corner_se, corner_sw return cornerTag.ToLowerInvariant() switch { "corner_ne" => (preferVoid ? wallCornerNEVoid : null) ?? wallCornerNE, @@ -1358,41 +1448,41 @@ public class DungeonGeneratorV2 Console.WriteLine($"[DungeonGenV2] Wall tile mapping: N={wallNorth.Id}, S={wallSouth.Id}, E={wallEast.Id}, W={wallWest.Id}"); - // Track positions that need walls var wallPositions = new List<(int X, int Y, TileDefinition Tile)>(); - // Check each void tile to see if it borders a floor + bool IsWallAt(int wx, int wy) + { + if (wx < 0 || wx >= MapWidth || wy < 0 || wy >= MapHeight) return false; + int tid = layout.Tiles[wx, wy]; + if (tid == 0) return false; + return _tileDefinitions.TryGetValue(tid, out var td) && td.Type == TileType.Wall; + } + + bool IsOutsideAt(int wx, int wy) + { + if (wx < 0 || wx >= MapWidth || wy < 0 || wy >= MapHeight) return true; + if (layout.IsWalkable(wx, wy)) return false; + return !IsWallAt(wx, wy); + } + for (int x = 0; x < MapWidth; x++) { for (int y = 0; y < MapHeight; y++) { - // Skip if not void if (layout.Tiles[x, y] != 0) continue; - // Check neighbors for floor tiles (walkable) bool hasFloorNorth = y > 0 && layout.IsWalkable(x, y - 1); bool hasFloorSouth = y < MapHeight - 1 && layout.IsWalkable(x, y + 1); bool hasFloorEast = x < MapWidth - 1 && layout.IsWalkable(x + 1, y); bool hasFloorWest = x > 0 && layout.IsWalkable(x - 1, y); - // If any adjacent tile is floor, this should be a wall if (hasFloorNorth || hasFloorSouth || hasFloorEast || hasFloorWest) { - // Determine wall type based on which direction has floor TileDefinition wallTile; - // Check for corners first. - // IMPORTANT: corner_* tags indicate the quadrant where the *wall mass* lives inside this tile. - // That quadrant matches the direction of the interior (walkable) corner. - // Example: if the interior is to the NW (diagonal floor at NW), use corner_nw. - // If this is an *outside* corner (the two orthogonal sides away from the interior are void), - // prefer a corner variant that includes the "void" tag. bool outsideN = IsOutsideAt(x, y - 1); - bool outsideS = IsOutsideAt(x, y + 1); - bool outsideE = IsOutsideAt(x + 1, y); - bool outsideW = IsOutsideAt(x - 1, y); if (hasFloorNorth && hasFloorWest) @@ -1404,7 +1494,7 @@ public class DungeonGeneratorV2 else if (hasFloorSouth && hasFloorEast) wallTile = PickCorner("corner_se", preferVoid: (outsideN && outsideW)); else if (hasFloorSouth) - wallTile = wallNorth; // Wall is north of floor, so it's a north-facing wall + wallTile = wallNorth; else if (hasFloorNorth) wallTile = wallSouth; else if (hasFloorEast) @@ -1417,12 +1507,10 @@ public class DungeonGeneratorV2 } } - // Place wall tiles foreach (var (x, y, tile) in wallPositions) { layout.Tiles[x, y] = tile.Id; - // Walls are not walkable if (layout.Walkable != null) { layout.Walkable[x, y] = false; @@ -1435,11 +1523,10 @@ public class DungeonGeneratorV2 TileDefinitionId = tile.Id, SheetId = tile.TileMapSheetId, FrameIndex = tile.FrameIndex, - Layer = 2 // Walls on layer 2 + Layer = 2 }); } - // Index existing wall visuals so we can update/replace them without duplicating TileDetails entries. var wallDetailIndex = new Dictionary<(int X, int Y), int>(); for (int i = 0; i < layout.TileDetails.Count; i++) { @@ -1448,27 +1535,6 @@ public class DungeonGeneratorV2 wallDetailIndex[(d.X, d.Y)] = i; } - // Void-corner fill pass: when corridors/walls are thicker, some corner "caps" end up as void tiles that - // only see walkable space diagonally. Fill those with the appropriate connected corner wall so we don't - // get little void bite-marks at corridor turns and room borders. - bool IsWallAt(int wx, int wy) - { - if (wx < 0 || wx >= MapWidth || wy < 0 || wy >= MapHeight) return false; - int tid = layout.Tiles[wx, wy]; - if (tid == 0) return false; - return _tileDefinitions.TryGetValue(tid, out var td) && td.Type == TileType.Wall; - } - - - bool IsOutsideAt(int wx, int wy) - { - // "Outside"/"void" in your terminology: a tile that is NOT walkable and NOT a wall. - // This prevents treating floor as "void" while still recognizing unfilled space. - if (wx < 0 || wx >= MapWidth || wy < 0 || wy >= MapHeight) return true; // out of bounds counts as outside - if (layout.IsWalkable(wx, wy)) return false; - return !IsWallAt(wx, wy); - } - void PlaceWall(int wx, int wy, TileDefinition tdef) { layout.Tiles[wx, wy] = tdef.Id; @@ -1501,8 +1567,7 @@ public class DungeonGeneratorV2 { for (int y = 1; y < MapHeight - 1; y++) { - if (layout.Tiles[x, y] != 0) continue; // only fill void - // Don't overwrite walkable tiles (shouldn't happen because walkable implies non-zero, but safe). + if (layout.Tiles[x, y] != 0) continue; if (layout.IsWalkable(x, y)) continue; bool floorNE = layout.IsWalkable(x + 1, y - 1); @@ -1515,18 +1580,9 @@ public class DungeonGeneratorV2 bool wallE = IsWallAt(x + 1, y); bool wallW = IsWallAt(x - 1, y); - // Only fill if there's "supporting" wall structure nearby; prevents random diagonal filling. - // The diagonal walkable indicates the interior corner; the adjacent walls indicate we are on the border. - // Diagonal-walkable indicates the interior corner. Choose the corner wall variant that visually - // connects the two bordering wall runs (this tileset uses the opposite naming compared to the - // earlier assumption, so NW<->SE and NE<->SW). - // Outside-void corners: if the two orthogonal tiles away from the interior are void, prefer "void" corner variants. bool vN = IsOutsideAt(x, y - 1); - bool vS = IsOutsideAt(x, y + 1); - bool vE = IsOutsideAt(x + 1, y); - bool vW = IsOutsideAt(x - 1, y); if (floorSE && (wallS || wallE)) PlaceWall(x, y, PickCorner("corner_se", preferVoid: (vN && vW))); @@ -1536,12 +1592,6 @@ public class DungeonGeneratorV2 } } - // Corner fix-up pass: if a wall tile meets void on the outside but is adjacent to walkable - // only diagonally (common with thicker walls / multi-tile corridors), swap in the connected - // corner tile so the silhouette doesn't look "broken". - // - // Example: a boundary wall tile that is NW of a floor tile might not see floor South/East - // directly (those may be other wall tiles), but it *will* see floor at SE diagonally. for (int x = 1; x < MapWidth - 1; x++) { for (int y = 1; y < MapHeight - 1; y++) @@ -1563,13 +1613,9 @@ public class DungeonGeneratorV2 TileDefinition? replace = null; - // Choose connected outer corners using diagonal floor hints. bool vN2 = IsOutsideAt(x, y - 1); - bool vS2 = IsOutsideAt(x, y + 1); - bool vE2 = IsOutsideAt(x + 1, y); - bool vW2 = IsOutsideAt(x - 1, y); if (floorSE && !floorS && !floorE) replace = PickCorner("corner_se", preferVoid: (vN2 && vW2)); @@ -1583,7 +1629,6 @@ public class DungeonGeneratorV2 layout.Tiles[x, y] = replace.Id; if (layout.Walkable != null) layout.Walkable[x, y] = false; - // Update existing wall visual if present; otherwise add. if (wallDetailIndex.TryGetValue((x, y), out var idx)) { var d = layout.TileDetails[idx]; @@ -1642,7 +1687,6 @@ public class DungeonGeneratorV2 { if (room.Type == RoomType.Entrance) continue; - // Mob spawns int mobCount = room.Type switch { RoomType.Boss => 1, @@ -1665,7 +1709,6 @@ public class DungeonGeneratorV2 }); } - // Chest spawns int chestCount = room.Type switch { RoomType.Treasure => _rng.Next(2, 4), @@ -1692,9 +1735,9 @@ public class DungeonGeneratorV2 layout.TotalMobs = layout.MobSpawns.Count; layout.TotalChests = layout.ChestSpawns.Count; } + private static Dictionary> ParseSocketTypes(HashSet tags) { - // dir -> set of types; "" means untyped var map = new Dictionary>(StringComparer.OrdinalIgnoreCase) { ["N"] = new HashSet(StringComparer.OrdinalIgnoreCase), @@ -1708,11 +1751,6 @@ public class DungeonGeneratorV2 if (!t.StartsWith("Socket", StringComparison.OrdinalIgnoreCase)) continue; - // Support: - // SocketE - // SocketE=OuterBorder - // SocketE_OuterBorder - // SocketE:OuterBorder var cleaned = t.Replace(":", "=", StringComparison.Ordinal); string left = cleaned; @@ -1726,7 +1764,6 @@ public class DungeonGeneratorV2 } else { - // underscore typed form var parts = cleaned.Split('_', 2, StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); if (parts.Length == 2) { @@ -1735,13 +1772,11 @@ public class DungeonGeneratorV2 } } - // left is "SocketN" / "SocketE" if (left.Length < "Socket".Length + 1) continue; - var dir = left.Substring("Socket".Length); // "N" "E" "S" "W" + var dir = left.Substring("Socket".Length); if (!(dir is "N" or "E" or "S" or "W")) continue; - // untyped stored as "" map[dir].Add(string.IsNullOrWhiteSpace(type) ? "" : type); } @@ -1777,11 +1812,9 @@ public class DungeonGeneratorV2 if (primary.Count == 0 && variance.Count == 0) { - // If we require typed sockets and can't satisfy them, DO NOT relax. if (requiresTyped) return null; - // Otherwise, relax only the socket-tag requirement but keep compatibility. primary = _tileDefinitions.Values .Where(t => t.Type == TileType.Floor) .Where(t => HasTag(t, primaryTag)) @@ -1808,7 +1841,6 @@ public class DungeonGeneratorV2 private bool CompatibleWithPlacedNeighbors(DungeonLayoutV2 layout, int x, int y, TileDefinition t) { - // North neighbor if (y > 0 && layout.IsWalkable(x, y - 1)) { int nId = layout.Tiles[x, y - 1]; @@ -1816,7 +1848,6 @@ public class DungeonGeneratorV2 return false; } - // West neighbor if (x > 0 && layout.IsWalkable(x - 1, y)) { int wId = layout.Tiles[x - 1, y]; @@ -1838,11 +1869,9 @@ public class DungeonGeneratorV2 private bool NeighborRequiresTyped(int neighborTileId, string neighborDir) { - // neighborDir is the edge on the neighbor facing us (e.g. neighbor's "S" if it is north of us) if (!_tileSocketTypes.TryGetValue(neighborTileId, out var sockets)) return false; if (!sockets.TryGetValue(neighborDir, out var types)) return false; - // typed if it has any non-empty type return types.Any(t => !string.IsNullOrEmpty(t)); } @@ -1851,23 +1880,20 @@ public class DungeonGeneratorV2 if (!_tileSocketTypes.TryGetValue(neighborTileId, out var sockets)) return null; if (!sockets.TryGetValue(neighborEdgeFacingUs, out var types)) return null; - // If neighbor supports typed types on that edge, require a matching typed socket var typed = types.FirstOrDefault(t => !string.IsNullOrEmpty(t)); if (!string.IsNullOrEmpty(typed)) return $"Socket{ourDir}={typed}"; - // Otherwise require untyped if (types.Contains("")) return $"Socket{ourDir}"; - // neighbor has no socket facing us => no requirement (or treat as mismatch) return null; } + private List BuildRequiredSocketTags(DungeonLayoutV2 layout, int x, int y) { var req = new List(); - // North neighbor => our N must match neighbor's S if (y > 0 && layout.IsWalkable(x, y - 1)) { int nid = layout.Tiles[x, y - 1]; @@ -1875,7 +1901,6 @@ public class DungeonGeneratorV2 if (r != null) req.Add(r); } - // West neighbor => our W must match neighbor's E if (x > 0 && layout.IsWalkable(x - 1, y)) { int wid = layout.Tiles[x - 1, y]; @@ -1885,6 +1910,7 @@ public class DungeonGeneratorV2 return req; } + private bool HasAllTags(TileDefinition t, IEnumerable required) { if (!_tileTags.TryGetValue(t.Id, out var tags)) return false; @@ -1892,6 +1918,7 @@ public class DungeonGeneratorV2 if (!tags.Contains(r)) return false; return true; } + private bool HasTag(int tileId, string tag) => _tileTags.TryGetValue(tileId, out var tags) && tags.Contains(tag); @@ -1920,7 +1947,6 @@ public class DungeonGeneratorV2 foreach (var tag in tags) { - // TileBaseCore_2 if (tag.StartsWith("TileBaseCore_", StringComparison.OrdinalIgnoreCase) && int.TryParse(tag.Substring("TileBaseCore_".Length), out var fam)) { @@ -1932,77 +1958,38 @@ public class DungeonGeneratorV2 _activeFamilyId = families.Count > 0 ? families.ElementAt(_rng.Next(families.Count)) : 1; Console.WriteLine($"[DungeonGenV2] Chosen dungeon tile familyId={_activeFamilyId}"); } - //private bool EdgeSocketsCompatible(int aId, string aEdge, int bId, string bEdge) - //{ - // _tileSocketTypes.TryGetValue(aId, out var aMap); - // _tileSocketTypes.TryGetValue(bId, out var bMap); - // aMap ??= new Dictionary>(); - // bMap ??= new Dictionary>(); - - // aMap.TryGetValue(aEdge, out var aTypes); - // bMap.TryGetValue(bEdge, out var bTypes); - - // aTypes ??= new HashSet(); - // bTypes ??= new HashSet(); - - // bool aHas = aTypes.Count > 0; - // bool bHas = bTypes.Count > 0; - - // if (!aHas && !bHas) return true; // neither cares - // if (aHas != bHas) return false; // one cares, other doesn't - - // // both have sockets - // bool aTyped = aTypes.Any(t => !string.IsNullOrEmpty(t)); - // bool bTyped = bTypes.Any(t => !string.IsNullOrEmpty(t)); - - // if (!aTyped && !bTyped) - // return true; // both untyped - - // var aTypedSet = aTypes - // .Where(t => !string.IsNullOrEmpty(t)) - // .ToHashSet(StringComparer.OrdinalIgnoreCase); - - // var bTypedSet = bTypes - // .Where(t => !string.IsNullOrEmpty(t)) - // .ToHashSet(StringComparer.OrdinalIgnoreCase); - - // return aTypedSet.Overlaps(bTypedSet); - //} private bool EdgeSocketsCompatible(int aId, string aEdge, int bId, string bEdge) { - if (!_tileSocketTypes.TryGetValue(aId, out var aMap)) return true; // no sockets at all? treat as open? + // If using strict column-based sockets, delegate to that + if (_useStrictSockets) + { + return AreSocketsCompatibleStrict(aId, aEdge, bId, bEdge); + } + + // Legacy tag-based socket compatibility + if (!_tileSocketTypes.TryGetValue(aId, out var aMap)) return true; if (!_tileSocketTypes.TryGetValue(bId, out var bMap)) return true; - // Get socket types for each edge (default to empty if missing) aMap.TryGetValue(aEdge, out var aTypes); bMap.TryGetValue(bEdge, out var bTypes); aTypes ??= new HashSet(); bTypes ??= new HashSet(); - // If either side has no declared socket on this edge - treat as closed - bool aMissing = aTypes.Count == 0 && !aMap.ContainsKey(aEdge); // truly missing key + bool aMissing = aTypes.Count == 0 && !aMap.ContainsKey(aEdge); bool bMissing = bTypes.Count == 0 && !bMap.ContainsKey(bEdge); - // But if they explicitly have "Closed", it's typed bool aClosed = aTypes.Contains("Closed"); bool bClosed = bTypes.Contains("Closed"); - // Case 1: Both explicitly closed - compatible (shared wall seam) if (aClosed && bClosed) return true; - - // Case 2: One closed, one not - incompatible if (aClosed || bClosed) return false; - - // Case 3: One or both missing (no socket declared) - treat as closed if (aMissing || bMissing) return false; - // Case 4: Both have sockets (possibly untyped or typed) bool aTyped = aTypes.Any(t => !string.IsNullOrEmpty(t) && t != "Closed"); bool bTyped = bTypes.Any(t => !string.IsNullOrEmpty(t) && t != "Closed"); - // If either is typed, require matching type if (aTyped || bTyped) { var aTypedSet = aTypes.Where(t => !string.IsNullOrEmpty(t) && t != "Closed").ToHashSet(StringComparer.OrdinalIgnoreCase); @@ -2010,66 +1997,6 @@ public class DungeonGeneratorV2 return aTypedSet.Overlaps(bTypedSet); } - // Both untyped - always compatible return true; } } - -/// -/// Extended room with template info -/// -public class DungeonRoomV2 : DungeonRoom -{ - public int? TemplateId { get; set; } - public string? TemplateName { get; set; } - public HashSet TemplateTags { get; set; } = new(StringComparer.OrdinalIgnoreCase); - public new RoomType Type { get; set; } = RoomType.Normal; - - /// Connection points parsed from template - public List ConnectionPoints { get; set; } = new(); - - public DungeonRoomV2(int x, int y, int width, int height) : base(x, y, width, height) { } - - /// Get the best connection point for a given direction - public ConnectionPoint? GetConnectionPoint(string direction) - { - // First try exact match - var exact = ConnectionPoints.FirstOrDefault(c => c.Direction.Equals(direction, StringComparison.OrdinalIgnoreCase)); - if (exact != null) return exact; - - // No exact match - create a default one for this direction rather than using wrong direction - // This ensures the connection point is actually on the correct edge - return direction.ToLower() switch - { - "north" => new ConnectionPoint { X = Width / 2, Y = 0, Direction = "north", Width = 3 }, - "south" => new ConnectionPoint { X = Width / 2, Y = Height - 1, Direction = "south", Width = 3 }, - "east" => new ConnectionPoint { X = Width - 1, Y = Height / 2, Direction = "east", Width = 3 }, - "west" => new ConnectionPoint { X = 0, Y = Height / 2, Direction = "west", Width = 3 }, - _ => ConnectionPoints.FirstOrDefault() // Last resort fallback - }; - } - - /// Get world position of a connection point - public (int X, int Y) GetConnectionWorldPos(ConnectionPoint cp) - { - return (X + cp.X, Y + cp.Y); - } - -} - - -/// -/// Placed tile with details -/// -public class PlacedTile -{ - public int X { get; set; } - public int Y { get; set; } - public int TileDefinitionId { get; set; } - public int SheetId { get; set; } // For client rendering - public int FrameIndex { get; set; } // Frame in the sheet - public int Layer { get; set; } - public int Rotation { get; set; } - public bool FlipX { get; set; } - public bool FlipY { get; set; } -} diff --git a/Game/Dungeon/DungeonLayoutV2.cs b/Game/Dungeon/DungeonLayoutV2.cs index 3468896..2b437e2 100644 --- a/Game/Dungeon/DungeonLayoutV2.cs +++ b/Game/Dungeon/DungeonLayoutV2.cs @@ -172,17 +172,4 @@ public class DungeonLayoutV2 : DungeonLayout } } -/// -/// Tilemap sheet info for client -/// -public class TileMapSheetInfo -{ - public int Id { get; set; } - public string CdnPath { get; set; } = ""; - public int TileWidth { get; set; } - public int TileHeight { get; set; } - public int SheetWidth { get; set; } - public int SheetHeight { get; set; } - public int Columns { get; set; } - public int Rows { get; set; } -} + diff --git a/Game/Dungeon/DungeonRoomV2.cs b/Game/Dungeon/DungeonRoomV2.cs new file mode 100644 index 0000000..a1de26f --- /dev/null +++ b/Game/Dungeon/DungeonRoomV2.cs @@ -0,0 +1,48 @@ +using DataServer.Data.Entities; +using Server.Game.Dungeon; + +namespace Server.Game.Dungeon +{ + /// + /// Extended room with template info + /// + public class DungeonRoomV2 : DungeonRoom + { + public int? TemplateId { get; set; } + public string? TemplateName { get; set; } + public HashSet TemplateTags { get; set; } = new(StringComparer.OrdinalIgnoreCase); + public new RoomType Type { get; set; } = RoomType.Normal; + + /// Connection points parsed from template + public List ConnectionPoints { get; set; } = new(); + + public DungeonRoomV2(int x, int y, int width, int height) : base(x, y, width, height) { } + + /// Get the best connection point for a given direction + public ConnectionPoint? GetConnectionPoint(string direction) + { + // First try exact match + var exact = ConnectionPoints.FirstOrDefault(c => c.Direction.Equals(direction, StringComparison.OrdinalIgnoreCase)); + if (exact != null) return exact; + + // No exact match - create a default one for this direction rather than using wrong direction + // This ensures the connection point is actually on the correct edge + return direction.ToLower() switch + { + "north" => new ConnectionPoint { X = Width / 2, Y = 0, Direction = "north", Width = 3 }, + "south" => new ConnectionPoint { X = Width / 2, Y = Height - 1, Direction = "south", Width = 3 }, + "east" => new ConnectionPoint { X = Width - 1, Y = Height / 2, Direction = "east", Width = 3 }, + "west" => new ConnectionPoint { X = 0, Y = Height / 2, Direction = "west", Width = 3 }, + _ => ConnectionPoints.FirstOrDefault() // Last resort fallback + }; + } + + /// Get world position of a connection point + public (int X, int Y) GetConnectionWorldPos(ConnectionPoint cp) + { + return (X + cp.X, Y + cp.Y); + } + + } + +} diff --git a/Game/Dungeon/PlacedTile.cs b/Game/Dungeon/PlacedTile.cs new file mode 100644 index 0000000..505f027 --- /dev/null +++ b/Game/Dungeon/PlacedTile.cs @@ -0,0 +1,18 @@ +namespace Server.Game.Dungeon +{ + /// + /// Placed tile with details + /// + public class PlacedTile + { + public int X { get; set; } + public int Y { get; set; } + public int TileDefinitionId { get; set; } + public int SheetId { get; set; } // For client rendering + public int FrameIndex { get; set; } // Frame in the sheet + public int Layer { get; set; } + public int Rotation { get; set; } + public bool FlipX { get; set; } + public bool FlipY { get; set; } + } +} diff --git a/Game/Dungeon/TileMapSheetInfo.cs b/Game/Dungeon/TileMapSheetInfo.cs new file mode 100644 index 0000000..abf6889 --- /dev/null +++ b/Game/Dungeon/TileMapSheetInfo.cs @@ -0,0 +1,17 @@ +namespace Server.Game.Dungeon +{ + /// + /// Tilemap sheet info for client + /// + public class TileMapSheetInfo + { + public int Id { get; set; } + public string CdnPath { get; set; } = ""; + public int TileWidth { get; set; } + public int TileHeight { get; set; } + public int SheetWidth { get; set; } + public int SheetHeight { get; set; } + public int Columns { get; set; } + public int Rows { get; set; } + } +} diff --git a/Migrations/20260101221446_TileChanges.Designer.cs b/Migrations/20260101221446_TileChanges.Designer.cs new file mode 100644 index 0000000..8bdd80b --- /dev/null +++ b/Migrations/20260101221446_TileChanges.Designer.cs @@ -0,0 +1,2580 @@ +// +using System; +using DataServer.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace SystemRevivalServer.Migrations +{ + [DbContext(typeof(GameDbContext))] + [Migration("20260101221446_TileChanges")] + partial class TileChanges + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + + modelBuilder.Entity("DataServer.Data.Account", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BannedUntil") + .HasColumnType("datetime(6)"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("datetime(6)") + .HasDefaultValueSql("CURRENT_TIMESTAMP(6)"); + + b.Property("Email") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("IsBanned") + .HasColumnType("tinyint(1)"); + + b.Property("PasswordHash") + .IsRequired() + .HasColumnType("varbinary(64)"); + + b.Property("PasswordSalt") + .IsRequired() + .HasColumnType("varbinary(32)"); + + b.Property("Role") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("UpdatedAt") + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("datetime(6)") + .HasDefaultValueSql("CURRENT_TIMESTAMP(6)"); + + MySqlPropertyBuilderExtensions.UseMySqlComputedColumn(b.Property("UpdatedAt")); + + b.Property("Username") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.HasKey("Id"); + + b.HasIndex("Email") + .IsUnique(); + + b.HasIndex("Username") + .IsUnique(); + + b.ToTable("accounts", (string)null); + }); + + modelBuilder.Entity("DataServer.Data.Entities.ClientAsset", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AssetType") + .HasColumnType("int"); + + b.Property("CdnPath") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("FileHash") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("FilePath") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("IsRequired") + .HasColumnType("tinyint(1)"); + + b.Property("MinClientVersion") + .HasMaxLength(16) + .HasColumnType("varchar(16)"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("client_assets"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DamageResistanceType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Color") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("varchar(16)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("IconPath") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Key") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("SortOrder") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("damage_resistance_types"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DeathChest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("DungeonInstanceId") + .HasColumnType("char(36)"); + + b.Property("EmptiedAt") + .HasColumnType("datetime(6)"); + + b.Property("GoldAmount") + .HasColumnType("bigint"); + + b.Property("IsEmpty") + .HasColumnType("tinyint(1)"); + + b.Property("OwnerCharacterId") + .HasColumnType("bigint unsigned"); + + b.Property("VictimCharacterId") + .HasColumnType("bigint unsigned"); + + b.Property("VictimMobDefinitionId") + .HasColumnType("int"); + + b.Property("X") + .HasColumnType("float"); + + b.Property("Y") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.HasIndex("OwnerCharacterId"); + + b.HasIndex("VictimCharacterId"); + + b.ToTable("dungeon_death_chests"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DeathChestItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("DeathChestId") + .HasColumnType("bigint unsigned"); + + b.Property("IsTaken") + .HasColumnType("tinyint(1)"); + + b.Property("ItemDefinitionId") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("SlotIndex") + .HasColumnType("int"); + + b.Property("TakenAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("DeathChestId"); + + b.HasIndex("ItemDefinitionId"); + + b.ToTable("dungeon_death_chest_items"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonBeltItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CharacterId") + .HasColumnType("bigint unsigned"); + + b.Property("InventorySlotIndex") + .HasColumnType("int"); + + b.Property("SlotIndex") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CharacterId"); + + b.ToTable("dungeon_belt_items"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacter", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint unsigned"); + + b.Property("BossesKilled") + .HasColumnType("int"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CurrentHealth") + .HasColumnType("int"); + + b.Property("CurrentMana") + .HasColumnType("int"); + + b.Property("Dexterity") + .HasColumnType("int"); + + b.Property("DungeonsCompleted") + .HasColumnType("int"); + + b.Property("Endurance") + .HasColumnType("int"); + + b.Property("EquippedAccessory") + .HasColumnType("bigint unsigned"); + + b.Property("EquippedBoots") + .HasColumnType("bigint unsigned"); + + b.Property("EquippedChest") + .HasColumnType("bigint unsigned"); + + b.Property("EquippedGloves") + .HasColumnType("bigint unsigned"); + + b.Property("EquippedHead") + .HasColumnType("bigint unsigned"); + + b.Property("EquippedLegs") + .HasColumnType("bigint unsigned"); + + b.Property("EquippedOffhand") + .HasColumnType("bigint unsigned"); + + b.Property("EquippedWeapon") + .HasColumnType("bigint unsigned"); + + b.Property("Experience") + .HasColumnType("bigint"); + + b.Property("Gold") + .HasColumnType("bigint"); + + b.Property("Intelligence") + .HasColumnType("int"); + + b.Property("IsDeleted") + .HasColumnType("tinyint(1)"); + + b.Property("LastPlayedAt") + .HasColumnType("datetime(6)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("PlayersKilled") + .HasColumnType("int"); + + b.Property("ResistancesJson") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("Strength") + .HasColumnType("int"); + + b.Property("TotalDeaths") + .HasColumnType("int"); + + b.Property("TotalKills") + .HasColumnType("int"); + + b.Property("UnspentStatPoints") + .HasColumnType("int"); + + b.Property("Wisdom") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("AccountId"); + + b.ToTable("dungeon_characters"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacterCraftingSkill", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CharacterId") + .HasColumnType("bigint unsigned"); + + b.Property("Experience") + .HasColumnType("bigint"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("SkillType") + .HasColumnType("int"); + + b.Property("TotalItemsCrafted") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CharacterId"); + + b.ToTable("dungeon_character_crafting_skills"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacterItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AcquiredAt") + .HasColumnType("datetime(6)"); + + b.Property("CharacterId") + .HasColumnType("bigint unsigned"); + + b.Property("EquipSlot") + .HasColumnType("int"); + + b.Property("IsEquipped") + .HasColumnType("tinyint(1)"); + + b.Property("ItemDefinitionId") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("SlotIndex") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CharacterId"); + + b.HasIndex("ItemDefinitionId"); + + b.ToTable("dungeon_character_items"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacterItemCraftedLink", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CharacterItemId") + .HasColumnType("bigint unsigned"); + + b.Property("CraftedItemId") + .HasColumnType("bigint unsigned"); + + b.HasKey("Id"); + + b.HasIndex("CharacterItemId"); + + b.HasIndex("CraftedItemId"); + + b.ToTable("dungeon_character_item_crafted_link"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacterKnownRecipe", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CharacterId") + .HasColumnType("bigint unsigned"); + + b.Property("DiscoveredAt") + .HasColumnType("datetime(6)"); + + b.Property("RecipeId") + .HasColumnType("int"); + + b.Property("TimesCrafted") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CharacterId"); + + b.HasIndex("RecipeId"); + + b.ToTable("dungeon_character_known_recipes"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCraftedItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BaseItemDefinitionId") + .HasColumnType("int"); + + b.Property("CraftedAt") + .HasColumnType("datetime(6)"); + + b.Property("CrafterId") + .HasColumnType("bigint unsigned"); + + b.Property("CrafterName") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("CraftingLevelAtCreation") + .HasColumnType("int"); + + b.Property("CustomName") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("QualityRating") + .HasColumnType("int"); + + b.Property("RecipeId") + .HasColumnType("int"); + + b.Property("RollHistoryJson") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("RolledBonusArmor") + .HasColumnType("int"); + + b.Property("RolledBonusDexterity") + .HasColumnType("int"); + + b.Property("RolledBonusEndurance") + .HasColumnType("int"); + + b.Property("RolledBonusHealAmount") + .HasColumnType("int"); + + b.Property("RolledBonusHealth") + .HasColumnType("int"); + + b.Property("RolledBonusIntelligence") + .HasColumnType("int"); + + b.Property("RolledBonusMagicResist") + .HasColumnType("int"); + + b.Property("RolledBonusMana") + .HasColumnType("int"); + + b.Property("RolledBonusManaRestore") + .HasColumnType("int"); + + b.Property("RolledBonusMaxDamage") + .HasColumnType("int"); + + b.Property("RolledBonusMinDamage") + .HasColumnType("int"); + + b.Property("RolledBonusStrength") + .HasColumnType("int"); + + b.Property("RolledBonusWisdom") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BaseItemDefinitionId"); + + b.HasIndex("CrafterId"); + + b.HasIndex("RecipeId"); + + b.ToTable("dungeon_crafted_items"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCraftingRecipe", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BaseXp") + .HasColumnType("int"); + + b.Property("BonusOutputChanceAtMinLevel") + .HasColumnType("float"); + + b.Property("BonusOutputItemDefinitionId") + .HasColumnType("int"); + + b.Property("BonusOutputMaxLevel") + .HasColumnType("int"); + + b.Property("BonusOutputMinLevel") + .HasColumnType("int"); + + b.Property("BonusOutputQuantity") + .HasColumnType("int"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("HasStatRolls") + .HasColumnType("tinyint(1)"); + + b.Property("IsBaseRecipe") + .HasColumnType("tinyint(1)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("OutputItemDefinitionId") + .HasColumnType("int"); + + b.Property("OutputQuantity") + .HasColumnType("int"); + + b.Property("PossibleStatsJson") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("RequiredLevel") + .HasColumnType("int"); + + b.Property("SkillType") + .HasColumnType("int"); + + b.Property("Tier") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("OutputItemDefinitionId"); + + b.ToTable("dungeon_crafting_recipes"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCraftingRecipeIngredient", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ItemDefinitionId") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("RecipeId") + .HasColumnType("int"); + + b.Property("SlotOrder") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ItemDefinitionId"); + + b.HasIndex("RecipeId"); + + b.ToTable("dungeon_crafting_recipe_ingredients"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonItemDefinition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Armor") + .HasColumnType("int"); + + b.Property("AttackRange") + .HasColumnType("float"); + + b.Property("BonusDexterity") + .HasColumnType("int"); + + b.Property("BonusEndurance") + .HasColumnType("int"); + + b.Property("BonusHealth") + .HasColumnType("int"); + + b.Property("BonusIntelligence") + .HasColumnType("int"); + + b.Property("BonusMana") + .HasColumnType("int"); + + b.Property("BonusStrength") + .HasColumnType("int"); + + b.Property("BonusWisdom") + .HasColumnType("int"); + + b.Property("BuffDuration") + .HasColumnType("int"); + + b.Property("BuffResistancesJson") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("DamageTypeKey") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EquipSlot") + .HasColumnType("int"); + + b.Property("HealAmount") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("IsTeleportScroll") + .HasColumnType("tinyint(1)"); + + b.Property("ManaRestore") + .HasColumnType("int"); + + b.Property("MaxArmor") + .HasColumnType("int"); + + b.Property("MaxBonusDexterity") + .HasColumnType("int"); + + b.Property("MaxBonusEndurance") + .HasColumnType("int"); + + b.Property("MaxBonusHealth") + .HasColumnType("int"); + + b.Property("MaxBonusIntelligence") + .HasColumnType("int"); + + b.Property("MaxBonusMana") + .HasColumnType("int"); + + b.Property("MaxBonusStrength") + .HasColumnType("int"); + + b.Property("MaxBonusWisdom") + .HasColumnType("int"); + + b.Property("MaxDamage") + .HasColumnType("int"); + + b.Property("MaxMaxDamage") + .HasColumnType("int"); + + b.Property("MaxMinDamage") + .HasColumnType("int"); + + b.Property("MaxStack") + .HasColumnType("int"); + + b.Property("MinArmor") + .HasColumnType("int"); + + b.Property("MinBonusDexterity") + .HasColumnType("int"); + + b.Property("MinBonusEndurance") + .HasColumnType("int"); + + b.Property("MinBonusHealth") + .HasColumnType("int"); + + b.Property("MinBonusIntelligence") + .HasColumnType("int"); + + b.Property("MinBonusMana") + .HasColumnType("int"); + + b.Property("MinBonusStrength") + .HasColumnType("int"); + + b.Property("MinBonusWisdom") + .HasColumnType("int"); + + b.Property("MinDamage") + .HasColumnType("int"); + + b.Property("MinMaxDamage") + .HasColumnType("int"); + + b.Property("MinMinDamage") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Rarity") + .HasColumnType("int"); + + b.Property("RequiredDexterity") + .HasColumnType("int"); + + b.Property("RequiredIntelligence") + .HasColumnType("int"); + + b.Property("RequiredLevel") + .HasColumnType("int"); + + b.Property("RequiredStrength") + .HasColumnType("int"); + + b.Property("RequiredWisdom") + .HasColumnType("int"); + + b.Property("ResistancesJson") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("SpriteId") + .HasColumnType("int"); + + b.Property("SpritePath") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("Stackable") + .HasColumnType("tinyint(1)"); + + b.Property("StaminaRestore") + .HasColumnType("int"); + + b.Property("TeachesSpellId") + .HasColumnType("int"); + + b.Property("TintColor") + .HasMaxLength(16) + .HasColumnType("varchar(16)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("dungeon_item_definitions"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonLearnedSpell", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CharacterId") + .HasColumnType("bigint unsigned"); + + b.Property("DefinitionId") + .HasColumnType("int"); + + b.Property("LearnedAt") + .HasColumnType("datetime(6)"); + + b.Property("SpellDefinitionId") + .HasColumnType("int"); + + b.Property("SpellLevel") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CharacterId"); + + b.HasIndex("DefinitionId"); + + b.ToTable("dungeon_learned_spells"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonLootTable", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("DropChanceMultiplier") + .HasColumnType("float"); + + b.Property("GuaranteedDrop") + .HasColumnType("tinyint(1)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("MaxDrops") + .HasColumnType("int"); + + b.Property("MaxTier") + .HasColumnType("int"); + + b.Property("MinDrops") + .HasColumnType("int"); + + b.Property("MinTier") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.HasKey("Id"); + + b.ToTable("dungeon_loot_tables"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonLootTableEntry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("DropChance") + .HasColumnType("float"); + + b.Property("DropChancePerTier") + .HasColumnType("float"); + + b.Property("Guaranteed") + .HasColumnType("tinyint(1)"); + + b.Property("ItemDefinitionId") + .HasColumnType("int"); + + b.Property("LootTableId") + .HasColumnType("int"); + + b.Property("MaxDropChance") + .HasColumnType("float"); + + b.Property("MaxQuantity") + .HasColumnType("int"); + + b.Property("MinQuantity") + .HasColumnType("int"); + + b.Property("Weight") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ItemDefinitionId"); + + b.HasIndex("LootTableId"); + + b.ToTable("dungeon_loot_table_entries"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonMobDefinition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AggroRange") + .HasColumnType("float"); + + b.Property("AnimationSpeed") + .HasColumnType("float"); + + b.Property("ArmorPerTier") + .HasColumnType("float"); + + b.Property("AttackRange") + .HasColumnType("float"); + + b.Property("AttackSpeed") + .HasColumnType("float"); + + b.Property("BaseArmor") + .HasColumnType("int"); + + b.Property("BaseHealth") + .HasColumnType("int"); + + b.Property("BaseMagicDamage") + .HasColumnType("int"); + + b.Property("BaseMagicResist") + .HasColumnType("int"); + + b.Property("BaseMana") + .HasColumnType("int"); + + b.Property("BasePhysicalDamage") + .HasColumnType("int"); + + b.Property("BaseXp") + .HasColumnType("int"); + + b.Property("Behavior") + .HasColumnType("int"); + + b.Property("CallForHelpRadius") + .HasColumnType("float"); + + b.Property("Category") + .HasColumnType("int"); + + b.Property("DamagePerTier") + .HasColumnType("float"); + + b.Property("DamageTypeKey") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("DropChanceMultiplier") + .HasColumnType("float"); + + b.Property("FleeThreshold") + .HasColumnType("float"); + + b.Property("HealthPerTier") + .HasColumnType("float"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LeashRange") + .HasColumnType("float"); + + b.Property("LootTableId") + .HasColumnType("int"); + + b.Property("MaxTier") + .HasColumnType("int"); + + b.Property("MinTier") + .HasColumnType("int"); + + b.Property("MoveSpeed") + .HasColumnType("float"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("PhasesJson") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("PreferredRange") + .HasColumnType("float"); + + b.Property("ResistancesJson") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("Scale") + .HasColumnType("float"); + + b.Property("SpriteConfigJson") + .HasMaxLength(8192) + .HasColumnType("varchar(8192)"); + + b.Property("TintColor") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("varchar(16)"); + + b.Property("Type") + .HasColumnType("int"); + + b.Property("XpPerTier") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.ToTable("dungeon_mob_definitions"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonMobLootTable", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("LootTableId") + .HasColumnType("int"); + + b.Property("MobDefinitionId") + .HasColumnType("int"); + + b.Property("Priority") + .HasColumnType("int"); + + b.Property("RollChance") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.HasIndex("LootTableId"); + + b.HasIndex("MobDefinitionId"); + + b.ToTable("dungeon_mob_loot_tables"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonObjectDefinition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AnimationFps") + .HasColumnType("float"); + + b.Property("AnimationFrameCount") + .HasColumnType("int"); + + b.Property("Biome") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("BlocksLineOfSight") + .HasColumnType("tinyint(1)"); + + b.Property("BlocksMovement") + .HasColumnType("tinyint(1)"); + + b.Property("BlocksProjectiles") + .HasColumnType("tinyint(1)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasMaxLength(512) + .HasColumnType("varchar(512)"); + + b.Property("Health") + .HasColumnType("int"); + + b.Property("Height") + .HasColumnType("int"); + + b.Property("InteractedSpritePath") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("InteractionType") + .HasColumnType("int"); + + b.Property("IsAnimated") + .HasColumnType("tinyint(1)"); + + b.Property("IsDestructible") + .HasColumnType("tinyint(1)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("IsInteractable") + .HasColumnType("tinyint(1)"); + + b.Property("LootTableId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("SpriteId") + .HasColumnType("int"); + + b.Property("SpritePath") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("Tags") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("Type") + .HasColumnType("int"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Width") + .HasColumnType("int"); + + b.Property("ZIndex") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("dungeon_objects"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonPersistence", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BossKilled") + .HasColumnType("tinyint(1)"); + + b.Property("ChestStateJson") + .HasColumnType("json"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatorCharacterId") + .HasColumnType("bigint unsigned"); + + b.Property("CreatorId") + .HasColumnType("bigint unsigned"); + + b.Property("CreatorLevel") + .HasColumnType("int"); + + b.Property("CreatorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsCleared") + .HasColumnType("tinyint(1)"); + + b.Property("LastActivity") + .HasColumnType("datetime(6)"); + + b.Property("LevelBracketMax") + .HasColumnType("int"); + + b.Property("LevelBracketMin") + .HasColumnType("int"); + + b.Property("LootChestStateJson") + .HasColumnType("json"); + + b.Property("MobStateJson") + .HasColumnType("json"); + + b.Property("PersistedAt") + .HasColumnType("datetime(6)"); + + b.Property("Seed") + .HasColumnType("int"); + + b.Property("Tier") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CreatorId"); + + b.ToTable("dungeon_instances"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonRecipeScroll", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ItemDefinitionId") + .HasColumnType("int"); + + b.Property("RecipeId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ItemDefinitionId"); + + b.HasIndex("RecipeId"); + + b.ToTable("dungeon_recipe_scrolls"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonSpellDefinition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AreaOfEffect") + .HasColumnType("float"); + + b.Property("BaseDamage") + .HasColumnType("int"); + + b.Property("BaseHealing") + .HasColumnType("int"); + + b.Property("Cooldown") + .HasColumnType("float"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EffectColor") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("IsShield") + .HasColumnType("tinyint(1)"); + + b.Property("IsTeleport") + .HasColumnType("tinyint(1)"); + + b.Property("ManaCost") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Range") + .HasColumnType("float"); + + b.Property("RequiredIntelligence") + .HasColumnType("int"); + + b.Property("RequiredLevel") + .HasColumnType("int"); + + b.Property("RequiredWisdom") + .HasColumnType("int"); + + b.Property("ShieldAmount") + .HasColumnType("int"); + + b.Property("SpriteId") + .HasColumnType("int"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("dungeon_spell_definitions"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonStashItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CharacterId") + .HasColumnType("bigint unsigned"); + + b.Property("DefinitionId") + .HasColumnType("int"); + + b.Property("ItemDefinitionId") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("SlotIndex") + .HasColumnType("int"); + + b.Property("StoredAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("CharacterId"); + + b.HasIndex("DefinitionId"); + + b.ToTable("dungeon_stash_items"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonTemplate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("DefaultTileMapSheetId") + .HasColumnType("int"); + + b.Property("Description") + .HasMaxLength(512) + .HasColumnType("varchar(512)"); + + b.Property("GenerationParamsJson") + .HasColumnType("json"); + + b.Property("Height") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("IsHandCrafted") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("RoomPlacementsJson") + .HasColumnType("json"); + + b.Property("Tags") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("Tier") + .HasColumnType("int"); + + b.Property("TileDataJson") + .HasColumnType("json"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Width") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DefaultTileMapSheetId"); + + b.ToTable("dungeon_templates"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.MobAbilityAnimationMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AbilityAssignmentId") + .HasColumnType("int"); + + b.Property("AnimationKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("DirectionSuffix") + .HasMaxLength(16) + .HasColumnType("varchar(16)"); + + b.HasKey("Id"); + + b.HasIndex("AbilityAssignmentId"); + + b.ToTable("mob_ability_animation_mappings"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.MobAbilityAssignment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AbilityDefinitionId") + .HasColumnType("int"); + + b.Property("CooldownOverride") + .HasColumnType("float"); + + b.Property("DamageOverride") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("MaxHpPercent") + .HasColumnType("float"); + + b.Property("MinHpPercent") + .HasColumnType("float"); + + b.Property("MobDefinitionId") + .HasColumnType("int"); + + b.Property("Phase") + .HasColumnType("int"); + + b.Property("PriorityOverride") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("AbilityDefinitionId"); + + b.HasIndex("MobDefinitionId"); + + b.ToTable("dungeon_mob_ability_assignments"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.MobAbilityDefinition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AbilityType") + .HasColumnType("int"); + + b.Property("AffectedStat") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("AnimationDuration") + .HasColumnType("float"); + + b.Property("AnimationKey") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("AoeRadius") + .HasColumnType("float"); + + b.Property("BaseDamage") + .HasColumnType("int"); + + b.Property("CastTime") + .HasColumnType("float"); + + b.Property("ConeAngle") + .HasColumnType("float"); + + b.Property("Cooldown") + .HasColumnType("float"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("DamagePerTier") + .HasColumnType("float"); + + b.Property("DamageTypeKey") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("DisplacementDistance") + .HasColumnType("float"); + + b.Property("DotDamagePerTick") + .HasColumnType("int"); + + b.Property("DotTickInterval") + .HasColumnType("float"); + + b.Property("EffectDuration") + .HasColumnType("float"); + + b.Property("HpThresholdAbove") + .HasColumnType("float"); + + b.Property("HpThresholdBelow") + .HasColumnType("float"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Key") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ManaCost") + .HasColumnType("int"); + + b.Property("MinTargetsInRange") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Priority") + .HasColumnType("int"); + + b.Property("ProjectileSpeed") + .HasColumnType("float"); + + b.Property("ProjectileSprite") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("Range") + .HasColumnType("float"); + + b.Property("SoundEffectKey") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("SpeedModifier") + .HasColumnType("float"); + + b.Property("StatModifier") + .HasColumnType("float"); + + b.Property("SummonCount") + .HasColumnType("int"); + + b.Property("SummonMobId") + .HasColumnType("int"); + + b.Property("Targeting") + .HasColumnType("int"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("VisualEffectKey") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.HasKey("Id"); + + b.ToTable("dungeon_mob_abilities"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.MobAnimationAssignment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AnimationDefinitionId") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("MobDefinitionId") + .HasColumnType("int"); + + b.Property("OverrideKey") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Priority") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("AnimationDefinitionId"); + + b.HasIndex("MobDefinitionId"); + + b.ToTable("mob_animation_assignments"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.MobAnimationDefinition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("FlipX") + .HasColumnType("tinyint(1)"); + + b.Property("FlipY") + .HasColumnType("tinyint(1)"); + + b.Property("Fps") + .HasColumnType("float"); + + b.Property("FrameSequence") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Key") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Loop") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("SpriteSheetId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("SpriteSheetId"); + + b.ToTable("mob_animation_definitions"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.MobSpriteSheet", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CdnPath") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("FrameHeight") + .HasColumnType("int"); + + b.Property("FrameWidth") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("SheetHeight") + .HasColumnType("int"); + + b.Property("SheetWidth") + .HasColumnType("int"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.ToTable("mob_sprite_sheets"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.RoomTemplate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ConnectionPointsJson") + .HasColumnType("json"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasMaxLength(512) + .HasColumnType("varchar(512)"); + + b.Property("Height") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("MaxTier") + .HasColumnType("int"); + + b.Property("MinTier") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("SpawnPointsJson") + .HasColumnType("json"); + + b.Property("Tags") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("TileDataJson") + .HasColumnType("json"); + + b.Property("Type") + .HasColumnType("int"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Weight") + .HasColumnType("int"); + + b.Property("Width") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("room_templates"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.TileDefinition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AnimationFps") + .HasColumnType("float"); + + b.Property("AnimationFrameCount") + .HasColumnType("int"); + + b.Property("Biome") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("BlocksLineOfSight") + .HasColumnType("tinyint(1)"); + + b.Property("BlocksProjectiles") + .HasColumnType("tinyint(1)"); + + b.Property("FrameIndex") + .HasColumnType("int"); + + b.Property("IsAnimated") + .HasColumnType("tinyint(1)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("IsWalkable") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("RenderLayer") + .HasColumnType("int"); + + b.Property("SocketE") + .HasColumnType("int"); + + b.Property("SocketECustom") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("SocketN") + .HasColumnType("int"); + + b.Property("SocketNCustom") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("SocketS") + .HasColumnType("int"); + + b.Property("SocketSCustom") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("SocketW") + .HasColumnType("int"); + + b.Property("SocketWCustom") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("Tags") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("TileMapSheetId") + .HasColumnType("int"); + + b.Property("Type") + .HasColumnType("int"); + + b.Property("ZIndex") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TileMapSheetId"); + + b.ToTable("tile_definitions"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.TileMapSheet", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CdnPath") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("SheetHeight") + .HasColumnType("int"); + + b.Property("SheetWidth") + .HasColumnType("int"); + + b.Property("Tags") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("TileHeight") + .HasColumnType("int"); + + b.Property("TileWidth") + .HasColumnType("int"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.ToTable("tilemap_sheets"); + }); + + modelBuilder.Entity("DataServer.Data.Session", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint unsigned"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("datetime(6)") + .HasDefaultValueSql("CURRENT_TIMESTAMP(6)"); + + b.Property("CreatedIp") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ExpiresAt") + .HasColumnType("datetime(6)"); + + b.Property("RevokedAt") + .HasColumnType("datetime(6)"); + + b.Property("TokenHash") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("UserAgent") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("AccountId"); + + b.HasIndex("TokenHash") + .IsUnique(); + + b.ToTable("sessions", (string)null); + }); + + modelBuilder.Entity("DataServer.Data.Zone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("datetime(6)") + .HasDefaultValueSql("CURRENT_TIMESTAMP(6)"); + + b.Property("MaxX") + .HasColumnType("double"); + + b.Property("MaxY") + .HasColumnType("double"); + + b.Property("MaxZ") + .HasColumnType("double"); + + b.Property("MinX") + .HasColumnType("double"); + + b.Property("MinY") + .HasColumnType("double"); + + b.Property("MinZ") + .HasColumnType("double"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("UpdatedAt") + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("datetime(6)") + .HasDefaultValueSql("CURRENT_TIMESTAMP(6)"); + + MySqlPropertyBuilderExtensions.UseMySqlComputedColumn(b.Property("UpdatedAt")); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("zones", (string)null); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DeathChest", b => + { + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "OwnerCharacter") + .WithMany() + .HasForeignKey("OwnerCharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "VictimCharacter") + .WithMany() + .HasForeignKey("VictimCharacterId"); + + b.Navigation("OwnerCharacter"); + + b.Navigation("VictimCharacter"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DeathChestItem", b => + { + b.HasOne("DataServer.Data.Entities.DeathChest", "DeathChest") + .WithMany("Items") + .HasForeignKey("DeathChestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonItemDefinition", "ItemDefinition") + .WithMany() + .HasForeignKey("ItemDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DeathChest"); + + b.Navigation("ItemDefinition"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonBeltItem", b => + { + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "Character") + .WithMany() + .HasForeignKey("CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Character"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacter", b => + { + b.HasOne("DataServer.Data.Account", "Account") + .WithMany("Characters") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Account"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacterCraftingSkill", b => + { + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "Character") + .WithMany("CraftingSkills") + .HasForeignKey("CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Character"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacterItem", b => + { + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "Character") + .WithMany("Inventory") + .HasForeignKey("CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonItemDefinition", "ItemDefinition") + .WithMany() + .HasForeignKey("ItemDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Character"); + + b.Navigation("ItemDefinition"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacterItemCraftedLink", b => + { + b.HasOne("DataServer.Data.Entities.DungeonCharacterItem", "CharacterItem") + .WithMany() + .HasForeignKey("CharacterItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonCraftedItem", "CraftedItem") + .WithMany() + .HasForeignKey("CraftedItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CharacterItem"); + + b.Navigation("CraftedItem"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacterKnownRecipe", b => + { + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "Character") + .WithMany("KnownRecipes") + .HasForeignKey("CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonCraftingRecipe", "Recipe") + .WithMany() + .HasForeignKey("RecipeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Character"); + + b.Navigation("Recipe"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCraftedItem", b => + { + b.HasOne("DataServer.Data.Entities.DungeonItemDefinition", "BaseItemDefinition") + .WithMany() + .HasForeignKey("BaseItemDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "Crafter") + .WithMany() + .HasForeignKey("CrafterId"); + + b.HasOne("DataServer.Data.Entities.DungeonCraftingRecipe", "Recipe") + .WithMany() + .HasForeignKey("RecipeId"); + + b.Navigation("BaseItemDefinition"); + + b.Navigation("Crafter"); + + b.Navigation("Recipe"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCraftingRecipe", b => + { + b.HasOne("DataServer.Data.Entities.DungeonItemDefinition", "OutputItem") + .WithMany() + .HasForeignKey("OutputItemDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("OutputItem"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCraftingRecipeIngredient", b => + { + b.HasOne("DataServer.Data.Entities.DungeonItemDefinition", "ItemDefinition") + .WithMany() + .HasForeignKey("ItemDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonCraftingRecipe", "Recipe") + .WithMany("Ingredients") + .HasForeignKey("RecipeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ItemDefinition"); + + b.Navigation("Recipe"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonLearnedSpell", b => + { + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "Character") + .WithMany("LearnedSpells") + .HasForeignKey("CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonSpellDefinition", "Definition") + .WithMany() + .HasForeignKey("DefinitionId"); + + b.Navigation("Character"); + + b.Navigation("Definition"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonLootTableEntry", b => + { + b.HasOne("DataServer.Data.Entities.DungeonItemDefinition", "ItemDefinition") + .WithMany() + .HasForeignKey("ItemDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonLootTable", "LootTable") + .WithMany("Entries") + .HasForeignKey("LootTableId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ItemDefinition"); + + b.Navigation("LootTable"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonMobLootTable", b => + { + b.HasOne("DataServer.Data.Entities.DungeonLootTable", "LootTable") + .WithMany() + .HasForeignKey("LootTableId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonMobDefinition", "MobDefinition") + .WithMany() + .HasForeignKey("MobDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("LootTable"); + + b.Navigation("MobDefinition"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonPersistence", b => + { + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "Creator") + .WithMany() + .HasForeignKey("CreatorId"); + + b.Navigation("Creator"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonRecipeScroll", b => + { + b.HasOne("DataServer.Data.Entities.DungeonItemDefinition", "ItemDefinition") + .WithMany() + .HasForeignKey("ItemDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonCraftingRecipe", "Recipe") + .WithMany() + .HasForeignKey("RecipeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ItemDefinition"); + + b.Navigation("Recipe"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonStashItem", b => + { + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "Character") + .WithMany("Stash") + .HasForeignKey("CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonItemDefinition", "Definition") + .WithMany() + .HasForeignKey("DefinitionId"); + + b.Navigation("Character"); + + b.Navigation("Definition"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonTemplate", b => + { + b.HasOne("DataServer.Data.Entities.TileMapSheet", "DefaultTileMapSheet") + .WithMany() + .HasForeignKey("DefaultTileMapSheetId"); + + b.Navigation("DefaultTileMapSheet"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.MobAbilityAnimationMapping", b => + { + b.HasOne("DataServer.Data.Entities.MobAbilityAssignment", "AbilityAssignment") + .WithMany() + .HasForeignKey("AbilityAssignmentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("AbilityAssignment"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.MobAbilityAssignment", b => + { + b.HasOne("DataServer.Data.Entities.MobAbilityDefinition", "AbilityDefinition") + .WithMany() + .HasForeignKey("AbilityDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonMobDefinition", "MobDefinition") + .WithMany("AbilityAssignments") + .HasForeignKey("MobDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("AbilityDefinition"); + + b.Navigation("MobDefinition"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.MobAnimationAssignment", b => + { + b.HasOne("DataServer.Data.Entities.MobAnimationDefinition", "AnimationDefinition") + .WithMany() + .HasForeignKey("AnimationDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonMobDefinition", "MobDefinition") + .WithMany() + .HasForeignKey("MobDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("AnimationDefinition"); + + b.Navigation("MobDefinition"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.MobAnimationDefinition", b => + { + b.HasOne("DataServer.Data.Entities.MobSpriteSheet", "SpriteSheet") + .WithMany("Animations") + .HasForeignKey("SpriteSheetId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("SpriteSheet"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.TileDefinition", b => + { + b.HasOne("DataServer.Data.Entities.TileMapSheet", "TileMapSheet") + .WithMany("Tiles") + .HasForeignKey("TileMapSheetId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("TileMapSheet"); + }); + + modelBuilder.Entity("DataServer.Data.Session", b => + { + b.HasOne("DataServer.Data.Account", "Account") + .WithMany("Sessions") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Account"); + }); + + modelBuilder.Entity("DataServer.Data.Account", b => + { + b.Navigation("Characters"); + + b.Navigation("Sessions"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DeathChest", b => + { + b.Navigation("Items"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacter", b => + { + b.Navigation("CraftingSkills"); + + b.Navigation("Inventory"); + + b.Navigation("KnownRecipes"); + + b.Navigation("LearnedSpells"); + + b.Navigation("Stash"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCraftingRecipe", b => + { + b.Navigation("Ingredients"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonLootTable", b => + { + b.Navigation("Entries"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonMobDefinition", b => + { + b.Navigation("AbilityAssignments"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.MobSpriteSheet", b => + { + b.Navigation("Animations"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.TileMapSheet", b => + { + b.Navigation("Tiles"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Migrations/20260101221446_TileChanges.cs b/Migrations/20260101221446_TileChanges.cs new file mode 100644 index 0000000..8126171 --- /dev/null +++ b/Migrations/20260101221446_TileChanges.cs @@ -0,0 +1,110 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace SystemRevivalServer.Migrations +{ + /// + public partial class TileChanges : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "SocketE", + table: "tile_definitions", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddColumn( + name: "SocketECustom", + table: "tile_definitions", + type: "varchar(32)", + maxLength: 32, + nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AddColumn( + name: "SocketN", + table: "tile_definitions", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddColumn( + name: "SocketNCustom", + table: "tile_definitions", + type: "varchar(32)", + maxLength: 32, + nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AddColumn( + name: "SocketS", + table: "tile_definitions", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddColumn( + name: "SocketSCustom", + table: "tile_definitions", + type: "varchar(32)", + maxLength: 32, + nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AddColumn( + name: "SocketW", + table: "tile_definitions", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddColumn( + name: "SocketWCustom", + table: "tile_definitions", + type: "varchar(32)", + maxLength: 32, + nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "SocketE", + table: "tile_definitions"); + + migrationBuilder.DropColumn( + name: "SocketECustom", + table: "tile_definitions"); + + migrationBuilder.DropColumn( + name: "SocketN", + table: "tile_definitions"); + + migrationBuilder.DropColumn( + name: "SocketNCustom", + table: "tile_definitions"); + + migrationBuilder.DropColumn( + name: "SocketS", + table: "tile_definitions"); + + migrationBuilder.DropColumn( + name: "SocketSCustom", + table: "tile_definitions"); + + migrationBuilder.DropColumn( + name: "SocketW", + table: "tile_definitions"); + + migrationBuilder.DropColumn( + name: "SocketWCustom", + table: "tile_definitions"); + } + } +} diff --git a/Migrations/GameDbContextModelSnapshot.cs b/Migrations/GameDbContextModelSnapshot.cs index a849673..e5ff527 100644 --- a/Migrations/GameDbContextModelSnapshot.cs +++ b/Migrations/GameDbContextModelSnapshot.cs @@ -1960,6 +1960,34 @@ namespace SystemRevivalServer.Migrations b.Property("RenderLayer") .HasColumnType("int"); + b.Property("SocketE") + .HasColumnType("int"); + + b.Property("SocketECustom") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("SocketN") + .HasColumnType("int"); + + b.Property("SocketNCustom") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("SocketS") + .HasColumnType("int"); + + b.Property("SocketSCustom") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("SocketW") + .HasColumnType("int"); + + b.Property("SocketWCustom") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + b.Property("Tags") .HasMaxLength(256) .HasColumnType("varchar(256)"); diff --git a/Services/Admin/Pages/TileMaps/Edit.cshtml b/Services/Admin/Pages/TileMaps/Edit.cshtml index 32356a2..bf052b2 100644 --- a/Services/Admin/Pages/TileMaps/Edit.cshtml +++ b/Services/Admin/Pages/TileMaps/Edit.cshtml @@ -4,6 +4,7 @@ @{ ViewData["Title"] = Model.Sheet.Id == 0 ? "New TileMap Sheet" : $"Edit: {Model.Sheet.Name}"; var tileTypes = Enum.GetValues(); + var socketTypes = Enum.GetValues(); // Build image URL - handle both with and without /downloads/ path var imageUrl = Model.Sheet.CdnPath; if (!string.IsNullOrEmpty(imageUrl)) @@ -131,7 +132,7 @@

Tile Definitions

-
+
+ + +
+ + +
@@ -197,14 +204,14 @@

Defined Tiles (@Model.TileDefinitions.Count)

- +
- + @@ -226,11 +233,16 @@ - +
# Preview Name TypeTagsSockets Props Actions
@tile.Type @(tile.Tags ?? "-") - @if (tile.IsWalkable) { W } - @if (tile.BlocksProjectiles) { P } - @if (tile.BlocksLineOfSight) { L } + N + E + S + W + + @if (tile.IsWalkable) { W } + @if (tile.BlocksProjectiles) { P } + @if (tile.BlocksLineOfSight) { L } @@ -256,7 +268,7 @@