Changeset 682
- Timestamp:
- Jan 23, 2010, 4:03:37 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 1 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/inc/config.sample.php
r634 r682 34 34 'ArenaPoints' => 1649, 35 35 ), 36 'RealmList' => array(37 1 => array(38 'Id' => 7,39 'Name' => 'Realm 1'40 'DatabaseHost' => 'localhost',41 'DatabaseUser' => 'server1',42 'DatabasePassword' => 'server1',43 'DatabaseCharacters' => 'realm1_characters',44 'DatabaseMangos' => 'realm1_mangos',45 'DatabaseScriptDev2' => 'realm1_scriptdev2',46 'Server' => 1,47 'MaxOnlinePlayers' => 100,48 'XPRate' => 1,49 'Type' => 'Normalní',50 'Description' => 'Hlavní realm',51 ),52 ),53 36 ), 54 37 'Web' => array … … 70 53 'BankAccount' => '670100-2202937132/6210', 71 54 'TableRowPerPage' => 20, 72 'ServerList' => array( 73 1 => array( 74 'OS' => 'GNU/Linux', 75 'CPU' => 'AMD Athlon 64 X2 5600+, 2,8 GHz', 76 'Memory' => '8 GB DDR2 800 MHz dual channel', 77 'HDD' => 'WD Green 1 TB, 32 MB cache', 78 'Address' => 'localhost', 79 'Internet' => '16/16 Mbit/s, agregace 1:32', 80 'Statistic' => 'http://localhost/stat/', 81 }, 82 }, 55 'DefaultRealmIndex' => 1, 83 56 ), 84 57 'CheckRegistration' => array … … 93 66 ); 94 67 95 // Z pětná kompatibilita68 // Zastaralé, pro zpětnou kompatibilitu 96 69 $db_server = $Config['Database']['Host']; 97 70 $db_user = $Config['Database']['User']; -
trunk/inc/html.php
r637 r682 263 263 { 264 264 global $server, $Config, $System; 265 266 // Check servers online state. 267 $DbResult = $System->Database->query('SELECT COUNT(*) FROM Logon WHERE Online = 1'); 268 $DbRow = $DbResult->fetch_row(); 269 $OnlineState = $DbRow[0] > 0; // Report online state if one of all servers is online. 265 270 266 271 if(isset($_COOKIE['hof-quick']) AND $_COOKIE['hof-quick'] == 'no') … … 275 280 '<tr>'. 276 281 '<td colspan="2">'. 277 '<strong>Server : </strong>'.$server->OnlineStateImage($ System->NetworkPortState($Config['Web']['WoWServerAddr'], 3724)).'<b> (<a href="?page=realmlist">'.$server->OnlineCharactersCount().' hráčů celkem</a>) | Patch '.$Config['Mangos']['ClientVersion'].' | <a href="'.$Config['Web']['BaseURL'].'/pages/realmlist.wtf">Realmlist</a> | <a href="?page=server">Server info</a> | <a href="?page=realmlist">Seznam světů</a></b>'.282 '<strong>Server : </strong>'.$server->OnlineStateImage($OnlineState).'<b> (<a href="?page=realmlist">'.$server->OnlineCharactersCount().' hráčů celkem</a>) | Patch '.$Config['Mangos']['ClientVersion'].' | <a href="'.$Config['Web']['BaseURL'].'/pages/realmlist.wtf">Realmlist</a> | <a href="?page=server">Server info</a> | <a href="?page=realmlist">Seznam světů</a></b>'. 278 283 '</td></tr></table><br />'); 279 284 } -
trunk/inc/player.php
r609 r682 102 102 global $Config; 103 103 104 $ this->db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']);105 $DbResult = $ this->db->query('SELECT CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, " ", '.($Config['Mangos']['CharacterDataOffset']['Level'] + 1).'), " ", -1) AS UNSIGNED) AS `level` FROM `characters` WHERE `guid` = "'.$guid.'" LIMIT 1;');104 $Realm = new Realm($System, $_COOKIE['RealmIndex']); 105 $DbResult = $Realm->CharactersDatabase->query('SELECT CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, " ", '.($Config['Mangos']['CharacterDataOffset']['Level'] + 1).'), " ", -1) AS UNSIGNED) AS `level` FROM `characters` WHERE `guid` = "'.$guid.'" LIMIT 1;'); 106 106 $row = $DbResult->fetch_assoc(); 107 107 return($row['level']); … … 135 135 public function ResetXP($guid) 136 136 { 137 global $ Config;137 global $System, $Config; 138 138 139 139 if($this->CharInAcc($guid, 0)) … … 141 141 if(!$this->IsOnline($guid)) 142 142 { 143 $ this->db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']);144 $row = $ this->db->query('SELECT `data` FROM `characters` WHERE `guid` = "'.$guid.'" LIMIT 1')->fetch_assoc();143 $Realm = new Realm($System, $_COOKIE['RealmIndex']); 144 $row = $Realm->CharactersDatabase->query('SELECT `data` FROM `characters` WHERE `guid` = "'.$guid.'" LIMIT 1')->fetch_assoc(); 145 145 $data = explode(' ', $row['data']); 146 146 $data[$Config['Mangos']['CharacterDataOffset']['Exp']] = 0; 147 147 $data = implode(' ', $data); 148 $ this->db->query('UPDATE `characters` SET `data` = "'.$data.'" WHERE `guid` ="'.$guid.'" LIMIT 1');148 $Realm->CharactersDatabase->query('UPDATE `characters` SET `data` = "'.$data.'" WHERE `guid` ="'.$guid.'" LIMIT 1'); 149 149 $this->Msg('Postavě resetováno XP.', 0); 150 150 } else $this->Msg('Postava musí být offline.', 1); … … 154 154 public function ResetPosition($guid) 155 155 { 156 global $ Config;157 158 $ this->db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']);156 global $System, $Config; 157 158 $Realm = new Realm($System, $_COOKIE['RealmIndex']); 159 159 if($this->CharInAcc($guid, 0)) 160 160 { 161 161 if(!$this->IsOnline($guid)) 162 162 { 163 $row = $ this->db->query('SELECT * FROM `character_homebind` WHERE `guid` = "'.$guid.'" LIMIT 1;')->fetch_array();163 $row = $Realm->CharactersDatabase->query('SELECT * FROM `character_homebind` WHERE `guid` = "'.$guid.'" LIMIT 1;')->fetch_array(); 164 164 $home_char_map = $row['map']; 165 165 $home_char_position_x = $row['position_x']; … … 168 168 if(isset($home_char_map) and isset($home_char_position_x) and isset($home_char_position_y) and isset($home_char_position_z)) 169 169 { 170 $ this->db->query('UPDATE `characters` SET '.170 $Realm->CharactersDatabase->query('UPDATE `characters` SET '. 171 171 '`map` = "'.$home_char_map.'" , '. 172 172 '`position_x` ="'.$home_char_position_x.'" , '. … … 182 182 public function PlayerJail($guid) 183 183 { 184 global $ Config;185 186 $ this->db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']);184 global $System, $Config; 185 186 $Realm = new Realm($System, $_COOKIE['RealmIndex']); 187 187 // .go xyz -90.54 41.35 -31.71 188 188 // .go xyz -91.01 100.46 -31.71 … … 208 208 if(!$this->IsOnline($guid)) 209 209 { 210 $ this->db->query('UPDATE `characters` SET `map` = 35 ,'.210 $Realm->CharactersDatabase->query('UPDATE `characters` SET `map` = 35 ,'. 211 211 '`orientation` = "'.$defined_positions['o'.$rand_place].'" ,'. 212 212 '`position_x` ="'.$defined_positions['x'.$rand_place].'" ,'. … … 214 214 '`position_z` = "'.$defined_positions['z'.$rand_place].'"'. 215 215 ' WHERE `guid` ="'.$guid.'" LIMIT 1;'); 216 $ this->db->query('INSERT INTO `character_aura` (`guid`, `caster_guid`, `spell`, `effect_index`, `amount`, `maxduration`, `remaintime`, `remaincharges`) VALUES '.216 $Realm->CharactersDatabase->query('INSERT INTO `character_aura` (`guid`, `caster_guid`, `spell`, `effect_index`, `amount`, `maxduration`, `remaintime`, `remaincharges`) VALUES '. 217 217 '('.$guid.', '.$guid.', 23775, 0, 1, -1, -1, -1), '. 218 218 '('.$guid.', '.$guid.', 36558, 0, 1, -1, -1, -1);'); … … 223 223 public function IsOnline($guid) 224 224 { 225 global $ Config;226 227 $ this->db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']);228 $row = $ this->db->query('SELECT `online` FROM `characters` WHERE `guid` = "'.$guid.'" LIMIT 1;')->fetch_assoc();225 global $System, $Config; 226 227 $Realm = new Realm($System, $_COOKIE['RealmIndex']); 228 $row = $Realm->CharactersDatabase->query('SELECT `online` FROM `characters` WHERE `guid` = "'.$guid.'" LIMIT 1;')->fetch_assoc(); 229 229 if($row['online'] == 1) return(true); 230 230 else return(false); … … 258 258 public function CharNameToGuid($name) 259 259 { 260 global $ Config;261 262 $ this->db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']);263 $row = $ this->db->query('SELECT `guid` FROM `characters` WHERE `name` LIKE "'.$name.'" LIMIT 1;')->fetch_assoc();260 global $System, $Config; 261 262 $Realm = new Realm($System, $_COOKIE['RealmIndex']); 263 $row = $Realm->CharactersDatabase->query('SELECT `guid` FROM `characters` WHERE `name` LIKE "'.$name.'" LIMIT 1;')->fetch_assoc(); 264 264 if($row['guid'] != '') 265 265 { … … 275 275 global $Config; 276 276 277 $ this->db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']);278 $row = $ this->db->query('SELECT `name` FROM `characters` WHERE `guid` = "'.$guid.'" LIMIT 1;')->fetch_assoc();277 $Realm = new Realm($System, $_COOKIE['RealmIndex']); 278 $row = $Realm->CharactersDatabase->query('SELECT `name` FROM `characters` WHERE `guid` = "'.$guid.'" LIMIT 1;')->fetch_assoc(); 279 279 if($row['name'] != '') 280 280 { … … 305 305 { 306 306 global $Config; 307 307 308 308 $this->db->select_db($Config['Mangos']['DatabaseRealmd']); 309 309 $sha_pass = sha1(strtoupper($acc1_name).':'.strtoupper($acc1_pass)); … … 344 344 public function CharsOnAcc($accid) 345 345 { 346 global $Config ;346 global $Config, $System; 347 347 348 348 echo('<table class="BaseTable"> … … 354 354 <th>Nahráno</th> 355 355 </tr>'); 356 $this->db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']); 357 echo($this->db->error); 358 $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'); 359 echo($this->db->error); 356 $Realm = new Realm($System, $_COOKIE['RealmIndex']); 357 $sql = $Realm->CharactersDatabase->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'); 360 358 while($row = $sql->fetch_array()) 361 359 { -
trunk/index.php
r674 r682 18 18 $_COOKIE['RealmIndex'] = $_GET['RealmIndex']; 19 19 } 20 $RealmList = $Config['Mangos']['RealmList']; 21 $FirstRealm = array_shift($RealmList); 22 if(!array_key_exists('RealmIndex', $_COOKIE)) $_COOKIE['RealmIndex'] = $FirstRealm['Id']; 23 else 24 { 25 if(!array_key_exists($_COOKIE['RealmIndex'], $Config['Mangos']['RealmList'])) 26 $_COOKIE['RealmIndex'] = $FirstRealm['Id']; 27 } 28 20 29 21 session_start(); 30 22 include_once('inc/error.php'); … … 45 37 if(isset($_COOKIE['hof-random']) and $_COOKIE['hof-random'] == 'no') $num_headers = 1; 46 38 else $num_headers = 8; 39 40 // Check right RealmIndex 41 if(!array_key_exists('RealmIndex', $_COOKIE)) 42 { 43 $_COOKIE['RealmIndex'] = $Config['Web']['DefaultRealmIndex']; 44 } else 45 { 46 $DbResult = $System->Database->query('SELECT Id FROM Realm WHERE Id='.$_COOKIE['RealmIndex']); 47 if($DbResult->num_rows == 0) $_COOKIE['RealmIndex'] = $Config['Web']['DefaultRealmIndex']; 48 } 47 49 48 50 echo('<div id="page">'. … … 69 71 array('link' => '?page=teamspeak', 'Text' => 'Team speak'), 70 72 array('link' => '?page=client', 'Text' => 'HoF Client'), 71 array('link' => '?page=test-server', 'Text' => 'Test Server'),72 73 array('link' => '?page=search', 'Text' => 'Vyhledávání'), 73 74 array('link' => '?page=realmlist', 'Text' => 'Světy'), -
trunk/pages/events.php
r681 r682 40 40 function Events() 41 41 { 42 global $db, $EventsLinks, $Config ;42 global $db, $EventsLinks, $Config, $System; 43 43 44 44 $Events = array('Running' => array(), 'Planned' => array()); 45 $ db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseMangos']);45 $Realm = new Realm($System, $_COOKIE['RealmIndex']); 46 46 47 $DbResult = $ db->query('SELECT *, UNIX_TIMESTAMP(start_time) as start FROM game_event WHERE end_time > NOW() AND start_time < NOW()');47 $DbResult = $Realm->MangosDatabase->query('SELECT *, UNIX_TIMESTAMP(start_time) as start FROM game_event WHERE end_time > NOW() AND start_time < NOW()'); 48 48 while($Row = $DbResult->fetch_array()) 49 49 { -
trunk/pages/gmteam.php
r681 r682 55 55 56 56 $Output .= ShowGMList(array('Id' => 0, 'Name' => 'Všechny světy')); 57 foreach($Config['Mangos']['RealmList'] as $Realm) 57 $DbResult = $System->Database->query('SELECT * FROM Realm'); 58 while($Realm = $DbResult->fetch_assoc()) 58 59 { 59 60 $Output .= ShowGMList($Realm); -
trunk/pages/server.php
r681 r682 1 1 <?php 2 3 $DbResult = $System->Database->query('SELECT COUNT(*) FROM Realm'); 4 $DbRow = $DbResult->fetch_row(); 5 $RealmCount = $DbRow[0]; 2 6 3 7 $Output = '<h3 class="PageTitle">Server Heroes of Fantasy</h3>'. … … 12 16 <tr> 13 17 <td>Celkem světů</td> 14 <td>'. count($Config['Mangos']['RealmList']).'</td>18 <td>'.$RealmCount.'</td> 15 19 </tr> 16 20 <tr>
Note:
See TracChangeset
for help on using the changeset viewer.