@@ -226,6 +226,7 @@ const initMapper = (map) => {
226226} ;
227227
228228let parentShowMap ;
229+ let defaultMapId ;
229230/**
230231 * Intercept the map request from the controller.
231232 */
@@ -238,21 +239,23 @@ const intercept = () => {
238239 hg . controllers . TreasureMapController . showMap = async ( id = false ) => {
239240 parentShowMap ( id ) ;
240241
241- const intercepted = await interceptMapRequest ( id ?? user ?. quests ?. QuestRelicHunter ?. default_map_id ) ;
242+ const intercepted = await interceptMapRequest ( id || defaultMapId ) ;
242243 setTimeout ( ( ) => {
243244 if ( ! intercepted ) {
244- interceptMapRequest ( id ?? user ?. quests ?. QuestRelicHunter ?. default_map_id ) ;
245+ interceptMapRequest ( id || defaultMapId ) ;
245246 }
246247 } , 1000 ) ;
247248 } ;
248249
249250 onRequest ( 'users/treasuremap_v2.php' , async ( data ) => {
251+ hg . controllers . TreasureMapController . clearMapCache ( ) ;
250252 if ( data . treasure_map && data . treasure_map . map_id ) {
251253 await setMapData ( data . treasure_map . map_id , data . treasure_map ) ;
252254 }
253255 } , true ) ;
254256
255257 onRequest ( 'board/board.php' , async ( data ) => {
258+ hg . controllers . TreasureMapController . clearMapCache ( ) ;
256259 if ( data . treasure_map && data . treasure_map . map_id ) {
257260 await setMapData ( data . treasure_map . map_id , data . treasure_map ) ;
258261 }
@@ -520,6 +523,11 @@ const init = () => {
520523 onEvent ( 'map_show_map_preview' , addMapClassesToPreview ) ;
521524 onEvent ( 'map_hide_map_preview' , removeMapClassesFromPreview ) ;
522525
526+ defaultMapId = user ?. quests ?. QuestRelicHunter ?. default_map_id ;
527+ onRequest ( '*' , ( ) => {
528+ defaultMapId = user ?. quests ?. QuestRelicHunter ?. default_map_id ;
529+ } , true ) ;
530+
523531 onRequest ( 'users/treasuremap_v2.php' , ( ) => {
524532 runMapEnhancements ( ) ;
525533 setTimeout ( runMapEnhancements , 750 ) ;
0 commit comments