aowow/pages/compare.php
Sarjuuk 8d3698d466 initial commit
features:
- tool - Maps:
   * finally supports multi-layered zones
   * should also support icons if needed (questgiver, ect)

- tool - Item Comparison:
   * fully functional (yes, that includes heirlooms and items with random props)
   * may throw a minor js-error if using arrow-keys/esc/ret in input-fields in the LightboxPopus (but wowhead does also)
   * icons for prismatic sockets are not displayed if no other sockets are present (calculation is correct though)
   * modelviewer will still 'call home'

- tool - Talent Calculator:
   * got rid of a VERY dirty hack for the icons (they are now supplied as texture, not laoded one at a time)
   * glyphs should also be a bit more informative
   * talent data is pulled from static file, that should a) speed up load and b) prevent lockups if it cant be generated on the fly
   * you can now set the level for your build, which affects available talent points, glyphs and glyph-slots

- tool - Pet Calculator:
   * initial implementation; basically the same as the Talent Calculator

- general concept changed:
   * dropped ajax.php; json is now supplied by the appropriate page if &json is appended to the url
   * search.php and opensearch.php are being merged; again, output will depend on the appended parameter (&openserach, &json)
   * data included via data.php will be static and assembled only on installation and when the database changes (should speed up load)
   * locale strings are now in a single file instead of being split up to the template
   * still getting rid of criss-cross-includes, global variables and string-defines
2012-12-19 00:53:36 +01:00

99 lines
3.6 KiB
PHP

<?php
if (!defined('AOWOW_REVISION'))
die('invalid access');
require_once('includes/class.item.php');
require_once('includes/class.spell.php');
require_once('includes/class.faction.php'); // items may require a faction to use/own
// prefer $_GET over $_COOKIE
$compareString = '';
$doneSummary = '';
$pageData['items'] = array();
if (!empty($_GET['compare']))
$compareString = $_GET['compare'];
else if (!empty($_COOKIE['compare_groups']))
$compareString = urldecode($_COOKIE['compare_groups']);
if ($compareString)
{
$sets = explode(";", $compareString);
$items = array();
foreach ($sets as $set)
{
$itemsting = explode(":", $set);
$outString = array();
foreach ($itemsting as $substring)
{
$params = explode(".", $substring);
$items[] = (int)$params[0];
while (sizeof($params) < 7)
$params[] = 0;
$outString[] = "[".implode(',', $params)."]";
// MATCH() AGAINST() for integers would be nice...
$res = DB::Aowow()->SelectRow(
"SELECT itemsetID FROM ?_itemset WHERE
item1 = ? OR item2 = ? OR item3 = ? OR item4 = ? OR item5 = ? OR
item6 = ? OR item7 = ? OR item8 = ? OR item9 = ? OR item10 = ?",
(int)$params[0], (int)$params[0], (int)$params[0], (int)$params[0], (int)$params[0], (int)$params[0], (int)$params[0], (int)$params[0], (int)$params[0], (int)$params[0]
);
if ($res)
$piecesAssoc[(int)$params[0]] = $res['itemsetID'];
}
$outSet[] = "[".implode(',', $outString)."]";
}
$doneSummary = implode(',', $outSet);
$iList = new ItemList(array(array('i.entry', 'IN', $items)));
foreach ($iList->itemList as $item)
{
$item->getJsonStats();
$stats = array();
foreach ($item->json as $k => $v)
$stats[] = is_numeric($v) || $v[0] == "{" ? '"'.$k.'":'.$v.'' : '"'.$k.'":"'.$v.'"';
foreach ($item->itemMods as $k => $v)
if ($v)
$stats[] = '"'.Util::$itemMods[$k].'":'.$v;
$pageData['items'][] = "g_items.add(".$item->json['id'].", {name_".User::$localeString.":'".Util::jsEscape(Util::localizedString($item->template, 'name'))."', quality:".$item->template['Quality'].", icon:'".$item->template['icon']."', jsonequip:{".implode(",", $stats)."}});";
}
}
$pageData['summary'] = "new Summary({template:'compare',id:'compare',parent:'compare-generic',groups:[".$doneSummary."]});";
// Announcements
$announcements = DB::Aowow()->Select('SELECT * FROM ?_announcements WHERE flags & 0x10 AND (page = "compare" OR page = "*")');
foreach ($announcements as $k => $v)
$announcements[$k]['text'] = Util::localizedString($v, 'text');
$page = array(
'title' => Lang::$compare['compare'],
'tab' => 1,
'reqCSS' => array(
array('path' => 'template/css/Summary.css', 'condition' => false),
array('path' => 'template/css/Summary_ie6.css', 'condition' => 'lte IE 6'),
),
'reqJS' => array(
array('path' => 'template/js/Draggable.js'),
array('path' => 'template/js/filters.js'),
array('path' => 'template/js/Summary.js'),
array('path' => 'template/js/swfobject.js'),
array('path' => '?data=weight-presets.gems.enchants.itemsets'),
),
);
$smarty->updatePageVars($page);
$smarty->assign('data', $pageData);
$smarty->assign('lang', array_merge(Lang::$main, Lang::$compare));
$smarty->assign('announcements', $announcements);
$smarty->assign('mysql', DB::Aowow()->getStatistics());
$smarty->display('compare.tpl');
?>