typeId = intVal($id); $this->subject = new PetList(array(['id', $this->typeId])); if ($this->subject->error) $this->notFound(Lang::game('pet'), Lang::pet('notFound')); $this->name = $this->subject->getField('name', true); } protected function generatePath() { $this->path[] = $this->subject->getField('type'); } protected function generateTitle() { array_unshift($this->title, $this->name, Util::ucFirst(Lang::game('pet'))); } protected function generateContent() { $this->addJS('?data=zones&locale='.User::$localeId.'&t='.$_SESSION['dataKey']); /***********/ /* Infobox */ /***********/ $infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags')); // level range $infobox[] = Lang::game('level').Lang::main('colon').$this->subject->getField('minLevel').' - '.$this->subject->getField('maxLevel'); // exotic if ($this->subject->getField('exotic')) $infobox[] = '[url=?spell=53270]'.Lang::pet('exotic').'[/url]'; /****************/ /* Main Content */ /****************/ $this->infobox = '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]'; $this->headIcons = [$this->subject->getField('iconString')]; $this->expansion = Util::$expansionString[$this->subject->getField('expansion')]; $this->redButtons = array( BUTTON_WOWHEAD => true, BUTTON_LINKS => true, BUTTON_TALENT => ['href' => '?petcalc#'.Util::$tcEncoding[(int)($this->typeId / 10)] . Util::$tcEncoding[(2 * ($this->typeId % 10) + ($this->subject->getField('exotic') ? 1 : 0))], 'pet' => true] ); /**************/ /* Extra Tabs */ /**************/ // tab: tameable & gallery $condition = array( ['ct.type', 1], // Beast ['ct.typeFlags', 0x1, '&'], // tameable ['ct.family', $this->typeId], // displayed petType [ 'OR', // at least neutral to at least one faction ['ft.A', 1, '<'], ['ft.H', 1, '<'] ] ); $tng = new CreatureList($condition); $this->lvTabs[] = array( 'file' => 'creature', 'data' => $tng->getListviewData(NPCINFO_TAMEABLE), 'params' => array( 'name' => '$LANG.tab_tameable', 'hiddenCols' => "$['type']", 'visibleCols' => "$['skin']", 'note' => sprintf(Util::$filterResultString, '?npcs=1&filter=fa=38'), 'id' => 'tameable' ) ); $this->lvTabs[] = array( 'file' => 'model', 'data' => $tng->getListviewData(NPCINFO_MODEL), 'params' => [] ); // tab: diet $list = []; $mask = $this->subject->getField('foodMask'); for ($i = 1; $i < 7; $i++) if ($mask & (1 << ($i - 1))) $list[] = $i; $food = new ItemList(array(['i.subClass', [5, 8]], ['i.FoodType', $list], CFG_SQL_LIMIT_NONE)); $this->extendGlobalData($food->getJSGlobals()); $this->lvTabs[] = array( 'file' => 'item', 'data' => $food->getListviewData(), 'params' => array( 'name' => '$LANG.diet', 'hiddenCols' => "$['source', 'slot', 'side']", 'sort' => "$['level']", 'id' => 'diet' ) ); // tab: spells $mask = 0x0; foreach (Util::$skillLineMask[-1] as $idx => $pair) { if ($pair[0] == $this->typeId) { $mask = 1 << $idx; break; } } $conditions = [ ['s.typeCat', -3], // Pet-Ability [ 'OR', // match: first skillLine ['skillLine1', $this->subject->getField('skillLineId')], // match: second skillLine (if not mask) ['AND', ['skillLine1', 0, '>'], ['skillLine2OrMask', $this->subject->getField('skillLineId')]], // match: skillLineMask (if mask) ['AND', ['skillLine1', -1], ['skillLine2OrMask', $mask, '&']] ] ]; $spells = new SpellList($conditions); $this->extendGlobalData($spells->getJSGlobals(GLOBALINFO_SELF)); $this->lvTabs[] = array( 'file' => 'spell', 'data' => $spells->getListviewData(), 'params' => array( 'name' => '$LANG.tab_abilities', 'visibleCols' => "$['schools', 'level']", 'id' => 'abilities' ) ); // tab: talents $conditions = array( ['s.typeCat', -7], [ // last rank or unranked 'OR', ['s.cuFlags', SPELL_CU_LAST_RANK, '&'], ['s.rankNo', 0] ] ); switch ($this->subject->getField('type')) { case 0: $conditions[] = ['s.cuFlags', SPELL_CU_PET_TALENT_TYPE0, '&']; break; case 1: $conditions[] = ['s.cuFlags', SPELL_CU_PET_TALENT_TYPE1, '&']; break; case 2: $conditions[] = ['s.cuFlags', SPELL_CU_PET_TALENT_TYPE2, '&']; break; } $talents = new SpellList($conditions); $this->extendGlobalData($talents->getJSGlobals(GLOBALINFO_SELF)); $this->lvTabs[] = array( 'file' => 'spell', 'data' => $talents->getListviewData(), 'params' => array( 'visibleCols' => "$['tier', 'level']", 'name' => '$LANG.tab_talents', 'id' => 'talents', 'sort' => "$['tier', 'name']", '_petTalents' => 1 ) ); } } ?>