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; }
protected function generateContent() { /***********/ /* Infobox */ /***********/ $infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags')); if ($this->subject->getField('side') == SIDE_ALLIANCE) { $infobox[] = Lang::main('side') . Lang::main('colon') . '[span class=icon-alliance]' . Lang::game('si', SIDE_ALLIANCE) . '[/span]'; } else { if ($this->subject->getField('side') == SIDE_HORDE) { $infobox[] = Lang::main('side') . Lang::main('colon') . '[span class=icon-horde]' . Lang::game('si', SIDE_HORDE) . '[/span]'; } else { $infobox[] = Lang::main('side') . Lang::main('colon') . Lang::game('si', SIDE_BOTH); } } if ($g = $this->subject->getField('gender')) { $infobox[] = Lang::main('gender') . Lang::main('colon') . '[span class=icon-' . ($g == 2 ? 'female' : 'male') . ']' . Lang::main('sex', $g) . '[/span]'; } if ($eId = $this->subject->getField('eventId')) { $this->extendGlobalIds(TYPE_WORLDEVENT, $eId); $infobox[] = Lang::game('eventShort') . Lang::main('colon') . '[event=' . $eId . ']'; } /****************/ /* Main Content */ /****************/ $this->infobox = $infobox ? '[ul][li]' . implode('[/li][li]', $infobox) . '[/li][/ul]' : null; $this->expansion = Util::$expansionString[$this->subject->getField('expansion')]; $this->redButtons = array(BUTTON_WOWHEAD => true, BUTTON_LINKS => ['name' => $this->nameFixed]); // factionchange-equivalent if ($pendant = DB::World()->selectCell('SELECT IF(horde_id = ?d, alliance_id, -horde_id) FROM player_factionchange_titles WHERE alliance_id = ?d OR horde_id = ?d', $this->typeId, $this->typeId, $this->typeId)) { $altTitle = new TitleList(array(['id', abs($pendant)])); if (!$altTitle->error) { $this->transfer = sprintf(Lang::title('_transfer'), $altTitle->id, $altTitle->getHtmlizedName(), $pendant > 0 ? 'alliance' : 'horde', $pendant > 0 ? Lang::game('si', 1) : Lang::game('si', 2)); } } /**************/ /* Extra Tabs */ /**************/ // tab: quest source $quests = new QuestList(array(['rewardTitleId', $this->typeId])); if (!$quests->error) { $this->extendGlobalData($quests->getJSGlobals(GLOBALINFO_REWARDS)); $this->lvTabs[] = ['quest', array('data' => array_values($quests->getListviewData()), 'id' => 'reward-from-quest', 'name' => '$LANG.tab_rewardfrom', 'hiddenCols' => ['experience', 'money'], 'visibleCols' => ['category'])]; } // tab: achievement source if ($aIds = DB::World()->selectCol('SELECT entry FROM achievement_reward WHERE title_A = ?d OR title_H = ?d', $this->typeId, $this->typeId)) { $acvs = new AchievementList(array(['id', $aIds])); if (!$acvs->error) { $this->extendGlobalData($acvs->getJSGlobals()); $this->lvTabs[] = ['achievement', array('data' => array_values($acvs->getListviewData()), 'id' => 'reward-from-achievement', 'name' => '$LANG.tab_rewardfrom', 'visibleCols' => ['category'], 'sort' => ['reqlevel', 'name'])]; } } // tab: criteria of (to be added by TC) }
public function __construct($pageCall, $__) { parent::__construct($pageCall, $__); // prefer $_GET over $_COOKIE if (!empty($_GET['compare'])) { $this->compareString = $_GET['compare']; } else { if (!empty($_COOKIE['compare_groups'])) { $this->compareString = urldecode($_COOKIE['compare_groups']); } } $this->name = Lang::main('compareTool'); }
protected function generateContent() { /***********/ /* Infobox */ /***********/ $infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags')); // has Animation if ($this->subject->getField('isAnimated')) { $infobox[] = Lang::emote('isAnimated'); } /****************/ /* Main Content */ /****************/ $text = ''; if ($aliasses = DB::Aowow()->selectCol('SELECT command FROM ?_emotes_aliasses WHERE id = ?d AND locales & ?d', $this->typeId, 1 << User::$localeId)) { $text .= '[h3]' . Lang::emote('aliases') . '[/h3][ul]'; foreach ($aliasses as $a) { $text .= '[li]/' . $a . '[/li]'; } $text .= '[/ul][br][br]'; } $texts = []; if ($_ = $this->subject->getField('self', true)) { $texts[Lang::emote('self')] = $_; } if ($_ = $this->subject->getField('target', true)) { $texts[Lang::emote('target')] = $_; } if ($_ = $this->subject->getField('noTarget', true)) { $texts[Lang::emote('noTarget')] = $_; } if (!$texts) { $text .= '[div][i class=q0]' . Lang::emote('noText') . '[/i][/div]'; } else { foreach ($texts as $h => $t) { $text .= '[pad][b]' . $h . '[/b][ul][li][span class=s4]' . preg_replace('/%\\d?\\$?s/', '<' . Util::ucFirst(Lang::main('name')) . '>', $t) . '[/span][/li][/ul]'; } } $this->extraText = $text; $this->infobox = $infobox ? '[ul][li]' . implode('[/li][li]', $infobox) . '[/li][/ul]' : null; /**************/ /* Extra Tabs */ /**************/ // tab: achievement $condition = array(['ac.type', ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE], ['ac.value1', $this->typeId]); $acv = new AchievementList($condition); $this->lvTabs[] = ['achievement', ['data' => array_values($acv->getListviewData())]]; $this->extendGlobalData($acv->getJsGlobals()); }
public function renderTooltip() { if (!$this->curTpl) { return array(); } $x = '<table><tr><td>'; $x .= '<b>' . Util::jsEscape($this->getField('name', true)) . '</b><br>'; // cata+ (or go fill it by hand) if ($_ = $this->getField('description', true)) { $x .= '<div style="max-width: 300px" class="q">' . Util::jsEscape($_) . '</div>'; } if ($_ = $this->getField('cap')) { $x .= '<br><span class="q">' . Lang::currency('cap') . Lang::main('colon') . '</span>' . Lang::nf($_) . '<br>'; } $x .= '</td></tr></table>'; return $x; }
public function __construct($pageCall, $subPage) { parent::__construct($pageCall, $subPage); // chack if page is valid if (isset($this->validPages[$pageCall])) { $_ = $this->validPages[$pageCall]; // check if subpage is valid if (!isset($_[1])) { if (($_[1] = array_search($subPage, $this->subPages[$_[0]])) === false) { $this->error(); } if ($pageCall == 'help') { // ye.. hack .. class definitions only allow static values $_[2] = Lang::main('helpTopics', $_[1]); } } $this->type = $_[0]; $this->typeId = $_[1]; $this->name = $_[2]; $this->gPageInfo = array('type' => $this->type, 'typeId' => $this->typeId, 'name' => $this->name); } else { $this->error(); } }
function account() { $fields = array('name' => ['Username', false], 'pass1' => ['Enter Password', true], 'pass2' => ['Confirm Password', true]); if (CLISetup::readInput($fields)) { CLISetup::log(); if (!User::isValidName($fields['name'], $e)) { CLISetup::log(Lang::account($e == 1 ? 'errNameLength' : 'errNameChars'), CLISetup::LOG_ERROR); } else { if (!User::isValidPass($fields['pass1'], $e)) { CLISetup::log(Lang::account($e == 1 ? 'errPassLength' : 'errPassChars'), CLISetup::LOG_ERROR); } else { if ($fields['pass1'] != $fields['pass2']) { CLISetup::log(Lang::account('passMismatch'), CLISetup::LOG_ERROR); } else { if ($_ = DB::Aowow()->SelectCell('SELECT 1 FROM ?_account WHERE user = ? AND (status <> ?d OR (status = ?d AND statusTimer > UNIX_TIMESTAMP()))', $fields['name'], ACC_STATUS_NEW, ACC_STATUS_NEW)) { CLISetup::log(Lang::account('nameInUse'), CLISetup::LOG_ERROR); } else { // write to db $ok = DB::Aowow()->query('REPLACE INTO ?_account (user, passHash, displayName, joindate, email, allowExpire, userGroups, userPerms) VALUES (?, ?, ?, UNIX_TIMESTAMP(), ?, 0, ?d, 1)', $fields['name'], User::hashCrypt($fields['pass1']), Util::ucFirst($fields['name']), CFG_CONTACT_EMAIL, U_GROUP_ADMIN); if ($ok) { $newId = DB::Aowow()->selectCell('SELECT id FROM ?_account WHERE user = ?', $fields['name']); Util::gainSiteReputation($newId, SITEREP_ACTION_REGISTER); CLISetup::log("account " . $fields['name'] . " created successfully", CLISetup::LOG_OK); } else { // something went wrong CLISetup::log(Lang::main('intError'), CLISetup::LOG_ERROR); } } } } } } else { CLISetup::log(); CLISetup::log("account creation aborted", CLISetup::LOG_WARN); } }
echo ' <tr><td style="text-align:left;">' . Lang::main('numSQL') . '</td><td>' . $this->mysql['count'] . "</td></tr>\n"; echo ' <tr><td style="text-align:left;">' . Lang::main('timeSQL') . '</td><td>' . Util::formatTime($this->mysql['time'] * 1000, true) . "</td></tr>\n"; } if ($this->time) { echo ' <tr><td style="text-align:left;">Page generated in</td><td>' . Util::formatTime($this->time * 1000, true) . "</td></tr>\n"; } if ($this->cacheLoaded && $this->cacheLoaded[0] == CACHE_MODE_FILECACHE) { echo " <tr><td style=\"text-align:left;\">reloaded from filecache</td><td>created" . Lang::main('colon') . date(Lang::main('dateFmtLong'), $this->cacheLoaded[1]) . "</td></tr>\n"; } elseif ($this->cacheLoaded && $this->cacheLoaded[0] == CACHE_MODE_MEMCACHED) { echo " <tr><td style=\"text-align:left;\">reloaded from memcached</td><td>created" . Lang::main('colon') . date(Lang::main('dateFmtLong'), $this->cacheLoaded[1]) . "</td></tr>\n"; } echo " </table>\n"; } ?> </div> </div><!-- #wrapper .nosidebar --> </div><!-- #layout-inner --> </div><!-- #layout .nosidebar --> <noscript> <div id="noscript-bg"></div> <div id="noscript-text"><?php echo Lang::main('noJScript'); ?> </div> </noscript> <script type="text/javascript">DomContentLoaded.now()</script> </body> </html>
protected function generateContent() { $_level = $this->subject->getField('level'); $_minLevel = $this->subject->getField('minLevel'); $_flags = $this->subject->getField('flags'); $_specialFlags = $this->subject->getField('specialFlags'); $_side = Util::sideByRaceMask($this->subject->getField('reqRaceMask')); /***********/ /* Infobox */ /***********/ $infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags')); // event (todo: assign eventData) if ($_ = $this->subject->getField('eventId')) { $this->extendGlobalIds(TYPE_WORLDEVENT, $_); $infobox[] = Lang::game('eventShort') . Lang::main('colon') . '[event=' . $_ . ']'; } // level if ($_level > 0) { $infobox[] = Lang::game('level') . Lang::main('colon') . $_level; } // reqlevel if ($_minLevel) { $lvl = $_minLevel; if ($_ = $this->subject->getField('maxLevel')) { $lvl .= ' - ' . $_; } $infobox[] = sprintf(Lang::game('reqLevel'), $lvl); } // loremaster (i dearly hope those flags cover every case...) if ($this->subject->getField('zoneOrSortBak') > 0 && !$this->subject->isRepeatable()) { $conditions = array(['ac.type', ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE], ['ac.value1', $this->subject->getField('zoneOrSortBak')], ['a.faction', $_side, '&']); $loremaster = new AchievementList($conditions); $this->extendGlobalData($loremaster->getJSGlobals(GLOBALINFO_SELF)); switch ($loremaster->getMatches()) { case 0: break; case 1: $infobox[] = Lang::quest('loremaster') . Lang::main('colon') . '[achievement=' . $loremaster->id . ']'; break; default: $lm = Lang::quest('loremaster') . Lang::main('colon') . '[ul]'; foreach ($loremaster->iterate() as $id => $__) { $lm .= '[li][achievement=' . $id . '][/li]'; } $infobox[] = $lm . '[/ul]'; break; } } // type (maybe expand uppon?) $_ = []; if ($_flags & QUEST_FLAG_DAILY) { $_[] = Lang::quest('daily'); } else { if ($_flags & QUEST_FLAG_WEEKLY) { $_[] = Lang::quest('weekly'); } else { if ($_specialFlags & QUEST_FLAG_SPECIAL_MONTHLY) { $_[] = Lang::quest('monthly'); } } } if ($t = $this->subject->getField('type')) { $_[] = Lang::quest('questInfo', $t); } if ($_) { $infobox[] = Lang::game('type') . Lang::main('colon') . implode(' ', $_); } // side $_ = Lang::main('side') . Lang::main('colon'); switch ($_side) { case 3: $infobox[] = $_ . Lang::game('si', 3); break; case 2: $infobox[] = $_ . '[span class=icon-horde]' . Lang::game('si', 2) . '[/span]'; break; case 1: $infobox[] = $_ . '[span class=icon-alliance]' . Lang::game('si', 1) . '[/span]'; break; } // races if ($_ = Lang::getRaceString($this->subject->getField('reqRaceMask'), $__, $jsg, $n, false)) { $this->extendGlobalIds(TYPE_RACE, $jsg); $t = $n == 1 ? Lang::game('race') : Lang::game('races'); $infobox[] = Util::ucFirst($t) . Lang::main('colon') . $_; } // classes if ($_ = Lang::getClassString($this->subject->getField('reqClassMask'), $jsg, $n, false)) { $this->extendGlobalIds(TYPE_CLASS, $jsg); $t = $n == 1 ? Lang::game('class') : Lang::game('classes'); $infobox[] = Util::ucFirst($t) . Lang::main('colon') . $_; } // profession / skill if ($_ = $this->subject->getField('reqSkillId')) { $this->extendGlobalIds(TYPE_SKILL, $_); $sk = '[skill=' . $_ . ']'; if ($_ = $this->subject->getField('reqSkillPoints')) { $sk .= ' (' . $_ . ')'; } $infobox[] = Lang::quest('profession') . Lang::main('colon') . $sk; } // timer if ($_ = $this->subject->getField('timeLimit')) { $infobox[] = Lang::quest('timer') . Lang::main('colon') . Util::formatTime($_ * 1000); } $startEnd = DB::Aowow()->select('SELECT * FROM ?_quests_startend WHERE questId = ?d', $this->typeId); // start $start = '[icon name=quest_start' . ($this->subject->isDaily() ? '_daily' : '') . ']' . Lang::event('start') . Lang::main('colon') . '[/icon]'; $s = []; foreach ($startEnd as $se) { if ($se['method'] & 0x1) { $this->extendGlobalIds($se['type'], $se['typeId']); $s[] = ($s ? '[span=invisible]' . $start . '[/span] ' : $start . ' ') . '[' . Util::$typeStrings[$se['type']] . '=' . $se['typeId'] . ']'; } } if ($s) { $infobox[] = implode('[br]', $s); } // end $end = '[icon name=quest_end' . ($this->subject->isDaily() ? '_daily' : '') . ']' . Lang::event('end') . Lang::main('colon') . '[/icon]'; $e = []; foreach ($startEnd as $se) { if ($se['method'] & 0x2) { $this->extendGlobalIds($se['type'], $se['typeId']); $e[] = ($e ? '[span=invisible]' . $end . '[/span] ' : $end . ' ') . '[' . Util::$typeStrings[$se['type']] . '=' . $se['typeId'] . ']'; } } if ($e) { $infobox[] = implode('[br]', $e); } // Repeatable if ($_flags & QUEST_FLAG_REPEATABLE || $_specialFlags & QUEST_FLAG_SPECIAL_REPEATABLE) { $infobox[] = Lang::quest('repeatable'); } // sharable | not sharable $infobox[] = $_flags & QUEST_FLAG_SHARABLE ? Lang::quest('sharable') : Lang::quest('notSharable'); // Keeps you PvP flagged if ($this->subject->isPvPEnabled()) { $infobox[] = Lang::quest('keepsPvpFlag'); } // difficulty (todo (low): formula unclear. seems to be [minLevel,] -4, -2, (level), +3, +(9 to 15)) if ($_level > 0) { $_ = []; // red if ($_minLevel && $_minLevel < $_level - 4) { $_[] = '[color=q10]' . $_minLevel . '[/color]'; } // orange if (!$_minLevel || $_minLevel < $_level - 2) { $_[] = '[color=r1]' . (!$_ && $_minLevel > $_level - 4 ? $_minLevel : $_level - 4) . '[/color]'; } // yellow $_[] = '[color=r2]' . (!$_ && $_minLevel > $_level - 2 ? $_minLevel : $_level - 2) . '[/color]'; // green $_[] = '[color=r3]' . ($_level + 3) . '[/color]'; // grey (is about +/-1 level off) $_[] = '[color=r4]' . ($_level + 3 + ceil(12 * $_level / MAX_LEVEL)) . '[/color]'; if ($_) { $infobox[] = Lang::game('difficulty') . Lang::main('colon') . implode('[small] [/small]', $_); } } $this->infobox = '[ul][li]' . implode('[/li][li]', $infobox) . '[/li][/ul]'; /**********/ /* Series */ /**********/ // Quest Chain (are there cases where quests go in parallel?) $chain = array(array(array('side' => $_side, 'typeStr' => Util::$typeStrings[TYPE_QUEST], 'typeId' => $this->typeId, 'name' => $this->name, '_next' => $this->subject->getField('nextQuestIdChain')))); $_ = $chain[0][0]; while ($_) { if ($_ = DB::Aowow()->selectRow('SELECT id AS typeId, name_loc0, name_loc2, name_loc3, name_loc6, name_loc8, reqRaceMask FROM ?_quests WHERE nextQuestIdChain = ?d', $_['typeId'])) { $n = Util::localizedString($_, 'name'); array_unshift($chain, array(array('side' => Util::sideByRaceMask($_['reqRaceMask']), 'typeStr' => Util::$typeStrings[TYPE_QUEST], 'typeId' => $_['typeId'], 'name' => strlen($n) > 40 ? substr($n, 0, 40) . '…' : $n))); } } $_ = end($chain)[0]; while ($_) { if ($_ = DB::Aowow()->selectRow('SELECT id AS typeId, name_loc0, name_loc2, name_loc3, name_loc6, name_loc8, reqRaceMask, nextQuestIdChain AS _next FROM ?_quests WHERE id = ?d', $_['_next'])) { $n = Util::localizedString($_, 'name'); array_push($chain, array(array('side' => Util::sideByRaceMask($_['reqRaceMask']), 'typeStr' => Util::$typeStrings[TYPE_QUEST], 'typeId' => $_['typeId'], 'name' => strlen($n) > 40 ? substr($n, 0, 40) . '…' : $n, '_next' => $_['_next']))); } } if (count($chain) > 1) { $this->series[] = [$chain, null]; } // todo (low): sensibly merge the following lists into 'series' $listGen = function ($cnd) { $chain = []; $list = new QuestList($cnd); if ($list->error) { return null; } foreach ($list->iterate() as $id => $__) { $n = $list->getField('name', true); $chain[] = array(array('side' => Util::sideByRaceMask($list->getField('reqRaceMask')), 'typeStr' => Util::$typeStrings[TYPE_QUEST], 'typeId' => $id, 'name' => strlen($n) > 40 ? substr($n, 0, 40) . '…' : $n)); } return $chain; }; $extraLists = array(['reqQ', array('OR', ['AND', ['nextQuestId', $this->typeId], ['exclusiveGroup', 0, '<']], ['AND', ['id', $this->subject->getField('prevQuestId')], ['nextQuestIdChain', $this->typeId, '!']])], ['reqOneQ', array(['exclusiveGroup', 0, '>'], ['nextQuestId', $this->typeId])], ['opensQ', array('OR', ['AND', ['prevQuestId', $this->typeId], ['id', $this->subject->getField('nextQuestIdChain'), '!']], ['id', $this->subject->getField('nextQuestId')])], ['closesQ', array(['exclusiveGroup', 0, '!'], ['exclusiveGroup', $this->subject->getField('exclusiveGroup')], ['id', $this->typeId, '!'])], ['enablesQ', array(['prevQuestId', -$this->typeId])], ['enabledByQ', array(['id', -$this->subject->getField('prevQuestId')])]); foreach ($extraLists as $el) { if ($_ = $listGen($el[1])) { $this->series[] = [$_, sprintf(Util::$dfnString, Lang::quest($el[0] . 'Desc'), Lang::quest($el[0]))]; } } /*******************/ /* Objectives List */ /*******************/ $this->objectiveList = []; $this->providedItem = []; // gather ids for lookup $olItems = $olNPCs = $olGOs = $olFactions = []; // items $olItems[0] = array($this->subject->getField('sourceItemId'), $this->subject->getField('sourceItemCount'), false); for ($i = 1; $i < 7; $i++) { $id = $this->subject->getField('reqItemId' . $i); $qty = $this->subject->getField('reqItemCount' . $i); if (!$id || !$qty) { continue; } $olItems[$i] = [$id, $qty, $id == $olItems[0][0]]; } if ($ids = array_column($olItems, 0)) { $olItemData = new ItemList(array(['id', $ids])); $this->extendGlobalData($olItemData->getJSGlobals(GLOBALINFO_SELF)); $providedRequired = false; foreach ($olItems as $i => list($itemId, $qty, $provided)) { if (!$i || !$itemId || !in_array($itemId, $olItemData->getFoundIDs())) { continue; } if ($provided) { $providedRequired = true; } $this->objectiveList[] = array('typeStr' => Util::$typeStrings[TYPE_ITEM], 'id' => $itemId, 'name' => $olItemData->json[$itemId]['name'], 'qty' => $qty > 1 ? $qty : 0, 'quality' => 7 - $olItemData->json[$itemId]['quality'], 'extraText' => $provided ? ' (' . Lang::quest('provided') . ')' : ''); } // if providd item is not required by quest, list it below other requirements if (!$providedRequired && $olItems[0][0] && in_array($olItems[0][0], $olItemData->getFoundIDs())) { $this->providedItem = array('id' => $olItems[0][0], 'name' => $olItemData->json[$olItems[0][0]]['name'], 'qty' => $olItems[0][1] > 1 ? $olItems[0][1] : 0, 'quality' => 7 - $olItemData->json[$olItems[0][0]]['quality']); } } // creature or GO... for ($i = 1; $i < 5; $i++) { $id = $this->subject->getField('reqNpcOrGo' . $i); $qty = $this->subject->getField('reqNpcOrGoCount' . $i); $altTxt = $this->subject->getField('objectiveText' . $i, true); if ($id > 0 && $qty) { $olNPCs[$id] = [$qty, $altTxt, []]; } else { if ($id < 0 && $qty) { $olGOs[-$id] = [$qty, $altTxt]; } } } // .. creature kills if ($ids = array_keys($olNPCs)) { $olNPCData = new CreatureList(array('OR', ['id', $ids], ['killCredit1', $ids], ['killCredit2', $ids])); $this->extendGlobalData($olNPCData->getJSGlobals(GLOBALINFO_SELF)); // create proxy-references foreach ($olNPCData->iterate() as $id => $__) { if ($p = $olNPCData->getField('KillCredit1')) { if (isset($olNPCs[$p])) { $olNPCs[$p][2][$id] = $olNPCData->getField('name', true); } } if ($p = $olNPCData->getField('KillCredit2')) { if (isset($olNPCs[$p])) { $olNPCs[$p][2][$id] = $olNPCData->getField('name', true); } } } foreach ($olNPCs as $i => $pair) { if (!$i || !in_array($i, $olNPCData->getFoundIDs())) { continue; } $ol = array('typeStr' => Util::$typeStrings[TYPE_NPC], 'id' => $i, 'name' => $pair[1] ?: Util::localizedString($olNPCData->getEntry($i), 'name'), 'qty' => $pair[0] > 1 ? $pair[0] : 0, 'extraText' => $_specialFlags & QUEST_FLAG_SPECIAL_SPELLCAST || $pair[1] ? '' : ' ' . Lang::achievement('slain'), 'proxy' => $pair[2]); if ($pair[2]) { // has proxies assigned, add yourself as another proxy $ol['proxy'][$i] = Util::localizedString($olNPCData->getEntry($i), 'name'); } $this->objectiveList[] = $ol; } } // .. GO interactions if ($ids = array_keys($olGOs)) { $olGOData = new GameObjectList(array(['id', $ids])); $this->extendGlobalData($olGOData->getJSGlobals(GLOBALINFO_SELF)); foreach ($olNPCs as $i => $pair) { if (!$i || !in_array($i, $olGOData->getFoundIDs())) { continue; } $this->objectiveList[] = array('typeStr' => Util::$typeStrings[TYPE_OBJECT], 'id' => $i, 'name' => $pair[1] ?: Util::localizedString($olGOData->getEntry($i), 'name'), 'qty' => $pair[0] > 1 ? $pair[0] : 0); } } // reputation required for ($i = 1; $i < 3; $i++) { $id = $this->subject->getField('reqFactionId' . $i); $val = $this->subject->getField('reqFactionValue' . $i); if (!$id) { continue; } $olFactions[$id] = $val; } if ($ids = array_keys($olFactions)) { $olFactionsData = new FactionList(array(['id', $ids])); $this->extendGlobalData($olFactionsData->getJSGlobals(GLOBALINFO_SELF)); foreach ($olFactions as $i => $val) { if (!$i || !in_array($i, $olFactionsData->getFoundIDs())) { continue; } $this->objectiveList[] = array('typeStr' => Util::$typeStrings[TYPE_FACTION], 'id' => $i, 'name' => Util::localizedString($olFactionsData->getEntry($i), 'name'), 'qty' => sprintf(Util::$dfnString, $val . ' ' . Lang::achievement('points'), Lang::getReputationLevelForPoints($val)), 'extraText' => ''); } } // granted spell if ($_ = $this->subject->getField('sourceSpellId')) { $this->extendGlobalIds(TYPE_SPELL, $_); $this->objectiveList[] = array('typeStr' => Util::$typeStrings[TYPE_SPELL], 'id' => $_, 'name' => SpellList::getName($_), 'qty' => 0, 'extraText' => ' (' . Lang::quest('provided') . ')'); } // required money if ($this->subject->getField('rewardOrReqMoney') < 0) { $this->objectiveList[] = ['text' => Lang::quest('reqMoney') . Lang::main('colon') . Util::formatMoney(abs($this->subject->getField('rewardOrReqMoney')))]; } // required pvp kills if ($_ = $this->subject->getField('reqPlayerKills')) { $this->objectiveList[] = ['text' => Lang::quest('playerSlain') . ' (' . $_ . ')']; } /**********/ /* Mapper */ /**********/ $this->addJS('?data=zones&locale=' . User::$localeId . '&t=' . $_SESSION['dataKey']); /* TODO (GODDAMNIT): jeez.. */ // $startend + reqNpcOrGo[1-4] $this->map = null; // array( // 'data' => ['zone' => $this->typeId], // 'som' => Util::toJSON($som) // ); /****************/ /* Main Content */ /****************/ $this->gains = $this->createGains(); $this->mail = $this->createMail($maTab, $startEnd); $this->rewards = $this->createRewards(); $this->objectives = $this->subject->parseText('objectives', false); $this->details = $this->subject->parseText('details', false); $this->offerReward = $this->subject->parseText('offerReward', false); $this->requestItems = $this->subject->parseText('requestItems', false); $this->completed = $this->subject->parseText('completed', false); $this->end = $this->subject->parseText('end', false); $this->suggestedPl = $this->subject->getField('suggestedPlayers'); $this->unavailable = $_flags & QUEST_FLAG_UNAVAILABLE || $this->subject->getField('cuFlags') & CUSTOM_EXCLUDE_FOR_LISTVIEW; $this->redButtons = array(BUTTON_LINKS => ['color' => 'ffffff00', 'linkId' => 'quest:' . $this->typeId . ':' . $_level . ''], BUTTON_WOWHEAD => true); if ($maTab) { $this->lvTabs[] = $maTab; } // factionchange-equivalent if ($pendant = DB::World()->selectCell('SELECT IF(horde_id = ?d, alliance_id, -horde_id) FROM player_factionchange_quests WHERE alliance_id = ?d OR horde_id = ?d', $this->typeId, $this->typeId, $this->typeId)) { $altQuest = new QuestList(array(['id', abs($pendant)])); if (!$altQuest->error) { $this->transfer = sprintf(Lang::quest('_transfer'), $altQuest->id, $altQuest->getField('name', true), $pendant > 0 ? 'alliance' : 'horde', $pendant > 0 ? Lang::game('si', 1) : Lang::game('si', 2)); } } /**************/ /* Extra Tabs */ /**************/ // tab: see also $seeAlso = new QuestList(array(['name_loc' . User::$localeId, '%' . $this->name . '%'], ['id', $this->typeId, '!'])); if (!$seeAlso->error) { $this->extendGlobalData($seeAlso->getJSGlobals()); $this->lvTabs[] = array('file' => 'quest', 'data' => $seeAlso->getListviewData(), 'params' => array('name' => '$LANG.tab_seealso', 'id' => 'see-also')); } // tab: criteria of $criteriaOf = new AchievementList(array(['ac.type', ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST], ['ac.value1', $this->typeId])); if (!$criteriaOf->error) { $this->extendGlobalData($criteriaOf->getJSGlobals()); $this->lvTabs[] = array('file' => 'achievement', 'data' => $criteriaOf->getListviewData(), 'params' => array('name' => '$LANG.tab_criteriaof', 'id' => 'criteria-of')); } // tab: conditions $cnd = []; if ($_ = $this->subject->getField('reqMinRepFaction')) { $cnd[CND_SRC_QUEST_ACCEPT][$this->typeId][0][] = [CND_REPUTATION_RANK, $_, 1 << Util::getReputationLevelForPoints($this->subject->getField('reqMinRepValue'))]; $this->extendGlobalIds(TYPE_FACTION, $_); } if ($_ = $this->subject->getField('reqMaxRepFaction')) { $cnd[CND_SRC_QUEST_ACCEPT][$this->typeId][0][] = [-CND_REPUTATION_RANK, $_, 1 << Util::getReputationLevelForPoints($this->subject->getField('reqMaxRepValue'))]; $this->extendGlobalIds(TYPE_FACTION, $_); } $_ = Util::getServerConditions([CND_SRC_QUEST_ACCEPT, CND_SRC_QUEST_SHOW_MARK], null, $this->typeId); if (!empty($_[0])) { // awkward merger if (isset($_[0][CND_SRC_QUEST_ACCEPT][$this->typeId][0])) { if (isset($cnd[CND_SRC_QUEST_ACCEPT][$this->typeId][0])) { $cnd[CND_SRC_QUEST_ACCEPT][$this->typeId][0] = array_merge($cnd[CND_SRC_QUEST_ACCEPT][$this->typeId][0], $_[0][CND_SRC_QUEST_ACCEPT][$this->typeId][0]); } else { $cnd[CND_SRC_QUEST_ACCEPT] = $_[0][CND_SRC_QUEST_ACCEPT]; } } if (isset($_[0][CND_SRC_QUEST_SHOW_MARK])) { $cnd[CND_SRC_QUEST_SHOW_MARK] = $_[0][CND_SRC_QUEST_SHOW_MARK]; } $this->extendGlobalData($_[1]); } if ($cnd) { $tab = "<script type=\"text/javascript\">\n" . "var markup = ConditionList.createTab(" . Util::toJSON($cnd) . ");\n" . "Markup.printHtml(markup, 'tab-conditions', { allow: Markup.CLASS_STAFF })" . "</script>"; $this->lvTabs[] = array('file' => null, 'data' => $tab, 'params' => array('id' => 'conditions', 'name' => '$LANG.requires')); } }
protected function generateContent() { $this->addJS('?data=zones&locale=' . User::$localeId . '&t=' . $_SESSION['dataKey']); $_itemId = $this->subject->getField('itemId'); /***********/ /* Infobox */ /**********/ $infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags')); if ($this->typeId == 103) { // Arena Points $infobox[] = Lang::currency('cap') . Lang::main('colon') . '10\'000'; } else { if ($this->typeId == 104) { // Honor $infobox[] = Lang::currency('cap') . Lang::main('colon') . '75\'000'; } } /****************/ /* Main Content */ /****************/ $this->infobox = $infobox ? '[ul][li]' . implode('[/li][li]', $infobox) . '[/li][/ul]' : null; $this->name = $this->subject->getField('name', true); $this->headIcons = $this->typeId == 104 ? ['inv_bannerpvp_02', 'inv_bannerpvp_01'] : [$this->subject->getField('iconString')]; $this->redButtons = array(BUTTON_WOWHEAD => true, BUTTON_LINKS => true); /**************/ /* Extra Tabs */ /**************/ if ($this->typeId != 103 && $this->typeId != 104) { // tabs: this currency is contained in.. $lootTabs = new Loot(); if ($lootTabs->getByItem($_itemId)) { $this->extendGlobalData($lootTabs->jsGlobals); foreach ($lootTabs->iterate() as $tab) { $this->lvTabs[] = array('file' => $tab[0], 'data' => $tab[1], 'params' => ['name' => $tab[2], 'id' => $tab[3], 'extraCols' => $tab[4] ? '$[' . implode(', ', array_unique($tab[4])) . ']' : null, 'hiddenCols' => $tab[5] ? '$[' . implode(', ', array_unique($tab[5])) . ']' : null, 'visibleCols' => $tab[6] ? '$' . Util::toJSON(array_unique($tab[6])) : null]); } } // tab: sold by $itemObj = new ItemList(array(['id', $_itemId])); if (!empty($itemObj->getExtendedCost()[$_itemId])) { $vendors = $itemObj->getExtendedCost()[$_itemId]; $this->extendGlobalData($itemObj->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED)); $soldBy = new CreatureList(array(['id', array_keys($vendors)])); if (!$soldBy->error) { $sbData = $soldBy->getListviewData(); $extraCols = ['Listview.extraCols.stock', "Listview.funcBox.createSimpleCol('stack', 'stack', '10%', 'stack')", 'Listview.extraCols.cost']; $holidays = []; foreach ($sbData as $k => &$row) { $items = []; $tokens = []; foreach ($vendors[$k] as $id => $qty) { if (is_string($id)) { continue; } if ($id > 0) { $tokens[] = [$id, $qty]; } else { if ($id < 0) { $items[] = [-$id, $qty]; } } } if ($vendors[$k]['event']) { if (count($extraCols) == 3) { // not already pushed $extraCols[] = 'Listview.extraCols.condition'; } $this->extendGlobalIds(TYPE_WORLDEVENT, $vendors[$k]['event']); $row['condition'][0][$this->typeId][] = [[CND_ACTIVE_EVENT, $vendors[$k]['event']]]; } $row['stock'] = $vendors[$k]['stock']; $row['stack'] = $itemObj->getField('buyCount'); $row['cost'] = array($itemObj->getField('buyPrice'), $items ? $items : null, $tokens ? $tokens : null); } $this->lvTabs[] = array('file' => 'creature', 'data' => $sbData, 'params' => ['name' => '$LANG.tab_soldby', 'id' => 'sold-by-npc', 'extraCols' => '$[' . implode(', ', $extraCols) . ']', 'hiddenCols' => "\$['level', 'type']"]); } } } // tab: created by (spell) [for items its handled in Loot::getByContainer()] if ($this->typeId == 104) { $createdBy = new SpellList(array(['effect1Id', 45], ['effect2Id', 45], ['effect3Id', 45], 'OR')); if (!$createdBy->error) { $this->extendGlobalData($createdBy->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED)); if ($createdBy->hasSetFields(['reagent1'])) { $visCols = ['reagents']; } $this->lvTabs[] = array('file' => 'spell', 'data' => $createdBy->getListviewData(), 'params' => ['name' => '$LANG.tab_createdby', 'id' => 'created-by', 'visibleCols' => isset($visCols) ? '$' . Util::toJSON($visCols) : null]); } } // tab: currency for if ($this->typeId == 103) { $n = '?items&filter=cr=145;crs=1;crv=0'; $w = 'reqArenaPoints > 0'; } else { if ($this->typeId == 104) { $n = '?items&filter=cr=144;crs=1;crv=0'; $w = 'reqHonorPoints > 0'; } else { $n = in_array($this->typeId, [42, 61, 81, 241, 121, 122, 123, 125, 126, 161, 201, 101, 102, 221, 301, 341]) ? '?items&filter=cr=158;crs=' . $_itemId . ';crv=0' : null; $w = 'reqItemId1 = ' . $_itemId . ' OR reqItemId2 = ' . $_itemId . ' OR reqItemId3 = ' . $_itemId . ' OR reqItemId4 = ' . $_itemId . ' OR reqItemId5 = ' . $_itemId; } } $xCosts = DB::Aowow()->selectCol('SELECT id FROM ?_itemextendedcost WHERE ' . $w); $boughtBy = $xCosts ? DB::World()->selectCol('SELECT item FROM npc_vendor WHERE extendedCost IN (?a) UNION SELECT item FROM game_event_npc_vendor WHERE extendedCost IN (?a)', $xCosts, $xCosts) : []; if ($boughtBy) { $boughtBy = new ItemList(array(['id', $boughtBy])); if (!$boughtBy->error) { if ($boughtBy->getMatches() <= CFG_SQL_LIMIT_DEFAULT) { $n = null; } $this->lvTabs[] = array('file' => 'item', 'data' => $boughtBy->getListviewData(ITEMINFO_VENDOR, [TYPE_CURRENCY => $this->typeId]), 'params' => ['name' => '$LANG.tab_currencyfor', 'id' => 'currency-for', 'extraCols' => "\$[Listview.funcBox.createSimpleCol('stack', 'stack', '10%', 'stack')]", 'note' => $n ? sprintf(Util::$filterResultString, $n) : null]); $this->extendGlobalData($boughtBy->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED)); } } }
protected function generateContent() { $this->addJS('?data=zones&locale=' . User::$localeId . '&t=' . $_SESSION['dataKey']); $infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags')); $_mask = 1 << $this->typeId - 1; $tcClassId = [null, 8, 3, 1, 5, 4, 9, 6, 2, 7, null, 0]; // see TalentCalc.js /***********/ /* Infobox */ /***********/ // hero class if ($this->subject->getField('flags') & 0x40) { $infobox[] = '[tooltip=tooltip_heroclass]' . Lang::game('heroClass') . '[/tooltip]'; } // resource if ($this->typeId == 11) { // special Druid case $infobox[] = Lang::game('resources') . Lang::main('colon') . '[tooltip name=powertype1]' . Lang::game('st', 0) . ', ' . Lang::game('st', 31) . ', ' . Lang::game('st', 2) . '[/tooltip][span class=tip tooltip=powertype1]' . Util::ucFirst(Lang::spell('powerTypes', 0)) . '[/span], ' . '[tooltip name=powertype2]' . Lang::game('st', 5) . ', ' . Lang::game('st', 8) . '[/tooltip][span class=tip tooltip=powertype2]' . Util::ucFirst(Lang::spell('powerTypes', 1)) . '[/span], ' . '[tooltip name=powertype8]' . Lang::game('st', 1) . '[/tooltip][span class=tip tooltip=powertype8]' . Util::ucFirst(Lang::spell('powerTypes', 3)) . '[/span]'; } else { if ($this->typeId == 6) { // special DK case $infobox[] = Lang::game('resources') . Lang::main('colon') . '[span]' . Util::ucFirst(Lang::spell('powerTypes', 5)) . ', ' . Util::ucFirst(Lang::spell('powerTypes', $this->subject->getField('powerType'))) . '[/span]'; } else { // regular case $infobox[] = Lang::game('resource') . Lang::main('colon') . '[span]' . Util::ucFirst(Lang::spell('powerTypes', $this->subject->getField('powerType'))) . '[/span]'; } } // roles $roles = []; for ($i = 0; $i < 4; $i++) { if ($this->subject->getField('roles') & 1 << $i) { $roles[] = (count($roles) == 2 ? "\n" : '') . Lang::game('_roles', $i); } } if ($roles) { $infobox[] = (count($roles) > 1 ? Lang::game('roles') : Lang::game('role')) . Lang::main('colon') . implode(', ', $roles); } // specs $specList = []; $skills = new SkillList(array(['id', $this->subject->getField('skills')])); foreach ($skills->iterate() as $k => $__) { $specList[$k] = '[icon name=' . $skills->getField('iconString') . '][url=?spells=7.' . $this->typeId . '.' . $k . ']' . $skills->getField('name', true) . '[/url][/icon]'; } if ($specList) { $infobox[] = Lang::game('specs') . Lang::main('colon') . '[ul][li]' . implode('[/li][li]', $specList) . '[/li][/ul]'; } /****************/ /* Main Content */ /****************/ $this->infobox = '[ul][li]' . implode('[/li][li]', $infobox) . '[/li][/ul]'; $this->expansion = Util::$expansionString[$this->subject->getField('expansion')]; $this->headIcons = ['class_' . strtolower($this->subject->getField('fileString'))]; $this->redButtons = array(BUTTON_LINKS => ['color' => '', 'linkId' => ''], BUTTON_WOWHEAD => true, BUTTON_TALENT => ['href' => '?talent#' . Util::$tcEncoding[$tcClassId[$this->typeId] * 3], 'pet' => false], BUTTON_FORUM => false); /**************/ /* Extra Tabs */ /**************/ // Tab: Spells (grouped) // '$LANG.tab_armorproficiencies', // '$LANG.tab_weaponskills', // '$LANG.tab_glyphs', // '$LANG.tab_abilities', // '$LANG.tab_talents', $conditions = array(['s.typeCat', [-13, -11, -2, 7]], [['s.cuFlags', SPELL_CU_TRIGGERED | CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0], ['OR', ['s.reqClassMask', $_mask, '&'], ['s.skillLine1', $this->subject->getField('skills')], ['AND', ['s.skillLine1', 0, '>'], ['s.skillLine2OrMask', $this->subject->getField('skills')]]], ['OR', ['s.cuFlags', SPELL_CU_LAST_RANK, '&'], ['s.rankNo', 0]]); $genSpells = new SpellList($conditions); if (!$genSpells->error) { $this->extendGlobalData($genSpells->getJSGlobals(GLOBALINFO_SELF)); $this->lvTabs[] = array('file' => 'spell', 'data' => $genSpells->getListviewData(), 'params' => array('id' => 'spells', 'name' => '$LANG.tab_spells', 'visibleCols' => "\$['level', 'schools', 'type', 'classes']", 'hiddenCols' => "\$['reagents', 'skill']", 'sort' => "\$['-level', 'type', 'name']", 'computeDataFunc' => '$Listview.funcBox.initSpellFilter', 'onAfterCreate' => '$Listview.funcBox.addSpellIndicator')); } // Tab: Items (grouped) $conditions = array(['requiredClass', 0, '>'], ['requiredClass', $_mask, '&'], [['requiredClass', CLASS_MASK_ALL, '&'], CLASS_MASK_ALL, '!'], ['itemset', 0], 0); $items = new ItemList($conditions); if (!$items->error) { $this->extendGlobalData($items->getJSGlobals()); if (!$items->hasDiffFields(['requiredRace'])) { $hidden = "\$['side']"; } $this->lvTabs[] = array('file' => 'item', 'data' => $items->getListviewData(), 'params' => array('id' => 'items', 'name' => '$LANG.tab_items', 'visibleCols' => "\$['dps', 'armor', 'slot']", 'hiddenCols' => isset($hidden) ? $hidden : null, 'computeDataFunc' => '$Listview.funcBox.initSubclassFilter', 'onAfterCreate' => '$Listview.funcBox.addSubclassIndicator', 'note' => sprintf(Util::$filterResultString, '?items&filter=cr=152;crs=' . $this->typeId . ';crv=0'), '_truncated' => 1)); } // Tab: Quests $conditions = array(['reqClassMask', $_mask, '&'], [['reqClassMask', CLASS_MASK_ALL, '&'], CLASS_MASK_ALL, '!']); $quests = new QuestList($conditions); if (!$quests->error) { $this->extendGlobalData($quests->getJSGlobals()); $this->lvTabs[] = array('file' => 'quest', 'data' => $quests->getListviewData(), 'params' => ['sort' => "\$['reqlevel', 'name']"]); } // Tab: Itemsets $sets = new ItemsetList(array(['classMask', $_mask, '&'])); if (!$sets->error) { $this->extendGlobalData($sets->getJSGlobals(GLOBALINFO_SELF)); $this->lvTabs[] = array('file' => 'itemset', 'data' => $sets->getListviewData(), 'params' => array('note' => sprintf(Util::$filterResultString, '?itemsets&filter=cl=' . $this->typeId), 'hiddenCols' => "\$['classes']", 'sort' => "\$['-level', 'name']")); } // Tab: Trainer $conditions = array(['npcflag', 0x30, '&'], ['trainerType', 0], ['trainerClass', $this->typeId]); $trainer = new CreatureList($conditions); if (!$trainer->error) { $this->lvTabs[] = array('file' => 'creature', 'data' => $trainer->getListviewData(), 'params' => array('id' => 'trainers', 'name' => '$LANG.tab_trainers')); } // Tab: Races $races = new CharRaceList(array(['classMask', $_mask, '&'])); if (!$races->error) { $this->lvTabs[] = array('file' => 'race', 'data' => $races->getListviewData(), 'params' => []); } }
public function renderTooltip($interactive = false, $subOf = 0, $enhance = []) { if ($this->error) { return; } $_name = $this->getField('name', true); $_reqLvl = $this->curTpl['requiredLevel']; $_quality = $this->curTpl['quality']; $_flags = $this->curTpl['flags']; $_class = $this->curTpl['class']; $_subClass = $this->curTpl['subClass']; $_slot = $this->curTpl['slot']; $causesScaling = false; if (!empty($enhance['r'])) { if ($this->getRandEnchantForItem($enhance['r'])) { $_name .= ' ' . Util::localizedString($this->enhanceR, 'name'); $randEnchant = ''; for ($i = 1; $i < 6; $i++) { if ($this->enhanceR['enchantId' . $i] <= 0) { continue; } $enchant = DB::Aowow()->selectRow('SELECT * FROM ?_itemenchantment WHERE Id = ?d', $this->enhanceR['enchantId' . $i]); if ($this->enhanceR['allocationPct' . $i] > 0) { $amount = intVal($this->enhanceR['allocationPct' . $i] * $this->generateEnchSuffixFactor()); $randEnchant .= '<span>' . str_replace('$i', $amount, Util::localizedString($enchant, 'name')) . '</span><br />'; } else { $randEnchant .= '<span>' . Util::localizedString($enchant, 'name') . '</span><br />'; } } } else { unset($enhance['r']); } } if (isset($enhance['s']) && !in_array($_slot, [INVTYPE_WRISTS, INVTYPE_WAIST, INVTYPE_HANDS])) { unset($enhance['s']); } // IMPORTAT: DO NOT REMOVE THE HTML-COMMENTS! THEY ARE REQUIRED TO UPDATE THE TOOLTIP CLIENTSIDE $x = ''; // upper table: stats if (!$subOf) { $x .= '<table><tr><td>'; } // name; quality if ($subOf) { $x .= '<span class="q' . $_quality . '"><a href="?item=' . $this->id . '">' . $_name . '</a></span>'; } else { $x .= '<b class="q' . $_quality . '">' . $_name . '</b>'; } // heroic tag if ($_flags & ITEM_FLAG_HEROIC && $_quality == ITEM_QUALITY_EPIC) { $x .= '<br /><span class="q2">' . Lang::item('heroic') . '</span>'; } // requires map (todo: reparse ?_zones for non-conflicting data; generate Link to zone) if ($_ = $this->curTpl['map']) { $map = DB::Aowow()->selectRow('SELECT * FROM ?_zones WHERE mapId = ?d LIMIT 1', $_); $x .= '<br /><a href="?zone=' . $_ . '" class="q1">' . Util::localizedString($map, 'name') . '</a>'; } // requires area if ($this->curTpl['area']) { $area = DB::Aowow()->selectRow('SELECT * FROM ?_zones WHERE Id=?d LIMIT 1', $this->curTpl['area']); $x .= '<br />' . Util::localizedString($area, 'name'); } // conjured if ($_flags & ITEM_FLAG_CONJURED) { $x .= '<br />' . Lang::item('conjured'); } // bonding if ($_flags & ITEM_FLAG_ACCOUNTBOUND) { $x .= '<br /><!--bo-->' . Lang::item('bonding', 0); } else { if ($this->curTpl['bonding']) { $x .= '<br /><!--bo-->' . Lang::item('bonding', $this->curTpl['bonding']); } } // unique || unique-equipped || unique-limited if ($this->curTpl['maxCount'] > 0) { $x .= '<br />' . Lang::item('unique'); if ($this->curTpl['maxCount'] > 1) { $x .= ' (' . $this->curTpl['maxCount'] . ')'; } } else { if ($_flags & ITEM_FLAG_UNIQUEEQUIPPED) { $x .= '<br />' . Lang::item('uniqueEquipped'); } else { if ($this->curTpl['itemLimitCategory']) { $limit = DB::Aowow()->selectRow("SELECT * FROM ?_itemlimitcategory WHERE id = ?", $this->curTpl['itemLimitCategory']); $x .= '<br />' . ($limit['isGem'] ? Lang::item('uniqueEquipped') : Lang::item('unique')) . Lang::main('colon') . Util::localizedString($limit, 'name') . ' (' . $limit['count'] . ')'; } } } // max duration if ($dur = $this->curTpl['duration']) { $x .= "<br />" . Lang::game('duration') . Lang::main('colon') . Util::formatTime(abs($dur) * 1000) . ($this->curTpl['flagsCustom'] & 0x1 ? ' (' . Lang::item('realTime') . ')' : null); } // required holiday if ($eId = $this->curTpl['eventId']) { if ($hName = DB::Aowow()->selectRow('SELECT h.* FROM ?_holidays h JOIN ?_events e ON e.holidayId = h.id WHERE e.id = ?d', $eId)) { $x .= '<br />' . sprintf(Lang::game('requires'), '<a href="' . $eId . '" class="q1">' . Util::localizedString($hName, 'name') . '</a>'); } } // item begins a quest if ($this->curTpl['startQuest']) { $x .= '<br /><a class="q1" href="?quest=' . $this->curTpl['startQuest'] . '">' . Lang::item('startQuest') . '</a>'; } // containerType (slotCount) if ($this->curTpl['slots'] > 0) { $fam = $this->curTpl['bagFamily'] ? log($this->curTpl['bagFamily'], 2) + 1 : 0; // word order differs <_< if (in_array(User::$localeId, [LOCALE_FR, LOCALE_ES, LOCALE_RU])) { $x .= '<br />' . sprintf(Lang::item('bagSlotString'), Lang::item('bagFamily', $fam), $this->curTpl['slots']); } else { $x .= '<br />' . sprintf(Lang::item('bagSlotString'), $this->curTpl['slots'], Lang::item('bagFamily', $fam)); } } if (in_array($_class, [ITEM_CLASS_ARMOR, ITEM_CLASS_WEAPON, ITEM_CLASS_AMMUNITION])) { $x .= '<table width="100%"><tr>'; // Class if ($_slot) { $x .= '<td>' . Lang::item('inventoryType', $_slot) . '</td>'; } // Subclass if ($_class == ITEM_CLASS_ARMOR && $_subClass > 0) { $x .= '<th><!--asc' . $_subClass . '-->' . Lang::item('armorSubClass', $_subClass) . '</th>'; } else { if ($_class == ITEM_CLASS_WEAPON) { $x .= '<th>' . Lang::item('weaponSubClass', $_subClass) . '</th>'; } else { if ($_class == ITEM_CLASS_AMMUNITION) { $x .= '<th>' . Lang::item('projectileSubClass', $_subClass) . '</th>'; } } } $x .= '</tr></table>'; } else { if ($_slot && $_class != ITEM_CLASS_CONTAINER) { // yes, slot can occur on random items and is then also displayed <_< .. excluding Bags >_> $x .= '<br />' . Lang::item('inventoryType', $_slot) . '<br />'; } else { $x .= '<br />'; } } // Weapon/Ammunition Stats (not limited to weapons (see item:1700)) $speed = $this->curTpl['delay'] / 1000; $dmgmin1 = $this->curTpl['dmgMin1'] + $this->curTpl['dmgMin2']; $dmgmax1 = $this->curTpl['dmgMax1'] + $this->curTpl['dmgMax2']; $dps = $speed ? ($dmgmin1 + $dmgmax1) / (2 * $speed) : 0; if ($_class == ITEM_CLASS_AMMUNITION && $dmgmin1 && $dmgmax1) { $x .= Lang::item('addsDps') . ' ' . number_format(($dmgmin1 + $dmgmax1) / 2, 1) . ' ' . Lang::item('dps2') . '<br />'; } else { if ($dps) { if ($_class == ITEM_CLASS_WEAPON) { $x .= '<table width="100%"><tr>'; $x .= '<td><!--dmg-->' . sprintf($this->curTpl['dmgType1'] ? Lang::item('damageMagic') : Lang::item('damagePhys'), $this->curTpl['dmgMin1'] . ' - ' . $this->curTpl['dmgMax1'], Lang::game('sc', $this->curTpl['dmgType1'])) . '</td>'; $x .= '<th>' . Lang::item('speed') . ' <!--spd-->' . number_format($speed, 2) . '</th>'; // do not use localized format here! $x .= '</tr></table>'; } else { $x .= '<!--dmg-->' . sprintf($this->curTpl['dmgType1'] ? Lang::item('damageMagic') : Lang::item('damagePhys'), $this->curTpl['dmgMin1'] . ' - ' . $this->curTpl['dmgMax1'], Lang::game('sc', $this->curTpl['dmgType1'])) . '<br />'; } // secondary damage is set if ($this->curTpl['dmgMin2']) { $x .= '+' . sprintf($this->curTpl['dmgType2'] ? Lang::item('damageMagic') : Lang::item('damagePhys'), $this->curTpl['dmgMin2'] . ' - ' . $this->curTpl['dmgMax2'], Lang::game('sc', $this->curTpl['dmgType2'])) . '<br />'; } if ($_class == ITEM_CLASS_WEAPON) { $x .= '<!--dps-->(' . number_format($dps, 1) . ' ' . Lang::item('dps') . ')<br />'; } // do not use localized format here! // display FeralAttackPower if set if ($fap = $this->getFeralAP()) { $x .= '<span class="c11"><!--fap-->(' . $fap . ' ' . Lang::item('fap') . ')</span><br />'; } } } // Armor if ($_class == ITEM_CLASS_ARMOR && $this->curTpl['armorDamageModifier'] > 0) { $spanI = 'class="q2"'; if ($interactive) { $spanI = 'class="q2 tip" onmouseover="$WH.Tooltip.showAtCursor(event, $WH.sprintf(LANG.tooltip_armorbonus, ' . $this->curTpl['armorDamageModifier'] . '), 0, 0, \'q\')" onmousemove="$WH.Tooltip.cursorUpdate(event)" onmouseout="$WH.Tooltip.hide()"'; } $x .= '<span ' . $spanI . '><!--addamr' . $this->curTpl['armorDamageModifier'] . '--><span>' . sprintf(Lang::item('armor'), intVal($this->curTpl['armor'] + $this->curTpl['armorDamageModifier'])) . '</span></span><br />'; } else { if ($this->curTpl['armor'] + $this->curTpl['armorDamageModifier'] > 0) { $x .= '<span><!--amr-->' . sprintf(Lang::item('armor'), intVal($this->curTpl['armor'] + $this->curTpl['armorDamageModifier'])) . '</span><br />'; } } // Block if ($this->curTpl['block']) { $x .= '<span>' . sprintf(Lang::item('block'), $this->curTpl['block']) . '</span><br />'; } // Item is a gem (don't mix with sockets) if ($geId = $this->curTpl['gemEnchantmentId']) { $gemEnch = DB::Aowow()->selectRow('SELECT * FROM ?_itemenchantment WHERE id = ?d', $geId); $x .= '<span class="q1"><a href="?enchantment=' . $geId . '">' . Util::localizedString($gemEnch, 'name') . '</a></span><br />'; // activation conditions for meta gems if (!empty($gemEnch['conditionId'])) { if ($gemCnd = DB::Aowow()->selectRow('SELECT * FROM ?_itemenchantmentcondition WHERE id = ?d', $gemEnch['conditionId'])) { for ($i = 1; $i < 6; $i++) { if (!$gemCnd['color' . $i]) { continue; } 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], Lang::item('gemColors', $gemCnd['color' . $i] - 1)) . '</span><br />'; break; case 3: // requires more <color> than (<value> || <comparecolor>) gems $x .= '<span class="q0">' . Lang::achievement('reqNumCrt') . ' ' . sprintf(Lang::item('gemConditions', 3), Lang::item('gemColors', $gemCnd['color' . $i] - 1), Lang::item('gemColors', $gemCnd['cmpColor' . $i] - 1)) . '</span><br />'; break; } } } } } // Random Enchantment - if random enchantment is set, prepend stats from it if ($this->curTpl['randomEnchant'] && !isset($enhance['r'])) { $x .= '<span class="q2">' . Lang::item('randEnchant') . '</span><br />'; } else { if (isset($enhance['r'])) { $x .= $randEnchant; } } // itemMods (display stats and save ratings for later use) for ($j = 1; $j <= 10; $j++) { $type = $this->curTpl['statType' . $j]; $qty = $this->curTpl['statValue' . $j]; if (!$qty || $type <= 0) { continue; } // base stat if ($type >= ITEM_MOD_AGILITY && $type <= ITEM_MOD_STAMINA) { $x .= '<span><!--stat' . $type . '-->' . ($qty > 0 ? '+' : '-') . abs($qty) . ' ' . Lang::item('statType', $type) . '</span><br />'; } else { // rating with % for reqLevel $green[] = $this->parseRating($type, $qty, $interactive, $causesScaling); } } // magic resistances foreach (Util::$resistanceFields as $j => $rowName) { if ($rowName && $this->curTpl[$rowName] != 0) { $x .= '+' . $this->curTpl[$rowName] . ' ' . Lang::game('resistances', $j) . '<br />'; } } // Enchantment if (isset($enhance['e'])) { if ($enchText = DB::Aowow()->selectRow('SELECT * FROM ?_itemenchantment WHERE Id = ?', $enhance['e'])) { $x .= '<span class="q2"><!--e-->' . Util::localizedString($enchText, 'name') . '</span><br />'; } else { unset($enhance['e']); $x .= '<!--e-->'; } } else { // enchantment placeholder $x .= '<!--e-->'; } // Sockets w/ Gems if (!empty($enhance['g'])) { $gems = DB::Aowow()->select(' SELECT it.id AS ARRAY_KEY, ic.iconString, ae.*, it.gemColorMask AS colorMask FROM ?_items it JOIN ?_itemenchantment ae ON ae.id = it.gemEnchantmentId JOIN ?_icons ic ON ic.id = -it.displayId WHERE it.id IN (?a)', $enhance['g']); foreach ($enhance['g'] as $k => $v) { if ($v && !in_array($v, array_keys($gems))) { // 0 is valid unset($enhance['g'][$k]); } } } else { $enhance['g'] = []; } // zero fill empty sockets $sockCount = isset($enhance['s']) ? 1 : 0; if (!empty($this->json[$this->id]['nsockets'])) { $sockCount += $this->json[$this->id]['nsockets']; } while ($sockCount > count($enhance['g'])) { $enhance['g'][] = 0; } $enhance['g'] = array_reverse($enhance['g']); $hasMatch = 1; // fill native sockets for ($j = 1; $j <= 3; $j++) { if (!$this->curTpl['socketColor' . $j]) { continue; } for ($i = 0; $i < 4; $i++) { if ($this->curTpl['socketColor' . $j] & 1 << $i) { $colorId = $i; } } $pop = array_pop($enhance['g']); $col = $pop ? 1 : 0; $hasMatch &= $pop ? $gems[$pop]['colorMask'] & 1 << $colorId ? 1 : 0 : 0; $icon = $pop ? sprintf(Util::$bgImagePath['tiny'], STATIC_URL, strtolower($gems[$pop]['iconString'])) : null; $text = $pop ? Util::localizedString($gems[$pop], 'name') : Lang::item('socket', $colorId); if ($interactive) { $x .= '<a href="?items=3&filter=cr=81;crs=' . ($colorId + 1) . ';crv=0" class="socket-' . Util::$sockets[$colorId] . ' q' . $col . '" ' . $icon . '>' . $text . '</a><br />'; } else { $x .= '<span class="socket-' . Util::$sockets[$colorId] . ' q' . $col . '" ' . $icon . '>' . $text . '</span><br />'; } } // fill extra socket if (isset($enhance['s'])) { $pop = array_pop($enhance['g']); $col = $pop ? 1 : 0; $icon = $pop ? sprintf(Util::$bgImagePath['tiny'], STATIC_URL, strtolower($gems[$pop]['iconString'])) : null; $text = $pop ? Util::localizedString($gems[$pop], 'name') : Lang::item('socket', -1); if ($interactive) { $x .= '<a href="?items=3&filter=cr=81;crs=5;crv=0" class="socket-prismatic q' . $col . '" ' . $icon . '>' . $text . '</a><br />'; } else { $x .= '<span class="socket-prismatic q' . $col . '" ' . $icon . '>' . $text . '</span><br />'; } } else { // prismatic socket placeholder $x .= '<!--ps-->'; } if ($_ = $this->curTpl['socketBonus']) { $sbonus = DB::Aowow()->selectRow('SELECT * FROM ?_itemenchantment WHERE Id = ?d', $_); $x .= '<span class="q' . ($hasMatch ? '2' : '0') . '">' . Lang::item('socketBonus') . Lang::main('colon') . '<a href="?enchantment=' . $_ . '">' . Util::localizedString($sbonus, 'name') . '</a></span><br />'; } // durability if ($dur = $this->curTpl['durability']) { $x .= Lang::item('durability') . ' ' . $dur . ' / ' . $dur . '<br />'; } // required classes if ($classes = Lang::getClassString($this->curTpl['requiredClass'], $jsg, $__)) { foreach ($jsg as $js) { if (empty($this->jsGlobals[TYPE_CLASS][$js])) { $this->jsGlobals[TYPE_CLASS][$js] = $js; } } $x .= Lang::game('classes') . Lang::main('colon') . $classes . '<br />'; } // required races if ($races = Lang::getRaceString($this->curTpl['requiredRace'], $__, $jsg, $__)) { foreach ($jsg as $js) { if (empty($this->jsGlobals[TYPE_RACE][$js])) { $this->jsGlobals[TYPE_RACE][$js] = $js; } } if ($races != Lang::game('ra', 0)) { // not "both", but display combinations like: troll, dwarf $x .= Lang::game('races') . Lang::main('colon') . $races . '<br />'; } } // required honorRank (not used anymore) if ($rhr = $this->curTpl['requiredHonorRank']) { $x .= sprintf(Lang::game('requires'), Lang::game('pvpRank', $rhr)) . '<br />'; } // required CityRank..? // what the f.. // required level if ($_flags & ITEM_FLAG_ACCOUNTBOUND && $_quality == ITEM_QUALITY_HEIRLOOM) { $x .= sprintf(Lang::game('reqLevelHlm'), ' 1' . Lang::game('valueDelim') . MAX_LEVEL . ' (' . ($interactive ? sprintf(Util::$changeLevelString, MAX_LEVEL) : '<!--lvl-->' . MAX_LEVEL) . ')') . '<br />'; } else { if ($_reqLvl > 1) { $x .= sprintf(Lang::game('reqLevel'), $_reqLvl) . '<br />'; } } // required arena team rating / personal rating / todo (low): sort out what kind of rating if (!empty($this->getExtendedCost([], $reqRating)[$this->id]) && $reqRating) { $x .= sprintf(Lang::item('reqRating', $reqRating[1]), $reqRating[0]) . '<br />'; } // item level if (in_array($_class, [ITEM_CLASS_ARMOR, ITEM_CLASS_WEAPON])) { $x .= Lang::item('itemLevel') . ' ' . $this->curTpl['itemLevel'] . '<br />'; } // required skill if ($reqSkill = $this->curTpl['requiredSkill']) { $_ = '<a class="q1" href="?skill=' . $reqSkill . '">' . SkillList::getName($reqSkill) . '</a>'; if ($this->curTpl['requiredSkillRank'] > 0) { $_ .= ' (' . $this->curTpl['requiredSkillRank'] . ')'; } $x .= sprintf(Lang::game('requires'), $_) . '<br />'; } // required spell if ($reqSpell = $this->curTpl['requiredSpell']) { $x .= Lang::game('requires2') . ' <a class="q1" href="?spell=' . $reqSpell . '">' . SpellList::getName($reqSpell) . '</a><br />'; } // 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('/([^;]*)( <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 $itemset = new ItemsetList(array(['id', $setId])); if (!$itemset->error && $itemset->pieceToSet) { $pieces = DB::Aowow()->select(' SELECT b.id AS ARRAY_KEY, b.name_loc0, b.name_loc2, b.name_loc3, b.name_loc6, b.name_loc8, GROUP_CONCAT(a.id SEPARATOR \':\') AS equiv FROM ?_items a, ?_items b WHERE a.slotBak = b.slotBak AND a.itemset = b.itemset AND b.id IN (?a) GROUP BY b.id;', array_keys($itemset->pieceToSet)); foreach ($pieces as $k => &$p) { $p = '<span><!--si' . $p['equiv'] . '--><a href="?item=' . $k . '">' . Util::localizedString($p, 'name') . '</a></span>'; } $xSet = '<br /><span class="q"><a href="?itemset=' . $itemset->id . '" class="q">' . $itemset->getField('name', true) . '</a> (0/' . count($pieces) . ')</span>'; if ($skId = $itemset->getField('skillId')) { $xSet .= '<br />' . sprintf(Lang::game('requires'), '<a href="?skills=' . $skId . '" class="q1">' . SkillList::getName($skId) . '</a>'); if ($_ = $itemset->getField('skillLevel')) { $xSet .= ' (' . $_ . ')'; } $xSet .= '<br />'; } // list pieces $xSet .= '<div class="q0 indent">' . implode('<br />', $pieces) . '</div><br />'; // get bonuses $setSpellsAndIdx = []; for ($j = 1; $j <= 8; $j++) { if ($_ = $itemset->getField('spell' . $j)) { $setSpellsAndIdx[$_] = $j; } } $setSpells = []; if ($setSpellsAndIdx) { $boni = new SpellList(array(['s.id', array_keys($setSpellsAndIdx)])); foreach ($boni->iterate() as $__) { $setSpells[] = array('tooltip' => $boni->parseText('description', $_reqLvl > 1 ? $_reqLvl : MAX_LEVEL, false, $causesScaling)[0], 'entry' => $itemset->getField('spell' . $setSpellsAndIdx[$boni->id]), 'bonus' => $itemset->getField('bonus' . $setSpellsAndIdx[$boni->id])); } } // sort and list bonuses $xSet .= '<span class="q0">'; for ($i = 0; $i < count($setSpells); $i++) { for ($j = $i; $j < count($setSpells); $j++) { if ($setSpells[$j]['bonus'] >= $setSpells[$i]['bonus']) { continue; } $tmp = $setSpells[$i]; $setSpells[$i] = $setSpells[$j]; $setSpells[$j] = $tmp; } $xSet .= '<span>(' . $setSpells[$i]['bonus'] . ') ' . Lang::item('set') . ': <a href="?spell=' . $setSpells[$i]['entry'] . '">' . $setSpells[$i]['tooltip'] . '</a></span>'; if ($i < count($setSpells) - 1) { $xSet .= '<br />'; } } $xSet .= '</span>'; } } // recipes, vanity pets, mounts if ($this->canTeachSpell()) { $craftSpell = new SpellList(array(['s.id', intVal($this->curTpl['spellId2'])])); if (!$craftSpell->error) { $xCraft = ''; if ($desc = $this->getField('description', true)) { $x .= '<span class="q2">' . Lang::item('trigger', 0) . ' <a href="?spell=' . $this->curTpl['spellId2'] . '">' . $desc . '</a></span><br />'; } // recipe handling (some stray Techniques have subclass == 0), place at bottom of tooltipp if ($_class == ITEM_CLASS_RECIPE || $this->curTpl['bagFamily'] == 16) { $craftItem = new ItemList(array(['i.id', (int) $craftSpell->curTpl['effect1CreateItemId']])); if (!$craftItem->error) { if ($itemTT = $craftItem->renderTooltip($interactive, $this->id)) { $xCraft .= '<div><br />' . $itemTT . '</div>'; } $reagentItems = []; for ($i = 1; $i <= 8; $i++) { if ($rId = $craftSpell->getField('reagent' . $i)) { $reagentItems[$rId] = $craftSpell->getField('reagentCount' . $i); } } if (isset($xCraft) && $reagentItems) { $reagents = new ItemList(array(['i.id', array_keys($reagentItems)])); $reqReag = []; foreach ($reagents->iterate() as $__) { $reqReag[] = '<a href="?item=' . $reagents->id . '">' . $reagents->getField('name', true) . '</a> (' . $reagentItems[$reagents->id] . ')'; } $xCraft .= '<div class="q1 whtt-reagents"><br />' . Lang::game('requires2') . ' ' . implode(', ', $reqReag) . '</div>'; } } } } } // misc (no idea, how to organize the <br /> better) $xMisc = []; // itemset: pieces and boni if (isset($xSet)) { $xMisc[] = $xSet; } // funny, yellow text at the bottom, omit if we have a recipe if ($this->curTpl['description_loc0'] && !$this->canTeachSpell()) { $xMisc[] = '<span class="q">"' . $this->getField('description', true) . '"</span>'; } // readable if ($this->curTpl['pageTextId']) { $xMisc[] = '<span class="q2">' . Lang::item('readClick') . '</span>'; } // charges (i guess checking first spell is enough (single charges not shown)) if ($this->curTpl['spellCharges1'] > 1 || $this->curTpl['spellCharges1'] < -1) { $xMisc[] = '<span class="q1">' . abs($this->curTpl['spellCharges1']) . ' ' . Lang::item('charges') . '</span>'; } // list required reagents if (isset($xCraft)) { $xMisc[] = $xCraft; } if ($xMisc) { $x .= implode('<br />', $xMisc); } if ($sp = $this->curTpl['sellPrice']) { $x .= '<div class="q1 whtt-sellprice">' . Lang::item('sellPrice') . Lang::main('colon') . Util::formatMoney($sp) . '</div>'; } if (!$subOf) { $x .= '</td></tr></table>'; } // tooltip scaling if (!isset($xCraft)) { $link = [$subOf ? $subOf : $this->id, 1]; // itemId, scaleMinLevel if (isset($this->ssd[$this->id])) { array_push($link, $this->ssd[$this->id]['maxLevel'], $this->ssd[$this->id]['maxLevel'], $this->curTpl['scalingStatDistribution'], $this->curTpl['scalingStatValue']); } else { array_push($link, $causesScaling ? MAX_LEVEL : 1, $_reqLvl > 1 ? $_reqLvl : MAX_LEVEL); } $x .= '<!--?' . implode(':', $link) . '-->'; } return $x; }
<?php if (User::$id) { echo '<a id="toplinks-user">' . User::$displayName . '</a>'; echo '<span id="toplinks-rep" title="' . Lang::main('reputationTip') . '">(<a href="?reputation">' . User::getReputation() . '</a>)</span>'; } else { echo '<a href="?account=signin">' . Lang::main('signIn') . '</a>'; } ?> |<a href="#" id="toplinks-feedback" class="icon-email"><?php echo Lang::main('feedback'); ?> </a> |<a href="javascript:;" id="toplinks-language"><?php echo Lang::main('language'); ?> </a>
protected function generateContent() { $this->addJS('?data=zones&locale=' . User::$localeId . '&t=' . $_SESSION['dataKey']); /***********/ /* Infobox */ /***********/ $infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags')); // Event (ignore events, where the object only gets removed) if ($_ = DB::World()->selectCol('SELECT DISTINCT IF(ge.holiday, ge.holiday, -ge.eventEntry) FROM game_event ge, game_event_gameobject geg, gameobject g WHERE ge.eventEntry = geg.eventEntry AND g.guid = geg.guid AND g.id = ?d', $this->typeId)) { $this->extendGlobalIds(TYPE_WORLDEVENT, $_); $ev = []; foreach ($_ as $i => $e) { $ev[] = ($i % 2 ? '[br]' : ' ') . '[event=' . $e . ']'; } $infobox[] = Util::ucFirst(Lang::game('eventShort')) . Lang::main('colon') . implode(',', $ev); } // Reaction $_ = function ($r) { if ($r == 1) { return 2; } if ($r == -1) { return 10; } return; }; $infobox[] = Lang::npc('react') . Lang::main('colon') . '[color=q' . $_($this->subject->getField('A')) . ']A[/color] [color=q' . $_($this->subject->getField('H')) . ']H[/color]'; // reqSkill switch ($this->subject->getField('typeCat')) { case -3: // Herbalism $infobox[] = sprintf(Lang::game('requires'), Lang::spell('lockType', 2) . ' (' . $this->subject->getField('reqSkill') . ')'); break; case -4: // Mining $infobox[] = sprintf(Lang::game('requires'), Lang::spell('lockType', 3) . ' (' . $this->subject->getField('reqSkill') . ')'); break; case -5: // Lockpicking $infobox[] = sprintf(Lang::game('requires'), Lang::spell('lockType', 1) . ' (' . $this->subject->getField('reqSkill') . ')'); break; default: $locks = Lang::getLocks($this->subject->getField('lockId')); $l = ''; foreach ($locks as $idx => $_) { if ($idx < 0) { continue; } $this->extendGlobalIds(TYPE_ITEM, $idx); $l = Lang::gameObject('key') . Lang::main('colon') . '[item=' . $idx . ']'; } // if no propper item is found use a skill if ($locks) { $infobox[] = $l ? $l : array_pop($locks); } } // linked trap if ($_ = $this->subject->getField('linkedTrap')) { $this->extendGlobalIds(TYPE_OBJECT, $_); $infobox[] = Lang::gameObject('trap') . Lang::main('colon') . '[object=' . $_ . ']'; } // trap for $trigger = new GameObjectList(array(['linkedTrap', $this->typeId])); if (!$trigger->error) { $this->extendGlobalData($trigger->getJSGlobals()); $infobox[] = Lang::gameObject('triggeredBy') . Lang::main('colon') . '[object=' . $trigger->id . ']'; } // SpellFocus if ($_ = $this->subject->getField('spellFocusId')) { if ($sfo = DB::Aowow()->selectRow('SELECT * FROM ?_spellfocusobject WHERE id = ?d', $_)) { $infobox[] = '[tooltip name=focus]' . Lang::gameObject('focusDesc') . '[/tooltip][span class=tip tooltip=focus]' . Lang::gameObject('focus') . Lang::main('colon') . Util::localizedString($sfo, 'name') . '[/span]'; } } // lootinfo: [min, max, restock] if (($_ = $this->subject->getField('lootStack')) && $_[0]) { $buff = Lang::item('charges') . Lang::main('colon') . $_[0]; if ($_[0] < $_[1]) { $buff .= Lang::game('valueDelim') . $_[1]; } // since Veins don't have charges anymore, the timer is questionable $infobox[] = $_[2] > 1 ? '[tooltip name=restock]' . sprintf(Lang::gameObject('restock'), Util::formatTime($_[2] * 1000)) . '[/tooltip][span class=tip tooltip=restock]' . $buff . '[/span]' : $buff; } // meeting stone [minLevel, maxLevel, zone] if ($this->subject->getField('type') == OBJECT_MEETINGSTONE) { if ($_ = $this->subject->getField('mStone')) { $this->extendGlobalIds(TYPE_ZONE, $_[2]); $m = Lang::game('meetingStone') . Lang::main('colon') . '[zone=' . $_[2] . ']'; $l = $_[0]; if ($_[0] > 1 && $_[1] > $_[0]) { $l .= Lang::game('valueDelim') . min($_[1], MAX_LEVEL); } $infobox[] = $l ? '[tooltip name=meetingstone]' . sprintf(Lang::game('reqLevel'), $l) . '[/tooltip][span class=tip tooltip=meetingstone]' . $m . '[/span]' : $m; } } // capture area [minPlayer, maxPlayer, minTime, maxTime, radius] if ($this->subject->getField('type') == OBJECT_CAPTURE_POINT) { if ($_ = $this->subject->getField('capture')) { $buff = Lang::gameObject('capturePoint'); if ($_[2] > 1 || $_[0]) { $buff .= Lang::main('colon') . '[ul]'; } if ($_[2] > 1) { $buff .= '[li]' . Lang::game('duration') . Lang::main('colon') . ($_[3] > $_[2] ? Util::FormatTime($_[3] * 1000, true) . ' - ' : null) . Util::FormatTime($_[2] * 1000, true) . '[/li]'; } if ($_[1]) { $buff .= '[li]' . Lang::main('players') . Lang::main('colon') . $_[0] . ($_[1] > $_[0] ? ' - ' . $_[1] : null) . '[/li]'; } if ($_[4]) { $buff .= '[li]' . sprintf(Lang::spell('range'), $_[4]) . '[/li]'; } if ($_[2] > 1 || $_[0]) { $buff .= '[/ul]'; } } $infobox[] = $buff; } // AI if (User::isInGroup(U_GROUP_EMPLOYEE)) { if ($_ = $this->subject->getField('ScriptName')) { $infobox[] = 'Script' . Lang::main('colon') . $_; } else { if ($_ = $this->subject->getField('AIName')) { $infobox[] = 'AI' . Lang::main('colon') . $_; } } } /****************/ /* Main Content */ /****************/ // pageText $pageText = []; if ($next = $this->subject->getField('pageTextId')) { while ($next) { $row = DB::World()->selectRow('SELECT *, text as Text_loc0 FROM page_text pt LEFT JOIN locales_page_text lpt ON pt.entry = lpt.entry WHERE pt.entry = ?d', $next); $next = $row['next_page']; $pageText[] = Util::parseHtmlText(Util::localizedString($row, 'Text')); } } // add conditional js & css if ($pageText) { $this->addCSS(['path' => 'Book.css']); $this->addJS('Book.js'); } // get spawns and path $map = null; if ($spawns = $this->subject->getSpawns(SPAWNINFO_FULL)) { $map = ['data' => ['parent' => 'mapper-generic'], 'mapperData' => &$spawns]; foreach ($spawns as $areaId => &$areaData) { $map['extra'][$areaId] = ZoneList::getName($areaId); } } // consider pooled spawns $this->infobox = $infobox ? '[ul][li]' . implode('[/li][li]', $infobox) . '[/li][/ul]' : null; $this->pageText = $pageText; $this->map = $map; $this->redButtons = array(BUTTON_WOWHEAD => true, BUTTON_LINKS => true, BUTTON_VIEW3D => ['displayId' => $this->subject->getField('displayId'), 'type' => TYPE_OBJECT, 'typeId' => $this->typeId]); /**************/ /* Extra Tabs */ /**************/ // tab: summoned by $conditions = array('OR', ['AND', ['effect1Id', [50, 76, 104, 105, 106, 107]], ['effect1MiscValue', $this->typeId]], ['AND', ['effect2Id', [50, 76, 104, 105, 106, 107]], ['effect2MiscValue', $this->typeId]], ['AND', ['effect3Id', [50, 76, 104, 105, 106, 107]], ['effect3MiscValue', $this->typeId]]); $summons = new SpellList($conditions); if (!$summons->error) { $this->extendGlobalData($summons->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED)); $this->lvTabs[] = array('file' => 'spell', 'data' => $summons->getListviewData(), 'params' => array('id' => 'summoned-by', 'name' => '$LANG.tab_summonedby')); } // tab: related spells if ($_ = $this->subject->getField('spells')) { $relSpells = new SpellList(array(['id', $_])); if (!$relSpells->error) { $this->extendGlobalData($relSpells->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED)); $data = $relSpells->getListviewData(); foreach ($data as $relId => $d) { $data[$relId]['trigger'] = array_search($relId, $_); } $this->lvTabs[] = array('file' => 'spell', 'data' => $data, 'params' => array('id' => 'spells', 'name' => '$LANG.tab_spells', 'hiddenCols' => "\$['skill']", 'extraCols' => "\$[Listview.funcBox.createSimpleCol('trigger', 'Condition', '10%', 'trigger')]")); } } // tab: criteria of $acvs = new AchievementList(array(['ac.type', [ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT, ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT]], ['ac.value1', $this->typeId])); if (!$acvs->error) { $this->extendGlobalData($acvs->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED)); $this->lvTabs[] = array('file' => 'achievement', 'data' => $acvs->getListviewData(), 'params' => array('id' => 'criteria-of', 'name' => '$LANG.tab_criteriaof')); } // tab: starts quest // tab: ends quest $startEnd = new QuestList(array(['qse.type', TYPE_OBJECT], ['qse.typeId', $this->typeId])); if (!$startEnd->error) { $this->extendGlobalData($startEnd->getJSGlobals()); $lvData = $startEnd->getListviewData(); $_ = [[], []]; foreach ($startEnd->iterate() as $id => $__) { $m = $startEnd->getField('method'); if ($m & 0x1) { $_[0][] = $lvData[$id]; } if ($m & 0x2) { $_[1][] = $lvData[$id]; } } if ($_[0]) { $this->lvTabs[] = array('file' => 'quest', 'data' => $_[0], 'params' => array('name' => '$LANG.tab_starts', 'id' => 'starts')); } if ($_[1]) { $this->lvTabs[] = array('file' => 'quest', 'data' => $_[1], 'params' => array('name' => '$LANG.tab_ends', 'id' => 'ends')); } } // tab: related quests if ($_ = $this->subject->getField('reqQuest')) { $relQuest = new QuestList(array(['id', $_])); if (!$relQuest->error) { $this->extendGlobalData($relQuest->getJSGlobals()); $this->lvTabs[] = array('file' => 'quest', 'data' => $relQuest->getListviewData(), 'params' => array('name' => '$LANG.tab_quests', 'id' => 'quests')); } } // tab: contains $reqQuest = []; if ($_ = $this->subject->getField('lootId')) { $goLoot = new Loot(); if ($goLoot->getByContainer(LOOT_GAMEOBJECT, $_)) { $extraCols = $goLoot->extraCols; $hiddenCols = ['source', 'side', 'slot', 'reqlevel']; $this->extendGlobalData($goLoot->jsGlobals); foreach ($goLoot->iterate() as &$lv) { if (!empty($hiddenCols)) { foreach ($hiddenCols as $k => $str) { if (!empty($lv[$str])) { unset($hiddenCols[$k]); } } } if (!$lv['quest']) { continue; } $extraCols[] = 'Listview.extraCols.condition'; $reqQuest[$lv['id']] = 0; $lv['condition'][0][$this->typeId][] = [[CND_QUESTTAKEN, &$reqQuest[$lv['id']]]]; } $extraCols[] = 'Listview.extraCols.percent'; $this->lvTabs[] = array('file' => 'item', 'data' => $goLoot->getResult(), 'params' => array('name' => '$LANG.tab_contains', 'id' => 'contains', 'extraCols' => "\$[" . implode(', ', array_unique($extraCols)) . "]", 'hiddenCols' => $hiddenCols ? '$' . Util::toJSON(array_values($hiddenCols)) : null)); } } if ($reqIds = array_keys($reqQuest)) { $conditions = array('OR', ['reqSourceItemId1', $reqIds], ['reqSourceItemId2', $reqIds], ['reqSourceItemId3', $reqIds], ['reqSourceItemId4', $reqIds], ['reqItemId1', $reqIds], ['reqItemId2', $reqIds], ['reqItemId3', $reqIds], ['reqItemId4', $reqIds], ['reqItemId5', $reqIds], ['reqItemId6', $reqIds]); $reqQuests = new QuestList($conditions); $this->extendGlobalData($reqQuests->getJSGlobals()); foreach ($reqQuests->iterate() as $qId => $__) { if (empty($reqQuests->requires[$qId][TYPE_ITEM])) { continue; } foreach ($reqIds as $rId) { if (in_array($rId, $reqQuests->requires[$qId][TYPE_ITEM])) { $reqQuest[$rId] = $reqQuests->id; } } } } // tab: Same model as .. whats the f*****g point..? $sameModel = new GameObjectList(array(['displayId', $this->subject->getField('displayId')], ['id', $this->typeId, '!'])); if (!$sameModel->error) { $this->extendGlobalData($sameModel->getJSGlobals()); $this->lvTabs[] = array('file' => 'object', 'data' => $sameModel->getListviewData(), 'params' => array('name' => '$LANG.tab_samemodelas', 'id' => 'same-model-as')); } }
" method="post" onsubmit="this.elements['coords'].value = myCropper.getCoords()"> <?php echo Lang::screenshot('caption') . Lang::main('colon'); ?> <input type="text" name="screenshotalt" style="width: 55%" maxlength="200" /> <small> <?php echo Lang::screenshot('charLimit'); ?> </small><br /> <div class="pad"></div> <?php $this->localizedBrick('ssReminder', User::$localeId); ?> <input type="submit" value="<?php echo Lang::main('submit'); ?> " /> <input type="hidden" name="coords" /> </form> <script type="text/javascript">//<![CDATA[ var captionMaxLen = 200; Body = $('#main-contents').find('input[type=text]'); TextCounter = $('#main-contents').find('small'); Body.focus(); Body.keyup(function (e) { return UpdateTextCounter(); }); Body.keypress(function (e) { // ENTER
protected function generateContent() { /***********/ /* Infobox */ /***********/ $infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags')); // reqLevel if ($_ = $this->subject->getField('requiredLevel')) { $infobox[] = sprintf(Lang::game('reqLevel'), $_); } // reqskill if ($_ = $this->subject->getField('skillLine')) { $this->extendGlobalIds(TYPE_SKILL, $_); $foo = sprintf(Lang::game('requires'), ' [skill=' . $_ . ']'); if ($_ = $this->subject->getField('skillLevel')) { $foo .= ' (' . $_ . ')'; } $infobox[] = $foo; } /****************/ /* Main Content */ /****************/ $this->infobox = $infobox ? '[ul][li]' . implode('[/li][li]', $infobox) . '[/li][/ul]' : null; $this->effects = []; // 3 effects for ($i = 1; $i < 4; $i++) { $_ty = $this->subject->getField('type' . $i); $_qty = $this->subject->getField('amount' . $i); $_obj = $this->subject->getField('object' . $i); switch ($_ty) { case 1: case 3: case 7: $sArr = $this->subject->getField('spells')[$i]; $spl = $this->subject->getRelSpell($sArr[0]); $this->effects[$i]['name'] = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, 'Type: ' . $_ty, Lang::item('trigger', $sArr[1])) : Lang::item('trigger', $sArr[1]); $this->effects[$i]['proc'] = $sArr[3]; $this->effects[$i]['value'] = $_qty ?: null; $this->effects[$i]['icon'] = array('name' => !$spl ? Util::ucFirst(Lang::game('spell')) . ' #' . $sArr[0] : Util::localizedString($spl, 'name'), 'id' => $sArr[0], 'count' => $sArr[2]); break; case 5: if ($_obj < 2) { // [mana, health] are on [0, 1] respectively and are expected on [1, 2] .. $_obj++; } // 0 is weaponDmg .. ehh .. i messed up somewhere $this->effects[$i]['tip'] = [$_obj, Util::$itemMods[$_obj]]; // DO NOT BREAK! // DO NOT BREAK! case 2: case 6: case 8: case 4: $this->effects[$i]['name'] = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, 'Type: ' . $_ty, Lang::enchantment('types', $_ty)) : Lang::enchantment('types', $_ty); $this->effects[$i]['value'] = $_qty; if ($_ty == 4) { $this->effects[$i]['name'] .= Lang::main('colon') . '(' . (User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, 'Object: ' . $_obj, Lang::getMagicSchools(1 << $_obj)) : Lang::getMagicSchools(1 << $_obj)) . ')'; } } } // activation conditions if ($_ = $this->subject->getField('conditionId')) { $x = ''; if ($gemCnd = DB::Aowow()->selectRow('SELECT * FROM ?_itemenchantmentcondition WHERE id = ?d', $_)) { for ($i = 1; $i < 6; $i++) { if (!$gemCnd['color' . $i]) { continue; } $fiColors = function ($idx) { $foo = ''; switch ($idx) { case 2: $foo = '0:3:5'; break; // red // red case 3: $foo = '2:4:5'; break; // yellow // yellow case 4: $foo = '1:3:4'; break; // blue } 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)); } } } }
private function resolveEvaluation($formula) { // see Traits in javascript locales $PlayerName = Lang::main('name'); $pl = $PL = $this->interactive ? sprintf(Util::$dfnString, 'LANG.level', Lang::game('level')) : Lang::game('level'); $ap = $AP = $this->interactive ? sprintf(Util::$dfnString, 'LANG.traits.atkpwr[0]', Lang::spell('traitShort', 'atkpwr')) : Lang::spell('traitShort', 'atkpwr'); $rap = $RAP = $this->interactive ? sprintf(Util::$dfnString, 'LANG.traits.rgdatkpwr[0]', Lang::spell('traitShort', 'rgdatkpwr')) : Lang::spell('traitShort', 'rgdatkpwr'); $sp = $SP = $this->interactive ? sprintf(Util::$dfnString, 'LANG.traits.splpwr[0]', Lang::spell('traitShort', 'splpwr')) : Lang::spell('traitShort', 'splpwr'); $spa = $SPA = $this->interactive ? sprintf(Util::$dfnString, 'LANG.traits.arcsplpwr[0]', Lang::spell('traitShort', 'arcsplpwr')) : Lang::spell('traitShort', 'arcsplpwr'); $spfi = $SPFI = $this->interactive ? sprintf(Util::$dfnString, 'LANG.traits.firsplpwr[0]', Lang::spell('traitShort', 'firsplpwr')) : Lang::spell('traitShort', 'firsplpwr'); $spfr = $SPFR = $this->interactive ? sprintf(Util::$dfnString, 'LANG.traits.frosplpwr[0]', Lang::spell('traitShort', 'frosplpwr')) : Lang::spell('traitShort', 'frosplpwr'); $sph = $SPH = $this->interactive ? sprintf(Util::$dfnString, 'LANG.traits.holsplpwr[0]', Lang::spell('traitShort', 'holsplpwr')) : Lang::spell('traitShort', 'holsplpwr'); $spn = $SPN = $this->interactive ? sprintf(Util::$dfnString, 'LANG.traits.natsplpwr[0]', Lang::spell('traitShort', 'natsplpwr')) : Lang::spell('traitShort', 'natsplpwr'); $sps = $SPS = $this->interactive ? sprintf(Util::$dfnString, 'LANG.traits.shasplpwr[0]', Lang::spell('traitShort', 'shasplpwr')) : Lang::spell('traitShort', 'shasplpwr'); $bh = $BH = $this->interactive ? sprintf(Util::$dfnString, 'LANG.traits.splheal[0]', Lang::spell('traitShort', 'splheal')) : Lang::spell('traitShort', 'splheal'); // only 'ron test spell', guess its %-dmg mod; no idea what bc2 might be $pa = '<$PctArcane>'; // %arcane $pfi = '<$PctFire>'; // %fire $pfr = '<$PctFrost>'; // %frost $ph = '<$PctHoly>'; // %holy $pn = '<$PctNature>'; // %nature $ps = '<$PctShadow>'; // %shadow $pbh = '<$PctHeal>'; // %heal $pbhd = '<$PctHealDone>'; // %heal done $bc2 = '<$bc2>'; // bc2 $HND = $hnd = $this->interactive ? sprintf(Util::$dfnString, '[Hands required by weapon]', 'HND') : 'HND'; // todo (med): localize this one $MWS = $mws = $this->interactive ? sprintf(Util::$dfnString, 'LANG.traits.mlespeed[0]', 'MWS') : 'MWS'; $mw = $this->interactive ? sprintf(Util::$dfnString, 'LANG.traits.dmgmin1[0]', 'mw') : 'mw'; $MW = $this->interactive ? sprintf(Util::$dfnString, 'LANG.traits.dmgmax1[0]', 'MW') : 'MW'; $mwb = $this->interactive ? sprintf(Util::$dfnString, 'LANG.traits.mledmgmin[0]', 'mwb') : 'mwb'; $MWB = $this->interactive ? sprintf(Util::$dfnString, 'LANG.traits.mledmgmax[0]', 'MWB') : 'MWB'; $rwb = $this->interactive ? sprintf(Util::$dfnString, 'LANG.traits.rgddmgmin[0]', 'rwb') : 'rwb'; $RWB = $this->interactive ? sprintf(Util::$dfnString, 'LANG.traits.rgddmgmax[0]', 'RWB') : 'RWB'; $cond = $COND = function ($a, $b, $c) { return $a ? $b : $c; }; $eq = $EQ = function ($a, $b) { return $a == $b; }; $gt = $GT = function ($a, $b) { return $a > $b; }; $gte = $GTE = function ($a, $b) { return $a <= $b; }; $floor = $FLOOR = function ($a) { return floor($a); }; $max = $MAX = function ($a, $b) { return max($a, $b); }; $min = $MIN = function ($a, $b) { return min($a, $b); }; if (preg_match_all('/\\$\\w+\\b/i', $formula, $vars)) { $evalable = true; foreach ($vars[0] as $var) { $var = substr($var, 1); if (isset(${$var})) { $eval = eval('return @$' . $var . ';'); // attention: error suppression active here (will be logged anyway) if (getType($eval) == 'object') { continue; } else { if (is_numeric($eval)) { continue; } } } else { ${$var} = '<UNK: $' . $var . '>'; } $evalable = false; break; } if (!$evalable) { // can't eval constructs because of strings present. replace constructs with strings $cond = $COND = !$this->interactive ? 'COND' : sprintf(Util::$dfnString, 'COND(<span class=\'q1\'>a</span>, <span class=\'q1\'>b</span>, <span class=\'q1\'>c</span>)<br /> <span class=\'q1\'>a</span> ? <span class=\'q1\'>b</span> : <span class=\'q1\'>c</span>', 'COND'); $eq = $EQ = !$this->interactive ? 'EQ' : sprintf(Util::$dfnString, 'EQ(<span class=\'q1\'>a</span>, <span class=\'q1\'>b</span>)<br /> <span class=\'q1\'>a</span> == <span class=\'q1\'>b</span>', 'EQ'); $gt = $GT = !$this->interactive ? 'GT' : sprintf(Util::$dfnString, 'GT(<span class=\'q1\'>a</span>, <span class=\'q1\'>b</span>)<br /> <span class=\'q1\'>a</span> > <span class=\'q1\'>b</span>', 'GT'); $gte = $GTE = !$this->interactive ? 'GTE' : sprintf(Util::$dfnString, 'GTE(<span class=\'q1\'>a</span>, <span class=\'q1\'>b</span>)<br /> <span class=\'q1\'>a</span> <= <span class=\'q1\'>b</span>', 'GT'); $floor = $FLOOR = !$this->interactive ? 'FLOOR' : sprintf(Util::$dfnString, 'FLOOR(<span class=\'q1\'>a</span>)', 'FLOOR'); $min = $MIN = !$this->interactive ? 'MIN' : sprintf(Util::$dfnString, 'MIN(<span class=\'q1\'>a</span>, <span class=\'q1\'>b</span>)', 'MIN'); $max = $MAX = !$this->interactive ? 'MAX' : sprintf(Util::$dfnString, 'MAX(<span class=\'q1\'>a</span>, <span class=\'q1\'>b</span>)', 'MAX'); $pl = $PL = !$this->interactive ? 'PL' : sprintf(Util::$dfnString, 'LANG.level', 'PL'); // note the " ! return eval('return "' . $formula . '";'); } else { return eval('return ' . $formula . ';'); } } // since this function may be called recursively, there are cases, where the already evaluated string is tried to be evaled again, throwing parse errors // todo (med): also quit, if we replaced vars with non-interactive text if (strstr($formula, '</dfn>') || strstr($formula, '<!--')) { return $formula; } // hm, minor eval-issue. eval doesnt understand two operators without a space between them (eg. spelll: 18126) $formula = preg_replace('/(\\+|-|\\*|\\/)(\\+|-|\\*|\\/)/i', '\\1 \\2', $formula); // there should not be any letters without a leading $ return eval('return ' . $formula . ';'); }
protected function generateContent() { /***********/ /* Infobox */ /***********/ $infobox = $contrib = $groups = []; foreach (Lang::account('groups') as $idx => $key) { if ($idx >= 0 && $this->user['userGroups'] & 1 << $idx) { $groups[] = (!fMod(count($groups) + 1, 3) ? '[br]' : null) . Lang::account('groups', $idx); } } $infobox[] = Lang::user('joinDate') . Lang::main('colon') . '[tooltip name=joinDate]' . date('l, G:i:s', $this->user['joinDate']) . '[/tooltip][span class=tip tooltip=joinDate]' . date(Lang::main('dateFmtShort'), $this->user['joinDate']) . '[/span]'; $infobox[] = Lang::user('lastLogin') . Lang::main('colon') . '[tooltip name=lastLogin]' . date('l, G:i:s', $this->user['prevLogin']) . '[/tooltip][span class=tip tooltip=lastLogin]' . date(Lang::main('dateFmtShort'), $this->user['prevLogin']) . '[/span]'; $infobox[] = Lang::user('userGroups') . Lang::main('colon') . ($groups ? implode(', ', $groups) : Lang::account('groups', -1)); $infobox[] = Lang::user('consecVisits') . Lang::main('colon') . $this->user['consecutiveVisits']; $infobox[] = Util::ucFirst(Lang::main('siteRep')) . Lang::main('colon') . Lang::nf($this->user['sumRep']); // contrib -> [url=http://www.wowhead.com/client]Data uploads: n [small]([tooltip=tooltip_totaldatauploads]xx.y MB[/tooltip])[/small][/url] $co = DB::Aowow()->selectRow('SELECT COUNT(DISTINCT c.id) AS sum, SUM(IFNULL(cr.value, 0)) AS nRates FROM ?_comments c LEFT JOIN ?_comments_rates cr ON cr.commentId = c.id AND cr.userId <> 0 WHERE c.replyTo = 0 AND c.userId = ?d', $this->user['id']); if ($co['sum']) { $contrib[] = Lang::user('comments') . Lang::main('colon') . $co['sum'] . ($co['nRates'] ? ' [small]([tooltip=tooltip_totalratings]' . $co['nRates'] . '[/tooltip])[/small]' : null); } $ss = DB::Aowow()->selectRow('SELECT COUNT(*) AS sum, SUM(IF(status & ?d, 1, 0)) AS nSticky, SUM(IF(status & ?d, 0, 1)) AS nPending FROM ?_screenshots WHERE userIdOwner = ?d AND (status & ?d) = 0', CC_FLAG_STICKY, CC_FLAG_APPROVED, $this->user['id'], CC_FLAG_DELETED); if ($ss['sum']) { $buff = []; if ($ss['nSticky'] || $ss['nPending']) { if ($normal = $ss['sum'] - $ss['nSticky'] - $ss['nPending']) { $buff[] = '[tooltip=tooltip_normal]' . $normal . '[/tooltip]'; } if ($ss['nSticky']) { $buff[] = '[tooltip=tooltip_sticky]' . $ss['nSticky'] . '[/tooltip]'; } if ($ss['nPending']) { $buff[] = '[tooltip=tooltip_pending]' . $ss['nPending'] . '[/tooltip]'; } } $contrib[] = Lang::user('screenshots') . Lang::main('colon') . $ss['sum'] . ($buff ? ' [small](' . implode($buff, ' + ') . ')[/small]' : null); } $vi = DB::Aowow()->selectRow('SELECT COUNT(id) AS sum, SUM(IF(status & ?d, 1, 0)) AS nSticky, SUM(IF(status & ?d, 0, 1)) AS nPending FROM ?_videos WHERE userIdOwner = ?d AND (status & ?d) = 0', CC_FLAG_STICKY, CC_FLAG_APPROVED, $this->user['id'], CC_FLAG_DELETED); if ($vi['sum']) { $buff = []; if ($vi['nSticky'] || $vi['nPending']) { if ($normal = $vi['sum'] - $vi['nSticky'] - $vi['nPending']) { $buff[] = '[tooltip=tooltip_normal]' . $normal . '[/tooltip]'; } if ($vi['nSticky']) { $buff[] = '[tooltip=tooltip_sticky]' . $vi['nSticky'] . '[/tooltip]'; } if ($vi['nPending']) { $buff[] = '[tooltip=tooltip_pending]' . $vi['nPending'] . '[/tooltip]'; } } $contrib[] = Lang::user('videos') . Lang::main('colon') . $vi['sum'] . ($buff ? ' [small](' . implode($buff, ' + ') . ')[/small]' : null); } // contrib -> Forum posts: 5769 [small]([tooltip=topics]579[/tooltip] + [tooltip=replies]5190[/tooltip])[/small] $this->infobox = '[ul][li]' . implode('[/li][li]', $infobox) . '[/li][/ul]'; if ($contrib) { $this->contributions = '[ul][li]' . implode('[/li][li]', $contrib) . '[/li][/ul]'; } /****************/ /* Main Content */ /****************/ $this->name = $this->user['title'] ? $this->user['displayName'] . ' <' . $this->user['title'] . '>' : sprintf(Lang::user('profileTitle'), $this->user['displayName']); /**************/ /* Extra Tabs */ /**************/ $this->lvTabs = []; $this->forceTabs = true; // [unused] Site Achievements // Reputation changelog (params only for comment-events) if ($repData = DB::Aowow()->select('SELECT action, amount, date AS \'when\', IF(action IN (3, 4, 5), sourceA, 0) AS param FROM ?_account_reputation WHERE userId = ?d', $this->user['id'])) { foreach ($repData as &$r) { $r['when'] = date(Util::$dateFormatInternal, $r['when']); } $this->lvTabs[] = ['reputationhistory', ['data' => $repData]]; } // Comments if ($_ = CommunityContent::getCommentPreviews(['user' => $this->user['id'], 'replies' => false], $nFound)) { $tabData = array('data' => $_, 'hiddenCols' => ['author'], 'onBeforeCreate' => '$Listview.funcBox.beforeUserComments', '_totalCount' => $nFound); if ($nFound > CFG_SQL_LIMIT_DEFAULT) { $tabData['name'] = '$LANG.tab_latestcomments'; $tabData['note'] = '$$WH.sprintf(LANG.lvnote_usercomments, ' . $nFound . ')'; } $this->lvTabs[] = ['commentpreview', $tabData]; } // Comment Replies if ($_ = CommunityContent::getCommentPreviews(['user' => $this->user['id'], 'replies' => true], $nFound)) { $tabData = array('data' => $_, 'hiddenCols' => ['author'], 'onBeforeCreate' => '$Listview.funcBox.beforeUserComments', '_totalCount' => $nFound); if ($nFound > CFG_SQL_LIMIT_DEFAULT) { $tabData['name'] = '$LANG.tab_latestreplies'; $tabData['note'] = '$$WH.sprintf(LANG.lvnote_userreplies, ' . $nFound . ')'; } $this->lvTabs[] = ['replypreview', $tabData]; } // Screenshots if ($_ = CommunityContent::getScreenshots(-$this->user['id'], 0, $nFound)) { $tabData = array('data' => $_, '_totalCount' => $nFound); if ($nFound > CFG_SQL_LIMIT_DEFAULT) { $tabData['name'] = '$LANG.tab_latestscreenshots'; $tabData['note'] = '$$WH.sprintf(LANG.lvnote_userscreenshots, ' . $nFound . ')'; } $this->lvTabs[] = ['screenshot', $tabData]; } // Videos if ($_ = CommunityContent::getVideos(-$this->user['id'], 0, $nFound)) { $tabData = array('data' => $_, '_totalCount' => $nFound); if ($nFound > CFG_SQL_LIMIT_DEFAULT) { $tabData['name'] = '$LANG.tab_latestvideos'; $tabData['note'] = '$$WH.sprintf(LANG.lvnote_uservideos, ' . $nFound . ')'; } $this->lvTabs[] = ['video', $tabData]; } // forum -> latest topics [unused] // forum -> latest replies [unused] // Characters [todo] $this->user['characterData'] = []; /* us_addCharactersTab([ { id:763, "name":"Lilywhite", "achievementpoints":"0", "guild":"whatever", "guildrank":"0", "realm":"draenor", "realmname":"Draenor", "battlegroup":"cyclone", "battlegroupname":"Cyclone", "region":"us", "level":"10", "race":"7", "gender":"0", "classs":"1", "faction":"0", "gearscore":"0", "talenttree1":"0", "talenttree2":"0", "talenttree3":"0", "talentspec":0, "published":1, "pinned":0 } ]); */ // Profiles [todo] $this->user['profileData'] = []; }
} } // item upgrade search if (isset($this->redButtons[BUTTON_UPGRADE])) { if ($b = $this->redButtons[BUTTON_UPGRADE]) { echo '<a href="javascript:;" class="button-red" onclick="this.blur(); pr_showClassPresetMenu(this, ' . $this->typeId . ', ', $b['class'] . ', ' . $b['slot'] . ', event);"><em><b><i>' . Lang::main('findUpgrades') . '</i></b><span>' . Lang::main('findUpgrades') . '</span></em></a>'; } else { echo '<a href="javascript:;" class="button-red button-red-disabled"><em><b><i>' . Lang::main('findUpgrades') . '</i></b><span>' . Lang::main('findUpgrades') . '</span></em></a>'; } } // goto: talent calculator if (isset($this->redButtons[BUTTON_TALENT])) { if ($b = $this->redButtons[BUTTON_TALENT]) { echo '<a href="' . $b['href'] . '" class="button-red"><em><b><i>' . ($b['pet'] ? Lang::main('petCalc') : Lang::main('talentCalc')) . '</i></b><span>' . ($b['pet'] ? Lang::main('petCalc') : Lang::main('talentCalc')) . '</span></em></a>'; } else { echo '<a href="javascript:;" class="button-red button-red-disabled"><em><b><i>{if $b.pet}' . Lang::main('petCalc') . 'else:' . Lang::main('talentCalc') . 'endif;</i></b><span>{if $b.pet}' . Lang::main('petCalc') . 'else:' . Lang::main('talentCalc') . 'endif;</span></em></a>'; } } // goto: (sub-)forum if (isset($this->redButtons[BUTTON_FORUM])) { if ($b = $this->redButtons[BUTTON_FORUM]) { echo '<a href="' . $b['href'] . '" class="button-red"><em><b><i>' . Lang::main('forum') . '</i></b><span>' . Lang::main('forum') . '</span></em></a>'; } else { echo '<a href="javascript:;" class="button-red button-red-disabled"><em><b><i>' . Lang::main('forum') . '</i></b><span>' . Lang::main('forum') . '</span></em></a>'; } } // equip item on pinned character if (isset($this->redButtons[BUTTON_EQUIP])) { echo '<div id="equip-pinned-button"></div>'; /* content is added by jScript */ }
protected function generateTitle() { array_unshift($this->title, Util::ucFirst(Lang::main('_cpHead'))); }
protected function handleReplyEdit() { if (!User::canComment()) { return 'You are not allowed to reply.'; } else { if (!$this->_post['replyId'] || !$this->_post['commentId']) { return Lang::main('genericError'); } else { if (!$this->_post['body'] || mb_strlen($this->_post['body']) < self::REPLY_LENGTH_MIN || mb_strlen($this->_post['body']) > self::REPLY_LENGTH_MAX) { return 'Your reply has ' . mb_strlen($this->_post['body']) . ' characters and must have at least ' . self::REPLY_LENGTH_MIN . ' and at most ' . self::REPLY_LENGTH_MAX . '.'; } } } if (DB::Aowow()->query('UPDATE ?_comments SET body = ?, editUserId = ?d, editDate = UNIX_TIMESTAMP(), editCount = editCount + 1 WHERE id = ?d AND replyTo = ?d{ AND userId = ?d}', $this->_post['body'], User::$id, $this->_post['replyId'], $this->_post['commentId'], User::isInGroup(U_GROUP_MODERATOR) ? DBSIMPLE_SKIP : User::$id)) { return Util::toJSON(CommunityContent::getCommentReplies($this->_post['commentId'])); } else { return Lang::main('genericError'); } }
protected function generateContent() { $this->addJS('?data=zones&locale=' . User::$localeId . '&t=' . $_SESSION['dataKey']); /***********/ /* Infobox */ /***********/ $infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags')); // Quartermaster if any if ($ids = $this->subject->getField('qmNpcIds')) { $this->extendGlobalIds(TYPE_NPC, $ids); $qmStr = Lang::faction('quartermaster') . Lang::main('colon'); if (count($ids) == 1) { $qmStr .= '[npc=' . $ids[0] . ']'; } else { if (count($ids) > 1) { $qmStr .= '[ul]'; foreach ($ids as $id) { $qmStr .= '[li][npc=' . $id . '][/li]'; } $qmStr .= '[/ul]'; } } $infobox[] = $qmStr; } // side if any if ($_ = $this->subject->getField('side')) { $infobox[] = Lang::main('side') . Lang::main('colon') . '[span class=icon-' . ($_ == 1 ? 'alliance' : 'horde') . ']' . Lang::game('si', $_) . '[/span]'; } /****************/ /* Main Content */ /****************/ $this->extraText = ''; $this->infobox = $infobox ? '[ul][li]' . implode('[/li][li]', $infobox) . '[/li][/ul]' : null; $this->redButtons = array(BUTTON_WOWHEAD => true, BUTTON_LINKS => true); // Spillover Effects /* todo (low): also check on reputation_spillover_template (but its data is identical to calculation below $rst = DB::World()->selectRow('SELECT CONCAT_WS(" ", faction1, faction2, faction3, faction4) AS faction, CONCAT_WS(" ", rate_1, rate_2, rate_3, rate_4) AS rate, CONCAT_WS(" ", rank_1, rank_2, rank_3, rank_4) AS rank FROM reputation_spillover_template WHERE faction = ?d', $this->typeId); */ $conditions = array(['id', $this->typeId, '!'], ['repIdx', -1, '!']); if ($p = $this->subject->getField('parentFactionId')) { // linked via parent $conditions[] = ['OR', ['id', $p], ['parentFactionId', $p]]; } else { // self as parent $conditions[] = ['parentFactionId', $this->typeId]; } $spillover = new FactionList($conditions); $this->extendGlobalData($spillover->getJSGlobals()); $buff = ''; foreach ($spillover->iterate() as $spillId => $__) { if ($val = $spillover->getField('spilloverRateIn') * $this->subject->getField('spilloverRateOut') * 100) { $buff .= '[tr][td][faction=' . $spillId . '][/td][td][span class=q' . ($val > 0 ? '2]+' : '10]') . $val . '%[/span][/td][td]' . Lang::game('rep', $spillover->getField('spilloverMaxRank')) . '[/td][/tr]'; } } if ($buff) { $this->extraText .= '[h3 class=clear]' . Lang::faction('spillover') . '[/h3][div margin=15px]' . Lang::faction('spilloverDesc') . '[/div][table class=grid width=400px][tr][td width=150px][b]' . Util::ucFirst(Lang::game('faction')) . '[/b][/td][td width=100px][b]' . Lang::spell('_value') . '[/b][/td][td width=150px][b]' . Lang::faction('maxStanding') . '[/b][/td][/tr]' . $buff . '[/table]'; } // reward rates (ultimately this should be calculated into each reward display) if ($rates = DB::World()->selectRow('SELECT * FROM reputation_reward_rate WHERE faction = ?d', $this->typeId)) { $buff = ''; foreach ($rates as $k => $v) { if ($v == 1) { continue; } switch ($k) { case 'quest_rate': $buff .= '[tr][td]' . Lang::game('quests') . Lang::main('colon') . '[/td]'; break; case 'quest_daily_rate': $buff .= '[tr][td]' . Lang::game('quests') . ' (' . Lang::quest('daily') . ')' . Lang::main('colon') . '[/td]'; break; case 'quest_weekly_rate': $buff .= '[tr][td]' . Lang::game('quests') . ' (' . Lang::quest('weekly') . ')' . Lang::main('colon') . '[/td]'; break; case 'quest_monthly_rate': $buff .= '[tr][td]' . Lang::game('quests') . ' (' . Lang::quest('monthly') . ')' . Lang::main('colon') . '[/td]'; break; case 'creature_rate': $buff .= '[tr][td]' . Lang::game('npcs') . Lang::main('colon') . '[/td]'; break; case 'spell_rate': $buff .= '[tr][td]' . Lang::game('spells') . Lang::main('colon') . '[/td]'; break; } $buff .= '[td width=35px align=right][span class=q' . ($v < 1 ? '10]' : '2]+') . intVal(($v - 1) * 100) . '%[/span][/td][/tr]'; } if ($buff) { $this->extraText .= '[h3 class=clear]' . Lang::faction('customRewRate') . '[/h3][table]' . $buff . '[/table]'; } } // factionchange-equivalent if ($pendant = DB::World()->selectCell('SELECT IF(horde_id = ?d, alliance_id, -horde_id) FROM player_factionchange_reputations WHERE alliance_id = ?d OR horde_id = ?d', $this->typeId, $this->typeId, $this->typeId)) { $altFac = new FactionList(array(['id', abs($pendant)])); if (!$altFac->error) { $this->transfer = sprintf(Lang::faction('_transfer'), $altFac->id, $altFac->getField('name', true), $pendant > 0 ? 'alliance' : 'horde', $pendant > 0 ? Lang::game('si', 1) : Lang::game('si', 2)); } } /**************/ /* Extra Tabs */ /**************/ // tab: items $items = new ItemList(array(['requiredFaction', $this->typeId])); if (!$items->error) { $this->extendGlobalData($items->getJSGlobals(GLOBALINFO_SELF)); $tabData = array('data' => array_values($items->getListviewData()), 'extraCols' => '$_', 'sort' => ['standing', 'name']); if ($items->getMatches() > CFG_SQL_LIMIT_DEFAULT) { $tabData['note'] = sprintf(Util::$filterResultString, '?items&filter=cr=17;crs=' . $this->typeId . ';crv=0'); } $this->lvTabs[] = ['item', $tabData, 'itemStandingCol']; } // tab: creatures with onKill reputation if ($this->subject->getField('reputationIndex') != -1) { // inherit siblings/children from $spillover $cRep = DB::World()->selectCol('SELECT DISTINCT creature_id AS ARRAY_KEY, qty FROM ( SELECT creature_id, RewOnKillRepValue1 as qty FROM creature_onkill_reputation WHERE RewOnKillRepValue1 > 0 AND (RewOnKillRepFaction1 = ?d{ OR (RewOnKillRepFaction1 IN (?a) AND IsTeamAward1 <> 0)}) UNION SELECT creature_id, RewOnKillRepValue2 as qty FROM creature_onkill_reputation WHERE RewOnKillRepValue2 > 0 AND (RewOnKillRepFaction2 = ?d{ OR (RewOnKillRepFaction2 IN (?a) AND IsTeamAward2 <> 0)}) ) x', $this->typeId, $spillover->getFoundIDs() ?: DBSIMPLE_SKIP, $this->typeId, $spillover->getFoundIDs() ?: DBSIMPLE_SKIP); if ($cRep) { $killCreatures = new CreatureList(array(['id', array_keys($cRep)])); if (!$killCreatures->error) { $data = $killCreatures->getListviewData(); foreach ($data as $id => &$d) { $d['reputation'] = $cRep[$id]; } $tabData = array('data' => array_values($data), 'extraCols' => '$_', 'sort' => ['-reputation', 'name']); if ($killCreatures->getMatches() > CFG_SQL_LIMIT_DEFAULT) { $tabData['note'] = sprintf(Util::$filterResultString, '?npcs&filter=cr=42;crs=' . $this->typeId . ';crv=0'); } $this->lvTabs[] = ['creature', $tabData, 'npcRepCol']; } } } // tab: members if ($_ = $this->subject->getField('templateIds')) { $members = new CreatureList(array(['faction', $_])); if (!$members->error) { $tabData = array('data' => array_values($members->getListviewData()), 'id' => 'member', 'name' => '$LANG.tab_members'); if ($members->getMatches() > CFG_SQL_LIMIT_DEFAULT) { $tabData['note'] = sprintf(Util::$filterResultString, '?npcs&filter=cr=3;crs=' . $this->typeId . ';crv=0'); } $this->lvTabs[] = ['creature', $tabData]; } } // tab: objects if ($_ = $this->subject->getField('templateIds')) { $objects = new GameObjectList(array(['faction', $_])); if (!$objects->error) { $this->lvTabs[] = ['object', ['data' => array_values($objects->getListviewData())]]; } } // tab: quests $conditions = array(['AND', ['rewardFactionId1', $this->typeId], ['rewardFactionValue1', 0, '>']], ['AND', ['rewardFactionId2', $this->typeId], ['rewardFactionValue2', 0, '>']], ['AND', ['rewardFactionId3', $this->typeId], ['rewardFactionValue3', 0, '>']], ['AND', ['rewardFactionId4', $this->typeId], ['rewardFactionValue4', 0, '>']], ['AND', ['rewardFactionId5', $this->typeId], ['rewardFactionValue5', 0, '>']], 'OR'); $quests = new QuestList($conditions); if (!$quests->error) { $this->extendGlobalData($quests->getJSGlobals(GLOBALINFO_ANY)); $tabData = array('data' => array_values($quests->getListviewData($this->typeId)), 'extraCols' => '$_'); if ($quests->getMatches() > CFG_SQL_LIMIT_DEFAULT) { $tabData['note'] = sprintf(Util::$filterResultString, '?quests&filter=cr=1;crs=' . $this->typeId . ';crv=0'); } $this->lvTabs[] = ['quest', $tabData, 'questRepCol']; } // tab: achievements $conditions = array(['ac.type', ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION], ['ac.value1', $this->typeId]); $acvs = new AchievementList($conditions); if (!$acvs->error) { $this->extendGlobalData($acvs->getJSGlobals(GLOBALINFO_ANY)); $this->lvTabs[] = ['achievement', array('data' => array_values($acvs->getListviewData()), 'id' => 'criteria-of', 'name' => '$LANG.tab_criteriaof', 'visibleCols' => ['category'])]; } }
private function createEffects(&$infobox, &$redButtons) { // proc data .. maybe use more information..? $procData = DB::World()->selectRow('SELECT IF(ppmRate > 0, -ppmRate, customChance) AS chance, cooldown FROM spell_proc_event WHERE entry = ?d', $this->typeId); if (!isset($procData['cooldown'])) { $procData['cooldown'] = 0; } $effects = []; $spellIdx = array_unique(array_merge($this->subject->canTriggerSpell(), $this->subject->canTeachSpell())); $itemIdx = $this->subject->canCreateItem(); // Iterate through all effects: for ($i = 1; $i < 4; $i++) { if ($this->subject->getField('effect' . $i . 'Id') <= 0) { continue; } $effId = (int) $this->subject->getField('effect' . $i . 'Id'); $effMV = (int) $this->subject->getField('effect' . $i . 'MiscValue'); $effBP = (int) $this->subject->getField('effect' . $i . 'BasePoints'); $effDS = (int) $this->subject->getField('effect' . $i . 'DieSides'); $effRPPL = $this->subject->getField('effect' . $i . 'RealPointsPerLevel'); $effAura = (int) $this->subject->getField('effect' . $i . 'AuraId'); $foo =& $effects[]; // Icons: // .. from item if (in_array($i, $itemIdx)) { $_ = $this->subject->getField('effect' . $i . 'CreateItemId'); foreach ($this->subject->relItems->iterate() as $itemId => $__) { if ($itemId != $_) { continue; } $foo['icon'] = array('id' => $this->subject->relItems->id, 'name' => $this->subject->relItems->getField('name', true), 'quality' => $this->subject->relItems->getField('quality'), 'count' => $effDS + $effBP, 'icon' => $this->subject->relItems->getField('iconString')); break; } if ($effDS > 1) { $foo['icon']['count'] = "'" . ($effBP + 1) . '-' . $foo['icon']['count'] . "'"; } } else { if (in_array($i, $spellIdx) || $effId == 133) { $_ = $this->subject->getField('effect' . $i . 'TriggerSpell'); if (!$_) { $_ = $this->subject->getField('effect' . $i . 'MiscValue'); } $trig = new SpellList(array(['s.id', (int) $_])); $foo['icon'] = array('id' => $_, 'name' => $trig->error ? Util::ucFirst(Lang::game('spell')) . ' #' . $_ : $trig->getField('name', true), 'count' => 0); $this->extendGlobalData($trig->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED)); } } // Effect Name $foo['name'] = (User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, 'EffectId: ' . $effId, Util::$spellEffectStrings[$effId]) : Util::$spellEffectStrings[$effId]) . Lang::main('colon'); if ($this->subject->getField('effect' . $i . 'RadiusMax') > 0) { $foo['radius'] = $this->subject->getField('effect' . $i . 'RadiusMax'); } if (!in_array($i, $itemIdx) && !in_array($i, $spellIdx) && !in_array($effAura, [225, 227])) { $foo['value'] = ($effDS && $effDS != 1 ? $effBP + 1 . Lang::game('valueDelim') : null) . ($effBP + $effDS); } if ($effRPPL != 0) { $foo['value'] = (isset($foo['value']) ? $foo['value'] : '0') . sprintf(Lang::spell('costPerLevel'), $effRPPL); } if ($this->subject->getField('effect' . $i . 'Periode') > 0) { $foo['interval'] = Util::formatTime($this->subject->getField('effect' . $i . 'Periode')); } if ($_ = $this->subject->getField('effect' . $i . 'Mechanic')) { $foo['mechanic'] = Lang::game('me', $_); } if (!empty($procData['chance'])) { $foo['procData'] = array($procData['chance'], $procData['cooldown'] ? Util::formatTime($procData['cooldown'] * 1000, true) : null); } else { if (in_array($i, $this->subject->canTriggerSpell()) && $this->subject->getField('procChance')) { $foo['procData'] = array($this->subject->getField('procChance'), $procData['cooldown'] ? Util::formatTime($procData['cooldown'] * 1000, true) : null); } } // parse masks and indizes switch ($effId) { case 8: // Power Drain // Power Drain case 30: // Energize // Energize case 137: // Energize Pct $_ = Lang::spell('powerTypes', $effMV); if ($_ && User::isInGroup(U_GROUP_EMPLOYEE)) { $_ = sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_); } else { if (!$_) { $_ = $effMV; } } if ($effMV == POWER_RAGE || $effMV == POWER_RUNIC_POWER) { $foo['value'] = ($effDS && $effDS != 1 ? ($effBP + 1) / 10 . Lang::game('valueDelim') : null) . ($effBP + $effDS) / 10; } $foo['name'] .= ' (' . $_ . ')'; break; case 16: // QuestComplete if ($_ = QuestList::getName($effMV)) { $foo['name'] .= '(<a href="?quest=' . $effMV . '">' . $_ . '</a>)'; } else { $foo['name'] .= Util::ucFirst(Lang::game('quest')) . ' #' . $effMV; } break; case 28: // Summon // Summon case 90: // Kill Credit // Kill Credit case 134: // Kill Credit2 $_ = Lang::game('npc') . ' #' . $effMV; if ($summon = $this->subject->getModelInfo($this->typeId, $i)) { $_ = $summon['typeId'] ? ' (<a href="?npc=' . $summon['typeId'] . '">' . $summon['displayName'] . '</a>)' : ' (#0)'; $redButtons[BUTTON_VIEW3D] = ['type' => TYPE_NPC, 'displayId' => $summon['displayId']]; } $foo['name'] .= $_; break; case 33: // Open Lock $_ = $effMV ? Lang::spell('lockType', $effMV) : $effMV; if ($_ && User::isInGroup(U_GROUP_EMPLOYEE)) { $_ = sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_); } else { if (!$_) { $_ = $effMV; } } $foo['name'] .= ' (' . $_ . ')'; break; case 53: // Enchant Item Perm // Enchant Item Perm case 54: // Enchant Item Temp // Enchant Item Temp case 92: // Enchant Held Item // Enchant Held Item case 156: // Enchant Item Prismatic if ($_ = DB::Aowow()->selectRow('SELECT * FROM ?_itemenchantment WHERE id = ?d', $effMV)) { $foo['name'] .= ' (<a href="?enchantment=' . $effMV . '" class="q2">' . Util::localizedString($_, 'name') . '</a>)'; } else { $foo['name'] .= ' #' . $effMV; } break; case 38: // Dispel [miscValue => Types] // Dispel [miscValue => Types] case 126: // Steal Aura $_ = Lang::game('dt', $effMV); if ($_ && User::isInGroup(U_GROUP_EMPLOYEE)) { $_ = sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_); } else { if (!$_) { $_ = $effMV; } } $foo['name'] .= ' (' . $_ . ')'; break; case 39: // Learn Language $_ = Lang::game('languages', $effMV); if ($_ && User::isInGroup(U_GROUP_EMPLOYEE)) { $_ = sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_); } else { if (!$_) { $_ = $effMV; } } $foo['name'] .= ' (' . $_ . ')'; break; case 50: // Trans Door // Trans Door case 76: // Summon Object (Wild) // case 86: // Activate Object // Summon Object (Wild) // case 86: // Activate Object case 104: // Summon Object (slot 1) // Summon Object (slot 1) case 105: // Summon Object (slot 2) // Summon Object (slot 2) case 106: // Summon Object (slot 3) // Summon Object (slot 3) case 107: // Summon Object (slot 4) $_ = Util::ucFirst(Lang::game('object')) . ' #' . $effMV; if ($summon = $this->subject->getModelInfo($this->typeId, $i)) { $_ = $summon['typeId'] ? ' (<a href="?object=' . $summon['typeId'] . '">' . $summon['displayName'] . '</a>)' : ' (#0)'; $redButtons[BUTTON_VIEW3D] = ['type' => TYPE_OBJECT, 'displayId' => $summon['displayId']]; } $foo['name'] .= $_; break; case 74: // Apply Glyph if ($_ = DB::Aowow()->selectCell('SELECT spellId FROM ?_glyphproperties WHERE id = ?d', $effMV)) { if ($n = SpellList::getName($_)) { $foo['name'] .= '(<a href="?spell=' . $_ . '">' . $n . '</a>)'; } else { $foo['name'] .= Util::ucFirst(Lang::game('spell')) . ' #' . $effMV; } } else { $foo['name'] .= ' #' . $effMV; } break; case 95: // Skinning switch ($effMV) { case 0: $_ = Lang::game('ct', 1) . ', ' . Lang::game('ct', 2); break; // Beast, Dragonkin // Beast, Dragonkin case 1: case 2: $_ = Lang::game('ct', 4); break; // Elemental (nature based, earth based) // Elemental (nature based, earth based) case 3: $_ = Lang::game('ct', 9); break; // Mechanic // Mechanic default: $_ = ''; } if (User::isInGroup(U_GROUP_EMPLOYEE)) { $_ = sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_); } else { $_ = $effMV; } $foo['name'] .= ' (' . $_ . ')'; break; case 108: // Dispel Mechanic $_ = Lang::game('me', $effMV); if ($_ && User::isInGroup(U_GROUP_EMPLOYEE)) { $_ = sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_); } else { if (!$_) { $_ = $effMV; } } $foo['name'] .= ' (' . $_ . ')'; break; case 118: // Require Skill if ($_ = SkillList::getName($effMV)) { $foo['name'] .= '(<a href="?skill=' . $effMV . '">' . $_ . '</a>)'; } else { $foo['name'] .= Util::ucFirst(Lang::game('skill')) . ' #' . $effMV; } break; case 146: // Activate Rune $_ = Lang::spell('powerRunes', $effMV); if ($_ && User::isInGroup(U_GROUP_EMPLOYEE)) { $_ = sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_); } else { if (!$_) { $_ = $effMV; } } $foo['name'] .= ' (' . $_ . ')'; break; case 123: // Send Taxi - effMV is taxiPathId. We only use paths for flightmasters for now, so spell-triggered paths are not in the table // Send Taxi - effMV is taxiPathId. We only use paths for flightmasters for now, so spell-triggered paths are not in the table default: if (($effMV || $effId == 97) && $effId != 155) { $foo['name'] .= ' (' . $effMV . ')'; } // Aura // Aura case 6: // Simple // Simple case 27: // AA Persistent // AA Persistent case 35: // AA Party // AA Party case 65: // AA Raid // AA Raid case 119: // AA Pet // AA Pet case 128: // AA Friend // AA Friend case 129: // AA Enemy // AA Enemy case 143: if ($effAura > 0 && isset(Util::$spellAuraStrings[$effAura])) { $foo['name'] .= User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, 'AuraId: ' . $effAura, Util::$spellAuraStrings[$effAura]) : Util::$spellAuraStrings[$effAura]; $bar = $effMV; switch ($effAura) { case 17: // Mod Stealth Detection if ($_ = Lang::spell('stealthType', $effMV)) { $bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_) : $_; } break; case 19: // Mod Invisibility Detection if ($_ = Lang::spell('invisibilityType', $effMV)) { $bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_) : $_; } break; case 24: // Periodic Energize // Periodic Energize case 21: // Obsolete Mod Power // Obsolete Mod Power case 35: // Mod Increase Power // Mod Increase Power case 85: // Mod Power Regeneration // Mod Power Regeneration case 110: // Mod Power Regeneration Pct if ($_ = Lang::spell('powerTypes', $effMV)) { $bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_) : $_; } break; case 29: // Mod Stat // Mod Stat case 80: // Mod Stat % // Mod Stat % case 137: // Mod Total Stat % // Mod Total Stat % case 175: // Mod Spell Healing Of Stat Percent // Mod Spell Healing Of Stat Percent case 212: // Mod Ranged Attack Power Of Stat Percent // Mod Ranged Attack Power Of Stat Percent case 219: // Mod Mana Regeneration from Stat // Mod Mana Regeneration from Stat case 268: // Mod Attack Power Of Stat Percent $mask = $effMV == -1 ? 0x1f : 1 << $effMV; $_ = []; for ($j = 0; $j < 5; $j++) { if ($mask & 1 << $j) { $_[] = Lang::game('stats', $j); } } if ($_ = implode(', ', $_)) { } $bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_) : $_; break; case 36: // Shapeshift if ($st = $this->subject->getModelInfo($this->typeId, $i)) { $redButtons[BUTTON_VIEW3D] = array('type' => TYPE_NPC, 'displayId' => $st['displayId']); if ($st['creatureType'] > 0) { $infobox[] = Lang::game('type') . Lang::main('colon') . Lang::game('ct', $st['creatureType']); } if ($_ = $st['displayName']) { $bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_) : $_; } } break; case 37: // Effect immunity if (isset(Util::$spellEffectStrings[$effMV])) { $_ = Util::$spellEffectStrings[$effMV]; $bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_) : $_; } break; case 38: // Aura immunity if (isset(Util::$spellAuraStrings[$effMV])) { $_ = Util::$spellAuraStrings[$effMV]; $bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_) : $_; } break; case 41: // Dispel Immunity // Dispel Immunity case 178: // Mod Debuff Resistance // Mod Debuff Resistance case 245: // Mod Aura Duration By Dispel if ($_ = Lang::game('dt', $effMV)) { $bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_) : $_; } break; case 44: // Track Creature if ($_ = Lang::game('ct', $effMV)) { $bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_) : $_; } break; case 45: // Track Resource if ($_ = Lang::spell('lockType', $effMV)) { $bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_) : $_; } break; case 75: // Language if ($_ = Lang::game('languages', $effMV)) { $bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_) : $_; } break; case 77: // Mechanic Immunity // Mechanic Immunity case 117: // Mod Mechanic Resistance // Mod Mechanic Resistance case 232: // Mod Mechanic Duration // Mod Mechanic Duration case 234: // Mod Mechanic Duration (no stack) // Mod Mechanic Duration (no stack) case 255: // Mod Mechanic Damage Taken Pct // Mod Mechanic Damage Taken Pct case 276: // Mod Mechanic Damage Done Percent if ($_ = Lang::game('me', $effMV)) { $bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . Util::asHex($effMV), $_) : $_; } break; case 147: // Mechanic Immunity Mask $_ = []; foreach (Lang::game('me') as $k => $str) { if ($effMV & 1 << $k - 1) { $_[] = $str; } } if ($_ = implode(', ', $_)) { $bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . Util::asHex($effMV), $_) : $_; } break; case 10: // Mod Threat // Mod Threat case 13: // Mod Damage Done // Mod Damage Done case 14: // Mod Damage Taken // Mod Damage Taken case 22: // Mod Resistance // Mod Resistance case 39: // School Immunity // School Immunity case 40: // Damage Immunity // Damage Immunity case 50: // Mod Critical Healing Amount // Mod Critical Healing Amount case 57: // Mod Spell Crit Chance // Mod Spell Crit Chance case 69: // School Absorb // School Absorb case 71: // Mod Spell Crit Chance School // Mod Spell Crit Chance School case 72: // Mod Power Cost School Percent // Mod Power Cost School Percent case 73: // Mod Power Cost School Flat // Mod Power Cost School Flat case 74: // Reflect Spell School // Reflect Spell School case 79: // Mod Damage Done Pct // Mod Damage Done Pct case 81: // Split Damage Pct // Split Damage Pct case 83: // Mod Base Resistance // Mod Base Resistance case 87: // Mod Damage Taken Pct // Mod Damage Taken Pct case 97: // Mana Shield // Mana Shield case 101: // Mod Resistance Pct // Mod Resistance Pct case 115: // Mod Healing Taken // Mod Healing Taken case 118: // Mod Healing Taken Pct // Mod Healing Taken Pct case 123: // Mod Target Resistance // Mod Target Resistance case 135: // Mod Healing Done // Mod Healing Done case 136: // Mod Healing Done Pct // Mod Healing Done Pct case 142: // Mod Base Resistance Pct // Mod Base Resistance Pct case 143: // Mod Resistance Exclusive // Mod Resistance Exclusive case 149: // Reduce Pushback // Reduce Pushback case 163: // Mod Crit Damage Bonus // Mod Crit Damage Bonus case 174: // Mod Spell Damage Of Stat Percent // Mod Spell Damage Of Stat Percent case 182: // Mod Resistance Of Stat Percent // Mod Resistance Of Stat Percent case 186: // Mod Attacker Spell Hit Chance // Mod Attacker Spell Hit Chance case 194: // Mod Target Absorb School // Mod Target Absorb School case 195: // Mod Target Ability Absorb School // Mod Target Ability Absorb School case 199: // Mod Increases Spell Percent to Hit // Mod Increases Spell Percent to Hit case 229: // Mod AoE Damage Avoidance // Mod AoE Damage Avoidance case 271: // Mod Damage Percent Taken Form Caster // Mod Damage Percent Taken Form Caster case 310: // Mod Creature AoE Damage Avoidance if ($_ = Lang::getMagicSchools($effMV)) { $bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . Util::asHex($effMV), $_) : $_; } break; case 30: // Mod Skill // Mod Skill case 98: // Mod Skill Value if ($_ = SkillList::getName($effMV)) { $bar = ' (<a href="?skill=' . $effMV . '">' . SkillList::getName($effMV) . '</a>)'; } else { $bar = Lang::main('colon') . Util::ucFirst(Lang::game('skill')) . ' #' . $effMV; } break; case 107: // Flat Modifier // Flat Modifier case 108: // Pct Modifier if ($_ = Lang::spell('spellModOp', $effMV)) { $bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_) : $_; } break; case 189: // Mod Rating // Mod Rating case 220: // Combat Rating From Stat $_ = []; foreach (Lang::spell('combatRating') as $k => $str) { if (1 << $k & $effMV) { $_[] = $str; } } if ($_ = implode(', ', $_)) { $bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . Util::asHex($effMV), $_) : $_; } break; case 168: // Mod Damage Done Versus // Mod Damage Done Versus case 59: // Mod Damage Done Versus Creature // Mod Damage Done Versus Creature case 102: // Mod Melee Attack Power Versus // Mod Melee Attack Power Versus case 131: // Mod Ranged Attack Power Versus // Mod Ranged Attack Power Versus case 180: // Mod Spell Damage Versus $_ = []; foreach (Lang::game('ct') as $k => $str) { if ($effMV & 1 << $k - 1) { $_[] = $str; } } if ($_ = implode(', ', $_)) { $bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . Util::asHex($effMV), $_) : $_; } break; case 249: // Convert Rune $x = $this->subject->getField('effect' . $i . 'MiscValueB'); if ($_ = Lang::spell('powerRunes', $x)) { $bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $x, $_) : $_; } break; case 78: // Mounted // Mounted case 56: // Transform if ($transform = $this->subject->getModelInfo($this->typeId, $i)) { $redButtons[BUTTON_VIEW3D] = ['type' => TYPE_NPC, 'displayId' => $transform['displayId']]; $bar = $transform['typeId'] ? ' (<a href="?npc=' . $transform['typeId'] . '">' . $transform['displayName'] . '</a>)' : ' (#0)'; } else { $bar = Lang::main('colon') . Lang::game('npc') . ' #' . $effMV; } break; case 139: // Force Reaction $foo['value'] = sprintf(Util::$dfnString, $foo['value'], Lang::game('rep', $foo['value'])); // DO NOT BREAK // DO NOT BREAK case 190: // Mod Faction Reputation Gain $bar = ' (<a href="?faction=' . $effMV . '">' . FactionList::getName($effMV) . '</a>)'; break; // also breaks for 139 } $foo['name'] .= strstr($bar, 'href') || strstr($bar, '#') ? $bar : ($bar ? ' (' . $bar . ')' : null); if (in_array($effAura, [174, 220, 182])) { $foo['name'] .= ' [' . sprintf(Util::$dfnString, Lang::game('stats', $this->subject->getField('effect' . $i . 'MiscValueB')), $this->subject->getField('effect' . $i . 'MiscValueB')) . ']'; } else { if ($this->subject->getField('effect' . $i . 'MiscValueB') > 0) { $foo['name'] .= ' [' . $this->subject->getField('effect' . $i . 'MiscValueB') . ']'; } } } else { if ($effAura > 0) { $foo['name'] .= Lang::main('colon') . 'Unknown Aura (' . $effAura . ')'; } } break; } // cases where we dont want 'Value' to be displayed if (in_array($effAura, [11, 12, 36, 77]) || in_array($effId, []) || empty($foo['value'])) { unset($foo['value']); } } unset($foo); // clear reference return $effects; }
public function error() { $this->path = null; $this->tabId = null; $this->type = -99; // get error-article $this->typeId = 0; $this->title[] = Lang::main('errPageTitle'); $this->name = Lang::main('errPageTitle'); $this->addArticle(); Util::arraySumByKey($this->mysql, DB::Aowow()->getStatistics(), DB::World()->getStatistics()); $this->display('text-page-generic'); exit; }
protected function generateTitle() { if ($this->page == 'most-comments') { if ($this->category && in_array($this->category[0], [7, 30])) { array_unshift($this->title, sprintf(Lang::main('mostComments', 1), $this->category[0])); } else { array_unshift($this->title, Lang::main('mostComments', 0)); } } array_unshift($this->title, $this->name); }
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 = ' – <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, '!']; } 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()); } } }
protected function generateTitle() { array_unshift($this->title, $this->search, Lang::main('search')); }
public function renderTooltip() { $criteria = $this->getCriteria(); $tmp = []; $rows = []; $i = 0; foreach ($criteria as $_row) { if ($i++ % 2) { $tmp[] = $_row; } else { $rows[] = $_row; } } if ($tmp) { $rows = array_merge($rows, $tmp); } $description = $this->getField('description', true); $name = $this->getField('name', true); $criteria = ''; $i = 0; foreach ($rows as $crt) { $obj = (int) $crt['value1']; $qty = (int) $crt['value2']; // we could show them, but the tooltips are cluttered if ($crt['completionFlags'] & ACHIEVEMENT_CRITERIA_FLAG_HIDDEN && User::$perms <= 0) { continue; } $crtName = Util::localizedString($crt, 'name'); switch ($crt['type']) { // link to title - todo (low): crosslink case ACHIEVEMENT_CRITERIA_TYPE_EARNED_PVP_TITLE: $crtName = Util::ucFirst(Lang::game('title')) . Lang::main('colon') . $crtName; break; // link to quest // link to quest case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST: if (!$crtName) { $crtName = QuestList::getName($obj); } break; // link to spell (/w icon) // link to spell (/w icon) case ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET: case ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2: case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL: case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL: case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2: if (!$crtName) { $crtName = SpellList::getName($obj); } break; // link to item (/w icon) // link to item (/w icon) case ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM: case ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM: case ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM: case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM: if (!$crtName) { $crtName = ItemList::getName($obj); } break; // link to faction (/w target reputation) // link to faction (/w target reputation) case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION: if (!$crtName) { $crtName = FactionList::getName($obj); } break; } if ($crt['completionFlags'] & ACHIEVEMENT_CRITERIA_FLAG_MONEY_COUNTER) { $criteria .= '- ' . Util::jsEscape($crtName) . ' <span class="moneygold">' . number_format($crt['value2'] / 10000) . '</span><br />'; } else { $criteria .= '- ' . Util::jsEscape($crtName) . '<br />'; } if (++$i == round(count($rows) / 2)) { $criteria .= '</small></td><th class="q0" style="white-space: nowrap; text-align: left"><small>'; } } $x = '<table><tr><td><b class="q">'; $x .= Util::jsEscape($name); $x .= '</b></td></tr></table>'; if ($description || $criteria) { $x .= '<table><tr><td>'; } if ($description) { $x .= '<br />' . Util::jsEscape($description) . '<br />'; } if ($criteria) { $x .= '<br /><span class="q">' . Lang::achievement('criteria') . ':</span>'; $x .= '<table width="100%"><tr><td class="q0" style="white-space: nowrap"><small>' . $criteria . '</small></th></tr></table>'; } if ($description || $criteria) { $x .= '</td></tr></table>'; } return $x; }
?> /><label for="ma-1"><?php echo Lang::main('oneFilter'); ?> </label> </div> <div class="clear"></div> <div class="padded"> <input type="submit" value="<?php echo Lang::main('applyFilter'); ?> " /> <input type="reset" value="<?php echo Lang::main('resetForm'); ?> " /> </div> </form> <div class="pad"></div> </div> <script type="text/javascript">//<![CDATA[ fi_init('objects'); <?php foreach ($f['fi'] as $str) { echo ' ' . $str . "\n"; } ?>
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 . ':"..UnitGUID("player")..":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']")); $this->extendGlobalData($saList->getJSGlobals()); // tab: criteria of $refs = DB::Aowow()->SelectCol('SELECT refAchievementId FROM ?_achievementcriteria WHERE Type = ?d AND value1 = ?d', ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT, $this->typeId); if (!empty($refs)) { $coList = new AchievementList(array(['id', $refs])); $this->lvTabs[] = array('file' => 'achievement', 'data' => $coList->getListviewData(), 'params' => array('id' => 'criteria-of', 'name' => '$LANG.tab_criteriaof', 'visibleCols' => "\$['category']")); $this->extendGlobalData($coList->getJSGlobals()); } /*****************/ /* Criteria List */ /*****************/ $iconId = 1; $rightCol = []; foreach ($this->subject->getCriteria() as $i => $crt) { // hide hidden criteria for regular users (really do..?) // if (($crt['completionFlags'] & ACHIEVEMENT_CRITERIA_FLAG_HIDDEN) && User::$perms > 0) // continue; // alternative display option $displayMoney = $crt['completionFlags'] & ACHIEVEMENT_CRITERIA_FLAG_MONEY_COUNTER; $crtName = Util::localizedString($crt, 'name'); $tmp = array('id' => $crt['id'], 'name' => $crtName, 'type' => $crt['type']); $obj = (int) $crt['value1']; $qty = (int) $crt['value2']; switch ($crt['type']) { // link to npc case ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE: case ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE: $tmp['link'] = array('href' => '?npc=' . $obj, 'text' => $crtName); $tmp['extraText'] = Lang::achievement('slain'); break; // link to area (by map) // link to area (by map) case ACHIEVEMENT_CRITERIA_TYPE_WIN_BG: case ACHIEVEMENT_CRITERIA_TYPE_WIN_ARENA: case ACHIEVEMENT_CRITERIA_TYPE_PLAY_ARENA: case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND: case ACHIEVEMENT_CRITERIA_TYPE_DEATH_AT_MAP: if ($zoneId = DB::Aowow()->selectCell('SELECT id FROM ?_zones WHERE mapId = ? LIMIT 1', $obj)) { $tmp['link'] = array('href' => '?zone=' . $zoneId, 'text' => $crtName); } else { $tmp['extraText'] = $crtName; } break; // link to area // link to area case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE: case ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL_AT_AREA: $tmp['link'] = array('href' => '?zone=' . $obj, 'text' => $crtName); break; // link to skills // link to skills case ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL: case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL: case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS: case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LINE: $tmp['link'] = array('href' => '?skill=' . $obj, 'text' => $crtName); break; // link to class // link to class case ACHIEVEMENT_CRITERIA_TYPE_HK_CLASS: $tmp['link'] = array('href' => '?class=' . $obj, 'text' => $crtName); break; // link to race // link to race case ACHIEVEMENT_CRITERIA_TYPE_HK_RACE: $tmp['link'] = array('href' => '?race=' . $obj, 'text' => $crtName); break; // link to title - todo (low): crosslink // link to title - todo (low): crosslink case ACHIEVEMENT_CRITERIA_TYPE_EARNED_PVP_TITLE: $tmp['extraText'] = Util::ucFirst(Lang::game('title')) . Lang::main('colon') . $crtName; break; // link to achivement (/w icon) // link to achivement (/w icon) case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT: $tmp['link'] = array('href' => '?achievement=' . $obj, 'text' => $crtName); $tmp['icon'] = $iconId; $this->criteria['icons'][] = array('itr' => $iconId++, 'type' => 'g_achievements', 'id' => $obj); $this->extendGlobalIds(TYPE_ACHIEVEMENT, $obj); break; // link to quest // link to quest case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST: // $crtName = ; $tmp['link'] = array('href' => '?quest=' . $obj, 'text' => $crtName ?: QuestList::getName($obj)); break; // link to spell (/w icon) // link to spell (/w icon) case ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET: case ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2: case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL: case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL: case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2: $tmp['link'] = array('href' => '?spell=' . $obj, 'text' => $crtName ?: SpellList::getName($obj)); $this->extendGlobalIds(TYPE_SPELL, $obj); $tmp['icon'] = $iconId; $this->criteria['icons'][] = array('itr' => $iconId++, 'type' => 'g_spells', 'id' => $obj); break; // link to item (/w icon) // link to item (/w icon) case ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM: case ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM: case ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM: case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM: $crtItm = new ItemList(array(['i.id', $obj])); $tmp['link'] = array('href' => '?item=' . $obj, 'text' => $crtName ?: $crtItm->getField('name', true), 'quality' => $crtItm->getField('quality'), 'count' => $qty); $this->extendGlobalData($crtItm->getJSGlobals()); $tmp['icon'] = $iconId; $this->criteria['icons'][] = array('itr' => $iconId++, 'type' => 'g_items', 'id' => $obj, 'count' => $qty); break; // link to faction (/w target reputation) // link to faction (/w target reputation) case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION: $tmp['link'] = array('href' => '?faction=' . $obj, 'text' => $crtName ?: FactionList::getName($obj)); $tmp['extraText'] = ' (' . Lang::getReputationLevelForPoints($qty) . ')'; break; // link to GObject // link to GObject case ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT: case ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT: $tmp['link'] = array('href' => '?object=' . $obj, 'text' => $crtName); break; default: // Add a gold coin icon if required $tmp['extraText'] = $displayMoney ? Util::formatMoney($qty) : $crtName; break; } // If the right column if ($i % 2) { $this->criteria['data'][] = $tmp; } else { $rightCol[] = $tmp; } } // If you found the second column - merge data from it to the end of the main body if ($rightCol) { $this->criteria['data'] = array_merge($this->criteria['data'], $rightCol); } }