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() { $this->addCSS(['string' => '.announcement { margin: auto; max-width: 1200px; padding: 0px 15px 15px 15px }']); // load oneliner if ($_ = DB::Aowow()->selectRow('SELECT * FROM ?_home_oneliner WHERE active = 1 LIMIT 1')) { $this->oneliner = Util::jsEscape(Util::localizedString($_, 'text')); } // load news $this->news = DB::Aowow()->selectRow('SELECT id as ARRAY_KEY, n.* FROM ?_home_featuredbox n WHERE active = 1 ORDER BY id DESC LIMIT 1'); if (!$this->news) { return; } $this->news['text'] = Util::localizedString($this->news, 'text', true); if ($_ = (new Markup($this->news['text']))->parseGlobalsFromText()) { $this->extendGlobalData($_); } if (empty($this->news['bgImgUrl'])) { $this->news['bgImgUrl'] = STATIC_URL . '/images/' . User::$localeString . '/mainpage-bg-news.jpg'; } else { $this->news['bgImgUrl'] = strtr($this->news['bgImgUrl'], ['HOST_URL' => HOST_URL, 'STATIC_URL' => STATIC_URL]); } // load overlay links $this->news['overlays'] = DB::Aowow()->select('SELECT * FROM ?_home_featuredbox_overlay WHERE featureId = ?d', $this->news['id']); foreach ($this->news['overlays'] as &$o) { $o['title'] = Util::localizedString($o, 'title', true); $o['title'] = strtr($o['title'], ['HOST_URL' => HOST_URL, 'STATIC_URL' => STATIC_URL]); } }
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 static function getInfoBoxForFlags($flags) { $tmp = []; if ($flags & CUSTOM_DISABLED) { $tmp[] = '[tooltip name=disabledHint]' . Util::jsEscape(self::main('disabledHint')) . '[/tooltip][span class=tip tooltip=disabledHint]' . Util::jsEscape(self::main('disabled')) . '[/span]'; } if ($flags & CUSTOM_SERVERSIDE) { $tmp[] = '[tooltip name=serversideHint]' . Util::jsEscape(self::main('serversideHint')) . '[/tooltip][span class=tip tooltip=serversideHint]' . Util::jsEscape(self::main('serverside')) . '[/span]'; } if ($flags & CUSTOM_UNAVAILABLE) { $tmp[] = self::main('unavailable'); } if ($flags & CUSTOM_EXCLUDE_FOR_LISTVIEW && User::isInGroup(U_GROUP_STAFF)) { $tmp[] = '[tooltip name=excludedHint]This entry is excluded from lists and is not searchable.[/tooltip][span tooltip=excludedHint class="tip q10"]Hidden[/span]'; } return $tmp; }
<?php // link to wowhead if (isset($this->redButtons[BUTTON_WOWHEAD])) { if ($this->redButtons[BUTTON_WOWHEAD]) { echo '<a href="' . Util::$wowheadLink . '" class="button-red"><em><b><i>Wowhead</i></b><span>Wowhead</span></em></a>'; } else { echo '<a href="javascript:;" class="button-red button-red-disabled"><em><b><i>Wowhead</i></b><span>Wowhead</span></em></a>'; } } // ingame-links/markdown/ect if (isset($this->redButtons[BUTTON_LINKS])) { if ($b = $this->redButtons[BUTTON_LINKS]) { echo '<a href="javascript:;" id="open-links-button" class="button-red" onclick="this.blur(); Links.show({' . (isset($b['color']) ? "linkColor: '" . $b['color'] . "', " : null) . (isset($b['linkId']) ? "linkId: '" . $b['linkId'] . "', " : null) . "linkName: '" . Util::jsEscape(isset($b['name']) ? $b['name'] : $this->name) . "', type: " . $this->type . ', typeId: ' . $this->typeId . ' });"><em><b><i>' . Lang::main('links') . '</i></b><span>' . Lang::main('links') . '</span></em></a>'; } else { echo '<a href="javascript:;" id="open-links-button" class="button-red button-red-disabled"><em><b><i>' . Lang::main('links') . '</i></b><span>' . Lang::main('links') . '</span></em></a>'; } } // view in 3D if (isset($this->redButtons[BUTTON_VIEW3D])) { if ($b = $this->redButtons[BUTTON_VIEW3D]) { // json_encode puts property names in brackets wich is not cool with inline javascript $data = []; foreach ($b as $k => $v) { $data[] = $k . ': ' . json_encode($v, JSON_NUMERIC_CHECK); } echo '<a href="javascript:;" id="view3D-button" class="button-red" onclick="this.blur(); ModelViewer.show({' . implode(', ', $data) . '})"><em><b><i>' . Lang::main('view3D') . '</i></b><span>' . Lang::main('view3D') . '</span></em></a>'; } else { echo '<a href="javascript:;" id="view3D-button" class="button-red button-red-disabled"><em><b><i>' . Lang::main('view3D') . '</i></b><span>' . Lang::main('view3D') . '</span></em></a>'; } }
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; }
private function generateOpenSearch($asError = false) { // this one is funny: we want 10 results, ideally equally distributed over each type $foundTotal = 0; $limit = $this->maxResults; $result = array($this->search, [], [], [], [], [], [], []); foreach ($this->lvTabs as list($_, $_, $_, $osInfo)) { $foundTotal += $osInfo[2]; } if (!$foundTotal || $asError) { return '["' . Util::jsEscape($this->search) . '", []]'; } foreach ($this->lvTabs as list($_, $tabData, $_, $osInfo)) { $max = max(1, intVal($limit * $osInfo[2] / $foundTotal)); $limit -= $max; for ($i = 0; $i < $max; $i++) { $data = array_shift($tabData['data']); if (!$data) { break; } $hasQ = is_numeric($data['name'][0]) || $data['name'][0] == '@'; $result[1][] = ($hasQ ? mb_substr($data['name'], 1) : $data['name']) . $osInfo[1]; $result[3][] = HOST_URL . '/?' . Util::$typeStrings[$osInfo[0]] . '=' . $data['id']; $extra = [$osInfo[0], $data['id']]; // type, typeId if (isset($osInfo[3][$data['id']])) { $extra[] = $osInfo[3][$data['id']]; } // param1 if (isset($osInfo[4][$data['id']])) { $extra[] = $osInfo[4][$data['id']]; } // param2 $result[7][] = $extra; } if ($limit <= 0) { break; } } return Util::toJSON($result); }
<?php /* Util::jsEscape gets a bit greedy here */ if (!empty($this->article)) { ?> <div id="article-generic" class="left"></div> <script type="text/javascript">//<![CDATA[ Markup.printHtml("<?php echo strtr(Util::jsEscape($this->article['text']), ['scr\\"+\\"ipt' => 'scr"+"ipt']); ?> ", "article-generic", { <?php foreach ($this->article['params'] as $k => $v) { echo $k . ': ' . ($v[0] == '$' ? substr($v, 1) : "'" . $v . "'") . ",\n"; } ?> allow: Markup.CLASS_ADMIN, dbpage: true }); //]]></script> <div class="pad2"></div> <?php }
protected function generateTooltip($asError = false) { $x = '$WowheadPower.registerProfile(' . ($this->isCustom ? $this->profile : "'" . implode('.', $this->profile) . "'") . ', ' . User::$localeId . ', {'; if ($asError) { return $x . "});"; } @(include 'datasets/ProfilerExampleChar'); // tmp char data $name = $character['name']; $guild = $character['guild']; $gRankName = $character['guildrank']; $lvl = $character['level']; $ra = $character['race']; $cl = $character['classs']; $gender = $character['gender']; $desc = $character['description']; $title = (new TitleList(array(['id', $character['title']])))->getField($gender ? 'female' : 'male', true); if ($this->isCustom) { $name .= ' (Custom Profile)'; } else { if ($title) { $name = sprintf($title, $name); } } $x .= "\n"; $x .= "\tname_" . User::$localeString . ": '" . Util::jsEscape($name) . "',\n"; $x .= "\ttooltip_" . User::$localeString . ": '" . $this->subject->renderTooltip() . "',\n"; $x .= "\ticon: \$WH.g_getProfileIcon(" . $ra . ", " . $cl . ", " . $gender . ", " . $lvl . "),\n"; // (race, class, gender, level, iconOrId, 'medium') $x .= "});"; return $x; }
public function renderTooltip() { if (!$this->curTpl) { return null; } $title = Util::jsEscape($this->getField('name', true)); $level = $this->curTpl['level']; if ($level < 0) { $level = 0; } $x = ''; if ($level) { $level = sprintf(Lang::quest('questLevel'), $level); if ($this->curTpl['flags'] & QUEST_FLAG_DAILY) { // daily $level .= ' ' . Lang::quest('daily'); } $x .= '<table><tr><td><table width="100%"><tr><td><b class="q">' . $title . '</b></td><th><b class="q0">' . $level . '</b></th></tr></table></td></tr></table>'; } else { $x .= '<table><tr><td><b class="q">' . $title . '</b></td></tr></table>'; } $x .= '<table><tr><td><br />' . $this->parseText('objectives'); $xReq = ''; for ($i = 1; $i < 5; $i++) { $ot = $this->getField('objectiveText' . $i, true); $rng = $this->curTpl['reqNpcOrGo' . $i]; $rngQty = $this->curTpl['reqNpcOrGoCount' . $i]; if ($rngQty < 1 && (!$rng || $ot)) { continue; } if ($ot) { $name = $ot; } else { $name = $rng > 0 ? CreatureList::getName($rng) : GameObjectList::getName(-$rng); } $xReq .= '<br /> - ' . Util::jsEscape($name) . ($rngQty > 1 ? ' x ' . $rngQty : null); } for ($i = 1; $i < 7; $i++) { $ri = $this->curTpl['reqItemId' . $i]; $riQty = $this->curTpl['reqItemCount' . $i]; if (!$ri || $riQty < 1) { continue; } $xReq .= '<br /> - ' . Util::jsEscape(ItemList::getName($ri)) . ($riQty > 1 ? ' x ' . $riQty : null); } if ($et = $this->getField('end', true)) { $xReq .= '<br /> - ' . Util::jsEscape($et); } if ($_ = $this->getField('rewardOrReqMoney')) { if ($_ < 0) { $xReq .= '<br /> - ' . Lang::quest('money') . Lang::main('colon') . Util::formatMoney(abs($_)); } } if ($xReq) { $x .= '<br /><br /><span class="q">' . Lang::quest('requirements') . Lang::main('colon') . '</span>' . $xReq; } $x .= '</td></tr></table>'; return $x; }
protected function generateTooltip($asError = false) { if ($asError) { return '$WowheadPower.registerQuest(' . $this->typeId . ', ' . User::$localeId . ', {});'; } $x = '$WowheadPower.registerQuest(' . $this->typeId . ', ' . User::$localeId . ", {\n"; $x .= "\tname_" . User::$localeString . ": '" . Util::jsEscape($this->subject->getField('name', true)) . "',\n"; $x .= "\ttooltip_" . User::$localeString . ': \'' . $this->subject->renderTooltip() . "'"; if ($this->subject->isDaily()) { $x .= ",\n\tdaily: 1"; } $x .= "\n});"; return $x; }
protected function generateContent() { $this->addJS('?data=zones&locale=' . User::$localeId . '&t=' . $_SESSION['dataKey']); /***********/ /* Infobox */ /***********/ $infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags')); // City if ($this->subject->getField('flags') & 0x8 && !$this->subject->getField('parentArea')) { $infobox[] = Lang::zone('city'); } // Auto repop if ($this->subject->getField('flags') & 0x1000 && !$this->subject->getField('parentArea')) { $infobox[] = Lang::zone('autoRez'); } // Level if ($_ = $this->subject->getField('levelMin')) { if ($_ < $this->subject->getField('levelMax')) { $_ .= ' - ' . $this->subject->getField('levelMax'); } $infobox[] = Lang::game('level') . Lang::main('colon') . $_; } // required Level if ($_ = $this->subject->getField('levelReq')) { if ($__ = $this->subject->getField('levelReqLFG')) { $buff = sprintf(Lang::zone('reqLevels'), $_, $__); } else { $buff = Lang::main('_reqLevel') . Lang::main('colon') . $_; } $infobox[] = $buff; } // Territory $_ = $this->subject->getField('faction'); $__ = '%s'; if ($_ == 0) { $__ = '[span class=icon-alliance]%s[/span]'; } else { if ($_ == 1) { $__ = '[span class=icon-horde]%s[/span]'; } else { if ($_ == 4) { $__ = '[span class=icon-ffa]%s[/span]'; } } } $infobox[] = Lang::zone('territory') . Lang::main('colon') . sprintf($__, Lang::zone('territories', $_)); // Instance Type $infobox[] = Lang::zone('instanceType') . Lang::main('colon') . '[span class=icon-instance' . $this->subject->getField('type') . ']' . Lang::zone('instanceTypes', $this->subject->getField('type')) . '[/span]'; // Heroic mode if ($_ = $this->subject->getField('levelHeroic')) { $infobox[] = '[icon preset=heroic]' . sprintf(Lang::zone('hcAvailable'), $_) . '[/icon]'; } // number of players if ($_ = $this->subject->getField('maxPlayer')) { $infobox[] = Lang::zone('numPlayers') . Lang::main('colon') . ($_ == -2 ? '10/25' : $_); } // Attunement Quest/Achievements & Keys if ($attmnt = $this->subject->getField('attunes')) { foreach ($attmnt as $type => $ids) { $this->extendGlobalIds($type, array_map('abs', $ids)); foreach ($ids as $id) { if ($type == TYPE_ITEM) { $infobox[] = Lang::zone('key', (int) ($id < 0)) . Lang::main('colon') . '[item=' . abs($id) . ']'; } else { $infobox[] = Lang::zone('attunement', (int) ($id < 0)) . Lang::main('colon') . '[' . Util::$typeStrings[$type] . '=' . abs($id) . ']'; } } } } // Instances if ($_ = DB::Aowow()->selectCol('SELECT id FROM ?_zones WHERE parentAreaId = ?d AND (flags & ?d) = 0', $this->typeId, CUSTOM_EXCLUDE_FOR_LISTVIEW)) { $this->extendGlobalIds(TYPE_ZONE, $_); $infobox[] = Lang::maps('Instances') . Lang::main('colon') . "\n[zone=" . implode("], \n[zone=", $_) . ']'; } // location (if instance) if ($pa = $this->subject->getField('parentAreaId')) { $paO = new ZoneList(array(['id', $pa])); if (!$paO->error) { $pins = str_pad($this->subject->getField('parentX') * 10, 3, '0', STR_PAD_LEFT) . str_pad($this->subject->getField('parentY') * 10, 3, '0', STR_PAD_LEFT); $infobox[] = Lang::zone('location') . Lang::main('colon') . '[lightbox=map zone=' . $pa . ' pins=' . $pins . ']' . $paO->getField('name', true) . '[/lightbox]'; } } /* has to be defined in an article, i think // faction(s) / Reputation Hub / Raid Faction // [li]Raid faction: [faction=1156][/li] || [li]Factions: [faction=1156]/[faction=1156][/li] // final boss // [li]Final boss: [icon preset=boss][npc=37226][/icon][/li] */ /****************/ /* Main Content */ /****************/ $addToMap = function ($what, $entry) use(&$som) { // entry always contains: type, id, name, level, coords[] if (!isset($som[$what][$entry['name']])) { // not found yet $som[$what][$entry['name']][] = $entry; } else { // check for identical floors foreach ($som[$what][$entry['name']] as &$byFloor) { if ($byFloor['level'] != $entry['level']) { continue; } // found existing floor, ammending coords $byFloor['coords'][] = $entry['coords'][0]; break; } // floor not used yet, create it $som[$what][$entry['name']][] = $entry; } }; if ($_ = $this->subject->getField('parentArea')) { $this->extraText = sprintf(Lang::zone('zonePartOf'), $_); $this->extendGlobalIds(TYPE_ZONE, $_); } // we cannot fetch spawns via lists. lists are grouped by entry $oSpawns = DB::Aowow()->select('SELECT * FROM ?_spawns WHERE areaId = ?d AND type = ?d', $this->typeId, TYPE_OBJECT); $cSpawns = DB::Aowow()->select('SELECT * FROM ?_spawns WHERE areaId = ?d AND type = ?d', $this->typeId, TYPE_NPC); $conditions = [CFG_SQL_LIMIT_NONE, ['s.areaId', $this->typeId]]; if (!User::isInGroup(U_GROUP_STAFF)) { $conditions[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0]; } $objectSpawns = new GameObjectList($conditions); $creatureSpawns = new CreatureList($conditions); $questsLV = $rewardsLV = []; // see if we can actually display a map $hasMap = file_exists('static/images/wow/maps/' . Util::$localeStrings[User::$localeId] . '/normal/' . $this->typeId . '.jpg'); if (!$hasMap) { // try multilayered $hasMap = file_exists('static/images/wow/maps/' . Util::$localeStrings[User::$localeId] . '/normal/' . $this->typeId . '-1.jpg'); } if (!$hasMap) { // try english fallback $hasMap = file_exists('static/images/wow/maps/enus/normal/' . $this->typeId . '.jpg'); } if (!$hasMap) { // try english fallback, multilayered $hasMap = file_exists('static/images/wow/maps/enus/normal/' . $this->typeId . '-1.jpg'); } if ($hasMap) { $som = []; foreach ($oSpawns as $spawn) { $tpl = $objectSpawns->getEntry($spawn['typeId']); if (!$tpl) { continue; } $n = Util::localizedString($tpl, 'name'); $what = ''; switch ($tpl['typeCat']) { case -3: $what = 'herb'; break; case -4: $what = 'vein'; break; case 9: $what = 'book'; break; case -6: if ($tpl['spellFocusId'] == 1) { $what = 'anvil'; } else { if ($tpl['spellFocusId'] == 3) { $what = 'forge'; } } break; } if ($what) { $addToMap($what, array('coords' => [[$spawn['posX'], $spawn['posY']]], 'level' => $spawn['floor'], 'name' => $n, 'type' => TYPE_OBJECT, 'id' => $tpl['id'])); } if ($tpl['startsQuests']) { $started = new QuestList(array(['qse.method', 1, '&'], ['qse.type', TYPE_OBJECT], ['qse.typeId', $tpl['id']])); if ($started->error) { continue; } // store data for misc tabs foreach ($started->getListviewData() as $id => $data) { if (!empty($started->rewards[$id][TYPE_ITEM])) { $rewardsLV = array_merge($rewardsLV, array_keys($started->rewards[$id][TYPE_ITEM])); } if (!empty($started->choices[$id][TYPE_ITEM])) { $rewardsLV = array_merge($rewardsLV, array_keys($started->choices[$id][TYPE_ITEM])); } $questsLV[$id] = $data; } $this->extendGlobalData($started->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_REWARDS)); if ($tpl['A'] != -1 & ($_ = $started->getSOMData(SIDE_ALLIANCE))) { $addToMap('alliancequests', array('coords' => [[$spawn['posX'], $spawn['posY']]], 'level' => $spawn['floor'], 'name' => $n, 'type' => TYPE_OBJECT, 'id' => $tpl['id'], 'side' => ($tpl['A'] < 0 ? 0 : 0x1) | ($tpl['H'] < 0 ? 0 : 0x2), 'quests' => array_values($_))); } if ($tpl['H'] != -1 & ($_ = $started->getSOMData(SIDE_HORDE))) { $addToMap('hordequests', array('coords' => [[$spawn['posX'], $spawn['posY']]], 'level' => $spawn['floor'], 'name' => $n, 'type' => TYPE_OBJECT, 'id' => $tpl['id'], 'side' => ($tpl['A'] < 0 ? 0 : 0x1) | ($tpl['H'] < 0 ? 0 : 0x2), 'quests' => array_values($_))); } } } $flightNodes = []; foreach ($cSpawns as $spawn) { $tpl = $creatureSpawns->getEntry($spawn['typeId']); if (!$tpl) { continue; } $n = Util::localizedString($tpl, 'name'); $sn = Util::localizedString($tpl, 'subname'); $what = ''; if ($tpl['npcflag'] & NPC_FLAG_REPAIRER) { $what = 'repair'; } else { if ($tpl['npcflag'] & NPC_FLAG_AUCTIONEER) { $what = 'auctioneer'; } else { if ($tpl['npcflag'] & NPC_FLAG_BANKER) { $what = 'banker'; } else { if ($tpl['npcflag'] & NPC_FLAG_BATTLEMASTER) { $what = 'battlemaster'; } else { if ($tpl['npcflag'] & NPC_FLAG_INNKEEPER) { $what = 'innkeeper'; } else { if ($tpl['npcflag'] & NPC_FLAG_TRAINER) { $what = 'trainer'; } else { if ($tpl['npcflag'] & NPC_FLAG_VENDOR) { $what = 'vendor'; } else { if ($tpl['npcflag'] & NPC_FLAG_FLIGHT_MASTER) { $flightNodes[$tpl['id']] = [$spawn['posX'], $spawn['posY']]; $what = 'flightmaster'; } else { if ($tpl['npcflag'] & NPC_FLAG_STABLE_MASTER) { $what = 'stablemaster'; } else { if ($tpl['npcflag'] & NPC_FLAG_GUILD_MASTER) { $what = 'guildmaster'; } else { if ($tpl['npcflag'] & (NPC_FLAG_SPIRIT_HEALER | NPC_FLAG_SPIRIT_GUIDE)) { $what = 'spirithealer'; } else { if ($creatureSpawns->isBoss()) { $what = 'boss'; } else { if ($tpl['rank'] == 2 || $tpl['rank'] == 4) { $what = 'rare'; } } } } } } } } } } } } } if ($what) { $addToMap($what, array('coords' => [[$spawn['posX'], $spawn['posY']]], 'level' => $spawn['floor'], 'name' => $n, 'type' => TYPE_NPC, 'id' => $tpl['id'], 'reacthorde' => $tpl['H'] ?: 1, 'reactalliance' => $tpl['A'] ?: 1, 'description' => $sn)); } if ($tpl['startsQuests']) { $started = new QuestList(array(['qse.method', 1, '&'], ['qse.type', TYPE_NPC], ['qse.typeId', $tpl['id']])); if ($started->error) { continue; } // store data for misc tabs foreach ($started->getListviewData() as $id => $data) { if (!empty($started->rewards[$id][TYPE_ITEM])) { $rewardsLV = array_merge($rewardsLV, array_keys($started->rewards[$id][TYPE_ITEM])); } if (!empty($started->choices[$id][TYPE_ITEM])) { $rewardsLV = array_merge($rewardsLV, array_keys($started->choices[$id][TYPE_ITEM])); } $questsLV[$id] = $data; } if ($tpl['A'] != -1 & ($_ = $started->getSOMData(SIDE_ALLIANCE))) { $addToMap('alliancequests', array('coords' => [[$spawn['posX'], $spawn['posY']]], 'level' => $spawn['floor'], 'name' => $n, 'type' => TYPE_NPC, 'id' => $tpl['id'], 'reacthorde' => $tpl['H'], 'reactalliance' => $tpl['A'], 'side' => ($tpl['A'] < 0 ? 0 : SIDE_ALLIANCE) | ($tpl['H'] < 0 ? 0 : SIDE_HORDE), 'quests' => array_values($_))); } if ($tpl['H'] != -1 & ($_ = $started->getSOMData(SIDE_HORDE))) { $addToMap('hordequests', array('coords' => [[$spawn['posX'], $spawn['posY']]], 'level' => $spawn['floor'], 'name' => $n, 'type' => TYPE_NPC, 'id' => $tpl['id'], 'reacthorde' => $tpl['H'], 'reactalliance' => $tpl['A'], 'side' => ($tpl['A'] < 0 ? 0 : SIDE_ALLIANCE) | ($tpl['H'] < 0 ? 0 : SIDE_HORDE), 'quests' => array_values($_))); } } } // remove unwanted indizes foreach ($som as $what => &$dataz) { if (empty($som[$what])) { continue; } foreach ($dataz as &$data) { $data = array_values($data); } if (!in_array($what, ['vein', 'herb', 'rare'])) { $foo = []; foreach ($dataz as $d) { foreach ($d as $_) { $foo[] = $_; } } $dataz = $foo; } } // append paths between nodes if ($flightNodes) { // neutral nodes come last as the line is colored by the node it's attached to usort($som['flightmaster'], function ($a, $b) { $n1 = $a['reactalliance'] == $a['reacthorde']; $n2 = $b['reactalliance'] == $b['reacthorde']; if ($n1 && !$n2) { return 1; } if (!$n1 && $n2) { return -1; } return 0; }); $paths = DB::Aowow()->select('SELECT n1.typeId AS "0", n2.typeId AS "1" FROM ?_taxipath p JOIN ?_taxinodes n1 ON n1.id = p.startNodeId JOIN ?_taxinodes n2 ON n2.id = p.endNodeId WHERE n1.typeId IN (?a) AND n2.typeId IN (?a)', array_keys($flightNodes), array_keys($flightNodes)); foreach ($paths as $k => $path) { foreach ($som['flightmaster'] as &$fm) { if ($fm['id'] != $path[0] && $fm['id'] != $path[1]) { continue; } if ($fm['id'] == $path[0]) { $fm['paths'][] = $flightNodes[$path[1]]; } if ($fm['id'] == $path[1]) { $fm['paths'][] = $flightNodes[$path[0]]; } unset($paths[$k]); break; } } } // preselect bosses for raids/dungeons if (in_array($this->subject->getField('type'), [2, 3, 4, 5, 7, 8])) { $som['instance'] = true; } $this->map = array('data' => ['parent' => 'mapper-generic', 'zone' => $this->typeId], 'som' => $som); } else { $this->map = false; } $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 => true); /* - associated with holiday? */ /**************/ /* Extra Tabs */ /**************/ // tab: NPCs if ($cSpawns && !$creatureSpawns->error) { $lvData = array('file' => 'creature', 'data' => $creatureSpawns->getListviewData(), 'params' => ['note' => sprintf(Util::$filterResultString, '?npcs&filter=cr=6;crs=' . $this->typeId . ';crv=0')]); if ($creatureSpawns->getMatches() > CFG_SQL_LIMIT_DEFAULT) { $lvData['params']['_truncated'] = 1; } $this->extendGlobalData($creatureSpawns->getJSGlobals(GLOBALINFO_SELF)); $this->lvTabs[] = $lvData; } // tab: Objects if ($oSpawns && !$objectSpawns->error) { $lvData = array('file' => 'object', 'data' => $objectSpawns->getListviewData(), 'params' => ['note' => sprintf(Util::$filterResultString, '?objects&filter=cr=1;crs=' . $this->typeId . ';crv=0')]); if ($objectSpawns->getMatches() > CFG_SQL_LIMIT_DEFAULT) { $lvData['params']['_truncated'] = 1; } $this->extendGlobalData($objectSpawns->getJSGlobals(GLOBALINFO_SELF)); $this->lvTabs[] = $lvData; } // tab: Quests [data collected by SOM-routine] if ($questsLV) { $this->lvTabs[] = array('file' => 'quest', 'data' => $questsLV, 'params' => ['note' => '$$WH.sprintf(LANG.lvnote_zonequests, ' . $this->subject->getField('mapId') . ', ' . $this->typeId . ', \'' . Util::jsEscape($this->subject->getField('name', true)) . '\', ' . $this->typeId . ')']); } // tab: item-quest starter // select every quest starter, that is a drop $questStartItem = DB::Aowow()->select(' SELECT qse.typeId AS ARRAY_KEY, moreType, moreTypeId, moreZoneId FROM ?_quests_startend qse JOIN ?_source src ON src.type = qse.type AND src.typeId = qse.typeId WHERE src.src2 IS NOT NULL AND qse.type = ?d AND (moreZoneId = ?d OR (moreType = ?d AND moreTypeId IN (?a)) OR (moreType = ?d AND moreTypeId IN (?a)))', TYPE_ITEM, $this->typeId, TYPE_NPC, array_unique(array_column($cSpawns, 'typeId')) ?: [0], TYPE_OBJECT, array_unique(array_column($oSpawns, 'typeId')) ?: [0]); if ($questStartItem) { $qsiList = new ItemList(array(['id', array_keys($questStartItem)])); if (!$qsiList->error) { $this->lvTabs[] = array('file' => 'item', 'data' => $qsiList->getListviewData(), 'params' => ['name' => '$LANG.tab_startsquest', 'id' => 'starts-quest']); $this->extendGlobalData($qsiList->getJSGlobals(GLOBALINFO_SELF)); } } // tab: Quest Rewards [ids collected by SOM-routine] if ($rewardsLV) { $rewards = new ItemList(array(['id', array_unique($rewardsLV)])); if (!$rewards->error) { $this->lvTabs[] = array('file' => 'item', 'data' => $rewards->getListviewData(), 'params' => ['name' => '$LANG.tab_questrewards', 'id' => 'quest-rewards', 'note' => sprintf(Util::$filterResultString, '?items&filter=cr=126;crs=' . $this->typeId . ';crv=0')]); $this->extendGlobalData($rewards->getJSGlobals(GLOBALINFO_SELF)); } } // tab: achievements // tab: fished in zone $fish = new Loot(); if ($fish->getByContainer(LOOT_FISHING, $this->typeId)) { $this->extendGlobalData($fish->jsGlobals); $xCols = array_merge(['Listview.extraCols.percent'], $fish->extraCols); foreach ($fish->iterate() as $lv) { if (!$lv['quest']) { continue; } $xCols = array_merge($xCols, ['Listview.extraCols.condition']); $reqQuest[$lv['id']] = 0; $lv['condition'][0][$this->typeId][] = [[CND_QUESTTAKEN, &$reqQuest[$lv['id']]]]; } $this->lvTabs[] = array('file' => 'item', 'data' => $fish->getResult(), 'params' => ['name' => '$LANG.tab_fishing', 'id' => 'fishing', 'extraCols' => $xCols ? "\$[" . implode(', ', array_unique($xCols)) . "]" : null, 'hiddenCols' => "\$['side']"]); } // tab: spells if ($saData = DB::World()->select('SELECT * FROM spell_area WHERE area = ?d', $this->typeId)) { $spells = new SpellList(array(['id', array_column($saData, 'spell')])); if (!$spells->error) { $lvSpells = $spells->getListviewData(); $this->extendGlobalData($spells->getJSGlobals()); $extra = false; foreach ($saData as $a) { if (empty($lvSpells[$a['spell']])) { continue; } $condition = []; if ($a['aura_spell']) { $this->extendGlobalIds(TYPE_SPELL, abs($a['aura_spell'])); $condition[0][$this->typeId][] = [[$a['aura_spell'] > 0 ? CND_AURA : -CND_AURA, abs($a['aura_spell'])]]; } if ($a['quest_start']) { $this->extendGlobalIds(TYPE_QUEST, $a['quest_start']); $group = []; for ($i = 0; $i < 7; $i++) { if (!($a['quest_start_status'] & 1 << $i)) { continue; } if ($i == 0) { $group[] = [CND_QUEST_NONE, $a['quest_start']]; } else { if ($i == 1) { $group[] = [CND_QUEST_COMPLETE, $a['quest_start']]; } else { if ($i == 3) { $group[] = [CND_QUESTTAKEN, $a['quest_start']]; } else { if ($i == 6) { $group[] = [CND_QUESTREWARDED, $a['quest_start']]; } } } } } if ($group) { $condition[0][$this->typeId][] = $group; } } if ($a['quest_end'] && $a['quest_end'] != $a['quest_start']) { $this->extendGlobalIds(TYPE_QUEST, $a['quest_end']); $group = []; for ($i = 0; $i < 7; $i++) { if (!($a['quest_end_status'] & 1 << $i)) { continue; } if ($i == 0) { $group[] = [-CND_QUEST_NONE, $a['quest_end']]; } else { if ($i == 1) { $group[] = [-CND_QUEST_COMPLETE, $a['quest_end']]; } else { if ($i == 3) { $group[] = [-CND_QUESTTAKEN, $a['quest_end']]; } else { if ($i == 6) { $group[] = [-CND_QUESTREWARDED, $a['quest_end']]; } } } } } if ($group) { $condition[0][$this->typeId][] = $group; } } if ($a['racemask']) { $foo = []; for ($i = 0; $i < 11; $i++) { if ($a['racemask'] & 1 << $i) { $foo[] = $i + 1; } } $this->extendGlobalIds(TYPE_RACE, $foo); $condition[0][$this->typeId][] = [[CND_RACE, $a['racemask']]]; } if ($a['gender'] != 2) { // 2: both $condition[0][$this->typeId][] = [[CND_GENDER, $a['gender'] + 1]]; } if ($condition) { $extra = true; $lvSpells[$a['spell']] = array_merge($lvSpells[$a['spell']], ['condition' => $condition]); } } $this->lvTabs[] = array('file' => 'spell', 'data' => $lvSpells, 'params' => array('extraCols' => $extra ? '$[Listview.extraCols.condition]' : null, 'hiddenCols' => "\$['skill']")); } } // tab: subzones $subZones = new ZoneList(array(['parentArea', $this->typeId])); if (!$subZones->error) { $this->lvTabs[] = array('file' => 'zone', 'data' => $subZones->getListviewData(), 'params' => ['name' => '$LANG.tab_zones', 'id' => 'subzones', 'hiddenCols' => "\$['territory', 'instancetype']"]); $this->extendGlobalData($subZones->getJSGlobals(GLOBALINFO_SELF)); } }
$this->brick('header'); ?> <div class="main" id="main"> <div class="main-precontents" id="main-precontents"></div> <div class="main-contents" id="main-contents"> <?php $this->brick('announcement'); $this->brick('pageTemplate'); $this->brick('infobox'); ?> <script type="text/javascript">var g_pageInfo = { username: '******'name']); ?> ' }</script> <div class="text"> <div id="h1-icon-generic" class="h1-icon"></div> <script type="text/javascript"> $WH.ge('h1-icon-generic').appendChild(Icon.createUser(<?php echo (is_numeric(User::$avatar) ? 2 : 1) . ' , \'' . User::$avatar . '\''; ?> , 1, null, <?php echo User::isInGroup(U_GROUP_PREMIUM) ? 0 : 2; ?> , false, Icon.getPrivilegeBorder(<?php echo User::getReputation(); ?>
protected function handleLoad() { /* params id: profileId items: string [itemIds.join(':')] unnamed: unixtime [only to force the browser to reload instead of cache] return lots... */ // titles, achievements, characterData, talents (, pets) // and some onLoad-hook to .. load it registerProfile($data) // everything else goes through data.php .. strangely enough if (!$this->_get['id']) { return; } $char = new ProfileList(array(['id', $this->_get['id'][0]])); // or string or whatever $buff = ''; if ($it = array_column($char->getField('inventory'), 0)) { $itemz = new ItemList(array(['id', $it, CFG_SQL_LIMIT_NONE])); $data = $itemz->getListviewData(ITEMINFO_JSON | ITEMINFO_SUBITEMS); // get and apply inventory foreach ($itemz->iterate() as $iId => $__) { $buff .= 'g_items.add(' . $iId . ', {name_' . User::$localeString . ":'" . Util::jsEscape($itemz->getField('name', true)) . "', quality:" . $itemz->getField('quality') . ", icon:'" . $itemz->getField('iconString') . "', jsonequip:" . Util::toJSON($data[$iId]) . "});\n"; } $buff .= "\n"; } if ($au = $char->getField('auras')) { $auraz = new SpellList(array(['id', $char->getField('auras')], CFG_SQL_LIMIT_NONE)); $dataz = $auraz->getListviewData(); $modz = $auraz->getProfilerMods(); // get and apply aura-mods foreach ($dataz as $id => $data) { $mods = []; if (!empty($modz[$id])) { foreach ($modz[$id] as $k => $v) { if (is_array($v)) { $mods[] = $v; } else { if ($str = @Util::$itemMods[$k]) { $mods[$str] = $v; } } } } $buff .= 'g_spells.add(' . $id . ", {id:" . $id . ", name:'" . Util::jsEscape(mb_substr($data['name'], 1)) . "', icon:'" . $data['icon'] . "', modifier:" . Util::toJSON($mods) . "});\n"; } $buff .= "\n"; } /* depending on progress-achievements // required by progress in JScript move to handleLoad()? Util::$pageTemplate->extendGlobalIds(TYPE_NPC, [29120, 31134, 29306, 29311, 23980, 27656, 26861, 26723, 28923, 15991]); */ // load available titles Util::loadStaticFile('p-titles-' . $char->getField('gender'), $buff, true); // load available achievements if (!Util::loadStaticFile('p-achievements', $buff, true)) { $buff .= "\n\ng_achievement_catorder = [];"; $buff .= "\n\ng_achievement_points = [0];"; } // excludes; structure UNK type => [maskBit => [typeIds]] ? /* g_user.excludes = [type:[typeIds]] g_user.includes = [type:[typeIds]] g_user.excludegroups = groupMask // requires g_user.settings != null maskBit are matched against fieldId from excludeGroups id: 1, label: LANG.dialog_notavail id: 2, label: LANG.dialog_tcg id: 4, label: LANG.dialog_collector id: 8, label: LANG.dialog_promo id: 16, label: LANG.dialog_nonus id: 96, label: LANG.dialog_faction id: 896, label: LANG.dialog_profession id: 1024, label: LANG.dialog_noexalted */ // $buff .= "\n\ng_excludes = {};"; // add profile to buffer $buff .= "\n\n\$WowheadProfiler.registerProfile(" . Util::toJSON($char->getEntry(2)) . ");"; // can't use JSON_NUMERIC_CHECK or the talent-string becomes a float return $buff . "\n"; }
$this->brick('header'); ?> <div class="main" id="main"> <div class="main-precontents" id="main-precontents"></div> <div class="main-contents" id="main-contents"> <?php $this->brick('announcement'); $this->brick('pageTemplate'); $this->brick('infobox'); ?> <script type="text/javascript">var g_pageInfo = { username: '******'displayName']); ?> ' }</script> <div class="text"> <div id="h1-icon-generic" class="h1-icon"></div> <script type="text/javascript"> $WH.ge('h1-icon-generic').appendChild(Icon.createUser(<?php echo (is_numeric($this->user['avatar']) ? 2 : 1) . ', \'' . ($this->user['avatar'] ?: 'inv_misc_questionmark') . '\''; ?> , 1, null, <?php echo User::isInGroup(U_GROUP_PREMIUM) ? 0 : 2; ?> , false, Icon.getPrivilegeBorder(<?php echo $this->user['sumRep']; ?>
public function renderTooltip() { if (!$this->curTpl) { return null; } $x = '<table><tr><td>'; // head v that extra % is nesecary because we are using sprintf later on $x .= '<table width="100%%"><tr><td><b>' . Util::jsEscape($this->getField('name', true)) . '</b></td><th><b class="q0">' . Lang::event('category', $this->getField('category')) . '</b></th></tr></table>'; // use string-placeholder for dates // start $x .= Lang::event('start') . Lang::main('colon') . '%s<br>'; // end $x .= Lang::event('end') . Lang::main('colon') . '%s'; $x .= '</td></tr></table>'; // desc if ($this->getField('holidayId')) { if ($_ = $this->getField('description', true)) { $x .= '<table><tr><td><span class="q">' . Util::jsEscape($_) . '</span></td></tr></table>'; } } return $x; }
protected function generateTooltip($asError = false) { if ($asError) { return '$WowheadPower.registerObject(' . $this->typeId . ', ' . User::$localeId . ', {});'; } $s = $this->subject->getSpawns(SPAWNINFO_SHORT); $x = '$WowheadPower.registerObject(' . $this->typeId . ', ' . User::$localeId . ", {\n"; $x .= "\tname_" . User::$localeString . ": '" . Util::jsEscape($this->subject->getField('name', true)) . "',\n"; $x .= "\ttooltip_" . User::$localeString . ": '" . Util::jsEscape($this->subject->renderTooltip()) . "',\n"; $x .= "\tmap: " . ($s ? "{zone: " . $s[0] . ", coords: {" . $s[1] . ":" . Util::toJSON($s[2]) . "}}" : '{}') . "\n"; $x .= "});"; return $x; }
protected function generateTooltip($asError = false) { $itemString = $this->typeId; foreach ($this->enhancedTT as $k => $val) { $itemString .= $k . (is_array($val) ? implode(',', $val) : $val); } if ($asError) { return '$WowheadPower.registerItem(\'' . $itemString . '\', ' . User::$localeId . ', {})'; } $x = '$WowheadPower.registerItem(\'' . $itemString . '\', ' . User::$localeId . ", {\n"; $x .= "\tname_" . User::$localeString . ": '" . Util::jsEscape($this->subject->getField('name', true)) . "',\n"; $x .= "\tquality: " . $this->subject->getField('quality') . ",\n"; $x .= "\ticon: '" . urlencode($this->subject->getField('iconString')) . "',\n"; $x .= "\ttooltip_" . User::$localeString . ": '" . Util::jsEscape($this->subject->renderTooltip(false, 0, $this->enhancedTT)) . "'\n"; $x .= "});"; return $x; }
protected function generateTooltip($asError = false) { if ($asError) { return '$WowheadPower.registerAchievement(' . $this->typeId . ', ' . User::$localeId . ', {});'; } $x = '$WowheadPower.registerAchievement(' . $this->typeId . ', ' . User::$localeId . ",{\n"; $x .= "\tname_" . User::$localeString . ": '" . Util::jsEscape($this->subject->getField('name', true)) . "',\n"; $x .= "\ticon: '" . urlencode($this->subject->getField('iconString')) . "',\n"; $x .= "\ttooltip_" . User::$localeString . ": '" . $this->subject->renderTooltip() . "'\n"; $x .= "});"; return $x; }
<?php if (!empty($this->headIcons)) { foreach ($this->headIcons as $k => $v) { echo '<div id="h1-icon-' . $k . "\" class=\"h1-icon\"></div>\n"; } ?> <script type="text/javascript">//<![CDATA[ <?php foreach ($this->headIcons as $k => $v) { echo "\$WH.ge('h1-icon-" . $k . "').appendChild(Icon.create('" . Util::jsEscape($v) . "', 1));\n"; } ?> //]]></script> <?php }
} else { ?> <div class="text"> <h1><?php echo $this->name; ?> </h1> <?php $this->brick('article'); if (isset($this->extraText)) { ?> <div id="text-generic" class="left"></div> <script type="text/javascript">//<![CDATA[ Markup.printHtml("<?php echo Util::jsEscape($this->extraText); ?> ", "text-generic", { allow: Markup.CLASS_ADMIN, dbpage: true }); //]]></script> <div class="pad2"></div> <?php } if (isset($this->extraHTML)) { echo $this->extraHTML; } } ?>
private function generateOpenSearch($asError = false) { // this one is funny: we want 10 results, ideally equally distributed over each type $foundTotal = 0; $limit = $this->maxResults; $result = array($this->search, [], [], [], [], [], [], []); foreach ($this->lvTabs as $_) { $foundTotal += $_['matches']; } if (!$foundTotal || $asError) { return '["' . Util::jsEscape($this->search) . '", []]'; } foreach ($this->lvTabs as $idx => $set) { $max = max(1, intVal($limit * $set['matches'] / $foundTotal)); $limit -= $max; for ($i = 0; $i < $max; $i++) { $data = array_shift($set['data']); if (!$data) { break; } $hasQ = is_numeric($data['name'][0]) || $data['name'][0] == '@'; $result[1][] = ($hasQ ? substr($data['name'], 1) : $data['name']) . $set['appendix']; $result[3][] = HOST_URL . '/?' . Util::$typeStrings[$set['type']] . '=' . $data['id']; $extra = [$set['type'], $data['id']]; if (isset($data['param1'])) { $extra[] = $data['param1']; } if (isset($data['param2'])) { $extra[] = $data['param2']; } $result[7][] = $extra; } if ($limit <= 0) { break; } } return Util::toJSON($result); }
protected function generateTooltip($asError = false) { if ($asError) { die('$WowheadPower.registerSpell(' . $this->typeId . ', ' . User::$localeId . ', {});'); } $x = '$WowheadPower.registerSpell(' . $this->typeId . ', ' . User::$localeId . ", {\n"; $pt = []; if ($n = $this->subject->getField('name', true)) { $pt[] = "\tname_" . User::$localeString . ": '" . Util::jsEscape($n) . "'"; } if ($i = $this->subject->getField('iconString')) { $pt[] = "\ticon: '" . urlencode($i) . "'"; } if ($tt = $this->subject->renderTooltip()) { $pt[] = "\ttooltip_" . User::$localeString . ": '" . Util::jsEscape($tt[0]) . "'"; $pt[] = "\tspells_" . User::$localeString . ": " . Util::toJSON($tt[1]); } if ($btt = $this->subject->renderBuff()) { $pt[] = "\tbuff_" . User::$localeString . ": '" . Util::jsEscape($btt[0]) . "'"; $pt[] = "\tbuffspells_" . User::$localeString . ": " . Util::toJSON($btt[1]); } $x .= implode(",\n", $pt) . "\n});"; return $x; }
<div class="text"> <?php $this->brick('redButtons'); if ($this->expansion) { echo ' <h1 class="h1-icon"><span class="icon-' . $this->expansion . '-right">' . $this->name . "</span></h1>\n"; } else { echo ' <h1>' . $this->name . "</h1>\n"; } $this->brick('article'); echo $this->description; ?> <script type="text/javascript">//<![CDATA[ <?php foreach ($this->pieces as $p) { echo " g_items.add(" . $p['id'] . ", {name_" . User::$localeString . ":'" . Util::jsEscape($p['name']) . "', quality:" . $p['quality'] . ", icon:'" . $p['icon'] . "', jsonequip:" . json_encode($p['json']) . "});\n"; } ?> //]]></script> <table class="iconlist"> <?php foreach ($this->pieces as $i => $p) { echo ' <tr><th align="right" id="iconlist-icon' . ($i + 1) . '"></th><td><span class="q' . $p['quality'] . '"><a href="?item=' . $p['id'] . '">' . $p['name'] . "</a></span></td></tr>\n"; } ?> </table> <script type="text/javascript">//<![CDATA[ <?php foreach ($this->pieces as $i => $p) {
<div class="main" id="main"> <div class="main-precontents" id="main-precontents"></div> <div class="main-contents" id="main-contents"> <?php $this->brick('announcement'); $this->brick('pageTemplate'); ?> <div class="text"> <div id="compare-generic"></div> <script type="text/javascript">//<![CDATA[ <?php foreach ($this->cmpItems as $item) { echo ' g_items.add(' . $item[0] . ', {name_' . User::$localeString . ':\'' . Util::jsEscape($item[1]) . '\', quality:' . $item[2] . ', icon:\'' . $item[3] . '\', jsonequip:' . json_encode($item[4], JSON_NUMERIC_CHECK) . "});\n"; } ?> new Summary({template:'compare',id:'compare',parent:'compare-generic',groups:<?php echo json_encode($this->summary, JSON_NUMERIC_CHECK); ?> }); //]]></script> </div> <div class="clear"></div> </div><!-- main-contents --> </div><!-- main --> <?php $this->brick('footer');
function itemsets() { $success = true; $setList = DB::Aowow()->Select('SELECT * FROM ?_itemset ORDER BY refSetId DESC'); $jsonBonus = []; // check directory-structure foreach (Util::$localeStrings as $dir) { if (!CLISetup::writeDir('datasets/' . $dir)) { $success = false; } } foreach (CLISetup::$localeIds as $lId) { User::useLocale($lId); Lang::load(Util::$localeStrings[$lId]); $itemsetOut = []; foreach ($setList as $set) { set_time_limit(15); $setOut = array('id' => $set['id'], 'name' => 7 - $set['quality'] . Util::jsEscape(Util::localizedString($set, 'name')), 'pieces' => [], 'heroic' => !!$set['heroic'], 'maxlevel' => $set['maxLevel'], 'minlevel' => $set['minLevel'], 'type' => $set['type'], 'setbonus' => []); if ($set['classMask']) { $setOut['reqclass'] = $set['classMask']; $setOut['classes'] = []; for ($i = 0; $i < 12; $i++) { if ($set['classMask'] & 1 << $i - 1) { $setOut['classes'][] = $i; } } } if ($set['contentGroup']) { $setOut['note'] = $set['contentGroup']; } if ($set['id'] < 0) { $setOut['idbak'] = $set['refSetId']; } for ($i = 1; $i < 11; $i++) { if ($set['item' . $i]) { $setOut['pieces'][] = $set['item' . $i]; } } for ($i = 1; $i < 9; $i++) { if (!$set['bonus' . $i] || !$set['spell' . $i]) { continue; } // costy and locale-independant -> cache if (!isset($jsonBonus[$set['spell' . $i]])) { $jsonBonus[$set['spell' . $i]] = (new SpellList(array(['s.id', (int) $set['spell' . $i]])))->getStatGain()[$set['spell' . $i]]; } if (!isset($setOut['setbonus'][$set['bonus' . $i]])) { $setOut['setbonus'][$set['bonus' . $i]] = $jsonBonus[$set['spell' . $i]]; } else { foreach ($jsonBonus[$set['spell' . $i]] as $k => $v) { @($setOut['setbonus'][$set['bonus' . $i]][$k] += $v); } } } foreach ($setOut['setbonus'] as $k => $v) { if (empty($v)) { unset($setOut['setbonus'][$k]); } else { foreach ($v as $sk => $sv) { if ($str = Util::$itemMods[$sk]) { $setOut['setbonus'][$k][$str] = $sv; unset($setOut['setbonus'][$k][$sk]); } } } } if (empty($setOut['setbonus'])) { unset($setOut['setbonus']); } $itemsetOut[$setOut['id']] = $setOut; } $toFile = "var g_itemsets = " . Util::toJSON($itemsetOut) . ";"; $file = 'datasets/' . User::$localeString . '/itemsets'; if (!CLISetup::writeFile($file, $toFile)) { $success = false; } } return $success; }
private function addArticle() { if (empty($this->type) || !isset($this->typeId)) { return; } $article = DB::Aowow()->selectRow('SELECT article, quickInfo, locale FROM ?_articles WHERE type = ?d AND typeId = ?d AND locale = ?d UNION ALL ' . 'SELECT article, quickInfo, locale FROM ?_articles WHERE type = ?d AND typeId = ?d AND locale = 0 ORDER BY locale DESC LIMIT 1', $this->type, $this->typeId, User::$localeId, $this->type, $this->typeId); if ($article) { foreach ($article as $text) { (new Markup($text))->parseGlobalsFromText($this->jsgBuffer); } $replace = array('<script' => '<scr"+"ipt', 'script>' => 'scr"+"ipt>', 'HOST_URL' => HOST_URL, 'STATIC_URL' => STATIC_URL); $this->article = array('text' => strtr($article['article'], $replace), 'params' => []); if (empty($this->infobox) && !empty($article['quickInfo'])) { $this->infobox = $article['quickInfo']; } if ($article['locale'] != User::$localeId) { $this->article['params'] = ['prepend' => Util::jsEscape('<div class="notice-box"><span class="icon-bubble">' . Lang::main('englishOnly') . '</span></div>')]; } } }
</script> </td></tr> <?php } if (!empty($this->contributions)) { ?> <tr><th id="infobox-contributions"><?php echo Lang::user('contributions'); ?> </th></tr> <tr><td> <div class="infobox-spacer"></div> <div id="infobox-contents1"></div> <script type="text/javascript"> Markup.printHtml('<?php echo Util::jsEscape($this->contributions); ?> ', 'infobox-contents1', { allow: Markup.CLASS_STAFF }); </script> </td></tr> <?php } if (!empty($this->series)) { foreach ($this->series as $s) { $this->brick('series', ['list' => $s[0], 'listTitle' => $s[1]]); } } if (!empty($this->type) && !empty($this->typeId)) { ?> <tr><th id="infobox-screenshots"><?php echo Lang::main('screenshots');