示例#1
0
 public static function GetAllItemsInSubCategoryByInventoryType($CategoryID, $SubCategoryID, $InventoryType, $Offset)
 {
     global $FCCore;
     $Result = array();
     $Statement = Items::$WConnection->prepare('
         SELECT
             it.*,
             LOWER(fi.iconname) as icon
         FROM
             item_template it
         LEFT JOIN ' . $FCCore['Database']['database'] . '.freedomcore_icons fi ON
             it.displayid = fi.id
         WHERE
                 it.class = :class
             AND
                 it.subclass = :subclass
             AND
                 it.InventoryType = :invtype
         ORDER BY it.ItemLevel DESC
         LIMIT 50 OFFSET ' . $Offset . '
     ');
     $Statement->bindParam(':class', $CategoryID);
     $Statement->bindParam(':subclass', $SubCategoryID);
     $Statement->bindParam(':invtype', $InventoryType);
     $Statement->execute();
     $Result['item_list'] = $Statement->fetchAll(PDO::FETCH_ASSOC);
     if (!empty($Result['item_list'])) {
         for ($i = 0; $i < 1; $i++) {
             $Result['category_data'] = array('name' => Items::ItemClass($Result['item_list'][$i]['class']), 'subname' => Items::ItemSubClass($Result['item_list'][$i]['class'], $Result['item_list'][$i]['subclass']), 'inventorytype' => array('id' => $InventoryType, 'translation' => Items::InventoryTypeTranslation($InventoryType)));
         }
     }
     $Index = 0;
     if (!empty($Result['item_list'])) {
         foreach ($Result['item_list'] as $Item) {
             $Result['item_list'][$Index]['subclass'] = Items::ItemSubClass($Item['class'], $Item['subclass']);
             $Result['item_list'][$Index]['class'] = Items::ItemClass($Item['class']);
             $Index++;
         }
     }
     return array('count' => Items::SelectCount('item_template', array('class' => $CategoryID, 'subclass' => $SubCategoryID, 'InventoryType' => $InventoryType)), 'items' => $Result);
 }
 private static function GetItemArrayData($ItemArray)
 {
     global $FCCore;
     $SQL = 'SELECT
             it.entry,
             it.class,
             it.subclass,
             it.name,
             it.displayid,
             it.Quality,
             it.BuyPrice,
             it.SellPrice,
             it.bonding,
             it.RequiredLevel,
             it.InventoryType,
             LOWER(fi.iconname) as icon
         FROM
             item_template it
         LEFT JOIN ' . $FCCore['Database']['database'] . '.freedomcore_icons fi ON
             it.displayid = fi.id
         WHERE
             entry IN (' . $ItemArray . ')';
     $Statement = Zones::$WConnection->prepare($SQL);
     $Statement->execute();
     $Result = $Statement->fetchAll(PDO::FETCH_ASSOC);
     $ArrayIndex = 0;
     foreach ($Result as $Item) {
         $Result[$ArrayIndex]['subclass'] = Items::ItemSubClass($Item['class'], $Item['subclass']);
         $Result[$ArrayIndex]['class'] = Items::ItemClass($Item['class']);
         $Result[$ArrayIndex]['BuyPrice'] = Text::MoneyToCoins($Item['BuyPrice']);
         $Result[$ArrayIndex]['SellPrice'] = Text::MoneyToCoins($Item['SellPrice']);
         $Result[$ArrayIndex]['bond_translation'] = Items::BondTranslation($Item['bonding']);
         $Result[$ArrayIndex]['it_translation'] = Items::InventoryTypeTranslation($Item['InventoryType']);
         $ArrayIndex++;
     }
     return $Result;
 }