source: branches/old/honor.php

Last change on this file was 448, checked in by george, 16 years ago
  • Přesunuto: Obsah kořenové složky byl přesunut do složky trunk a beta web přesunut do branches/beta.
File size: 5.2 KB
Line 
1<?php
2 include('global.php');
3 ShowHeader();
4
5 echo('<h3>Nejlepší hráči:</h3><div align="center">');
6 $Database->select_db($Config['Mangos']['DatabaseCharacters']);
7
8 $HonorRanks = array(
9 array(1000, 'Vojín', 'Zvěd'),
10 array(5000, 'Desátník', 'Bručoun'),
11 array(10000, 'Seržant', 'Seržant'),
12 array(15000, 'Velící seržant', 'Starší seržant'),
13 array(20000, 'Major seržant', 'Nejvyšší seržant'),
14 array(25000, 'Rytíř', 'Kamenný strážce'),
15 array(30000, 'Rytíř poručík', 'Krvavý strážce'),
16 array(35000, 'Rytíř kapitán', 'Legionář'),
17 array(40000, 'Rytíř vůdce', 'Setník'),
18 array(45000, 'Poručík velitel', 'Vůdce'),
19 array(50000, 'Velitel', 'Poručík generál'),
20 array(55000, 'Maršál', 'Generál'),
21 array(60000, 'Polní maršál', 'Válečník'),
22 array(65001, 'Nejvyšší maršál', 'Vrchní válečník'),
23 );
24
25 if(!array_key_exists('order_by', $_SESSION)) $_SESSION['order_by'] = 'highest_rank';
26 if(array_key_exists('order_by', $_GET)) $_SESSION['order_by'] = $Database->real_escape_string($_GET['order_by']);
27 $order_by = $_SESSION['order_by'];
28
29 if(!array_key_exists('dir', $_SESSION)) $_SESSION['dir'] = 1;
30 if(array_key_exists('dir', $_GET)) $_SESSION['dir'] = $Database->real_escape_string($_GET['dir']);
31 $dir = $_SESSION['dir'];
32 $dir = ($dir) ? 0 : 1;
33 $order_dir = ($dir) ? "ASC" : "DESC";
34
35 $result = $Database->query("SELECT count(*) FROM `characters`");
36 $Row = $result->fetch_array();
37 $total_online = $Row[0];
38
39 $order_side = "";
40
41 $PerPage = 20;
42 if(array_key_exists('page', $_GET)) $_SESSION['page'] = $Database->real_escape_string($_GET['page']);
43 if(array_key_exists('page', $_SESSION)) $Page = $_SESSION['page']; else $Page = 0;
44
45 require_once("minimanager/scripts/defines.php");
46 $result = $Database->query("SELECT guid,name,race,class,zone,map,
47 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_HONOR_POINTS+1)."), ' ', -1) AS UNSIGNED) AS highest_rank,
48 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1).'), " ", -1) AS UNSIGNED) AS level,account
49 FROM `characters` WHERE 1 '.$order_side.' ORDER BY '.$order_by.' '.$order_dir.' LIMIT '.$Page*$PerPage.','.$PerPage);
50 //echo($Database->error);
51
52 require_once("minimanager/lang/english.php");
53 $lang_index = array(
54 // ----- INDEX.PHP -----
55 'realm' => 'Realm',
56 'online' => 'Online',
57 'offline_or_let_height' => 'Offline or Latency too Height',
58 'delete' => 'Delete',
59 'tot_users_online' => 'Celkem postav',
60 'name' => 'Jméno',
61 'race' => 'Rasa',
62 'class' => 'Třída',
63 'level' => 'Úroveň',
64 'map' => 'Mapa',
65 'zone' => 'Zóna',
66 'honor_kills' => 'Body cti',
67 );
68
69 $output = "<font class=\"bold\">{$lang_index['tot_users_online']}: $total_online</font><br />
70 <table width=\"70%\" class=\"TableGuilda\" border=\"1\" cellspacing=\"0\" cellpadding=\"2\">
71 <tr>
72 <th>Pořadí</th><th><a href=\"?order_by=name&amp;dir=$dir\">".($order_by=='name' ? "<img src=\"images/online_player/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_index['name']}</a></th>
73 <th><a href=\"?order_by=race&amp;dir=$dir\">".($order_by=='race' ? "<img src=\"images/online_player/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_index['race']}</a></th>
74 <th><a href=\"?order_by=class&amp;dir=$dir\">".($order_by=='class' ? "<img src=\"images/online_player/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_index['class']}</a></th>
75 <th><a href=\"?order_by=level&amp;dir=$dir\">".($order_by=='level' ? "<img src=\"images/online_player/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_index['level']}</a></th>
76
77 <th colspan=\"2\"><a href=\"?order_by=highest_rank&amp;dir=$dir\">".($order_by=='highest_rank' ? "<img src=\"images/online_player//arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_index['honor_kills']}</a></th>
78 </tr>";
79
80 require_once("minimanager/scripts/id_tab.php");
81 $Index = $Page*$PerPage;
82 while($char = $result->fetch_row())
83 {
84 $zone = get_zone_name($char[4]);
85 if($zone == ' ') $zone = '&nbsp;';
86 $race = get_player_race($char[2]);
87 if(($char[2] == 1) or ($char[2] == 3) or ($char[2] == 4) or ($char[2] == 7) or ($char[2] == 11))
88 {
89 $color = '#9090ff';
90 $RankNameIndex = 1;
91 } else
92 {
93 $color = '#FF5050';
94 $RankNameIndex = 2;
95 }
96 $RankIndex = 0;
97 foreach($HonorRanks as $HonorRankIndex => $HonorRank)
98 {
99 if($char[6] > $HonorRank[0])
100 {
101 $RankIndex = $HonorRankIndex;
102 }
103 }
104 $output .= '<tr><td>'.($Index+1).".</td>
105 <td style=\"color: ".$color.";\">$char[1]</td>
106 <td><img src='images/online_player/{$char[2]}-0.gif' onmousemove='toolTip(\"".$race."\",\"item_tooltip\")' onmouseout='toolTip()' /></td>
107 <td><img src='images/online_player/{$char[3]}.gif' onmousemove='toolTip(\"".get_player_class($char[3])."\",\"item_tooltip\")' onmouseout='toolTip()' /></td>
108 <td>$char[7]</td>
109 <td><img src=\"images/honor_ranks/rank".($RankIndex+1).".gif\" alt=\"".$HonorRanks[$RankIndex][$RankNameIndex]."\">&nbsp;".$HonorRanks[$RankIndex][$RankNameIndex]."</td><td>$char[6]</td>
110 </tr>";
111 $Index++;
112 }
113 $output .= "</table>";
114 $output .= PagesList('?page=', $Page, $total_online, $PerPage);
115 $output .= '</div>';
116 echo($output);
117
118 ShowFooter();
119?>
Note: See TracBrowser for help on using the repository browser.