diff --git a/Game/Dungeon/DungeonSimulation.cs b/Game/Dungeon/DungeonSimulation.cs index 74df126..f4449b2 100644 --- a/Game/Dungeon/DungeonSimulation.cs +++ b/Game/Dungeon/DungeonSimulation.cs @@ -27,24 +27,33 @@ public class DungeonSimulation public ConcurrentDictionary DroppedItems { get; } = new(); public ConcurrentDictionary Portals { get; } = new(); public ConcurrentDictionary LootChests { get; } = new(); + public ConcurrentDictionary Projectiles { get; } = new(); + public ConcurrentDictionary HazardZones { get; } = new(); - // ID generator for loot chests + // ID generators private int _nextLootChestId = 1; + private int _nextProjectileId = 1; + private int _nextHazardId = 1; public int GetNextLootChestId() => _nextLootChestId++; + public int GetNextProjectileId() => _nextProjectileId++; + public int GetNextHazardId() => _nextHazardId++; // Combat tracking private readonly List _pendingDamageEvents = new(); private readonly List _pendingDeathEvents = new(); + private readonly List _pendingAbilityEvents = new(); private int _nextDroppedItemId = 1; private readonly Dictionary _mobDefinitions; + private readonly Dictionary? _abilityDefinitions; - public DungeonSimulation(DungeonLayout layout, int tier, Dictionary mobDefinitions, int bracketMin = 1) + public DungeonSimulation(DungeonLayout layout, int tier, Dictionary mobDefinitions, int bracketMin = 1, Dictionary? abilityDefinitions = null) { Layout = layout; Tier = tier; BracketMin = bracketMin; _mobDefinitions = mobDefinitions; + _abilityDefinitions = abilityDefinitions; SpawnMobs(); InitializeChests(); @@ -110,7 +119,7 @@ public class DungeonSimulation // Use bracket-aware stat scaling var stats = mobDef.GetStatsForBracket(BracketMin); - Mobs[mobSpawn.Id] = new MobInstance + var mob = new MobInstance { Id = mobSpawn.Id, DefinitionId = mobDef.Id, @@ -121,13 +130,67 @@ public class DungeonSimulation SpawnY = mobSpawn.Y * 32 + 16, Health = stats.MaxHealth, MaxHealth = stats.MaxHealth, + Mana = mobDef.BaseMana, + MaxMana = mobDef.BaseMana, Stats = stats, State = MobState.Idle, SpriteConfigJson = mobDef.SpriteConfigJson, TintColor = mobDef.TintColor, Scale = mobDef.Scale, - Type = mobDef.Type + Type = mobDef.Type, + Behavior = mobDef.Behavior, + PreferredRange = mobDef.PreferredRange, + FleeThreshold = mobDef.FleeThreshold, + Phases = mobDef.Phases, + CurrentAnimation = "idle_down", + FacingDirection = "down" }; + + // Load abilities for this mob + if (_abilityDefinitions != null && mobDef.AbilityAssignments != null) + { + foreach (var assignment in mobDef.AbilityAssignments.Where(a => a.IsEnabled)) + { + if (_abilityDefinitions.TryGetValue(assignment.AbilityDefinitionId, out var abilityDef)) + { + mob.Abilities.Add(new MobAbilityState + { + AbilityId = abilityDef.Id, + Definition = abilityDef, + CooldownRemaining = 0, + Priority = assignment.PriorityOverride ?? abilityDef.Priority, + Phase = assignment.Phase, + MinHpPercent = assignment.MinHpPercent, + MaxHpPercent = assignment.MaxHpPercent + }); + } + } + } + + // If no abilities loaded, give a basic attack + if (mob.Abilities.Count == 0) + { + mob.Abilities.Add(new MobAbilityState + { + AbilityId = 0, + Definition = new MobAbilityDefinition + { + Id = 0, + Name = "Basic Attack", + Key = "basic_attack", + AbilityType = MobAbilityType.MeleeAttack, + BaseDamage = stats.PhysicalDamage, + Range = stats.AttackRange, + Cooldown = 1f / stats.AttackSpeed, + AnimationKey = "attack", + DamageTypeKey = stats.DamageTypeKey + }, + CooldownRemaining = 0, + Priority = 1 + }); + } + + Mobs[mobSpawn.Id] = mob; } } @@ -181,14 +244,35 @@ public class DungeonSimulation _pendingDamageEvents.Clear(); _pendingDeathEvents.Clear(); + _pendingAbilityEvents.Clear(); // Update all mobs (AI) foreach (var mob in Mobs.Values.Where(m => m.IsAlive)) { - UpdateMob(mob); + MobAI.UpdateMob(mob, this, TickDelta); + + // Process mob attacks if in attacking state + if (mob.State == MobState.Attacking && mob.TargetId.HasValue) + { + float attackInterval = 1f / mob.Stats.AttackSpeed; + if (CurrentTick - mob.LastAttackTick >= (long)(attackInterval * TicksPerSecond)) + { + if (Players.TryGetValue(mob.TargetId.Value, out var target) && target.IsAlive) + { + ProcessMobAbility(mob, target); + } + mob.LastAttackTick = CurrentTick; + } + } } - // Update players (movement, regeneration) + // Update projectiles + UpdateProjectiles(); + + // Update hazard zones + UpdateHazardZones(); + + // Update players (movement, regeneration, status effects) foreach (var player in Players.Values.Where(p => p.IsAlive)) { UpdatePlayer(player); @@ -205,96 +289,415 @@ public class DungeonSimulation { DamageEvents = new List(_pendingDamageEvents), DeathEvents = new List(_pendingDeathEvents), + AbilityEvents = new List(_pendingAbilityEvents), Phase = Phase }; } - private void UpdateMob(MobInstance mob) + /// + /// Process a mob's ability/attack against a target + /// + private void ProcessMobAbility(MobInstance mob, PlayerInstance target) { - // Find closest player - PlayerInstance? target = null; - float closestDist = float.MaxValue; + // Find the best available ability + var ability = mob.Abilities + .Where(a => a.IsAvailable(mob.HpPercent)) + .Where(a => a.Phase == 0 || a.Phase == mob.CurrentPhase) + .OrderByDescending(a => a.Priority) + .FirstOrDefault(); - foreach (var player in Players.Values.Where(p => p.IsAlive)) - { - float dist = Distance(mob.X, mob.Y, player.X, player.Y); - if (dist < closestDist) - { - closestDist = dist; - target = player; - } - } + if (ability == null) return; - if (target == null) - { - mob.State = MobState.Returning; - mob.TargetId = null; - MoveToward(mob, mob.SpawnX, mob.SpawnY, mob.Stats.MoveSpeed * 0.5f); - return; - } + float distance = Distance(mob.X, mob.Y, target.X, target.Y); + if (ability.Definition.Range > 0 && distance > ability.Definition.Range) return; - if (closestDist <= mob.Stats.AggroRange) + // Put ability on cooldown + ability.CooldownRemaining = ability.Definition.Cooldown; + + // Emit ability event for client animation + _pendingAbilityEvents.Add(new AbilityEvent { - mob.TargetId = target.CharacterId; - - float distFromSpawn = Distance(mob.X, mob.Y, mob.SpawnX, mob.SpawnY); - if (distFromSpawn > mob.Stats.LeashRange) - { - mob.State = MobState.Returning; - mob.TargetId = null; - MoveToward(mob, mob.SpawnX, mob.SpawnY, mob.Stats.MoveSpeed); - mob.Health = Math.Min(mob.MaxHealth, mob.Health + (int)(mob.MaxHealth * 0.02f)); - return; - } - - if (closestDist <= mob.Stats.AttackRange) - { - mob.State = MobState.Attacking; + SourceType = EntityType.Mob, + SourceId = mob.Id, + AbilityKey = ability.Definition.Key, + AnimationKey = ability.Definition.AnimationKey, + TargetX = target.X, + TargetY = target.Y, + TargetId = (int)target.CharacterId + }); + + // Process ability based on type + switch (ability.Definition.AbilityType) + { + case MobAbilityType.MeleeAttack: + case MobAbilityType.Cleave: + ProcessMeleeAbility(mob, ability.Definition, target); + break; - float attackInterval = 1f / mob.Stats.AttackSpeed; - if (CurrentTick - mob.LastAttackTick >= (long)(attackInterval * TicksPerSecond)) - { - MobAttackPlayer(mob, target); - mob.LastAttackTick = CurrentTick; - } - } - else - { - mob.State = MobState.Chasing; - MoveToward(mob, target.X, target.Y, mob.Stats.MoveSpeed); - } - } - else - { - mob.State = MobState.Idle; - mob.TargetId = null; + case MobAbilityType.ProjectileSingle: + case MobAbilityType.ProjectileAoe: + SpawnProjectile(mob, ability.Definition, target); + break; + + case MobAbilityType.GroundAoe: + case MobAbilityType.ConeAttack: + ProcessAoeAbility(mob, ability.Definition, target.X, target.Y); + break; + + case MobAbilityType.Poison: + case MobAbilityType.Bleed: + case MobAbilityType.Burn: + ApplyDotToPlayer(mob, ability.Definition, target); + break; + + case MobAbilityType.Stun: + case MobAbilityType.Slow: + case MobAbilityType.Root: + case MobAbilityType.Fear: + ApplyStatusToPlayer(ability.Definition, target); + break; + + case MobAbilityType.Knockback: + ApplyKnockback(mob, ability.Definition, target); + break; + + case MobAbilityType.Pull: + ApplyPull(mob, ability.Definition, target); + break; + + case MobAbilityType.HazardZone: + SpawnHazardZone(mob, ability.Definition, target.X, target.Y); + break; } } - private void MobAttackPlayer(MobInstance mob, PlayerInstance player) + private void ProcessMeleeAbility(MobInstance mob, MobAbilityDefinition ability, PlayerInstance target) { - // Use mob's configured damage type key - string damageTypeKey = mob.Stats.DamageTypeKey ?? "physical"; - int baseDamage = mob.Stats.PhysicalDamage + mob.Stats.MagicDamage; + int damage = ability.BaseDamage; + string damageTypeKey = ability.DamageTypeKey ?? "physical"; - // Calculate damage with resistances var result = CombatCalculator.CalculateMobToPlayerDamage( - mob, player, damageTypeKey, baseDamage, player.Resistances); + mob, target, damageTypeKey, damage, target.Resistances); - player.Health -= result.FinalDamage; + ApplyDamageToPlayer(mob, target, result.FinalDamage, damageTypeKey, result.WasResisted, result.WasWeakness); + + // Cleave hits other nearby players + if (ability.AbilityType == MobAbilityType.Cleave && ability.AoeRadius > 0) + { + foreach (var other in Players.Values.Where(p => p.IsAlive && p.CharacterId != target.CharacterId)) + { + if (Distance(mob.X, mob.Y, other.X, other.Y) <= ability.AoeRadius) + { + var otherResult = CombatCalculator.CalculateMobToPlayerDamage( + mob, other, damageTypeKey, damage, other.Resistances); + ApplyDamageToPlayer(mob, other, otherResult.FinalDamage, damageTypeKey, otherResult.WasResisted, otherResult.WasWeakness); + } + } + } + } + + private void SpawnProjectile(MobInstance mob, MobAbilityDefinition ability, PlayerInstance target) + { + var projectile = new ProjectileInstance + { + Id = GetNextProjectileId(), + SourceMobId = mob.Id, + AbilityId = ability.Id, + X = mob.X, + Y = mob.Y, + TargetX = target.X, + TargetY = target.Y, + Speed = ability.ProjectileSpeed, + Damage = ability.BaseDamage, + DamageTypeKey = ability.DamageTypeKey, + AoeRadius = ability.AoeRadius, + SpriteKey = ability.ProjectileSprite ?? "projectile_default" + }; + + // Calculate direction + float dx = target.X - mob.X; + float dy = target.Y - mob.Y; + float dist = MathF.Sqrt(dx * dx + dy * dy); + if (dist > 0) + { + projectile.VelocityX = (dx / dist) * ability.ProjectileSpeed; + projectile.VelocityY = (dy / dist) * ability.ProjectileSpeed; + } + + Projectiles[projectile.Id] = projectile; + } + + private void UpdateProjectiles() + { + var toRemove = new List(); + + foreach (var projectile in Projectiles.Values) + { + // Move projectile + projectile.X += projectile.VelocityX * TickDelta; + projectile.Y += projectile.VelocityY * TickDelta; + projectile.DistanceTraveled += MathF.Sqrt( + projectile.VelocityX * projectile.VelocityX + + projectile.VelocityY * projectile.VelocityY) * TickDelta; + + // Check max range + if (projectile.DistanceTraveled > 500) + { + toRemove.Add(projectile.Id); + continue; + } + + // Check collision with players + foreach (var player in Players.Values.Where(p => p.IsAlive)) + { + if (Distance(projectile.X, projectile.Y, player.X, player.Y) < 20) + { + // Hit! + if (projectile.AoeRadius > 0) + { + // AOE explosion + ProcessAoeAbilityAtLocation(projectile, projectile.X, projectile.Y); + } + else + { + // Single target + if (Mobs.TryGetValue(projectile.SourceMobId, out var sourceMob)) + { + var result = CombatCalculator.CalculateMobToPlayerDamage( + sourceMob, player, projectile.DamageTypeKey, projectile.Damage, player.Resistances); + ApplyDamageToPlayer(sourceMob, player, result.FinalDamage, projectile.DamageTypeKey, result.WasResisted, result.WasWeakness); + } + } + toRemove.Add(projectile.Id); + break; + } + } + + // Check wall collision + if (!CanMoveTo(projectile.X, projectile.Y)) + { + if (projectile.AoeRadius > 0) + { + ProcessAoeAbilityAtLocation(projectile, projectile.X, projectile.Y); + } + toRemove.Add(projectile.Id); + } + } + + foreach (var id in toRemove) + { + Projectiles.TryRemove(id, out _); + } + } + + private void ProcessAoeAbility(MobInstance mob, MobAbilityDefinition ability, float targetX, float targetY) + { + foreach (var player in Players.Values.Where(p => p.IsAlive)) + { + if (Distance(targetX, targetY, player.X, player.Y) <= ability.AoeRadius) + { + var result = CombatCalculator.CalculateMobToPlayerDamage( + mob, player, ability.DamageTypeKey, ability.BaseDamage, player.Resistances); + ApplyDamageToPlayer(mob, player, result.FinalDamage, ability.DamageTypeKey, result.WasResisted, result.WasWeakness); + } + } + } + + private void ProcessAoeAbilityAtLocation(ProjectileInstance projectile, float x, float y) + { + if (!Mobs.TryGetValue(projectile.SourceMobId, out var sourceMob)) return; + + foreach (var player in Players.Values.Where(p => p.IsAlive)) + { + if (Distance(x, y, player.X, player.Y) <= projectile.AoeRadius) + { + var result = CombatCalculator.CalculateMobToPlayerDamage( + sourceMob, player, projectile.DamageTypeKey, projectile.Damage, player.Resistances); + ApplyDamageToPlayer(sourceMob, player, result.FinalDamage, projectile.DamageTypeKey, result.WasResisted, result.WasWeakness); + } + } + } + + private void ApplyDotToPlayer(MobInstance mob, MobAbilityDefinition ability, PlayerInstance target) + { + // First apply initial hit if any + if (ability.BaseDamage > 0) + { + var result = CombatCalculator.CalculateMobToPlayerDamage( + mob, target, ability.DamageTypeKey, ability.BaseDamage, target.Resistances); + ApplyDamageToPlayer(mob, target, result.FinalDamage, ability.DamageTypeKey, result.WasResisted, result.WasWeakness); + } + + // Apply DOT status effect + string effectType = ability.AbilityType switch + { + MobAbilityType.Poison => "poison", + MobAbilityType.Bleed => "bleed", + MobAbilityType.Burn => "burn", + _ => "dot" + }; + + target.StatusEffects.Add(new PlayerStatusEffect + { + EffectType = effectType, + Duration = ability.EffectDuration, + TickInterval = ability.DotTickInterval, + NextTickIn = ability.DotTickInterval, + DamagePerTick = ability.DotDamagePerTick, + SourceMobId = mob.Id + }); + } + + private void ApplyStatusToPlayer(MobAbilityDefinition ability, PlayerInstance target) + { + string effectType = ability.AbilityType switch + { + MobAbilityType.Stun => "stun", + MobAbilityType.Slow => "slow", + MobAbilityType.Root => "root", + MobAbilityType.Fear => "fear", + MobAbilityType.Silence => "silence", + _ => "debuff" + }; + + target.StatusEffects.Add(new PlayerStatusEffect + { + EffectType = effectType, + Duration = ability.EffectDuration, + Modifier = ability.SpeedModifier + }); + } + + private void ApplyKnockback(MobInstance mob, MobAbilityDefinition ability, PlayerInstance target) + { + // Apply damage first + if (ability.BaseDamage > 0) + { + var result = CombatCalculator.CalculateMobToPlayerDamage( + mob, target, ability.DamageTypeKey, ability.BaseDamage, target.Resistances); + ApplyDamageToPlayer(mob, target, result.FinalDamage, ability.DamageTypeKey, result.WasResisted, result.WasWeakness); + } + + // Calculate knockback direction (away from mob) + float dx = target.X - mob.X; + float dy = target.Y - mob.Y; + float dist = MathF.Sqrt(dx * dx + dy * dy); + + if (dist > 0) + { + float newX = target.X + (dx / dist) * ability.DisplacementDistance; + float newY = target.Y + (dy / dist) * ability.DisplacementDistance; + + if (CanMoveTo(newX, target.Y)) target.X = newX; + if (CanMoveTo(target.X, newY)) target.Y = newY; + } + } + + private void ApplyPull(MobInstance mob, MobAbilityDefinition ability, PlayerInstance target) + { + // Calculate pull direction (toward mob) + float dx = mob.X - target.X; + float dy = mob.Y - target.Y; + float dist = MathF.Sqrt(dx * dx + dy * dy); + + if (dist > 0) + { + float pullDist = Math.Min(ability.DisplacementDistance, dist - 30); // Don't pull on top of mob + if (pullDist > 0) + { + float newX = target.X + (dx / dist) * pullDist; + float newY = target.Y + (dy / dist) * pullDist; + + if (CanMoveTo(newX, target.Y)) target.X = newX; + if (CanMoveTo(target.X, newY)) target.Y = newY; + } + } + } + + private void SpawnHazardZone(MobInstance mob, MobAbilityDefinition ability, float x, float y) + { + var hazard = new HazardZone + { + Id = GetNextHazardId(), + SourceMobId = mob.Id, + X = x, + Y = y, + Radius = ability.AoeRadius, + DamagePerTick = ability.DotDamagePerTick, + TickInterval = ability.DotTickInterval, + Duration = ability.EffectDuration, + NextTickIn = ability.DotTickInterval, + DamageTypeKey = ability.DamageTypeKey, + VisualKey = ability.VisualEffectKey ?? "hazard_default" + }; + + HazardZones[hazard.Id] = hazard; + } + + private void UpdateHazardZones() + { + var toRemove = new List(); + + foreach (var hazard in HazardZones.Values) + { + hazard.Duration -= TickDelta; + hazard.NextTickIn -= TickDelta; + + if (hazard.Duration <= 0) + { + toRemove.Add(hazard.Id); + continue; + } + + if (hazard.NextTickIn <= 0) + { + hazard.NextTickIn = hazard.TickInterval; + + // Damage players in zone + MobInstance? sourceMob = null; + Mobs.TryGetValue(hazard.SourceMobId, out sourceMob); + + foreach (var player in Players.Values.Where(p => p.IsAlive)) + { + if (Distance(hazard.X, hazard.Y, player.X, player.Y) <= hazard.Radius) + { + if (sourceMob != null) + { + var result = CombatCalculator.CalculateMobToPlayerDamage( + sourceMob, player, hazard.DamageTypeKey, hazard.DamagePerTick, player.Resistances); + ApplyDamageToPlayer(sourceMob, player, result.FinalDamage, hazard.DamageTypeKey, result.WasResisted, result.WasWeakness); + } + else + { + ApplyDamageToPlayer(null, player, hazard.DamagePerTick, hazard.DamageTypeKey, false, false); + } + } + } + } + } + + foreach (var id in toRemove) + { + HazardZones.TryRemove(id, out _); + } + } + + private void ApplyDamageToPlayer(MobInstance? mob, PlayerInstance player, int damage, string damageTypeKey, bool wasResisted, bool wasWeakness) + { + player.Health -= damage; player.IsInCombat = true; player.LastCombatTick = CurrentTick; _pendingDamageEvents.Add(new DamageEvent { SourceType = EntityType.Mob, - SourceId = mob.Id, + SourceId = mob?.Id ?? 0, TargetType = EntityType.Player, TargetId = (int)player.CharacterId, - Damage = result.FinalDamage, + Damage = damage, DamageTypeKey = damageTypeKey, - WasResisted = result.WasResisted, - WasWeakness = result.WasWeakness + WasResisted = wasResisted, + WasWeakness = wasWeakness }); if (player.Health <= 0) @@ -308,32 +711,66 @@ public class DungeonSimulation EntityId = (int)player.CharacterId, EntityName = player.CharacterName, KillerType = EntityType.Mob, - KillerId = mob.Id, - KillerName = mob.Name + KillerId = mob?.Id ?? 0, + KillerName = mob?.Name ?? "Hazard" }); } } private void UpdatePlayer(PlayerInstance player) { - // Process movement input - if (player.InputX != 0 || player.InputY != 0) + // Update status effects first + UpdatePlayerStatusEffects(player); + + // If stunned, can't do anything + if (player.IsStunned) return; + + // Process movement input (unless rooted or feared) + if (!player.IsRooted && !player.IsFeared) { - float speed = player.MoveSpeed * TickDelta; - float newX = player.X + player.InputX * speed; - float newY = player.Y + player.InputY * speed; - - if (CanMoveTo(newX, player.Y)) player.X = newX; - if (CanMoveTo(player.X, newY)) player.Y = newY; - if (player.InputX != 0 || player.InputY != 0) { - player.Rotation = MathF.Atan2(player.InputY, player.InputX); + float speedMod = player.GetSpeedModifier(); + float speed = player.MoveSpeed * speedMod * TickDelta; + float newX = player.X + player.InputX * speed; + float newY = player.Y + player.InputY * speed; + + if (CanMoveTo(newX, player.Y)) player.X = newX; + if (CanMoveTo(player.X, newY)) player.Y = newY; + + if (player.InputX != 0 || player.InputY != 0) + { + player.Rotation = MathF.Atan2(player.InputY, player.InputX); + } } } - // Process attack - if (player.WantsToAttack && player.AttackTargetId.HasValue) + // If feared, run away from nearest mob + if (player.IsFeared) + { + var nearestMob = Mobs.Values + .Where(m => m.IsAlive) + .OrderBy(m => Distance(player.X, player.Y, m.X, m.Y)) + .FirstOrDefault(); + + if (nearestMob != null) + { + float dx = player.X - nearestMob.X; + float dy = player.Y - nearestMob.Y; + float dist = MathF.Sqrt(dx * dx + dy * dy); + if (dist > 0) + { + float speed = player.MoveSpeed * 1.2f * TickDelta; // Run faster when feared + float newX = player.X + (dx / dist) * speed; + float newY = player.Y + (dy / dist) * speed; + if (CanMoveTo(newX, player.Y)) player.X = newX; + if (CanMoveTo(player.X, newY)) player.Y = newY; + } + } + } + + // Process attack (unless stunned or silenced for abilities) + if (!player.IsStunned && player.WantsToAttack && player.AttackTargetId.HasValue) { TryPlayerAttack(player, player.AttackTargetId.Value); player.WantsToAttack = false; @@ -349,6 +786,65 @@ public class DungeonSimulation } } + private void UpdatePlayerStatusEffects(PlayerInstance player) + { + var expired = new List(); + + foreach (var effect in player.StatusEffects) + { + effect.Duration -= TickDelta; + + // Handle DOT + if (effect.DamagePerTick > 0) + { + effect.NextTickIn -= TickDelta; + if (effect.NextTickIn <= 0) + { + player.Health -= effect.DamagePerTick; + player.IsInCombat = true; + player.LastCombatTick = CurrentTick; + effect.NextTickIn = effect.TickInterval; + + _pendingDamageEvents.Add(new DamageEvent + { + SourceType = EntityType.Mob, + SourceId = effect.SourceMobId, + TargetType = EntityType.Player, + TargetId = (int)player.CharacterId, + Damage = effect.DamagePerTick, + DamageTypeKey = effect.EffectType + }); + + if (player.Health <= 0) + { + player.Health = 0; + player.IsAlive = false; + + string killerName = "DOT"; + if (Mobs.TryGetValue(effect.SourceMobId, out var mob)) + killerName = mob.Name; + + _pendingDeathEvents.Add(new DeathEvent + { + EntityType = EntityType.Player, + EntityId = (int)player.CharacterId, + EntityName = player.CharacterName, + KillerType = EntityType.Mob, + KillerId = effect.SourceMobId, + KillerName = killerName + }); + } + } + } + + if (effect.Duration <= 0) + expired.Add(effect); + } + + foreach (var e in expired) + player.StatusEffects.Remove(e); + } + private void TryPlayerAttack(PlayerInstance player, ulong targetId) { if (!Mobs.TryGetValue((int)targetId, out var mob) || !mob.IsAlive) diff --git a/Game/Dungeon/PlayerInstance.cs b/Game/Dungeon/PlayerInstance.cs index 7357537..a328144 100644 --- a/Game/Dungeon/PlayerInstance.cs +++ b/Game/Dungeon/PlayerInstance.cs @@ -39,6 +39,11 @@ public class PlayerInstance /// public Dictionary Resistances { get; set; } = new(); + /// + /// Active status effects on this player + /// + public List StatusEffects { get; set; } = new(); + public bool IsAlive { get; set; } = true; public bool IsInCombat { get; set; } @@ -56,4 +61,41 @@ public class PlayerInstance public float InputY { get; set; } public bool WantsToAttack { get; set; } public ulong? AttackTargetId { get; set; } + + /// Check if player is stunned + public bool IsStunned => StatusEffects.Any(e => e.EffectType == "stun" && e.Duration > 0); + + /// Check if player is rooted + public bool IsRooted => StatusEffects.Any(e => e.EffectType == "root" && e.Duration > 0); + + /// Check if player is feared + public bool IsFeared => StatusEffects.Any(e => e.EffectType == "fear" && e.Duration > 0); + + /// Check if player is silenced + public bool IsSilenced => StatusEffects.Any(e => e.EffectType == "silence" && e.Duration > 0); + + /// Get current speed modifier from status effects + public float GetSpeedModifier() + { + float modifier = 1.0f; + foreach (var effect in StatusEffects.Where(e => e.EffectType == "slow" && e.Duration > 0)) + { + modifier *= effect.Modifier; + } + return modifier; + } +} + +/// +/// A status effect applied to a player +/// +public class PlayerStatusEffect +{ + public string EffectType { get; set; } = ""; // poison, bleed, burn, slow, stun, root, fear, silence + public float Duration { get; set; } + public float TickInterval { get; set; } + public float NextTickIn { get; set; } + public int DamagePerTick { get; set; } + public float Modifier { get; set; } = 1.0f; // For slow, etc. + public int SourceMobId { get; set; } } diff --git a/Game/Dungeon/ProjectileInstance.cs b/Game/Dungeon/ProjectileInstance.cs new file mode 100644 index 0000000..738ed0a --- /dev/null +++ b/Game/Dungeon/ProjectileInstance.cs @@ -0,0 +1,64 @@ +namespace Server.Game.Dungeon; + +/// +/// A projectile in flight +/// +public class ProjectileInstance +{ + public int Id { get; set; } + public int SourceMobId { get; set; } + public int AbilityId { get; set; } + + public float X { get; set; } + public float Y { get; set; } + public float VelocityX { get; set; } + public float VelocityY { get; set; } + public float Speed { get; set; } + + public float TargetX { get; set; } + public float TargetY { get; set; } + + public int Damage { get; set; } + public string DamageTypeKey { get; set; } = "physical"; + public float AoeRadius { get; set; } + + public float DistanceTraveled { get; set; } + public float MaxRange { get; set; } = 500f; + + public string SpriteKey { get; set; } = "projectile_default"; +} + +/// +/// A persistent damage zone on the ground +/// +public class HazardZone +{ + public int Id { get; set; } + public int SourceMobId { get; set; } + + public float X { get; set; } + public float Y { get; set; } + public float Radius { get; set; } + + public int DamagePerTick { get; set; } + public float TickInterval { get; set; } + public float NextTickIn { get; set; } + public float Duration { get; set; } + + public string DamageTypeKey { get; set; } = "fire"; + public string VisualKey { get; set; } = "hazard_default"; +} + +/// +/// Event when an ability is used (for client animations) +/// +public class AbilityEvent +{ + public EntityType SourceType { get; set; } + public int SourceId { get; set; } + public string AbilityKey { get; set; } = ""; + public string AnimationKey { get; set; } = "attack"; + public float TargetX { get; set; } + public float TargetY { get; set; } + public int? TargetId { get; set; } +} diff --git a/Game/Dungeon/TickResult.cs b/Game/Dungeon/TickResult.cs index 2d563e5..d1b6422 100644 --- a/Game/Dungeon/TickResult.cs +++ b/Game/Dungeon/TickResult.cs @@ -4,6 +4,7 @@ public class TickResult { public List DamageEvents { get; set; } = new(); public List DeathEvents { get; set; } = new(); + public List AbilityEvents { get; set; } = new(); public DungeonPhase Phase { get; set; } } diff --git a/Migrations/20251227162034_Mobv2 p2.Designer.cs b/Migrations/20251227162034_Mobv2 p2.Designer.cs new file mode 100644 index 0000000..d769b04 --- /dev/null +++ b/Migrations/20251227162034_Mobv2 p2.Designer.cs @@ -0,0 +1,1941 @@ +// +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("20251227162034_Mobv2 p2")] + partial class Mobv2p2 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + + modelBuilder.Entity("DataServer.Data.Account", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BannedUntil") + .HasColumnType("datetime(6)"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("datetime(6)") + .HasDefaultValueSql("CURRENT_TIMESTAMP(6)"); + + b.Property("Email") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("IsBanned") + .HasColumnType("tinyint(1)"); + + b.Property("PasswordHash") + .IsRequired() + .HasColumnType("varbinary(64)"); + + b.Property("PasswordSalt") + .IsRequired() + .HasColumnType("varbinary(32)"); + + b.Property("Role") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("UpdatedAt") + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("datetime(6)") + .HasDefaultValueSql("CURRENT_TIMESTAMP(6)"); + + MySqlPropertyBuilderExtensions.UseMySqlComputedColumn(b.Property("UpdatedAt")); + + b.Property("Username") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.HasKey("Id"); + + b.HasIndex("Email") + .IsUnique(); + + b.HasIndex("Username") + .IsUnique(); + + b.ToTable("accounts", (string)null); + }); + + modelBuilder.Entity("DataServer.Data.Entities.ClientAsset", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AssetType") + .HasColumnType("int"); + + b.Property("CdnPath") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("FileHash") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("FilePath") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("IsRequired") + .HasColumnType("tinyint(1)"); + + b.Property("MinClientVersion") + .HasMaxLength(16) + .HasColumnType("varchar(16)"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("client_assets"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DamageResistanceType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Color") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("varchar(16)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("IconPath") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Key") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("SortOrder") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("damage_resistance_types"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DeathChest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("DungeonInstanceId") + .HasColumnType("char(36)"); + + b.Property("EmptiedAt") + .HasColumnType("datetime(6)"); + + b.Property("GoldAmount") + .HasColumnType("bigint"); + + b.Property("IsEmpty") + .HasColumnType("tinyint(1)"); + + b.Property("OwnerCharacterId") + .HasColumnType("bigint unsigned"); + + b.Property("VictimCharacterId") + .HasColumnType("bigint unsigned"); + + b.Property("VictimMobDefinitionId") + .HasColumnType("int"); + + b.Property("X") + .HasColumnType("float"); + + b.Property("Y") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.HasIndex("OwnerCharacterId"); + + b.HasIndex("VictimCharacterId"); + + b.ToTable("dungeon_death_chests"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DeathChestItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("DeathChestId") + .HasColumnType("bigint unsigned"); + + b.Property("IsTaken") + .HasColumnType("tinyint(1)"); + + b.Property("ItemDefinitionId") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("SlotIndex") + .HasColumnType("int"); + + b.Property("TakenAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("DeathChestId"); + + b.HasIndex("ItemDefinitionId"); + + b.ToTable("dungeon_death_chest_items"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonBeltItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CharacterId") + .HasColumnType("bigint unsigned"); + + b.Property("InventorySlotIndex") + .HasColumnType("int"); + + b.Property("SlotIndex") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CharacterId"); + + b.ToTable("dungeon_belt_items"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacter", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint unsigned"); + + b.Property("BossesKilled") + .HasColumnType("int"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CurrentHealth") + .HasColumnType("int"); + + b.Property("CurrentMana") + .HasColumnType("int"); + + b.Property("Dexterity") + .HasColumnType("int"); + + b.Property("DungeonsCompleted") + .HasColumnType("int"); + + b.Property("Endurance") + .HasColumnType("int"); + + b.Property("EquippedAccessory") + .HasColumnType("bigint unsigned"); + + b.Property("EquippedBoots") + .HasColumnType("bigint unsigned"); + + b.Property("EquippedChest") + .HasColumnType("bigint unsigned"); + + b.Property("EquippedGloves") + .HasColumnType("bigint unsigned"); + + b.Property("EquippedHead") + .HasColumnType("bigint unsigned"); + + b.Property("EquippedLegs") + .HasColumnType("bigint unsigned"); + + b.Property("EquippedOffhand") + .HasColumnType("bigint unsigned"); + + b.Property("EquippedWeapon") + .HasColumnType("bigint unsigned"); + + b.Property("Experience") + .HasColumnType("bigint"); + + b.Property("Gold") + .HasColumnType("bigint"); + + b.Property("Intelligence") + .HasColumnType("int"); + + b.Property("IsDeleted") + .HasColumnType("tinyint(1)"); + + b.Property("LastPlayedAt") + .HasColumnType("datetime(6)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("PlayersKilled") + .HasColumnType("int"); + + b.Property("ResistancesJson") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("Strength") + .HasColumnType("int"); + + b.Property("TotalDeaths") + .HasColumnType("int"); + + b.Property("TotalKills") + .HasColumnType("int"); + + b.Property("UnspentStatPoints") + .HasColumnType("int"); + + b.Property("Wisdom") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("AccountId"); + + b.ToTable("dungeon_characters"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacterCraftingSkill", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CharacterId") + .HasColumnType("bigint unsigned"); + + b.Property("Experience") + .HasColumnType("bigint"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("SkillType") + .HasColumnType("int"); + + b.Property("TotalItemsCrafted") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CharacterId"); + + b.ToTable("dungeon_character_crafting_skills"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacterItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AcquiredAt") + .HasColumnType("datetime(6)"); + + b.Property("CharacterId") + .HasColumnType("bigint unsigned"); + + b.Property("EquipSlot") + .HasColumnType("int"); + + b.Property("IsEquipped") + .HasColumnType("tinyint(1)"); + + b.Property("ItemDefinitionId") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("SlotIndex") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CharacterId"); + + b.HasIndex("ItemDefinitionId"); + + b.ToTable("dungeon_character_items"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacterItemCraftedLink", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CharacterItemId") + .HasColumnType("bigint unsigned"); + + b.Property("CraftedItemId") + .HasColumnType("bigint unsigned"); + + b.HasKey("Id"); + + b.HasIndex("CharacterItemId"); + + b.HasIndex("CraftedItemId"); + + b.ToTable("dungeon_character_item_crafted_link"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacterKnownRecipe", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CharacterId") + .HasColumnType("bigint unsigned"); + + b.Property("DiscoveredAt") + .HasColumnType("datetime(6)"); + + b.Property("RecipeId") + .HasColumnType("int"); + + b.Property("TimesCrafted") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CharacterId"); + + b.HasIndex("RecipeId"); + + b.ToTable("dungeon_character_known_recipes"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCraftedItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BaseItemDefinitionId") + .HasColumnType("int"); + + b.Property("CraftedAt") + .HasColumnType("datetime(6)"); + + b.Property("CrafterId") + .HasColumnType("bigint unsigned"); + + b.Property("CrafterName") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("CraftingLevelAtCreation") + .HasColumnType("int"); + + b.Property("CustomName") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("QualityRating") + .HasColumnType("int"); + + b.Property("RecipeId") + .HasColumnType("int"); + + b.Property("RollHistoryJson") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("RolledBonusArmor") + .HasColumnType("int"); + + b.Property("RolledBonusDexterity") + .HasColumnType("int"); + + b.Property("RolledBonusEndurance") + .HasColumnType("int"); + + b.Property("RolledBonusHealAmount") + .HasColumnType("int"); + + b.Property("RolledBonusHealth") + .HasColumnType("int"); + + b.Property("RolledBonusIntelligence") + .HasColumnType("int"); + + b.Property("RolledBonusMagicResist") + .HasColumnType("int"); + + b.Property("RolledBonusMana") + .HasColumnType("int"); + + b.Property("RolledBonusManaRestore") + .HasColumnType("int"); + + b.Property("RolledBonusMaxDamage") + .HasColumnType("int"); + + b.Property("RolledBonusMinDamage") + .HasColumnType("int"); + + b.Property("RolledBonusStrength") + .HasColumnType("int"); + + b.Property("RolledBonusWisdom") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BaseItemDefinitionId"); + + b.HasIndex("CrafterId"); + + b.HasIndex("RecipeId"); + + b.ToTable("dungeon_crafted_items"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCraftingRecipe", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BaseXp") + .HasColumnType("int"); + + b.Property("BonusOutputChanceAtMinLevel") + .HasColumnType("float"); + + b.Property("BonusOutputItemDefinitionId") + .HasColumnType("int"); + + b.Property("BonusOutputMaxLevel") + .HasColumnType("int"); + + b.Property("BonusOutputMinLevel") + .HasColumnType("int"); + + b.Property("BonusOutputQuantity") + .HasColumnType("int"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("HasStatRolls") + .HasColumnType("tinyint(1)"); + + b.Property("IsBaseRecipe") + .HasColumnType("tinyint(1)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("OutputItemDefinitionId") + .HasColumnType("int"); + + b.Property("OutputQuantity") + .HasColumnType("int"); + + b.Property("PossibleStatsJson") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("RequiredLevel") + .HasColumnType("int"); + + b.Property("SkillType") + .HasColumnType("int"); + + b.Property("Tier") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("OutputItemDefinitionId"); + + b.ToTable("dungeon_crafting_recipes"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCraftingRecipeIngredient", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ItemDefinitionId") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("RecipeId") + .HasColumnType("int"); + + b.Property("SlotOrder") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ItemDefinitionId"); + + b.HasIndex("RecipeId"); + + b.ToTable("dungeon_crafting_recipe_ingredients"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonItemDefinition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Armor") + .HasColumnType("int"); + + b.Property("AttackRange") + .HasColumnType("float"); + + b.Property("BonusDexterity") + .HasColumnType("int"); + + b.Property("BonusEndurance") + .HasColumnType("int"); + + b.Property("BonusHealth") + .HasColumnType("int"); + + b.Property("BonusIntelligence") + .HasColumnType("int"); + + b.Property("BonusMana") + .HasColumnType("int"); + + b.Property("BonusStrength") + .HasColumnType("int"); + + b.Property("BonusWisdom") + .HasColumnType("int"); + + b.Property("BuffDuration") + .HasColumnType("int"); + + b.Property("BuffResistancesJson") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("DamageTypeKey") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EquipSlot") + .HasColumnType("int"); + + b.Property("HealAmount") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("IsTeleportScroll") + .HasColumnType("tinyint(1)"); + + b.Property("ManaRestore") + .HasColumnType("int"); + + b.Property("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("ResistancesJson") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("SpriteId") + .HasColumnType("int"); + + b.Property("SpritePath") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("Stackable") + .HasColumnType("tinyint(1)"); + + b.Property("StaminaRestore") + .HasColumnType("int"); + + b.Property("TeachesSpellId") + .HasColumnType("int"); + + b.Property("TintColor") + .HasMaxLength(16) + .HasColumnType("varchar(16)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("dungeon_item_definitions"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonLearnedSpell", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CharacterId") + .HasColumnType("bigint unsigned"); + + b.Property("DefinitionId") + .HasColumnType("int"); + + b.Property("LearnedAt") + .HasColumnType("datetime(6)"); + + b.Property("SpellDefinitionId") + .HasColumnType("int"); + + b.Property("SpellLevel") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CharacterId"); + + b.HasIndex("DefinitionId"); + + b.ToTable("dungeon_learned_spells"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonLootTable", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("DropChanceMultiplier") + .HasColumnType("float"); + + b.Property("GuaranteedDrop") + .HasColumnType("tinyint(1)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("MaxDrops") + .HasColumnType("int"); + + b.Property("MaxTier") + .HasColumnType("int"); + + b.Property("MinDrops") + .HasColumnType("int"); + + b.Property("MinTier") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.HasKey("Id"); + + b.ToTable("dungeon_loot_tables"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonLootTableEntry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("DropChance") + .HasColumnType("float"); + + b.Property("DropChancePerTier") + .HasColumnType("float"); + + b.Property("Guaranteed") + .HasColumnType("tinyint(1)"); + + b.Property("ItemDefinitionId") + .HasColumnType("int"); + + b.Property("LootTableId") + .HasColumnType("int"); + + b.Property("MaxDropChance") + .HasColumnType("float"); + + b.Property("MaxQuantity") + .HasColumnType("int"); + + b.Property("MinQuantity") + .HasColumnType("int"); + + b.Property("Weight") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ItemDefinitionId"); + + b.HasIndex("LootTableId"); + + b.ToTable("dungeon_loot_table_entries"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonMobDefinition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AggroRange") + .HasColumnType("float"); + + b.Property("AnimationSpeed") + .HasColumnType("float"); + + b.Property("ArmorPerTier") + .HasColumnType("float"); + + b.Property("AttackRange") + .HasColumnType("float"); + + b.Property("AttackSpeed") + .HasColumnType("float"); + + b.Property("BaseArmor") + .HasColumnType("int"); + + b.Property("BaseHealth") + .HasColumnType("int"); + + b.Property("BaseMagicDamage") + .HasColumnType("int"); + + b.Property("BaseMagicResist") + .HasColumnType("int"); + + b.Property("BaseMana") + .HasColumnType("int"); + + b.Property("BasePhysicalDamage") + .HasColumnType("int"); + + b.Property("BaseXp") + .HasColumnType("int"); + + b.Property("Behavior") + .HasColumnType("int"); + + b.Property("CallForHelpRadius") + .HasColumnType("float"); + + b.Property("Category") + .HasColumnType("int"); + + b.Property("DamagePerTier") + .HasColumnType("float"); + + b.Property("DamageTypeKey") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("DropChanceMultiplier") + .HasColumnType("float"); + + b.Property("FleeThreshold") + .HasColumnType("float"); + + b.Property("HealthPerTier") + .HasColumnType("float"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LeashRange") + .HasColumnType("float"); + + b.Property("LootTableId") + .HasColumnType("int"); + + b.Property("MaxTier") + .HasColumnType("int"); + + b.Property("MinTier") + .HasColumnType("int"); + + b.Property("MoveSpeed") + .HasColumnType("float"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("PhasesJson") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("PreferredRange") + .HasColumnType("float"); + + b.Property("ResistancesJson") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("Scale") + .HasColumnType("float"); + + b.Property("SpriteConfigJson") + .HasMaxLength(8192) + .HasColumnType("varchar(8192)"); + + b.Property("TintColor") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("varchar(16)"); + + b.Property("Type") + .HasColumnType("int"); + + b.Property("XpPerTier") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.ToTable("dungeon_mob_definitions"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonMobLootTable", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("LootTableId") + .HasColumnType("int"); + + b.Property("MobDefinitionId") + .HasColumnType("int"); + + b.Property("Priority") + .HasColumnType("int"); + + b.Property("RollChance") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.HasIndex("LootTableId"); + + b.HasIndex("MobDefinitionId"); + + b.ToTable("dungeon_mob_loot_tables"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonPersistence", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BossKilled") + .HasColumnType("tinyint(1)"); + + b.Property("ChestStateJson") + .HasColumnType("json"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatorCharacterId") + .HasColumnType("bigint unsigned"); + + b.Property("CreatorId") + .HasColumnType("bigint unsigned"); + + b.Property("CreatorLevel") + .HasColumnType("int"); + + b.Property("CreatorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsCleared") + .HasColumnType("tinyint(1)"); + + b.Property("LastActivity") + .HasColumnType("datetime(6)"); + + b.Property("LevelBracketMax") + .HasColumnType("int"); + + b.Property("LevelBracketMin") + .HasColumnType("int"); + + b.Property("LootChestStateJson") + .HasColumnType("json"); + + b.Property("MobStateJson") + .HasColumnType("json"); + + b.Property("PersistedAt") + .HasColumnType("datetime(6)"); + + b.Property("Seed") + .HasColumnType("int"); + + b.Property("Tier") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CreatorId"); + + b.ToTable("dungeon_instances"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonRecipeScroll", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ItemDefinitionId") + .HasColumnType("int"); + + b.Property("RecipeId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ItemDefinitionId"); + + b.HasIndex("RecipeId"); + + b.ToTable("dungeon_recipe_scrolls"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonSpellDefinition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AreaOfEffect") + .HasColumnType("float"); + + b.Property("BaseDamage") + .HasColumnType("int"); + + b.Property("BaseHealing") + .HasColumnType("int"); + + b.Property("Cooldown") + .HasColumnType("float"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EffectColor") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("IsShield") + .HasColumnType("tinyint(1)"); + + b.Property("IsTeleport") + .HasColumnType("tinyint(1)"); + + b.Property("ManaCost") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Range") + .HasColumnType("float"); + + b.Property("RequiredIntelligence") + .HasColumnType("int"); + + b.Property("RequiredLevel") + .HasColumnType("int"); + + b.Property("RequiredWisdom") + .HasColumnType("int"); + + b.Property("ShieldAmount") + .HasColumnType("int"); + + b.Property("SpriteId") + .HasColumnType("int"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("dungeon_spell_definitions"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonStashItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CharacterId") + .HasColumnType("bigint unsigned"); + + b.Property("DefinitionId") + .HasColumnType("int"); + + b.Property("ItemDefinitionId") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("SlotIndex") + .HasColumnType("int"); + + b.Property("StoredAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("CharacterId"); + + b.HasIndex("DefinitionId"); + + b.ToTable("dungeon_stash_items"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.MobAbilityAssignment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AbilityDefinitionId") + .HasColumnType("int"); + + b.Property("CooldownOverride") + .HasColumnType("float"); + + b.Property("DamageOverride") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("MaxHpPercent") + .HasColumnType("float"); + + b.Property("MinHpPercent") + .HasColumnType("float"); + + b.Property("MobDefinitionId") + .HasColumnType("int"); + + b.Property("Phase") + .HasColumnType("int"); + + b.Property("PriorityOverride") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("AbilityDefinitionId"); + + b.HasIndex("MobDefinitionId"); + + b.ToTable("dungeon_mob_ability_assignments"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.MobAbilityDefinition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AbilityType") + .HasColumnType("int"); + + b.Property("AffectedStat") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("AnimationDuration") + .HasColumnType("float"); + + b.Property("AnimationKey") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("AoeRadius") + .HasColumnType("float"); + + b.Property("BaseDamage") + .HasColumnType("int"); + + b.Property("CastTime") + .HasColumnType("float"); + + b.Property("ConeAngle") + .HasColumnType("float"); + + b.Property("Cooldown") + .HasColumnType("float"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("DamagePerTier") + .HasColumnType("float"); + + b.Property("DamageTypeKey") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("DisplacementDistance") + .HasColumnType("float"); + + b.Property("DotDamagePerTick") + .HasColumnType("int"); + + b.Property("DotTickInterval") + .HasColumnType("float"); + + b.Property("EffectDuration") + .HasColumnType("float"); + + b.Property("HpThresholdAbove") + .HasColumnType("float"); + + b.Property("HpThresholdBelow") + .HasColumnType("float"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Key") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ManaCost") + .HasColumnType("int"); + + b.Property("MinTargetsInRange") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Priority") + .HasColumnType("int"); + + b.Property("ProjectileSpeed") + .HasColumnType("float"); + + b.Property("ProjectileSprite") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("Range") + .HasColumnType("float"); + + b.Property("SoundEffectKey") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("SpeedModifier") + .HasColumnType("float"); + + b.Property("StatModifier") + .HasColumnType("float"); + + b.Property("SummonCount") + .HasColumnType("int"); + + b.Property("SummonMobId") + .HasColumnType("int"); + + b.Property("Targeting") + .HasColumnType("int"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("VisualEffectKey") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.HasKey("Id"); + + b.ToTable("dungeon_mob_abilities"); + }); + + modelBuilder.Entity("DataServer.Data.Session", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint unsigned"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("datetime(6)") + .HasDefaultValueSql("CURRENT_TIMESTAMP(6)"); + + b.Property("CreatedIp") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ExpiresAt") + .HasColumnType("datetime(6)"); + + b.Property("RevokedAt") + .HasColumnType("datetime(6)"); + + b.Property("TokenHash") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("UserAgent") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("AccountId"); + + b.HasIndex("TokenHash") + .IsUnique(); + + b.ToTable("sessions", (string)null); + }); + + modelBuilder.Entity("DataServer.Data.Zone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("datetime(6)") + .HasDefaultValueSql("CURRENT_TIMESTAMP(6)"); + + b.Property("MaxX") + .HasColumnType("double"); + + b.Property("MaxY") + .HasColumnType("double"); + + b.Property("MaxZ") + .HasColumnType("double"); + + b.Property("MinX") + .HasColumnType("double"); + + b.Property("MinY") + .HasColumnType("double"); + + b.Property("MinZ") + .HasColumnType("double"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("UpdatedAt") + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("datetime(6)") + .HasDefaultValueSql("CURRENT_TIMESTAMP(6)"); + + MySqlPropertyBuilderExtensions.UseMySqlComputedColumn(b.Property("UpdatedAt")); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("zones", (string)null); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DeathChest", b => + { + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "OwnerCharacter") + .WithMany() + .HasForeignKey("OwnerCharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "VictimCharacter") + .WithMany() + .HasForeignKey("VictimCharacterId"); + + b.Navigation("OwnerCharacter"); + + b.Navigation("VictimCharacter"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DeathChestItem", b => + { + b.HasOne("DataServer.Data.Entities.DeathChest", "DeathChest") + .WithMany("Items") + .HasForeignKey("DeathChestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonItemDefinition", "ItemDefinition") + .WithMany() + .HasForeignKey("ItemDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DeathChest"); + + b.Navigation("ItemDefinition"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonBeltItem", b => + { + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "Character") + .WithMany() + .HasForeignKey("CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Character"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacter", b => + { + b.HasOne("DataServer.Data.Account", "Account") + .WithMany("Characters") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Account"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacterCraftingSkill", b => + { + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "Character") + .WithMany("CraftingSkills") + .HasForeignKey("CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Character"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacterItem", b => + { + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "Character") + .WithMany("Inventory") + .HasForeignKey("CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonItemDefinition", "ItemDefinition") + .WithMany() + .HasForeignKey("ItemDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Character"); + + b.Navigation("ItemDefinition"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacterItemCraftedLink", b => + { + b.HasOne("DataServer.Data.Entities.DungeonCharacterItem", "CharacterItem") + .WithMany() + .HasForeignKey("CharacterItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonCraftedItem", "CraftedItem") + .WithMany() + .HasForeignKey("CraftedItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CharacterItem"); + + b.Navigation("CraftedItem"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacterKnownRecipe", b => + { + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "Character") + .WithMany("KnownRecipes") + .HasForeignKey("CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonCraftingRecipe", "Recipe") + .WithMany() + .HasForeignKey("RecipeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Character"); + + b.Navigation("Recipe"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCraftedItem", b => + { + b.HasOne("DataServer.Data.Entities.DungeonItemDefinition", "BaseItemDefinition") + .WithMany() + .HasForeignKey("BaseItemDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "Crafter") + .WithMany() + .HasForeignKey("CrafterId"); + + b.HasOne("DataServer.Data.Entities.DungeonCraftingRecipe", "Recipe") + .WithMany() + .HasForeignKey("RecipeId"); + + b.Navigation("BaseItemDefinition"); + + b.Navigation("Crafter"); + + b.Navigation("Recipe"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCraftingRecipe", b => + { + b.HasOne("DataServer.Data.Entities.DungeonItemDefinition", "OutputItem") + .WithMany() + .HasForeignKey("OutputItemDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("OutputItem"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCraftingRecipeIngredient", b => + { + b.HasOne("DataServer.Data.Entities.DungeonItemDefinition", "ItemDefinition") + .WithMany() + .HasForeignKey("ItemDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonCraftingRecipe", "Recipe") + .WithMany("Ingredients") + .HasForeignKey("RecipeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ItemDefinition"); + + b.Navigation("Recipe"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonLearnedSpell", b => + { + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "Character") + .WithMany("LearnedSpells") + .HasForeignKey("CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonSpellDefinition", "Definition") + .WithMany() + .HasForeignKey("DefinitionId"); + + b.Navigation("Character"); + + b.Navigation("Definition"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonLootTableEntry", b => + { + b.HasOne("DataServer.Data.Entities.DungeonItemDefinition", "ItemDefinition") + .WithMany() + .HasForeignKey("ItemDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonLootTable", "LootTable") + .WithMany("Entries") + .HasForeignKey("LootTableId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ItemDefinition"); + + b.Navigation("LootTable"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonMobLootTable", b => + { + b.HasOne("DataServer.Data.Entities.DungeonLootTable", "LootTable") + .WithMany() + .HasForeignKey("LootTableId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonMobDefinition", "MobDefinition") + .WithMany() + .HasForeignKey("MobDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("LootTable"); + + b.Navigation("MobDefinition"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonPersistence", b => + { + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "Creator") + .WithMany() + .HasForeignKey("CreatorId"); + + b.Navigation("Creator"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonRecipeScroll", b => + { + b.HasOne("DataServer.Data.Entities.DungeonItemDefinition", "ItemDefinition") + .WithMany() + .HasForeignKey("ItemDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonCraftingRecipe", "Recipe") + .WithMany() + .HasForeignKey("RecipeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ItemDefinition"); + + b.Navigation("Recipe"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonStashItem", b => + { + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "Character") + .WithMany("Stash") + .HasForeignKey("CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonItemDefinition", "Definition") + .WithMany() + .HasForeignKey("DefinitionId"); + + b.Navigation("Character"); + + b.Navigation("Definition"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.MobAbilityAssignment", b => + { + b.HasOne("DataServer.Data.Entities.MobAbilityDefinition", "AbilityDefinition") + .WithMany() + .HasForeignKey("AbilityDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonMobDefinition", "MobDefinition") + .WithMany("AbilityAssignments") + .HasForeignKey("MobDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("AbilityDefinition"); + + b.Navigation("MobDefinition"); + }); + + modelBuilder.Entity("DataServer.Data.Session", b => + { + b.HasOne("DataServer.Data.Account", "Account") + .WithMany("Sessions") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Account"); + }); + + modelBuilder.Entity("DataServer.Data.Account", b => + { + b.Navigation("Characters"); + + b.Navigation("Sessions"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DeathChest", b => + { + b.Navigation("Items"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacter", b => + { + b.Navigation("CraftingSkills"); + + b.Navigation("Inventory"); + + b.Navigation("KnownRecipes"); + + b.Navigation("LearnedSpells"); + + b.Navigation("Stash"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCraftingRecipe", b => + { + b.Navigation("Ingredients"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonLootTable", b => + { + b.Navigation("Entries"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonMobDefinition", b => + { + b.Navigation("AbilityAssignments"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Migrations/20251227162034_Mobv2 p2.cs b/Migrations/20251227162034_Mobv2 p2.cs new file mode 100644 index 0000000..cad475a --- /dev/null +++ b/Migrations/20251227162034_Mobv2 p2.cs @@ -0,0 +1,22 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace SystemRevivalServer.Migrations +{ + /// + public partial class Mobv2p2 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/Services/Admin/Pages/Shared/_Layout.cshtml b/Services/Admin/Pages/Shared/_Layout.cshtml index a9259f7..8ff90ca 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