本文整理汇总了PHP中ItemList::getField方法的典型用法代码示例。如果您正苦于以下问题:PHP ItemList::getField方法的具体用法?PHP ItemList::getField怎么用?PHP ItemList::getField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ItemList
的用法示例。
在下文中一共展示了ItemList::getField方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: _searchItem
private function _searchItem($cndBase, &$shared)
{
$result = [];
$miscData = [];
$cndAdd = empty($this->query) ? [] : (is_int($this->query) ? ['id', $this->query] : $this->createLookup());
if ($this->searchMask & SEARCH_TYPE_JSON && $this->searchMask & 0x20 && !empty($shared['pcsToSet'])) {
$cnd = [['i.id', array_keys($shared['pcsToSet'])], CFG_SQL_LIMIT_NONE];
$miscData = ['pcsToSet' => $shared['pcsToSet']];
} else {
if ($this->searchMask & SEARCH_TYPE_JSON && $this->searchMask & 0x40) {
$cnd = $cndBase;
$cnd[] = ['i.class', [ITEM_CLASS_WEAPON, ITEM_CLASS_GEM, ITEM_CLASS_ARMOR]];
$cnd[] = $cndAdd;
$slots = isset($_GET['slots']) ? explode(':', $_GET['slots']) : [];
array_walk($slots, function (&$v, $k) {
$v = intVal($v);
});
if ($_ = array_filter($slots)) {
$cnd[] = ['slot', $_];
}
$itemFilter = new ItemListFilter();
if ($_ = $itemFilter->createConditionsForWeights($this->statWeight)) {
$miscData['extraOpts'] = $itemFilter->extraOpts;
$cnd = array_merge($cnd, [$_]);
}
} else {
$cnd = array_merge($cndBase, [$cndAdd]);
}
}
$items = new ItemList($cnd, $miscData);
if ($data = $items->getListviewData($this->searchMask & SEARCH_TYPE_JSON ? ITEMINFO_SUBITEMS | ITEMINFO_JSON : 0)) {
if ($this->searchMask & SEARCH_TYPE_REGULAR) {
$this->extendGlobalData($items->getJSGlobals());
}
if ($this->searchMask & SEARCH_TYPE_OPEN) {
foreach ($items->iterate() as $__) {
$data[$items->id]['param1'] = $items->getField('iconString');
$data[$items->id]['param2'] = $items->getField('quality');
}
}
$result = array('type' => TYPE_ITEM, 'appendix' => ' (Item)', 'matches' => $items->getMatches(), 'file' => ItemList::$brickFile, 'data' => $data, 'params' => []);
if ($items->getMatches() > $this->maxResults) {
$result['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_itemsfound', $items->getMatches(), $this->maxResults);
$result['params']['_truncated'] = 1;
}
if (isset($result['params']['note'])) {
$result['params']['note'] .= ' + LANG.dash + $WH.sprintf(LANG.lvnote_filterresults, \'?items&filter=na=' . urlencode($this->search) . '\')';
} else {
$result['params']['note'] = '$$WH.sprintf(LANG.lvnote_filterresults, \'?items&filter=na=' . urlencode($this->search) . '\')';
}
}
return $result;
}
示例3: renderTooltip
public function renderTooltip($interactive = false, $subOf = 0, $enhance = [])
{
if ($this->error) {
return;
}
$_name = $this->getField('name', true);
$_reqLvl = $this->curTpl['requiredLevel'];
$_quality = $this->curTpl['quality'];
$_flags = $this->curTpl['flags'];
$_class = $this->curTpl['class'];
$_subClass = $this->curTpl['subClass'];
$_slot = $this->curTpl['slot'];
$causesScaling = false;
if (!empty($enhance['r'])) {
if ($this->getRandEnchantForItem($enhance['r'])) {
$_name .= ' ' . Util::localizedString($this->enhanceR, 'name');
$randEnchant = '';
for ($i = 1; $i < 6; $i++) {
if ($this->enhanceR['enchantId' . $i] <= 0) {
continue;
}
$enchant = DB::Aowow()->selectRow('SELECT * FROM ?_itemenchantment WHERE Id = ?d', $this->enhanceR['enchantId' . $i]);
if ($this->enhanceR['allocationPct' . $i] > 0) {
$amount = intVal($this->enhanceR['allocationPct' . $i] * $this->generateEnchSuffixFactor());
$randEnchant .= '<span>' . str_replace('$i', $amount, Util::localizedString($enchant, 'name')) . '</span><br />';
} else {
$randEnchant .= '<span>' . Util::localizedString($enchant, 'name') . '</span><br />';
}
}
} else {
unset($enhance['r']);
}
}
if (isset($enhance['s']) && !in_array($_slot, [INVTYPE_WRISTS, INVTYPE_WAIST, INVTYPE_HANDS])) {
unset($enhance['s']);
}
// IMPORTAT: DO NOT REMOVE THE HTML-COMMENTS! THEY ARE REQUIRED TO UPDATE THE TOOLTIP CLIENTSIDE
$x = '';
// upper table: stats
if (!$subOf) {
$x .= '<table><tr><td>';
}
// name; quality
if ($subOf) {
$x .= '<span class="q' . $_quality . '"><a href="?item=' . $this->id . '">' . $_name . '</a></span>';
} else {
$x .= '<b class="q' . $_quality . '">' . $_name . '</b>';
}
// heroic tag
if ($_flags & ITEM_FLAG_HEROIC && $_quality == ITEM_QUALITY_EPIC) {
$x .= '<br /><span class="q2">' . Lang::item('heroic') . '</span>';
}
// requires map (todo: reparse ?_zones for non-conflicting data; generate Link to zone)
if ($_ = $this->curTpl['map']) {
$map = DB::Aowow()->selectRow('SELECT * FROM ?_zones WHERE mapId = ?d LIMIT 1', $_);
$x .= '<br /><a href="?zone=' . $_ . '" class="q1">' . Util::localizedString($map, 'name') . '</a>';
}
// requires area
if ($this->curTpl['area']) {
$area = DB::Aowow()->selectRow('SELECT * FROM ?_zones WHERE Id=?d LIMIT 1', $this->curTpl['area']);
$x .= '<br />' . Util::localizedString($area, 'name');
}
// conjured
if ($_flags & ITEM_FLAG_CONJURED) {
$x .= '<br />' . Lang::item('conjured');
}
// bonding
if ($_flags & ITEM_FLAG_ACCOUNTBOUND) {
$x .= '<br /><!--bo-->' . Lang::item('bonding', 0);
} else {
if ($this->curTpl['bonding']) {
$x .= '<br /><!--bo-->' . Lang::item('bonding', $this->curTpl['bonding']);
}
}
// unique || unique-equipped || unique-limited
if ($this->curTpl['maxCount'] > 0) {
$x .= '<br />' . Lang::item('unique');
if ($this->curTpl['maxCount'] > 1) {
$x .= ' (' . $this->curTpl['maxCount'] . ')';
}
} else {
if ($_flags & ITEM_FLAG_UNIQUEEQUIPPED) {
$x .= '<br />' . Lang::item('uniqueEquipped');
} else {
if ($this->curTpl['itemLimitCategory']) {
$limit = DB::Aowow()->selectRow("SELECT * FROM ?_itemlimitcategory WHERE id = ?", $this->curTpl['itemLimitCategory']);
$x .= '<br />' . ($limit['isGem'] ? Lang::item('uniqueEquipped') : Lang::item('unique')) . Lang::main('colon') . Util::localizedString($limit, 'name') . ' (' . $limit['count'] . ')';
}
}
}
// max duration
if ($dur = $this->curTpl['duration']) {
$x .= "<br />" . Lang::game('duration') . Lang::main('colon') . Util::formatTime(abs($dur) * 1000) . ($this->curTpl['flagsCustom'] & 0x1 ? ' (' . Lang::item('realTime') . ')' : null);
}
// required holiday
if ($eId = $this->curTpl['eventId']) {
if ($hName = DB::Aowow()->selectRow('SELECT h.* FROM ?_holidays h JOIN ?_events e ON e.holidayId = h.id WHERE e.id = ?d', $eId)) {
$x .= '<br />' . sprintf(Lang::game('requires'), '<a href="' . $eId . '" class="q1">' . Util::localizedString($hName, 'name') . '</a>');
}
}
//.........这里部分代码省略.........
示例4: 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;
}
示例5: 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;
}
//.........这里部分代码省略.........
示例6: 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, '!'];
//.........这里部分代码省略.........
示例7: generateContent
protected function generateContent()
{
/***********/
/* Infobox */
/***********/
$infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
// points
if ($_ = $this->subject->getField('points')) {
$infobox[] = Lang::achievement('points') . Lang::main('colon') . '[achievementpoints=' . $_ . ']';
}
// location
// todo (low)
// faction
switch ($this->subject->getField('faction')) {
case 1:
$infobox[] = Lang::main('side') . Lang::main('colon') . '[span class=icon-alliance]' . Lang::game('si', SIDE_ALLIANCE) . '[/span]';
break;
case 2:
$infobox[] = Lang::main('side') . Lang::main('colon') . '[span class=icon-horde]' . Lang::game('si', SIDE_HORDE) . '[/span]';
break;
default:
// case 3
$infobox[] = Lang::main('side') . Lang::main('colon') . Lang::game('si', SIDE_BOTH);
}
// realm first available?
if ($this->subject->getField('flags') & 0x100 && DB::isConnectable(DB_AUTH)) {
$avlb = [];
foreach (DB::Auth()->selectCol('SELECT id AS ARRAY_KEY, name FROM realmlist WHERE allowedSecurityLevel = 0 AND gamebuild = ?d', WOW_VERSION) as $rId => $name) {
if (!DB::isConnectable(DB_CHARACTERS . $rId)) {
continue;
}
if (!DB::Characters($rId)->selectCell('SELECT 1 FROM character_achievement WHERE achievement = ?d LIMIT 1', $this->typeId)) {
$avlb[] = $name;
}
}
if ($avlb) {
$infobox[] = Lang::achievement('rfAvailable') . implode(', ', $avlb);
}
}
/**********/
/* Series */
/**********/
$series = [];
if ($c = $this->subject->getField('chainId')) {
$chainAcv = new AchievementList(array(['chainId', $c]));
foreach ($chainAcv->iterate() as $aId => $__) {
$pos = $chainAcv->getField('chainPos');
if (!isset($series[$pos])) {
$series[$pos] = [];
}
$series[$pos][] = array('side' => $chainAcv->getField('faction'), 'typeStr' => Util::$typeStrings[TYPE_ACHIEVEMENT], 'typeId' => $aId, 'name' => $chainAcv->getField('name', true));
}
}
/****************/
/* Main Content */
/****************/
$this->mail = $this->createMail($reqBook);
$this->headIcons = [$this->subject->getField('iconString')];
$this->infobox = $infobox ? '[ul][li]' . implode('[/li][li]', $infobox) . '[/li][/ul]' : null;
$this->series = $series ? [[$series, null]] : null;
$this->description = $this->subject->getField('description', true);
$this->redButtons = array(BUTTON_LINKS => ['color' => 'ffffff00', 'linkId' => Util::$typeStrings[TYPE_ACHIEVEMENT] . ':' . $this->typeId . ':"..UnitGUID("player")..":0:0:0:0:0:0:0:0'], BUTTON_WOWHEAD => !($this->subject->getField('cuFlags') & CUSTOM_SERVERSIDE));
$this->criteria = array('reqQty' => $this->subject->getField('reqCriteriaCount'), 'icons' => [], 'data' => []);
if ($reqBook) {
$this->addCss(['path' => 'Book.css']);
}
// create rewards
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']"));
//.........这里部分代码省略.........
示例8: generateContent
protected function generateContent()
{
/***********/
/* Infobox */
/***********/
$infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
// reqLevel
if ($_ = $this->subject->getField('requiredLevel')) {
$infobox[] = sprintf(Lang::game('reqLevel'), $_);
}
// reqskill
if ($_ = $this->subject->getField('skillLine')) {
$this->extendGlobalIds(TYPE_SKILL, $_);
$foo = sprintf(Lang::game('requires'), ' [skill=' . $_ . ']');
if ($_ = $this->subject->getField('skillLevel')) {
$foo .= ' (' . $_ . ')';
}
$infobox[] = $foo;
}
/****************/
/* Main Content */
/****************/
$this->infobox = $infobox ? '[ul][li]' . implode('[/li][li]', $infobox) . '[/li][/ul]' : null;
$this->effects = [];
// 3 effects
for ($i = 1; $i < 4; $i++) {
$_ty = $this->subject->getField('type' . $i);
$_qty = $this->subject->getField('amount' . $i);
$_obj = $this->subject->getField('object' . $i);
switch ($_ty) {
case 1:
case 3:
case 7:
$sArr = $this->subject->getField('spells')[$i];
$spl = $this->subject->getRelSpell($sArr[0]);
$this->effects[$i]['name'] = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, 'Type: ' . $_ty, Lang::item('trigger', $sArr[1])) : Lang::item('trigger', $sArr[1]);
$this->effects[$i]['proc'] = $sArr[3];
$this->effects[$i]['value'] = $_qty ?: null;
$this->effects[$i]['icon'] = array('name' => !$spl ? Util::ucFirst(Lang::game('spell')) . ' #' . $sArr[0] : Util::localizedString($spl, 'name'), 'id' => $sArr[0], 'count' => $sArr[2]);
break;
case 5:
if ($_obj < 2) {
// [mana, health] are on [0, 1] respectively and are expected on [1, 2] ..
$_obj++;
}
// 0 is weaponDmg .. ehh .. i messed up somewhere
$this->effects[$i]['tip'] = [$_obj, Util::$itemMods[$_obj]];
// DO NOT BREAK!
// DO NOT BREAK!
case 2:
case 6:
case 8:
case 4:
$this->effects[$i]['name'] = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, 'Type: ' . $_ty, Lang::enchantment('types', $_ty)) : Lang::enchantment('types', $_ty);
$this->effects[$i]['value'] = $_qty;
if ($_ty == 4) {
$this->effects[$i]['name'] .= Lang::main('colon') . '(' . (User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, 'Object: ' . $_obj, Lang::getMagicSchools(1 << $_obj)) : Lang::getMagicSchools(1 << $_obj)) . ')';
}
}
}
// activation conditions
if ($_ = $this->subject->getField('conditionId')) {
$x = '';
if ($gemCnd = DB::Aowow()->selectRow('SELECT * FROM ?_itemenchantmentcondition WHERE id = ?d', $_)) {
for ($i = 1; $i < 6; $i++) {
if (!$gemCnd['color' . $i]) {
continue;
}
$fiColors = function ($idx) {
$foo = '';
switch ($idx) {
case 2:
$foo = '0:3:5';
break;
// red
// red
case 3:
$foo = '2:4:5';
break;
// yellow
// yellow
case 4:
$foo = '1:3:4';
break;
// blue
}
return $foo;
};
$bLink = $gemCnd['color' . $i] ? '<a href="?items=3&filter=ty=' . $fiColors($gemCnd['color' . $i]) . '">' . Lang::item('gemColors', $gemCnd['color' . $i] - 1) . '</a>' : '';
$cLink = $gemCnd['cmpColor' . $i] ? '<a href="?items=3&filter=ty=' . $fiColors($gemCnd['cmpColor' . $i]) . '">' . Lang::item('gemColors', $gemCnd['cmpColor' . $i] - 1) . '</a>' : '';
switch ($gemCnd['comparator' . $i]) {
case 2:
// requires less <color> than (<value> || <comparecolor>) gems
// requires less <color> than (<value> || <comparecolor>) gems
case 5:
// requires at least <color> than (<value> || <comparecolor>) gems
$sp = (int) $gemCnd['value' . $i] > 1;
$x .= '<span class="q0">' . Lang::achievement('reqNumCrt') . ' ' . sprintf(Lang::item('gemConditions', $gemCnd['comparator' . $i], $sp), $gemCnd['value' . $i], $bLink) . '</span><br />';
break;
case 3:
//.........这里部分代码省略.........
示例9: generateContent
//.........这里部分代码省略.........
// if intersect yields an empty array no lookups will occur
case 1:
if (isset($this->category[0]) && $this->category[0] == ITEM_CLASS_ARMOR) {
$groups = $availableSlots[ITEM_CLASS_ARMOR];
} else {
if (isset($this->category[0]) && $this->category[0] == ITEM_CLASS_WEAPON) {
$groups = $availableSlots[ITEM_CLASS_WEAPON];
} else {
$groups = array_merge($availableSlots[ITEM_CLASS_ARMOR], $availableSlots[ITEM_CLASS_WEAPON]);
}
}
if (isset($this->filter['sl'])) {
// skip lookups for unselected slots
$groups = array_intersect($groups, (array) $this->filter['sl']);
}
if (!empty($this->filter['upg'])) {
// skip lookups for slots we dont have items to upgrade for
$groups = array_intersect($groups, (array) $this->filter['upg']);
}
if ($groups) {
$nameSource = Lang::item('inventoryType');
$this->forceTabs = true;
}
break;
case 2:
// itemlevel: first, try to find 10 level steps within range (if given) as tabs
// ohkayy, maybe i need to rethink $this
$this->filterOpts = $this->filterObj->extraOpts;
$this->filterOpts['is']['o'] = [null];
// remove 'order by' from itemStats
$extraOpts = array_merge($this->filterOpts, ['i' => ['g' => ['itemlevel'], 'o' => ['itemlevel DESC']]]);
$levelRef = new ItemList(array_merge($conditions, [10]), ['extraOpts' => $extraOpts]);
foreach ($levelRef->iterate() as $_) {
$l = $levelRef->getField('itemLevel');
$groups[] = $l;
$nameSource[$l] = Lang::game('level') . ' ' . $l;
}
if ($groups) {
$l = -end($groups);
$groups[] = $l;
// push last value as negativ to signal misc group after $this level
$extraOpts = ['i' => ['o' => ['itemlevel DESC']]];
$nameSource[$l] = Lang::item('tabOther');
$this->forceTabs = true;
}
break;
case 3:
// source
$groups = [1, 2, 3, 4, 5, 10, 11, 12, 0];
$nameSource = Lang::game('sources');
$this->forceTabs = true;
break;
// none
// none
default:
$grouping = 0;
$groups[0] = null;
}
/*****************************/
/* create lv-tabs for groups */
/*****************************/
foreach ($groups as $group) {
switch ($grouping) {
case 1:
$finalCnd = array_merge($conditions, [['slot', $group], $maxResults]);
break;
示例10: generateContent
protected function generateContent()
{
$this->addJS('?data=weight-presets.zones&locale=' . User::$localeId . '&t=' . $_SESSION['dataKey']);
$_flags = $this->subject->getField('flags');
$_slot = $this->subject->getField('slot');
$_class = $this->subject->getField('class');
$_subClass = $this->subject->getField('subClass');
$_bagFamily = $this->subject->getField('bagFamily');
$_model = $this->subject->getField('displayId');
$_visSlots = array(INVTYPE_HEAD, INVTYPE_SHOULDERS, INVTYPE_BODY, INVTYPE_CHEST, INVTYPE_WAIST, INVTYPE_LEGS, INVTYPE_FEET, INVTYPE_WRISTS, INVTYPE_HANDS, INVTYPE_WEAPON, INVTYPE_SHIELD, INVTYPE_RANGED, INVTYPE_CLOAK, INVTYPE_2HWEAPON, INVTYPE_TABARD, INVTYPE_ROBE, INVTYPE_WEAPONMAINHAND, INVTYPE_WEAPONOFFHAND, INVTYPE_HOLDABLE, INVTYPE_THROWN, INVTYPE_RANGEDRIGHT);
/***********/
/* Infobox */
/***********/
$infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
// itemlevel
if (in_array($_class, [ITEM_CLASS_ARMOR, ITEM_CLASS_WEAPON, ITEM_CLASS_AMMUNITION]) || $this->subject->getField('gemEnchantmentId')) {
$infobox[] = Lang::game('level') . Lang::main('colon') . $this->subject->getField('itemLevel');
}
// account-wide
if ($_flags & ITEM_FLAG_ACCOUNTBOUND) {
$infobox[] = Lang::item('accountWide');
}
// side
if ($si = $this->subject->json[$this->typeId]['side']) {
if ($si != 3) {
$infobox[] = Lang::main('side') . Lang::main('colon') . '[span class=icon-' . ($si == 1 ? 'alliance' : 'horde') . ']' . Lang::game('si', $si) . '[/span]';
}
}
// consumable / not consumable
if (!$_slot) {
$hasUse = false;
for ($i = 1; $i < 6; $i++) {
if ($this->subject->getField('spellId' . $i) <= 0 || in_array($this->subject->getField('spellTrigger' . $i), [1, 2])) {
continue;
}
$hasUse = true;
if ($this->subject->getField('spellCharges' . $i) >= 0) {
continue;
}
$tt = '[tooltip=tooltip_consumedonuse]' . Lang::item('consumable') . '[/tooltip]';
break;
}
if ($hasUse) {
$infobox[] = isset($tt) ? $tt : '[tooltip=tooltip_notconsumedonuse]' . Lang::item('nonConsumable') . '[/tooltip]';
}
}
// related holiday
if ($hId = $this->subject->getField('holidayId')) {
if ($hName = DB::Aowow()->selectRow('SELECT * FROM ?_holidays WHERE id = ?d', $hId)) {
$infobox[] = Lang::game('eventShort') . Lang::main('colon') . '[url=?event=' . $hId . ']' . Util::localizedString($hName, 'name') . '[/url]';
}
}
// tool
if ($tId = $this->subject->getField('totemCategory')) {
if ($tName = DB::Aowow()->selectRow('SELECT * FROM ?_totemcategory WHERE id = ?d', $tId)) {
$infobox[] = Lang::item('tool') . Lang::main('colon') . '[url=?items&filter=cr=91;crs=' . $tId . ';crv=0]' . Util::localizedString($tName, 'name') . '[/url]';
}
}
// extendedCost
if (!empty($this->subject->getExtendedCost([], $_reqRating)[$this->subject->id])) {
$vendors = $this->subject->getExtendedCost()[$this->subject->id];
$each = $this->subject->getField('stackable') > 1 ? '[color=q0] (' . Lang::item('each') . ')[/color]' : null;
$handled = [];
$costList = [];
foreach ($vendors as $npcId => $data) {
$tokens = [];
$currency = [];
if (!is_array($data)) {
continue;
}
foreach ($data as $c => $qty) {
if (is_string($c)) {
unset($data[$c]);
// unset miscData to prevent having two vendors /w the same cost being cached, because of different stock or rating-requirements
continue;
}
if ($c < 0) {
// currency items (and honor or arena)
$currency[] = -$c . ',' . $qty;
} else {
if ($c > 0) {
// plain items (item1,count1,item2,count2,...)
$tokens[$c] = $c . ',' . $qty;
}
}
}
// display every cost-combination only once
if (in_array(md5(serialize($data)), $handled)) {
continue;
}
$handled[] = md5(serialize($data));
$cost = isset($data[0]) ? '[money=' . $data[0] : '[money';
if ($tokens) {
$cost .= ' items=' . implode(',', $tokens);
}
if ($currency) {
$cost .= ' currency=' . implode(',', $currency);
}
$cost .= ']';
$costList[] = $cost;
//.........这里部分代码省略.........
示例11: handleLoad
protected function handleLoad()
{
/* params
id: profileId
items: string [itemIds.join(':')]
unnamed: unixtime [only to force the browser to reload instead of cache]
return
lots...
*/
// titles, achievements, characterData, talents (, pets)
// and some onLoad-hook to .. load it registerProfile($data)
// everything else goes through data.php .. strangely enough
if (!$this->_get['id']) {
return;
}
$char = new ProfileList(array(['id', $this->_get['id'][0]]));
// or string or whatever
$buff = '';
if ($it = array_column($char->getField('inventory'), 0)) {
$itemz = new ItemList(array(['id', $it, CFG_SQL_LIMIT_NONE]));
$data = $itemz->getListviewData(ITEMINFO_JSON | ITEMINFO_SUBITEMS);
// get and apply inventory
foreach ($itemz->iterate() as $iId => $__) {
$buff .= 'g_items.add(' . $iId . ', {name_' . User::$localeString . ":'" . Util::jsEscape($itemz->getField('name', true)) . "', quality:" . $itemz->getField('quality') . ", icon:'" . $itemz->getField('iconString') . "', jsonequip:" . Util::toJSON($data[$iId]) . "});\n";
}
$buff .= "\n";
}
if ($au = $char->getField('auras')) {
$auraz = new SpellList(array(['id', $char->getField('auras')], CFG_SQL_LIMIT_NONE));
$dataz = $auraz->getListviewData();
$modz = $auraz->getProfilerMods();
// get and apply aura-mods
foreach ($dataz as $id => $data) {
$mods = [];
if (!empty($modz[$id])) {
foreach ($modz[$id] as $k => $v) {
if (is_array($v)) {
$mods[] = $v;
} else {
if ($str = @Util::$itemMods[$k]) {
$mods[$str] = $v;
}
}
}
}
$buff .= 'g_spells.add(' . $id . ", {id:" . $id . ", name:'" . Util::jsEscape(mb_substr($data['name'], 1)) . "', icon:'" . $data['icon'] . "', modifier:" . Util::toJSON($mods) . "});\n";
}
$buff .= "\n";
}
/* depending on progress-achievements
// required by progress in JScript move to handleLoad()?
Util::$pageTemplate->extendGlobalIds(TYPE_NPC, [29120, 31134, 29306, 29311, 23980, 27656, 26861, 26723, 28923, 15991]);
*/
// load available titles
Util::loadStaticFile('p-titles-' . $char->getField('gender'), $buff, true);
// load available achievements
if (!Util::loadStaticFile('p-achievements', $buff, true)) {
$buff .= "\n\ng_achievement_catorder = [];";
$buff .= "\n\ng_achievement_points = [0];";
}
// excludes; structure UNK type => [maskBit => [typeIds]] ?
/*
g_user.excludes = [type:[typeIds]]
g_user.includes = [type:[typeIds]]
g_user.excludegroups = groupMask // requires g_user.settings != null
maskBit are matched against fieldId from excludeGroups
id: 1, label: LANG.dialog_notavail
id: 2, label: LANG.dialog_tcg
id: 4, label: LANG.dialog_collector
id: 8, label: LANG.dialog_promo
id: 16, label: LANG.dialog_nonus
id: 96, label: LANG.dialog_faction
id: 896, label: LANG.dialog_profession
id: 1024, label: LANG.dialog_noexalted
*/
// $buff .= "\n\ng_excludes = {};";
// add profile to buffer
$buff .= "\n\n\$WowheadProfiler.registerProfile(" . Util::toJSON($char->getEntry(2)) . ");";
// can't use JSON_NUMERIC_CHECK or the talent-string becomes a float
return $buff . "\n";
}