Skip to content

Commit 7bb889e

Browse files
committed
feat: add support for new highscore categories
1 parent 259b2b0 commit 7bb889e

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

src/validation/highscore.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77

88
var (
99
// validHighscoreCatregories stores all valid highscore categories
10-
validHighscoreCategories = []string{"achievements", "achievement", "axe", "axefighting", "charm", "charms", "charmpoints", "charmspoints", "club", "clubfighting", "distance", "distancefighting", "fishing", "fist", "fistfighting", "goshnar", "goshnars", "goshnarstaint", "loyalty", "loyaltypoints", "magic", "mlvl", "magiclevel", "shielding", "shield", "sword", "swordfighting", "drome", "dromescore", "experience", "boss", "bosses", "bosspoints"}
10+
validHighscoreCategories = []string{"achievements", "achievement", "axe", "axefighting", "charm", "charms", "charmpoints", "charmspoints", "club", "clubfighting", "distance", "distancefighting", "fishing", "fist", "fistfighting", "goshnar", "goshnars", "goshnarstaint", "loyalty", "loyaltypoints", "magic", "mlvl", "magiclevel", "shielding", "shield", "sword", "swordfighting", "drome", "dromescore", "experience", "boss", "bosses", "bosspoints", "bountypoints", "bountypoint", "bountypointsearned", "weeklytasks", "weeklytask", "weeklytaskscompleted"}
1111
)
1212

1313
// IsHighscoreCategoryValid reports wheter the provided string represents a valid highscore category
@@ -40,6 +40,8 @@ const (
4040
HighScoreSwordfighting
4141
HighScoreDromescore
4242
HighScoreBosspoints
43+
HighScoreBountypoints
44+
HighScoreWeeklytasks
4345
)
4446

4547
func (hc HighscoreCategory) String() (string, error) {
@@ -82,6 +84,10 @@ func HighscoreCategoryFromString(input string) HighscoreCategory {
8284
return HighScoreDromescore
8385
case "boss", "bosses", "bosspoints":
8486
return HighScoreBosspoints
87+
case "bountypoints", "bountypoint", "bountypointsearned":
88+
return HighScoreBountypoints
89+
case "weeklytaskscompleted", "weeklytasks", "weeklytask":
90+
return HighScoreWeeklytasks
8591
default:
8692
return HighScoreExperience
8793
}

src/validation/highscore_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,14 @@ func TestHighscoreCategoryFromString(t *testing.T) {
125125
inputs: []string{"boss", "bosses", "bosspoints"},
126126
expected: HighScoreBosspoints,
127127
},
128+
"Bountypoints": {
129+
inputs: []string{"bountypoints", "bountypoint", "bountypointsearned"},
130+
expected: HighscoreBountypoints,
131+
},
132+
"Weeklytasks": {
133+
inputs: []string{"weeklytasks", "weeklytask", "weeklytaskscompleted"},
134+
expected: HighscoreWeeklytasks,
135+
},
128136
}
129137

130138
for category, data := range categoryTests {

src/webserver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ func tibiaGuildsOverview(c *gin.Context) {
499499
// @Accept json
500500
// @Produce json
501501
// @Param world path string true "The world" default(all) extensions(x-example=Antica)
502-
// @Param category path string true "The category" default(experience) Enums(achievements, axefighting, charmpoints, clubfighting, distancefighting, experience, fishing, fistfighting, goshnarstaint, loyaltypoints, magiclevel, shielding, swordfighting, dromescore, bosspoints) extensions(x-example=fishing)
502+
// @Param category path string true "The category" default(experience) Enums(achievements, axefighting, charmpoints, clubfighting, distancefighting, experience, fishing, fistfighting, goshnarstaint, loyaltypoints, magiclevel, shielding, swordfighting, dromescore, bosspoints, bountypoints, weeklytasks) extensions(x-example=fishing)
503503
// @Param vocation path string true "The vocation" default(all) Enums(all, knights, paladins, sorcerers, druids, monks) extensions(x-example=all)
504504
// @Param page path int true "The current page" default(1) minimum(1) extensions(x-example=1)
505505
// @Success 200 {object} HighscoresResponse

0 commit comments

Comments
 (0)