Skip to content

Commit 658027e

Browse files
committed
Add new items from puzzes data
1 parent c3d65db commit 658027e

2 files changed

Lines changed: 32 additions & 5 deletions

File tree

controllers/puzzles.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,13 @@ func (p *PuzzleController) GetPuzzles(c *gin.Context) {
4848

4949
puzzleResponse := models.PuzzleResponse{
5050
Name: puzzle.GetName(),
51+
Title: puzzle.DescProps.Title,
52+
Index: puzzle.DescProps.Index,
5153
Difficulty: puzzle.DescProps.Difficulty,
5254
Language: puzzle.DescProps.Language,
5355
CompressedSize: compressedSize,
5456
UncompressedSize: uncompressedSize,
57+
HivecraftVersion: puzzle.MetaProps.HivecraftVersion,
5558
Cipher: puzzle.Cipher,
5659
Obscure: puzzle.Obscure,
5760
ID: puzzle.MetaProps.ID,
@@ -157,10 +160,13 @@ func (p *PuzzleController) GetPuzzle(c *gin.Context) {
157160

158161
puzzleResponse := models.PuzzleResponse{
159162
Name: foundPuzzle.GetName(),
163+
Title: foundPuzzle.DescProps.Title,
164+
Index: foundPuzzle.DescProps.Index,
160165
Difficulty: foundPuzzle.DescProps.Difficulty,
161166
Language: foundPuzzle.DescProps.Language,
162167
CompressedSize: compressedSize,
163168
UncompressedSize: uncompressedSize,
169+
HivecraftVersion: foundPuzzle.MetaProps.HivecraftVersion,
164170
Cipher: foundPuzzle.Cipher,
165171
Obscure: foundPuzzle.Obscure,
166172
ID: foundPuzzle.MetaProps.ID,

models/puzzle.go

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,13 @@ type Puzzle struct {
2323
// PuzzleResponse represents puzzle data for API responses
2424
type PuzzleResponse struct {
2525
Name string `json:"name"`
26+
Title string `json:"title"`
27+
Index string `json:"index"`
2628
Difficulty string `json:"difficulty"`
2729
Language string `json:"language"`
2830
CompressedSize int64 `json:"compressedSize"`
2931
UncompressedSize int64 `json:"uncompressedSize"`
32+
HivecraftVersion string `json:"hivecraftVersion"`
3033
Cipher string `json:"cipher"`
3134
Obscure string `json:"obscure"`
3235
ID string `json:"id"`
@@ -38,18 +41,21 @@ type PuzzleResponse struct {
3841
// MetaProps represents metadata XML properties for a puzzle
3942
type MetaProps struct {
4043
XMLName xml.Name `xml:"Properties"`
41-
Author string `xml:"author"`
42-
Created string `xml:"created"`
43-
Modified string `xml:"modified"`
44-
Title string `xml:"title"`
45-
ID string `xml:"id"`
44+
Author string `xml:"author"`
45+
Created string `xml:"created"`
46+
Modified string `xml:"modified"`
47+
HivecraftVersion string `xml:"hivecraftVersion"`
48+
Title string `xml:"title"`
49+
ID string `xml:"id"`
4650
}
4751

4852
// DescProps represents description XML properties for a puzzle
4953
type DescProps struct {
5054
XMLName xml.Name `xml:"Properties"`
5155
Difficulty string `xml:"difficulty"`
5256
Language string `xml:"language"`
57+
Title string `xml:"title"`
58+
Index string `xml:"index"`
5359
}
5460

5561
// GetName returns the name of the puzzle (last part of the path)
@@ -96,4 +102,19 @@ func (p *Puzzle) GetUnveilPath() string {
96102
// GetId returns the ID of the puzzle
97103
func (p *Puzzle) GetId() string {
98104
return p.MetaProps.ID
105+
}
106+
107+
// GetPuzzleTitle returns the title of the puzzle
108+
func (p *Puzzle) GetPuzzleTitle() string {
109+
return p.DescProps.Title
110+
}
111+
112+
// GetPuzzleIndex returns the index of the puzzle
113+
func (p *Puzzle) GetPuzzleIndex() string {
114+
return p.DescProps.Index
115+
}
116+
117+
// GetPuzzleHivecraftVersion returns the Hivecraft version of the puzzle
118+
func (p *Puzzle) GetPuzzleHivecraftVersion() string {
119+
return p.MetaProps.HivecraftVersion
99120
}

0 commit comments

Comments
 (0)