• 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 ZnoteAAC highscore page, sorting

Amiroslo

Excellent OT User
Joined
Jul 28, 2009
Messages
6,767
Solutions
5
Reaction score
769
Hi,

Currently the highscore page it’s sorting players from highest reborn, to lowest reborn. (After I edited it for that)

I need to do the following:
Sort according to vocation, then reborn.

Vocation sorting, highest vocation ID then highest reborn:
Voc ID 14
Voc ID 13
Voc ID 12
Voc ID 11
Voc ID 1-4 - those shouldn’t be sorted by vocation ID, but just reborns, since those are basic vocations that you can choose from when you start, while the other are promotional vocations.

Using latest ZnoteAAC, TFS 0.4

My highscore page code: <?php require_once 'engine/init.php'; include 'layout/overall/header.php';if - Pastebin.com (https://pastebin.com/HDka0t4x)

thank you
 
I can pay 10$ if someone can do this
PayPal: [email protected] :)

To sort the highscore page according to vocation, then reborn, you will need to modify the function fetchAllScores() in the engine/functions/highscore.php file.

Here is an updated version of fetchAllScores() that should sort the highscore page as required:

PHP:
function fetchAllScores($limit = 100, $engine = 'TFS_02', $ignoreGroupId = 0, $configVocations = [], $vocation = 'all', $loadFlags = false, $loadOutfits = false) {
global $SQL, $config;
$result = [];
foreach ($configVocations as $v_id => $v_data) {
$result[$v_id] = [];
}
if ($vocation === 'all') {
$vocationFilter = '';
} else {
$vocationFilter = 'AND `vocation` = '. (int)$vocation;
}
if ($ignoreGroupId === 0) {
$ignoreGroupIdFilter = '';
} else {
$ignoreGroupIdFilter = 'AND `group_id` != '. (int)$ignoreGroupId;
}
switch ($engine) {
case 'TFS_02':
$tableName = '`players`';
$skillColumnName = '`value`';
break;
default:
$tableName = '`player_skills`';
$skillColumnName = '`value` - `base`';
break;
}
$rowsPerPage = $config['highscore']['rowsPerPage'];
$offset = ($limit > $rowsPerPage) ? ($limit - $rowsPerPage) : 0;
foreach ($configVocations as $v_id => $v_data) {
if ($v_data['fromVoc'] !== false) {
continue;
}
$order = '';
if ($v_id > 4) {
$order .= 'ORDER BY `vocation` DESC, `reborns` DESC, `level` DESC, `magic` DESC, `name` ASC';
} else {
$order .= 'ORDER BY `reborns` DESC, `level` DESC, `magic` DESC, `name` ASC';
}
$sql = "SELECT `name`, `level`, `reborns`, `vocation`, `group_id`, `experience`, `magic`, `skill_fist`, `skill_club`, `skill_sword`, `skill_axe`, `skill_dist`, `skill_shielding`, `skill_fishing` FROM {$tableName} WHERE `group_id` != 1 {$ignoreGroupIdFilter} {$vocationFilter} {$order} LIMIT {$offset}, {$rowsPerPage};";
$data = $SQL->query($sql);
if ($data) {
foreach ($data as $player) {
$player['vocation_name'] = $configVocations[$player['vocation']]['name'];
$player['online'] = false;
if ($loadFlags) {
$player['country'] = getCountryCode($player['name']);
}
if ($loadOutfits) {
$player['outfit'] = outfitToCSS(getPlayerOutfit($player['name']));
}
$result[$v_id][] = $player;
}
}
}
return $result;
}

The function now includes a conditional statement that determines whether to order by vocation or not. If the vocation is one of the promotional vocations (vocation ID 11-14), it will sort by vocation ID, reborn, level, magic, and name. If the vocation is one of the basic voc
 
engine/functions/highscore.php file.
Hi,
this file doesnt exist, I believe the file that should be changed is users.php in engine/function/ , perhaps youre using a different Znote version (or chatgpt)?
also it says 'TFS_02', in your code above, is that correct? Because I am using 0.4 = TFS_03 as mentioned in the first post

Here is my users.php file: <?php// TFS 1.0 functions ///////////END 1.0 ////////// Fetch Images - Pastebin.com (https://pastebin.com/wBJ7qEuS)

Thank you
 
Last edited:
Back
Top