private function _searchSpell($cndBase) { $result = []; $cnd = array_merge($cndBase, array(['OR', ['s.typeCat', [0, -9]], ['AND', ['s.cuFlags', SPELL_CU_TRIGGERED, '&'], ['s.typeCat', [7, -2]]]], $this->createLookup())); $misc = new SpellList($cnd); if ($data = $misc->getListviewData()) { if ($this->searchMask & SEARCH_TYPE_REGULAR) { $this->extendGlobalData($misc->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED)); } if ($this->searchMask & SEARCH_TYPE_OPEN) { foreach ($misc->iterate() as $__) { $data[$misc->id]['param1'] = strToLower($misc->getField('iconString')); } } $result = array('type' => TYPE_SPELL, 'appendix' => ' (Spell)', 'matches' => $misc->getMatches(), 'file' => SpellList::$brickFile, 'data' => $data, 'params' => ['name' => '$LANG.tab_uncategorizedspells', 'visibleCols' => "\$['level']", 'hiddenCols' => "\$['skill']"]); if ($misc->getMatches() > $this->maxResults) { $result['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_spellsfound', $misc->getMatches(), $this->maxResults); $result['params']['_truncated'] = 1; } if (isset($result['params']['note'])) { $result['params']['note'] .= ' + LANG.dash + $WH.sprintf(LANG.lvnote_filterresults, \'?spells=0&filter=na=' . urlencode($this->search) . '\')'; } else { $result['params']['note'] = '$$WH.sprintf(LANG.lvnote_filterresults, \'?spells=0&filter=na=' . urlencode($this->search) . '\')'; } } return $result; }
protected function generateContent() { $conditions = []; $visibleCols = []; $hiddenCols = []; $tabData = ['data' => []]; // the next lengthy ~250 lines determine $conditions and lvParams if ($this->category) { switch ($this->category[0]) { case -2: // Character Talents $this->filter['classPanel'] = true; array_push($visibleCols, 'singleclass', 'level', 'schools', 'tier'); $conditions[] = ['s.typeCat', -2]; // i will NOT redefine those class2skillId ... reusing if (isset($this->category[2])) { $conditions[] = ['s.skillLine1', $this->category[2]]; } else { if (isset($this->category[1])) { $conditions[] = ['s.skillLine1', $this->validCats[-2][$this->category[1]]]; } } break; case -3: // Pet Spells array_push($visibleCols, 'level', 'schools'); $conditions[] = ['s.typeCat', -3]; if (isset($this->category[1])) { $xCond = null; for ($i = -2; $i < 0; $i++) { foreach (Util::$skillLineMask[$i] as $idx => $pair) { if ($pair[1] == $this->category[1]) { $xCond = ['AND', ['s.skillLine1', $i], ['s.skillLine2OrMask', 1 << $idx, '&']]; break; } } } $conditions[] = ['OR', $xCond, ['s.skillLine1', $this->category[1]], ['AND', ['s.skillLine1', 0, '>'], ['s.skillLine2OrMask', $this->category[1]]]]; } else { $conditions[] = ['OR', ['s.skillLine1', [-1, -2]], ['s.skillLine1', $this->validCats[-3]], ['AND', ['s.skillLine1', 0, '>'], ['s.skillLine2OrMask', $this->validCats[-3]]]]; } break; case -4: // Racials array_push($visibleCols, 'classes'); $conditions[] = ['s.typeCat', -4]; break; case -8: // NPC-Spells // NPC-Spells case -9: // GM Spells array_push($visibleCols, 'level'); case -5: // Mounts // Mounts case -6: // Companions $conditions[] = ['s.typeCat', $this->category[0]]; break; case -7: // Pet Talents array_push($visibleCols, 'level', 'tier'); $conditions[] = ['s.typeCat', -7]; if (isset($this->category[1])) { switch ($this->category[1]) { case 409: // Tenacity $conditions[] = ['s.cuFlags', SPELL_CU_PET_TALENT_TYPE1, '&']; $url = '?pets=1'; break; case 410: // Cunning $conditions[] = ['s.cuFlags', SPELL_CU_PET_TALENT_TYPE2, '&']; $url = '?pets=2'; break; case 411: // Ferocity $conditions[] = ['s.cuFlags', SPELL_CU_PET_TALENT_TYPE0, '&']; $url = '?pets=0'; break; } $tabData['note'] = '$$WH.sprintf(LANG.lvnote_pettalents, "' . $url . '")'; } $tabData['_petTalents'] = 1; // not conviced, this is correct, but .. it works break; case -11: // Proficiencies ... the subIds are actually SkillLineCategories if (!isset($this->category[1]) || $this->category[1] != 10) { array_push($visibleCols, 'classes'); } $conditions[] = ['s.typeCat', -11]; if (isset($this->category[1])) { if ($this->category[1] == 6) { // todo (med): we know Weapon(6) includes spell Shoot(3018), that has a mask; but really, ANY proficiency or petSkill should be in that mask so there is no need to differenciate $conditions[] = ['OR', ['s.skillLine1', SpellList::$skillLines[$this->category[1]]], ['s.skillLine1', -3]]; } else { $conditions[] = ['s.skillLine1', SpellList::$skillLines[$this->category[1]]]; } } break; case -13: // Glyphs $this->filter['classPanel'] = true; $this->filter['glyphPanel'] = true; array_push($visibleCols, 'singleclass', 'glyphtype'); $conditions[] = ['s.typeCat', -13]; if (isset($this->category[1])) { $conditions[] = ['s.reqClassMask', 1 << $this->category[1] - 1, '&']; } break; case 7: // Abilities $this->filter['classPanel'] = true; array_push($visibleCols, 'level', 'singleclass', 'schools'); $conditions[] = ['s.typeCat', [7, -2]]; $conditions[] = [['s.cuFlags', SPELL_CU_TRIGGERED | SPELL_CU_TALENT, '&'], 0]; // Runeforging listed multiple times, exclude from explicit skill-listing // if (isset($this->category[1]) && $this->category[1] == 6 && isset($this->category[2]) && $this->category[2] != 776) // $conditions[] = [['s.attributes0', 0x80, '&'], 0]; // else // $conditions[] = [ // [['s.attributes0', 0x80, '&'], 0], // ~SPELL_ATTR0_HIDDEN_CLIENTSIDE // ['s.attributes0', 0x20, '&'], // SPELL_ATTR0_TRADESPELL (DK: Runeforging) // 'OR' // ]; if (isset($this->category[2])) { $conditions[] = ['OR', ['s.skillLine1', $this->category[2]], ['AND', ['s.skillLine1', 0, '>'], ['s.skillLine2OrMask', $this->category[2]]]]; } else { if (isset($this->category[1])) { $conditions[] = ['OR', ['s.skillLine1', $this->validCats[7][$this->category[1]]], ['AND', ['s.skillLine1', 0, '>'], ['s.skillLine2OrMask', $this->validCats[7][$this->category[1]]]]]; } } break; case 9: // Secondary Skills array_push($visibleCols, 'source'); $conditions[] = ['s.typeCat', 9]; if (isset($this->category[1])) { $conditions[] = ['OR', ['s.skillLine1', $this->category[1]], ['AND', ['s.skillLine1', 0, '>'], ['s.skillLine2OrMask', $this->category[1]]]]; if (!empty($this->shortFilter[$this->category[1]])) { $sf = $this->shortFilter[$this->category[1]]; $txt = ''; if ($sf[0] && $sf[1]) { $txt = sprintf(Lang::spell('relItems', 'crafted'), $sf[0]) . Lang::spell('relItems', 'link') . sprintf(Lang::spell('relItems', 'recipes'), $sf[1]); } else { if ($sf[0]) { $txt = sprintf(Lang::spell('relItems', 'crafted'), $sf[0]); } else { if ($sf[1]) { $txt = sprintf(Lang::spell('relItems', 'recipes'), $sf[1]); } } } $note = Lang::spell('cat', $this->category[0], $this->category[1]); if (is_array($note)) { $note = $note[0]; } $tabData['note'] = sprintf(Lang::spell('relItems', 'base'), $txt, $note); $tabData['sort'] = ['skill', 'name']; } } break; case 11: // Professions array_push($visibleCols, 'source'); $conditions[] = ['s.typeCat', 11]; if (isset($this->category[2])) { if ($this->category[2] == 9787) { // general weaponsmithing $conditions[] = ['s.reqSpellId', [9787, 17039, 17040, 17041]]; } else { $conditions[] = ['s.reqSpellId', $this->category[2]]; } } else { if (isset($this->category[1])) { $conditions[] = ['s.skillLine1', $this->category[1]]; } } if (isset($this->category[1])) { $conditions[] = ['s.skillLine1', $this->category[1]]; if (!empty($this->shortFilter[$this->category[1]])) { $sf = $this->shortFilter[$this->category[1]]; $txt = ''; if ($sf[0] && $sf[1]) { $txt = sprintf(Lang::spell('relItems', 'crafted'), $sf[0]) . Lang::spell('relItems', 'link') . sprintf(Lang::spell('relItems', 'recipes'), $sf[1]); } else { if ($sf[0]) { $txt = sprintf(Lang::spell('relItems', 'crafted'), $sf[0]); } else { if ($sf[1]) { $txt = sprintf(Lang::spell('relItems', 'recipes'), $sf[1]); } } } $note = Lang::spell('cat', $this->category[0], $this->category[1]); if (is_array($note)) { $note = $note[0]; } $tabData['note'] = sprintf(Lang::spell('relItems', 'base'), $txt, $note); $tabData['sort'] = ['skill', 'name']; } } break; case 0: // misc. Spells & triggered player abilities array_push($visibleCols, 'level'); $conditions[] = ['OR', ['s.typeCat', 0], ['AND', ['s.cuFlags', SPELL_CU_TRIGGERED, '&'], ['s.typeCat', [7, -2]]]]; break; } } if (!User::isInGroup(U_GROUP_EMPLOYEE)) { $conditions[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0]; } if ($_ = $this->filterObj->getConditions()) { $conditions[] = $_; } $spells = new SpellList($conditions); $this->extendGlobalData($spells->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED)); $tabData['data'] = array_values($spells->getListviewData()); // recreate form selection $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(); if (!empty($this->filter['fi']['extraCols'])) { $tabData['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)'; } // create note if search limit was exceeded; overwriting 'note' is intentional if ($spells->getMatches() > CFG_SQL_LIMIT_DEFAULT) { $tabData['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_spellsfound', $spells->getMatches(), CFG_SQL_LIMIT_DEFAULT); $tabData['_truncated'] = 1; } if ($this->filterObj->error) { $tabData['_errors'] = 1; } // add source to cols if explicitly searching for it if ($_ = $this->filterObj->getForm('setCriteria', true)) { if (in_array(9, $_['cr']) && !in_array('source', $visibleCols)) { $visibleCols[] = 'source'; } } $mask = $spells->hasSetFields(['reagent1', 'skillLines', 'trainingCost', 'reqClassMask']); if ($mask & 0x1) { $visibleCols[] = 'reagents'; } if (!($mask & 0x2) && $this->category && !in_array($this->category[0], [9, 11])) { $hiddenCols[] = 'skill'; } if ($mask & 0x4) { $visibleCols[] = 'trainingcost'; } if ($mask & 0x8 && !in_array('singleclass', $visibleCols)) { $visibleCols[] = 'singleclass'; } if ($visibleCols) { $tabData['visibleCols'] = $visibleCols; } if ($hiddenCols) { $tabData['hiddenCols'] = $hiddenCols; } $this->lvTabs[] = ['spell', $tabData]; // sort for dropdown-menus Lang::sort('game', 'ra'); Lang::sort('game', 'cl'); Lang::sort('game', 'sc'); Lang::sort('game', 'me'); }