• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

AAC Znote highscore multiworld

Vantoria

www.ClassicOT.us
Joined
Jun 6, 2014
Messages
186
Reaction score
16
Location
USA
hello friends i have a problem with my znote with multiworld support... well i want to ask a question how i can show specific worlds in highscore i mean i have 5 servers and 1 of them is only for test purpose how i can hide that world from my highscore?

Highscores.php
PHP:
<?php ini_set('memory_limit', '-1');?>
<?php require_once 'engine/init.php'; include 'layout/overall/header.php'; ?>
        <img src="layout/images/line_body.gif" align="center" height="7" width="100%">
        <img src="images/title_highscores.gif" align="left">
        <img src="layout/images/line_body.gif" align="center" height="7" width="100%">
<?php

if ($config['log_ip']) {
    znote_visitor_insert_detailed_data(3);
}

// Fetch highscore type
$type = (isset($_GET['type'])) ? (int)getValue($_GET['type']) : 7;
if ($type > 9) $type = 7;

// Fetch highscore vocation
$configVocations = $config['vocations'];
//$debug['configVocations'] = $configVocations;
$vocationIds = array_keys($configVocations);
$vocation = 'all';
if (isset($_GET['vocation']) && is_numeric($_GET['vocation'])) {
    $vocation = (int)$_GET['vocation'];
    if (!in_array($vocation, $vocationIds)) {
        $vocation = "all";
    }
}

$worlds = $config['worlds'];
$world_ids = get_av_worlds();
$world = 'all';
if (isset($_GET['world']) && is_numeric($_GET['world'])) {
    $world = (int)$_GET['world'];
    if (!in_array($world, $world_ids)) {
        $world = 'all';
    }
}

// Fetch highscore page
$page = getValue(@$_GET['page']);
if (!$page || $page == 0) $page = 1;
else $page = (int)$page;

$highscore = $config['highscore'];
$loadFlags = ($config['country_flags']['enabled'] && $config['country_flags']['highscores']) ? true : false;

$rows = $highscore['rows'];
$rowsPerPage = $highscore['rowsPerPage'];

function skillName($type) {
    $types = array(
        1 => "Club",
        2 => "Sword",
        3 => "Axe",
        4 => "Distance",
        5 => "Shield",
        6 => "Fish",
        7 => "Experience", // Hardcoded
        8 => "Magic Level", // Hardcoded
        9 => "Fist", // Since 0 returns false I will make 9 = 0. :)
    );
    return $types[(int)$type];
}

function pageCheck($index, $page, $rowPerPage) {
    return ($index < ($page * $rowPerPage) && $index >= ($page * $rowPerPage) - $rowPerPage) ? true : false;
}

$cache = new Cache('engine/cache/highscores-'.$world);
if ($cache->hasExpired()) {
    $vocGroups = fetchAllScores($rows, $config['TFSVersion'], $highscore['ignoreGroupId'], $configVocations, $vocation, $loadFlags, $world);
   
    $cache->setContent($vocGroups);
    $cache->save();
} else {
    $vocGroups = $cache->load();
}
if ($vocGroups) {
    $vocGroup = (is_array($vocGroups[$vocation])) ? $vocGroups[$vocation] : $vocGroups[$vocGroups[$vocation]];
    ?>
    <div class="panel panel-default" style="width: auto;">
    <div class="panel-body">

    <form class="form-inline" action="" method="GET" >
    <p class="justificando">
        <select class="form-control"  name="type" >
            <option value="7" <?php if ($type == 7) echo "selected"; ?>>Experience</option>
            <option value="8" <?php if ($type == 8) echo "selected"; ?>>Magic</option>
            <option value="5" <?php if ($type == 5) echo "selected"; ?>>Shield</option>
            <option value="2" <?php if ($type == 2) echo "selected"; ?>>Sword</option>
            <option value="1" <?php if ($type == 1) echo "selected"; ?>>Club</option>
            <option value="3" <?php if ($type == 3) echo "selected"; ?>>Axe</option>
            <option value="4" <?php if ($type == 4) echo "selected"; ?>>Distance</option>
            <option value="6" <?php if ($type == 6) echo "selected"; ?>>Fish</option>
            <option value="9" <?php if ($type == 9) echo "selected"; ?>>Fist</option>
        </select>

        <select class="form-control"  name="world">
            <option value="all" <?php if (!is_int($world)) echo "selected"; ?>>All Worlds</option>

            <?php
            foreach ($worlds as $w) {
                $w_id = $w['id'];
                    $selected = (is_int($world) && $world == $w_id) ? " selected $world = $w_id" : "";
                    echo '<option value="'. $w_id .'"'. $selected .'>'. $w['name'] .'</option>';
            }
            ?>
        </select>

        <select class="form-control"  name="vocation">
            <option value="all" <?php if (!is_int($vocation)) echo "selected"; ?>>Any Vocation</option>

            <?php
            foreach ($configVocations as $v_id => $v_data) {
                if ($v_data['fromVoc'] === false) {
                    $selected = (is_int($vocation) && $vocation == $v_id) ? " selected $vocation = $v_id" : "";
                    echo '<option value="'. $v_id .'"'. $selected .'>'. $v_data['name'] .'</option>';
                }
            }
            ?>
        </select>

        <select class="form-control"  name="page" >
            <?php
            $pages = ceil(min(($highscore['rows'] / $highscore['rowsPerPage']), (count($vocGroup[$type]) / $highscore['rowsPerPage'])));
            for ($i = 0; $i < $pages; $i++) {
                $x = $i + 1;
                if ($x == $page) echo "<option value='".$x."' selected>Page: ".$x."</option>";
                else echo "<option value='".$x."'>Page: ".$x."</option>";
            }
            ?>
        </select>

        <input type="submit" value="View" class="btn btn-info">
        </p>
    </form>
   
    <table style="width: 100%;/*border:3px double #fff;*/box-shadow:1px 1px 10px #000;" cellpadding="10" cellspacing="1">
        <tr class="yellow">
            <td>#</td>
            <th>Name</th>
            <?php if ($world === 'all') echo '<th>World</th>' ?>
            <th>Vocation</th>
            <th>Level</th>
            <?php if ($type === 7) echo "<th>Experience</th>"; ?>
        </tr>
        </thead>
        <?php
       
        for ($i = 0; $i < count($vocGroup[$type]); $i++) {
            if ($vocGroup[$type] === false) {
                ?>
                <tr>
                    <td colspan="5">Nothing to show here yet.</td>
                </tr>
                <?php
            } else {
                    if (pageCheck($i, $page, $rowsPerPage)) {
                            $flag = ($loadFlags === true && strlen($vocGroup[$type][$i]['flag']) > 1) ? '<img src="' . $config['country_flags']['server'] . '/' . $vocGroup[$type][$i]['flag'] . '.png">  ' : '';?>
                            <tr>
                                <td><?php echo $i+1; ?></td>
                                <td><?php echo $flag; ?><a href="characterprofile.php?name=<?php echo $vocGroup[$type][$i]['name']; ?>"><?php echo $vocGroup[$type][$i]['name']; ?></a></td>
                                <?php if ($world === 'all') echo '<td>'.world_id_to_name((int)$vocGroup[$type][$i]['world_id']).'</td>';?>
                                <td><?php echo vocation_id_to_name($vocGroup[$type][$i]['vocation']); ?></td>
                                <td><?php echo $vocGroup[$type][$i]['value']; ?></td>
                                <?php if ($type === 7) echo "<td>". $vocGroup[$type][$i]['experience'] ."</td>"; ?>
                            </tr>
<?php
                    }
            }
        }
?>
    </table>
    </div>
    </div>
    <?php
}
include 'layout/overall/footer.php'; ?>
this is how i identify the worlds in config.php
PHP:
    $config['worlds'] = array(
        array(
            'id' => 1,
            'name' => 'Empera',
            'ip' => 'empera-global.com',
            'port' => 7172
        ),
sorry for tag you guys
@Znote
@Magich
 
Last edited:
You could just remove the array of the test server after this line:
PHP:
$worlds = $config['worlds'];
by using:
PHP:
unset($worlds[x]);
where x is the position of the test server in worlds array (0 would be first element in that array, 1 the second, ...)
;)
 
You could just remove the array of the test server after this line:
PHP:
$worlds = $config['worlds'];
by using:
PHP:
unset($worlds[x]);
where x is the position of the test server in worlds array (0 would be first element in that array, 1 the second, ...)
;)
thanks for reply it did work for select world option test server doesn't show up for select that part is good now but they still showing up because the select option "All Worlds" at line 98 it is like when you go to the page highscores.php directly show all worlds how i can change that to select show specific world when you visit highscores
 
Back
Top