From ad31501bd76ae854f029bbca6de7567e3d6a545a Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Sun, 25 Aug 2013 10:02:23 +0200 Subject: [PATCH] Spell: * added forgotten brick-file names from last commit * implemented Tab: 'Stack Rules' * implemented Tab: 'Linked with' --- includes/utilities.php | 4 +- pages/spell.php | 164 ++++++++-- template/bricks/listviews/spell.tpl | 6 + template/js/global.js | 450 +++++++++++++++++++++++----- 4 files changed, 534 insertions(+), 90 deletions(-) diff --git a/includes/utilities.php b/includes/utilities.php index 2788b48d..7fe5a542 100644 --- a/includes/utilities.php +++ b/includes/utilities.php @@ -163,12 +163,10 @@ abstract class BaseType $this->setupQuery = str_replace('[cond]', empty($sql) ? '1' : '('.implode($linking, $sql).')', $this->setupQuery); $this->setupQuery .= $limit; - $rows = DB::Aowow()->SelectPage($cnt, $this->setupQuery); + $rows = DB::Aowow()->SelectPage($this->matches, $this->setupQuery); if (!$rows) return; - $this->matches = $cnt; - foreach ($rows as $k => $tpl) $this->templates[$k] = $tpl; diff --git a/pages/spell.php b/pages/spell.php index 4e3f0f0f..4a8bbbc1 100644 --- a/pages/spell.php +++ b/pages/spell.php @@ -203,7 +203,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) ) = $spell->renderBuff(MAX_LEVEL, true); // js-globals - $spell->addGlobalsToJScript($smarty, GLOBALINFO_RELATED); + $spell->addGlobalsToJScript($smarty); // prepare Tools foreach ($pageData['page']['tools'] as $k => $tool) @@ -583,7 +583,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) * extra tabs *******/ - // modifies $this + // tab: modifies $this $sub = ['OR']; $conditions = [ ['s.typeCat', [0, -9 /*, -8*/], '!'], // uncategorized (0), GM (-9), NPC-Spell (-8); NPC includes totems, lightwell and others :/ @@ -619,6 +619,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $msH = "$['skill']"; $pageData['relTabs'][] = array( + 'file' => 'spell', 'data' => $modSpells->getListviewData(), 'params' => [ 'tabs' => '$tabsRelated', @@ -629,11 +630,11 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) ] ); - $modSpells->addGlobalddoJScript($smarty); + $modSpells->addGlobalsToJScript($smarty); } } - // modified by $this + // tab: modified by $this $sub = ['OR']; $conditions = [ ['s.spellFamilyId', $spell->getField('spellFamilyId')], @@ -670,6 +671,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $mbH = "$['skill']"; $pageData['relTabs'][] = array( + 'file' => 'spell', 'data' => $modsSpell->getListviewData(), 'params' => [ 'tabs' => '$tabsRelated', @@ -684,7 +686,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) } } - // see also + // tab: see also $conditions = array( ['s.schoolMask', $spell->getField('schoolMask')], ['s.effect1Id', $spell->getField('effect1Id')], @@ -702,6 +704,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $saH = "$['skill']"; $pageData['relTabs'][] = array( + 'file' => 'spell', 'data' => $saSpells->getListviewData(), 'params' => [ 'tabs' => '$tabsRelated', @@ -715,7 +718,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $saSpells->addGlobalsToJScript($smarty); } - // used by - itemset + // tab: used by - itemset $conditions = array( 'OR', ['spell1', $spell->id], ['spell2', $spell->id], ['spell3', $spell->id], ['spell4', $spell->id], @@ -726,6 +729,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) if (!$ubSets->error) { $pageData['relTabs'][] = array( + 'file' => 'itemset', 'data' => $ubSets->getListviewData(), 'params' => [ 'tabs' => '$tabsRelated', @@ -738,7 +742,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) } - // used by - item + // tab: used by - item $conditions = array( 'OR', // 6: learn spell ['AND', ['spelltrigger_1', 6, '!'], ['spellid_1', $spell->id]], @@ -752,6 +756,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) if (!$ubItems->error) { $pageData['relTabs'][] = array( + 'file' => 'item', 'data' => $ubItems->getListviewData(), 'params' => [ 'tabs' => '$tabsRelated', @@ -763,7 +768,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $ubItems->addGlobalsToJScript($smarty); } - // criteria of + // tab: criteria of $_ = [ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2, ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL, ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2, ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL]; if ($crs = DB::Aowow()->selectCol('SELECT refAchievement FROM ?_achievementCriteria WHERE type IN (?a) AND value1 = ?d', $_, $spell->id)) { @@ -783,7 +788,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) } } - // "contains" + // tab: contains // spell_loot_template & skill_extra_item_template $extraItem = DB::Aowow()->selectRow('SELECT * FROM skill_extra_item_template WHERE spellid = ?d', $spell->id); $spellLoot = DB::Aowow()->select('SELECT *, item as ARRAY_KEY FROM spell_loot_template WHERE entry = ?d', $spell->id); @@ -860,7 +865,137 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) ); } - // teaches + // tab: Exclusive with + $firstRank = DB::Aowow()->selectCell( // returns self or firstRank + 'SELECT IF(s1.rankId <> 1 AND s2.id, s2.id, s1.id) + FROM ?_spell s1 + LEFT JOIN ?_spell s2 + ON s1.SpellFamilyId = s2.SpelLFamilyId AND + s1.SpellFamilyFlags1 = s2.SpelLFamilyFlags1 AND + s1.SpellFamilyFlags2 = s2.SpellFamilyFlags2 AND + s1.SpellFamilyFlags3 = s2.SpellFamilyFlags3 AND + s1.name_loc0 = s2.name_loc0 AND + s2.RankId = 1 + WHERE s1.id = ?d', + $_id + ); + + if ($firstRank) { + $linkedSpells = DB::Aowow()->selectCol( // dont look too closely ..... please..? + 'SELECT IF(sg2.spell_id < 0, sg2.id, sg2.spell_id) AS ARRAY_KEY, IF(sg2.spell_id < 0, sg2.spell_id, sr.stack_rule) + FROM spell_group sg1 + JOIN spell_group sg2 + ON (sg1.id = sg2.id OR sg1.id = -sg2.spell_id) AND sg1.spell_id != sg2.spell_id + LEFT JOIN spell_group_stack_rules sr + ON sg1.id = sr.group_id + WHERE sg1.spell_id = ?d', + $firstRank + ); + if ($linkedSpells) + { + $extraSpells = []; + foreach ($linkedSpells as $k => $v) + { + if ($v > 0) + continue; + + $extraSpells += DB::Aowow()->selectCol( // recursive case (recursive and regular ids are not mixed in a group) + 'SELECT sg2.spell_id AS ARRAY_KEY, sr.stack_rule + FROM spell_group sg1 + JOIN spell_group sg2 + ON sg2.id = -sg1.spell_id AND sg2.spell_id != ?d + LEFT JOIN spell_group_stack_rules sr + ON sg1.id = sr.group_id + WHERE sg1.id = ?d', + $firstRank, + $k + ); + + unset($linkedSpells[$k]); + } + + $groups = $linkedSpells + $extraSpells; + $stacks = new SpellList(array(['s.id', array_keys($groups)])); + + if (!$stacks->error) + { + $data = $stacks->getListviewData(); + foreach ($data as $k => $d) + $data[$k]['stackRule'] = $groups[$k]; + + if (!$stacks->hasSetFields(['skillLines'])) + $sH = "$['skill']"; + + $pageData['relTabs'][] = array( + 'file' => 'spell', + 'data' => $data, + 'params' => [ + 'tabs' => '$tabsRelated', + 'id' => 'spell-group-stack', + 'name' => 'Stack Group', // todo (med): localize + 'visibleCols' => "$['stackRules']", + 'hiddenCols' => isset($sH) ? $sH : null + ] + ); + + $stacks->addGlobalsToJScript($smarty); + } + } + } + + // tab: Linked with + $rows = DB::Aowow()->select(' + SELECT spell_trigger AS `trigger`, + spell_effect AS effect, + type, + IF(ABS(spell_effect) = ?d, ABS(spell_trigger), ABS(spell_effect)) AS related + FROM spell_linked_spell + WHERE ABS(spell_effect) = ?d OR ABS(spell_trigger) = ?d', + $_id, $_id, $_id + ); + + $related = []; + foreach ($rows as $row) + $related[] = $row['related']; + + if ($related) + $linked = new SpellList(array(['s.id', $related])); + + if (isset($linked) && !$linked->error) + { + $lv = $linked->getListviewData(); + $data = []; + + foreach ($rows as $r) + { + foreach ($lv as $dk => $d) + { + if ($r['related'] == $dk) + { + $lv[$dk]['linked'] = json_encode([$r['trigger'], $r['effect'], $r['type']], JSON_NUMERIC_CHECK); + $data[] = $lv[$dk]; + break; + } + } + } + + $pageData['relTabs'][] = array( + 'file' => 'spell', + 'data' => $data, + 'params' => [ + 'tabs' => '$tabsRelated', + 'id' => 'spell-link', + 'name' => 'Linked with', // todo (med): localize + 'hiddenCols' => "$['skill', 'name']", + 'visibleCols' => "$['linkedTrigger', 'linkedEffect']" + ] + ); + + $linked->addGlobalsToJScript($smarty); + } + + + // tab: teaches // -> spell_learn_spell // -> skill_discovery_template @@ -900,16 +1035,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $spellArr['usedbynpc'] = []; - /* used by item - - - */ - - - /* NEW - is in stack-rule with X - is linked with X scaling data conditions difficulty-versions diff --git a/template/bricks/listviews/spell.tpl b/template/bricks/listviews/spell.tpl index 0bf3de6a..8a03574a 100644 --- a/template/bricks/listviews/spell.tpl +++ b/template/bricks/listviews/spell.tpl @@ -77,6 +77,12 @@ {if isset($curr.percent)} percent:{$curr.percent}, {/if} + {if isset($curr.stackRule)} + stackRule:{$curr.stackRule}, + {/if} + {if isset($curr.linked)} + linked:{$curr.linked}, + {/if} id:{$curr.id} {rdelim} {if $smarty.foreach.i.last}{else},{/if} diff --git a/template/js/global.js b/template/js/global.js index 6af75ef6..7c223084 100644 --- a/template/js/global.js +++ b/template/js/global.js @@ -4618,102 +4618,133 @@ Listview.extraCols = { id: 'condition', name: LANG.requires, compute: function(row, td) { + if (!row.condition || !row.condition.type || !row.condition.typeId) { + return ''; + } + + var cnd = Listview.extraCols.condition.getState(row.condition); + if (!cnd) { + return; + } + td.className = 'small'; td.style.lineHeight = '18px'; - if (row.condition) { - switch(g_types[row.condition.type]) { - case 'spell': - return Listview.extraCols.condition.getSpellText(row.condition, td); - case 'item': - return Listview.extraCols.condition.getItemText(row.condition, td); - case 'achievement': - return Listview.extraCols.condition.getAchievementText(row.condition, td); - case 'quest': - return Listview.extraCols.condition.getQuestText(row.condition, td); - default: - return 'unhandled condition'; - } + var span = $WH.ce('span'); + span.className = cnd.color; + $WH.ae(span, cnd.state); + $WH.ae(td, span); + $WH.ae(td, $WH.ce('br')); + + var a = $WH.ce('a'); + a.href = cnd.url; + a.className = 'icontiny tinyspecial'; + if (cnd.quality) { + a.className += ' q' + cnd.quality; + } + a.style.backgroundImage = 'url(' + g_staticUrl + '/images/icons/tiny/' + cnd.icon + '.gif)'; + a.style.whiteSpace = 'nowrap'; + $WH.st(a, cnd.name); + $WH.ae(td, a); + }, + getVisibleText: function(row) { + var buff = ''; + + if (!row.condition || !row.condition.type || !row.condition.typeId) { + return buff; + } + + var cnd = Listview.extraCols.condition.getState(row.condition); + if (!cnd) { + return buff; + } + + buff += cnd.name + ' ' + cnd.state; + + return buff; + }, + getState: function(cond) { + switch (g_types[cond.type]) { + case 'spell': + return Listview.extraCols.condition.getSpellState(cond); + case 'item': + return Listview.extraCols.condition.getItemtate(cond); + case 'achievement': + return Listview.extraCols.condition.getAchievementState(cond); + case 'quest': + return Listview.extraCols.condition.getQuestState(cond); + default: + return {}; } }, - getSpellText: function(cond, td) { + getSpellState: function(cond) { if (!cond.typeId || !g_spells[cond.typeId]) { return; } - var item = g_spells[cond.typeId]; - var span = $WH.ce('span'); - span.className = cond.status ? 'q2' : 'q10'; - $WH.ae(span, cond.status ? $WH.ct(LANG.pr_note_known) : $WH.ct(LANG.pr_note_missing)); - $WH.ae(td, span); - $WH.ae(td, $WH.ce('br')); + var + cnd = {}, + item = g_spells[cond.typeId]; - var a = $WH.ce('a'); - a.href = '?spell=' + cond.typeId; - a.className = 'icontiny tinyspecial'; - a.style.backgroundImage = 'url(' + g_staticUrl + '/images/icons/tiny/' + item.icon.toLowerCase() + '.gif)'; - a.style.whiteSpace = 'nowrap'; - $WH.ae(a, $WH.ct(item['name_' + g_locale.name])); - $WH.ae(td, a); + cnd.icon = item.icon.toLowerCase(); + cnd.state = cond.status ? $WH.ct(LANG.pr_note_known) : $WH.ct(LANG.pr_note_missing); + cnd.color = cond.status ? 'q2' : 'q10'; + cnd.name = item['name_' + g_locale.name]; + cnd.url = '?spell=' + cond.typeId; + + return cnd; }, - getItemText: function(cond, td) { + getItemState: function(cond) { if (!cond.typeId || !g_items[cond.typeId]) { return; } - var item = g_items[cond.typeId]; - var span = $WH.ce('span'); - span.className = cond.status ? 'q2' : 'q10'; - $WH.ae(span, cond.status ? $WH.ct(LANG.pr_note_earned) : $WH.ct(LANG.pr_note_missing)); - $WH.ae(td, span); - $WH.ae(td, $WH.ce('br')); + var + cnd = {}, + item = g_items[cond.typeId]; - var a = $WH.ce('a'); - a.href = '?item=' + cond.typeId; - a.className = 'icontiny tinyspecial'; - a.className += ' q' + item.quality; - a.style.backgroundImage = 'url(' + g_staticUrl + '/images/icons/tiny/' + item.icon.toLowerCase() + '.gif)'; - a.style.whiteSpace = 'nowrap'; - $WH.ae(a, $WH.ct(item['name_' + g_locale.name])); - $WH.ae(td, a); + cnd.icon = item.icon.toLowerCase(); + cnd.state = cond.status ? $WH.ct(LANG.pr_note_earned) : $WH.ct(LANG.pr_note_missing); + cnd.color = cond.status ? 'q2' : 'q10'; + cnd.name = item['name_' + g_locale.name]; + cnd.url = '?item=' + cond.typeId; + cnd.quality = item.quality; + + return cnd; }, - getAchievementText: function(cond, td) { + getAchievementState: function(cond) { if (!cond.typeId || !g_achievements[cond.typeId]) { return; } - var item = g_achievements[cond.typeId]; - var span = $WH.ce('span'); - span.className = cond.status ? 'q2' : 'q10'; - $WH.ae(span, cond.status ? $WH.ct(LANG.pr_note_earned) : $WH.ct(LANG.pr_note_incomplete)); - $WH.ae(td, span); - $WH.ae(td, $WH.ce('br')); + var + cnd = {}, + item = g_achievements[cond.typeId]; - var a = $WH.ce('a'); - a.href = '?achievement=' + cond.typeId; - a.className = 'icontiny tinyspecial'; - a.style.backgroundImage = 'url(' + g_staticUrl + '/images/icons/tiny/' + item.icon.toLowerCase() + '.gif)'; - a.style.whiteSpace = 'nowrap'; - $WH.st(a, item['name_' + g_locale.name]); - $WH.ae(td, a); + cnd.icon = item.icon.toLowerCase(); + cnd.state = cond.status ? $WH.ct(LANG.pr_note_earned) : $WH.ct(LANG.pr_note_incomplete); + cnd.color = cond.status ? 'q2' : 'q10'; + cnd.name = item['name_' + g_locale.name]; + cnd.url = '?achievement=' + cond.typeId; + + return cnd; }, - getQuestText: function(cond, td) { + getQuestState: function(cond) { if (!cond.typeId || !g_quests[cond.typeId]) { return; } - var item = g_quests[cond.typeId]; - var span = $WH.ce('span'); - span.className = cond.status == 1 ? 'q1' : cond.status == 2 ? 'q2' : 'q10'; - $WH.ae(span, cond.status == 1 ? $WH.ct(LANG.progress) : cond.status == 2 ? $WH.ct(LANG.pr_note_complete) : $WH.ct(LANG.pr_note_incomplete)); - $WH.ae(td, span); - $WH.ae(td, $WH.ce('br')); + var + cnd = {}, + item = g_quests[cond.typeId]; - var a = $WH.ce('a'); - a.href = '?quest=' + cond.typeId; - a.style.whiteSpace = 'nowrap'; - $WH.st(a, item['name_' + g_locale.name]); - $WH.ae(td, a); + cnd.icon = item.icon.toLowerCase(); + cnd.state = cond.status == 1 ? $WH.ct(LANG.progress) : cond.status == 2 ? $WH.ct(LANG.pr_note_complete) : $WH.ct(LANG.pr_note_incomplete); + cnd.color = cond.status == 1 ? 'q1' : cond.status == 2 ? 'q2' : 'q10'; + cnd.name = item['name_' + g_locale.name]; + cnd.url = '?quest=' + cond.typeId; + + return cnd; }, sortFunc: function(a, b, col) { if (a.condition.status && b.condition.status) { @@ -8730,6 +8761,289 @@ Listview.templates = { return Listview.funcBox.assocArrCmp(a.skill, b.skill, g_spell_skills); } + }, + /* sarjuuk + todo: localize he next three cols + */ + { + id: 'stackRules', + name: 'Behaviour', + type: 'text', + width: '20%', + hidden: true, + compute: function(spell, td) { + if (!spell.stackRule) { + return; + } + + var + buff = '', + buff2 = ''; + + switch (spell.stackRule) { + case 3: + buff2 = '(strongest effect is applied)'; + case 0: + buff = 'coexist'; // without condition + break; + case 2: + buff2 = '(from same caster)'; + case 1: + buff = 'exclusive'; // without condition + break; + } + + td.className = 'small'; + td.style.lineHeight = '18px'; + + var span = $WH.ce('span'); + span.className = !spell.stackRule || spell.stackRule == 3 ? 'q2' : 'q10'; + $WH.ae(span, $WH.ct(buff)); + $WH.ae(td, span); + + if (buff2) { + var sp2 = $WH.ce('span'); + sp2.style.whiteSpace = 'nowrap'; + sp2.className = 'q0'; + $WH.ae(td, $WH.ce('br')); + $WH.st(sp2, buff2); + $WH.ae(td, sp2); + } + }, + getVisibleText: function (spell) { + if (!spell.stackRule) { + return; + } + + var buff = ''; + switch (spell.stackRule) { + case 3: + buff += '(strongest effect is applied)'; + case 0: + buff += ' coexist'; + break; + case 2: + buff += '(from same caster)'; + case 1: + buff += ' exclusive'; + break; + } + + return buff; + }, + sortFunc: function(a, b, col) { + return $WH.strcmp(a.stackRule, b.stackRule); + } + }, + { + id: 'linkedTrigger', + name: 'Triggers', + type: 'text', + width: '50%', + hidden: true, + compute: function(spell, td) { + if (!spell.linked) { + return; + } + + var + trigger = spell.linked[0], + buff = ''; + + switch (spell.linked[2]) { + case 0: + buff = trigger > 0 ? 'When Spell is casted' : 'When Aura is removed'; + break; + case 1: + buff = 'When Spell hits the target(s)'; + break; + case 2: + buff = 'When Aura is applied and removed'; + break; + } + + td.className = 'small'; + td.style.lineHeight = '18px'; + + var a = $WH.ce('a'); + a.style.whiteSpace = 'nowrap'; + a.href = '?spell=' + Math.abs(trigger); + if (g_pageInfo.typeId == Math.abs(trigger)) { // ponts to self + a.className = 'q1'; + $WH.st(a, 'This'); + } + else { + var item = g_spells[Math.abs(trigger)]; + a.className = 'icontiny tinyspecial'; + a.style.backgroundImage = 'url(' + g_staticUrl + '/images/icons/tiny/' + item['icon'] + '.gif)'; + $WH.st(a, item['name_' + g_locale.name]); + } + $WH.ae(td, a); + + var span = $WH.ce('span'); + span.className = 'q0'; + $WH.st(span, buff); + $WH.ae(td, $WH.ce('br')); + $WH.ae(td, span); + + }, + getVisibleText: function (spell) { + if (!spell.linked) { + return; + } + + var + trigger = spell.linked[0], + buff = ''; + + if (g_pageInfo.typeId == Math.abs(trigger)) { + buff += 'This'; + } + else { + buff += g_spells[Math.abs(trigger)]['name_' + g_locale.name]; + } + + switch (spell.linked[2]) { + case 0: + buff += trigger > 0 ? ' When Spell is casted' : ' When Aura is removed'; + break; + case 1: + buff += ' When Spell hits the target(s)'; + break; + case 2: + buff += ' When Aura is applied and removed'; + break; + } + + return buff; + }, + sortFunc: function(a, b, col) { + var + trA = a.linked[0], + trB = b.linked[0]; + + if (trA > 0 && trB < 0) { + return -1; + } + else if (trA < 0 && trB > 0) { + return 1; + } + + if (g_pageInfo.typeId == Math.abs(trA)) { + return 1; + } + else if (g_pageInfo.typeId == Math.abs(trB)) { + return -1; + } + else if (trA != trB) { + return $WH.strcmp(g_spells[Math.abs(trA)]['name_' + g_locale.name], g_spells[Math.abs(trB)]['name_' + g_locale.name]); + } + + return 0; + } + }, + { + id: 'linkedEffect', + name: 'Effects', + type: 'text', + width: '50%', + hidden: true, + compute: function(spell, td) { + if (!spell.linked) { + return; + } + + var + effect = spell.linked[1], + buff = ''; + + switch (spell.linked[2]) { + case 0: + case 1: + buff = effect > 0 ? 'Spell is triggered' : 'Spells Auras are removed'; + break; + case 2: + buff = effect > 0 ? 'Spells Auras are applied or removed' : 'Immunity against Spell is applied or cleared '; + break; + } + + td.className = 'small'; + td.style.lineHeight = '18px'; + + var a = $WH.ce('a'); + a.style.whiteSpace = 'nowrap'; + a.href = '?spell=' + Math.abs(effect); + if (g_pageInfo.typeId == Math.abs(effect)) { // ponts to self + a.className = 'q1'; + $WH.st(a, 'This'); + } + else { + var item = g_spells[Math.abs(effect)]; + a.className = 'icontiny tinyspecial'; + a.style.backgroundImage = 'url(' + g_staticUrl + '/images/icons/tiny/' + item['icon'] + '.gif)'; + $WH.st(a, item['name_' + g_locale.name]); + } + $WH.ae(td, a); + + var span = $WH.ce('span'); + span.className = 'q0'; + $WH.st(span, buff); + $WH.ae(td, $WH.ce('br')); + $WH.ae(td, span); + + }, + getVisibleText: function (spell) { + if (!spell.linked) { + return; + } + + var + effect = spell.linked[1], + buff = ''; + + if (g_pageInfo.typeId == Math.abs(effect)) { + buff += 'This'; + } + else { + buff += g_spells[Math.abs(effect)]['name_' + g_locale.name]; + } + + switch (spell.linked[2]) { + case 0: + case 1: + buff += effect > 0 ? ' Spell is triggered' : ' Spells Auras are removed'; + break; + case 2: + buff += effect > 0 ? ' Spells Auras are applied or removed' : ' Immunity against Spell is applied or cleared '; + break; + } + + return buff; + }, + sortFunc: function(a, b, col) { + var + effA = a.linked[1], + effB = b.linked[1]; + + if (effA > 0 && effB < 0) { + return -1; + } + else if (effA < 0 && effB > 0) { + return 1; + } + + if (g_pageInfo.typeId == Math.abs(effA)) { + return 1; + } + else if (g_pageInfo.typeId == Math.abs(effB)) { + return -1; + } + else if (effA != effB) { + return $WH.strcmp(g_spells[Math.abs(effA)]['name_' + g_locale.name], g_spells[Math.abs(effB)]['name_' + g_locale.name]); + } + + return 0; + } } ],