本文整理汇总了PHP中ItemList::getListviewData方法的典型用法代码示例。如果您正苦于以下问题:PHP ItemList::getListviewData方法的具体用法?PHP ItemList::getListviewData怎么用?PHP ItemList::getListviewData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ItemList
的用法示例。
在下文中一共展示了ItemList::getListviewData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateContent
protected function generateContent()
{
// add conditional js
$this->addJS('?data=weight-presets.gems.enchants.itemsets&locale=' . User::$localeId . '&t=' . $_SESSION['dataKey']);
if (!$this->compareString) {
return;
}
$sets = explode(';', $this->compareString);
$items = $outSet = [];
foreach ($sets as $set) {
$itemSting = explode(':', $set);
$outString = [];
foreach ($itemSting as $substring) {
$params = explode('.', $substring);
$items[] = (int) $params[0];
while (sizeof($params) < 7) {
$params[] = 0;
}
$outString[] = $params;
}
$outSet[] = $outString;
}
$this->summary = $outSet;
$iList = new ItemList(array(['i.id', $items]));
$data = $iList->getListviewData(ITEMINFO_SUBITEMS | ITEMINFO_JSON);
foreach ($iList->iterate() as $itemId => $__) {
if (empty($data[$itemId])) {
continue;
}
$this->cmpItems[] = [$itemId, $iList->getField('name', true), $iList->getField('quality'), $iList->getField('iconString'), $data[$itemId]];
}
}
示例2: generateContent
protected function generateContent()
{
/****************/
/* Main Content */
/****************/
$this->headIcons = [$this->subject->getField('iconString')];
$this->redButtons = array(BUTTON_WOWHEAD => true, BUTTON_LINKS => true);
if ($_ = $this->subject->getField('description', true)) {
$this->extraText = $_;
}
/**************/
/* Extra Tabs */
/**************/
if (in_array($this->cat, [-5, 9, 11])) {
// tab: recipes [spells] (crafted)
$condition = array(['OR', ['s.reagent1', 0, '>'], ['s.reagent2', 0, '>'], ['s.reagent3', 0, '>'], ['s.reagent4', 0, '>'], ['s.reagent5', 0, '>'], ['s.reagent6', 0, '>'], ['s.reagent7', 0, '>'], ['s.reagent8', 0, '>']], ['OR', ['s.skillLine1', $this->typeId], ['AND', ['s.skillLine1', 0, '>'], ['s.skillLine2OrMask', $this->typeId]]], CFG_SQL_LIMIT_NONE);
$recipes = new SpellList($condition);
// also relevant for 3
if (!$recipes->error) {
$this->extendGlobalData($recipes->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
$this->lvTabs[] = array('file' => 'spell', 'data' => $recipes->getListviewData(), 'params' => array('id' => 'recipes', 'name' => '$LANG.tab_recipes', 'visibleCols' => "\$['reagents', 'source']", 'note' => sprintf(Util::$filterResultString, '?spells=' . $this->cat . '.' . $this->typeId . '&filter=cr=20;crs=1;crv=0')));
}
// tab: recipe Items [items] (Books)
$filterRecipe = [null, 165, 197, 202, 164, 185, 171, 129, 333, 356, 755, 773, 186, 182];
$conditions = array(['requiredSkill', $this->typeId], ['class', ITEM_CLASS_RECIPE], CFG_SQL_LIMIT_NONE);
$recipeItems = new ItemList($conditions);
if (!$recipeItems->error) {
$this->extendGlobalData($recipeItems->getJSGlobals(GLOBALINFO_SELF));
if ($_ = array_search($this->typeId, $filterRecipe)) {
$_ = sprintf(Util::$filterResultString, "?items=9." . $_);
}
$this->lvTabs[] = array('file' => 'item', 'data' => $recipeItems->getListviewData(), 'params' => array('id' => 'recipe-items', 'name' => '$LANG.tab_recipeitems', 'note' => $_));
}
// tab: crafted items [items]
$filterItem = [null, 171, 164, 185, 333, 202, 129, 755, 165, 186, 197, null, null, 356, 182, 773];
$created = [];
foreach ($recipes->iterate() as $__) {
if ($idx = $recipes->canCreateItem()) {
foreach ($idx as $i) {
$created[] = $recipes->getField('effect' . $i . 'CreateItemId');
}
}
}
if ($created) {
$created = new ItemList(array(['i.id', $created], CFG_SQL_LIMIT_NONE));
if (!$created->error) {
$this->extendGlobalData($created->getJSGlobals(GLOBALINFO_SELF));
if ($_ = array_search($this->typeId, $filterItem)) {
$_ = sprintf(Util::$filterResultString, "?items&filter=cr=86;crs=" . $_ . ";crv=0");
}
$this->lvTabs[] = array('file' => 'item', 'data' => $created->getListviewData(), 'params' => array('id' => 'crafted-items', 'name' => '$LANG.tab_crafteditems', 'note' => $_));
}
}
// tab: required by [item]
$conditions = array(['requiredSkill', $this->typeId], ['class', ITEM_CLASS_RECIPE, '!'], CFG_SQL_LIMIT_NONE);
$reqBy = new ItemList($conditions);
if (!$reqBy->error) {
$this->extendGlobalData($reqBy->getJSGlobals(GLOBALINFO_SELF));
if ($_ = array_search($this->typeId, $filterItem)) {
$_ = sprintf(Util::$filterResultString, "?items&filter=cr=99:168;crs=" . $_ . ":2;crv=0:0");
}
$this->lvTabs[] = array('file' => 'item', 'data' => $reqBy->getListviewData(), 'params' => array('id' => 'required-by', 'name' => '$LANG.tab_requiredby', 'note' => $_));
}
// tab: required by [itemset]
$conditions = array(['skillId', $this->typeId], CFG_SQL_LIMIT_NONE);
$reqBy = new ItemsetList($conditions);
if (!$reqBy->error) {
$this->extendGlobalData($reqBy->getJSGlobals(GLOBALINFO_SELF));
$this->lvTabs[] = array('file' => 'itemset', 'data' => $reqBy->getListviewData(), 'params' => array('id' => 'required-by-set', 'name' => '$LANG.tab_requiredby'));
}
}
// tab: spells [spells] (exclude first tab)
$reqClass = 0x0;
$reqRace = 0x0;
$condition = array(['AND', ['s.reagent1', 0], ['s.reagent2', 0], ['s.reagent3', 0], ['s.reagent4', 0], ['s.reagent5', 0], ['s.reagent6', 0], ['s.reagent7', 0], ['s.reagent8', 0]], ['OR', ['s.skillLine1', $this->typeId], ['AND', ['s.skillLine1', 0, '>'], ['s.skillLine2OrMask', $this->typeId]]], CFG_SQL_LIMIT_NONE);
foreach (Util::$skillLineMask as $line1 => $sets) {
foreach ($sets as $idx => $set) {
if ($set[1] == $this->typeId) {
$condition[1][] = array('AND', ['s.skillLine1', $line1], ['s.skillLine2OrMask', 1 << $idx, '&']);
break 2;
}
}
}
$spells = new SpellList($condition);
if (!$spells->error) {
foreach ($spells->iterate() as $__) {
$reqClass |= $spells->getField('reqClassMask');
$reqRace |= $spells->getField('reqRaceMask');
}
$this->extendGlobalData($spells->getJSGlobals(GLOBALINFO_SELF));
$lv = array('file' => 'spell', 'data' => $spells->getListviewData(), 'params' => ['visibleCols' => "\$['source']"]);
switch ($this->cat) {
case -4:
$lv['params']['note'] = sprintf(Util::$filterResultString, '?spells=-4');
break;
case 7:
if ($this->typeId != 769) {
// Internal
$lv['params']['note'] = sprintf(Util::$filterResultString, '?spells=' . $this->cat . '.' . (log($reqClass, 2) + 1) . '.' . $this->typeId);
}
//.........这里部分代码省略.........
示例3: generateContent
protected function generateContent()
{
$this->addJS('?data=zones&locale=' . User::$localeId . '&t=' . $_SESSION['dataKey']);
$_itemId = $this->subject->getField('itemId');
/***********/
/* Infobox */
/**********/
$infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
if ($this->typeId == 103) {
// Arena Points
$infobox[] = Lang::currency('cap') . Lang::main('colon') . '10\'000';
} else {
if ($this->typeId == 104) {
// Honor
$infobox[] = Lang::currency('cap') . Lang::main('colon') . '75\'000';
}
}
/****************/
/* Main Content */
/****************/
$this->infobox = $infobox ? '[ul][li]' . implode('[/li][li]', $infobox) . '[/li][/ul]' : null;
$this->name = $this->subject->getField('name', true);
$this->headIcons = $this->typeId == 104 ? ['inv_bannerpvp_02', 'inv_bannerpvp_01'] : [$this->subject->getField('iconString')];
$this->redButtons = array(BUTTON_WOWHEAD => true, BUTTON_LINKS => true);
/**************/
/* Extra Tabs */
/**************/
if ($this->typeId != 103 && $this->typeId != 104) {
// tabs: this currency is contained in..
$lootTabs = new Loot();
if ($lootTabs->getByItem($_itemId)) {
$this->extendGlobalData($lootTabs->jsGlobals);
foreach ($lootTabs->iterate() as $tab) {
$this->lvTabs[] = array('file' => $tab[0], 'data' => $tab[1], 'params' => ['name' => $tab[2], 'id' => $tab[3], 'extraCols' => $tab[4] ? '$[' . implode(', ', array_unique($tab[4])) . ']' : null, 'hiddenCols' => $tab[5] ? '$[' . implode(', ', array_unique($tab[5])) . ']' : null, 'visibleCols' => $tab[6] ? '$' . Util::toJSON(array_unique($tab[6])) : null]);
}
}
// tab: sold by
$itemObj = new ItemList(array(['id', $_itemId]));
if (!empty($itemObj->getExtendedCost()[$_itemId])) {
$vendors = $itemObj->getExtendedCost()[$_itemId];
$this->extendGlobalData($itemObj->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
$soldBy = new CreatureList(array(['id', array_keys($vendors)]));
if (!$soldBy->error) {
$sbData = $soldBy->getListviewData();
$extraCols = ['Listview.extraCols.stock', "Listview.funcBox.createSimpleCol('stack', 'stack', '10%', 'stack')", 'Listview.extraCols.cost'];
$holidays = [];
foreach ($sbData as $k => &$row) {
$items = [];
$tokens = [];
foreach ($vendors[$k] as $id => $qty) {
if (is_string($id)) {
continue;
}
if ($id > 0) {
$tokens[] = [$id, $qty];
} else {
if ($id < 0) {
$items[] = [-$id, $qty];
}
}
}
if ($vendors[$k]['event']) {
if (count($extraCols) == 3) {
// not already pushed
$extraCols[] = 'Listview.extraCols.condition';
}
$this->extendGlobalIds(TYPE_WORLDEVENT, $vendors[$k]['event']);
$row['condition'][0][$this->typeId][] = [[CND_ACTIVE_EVENT, $vendors[$k]['event']]];
}
$row['stock'] = $vendors[$k]['stock'];
$row['stack'] = $itemObj->getField('buyCount');
$row['cost'] = array($itemObj->getField('buyPrice'), $items ? $items : null, $tokens ? $tokens : null);
}
$this->lvTabs[] = array('file' => 'creature', 'data' => $sbData, 'params' => ['name' => '$LANG.tab_soldby', 'id' => 'sold-by-npc', 'extraCols' => '$[' . implode(', ', $extraCols) . ']', 'hiddenCols' => "\$['level', 'type']"]);
}
}
}
// tab: created by (spell) [for items its handled in Loot::getByContainer()]
if ($this->typeId == 104) {
$createdBy = new SpellList(array(['effect1Id', 45], ['effect2Id', 45], ['effect3Id', 45], 'OR'));
if (!$createdBy->error) {
$this->extendGlobalData($createdBy->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
if ($createdBy->hasSetFields(['reagent1'])) {
$visCols = ['reagents'];
}
$this->lvTabs[] = array('file' => 'spell', 'data' => $createdBy->getListviewData(), 'params' => ['name' => '$LANG.tab_createdby', 'id' => 'created-by', 'visibleCols' => isset($visCols) ? '$' . Util::toJSON($visCols) : null]);
}
}
// tab: currency for
if ($this->typeId == 103) {
$n = '?items&filter=cr=145;crs=1;crv=0';
$w = 'reqArenaPoints > 0';
} else {
if ($this->typeId == 104) {
$n = '?items&filter=cr=144;crs=1;crv=0';
$w = 'reqHonorPoints > 0';
} else {
$n = in_array($this->typeId, [42, 61, 81, 241, 121, 122, 123, 125, 126, 161, 201, 101, 102, 221, 301, 341]) ? '?items&filter=cr=158;crs=' . $_itemId . ';crv=0' : null;
$w = 'reqItemId1 = ' . $_itemId . ' OR reqItemId2 = ' . $_itemId . ' OR reqItemId3 = ' . $_itemId . ' OR reqItemId4 = ' . $_itemId . ' OR reqItemId5 = ' . $_itemId;
}
//.........这里部分代码省略.........
示例4: generateContent
protected function generateContent()
{
$_ta = $this->subject->getField('contentGroup');
$_ty = $this->subject->getField('type');
$_cnt = count($this->subject->getField('pieces'));
/***********/
/* Infobox */
/***********/
$infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
// unavailable (todo (low): set data)
if ($this->subject->getField('cuFlags') & CUSTOM_UNAVAILABLE) {
$infobox[] = Lang::main('unavailable');
}
// worldevent
if ($e = $this->subject->getField('eventId')) {
$infobox[] = Lang::game('eventShort') . Lang::main('colon') . '[event=' . $e . ']';
$this->extendGlobalIds(TYPE_WORLDEVENT, $e);
}
// itemLevel
if ($min = $this->subject->getField('minLevel')) {
$foo = Lang::game('level') . Lang::main('colon') . $min;
$max = $this->subject->getField('maxLevel');
if ($min < $max) {
$foo .= ' - ' . $max;
}
$infobox[] = $foo;
}
// class
if ($cl = Lang::getClassString($this->subject->getField('classMask'), $jsg, $qty, false)) {
$this->extendGlobalIds(TYPE_CLASS, $jsg);
$t = $qty == 1 ? Lang::game('class') : Lang::game('classes');
$infobox[] = Util::ucFirst($t) . Lang::main('colon') . $cl;
}
// required level
if ($lvl = $this->subject->getField('reqLevel')) {
$infobox[] = sprintf(Lang::game('reqLevel'), $lvl);
}
// type
if ($_ty) {
$infobox[] = Lang::game('type') . Lang::main('colon') . Lang::itemset('types', $_ty);
}
// tag
if ($_ta) {
$infobox[] = Lang::itemset('_tag') . Lang::main('colon') . '[url=?itemsets&filter=ta=' . $_ta . ']' . Lang::itemset('notes', $_ta) . '[/url]';
}
/****************/
/* Main Content */
/****************/
// pieces + Summary
$pieces = [];
$eqList = [];
$compare = [];
if (!$this->subject->pieceToSet) {
$cnd = [0];
} else {
$cnd = ['i.id', array_keys($this->subject->pieceToSet)];
}
$iList = new ItemList(array($cnd));
$data = $iList->getListviewData(ITEMINFO_SUBITEMS | ITEMINFO_JSON);
foreach ($iList->iterate() as $itemId => $__) {
if (empty($data[$itemId])) {
continue;
}
$slot = $iList->getField('slot');
$disp = $iList->getField('displayId');
if ($slot && $disp) {
$eqList[] = [$slot, $disp];
}
$compare[] = $itemId;
$pieces[] = array('id' => $itemId, 'name' => $iList->getField('name', true), 'quality' => $iList->getField('quality'), 'icon' => $iList->getField('iconString'), 'json' => $data[$itemId]);
}
$skill = '';
if ($_sk = $this->subject->getField('skillId')) {
$spellLink = sprintf('<a href="?spells=11.%s">%s</a> (%s)', $_sk, Lang::spell('cat', 11, $_sk, 0), $this->subject->getField('skillLevel'));
$skill = ' – <small><b>' . sprintf(Lang::game('requires'), $spellLink) . '</b></small>';
}
$this->bonusExt = $skill;
$this->description = $_ta ? sprintf(Lang::itemset('_desc'), $this->name, Lang::itemset('notes', $_ta), $_cnt) : sprintf(Lang::itemset('_descTagless'), $this->name, $_cnt);
$this->unavailable = $this->subject->getField('cuFlags') & CUSTOM_UNAVAILABLE;
$this->infobox = $infobox ? '[ul][li]' . implode('[/li][li]', $infobox) . '[/li][/ul]' : null;
$this->pieces = $pieces;
$this->spells = $this->subject->getBonuses();
$this->expansion = 0;
$this->redButtons = array(BUTTON_WOWHEAD => $this->typeId > 0, BUTTON_LINKS => ['color' => '', 'linkId' => ''], BUTTON_VIEW3D => ['type' => TYPE_ITEMSET, 'typeId' => $this->typeId, 'equipList' => $eqList], BUTTON_COMPARE => ['eqList' => implode(':', $compare), 'qty' => $_cnt]);
$this->compare = array('level' => $this->subject->getField('reqLevel'), 'items' => array_map(function ($v) {
return [[$v]];
}, $compare));
/**************/
/* Extra Tabs */
/**************/
// related sets (priority: 1: similar tag + class; 2: has event; 3: no tag + similar type, 4: similar type + profession)
$rel = [];
if ($_ta && count($this->path) == 3) {
$rel[] = ['id', $this->typeId, '!'];
$rel[] = ['classMask', 1 << end($this->path) - 1, '&'];
$rel[] = ['contentGroup', (int) $_ta];
} else {
if ($this->subject->getField('eventId')) {
$rel[] = ['id', $this->typeId, '!'];
$rel[] = ['eventId', 0, '!'];
//.........这里部分代码省略.........
示例5: generateContent
//.........这里部分代码省略.........
$buff .= '[tr][td]' . Lang::game('quests') . ' (' . Lang::quest('daily') . ')' . Lang::main('colon') . '[/td]';
break;
case 'quest_weekly_rate':
$buff .= '[tr][td]' . Lang::game('quests') . ' (' . Lang::quest('weekly') . ')' . Lang::main('colon') . '[/td]';
break;
case 'quest_monthly_rate':
$buff .= '[tr][td]' . Lang::game('quests') . ' (' . Lang::quest('monthly') . ')' . Lang::main('colon') . '[/td]';
break;
case 'creature_rate':
$buff .= '[tr][td]' . Lang::game('npcs') . Lang::main('colon') . '[/td]';
break;
case 'spell_rate':
$buff .= '[tr][td]' . Lang::game('spells') . Lang::main('colon') . '[/td]';
break;
}
$buff .= '[td width=35px align=right][span class=q' . ($v < 1 ? '10]' : '2]+') . intVal(($v - 1) * 100) . '%[/span][/td][/tr]';
}
if ($buff) {
$this->extraText .= '[h3 class=clear]' . Lang::faction('customRewRate') . '[/h3][table]' . $buff . '[/table]';
}
}
// factionchange-equivalent
if ($pendant = DB::World()->selectCell('SELECT IF(horde_id = ?d, alliance_id, -horde_id) FROM player_factionchange_reputations WHERE alliance_id = ?d OR horde_id = ?d', $this->typeId, $this->typeId, $this->typeId)) {
$altFac = new FactionList(array(['id', abs($pendant)]));
if (!$altFac->error) {
$this->transfer = sprintf(Lang::faction('_transfer'), $altFac->id, $altFac->getField('name', true), $pendant > 0 ? 'alliance' : 'horde', $pendant > 0 ? Lang::game('si', 1) : Lang::game('si', 2));
}
}
/**************/
/* Extra Tabs */
/**************/
// tab: items
$items = new ItemList(array(['requiredFaction', $this->typeId]));
if (!$items->error) {
$this->extendGlobalData($items->getJSGlobals(GLOBALINFO_SELF));
$tabData = array('data' => array_values($items->getListviewData()), 'extraCols' => '$_', 'sort' => ['standing', 'name']);
if ($items->getMatches() > CFG_SQL_LIMIT_DEFAULT) {
$tabData['note'] = sprintf(Util::$filterResultString, '?items&filter=cr=17;crs=' . $this->typeId . ';crv=0');
}
$this->lvTabs[] = ['item', $tabData, 'itemStandingCol'];
}
// tab: creatures with onKill reputation
if ($this->subject->getField('reputationIndex') != -1) {
// inherit siblings/children from $spillover
$cRep = DB::World()->selectCol('SELECT DISTINCT creature_id AS ARRAY_KEY, qty FROM (
SELECT creature_id, RewOnKillRepValue1 as qty FROM creature_onkill_reputation WHERE RewOnKillRepValue1 > 0 AND (RewOnKillRepFaction1 = ?d{ OR (RewOnKillRepFaction1 IN (?a) AND IsTeamAward1 <> 0)}) UNION
SELECT creature_id, RewOnKillRepValue2 as qty FROM creature_onkill_reputation WHERE RewOnKillRepValue2 > 0 AND (RewOnKillRepFaction2 = ?d{ OR (RewOnKillRepFaction2 IN (?a) AND IsTeamAward2 <> 0)})
) x', $this->typeId, $spillover->getFoundIDs() ?: DBSIMPLE_SKIP, $this->typeId, $spillover->getFoundIDs() ?: DBSIMPLE_SKIP);
if ($cRep) {
$killCreatures = new CreatureList(array(['id', array_keys($cRep)]));
if (!$killCreatures->error) {
$data = $killCreatures->getListviewData();
foreach ($data as $id => &$d) {
$d['reputation'] = $cRep[$id];
}
$tabData = array('data' => array_values($data), 'extraCols' => '$_', 'sort' => ['-reputation', 'name']);
if ($killCreatures->getMatches() > CFG_SQL_LIMIT_DEFAULT) {
$tabData['note'] = sprintf(Util::$filterResultString, '?npcs&filter=cr=42;crs=' . $this->typeId . ';crv=0');
}
$this->lvTabs[] = ['creature', $tabData, 'npcRepCol'];
}
}
}
// tab: members
if ($_ = $this->subject->getField('templateIds')) {
$members = new CreatureList(array(['faction', $_]));
if (!$members->error) {
$tabData = array('data' => array_values($members->getListviewData()), 'id' => 'member', 'name' => '$LANG.tab_members');
if ($members->getMatches() > CFG_SQL_LIMIT_DEFAULT) {
$tabData['note'] = sprintf(Util::$filterResultString, '?npcs&filter=cr=3;crs=' . $this->typeId . ';crv=0');
}
$this->lvTabs[] = ['creature', $tabData];
}
}
// tab: objects
if ($_ = $this->subject->getField('templateIds')) {
$objects = new GameObjectList(array(['faction', $_]));
if (!$objects->error) {
$this->lvTabs[] = ['object', ['data' => array_values($objects->getListviewData())]];
}
}
// tab: quests
$conditions = array(['AND', ['rewardFactionId1', $this->typeId], ['rewardFactionValue1', 0, '>']], ['AND', ['rewardFactionId2', $this->typeId], ['rewardFactionValue2', 0, '>']], ['AND', ['rewardFactionId3', $this->typeId], ['rewardFactionValue3', 0, '>']], ['AND', ['rewardFactionId4', $this->typeId], ['rewardFactionValue4', 0, '>']], ['AND', ['rewardFactionId5', $this->typeId], ['rewardFactionValue5', 0, '>']], 'OR');
$quests = new QuestList($conditions);
if (!$quests->error) {
$this->extendGlobalData($quests->getJSGlobals(GLOBALINFO_ANY));
$tabData = array('data' => array_values($quests->getListviewData($this->typeId)), 'extraCols' => '$_');
if ($quests->getMatches() > CFG_SQL_LIMIT_DEFAULT) {
$tabData['note'] = sprintf(Util::$filterResultString, '?quests&filter=cr=1;crs=' . $this->typeId . ';crv=0');
}
$this->lvTabs[] = ['quest', $tabData, 'questRepCol'];
}
// tab: achievements
$conditions = array(['ac.type', ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION], ['ac.value1', $this->typeId]);
$acvs = new AchievementList($conditions);
if (!$acvs->error) {
$this->extendGlobalData($acvs->getJSGlobals(GLOBALINFO_ANY));
$this->lvTabs[] = ['achievement', array('data' => array_values($acvs->getListviewData()), 'id' => 'criteria-of', 'name' => '$LANG.tab_criteriaof', 'visibleCols' => ['category'])];
}
}
示例6: generateContent
protected function generateContent()
{
$infobox = [];
$_mask = 1 << $this->typeId - 1;
$mountVendors = array(null, [384, 33307], [3362, 33553], [1261, 33310], [4730, 33653], [4731, 33555], [3685, 33556], [7955, 33650], [7952, 33554], null, [16264, 33557], [17584, 33657]);
/***********/
/* Infobox */
/***********/
$infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
// side
if ($_ = $this->subject->getField('side')) {
$infobox[] = Lang::main('side') . Lang::main('colon') . '[span class=icon-' . ($_ == 2 ? 'horde' : 'alliance') . ']' . Lang::game('si', $_) . '[/span]';
}
// faction
if ($_ = $this->subject->getField('factionId')) {
$fac = new FactionList(array(['f.id', $_]));
$this->extendGlobalData($fac->getJSGlobals());
$infobox[] = Util::ucFirst(Lang::game('faction')) . Lang::main('colon') . '[faction=' . $fac->id . ']';
}
// leader
if ($_ = $this->subject->getField('leader')) {
$this->extendGlobalIds(TYPE_NPC, $_);
$infobox[] = Lang::race('racialLeader') . Lang::main('colon') . '[npc=' . $_ . ']';
}
// start area
if ($_ = $this->subject->getField('startAreaId')) {
$this->extendGlobalIds(TYPE_ZONE, $_);
$infobox[] = Lang::race('startZone') . Lang::main('colon') . '[zone=' . $_ . ']';
}
/****************/
/* Main Content */
/****************/
$this->infobox = '[ul][li]' . implode('[/li][li]', $infobox) . '[/li][/ul]';
$this->expansion = Util::$expansionString[$this->subject->getField('expansion')];
$this->headIcons = array('race_' . strtolower($this->subject->getField('fileString')) . '_male', 'race_' . strtolower($this->subject->getField('fileString')) . '_female');
$this->redButtons = array(BUTTON_WOWHEAD => true, BUTTON_LINKS => true);
/**************/
/* Extra Tabs */
/**************/
// Classes
$classes = new CharClassList(array(['racemask', $_mask, '&']));
if (!$classes->error) {
$this->extendGlobalData($classes->getJSGlobals());
$this->lvTabs[] = ['class', ['data' => array_values($classes->getListviewData())]];
}
// Tongues
$conditions = array(['typeCat', -11], ['reqRaceMask', $_mask, '&']);
$tongues = new SpellList($conditions);
if (!$tongues->error) {
$this->extendGlobalData($tongues->getJSGlobals());
$this->lvTabs[] = ['spell', array('data' => array_values($tongues->getListviewData()), 'id' => 'languages', 'name' => '$LANG.tab_languages', 'hiddenCols' => ['reagents'])];
}
// Racials
$conditions = array(['typeCat', -4], ['reqRaceMask', $_mask, '&']);
$racials = new SpellList($conditions);
if (!$racials->error) {
$this->extendGlobalData($racials->getJSGlobals());
$this->lvTabs[] = ['spell', array('data' => array_values($racials->getListviewData()), 'id' => 'racial-traits', 'name' => '$LANG.tab_racialtraits', 'hiddenCols' => ['reagents'])];
}
// Quests
$conditions = array(['reqRaceMask', $_mask, '&'], [['reqRaceMask', RACE_MASK_HORDE, '&'], RACE_MASK_HORDE, '!'], [['reqRaceMask', RACE_MASK_ALLIANCE, '&'], RACE_MASK_ALLIANCE, '!']);
$quests = new QuestList($conditions);
if (!$quests->error) {
$this->extendGlobalData($quests->getJSGlobals());
$this->lvTabs[] = ['quest', ['data' => array_values($quests->getListviewData())]];
}
// Mounts
// ok, this sucks, but i rather hardcode the trainer, than fetch items by namepart
$items = isset($mountVendors[$this->typeId]) ? DB::World()->selectCol('SELECT item FROM npc_vendor WHERE entry IN (?a)', $mountVendors[$this->typeId]) : 0;
$conditions = array(['i.id', $items], ['i.class', ITEM_CLASS_MISC], ['i.subClass', 5]);
$mounts = new ItemList($conditions);
if (!$mounts->error) {
$this->extendGlobalData($mounts->getJSGlobals());
$this->lvTabs[] = ['item', array('data' => array_values($mounts->getListviewData()), 'id' => 'mounts', 'name' => '$LANG.tab_mounts', 'hiddenCols' => ['slot', 'type'])];
}
}
示例7: generateContent
//.........这里部分代码省略.........
$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 $__) {
示例8: generateContent
//.........这里部分代码省略.........
// SMART_SCRIPT_TYPE_CREATURE = 0; SMART_ACTION_CAST = 11; SMART_ACTION_ADD_AURA = 75; SMART_ACTION_INVOKER_CAST = 85; SMART_ACTION_CROSS_CAST = 86
$smartSpells = DB::World()->selectCol('SELECT action_param1 FROM smart_scripts WHERE source_type = 0 AND action_type IN (11, 75, 85, 86) AND entryOrGUID = ?d', $this->typeId);
$tplSpells = [];
$conditions = ['OR'];
for ($i = 1; $i < 9; $i++) {
if ($_ = $this->subject->getField('spell' . $i)) {
$tplSpells[] = $_;
}
}
if ($tplSpells) {
$conditions[] = ['id', $tplSpells];
}
if ($smartSpells) {
$conditions[] = ['id', $smartSpells];
}
// Pet-Abilities
if ($_typeFlags & 0x1 && ($_ = $this->subject->getField('family'))) {
$skill = 0;
$mask = 0x0;
foreach (Util::$skillLineMask[-1] as $idx => $pair) {
if ($pair[0] != $_) {
continue;
}
$skill = $pair[1];
$mask = 1 << $idx;
break;
}
$conditions[] = ['AND', ['s.typeCat', -3], ['OR', ['skillLine1', $skill], ['AND', ['skillLine1', 0, '>'], ['skillLine2OrMask', $skill]], ['AND', ['skillLine1', -1], ['skillLine2OrMask', $mask, '&']]]];
}
if (count($conditions) > 1) {
$abilities = new SpellList($conditions);
if (!$abilities->error) {
$this->extendGlobalData($abilities->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
$controled = $abilities->getListviewData();
$normal = [];
foreach ($controled as $id => $values) {
if (in_array($id, $smartSpells)) {
$normal[$id] = $values;
unset($controled[$id]);
continue;
}
// not quite right. All seats should be checked for allowed-to-cast-flag-something
if (!$this->subject->getField('vehicleId') && in_array($id, $tplSpells)) {
$normal[$id] = $values;
unset($controled[$id]);
}
}
if ($normal) {
$this->lvTabs[] = array('file' => 'spell', 'data' => $normal, 'params' => array('name' => '$LANG.tab_abilities', 'id' => 'abilities'));
}
if ($controled) {
$this->lvTabs[] = array('file' => 'spell', 'data' => $controled, 'params' => array('name' => '$LANG.tab_controlledabilities', 'id' => 'controlled-abilities'));
}
}
}
// tab: summoned by
$conditions = array('OR', ['AND', ['effect1Id', 28], ['effect1MiscValue', $this->typeId]], ['AND', ['effect2Id', 28], ['effect2MiscValue', $this->typeId]], ['AND', ['effect3Id', 28], ['effect3MiscValue', $this->typeId]]);
$summoned = new SpellList($conditions);
if (!$summoned->error) {
$this->extendGlobalData($summoned->getJSGlobals());
$this->lvTabs[] = array('file' => 'spell', 'data' => $summoned->getListviewData(), 'params' => array('name' => '$LANG.tab_summonedby', 'id' => 'summoned-by'));
}
// tab: teaches
if ($this->subject->getField('npcflag') & NPC_FLAG_TRAINER) {
$teachQuery = '
SELECT IFNULL(t2.SpellID, t1.SpellID) AS ARRAY_KEY,
示例9: generateContent
protected function generateContent()
{
$this->addJS('?data=zones&locale=' . User::$localeId . '&t=' . $_SESSION['dataKey']);
$infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
$_mask = 1 << $this->typeId - 1;
$tcClassId = [null, 8, 3, 1, 5, 4, 9, 6, 2, 7, null, 0];
// see TalentCalc.js
/***********/
/* Infobox */
/***********/
// hero class
if ($this->subject->getField('flags') & 0x40) {
$infobox[] = '[tooltip=tooltip_heroclass]' . Lang::game('heroClass') . '[/tooltip]';
}
// resource
if ($this->typeId == 11) {
// special Druid case
$infobox[] = Lang::game('resources') . Lang::main('colon') . '[tooltip name=powertype1]' . Lang::game('st', 0) . ', ' . Lang::game('st', 31) . ', ' . Lang::game('st', 2) . '[/tooltip][span class=tip tooltip=powertype1]' . Util::ucFirst(Lang::spell('powerTypes', 0)) . '[/span], ' . '[tooltip name=powertype2]' . Lang::game('st', 5) . ', ' . Lang::game('st', 8) . '[/tooltip][span class=tip tooltip=powertype2]' . Util::ucFirst(Lang::spell('powerTypes', 1)) . '[/span], ' . '[tooltip name=powertype8]' . Lang::game('st', 1) . '[/tooltip][span class=tip tooltip=powertype8]' . Util::ucFirst(Lang::spell('powerTypes', 3)) . '[/span]';
} else {
if ($this->typeId == 6) {
// special DK case
$infobox[] = Lang::game('resources') . Lang::main('colon') . '[span]' . Util::ucFirst(Lang::spell('powerTypes', 5)) . ', ' . Util::ucFirst(Lang::spell('powerTypes', $this->subject->getField('powerType'))) . '[/span]';
} else {
// regular case
$infobox[] = Lang::game('resource') . Lang::main('colon') . '[span]' . Util::ucFirst(Lang::spell('powerTypes', $this->subject->getField('powerType'))) . '[/span]';
}
}
// roles
$roles = [];
for ($i = 0; $i < 4; $i++) {
if ($this->subject->getField('roles') & 1 << $i) {
$roles[] = (count($roles) == 2 ? "\n" : '') . Lang::game('_roles', $i);
}
}
if ($roles) {
$infobox[] = (count($roles) > 1 ? Lang::game('roles') : Lang::game('role')) . Lang::main('colon') . implode(', ', $roles);
}
// specs
$specList = [];
$skills = new SkillList(array(['id', $this->subject->getField('skills')]));
foreach ($skills->iterate() as $k => $__) {
$specList[$k] = '[icon name=' . $skills->getField('iconString') . '][url=?spells=7.' . $this->typeId . '.' . $k . ']' . $skills->getField('name', true) . '[/url][/icon]';
}
if ($specList) {
$infobox[] = Lang::game('specs') . Lang::main('colon') . '[ul][li]' . implode('[/li][li]', $specList) . '[/li][/ul]';
}
/****************/
/* Main Content */
/****************/
$this->infobox = '[ul][li]' . implode('[/li][li]', $infobox) . '[/li][/ul]';
$this->expansion = Util::$expansionString[$this->subject->getField('expansion')];
$this->headIcons = ['class_' . strtolower($this->subject->getField('fileString'))];
$this->redButtons = array(BUTTON_LINKS => ['color' => '', 'linkId' => ''], BUTTON_WOWHEAD => true, BUTTON_TALENT => ['href' => '?talent#' . Util::$tcEncoding[$tcClassId[$this->typeId] * 3], 'pet' => false], BUTTON_FORUM => false);
/**************/
/* Extra Tabs */
/**************/
// Tab: Spells (grouped)
// '$LANG.tab_armorproficiencies',
// '$LANG.tab_weaponskills',
// '$LANG.tab_glyphs',
// '$LANG.tab_abilities',
// '$LANG.tab_talents',
$conditions = array(['s.typeCat', [-13, -11, -2, 7]], [['s.cuFlags', SPELL_CU_TRIGGERED | CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0], ['OR', ['s.reqClassMask', $_mask, '&'], ['s.skillLine1', $this->subject->getField('skills')], ['AND', ['s.skillLine1', 0, '>'], ['s.skillLine2OrMask', $this->subject->getField('skills')]]], ['OR', ['s.cuFlags', SPELL_CU_LAST_RANK, '&'], ['s.rankNo', 0]]);
$genSpells = new SpellList($conditions);
if (!$genSpells->error) {
$this->extendGlobalData($genSpells->getJSGlobals(GLOBALINFO_SELF));
$this->lvTabs[] = array('file' => 'spell', 'data' => $genSpells->getListviewData(), 'params' => array('id' => 'spells', 'name' => '$LANG.tab_spells', 'visibleCols' => "\$['level', 'schools', 'type', 'classes']", 'hiddenCols' => "\$['reagents', 'skill']", 'sort' => "\$['-level', 'type', 'name']", 'computeDataFunc' => '$Listview.funcBox.initSpellFilter', 'onAfterCreate' => '$Listview.funcBox.addSpellIndicator'));
}
// Tab: Items (grouped)
$conditions = array(['requiredClass', 0, '>'], ['requiredClass', $_mask, '&'], [['requiredClass', CLASS_MASK_ALL, '&'], CLASS_MASK_ALL, '!'], ['itemset', 0], 0);
$items = new ItemList($conditions);
if (!$items->error) {
$this->extendGlobalData($items->getJSGlobals());
if (!$items->hasDiffFields(['requiredRace'])) {
$hidden = "\$['side']";
}
$this->lvTabs[] = array('file' => 'item', 'data' => $items->getListviewData(), 'params' => array('id' => 'items', 'name' => '$LANG.tab_items', 'visibleCols' => "\$['dps', 'armor', 'slot']", 'hiddenCols' => isset($hidden) ? $hidden : null, 'computeDataFunc' => '$Listview.funcBox.initSubclassFilter', 'onAfterCreate' => '$Listview.funcBox.addSubclassIndicator', 'note' => sprintf(Util::$filterResultString, '?items&filter=cr=152;crs=' . $this->typeId . ';crv=0'), '_truncated' => 1));
}
// Tab: Quests
$conditions = array(['reqClassMask', $_mask, '&'], [['reqClassMask', CLASS_MASK_ALL, '&'], CLASS_MASK_ALL, '!']);
$quests = new QuestList($conditions);
if (!$quests->error) {
$this->extendGlobalData($quests->getJSGlobals());
$this->lvTabs[] = array('file' => 'quest', 'data' => $quests->getListviewData(), 'params' => ['sort' => "\$['reqlevel', 'name']"]);
}
// Tab: Itemsets
$sets = new ItemsetList(array(['classMask', $_mask, '&']));
if (!$sets->error) {
$this->extendGlobalData($sets->getJSGlobals(GLOBALINFO_SELF));
$this->lvTabs[] = array('file' => 'itemset', 'data' => $sets->getListviewData(), 'params' => array('note' => sprintf(Util::$filterResultString, '?itemsets&filter=cl=' . $this->typeId), 'hiddenCols' => "\$['classes']", 'sort' => "\$['-level', 'name']"));
}
// Tab: Trainer
$conditions = array(['npcflag', 0x30, '&'], ['trainerType', 0], ['trainerClass', $this->typeId]);
$trainer = new CreatureList($conditions);
if (!$trainer->error) {
$this->lvTabs[] = array('file' => 'creature', 'data' => $trainer->getListviewData(), 'params' => array('id' => 'trainers', 'name' => '$LANG.tab_trainers'));
}
// Tab: Races
$races = new CharRaceList(array(['classMask', $_mask, '&']));
if (!$races->error) {
//.........这里部分代码省略.........
示例10: generateContent
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();
//.........这里部分代码省略.........
示例11: getByContainer
public function getByContainer($table, $entry)
{
$this->entry = intVal($entry);
if (!in_array($table, $this->lootTemplates) || !$this->entry) {
return null;
}
/*
todo (high): implement conditions on loot (and conditions in general)
also
// if (is_array($this->entry) && in_array($table, [LOOT_CREATURE, LOOT_GAMEOBJECT])
// iterate over the 4 available difficulties and assign modes
modes:{"mode":1,"1":{"count":4408,"outof":16013},"4":{"count":4408,"outof":22531}}
*/
$handledRefs = [];
$struct = self::getByContainerRecursive($table, $this->entry, $handledRefs);
if (!$struct) {
return false;
}
$items = new ItemList(array(['i.id', $struct[1]], CFG_SQL_LIMIT_NONE));
$this->jsGlobals = $items->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED);
$foo = $items->getListviewData();
// assign listview LV rows to loot rows, not the other way round! The same item may be contained multiple times
foreach ($struct[0] as $loot) {
$base = array('percent' => round($loot['groupChance'] * $loot['realChanceMod'], 3), 'group' => $loot['group'], 'quest' => $loot['quest'], 'count' => 1);
if ($_ = $loot['mode']) {
$base['mode'] = $_;
}
if ($_ = $loot['parentRef']) {
$base['reference'] = $_;
}
if ($_ = self::createStack($loot)) {
$base['pctstack'] = $_;
}
if (empty($loot['reference'])) {
if (!User::isInGroup(U_GROUP_EMPLOYEE)) {
if (!isset($this->results[$loot['content']])) {
$this->results[$loot['content']] = array_merge($foo[$loot['content']], $base, ['stack' => [$loot['min'], $loot['max']]]);
} else {
$this->results[$loot['content']]['percent'] += $base['percent'];
}
} else {
// in case of limited trash loot, check if $foo[<itemId>] exists
$this->results[] = array_merge($foo[$loot['content']], $base, ['stack' => [$loot['min'], $loot['max']]]);
}
} else {
if (User::isInGroup(U_GROUP_EMPLOYEE)) {
$data = array('id' => $loot['reference'], 'name' => '@REFERENCE: ' . $loot['reference'], 'icon' => 'trade_engineering', 'stack' => [$loot['multiplier'], $loot['multiplier']]);
$this->results[] = array_merge($base, $data);
$this->jsGlobals[TYPE_ITEM][$loot['reference']] = $data;
}
}
}
// move excessive % to extra loot
if (!User::isInGroup(U_GROUP_EMPLOYEE)) {
foreach ($this->results as &$_) {
if ($_['percent'] <= 100) {
continue;
}
while ($_['percent'] > 200) {
$_['stack'][0]++;
$_['stack'][1]++;
$_['percent'] -= 100;
}
$_['stack'][1]++;
$_['percent'] = 100;
}
} else {
$fields = ['mode', 'reference'];
$base = [];
$set = 0;
foreach ($this->results as $foo) {
foreach ($fields as $idx => $field) {
$val = isset($foo[$field]) ? $foo[$field] : 0;
if (!isset($base[$idx])) {
$base[$idx] = $val;
} else {
if ($base[$idx] != $val) {
$set |= 1 << $idx;
}
}
}
if ($set == pow(2, count($fields)) - 1) {
break;
}
}
$this->extraCols[] = "Listview.funcBox.createSimpleCol('group', 'Group', '7%', 'group')";
foreach ($fields as $idx => $field) {
if ($set & 1 << $idx) {
$this->extraCols[] = "Listview.funcBox.createSimpleCol('" . $field . "', '" . Util::ucFirst($field) . "', '7%', '" . $field . "')";
}
}
}
return true;
}
示例12: generateContent
protected function generateContent()
{
$this->addJS('?data=zones&locale=' . User::$localeId . '&t=' . $_SESSION['dataKey']);
/***********/
/* Infobox */
/***********/
$infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
// level range
$infobox[] = Lang::game('level') . Lang::main('colon') . $this->subject->getField('minLevel') . ' - ' . $this->subject->getField('maxLevel');
// exotic
if ($this->subject->getField('exotic')) {
$infobox[] = '[url=?spell=53270]' . Lang::pet('exotic') . '[/url]';
}
/****************/
/* Main Content */
/****************/
$this->infobox = '[ul][li]' . implode('[/li][li]', $infobox) . '[/li][/ul]';
$this->headIcons = [$this->subject->getField('iconString')];
$this->expansion = Util::$expansionString[$this->subject->getField('expansion')];
$this->redButtons = array(BUTTON_WOWHEAD => true, BUTTON_LINKS => true, BUTTON_TALENT => ['href' => '?petcalc#' . Util::$tcEncoding[(int) ($this->typeId / 10)] . Util::$tcEncoding[2 * ($this->typeId % 10) + ($this->subject->getField('exotic') ? 1 : 0)], 'pet' => true]);
/**************/
/* Extra Tabs */
/**************/
// tab: tameable & gallery
$condition = array(['ct.type', 1], ['ct.typeFlags', 0x1, '&'], ['ct.family', $this->typeId], ['OR', ['ft.A', 1, '<'], ['ft.H', 1, '<']]);
$tng = new CreatureList($condition);
$this->lvTabs[] = array('file' => 'creature', 'data' => $tng->getListviewData(NPCINFO_TAMEABLE), 'params' => array('name' => '$LANG.tab_tameable', 'hiddenCols' => "\$['type']", 'visibleCols' => "\$['skin']", 'note' => sprintf(Util::$filterResultString, '?npcs=1&filter=fa=38'), 'id' => 'tameable'));
$this->lvTabs[] = array('file' => 'model', 'data' => $tng->getListviewData(NPCINFO_MODEL), 'params' => []);
// tab: diet
$list = [];
$mask = $this->subject->getField('foodMask');
for ($i = 1; $i < 7; $i++) {
if ($mask & 1 << $i - 1) {
$list[] = $i;
}
}
$food = new ItemList(array(['i.subClass', [5, 8]], ['i.FoodType', $list], CFG_SQL_LIMIT_NONE));
$this->extendGlobalData($food->getJSGlobals());
$this->lvTabs[] = array('file' => 'item', 'data' => $food->getListviewData(), 'params' => array('name' => '$LANG.diet', 'hiddenCols' => "\$['source', 'slot', 'side']", 'sort' => "\$['level']", 'id' => 'diet'));
// tab: spells
$mask = 0x0;
foreach (Util::$skillLineMask[-1] as $idx => $pair) {
if ($pair[0] == $this->typeId) {
$mask = 1 << $idx;
break;
}
}
$conditions = [['s.typeCat', -3], ['OR', ['skillLine1', $this->subject->getField('skillLineId')], ['AND', ['skillLine1', 0, '>'], ['skillLine2OrMask', $this->subject->getField('skillLineId')]], ['AND', ['skillLine1', -1], ['skillLine2OrMask', $mask, '&']]]];
$spells = new SpellList($conditions);
$this->extendGlobalData($spells->getJSGlobals(GLOBALINFO_SELF));
$this->lvTabs[] = array('file' => 'spell', 'data' => $spells->getListviewData(), 'params' => array('name' => '$LANG.tab_abilities', 'visibleCols' => "\$['schools', 'level']", 'id' => 'abilities'));
// tab: talents
$conditions = array(['s.typeCat', -7], ['OR', ['s.cuFlags', SPELL_CU_LAST_RANK, '&'], ['s.rankNo', 0]]);
switch ($this->subject->getField('type')) {
case 0:
$conditions[] = ['s.cuFlags', SPELL_CU_PET_TALENT_TYPE0, '&'];
break;
case 1:
$conditions[] = ['s.cuFlags', SPELL_CU_PET_TALENT_TYPE1, '&'];
break;
case 2:
$conditions[] = ['s.cuFlags', SPELL_CU_PET_TALENT_TYPE2, '&'];
break;
}
$talents = new SpellList($conditions);
$this->extendGlobalData($talents->getJSGlobals(GLOBALINFO_SELF));
$this->lvTabs[] = array('file' => 'spell', 'data' => $talents->getListviewData(), 'params' => array('visibleCols' => "\$['tier', 'level']", 'name' => '$LANG.tab_talents', 'id' => 'talents', 'sort' => "\$['tier', 'name']", '_petTalents' => 1));
}
示例13: generateContent
//.........这里部分代码省略.........
continue;
}
$sf[4] = array_merge($sf[4], ['Listview.extraCols.condition']);
$reqQuest[$lv['id']] = 0;
$lv['condition'][0][$this->typeId][] = [[CND_QUESTTAKEN, &$reqQuest[$lv['id']]]];
}
$this->lvTabs[] = array('file' => 'item', 'data' => $lootTab->getResult(), 'params' => ['name' => $sf[2], 'id' => $sf[3], 'extraCols' => $sf[4] ? "\$[" . implode(', ', array_unique($sf[4])) . "]" : null, 'hiddenCols' => $sf[5] ? "\$" . Util::toJSON($sf[5]) : null, 'visibleCols' => $sf[6] ? '$' . Util::toJSON($sf[6]) : 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);
$reqQuests->getJSGlobals(GLOBALINFO_SELF);
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: container can contain
if ($this->subject->getField('slots') > 0) {
$contains = new ItemList(array(['bagFamily', $_bagFamily, '&'], ['slots', 1, '<'], CFG_SQL_LIMIT_NONE));
if (!$contains->error) {
$this->extendGlobalData($contains->getJSGlobals(GLOBALINFO_SELF));
$hCols = ['side'];
if (!$contains->hasSetFields(['slot'])) {
$hCols[] = 'slot';
}
$this->lvTabs[] = array('file' => 'item', 'data' => $contains->getListviewData(), 'params' => ['name' => '$LANG.tab_cancontain', 'id' => 'can-contain', 'hiddenCols' => '$' . Util::toJSON($hCols)]);
}
} else {
if ($_bagFamily != 0x100) {
$contains = new ItemList(array(['bagFamily', $_bagFamily, '&'], ['slots', 0, '>'], CFG_SQL_LIMIT_NONE));
if (!$contains->error) {
$this->extendGlobalData($contains->getJSGlobals(GLOBALINFO_SELF));
$this->lvTabs[] = array('file' => 'item', 'data' => $contains->getListviewData(), 'params' => ['name' => '$LANG.tab_canbeplacedin', 'id' => 'can-be-placed-in', 'hiddenCols' => "\$['side']"]);
}
}
}
// tab: criteria of
$conditions = array(['ac.type', [ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM, ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM, ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM]], ['ac.value1', $this->typeId]);
$criteriaOf = new AchievementList($conditions);
if (!$criteriaOf->error) {
$this->extendGlobalData($criteriaOf->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_REWARDS));
$hCols = [];
if (!$criteriaOf->hasSetFields(['reward_loc0'])) {
$hCols = ['rewards'];
}
$this->lvTabs[] = array('file' => 'achievement', 'data' => $criteriaOf->getListviewData(), 'params' => ['name' => '$LANG.tab_criteriaof', 'id' => 'criteria-of', 'visibleCols' => "\$['category']", 'hiddenCols' => '$' . Util::toJSON($hCols)]);
}
// tab: reagent for
$conditions = array('OR', ['reagent1', $this->typeId], ['reagent2', $this->typeId], ['reagent3', $this->typeId], ['reagent4', $this->typeId], ['reagent5', $this->typeId], ['reagent6', $this->typeId], ['reagent7', $this->typeId], ['reagent8', $this->typeId]);
$reagent = new SpellList($conditions);
if (!$reagent->error) {
$this->extendGlobalData($reagent->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
$this->lvTabs[] = array('file' => 'spell', 'data' => $reagent->getListviewData(), 'params' => ['name' => '$LANG.tab_reagentfor', 'id' => 'reagent-for', 'visibleCols' => "\$['reagents']"]);
}
// tab: unlocks (object or item)
$lockIds = DB::Aowow()->selectCol('SELECT id FROM ?_lock WHERE (type1 = 1 AND properties1 = ?d) OR
(type2 = 1 AND properties2 = ?d) OR (type3 = 1 AND properties3 = ?d) OR
(type4 = 1 AND properties4 = ?d) OR (type5 = 1 AND properties5 = ?d)', $this->typeId, $this->typeId, $this->typeId, $this->typeId, $this->typeId);
示例14: generateContent
//.........这里部分代码省略.........
continue;
}
$n = Util::localizedString($tpl, 'name');
$what = '';
switch ($tpl['typeCat']) {
case -3:
$what = 'herb';
break;
case -4:
$what = 'vein';
break;
case 9:
$what = 'book';
break;
case -6:
if ($tpl['spellFocusId'] == 1) {
$what = 'anvil';
} else {
if ($tpl['spellFocusId'] == 3) {
$what = 'forge';
}
}
break;
}
if ($what) {
$addToMap($what, array('coords' => [[$spawn['posX'], $spawn['posY']]], 'level' => $spawn['floor'], 'name' => $n, 'type' => TYPE_OBJECT, 'id' => $tpl['id']));
}
if ($tpl['startsQuests']) {
$started = new QuestList(array(['qse.method', 1, '&'], ['qse.type', TYPE_OBJECT], ['qse.typeId', $tpl['id']]));
if ($started->error) {
continue;
}
// store data for misc tabs
foreach ($started->getListviewData() as $id => $data) {
if (!empty($started->rewards[$id][TYPE_ITEM])) {
$rewardsLV = array_merge($rewardsLV, array_keys($started->rewards[$id][TYPE_ITEM]));
}
if (!empty($started->choices[$id][TYPE_ITEM])) {
$rewardsLV = array_merge($rewardsLV, array_keys($started->choices[$id][TYPE_ITEM]));
}
$questsLV[$id] = $data;
}
$this->extendGlobalData($started->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_REWARDS));
if ($tpl['A'] != -1 & ($_ = $started->getSOMData(SIDE_ALLIANCE))) {
$addToMap('alliancequests', array('coords' => [[$spawn['posX'], $spawn['posY']]], 'level' => $spawn['floor'], 'name' => $n, 'type' => TYPE_OBJECT, 'id' => $tpl['id'], 'side' => ($tpl['A'] < 0 ? 0 : 0x1) | ($tpl['H'] < 0 ? 0 : 0x2), 'quests' => array_values($_)));
}
if ($tpl['H'] != -1 & ($_ = $started->getSOMData(SIDE_HORDE))) {
$addToMap('hordequests', array('coords' => [[$spawn['posX'], $spawn['posY']]], 'level' => $spawn['floor'], 'name' => $n, 'type' => TYPE_OBJECT, 'id' => $tpl['id'], 'side' => ($tpl['A'] < 0 ? 0 : 0x1) | ($tpl['H'] < 0 ? 0 : 0x2), 'quests' => array_values($_)));
}
}
}
$flightNodes = [];
foreach ($cSpawns as $spawn) {
$tpl = $creatureSpawns->getEntry($spawn['typeId']);
if (!$tpl) {
continue;
}
$n = Util::localizedString($tpl, 'name');
$sn = Util::localizedString($tpl, 'subname');
$what = '';
if ($tpl['npcflag'] & NPC_FLAG_REPAIRER) {
$what = 'repair';
} else {
if ($tpl['npcflag'] & NPC_FLAG_AUCTIONEER) {
$what = 'auctioneer';
} else {
示例15: generateContent
//.........这里部分代码省略.........
$this->stances = Lang::getStances($this->subject->getField('stanceMask'));
}
if (($_ = $this->subject->getField('recoveryTime')) && $_ > 0) {
$this->cooldown = Util::formatTime($_);
}
if (($_ = $this->subject->getField('duration')) && $_ > 0) {
$this->duration = Util::formatTime($_);
}
// factionchange-equivalent
if ($pendant = DB::World()->selectCell('SELECT IF(horde_id = ?d, alliance_id, -horde_id) FROM player_factionchange_spells WHERE alliance_id = ?d OR horde_id = ?d', $this->typeId, $this->typeId, $this->typeId)) {
$altSpell = new SpellList(array(['id', abs($pendant)]));
if (!$altSpell->error) {
$this->transfer = sprintf(Lang::spell('_transfer'), $altSpell->id, 1, $altSpell->getField('iconString'), $altSpell->getField('name', true), $pendant > 0 ? 'alliance' : 'horde', $pendant > 0 ? Lang::game('si', 1) : Lang::game('si', 2));
}
}
/**************/
/* Extra Tabs */
/**************/
$j = [null, 'A', 'B', 'C'];
// tab: abilities [of shapeshift form]
for ($i = 1; $i < 4; $i++) {
if ($this->subject->getField('effect' . $i . 'AuraId') != 36) {
continue;
}
$formSpells = DB::Aowow()->selectRow('SELECT spellId1, spellId2, spellId3, spellId4, spellId5, spellId6, spellId7, spellId8 FROM ?_shapeshiftforms WHERE id = ?d', $this->subject->getField('effect' . $i . 'MiscValue'));
if (!$formSpells) {
continue;
}
$abilities = new SpellList(array(['id', $formSpells]));
if (!$abilities->error) {
if (!$abilities->hasSetFields(['skillLines'])) {
$abH = "\$['skill']";
}
$this->lvTabs[] = array('file' => 'spell', 'data' => $abilities->getListviewData(), 'params' => array('id' => 'controlledabilities', 'name' => '$LANG.tab_controlledabilities', 'visibleCols' => "\$['level']", 'hiddenCols' => isset($abH) ? $abH : null));
$this->extendGlobalData($abilities->getJSGlobals(GLOBALINFO_SELF));
}
}
// tab: modifies $this
$sub = ['OR'];
$conditions = [['s.typeCat', [0, -9, -8], '!'], ['s.spellFamilyId', $this->subject->getField('spellFamilyId')], &$sub];
for ($i = 1; $i < 4; $i++) {
// Flat Mods (107), Pct Mods (108), No Reagent Use (256) .. include dummy..? (4)
if (!in_array($this->subject->getField('effect' . $i . 'AuraId'), [107, 108, 256, 286])) {
continue;
}
$m1 = $this->subject->getField('effect1SpellClassMask' . $j[$i]);
$m2 = $this->subject->getField('effect2SpellClassMask' . $j[$i]);
$m3 = $this->subject->getField('effect3SpellClassMask' . $j[$i]);
if (!$m1 && !$m2 && !$m3) {
continue;
}
$sub[] = ['s.spellFamilyFlags1', $m1, '&'];
$sub[] = ['s.spellFamilyFlags2', $m2, '&'];
$sub[] = ['s.spellFamilyFlags3', $m3, '&'];
}
if (count($sub) > 1) {
$modSpells = new SpellList($conditions);
if (!$modSpells->error) {
if (!$modSpells->hasSetFields(['skillLines'])) {
$msH = "\$['skill']";
}
$this->lvTabs[] = array('file' => 'spell', 'data' => $modSpells->getListviewData(), 'params' => array('id' => 'modifies', 'name' => '$LANG.tab_modifies', 'visibleCols' => "\$['level']", 'hiddenCols' => isset($msH) ? $msH : null));
$this->extendGlobalData($modSpells->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
}
}
// tab: modified by $this