Skip to content

Commit 5ff636f

Browse files
committed
a few fixe in spells
- fix s.Find by adding additional css class - add check for exp lvl not to be - - add test for spell ice burst
1 parent ecd229a commit 5ff636f

File tree

5 files changed

+12
-8
lines changed

5 files changed

+12
-8
lines changed

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ replace github.com/TibiaData/tibiadata-api-go/src/validation => ./src/validation
1010

1111
require (
1212
github.com/PuerkitoBio/goquery v1.8.0
13-
github.com/TibiaData/tibiadata-api-go/src/static v0.0.0-20230129152830-3aef07c52e4b
14-
github.com/TibiaData/tibiadata-api-go/src/validation v0.0.0-20230129152830-3aef07c52e4b
13+
github.com/TibiaData/tibiadata-api-go/src/static v0.0.0-20230129215911-ecd229a4c256
14+
github.com/TibiaData/tibiadata-api-go/src/validation v0.0.0-20230129215911-ecd229a4c256
1515
github.com/gin-contrib/gzip v0.0.6
1616
github.com/gin-gonic/gin v1.8.2
1717
github.com/go-resty/resty/v2 v2.7.0
@@ -21,7 +21,7 @@ require (
2121
)
2222

2323
require (
24-
github.com/TibiaData/tibiadata-api-go/src/tibiamapping v0.0.0-20230129152830-3aef07c52e4b // indirect
24+
github.com/TibiaData/tibiadata-api-go/src/tibiamapping v0.0.0-20230129215911-ecd229a4c256 // indirect
2525
github.com/andybalholm/cascadia v1.3.1 // indirect
2626
github.com/davecgh/go-spew v1.1.1 // indirect
2727
github.com/gin-contrib/sse v0.1.0 // indirect

src/TibiaSpellsOverview.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ func TibiaSpellsOverviewImpl(vocationName string, BoxContentHTML string) (*Spell
8181
spellBuilder.TypeRune = true
8282
}
8383
case 3:
84-
spellBuilder.Level = TibiaDataStringToInteger(selectionText)
84+
if selectionText != "-" {
85+
spellBuilder.Level = TibiaDataStringToInteger(selectionText)
86+
}
8587
case 4:
8688
mana := -1
8789
if selectionText != "var." {

src/TibiaSpellsOverview_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ func TestOverviewAll(t *testing.T) {
5656
assert.True(findPersonSpell.TypeInstant)
5757
assert.False(findPersonSpell.TypeRune)
5858
assert.False(findPersonSpell.PremiumOnly)
59+
60+
iceBurstSpell := spellsOverviewJson.Spells.Spells[82]
61+
assert.Equal("Ice Burst", iceBurstSpell.Name)
62+
assert.Equal(0, iceBurstSpell.Level)
63+
assert.Equal(0, iceBurstSpell.Price)
5964
}
6065

6166
func TestOverviewDruid(t *testing.T) {

src/TibiaSpellsSpell.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ func TibiaSpellsSpellImpl(spell string, BoxContentHTML string) (*SpellInformatio
115115
}
116116

117117
// Running query over each div
118-
s.Find("table.Table2 tbody tr").EachWithBreak(func(index int, s *goquery.Selection) bool {
118+
s.Find("table.Table2 .TableContentContainer tbody tr").EachWithBreak(func(index int, s *goquery.Selection) bool {
119119
// Storing HTML into SpellDivHTML
120120
SpellDivHTML, err := s.Html()
121121
if err != nil {

src/TibiaSpellsSpell_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package main
22

33
import (
44
"io"
5-
"log"
65
"testing"
76

87
"github.com/TibiaData/tibiadata-api-go/src/static"
@@ -29,8 +28,6 @@ func TestFindPerson(t *testing.T) {
2928
assert := assert.New(t)
3029
spell := findPersonJson.Spell
3130

32-
log.Print(spell)
33-
3431
assert.Empty(spell.Description)
3532
assert.Equal("Find Person", spell.Name)
3633
assert.Equal("findperson", spell.Spell)

0 commit comments

Comments
 (0)