From 4c4cde11658dc59aa96f868e50df24de19cef0c3 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Wed, 18 Nov 2015 23:39:16 +0100 Subject: [PATCH] Items/GemPerfection * use skill_perfect_item_template to display Gem Perfection procs --- includes/shared.php | 2 +- includes/types/spell.class.php | 2 +- pages/item.php | 28 ++++++++++++ pages/spell.php | 19 +++++++++ template/pages/spell.tpl.php | 78 ++++++++++++++++++++-------------- 5 files changed, 95 insertions(+), 34 deletions(-) diff --git a/includes/shared.php b/includes/shared.php index a3eba74e..f71f7d8f 100644 --- a/includes/shared.php +++ b/includes/shared.php @@ -1,6 +1,6 @@ selectCol('SELECT perfectItemType FROM skill_perfect_item_template WHERE spellId IN (?a)', $this->getFoundIDs()); foreach ($this->iterate() as &$_curTpl) { // required for globals diff --git a/pages/item.php b/pages/item.php index 4c1f142a..9369bb18 100644 --- a/pages/item.php +++ b/pages/item.php @@ -422,6 +422,34 @@ class ItemPage extends genericPage /* Extra Tabs */ /**************/ + // tab: createdBy (perfect item specific) + if ($perfItem = DB::World()->select('SELECT *, spellId AS ARRAY_KEY FROM skill_perfect_item_template WHERE perfectItemType = ?d', $this->typeId)) + { + $perfSpells = new SpellList(array(['id', array_column($perfItem, 'spellId')])); + if (!$perfSpells->error) + { + $lvData = $perfSpells->getListviewData(); + $this->extendGlobalData($perfSpells->getJSGlobals(GLOBALINFO_RELATED)); + + foreach ($lvData as $sId => &$data) + { + $data['percent'] = $perfItem[$sId]['perfectCreateChance']; + $data['condition'][0][$this->typeId] = [[[CND_SPELL, $perfItem[$sId]['requiredSpecialization']]]]; + $this->extendGlobalIDs(TYPE_SPELL, $perfItem[$sId]['requiredSpecialization']); + } + + $this->lvTabs[] = array( + 'file' => 'spell', + 'data' => $lvData, + 'params' => [ + 'name' => '$LANG.tab_createdby', + 'id' => 'created-by', // should by exclusive with created-by from spell_loot + 'extraCols' => '$[Listview.extraCols.percent, Listview.extraCols.condition]' + ] + ); + } + } + // tabs: this item is contained in.. $lootTabs = new Loot(); $createdBy = []; diff --git a/pages/spell.php b/pages/spell.php index 8e0d16dd..af7c182e 100644 --- a/pages/spell.php +++ b/pages/spell.php @@ -1546,6 +1546,7 @@ class SpellPage extends GenericPage $effects = []; $spellIdx = array_unique(array_merge($this->subject->canTriggerSpell(), $this->subject->canTeachSpell())); $itemIdx = $this->subject->canCreateItem(); + $perfItem = DB::World()->selectRow('SELECT * FROM skill_perfect_item_template WHERE spellId = ?d', $this->typeId); // Iterate through all effects: for ($i = 1; $i < 4; $i++) @@ -1582,6 +1583,24 @@ class SpellPage extends GenericPage break; } + // perfect Items + if ($perfItem && $this->subject->relItems->getEntry($perfItem['perfectItemType'])) + { + $cndSpell = new SpellList(array(['id', $perfItem['requiredSpecialization']])); + if (!$cndSpell->error) + { + $foo['perfItem'] = array( + 'icon' => $cndSpell->getField('iconString'), + 'quality' => $this->subject->relItems->getField('quality'), + 'cndSpellId' => $perfItem['requiredSpecialization'], + 'cndSpellName' => $cndSpell->getField('name', true), + 'chance' => $perfItem['perfectCreateChance'], + 'itemId' => $perfItem['perfectItemType'], + 'itemName' => $this->subject->relItems->getField('name', true) + ); + } + } + if ($effDS > 1) $foo['icon']['count'] = "'".($effBP + 1).'-'.$foo['icon']['count']."'"; } diff --git a/template/pages/spell.tpl.php b/template/pages/spell.tpl.php index 6a7b73eb..a93f76cc 100644 --- a/template/pages/spell.tpl.php +++ b/template/pages/spell.tpl.php @@ -16,7 +16,7 @@ brick('redButtons'); ?> -

name; ?>

+

name; ?>

brick('tooltip'); @@ -35,7 +35,7 @@ if ($this->reagents[1]): echo "
\n"; endif; ?> -

+

tools as $i => $t): @@ -69,7 +69,7 @@ if (!empty($this->transfer)): endif; ?> -

+

@@ -85,54 +85,54 @@ endif; - - + + - - + + - - + + - - + + - - + +
duration) ? $this->duration : ''.Lang::main('n_a').''; ?>duration) ? $this->duration : ''.Lang::main('n_a').'');?>
school[1]) ? (User::isInGroup(U_GROUP_STAFF) ? sprintf(Util::$dfnString, $this->school[0], $this->school[1]) : $this->school[1]) : ''.Lang::main('n_a').''; ?>school[1]) ? (User::isInGroup(U_GROUP_STAFF) ? sprintf(Util::$dfnString, $this->school[0], $this->school[1]) : $this->school[1]) : ''.Lang::main('n_a').'');?>
mechanic) ? $this->mechanic : ''.Lang::main('n_a').''; ?>mechanic) ? $this->mechanic : ''.Lang::main('n_a').'');?>
dispel) ? $this->dispel : ''.Lang::main('n_a').''; ?>dispel) ? $this->dispel : ''.Lang::main('n_a').'');?>
gcdCat) ? $this->gcdCat : ''.Lang::main('n_a').''; ?>gcdCat) ? $this->gcdCat : ''.Lang::main('n_a').'');?>
- - powerCost) ? $this->powerCost : Lang::spell('_none'); ?> + + powerCost) ? $this->powerCost : Lang::spell('_none'));?> - - range.' '.Lang::spell('_distUnit').' ('.$this->rangeName; ?>) + + range.' '.Lang::spell('_distUnit').' ('.$this->rangeName;?>) - - castTime; ?> + + castTime;?> - - cooldown) ? $this->cooldown : ''.Lang::main('n_a').''; ?> + + cooldown) ? $this->cooldown : ''.Lang::main('n_a').'');?> - '.Lang::spell('_gcd'); ?> - gcd; ?> + '.Lang::spell('_gcd');?> + gcd;?> scaling), [[-1, -1, 0, 0], [0, 0, 0, 0]])): ?> - + stances)): ?> - - stances; ?> + + stances;?> items)): ?> - - items[0]), $this->items[1]) : $this->items[1]; ?> + + items[0]), $this->items[1]) : $this->items[1]);?> effects as $i => $e): ?> - + ' . @@ -200,7 +201,7 @@ foreach ($this->effects as $i => $e): ?> - + '.$e['icon']['name']."\n"; @@ -212,8 +213,21 @@ foreach ($this->effects as $i => $e):
+ + + +
+ + + @@ -224,7 +238,7 @@ endforeach; ?> -

+