Expose imported critical data in web app
This commit is contained in:
@@ -15,6 +15,15 @@
|
||||
<pre class="code-block">{
|
||||
"attackTables": [
|
||||
{ "key": "broadsword", "label": "Broadsword" }
|
||||
],
|
||||
"criticalTables": [
|
||||
{
|
||||
"key": "mana",
|
||||
"label": "Mana Critical Strike Table",
|
||||
"family": "standard",
|
||||
"sourceDocument": "Mana.pdf",
|
||||
"notes": "Imported from PDF XML extraction."
|
||||
}
|
||||
]
|
||||
}</pre>
|
||||
</section>
|
||||
@@ -34,10 +43,11 @@
|
||||
<h2 class="panel-title">Critical lookup</h2>
|
||||
<p class="panel-copy"><code>POST /api/lookup/critical</code></p>
|
||||
<pre class="code-block">{
|
||||
"criticalType": "slash",
|
||||
"column": "B",
|
||||
"roll": 72,
|
||||
"criticalType": "mana",
|
||||
"column": "E",
|
||||
"roll": 100,
|
||||
"group": null
|
||||
}</pre>
|
||||
<p class="panel-copy">Response now includes table metadata, roll-band bounds, raw imported cell text, parse status, and parsed JSON alongside the gameplay description.</p>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
@@ -17,8 +17,8 @@ else
|
||||
<span class="eyebrow">Rolemaster Lookup Desk</span>
|
||||
<h1 class="page-title">Resolve the attack roll, then the critical, from one place.</h1>
|
||||
<p class="lede">
|
||||
This starter app seeds a small SQLite dataset and exposes the same lookup flow through Blazor and minimal APIs.
|
||||
The current data is intentionally limited to a first pass so the import pipeline can grow from a working base.
|
||||
Attack tables still come from the starter dataset, while critical lookups now read the importer-managed tables loaded into the same SQLite file.
|
||||
The page surfaces both the gameplay result and the import metadata behind each critical entry.
|
||||
</p>
|
||||
<div class="tag-row">
|
||||
<span class="tag">@referenceData.AttackTables.Count attack tables</span>
|
||||
@@ -104,16 +104,7 @@ else
|
||||
{
|
||||
<div class="callout">
|
||||
<h4>Automatic critical resolution</h4>
|
||||
<div class="result-stats">
|
||||
<span class="stat-pill">@attackResult.AutoCritical.CriticalTableName</span>
|
||||
<span class="stat-pill">Column: @attackResult.AutoCritical.Column</span>
|
||||
<span class="stat-pill">Band: @attackResult.AutoCritical.RollBand</span>
|
||||
</div>
|
||||
<p><strong>@attackResult.AutoCritical.Description</strong></p>
|
||||
@if (!string.IsNullOrWhiteSpace(attackResult.AutoCritical.AffixText))
|
||||
{
|
||||
<p class="muted">@attackResult.AutoCritical.AffixText</p>
|
||||
}
|
||||
<CriticalLookupResultCard Result="attackResult.AutoCritical" />
|
||||
</div>
|
||||
}
|
||||
else if (!string.IsNullOrWhiteSpace(attackResult.CriticalSeverity))
|
||||
@@ -127,7 +118,7 @@ else
|
||||
|
||||
<section class="panel">
|
||||
<h2 class="panel-title">Direct Critical Lookup</h2>
|
||||
<p class="panel-copy">Use this when you already know the critical table, column, and roll.</p>
|
||||
<p class="panel-copy">Use this when you already know the critical table, column, roll, and group if the selected table has variants.</p>
|
||||
|
||||
<div class="lookup-form">
|
||||
<div class="form-grid">
|
||||
@@ -146,11 +137,24 @@ else
|
||||
<select id="critical-column" class="input-shell" @bind="criticalInput.Column">
|
||||
@foreach (var column in SelectedCriticalTable?.Columns ?? [])
|
||||
{
|
||||
<option value="@column.Key">@column.Label</option>
|
||||
<option value="@column.Key">@column.Label (@column.Role)</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@if (SelectedCriticalTable?.Groups.Count > 0)
|
||||
{
|
||||
<div class="field-shell">
|
||||
<label for="critical-group">Group</label>
|
||||
<select id="critical-group" class="input-shell" @bind="criticalInput.Group">
|
||||
@foreach (var group in SelectedCriticalTable.Groups)
|
||||
{
|
||||
<option value="@group.Key">@group.Label</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="field-shell">
|
||||
<label for="critical-roll-direct">Critical roll</label>
|
||||
<input id="critical-roll-direct" class="input-shell" type="number" min="1" max="100" @bind="criticalInput.Roll" />
|
||||
@@ -170,26 +174,14 @@ else
|
||||
@if (criticalResult is not null)
|
||||
{
|
||||
<div class="result-shell">
|
||||
<div class="result-card">
|
||||
<h3>@criticalResult.CriticalTableName</h3>
|
||||
<div class="result-stats">
|
||||
<span class="stat-pill">Column: @criticalResult.Column</span>
|
||||
<span class="stat-pill">Band: @criticalResult.RollBand</span>
|
||||
<span class="stat-pill">Roll: @criticalResult.Roll</span>
|
||||
</div>
|
||||
<p><strong>@criticalResult.Description</strong></p>
|
||||
@if (!string.IsNullOrWhiteSpace(criticalResult.AffixText))
|
||||
{
|
||||
<p class="muted">@criticalResult.AffixText</p>
|
||||
}
|
||||
</div>
|
||||
<CriticalLookupResultCard Result="criticalResult" />
|
||||
</div>
|
||||
}
|
||||
</section>
|
||||
|
||||
<section class="panel">
|
||||
<h2 class="panel-title">Seeded Reference Data</h2>
|
||||
<p class="panel-copy">The schema supports much more than what is seeded today. These are the initial tables standing up the flow.</p>
|
||||
<h2 class="panel-title">Loaded Reference Data</h2>
|
||||
<p class="panel-copy">Attack tables remain starter content. Critical tables below are whatever importer-managed entries are currently loaded into the app database.</p>
|
||||
|
||||
<div class="table-list">
|
||||
@foreach (var attackTable in referenceData.AttackTables)
|
||||
@@ -202,10 +194,7 @@ else
|
||||
|
||||
@foreach (var criticalTable in referenceData.CriticalTables)
|
||||
{
|
||||
<div class="table-list-item">
|
||||
<strong>@criticalTable.Label</strong>
|
||||
<span class="muted">Critical key: <code>@criticalTable.Key</code>, columns: @string.Join(", ", criticalTable.Columns.Select(column => column.Label))</span>
|
||||
</div>
|
||||
<CriticalTableReferenceCard Table="criticalTable" />
|
||||
}
|
||||
</div>
|
||||
</section>
|
||||
@@ -234,6 +223,7 @@ else
|
||||
var initialCriticalTable = referenceData.CriticalTables.FirstOrDefault();
|
||||
criticalInput.CriticalType = initialCriticalTable?.Key ?? string.Empty;
|
||||
criticalInput.Column = initialCriticalTable?.Columns.FirstOrDefault()?.Key ?? string.Empty;
|
||||
criticalInput.Group = initialCriticalTable?.Groups.FirstOrDefault()?.Key ?? string.Empty;
|
||||
}
|
||||
|
||||
private async Task RunAttackLookupAsync()
|
||||
@@ -271,11 +261,11 @@ else
|
||||
criticalInput.CriticalType,
|
||||
criticalInput.Column,
|
||||
criticalInput.Roll,
|
||||
null));
|
||||
SelectedCriticalTable?.Groups.Count > 0 ? criticalInput.Group : null));
|
||||
|
||||
if (response is null)
|
||||
{
|
||||
criticalError = "No seeded critical result matched that table, column, and roll.";
|
||||
criticalError = "No loaded critical result matched that table, group, column, and roll.";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -288,6 +278,7 @@ else
|
||||
|
||||
var table = referenceData?.CriticalTables.FirstOrDefault(item => item.Key == criticalInput.CriticalType);
|
||||
criticalInput.Column = table?.Columns.FirstOrDefault()?.Key ?? string.Empty;
|
||||
criticalInput.Group = table?.Groups.FirstOrDefault()?.Key ?? string.Empty;
|
||||
criticalResult = null;
|
||||
criticalError = null;
|
||||
}
|
||||
@@ -304,6 +295,7 @@ else
|
||||
{
|
||||
public string CriticalType { get; set; } = string.Empty;
|
||||
public string Column { get; set; } = string.Empty;
|
||||
public string Group { get; set; } = string.Empty;
|
||||
public int Roll { get; set; } = 72;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user