Esempio n. 1
0
//          please restore <code>\'scripts/config.dist.php\'</code></center>');
require_once 'scripts/config.php';
//}
//else
//  exit('<center><br><code>\'scripts/config.php\'</code> not found,<br>
//        please copy <code>\'scripts/config.dist.php\'</code> to
//        <code>\'scripts/config.php\'</code> and make appropriate changes.');
require_once 'libs/db_lib.php';
require_once 'libs/global_lib.php';
require_once 'libs/spell_lib.php';
//header('Expires: Tue, 01 Jan 2000 00:00:00 GMT');
//header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
//header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
//header('Cache-Control: post-check=0, pre-check=0', false);
//header('Pragma: no-cache');
//wowhead_tt();
//echo $output;
$sqlm = new SQL();
$sqlm->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']);
$result = $sqlm->query('select spellID from dbc_spell order by spellID ASC');
$i = 0;
while ($entry = $sqlm->fetch_assoc($result)) {
    if (spell_get_icon($entry['spellID'], $sqlm) == 'img/INV/INV_blank_32.gif') {
        //echo '<a href="'.$spell_datasite.$entry['spellID'].'"><img src="'.spell_get_icon($entry['spellID'], $sqlm).'" /></a>';
        spell_get_icon($entry['spellID'], $sqlm);
        echo $entry['spellID'] . ' ';
    } else {
        ++$i;
    }
}
echo $i;
function char_pets()
{
    global $output, $realm_id, $characters_db, $arcm_db, $action_permission, $user_lvl, $user_name, $site_encoding, $base_datasite, $spell_datasite, $pet_ability, $sql, $core;
    //wowhead_tt();
    if (empty($_GET["id"])) {
        error(lang("global", "empty_fields"));
    }
    if (empty($_GET["realm"])) {
        $realmid = $realm_id;
    } else {
        $realmid = $sql["logon"]->quote_smart($_GET["realm"]);
        if (is_numeric($realmid)) {
            $sql["char"]->connect($characters_db[$realmid]['addr'], $characters_db[$realmid]['user'], $characters_db[$realmid]['pass'], $characters_db[$realmid]['name'], $characters_db[$realmid]["encoding"]);
        } else {
            $realmid = $realm_id;
        }
    }
    $id = $sql["char"]->quote_smart($_GET["id"]);
    if (!is_numeric($id)) {
        $id = 0;
    }
    if ($core == 1) {
        $result = $sql["char"]->query("SELECT acct, name, race, class, level, gender\n      FROM characters\n      WHERE guid='" . $id . "' LIMIT 1");
    } else {
        $result = $sql["char"]->query("SELECT account AS acct, name, race, class, level, gender\n      FROM characters\n      WHERE guid='" . $id . "' LIMIT 1");
    }
    if ($sql["char"]->num_rows($result)) {
        $char = $sql["char"]->fetch_assoc($result);
        // we get user permissions first
        $owner_acc_id = $sql["char"]->result($result, 0, 'acct');
        if ($core == 1) {
            $result = $sql["logon"]->query("SELECT login FROM accounts WHERE acct='" . $char["acct"] . "'");
        } else {
            $result = $sql["logon"]->query("SELECT username AS login FROM account WHERE id='" . $char["acct"] . "'");
        }
        $owner_name = $sql["logon"]->result($result, 0, 'login');
        $s_query = "SELECT *, SecurityLevel AS gm FROM config_accounts WHERE Login='******'";
        $s_result = $sql["mgr"]->query($s_query);
        $s_fields = $sql["mgr"]->fetch_assoc($s_result);
        $owner_gmlvl = $s_fields["gm"];
        $view_mod = $s_fields["View_Mod_Pets"];
        if ($owner_gmlvl >= 1073741824) {
            $owner_gmlvl -= 1073741824;
        }
        // owner configured overrides
        $view_override = false;
        if ($view_mod > 0) {
            if ($view_mod == 1) {
            } elseif ($view_mod == 2) {
                // only registered users may view this page
                if ($user_lvl > -1) {
                    $view_override = true;
                }
            }
        }
        // visibility overrides for specific tabs
        $view_inv_override = false;
        if ($s_fields["View_Mod_Inv"] > 0) {
            if ($s_fields["View_Mod_Inv"] == 1) {
            } elseif ($s_fields["View_Mod_Inv"] == 2) {
                // only registered users may view this tab
                if ($user_lvl > -1) {
                    $view_inv_override = true;
                }
            }
        } else {
            if ($user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                $view_inv_override = true;
            }
        }
        $view_talent_override = false;
        if ($s_fields["View_Mod_Talent"] > 0) {
            if ($s_fields["View_Mod_Talent"] == 1) {
            } elseif ($s_fields["View_Mod_Talent"] == 2) {
                // only registered users may view this tab
                if ($user_lvl > -1) {
                    $view_talent_override = true;
                }
            }
        } else {
            if ($user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                $view_talent_override = true;
            }
        }
        $view_achieve_override = false;
        if ($s_fields["View_Mod_Achieve"] > 0) {
            if ($s_fields["View_Mod_Achieve"] == 1) {
            } elseif ($s_fields["View_Mod_Achieve"] == 2) {
                // only registered users may view this tab
                if ($user_lvl > -1) {
                    $view_achieve_override = true;
                }
            }
        } else {
            if ($user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                $view_achieve_override = true;
            }
        }
        $view_quest_override = false;
        if ($s_fields["View_Mod_Quest"] > 0) {
            if ($s_fields["View_Mod_Quest"] == 1) {
            } elseif ($s_fields["View_Mod_Quest"] == 2) {
                // only registered users may view this tab
                if ($user_lvl > -1) {
                    $view_quest_override = true;
                }
            }
        } else {
            if ($user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                $view_quest_override = true;
            }
        }
        $view_friends_override = false;
        if ($s_fields["View_Mod_Friends"] > 0) {
            if ($s_fields["View_Mod_Friends"] == 1) {
            } elseif ($s_fields["View_Mod_Friends"] == 2) {
                // only registered users may view this tab
                if ($user_lvl > -1) {
                    $view_friends_override = true;
                }
            }
        } else {
            if ($user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                $view_friends_override = true;
            }
        }
        $view_view_override = false;
        if ($s_fields["View_Mod_View"] > 0) {
            if ($s_fields["View_Mod_View"] == 1) {
            } elseif ($s_fields["View_Mod_View"] == 2) {
                // only registered users may view this tab
                if ($user_lvl > -1) {
                    $view_view_override = true;
                }
            }
        } else {
            if ($user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                $view_view_override = true;
            }
        }
        $view_rep_override = false;
        if ($s_fields["View_Mod_Rep"] > 0) {
            if ($s_fields["View_Mod_Rep"] == 1) {
            } elseif ($s_fields["View_Mod_Rep"] == 2) {
                // only registered users may view this tab
                if ($user_lvl > -1) {
                    $view_rep_override = true;
                }
            }
        } else {
            if ($user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                $view_rep_override = true;
            }
        }
        $view_skill_override = false;
        if ($s_fields["View_Mod_Skill"] > 0) {
            if ($s_fields["View_Mod_Skill"] == 1) {
            } elseif ($s_fields["View_Mod_Skill"] == 2) {
                // only registered users may view this tab
                if ($user_lvl > -1) {
                    $view_skill_override = true;
                }
            }
        } else {
            if ($user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                $view_skill_override = true;
            }
        }
        $view_pvp_override = false;
        if ($s_fields["View_Mod_PvP"] > 0) {
            if ($s_fields["View_Mod_PvP"] == 1) {
            } elseif ($s_fields["View_Mod_PvP"] == 2) {
                // only registered users may view this tab
                if ($user_lvl > -1) {
                    $view_pvp_override = true;
                }
            }
        } else {
            if ($user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                $view_pvp_override = true;
            }
        }
        if ($view_override || $user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
            $output .= '
          <center>
            <div class="tab">
              <ul>
                <li class="selected"><a href="char.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "char_sheet") . '</a></li>';
            if ($view_inv_override) {
                $output .= '
                <li><a href="char_inv.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "inventory") . '</a></li>';
            }
            if ($view_talent_override) {
                $output .= '
                ' . ($char["level"] < 10 ? '' : '<li><a href="char_talent.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "talents") . '</a></li>') . '';
            }
            if ($view_achieve_override) {
                $output .= '
                <li><a href="char_achieve.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "achievements") . '</a></li>';
            }
            if ($view_quest_override) {
                $output .= '
                <li><a href="char_quest.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "quests") . '</a></li>';
            }
            if ($view_friends_override) {
                $output .= '
                <li><a href="char_friends.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "friends") . '</a></li>';
            }
            if ($view_view_override) {
                $output .= '
                <li><a href="char_view.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "view") . '</a></li>';
            }
            $output .= '
              </ul>
            </div>
            <div class="tab_content">
              <div class="tab">
                <ul>
                  <li><a href="char.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "char_sheet") . '</a></li>';
            $output .= '
                  <li class="selected"><a href="char_pets.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "pets") . '</a></li>';
            if ($view_rep_override) {
                $output .= '
                  <li><a href="char_rep.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "reputation") . '</a></li>';
            }
            if ($view_skill_override) {
                $output .= '
                  <li><a href="char_skill.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "skills") . '</a></li>';
            }
            if ($view_pvp_override) {
                $output .= '
                  <li><a href="char_pvp.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "pvp") . '</a></li>';
            }
            if ($owner_name == $user_name || $user_lvl >= get_page_permission("insert", "char_mail.php")) {
                $output .= '
                  <li><a href="char_mail.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "mail") . '</a></li>';
            }
            $output .= '
                </ul>
              </div>
              <div class="tab_content2">
              <font class="bold">
                ' . htmlentities($char["name"], ENT_COMPAT, $site_encoding) . ' -
                <img src="img/c_icons/' . $char["race"] . '-' . $char["gender"] . '.gif" onmousemove="oldtoolTip(\'' . char_get_race_name($char["race"]) . '\', \'old_item_tooltip\')" onmouseout="oldtoolTip()" alt="" />
                <img src="img/c_icons/' . $char["class"] . '.gif" onmousemove="oldtoolTip(\'' . char_get_class_name($char["class"]) . '\', \'old_item_tooltip\')" onmouseout="oldtoolTip()" alt="" /> - ' . lang("char", "level_short") . char_get_level_color($char["level"]) . '
              </font>
              <br />
              <br />';
            if ($core == 1) {
                $result = $sql["char"]->query("SELECT petnumber, level, fields,\n          SUBSTRING_INDEX(SUBSTRING_INDEX(`fields`, ' ', 77), ' ', -1) AS cur_xp,\n          SUBSTRING_INDEX(SUBSTRING_INDEX(`fields`, ' ', 78), ' ', -1) AS next_level_xp,\n          name, happinessupdate\n          FROM playerpets\n          WHERE ownerguid='" . $id . "'");
            } else {
                $result = $sql["char"]->query("SELECT id AS petnumber, level, abdata AS fields,\n          exp AS cur_xp,\n          SUBSTRING_INDEX(SUBSTRING_INDEX(`abdata`, ' ', 78), ' ', -1) AS next_level_xp,\n          name, curhappiness AS happinessupdate\n          FROM character_pet \n          WHERE owner='" . $id . "'");
            }
            if ($sql["char"]->num_rows($result)) {
                while ($pet = $sql["char"]->fetch_assoc($result)) {
                    $pet_data = explode(' ', $pet["fields"]);
                    $happiness = floor($pet_data[UNIT_FIELD_MAXPOWER3] / 333000);
                    if ($happiness == 1) {
                        $hap_text = 'Content';
                        $hap_val = 1;
                    } elseif ($happiness == 2) {
                        $hap_text = 'Happy';
                        $hap_val = 2;
                    } else {
                        $hap_text = 'Unhappy';
                        $hap_val = 0;
                    }
                    if ($core == 1) {
                        $pet_next_lvl_xp = $pet["next_level_xp"];
                    } else {
                        $pet_next_lvl_xp = floor(char_get_xp_to_level($pet["level"]) / 4);
                    }
                    // this_is_junk: style left hardcoded because it's calculated.
                    $output .= '
                <font class="bold">' . $pet["name"] . ' - lvl ' . char_get_level_color($pet["level"]) . '
                  <a class="ch_pet_padding" onmouseover="oldtoolTip(\'' . $hap_text . '\', \'old_item_tooltip\')" onmouseout="oldtoolTip()"><img src="img/pet/happiness_' . $hap_val . '.jpg" alt="" /></a>
                  <br /><br />
                </font>
                <table class="lined" id="ch_pet_xp">
                  <tr>
                    <td align="right">Exp:</td>
                    <td valign="top" class="bar skill_bar" style="background-position: ' . (round(385 * $pet["cur_xp"] / $pet_next_lvl_xp) - 385) . 'px;">
                      <span>' . $pet["cur_xp"] . '/' . $pet_next_lvl_xp . '</span>
                    </td>
                  </tr>
                  <tr>
                    <td align="right">Pet Abilities:</td>
                    <td align="left">';
                    if ($core == 1) {
                        $ability_results = $sql["char"]->query("SELECT spellid FROM playerpetspells WHERE petnumber='" . $pet["petnumber"] . "' AND flags > 1");
                    } else {
                        $ability_results = $sql["char"]->query("SELECT spell AS spellid FROM pet_spell WHERE guid='" . $pet["petnumber"] . "' AND active > 1");
                    }
                    // active = 0 is unused and active = 1 probably some passive auras, i dont know diference between values 129 and 193, need to check mangos source
                    if ($sql["char"]->num_rows($ability_results)) {
                        while ($ability = $sql["char"]->fetch_assoc($ability_results)) {
                            $output .= '
                      <a class="ch_pet_padding" href="' . $base_datasite . $spell_datasite . $ability["spellid"] . '" target="_blank">
                        <img src="' . spell_get_icon($ability["spellid"]) . '" alt="' . $ability["spellid"] . '" class="icon_border_0" />
                      </a>';
                        }
                    }
                    $output .= '
                    </td>
                  </tr>
                </table>
                <br /><br />';
                }
                unset($ability_results);
                unset($pet_next_lvl_xp);
                unset($happiness);
                unset($pet);
            }
            $output .= '
              </div>
            </div>
            <br />
            <table class="hidden">
              <tr>
                <td>';
            // button to user account page, user account page has own security
            makebutton(lang("char", "chars_acc"), 'user.php?action=edit_user&amp;id=' . $owner_acc_id . '', 130);
            $output .= '
                </td>
                <td>';
            // only higher level GM with delete access can edit character
            //  character edit allows removal of character items, so delete permission is needed
            if ($user_lvl > $owner_gmlvl && $user_lvl >= $action_permission["delete"]) {
                //makebutton($lang_char["edit_button"], 'char_edit.php?id='.$id.'&amp;realm='.$realmid.'', 130);
                $output .= '
                </td>
                <td>';
            }
            // only higher level GM with delete access, or character owner can delete character
            if ($user_lvl > $owner_gmlvl && $user_lvl >= $action_permission["delete"] || $owner_name === $user_name) {
                makebutton(lang("char", "del_char"), 'char_list.php?action=del_char_form&amp;check%5B%5D=' . $id . '" type="wrn', 130);
                $output .= '
                </td>
                <td>';
            }
            // only GM with update permission can send mail, mail can send items, so update permission is needed
            if ($user_lvl >= $action_permission["update"]) {
                makebutton(lang("char", "send_mail"), 'mail.php?type=ingame_mail&amp;to=' . $char["name"] . '', 130);
                $output .= '
                </td>
                <td>';
            }
            makebutton(lang("global", "back"), 'javascript:window.history.back()" type="def', 130);
            $output .= '
                </td>
              </tr>
            </table>
            <br />
          </center>
          <!-- end of char_pets.php -->';
        } else {
            error(lang("char", "no_permission"));
        }
    } else {
        error(lang("char", "no_char_found"));
    }
}
Esempio n. 3
0
function char_main(&$sqlr, &$sqlc)
{
    global $output, $lang_global, $lang_char, $lang_item, $realm_id, $realm_db, $characters_db, $world_db, $server, $mmfpm_db, $action_permission, $user_lvl, $user_name, $user_id, $item_datasite, $spell_datasite, $showcountryflag;
    // this page uses wowhead tooltops
    wowhead_tt();
    // we need at least an id or we would have nothing to show
    if (empty($_GET['id'])) {
        error($lang_global['empty_fields']);
    }
    // this is multi realm support, as of writing still under development
    //  this page is already implementing it
    if (empty($_GET['realm'])) {
        $realmid = $realm_id;
    } else {
        $realmid = $sqlr->quote_smart($_GET['realm']);
        if (is_numeric($realmid)) {
            $sqlc->connect($characters_db[$realmid]['addr'], $characters_db[$realmid]['user'], $characters_db[$realmid]['pass'], $characters_db[$realmid]['name']);
        } else {
            $realmid = $realm_id;
        }
    }
    $id = $sqlc->quote_smart($_GET['id']);
    if (is_numeric($id)) {
    } else {
        error($lang_global['empty_fields']);
    }
    $result = $sqlc->query('SELECT account, race FROM characters WHERE guid = ' . $id . ' LIMIT 1');
    if ($sqlc->num_rows($result)) {
        //resrict by owner's gmlvl
        $owner_acc_id = $sqlc->result($result, 0, 'account');
        $query = $sqlr->query('SELECT gmlevel, username FROM account WHERE id = ' . $owner_acc_id . '');
        $owner_gmlvl = $sqlr->result($query, 0, 'gmlevel');
        $owner_name = $sqlr->result($query, 0, 'username');
        if ($user_lvl || $server[$realmid]['both_factions']) {
            $side_v = 0;
            $side_p = 0;
        } else {
            $side_p = in_array($sqlc->result($result, 0, 'race'), array(2, 5, 6, 8, 10)) ? 1 : 2;
            $result_1 = $sqlc->query('SELECT race FROM characters WHERE account = ' . $user_id . ' LIMIT 1');
            if ($sqlc->num_rows($result)) {
                $side_v = in_array($sqlc->result($result_1, 0, 'race'), array(2, 5, 6, 8, 10)) ? 1 : 2;
            } else {
                $side_v = 0;
            }
            unset($result_1);
        }
        if ($user_lvl >= $owner_gmlvl && ($side_v === $side_p || !$side_v)) {
            $result = $sqlc->query('SELECT account, data, name, race, class, gender, level, zone, map, online, totaltime, 
									arenaPoints, totalHonorPoints, totalKills, 
									health, 
									power1, power2, power3, power4, power5, power6, power7
								FROM characters 
								WHERE guid = ' . $id . '');
            $char = $sqlc->fetch_assoc($result);
            $char_data = explode(' ', $char['data']);
            $online = $char['online'] ? $lang_char['online'] : $lang_char['offline'];
            if ($char_data[CHAR_DATA_OFFSET_GUILD_ID]) {
                $guild_name = $sqlc->result($sqlc->query('SELECT name FROM guild WHERE guildid =' . $char_data[CHAR_DATA_OFFSET_GUILD_ID] . ''), 0, 'name');
                $guild_name = '<a href="guild.php?action=view_guild&amp;realm=' . $realmid . '&amp;error=3&amp;id=' . $char_data[CHAR_DATA_OFFSET_GUILD_ID] . '" >' . $guild_name . '</a>';
                $mrank = $char_data[CHAR_DATA_OFFSET_GUILD_RANK] + 1;
                $guild_rank = $sqlc->result($sqlc->query('SELECT rname FROM guild_rank WHERE guildid =' . $char_data[CHAR_DATA_OFFSET_GUILD_ID] . ' AND rid=' . $mrank . ''), 0, 'rname');
            } else {
                $guild_name = $lang_global['none'];
                $guild_rank = $lang_global['none'];
            }
            $block = unpack('f', pack('L', $char_data[CHAR_DATA_OFFSET_BLOCK]));
            $block = round($block[1], 2);
            $dodge = unpack('f', pack('L', $char_data[CHAR_DATA_OFFSET_DODGE]));
            $dodge = round($dodge[1], 2);
            $parry = unpack('f', pack('L', $char_data[CHAR_DATA_OFFSET_PARRY]));
            $parry = round($parry[1], 2);
            $crit = unpack('f', pack('L', $char_data[CHAR_DATA_OFFSET_MELEE_CRIT]));
            $crit = round($crit[1], 2);
            $ranged_crit = unpack('f', pack('L', $char_data[CHAR_DATA_OFFSET_RANGE_CRIT]));
            $ranged_crit = round($ranged_crit[1], 2);
            $maxdamage = unpack('f', pack('L', $char_data[CHAR_DATA_OFFSET_MAXDAMAGE]));
            $maxdamage = round($maxdamage[1], 0);
            $mindamage = unpack('f', pack('L', $char_data[CHAR_DATA_OFFSET_MINDAMAGE]));
            $mindamage = round($mindamage[1], 0);
            $maxrangeddamage = unpack('f', pack('L', $char_data[CHAR_DATA_OFFSET_MAXRANGEDDAMAGE]));
            $maxrangeddamage = round($maxrangeddamage[1], 0);
            $minrangeddamage = unpack('f', pack('L', $char_data[CHAR_DATA_OFFSET_MINRANGEDDAMAGE]));
            $minrangeddamage = round($minrangeddamage[1], 0);
            $spell_crit = 100;
            for ($i = 0; $i < 6; ++$i) {
                $temp = unpack('f', pack('L', $char_data[CHAR_DATA_OFFSET_SPELL_CRIT + 1 + $i]));
                if ($temp[1] < $spell_crit) {
                    $spell_crit = $temp[1];
                }
            }
            $spell_crit = round($spell_crit, 2);
            $spell_damage = 9999;
            for ($i = 0; $i < 6; ++$i) {
                if ($char_data[CHAR_DATA_OFFSET_SPELL_DAMAGE + 1 + $i] < $spell_damage) {
                    $spell_damage = $char_data[CHAR_DATA_OFFSET_SPELL_DAMAGE + 1 + $i];
                }
            }
            $rage = round($char['power2'] / 10);
            $expertise = '' . $char_data[CHAR_DATA_OFFSET_EXPERTISE] . ' / ' . $char_data[CHAR_DATA_OFFSET_OFFHAND_EXPERTISE] . '';
            $EQU_HEAD = $char_data[CHAR_DATA_OFFSET_EQU_HEAD];
            $EQU_NECK = $char_data[CHAR_DATA_OFFSET_EQU_NECK];
            $EQU_SHOULDER = $char_data[CHAR_DATA_OFFSET_EQU_SHOULDER];
            $EQU_SHIRT = $char_data[CHAR_DATA_OFFSET_EQU_SHIRT];
            $EQU_CHEST = $char_data[CHAR_DATA_OFFSET_EQU_CHEST];
            $EQU_BELT = $char_data[CHAR_DATA_OFFSET_EQU_BELT];
            $EQU_LEGS = $char_data[CHAR_DATA_OFFSET_EQU_LEGS];
            $EQU_FEET = $char_data[CHAR_DATA_OFFSET_EQU_FEET];
            $EQU_WRIST = $char_data[CHAR_DATA_OFFSET_EQU_WRIST];
            $EQU_GLOVES = $char_data[CHAR_DATA_OFFSET_EQU_GLOVES];
            $EQU_FINGER1 = $char_data[CHAR_DATA_OFFSET_EQU_FINGER1];
            $EQU_FINGER2 = $char_data[CHAR_DATA_OFFSET_EQU_FINGER2];
            $EQU_TRINKET1 = $char_data[CHAR_DATA_OFFSET_EQU_TRINKET1];
            $EQU_TRINKET2 = $char_data[CHAR_DATA_OFFSET_EQU_TRINKET2];
            $EQU_BACK = $char_data[CHAR_DATA_OFFSET_EQU_BACK];
            $EQU_MAIN_HAND = $char_data[CHAR_DATA_OFFSET_EQU_MAIN_HAND];
            $EQU_OFF_HAND = $char_data[CHAR_DATA_OFFSET_EQU_OFF_HAND];
            $EQU_RANGED = $char_data[CHAR_DATA_OFFSET_EQU_RANGED];
            $EQU_TABARD = $char_data[CHAR_DATA_OFFSET_EQU_TABARD];
            /*
            // reserved incase we want to use back minimanagers' built in tooltip, instead of wowheads'
            // minimanagers' item tooltip needs updating, but it can show enchantments and sockets.
            
                  $equiped_items = array
                  (
                     1 => array(($EQU_HEAD      ? get_item_tooltip($EQU_HEAD)      : 0),($EQU_HEAD      ? get_item_icon($EQU_HEAD)      : 0),($EQU_HEAD      ? get_item_border($EQU_HEAD)      : 0)),
                     2 => array(($EQU_NECK      ? get_item_tooltip($EQU_NECK)      : 0),($EQU_NECK      ? get_item_icon($EQU_NECK)      : 0),($EQU_NECK      ? get_item_border($EQU_NECK)      : 0)),
                     3 => array(($EQU_SHOULDER  ? get_item_tooltip($EQU_SHOULDER)  : 0),($EQU_SHOULDER  ? get_item_icon($EQU_SHOULDER)  : 0),($EQU_SHOULDER  ? get_item_border($EQU_SHOULDER)  : 0)),
                     4 => array(($EQU_SHIRT     ? get_item_tooltip($EQU_SHIRT)     : 0),($EQU_SHIRT     ? get_item_icon($EQU_SHIRT)     : 0),($EQU_SHIRT     ? get_item_border($EQU_SHIRT)     : 0)),
                     5 => array(($EQU_CHEST     ? get_item_tooltip($EQU_CHEST)     : 0),($EQU_CHEST     ? get_item_icon($EQU_CHEST)     : 0),($EQU_CHEST     ? get_item_border($EQU_CHEST)     : 0)),
                     6 => array(($EQU_BELT      ? get_item_tooltip($EQU_BELT)      : 0),($EQU_BELT      ? get_item_icon($EQU_BELT)      : 0),($EQU_BELT      ? get_item_border($EQU_BELT)      : 0)),
                     7 => array(($EQU_LEGS      ? get_item_tooltip($EQU_LEGS)      : 0),($EQU_LEGS      ? get_item_icon($EQU_LEGS)      : 0),($EQU_LEGS      ? get_item_border($EQU_LEGS)      : 0)),
                     8 => array(($EQU_FEET      ? get_item_tooltip($EQU_FEET)      : 0),($EQU_FEET      ? get_item_icon($EQU_FEET)      : 0),($EQU_FEET      ? get_item_border($EQU_FEET)      : 0)),
                     9 => array(($EQU_WRIST     ? get_item_tooltip($EQU_WRIST)     : 0),($EQU_WRIST     ? get_item_icon($EQU_WRIST)     : 0),($EQU_WRIST     ? get_item_border($EQU_WRIST)     : 0)),
                    10 => array(($EQU_GLOVES    ? get_item_tooltip($EQU_GLOVES)    : 0),($EQU_GLOVES    ? get_item_icon($EQU_GLOVES)    : 0),($EQU_GLOVES    ? get_item_border($EQU_GLOVES)    : 0)),
                    11 => array(($EQU_FINGER1   ? get_item_tooltip($EQU_FINGER1)   : 0),($EQU_FINGER1   ? get_item_icon($EQU_FINGER1)   : 0),($EQU_FINGER1   ? get_item_border($EQU_FINGER1)   : 0)),
                    12 => array(($EQU_FINGER2   ? get_item_tooltip($EQU_FINGER2)   : 0),($EQU_FINGER2   ? get_item_icon($EQU_FINGER2)   : 0),($EQU_FINGER2   ? get_item_border($EQU_FINGER2)   : 0)),
                    13 => array(($EQU_TRINKET1  ? get_item_tooltip($EQU_TRINKET1)  : 0),($EQU_TRINKET1  ? get_item_icon($EQU_TRINKET1)  : 0),($EQU_TRINKET1  ? get_item_border($EQU_TRINKET1)  : 0)),
                    14 => array(($EQU_TRINKET2  ? get_item_tooltip($EQU_TRINKET2)  : 0),($EQU_TRINKET2  ? get_item_icon($EQU_TRINKET2)  : 0),($EQU_TRINKET2  ? get_item_border($EQU_TRINKET2)  : 0)),
                    15 => array(($EQU_BACK      ? get_item_tooltip($EQU_BACK)      : 0),($EQU_BACK      ? get_item_icon($EQU_BACK)      : 0),($EQU_BACK      ? get_item_border($EQU_BACK)      : 0)),
                    16 => array(($EQU_MAIN_HAND ? get_item_tooltip($EQU_MAIN_HAND) : 0),($EQU_MAIN_HAND ? get_item_icon($EQU_MAIN_HAND) : 0),($EQU_MAIN_HAND ? get_item_border($EQU_MAIN_HAND) : 0)),
                    17 => array(($EQU_OFF_HAND  ? get_item_tooltip($EQU_OFF_HAND)  : 0),($EQU_OFF_HAND  ? get_item_icon($EQU_OFF_HAND)  : 0),($EQU_OFF_HAND  ? get_item_border($EQU_OFF_HAND)  : 0)),
                    18 => array(($EQU_RANGED    ? get_item_tooltip($EQU_RANGED)    : 0),($EQU_RANGED    ? get_item_icon($EQU_RANGED)    : 0),($EQU_RANGED    ? get_item_border($EQU_RANGED)    : 0)),
                    19 => array(($EQU_TABARD    ? get_item_tooltip($EQU_TABARD)    : 0),($EQU_TABARD    ? get_item_icon($EQU_TABARD)    : 0),($EQU_TABARD    ? get_item_border($EQU_TABARD)    : 0))
                  );
            */
            $sqlm = new SQL();
            $sqlm->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']);
            $sqlw = new SQL();
            $sqlw->connect($world_db[$realmid]['addr'], $world_db[$realmid]['user'], $world_db[$realmid]['pass'], $world_db[$realmid]['name']);
            $equiped_items = array(1 => array('', $EQU_HEAD ? get_item_icon($EQU_HEAD, $sqlm, $sqlw) : 0, $EQU_HEAD ? get_item_border($EQU_HEAD, $sqlw) : 0), 2 => array('', $EQU_NECK ? get_item_icon($EQU_NECK, $sqlm, $sqlw) : 0, $EQU_NECK ? get_item_border($EQU_NECK, $sqlw) : 0), 3 => array('', $EQU_SHOULDER ? get_item_icon($EQU_SHOULDER, $sqlm, $sqlw) : 0, $EQU_SHOULDER ? get_item_border($EQU_SHOULDER, $sqlw) : 0), 4 => array('', $EQU_SHIRT ? get_item_icon($EQU_SHIRT, $sqlm, $sqlw) : 0, $EQU_SHIRT ? get_item_border($EQU_SHIRT, $sqlw) : 0), 5 => array('', $EQU_CHEST ? get_item_icon($EQU_CHEST, $sqlm, $sqlw) : 0, $EQU_CHEST ? get_item_border($EQU_CHEST, $sqlw) : 0), 6 => array('', $EQU_BELT ? get_item_icon($EQU_BELT, $sqlm, $sqlw) : 0, $EQU_BELT ? get_item_border($EQU_BELT, $sqlw) : 0), 7 => array('', $EQU_LEGS ? get_item_icon($EQU_LEGS, $sqlm, $sqlw) : 0, $EQU_LEGS ? get_item_border($EQU_LEGS, $sqlw) : 0), 8 => array('', $EQU_FEET ? get_item_icon($EQU_FEET, $sqlm, $sqlw) : 0, $EQU_FEET ? get_item_border($EQU_FEET, $sqlw) : 0), 9 => array('', $EQU_WRIST ? get_item_icon($EQU_WRIST, $sqlm, $sqlw) : 0, $EQU_WRIST ? get_item_border($EQU_WRIST, $sqlw) : 0), 10 => array('', $EQU_GLOVES ? get_item_icon($EQU_GLOVES, $sqlm, $sqlw) : 0, $EQU_GLOVES ? get_item_border($EQU_GLOVES, $sqlw) : 0), 11 => array('', $EQU_FINGER1 ? get_item_icon($EQU_FINGER1, $sqlm, $sqlw) : 0, $EQU_FINGER1 ? get_item_border($EQU_FINGER1, $sqlw) : 0), 12 => array('', $EQU_FINGER2 ? get_item_icon($EQU_FINGER2, $sqlm, $sqlw) : 0, $EQU_FINGER2 ? get_item_border($EQU_FINGER2, $sqlw) : 0), 13 => array('', $EQU_TRINKET1 ? get_item_icon($EQU_TRINKET1, $sqlm, $sqlw) : 0, $EQU_TRINKET1 ? get_item_border($EQU_TRINKET1, $sqlw) : 0), 14 => array('', $EQU_TRINKET2 ? get_item_icon($EQU_TRINKET2, $sqlm, $sqlw) : 0, $EQU_TRINKET2 ? get_item_border($EQU_TRINKET2, $sqlw) : 0), 15 => array('', $EQU_BACK ? get_item_icon($EQU_BACK, $sqlm, $sqlw) : 0, $EQU_BACK ? get_item_border($EQU_BACK, $sqlw) : 0), 16 => array('', $EQU_MAIN_HAND ? get_item_icon($EQU_MAIN_HAND, $sqlm, $sqlw) : 0, $EQU_MAIN_HAND ? get_item_border($EQU_MAIN_HAND, $sqlw) : 0), 17 => array('', $EQU_OFF_HAND ? get_item_icon($EQU_OFF_HAND, $sqlm, $sqlw) : 0, $EQU_OFF_HAND ? get_item_border($EQU_OFF_HAND, $sqlw) : 0), 18 => array('', $EQU_RANGED ? get_item_icon($EQU_RANGED, $sqlm, $sqlw) : 0, $EQU_RANGED ? get_item_border($EQU_RANGED, $sqlw) : 0), 19 => array('', $EQU_TABARD ? get_item_icon($EQU_TABARD, $sqlm, $sqlw) : 0, $EQU_TABARD ? get_item_border($EQU_TABARD, $sqlw) : 0));
            if ($user_lvl > $owner_gmlvl || $owner_name === $user_name) {
                $output .= '
          <!-- start of char.php -->
          <center>
            <div id="tab_content">
              <div id="tab">
                <ul>
                  <li><a href="char_inv.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['inventory'] . '</a></li>
                  <li><a href="char_extra.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['extra'] . '</a></li>
                  ' . ($char['level'] < 10 ? '' : '<li><a href="char_talent.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['talents'] . '</a></li>') . '
                  <li><a href="char_achieve.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['achievements'] . '</a></li>
                  <li><a href="char_rep.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['reputation'] . '</a></li>
                  <li><a href="char_skill.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['skills'] . '</a></li>
                  <li><a href="char_quest.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['quests'] . '</a></li>';
                if (char_get_class_name($char['class']) === 'Hunter') {
                    $output .= '
                  <li><a href="char_pets.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['pets'] . '</a></li>';
                }
                $output .= '
                  <li><a href="char_friends.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['friends'] . '</a></li>
				  <li><a href="char_spell.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['spells'] . '</a></li>
				  <li><a href="char_mail.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['mail'] . '</a></li>
                </ul>
                <ul>';
                // selected char tab at last
                $output .= '
                  <li id="selected"><a href="char.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['char_sheet'] . '</a></li>';
            } else {
                $output .= '
          <center>
            <div id="tab">
              <ul>
                <li id="selected"><a href="char.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['char_sheet'] . '</a></li>
              </ul>
            </div>
            <div id="tab_content">
              <div id="tab">
                <ul>';
            }
            $output .= '
                </ul>
              </div>
              <div id="tab_content2">
                <table class="lined" style="width: 580px;">
                  <tr>
                    <td colspan="2">
                      <div>
                        <img src="' . char_get_avatar_img($char['level'], $char['gender'], $char['race'], $char['class'], 0) . '" alt="avatar" />
                      </div>
                      <div>';
            $a_results = $sqlc->query('SELECT DISTINCT spell FROM character_aura WHERE guid = ' . $id . '');
            if ($sqlc->num_rows($a_results)) {
                while ($aura = $sqlc->fetch_assoc($a_results)) {
                    $output .= '
                        <a style="padding:2px;" href="' . $spell_datasite . $aura['spell'] . '" target="_blank">
                          <img src="' . spell_get_icon($aura['spell'], $sqlm) . '" alt="' . $aura['spell'] . '" width="24" height="24" />
                        </a>';
                }
            }
            $output .= '
                      </div>
                    </td>
                    <td colspan="4">
                      <font class="bold">
                        ' . htmlentities($char['name']) . ' -
                        <img src="img/c_icons/' . $char['race'] . '-' . $char['gender'] . '.gif" onmousemove="toolTip(\'' . char_get_race_name($char['race']) . '\', \'item_tooltip\')" onmouseout="toolTip()" alt="" />
                        <img src="img/c_icons/' . $char['class'] . '.gif" onmousemove="toolTip(\'' . char_get_class_name($char['class']) . '\', \'item_tooltip\')" onmouseout="toolTip()" alt="" />
                        - lvl ' . char_get_level_color($char['level']) . '
                      </font>
                      <br />' . get_map_name($char['map'], $sqlm) . ' - ' . get_zone_name($char['zone'], $sqlm) . '
                      <br />' . $lang_char['honor_points'] . ': ' . $char['totalHonorPoints'] . ' / ' . $char['arenaPoints'] . ' - ' . $lang_char['honor_kills'] . ': ' . $char['totalKills'] . '
                      <br />' . $lang_char['guild'] . ': ' . $guild_name . ' | ' . $lang_char['rank'] . ': ' . htmlentities($guild_rank) . '
                      <br />' . ($char['online'] ? '<img src="img/up.gif" onmousemove="toolTip(\'Online\', \'item_tooltip\')" onmouseout="toolTip()" alt="online" />' : '<img src="img/down.gif" onmousemove="toolTip(\'Offline\', \'item_tooltip\')" onmouseout="toolTip()" alt="offline" />');
            if ($showcountryflag) {
                require_once 'libs/misc_lib.php';
                $country = misc_get_country_by_account($char['account'], $sqlr, $sqlm);
                $output .= ' - ' . ($country['code'] ? '<img src="img/flags/' . $country['code'] . '.png" onmousemove="toolTip(\'' . $country['country'] . '\', \'item_tooltip\')" onmouseout="toolTip()" alt="" />' : '-');
                unset($country);
            }
            $output .= '
                    </td>
                  </tr>
                  <tr>
                    <td width="6%">';
            if ($equiped_items[1][1]) {
                $output .= '
                      <a style="padding:2px;" href="' . $item_datasite . $EQU_HEAD . '" target="_blank">
                        <img src="' . $equiped_items[1][1] . '" class="' . $equiped_items[1][2] . '" alt="Head" />
                      </a>';
            } else {
                $output .= '
                      <img src="img/INV/INV_empty_head.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                    </td>
                    <td class="half_line" colspan="2" align="center" width="50%">
                      <div class="gradient_p">' . $lang_item['health'] . ':</div>
                      <div class="gradient_pp">' . $char['health'] . '</div>';
            if ($char['class'] == 11) {
                //druid
                $output .= '
                      </br>
                      <div class="gradient_p">' . $lang_item['energy'] . ':</div>
                      <div class="gradient_pp">' . $char['power4'] . '</div>';
            }
            $output .= '
                    </td>
                    <td class="half_line" colspan="2" align="center" width="50%">';
            if ($char['class'] == 1) {
                $output .= '
                      <div class="gradient_p">' . $lang_item['rage'] . ':</div>
                      <div class="gradient_pp">' . $rage . '</div>';
            } elseif ($char['class'] == 4) {
                $output .= '
                      <div class="gradient_p">' . $lang_item['energy'] . ':</div>
                      <div class="gradient_pp">' . $char['power4'] . '</div>';
            } elseif ($char['class'] == 6) {
                // Don't know if FOCUS is the right one need to verify with Death Knight player.
                $output .= '
                      <div class="gradient_p">' . $lang_item['runic'] . ':</div>
                      <div class="gradient_pp">Unknown</div>';
            } elseif ($char['class'] == 11) {
                $output .= '
                      <div class="gradient_p">' . $lang_item['mana'] . ':</div>
                      <div class="gradient_pp">' . $char['power1'] . '</div>
                      </br>
                      <div class="gradient_p">' . $lang_item['rage'] . ':</div>
                      <div class="gradient_pp">' . $rage . '</div>';
            } elseif ($char['class'] == 2 || $char['class'] == 3 || $char['class'] == 5 || $char['class'] == 7 || $char['class'] == 8 || $char['class'] == 9) {
                $output .= '
                      <div class="gradient_p">' . $lang_item['mana'] . ':</div>
                      <div class="gradient_pp">' . $char['power1'] . '</div>';
            }
            $output .= '
                    </td>
                    <td width="6%">';
            if ($equiped_items[10][1]) {
                $output .= '
                      <a style="padding:2px;" href="' . $item_datasite . $EQU_GLOVES . '" target="_blank">
                        <img src="' . $equiped_items[10][1] . '" class="' . $equiped_items[10][2] . '" alt="Gloves" />
                      </a>';
            } else {
                $output .= '
                      <img src="img/INV/INV_empty_gloves.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                    </td>
                  </tr>
                  <tr>
                    <td width="1%">';
            if ($equiped_items[2][1]) {
                $output .= '
                      <a style="padding:2px;" href="' . $item_datasite . $EQU_NECK . '" target="_blank">
                        <img src="' . $equiped_items[2][1] . '" class="' . $equiped_items[2][2] . '" alt="Neck" />
                      </a>';
            } else {
                $output .= '
                      <img src="img/INV/INV_empty_neck.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                    </td>
                    <td class="half_line" colspan="2" rowspan="3" align="center" width="50%">
                      <div class="gradient_p">
                        ' . $lang_item['strength'] . ':<br />
                        ' . $lang_item['agility'] . ':<br />
                        ' . $lang_item['stamina'] . ':<br />
                        ' . $lang_item['intellect'] . ':<br />
                        ' . $lang_item['spirit'] . ':<br />
                        ' . $lang_item['armor'] . ':
                      </div>
                      <div class="gradient_pp">
                        ' . $char_data[CHAR_DATA_OFFSET_STR] . '<br />
                        ' . $char_data[CHAR_DATA_OFFSET_AGI] . '<br />
                        ' . $char_data[CHAR_DATA_OFFSET_STA] . '<br />
                        ' . $char_data[CHAR_DATA_OFFSET_INT] . '<br />
                        ' . $char_data[CHAR_DATA_OFFSET_SPI] . '<br />
                        ' . $char_data[CHAR_DATA_OFFSET_ARMOR] . '
                      </div>
                    </td>
                    <td class="half_line" colspan="2" rowspan="3" align="center" width="50%">
                      <div class="gradient_p">
                        ' . $lang_item['res_holy'] . ':<br />
                        ' . $lang_item['res_arcane'] . ':<br />
                        ' . $lang_item['res_fire'] . ':<br />
                        ' . $lang_item['res_nature'] . ':<br />
                        ' . $lang_item['res_frost'] . ':<br />
                        ' . $lang_item['res_shadow'] . ':
                      </div>
                      <div class="gradient_pp">
                        ' . $char_data[CHAR_DATA_OFFSET_RES_HOLY] . '<br />
                        ' . $char_data[CHAR_DATA_OFFSET_RES_ARCANE] . '<br />
                        ' . $char_data[CHAR_DATA_OFFSET_RES_FIRE] . '<br />
                        ' . $char_data[CHAR_DATA_OFFSET_RES_NATURE] . '<br />
                        ' . $char_data[CHAR_DATA_OFFSET_RES_FROST] . '<br />
                        ' . $char_data[CHAR_DATA_OFFSET_RES_SHADOW] . '
                      </div>
                    </td>
                    <td width="1%">';
            if ($equiped_items[6][1]) {
                $output .= '
                      <a style="padding:2px;" href="' . $item_datasite . $EQU_BELT . '" target="_blank">
                        <img src="' . $equiped_items[6][1] . '" class="' . $equiped_items[6][2] . '" alt="Belt" />
                      </a>';
            } else {
                $output .= '
                      <img src="img/INV/INV_empty_waist.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                    </td>
                  </tr>
                  <tr>
                    <td width="1%">';
            if ($equiped_items[3][1]) {
                $output .= '
                      <a style="padding:2px;" href="' . $item_datasite . $EQU_SHOULDER . '" target="_blank">
                        <img src="' . $equiped_items[3][1] . '" class="' . $equiped_items[3][2] . '" alt="Shoulder" />
                      </a>';
            } else {
                $output .= '
                      <img src="img/INV/INV_empty_shoulder.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                    </td>
                    <td width="1%">';
            if ($equiped_items[7][1]) {
                $output .= '
                      <a style="padding:2px;" href="' . $item_datasite . $EQU_LEGS . '" target="_blank">
                        <img src="' . $equiped_items[7][1] . '" class="' . $equiped_items[7][2] . '" alt="Legs" />
                      </a>';
            } else {
                $output .= '
                      <img src="img/INV/INV_empty_legs.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                    </td>
                  </tr>
                  <tr>
                    <td width="1%">';
            if ($equiped_items[15][1]) {
                $output .= '
                      <a style="padding:2px;" href="' . $item_datasite . $EQU_BACK . '" target="_blank">
                        <img src="' . $equiped_items[15][1] . '" class="' . $equiped_items[15][2] . '" alt="Back" />
                      </a>';
            } else {
                $output .= '
                      <img src="img/INV/INV_empty_chest_back.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                    </td>
                    <td width="1%">';
            if ($equiped_items[8][1]) {
                $output .= '
                      <a style="padding:2px;" href="' . $item_datasite . $EQU_FEET . '" target="_blank">
                        <img src="' . $equiped_items[8][1] . '" class="' . $equiped_items[8][2] . '" alt="Feet" />
                      </a>';
            } else {
                $output .= '
                      <img src="img/INV/INV_empty_feet.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                    </td>
                  </tr>
                  <tr>
                    <td width="1%">';
            if ($equiped_items[5][1]) {
                $output .= '
                      <a style="padding:2px;" href="' . $item_datasite . $EQU_CHEST . '" target="_blank">
                        <img src="' . $equiped_items[5][1] . '" class="' . $equiped_items[5][2] . '" alt="Chest" />
                      </a>';
            } else {
                $output .= '
                      <img src="img/INV/INV_empty_chest_back.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                    </td>
                    <td class="half_line" colspan="2" rowspan="2" align="center" width="50%">
                      <div class="gradient_p">
                        ' . $lang_char['melee_d'] . ':<br />
                        ' . $lang_char['melee_ap'] . ':<br />
                        ' . $lang_char['melee_hit'] . ':<br />
                        ' . $lang_char['melee_crit'] . ':<br />
                        ' . $lang_char['expertise'] . ':<br />
                      </div>
                      <div class="gradient_pp">
                        ' . $mindamage . '-' . $maxdamage . '<br />
                        ' . ($char_data[CHAR_DATA_OFFSET_AP] + $char_data[CHAR_DATA_OFFSET_AP_MOD]) . '<br />
                        ' . $char_data[CHAR_DATA_OFFSET_MELEE_HIT] . '<br />
                        ' . $crit . '%<br />
                        ' . $expertise . '<br />
                      </div>
                    </td>
                    <td class="half_line" colspan="2" rowspan="2" align="center" width="50%">
                      <div class="gradient_p">
                        ' . $lang_char['spell_d'] . ':<br />
                        ' . $lang_char['spell_heal'] . ':<br />
                        ' . $lang_char['spell_hit'] . ':<br />
                        ' . $lang_char['spell_crit'] . ':<br />
                        ' . $lang_char['spell_haste'] . '
                      </div>
                      <div class="gradient_pp">
                        ' . $spell_damage . '<br />
                        ' . $char_data[CHAR_DATA_OFFSET_SPELL_HEAL] . '<br />
                        ' . $char_data[CHAR_DATA_OFFSET_SPELL_HIT] . '<br />
                        ' . $spell_crit . '%<br />
                        ' . $char_data[CHAR_DATA_OFFSET_SPELL_HASTE_RATING] . '
                      </div>
                    </td>
                    <td width="1%">';
            if ($equiped_items[11][1]) {
                $output .= '
                      <a style="padding:2px;" href="' . $item_datasite . $EQU_FINGER1 . '" target="_blank">
                        <img src="' . $equiped_items[11][1] . '" class="' . $equiped_items[11][2] . '" alt="Finger1" />
                      </a>';
            } else {
                $output .= '
                      <img src="img/INV/INV_empty_finger.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                    </td>
                  </tr>
                  <tr>
                    <td width="1%">';
            if ($equiped_items[4][1]) {
                $output .= '
                      <a style="padding:2px;" href="' . $item_datasite . $EQU_SHIRT . '" target="_blank">
                        <img src="' . $equiped_items[4][1] . '" class="' . $equiped_items[4][2] . '" alt="Shirt" />
                      </a>';
            } else {
                $output .= '
                      <img src="img/INV/INV_empty_shirt.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                    </td>
                    <td width="1%">';
            if ($equiped_items[12][1]) {
                $output .= '
                      <a style="padding:2px;" href="' . $item_datasite . $EQU_FINGER2 . '" target="_blank">
                        <img src="' . $equiped_items[12][1] . '" class="' . $equiped_items[12][2] . '" alt="Finger2" />
                      </a>';
            } else {
                $output .= '
                      <img src="img/INV/INV_empty_finger.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                    </td>
                  </tr>
                  <tr>
                    <td width="1%">';
            if ($equiped_items[19][1]) {
                $output .= '
                      <a style="padding:2px;" href="' . $item_datasite . $EQU_TABARD . '" target="_blank">
                        <img src="' . $equiped_items[19][1] . '" class="' . $equiped_items[19][2] . '" alt="Tabard" />
                      </a>';
            } else {
                $output .= '
                      <img src="img/INV/INV_empty_tabard.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                    </td>
                    <td class="half_line" colspan="2" rowspan="2" align="center" width="50%">
                      <div class="gradient_p">
                        ' . $lang_char['dodge'] . ':<br />
                        ' . $lang_char['parry'] . ':<br />
                        ' . $lang_char['block'] . ':<br />
                        ' . $lang_char['resilience'] . ':<br />
                      </div>
                      <div class="gradient_pp">
                        ' . $dodge . '%<br />
                        ' . $parry . '%<br />
                        ' . $block . '%<br />
                        ' . $char_data[CHAR_DATA_OFFSET_RESILIENCE] . '<br />
                      </div>
                    </td>
                    <td class="half_line" colspan="2" rowspan="2" align="center" width="50%">
                      <div class="gradient_p">
                        ' . $lang_char['ranged_d'] . ':<br />
                        ' . $lang_char['ranged_ap'] . ':<br />
                        ' . $lang_char['ranged_hit'] . ':<br />
                        ' . $lang_char['ranged_crit'] . ':<br />
                      </div>
                      <div class="gradient_pp">
                        ' . $minrangeddamage . '-' . $maxrangeddamage . '<br />
                        ' . ($char_data[CHAR_DATA_OFFSET_RANGED_AP] + $char_data[CHAR_DATA_OFFSET_RANGED_AP_MOD]) . '<br />
                        ' . $char_data[CHAR_DATA_OFFSET_RANGE_HIT] . '<br />
                        ' . $ranged_crit . '%<br />
                      </div>
                    </td>
                    <td width="1%">';
            if ($equiped_items[13][1]) {
                $output .= '
                      <a style="padding:2px;" href="' . $item_datasite . $EQU_TRINKET1 . '" target="_blank">
                        <img src="' . $equiped_items[13][1] . '" class="' . $equiped_items[13][2] . '" alt="Trinket1" />
                      </a>';
            } else {
                $output .= '
                      <img src="img/INV/INV_empty_trinket.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                    </td>
                  </tr>
                  <tr>
                    <td width="1%">';
            if ($equiped_items[9][1]) {
                $output .= '
                      <a style="padding:2px;" href="' . $item_datasite . $EQU_WRIST . '" target="_blank">
                        <img src="' . $equiped_items[9][1] . '" class="' . $equiped_items[9][2] . '" alt="Wrist" />
                      </a>';
            } else {
                $output .= '
                      <img src="img/INV/INV_empty_wrist.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                    </td>
                    <td width="1%">';
            if ($equiped_items[14][1]) {
                $output .= '
                      <a style="padding:2px;" href="' . $item_datasite . $EQU_TRINKET2 . '" target="_blank">
                        <img src="' . $equiped_items[14][1] . '" class="' . $equiped_items[14][2] . '" alt="Trinket2" />
                      </a>';
            } else {
                $output .= '
                      <img src="img/INV/INV_empty_trinket.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                    </td>
                  </tr>
                  <tr>
                    <td></td>
                    <td width="15%">';
            if ($equiped_items[16][1]) {
                $output .= '
                      <a style="padding:2px;" href="' . $item_datasite . $EQU_MAIN_HAND . '" target="_blank">
                        <img src="' . $equiped_items[16][1] . '" class="' . $equiped_items[16][2] . '" alt="MainHand" />
                      </a>';
            } else {
                $output .= '
                      <img src="img/INV/INV_empty_main_hand.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                    </td>
                    <td width="15%">';
            if ($equiped_items[17][1]) {
                $output .= '
                      <a style="padding:2px;" href="' . $item_datasite . $EQU_OFF_HAND . '" target="_blank">
                        <img src="' . $equiped_items[17][1] . '" class="' . $equiped_items[17][2] . '" alt="OffHand" />
                      </a>';
            } else {
                $output .= '
                      <img src="img/INV/INV_empty_off_hand.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                    </td>
                    <td width="15%">';
            if ($equiped_items[18][1]) {
                $output .= '
                      <a style="padding:2px;" href="' . $item_datasite . $EQU_RANGED . '" target="_blank">
                        <img src="' . $equiped_items[18][1] . '" class="' . $equiped_items[18][2] . '" alt="Ranged" />
                      </a>';
            } else {
                $output .= '
                      <img src="img/INV/INV_empty_ranged.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                    </td>
                    <td width="15%"></td>
                    <td></td>
                  </tr>';
            if ($user_lvl > $owner_gmlvl || $owner_name === $user_name) {
                //total time played
                $tot_time = $char['totaltime'];
                $tot_days = (int) ($tot_time / 86400);
                $tot_time = $tot_time - $tot_days * 86400;
                $total_hours = (int) ($tot_time / 3600);
                $tot_time = $tot_time - $total_hours * 3600;
                $total_min = (int) ($tot_time / 60);
                $output .= '
                  <tr>
                    <td colspan="6">
                      ' . $lang_char['tot_paly_time'] . ': ' . $tot_days . ' ' . $lang_char['days'] . ' ' . $total_hours . ' ' . $lang_char['hours'] . ' ' . $total_min . ' ' . $lang_char['min'] . '
                    </td>
                  </tr>';
            }
            $output .= '
                </table>
              </div>
              <br />
            </div>
            <br />
            <table class="hidden">
              <tr>
                <td>';
            // button to user account page, user account page has own security
            makebutton($lang_char['chars_acc'], 'user.php?action=edit_user&amp;id=' . $owner_acc_id . '', 130);
            $output .= '
                </td>
                <td>';
            // only higher level GM with delete access can edit character
            //  character edit allows removal of character items, so delete permission is needed
            if ($user_lvl > $owner_gmlvl && $user_lvl >= $action_permission['delete']) {
                makebutton($lang_char['edit_button'], 'char_edit.php?id=' . $id . '&amp;realm=' . $realmid . '', 130);
                $output .= '
                </td>
                <td>';
            }
            // only higher level GM with delete access, or character owner can delete character
            if ($user_lvl > $owner_gmlvl && $user_lvl >= $action_permission['delete'] || $owner_name === $user_name) {
                makebutton($lang_char['del_char'], 'char_list.php?action=del_char_form&amp;check%5B%5D=' . $id . '" type="wrn', 130);
                $output .= '
                </td>
                <td>';
            }
            // only GM with update permission can send mail, mail can send items, so update permission is needed
            if ($user_lvl >= $action_permission['update']) {
                makebutton($lang_char['send_mail'], 'mail.php?type=ingame_mail&amp;to=' . $char['name'] . '', 130);
                $output .= '
                </td>
                <td>';
            }
            makebutton($lang_global['back'], 'javascript:window.history.back()" type="def', 130);
            $output .= '
                </td>
              </tr>
            </table>
            <br />
          </center>
          <!-- end of char.php -->';
        } else {
            error($lang_char['no_permission']);
        }
    } else {
        error($lang_char['no_char_found']);
    }
}
Esempio n. 4
0
function char_talent(&$sqlr, &$sqlc)
{
    global $output, $lang_global, $lang_char, $realm_id, $realm_db, $characters_db, $mmfpm_db, $server, $action_permission, $user_lvl, $user_name, $spell_datasite;
    // this page uses wowhead tooltops
    wowhead_tt();
    //==========================$_GET and SECURE=================================
    // id and multi realm security to prevent sql injection
    require_once './include/char/include/char_multi_realm_security.php';
    //==========================$_GET and SECURE end=============================
    // getting character data from database
    $result = $sqlc->query('
		SELECT account, name, race, class, level, gender, 
			specCount AS talent_points
			FROM characters WHERE guid = ' . $id . '
			LIMIT 1');
    // no point going further if character does not exist
    if ($sqlc->num_rows($result)) {
        $char = $sqlc->fetch_assoc($result);
        // we get user permissions first
        $owner_acc_id = $sqlc->result($result, 0, 'account');
        $result = $sqlr->query('
			SELECT gmlevel, username 
			FROM account 
			WHERE id = ' . $char['account'] . '');
        $owner_gmlvl = $sqlr->result($result, 0, 'gmlevel');
        $owner_name = $sqlr->result($result, 0, 'username');
        // check user permission
        if ($user_lvl > $owner_gmlvl || $owner_name === $user_name) {
            // character sub header
            $output .= '
<center>
<div id="tab_content">
	<h1>' . $lang_char['talents'] . '</h1>
	<br />';
            // character menu tab
            require_once './include/char/include/char_header.php';
            // character info
            require_once './include/char/include/char_info.php';
            //---------------Page Specific Data Starts Here--------------------------
            $output .= '
<div id="tab_content2">
	<table class="lined" style="width: 550px;">
		<tr valign="top" align="center">';
            $result = $sqlc->query('
				SELECT spell 
				FROM character_spell 
				WHERE guid = ' . $id . ' AND active = 1 AND disabled = 0 
				ORDER BY spell DESC');
            if ($sqlc->num_rows($result)) {
                $talent_rate = isset($server[$realmid]['talent_rate']) ? $server[$realmid]['talent_rate'] : 1;
                $talent_points = ($char['level'] - 9) * $talent_rate;
                $talent_points_left = $char['talent_points'];
                $talent_points_used = $talent_points - $talent_points_left;
                $sqlm = new SQL();
                $sqlm->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']);
                $tabs = array();
                $l = 0;
                while (($talent = $sqlc->fetch_assoc($result)) && $l < $talent_points_used) {
                    if ($tab = $sqlm->fetch_assoc($sqlm->query('
						SELECT field_1, field_2, field_3, field_13, field_16
						FROM dbc_talent
						WHERE field_8 = ' . $talent['spell'] . ' 
						LIMIT 1'))) {
                        if (isset($tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']])) {
                            $l -= $tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']][1];
                        }
                        $tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']] = array($talent['spell'], '5', '5');
                        $l += 5;
                        if ($tab['field_13']) {
                            talent_dependencies($tabs, $tab, $l, $sqlm);
                        }
                    } elseif ($tab = $sqlm->fetch_assoc($sqlm->query('
						SELECT field_1, field_2, field_3, field_13, field_16, field_8
						FROM dbc_talent
						WHERE field_7 = ' . $talent['spell'] . '
						LIMIT 1'))) {
                        if (isset($tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']])) {
                            $l -= $tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']][1];
                        }
                        $tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']] = array($talent['spell'], '4', $tab['field_8'] ? '2' : '5');
                        $l += 4;
                        if ($tab['field_13']) {
                            talent_dependencies($tabs, $tab, $l, $sqlm);
                        }
                    } elseif ($tab = $sqlm->fetch_assoc($sqlm->query('
							SELECT field_1, field_2, field_3, field_13, field_16, field_7
							FROM dbc_talent
							WHERE field_6 = ' . $talent['spell'] . '
							LIMIT 1'))) {
                        if (isset($tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']])) {
                            $l -= $tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']][1];
                        }
                        $tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']] = array($talent['spell'], '3', $tab['field_7'] ? '2' : '5');
                        $l += 3;
                        if ($tab['field_13']) {
                            talent_dependencies($tabs, $tab, $l, $sqlm);
                        }
                    } elseif ($tab = $sqlm->fetch_assoc($sqlm->query('
							SELECT field_1, field_2, field_3, field_13, field_16, field_6
							FROM dbc_talent
							WHERE field_5 = ' . $talent['spell'] . '
							LIMIT 1'))) {
                        if (isset($tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']])) {
                            $l -= $tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']][1];
                        }
                        $tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']] = array($talent['spell'], '2', $tab['field_6'] ? '2' : '5');
                        $l += 2;
                        if ($tab['field_13']) {
                            talent_dependencies($tabs, $tab, $l, $sqlm);
                        }
                    } elseif ($tab = $sqlm->fetch_assoc($sqlm->query('
							SELECT field_1, field_2, field_3, field_13, field_16, field_5
							FROM dbc_talent
							WHERE field_4 = ' . $talent['spell'] . '
							LIMIT 1'))) {
                        if (isset($tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']])) {
                            $l -= $tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']][1];
                        }
                        $tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']] = array($talent['spell'], '1', $tab['field_5'] ? '2' : '5');
                        $l += 1;
                        if ($tab['field_13']) {
                            talent_dependencies($tabs, $tab, $l, $sqlm);
                        }
                    }
                }
                unset($tab);
                unset($talent);
                foreach ($tabs as $k => $data) {
                    $points = 0;
                    $output .= '
			<td>
				<table class="hidden" style="width: 0px;">
					<tr>
						<td colspan="6" style="border-bottom-width: 0px;">
						</td>
					</tr>
					<tr>';
                    for ($i = 0; $i < 11; ++$i) {
                        for ($j = 0; $j < 4; ++$j) {
                            if (isset($data[$i][$j])) {
                                $output .= '
						<td valign="bottom" align="center" style="border-top-width: 0px;border-bottom-width: 0px;">
							<a href="' . $spell_datasite . $data[$i][$j][0] . '" target="_blank">
								<img src="' . spell_get_icon($data[$i][$j][0], $sqlm) . '" width="36" height="36" class="icon_border_' . $data[$i][$j][2] . '" alt="" />
							</a>
							<div style="width:0px;margin:-14px 0px 0px 30px;font-size:14px;color:black">
								' . $data[$i][$j][1] . '
							</div>
							<div style="width:0px;margin:-14px 0px 0px 29px;font-size:14px;color:white">
								' . $data[$i][$j][1] . '
							</div>
						</td>';
                                $points += $data[$i][$j][1];
                            } else {
                                $output .= '
						<td valign="bottom" align="center" style="border-top-width: 0px;border-bottom-width: 0px;">
							<img src="img/blank.gif" width="44" height="44" alt="" />
						</td>';
                            }
                        }
                        $output .= '
					</tr>
					<tr>';
                    }
                    $output .= '
						<td colspan="6" style="border-top-width: 0px;border-bottom-width: 0px;"></td>
					</tr>
					<tr>
						<td colspan="6" valign="bottom" align="left">
							' . $sqlm->result($sqlm->query('SELECT field_1 FROM dbc_talenttab WHERE id = ' . $k . ''), 0, 'field_1') . ': ' . $points . '
						</td>
					</tr>
				</table>
			</td>';
                }
                unset($data);
                unset($k);
                unset($tabs);
                $output .= '
		</tr>
	</table>
	<br />
	<table>
		<tr>
			<td align="left">
				' . $lang_char['talent_rate'] . ': <br />
				' . $lang_char['talent_points'] . ': <br />
				' . $lang_char['talent_points_used'] . ': <br />
				' . $lang_char['talent_points_shown'] . ': <br />
				' . $lang_char['talent_points_left'] . ':
			</td>
			<td align="left">
				' . $talent_rate . '<br />
				' . $talent_points . '<br />
				' . $talent_points_used . '<br />
				' . $l . '<br />
				' . $talent_points_left . '
			</td>
			<td width="64">
			</td>
			<td align="right">';
                unset($l);
                unset($talent_rate);
                unset($talent_points);
                unset($talent_points_used);
                unset($talent_points_left);
                $result = $sqlc->query('
					SELECT spec, slot, glyph
					FROM character_glyphs
					WHERE guid = ' . $id . '');
                while ($glyphs = $sqlc->fetch_assoc($result)) {
                    if ($glyphs['glyph']) {
                        $glyph = $sqlm->result($sqlm->query('
							SELECT field_1
							FROM dbc_glyphproperties
							WHERE id = ' . $glyphs['glyph'] . ''), 0);
                        $output .= '
				<a href="' . $spell_datasite . $glyph . '" target="_blank">
					<img src="' . spell_get_icon($glyph, $sqlm) . '" width="36" height="36" class="icon_border_0" alt="" />
				</a>';
                    }
                }
                unset($glyphs);
                $output .= '
			</td>';
            }
            $output .= '
		</tr>
	</table>';
            $output .= '
</div>
<br />';
            //---------------Page Specific Data Ends here----------------------------
            // character sub footer
            require_once './include/char/include/char_ footer.php';
            $output .= '
<br />
</center>';
        } else {
            error($lang_char['no_permission']);
        }
    } else {
        error($lang_char['no_char_found']);
    }
}
Esempio n. 5
0
function char_spell(&$sqlr, &$sqlc)
{
    global $output, $lang_global, $lang_char, $realm_id, $characters_db, $mmfpm_db, $action_permission, $user_lvl, $user_name, $spell_datasite, $itemperpage;
    wowhead_tt();
    require_once 'core/char/char_security.php';
    $start = isset($_GET['start']) ? $sqlc->quote_smart($_GET['start']) : 0;
    if (is_numeric($start)) {
    } else {
        $start = 0;
    }
    $result = $sqlc->query('SELECT account, name, race, class, level, gender
                            FROM characters WHERE guid = ' . $id . ' LIMIT 1');
    if ($sqlc->num_rows($result)) {
        $char = $sqlc->fetch_assoc($result);
        $owner_acc_id = $sqlc->result($result, 0, 'account');
        $result = $sqlr->query('SELECT `username`, `gmlevel` FROM `account` LEFT JOIN `account_access` ON `account`.`id`=`account_access`.`id` WHERE `account`.`id` = ' . $owner_acc_id . ' ORDER BY `gmlevel` DESC LIMIT 1');
        $owner_name = $sqlr->result($result, 0, 'username');
        $owner_gmlvl = $sqlr->result($result, 0, 'gmlevel');
        if (empty($owner_gmlvl)) {
            $owner_gmlvl = 0;
        }
        if ($user_lvl > $owner_gmlvl || $owner_name === $user_name) {
            $all_record = $sqlc->result($sqlc->query('SELECT count(spell) FROM character_spell WHERE guid = ' . $id . ' and active = 1'), 0);
            $result = $sqlc->query('SELECT spell FROM character_spell WHERE guid = ' . $id . ' and active = 1 order by spell ASC LIMIT ' . $start . ', ' . $itemperpage . '');
            $output .= '
                        <center>
                            <div id="tab_content">
                                <h1>' . $lang_char['spells'] . '</h1>
                                <br />';
            require_once 'core/char/char_header.php';
            $output .= '
                                <br /><br />';
            if ($sqlc->num_rows($result)) {
                $output .= '
                                <table class="lined" style="width: 550px;">
                                    <tr align="right">
                                        <td colspan="4">';
                $output .= generate_pagination('char_spell.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;start=' . $start . '', $all_record, $itemperpage, $start);
                $output .= '
                                        </td>
                                    </tr>
                                    <tr>
                                        <th>' . $lang_char['icon'] . '</th>
                                        <th>' . $lang_char['name'] . '</th>
                                        <th>' . $lang_char['icon'] . '</th>
                                        <th>' . $lang_char['name'] . '</th>
                                    </tr>';
                $sqlm = new SQL();
                $sqlm->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']);
                while ($spell = $sqlc->fetch_assoc($result)) {
                    $output .= '
                                    <tr>
                                        <td><a href="' . $spell_datasite . $spell['spell'] . '"><img src="' . spell_get_icon($spell['spell'], $sqlm) . '" class="icon_border_0" /></a></td>
                                        <td align="left"><a href="' . $spell_datasite . $spell['spell'] . '">' . spell_get_name($spell['spell'], $sqlm) . '</a></td>';
                    if ($spell = $sqlc->fetch_assoc($result)) {
                        $output .= '
                                        <td><a href="' . $spell_datasite . $spell['spell'] . '"><img src="' . spell_get_icon($spell['spell'], $sqlm) . '" class="icon_border_0" /></a></td>
                                        <td align="left"><a href="' . $spell_datasite . $spell['spell'] . '">' . spell_get_name($spell['spell'], $sqlm) . '</a></td>
                                    </tr>';
                    } else {
                        $output .= '
                                        <td></td>
                                        <td></td>
                                    </tr>';
                    }
                }
                $output .= '
                                    <tr align="right">
                                        <td colspan="4">';
                $output .= generate_pagination('char_spell.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;start=' . $start . '', $all_record, $itemperpage, $start);
                $output .= '
                                        </td>
                                    </tr>
                                </table>';
            }
            //---------------Page Specific Data Ends here----------------------------
            //---------------Character Tabs Footer-----------------------------------
            $output .= '
                                </div>
                                </div>
                                <br />';
            require_once 'core/char/char_footer.php';
            $output .= '
                                <br />
                            </center>
                            <!-- end of char_spell.php -->';
        } else {
            error($lang_char['no_permission']);
        }
    } else {
        error($lang_char['no_char_found']);
    }
}
Esempio n. 6
0
function char_main(&$sqlr, &$sqlc)
{
    global $output, $lang_global, $lang_char, $lang_item, $realm_id, $realm_db, $characters_db, $world_db, $server, $mmfpm_db, $action_permission, $user_lvl, $user_name, $user_id, $item_datasite, $spell_datasite, $showcountryflag;
    // this page uses wowhead tooltops
    wowhead_tt();
    require_once 'core/char/char_security.php';
    $result = $sqlc->query('SELECT account, race FROM characters WHERE guid = ' . $id . ' LIMIT 1');
    if ($sqlc->num_rows($result)) {
        //resrict by owner's gmlvl
        $owner_acc_id = $sqlc->result($result, 0, 'account');
        $query = $sqlr->query('SELECT `username`, `gmlevel` FROM `account` LEFT JOIN `account_access` ON `account`.`id`=`account_access`.`id` WHERE `account`.`id` = ' . $owner_acc_id . ' ORDER BY `gmlevel` DESC LIMIT 1');
        $owner_name = $sqlr->result($query, 0, 'username');
        $owner_gmlvl = $sqlr->result($query, 0, 'gmlevel');
        if (empty($owner_gmlvl)) {
            $owner_gmlvl = 0;
        }
        if ($user_lvl || $server[$realmid]['both_factions']) {
            $side_v = 0;
            $side_p = 0;
        } else {
            $side_p = in_array($sqlc->result($result, 0, 'race'), array(2, 5, 6, 8, 10)) ? 1 : 2;
            $result_1 = $sqlc->query('SELECT race FROM characters WHERE account = ' . $user_id . ' LIMIT 1');
            if ($sqlc->num_rows($result)) {
                $side_v = in_array($sqlc->result($result_1, 0, 'race'), array(2, 5, 6, 8, 10)) ? 1 : 2;
            } else {
                $side_v = 0;
            }
            unset($result_1);
        }
        if ($user_lvl >= $owner_gmlvl && ($side_v === $side_p || !$side_v)) {
            $result = $sqlc->query('SELECT characters.equipmentCache, characters.name, characters.race, characters.class, characters.level, characters.zone, characters.map, characters.online, characters.totaltime, characters.gender, characters.account, character_stats.blockPct,
                                    character_stats.dodgePct, character_stats.parryPct, character_stats.critPct, character_stats.rangedCritPct, character_stats.spellCritPct, COALESCE(guild_member.guildid,0) AS guildid, COALESCE(guild_member.rank,0) AS rank, 
                                    characters.totalHonorPoints, characters.arenaPoints, characters.totalKills, character_stats.maxhealth, character_stats.maxpower1, character_stats.strength, character_stats.agility, character_stats.stamina, character_stats.intellect,
                                    character_stats.spirit, character_stats.armor, character_stats.resHoly, character_stats.resFire, character_stats.resNature, character_stats.resFrost, character_stats.resShadow, character_stats.resArcane, character_stats.attackPower,
                                    character_stats.rangedAttackPower, character_stats.spellPower, characters.power2, character_stats.maxpower2, characters.power4, character_stats.maxpower4, characters.power3, character_stats.maxpower3   
                                    FROM characters LEFT JOIN character_stats ON characters.guid = character_stats.guid LEFT JOIN guild_member ON characters.guid = guild_member.guid WHERE characters.guid = ' . $id);
            $char = $sqlc->fetch_assoc($result);
            $eq_data = explode(' ', $char['equipmentCache']);
            $online = $char['online'] ? $lang_char['online'] : $lang_char['offline'];
            if ($char['guildid'] && $char['guildid'] != 0) {
                $guild_name = $sqlc->result($sqlc->query('SELECT name FROM guild WHERE guildid =' . $char['guildid'] . ''), 0, 'name');
                $guild_name = '<a href="guild.php?action=view_guild&amp;realm=' . $realmid . '&amp;error=3&amp;id=' . $char['guildid'] . '" >' . $guild_name . '</a>';
                $mrank = $char['rank'];
                $guild_rank = $sqlc->result($sqlc->query('SELECT rname FROM guild_rank WHERE guildid =' . $char['guildid'] . ' AND rid=' . $mrank . ''), 0, 'rname');
            } else {
                $guild_name = $lang_global['none'];
                $guild_rank = $lang_global['none'];
            }
            $block = round($char['blockPct'], 2);
            $dodge = round($char['dodgePct'], 2);
            $parry = round($char['parryPct'], 2);
            $crit = round($char['critPct'], 2);
            $ranged_crit = round($char['rangedCritPct'], 2);
            $spell_crit = round($char['spellCritPct'], 2);
            $spell_damage = $char['spellPower'];
            $rage = round($char['power2'] / 10);
            $maxrage = round($char['maxpower2'] / 10);
            //preventing undefined variables, didnt want to remove all this stuff so just filling the missing variables with 0
            define('CHAR_DATA_OFFSET_MELEE_HIT', 0);
            define('CHAR_DATA_OFFSET_SPELL_HEAL', 1);
            define('CHAR_DATA_OFFSET_SPELL_HIT', 2);
            define('CHAR_DATA_OFFSET_SPELL_HASTE_RATING', 3);
            define('CHAR_DATA_OFFSET_RESILIENCE', 4);
            define('CHAR_DATA_OFFSET_RANGE_HIT', 5);
            $char_data = array(0, 0, 0, 0, 0, 0);
            $maxdamage = 0;
            $mindamage = 0;
            $maxrangeddamage = 0;
            $minrangeddamage = 0;
            $expertise = 0;
            $EQU_HEAD = $eq_data[EQ_DATA_OFFSET_EQU_HEAD];
            $EQU_NECK = $eq_data[EQ_DATA_OFFSET_EQU_NECK];
            $EQU_SHOULDER = $eq_data[EQ_DATA_OFFSET_EQU_SHOULDER];
            $EQU_SHIRT = $eq_data[EQ_DATA_OFFSET_EQU_SHIRT];
            $EQU_CHEST = $eq_data[EQ_DATA_OFFSET_EQU_CHEST];
            $EQU_BELT = $eq_data[EQ_DATA_OFFSET_EQU_BELT];
            $EQU_LEGS = $eq_data[EQ_DATA_OFFSET_EQU_LEGS];
            $EQU_FEET = $eq_data[EQ_DATA_OFFSET_EQU_FEET];
            $EQU_WRIST = $eq_data[EQ_DATA_OFFSET_EQU_WRIST];
            $EQU_GLOVES = $eq_data[EQ_DATA_OFFSET_EQU_GLOVES];
            $EQU_FINGER1 = $eq_data[EQ_DATA_OFFSET_EQU_FINGER1];
            $EQU_FINGER2 = $eq_data[EQ_DATA_OFFSET_EQU_FINGER2];
            $EQU_TRINKET1 = $eq_data[EQ_DATA_OFFSET_EQU_TRINKET1];
            $EQU_TRINKET2 = $eq_data[EQ_DATA_OFFSET_EQU_TRINKET2];
            $EQU_BACK = $eq_data[EQ_DATA_OFFSET_EQU_BACK];
            $EQU_MAIN_HAND = $eq_data[EQ_DATA_OFFSET_EQU_MAIN_HAND];
            $EQU_OFF_HAND = $eq_data[EQ_DATA_OFFSET_EQU_OFF_HAND];
            $EQU_RANGED = $eq_data[EQ_DATA_OFFSET_EQU_RANGED];
            $EQU_TABARD = $eq_data[EQ_DATA_OFFSET_EQU_TABARD];
            /*
            // reserved incase we want to use back minimanagers' built in tooltip, instead of wowheads'
            // minimanagers' item tooltip needs updating, but it can show enchantments and sockets.
            
                  $equiped_items = array
                  (
                     1 => array(($EQU_HEAD      ? get_item_tooltip($EQU_HEAD)      : 0),($EQU_HEAD      ? get_item_icon($EQU_HEAD)      : 0),($EQU_HEAD      ? get_item_border($EQU_HEAD)      : 0)),
                     2 => array(($EQU_NECK      ? get_item_tooltip($EQU_NECK)      : 0),($EQU_NECK      ? get_item_icon($EQU_NECK)      : 0),($EQU_NECK      ? get_item_border($EQU_NECK)      : 0)),
                     3 => array(($EQU_SHOULDER  ? get_item_tooltip($EQU_SHOULDER)  : 0),($EQU_SHOULDER  ? get_item_icon($EQU_SHOULDER)  : 0),($EQU_SHOULDER  ? get_item_border($EQU_SHOULDER)  : 0)),
                     4 => array(($EQU_SHIRT     ? get_item_tooltip($EQU_SHIRT)     : 0),($EQU_SHIRT     ? get_item_icon($EQU_SHIRT)     : 0),($EQU_SHIRT     ? get_item_border($EQU_SHIRT)     : 0)),
                     5 => array(($EQU_CHEST     ? get_item_tooltip($EQU_CHEST)     : 0),($EQU_CHEST     ? get_item_icon($EQU_CHEST)     : 0),($EQU_CHEST     ? get_item_border($EQU_CHEST)     : 0)),
                     6 => array(($EQU_BELT      ? get_item_tooltip($EQU_BELT)      : 0),($EQU_BELT      ? get_item_icon($EQU_BELT)      : 0),($EQU_BELT      ? get_item_border($EQU_BELT)      : 0)),
                     7 => array(($EQU_LEGS      ? get_item_tooltip($EQU_LEGS)      : 0),($EQU_LEGS      ? get_item_icon($EQU_LEGS)      : 0),($EQU_LEGS      ? get_item_border($EQU_LEGS)      : 0)),
                     8 => array(($EQU_FEET      ? get_item_tooltip($EQU_FEET)      : 0),($EQU_FEET      ? get_item_icon($EQU_FEET)      : 0),($EQU_FEET      ? get_item_border($EQU_FEET)      : 0)),
                     9 => array(($EQU_WRIST     ? get_item_tooltip($EQU_WRIST)     : 0),($EQU_WRIST     ? get_item_icon($EQU_WRIST)     : 0),($EQU_WRIST     ? get_item_border($EQU_WRIST)     : 0)),
                    10 => array(($EQU_GLOVES    ? get_item_tooltip($EQU_GLOVES)    : 0),($EQU_GLOVES    ? get_item_icon($EQU_GLOVES)    : 0),($EQU_GLOVES    ? get_item_border($EQU_GLOVES)    : 0)),
                    11 => array(($EQU_FINGER1   ? get_item_tooltip($EQU_FINGER1)   : 0),($EQU_FINGER1   ? get_item_icon($EQU_FINGER1)   : 0),($EQU_FINGER1   ? get_item_border($EQU_FINGER1)   : 0)),
                    12 => array(($EQU_FINGER2   ? get_item_tooltip($EQU_FINGER2)   : 0),($EQU_FINGER2   ? get_item_icon($EQU_FINGER2)   : 0),($EQU_FINGER2   ? get_item_border($EQU_FINGER2)   : 0)),
                    13 => array(($EQU_TRINKET1  ? get_item_tooltip($EQU_TRINKET1)  : 0),($EQU_TRINKET1  ? get_item_icon($EQU_TRINKET1)  : 0),($EQU_TRINKET1  ? get_item_border($EQU_TRINKET1)  : 0)),
                    14 => array(($EQU_TRINKET2  ? get_item_tooltip($EQU_TRINKET2)  : 0),($EQU_TRINKET2  ? get_item_icon($EQU_TRINKET2)  : 0),($EQU_TRINKET2  ? get_item_border($EQU_TRINKET2)  : 0)),
                    15 => array(($EQU_BACK      ? get_item_tooltip($EQU_BACK)      : 0),($EQU_BACK      ? get_item_icon($EQU_BACK)      : 0),($EQU_BACK      ? get_item_border($EQU_BACK)      : 0)),
                    16 => array(($EQU_MAIN_HAND ? get_item_tooltip($EQU_MAIN_HAND) : 0),($EQU_MAIN_HAND ? get_item_icon($EQU_MAIN_HAND) : 0),($EQU_MAIN_HAND ? get_item_border($EQU_MAIN_HAND) : 0)),
                    17 => array(($EQU_OFF_HAND  ? get_item_tooltip($EQU_OFF_HAND)  : 0),($EQU_OFF_HAND  ? get_item_icon($EQU_OFF_HAND)  : 0),($EQU_OFF_HAND  ? get_item_border($EQU_OFF_HAND)  : 0)),
                    18 => array(($EQU_RANGED    ? get_item_tooltip($EQU_RANGED)    : 0),($EQU_RANGED    ? get_item_icon($EQU_RANGED)    : 0),($EQU_RANGED    ? get_item_border($EQU_RANGED)    : 0)),
                    19 => array(($EQU_TABARD    ? get_item_tooltip($EQU_TABARD)    : 0),($EQU_TABARD    ? get_item_icon($EQU_TABARD)    : 0),($EQU_TABARD    ? get_item_border($EQU_TABARD)    : 0))
                  );
            */
            $sqlm = new SQL();
            $sqlm->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']);
            $sqlw = new SQL();
            $sqlw->connect($world_db[$realmid]['addr'], $world_db[$realmid]['user'], $world_db[$realmid]['pass'], $world_db[$realmid]['name']);
            $equiped_items = array(1 => array('', $EQU_HEAD ? get_item_icon($EQU_HEAD, $sqlm, $sqlw) : 0, $EQU_HEAD ? get_item_border($EQU_HEAD, $sqlw) : 0), 2 => array('', $EQU_NECK ? get_item_icon($EQU_NECK, $sqlm, $sqlw) : 0, $EQU_NECK ? get_item_border($EQU_NECK, $sqlw) : 0), 3 => array('', $EQU_SHOULDER ? get_item_icon($EQU_SHOULDER, $sqlm, $sqlw) : 0, $EQU_SHOULDER ? get_item_border($EQU_SHOULDER, $sqlw) : 0), 4 => array('', $EQU_SHIRT ? get_item_icon($EQU_SHIRT, $sqlm, $sqlw) : 0, $EQU_SHIRT ? get_item_border($EQU_SHIRT, $sqlw) : 0), 5 => array('', $EQU_CHEST ? get_item_icon($EQU_CHEST, $sqlm, $sqlw) : 0, $EQU_CHEST ? get_item_border($EQU_CHEST, $sqlw) : 0), 6 => array('', $EQU_BELT ? get_item_icon($EQU_BELT, $sqlm, $sqlw) : 0, $EQU_BELT ? get_item_border($EQU_BELT, $sqlw) : 0), 7 => array('', $EQU_LEGS ? get_item_icon($EQU_LEGS, $sqlm, $sqlw) : 0, $EQU_LEGS ? get_item_border($EQU_LEGS, $sqlw) : 0), 8 => array('', $EQU_FEET ? get_item_icon($EQU_FEET, $sqlm, $sqlw) : 0, $EQU_FEET ? get_item_border($EQU_FEET, $sqlw) : 0), 9 => array('', $EQU_WRIST ? get_item_icon($EQU_WRIST, $sqlm, $sqlw) : 0, $EQU_WRIST ? get_item_border($EQU_WRIST, $sqlw) : 0), 10 => array('', $EQU_GLOVES ? get_item_icon($EQU_GLOVES, $sqlm, $sqlw) : 0, $EQU_GLOVES ? get_item_border($EQU_GLOVES, $sqlw) : 0), 11 => array('', $EQU_FINGER1 ? get_item_icon($EQU_FINGER1, $sqlm, $sqlw) : 0, $EQU_FINGER1 ? get_item_border($EQU_FINGER1, $sqlw) : 0), 12 => array('', $EQU_FINGER2 ? get_item_icon($EQU_FINGER2, $sqlm, $sqlw) : 0, $EQU_FINGER2 ? get_item_border($EQU_FINGER2, $sqlw) : 0), 13 => array('', $EQU_TRINKET1 ? get_item_icon($EQU_TRINKET1, $sqlm, $sqlw) : 0, $EQU_TRINKET1 ? get_item_border($EQU_TRINKET1, $sqlw) : 0), 14 => array('', $EQU_TRINKET2 ? get_item_icon($EQU_TRINKET2, $sqlm, $sqlw) : 0, $EQU_TRINKET2 ? get_item_border($EQU_TRINKET2, $sqlw) : 0), 15 => array('', $EQU_BACK ? get_item_icon($EQU_BACK, $sqlm, $sqlw) : 0, $EQU_BACK ? get_item_border($EQU_BACK, $sqlw) : 0), 16 => array('', $EQU_MAIN_HAND ? get_item_icon($EQU_MAIN_HAND, $sqlm, $sqlw) : 0, $EQU_MAIN_HAND ? get_item_border($EQU_MAIN_HAND, $sqlw) : 0), 17 => array('', $EQU_OFF_HAND ? get_item_icon($EQU_OFF_HAND, $sqlm, $sqlw) : 0, $EQU_OFF_HAND ? get_item_border($EQU_OFF_HAND, $sqlw) : 0), 18 => array('', $EQU_RANGED ? get_item_icon($EQU_RANGED, $sqlm, $sqlw) : 0, $EQU_RANGED ? get_item_border($EQU_RANGED, $sqlw) : 0), 19 => array('', $EQU_TABARD ? get_item_icon($EQU_TABARD, $sqlm, $sqlw) : 0, $EQU_TABARD ? get_item_border($EQU_TABARD, $sqlw) : 0));
            if ($user_lvl > $owner_gmlvl || $owner_name === $user_name) {
                $output .= '
                <center>
                    <div id="tab_content">
                        <h1>' . $lang_char['char_sheet'] . '</h1><br />
                        <div id="tab">
                            <ul>
                                <li><a href="char.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['char_sheet'] . '</a></li>
                                <li><a href="char_inv.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['inventory'] . '</a></li>
                                <li><a href="char_extra.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['extra'] . '</a></li>
                                ' . ($char['level'] < 10 ? '' : '<li><a href="char_talent.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['talents'] . '</a></li>') . '
                                <li><a href="char_achieve.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['achievements'] . '</a></li>
                                <li><a href="char_rep.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['reputation'] . '</a></li>
                                <li><a href="char_skill.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['skills'] . '</a></li>
                                <li><a href="char_quest.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['quests'] . '</a></li>';
                if (char_get_class_name($char['class']) === 'Hunter') {
                    $output .= '
                                <li><a href="char_pets.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['pets'] . '</a></li>';
                }
                $output .= '
                                <li><a href="char_friends.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['friends'] . '</a></li>
                                <li><a href="char_spell.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['spells'] . '</a></li>
                                <li><a href="char_mail.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['mail'] . '</a></li>';
            } else {
                $output .= '
                <center>
                    <div id="tab_content">
                        <h1>' . $lang_char['char_sheet'] . '</h1><br />
                        <div id="tab">
                            <ul>
                                <li><a href="char.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['char_sheet'] . '</a></li>';
            }
            $output .= '
                            </ul>
                        </div>
                        <div id="tab_content2">
                            <table class="lined" style="width: 580px;">
                                <tr>
                                    <td colspan="2">
                                        <div>
                                            <img src="' . char_get_avatar_img($char['level'], $char['gender'], $char['race'], $char['class'], 0) . '" alt="avatar" />
                                        </div>
                                        <div>';
            $a_results = $sqlc->query('SELECT DISTINCT spell FROM character_aura WHERE guid = ' . $id . '');
            if ($sqlc->num_rows($a_results)) {
                while ($aura = $sqlc->fetch_assoc($a_results)) {
                    $output .= '
                                            <a style="padding:2px;" href="' . $spell_datasite . $aura['spell'] . '" target="_blank">
                                                <img src="' . spell_get_icon($aura['spell'], $sqlm) . '" alt="' . $aura['spell'] . '" width="24" height="24" />
                                            </a>';
                }
            }
            $output .= '
                                        </div>
                                    </td>
                                    <td colspan="4">
                                        <font class="bold">
                                            ' . htmlentities($char['name']) . ' -
                                            <img src="img/c_icons/' . $char['race'] . '-' . $char['gender'] . '.gif" onmousemove="toolTip(\'' . char_get_race_name($char['race']) . '\', \'item_tooltip\')" onmouseout="toolTip()" alt="" />
                                            <img src="img/c_icons/' . $char['class'] . '.gif" onmousemove="toolTip(\'' . char_get_class_name($char['class']) . '\', \'item_tooltip\')" onmouseout="toolTip()" alt="" />
                                            - lvl ' . char_get_level_color($char['level']) . '
                                        </font>
                                        <br />' . get_map_name($char['map'], $sqlm) . ' - ' . get_zone_name($char['zone'], $sqlm) . '
                                        <br />' . $lang_char['honor_points'] . ': ' . $char['totalHonorPoints'] . ' / ' . $char['arenaPoints'] . ' - ' . $lang_char['honor_kills'] . ': ' . $char['totalKills'] . '
                                        <br />' . $lang_char['guild'] . ': ' . $guild_name . ' | ' . $lang_char['rank'] . ': ' . htmlentities($guild_rank) . '
                                        <br />' . ($char['online'] ? '<img src="img/up.gif" onmousemove="toolTip(\'Online\', \'item_tooltip\')" onmouseout="toolTip()" alt="online" />' : '<img src="img/down.gif" onmousemove="toolTip(\'Offline\', \'item_tooltip\')" onmouseout="toolTip()" alt="offline" />');
            if ($showcountryflag) {
                require_once 'libs/misc_lib.php';
                $country = misc_get_country_by_account($char['account'], $sqlr, $sqlm);
                $output .= ' - ' . ($country['code'] ? '<img src="img/flags/' . $country['code'] . '.png" onmousemove="toolTip(\'' . $country['country'] . '\', \'item_tooltip\')" onmouseout="toolTip()" alt="" />' : '-');
                unset($country);
            }
            $output .= '
                                    </td>
                                </tr>
                                <tr>
                                    <td width="6%">';
            if ($equiped_items[1][1]) {
                $output .= '
                                        <a style="padding:2px;" href="' . $item_datasite . $EQU_HEAD . '" target="_blank">
                                            <img src="' . $equiped_items[1][1] . '" class="' . $equiped_items[1][2] . '" alt="Head" />
                                        </a>';
            } else {
                $output .= '
                                        <img src="img/INV/INV_empty_head.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                                    </td>
                                    <td class="half_line" colspan="2" align="center" width="50%">
                                        <div class="gradient_p">' . $lang_item['health'] . ':</div>
                                        <div class="gradient_pp">' . $char['maxhealth'] . '</div>';
            if ($char['class'] == 11) {
                //druid
                $output .= '
                                        </br>
                                        <div class="gradient_p">' . $lang_item['energy'] . ':</div>
                                        <div class="gradient_pp">' . $char['power4'] . '/' . $char['maxpower4'] . '</div>';
            }
            $output .= '
                                    </td>
                                    <td class="half_line" colspan="2" align="center" width="50%">';
            if ($char['class'] == 1) {
                // warrior
                $output .= '
                                        <div class="gradient_p">' . $lang_item['rage'] . ':</div>
                                        <div class="gradient_pp">' . $rage . '/' . $maxrage . '</div>';
            } elseif ($char['class'] == 4) {
                // rogue
                $output .= '
                                        <div class="gradient_p">' . $lang_item['energy'] . ':</div>
                                        <div class="gradient_pp">' . $char['power4'] . '/' . $char['maxpower4'] . '</div>';
            } elseif ($char['class'] == 6) {
                // death knight // Don't know if FOCUS is the right one need to verify with Death Knight player.
                $output .= '
                                        <div class="gradient_p">' . $lang_item['runic'] . ':</div>
                                        <div class="gradient_pp">' . $char['power3'] . '/' . $char['maxpower3'] . '</div>';
            } elseif ($char['class'] == 11) {
                // druid
                $output .= '
                                        <div class="gradient_p">' . $lang_item['mana'] . ':</div>
                                        <div class="gradient_pp">' . $char['maxpower1'] . '</div>
                                        </br>
                                        <div class="gradient_p">' . $lang_item['rage'] . ':</div>
                                        <div class="gradient_pp">' . $rage . '/' . $maxrage . '</div>';
            } elseif ($char['class'] == 2 || $char['class'] == 3 || $char['class'] == 5 || $char['class'] == 7 || $char['class'] == 8 || $char['class'] == 9) {
                // warlock
                $output .= '
                                        <div class="gradient_p">' . $lang_item['mana'] . ':</div>
                                        <div class="gradient_pp">' . $char['maxpower1'] . '</div>';
            }
            $output .= '
                                    </td>
                                    <td width="6%">';
            if ($equiped_items[10][1]) {
                $output .= '
                                        <a style="padding:2px;" href="' . $item_datasite . $EQU_GLOVES . '" target="_blank">
                                            <img src="' . $equiped_items[10][1] . '" class="' . $equiped_items[10][2] . '" alt="Gloves" />
                                        </a>';
            } else {
                $output .= '
                                        <img src="img/INV/INV_empty_gloves.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                                    </td>
                                </tr>
                                <tr>
                                    <td width="1%">';
            if ($equiped_items[2][1]) {
                $output .= '
                                        <a style="padding:2px;" href="' . $item_datasite . $EQU_NECK . '" target="_blank">
                                            <img src="' . $equiped_items[2][1] . '" class="' . $equiped_items[2][2] . '" alt="Neck" />
                                        </a>';
            } else {
                $output .= '
                                        <img src="img/INV/INV_empty_neck.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                                    </td>
                                    <td class="half_line" colspan="2" rowspan="3" align="center" width="50%">
                                        <div class="gradient_p">
                                            ' . $lang_item['strength'] . ':<br />
                                            ' . $lang_item['agility'] . ':<br />
                                            ' . $lang_item['stamina'] . ':<br />
                                            ' . $lang_item['intellect'] . ':<br />
                                            ' . $lang_item['spirit'] . ':<br />
                                            ' . $lang_item['armor'] . ':
                                        </div>
                                        <div class="gradient_pp">
                                            ' . $char['strength'] . '<br />
                                            ' . $char['agility'] . '<br />
                                            ' . $char['stamina'] . '<br />
                                            ' . $char['intellect'] . '<br />
                                            ' . $char['spirit'] . '<br />
                                            ' . $char['armor'] . '
                                        </div>
                                    </td>
                                    <td class="half_line" colspan="2" rowspan="3" align="center" width="50%">
                                        <div class="gradient_p">
                                            ' . $lang_item['res_holy'] . ':<br />
                                            ' . $lang_item['res_arcane'] . ':<br />
                                            ' . $lang_item['res_fire'] . ':<br />
                                            ' . $lang_item['res_nature'] . ':<br />
                                            ' . $lang_item['res_frost'] . ':<br />
                                            ' . $lang_item['res_shadow'] . ':
                                        </div>
                                        <div class="gradient_pp">
                                            ' . $char['resHoly'] . '<br />
                                            ' . $char['resArcane'] . '<br />
                                            ' . $char['resFire'] . '<br />
                                            ' . $char['resNature'] . '<br />
                                            ' . $char['resFrost'] . '<br />
                                            ' . $char['resShadow'] . '
                                        </div>
                                    </td>
                                    <td width="1%">';
            if ($equiped_items[6][1]) {
                $output .= '
                                        <a style="padding:2px;" href="' . $item_datasite . $EQU_BELT . '" target="_blank">
                                            <img src="' . $equiped_items[6][1] . '" class="' . $equiped_items[6][2] . '" alt="Belt" />
                                        </a>';
            } else {
                $output .= '
                                        <img src="img/INV/INV_empty_waist.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                                    </td>
                                </tr>
                                <tr>
                                    <td width="1%">';
            if ($equiped_items[3][1]) {
                $output .= '
                                        <a style="padding:2px;" href="' . $item_datasite . $EQU_SHOULDER . '" target="_blank">
                                            <img src="' . $equiped_items[3][1] . '" class="' . $equiped_items[3][2] . '" alt="Shoulder" />
                                        </a>';
            } else {
                $output .= '
                                        <img src="img/INV/INV_empty_shoulder.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                                    </td>
                                    <td width="1%">';
            if ($equiped_items[7][1]) {
                $output .= '
                                        <a style="padding:2px;" href="' . $item_datasite . $EQU_LEGS . '" target="_blank">
                                            <img src="' . $equiped_items[7][1] . '" class="' . $equiped_items[7][2] . '" alt="Legs" />
                                        </a>';
            } else {
                $output .= '
                                        <img src="img/INV/INV_empty_legs.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                                    </td>
                                </tr>
                                <tr>
                                    <td width="1%">';
            if ($equiped_items[15][1]) {
                $output .= '
                                        <a style="padding:2px;" href="' . $item_datasite . $EQU_BACK . '" target="_blank">
                                            <img src="' . $equiped_items[15][1] . '" class="' . $equiped_items[15][2] . '" alt="Back" />
                                        </a>';
            } else {
                $output .= '
                                        <img src="img/INV/INV_empty_chest_back.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                                    </td>
                                    <td width="1%">';
            if ($equiped_items[8][1]) {
                $output .= '
                                        <a style="padding:2px;" href="' . $item_datasite . $EQU_FEET . '" target="_blank">
                                            <img src="' . $equiped_items[8][1] . '" class="' . $equiped_items[8][2] . '" alt="Feet" />
                                        </a>';
            } else {
                $output .= '
                                        <img src="img/INV/INV_empty_feet.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                                    </td>
                                </tr>
                                <tr>
                                    <td width="1%">';
            if ($equiped_items[5][1]) {
                $output .= '
                                        <a style="padding:2px;" href="' . $item_datasite . $EQU_CHEST . '" target="_blank">
                                            <img src="' . $equiped_items[5][1] . '" class="' . $equiped_items[5][2] . '" alt="Chest" />
                                        </a>';
            } else {
                $output .= '
                                        <img src="img/INV/INV_empty_chest_back.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                                    </td>
                                    <td class="half_line" colspan="2" rowspan="2" align="center" width="50%">
                                        <div class="gradient_p">
                                            ' . $lang_char['melee_d'] . ':<br />
                                            ' . $lang_char['melee_ap'] . ':<br />
                                            ' . $lang_char['melee_hit'] . ':<br />
                                            ' . $lang_char['melee_crit'] . ':<br />
                                            ' . $lang_char['expertise'] . ':<br />
                                        </div>
                                        <div class="gradient_pp">
                                            ' . $mindamage . '-' . $maxdamage . '<br />
                                            ' . $char['attackPower'] . '<br />
                                            ' . $char_data[CHAR_DATA_OFFSET_MELEE_HIT] . '<br />
                                            ' . $crit . '%<br />
                                            ' . $expertise . '<br />
                                        </div>
                                    </td>
                                    <td class="half_line" colspan="2" rowspan="2" align="center" width="50%">
                                        <div class="gradient_p">
                                            ' . $lang_char['spell_d'] . ':<br />
                                            ' . $lang_char['spell_heal'] . ':<br />
                                            ' . $lang_char['spell_hit'] . ':<br />
                                            ' . $lang_char['spell_crit'] . ':<br />
                                            ' . $lang_char['spell_haste'] . '
                                        </div>
                                        <div class="gradient_pp">
                                            ' . $spell_damage . '<br />
                                            ' . $char_data[CHAR_DATA_OFFSET_SPELL_HEAL] . '<br />
                                            ' . $char_data[CHAR_DATA_OFFSET_SPELL_HIT] . '<br />
                                            ' . $spell_crit . '%<br />
                                            ' . $char_data[CHAR_DATA_OFFSET_SPELL_HASTE_RATING] . '
                                        </div>
                                    </td>
                                    <td width="1%">';
            if ($equiped_items[11][1]) {
                $output .= '
                                        <a style="padding:2px;" href="' . $item_datasite . $EQU_FINGER1 . '" target="_blank">
                                            <img src="' . $equiped_items[11][1] . '" class="' . $equiped_items[11][2] . '" alt="Finger1" />
                                        </a>';
            } else {
                $output .= '
                                        <img src="img/INV/INV_empty_finger.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                                    </td>
                                </tr>
                                <tr>
                                    <td width="1%">';
            if ($equiped_items[4][1]) {
                $output .= '
                                        <a style="padding:2px;" href="' . $item_datasite . $EQU_SHIRT . '" target="_blank">
                                            <img src="' . $equiped_items[4][1] . '" class="' . $equiped_items[4][2] . '" alt="Shirt" />
                                        </a>';
            } else {
                $output .= '
                                        <img src="img/INV/INV_empty_shirt.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                                    </td>
                                    <td width="1%">';
            if ($equiped_items[12][1]) {
                $output .= '
                                        <a style="padding:2px;" href="' . $item_datasite . $EQU_FINGER2 . '" target="_blank">
                                            <img src="' . $equiped_items[12][1] . '" class="' . $equiped_items[12][2] . '" alt="Finger2" />
                                        </a>';
            } else {
                $output .= '
                                        <img src="img/INV/INV_empty_finger.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                                    </td>
                                </tr>
                                <tr>
                                    <td width="1%">';
            if ($equiped_items[19][1]) {
                $output .= '
                                        <a style="padding:2px;" href="' . $item_datasite . $EQU_TABARD . '" target="_blank">
                                            <img src="' . $equiped_items[19][1] . '" class="' . $equiped_items[19][2] . '" alt="Tabard" />
                                        </a>';
            } else {
                $output .= '
                                        <img src="img/INV/INV_empty_tabard.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                                    </td>
                                    <td class="half_line" colspan="2" rowspan="2" align="center" width="50%">
                                        <div class="gradient_p">
                                            ' . $lang_char['dodge'] . ':<br />
                                            ' . $lang_char['parry'] . ':<br />
                                            ' . $lang_char['block'] . ':<br />
                                            ' . $lang_char['resilience'] . ':<br />
                                        </div>
                                        <div class="gradient_pp">
                                            ' . $dodge . '%<br />
                                            ' . $parry . '%<br />
                                            ' . $block . '%<br />
                                            ' . $char_data[CHAR_DATA_OFFSET_RESILIENCE] . '<br />
                                        </div>
                                    </td>
                                    <td class="half_line" colspan="2" rowspan="2" align="center" width="50%">
                                        <div class="gradient_p">
                                            ' . $lang_char['ranged_d'] . ':<br />
                                            ' . $lang_char['ranged_ap'] . ':<br />
                                            ' . $lang_char['ranged_hit'] . ':<br />
                                            ' . $lang_char['ranged_crit'] . ':<br />
                                        </div>
                                        <div class="gradient_pp">
                                            ' . $minrangeddamage . '-' . $maxrangeddamage . '<br />
                                            ' . $char['rangedAttackPower'] . '<br />
                                            ' . $char_data[CHAR_DATA_OFFSET_RANGE_HIT] . '<br />
                                            ' . $ranged_crit . '%<br />
                                        </div>
                                    </td>
                                    <td width="1%">';
            if ($equiped_items[13][1]) {
                $output .= '
                                        <a style="padding:2px;" href="' . $item_datasite . $EQU_TRINKET1 . '" target="_blank">
                                            <img src="' . $equiped_items[13][1] . '" class="' . $equiped_items[13][2] . '" alt="Trinket1" />
                                        </a>';
            } else {
                $output .= '
                                        <img src="img/INV/INV_empty_trinket.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                                    </td>
                                </tr>
                                <tr>
                                    <td width="1%">';
            if ($equiped_items[9][1]) {
                $output .= '
                                        <a style="padding:2px;" href="' . $item_datasite . $EQU_WRIST . '" target="_blank">
                                            <img src="' . $equiped_items[9][1] . '" class="' . $equiped_items[9][2] . '" alt="Wrist" />
                                        </a>';
            } else {
                $output .= '
                                        <img src="img/INV/INV_empty_wrist.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                                    </td>
                                    <td width="1%">';
            if ($equiped_items[14][1]) {
                $output .= '
                                        <a style="padding:2px;" href="' . $item_datasite . $EQU_TRINKET2 . '" target="_blank">
                                            <img src="' . $equiped_items[14][1] . '" class="' . $equiped_items[14][2] . '" alt="Trinket2" />
                                        </a>';
            } else {
                $output .= '
                                        <img src="img/INV/INV_empty_trinket.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                                    </td>
                                </tr>
                                <tr>
                                    <td></td>
                                    <td width="15%">';
            if ($equiped_items[16][1]) {
                $output .= '
                                        <a style="padding:2px;" href="' . $item_datasite . $EQU_MAIN_HAND . '" target="_blank">
                                            <img src="' . $equiped_items[16][1] . '" class="' . $equiped_items[16][2] . '" alt="MainHand" />
                                        </a>';
            } else {
                $output .= '
                                        <img src="img/INV/INV_empty_main_hand.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                                    </td>
                                    <td width="15%">';
            if ($equiped_items[17][1]) {
                $output .= '
                                        <a style="padding:2px;" href="' . $item_datasite . $EQU_OFF_HAND . '" target="_blank">
                                            <img src="' . $equiped_items[17][1] . '" class="' . $equiped_items[17][2] . '" alt="OffHand" />
                                        </a>';
            } else {
                $output .= '
                                        <img src="img/INV/INV_empty_off_hand.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                                    </td>
                                    <td width="15%">';
            if ($equiped_items[18][1]) {
                $output .= '
                                        <a style="padding:2px;" href="' . $item_datasite . $EQU_RANGED . '" target="_blank">
                                            <img src="' . $equiped_items[18][1] . '" class="' . $equiped_items[18][2] . '" alt="Ranged" />
                                        </a>';
            } else {
                $output .= '
                                        <img src="img/INV/INV_empty_ranged.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                                    </td>
                                    <td width="15%"></td>
                                    <td></td>
                                </tr>';
            if ($user_lvl > $owner_gmlvl || $owner_name === $user_name) {
                //total time played
                $tot_time = $char['totaltime'];
                $tot_days = (int) ($tot_time / 86400);
                $tot_time = $tot_time - $tot_days * 86400;
                $total_hours = (int) ($tot_time / 3600);
                $tot_time = $tot_time - $total_hours * 3600;
                $total_min = (int) ($tot_time / 60);
                $output .= '
                                <tr>
                                    <td colspan="6">
                                        ' . $lang_char['tot_paly_time'] . ': ' . $tot_days . ' ' . $lang_char['days'] . ' ' . $total_hours . ' ' . $lang_char['hours'] . ' ' . $total_min . ' ' . $lang_char['min'] . '
                                    </td>
                                </tr>';
            }
            $output .= '
                            </table>
                        </div>
                        <br />
                    </div>
                    <br />';
            require_once 'core/char/char_footer.php';
            $output .= '
                    <br />
                </center>';
        } else {
            error($lang_char['no_permission']);
        }
    } else {
        error($lang_char['no_char_found']);
    }
}
Esempio n. 7
0
function char_pets(&$sqlr, &$sqlc)
{
    global $output, $lang_global, $lang_char, $realm_id, $characters_db, $mmfpm_db, $action_permission, $user_lvl, $user_name, $spell_datasite, $pet_ability;
    // this page uses wowhead tooltops
    wowhead_tt();
    //==========================$_GET and SECURE=================================
    // id and multi realm security to prevent sql injection
    require_once './include/char/include/char_multi_realm_security.php';
    //==========================$_GET and SECURE end=============================
    // getting character data from database
    $result = $sqlc->query('
		SELECT account, name, race, class, gender, level
		FROM characters
		WHERE guid = ' . $id . '
		LIMIT 1');
    // no point going further if character does not exist
    if ($sqlc->num_rows($result)) {
        $char = $sqlc->fetch_assoc($result);
        // we get user permissions first
        $owner_acc_id = $sqlc->result($result, 0, 'account');
        $result = $sqlr->query('
			SELECT gmlevel, username 
			FROM account 
			WHERE id = ' . $char['account'] . '');
        $owner_gmlvl = $sqlr->result($result, 0, 'gmlevel');
        $owner_name = $sqlr->result($result, 0, 'username');
        // check user permission
        if ($user_lvl > $owner_gmlvl || $owner_name === $user_name) {
            // character sub header
            $output .= '
<center>
<div id="tab_content">
	<h1>' . $lang_char['pets'] . '</h1>
	<br />';
            // character menu tab
            require_once './include/char/include/char_header.php';
            // character info
            require_once './include/char/include/char_info.php';
            //---------------Page Specific Data Starts Here--------------------------
            $output .= '
	<div id="tab_content2">';
            $result = $sqlc->query('
			SELECT id, level, exp, name, curhappiness
			FROM character_pet
			WHERE owner = ' . $id . '');
            if ($sqlc->num_rows($result)) {
                $sqlm = new SQL();
                $sqlm->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']);
                while ($pet = $sqlc->fetch_assoc($result)) {
                    $happiness = floor($pet['curhappiness'] / 333000);
                    if (1 == $happiness) {
                        $hap_text = 'Content';
                        $hap_val = 1;
                    } elseif (2 == $happiness) {
                        $hap_text = 'Happy';
                        $hap_val = 2;
                    } else {
                        $hap_text = 'Unhappy';
                        $hap_val = 0;
                    }
                    $pet_next_lvl_xp = floor(char_get_xp_to_level($pet['level']) / 4);
                    $output .= '
		<font class="bold">' . $pet['name'] . ' - lvl ' . char_get_level_color($pet['level']) . '
			<a style="padding:2px;" onmouseover="toolTip(\'' . $hap_text . '\', \'item_tooltip\')" onmouseout="toolTip()"><img src="img/pet/happiness_' . $hap_val . '.jpg" alt="" /></a>
			<br /><br />
		</font>
		<table class="lined" style="width: 550px;">
			<tr>
				<td align="right">Exp:</td>
				<td valign="top" class="bar skill_bar" style="background-position: ' . (round(385 * $pet['exp'] / $pet_next_lvl_xp) - 385) . 'px;">
						<span>' . $pet['exp'] . '/' . $pet_next_lvl_xp . '</span>
				</td>
			</tr>
			<tr>
				<td align="right">Pet Abilities:</td>
				<td align="left">';
                    // active = 0 is unused and active = 1 probably some passive auras, i dont know diference between values 129 and 193, need to check mangos source
                    $ability_results = $sqlc->query('
					SELECT spell
					FROM pet_spell
					WHERE guid = ' . $pet['id'] . ' and active > 1');
                    if ($sqlc->num_rows($ability_results)) {
                        while ($ability = $sqlc->fetch_assoc($ability_results)) {
                            $output .= '
					<a style="padding:2px;" href="' . $spell_datasite . $ability['spell'] . '" target="_blank">
						<img src="' . spell_get_icon($ability['spell'], $sqlm) . '" alt="' . $ability['spell'] . '" class="icon_border_0" />
					</a>';
                        }
                    }
                    $output .= '
				</td>
			</tr>
		</table>
		<br /><br />';
                }
                unset($ability_results);
                unset($pet_next_lvl_xp);
                unset($happiness);
                unset($pet);
            }
            $output .= '
	</div>
</div>
<br />';
            //---------------Page Specific Data Ends here----------------------------
            // character sub footer
            require_once './include/char/include/char_ footer.php';
            $output .= '
<br />
</center>';
        } else {
            error($lang_char['no_permission']);
        }
    } else {
        error($lang_char['no_char_found']);
    }
}
function char_spell(&$sqlr, &$sqlc)
{
    global $output, $lang_global, $lang_char, $realm_id, $characters_db, $mmfpm_db, $action_permission, $user_lvl, $user_name, $spell_datasite, $itemperpage;
    // this page uses wowhead tooltops
    wowhead_tt();
    //==========================$_GET and SECURE=================================
    // id and multi realm security to prevent sql injection
    require_once './include/char/include/char_multi_realm_security.php';
    $start = isset($_GET['start']) ? $sqlr->quote_smart($_GET['start']) : 0;
    if (is_numeric($start)) {
    } else {
        $start = 0;
    }
    $order_by = isset($_GET['order_by']) ? $sqlr->quote_smart($_GET['order_by']) : 'guid';
    if (preg_match('/^[_[:lower:]]{1,12}$/', $order_by)) {
    } else {
        $order_by = 'guid';
    }
    $dir = isset($_GET['dir']) ? $sqlr->quote_smart($_GET['dir']) : 1;
    if (preg_match('/^[01]{1}$/', $dir)) {
    } else {
        $dir = 1;
    }
    $order_dir = $dir ? 'ASC' : 'DESC';
    $dir = $dir ? 0 : 1;
    //==========================$_GET and SECURE end=============================
    // getting character data from database
    $result = $sqlc->query('
		SELECT account, name, race, class, gender, level
		FROM characters
		WHERE guid = ' . $id . '
		LIMIT 1');
    // no point going further if character does not exist
    if ($sqlc->num_rows($result)) {
        $char = $sqlc->fetch_assoc($result);
        // we get user permissions first
        $owner_acc_id = $sqlc->result($result, 0, 'account');
        $result = $sqlr->query('
			SELECT gmlevel, username 
			FROM account 
			WHERE id = ' . $char['account'] . '');
        $owner_gmlvl = $sqlr->result($result, 0, 'gmlevel');
        $owner_name = $sqlr->result($result, 0, 'username');
        // check user permission
        if ($user_lvl > $owner_gmlvl || $owner_name === $user_name) {
            // character sub header
            $output .= '
<center>
<div id="tab_content">
	<h1>' . $lang_char['spells'] . '</h1>
	<br />';
            // character menu tab
            require_once './include/char/include/char_header.php';
            // character info
            require_once './include/char/include/char_info.php';
            //---------------Page Specific Data Starts Here--------------------------
            $output .= '
	<h1>' . $lang_char['spells'] . '</h1>
	<br />';
            // character extra menu tab
            require_once './include/char/include/char_spell_header.php';
            $all_record = $sqlc->result($sqlc->query('
				SELECT count(spell) 
				FROM character_spell 
				WHERE guid = ' . $id . ' and active = 1'), 0);
            $result = $sqlc->query('
				SELECT spell 
				FROM character_spell 
				WHERE guid = ' . $id . ' and active = 1 
				ORDER BY spell ASC
				LIMIT ' . $start . ', ' . $itemperpage . '');
            $output .= '
	<div id="tab_content2">
		<table class="lined" style="width: 550px;">
			<tr align="right">
				<td colspan="4">';
            $output .= generate_pagination('char_spell.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;start=' . $start . '', $all_record, $itemperpage, $start);
            $output .= '
				</td>
			</tr>
			<tr>
				<th>' . $lang_char['icon'] . '</th>
				<th>' . $lang_char['name'] . '</th>
				<th>' . $lang_char['icon'] . '</th>
				<th>' . $lang_char['name'] . '</th>
			</tr>';
            $sqlm = new SQL();
            $sqlm->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']);
            while ($spell = $sqlc->fetch_assoc($result)) {
                $output .= '
			<tr>
				<td><a href="' . $spell_datasite . $spell['spell'] . '"><img src="' . spell_get_icon($spell['spell'], $sqlm) . '" class="icon_border_0" /></a></td>
				<td align="left"><a href="' . $spell_datasite . $spell['spell'] . '">' . spell_get_name($spell['spell'], $sqlm) . '</a></td>';
                if ($spell = $sqlc->fetch_assoc($result)) {
                    $output .= '
				<td><a href="' . $spell_datasite . $spell['spell'] . '"><img src="' . spell_get_icon($spell['spell'], $sqlm) . '" class="icon_border_0" /></a></td>
				<td align="left"><a href="' . $spell_datasite . $spell['spell'] . '">' . spell_get_name($spell['spell'], $sqlm) . '</a></td>
			</tr>';
                } else {
                    $output .= '
				<td></td>
				<td></td>
			</tr>';
                }
            }
            $output .= '
			<tr align="right">
				<td colspan="4">';
            $output .= generate_pagination('char_spell.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;start=' . $start . '', $all_record, $itemperpage, $start);
            $output .= '
				</td>
			</tr>
		</table>
	</div>
</div>
<br />';
            //---------------Page Specific Data Ends here----------------------------
            // character sub footer
            require_once './include/char/include/char_ footer.php';
            $output .= '
<br />
</center>';
        } else {
            error($lang_char['no_permission']);
        }
    } else {
        error($lang_char['no_char_found']);
    }
}
function char_main()
{
    global $output, $realm_id, $logon_db, $characters_db, $world_db, $server, $corem_db, $site_encoding, $action_permission, $user_lvl, $user_name, $user_id, $locales_search_option, $base_datasite, $item_datasite, $spell_datasite, $showcountryflag, $timezone_offset, $sql, $core;
    // this page uses wowhead tooltops
    //wowhead_tt();
    // we need at either an id or a name or we would have nothing to show
    if (empty($_GET["id"])) {
        if (empty($_GET["name"])) {
            error(lang("global", "empty_fields"));
        }
    }
    // this is multi realm support, as of writing still under development
    // this page is already implementing it
    if (empty($_GET["realm"])) {
        $realmid = $realm_id;
    } else {
        $realmid = $sql["logon"]->quote_smart($_GET["realm"]);
        if (is_numeric($realmid)) {
            $sql["char"]->connect($characters_db[$realmid]["addr"], $characters_db[$realmid]["user"], $characters_db[$realmid]["pass"], $characters_db[$realmid]["name"], $characters_db[$realmid]["encoding"]);
        } else {
            $realmid = $realm_id;
        }
    }
    if (empty($_GET["id"])) {
        $name = $sql["char"]->quote_smart($_GET["name"]);
        if ($core == 1) {
            $result = $sql["char"]->query("SELECT guid, acct, race FROM characters WHERE name='" . $name . "' LIMIT 1");
        } else {
            $result = $sql["char"]->query("SELECT guid, id AS acct, race FROM characters WHERE name='" . $name . "' LIMIT 1");
        }
        $id_result = $sql["char"]->fetch_assoc($result);
        $id = $id_result["guid"];
    } else {
        $id = $sql["char"]->quote_smart($_GET["id"]);
    }
    if (!is_numeric($id)) {
        error(lang("global", "empty_fields"));
    }
    if ($core == 1) {
        $result = $sql["char"]->query("SELECT acct, race FROM characters WHERE guid='" . $id . "' LIMIT 1");
    } else {
        $result = $sql["char"]->query("SELECT account AS acct, race FROM characters WHERE guid='" . $id . "' LIMIT 1");
    }
    if ($sql["char"]->num_rows($result)) {
        //resrict by owner's gmlvl
        $owner_acc_id = $sql["char"]->result($result, 0, "acct");
        if ($core == 1) {
            $query = $sql["logon"]->query("SELECT login FROM accounts WHERE acct='" . $owner_acc_id . "'");
        } else {
            $query = $sql["logon"]->query("SELECT username as login FROM account WHERE id='" . $owner_acc_id . "'");
        }
        $owner_name = $sql["logon"]->result($query, 0, "login");
        $s_query = "SELECT *, SecurityLevel AS gm FROM config_accounts WHERE Login='******'";
        $s_result = $sql["mgr"]->query($s_query);
        $s_fields = $sql["mgr"]->fetch_assoc($s_result);
        $owner_gmlvl = $s_fields["gm"];
        $view_mod = $s_fields["View_Mod_Sheet"];
        if ($owner_gmlvl >= 1073741824) {
            $owner_gmlvl -= 1073741824;
        }
        // owner configured overrides
        $view_override = false;
        if ($view_mod > 0) {
            if ($view_mod == 1) {
            } elseif ($view_mod == 2) {
                // only registered users may view this page
                if ($user_lvl > -1) {
                    $view_override = true;
                }
            }
        }
        if ($user_lvl || $server[$realmid]["both_factions"]) {
            $side_v = 0;
            $side_p = 0;
        } else {
            $side_p = in_array($sql["char"]->result($result, 0, "race"), array(2, 5, 6, 8, 10)) ? 1 : 2;
            if ($core == 1) {
                $result_1 = $sql["char"]->query("SELECT race FROM characters WHERE acct='" . $user_id . "' LIMIT 1");
            } else {
                $result_1 = $sql["char"]->query("SELECT race FROM characters WHERE account='" . $user_id . "' LIMIT 1");
            }
            if ($sql["char"]->num_rows($result)) {
                $side_v = in_array($sql["char"]->result($result_1, 0, "race"), array(2, 5, 6, 8, 10)) ? 1 : 2;
            } else {
                $side_v = 0;
            }
            unset($result_1);
        }
        if ($view_override || $user_lvl >= gmlevel($owner_gmlvl) && ($side_v === $side_p || !$side_v)) {
            if ($core == 1) {
                $result = $sql["char"]->query("SELECT guid, name, race, class, level, zoneid, mapid, online, gender,\n          SUBSTRING_INDEX(SUBSTRING_INDEX(playedtime, ' ', 2), ' ', -1) AS totaltime,\n          acct, data, timestamp, xp \n          FROM characters WHERE guid='" . $id . "'");
            } elseif ($core == 2) {
                $result = $sql["char"]->query("SELECT guid, name, race, class, level, zone AS zoneid, map AS mapid, \n          online, gender, totaltime, account AS acct, logout_time AS timestamp, health, \n\t\t\t\t\tpower1, power2, power3, power4, power5, power6, power7, xp,\n          arenaPoints, totalHonorPoints, totalKills\n          FROM characters WHERE guid='" . $id . "'");
            } else {
                $result = $sql["char"]->query("SELECT guid, name, race, class, level, zone AS zoneid, map AS mapid, \n          online, gender, totaltime, account AS acct, logout_time AS timestamp, health, \n\t\t\t\t\tpower1, power2, power3, power4, power5, power6, power7, xp, arenaPoints, totalHonorPoints, totalKills\n          FROM characters WHERE guid='" . $id . "'");
            }
            $char = $sql["char"]->fetch_assoc($result);
            // find out what mode we're in View or Delete (0 = View, 1 = Delete)
            $mode = isset($_GET["mode"]) ? $_GET["mode"] : 0;
            // only the character's owner or a GM with Delete privs can enter Delete Mode
            if ($owner_name != $user_name) {
                if ($user_lvl < $action_permission["delete"]) {
                    $mode = 0;
                } else {
                    $mode = $mode;
                }
            }
            // View Mode is only availble on characters that are offline
            if ($char["online"] != 0) {
                $mode = 0;
            }
            if ($core == 1) {
                $char_data = $char["data"];
                if (empty($char_data)) {
                    $char_data = str_repeat("0;", PLAYER_END);
                }
                $char_data = explode(";", $char_data);
            } else {
                $query = "SELECT * FROM characters LEFT JOIN character_stats ON characters.guid=character_stats.guid WHERE characters.guid='" . $id . "'";
                $char_data_result = $sql["char"]->query($query);
                $char_data_fields = $sql["char"]->fetch_assoc($char_data_result);
                $char_data[PLAYER_BLOCK_PERCENTAGE] = isset($char_data_fields["blockPct"]) ? $char_data_fields["blockPct"] : '&nbsp;';
                $char_data[PLAYER_DODGE_PERCENTAGE] = isset($char_data_fields["dodgePct"]) ? $char_data_fields["dodgePct"] : '&nbsp;';
                $char_data[PLAYER_PARRY_PERCENTAGE] = isset($char_data_fields["parryPct"]) ? $char_data_fields["parryPct"] : '&nbsp;';
                $char_data[PLAYER_CRIT_PERCENTAGE] = isset($char_data_fields["critPct"]) ? $char_data_fields["critPct"] : '&nbsp;';
                $char_data[PLAYER_RANGED_CRIT_PERCENTAGE] = isset($char_data_fields["rangedCritPct"]) ? $char_data_fields["rangedCritPct"] : '&nbsp;';
                $char_data[UNIT_FIELD_MAXDAMAGE] = isset($char_data_fields["attackPower"]) ? $char_data_fields["attackPower"] : '&nbsp;';
                $char_data[UNIT_FIELD_MINDAMAGE] = isset($char_data_fields["attackPower"]) ? $char_data_fields["attackPower"] : '&nbsp;';
                $char_data[UNIT_FIELD_MAXRANGEDDAMAGE] = isset($char_data_fields["rangedAttackPower"]) ? $char_data_fields["rangedAttackPower"] : '&nbsp;';
                $char_data[UNIT_FIELD_MINRANGEDDAMAGE] = isset($char_data_fields["rangedAttackPower"]) ? $char_data_fields["rangedAttackPower"] : '&nbsp;';
                $char_data[PLAYER_SPELL_CRIT_PERCENTAGE1] = isset($char_data_fields["spellCritPct"]) ? $char_data_fields["spellCritPct"] : '&nbsp;';
                $char_data[PLAYER_FIELD_MOD_DAMAGE_DONE_POS] = isset($char_data_fields["spellPower"]) ? $char_data_fields["spellPower"] : '&nbsp;';
                $char_data[UNIT_FIELD_STAT0] = isset($char_data_fields["strength"]) ? $char_data_fields["strength"] : '&nbsp;';
                $char_data[UNIT_FIELD_STAT1] = isset($char_data_fields["agility"]) ? $char_data_fields["agility"] : '&nbsp;';
                $char_data[UNIT_FIELD_STAT2] = isset($char_data_fields["stamina"]) ? $char_data_fields["stamina"] : '&nbsp;';
                $char_data[UNIT_FIELD_STAT3] = isset($char_data_fields["intellect"]) ? $char_data_fields["intellect"] : '&nbsp;';
                $char_data[UNIT_FIELD_STAT4] = isset($char_data_fields["spirit"]) ? $char_data_fields["spirit"] : '&nbsp;';
                $char_data[UNIT_FIELD_RESISTANCES] = isset($char_data_fields["armor"]) ? $char_data_fields["armor"] : '&nbsp;';
                $char_data[UNIT_FIELD_RESISTANCES + 1] = isset($char_data_fields["resHoly"]) ? $char_data_fields["resHoly"] : '&nbsp;';
                $char_data[UNIT_FIELD_RESISTANCES + 2] = isset($char_data_fields["resArcane"]) ? $char_data_fields["resArcane"] : '&nbsp;';
                $char_data[UNIT_FIELD_RESISTANCES + 3] = isset($char_data_fields["resFire"]) ? $char_data_fields["resFire"] : '&nbsp;';
                $char_data[UNIT_FIELD_RESISTANCES + 4] = isset($char_data_fields["resNature"]) ? $char_data_fields["resNature"] : '&nbsp;';
                $char_data[UNIT_FIELD_RESISTANCES + 5] = isset($char_data_fields["resFrost"]) ? $char_data_fields["resFrost"] : '&nbsp;';
                $char_data[UNIT_FIELD_RESISTANCES + 6] = isset($char_data_fields["resShadow"]) ? $char_data_fields["resShadow"] : '&nbsp;';
                $char_data[UNIT_FIELD_HEALTH] = isset($char["health"]) ? $char["health"] : '&nbsp;';
                $char_data[UNIT_FIELD_MAXHEALTH] = isset($char_data_fields["maxhealth"]) ? $char_data_fields["maxhealth"] : '&nbsp;';
                $char_data[UNIT_FIELD_POWER1] = isset($char["power1"]) ? $char["power1"] : '&nbsp;';
                $char_data[UNIT_FIELD_POWER2] = isset($char["power2"]) ? $char["power2"] : '&nbsp;';
                $char_data[UNIT_FIELD_POWER3] = isset($char["power3"]) ? $char["power3"] : '&nbsp;';
                $char_data[UNIT_FIELD_POWER4] = isset($char["power4"]) ? $char["power4"] : '&nbsp;';
                $char_data[UNIT_FIELD_POWER5] = isset($char["power5"]) ? $char["power5"] : '&nbsp;';
                $char_data[UNIT_FIELD_POWER6] = isset($char["power6"]) ? $char["power6"] : '&nbsp;';
                $char_data[UNIT_FIELD_POWER7] = isset($char["power7"]) ? $char["power7"] : '&nbsp;';
                $char_data[UNIT_FIELD_MAXPOWER1] = isset($char_data_fields["maxpower1"]) ? $char_data_fields["maxpower1"] : '&nbsp;';
                $char_data[UNIT_FIELD_MAXPOWER2] = isset($char_data_fields["maxpower2"]) ? $char_data_fields["maxpower2"] : '&nbsp;';
                $char_data[UNIT_FIELD_MAXPOWER3] = isset($char_data_fields["maxpower3"]) ? $char_data_fields["maxpower3"] : '&nbsp;';
                $char_data[UNIT_FIELD_MAXPOWER4] = isset($char_data_fields["maxpower4"]) ? $char_data_fields["maxpower4"] : '&nbsp;';
                $char_data[UNIT_FIELD_MAXPOWER5] = isset($char_data_fields["maxpower5"]) ? $char_data_fields["maxpower5"] : '&nbsp;';
                $char_data[UNIT_FIELD_MAXPOWER6] = isset($char_data_fields["maxpower6"]) ? $char_data_fields["maxpower6"] : '&nbsp;';
                $char_data[UNIT_FIELD_MAXPOWER7] = isset($char_data_fields["maxpower7"]) ? $char_data_fields["maxpower7"] : '&nbsp;';
                $char_data[PLAYER_FIELD_MOD_HEALING_DONE_POS] = "ERR";
                $char_data[PLAYER_FIELD_COMBAT_RATING_1 + 5] = "ERR";
                $char_data[PLAYER_FIELD_COMBAT_RATING_1 + 17] = "ERR";
                $char_data[PLAYER_FIELD_COMBAT_RATING_1 + 6] = "ERR";
                $char_data[PLAYER_FIELD_COMBAT_RATING_1 + 7] = "ERR";
                $char_data[PLAYER_EXPERTISE] = "ERR";
                $char_data[PLAYER_OFFHAND_EXPERTISE] = "ERR";
                $char_data[PLAYER_FIELD_HONOR_CURRENCY] = isset($char["totalHonorPoints"]) ? $char["totalHonorPoints"] : '&nbsp;';
                $char_data[PLAYER_FIELD_ARENA_CURRENCY] = isset($char["arenaPoints"]) ? $char["arenaPoints"] : '&nbsp;';
                $char_data[PLAYER_FIELD_LIFETIME_HONORBALE_KILLS] = isset($char["totalKills"]) ? $char["totalKills"] : '&nbsp;';
            }
            if ($core == 1) {
                $guild_id = $sql["char"]->result($sql["char"]->query("SELECT guildid FROM guild_data WHERE playerid='" . $char["guid"] . "'"), 0);
                $guild_rank = $sql["char"]->result($sql["char"]->query("SELECT guildRank FROM guild_data WHERE playerid='" . $char["guid"] . "'"), 0);
                $guild_name = $sql["char"]->result($sql["char"]->query("SELECT guildName FROM guilds WHERE guildid='" . $guild_id . "'"));
            } else {
                $guild_id = $sql["char"]->result($sql["char"]->query("SELECT guildid FROM guild_member WHERE guid='" . $char["guid"] . "'"), 0);
                $guild_rank = $sql["char"]->result($sql["char"]->query("SELECT rank AS guildRank FROM guild_member WHERE guid='" . $char["guid"] . "'"), 0);
                $guild_name = $sql["char"]->result($sql["char"]->query("SELECT name AS guildName FROM guild WHERE guildid='" . $guild_id . "'"));
            }
            $online = $char["online"] ? lang("char", "online") : lang("char", "offline");
            if ($guild_id) {
                //$guild_name = $sql["char"]->result($sql["char"]->query('SELECT name FROM guild WHERE guildid ='.$char_data[CHAR_DATA_OFFSET_GUILD_ID].''), 0, 'name');
                $guild_name = '<a href="guild.php?action=view_guild&amp;realm=' . $realmid . '&amp;error=3&amp;id=' . $guild_id . '" >' . $guild_name . '</a>';
                $mrank = $guild_rank;
                if ($core == 1) {
                    $guild_rank = $sql["char"]->result($sql["char"]->query("SELECT rankname FROM guild_ranks WHERE guildid='" . $guild_id . "' AND rankId='" . $mrank . "'"), 0, "rankname");
                } else {
                    $guild_rank = $sql["char"]->result($sql["char"]->query("SELECT rname AS rankname FROM guild_rank WHERE guildid='" . $guild_id . "' AND rid='" . $mrank . "'"), 0, "rankname");
                }
            } else {
                $guild_name = lang("global", "none");
                $guild_rank = lang("global", "none");
            }
            if ($core == 1) {
                $block = unpack("f", pack("L", $char_data[PLAYER_BLOCK_PERCENTAGE]));
                $block = round($block[1], 2);
                $dodge = unpack("f", pack("L", $char_data[PLAYER_DODGE_PERCENTAGE]));
                $dodge = round($dodge[1], 2);
                $parry = unpack("f", pack("L", $char_data[PLAYER_PARRY_PERCENTAGE]));
                $parry = round($parry[1], 2);
                $crit = unpack("f", pack("L", $char_data[PLAYER_CRIT_PERCENTAGE]));
                $crit = round($crit[1], 2);
                $ranged_crit = unpack("f", pack("L", $char_data[PLAYER_RANGED_CRIT_PERCENTAGE]));
                $ranged_crit = round($ranged_crit[1], 2);
                $maxdamage = unpack("f", pack("L", $char_data[UNIT_FIELD_MAXDAMAGE]));
                $maxdamage = round($maxdamage[1], 0);
                $mindamage = unpack("f", pack("L", $char_data[UNIT_FIELD_MINDAMAGE]));
                $mindamage = round($mindamage[1], 0);
                $maxrangeddamage = unpack("f", pack("L", $char_data[UNIT_FIELD_MAXRANGEDDAMAGE]));
                $maxrangeddamage = round($maxrangeddamage[1], 0);
                $minrangeddamage = unpack("f", pack("L", $char_data[UNIT_FIELD_MINRANGEDDAMAGE]));
                $minrangeddamage = round($minrangeddamage[1], 0);
            } else {
                $block = $char_data[PLAYER_BLOCK_PERCENTAGE];
                $block = round($block, 2);
                $dodge = $char_data[PLAYER_DODGE_PERCENTAGE];
                $dodge = round($dodge, 2);
                $parry = $char_data[PLAYER_PARRY_PERCENTAGE];
                $parry = round($parry, 2);
                $crit = $char_data[PLAYER_CRIT_PERCENTAGE];
                $crit = round($crit, 2);
                $ranged_crit = $char_data[PLAYER_RANGED_CRIT_PERCENTAGE];
                $ranged_crit = round($ranged_crit, 2);
                $maxdamage = $char_data[UNIT_FIELD_MAXDAMAGE];
                $maxdamage = round($maxdamage, 0);
                $mindamage = $char_data[UNIT_FIELD_MINDAMAGE];
                $mindamage = round($mindamage, 0);
                $maxrangeddamage = $char_data[UNIT_FIELD_MAXRANGEDDAMAGE];
                $maxrangeddamage = round($maxrangeddamage, 0);
                $minrangeddamage = $char_data[UNIT_FIELD_MINRANGEDDAMAGE];
                $minrangeddamage = round($minrangeddamage, 0);
            }
            if ($core == 1) {
                $spell_crit = 100;
                for ($i = 0; $i < 6; ++$i) {
                    $temp = unpack("f", pack("L", $char_data[PLAYER_SPELL_CRIT_PERCENTAGE1 + 1 + $i]));
                    if ($temp[1] < $spell_crit) {
                        $spell_crit = $temp[1];
                    }
                }
                $spell_crit = round($spell_crit, 2);
            } else {
                $spell_crit = $char_data[PLAYER_SPELL_CRIT_PERCENTAGE1];
                $spell_crit = round($spell_crit, 2);
            }
            if ($core == 1) {
                $spell_damage = 9999;
                for ($i = 0; $i < 6; ++$i) {
                    if ($char_data[PLAYER_FIELD_MOD_DAMAGE_DONE_POS + 1 + $i] < $spell_damage) {
                        $spell_damage = $char_data[PLAYER_FIELD_MOD_DAMAGE_DONE_POS + 1 + $i];
                    }
                }
            } else {
                $spell_damage = $char_data[PLAYER_FIELD_MOD_DAMAGE_DONE_POS];
            }
            $spell_heal = $char_data[PLAYER_FIELD_MOD_HEALING_DONE_POS];
            // this_is_junk: PLAYER_FIELD_COMBAT_RATING_1 +5, +6, and +7 seem to have the same value as +5
            //               I'm not sure which of these fields is which hit rating. :/
            $spell_hit = $char_data[PLAYER_FIELD_COMBAT_RATING_1 + 5];
            // this_is_junk: PLAYER_FIELD_COMBAT_RATING_1 +18 and +19 seem to have the same value as +5
            //               I'm not sure which of these fields is really spell haste. :/
            $spell_haste = $char_data[PLAYER_FIELD_COMBAT_RATING_1 + 17];
            // this_is_junk: PLAYER_FIELD_COMBAT_RATING_1 +5, +6, and +7 seem to have the same value as +5
            //               I'm not sure which of these fields is which hit rating. :/
            $ranged_hit = $char_data[PLAYER_FIELD_COMBAT_RATING_1 + 6];
            // this_is_junk: PLAYER_FIELD_COMBAT_RATING_1 +5, +6, and +7 seem to have the same value as +5
            //               I'm not sure which of these fields is which hit rating. :/
            $melee_hit = $char_data[PLAYER_FIELD_COMBAT_RATING_1 + 7];
            $expertise = $char_data[PLAYER_EXPERTISE] . " / " . $char_data[PLAYER_OFFHAND_EXPERTISE];
            //if ( $core == 1 )
            //{
            /*$EQU_HEAD      = $char_data[PLAYER_FIELD_INV_SLOT_HEAD + 0];
              $EQU_NECK      = $char_data[PLAYER_FIELD_INV_SLOT_HEAD + 2];
              $EQU_SHOULDER  = $char_data[PLAYER_FIELD_INV_SLOT_HEAD + 4];
              $EQU_SHIRT     = $char_data[PLAYER_FIELD_INV_SLOT_HEAD + 6];
              $EQU_CHEST     = $char_data[PLAYER_FIELD_INV_SLOT_HEAD + 8];
              $EQU_BELT      = $char_data[PLAYER_FIELD_INV_SLOT_HEAD + 10];
              $EQU_LEGS      = $char_data[PLAYER_FIELD_INV_SLOT_HEAD + 12];
              $EQU_FEET      = $char_data[PLAYER_FIELD_INV_SLOT_HEAD + 14];
              $EQU_WRIST     = $char_data[PLAYER_FIELD_INV_SLOT_HEAD + 16];
              $EQU_GLOVES    = $char_data[PLAYER_FIELD_INV_SLOT_HEAD + 18];
              $EQU_FINGER1   = $char_data[PLAYER_FIELD_INV_SLOT_HEAD + 20];
              $EQU_FINGER2   = $char_data[PLAYER_FIELD_INV_SLOT_HEAD + 22];
              $EQU_TRINKET1  = $char_data[PLAYER_FIELD_INV_SLOT_HEAD + 24];
              $EQU_TRINKET2  = $char_data[PLAYER_FIELD_INV_SLOT_HEAD + 26];
              $EQU_BACK      = $char_data[PLAYER_FIELD_INV_SLOT_HEAD + 28];
              $EQU_MAIN_HAND = $char_data[PLAYER_FIELD_INV_SLOT_HEAD + 30];
              $EQU_OFF_HAND  = $char_data[PLAYER_FIELD_INV_SLOT_HEAD + 32];
              $EQU_RANGED    = $char_data[PLAYER_FIELD_INV_SLOT_HEAD + 34];
              $EQU_TABARD    = $char_data[PLAYER_FIELD_INV_SLOT_HEAD + 36];*/
            //}
            //else
            //{
            $world_db_name = $world_db[$realm_id]["name"];
            if ($core == 1) {
                $char_equip_query = "SELECT *, \n          playeritems.entry AS item_template, randomprop as property, enchantments AS enchantment, flags\n          FROM playeritems WHERE ownerguid='" . $id . "' AND containerslot=-1";
            } elseif ($core == 2) {
                $char_equip_query = "SELECT *,\n          SUBSTRING_INDEX(SUBSTRING_INDEX(item_instance.data, ' ', 11), ' ', -1) AS creator,\n          SUBSTRING_INDEX(SUBSTRING_INDEX(item_instance.data, ' ', 23), ' ', -1) AS enchantment,\n          SUBSTRING_INDEX(SUBSTRING_INDEX(item_instance.data, ' ', 60), ' ', -1) AS property,\n          SUBSTRING_INDEX(SUBSTRING_INDEX(item_instance.data, ' ', 62), ' ', -1) AS durability,\n          SUBSTRING_INDEX(SUBSTRING_INDEX(item_instance.data, ' ', 22), ' ', -1) AS flags\n          FROM character_inventory\n            LEFT JOIN item_instance ON character_inventory.item=item_instance.guid\n          WHERE character_inventory.guid='" . $id . "' AND character_inventory.bag=0";
            } else {
                $char_equip_query = "SELECT *,\n          creatorGuid AS creator, enchantments AS enchantment,\n          randomPropertyId AS property, durability, flags,\n          itemEntry AS item_template\n          FROM character_inventory\n            LEFT JOIN item_instance ON character_inventory.item=item_instance.guid\n          WHERE character_inventory.guid='" . $id . "' AND character_inventory.bag=0";
            }
            $char_equip_result = $sql["char"]->query($char_equip_query);
            while ($equip_row = $sql["char"]->fetch_assoc($char_equip_result)) {
                switch ($equip_row["slot"]) {
                    case 0:
                        $EQU_HEAD = $equip_row["item_template"];
                        $EQU_HEAD_ROW = $equip_row;
                        break;
                    case 1:
                        $EQU_NECK = $equip_row["item_template"];
                        $EQU_NECK_ROW = $equip_row;
                        break;
                    case 2:
                        $EQU_SHOULDER = $equip_row["item_template"];
                        $EQU_SHOULDER_ROW = $equip_row;
                        break;
                    case 3:
                        $EQU_SHIRT = $equip_row["item_template"];
                        $EQU_SHIRT_ROW = $equip_row;
                        break;
                    case 4:
                        $EQU_CHEST = $equip_row["item_template"];
                        $EQU_CHEST_ROW = $equip_row;
                        break;
                    case 5:
                        $EQU_BELT = $equip_row["item_template"];
                        $EQU_BELT_ROW = $equip_row;
                        break;
                    case 6:
                        $EQU_LEGS = $equip_row["item_template"];
                        $EQU_LEGS_ROW = $equip_row;
                        break;
                    case 7:
                        $EQU_FEET = $equip_row["item_template"];
                        $EQU_FEET_ROW = $equip_row;
                        break;
                    case 8:
                        $EQU_WRIST = $equip_row["item_template"];
                        $EQU_WRIST_ROW = $equip_row;
                        break;
                    case 9:
                        $EQU_GLOVES = $equip_row["item_template"];
                        $EQU_GLOVES_ROW = $equip_row;
                        break;
                    case 10:
                        $EQU_FINGER1 = $equip_row["item_template"];
                        $EQU_FINGER1_ROW = $equip_row;
                        break;
                    case 11:
                        $EQU_FINGER2 = $equip_row["item_template"];
                        $EQU_FINGER2_ROW = $equip_row;
                        break;
                    case 12:
                        $EQU_TRINKET1 = $equip_row["item_template"];
                        $EQU_TRINKET1_ROW = $equip_row;
                        break;
                    case 13:
                        $EQU_TRINKET2 = $equip_row["item_template"];
                        $EQU_TRINKET2_ROW = $equip_row;
                        break;
                    case 14:
                        $EQU_BACK = $equip_row["item_template"];
                        $EQU_BACK_ROW = $equip_row;
                        break;
                    case 15:
                        $EQU_MAIN_HAND = $equip_row["item_template"];
                        $EQU_MAIN_HAND_ROW = $equip_row;
                        break;
                    case 16:
                        $EQU_OFF_HAND = $equip_row["item_template"];
                        $EQU_OFF_HAND_ROW = $equip_row;
                        break;
                    case 17:
                        $EQU_RANGED = $equip_row["item_template"];
                        $EQU_RANGED_ROW = $equip_row;
                        break;
                    case 18:
                        $EQU_TABARD = $equip_row["item_template"];
                        $EQU_TABARD_ROW = $equip_row;
                        break;
                }
            }
            //}
            $equiped_items = array(1 => array("", $EQU_HEAD ? get_item_icon($EQU_HEAD) : 0, $EQU_HEAD ? get_item_border($EQU_HEAD) : 0, $EQU_HEAD_ROW), 2 => array("", $EQU_NECK ? get_item_icon($EQU_NECK) : 0, $EQU_NECK ? get_item_border($EQU_NECK) : 0, $EQU_NECK_ROW), 3 => array("", $EQU_SHOULDER ? get_item_icon($EQU_SHOULDER) : 0, $EQU_SHOULDER ? get_item_border($EQU_SHOULDER) : 0, $EQU_SHOULDER_ROW), 4 => array("", $EQU_SHIRT ? get_item_icon($EQU_SHIRT) : 0, $EQU_SHIRT ? get_item_border($EQU_SHIRT) : 0, $EQU_SHIRT_ROW), 5 => array("", $EQU_CHEST ? get_item_icon($EQU_CHEST) : 0, $EQU_CHEST ? get_item_border($EQU_CHEST) : 0, $EQU_CHEST_ROW), 6 => array("", $EQU_BELT ? get_item_icon($EQU_BELT) : 0, $EQU_BELT ? get_item_border($EQU_BELT) : 0, $EQU_BELT_ROW), 7 => array("", $EQU_LEGS ? get_item_icon($EQU_LEGS) : 0, $EQU_LEGS ? get_item_border($EQU_LEGS) : 0, $EQU_LEGS_ROW), 8 => array("", $EQU_FEET ? get_item_icon($EQU_FEET) : 0, $EQU_FEET ? get_item_border($EQU_FEET) : 0, $EQU_FEET_ROW), 9 => array("", $EQU_WRIST ? get_item_icon($EQU_WRIST) : 0, $EQU_WRIST ? get_item_border($EQU_WRIST) : 0, $EQU_WRIST_ROW), 10 => array("", $EQU_GLOVES ? get_item_icon($EQU_GLOVES) : 0, $EQU_GLOVES ? get_item_border($EQU_GLOVES) : 0, $EQU_GLOVES_ROW), 11 => array("", $EQU_FINGER1 ? get_item_icon($EQU_FINGER1) : 0, $EQU_FINGER1 ? get_item_border($EQU_FINGER1) : 0, $EQU_FINGER1_ROW), 12 => array("", $EQU_FINGER2 ? get_item_icon($EQU_FINGER2) : 0, $EQU_FINGER2 ? get_item_border($EQU_FINGER2) : 0, $EQU_FINGER2_ROW), 13 => array("", $EQU_TRINKET1 ? get_item_icon($EQU_TRINKET1) : 0, $EQU_TRINKET1 ? get_item_border($EQU_TRINKET1) : 0, $EQU_TRINKET1_ROW), 14 => array("", $EQU_TRINKET2 ? get_item_icon($EQU_TRINKET2) : 0, $EQU_TRINKET2 ? get_item_border($EQU_TRINKET2) : 0, $EQU_TRINKET2_ROW), 15 => array("", $EQU_BACK ? get_item_icon($EQU_BACK) : 0, $EQU_BACK ? get_item_border($EQU_BACK) : 0, $EQU_BACK_ROW), 16 => array("", $EQU_MAIN_HAND ? get_item_icon($EQU_MAIN_HAND) : 0, $EQU_MAIN_HAND ? get_item_border($EQU_MAIN_HAND) : 0, $EQU_MAIN_HAND_ROW), 17 => array("", $EQU_OFF_HAND ? get_item_icon($EQU_OFF_HAND) : 0, $EQU_OFF_HAND ? get_item_border($EQU_OFF_HAND) : 0, $EQU_OFF_HAND_ROW), 18 => array("", $EQU_RANGED ? get_item_icon($EQU_RANGED) : 0, $EQU_RANGED ? get_item_border($EQU_RANGED) : 0, $EQU_RANGED_ROW), 19 => array("", $EQU_TABARD ? get_item_icon($EQU_TABARD) : 0, $EQU_TABARD ? get_item_border($EQU_TABARD) : 0, $EQU_TABARD_ROW));
            // visibility overrides for specific tabs
            $view_inv_override = false;
            if ($s_fields["View_Mod_Inv"] > 0) {
                if ($s_fields["View_Mod_Inv"] == 1) {
                } elseif ($s_fields["View_Mod_Inv"] == 2) {
                    // only registered users may view this tab
                    if ($user_lvl > -1) {
                        $view_inv_override = true;
                    }
                }
            } else {
                if ($user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                    $view_inv_override = true;
                }
            }
            $view_talent_override = false;
            if ($s_fields["View_Mod_Talent"] > 0) {
                if ($s_fields["View_Mod_Talent"] == 1) {
                } elseif ($s_fields["View_Mod_Talent"] == 2) {
                    // only registered users may view this tab
                    if ($user_lvl > -1) {
                        $view_talent_override = true;
                    }
                }
            } else {
                if ($user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                    $view_talent_override = true;
                }
            }
            $view_achieve_override = false;
            if ($s_fields["View_Mod_Achieve"] > 0) {
                if ($s_fields["View_Mod_Achieve"] == 1) {
                } elseif ($s_fields["View_Mod_Achieve"] == 2) {
                    // only registered users may view this tab
                    if ($user_lvl > -1) {
                        $view_achieve_override = true;
                    }
                }
            } else {
                if ($user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                    $view_achieve_override = true;
                }
            }
            $view_quest_override = false;
            if ($s_fields["View_Mod_Quest"] > 0) {
                if ($s_fields["View_Mod_Quest"] == 1) {
                } elseif ($s_fields["View_Mod_Quest"] == 2) {
                    // only registered users may view this tab
                    if ($user_lvl > -1) {
                        $view_quest_override = true;
                    }
                }
            } else {
                if ($user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                    $view_quest_override = true;
                }
            }
            $view_friends_override = false;
            if ($s_fields["View_Mod_Friends"] > 0) {
                if ($s_fields["View_Mod_Friends"] == 1) {
                } elseif ($s_fields["View_Mod_Friends"] == 2) {
                    // only registered users may view this tab
                    if ($user_lvl > -1) {
                        $view_friends_override = true;
                    }
                }
            } else {
                if ($user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                    $view_friends_override = true;
                }
            }
            $view_view_override = false;
            if ($s_fields["View_Mod_View"] > 0) {
                if ($s_fields["View_Mod_View"] == 1) {
                } elseif ($s_fields["View_Mod_View"] == 2) {
                    // only registered users may view this tab
                    if ($user_lvl > -1) {
                        $view_view_override = true;
                    }
                }
            } else {
                if ($user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                    $view_view_override = true;
                }
            }
            $view_pets_override = false;
            if ($s_fields["View_Mod_Pets"] > 0) {
                if ($s_fields["View_Mod_Pets"] == 1) {
                } elseif ($s_fields["View_Mod_Pets"] == 2) {
                    // only registered users may view this tab
                    if ($user_lvl > -1) {
                        $view_pets_override = true;
                    }
                }
            } else {
                if ($user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                    $view_pets_override = true;
                }
            }
            $view_rep_override = false;
            if ($s_fields["View_Mod_Rep"] > 0) {
                if ($s_fields["View_Mod_Rep"] == 1) {
                } elseif ($s_fields["View_Mod_Rep"] == 2) {
                    // only registered users may view this tab
                    if ($user_lvl > -1) {
                        $view_rep_override = true;
                    }
                }
            } else {
                if ($user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                    $view_rep_override = true;
                }
            }
            $view_skill_override = false;
            if ($s_fields["View_Mod_Skill"] > 0) {
                if ($s_fields["View_Mod_Skill"] == 1) {
                } elseif ($s_fields["View_Mod_Skill"] == 2) {
                    // only registered users may view this tab
                    if ($user_lvl > -1) {
                        $view_skill_override = true;
                    }
                }
            } else {
                if ($user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                    $view_skill_override = true;
                }
            }
            $view_pvp_override = false;
            if ($s_fields["View_Mod_PvP"] > 0) {
                if ($s_fields["View_Mod_PvP"] == 1) {
                } elseif ($s_fields["View_Mod_PvP"] == 2) {
                    // only registered users may view this tab
                    if ($user_lvl > -1) {
                        $view_pvp_override = true;
                    }
                }
            } else {
                if ($user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                    $view_pvp_override = true;
                }
            }
            $output .= '
          <!-- start of char.php -->
          <div class="tab">
            <ul>
              <li class="selected"><a href="char.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "char_sheet") . '</a></li>';
            if ($view_inv_override) {
                $output .= '
              <li><a href="char_inv.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "inventory") . '</a></li>';
            }
            if ($view_talent_override) {
                $output .= '
              ' . ($char["level"] < 10 ? '' : '<li><a href="char_talent.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "talents") . '</a></li>') . '';
            }
            if ($view_achieve_override) {
                $output .= '
              <li><a href="char_achieve.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "achievements") . '</a></li>';
            }
            if ($view_quest_override) {
                $output .= '
              <li><a href="char_quest.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "quests") . '</a></li>';
            }
            if ($view_friends_override) {
                $output .= '
              <li><a href="char_friends.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "friends") . '</a></li>';
            }
            if ($view_view_override) {
                $output .= '
              <li><a href="char_view.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "view") . '</a></li>';
            }
            $output .= '
            </ul>
          </div>';
            if ($view_override || $user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                $output .= '
          <div class="tab_content center">
            <div class="tab">
              <ul>
                <li class="selected"><a href="char.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "char_sheet") . '</a></li>';
                if (char_get_class_name($char["class"]) === "Hunter" && $view_pets_override) {
                    $output .= '
                <li><a href="char_pets.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "pets") . '</a></li>';
                }
                if ($view_rep_override) {
                    $output .= '
                <li><a href="char_rep.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "reputation") . '</a></li>';
                }
                if ($view_skill_override) {
                    $output .= '
                <li><a href="char_skill.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "skills") . '</a></li>';
                }
                if ($view_pvp_override) {
                    $output .= '
                <li><a href="char_pvp.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "pvp") . '</a></li>';
                }
                if ($owner_name == $user_name || $user_lvl >= get_page_permission("insert", "char_mail.php")) {
                    $output .= '
                <li><a href="char_mail.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "mail") . '</a></li>';
                }
                $output .= '
              </ul>
            </div>';
            } else {
                $output .= '
            <div class="tab_content center">
              <div class="tab">
              </div>';
            }
            $output .= '
              <div class="tab_content2 center">
                <table class="lined" id="char_character_sheet">
                  <tr>
                    <td colspan="2">
                      <div>
                        <img src="' . char_get_avatar_img($char["level"], $char["gender"], $char["race"], $char["class"], 0) . '" alt="avatar" />
                      </div>
                      <div>';
            // this_is_junk: auras are stored in a string in the characters table.
            // not sure how to query a string as though it were a record
            if ($core == 1) {
            } else {
                $a_results = $sql["char"]->query("SELECT DISTINCT spell FROM character_aura WHERE guid='" . $id . "'");
            }
            if ($sql["char"]->num_rows($a_results)) {
                while ($aura = $sql["char"]->fetch_assoc($a_results)) {
                    $output .= '
                        <a class="char_icon_padding" href="' . $base_datasite . $spell_datasite . $aura["spell"] . '" rel="external">
                          <img src="' . spell_get_icon($aura["spell"]) . '" alt="' . $aura["spell"] . '" width="24" height="24" />
                        </a>';
                }
            }
            $output .= '
                      </div>
                    </td>
                    <td colspan="4">
                      <span class="bold">
                        ' . htmlentities($char["name"], ENT_COMPAT, $site_encoding) . ' -
                        <img src="img/c_icons/' . $char["race"] . '-' . $char["gender"] . '.gif" onmousemove="oldtoolTip(\'' . char_get_race_name($char["race"]) . '\', \'old_item_tooltip\')" onmouseout="oldtoolTip()" alt="" />
                        <img src="img/c_icons/' . $char["class"] . '.gif" onmousemove="oldtoolTip(\'' . char_get_class_name($char["class"]) . '\', \'old_item_tooltip\')" onmouseout="oldtoolTip()" alt="" />
                       - ' . lang("char", "level_short") . char_get_level_color($char["level"]) . '
                      </span>
                      <br />' . lang("char", "location") . ': ' . get_map_name($char["mapid"]) . ' - ' . get_zone_name($char["zoneid"]) . '
                      <br />' . lang("char", "honor_points") . ': ' . $char_data[PLAYER_FIELD_HONOR_CURRENCY] . ' | ' . lang("char", "arena_points") . ': ' . $char_data[PLAYER_FIELD_ARENA_CURRENCY] . ' | ' . lang("char", "honor_kills") . ': ' . $char_data[PLAYER_FIELD_LIFETIME_HONORBALE_KILLS] . '
                      <br />' . lang("char", "guild") . ': ' . $guild_name . ' | ' . lang("char", "rank") . ': ' . htmlentities($guild_rank, ENT_COMPAT, $site_encoding) . '
                      <br />' . lang("char", "online") . ': ' . ($char["online"] ? '<img src="img/up.gif" onmousemove="oldtoolTip(\'' . lang("char", "online") . '\', \'old_item_tooltip\')" onmouseout="oldtoolTip()" alt="online" />' : '<img src="img/down.gif" onmousemove="oldtoolTip(\'' . lang("char", "offline") . '\', \'old_item_tooltip\')" onmouseout="oldtoolTip()" alt="offline" />');
            if ($showcountryflag) {
                require_once 'libs/misc_lib.php';
                $country = misc_get_country_by_account($char["acct"]);
                $output .= ' | ' . lang("global", "country") . ': ' . ($country["code"] ? '<img src="img/flags/' . $country["code"] . '.png" onmousemove="oldtoolTip(\'' . $country["country"] . '\', \'old_item_tooltip\')" onmouseout="oldtoolTip()" alt="" />' : '-');
                unset($country);
            }
            $output .= '
                    </td>
                  </tr>
                  <tr>
                    <td style="width: 6%;">';
            if ($equiped_items[1][1]) {
                $output .= '
                      <a class="char_icon_padding" href="' . $base_datasite . $item_datasite . $EQU_HEAD . '" rel="external" onmouseover="ShowTooltip(this,\'_b' . 'HEAD' . '\');" onmouseout="HideTooltip(\'_b' . 'HEAD' . '\');">
                        <img src="' . $equiped_items[1][1] . '" class="' . $equiped_items[1][2] . '" alt="Head" />
                      </a>';
                if ($mode) {
                    $output .= '
                      <div style="position: relative;">
                        <a href="char.php?action=delete_item&id=' . $id . '&bag=' . $equiped_items[1][3]["bag"] . '&slot=' . $equiped_items[1][3]["slot"] . '&item=' . $equiped_items[1][3]["item_template"] . '&mode=' . $mode . '" id="ch_item_delete">
                          <img src="img/aff_cross.png" />
                        </a>
                      </div>';
                }
                // build a tooltip object for this item
                $i_fields = get_item_info($equiped_items[1][3]["item_template"]);
                $output .= '
                      <div class="item_tooltip" id="tooltip_b' . 'HEAD' . '">
                        <table>
                          <tr>
                            <td>
                              ' . get_item_tooltip($i_fields, $equiped_items[1][3]["enchantment"], $equiped_items[1][3]["property"], $equiped_items[1][3]["creator"], $equiped_items[1][3]["durability"], $equiped_items[1][3]["flags"]) . '
                            </td>
                          </tr>
                        </table>
                      </div>';
            } else {
                $output .= '
                      <img src="img/INV/INV_empty_head.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                    </td>
                    <td class="half_line" colspan="2" align="center" style="width: 50%;">
                      <div class="gradient_p" id="char_hp_name">' . lang("item", "health") . ':</div>
                      <div class="gradient_pp" id="char_hp_value">' . $char_data[UNIT_FIELD_HEALTH] . '/' . $char_data[UNIT_FIELD_MAXHEALTH] . '</div>';
            if ($char["class"] == 11) {
                //druid
                $output .= '
                      <br />
                      <div class="gradient_p" id="char_energy_name">' . lang("item", "mana") . ':</div>
                      <div class="gradient_pp" id="char_energy_value">' . $char_data[UNIT_FIELD_POWER1] . '/' . $char_data[UNIT_FIELD_MAXPOWER1] . '</div>';
            }
            $output .= '
                    </td>
                    <td class="half_line" colspan="2" align="center" style="width: 50%;">';
            if ($char["class"] == 1) {
                $output .= '
                      <div class="gradient_p" id="char_energy_name">' . lang("item", "rage") . ':</div>
                      <div class="gradient_pp" id="char_energy_value">' . $char_data[UNIT_FIELD_POWER2] / 10 . '/' . $char_data[UNIT_FIELD_MAXPOWER2] / 10 . '</div>';
            } elseif ($char["class"] == 4) {
                $output .= '
                      <div class="gradient_p" id="char_energy_name">' . lang("item", "energy") . ':</div>
                      <div class="gradient_pp" id="char_energy_value">' . $char_data[UNIT_FIELD_POWER4] . '/' . $char_data[UNIT_FIELD_MAXPOWER4] . '</div>';
            } elseif ($char["class"] == 6) {
                $output .= '
                      <div class="gradient_p" id="char_energy_name">' . lang("item", "runic") . ':</div>
                      <div class="gradient_pp" id="char_energy_value">' . $char_data[UNIT_FIELD_POWER7] / 10 . '/' . $char_data[UNIT_FIELD_MAXPOWER7] / 10 . '</div>';
            } elseif ($char["class"] == 11) {
                $output .= '
                      <div class="gradient_p" id="char_energy_name">' . lang("item", "mana") . ':</div>
                      <div class="gradient_pp" id="char_energy_value">' . $char_data[UNIT_FIELD_POWER1] . '/' . $char_data[UNIT_FIELD_MAXPOWER1] . '</div>
                      <br />
                      <div class="gradient_p" id="char_energy_name">' . lang("item", "rage") . ':</div>
                      <div class="gradient_pp" id="char_energy_value">' . $char_data[UNIT_FIELD_POWER2] / 10 . '/' . $char_data[UNIT_FIELD_MAXPOWER2] / 10 . '</div>';
            } elseif ($char["class"] == 2 || $char["class"] == 3 || $char["class"] == 5 || $char["class"] == 7 || $char["class"] == 8 || $char["class"] == 9) {
                $output .= '
                      <div class="gradient_p" id="char_energy_name">' . lang("item", "mana") . ':</div>
                      <div class="gradient_pp" id="char_energy_value">' . $char_data[UNIT_FIELD_POWER1] . '/' . $char_data[UNIT_FIELD_MAXPOWER1] . '</div>';
            }
            $output .= '
                    </td>
                    <td style="width: 6%;">';
            if ($equiped_items[10][1]) {
                $output .= '
                      <a class="char_icon_padding" href="' . $base_datasite . $item_datasite . $EQU_GLOVES . '" rel="external" onmouseover="ShowTooltip(this,\'_b' . 'GLOVES' . '\');" onmouseout="HideTooltip(\'_b' . 'GLOVES' . '\');">
                        <img src="' . $equiped_items[10][1] . '" class="' . $equiped_items[10][2] . '" alt="Gloves" />
                      </a>';
                if ($mode) {
                    $output .= '
                      <div style="position: relative;">
                        <a href="char.php?action=delete_item&id=' . $id . '&bag=' . $equiped_items[10][3]["bag"] . '&slot=' . $equiped_items[10][3]["slot"] . '&item=' . $equiped_items[10][3]["item_template"] . '&mode=' . $mode . '" id="ch_item_delete">
                          <img src="img/aff_cross.png" />
                        </a>
                      </div>';
                }
                // build a tooltip object for this item
                $i_fields = get_item_info($equiped_items[10][3]["item_template"]);
                $output .= '
                      <div class="item_tooltip" id="tooltip_b' . 'GLOVES' . '">
                        <table>
                          <tr>
                            <td>
                              ' . get_item_tooltip($i_fields, $equiped_items[10][3]["enchantment"], $equiped_items[10][3]["property"], $equiped_items[10][3]["creator"], $equiped_items[10][3]["durability"], $equiped_items[10][3]["flags"]) . '
                            </td>
                          </tr>
                        </table>
                      </div>';
            } else {
                $output .= '
                      <img src="img/INV/INV_empty_gloves.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                    </td>
                  </tr>
                  <tr>
                    <td style="width: 1%;">';
            if ($equiped_items[2][1]) {
                $output .= '
                      <a class="char_icon_padding" href="' . $base_datasite . $item_datasite . $EQU_NECK . '" rel="external" onmouseover="ShowTooltip(this,\'_b' . 'NECK' . '\');" onmouseout="HideTooltip(\'_b' . 'NECK' . '\');">
                        <img src="' . $equiped_items[2][1] . '" class="' . $equiped_items[2][2] . '" alt="Neck" />
                      </a>';
                if ($mode) {
                    $output .= '
                      <div style="position: relative;">
                        <a href="char.php?action=delete_item&id=' . $id . '&bag=' . $equiped_items[2][3]["bag"] . '&slot=' . $equiped_items[2][3]["slot"] . '&item=' . $equiped_items[2][3]["item_template"] . '&mode=' . $mode . '" id="ch_item_delete">
                          <img src="img/aff_cross.png" />
                        </a>
                      </div>';
                }
                // build a tooltip object for this item
                $i_fields = get_item_info($equiped_items[2][3]['item_template']);
                $output .= '
                      <div class="item_tooltip" id="tooltip_b' . 'NECK' . '">
                        <table>
                          <tr>
                            <td>
                              ' . get_item_tooltip($i_fields, $equiped_items[2][3]['enchantment'], $equiped_items[2][3]['property'], $equiped_items[2][3]['creator'], $equiped_items[2][3]['durability'], $equiped_items[2][3]['flags']) . '
                            </td>
                          </tr>
                        </table>
                      </div>';
            } else {
                $output .= '
                      <img src="img/INV/INV_empty_neck.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                    </td>
                    <td class="half_line" colspan="2" rowspan="3" align="center" style="width: 50%;">
                      <div class="gradient_p">
                        ' . lang("item", "strength") . ':<br />
                        ' . lang("item", "agility") . ':<br />
                        ' . lang("item", "stamina") . ':<br />
                        ' . lang("item", "intellect") . ':<br />
                        ' . lang("item", "spirit") . ':<br />
                        ' . lang("item", "armor") . ':
                      </div>
                      <div class="gradient_pp">
                        ' . $char_data[UNIT_FIELD_STAT0] . '<br />
                        ' . $char_data[UNIT_FIELD_STAT1] . '<br />
                        ' . $char_data[UNIT_FIELD_STAT2] . '<br />
                        ' . $char_data[UNIT_FIELD_STAT3] . '<br />
                        ' . $char_data[UNIT_FIELD_STAT4] . '<br />
                        ' . $char_data[UNIT_FIELD_RESISTANCES] . '
                      </div>
                    </td>
                    <td class="half_line" colspan="2" rowspan="3" align="center" style="width: 50%;">
                      <div class="gradient_p">
                        ' . lang("item", "res_holy") . ':<br />
                        ' . lang("item", "res_arcane") . ':<br />
                        ' . lang("item", "res_fire") . ':<br />
                        ' . lang("item", "res_nature") . ':<br />
                        ' . lang("item", "res_frost") . ':<br />
                        ' . lang("item", "res_shadow") . ':
                      </div>
                      <div class="gradient_pp">
                        ' . $char_data[UNIT_FIELD_RESISTANCES + 1] . '<br />
                        ' . $char_data[UNIT_FIELD_RESISTANCES + 2] . '<br />
                        ' . $char_data[UNIT_FIELD_RESISTANCES + 3] . '<br />
                        ' . $char_data[UNIT_FIELD_RESISTANCES + 4] . '<br />
                        ' . $char_data[UNIT_FIELD_RESISTANCES + 5] . '<br />
                        ' . $char_data[UNIT_FIELD_RESISTANCES + 6] . '
                      </div>
                    </td>
                    <td style="width: 1%;">';
            if ($equiped_items[6][1]) {
                $output .= '
                      <a class="char_icon_padding" href="' . $base_datasite . $item_datasite . $EQU_BELT . '" rel="external" onmouseover="ShowTooltip(this,\'_b' . 'BELT' . '\');" onmouseout="HideTooltip(\'_b' . 'BELT' . '\');">
                        <img src="' . $equiped_items[6][1] . '" class="' . $equiped_items[6][2] . '" alt="Belt" />
                      </a>';
                if ($mode) {
                    $output .= '
                      <div style="position: relative;">
                        <a href="char.php?action=delete_item&id=' . $id . '&bag=' . $equiped_items[6][3]["bag"] . '&slot=' . $equiped_items[6][3]["slot"] . '&item=' . $equiped_items[6][3]["item_template"] . '&mode=' . $mode . '" id="ch_item_delete">
                          <img src="img/aff_cross.png" />
                        </a>
                      </div>';
                }
                // build a tooltip object for this item
                $i_fields = get_item_info($equiped_items[6][3]['item_template']);
                $output .= '
                      <div class="item_tooltip" id="tooltip_b' . 'BELT' . '">
                        <table>
                          <tr>
                            <td>
                              ' . get_item_tooltip($i_fields, $equiped_items[6][3]['enchantment'], $equiped_items[6][3]['property'], $equiped_items[6][3]['creator'], $equiped_items[6][3]['durability'], $equiped_items[6][3]['flags']) . '
                            </td>
                          </tr>
                        </table>
                      </div>';
            } else {
                $output .= '
                      <img src="img/INV/INV_empty_waist.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                    </td>
                  </tr>
                  <tr>
                    <td style="width: 1%;">';
            if ($equiped_items[3][1]) {
                $output .= '
                      <a class="char_icon_padding" href="' . $base_datasite . $item_datasite . $EQU_SHOULDER . '" rel="external" onmouseover="ShowTooltip(this,\'_b' . 'SHOULDER' . '\');" onmouseout="HideTooltip(\'_b' . 'SHOULDER' . '\');">
                        <img src="' . $equiped_items[3][1] . '" class="' . $equiped_items[3][2] . '" alt="Shoulder" />
                      </a>';
                if ($mode) {
                    $output .= '
                      <div style="position: relative;">
                        <a href="char.php?action=delete_item&id=' . $id . '&bag=' . $equiped_items[3][3]["bag"] . '&slot=' . $equiped_items[3][3]["slot"] . '&item=' . $equiped_items[3][3]["item_template"] . '&mode=' . $mode . '" id="ch_item_delete">
                          <img src="img/aff_cross.png" />
                        </a>
                      </div>';
                }
                // build a tooltip object for this item
                $i_fields = get_item_info($equiped_items[3][3]['item_template']);
                $output .= '
                      <div class="item_tooltip" id="tooltip_b' . 'SHOULDER' . '">
                        <table>
                          <tr>
                            <td>
                              ' . get_item_tooltip($i_fields, $equiped_items[3][3]['enchantment'], $equiped_items[3][3]['property'], $equiped_items[3][3]['creator'], $equiped_items[3][3]['durability'], $equiped_items[3][3]['flags']) . '
                            </td>
                          </tr>
                        </table>
                      </div>';
            } else {
                $output .= '
                      <img src="img/INV/INV_empty_shoulder.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                    </td>
                    <td style="width: 1%;">';
            if ($equiped_items[7][1]) {
                $output .= '
                      <a class="char_icon_padding" href="' . $base_datasite . $item_datasite . $EQU_LEGS . '" rel="external" onmouseover="ShowTooltip(this,\'_b' . 'LEGS' . '\');" onmouseout="HideTooltip(\'_b' . 'LEGS' . '\');">
                        <img src="' . $equiped_items[7][1] . '" class="' . $equiped_items[7][2] . '" alt="Legs" />
                      </a>';
                if ($mode) {
                    $output .= '
                      <div style="position: relative;">
                        <a href="char.php?action=delete_item&id=' . $id . '&bag=' . $equiped_items[7][3]["bag"] . '&slot=' . $equiped_items[7][3]["slot"] . '&item=' . $equiped_items[7][3]["item_template"] . '&mode=' . $mode . '" id="ch_item_delete">
                          <img src="img/aff_cross.png" />
                        </a>
                      </div>';
                }
                // build a tooltip object for this item
                $i_fields = get_item_info($equiped_items[7][3]['item_template']);
                $output .= '
                      <div class="item_tooltip" id="tooltip_b' . 'LEGS' . '">
                        <table>
                          <tr>
                            <td>
                              ' . get_item_tooltip($i_fields, $equiped_items[7][3]['enchantment'], $equiped_items[7][3]['property'], $equiped_items[7][3]['creator'], $equiped_items[7][3]['durability'], $equiped_items[7][3]['flags']) . '
                            </td>
                          </tr>
                        </table>
                      </div>';
            } else {
                $output .= '
                      <img src="img/INV/INV_empty_legs.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                    </td>
                  </tr>
                  <tr>
                    <td style="width: 1%;">';
            if ($equiped_items[15][1]) {
                $output .= '
                      <a class="char_icon_padding" href="' . $base_datasite . $item_datasite . $EQU_BACK . '" rel="external" onmouseover="ShowTooltip(this,\'_b' . 'BACK' . '\');" onmouseout="HideTooltip(\'_b' . 'BACK' . '\');">
                        <img src="' . $equiped_items[15][1] . '" class="' . $equiped_items[15][2] . '" alt="Back" />
                      </a>';
                if ($mode) {
                    $output .= '
                      <div style="position: relative;">
                        <a href="char.php?action=delete_item&id=' . $id . '&bag=' . $equiped_items[15][3]["bag"] . '&slot=' . $equiped_items[15][3]["slot"] . '&item=' . $equiped_items[15][3]["item_template"] . '&mode=' . $mode . '" id="ch_item_delete">
                          <img src="img/aff_cross.png" />
                        </a>
                      </div>';
                }
                // build a tooltip object for this item
                $i_fields = get_item_info($equiped_items[15][3]['item_template']);
                $output .= '
                      <div class="item_tooltip" id="tooltip_b' . 'BACK' . '">
                        <table>
                          <tr>
                            <td>
                              ' . get_item_tooltip($i_fields, $equiped_items[15][3]['enchantment'], $equiped_items[15][3]['property'], $equiped_items[15][3]['creator'], $equiped_items[15][3]['durability'], $equiped_items[15][3]['flags']) . '
                            </td>
                          </tr>
                        </table>
                      </div>';
            } else {
                $output .= '
                      <img src="img/INV/INV_empty_chest_back.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                    </td>
                    <td style="width: 1%;">';
            if ($equiped_items[8][1]) {
                $output .= '
                      <a class="char_icon_padding" href="' . $base_datasite . $item_datasite . $EQU_FEET . '" rel="external" onmouseover="ShowTooltip(this,\'_b' . 'FEET' . '\');" onmouseout="HideTooltip(\'_b' . 'FEET' . '\');">
                        <img src="' . $equiped_items[8][1] . '" class="' . $equiped_items[8][2] . '" alt="Feet" />
                      </a>';
                if ($mode) {
                    $output .= '
                      <div style="position: relative;">
                        <a href="char.php?action=delete_item&id=' . $id . '&bag=' . $equiped_items[8][3]["bag"] . '&slot=' . $equiped_items[8][3]["slot"] . '&item=' . $equiped_items[8][3]["item_template"] . '&mode=' . $mode . '" id="ch_item_delete">
                          <img src="img/aff_cross.png" />
                        </a>
                      </div>';
                }
                // build a tooltip object for this item
                $i_fields = get_item_info($equiped_items[8][3]['item_template']);
                $output .= '
                      <div class="item_tooltip" id="tooltip_b' . 'FEET' . '">
                        <table>
                          <tr>
                            <td>
                              ' . get_item_tooltip($i_fields, $equiped_items[8][3]['enchantment'], $equiped_items[8][3]['property'], $equiped_items[8][3]['creator'], $equiped_items[8][3]['durability'], $equiped_items[8][3]['flags']) . '
                            </td>
                          </tr>
                        </table>
                      </div>';
            } else {
                $output .= '
                      <img src="img/INV/INV_empty_feet.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                    </td>
                  </tr>
                  <tr>
                    <td style="width: 1%;">';
            if ($equiped_items[5][1]) {
                $output .= '
                      <a class="char_icon_padding" href="' . $base_datasite . $item_datasite . $EQU_CHEST . '" rel="external" onmouseover="ShowTooltip(this,\'_b' . 'CHEST' . '\');" onmouseout="HideTooltip(\'_b' . 'CHEST' . '\');">
                        <img src="' . $equiped_items[5][1] . '" class="' . $equiped_items[5][2] . '" alt="Chest" />
                      </a>';
                if ($mode) {
                    $output .= '
                      <div style="position: relative;">
                        <a href="char.php?action=delete_item&id=' . $id . '&bag=' . $equiped_items[5][3]["bag"] . '&slot=' . $equiped_items[5][3]["slot"] . '&item=' . $equiped_items[5][3]["item_template"] . '&mode=' . $mode . '" id="ch_item_delete">
                          <img src="img/aff_cross.png" />
                        </a>
                      </div>';
                }
                // build a tooltip object for this item
                $i_fields = get_item_info($equiped_items[5][3]['item_template']);
                $output .= '
                      <div class="item_tooltip" id="tooltip_b' . 'CHEST' . '">
                        <table>
                          <tr>
                            <td>
                              ' . get_item_tooltip($i_fields, $equiped_items[5][3]['enchantment'], $equiped_items[5][3]['property'], $equiped_items[5][3]['creator'], $equiped_items[5][3]['durability'], $equiped_items[5][3]['flags']) . '
                            </td>
                          </tr>
                        </table>
                      </div>';
            } else {
                $output .= '
                      <img src="img/INV/INV_empty_chest_back.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                    </td>
                    <td class="half_line" colspan="2" rowspan="2" align="center" style="width: 50%;">
                      <div class="gradient_p" id="char_melee_name">
                        ' . lang("char", "melee_d") . ':<br />
                        ' . lang("char", "melee_ap") . ':<br />
                        ' . lang("char", "melee_hit") . ':<br />
                        ' . lang("char", "melee_crit") . ':<br />
                        ' . lang("char", "expertise") . ':<br />
                      </div>
                      <div class="gradient_pp" id="char_melee_value">
                        ' . $mindamage . '-' . $maxdamage . '<br />
                        ' . ($char_data[UNIT_FIELD_ATTACK_POWER] + $char_data[UNIT_FIELD_ATTACK_POWER_MODS]) . '<br />
                        ' . $melee_hit . '<br />
                        ' . $crit . '%<br />
                        ' . $expertise . '<br />
                      </div>
                    </td>
                    <td class="half_line" colspan="2" rowspan="2" align="center" style="width: 50%;">
                      <div class="gradient_p">
                        ' . lang("char", "spell_d") . ':<br />
                        ' . lang("char", "spell_heal") . ':<br />
                        ' . lang("char", "spell_hit") . ':<br />
                        ' . lang("char", "spell_crit") . ':<br />
                        ' . lang("char", "spell_haste") . '
                      </div>
                      <div class="gradient_pp">
                        ' . $spell_damage . '<br />
                        ' . $spell_heal . '<br />
                        ' . $spell_hit . '<br />
                        ' . $spell_crit . '%<br />
                        ' . $spell_haste . '
                      </div>
                    </td>
                    <td style="width: 1%;">';
            if ($equiped_items[11][1]) {
                $output .= '
                      <a class="char_icon_padding" href="' . $base_datasite . $item_datasite . $EQU_FINGER1 . '" rel="external" onmouseover="ShowTooltip(this,\'_b' . 'FINGER1' . '\');" onmouseout="HideTooltip(\'_b' . 'FINGER1' . '\');">
                        <img src="' . $equiped_items[11][1] . '" class="' . $equiped_items[11][2] . '" alt="Finger1" />
                      </a>';
                if ($mode) {
                    $output .= '
                      <div style="position: relative;">
                        <a href="char.php?action=delete_item&id=' . $id . '&bag=' . $equiped_items[11][3]["bag"] . '&slot=' . $equiped_items[11][3]["slot"] . '&item=' . $equiped_items[11][3]["item_template"] . '&mode=' . $mode . '" id="ch_item_delete">
                          <img src="img/aff_cross.png" />
                        </a>
                      </div>';
                }
                // build a tooltip object for this item
                $i_fields = get_item_info($equiped_items[11][3]['item_template']);
                $output .= '
                      <div class="item_tooltip" id="tooltip_b' . 'FINGER1' . '">
                        <table>
                          <tr>
                            <td>
                              ' . get_item_tooltip($i_fields, $equiped_items[11][3]['enchantment'], $equiped_items[11][3]['property'], $equiped_items[11][3]['creator'], $equiped_items[11][3]['durability'], $equiped_items[11][3]['flags']) . '
                            </td>
                          </tr>
                        </table>
                      </div>';
            } else {
                $output .= '
                      <img src="img/INV/INV_empty_finger.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                    </td>
                  </tr>
                  <tr>
                    <td style="width: 1%;">';
            if ($equiped_items[4][1]) {
                $output .= '
                      <a class="char_icon_padding" href="' . $base_datasite . $item_datasite . $EQU_SHIRT . '" rel="external" onmouseover="ShowTooltip(this,\'_b' . 'SHIRT' . '\');" onmouseout="HideTooltip(\'_b' . 'SHIRT' . '\');">
                        <img src="' . $equiped_items[4][1] . '" class="' . $equiped_items[4][2] . '" alt="Shirt" />
                      </a>';
                if ($mode) {
                    $output .= '
                      <div style="position: relative;">
                        <a href="char.php?action=delete_item&id=' . $id . '&bag=' . $equiped_items[4][3]["bag"] . '&slot=' . $equiped_items[4][3]["slot"] . '&item=' . $equiped_items[4][3]["item_template"] . '&mode=' . $mode . '" id="ch_item_delete">
                          <img src="img/aff_cross.png" />
                        </a>
                      </div>';
                }
                // build a tooltip object for this item
                $i_fields = get_item_info($equiped_items[4][3]['item_template']);
                $output .= '
                      <div class="item_tooltip" id="tooltip_b' . 'SHIRT' . '">
                        <table>
                          <tr>
                            <td>
                              ' . get_item_tooltip($i_fields, $equiped_items[4][3]['enchantment'], $equiped_items[4][3]['property'], $equiped_items[4][3]['creator'], $equiped_items[4][3]['durability'], $equiped_items[4][3]['flags']) . '
                            </td>
                          </tr>
                        </table>
                      </div>';
            } else {
                $output .= '
                      <img src="img/INV/INV_empty_shirt.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                    </td>
                    <td style="width: 1%;">';
            if ($equiped_items[12][1]) {
                $output .= '
                      <a class="char_icon_padding" href="' . $base_datasite . $item_datasite . $EQU_FINGER2 . '" rel="external" onmouseover="ShowTooltip(this,\'_b' . 'FINGER2' . '\');" onmouseout="HideTooltip(\'_b' . 'FINGER2' . '\');">
                        <img src="' . $equiped_items[12][1] . '" class="' . $equiped_items[12][2] . '" alt="Finger2" />
                      </a>';
                if ($mode) {
                    $output .= '
                      <div style="position: relative;">
                        <a href="char.php?action=delete_item&id=' . $id . '&bag=' . $equiped_items[12][3]["bag"] . '&slot=' . $equiped_items[12][3]["slot"] . '&item=' . $equiped_items[12][3]["item_template"] . '&mode=' . $mode . '" id="ch_item_delete">
                          <img src="img/aff_cross.png" />
                        </a>
                      </div>';
                }
                // build a tooltip object for this item
                $i_fields = get_item_info($equiped_items[12][3]['item_template']);
                $output .= '
                      <div class="item_tooltip" id="tooltip_b' . 'FINGER2' . '">
                        <table>
                          <tr>
                            <td>
                              ' . get_item_tooltip($i_fields, $equiped_items[12][3]['enchantment'], $equiped_items[12][3]['property'], $equiped_items[12][3]['creator'], $equiped_items[12][3]['durability'], $equiped_items[12][3]['flags']) . '
                            </td>
                          </tr>
                        </table>
                      </div>';
            } else {
                $output .= '
                      <img src="img/INV/INV_empty_finger.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                    </td>
                  </tr>
                  <tr>
                    <td style="width: 1%;">';
            if ($equiped_items[19][1]) {
                $output .= '
                      <a class="char_icon_padding" href="' . $base_datasite . $item_datasite . $EQU_TABARD . '" rel="external" onmouseover="ShowTooltip(this,\'_b' . 'TABARD' . '\');" onmouseout="HideTooltip(\'_b' . 'TABARD' . '\');">
                        <img src="' . $equiped_items[19][1] . '" class="' . $equiped_items[19][2] . '" alt="Tabard" />
                      </a>';
                if ($mode) {
                    $output .= '
                      <div style="position: relative;">
                        <a href="char.php?action=delete_item&id=' . $id . '&bag=' . $equiped_items[19][3]["bag"] . '&slot=' . $equiped_items[19][3]["slot"] . '&item=' . $equiped_items[19][3]["item_template"] . '&mode=' . $mode . '" id="ch_item_delete">
                          <img src="img/aff_cross.png" />
                        </a>
                      </div>';
                }
                // build a tooltip object for this item
                $i_fields = get_item_info($equiped_items[19][3]['item_template']);
                $output .= '
                      <div class="item_tooltip" id="tooltip_b' . 'TABARD' . '">
                        <table>
                          <tr>
                            <td>
                              ' . get_item_tooltip($i_fields, $equiped_items[19][3]['enchantment'], $equiped_items[19][3]['property'], $equiped_items[19][3]['creator'], $equiped_items[19][3]['durability'], $equiped_items[19][3]['flags']) . '
                            </td>
                          </tr>
                        </table>
                      </div>';
            } else {
                $output .= '
                      <img src="img/INV/INV_empty_tabard.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                    </td>
                    <td class="half_line" colspan="2" rowspan="2" align="center" style="width: 50%;">
                      <div class="gradient_p">
                        ' . lang("char", "dodge") . ':<br />
                        ' . lang("char", "parry") . ':<br />
                        ' . lang("char", "block") . ':
                      </div>
                      <div class="gradient_pp">
                        ' . $dodge . '%<br />
                        ' . $parry . '%<br />
                        ' . $block . '%
                      </div>
                    </td>
                    <td class="half_line" colspan="2" rowspan="2" align="center" style="width: 50%;">
                      <div class="gradient_p" id="char_ranged_name">
                        ' . lang("char", "ranged_d") . ':<br />
                        ' . lang("char", "ranged_ap") . ':<br />
                        ' . lang("char", "ranged_hit") . ':<br />
                        ' . lang("char", "ranged_crit") . ':<br />
                      </div>
                      <div class="gradient_pp" id="char_ranged_value">
                        ' . $minrangeddamage . '-' . $maxrangeddamage . '<br />
                        ' . ($char_data[UNIT_FIELD_RANGED_ATTACK_POWER] + $char_data[UNIT_FIELD_RANGED_ATTACK_POWER_MODS]) . '<br />
                        ' . $ranged_hit . '<br />
                        ' . $ranged_crit . '%<br />
                      </div>
                    </td>
                    <td style="width: 1%;">';
            if ($equiped_items[13][1]) {
                $output .= '
                      <a class="char_icon_padding" href="' . $base_datasite . $item_datasite . $EQU_TRINKET1 . '" rel="external" onmouseover="ShowTooltip(this,\'_b' . 'TRINKET1' . '\');" onmouseout="HideTooltip(\'_b' . 'TRINKET1' . '\');">
                        <img src="' . $equiped_items[13][1] . '" class="' . $equiped_items[13][2] . '" alt="Trinket1" />
                      </a>';
                if ($mode) {
                    $output .= '
                      <div style="position: relative;">
                        <a href="char.php?action=delete_item&id=' . $id . '&bag=' . $equiped_items[13][3]["bag"] . '&slot=' . $equiped_items[13][3]["slot"] . '&item=' . $equiped_items[13][3]["item_template"] . '&mode=' . $mode . '" id="ch_item_delete">
                          <img src="img/aff_cross.png" />
                        </a>
                      </div>';
                }
                // build a tooltip object for this item
                $i_fields = get_item_info($equiped_items[13][3]['item_template']);
                $output .= '
                      <div class="item_tooltip" id="tooltip_b' . 'TRINKET1' . '">
                        <table>
                          <tr>
                            <td>
                              ' . get_item_tooltip($i_fields, $equiped_items[13][3]['enchantment'], $equiped_items[13][3]['property'], $equiped_items[13][3]['creator'], $equiped_items[13][3]['durability'], $equiped_items[13][3]['flags']) . '
                            </td>
                          </tr>
                        </table>
                      </div>';
            } else {
                $output .= '
                      <img src="img/INV/INV_empty_trinket.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                    </td>
                  </tr>
                  <tr>
                    <td style="width: 1%;">';
            if ($equiped_items[9][1]) {
                $output .= '
                      <a class="char_icon_padding" href="' . $base_datasite . $item_datasite . $EQU_WRIST . '" rel="external" onmouseover="ShowTooltip(this,\'_b' . 'WRIST' . '\');" onmouseout="HideTooltip(\'_b' . 'WRIST' . '\');">
                        <img src="' . $equiped_items[9][1] . '" class="' . $equiped_items[9][2] . '" alt="Wrist" />
                      </a>';
                if ($mode) {
                    $output .= '
                      <div style="position: relative;">
                        <a href="char.php?action=delete_item&id=' . $id . '&bag=' . $equiped_items[9][3]["bag"] . '&slot=' . $equiped_items[9][3]["slot"] . '&item=' . $equiped_items[9][3]["item_template"] . '&mode=' . $mode . '" id="ch_item_delete">
                          <img src="img/aff_cross.png" />
                        </a>
                      </div>';
                }
                // build a tooltip object for this item
                $i_fields = get_item_info($equiped_items[9][3]['item_template']);
                $output .= '
                      <div class="item_tooltip" id="tooltip_b' . 'WRIST' . '">
                        <table>
                          <tr>
                            <td>
                              ' . get_item_tooltip($i_fields, $equiped_items[9][3]['enchantment'], $equiped_items[9][3]['property'], $equiped_items[9][3]['creator'], $equiped_items[9][3]['durability'], $equiped_items[9][3]['flags']) . '
                            </td>
                          </tr>
                        </table>
                      </div>';
            } else {
                $output .= '
                      <img src="img/INV/INV_empty_wrist.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                    </td>
                    <td style="width: 1%;">';
            if ($equiped_items[14][1]) {
                $output .= '
                      <a class="char_icon_padding" href="' . $base_datasite . $item_datasite . $EQU_TRINKET2 . '" rel="external" onmouseover="ShowTooltip(this,\'_b' . 'TRINKET2' . '\');" onmouseout="HideTooltip(\'_b' . 'TRINKET2' . '\');">
                        <img src="' . $equiped_items[14][1] . '" class="' . $equiped_items[14][2] . '" alt="Trinket2" />
                      </a>';
                if ($mode) {
                    $output .= '
                      <div style="position: relative;">
                        <a href="char.php?action=delete_item&id=' . $id . '&bag=' . $equiped_items[14][3]["bag"] . '&slot=' . $equiped_items[14][3]["slot"] . '&item=' . $equiped_items[14][3]["item_template"] . '&mode=' . $mode . '" id="ch_item_delete">
                          <img src="img/aff_cross.png" />
                        </a>
                      </div>';
                }
                // build a tooltip object for this item
                $i_fields = get_item_info($equiped_items[14][3]['item_template']);
                $output .= '
                      <div class="item_tooltip" id="tooltip_b' . 'TRINKET2' . '">
                        <table>
                          <tr>
                            <td>
                              ' . get_item_tooltip($i_fields, $equiped_items[14][3]['enchantment'], $equiped_items[14][3]['property'], $equiped_items[14][3]['creator'], $equiped_items[14][3]['durability'], $equiped_items[14][3]['flags']) . '
                            </td>
                          </tr>
                        </table>
                      </div>';
            } else {
                $output .= '
                      <img src="img/INV/INV_empty_trinket.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                    </td>
                  </tr>
                  <tr>
                    <td></td>
                    <td style="width: 15%;">';
            if ($equiped_items[16][1]) {
                $output .= '
                      <a class="char_icon_padding" href="' . $base_datasite . $item_datasite . $EQU_MAIN_HAND . '" rel="external" onmouseover="ShowTooltip(this,\'_b' . 'MAIN_HAND' . '\');" onmouseout="HideTooltip(\'_b' . 'MAIN_HAND' . '\');">
                        <img src="' . $equiped_items[16][1] . '" class="' . $equiped_items[16][2] . '" alt="MainHand" />
                      </a>';
                if ($mode) {
                    $output .= '
                      <div style="position: relative;">
                        <a href="char.php?action=delete_item&id=' . $id . '&bag=' . $equiped_items[16][3]["bag"] . '&slot=' . $equiped_items[16][3]["slot"] . '&item=' . $equiped_items[16][3]["item_template"] . '&mode=' . $mode . '" id="ch_item_delete">
                          <img src="img/aff_cross.png" />
                        </a>
                      </div>';
                }
                // build a tooltip object for this item
                $i_fields = get_item_info($equiped_items[16][3]['item_template']);
                $output .= '
                      <div class="item_tooltip" id="tooltip_b' . 'MAIN_HAND' . '">
                        <table>
                          <tr>
                            <td>
                              ' . get_item_tooltip($i_fields, $equiped_items[16][3]['enchantment'], $equiped_items[16][3]['property'], $equiped_items[16][3]['creator'], $equiped_items[16][3]['durability'], $equiped_items[16][3]['flags']) . '
                            </td>
                          </tr>
                        </table>
                      </div>';
            } else {
                $output .= '
                      <img src="img/INV/INV_empty_main_hand.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                    </td>
                    <td style="width: 15%;">';
            if ($equiped_items[17][1]) {
                $output .= '
                      <a class="char_icon_padding" href="' . $base_datasite . $item_datasite . $EQU_OFF_HAND . '" rel="external" onmouseover="ShowTooltip(this,\'_b' . 'OFF_HAND' . '\');" onmouseout="HideTooltip(\'_b' . 'OFF_HAND' . '\');">
                        <img src="' . $equiped_items[17][1] . '" class="' . $equiped_items[17][2] . '" alt="OffHand" />
                      </a>';
                if ($mode) {
                    $output .= '
                      <div style="position: relative;">
                        <a href="char.php?action=delete_item&id=' . $id . '&bag=' . $equiped_items[17][3]["bag"] . '&slot=' . $equiped_items[17][3]["slot"] . '&item=' . $equiped_items[17][3]["item_template"] . '&mode=' . $mode . '" id="ch_item_delete">
                          <img src="img/aff_cross.png" />
                        </a>
                      </div>';
                }
                // build a tooltip object for this item
                $i_fields = get_item_info($equiped_items[17][3]['item_template']);
                $output .= '
                      <div class="item_tooltip" id="tooltip_b' . 'OFF_HAND' . '">
                        <table>
                          <tr>
                            <td>
                              ' . get_item_tooltip($i_fields, $equiped_items[17][3]['enchantment'], $equiped_items[17][3]['property'], $equiped_items[17][3]['creator'], $equiped_items[17][3]['durability'], $equiped_items[17][3]['flags']) . '
                            </td>
                          </tr>
                        </table>
                      </div>';
            } else {
                $output .= '
                      <img src="img/INV/INV_empty_off_hand.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                    </td>
                    <td style="width: 15%;">';
            if ($equiped_items[18][1]) {
                $output .= '
                      <a class="char_icon_padding" href="' . $base_datasite . $item_datasite . $EQU_RANGED . '" rel="external" onmouseover="ShowTooltip(this,\'_b' . 'RANGED' . '\');" onmouseout="HideTooltip(\'_b' . 'RANGED' . '\');">
                        <img src="' . $equiped_items[18][1] . '" class="' . $equiped_items[18][2] . '" alt="Ranged" />
                      </a>';
                if ($mode) {
                    $output .= '
                      <div style="position: relative;">
                        <a href="char.php?action=delete_item&id=' . $id . '&bag=' . $equiped_items[18][3]["bag"] . '&slot=' . $equiped_items[18][3]["slot"] . '&item=' . $equiped_items[18][3]["item_template"] . '&mode=' . $mode . '" id="ch_item_delete">
                          <img src="img/aff_cross.png" />
                        </a>
                      </div>';
                }
                // build a tooltip object for this item
                $i_fields = get_item_info($equiped_items[18][3]['item_template']);
                $output .= '
                      <div class="item_tooltip" id="tooltip_b' . 'RANGED' . '">
                        <table>
                          <tr>
                            <td>
                              ' . get_item_tooltip($i_fields, $equiped_items[18][3]['enchantment'], $equiped_items[18][3]['property'], $equiped_items[18][3]['creator'], $equiped_items[18][3]['durability'], $equiped_items[18][3]['flags']) . '
                            </td>
                          </tr>
                        </table>
                      </div>';
            } else {
                $output .= '
                      <img src="img/INV/INV_empty_ranged.png" class="icon_border_0" alt="empty" />';
            }
            $output .= '
                    </td>
                    <td style="width: 15%;"></td>
                    <td></td>
                  </tr>';
            if ($user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                // if the character is still leveling, show an experience bar
                if ($char["level"] < 80) {
                    $xp_query = "SELECT * FROM xp_to_level WHERE level='" . $char["level"] . "'";
                    $xp_result = $sql["mgr"]->query($xp_query);
                    $xp_fields = $sql["mgr"]->fetch_assoc($xp_result);
                    $xp_to_level = $xp_fields["xp_for_next_level"];
                    $output .= '
                    <tr>
                      <td colspan="6" class="bar xp_bar" style="background-position: ' . (round(580 * $char["xp"] / $xp_to_level) - 580) . 'px;">
                        ' . lang("char", "exp") . ": " . $char["xp"] . " / " . $xp_to_level . '
                      </td>
                    </tr>';
                }
                //total time played
                $tot_time = $char["totaltime"];
                $tot_days = (int) ($tot_time / 86400);
                $tot_time = $tot_time - $tot_days * 86400;
                $total_hours = (int) ($tot_time / 3600);
                $tot_time = $tot_time - $total_hours * 3600;
                $total_min = (int) ($tot_time / 60);
                $time_offset = $timezone_offset * 3600;
                if ($char["timestamp"] != 0) {
                    $lastseen = date("F j, Y @ Hi", $char["timestamp"] + $time_offset);
                } else {
                    $lastseen = '-';
                }
                $output .= '
                  <tr>
                    <td colspan="6">
                      ' . lang("char", "tot_play_time") . ': ' . $tot_days . ' ' . lang("char", "days") . ' ' . $total_hours . ' ' . lang("char", "hours") . ' ' . $total_min . ' ' . lang("char", "min") . '
                    </td>
                  </tr>';
                $output .= '
                  <tr>
                    <td colspan="6">
                      ' . lang("char", "lastseen") . ': ' . $lastseen . '
                    </td>
                  </tr>';
            }
            $output .= '
                </table>
              </div>
              <br />
            </div>
            <br />
            <table class="hidden center">
              <tr>
                <td>';
            // button to user account page, user account page has own security
            makebutton(lang("char", "chars_acc"), 'user.php?action=edit_user&amp;acct=' . $owner_acc_id . '', 130);
            $output .= '
                </td>
                <td>';
            // only higher level GM with delete access can edit character
            //  character edit allows removal of character items, so delete permission is needed
            if ($user_lvl >= $owner_gmlvl && $user_lvl >= $action_permission["delete"]) {
                makebutton(lang("char", "edit_button"), 'char_edit.php?id=' . $id . '&amp;realm=' . $realmid, 130);
                $output .= '
                </td>
                <td>';
            }
            // only higher level GM with delete access, or character owner can delete character
            if ($user_lvl > $owner_gmlvl && $user_lvl >= $action_permission["delete"] || $owner_name === $user_name) {
                makebutton(lang("char", "del_char"), 'char_list.php?action=del_char_form&amp;check%5B%5D=' . $id . '" type="wrn', 130);
                $output .= '
                </td>
                <td>';
            }
            // show Delete Mode / View Mode button depending on current mode
            if ($mode) {
                makebutton(lang("char", "viewmode"), 'char.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;mode=0" type="def', 130);
            } else {
                makebutton(lang("char", "deletemode"), 'char.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;mode=1" type="def', 130);
            }
            $output .= '
                </td>
                <td>';
            // only GM with update permission can send mail, mail can send items, so update permission is needed
            if ($user_lvl >= $action_permission["update"]) {
                makebutton(lang("char", "send_mail"), 'mail.php?type=ingame_mail&amp;to=' . $char["name"], 130);
                $output .= '
                </td>';
            } else {
                $output .= '
                </td>';
            }
            $output .= '
              </tr>
              <tr>
                <td>';
            makebutton(lang("global", "back"), 'javascript:window.history.back()" type="def', 130);
            $output .= '
                </td>
              </tr>
            </table>
            <br />
          <!-- end of char.php -->';
        } else {
        }
        //error($lang_char["no_permission"]);
    } else {
        error(lang("char", "no_char_found"));
    }
}
Esempio n. 10
0
function char_talent(&$sqlr, &$sqlc)
{
    global $output, $lang_global, $lang_char, $realm_id, $realm_db, $characters_db, $mmfpm_db, $server, $action_permission, $user_lvl, $user_name, $spell_datasite;
    // this page uses wowhead tooltops
    wowhead_tt();
    // we need at least an id or we would have nothing to show
    if (empty($_GET['id'])) {
        error($lang_global['empty_fields']);
    }
    // this is multi realm support, as of writing still under development
    //  this page is already implementing it
    if (empty($_GET['realm'])) {
        $realmid = $realm_id;
    } else {
        $realmid = $sqlr->quote_smart($_GET['realm']);
        if (is_numeric($realmid)) {
            $sqlc->connect($characters_db[$realmid]['addr'], $characters_db[$realmid]['user'], $characters_db[$realmid]['pass'], $characters_db[$realmid]['name']);
        } else {
            $realmid = $realm_id;
        }
    }
    //-------------------SQL Injection Prevention--------------------------------
    // no point going further if we don have a valid ID
    $id = $sqlc->quote_smart($_GET['id']);
    if (is_numeric($id)) {
    } else {
        error($lang_global['empty_fields']);
    }
    $result = $sqlc->query('SELECT account, name, race, class, level, gender,
    CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(data, " ", ' . (CHAR_DATA_OFFSET_POINTS1 + 1) . '), " ", -1) AS UNSIGNED) AS talent_points
    FROM characters WHERE guid = ' . $id . ' LIMIT 1');
    if ($sqlc->num_rows($result)) {
        $char = $sqlc->fetch_assoc($result);
        $owner_acc_id = $sqlc->result($result, 0, 'account');
        $result = $sqlr->query('SELECT gmlevel,username FROM account WHERE id = ' . $char['account'] . '');
        $owner_gmlvl = $sqlr->result($result, 0, 'gmlevel');
        $owner_name = $sqlr->result($result, 0, 'username');
        if ($user_lvl > $owner_gmlvl || $owner_name === $user_name) {
            $result = $sqlc->query('SELECT spell FROM character_spell WHERE guid = ' . $id . ' and active = 1 and disabled = 0 ORDER BY spell DESC');
            $output .= '
          <center>
           <div id="tab_content">
              <div id="tab">
                <ul>
                  <li><a href="char.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['char_sheet'] . '</a></li>
                  <li><a href="char_inv.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['inventory'] . '</a></li>
                  <li><a href="char_extra.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['extra'] . '</a></li>
                  <li><a href="char_achieve.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['achievements'] . '</a></li>
                  <li><a href="char_rep.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['reputation'] . '</a></li>
                  <li><a href="char_skill.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['skills'] . '</a></li>
                  <li><a href="char_quest.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['quests'] . '</a></li>';
            if (char_get_class_name($char['class']) === 'Hunter') {
                $output .= '
                  <li><a href="char_pets.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['pets'] . '</a></li>';
            }
            $output .= '
                  <li><a href="char_friends.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['friends'] . '</a></li>
				  <li><a href="char_spell.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['spells'] . '</a></li>
				  <li><a href="char_mail.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['mail'] . '</a></li>
                </ul>
                <ul>';
            // selected char tab at last
            $output .= '
                  <li id="selected"><a href="char_talent.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['talents'] . '</a></li>';
            $output .= '
              </ul>
            </div>
            <div id="tab_content2">
              <font class="bold">
                ' . htmlentities($char['name']) . ' -
                <img src="img/c_icons/' . $char['race'] . '-' . $char['gender'] . '.gif"
                  onmousemove="toolTip(\'' . char_get_race_name($char['race']) . '\', \'item_tooltip\')" onmouseout="toolTip()" alt="" />
                <img src="img/c_icons/' . $char['class'] . '.gif"
                  onmousemove="toolTip(\'' . char_get_class_name($char['class']) . '\',\'item_tooltip\')" onmouseout="toolTip()" alt="" /> - lvl ' . char_get_level_color($char['level']) . '
              </font>
              <br /><br />
              <table class="lined" style="width: 550px;">
                <tr valign="top" align="center">';
            if ($sqlc->num_rows($result)) {
                $talent_rate = isset($server[$realmid]['talent_rate']) ? $server[$realmid]['talent_rate'] : 1;
                $talent_points = ($char['level'] - 9) * $talent_rate;
                $talent_points_left = $char['talent_points'];
                $talent_points_used = $talent_points - $talent_points_left;
                $sqlm = new SQL();
                $sqlm->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']);
                $tabs = array();
                $l = 0;
                while (($talent = $sqlc->fetch_assoc($result)) && $l < $talent_points_used) {
                    if ($tab = $sqlm->fetch_assoc($sqlm->query('SELECT field_1, field_2, field_3, field_13, field_16 from dbc_talent where field_8 = ' . $talent['spell'] . ' LIMIT 1'))) {
                        if (isset($tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']])) {
                            $l -= $tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']][1];
                        }
                        $tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']] = array($talent['spell'], '5', '5');
                        $l += 5;
                        if ($tab['field_13']) {
                            talent_dependencies($tabs, $tab, $l, $sqlm);
                        }
                    } elseif ($tab = $sqlm->fetch_assoc($sqlm->query('SELECT field_1, field_2, field_3, field_13, field_16, field_8 from dbc_talent where field_7 = ' . $talent['spell'] . ' LIMIT 1'))) {
                        if (isset($tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']])) {
                            $l -= $tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']][1];
                        }
                        $tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']] = array($talent['spell'], '4', $tab['field_8'] ? '2' : '5');
                        $l += 4;
                        if ($tab['field_13']) {
                            talent_dependencies($tabs, $tab, $l, $sqlm);
                        }
                    } elseif ($tab = $sqlm->fetch_assoc($sqlm->query('SELECT field_1, field_2, field_3, field_13, field_16, field_7 from dbc_talent where field_6 = ' . $talent['spell'] . ' LIMIT 1'))) {
                        if (isset($tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']])) {
                            $l -= $tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']][1];
                        }
                        $tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']] = array($talent['spell'], '3', $tab['field_7'] ? '2' : '5');
                        $l += 3;
                        if ($tab['field_13']) {
                            talent_dependencies($tabs, $tab, $l, $sqlm);
                        }
                    } elseif ($tab = $sqlm->fetch_assoc($sqlm->query('SELECT field_1, field_2, field_3, field_13, field_16, field_6 from dbc_talent where field_5 = ' . $talent['spell'] . ' LIMIT 1'))) {
                        if (isset($tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']])) {
                            $l -= $tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']][1];
                        }
                        $tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']] = array($talent['spell'], '2', $tab['field_6'] ? '2' : '5');
                        $l += 2;
                        if ($tab['field_13']) {
                            talent_dependencies($tabs, $tab, $l, $sqlm);
                        }
                    } elseif ($tab = $sqlm->fetch_assoc($sqlm->query('SELECT field_1, field_2, field_3, field_13, field_16, field_5 from dbc_talent where field_4 = ' . $talent['spell'] . ' LIMIT 1'))) {
                        if (isset($tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']])) {
                            $l -= $tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']][1];
                        }
                        $tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']] = array($talent['spell'], '1', $tab['field_5'] ? '2' : '5');
                        $l += 1;
                        if ($tab['field_13']) {
                            talent_dependencies($tabs, $tab, $l, $sqlm);
                        }
                    }
                }
                unset($tab);
                unset($talent);
                foreach ($tabs as $k => $data) {
                    $points = 0;
                    $output .= '
                  <td>
                    <table class="hidden" style="width: 0px;">
                     <tr>
                       <td colspan="6" style="border-bottom-width: 0px;">
                       </td>
                     </tr>
                     <tr>';
                    for ($i = 0; $i < 11; ++$i) {
                        for ($j = 0; $j < 4; ++$j) {
                            if (isset($data[$i][$j])) {
                                $output .= '
                        <td valign="bottom" align="center" style="border-top-width: 0px;border-bottom-width: 0px;">
                          <a href="' . $spell_datasite . $data[$i][$j][0] . '" target="_blank">
                            <img src="' . spell_get_icon($data[$i][$j][0], $sqlm) . '" width="36" height="36" class="icon_border_' . $data[$i][$j][2] . '" alt="" />
                          </a>
                          <div style="width:0px;margin:-14px 0px 0px 30px;font-size:14px;color:black">' . $data[$i][$j][1] . '</div>
                          <div style="width:0px;margin:-14px 0px 0px 29px;font-size:14px;color:white">' . $data[$i][$j][1] . '</div>
                        </td>';
                                $points += $data[$i][$j][1];
                            } else {
                                $output .= '
                        <td valign="bottom" align="center" style="border-top-width: 0px;border-bottom-width: 0px;">
                          <img src="img/blank.gif" width="44" height="44" alt="" />
                        </td>';
                            }
                        }
                        $output .= '
                      </tr>
                      <tr>';
                    }
                    $output .= '
                       <td colspan="6" style="border-top-width: 0px;border-bottom-width: 0px;">
                       </td>
                     </tr>
                      <tr>
                        <td colspan="6" valign="bottom" align="left">
                         ' . $sqlm->result($sqlm->query('SELECT field_1 FROM dbc_talenttab WHERE id = ' . $k . ''), 0, 'field_1') . ': ' . $points . '
                        </td>
                      </tr>
                    </table>
                  </td>';
                }
                unset($data);
                unset($k);
                unset($tabs);
                $output .= '
                </tr>
              </table>
              <br />
              <table>
                <tr>
                  <td align="left">
                    ' . $lang_char['talent_rate'] . ': <br />
                    ' . $lang_char['talent_points'] . ': <br />
                    ' . $lang_char['talent_points_used'] . ': <br />
                    ' . $lang_char['talent_points_shown'] . ': <br />
                    ' . $lang_char['talent_points_left'] . ':
                  </td>
                  <td align="left">
                    ' . $talent_rate . '<br />
                    ' . $talent_points . '<br />
                    ' . $talent_points_used . '<br />
                    ' . $l . '<br />
                    ' . $talent_points_left . '
                  </td>
                  <td width="64">
                  </td>
                  <td align="right">';
                unset($l);
                unset($talent_rate);
                unset($talent_points);
                unset($talent_points_used);
                unset($talent_points_left);
                $glyphs = explode(' ', $sqlc->result($sqlc->query('SELECT data FROM characters WHERE guid = ' . $id . ''), 0));
                for ($i = 0; $i < 6; ++$i) {
                    if ($glyphs[CHAR_DATA_OFFSET_GLYPHS + $i]) {
                        $glyph = $sqlm->result($sqlm->query('select field_1 from dbc_glyphproperties where id = ' . $glyphs[CHAR_DATA_OFFSET_GLYPHS + $i] . ''), 0);
                        $output .= '
                    <a href="' . $spell_datasite . $glyph . '" target="_blank">
                      <img src="' . spell_get_icon($glyph, $sqlm) . '" width="36" height="36" class="icon_border_0" alt="" />
                    </a>';
                    }
                }
                unset($glyphs);
                $output .= '
                  </td>';
            }
            //---------------Page Specific Data Ends here----------------------------
            //---------------Character Tabs Footer-----------------------------------
            $output .= '
                </tr>
              </table>
            </div>
            </div>
            <br />
            <table class="hidden">
              <tr>
                <td>';
            // button to user account page, user account page has own security
            makebutton($lang_char['chars_acc'], 'user.php?action=edit_user&amp;id=' . $owner_acc_id . '', 130);
            $output .= '
                </td>
                <td>';
            // only higher level GM with delete access can edit character
            //  character edit allows removal of character items, so delete permission is needed
            if ($user_lvl > $owner_gmlvl && $user_lvl >= $action_permission['delete']) {
                makebutton($lang_char['edit_button'], 'char_edit.php?id=' . $id . '&amp;realm=' . $realmid . '', 130);
                $output .= '
                </td>
                <td>';
            }
            // only higher level GM with delete access, or character owner can delete character
            if ($user_lvl > $owner_gmlvl && $user_lvl >= $action_permission['delete'] || $owner_name === $user_name) {
                makebutton($lang_char['del_char'], 'char_list.php?action=del_char_form&amp;check%5B%5D=' . $id . '" type="wrn', 130);
                $output .= '
                </td>
                <td>';
            }
            // only GM with update permission can send mail, mail can send items, so update permission is needed
            if ($user_lvl >= $action_permission['update']) {
                makebutton($lang_char['send_mail'], 'mail.php?type=ingame_mail&amp;to=' . $char['name'] . '', 130);
                $output .= '
                </td>
                <td>';
            }
            makebutton($lang_global['back'], 'javascript:window.history.back()" type="def', 130);
            $output .= '
                </td>
              </tr>
            </table>
            <br />
          </center>
          <!-- end of char_talent.php -->';
        } else {
            error($lang_char['no_permission']);
        }
    } else {
        error($lang_char['no_char_found']);
    }
}
function char_talent()
{
    global $output, $realm_id, $characters_db, $corem_db, $dbc_db, $server, $action_permission, $site_encoding, $user_lvl, $user_name, $base_datasite, $spell_datasite, $sql, $core;
    // this page uses wowhead tooltops
    wowhead_tt();
    // we need at least an id or we would have nothing to show
    if (empty($_GET["id"])) {
        error(lang("global", "empty_fields"));
    }
    // this is multi realm support, as of writing still under development
    //  this page is already implementing it
    if (empty($_GET["realm"])) {
        $realmid = $realm_id;
    } else {
        $realmid = $sql["logon"]->quote_smart($_GET["realm"]);
        if (is_numeric($realmid)) {
            $sql["char"]->connect($characters_db[$realmid]["addr"], $characters_db[$realmid]["user"], $characters_db[$realmid]["pass"], $characters_db[$realmid]["name"], $characters_db[$realmid]["encoding"]);
        } else {
            $realmid = $realm_id;
        }
    }
    //-------------------SQL Injection Prevention--------------------------------
    // no point going further if we don have a valid ID
    $id = $sql["char"]->quote_smart($_GET["id"]);
    if (!is_numeric($id)) {
        error(lang("global", "empty_fields"));
    }
    if ($core == 1) {
        $result = $sql["char"]->query("SELECT acct, name, race, class, level, gender,\n      CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(data, ' ', " . (CHAR_DATA_OFFSET_POINTS1 + 1) . "), ' ', -1) AS UNSIGNED) AS talent_points\n      FROM characters WHERE guid='" . $id . "' LIMIT 1");
    } else {
        $result = $sql["char"]->query("SELECT account AS acct, name, race, class, level, gender\n      FROM characters WHERE guid='" . $id . "' LIMIT 1");
    }
    if ($sql["char"]->num_rows($result)) {
        $char = $sql["char"]->fetch_assoc($result);
        //resrict by owner's gmlvl
        $owner_acc_id = $sql["char"]->result($result, 0, "acct");
        if ($core == 1) {
            $query = $sql["logon"]->query("SELECT login FROM accounts WHERE acct='" . $owner_acc_id . "'");
        } else {
            $query = $sql["logon"]->query("SELECT username as login FROM account WHERE id='" . $owner_acc_id . "'");
        }
        $owner_name = $sql["logon"]->result($query, 0, "login");
        $s_query = "SELECT *, SecurityLevel AS gm FROM config_accounts WHERE Login='******'";
        $s_result = $sql["mgr"]->query($s_query);
        $s_fields = $sql["mgr"]->fetch_assoc($s_result);
        $owner_gmlvl = $s_fields["gm"];
        $view_mod = $s_fields["View_Mod_Talent"];
        if ($owner_gmlvl >= 1073741824) {
            $owner_gmlvl -= 1073741824;
        }
        // owner configured overrides
        $view_override = false;
        if ($view_mod > 0) {
            if ($view_mod == 1) {
            } elseif ($view_mod == 2) {
                // only registered users may view this page
                if ($user_lvl > -1) {
                    $view_override = true;
                }
            }
        }
        // visibility overrides for specific tabs
        $view_inv_override = false;
        if ($s_fields["View_Mod_Inv"] > 0) {
            if ($s_fields["View_Mod_Inv"] == 1) {
            } elseif ($s_fields["View_Mod_Inv"] == 2) {
                // only registered users may view this tab
                if ($user_lvl > -1) {
                    $view_inv_override = true;
                }
            }
        } else {
            if ($user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                $view_inv_override = true;
            }
        }
        $view_achieve_override = false;
        if ($s_fields["View_Mod_AcView_Mod_Acieve"] > 0) {
            if ($s_fields["View_Mod_Achieve"] == 1) {
            } elseif ($s_fields["View_Mod_Achieve"] == 2) {
                // only registered users may view this tab
                if ($user_lvl > -1) {
                    $view_achieve_override = true;
                }
            }
        } else {
            if ($user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                $view_achieve_override = true;
            }
        }
        $view_quest_override = false;
        if ($s_fields["View_Mod_Quest"] > 0) {
            if ($s_fields["View_Mod_Quest"] == 1) {
            } elseif ($s_fields["View_Mod_Quest"] == 2) {
                // only registered users may view this tab
                if ($user_lvl > -1) {
                    $view_quest_override = true;
                }
            }
        } else {
            if ($user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                $view_quest_override = true;
            }
        }
        $view_friends_override = false;
        if ($s_fields["View_Mod_Friends"] > 0) {
            if ($s_fields["View_Mod_Friends"] == 1) {
            } elseif ($s_fields["View_Mod_Friends"] == 2) {
                // only registered users may view this tab
                if ($user_lvl > -1) {
                    $view_friends_override = true;
                }
            }
        } else {
            if ($user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                $view_friends_override = true;
            }
        }
        $view_view_override = false;
        if ($s_fields["View_Mod_View"] > 0) {
            if ($s_fields["View_Mod_View"] == 1) {
            } elseif ($s_fields["View_Mod_View"] == 2) {
                // only registered users may view this tab
                if ($user_lvl > -1) {
                    $view_view_override = true;
                }
            }
        } else {
            if ($user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                $view_view_override = true;
            }
        }
        if ($view_override || $user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
            if (strlen($_GET["curspec"]) == 0) {
                if ($core == 1) {
                    $spec_query = "SELECT currentspec FROM characters WHERE guid='" . $id . "'";
                } else {
                    $spec_query = "SELECT activespec AS currentspec FROM characters WHERE guid='" . $id . "'";
                }
                $spec_results = $sql["char"]->query($spec_query);
                $spec_field = $sql["char"]->fetch_assoc($spec_results);
                $cur_spec = $spec_field["currentspec"] + 1;
                if ($cur_spec == 1) {
                    $opp_spec = 2;
                } else {
                    $opp_spec = 1;
                }
            } else {
                $cur_spec = $_GET["curspec"];
                if ($cur_spec == 1) {
                    $opp_spec = 2;
                } else {
                    $opp_spec = 1;
                }
            }
            if ($core == 1) {
                // this_is_junk: ArcEmu stores talents in a characters table field in the following format:
                //               [talent id][spell offset],[talent id2][spell offset2],...[talent idN][spell offsetN],
                //               So, we have to explode it into an array, then into a pair of arrays.
                $result = $sql["char"]->query("SELECT talents" . $cur_spec . " FROM characters WHERE guid='" . $id . "'");
                $talent_list = $sql["char"]->result($result, 0);
                $talent_list = substr($talent_list, 0, strlen($talent_list) - 1);
                $talent_list = explode(",", $talent_list);
                $talents = array();
                $talent_ranks = array();
                $pick = 0;
                foreach ($talent_list as $t) {
                    if ($pick) {
                        array_push($talent_ranks, $t);
                        $pick = 0;
                    } else {
                        array_push($talents, $t);
                        $pick = 1;
                    }
                }
            } elseif ($core == 2) {
                $query = "SELECT * FROM character_talent\n                    LEFT JOIN `" . $dbc_db["name"] . "`.talent ON character_talent.talent_id=talent.ID\n                  WHERE guid='" . $id . "' AND spec='" . ($cur_spec - 1) . "'";
                $result = $sql["char"]->query($query);
                $talents = array();
                while ($row = $sql["char"]->fetch_assoc($result)) {
                    $cur_rank = $row["current_rank"] + 1;
                    array_push($talents, $row["Spell" . $cur_rank]);
                    array_push($talent_ranks, 0);
                }
            } else {
                $query = "SELECT * FROM character_talent WHERE guid='" . $id . "' AND spec='" . ($cur_spec - 1) . "'";
                $result = $sql["char"]->query($query);
                $talents = array();
                while ($row = $sql["char"]->fetch_assoc($result)) {
                    array_push($talents, $row["spell"]);
                    array_push($talent_ranks, 0);
                }
            }
            $output .= '
              <div class="tab">
              <ul>
                <li><a href="char.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "char_sheet") . '</a></li>';
            if ($view_inv_override) {
                $output .= '
                <li><a href="char_inv.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "inventory") . '</a></li>';
            }
            $output .= '
                <li class="selected"><a href="char_talent.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "talents") . '</a></li>';
            if ($view_achieve_override) {
                $output .= '
                <li><a href="char_achieve.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "achievements") . '</a></li>';
            }
            if ($view_quest_override) {
                $output .= '
                <li><a href="char_quest.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "quests") . '</a></li>';
            }
            if ($view_friends_override) {
                $output .= '
                <li><a href="char_friends.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "friends") . '</a></li>';
            }
            if ($view_view_override) {
                $output .= '
                <li><a href="char_view.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "view") . '</a></li>';
            }
            $output .= '
              </ul>
            </div>
            <div class="tab_content center center_text">
              <span class="bold">' . htmlentities($char["name"], ENT_COMPAT, $site_encoding) . ' - </span>
              <img src="img/c_icons/' . $char["race"] . '-' . $char["gender"] . '.gif" onmousemove="oldtoolTip(\'' . char_get_race_name($char["race"]) . '\', \'old_item_tooltip\')" onmouseout="oldtoolTip()" alt="" />
              <img src="img/c_icons/' . $char["class"] . '.gif" onmousemove="oldtoolTip(\'' . char_get_class_name($char["class"]) . '\', \'old_item_tooltip\')" onmouseout="oldtoolTip()" alt="" />
              <span class="bold"> - ' . lang("char", "level_short") . char_get_level_color($char["level"]) . '</span>
              <br />
              <br />';
            if ($cur_spec == 1) {
                $output .= '
              <span class="bold">' . lang("char", "talentspec") . ': ' . $cur_spec . '&nbsp;<a href="char_talent.php?id=' . $id . '&amp;realm=' . $realm_id . '&amp;curspec=' . $opp_spec . '">' . $opp_spec . '</a></span><br />';
            } else {
                $output .= '
              <span class="bold">' . lang("char", "talentspec") . ': <a href="char_talent.php?id=' . $id . '&amp;realm=' . $realm_id . '&amp;curspec=' . $opp_spec . '">' . $opp_spec . '</a>&nbsp;' . $cur_spec . '</span><br />';
            }
            if (count($talents) > 1) {
                $output .= '
              <table class="lined" id="ch_tal_main">
                <tr valign="top" align="center">';
                $talent_rate = isset($server[$realmid]["talent_rate"]) ? $server[$realmid]["talent_rate"] : 1;
                $talent_points = ($char["level"] - 9) * $talent_rate;
                $talent_points_left = $char["talent_points"];
                $talent_points_used = $talent_points - $talent_points_left;
                $tabs = array();
                $l = 0;
                for ($i = 0; $i < count($talents); $i++) {
                    if ($core == 1) {
                        $talent_spell = $sql["dbc"]->query("SELECT spell" . ($talent_ranks[$i] + 1) . " FROM talent WHERE id='" . $talents[$i] . "'");
                        $talent_spell = $sql["dbc"]->result($talent_spell, 0);
                    } else {
                        $talent_spell = $talents[$i];
                    }
                    if ($tab = $sql["dbc"]->fetch_assoc($sql["dbc"]->query("SELECT TalentTab, Row, Col, Talent1, TalentCount1 FROM talent WHERE spell5='" . $talent_spell . "' LIMIT 1"))) {
                        if (isset($tabs[$tab["TalentTab"]][$tab["Row"]][$tab["Col"]])) {
                            $l -= $tabs[$tab["TalentTab"]][$tab["Row"]][$tab["Col"]][1];
                        }
                        $tabs[$tab["TalentTab"]][$tab["Row"]][$tab["Col"]] = array($talent_spell, "5", "5");
                        $l += 5;
                        if ($tab["Talent1"]) {
                            talent_dependencies($tabs, $tab, $l);
                        }
                    } elseif ($tab = $sql["dbc"]->fetch_assoc($sql["dbc"]->query("SELECT TalentTab, Row, Col, Talent1, TalentCount1 FROM talent WHERE spell4='" . $talent_spell . "' LIMIT 1"))) {
                        if (isset($tabs[$tab["TalentTab"]][$tab["Row"]][$tab["Col"]])) {
                            $l -= $tabs[$tab["TalentTab"]][$tab["Row"]][$tab["Col"]][1];
                        }
                        $tabs[$tab["TalentTab"]][$tab["Row"]][$tab["Col"]] = array($talent_spell, "4", $tab["Spell5"] ? "2" : "5");
                        $l += 4;
                        if ($tab["Talent1"]) {
                            talent_dependencies($tabs, $tab, $l);
                        }
                    } elseif ($tab = $sql["dbc"]->fetch_assoc($sql["dbc"]->query("SELECT TalentTab, Row, Col, Talent1, TalentCount1 FROM talent WHERE spell3='" . $talent_spell . "' LIMIT 1"))) {
                        if (isset($tabs[$tab["TalentTab"]][$tab["Row"]][$tab["Col"]])) {
                            $l -= $tabs[$tab["TalentTab"]][$tab["Row"]][$tab["Col"]][1];
                        }
                        $tabs[$tab["TalentTab"]][$tab["Row"]][$tab["Col"]] = array($talent_spell, "3", $tab["Spell4"] ? "2" : "5");
                        $l += 3;
                        if ($tab["Talent1"]) {
                            talent_dependencies($tabs, $tab, $l);
                        }
                    } elseif ($tab = $sql["dbc"]->fetch_assoc($sql["dbc"]->query("SELECT TalentTab, Row, Col, Talent1, TalentCount1 FROM talent WHERE spell2='" . $talent_spell . "' LIMIT 1"))) {
                        if (isset($tabs[$tab["TalentTab"]][$tab["Row"]][$tab["Col"]])) {
                            $l -= $tabs[$tab["TalentTab"]][$tab["Row"]][$tab["Col"]][1];
                        }
                        $tabs[$tab["TalentTab"]][$tab["Row"]][$tab["Col"]] = array($talent_spell, "2", $tab["Spell3"] ? "2" : "5");
                        $l += 2;
                        if ($tab["Talent1"]) {
                            talent_dependencies($tabs, $tab, $l);
                        }
                    } elseif ($tab = $sql["dbc"]->fetch_assoc($sql["dbc"]->query("SELECT TalentTab, Row, Col, Talent1, TalentCount1 FROM talent WHERE spell1='" . $talent_spell . "' LIMIT 1"))) {
                        if (isset($tabs[$tab["TalentTab"]][$tab["Row"]][$tab["Col"]])) {
                            $l -= $tabs[$tab["TalentTab"]][$tab["Row"]][$tab["Col"]][1];
                        }
                        $tabs[$tab["TalentTab"]][$tab["Row"]][$tab["Col"]] = array($talent_spell, '1', $tab["Spell2"] ? "2" : "5");
                        $l += 1;
                        if ($tab["Talent1"]) {
                            talent_dependencies($tabs, $tab, $l);
                        }
                    }
                }
                unset($tab);
                unset($talent);
                $class_name = get_class_name($char["class"]);
                foreach ($tabs as $k => $data) {
                    $talent_name = $sql["dbc"]->result($sql["dbc"]->query("SELECT name FROM talenttab WHERE id='" . $k . "'"), 0, "name");
                    $talent_name = str_replace(" ", "", $talent_name);
                    $points = 0;
                    $output .= '
                  <td>
                    <table class="hidden" id="ch_tal_0_width">
                     <tr>
                       <td colspan="6" style="ch_tal_0_bottom_width">
                       </td>
                     </tr>
                     <tr>';
                    for ($i = 0; $i < 11; ++$i) {
                        for ($j = 0; $j < 4; ++$j) {
                            if (isset($data[$i][$j])) {
                                // this_is_junk: style left hardcoded because it's calculated.
                                $output .= '
                        <td valign="bottom" align="center" style="border-top-width: 0px;border-bottom-width: 0px;background-attachment:fixed;background:url(./img/TALENTFRAME/' . $class_name . $talent_name . '.png) ' . $j * -50 . 'px ' . $i * -50 . 'px">
                          <a href="' . $base_datasite . $spell_datasite . $data[$i][$j][0] . '" rel="external">
                            <img src="' . spell_get_icon($data[$i][$j][0]) . '" width="36" height="36" class="icon_border_' . $data[$i][$j][2] . '" alt="" />
                          </a>
                          <div class="ch_tal_level_shadow">' . $data[$i][$j][1] . '</div>
                          <div class="ch_tal_level">' . $data[$i][$j][1] . '</div>
                        </td>';
                                $points += $data[$i][$j][1];
                            } else {
                                $output .= '
                        <td valign="bottom" align="center" style="border-top-width: 0px;border-bottom-width: 0px;background-attachment:fixed;background:url(./img/TALENTFRAME/' . $class_name . $talent_name . '.png) ' . $j * -50 . 'px ' . $i * -50 . 'px">
                          <img src="img/blank.gif" width="44" height="44" alt="" />
                        </td>';
                            }
                        }
                        $output .= '
                      </tr>
                      <tr>';
                    }
                    $output .= '
                       <td colspan="6" id="ch_tal_0_top_bottom_width">
                       </td>
                     </tr>
                      <tr>
                        <td colspan="6" valign="bottom" align="left">
                         ' . $sql["dbc"]->result($sql["dbc"]->query("SELECT name FROM talenttab WHERE id='" . $k . "'"), 0, "name") . ': ' . $points . '
                        </td>
                      </tr>
                    </table>
                  </td>';
                }
                unset($data);
                unset($k);
                unset($tabs);
                $output .= '
                </tr>
              </table>
              <br />
              <table class="center">
                <tr>
                  <td align="left">
                    ' . lang("char", "talent_rate") . ': <br />
                    ' . lang("char", "talent_points") . ': <br />
                    ' . lang("char", "talent_points_used") . ': <br />
                    ' . lang("char", "talent_points_shown") . ': <br />
                    ' . lang("char", "talent_points_left") . ':
                  </td>
                  <td align="left">
                    ' . $talent_rate . '<br />
                    ' . $talent_points . '<br />
                    ' . $talent_points_used . '<br />
                    ' . $l . '<br />
                    ' . $talent_points_left . '
                  </td>
                  <td style="width: 64px">
                  </td>
                  <td align="right">';
                unset($l);
                unset($talent_rate);
                unset($talent_points);
                unset($talent_points_used);
                unset($talent_points_left);
                if ($core == 1) {
                    $glyph_query = "SELECT glyphs" . $cur_spec . " FROM characters WHERE guid='" . $id . "'";
                    $glyph_results = $sql["char"]->query($glyph_query);
                    $glyph_field = $sql["char"]->fetch_assoc($glyph_results);
                    $glyphs = $glyph_field["glyphs1"];
                    $glyphs = substr($glyphs, 0, strlen($glyphs) - 1);
                    $glyphs = explode(',', $glyphs);
                } else {
                    $glyph_query = "SELECT * FROM character_glyphs WHERE guid='" . $id . "' and spec='" . ($cur_spec - 1) . "'";
                    $glyph_result = $sql["char"]->query($glyph_query);
                    $glyph_field = $sql["char"]->fetch_assoc($glyph_result);
                    $glyphs = array();
                    if (isset($glyph_field["glyph1"])) {
                        array_push($glyphs, $glyph_field["glyph1"]);
                    }
                    if (isset($glyph_field["glyph2"])) {
                        array_push($glyphs, $glyph_field["glyph2"]);
                    }
                    if (isset($glyph_field["glyph3"])) {
                        array_push($glyphs, $glyph_field["glyph3"]);
                    }
                    if (isset($glyph_field["glyph4"])) {
                        array_push($glyphs, $glyph_field["glyph4"]);
                    }
                    if (isset($glyph_field["glyph5"])) {
                        array_push($glyphs, $glyph_field["glyph5"]);
                    }
                    if (isset($glyph_field["glyph6"])) {
                        array_push($glyphs, $glyph_field["glyph6"]);
                    }
                }
                for ($i = 0; $i < 6; ++$i) {
                    if ($glyphs[$i]) {
                        $glyph = $sql["dbc"]->result($sql["dbc"]->query("SELECT spellid FROM glyphproperties WHERE id='" . $glyphs[$i] . "'"), 0);
                        $output .= '
                    <a href="' . $base_datasite . $spell_datasite . $glyph . '" rel="external">
                      <img src="' . spell_get_icon($glyph) . '" width="36" height="36" class="icon_border_0" alt="" />
                    </a>';
                    }
                }
                unset($glyphs);
                $output .= '
                  </td>
                </tr>
              </table>';
            }
            //---------------Page Specific Data Ends here----------------------------
            //---------------Character Tabs Footer-----------------------------------
            $output .= '
            </div>
            <br />
            <table class="hidden">
              <tr>
                <td>';
            // button to user account page, user account page has own security
            makebutton(lang("char", "chars_acc"), 'user.php?action=edit_user&amp;id=' . $owner_acc_id . '', 130);
            $output .= '
                </td>
                <td>';
            // only higher level GM with delete access can edit character
            //  character edit allows removal of character items, so delete permission is needed
            if ($user_lvl > $owner_gmlvl && $user_lvl >= $action_permission["delete"]) {
                //makebutton($lang_char["edit_button"], 'char_edit.php?id='.$id.'&amp;realm='.$realmid.'', 130);
                $output .= '
                </td>
                <td>';
            }
            // only higher level GM with delete access, or character owner can delete character
            if ($user_lvl > $owner_gmlvl && $user_lvl >= $action_permission["delete"] || $owner_name === $user_name) {
                makebutton(lang("char", "del_char"), 'char_list.php?action=del_char_form&amp;check%5B%5D=' . $id . '" type="wrn', 130);
                $output .= '
                </td>
                <td>';
            }
            // only GM with update permission can send mail, mail can send items, so update permission is needed
            if ($user_lvl >= $action_permission["update"]) {
                makebutton(lang("char", "send_mail"), 'mail.php?type=ingame_mail&amp;to=' . $char["name"], 130);
                $output .= '
                </td>
                <td>';
            }
            makebutton(lang("global", "back"), 'javascript:window.history.back()" type="def', 130);
            $output .= '
                </td>
              </tr>
            </table>
            <br />
          <!-- end of char_talent.php -->';
        } else {
            error(lang("char", "no_permission"));
        }
    } else {
        error(lang("char", "no_char_found"));
    }
}
Esempio n. 12
0
function char_spell(&$sqlr, &$sqlc)
{
    global $output, $lang_global, $lang_char, $realm_id, $characters_db, $mmfpm_db, $action_permission, $user_lvl, $user_name, $spell_datasite, $itemperpage;
    wowhead_tt();
    if (empty($_GET['id'])) {
        error($lang_global['empty_fields']);
    }
    if (empty($_GET['realm'])) {
        $realmid = $realm_id;
    } else {
        $realmid = $sqlr->quote_smart($_GET['realm']);
        if (is_numeric($realmid)) {
            $sqlc->connect($characters_db[$realmid]['addr'], $characters_db[$realmid]['user'], $characters_db[$realmid]['pass'], $characters_db[$realmid]['name']);
        } else {
            $realmid = $realm_id;
        }
    }
    $id = $sqlc->quote_smart($_GET['id']);
    if (is_numeric($id)) {
    } else {
        $id = 0;
    }
    $start = isset($_GET['start']) ? $sqlc->quote_smart($_GET['start']) : 0;
    if (is_numeric($start)) {
    } else {
        $start = 0;
    }
    $result = $sqlc->query('SELECT account, name, race, class, level, gender
    FROM characters WHERE guid = ' . $id . ' LIMIT 1');
    if ($sqlc->num_rows($result)) {
        $char = $sqlc->fetch_assoc($result);
        $owner_acc_id = $sqlc->result($result, 0, 'account');
        $result = $sqlr->query('SELECT gmlevel, username FROM account WHERE id = ' . $char['account'] . '');
        $owner_gmlvl = $sqlr->result($result, 0, 'gmlevel');
        $owner_name = $sqlr->result($result, 0, 'username');
        if ($user_lvl > $owner_gmlvl || $owner_name === $user_name) {
            $all_record = $sqlc->result($sqlc->query('SELECT count(spell) FROM character_spell WHERE guid = ' . $id . ' and active = 1'), 0);
            $result = $sqlc->query('SELECT spell FROM character_spell WHERE guid = ' . $id . ' and active = 1 order by spell ASC LIMIT ' . $start . ', ' . $itemperpage . '');
            $output .= '
          <center>
           <div id="tab_content">
              <div id="tab">
                <ul>
                  <li><a href="char.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['char_sheet'] . '</a></li>
                  <li><a href="char_inv.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['inventory'] . '</a></li>
                  <li><a href="char_extra.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['extra'] . '</a></li>
                  ' . ($char['level'] < 10 ? '' : '<li><a href="char_talent.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['talents'] . '</a></li>') . '
                  <li><a href="char_achieve.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['achievements'] . '</a></li>
                  <li><a href="char_rep.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['reputation'] . '</a></li>
                  <li><a href="char_skill.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['skills'] . '</a></li>
                  <li><a href="char_quest.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['quests'] . '</a></li>';
            if (char_get_class_name($char['class']) === 'Hunter') {
                $output .= '
                  <li><a href="char_pets.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['pets'] . '</a></li>';
            }
            $output .= '
                  <li><a href="char_friends.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['friends'] . '</a></li>
				  <li><a href="char_mail.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['mail'] . '</a></li>
                </ul>
                <ul>';
            // selected char tab at last
            $output .= '
                  <li id="selected"><a href="char_spell.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['spells'] . '</a></li>';
            $output .= '
              </ul>
            </div>
            <div id="tab_content2">
              <font class="bold">
                ' . htmlentities($char['name']) . ' -
                <img src="img/c_icons/' . $char['race'] . '-' . $char['gender'] . '.gif"
                  onmousemove="toolTip(\'' . char_get_race_name($char['race']) . '\', \'item_tooltip\')" onmouseout="toolTip()" alt="" />
                <img src="img/c_icons/' . $char['class'] . '.gif"
                  onmousemove="toolTip(\'' . char_get_class_name($char['class']) . '\',\'item_tooltip\')" onmouseout="toolTip()" alt="" /> - lvl ' . char_get_level_color($char['level']) . '
              </font>
              <br /><br />';
            if ($sqlc->num_rows($result)) {
                $output .= '
              <table class="lined" style="width: 550px;">
                <tr align="right">
                  <td colspan="4">';
                $output .= generate_pagination('char_spell.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;start=' . $start . '', $all_record, $itemperpage, $start);
                $output .= '
                  </td>
                </tr>
                <tr>
                  <th>' . $lang_char['icon'] . '</th>
                  <th>' . $lang_char['name'] . '</th>
                  <th>' . $lang_char['icon'] . '</th>
                  <th>' . $lang_char['name'] . '</th>
                </tr>';
                $sqlm = new SQL();
                $sqlm->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']);
                while ($spell = $sqlc->fetch_assoc($result)) {
                    $output .= '
                <tr>
                  <td><a href="' . $spell_datasite . $spell['spell'] . '"><img src="' . spell_get_icon($spell['spell'], $sqlm) . '" class="icon_border_0" /></a></td>
                  <td align="left"><a href="' . $spell_datasite . $spell['spell'] . '">' . spell_get_name($spell['spell'], $sqlm) . '</a></td>';
                    if ($spell = $sqlc->fetch_assoc($result)) {
                        $output .= '
                  <td><a href="' . $spell_datasite . $spell['spell'] . '"><img src="' . spell_get_icon($spell['spell'], $sqlm) . '" class="icon_border_0" /></a></td>
                  <td align="left"><a href="' . $spell_datasite . $spell['spell'] . '">' . spell_get_name($spell['spell'], $sqlm) . '</a></td>
                </tr>';
                    } else {
                        $output .= '
                  <td></td>
                  <td></td>
                </tr>';
                    }
                }
                $output .= '
                <tr align="right">
                  <td colspan="4">';
                $output .= generate_pagination('char_spell.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;start=' . $start . '', $all_record, $itemperpage, $start);
                $output .= '
                  </td>
                </tr>
              </table>';
            }
            //---------------Page Specific Data Ends here----------------------------
            //---------------Character Tabs Footer-----------------------------------
            $output .= '
            </div>
            </div>
            <br />
            <table class="hidden">
              <tr>
                <td>';
            // button to user account page, user account page has own security
            makebutton($lang_char['chars_acc'], 'user.php?action=edit_user&amp;id=' . $owner_acc_id . '', 130);
            $output .= '
                </td>
                <td>';
            // only higher level GM with delete access can edit character
            //  character edit allows removal of character items, so delete permission is needed
            if ($user_lvl > $owner_gmlvl && $user_lvl >= $action_permission['delete']) {
                makebutton($lang_char['edit_button'], 'char_edit.php?id=' . $id . '&amp;realm=' . $realmid . '', 130);
                $output .= '
                </td>
                <td>';
            }
            // only higher level GM with delete access, or character owner can delete character
            if ($user_lvl > $owner_gmlvl && $user_lvl >= $action_permission['delete'] || $owner_name === $user_name) {
                makebutton($lang_char['del_char'], 'char_list.php?action=del_char_form&amp;check%5B%5D=' . $id . '" type="wrn', 130);
                $output .= '
                </td>
                <td>';
            }
            // only GM with update permission can send mail, mail can send items, so update permission is needed
            if ($user_lvl >= $action_permission['update']) {
                makebutton($lang_char['send_mail'], 'mail.php?type=ingame_mail&amp;to=' . $char['name'] . '', 130);
                $output .= '
                </td>
                <td>';
            }
            makebutton($lang_global['back'], 'javascript:window.history.back()" type="def', 130);
            $output .= '
                </td>
              </tr>
            </table>
            <br />
          </center>
          <!-- end of char_spell.php -->';
        } else {
            error($lang_char['no_permission']);
        }
    } else {
        error($lang_char['no_char_found']);
    }
}
Esempio n. 13
0
function char_talent(&$sqlr, &$sqlc)
{
    global $output, $lang_global, $lang_char, $realm_id, $realm_db, $characters_db, $mmfpm_db, $server, $action_permission, $user_lvl, $user_name, $spell_datasite;
    // this page uses wowhead tooltops
    wowhead_tt();
    require_once 'core/char/char_security.php';
    $result = $sqlc->query('SELECT account, name, race, class, level, gender, (SELECT count(spell) FROM character_talent WHERE guid = ' . $id . ' AND spec = (SELECT activespec FROM characters WHERE guid = ' . $id . ')) AS talent_points
        FROM characters WHERE guid = ' . $id . ' LIMIT 1');
    if ($sqlc->num_rows($result)) {
        $char = $sqlc->fetch_assoc($result);
        $owner_acc_id = $sqlc->result($result, 0, 'account');
        $result = $sqlr->query('SELECT `username`, `gmlevel` FROM `account` LEFT JOIN `account_access` ON `account`.`id`=`account_access`.`id` WHERE `account`.`id` = ' . $owner_acc_id . ' ORDER BY `gmlevel` DESC LIMIT 1');
        $owner_name = $sqlr->result($result, 0, 'username');
        $owner_gmlvl = $sqlr->result($result, 0, 'gmlevel');
        if (empty($owner_gmlvl)) {
            $owner_gmlvl = 0;
        }
        if ($user_lvl > $owner_gmlvl || $owner_name === $user_name) {
            $result = $sqlc->query('SELECT spell FROM character_spell WHERE guid = ' . $id . ' and active = 1 and disabled = 0 ORDER BY spell DESC');
            $output .= '
                        <center>
                            <div id="tab_content">
                                <h1>' . $lang_char['talents'] . '</h1>
                                <br />';
            require_once 'core/char/char_header.php';
            $output .= '
                                <br /><br />
                                <table class="lined" style="width: 550px;">
                                    <tr valign="top" align="center">';
            if ($sqlc->num_rows($result)) {
                $talent_rate = isset($server[$realmid]['talent_rate']) ? $server[$realmid]['talent_rate'] : 1;
                $talent_points = ($char['level'] - 9) * $talent_rate;
                $talent_points_left = $char['talent_points'];
                $talent_points_used = $talent_points - $talent_points_left;
                $sqlm = new SQL();
                $sqlm->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']);
                $tabs = array();
                $l = 0;
                while (($talent = $sqlc->fetch_assoc($result)) && $l < $talent_points_used) {
                    if ($tab = $sqlm->fetch_assoc($sqlm->query('SELECT field_1, field_2, field_3, field_13, field_16 from dbc_talent where field_8 = ' . $talent['spell'] . ' LIMIT 1'))) {
                        if (isset($tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']])) {
                            $l -= $tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']][1];
                        }
                        $tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']] = array($talent['spell'], '5', '5');
                        $l += 5;
                        if ($tab['field_13']) {
                            talent_dependencies($tabs, $tab, $l, $sqlm);
                        }
                    } elseif ($tab = $sqlm->fetch_assoc($sqlm->query('SELECT field_1, field_2, field_3, field_13, field_16, field_8 from dbc_talent where field_7 = ' . $talent['spell'] . ' LIMIT 1'))) {
                        if (isset($tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']])) {
                            $l -= $tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']][1];
                        }
                        $tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']] = array($talent['spell'], '4', $tab['field_8'] ? '2' : '5');
                        $l += 4;
                        if ($tab['field_13']) {
                            talent_dependencies($tabs, $tab, $l, $sqlm);
                        }
                    } elseif ($tab = $sqlm->fetch_assoc($sqlm->query('SELECT field_1, field_2, field_3, field_13, field_16, field_7 from dbc_talent where field_6 = ' . $talent['spell'] . ' LIMIT 1'))) {
                        if (isset($tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']])) {
                            $l -= $tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']][1];
                        }
                        $tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']] = array($talent['spell'], '3', $tab['field_7'] ? '2' : '5');
                        $l += 3;
                        if ($tab['field_13']) {
                            talent_dependencies($tabs, $tab, $l, $sqlm);
                        }
                    } elseif ($tab = $sqlm->fetch_assoc($sqlm->query('SELECT field_1, field_2, field_3, field_13, field_16, field_6 from dbc_talent where field_5 = ' . $talent['spell'] . ' LIMIT 1'))) {
                        if (isset($tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']])) {
                            $l -= $tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']][1];
                        }
                        $tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']] = array($talent['spell'], '2', $tab['field_6'] ? '2' : '5');
                        $l += 2;
                        if ($tab['field_13']) {
                            talent_dependencies($tabs, $tab, $l, $sqlm);
                        }
                    } elseif ($tab = $sqlm->fetch_assoc($sqlm->query('SELECT field_1, field_2, field_3, field_13, field_16, field_5 from dbc_talent where field_4 = ' . $talent['spell'] . ' LIMIT 1'))) {
                        if (isset($tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']])) {
                            $l -= $tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']][1];
                        }
                        $tabs[$tab['field_1']][$tab['field_2']][$tab['field_3']] = array($talent['spell'], '1', $tab['field_5'] ? '2' : '5');
                        $l += 1;
                        if ($tab['field_13']) {
                            talent_dependencies($tabs, $tab, $l, $sqlm);
                        }
                    }
                }
                unset($tab);
                unset($talent);
                foreach ($tabs as $k => $data) {
                    $points = 0;
                    $output .= '
                                        <td>
                                            <table class="hidden" style="width: 0px;">
                                                <tr>
                                                    <td colspan="6" style="border-bottom-width: 0px;">
                                                    </td>
                                                </tr>
                                                <tr>';
                    for ($i = 0; $i < 11; ++$i) {
                        for ($j = 0; $j < 4; ++$j) {
                            if (isset($data[$i][$j])) {
                                $output .= '
                                                    <td valign="bottom" align="center" style="border-top-width: 0px;border-bottom-width: 0px;">
                                                        <a href="' . $spell_datasite . $data[$i][$j][0] . '" target="_blank">
                                                            <img src="' . spell_get_icon($data[$i][$j][0], $sqlm) . '" width="36" height="36" class="icon_border_' . $data[$i][$j][2] . '" alt="" />
                                                        </a>
                                                        <div style="width:0px;margin:-14px 0px 0px 30px;font-size:14px;color:black">' . $data[$i][$j][1] . '</div>
                                                        <div style="width:0px;margin:-14px 0px 0px 29px;font-size:14px;color:white">' . $data[$i][$j][1] . '</div>
                                                    </td>';
                                $points += $data[$i][$j][1];
                            } else {
                                $output .= '
                                                    <td valign="bottom" align="center" style="border-top-width: 0px;border-bottom-width: 0px;">
                                                        <img src="img/blank.gif" width="44" height="44" alt="" />
                                                    </td>';
                            }
                        }
                        $output .= '
                                                </tr>
                                                <tr>';
                    }
                    $output .= '
                                                    <td colspan="6" style="border-top-width: 0px;border-bottom-width: 0px;">
                                                        </td>
                                                </tr>
                                                <tr>
                                                    <td colspan="6" valign="bottom" align="left">
                                                    ' . $sqlm->result($sqlm->query('SELECT field_1 FROM dbc_talenttab WHERE id = ' . $k . ''), 0, 'field_1') . ': ' . $points . '
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>';
                }
                unset($data);
                unset($k);
                unset($tabs);
                $output .= '
                                    </tr>
                                </table>
                                <br />
                                <table>
                                    <tr>
                                        <td align="left">
                                            ' . $lang_char['talent_rate'] . ': <br />
                                            ' . $lang_char['talent_points'] . ': <br />
                                            ' . $lang_char['talent_points_used'] . ': <br />
                                            ' . $lang_char['talent_points_shown'] . ': <br />
                                            ' . $lang_char['talent_points_left'] . ':
                                        </td>
                                        <td align="left">
                                            ' . $talent_rate . '<br />
                                            ' . $talent_points . '<br />
                                            ' . $talent_points_used . '<br />
                                            ' . $l . '<br />
                                            ' . $talent_points_left . '
                                        </td>
                                        <td width="64">
                                        </td>
                                        <td align="right">';
                unset($l);
                unset($talent_rate);
                unset($talent_points);
                unset($talent_points_used);
                unset($talent_points_left);
                $result = $sqlc->query('SELECT * FROM character_glyphs WHERE guid = ' . $id . ' AND spec = (SELECT activespec FROM characters WHERE guid = ' . $id . ')');
                if ($sqlc->num_rows($result)) {
                    $glyphs = $sqlc->fetch_assoc($result);
                    $glyphs = array($glyphs['glyph1'], $glyphs['glyph2'], $glyphs['glyph3'], $glyphs['glyph4'], $glyphs['glyph5'], $glyphs['glyph6']);
                    // didnt want to recode the block down there
                } else {
                    $glyphs = array(0, 0, 0, 0, 0, 0, 0);
                }
                for ($i = 0; $i < 6; ++$i) {
                    if ($glyphs[$i] && $glyphs[$i] > 0) {
                        $glyph = $sqlm->result($sqlm->query('select IFNULL(field_1,0) from dbc_glyphproperties where id = ' . $glyphs[$i] . ''), 0);
                        $output .= '
                                            <a href="' . $spell_datasite . $glyph . '" target="_blank">
                                                <img src="' . spell_get_icon($glyph, $sqlm) . '" width="36" height="36" class="icon_border_0" alt="" />
                                            </a>';
                    }
                }
                unset($glyphs);
                $output .= '
                                        </td>';
            }
            //---------------Page Specific Data Ends here----------------------------
            //---------------Character Tabs Footer-----------------------------------
            $output .= '
                                    </tr>
                                </table>
                            </div>
                            </div>
                            <br />';
            require_once 'core/char/char_footer.php';
            $output .= '
                            <br />
                        </center>
                        <!-- end of char_talent.php -->';
        } else {
            error($lang_char['no_permission']);
        }
    } else {
        error($lang_char['no_char_found']);
    }
}
Esempio n. 14
0
function char_mounts(&$sqlr, &$sqlc, &$sqlm)
{
    global $output, $lang_global, $lang_char, $realm_id, $characters_db, $mmfpm_db, $action_permission, $user_lvl, $user_name, $spell_datasite;
    // this page uses wowhead tooltops
    wowhead_tt();
    //==========================$_GET and SECURE=================================
    // id and multi realm security to prevent sql injection
    require_once './include/char/include/char_multi_realm_security.php';
    //==========================$_GET and SECURE end=============================
    // getting character data from database
    $result = $sqlc->query('
		SELECT account, name, race, class, gender, level
		FROM characters
		WHERE guid = ' . $id . '
		LIMIT 1');
    // no point going further if character does not exist
    if ($sqlc->num_rows($result)) {
        $char = $sqlc->fetch_assoc($result);
        // we get user permissions first
        $owner_acc_id = $sqlc->result($result, 0, 'account');
        $result = $sqlr->query('
			SELECT gmlevel, username 
			FROM account 
			WHERE id = ' . $char['account'] . '');
        $owner_gmlvl = $sqlr->result($result, 0, 'gmlevel');
        $owner_name = $sqlr->result($result, 0, 'username');
        // check user permission
        if ($user_lvl > $owner_gmlvl || $owner_name === $user_name) {
            // character sub header
            $output .= '
<center>
<div id="tab_content">
	<h1>' . $lang_char['spells'] . '</h1>
	<br />';
            // character menu tab
            require_once './include/char/include/char_header.php';
            // character info
            require_once './include/char/include/char_info.php';
            //---------------Page Specific Data Starts Here--------------------------
            $output .= '
	<h1>' . $lang_char['mounts'] . '</h1>
	<br />';
            // character extra menu tab
            require_once './include/char/include/char_spell_header.php';
            $output .= '
	<div id="tab_content2">
		<table class="lined" style="width: 450px;">
			<tr>
				<th width="15%">' . $lang_char['icon'] . '</th>
				<th width="85%">' . $lang_char['name'] . '</th>
			</tr>';
            $sqlm = new SQL();
            $sqlm->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']);
            // SkillLine 777 = mount
            $skilllineability = $sqlm->query('
				SELECT field_2 
				FROM dbc_skilllineability
				WHERE field_1 = 777');
            while ($spells = $sqlm->fetch_assoc($skilllineability)) {
                // to get from char spells just spell that we want
                $spell = $sqlc->query('
					SELECT spell 
					FROM character_spell 
					WHERE guid = ' . $id . ' AND spell = ' . $spells['field_2'] . ' ');
                while ($character = $sqlc->fetch_assoc($spell)) {
                    $output .= '
			<tr valign="center">
				<td >
					<a style="padding:2px;" href="' . $spell_datasite . $character['spell'] . '" target="_blank">
						<img src="' . spell_get_icon($character['spell'], $sqlm) . '" alt="' . $character['spell'] . '" class="icon_border_0" />
					</a>
				</td>
				<td width="90%" align="center">
					' . spell_get_name($character['spell'], $sqlm) . '
				</td>
			</tr>';
                }
            }
            $output .= '
		</table>
	</div>
</div>
<br />';
            unset($skilllineability);
            unset($spell);
            unset($spells);
            unset($character);
            //---------------Page Specific Data Ends Here--------------------------
            // character sub footer
            require_once './include/char/include/char_ footer.php';
            $output .= '
<br />
</center>';
        } else {
            error($lang_char['no_permission']);
        }
    } else {
        error($lang_char['no_char_found']);
    }
}
Esempio n. 15
0
function char_pets(&$sqlr, &$sqlc)
{
    global $output, $lang_global, $lang_char, $realm_id, $characters_db, $mmfpm_db, $action_permission, $user_lvl, $user_name, $spell_datasite, $pet_ability;
    wowhead_tt();
    if (empty($_GET['id'])) {
        error($lang_global['empty_fields']);
    }
    if (empty($_GET['realm'])) {
        $realmid = $realm_id;
    } else {
        $realmid = $sqlr->quote_smart($_GET['realm']);
        if (is_numeric($realmid)) {
            $sqlc->connect($characters_db[$realmid]['addr'], $characters_db[$realmid]['user'], $characters_db[$realmid]['pass'], $characters_db[$realmid]['name']);
        } else {
            $realmid = $realm_id;
        }
    }
    $id = $sqlc->quote_smart($_GET['id']);
    if (is_numeric($id)) {
    } else {
        $id = 0;
    }
    $result = $sqlc->query('SELECT account, name, race, class, level, gender FROM characters WHERE guid = ' . $id . ' LIMIT 1');
    if ($sqlc->num_rows($result)) {
        $char = $sqlc->fetch_assoc($result);
        $owner_acc_id = $sqlc->result($result, 0, 'account');
        $result = $sqlr->query('SELECT gmlevel, username FROM account WHERE id = ' . $char['account'] . '');
        $owner_gmlvl = $sqlr->result($result, 0, 'gmlevel');
        $owner_name = $sqlr->result($result, 0, 'username');
        if ($user_lvl > $owner_gmlvl || $owner_name === $user_name) {
            $output .= '
		<center>
		<div id="tab_content">
		<div id="tab">
		<ul>
			<li><a href="char.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['char_sheet'] . '</a></li>
			<li><a href="char_inv.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['inventory'] . '</a></li>
            <li><a href="char_extra.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['extra'] . '</a></li>
			' . ($char['level'] < 10 ? '' : '<li><a href="char_talent.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['talents'] . '</a></li>') . '
			<li><a href="char_achieve.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['achievements'] . '</a></li>
			<li><a href="char_rep.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['reputation'] . '</a></li>
			<li><a href="char_skill.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['skills'] . '</a></li>
			<li><a href="char_quest.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['quests'] . '</a></li>
			<li><a href="char_friends.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['friends'] . '</a></li>
			<li><a href="char_spell.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['spells'] . '</a></li>
			<li><a href="char_mail.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['mail'] . '</a></li>
		</ul>
		<ul>';
            // selected char tab at last
            $output .= '
			<li id="selected"><a href="char_pets.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['pets'] . '</a></li>';
            $output .= '
		</ul>
		</div>
		<div id="tab_content2">
		<font class="bold">
		' . htmlentities($char['name']) . ' -
		<img src="img/c_icons/' . $char['race'] . '-' . $char['gender'] . '.gif"
		onmousemove="toolTip(\'' . char_get_race_name($char['race']) . '\', \'item_tooltip\')" onmouseout="toolTip()" alt="" />
		<img src="img/c_icons/' . $char['class'] . '.gif"
		onmousemove="toolTip(\'' . char_get_class_name($char['class']) . '\',\'item_tooltip\')" onmouseout="toolTip()" alt="" /> - lvl ' . char_get_level_color($char['level']) . '
		</font>
		<br /><br />';
            $result = $sqlc->query('SELECT id, level, exp, name, curhappiness FROM character_pet WHERE owner = ' . $id . '');
            if ($sqlc->num_rows($result)) {
                $sqlm = new SQL();
                $sqlm->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']);
                while ($pet = $sqlc->fetch_assoc($result)) {
                    $happiness = floor($pet['curhappiness'] / 333000);
                    if (1 == $happiness) {
                        $hap_text = 'Content';
                        $hap_val = 1;
                    } elseif (2 == $happiness) {
                        $hap_text = 'Happy';
                        $hap_val = 2;
                    } else {
                        $hap_text = 'Unhappy';
                        $hap_val = 0;
                    }
                    $pet_next_lvl_xp = floor(char_get_xp_to_level($pet['level']) / 4);
                    $output .= '
				<font class="bold">' . $pet['name'] . ' - lvl ' . char_get_level_color($pet['level']) . '
				<a style="padding:2px;" onmouseover="toolTip(\'' . $hap_text . '\', \'item_tooltip\')" onmouseout="toolTip()"><img src="img/pet/happiness_' . $hap_val . '.jpg" alt="" /></a>
				<br /><br />
				</font>
				<table class="lined" style="width: 550px;">
					<tr>
						<td align="right">Exp:</td>
						<td valign="top" class="bar skill_bar" style="background-position: ' . (round(385 * $pet['exp'] / $pet_next_lvl_xp) - 385) . 'px;">
							<span>' . $pet['exp'] . '/' . $pet_next_lvl_xp . '</span>
						</td>
					</tr>
					<tr>
						<td align="right">Pet Abilities:</td>
						<td align="left">';
                    $ability_results = $sqlc->query('SELECT spell FROM pet_spell WHERE guid = ' . $pet['id'] . ' and active > 1');
                    // active = 0 is unused and active = 1 probably some passive auras, i dont know diference between values 129 and 193, need to check mangos source
                    if ($sqlc->num_rows($ability_results)) {
                        while ($ability = $sqlc->fetch_assoc($ability_results)) {
                            $output .= '
									<a style="padding:2px;" href="' . $spell_datasite . $ability['spell'] . '" target="_blank">
										<img src="' . spell_get_icon($ability['spell'], $sqlm) . '" alt="' . $ability['spell'] . '" class="icon_border_0" />
									</a>';
                        }
                    }
                    $output .= '
						</td>
					</tr>
				</table>
		<br /><br />';
                }
                unset($ability_results);
                unset($pet_next_lvl_xp);
                unset($happiness);
                unset($pet);
            }
            $output .= '
</div>
</div>
<br />
<table class="hidden">
	<tr>
		<td>';
            // button to user account page, user account page has own security
            makebutton($lang_char['chars_acc'], 'user.php?action=edit_user&amp;id=' . $owner_acc_id . '', 130);
            $output .= '
		</td>
		<td>';
            // only higher level GM with delete access can edit character
            //  character edit allows removal of character items, so delete permission is needed
            if ($user_lvl > $owner_gmlvl && $user_lvl >= $action_permission['delete']) {
                makebutton($lang_char['edit_button'], 'char_edit.php?id=' . $id . '&amp;realm=' . $realmid . '', 130);
                $output .= '
				</td>
				<td>';
            }
            // only higher level GM with delete access, or character owner can delete character
            if ($user_lvl > $owner_gmlvl && $user_lvl >= $action_permission['delete'] || $owner_name === $user_name) {
                makebutton($lang_char['del_char'], 'char_list.php?action=del_char_form&amp;check%5B%5D=' . $id . '" type="wrn', 130);
                $output .= '
				</td>
				<td>';
            }
            // only GM with update permission can send mail, mail can send items, so update permission is needed
            if ($user_lvl >= $action_permission['update']) {
                makebutton($lang_char['send_mail'], 'mail.php?type=ingame_mail&amp;to=' . $char['name'] . '', 130);
                $output .= '
					</td>
					<td>';
            }
            makebutton($lang_global['back'], 'javascript:window.history.back()" type="def', 130);
            $output .= '
					</td>
					</tr>
					</table>
					<br />
					</center>
					<!-- end of char_pets.php -->';
        } else {
            error($lang_char['no_permission']);
        }
    } else {
        error($lang_char['no_char_found']);
    }
}
Esempio n. 16
0
function char_pets(&$sqlr, &$sqlc)
{
    global $output, $lang_global, $lang_char, $realm_id, $characters_db, $mmfpm_db, $action_permission, $user_lvl, $user_name, $spell_datasite, $pet_ability;
    wowhead_tt();
    require_once 'core/char/char_security.php';
    $result = $sqlc->query('SELECT account, name, race, class, level, gender FROM characters WHERE guid = ' . $id . ' LIMIT 1');
    if ($sqlc->num_rows($result)) {
        $char = $sqlc->fetch_assoc($result);
        $owner_acc_id = $sqlc->result($result, 0, 'account');
        $result = $sqlr->query('SELECT `username`, `gmlevel` FROM `account` LEFT JOIN `account_access` ON `account`.`id`=`account_access`.`id` WHERE `account`.`id` = ' . $owner_acc_id . ' ORDER BY `gmlevel` DESC LIMIT 1');
        $owner_name = $sqlr->result($result, 0, 'username');
        $owner_gmlvl = $sqlr->result($result, 0, 'gmlevel');
        if (empty($owner_gmlvl)) {
            $owner_gmlvl = 0;
        }
        if ($user_lvl > $owner_gmlvl || $owner_name === $user_name) {
            $output .= '
                    <center>
                        <div id="tab_content">
                        <h1>' . $lang_char['pets'] . '</h1>
                        <br />';
            require_once 'core/char/char_header.php';
            $output .= '
                        <br /><br />';
            $result = $sqlc->query('SELECT id, level, exp, name, curhappiness FROM character_pet WHERE owner = ' . $id . '');
            if ($sqlc->num_rows($result)) {
                $sqlm = new SQL();
                $sqlm->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']);
                while ($pet = $sqlc->fetch_assoc($result)) {
                    $happiness = floor($pet['curhappiness'] / 333000);
                    if (1 == $happiness) {
                        $hap_text = 'Content';
                        $hap_val = 1;
                    } elseif (2 == $happiness) {
                        $hap_text = 'Happy';
                        $hap_val = 2;
                    } else {
                        $hap_text = 'Unhappy';
                        $hap_val = 0;
                    }
                    $pet_next_lvl_xp = floor(char_get_xp_to_level($pet['level']) / 4);
                    $output .= '
                        <font class="bold">' . $pet['name'] . ' - lvl ' . char_get_level_color($pet['level']) . '
                            <a style="padding:2px;" onmouseover="toolTip(\'' . $hap_text . '\', \'item_tooltip\')" onmouseout="toolTip()"><img src="img/pet/happiness_' . $hap_val . '.jpg" alt="" /></a>
                            <br /><br />
                        </font>
                        <table class="lined" style="width: 550px;">
                            <tr>
                                <td align="right">Exp:</td>
                                <td valign="top" class="bar skill_bar" style="background-position: ' . (round(385 * $pet['exp'] / $pet_next_lvl_xp) - 385) . 'px;">
                                    <span>' . $pet['exp'] . '/' . $pet_next_lvl_xp . '</span>
                                </td>
                            </tr>
                            <tr>
                                <td align="right">Pet Abilities:</td>
                                <td align="left">';
                    $ability_results = $sqlc->query('SELECT spell FROM pet_spell WHERE guid = ' . $pet['id'] . ' and active > 1');
                    // active = 0 is unused and active = 1 probably some passive auras, i dont know diference between values 129 and 193, need to check mangos source
                    if ($sqlc->num_rows($ability_results)) {
                        while ($ability = $sqlc->fetch_assoc($ability_results)) {
                            $output .= '
                                    <a style="padding:2px;" href="' . $spell_datasite . $ability['spell'] . '" target="_blank">
                                        <img src="' . spell_get_icon($ability['spell'], $sqlm) . '" alt="' . $ability['spell'] . '" class="icon_border_0" />
                                    </a>';
                        }
                    }
                    $output .= '
                                </td>
                            </tr>
                        </table>
                        <br /><br />';
                }
                unset($ability_results);
                unset($pet_next_lvl_xp);
                unset($happiness);
                unset($pet);
            }
            $output .= '
                    </div>
                    </div>
                    <br />';
            require_once 'core/char/char_footer.php';
            $output .= '
                    <br />
                    </center>
                    <!-- end of char_pets.php -->';
        } else {
            error($lang_char['no_permission']);
        }
    } else {
        error($lang_char['no_char_found']);
    }
}