| 120 | |
| 121 | |
| 122 | def register_location_api(app): |
| 123 | |
| 124 | @app.route("/api/planet/<planet_name>/location-data") |
| 125 | def get_planet_location_api(planet_name): |
| 126 | data = get_complete_location_data(planet_name) |
| 127 | return jsonify(data) |
| 128 | |
| 129 | @app.route("/api/current-location") |
| 130 | def get_current_location(): |
| 131 | galaxy_data = session.get("galaxy") |
| 132 | system_index = session.get("system") |
| 133 | |
| 134 | if not galaxy_data or system_index is None: |
| 135 | return jsonify({"error": "No current location in session"}) |
| 136 | |
| 137 | return jsonify({"galaxy_coordinates": galaxy_data["coordinates"], "system_index": system_index}) |