private static function HandleItems() { if (!is_array(self::$m_items)) { return false; } $items = array(); foreach (self::$m_items as $item) { $item_temp = array('entry' => $item['entry'], 'icon' => $item['icon'], 'quality' => $item['quality'], 'name' => isset($item['name_loc']) && $item['name_loc'] != null ? $item['name_loc'] : $item['name'], 'js_data' => array(array('key' => 'name', 'data' => isset($item['name_loc']) && $item['name_loc'] != null ? '"' . (7 - $item['quality']) . str_replace('"', '\\"', $item['name_loc']) . '"' : '"' . (7 - $item['quality']) . str_replace('"', '\\"', $item['name']) . '"'), array('key' => 'class', 'data' => $item['class']), array('key' => 'displayid', 'data' => $item['displayid']), array('key' => 'id', 'data' => $item['entry']), array('key' => 'reqlevel', 'data' => $item['RequiredLevel']), array('key' => 'subclass', 'data' => $item['subclass']), array('key' => 'level', 'data' => $item['ItemLevel']), array('key' => 'quality', 'data' => $item['quality']), array('key' => 'firstseenpatch', 'data' => 0))); // Fill js_data with extra fields if ($item['class'] == ITEM_CLASS_ARMOR) { $item_temp['js_data'][] = array('key' => 'armor', 'data' => $item['armor']); $item_temp['js_data'][] = array('key' => 'slot', 'data' => $item['InventoryType']); $item_temp['js_data'][] = array('key' => 'slotbak', 'data' => $item['InventoryType']); } if ($item['class'] == ITEM_CLASS_WEAPON) { $item_temp['js_data'][] = array('key' => 'speed', 'data' => $item['Delay']); $item_temp['js_data'][] = array('key' => 'dps', 'data' => self::CalculateDPS($item)); $item_temp['js_data'][] = array('key' => 'speed', 'data' => $item['Delay'] / 1000); $item_temp['js_data'][] = array('key' => 'slot', 'data' => $item['InventoryType']); $item_temp['js_data'][] = array('key' => 'slotbak', 'data' => $item['InventoryType']); } if ($item['BuyPrice'] > 0) { $item_temp['js_data'][] = array('key' => 'cost', 'data' => sprintf('[%d]', $item['BuyPrice'])); } if ($item['SellPrice'] > 0) { $item_temp['js_data'][] = array('key' => 'sellprice', 'data' => sprintf('[%d]', $item['SellPrice'])); } if ($item['Flags'] & ITEM_FLAGS_HEROIC) { $item_temp['js_data'][] = array('key' => 'heroic', 'data' => 1); } $items[] = $item_temp; } self::$m_items = $items; unset($items, $item_temp, $item); }