'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', }; } function index_itemcustom_display_value($value): string { if ($value === null || $value === '') { return '0'; } if (is_numeric($value)) { $formatted = number_format((float) $value, 2, '.', ''); $formatted = rtrim(rtrim($formatted, '0'), '.'); return $formatted === '' ? '0' : $formatted; } return trim((string) $value) !== '' ? trim((string) $value) : '0'; } function index_itemcustom_stat_preview(?string $sign, $value, ?string $unit): string { $prefix = $sign === '-' ? '-' : ($sign === '+' ? '+' : ''); $displayValue = index_itemcustom_display_value($value); $displayUnit = trim((string) ($unit ?? '')); return trim($prefix . $displayValue . ($displayUnit !== '' ? ' ' . $displayUnit : '')); } function index_vanilla_description_html(?string $description): string { $description = trim((string) $description); if ($description === '') { return 'Aucune description.'; } if ($description !== strip_tags($description)) { return $description; } return nl2br(htmlspecialchars($description, ENT_QUOTES, 'UTF-8')); } function index_vanilla_uex_normalize_whitespace(string $value): string { return trim((string) preg_replace('/\s+/u', ' ', html_entity_decode(strip_tags($value), ENT_QUOTES | ENT_HTML5, 'UTF-8'))); } function index_vanilla_uex_normalize_search_text(string $value): string { $value = function_exists('mb_strtolower') ? mb_strtolower($value, 'UTF-8') : strtolower($value); $value = preg_replace('/[^[:alnum:]]+/u', ' ', $value); return trim((string) preg_replace('/\s+/u', ' ', $value)); } function index_vanilla_uex_title_matches_query(string $title, string $queryName): bool { $normalizedTitle = index_vanilla_uex_normalize_search_text($title); $normalizedQuery = index_vanilla_uex_normalize_search_text($queryName); if ($normalizedTitle === '' || $normalizedQuery === '') { return false; } if (strpos($normalizedTitle, $normalizedQuery) !== false) { return true; } $queryTokens = array_values(array_filter(explode(' ', $normalizedQuery), static function (string $token): bool { return preg_match('/\d/', $token) || strlen($token) >= 3; })); if ($queryTokens === []) { return false; } foreach ($queryTokens as $token) { if (strpos($normalizedTitle, $token) === false) { return false; } } return true; } function index_vanilla_uex_extract_price_value(string $rawPrice): ?int { $rawPrice = trim($rawPrice); if ($rawPrice === '') { return null; } if (!preg_match('/([0-9][0-9\s,\.]*)((?:\s*[KMB])?)\s*(?:A?UEC)\b/i', $rawPrice, $matches)) { return null; } $numberPart = preg_replace('/\s+/', '', (string) ($matches[1] ?? '')); $suffix = strtoupper(trim((string) ($matches[2] ?? ''))); if ($numberPart === '') { return null; } if ($suffix !== '') { if (substr_count($numberPart, ',') === 1 && strpos($numberPart, '.') === false) { $numberPart = str_replace(',', '.', $numberPart); } else { $numberPart = str_replace(',', '', $numberPart); } } else { if (strpos($numberPart, ',') !== false && strpos($numberPart, '.') !== false) { if (strrpos($numberPart, ',') > strrpos($numberPart, '.')) { $numberPart = str_replace('.', '', $numberPart); $numberPart = str_replace(',', '.', $numberPart); } else { $numberPart = str_replace(',', '', $numberPart); } } else { $numberPart = str_replace(',', '', $numberPart); } } if (!is_numeric($numberPart)) { return null; } $value = (float) $numberPart; $multiplier = match ($suffix) { 'K' => 1000, 'M' => 1000000, 'B' => 1000000000, default => 1, }; return (int) round($value * $multiplier); } function index_vanilla_uex_parse_estimate_from_html(string $html, string $queryName, int $sampleLimit = 10): array { $values = []; $chunks = preg_split('/
La sécurité et la protection des intérêts impériaux sont des priorités absolues pour l’agence.
En tant que garante de l’ordre dans les zones sous juridiction de l’UEE, l’agence BOPS s'engage à prévenir, neutraliser et répondre efficacement à toutes les formes de menaces, qu'elles soient internes ou externes aux territoires de l'Empire.
Cette mission repose sur une approche combinant vigilance, réactivité et expertise tactique, afin d’assurer la stabilité, la sécurité des citoyens et le respect des lois impériales.
Chaque opération est conçue pour inspirer confiance aux populations locales tout en projetant une image de force et de discipline au sein de l’univers connu.
— Surveillance active des secteurs critiques pour dissuader les menaces potentielles. — Protection rapprochée de convois, personnalités importantes ou cargaisons sensibles. — Neutralisation de vaisseaux hostiles ou suspects, avec récupération d’actifs stratégiques. — Ciblage et capture ou élimination de fugitifs dangereux, conformément aux lois impériales. — Protection des civils en détresse et aide aux infrastructures endommagées. — Collecte et analyse d’informations sur des activités suspectes, incidents ou organisations hostiles.