public static function getLocks($lockId, $interactive = false) { $locks = []; $lock = DB::Aowow()->selectRow('SELECT * FROM ?_lock WHERE id = ?d', $lockId); if (!$lock) { return $locks; } for ($i = 1; $i <= 5; $i++) { $prop = $lock['properties' . $i]; $rank = $lock['reqSkill' . $i]; $name = ''; if ($lock['type' . $i] == 1) { $name = ItemList::getName($prop); if (!$name) { continue; } if ($interactive) { $name = '<a class="q1" href="?item=' . $prop . '">' . $name . '</a>'; } } else { if ($lock['type' . $i] == 2) { // exclude unusual stuff if (!in_array($prop, [1, 2, 3, 4, 9, 16, 20])) { continue; } $name = self::spell('lockType', $prop); if (!$name) { continue; } if ($interactive) { $skill = 0; switch ($prop) { case 1: $skill = 633; break; // Lockpicking // Lockpicking case 2: $skill = 182; break; // Herbing // Herbing case 3: $skill = 186; break; // Mining // Mining case 20: $skill = 773; break; // Scribing } if ($skill) { $name = '<a href="?skill=' . $skill . '">' . $name . '</a>'; } } if ($rank > 0) { $name .= ' (' . $rank . ')'; } } else { continue; } } $locks[$lock['type' . $i] == 1 ? $prop : -$prop] = sprintf(self::game('requires'), $name); } return $locks; }
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; }
public function renderTooltip($level = MAX_LEVEL, $interactive = false) { if (!$this->curTpl) { return ['', []]; } $this->interactive = $interactive; // fetch needed texts $name = $this->getField('name', true); $rank = $this->getField('rank', true); $desc = $this->parseText('description', $level, $this->interactive, $scaling); $tools = $this->getToolsForCurrent(); $cool = $this->createCooldownForCurrent(); $cast = $this->createCastTimeForCurrent(); $cost = $this->createPowerCostForCurrent(); $range = $this->createRangesForCurrent(); // get reagents $reagents = $this->getReagentsForCurrent(); foreach ($reagents as &$r) { $r[2] = ItemList::getName($r[0]); } $reagents = array_reverse($reagents); // get stances (check: SPELL_ATTR2_NOT_NEED_SHAPESHIFT) $stances = ''; if ($this->curTpl['stanceMask'] && !($this->curTpl['attributes2'] & 0x80000)) { $stances = Lang::game('requires2') . ' ' . Lang::getStances($this->curTpl['stanceMask']); } // get item requirement (skip for professions) $reqItems = ''; if ($this->curTpl['typeCat'] != 11) { $class = $this->getField('equippedItemClass'); $mask = $this->getField('equippedItemSubClassMask'); $reqItems = Lang::getRequiredItems($class, $mask); } // get created items (may need improvement) $createItem = ''; if (in_array($this->curTpl['typeCat'], [9, 11])) { foreach ($this->canCreateItem() as $idx) { if ($this->curTpl['effect' . $idx . 'Id'] == 53) { // Enchantment (has createItem Scroll of Enchantment) continue; } foreach ($this->relItems->iterate() as $cId => $__) { if ($cId != $this->curTpl['effect' . $idx . 'CreateItemId']) { continue; } $createItem = $this->relItems->renderTooltip(true, $this->id); break 2; } } } $x = ''; $x .= '<table><tr><td>'; // name & rank if ($rank) { $x .= '<table width="100%"><tr><td><b>' . $name . '</b></td><th><b class="q0">' . $rank . '</b></th></tr></table>'; } else { $x .= '<b>' . $name . '</b><br />'; } // powerCost & ranges if ($range && $cost) { $x .= '<table width="100%"><tr><td>' . $cost . '</td><th>' . $range . '</th></tr></table>'; } else { if ($cost || $range) { $x .= $range . $cost . '<br />'; } } // castTime & cooldown if ($cast && $cool) { $x .= '<table width="100%">'; $x .= '<tr><td>' . $cast . '</td><th>' . $cool . '</th></tr>'; if ($stances) { $x .= '<tr><td colspan="2">' . $stances . '</td></tr>'; } $x .= '</table>'; } else { if ($cast || $cool) { $x .= $cast . $cool; if ($stances) { $x .= '<br />' . $stances; } } } $x .= '</td></tr></table>'; $xTmp = []; if ($tools) { $_ = Lang::spell('tools') . ':<br/><div class="indent q1">'; while ($tool = array_pop($tools)) { if (isset($tool['itemId'])) { $_ .= '<a href="?item=' . $tool['itemId'] . '">' . $tool['name'] . '</a>'; } else { if (isset($tool['id'])) { $_ .= '<a href="?items&filter=cr=91;crs=' . $tool['id'] . ';crv=0">' . $tool['name'] . '</a>'; } else { $_ .= $tool['name']; } } if (!empty($tools)) { $_ .= ', '; } else { $_ .= '<br />'; } } $xTmp[] = $_ . '</div>'; } if ($reagents) { $_ = Lang::spell('reagents') . ':<br/><div class="indent q1">'; while ($reagent = array_pop($reagents)) { $_ .= '<a href="?item=' . $reagent[0] . '">' . $reagent[2] . '</a>'; if ($reagent[1] > 1) { $_ .= ' (' . $reagent[1] . ')'; } $_ .= empty($reagents) ? '<br />' : ', '; } $xTmp[] = $_ . '</div>'; } if ($reqItems) { $xTmp[] = Lang::game('requires2') . ' ' . $reqItems; } if ($desc[0]) { $xTmp[] = '<span class="q">' . $desc[0] . '</span>'; } if ($createItem) { $xTmp[] = $createItem; } if ($xTmp) { $x .= '<table><tr><td>' . implode('<br />', $xTmp) . '</td></tr></table>'; } // scaling information - spellId:min:max:curr $x .= '<!--?' . $this->id . ':1:' . ($scaling ? MAX_LEVEL : 1) . ':' . $level . '-->'; return [$x, $desc[1]]; }
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; }