Changeset 307 for minimanager/char.php
- Timestamp:
- Mar 13, 2008, 8:18:42 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
minimanager/char.php
r304 r307 13 13 require_once("scripts/get_lib.php"); 14 14 require_once("scripts/talents.php"); 15 require_once("scripts/pets.php"); 15 16 require_once("scripts/defines.php"); 17 require_once("scripts/char_aura.php"); 16 18 17 19 //######################################################################################################################## … … 20 22 function char_main() { 21 23 global $lang_global, $lang_char, $lang_item, $output, $realm_db, $characters_db, $realm_id, $user_lvl,$mangos_db, 22 $user_name, $item_datasite, $server, $user_id ;24 $user_name, $item_datasite, $server, $user_id, $char_aura, $talent_datasite; 23 25 24 26 if (empty($_GET['id'])) error($lang_global['empty_fields']); … … 29 31 $id = $sql->quote_smart($_GET['id']); 30 32 31 $result = $sql->query("SELECT account,race FROM `character ` WHERE guid = $id LIMIT 1");33 $result = $sql->query("SELECT account,race FROM `characters` WHERE guid = $id LIMIT 1"); 32 34 33 35 if ($sql->num_rows($result)){ … … 43 45 if( !$user_lvl && !$server[$realm_id]['both_factions']){ 44 46 $side_p = (in_array($sql->result($result, 0, 'race'),array(2,5,6,8,10))) ? 1 : 2; 45 $result_1 = $sql->query("SELECT race FROM `character ` WHERE account = '$user_id' LIMIT 1");47 $result_1 = $sql->query("SELECT race FROM `characters` WHERE account = '$user_id' LIMIT 1"); 46 48 if ($sql->num_rows($result)){ 47 49 $side_v = (in_array($sql->result($result_1, 0, 'race'),array(2,5,6,8,10))) ? 1 : 2; … … 55 57 if ($user_lvl >= $owner_gmlvl && (($side_v == $side_p) || !$side_v)){ 56 58 57 $result = $sql->query("SELECT data,name,race,class,zone,map,online,totaltime, mid(lpad( hex( CAST(substring_index(substring_index(data,' ',".(36+1)."),' ',-1) as unsigned) ),8,'0'),4,1) as gender FROM `character ` WHERE guid = '$id'");59 $result = $sql->query("SELECT data,name,race,class,zone,map,online,totaltime, mid(lpad( hex( CAST(substring_index(substring_index(data,' ',".(36+1)."),' ',-1) as unsigned) ),8,'0'),4,1) as gender FROM `characters` WHERE guid = '$id'"); 58 60 $char = $sql->fetch_row($result); 59 61 $char_data = explode(' ',$char[0]); … … 65 67 $guild_name = $sql->result($query, 0, 'name'); 66 68 $guild_name = "<a href=\"guild.php?action=view_guild&error=3&id={$char_data[CHAR_DATA_OFFSET_GUILD_ID]}\" >$guild_name</a>"; 67 if ($char_data[CHAR_DATA_OFFSET_GUILD_RANK]){ 68 $guild_rank_query = $sql->query("SELECT rname FROM guild_rank WHERE guildid ='{$char_data[CHAR_DATA_OFFSET_GUILD_ID]}' AND rid='{$char_data[CHAR_DATA_OFFSET_GUILD_RANK]}'"); 69 $guild_rank = $sql->result($guild_rank_query, 0, 'rname'); 70 } else $guild_rank = $lang_char['guild_leader']; 69 $mrank = $char_data[CHAR_DATA_OFFSET_GUILD_RANK] + 1; 70 $guild_rank_query = $sql->query("SELECT rname FROM guild_rank WHERE guildid ='{$char_data[CHAR_DATA_OFFSET_GUILD_ID]}' AND rid='{$mrank}'"); 71 $guild_rank = $sql->result($guild_rank_query, 0, 'rname'); 71 72 } else { 72 73 $guild_name = $lang_global['none']; … … 114 115 115 116 if (($user_lvl > $owner_gmlvl)||($owner_name == $user_name)) 116 $output .= "<li><a href=\"char.php?id=$id&action=char_inv\">{$lang_char['inventory']}</a></li>117 { $output .= "<li><a href=\"char.php?id=$id&action=char_inv\">{$lang_char['inventory']}</a></li> 117 118 <li><a href=\"char.php?id=$id&action=char_quest\">{$lang_char['quests']}</a></li> 118 119 <li><a href=\"char.php?id=$id&action=char_skill\">{$lang_char['skills']}</a></li> 119 120 <li><a href=\"char.php?id=$id&action=char_talent\">{$lang_char['talents']}</a></li> 120 121 <li><a href=\"char.php?id=$id&action=char_rep\">{$lang_char['reputation']}</a></li>"; 122 if( get_player_class($char[3]) == 'Hunter' ) { $output .= " <li><a href=\"char.php?id=$id&action=char_pets\">{$lang_char['pets']}</a></li>"; } 123 } 121 124 $output .= "</ul> 122 125 </div> … … 124 127 125 128 <table class=\"lined\" style=\"width: 580px;\"> 126 <tr><td colspan=\"6\"><div><img src=".get_image_dir($char_data[CHAR_DATA_OFFSET_LEVEL],$char[8],$char[2],$char[3],$owner_gmlvl)."></div><font class=\"bold\">$char[1] - ".get_player_race($char[2])." ".get_player_class($char[3])." (lvl {$char_data[CHAR_DATA_OFFSET_LEVEL]})</font><br /> 129 <tr><td colspan=\"6\"><div><img src=".get_image_dir($char_data[CHAR_DATA_OFFSET_LEVEL],$char[8],$char[2],$char[3],$owner_gmlvl)."></div><div>"; 130 131 $sql->connect($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']); 132 $a_results = $sql->query("SELECT DISTINCT spell,remaintime FROM `character_aura` WHERE guid = '$id'"); 133 if ($sql->num_rows($a_results)){ 134 while ($aura = $sql->fetch_row($a_results)){ 135 if( isset($char_aura[$aura[0]]) ) 136 { 137 $output .= "<a style=\"padding:2px;\" onmouseover=\"toolTip('<font color=\'white\'>".get_char_aura_name($aura[0])."<br />Id: $aura[0]</font>','item_tooltip')\" onmouseout=\"toolTip()\" href=\"$talent_datasite$aura[0]\"><img src=\"img/Char_AURA/".get_char_aura_image($aura[0])."\" width=24 height=24></a>"; 138 } 139 else { $output .= ": <a href=\"$talent_datasite$aura[0]\">aura $aura[0]</a> :"; } 140 } 141 } 142 143 144 145 $output .="</div><font class=\"bold\">$char[1] - ".get_player_race($char[2])." ".get_player_class($char[3])." (lvl {$char_data[CHAR_DATA_OFFSET_LEVEL]})</font><br /> 127 146 {$lang_char['guild']}: $guild_name | {$lang_char['rank']}: $guild_rank<br />$online</td></tr> 128 147 <tr> … … 359 378 $id = $sql->quote_smart($_GET['id']); 360 379 361 $result = $sql->query("SELECT account FROM `character ` WHERE guid = '$id' LIMIT 1");380 $result = $sql->query("SELECT account FROM `characters` WHERE guid = '$id' LIMIT 1"); 362 381 363 382 if ($sql->num_rows($result)){ … … 372 391 $sql->connect($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']); 373 392 374 $result = $sql->query("SELECT name,race,class,SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_GOLD+1)."), ' ', -1), SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1), mid(lpad( hex( CAST(substring_index(substring_index(data,' ',".(36+1)."),' ',-1) as unsigned) ),8,'0'),4,1) as gender FROM `character ` WHERE guid = '$id'");393 $result = $sql->query("SELECT name,race,class,SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_GOLD+1)."), ' ', -1), SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1), mid(lpad( hex( CAST(substring_index(substring_index(data,' ',".(36+1)."),' ',-1) as unsigned) ),8,'0'),4,1) as gender FROM `characters` WHERE guid = '$id'"); 375 394 376 395 $char = $sql->fetch_row($result); … … 452 471 <li><a href=\"char.php?id=$id&action=char_skill\">{$lang_char['skills']}</a></li> 453 472 <li><a href=\"char.php?id=$id&action=char_talent\">{$lang_char['talents']}</a></li> 454 <li><a href=\"char.php?id=$id&action=char_rep\">{$lang_char['reputation']}</a></li> 455 </ul> 473 <li><a href=\"char.php?id=$id&action=char_rep\">{$lang_char['reputation']}</a></li>"; 474 if( get_player_class($char[2]) == 'Hunter' ) { $output .= " <li><a href=\"char.php?id=$id&action=char_pets\">{$lang_char['pets']}</a></li>"; } 475 $output .= "</ul> 456 476 </div> 457 477 … … 645 665 function char_quest(){ 646 666 global $lang_global, $lang_char, $lang_item, $output, $realm_db, $characters_db, $realm_id, $user_lvl,$mangos_db, 647 $user_name, $quest_datasite ;667 $user_name, $quest_datasite, $language; 648 668 649 669 if (empty($_GET['id'])) error($lang_global['empty_fields']); … … 656 676 $dir = (isset($_GET['dir'])) ? $sql->quote_smart($_GET['dir']) : 0; 657 677 $dir = ($dir) ? 0 : 1; 658 $result = $sql->query("SELECT account,name,race,class FROM `character ` WHERE guid = '$id' LIMIT 1");678 $result = $sql->query("SELECT account,name,race,class FROM `characters` WHERE guid = '$id' LIMIT 1"); 659 679 660 680 if ($sql->num_rows($result)){ … … 678 698 <li><a href=\"char.php?id=$id&action=char_skill\">{$lang_char['skills']}</a></li> 679 699 <li><a href=\"char.php?id=$id&action=char_talent\">{$lang_char['talents']}</a></li> 680 <li><a href=\"char.php?id=$id&action=char_rep\">{$lang_char['reputation']}</a></li> 681 </ul> 700 <li><a href=\"char.php?id=$id&action=char_rep\">{$lang_char['reputation']}</a></li>"; 701 if( get_player_class($char[3]) == 'Hunter' ) { $output .= " <li><a href=\"char.php?id=$id&action=char_pets\">{$lang_char['pets']}</a></li>"; } 702 $output .= "</ul> 682 703 </div> 683 704 <div id=\"tab_content\"> … … 696 717 if ($sql->num_rows($result)){ 697 718 while ($quest = $sql->fetch_row($result)){ 698 $query1 = $sql->query("SELECT QuestLevel,Title FROM `".$mangos_db[$realm_id]['name']."`.`quest_template` WHERE entry ='$quest[0]'"); 719 $deplang = get_lang_id(); 720 $query1 = $sql->query("SELECT QuestLevel,IFNULL(".($deplang<>0?"title_loc$deplang":"NULL").",`title`) as Title FROM `".$mangos_db[$realm_id]['name']."`.`quest_template` LEFT JOIN `".$mangos_db[$realm_id]['name']."`.`locales_quest` ON `quest_template`.`entry` = `locales_quest`.`entry` WHERE `quest_template`.`entry` ='$quest[0]'"); 699 721 $quest_info = $sql->fetch_row($query1); 700 722 if($quest[1]==1) … … 766 788 767 789 $id = $sql->quote_smart($_GET['id']); 768 $result = $sql->query("SELECT account,name,race,class FROM `character ` WHERE guid = '$id' LIMIT 1");790 $result = $sql->query("SELECT account,name,race,class FROM `characters` WHERE guid = '$id' LIMIT 1"); 769 791 770 792 if ($sql->num_rows($result)){ … … 788 810 <li><a href=\"char.php?id=$id&action=char_skill\">{$lang_char['skills']}</a></li> 789 811 <li><a href=\"char.php?id=$id&action=char_talent\">{$lang_char['talents']}</a></li> 790 <li id=\"selected\"><a href=\"char.php?id=$id&action=char_rep\">{$lang_char['reputation']}</a></li> 791 </ul> 812 <li id=\"selected\"><a href=\"char.php?id=$id&action=char_rep\">{$lang_char['reputation']}</a></li>"; 813 if( get_player_class($char[3]) == 'Hunter' ) { $output .= "<li><a href=\"char.php?id=$id&action=char_pets\">{$lang_char['pets']}</a></li>"; } 814 $output .= " </ul> 792 815 </div> 793 816 <div id=\"tab_content\"> … … 870 893 $dir = ($dir) ? 0 : 1; 871 894 872 $result = $sql->query("SELECT account FROM `character ` WHERE guid = '$id'");895 $result = $sql->query("SELECT account FROM `characters` WHERE guid = '$id'"); 873 896 874 897 if ($sql->num_rows($result) == 1){ … … 883 906 $sql->connect($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']); 884 907 885 $result = $sql->query("SELECT data,name,race,class,CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) AS UNSIGNED) AS level FROM `character ` WHERE guid = '$id'");908 $result = $sql->query("SELECT data,name,race,class,CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) AS UNSIGNED) AS level FROM `characters` WHERE guid = '$id'"); 886 909 $char = $sql->fetch_row($result); 887 910 $char_data = explode(' ',$char[0]); … … 895 918 <li id=\"selected\"><a href=\"char.php?id=$id&action=char_skill\">{$lang_char['skills']}</a></li> 896 919 <li><a href=\"char.php?id=$id&action=char_talent\">{$lang_char['talents']}</a></li> 897 <li><a href=\"char.php?id=$id&action=char_rep\">{$lang_char['reputation']}</a></li> 898 </ul> 920 <li><a href=\"char.php?id=$id&action=char_rep\">{$lang_char['reputation']}</a></li>"; 921 if( get_player_class($char[3]) == 'Hunter' ) { $output .= " <li><a href=\"char.php?id=$id&action=char_pets\">{$lang_char['pets']}</a></li>"; } 922 $output .= " </ul> 899 923 </div> 900 924 <div id=\"tab_content\"> … … 1032 1056 $dir = ($dir) ? 0 : 1; 1033 1057 1034 $result = $sql->query("SELECT account FROM `character ` WHERE guid = '$id'");1058 $result = $sql->query("SELECT account FROM `characters` WHERE guid = '$id'"); 1035 1059 1036 1060 if ($sql->num_rows($result) == 1){ … … 1045 1069 $sql->connect($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']); 1046 1070 1047 $result = $sql->query("SELECT data,name,race,class,CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) AS UNSIGNED) AS level FROM `character ` WHERE guid = '$id'");1071 $result = $sql->query("SELECT data,name,race,class,CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) AS UNSIGNED) AS level FROM `characters` WHERE guid = '$id'"); 1048 1072 $char = $sql->fetch_row($result); 1049 1073 $char_data = explode(' ',$char[0]); … … 1057 1081 <li><a href=\"char.php?id=$id&action=char_skill\">{$lang_char['skills']}</a></li> 1058 1082 <li id=\"selected\"><a href=\"char.php?id=$id&action=char_talent\">{$lang_char['talents']}</a></li> 1059 <li><a href=\"char.php?id=$id&action=char_rep\">{$lang_char['reputation']}</a></li> 1060 </ul> 1083 <li><a href=\"char.php?id=$id&action=char_rep\">{$lang_char['reputation']}</a></li>"; 1084 if( get_player_class($char[3]) == 'Hunter' ) { $output .= " <li><a href=\"char.php?id=$id&action=char_pets\">{$lang_char['pets']}</a></li>"; } 1085 $output .= " </ul> 1061 1086 </div> 1062 1087 <div id=\"tab_content\"> … … 1133 1158 } 1134 1159 1160 1161 //########################################################################################################################^M 1162 // SHOW CHARACTER PETS 1163 //########################################################################################################################^M 1164 function char_pets() { 1165 global $lang_global, $lang_char, $lang_item, $output, $realm_db, $characters_db, $realm_id, $user_lvl,$mangos_db, 1166 $user_name, $pet_ability, $talent_datasite; 1167 1168 if (empty($_GET['id'])) error($lang_global['empty_fields']); 1169 1170 $sql = new SQL; 1171 $sql->connect($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']); 1172 1173 $id = $sql->quote_smart($_GET['id']); 1174 1175 $result = $sql->query("SELECT account FROM `characters` WHERE guid = '$id'"); 1176 1177 if ($sql->num_rows($result) == 1){ 1178 $owner_acc_id = $sql->result($result, 0, 'account'); 1179 $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']); 1180 $result = $sql->query("SELECT gmlevel,username FROM account WHERE id ='$owner_acc_id'"); 1181 $owner_gmlvl = $sql->result($result, 0, 'gmlevel'); 1182 $owner_name = $sql->result($result, 0, 'username'); 1183 1184 if (($user_lvl > $owner_gmlvl)||($owner_name == $user_name)){ 1185 1186 $sql->connect($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']); 1187 1188 $result = $sql->query("SELECT id,level,exp,nextlvlexp,loyaltypoints,loyalty,trainpoint,name,curhappiness,TeachSpelldata FROM `character_pet` WHERE owner = '$id'"); 1189 1190 $output .= "<center> 1191 <div id=\"tab\"> 1192 <ul> 1193 <li><a href=\"char.php?id=$id\">{$lang_char['char_sheet']}</a></li> 1194 <li><a href=\"char.php?id=$id&action=char_inv\">{$lang_char['inventory']}</a></li> 1195 <li><a href=\"char.php?id=$id&action=char_quest\">{$lang_char['quests']}</a></li> 1196 <li><a href=\"char.php?id=$id&action=char_skill\">{$lang_char['skills']}</a></li> 1197 <li><a href=\"char.php?id=$id&action=char_talent\">{$lang_char['talents']}</a></li> 1198 <li><a href=\"char.php?id=$id&action=char_rep\">{$lang_char['reputation']}</a></li> 1199 <li id=\"selected\"><a href=\"char.php?id=$id&action=char_pet\">{$lang_char['pets']}</a></li> 1200 </ul> 1201 </div> 1202 <div id=\"tab_content\">"; 1203 1204 if ($sql->num_rows($result)){ 1205 while($pet = $sql->fetch_row($result)){ 1206 $happiness = floor($pet[8]/333000); 1207 1208 switch ($happiness) { 1209 case 3: 1210 case 2: 1211 $hap_text = "Happy"; 1212 $hap_val = 2; 1213 break; 1214 case 1: 1215 $hap_text = "Content"; 1216 $hap_val = 1; 1217 break; 1218 default: 1219 $hap_text = "Unhappy"; 1220 $hap_val = 0; 1221 } 1222 1223 1224 1225 $output .= " <font class=\"bold\">$pet[7] (lvl$pet[1]) 1226 <a style=\"padding:2px;\" onmouseover=\"toolTip('<font color=\'white\'>$hap_text</font>','item_tooltip')\" onmouseout=\"toolTip()\"><img src=\"img/pet/happiness_$hap_val.jpg\"></a> 1227 <br /><br /></font> 1228 <table class=\"lined\" style=\"width: 550px;\"> 1229 <tr><td align=right>Exp:</td><td valign=\"top\" class=\"bar skill_bar\" style=\"background-position: ".(round(385*$pet[2]/$pet[3])-385)."px;\"> 1230 <span>$pet[2]/$pet[3]</span> 1231 </td></tr> 1232 <tr><td align=right>Loyalty:</td><td align=left>Level $pet[5] ($pet[4] pts)</td></tr> 1233 <tr><td align=right>Training Points:</td><td align=left>$pet[6]</td></tr>"; 1234 $output .= "<tr><td align=right>Pet Abilities:</td><td align=left>"; 1235 $ability_results = $sql->query("SELECT spell FROM `pet_spell` WHERE guid = '$pet[0]'"); 1236 if ($sql->num_rows($ability_results)){ 1237 while ($ability = $sql->fetch_row($ability_results)){ 1238 if( isset($pet_ability[$ability[0]]) ) 1239 { 1240 $output .= "<a style=\"padding:2px;\" onmouseover=\"toolTip('<font color=\'white\'>".get_pet_ability_name($ability[0])."<br />Training Points: ".get_pet_ability_trainvalue($ability[0])."<br />Id: $ability[0]</font>','item_tooltip')\" onmouseout=\"toolTip()\" href=\"$talent_datasite$ability[0]\"><img src=\"img/pet/".get_pet_ability_image($ability[0])."\"></a>"; 1241 } 1242 } 1243 } 1244 $output .= "</td></tr>"; 1245 $output .= "</table><br /><br />"; 1246 } 1247 } 1248 1249 $output .= "</div> 1250 <table class=\"hidden\"> 1251 <tr><td>"; 1252 if ($user_lvl > $owner_gmlvl){ 1253 makebutton($lang_char['chars_acc'], "user.php?action=edit_user&id=$owner_acc_id",140); 1254 makebutton($lang_char['edit_button'], "char_edit.php?id=$id",140); 1255 } 1256 if (($user_lvl > 0)&&(($user_lvl > $owner_gmlvl)||($owner_name == $user_name))){ 1257 makebutton($lang_char['del_char'], "char_list.php?action=del_char_form&check%5B%5D=$id",140); 1258 makebutton($lang_char['send_mail'], "mail.php?type=ingame_mail&to=$char[1]",140); 1259 } 1260 makebutton($lang_global['back'], "javascript:window.history.back()",140); 1261 $output .= "</td></tr> 1262 </table><br /></center>"; 1263 } else { 1264 $sql->close(); 1265 error($lang_char['no_permission']); 1266 } 1267 } else error($lang_char['no_char_found']); 1268 $sql->close(); 1269 } 1270 1271 1272 1273 1274 1275 1135 1276 //######################################################################################################################## 1136 1277 // MAIN … … 1157 1298 char_talent(); 1158 1299 break; 1300 case "char_pets": 1301 char_pets(); 1302 break; 1159 1303 default: 1160 1304 char_main();
Note:
See TracChangeset
for help on using the changeset viewer.