Posted June 18Jun 18 Observação: testado apenas no Lucera2 Interlude.1 - Salve como top_enchant.php e coloque-o na pasta raiz do site ou onde preferir.2 - Execute o SQL no Navicat:SELECT C.char_name, C.online, I.enchant, I.item_typeFROM characters CINNER JOIN items I ON C.obj_Id = I.owner_idWHERE I.item_type IN (123, 456, 789)AND C.char_name != 'admin'ORDER BY I.enchant DESCLIMIT 30;3 - Modifique as configurações de conexão do PDO (em vermelho) para corresponder ao seu VPS (IP, BD, USUÁRIO e SENHA).$pdo = new PDO('mysql:host=YOUIP;dbname=YOUDB;charset=utf8mb4', 'root', 'PASS'); <?php // Author: RICARDOJRE // Description: Code to display the Top Enchant ranking // Configurações $countTopPlayers = 30; $weaponIds = [ 6591,6592,6593,6594,6595,6599,6600,6601,6602,6603,6604,6605,6606,6607,6608,6609,6610,7575,7576,7577,7578,6596,6597,6598,6587,6588,6589,6584,6585,6586,6580,6581,6582,6583,9824,9350,9351,9352,9353,9354,9355,9356,9357,9358,9359,9360,9361,9362,9363,9364,9365,9366,9367,9368,9369,9370,9371,9372,9373,9374,9375,9376,9377,9378,9379,9380,9381,9382,9383,9384,9385,9386,9387,9388,9389,9390,9391,9392,9393,9394,9664,9665,9666,9667 ]; // Mapeamento dos IDs para os nomes dos itens reais $itemNames = [ 6590 => "Angel Slayer Crt. Damage", 6591 => "Angel Slayer HP Drain", 6592 => "Angel Slayer Haste", 6593 => "Shining Bow Cheap Shot", 6594 => "Shining Bow Focus", 6595 => "Shining Bow Crt. Slow", 6599 => "Saint Spear Health", 6600 => "Saint Spear Guidance", 6601 => "Saint Spear Haste", 6602 => "Demon Splinter Focus", 6603 => "Demon Splinter Health", 6604 => "Demon Splinter Crt. Stun", 6605 => "Heavens Divider Haste", 6606 => "Heavens Divider Health", 6607 => "Heavens Divider Focus", 6608 => "Arcana Mace Acumen", 6609 => "Arcana Mace MP Regeneration", 6610 => "Arcana Mace Mana Up", 7575 => "Draconic Bow", 7576 => "Draconic Bow Cheap Shot", 7577 => "Draconic Bow Focus", 7578 => "Draconic Bow Critical Slow", 6596 => "Dragon Hunter Axe", 6597 => "Dragon Hunter Axe Health", 6598 => "Dragon Hunter Axe HP Drain", 6587 => "Imperial Staff Empower", 6588 => "Imperial Staff MP Regeneration", 6589 => "Imperial Staff Magic Hold", 6584 => "Basalt Battlehammer HP Drain", 6585 => "Basalt Battlehammer Health", 6586 => "Basalt Battlehammer HP Regeneration", 6580 => "Tallum Blade*Dark Legion's Edge", 6581 => "Forgotten Blade Haste", 6582 => "Forgotten Blade Health", 6583 => "Forgotten Blade Focus", 9824 => "Dual Miracles Magic", 9350 => "Dynasty Blade", 9351 => "Dynasty Two Handed Sword", 9352 => "Dynasty Magic Sword", 9353 => "Dynasty Bow", 9354 => "Dynasty Dagger", 9355 => "Dynasty Spear", 9356 => "Dynasty Hammer", 9357 => "Dynasty Staff", 9358 => "Dynasty Fist", 9359 => "Dynasty Crusher", 9360 => "Dynasty Two Handed Staff", 9361 => "Dynasty Dual Blade", 9362 => "Dynasty Blade Focus", 9363 => "Dynasty Blade Health", 9364 => "Dynasty Blade Haste", 9365 => "Dynasty Two Handed Sword Focus", 9366 => "Dynasty Two Handed Sword Health", 9367 => "Dynasty Two Handed Sword Haste", 9368 => "Dynasty Magic Sword Acumen", 9369 => "Dynasty Magic Sword Mana Up", 9370 => "Dynasty Magic Sword MP Regeneration", 9371 => "Dynasty Bow Cheap Shot", 9372 => "Dynasty Bow Critical Slow", 9373 => "Dynasty Bow Focus", 9374 => "Dynasty Dagger Critical Damage", 9375 => "Dynasty Dagger HP Drain", 9376 => "Dynasty Dagger Haste", 9377 => "Dynasty Spear Health", 9378 => "Dynasty Spear Guidance", 9379 => "Dynasty Spear Haste", 9380 => "Dynasty Hammer HP Drain", 9381 => "Dynasty Hammer Health", 9382 => "Dynasty Hammer HP Regeneration", 9383 => "Dynasty Staff Acumen", 9384 => "Dynasty Staff Mana Up", 9385 => "Dynasty Staff MP Regeneration", 9386 => "Dynasty Fist Focus", 9387 => "Dynasty Fist Health", 9388 => "Dynasty Fist Critical Stun", 9389 => "Dynasty Crusher HP Regeneration", 9390 => "Dynasty Crusher Health", 9391 => "Dynasty Crusher HP Drain", 9392 => "Dynasty Two Handed Staff Empower", 9393 => "Dynasty Two Handed Staff MP Regeneration", 9394 => "Dynasty Two Handed Staff Acumen", 9664 => "Dual Book Magic", 9665 => "Dual Book Magic - MP Regeneration", 9666 => "Dual Book Magic - Mana Up", 9667 => "Dual Book Magic - Acumen", ]; $weaponIdsString = implode(',', $weaponIds); try { // Configure sua conexão PDO aqui $pdo = new PDO('mysql:host=SEUIP;dbname=NOMEDOBANCODEDADOS;charset=utf8mb4', 'root', 'SENHA'); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $sql = " SELECT C.char_name, C.online, I.enchant, I.item_type FROM characters C INNER JOIN items I ON C.obj_Id = I.owner_id WHERE I.item_type IN ($weaponIdsString) AND LOWER(C.char_name) NOT IN ('jre', 'admin', 'gm') ORDER BY I.enchant DESC LIMIT :limit "; $stmt = $pdo->prepare($sql); $stmt->bindValue(':limit', $countTopPlayers, PDO:ARAM_INT); $stmt->execute(); $results = $stmt->fetchAll(PDO::FETCH_ASSOC); echo "<table border='1' cellpadding='5' cellspacing='0' style='margin: 0 auto; text-align: center;'>"; echo "<tr><th>Posição</th><th>Nome</th><th>Enchant</th><th>Item</th><th>Status</th></tr>"; $pos = 1; foreach ($results as $row) { $status = ($row['online'] == 1) ? "<span style='color:green'>On</span>" : "<span style='color:red'>Off</span>"; $enchant = "+" . intval($row['enchant']); $name = htmlspecialchars($row['char_name']); $itemType = intval($row['item_type']); $itemName = isset($itemNames[$itemType]) ? $itemNames[$itemType] : "Item desconhecido"; $itemName = htmlspecialchars($itemName); if ($pos == 1) { $color = "#FFD700"; // Ouro } elseif ($pos == 2) { $color = "#C0C0C0"; // Prata } elseif ($pos == 3) { $color = "#CD7F32"; // Bronze } else { $color = "#FFFFFF"; // Preto padrão } echo "<tr>"; echo "<td style='color: {$color}; font-weight: bold;'>{$pos}°</td>"; echo "<td style='color: {$color}; font-weight: bold;'>{$name}</td>"; echo "<td style='color: #90EE90; font-weight: bold;'>{$enchant}</td>"; echo "<td>{$itemName}</td>"; echo "<td>{$status}</td>"; echo "</tr>"; $pos++; } echo "</table>"; } catch (PDOException $e) { echo "Erro ao consultar o banco: " . $e->getMessage(); } ?> CREDITOS : Ricardo JRE MMO-DEV Edited June 18Jun 18 by Farmalouco
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.