@@ -173,12 +173,24 @@ def get_guide(self):
173173
174174 def get_x_map_id (self ):
175175 response = requests .get (
176- self .URLS ["x-maps" ], headers = self .x_headers
176+ self .URLS ["x-maps" ] + "?guide=%d" % self .guide ,
177+ headers = self .x_headers ,
177178 ).json ()
178179 for r in response ["results" ]:
179180 if r ["name" ]["en-US" ] == self .REGIONED_MAP :
181+ self .logger .debug (
182+ "Found map '%s' with id=%d for guide=%d" ,
183+ self .REGIONED_MAP ,
184+ r ["id" ],
185+ self .guide ,
186+ )
180187 return r ["id" ]
181- self .logger .critical ("ERROR: Did not find expected map" )
188+ self .logger .critical (
189+ "ERROR: Did not find expected map '%s' for guide %d" ,
190+ self .REGIONED_MAP ,
191+ self .guide ,
192+ )
193+ sys .exit (1 )
182194
183195 def get_things (self , thing ):
184196 """
@@ -307,15 +319,15 @@ def add_x_map_region(self, map_region, update, rid, location_id):
307319 }
308320 self .add_thing ("x-map-regions" , name , data , update , rid )
309321
310- def get_x_map_region_for_room (self , room ):
322+ def get_x_map_region_for_room (self , location_id ):
311323 return next (
312324 (
313325 reg
314326 for reg in self .x_map_regions .values ()
315327 if (
316328 reg ["location" ] is not None
317329 and "name" in reg ["location" ]
318- and reg ["location" ]["id" ] == room
330+ and reg ["location" ]["id" ] == location_id
319331 )
320332 ),
321333 None ,
@@ -333,13 +345,12 @@ def setup_x_map_regions(self):
333345 continue
334346 update = False
335347 rid = None
336- guidebook_map_region = self .get_x_map_region_for_room (room )
348+ location_id = self .x_rooms [room ]["id" ]
349+ guidebook_map_region = self .get_x_map_region_for_room (location_id )
337350 if guidebook_map_region :
338351 update = True
339352 rid = guidebook_map_region ["id" ]
340353
341- location_id = self .x_rooms [room ]["id" ]
342-
343354 if self .update :
344355 # Update room's Guidebook location to work the map region.
345356 # NOTE: Changing the type to gb-interactive hides the location
0 commit comments