removing smarty - part VII

- rewrote Item/Items
- BaseType: fixed querey generation wizh null-values in extraOpts
- ItemList:
  * reworked extendJsonStats() to use ?_itemstats istead of parsing on the fly
  * moved onUse-components used by xml from extendJsonStats() to separate function
  * the enhance-string passed with tooltips is now checked first
- Loot: class is no longer static
- Util::parseItemEnchantment() will now accept and return arrays and does only one single lookup
- cuFlags are explained in the infobox, when available
- JS:
  * do NOT strip iconStrings. It rightly can contain whitespaces >.<
  * removed a redundant $WH.ct in Conditions
This commit is contained in:
Sarjuuk
2014-06-28 14:29:39 +02:00
parent caa7a7e39f
commit 4919e1ef57
34 changed files with 2154 additions and 2043 deletions

View File

@@ -482,13 +482,13 @@ define('ITEM_CLASS_ARMOR', 4);
define('ITEM_CLASS_REAGENT', 5);
define('ITEM_CLASS_AMMUNITION', 6);
define('ITEM_CLASS_TRADEGOOD', 7);
// define('ITEM_CLASS_GENERIC', 8);
define('ITEM_CLASS_GENERIC', 8);
define('ITEM_CLASS_RECIPE', 9);
define('ITEM_CLASS_MONEY', 10);
define('ITEM_CLASS_QUIVER', 11);
define('ITEM_CLASS_QUEST', 12);
define('ITEM_CLASS_KEY', 13);
// define('ITEM_CLASS_PERMANENT', 14);
define('ITEM_CLASS_PERMANENT', 14);
define('ITEM_CLASS_MISC', 15);
define('ITEM_CLASS_GLYPH', 16);

View File

@@ -16,9 +16,9 @@ trait DetailPage
// mode, type, typeId, localeId, category, filter
$key = [$this->mode, $this->type, $this->typeId, User::$localeId, '-1', '-1'];
// check for $this->enhancedTT from Item and apply
// foreach ($extra as $x)
// $key[] = (string)$x;
// item special: can modify tooltips
if (isset($this->enhancedTT))
$key[] = md5(serialize($this->enhancedTT));
return implode('_', $key);
}
@@ -159,11 +159,12 @@ class GenericPage
$this->saveCache();
}
$this->gPageInfo = array( // varies slightly for special pages like maps, user-dashboard or profiler
'type' => $this->type,
'typeId' => $this->typeId,
'name' => $this->name
);
if (isset($this->type) && isset($this->typeId))
$this->gPageInfo = array( // varies slightly for special pages like maps, user-dashboard or profiler
'type' => $this->type,
'typeId' => $this->typeId,
'name' => $this->name
);
if (method_exists($this, 'postCache')) // e.g. update dates for events and such
$this->postCache();
@@ -258,12 +259,12 @@ class GenericPage
private function addAnnouncements() // get announcements and notes for user
{
if (!isset($this->announcements))
$this->announcements = [];
// display occured notices
if ($_ = Util::getNotes(false))
{
if (!isset($this->announcements))
$this->announcements = [];
$this->announcements[] = array(
'id' => 0,
'mode' => 1,
@@ -277,9 +278,6 @@ class GenericPage
// fetch announcements
if (preg_match('/^([a-z\-]+)=?.*$/i', $_SERVER['QUERY_STRING'], $match))
{
if (!isset($this->announcements))
$this->announcements = [];
$ann = DB::Aowow()->Select('SELECT * FROM ?_announcements WHERE status = 1 AND (page = ? OR page = "*") AND (groupMask = 0 OR groupMask & ?d)', $match[1], User::$groups);
foreach ($ann as $k => $v)
{

View File

@@ -9,14 +9,16 @@ ini_set('serialize_precision', 4);
require 'includes/defines.php';
require 'config/config.php';
require 'includes/genericPage.class.php';
require 'includes/libs/DbSimple/Generic.php'; // Libraray: http://en.dklab.ru/lib/DbSimple (using mysqli variant: https://bitbucket.org/brainreaver/dbsimple/src)
require 'includes/utilities.php';
require 'includes/ajaxHandler.class.php';
require 'includes/libs/DbSimple/Generic.php'; // Libraray: http://en.dklab.ru/lib/DbSimple (using mysqli variant: https://bitbucket.org/brainreaver/dbsimple/src)
require 'includes/utilities.php'; // misc™ data 'n func
require 'includes/ajaxHandler.class.php'; // handles ajax and jsonp requests
require 'includes/user.class.php';
require 'includes/database.class.php';
require 'includes/community.class.php';
require 'includes/database.class.php'; // wrap DBSimple
require 'includes/community.class.php'; // handle comments, screenshots and videos
require 'includes/loot.class.php'; // build lv-tabs containing loot-information
require 'localization/lang.class.php';
// autoload List-classes, associated filters and pages
spl_autoload_register(function ($class) {
$class = str_replace('Filter', '', $class);

View File

@@ -20,11 +20,12 @@ if (!defined('AOWOW_REVISION'))
class Loot
{
public static $jsGlobals = [];
public static $extraCols = [];
public $jsGlobals = [];
public $extraCols = [];
private static $results = [];
private static $lootTemplates = array(
private $entry = 0; // depending on the lookup itemId oder templateId
private $results = [];
private $lootTemplates = array(
LOOT_REFERENCE, // internal
LOOT_ITEM, // item
LOOT_DISENCHANT, // item
@@ -39,20 +40,20 @@ class Loot
LOOT_SPELL // spell
);
public static function &iterate()
public function &iterate()
{
reset(self::$results);
reset($this->results);
while (list($k, $__) = each(self::$results))
yield self::$results[$k];
while (list($k, $__) = each($this->results))
yield $this->results[$k];
}
public static function getResult()
public function getResult()
{
return self::$results;
return $this->results;
}
private static function createStack($l) // issue: TC always has an equal distribution between min/max
private function createStack($l) // issue: TC always has an equal distribution between min/max
{
if (empty($l['min']) || empty($l['max']) || $l['min'] <= $l['max'])
return null;
@@ -65,14 +66,22 @@ class Loot
return json_encode($stack, JSON_NUMERIC_CHECK);
}
private static function storeJSGlobals($data)
private function storeJSGlobals($data)
{
foreach ($data as $type => $jsData)
{
foreach ($jsData as $k => $v)
self::$jsGlobals[$type][$k] = $v;
{
// was already set at some point with full data
if (isset($this->jsGlobals[$type][$k]) && is_array($this->jsGlobals[$type][$k]))
continue;
$this->jsGlobals[$type][$k] = $v;
}
}
}
private static function getByContainerRecursive($tableName, $lootId, &$handledRefs, $groupId = 0, $baseChance = 1.0)
private function getByContainerRecursive($tableName, $lootId, &$handledRefs, $groupId = 0, $baseChance = 1.0)
{
$loot = [];
$rawItems = [];
@@ -80,7 +89,7 @@ class Loot
if (!$tableName || !$lootId)
return null;
$rows = DB::Aowow()->select('SELECT * FROM ?# WHERE entry = ?d{ AND groupid = ?d}', $tableName, abs($lootId), $groupId ? $groupId : DBSIMPLE_SKIP);
$rows = DB::Aowow()->select('SELECT * FROM ?# WHERE entry = ?d{ AND groupid = ?d}', $tableName, abs($lootId), $groupId ?: DBSIMPLE_SKIP);
if (!$rows)
return null;
@@ -164,7 +173,7 @@ class Loot
}
else // shouldn't have happened
{
self::addNote(U_GROUP_EMPLOYEE, 'Loot::getByContainerRecursive: unhandled case in calculating chance for item '.$entry['item'].'!');
Util::addNote(U_GROUP_EMPLOYEE, 'Loot::getByContainerRecursive: unhandled case in calculating chance for item '.$entry['item'].'!');
continue;
}
@@ -178,7 +187,7 @@ class Loot
$sum = 0;
else if ($sum > 100)
{
self::addNote(U_GROUP_EMPLOYEE, 'Loot::getByContainerRecursive: entry '.$lootId.' / group '.$k.' has a total chance of '.number_format($sum, 2).'%. Some items cannot drop!');
Util::addNote(U_GROUP_EMPLOYEE, 'Loot::getByContainerRecursive: entry '.$lootId.' / group '.$k.' has a total chance of '.number_format($sum, 2).'%. Some items cannot drop!');
$sum = 100;
}
@@ -190,11 +199,11 @@ class Loot
return [$loot, array_unique($rawItems)];
}
public static function getByContainer($table, $entry)
public function getByContainer($table, $entry)
{
$loot = null;
$this->entry = intVal($entry);
if (!$table || !$entry)
if (!in_array($table, $this->lootTemplates) || !$this->entry)
return null;
/*
@@ -202,19 +211,19 @@ class Loot
also
// if (is_array($entry) && in_array($table, [LOOT_CREATURE, LOOT_GAMEOBJECT])
// if (is_array($this->entry) && in_array($table, [LOOT_CREATURE, LOOT_GAMEOBJECT])
// iterate over the 4 available difficulties and assign modes
modes:{"mode":1,"1":{"count":4408,"outof":16013},"4":{"count":4408,"outof":22531}}
*/
$handledRefs = [];
$struct = self::getByContainerRecursive($table, $entry, $handledRefs);
$struct = self::getByContainerRecursive($table, $this->entry, $handledRefs);
if (!$struct)
return false;
$items = new ItemList(array(['i.id', $struct[1]], CFG_SQL_LIMIT_NONE));
self::$jsGlobals = $items->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED);
$this->jsGlobals = $items->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED);
$foo = $items->getListviewData();
// assign listview LV rows to loot rows, not the other way round! The same item may be contained multiple times
@@ -240,13 +249,13 @@ class Loot
{
if (!User::isInGroup(U_GROUP_STAFF))
{
if (!isset(self::$results[$loot['content']]))
self::$results[$loot['content']] = array_merge($foo[$loot['content']], $base, ['stack' => [$loot['min'], $loot['max']]]);
if (!isset($this->results[$loot['content']]))
$this->results[$loot['content']] = array_merge($foo[$loot['content']], $base, ['stack' => [$loot['min'], $loot['max']]]);
else
self::$results[$loot['content']]['percent'] += $base['percent'];
$this->results[$loot['content']]['percent'] += $base['percent'];
}
else // in case of limited trash loot, check if $foo[<itemId>] exists
self::$results[] = array_merge($foo[$loot['content']], $base, ['stack' => [$loot['min'], $loot['max']]]);
$this->results[] = array_merge($foo[$loot['content']], $base, ['stack' => [$loot['min'], $loot['max']]]);
}
else if (User::isInGroup(U_GROUP_STAFF)) // create dummy for ref-drop
{
@@ -256,16 +265,16 @@ class Loot
'icon' => 'trade_engineering',
'stack' => [$loot['multiplier'], $loot['multiplier']]
);
self::$results[] = array_merge($base, $data);
$this->results[] = array_merge($base, $data);
self::$jsGlobals[TYPE_ITEM][$loot['content']] = $data;
$this->jsGlobals[TYPE_ITEM][$loot['content']] = $data;
}
}
// move excessive % to extra loot
if (!User::isInGroup(U_GROUP_STAFF))
{
foreach (self::$results as &$_)
foreach ($this->results as &$_)
{
if ($_['percent'] <= 100)
continue;
@@ -286,7 +295,7 @@ class Loot
$fields = ['mode', 'reference'];
$base = [];
$set = 0;
foreach (self::$results as $foo)
foreach ($this->results as $foo)
{
foreach ($fields as $idx => $field)
{
@@ -300,19 +309,21 @@ class Loot
break;
}
self::$extraCols[] = "Listview.funcBox.createSimpleCol('group', 'Group', '7%', 'group')";
$this->extraCols[] = "Listview.funcBox.createSimpleCol('group', 'Group', '7%', 'group')";
foreach ($fields as $idx => $field)
if ($set & (1 << $idx))
self::$extraCols[] = "Listview.funcBox.createSimpleCol('".$field."', '".Util::ucFirst($field)."', '7%', '".$field."')";
$this->extraCols[] = "Listview.funcBox.createSimpleCol('".$field."', '".Util::ucFirst($field)."', '7%', '".$field."')";
}
return true;
}
public static function getByItem($itemId, $maxResults = CFG_SQL_LIMIT_DEFAULT)
public function getByItem($entry, $maxResults = CFG_SQL_LIMIT_DEFAULT)
{
if (!$itemId)
return [];
$this->entry = intVal($entry);
if (!$this->entry)
return false;
// [fileName, tabData, tabName, tabId, extraCols, hiddenCols, visibleCols]
$tabsFinal = array(
@@ -364,15 +375,15 @@ class Loot
{
// check for possible database inconsistencies
if (!$ref['chance'] && !$ref['isGrouped'])
self::addNote(U_GROUP_EMPLOYEE, 'Loot by Item: ungrouped Item/Ref '.$ref['item'].' has 0% chance assigned!');
Util::addNote(U_GROUP_EMPLOYEE, 'Loot by Item: ungrouped Item/Ref '.$ref['item'].' has 0% chance assigned!');
if ($ref['isGrouped'] && $ref['sumChance'] > 100)
self::addNote(U_GROUP_EMPLOYEE, 'Loot by Item: group with Item/Ref '.$ref['item'].' has '.number_format($ref['sumChance'], 2).'% total chance! Some items cannot drop!');
Util::addNote(U_GROUP_EMPLOYEE, 'Loot by Item: group with Item/Ref '.$ref['item'].' has '.number_format($ref['sumChance'], 2).'% total chance! Some items cannot drop!');
if ($ref['isGrouped'] && $ref['sumChance'] == 100 && !$ref['chance'])
self::addNote(U_GROUP_EMPLOYEE, 'Loot by Item: Item/Ref '.$ref['item'].' with adaptive chance cannot drop. Group already at 100%!');
Util::addNote(U_GROUP_EMPLOYEE, 'Loot by Item: Item/Ref '.$ref['item'].' with adaptive chance cannot drop. Group already at 100%!');
$chance = abs($ref['chance'] ? $ref['chance'] : (100 - $ref['sumChance']) / $ref['nZeroItems']) / 100;
$chance = abs($ref['chance'] ?: (100 - $ref['sumChance']) / $ref['nZeroItems']) / 100;
// apply inherited chanceMods
if (isset($chanceMods[$ref['item']]))
@@ -390,7 +401,7 @@ class Loot
$data = array(
'percent' => $chance,
'stack' => [$ref['min'], $ref['max']],
'count' => 1 // ..and one for the sort script
'count' => 1 // ..and one for the sort script
);
if ($_ = self::createStack($ref))
@@ -416,7 +427,7 @@ class Loot
$newRefs = DB::Aowow()->select(
sprintf($query, 'lt1.item = ?d AND lt1.mincountOrRef > 0'),
LOOT_REFERENCE, LOOT_REFERENCE,
$itemId
$this->entry
);
while ($newRefs)
@@ -434,13 +445,13 @@ class Loot
/*
search the real loot-templates for the itemId and gathered refds
*/
for ($i = 1; $i < count(self::$lootTemplates); $i++)
for ($i = 1; $i < count($this->lootTemplates); $i++)
{
$result = $calcChance(DB::Aowow()->select(
sprintf($query, '{lt1.mincountOrRef IN (?a) OR }(lt1.mincountOrRef > 0 AND lt1.item = ?d)'),
self::$lootTemplates[$i], self::$lootTemplates[$i],
$this->lootTemplates[$i], $this->lootTemplates[$i],
$refResults ? array_keys($refResults) : DBSIMPLE_SKIP,
$itemId
$this->entry
));
// do not skip here if $result is empty. Additional loot for spells and quest is added separately
@@ -457,7 +468,7 @@ class Loot
// screws with GO-loot and skinnig-loot as these templates are shared for several tabs (fish, herb, ore) (herb, ore, leather)
$ids = array_slice(array_keys($result), 0, $maxResults);
switch (self::$lootTemplates[$i])
switch ($this->lootTemplates[$i])
{
case LOOT_CREATURE: $field = 'lootId'; $tabId = 4; break;
case LOOT_PICKPOCKET: $field = 'pickpocketLootId'; $tabId = 5; break;
@@ -494,8 +505,8 @@ class Loot
}
break;
case LOOT_MAIL:
$conditions = array(['rewardChoiceItemId1', $itemId], ['rewardChoiceItemId2', $itemId], ['rewardChoiceItemId3', $itemId], ['rewardChoiceItemId4', $itemId], ['rewardChoiceItemId5', $itemId],
['rewardChoiceItemId6', $itemId], ['rewardItemId1', $itemId], ['rewardItemId2', $itemId], ['rewardItemId3', $itemId], ['rewardItemId4', $itemId],
$conditions = array(['rewardChoiceItemId1', $this->entry], ['rewardChoiceItemId2', $this->entry], ['rewardChoiceItemId3', $this->entry], ['rewardChoiceItemId4', $this->entry], ['rewardChoiceItemId5', $this->entry],
['rewardChoiceItemId6', $this->entry], ['rewardItemId1', $this->entry], ['rewardItemId2', $this->entry], ['rewardItemId3', $this->entry], ['rewardItemId4', $this->entry],
'OR');
if ($ids)
$conditions[] = ['rewardMailTemplateId', $ids];
@@ -517,7 +528,7 @@ class Loot
break;
case LOOT_SPELL:
$conditions = ['OR', ['effect1CreateItemId', $itemId], ['effect2CreateItemId', $itemId], ['effect3CreateItemId', $itemId]];
$conditions = ['OR', ['effect1CreateItemId', $this->entry], ['effect2CreateItemId', $this->entry], ['effect3CreateItemId', $this->entry]];
if ($ids)
$conditions[] = ['id', $ids];
@@ -573,7 +584,9 @@ class Loot
}
}
return $tabsFinal;
$this->results = $tabsFinal;
return true;
}
}

View File

@@ -233,16 +233,16 @@ abstract class BaseType
$this->queryBase .= ' WHERE ('.implode($linking, $where).')';
// append grouping
if ($g = array_column($this->queryOpts, 'g'))
$this->queryBase .= ' GROUP BY '.implode(', ', array_filter($g));
if ($g = array_filter(array_column($this->queryOpts, 'g')))
$this->queryBase .= ' GROUP BY '.implode(', ', $g);
// append post filtering
if ($h = array_column($this->queryOpts, 'h'))
$this->queryBase .= ' HAVING '.implode(' AND ', array_filter($h));
if ($h = array_filter(array_column($this->queryOpts, 'h')))
$this->queryBase .= ' HAVING '.implode(' AND ', $h);
// append ordering
if ($o = array_column($this->queryOpts, 'o'))
$this->queryBase .= ' ORDER BY '.implode(', ', array_filter($o));
if ($o = array_filter(array_column($this->queryOpts, 'o')))
$this->queryBase .= ' ORDER BY '.implode(', ', $o);
// apply limit
if ($limit)

View File

@@ -22,11 +22,11 @@ class ItemList extends BaseType
private $vendors = [];
private $jsGlobals = []; // getExtendedCost creates some and has no access to template
protected $queryBase = 'SELECT i.*, i.id AS ARRAY_KEY FROM ?_items i';
protected $queryBase = 'SELECT i.*, `is`.*, i.id AS ARRAY_KEY FROM ?_items i';
protected $queryOpts = array(
'is' => ['j' => '?_item_stats AS `is` ON `is`.`id` = `i`.`id`', 'o' => 'score DESC'],
'is' => ['j' => ['?_item_stats AS `is` ON `is`.`id` = `i`.`id`', true]],
's' => ['j' => ['?_spell AS `s` ON s.effect1CreateItemId = i.id', true], 'g' => 'i.id'],
'i' => ['o' => 'i.quality DESC, i.itemLevel DESC']
'i' => [['is'], 'o' => 'i.quality DESC, i.itemLevel DESC']
);
public function __construct($conditions = [], $miscData = null)
@@ -230,12 +230,12 @@ class ItemList extends BaseType
if ($addInfoMask & ITEMINFO_SUBITEMS)
$this->initSubItems();
if ($addInfoMask & ITEMINFO_JSON)
$this->extendJsonStats();
$data = [];
foreach ($this->iterate() as $__)
{
if ($addInfoMask & ITEMINFO_JSON)
$this->extendJsonStats();
foreach ($this->json[$this->id] as $k => $v)
$data[$this->id][$k] = $v;
@@ -246,7 +246,7 @@ class ItemList extends BaseType
if ($addInfoMask & ITEMINFO_JSON)
{
foreach ($this->itemMods[$this->id] as $k => $v)
$data[$this->id][Util::$itemMods[$k]] = $v;
$data[$this->id][$k] = $v;
if ($_ = intVal(($this->curTpl['minMoneyLoot'] + $this->curTpl['maxMoneyLoot']) / 2))
$data[$this->id]['avgmoney'] = $_;
@@ -269,8 +269,7 @@ class ItemList extends BaseType
{
// just use the first results
// todo (med): dont use first result; search for the right one
$cost = @reset($this->getExtendedCost($miscData)[$this->id]);
if ($cost)
if ($cost = @reset($this->getExtendedCost($miscData)[$this->id]))
{
$currency = [];
$tokens = [];
@@ -386,8 +385,8 @@ class ItemList extends BaseType
{
$extra[$id] = array(
'id' => $id,
'tooltip' => Util::jsEscape($this->renderTooltip(null, true)),
'spells' => ''
'tooltip' => $this->renderTooltip(true),
'spells' => new StdClass // placeholder for knownSpells
);
}
}
@@ -404,7 +403,7 @@ class ItemList extends BaseType
interactive (set to place javascript/anchors to manipulate level and ratings or link to filters (static tooltips vs popup tooltip))
subOf (tabled layout doesn't work if used as sub-tooltip in other item or spell tooltips; use line-break instead)
*/
public function renderTooltip($enhance = [], $interactive = false, $subOf = 0)
public function renderTooltip($interactive = false, $subOf = 0, $enhance = [])
{
if ($this->error)
return;
@@ -421,30 +420,34 @@ class ItemList extends BaseType
$_slot = $this->curTpl['slot'];
$causesScaling = false;
if (!empty($enhance['rand']))
if (!empty($enhance['r']))
{
$rndEnch = DB::Aowow()->selectRow('SELECT * FROM ?_itemrandomenchant WHERE Id = ?d', $enhance['rand']);
$_name .= ' '.Util::localizedString($rndEnch, 'name');
$randEnchant = '';
for ($i = 1; $i < 6; $i++)
if ($rndEnch = DB::Aowow()->selectRow('SELECT * FROM ?_itemrandomenchant WHERE Id = ?d', $enhance['r']))
{
if ($rndEnch['enchantId'.$i] <= 0)
continue;
$_name .= ' '.Util::localizedString($rndEnch, 'name');
$randEnchant = '';
$enchant = DB::Aowow()->selectRow('SELECT * FROM ?_itemenchantment WHERE Id = ?d', $rndEnch['enchantId'.$i]);
if ($rndEnch['allocationPct'.$i] > 0)
for ($i = 1; $i < 6; $i++)
{
$amount = intVal($rndEnch['allocationPct'.$i] * $this->generateEnchSuffixFactor());
$randEnchant .= '<span>'.str_replace('$i', $amount, Util::localizedString($enchant, 'text')).'</span><br />';
if ($rndEnch['enchantId'.$i] <= 0)
continue;
$enchant = DB::Aowow()->selectRow('SELECT * FROM ?_itemenchantment WHERE Id = ?d', $rndEnch['enchantId'.$i]);
if ($rndEnch['allocationPct'.$i] > 0)
{
$amount = intVal($rndEnch['allocationPct'.$i] * $this->generateEnchSuffixFactor());
$randEnchant .= '<span>'.str_replace('$i', $amount, Util::localizedString($enchant, 'text')).'</span><br />';
}
else
$randEnchant .= '<span>'.Util::localizedString($enchant, 'text').'</span><br />';
}
else
$randEnchant .= '<span>'.Util::localizedString($enchant, 'text').'</span><br />';
}
else
unset($enhance['r']);
}
if (isset($enhance['sock']) && !in_array($_slot, [INVTYPE_WRISTS, INVTYPE_WAIST, INVTYPE_HANDS]))
unset($enhance['sock']);
if (isset($enhance['s']) && !in_array($_slot, [INVTYPE_WRISTS, INVTYPE_WAIST, INVTYPE_HANDS]))
unset($enhance['s']);
// IMPORTAT: DO NOT REMOVE THE HTML-COMMENTS! THEY ARE REQUIRED TO UPDATE THE TOOLTIP CLIENTSIDE
$x = '';
@@ -500,12 +503,12 @@ class ItemList extends BaseType
else if ($this->curTpl['itemLimitCategory'])
{
$limit = DB::Aowow()->selectRow("SELECT * FROM ?_itemlimitcategory WHERE id = ?", $this->curTpl['itemLimitCategory']);
$x .= '<br />'.($limit['isGem'] ? Lang::$item['uniqueEquipped'] : Lang::$item['unique']).Lang::$colon.Util::localizedString($limit, 'name').' ('.$limit['count'].')';
$x .= '<br />'.($limit['isGem'] ? Lang::$item['uniqueEquipped'] : Lang::$item['unique']).Lang::$main['colon'].Util::localizedString($limit, 'name').' ('.$limit['count'].')';
}
// max duration
if ($dur = $this->curTpl['duration'])
$x .= "<br />".Lang::$game['duration'].Lang::$colon.Util::formatTime(abs($dur) * 1000).($this->curTpl['flagsCustom'] & 0x1 ? ' ('.Lang::$item['realTime'].')' : null);
$x .= "<br />".Lang::$game['duration'].Lang::$main['colon'].Util::formatTime(abs($dur) * 1000).($this->curTpl['flagsCustom'] & 0x1 ? ' ('.Lang::$item['realTime'].')' : null);
// required holiday
if ($hId = $this->curTpl['holidayId'])
@@ -607,9 +610,9 @@ class ItemList extends BaseType
}
// Random Enchantment - if random enchantment is set, prepend stats from it
if ($this->curTpl['randomEnchant'] && !isset($enhance['rand']))
if ($this->curTpl['randomEnchant'] && !isset($enhance['r']))
$x .= '<span class="q2">'.Lang::$item['randEnchant'].'</span><br />';
else if (isset($enhance['rand']))
else if (isset($enhance['r']))
$x .= $randEnchant;
// itemMods (display stats and save ratings for later use)
@@ -634,41 +637,36 @@ class ItemList extends BaseType
$x .= '+'.$this->curTpl[$rowName].' '.Lang::$game['resistances'][$j].'<br />';
// Enchantment
if (isset($enhance['ench']))
if (isset($enhance['e']))
{
$enchText = DB::Aowow()->selectRow('SELECT * FROM ?_itemenchantment WHERE Id = ?', $enhance['ench']);
$x .= '<span class="q2"><!--e-->'.Util::localizedString($enchText, 'text').'</span><br />';
if ($enchText = DB::Aowow()->selectRow('SELECT * FROM ?_itemenchantment WHERE Id = ?', $enhance['e']))
$x .= '<span class="q2"><!--e-->'.Util::localizedString($enchText, 'text').'</span><br />';
else
{
unset($enhance['e']);
$x .= '<!--e-->';
}
}
else // enchantment placeholder
$x .= '<!--e-->';
// Sockets w/ Gems
if (!empty($enhance['gems']))
if (!empty($enhance['g']))
{
$gems = DB::Aowow()->select('
SELECT
i.id AS ARRAY_KEY,
i.iconString,
ae.*,
i.gemColorMask AS colorMask
FROM
?_items i
JOIN
?_itemenchantment ae ON ae.id = i.gemEnchantmentId
WHERE
i.id IN (?a)',
$enhance['gems']
);
$gems = DB::Aowow()->select('SELECT i.id AS ARRAY_KEY, i.iconString, ae.*, i.gemColorMask AS colorMask FROM ?_items i JOIN ?_itemenchantment ae ON ae.id = i.gemEnchantmentId WHERE i.id IN (?a)', $enhance['g']);
foreach ($enhance['g'] as $k => $v)
if (!in_array(array_keys($gems), $v))
unset($enhance['g'][$k]);
}
else
$enhance['gems'] = [];
$enhance['g'] = [];
// zero fill empty sockets
$sockCount = $this->curTpl['socketColor1'] + $this->curTpl['socketColor2'] + $this->curTpl['socketColor3'] + (isset($enhance['sock']) ? 1 : 0);
while ($sockCount > count($enhance['gems']))
$enhance['gems'][] = 0;
$sockCount = $this->curTpl['socketColor1'] + $this->curTpl['socketColor2'] + $this->curTpl['socketColor3'] + (isset($enhance['s']) ? 1 : 0);
while ($sockCount > count($enhance['g']))
$enhance['g'][] = 0;
$enhance['gems'] = array_reverse($enhance['gems']);
$enhance['g'] = array_reverse($enhance['g']);
$hasMatch = 1;
// fill native sockets
@@ -681,7 +679,7 @@ class ItemList extends BaseType
if (($this->curTpl['socketColor'.$j] & (1 << $i)))
$colorId = $i;
$pop = array_pop($enhance['gems']);
$pop = array_pop($enhance['g']);
$col = $pop ? 1 : 0;
$hasMatch &= $pop ? (($gems[$pop]['colorMask'] & (1 << $colorId)) ? 1 : 0) : 0;
$icon = $pop ? sprintf(Util::$bgImagePath['tiny'], STATIC_URL, strtolower($gems[$pop]['iconString'])) : null;
@@ -694,9 +692,9 @@ class ItemList extends BaseType
}
// fill extra socket
if (isset($enhance['sock']))
if (isset($enhance['s']))
{
$pop = array_pop($enhance['gems']);
$pop = array_pop($enhance['g']);
$col = $pop ? 1 : 0;
$icon = $pop ? sprintf(Util::$bgImagePath['tiny'], STATIC_URL, strtolower($gems[$pop]['iconString'])) : null;
$text = $pop ? Util::localizedString($gems[$pop], 'text') : Lang::$item['socket'][-1];
@@ -712,7 +710,7 @@ class ItemList extends BaseType
if ($this->curTpl['socketBonus'])
{
$sbonus = DB::Aowow()->selectRow('SELECT * FROM ?_itemenchantment WHERE Id = ?d', $this->curTpl['socketBonus']);
$x .= '<span class="q'.($hasMatch ? '2' : '0').'">'.Lang::$item['socketBonus'].Lang::$colon.Util::localizedString($sbonus, 'text').'</span><br />';
$x .= '<span class="q'.($hasMatch ? '2' : '0').'">'.Lang::$item['socketBonus'].Lang::$main['colon'].Util::localizedString($sbonus, 'text').'</span><br />';
}
// durability
@@ -721,12 +719,12 @@ class ItemList extends BaseType
// required classes
if ($classes = Lang::getClassString($this->curTpl['requiredClass']))
$x .= Lang::$game['classes'].Lang::$colon.$classes.'<br />';
$x .= Lang::$game['classes'].Lang::$main['colon'].$classes.'<br />';
// required races
if ($races = Lang::getRaceString($this->curTpl['requiredRace']))
if ($races != Lang::$game['ra'][0]) // not "both", but display combinations like: troll, dwarf
$x .= Lang::$game['races'].Lang::$colon.$races.'<br />';
$x .= Lang::$game['races'].Lang::$main['colon'].$races.'<br />';
// required honorRank (not used anymore)
if ($rhr = $this->curTpl['requiredHonorRank'])
@@ -920,7 +918,7 @@ class ItemList extends BaseType
$craftItem = new ItemList(array(['i.id', (int)$craftSpell->curTpl['effect1CreateItemId']]));
if (!$craftItem->error)
{
if ($itemTT = $craftItem->renderTooltip(null, $interactive, $this->id))
if ($itemTT = $craftItem->renderTooltip($interactive, $this->id))
$xCraft .= '<div><br />'.$itemTT.'</div>';
$reagentItems = [];
@@ -970,7 +968,7 @@ class ItemList extends BaseType
$x .= implode('<br />', $xMisc);
if ($sp = $this->curTpl['sellPrice'])
$x .= '<div class="q1 whtt-sellprice">'.Lang::$item['sellPrice'].Lang::$colon.Util::formatMoney($sp).'</div>';
$x .= '<div class="q1 whtt-sellprice">'.Lang::$item['sellPrice'].Lang::$main['colon'].Util::formatMoney($sp).'</div>';
if (!$subOf)
$x .= '</td></tr></table>';
@@ -1078,65 +1076,75 @@ class ItemList extends BaseType
public function extendJsonStats()
{
$onUseStats = [];
$enchantments = []; // buffer Ids for lookup id => src; src>0: socketBonus; src<0: gemEnchant
// convert ItemMods
$this->itemMods[$this->id] = [];
for ($h = 1; $h <= 10; $h++)
foreach ($this->iterate() as $__)
{
$mod = $this->curTpl['statType'.$h];
$val = $this->curTpl['statValue'.$h];
if (!$mod || !$val)
continue;
$this->itemMods[$this->id] = [];
@$this->itemMods[$this->id][$mod] += $val;
foreach (Util::$itemMods as $mod)
if (!empty($this->curTpl[$mod]))
@$this->itemMods[$this->id][$mod] += $this->curTpl[$mod];
// fetch and add socketbonusstats
if (@$this->json[$this->id]['socketbonus'] > 0)
$enchantments[$this->json[$this->id]['socketbonus']][] = $this->id;
// Item is a gem (don't mix with sockets)
if ($geId = $this->curTpl['gemEnchantmentId'])
$enchantments[$geId][] = -$this->id;
}
if ($enchantments)
{
$parsed = Util::parseItemEnchantment(array_keys($enchantments));
// and merge enchantments back
foreach ($parsed as $eId => $stats)
{
foreach ($enchantments[$eId] as $item)
{
if ($item > 0) // apply socketBonus
$this->json[$item]['socketbonusstat'] = $stats;
else /* if ($item < 0) */
foreach ($stats as $mod => $qty) // apply gemEnchantment
@$this->json[-$item][$mod] += $qty;
}
}
}
foreach ($this->json as $item => $json)
foreach ($json as $k => $v)
if (!$v && !in_array($k, ['classs', 'subclass', 'quality', 'side']))
unset($this->json[$item][$k]);
}
public function getOnUseStats()
{
$onUseStats = [];
// convert Spells
$equipSpells = [];
$useSpells = [];
for ($h = 1; $h <= 5; $h++)
{
if ($this->curTpl['spellId'.$h] <= 0)
continue;
// armor & weapons only onEquip && consumables only onUse
if (!(in_array($this->curTpl['class'], [ITEM_CLASS_WEAPON, ITEM_CLASS_ARMOR]) && $this->curTpl['spellTrigger'.$h] == 1) &&
!( $this->curTpl['class'] == ITEM_CLASS_CONSUMABLE && $this->curTpl['spellTrigger'.$h] == 0))
if ($this->curTpl['class'] != ITEM_CLASS_CONSUMABLE || $this->curTpl['spellTrigger'.$h])
continue;
$equipSpells[] = $this->curTpl['spellId'.$h];
$useSpells[] = $this->curTpl['spellId'.$h];
}
if ($equipSpells)
if ($useSpells)
{
$eqpSplList = new SpellList(array(['s.id', $equipSpells]));
$eqpSplList = new SpellList(array(['s.id', $useSpells]));
foreach ($eqpSplList->getStatGain() as $stat)
{
foreach ($stat as $mId => $qty)
{
@$this->itemMods[$this->id][$mId] += $qty;
if ($this->curTpl['class'] == ITEM_CLASS_CONSUMABLE)
@$onUseStats[$mId] += $qty;
}
}
@$onUseStats[$mId] += $qty;
}
// fetch and add socketbonusstats
if (@$this->json[$this->id]['socketbonus'] > 0)
$this->json[$this->id]['socketbonusstat'] = Util::parseItemEnchantment($this->json[$this->id]['socketbonus']);
// Item is a gem (don't mix with sockets)
if ($geId = $this->curTpl['gemEnchantmentId'])
{
$gemStats = Util::parseItemEnchantment($geId);
foreach ($gemStats as $mod => $qty)
@$this->json[$this->id][$mod] += $qty;
}
foreach ($this->json[$this->id] as $k => $v)
if (!isset($v) || $v === "false" || (!in_array($k, ['classs', 'subclass', 'quality', 'side']) && $v == "0"))
unset($this->json[$this->id][$k]);
return $onUseStats;
}
@@ -1296,7 +1304,7 @@ class ItemList extends BaseType
{
$stats = Util::parseItemEnchantment($enchId, false, $misc);
$this->rndEnchIds[$enchId] = array(
'text' => $misc['name'],
'text' => $misc[$enchId]['name'],
'stats' => $stats
);
}
@@ -1398,7 +1406,7 @@ class ItemList extends BaseType
// clear zero-values afterwards
foreach ($json as $k => $v)
if (!isset($v) || $v === "false" || (!in_array($k, ['classs', 'subclass', 'quality', 'side']) && $v == "0"))
if (!$v && !in_array($k, ['classs', 'subclass', 'quality', 'side']))
unset($json[$k]);
$this->json[$json['id']] = $json;
@@ -1618,7 +1626,8 @@ class ItemListFilter extends Filter
if ($select)
{
$this->extraOpts['is']['s'][] = ', ('.implode(' + ', $select).') / '.$wtSum.' AS score';
$this->extraOpts['is']['s'][] = ', IF(is.id IS NULL, 0, ('.implode(' + ', $select).') / '.$wtSum.') AS score';
$this->extraOpts['is']['o'][] = 'score DESC';
$this->extraOpts['i']['o'][] = null; // remove default ordering
}
else

View File

@@ -1090,103 +1090,107 @@ class Util
// 8 => TYPE_PRISMATIC_SOCKET Extra Sockets AmountX as socketCount (ignore)
public static function parseItemEnchantment($ench, $raw = false, &$misc = null)
{
$enchant = [];
if (is_numeric($ench))
$enchant = DB::Aowow()->selectRow('SELECT *, Id AS ARRAY_KEY FROM ?_itemenchantment WHERE Id = ?d', $ench);
else if (is_array($ench))
$enchant = $ench;
if (!$enchant)
if (!$ench)
return [];
$misc = array(
'name' => self::localizedString($enchant, 'text'),
'text' => array(
'text_loc0' => $enchant['text_loc0'],
'text_loc2' => $enchant['text_loc2'],
'text_loc3' => $enchant['text_loc3'],
'text_loc6' => $enchant['text_loc6'],
'text_loc8' => $enchant['text_loc8']
)
);
if (is_numeric($ench))
$ench = [$ench];
if ($enchant['skillLine'] > 0)
$misc['reqskill'] = $enchant['skillLine'];
if (!is_array($ench))
return [];
if ($enchant['skillLevel'] > 0)
$misc['reqskillrank'] = $enchant['skillLevel'];
$enchants = DB::Aowow()->select('SELECT *, Id AS ARRAY_KEY FROM ?_itemenchantment WHERE id IN (?a)', $ench);
if (!$enchants)
return [];
if ($enchant['requiredLevel'] > 0)
$misc['reqlevel'] = $enchant['requiredLevel'];
// parse stats
$jsonStats = [];
for ($h = 1; $h <= 3; $h++)
$result = [];
foreach ($enchants as $eId => $e)
{
$obj = (int)$enchant['object'.$h];
$val = (int)$enchant['amount'.$h];
$misc[$eId] = array(
'name' => self::localizedString($e, 'text'),
'text' => array(
'text_loc0' => $e['text_loc0'],
'text_loc2' => $e['text_loc2'],
'text_loc3' => $e['text_loc3'],
'text_loc6' => $e['text_loc6'],
'text_loc8' => $e['text_loc8']
)
);
switch ($enchant['type'.$h])
if ($e['skillLine'] > 0)
$misc[$eId]['reqskill'] = $e['skillLine'];
if ($e['skillLevel'] > 0)
$misc[$eId]['reqskillrank'] = $e['skillLevel'];
if ($e['requiredLevel'] > 0)
$misc[$eId]['reqlevel'] = $e['requiredLevel'];
// parse stats
$jsonStats = [];
for ($h = 1; $h <= 3; $h++)
{
case 2:
@$jsonStats[ITEM_MOD_WEAPON_DMG] += $val;
break;
case 3:
case 7:
$spl = new SpellList(array(['s.id', $obj]));
if ($spl->error)
$obj = (int)$e['object'.$h];
$val = (int)$e['amount'.$h];
switch ($e['type'.$h])
{
case 2:
@$jsonStats[ITEM_MOD_WEAPON_DMG] += $val;
break;
case 3:
case 7:
$spl = new SpellList(array(['s.id', $obj]));
if ($spl->error)
break;
$gains = $spl->getStatGain();
$gains = $spl->getStatGain();
foreach ($gains as $gain)
foreach ($gain as $k => $v) // array_merge screws up somehow...
@$jsonStats[$k] += $v;
break;
case 4:
switch ($obj)
{
case 0: // Physical
@$jsonStats[ITEM_MOD_ARMOR] += $val;
break;
case 1: // Holy
@$jsonStats[ITEM_MOD_HOLY_RESISTANCE] += $val;
break;
case 2: // Fire
@$jsonStats[ITEM_MOD_FIRE_RESISTANCE] += $val;
break;
case 3: // Nature
@$jsonStats[ITEM_MOD_NATURE_RESISTANCE] += $val;
break;
case 4: // Frost
@$jsonStats[ITEM_MOD_FROST_RESISTANCE] += $val;
break;
case 5: // Shadow
@$jsonStats[ITEM_MOD_SHADOW_RESISTANCE] += $val;
break;
case 6: // Arcane
@$jsonStats[ITEM_MOD_ARCANE_RESISTANCE] += $val;
break;
}
break;
case 5:
@$jsonStats[$obj] += $val;
break;
foreach ($gains as $gain)
foreach ($gain as $k => $v) // array_merge screws up somehow...
@$jsonStats[$k] += $v;
break;
case 4:
switch ($obj)
{
case 0: // Physical
@$jsonStats[ITEM_MOD_ARMOR] += $val;
break;
case 1: // Holy
@$jsonStats[ITEM_MOD_HOLY_RESISTANCE] += $val;
break;
case 2: // Fire
@$jsonStats[ITEM_MOD_FIRE_RESISTANCE] += $val;
break;
case 3: // Nature
@$jsonStats[ITEM_MOD_NATURE_RESISTANCE] += $val;
break;
case 4: // Frost
@$jsonStats[ITEM_MOD_FROST_RESISTANCE] += $val;
break;
case 5: // Shadow
@$jsonStats[ITEM_MOD_SHADOW_RESISTANCE] += $val;
break;
case 6: // Arcane
@$jsonStats[ITEM_MOD_ARCANE_RESISTANCE] += $val;
break;
}
break;
case 5:
@$jsonStats[$obj] += $val;
break;
}
}
if ($raw)
$result[$eId] = $jsonStats;
else
foreach ($jsonStats as $k => $v) // check if we use these mods
if ($str = Util::$itemMods[$k])
$result[$eId][$str] = $v;
}
if ($raw)
return $jsonStats;
// check if we use these mods
$return = [];
foreach ($jsonStats as $k => $v)
{
if ($str = Util::$itemMods[$k])
$return[$str] = $v;
}
return $return;
return $result;
}
// default ucFirst doesn't convert UTF-8 chars

View File

@@ -77,7 +77,7 @@ class AchievementPage extends GenericPage
/* Infobox */
/***********/
$infobox = [];
$infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
// points
if ($_ = $this->subject->getField('points'))
@@ -397,7 +397,7 @@ class AchievementPage extends GenericPage
protected function generateTooltip($asError = false)
{
if ($asError)
die('$WowheadPower.registerAchievement('.$this->typeId.', '.User::$localeId.', {});');
return '$WowheadPower.registerAchievement('.$this->typeId.', '.User::$localeId.', {});';
$x = '$WowheadPower.registerAchievement('.$this->typeId.', '.User::$localeId.",{\n";
$x .= "\tname_".User::$localeString.": '".Util::jsEscape($this->subject->getField('name', true))."',\n";

View File

@@ -43,7 +43,7 @@ class ClassPage extends GenericPage
protected function generateContent()
{
$infobox = [];
$infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
$_mask = 1 << ($this->typeId - 1);
$tcClassId = [null, 8, 3, 1, 5, 4, 9, 6, 2, 7, null, 0]; // see TalentCalc.js

View File

@@ -49,17 +49,18 @@ class CurrencyPage extends GenericPage
/* Infobox */
/**********/
$infobox = '';
$infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
if ($this->typeId == 103) // Arena Points
$infobox = '[ul][li]'.Lang::$currency['cap'].Lang::$main['colon'].'10\'000[/li][/ul]';
$infobox[] = Lang::$currency['cap'].Lang::$main['colon'].'10\'000';
else if ($this->typeId == 104) // Honor
$infobox = '[ul][li]'.Lang::$currency['cap'].Lang::$main['colon'].'75\'000[/li][/ul]';
$infobox[] = Lang::$currency['cap'].Lang::$main['colon'].'75\'000';
/****************/
/* Main Content */
/****************/
$this->infobox = $infobox;
$this->infobox = '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]';
$this->name = $this->subject->getField('name', true);
$this->headIcons = $this->typeId == 104 ? ['inv_bannerpvp_02', 'inv_bannerpvp_01'] : [$this->subject->getField('iconString')];
$this->redButtons = array(
@@ -73,26 +74,28 @@ class CurrencyPage extends GenericPage
if (!$_isSpecial)
{
include 'includes/loot.class.php';
// tabs: this currency is contained in..
$lootTabs = Loot::getByItem($_itemId);
$this->extendGlobalData(Loot::$jsGlobals);
$lootTabs = new Loot();
foreach ($lootTabs as $tab)
if ($lootTabs->getByItem($_itemId))
{
$this->lvData[] = array(
'file' => $tab[0],
'data' => $tab[1],
'params' => [
'tabs' => '$tabsRelated',
'name' => $tab[2],
'id' => $tab[3],
'extraCols' => $tab[4] ? '$['.implode(', ', array_unique($tab[4])).']' : null,
'hiddenCols' => $tab[5] ? '$['.implode(', ', array_unique($tab[5])).']' : null,
'visibleCols' => $tab[6] ? '$'. json_encode( array_unique($tab[6])) : null
]
);
$this->extendGlobalData($lootTabs->jsGlobals);
foreach ($lootTabs->iterate() as $tab)
{
$this->lvData[] = array(
'file' => $tab[0],
'data' => $tab[1],
'params' => [
'tabs' => '$tabsRelated',
'name' => $tab[2],
'id' => $tab[3],
'extraCols' => $tab[4] ? '$['.implode(', ', array_unique($tab[4])).']' : null,
'hiddenCols' => $tab[5] ? '$['.implode(', ', array_unique($tab[5])).']' : null,
'visibleCols' => $tab[6] ? '$'. json_encode( array_unique($tab[6])) : null
]
);
}
}
// tab: sold by

View File

@@ -65,7 +65,7 @@ class EventPage extends GenericPage
/* Infobox */
/***********/
$this->infobox = [];
$this->infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
// boss
if ($_ = $this->subject->getField('bossCreature'))

View File

@@ -51,7 +51,7 @@ class FactionPage extends GenericPage
/***********/
/* Infobox */
/***********/
$infobox = [];
$infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
// Quartermaster if any
if ($ids = $this->subject->getField('qmNpcIds'))

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -37,12 +37,12 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
// holiday
if ($_ev)
$infobox[] = Lang::$game['eventShort'].Lang::$colon.'[url=?event='.$_ev.']'.WorldEventList::getName($_ev).'[/url]';
$infobox[] = Lang::$game['eventShort'].Lang::$main['colon'].'[url=?event='.$_ev.']'.WorldEventList::getName($_ev).'[/url]';
// itemLevel
if ($min = $iSet->getField('minLevel'))
{
$foo = Lang::$game['level'].Lang::$colon.$min;
$foo = Lang::$game['level'].Lang::$main['colon'].$min;
$max = $iSet->getField('maxLevel');
if ($min < $max)
@@ -60,7 +60,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
$foo[] = (!fMod(count($foo) + 1, 3) ? '\n' : null) . '[class='.($i + 1).']';
$t = count($foo) == 1 ? Lang::$game['class'] : Lang::$game['classes'];
$infobox[] = Util::ucFirst($t).Lang::$colon.implode(', ', $foo);
$infobox[] = Util::ucFirst($t).Lang::$main['colon'].implode(', ', $foo);
}
// required level
@@ -69,11 +69,11 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
// type
if ($_ty)
$infobox[] = Lang::$game['type'].lang::$colon.Lang::$itemset['types'][$_ty];
$infobox[] = Lang::$game['type'].Lang::$main['colon'].Lang::$itemset['types'][$_ty];
// tag
if ($_ta)
$infobox[] = Lang::$itemset['_tag'].Lang::$colon.'[url=?itemsets&filter=ta='.$_ta.']'.Lang::$itemset['notes'][$_ta].'[/url]';
$infobox[] = Lang::$itemset['_tag'].Lang::$main['colon'].'[url=?itemsets&filter=ta='.$_ta.']'.Lang::$itemset['notes'][$_ta].'[/url]';
/****************/
/* Main Content */
@@ -208,7 +208,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
'relTabs' => []
);
$iSet->addGlobalsToJscript();
$iSet->getJSGlobals();
/**************/
/* Extra Tabs */
@@ -262,7 +262,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
if (!$mask)
$pageData['related']['params']['hiddenCols'] = "$['classes']";
$relSets->addGlobalsToJscript();
$relSets->getJSGlobals();
}
}
@@ -272,7 +272,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
$smarty->updatePageVars($pageData['page']);
$smarty->assign('community', CommunityContent::getAll(TYPE_ITEMSET, $_id)); // comments, screenshots, videos
$smarty->assign('lang', array_merge(Lang::$main, Lang::$itemset, ['colon' => Lang::$colon]));
$smarty->assign('lang', array_merge(Lang::$main, Lang::$itemset, ['colon' => Lang::$main['colon']]));
$smarty->assign('lvData', $pageData['relTabs']);
// load the page

View File

@@ -14,7 +14,7 @@ if (!$smarty->loadCache($cacheKey, $pageData, $filter))
$itemsetFilter = new ItemsetListFilter();
$itemsets = new ItemsetList([$itemsetFilter->getConditions()]);
$itemsets->addGlobalsToJscript();
$itemsets->getJSGlobals();
// recreate form selection
$filter = array_merge($itemsetFilter->getForm('form'), $filter);
@@ -70,7 +70,7 @@ asort(Lang::$game['cl']);
$smarty->updatePageVars($pageData['page']);
$smarty->assign('filter', $filter);
$smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$itemset, Lang::$item, ['colon' => lang::$colon]));
$smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$itemset, Lang::$item, ['colon' => Lang::$main['colon']]));
$smarty->assign('lvData', $pageData['lv']);
// load the page

View File

@@ -65,7 +65,7 @@ class ObjectPage extends GenericPage
/* Infobox */
/***********/
$infobox = [];
$infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
// Event
if ($_ = DB::Aowow()->selectRow('SELECT e.id, holidayId FROM ?_events e, game_event_gameobject geg, gameobject g WHERE e.id = ABS(geg.eventEntry) AND g.guid = geg.guid AND g.id = ?d', $this->typeId))
@@ -393,17 +393,15 @@ class ObjectPage extends GenericPage
$reqQuest = [];
if ($_ = $this->subject->getField('lootId'))
{
include 'includes/loot.class.php';
if (Loot::getByContainer(LOOT_GAMEOBJECT, $_))
$goLoot = new Loot();
if ($goLoot->getByContainer(LOOT_GAMEOBJECT, $_))
{
$extraCols = Loot::$extraCols;
$extraCols = $goLoot->extraCols;
$hiddenCols = ['source', 'side', 'slot', 'reqlevel'];
$itemLoot = Loot::getResult();
$this->extendGlobalData(Loot::$jsGlobals);
$this->extendGlobalData($goLoot->jsGlobals);
foreach ($itemLoot as $l => $lv)
foreach ($goLoot->iterate() as &$lv)
{
if (!empty($hiddenCols))
foreach ($hiddenCols as $k => $str)
@@ -417,14 +415,14 @@ class ObjectPage extends GenericPage
$reqQuest[$lv['id']] = 0;
$itemLoot[$l]['condition'][] = ['type' => TYPE_QUEST, 'typeId' => &$reqQuest[$lv['id']], 'status' => 1];
$lv['condition'][] = ['type' => TYPE_QUEST, 'typeId' => &$reqQuest[$lv['id']], 'status' => 1];
}
$extraCols[] = 'Listview.extraCols.percent';
$this->lvData[] = array(
'file' => 'item',
'data' => $itemLoot,
'data' => $goLoot->getResult(),
'params' => [
'tabs' => '$tabsRelated',
'name' => '$LANG.tab_contains',
@@ -481,7 +479,7 @@ class ObjectPage extends GenericPage
protected function generateTooltip($asError = false)
{
if ($asError)
die('$WowheadPower.registerObject('.$this->typeId.', '.User::$localeId.', {});');
return '$WowheadPower.registerObject('.$this->typeId.', '.User::$localeId.', {});';
$s = $this->subject->getSpawns(true);

View File

@@ -6358,7 +6358,7 @@ Listview.extraCols = {
cnd.color = cond.status ? 'q2' : 'q10';
cnd.links = [{
icon: item.icon.toLowerCase(),
name: $WH.ct(item['name_' + g_locale.name]),
name: item['name_' + g_locale.name],
url : '?skill=' + cond.typeId
}];
@@ -6380,7 +6380,7 @@ Listview.extraCols = {
cnd.color = cond.status ? 'q2' : 'q10';
cnd.links = [{
icon: item.icon.toLowerCase(),
name: $WH.ct(item['name_' + g_locale.name]),
name: item['name_' + g_locale.name],
url : '?spell=' + cond.typeId
}];
@@ -6399,7 +6399,7 @@ Listview.extraCols = {
cnd.color = cond.status ? 'q2' : 'q10';
cnd.links = [{
icon : item.icon.toLowerCase(),
name : $WH.ct(item['name_' + g_locale.name]),
name : item['name_' + g_locale.name],
url : '?item=' + cond.typeId,
color: 'q' + item.quality
}];
@@ -6419,7 +6419,7 @@ Listview.extraCols = {
cnd.color = cond.status ? 'q2' : 'q10';
cnd.links = [{
icon: item.icon.toLowerCase(),
name: $WH.ct(item['name_' + g_locale.name]),
name: item['name_' + g_locale.name],
url : '?achievement=' + cond.typeId
}];
@@ -6437,7 +6437,7 @@ Listview.extraCols = {
cnd.state = $WH.ct((cond.status == 1 ? LANG.progress : (cond.status == 2 ? LANG.pr_note_complete : LANG.pr_note_incomplete)) + LANG.colon);
cnd.color = cond.status == 1 ? 'q1' : cond.status == 2 ? 'q2' : 'q10';
cnd.links = [{
name: $WH.ct(item['name_' + g_locale.name]),
name: item['name_' + g_locale.name],
url : '?quest=' + cond.typeId
}];
@@ -6459,7 +6459,7 @@ Listview.extraCols = {
for (var i = 0, len = races.length; i < len; ++i) {
cnd.links.push({
name: $WH.ct(g_chr_races[races[i]]),
name: g_chr_races[races[i]],
url : '?class=' + races[i]
});
}

View File

@@ -2,7 +2,7 @@
if (!empty($this->pageText)):
?>
<div class="clear"></div>
<h3><?php echo Lang::$main['content']; ?></h3>
<h3><?php echo Lang::$item['content']; ?></h3>
<div id="book-generic"></div>
<script>//<![CDATA[

View File

@@ -1,3 +1,3 @@
var lv_comments = <?php echo json_encode($this->community['co'], JSON_NUMERIC_CHECK); ?>;
var lv_screenshots = <?php echo json_encode($this->community['sc'], JSON_NUMERIC_CHECK); ?>;
var lv_videos = <?php echo json_encode($this->community['vi'], JSON_NUMERIC_CHECK); ?>;
var lv_comments = <?php echo json_encode($this->community['co'], JSON_NUMERIC_CHECK); ?>;
var lv_screenshots = <?php echo json_encode($this->community['sc'], JSON_NUMERIC_CHECK); ?>;
var lv_videos = <?php echo json_encode($this->community['vi'], JSON_NUMERIC_CHECK); ?>;

View File

@@ -7,7 +7,16 @@
<?php if (!empty($this->jsGlobals[6][2]['buff'])): /* not set with items */ ?>
<h3><?php echo Lang::$spell['_aura']; ?></h3>
<div id="btt<?php echo $this->typeId; ?>" class="wowhead-tooltip"></div>
<?php endif; ?>
<?php
endif;
/*
tt: Tooltip
btt: Buff-Tooltip
sl: Slider for CharLevel
ks: Known Spells
*/
?>
<script type="text/javascript">//<![CDATA[
$WH.ge('ic<?php echo $this->typeId; ?>').appendChild(Icon.create('<?php echo $this->headIcons[0]; ?>', 2, null, 0, <?php echo $this->headIcons[1]; ?>));

View File

@@ -3,7 +3,7 @@ var _ = g_achievements;
foreach ($vars as $id => $data):
echo '_['.$id.']={' .
'name_'.User::$localeString.':\''.Util::jsEscape($data['name']).'\',' .
'icon:\''.Util::jsEscape($data['icon']).'\'' .
'icon:\''.$data['icon'].'\'' .
'};';
endforeach;
?>

View File

@@ -3,7 +3,7 @@ var _ = g_holidays;
foreach ($vars as $id => $data):
echo '_['.$id.']={' .
'name_'.User::$localeString.':\''.Util::jsEscape($data['name']).'\',' .
'icon:\''.Util::jsEscape($data['icon']).'\'' .
'icon:\''.$data['icon'].'\'' .
'};';
endforeach;
?>

View File

@@ -3,13 +3,13 @@ var _ = g_items;
foreach ($vars as $id => $data):
echo '_['.$id.']={' .
'name_'.User::$localeString.':\''.Util::jsEscape($data['name']).'\',' .
'icon:\''.Util::jsEscape($data['icon']).'\'' .
'icon:\''.$data['icon'].'\'' .
(isset($data['quality']) ? ', quality:\''.$data['quality'].'\'' : null) .
'};';
endforeach;
if ($extra):
echo '_['.$extra['id'].'].tooltip_'.User::$localeString.' = \''.$extra['tooltip'].'\'';
echo '_['.$extra['id'].'].spells_'.User::$localeString.' = {'.json_encode($extra['spells'], JSON_NUMERIC_CHECK).'};';
if (isset($extra[$this->typeId])):
echo '_['.$extra[$this->typeId]['id'].'].tooltip_'.User::$localeString.' = \''.Util::jsEscape($extra[$this->typeId]['tooltip']).'\';';
echo '_['.$extra[$this->typeId]['id'].'].spells_'.User::$localeString.' = '.json_encode($extra[$this->typeId]['spells'], JSON_NUMERIC_CHECK).';';
endif;
?>

View File

@@ -1,6 +1,6 @@
var _ = g_pets;
<?php
foreach ($vars as $id => $data):
echo '_['.$id.']={icon:\''.Util::jsEscape($data['icon']).'\'};';
echo '_['.$id.']={icon:\''.$data['icon'].'\'};';
endforeach;
?>

View File

@@ -3,7 +3,7 @@ var _ = g_skills;
foreach ($vars as $id => $data):
echo '_['.$id.']={' .
'name_'.User::$localeString.':\''.Util::jsEscape($data['name']).'\',' .
'icon:\''.Util::jsEscape($data['icon']).'\'' .
'icon:\''.$data['icon'].'\'' .
'};';
endforeach;
?>

View File

@@ -3,7 +3,7 @@ var _ = g_spells;
foreach ($vars as $id => $data):
echo '_['.$id.']={' .
'name_'.User::$localeString.':\''.Util::jsEscape($data['name']).'\',' .
'icon:\''.Util::jsEscape($data['icon']).'\'' .
'icon:\''.$data['icon'].'\'' .
'};';
endforeach;

View File

@@ -9,8 +9,8 @@
<script type="text/javascript">//<![CDATA[
<?php
$this->brick('community');
echo "var g_pageInfo = ".json_encode($this->gPageInfo, JSON_NUMERIC_CHECK).";\n" .
"g_initPath(".json_encode($this->path, JSON_NUMERIC_CHECK).");\n";
echo " var g_pageInfo = ".json_encode($this->gPageInfo, JSON_NUMERIC_CHECK).";\n" .
" g_initPath(".json_encode($this->path, JSON_NUMERIC_CHECK).");\n";
?>
//]]></script>

View File

@@ -9,8 +9,8 @@
<script type="text/javascript">//<![CDATA[
<?php
$this->brick('community');
echo "var g_pageInfo = ".json_encode($this->gPageInfo, JSON_NUMERIC_CHECK).";\n" .
"g_initPath(".json_encode($this->path, JSON_NUMERIC_CHECK).");\n";
echo " var g_pageInfo = ".json_encode($this->gPageInfo, JSON_NUMERIC_CHECK).";\n" .
" g_initPath(".json_encode($this->path, JSON_NUMERIC_CHECK).");\n";
?>
//]]></script>

View File

@@ -1,83 +0,0 @@
{include file='header.tpl'}
<div class="main" id="main">
<div class="main-precontents" id="main-precontents"></div>
<div class="main-contents" id="main-contents">
{if !empty($announcements)}
{foreach from=$announcements item=item}
{include file='bricks/announcement.tpl' an=$item}
{/foreach}
{/if}
<script type="text/javascript">//<![CDATA[
{include file='bricks/community.tpl'}
var g_pageInfo = {ldelim}type: {$type}, typeId: {$typeId}, name: '{$name|escape:"quotes"}'{rdelim};
g_initPath({$path});
{if $user.id && $redButtons[$smarty.const.BUTTON_EQUIP]}
DomContentLoaded.addEvent(function() {ldelim} pr_addEquipButton('equip-pinned-button', {$typeId}); {rdelim});
{/if}
//]]></script>
{include file='bricks/infobox.tpl'}
<div class="text">
{include file='bricks/redButtons.tpl'}
<h1{if isset($expansion)} class="h1-icon"><span class="icon-{$expansion}-right">{$name}</span>{else}>{$name}{/if}</h1>
{include file='bricks/tooltip.tpl'}
{include file='bricks/article.tpl'}
{if !empty($disabled)}
<div class="pad"></div>
<b style="color: red">{$lang._unavailable}</b>
{/if}
{if !empty($transfer)}
<div class="pad"></div>
{$transfer}
{/if}
{if !empty($subItems)}
<div class="clear"></div>
<h3>{$lang._rndEnchants}</h3>
<div class="random-enchantments" style="margin-right: 25px">
<ul>
{foreach from=$subItems item=i key=k}{if $k < (count($subItems) / 2)}
<li><div>
<span class="q{$quality}">...{$i.name}</span>
<small class="q0">{$lang._chance|@sprintf:$i.chance}</small>
<br />{$i.enchantment}
</div></li>
{/if}{/foreach}
</ul>
</div>
{if count($subItems) > 1}
<div class="random-enchantments" style="margin-right: 25px">
<ul>
{foreach from=$subItems item=i key=k}{if $k >= (count($subItems) / 2)}
<li><div>
<span class="q{$quality}">...{$i.name}</span>
<small class="q0">{$lang._chance|@sprintf:$i.chance}</small>
<br />{$i.enchantment}
</div></li>
{/if}{/foreach}
</ul>
</div>
{/if}
{/if}
{include file='bricks/book.tpl'}
<h2 class="clear">{$lang.related}</h2>
</div>
{include file='bricks/tabsRelated.tpl' tabs=$lvData}
{include file='bricks/contribute.tpl'}
</div><!-- main-contents -->
</div><!-- main -->
{include file='footer.tpl'}

View File

@@ -0,0 +1,94 @@
<?php $this->brick('header'); ?>
<div class="main" id="main">
<div class="main-precontents" id="main-precontents"></div>
<div class="main-contents" id="main-contents">
<?php $this->brick('announcement'); ?>
<script type="text/javascript">//<![CDATA[
<?php
$this->brick('community');
echo " var g_pageInfo = ".json_encode($this->gPageInfo, JSON_NUMERIC_CHECK).";\n" .
" g_initPath(".json_encode($this->path, JSON_NUMERIC_CHECK).");\n";
if (User::$id > 0 && $this->redButtons[BUTTON_EQUIP]):
echo " DomContentLoaded.addEvent(function() { pr_addEquipButton('equip-pinned-button', ".$this->typeId."); });\n";
endif;
?>
//]]></script>
<?php $this->brick('infobox'); ?>
<div class="text">
<?php $this->brick('redButtons'); ?>
<h1><?php echo $this->name; ?></h1>
<?php
$this->brick('tooltip');
$this->brick('article');
if ($this->disabled):
?>
<div class="pad"></div>
<b style="color: red"><?php echo Lang::$item['_unavailable']; ?></b>
<?php
endif;
if (!empty($this->transfer)):
echo " <div class=\"pad\"></div>\n ".$this->transfer."\n";
endif;
if (!empty($this->subItems)):
?>
<div class="clear"></div>
<h3><?php echo Lang::$item['_rndEnchants']; ?></h3>
<div class="random-enchantments" style="margin-right: 25px">
<ul>
<?php
foreach ($this->subItems['data'] as $k => $i):
if ($k < (count($this->subItems['data']) / 2)):
echo ' <li><div><span class="q'.$this->subItems['quality'].'">...'.$i['name'].'</span>';
echo ' <small class="q0">'.sprintf(Lang::$item['_chance'], $i['chance']).'</small><br />'.$i['enchantment'].'</div></li>';
endif;
endforeach;
?>
</ul>
</div>
<?php
if (count($this->subItems) > 1):
?>
<div class="random-enchantments" style="margin-right: 25px">
<ul>
<?php
foreach ($this->subItems['data'] as $k => $i):
if ($k >= (count($this->subItems['data']) / 2)):
echo ' <li><div><span class="q'.$this->subItems['quality'].'">...'.$i['name'].'</span>';
echo ' <small class="q0">'.sprintf(Lang::$item['_chance'], $i['chance']).'</small><br />'.$i['enchantment'].'</div></li>';
endif;
endforeach;
?>
</ul>
</div>
<?php
endif;
endif;
$this->brick('book');
?>
<h2 class="clear"><?php echo Lang::$main['related']; ?></h2>
</div>
<?php
$this->brick('tabsRelated');
$this->brick('contribute');
?>
</div><!-- main-contents -->
</div><!-- main -->
<?php $this->brick('footer'); ?>

View File

@@ -1,196 +0,0 @@
{include file='header.tpl'}
<div class="main" id="main">
<div class="main-precontents" id="main-precontents"></div>
<div class="main-contents" id="main-contents">
{if !empty($announcements)}
{foreach from=$announcements item=item}
{include file='bricks/announcement.tpl' an=$item}
{/foreach}
{/if}
<script type="text/javascript">
g_initPath({$path}, {if empty($filter.query)}0{else}1{/if});
{if isset($filter.query)}
Menu.modifyUrl(Menu.findItem(mn_database, [0]), {ldelim} filter: '+={$filter.query|escape:'quotes'}' {rdelim}, {ldelim} onAppendCollision: fi_mergeFilterParams, onAppendEmpty: fi_setFilterParams, menuUrl: Menu.getItemUrl(Menu.findItem(mn_database, [0])) {rdelim});
{/if}
</script>
<div id="fi" style="display: {if empty($filter.query)}none{else}block{/if};">
<form action="?items{$subCat}&filter" method="post" name="fi" onsubmit="return fi_submit(this)" onreset="return fi_reset(this)">
<div class="rightpanel">
<div style="float: left">{$lang._quality}{$lang.colon}</div>
<small><a href="javascript:;" onclick="document.forms['fi'].elements['qu[]'].selectedIndex = -1; return false" onmousedown="return false">{$lang.clear}</a></small>
<div class="clear"></div>
<select name="qu[]" size="7" multiple="multiple" class="rightselect" style="background-color: #181818">
{foreach from=$lang.quality key=k item=str}
<option value="{$k}" class="q{$k}"{if isset($filter.qu) && in_array($k, (array)$filter.qu)} selected{/if}>{$str}</option>
{/foreach}
</select>
</div>
{if !empty($filter.slot)}
<div class="rightpanel2">
<div style="float: left">{$lang.slot}{$lang.colon}</div>
<small><a href="javascript:;" onclick="document.forms['fi'].elements['sl[]'].selectedIndex = -1; return false" onmousedown="return false">{$lang.clear}</a></small>
<div class="clear"></div>
<select name="sl[]" size="{if $filter.slot|@count < 7}{$filter.slot|@count}{else}7{/if}" multiple="multiple" class="rightselect">
{foreach from=$filter.slot key=k item=str}
<option value="{$k}"{if isset($filter.sl) && in_array($k, (array)$filter.sl)} selected{/if}>{$str}</option>
{/foreach}
</select>
</div>
{/if}
{if !empty($filter.type)}
<div class="rightpanel2">
<div style="float: left">{$lang.type}{$lang.colon}</div>
<small><a href="javascript:;" onclick="document.forms['fi'].elements['ty[]'].selectedIndex = -1; return false" onmousedown="return false">{$lang.clear}</a></small>
<div class="clear"></div>
<select name="ty[]" size="{if $filter.type|@count < 7}{$filter.type|@count}{else}7{/if}" multiple="multiple" class="rightselect">
{foreach from=$filter.type key=k item=str}
<option value="{$k}"{if isset($filter.ty) && in_array($k, (array)$filter.ty)} selected{/if}>{$str}</option>
{/foreach}
</select>
</div>
{/if}
<table>
<tr>
<td>{$lang.name|ucFirst}{$lang.colon}</td>
<td colspan="2">&nbsp;<input type="text" name="na" size="30" {if isset($filter.na)}value="{$filter.na|escape:'html'}" {/if}/></td>
<td></td>
</tr><tr>
<td class="padded">{$lang.level}{$lang.colon}</td>
<td class="padded">&nbsp;<input type="text" name="minle" maxlength="3" class="smalltextbox2" {if isset($filter.minle)}value="{$filter.minle}" {/if}/> - <input type="text" name="maxle" maxlength="3" class="smalltextbox2" {if isset($filter.maxle)}value="{$filter.maxle}" {/if}/></td>
<td class="padded">
<table>
<tr>
<td>&nbsp;&nbsp;&nbsp;{$lang._reqLevel}{$lang.colon}</td>
<td>&nbsp;<input type="text" name="minrl" maxlength="2" class="smalltextbox" {if isset($filter.minrl)}value="{$filter.minrl}" {/if}/> - <input type="text" name="maxrl" maxlength="2" class="smalltextbox" {if isset($filter.maxrl)}value="{$filter.maxrl}" {/if}/></td>
</tr>
</table>
</td>
<td></td>
</tr><tr>
<td class="padded">{$lang.usableBy}{$lang.colon}</td>
<td class="padded">&nbsp;<select name="si" style="margin-right: 0.5em">
<option></option>
{foreach from=$lang.si key=k item=str}
<option value="{$k}"{if isset($filter.si) && $k == $filter.si} selected{/if}>{$str}</option>
{/foreach}
</select></td>
<td class="padded">
&nbsp;<select name="ub">
<option></option>
{foreach from=$lang.cl key=k item=str}{if $str}
<option value="{$k}"{if isset($filter.ub) && $k == $filter.ub} selected{/if}>{$str}</option>
{/if}{/foreach}
</select></td>
</td>
</tr>
</table>
<div id="fi_criteria" class="padded criteria"><div></div></div>
<div><a href="javascript:;" id="fi_addcriteria" onclick="fi_addCriterion(this); return false">{$lang.addFilter}</a></div>
<div class="padded2">
<div style="float: right">{$lang.refineSearch}</div>
{$lang.match}{$lang.colon}<input type="radio" name="ma" value="" id="ma-0" {if !isset($filter.ma)}checked="checked" {/if}/><label for="ma-0">{$lang.allFilter}</label><input type="radio" name="ma" value="1" id="ma-1" {if isset($filter.ma)}checked="checked" {/if}/><label for="ma-1">{$lang.oneFilter}</label>
</div>
<div class="pad3"></div>
<div class="text">
<h3 class="first"><a id="fi_weight_toggle" href="javascript:;" class="disclosure-off" onclick="return g_disclose($WH.ge('statweight-disclosure'), this)">{$lang.createWS}</a></h3>
</div>
<div id="statweight-disclosure" style="display: none">
<div id="statweight-help">
<div><a href="?help=stat-weighting" target="_blank" id="statweight-help" class="icon-help">{$lang.help}</a></div>
</div>
<table>
<tr>
<td>{$lang.preset}{$lang.colon}</td>
<td id="fi_presets"></td>
</tr>
<tr>
<td class="padded">{$lang.gems}{$lang.colon}</td>
<td class="padded">
<select name="gm">
<option {if !isset($filter.gm)}selected{/if}></option>
<option value="2" {if isset($filter.gm) && $filter.gm == 2}selected{/if}>{$lang.quality[2]}</option>
<option value="3" {if isset($filter.gm) && $filter.gm == 3}selected{/if}>{$lang.quality[3]}</option>
<option value="4" {if isset($filter.gm) && $filter.gm == 4}selected{/if}>{$lang.quality[4]}</option>
</select>
&nbsp; <input type="checkbox" name="jc" value="1" id="jc" {if isset($filter.jc) && $filter.jc == 1}checked="checked"{/if}/><label for="jc">{$lang.jcGemsOnly|sprintf:' class="tip" onmouseover="$WH.Tooltip.showAtCursor(event, LANG.tooltip_jconlygems, 0, 0, \'q\')" onmousemove="$WH.Tooltip.cursorUpdate(event)" onmouseout="$WH.Tooltip.hide()"'}</label>
</td>
</tr>
</table>
<div id="fi_weight" class="criteria" style="display: none"><div></div></div>
<div><a href="javascript:;" id="fi_addweight" onclick="fi_addCriterion(this); return false" style="display: none">{$lang.addWeight}</a></div>
<div class="pad2"></div>
<small>{$lang.cappedHint}</small>
</div>
<div class="clear"></div>
<div class="padded">{$lang.groupBy}{$lang.colon}
{foreach from=$lang.gb key=k item=str}
{if $k == 0}
<input type="radio" name="gb" value="" id="gb-{$str[1]}" {if empty($filter.gb)}checked="checked" {/if}/><label for="gb-{$str[1]}">{$str[0]}</label>
{else}
<input type="radio" name="gb" value="{$k}" id="gb-{$str[1]}" {if !empty($filter.gb) && $filter.gb == $k}checked="checked" {/if}/><label for="gb-{$str[1]}">{$str[0]}</label>
{/if}
{/foreach}
</div>
<div class="clear"></div>
<div class="padded">
<input type="submit" value="{$lang.applyFilter}" />
<input type="reset" value="{$lang.resetForm}" />
</div>
<input type="hidden" name="upg"{if !empty($filter.upg)} value="{$filter.upg}"{/if}/>
<div class="pad"></div>
</form>
<div class="pad"></div>
</div>
<script type="text/javascript">//<![CDATA[
fi_init('items');
{foreach from=$filter.fi item=str}
{$str}
{/foreach}
//]]></script>
{if $lvData.isGrouped}
<div id="tabs-generic"></div>
{/if}
<div id="lv-generic" class="listview"></div>
<script type="text/javascript">//<![CDATA[
{if !empty($gemScores)}var fi_gemScores = {$gemScores};{/if}
{if $lvData.isGrouped}
var tabsGroups = new Tabs({ldelim}parent: $WH.ge('tabs-generic'){rdelim});
{/if}
{foreach from=$lvData.tabs item="tab"}
{include file="listviews/item.tpl" data=$tab.data params=$tab.params}
{/foreach}
{if $lvData.isGrouped}
tabsGroups.flush();
{/if}
//]]></script>
<div class="clear"></div>
</div><!-- main-contents -->
</div><!-- main -->
{include file='footer.tpl'}

View File

@@ -0,0 +1,226 @@
<?php
$this->brick('header');
$f = $this->filter; // shorthand
?>
<div class="main" id="main">
<div class="main-precontents" id="main-precontents"></div>
<div class="main-contents" id="main-contents">
<?php $this->brick('announcement'); ?>
<script type="text/javascript">
g_initPath(<?php echo json_encode($this->path, JSON_NUMERIC_CHECK).', '.(empty($f['query']) ? 0 : 1) ?>);
<?php
if (!empty($f['query'])):
// todo: update menu-class Menu.modifyUrl(Menu.findItem(mn_database, [0]), { filter: '+={$f['query']|escape:'quotes'}' }, { onAppendCollision: fi_mergeFilterParams, onAppendEmpty: fi_setFilterParams, menuUrl: Menu.getItemUrl(Menu.findItem(mn_database, [0])) });
endif;
?>
</script>
<div id="fi" style="display: <?php echo empty($f['query']) ? 'none' : 'block' ?>;">
<form action="?items<?php echo $this->subCat; ?>&filter" method="post" name="fi" onsubmit="return fi_submit(this)" onreset="return fi_reset(this)">
<div class="rightpanel">
<div style="float: left"><?php echo Lang::$item['_quality'].Lang::$main['colon']; ?></div>
<small><a href="javascript:;" onclick="document.forms['fi'].elements['qu[]'].selectedIndex = -1; return false" onmousedown="return false"><?php echo Lang::$main['clear']; ?></a></small>
<div class="clear"></div>
<select name="qu[]" size="7" multiple="multiple" class="rightselect" style="background-color: #181818">
<?php
foreach (Lang::$item['quality'] as $k => $str):
echo ' <option value="'.$k.'" class="q'.$k.'"'.(isset($f['qu']) && in_array($k, (array)$f['qu']) ? ' selected' : null).'>'.$str."</option>\n";
endforeach;
?>
</select>
</div>
<?php
if (!empty($f['slot'])):
?>
<div class="rightpanel2">
<div style="float: left"><?php echo Lang::$item['slot'].Lang::$main['colon']; ?></div>
<small><a href="javascript:;" onclick="document.forms['fi'].elements['sl[]'].selectedIndex = -1; return false" onmousedown="return false"><?php echo Lang::$main['clear']; ?></a></small>
<div class="clear"></div>
<select name="sl[]" size="<?php echo min(@count($f['slot']), 7); ?>" multiple="multiple" class="rightselect">
<?php
foreach ($f['slot'] as $k => $str):
echo ' <option value="'.$k.'" '.(isset($f['sl']) && in_array($k, (array)$f['sl']) ? ' selected' : null).'>'.$str."</option>\n";
endforeach;
?>
</select>
</div>
<?php
endif;
if (!empty($f['type'])):
?>
<div class="rightpanel2">
<div style="float: left"><?php echo Lang::$game['type'].Lang::$main['colon']; ?></div>
<small><a href="javascript:;" onclick="document.forms['fi'].elements['ty[]'].selectedIndex = -1; return false" onmousedown="return false"><?php echo Lang::$main['clear']; ?></a></small>
<div class="clear"></div>
<select name="ty[]" size="<?php echo min(@count($f['type']), 7); ?>" multiple="multiple" class="rightselect">
<?php
foreach ($f['type'] as $k => $str):
echo ' <option value="'.$k.'" '.(isset($f['ty']) && in_array($k, (array)$f['ty']) ? ' selected' : null).'>'.$str."</option>\n";
endforeach;
?>
</select>
</div>
<?php endif; ?>
<table>
<tr>
<td><?php echo Util::ucFirst(Lang::$main['name']).Lang::$main['colon']; ?></td>
<td colspan="2">&nbsp;<input type="text" name="na" size="30" <?php echo isset($f['na']) ? 'value="'.Util::htmlEscape($f['na']).'" ' : null; ?>/></td>
<td></td>
</tr><tr>
<td class="padded"><?php echo Lang::$game['level'].Lang::$main['colon']; ?></td>
<td class="padded">&nbsp;<input type="text" name="minle" maxlength="3" class="smalltextbox2" <?php echo isset($f['minle']) ? 'value="'.$f['minle'].'" ' : null; ?>/> - <input type="text" name="maxle" maxlength="3" class="smalltextbox2" <?php echo isset($f['maxle']) ? 'value="'.$f['maxle'].'" ' : null; ?>/></td>
<td class="padded">
<table>
<tr>
<td>&nbsp;&nbsp;&nbsp;<?php echo Lang::$main['_reqLevel'].Lang::$main['colon']; ?></td>
<td>&nbsp;<input type="text" name="minrl" maxlength="2" class="smalltextbox" <?php echo isset($f['minrl']) ? 'value="'.$f['minrl'].'" ' : null; ?>/> - <input type="text" name="maxrl" maxlength="2" class="smalltextbox" <?php echo isset($f['maxrl']) ? 'value="'.$f['maxrl'].'" ' : null; ?>/></td>
</tr>
</table>
</td>
<td></td>
</tr><tr>
<td class="padded"><?php echo Lang::$item['usableBy'].Lang::$main['colon']; ?></td>
<td class="padded">&nbsp;<select name="si" style="margin-right: 0.5em">
<option></option>
<?php
foreach (Lang::$game['si'] as $k => $str):
echo ' <option value="'.$k.'"'.(isset($f['si']) && $k == $f['si'] ? ' selected' : null).'>'.$str."</option>\n";
endforeach;
?>
</select></td>
<td class="padded">
&nbsp;<select name="ub">
<option></option>
<?php
foreach (Lang::$game['cl'] as $k => $str):
if ($str):
echo ' <option value="'.$k.'"'.(isset($f['ub']) && $k == $f['ub'] ? ' selected' : null).'>'.$str."</option>\n";
endif;
endforeach;
?>
</select></td>
</td>
</tr>
</table>
<div id="fi_criteria" class="padded criteria"><div></div></div>
<div><a href="javascript:;" id="fi_addcriteria" onclick="fi_addCriterion(this); return false"><?php echo Lang::$main['addFilter']; ?></a></div>
<div class="padded2">
<div style="float: right"><?php echo Lang::$main['refineSearch']; ?></div>
<?php echo Lang::$main['match'].Lang::$main['colon']; ?><input type="radio" name="ma" value="" id="ma-0" <?php echo !isset($f['ma']) ? 'checked="checked" ' : null; ?>/><label for="ma-0"><?php echo Lang::$main['allFilter']; ?></label><input type="radio" name="ma" value="1" id="ma-1" <?php echo isset($f['ma']) ? 'checked="checked" ' : null; ?>/><label for="ma-1"><?php echo Lang::$main['oneFilter']; ?></label>
</div>
<div class="pad3"></div>
<div class="text">
<h3 class="first"><a id="fi_weight_toggle" href="javascript:;" class="disclosure-off" onclick="return g_disclose($WH.ge('statweight-disclosure'), this)"><?php echo Lang::$main['createWS']; ?></a></h3>
</div>
<div id="statweight-disclosure" style="display: none">
<div id="statweight-help">
<div><a href="?help=stat-weighting" target="_blank" id="statweight-help" class="icon-help"><?php echo Lang::$main['help']; ?></a></div>
</div>
<table>
<tr>
<td><?php echo Lang::$main['preset'].Lang::$main['colon']; ?></td>
<td id="fi_presets"></td>
</tr>
<tr>
<td class="padded"><?php echo Lang::$item['gems'].Lang::$main['colon']; ?></td>
<td class="padded">
<select name="gm">
<option<?php echo !isset($f['gm']) ? ' selected' : null; ?>></option>
<option value="2"<?php echo (isset($f['gm']) && $f['gm'] == 2 ? ' selected' : null).'>'.Lang::$item['quality'][2]; ?></option>
<option value="3"<?php echo (isset($f['gm']) && $f['gm'] == 3 ? ' selected' : null).'>'.Lang::$item['quality'][3]; ?></option>
<option value="4"<?php echo (isset($f['gm']) && $f['gm'] == 4 ? ' selected' : null).'>'.Lang::$item['quality'][4]; ?></option>
</select>
&nbsp; <input type="checkbox" name="jc" value="1" id="jc" <?php echo isset($f['jc']) && $f['jc'] == 1 ? 'checked="checked" ' : null; ?>/><label for="jc"><?php echo sprintf(Lang::$main['jcGemsOnly'], ' class="tip" onmouseover="$WH.Tooltip.showAtCursor(event, LANG.tooltip_jconlygems, 0, 0, \'q\')" onmousemove="$WH.Tooltip.cursorUpdate(event)" onmouseout="$WH.Tooltip.hide()"'); ?></label>
</td>
</tr>
</table>
<div id="fi_weight" class="criteria" style="display: none"><div></div></div>
<div><a href="javascript:;" id="fi_addweight" onclick="fi_addCriterion(this); return false" style="display: none"><?php echo Lang::$main['addWeight']; ?></a></div>
<div class="pad2"></div>
<small><?php echo Lang::$main['cappedHint']; ?></small>
</div>
<div class="clear"></div>
<div class="padded">
<?php
echo Lang::$main['groupBy'].Lang::$main['colon']."\n";
foreach (Lang::$main['gb'] as $k => $str):
if ($k):
echo ' <input type="radio" name="gb" value="'.$k.'" id="gb-'.$str[1].'"'.(!empty($f['gb']) && $f['gb'] == $k ? ' checked="checked"' : null).'/><label for="gb-'.$str[1].'">'.$str[0]."</label>\n";
else:
echo ' <input type="radio" name="gb" value="" id="gb-'.$str[1].'"'.(empty($f['gb']) ? ' checked="checked"' : null).'/><label for="gb-'.$str[1].'">'.$str[0]."</label>\n";
endif;
endforeach;
?>
</div>
<div class="clear"></div>
<div class="padded">
<input type="submit" value="<?php echo Lang::$main['applyFilter']; ?>" />
<input type="reset" value="<?php echo Lang::$main['resetForm']; ?>" />
</div>
<input type="hidden" name="upg"<?php echo !empty($f['upg']) ? ' value="'.$f['upg'].'"' : null; ?>/>
<div class="pad"></div>
</form>
<div class="pad"></div>
</div>
<script type="text/javascript">//<![CDATA[
fi_init('items');
<?php
foreach ($f['fi'] as $str):
echo ' '.$str."\n";
endforeach;
?>
//]]></script>
<?php
if ($this->hasGroupedTabs):
echo " <div id=\"tabs-generic\"></div>\n";
endif;
?>
<div id="lv-generic" class="listview"></div>
<script type="text/javascript">//<![CDATA[
<?php
if (!empty($this->gemScores)):
echo " var fi_gemScores = ".json_encode($this->gemScores, JSON_NUMERIC_CHECK).";\n";
endif;
if ($this->hasGroupedTabs):
echo " var tabsGroups = new Tabs({parent: \$WH.ge('tabs-generic')});\n";
endif;
foreach ($this->lvData as $tab):
$this->lvBrick('item', ['data' => $tab['data'], 'params' => $tab['params']]);
endforeach;
if ($this->hasGroupedTabs):
echo " tabsGroups.flush();\n";
endif;
?>
//]]></script>
<div class="clear"></div>
</div><!-- main-contents -->
</div><!-- main -->
<?php $this->brick('footer'); ?>

View File

@@ -9,8 +9,8 @@
<script type="text/javascript">//<![CDATA[
<?php
$this->brick('community');
echo "var g_pageInfo = ".json_encode($this->gPageInfo, JSON_NUMERIC_CHECK).";\n" .
"g_initPath(".json_encode($this->path, JSON_NUMERIC_CHECK).");\n";
echo " var g_pageInfo = ".json_encode($this->gPageInfo, JSON_NUMERIC_CHECK).";\n" .
" g_initPath(".json_encode($this->path, JSON_NUMERIC_CHECK).");\n";
?>
//]]></script>