From 0b89cd06aadffcf117166de1cf4eceeeef2bf826 Mon Sep 17 00:00:00 2001 From: dingo Date: Sat, 31 Jan 2026 11:19:38 -0500 Subject: [PATCH] Dungeon Admin management --- Game/Dungeon/DungeonHandlerAdmin.cs | 2 +- Game/Dungeon/DungeonSimulation.cs | 32 +++-- Game/Dungeon/PlayerInstance.cs | 5 + Services/Admin/Pages/Dungeons/View.cshtml | 127 ++++++++++++++++++- Services/Admin/Pages/Dungeons/View.cshtml.cs | 110 +++++++++++++++- 5 files changed, 256 insertions(+), 20 deletions(-) diff --git a/Game/Dungeon/DungeonHandlerAdmin.cs b/Game/Dungeon/DungeonHandlerAdmin.cs index f42df0c..f9fd1d7 100644 --- a/Game/Dungeon/DungeonHandlerAdmin.cs +++ b/Game/Dungeon/DungeonHandlerAdmin.cs @@ -496,7 +496,7 @@ public partial class DungeonHandler return false; if (!dungeon.Simulation.Players.TryGetValue(characterId, out var player)) return false; - player.Armor = invulnerable ? 999999 : 0; + player.IsInvulnerable = invulnerable; return true; } diff --git a/Game/Dungeon/DungeonSimulation.cs b/Game/Dungeon/DungeonSimulation.cs index 4cff577..2270c66 100644 --- a/Game/Dungeon/DungeonSimulation.cs +++ b/Game/Dungeon/DungeonSimulation.cs @@ -951,6 +951,7 @@ public partial class DungeonSimulation private void ApplyDamageToPlayer(MobInstance? mob, PlayerInstance player, int damage, string damageTypeKey, bool wasResisted, bool wasWeakness) { + if (player.IsInvulnerable) return; player.Health -= damage; player.IsInCombat = true; player.LastCombatTick = CurrentTick; @@ -1069,22 +1070,28 @@ public partial class DungeonSimulation effect.NextTickIn -= TickDelta; if (effect.NextTickIn <= 0) { - player.Health -= effect.DamagePerTick; - player.IsInCombat = true; - player.LastCombatTick = CurrentTick; + if (!player.IsInvulnerable) + { + player.Health -= effect.DamagePerTick; + player.IsInCombat = true; + player.LastCombatTick = CurrentTick; + } effect.NextTickIn = effect.TickInterval; - _pendingDamageEvents.Add(new DamageEvent + if (!player.IsInvulnerable) { - SourceType = EntityType.Mob, - SourceId = effect.SourceMobId, - TargetType = EntityType.Player, - TargetId = (int)player.CharacterId, - Damage = effect.DamagePerTick, - DamageTypeKey = effect.EffectType - }); + _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) + if (!player.IsInvulnerable && player.Health <= 0) { player.Health = 0; player.IsAlive = false; @@ -1362,4 +1369,3 @@ public partial class DungeonSimulation } - diff --git a/Game/Dungeon/PlayerInstance.cs b/Game/Dungeon/PlayerInstance.cs index b9f8248..0cf6844 100644 --- a/Game/Dungeon/PlayerInstance.cs +++ b/Game/Dungeon/PlayerInstance.cs @@ -29,6 +29,11 @@ public class PlayerInstance // Defensive stats (from gear) public int Armor { get; set; } + /// + /// Admin override to prevent all incoming damage + /// + public bool IsInvulnerable { get; set; } + /// /// Weapon damage type key (from equipped weapon, defaults to physical for unarmed) /// diff --git a/Services/Admin/Pages/Dungeons/View.cshtml b/Services/Admin/Pages/Dungeons/View.cshtml index 28e8331..ed79587 100644 --- a/Services/Admin/Pages/Dungeons/View.cshtml +++ b/Services/Admin/Pages/Dungeons/View.cshtml @@ -21,6 +21,10 @@ .stat-card { background: rgba(30, 30, 50, 0.8); border: 1px solid #374151; border-radius: 8px; padding: 12px; } .inspector { background: rgba(20, 20, 40, 0.95); border: 1px solid #4f46e5; border-radius: 8px; padding: 16px; } .inspector-stat { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,0.1); } + .inspector, .inspector * { color: #e5e7eb; } + .inspector .text-gray-400 { color: #9ca3af !important; } + .inspector select, .inspector input, .inspector textarea { background: #111827; border-color: #374151; color: #e5e7eb; } + .inspector option { color: #e5e7eb; background: #111827; } .tool-btn { padding: 6px 10px; border-radius: 6px; font-size: 12px; transition: all 0.15s; background: #374151; color: #ccc; border: none; cursor: pointer; } .tool-btn:hover { background: #4b5563; } .tool-btn.active { background: #4f46e5; color: white; } @@ -145,9 +149,57 @@ else
-
- - +
+ + + +
+ +
+
+
Add Ability
+
+ + +
+
+ +
+
Resistances
+
+ + +
+
+ + +
+
+ +
+
Loot
+
+ + +
+
+ + + +
+
@@ -182,6 +234,7 @@ else

Spawn Mob

+