Changeset 577 for trunk


Ignore:
Timestamp:
Apr 29, 2009, 9:04:21 PM (16 years ago)
Author:
george
Message:
  • Opraveno: Vyčítání položek ze sloupce Data u postav je nyní nastavování přes konfigurační soubor. Nutno synchronizovat např. dle minimanageru souboru scripts/defines.php při každé změně verze herního klienta.
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/inc/config.sample.php

    r576 r577  
    2828    'GMCommandsLog' => 'gm_commands.log',
    2929    'MaxAccountCount' => 13000,
     30    'CharacterDataOffset' => array
     31    (
     32      'Exp' => 1010,
     33      'Level' => 53,
     34      'Gender' => 22,
     35      'HonorPoints' => 1648,
     36      'ArenaPoints' => 1649,
     37    ),
    3038  ),
    3139  'Web' => array
  • trunk/inc/player.php

    r576 r577  
    107107    $this->db->select_db($Config['Mangos']['DatabaseCharacters']);
    108108      $DbResult = $this->db->query(
    109       'SELECT CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, " ", 34), " ", -1)'.
     109      'SELECT CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, " ", '.($Config['Mangos']['CharacterDataOffset']['Level'] + 1).'), " ", -1)'.
    110110      ' AS UNSIGNED) AS `level` FROM `characters` WHERE `guid` = "'.$guid.'" LIMIT 1;');
    111111    $row = $DbResult->fetch_assoc();
     
    148148        $row = $this->db->query('SELECT `data` FROM `characters` WHERE `guid` = "'.$guid.'" LIMIT 1')->fetch_assoc();
    149149        $data = explode(' ', $row['data']);
    150         $data[926] = 0;
     150        $data[$Config['Mangos']['CharacterDataOffset']['Exp']] = 0;
    151151        $data = implode(' ', $data);
    152152        $this->db->query('UPDATE `characters` SET `data` = "'.$data.'" WHERE `guid` ="'.$guid.'" LIMIT 1');
     
    360360    $this->db->select_db($Config['Mangos']['DatabaseCharacters']);
    361361    echo($this->db->error);
    362     $sql = $this->db->query('SELECT `guid`,`name`,`race`,`totaltime`,`class`, mid(lpad( hex( CAST(substring_index(substring_index(data, " ", 37), " ",-1) AS unsigned) ), 8, 0), 4, 1) AS gender FROM `characters` WHERE `account`='.$accid.' ORDER BY `totaltime` DESC LIMIT 0, 10');
     362    $sql = $this->db->query('SELECT `guid`,`name`,`race`,`totaltime`,`class`, mid(lpad( hex( CAST(substring_index(substring_index(data, " ", '.($Config['Mangos']['CharacterDataOffset']['Gender'] + 1).'), " ",-1) AS unsigned) ), 8, 0), 4, 1) AS gender FROM `characters` WHERE `account`='.$accid.' ORDER BY `totaltime` DESC LIMIT 0, 10');
    363363    echo($this->db->error);
    364364    while($row = $sql->fetch_array())
  • trunk/pages/autori.php

    r549 r577  
    66
    77
    8 echo('Aktivní programátoři: Zork, Amun, Barny, Chronos<br /><br />');
     8echo('Aktivní programátoři: Barny, Chronos<br />');
     9echo('Dřívější programátoři: Zork, Amun, bbtrash<br /><br />');
    910echo('Některé části webu převzaty ze starého webu vytvořeného maronem a chronosem<br />');
    1011echo('Původní návrh nového webu: bbtrash (<a href="hhttp://www.isystems.cz/?r=apesc/">http://www.isystems.cz/</a>)<br /><br />');
  • trunk/pages/guilda.php

    r547 r577  
    11<?php
    2 $id = (isset($_GET["id"])) ? $db->real_escape_string($_GET["id"]) : 0;
    3 function count_days( $a, $b )
     2
     3function count_days($a, $b)
    44{
    5         $gd_a = getdate( $a );
    6         $gd_b = getdate( $b );
    7         $a_new = mktime( 12, 0, 0, $gd_a['mon'], $gd_a['mday'], $gd_a['year'] );
    8         $b_new = mktime( 12, 0, 0, $gd_b['mon'], $gd_b['mday'], $gd_b['year'] );
    9         return round( abs( $a_new - $b_new ) / 86400 );
     5        $gd_a = getdate($a);
     6        $gd_b = getdate($b);
     7        $a_new = mktime(12, 0, 0, $gd_a['mon'], $gd_a['mday'], $gd_a['year']);
     8        $b_new = mktime(12, 0, 0, $gd_b['mon'], $gd_b['mday'], $gd_b['year']);
     9        return round(abs($a_new - $b_new) / 86400);
    1010}
    11 if ($id != 0)
     11
     12$db->select_db($Config['Mangos']['DatabaseCharacters']);
     13$id = (isset($_GET['id'])) ? $_GET['id'] : 0;
     14if($id != 0)
    1215{
    13   $db -> select_db($db_characters);
    1416  $guild_id = $id;
    1517  $guild_data = $db -> query("SELECT `guildid`, `name`, `createdate` FROM `guild` WHERE `guildid` = ".$guild_id." LIMIT 1;") -> fetch_array();
    16   $members = $db -> query("SELECT guild_member.guid, guild_member.rank AS mrank, `characters`.name, SUBSTRING_INDEX(SUBSTRING_INDEX(`characters`.`data`, ' ', 35), ' ', -1) AS level, (SELECT rname FROM guild_rank WHERE guildid =".$guild_id." AND rid = mrank+1) AS rname, guild_member.pnote, guild_member.offnote FROM guild_member,`characters` LEFT JOIN guild_member k1 ON k1.`guid`=`characters`.`guid` WHERE guild_member.guildid = ".$guild_id." AND guild_member.guid=`characters`.guid ORDER BY mrank");
     18  $members = $db -> query("SELECT guild_member.guid, guild_member.rank AS mrank, `characters`.name, SUBSTRING_INDEX(SUBSTRING_INDEX(`characters`.`data`, ' ', ".$Config['Mangos']['CharacterDataOffset']['Level']." + 1), ' ', -1) AS level, (SELECT rname FROM guild_rank WHERE guildid =".$guild_id." AND rid = mrank+1) AS rname, guild_member.pnote, guild_member.offnote FROM guild_member,`characters` LEFT JOIN guild_member k1 ON k1.`guid`=`characters`.`guid` WHERE guild_member.guildid = ".$guild_id." AND guild_member.guid=`characters`.guid ORDER BY mrank");
    1719  $total_members = $members -> num_rows;
    1820  $members_data = $members -> fetch_array();
    1921  $online_mem = $db -> query("SELECT count(*) AS online_mem  FROM `guild_member`, `characters`, `guild` WHERE guild.guildid = ".$guild_id." AND guild_member.guildid = guild.guildid AND guild_member.guid = characters.guid AND characters.online = 1;") -> fetch_array();;
    2022  // guild info
    21   $date_arr = explode(" ",$guild_data["createdate"]);
    22   $date = explode("-",$date_arr[0]);
    23   $time_stp = explode(":",$date_arr[1]);
    24   $time = mktime($time_stp[0],$time_stp[1],$time_stp[2],$date[1],$date[2],$date[0]);
    25   $human_date = date ("d.m.Y H:i:s",$time);
    26   echo "<a href=\"?page=guildy\">&lt;- Zpět na výpis</a><br />";
    27   echo "
    28   <table border=\"1\">
     23  $date_arr = explode(' ', $guild_data['createdate']);
     24  $date = explode('-', $date_arr[0]);
     25  $time_stp = explode(':', $date_arr[1]);
     26  $time = mktime($time_stp[0], $time_stp[1], $time_stp[2], $date[1], $date[2], $date[0]);
     27  $human_date = date('d.m.Y H:i:s', $time);
     28  echo('<a href="?page=guildy">&lt;- Zpět na výpis</a><br />');
     29  echo('<table border="1">
    2930    <tr>
    30       <td colspan=\"2\"><font size=\"5\">Guilda : ".$guild_data["name"]."</font></td>
     31      <td colspan="2"><font size="5">Guilda : '.$guild_data['name'].'</font></td>
    3132    </tr>
    3233    <tr>
    3334      <th>Datum založení: </th>
    34       <td>".$human_date."</td>
     35      <td>'.$human_date.'</td>
    3536    </tr>
    3637    <tr>
    3738      <th>Celkem členů: </th>
    38       <td>".$total_members." (Online : ".$online_mem["online_mem"].")</td>
     39      <td>'.$total_members.' (Online : '.$online_mem['online_mem'].')</td>
    3940    </tr>
    40   </table>
    41   ";
     41  </table>');
     42 
    4243  // members info
    43   echo "
    44   <table border=\"1\">
     44  echo('<table border="1">
    4545    <tr>
    46       <th align=\"center\">Jméno</th>
    47       <th align=\"center\">Rasa</th>
    48       <th align=\"center\">Class</th>
    49       <th align=\"center\">Úroveň</th>
    50       <th align=\"center\">Rank</th>
    51       <th align=\"center\">Poslední přihlášení (Dny)</th>
    52       <th align=\"center\">Online</th>     
    53     </tr>
    54   ";
    55   while ($member = $members -> fetch_row())
    56   {
    57    
    58     $query = $db -> query("SELECT `race`,`class`,`online`, `account`, `logout_time`, SUBSTRING_INDEX(SUBSTRING_INDEX(`characters`.`data`, ' ', 53+1), ' ', -1) AS level, mid(lpad( hex( CAST(substring_index(substring_index(data,' ',".(36+1)."),' ',-1) as unsigned) ),8,'0'),4,1) as gender FROM `characters` WHERE `guid` = '".$member[0]."' LIMIT 1;");
     46      <th align="center">Jméno</th>
     47      <th align="center">Rasa</th>
     48      <th align="center">Class</th>
     49      <th align="center">Úroveň</th>
     50      <th align="center">Rank</th>
     51      <th align="center">Poslední přihlášení (Dny)</th>
     52      <th align="center">Online</th>     
     53    </tr>');
     54  while($member = $members->fetch_row())
     55  {   
     56    $query = $db->query("SELECT `race`,`class`,`online`, `account`, `logout_time`, SUBSTRING_INDEX(SUBSTRING_INDEX(`characters`.`data`, ' ', ".$Config['Mangos']['CharacterDataOffset']['Level']."+1), ' ', -1) AS level, mid(lpad( hex( CAST(substring_index(substring_index(data,' ',".($Config['Mangos']['CharacterDataOffset']['Gender'] + 1)."),' ',-1) as unsigned) ),8,'0'),4,1) as gender FROM `characters` WHERE `guid` = '".$member[0]."' LIMIT 1;");
    5957    $online = $query -> fetch_array();
    6058          $accid = $online["account"];
     
    145143    ";
    146144  }
    147 echo "</table>";
    148 
    149 
    150 
    151 
    152 
    153 
    154 }
    155 else
    156 {echo "<meta http-equiv=\"refresh\" content=\"0;url=?page=guildy\">";}
     145  echo('</table>');
     146} else echo('<meta http-equiv="refresh" content="0;url=?page=guildy">');
    157147 
    158  
    159  
    160  
    161 
    162 
    163 
    164 
    165148?>
  • trunk/pages/guildy.php

    r407 r577  
    2727  if ($row != "")
    2828  {
    29     return "<a href=\"http://".$row."/\" target=\"_blank\">".$name."</a>";
     29    return "<a href=\"http://".$row."/\" target=\"_blank\">www</a>";
    3030  }
    3131  else
     
    5050<table border=\"1\" width=\"540\">
    5151  <tr>
    52     <th align=\"center\">".MakeLink("Frakce","fraction")."</th>
     52    <th align=\"center\">".MakeLink("","fraction")."</th>
    5353    <th align=\"center\">".MakeLink("Jméno guildy","name")."</th>
    5454    <th align=\"center\">".MakeLink("Celkem členů","member_count")."</th>
     
    5757    <th align=\"center\">".MakeLink("Stránky guildy","homepage")."</th>
    5858    <th align=\"center\">".MakeLink("Založena","createdate")."</th>
    59   </tr>
    60 ";
     59  </tr>";
    6160
    62 
    63 
    64 
    65 $db -> select_db($db_characters);
     61$db->select_db($Config['Mangos']['DatabaseCharacters']);
    6662
    6763$sql = $db -> query('SELECT `guild`.homepage, `guild`.name, `guild`.guildid, `guild`.createdate, COUNT(`guild_member`.`guildid`) AS member_count ,`leader`.`race` IN (1, 3, 4, 7, 11) AS fraction , `leader`.`guid` AS leader FROM `guild` JOIN `guild_member` ON `guild_member`.`guildid` = `guild`.`guildid` JOIN `characters` AS `memebers` ON `memebers`.`guid`= `guild_member`.`guid` JOIN `characters` AS `leader` ON `leader`.`guid`= `guild`.`leaderguid` GROUP BY guild.name ORDER BY '.$order_by.' '.$order_dir.';');
  • trunk/pages/online.php

    r567 r577  
    11<?php
    22
    3 // razeni
    4   $order_by = (isset($_GET["order"])) ? $db->real_escape_string($_GET["order"]) : "name";
    5   $dir = (isset($_GET["dir"])) ? $db->real_escape_string($_GET["dir"]) : "down";
    6   $order_dir = ($dir == "up") ? "ASC" : "DESC";
    7   $dir = ($dir == "down") ? "up" : "down";
    8   $dir_img = ($dir == "down") ? "<img src=\"imgs/inc/up.gif\">" : "<img src=\"imgs/inc/down.gif\">";
     3$order_by = (isset($_GET['order'])) ? $db->real_escape_string($_GET['order']) : 'name';
     4$dir = (isset($_GET['dir'])) ? $db->real_escape_string($_GET['dir']) : 'down';
     5$order_dir = ($dir == 'up') ? 'ASC' :'DESC';
     6$dir = ($dir == 'down') ? 'up' : 'down';
     7$dir_img = ($dir == 'down') ? '<img src="imgs/inc/up.gif" alt="vzestupně" />' : '<img src="imgs/inc/down.gif" alt="sestupně"/>';
    98
    10 function MakeLink ($show,$sort)
     9function MakeLink($show, $sort)
    1110{
    12   global $dir , $dir_img;
    13   if (isset($_GET["order"]) AND $_GET["order"] == $sort)
     11  global $dir, $dir_img;
     12  if(isset($_GET['order']) and $_GET['order'] == $sort)
    1413  {
    15     $arrow = $dir_img."";
     14    $arrow = $dir_img;
    1615  }
    1716  else
    1817  {
    19     $arrow = "";
     18    $arrow = '';
    2019  }
    21   return $arrow."<a href=\"?page=online&amp;order=".$sort."&amp;dir=".$dir."\">".$show."</a>";
    22 } 
    23 echo "
    24 Ve hře se právě nachází ".$server -> MangosOnline()." hráčů.
    25 <center>
    26 <table border=\"1\" width=\"540\">
     20  return($arrow.'<a href="?page=online&amp;order='.$sort.'&amp;dir='.$dir.'">'.$show.'</a>');
     21}
     22
     23echo('Ve hře se právě nachází '.$server->MangosOnline().' hráčů.'.
     24'<center>
     25<table border="1" width="540">
    2726  <tr>
    28     <th align=\"center\">Frakce</th>
    29     <th align=\"center\">".MakeLink("Nick","name")."</th>
    30     <th align=\"center\">".MakeLink("Rasa","race")."</th>
    31     <th align=\"center\">".MakeLink("Class","class")."</th>
    32     <th align=\"center\">".MakeLink("Lvl","level")."</th>
    33     <th align=\"center\">".MakeLink("Mapa","map")."</th>
    34     <th align=\"center\">".MakeLink("Honory","highest_rank")."<br />".MakeLink("Aréna body","arena_points")."</th>
    35   </tr>
    36 ";
    37   $db -> select_db($db_characters);
    38   $sql = $db -> query("SELECT guid,name,race,class,zone,map,
    39   CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 1648+1), ' ', -1) AS UNSIGNED) AS highest_rank,
    40   CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 53+1), ' ', -1) AS UNSIGNED) AS level,
    41   CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 1649+1), ' ', -1) AS UNSIGNED) AS arena_points,
    42   mid(lpad( hex( CAST(substring_index(substring_index(data,' ',36+1),' ',-1) as unsigned) ),8,'0'),4,1) AS gender
    43   FROM `characters` WHERE `online`= 1 ORDER BY `".$order_by."` $order_dir;");
    44 while($row = $sql -> fetch_array())
     27    <th align="center">Frakce</th>
     28    <th align="center">'.MakeLink('Nick', 'name').'</th>
     29    <th align="center">'.MakeLink('Rasa', 'race').'</th>
     30    <th align="center">'.MakeLink('Class', 'class').'</th>
     31    <th align="center">'.MakeLink('Lvl', 'level').'</th>
     32    <th align="center">'.MakeLink('Mapa', 'map').'</th>
     33    <th align="center">'.MakeLink('Honory', 'highest_rank').'<br />'.
     34    MakeLink('Aréna body', 'arena_points').'</th></tr>');
     35
     36$db->select_db($Config['Mangos']['DatabaseCharacters']);
     37$sql = $db->query('SELECT guid, name, race, class, zone, map, '.
     38  'CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, " ", '.$Config['Mangos']['CharacterDataOffset']['HonorPoints'].'+1), " ", -1) AS UNSIGNED) AS highest_rank, '.
     39  'CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, " ", '.$Config['Mangos']['CharacterDataOffset']['Level'].' + 1), " ", -1) AS UNSIGNED) AS level, '.
     40  'CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, " ", '.$Config['Mangos']['CharacterDataOffset']['ArenaPoints'].' + 1), " ", -1) AS UNSIGNED) AS arena_points, '.
     41  'mid(lpad( hex( CAST(substring_index(substring_index(data, " ", '.$Config['Mangos']['CharacterDataOffset']['Gender'].' + 1), " ", -1) as unsigned) ), 8, 0), 4, 1) AS gender '.
     42  'FROM `characters` WHERE `online`= 1 ORDER BY `'.$order_by.'` '.$order_dir);
     43while($row = $sql->fetch_assoc())
    4544{
    46   $aliance = array (1, 3, 4, 7, 11);
    47   $frakce = (in_array($row["race"],$aliance))?"<img src=\"imgs/inc/a.gif\">":"<img src=\"imgs/inc/h.gif\">";
    48   $gender = ($row["gender"] == 0)?"m":"f";
    49   echo "
    50     <tr>
    51       <td align=\"center\">".$frakce."</td>
    52       <td align=\"center\">".$row["name"]."</td>
    53       <td align=\"center\"><img src=\"imgs/icons/".$player -> GetPlayerRace($row["race"])."-".$gender.".gif\"></td>
    54       <td align=\"center\"><img src=\"imgs/icons/".$player -> GetPlayerClass($row["class"]).".gif\"></td>
    55       <td align=\"center\">".$row["level"]."</td>
    56       <td align=\"center\">".$server -> MapName($row["map"])."<br />(".$server -> ZoneName($row["zone"]).")</td>
    57       <td align=\"center\">".$row["highest_rank"]."<br />".$row["arena_points"]."</td>
    58     </tr>
    59   ";
    60 
    61 
    62 
    63 
     45  $aliance = array(1, 3, 4, 7, 11);
     46  $frakce = (in_array($row['race'], $aliance)) ? '<img src="imgs/inc/a.gif" alt="aliance"/>' : '<img src="imgs/inc/h.gif" alt="horda" />';
     47  $gender = ($row['gender'] == 0) ? 'm' : 'f';
     48  echo('<tr>
     49      <td align="center">'.$frakce.'</td>
     50      <td align="center">'.$row['name'].'</td>
     51      <td align="center"><img src="imgs/icons/'.$player->GetPlayerRace($row['race']).'-'.$gender.'.gif" alt="rasa" /></td>
     52      <td align="center"><img src="imgs/icons/'.$player->GetPlayerClass($row['class']).'.gif" alt="třída" /></td>
     53      <td align="center">'.$row['level'].'</td>
     54      <td align="center">'.$server->MapName($row['map']).'<br />('.$server->ZoneName($row['zone']).')</td>
     55      <td align="center">'.$row['highest_rank'].'<br />'.$row['arena_points'].'</td></tr>');
    6456}
    65 echo "</table></center>";
    66 
    67 
    68 
     57echo('</table></center>');
    6958
    7059?>
Note: See TracChangeset for help on using the changeset viewer.