adventure: count the treasures an adventurer has actually found
A treasure_found fact turns loot into a trophy: a story-grade find lands on the who page as a stat tile, a named row in a Treasures found showcase, and a trail entry linking back to the dispatch. A realm-first hoard rides the priority tier the way zone_first does, and gets the same star and callout. The item name travels in the fact's stakes field, which the events log now keeps (a new nullable column, backfilled to NULL for older rows). Counting is only ever from the fact, never the vault snapshot, so a bought sword is never a trophy and a history that predates the fact is a clean zero. This is a new event_type, so Pete's ingest must be deployed before gogobee emits one, or the first finds park forever on the retry ladder.
This commit is contained in:
@@ -218,6 +218,33 @@ func TestRenderZoneTaxonomy(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestRenderTreasure: a story-grade find names the item and its zone; a
|
||||
// priority find is billed as a realm-first, and the rarity from outcome rides
|
||||
// into the lede.
|
||||
func TestRenderTreasure(t *testing.T) {
|
||||
hoard := AdvFact{EventType: "treasure_found", Tier: "priority", Subject: "Josie",
|
||||
Zone: "The Ossuary", Stakes: "Crown of the Drowned King", Outcome: "legendary", Level: 7}
|
||||
hl, lede, ok := renderAdventure(hoard)
|
||||
if !ok || !strings.Contains(hl, "First ever") || !strings.Contains(hl, "Crown of the Drowned King") {
|
||||
t.Errorf("hoard headline = %q (ok=%v)", hl, ok)
|
||||
}
|
||||
if !strings.Contains(lede, "legendary") {
|
||||
t.Errorf("hoard lede dropped the rarity: %q", lede)
|
||||
}
|
||||
|
||||
find := AdvFact{EventType: "treasure_found", Tier: "bulletin", Subject: "Josie",
|
||||
Zone: "The Sump", Stakes: "Ring of Nine Sorrows"}
|
||||
hl2, _, ok := renderAdventure(find)
|
||||
if !ok || !strings.Contains(hl2, "Josie") || !strings.Contains(hl2, "Ring of Nine Sorrows") ||
|
||||
!strings.Contains(hl2, "The Sump") || strings.Contains(hl2, "First ever") {
|
||||
t.Errorf("plain find headline = %q (ok=%v)", hl2, ok)
|
||||
}
|
||||
|
||||
if lbl, emoji := advEventMeta("treasure_found"); lbl != "Treasure" || emoji == "" {
|
||||
t.Errorf("treasure meta = %q/%q", lbl, emoji)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAdventureArtAndMeta(t *testing.T) {
|
||||
const token = "t"
|
||||
s, _ := newAdvServer(t, token)
|
||||
|
||||
Reference in New Issue
Block a user