本文整理汇总了PHP中ItemList::getJSGlobals方法的典型用法代码示例。如果您正苦于以下问题:PHP ItemList::getJSGlobals方法的具体用法?PHP ItemList::getJSGlobals怎么用?PHP ItemList::getJSGlobals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ItemList
的用法示例。
在下文中一共展示了ItemList::getJSGlobals方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createRewards
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'] .= ' ' . 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;
}
示例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
//.........这里部分代码省略.........
if ($foo = $this->subject->getField('rewards')) {
array_walk($foo, function (&$item) {
$item = $item[0] != TYPE_ITEM ? null : $item[1];
});
$bar = new ItemList(array(['i.id', $foo]));
foreach ($bar->iterate() as $id => $__) {
$this->rewards['item'][] = array('name' => $bar->getField('name', true), 'quality' => $bar->getField('quality'), 'typeStr' => Util::$typeStrings[TYPE_ITEM], 'id' => $id, 'globalStr' => 'g_items');
}
}
if ($foo = $this->subject->getField('rewards')) {
array_walk($foo, function (&$item) {
$item = $item[0] != TYPE_TITLE ? null : $item[1];
});
$bar = new TitleList(array(['id', $foo]));
foreach ($bar->iterate() as $__) {
$this->rewards['title'][] = sprintf(Lang::achievement('titleReward'), $bar->id, trim(str_replace('%s', '', $bar->getField('male', true))));
}
}
$this->rewards['text'] = $this->subject->getField('reward', true);
// factionchange-equivalent
if ($pendant = DB::World()->selectCell('SELECT IF(horde_id = ?d, alliance_id, -horde_id) FROM player_factionchange_achievement WHERE alliance_id = ?d OR horde_id = ?d', $this->typeId, $this->typeId, $this->typeId)) {
$altAcv = new AchievementList(array(['id', abs($pendant)]));
if (!$altAcv->error) {
$this->transfer = sprintf(Lang::achievement('_transfer'), $altAcv->id, 1, $altAcv->getField('iconString'), $altAcv->getField('name', true), $pendant > 0 ? 'alliance' : 'horde', $pendant > 0 ? Lang::game('si', 1) : Lang::game('si', 2));
}
}
/**************/
/* Extra Tabs */
/**************/
// tab: see also
$conditions = array(['name_loc' . User::$localeId, $this->subject->getField('name', true)], ['id', $this->typeId, '!']);
$saList = new AchievementList($conditions);
$this->lvTabs[] = array('file' => 'achievement', 'data' => $saList->getListviewData(), 'params' => array('id' => 'see-also', 'name' => '$LANG.tab_seealso', 'visibleCols' => "\$['category']"));
$this->extendGlobalData($saList->getJSGlobals());
// tab: criteria of
$refs = DB::Aowow()->SelectCol('SELECT refAchievementId FROM ?_achievementcriteria WHERE Type = ?d AND value1 = ?d', ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT, $this->typeId);
if (!empty($refs)) {
$coList = new AchievementList(array(['id', $refs]));
$this->lvTabs[] = array('file' => 'achievement', 'data' => $coList->getListviewData(), 'params' => array('id' => 'criteria-of', 'name' => '$LANG.tab_criteriaof', 'visibleCols' => "\$['category']"));
$this->extendGlobalData($coList->getJSGlobals());
}
/*****************/
/* Criteria List */
/*****************/
$iconId = 1;
$rightCol = [];
foreach ($this->subject->getCriteria() as $i => $crt) {
// hide hidden criteria for regular users (really do..?)
// if (($crt['completionFlags'] & ACHIEVEMENT_CRITERIA_FLAG_HIDDEN) && User::$perms > 0)
// continue;
// alternative display option
$displayMoney = $crt['completionFlags'] & ACHIEVEMENT_CRITERIA_FLAG_MONEY_COUNTER;
$crtName = Util::localizedString($crt, 'name');
$tmp = array('id' => $crt['id'], 'name' => $crtName, 'type' => $crt['type']);
$obj = (int) $crt['value1'];
$qty = (int) $crt['value2'];
switch ($crt['type']) {
// link to npc
case ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE:
case ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE:
$tmp['link'] = array('href' => '?npc=' . $obj, 'text' => $crtName);
$tmp['extraText'] = Lang::achievement('slain');
break;
// link to area (by map)
// link to area (by map)
case ACHIEVEMENT_CRITERIA_TYPE_WIN_BG:
示例4: 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;
}
//.........这里部分代码省略.........
示例5: generateContent
//.........这里部分代码省略.........
}
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));
}
}
}
}
示例6: generateContent
protected function generateContent()
{
$this->addJS('?data=zones&locale=' . User::$localeId . '&t=' . $_SESSION['dataKey']);
/***********/
/* Infobox */
/***********/
$infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
// Quartermaster if any
if ($ids = $this->subject->getField('qmNpcIds')) {
$this->extendGlobalIds(TYPE_NPC, $ids);
$qmStr = Lang::faction('quartermaster') . Lang::main('colon');
if (count($ids) == 1) {
$qmStr .= '[npc=' . $ids[0] . ']';
} else {
if (count($ids) > 1) {
$qmStr .= '[ul]';
foreach ($ids as $id) {
$qmStr .= '[li][npc=' . $id . '][/li]';
}
$qmStr .= '[/ul]';
}
}
$infobox[] = $qmStr;
}
// side if any
if ($_ = $this->subject->getField('side')) {
$infobox[] = Lang::main('side') . Lang::main('colon') . '[span class=icon-' . ($_ == 1 ? 'alliance' : 'horde') . ']' . Lang::game('si', $_) . '[/span]';
}
/****************/
/* Main Content */
/****************/
$this->extraText = '';
$this->infobox = $infobox ? '[ul][li]' . implode('[/li][li]', $infobox) . '[/li][/ul]' : null;
$this->redButtons = array(BUTTON_WOWHEAD => true, BUTTON_LINKS => true);
// Spillover Effects
/* todo (low): also check on reputation_spillover_template (but its data is identical to calculation below
$rst = DB::World()->selectRow('SELECT
CONCAT_WS(" ", faction1, faction2, faction3, faction4) AS faction,
CONCAT_WS(" ", rate_1, rate_2, rate_3, rate_4) AS rate,
CONCAT_WS(" ", rank_1, rank_2, rank_3, rank_4) AS rank
FROM reputation_spillover_template WHERE faction = ?d', $this->typeId);
*/
$conditions = array(['id', $this->typeId, '!'], ['repIdx', -1, '!']);
if ($p = $this->subject->getField('parentFactionId')) {
// linked via parent
$conditions[] = ['OR', ['id', $p], ['parentFactionId', $p]];
} else {
// self as parent
$conditions[] = ['parentFactionId', $this->typeId];
}
$spillover = new FactionList($conditions);
$this->extendGlobalData($spillover->getJSGlobals());
$buff = '';
foreach ($spillover->iterate() as $spillId => $__) {
if ($val = $spillover->getField('spilloverRateIn') * $this->subject->getField('spilloverRateOut') * 100) {
$buff .= '[tr][td][faction=' . $spillId . '][/td][td][span class=q' . ($val > 0 ? '2]+' : '10]') . $val . '%[/span][/td][td]' . Lang::game('rep', $spillover->getField('spilloverMaxRank')) . '[/td][/tr]';
}
}
if ($buff) {
$this->extraText .= '[h3 class=clear]' . Lang::faction('spillover') . '[/h3][div margin=15px]' . Lang::faction('spilloverDesc') . '[/div][table class=grid width=400px][tr][td width=150px][b]' . Util::ucFirst(Lang::game('faction')) . '[/b][/td][td width=100px][b]' . Lang::spell('_value') . '[/b][/td][td width=150px][b]' . Lang::faction('maxStanding') . '[/b][/td][/tr]' . $buff . '[/table]';
}
// reward rates (ultimately this should be calculated into each reward display)
if ($rates = DB::World()->selectRow('SELECT * FROM reputation_reward_rate WHERE faction = ?d', $this->typeId)) {
$buff = '';
foreach ($rates as $k => $v) {
if ($v == 1) {
continue;
}
switch ($k) {
case 'quest_rate':
$buff .= '[tr][td]' . Lang::game('quests') . Lang::main('colon') . '[/td]';
break;
case 'quest_daily_rate':
$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));
}
//.........这里部分代码省略.........
示例7: 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) {
//.........这里部分代码省略.........
示例8: generateContent
//.........这里部分代码省略.........
$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 {
if ($tpl['npcflag'] & NPC_FLAG_BANKER) {
$what = 'banker';
} else {
if ($tpl['npcflag'] & NPC_FLAG_BATTLEMASTER) {
$what = 'battlemaster';
} else {
if ($tpl['npcflag'] & NPC_FLAG_INNKEEPER) {
$what = 'innkeeper';
} else {
示例9: 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;
}
示例10: generateContent
//.........这里部分代码省略.........
// tab: abilities / tab_controlledabilities (dep: VehicleId)
// 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 = '
示例11: 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();
//.........这里部分代码省略.........
示例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
//.........这里部分代码省略.........
$this->extendGlobalData($lootTabs->jsGlobals);
foreach ($lootTabs->iterate() as $idx => $tab) {
if (!$tab[1]) {
continue;
}
if ($idx == 16) {
$createdBy = array_column($tab[1], 'id');
}
$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] ? '$ ' . Util::toJSON(array_unique($tab[5])) : null, 'visibleCols' => $tab[6] ? '$' . Util::toJSON(array_unique($tab[6])) : null]);
}
}
// tabs: this item contains..
$sourceFor = array([LOOT_ITEM, $this->subject->id, '$LANG.tab_contains', 'contains', ['Listview.extraCols.percent'], [], []], [LOOT_PROSPECTING, $this->subject->id, '$LANG.tab_prospecting', 'prospecting', ['Listview.extraCols.percent'], ['side', 'slot', 'reqlevel'], []], [LOOT_MILLING, $this->subject->id, '$LANG.tab_milling', 'milling', ['Listview.extraCols.percent'], ['side', 'slot', 'reqlevel'], []], [LOOT_DISENCHANT, $this->subject->getField('disenchantId'), '$LANG.tab_disenchanting', 'disenchanting', ['Listview.extraCols.percent'], ['side', 'slot', 'reqlevel'], []]);
$reqQuest = [];
foreach ($sourceFor as $sf) {
$lootTab = new Loot();
if ($lootTab->getByContainer($sf[0], $sf[1])) {
$this->extendGlobalData($lootTab->jsGlobals);
$sf[4] = array_merge($sf[4], $lootTab->extraCols);
foreach ($lootTab->iterate() as $lv) {
if (!$lv['quest']) {
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
示例14: generateContent
protected function generateContent()
{
$this->addJS('?data=zones&locale=' . User::$localeId . '&t=' . $_SESSION['dataKey']);
$_cat = $this->subject->getField('typeCat');
$redButtons = array(BUTTON_LINKS => ['color' => 'ff71d5ff', 'linkId' => Util::$typeStrings[TYPE_SPELL] . ':' . $this->typeId], BUTTON_VIEW3D => false, BUTTON_WOWHEAD => true);
/***********/
/* Infobox */
/***********/
$infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
// level
if (!in_array($_cat, [-5, -6])) {
if ($_ = $this->subject->getField('talentLevel')) {
$infobox[] = in_array($_cat, [-2, 7, -13]) ? sprintf(Lang::game('reqLevel'), $_) : Lang::game('level') . Lang::main('colon') . $_;
} else {
if ($_ = $this->subject->getField('spellLevel')) {
$infobox[] = in_array($_cat, [-2, 7, -13]) ? sprintf(Lang::game('reqLevel'), $_) : Lang::game('level') . Lang::main('colon') . $_;
}
}
}
// races
if ($_ = Lang::getRaceString($this->subject->getField('reqRaceMask'), $__, $jsg, $n, false)) {
if ($_ != Lang::game('ra', 0)) {
$this->extendGlobalIds(TYPE_RACE, $jsg);
$t = $n == 1 ? Lang::game('race') : Lang::game('races');
$infobox[] = Util::ucFirst($t) . Lang::main('colon') . $_;
}
}
// classes
if ($_ = Lang::getClassString($this->subject->getField('reqClassMask'), $jsg, $n, false)) {
$this->extendGlobalIds(TYPE_CLASS, $jsg);
$t = $n == 1 ? Lang::game('class') : Lang::game('classes');
$infobox[] = Util::ucFirst($t) . Lang::main('colon') . $_;
}
// spell focus
if ($_ = $this->subject->getField('spellFocusObject')) {
$bar = DB::Aowow()->selectRow('SELECT * FROM ?_spellfocusobject WHERE id = ?d', $_);
$focus = new GameObjectList(array(['spellFocusId', $_], 1));
$infobox[] = Lang::game('requires2') . ' ' . ($focus->error ? Util::localizedString($bar, 'name') : '[url=?object=' . $focus->id . ']' . Util::localizedString($bar, 'name') . '[/url]');
}
// primary & secondary trades
if (in_array($_cat, [9, 11])) {
// skill
if ($_ = $this->subject->getField('skillLines')[0]) {
$rSkill = new SkillList(array(['id', $_]));
if (!$rSkill->error) {
$this->extendGlobalData($rSkill->getJSGlobals());
$bar = sprintf(Lang::game('requires'), ' [skill=' . $rSkill->id . ']');
if ($_ = $this->subject->getField('learnedAt')) {
$bar .= ' (' . $_ . ')';
}
$infobox[] = $bar;
}
}
// specialization
if ($_ = $this->subject->getField('reqSpellId')) {
$rSpell = new SpellList(array(['id', $_]));
if (!$rSpell->error) {
$this->extendGlobalData($rSpell->getJSGlobals());
$infobox[] = Lang::game('requires2') . ' [spell=' . $rSpell->id . '][/li]';
}
}
// difficulty
if ($_ = $this->subject->getColorsForCurrent()) {
$bar = [];
for ($i = 0; $i < 4; $i++) {
if ($_[$i]) {
$bar[] = '[color=r' . ($i + 1) . ']' . $_[$i] . '[/color]';
}
}
$infobox[] = Lang::game('difficulty') . Lang::main('colon') . implode(' ', $bar);
}
}
// accquisition.. 10: starter spell; 7: discovery
if (isset($this->subject->sources[$this->subject->id][10])) {
$infobox[] = Lang::spell('starter');
} else {
if (isset($this->subject->sources[$this->subject->id][7])) {
$infobox[] = Lang::spell('discovered');
}
}
// training cost
if ($cost = $this->subject->getField('trainingCost')) {
$infobox[] = Lang::spell('trainingCost') . Lang::main('colon') . '[money=' . $cost . '][/li]';
}
// used in mode
foreach ($this->difficulties as $n => $id) {
if ($id == $this->typeId) {
// "Mode" seems to be multilingual acceptable
$infobox[] = 'Mode' . Lang::main('colon') . Lang::game('modes', $n);
}
}
$effects = $this->createEffects($infobox, $redButtons);
// spell script
if (User::isInGroup(U_GROUP_STAFF)) {
if ($_ = DB::World()->selectCell('SELECT ScriptName FROM spell_script_names WHERE ABS(spell_id) = ?d', $this->firstRank)) {
$infobox[] = 'Script' . Lang::main('colon') . $_;
}
}
$infobox = $infobox ? '[ul][li]' . implode('[/li][li]', $infobox) . '[/li][/ul]' : '';
// append glyph symbol if available
//.........这里部分代码省略.........
示例15: createGemScores
private function createGemScores()
{
$gemScores = [];
if (empty($this->filter['fi']['setWeights'])) {
return [];
}
if (!empty($this->filter['gm'])) {
$this->sharedLV['computeDataFunc'] = '$fi_scoreSockets';
$q = intVal($this->filter['gm']);
$mask = 14;
$cnd = [10, ['class', ITEM_CLASS_GEM], ['gemColorMask', &$mask, '&'], ['quality', &$q]];
if (!isset($this->filter['jc'])) {
$cnd[] = ['itemLimitCategory', 0];
}
// Jeweler's Gems
if ($this->filterObj->wtCnd) {
$cnd[] = $this->filterObj->wtCnd;
}
$anyColor = new ItemList($cnd, ['extraOpts' => $this->filterObj->extraOpts]);
if (!$anyColor->error) {
$this->extendGlobalData($anyColor->getJSGlobals());
$gemScores[0] = array_values($anyColor->getListviewData(ITEMINFO_GEM));
}
for ($i = 0; $i < 4; $i++) {
$mask = 1 << $i;
$q = !$i ? 3 : intVal($this->filter['gm']);
// meta gems are always included.. ($q is backReferenced)
$byColor = new ItemList($cnd, ['extraOpts' => $this->filterObj->extraOpts]);
if (!$byColor->error) {
$this->extendGlobalData($byColor->getJSGlobals());
$gemScores[$mask] = array_values($byColor->getListviewData(ITEMINFO_GEM));
}
}
}
$this->sharedLV['onBeforeCreate'] = '$fi_initWeightedListview';
$this->sharedLV['onAfterCreate'] = '$fi_addUpgradeIndicator';
$this->sharedLV['sort'] = ['-score', 'name'];
array_push($this->sharedLV['hiddenCols'], 'type', 'source');
return $gemScores;
}