コード例 #1
0
ファイル: item_lib.php プロジェクト: GlassFace/CoreManager2
function get_item_tooltip($item, $ench, $prop, $creator, $durability, $flags)
{
    global $world_db, $realm_id, $locales_search_option, $site_encoding, $sql, $core;
    if ($item) {
        $tooltip = "";
        // properties
        if ($core == 1) {
            $query = "SELECT * FROM itemrandomproperties WHERE ID='" . $prop . "'";
            $result = $sql["dbc"]->query($query);
            $i_prop = $sql["dbc"]->fetch_assoc($result);
        } else {
            if ($prop > 2147483647) {
                // Random Suffix values are stored as "negative" integers
                // this_is_junk: the SpellItemEnchantment value pointed to by the fields in a
                // RandomSuffix have +i instead of a stated value.
                // I'm not sure yet how to translate that.
                // tempararily disabling showing Random Suffixes...
                //$prop = 4294967296 - $prop;
                $query = "SELECT * FROM itemrandomsuffix WHERE ID='" . $prop . "'";
                $result = $sql["dbc"]->query($query);
                $i_prop = $sql["dbc"]->fetch_assoc($result);
            } else {
                // Random Property values are stored as "positive" integers
                $query = "SELECT * FROM itemrandomproperties WHERE ID='" . $prop . "'";
                $result = $sql["dbc"]->query($query);
                $i_prop = $sql["dbc"]->fetch_assoc($result);
            }
        }
        // enchantment
        if ($core == 1) {
            // ArcEmu stores extra (and unneeded) enchantments
            // first, we get all the enchantments
            $temp_ench = explode(";", $ench);
            // then, we just need the enchantment in slot 0
            $ench = 0;
            foreach ($temp_ench as $temp_row) {
                // it seems that we will sometimes get an extra array member. :/
                // we don't want it corrupting our data.
                if ($temp_row != "") {
                    $temp = explode(",", $temp_row);
                    if ($temp[2] == 0) {
                        $ench = $temp[0];
                    }
                }
            }
        }
        $query = "SELECT * FROM spellitemenchantment WHERE ID='" . $ench . "'";
        $result = $sql["dbc"]->query($query);
        $i_ench = $sql["dbc"]->fetch_assoc($result);
        // Localization
        if ($locales_search_option != 0) {
            if ($core == 1) {
                $itemname = htmlspecialchars($item["name"], ENT_COMPAT, $site_encoding);
            } else {
                $itemname = htmlspecialchars($item["name_loc" . $locales_search_option], ENT_COMPAT, $site_encoding);
            }
            // if for some reason there is no localized item name, we'll use the English
            // (hopefully there will be one to show)
            if ($itemname == "") {
                $itemname = htmlspecialchars($item["name"], ENT_COMPAT, $site_encoding);
            }
        } else {
            $itemname = htmlspecialchars($item["name"], ENT_COMPAT, $site_encoding);
        }
        switch ($item["Quality"]) {
            case 0:
                //Grey Poor
                $tooltip .= '<span style="color: #b2c2b9;" class="large">' . $itemname . ' ' . $i_prop["Name"] . '</span><br />';
                break;
            case 1:
                //White Common
                $tooltip .= '<span style="color: white;" class="large">' . $itemname . ' ' . $i_prop["Name"] . '</span><br />';
                break;
            case 2:
                //Green Uncommon
                $tooltip .= '<span style="color: #1eff00;" class="large">' . $itemname . ' ' . $i_prop["Name"] . '</span><br />';
                break;
            case 3:
                //Blue Rare
                $tooltip .= '<span style="color: #0070dd;" class="large">' . $itemname . ' ' . $i_prop["Name"] . '</span><br />';
                break;
            case 4:
                //Purple Epic
                $tooltip .= '<span style="color: #a335ee;" class="large">' . $itemname . ' ' . $i_prop["Name"] . '</span><br />';
                break;
            case 5:
                //Orange Legendary
                $tooltip .= '<span style="color: orange;" class="large">' . $itemname . ' ' . $i_prop["Name"] . '</span><br />';
                break;
            case 6:
                //Gold Artifact
                $tooltip .= '<span style="color: #e5cc80;" class="large">' . $itemname . ' ' . $i_prop["Name"] . '</span><br />';
                break;
            case 7:
                //Gold Heirloom
                $tooltip .= '<span style="color: #e5cc80;" class="large">' . $itemname . ' ' . $i_prop["Name"] . '</span><br />';
                break;
            default:
        }
        $tooltip .= '<span style="color: white;">';
        // bonding
        // first, we check if our item is already bound
        // if not, show how it will bind
        if (($flags && 1) == 1) {
            $tooltip .= lang("item", "bound") . '<br />';
        } else {
            switch ($item["bonding"]) {
                case 1:
                    //Binds when Picked Up
                    $tooltip .= lang("item", "bop") . '<br />';
                    break;
                case 2:
                    //Binds when Equipped
                    $tooltip .= lang("item", "boe") . '<br />';
                    break;
                case 3:
                    //Binds when Used
                    $tooltip .= lang("item", "bou") . '<br />';
                    break;
                case 4:
                    //Quest Item
                    $tooltip .= lang("item", "quest_item") . '<br />';
                    break;
                default:
            }
        }
        if ($core == 1) {
            if ($item["Unique"]) {
                $tooltip .= lang("item", "unique") . '<br />';
            }
        } else {
            if ($item["maxcount"]) {
                $tooltip .= lang("item", "unique") . '<br />';
            }
        }
        switch ($item["InventoryType"]) {
            case 1:
                $tooltip .= lang("item", "head") . ' - ';
                break;
            case 2:
                $tooltip .= lang("item", "neck") . ' - ';
                break;
            case 3:
                $tooltip .= lang("item", "shoulder") . ' - ';
                break;
            case 4:
                $tooltip .= lang("item", "shirt") . ' - ';
                break;
            case 5:
                $tooltip .= lang("item", "chest") . ' - ';
                break;
            case 6:
                $tooltip .= lang("item", "belt") . ' - ';
                break;
            case 7:
                $tooltip .= lang("item", "legs") . ' - ';
                break;
            case 8:
                $tooltip .= lang("item", "feet") . ' - ';
                break;
            case 9:
                $tooltip .= lang("item", "wrist") . ' - ';
                break;
            case 10:
                $tooltip .= lang("item", "gloves") . ' - ';
                break;
            case 11:
                $tooltip .= lang("item", "finger") . ' - ';
                break;
            case 12:
                $tooltip .= lang("item", "trinket") . ' - ';
                break;
            case 13:
                $tooltip .= lang("item", "one_hand") . ' - ';
                break;
            case 14:
                $tooltip .= lang("item", "off_hand") . ' - ';
                break;
            case 16:
                $tooltip .= lang("item", "back") . ' - ';
                break;
            case 18:
                $tooltip .= lang("item", "bag") . '<br />';
                break;
            case 19:
                $tooltip .= lang("item", "tabard") . ' - ';
                break;
            case 20:
                $tooltip .= lang("item", "robe") . ' - ';
                break;
            case 21:
                $tooltip .= lang("item", "main_hand") . ' - ';
                break;
            case 23:
                $tooltip .= lang("item", "tome") . ' - ';
                break;
            default:
        }
        switch ($item["class"]) {
            case 0:
                //Consumable
                $tooltip .= lang("item", "consumable") . '<br />';
                break;
            case 2:
                //Weapon
                switch ($item["subclass"]) {
                    case 0:
                        $tooltip .= lang("item", "axe_1h") . '<br />';
                        break;
                    case 1:
                        $tooltip .= lang("item", "axe_2h") . '<br />';
                        break;
                    case 2:
                        $tooltip .= lang("item", "bow") . '<br />';
                        break;
                    case 3:
                        $tooltip .= lang("item", "rifle") . '<br />';
                        break;
                    case 4:
                        $tooltip .= lang("item", "mace_1h") . '<br />';
                        break;
                    case 5:
                        $tooltip .= lang("item", "mace_2h") . '<br />';
                        break;
                    case 6:
                        $tooltip .= lang("item", "polearm") . '<br />';
                        break;
                    case 7:
                        $tooltip .= lang("item", "sword_1h") . '<br />';
                        break;
                    case 8:
                        $tooltip .= lang("item", "sword_2h") . '<br />';
                        break;
                    case 10:
                        $tooltip .= lang("item", "staff") . '<br />';
                        break;
                    case 11:
                        $tooltip .= lang("item", "exotic_1h") . '<br />';
                        break;
                    case 12:
                        $tooltip .= lang("item", "exotic_2h") . '<br />';
                        break;
                    case 13:
                        $tooltip .= lang("item", "fist_weapon") . '<br />';
                        break;
                    case 14:
                        $tooltip .= lang("item", "misc_weapon") . '<br />';
                        break;
                    case 15:
                        $tooltip .= lang("item", "dagger") . '<br />';
                        break;
                    case 16:
                        $tooltip .= lang("item", "thrown") . '<br />';
                        break;
                    case 17:
                        $tooltip .= lang("item", "spear") . '<br />';
                        break;
                    case 18:
                        $tooltip .= lang("item", "crossbow") . '<br />';
                        break;
                    case 19:
                        $tooltip .= lang("item", "wand") . '<br />';
                        break;
                    case 20:
                        $tooltip .= lang("item", "fishing_pole") . '<br />';
                        break;
                    default:
                }
                break;
            case 4:
                //Armor
                switch ($item["subclass"]) {
                    case 0:
                        $tooltip .= lang("item", "misc") . '<br />';
                        break;
                    case 1:
                        $tooltip .= lang("item", "cloth") . '<br />';
                        break;
                    case 2:
                        $tooltip .= lang("item", "leather") . '<br />';
                        break;
                    case 3:
                        $tooltip .= lang("item", "mail") . '<br />';
                        break;
                    case 4:
                        $tooltip .= lang("item", "plate") . '<br />';
                        break;
                    case 6:
                        $tooltip .= lang("item", "shield") . '<br />';
                        break;
                    default:
                }
                break;
            case 6:
                //Projectile
                switch ($item["subclass"]) {
                    case 2:
                        $tooltip .= lang("item", "arrows") . '<br />';
                        break;
                    case 3:
                        $tooltip .= lang("item", "bullets") . '<br />';
                        break;
                    default:
                }
                break;
            case 7:
                //Trade Goods
                switch ($item["subclass"]) {
                    case 0:
                        $tooltip .= lang("item", "trade_goods") . '<br />';
                        break;
                    case 1:
                        $tooltip .= lang("item", "parts") . '<br />';
                        break;
                    case 2:
                        $tooltip .= lang("item", "explosives") . '<br />';
                        break;
                    case 3:
                        $tooltip .= lang("item", "devices") . '<br />';
                        break;
                    default:
                }
                break;
            case 9:
                //Recipe
                switch ($item["subclass"]) {
                    case 0:
                        $tooltip .= lang("item", "book") . '<br />';
                        break;
                    case 1:
                        $tooltip .= lang("item", "LW_pattern") . '<br />';
                        break;
                    case 2:
                        $tooltip .= lang("item", "tailoring_pattern") . '<br />';
                        break;
                    case 3:
                        $tooltip .= lang("item", "ENG_Schematic") . '<br />';
                        break;
                    case 4:
                        $tooltip .= lang("item", "BS_plans") . '<br />';
                        break;
                    case 5:
                        $tooltip .= lang("item", "cooking_recipe") . '<br />';
                        break;
                    case 6:
                        $tooltip .= lang("item", "alchemy_recipe") . '<br />';
                        break;
                    case 7:
                        $tooltip .= lang("item", "FA_manual") . '<br />';
                        break;
                    case 8:
                        $tooltip .= lang("item", "ench_formula") . '<br />';
                        break;
                    case 9:
                        $tooltip .= lang("item", "JC_formula") . '<br />';
                        break;
                    default:
                }
                break;
            case 11:
                //Quiver
                switch ($item["subclass"]) {
                    case 2:
                        $tooltip .= ' ' . lang("item", "quiver") . '<br />';
                        break;
                    case 3:
                        $tooltip .= ' ' . lang("item", "ammo_pouch") . '<br />';
                        break;
                    default:
                }
                break;
            case 12:
                //Quest
                if ($item["bonding"] != 4) {
                    $tooltip .= lang("item", "quest_item") . '<br />';
                }
                break;
            case 13:
                //key
                switch ($item["subclass"]) {
                    case 0:
                        $tooltip .= lang("item", "key") . '<br />';
                        break;
                    case 1:
                        $tooltip .= lang("item", "lockpick") . '<br />';
                        break;
                    default:
                }
                break;
            default:
        }
        $tooltip .= $item["armor"] ? $item["armor"] . ' ' . lang("item", "armor") . '<br />' : '';
        for ($f = 37; $f <= 41; $f += 3) {
            // why does it count so high if there are so few damage values?
            switch ($f) {
                case 37:
                    $type = "dmg_type1";
                    $min = "dmg_min1";
                    $max = "dmg_max1";
                    break;
                case 40:
                    $type = "dmg_type2";
                    $min = "dmg_min2";
                    $max = "dmg_max2";
                    break;
            }
            $dmg_type = $item[$type];
            $min_dmg_value = $item[$min];
            $max_dmg_value = $item[$max];
            if ($min_dmg_value && $max_dmg_value) {
                switch ($dmg_type) {
                    case 0:
                        // Physical
                        $tooltip .= $min_dmg_value . ' - ' . $max_dmg_value . ' ' . lang("item", "damage") . '<br />(' . ($item["delay"] ? round(($min_dmg_value + $max_dmg_value) / 2 / ($item["delay"] / 1000), 2) : $min_dmg_value) . ' DPS)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . lang("item", "speed") . ' : ' . $item["delay"] / 1000 . '<br />';
                        break;
                    case 1:
                        // Holy
                        $tooltip .= $min_dmg_value . ' - ' . $max_dmg_value . ' ' . lang("item", "holy_dmg") . '<br />';
                        break;
                    case 2:
                        // Fire
                        $tooltip .= $min_dmg_value . ' - ' . $max_dmg_value . ' ' . lang("item", "fire_dmg") . '<br />';
                        break;
                    case 3:
                        // Nature
                        $tooltip .= $min_dmg_value . ' - ' . $max_dmg_value . ' ' . lang("item", "nature_dmg") . '<br />';
                        break;
                    case 4:
                        // Frost
                        $tooltip .= $min_dmg_value . ' - ' . $max_dmg_value . ' ' . lang("item", "frost_dmg") . '<br />';
                        break;
                    case 5:
                        // Shadow
                        $tooltip .= $min_dmg_value . ' - ' . $max_dmg_value . ' ' . lang("item", "shadow_dmg") . '<br />';
                        break;
                    case 6:
                        // Arcane
                        $tooltip .= $min_dmg_value . ' - ' . $max_dmg_value . ' ' . lang("item", "arcane_dmg") . '<br />';
                        break;
                    default:
                }
            }
        }
        //basic status
        for ($s = 0; $s <= 18; $s += 2) {
            switch ($s) {
                case 0:
                    $type = "stat_type1";
                    $value = "stat_value1";
                    break;
                case 2:
                    $type = "stat_type2";
                    $value = "stat_value2";
                    break;
                case 4:
                    $type = "stat_type3";
                    $value = "stat_value3";
                    break;
                case 6:
                    $type = "stat_type4";
                    $value = "stat_value4";
                    break;
                case 8:
                    $type = "stat_type5";
                    $value = "stat_value5";
                    break;
                case 10:
                    $type = "stat_type6";
                    $value = "stat_value6";
                    break;
                case 12:
                    $type = "stat_type7";
                    $value = "stat_value7";
                    break;
                case 14:
                    $type = "stat_type8";
                    $value = "stat_value8";
                    break;
                case 16:
                    $type = "stat_type9";
                    $value = "stat_value9";
                    break;
                case 18:
                    $type = "stat_type10";
                    $value = "stat_value10";
                    break;
            }
            $stat_value = $item[$value];
            if ($item[$type] && $stat_value) {
                switch ($item[$type]) {
                    case 1:
                        $tooltip .= '+' . $stat_value . ' ' . lang("item", "health") . '<br />';
                        break;
                    case 2:
                        $tooltip .= '+' . $stat_value . ' ' . lang("item", "mana") . '<br />';
                        break;
                    case 3:
                        $tooltip .= '+' . $stat_value . ' ' . lang("item", "agility") . '<br />';
                        break;
                    case 4:
                        $tooltip .= '+' . $stat_value . ' ' . lang("item", "strength") . '<br />';
                        break;
                    case 5:
                        $tooltip .= '+' . $stat_value . ' ' . lang("item", "intellect") . '<br />';
                        break;
                    case 6:
                        $tooltip .= '+' . $stat_value . ' ' . lang("item", "spirit") . '<br />';
                        break;
                    case 7:
                        $tooltip .= '+' . $stat_value . ' ' . lang("item", "stamina") . '<br />';
                        break;
                    default:
                        $flag_rating = 1;
                }
            }
        }
        if ($item["holy_res"]) {
            $tooltip .= $item["holy_res"] . ' ' . lang("item", "res_holy") . '<br />';
        }
        if ($item["arcane_res"]) {
            $tooltip .= $item["arcane_res"] . ' ' . lang("item", "res_arcane") . '<br />';
        }
        if ($item["fire_res"]) {
            $tooltip .= $item["fire_res"] . ' ' . lang("item", "res_fire") . '<br />';
        }
        if ($item["nature_res"]) {
            $tooltip .= $item["nature_res"] . ' ' . lang("item", "res_nature") . '<br />';
        }
        if ($item["frost_res"]) {
            $tooltip .= $item["frost_res"] . ' ' . lang("item", "res_frost") . '<br />';
        }
        if ($item["shadow_res"]) {
            $tooltip .= $item["shadow_res"] . ' ' . lang("item", "res_shadow") . '<br />';
        }
        //sockets
        for ($p = 72; $p <= 74; $p++) {
            switch ($p) {
                case 72:
                    $sock = "socketColor_1";
                    break;
                case 73:
                    $sock = "socketColor_2";
                    break;
                case 74:
                    $sock = "socketColor_3";
                    break;
            }
            if ($item[$sock]) {
                switch ($item[$sock]) {
                    case 1:
                        $tooltip .= '<img class="item_tooltip_socket" src="img/socket_meta.gif" alt="" /><span style="color: gray;"> ' . lang("item", "socket_meta") . '</span><br />';
                        break;
                    case 2:
                        $tooltip .= '<img class="item_tooltip_socket" src="img/socket_red.gif" alt="" /><span style="color: red;"> ' . lang("item", "socket_red") . '</span><br />';
                        break;
                    case 4:
                        $tooltip .= '<img class="item_tooltip_socket" src="img/socket_yellow.gif" alt="" /><span style="color: yellow;"> ' . lang("item", "socket_yellow") . '</span><br />';
                        break;
                    case 8:
                        $tooltip .= '<img class="item_tooltip_socket" src="img/socket_blue.gif" alt="" /><span style="color: blue;"> ' . lang("item", "socket_blue") . '</span><br />';
                        break;
                    default:
                }
            }
        }
        $tooltip .= '</span><span style="color: #1eff00;">';
        // random enchantments
        // we color them green because we don't add them to the normal stat values, yet.
        if ($prop > 2147483647) {
            // tempararily disabling showing Random Suffixes...
            $tooltip .= '< Random Enchantment ><br />';
        } else {
            if ($i_prop) {
                $prop1 = $i_prop["SpellItemEnchantment_1"];
                $prop2 = $i_prop["SpellItemEnchantment_2"];
                $prop3 = $i_prop["SpellItemEnchantment_3"];
                $prop4 = $i_prop["SpellItemEnchantment_4"];
                $prop5 = $i_prop["SpellItemEnchantment_5"];
                $query = "SELECT * FROM spellitemenchantment \r\n          WHERE " . ($prop1 ? "ID=" . $prop1 : "") . ($prop2 ? " OR ID=" . $prop2 : "") . ($prop3 ? " OR ID=" . $prop3 : "") . ($prop4 ? " OR ID=" . $prop4 : "") . ($prop5 ? " OR ID=" . $prop5 : "");
                $result = $sql["dbc"]->query($query);
                while ($prop_row = $sql["dbc"]->fetch_assoc($result)) {
                    $tooltip .= $prop_row["EnchantmentName"] . '<br />';
                }
            }
        }
        $tooltip .= '</span><span style="color: #ffffff;">';
        if (isset($durability) && $item["MaxDurability"] > 0) {
            $tooltip .= lang("item", "durability") . ' ' . $durability . " / " . $item["MaxDurability"] . '<br />';
        }
        //level requierment
        if ($item["RequiredLevel"] > 1) {
            $tooltip .= lang("item", "lvl_req") . ' ' . $item["RequiredLevel"] . '<br />';
        } elseif ($item["RequiredLevel"] == 0) {
            if ($item["Quality"] == 7) {
                $tooltip .= lang("item", "lvl_req2") . '<br />';
            }
            // "Requires Level 1 to 80"
        } else {
        }
        // don't bother showing "Requires Level" for items that require level 1
        //item level
        if ($item["ItemLevel"]) {
            $tooltip .= lang("item", "itemlvl") . ' ' . $item["ItemLevel"] . '<br />';
        }
        //allowable classes
        if ($item["AllowableClass"] && $item["AllowableClass"] != -1 && $item["AllowableClass"] != 1503) {
            $tooltip .= lang("item", "class") . ':';
            if ($item["AllowableClass"] & 1) {
                $tooltip .= ' ' . lang("id_tab", "warrior") . ' ';
            }
            if ($item["AllowableClass"] & 2) {
                $tooltip .= ' ' . lang("id_tab", "paladin") . ' ';
            }
            if ($item["AllowableClass"] & 4) {
                $tooltip .= ' ' . lang("id_tab", "hunter") . ' ';
            }
            if ($item["AllowableClass"] & 8) {
                $tooltip .= ' ' . lang("id_tab", "rogue") . ' ';
            }
            if ($item["AllowableClass"] & 16) {
                $tooltip .= ' ' . lang("id_tab", "priest") . ' ';
            }
            if ($item["AllowableClass"] & 64) {
                $tooltip .= ' ' . lang("id_tab", "shaman") . ' ';
            }
            if ($item["AllowableClass"] & 128) {
                $tooltip .= ' ' . lang("id_tab", "mage") . ' ';
            }
            if ($item["AllowableClass"] & 256) {
                $tooltip .= ' ' . lang("id_tab", "warlock") . ' ';
            }
            if ($item["AllowableClass"] & 1024) {
                $tooltip .= ' ' . lang("id_tab", "druid") . ' ';
            }
            $tooltip .= '<br />';
        }
        //number of bag slots
        if ($item["ContainerSlots"]) {
            $tooltip .= ' ' . $item["ContainerSlots"] . ' ' . lang("item", "slots") . '<br />';
        }
        $tooltip .= '</span><span style="color: #1eff00;">';
        //created enchantments
        if ($ench) {
            $tooltip .= $i_ench["EnchantmentName"] . '<br />';
        }
        //Ratings additions.
        if (isset($flag_rating)) {
            for ($s = 0; $s <= 18; $s += 2) {
                switch ($s) {
                    case 0:
                        $type = "stat_type1";
                        $value = "stat_value1";
                        break;
                    case 2:
                        $type = "stat_type2";
                        $value = "stat_value2";
                        break;
                    case 4:
                        $type = "stat_type3";
                        $value = "stat_value3";
                        break;
                    case 6:
                        $type = "stat_type4";
                        $value = "stat_value4";
                        break;
                    case 8:
                        $type = "stat_type5";
                        $value = "stat_value5";
                        break;
                    case 10:
                        $type = "stat_type6";
                        $value = "stat_value6";
                        break;
                    case 12:
                        $type = "stat_type7";
                        $value = "stat_value7";
                        break;
                    case 14:
                        $type = "stat_type8";
                        $value = "stat_value8";
                        break;
                    case 16:
                        $type = "stat_type9";
                        $value = "stat_value9";
                        break;
                    case 18:
                        $type = "stat_type10";
                        $value = "stat_value10";
                        break;
                }
                $stat_type = $item[$type];
                $stat_value = $item[$value];
                if ($stat_type && $stat_value) {
                    switch ($stat_type) {
                        case 12:
                            $tooltip .= lang("item", "spell_equip") . ': ' . lang("item", "improves") . ' ' . lang("item", "DEFENCE_RATING") . ' ' . lang("item", "rating_by") . ' ' . $stat_value . '.<br />';
                            break;
                        case 13:
                            $tooltip .= lang("item", "spell_equip") . ': ' . lang("item", "improves") . ' ' . lang("item", "DODGE_RATING") . ' ' . lang("item", "rating_by") . ' ' . $stat_value . '.<br />';
                            break;
                        case 14:
                            $tooltip .= lang("item", "spell_equip") . ': ' . lang("item", "improves") . ' ' . lang("item", "PARRY_RATING") . ' ' . lang("item", "rating_by") . ' ' . $stat_value . '.<br />';
                            break;
                        case 15:
                            $tooltip .= lang("item", "spell_equip") . ': ' . lang("item", "improves") . ' ' . lang("item", "SHIELD_BLOCK_RATING") . ' ' . lang("item", "rating_by") . ' ' . $stat_value . '.<br />';
                            break;
                        case 16:
                            $tooltip .= lang("item", "spell_equip") . ': ' . lang("item", "improves") . ' ' . lang("item", "MELEE_HIT_RATING") . ' ' . lang("item", "rating_by") . ' ' . $stat_value . '.<br />';
                            break;
                        case 17:
                            $tooltip .= lang("item", "spell_equip") . ': ' . lang("item", "improves") . ' ' . lang("item", "RANGED_HIT_RATING") . ' ' . lang("item", "rating_by") . ' ' . $stat_value . '.<br />';
                            break;
                        case 18:
                            $tooltip .= lang("item", "spell_equip") . ': ' . lang("item", "improves") . ' ' . lang("item", "SPELL_HIT_RATING") . ' ' . lang("item", "rating_by") . ' ' . $stat_value . '.<br />';
                            break;
                        case 19:
                            $tooltip .= lang("item", "spell_equip") . ': ' . lang("item", "improves") . ' ' . lang("item", "MELEE_CS_RATING") . ' ' . lang("item", "rating_by") . ' ' . $stat_value . '.<br />';
                            break;
                        case 20:
                            $tooltip .= lang("item", "spell_equip") . ': ' . lang("item", "improves") . ' ' . lang("item", "RANGED_CS_RATING") . ' ' . lang("item", "rating_by") . ' ' . $stat_value . '.<br />';
                            break;
                        case 21:
                            $tooltip .= lang("item", "spell_equip") . ': ' . lang("item", "improves") . ' ' . lang("item", "SPELL_CS_RATING") . ' ' . lang("item", "rating_by") . ' ' . $stat_value . '.<br />';
                            break;
                        case 22:
                            $tooltip .= lang("item", "spell_equip") . ': ' . lang("item", "improves") . ' ' . lang("item", "MELEE_HA_RATING") . ' ' . lang("item", "rating_by") . ' ' . $stat_value . '.<br />';
                            break;
                        case 23:
                            $tooltip .= lang("item", "spell_equip") . ': ' . lang("item", "improves") . ' ' . lang("item", "RANGED_HA_RATING") . ' ' . lang("item", "rating_by") . ' ' . $stat_value . '.<br />';
                            break;
                        case 24:
                            $tooltip .= lang("item", "spell_equip") . ': ' . lang("item", "improves") . ' ' . lang("item", "SPELL_HA_RATING") . ' ' . lang("item", "rating_by") . ' ' . $stat_value . '.<br />';
                            break;
                        case 25:
                            $tooltip .= lang("item", "spell_equip") . ': ' . lang("item", "improves") . ' ' . lang("item", "MELEE_CA_RATING") . ' ' . lang("item", "rating_by") . ' ' . $stat_value . '.<br />';
                            break;
                        case 26:
                            $tooltip .= lang("item", "spell_equip") . ': ' . lang("item", "improves") . ' ' . lang("item", "RANGED_CA_RATING") . ' ' . lang("item", "rating_by") . ' ' . $stat_value . '.<br />';
                            break;
                        case 27:
                            $tooltip .= lang("item", "spell_equip") . ': ' . lang("item", "improves") . ' ' . lang("item", "SPELL_CA_RATING") . ' ' . lang("item", "rating_by") . ' ' . $stat_value . '.<br />';
                            break;
                        case 28:
                            $tooltip .= lang("item", "spell_equip") . ': ' . lang("item", "improves") . ' ' . lang("item", "MELEE_HASTE_RATING") . ' ' . lang("item", "rating_by") . ' ' . $stat_value . '.<br />';
                            break;
                        case 29:
                            $tooltip .= lang("item", "spell_equip") . ': ' . lang("item", "improves") . ' ' . lang("item", "RANGED_HASTE_RATING") . ' ' . lang("item", "rating_by") . ' ' . $stat_value . '.<br />';
                            break;
                        case 30:
                            $tooltip .= lang("item", "spell_equip") . ': ' . lang("item", "improves") . ' ' . lang("item", "SPELL_HASTE_RATING") . ' ' . lang("item", "rating_by") . ' ' . $stat_value . '.<br />';
                            break;
                        case 31:
                            $tooltip .= lang("item", "spell_equip") . ': ' . lang("item", "improves") . ' ' . lang("item", "HIT_RATING") . ' ' . lang("item", "rating_by") . ' ' . $stat_value . '.<br />';
                            break;
                        case 32:
                            $tooltip .= lang("item", "spell_equip") . ': ' . lang("item", "improves") . ' ' . lang("item", "CS_RATING") . ' ' . lang("item", "rating_by") . ' ' . $stat_value . '.<br />';
                            break;
                        case 33:
                            $tooltip .= lang("item", "spell_equip") . ': ' . lang("item", "improves") . ' ' . lang("item", "HA_RATING") . ' ' . lang("item", "rating_by") . ' ' . $stat_value . '.<br />';
                            break;
                        case 34:
                            $tooltip .= lang("item", "spell_equip") . ': ' . lang("item", "improves") . ' ' . lang("item", "CA_RATING") . ' ' . lang("item", "rating_by") . ' ' . $stat_value . '.<br />';
                            break;
                        case 35:
                            $tooltip .= lang("item", "spell_equip") . ': ' . lang("item", "improves") . ' ' . lang("item", "RESILIENCE_RATING") . ' ' . lang("item", "rating_by") . ' ' . $stat_value . '.<br />';
                            break;
                        case 36:
                            $tooltip .= lang("item", "spell_equip") . ': ' . lang("item", "improves") . ' ' . lang("item", "HASTE_RATING") . ' ' . lang("item", "rating_by") . ' ' . $stat_value . '.<br />';
                            break;
                        default:
                    }
                }
            }
        }
        //add equip spellid to status
        for ($s1 = 27; $s1 <= 31; $s1++) {
            switch ($s1) {
                case 27:
                    $spellid = "spellid_1";
                    $trigger = "spelltrigger_1";
                    $charges = "spellcharges_1";
                    break;
                case 28:
                    $spellid = "spellid_2";
                    $trigger = "spelltrigger_2";
                    $charges = "spellcharges_2";
                    break;
                case 29:
                    $spellid = "spellid_3";
                    $trigger = "spelltrigger_3";
                    $charges = "spellcharges_3";
                    break;
                case 30:
                    $spellid = "spellid_4";
                    $trigger = "spelltrigger_4";
                    $charges = "spellcharges_4";
                    break;
                case 31:
                    $spellid = "spellid_5";
                    $trigger = "spelltrigger_5";
                    $charges = "spellcharges_5";
                    break;
            }
            if ($item[$spellid]) {
                switch ($item[$trigger]) {
                    case 0:
                        $tooltip .= lang("item", "spell_use") . ': ';
                        break;
                    case 1:
                        $tooltip .= lang("item", "spell_equip") . ': ';
                        break;
                    case 2:
                        $tooltip .= lang("item", "spell_coh") . ': ';
                        break;
                    default:
                }
                $query = "SELECT Name FROM spell WHERE Id='" . $item[$spellid] . "'";
                $result = $sql["dbc"]->query($query);
                $spell = $sql["dbc"]->fetch_assoc($result);
                $spell = $spell["Name"];
                $tooltip .= ' ' . $spell . '<br />';
                if ($item[$spellid]) {
                    if ($item[$charges] > 1) {
                        $tooltip .= "" . abs($item[$charges]) . ' ' . lang("item", "charges") . '.<br />';
                    }
                }
            }
        }
        $tooltip .= '</span>';
        if ($item["itemset"]) {
            include_once "id_tab.php";
            $tooltip .= '<span style="color: orange;">' . lang("item", "item_set") . ' : ' . get_itemset_name($item["itemset"]) . ' (' . $item["itemset"] . ')</span><br />';
        }
        if ($item["description1"]) {
            // Localization
            if ($locales_search_option != 0) {
                if ($core == 1) {
                    $item["description"] = $item["description"];
                } else {
                    $item["description"] = $item["description_loc" . $locales_search_option];
                }
            } else {
                $item["description"] = $item["description1"];
            }
            $tooltip .= '<span style="color: orange;">\'' . str_replace("\"", " '", $item["description"]) . '\'</span><br />';
        }
        if ($creator) {
            if (!$core == 1) {
                $c_query = "SELECT name FROM characters WHERE guid='" . $creator . "'";
                $c_result = $sql["char"]->query($c_query);
                $c_field = $sql["char"]->fetch_assoc($c_result);
                $creator = $c_field["name"];
            }
            $tooltip .= '<span style="color: #1eff00;">&lt; ' . lang("item", "madeby") . ' ' . $creator . ' &gt;</span><br />';
        }
        if ($item["SellPrice"]) {
            // pad the sell price
            $SellPrice = str_pad($item["SellPrice"], 4, "0", STR_PAD_LEFT);
            // break it into gold, silver, and copper
            $pg = substr($SellPrice, 0, -4);
            if ($pg == "") {
                $pg = 0;
            }
            $ps = substr($SellPrice, -4, 2);
            if ($ps == "" || $ps == "00") {
                $ps = 0;
            }
            $pc = substr($SellPrice, -2);
            if ($pc == "" || $pc == "00") {
                $pc = 0;
            }
            // convert the strings into numbers
            $pg = floor($pg);
            $ps = floor($ps);
            $pc = floor($pc);
            $tooltip .= lang("item", "sellprice") . ': ';
            if ($pg) {
                $tooltip .= $pg . '<img class="item_tooltip_price" src="img/gold.gif" alt="" style="position: relative; bottom: -6px;" />';
            }
            if ($ps) {
                $tooltip .= $ps . '<img class="item_tooltip_price" src="img/silver.gif" alt="" style="position: relative; bottom: -6px;" />';
            }
            if ($pc) {
                $tooltip .= $pc . '<img class="item_tooltip_price" src="img/copper.gif" alt="" style="position: relative; bottom: -6px;" />';
            }
        } else {
            $tooltip .= lang("item", "nosellprice");
        }
        return $tooltip;
    } else {
        return NULL;
    }
}
コード例 #2
0
ファイル: item_lib.php プロジェクト: BACKUPLIB/minimanager
function get_item_tooltip($item_id)
{
    global $lang_item, $lang_id_tab, $world_db, $realm_id, $language;
    if ($item_id) {
        $sqlw = new SQL();
        $sqlw->connect($world_db[$realm_id]['addr'], $world_db[$realm_id]['user'], $world_db[$realm_id]['pass'], $world_db[$realm_id]['name']);
        $deplang = get_lang_id();
        $result_1 = $sqlw->query("SELECT stat_type1,stat_value1,stat_type2,\r\n      stat_value2,stat_type3,stat_value3,stat_type4,stat_value4,stat_type5,\r\n      stat_value5,stat_type6,stat_value6,stat_type7,stat_value7,stat_type8,\r\n      stat_value8,stat_type9,stat_value9,stat_type10,stat_value10,armor,\r\n      holy_res,fire_res,nature_res,frost_res,arcane_res,shadow_res,spellid_1,\r\n      spellid_2,spellid_3,spellid_4,spellid_5,\r\n      IFNULL(" . ($deplang != 0 ? "name_loc{$deplang}" : "NULL") . ",name),class,subclass,\r\n      Quality,RequiredLevel,dmg_min1,dmg_max1,dmg_type1,dmg_min2,dmg_max2,\r\n      dmg_type2,delay,bonding,description,itemset,item_template.entry,\r\n      InventoryType,ItemLevel,displayid,maxcount,spelltrigger_1,spelltrigger_2,\r\n      spelltrigger_3,spelltrigger_4,spelltrigger_5,ContainerSlots,\r\n      spellcharges_1,spellcharges_2,spellcharges_3,spellcharges_4,\r\n      spellcharges_5,AllowableClass,socketColor_1,socketColor_2,socketColor_3,\r\n      RandomProperty,RandomSuffix\r\n      FROM item_template LEFT JOIN locales_item ON item_template.entry = locales_item.entry\r\n      WHERE item_template.entry = '{$item_id}' LIMIT 1");
        if ($item = $sqlw->fetch_row($result_1)) {
            $tooltip = "";
            $itemname = htmlspecialchars($item[32]);
            switch ($item[35]) {
                case 0:
                    //Grey Poor
                    $tooltip .= "<font color='#b2c2b9' class='large'>{$itemname}</font><br />";
                    break;
                case 1:
                    //White Common
                    $tooltip .= "<font color='white' class='large'>{$itemname}</font><br />";
                    break;
                case 2:
                    //Green Uncommon
                    $tooltip .= "<font color='#1eff00' class='large'>{$itemname}</font><br />";
                    break;
                case 3:
                    //Blue Rare
                    $tooltip .= "<font color='#0070dd' class='large'>{$itemname}</font><br />";
                    break;
                case 4:
                    //Purple Epic
                    $tooltip .= "<font color='#a335ee' class='large'>{$itemname}</font><br />";
                    break;
                case 5:
                    //Orange Legendary
                    $tooltip .= "<font color='orange' class='large'>{$itemname}</font><br />";
                    break;
                case 6:
                    //Red Artifact
                    $tooltip .= "<font color='red' class='large'>{$itemname}</font><br />";
                    break;
                default:
            }
            $tooltip .= "<font color='white'>";
            switch ($item[53]) {
                case 1:
                    //Binds when Picked Up
                    $tooltip .= "{$lang_item['bop']}<br />";
                    break;
                case 2:
                    //Binds when Equipped
                    $tooltip .= "{$lang_item['boe']}<br />";
                    break;
                case 3:
                    //Binds when Used
                    $tooltip .= "{$lang_item['bou']}<br />";
                    break;
                case 4:
                    //Quest Item
                    $tooltip .= "{$lang_item['quest_item']}<br />";
                    break;
                default:
            }
            if ($item[60]) {
                $tooltip .= "{$lang_item['unique']}<br />";
            }
            $tooltip .= "<br />";
            switch ($item[57]) {
                case 1:
                    $tooltip .= "{$lang_item['head']} - ";
                    break;
                case 2:
                    $tooltip .= "{$lang_item['neck']} - ";
                    break;
                case 3:
                    $tooltip .= "{$lang_item['shoulder']} - ";
                    break;
                case 4:
                    $tooltip .= "{$lang_item['shirt']} - ";
                    break;
                case 5:
                    $tooltip .= "{$lang_item['chest']} - ";
                    break;
                case 6:
                    $tooltip .= "{$lang_item['belt']} - ";
                    break;
                case 7:
                    $tooltip .= "{$lang_item['legs']} - ";
                    break;
                case 8:
                    $tooltip .= "{$lang_item['feet']} - ";
                    break;
                case 9:
                    $tooltip .= "{$lang_item['wrist']} - ";
                    break;
                case 10:
                    $tooltip .= "{$lang_item['gloves']} - ";
                    break;
                case 11:
                    $tooltip .= "{$lang_item['finger']} - ";
                    break;
                case 12:
                    $tooltip .= "{$lang_item['trinket']} - ";
                    break;
                case 13:
                    $tooltip .= "{$lang_item['one_hand']} - ";
                    break;
                case 14:
                    $tooltip .= "{$lang_item['off_hand']} - ";
                    break;
                case 16:
                    $tooltip .= "{$lang_item['back']} - ";
                    break;
                case 18:
                    $tooltip .= "{$lang_item['bag']}";
                    break;
                case 19:
                    $tooltip .= "{$lang_item['tabard']} - ";
                    break;
                case 20:
                    $tooltip .= "{$lang_item['robe']} - ";
                    break;
                case 21:
                    $tooltip .= "{$lang_item['main_hand']} - ";
                    break;
                case 23:
                    $tooltip .= "{$lang_item['tome']} - ";
                    break;
                default:
            }
            switch ($item[33]) {
                case 0:
                    //Consumable
                    $tooltip .= "{$lang_item['consumable']}<br />";
                    break;
                case 2:
                    //Weapon
                    switch ($item[34]) {
                        case 0:
                            $tooltip .= "{$lang_item['axe_1h']}<br />";
                            break;
                        case 1:
                            $tooltip .= "{$lang_item['axe_2h']}<br />";
                            break;
                        case 2:
                            $tooltip .= "{$lang_item['bow']}<br />";
                            break;
                        case 3:
                            $tooltip .= "{$lang_item['rifle']}<br />";
                            break;
                        case 4:
                            $tooltip .= "{$lang_item['mace_1h']}<br />";
                            break;
                        case 5:
                            $tooltip .= "{$lang_item['mace_2h']}<br />";
                            break;
                        case 6:
                            $tooltip .= "{$lang_item['polearm']}<br />";
                            break;
                        case 7:
                            $tooltip .= "{$lang_item['sword_1h']}<br />";
                            break;
                        case 8:
                            $tooltip .= "{$lang_item['sword_2h']}<br />";
                            break;
                        case 10:
                            $tooltip .= "{$lang_item['staff']}<br />";
                            break;
                        case 11:
                            $tooltip .= "{$lang_item['exotic_1h']}<br />";
                            break;
                        case 12:
                            $tooltip .= "{$lang_item['exotic_2h']}<br />";
                            break;
                        case 13:
                            $tooltip .= "{$lang_item['fist_weapon']}<br />";
                            break;
                        case 14:
                            $tooltip .= "{$lang_item['misc_weapon']}<br />";
                            break;
                        case 15:
                            $tooltip .= "{$lang_item['dagger']}<br />";
                            break;
                        case 16:
                            $tooltip .= "{$lang_item['thrown']}<br />";
                            break;
                        case 17:
                            $tooltip .= "{$lang_item['spear']}<br />";
                            break;
                        case 18:
                            $tooltip .= "{$lang_item['crossbow']}<br />";
                            break;
                        case 19:
                            $tooltip .= "{$lang_item['wand']}<br />";
                            break;
                        case 20:
                            $tooltip .= "{$lang_item['fishing_pole']}<br />";
                            break;
                        default:
                    }
                    break;
                case 4:
                    //Armor
                    switch ($item[34]) {
                        case 0:
                            $tooltip .= "{$lang_item['misc']}<br />";
                            break;
                        case 1:
                            $tooltip .= "{$lang_item['cloth']}<br />";
                            break;
                        case 2:
                            $tooltip .= "{$lang_item['leather']}<br />";
                            break;
                        case 3:
                            $tooltip .= "{$lang_item['mail']}<br />";
                            break;
                        case 4:
                            $tooltip .= "{$lang_item['plate']}<br />";
                            break;
                        case 6:
                            $tooltip .= "{$lang_item['shield']}<br />";
                            break;
                        default:
                    }
                    break;
                case 6:
                    //Projectile
                    switch ($item[34]) {
                        case 2:
                            $tooltip .= "{$lang_item['arrows']}<br />";
                            break;
                        case 3:
                            $tooltip .= "{$lang_item['bullets']}<br />";
                            break;
                        default:
                    }
                    break;
                case 7:
                    //Trade Goods
                    switch ($item[34]) {
                        case 0:
                            $tooltip .= "{$lang_item['trade_goods']}<br />";
                            break;
                        case 1:
                            $tooltip .= "{$lang_item['parts']}<br />";
                            break;
                        case 2:
                            $tooltip .= "{$lang_item['explosives']}<br />";
                            break;
                        case 3:
                            $tooltip .= "{$lang_item['devices']}<br />";
                            break;
                        default:
                    }
                    break;
                case 9:
                    //Recipe
                    switch ($item[34]) {
                        case 0:
                            $tooltip .= "{$lang_item['book']}<br />";
                            break;
                        case 1:
                            $tooltip .= "{$lang_item['LW_pattern']}<br />";
                            break;
                        case 2:
                            $tooltip .= "{$lang_item['tailoring_pattern']}<br />";
                            break;
                        case 3:
                            $tooltip .= "{$lang_item['ENG_Schematic']}<br />";
                            break;
                        case 4:
                            $tooltip .= "{$lang_item['BS_plans']}<br />";
                            break;
                        case 5:
                            $tooltip .= "{$lang_item['cooking_recipe']}<br />";
                            break;
                        case 6:
                            $tooltip .= "{$lang_item['alchemy_recipe']}<br />";
                            break;
                        case 7:
                            $tooltip .= "{$lang_item['FA_manual']}<br />";
                            break;
                        case 8:
                            $tooltip .= "{$lang_item['ench_formula']}<br />";
                            break;
                        case 9:
                            $tooltip .= "{$lang_item['JC_formula']}<br />";
                            break;
                        default:
                    }
                    break;
                case 11:
                    //Quiver
                    switch ($item[34]) {
                        case 2:
                            $tooltip .= " {$lang_item['quiver']}<br />";
                            break;
                        case 3:
                            $tooltip .= " {$lang_item['ammo_pouch']}<br />";
                            break;
                        default:
                    }
                    break;
                case 12:
                    //Quest
                    if ($item[53] != 4) {
                        $tooltip .= "{$lang_item['quest_item']}<br />";
                    }
                    break;
                case 13:
                    //key
                    switch ($item[34]) {
                        case 0:
                            $tooltip .= "{$lang_item['key']}<br />";
                            break;
                        case 1:
                            $tooltip .= "{$lang_item['lockpick']}<br />";
                            break;
                        default:
                    }
                    break;
                default:
            }
            $tooltip .= "{$item['20']} {$lang_item['armor']}<br />";
            for ($f = 37; $f <= 51; $f += 3) {
                $dmg_type = $item[$f + 2];
                $min_dmg_value = $item[$f];
                $max_dmg_value = $item[$f + 1];
                if ($min_dmg_value && $max_dmg_value) {
                    switch ($dmg_type) {
                        case 0:
                            // Physical
                            $tooltip .= "{$min_dmg_value} - {$max_dmg_value} {$lang_item['damage']}<br />(" . ($item[52] ? round(($min_dmg_value + $max_dmg_value) / 2 / ($item[52] / 1000), 2) : $min_dmg_value) . " DPS)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$lang_item['speed']} : " . $item[52] / 1000 . "<br />";
                            break;
                        case 1:
                            // Holy
                            $tooltip .= "{$min_dmg_value} - {$max_dmg_value} {$lang_item['holy_dmg']}<br />";
                            break;
                        case 2:
                            // Fire
                            $tooltip .= "{$min_dmg_value} - {$max_dmg_value} {$lang_item['fire_dmg']}<br />";
                            break;
                        case 3:
                            // Nature
                            $tooltip .= "{$min_dmg_value} - {$max_dmg_value} {$lang_item['nature_dmg']}<br />";
                            break;
                        case 4:
                            // Frost
                            $tooltip .= "{$min_dmg_value} - {$max_dmg_value} {$lang_item['frost_dmg']}<br />";
                            break;
                        case 5:
                            // Shadow
                            $tooltip .= "{$min_dmg_value} - {$max_dmg_value} {$lang_item['shadow_dmg']}<br />";
                            break;
                        case 6:
                            // Arcane
                            $tooltip .= "{$min_dmg_value} - {$max_dmg_value} {$lang_item['arcane_dmg']}<br />";
                            break;
                        default:
                    }
                }
            }
            //basic status
            for ($s = 0; $s <= 18; $s += 2) {
                $stat_value = $item[$s + 1];
                if ($item[$s] && $stat_value) {
                    switch ($item[$s]) {
                        case 1:
                            $tooltip .= "+{$stat_value} {$lang_item['health']}<br />";
                            break;
                        case 2:
                            $tooltip .= "+{$stat_value} {$lang_item['mana']}<br />";
                            break;
                        case 3:
                            $tooltip .= "+{$stat_value} {$lang_item['agility']}<br />";
                            break;
                        case 4:
                            $tooltip .= "+{$stat_value} {$lang_item['strength']}<br />";
                            break;
                        case 5:
                            $tooltip .= "+{$stat_value} {$lang_item['intellect']}<br />";
                            break;
                        case 6:
                            $tooltip .= "+{$stat_value} {$lang_item['spirit']}<br />";
                            break;
                        case 7:
                            $tooltip .= "+{$stat_value} {$lang_item['stamina']}<br />";
                            break;
                        default:
                            $flag_rating = 1;
                    }
                }
            }
            if ($item[21]) {
                $tooltip .= "{$item['21']} {$lang_item['res_holy']}<br />";
            }
            if ($item[25]) {
                $tooltip .= "{$item['25']} {$lang_item['res_arcane']}<br />";
            }
            if ($item[22]) {
                $tooltip .= "{$item['22']} {$lang_item['res_fire']}<br />";
            }
            if ($item[23]) {
                $tooltip .= "{$item['23']} {$lang_item['res_nature']}<br />";
            }
            if ($item[24]) {
                $tooltip .= "{$item['24']} {$lang_item['res_frost']}<br />";
            }
            if ($item[26]) {
                $tooltip .= "{$item['26']} {$lang_item['res_shadow']}<br />";
            }
            //sockets
            for ($p = 72; $p <= 74; $p++) {
                if ($item[$p]) {
                    switch ($item[$p]) {
                        case 1:
                            $tooltip .= "<img src='img/socket_meta.gif' alt='' /><font color='gray'> {$lang_item['socket_meta']}</font><br />";
                            break;
                        case 2:
                            $tooltip .= "<img src='img/socket_red.gif' alt='' /><font color='red'> {$lang_item['socket_red']}</font><br />";
                            break;
                        case 4:
                            $tooltip .= "<img src='img/socket_yellow.gif' alt='' /><font color='yellow'> {$lang_item['socket_yellow']}</font><br />";
                            break;
                        case 8:
                            $tooltip .= "<img src='img/socket_blue.gif' alt='' /><font color='blue'> {$lang_item['socket_blue']}</font><br />";
                            break;
                        default:
                    }
                }
            }
            //level requierment
            if ($item[36]) {
                $tooltip .= "{$lang_item['lvl_req']} {$item['36']}<br />";
            }
            //allowable classes
            if ($item[71] && $item[71] != -1 && $item[71] != 1503) {
                $tooltip .= "{$lang_item['class']}:";
                if ($item[71] & 1) {
                    $tooltip .= " {$lang_id_tab['warrior']} ";
                }
                if ($item[71] & 2) {
                    $tooltip .= " {$lang_id_tab['paladin']} ";
                }
                if ($item[71] & 4) {
                    $tooltip .= " {$lang_id_tab['hunter']} ";
                }
                if ($item[71] & 8) {
                    $tooltip .= " {$lang_id_tab['rogue']} ";
                }
                if ($item[71] & 16) {
                    $tooltip .= " {$lang_id_tab['priest']} ";
                }
                if ($item[71] & 64) {
                    $tooltip .= " {$lang_id_tab['shaman']} ";
                }
                if ($item[71] & 128) {
                    $tooltip .= " {$lang_id_tab['mage']} ";
                }
                if ($item[71] & 256) {
                    $tooltip .= " {$lang_id_tab['warlock']} ";
                }
                if ($item[71] & 1024) {
                    $tooltip .= " {$lang_id_tab['druid']} ";
                }
                $tooltip .= "<br />";
            }
            //number of bag slots
            if ($item[66]) {
                $tooltip .= " {$item['66']} {$lang_item['slots']}<br />";
            }
            $tooltip .= "</font><br /><font color='#1eff00'>";
            //random enchantments
            if ($item[75] || $item[76]) {
                $tooltip .= "&lt; Random enchantment &gt;<br />";
            }
            //Ratings additions.
            if (isset($flag_rating)) {
                for ($s = 0; $s <= 18; $s += 2) {
                    $stat_type = $item[$s];
                    $stat_value = $item[$s + 1];
                    if ($stat_type && $stat_value) {
                        switch ($stat_type) {
                            case 12:
                                $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['DEFENCE_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />";
                                break;
                            case 13:
                                $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['DODGE_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />";
                                break;
                            case 14:
                                $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['PARRY_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />";
                                break;
                            case 15:
                                $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['SHIELD_BLOCK_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />";
                                break;
                            case 16:
                                $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['MELEE_HIT_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />";
                                break;
                            case 17:
                                $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['RANGED_HIT_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />";
                                break;
                            case 18:
                                $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['SPELL_HIT_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />";
                                break;
                            case 19:
                                $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['MELEE_CS_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />";
                                break;
                            case 20:
                                $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['RANGED_CS_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />";
                                break;
                            case 21:
                                $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['SPELL_CS_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />";
                                break;
                            case 22:
                                $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['MELEE_HA_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />";
                                break;
                            case 23:
                                $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['RANGED_HA_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />";
                                break;
                            case 24:
                                $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['SPELL_HA_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />";
                                break;
                            case 25:
                                $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['MELEE_CA_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />";
                                break;
                            case 26:
                                $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['RANGED_CA_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />";
                                break;
                            case 27:
                                $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['SPELL_CA_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />";
                                break;
                            case 28:
                                $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['MELEE_HASTE_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />";
                                break;
                            case 29:
                                $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['RANGED_HASTE_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />";
                                break;
                            case 30:
                                $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['SPELL_HASTE_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />";
                                break;
                            case 31:
                                $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['HIT_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />";
                                break;
                            case 32:
                                $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['CS_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />";
                                break;
                            case 33:
                                $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['HA_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />";
                                break;
                            case 34:
                                $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['CA_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />";
                                break;
                            case 35:
                                $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['RESILIENCE_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />";
                                break;
                            case 36:
                                $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['HASTE_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />";
                                break;
                            default:
                        }
                    }
                }
            }
            //add equip spellid to status
            for ($s1 = 27; $s1 <= 31; $s1++) {
                if ($item[$s1]) {
                    switch ($item[$s1 + 34]) {
                        case 0:
                            $tooltip .= "{$lang_item['spell_use']}: ";
                            break;
                        case 1:
                            $tooltip .= "{$lang_item['spell_equip']}: ";
                            break;
                        case 2:
                            $tooltip .= "{$lang_item['spell_coh']}: ";
                            break;
                        default:
                    }
                    $tooltip .= " {$item[$s1]}<br />";
                    if ($item[$s1]) {
                        if ($item[$s1 + 40]) {
                            $tooltip .= abs($item[$s1 + 40]) . " {$lang_item['charges']}.<br />";
                        }
                    }
                }
            }
            $tooltip .= "</font>";
            if ($item[55]) {
                include_once "id_tab.php";
                $tooltip .= "<br /><font color='orange'>{$lang_item['item_set']} : " . get_itemset_name($item[55]) . " ({$item['55']})</font>";
            }
            if ($item[54]) {
                $tooltip .= "<br /><font color='orange'>''" . str_replace("\"", " '", $item[54]) . "'</font>";
            }
        } else {
            $tooltip = "Item ID: {$item_id} Not Found";
        }
        return $tooltip;
    } else {
        return NULL;
    }
}