Changeset 682 for trunk/inc/player.php
- Timestamp:
- Jan 23, 2010, 4:03:37 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 {
Note:
See TracChangeset
for help on using the changeset viewer.