Changeset 700 for trunk


Ignore:
Timestamp:
Mar 28, 2010, 7:42:27 PM (15 years ago)
Author:
george
Message:
  • Přidáno: Zobrazení seznamu online hráčů pro všechny světy společně.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/inc/html.php

    r695 r700  
    227227        '<tr>'.
    228228        '<td colspan="2">'.
    229         '<strong>Server : </strong>'.$server->OnlineStateImage($OnlineState).'<b> (<a href="'.$html->Link('/svety/').'">'.$server->OnlineCharactersCount().' hráčů celkem</a>) | Patch '.$Config['Mangos']['ClientVersion'].' | <a href="'.$html->Link('/pages/realmlist.wtf').'">Realmlist</a> | <a href="'.$html->Link('/server/').'">Server</a> | <a href="'.$html->Link('/svety/').'">Světy</a></b>'.
     229        '<strong>Server : </strong>'.$server->OnlineStateImage($OnlineState).'<b> (<a href="'.$html->Link('/online-hraci/').'">'.$server->OnlineCharactersCount().' hráčů celkem</a>) | Patch '.$Config['Mangos']['ClientVersion'].' | <a href="'.$html->Link('/pages/realmlist.wtf').'">Realmlist</a> | <a href="'.$html->Link('/server/').'">Server</a> | <a href="'.$html->Link('/svety/').'">Světy</a></b>'.
    230230        '</td></tr></table><br />');
    231231    }
  • trunk/pages/online-hraci.php

    r697 r700  
    2424echo('<h3 class="PageTitle">Online hráči</h3>');
    2525
    26 $Realm = new Realm($System, $_COOKIE['RealmIndex']);
    27 echo('<div style="text-align: center">Celkem '.$Realm->OnlineCharactersCount().' hráčů.</div>'.
    28 '<table class="BaseTable">
     26if(array_key_exists('RealmIndex', $_COOKIE))
     27{
     28  $Realm = new Realm($System, $_COOKIE['RealmIndex']);
     29  echo('<div style="text-align: center">Celkem '.$Realm->OnlineCharactersCount().' hráčů.</div>'.
     30  '<table class="BaseTable">
    2931  <tr>
    3032    <th align="center">Frakce</th>
     
    3739    MakeLink('Body arén', 'arena_points').'</th></tr>');
    3840
    39 $sql = $Realm->CharactersDatabase->query('SELECT guid, name, race, class, zone, map, '.
     41  $sql = $Realm->CharactersDatabase->query('SELECT guid, name, race, class, zone, map, '.
    4042  'CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, " ", '.$Config['Mangos']['CharacterDataOffset']['HonorPoints'].'+1), " ", -1) AS UNSIGNED) AS highest_rank, '.
    4143  'CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, " ", '.$Config['Mangos']['CharacterDataOffset']['Level'].' + 1), " ", -1) AS UNSIGNED) AS level, '.
     
    4345  'mid(lpad( hex( CAST(substring_index(substring_index(data, " ", '.$Config['Mangos']['CharacterDataOffset']['Gender'].' + 1), " ", -1) as unsigned) ), 8, 0), 4, 1) AS gender '.
    4446  'FROM `characters` WHERE `online`= 1 ORDER BY `'.$order_by.'` '.$order_dir);
    45 while($row = $sql->fetch_assoc())
    46 {
    47   $aliance = array(1, 3, 4, 7, 11);
    48   $frakce = (in_array($row['race'], $aliance)) ? '<img src="'.$html->Link('/imgs/inc/a.gif').'" alt="aliance"/>' : '<img src="'.$html->Link('/imgs/inc/h.gif').'" alt="horda" />';
    49   $gender = ($row['gender'] == 0) ? '0' : '1';
    50   echo('<tr>
     47  while($row = $sql->fetch_assoc())
     48  {
     49    $aliance = array(1, 3, 4, 7, 11);
     50    $frakce = (in_array($row['race'], $aliance)) ? '<img src="'.$html->Link('/imgs/inc/a.gif').'" alt="aliance"/>' : '<img src="'.$html->Link('/imgs/inc/h.gif').'" alt="horda" />';
     51    $gender = ($row['gender'] == 0) ? '0' : '1';
     52    echo('<tr>
    5153      <td align="center">'.$frakce.'</td>
    5254      <td align="center">'.$row['name'].'</td>
     
    5658      <td align="center">'.$server->MapName($row['map']).'<br />('.$server->ZoneName($row['zone']).')</td>
    5759      <td align="center">'.$row['highest_rank'].'<br />'.$row['arena_points'].'</td></tr>');
     60  }
     61  echo('</table>');
     62} else
     63{
     64  $PlayerList = array();
     65  $DbResult2 = $System->Database->query('SELECT * FROM Realm WHERE Enabled =1'); 
     66  while($DbRealm = $DbResult2->fetch_assoc())
     67  {
     68    $Realm = new Realm($System, $DbRealm['Id']);
     69    $sql = $Realm->CharactersDatabase->query('SELECT guid, name, race, class, zone, map, '.
     70  'CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, " ", '.$Config['Mangos']['CharacterDataOffset']['HonorPoints'].'+1), " ", -1) AS UNSIGNED) AS highest_rank, '.
     71  'CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, " ", '.$Config['Mangos']['CharacterDataOffset']['Level'].' + 1), " ", -1) AS UNSIGNED) AS level, '.
     72  'CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, " ", '.$Config['Mangos']['CharacterDataOffset']['ArenaPoints'].' + 1), " ", -1) AS UNSIGNED) AS arena_points, '.
     73  'mid(lpad( hex( CAST(substring_index(substring_index(data, " ", '.$Config['Mangos']['CharacterDataOffset']['Gender'].' + 1), " ", -1) as unsigned) ), 8, 0), 4, 1) AS gender '.
     74  'FROM `characters` WHERE `online`= 1 ORDER BY `'.$order_by.'` '.$order_dir);
     75    while($DbRow = $sql->fetch_assoc())
     76    {
     77      $DbRow['svet'] = $DbRealm['Name'];
     78      $PlayerList[$DbRow['name'].$DbRow['svet']] = $DbRow;
     79    }
     80  }
     81 
     82  echo('<div style="text-align: center">Celkem '.count($PlayerList).' hráčů ve všech světech.</div>'.
     83  '<table class="BaseTable">
     84  <tr>'.
     85    '<th align="center">Frakce</th>'.
     86    '<th align="center">'.MakeLink('Jméno', 'name').'</th>'.
     87    '<th align="center">'.MakeLink('Rasa', 'race').'</th>'.
     88    '<th align="center">'.MakeLink('Třída', 'class').'</th>'.
     89    '<th align="center">'.MakeLink('Úroveň', 'level').'</th>'.
     90    '<th align="center">'.MakeLink('Svět', 'svet').'</th>'.
     91    '</tr>');
     92   
     93  ksort($PlayerList);
     94
     95  foreach($PlayerList as $row)
     96  {
     97    $aliance = array(1, 3, 4, 7, 11);
     98    $frakce = (in_array($row['race'], $aliance)) ? '<img src="'.$html->Link('/imgs/inc/a.gif').'" alt="aliance"/>' : '<img src="'.$html->Link('/imgs/inc/h.gif').'" alt="horda" />';
     99    $gender = ($row['gender'] == 0) ? '0' : '1';
     100    echo('<tr>'.
     101      '<td align="center">'.$frakce.'</td>'.
     102      '<td align="center">'.$row['name'].'</td>'.
     103      '<td align="center"><img src="'.$html->Link('/imgs/icons/'.$row['race'].'-'.$gender.'.gif').'" alt="rasa" /></td>'.
     104      '<td align="center"><img src="'.$html->Link('/imgs/icons/'.$row['class'].'.gif').'" alt="třída" /></td>'.
     105      '<td align="center">'.$row['level'].'</td>'.
     106      '<td align="center">'.$row['svet'].'</td>'.
     107      '</tr>');
     108  }
     109  echo('</table>');
    58110}
    59 echo('</table>');
    60111
    61112?>
Note: See TracChangeset for help on using the changeset viewer.