Spells/DetailPage

* display spells affectged by category cooldowns

Items/DetailPage
 * display items affected by category cooldowns defined in spell template
This commit is contained in:
Sarjuuk
2018-07-20 17:10:32 +02:00
parent e0150feda6
commit d32f21f9ca
2 changed files with 43 additions and 2 deletions

View File

@@ -908,11 +908,22 @@ class ItemPage extends genericPage
}
// tab: Shared cooldown
$cdCats = [];
$cdCats = [];
$useSpells = [];
for ($i = 1; $i < 6; $i++)
{
// as defined on item
if ($this->subject->getField('spellId'.$i) > 0 && $this->subject->getField('spellCategory'.$i) > 0)
$cdCats[] = $this->subject->getField('spellCategory'.$i);
// as defined in spell
if ($this->subject->getField('spellId'.$i) > 0)
$useSpells[] = $this->subject->getField('spellId'.$i);
}
if ($useSpells)
if ($_ = DB::Aowow()->selectCol('SELECT category FROM ?_spell WHERE id IN (?a) AND recoveryCategory > 0', $useSpells))
$cdCats += $_;
if ($cdCats)
{
$conditions = array(
@@ -926,6 +937,11 @@ class ItemPage extends genericPage
['spellCategory5', $cdCats],
]
);
if ($spellsByCat = DB::Aowow()->selectCol('SELECT id FROM ?_spell WHERE category IN (?a)', $cdCats))
for ($i = 1; $i < 6; $i++)
$conditions[1][] = ['spellId'.$i, $spellsByCat];
$cdItems = new ItemList($conditions);
if (!$cdItems->error)
{
@@ -939,7 +955,6 @@ class ItemPage extends genericPage
}
}
// tab: sounds
$soundIds = [];
if ($_class == ITEM_CLASS_WEAPON)

View File

@@ -512,6 +512,32 @@ class SpellPage extends GenericPage
$this->extendGlobalData($saSpells->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
}
// tab: shared cooldown
if ($this->subject->getField('recoveryCategory'))
{
$conditions = array(
['id', $this->typeId, '!'],
['category', $this->subject->getField('category')],
['recoveryCategory', 0, '>'],
);
// limit shared cooldowns to same player class for regulat users
if (!User::isInGroup(U_GROUP_STAFF) && $this->subject->getField('spellFamilyId'))
$conditions[] = ['spellFamilyId', $this->subject->getField('spellFamilyId')];
$cdSpells = new SpellList($conditions);
if (!$cdSpells->error)
{
$this->lvTabs[] = ['spell', array(
'data' => array_values($cdSpells->getListviewData()),
'name' => '$LANG.tab_sharedcooldown',
'id' => 'shared-cooldown'
)];
$this->extendGlobalData($cdSpells->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
}
}
// tab: used by - spell
if ($so = DB::Aowow()->selectCell('SELECT id FROM ?_spelloverride WHERE spellId1 = ?d OR spellId2 = ?d OR spellId3 = ?d OR spellId4 = ?d OR spellId5 = ?d', $this->subject->id, $this->subject->id, $this->subject->id, $this->subject->id, $this->subject->id))
{