当前位置: 首页>>代码示例>>PHP>>正文


PHP ItemList::iterate方法代码示例

本文整理汇总了PHP中ItemList::iterate方法的典型用法代码示例。如果您正苦于以下问题:PHP ItemList::iterate方法的具体用法?PHP ItemList::iterate怎么用?PHP ItemList::iterate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ItemList的用法示例。


在下文中一共展示了ItemList::iterate方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: generateContent

 protected function generateContent()
 {
     // add conditional js
     $this->addJS('?data=weight-presets.gems.enchants.itemsets&locale=' . User::$localeId . '&t=' . $_SESSION['dataKey']);
     if (!$this->compareString) {
         return;
     }
     $sets = explode(';', $this->compareString);
     $items = $outSet = [];
     foreach ($sets as $set) {
         $itemSting = explode(':', $set);
         $outString = [];
         foreach ($itemSting as $substring) {
             $params = explode('.', $substring);
             $items[] = (int) $params[0];
             while (sizeof($params) < 7) {
                 $params[] = 0;
             }
             $outString[] = $params;
         }
         $outSet[] = $outString;
     }
     $this->summary = $outSet;
     $iList = new ItemList(array(['i.id', $items]));
     $data = $iList->getListviewData(ITEMINFO_SUBITEMS | ITEMINFO_JSON);
     foreach ($iList->iterate() as $itemId => $__) {
         if (empty($data[$itemId])) {
             continue;
         }
         $this->cmpItems[] = [$itemId, $iList->getField('name', true), $iList->getField('quality'), $iList->getField('iconString'), $data[$itemId]];
     }
 }
开发者ID:Carbenium,项目名称:aowow,代码行数:32,代码来源:compare.php

示例2: _searchItem

 private function _searchItem($cndBase, &$shared)
 {
     $result = [];
     $miscData = [];
     $cndAdd = empty($this->query) ? [] : (is_int($this->query) ? ['id', $this->query] : $this->createLookup());
     if ($this->searchMask & SEARCH_TYPE_JSON && $this->searchMask & 0x20 && !empty($shared['pcsToSet'])) {
         $cnd = [['i.id', array_keys($shared['pcsToSet'])], CFG_SQL_LIMIT_NONE];
         $miscData = ['pcsToSet' => $shared['pcsToSet']];
     } else {
         if ($this->searchMask & SEARCH_TYPE_JSON && $this->searchMask & 0x40) {
             $cnd = $cndBase;
             $cnd[] = ['i.class', [ITEM_CLASS_WEAPON, ITEM_CLASS_GEM, ITEM_CLASS_ARMOR]];
             $cnd[] = $cndAdd;
             $slots = isset($_GET['slots']) ? explode(':', $_GET['slots']) : [];
             array_walk($slots, function (&$v, $k) {
                 $v = intVal($v);
             });
             if ($_ = array_filter($slots)) {
                 $cnd[] = ['slot', $_];
             }
             $itemFilter = new ItemListFilter();
             if ($_ = $itemFilter->createConditionsForWeights($this->statWeight)) {
                 $miscData['extraOpts'] = $itemFilter->extraOpts;
                 $cnd = array_merge($cnd, [$_]);
             }
         } else {
             $cnd = array_merge($cndBase, [$cndAdd]);
         }
     }
     $items = new ItemList($cnd, $miscData);
     if ($data = $items->getListviewData($this->searchMask & SEARCH_TYPE_JSON ? ITEMINFO_SUBITEMS | ITEMINFO_JSON : 0)) {
         if ($this->searchMask & SEARCH_TYPE_REGULAR) {
             $this->extendGlobalData($items->getJSGlobals());
         }
         if ($this->searchMask & SEARCH_TYPE_OPEN) {
             foreach ($items->iterate() as $__) {
                 $data[$items->id]['param1'] = $items->getField('iconString');
                 $data[$items->id]['param2'] = $items->getField('quality');
             }
         }
         $result = array('type' => TYPE_ITEM, 'appendix' => ' (Item)', 'matches' => $items->getMatches(), 'file' => ItemList::$brickFile, 'data' => $data, 'params' => []);
         if ($items->getMatches() > $this->maxResults) {
             $result['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_itemsfound', $items->getMatches(), $this->maxResults);
             $result['params']['_truncated'] = 1;
         }
         if (isset($result['params']['note'])) {
             $result['params']['note'] .= ' + LANG.dash + $WH.sprintf(LANG.lvnote_filterresults, \'?items&filter=na=' . urlencode($this->search) . '\')';
         } else {
             $result['params']['note'] = '$$WH.sprintf(LANG.lvnote_filterresults, \'?items&filter=na=' . urlencode($this->search) . '\')';
         }
     }
     return $result;
 }
开发者ID:Niknox,项目名称:aowow,代码行数:53,代码来源:search.php

示例3: renderTooltip


//.........这里部分代码省略.........
     }
     // required reputation w/ faction
     if ($reqFac = $this->curTpl['requiredFaction']) {
         $x .= sprintf(Lang::game('requires'), '<a class="q1" href=?faction="' . $reqFac . '">' . FactionList::getName($reqFac) . '</a> - ' . Lang::game('rep', $this->curTpl['requiredFactionRank'])) . '<br />';
     }
     // locked or openable
     if ($locks = Lang::getLocks($this->curTpl['lockId'], true)) {
         $x .= '<span class="q0">' . Lang::item('locked') . '<br />' . implode('<br />', $locks) . '</span><br />';
     } else {
         if ($this->curTpl['flags'] & ITEM_FLAG_OPENABLE) {
             $x .= '<span class="q2">' . Lang::item('openClick') . '</span><br />';
         }
     }
     // upper table: done
     if (!$subOf) {
         $x .= '</td></tr></table>';
     }
     // spells on item
     if (!$this->canTeachSpell()) {
         $itemSpellsAndTrigger = [];
         for ($j = 1; $j <= 5; $j++) {
             if ($this->curTpl['spellId' . $j] > 0) {
                 $cd = $this->curTpl['spellCooldown' . $j];
                 if ($cd < $this->curTpl['spellCategoryCooldown' . $j]) {
                     $cd = $this->curTpl['spellCategoryCooldown' . $j];
                 }
                 $cd = $cd < 5000 ? null : ' (' . sprintf(Lang::game('cooldown'), Util::formatTime($cd)) . ')';
                 $itemSpellsAndTrigger[$this->curTpl['spellId' . $j]] = [$this->curTpl['spellTrigger' . $j], $cd];
             }
         }
         if ($itemSpellsAndTrigger) {
             $cooldown = '';
             $itemSpells = new SpellList(array(['s.id', array_keys($itemSpellsAndTrigger)]));
             foreach ($itemSpells->iterate() as $__) {
                 if ($parsed = $itemSpells->parseText('description', $_reqLvl > 1 ? $_reqLvl : MAX_LEVEL, false, $causesScaling)[0]) {
                     if ($interactive) {
                         $link = '<a href="?spell=' . $itemSpells->id . '">%s</a>';
                         $parsed = preg_replace_callback('/([^;]*)(&nbsp;<small>.*?<\\/small>)([^&]*)/i', function ($m) use($link) {
                             $m[1] = $m[1] ? sprintf($link, $m[1]) : '';
                             $m[3] = $m[3] ? sprintf($link, $m[3]) : '';
                             return $m[1] . $m[2] . $m[3];
                         }, $parsed, -1, $nMatches);
                         if (!$nMatches) {
                             $parsed = sprintf($link, $parsed);
                         }
                     }
                     $green[] = Lang::item('trigger', $itemSpellsAndTrigger[$itemSpells->id][0]) . $parsed . $itemSpellsAndTrigger[$itemSpells->id][1];
                 }
             }
         }
     }
     // lower table (ratings, spells, ect)
     if (!$subOf) {
         $x .= '<table><tr><td>';
     }
     if (isset($green)) {
         foreach ($green as $j => $bonus) {
             if ($bonus) {
                 $x .= '<span class="q2">' . $bonus . '</span><br />';
             }
         }
     }
     // Item Set
     $pieces = [];
     if ($setId = $this->getField('itemset')) {
         // while Ids can technically be used multiple times the only difference in data are the items used. So it doesn't matter what we get
开发者ID:saqar,项目名称:aowow,代码行数:67,代码来源:item.class.php

示例4: generateContent

 protected function generateContent()
 {
     $_ta = $this->subject->getField('contentGroup');
     $_ty = $this->subject->getField('type');
     $_cnt = count($this->subject->getField('pieces'));
     /***********/
     /* Infobox */
     /***********/
     $infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
     // unavailable (todo (low): set data)
     if ($this->subject->getField('cuFlags') & CUSTOM_UNAVAILABLE) {
         $infobox[] = Lang::main('unavailable');
     }
     // worldevent
     if ($e = $this->subject->getField('eventId')) {
         $infobox[] = Lang::game('eventShort') . Lang::main('colon') . '[event=' . $e . ']';
         $this->extendGlobalIds(TYPE_WORLDEVENT, $e);
     }
     // itemLevel
     if ($min = $this->subject->getField('minLevel')) {
         $foo = Lang::game('level') . Lang::main('colon') . $min;
         $max = $this->subject->getField('maxLevel');
         if ($min < $max) {
             $foo .= ' - ' . $max;
         }
         $infobox[] = $foo;
     }
     // class
     if ($cl = Lang::getClassString($this->subject->getField('classMask'), $jsg, $qty, false)) {
         $this->extendGlobalIds(TYPE_CLASS, $jsg);
         $t = $qty == 1 ? Lang::game('class') : Lang::game('classes');
         $infobox[] = Util::ucFirst($t) . Lang::main('colon') . $cl;
     }
     // required level
     if ($lvl = $this->subject->getField('reqLevel')) {
         $infobox[] = sprintf(Lang::game('reqLevel'), $lvl);
     }
     // type
     if ($_ty) {
         $infobox[] = Lang::game('type') . Lang::main('colon') . Lang::itemset('types', $_ty);
     }
     // tag
     if ($_ta) {
         $infobox[] = Lang::itemset('_tag') . Lang::main('colon') . '[url=?itemsets&filter=ta=' . $_ta . ']' . Lang::itemset('notes', $_ta) . '[/url]';
     }
     /****************/
     /* Main Content */
     /****************/
     // pieces + Summary
     $pieces = [];
     $eqList = [];
     $compare = [];
     if (!$this->subject->pieceToSet) {
         $cnd = [0];
     } else {
         $cnd = ['i.id', array_keys($this->subject->pieceToSet)];
     }
     $iList = new ItemList(array($cnd));
     $data = $iList->getListviewData(ITEMINFO_SUBITEMS | ITEMINFO_JSON);
     foreach ($iList->iterate() as $itemId => $__) {
         if (empty($data[$itemId])) {
             continue;
         }
         $slot = $iList->getField('slot');
         $disp = $iList->getField('displayId');
         if ($slot && $disp) {
             $eqList[] = [$slot, $disp];
         }
         $compare[] = $itemId;
         $pieces[] = array('id' => $itemId, 'name' => $iList->getField('name', true), 'quality' => $iList->getField('quality'), 'icon' => $iList->getField('iconString'), 'json' => $data[$itemId]);
     }
     $skill = '';
     if ($_sk = $this->subject->getField('skillId')) {
         $spellLink = sprintf('<a href="?spells=11.%s">%s</a> (%s)', $_sk, Lang::spell('cat', 11, $_sk, 0), $this->subject->getField('skillLevel'));
         $skill = ' &ndash; <small><b>' . sprintf(Lang::game('requires'), $spellLink) . '</b></small>';
     }
     $this->bonusExt = $skill;
     $this->description = $_ta ? sprintf(Lang::itemset('_desc'), $this->name, Lang::itemset('notes', $_ta), $_cnt) : sprintf(Lang::itemset('_descTagless'), $this->name, $_cnt);
     $this->unavailable = $this->subject->getField('cuFlags') & CUSTOM_UNAVAILABLE;
     $this->infobox = $infobox ? '[ul][li]' . implode('[/li][li]', $infobox) . '[/li][/ul]' : null;
     $this->pieces = $pieces;
     $this->spells = $this->subject->getBonuses();
     $this->expansion = 0;
     $this->redButtons = array(BUTTON_WOWHEAD => $this->typeId > 0, BUTTON_LINKS => ['color' => '', 'linkId' => ''], BUTTON_VIEW3D => ['type' => TYPE_ITEMSET, 'typeId' => $this->typeId, 'equipList' => $eqList], BUTTON_COMPARE => ['eqList' => implode(':', $compare), 'qty' => $_cnt]);
     $this->compare = array('level' => $this->subject->getField('reqLevel'), 'items' => array_map(function ($v) {
         return [[$v]];
     }, $compare));
     /**************/
     /* Extra Tabs */
     /**************/
     // related sets (priority: 1: similar tag + class; 2: has event; 3: no tag + similar type, 4: similar type + profession)
     $rel = [];
     if ($_ta && count($this->path) == 3) {
         $rel[] = ['id', $this->typeId, '!'];
         $rel[] = ['classMask', 1 << end($this->path) - 1, '&'];
         $rel[] = ['contentGroup', (int) $_ta];
     } else {
         if ($this->subject->getField('eventId')) {
             $rel[] = ['id', $this->typeId, '!'];
             $rel[] = ['eventId', 0, '!'];
//.........这里部分代码省略.........
开发者ID:saqar,项目名称:aowow,代码行数:101,代码来源:itemset.php

示例5: generateContent

 protected function generateContent()
 {
     /***********/
     /* Infobox */
     /***********/
     $infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
     // points
     if ($_ = $this->subject->getField('points')) {
         $infobox[] = Lang::achievement('points') . Lang::main('colon') . '[achievementpoints=' . $_ . ']';
     }
     // location
     // todo (low)
     // faction
     switch ($this->subject->getField('faction')) {
         case 1:
             $infobox[] = Lang::main('side') . Lang::main('colon') . '[span class=icon-alliance]' . Lang::game('si', SIDE_ALLIANCE) . '[/span]';
             break;
         case 2:
             $infobox[] = Lang::main('side') . Lang::main('colon') . '[span class=icon-horde]' . Lang::game('si', SIDE_HORDE) . '[/span]';
             break;
         default:
             // case 3
             $infobox[] = Lang::main('side') . Lang::main('colon') . Lang::game('si', SIDE_BOTH);
     }
     // realm first available?
     if ($this->subject->getField('flags') & 0x100 && DB::isConnectable(DB_AUTH)) {
         $avlb = [];
         foreach (DB::Auth()->selectCol('SELECT id AS ARRAY_KEY, name FROM realmlist WHERE allowedSecurityLevel = 0 AND gamebuild = ?d', WOW_VERSION) as $rId => $name) {
             if (!DB::isConnectable(DB_CHARACTERS . $rId)) {
                 continue;
             }
             if (!DB::Characters($rId)->selectCell('SELECT 1 FROM character_achievement WHERE achievement = ?d LIMIT 1', $this->typeId)) {
                 $avlb[] = $name;
             }
         }
         if ($avlb) {
             $infobox[] = Lang::achievement('rfAvailable') . implode(', ', $avlb);
         }
     }
     /**********/
     /* Series */
     /**********/
     $series = [];
     if ($c = $this->subject->getField('chainId')) {
         $chainAcv = new AchievementList(array(['chainId', $c]));
         foreach ($chainAcv->iterate() as $aId => $__) {
             $pos = $chainAcv->getField('chainPos');
             if (!isset($series[$pos])) {
                 $series[$pos] = [];
             }
             $series[$pos][] = array('side' => $chainAcv->getField('faction'), 'typeStr' => Util::$typeStrings[TYPE_ACHIEVEMENT], 'typeId' => $aId, 'name' => $chainAcv->getField('name', true));
         }
     }
     /****************/
     /* Main Content */
     /****************/
     $this->mail = $this->createMail($reqBook);
     $this->headIcons = [$this->subject->getField('iconString')];
     $this->infobox = $infobox ? '[ul][li]' . implode('[/li][li]', $infobox) . '[/li][/ul]' : null;
     $this->series = $series ? [[$series, null]] : null;
     $this->description = $this->subject->getField('description', true);
     $this->redButtons = array(BUTTON_LINKS => ['color' => 'ffffff00', 'linkId' => Util::$typeStrings[TYPE_ACHIEVEMENT] . ':' . $this->typeId . ':&quot;..UnitGUID(&quot;player&quot;)..&quot;:0:0:0:0:0:0:0:0'], BUTTON_WOWHEAD => !($this->subject->getField('cuFlags') & CUSTOM_SERVERSIDE));
     $this->criteria = array('reqQty' => $this->subject->getField('reqCriteriaCount'), 'icons' => [], 'data' => []);
     if ($reqBook) {
         $this->addCss(['path' => 'Book.css']);
     }
     // create rewards
     if ($foo = $this->subject->getField('rewards')) {
         array_walk($foo, function (&$item) {
             $item = $item[0] != TYPE_ITEM ? null : $item[1];
         });
         $bar = new ItemList(array(['i.id', $foo]));
         foreach ($bar->iterate() as $id => $__) {
             $this->rewards['item'][] = array('name' => $bar->getField('name', true), 'quality' => $bar->getField('quality'), 'typeStr' => Util::$typeStrings[TYPE_ITEM], 'id' => $id, 'globalStr' => 'g_items');
         }
     }
     if ($foo = $this->subject->getField('rewards')) {
         array_walk($foo, function (&$item) {
             $item = $item[0] != TYPE_TITLE ? null : $item[1];
         });
         $bar = new TitleList(array(['id', $foo]));
         foreach ($bar->iterate() as $__) {
             $this->rewards['title'][] = sprintf(Lang::achievement('titleReward'), $bar->id, trim(str_replace('%s', '', $bar->getField('male', true))));
         }
     }
     $this->rewards['text'] = $this->subject->getField('reward', true);
     // factionchange-equivalent
     if ($pendant = DB::World()->selectCell('SELECT IF(horde_id = ?d, alliance_id, -horde_id) FROM player_factionchange_achievement WHERE alliance_id = ?d OR horde_id = ?d', $this->typeId, $this->typeId, $this->typeId)) {
         $altAcv = new AchievementList(array(['id', abs($pendant)]));
         if (!$altAcv->error) {
             $this->transfer = sprintf(Lang::achievement('_transfer'), $altAcv->id, 1, $altAcv->getField('iconString'), $altAcv->getField('name', true), $pendant > 0 ? 'alliance' : 'horde', $pendant > 0 ? Lang::game('si', 1) : Lang::game('si', 2));
         }
     }
     /**************/
     /* Extra Tabs */
     /**************/
     // tab: see also
     $conditions = array(['name_loc' . User::$localeId, $this->subject->getField('name', true)], ['id', $this->typeId, '!']);
     $saList = new AchievementList($conditions);
     $this->lvTabs[] = array('file' => 'achievement', 'data' => $saList->getListviewData(), 'params' => array('id' => 'see-also', 'name' => '$LANG.tab_seealso', 'visibleCols' => "\$['category']"));
//.........这里部分代码省略.........
开发者ID:Carbenium,项目名称:aowow,代码行数:101,代码来源:achievement.php

示例6: generateContent


//.........这里部分代码省略.........
                     }
                     return $foo;
                 };
                 $bLink = $gemCnd['color' . $i] ? '<a href="?items=3&filter=ty=' . $fiColors($gemCnd['color' . $i]) . '">' . Lang::item('gemColors', $gemCnd['color' . $i] - 1) . '</a>' : '';
                 $cLink = $gemCnd['cmpColor' . $i] ? '<a href="?items=3&filter=ty=' . $fiColors($gemCnd['cmpColor' . $i]) . '">' . Lang::item('gemColors', $gemCnd['cmpColor' . $i] - 1) . '</a>' : '';
                 switch ($gemCnd['comparator' . $i]) {
                     case 2:
                         // requires less <color> than (<value> || <comparecolor>) gems
                     // requires less <color> than (<value> || <comparecolor>) gems
                     case 5:
                         // requires at least <color> than (<value> || <comparecolor>) gems
                         $sp = (int) $gemCnd['value' . $i] > 1;
                         $x .= '<span class="q0">' . Lang::achievement('reqNumCrt') . ' ' . sprintf(Lang::item('gemConditions', $gemCnd['comparator' . $i], $sp), $gemCnd['value' . $i], $bLink) . '</span><br />';
                         break;
                     case 3:
                         // requires more <color> than (<value> || <comparecolor>) gems
                         $link = '<a href="?items=3&filter=ty=' . $fiColors($gemCnd['cmpColor' . $i]) . '">' . Lang::item('gemColors', $gemCnd['cmpColor' . $i] - 1) . '</a>';
                         $x .= '<span class="q0">' . Lang::achievement('reqNumCrt') . ' ' . sprintf(Lang::item('gemConditions', 3), $bLink, $cLink) . '</span><br />';
                         break;
                 }
             }
         }
         $this->activateCondition = $x;
     }
     /**************/
     /* Extra Tabs */
     /**************/
     // used by gem
     $gemList = new ItemList(array(['gemEnchantmentId', $this->typeId]));
     if (!$gemList->error) {
         $this->lvTabs[] = ['item', array('data' => array_values($gemList->getListviewData()), 'name' => '$LANG.tab_usedby + \' \' + LANG.gems', 'id' => 'used-by-gem')];
         $this->extendGlobalData($gemList->getJsGlobals());
     }
     // used by socket bonus
     $socketsList = new ItemList(array(['socketBonus', $this->typeId]));
     if (!$socketsList->error) {
         $this->lvTabs[] = ['item', array('data' => array_values($socketsList->getListviewData()), 'name' => '$LANG.tab_usedby + \' \' + \'' . Lang::item('socketBonus') . '\'', 'id' => 'used-by-socketbonus')];
         $this->extendGlobalData($socketsList->getJsGlobals());
     }
     // used by spell
     // used by useItem
     $cnd = array('OR', ['AND', ['effect1Id', [53, 54, 156, 92]], ['effect1MiscValue', $this->typeId]], ['AND', ['effect2Id', [53, 54, 156, 92]], ['effect2MiscValue', $this->typeId]], ['AND', ['effect3Id', [53, 54, 156, 92]], ['effect3MiscValue', $this->typeId]]);
     $spellList = new SpellList($cnd);
     if (!$spellList->error) {
         $spellData = $spellList->getListviewData();
         $this->extendGlobalData($spellList->getJsGlobals());
         $spellIds = $spellList->getFoundIDs();
         $conditions = array('OR', ['AND', ['spellTrigger1', [0, 5]], ['spellId1', $spellIds]], ['AND', ['spellTrigger2', [0, 5]], ['spellId2', $spellIds]], ['AND', ['spellTrigger3', [0, 5]], ['spellId3', $spellIds]], ['AND', ['spellTrigger4', [0, 5]], ['spellId4', $spellIds]], ['AND', ['spellTrigger5', [0, 5]], ['spellId5', $spellIds]]);
         $ubItems = new ItemList($conditions);
         if (!$ubItems->error) {
             $this->lvTabs[] = ['item', array('data' => array_values($ubItems->getListviewData()), 'name' => '$LANG.tab_usedby + \' \' + LANG.types[3][0]', 'id' => 'used-by-item')];
             $this->extendGlobalData($ubItems->getJSGlobals(GLOBALINFO_SELF));
         }
         // remove found spells if they are used by an item
         if (!$ubItems->error) {
             foreach ($spellList->iterate() as $sId => $__) {
                 // if Perm. Enchantment has a createItem its a Scroll of Enchantment (display both)
                 for ($i = 1; $i < 4; $i++) {
                     if ($spellList->getField('effect' . $i . 'Id') == 53 && $spellList->getField('effect' . $i . 'CreateItemId')) {
                         continue 2;
                     }
                 }
                 foreach ($ubItems->iterate() as $__) {
                     for ($i = 1; $i < 6; $i++) {
                         if ($ubItems->getField('spellId' . $i) == $sId) {
                             unset($spellData[$sId]);
                             break 2;
                         }
                     }
                 }
             }
         }
         $this->lvTabs[] = ['spell', array('data' => array_values($spellData), 'name' => '$LANG.tab_usedby + \' \' + LANG.types[6][0]', 'id' => 'used-by-spell')];
     }
     // used by randomAttrItem
     $ire = DB::Aowow()->select('SELECT *, ABS(id) AS ARRAY_KEY FROM ?_itemrandomenchant WHERE enchantId1 = ?d OR enchantId2 = ?d OR enchantId3 = ?d OR enchantId4 = ?d OR enchantId5 = ?d', $this->typeId, $this->typeId, $this->typeId, $this->typeId, $this->typeId);
     if ($ire) {
         if ($iet = DB::World()->select('SELECT entry AS ARRAY_KEY, ench, chance FROM item_enchantment_template WHERE ench IN (?a)', array_keys($ire))) {
             $randIds = [];
             // transform back to signed format
             foreach ($iet as $tplId => $data) {
                 $randIds[$ire[$data['ench']]['id'] > 0 ? $tplId : -$tplId] = $ire[$data['ench']]['id'];
             }
             $randItems = new ItemList(array(CFG_SQL_LIMIT_NONE, ['randomEnchant', array_keys($randIds)]));
             if (!$randItems->error) {
                 $data = $randItems->getListviewData();
                 foreach ($randItems->iterate() as $iId => $__) {
                     $re = $randItems->getField('randomEnchant');
                     $data[$iId]['percent'] = $iet[abs($re)]['chance'];
                     $data[$iId]['count'] = 1;
                     // expected by js or the pct-col becomes unsortable
                     $data[$iId]['rel'] = 'rand=' . $ire[$iet[abs($re)]['ench']]['id'];
                     $data[$iId]['name'] .= ' ' . Util::localizedString($ire[$iet[abs($re)]['ench']], 'name');
                 }
                 $this->lvTabs[] = ['item', array('data' => array_values($data), 'id' => 'used-by-rand', 'name' => '$LANG.tab_usedby + \' \' + \'' . Lang::item('_rndEnchants') . '\'', 'extraCols' => ['$Listview.extraCols.percent'])];
                 $this->extendGlobalData($randItems->getJSGlobals(GLOBALINFO_SELF));
             }
         }
     }
 }
开发者ID:TrinityCore,项目名称:aowow,代码行数:101,代码来源:enchantment.php

示例7: generateContent


//.........这里部分代码省略.........
         // slot: (try to limit the lookups by class grouping and intersecting with preselected slots)
         // if intersect yields an empty array no lookups will occur
         case 1:
             if (isset($this->category[0]) && $this->category[0] == ITEM_CLASS_ARMOR) {
                 $groups = $availableSlots[ITEM_CLASS_ARMOR];
             } else {
                 if (isset($this->category[0]) && $this->category[0] == ITEM_CLASS_WEAPON) {
                     $groups = $availableSlots[ITEM_CLASS_WEAPON];
                 } else {
                     $groups = array_merge($availableSlots[ITEM_CLASS_ARMOR], $availableSlots[ITEM_CLASS_WEAPON]);
                 }
             }
             if (isset($this->filter['sl'])) {
                 // skip lookups for unselected slots
                 $groups = array_intersect($groups, (array) $this->filter['sl']);
             }
             if (!empty($this->filter['upg'])) {
                 // skip lookups for slots we dont have items to upgrade for
                 $groups = array_intersect($groups, (array) $this->filter['upg']);
             }
             if ($groups) {
                 $nameSource = Lang::item('inventoryType');
                 $this->forceTabs = true;
             }
             break;
         case 2:
             // itemlevel: first, try to find 10 level steps within range (if given) as tabs
             // ohkayy, maybe i need to rethink $this
             $this->filterOpts = $this->filterObj->extraOpts;
             $this->filterOpts['is']['o'] = [null];
             // remove 'order by' from itemStats
             $extraOpts = array_merge($this->filterOpts, ['i' => ['g' => ['itemlevel'], 'o' => ['itemlevel DESC']]]);
             $levelRef = new ItemList(array_merge($conditions, [10]), ['extraOpts' => $extraOpts]);
             foreach ($levelRef->iterate() as $_) {
                 $l = $levelRef->getField('itemLevel');
                 $groups[] = $l;
                 $nameSource[$l] = Lang::game('level') . ' ' . $l;
             }
             if ($groups) {
                 $l = -end($groups);
                 $groups[] = $l;
                 // push last value as negativ to signal misc group after $this level
                 $extraOpts = ['i' => ['o' => ['itemlevel DESC']]];
                 $nameSource[$l] = Lang::item('tabOther');
                 $this->forceTabs = true;
             }
             break;
         case 3:
             // source
             $groups = [1, 2, 3, 4, 5, 10, 11, 12, 0];
             $nameSource = Lang::game('sources');
             $this->forceTabs = true;
             break;
             // none
         // none
         default:
             $grouping = 0;
             $groups[0] = null;
     }
     /*****************************/
     /* create lv-tabs for groups */
     /*****************************/
     foreach ($groups as $group) {
         switch ($grouping) {
             case 1:
                 $finalCnd = array_merge($conditions, [['slot', $group], $maxResults]);
开发者ID:TrinityCore,项目名称:aowow,代码行数:67,代码来源:items.php

示例8: handleLoad

 protected function handleLoad()
 {
     /*  params
                 id: profileId
                 items: string       [itemIds.join(':')]
                 unnamed: unixtime   [only to force the browser to reload instead of cache]
             return
                 lots...
         */
     // titles, achievements, characterData, talents (, pets)
     // and some onLoad-hook to .. load it registerProfile($data)
     // everything else goes through data.php .. strangely enough
     if (!$this->_get['id']) {
         return;
     }
     $char = new ProfileList(array(['id', $this->_get['id'][0]]));
     // or string or whatever
     $buff = '';
     if ($it = array_column($char->getField('inventory'), 0)) {
         $itemz = new ItemList(array(['id', $it, CFG_SQL_LIMIT_NONE]));
         $data = $itemz->getListviewData(ITEMINFO_JSON | ITEMINFO_SUBITEMS);
         // get and apply inventory
         foreach ($itemz->iterate() as $iId => $__) {
             $buff .= 'g_items.add(' . $iId . ', {name_' . User::$localeString . ":'" . Util::jsEscape($itemz->getField('name', true)) . "', quality:" . $itemz->getField('quality') . ", icon:'" . $itemz->getField('iconString') . "', jsonequip:" . Util::toJSON($data[$iId]) . "});\n";
         }
         $buff .= "\n";
     }
     if ($au = $char->getField('auras')) {
         $auraz = new SpellList(array(['id', $char->getField('auras')], CFG_SQL_LIMIT_NONE));
         $dataz = $auraz->getListviewData();
         $modz = $auraz->getProfilerMods();
         // get and apply aura-mods
         foreach ($dataz as $id => $data) {
             $mods = [];
             if (!empty($modz[$id])) {
                 foreach ($modz[$id] as $k => $v) {
                     if (is_array($v)) {
                         $mods[] = $v;
                     } else {
                         if ($str = @Util::$itemMods[$k]) {
                             $mods[$str] = $v;
                         }
                     }
                 }
             }
             $buff .= 'g_spells.add(' . $id . ", {id:" . $id . ", name:'" . Util::jsEscape(mb_substr($data['name'], 1)) . "', icon:'" . $data['icon'] . "', modifier:" . Util::toJSON($mods) . "});\n";
         }
         $buff .= "\n";
     }
     /* depending on progress-achievements
            // required by progress in JScript move to handleLoad()?
            Util::$pageTemplate->extendGlobalIds(TYPE_NPC, [29120, 31134, 29306, 29311, 23980, 27656, 26861, 26723, 28923, 15991]);
        */
     // load available titles
     Util::loadStaticFile('p-titles-' . $char->getField('gender'), $buff, true);
     // load available achievements
     if (!Util::loadStaticFile('p-achievements', $buff, true)) {
         $buff .= "\n\ng_achievement_catorder = [];";
         $buff .= "\n\ng_achievement_points = [0];";
     }
     // excludes; structure UNK type => [maskBit => [typeIds]] ?
     /*
         g_user.excludes = [type:[typeIds]]
         g_user.includes = [type:[typeIds]]
         g_user.excludegroups = groupMask        // requires g_user.settings != null
     
         maskBit are matched against fieldId from excludeGroups
         id: 1, label: LANG.dialog_notavail
         id: 2, label: LANG.dialog_tcg
         id: 4, label: LANG.dialog_collector
         id: 8, label: LANG.dialog_promo
         id: 16, label: LANG.dialog_nonus
         id: 96, label: LANG.dialog_faction
         id: 896, label: LANG.dialog_profession
         id: 1024, label: LANG.dialog_noexalted
     */
     // $buff .= "\n\ng_excludes = {};";
     // add profile to buffer
     $buff .= "\n\n\$WowheadProfiler.registerProfile(" . Util::toJSON($char->getEntry(2)) . ");";
     // can't use JSON_NUMERIC_CHECK or the talent-string becomes a float
     return $buff . "\n";
 }
开发者ID:saqar,项目名称:aowow,代码行数:82,代码来源:profile.class.php


注:本文中的ItemList::iterate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。