File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -73,10 +73,20 @@ func (b *Builder) housesWorker(client *resty.Client) error {
7373
7474 })
7575
76+ // Find the index of Antica in b.Worlds[] or fallback to first index
77+ worldsIndex := func () int {
78+ for i , world := range b .Worlds {
79+ if world == "Antica" {
80+ return i
81+ }
82+ }
83+ return 0
84+ }()
85+
7686 for _ , town := range b .Towns {
7787 log .Printf ("[info] Retrieving data about houses and guildhalls in %s." , town )
7888
79- ApiUrl := "https://" + TibiaDataAPIhost + "/v4/houses/" + b .Worlds [0 ] + "/" + url .QueryEscape (town )
89+ ApiUrl := "https://" + TibiaDataAPIhost + "/v4/houses/" + b .Worlds [worldsIndex ] + "/" + url .QueryEscape (town )
8090 res , err := client .R ().Get (ApiUrl )
8191 if err != nil {
8292 return fmt .Errorf ("issue getting %s endpoint. Error: %s" , ApiUrl , err )
You can’t perform that action at this time.
0 commit comments