Esempio n. 1
0
 protected function generateContent()
 {
     $conditions = [];
     if (!User::isInGroup(U_GROUP_EMPLOYEE)) {
         $conditions[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0];
     }
     $races = new CharRaceList($conditions);
     if (!$races->error) {
         $this->lvTabs[] = ['race', ['data' => array_values($races->getListviewData())]];
     }
 }
Esempio n. 2
0
 private function _searchCharRace($cndBase)
 {
     $result = [];
     $cnd = array_merge($cndBase, [$this->createLookup()]);
     $races = new CharRaceList($cnd);
     if ($data = $races->getListviewData()) {
         if ($this->searchMask & SEARCH_TYPE_OPEN) {
             foreach ($races->iterate() as $__) {
                 $data[$races->id]['param1'] = '"race_' . strToLower($races->getField('fileString')) . '_male"';
             }
         }
         $result = array('type' => TYPE_RACE, 'appendix' => ' (Race)', 'matches' => $races->getMatches(), 'file' => CharRaceList::$brickFile, 'data' => $data, 'params' => []);
         if ($races->getMatches() > $this->maxResults) {
             // $result['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_', $races->getMatches(), $this->maxResults);
             $result['params']['_truncated'] = 1;
         }
     }
     return $result;
 }
Esempio n. 3
0
 protected function generateContent()
 {
     /****************/
     /* Main Content */
     /****************/
     $this->headIcons = [$this->subject->getField('iconString')];
     $this->redButtons = array(BUTTON_WOWHEAD => true, BUTTON_LINKS => true);
     if ($_ = $this->subject->getField('description', true)) {
         $this->extraText = $_;
     }
     /**************/
     /* Extra Tabs */
     /**************/
     if (in_array($this->cat, [-5, 9, 11])) {
         // tab: recipes [spells] (crafted)
         $condition = array(['OR', ['s.reagent1', 0, '>'], ['s.reagent2', 0, '>'], ['s.reagent3', 0, '>'], ['s.reagent4', 0, '>'], ['s.reagent5', 0, '>'], ['s.reagent6', 0, '>'], ['s.reagent7', 0, '>'], ['s.reagent8', 0, '>']], ['OR', ['s.skillLine1', $this->typeId], ['AND', ['s.skillLine1', 0, '>'], ['s.skillLine2OrMask', $this->typeId]]], CFG_SQL_LIMIT_NONE);
         $recipes = new SpellList($condition);
         // also relevant for 3
         if (!$recipes->error) {
             $this->extendGlobalData($recipes->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
             $this->lvTabs[] = array('file' => 'spell', 'data' => $recipes->getListviewData(), 'params' => array('id' => 'recipes', 'name' => '$LANG.tab_recipes', 'visibleCols' => "\$['reagents', 'source']", 'note' => sprintf(Util::$filterResultString, '?spells=' . $this->cat . '.' . $this->typeId . '&filter=cr=20;crs=1;crv=0')));
         }
         // tab: recipe Items [items] (Books)
         $filterRecipe = [null, 165, 197, 202, 164, 185, 171, 129, 333, 356, 755, 773, 186, 182];
         $conditions = array(['requiredSkill', $this->typeId], ['class', ITEM_CLASS_RECIPE], CFG_SQL_LIMIT_NONE);
         $recipeItems = new ItemList($conditions);
         if (!$recipeItems->error) {
             $this->extendGlobalData($recipeItems->getJSGlobals(GLOBALINFO_SELF));
             if ($_ = array_search($this->typeId, $filterRecipe)) {
                 $_ = sprintf(Util::$filterResultString, "?items=9." . $_);
             }
             $this->lvTabs[] = array('file' => 'item', 'data' => $recipeItems->getListviewData(), 'params' => array('id' => 'recipe-items', 'name' => '$LANG.tab_recipeitems', 'note' => $_));
         }
         // tab: crafted items [items]
         $filterItem = [null, 171, 164, 185, 333, 202, 129, 755, 165, 186, 197, null, null, 356, 182, 773];
         $created = [];
         foreach ($recipes->iterate() as $__) {
             if ($idx = $recipes->canCreateItem()) {
                 foreach ($idx as $i) {
                     $created[] = $recipes->getField('effect' . $i . 'CreateItemId');
                 }
             }
         }
         if ($created) {
             $created = new ItemList(array(['i.id', $created], CFG_SQL_LIMIT_NONE));
             if (!$created->error) {
                 $this->extendGlobalData($created->getJSGlobals(GLOBALINFO_SELF));
                 if ($_ = array_search($this->typeId, $filterItem)) {
                     $_ = sprintf(Util::$filterResultString, "?items&filter=cr=86;crs=" . $_ . ";crv=0");
                 }
                 $this->lvTabs[] = array('file' => 'item', 'data' => $created->getListviewData(), 'params' => array('id' => 'crafted-items', 'name' => '$LANG.tab_crafteditems', 'note' => $_));
             }
         }
         // tab: required by [item]
         $conditions = array(['requiredSkill', $this->typeId], ['class', ITEM_CLASS_RECIPE, '!'], CFG_SQL_LIMIT_NONE);
         $reqBy = new ItemList($conditions);
         if (!$reqBy->error) {
             $this->extendGlobalData($reqBy->getJSGlobals(GLOBALINFO_SELF));
             if ($_ = array_search($this->typeId, $filterItem)) {
                 $_ = sprintf(Util::$filterResultString, "?items&filter=cr=99:168;crs=" . $_ . ":2;crv=0:0");
             }
             $this->lvTabs[] = array('file' => 'item', 'data' => $reqBy->getListviewData(), 'params' => array('id' => 'required-by', 'name' => '$LANG.tab_requiredby', 'note' => $_));
         }
         // tab: required by [itemset]
         $conditions = array(['skillId', $this->typeId], CFG_SQL_LIMIT_NONE);
         $reqBy = new ItemsetList($conditions);
         if (!$reqBy->error) {
             $this->extendGlobalData($reqBy->getJSGlobals(GLOBALINFO_SELF));
             $this->lvTabs[] = array('file' => 'itemset', 'data' => $reqBy->getListviewData(), 'params' => array('id' => 'required-by-set', 'name' => '$LANG.tab_requiredby'));
         }
     }
     // tab: spells [spells] (exclude first tab)
     $reqClass = 0x0;
     $reqRace = 0x0;
     $condition = array(['AND', ['s.reagent1', 0], ['s.reagent2', 0], ['s.reagent3', 0], ['s.reagent4', 0], ['s.reagent5', 0], ['s.reagent6', 0], ['s.reagent7', 0], ['s.reagent8', 0]], ['OR', ['s.skillLine1', $this->typeId], ['AND', ['s.skillLine1', 0, '>'], ['s.skillLine2OrMask', $this->typeId]]], CFG_SQL_LIMIT_NONE);
     foreach (Util::$skillLineMask as $line1 => $sets) {
         foreach ($sets as $idx => $set) {
             if ($set[1] == $this->typeId) {
                 $condition[1][] = array('AND', ['s.skillLine1', $line1], ['s.skillLine2OrMask', 1 << $idx, '&']);
                 break 2;
             }
         }
     }
     $spells = new SpellList($condition);
     if (!$spells->error) {
         foreach ($spells->iterate() as $__) {
             $reqClass |= $spells->getField('reqClassMask');
             $reqRace |= $spells->getField('reqRaceMask');
         }
         $this->extendGlobalData($spells->getJSGlobals(GLOBALINFO_SELF));
         $lv = array('file' => 'spell', 'data' => $spells->getListviewData(), 'params' => ['visibleCols' => "\$['source']"]);
         switch ($this->cat) {
             case -4:
                 $lv['params']['note'] = sprintf(Util::$filterResultString, '?spells=-4');
                 break;
             case 7:
                 if ($this->typeId != 769) {
                     // Internal
                     $lv['params']['note'] = sprintf(Util::$filterResultString, '?spells=' . $this->cat . '.' . (log($reqClass, 2) + 1) . '.' . $this->typeId);
                 }
                 // doesn't matter what spell; reqClass should be identical for all Class Spells
                 break;
             case 9:
             case 11:
                 $lv['params']['note'] = sprintf(Util::$filterResultString, '?spells=' . $this->cat . '.' . $this->typeId);
                 break;
         }
         $this->lvTabs[] = $lv;
     }
     // tab: trainers [npcs]
     if (in_array($this->cat, [-5, 6, 7, 8, 9, 11])) {
         $list = [];
         if (!empty(Util::$trainerTemplates[TYPE_SKILL][$this->typeId])) {
             $list = DB::World()->selectCol('SELECT DISTINCT entry FROM npc_trainer WHERE spell IN (?a) AND entry < 200000', Util::$trainerTemplates[TYPE_SKILL][$this->typeId]);
         } else {
             $mask = 0;
             foreach (Util::$skillLineMask[-3] as $idx => $pair) {
                 if ($pair[1] == $this->typeId) {
                     $mask |= 1 << $idx;
                 }
             }
             $spellIds = DB::Aowow()->selectCol('SELECT id FROM ?_spell WHERE typeCat IN (-11, 9) AND (skillLine1 = ?d OR (skillLine1 > 0 AND skillLine2OrMask = ?d) {OR (skillLine1 = -3 AND skillLine2OrMask = ?d)})', $this->typeId, $this->typeId, $mask ?: DBSIMPLE_SKIP);
             $list = $spellIds ? DB::World()->selectCol('
                 SELECT    IF(t1.entry > 200000, t2.entry, t1.entry)
                 FROM      npc_trainer t1
                 LEFT JOIN npc_trainer t2 ON t2.spell = -t1.entry
                 WHERE     t1.spell IN (?a)', $spellIds) : [];
         }
         if ($list) {
             $this->addJS('?data=zones&locale=' . User::$localeId . '&t=' . $_SESSION['dataKey']);
             $trainer = new CreatureList(array(CFG_SQL_LIMIT_NONE, ['ct.id', $list], ['s.guid', NULL, '!'], ['ct.npcflag', 0x10, '&']));
             if (!$trainer->error) {
                 $this->extendGlobalData($trainer->getJSGlobals());
                 $this->lvTabs[] = array('file' => 'creature', 'data' => $trainer->getListviewData(), 'params' => array('id' => 'trainer', 'name' => '$LANG.tab_trainers'));
             }
         }
     }
     // tab: quests [quests]
     if (in_array($this->cat, [9, 11])) {
         $sort = 0;
         switch ($this->typeId) {
             case 182:
                 $sort = 24;
                 break;
                 // Herbalism
             // Herbalism
             case 356:
                 $sort = 101;
                 break;
                 // Fishing
             // Fishing
             case 164:
                 $sort = 121;
                 break;
                 // Blacksmithing
             // Blacksmithing
             case 171:
                 $sort = 181;
                 break;
                 // Alchemy
             // Alchemy
             case 165:
                 $sort = 182;
                 break;
                 // Leatherworking
             // Leatherworking
             case 202:
                 $sort = 201;
                 break;
                 // Engineering
             // Engineering
             case 197:
                 $sort = 264;
                 break;
                 // Tailoring
             // Tailoring
             case 185:
                 $sort = 304;
                 break;
                 // Cooking
             // Cooking
             case 129:
                 $sort = 324;
                 break;
                 // First Aid
             // First Aid
             case 773:
                 $sort = 371;
                 break;
                 // Inscription
             // Inscription
             case 755:
                 $sort = 373;
                 break;
                 // Jewelcrafting
         }
         if ($sort) {
             $quests = new QuestList(array(['zoneOrSort', -$sort], CFG_SQL_LIMIT_NONE));
             if (!$quests->error) {
                 $this->extendGlobalData($quests->getJSGlobals());
                 $this->lvTabs[] = array('file' => 'quest', 'data' => $quests->getListviewData(), 'params' => []);
             }
         }
     }
     // tab: related classes (apply classes from [spells])
     $class = [];
     for ($i = 0; $i < 11; $i++) {
         if ($reqClass & 1 << $i) {
             $class[] = $i + 1;
         }
     }
     if ($class) {
         $classes = new CharClassList(array(['id', $class]));
         if (!$classes->error) {
             $this->lvTabs[] = array('file' => 'class', 'data' => $classes->getListviewData(), 'params' => []);
         }
     }
     // tab: related races (apply races from [spells])
     $race = [];
     for ($i = 0; $i < 12; $i++) {
         if ($reqRace & 1 << $i) {
             $race[] = $i + 1;
         }
     }
     if ($race) {
         $races = new CharRaceList(array(['id', $race]));
         if (!$races->error) {
             $this->lvTabs[] = array('file' => 'race', 'data' => $races->getListviewData(), 'params' => []);
         }
     }
 }
Esempio n. 4
0
 protected function generateContent()
 {
     $this->addJS('?data=zones&locale=' . User::$localeId . '&t=' . $_SESSION['dataKey']);
     $infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
     $_mask = 1 << $this->typeId - 1;
     $tcClassId = [null, 8, 3, 1, 5, 4, 9, 6, 2, 7, null, 0];
     // see TalentCalc.js
     /***********/
     /* Infobox */
     /***********/
     // hero class
     if ($this->subject->getField('flags') & 0x40) {
         $infobox[] = '[tooltip=tooltip_heroclass]' . Lang::game('heroClass') . '[/tooltip]';
     }
     // resource
     if ($this->typeId == 11) {
         // special Druid case
         $infobox[] = Lang::game('resources') . Lang::main('colon') . '[tooltip name=powertype1]' . Lang::game('st', 0) . ', ' . Lang::game('st', 31) . ', ' . Lang::game('st', 2) . '[/tooltip][span class=tip tooltip=powertype1]' . Util::ucFirst(Lang::spell('powerTypes', 0)) . '[/span], ' . '[tooltip name=powertype2]' . Lang::game('st', 5) . ', ' . Lang::game('st', 8) . '[/tooltip][span class=tip tooltip=powertype2]' . Util::ucFirst(Lang::spell('powerTypes', 1)) . '[/span], ' . '[tooltip name=powertype8]' . Lang::game('st', 1) . '[/tooltip][span class=tip tooltip=powertype8]' . Util::ucFirst(Lang::spell('powerTypes', 3)) . '[/span]';
     } else {
         if ($this->typeId == 6) {
             // special DK case
             $infobox[] = Lang::game('resources') . Lang::main('colon') . '[span]' . Util::ucFirst(Lang::spell('powerTypes', 5)) . ', ' . Util::ucFirst(Lang::spell('powerTypes', $this->subject->getField('powerType'))) . '[/span]';
         } else {
             // regular case
             $infobox[] = Lang::game('resource') . Lang::main('colon') . '[span]' . Util::ucFirst(Lang::spell('powerTypes', $this->subject->getField('powerType'))) . '[/span]';
         }
     }
     // roles
     $roles = [];
     for ($i = 0; $i < 4; $i++) {
         if ($this->subject->getField('roles') & 1 << $i) {
             $roles[] = (count($roles) == 2 ? "\n" : '') . Lang::game('_roles', $i);
         }
     }
     if ($roles) {
         $infobox[] = (count($roles) > 1 ? Lang::game('roles') : Lang::game('role')) . Lang::main('colon') . implode(', ', $roles);
     }
     // specs
     $specList = [];
     $skills = new SkillList(array(['id', $this->subject->getField('skills')]));
     foreach ($skills->iterate() as $k => $__) {
         $specList[$k] = '[icon name=' . $skills->getField('iconString') . '][url=?spells=7.' . $this->typeId . '.' . $k . ']' . $skills->getField('name', true) . '[/url][/icon]';
     }
     if ($specList) {
         $infobox[] = Lang::game('specs') . Lang::main('colon') . '[ul][li]' . implode('[/li][li]', $specList) . '[/li][/ul]';
     }
     /****************/
     /* Main Content */
     /****************/
     $this->infobox = '[ul][li]' . implode('[/li][li]', $infobox) . '[/li][/ul]';
     $this->expansion = Util::$expansionString[$this->subject->getField('expansion')];
     $this->headIcons = ['class_' . strtolower($this->subject->getField('fileString'))];
     $this->redButtons = array(BUTTON_LINKS => ['color' => '', 'linkId' => ''], BUTTON_WOWHEAD => true, BUTTON_TALENT => ['href' => '?talent#' . Util::$tcEncoding[$tcClassId[$this->typeId] * 3], 'pet' => false], BUTTON_FORUM => false);
     /**************/
     /* Extra Tabs */
     /**************/
     // Tab: Spells (grouped)
     //     '$LANG.tab_armorproficiencies',
     //     '$LANG.tab_weaponskills',
     //     '$LANG.tab_glyphs',
     //     '$LANG.tab_abilities',
     //     '$LANG.tab_talents',
     $conditions = array(['s.typeCat', [-13, -11, -2, 7]], [['s.cuFlags', SPELL_CU_TRIGGERED | CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0], ['OR', ['s.reqClassMask', $_mask, '&'], ['s.skillLine1', $this->subject->getField('skills')], ['AND', ['s.skillLine1', 0, '>'], ['s.skillLine2OrMask', $this->subject->getField('skills')]]], ['OR', ['s.cuFlags', SPELL_CU_LAST_RANK, '&'], ['s.rankNo', 0]]);
     $genSpells = new SpellList($conditions);
     if (!$genSpells->error) {
         $this->extendGlobalData($genSpells->getJSGlobals(GLOBALINFO_SELF));
         $this->lvTabs[] = array('file' => 'spell', 'data' => $genSpells->getListviewData(), 'params' => array('id' => 'spells', 'name' => '$LANG.tab_spells', 'visibleCols' => "\$['level', 'schools', 'type', 'classes']", 'hiddenCols' => "\$['reagents', 'skill']", 'sort' => "\$['-level', 'type', 'name']", 'computeDataFunc' => '$Listview.funcBox.initSpellFilter', 'onAfterCreate' => '$Listview.funcBox.addSpellIndicator'));
     }
     // Tab: Items (grouped)
     $conditions = array(['requiredClass', 0, '>'], ['requiredClass', $_mask, '&'], [['requiredClass', CLASS_MASK_ALL, '&'], CLASS_MASK_ALL, '!'], ['itemset', 0], 0);
     $items = new ItemList($conditions);
     if (!$items->error) {
         $this->extendGlobalData($items->getJSGlobals());
         if (!$items->hasDiffFields(['requiredRace'])) {
             $hidden = "\$['side']";
         }
         $this->lvTabs[] = array('file' => 'item', 'data' => $items->getListviewData(), 'params' => array('id' => 'items', 'name' => '$LANG.tab_items', 'visibleCols' => "\$['dps', 'armor', 'slot']", 'hiddenCols' => isset($hidden) ? $hidden : null, 'computeDataFunc' => '$Listview.funcBox.initSubclassFilter', 'onAfterCreate' => '$Listview.funcBox.addSubclassIndicator', 'note' => sprintf(Util::$filterResultString, '?items&filter=cr=152;crs=' . $this->typeId . ';crv=0'), '_truncated' => 1));
     }
     // Tab: Quests
     $conditions = array(['reqClassMask', $_mask, '&'], [['reqClassMask', CLASS_MASK_ALL, '&'], CLASS_MASK_ALL, '!']);
     $quests = new QuestList($conditions);
     if (!$quests->error) {
         $this->extendGlobalData($quests->getJSGlobals());
         $this->lvTabs[] = array('file' => 'quest', 'data' => $quests->getListviewData(), 'params' => ['sort' => "\$['reqlevel', 'name']"]);
     }
     // Tab: Itemsets
     $sets = new ItemsetList(array(['classMask', $_mask, '&']));
     if (!$sets->error) {
         $this->extendGlobalData($sets->getJSGlobals(GLOBALINFO_SELF));
         $this->lvTabs[] = array('file' => 'itemset', 'data' => $sets->getListviewData(), 'params' => array('note' => sprintf(Util::$filterResultString, '?itemsets&filter=cl=' . $this->typeId), 'hiddenCols' => "\$['classes']", 'sort' => "\$['-level', 'name']"));
     }
     // Tab: Trainer
     $conditions = array(['npcflag', 0x30, '&'], ['trainerType', 0], ['trainerClass', $this->typeId]);
     $trainer = new CreatureList($conditions);
     if (!$trainer->error) {
         $this->lvTabs[] = array('file' => 'creature', 'data' => $trainer->getListviewData(), 'params' => array('id' => 'trainers', 'name' => '$LANG.tab_trainers'));
     }
     // Tab: Races
     $races = new CharRaceList(array(['classMask', $_mask, '&']));
     if (!$races->error) {
         $this->lvTabs[] = array('file' => 'race', 'data' => $races->getListviewData(), 'params' => []);
     }
 }
Esempio n. 5
0
 private function _searchCharRace($cndBase)
 {
     $cnd = array_merge($cndBase, [$this->createLookup()]);
     $races = new CharRaceList($cnd);
     if ($data = $races->getListviewData()) {
         $result['data'] = array_values($data);
         $osInfo = [TYPE_RACE, ' (Race)', $races->getMatches(), []];
         if ($this->searchMask & SEARCH_TYPE_OPEN) {
             foreach ($races->iterate() as $id => $__) {
                 $osInfo[3][$id] = 'race_' . strToLower($races->getField('fileString')) . '_male';
             }
         }
         if ($races->getMatches() > $this->maxResults) {
             // $result['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_', $races->getMatches(), $this->maxResults);
             $result['_truncated'] = 1;
         }
         return ['race', $result, null, $osInfo];
     }
     return false;
 }