@@ -30,8 +30,9 @@ type CreaturesOverviewResponse struct {
3030}
3131
3232var (
33- BoostedCreatureImageRegex = regexp .MustCompile (`<img[^>]+\bsrc=["']([^"']+)["']` )
34- CreatureInformationRegex = regexp .MustCompile (`.*race=(.*)"><img src="(.*)" border.*div>(.*)<\/div>` )
33+ BoostedCreatureNameAndRaceRegex = regexp .MustCompile (`<a.*race=(.*)".*?>(.*)</a>` )
34+ BoostedCreatureImageRegex = regexp .MustCompile (`<img[^>]+\bsrc=["']([^"']+)["']` )
35+ CreatureInformationRegex = regexp .MustCompile (`.*race=(.*)"><img src="(.*)" border.*div>(.*)<\/div>` )
3536)
3637
3738func TibiaCreaturesOverviewImpl (BoxContentHTML string ) (CreaturesOverviewResponse , error ) {
@@ -51,6 +52,15 @@ func TibiaCreaturesOverviewImpl(BoxContentHTML string) (CreaturesOverviewRespons
5152 return CreaturesOverviewResponse {}, fmt .Errorf ("[error] TibiaCreaturesOverviewImpl failed at ReaderHTML.Find, err: %s" , err )
5253 }
5354
55+ // Regex to get data for name and race param for boosted creature
56+ subma1b := BoostedCreatureNameAndRaceRegex .FindAllStringSubmatch (InnerTableContainerTMPB , - 1 )
57+
58+ if len (subma1b ) > 0 {
59+ // Settings vars for usage in JSONData
60+ BoostedCreatureName = subma1b [0 ][2 ]
61+ BoostedCreatureRace = subma1b [0 ][1 ]
62+ }
63+
5464 // Regex to get image of boosted creature
5565 subma2b := BoostedCreatureImageRegex .FindAllStringSubmatch (InnerTableContainerTMPB , - 1 )
5666
@@ -83,9 +93,7 @@ func TibiaCreaturesOverviewImpl(BoxContentHTML string) (CreaturesOverviewRespons
8393 if len (subma1 ) > 0 && len (subma1 [0 ][3 ]) > 1 {
8494 // Adding bool to indicate features in creature_list
8595 FeaturedRace := false
86- if TibiaDataVerifyBoostedCreatureImage (subma1 [0 ][2 ], BoostedCreatureImage ) {
87- BoostedCreatureName = TibiaDataSanitizeEscapedString (subma1 [0 ][3 ])
88- BoostedCreatureRace = subma1 [0 ][1 ]
96+ if subma1 [0 ][1 ] == BoostedCreatureRace {
8997 FeaturedRace = true
9098 }
9199
0 commit comments