Dungeon Admin management-ooops
This commit is contained in:
@@ -34,7 +34,8 @@ public class ViewModel : AdminPageModel
|
|||||||
|
|
||||||
public async Task OnGetAsync(Guid id)
|
public async Task OnGetAsync(Guid id)
|
||||||
{
|
{
|
||||||
Dungeon = _dungeonHandler.GetDungeon(id);
|
var dungeon = _dungeonHandler.GetDungeon(id);
|
||||||
|
Dungeon = dungeon;
|
||||||
|
|
||||||
MobDefinitions = await _db.DungeonMobDefinitions
|
MobDefinitions = await _db.DungeonMobDefinitions
|
||||||
.Where(m => m.IsEnabled).OrderBy(m => m.Name).ToListAsync();
|
.Where(m => m.IsEnabled).OrderBy(m => m.Name).ToListAsync();
|
||||||
@@ -65,11 +66,11 @@ public class ViewModel : AdminPageModel
|
|||||||
cols = s.Columns
|
cols = s.Columns
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if (Dungeon == null) return;
|
if (dungeon == null) return;
|
||||||
|
|
||||||
Duration = FormatDuration(DateTime.UtcNow - Dungeon.CreatedAt);
|
Duration = FormatDuration(DateTime.UtcNow - dungeon.CreatedAt);
|
||||||
|
|
||||||
var layout = Dungeon.LayoutV2;
|
var layout = dungeon.LayoutV2;
|
||||||
if (layout != null)
|
if (layout != null)
|
||||||
{
|
{
|
||||||
MapWidth = layout.Width;
|
MapWidth = layout.Width;
|
||||||
@@ -89,20 +90,20 @@ public class ViewModel : AdminPageModel
|
|||||||
}
|
}
|
||||||
else { MapWidth = 100; MapHeight = 100; }
|
else { MapWidth = 100; MapHeight = 100; }
|
||||||
|
|
||||||
PlayersJson = JsonSerializer.Serialize(Dungeon.Simulation.Players.Values.Select(p => new {
|
PlayersJson = JsonSerializer.Serialize(dungeon.Simulation.Players.Values.Select(p => new {
|
||||||
id = p.CharacterId.ToString(), name = p.CharacterName, x = p.X, y = p.Y,
|
id = p.CharacterId.ToString(), name = p.CharacterName, x = p.X, y = p.Y,
|
||||||
health = p.Health, maxHealth = p.MaxHealth, isAlive = p.IsAlive
|
health = p.Health, maxHealth = p.MaxHealth, isAlive = p.IsAlive
|
||||||
}));
|
}));
|
||||||
|
|
||||||
MobsJson = JsonSerializer.Serialize(Dungeon.Simulation.Mobs.Values.Select(m => new {
|
MobsJson = JsonSerializer.Serialize(dungeon.Simulation.Mobs.Values.Select(m => new {
|
||||||
id = m.Id, name = m.Name, x = m.X, y = m.Y, health = m.Health, maxHealth = m.MaxHealth,
|
id = m.Id, name = m.Name, x = m.X, y = m.Y, health = m.Health, maxHealth = m.MaxHealth,
|
||||||
alive = m.IsAlive, isBoss = m.Type == DataServer.Data.Enums.MobType.Boss, state = m.State.ToString(),
|
alive = m.IsAlive, isBoss = m.Type == DataServer.Data.Enums.MobType.Boss, state = m.State.ToString(),
|
||||||
abilities = m.Abilities.Select(a => new { id = a.AbilityId, name = a.Definition?.Name ?? $"Ability {a.AbilityId}", key = a.Definition?.Key ?? "" }),
|
abilities = m.Abilities.Select(a => new { id = a.AbilityId, name = a.Definition?.Name ?? $"Ability {a.AbilityId}", key = a.Definition?.Key ?? "" }),
|
||||||
resistances = m.Stats.Resistances,
|
resistances = m.Stats.Resistances,
|
||||||
lootGold = m.DeathLootGold,
|
lootGold = m.DeathLootGold,
|
||||||
lootItems = m.DeathLoot == null
|
lootItems = m.DeathLoot == null
|
||||||
? Array.Empty<object>()
|
? Enumerable.Empty<object>()
|
||||||
: m.DeathLoot.Select(l => new { id = l.ItemDefinitionId, name = l.Item?.Name ?? $"Item {l.ItemDefinitionId}", qty = l.Quantity })
|
: m.DeathLoot.Select(l => (object)new { id = l.ItemDefinitionId, name = l.Item?.Name ?? $"Item {l.ItemDefinitionId}", qty = l.Quantity })
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,8 +127,8 @@ public class ViewModel : AdminPageModel
|
|||||||
resistances = m.Stats.Resistances,
|
resistances = m.Stats.Resistances,
|
||||||
lootGold = m.DeathLootGold,
|
lootGold = m.DeathLootGold,
|
||||||
lootItems = m.DeathLoot == null
|
lootItems = m.DeathLoot == null
|
||||||
? Array.Empty<object>()
|
? Enumerable.Empty<object>()
|
||||||
: m.DeathLoot.Select(l => new { id = l.ItemDefinitionId, name = l.Item?.Name ?? $"Item {l.ItemDefinitionId}", qty = l.Quantity })
|
: m.DeathLoot.Select(l => (object)new { id = l.ItemDefinitionId, name = l.Item?.Name ?? $"Item {l.ItemDefinitionId}", qty = l.Quantity })
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user