300) { foreach ($_SESSION["characters"] as $character_id => &$charData) { if (isset($charData["refresh_token"])) { if ( !isset($charData["access_token"]) || is_token_expired($charData["access_token"]) ) { $new_tokens = refresh_token($charData["refresh_token"]); if (!empty($new_tokens["access_token"])) { $charData["access_token"] = $new_tokens["access_token"]; } else { error_log( "Failed to refresh token for character ID $character_id" ); } } } } unset($charData); $_SESSION['last_token_refresh'] = $page_load_time; } } if (!isset($_SESSION["characters"]) || empty($_SESSION["characters"])) { echo "No characters logged in. Go back"; exit(); } // Check if we have a cached blueprint list $cache_key = "all_character_blueprints"; $cached_data = get_cache_data($cache_key); if ($cached_data !== null) { $blueprints = $cached_data; } else { // Fetch blueprints for all characters $blueprints = []; $blueprint_ids = []; foreach ($_SESSION["characters"] as $character_id => $charData) { $access_token = $charData["access_token"] ?? null; if (!$access_token) { continue; } $character_blueprints = fetch_character_blueprints( $character_id, $access_token ); foreach ($character_blueprints as $bp) { $key = $bp["blueprint_type_id"] . "-" . $bp["material_efficiency"] . "-" . $bp["time_efficiency"] . "-" . $bp["runs"]; $blueprints[$key] = $bp; $blueprint_ids[] = $bp["blueprint_type_id"]; } } $blueprint_names = fetch_type_names(array_unique($blueprint_ids)); foreach ($blueprints as &$bp) { $bp["blueprint_name"] = $blueprint_names[$bp["blueprint_type_id"]] ?? "Unknown Blueprint"; } unset($bp); // Cache the results for 10 minutes set_cache_data($cache_key, $blueprints, 600); } ?> Blueprints

Blueprints

Blueprint Name Material Efficiency Time Efficiency Number of Runs Runs Remaining
% %