source: honor.php@ 310

Last change on this file since 310 was 309, checked in by george, 17 years ago

Opravy související s přejmenování sloupce character na characters.

File size: 5.1 KB
Line 
1
2<?
3 include('global.php');
4 ShowHeader();
5
6 echo('<h3>Nejlep¹í hráèi:</h3><div align="center">');
7 $Database->select_db('characters');
8
9 $HonorRanks = array(
10 array(1000, 'Vojín', 'Zvìd'),
11 array(5000, 'Desátník', 'Bruèoun'),
12 array(10000, 'Ser¾ant', 'Ser¾ant'),
13 array(15000, 'Velící ser¾ant', 'Star¹í ser¾ant'),
14 array(20000, 'Major ser¾ant', 'Nejvy¹¹í ser¾ant'),
15 array(25000, 'Rytíø', 'Kamenný strá¾ce'),
16 array(30000, 'Rytíø poruèík', 'Krvavý strá¾ce'),
17 array(35000, 'Rytíø kapitán', 'Legionáø'),
18 array(40000, 'Rytíø vùdce', 'Setník'),
19 array(45000, 'Poruèík velitel', 'Vùdce'),
20 array(50000, 'Velitel', 'Poruèík generál'),
21 array(55000, 'Mar¹ál', 'Generál'),
22 array(60000, 'Polní mar¹ál', 'Váleèník'),
23 array(65001, 'Nejvy¹¹í mar¹ál', 'Vrchní váleèník'),
24 );
25
26 if(!array_key_exists('order_by', $_SESSION)) $_SESSION['order_by'] = 'highest_rank';
27 if(array_key_exists('order_by', $_GET)) $_SESSION['order_by'] = $Database->real_escape_string($_GET['order_by']);
28 $order_by = $_SESSION['order_by'];
29
30 if(!array_key_exists('dir', $_SESSION)) $_SESSION['dir'] = 1;
31 if(array_key_exists('dir', $_GET)) $_SESSION['dir'] = $Database->real_escape_string($_GET['dir']);
32 $dir = $_SESSION['dir'];
33 $dir = ($dir) ? 0 : 1;
34 $order_dir = ($dir) ? "ASC" : "DESC";
35
36 $result = $Database->query("SELECT count(*) FROM `characters`");
37 $Row = $result->fetch_array();
38 $total_online = $Row[0];
39
40 $order_side = "";
41
42 $PerPage = 20;
43 if(array_key_exists('page', $_GET)) $_SESSION['page'] = $Database->real_escape_string($_GET['page']);
44 if(array_key_exists('page', $_SESSION)) $Page = $_SESSION['page']; else $Page = 0;
45
46 require_once("minimanager/scripts/defines.php");
47 $result = $Database->query("SELECT guid,name,race,class,zone,map,
48 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_HONOR_POINTS+1)."), ' ', -1) AS UNSIGNED) AS highest_rank,
49 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1).'), " ", -1) AS UNSIGNED) AS level,account
50 FROM `characters` WHERE 1 '.$order_side.' ORDER BY '.$order_by.' '.$order_dir.' LIMIT '.$Page*$PerPage.','.$PerPage);
51
52 require_once("minimanager/lang/enUS.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.