0; ALTER TABLE `aowow_items` DROP COLUMN `RandomSuffix`, -- localization UPDATE aowow_items a, locales_item b SET a.name_loc2 = b.name_loc2, a.name_loc3 = b.name_loc3, a.name_loc6 = b.name_loc6, a.name_loc8 = b.name_loc8, a.description_loc2 = b.description_loc2, a.description_loc3 = b.description_loc3, a.description_loc6 = b.description_loc6, a.description_loc8 = b.description_loc8 WHERE a.id = b.entry; -- merge with gemProperties UPDATE aowow_items a, dbc.gemProperties b SET a.gemEnchantmentId = b.spellItemEnchantmentId, a.gemColorMask = b.colorMask WHERE a.gemColorMask = b.id; -- icon UPDATE aowow_items a, dbc.itemDisplayInfo b SET a.iconString = b.inventoryIcon1, a.model = (leftModelName = '', rightModelName, leftModelName) WHERE a.displayId = b.id; -- Robes => Chest and Ranged (right) => Ranged UPDATE aowow_items SET slot = 15 WHERE slotbak = 26; UPDATE aowow_items SET slot = 5 WHERE slotbak = 20; -- custom sub-classes UPDATE aowow_items SET subClassBak = subClass, classBak = class, slot = slotBak; UPDATE aowow_items SET subclass = IF( slot = 4, -8, IF( -- shirt slot = 19, -7, IF( -- tabard slot = 16, -6, IF( -- cloak slot = 23, -5, IF( -- held in offhand slot = 12, -4, IF( -- trinket slot = 2, -3, IF( -- amulet slot = 11, -2, subClassBak -- ring ) ) ) ) ) ) ) WHERE class = 4; // move alchemist stones to trinkets (Armor) UPDATE aowow_items SET class = 4, subClass = -4 WHERE classBak = 7 AND subClassBak = 11 AND slotBak = 12; // mark keys as key (if not quest items) UPDATE aowow_items SET class = 13, subClass = 0 WHERE classBak IN (0, 15) AND bagFamily & 0x100; // set subSubClass for Glyphs (major/minor (requires spells to be set up)) UPDATE aowow_items i, dbc.spell s, dbc.glyphProperties gp SET i.subSubClass = IF(gp.typeFlags & 0x1, 2, 1) WHERE i.spellId1 = s.id AND s.effectMiscValue1 = gp.id AND i.classBak = 16; // elixir-subClasses - spell_group.id = item.subSubClass (1:battle; 2:guardian) // query takes ~1min UPDATE aowow_items i, world.spell_group sg SET i.subSubClass = sg.id WHERE sg.spell_id = i.spellId1 AND i.classBak = 0 AND i.subClassBak = 2; // filter misc(class:15) junk(subclass:0) to appropriate categories // assign pets and mounts to category UPDATE aowow_items i, dbc.spell s SET subClass = IF(effectAuraId1 <> 78, 2, IF(effectAuraId2 = 207 OR effectAuraId3 = 207 OR (s.id <> 65917 AND effectAuraId2 = 4 AND effectId3 = 77), -7, 5)) WHERE s.id = spellId2 AND class = 15 AND spellId1 IN (483, 55884); -- misc items with learn-effect // more corner cases (mounts that are not actualy learned) UPDATE aowow_items i, dbc.spell s SET i.subClass = -7 WHERE (effectId1 = 64 OR (effectAuraId1 = 78 AND effectAuraId2 = 4 AND effectId3 = 77) OR effectAuraId1 = 207 OR effectAuraId2 = 207 OR effectAuraId3 = 207) AND s.id = i.spellId1 AND i.class = 15 AND i.subClass = 5; UPDATE aowow_items i, dbc.spell s SET i.subClass = 5 WHERE s.effectAuraId1 = 78 AND s.id = i.spellId1 AND i.class = 15 AND i.subClass = 0; UPDATE aowow_items i, dbc.spell s SET i.class = 0, i.subClass = 6 WHERE s.effectId1 = 53 AND s.id = i.spellId1 AND i.class = 15 AND i.subClassBak = 0; UPDATE aowow_items i, dbc.spell s SET i.subClass = -3 WHERE s.effectId1 = 54 AND s.id = i.spellId1 AND i.class = 0 AND i.subClassBak = 8; // one stray enchanting recipe .. with a strange icon UPDATE aowow_items SET class = 9, subClass = 8 WHERE id = 33147; UPDATE aowow_items SET subClass = -2 WHERE quality = 4 AND class = 15 AND subClassBak = 0 AND requiredClass AND (requiredClass & 0x5FF) <> 0x5FF; */ class ItemSetup extends ItemList { private $cols = []; public function __construct($start, $end) // i suggest steps of 3k at max (20 steps (0 - 60k)); otherwise eats your ram for breakfast { $this->cols = DB::Aowow()->selectCol('SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA`="world" AND `TABLE_NAME`="aowow_item_stats"'); set_time_limit(300); $conditions = array( ['i.id', $start, '>'], ['i.id', $end, '<='], ['class', [ITEM_CLASS_WEAPON, ITEM_CLASS_GEM, ITEM_CLASS_ARMOR, ITEM_CLASS_CONSUMABLE]], 0 ); parent::__construct($conditions); } public function calcRepairCost() { foreach ($this->iterate() as $id => $__) { $cls = $this->curTpl['class']; $scb = $this->curTpl['subClassBak']; $dur = $this->curTpl['durability']; $qu = $this->curTpl['quality']; // has no durability if (!in_array($cls, [ITEM_CLASS_WEAPON, ITEM_CLASS_ARMOR]) || $dur <= 0) continue; // is relic, misc or obsolete if ($cls == ITEM_CLASS_ARMOR && !in_array($scb, [1, 2, 3, 4, 6])) continue; $cost = DB::Aowow()->selectCell('SELECT ?# FROM ?_durabilityCost WHERE itemLevel = ?', 'class'.$cls.'Sub'.$scb, $this->curTpl['itemLevel'] ); $qMod = Util::$itemDurabilityQualityMod[(($qu + 1) * 2)]; DB::Aowow()->query('UPDATE ?_items SET repairPrice = ?d WHERE id = ?d', intVal($dur * $cost * $qMod), $id); } } public function writeStatsTable() { foreach ($this->iterate() as $__) { $this->extendJsonStats(); $updateFields = []; foreach (@$this->json[$this->id] as $k => $v) { if (!in_array($k, $this->cols) || !$v || $k == 'id') continue; $updateFields[$k] = number_format($v, 2, '.', ''); } if (isset($this->itemMods[$this->id])) { foreach ($this->itemMods[$this->id] as $k => $v) { if (!$v) continue; if ($str = Util::$itemMods[$k]) $updateFields[$str] = number_format($v, 2, '.', ''); } } if ($updateFields) DB::Aowow()->query('REPLACE INTO ?_item_stats (`id`, `'.implode('`, `', array_keys($updateFields)).'`) VALUES (?d, "'.implode('", "', $updateFields).'")', $this->id); } } } ?>