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:
@@ -150,6 +150,7 @@ func (s *Server) handleAdventureIngest(w http.ResponseWriter, r *http.Request) {
|
||||
Tally: f.Count,
|
||||
Outcome: f.Outcome,
|
||||
Milestone: f.Milestone,
|
||||
Stakes: f.Stakes,
|
||||
Actors: f.Actors,
|
||||
OccurredAt: occurredAt,
|
||||
}); err != nil {
|
||||
@@ -204,6 +205,8 @@ func advEventMeta(eventType string) (label, emoji string) {
|
||||
return "First clear", "🗺️"
|
||||
case "zone_clear":
|
||||
return "Zone cleared", "🗺️"
|
||||
case "treasure_found":
|
||||
return "Treasure", "💎"
|
||||
case "death":
|
||||
return "In memoriam", "🪦"
|
||||
case "arrival":
|
||||
@@ -410,6 +413,24 @@ func renderAdventure(f AdvFact) (headline, lede string, ok bool) {
|
||||
inRegion = " in " + f.Region
|
||||
}
|
||||
return headline, fmt.Sprintf("%s made it through %s%s%s. Nicely done.", f.Subject, f.Zone, inRegion, atLevel), true
|
||||
case "treasure_found":
|
||||
// A story-grade find pulled from a dungeon. stakes is the item's name,
|
||||
// outcome its rarity, and the priority tier marks a realm-first hoard
|
||||
// nobody had ever pulled before — the same split zone_first uses.
|
||||
inZone := f.Zone
|
||||
if inZone == "" {
|
||||
inZone = "the dungeon"
|
||||
}
|
||||
rarity := ""
|
||||
if f.Outcome != "" {
|
||||
rarity = strings.ToLower(f.Outcome) + " "
|
||||
}
|
||||
if f.Tier == "priority" {
|
||||
return fmt.Sprintf("First ever: %s pulls %s out of %s.", f.Subject, f.Stakes, inZone),
|
||||
fmt.Sprintf("Nobody had laid hands on %s before today. %s found the %shoard deep in %s%s, first in the realm to do it. Some haul.", f.Stakes, f.Subject, rarity, inZone, atLevel), true
|
||||
}
|
||||
return fmt.Sprintf("%s turned up %s in %s.", f.Subject, f.Stakes, inZone),
|
||||
fmt.Sprintf("%s came back from %s with %s to show for it%s. A %sfind like that is worth a mention. Nice one.", f.Subject, inZone, f.Stakes, atLevel, rarity), true
|
||||
case "death":
|
||||
return fmt.Sprintf("We lost %s in %s.", f.Subject, f.Zone),
|
||||
fmt.Sprintf("Sad news to pass along: %s fell at level %d in %s. The graveyard's a little fuller tonight. Rest easy.", f.Subject, f.Level, f.Zone), true
|
||||
|
||||
Reference in New Issue
Block a user