Example #1
0
 protected function generateContent()
 {
     $conditions = [];
     if (!User::isInGroup(U_GROUP_EMPLOYEE)) {
         $conditions[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0];
     }
     if ($_ = $this->filterObj->getConditions()) {
         $conditions[] = $_;
     }
     $itemsets = new ItemsetList($conditions);
     $this->extendGlobalData($itemsets->getJSGlobals());
     // 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();
     $this->addJS('?data=weight-presets&locale=' . User::$localeId . '&t=' . $_SESSION['dataKey']);
     $lv = array('file' => 'itemset', 'data' => $itemsets->getListviewData(), 'params' => []);
     if (!empty($this->filter['fi']['extraCols'])) {
         $lv['params']['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)';
     }
     // create note if search limit was exceeded
     if ($itemsets->getMatches() > CFG_SQL_LIMIT_DEFAULT) {
         $lv['params']['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_itemsetsfound', $itemsets->getMatches(), CFG_SQL_LIMIT_DEFAULT);
         $lv['params']['_truncated'] = 1;
     }
     if ($this->filterObj->error) {
         $lv['params']['_errors'] = '$1';
     }
     $this->lvTabs[] = $lv;
     // sort for dropdown-menus
     Lang::sort('itemset', 'notes', SORT_NATURAL);
     Lang::sort('game', 'si');
 }
Example #2
0
 protected function generateContent()
 {
     $conditions = [];
     if (!User::isInGroup(U_GROUP_EMPLOYEE)) {
         $conditions[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0];
     }
     if ($this->category) {
         $conditions[] = ['typeCat', (int) $this->category[0]];
     }
     // recreate form selection
     $this->filter = $this->filterObj->getForm('form');
     $this->filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : null;
     $this->filter['fi'] = $this->filterObj->getForm();
     if ($_ = $this->filterObj->getConditions()) {
         $conditions[] = $_;
     }
     $tabData = ['data' => []];
     $objects = new GameObjectList($conditions, ['extraOpts' => $this->filterObj->extraOpts]);
     if (!$objects->error) {
         $tabData['data'] = array_values($objects->getListviewData());
         if ($objects->hasSetFields(['reqSkill'])) {
             $tabData['visibleCols'] = ['skill'];
         }
         // create note if search limit was exceeded
         if ($objects->getMatches() > CFG_SQL_LIMIT_DEFAULT) {
             $tabData['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_objectsfound', $objects->getMatches(), CFG_SQL_LIMIT_DEFAULT);
             $tabData['_truncated'] = 1;
         }
         if ($this->filterObj->error) {
             $tabData['_errors'] = 1;
         }
     }
     $this->lvTabs[] = ['object', $tabData];
 }
Example #3
0
 protected function generateContent()
 {
     $conditions = [];
     if (!User::isInGroup(U_GROUP_EMPLOYEE)) {
         // unlisted factions
         $conditions[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0];
     }
     if (isset($this->category[1])) {
         $conditions[] = ['parentFactionId', $this->category[1]];
     } else {
         if (isset($this->category[0])) {
             if ($this->category[0]) {
                 $subs = DB::Aowow()->selectCol('SELECT id FROM ?_factions WHERE parentFactionId = ?d', $this->category[0]);
             } else {
                 $subs = [0];
             }
             $conditions[] = ['OR', ['parentFactionId', $subs], ['id', $subs]];
         }
     }
     $data = [];
     $factions = new FactionList($conditions);
     if (!$factions->error) {
         $data = $factions->getListviewData();
     }
     $this->lvTabs[] = array('file' => 'faction', 'data' => $data, 'params' => []);
 }
Example #4
0
 protected function generateContent()
 {
     $conditions = [];
     if (!User::isInGroup(U_GROUP_EMPLOYEE)) {
         $conditions[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0];
     }
     // include child categories if current category is empty
     if ($this->category) {
         $conditions[] = ['category', (int) end($this->category)];
     }
     // recreate form selection
     $this->filter = $this->filterObj->getForm('form');
     $this->filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : null;
     $this->filter['fi'] = $this->filterObj->getForm();
     if ($fiCnd = $this->filterObj->getConditions()) {
         $conditions[] = $fiCnd;
     }
     $acvList = new AchievementList($conditions);
     if (!$acvList->getMatches()) {
         $curCats = $catList = [!empty($this->category) ? (int) end($this->category) : 0];
         while ($curCats) {
             $curCats = DB::Aowow()->SelectCol('SELECT Id FROM ?_achievementcategory WHERE parentCategory IN (?a)', $curCats);
             $catList = array_merge($catList, $curCats);
         }
         $conditions = [];
         if ($fiCnd) {
             $conditions[] = $fiCnd;
         }
         if ($catList) {
             $conditions[] = ['category', $catList];
         }
         $acvList = new AchievementList($conditions);
     }
     $params = $data = [];
     if (!$acvList->error) {
         $data = $acvList->getListviewData();
         // fill g_items, g_titles, g_achievements
         $this->extendGlobalData($acvList->getJSGlobals());
         // if we are have different cats display field
         if ($acvList->hasDiffFields(['category'])) {
             $params['visibleCols'] = "\$['category']";
         }
         if (!empty($this->filter['fi']['extraCols'])) {
             $params['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)';
         }
         // create note if search limit was exceeded
         if ($acvList->getMatches() > CFG_SQL_LIMIT_DEFAULT) {
             $params['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_achievementsfound', $acvList->getMatches(), CFG_SQL_LIMIT_DEFAULT);
             $params['_truncated'] = 1;
         }
         if ($this->filterObj->error) {
             $params['_errors'] = '$1';
         }
     }
     $this->lvTabs[] = array('file' => 'achievement', 'data' => $data, 'params' => $params);
     // sort for dropdown-menus in filter
     Lang::sort('game', 'si');
 }
Example #5
0
 public function __construct(array $params)
 {
     parent::__construct($params);
     // requires 'action' parameter in any case
     if (!$this->_get['action'] || !$this->params) {
         return;
     }
     if ($this->params[0] == 'screenshots') {
         if (!User::isInGroup(U_GROUP_STAFF | U_GROUP_SCREENSHOT)) {
             // comment_mod, handleSSmod, vi_mod ?
             return;
         }
         if ($this->_get['action'] == 'list') {
             $this->handler = 'ssList';
         } else {
             if ($this->_get['action'] == 'manage') {
                 $this->handler = 'ssManage';
             } else {
                 if ($this->_get['action'] == 'editalt') {
                     $this->handler = 'ssEditAlt';
                 } else {
                     if ($this->_get['action'] == 'approve') {
                         $this->handler = 'ssApprove';
                     } else {
                         if ($this->_get['action'] == 'sticky') {
                             $this->handler = 'ssSticky';
                         } else {
                             if ($this->_get['action'] == 'delete') {
                                 $this->handler = 'ssDelete';
                             } else {
                                 if ($this->_get['action'] == 'relocate') {
                                     $this->handler = 'ssRelocate';
                                 }
                             }
                         }
                     }
                 }
             }
         }
     } else {
         if ($this->params[0] == 'siteconfig') {
             if (!User::isInGroup(U_GROUP_DEV | U_GROUP_ADMIN)) {
                 return;
             }
             if ($this->_get['action'] == 'add') {
                 $this->handler = 'confAdd';
             } else {
                 if ($this->_get['action'] == 'remove') {
                     $this->handler = 'confRemove';
                 } else {
                     if ($this->_get['action'] == 'update') {
                         $this->handler = 'confUpdate';
                     }
                 }
             }
         }
     }
 }
Example #6
0
 protected function generateContent()
 {
     /****************/
     /* Main Content */
     /****************/
     if (in_array(array_search($this->page, $this->validPages), [0, 1, 2, 3, 11, 12])) {
         $this->h1Links = '<small><a href="?' . $this->page . ($this->category ? '=' . $this->category[0] : null) . '&rss" class="icon-rss">' . Lang::main('subscribe') . '</a></small>';
     }
     switch ($this->page) {
         case 'random':
             $type = array_rand(array_filter(Util::$typeStrings));
             $typeId = (new Util::$typeClasses[$type](null))->getRandomId();
             header('Location: ?' . Util::$typeStrings[$type] . '=' . $typeId, true, 302);
             die;
         case 'latest-comments':
             $this->lvTabs[] = array('file' => 'commentpreview', 'data' => CommunityContent::getCommentPreviews(), 'params' => []);
             break;
         case 'latest-screenshots':
             $this->lvTabs[] = array('file' => 'screenshot', 'data' => [], 'params' => []);
             break;
         case 'latest-videos':
             $this->lvTabs[] = array('file' => 'video', 'data' => [], 'params' => []);
             break;
         case 'latest-articles':
             $this->lvTabs = [];
             break;
         case 'latest-additions':
             $extraText = '';
             break;
         case 'unrated-comments':
             $this->lvTabs[] = array('file' => 'commentpreview', 'data' => [], 'params' => []);
             break;
         case 'missing-screenshots':
             // limit to 200 entries each (it generates faster, consumes less memory and should be enough options)
             $cnd = [[['cuFlags', CUSTOM_HAS_SCREENSHOT, '&'], 0], 200];
             if (!User::isInGroup(U_GROUP_EMPLOYEE)) {
                 $cnd[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0];
             }
             foreach (Util::$typeClasses as $classStr) {
                 if (!$classStr) {
                     continue;
                 }
                 $typeObj = new $classStr($cnd);
                 if (!$typeObj->error) {
                     $this->extendGlobalData($typeObj->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED | GLOBALINFO_REWARDS));
                     $this->lvTabs[] = array('file' => $typeObj::$brickFile, 'data' => $typeObj->getListviewData(), 'params' => []);
                 }
             }
             break;
         case 'most-comments':
             if ($this->category && !in_array($this->category[0], [1, 7, 30])) {
                 header('Location: ?most-comments=1' . ($this->rss ? '&rss' : null), true, 302);
             }
             $this->lvTabs[] = array('file' => 'commentpreview', 'data' => [], 'params' => []);
             break;
     }
 }
Example #7
0
 public static function getNotes($restricted = true)
 {
     $notes = [];
     foreach (self::$notes as $data) {
         if (!$restricted || !$data[0] || User::isInGroup($data[0])) {
             $notes[] = $data[1];
         }
     }
     return $notes;
 }
Example #8
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())]];
     }
 }
Example #9
0
 protected function generateContent()
 {
     $conditions = [];
     if (!User::isInGroup(U_GROUP_EMPLOYEE)) {
         $conditions[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0];
     }
     if ($this->category) {
         $conditions[] = ['typeCat', $this->category[0]];
     }
     $skills = new SkillList($conditions);
     $this->lvTabs[] = ['skill', ['data' => array_values($skills->getListviewData())]];
 }
Example #10
0
 protected function generateContent()
 {
     $conditions = [];
     if (!User::isInGroup(U_GROUP_EMPLOYEE)) {
         $conditions[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0];
     }
     if ($this->category) {
         $conditions[] = ['category', (int) $this->category[0]];
     }
     $money = new CurrencyList($conditions);
     $this->lvTabs[] = array('file' => 'currency', 'data' => $money->getListviewData(), 'params' => []);
 }
Example #11
0
 protected function generateContent()
 {
     $tabData = array('data' => [], 'name' => Util::ucFirst(Lang::game('enchantments')));
     $conditions = [];
     if (!User::isInGroup(U_GROUP_EMPLOYEE)) {
         $conditions[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0];
     }
     if ($_ = $this->filterObj->getConditions()) {
         $conditions[] = $_;
     }
     $ench = new EnchantmentList($conditions);
     $tabData['data'] = array_values($ench->getListviewData());
     $this->extendGlobalData($ench->getJSGlobals());
     // 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();
     $xCols = $this->filterObj->getForm('extraCols', true);
     foreach (Util::$itemFilter as $fiId => $str) {
         if (array_column($tabData['data'], $str)) {
             $xCols[] = $fiId;
         }
     }
     if (array_column($tabData['data'], 'dmg')) {
         $xCols[] = 34;
     }
     if ($xCols) {
         $this->filter['fi']['extraCols'] = "fi_extraCols = " . Util::toJSON(array_values(array_unique($xCols))) . ";";
     }
     if (!empty($this->filter['fi']['extraCols'])) {
         $tabData['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)';
     }
     if ($ench->getMatches() > CFG_SQL_LIMIT_DEFAULT) {
         $tabData['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_enchantmentsfound', $ench->getMatches(), CFG_SQL_LIMIT_DEFAULT);
         $tabData['_truncated'] = 1;
     }
     if (array_filter(array_column($tabData['data'], 'spells'))) {
         $tabData['visibleCols'] = ['trigger'];
     }
     if (!$ench->hasSetFields(['skillLine'])) {
         $tabData['hiddenCols'] = ['skill'];
     }
     if ($this->filterObj->error) {
         $tabData['_errors'] = '$1';
     }
     $this->lvTabs[] = ['enchantment', $tabData, 'enchantment'];
 }
Example #12
0
 protected function generateContent()
 {
     $this->addJS('?data=zones&locale=' . User::$localeId . '&t=' . $_SESSION['dataKey']);
     $conditions = [];
     if (!User::isInGroup(U_GROUP_EMPLOYEE)) {
         $conditions[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0];
     }
     if ($this->category) {
         $conditions[] = ['type', $this->category[0]];
         $this->petFamPanel = $this->category[0] == 1;
     } else {
         $this->petFamPanel = false;
     }
     if ($_ = $this->filterObj->getConditions()) {
         $conditions[] = $_;
     }
     // beast subtypes are selected via filter
     $npcs = new CreatureList($conditions, ['extraOpts' => $this->filterObj->extraOpts]);
     // 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();
     $repCols = $this->filterObj->getForm('reputationCols');
     $tabData = array('data' => array_values($npcs->getListviewData($repCols ? NPCINFO_REP : 0x0)));
     if ($repCols) {
         $tabData['extraCols'] = '$fi_getReputationCols(' . Util::toJSON($repCols) . ')';
     } else {
         if (!empty($this->filter['fi']['extraCols'])) {
             $tabData['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)';
         }
     }
     if ($this->category) {
         $tabData['hiddenCols'] = ['type'];
     }
     // create note if search limit was exceeded
     if ($npcs->getMatches() > CFG_SQL_LIMIT_DEFAULT) {
         $tabData['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_npcsfound', $npcs->getMatches(), CFG_SQL_LIMIT_DEFAULT);
         $tabData['_truncated'] = 1;
     }
     if ($this->filterObj->error) {
         $tabData['_errors'] = 1;
     }
     $this->lvTabs[] = ['creature', $tabData];
     // sort for dropdown-menus
     Lang::sort('game', 'fa');
 }
Example #13
0
 public static function getInfoBoxForFlags($flags)
 {
     $tmp = [];
     if ($flags & CUSTOM_DISABLED) {
         $tmp[] = '[tooltip name=disabledHint]' . Util::jsEscape(self::main('disabledHint')) . '[/tooltip][span class=tip tooltip=disabledHint]' . Util::jsEscape(self::main('disabled')) . '[/span]';
     }
     if ($flags & CUSTOM_SERVERSIDE) {
         $tmp[] = '[tooltip name=serversideHint]' . Util::jsEscape(self::main('serversideHint')) . '[/tooltip][span class=tip tooltip=serversideHint]' . Util::jsEscape(self::main('serverside')) . '[/span]';
     }
     if ($flags & CUSTOM_UNAVAILABLE) {
         $tmp[] = self::main('unavailable');
     }
     if ($flags & CUSTOM_EXCLUDE_FOR_LISTVIEW && User::isInGroup(U_GROUP_STAFF)) {
         $tmp[] = '[tooltip name=excludedHint]This entry is excluded from lists and is not searchable.[/tooltip][span tooltip=excludedHint class="tip q10"]Hidden[/span]';
     }
     return $tmp;
 }
Example #14
0
 protected function generateContent()
 {
     $conditions = [];
     if (!User::isInGroup(U_GROUP_EMPLOYEE)) {
         $conditions[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0];
     }
     if (isset($this->category[1])) {
         $conditions[] = ['zoneOrSort', $this->category[1]];
     } else {
         if (isset($this->category[0])) {
             $conditions[] = ['zoneOrSort', $this->validCats[$this->category[0]]];
         }
     }
     if ($_ = $this->filterObj->getConditions()) {
         $conditions[] = $_;
     }
     $quests = new QuestList($conditions, ['extraOpts' => $this->filterObj->extraOpts]);
     $this->extendGlobalData($quests->getJSGlobals());
     // 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();
     $tabData = ['data' => array_values($quests->getListviewData())];
     if ($_ = $this->filterObj->getForm('reputationCols')) {
         $tabData['extraCols'] = '$fi_getReputationCols(' . json_encode($_, JSON_NUMERIC_CHECK) . ')';
     } else {
         if (!empty($this->filter['fi']['extraCols'])) {
             $tabData['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)';
         }
     }
     // create note if search limit was exceeded
     if ($quests->getMatches() > CFG_SQL_LIMIT_DEFAULT) {
         $tabData['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_questsfound', $quests->getMatches(), CFG_SQL_LIMIT_DEFAULT);
         $tabData['_truncated'] = 1;
     } else {
         if (isset($this->category[1]) && $this->category[1] > 0) {
             $tabData['note'] = '$$WH.sprintf(LANG.lvnote_questgivers, ' . $this->category[1] . ', g_zones[' . $this->category[1] . '], ' . $this->category[1] . ')';
         }
     }
     if ($this->filterObj->error) {
         $tabData['_errors'] = 1;
     }
     $this->lvTabs[] = ['quest', $tabData];
 }
Example #15
0
File: pets.php Project: saqar/aowow
 protected function generateContent()
 {
     $conditions = [];
     if (!User::isInGroup(U_GROUP_EMPLOYEE)) {
         $conditions[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0];
     }
     if ($this->category) {
         $conditions[] = ['type', (int) $this->category[0]];
     }
     $pets = new PetList($conditions);
     if (!$pets->error) {
         $this->extendGlobalData($pets->getJSGlobals(GLOBALINFO_RELATED));
         $params = ['visibleCols' => "\$['abilities']"];
         if (!$pets->hasDiffFields(['type'])) {
             $params['hiddenCols'] = "\$['type']";
         }
         $this->lvTabs[] = array('file' => 'pet', 'data' => $pets->getListviewData(), 'params' => $params);
     }
 }
Example #16
0
 protected function generateContent()
 {
     $conditions = [];
     if (!User::isInGroup(U_GROUP_EMPLOYEE)) {
         // hide unused titles
         $conditions[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0];
     }
     if ($this->category) {
         $conditions[] = ['category', $this->category[0]];
     }
     $titles = new TitleList($conditions);
     if (!$titles->error) {
         $params = [];
         if ($titles->hasDiffFields(['category'])) {
             $params['visibleCols'] = "\$['category']";
         }
         if (!$titles->hasAnySource()) {
             $params['hiddenCols'] = "\$['source']";
         }
         $this->lvTabs[] = array('file' => 'title', 'data' => $titles->getListviewData(), 'params' => $params);
     }
 }
Example #17
0
 protected function generateContent()
 {
     $condition = [];
     if (!User::isInGroup(U_GROUP_EMPLOYEE)) {
         $condition[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0];
     }
     if ($this->category) {
         switch ($this->category[0]) {
             case 0:
                 $condition[] = ['e.holidayId', 0];
                 break;
             case 1:
                 $condition[] = ['h.scheduleType', -1];
                 break;
             case 2:
                 $condition[] = ['h.scheduleType', [0, 1]];
                 break;
             case 3:
                 $condition[] = ['h.scheduleType', 2];
                 break;
         }
     }
     $events = new WorldEventList($condition);
     $this->extendGlobalData($events->getJSGlobals());
     $this->deps = [];
     foreach ($events->iterate() as $__) {
         if ($d = $events->getField('requires')) {
             $this->deps[$events->id] = $d;
         }
     }
     $data = array_values($events->getListviewData());
     $this->lvTabs[] = ['event', ['data' => $data]];
     if ($_ = array_filter($data, function ($x) {
         return $x['id'] > 0;
     })) {
         $this->lvTabs[] = ['calendar', array('data' => $_, 'hideCount' => 1)];
     }
 }
Example #18
0
        <div class="footer">
<?php 
if (User::isInGroup(U_GROUP_EMPLOYEE) && ($this->time || isset($this->mysql) || $this->isCached)) {
    echo "            <table style=\"margin:auto;\">\n";
    if (isset($this->mysql)) {
        echo '                <tr><td style="text-align:left;">' . Lang::main('numSQL') . '</td><td>' . $this->mysql['count'] . "</td></tr>\n";
        echo '                <tr><td style="text-align:left;">' . Lang::main('timeSQL') . '</td><td>' . Util::formatTime($this->mysql['time'] * 1000, true) . "</td></tr>\n";
    }
    if ($this->time) {
        echo '                <tr><td style="text-align:left;">Page generated in</td><td>' . Util::formatTime($this->time * 1000, true) . "</td></tr>\n";
    }
    if ($this->cacheLoaded && $this->cacheLoaded[0] == CACHE_MODE_FILECACHE) {
        echo "                <tr><td style=\"text-align:left;\">reloaded from filecache</td><td>created" . Lang::main('colon') . date(Lang::main('dateFmtLong'), $this->cacheLoaded[1]) . "</td></tr>\n";
    } elseif ($this->cacheLoaded && $this->cacheLoaded[0] == CACHE_MODE_MEMCACHED) {
        echo "                <tr><td style=\"text-align:left;\">reloaded from memcached</td><td>created" . Lang::main('colon') . date(Lang::main('dateFmtLong'), $this->cacheLoaded[1]) . "</td></tr>\n";
    }
    echo "            </table>\n";
}
?>
        </div>
    </div><!-- #wrapper .nosidebar -->
    </div><!-- #layout-inner -->
</div><!-- #layout .nosidebar -->

<noscript>
    <div id="noscript-bg"></div>
    <div id="noscript-text"><?php 
echo Lang::main('noJScript');
?>
</div>
</noscript>
Example #19
0
 private function createRewards()
 {
     $rewards = [];
     // moneyReward / maxLevelCompensation
     $comp = $this->subject->getField('rewardMoneyMaxLevel');
     $questMoney = $this->subject->getField('rewardOrReqMoney');
     if ($questMoney > 0) {
         $rewards['money'] = Util::formatMoney($questMoney);
         if ($comp > 0) {
             $rewards['money'] .= '&nbsp;' . sprintf(Lang::quest('expConvert'), Util::formatMoney($questMoney + $comp), MAX_LEVEL);
         }
     } else {
         if ($questMoney <= 0 && $questMoney + $comp > 0) {
             $rewards['money'] = sprintf(Lang::quest('expConvert2'), Util::formatMoney($questMoney + $comp), MAX_LEVEL);
         }
     }
     // itemChoices
     if (!empty($this->subject->choices[$this->typeId][TYPE_ITEM])) {
         $c = $this->subject->choices[$this->typeId][TYPE_ITEM];
         $choiceItems = new ItemList(array(['id', array_keys($c)]));
         if (!$choiceItems->error) {
             $this->extendGlobalData($choiceItems->getJSGlobals());
             foreach ($choiceItems->Iterate() as $id => $__) {
                 $rewards['choice'][] = array('typeStr' => Util::$typeStrings[TYPE_ITEM], 'id' => $id, 'name' => $choiceItems->getField('name', true), 'quality' => $choiceItems->getField('quality'), 'qty' => $c[$id], 'globalStr' => 'g_items');
             }
         }
     }
     // itemRewards
     if (!empty($this->subject->rewards[$this->typeId][TYPE_ITEM])) {
         $ri = $this->subject->rewards[$this->typeId][TYPE_ITEM];
         $rewItems = new ItemList(array(['id', array_keys($ri)]));
         if (!$rewItems->error) {
             $this->extendGlobalData($rewItems->getJSGlobals());
             foreach ($rewItems->Iterate() as $id => $__) {
                 $rewards['items'][] = array('typeStr' => Util::$typeStrings[TYPE_ITEM], 'id' => $id, 'name' => $rewItems->getField('name', true), 'quality' => $rewItems->getField('quality'), 'qty' => $ri[$id], 'globalStr' => 'g_items');
             }
         }
     }
     if (!empty($this->subject->rewards[$this->typeId][TYPE_ITEM][TYPE_CURRENCY])) {
         $rc = $this->subject->rewards[$this->typeId][TYPE_ITEM][TYPE_CURRENCY];
         $rewCurr = new CurrencyList(array(['id', array_keys($rc)]));
         if (!$rewCurr->error) {
             $this->extendGlobalData($rewCurr->getJSGlobals());
             foreach ($rewCurr->Iterate() as $id => $__) {
                 $rewards['items'][] = array('typeStr' => Util::$typeStrings[TYPE_CURRENCY], 'id' => $id, 'name' => $rewCurr->getField('name', true), 'quality' => 1, 'qty' => $rc[$id] * ($_side == 2 ? -1 : 1), 'globalStr' => 'g_gatheredcurrencies');
             }
         }
     }
     // spellRewards
     $displ = $this->subject->getField('rewardSpell');
     $cast = $this->subject->getField('rewardSpellCast');
     if (!$cast && $displ) {
         $cast = $displ;
         $displ = 0;
     }
     if ($cast || $displ) {
         $rewSpells = new SpellList(array(['id', [$displ, $cast]]));
         $this->extendGlobalData($rewSpells->getJSGlobals());
         if (User::isInGroup(U_GROUP_EMPLOYEE)) {
             $extra = null;
             if ($_ = $rewSpells->getEntry($displ)) {
                 $extra = sprintf(Lang::quest('spellDisplayed'), $displ, Util::localizedString($_, 'name'));
             }
             if ($_ = $rewSpells->getEntry($cast)) {
                 $rewards['spells']['extra'] = $extra;
                 $rewards['spells']['cast'][] = array('typeStr' => Util::$typeStrings[TYPE_SPELL], 'id' => $cast, 'name' => Util::localizedString($_, 'name'), 'globalStr' => 'g_spells');
             }
         } else {
             $teach = [];
             foreach ($rewSpells->iterate() as $id => $__) {
                 if ($_ = $rewSpells->canTeachSpell()) {
                     foreach ($_ as $idx) {
                         $teach[$rewSpells->getField('effect' . $idx . 'TriggerSpell')] = $id;
                     }
                 }
             }
             if ($_ = $rewSpells->getEntry($displ)) {
                 $rewards['spells']['extra'] = null;
                 $rewards['spells'][$teach ? 'learn' : 'cast'][] = array('typeStr' => Util::$typeStrings[TYPE_SPELL], 'id' => $displ, 'name' => Util::localizedString($_, 'name'), 'globalStr' => 'g_spells');
             } else {
                 if (($_ = $rewSpells->getEntry($cast)) && !$teach) {
                     $rewards['spells']['extra'] = null;
                     $rewards['spells']['cast'][] = array('typeStr' => Util::$typeStrings[TYPE_SPELL], 'id' => $cast, 'name' => Util::localizedString($_, 'name'), 'globalStr' => 'g_spells');
                 } else {
                     $taught = new SpellList(array(['id', array_keys($teach)]));
                     if (!$taught->error) {
                         $this->extendGlobalData($taught->getJSGlobals());
                         $rewards['spells']['extra'] = null;
                         foreach ($taught->iterate() as $id => $__) {
                             $rewards['spells']['learn'][] = array('typeStr' => Util::$typeStrings[TYPE_SPELL], 'id' => $id, 'name' => $taught->getField('name', true), 'globalStr' => 'g_spells');
                         }
                     }
                 }
             }
         }
     }
     return $rewards;
 }
Example #20
0
 protected function generateContent()
 {
     $conditions = [CFG_SQL_LIMIT_NONE];
     $visibleCols = [];
     $hiddenCols = [];
     $mapFile = 0;
     $spawnMap = -1;
     if (!User::isInGroup(U_GROUP_EMPLOYEE)) {
         // sub-areas and unused zones
         $conditions[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0];
     }
     if ($this->category) {
         $conditions[] = ['z.category', $this->category[0]];
         $hiddenCols[] = 'category';
         if (isset($this->category[1]) && in_array($this->category[0], [2, 3])) {
             $conditions[] = ['z.expansion', $this->category[1]];
         }
         if (empty($this->category[1])) {
             switch ($this->category[0]) {
                 case 0:
                     $mapFile = -3;
                     $spawnMap = 0;
                     break;
                 case 1:
                     $mapFile = -6;
                     $spawnMap = 1;
                     break;
                 case 8:
                     $mapFile = -2;
                     $spawnMap = 530;
                     break;
                 case 10:
                     $mapFile = -5;
                     $spawnMap = 571;
                     break;
             }
         }
         switch ($this->category[0]) {
             case 6:
             case 2:
             case 3:
                 array_push($visibleCols, 'level', 'players');
             case 9:
                 $hiddenCols[] = 'territory';
                 break;
         }
     }
     $zones = new ZoneList($conditions);
     if (!$zones->hasSetFields(['type'])) {
         $hiddenCols[] = 'instancetype';
     }
     $tabData = ['data' => array_values($zones->getListviewData())];
     if ($visibleCols) {
         $tabData['visibleCols'] = $visibleCols;
     }
     if ($hiddenCols) {
         $tabData['hiddenCols'] = $hiddenCols;
     }
     $this->map = null;
     $this->lvTabs[] = ['zone', $tabData];
     // create flight map
     if ($mapFile) {
         $somData = ['flightmaster' => []];
         $nodes = DB::Aowow()->select('SELECT id AS ARRAY_KEY, tn.* FROM ?_taxinodes tn WHERE mapId = ?d ', $spawnMap);
         $paths = DB::Aowow()->select('
                     SELECT  IF(tn1.reactA = tn1.reactH AND tn2.reactA = tn2.reactH, 1, 0) AS neutral,
                             tp.startNodeId AS startId,
                             tn1.posX AS startPosX,
                             tn1.posY AS startPosY,
                             tp.endNodeId AS endId,
                             tn2.posX AS endPosX,
                             tn2.posY AS endPosY
                     FROM    ?_taxipath tp,
                             ?_taxinodes tn1,
                             ?_taxinodes tn2
                     WHERE   tn1.Id = tp.endNodeId AND
                             tn2.Id = tp.startNodeId AND
                             (tp.startNodeId IN (?a) OR tp.EndNodeId IN (?a))
                     ', array_keys($nodes), array_keys($nodes));
         foreach ($nodes as $i => $n) {
             $neutral = $n['reactH'] == $n['reactA'];
             $data = array('coords' => [[$n['posX'], $n['posY']]], 'level' => 0, 'name' => Util::localizedString($n, 'name'), 'type' => $n['type'], 'id' => $n['typeId'], 'reacthorde' => $n['reactH'], 'reactalliance' => $n['reactA'], 'paths' => []);
             foreach ($paths as $j => $p) {
                 if ($i != $p['startId'] && $i != $p['endId']) {
                     continue;
                 }
                 if ($i == $p['startId'] && (!$neutral || $p['neutral'])) {
                     $data['paths'][] = [$p['startPosX'], $p['startPosY']];
                     unset($paths[$j]);
                 } else {
                     if ($i == $p['endId'] && (!$neutral || $p['neutral'])) {
                         $data['paths'][] = [$p['endPosX'], $p['endPosY']];
                         unset($paths[$j]);
                     }
                 }
             }
             if (empty($data['paths'])) {
                 unset($data['paths']);
             }
             $somData['flightmaster'][] = $data;
         }
         $this->map = array('data' => array('zone' => $mapFile, 'zoom' => 1, 'overlay' => true, 'zoomable' => false, 'parent' => 'mapper-generic'), 'som' => $somData, 'mapperData' => [$mapFile => new stdClass()]);
     }
 }
Example #21
0
 protected function generateContent()
 {
     $this->addJS('?data=zones&locale=' . User::$localeId . '&t=' . $_SESSION['dataKey']);
     /***********/
     /* Infobox */
     /***********/
     $infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
     // Event (ignore events, where the object only gets removed)
     if ($_ = DB::World()->selectCol('SELECT DISTINCT IF(ge.holiday, ge.holiday, -ge.eventEntry) FROM game_event ge, game_event_gameobject geg, gameobject g WHERE ge.eventEntry = geg.eventEntry AND g.guid = geg.guid AND g.id = ?d', $this->typeId)) {
         $this->extendGlobalIds(TYPE_WORLDEVENT, $_);
         $ev = [];
         foreach ($_ as $i => $e) {
             $ev[] = ($i % 2 ? '[br]' : ' ') . '[event=' . $e . ']';
         }
         $infobox[] = Util::ucFirst(Lang::game('eventShort')) . Lang::main('colon') . implode(',', $ev);
     }
     // Reaction
     $_ = function ($r) {
         if ($r == 1) {
             return 2;
         }
         if ($r == -1) {
             return 10;
         }
         return;
     };
     $infobox[] = Lang::npc('react') . Lang::main('colon') . '[color=q' . $_($this->subject->getField('A')) . ']A[/color] [color=q' . $_($this->subject->getField('H')) . ']H[/color]';
     // reqSkill
     switch ($this->subject->getField('typeCat')) {
         case -3:
             // Herbalism
             $infobox[] = sprintf(Lang::game('requires'), Lang::spell('lockType', 2) . ' (' . $this->subject->getField('reqSkill') . ')');
             break;
         case -4:
             // Mining
             $infobox[] = sprintf(Lang::game('requires'), Lang::spell('lockType', 3) . ' (' . $this->subject->getField('reqSkill') . ')');
             break;
         case -5:
             // Lockpicking
             $infobox[] = sprintf(Lang::game('requires'), Lang::spell('lockType', 1) . ' (' . $this->subject->getField('reqSkill') . ')');
             break;
         default:
             $locks = Lang::getLocks($this->subject->getField('lockId'));
             $l = '';
             foreach ($locks as $idx => $_) {
                 if ($idx < 0) {
                     continue;
                 }
                 $this->extendGlobalIds(TYPE_ITEM, $idx);
                 $l = Lang::gameObject('key') . Lang::main('colon') . '[item=' . $idx . ']';
             }
             // if no propper item is found use a skill
             if ($locks) {
                 $infobox[] = $l ? $l : array_pop($locks);
             }
     }
     // linked trap
     if ($_ = $this->subject->getField('linkedTrap')) {
         $this->extendGlobalIds(TYPE_OBJECT, $_);
         $infobox[] = Lang::gameObject('trap') . Lang::main('colon') . '[object=' . $_ . ']';
     }
     // trap for
     $trigger = new GameObjectList(array(['linkedTrap', $this->typeId]));
     if (!$trigger->error) {
         $this->extendGlobalData($trigger->getJSGlobals());
         $infobox[] = Lang::gameObject('triggeredBy') . Lang::main('colon') . '[object=' . $trigger->id . ']';
     }
     // SpellFocus
     if ($_ = $this->subject->getField('spellFocusId')) {
         if ($sfo = DB::Aowow()->selectRow('SELECT * FROM ?_spellfocusobject WHERE id = ?d', $_)) {
             $infobox[] = '[tooltip name=focus]' . Lang::gameObject('focusDesc') . '[/tooltip][span class=tip tooltip=focus]' . Lang::gameObject('focus') . Lang::main('colon') . Util::localizedString($sfo, 'name') . '[/span]';
         }
     }
     // lootinfo: [min, max, restock]
     if (($_ = $this->subject->getField('lootStack')) && $_[0]) {
         $buff = Lang::item('charges') . Lang::main('colon') . $_[0];
         if ($_[0] < $_[1]) {
             $buff .= Lang::game('valueDelim') . $_[1];
         }
         // since Veins don't have charges anymore, the timer is questionable
         $infobox[] = $_[2] > 1 ? '[tooltip name=restock]' . sprintf(Lang::gameObject('restock'), Util::formatTime($_[2] * 1000)) . '[/tooltip][span class=tip tooltip=restock]' . $buff . '[/span]' : $buff;
     }
     // meeting stone [minLevel, maxLevel, zone]
     if ($this->subject->getField('type') == OBJECT_MEETINGSTONE) {
         if ($_ = $this->subject->getField('mStone')) {
             $this->extendGlobalIds(TYPE_ZONE, $_[2]);
             $m = Lang::game('meetingStone') . Lang::main('colon') . '[zone=' . $_[2] . ']';
             $l = $_[0];
             if ($_[0] > 1 && $_[1] > $_[0]) {
                 $l .= Lang::game('valueDelim') . min($_[1], MAX_LEVEL);
             }
             $infobox[] = $l ? '[tooltip name=meetingstone]' . sprintf(Lang::game('reqLevel'), $l) . '[/tooltip][span class=tip tooltip=meetingstone]' . $m . '[/span]' : $m;
         }
     }
     // capture area [minPlayer, maxPlayer, minTime, maxTime, radius]
     if ($this->subject->getField('type') == OBJECT_CAPTURE_POINT) {
         if ($_ = $this->subject->getField('capture')) {
             $buff = Lang::gameObject('capturePoint');
             if ($_[2] > 1 || $_[0]) {
                 $buff .= Lang::main('colon') . '[ul]';
             }
             if ($_[2] > 1) {
                 $buff .= '[li]' . Lang::game('duration') . Lang::main('colon') . ($_[3] > $_[2] ? Util::FormatTime($_[3] * 1000, true) . ' - ' : null) . Util::FormatTime($_[2] * 1000, true) . '[/li]';
             }
             if ($_[1]) {
                 $buff .= '[li]' . Lang::main('players') . Lang::main('colon') . $_[0] . ($_[1] > $_[0] ? ' - ' . $_[1] : null) . '[/li]';
             }
             if ($_[4]) {
                 $buff .= '[li]' . sprintf(Lang::spell('range'), $_[4]) . '[/li]';
             }
             if ($_[2] > 1 || $_[0]) {
                 $buff .= '[/ul]';
             }
         }
         $infobox[] = $buff;
     }
     // AI
     if (User::isInGroup(U_GROUP_EMPLOYEE)) {
         if ($_ = $this->subject->getField('ScriptName')) {
             $infobox[] = 'Script' . Lang::main('colon') . $_;
         } else {
             if ($_ = $this->subject->getField('AIName')) {
                 $infobox[] = 'AI' . Lang::main('colon') . $_;
             }
         }
     }
     /****************/
     /* Main Content */
     /****************/
     // pageText
     $pageText = [];
     if ($next = $this->subject->getField('pageTextId')) {
         while ($next) {
             $row = DB::World()->selectRow('SELECT *, text as Text_loc0 FROM page_text pt LEFT JOIN locales_page_text lpt ON pt.entry = lpt.entry WHERE pt.entry = ?d', $next);
             $next = $row['next_page'];
             $pageText[] = Util::parseHtmlText(Util::localizedString($row, 'Text'));
         }
     }
     // add conditional js & css
     if ($pageText) {
         $this->addCSS(['path' => 'Book.css']);
         $this->addJS('Book.js');
     }
     // get spawns and path
     $map = null;
     if ($spawns = $this->subject->getSpawns(SPAWNINFO_FULL)) {
         $map = ['data' => ['parent' => 'mapper-generic'], 'mapperData' => &$spawns];
         foreach ($spawns as $areaId => &$areaData) {
             $map['extra'][$areaId] = ZoneList::getName($areaId);
         }
     }
     // consider pooled spawns
     $this->infobox = $infobox ? '[ul][li]' . implode('[/li][li]', $infobox) . '[/li][/ul]' : null;
     $this->pageText = $pageText;
     $this->map = $map;
     $this->redButtons = array(BUTTON_WOWHEAD => true, BUTTON_LINKS => true, BUTTON_VIEW3D => ['displayId' => $this->subject->getField('displayId'), 'type' => TYPE_OBJECT, 'typeId' => $this->typeId]);
     /**************/
     /* Extra Tabs */
     /**************/
     // tab: summoned by
     $conditions = array('OR', ['AND', ['effect1Id', [50, 76, 104, 105, 106, 107]], ['effect1MiscValue', $this->typeId]], ['AND', ['effect2Id', [50, 76, 104, 105, 106, 107]], ['effect2MiscValue', $this->typeId]], ['AND', ['effect3Id', [50, 76, 104, 105, 106, 107]], ['effect3MiscValue', $this->typeId]]);
     $summons = new SpellList($conditions);
     if (!$summons->error) {
         $this->extendGlobalData($summons->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
         $this->lvTabs[] = array('file' => 'spell', 'data' => $summons->getListviewData(), 'params' => array('id' => 'summoned-by', 'name' => '$LANG.tab_summonedby'));
     }
     // tab: related spells
     if ($_ = $this->subject->getField('spells')) {
         $relSpells = new SpellList(array(['id', $_]));
         if (!$relSpells->error) {
             $this->extendGlobalData($relSpells->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
             $data = $relSpells->getListviewData();
             foreach ($data as $relId => $d) {
                 $data[$relId]['trigger'] = array_search($relId, $_);
             }
             $this->lvTabs[] = array('file' => 'spell', 'data' => $data, 'params' => array('id' => 'spells', 'name' => '$LANG.tab_spells', 'hiddenCols' => "\$['skill']", 'extraCols' => "\$[Listview.funcBox.createSimpleCol('trigger', 'Condition', '10%', 'trigger')]"));
         }
     }
     // tab: criteria of
     $acvs = new AchievementList(array(['ac.type', [ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT, ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT]], ['ac.value1', $this->typeId]));
     if (!$acvs->error) {
         $this->extendGlobalData($acvs->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
         $this->lvTabs[] = array('file' => 'achievement', 'data' => $acvs->getListviewData(), 'params' => array('id' => 'criteria-of', 'name' => '$LANG.tab_criteriaof'));
     }
     // tab: starts quest
     // tab: ends quest
     $startEnd = new QuestList(array(['qse.type', TYPE_OBJECT], ['qse.typeId', $this->typeId]));
     if (!$startEnd->error) {
         $this->extendGlobalData($startEnd->getJSGlobals());
         $lvData = $startEnd->getListviewData();
         $_ = [[], []];
         foreach ($startEnd->iterate() as $id => $__) {
             $m = $startEnd->getField('method');
             if ($m & 0x1) {
                 $_[0][] = $lvData[$id];
             }
             if ($m & 0x2) {
                 $_[1][] = $lvData[$id];
             }
         }
         if ($_[0]) {
             $this->lvTabs[] = array('file' => 'quest', 'data' => $_[0], 'params' => array('name' => '$LANG.tab_starts', 'id' => 'starts'));
         }
         if ($_[1]) {
             $this->lvTabs[] = array('file' => 'quest', 'data' => $_[1], 'params' => array('name' => '$LANG.tab_ends', 'id' => 'ends'));
         }
     }
     // tab: related quests
     if ($_ = $this->subject->getField('reqQuest')) {
         $relQuest = new QuestList(array(['id', $_]));
         if (!$relQuest->error) {
             $this->extendGlobalData($relQuest->getJSGlobals());
             $this->lvTabs[] = array('file' => 'quest', 'data' => $relQuest->getListviewData(), 'params' => array('name' => '$LANG.tab_quests', 'id' => 'quests'));
         }
     }
     // tab: contains
     $reqQuest = [];
     if ($_ = $this->subject->getField('lootId')) {
         $goLoot = new Loot();
         if ($goLoot->getByContainer(LOOT_GAMEOBJECT, $_)) {
             $extraCols = $goLoot->extraCols;
             $hiddenCols = ['source', 'side', 'slot', 'reqlevel'];
             $this->extendGlobalData($goLoot->jsGlobals);
             foreach ($goLoot->iterate() as &$lv) {
                 if (!empty($hiddenCols)) {
                     foreach ($hiddenCols as $k => $str) {
                         if (!empty($lv[$str])) {
                             unset($hiddenCols[$k]);
                         }
                     }
                 }
                 if (!$lv['quest']) {
                     continue;
                 }
                 $extraCols[] = 'Listview.extraCols.condition';
                 $reqQuest[$lv['id']] = 0;
                 $lv['condition'][0][$this->typeId][] = [[CND_QUESTTAKEN, &$reqQuest[$lv['id']]]];
             }
             $extraCols[] = 'Listview.extraCols.percent';
             $this->lvTabs[] = array('file' => 'item', 'data' => $goLoot->getResult(), 'params' => array('name' => '$LANG.tab_contains', 'id' => 'contains', 'extraCols' => "\$[" . implode(', ', array_unique($extraCols)) . "]", 'hiddenCols' => $hiddenCols ? '$' . Util::toJSON(array_values($hiddenCols)) : null));
         }
     }
     if ($reqIds = array_keys($reqQuest)) {
         $conditions = array('OR', ['reqSourceItemId1', $reqIds], ['reqSourceItemId2', $reqIds], ['reqSourceItemId3', $reqIds], ['reqSourceItemId4', $reqIds], ['reqItemId1', $reqIds], ['reqItemId2', $reqIds], ['reqItemId3', $reqIds], ['reqItemId4', $reqIds], ['reqItemId5', $reqIds], ['reqItemId6', $reqIds]);
         $reqQuests = new QuestList($conditions);
         $this->extendGlobalData($reqQuests->getJSGlobals());
         foreach ($reqQuests->iterate() as $qId => $__) {
             if (empty($reqQuests->requires[$qId][TYPE_ITEM])) {
                 continue;
             }
             foreach ($reqIds as $rId) {
                 if (in_array($rId, $reqQuests->requires[$qId][TYPE_ITEM])) {
                     $reqQuest[$rId] = $reqQuests->id;
                 }
             }
         }
     }
     // tab: Same model as .. whats the f*****g point..?
     $sameModel = new GameObjectList(array(['displayId', $this->subject->getField('displayId')], ['id', $this->typeId, '!']));
     if (!$sameModel->error) {
         $this->extendGlobalData($sameModel->getJSGlobals());
         $this->lvTabs[] = array('file' => 'object', 'data' => $sameModel->getListviewData(), 'params' => array('name' => '$LANG.tab_samemodelas', 'id' => 'same-model-as'));
     }
 }
Example #22
0
 protected function handleReplyDelete()
 {
     if (!User::$id || !$this->_post['id']) {
         return;
     }
     if (DB::Aowow()->query('DELETE FROM ?_comments WHERE id = ?d{ AND userId = ?d}', $this->_post['id'][0], User::isInGroup(U_GROUP_MODERATOR) ? DBSIMPLE_SKIP : User::$id)) {
         DB::Aowow()->query('DELETE FROM ?_comments_rates WHERE commentId = ?d', $this->_post['id'][0]);
     }
 }
Example #23
0
 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'), '&nbsp;[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));
             }
         }
     }
 }
Example #24
0
 private function performSearch()
 {
     $cndBase = ['AND', $this->maxResults];
     // Exclude internal wow stuff
     if (!User::isInGroup(U_GROUP_EMPLOYEE)) {
         $cndBase[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0];
     }
     $shared = [];
     foreach ($this->searches as $idx => $ref) {
         if ($this->searchMask & 1 << $idx) {
             if ($_ = $this->{$ref}[0]($cndBase, $shared)) {
                 $this->lvTabs[$idx] = $_;
             }
         }
     }
 }
Example #25
0
 private function createEffects(&$infobox, &$redButtons)
 {
     // proc data .. maybe use more information..?
     $procData = DB::World()->selectRow('SELECT IF(ppmRate > 0, -ppmRate, customChance) AS chance, cooldown FROM spell_proc_event WHERE entry = ?d', $this->typeId);
     if (!isset($procData['cooldown'])) {
         $procData['cooldown'] = 0;
     }
     $effects = [];
     $spellIdx = array_unique(array_merge($this->subject->canTriggerSpell(), $this->subject->canTeachSpell()));
     $itemIdx = $this->subject->canCreateItem();
     // Iterate through all effects:
     for ($i = 1; $i < 4; $i++) {
         if ($this->subject->getField('effect' . $i . 'Id') <= 0) {
             continue;
         }
         $effId = (int) $this->subject->getField('effect' . $i . 'Id');
         $effMV = (int) $this->subject->getField('effect' . $i . 'MiscValue');
         $effBP = (int) $this->subject->getField('effect' . $i . 'BasePoints');
         $effDS = (int) $this->subject->getField('effect' . $i . 'DieSides');
         $effRPPL = $this->subject->getField('effect' . $i . 'RealPointsPerLevel');
         $effAura = (int) $this->subject->getField('effect' . $i . 'AuraId');
         $foo =& $effects[];
         // Icons:
         // .. from item
         if (in_array($i, $itemIdx)) {
             $_ = $this->subject->getField('effect' . $i . 'CreateItemId');
             foreach ($this->subject->relItems->iterate() as $itemId => $__) {
                 if ($itemId != $_) {
                     continue;
                 }
                 $foo['icon'] = array('id' => $this->subject->relItems->id, 'name' => $this->subject->relItems->getField('name', true), 'quality' => $this->subject->relItems->getField('quality'), 'count' => $effDS + $effBP, 'icon' => $this->subject->relItems->getField('iconString'));
                 break;
             }
             if ($effDS > 1) {
                 $foo['icon']['count'] = "'" . ($effBP + 1) . '-' . $foo['icon']['count'] . "'";
             }
         } else {
             if (in_array($i, $spellIdx) || $effId == 133) {
                 $_ = $this->subject->getField('effect' . $i . 'TriggerSpell');
                 if (!$_) {
                     $_ = $this->subject->getField('effect' . $i . 'MiscValue');
                 }
                 $trig = new SpellList(array(['s.id', (int) $_]));
                 $foo['icon'] = array('id' => $_, 'name' => $trig->error ? Util::ucFirst(Lang::game('spell')) . ' #' . $_ : $trig->getField('name', true), 'count' => 0);
                 $this->extendGlobalData($trig->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
             }
         }
         // Effect Name
         $foo['name'] = (User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, 'EffectId: ' . $effId, Util::$spellEffectStrings[$effId]) : Util::$spellEffectStrings[$effId]) . Lang::main('colon');
         if ($this->subject->getField('effect' . $i . 'RadiusMax') > 0) {
             $foo['radius'] = $this->subject->getField('effect' . $i . 'RadiusMax');
         }
         if (!in_array($i, $itemIdx) && !in_array($i, $spellIdx) && !in_array($effAura, [225, 227])) {
             $foo['value'] = ($effDS && $effDS != 1 ? $effBP + 1 . Lang::game('valueDelim') : null) . ($effBP + $effDS);
         }
         if ($effRPPL != 0) {
             $foo['value'] = (isset($foo['value']) ? $foo['value'] : '0') . sprintf(Lang::spell('costPerLevel'), $effRPPL);
         }
         if ($this->subject->getField('effect' . $i . 'Periode') > 0) {
             $foo['interval'] = Util::formatTime($this->subject->getField('effect' . $i . 'Periode'));
         }
         if ($_ = $this->subject->getField('effect' . $i . 'Mechanic')) {
             $foo['mechanic'] = Lang::game('me', $_);
         }
         if (!empty($procData['chance'])) {
             $foo['procData'] = array($procData['chance'], $procData['cooldown'] ? Util::formatTime($procData['cooldown'] * 1000, true) : null);
         } else {
             if (in_array($i, $this->subject->canTriggerSpell()) && $this->subject->getField('procChance')) {
                 $foo['procData'] = array($this->subject->getField('procChance'), $procData['cooldown'] ? Util::formatTime($procData['cooldown'] * 1000, true) : null);
             }
         }
         // parse masks and indizes
         switch ($effId) {
             case 8:
                 // Power Drain
             // Power Drain
             case 30:
                 // Energize
             // Energize
             case 137:
                 // Energize Pct
                 $_ = Lang::spell('powerTypes', $effMV);
                 if ($_ && User::isInGroup(U_GROUP_EMPLOYEE)) {
                     $_ = sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_);
                 } else {
                     if (!$_) {
                         $_ = $effMV;
                     }
                 }
                 if ($effMV == POWER_RAGE || $effMV == POWER_RUNIC_POWER) {
                     $foo['value'] = ($effDS && $effDS != 1 ? ($effBP + 1) / 10 . Lang::game('valueDelim') : null) . ($effBP + $effDS) / 10;
                 }
                 $foo['name'] .= ' (' . $_ . ')';
                 break;
             case 16:
                 // QuestComplete
                 if ($_ = QuestList::getName($effMV)) {
                     $foo['name'] .= '(<a href="?quest=' . $effMV . '">' . $_ . '</a>)';
                 } else {
                     $foo['name'] .= Util::ucFirst(Lang::game('quest')) . ' #' . $effMV;
                 }
                 break;
             case 28:
                 // Summon
             // Summon
             case 90:
                 // Kill Credit
             // Kill Credit
             case 134:
                 // Kill Credit2
                 $_ = Lang::game('npc') . ' #' . $effMV;
                 if ($summon = $this->subject->getModelInfo($this->typeId, $i)) {
                     $_ = $summon['typeId'] ? ' (<a href="?npc=' . $summon['typeId'] . '">' . $summon['displayName'] . '</a>)' : ' (#0)';
                     $redButtons[BUTTON_VIEW3D] = ['type' => TYPE_NPC, 'displayId' => $summon['displayId']];
                 }
                 $foo['name'] .= $_;
                 break;
             case 33:
                 // Open Lock
                 $_ = $effMV ? Lang::spell('lockType', $effMV) : $effMV;
                 if ($_ && User::isInGroup(U_GROUP_EMPLOYEE)) {
                     $_ = sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_);
                 } else {
                     if (!$_) {
                         $_ = $effMV;
                     }
                 }
                 $foo['name'] .= ' (' . $_ . ')';
                 break;
             case 53:
                 // Enchant Item Perm
             // Enchant Item Perm
             case 54:
                 // Enchant Item Temp
             // Enchant Item Temp
             case 92:
                 // Enchant Held Item
             // Enchant Held Item
             case 156:
                 // Enchant Item Prismatic
                 if ($_ = DB::Aowow()->selectRow('SELECT * FROM ?_itemenchantment WHERE id = ?d', $effMV)) {
                     $foo['name'] .= ' (<a href="?enchantment=' . $effMV . '" class="q2">' . Util::localizedString($_, 'name') . '</a>)';
                 } else {
                     $foo['name'] .= ' #' . $effMV;
                 }
                 break;
             case 38:
                 // Dispel [miscValue => Types]
             // Dispel [miscValue => Types]
             case 126:
                 // Steal Aura
                 $_ = Lang::game('dt', $effMV);
                 if ($_ && User::isInGroup(U_GROUP_EMPLOYEE)) {
                     $_ = sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_);
                 } else {
                     if (!$_) {
                         $_ = $effMV;
                     }
                 }
                 $foo['name'] .= ' (' . $_ . ')';
                 break;
             case 39:
                 // Learn Language
                 $_ = Lang::game('languages', $effMV);
                 if ($_ && User::isInGroup(U_GROUP_EMPLOYEE)) {
                     $_ = sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_);
                 } else {
                     if (!$_) {
                         $_ = $effMV;
                     }
                 }
                 $foo['name'] .= ' (' . $_ . ')';
                 break;
             case 50:
                 // Trans Door
             // Trans Door
             case 76:
                 // Summon Object (Wild)
                 // case 86:                                 // Activate Object
             // Summon Object (Wild)
             // case 86:                                 // Activate Object
             case 104:
                 // Summon Object (slot 1)
             // Summon Object (slot 1)
             case 105:
                 // Summon Object (slot 2)
             // Summon Object (slot 2)
             case 106:
                 // Summon Object (slot 3)
             // Summon Object (slot 3)
             case 107:
                 // Summon Object (slot 4)
                 $_ = Util::ucFirst(Lang::game('object')) . ' #' . $effMV;
                 if ($summon = $this->subject->getModelInfo($this->typeId, $i)) {
                     $_ = $summon['typeId'] ? ' (<a href="?object=' . $summon['typeId'] . '">' . $summon['displayName'] . '</a>)' : ' (#0)';
                     $redButtons[BUTTON_VIEW3D] = ['type' => TYPE_OBJECT, 'displayId' => $summon['displayId']];
                 }
                 $foo['name'] .= $_;
                 break;
             case 74:
                 // Apply Glyph
                 if ($_ = DB::Aowow()->selectCell('SELECT spellId FROM ?_glyphproperties WHERE id = ?d', $effMV)) {
                     if ($n = SpellList::getName($_)) {
                         $foo['name'] .= '(<a href="?spell=' . $_ . '">' . $n . '</a>)';
                     } else {
                         $foo['name'] .= Util::ucFirst(Lang::game('spell')) . ' #' . $effMV;
                     }
                 } else {
                     $foo['name'] .= ' #' . $effMV;
                 }
                 break;
             case 95:
                 // Skinning
                 switch ($effMV) {
                     case 0:
                         $_ = Lang::game('ct', 1) . ', ' . Lang::game('ct', 2);
                         break;
                         // Beast, Dragonkin
                     // Beast, Dragonkin
                     case 1:
                     case 2:
                         $_ = Lang::game('ct', 4);
                         break;
                         // Elemental (nature based, earth based)
                     // Elemental (nature based, earth based)
                     case 3:
                         $_ = Lang::game('ct', 9);
                         break;
                         // Mechanic
                     // Mechanic
                     default:
                         $_ = '';
                 }
                 if (User::isInGroup(U_GROUP_EMPLOYEE)) {
                     $_ = sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_);
                 } else {
                     $_ = $effMV;
                 }
                 $foo['name'] .= ' (' . $_ . ')';
                 break;
             case 108:
                 // Dispel Mechanic
                 $_ = Lang::game('me', $effMV);
                 if ($_ && User::isInGroup(U_GROUP_EMPLOYEE)) {
                     $_ = sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_);
                 } else {
                     if (!$_) {
                         $_ = $effMV;
                     }
                 }
                 $foo['name'] .= ' (' . $_ . ')';
                 break;
             case 118:
                 // Require Skill
                 if ($_ = SkillList::getName($effMV)) {
                     $foo['name'] .= '(<a href="?skill=' . $effMV . '">' . $_ . '</a>)';
                 } else {
                     $foo['name'] .= Util::ucFirst(Lang::game('skill')) . ' #' . $effMV;
                 }
                 break;
             case 146:
                 // Activate Rune
                 $_ = Lang::spell('powerRunes', $effMV);
                 if ($_ && User::isInGroup(U_GROUP_EMPLOYEE)) {
                     $_ = sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_);
                 } else {
                     if (!$_) {
                         $_ = $effMV;
                     }
                 }
                 $foo['name'] .= ' (' . $_ . ')';
                 break;
             case 123:
                 // Send Taxi - effMV is taxiPathId. We only use paths for flightmasters for now, so spell-triggered paths are not in the table
             // Send Taxi - effMV is taxiPathId. We only use paths for flightmasters for now, so spell-triggered paths are not in the table
             default:
                 if (($effMV || $effId == 97) && $effId != 155) {
                     $foo['name'] .= ' (' . $effMV . ')';
                 }
                 // Aura
             // Aura
             case 6:
                 // Simple
             // Simple
             case 27:
                 // AA Persistent
             // AA Persistent
             case 35:
                 // AA Party
             // AA Party
             case 65:
                 // AA Raid
             // AA Raid
             case 119:
                 // AA Pet
             // AA Pet
             case 128:
                 // AA Friend
             // AA Friend
             case 129:
                 // AA Enemy
             // AA Enemy
             case 143:
                 if ($effAura > 0 && isset(Util::$spellAuraStrings[$effAura])) {
                     $foo['name'] .= User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, 'AuraId: ' . $effAura, Util::$spellAuraStrings[$effAura]) : Util::$spellAuraStrings[$effAura];
                     $bar = $effMV;
                     switch ($effAura) {
                         case 17:
                             // Mod Stealth Detection
                             if ($_ = Lang::spell('stealthType', $effMV)) {
                                 $bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_) : $_;
                             }
                             break;
                         case 19:
                             // Mod Invisibility Detection
                             if ($_ = Lang::spell('invisibilityType', $effMV)) {
                                 $bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_) : $_;
                             }
                             break;
                         case 24:
                             // Periodic Energize
                         // Periodic Energize
                         case 21:
                             // Obsolete Mod Power
                         // Obsolete Mod Power
                         case 35:
                             // Mod Increase Power
                         // Mod Increase Power
                         case 85:
                             // Mod Power Regeneration
                         // Mod Power Regeneration
                         case 110:
                             // Mod Power Regeneration Pct
                             if ($_ = Lang::spell('powerTypes', $effMV)) {
                                 $bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_) : $_;
                             }
                             break;
                         case 29:
                             // Mod Stat
                         // Mod Stat
                         case 80:
                             // Mod Stat %
                         // Mod Stat %
                         case 137:
                             // Mod Total Stat %
                         // Mod Total Stat %
                         case 175:
                             // Mod Spell Healing Of Stat Percent
                         // Mod Spell Healing Of Stat Percent
                         case 212:
                             // Mod Ranged Attack Power Of Stat Percent
                         // Mod Ranged Attack Power Of Stat Percent
                         case 219:
                             // Mod Mana Regeneration from Stat
                         // Mod Mana Regeneration from Stat
                         case 268:
                             // Mod Attack Power Of Stat Percent
                             $mask = $effMV == -1 ? 0x1f : 1 << $effMV;
                             $_ = [];
                             for ($j = 0; $j < 5; $j++) {
                                 if ($mask & 1 << $j) {
                                     $_[] = Lang::game('stats', $j);
                                 }
                             }
                             if ($_ = implode(', ', $_)) {
                             }
                             $bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_) : $_;
                             break;
                         case 36:
                             // Shapeshift
                             if ($st = $this->subject->getModelInfo($this->typeId, $i)) {
                                 $redButtons[BUTTON_VIEW3D] = array('type' => TYPE_NPC, 'displayId' => $st['displayId']);
                                 if ($st['creatureType'] > 0) {
                                     $infobox[] = Lang::game('type') . Lang::main('colon') . Lang::game('ct', $st['creatureType']);
                                 }
                                 if ($_ = $st['displayName']) {
                                     $bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_) : $_;
                                 }
                             }
                             break;
                         case 37:
                             // Effect immunity
                             if (isset(Util::$spellEffectStrings[$effMV])) {
                                 $_ = Util::$spellEffectStrings[$effMV];
                                 $bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_) : $_;
                             }
                             break;
                         case 38:
                             // Aura immunity
                             if (isset(Util::$spellAuraStrings[$effMV])) {
                                 $_ = Util::$spellAuraStrings[$effMV];
                                 $bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_) : $_;
                             }
                             break;
                         case 41:
                             // Dispel Immunity
                         // Dispel Immunity
                         case 178:
                             // Mod Debuff Resistance
                         // Mod Debuff Resistance
                         case 245:
                             // Mod Aura Duration By Dispel
                             if ($_ = Lang::game('dt', $effMV)) {
                                 $bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_) : $_;
                             }
                             break;
                         case 44:
                             // Track Creature
                             if ($_ = Lang::game('ct', $effMV)) {
                                 $bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_) : $_;
                             }
                             break;
                         case 45:
                             // Track Resource
                             if ($_ = Lang::spell('lockType', $effMV)) {
                                 $bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_) : $_;
                             }
                             break;
                         case 75:
                             // Language
                             if ($_ = Lang::game('languages', $effMV)) {
                                 $bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_) : $_;
                             }
                             break;
                         case 77:
                             // Mechanic Immunity
                         // Mechanic Immunity
                         case 117:
                             // Mod Mechanic Resistance
                         // Mod Mechanic Resistance
                         case 232:
                             // Mod Mechanic Duration
                         // Mod Mechanic Duration
                         case 234:
                             // Mod Mechanic Duration (no stack)
                         // Mod Mechanic Duration (no stack)
                         case 255:
                             // Mod Mechanic Damage Taken Pct
                         // Mod Mechanic Damage Taken Pct
                         case 276:
                             // Mod Mechanic Damage Done Percent
                             if ($_ = Lang::game('me', $effMV)) {
                                 $bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . Util::asHex($effMV), $_) : $_;
                             }
                             break;
                         case 147:
                             // Mechanic Immunity Mask
                             $_ = [];
                             foreach (Lang::game('me') as $k => $str) {
                                 if ($effMV & 1 << $k - 1) {
                                     $_[] = $str;
                                 }
                             }
                             if ($_ = implode(', ', $_)) {
                                 $bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . Util::asHex($effMV), $_) : $_;
                             }
                             break;
                         case 10:
                             // Mod Threat
                         // Mod Threat
                         case 13:
                             // Mod Damage Done
                         // Mod Damage Done
                         case 14:
                             // Mod Damage Taken
                         // Mod Damage Taken
                         case 22:
                             // Mod Resistance
                         // Mod Resistance
                         case 39:
                             // School Immunity
                         // School Immunity
                         case 40:
                             // Damage Immunity
                         // Damage Immunity
                         case 50:
                             // Mod Critical Healing Amount
                         // Mod Critical Healing Amount
                         case 57:
                             // Mod Spell Crit Chance
                         // Mod Spell Crit Chance
                         case 69:
                             // School Absorb
                         // School Absorb
                         case 71:
                             // Mod Spell Crit Chance School
                         // Mod Spell Crit Chance School
                         case 72:
                             // Mod Power Cost School Percent
                         // Mod Power Cost School Percent
                         case 73:
                             // Mod Power Cost School Flat
                         // Mod Power Cost School Flat
                         case 74:
                             // Reflect Spell School
                         // Reflect Spell School
                         case 79:
                             // Mod Damage Done Pct
                         // Mod Damage Done Pct
                         case 81:
                             // Split Damage Pct
                         // Split Damage Pct
                         case 83:
                             // Mod Base Resistance
                         // Mod Base Resistance
                         case 87:
                             // Mod Damage Taken Pct
                         // Mod Damage Taken Pct
                         case 97:
                             // Mana Shield
                         // Mana Shield
                         case 101:
                             // Mod Resistance Pct
                         // Mod Resistance Pct
                         case 115:
                             // Mod Healing Taken
                         // Mod Healing Taken
                         case 118:
                             // Mod Healing Taken Pct
                         // Mod Healing Taken Pct
                         case 123:
                             // Mod Target Resistance
                         // Mod Target Resistance
                         case 135:
                             // Mod Healing Done
                         // Mod Healing Done
                         case 136:
                             // Mod Healing Done Pct
                         // Mod Healing Done Pct
                         case 142:
                             // Mod Base Resistance Pct
                         // Mod Base Resistance Pct
                         case 143:
                             // Mod Resistance Exclusive
                         // Mod Resistance Exclusive
                         case 149:
                             // Reduce Pushback
                         // Reduce Pushback
                         case 163:
                             // Mod Crit Damage Bonus
                         // Mod Crit Damage Bonus
                         case 174:
                             // Mod Spell Damage Of Stat Percent
                         // Mod Spell Damage Of Stat Percent
                         case 182:
                             // Mod Resistance Of Stat Percent
                         // Mod Resistance Of Stat Percent
                         case 186:
                             // Mod Attacker Spell Hit Chance
                         // Mod Attacker Spell Hit Chance
                         case 194:
                             // Mod Target Absorb School
                         // Mod Target Absorb School
                         case 195:
                             // Mod Target Ability Absorb School
                         // Mod Target Ability Absorb School
                         case 199:
                             // Mod Increases Spell Percent to Hit
                         // Mod Increases Spell Percent to Hit
                         case 229:
                             // Mod AoE Damage Avoidance
                         // Mod AoE Damage Avoidance
                         case 271:
                             // Mod Damage Percent Taken Form Caster
                         // Mod Damage Percent Taken Form Caster
                         case 310:
                             // Mod Creature AoE Damage Avoidance
                             if ($_ = Lang::getMagicSchools($effMV)) {
                                 $bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . Util::asHex($effMV), $_) : $_;
                             }
                             break;
                         case 30:
                             // Mod Skill
                         // Mod Skill
                         case 98:
                             // Mod Skill Value
                             if ($_ = SkillList::getName($effMV)) {
                                 $bar = ' (<a href="?skill=' . $effMV . '">' . SkillList::getName($effMV) . '</a>)';
                             } else {
                                 $bar = Lang::main('colon') . Util::ucFirst(Lang::game('skill')) . ' #' . $effMV;
                             }
                             break;
                         case 107:
                             // Flat Modifier
                         // Flat Modifier
                         case 108:
                             // Pct Modifier
                             if ($_ = Lang::spell('spellModOp', $effMV)) {
                                 $bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_) : $_;
                             }
                             break;
                         case 189:
                             // Mod Rating
                         // Mod Rating
                         case 220:
                             // Combat Rating From Stat
                             $_ = [];
                             foreach (Lang::spell('combatRating') as $k => $str) {
                                 if (1 << $k & $effMV) {
                                     $_[] = $str;
                                 }
                             }
                             if ($_ = implode(', ', $_)) {
                                 $bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . Util::asHex($effMV), $_) : $_;
                             }
                             break;
                         case 168:
                             // Mod Damage Done Versus
                         // Mod Damage Done Versus
                         case 59:
                             // Mod Damage Done Versus Creature
                         // Mod Damage Done Versus Creature
                         case 102:
                             // Mod Melee Attack Power Versus
                         // Mod Melee Attack Power Versus
                         case 131:
                             // Mod Ranged Attack Power Versus
                         // Mod Ranged Attack Power Versus
                         case 180:
                             // Mod Spell Damage Versus
                             $_ = [];
                             foreach (Lang::game('ct') as $k => $str) {
                                 if ($effMV & 1 << $k - 1) {
                                     $_[] = $str;
                                 }
                             }
                             if ($_ = implode(', ', $_)) {
                                 $bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . Util::asHex($effMV), $_) : $_;
                             }
                             break;
                         case 249:
                             // Convert Rune
                             $x = $this->subject->getField('effect' . $i . 'MiscValueB');
                             if ($_ = Lang::spell('powerRunes', $x)) {
                                 $bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $x, $_) : $_;
                             }
                             break;
                         case 78:
                             // Mounted
                         // Mounted
                         case 56:
                             // Transform
                             if ($transform = $this->subject->getModelInfo($this->typeId, $i)) {
                                 $redButtons[BUTTON_VIEW3D] = ['type' => TYPE_NPC, 'displayId' => $transform['displayId']];
                                 $bar = $transform['typeId'] ? ' (<a href="?npc=' . $transform['typeId'] . '">' . $transform['displayName'] . '</a>)' : ' (#0)';
                             } else {
                                 $bar = Lang::main('colon') . Lang::game('npc') . ' #' . $effMV;
                             }
                             break;
                         case 139:
                             // Force Reaction
                             $foo['value'] = sprintf(Util::$dfnString, $foo['value'], Lang::game('rep', $foo['value']));
                             // DO NOT BREAK
                         // DO NOT BREAK
                         case 190:
                             // Mod Faction Reputation Gain
                             $bar = ' (<a href="?faction=' . $effMV . '">' . FactionList::getName($effMV) . '</a>)';
                             break;
                             // also breaks for 139
                     }
                     $foo['name'] .= strstr($bar, 'href') || strstr($bar, '#') ? $bar : ($bar ? ' (' . $bar . ')' : null);
                     if (in_array($effAura, [174, 220, 182])) {
                         $foo['name'] .= ' [' . sprintf(Util::$dfnString, Lang::game('stats', $this->subject->getField('effect' . $i . 'MiscValueB')), $this->subject->getField('effect' . $i . 'MiscValueB')) . ']';
                     } else {
                         if ($this->subject->getField('effect' . $i . 'MiscValueB') > 0) {
                             $foo['name'] .= ' [' . $this->subject->getField('effect' . $i . 'MiscValueB') . ']';
                         }
                     }
                 } else {
                     if ($effAura > 0) {
                         $foo['name'] .= Lang::main('colon') . 'Unknown Aura (' . $effAura . ')';
                     }
                 }
                 break;
         }
         // cases where we dont want 'Value' to be displayed
         if (in_array($effAura, [11, 12, 36, 77]) || in_array($effId, []) || empty($foo['value'])) {
             unset($foo['value']);
         }
     }
     unset($foo);
     // clear reference
     return $effects;
 }
Example #26
0
?>
" type="text/javascript"></script>
    <script src="<?php 
echo STATIC_URL . '/js/global.js?' . AOWOW_REVISION;
?>
" type="text/javascript"></script>
    <script src="<?php 
echo STATIC_URL . '/js/locale.js?' . AOWOW_REVISION;
?>
" type="text/javascript"></script>
    <script src="<?php 
echo STATIC_URL . '/js/Markup.js?' . AOWOW_REVISION;
?>
" type="text/javascript"></script>
<?php 
if (User::isInGroup(U_GROUP_STAFF | U_GROUP_SCREENSHOT | U_GROUP_VIDEO)) {
    echo '    <script src="' . STATIC_URL . '/js/staff.js?' . AOWOW_REVISION . "\" type=\"text/javascript\"></script>\n";
}
foreach ($this->js as $js) {
    if (!empty($js)) {
        echo '    <script src="' . ($js[0] == '?' ? $js . '&' : STATIC_URL . '/js/' . $js . '?') . AOWOW_REVISION . "\" type=\"text/javascript\"></script>\n";
    }
}
?>
    <script type="text/javascript">
        var g_user = <?php 
echo Util::toJSON($this->gUser, JSON_UNESCAPED_UNICODE);
?>
;
    </script>
<?php 
Example #27
0
 protected function generateContent()
 {
     /****************/
     /* Main Content */
     /****************/
     if (in_array(array_search($this->page, $this->validPages), [0, 1, 2, 3, 11, 12])) {
         $this->h1Links = '<small><a href="?' . $this->page . ($this->category ? '=' . $this->category[0] : null) . '&rss" class="icon-rss">' . Lang::main('subscribe') . '</a></small>';
     }
     switch ($this->page) {
         case 'random':
             $type = array_rand(array_filter(Util::$typeClasses));
             $typeId = (new Util::$typeClasses[$type](null))->getRandomId();
             header('Location: ?' . Util::$typeStrings[$type] . '=' . $typeId, true, 302);
             die;
         case 'latest-comments':
             // rss
             $data = CommunityContent::getCommentPreviews();
             if ($this->rss) {
                 foreach ($data as $d) {
                     // todo (low): preview should be html-formated
                     $this->feedData[] = array('title' => [true, [], Util::ucFirst(Lang::game(Util::$typeStrings[$d['type']])) . Lang::main('colon') . htmlentities($d['subject'])], 'link' => [false, [], HOST_URL . '/?go-to-comment&amp;id=' . $d['id']], 'description' => [true, [], htmlentities($d['preview']) . "<br /><br />" . sprintf(Lang::main('byUserTimeAgo'), $d['user'], Util::formatTime($d['elapsed'] * 1000, true))], 'pubDate' => [false, [], date(DATE_RSS, time() - $d['elapsed'])], 'guid' => [false, [], HOST_URL . '/?go-to-comment&amp;id=' . $d['id']]);
                 }
             } else {
                 $this->lvTabs[] = ['commentpreview', ['data' => $data]];
             }
             break;
         case 'latest-screenshots':
             // rss
             $data = CommunityContent::getScreenshots();
             if ($this->rss) {
                 foreach ($data as $d) {
                     $desc = '<a href="' . HOST_URL . '/?' . Util::$typeStrings[$d['type']] . '=' . $d['typeId'] . '#screenshots:id=' . $d['id'] . '"><img src="' . STATIC_URL . '/uploads/screenshots/thumb/' . $d['id'] . '.jpg" alt="" /></a>';
                     if ($d['caption']) {
                         $desc .= '<br />' . $d['caption'];
                     }
                     $desc .= "<br /><br />" . sprintf(Lang::main('byUserTimeAgo'), $d['user'], Util::formatTime($d['elapsed'] * 1000, true));
                     // enclosure/length => filesize('static/uploads/screenshots/thumb/'.$d['id'].'.jpg') .. always set to this placeholder value though
                     $this->feedData[] = array('title' => [true, [], Util::ucFirst(Lang::game(Util::$typeStrings[$d['type']])) . Lang::main('colon') . htmlentities($d['subject'])], 'link' => [false, [], HOST_URL . '/?' . Util::$typeStrings[$d['type']] . '=' . $d['typeId'] . '#screenshots:id=' . $d['id']], 'description' => [true, [], $desc], 'pubDate' => [false, [], date(DATE_RSS, time() - $d['elapsed'])], 'enclosure' => [false, ['url' => STATIC_URL . '/uploads/screenshots/thumb/' . $d['id'] . '.jpg', 'length' => 12345, 'type' => 'image/jpeg'], null], 'guid' => [false, [], HOST_URL . '/?' . Util::$typeStrings[$d['type']] . '=' . $d['typeId'] . '#screenshots:id=' . $d['id']]);
                 }
             } else {
                 $this->lvTabs[] = ['screenshot', ['data' => $data]];
             }
             break;
         case 'latest-videos':
             // rss
             $data = CommunityContent::getVideos();
             if ($this->rss) {
                 foreach ($data as $d) {
                     $desc = '<a href="' . HOST_URL . '/?' . Util::$typeStrings[$d['type']] . '=' . $d['typeId'] . '#videos:id=' . $d['id'] . '"><img src="//i3.ytimg.com/vi/' . $d['videoId'] . '/default.jpg" alt="" /></a>';
                     if ($d['caption']) {
                         $desc .= '<br />' . $d['caption'];
                     }
                     $desc .= "<br /><br />" . sprintf(Lang::main('byUserTimeAgo'), $d['user'], Util::formatTime($d['elapsed'] * 1000, true));
                     // is enclosure/length .. is this even relevant..?
                     $this->feedData[] = array('title' => [true, [], Util::ucFirst(Lang::game(Util::$typeStrings[$d['type']])) . Lang::main('colon') . htmlentities($row['subject'])], 'link' => [false, [], HOST_URL . '/?' . Util::$typeStrings[$d['type']] . '=' . $d['typeId'] . '#videos:id=' . $d['id']], 'description' => [true, [], $desc], 'pubDate' => [false, [], date(DATE_RSS, time() - $row['elapsed'])], 'enclosure' => [false, ['url' => '//i3.ytimg.com/vi/' . $d['videoId'] . '/default.jpg', 'length' => 12345, 'type' => 'image/jpeg'], null], 'guid' => [false, [], HOST_URL . '/?' . Util::$typeStrings[$d['type']] . '=' . $d['typeId'] . '#videos:id=' . $d['id']]);
                 }
             } else {
                 $this->lvTabs[] = ['video', ['data' => $data]];
             }
             break;
         case 'latest-articles':
             // rss
             $this->lvTabs = [];
             break;
         case 'latest-additions':
             // rss
             $extraText = '';
             break;
         case 'unrated-comments':
             $this->lvTabs[] = ['commentpreview', ['data' => []]];
             break;
         case 'missing-screenshots':
             // limit to 200 entries each (it generates faster, consumes less memory and should be enough options)
             $cnd = [[['cuFlags', CUSTOM_HAS_SCREENSHOT, '&'], 0], 200];
             if (!User::isInGroup(U_GROUP_EMPLOYEE)) {
                 $cnd[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0];
             }
             foreach (Util::$typeClasses as $classStr) {
                 if (!$classStr) {
                     continue;
                 }
                 $typeObj = new $classStr($cnd);
                 if (!$typeObj->error) {
                     $this->extendGlobalData($typeObj->getJSGlobals(GLOBALINFO_ANY));
                     $this->lvTabs[] = [$typeObj::$brickFile, ['data' => array_values($typeObj->getListviewData())]];
                 }
             }
             break;
         case 'most-comments':
             // rss
             if ($this->category && !in_array($this->category[0], [1, 7, 30])) {
                 header('Location: ?most-comments=1' . ($this->rss ? '&rss' : null), true, 302);
             }
             $tabBase = array('extraCols' => ["\$Listview.funcBox.createSimpleCol('ncomments', 'tab_comments', '10%', 'ncomments')"], 'sort' => ['-ncomments']);
             foreach (Util::$typeClasses as $type => $classStr) {
                 if (!$classStr) {
                     continue;
                 }
                 $comments = DB::Aowow()->selectCol('
                     SELECT   `typeId` AS ARRAY_KEY, count(1) FROM ?_comments
                     WHERE    `replyTo` = 0 AND (`flags` & ?d) = 0 AND `type`= ?d AND `date` > (UNIX_TIMESTAMP() - ?d)
                     GROUP BY `type`, `typeId`
                     LIMIT    100', CC_FLAG_DELETED, $type, (isset($this->category[0]) ? $this->category[0] : 1) * DAY);
                 if (!$comments) {
                     continue;
                 }
                 $typeClass = new $classStr(array(['id', array_keys($comments)]));
                 if (!$typeClass->error) {
                     $data = $typeClass->getListviewData();
                     if ($this->rss) {
                         foreach ($data as $typeId => &$d) {
                             $this->feedData[] = array('title' => [true, [], htmlentities(Util::$typeStrings[$type] == 'item' ? mb_substr($d['name'], 1) : $d['name'])], 'type' => [false, [], Util::$typeStrings[$type]], 'link' => [false, [], HOST_URL . '/?' . Util::$typeStrings[$type] . '=' . $d['id']], 'ncomments' => [false, [], $comments[$typeId]]);
                         }
                     } else {
                         foreach ($data as $typeId => &$d) {
                             $d['ncomments'] = $comments[$typeId];
                         }
                         $this->extendGlobalData($typeClass->getJSGlobals(GLOBALINFO_ANY));
                         $this->lvTabs[] = [$typeClass::$brickFile, array_merge($tabBase, ['data' => array_values($data)])];
                     }
                 }
             }
             break;
     }
     // found nothing => set empty content
     // tpl: commentpreview - anything, doesn't matter what
     if (!$this->lvTabs && !$this->rss) {
         $this->lvTabs[] = ['commentpreview', ['data' => []]];
     }
 }
Example #28
0
 private function parseRating($type, $value, $interactive = false, &$scaling = false)
 {
     // clamp level range
     $ssdLvl = isset($this->ssd[$this->id]) ? $this->ssd[$this->id]['maxLevel'] : 1;
     $reqLvl = $this->curTpl['requiredLevel'] > 1 ? $this->curTpl['requiredLevel'] : MAX_LEVEL;
     $level = min(max($reqLvl, $ssdLvl), MAX_LEVEL);
     // unknown rating
     if (in_array($type, [2, 8, 9, 10, 11]) || $type > ITEM_MOD_BLOCK_VALUE || $type < 0) {
         if (User::isInGroup(U_GROUP_EMPLOYEE)) {
             return sprintf(Lang::item('statType', count(Lang::item('statType')) - 1), $type, $value);
         } else {
             return null;
         }
     } else {
         if (in_array($type, Util::$lvlIndepRating)) {
             return Lang::item('trigger', 1) . str_replace('%d', '<!--rtg' . $type . '-->' . $value, Lang::item('statType', $type));
         } else {
             $scaling = true;
             if ($interactive) {
                 $js = '&nbsp;<small>(' . sprintf(Util::$changeLevelString, Util::setRatingLevel($level, $type, $value)) . ')</small>';
             } else {
                 $js = '&nbsp;<small>(' . Util::setRatingLevel($level, $type, $value) . ')</small>';
             }
             return Lang::item('trigger', 1) . str_replace('%d', '<!--rtg' . $type . '-->' . $value . $js, Lang::item('statType', $type));
         }
     }
 }
Example #29
0
 public function display($override = '')
 {
     // Heisenbug: IE11 and FF32 will sometimes (under unknown circumstances) cache 302 redirects and stop
     // re-requesting them from the server but load them from local cache, thus breaking menu features.
     Util::sendNoCacheHeader();
     if (isset($this->tabId)) {
         $this->pageTemplate['activeTab'] = $this->tabId;
     }
     if ($override) {
         $this->addAnnouncements();
         include 'template/pages/' . $override . '.tpl.php';
         die;
     } else {
         if ($this->tpl) {
             $this->prepareContent();
             if (!$this->isSaneInclude('template/pages/', $this->tpl)) {
                 die(User::isInGroup(U_GROUP_EMPLOYEE) ? 'Error: nonexistant template requested: template/pages/' . $this->tpl . '.tpl.php' : null);
             }
             $this->addAnnouncements();
             include 'template/pages/' . $this->tpl . '.tpl.php';
             die;
         } else {
             $this->error();
         }
     }
 }
Example #30
0
 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');
 }