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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AbilitiesJson") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + 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("Category") + .HasColumnType("int"); + + b.Property("DamagePerTier") + .HasColumnType("float"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("DropChanceMultiplier") + .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("ResistancesJson") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("Scale") + .HasColumnType("float"); + + b.Property("SpriteConfigJson") + .HasMaxLength(4096) + .HasColumnType("varchar(4096)"); + + 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.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.EquipmentSlot", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CharacterId") + .HasColumnType("bigint unsigned"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("datetime(6)") + .HasDefaultValueSql("CURRENT_TIMESTAMP(6)"); + + b.Property("ItemTemplateId") + .HasColumnType("bigint unsigned"); + + b.Property("SlotCode") + .HasColumnType("tinyint unsigned"); + + b.Property("UpdatedAt") + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("datetime(6)") + .HasDefaultValueSql("CURRENT_TIMESTAMP(6)"); + + MySqlPropertyBuilderExtensions.UseMySqlComputedColumn(b.Property("UpdatedAt")); + + b.HasKey("Id"); + + b.HasIndex("ItemTemplateId"); + + b.HasIndex("CharacterId", "SlotCode") + .IsUnique(); + + b.ToTable("equipment", (string)null); + }); + + modelBuilder.Entity("DataServer.Data.InventoryItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CharacterId") + .HasColumnType("bigint unsigned"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("datetime(6)") + .HasDefaultValueSql("CURRENT_TIMESTAMP(6)"); + + b.Property("ItemTemplateId") + .HasColumnType("bigint unsigned"); + + b.Property("Quantity") + .HasColumnType("int unsigned"); + + b.Property("SlotIndex") + .HasColumnType("int unsigned"); + + b.Property("UpdatedAt") + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("datetime(6)") + .HasDefaultValueSql("CURRENT_TIMESTAMP(6)"); + + MySqlPropertyBuilderExtensions.UseMySqlComputedColumn(b.Property("UpdatedAt")); + + b.HasKey("Id"); + + b.HasIndex("CharacterId"); + + b.HasIndex("ItemTemplateId"); + + b.HasIndex("CharacterId", "SlotIndex") + .IsUnique(); + + b.ToTable("inventories", (string)null); + }); + + modelBuilder.Entity("DataServer.Data.ItemTemplate", 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("ItemType") + .HasColumnType("tinyint unsigned"); + + b.Property("MaxStack") + .HasColumnType("int unsigned"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Rarity") + .HasColumnType("tinyint unsigned"); + + b.Property("StatsJson") + .HasColumnType("json"); + + b.Property("UpdatedAt") + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("datetime(6)") + .HasDefaultValueSql("CURRENT_TIMESTAMP(6)"); + + MySqlPropertyBuilderExtensions.UseMySqlComputedColumn(b.Property("UpdatedAt")); + + b.Property("Weight") + .HasColumnType("int unsigned"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("item_templates", (string)null); + }); + + modelBuilder.Entity("DataServer.Data.Old_Character", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint unsigned"); + + b.Property("AppearanceJson") + .HasColumnType("json"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("datetime(6)") + .HasDefaultValueSql("CURRENT_TIMESTAMP(6)"); + + b.Property("FacingDeg") + .HasColumnType("float"); + + b.Property("HpCurrent") + .HasColumnType("int unsigned"); + + b.Property("HpMax") + .HasColumnType("int unsigned"); + + b.Property("Level") + .HasColumnType("int unsigned"); + + b.Property("MpCurrent") + .HasColumnType("int unsigned"); + + b.Property("MpMax") + .HasColumnType("int unsigned"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("PosX") + .HasColumnType("double"); + + b.Property("PosY") + .HasColumnType("double"); + + b.Property("PosZ") + .HasColumnType("double"); + + b.Property("StaminaCurrent") + .HasColumnType("int unsigned"); + + b.Property("StaminaMax") + .HasColumnType("int unsigned"); + + b.Property("StatDexterity") + .HasColumnType("int unsigned"); + + b.Property("StatEndurance") + .HasColumnType("int unsigned"); + + b.Property("StatIntelligence") + .HasColumnType("int unsigned"); + + b.Property("StatStrength") + .HasColumnType("int unsigned"); + + b.Property("StatWisdom") + .HasColumnType("int unsigned"); + + b.Property("UpdatedAt") + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("datetime(6)") + .HasDefaultValueSql("CURRENT_TIMESTAMP(6)"); + + MySqlPropertyBuilderExtensions.UseMySqlComputedColumn(b.Property("UpdatedAt")); + + b.Property("Xp") + .HasColumnType("bigint unsigned"); + + b.Property("ZoneId") + .HasColumnType("bigint unsigned"); + + b.HasKey("Id"); + + b.HasIndex("AccountId") + .IsUnique(); + + b.HasIndex("ZoneId"); + + b.ToTable("characters", (string)null); + }); + + 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() + .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.EquipmentSlot", b => + { + b.HasOne("DataServer.Data.Old_Character", "Old_Character") + .WithMany() + .HasForeignKey("CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.ItemTemplate", "ItemTemplate") + .WithMany() + .HasForeignKey("ItemTemplateId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("ItemTemplate"); + + b.Navigation("Old_Character"); + }); + + modelBuilder.Entity("DataServer.Data.InventoryItem", b => + { + b.HasOne("DataServer.Data.Old_Character", "Old_Character") + .WithMany() + .HasForeignKey("CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.ItemTemplate", "ItemTemplate") + .WithMany() + .HasForeignKey("ItemTemplateId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("ItemTemplate"); + + b.Navigation("Old_Character"); + }); + + modelBuilder.Entity("DataServer.Data.Old_Character", b => + { + b.HasOne("DataServer.Data.Account", "Account") + .WithMany("Characters") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Zone", "Zone") + .WithMany() + .HasForeignKey("ZoneId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Account"); + + b.Navigation("Zone"); + }); + + 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"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Migrations/20251226145940_Cleanup.cs b/Migrations/20251226145940_Cleanup.cs new file mode 100644 index 0000000..c4d88af --- /dev/null +++ b/Migrations/20251226145940_Cleanup.cs @@ -0,0 +1,221 @@ +using System; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace SystemRevivalServer.Migrations +{ + /// + public partial class Cleanup : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "game_recipes"); + + migrationBuilder.DropTable( + name: "match_history"); + + migrationBuilder.DropTable( + name: "player_stats"); + + migrationBuilder.DropTable( + name: "game_items"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "game_items", + columns: table => new + { + Id = table.Column(type: "int", nullable: false), + AmmoType = table.Column(type: "int", nullable: false), + Category = table.Column(type: "int", nullable: false), + CraftCost = table.Column(type: "int", nullable: false), + CreatedAt = table.Column(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)"), + Damage = table.Column(type: "int", nullable: false), + DamageReduction = table.Column(type: "float", nullable: false), + DashCooldown = table.Column(type: "float", nullable: false), + DashDistance = table.Column(type: "float", nullable: false), + Description = table.Column(type: "varchar(256)", maxLength: 256, nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ExplosionRadius = table.Column(type: "float", nullable: false), + FireRate = table.Column(type: "float", nullable: false), + HarvestMultiplier = table.Column(type: "float", nullable: false), + HealAmount = table.Column(type: "int", nullable: false), + HealthBonus = table.Column(type: "int", nullable: false), + IsEnabled = table.Column(type: "tinyint(1)", nullable: false, defaultValue: true), + LootValue = table.Column(type: "int", nullable: false), + Name = table.Column(type: "varchar(64)", maxLength: 64, nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + PelletCount = table.Column(type: "int", nullable: false), + ProjectileSpeed = table.Column(type: "float", nullable: false), + Range = table.Column(type: "float", nullable: false), + ScanCooldown = table.Column(type: "float", nullable: false), + ScanRadius = table.Column(type: "float", nullable: false), + ShieldBoostDuration = table.Column(type: "float", nullable: false), + ShieldDuration = table.Column(type: "float", nullable: false), + ShieldHealth = table.Column(type: "int", nullable: false), + SpeedBoostDuration = table.Column(type: "float", nullable: false), + SpeedMultiplier = table.Column(type: "float", nullable: false), + SpeedPenalty = table.Column(type: "float", nullable: false), + Spread = table.Column(type: "float", nullable: false), + Stackable = table.Column(type: "tinyint(1)", nullable: false), + UpdatedAt = table.Column(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn) + }, + constraints: table => + { + table.PrimaryKey("PK_game_items", x => x.Id); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "match_history", + columns: table => new + { + Id = table.Column(type: "bigint unsigned", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + AccountId = table.Column(type: "bigint unsigned", nullable: false), + DamageDealt = table.Column(type: "int", nullable: false), + DamageTaken = table.Column(type: "int", nullable: false), + Deaths = table.Column(type: "int", nullable: false), + EloAfter = table.Column(type: "int", nullable: false), + EloChange = table.Column(type: "int", nullable: false), + EnergyCollected = table.Column(type: "int", nullable: false), + ItemsCrafted = table.Column(type: "int", nullable: false), + Kills = table.Column(type: "int", nullable: false), + MatchDurationSeconds = table.Column(type: "int", nullable: false), + MatchId = table.Column(type: "varchar(32)", maxLength: 32, nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Placement = table.Column(type: "int", nullable: false), + PlayedAt = table.Column(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)"), + RareCollected = table.Column(type: "int", nullable: false), + Result = table.Column(type: "int", nullable: false), + ScrapCollected = table.Column(type: "int", nullable: false), + SurvivalTimeSeconds = table.Column(type: "int", nullable: false), + TotalPlayers = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_match_history", x => x.Id); + table.ForeignKey( + name: "FK_match_history_accounts_AccountId", + column: x => x.AccountId, + principalTable: "accounts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "player_stats", + columns: table => new + { + Id = table.Column(type: "bigint unsigned", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + AccountId = table.Column(type: "bigint unsigned", nullable: false), + CreatedAt = table.Column(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)"), + Deaths = table.Column(type: "int", nullable: false), + Elo = table.Column(type: "int", nullable: false, defaultValue: 1000), + Extractions = table.Column(type: "int", nullable: false), + ItemsCrafted = table.Column(type: "int", nullable: false), + Kills = table.Column(type: "int", nullable: false), + LongestSurvivalSeconds = table.Column(type: "int", nullable: false), + Losses = table.Column(type: "int", nullable: false), + MatchesPlayed = table.Column(type: "int", nullable: false), + TotalDamageDealt = table.Column(type: "bigint", nullable: false), + TotalDamageTaken = table.Column(type: "bigint", nullable: false), + TotalEnergyCollected = table.Column(type: "bigint", nullable: false), + TotalPlayTimeSeconds = table.Column(type: "bigint", nullable: false), + TotalRareCollected = table.Column(type: "bigint", nullable: false), + TotalScrapCollected = table.Column(type: "bigint", nullable: false), + UpdatedAt = table.Column(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn), + Wins = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_player_stats", x => x.Id); + table.ForeignKey( + name: "FK_player_stats_accounts_AccountId", + column: x => x.AccountId, + principalTable: "accounts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "game_recipes", + columns: table => new + { + Id = table.Column(type: "int", nullable: false), + ResultItemId = table.Column(type: "int", nullable: false), + CreatedAt = table.Column(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)"), + EnergyCost = table.Column(type: "int", nullable: false), + IsEnabled = table.Column(type: "tinyint(1)", nullable: false, defaultValue: true), + RareCost = table.Column(type: "int", nullable: false), + ScrapCost = table.Column(type: "int", nullable: false), + UpdatedAt = table.Column(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn) + }, + constraints: table => + { + table.PrimaryKey("PK_game_recipes", x => x.Id); + table.ForeignKey( + name: "FK_game_recipes_game_items_ResultItemId", + column: x => x.ResultItemId, + principalTable: "game_items", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_game_items_Category", + table: "game_items", + column: "Category"); + + migrationBuilder.CreateIndex( + name: "IX_game_items_IsEnabled", + table: "game_items", + column: "IsEnabled"); + + migrationBuilder.CreateIndex( + name: "IX_game_recipes_IsEnabled", + table: "game_recipes", + column: "IsEnabled"); + + migrationBuilder.CreateIndex( + name: "IX_game_recipes_ResultItemId", + table: "game_recipes", + column: "ResultItemId"); + + migrationBuilder.CreateIndex( + name: "IX_match_history_AccountId", + table: "match_history", + column: "AccountId"); + + migrationBuilder.CreateIndex( + name: "IX_match_history_MatchId", + table: "match_history", + column: "MatchId"); + + migrationBuilder.CreateIndex( + name: "IX_match_history_PlayedAt", + table: "match_history", + column: "PlayedAt"); + + migrationBuilder.CreateIndex( + name: "IX_player_stats_AccountId", + table: "player_stats", + column: "AccountId", + unique: true); + } + } +} diff --git a/Migrations/GameDbContextModelSnapshot.cs b/Migrations/GameDbContextModelSnapshot.cs index 5707a01..185eccd 100644 --- a/Migrations/GameDbContextModelSnapshot.cs +++ b/Migrations/GameDbContextModelSnapshot.cs @@ -1,10 +1,10 @@ // using System; +using DataServer.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using DataServer.Data; #nullable disable @@ -1269,168 +1269,6 @@ namespace SystemRevivalServer.Migrations b.ToTable("equipment", (string)null); }); - modelBuilder.Entity("DataServer.Data.GameItem", b => - { - b.Property("Id") - .HasColumnType("int"); - - b.Property("AmmoType") - .HasColumnType("int"); - - b.Property("Category") - .HasColumnType("int"); - - b.Property("CraftCost") - .HasColumnType("int"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime(6)") - .HasDefaultValueSql("CURRENT_TIMESTAMP(6)"); - - b.Property("Damage") - .HasColumnType("int"); - - b.Property("DamageReduction") - .HasColumnType("float"); - - b.Property("DashCooldown") - .HasColumnType("float"); - - b.Property("DashDistance") - .HasColumnType("float"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("ExplosionRadius") - .HasColumnType("float"); - - b.Property("FireRate") - .HasColumnType("float"); - - b.Property("HarvestMultiplier") - .HasColumnType("float"); - - b.Property("HealAmount") - .HasColumnType("int"); - - b.Property("HealthBonus") - .HasColumnType("int"); - - b.Property("IsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("tinyint(1)") - .HasDefaultValue(true); - - b.Property("LootValue") - .HasColumnType("int"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("varchar(64)"); - - b.Property("PelletCount") - .HasColumnType("int"); - - b.Property("ProjectileSpeed") - .HasColumnType("float"); - - b.Property("Range") - .HasColumnType("float"); - - b.Property("ScanCooldown") - .HasColumnType("float"); - - b.Property("ScanRadius") - .HasColumnType("float"); - - b.Property("ShieldBoostDuration") - .HasColumnType("float"); - - b.Property("ShieldDuration") - .HasColumnType("float"); - - b.Property("ShieldHealth") - .HasColumnType("int"); - - b.Property("SpeedBoostDuration") - .HasColumnType("float"); - - b.Property("SpeedMultiplier") - .HasColumnType("float"); - - b.Property("SpeedPenalty") - .HasColumnType("float"); - - b.Property("Spread") - .HasColumnType("float"); - - b.Property("Stackable") - .HasColumnType("tinyint(1)"); - - b.Property("UpdatedAt") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("datetime(6)") - .HasDefaultValueSql("CURRENT_TIMESTAMP(6)"); - - MySqlPropertyBuilderExtensions.UseMySqlComputedColumn(b.Property("UpdatedAt")); - - b.HasKey("Id"); - - b.HasIndex("Category"); - - b.HasIndex("IsEnabled"); - - b.ToTable("game_items", (string)null); - }); - - modelBuilder.Entity("DataServer.Data.GameRecipe", b => - { - b.Property("Id") - .HasColumnType("int"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime(6)") - .HasDefaultValueSql("CURRENT_TIMESTAMP(6)"); - - b.Property("EnergyCost") - .HasColumnType("int"); - - b.Property("IsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("tinyint(1)") - .HasDefaultValue(true); - - b.Property("RareCost") - .HasColumnType("int"); - - b.Property("ResultItemId") - .HasColumnType("int"); - - b.Property("ScrapCost") - .HasColumnType("int"); - - b.Property("UpdatedAt") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("datetime(6)") - .HasDefaultValueSql("CURRENT_TIMESTAMP(6)"); - - MySqlPropertyBuilderExtensions.UseMySqlComputedColumn(b.Property("UpdatedAt")); - - b.HasKey("Id"); - - b.HasIndex("IsEnabled"); - - b.HasIndex("ResultItemId"); - - b.ToTable("game_recipes", (string)null); - }); - modelBuilder.Entity("DataServer.Data.InventoryItem", b => { b.Property("Id") @@ -1523,83 +1361,6 @@ namespace SystemRevivalServer.Migrations b.ToTable("item_templates", (string)null); }); - modelBuilder.Entity("DataServer.Data.MatchHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint unsigned"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("bigint unsigned"); - - b.Property("DamageDealt") - .HasColumnType("int"); - - b.Property("DamageTaken") - .HasColumnType("int"); - - b.Property("Deaths") - .HasColumnType("int"); - - b.Property("EloAfter") - .HasColumnType("int"); - - b.Property("EloChange") - .HasColumnType("int"); - - b.Property("EnergyCollected") - .HasColumnType("int"); - - b.Property("ItemsCrafted") - .HasColumnType("int"); - - b.Property("Kills") - .HasColumnType("int"); - - b.Property("MatchDurationSeconds") - .HasColumnType("int"); - - b.Property("MatchId") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("varchar(32)"); - - b.Property("Placement") - .HasColumnType("int"); - - b.Property("PlayedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime(6)") - .HasDefaultValueSql("CURRENT_TIMESTAMP(6)"); - - b.Property("RareCollected") - .HasColumnType("int"); - - b.Property("Result") - .HasColumnType("int"); - - b.Property("ScrapCollected") - .HasColumnType("int"); - - b.Property("SurvivalTimeSeconds") - .HasColumnType("int"); - - b.Property("TotalPlayers") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("MatchId"); - - b.HasIndex("PlayedAt"); - - b.ToTable("match_history", (string)null); - }); - modelBuilder.Entity("DataServer.Data.Old_Character", b => { b.Property("Id") @@ -1695,84 +1456,6 @@ namespace SystemRevivalServer.Migrations b.ToTable("characters", (string)null); }); - modelBuilder.Entity("DataServer.Data.PlayerStats", 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("Deaths") - .HasColumnType("int"); - - b.Property("Elo") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasDefaultValue(1000); - - b.Property("Extractions") - .HasColumnType("int"); - - b.Property("ItemsCrafted") - .HasColumnType("int"); - - b.Property("Kills") - .HasColumnType("int"); - - b.Property("LongestSurvivalSeconds") - .HasColumnType("int"); - - b.Property("Losses") - .HasColumnType("int"); - - b.Property("MatchesPlayed") - .HasColumnType("int"); - - b.Property("TotalDamageDealt") - .HasColumnType("bigint"); - - b.Property("TotalDamageTaken") - .HasColumnType("bigint"); - - b.Property("TotalEnergyCollected") - .HasColumnType("bigint"); - - b.Property("TotalPlayTimeSeconds") - .HasColumnType("bigint"); - - b.Property("TotalRareCollected") - .HasColumnType("bigint"); - - b.Property("TotalScrapCollected") - .HasColumnType("bigint"); - - b.Property("UpdatedAt") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("datetime(6)") - .HasDefaultValueSql("CURRENT_TIMESTAMP(6)"); - - MySqlPropertyBuilderExtensions.UseMySqlComputedColumn(b.Property("UpdatedAt")); - - b.Property("Wins") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("AccountId") - .IsUnique(); - - b.ToTable("player_stats", (string)null); - }); - modelBuilder.Entity("DataServer.Data.Session", b => { b.Property("Id") @@ -2167,17 +1850,6 @@ namespace SystemRevivalServer.Migrations b.Navigation("Old_Character"); }); - modelBuilder.Entity("DataServer.Data.GameRecipe", b => - { - b.HasOne("DataServer.Data.GameItem", "ResultItem") - .WithMany() - .HasForeignKey("ResultItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ResultItem"); - }); - modelBuilder.Entity("DataServer.Data.InventoryItem", b => { b.HasOne("DataServer.Data.Old_Character", "Old_Character") @@ -2197,17 +1869,6 @@ namespace SystemRevivalServer.Migrations b.Navigation("Old_Character"); }); - modelBuilder.Entity("DataServer.Data.MatchHistory", b => - { - b.HasOne("DataServer.Data.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - }); - modelBuilder.Entity("DataServer.Data.Old_Character", b => { b.HasOne("DataServer.Data.Account", "Account") @@ -2227,17 +1888,6 @@ namespace SystemRevivalServer.Migrations b.Navigation("Zone"); }); - modelBuilder.Entity("DataServer.Data.PlayerStats", b => - { - b.HasOne("DataServer.Data.Account", "Account") - .WithOne() - .HasForeignKey("DataServer.Data.PlayerStats", "AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - }); - modelBuilder.Entity("DataServer.Data.Session", b => { b.HasOne("DataServer.Data.Account", "Account") diff --git a/Program.cs b/Program.cs index 1017379..eaae2e9 100644 --- a/Program.cs +++ b/Program.cs @@ -72,16 +72,12 @@ builder.Services.AddSingleton(); // Message handlers builder.Services.AddSingleton(); -// Void Scavengers game -//builder.Services.AddSingleton(); -//builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddSingleton(sp => sp.GetRequiredService()); builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); -builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); diff --git a/Services/Admin/Pages/Login.cshtml b/Services/Admin/Pages/Login.cshtml index 3cfb7c7..6ade102 100644 --- a/Services/Admin/Pages/Login.cshtml +++ b/Services/Admin/Pages/Login.cshtml @@ -23,7 +23,7 @@ -

Void Scavengers

+

Dungeon Divers

Admin Panel

diff --git a/Services/Admin/Pages/Shared/_Layout.cshtml b/Services/Admin/Pages/Shared/_Layout.cshtml index cc4aefb..654b7b2 100644 --- a/Services/Admin/Pages/Shared/_Layout.cshtml +++ b/Services/Admin/Pages/Shared/_Layout.cshtml @@ -4,7 +4,7 @@ - @ViewData["Title"] - Void Scavengers Admin + @ViewData["Title"] - Dungeon Divers Admin