Ejemplo n.º 1
0
 protected function generateTitle()
 {
     array_unshift($this->title, $this->name);
     if ($this->category) {
         array_unshift($this->title, Lang::npc('cat', $this->category[0]));
     }
 }
Ejemplo n.º 2
0
 public function renderTooltip()
 {
     if (!$this->curTpl) {
         return null;
     }
     $level = '??';
     $type = $this->curTpl['type'];
     $row3 = [Lang::game('level')];
     $fam = $this->curTpl['family'];
     if (!($this->curTpl['typeFlags'] & 0x4)) {
         $level = $this->curTpl['minLevel'];
         if ($level != $this->curTpl['maxLevel']) {
             $level .= ' - ' . $this->curTpl['maxLevel'];
         }
     } else {
         $level = '??';
     }
     $row3[] = $level;
     if ($type) {
         $row3[] = Lang::game('ct', $type);
     }
     if ($_ = Lang::npc('rank', $this->curTpl['rank'])) {
         $row3[] = '(' . $_ . ')';
     }
     $x = '<table>';
     $x .= '<tr><td><b class="q">' . $this->getField('name', true) . '</b></td></tr>';
     if ($sn = $this->getField('subname', true)) {
         $x .= '<tr><td>' . $sn . '</td></tr>';
     }
     $x .= '<tr><td>' . implode(' ', $row3) . '</td></tr>';
     if ($type == 1 && $fam) {
         // 1: Beast
         $x .= '<tr><td>' . Lang::game('fa', $fam) . '</td></tr>';
     }
     $fac = new FactionList(array([['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0], ['id', (int) $this->getField('factionId')]));
     if (!$fac->error) {
         $x .= '<tr><td>' . $fac->getField('name', true) . '</td></tr>';
     }
     $x .= '</table>';
     return $x;
 }
Ejemplo n.º 3
0
                        </tr><tr>
                            <td class="padded"><?php 
echo Lang::game('level') . Lang::main('colon');
?>
</td>
                            <td class="padded">&nbsp;<input type="text" name="minle" maxlength="2" class="smalltextbox" <?php 
echo isset($f['minle']) ? 'value="' . $f['minle'] . '" ' : null;
?>
/> - <input type="text" name="maxle" maxlength="2" class="smalltextbox" <?php 
echo isset($f['maxle']) ? 'value="' . $f['maxle'] . '" ' : null;
?>
/></td>
                            <td class="padded" width="100%">
                                <table><tr>
                                    <td>&nbsp;&nbsp;&nbsp;<?php 
echo Lang::npc('react') . Lang::main('colon');
?>
</td>
                                    <td>&nbsp;<select name="ra" onchange="fi_dropdownSync(this)" onkeyup="fi_dropdownSync(this)" style="background-color: #181818"<?php 
echo isset($f['ra']) ? ' class="q' . ($f['ra'] == 1 ? '2' : ($f['ra'] == -1 ? '10' : null)) . '"' : null;
?>
>
                                        <option></option>
                                        <option value="1" class="q2"<?php 
echo isset($f['ra']) && $f['ra'] == 1 ? ' selected' : null;
?>
>A</option>
                                        <option value="0" class="q"<?php 
echo isset($f['ra']) && $f['ra'] == 0 ? ' selected' : null;
?>
>A</option>
Ejemplo n.º 4
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'));
     }
 }
Ejemplo n.º 5
0
 private function createFullSpawns()
 {
     $data = [];
     $wpSum = [];
     $wpIdx = 0;
     $spawns = DB::Aowow()->select("SELECT * FROM ?_spawns WHERE type = ?d AND typeId = ?d", self::$type, $this->id);
     if (!$spawns) {
         return;
     }
     foreach ($spawns as $s) {
         // check, if we can attach waypoints to creature
         // we will get a nice clusterfuck of dots if we do this for more GUIDs, than we have colors though
         if (count($spawns) < 6 && self::$type == TYPE_NPC) {
             if ($wPoints = DB::Aowow()->select('SELECT * FROM ?_creature_waypoints WHERE creatureOrPath = ?d AND floor = ?d', $s['pathId'] ? -$s['pathId'] : $this->id, $s['floor'])) {
                 foreach ($wPoints as $i => $p) {
                     $label = [Lang::npc('waypoint') . Lang::main('colon') . $p['point']];
                     if ($p['wait']) {
                         $label[] = Lang::npc('wait') . Lang::main('colon') . Util::formatTime($p['wait'], false);
                     }
                     $set = ['label' => '$<br><span class="q0">' . implode('<br>', $label) . '</span>', 'type' => $wpIdx];
                     // connective line
                     if ($i > 0) {
                         $set['lines'] = [[$wPoints[$i - 1]['posX'], $wPoints[$i - 1]['posY']]];
                     }
                     $data[$s['areaId']][$s['floor']]['coords'][] = [$p['posX'], $p['posY'], $set];
                     if (empty($wpSum[$s['areaId']][$s['floor']])) {
                         $wpSum[$s['areaId']][$s['floor']] = 1;
                     } else {
                         $wpSum[$s['areaId']][$s['floor']]++;
                     }
                 }
                 $wpIdx++;
             }
         }
         $label = [];
         if (User::isInGroup(U_GROUP_STAFF)) {
             $label[] = $s['guid'] < 0 ? 'Vehicle Accessory' : 'GUID' . Lang::main('colon') . $s['guid'];
         }
         if ($s['respawn']) {
             $label[] = Lang::npc('respawnIn') . Lang::main('colon') . Util::formatTime($s['respawn'] * 1000, false);
         }
         if (User::isInGroup(U_GROUP_STAFF)) {
             if ($s['phaseMask'] > 1 && ($s['phaseMask'] & 0xffff) != 0xffff) {
                 $label[] = Lang::game('phases') . Lang::main('colon') . Util::asHex($s['phaseMask']);
             }
             if ($s['spawnMask'] == 15) {
                 $label[] = Lang::game('mode') . Lang::main('colon') . Lang::game('modes', -1);
             } else {
                 if ($s['spawnMask']) {
                     $_ = [];
                     for ($i = 0; $i < 4; $i++) {
                         if ($s['spawnMask'] & 1 << $i) {
                             $_[] = Lang::game('modes', $i);
                         }
                     }
                     $label[] = Lang::game('mode') . Lang::main('colon') . implode(', ', $_);
                 }
             }
         }
         $data[$s['areaId']][$s['floor']]['coords'][] = [$s['posX'], $s['posY'], ['label' => '$<br><span class="q0">' . implode('<br>', $label) . '</span>']];
     }
     foreach ($data as $a => &$areas) {
         foreach ($areas as $f => &$floor) {
             $floor['count'] = count($floor['coords']) - (!empty($wpSum[$a][$f]) ? $wpSum[$a][$f] : 0);
         }
     }
     $this->spawnResult[SPAWNINFO_FULL] = $data;
 }
Ejemplo n.º 6
0
Archivo: npc.php Proyecto: saqar/aowow
 private function getOnKillRep($dummyIds, $mapType)
 {
     $spilledParents = [];
     $reputation = [];
     // base NPC
     if ($base = $this->getRepForId($this->typeId, $spilledParents)) {
         $reputation[] = [Lang::npc('modes', 1, 0), $base];
     }
     // difficulty dummys
     if ($dummyIds && ($mapType == 1 || $mapType == 2)) {
         $alt = [];
         $rep = $this->getRepForId(array_keys($dummyIds), $spilledParents);
         // order by difficulty
         foreach ($rep as $r) {
             $alt[$dummyIds[$r['npc']]][] = $r;
         }
         // apply by difficulty
         foreach ($alt as $mode => $dat) {
             $reputation[] = [Lang::npc('modes', $mapType, $mode), $dat];
         }
     }
     // get spillover factions and apply
     if ($spilledParents) {
         $spilled = new FactionList(array(['parentFactionId', array_keys($spilledParents)]));
         foreach ($reputation as &$sets) {
             foreach ($sets[1] as &$row) {
                 if (empty($row['spillover'])) {
                     continue;
                 }
                 foreach ($spilled->iterate() as $spId => $__) {
                     // find parent
                     if ($spilled->getField('parentFactionId') != $row['spillover']) {
                         continue;
                     }
                     // don't readd parent
                     if ($row['id'] == $spId) {
                         continue;
                     }
                     $spMax = $spilledParents[$row['spillover']][1];
                     $sets[1][] = array('id' => $spId, 'qty' => $spilledParents[$row['spillover']][0], 'name' => $spilled->getField('name', true), 'cap' => $spMax && $spMax < REP_EXALTED ? Lang::game('rep', $spMax) : null);
                 }
             }
         }
     }
     return $reputation;
 }
Ejemplo n.º 7
0
<?php

if (isset($this->map) && empty($this->map)) {
    echo Lang::zone('noMap');
} elseif (!empty($this->map['data'])) {
    if ($this->type != TYPE_ZONE) {
        echo '            <div>' . ($this->type == TYPE_OBJECT ? Lang::gameObject('foundIn') : Lang::npc('foundIn')) . ' <span id="locations">';
        $n = count($this->map['mapperData']);
        $i = 0;
        foreach ($this->map['mapperData'] as $areaId => $areaData) {
            if ($n > 1 && $i++ > 0) {
                echo $i < $n ? ', ' : Lang::main('and');
            }
            echo '<a href="javascript:;" onclick="myMapper.update({zone: ' . $areaId . '}); g_setSelectedLink(this, \'mapper\'); return false" onmousedown="return false">' . $this->map['extra'][$areaId] . '</a>&nbsp;(' . reset($areaData)['count'] . ')';
        }
        echo ".</span></div>\n";
    }
    if (!empty($this->map['data']['zone']) && $this->map['data']['zone'] < 0) {
        ?>
            <div id="mapper" style="width: 778px; margin: 0 auto">
<?php 
        if (isset($this->map['som'])) {
            ?>
                <div id="som-generic"></div>
<?php 
        }
        ?>
                <div id="mapper-generic"></div>
                <div class="pad clear"></div>
            </div>
<?php 
Ejemplo n.º 8
0
 protected function generateContent()
 {
     $this->addJS('?data=zones&locale=' . User::$localeId . '&t=' . $_SESSION['dataKey']);
     /***********/
     /* Infobox */
     /***********/
     $this->infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
     // boss
     if ($_ = $this->subject->getField('bossCreature')) {
         $this->extendGlobalIds(TYPE_NPC, $_);
         $this->infobox[] = Lang::npc('rank', 3) . Lang::main('colon') . '[npc=' . $_ . ']';
     }
     // display internal id to staff
     if (User::isInGroup(U_GROUP_STAFF)) {
         $this->infobox[] = 'Event-Id' . Lang::main('colon') . $this->eId;
     }
     /****************/
     /* Main Content */
     /****************/
     // no entry in ?_articles? use default HolidayDescription
     if ($this->hId && empty($this->article)) {
         $this->article = ['text' => Util::jsEscape($this->subject->getField('description', true)), 'params' => []];
     }
     $this->headIcons = [$this->subject->getField('iconString')];
     $this->redButtons = array(BUTTON_WOWHEAD => $this->hId > 0, BUTTON_LINKS => true);
     /**************/
     /* Extra Tabs */
     /**************/
     $hasFilter = in_array($this->hId, [372, 283, 285, 353, 420, 400, 284, 201, 374, 409, 141, 324, 321, 424, 335, 327, 341, 181, 404, 398, 301]);
     // tab: npcs
     if ($npcIds = DB::World()->selectCol('SELECT id AS ARRAY_KEY, IF(ec.eventEntry > 0, 1, 0) AS added FROM creature c, game_event_creature ec WHERE ec.guid = c.guid AND ABS(ec.eventEntry) = ?d', $this->eId)) {
         $creatures = new CreatureList(array(['id', array_keys($npcIds)]));
         if (!$creatures->error) {
             $data = $creatures->getListviewData();
             foreach ($data as &$d) {
                 $d['method'] = $npcIds[$d['id']];
             }
             $tabData = ['data' => array_values($data)];
             if ($hasFilter) {
                 $tabData['note'] = sprintf(Util::$filterResultString, '?npcs&filter=cr=38;crs=' . $this->hId . ';crv=0');
             }
             $this->lvTabs[] = ['creature', $tabData];
         }
     }
     // tab: objects
     if ($objectIds = DB::World()->selectCol('SELECT id AS ARRAY_KEY, IF(eg.eventEntry > 0, 1, 0) AS added FROM gameobject g, game_event_gameobject eg WHERE eg.guid = g.guid AND ABS(eg.eventEntry) = ?d', $this->eId)) {
         $objects = new GameObjectList(array(['id', array_keys($objectIds)]));
         if (!$objects->error) {
             $data = $objects->getListviewData();
             foreach ($data as &$d) {
                 $d['method'] = $objectIds[$d['id']];
             }
             $tabData = ['data' => array_values($data)];
             if ($hasFilter) {
                 $tabData['note'] = sprintf(Util::$filterResultString, '?objects&filter=cr=16;crs=' . $this->hId . ';crv=0');
             }
             $this->lvTabs[] = ['object', $tabData];
         }
     }
     // tab: achievements
     if ($_ = $this->subject->getField('achievementCatOrId')) {
         $condition = $_ > 0 ? [['category', $_]] : [['id', -$_]];
         $acvs = new AchievementList($condition);
         if (!$acvs->error) {
             $this->extendGlobalData($acvs->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
             $tabData = array('data' => array_values($acvs->getListviewData()), 'visibleCols' => ['category']);
             if ($hasFilter) {
                 $tabData['note'] = sprintf(Util::$filterResultString, '?achievements&filter=cr=11;crs=' . $this->hId . ';crv=0');
             }
             $this->lvTabs[] = ['achievement', $tabData];
         }
     }
     $itemCnd = [];
     if ($this->hId) {
         $itemCnd = array('OR', ['eventId', $this->eId]);
         // tab: quests (by table, go & creature)
         $quests = new QuestList(array(['eventId', $this->eId]));
         if (!$quests->error) {
             $this->extendGlobalData($quests->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_REWARDS));
             $tabData = ['data' => array_values($quests->getListviewData())];
             if ($hasFilter) {
                 $tabData['note'] = sprintf(Util::$filterResultString, '?quests&filter=cr=33;crs=' . $this->hId . ';crv=0');
             }
             $this->lvTabs[] = ['quest', $tabData];
             $questItems = [];
             foreach (array_column($quests->rewards, TYPE_ITEM) as $arr) {
                 $questItems = array_merge($questItems, $arr);
             }
             foreach (array_column($quests->requires, TYPE_ITEM) as $arr) {
                 $questItems = array_merge($questItems, $arr);
             }
             if ($questItems) {
                 $itemCnd[] = ['id', $questItems];
             }
         }
     }
     // items from creature
     if ($npcIds && !$creatures->error) {
         // vendor
         $cIds = $creatures->getFoundIDs();
         if ($sells = DB::World()->selectCol('SELECT item FROM npc_vendor nv WHERE entry IN (?a) UNION SELECT item FROM game_event_npc_vendor genv JOIN creature c ON genv.guid = c.guid WHERE c.id IN (?a)', $cIds, $cIds)) {
             $itemCnd[] = ['id', $sells];
         }
     }
     // tab: items
     // not checking for loot ... cant distinguish between eventLoot and fillerCrapLoot
     if ($itemCnd) {
         $eventItems = new ItemList($itemCnd);
         if (!$eventItems->error) {
             $this->extendGlobalData($eventItems->getJSGlobals(GLOBALINFO_SELF));
             $tabData = ['data' => array_values($eventItems->getListviewData())];
             if ($hasFilter) {
                 $tabData['note'] = sprintf(Util::$filterResultString, '?items&filter=cr=160;crs=' . $this->hId . ';crv=0');
             }
             $this->lvTabs[] = ['item', $tabData];
         }
     }
     // tab: see also (event conditions)
     if ($rel = DB::World()->selectCol('SELECT IF(eventEntry = prerequisite_event, NULL, IF(eventEntry = ?d, prerequisite_event, -eventEntry)) FROM game_event_prerequisite WHERE prerequisite_event = ?d OR eventEntry = ?d', $this->eId, $this->eId, $this->eId)) {
         $list = [];
         array_walk($rel, function ($v, $k) use(&$list) {
             if ($v > 0) {
                 $list[] = $v;
             } else {
                 if ($v === null) {
                     trigger_error('game_event_prerequisite: this event has itself as prerequisite', E_USER_WARNING);
                 }
             }
         });
         if ($list) {
             $relEvents = new WorldEventList(array(['id', $list]));
             $this->extendGlobalData($relEvents->getJSGlobals());
             $relData = $relEvents->getListviewData();
             foreach ($relEvents->getFoundIDs() as $id) {
                 $relData[$id]['condition'][0][$this->typeId][] = [[-CND_ACTIVE_EVENT, $this->eId]];
             }
             $this->extendGlobalData($this->subject->getJSGlobals());
             foreach ($rel as $r) {
                 if ($r <= 0) {
                     continue;
                 }
                 $this->extendGlobalIds(TYPE_WORLDEVENT, $r);
                 $d = $this->subject->getListviewData();
                 $d[$this->eId]['condition'][0][$this->typeId][] = [[-CND_ACTIVE_EVENT, $r]];
                 $relData = array_merge($relData, $d);
             }
             $this->lvTabs[] = ['event', array('data' => array_values($relData), 'id' => 'see-also', 'name' => '$LANG.tab_seealso', 'hiddenCols' => ['date'], 'extraCols' => ['$Listview.extraCols.condition'])];
         }
     }
 }
Ejemplo n.º 9
0
}
if ($this->reputation) {
    ?>
                <h3><?php 
    echo Lang::main('gains');
    ?>
</h3>
<?php 
    echo Lang::npc('gainsDesc') . Lang::main('colon');
    foreach ($this->reputation as $set) {
        if (count($this->reputation) > 1) {
            echo '<ul><li><span class="rep-difficulty">' . $set[0] . '</span></li>';
        }
        echo '<ul>';
        foreach ($set[1] as $itr) {
            echo '<li><div' . ($itr['qty'] < 0 ? ' class="reputation-negative-amount"' : null) . '><span>' . $itr['qty'] . '</span> ' . Lang::npc('repWith') . ' <a href="?faction=' . $itr['id'] . '">' . $itr['name'] . '</a>' . ($itr['cap'] && $itr['qty'] > 0 ? '&nbsp;(' . sprintf(Lang::npc('stopsAt'), $itr['cap']) . ')' : null) . '</div></li>';
        }
        echo '</ul>';
        if (count($this->reputation) > 1) {
            echo '</ul>';
        }
    }
}
?>
                <h2 class="clear"><?php 
echo Lang::main('related');
?>
</h2>
            </div>

<?php 
Ejemplo n.º 10
0
        }
        $addData = ['rewards' => !empty($r['items']) ? $r['items'] : null, 'offset' => $offset, 'extra' => !empty($r['money']) ? $r['money'] : null];
        $addData['rewTitle'] = empty($r['choice']) ? Lang::quest('receiveItems') : Lang::quest('receiveAlso');
        $this->brick('rewards', $addData);
    }
}
if ($g = $this->gains) {
    echo '                    <h3>' . Lang::main('gains') . "</h3>\n";
    echo '                    ' . Lang::quest('gainsDesc') . Lang::main('colon') . "\n";
    echo "                    <ul>\n";
    if (!empty($g['xp'])) {
        echo '                        <li><div>' . number_format($g['xp']) . ' ' . Lang::quest('experience') . "</div></li>\n";
    }
    if (!empty($g['rep'])) {
        foreach ($g['rep'] as $r) {
            echo '                        <li><div>' . ($r['qty'] < 0 ? '<b class="q10">' . $r['qty'] . '</b>' : $r['qty']) . ' ' . Lang::npc('repWith') . ' <a href="?faction=' . $r['id'] . '">' . $r['name'] . "</a></div></li>\n";
        }
    }
    if (!empty($g['title'])) {
        echo '                        <li><div>' . sprintf(Lang::quest('theTitle'), $g['title']) . "</div></li>\n";
    }
    if (!empty($g['tp'])) {
        echo '                        <li><div>' . $g['tp'] . ' ' . Lang::quest('bonusTalents') . "</div></li>\n";
    }
    echo "                    </ul>\n";
}
$this->brick('mail');
if (!empty($this->transfer)) {
    echo "    <div class=\"pad\"></div>\n    " . $this->transfer . "\n";
}
?>