* added forgotten brick-file names from last commit
* implemented Tab: 'Stack Rules'
* implemented Tab: 'Linked with'
This commit is contained in:
Sarjuuk
2013-08-25 10:02:23 +02:00
parent d45b972d14
commit ad31501bd7
4 changed files with 534 additions and 90 deletions

View File

@@ -163,12 +163,10 @@ abstract class BaseType
$this->setupQuery = str_replace('[cond]', empty($sql) ? '1' : '('.implode($linking, $sql).')', $this->setupQuery); $this->setupQuery = str_replace('[cond]', empty($sql) ? '1' : '('.implode($linking, $sql).')', $this->setupQuery);
$this->setupQuery .= $limit; $this->setupQuery .= $limit;
$rows = DB::Aowow()->SelectPage($cnt, $this->setupQuery); $rows = DB::Aowow()->SelectPage($this->matches, $this->setupQuery);
if (!$rows) if (!$rows)
return; return;
$this->matches = $cnt;
foreach ($rows as $k => $tpl) foreach ($rows as $k => $tpl)
$this->templates[$k] = $tpl; $this->templates[$k] = $tpl;

View File

@@ -203,7 +203,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
) = $spell->renderBuff(MAX_LEVEL, true); ) = $spell->renderBuff(MAX_LEVEL, true);
// js-globals // js-globals
$spell->addGlobalsToJScript($smarty, GLOBALINFO_RELATED); $spell->addGlobalsToJScript($smarty);
// prepare Tools // prepare Tools
foreach ($pageData['page']['tools'] as $k => $tool) foreach ($pageData['page']['tools'] as $k => $tool)
@@ -583,7 +583,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
* extra tabs * extra tabs
*******/ *******/
// modifies $this // tab: modifies $this
$sub = ['OR']; $sub = ['OR'];
$conditions = [ $conditions = [
['s.typeCat', [0, -9 /*, -8*/], '!'], // uncategorized (0), GM (-9), NPC-Spell (-8); NPC includes totems, lightwell and others :/ ['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']"; $msH = "$['skill']";
$pageData['relTabs'][] = array( $pageData['relTabs'][] = array(
'file' => 'spell',
'data' => $modSpells->getListviewData(), 'data' => $modSpells->getListviewData(),
'params' => [ 'params' => [
'tabs' => '$tabsRelated', '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']; $sub = ['OR'];
$conditions = [ $conditions = [
['s.spellFamilyId', $spell->getField('spellFamilyId')], ['s.spellFamilyId', $spell->getField('spellFamilyId')],
@@ -670,6 +671,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
$mbH = "$['skill']"; $mbH = "$['skill']";
$pageData['relTabs'][] = array( $pageData['relTabs'][] = array(
'file' => 'spell',
'data' => $modsSpell->getListviewData(), 'data' => $modsSpell->getListviewData(),
'params' => [ 'params' => [
'tabs' => '$tabsRelated', 'tabs' => '$tabsRelated',
@@ -684,7 +686,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
} }
} }
// see also // tab: see also
$conditions = array( $conditions = array(
['s.schoolMask', $spell->getField('schoolMask')], ['s.schoolMask', $spell->getField('schoolMask')],
['s.effect1Id', $spell->getField('effect1Id')], ['s.effect1Id', $spell->getField('effect1Id')],
@@ -702,6 +704,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
$saH = "$['skill']"; $saH = "$['skill']";
$pageData['relTabs'][] = array( $pageData['relTabs'][] = array(
'file' => 'spell',
'data' => $saSpells->getListviewData(), 'data' => $saSpells->getListviewData(),
'params' => [ 'params' => [
'tabs' => '$tabsRelated', 'tabs' => '$tabsRelated',
@@ -715,7 +718,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
$saSpells->addGlobalsToJScript($smarty); $saSpells->addGlobalsToJScript($smarty);
} }
// used by - itemset // tab: used by - itemset
$conditions = array( $conditions = array(
'OR', 'OR',
['spell1', $spell->id], ['spell2', $spell->id], ['spell3', $spell->id], ['spell4', $spell->id], ['spell1', $spell->id], ['spell2', $spell->id], ['spell3', $spell->id], ['spell4', $spell->id],
@@ -726,6 +729,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
if (!$ubSets->error) if (!$ubSets->error)
{ {
$pageData['relTabs'][] = array( $pageData['relTabs'][] = array(
'file' => 'itemset',
'data' => $ubSets->getListviewData(), 'data' => $ubSets->getListviewData(),
'params' => [ 'params' => [
'tabs' => '$tabsRelated', 'tabs' => '$tabsRelated',
@@ -738,7 +742,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
} }
// used by - item // tab: used by - item
$conditions = array( $conditions = array(
'OR', // 6: learn spell 'OR', // 6: learn spell
['AND', ['spelltrigger_1', 6, '!'], ['spellid_1', $spell->id]], ['AND', ['spelltrigger_1', 6, '!'], ['spellid_1', $spell->id]],
@@ -752,6 +756,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
if (!$ubItems->error) if (!$ubItems->error)
{ {
$pageData['relTabs'][] = array( $pageData['relTabs'][] = array(
'file' => 'item',
'data' => $ubItems->getListviewData(), 'data' => $ubItems->getListviewData(),
'params' => [ 'params' => [
'tabs' => '$tabsRelated', 'tabs' => '$tabsRelated',
@@ -763,7 +768,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
$ubItems->addGlobalsToJScript($smarty); $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]; $_ = [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)) 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 // spell_loot_template & skill_extra_item_template
$extraItem = DB::Aowow()->selectRow('SELECT * FROM skill_extra_item_template WHERE spellid = ?d', $spell->id); $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); $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 // -> spell_learn_spell
// -> skill_discovery_template // -> skill_discovery_template
@@ -900,16 +1035,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
$spellArr['usedbynpc'] = []; $spellArr['usedbynpc'] = [];
/* used by item
*/
/* NEW /* NEW
is in stack-rule with X
is linked with X
scaling data scaling data
conditions conditions
difficulty-versions difficulty-versions

View File

@@ -77,6 +77,12 @@
{if isset($curr.percent)} {if isset($curr.percent)}
percent:{$curr.percent}, percent:{$curr.percent},
{/if} {/if}
{if isset($curr.stackRule)}
stackRule:{$curr.stackRule},
{/if}
{if isset($curr.linked)}
linked:{$curr.linked},
{/if}
id:{$curr.id} id:{$curr.id}
{rdelim} {rdelim}
{if $smarty.foreach.i.last}{else},{/if} {if $smarty.foreach.i.last}{else},{/if}

View File

@@ -4618,102 +4618,133 @@ Listview.extraCols = {
id: 'condition', id: 'condition',
name: LANG.requires, name: LANG.requires,
compute: function(row, td) { 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.className = 'small';
td.style.lineHeight = '18px'; td.style.lineHeight = '18px';
if (row.condition) { var span = $WH.ce('span');
switch(g_types[row.condition.type]) { span.className = cnd.color;
case 'spell': $WH.ae(span, cnd.state);
return Listview.extraCols.condition.getSpellText(row.condition, td); $WH.ae(td, span);
case 'item': $WH.ae(td, $WH.ce('br'));
return Listview.extraCols.condition.getItemText(row.condition, td);
case 'achievement': var a = $WH.ce('a');
return Listview.extraCols.condition.getAchievementText(row.condition, td); a.href = cnd.url;
case 'quest': a.className = 'icontiny tinyspecial';
return Listview.extraCols.condition.getQuestText(row.condition, td); if (cnd.quality) {
default: a.className += ' q' + cnd.quality;
return 'unhandled condition'; }
} 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]) { if (!cond.typeId || !g_spells[cond.typeId]) {
return; return;
} }
var item = g_spells[cond.typeId]; var
var span = $WH.ce('span'); cnd = {},
span.className = cond.status ? 'q2' : 'q10'; item = g_spells[cond.typeId];
$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 a = $WH.ce('a'); cnd.icon = item.icon.toLowerCase();
a.href = '?spell=' + cond.typeId; cnd.state = cond.status ? $WH.ct(LANG.pr_note_known) : $WH.ct(LANG.pr_note_missing);
a.className = 'icontiny tinyspecial'; cnd.color = cond.status ? 'q2' : 'q10';
a.style.backgroundImage = 'url(' + g_staticUrl + '/images/icons/tiny/' + item.icon.toLowerCase() + '.gif)'; cnd.name = item['name_' + g_locale.name];
a.style.whiteSpace = 'nowrap'; cnd.url = '?spell=' + cond.typeId;
$WH.ae(a, $WH.ct(item['name_' + g_locale.name]));
$WH.ae(td, a); return cnd;
}, },
getItemText: function(cond, td) { getItemState: function(cond) {
if (!cond.typeId || !g_items[cond.typeId]) { if (!cond.typeId || !g_items[cond.typeId]) {
return; return;
} }
var item = g_items[cond.typeId]; var
var span = $WH.ce('span'); cnd = {},
span.className = cond.status ? 'q2' : 'q10'; item = g_items[cond.typeId];
$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 a = $WH.ce('a'); cnd.icon = item.icon.toLowerCase();
a.href = '?item=' + cond.typeId; cnd.state = cond.status ? $WH.ct(LANG.pr_note_earned) : $WH.ct(LANG.pr_note_missing);
a.className = 'icontiny tinyspecial'; cnd.color = cond.status ? 'q2' : 'q10';
a.className += ' q' + item.quality; cnd.name = item['name_' + g_locale.name];
a.style.backgroundImage = 'url(' + g_staticUrl + '/images/icons/tiny/' + item.icon.toLowerCase() + '.gif)'; cnd.url = '?item=' + cond.typeId;
a.style.whiteSpace = 'nowrap'; cnd.quality = item.quality;
$WH.ae(a, $WH.ct(item['name_' + g_locale.name]));
$WH.ae(td, a); return cnd;
}, },
getAchievementText: function(cond, td) { getAchievementState: function(cond) {
if (!cond.typeId || !g_achievements[cond.typeId]) { if (!cond.typeId || !g_achievements[cond.typeId]) {
return; return;
} }
var item = g_achievements[cond.typeId]; var
var span = $WH.ce('span'); cnd = {},
span.className = cond.status ? 'q2' : 'q10'; item = g_achievements[cond.typeId];
$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 a = $WH.ce('a'); cnd.icon = item.icon.toLowerCase();
a.href = '?achievement=' + cond.typeId; cnd.state = cond.status ? $WH.ct(LANG.pr_note_earned) : $WH.ct(LANG.pr_note_incomplete);
a.className = 'icontiny tinyspecial'; cnd.color = cond.status ? 'q2' : 'q10';
a.style.backgroundImage = 'url(' + g_staticUrl + '/images/icons/tiny/' + item.icon.toLowerCase() + '.gif)'; cnd.name = item['name_' + g_locale.name];
a.style.whiteSpace = 'nowrap'; cnd.url = '?achievement=' + cond.typeId;
$WH.st(a, item['name_' + g_locale.name]);
$WH.ae(td, a); return cnd;
}, },
getQuestText: function(cond, td) { getQuestState: function(cond) {
if (!cond.typeId || !g_quests[cond.typeId]) { if (!cond.typeId || !g_quests[cond.typeId]) {
return; return;
} }
var item = g_quests[cond.typeId]; var
var span = $WH.ce('span'); cnd = {},
span.className = cond.status == 1 ? 'q1' : cond.status == 2 ? 'q2' : 'q10'; item = g_quests[cond.typeId];
$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 a = $WH.ce('a'); cnd.icon = item.icon.toLowerCase();
a.href = '?quest=' + cond.typeId; cnd.state = cond.status == 1 ? $WH.ct(LANG.progress) : cond.status == 2 ? $WH.ct(LANG.pr_note_complete) : $WH.ct(LANG.pr_note_incomplete);
a.style.whiteSpace = 'nowrap'; cnd.color = cond.status == 1 ? 'q1' : cond.status == 2 ? 'q2' : 'q10';
$WH.st(a, item['name_' + g_locale.name]); cnd.name = item['name_' + g_locale.name];
$WH.ae(td, a); cnd.url = '?quest=' + cond.typeId;
return cnd;
}, },
sortFunc: function(a, b, col) { sortFunc: function(a, b, col) {
if (a.condition.status && b.condition.status) { if (a.condition.status && b.condition.status) {
@@ -8730,6 +8761,289 @@ Listview.templates = {
return Listview.funcBox.assocArrCmp(a.skill, b.skill, g_spell_skills); 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;
}
} }
], ],