### Local Server for Testing (Shell) Source: https://github.com/pwingles/arc-raiders-map/blob/main/README.md Starts a local HTTP server to test the interactive map with live reload capabilities. This is useful for development and testing changes before deployment. It requires Python to be installed. ```powershell cd C:\Users\pring\OneDrive\Documents\ArcMap python -m http.server 8000 # visit http://localhost:8000 ``` -------------------------------- ### Define Map Configuration Data Structure (JavaScript) Source: https://context7.com/pwingles/arc-raiders-map/llms.txt Defines the structure for map configurations, including details like map ID, name, description, categories, and item locations. This data is loaded from `data/maps.js` and is accessible via `window.arcMapsConfig`. The example shows configurations for 'dam-battlegrounds' and 'spaceport'. ```javascript // Example map configuration structure in data/maps.js window.arcMapsConfig = { "dam-battlegrounds": { "id": "dam-battlegrounds", "name": "Dam Battlegrounds", "description": "Overgrown ruins of the Alcantara Power Plant. Toxic, waterlogged terrain.", "biome": "Flooded industrial exclusion zone", "thumbnail": "data/Dam_Battlegrounds_Map_(Server_Slam).jpg", "threatLevel": {"label": "High Threat", "color": "#f97316"}, "recommendedPower": 18, "featuredLoot": ["Aphelion Blueprint", "Stormglass Core modules"], "tileUrl": "https://tiles.mapgenie.io/games/arc-raiders/dam-battlegrounds/default-v1/{z}/{x}/{y}.jpg", "center": [-0.6990354480387, 0.656516773651405], // [lng, lat] "bounds": { "minLat": 0.42533543451718, "maxLat": 0.88769811278563, "minLng": -0.86595734500438, "maxLng": -0.53211355107302 }, "zoom": {"min": 9, "max": 14, "initial": 11}, "categories": [ { "id": 13842, "name": "Locked Door", "icon": "locked_door", "type": "lockedDoor", "group": "Locations", "color": "#223034", "visible": true }, { "id": 13823, "name": "Ammo Box", "icon": "ammo_box", "type": "ammoBox", "group": "Loot", "color": "#f59e0b", "visible": true } ], "items": [ { "id": 524427, "name": "Locked Door #3", "description": "Requires Security Clearance Level 2. Contains rare weapon blueprints.", "categoryId": 13842, "type": "lockedDoor", "coords": [-0.69812345, 0.65432100], "media": [] }, { "id": 524430, "name": "Ammo Cache Alpha", "description": "Heavy ammo and grenades", "categoryId": 13823, "type": "ammoBox", "coords": [-0.70123456, 0.66543210], "media": [] } ] }, "spaceport": { // Additional map configurations... } }; ``` -------------------------------- ### Initialize Interactive Map using JavaScript Source: https://context7.com/pwingles/arc-raiders-map/llms.txt Initializes the Mapbox GL map with MapGenie's raster tile server, sets up event listeners, and loads the first available map configuration with all categories and markers. The state management for the map is handled globally. ```javascript // In js/app.js - Initialization runs on DOMContentLoaded // Map state management const state = { currentMapId: "dam-battlegrounds", map: null, markers: [], foundItems: new Set(), visibleCategories: new Set(), searchQuery: "" }; // Initialization is automatic when page loads // Access map instance after initialization document.addEventListener('DOMContentLoaded', () => { // Map auto-initializes and loads first map setTimeout(() => { console.log("Current map:", state.currentMapId); console.log("Total markers:", state.markers.length); console.log("Map center:", state.map.getCenter()); }, 2000); }); ``` -------------------------------- ### Load Map Configuration with Mapbox GL Source: https://context7.com/pwingles/arc-raiders-map/llms.txt Initializes a Mapbox GL map with a specified configuration, including tile URLs, zoom levels, center coordinates, and bounds. It uses a provided map ID to fetch configuration details from `window.arcMapsConfig`. ```javascript // Switch to a different map function loadMap(mapId) { const mapConfig = window.arcMapsConfig[mapId]; if (!mapConfig) return; // Map configuration includes tile URL and bounds const map = new mapboxgl.Map({ container: 'map', style: { version: 8, sources: { 'mapgenie-tiles': { type: 'raster', tiles: [mapConfig.tileUrl], tileSize: 512, minzoom: mapConfig.zoom.min, maxzoom: mapConfig.zoom.max } }, layers: [{ id: 'mapgenie-layer', type: 'raster', source: 'mapgenie-tiles' }] }, center: mapConfig.center, // [lng, lat] zoom: mapConfig.zoom.initial, maxBounds: [[mapConfig.bounds.minLng, mapConfig.bounds.minLat], [mapConfig.bounds.maxLng, mapConfig.bounds.maxLat]] }); } // User clicks map tab - automatically triggers loadMap() document.querySelector('[data-map-id="spaceport"]').click(); ``` -------------------------------- ### Chartbeat Initialization (JavaScript) Source: https://github.com/pwingles/arc-raiders-map/blob/main/dam-battlegrounds-page.html Configures and loads the Chartbeat analytics script asynchronously. This is used for tracking website performance and user engagement. ```javascript var _sf_async_config = window._sf_async_config = (window._sf_async_config || {}); _sf_async_config.uid = 21105; _sf_async_config.domain = 'mapgenie.io'; _sf_async_config.flickerControl = false; _sf_async_config.useCanonical = true; _sf_async_config.useCanonicalDomain = true; _sf_async_config.sections = "arc-raiders"; function loadChartbeat() { var e = document.createElement('script'); var n = document.getElementsByTagName('script')[0]; e.type = 'text/javascript'; e.async = true; e.src = '//static.chartbeat.com/js/chartbeat.js'; n.parentNode.insertBefore(e, n); } loadChartbeat(); ``` -------------------------------- ### Synchronize MapGenie Data to Application Format using Python Source: https://context7.com/pwingles/arc-raiders-map/llms.txt Converts MapGenie JSON data into the application's map configuration format. This includes proper category mappings, coordinate transformations, and Mapbox GL tile layer configurations. The `main()` function generates the `maps.js` file. ```python from sync_mapgenie_data import process_map_data, generate_maps_js, main # Process a single map configuration map_config = process_map_data("dam-battlegrounds", { "file": "mapgenie_dam-battlegrounds.json", "id": "dam-battlegrounds", "name": "Dam Battlegrounds", "description": "Overgrown ruins of the Alcantara Power Plant.", "biome": "Flooded industrial exclusion zone", "thumbnail": "data/Dam_Battlegrounds_Map_(Server_Slam).jpg", "threatLevel": {"label": "High Threat", "color": "#f97316"}, "recommendedPower": 18, "featuredLoot": ["Aphelion Blueprint", "Stormglass Core modules"], "tile_url": "https://tiles.mapgenie.io/games/arc-raiders/dam-battlegrounds/default-v1/{z}/{x}/{y}.jpg" }) # Generate complete maps.js file for all configured maps main() # Output: data/maps.js with window.arcMapsConfig containing all map data ``` -------------------------------- ### Markdown-it Renderer Rule for Audio Links Source: https://github.com/pwingles/arc-raiders-map/blob/main/dam-battlegrounds-page.html Customizes the markdown-it renderer to transform links ending in '.mp3' into audio elements with controls. Other links will open in a new tab. ```javascript window.md = window.markdownit({ html: false, }); md.renderer.rules.link_open = function (tokens, idx, options, env, self) { var token = tokens[idx]; var href = token.attrs[0][1]; if (href.endsWith('.mp3')) { token.tag = "audio" token.attrs = [['src', href], ['controls', 'true']] } else { token.attrPush(['target', '_blank']); } return self.renderToken(tokens, idx, options, env, self); }; ``` -------------------------------- ### Export and Import User Progress (JavaScript) Source: https://context7.com/pwingles/arc-raiders-map/llms.txt Handles the export of user progress (found items) into a JSON file and the import of progress data from a previously exported file. It utilizes browser File API for file handling and JSON parsing. Requires HTML elements with IDs 'exportBtn' and 'importInput'. ```javascript // Export progress to JSON file function exportProgress() { const data = { version: 1, timestamp: new Date().toISOString(), foundItems: [...state.foundItems] // ["dam-battlegrounds-524427", ...] }; const blob = new Blob([JSON.stringify(data, null, 2)], {type: 'application/json'}); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = `arc-raiders-progress-${new Date().toISOString().split('T')[0]}.json`; a.click(); URL.revokeObjectURL(url); } // Import progress from file function importProgress(fileInputEvent) { const file = fileInputEvent.target.files?.[0]; if (!file) return; const reader = new FileReader(); reader.onload = (event) => { try { const data = JSON.parse(event.target.result); if (data.foundItems) { state.foundItems = new Set(data.foundItems); saveProgress(); // Save to localStorage loadMap(state.currentMapId); // Reload to update UI } } catch (err) { alert('Invalid progress file'); } }; reader.readAsText(file); } // Trigger export document.getElementById('exportBtn').click(); // Import via file input document.getElementById('importInput').addEventListener('change', importProgress); ``` -------------------------------- ### Overwolf Detection and Initialization Source: https://github.com/pwingles/arc-raiders-map/blob/main/dam-battlegrounds-page.html Sets a flag to indicate if the application is running within the Overwolf environment. Currently set to false. ```javascript window.isOverwolf = false; ``` -------------------------------- ### Compare Coordinate Systems using Python Source: https://context7.com/pwingles/arc-raiders-map/llms.txt A utility script for analyzing coordinate ranges and validating coordinate transformation between MapGenie's lat/lng format and the application's coordinate system. It loads data from a JSON file and prints the latitude and longitude ranges. ```python import json import re # Load and compare coordinate systems with open('mapgenie_dam-battlegrounds.json', 'r') as f: mg_data = json.load(f) # Extract locked door locations (category_id 13842) mg_locked_doors = [loc for loc in mg_data['locations'] if loc['category_id'] == 13842] # Analyze coordinate ranges all_lats = [float(loc['latitude']) for loc in mg_data['locations']] all_lngs = [float(loc['longitude']) for loc in mg_data['locations']] print(f"Latitude range: {min(all_lats):.6f} to {max(all_lats):.6f}") print(f"Longitude range: {min(all_lngs):.6f} to {max(all_lngs):.6f}") print(f"Center point: [{(min(all_lngs)+max(all_lngs))/2:.6f}, {(min(all_lats)+max(all_lats))/2:.6f}]") ``` -------------------------------- ### Custom Tile Layer Configuration (JavaScript) Source: https://github.com/pwingles/arc-raiders-map/blob/main/README.md Specifies the configuration for using custom map tiles, such as those provided by Mapbox. This includes the tile server URL, attribution, and initial map view center and zoom level. This is used when the `projection` is set to `geo`. ```javascript tileLayer: { url: "https://api.mapbox.com/styles/v1//