예제 #1
0
 public function renderTooltip()
 {
     if (!$this->curTpl) {
         return array();
     }
     $x = '<table><tr><td>';
     $x .= '<span class="q' . $this->getField('quality') . '">' . Util::jsEscape($this->getField('name', true)) . '</span><br />';
     $nClasses = 0;
     if ($_ = $this->getField('classMask')) {
         $cl = Lang::getClassString($_, $__, $nClasses);
         $x .= Util::ucFirst($nClasses > 1 ? Lang::game('classes') : Lang::game('class')) . Lang::main('colon') . $cl . '<br />';
     }
     if ($_ = $this->getField('contentGroup')) {
         $x .= Util::jsEscape(Lang::itemset('notes', $_)) . ($this->getField('heroic') ? ' <i class="q2">(' . Lang::item('heroic') . ')</i>' : '') . '<br />';
     }
     if (!$nClasses || !$this->getField('contentGroup')) {
         $x .= Lang::itemset('types', $this->getField('type')) . '<br />';
     }
     if ($bonuses = $this->getBonuses()) {
         $x .= '<span>';
         foreach ($bonuses as $b) {
             $x .= '<br /><span class=\\"q13\\">' . $b['bonus'] . ' ' . Lang::itemset('_pieces') . Lang::main('colon') . '</span>' . Util::jsEscape($b['desc']);
         }
         $x .= '</span>';
     }
     $x .= '</td></tr></table>';
     return $x;
 }
예제 #2
0
파일: itemset.php 프로젝트: saqar/aowow
 public function notFound()
 {
     if ($this->mode != CACHE_TYPE_TOOLTIP) {
         return parent::notFound(Lang::game('itemset'), Lang::itemset('notFound'));
     }
     header('Content-type: application/x-javascript; charset=utf-8');
     echo $this->generateTooltip(true);
     exit;
 }
예제 #3
0
파일: itemset.php 프로젝트: Carbenium/aowow
 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');
     }
     // holiday
     if ($h = $this->subject->getField('holidayId')) {
         $infobox[] = Lang::game('eventShort') . Lang::main('colon') . '[event=' . $h . ']';
         $this->extendGlobalIds(TYPE_WORLDEVENT, $h);
     }
     // 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]);
     }
     // spells
     $foo = [];
     $spells = [];
     for ($i = 1; $i < 9; $i++) {
         $spl = $this->subject->getField('spell' . $i);
         $qty = $this->subject->getField('bonus' . $i);
         if ($spl && $qty) {
             $foo[] = $spl;
             $spells[] = array('id' => $spl, 'bonus' => $qty, 'desc' => '');
         }
     }
     // sort by required pieces ASC
     usort($spells, function ($a, $b) {
         if ($a['bonus'] == $b['bonus']) {
             return 0;
         }
         return $a['bonus'] > $b['bonus'] ? 1 : -1;
     });
     $setSpells = new SpellList(array(['s.id', $foo]));
     foreach ($setSpells->iterate() as $spellId => $__) {
         foreach ($spells as &$s) {
             if ($spellId != $s['id']) {
                 continue;
             }
             $s['desc'] = $setSpells->parseText('description')[0];
         }
     }
     $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 = $spells;
     $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('holidayId')) {
             $rel[] = ['id', $this->typeId, '!'];
             $rel[] = ['holidayId', 0, '!'];
         } else {
             if ($this->subject->getField('skillId')) {
                 $rel[] = ['id', $this->typeId, '!'];
                 $rel[] = ['contentGroup', 0];
                 $rel[] = ['skillId', 0, '!'];
                 $rel[] = ['type', $_ty];
             } else {
                 if (!$_ta && $_ty) {
                     $rel[] = ['id', $this->typeId, '!'];
                     $rel[] = ['contentGroup', 0];
                     $rel[] = ['type', $_ty];
                     $rel[] = ['skillId', 0];
                 }
             }
         }
     }
     if ($rel) {
         $relSets = new ItemsetList($rel);
         if (!$relSets->error) {
             $lv = array('file' => 'itemset', 'data' => $relSets->getListviewData(), 'params' => array('id' => 'see-also', 'name' => '$LANG.tab_seealso'));
             if (!$relSets->hasDiffFields(['classMask'])) {
                 $lv['params']['hiddenCols'] = "\$['classes']";
             }
             $this->lvTabs[] = $lv;
             $this->extendGlobalData($relSets->getJSGlobals());
         }
     }
 }
예제 #4
0
?>
</h3>

<?php 
echo "                " . Lang::itemset('_conveyBonus') . "\n";
?>
                <ul>
<?php 
foreach ($this->spells as $i => $s) {
    echo '                    <li><div>' . $s['bonus'] . ' ' . Lang::itemset('_pieces') . Lang::main('colon') . '<a href="?spell=' . $s['id'] . '">' . $s['desc'] . "</a></div></li>\n";
}
?>
                </ul>

                <h2 class="clear"><?php 
echo Lang::itemset('summary');
?>
</h2>

                <div id="summary-generic"></div>
                <script type="text/javascript">//<![CDATA[
                    new Summary(<?php 
echo Util::toJSON($this->summary);
?>
);
                //]]></script>

                <h2 class="clear"><?php 
echo Lang::main('related');
?>
</h2>
예제 #5
0
    if ($str) {
        echo '                            <option value="' . $i . '"' . (isset($f['cl']) && $i == $f['cl'] ? ' selected' : null) . '>' . $str . "</option>\n";
    }
}
?>
                            </select></td>
                            <td class="padded">
                                <table><tr>
                                    <td>&nbsp;&nbsp;&nbsp;<?php 
echo Lang::itemset('_tag') . Lang::main('colon');
?>
</td>
                                    <td>&nbsp;<select name="ta">
                                        <option></option>
<?php 
foreach (Lang::itemset('notes') as $i => $str) {
    if ($str) {
        echo '                            <option value="' . $i . '"' . (isset($f['ta']) && $i == $f['ta'] ? ' selected' : null) . '>' . $str . "</option>\n";
    }
}
?>
                                    </select></td>
                                </tr></table>
                            </td>
                        </tr>
                    </table>

                    <div id="fi_criteria" class="padded criteria"><div></div></div>
                    <div><a href="javascript:;" id="fi_addcriteria" onclick="fi_addCriterion(this); return false"><?php 
echo Lang::main('addFilter');
?>