summaryrefslogtreecommitdiff
path: root/model
diff options
context:
space:
mode:
authorewy <ewy0@protonmail.com>2026-05-22 16:54:49 +0200
committerewy <ewy0@protonmail.com>2026-05-22 16:54:49 +0200
commit007e2de369f9fc26da3237646de14f2af5052ee8 (patch)
treef81557385628fc93f1ef9616b8bc75a304f9d740 /model
initial commit
Diffstat (limited to 'model')
-rw-r--r--model/act.go9
-rw-r--r--model/run.go24
-rw-r--r--model/save.go106
-rw-r--r--model/versions.go3
4 files changed, 142 insertions, 0 deletions
diff --git a/model/act.go b/model/act.go
new file mode 100644
index 0000000..3a95939
--- /dev/null
+++ b/model/act.go
@@ -0,0 +1,9 @@
+package model
+
+type Act struct {
+ Floor int
+ Label string
+ Key string
+}
+
+var Acts = make(map[string]*Act)
diff --git a/model/run.go b/model/run.go
new file mode 100644
index 0000000..9329708
--- /dev/null
+++ b/model/run.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "crypto/md5"
+ "encoding/hex"
+ "encoding/json"
+)
+
+type Run struct {
+ RunSave
+ RunId string
+}
+
+func NewRun(fileContent []byte) (Run, error) {
+ var save RunSave
+ err := json.Unmarshal(fileContent, &save)
+ sum := md5.Sum(fileContent)
+ r := Run{RunId: hex.EncodeToString(sum[:]), RunSave: save}
+ if err != nil {
+ return r, err
+ }
+
+ return r, nil
+}
diff --git a/model/save.go b/model/save.go
new file mode 100644
index 0000000..4127828
--- /dev/null
+++ b/model/save.go
@@ -0,0 +1,106 @@
+package model
+
+type PlayerStat struct {
+ CurrentGold int `json:"current_gold"`
+ CurrentHp int `json:"current_hp"`
+ DamageTaken int `json:"damage_taken"`
+ GoldGained int `json:"gold_gained"`
+ GoldLost int `json:"gold_lost"`
+ GoldSpent int `json:"gold_spent"`
+ GoldStolen int `json:"gold_stolen"`
+ HpHealed int `json:"hp_healed"`
+ MaxHp int `json:"max_hp"`
+ MaxHpGained int `json:"max_hp_gained"`
+ MaxHpLost int `json:"max_hp_lost"`
+ PlayerID int `json:"player_id"`
+}
+
+type RunSave struct {
+ Acts []string `json:"acts"`
+ Ascension int `json:"ascension"`
+ BuildID string `json:"build_id"`
+ GameMode string `json:"game_mode"`
+ KilledByEncounter string `json:"killed_by_encounter"`
+ KilledByEvent string `json:"killed_by_event"`
+ MapPointHistory [][]struct {
+ MapPointType string `json:"map_point_type"`
+ PlayerStats []struct {
+ PlayerStat
+ CardChoices []struct {
+ Card struct {
+ Id string `json:"id"`
+ CurrentUpgradeLevel int `json:"current_upgrade_level"`
+ }
+ WasPicked bool `json:"was_picked"`
+ } `json:"card_choices"`
+ AncientChoice []struct {
+ TextKey string `json:"TextKey"`
+ Title struct {
+ Key string `json:"key"`
+ Table string `json:"table"`
+ } `json:"title"`
+ WasChosen bool `json:"was_chosen"`
+ } `json:"ancient_choice"`
+ CardsTransformed []struct {
+ FinalCard struct {
+ FloorAddedToDeck int `json:"floor_added_to_deck"`
+ ID string `json:"id"`
+ } `json:"final_card"`
+ OriginalCard struct {
+ FloorAddedToDeck int `json:"floor_added_to_deck"`
+ ID string `json:"id"`
+ } `json:"original_card"`
+ } `json:"cards_transformed"`
+ EventChoices []struct {
+ Title struct {
+ Key string `json:"key"`
+ Table string `json:"table"`
+ } `json:"title"`
+ } `json:"event_choices"`
+ GoldGained int `json:"gold_gained"`
+ GoldLost int `json:"gold_lost"`
+ GoldSpent int `json:"gold_spent"`
+ GoldStolen int `json:"gold_stolen"`
+ HpHealed int `json:"hp_healed"`
+ MaxHp int `json:"max_hp"`
+ MaxHpGained int `json:"max_hp_gained"`
+ MaxHpLost int `json:"max_hp_lost"`
+ PlayerID int `json:"player_id"`
+ RelicChoices []struct {
+ Choice string `json:"choice"`
+ WasPicked bool `json:"was_picked"`
+ } `json:"relic_choices"`
+ } `json:"player_stats"`
+ Rooms []struct {
+ ModelID string `json:"model_id"`
+ RoomType string `json:"room_type"`
+ TurnsTaken int `json:"turns_taken"`
+ } `json:"rooms"`
+ } `json:"map_point_history"`
+ Modifiers []interface{} `json:"modifiers"`
+ PlatformType string `json:"platform_type"`
+ Players []struct {
+ Character string `json:"character"`
+ Deck []struct {
+ FloorAddedToDeck int `json:"floor_added_to_deck"`
+ ID string `json:"id"`
+ Enchantment struct {
+ Amount int `json:"amount"`
+ ID string `json:"id"`
+ } `json:"enchantment,omitempty"`
+ } `json:"deck"`
+ ID int `json:"id"`
+ MaxPotionSlotCount int `json:"max_potion_slot_count"`
+ Potions []interface{} `json:"potions"`
+ Relics []struct {
+ FloorAddedToDeck int `json:"floor_added_to_deck"`
+ ID string `json:"id"`
+ } `json:"relics"`
+ } `json:"players"`
+ RunTime int `json:"run_time"`
+ SchemaVersion int `json:"schema_version"`
+ Seed string `json:"seed"`
+ StartTime int `json:"start_time"`
+ WasAbandoned bool `json:"was_abandoned"`
+ Win bool `json:"win"`
+}
diff --git a/model/versions.go b/model/versions.go
new file mode 100644
index 0000000..f07a3b1
--- /dev/null
+++ b/model/versions.go
@@ -0,0 +1,3 @@
+package model
+
+var Versions []string