diff --git a/Api/ItemsController.cs b/Api/ItemsController.cs
deleted file mode 100644
index 6b0629b..0000000
--- a/Api/ItemsController.cs
+++ /dev/null
@@ -1,341 +0,0 @@
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.EntityFrameworkCore;
-using DataServer.Data;
-using Server.Services.Auth;
-using Server.Game;
-
-namespace Server.Api;
-
-///
-/// API endpoints for game items and recipes
-///
-[ApiController]
-[Route("api/items")]
-public class ItemsController : ControllerBase
-{
- private readonly GameDbContext _db;
- private readonly IItemService _itemService;
- private readonly IAdminAuthService _adminAuth;
-
- public ItemsController(GameDbContext db, IItemService itemService, IAdminAuthService adminAuth)
- {
- _db = db;
- _itemService = itemService;
- _adminAuth = adminAuth;
- }
-
- ///
- /// Get all items (from cache) - public endpoint
- ///
- [HttpGet]
- public IActionResult GetAllItems([FromQuery] ItemCategory? category = null)
- {
- var items = category.HasValue
- ? _itemService.GetItemsByCategory(category.Value)
- : _itemService.GetAllItems();
-
- return Ok(items);
- }
-
- ///
- /// Get a specific item - public endpoint
- ///
- [HttpGet("{id}")]
- public IActionResult GetItem(int id)
- {
- var item = _itemService.GetItem(id);
- if (item == null)
- return NotFound(new { error = "Item not found" });
-
- return Ok(item);
- }
-
- ///
- /// Get all recipes (from cache) - public endpoint
- ///
- [HttpGet("recipes")]
- public IActionResult GetAllRecipes()
- {
- var recipes = _itemService.GetAllRecipes();
-
- // Enrich with item names
- var enriched = recipes.Select(r => new
- {
- r.Id,
- r.ResultItemId,
- ResultItemName = _itemService.GetItem(r.ResultItemId)?.Name ?? "Unknown",
- r.ScrapCost,
- r.EnergyCost,
- r.RareCost
- });
-
- return Ok(enriched);
- }
-
- ///
- /// Force reload the item cache (admin only)
- ///
- [HttpPost("reload")]
- public async Task ReloadCache()
- {
- var auth = await ValidateAdminAsync();
- if (!auth.IsAuthorized) return Unauthorized(new { error = auth.Error });
-
- await _itemService.ReloadCacheAsync();
- return Ok(new { message = "Cache reloaded", itemCount = _itemService.GetAllItems().Count });
- }
-
- ///
- /// Create or update an item (admin only)
- ///
- [HttpPost]
- public async Task UpsertItem([FromBody] GameItemDto dto)
- {
- var auth = await ValidateAdminAsync();
- if (!auth.IsAuthorized) return Unauthorized(new { error = auth.Error });
-
- var existing = await _db.GameItems.FindAsync(dto.Id);
-
- if (existing == null)
- {
- var item = new GameItem
- {
- Id = dto.Id,
- Name = dto.Name,
- Category = dto.Category,
- CraftCost = dto.CraftCost,
- Description = dto.Description,
- LootValue = dto.LootValue,
- Stackable = dto.Stackable,
- IsEnabled = dto.IsEnabled,
- Damage = dto.Damage,
- FireRate = dto.FireRate,
- ProjectileSpeed = dto.ProjectileSpeed,
- Range = dto.Range,
- AmmoType = dto.AmmoType,
- PelletCount = dto.PelletCount,
- Spread = dto.Spread,
- ExplosionRadius = dto.ExplosionRadius,
- HarvestMultiplier = dto.HarvestMultiplier,
- ScanRadius = dto.ScanRadius,
- ScanCooldown = dto.ScanCooldown,
- ShieldHealth = dto.ShieldHealth,
- ShieldDuration = dto.ShieldDuration,
- HealAmount = dto.HealAmount,
- ShieldBoostDuration = dto.ShieldBoostDuration,
- DamageReduction = dto.DamageReduction,
- SpeedBoostDuration = dto.SpeedBoostDuration,
- SpeedMultiplier = dto.SpeedMultiplier,
- HealthBonus = dto.HealthBonus,
- SpeedPenalty = dto.SpeedPenalty,
- DashDistance = dto.DashDistance,
- DashCooldown = dto.DashCooldown,
- CreatedAt = DateTime.UtcNow
- };
- _db.GameItems.Add(item);
- }
- else
- {
- existing.Name = dto.Name;
- existing.Category = dto.Category;
- existing.CraftCost = dto.CraftCost;
- existing.Description = dto.Description;
- existing.LootValue = dto.LootValue;
- existing.Stackable = dto.Stackable;
- existing.IsEnabled = dto.IsEnabled;
- existing.Damage = dto.Damage;
- existing.FireRate = dto.FireRate;
- existing.ProjectileSpeed = dto.ProjectileSpeed;
- existing.Range = dto.Range;
- existing.AmmoType = dto.AmmoType;
- existing.PelletCount = dto.PelletCount;
- existing.Spread = dto.Spread;
- existing.ExplosionRadius = dto.ExplosionRadius;
- existing.HarvestMultiplier = dto.HarvestMultiplier;
- existing.ScanRadius = dto.ScanRadius;
- existing.ScanCooldown = dto.ScanCooldown;
- existing.ShieldHealth = dto.ShieldHealth;
- existing.ShieldDuration = dto.ShieldDuration;
- existing.HealAmount = dto.HealAmount;
- existing.ShieldBoostDuration = dto.ShieldBoostDuration;
- existing.DamageReduction = dto.DamageReduction;
- existing.SpeedBoostDuration = dto.SpeedBoostDuration;
- existing.SpeedMultiplier = dto.SpeedMultiplier;
- existing.HealthBonus = dto.HealthBonus;
- existing.SpeedPenalty = dto.SpeedPenalty;
- existing.DashDistance = dto.DashDistance;
- existing.DashCooldown = dto.DashCooldown;
- }
-
- await _db.SaveChangesAsync();
- await _itemService.ReloadCacheAsync();
-
- return Ok(new { message = existing == null ? "Item created" : "Item updated", id = dto.Id });
- }
-
- ///
- /// Create or update a recipe (admin only)
- ///
- [HttpPost("recipes")]
- public async Task UpsertRecipe([FromBody] GameRecipeDto dto)
- {
- var auth = await ValidateAdminAsync();
- if (!auth.IsAuthorized) return Unauthorized(new { error = auth.Error });
-
- var existing = await _db.GameRecipes.FindAsync(dto.Id);
-
- if (existing == null)
- {
- var recipe = new GameRecipe
- {
- Id = dto.Id,
- ResultItemId = dto.ResultItemId,
- ScrapCost = dto.ScrapCost,
- EnergyCost = dto.EnergyCost,
- RareCost = dto.RareCost,
- IsEnabled = dto.IsEnabled,
- CreatedAt = DateTime.UtcNow
- };
- _db.GameRecipes.Add(recipe);
- }
- else
- {
- existing.ResultItemId = dto.ResultItemId;
- existing.ScrapCost = dto.ScrapCost;
- existing.EnergyCost = dto.EnergyCost;
- existing.RareCost = dto.RareCost;
- existing.IsEnabled = dto.IsEnabled;
- }
-
- await _db.SaveChangesAsync();
- await _itemService.ReloadCacheAsync();
-
- return Ok(new { message = existing == null ? "Recipe created" : "Recipe updated", id = dto.Id });
- }
-
- ///
- /// Seed default items if database is empty (admin only)
- ///
- [HttpPost("seed")]
- public async Task SeedDefaults()
- {
- var auth = await ValidateAdminAsync();
- if (!auth.IsAuthorized) return Unauthorized(new { error = auth.Error });
-
- var existingItemCount = await _db.GameItems.CountAsync();
- var existingRecipeCount = await _db.GameRecipes.CountAsync();
-
- if (existingItemCount > 0 || existingRecipeCount > 0)
- return BadRequest(new { error = "Database already has items/recipes. Clear first or use upsert." });
-
- var defaultItems = DefaultItemData.GetDefaultItems();
- var defaultRecipes = DefaultItemData.GetDefaultRecipes();
-
- _db.GameItems.AddRange(defaultItems);
- _db.GameRecipes.AddRange(defaultRecipes);
-
- await _db.SaveChangesAsync();
- await _itemService.ReloadCacheAsync();
-
- return Ok(new
- {
- message = "Default items seeded",
- itemsAdded = defaultItems.Count,
- recipesAdded = defaultRecipes.Count
- });
- }
-
- ///
- /// Delete an item (admin only)
- ///
- [HttpDelete("{id}")]
- public async Task DeleteItem(int id)
- {
- var auth = await ValidateAdminAsync();
- if (!auth.IsAuthorized) return Unauthorized(new { error = auth.Error });
-
- var item = await _db.GameItems.FindAsync(id);
- if (item == null)
- return NotFound(new { error = "Item not found" });
-
- _db.GameItems.Remove(item);
- await _db.SaveChangesAsync();
- await _itemService.ReloadCacheAsync();
-
- return Ok(new { message = "Item deleted", id });
- }
-
- ///
- /// Delete a recipe (admin only)
- ///
- [HttpDelete("recipes/{id}")]
- public async Task DeleteRecipe(int id)
- {
- var auth = await ValidateAdminAsync();
- if (!auth.IsAuthorized) return Unauthorized(new { error = auth.Error });
-
- var recipe = await _db.GameRecipes.FindAsync(id);
- if (recipe == null)
- return NotFound(new { error = "Recipe not found" });
-
- _db.GameRecipes.Remove(recipe);
- await _db.SaveChangesAsync();
- await _itemService.ReloadCacheAsync();
-
- return Ok(new { message = "Recipe deleted", id });
- }
-
- private async Task ValidateAdminAsync()
- {
- var token = Request.Headers["Authorization"].FirstOrDefault()?.Replace("Bearer ", "");
- return await _adminAuth.ValidateAsync(token, AccountRole.Admin);
- }
-}
-
-public class GameItemDto
-{
- public int Id { get; set; }
- public string Name { get; set; } = "";
- public ItemCategory Category { get; set; }
- public int CraftCost { get; set; }
- public string Description { get; set; } = "";
- public int LootValue { get; set; }
- public bool Stackable { get; set; }
- public bool IsEnabled { get; set; } = true;
-
- public int Damage { get; set; }
- public float FireRate { get; set; }
- public float ProjectileSpeed { get; set; }
- public float Range { get; set; }
- public int AmmoType { get; set; }
- public int PelletCount { get; set; } = 1;
- public float Spread { get; set; }
- public float ExplosionRadius { get; set; }
-
- public float HarvestMultiplier { get; set; } = 1f;
- public float ScanRadius { get; set; }
- public float ScanCooldown { get; set; }
- public int ShieldHealth { get; set; }
- public float ShieldDuration { get; set; }
-
- public int HealAmount { get; set; }
- public float ShieldBoostDuration { get; set; }
- public float DamageReduction { get; set; }
- public float SpeedBoostDuration { get; set; }
- public float SpeedMultiplier { get; set; } = 1f;
-
- public int HealthBonus { get; set; }
- public float SpeedPenalty { get; set; }
- public float DashDistance { get; set; }
- public float DashCooldown { get; set; }
-}
-
-public class GameRecipeDto
-{
- public int Id { get; set; }
- public int ResultItemId { get; set; }
- public int ScrapCost { get; set; }
- public int EnergyCost { get; set; }
- public int RareCost { get; set; }
- public bool IsEnabled { get; set; } = true;
-}
diff --git a/Api/StatsController.cs b/Api/StatsController.cs
deleted file mode 100644
index 68b07b0..0000000
--- a/Api/StatsController.cs
+++ /dev/null
@@ -1,343 +0,0 @@
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.EntityFrameworkCore;
-using DataServer.Data;
-
-namespace Server.Api;
-
-///
-/// API endpoints for player statistics and leaderboards
-///
-[ApiController]
-[Route("api/stats")]
-public class StatsController : ControllerBase
-{
- private readonly GameDbContext _db;
-
- public StatsController(GameDbContext db)
- {
- _db = db;
- }
-
- ///
- /// Get stats for a specific player by account ID
- ///
- [HttpGet("player/{accountId}")]
- public async Task GetPlayerStats(ulong accountId)
- {
- var stats = await _db.PlayerStats
- .Where(s => s.AccountId == accountId)
- .Select(s => new PlayerStatsDto
- {
- AccountId = s.AccountId,
- Username = s.Account.Username,
- MatchesPlayed = s.MatchesPlayed,
- Wins = s.Wins,
- Losses = s.Losses,
- Extractions = s.Extractions,
- WinRate = s.MatchesPlayed > 0 ? (float)s.Wins / s.MatchesPlayed * 100 : 0,
- Kills = s.Kills,
- Deaths = s.Deaths,
- KdRatio = s.Deaths > 0 ? (float)s.Kills / s.Deaths : s.Kills,
- TotalDamageDealt = s.TotalDamageDealt,
- TotalDamageTaken = s.TotalDamageTaken,
- TotalScrapCollected = s.TotalScrapCollected,
- TotalEnergyCollected = s.TotalEnergyCollected,
- TotalRareCollected = s.TotalRareCollected,
- ItemsCrafted = s.ItemsCrafted,
- TotalPlayTimeSeconds = s.TotalPlayTimeSeconds,
- LongestSurvivalSeconds = s.LongestSurvivalSeconds,
- Elo = s.Elo
- })
- .FirstOrDefaultAsync();
-
- if (stats == null)
- return NotFound(new { error = "Player stats not found" });
-
- return Ok(stats);
- }
-
- ///
- /// Get stats for a player by username
- ///
- [HttpGet("player/name/{username}")]
- public async Task GetPlayerStatsByName(string username)
- {
- var stats = await _db.PlayerStats
- .Where(s => s.Account.Username == username)
- .Select(s => new PlayerStatsDto
- {
- AccountId = s.AccountId,
- Username = s.Account.Username,
- MatchesPlayed = s.MatchesPlayed,
- Wins = s.Wins,
- Losses = s.Losses,
- Extractions = s.Extractions,
- WinRate = s.MatchesPlayed > 0 ? (float)s.Wins / s.MatchesPlayed * 100 : 0,
- Kills = s.Kills,
- Deaths = s.Deaths,
- KdRatio = s.Deaths > 0 ? (float)s.Kills / s.Deaths : s.Kills,
- TotalDamageDealt = s.TotalDamageDealt,
- TotalDamageTaken = s.TotalDamageTaken,
- TotalScrapCollected = s.TotalScrapCollected,
- TotalEnergyCollected = s.TotalEnergyCollected,
- TotalRareCollected = s.TotalRareCollected,
- ItemsCrafted = s.ItemsCrafted,
- TotalPlayTimeSeconds = s.TotalPlayTimeSeconds,
- LongestSurvivalSeconds = s.LongestSurvivalSeconds,
- Elo = s.Elo
- })
- .FirstOrDefaultAsync();
-
- if (stats == null)
- return NotFound(new { error = "Player not found" });
-
- return Ok(stats);
- }
-
- ///
- /// Get leaderboard by Elo rating
- ///
- [HttpGet("leaderboard")]
- public async Task GetLeaderboard(
- [FromQuery] string sort = "elo",
- [FromQuery] int page = 1,
- [FromQuery] int pageSize = 20)
- {
- pageSize = Math.Clamp(pageSize, 1, 100);
- page = Math.Max(1, page);
-
- var query = _db.PlayerStats
- .Where(s => s.MatchesPlayed >= 5); // Minimum games to appear on leaderboard
-
- query = sort.ToLower() switch
- {
- "wins" => query.OrderByDescending(s => s.Wins),
- "kills" => query.OrderByDescending(s => s.Kills),
- "winrate" => query.OrderByDescending(s => s.MatchesPlayed > 0 ? (float)s.Wins / s.MatchesPlayed : 0),
- "kd" => query.OrderByDescending(s => s.Deaths > 0 ? (float)s.Kills / s.Deaths : s.Kills),
- "extractions" => query.OrderByDescending(s => s.Extractions),
- "playtime" => query.OrderByDescending(s => s.TotalPlayTimeSeconds),
- _ => query.OrderByDescending(s => s.Elo)
- };
-
- var totalCount = await query.CountAsync();
- var totalPages = (int)Math.Ceiling(totalCount / (double)pageSize);
-
- var entries = await query
- .Skip((page - 1) * pageSize)
- .Take(pageSize)
- .Select(s => new LeaderboardEntryDto
- {
- Rank = 0, // Calculated below
- AccountId = s.AccountId,
- Username = s.Account.Username,
- Elo = s.Elo,
- Wins = s.Wins,
- Losses = s.Losses,
- WinRate = s.MatchesPlayed > 0 ? (float)s.Wins / s.MatchesPlayed * 100 : 0,
- Kills = s.Kills,
- Deaths = s.Deaths,
- KdRatio = s.Deaths > 0 ? (float)s.Kills / s.Deaths : s.Kills,
- Extractions = s.Extractions,
- MatchesPlayed = s.MatchesPlayed
- })
- .ToListAsync();
-
- // Calculate ranks
- int startRank = (page - 1) * pageSize + 1;
- for (int i = 0; i < entries.Count; i++)
- {
- entries[i].Rank = startRank + i;
- }
-
- return Ok(new LeaderboardResponse
- {
- Entries = entries,
- Page = page,
- PageSize = pageSize,
- TotalPages = totalPages,
- TotalCount = totalCount,
- SortBy = sort
- });
- }
-
- ///
- /// Get match history for a player
- ///
- [HttpGet("player/{accountId}/history")]
- public async Task GetMatchHistory(
- ulong accountId,
- [FromQuery] int page = 1,
- [FromQuery] int pageSize = 20)
- {
- pageSize = Math.Clamp(pageSize, 1, 50);
- page = Math.Max(1, page);
-
- var query = _db.MatchHistory
- .Where(m => m.AccountId == accountId)
- .OrderByDescending(m => m.PlayedAt);
-
- var totalCount = await query.CountAsync();
- var totalPages = (int)Math.Ceiling(totalCount / (double)pageSize);
-
- var matches = await query
- .Skip((page - 1) * pageSize)
- .Take(pageSize)
- .Select(m => new MatchHistoryDto
- {
- MatchId = m.MatchId,
- PlayedAt = m.PlayedAt,
- Result = m.Result.ToString(),
- Placement = m.Placement,
- TotalPlayers = m.TotalPlayers,
- Kills = m.Kills,
- Deaths = m.Deaths,
- DamageDealt = m.DamageDealt,
- DamageTaken = m.DamageTaken,
- ScrapCollected = m.ScrapCollected,
- EnergyCollected = m.EnergyCollected,
- RareCollected = m.RareCollected,
- ItemsCrafted = m.ItemsCrafted,
- SurvivalTimeSeconds = m.SurvivalTimeSeconds,
- EloChange = m.EloChange,
- EloAfter = m.EloAfter
- })
- .ToListAsync();
-
- return Ok(new MatchHistoryResponse
- {
- Matches = matches,
- Page = page,
- PageSize = pageSize,
- TotalPages = totalPages,
- TotalCount = totalCount
- });
- }
-
- ///
- /// Get global statistics
- ///
- [HttpGet("global")]
- public async Task GetGlobalStats()
- {
- var stats = await _db.PlayerStats
- .GroupBy(s => 1)
- .Select(g => new GlobalStatsDto
- {
- TotalPlayers = g.Count(),
- TotalMatchesPlayed = g.Sum(s => s.MatchesPlayed),
- TotalKills = g.Sum(s => s.Kills),
- TotalExtractions = g.Sum(s => s.Extractions),
- TotalPlayTimeHours = g.Sum(s => s.TotalPlayTimeSeconds) / 3600.0,
- AverageElo = g.Average(s => (double)s.Elo),
- TopElo = g.Max(s => s.Elo)
- })
- .FirstOrDefaultAsync();
-
- if (stats == null)
- {
- return Ok(new GlobalStatsDto());
- }
-
- // Get active players (played in last 7 days)
- var sevenDaysAgo = DateTime.UtcNow.AddDays(-7);
- stats.ActivePlayers = await _db.MatchHistory
- .Where(m => m.PlayedAt >= sevenDaysAgo)
- .Select(m => m.AccountId)
- .Distinct()
- .CountAsync();
-
- return Ok(stats);
- }
-}
-
-// DTOs
-public class PlayerStatsDto
-{
- public ulong AccountId { get; set; }
- public string Username { get; set; } = "";
- public int MatchesPlayed { get; set; }
- public int Wins { get; set; }
- public int Losses { get; set; }
- public int Extractions { get; set; }
- public float WinRate { get; set; }
- public int Kills { get; set; }
- public int Deaths { get; set; }
- public float KdRatio { get; set; }
- public long TotalDamageDealt { get; set; }
- public long TotalDamageTaken { get; set; }
- public long TotalScrapCollected { get; set; }
- public long TotalEnergyCollected { get; set; }
- public long TotalRareCollected { get; set; }
- public int ItemsCrafted { get; set; }
- public long TotalPlayTimeSeconds { get; set; }
- public int LongestSurvivalSeconds { get; set; }
- public int Elo { get; set; }
-}
-
-public class LeaderboardEntryDto
-{
- public int Rank { get; set; }
- public ulong AccountId { get; set; }
- public string Username { get; set; } = "";
- public int Elo { get; set; }
- public int Wins { get; set; }
- public int Losses { get; set; }
- public float WinRate { get; set; }
- public int Kills { get; set; }
- public int Deaths { get; set; }
- public float KdRatio { get; set; }
- public int Extractions { get; set; }
- public int MatchesPlayed { get; set; }
-}
-
-public class LeaderboardResponse
-{
- public List Entries { get; set; } = new();
- public int Page { get; set; }
- public int PageSize { get; set; }
- public int TotalPages { get; set; }
- public int TotalCount { get; set; }
- public string SortBy { get; set; } = "";
-}
-
-public class MatchHistoryDto
-{
- public string MatchId { get; set; } = "";
- public DateTime PlayedAt { get; set; }
- public string Result { get; set; } = "";
- public int Placement { get; set; }
- public int TotalPlayers { get; set; }
- public int Kills { get; set; }
- public int Deaths { get; set; }
- public int DamageDealt { get; set; }
- public int DamageTaken { get; set; }
- public int ScrapCollected { get; set; }
- public int EnergyCollected { get; set; }
- public int RareCollected { get; set; }
- public int ItemsCrafted { get; set; }
- public int SurvivalTimeSeconds { get; set; }
- public int EloChange { get; set; }
- public int EloAfter { get; set; }
-}
-
-public class MatchHistoryResponse
-{
- public List Matches { get; set; } = new();
- public int Page { get; set; }
- public int PageSize { get; set; }
- public int TotalPages { get; set; }
- public int TotalCount { get; set; }
-}
-
-public class GlobalStatsDto
-{
- public int TotalPlayers { get; set; }
- public int ActivePlayers { get; set; }
- public int TotalMatchesPlayed { get; set; }
- public int TotalKills { get; set; }
- public int TotalExtractions { get; set; }
- public double TotalPlayTimeHours { get; set; }
- public double AverageElo { get; set; }
- public int TopElo { get; set; }
-}
diff --git a/Game/GameOpCodes.cs b/Game/GameOpCodes.cs
deleted file mode 100644
index 59b8c37..0000000
--- a/Game/GameOpCodes.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-namespace Server.Networking.Messages;
-
-///
-/// OpCodes for Void Scavengers game - extends base OpCodes
-///
-public static class GameOpCodes
-{
- // ===== Lobby/Matchmaking (400-419) =====
- public const int LOBBY_JOIN = 400;
- public const int LOBBY_JOIN_RESULT = 401;
- public const int LOBBY_STATE = 402; // Periodic update of lobby players
- public const int LOBBY_READY = 403;
- public const int LOBBY_COUNTDOWN = 404; // Game starting in X seconds
- public const int LOBBY_LEAVE = 405;
-
- // ===== Game State (420-449) =====
- public const int GAME_START = 420; // Server -> Client: Round begins
- public const int GAME_STATE = 421; // Server -> Client: Full world snapshot
- public const int GAME_TICK = 422; // Server -> Client: Delta update
- public const int GAME_END = 423; // Server -> Client: Round over
- public const int GAME_STATS = 424; // Server -> Client: End-of-round stats
-
- // ===== Player Input (450-469) =====
- public const int INPUT_MOVE = 450; // Client -> Server: Movement input
- public const int INPUT_ACTION = 451; // Client -> Server: Use/Interact/Pickup
- public const int INPUT_SHOOT = 452; // Client -> Server: Fire weapon
- public const int INPUT_DROP = 453; // Client -> Server: Drop item
- public const int INPUT_CRAFT = 454; // Client -> Server: Craft request
-
- // ===== World Events (470-499) =====
- public const int EVENT_SPAWN = 470; // Entity spawned
- public const int EVENT_DESPAWN = 471; // Entity removed
- public const int EVENT_DAMAGE = 472; // Damage dealt
- public const int EVENT_DEATH = 473; // Player/entity died
- public const int EVENT_PICKUP = 474; // Item picked up
- public const int EVENT_PROJECTILE = 475; // Projectile created
- public const int EVENT_EXPLOSION = 476; // Area effect
- public const int EVENT_CRAFT_COMPLETE = 477; // Crafting finished
- public const int EVENT_EXTRACT = 478; // Player extracted with loot
-
- // ===== Chat/Social (500-509) =====
- public const int CHAT_SEND = 500;
- public const int CHAT_RECEIVE = 501;
- public const int CHAT_PROXIMITY = 502; // Location-based chat
-}
diff --git a/Game/ItemService.cs b/Game/ItemService.cs
deleted file mode 100644
index 3255d07..0000000
--- a/Game/ItemService.cs
+++ /dev/null
@@ -1,279 +0,0 @@
-using System.Collections.Concurrent;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.Extensions.Caching.Memory;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Logging;
-using DataServer.Data;
-
-namespace Server.Game;
-
-///
-/// Interface for item data access
-///
-public interface IItemService
-{
- GameItemData? GetItem(int id);
- GameRecipeData? GetRecipe(int id);
- IReadOnlyList GetAllItems();
- IReadOnlyList GetAllRecipes();
- IReadOnlyList GetItemsByCategory(ItemCategory category);
- Task ReloadCacheAsync();
-}
-
-///
-/// Runtime item data (cached from database)
-///
-public sealed class GameItemData
-{
- public int Id { get; init; }
- public string Name { get; init; } = "";
- public ItemCategory Category { get; init; }
- public int CraftCost { get; init; }
- public string Description { get; init; } = "";
- public int LootValue { get; init; }
- public bool Stackable { get; init; }
-
- // Weapon stats
- public int Damage { get; init; }
- public float FireRate { get; init; }
- public float ProjectileSpeed { get; init; }
- public float Range { get; init; }
- public int AmmoType { get; init; }
- public int PelletCount { get; init; } = 1;
- public float Spread { get; init; }
- public float ExplosionRadius { get; init; }
-
- // Tool stats
- public float HarvestMultiplier { get; init; } = 1f;
- public float ScanRadius { get; init; }
- public float ScanCooldown { get; init; }
- public int ShieldHealth { get; init; }
- public float ShieldDuration { get; init; }
-
- // Consumable stats
- public int HealAmount { get; init; }
- public float ShieldBoostDuration { get; init; }
- public float DamageReduction { get; init; }
- public float SpeedBoostDuration { get; init; }
- public float SpeedMultiplier { get; init; } = 1f;
-
- // Armor stats
- public int HealthBonus { get; init; }
- public float SpeedPenalty { get; init; }
- public float DashDistance { get; init; }
- public float DashCooldown { get; init; }
-
- public static GameItemData FromEntity(GameItem e) => new()
- {
- Id = e.Id,
- Name = e.Name,
- Category = e.Category,
- CraftCost = e.CraftCost,
- Description = e.Description,
- LootValue = e.LootValue,
- Stackable = e.Stackable,
- Damage = e.Damage,
- FireRate = e.FireRate,
- ProjectileSpeed = e.ProjectileSpeed,
- Range = e.Range,
- AmmoType = e.AmmoType,
- PelletCount = e.PelletCount,
- Spread = e.Spread,
- ExplosionRadius = e.ExplosionRadius,
- HarvestMultiplier = e.HarvestMultiplier,
- ScanRadius = e.ScanRadius,
- ScanCooldown = e.ScanCooldown,
- ShieldHealth = e.ShieldHealth,
- ShieldDuration = e.ShieldDuration,
- HealAmount = e.HealAmount,
- ShieldBoostDuration = e.ShieldBoostDuration,
- DamageReduction = e.DamageReduction,
- SpeedBoostDuration = e.SpeedBoostDuration,
- SpeedMultiplier = e.SpeedMultiplier,
- HealthBonus = e.HealthBonus,
- SpeedPenalty = e.SpeedPenalty,
- DashDistance = e.DashDistance,
- DashCooldown = e.DashCooldown
- };
-}
-
-///
-/// Runtime recipe data (cached from database)
-///
-public sealed class GameRecipeData
-{
- public int Id { get; init; }
- public int ResultItemId { get; init; }
- public int ScrapCost { get; init; }
- public int EnergyCost { get; init; }
- public int RareCost { get; init; }
-
- public bool CanCraft(int scrap, int energy, int rare)
- {
- return scrap >= ScrapCost && energy >= EnergyCost && rare >= RareCost;
- }
-
- public static GameRecipeData FromEntity(GameRecipe e) => new()
- {
- Id = e.Id,
- ResultItemId = e.ResultItemId,
- ScrapCost = e.ScrapCost,
- EnergyCost = e.EnergyCost,
- RareCost = e.RareCost
- };
-}
-
-///
-/// Cached item service that loads from database and refreshes periodically
-///
-public sealed class CachedItemService : IItemService, IDisposable
-{
- private readonly ILogger _log;
- private readonly IServiceScopeFactory _scopeFactory;
- private readonly Timer _refreshTimer;
-
- private ConcurrentDictionary _items = new();
- private ConcurrentDictionary _recipes = new();
- private ConcurrentDictionary> _itemsByCategory = new();
-
- private static readonly TimeSpan RefreshInterval = TimeSpan.FromMinutes(5);
-
- public CachedItemService(ILogger log, IServiceScopeFactory scopeFactory)
- {
- _log = log;
- _scopeFactory = scopeFactory;
-
- // Initial load
- _ = ReloadCacheAsync();
-
- // Periodic refresh
- _refreshTimer = new Timer(_ => _ = ReloadCacheAsync(), null, RefreshInterval, RefreshInterval);
- }
-
- public GameItemData? GetItem(int id) => _items.TryGetValue(id, out var item) ? item : null;
-
- public GameRecipeData? GetRecipe(int id) => _recipes.TryGetValue(id, out var recipe) ? recipe : null;
-
- public IReadOnlyList GetAllItems() => _items.Values.ToList();
-
- public IReadOnlyList GetAllRecipes() => _recipes.Values.ToList();
-
- public IReadOnlyList GetItemsByCategory(ItemCategory category)
- {
- return _itemsByCategory.TryGetValue(category, out var items) ? items : new List();
- }
-
- public async Task ReloadCacheAsync()
- {
- try
- {
- using var scope = _scopeFactory.CreateScope();
- var db = scope.ServiceProvider.GetRequiredService();
-
- // Load items
- var items = await db.GameItems
- .Where(i => i.IsEnabled)
- .ToListAsync();
-
- var newItems = new ConcurrentDictionary();
- var newByCategory = new ConcurrentDictionary>();
-
- foreach (var item in items)
- {
- var data = GameItemData.FromEntity(item);
- newItems[item.Id] = data;
-
- if (!newByCategory.ContainsKey(item.Category))
- newByCategory[item.Category] = new List();
- newByCategory[item.Category].Add(data);
- }
-
- // Load recipes
- var recipes = await db.GameRecipes
- .Where(r => r.IsEnabled)
- .ToListAsync();
-
- var newRecipes = new ConcurrentDictionary();
- foreach (var recipe in recipes)
- {
- newRecipes[recipe.Id] = GameRecipeData.FromEntity(recipe);
- }
-
- // Atomic swap
- _items = newItems;
- _recipes = newRecipes;
- _itemsByCategory = newByCategory;
-
- _log.LogInformation("Loaded {ItemCount} items and {RecipeCount} recipes from database",
- items.Count, recipes.Count);
- }
- catch (Exception ex)
- {
- _log.LogError(ex, "Failed to reload item cache from database");
- }
- }
-
- public void Dispose()
- {
- _refreshTimer.Dispose();
- }
-}
-
-///
-/// Fallback static item database (used if DB is empty or for seeding)
-///
-public static class DefaultItemData
-{
- public static List GetDefaultItems() => new()
- {
- // Resources
- new() { Id = 1, Name = "Scrap Metal", Category = ItemCategory.Resource, CraftCost = 0, Description = "Basic salvage material", LootValue = 1, Stackable = true },
- new() { Id = 2, Name = "Energy Cell", Category = ItemCategory.Resource, CraftCost = 0, Description = "Charged power source", LootValue = 2, Stackable = true },
- new() { Id = 3, Name = "Rare Alloy", Category = ItemCategory.Resource, CraftCost = 0, Description = "Precious refined metal", LootValue = 5, Stackable = true },
-
- // Weapons
- new() { Id = 100, Name = "Pulse Pistol", Category = ItemCategory.Weapon, CraftCost = 15, Description = "Basic sidearm", LootValue = 10, Stackable = false, Damage = 10, FireRate = 4f, ProjectileSpeed = 400f, Range = 300f },
- new() { Id = 101, Name = "Scatter Gun", Category = ItemCategory.Weapon, CraftCost = 25, Description = "Close-range devastation", LootValue = 20, Stackable = false, Damage = 6, FireRate = 1.5f, ProjectileSpeed = 350f, Range = 150f, PelletCount = 5, Spread = 0.4f },
- new() { Id = 102, Name = "Rail Rifle", Category = ItemCategory.Weapon, CraftCost = 40, Description = "Long-range precision", LootValue = 35, Stackable = false, Damage = 45, FireRate = 0.8f, ProjectileSpeed = 800f, Range = 600f },
- new() { Id = 103, Name = "Plasma Launcher", Category = ItemCategory.Weapon, CraftCost = 60, Description = "Area damage weapon", LootValue = 50, Stackable = false, Damage = 30, FireRate = 0.5f, ProjectileSpeed = 250f, Range = 400f, ExplosionRadius = 50f },
-
- // Tools
- new() { Id = 200, Name = "Mining Laser", Category = ItemCategory.Tool, CraftCost = 15, Description = "Harvests resources faster", LootValue = 12, Stackable = false, HarvestMultiplier = 2.0f },
- new() { Id = 201, Name = "Scanner", Category = ItemCategory.Tool, CraftCost = 20, Description = "Reveals nearby resources and players", LootValue = 15, Stackable = false, ScanRadius = 200f, ScanCooldown = 10f },
- new() { Id = 202, Name = "Portable Shield", Category = ItemCategory.Tool, CraftCost = 35, Description = "Deployable cover", LootValue = 25, Stackable = false, ShieldHealth = 100, ShieldDuration = 15f },
-
- // Consumables
- new() { Id = 300, Name = "Repair Kit", Category = ItemCategory.Consumable, CraftCost = 10, Description = "Restores 30 health", LootValue = 8, Stackable = true, HealAmount = 30 },
- new() { Id = 301, Name = "Shield Booster", Category = ItemCategory.Consumable, CraftCost = 15, Description = "Temporary damage reduction", LootValue = 12, Stackable = true, ShieldBoostDuration = 10f, DamageReduction = 0.3f },
- new() { Id = 302, Name = "Speed Stim", Category = ItemCategory.Consumable, CraftCost = 12, Description = "Temporary speed boost", LootValue = 10, Stackable = true, SpeedBoostDuration = 8f, SpeedMultiplier = 1.5f },
-
- // Armor
- new() { Id = 400, Name = "Light Suit", Category = ItemCategory.Armor, CraftCost = 20, Description = "+20 max health", LootValue = 15, Stackable = false, HealthBonus = 20 },
- new() { Id = 401, Name = "Heavy Suit", Category = ItemCategory.Armor, CraftCost = 45, Description = "+50 max health, slower", LootValue = 35, Stackable = false, HealthBonus = 50, SpeedPenalty = 0.15f },
- new() { Id = 402, Name = "Thruster Pack", Category = ItemCategory.Armor, CraftCost = 30, Description = "Dash ability", LootValue = 25, Stackable = false, DashDistance = 100f, DashCooldown = 5f }
- };
-
- public static List GetDefaultRecipes() => new()
- {
- // Weapons
- new() { Id = 1, ResultItemId = 100, ScrapCost = 5, EnergyCost = 2, RareCost = 0 },
- new() { Id = 2, ResultItemId = 101, ScrapCost = 8, EnergyCost = 3, RareCost = 0 },
- new() { Id = 3, ResultItemId = 102, ScrapCost = 10, EnergyCost = 5, RareCost = 2 },
- new() { Id = 4, ResultItemId = 103, ScrapCost = 15, EnergyCost = 8, RareCost = 4 },
-
- // Tools
- new() { Id = 10, ResultItemId = 200, ScrapCost = 6, EnergyCost = 3, RareCost = 0 },
- new() { Id = 11, ResultItemId = 201, ScrapCost = 8, EnergyCost = 4, RareCost = 1 },
- new() { Id = 12, ResultItemId = 202, ScrapCost = 12, EnergyCost = 6, RareCost = 2 },
-
- // Consumables
- new() { Id = 20, ResultItemId = 300, ScrapCost = 3, EnergyCost = 2, RareCost = 0 },
- new() { Id = 21, ResultItemId = 301, ScrapCost = 4, EnergyCost = 3, RareCost = 0 },
- new() { Id = 22, ResultItemId = 302, ScrapCost = 3, EnergyCost = 4, RareCost = 0 },
-
- // Armor
- new() { Id = 30, ResultItemId = 400, ScrapCost = 8, EnergyCost = 0, RareCost = 1 },
- new() { Id = 31, ResultItemId = 401, ScrapCost = 15, EnergyCost = 0, RareCost = 3 },
- new() { Id = 32, ResultItemId = 402, ScrapCost = 10, EnergyCost = 5, RareCost = 2 }
- };
-}
diff --git a/Migrations/20251226145940_Cleanup.Designer.cs b/Migrations/20251226145940_Cleanup.Designer.cs
new file mode 100644
index 0000000..267b524
--- /dev/null
+++ b/Migrations/20251226145940_Cleanup.Designer.cs
@@ -0,0 +1,1942 @@
+//
+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("20251226145940_Cleanup")]
+ partial class Cleanup
+ {
+ ///
+ 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.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("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("DamageType")
+ .HasColumnType("int");
+
+ 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("MagicResist")
+ .HasColumnType("int");
+
+ b.Property("ManaRestore")
+ .HasColumnType("int");
+
+ b.Property("MaxDamage")
+ .HasColumnType("int");
+
+ b.Property("MaxStack")
+ .HasColumnType("int");
+
+ b.Property("MinDamage")
+ .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("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