Skip to content

Commit 57742e6

Browse files
authored
feat: support new vocation monk (#451)
1 parent 16946de commit 57742e6

File tree

12 files changed

+3599
-2810
lines changed

12 files changed

+3599
-2810
lines changed

src/TIbiaDataDocsV3.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ type GuildsOverviewResponseV3 struct {
162162
// @Produce json
163163
// @Param world path string true "The world" default(all) extensions(x-example=Antica)
164164
// @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)
165-
// @Param vocation path string true "The vocation" default(all) Enums(all, knights, paladins, sorcerers, druids) extensions(x-example=knights)
165+
// @Param vocation path string true "The vocation" default(all) Enums(all, knights, paladins, sorcerers, druids, monks) extensions(x-example=knights)
166166
// @Param page path int true "The current page" default(1) minimum(1) extensions(x-example=1)
167167
// @Success 200 {object} HighscoresResponseV3
168168
// @Router /v3/highscores/{world}/{category}/{vocation}/{page} [get]

src/TibiaDataUtils.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,9 @@ func TibiaDataVocationValidator(vocation string) (string, string) {
275275
case "druid", "druids":
276276
vocationid = "5"
277277
vocation = "druids"
278+
case "monk", "monks":
279+
vocationid = "6"
280+
vocation = "monks"
278281
default:
279282
vocationid = "0"
280283
vocation = "all"

src/TibiaDataUtils_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ func TestTibiaDataVocationValidator(t *testing.T) {
8888
x, y = TibiaDataVocationValidator("druid")
8989
assert.Equal(x, "druids")
9090
assert.Equal(y, "5")
91+
x, y = TibiaDataVocationValidator("monk")
92+
assert.Equal(x, "monks")
93+
assert.Equal(y, "6")
9194
x, y = TibiaDataVocationValidator("")
9295
assert.Equal(x, "all")
9396
assert.Equal(y, "0")

src/TibiaSpellsSpell_test.go

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,12 @@ func TestFindPerson(t *testing.T) {
3737
assert.True(spell.HasSpellInformation)
3838
assert.NotNil(spell.SpellInformation)
3939
assert.Equal("exiva 'name'", spell.SpellInformation.Formula)
40-
assert.Equal(4, len(spell.SpellInformation.Vocation))
40+
assert.Equal(5, len(spell.SpellInformation.Vocation))
4141
assert.Equal("Druid", spell.SpellInformation.Vocation[0])
4242
assert.Equal("Knight", spell.SpellInformation.Vocation[1])
43-
assert.Equal("Paladin", spell.SpellInformation.Vocation[2])
44-
assert.Equal("Sorcerer", spell.SpellInformation.Vocation[3])
43+
assert.Equal("Monk", spell.SpellInformation.Vocation[2])
44+
assert.Equal("Paladin", spell.SpellInformation.Vocation[3])
45+
assert.Equal("Sorcerer", spell.SpellInformation.Vocation[4])
4546
assert.False(spell.SpellInformation.GroupAttack)
4647
assert.False(spell.SpellInformation.GroupHealing)
4748
assert.True(spell.SpellInformation.GroupSupport)
@@ -52,9 +53,9 @@ func TestFindPerson(t *testing.T) {
5253
assert.Equal(8, spell.SpellInformation.Level)
5354
assert.Equal(20, spell.SpellInformation.Mana)
5455
assert.Equal(80, spell.SpellInformation.Price)
55-
assert.Equal(12, len(spell.SpellInformation.City))
56+
assert.Equal(13, len(spell.SpellInformation.City))
5657
assert.Equal("Ab'Dendriel", spell.SpellInformation.City[0])
57-
assert.Equal("Yalahar", spell.SpellInformation.City[11])
58+
assert.Equal("Yalahar", spell.SpellInformation.City[12])
5859
assert.False(spell.SpellInformation.Premium)
5960
assert.False(spell.HasRuneInformation)
6061
}
@@ -85,9 +86,10 @@ func TestHeavyMagicMissileRune(t *testing.T) {
8586
assert.True(spell.HasSpellInformation)
8687
assert.NotNil(spell.SpellInformation)
8788
assert.Equal("adori vis", spell.SpellInformation.Formula)
88-
assert.Equal(2, len(spell.SpellInformation.Vocation))
89+
assert.Equal(3, len(spell.SpellInformation.Vocation))
8990
assert.Equal("Druid", spell.SpellInformation.Vocation[0])
90-
assert.Equal("Sorcerer", spell.SpellInformation.Vocation[1])
91+
assert.Equal("Monk", spell.SpellInformation.Vocation[1])
92+
assert.Equal("Sorcerer", spell.SpellInformation.Vocation[2])
9193
assert.False(spell.SpellInformation.GroupAttack)
9294
assert.False(spell.SpellInformation.GroupHealing)
9395
assert.True(spell.SpellInformation.GroupSupport)
@@ -107,7 +109,7 @@ func TestHeavyMagicMissileRune(t *testing.T) {
107109
assert.True(spell.HasRuneInformation)
108110
assert.Equal(4, len(spell.RuneInformation.Vocation))
109111
assert.Equal("Druid", spell.RuneInformation.Vocation[0])
110-
assert.Equal("Knight", spell.RuneInformation.Vocation[1])
112+
assert.Equal("Monk", spell.RuneInformation.Vocation[1])
111113
assert.Equal("Paladin", spell.RuneInformation.Vocation[2])
112114
assert.Equal("Sorcerer", spell.RuneInformation.Vocation[3])
113115
assert.True(spell.RuneInformation.GroupAttack)
@@ -230,7 +232,7 @@ func TestCurePoisonRune(t *testing.T) {
230232
assert.True(spell.HasSpellInformation)
231233
assert.NotNil(spell.SpellInformation)
232234
assert.Equal("adana pox", spell.SpellInformation.Formula)
233-
assert.Equal(1, len(spell.SpellInformation.Vocation))
235+
assert.Equal(2, len(spell.SpellInformation.Vocation))
234236
assert.False(spell.SpellInformation.GroupAttack)
235237
assert.False(spell.SpellInformation.GroupHealing)
236238
assert.True(spell.SpellInformation.GroupSupport)

src/TibiaWorldsWorld_test.go

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,3 +220,51 @@ func TestWorldOceanis(t *testing.T) {
220220
assert.Empty(world.TournamentWorldType)
221221
assert.Equal(0, len(world.OnlinePlayers))
222222
}
223+
224+
func TestWorldTesta(t *testing.T) {
225+
file, err := static.TestFiles.Open("testdata/worlds/world/Testa.html")
226+
if err != nil {
227+
t.Fatalf("file opening error: %s", err)
228+
}
229+
defer file.Close()
230+
231+
data, err := io.ReadAll(file)
232+
if err != nil {
233+
t.Fatalf("File reading error: %s", err)
234+
}
235+
236+
worldJson, err := TibiaWorldsWorldImpl("Testa", string(data), "")
237+
if err != nil {
238+
t.Fatal(err)
239+
}
240+
241+
assert := assert.New(t)
242+
world := worldJson.World
243+
244+
assert.Equal("Testa", world.Name)
245+
assert.Equal("online", world.Status)
246+
assert.Equal(87, world.PlayersOnline)
247+
assert.Equal(781, world.RecordPlayers)
248+
assert.Equal("2012-12-04T15:42:47Z", world.RecordDate)
249+
assert.Equal("2013-01", world.CreationDate)
250+
assert.Equal("Europe", world.Location)
251+
assert.Equal("Optional PvP", world.PvpType)
252+
assert.False(world.PremiumOnly)
253+
assert.Equal("regular", world.TransferType)
254+
assert.Equal(0, len(world.WorldsQuestTitles))
255+
assert.True(world.BattleyeProtected)
256+
assert.Equal("release", world.BattleyeDate)
257+
assert.Equal("regular", world.GameWorldType)
258+
assert.Empty(world.TournamentWorldType)
259+
assert.Equal(87, len(world.OnlinePlayers))
260+
261+
firstPlayer := world.OnlinePlayers[0]
262+
assert.Equal("Alius Harg E1", firstPlayer.Name)
263+
assert.Equal(8, firstPlayer.Level)
264+
assert.Equal("Monk", firstPlayer.Vocation)
265+
266+
thirdPlayer := world.OnlinePlayers[2]
267+
assert.Equal("Andris Hun paladin E1", thirdPlayer.Name)
268+
assert.Equal(23, thirdPlayer.Level)
269+
assert.Equal("Exalted Monk", thirdPlayer.Vocation)
270+
}

src/static/testdata/spells/spell/Convince Creature Rune.html

Lines changed: 682 additions & 704 deletions
Large diffs are not rendered by default.

src/static/testdata/spells/spell/Cure Poison Rune.html

Lines changed: 682 additions & 704 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)