- implemented use of itemExtendedCost and fueled some more item-tabs with it

- tinkering with learned spells and added teach-tabs to item.php
- required arenaRating in item tooltips
- updated js-functions handling currencies
- updated Markup with correct links
- i probably forgot to add sql
This commit is contained in:
Sarjuuk
2013-12-08 17:49:39 +01:00
parent 6c7006eeb2
commit 07ee8213da
18 changed files with 761 additions and 337 deletions

View File

@@ -105,7 +105,7 @@ define('GLOBALINFO_ANY', 0xF);
define('ITEMINFO_JSON', 0x01);
define('ITEMINFO_SUBITEMS', 0x02);
define('ITEMINFO_VENDOR', 0x04);
// define('ITEMINFO_LOOT', 0x08); // get these infos from dedicatd loot function [count, stack, pctstack, modes]
// define('ITEMINFO_LOOT', 0x08); // get these infos from dedicatd loot function [count, stack, pctstack, modes]
define('ITEMINFO_GEM', 0x10);
define('ITEMINFO_MODEL', 0x20);

View File

@@ -151,15 +151,17 @@ class CreatureList extends BaseType
'minlevel' => $this->curTpl['minlevel'],
'maxlevel' => $this->curTpl['maxlevel'],
'id' => $this->id,
'boss' => $this->curTpl['type_flags'] & 0x4,
'rank' => $this->curTpl['rank'],
'location' => json_encode($this->getSpawns(SPAWNINFO_ZONES), JSON_NUMERIC_CHECK),
'boss' => $this->curTpl['type_flags'] & 0x4 ? 1 : 0,
'rank' => $this->curTpl['rank'], // classification(?)
'location' => $this->getSpawns(SPAWNINFO_ZONES),
'name' => $this->getField('name', true),
'tag' => $this->getField('subname', true),
'type' => $this->curTpl['type'],
'react' => '['.$this->curTpl['A'].', '.$this->curTpl['H'].']'
);
if ($_ = $this->getField('subname', true))
$data[$this->id]['tag'] = $_;
if ($addInfoMask & NPCINFO_TAMEABLE) // only first skin of first model ... we're omitting potentially 11 skins here .. but the lv accepts only one .. w/e
$data[$this->id]['skin'] = $this->curTpl['textureString'];
}

View File

@@ -31,9 +31,16 @@ class CurrencyList extends BaseType
{
foreach ($this->iterate() as $__)
{
if ($this->id == 104) // in case of honor commit sebbuku
$icon = ['alliance-icon', 'horde-icon'];
else if ($this->id == 103) // also arena-icon diffs from item-icon
$icon = ['money_arena', 'money_arena'];
else
$icon = [$this->curTpl['iconString'], $this->curTpl['iconString']];
$template->extendGlobalData(self::$type, [$this->id => array(
'name' => $this->getField('name', true),
'icon' => $this->curTpl['iconString']
'icon' => $icon
)]);
}
}

View File

@@ -18,6 +18,7 @@ class ItemList extends BaseType
public $subItems = [];
private $ssd = [];
private $vendors = [];
protected $queryBase = 'SELECT i.*, i.id AS ARRAY_KEY FROM ?_items i';
protected $queryOpts = array(
@@ -74,10 +75,102 @@ class ItemList extends BaseType
return Util::localizedString($n, 'name');
}
public function getExtendedCost()
// todo (high): there are cases, where the same items has different extendedCosts attached (through different vendors)
// needs a way to filter for a specific currency/token to accomodate currencyFor-Tabs
// needs a way to filter for a specific vendor to accomodate soldBy-Tabs
public function getExtendedCost(&$reqRating = 0)
{
// placeholder
return []; // [id => qty]
if (!empty($this->vendors))
return $this->vendors;
$ids = array_keys($this->templates);
$itemz = DB::Aowow()->select('
SELECT nv.item AS ARRAY_KEY1, nv.entry AS ARRAY_KEY2, 0 AS eventId, nv.maxcount, iec.* FROM npc_vendor nv LEFT JOIN ?_itemextendedcost iec ON nv.extendedCost = iec.id WHERE nv.item IN (?a)
UNION
SELECT genv.item AS ARRAY_KEY1, c.id AS ARRAY_KEY2, genv.eventEntry AS eventId, genv.maxcount, iec.* FROM game_event_npc_vendor genv JOIN creature c ON c.guid = genv.guid LEFT JOIN ?_itemextendedcost iec ON genv.extendedCost = iec.id WHERE genv.item IN (?a)',
$ids,
$ids
);
$cItems = [];
foreach ($itemz as &$vendors)
{
foreach ($vendors as $k => $costs)
{
$data = array(
'stock' => $costs['maxcount'] ? $costs['maxcount'] : -1,
'event' => $costs['eventId']
);
// reqRating ins't really a cost .. so pass it by ref instead of return
// note: how to distinguish between brackets .. or team/pers-rating?
if ($_ = @$costs['reqPersonalRating'])
$reqRating = $_;
if ($_ = $this->getField('buyPrice')) // somewhat nonsense.. is identical for all vendors (obviously)
$data[0] = $_;
// hardcode arena(103) & honor(104)
if ($_ = @$costs['reqArenaPoints'])
{
$data[-103] = $_;
Util::$pageTemplate->extendGlobalIds(TYPE_CURRENCY, 103);
}
if ($_ = @$costs['reqHonorPoints'])
{
$data[-104] = $_;
Util::$pageTemplate->extendGlobalIds(TYPE_CURRENCY, 104);
}
for ($i = 1; $i < 6; $i++)
{
if (($_ = @$costs['reqItemId'.$i]) && $costs['itemCount'.$i] > 0)
{
$data[$_] = $costs['itemCount'.$i];
$cItems[] = $_;
}
}
$vendors[$k] = $data;
}
}
// convert items to currency if possible
$moneyItems = new CurrencyList(array(['itemId', $cItems]));
$moneyItems->addGlobalsToJscript(Util::$pageTemplate);
foreach ($itemz as $id => &$vendors)
{
foreach ($vendors as &$costs)
{
foreach ($costs as $k => $v)
{
if (in_array($k, $cItems))
{
$found = false;
foreach ($moneyItems->iterate() as $__)
{
if ($moneyItems->getField('itemId') == $k)
{
unset($costs[$k]);
$costs[-$moneyItems->id] = $v;
$found = true;
break;
}
}
if (!$found)
Util::$pageTemplate->extendGlobalIds(TYPE_ITEM, $k);
}
}
}
$this->vendors[$id] = $vendors;
}
return $this->vendors;
}
public function getListviewData($addInfoMask = 0x0)
@@ -131,18 +224,37 @@ class ItemList extends BaseType
if ($addInfoMask & ITEMINFO_VENDOR)
{
$data[$this->id]['cost'] = []; // [money, honor (>0:ally; <0:horde), arena, [items?]]
// just use the first reseults
if ($cost = @reset($this->getExtendedCost()[$this->id]));
{
$currency = [];
$tokens = [];
foreach ($cost as $k => $qty)
{
if (is_string($k))
continue;
if ($k > 0)
$tokens[] = [$k, $qty];
else if ($k < 0)
$currency[] = [-$k, $qty];
}
$data[$this->id]['stock'] = $cost['stock'];
$data[$this->id]['cost'] = array(
$this->getField('buyPrice'),
$currency ? $currency : null,
$tokens ? $tokens : null
);
}
if ($x = $this->curTpl['buyPrice'])
{
$data[$this->id]['buyprice'] = $x;
$data[$this->id]['cost'][0] = $x;
}
if ($x = $this->curTpl['sellPrice'])
$data[$this->id]['sellprice'] = $x;
// todo (med): use extended cost table to fill arena points ect
if ($x = $this->curTpl['buyCount'])
$data[$this->id]['stack'] = $x;
}
if ($this->curTpl['class'] == ITEM_CLASS_GLYPH)
@@ -171,7 +283,7 @@ class ItemList extends BaseType
$data[$this->id]['reqrace'] = $_;
if ($_ = $this->curTpl['requiredClass'])
$data[$this->id]['reqclass'] = $_; // $data[$this->id]['classes'] ??
$data[$this->id]['reqclass'] = $_; // $data[$this->id]['classes'] ??
if ($this->curTpl['flags'] & ITEM_FLAG_HEROIC)
$data[$this->id]['heroic'] = true;
@@ -182,17 +294,10 @@ class ItemList extends BaseType
}
/* even more complicated crap
"source":[5],
"sourcemore":[{"z":3703}],
{"source":[5],"sourcemore":[{"n":"Commander Oxheart","t":1,"ti":64606,"z":5842}],
cost:[] format unk 0:copper, 1:[items]? 2, 3, 4, 5
"source":[5],"sourcemore":[{"n":"Commander Oxheart","t":1,"ti":64606,"z":5842}],
avail unk
rel unk
modelviewer {type:X, displayid:Y, slot:z} .. not sure, when to set
}
*/
return $data;
@@ -572,6 +677,10 @@ class ItemList extends BaseType
else if ($_reqLvl > 1)
$x .= sprintf(Lang::$game['reqLevel'], $_reqLvl).'<br />';
// required arena team raing / perosnal rating / todo (low): sort out what kind of rating
if (@$this->getExtendedCost($reqRating)[$this->id] && $reqRating)
$x .= sprintf(Lang::$item['reqRating'], $reqRating);
// item level
if (in_array($_class, [ITEM_CLASS_ARMOR, ITEM_CLASS_WEAPON]))
$x .= Lang::$item['itemLevel'].' '.$this->curTpl['itemLevel'].'<br />';

View File

@@ -8,8 +8,8 @@ class WorldEventList extends BaseType
{
public static $type = TYPE_WORLDEVENT;
protected $queryBase = 'SELECT *, -e.id AS ARRAY_KEY, -e.id as id FROM ?_events e LEFT JOIN ?_holidays h ON e.holidayId = h.id';
protected $queryOpts = ['e' => ['o' => '-e.id ASC']];
protected $queryBase = 'SELECT *, -e.id AS ARRAY_KEY, -e.id as id FROM ?_events e';
protected $queryOpts = ['e' => ['j' => ['?_holidays h ON e.holidayId = h.id', true], 'o' => '-e.id ASC']];
public function __construct($conditions = [])
{
@@ -36,6 +36,8 @@ class WorldEventList extends BaseType
if ($this->curTpl['requires'])
$this->curTpl['requires'] = explode(' ', $this->curTpl['requires']);
$this->curTpl['eventBak'] = -$this->curTpl['id'];
// change Ids if holiday is set
if ($this->curTpl['holidayId'] > 0)
{

View File

@@ -1767,7 +1767,7 @@ class Util
return false; // always false for passed arrays
}
public function arraySumByKey(&$ref)
public static function arraySumByKey(&$ref)
{
$nArgs = func_num_args();
if (!is_array($ref) || $nArgs < 2)
@@ -1789,6 +1789,45 @@ class Util
}
}
public static function getTaughtSpells(&$spell)
{
$extraIds = [-1]; // init with -1 to prevent empty-array errors
$lookup = [-1];
switch (gettype($spell))
{
case 'object':
if (get_class($spell) != 'SpellList')
return [];
$lookup[] = $spell->id;
foreach ($spell->canTeachSpell() as $idx)
$extraIds[] = $spell->getField('effect'.$idx.'TriggerSpell');
break;
case 'integer':
$lookup[] = $spell;
break;
case 'array':
$lookup = $spell;
break;
default:
return [];
}
$data = array_merge(
DB::Aowow()->selectCol('SELECT spellId FROM spell_learn_spell WHERE entry IN (?a)', $lookup),
DB::Aowow()->selectCol('SELECT spellId FROM skill_discovery_template WHERE reqSpell IN (?a)', $lookup), // note: omits required spell and chance
$extraIds
);
// return list of integers, not strings
array_walk($data, function (&$v, $k) {
$v = intVal($v);
});
return $data;
}
/* from TC wiki
fishing_loot_template no relation entry is linked with ID of the fishing zone or area
creature_loot_template entry many <- many creature_template lootid
@@ -2085,12 +2124,12 @@ class Util
{
$data = array(
'percent' => $chance,
'stack' => [$ref['multiplier'], $ref['multiplier']],
'stack' => [$ref['min'], $ref['max']],
'count' => 1 // ..and one for the sort script
);
$stack = []; // equal distribution between min/max .. not blizzlike, but hey, TC-issue
if ($ref['max'] > $ref['min'])
if ($ref['max'] > 1)
for ($i = $ref['min']; $i <= $ref['max']; $i++)
$stack[$i] = round(100 / (1 + $ref['max'] - $ref['min']), 3);

View File

@@ -543,6 +543,7 @@ $lang = array(
'_rndEnchants' => "Zufällige Verzauberungen",
'_chance' => "(Chance von %s%%)",
'_reqLevel' => "Mindeststufe",
'reqRating' => "Benötigt eine persönliche Arenawertung und Teamwertung von %d.",
'slot' => "Platz",
'_quality' => "Qualität",
'usableBy' => "Benutzbar von",

View File

@@ -530,6 +530,7 @@ $lang = array(
'_rndEnchants' => "Random Enchantments",
'_chance' => "(%s%% chance)",
'_reqLevel' => "Required level",
'reqRating' => "Requires personal and team arena rating of %d<br />in 3v3 or 5v5 brackets",
'slot' => "Slot",
'_quality' => "Quality",
'usableBy' => "Usable by",

View File

@@ -501,6 +501,7 @@ $lang = array(
'_rndEnchants' => "Encantamientos aleatorios",
'_chance' => "(probabilidad %s%%)",
'_reqLevel' => "Nivel requerido",
'reqRating' => "Requiere un índice de arena personal y de equipo de %d",
'slot' => "Casilla",
'_quality' => "Calidad",
'usableBy' => "Usable por",

View File

@@ -501,6 +501,7 @@ $lang = array(
'_rndEnchants' => "Enchantements aléatoires",
'_chance' => "(%s%% de chance)",
'_reqLevel' => "Niveau requis",
'reqRating' => "Nécessite une cote d'arène personnelle et en équipe de %d<br />en arène de 3c3 ou 5c5.",
'slot' => "Emplacement",
'_quality' => "Qualité",
'usableBy' => "Utilisable par",

View File

@@ -501,6 +501,7 @@ $lang = array(
'_rndEnchants' => "Случайные улучшения",
'_chance' => "(шанс %s%%)",
'_reqLevel' => "Требуется уровень",
'reqRating' => "Требуется личный и командный рейтинг на арене не ниже %d",
'slot' => "Слот",
'_quality' => "Качество",
'usableBy' => "Используется (кем)",
@@ -561,8 +562,8 @@ $lang = array(
)),
1 => array("Контейнеры", array(
0 => "Сумки", 1 => "Сумки душ", 3 => "Сумки зачаровывателя", 4 => "Сумки инженера", 7 => "Сумки кожевника", 8 => "Сумки начертателя",
2 => "Сумки травника", 6 => "Сумки шахтера", 5 => "Сумки ювелира",
2 => "Сумки травника", 6 => "Сумки шахтера", 5 => "Сумки ювелира",
)),
0 => array("Расходуемые", array(
7 => "Бинты", 5 => "Еда и напитки", 1 => "Зелья", 0 => "Расходуемые", 4 => "Свитки", -3 => "Улучшения (временные)",

View File

@@ -77,9 +77,12 @@ if (!$smarty->loadCache($cacheKeyPage, $item))
$_flags = $item->getField('flags');
$_slot = $item->getField('slot');
$_subClass = $item->getField('subClass');
$_class = $item->getField('class');
$_subClass = $item->getField('subClass');
$_bagFamily = $item->getField('bagFamily');
$_extCost = [];
if ($_ = @$item->getExtendedCost($_reqRating)[$item->id])
$_extCost = $_;
/***********/
/* Infobox */
@@ -127,17 +130,37 @@ if (!$smarty->loadCache($cacheKeyPage, $item))
if ($tName = DB::Aowow()->selectRow('SELECT * FROM ?_totemCategory WHERE id = ?d', $tId))
$quickInfo[] = Lang::$item['tool'].Lang::$colon.'[url=?items&filter=cr=91;crs='.$tId.';crv=0]'.Util::localizedString($tName, 'name').'[/url]';
$each = $item->getField('stackable') > 1 ? '[color=q0] ('.Lang::$item['each'].')[/color]' : null;
$cost = '';
if ($_ = $item->getField('buyPrice'))
$cost .= '[money='.$_.']';
if ($_ = $item->getExtendedCost())
$each = $item->getField('stackable') > 1 ? '[color=q0] ('.Lang::$item['each'].')[/color]' : null;
$tokens = $currency = [];
if ($_ = reset($_extCost))
{
foreach ($_ as $c => $qty)
$cost .= '[currency='.$c.' amount='.$qty.']';
{
if (is_string($c))
continue;
if ($cost)
$quickInfo[] = Lang::$item['cost'].Lang::$colon.$cost.$each;
if ($c < 0) // currency items (and honor or arena)
$currency[] = -$c.','.$qty;
else if ($c > 0) // plain items (item1,count1,item2,count2,...)
$tokens[$c] = $c.','.$qty;
}
$cost = isset($_[0]) ? '[money='.$_[0] : '[money';
if ($tokens)
$cost .= ' items='.implode(',', $tokens);
if ($currency)
$cost .= ' currency='.implode(',', $currency);
$cost .= ']';
if ($cost)
$quickInfo[] = Lang::$item['cost'].Lang::$colon.$cost.$each;
if ($_reqRating)
$quickInfo[] = sprintf(Lang::$item['reqRating'], $_reqRating);
}
if ($_ = $item->getField('repairPrice'))
$quickInfo[] = Lang::$item['repairCost'].Lang::$colon.'[money='.$_.']';
@@ -274,7 +297,7 @@ if (!$smarty->loadCache($cacheKeyPage, $item))
{
for ($i = 1; $i < count($pageData['page']['subItems']); $i++)
{
$prev = &$pageData['page']['subItems'][$i-1];
$prev = &$pageData['page']['subItems'][$i - 1];
$cur = &$pageData['page']['subItems'][$i];
if ($prev['jsonequip'] == $cur['jsonequip'] && $prev['name'] == $cur['name'])
{
@@ -290,21 +313,20 @@ if (!$smarty->loadCache($cacheKeyPage, $item))
$pendant = DB::Aowow()->selectCell('SELECT IF(horde_id = ?d, alliance_id, -horde_id) FROM player_factionchange_items WHERE alliance_id = ?d OR horde_id = ?d', $_id, $_id, $_id);
if ($pendant)
{
$altItem = new ItemList(array(['id', abs($pendant)])); // todo (med): include this item in tab: "see also"
$altItem = new ItemList(array(['id', abs($pendant)]));
if (!$altItem->error)
{
$pageData['page']['transfer'] = array(
'id' => $altItem->id,
'quality' => $altItem->getField('quality'),
'icon' => $altItem->getField('iconString'),
'name' => $altItem->getField('name', true),
'facInt' => $pendant > 0 ? 'alliance' : 'horde',
'facName' => $pendant > 0 ? Lang::$game['si'][1] : Lang::$game['si'][2]
'id' => $altItem->id,
'quality' => $altItem->getField('quality'),
'icon' => $altItem->getField('iconString'),
'name' => $altItem->getField('name', true),
'facInt' => $pendant > 0 ? 'alliance' : 'horde',
'facName' => $pendant > 0 ? Lang::$game['si'][1] : Lang::$game['si'][2]
);
}
}
/*
/**************/
/* Extra Tabs */
/**************/
@@ -728,7 +750,24 @@ if (!$smarty->loadCache($cacheKeyPage, $item))
}
// tab: see also
$saItems = new ItemList(array(['id', $_id, '!'], ['name_loc'.User::$localeId, $item->getField('name', true)]));
$conditions = array(
['id', $_id, '!'],
[
'OR',
['name_loc'.User::$localeId, $item->getField('name', true)],
[
'AND',
['class', $_class],
['subClass', $_subClass],
['itemLevel', $item->getField('itemLevel') - 15, '>'],
['itemLevel', $item->getField('itemLevel') + 15, '<'],
['quality', $item->getField('quality')],
['requiredClass', $item->getField('requiredClass')]
]
]
);
$saItems = new ItemList($conditions);
if (!$saItems->error)
{
$saItems->addGlobalsToJscript($smarty, GLOBALINFO_SELF);
@@ -744,7 +783,25 @@ if (!$smarty->loadCache($cacheKeyPage, $item))
);
}
// tab: starts (quest) [omited, because the questlink IS ALREADY in the item tooltip]
// tab: starts (quest)
if ($qId = $item->getField('startQuest'))
{
$starts = new QuestList(array(['qt.id', $qId]));
if (!$starts->error)
{
$starts->addGlobalsToJscript($stmarty);
$pageData['relTabs'][] = array(
'file' => 'item',
'data' => $starts->getListviewData(),
'params' => [
'tabs' => '$tabsRelated',
'name' => '$LANG.tab_starts',
'id' => 'starts-quest'
]
);
}
}
// tab: objective of (quest)
$conditions = array(
@@ -791,7 +848,7 @@ if (!$smarty->loadCache($cacheKeyPage, $item))
}
// tab: same model as
if ($model = $item->getField('model'))
if (($model = $item->getField('model')) && $_slot)
{
$sameModel = new ItemList(array(['model', $model], ['id', $_id, '!']));
if (!$sameModel->error)
@@ -811,11 +868,164 @@ if (!$smarty->loadCache($cacheKeyPage, $item))
}
}
// sold by [consult itemExtendedCost]
// tab: sold by
if ($vendors = $_extCost)
{
$soldBy = new CreatureList(array(['id', array_keys($vendors)]));
if (!$soldBy->error)
{
$soldBy->addGlobalsToJscript($smarty, GLOBALINFO_SELF);
$sbData = $soldBy->getListviewData();
// currency for
$extraCols = ['Listview.extraCols.stock', "Listview.funcBox.createSimpleCol('stack', 'stack', '10%', 'stack')", 'Listview.extraCols.cost'];
// teaches
$holidays = [];
foreach ($sbData as $k => &$row)
{
$currency = [];
$tokens = [];
foreach ($vendors[$k] as $id => $qty)
{
if (is_string($id))
continue;
if ($id > 0)
$tokens[] = [$id, $qty];
else if ($id < 0)
$currency[] = [-$id, $qty];
}
if ($_ = $vendors[$k]['event'])
{
if (count($extraCols) == 3) // not already pushed
$extraCols[] = 'Listview.extraCols.condition';
$holidays[$_] = 0; // applied as back ref.
$row['condition'] = array(
'type' => TYPE_WORLDEVENT,
'typeId' => &$holidays[$_],
'status' => 1
);
}
$row['stock'] = $vendors[$k]['stock'];
$row['stack'] = $item->getField('buyCount');
$row['cost'] = array(
$item->getField('buyPrice'),
$currency ? $currency : null,
$tokens ? $tokens : null
);
}
if ($holidays)
{
$hObj = new WorldEventList(array(['id', array_keys($holidays)]));
$hObj->addGlobalsToJscript($smarty);
foreach ($hObj->iterate() as $id => $tpl)
{
if ($_ = $tpl['holidayId'])
$holidays[$tpl['eventBak']] = $_;
else
$holidays[-$id] = $id;
}
}
$pageData['relTabs'][] = array(
'file' => 'creature',
'data' => $sbData,
'params' => [
'tabs' => '$tabsRelated',
'name' => '$LANG.tab_soldby',
'id' => 'sold-by-npc',
'extraCols' => '$['.implode(', ', $extraCols).']',
'hiddenCols' => "$['level', 'type']"
]
);
}
}
// tab: currency for
// some minor trickery: get arenaPoints(43307) and honorPoints(43308) directly
if ($_id == 43307)
$w = 'iec.reqArenaPoints > 0';
else if ($_id == 43308)
$w = 'iec.reqHonorPoints > 0';
else
$w = 'iec.reqItemId1 = '.$_id.' OR iec.reqItemId2 = '.$_id.' OR iec.reqItemId3 = '.$_id.' OR iec.reqItemId4 = '.$_id.' OR iec.reqItemId5 = '.$_id;
$baughtBy = DB::Aowow()->selectCol('
SELECT item FROM npc_vendor nv JOIN ?_itemExtendedCost iec ON iec.id = nv.extendedCost WHERE '.$w.'
UNION
SELECT item FROM game_event_npc_vendor genv JOIN ?_itemExtendedCost iec ON iec.id = genv.extendedCost WHERE '.$w
);
if ($baughtBy)
{
$baughtBy = new ItemList(array(['id', $baughtBy]));
if (!$baughtBy->error)
{
$baughtBy->addGlobalsToJscript($smarty);
$pageData['relTabs'][] = array(
'file' => 'item',
'data' => $baughtBy->getListviewData(ITEMINFO_VENDOR),
'params' => [
'tabs' => '$tabsRelated',
'name' => '$LANG.tab_currencyfor',
'id' => 'currency-for',
'extraCols' => "$[Listview.funcBox.createSimpleCol('stack', 'stack', '10%', 'stack'), Listview.extraCols.cost]"
]
);
}
}
// tab: teaches
$ids = $indirect = [];
for ($i = 1; $i < 6; $i++)
{
if ($item->getField('spellTrigger'.$i) == 6)
$ids[] = $item->getField('spellId'.$i);
else if ($item->getField('spellTrigger'.$i) == 0 && $item->getField('spellId'.$i) > 0)
$indirect[] = $item->getField('spellId'.$i);
}
// taught indirectly
if ($indirect)
{
$indirectSpells = new SpellList(array(['id', $indirect]));
foreach ($indirectSpells->iterate() as $__)
if ($_ = $indirectSpells->canTeachSpell())
foreach ($_ as $idx)
$ids[] = $indirectSpells->getField('effect'.$idx.'TriggerSpell');
$ids = array_merge($ids, Util::getTaughtSpells($indirect));
}
if ($ids)
{
$taughtSpells = new SpellList(array(['id', $ids]));
if (!$taughtSpells->error)
{
$taughtSpells->addGlobalsToJscript($smarty, GLOBALINFO_SELF | GLOBALINFO_RELATED);
$visCols = ['level', 'schools'];
if ($taughtSpells->hasSetFields(['reagent1']))
$visCols[] = 'reagents';
$pageData['relTabs'][] = array(
'file' => 'spell',
'data' => $taughtSpells->getListviewData(),
'params' => [
'tabs' => '$tabsRelated',
'name' => '$LANG.tab_teaches',
'id' => 'teaches',
'visibleCols' => '$'.json_encode($visCols),
]
);
}
}
// taught by (req. workaround over the spell taught)
// Shared cooldown

View File

@@ -1416,17 +1416,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
}
// tab: teaches
$_ = [];
foreach ($spell->canTeachSpell() as $idx)
$_[] = $spell->getField('effect'.$idx.'TriggerSpell');
$ids = array_merge(
DB::Aowow()->selectCol('SELECT spellId FROM spell_learn_spell WHERE entry = ?d', $_id),
DB::Aowow()->selectCol('SELECT spellId FROM skill_discovery_template WHERE reqSpell = ?d', $_id), // note: omits required spell and chance
$_
);
if ($ids)
if ($ids = Util::getTaughtSpells($spell))
{
$teaches = new SpellList(array(['id', $ids]));
if (!$teaches->error)

View File

@@ -375,9 +375,11 @@ if (!$smarty->loadCache($cacheKey, $pageData, $filter))
if ($cats[0] !== null) // !any Spell (php loose comparison: (null == 0) is true)
{
$conditions[] = 'OR';
$conditions[] = ['s.typeCat', 0];
$conditions[] = ['s.cuFlags', SPELL_CU_EXCLUDE_CATEGORY_SEARCH, '&'];
$conditions[] = array(
'OR',
['s.typeCat', 0],
['s.cuFlags', SPELL_CU_EXCLUDE_CATEGORY_SEARCH, '&']
);
break;
}

View File

@@ -3,7 +3,7 @@ var _ = g_gatheredcurrencies;
{foreach from=$data key=id item=item}
_[{$id}]={ldelim}
name_{$user.language}:'{$item.name|escape:"javascript"}',
icon:'{$item.icon|escape:"javascript"}'
icon:{$item.icon|@json_encode}
{rdelim};
{/foreach}
{/strip}

View File

@@ -14,51 +14,11 @@
data:[
{foreach name=i from=$data item=curr}
{ldelim}
name:'{$curr.name|escape:"quotes"}',
{if $curr.tag}
tag:'{$curr.tag|escape:"quotes"}',
{/if}
minlevel:{$curr.minlevel},
maxlevel:{$curr.maxlevel},
type:{$curr.type},
classification:{$curr.rank},
{if $curr.boss}
boss: 1,
{/if}
react:{$curr.react},
location:{$curr.location},
{if isset($curr.skin)}
skin: '{$curr.skin}',
{/if}
{if isset($curr.percent)}
percent:{$curr.percent},
{/if}
{if isset($curr.count)}
count:{$curr.count},
{/if}
{if isset($curr.cost)}
stock:{$curr.stock},
{if isset($curr.stack)}
stack:{$curr.stack},
{foreach from=$curr key='name' item=val}
{if $name != 'id'}
{$name}:{$val|@json_encode:$smarty.const.JSON_NUMERIC_CHECK},
{/if}
cost:[
{if isset($curr.cost.money)}{$curr.cost.money}{/if}
{if isset($curr.cost.honor) or isset($curr.cost.arena) or isset($curr.cost.items)}
,{if isset($curr.cost.honor)}{$curr.cost.honor}{/if}
{if isset($curr.cost.arena) or isset($curr.cost.items)}
,{if isset($curr.cost.arena)}{$curr.cost.arena}{/if}
{if isset($curr.cost.items)}
,[
{foreach from=$curr.cost.items item=curitem name=c}
[{$curitem.item},{$curitem.count}]
{if $smarty.foreach.c.last}{else},{/if}
{/foreach}
]
{/if}
{/if}
{/if}
],
{/if}
{/foreach}
id:{$curr.id}
{rdelim}
{if $smarty.foreach.i.last}{else},{/if}

View File

@@ -187,9 +187,9 @@ var Markup = {
if(g_achievements[id] && g_achievements[id][nameCol])
{
var ach = g_achievements[id];
return '<a href="' + url + '/achievement=' + id + '"' + (rel.length ? ' rel="' + rel.join('&') + '"' : '') + (!attr.icon ? ' class="icontiny"><img src="' + g_staticUrl + '/images/icons/tiny/' + ach.icon.toLowerCase() + '.gif"' : '') + Markup._addGlobalAttributes(attr) + ' align="absmiddle" /> <span class="tinyicontxt">' + Markup._safeHtml(ach[nameCol]) + '</span></a>';
return '<a href="' + url + '?achievement=' + id + '"' + (rel.length ? ' rel="' + rel.join('&') + '"' : '') + (!attr.icon ? ' class="icontiny"><img src="' + g_staticUrl + '/images/icons/tiny/' + ach.icon.toLowerCase() + '.gif"' : '') + Markup._addGlobalAttributes(attr) + ' align="absmiddle" /> <span class="tinyicontxt">' + Markup._safeHtml(ach[nameCol]) + '</span></a>';
}
return '<a href="' + url + '/achievement=' + id + '"' + (rel.length ? ' rel="' + rel.join('&') + '"' : '') + Markup._addGlobalAttributes(attr) + '>(' + LANG.types[10][0] + ' #' + id + ')</a>';
return '<a href="' + url + '?achievement=' + id + '"' + (rel.length ? ' rel="' + rel.join('&') + '"' : '') + Markup._addGlobalAttributes(attr) + '>(' + LANG.types[10][0] + ' #' + id + ')</a>';
},
toText: function(attr)
{
@@ -334,9 +334,9 @@ var Markup = {
if(g_classes[id] && g_classes[id][nameCol])
{
var cls = g_classes[id];
return '<a href="' + url + '/class=' + id + '"' + (!attr.icon ? ' class="icontiny c' + id + '"><img src="' + g_staticUrl + '/images/icons/tiny/' + g_classes.getIcon(id) + '.gif"' : '') + Markup._addGlobalAttributes(attr) + ' align="absmiddle" /> <span class="tinyicontxt">' + Markup._safeHtml(cls[nameCol]) + '</span></a>';
return '<a href="' + url + '?class=' + id + '"' + (!attr.icon ? ' class="icontiny c' + id + '"><img src="' + g_staticUrl + '/images/icons/tiny/' + g_classes.getIcon(id) + '.gif"' : '') + Markup._addGlobalAttributes(attr) + ' align="absmiddle" /> <span class="tinyicontxt">' + Markup._safeHtml(cls[nameCol]) + '</span></a>';
}
return '<a href="' + url + '/class=' + id + '" class="c' + id + '"' + Markup._addGlobalAttributes(attr) + '>(' + LANG.types[13][0] + ' #' + id + ')</a>';
return '<a href="' + url + '?class=' + id + '" class="c' + id + '"' + Markup._addGlobalAttributes(attr) + '>(' + LANG.types[13][0] + ' #' + id + ')</a>';
},
toText: function(attr)
{
@@ -431,12 +431,12 @@ var Markup = {
{
var curr = g_gatheredcurrencies[id];
if(attr.amount)
return '<a href="' + url + '/currency=' + id + '"' + (!attr.icon ? ' class="icontinyr tip q1" onmouseover="$WH.Tooltip.showAtCursor(event, \'' + Markup._safeHtml(curr[nameCol]) + '\', 0, 0, \'q1\');" onmousemove="$WH.Tooltip.cursorUpdate(event)" onmouseout="$WH.Tooltip.hide()" style="background-image:url(' + g_staticUrl + '/images/icons/tiny/' + curr.icon[0].toLowerCase() + '.gif)' : '') + Markup._addGlobalAttributes(attr) + '"> <span class="tinyicontxt">' + attr.amount.split(':').join(' - ') + '</span></a>';
return '<a href="' + url + '?currency=' + id + '"' + (!attr.icon ? ' class="icontinyr tip q1" onmouseover="$WH.Tooltip.showAtCursor(event, \'' + Markup._safeHtml(curr[nameCol]) + '\', 0, 0, \'q1\');" onmousemove="$WH.Tooltip.cursorUpdate(event)" onmouseout="$WH.Tooltip.hide()" style="background-image:url(' + g_staticUrl + '/images/icons/tiny/' + curr.icon[0].toLowerCase() + '.gif)' : '') + Markup._addGlobalAttributes(attr) + '"> <span class="tinyicontxt">' + attr.amount.split(':').join(' - ') + '</span></a>';
else
return '<a href="' + url + '/currency=' + id + '"' + (!attr.icon ? ' class="icontiny q1"><span><img src="' + g_staticUrl + '/images/icons/tiny/' + curr.icon[0].toLowerCase() + '.gif"' : '') + Markup._addGlobalAttributes(attr) + ' align="absmiddle" /> <span class="tinyicontxt">' + Markup._safeHtml(curr[nameCol]) + '</a>';
return '<a href="' + url + '?currency=' + id + '"' + (!attr.icon ? ' class="icontiny q1"><span><img src="' + g_staticUrl + '/images/icons/tiny/' + curr.icon[0].toLowerCase() + '.gif"' : '') + Markup._addGlobalAttributes(attr) + ' align="absmiddle" /> <span class="tinyicontxt">' + Markup._safeHtml(curr[nameCol]) + '</a>';
}
return '<a href="' + url + '/currency=' + id + '"' + Markup._addGlobalAttributes(attr) + '>(' + LANG.types[17][0] + ' #' + id + ')</a>' + (attr.amount > 0 ? ' x' + attr.amount : '');
return '<a href="' + url + '?currency=' + id + '"' + Markup._addGlobalAttributes(attr) + '>(' + LANG.types[17][0] + ' #' + id + ')</a>' + (attr.amount > 0 ? ' x' + attr.amount : '');
},
toText: function(attr)
{
@@ -597,9 +597,9 @@ var Markup = {
if(g_holidays[id] && g_holidays[id][nameCol])
{
var evt = g_holidays[id];
return '<a href="' + url + '/event=' + id + '"' + Markup._addGlobalAttributes(attr) + '>' + Markup._safeHtml(evt[nameCol]) + '</a>';
return '<a href="' + url + '?event=' + id + '"' + Markup._addGlobalAttributes(attr) + '>' + Markup._safeHtml(evt[nameCol]) + '</a>';
}
return '<a href="' + url + '/event=' + id + '"' + Markup._addGlobalAttributes(attr) + '>(' + LANG.types[12][0] + ' #' + id + ')</a>';
return '<a href="' + url + '?event=' + id + '"' + Markup._addGlobalAttributes(attr) + '>(' + LANG.types[12][0] + ' #' + id + ')</a>';
},
toText: function(attr)
{
@@ -638,9 +638,9 @@ var Markup = {
if(g_factions[id] && g_factions[id][nameCol])
{
var fac = g_factions[id];
return '<a href="' + url + '/faction=' + id + '"' + Markup._addGlobalAttributes(attr) + '>' + Markup._safeHtml(fac[nameCol]) + '</a>';
return '<a href="' + url + '?faction=' + id + '"' + Markup._addGlobalAttributes(attr) + '>' + Markup._safeHtml(fac[nameCol]) + '</a>';
}
return '<a href="' + url + '/faction=' + id + '"' + Markup._addGlobalAttributes(attr) + '>(' + LANG.types[8][0] + ' #' + id + ')</a>';
return '<a href="' + url + '?faction=' + id + '"' + Markup._addGlobalAttributes(attr) + '>(' + LANG.types[8][0] + ' #' + id + ')</a>';
},
toText: function(attr)
{
@@ -1065,11 +1065,11 @@ var Markup = {
if(g_items[id] && g_items[id][nameCol])
{
var item = g_items[id];
var str = '<a' + Markup._addGlobalAttributes(attr) + ' href="' + url + '/item=' + id + '" class="q' + item.quality + (!attr.icon ? ' icontiny"><img src="' + g_staticUrl + '/images/icons/tiny/' + item.icon.toLowerCase() + '.gif"' : '') + ' align="absmiddle" /> <span class="tinyicontxt">';
var str = '<a' + Markup._addGlobalAttributes(attr) + ' href="' + url + '?item=' + id + '" class="q' + item.quality + (!attr.icon ? ' icontiny"><img src="' + g_staticUrl + '/images/icons/tiny/' + item.icon.toLowerCase() + '.gif"' : '') + ' align="absmiddle" /> <span class="tinyicontxt">';
str += Markup._safeHtml(item[nameCol]) + '</span></a>';
return str;
}
return '<a href="' + url + '/item=' + id + '"' + Markup._addGlobalAttributes(attr) + '>(' + LANG.types[3][0] + ' #' + id + ')</a>';
return '<a href="' + url + '?item=' + id + '"' + Markup._addGlobalAttributes(attr) + '>(' + LANG.types[3][0] + ' #' + id + ')</a>';
},
toText: function(attr)
{
@@ -1108,9 +1108,9 @@ var Markup = {
if(g_itemsets[id] && g_itemsets[id][nameCol])
{
var set = g_itemsets[id];
return '<a href="' + url + '/itemset=' + id + '"' + Markup._addGlobalAttributes(attr) + '>' + Markup._safeHtml(set[nameCol]) + '</a>';
return '<a href="' + url + '?itemset=' + id + '"' + Markup._addGlobalAttributes(attr) + '>' + Markup._safeHtml(set[nameCol]) + '</a>';
}
return '<a href="' + url + '/itemset=' + id + '"' + Markup._addGlobalAttributes(attr) + '>(' + LANG.types[4][0] + ' #' + id + ')</a>';
return '<a href="' + url + '?itemset=' + id + '"' + Markup._addGlobalAttributes(attr) + '>(' + LANG.types[4][0] + ' #' + id + ')</a>';
},
toText: function(attr)
{
@@ -1454,12 +1454,8 @@ var Markup = {
items: { req: false, valid: /^[0-9,]+$/ },
currency: { req: false, valid: /^[0-9,]+$/ },
achievement: { req: false, valid: /\S+/ },
// DEPRECATED
arena: { req: false, valid: /^[0-9]+$/ },
honor: { req: false, valid: /^[0-9]+$/ },
conquest: { req: false, valid: /^[0-9]+$/ },
justice: { req: false, valid: /^[0-9]+$/ },
valor: { req: false, valid: /^[0-9]+$/ }
},
allowedClass: MARKUP_CLASS_STAFF,
toHtml: function(attr)
@@ -1484,16 +1480,10 @@ var Markup = {
}
// Backwards compatability
if(attr.arena && !attr.conquest)
attr.conquest = attr.arena;
if(attr.honor)
currency.push([392, attr.honor]);
if(attr.conquest)
currency.push([390, attr.conquest]);
if(attr.justice)
currency.push([395, attr.justice]);
if(attr.valor)
currency.push([396, attr.valor]);
currency.push([104, attr.honor]);
if(attr.arena)
currency.push([103, attr.arena]);
return g_getMoneyHtml(attr.unnamed, attr.side, items, currency, attr.achievement);
}
@@ -1524,9 +1514,9 @@ var Markup = {
if(g_npcs[id] && g_npcs[id][nameCol])
{
var npc = g_npcs[id];
return '<a href="' + url + '/npc=' + id + '"' + Markup._addGlobalAttributes(attr) + '>' + Markup._safeHtml(npc[nameCol]) + '</a>';
return '<a href="' + url + '?npc=' + id + '"' + Markup._addGlobalAttributes(attr) + '>' + Markup._safeHtml(npc[nameCol]) + '</a>';
}
return '<a href="' + url + '/npc=' + id + '"' + Markup._addGlobalAttributes(attr) + '>(' + LANG.types[1][0] + ' #' + id + ')</a>';
return '<a href="' + url + '?npc=' + id + '"' + Markup._addGlobalAttributes(attr) + '>(' + LANG.types[1][0] + ' #' + id + ')</a>';
},
toText: function(attr)
{
@@ -1539,47 +1529,6 @@ var Markup = {
return LANG.types[1][0] + ' #' + id;
}
},
petability:
{
empty: true,
allowInReplies: true,
attr:
{
unnamed: { req: true, valid: /^[0-9]+$/ },
domain: { req: false, valid: /^(beta|mop|ptr|www|de|es|fr|ru|pt)$/ },
site: { req: false, valid: /^(beta|mop|ptr|www|de|es|fr|ru|pt)$/ }
},
validate: function(attr)
{
if((attr.domain || attr.site) && Markup.dbpage)
return false;
return true;
},
toHtml: function(attr)
{
var id = attr.unnamed;
var domainInfo = Markup._getDatabaseDomainInfo(attr);
var url = domainInfo[0];
var nameCol = domainInfo[1];
if(g_petabilities[id] && g_petabilities[id][nameCol])
{
var ability = g_petabilities[id];
return '<a href="' + url + '/petability=' + id + '"' + Markup._addGlobalAttributes(attr) + '>' + Markup._safeHtml(ability[nameCol]) + '</a>';
}
return '<a href="' + url + '/petability=' + id + '"' + Markup._addGlobalAttributes(attr) + '>(' + LANG.types[200][0] + ' #' + id + ')</a>';
},
toText: function(attr)
{
var id = attr.unnamed;
var domainInfo = Markup._getDatabaseDomainInfo(attr);
var nameCol = domainInfo[1];
if(g_petabilities[id] && g_petabilities[id][nameCol])
return Markup._safeHtml(g_petabilities[id][nameCol]);
return LANG.types[200][0] + ' #' + id;
}
},
object:
{
empty: true,
@@ -1606,9 +1555,9 @@ var Markup = {
if(g_objects[id] && g_objects[id][nameCol])
{
var obj = g_objects[id];
return '<a href="' + url + '/object=' + id + '"' + Markup._addGlobalAttributes(attr) + '>' + Markup._safeHtml(obj[nameCol]) + '</a>';
return '<a href="' + url + '?object=' + id + '"' + Markup._addGlobalAttributes(attr) + '>' + Markup._safeHtml(obj[nameCol]) + '</a>';
}
return '<a href="' + url + '/object=' + id + '"' + Markup._addGlobalAttributes(attr) + '>(' + LANG.types[2][0] + ' #' + id + ')</a>';
return '<a href="' + url + '?object=' + id + '"' + Markup._addGlobalAttributes(attr) + '>(' + LANG.types[2][0] + ' #' + id + ')</a>';
},
toText: function(attr)
{
@@ -1729,10 +1678,10 @@ var Markup = {
if(g_pet_families && g_pet_families[id] && g_pets && g_pets[id])
{
var str = '<span' + (!attr.icon ? ' class="icontiny" style="background-image: url(' + g_staticUrl + '/images/icons/tiny/' + g_pets[id]['icon'].toLowerCase() + '.gif)' : '') + '">';
str += '<a href="' + url + '/pet=' + id + '"' + Markup._addGlobalAttributes(attr) + '>' + Markup._safeHtml(g_pet_families[id]) + '</a></span>';
str += '<a href="' + url + '?pet=' + id + '"' + Markup._addGlobalAttributes(attr) + '>' + Markup._safeHtml(g_pet_families[id]) + '</a></span>';
return str;
}
return '<a href="' + url + '/pet=' + id + '"' + Markup._addGlobalAttributes(attr) + '>(' + LANG.types[9][0] + ' #' + id + ')</a>';
return '<a href="' + url + '?pet=' + id + '"' + Markup._addGlobalAttributes(attr) + '>(' + LANG.types[9][0] + ' #' + id + ')</a>';
},
toText: function(attr)
{
@@ -1790,9 +1739,9 @@ var Markup = {
if(g_quests[id] && g_quests[id][nameCol])
{
var quest = g_quests[id];
return '<a href="' + url + '/quest=' + id + '"' + (!attr.icon ? ' class="icontiny"><img src="' + g_staticUrl + '/images/icons/tiny/' + (quest.daily ? 'quest_start_daily' : 'quest_start') + '.gif"' : '') + Markup._addGlobalAttributes(attr) + ' align="absmiddle" /> <span class="tinyicontxt">' + Markup._safeHtml(quest[nameCol]) + '</span></a>';
return '<a href="' + url + '?quest=' + id + '"' + (!attr.icon ? ' class="icontiny"><img src="' + g_staticUrl + '/images/icons/tiny/' + (quest.daily ? 'quest_start_daily' : 'quest_start') + '.gif"' : '') + Markup._addGlobalAttributes(attr) + ' align="absmiddle" /> <span class="tinyicontxt">' + Markup._safeHtml(quest[nameCol]) + '</span></a>';
}
return '<a href="' + url + '/quest=' + id + '"' + Markup._addGlobalAttributes(attr) + '>(' + LANG.types[5][0] + ' #' + id + ')</a>';
return '<a href="' + url + '?quest=' + id + '"' + Markup._addGlobalAttributes(attr) + '>(' + LANG.types[5][0] + ' #' + id + ')</a>';
},
toText: function(attr)
{
@@ -1951,9 +1900,9 @@ var Markup = {
if(g_races[id] && g_races[id][nameCol])
{
var race = g_races[id];
return '<a href="' + url + '/race=' + id + '"' + (!attr.icon ? ' class="icontiny"><img src="' + g_staticUrl + '/images/icons/tiny/' + g_races.getIcon(id, gender) + '.gif"' : '') + Markup._addGlobalAttributes(attr) + ' align="absmiddle" /> <span class="tinyicontxt">' + Markup._safeHtml(race[nameCol]) + '</span></a>';
return '<a href="' + url + '?race=' + id + '"' + (!attr.icon ? ' class="icontiny"><img src="' + g_staticUrl + '/images/icons/tiny/' + g_races.getIcon(id, gender) + '.gif"' : '') + Markup._addGlobalAttributes(attr) + ' align="absmiddle" /> <span class="tinyicontxt">' + Markup._safeHtml(race[nameCol]) + '</span></a>';
}
return '<a href="' + url + '/race=' + id + '"' + Markup._addGlobalAttributes(attr) + '>(' + LANG.types[14][0] + ' #' + id + ')</a>';
return '<a href="' + url + '?race=' + id + '"' + Markup._addGlobalAttributes(attr) + '>(' + LANG.types[14][0] + ' #' + id + ')</a>';
},
toText: function(attr)
{
@@ -2149,9 +2098,9 @@ var Markup = {
if(g_skills[id] && g_skills[id][nameCol])
{
var skill = g_skills[id];
return '<a href="' + url + '/skill=' + id + '"' + (!attr.icon ? ' class="icontiny"><img src="' + g_staticUrl + '/images/icons/tiny/' + g_skills.getIcon(id) + '.gif"' : '') + Markup._addGlobalAttributes(attr) + ' align="absmiddle" /> <span class="tinyicontxt">' + Markup._safeHtml(skill[nameCol]) + '</span></a>';
return '<a href="' + url + '?skill=' + id + '"' + (!attr.icon ? ' class="icontiny"><img src="' + g_staticUrl + '/images/icons/tiny/' + g_skills.getIcon(id) + '.gif"' : '') + Markup._addGlobalAttributes(attr) + ' align="absmiddle" /> <span class="tinyicontxt">' + Markup._safeHtml(skill[nameCol]) + '</span></a>';
}
return '<a href="' + url + '/skill=' + id + '"' + Markup._addGlobalAttributes(attr) + '>(' + LANG.types[15][0] + ' #' + id + ')</a>';
return '<a href="' + url + '?skill=' + id + '"' + Markup._addGlobalAttributes(attr) + '>(' + LANG.types[15][0] + ' #' + id + ')</a>';
},
toText: function(attr)
{
@@ -2261,11 +2210,11 @@ var Markup = {
if(g_spells[id] && g_spells[id][nameCol])
{
var spell = g_spells[id];
return '<a href="' + url + '/spell=' + id + '"' + (rel.length ? ' rel="' + rel.join('&') + '"' : '') + (!attr.icon ? ' class="icontiny"><img src="' + g_staticUrl + '/images/icons/tiny/' + spell.icon.toLowerCase() + '.gif"' : '') + Markup._addGlobalAttributes(attr) + ' align="absmiddle" /> <span class="tinyicontxt">' + Markup._safeHtml(spell[nameCol]) + '</span></a>';
return '<a href="' + url + '?spell=' + id + '"' + (rel.length ? ' rel="' + rel.join('&') + '"' : '') + (!attr.icon ? ' class="icontiny"><img src="' + g_staticUrl + '/images/icons/tiny/' + spell.icon.toLowerCase() + '.gif"' : '') + Markup._addGlobalAttributes(attr) + ' align="absmiddle" /> <span class="tinyicontxt">' + Markup._safeHtml(spell[nameCol]) + '</span></a>';
}
if(attr.mop && attr.mopname && attr.mopicon && attr.mopicon.indexOf('.jpg', attr.mopicon.length - 4) !== -1)
return '<span class="tooltip-inside-icon" style="background:url(' + g_staticUrl + 'images/icons/mop-talents/18/' + Markup._safeHtml(attr.mopicon) + ')"></span> <a href="' + url + '/spell=' + id + '"' + (rel.length ? ' rel="' + rel.join('&') + '"' : '') + ' ><span class="tinyicontxt">' + Markup._safeHtml(attr.mopname) + '</span></a>';
return '<a href="' + url + '/spell=' + id + '"' + (rel.length ? ' rel="' + rel.join('&') + '"' : '') + '>(' + LANG.types[6][0] + ' #' + id + ')</a>';
return '<span class="tooltip-inside-icon" style="background:url(' + g_staticUrl + 'images/icons/mop-talents/18/' + Markup._safeHtml(attr.mopicon) + ')"></span> <a href="' + url + '?spell=' + id + '"' + (rel.length ? ' rel="' + rel.join('&') + '"' : '') + ' ><span class="tinyicontxt">' + Markup._safeHtml(attr.mopname) + '</span></a>';
return '<a href="' + url + '?spell=' + id + '"' + (rel.length ? ' rel="' + rel.join('&') + '"' : '') + '>(' + LANG.types[6][0] + ' #' + id + ')</a>';
},
toText: function(attr)
{
@@ -2316,9 +2265,9 @@ var Markup = {
if(g_achievements[id] && g_achievements[id][nameCol])
{
var ach = g_achievements[id];
return '<a href="' + url + '/achievement=' + id + '"' + (!attr.icon ? ' class="icontiny"><img src="' + g_staticUrl + '/images/icons/tiny/' + ach.icon.toLowerCase() + '.gif"' : '') + Markup._addGlobalAttributes(attr) + ' align="absmiddle" /> <span class="tinyicontxt">' + Markup._safeHtml(ach[nameCol]) + '</span></a>';
return '<a href="' + url + '?achievement=' + id + '"' + (!attr.icon ? ' class="icontiny"><img src="' + g_staticUrl + '/images/icons/tiny/' + ach.icon.toLowerCase() + '.gif"' : '') + Markup._addGlobalAttributes(attr) + ' align="absmiddle" /> <span class="tinyicontxt">' + Markup._safeHtml(ach[nameCol]) + '</span></a>';
}
return '<a href="' + url + '/achievement=' + id + '"' + Markup._addGlobalAttributes(attr) + '>(' + LANG.types[10][0] + ' #' + id + ')</a>';
return '<a href="' + url + '?achievement=' + id + '"' + Markup._addGlobalAttributes(attr) + '>(' + LANG.types[10][0] + ' #' + id + ')</a>';
},
toText: function(attr)
{
@@ -3058,9 +3007,9 @@ var Markup = {
if(g_titles[id] && g_titles[id][nameCol])
{
return '<a href="' + url + '/title=' + id + '"' + Markup._addGlobalAttributes(attr) + '>' + Markup._safeHtml(g_titles[id][nameCol]) + '</a>';
return '<a href="' + url + '?title=' + id + '"' + Markup._addGlobalAttributes(attr) + '>' + Markup._safeHtml(g_titles[id][nameCol]) + '</a>';
}
return '<a href="' + url + '/title=' + id + '"' + Markup._addGlobalAttributes(attr) + '>(' + LANG.types[11][0] + ' #' + id + ')</a>';
return '<a href="' + url + '?title=' + id + '"' + Markup._addGlobalAttributes(attr) + '>(' + LANG.types[11][0] + ' #' + id + ')</a>';
},
toText: function(attr)
{
@@ -3098,9 +3047,9 @@ var Markup = {
if(g_gatheredzones[id] && g_gatheredzones[id][nameCol])
{
return '<a href="' + url + '/zone=' + id + '"' + Markup._addGlobalAttributes(attr) + '>' + Markup._safeHtml(g_gatheredzones[id][nameCol]) + '</a>';
return '<a href="' + url + '?zone=' + id + '"' + Markup._addGlobalAttributes(attr) + '>' + Markup._safeHtml(g_gatheredzones[id][nameCol]) + '</a>';
}
return '<a href="' + url + '/zone=' + id + '"' + Markup._addGlobalAttributes(attr) + '>(' + LANG.types[7][0] + ' #' + id + ')</a>';
return '<a href="' + url + '?zone=' + id + '"' + Markup._addGlobalAttributes(attr) + '>(' + LANG.types[7][0] + ' #' + id + ')</a>';
},
toText: function(attr)
{

View File

@@ -953,59 +953,116 @@ function g_createAchievementBar(b, d, a) {
return g_createProgressBar(c)
}
function g_getMoneyHtml(c) {
var b = 0,
a = "";
if (c >= 10000) {
b = 1;
a += '<span class="moneygold">' + Math.floor(c / 10000) + "</span>";
c %= 10000
function g_getMoneyHtml(money, side, costItems, costCurrency, achievementPoints) {
var
ns = 0,
html = '';
if (side == 1 || side == 'alliance') {
side = 1;
}
if (c >= 100) {
if (b) {
a += " "
} else {
b = 1
else if (side == 2 || side == 'horde') {
side = 2;
}
else {
side = 3;
}
if (money >= 10000) {
ns = 1;
var display = Math.floor(money / 10000);
html += '<span class="moneygold">' + $WH.number_format(display) + '</span>';
money %= 10000;
}
if (money >= 100) {
if (ns) {
html += ' ';
}
a += '<span class="moneysilver">' + Math.floor(c / 100) + "</span>";
c %= 100
}
if (c >= 1) {
if (b) {
a += " "
} else {
b = 1
else {
ns = 1;
}
a += '<span class="moneycopper">' + c + "</span>"
var display = Math.floor(money / 100);
html += '<span class="moneysilver">' + display + '</span>';
money %= 100;
}
return a
}
function g_getMoneyHtml2(f, c, b, a) {
var e = g_getMoneyHtml(f);
if (c !== undefined && c !== null && c != 0) {
if (e.length > 0) {
e += " "
if (money >= 1) {
if (ns) {
html += ' ';
}
e += '<span class="money' + (c < 0 ? "horde": "alliance") + ' tip" onmouseover="Listview.funcBox.moneyHonorOver(event)" onmousemove="$WH.Tooltip.cursorUpdate(event)" onmouseout="$WH.Tooltip.hide()">' + g_numberFormat(Math.abs(c)) + "</span>"
}
if (b !== undefined && b !== null && b > 0) {
if (e.length > 0) {
e += " "
else {
ns = 1;
}
e += '<span class="moneyarena tip" onmouseover="Listview.funcBox.moneyArenaOver(event)" onmousemove="$WH.Tooltip.cursorUpdate(event)" onmouseout="$WH.Tooltip.hide()">' + g_numberFormat(b) + "</span>"
html += '<span class="moneycopper">' + money + '</span>';
}
if (a !== undefined && a !== null && a.length > 0) {
for (var d = 0; d < a.length; ++d) {
if (e.length > 0) {
e += " "
if (costItems != null) {
for (var i = 0; i < costItems.length; ++i) {
if (ns) {
html += ' ';
}
var h = a[d][0];
var g = a[d][1];
e += '<a href="?item=' + h + '" class="moneyitem" style="background-image: url(images/icons/tiny/' + (g_items[h] && g_items[h]["icon"] ? g_items[h]["icon"] : "inv_misc_questionmark").toLowerCase() + '.gif)">' + g + "</a>"
else {
ns = 1;
}
var itemId = costItems[i][0];
var count = costItems[i][1];
var icon = (g_items[itemId] && g_items[itemId].icon ? g_items[itemId].icon : 'inv_misc_questionmark');
html += '<a href="?item=' + itemId + '" class="moneyitem" style="background-image: url(' + g_staticUrl + '/images/icons/tiny/' + icon.toLowerCase() + '.gif)">' + count + '</a>';
}
}
return e
if (costCurrency != null) {
for (var i = 0; i < costCurrency.length; ++i) {
if (ns) {
html += ' ';
}
else {
ns = 1;
}
var currencyId = costCurrency[i][0];
var count = costCurrency[i][1];
var icon = (g_gatheredcurrencies[currencyId] && g_gatheredcurrencies[currencyId].icon ? g_gatheredcurrencies[currencyId].icon : ['inv_misc_questionmark', 'inv_misc_questionmark']);
if (side == 3 && icon[0] == icon[1]) {
side = 1;
}
// sarjuuk: custom start
if (currencyId == 103) { // arena
html += '<a href="?currency=' + currencyId + '" class="moneyarena tip" onmouseover="Listview.funcBox.moneyArenaOver(event)" onmousemove="$WH.Tooltip.cursorUpdate(event)" onmouseout="$WH.Tooltip.hide()">' + $WH.number_format(count) + '</a>';
}
else if (currencyId == 104) { // honor
html += '<a href="?currency=' + currencyId + '" class="money' + (side == 1 ? 'alliance' : 'horde') + ' tip" onmouseover="Listview.funcBox.moneyHonorOver(event)" onmousemove="$WH.Tooltip.cursorUpdate(event)" onmouseout="$WH.Tooltip.hide()">' + $WH.number_format(count) + '</a>';
}
else { // tokens
html += '<a href="?currency=' + currencyId + '" class="icontinyr tip q1" onmouseover="Listview.funcBox.moneyCurrencyOver(' + currencyId + ', ' + count + ', event)" onmousemove="$WH.Tooltip.cursorUpdate(event)" onmouseout="$WH.Tooltip.hide()" style="background-image: url(' + g_staticUrl + '/images/icons/tiny/' + icon[0].toLowerCase() + '.gif)">' + count + '</a>';
}
// sarjuuk: custom end
// html += '<a href="?currency=' + currencyId + '" class="icontinyr tip q1" onmouseover="Listview.funcBox.moneyCurrencyOver(' + currencyId + ', ' + count + ', event)" onmousemove="$WH.Tooltip.cursorUpdate(event)" onmouseout="$WH.Tooltip.hide()" style="background-image: url(' + g_staticUrl + '/images/icons/tiny/' + icon[(side == 3 ? 1 : side - 1)].toLowerCase() + '.gif)">' + (side == 3 ? '<span class="icontinyr" style="background-image: url(' + g_staticUrl + '/images/icons/tiny/' + icon[0].toLowerCase() + '.gif)">' : '') + count + (side == 3 ? '</span>' : '') + '</a>';
}
}
if (achievementPoints > 0) {
if (ns) {
html += ' ';
}
else {
ns = 1;
}
html += '<span class="moneyachievement tip" onmouseover="Listview.funcBox.moneyAchievementOver(event)" onmousemove="$WH.Tooltip.cursorUpdate(event)" onmouseout="$WH.Tooltip.hide()">' + $WH.number_format(achievementPoints) + '</span>';
}
return html;
}
function g_numberFormat(f, b, l, h) {
var c = f,
a = b;
@@ -5085,8 +5142,7 @@ Listview.extraCols = {
name: LANG.cost,
getValue: function(row) {
if (row.cost) {
return (row.cost[3] && row.cost[3][0] ? row.cost[3][0][1] : 0) || (row.cost[2] || row.cost[1] || row.cost[0])
// 5.0 return (row.cost[2] && row.cost[2][0] ? row.cost[2][0][1] : 0) || (row.cost[1] && row.cost[1][0] ? row.cost[1][0][1] : 0) || row.cost[0];
return (row.cost[2] && row.cost[2][0] ? row.cost[2][0][1] : 0) || (row.cost[1] && row.cost[1][0] ? row.cost[1][0][1] : 0) || row.cost[0];
}
},
compute: function(row, td) {
@@ -5109,9 +5165,7 @@ Listview.extraCols = {
}
}
Listview.funcBox.appendMoney(td, money, side, currency, items, row.cost[3]/*achievementPoints*/)
// 5.0 Listview.funcBox.appendMoney(td, money, side, items, currency, achievementPoints);
Listview.funcBox.appendMoney(td, money, side, items, currency, achievementPoints);
}
},
sortFunc: function(a, b, col) {
@@ -5429,7 +5483,7 @@ Listview.extraCols = {
var a = $WH.ce('a');
a.href = '?achievement=' + item.achievement;
a.className = 'icontiny tinyspecial';
a.style.backgroundImage = 'url(' + g_staticUrl + '/images/wow/icons/tiny/' + g_achievements[item.achievement].icon.toLowerCase() + '.gif)';
a.style.backgroundImage = 'url(' + g_staticUrl + '/images/icons/tiny/' + g_achievements[item.achievement].icon.toLowerCase() + '.gif)';
a.style.whiteSpace = 'nowrap';
$WH.st(a, g_achievements[item.achievement]['name_' + g_locale.name]);
@@ -5509,7 +5563,7 @@ Listview.extraCols = {
LANG.earned
LANG.progress
probably also events, zones, skill, faction, ..
probably also zones, skill, faction, ..
*/
id: 'condition',
@@ -5572,6 +5626,8 @@ Listview.extraCols = {
return Listview.extraCols.condition.getAchievementState(cond);
case 'quest':
return Listview.extraCols.condition.getQuestState(cond);
case 'event':
return Listview.extraCols.condition.getEventState(cond);
default:
return {};
}
@@ -5645,6 +5701,23 @@ Listview.extraCols = {
return cnd;
},
getEventState: function(cond) {
if (!cond.typeId || !g_holidays[cond.typeId]) {
return;
}
var
cnd = {},
item = g_holidays[cond.typeId];
cnd.icon = item.icon.toLowerCase();
cnd.state = cond.status ? $WH.ct('active') : $WH.ct('inactive');
cnd.color = cond.status ? 'q2' : 'q10';
cnd.name = item['name_' + g_locale.name];
cnd.url = '?event=' + cond.typeId;
return cnd;
},
sortFunc: function(a, b, col) {
if (a.condition.status && b.condition.status) {
return $WH.strcmp(a.condition.status, b.condition.status);
@@ -7582,104 +7655,180 @@ Listview.funcBox = {
},
moneyCurrencyOver: function(currencyId, count, e) {
var buff = g_gatheredcurrencies[currencyId]['name_' + Locale.getName()];
var buff = g_gatheredcurrencies[currencyId]['name_' + g_locale.name /*g_loc.getName()*/];
// justice / valor points handling removed
$WH.Tooltip.showAtCursor(e, buff, 0, 0, 'q1');
},
appendMoney: function(g, a, f, m, j, c, l) { // todo: understand and adapt
var k, h = 0;
if (a >= 10000) {
h = 1;
k = $WH.ce("span");
k.className = "moneygold";
$WH.ae(k, $WH.ct(Math.floor(a / 10000)));
$WH.ae(g, k);
a %= 10000
appendMoney: function(d, money, side, costItems, costCurrency, achievementPoints) {
var
_,
__,
ns = 0;
if (side == 1 || side == 'alliance') {
side = 1;
}
if (a >= 100) {
if (h) {
$WH.ae(g, $WH.ct(" "))
} else {
h = 1
else if (side == 2 || side == 'horde') {
side = 2;
}
else {
side = 3;
}
if (money >= 10000) {
ns = 1;
_ = $WH.ce('span');
_.className = 'moneygold';
$WH.ae(_, $WH.ct($WH.number_format(Math.floor(money / 10000))));
$WH.ae(d, _);
money %= 10000;
}
if (money >= 100) {
if (ns) {
$WH.ae(d, $WH.ct(' '));
}
k = $WH.ce("span");
k.className = "moneysilver";
$WH.ae(k, $WH.ct(Math.floor(a / 100)));
$WH.ae(g, k);
a %= 100
}
if (a >= 1 || f != null) {
if (h) {
$WH.ae(g, $WH.ct(" "))
} else {
h = 1
else {
ns = 1;
}
k = $WH.ce("span");
k.className = "moneycopper";
$WH.ae(k, $WH.ct(a));
$WH.ae(g, k)
_ = $WH.ce('span');
_.className = 'moneysilver';
$WH.ae(_, $WH.ct(Math.floor(money / 100)));
$WH.ae(d, _);
money %= 100;
}
if (m != null && m != 0) {
if (h) {
$WH.ae(g, $WH.ct(" "))
} else {
h = 1
if (money >= 1) {
if (ns) {
$WH.ae(d, $WH.ct(' '));
}
k = $WH.ce("span");
k.className = "money" + (m < 0 ? "horde": "alliance") + " tip";
k.onmouseover = Listview.funcBox.moneyHonorOver;
k.onmousemove = $WH.Tooltip.cursorUpdate;
k.onmouseout = $WH.Tooltip.hide;
$WH.ae(k, $WH.ct($WH.number_format(Math.abs(m))));
$WH.ae(g, k)
}
if (j >= 1) {
if (h) {
$WH.ae(g, $WH.ct(" "))
} else {
h = 1
else {
ns = 1;
}
k = $WH.ce("span");
k.className = "moneyarena tip";
k.onmouseover = Listview.funcBox.moneyArenaOver;
k.onmousemove = $WH.Tooltip.cursorUpdate;
k.onmouseout = $WH.Tooltip.hide;
$WH.ae(k, $WH.ct($WH.number_format(j)));
$WH.ae(g, k)
_ = $WH.ce('span');
_.className = 'moneycopper';
$WH.ae(_, $WH.ct(money));
$WH.ae(d, _);
}
if (c != null) {
for (var b = 0; b < c.length; ++b) {
if (h) {
$WH.ae(g, $WH.ct(" "))
} else {
h = 1
if (costItems != null) {
for (var i = 0; i < costItems.length; ++i) {
if (ns) {
$WH.ae(d, $WH.ct(' '));
}
var o = c[b][0];
var e = c[b][1];
k = $WH.ce("a");
k.href = "?item=" + o;
k.className = "moneyitem";
k.style.backgroundImage = "url(images/icons/tiny/" + g_items.getIcon(o).toLowerCase() + ".gif)";
$WH.ae(k, $WH.ct(e));
$WH.ae(g, k)
else {
ns = 1;
}
var itemId = costItems[i][0];
var count = costItems[i][1];
var icon = g_items.getIcon(itemId);
_ = $WH.ce('a');
_.href = '?item=' + itemId;
_.className = 'moneyitem';
_.style.backgroundImage = 'url(' + g_staticUrl + '/images/icons/tiny/' + icon.toLowerCase() + '.gif)';
$WH.ae(_, $WH.ct(count));
$WH.ae(d, _);
}
}
if (l != null) {
if (h) {
$WH.ae(g, $WH.ct(" "))
} else {
h = 1
if (costCurrency != null) {
for (var i = 0; i < costCurrency.length; ++i) {
if (ns) {
$WH.ae(d, $WH.ct(' '));
}
else {
ns = 1;
}
var currencyId = costCurrency[i][0];
var count = costCurrency[i][1];
var icon = ['inv_misc_questionmark', 'inv_misc_questionmark'];
if (g_gatheredcurrencies[currencyId]) {
icon = g_gatheredcurrencies[currencyId].icon;
}
// sarjuuk: replacement
_ = $WH.ce('a');
_.href = '?currency=' + currencyId;
_.onmousemove = $WH.Tooltip.cursorUpdate;
_.onmouseout = $WH.Tooltip.hide;
if (currencyId == 103) { // arena
_.className = 'moneyarena tip';
_.onmouseover = Listview.funcBox.moneyArenaOver;
$WH.ae(_, $WH.ct($WH.number_format(count)));
}
else if (currencyId == 104) { // honor
if (side == 3 && icon[0] == icon[1]) {
side = 1;
}
_.className = 'money' + (side == 1 ? 'alliance' : 'horde') + ' tip';
_.onmouseover = Listview.funcBox.moneyHonorOver;
if (side == 3) {
__ = $WH.ce('span');
__.className = 'moneyalliance';
$WH.ae(__, $WH.ct($WH.number_format(count)));
$WH.ae(_, __);
}
else {
$WH.ae(_, $WH.ct($WH.number_format(count)));
}
}
else { // tokens
_.className = 'icontinyr tip q1';
_.style.backgroundImage = 'url(' + g_staticUrl + '/images/icons/tiny/' + icon[0].toLowerCase() + '.gif)';
_.onmouseover = Listview.funcBox.moneyCurrencyOver.bind(_, currencyId, count);
$WH.ae(_, $WH.ct($WH.number_format(count)));
}
/* sarjuuk: original
if (side == 3 && icon[0] == icon[1]) {
side = 1;
}
_ = $WH.ce('a');
_.href = '?currency=' + currencyId;
_.className = 'icontinyr tip q1';
_.style.backgroundImage = 'url(' + g_staticUrl + '/images/icons/tiny/' + icon[(side == 3 ? 1 : side - 1)].toLowerCase() + '.gif)';
_.onmouseover = Listview.funcBox.moneyCurrencyOver.bind(_, currencyId, count);
_.onmousemove = $WH.Tooltip.cursorUpdate;
_.onmouseout = $WH.Tooltip.hide;
$WH.ae(d, _);
if (side == 3) {
__ = $WH.ce('span');
__.className = 'icontinyr';
__.style.backgroundImage = 'url(' + g_staticUrl + '/images/icons/tiny/' + icon[0].toLowerCase() + '.gif)';
$WH.ae(_, __);
_ = __;
}
*/
$WH.ae(d, _);
}
k = $WH.ce("span");
k.className = "moneyachievement tip";
k.onmouseover = Listview.funcBox.moneyAchievementOver;
k.onmousemove = $WH.Tooltip.cursorUpdate;
k.onmouseout = $WH.Tooltip.hide;
$WH.ae(k, $WH.ct($WH.number_format(l)));
$WH.ae(g, k)
}
if (achievementPoints > 0) {
if (ns) {
$WH.ae(d, $WH.ct(' '));
}
else {
ns = 1;
}
_ = $WH.ce('span');
_.className = 'moneyachievement tip';
_.onmouseover = Listview.funcBox.moneyAchievementOver;
_.onmousemove = $WH.Tooltip.cursorUpdate;
_.onmouseout = $WH.Tooltip.hide;
$WH.ae(_, $WH.ct($WH.number_format(achievementPoints)));
$WH.ae(d, _);
}
},
@@ -9283,7 +9432,7 @@ Listview.templates = {
}
if (quest.currencyrewards != null) {
Listview.funcBox.appendMoney(td, null, null, quest.side, null, quest.currencyrewards); // todo: update appendMoney ..!important!
Listview.funcBox.appendMoney(td, null, quest.side, null, quest.currencyrewards);
}
}
},
@@ -12113,7 +12262,7 @@ Listview.templates = {
value: 'points',
compute: function(achievement, td) {
if (achievement.points) {
Listview.funcBox.appendMoney(td, 0, null, 0, 0, 0, achievement.points);
Listview.funcBox.appendMoney(td, 0, null, 0, 0, achievement.points);
}
}
},
@@ -12761,7 +12910,7 @@ Listview.templates = {
tooltip: LANG.tooltip_achievementpoints,
compute: function(profile, td) {
if (profile.achievementpoints) {
Listview.funcBox.appendMoney(td, 0, null, 0, 0, 0, profile.achievementpoints);
Listview.funcBox.appendMoney(td, 0, null, 0, 0, profile.achievementpoints);
}
},
hidden: 1