block fields & records panel
global $ml_custom_ui, $ml_records;
$ml_custom_ui = array('global' => true,
'notice' => true,
'challenge_info' => true,
'net_infos' => true,
'chat' => true,
'checkpoint_list' => true,
'round_scores' => true,
'scoretable' => true
);
$ml_records = array('local' => ' --.--', 'dedi' => ' --.--', 'tmx' => ' --.--');
/**
* Displays a single ManiaLink window to a player
*
* $login : player login to send window to
* $header: string
* $icon : array( $style, $substyle {, $sizechg} )
* $data : array( $line1=array($col1, $col2, ...), $line2=array(...) )
* $widths: array( $overal, $col1, $col2, ...)
* $button: string
*
* A $line with one $col will occupy the full window width,
* otherwise all $line's must have the same number of columns,
* as should $widths (+1 for $overall).
* line height=".046" is required minimum to prevent alignment glitches
* due to large characters in some cells.
* If $colX is an array, it contains the string and the button's action id.
*/
function display_manialink($login, $header, $icon, $data, $widths, $button) {
global $aseco;
$player = $aseco->server->players->getPlayer($login);
$style = $player->style;
// check for old TMN-style window
if (empty($style)) {
$tsp = 'B'; // 'F' = solid, '0' = invisible
$txt = '333' . $tsp; // dark grey
$bgd = 'FFF' . $tsp; // white
$spc = 'DDD' . $tsp; // light grey
// build manialink header
$xml = '' .
'' . LF .
'' . LF;
// add header
$xml .= ' $o' . htmlspecialchars(validateUTF8String($header)) . ' | ' . LF;
// add spacer
$xml .= '' . LF;
$xml .= '$ | ' . LF;
// add lines with optional columns
foreach ($data as $line) {
$xml .= '';
if (!empty($line)) {
if (count($line) > 1) {
for ($i = 0; $i < count($widths)-1; $i++) {
if (is_array($line[$i])) {
$xml .= ' $o' . htmlspecialchars(validateUTF8String($line[$i][0])) . ' | ';
} else {
$xml .= ' $o' . htmlspecialchars(validateUTF8String($line[$i])) . ' | ';
}
}
} else {
$xml .= ' $o' . htmlspecialchars(validateUTF8String($line[0])) . ' | ';
}
} else { // spacer
$xml .= '$ | ';
}
$xml .= '' . LF;
}
// add spacer, button (action "0" = close) & footer
$xml .= '$ | ' . LF;
$xml .= '$o' . $button . ' | ';
} else { // TMF-style window
$hsize = $style['HEADER'][0]['TEXTSIZE'][0];
$bsize = $style['BODY'][0]['TEXTSIZE'][0];
$lines = count($data);
// build manialink header & window
$xml = '' .
'' . LF;
// add header and optional icon
$xml .= '' . LF;
if (is_array($icon)) {
$isize = $hsize;
if (isset($icon[2]))
$isize += $icon[2];
$xml .= '' . LF;
$xml .= '' . LF;
} else {
$xml .= '' . LF;
}
// add body
$xml .= '' . LF;
// add lines with optional columns
$xml .= '' . LF;
$cnt = 0;
foreach ($data as $line) {
$cnt++;
if (!empty($line)) {
if (count($line) > 1) {
for ($i = 0; $i < count($widths)-1; $i++) {
if (is_array($line[$i])) {
$xml .= '' . LF;
$xml .= '' . LF;
} else {
$xml .= '' . LF;
}
}
} else {
$xml .= '' . LF;
}
}
}
// add button (action "0" = close) & footer
$xml .= '' . LF;
$xml .= '';
$xml = str_replace('{#black}', $style['WINDOW'][0]['BLACKCOLOR'][0], $xml);
}
//$aseco->console_text($xml);
$aseco->client->addCall('SendDisplayManialinkPageToLogin', array($login, $aseco->formatColors($xml), 0, true));
} // display_manialink
/**
* Displays custom TMX track ManiaLink window to a player
*
* $login : player login to send window to
* $header: string
* $icon : array( $style, $substyle {, $sizechg} )
* $links : array( $image, $square, $page, $download )
* $data : array( $line1=array($col1, $col2, ...), $line2=array(...) )
* $widths: array( $overal, $col1, $col2, ...)
* $button: string
*
* A $line with one $col will occupy the full window width,
* otherwise all $line's must have the same number of columns,
* as should $widths (+1 for $overall).
* line height=".046" is required minimum to prevent alignment glitches
* due to large characters in some cells.
*/
function display_manialink_track($login, $header, $icon, $links, $data, $widths, $button) {
global $aseco;
$player = $aseco->server->players->getPlayer($login);
$style = $player->style;
$square = $links[1];
// check for old TMN-style window
if (empty($style)) {
$tsp = 'B'; // 'F' = solid, '0' = invisible
$txt = '333' . $tsp; // dark grey
$bgd = 'FFF' . $tsp; // white
$spc = 'DDD' . $tsp; // light grey
// build manialink header
$xml = '' .
'' . LF .
'' . LF;
// add header
$xml .= ' $o' . htmlspecialchars(validateUTF8String($header)) . ' | ' . LF;
// add spacers & image
$xml .= '' . LF;
$xml .= '$ | ' . LF;
$xml .= '' . htmlspecialchars($links[0]) . ' | ' . LF;
$xml .= '$ | ' . LF;
// add lines with optional columns
foreach ($data as $line) {
$xml .= '';
if (!empty($line)) {
for ($i = 0; $i < count($widths)-1; $i++) {
$xml .= ' $o' . htmlspecialchars(validateUTF8String($line[$i])) . ' | ';
}
} else { // spacer
$xml .= '$ | ';
}
$xml .= '' . LF;
}
// add spacer & links
$xml .= '$ | ' . LF;
$xml .= '' . LF;
$xml .= '$o' . htmlspecialchars($links[2]) . ' | ' .
'$o' . htmlspecialchars($links[3]) . ' | ' . LF;
// add spacer, button (action "0" = close) & footer
$xml .= '' . LF;
$xml .= '$ | ' . LF;
$xml .= '$o' . $button . ' | ';
} else { // TMF-style window
$hsize = $style['HEADER'][0]['TEXTSIZE'][0];
$bsize = $style['BODY'][0]['TEXTSIZE'][0];
$lines = count($data);
// build manialink header & window
$xml = '' .
'' . LF;
// add header
$xml .= '' . LF;
if (is_array($icon)) {
$isize = $hsize;
if (isset($icon[2]))
$isize += $icon[2];
$xml .= '' . LF;
$xml .= '' . LF;
} else {
$xml .= '' . LF;
}
// add image
$xml .= '' . LF;
// add body
$xml .= '' . LF;
// add lines with optional columns
$xml .= '' . LF;
$cnt = 0;
foreach ($data as $line) {
$cnt++;
if (!empty($line)) {
for ($i = 0; $i < count($widths)-1; $i++) {
$xml .= '' . LF;
}
}
}
// add links
$xml .= '' . LF;
$xml .= '' . LF;
$xml .= '' . LF;
// add button (action "0" = close) & footer
$xml .= '' . LF;
$xml .= '';
$xml = str_replace('{#black}', $style['WINDOW'][0]['BLACKCOLOR'][0], $xml);
}
//$aseco->console_text($xml);
$aseco->client->addCall('SendDisplayManialinkPageToLogin', array($login, $aseco->formatColors($xml), 0, true));
} // display_manialink_track
/**
* Displays a multipage ManiaLink window to a player
*
* $player: player object to send windows to
* ->msgs: array( array( $ptr, $header, $widths, $icon ),
* page1: array( $line1=array($col1, $col2, ...), $line2=array(...) ),
* 2: array( $line1=array($col1, $col2, ...), $line2=array(...) ),
* ... )
* $header: string
* $widths: array( $overal, $col1, $col2, ...)
* $icon : array( $style, $substyle {, $sizechg} )
*
* A $line with one $col will occupy the full window width,
* otherwise all $line's must have the same number of columns,
* as should $widths (+1 for $overall).
* line height=".046" is required minimum to prevent alignment glitches
* due to large characters in some cells.
* If $colX is an array, it contains the string and the button's action id.
*/
function display_manialink_multi($player) {
global $aseco;
// fake current page event
event_manialink($aseco, array(0, $player->login, 1));
} // display_manialink_multi
// called @ onPlayerManialinkPageAnswer
// Handles all ManiaLink main system responses,
// as well as multi-page ManiaLink windows
// [0]=PlayerUid, [1]=Login, [2]=Answer
function event_manialink($aseco, $answer) {
global $donation_values;
// leave actions outside -6 - 36 to other handlers
if ($answer[2] < -6 || $answer[2] > 36)
return;
// get player
$login = $answer[1];
$player = $aseco->server->players->getPlayer($login);
// check player answer
switch ($answer[2]) {
case 0:
// close main pop-up window
mainwindow_off($aseco, $login);
return;
// /stats fields
case -5:
// log clicked command
$aseco->console('player {1} clicked command "/active "', $player->login);
// /stats field Time Played
$command = array();
$command['author'] = $player;
chat_active($aseco, $command);
return;
case -6:
// log clicked command
$aseco->console('player {1} clicked command "/top100 "', $player->login);
// /stats field Server Rank
$command = array();
$command['author'] = $player;
chat_top100($aseco, $command);
return;
case 5:
// log clicked command
$aseco->console('player {1} clicked command "/toprecs "', $player->login);
// /stats field Records
$command = array();
$command['author'] = $player;
chat_toprecs($aseco, $command);
return;
case 6:
// log clicked command
$aseco->console('player {1} clicked command "/topwins "', $player->login);
// /stats field Races Won
$command = array();
$command['author'] = $player;
chat_topwins($aseco, $command);
return;
// Records panel fields
case 7:
// log clicked command
$aseco->console('player {1} clicked command "/topsums "', $player->login);
// records panel PB field
$command = array();
$command['author'] = $player;
chat_topsums($aseco, $command);
return;
case 8:
// log clicked command
$aseco->console('player {1} clicked command "/recs "', $player->login);
// records panel Local field
$command = array();
$command['author'] = $player;
$command['params'] = '';
chat_recs($aseco, $command);
return;
case 9:
// log clicked command
$aseco->console('player {1} clicked command "/dedirecs "', $player->login);
// records panel Dedi field
$command = array();
$command['author'] = $player;
$command['params'] = '';
if (function_exists('chat_dedirecs')) chat_dedirecs($aseco, $command);
return;
case 10:
// log clicked command
$aseco->console('player {1} clicked command "/tmxrecs "', $player->login);
// records panel TMX field
$command = array();
$command['author'] = $player;
$command['params'] = '';
if (function_exists('chat_tmxrecs')) chat_tmxrecs($aseco, $command);
return;
// /list Env fields
case 11:
// close main window because /list can take a while
mainwindow_off($aseco, $login);
// log clicked command
$aseco->console('player {1} clicked command "/list env:Stadium"', $player->login);
// /list Env field Stadium
$command = array();
$command['author'] = $player;
$command['params'] = 'env:Stadium';
chat_list($aseco, $command);
return;
case 12:
// close main window because /list can take a while
mainwindow_off($aseco, $login);
// log clicked command
$aseco->console('player {1} clicked command "/list env:Alpine"', $player->login);
// /list Env field Alpine
$command = array();
$command['author'] = $player;
$command['params'] = 'env:Alpine';
chat_list($aseco, $command);
return;
case 13:
// close main window because /list can take a while
mainwindow_off($aseco, $login);
// log clicked command
$aseco->console('player {1} clicked command "/list env:Bay"', $player->login);
// /list Env field Bay
$command = array();
$command['author'] = $player;
$command['params'] = 'env:Bay';
chat_list($aseco, $command);
return;
case 14:
// close main window because /list can take a while
mainwindow_off($aseco, $login);
// log clicked command
$aseco->console('player {1} clicked command "/list env:Coast"', $player->login);
// /list Env field Coast
$command = array();
$command['author'] = $player;
$command['params'] = 'env:Coast';
chat_list($aseco, $command);
return;
case 15:
// close main window because /list can take a while
mainwindow_off($aseco, $login);
// log clicked command
$aseco->console('player {1} clicked command "/list env:Island"', $player->login);
// /list Env field Island
$command = array();
$command['author'] = $player;
$command['params'] = 'env:Island';
chat_list($aseco, $command);
return;
case 16:
// close main window because /list can take a while
mainwindow_off($aseco, $login);
// log clicked command
$aseco->console('player {1} clicked command "/list env:Rally"', $player->login);
// /list Env field Rally
$command = array();
$command['author'] = $player;
$command['params'] = 'env:Rally';
chat_list($aseco, $command);
return;
case 17:
// close main window because /list can take a while
mainwindow_off($aseco, $login);
// log clicked command
$aseco->console('player {1} clicked command "/list env:Speed"', $player->login);
// /list Env field Speed
$command = array();
$command['author'] = $player;
$command['params'] = 'env:Speed';
chat_list($aseco, $command);
return;
// Vote panel buttons/keys
case 18:
// log clicked command
$aseco->console('player {1} clicked command "/y "', $player->login);
// /y on chat-based vote
$command = array();
$command['author'] = $player;
chat_y($aseco, $command);
return;
case 19:
// log clicked command
$aseco->console('player {1} clicked command "/n " (ignored)', $player->login);
// /n on chat-based vote (ignored)
return;
case 20:
// log clicked command
$aseco->console('player {1} clicked command "/admin clearjukebox"', $player->login);
// close main window
mainwindow_off($aseco, $login);
// /jukebox display Clear Jukebox button
$command = array();
$command['author'] = $player;
$command['params'] = 'clearjukebox';
chat_admin($aseco, $command);
return;
// Admin panel buttons
case 21:
// log clicked command
$aseco->console('player {1} clicked command "/admin restartmap"', $player->login);
// admin panel ClipRewind button
$command = array();
$command['author'] = $player;
$command['params'] = 'restartmap';
chat_admin($aseco, $command);
return;
case 22:
// log clicked command
$aseco->console('player {1} clicked command "/admin endround"', $player->login);
// admin panel ClipPause button
$command = array();
$command['author'] = $player;
$command['params'] = 'endround';
chat_admin($aseco, $command);
return;
case 23:
// log clicked command
$aseco->console('player {1} clicked command "/admin nextmap"', $player->login);
// admin panel ClipPlay button
$command = array();
$command['author'] = $player;
$command['params'] = 'nextmap';
chat_admin($aseco, $command);
return;
case 24:
// log clicked command
$aseco->console('player {1} clicked command "/admin replaymap"', $player->login);
// admin panel Refresh button
$command = array();
$command['author'] = $player;
$command['params'] = 'replaymap';
chat_admin($aseco, $command);
return;
case 25:
// log clicked command
$aseco->console('player {1} clicked command "/admin pass"', $player->login);
// admin panel ArrowGreen button
$command = array();
$command['author'] = $player;
$command['params'] = 'pass';
chat_admin($aseco, $command);
return;
case 26:
// log clicked command
$aseco->console('player {1} clicked command "/admin cancel"', $player->login);
// admin panel ArrowRed button
$command = array();
$command['author'] = $player;
$command['params'] = 'cancel';
chat_admin($aseco, $command);
return;
case 27:
// log clicked command
$aseco->console('player {1} clicked command "/admin players live"', $player->login);
// admin panel Buddies button
$command = array();
$command['author'] = $player;
$command['params'] = 'players live';
chat_admin($aseco, $command);
return;
// Payment dialog buttons
case 28:
// log clicked command
$aseco->console('player {1} confirmed command "/admin pay"', $player->login);
admin_pay($aseco, $player->login, true);
return;
case 29:
// log clicked command
$aseco->console('player {1} cancelled command "/admin pay"', $player->login);
admin_pay($aseco, $player->login, false);
return;
// Donate panel buttons
case 30:
// log clicked command
$aseco->console('player {1} clicked command "/donate ' . $donation_values[0] . '"', $player->login);
// donate panel field 1
$command = array();
$command['author'] = $player;
$command['params'] = $donation_values[0];
chat_donate($aseco, $command);
return;
case 31:
// log clicked command
$aseco->console('player {1} clicked command "/donate ' . $donation_values[1] . '"', $player->login);
// donate panel field 2
$command = array();
$command['author'] = $player;
$command['params'] = $donation_values[1];
chat_donate($aseco, $command);
return;
case 32:
// log clicked command
$aseco->console('player {1} clicked command "/donate ' . $donation_values[2] . '"', $player->login);
// donate panel field 3
$command = array();
$command['author'] = $player;
$command['params'] = $donation_values[2];
chat_donate($aseco, $command);
return;
case 33:
// log clicked command
$aseco->console('player {1} clicked command "/donate ' . $donation_values[3] . '"', $player->login);
// donate panel field 4
$command = array();
$command['author'] = $player;
$command['params'] = $donation_values[3];
chat_donate($aseco, $command);
return;
case 34:
// log clicked command
$aseco->console('player {1} clicked command "/donate ' . $donation_values[4] . '"', $player->login);
// donate panel field 5
$command = array();
$command['author'] = $player;
$command['params'] = $donation_values[4];
chat_donate($aseco, $command);
return;
case 35:
// log clicked command
$aseco->console('player {1} clicked command "/donate ' . $donation_values[5] . '"', $player->login);
// donate panel field 6
$command = array();
$command['author'] = $player;
$command['params'] = $donation_values[5];
chat_donate($aseco, $command);
return;
case 36:
// log clicked command
$aseco->console('player {1} clicked command "/donate ' . $donation_values[6] . '"', $player->login);
// donate panel field 7
$command = array();
$command['author'] = $player;
$command['params'] = $donation_values[6];
chat_donate($aseco, $command);
return;
}
// Handle multi-page ManiaLink windows in all styles
// update page pointer
$tot = count($player->msgs) - 1;
switch ($answer[2]) {
case -4: $player->msgs[0][0] = 1; break;
case -3: $player->msgs[0][0] -= 5; break;
case -2: $player->msgs[0][0] -= 1; break;
case 1: break; // stay on current page
case 2: $player->msgs[0][0] += 1; break;
case 3: $player->msgs[0][0] += 5; break;
case 4: $player->msgs[0][0] = $tot; break;
}
// stay within boundaries
if ($player->msgs[0][0] < 1)
$player->msgs[0][0] = 1;
elseif ($player->msgs[0][0] > $tot)
$player->msgs[0][0] = $tot;
// get control variables
$ptr = $player->msgs[0][0];
$header = $player->msgs[0][1];
$widths = $player->msgs[0][2];
$icon = $player->msgs[0][3];
$style = $player->style;
// check for old TMN-style window
if (empty($style)) {
$tsp = 'B'; // 'F' = solid, '0' = invisible
$txt = '333' . $tsp; // dark grey
$bgd = 'FFF' . $tsp; // white
$spc = 'DDD' . $tsp; // light grey
// build manialink header
$xml = '' .
'' . LF .
'' . LF;
// add header
$xml .= ' $o' . htmlspecialchars(validateUTF8String($header)) . ' | ' .
'$n(' . $ptr . '/' . $tot . ') | ' . LF;
// add spacer
$xml .= '' . LF;
$xml .= '$ | ' . LF;
// add lines with optional columns
foreach ($player->msgs[$ptr] as $line) {
$xml .= '';
if (!empty($line)) {
if (count($line) > 1) {
for ($i = 0; $i < count($widths)-1; $i++) {
if (is_array($line[$i])) {
$xml .= ' $o' . htmlspecialchars(validateUTF8String($line[$i][0])) . ' | ';
} else {
$xml .= ' $o' . htmlspecialchars(validateUTF8String($line[$i])) . ' | ';
}
}
} else {
$xml .= ' $o' . htmlspecialchars(validateUTF8String($line[0])) . ' | ';
}
} else { // spacer
$xml .= '$ | ';
}
$xml .= '' . LF;
}
// add spacer
$xml .= '$ | ' . LF;
// add button(s)
$add5 = ($tot > 5);
$butw = ($widths[0] - ($add5 ? 0.22 : 0)) / 3;
$xml .= '';
// check for preceding page(s), then Prev(5) button(s)
if ($ptr > 1) {
if ($add5)
$xml .= '$oPrev5 | ';
$xml .= '$oPrev | ';
} else {
if ($add5)
$xml .= '$ | ';
$xml .= '$ | ';
}
// always a Close button
$xml .= '$oClose | ';
// check for succeeding page(s), then Next(5) button(s)
if ($ptr < $tot) {
$xml .= '$oNext | ';
if ($add5)
$xml .= '$oNext5 | ';
} else {
$xml .= '$ | ';
if ($add5)
$xml .= '$ | ';
}
$xml .= '';
} else { // TMF-style window
$hsize = $style['HEADER'][0]['TEXTSIZE'][0];
$bsize = $style['BODY'][0]['TEXTSIZE'][0];
$lines = count($player->msgs[$ptr]);
// fill up multipage windows
if ($tot > 1)
$lines = max($lines, count($player->msgs[1]));
// build manialink header & window
$xml = '' .
'' . LF;
// add header
$xml .= '' . LF;
if (is_array($icon)) {
$isize = $hsize;
if (isset($icon[2]))
$isize += $icon[2];
$xml .= '' . LF;
$xml .= '' . LF;
} else {
$xml .= '' . LF;
}
$xml .= '' . LF;
// add body
$xml .= '' . LF;
// add lines with optional columns
$xml .= '' . LF;
$cnt = 0;
foreach ($player->msgs[$ptr] as $line) {
$cnt++;
if (!empty($line)) {
if (count($line) > 1) {
for ($i = 0; $i < count($widths)-1; $i++) {
if (isset($line[$i])) {
// check for action button
if (is_array($line[$i])) {
$xml .= '' . LF;
$xml .= '' . LF;
} else {
$xml .= '' . LF;
}
}
}
} else {
$xml .= '' . LF;
}
}
}
// add button(s) & footer
$add5 = ($tot > 5);
// check for preceding page(s), then First & Prev(5) button(s)
if ($ptr > 1) {
$first = '"ArrowFirst" action="-4"';
$prev5 = '"ArrowFastPrev" action="-3"';
$prev1 = '"ArrowPrev" action="-2"';
} else { // first page so dummy buttons
$first = '"StarGold"';
$prev5 = '"StarGold"';
$prev1 = '"StarGold"';
}
$xml .= '' . LF;
if ($add5) {
$xml .= '' . LF;
}
$xml .= '' . LF;
// always a Close button
$xml .= '' . LF;
// check for succeeding page(s), then Next(5) & Last button(s)
if ($ptr < $tot) {
$next1 = '"ArrowNext" action="2"';
$next5 = '"ArrowFastNext" action="3"';
$last = '"ArrowLast" action="4"';
} else { // last page so dummy buttons
$next1 = '"StarGold"';
$next5 = '"StarGold"';
$last = '"StarGold"';
}
$xml .= '' . LF;
if ($add5) {
$xml .= '' . LF;
}
$xml .= '' . LF;
$xml .= '';
$xml = str_replace('{#black}', $style['WINDOW'][0]['BLACKCOLOR'][0], $xml);
}
//$aseco->console_text($xml);
$aseco->client->addCall('SendDisplayManialinkPageToLogin', array($player->login, $aseco->formatColors($xml), 0, false));
} // event_manialink
/**
* Displays a payment dialog
*
* $login : player login to send dialog to
* $server: server name for payment
* $label : payment label string
*/
function display_payment($aseco, $login, $server, $label) {
// build manialink
$xml = '' .
'' .
'' .
'' .
'' .
'' .
'' .
'';
//$aseco->console_text($xml);
// disable dialog once clicked
$aseco->client->addCall('SendDisplayManialinkPageToLogin', array($login, $xml, 0, true));
} // display_payment
/**
* Closes main window
*
* $login: player login to close window for
*/
function mainwindow_off($aseco, $login) {
// close main window
$xml = '';
$aseco->client->addCall('SendDisplayManialinkPageToLogin', array($login, $xml, 0, false));
} // mainwindow_off
// called @ onEndRace
function allwindows_off($aseco, $data) {
if ($aseco->server->getGame() == 'TMF') {
// disable all pop-up windows and records & donate panels
$xml = '';
$aseco->client->query('SendDisplayManialinkPage', $xml, 0, false);
}
} // allwindows_off
/**
* Displays a CheckPoints panel
*
* $login: player login(s) to send panel to
* $cp : CP number
* $diff : color+sign+diff
*/
function display_cpspanel($aseco, $login, $cp, $diff) {
// build manialink
$xml = '' .
'' .
'' .
'' .
'';
//$aseco->console_text($xml);
$aseco->client->addCall('SendDisplayManialinkPageToLogin', array($login, $xml, 0, false));
} // display_cpspanel
/**
* Disables a CheckPoints panel
*
* $login: player login(s) to disable panel for
*/
function cpspanel_off($aseco, $login) {
$xml = '';
$aseco->client->addCall('SendDisplayManialinkPageToLogin', array($login, $xml, 0, false));
} // cpspanel_off
/**
* Disables all CheckPoints panels
*/
function allcpspanels_off($aseco) {
$xml = '';
$aseco->client->query('SendDisplayManialinkPage', $xml, 0, false);
} // allcpspanels_off
/**
* Displays an Admin panel
*
* $player: player to send panel to
*/
function display_admpanel($aseco, $player) {
// build manialink
$xml = $player->panels['admin'];
//$aseco->console_text($xml);
$aseco->client->addCall('SendDisplayManialinkPageToLogin', array($player->login, $xml, 0, false));
} // display_admpanel
/**
* Disables an Admin panel
*
* $login: player login to disable panel for
*/
function admpanel_off($aseco, $login) {
$xml = '';
$aseco->client->addCall('SendDisplayManialinkPageToLogin', array($login, $xml, 0, false));
} // admpanel_off
/**
* Displays a Donate panel
*
* $player : player to send panel to
* $coppers: donation values
*/
function display_donpanel($aseco, $player, $coppers) {
// build manialink
$xml = $player->panels['donate'];
for ($i = 1; $i <= 7; $i++)
$xml = str_replace('%COP' . $i . '%', $coppers[$i-1], $xml);
//$aseco->console_text($xml);
$aseco->client->addCall('SendDisplayManialinkPageToLogin', array($player->login, $xml, 0, false));
} // display_donpanel
/**
* Disables a Donate panel
*
* $login: player login to disable panel for
*/
function donpanel_off($aseco, $login) {
$xml = '';
$aseco->client->addCall('SendDisplayManialinkPageToLogin', array($login, $xml, 0, false));
} // donpanel_off
/**
* Displays a Records panel
*
* $player: player to send panel to
* $pb : personal best
*/
function display_recpanel($aseco, $player, $pb) {
global $ml_records;
// build manialink
$xml = str_replace(array('%PB%', '%TMX%', '%LCL%', '%DED%'),
array($pb, $ml_records['tmx'], $ml_records['local'], $ml_records['dedi']),
$player->panels['records']);
//$aseco->console_text($xml);
$aseco->client->addCall('SendDisplayManialinkPageToLogin', array($player->login, $xml, 0, false));
} // display_recpanel
/**
* Disables a Records panel
*
* $login: player login to disable panel for
*/
function recpanel_off($aseco, $login) {
$xml = '';
$aseco->client->addCall('SendDisplayManialinkPageToLogin', array($login, $xml, 0, false));
} // recpanel_off
function setRecordsPanel($field, $value) {
global $ml_records;
$ml_records[$field] = $value;
} // setRecordsPanel
/**
* Displays a Vote panel
*
* $player : player to send panel to
* $yesstr : string for the Yes button
* $nostr : string for the No button
* $timeout: timeout for temporary panel (used only by /votepanel list)
*/
function display_votepanel($aseco, $player, $yesstr, $nostr, $timeout) {
// build manialink
$xml = str_replace(array('%YES%', '%NO%'),
array($yesstr, $nostr), $player->panels['vote']);
//$aseco->console_text($xml);
// disable panel once clicked
$aseco->client->addCall('SendDisplayManialinkPageToLogin', array($player->login, $xml, $timeout, true));
} // display_votepanel
/**
* Disables a Vote panel
*
* $login: player login to disable panel for
*/
function votepanel_off($aseco, $login) {
$xml = '';
$aseco->client->addCall('SendDisplayManialinkPageToLogin', array($login, $xml, 0, false));
} // votepanel_off
/**
* Disables all Vote panels
*/
function allvotepanels_off($aseco) {
$xml = '';
$aseco->client->addCall('SendDisplayManialinkPage', array($xml, 0, false));
} // allvotepanels_off
/**
* Displays the Message window
*
* $msgs : lines to be displayed
* $timeout: timeout for window in msec
*/
function display_msgwindow($aseco, $msgs, $timeout) {
$cnt = count($msgs);
$xml = '' . LF .
'' . LF;
$pos = -1;
foreach ($msgs as $msg) {
$xml .= '' . LF .
$pos -= 2.5;
}
$xml .= '';
//$aseco->console_text($xml);
$aseco->client->addCall('SendDisplayManialinkPage', array($xml, $timeout, false));
} // display_msgwindow
/**
* Displays the /msglog button
*
* $login: player login to display button for
*/
function display_msglogbutton($aseco, $login) {
$xml = '' . LF .
'' . LF .
'';
//$aseco->console_text($xml);
$aseco->client->addCall('SendDisplayManialinkPageToLogin', array($login, $xml, 0, false));
} // display_msglogbutton
/**
* Displays a Scoreboard Stats panel
*
* $player : player to send panel to
* $rank : server rank
* $avg : record average
* $recs : records total
* $wins : wins total
* $play : session play time
* $dons : donations total
*/
function display_statspanel($aseco, $player, $rank, $avg, $recs, $wins, $play, $dons) {
// build manialink
$xml = str_replace(array('%RANK%', '%AVG%', '%RECS%', '%WINS%', '%PLAY%', '%DONS%'),
array($rank, $avg, $recs, $wins, $play, $dons), $aseco->statspanel);
//$aseco->console_text($xml);
$aseco->client->addCall('SendDisplayManialinkPageToLogin', array($player->login, $xml, 0, false));
} // display_votepanel
/**
* Disables all Scoreboard Stats panels
*
* called @ onNewChallenge
*/
function statspanels_off($aseco, $data) {
$xml = '';
$aseco->client->addCall('SendDisplayManialinkPage', array($xml, 0, false));
} // statspanels_off
// called @ onNewChallenge
// Disables Automatic Scorepanel at start of track if $auto_scorepanel = off
function scorepanel_off($aseco, $data) {
global $auto_scorepanel;
if ($aseco->server->getGame() == 'TMF' && !$auto_scorepanel) {
setCustomUIField('scoretable', false);
// dummy ManiaLink to preserve custom_ui
$xml = '' .
getCustomUIBlock() . '';
$aseco->client->addCall('SendDisplayManialinkPage', array($xml, 0, false));
}
} // scorepanel_off
// called @ onEndRace
// Enables Automatic Scorepanel at end of track
function scorepanel_on($aseco, $data) {
if ($aseco->server->getGame() == 'TMF') {
setCustomUIField('scoretable', true);
// dummy ManiaLink to preserve custom_ui
$xml = '' .
getCustomUIBlock() . '';
$aseco->client->addCall('SendDisplayManialinkPage', array($xml, 0, false));
}
} // scorepanel_on
// called @ onBeginRound
// Disables Rounds Finishpanel at start of round if $rounds_finishpanel = off
function roundspanel_off($aseco) {
global $auto_scorepanel, $rounds_finishpanel;
// check for Rounds/Team/Cup modes
if ($aseco->server->gameinfo->mode == Gameinfo::RNDS ||
$aseco->server->gameinfo->mode == Gameinfo::TEAM ||
$aseco->server->gameinfo->mode == Gameinfo::CUP) {
// check whether to disable panel
if ($aseco->server->getGame() == 'TMF' && !$rounds_finishpanel) {
setCustomUIField('round_scores', false);
// dummy ManiaLink to preserve custom_ui
$xml = '' .
getCustomUIBlock() . '';
$aseco->client->addCall('SendDisplayManialinkPage', array($xml, 0, false));
}
}
} // roundspanel_off
// called @ onPlayerFinish
// Enables Rounds Finishpanel at player finish
function roundspanel_on($aseco, $finish_item) {
global $auto_scorepanel, $rounds_finishpanel;
// check for Rounds/Team/Cup modes
if ($aseco->server->gameinfo->mode == Gameinfo::RNDS ||
$aseco->server->gameinfo->mode == Gameinfo::TEAM ||
$aseco->server->gameinfo->mode == Gameinfo::CUP) {
// check whether panel was disabled
if ($aseco->server->getGame() == 'TMF' && !$rounds_finishpanel) {
setCustomUIField('round_scores', true);
// dummy ManiaLink to preserve custom_ui
$xml = '' .
getCustomUIBlock() . '';
$aseco->client->addCall('SendDisplayManialinkPageToLogin', array($finish_item->player->login, $xml, 0, false));
}
}
} // roundspanel_on
function setCustomUIField($field, $value) {
global $ml_custom_ui;
$ml_custom_ui[$field] = $value;
} // setCustomUIField
function getCustomUIBlock() {
global $ml_custom_ui;
return '' .
'' .
'' .
'' .
'' .
'' .
'' .
'' .
'' .
'';
} // getCustomUIBlock
?>