From 007e2de369f9fc26da3237646de14f2af5052ee8 Mon Sep 17 00:00:00 2001 From: ewy Date: Fri, 22 May 2026 16:54:49 +0200 Subject: initial commit --- stats/ancients.go | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 stats/ancients.go (limited to 'stats/ancients.go') diff --git a/stats/ancients.go b/stats/ancients.go new file mode 100644 index 0000000..16ea207 --- /dev/null +++ b/stats/ancients.go @@ -0,0 +1,50 @@ +package stats + +import ( + "sts2stats/model" +) + +const ( + AncientKey = "ancient" +) + +type AncientChoice struct { + RunStat + AncientOption + ActIndex int + ActName string + Chosen bool +} + +type AncientOption struct { + Key string + Type string +} + +func EnrichAncients(run model.Run, st RunStat) (opts []any, err error) { + for actIndex, act := range run.MapPointHistory { + for _, floor := range act { + if floor.MapPointType != AncientKey { + continue + } + + for _, stat := range floor.PlayerStats { + for _, choice := range stat.AncientChoice { + + opts = append(opts, &AncientChoice{ + AncientOption: AncientOption{ + Key: choice.TextKey, + Type: choice.Title.Table, + }, + RunStat: st, + ActIndex: actIndex, + ActName: run.Acts[actIndex], + Chosen: choice.WasChosen, + }) + } + } + + } + } + return opts, nil +} -- cgit v1.3.1