mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Spells/Reagents
* always check all reagent fields, they are not set first to last
This commit is contained in:
@@ -461,17 +461,20 @@ abstract class BaseType
|
|||||||
|
|
||||||
trait listviewHelper
|
trait listviewHelper
|
||||||
{
|
{
|
||||||
public function hasSetFields($fields)
|
public function hasSetFields(?string ...$fields) : int
|
||||||
{
|
{
|
||||||
if (!is_array($fields))
|
|
||||||
return 0x0;
|
|
||||||
|
|
||||||
$result = 0x0;
|
$result = 0x0;
|
||||||
|
|
||||||
foreach ($this->iterate() as $__)
|
foreach ($this->iterate() as $__)
|
||||||
{
|
{
|
||||||
foreach ($fields as $k => $str)
|
foreach ($fields as $k => $str)
|
||||||
{
|
{
|
||||||
|
if (!$str)
|
||||||
|
{
|
||||||
|
unset($fields[$k]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->getField($str))
|
if ($this->getField($str))
|
||||||
{
|
{
|
||||||
$result |= 1 << $k;
|
$result |= 1 << $k;
|
||||||
@@ -489,11 +492,8 @@ trait listviewHelper
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hasDiffFields($fields)
|
public function hasDiffFields(?string ...$fields) : int
|
||||||
{
|
{
|
||||||
if (!is_array($fields))
|
|
||||||
return 0x0;
|
|
||||||
|
|
||||||
$base = [];
|
$base = [];
|
||||||
$result = 0x0;
|
$result = 0x0;
|
||||||
|
|
||||||
@@ -504,6 +504,12 @@ trait listviewHelper
|
|||||||
{
|
{
|
||||||
foreach ($fields as $k => $str)
|
foreach ($fields as $k => $str)
|
||||||
{
|
{
|
||||||
|
if (!$str)
|
||||||
|
{
|
||||||
|
unset($fields[$k]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if ($base[$str] != $this->getField($str))
|
if ($base[$str] != $this->getField($str))
|
||||||
{
|
{
|
||||||
$result |= 1 << $k;
|
$result |= 1 << $k;
|
||||||
|
|||||||
@@ -574,7 +574,7 @@ class Loot
|
|||||||
if (!empty($result))
|
if (!empty($result))
|
||||||
$tabsFinal[16][4][] = '$Listview.extraCols.percent';
|
$tabsFinal[16][4][] = '$Listview.extraCols.percent';
|
||||||
|
|
||||||
if ($srcObj->hasSetFields(['reagent1']))
|
if ($srcObj->hasSetFields('reagent1', 'reagent2', 'reagent3', 'reagent4', 'reagent5', 'reagent6', 'reagent7', 'reagent8'))
|
||||||
$tabsFinal[16][6][] = 'reagents';
|
$tabsFinal[16][6][] = 'reagents';
|
||||||
|
|
||||||
foreach ($srcObj->iterate() as $_)
|
foreach ($srcObj->iterate() as $_)
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ class AchievementsPage extends GenericPage
|
|||||||
$this->extendGlobalData($acvList->getJSGlobals());
|
$this->extendGlobalData($acvList->getJSGlobals());
|
||||||
|
|
||||||
// if we are have different cats display field
|
// if we are have different cats display field
|
||||||
if ($acvList->hasDiffFields(['category']))
|
if ($acvList->hasDiffFields('category'))
|
||||||
$tabData['visibleCols'] = ['category'];
|
$tabData['visibleCols'] = ['category'];
|
||||||
|
|
||||||
if (!empty($this->filter['fi']['extraCols']))
|
if (!empty($this->filter['fi']['extraCols']))
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ class ArenaTeamsPage extends GenericPage
|
|||||||
{
|
{
|
||||||
$teams->initializeLocalEntries();
|
$teams->initializeLocalEntries();
|
||||||
|
|
||||||
$dFields = $teams->hasDiffFields(['faction', 'type']);
|
$dFields = $teams->hasDiffFields('faction', 'type');
|
||||||
if (!($dFields & 0x1))
|
if (!($dFields & 0x1))
|
||||||
$tabData['hiddenCols'][] = 'faction';
|
$tabData['hiddenCols'][] = 'faction';
|
||||||
|
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ class ClassPage extends GenericPage
|
|||||||
$this->extendGlobalData($items->getJSGlobals());
|
$this->extendGlobalData($items->getJSGlobals());
|
||||||
|
|
||||||
$hiddenCols = null;
|
$hiddenCols = null;
|
||||||
if ($items->hasDiffFields(['requiredRace']))
|
if ($items->hasDiffFields('requiredRace'))
|
||||||
$hiddenCols = ['side'];
|
$hiddenCols = ['side'];
|
||||||
|
|
||||||
$this->lvTabs[] = [ItemList::$brickFile, array(
|
$this->lvTabs[] = [ItemList::$brickFile, array(
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ class CurrencyPage extends GenericPage
|
|||||||
'id' => 'created-by',
|
'id' => 'created-by',
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($createdBy->hasSetFields(['reagent1']))
|
if ($createdBy->hasSetFields('reagent1', 'reagent2', 'reagent3', 'reagent4', 'reagent5', 'reagent6', 'reagent7', 'reagent8'))
|
||||||
$tabData['visibleCols'] = ['reagents'];
|
$tabData['visibleCols'] = ['reagents'];
|
||||||
|
|
||||||
$this->lvTabs[] = [SpellList::$brickFile, $tabData];
|
$this->lvTabs[] = [SpellList::$brickFile, $tabData];
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ class EnchantmentsPage extends GenericPage
|
|||||||
if (array_filter(array_column($tabData['data'], 'spells')))
|
if (array_filter(array_column($tabData['data'], 'spells')))
|
||||||
$tabData['visibleCols'] = ['trigger'];
|
$tabData['visibleCols'] = ['trigger'];
|
||||||
|
|
||||||
if (!$ench->hasSetFields(['skillLine']))
|
if (!$ench->hasSetFields('skillLine'))
|
||||||
$tabData['hiddenCols'] = ['skill'];
|
$tabData['hiddenCols'] = ['skill'];
|
||||||
|
|
||||||
if ($this->filterObj->error)
|
if ($this->filterObj->error)
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ class GuildsPage extends GenericPage
|
|||||||
{
|
{
|
||||||
$guilds->initializeLocalEntries();
|
$guilds->initializeLocalEntries();
|
||||||
|
|
||||||
$dFields = $guilds->hasDiffFields(['faction', 'type']);
|
$dFields = $guilds->hasDiffFields('faction', 'type');
|
||||||
if (!($dFields & 0x1))
|
if (!($dFields & 0x1))
|
||||||
$tabData['hiddenCols'][] = 'faction';
|
$tabData['hiddenCols'][] = 'faction';
|
||||||
|
|
||||||
|
|||||||
@@ -571,7 +571,7 @@ class ItemPage extends genericPage
|
|||||||
$this->extendGlobalData($contains->getJSGlobals(GLOBALINFO_SELF));
|
$this->extendGlobalData($contains->getJSGlobals(GLOBALINFO_SELF));
|
||||||
|
|
||||||
$hCols = ['side'];
|
$hCols = ['side'];
|
||||||
if (!$contains->hasSetFields(['slot']))
|
if (!$contains->hasSetFields('slot'))
|
||||||
$hCols[] = 'slot';
|
$hCols[] = 'slot';
|
||||||
|
|
||||||
$this->lvTabs[] = [ItemList::$brickFile, array(
|
$this->lvTabs[] = [ItemList::$brickFile, array(
|
||||||
@@ -618,7 +618,7 @@ class ItemPage extends genericPage
|
|||||||
'visibleCols' => ['category']
|
'visibleCols' => ['category']
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!$criteriaOf->hasSetFields(['reward_loc0']))
|
if (!$criteriaOf->hasSetFields('reward_loc0'))
|
||||||
$tabData['hiddenCols'] = ['rewards'];
|
$tabData['hiddenCols'] = ['rewards'];
|
||||||
|
|
||||||
$this->lvTabs[] = [AchievementList::$brickFile, $tabData];
|
$this->lvTabs[] = [AchievementList::$brickFile, $tabData];
|
||||||
@@ -927,7 +927,7 @@ class ItemPage extends genericPage
|
|||||||
$this->extendGlobalData($taughtSpells->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
|
$this->extendGlobalData($taughtSpells->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
|
||||||
|
|
||||||
$visCols = ['level', 'schools'];
|
$visCols = ['level', 'schools'];
|
||||||
if ($taughtSpells->hasSetFields(['reagent1']))
|
if ($taughtSpells->hasSetFields('reagent1', 'reagent2', 'reagent3', 'reagent4', 'reagent5', 'reagent6', 'reagent7', 'reagent8'))
|
||||||
$visCols[] = 'reagents';
|
$visCols[] = 'reagents';
|
||||||
|
|
||||||
$this->lvTabs[] = [SpellList::$brickFile, array(
|
$this->lvTabs[] = [SpellList::$brickFile, array(
|
||||||
|
|||||||
@@ -370,7 +370,7 @@ class ItemsPage extends GenericPage
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($this->filterObj->getSetWeights()))
|
if (!empty($this->filterObj->getSetWeights()))
|
||||||
if ($items->hasSetFields(['armor']))
|
if ($items->hasSetFields('armor'))
|
||||||
$tabData['visibleCols'][] = 'armor';
|
$tabData['visibleCols'][] = 'armor';
|
||||||
|
|
||||||
// create note if search limit was exceeded; overwriting 'note' is intentional
|
// create note if search limit was exceeded; overwriting 'note' is intentional
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ class ItemsetPage extends GenericPage
|
|||||||
'name' => '$LANG.tab_seealso'
|
'name' => '$LANG.tab_seealso'
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!$relSets->hasDiffFields(['classMask']))
|
if (!$relSets->hasDiffFields('classMask'))
|
||||||
$tabData['hiddenCols'] = ['classes'];
|
$tabData['hiddenCols'] = ['classes'];
|
||||||
|
|
||||||
$this->lvTabs[] = [ItemsetList::$brickFile, $tabData];
|
$this->lvTabs[] = [ItemsetList::$brickFile, $tabData];
|
||||||
|
|||||||
@@ -639,7 +639,7 @@ class NpcPage extends GenericPage
|
|||||||
{
|
{
|
||||||
$colAddIn = null;
|
$colAddIn = null;
|
||||||
$extraCols = ["\$Listview.funcBox.createSimpleCol('stack', 'stack', '10%', 'stack')", '$Listview.extraCols.cost'];
|
$extraCols = ["\$Listview.funcBox.createSimpleCol('stack', 'stack', '10%', 'stack')", '$Listview.extraCols.cost'];
|
||||||
if ($soldItems->hasSetFields(['condition']))
|
if ($soldItems->hasSetFields('condition'))
|
||||||
$extraCols[] = '$Listview.extraCols.condition';
|
$extraCols[] = '$Listview.extraCols.condition';
|
||||||
|
|
||||||
$lvData = $soldItems->getListviewData(ITEMINFO_VENDOR, [Type::NPC => [$this->typeId]]);
|
$lvData = $soldItems->getListviewData(ITEMINFO_VENDOR, [Type::NPC => [$this->typeId]]);
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ class ObjectsPage extends GenericPage
|
|||||||
if (!$objects->error)
|
if (!$objects->error)
|
||||||
{
|
{
|
||||||
$tabData['data'] = array_values($objects->getListviewData());
|
$tabData['data'] = array_values($objects->getListviewData());
|
||||||
if ($objects->hasSetFields(['reqSkill']))
|
if ($objects->hasSetFields('reqSkill'))
|
||||||
$tabData['visibleCols'] = ['skill'];
|
$tabData['visibleCols'] = ['skill'];
|
||||||
|
|
||||||
// create note if search limit was exceeded
|
// create note if search limit was exceeded
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class PetsPage extends GenericPage
|
|||||||
'computeDataFunc' => '$_'
|
'computeDataFunc' => '$_'
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!$pets->hasDiffFields(['type']))
|
if (!$pets->hasDiffFields('type'))
|
||||||
$data['hiddenCols'] = ['type'];
|
$data['hiddenCols'] = ['type'];
|
||||||
};
|
};
|
||||||
$this->lvTabs[] = [PetList::$brickFile, $data, 'petFoodCol'];
|
$this->lvTabs[] = [PetList::$brickFile, $data, 'petFoodCol'];
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ class ProfilesPage extends GenericPage
|
|||||||
|
|
||||||
// init roster-listview
|
// init roster-listview
|
||||||
// $_GET['roster'] = 1|2|3|4 originally supplemented this somehow .. 2,3,4 arenateam-size (4 => 5-man), 1 guild
|
// $_GET['roster'] = 1|2|3|4 originally supplemented this somehow .. 2,3,4 arenateam-size (4 => 5-man), 1 guild
|
||||||
if ($this->roster == 1 && !$profiles->hasDiffFields(['guild']) && $profiles->getField('guild'))
|
if ($this->roster == 1 && !$profiles->hasDiffFields('guild') && $profiles->getField('guild'))
|
||||||
{
|
{
|
||||||
$tabData['roster'] = $this->roster;
|
$tabData['roster'] = $this->roster;
|
||||||
$tabData['visibleCols'][] = 'guildrank';
|
$tabData['visibleCols'][] = 'guildrank';
|
||||||
@@ -148,7 +148,7 @@ class ProfilesPage extends GenericPage
|
|||||||
|
|
||||||
$this->roster = Lang::profiler('guildRoster', [$profiles->getField('guildname')]);
|
$this->roster = Lang::profiler('guildRoster', [$profiles->getField('guildname')]);
|
||||||
}
|
}
|
||||||
else if ($this->roster && !$profiles->hasDiffFields(['arenateam']) && $profiles->getField('arenateam'))
|
else if ($this->roster && !$profiles->hasDiffFields('arenateam') && $profiles->getField('arenateam'))
|
||||||
{
|
{
|
||||||
$tabData['roster'] = $this->roster;
|
$tabData['roster'] = $this->roster;
|
||||||
$tabData['visibleCols'][] = 'rating';
|
$tabData['visibleCols'][] = 'rating';
|
||||||
|
|||||||
@@ -647,7 +647,7 @@ class SearchPage extends GenericPage
|
|||||||
}
|
}
|
||||||
|
|
||||||
$vis = ['level', 'schools'];
|
$vis = ['level', 'schools'];
|
||||||
if ($abilities->hasSetFields(['reagent1']))
|
if ($abilities->hasSetFields('reagent1', 'reagent2', 'reagent3', 'reagent4', 'reagent5', 'reagent6', 'reagent7', 'reagent8'))
|
||||||
$vis[] = 'reagents';
|
$vis[] = 'reagents';
|
||||||
|
|
||||||
$vis[] = $multiClass > 1 ? 'classes' : 'singleclass';
|
$vis[] = $multiClass > 1 ? 'classes' : 'singleclass';
|
||||||
@@ -700,7 +700,7 @@ class SearchPage extends GenericPage
|
|||||||
$this->extendGlobalData($talents->getJSGlobals());
|
$this->extendGlobalData($talents->getJSGlobals());
|
||||||
|
|
||||||
$vis = ['level', 'singleclass', 'schools'];
|
$vis = ['level', 'singleclass', 'schools'];
|
||||||
if ($talents->hasSetFields(['reagent1']))
|
if ($talents->hasSetFields('reagent1', 'reagent2', 'reagent3', 'reagent4', 'reagent5', 'reagent6', 'reagent7', 'reagent8'))
|
||||||
$vis[] = 'reagents';
|
$vis[] = 'reagents';
|
||||||
|
|
||||||
$osInfo = [Type::SPELL, ' (Talent)', $talents->getMatches(), [], []];
|
$osInfo = [Type::SPELL, ' (Talent)', $talents->getMatches(), [], []];
|
||||||
@@ -1353,7 +1353,7 @@ class SearchPage extends GenericPage
|
|||||||
if (array_filter(array_column($result['data'], 'spells')))
|
if (array_filter(array_column($result['data'], 'spells')))
|
||||||
$result['visibleCols'] = ['trigger'];
|
$result['visibleCols'] = ['trigger'];
|
||||||
|
|
||||||
if (!$enchantment->hasSetFields(['skillLine']))
|
if (!$enchantment->hasSetFields('skillLine'))
|
||||||
$result['hiddenCols'] = ['skill'];
|
$result['hiddenCols'] = ['skill'];
|
||||||
|
|
||||||
if ($enchantment->getMatches() > $this->maxResults)
|
if ($enchantment->getMatches() > $this->maxResults)
|
||||||
|
|||||||
@@ -374,7 +374,7 @@ class SpellPage extends GenericPage
|
|||||||
'visibleCols' => ['level'],
|
'visibleCols' => ['level'],
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!$abilities->hasSetFields(['skillLines']))
|
if (!$abilities->hasSetFields('skillLines'))
|
||||||
$tabData['hiddenCols'] = ['skill'];
|
$tabData['hiddenCols'] = ['skill'];
|
||||||
|
|
||||||
$this->lvTabs[] = [SpellList::$brickFile, $tabData];
|
$this->lvTabs[] = [SpellList::$brickFile, $tabData];
|
||||||
@@ -432,7 +432,7 @@ class SpellPage extends GenericPage
|
|||||||
}
|
}
|
||||||
|
|
||||||
$modifiesData += $modSpells->getListviewData();
|
$modifiesData += $modSpells->getListviewData();
|
||||||
if ($modSpells->hasSetFields(['skillLines']))
|
if ($modSpells->hasSetFields('skillLines'))
|
||||||
$hideSkillCol = false;
|
$hideSkillCol = false;
|
||||||
|
|
||||||
$this->extendGlobalData($modSpells->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
|
$this->extendGlobalData($modSpells->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
|
||||||
@@ -500,7 +500,7 @@ class SpellPage extends GenericPage
|
|||||||
'visibleCols' => ['level'],
|
'visibleCols' => ['level'],
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!$modsSpell->hasSetFields(['skillLines']))
|
if (!$modsSpell->hasSetFields('skillLines'))
|
||||||
$tabData['hiddenCols'] = ['skill'];
|
$tabData['hiddenCols'] = ['skill'];
|
||||||
|
|
||||||
$this->lvTabs[] = [SpellList::$brickFile, $tabData];
|
$this->lvTabs[] = [SpellList::$brickFile, $tabData];
|
||||||
@@ -562,7 +562,7 @@ class SpellPage extends GenericPage
|
|||||||
'visibleCols' => ['level'],
|
'visibleCols' => ['level'],
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!$saSpells->hasSetFields(['skillLines']))
|
if (!$saSpells->hasSetFields('skillLines'))
|
||||||
$tabData['hiddenCols'] = ['skill'];
|
$tabData['hiddenCols'] = ['skill'];
|
||||||
|
|
||||||
if (isset($saE))
|
if (isset($saE))
|
||||||
@@ -812,7 +812,7 @@ class SpellPage extends GenericPage
|
|||||||
foreach ($data as $k => $d)
|
foreach ($data as $k => $d)
|
||||||
$data[$k]['stackRule'] = $groups[$k];
|
$data[$k]['stackRule'] = $groups[$k];
|
||||||
|
|
||||||
if (!$stacks->hasSetFields(['skillLines']))
|
if (!$stacks->hasSetFields('skillLines'))
|
||||||
$sH = ['skill'];
|
$sH = ['skill'];
|
||||||
|
|
||||||
$tabData = array(
|
$tabData = array(
|
||||||
@@ -1100,7 +1100,7 @@ class SpellPage extends GenericPage
|
|||||||
'visibleCols' => $vis,
|
'visibleCols' => $vis,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!$teaches->hasSetFields(['skillLines']))
|
if (!$teaches->hasSetFields('skillLines'))
|
||||||
$tabData['hiddenCols'] = ['skill'];
|
$tabData['hiddenCols'] = ['skill'];
|
||||||
|
|
||||||
$this->lvTabs[] = [SpellList::$brickFile, $tabData];
|
$this->lvTabs[] = [SpellList::$brickFile, $tabData];
|
||||||
|
|||||||
@@ -446,15 +446,15 @@ class SpellsPage extends GenericPage
|
|||||||
$tabData['_errors'] = 1;
|
$tabData['_errors'] = 1;
|
||||||
|
|
||||||
|
|
||||||
$mask = $spells->hasSetFields(['reagent1', 'skillLines', 'trainingCost', 'reqClassMask']);
|
$mask = $spells->hasSetFields('skillLines', 'trainingCost', 'reqClassMask', null, 'reagent1', 'reagent2', 'reagent3', 'reagent4', 'reagent5', 'reagent6', 'reagent7', 'reagent8');
|
||||||
if ($mask & 0x1)
|
if (!($mask & 0x1) && $this->category && !in_array($this->category[0], [9, 11]))
|
||||||
$visibleCols[] = 'reagents';
|
|
||||||
if (!($mask & 0x2) && $this->category && !in_array($this->category[0], [9, 11]))
|
|
||||||
$hiddenCols[] = 'skill';
|
$hiddenCols[] = 'skill';
|
||||||
if ($mask & 0x4)
|
if ($mask & 0x2)
|
||||||
$visibleCols[] = 'trainingcost';
|
$visibleCols[] = 'trainingcost';
|
||||||
if (($mask & 0x8) && !in_array('singleclass', $visibleCols))
|
if (($mask & 0x4) && !in_array('singleclass', $visibleCols))
|
||||||
$visibleCols[] = 'classes';
|
$visibleCols[] = 'classes';
|
||||||
|
if ($mask & 0xFF0)
|
||||||
|
$visibleCols[] = 'reagents';
|
||||||
|
|
||||||
|
|
||||||
if ($visibleCols)
|
if ($visibleCols)
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class TitlesPage extends GenericPage
|
|||||||
{
|
{
|
||||||
$tabData['data'] = array_values($titles->getListviewData());
|
$tabData['data'] = array_values($titles->getListviewData());
|
||||||
|
|
||||||
if ($titles->hasDiffFields(['category']))
|
if ($titles->hasDiffFields('category'))
|
||||||
$tabData['visibleCols'] = ['category'];
|
$tabData['visibleCols'] = ['category'];
|
||||||
|
|
||||||
if (!$titles->hasAnySource())
|
if (!$titles->hasAnySource())
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ class ZonesPage extends GenericPage
|
|||||||
|
|
||||||
$zones = new ZoneList($conditions);
|
$zones = new ZoneList($conditions);
|
||||||
|
|
||||||
if (!$zones->hasSetFields(['type']))
|
if (!$zones->hasSetFields('type'))
|
||||||
$hiddenCols[] = 'instancetype';
|
$hiddenCols[] = 'instancetype';
|
||||||
|
|
||||||
$tabData = ['data' => array_values($zones->getListviewData())];
|
$tabData = ['data' => array_values($zones->getListviewData())];
|
||||||
|
|||||||
Reference in New Issue
Block a user