protected function generateContent() { // add conditional js $this->addJS('?data=weight-presets.gems.enchants.itemsets&locale=' . User::$localeId . '&t=' . $_SESSION['dataKey']); if (!$this->compareString) { return; } $sets = explode(';', $this->compareString); $items = $outSet = []; foreach ($sets as $set) { $itemSting = explode(':', $set); $outString = []; foreach ($itemSting as $substring) { $params = explode('.', $substring); $items[] = (int) $params[0]; while (sizeof($params) < 7) { $params[] = 0; } $outString[] = $params; } $outSet[] = $outString; } $this->summary = $outSet; $iList = new ItemList(array(['i.id', $items])); $data = $iList->getListviewData(ITEMINFO_SUBITEMS | ITEMINFO_JSON); foreach ($iList->iterate() as $itemId => $__) { if (empty($data[$itemId])) { continue; } $this->cmpItems[] = [$itemId, $iList->getField('name', true), $iList->getField('quality'), $iList->getField('iconString'), $data[$itemId]]; } }
private function _searchItem($cndBase, &$shared) { $result = []; $miscData = []; $cndAdd = empty($this->query) ? [] : (is_int($this->query) ? ['id', $this->query] : $this->createLookup()); if ($this->searchMask & SEARCH_TYPE_JSON && $this->searchMask & 0x20 && !empty($shared['pcsToSet'])) { $cnd = [['i.id', array_keys($shared['pcsToSet'])], CFG_SQL_LIMIT_NONE]; $miscData = ['pcsToSet' => $shared['pcsToSet']]; } else { if ($this->searchMask & SEARCH_TYPE_JSON && $this->searchMask & 0x40) { $cnd = $cndBase; $cnd[] = ['i.class', [ITEM_CLASS_WEAPON, ITEM_CLASS_GEM, ITEM_CLASS_ARMOR]]; $cnd[] = $cndAdd; $slots = isset($_GET['slots']) ? explode(':', $_GET['slots']) : []; array_walk($slots, function (&$v, $k) { $v = intVal($v); }); if ($_ = array_filter($slots)) { $cnd[] = ['slot', $_]; } $itemFilter = new ItemListFilter(); if ($_ = $itemFilter->createConditionsForWeights($this->statWeight)) { $miscData['extraOpts'] = $itemFilter->extraOpts; $cnd = array_merge($cnd, [$_]); } } else { $cnd = array_merge($cndBase, [$cndAdd]); } } $items = new ItemList($cnd, $miscData); if ($data = $items->getListviewData($this->searchMask & SEARCH_TYPE_JSON ? ITEMINFO_SUBITEMS | ITEMINFO_JSON : 0)) { if ($this->searchMask & SEARCH_TYPE_REGULAR) { $this->extendGlobalData($items->getJSGlobals()); } if ($this->searchMask & SEARCH_TYPE_OPEN) { foreach ($items->iterate() as $__) { $data[$items->id]['param1'] = $items->getField('iconString'); $data[$items->id]['param2'] = $items->getField('quality'); } } $result = array('type' => TYPE_ITEM, 'appendix' => ' (Item)', 'matches' => $items->getMatches(), 'file' => ItemList::$brickFile, 'data' => $data, 'params' => []); if ($items->getMatches() > $this->maxResults) { $result['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_itemsfound', $items->getMatches(), $this->maxResults); $result['params']['_truncated'] = 1; } if (isset($result['params']['note'])) { $result['params']['note'] .= ' + LANG.dash + $WH.sprintf(LANG.lvnote_filterresults, \'?items&filter=na=' . urlencode($this->search) . '\')'; } else { $result['params']['note'] = '$$WH.sprintf(LANG.lvnote_filterresults, \'?items&filter=na=' . urlencode($this->search) . '\')'; } } return $result; }
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; }
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 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); } }
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)); } } } }
protected function generateContent() { $this->addJS('?data=weight-presets&locale=' . User::$localeId . '&t=' . $_SESSION['dataKey']); $conditions = []; if (!User::isInGroup(U_GROUP_EMPLOYEE)) { $conditions[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0]; } /*******************/ /* evaluate filter */ /*******************/ // recreate form selection (must be evaluated first via getConditions()) if ($_ = $this->filterObj->getConditions()) { $conditions[] = $_; } $this->filter = array_merge($this->filterObj->getForm('form'), $this->filter); $this->filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : null; $this->filter['fi'] = $this->filterObj->getForm(); $menu = $this->createExtraMenus(); foreach ($menu['type'][0] as $k => $str) { if ($str && (!$menu['type'][1] || $menu['type'][1] & 1 << $k)) { $this->filter['type'][$k] = $str; } } foreach ($menu['slot'][0] as $k => $str) { if ($str && (!$menu['slot'][1] || $menu['slot'][1] & 1 << $k)) { $this->filter['slot'][$k] = $str; } } if (isset($this->filter['slot'][INVTYPE_SHIELD])) { // "Off Hand" => "Shield" $this->filter['slot'][INVTYPE_SHIELD] = Lang::item('armorSubClass', 6); } $xCols = $this->filterObj->getForm('extraCols', true); $infoMask = ITEMINFO_JSON; if (array_intersect([63, 64, 125], $xCols)) { // 63:buyPrice; 64:sellPrice; 125:reqarenartng $infoMask |= ITEMINFO_VENDOR; } if (!empty($this->filter['fi']['extraCols'])) { $this->sharedLV['extraCols'] = '$fi_getExtraCols(fi_extraCols, ' . (isset($this->filter['gm']) ? $this->filter['gm'] : 0) . ', ' . (array_intersect([63], $xCols) ? 1 : 0) . ')'; } if ($this->filterObj->error) { $this->sharedLV['_errors'] = '$1'; } /******************/ /* set conditions */ /******************/ if (isset($this->category[0])) { $conditions[] = ['i.class', $this->category[0]]; } if (isset($this->category[1])) { $conditions[] = ['i.subClass', $this->category[1]]; } if (isset($this->category[2])) { $conditions[] = ['i.subSubClass', $this->category[2]]; } /***********************/ /* handle auto-gemming */ /***********************/ $this->gemScores = $this->createGemScores(); /*************************/ /* handle upgrade search */ /*************************/ $upgItemData = []; if (!empty($this->filter['upg']) && !empty($this->filter['fi']['setWeights'])) { $upgItems = new ItemList(array(['id', array_keys($this->filter['upg'])]), ['extraOpts' => $this->filterObj->extraOpts]); if (!$upgItems->error) { $this->extendGlobalData($upgItems->getJSGlobals()); $upgItemData = $upgItems->getListviewData($infoMask); } } if ($upgItemData) { $singleSlot = true; $ref = reset($this->filter['upg']); foreach ($this->filter['upg'] as $slot) { if ($slot == $ref) { continue; } $singleSlot = false; break; } if ($singleSlot && empty($this->filter['gb'])) { // enforce group by slot $this->filter['gb'] = 1; } else { if (!$singleSlot) { $this->filter['gb'] = 1; $maxResults = 25; $this->sharedLV['customFilter'] = '$fi_filterUpgradeListview'; } } } /********************************************************************************************************************************/ /* group by */ /* */ /* cases that make sense: */ /* no upgItems -> everything goes */ /* 1 upgItems OR */ /* N upgItems (same slot) -> gb:none - disabled */ /* -> gb:slot - limited to slot of the upgItems (in theory weapons create a tab for each weapon type) */ /* -> gb:level - upgItems is added to all tabs */ /* -> gb:source - upgItems is added to all tabs */ /* N upgItems (random) -> gb:none - disabled */ /* -> gb:slot - only slots existing within the upgItems; match upgItems to slot */ /* -> gb:level - disabled */ /* -> gb:source - disabled */ /********************************************************************************************************************************/ $availableSlots = array(ITEM_CLASS_ARMOR => [INVTYPE_HEAD, INVTYPE_NECK, INVTYPE_SHOULDERS, INVTYPE_CHEST, INVTYPE_WAIST, INVTYPE_LEGS, INVTYPE_FEET, INVTYPE_WRISTS, INVTYPE_HANDS, INVTYPE_FINGER, INVTYPE_TRINKET, INVTYPE_SHIELD, INVTYPE_CLOAK], ITEM_CLASS_WEAPON => [INVTYPE_WEAPON, INVTYPE_RANGED, INVTYPE_2HWEAPON, INVTYPE_WEAPONMAINHAND, INVTYPE_WEAPONOFFHAND, INVTYPE_THROWN, INVTYPE_HOLDABLE]); $groups = []; $nameSource = []; $grouping = isset($this->filter['gb']) ? $this->filter['gb'] : null; $extraOpts = []; $maxResults = CFG_SQL_LIMIT_DEFAULT; switch ($grouping) { // slot: (try to limit the lookups by class grouping and intersecting with preselected slots) // if intersect yields an empty array no lookups will occur case 1: if (isset($this->category[0]) && $this->category[0] == ITEM_CLASS_ARMOR) { $groups = $availableSlots[ITEM_CLASS_ARMOR]; } else { if (isset($this->category[0]) && $this->category[0] == ITEM_CLASS_WEAPON) { $groups = $availableSlots[ITEM_CLASS_WEAPON]; } else { $groups = array_merge($availableSlots[ITEM_CLASS_ARMOR], $availableSlots[ITEM_CLASS_WEAPON]); } } if (isset($this->filter['sl'])) { // skip lookups for unselected slots $groups = array_intersect($groups, (array) $this->filter['sl']); } if (!empty($this->filter['upg'])) { // skip lookups for slots we dont have items to upgrade for $groups = array_intersect($groups, (array) $this->filter['upg']); } if ($groups) { $nameSource = Lang::item('inventoryType'); $this->forceTabs = true; } break; case 2: // itemlevel: first, try to find 10 level steps within range (if given) as tabs // ohkayy, maybe i need to rethink $this $this->filterOpts = $this->filterObj->extraOpts; $this->filterOpts['is']['o'] = [null]; // remove 'order by' from itemStats $extraOpts = array_merge($this->filterOpts, ['i' => ['g' => ['itemlevel'], 'o' => ['itemlevel DESC']]]); $levelRef = new ItemList(array_merge($conditions, [10]), ['extraOpts' => $extraOpts]); foreach ($levelRef->iterate() as $_) { $l = $levelRef->getField('itemLevel'); $groups[] = $l; $nameSource[$l] = Lang::game('level') . ' ' . $l; } if ($groups) { $l = -end($groups); $groups[] = $l; // push last value as negativ to signal misc group after $this level $extraOpts = ['i' => ['o' => ['itemlevel DESC']]]; $nameSource[$l] = Lang::item('tabOther'); $this->forceTabs = true; } break; case 3: // source $groups = [1, 2, 3, 4, 5, 10, 11, 12, 0]; $nameSource = Lang::game('sources'); $this->forceTabs = true; break; // none // none default: $grouping = 0; $groups[0] = null; } /*****************************/ /* create lv-tabs for groups */ /*****************************/ foreach ($groups as $group) { switch ($grouping) { case 1: $finalCnd = array_merge($conditions, [['slot', $group], $maxResults]); break; case 2: $finalCnd = array_merge($conditions, [['itemlevel', abs($group), $group > 0 ? null : '<'], $maxResults]); break; case 3: $finalCnd = array_merge($conditions, [$group ? ['src.src' . $group, null, '!'] : ['src.typeId', null], $maxResults]); break; default: $finalCnd = $conditions; } $items = new ItemList($finalCnd, ['extraOpts' => array_merge($extraOpts, $this->filterObj->extraOpts)]); if ($items->error) { continue; } $this->extendGlobalData($items->getJSGlobals()); $tabData = array_merge(['data' => $items->getListviewData($infoMask)], $this->sharedLV); $upg = []; if ($upgItemData) { if ($grouping == 1) { $upg = array_keys(array_filter($this->filter['upg'], function ($v) use($group) { return $v == $group; })); foreach ($upg as $uId) { $tabData['data'][$uId] = $upgItemData[$uId]; } if ($upg) { $tabData['_upgradeIds'] = $upg; } } else { if ($grouping) { $upg = array_keys($this->filter['upg']); $tabData['_upgradeIds'] = $upg; foreach ($upgItemData as $uId => $data) { // using numeric keys => cant use array_merge $tabData['data'][$uId] = $data; } } } } if ($grouping) { switch ($grouping) { case 1: $tabData['id'] = 'slot-' . $group; break; case 2: $tabData['id'] = $group > 0 ? 'level-' . $group : 'other'; break; case 3: $tabData['id'] = $group ? 'source-' . $group : 'unknown'; break; } $tabData['name'] = $nameSource[$group]; $tabData['tabs'] = '$tabsGroups'; } if (!empty($this->filter['fi']['setWeights'])) { if ($items->hasSetFields(['armor'])) { $tabData['visibleCols'][] = 'armor'; } } // create note if search limit was exceeded; overwriting 'note' is intentional if ($items->getMatches() > $maxResults && count($groups) > 1) { $tabData['_truncated'] = 1; $cls = isset($this->category[0]) ? '=' . $this->category[0] : ''; $override = ['gb' => '']; if ($upg) { $override['upg'] = implode(':', $upg); } switch ($grouping) { case 1: $override['sl'] = $group; $tabData['note'] = '$$WH.sprintf(LANG.lvnote_viewmoreslot, \'' . $cls . '\', \'' . $this->filterObj->urlize($override) . '\')'; break; case 2: if ($group > 0) { $override['minle'] = $group; $override['maxle'] = $group; } else { $override['maxle'] = abs($group) - 1; } $tabData['note'] = '$$WH.sprintf(LANG.lvnote_viewmorelevel, \'' . $cls . '\', \'' . $this->filterObj->urlize($override) . '\')'; break; case 3: if ($_ = [null, 3, 4, 5, 6, 7, 9, 10, 11][$group]) { $tabData['note'] = '$$WH.sprintf(LANG.lvnote_viewmoresource, \'' . $cls . '\', \'' . $this->filterObj->urlize($override, ['cr' => 128, 'crs' => $_, 'crv' => 0]) . '\')'; } break; } } else { if ($items->getMatches() > $maxResults) { $tabData['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_itemsfound', $items->getMatches(), CFG_SQL_LIMIT_DEFAULT); $tabData['_truncated'] = 1; } } foreach ($tabData as $k => $p) { if (!$p && $k != 'data') { unset($tabData[$k]); } } if ($grouping) { $tabData['hideCount'] = 1; } $tabData['data'] = array_values($tabData['data']); $this->lvTabs[] = ['item', $tabData]; } // reformat for use in template if (!empty($this->filter['upg'])) { $this->filter['upg'] = implode(':', array_keys($this->filter['upg'])); } // whoops, we have no data? create emergency content if (empty($this->lvTabs)) { $this->forceTabs = false; $this->lvTabs[] = ['item', ['data' => []]]; } // sort for dropdown-menus Lang::sort('game', 'ra'); Lang::sort('game', 'cl'); }
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"; }