@@ -32,7 +32,7 @@ type CreaturesOverviewResponse struct {
3232var (
3333 BoostedCreatureNameAndRaceRegex = regexp .MustCompile (`<a.*race=(.*)".*?>(.*)</a>` )
3434 BoostedCreatureImageRegex = regexp .MustCompile (`<img[^>]+\bsrc=["']([^"']+)["']` )
35- BoostedCreatureRaceRegex = regexp .MustCompile (`monsters\/(.*).gif` )
35+ BoostedCreatureRaceRegex = regexp .MustCompile (`.* monsters\/(.*).gif.* ` )
3636 CreatureInformationRegex = regexp .MustCompile (`.*race=(.*)"><img src="(.*)" border.*div>(.*)<\/div>` )
3737)
3838
@@ -58,6 +58,13 @@ func TibiaCreaturesOverviewImpl(BoxContentHTML string, url string) (CreaturesOve
5858 // Settings vars for usage in JSONData
5959 BoostedCreatureName = subma1b [0 ][2 ]
6060 BoostedCreatureRace = subma1b [0 ][1 ]
61+ } else {
62+ // Fallback if boosted creature is not in creature list
63+ BoostedCreatureName = InnerTableContainerTMPB [strings .Index (InnerTableContainerTMPB , ": " )+ 2 :]
64+ subma3b := BoostedCreatureRaceRegex .FindStringSubmatch (InnerTableContainerTMPB )
65+ if len (subma3b ) > 0 {
66+ BoostedCreatureRace = subma3b [1 ]
67+ }
6168 }
6269
6370 // Regex to get image of boosted creature
@@ -68,23 +75,6 @@ func TibiaCreaturesOverviewImpl(BoxContentHTML string, url string) (CreaturesOve
6875 BoostedCreatureImage = subma2b [0 ][1 ]
6976 }
7077
71- // Fallback if boosted creature is not in creature list
72- if len (BoostedCreatureName ) == 0 {
73-
74- // Find boosted creature
75- boostedMonsterTitle , boostedCreatureFound := ReaderHTML .Find ("#Monster" ).First ().Attr ("title" )
76-
77- if boostedCreatureFound {
78- boostedCreatureRace := boostedMonsterTitle [strings .Index (boostedMonsterTitle , ": " )+ 2 :]
79-
80- subma3b := BoostedCreatureRaceRegex .FindStringSubmatch (BoostedCreatureImage )
81- if len (subma3b ) > 0 {
82- BoostedCreatureName = boostedCreatureRace
83- BoostedCreatureRace = subma3b [1 ]
84- }
85- }
86- }
87-
8878 var (
8979 // Creating empty CreaturesData var
9080 CreaturesData []OverviewCreature
0 commit comments