本文整理汇总了PHP中ItemList::hasSetFields方法的典型用法代码示例。如果您正苦于以下问题:PHP ItemList::hasSetFields方法的具体用法?PHP ItemList::hasSetFields怎么用?PHP ItemList::hasSetFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ItemList
的用法示例。
在下文中一共展示了ItemList::hasSetFields方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateContent
//.........这里部分代码省略.........
$extra = [];
foreach ($tSpells as $sId => $train) {
if (empty($data[$sId])) {
continue;
}
if ($_ = $train['reqSkillId']) {
$this->extendGlobalIds(TYPE_SKILL, $_);
if (!isset($extra[0])) {
$extra[0] = 'Listview.extraCols.condition';
}
$data[$sId]['condition'][0][$this->typeId][] = [[CND_SKILL, $_, $train['reqSkillValue']]];
}
if ($_ = $train['reqLevel']) {
if (!isset($extra[1])) {
$extra[1] = "Listview.funcBox.createSimpleCol('reqLevel', LANG.tooltip_reqlevel, '7%', 'reqLevel')";
}
$data[$sId]['reqLevel'] = $_;
}
if ($_ = $train['cost']) {
$data[$sId]['trainingcost'] = $_;
}
}
$this->lvTabs[] = array('file' => 'spell', 'data' => $data, 'params' => array('name' => '$LANG.tab_teaches', 'id' => 'teaches', 'visibleCols' => "\$['trainingcost']", 'extraCols' => $extra ? '$[' . implode(', ', $extra) . ']' : null));
}
} else {
trigger_error('NPC ' . $this->typeId . ' is flagged as trainer, but doesn\'t have any spells set', E_USER_WARNING);
}
}
// tab: sells
if ($sells = DB::World()->selectCol('SELECT item FROM npc_vendor nv WHERE entry = ?d UNION SELECT item FROM game_event_npc_vendor genv JOIN creature c ON genv.guid = c.guid WHERE c.id = ?d', $this->typeId, $this->typeId)) {
$soldItems = new ItemList(array(['id', $sells]));
if (!$soldItems->error) {
$extraCols = ["Listview.funcBox.createSimpleCol('stack', 'stack', '10%', 'stack')", 'Listview.extraCols.cost'];
if ($soldItems->hasSetFields(['condition'])) {
$extraCols[] = 'Listview.extraCols.condition';
}
$lvData = $soldItems->getListviewData(ITEMINFO_VENDOR, [TYPE_NPC => [$this->typeId]]);
$sc = Util::getServerConditions(CND_SRC_NPC_VENDOR, $this->typeId);
if (!empty($sc[0])) {
$this->extendGlobalData($sc[1]);
if (!array_search('Listview.extraCols.condition', $extraCols)) {
$extraCols[] = 'Listview.extraCols.condition';
}
foreach ($lvData as $id => &$row) {
foreach ($sc[0] as $srcType => $cndData) {
if (!empty($cndData[$id . ':' . $this->typeId])) {
$row['condition'][0][$id . ':' . $this->typeId] = $cndData[$id . ':' . $this->typeId];
}
}
}
}
$this->lvTabs[] = array('file' => 'item', 'data' => $lvData, 'params' => array('name' => '$LANG.tab_sells', 'id' => 'currency-for', 'extraCols' => '$[' . implode(', ', $extraCols) . ']'));
$this->extendGlobalData($soldItems->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
}
}
// tabs: this creature contains..
$skinTab = ['tab_skinning', 'skinning'];
if ($_typeFlags & NPC_TYPEFLAG_HERBLOOT) {
$skinTab = ['tab_herbalism', 'herbalism'];
} else {
if ($_typeFlags & NPC_TYPEFLAG_MININGLOOT) {
$skinTab = ['tab_mining', 'mining'];
} else {
if ($_typeFlags & NPC_TYPEFLAG_ENGINEERLOOT) {
$skinTab = ['tab_engineering', 'engineering'];
}
示例2: generateContent
//.........这里部分代码省略.........
if ($upgItemData) {
if ($grouping == 1) {
$upg = array_keys(array_filter($this->filter['upg'], function ($v) use($group) {
return $v == $group;
}));
foreach ($upg as $uId) {
$tabData['data'][$uId] = $upgItemData[$uId];
}
if ($upg) {
$tabData['_upgradeIds'] = $upg;
}
} else {
if ($grouping) {
$upg = array_keys($this->filter['upg']);
$tabData['_upgradeIds'] = $upg;
foreach ($upgItemData as $uId => $data) {
// using numeric keys => cant use array_merge
$tabData['data'][$uId] = $data;
}
}
}
}
if ($grouping) {
switch ($grouping) {
case 1:
$tabData['id'] = 'slot-' . $group;
break;
case 2:
$tabData['id'] = $group > 0 ? 'level-' . $group : 'other';
break;
case 3:
$tabData['id'] = $group ? 'source-' . $group : 'unknown';
break;
}
$tabData['name'] = $nameSource[$group];
$tabData['tabs'] = '$tabsGroups';
}
if (!empty($this->filter['fi']['setWeights'])) {
if ($items->hasSetFields(['armor'])) {
$tabData['visibleCols'][] = 'armor';
}
}
// create note if search limit was exceeded; overwriting 'note' is intentional
if ($items->getMatches() > $maxResults && count($groups) > 1) {
$tabData['_truncated'] = 1;
$cls = isset($this->category[0]) ? '=' . $this->category[0] : '';
$override = ['gb' => ''];
if ($upg) {
$override['upg'] = implode(':', $upg);
}
switch ($grouping) {
case 1:
$override['sl'] = $group;
$tabData['note'] = '$$WH.sprintf(LANG.lvnote_viewmoreslot, \'' . $cls . '\', \'' . $this->filterObj->urlize($override) . '\')';
break;
case 2:
if ($group > 0) {
$override['minle'] = $group;
$override['maxle'] = $group;
} else {
$override['maxle'] = abs($group) - 1;
}
$tabData['note'] = '$$WH.sprintf(LANG.lvnote_viewmorelevel, \'' . $cls . '\', \'' . $this->filterObj->urlize($override) . '\')';
break;
case 3:
if ($_ = [null, 3, 4, 5, 6, 7, 9, 10, 11][$group]) {
$tabData['note'] = '$$WH.sprintf(LANG.lvnote_viewmoresource, \'' . $cls . '\', \'' . $this->filterObj->urlize($override, ['cr' => 128, 'crs' => $_, 'crv' => 0]) . '\')';
}
break;
}
} else {
if ($items->getMatches() > $maxResults) {
$tabData['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_itemsfound', $items->getMatches(), CFG_SQL_LIMIT_DEFAULT);
$tabData['_truncated'] = 1;
}
}
foreach ($tabData as $k => $p) {
if (!$p && $k != 'data') {
unset($tabData[$k]);
}
}
if ($grouping) {
$tabData['hideCount'] = 1;
}
$tabData['data'] = array_values($tabData['data']);
$this->lvTabs[] = ['item', $tabData];
}
// reformat for use in template
if (!empty($this->filter['upg'])) {
$this->filter['upg'] = implode(':', array_keys($this->filter['upg']));
}
// whoops, we have no data? create emergency content
if (empty($this->lvTabs)) {
$this->forceTabs = false;
$this->lvTabs[] = ['item', ['data' => []]];
}
// sort for dropdown-menus
Lang::sort('game', 'ra');
Lang::sort('game', 'cl');
}
示例3: generateContent
//.........这里部分代码省略.........
$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
$conditions = array(['ac.type', [ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM, ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM, ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM]], ['ac.value1', $this->typeId]);
$criteriaOf = new AchievementList($conditions);
if (!$criteriaOf->error) {
$this->extendGlobalData($criteriaOf->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_REWARDS));
$hCols = [];
if (!$criteriaOf->hasSetFields(['reward_loc0'])) {
$hCols = ['rewards'];
}
$this->lvTabs[] = array('file' => 'achievement', 'data' => $criteriaOf->getListviewData(), 'params' => ['name' => '$LANG.tab_criteriaof', 'id' => 'criteria-of', 'visibleCols' => "\$['category']", 'hiddenCols' => '$' . Util::toJSON($hCols)]);
}
// tab: reagent for
$conditions = array('OR', ['reagent1', $this->typeId], ['reagent2', $this->typeId], ['reagent3', $this->typeId], ['reagent4', $this->typeId], ['reagent5', $this->typeId], ['reagent6', $this->typeId], ['reagent7', $this->typeId], ['reagent8', $this->typeId]);
$reagent = new SpellList($conditions);
if (!$reagent->error) {
$this->extendGlobalData($reagent->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
$this->lvTabs[] = array('file' => 'spell', 'data' => $reagent->getListviewData(), 'params' => ['name' => '$LANG.tab_reagentfor', 'id' => 'reagent-for', 'visibleCols' => "\$['reagents']"]);
}
// tab: unlocks (object or item)