diff --git a/assets/pasted-20260409-093852-3bb41cef.png b/assets/pasted-20260409-093852-3bb41cef.png new file mode 100644 index 0000000..8f9d009 Binary files /dev/null and b/assets/pasted-20260409-093852-3bb41cef.png differ diff --git a/index.php b/index.php index 28434d3..ff446ca 100644 --- a/index.php +++ b/index.php @@ -1,5 +1,35 @@ 'scan-rarity-L', + 'E' => 'scan-rarity-E', + 'R' => 'scan-rarity-R', + 'U' => 'scan-rarity-U', + 'C' => 'scan-rarity-C', + default => 'scan-rarity-none', + }; +} + +function index_scan_rarity_label(?string $rarity): string +{ + return match (index_scan_normalize_rarity($rarity)) { + 'L' => 'Légendaire', + 'E' => 'Épique', + 'R' => 'Rare', + 'U' => 'Peu commun', + 'C' => 'Commun', + default => 'Non définie', + }; +} auth_start_session(); auth_bootstrap(); @@ -7,6 +37,66 @@ auth_bootstrap(); $session_cl_auth_user = isset($_SESSION['user']) ? (string) $_SESSION['user'] : ''; $session_cl_auth_right = isset($_SESSION['role']) ? (string) $_SESSION['role'] : ''; $is_authenticated = $session_cl_auth_user !== ''; + +$scan_reference_rows = []; +$scan_reference_max_occurrence = 0; +$scan_reference_error = null; + +try { + $db = db(); + $stmt_scan_reference = $db->query( + "SELECT o.cl_scobjs_id, o.cl_scobjs_name, o.cl_scobjs_rarity, m.cl_scmining_scan_value, m.cl_scmining_max_occurrence, + m.cl_scmining_can_manual, m.cl_scmining_can_land, m.cl_scmining_can_space + FROM tbl_scmining m + INNER JOIN tbl_scobjs o ON o.cl_scobjs_id = m.cl_scmining_obj_id + ORDER BY + CASE UPPER(COALESCE(o.cl_scobjs_rarity, '')) + WHEN 'L' THEN 1 + WHEN 'E' THEN 2 + WHEN 'R' THEN 3 + WHEN 'U' THEN 4 + WHEN 'C' THEN 5 + ELSE 6 + END, + o.cl_scobjs_name ASC" + ); + + foreach ($stmt_scan_reference->fetchAll() as $row) { + $occurrence_count = max(1, (int) ($row['cl_scmining_max_occurrence'] ?? 1)); + $scan_value = (int) ($row['cl_scmining_scan_value'] ?? 0); + $recovery_modes = []; + + if (!empty($row['cl_scmining_can_manual'])) { + $recovery_modes[] = 'Manuel'; + } + if (!empty($row['cl_scmining_can_land'])) { + $recovery_modes[] = 'Terrestre'; + } + if (!empty($row['cl_scmining_can_space'])) { + $recovery_modes[] = 'Spatial'; + } + + $scan_steps = []; + for ($i = 1; $i <= $occurrence_count; $i++) { + $scan_steps[] = $scan_value * $i; + } + + $scan_reference_rows[] = [ + 'id' => (string) ($row['cl_scobjs_id'] ?? ''), + 'name' => (string) ($row['cl_scobjs_name'] ?? ''), + 'rarity' => index_scan_normalize_rarity($row['cl_scobjs_rarity'] ?? ''), + 'rarity_label' => index_scan_rarity_label($row['cl_scobjs_rarity'] ?? ''), + 'rarity_class' => index_scan_rarity_class($row['cl_scobjs_rarity'] ?? ''), + 'recovery_modes' => $recovery_modes, + 'scan_steps' => $scan_steps, + 'max_occurrence' => $occurrence_count, + ]; + + $scan_reference_max_occurrence = max($scan_reference_max_occurrence, $occurrence_count); + } +} catch (Throwable $e) { + $scan_reference_error = 'Impossible de charger le tableau des signatures de scan pour le moment.'; +} ?> @@ -24,10 +114,242 @@ $is_authenticated = $session_cl_auth_user !== ''; +
- + + @@ -140,6 +524,127 @@ $is_authenticated = $session_cl_auth_user !== ''; + + +