- implemented item-lookup per weightscale (used in profiler, comparison tool and item upgrade search)

- some minor nonfunctional changes to support 'known' spells
- enabled dynamic update of Spelltooltips changing with pointsPerLevel
This commit is contained in:
Sarjuuk
2013-08-06 16:36:24 +02:00
parent 317af7d768
commit 5436ead926
18 changed files with 217 additions and 81 deletions

View File

@@ -7,22 +7,51 @@ class ItemList extends BaseType
{
use ListviewHelper;
public static $type = TYPE_ITEM;
public static $type = TYPE_ITEM;
public $tooltip = '';
public $json = [];
public $itemMods = [];
public $tooltip = '';
public $json = [];
public $itemMods = [];
public $rndEnchIds = [];
public $subItems = [];
public $rndEnchIds = [];
public $subItems = [];
private $ssd = [];
private $ssd = [];
private $weightQuery = 'SELECT i.*, iX.*, l.*, i.entry AS ARRAY_KEY, [weightsA] AS sum FROM item_template i LEFT JOIN ?_item_template_addon iX ON i.entry = iX.id LEFT JOIN locales_item l ON i.entry = l.entry JOIN ?_item_stats ais ON ais.id = i.entry WHERE [weightsB] AND [cond] ORDER BY sum DESC';
private $weightMatch = 'SELECT COUNT(1) FROM item_template i LEFT JOIN ?_item_template_addon iX ON i.entry = iX.id LEFT JOIN locales_item l ON i.entry = l.entry JOIN ?_item_stats ais ON ais.id = i.entry WHERE [cond]';
protected $setupQuery = 'SELECT *, i.entry AS ARRAY_KEY FROM item_template i LEFT JOIN ?_item_template_addon iX ON i.entry = iX.id LEFT JOIN locales_item l ON i.entry = l.entry WHERE [filter] [cond] ORDER BY i.Quality DESC';
protected $matchQuery = 'SELECT COUNT(1) FROM item_template i LEFT JOIN ?_item_template_addon iX ON i.entry = iX.id LEFT JOIN locales_item l ON i.entry = l.entry WHERE [filter] [cond]';
protected $setupQuery = 'SELECT *, i.entry AS ARRAY_KEY FROM item_template i LEFT JOIN ?_item_template_addon iX ON i.entry = iX.id LEFT JOIN locales_item l ON i.entry = l.entry WHERE [filter] [cond] ORDER BY i.Quality DESC';
protected $matchQuery = 'SELECT COUNT(1) FROM item_template i LEFT JOIN ?_item_template_addon iX ON i.entry = iX.id LEFT JOIN locales_item l ON i.entry = l.entry WHERE [filter] [cond]';
public function __construct($conditions, $pieceToSet = null)
public function __construct($conditions, $miscData = null)
{
// search by statweight
if ($miscData && isset($miscData['wt']) && isset($miscData['wtv']) && count($miscData['wt']) == count($miscData['wtv']))
{
$wtA = $wtB = [];
foreach ($miscData['wt'] as $k => $v)
{
if (@$str = Util::$itemFilter[$v])
{
if ($str == 'rgdspeed') // dont need no duplicate column
$str = 'speed';
$wtA[] = '(`ais`.`'.$str.'` * '.intVal($miscData['wtv'][$k]).')';
$wtB[] = '`ais`.`'.$str.'` <> 0';
}
}
$wtA = $wtA ? '('.implode(' + ', $wtA).')' : 1;
$wtB = $wtB ? '('.implode(' AND ', $wtB).')' : 1;
$this->setupQuery = $this->weightQuery;
$this->matchQuery = $this->weightMatch;
$this->setupQuery = strtr($this->setupQuery, ['[weightsA]' => $wtA, '[weightsB]' => $wtB]);
$this->matchQuery = strtr($this->matchQuery, ['[weightsA]' => $wtA, '[weightsB]' => $wtB]);
}
parent::__construct($conditions);
while ($this->iterate())
@@ -34,8 +63,8 @@ class ItemList extends BaseType
$this->initJsonStats();
// readdress itemset .. is wrong for virtual sets
if ($pieceToSet && isset($pieceToSet[$this->id]))
$this->json[$this->id]['itemset'] = $pieceToSet[$this->id];
if ($miscData && isset($miscData['pcsToSet']) && isset($miscData['pcsToSet'][$this->id]))
$this->json[$this->id]['itemset'] = $miscData['pcsToSet'][$this->id];
// unify those pesky masks
$_ = $this->curTpl['AllowableClass'];
@@ -557,7 +586,7 @@ class ItemList extends BaseType
{
$itemSpells = new SpellList(array(['s.id', array_keys($itemSpellsAndTrigger)]));
while ($itemSpells->iterate())
if ($parsed = $itemSpells->parseText('description', $this->curTpl['RequiredLevel']))
if ($parsed = $itemSpells->parseText('description', $this->curTpl['RequiredLevel'])[0])
$green[] = Lang::$item['trigger'][$itemSpellsAndTrigger[$itemSpells->id]] . ($interactive ? '<a href="?spell='.$itemSpells->id.'">'.$parsed.'</a>' : $parsed);
}
@@ -624,7 +653,7 @@ class ItemList extends BaseType
while ($boni->iterate())
{
$itemset['spells'][] = array(
'tooltip' => $boni->parseText('description', $this->curTpl['RequiredLevel']),
'tooltip' => $boni->parseText('description', $this->curTpl['RequiredLevel'])[0],
'entry' => $itemset['spell'.$setSpellsAndIdx[$boni->id]],
'bonus' => $itemset['bonus'.$setSpellsAndIdx[$boni->id]]
);
@@ -1061,6 +1090,9 @@ class ItemList extends BaseType
$json['feratkpwr'] = max(0, round((($json['dmgmin1'] + $json['dmgmax1']) / (2 * $this->curTpl['delay'] / 1000) - 54.8) * 14, 0));
}
if ($this->curTpl['ArmorDamageModifier'] > 0)
$json['armor'] += $this->curTpl['ArmorDamageModifier'];
// clear zero-values afterwards
foreach ($json as $k => $v)
if (!isset($v) || $v === "false" || (!in_array($k, ['classs', 'subclass', 'quality', 'side']) && $v == "0"))

View File

@@ -431,8 +431,9 @@ class SpellList extends BaseType
$add = $ref->getField('effect'.$effIdx.'DieSides');
$maxLvl = $ref->getField('maxLevel');
$baseLvl = $ref->getField('baseLevel');
$scaling = $this->curTpl['attributes1'] & 0x200; // never a referenced spell, ALWAYS $this; SPELL_ATTR1_MELEE_COMBAT_SPELL: 0x200
if ($this->curTpl['attributes1'] & 0x200) // never a referenced spell, ALWAYS $this; SPELL_ATTR1_MELEE_COMBAT_SPELL: 0x200
if ($scaling)
{
if ($level > $maxLvl && $maxLvl > 0)
$level = $maxLvl;
@@ -443,20 +444,12 @@ class SpellList extends BaseType
$base += (int)($level * $rppl);
}
switch ($add) // roll in a range <1;EffectDieSides> as of patch 3.3.3
{
case 0:
case 1: // range 1..1
return [
$base + $add,
$base + $add
];
default:
return [
$base + 1,
$base + $add
];
}
return [
$add ? $base + 1 : $base,
$base + $add,
$scaling ? '<!--ppl'.$baseLvl.':'.$maxLvl.':'.($base + max(1, $add)).':'.$rppl.'-->' : null,
$scaling ? '<!--ppl'.$baseLvl.':'.$maxLvl.':'.($base + $add).':'.$rppl.'-->' : null
];
}
public function canCreateItem()
@@ -498,6 +491,7 @@ class SpellList extends BaseType
$cond = $COND = function($a, $b, $c) { return $a ? $b : $c; };
$eq = $EQ = function($a, $b) { return $a == $b; };
$gt = $GT = function($a, $b) { return $a > $b; };
$gte = $GTE = function($a, $b) { return $a <= $b; };
$floor = $FLOOR = function($a) { return floor($a); };
if (preg_match_all('/\$[a-z]+\b/i', $formula, $vars))
@@ -506,11 +500,14 @@ class SpellList extends BaseType
foreach ($vars[0] as $var) // oh lord, forgive me this sin .. but is_callable seems to bug out and function_exists doesn't find lambda-functions >.<
{
if (@eval('return getType('.$var.');') != 'object')
{
$evalable = false;
break;
}
$eval = eval('return '.$var.';');
if (getType($eval) == 'object')
continue;
else if (is_numeric($eval))
continue;
$evalable = false;
break;
}
if (!$evalable)
@@ -519,6 +516,7 @@ class SpellList extends BaseType
$cond = $COND = !$this->interactive ? 'COND' : sprintf(Util::$dfnString, 'COND(<span class=\'q1\'>a</span>, <span class=\'q1\'>b</span>, <span class=\'q1\'>c</span>)<br /> <span class=\'q1\'>a</span> ? <span class=\'q1\'>b</span> : <span class=\'q1\'>c</span>', 'COND');
$eq = $EQ = !$this->interactive ? 'EQ' : sprintf(Util::$dfnString, 'EQ(<span class=\'q1\'>a</span>, <span class=\'q1\'>b</span>)<br /> <span class=\'q1\'>a</span> == <span class=\'q1\'>b</span>', 'EQ');
$gt = $GT = !$this->interactive ? 'GT' : sprintf(Util::$dfnString, 'GT(<span class=\'q1\'>a</span>, <span class=\'q1\'>b</span>)<br /> <span class=\'q1\'>a</span> > <span class=\'q1\'>b</span>', 'GT');
$gte = $GTE = !$this->interactive ? 'GTE' : sprintf(Util::$dfnString, 'GTE(<span class=\'q1\'>a</span>, <span class=\'q1\'>b</span>)<br /> <span class=\'q1\'>a</span> <= <span class=\'q1\'>b</span>', 'GT');
$floor = $FLOOR = !$this->interactive ? 'FLOOR' : sprintf(Util::$dfnString, 'FLOOR(<span class=\'q1\'>a</span>)', 'FLOOR');
$pl = $PL = !$this->interactive ? 'PL' : sprintf(Util::$dfnString, 'LANG.level', 'PL');
@@ -711,13 +709,13 @@ class SpellList extends BaseType
case 'O':
if ($lookup)
{
list($min, $max) = $this->calculateAmountForCurrent($effIdx, $this->refSpells[$lookup]);
list($min, $max, $modStrMin, $modStrMax) = $this->calculateAmountForCurrent($effIdx, $this->refSpells[$lookup]);
$periode = $this->refSpells[$lookup]->getField('effect'.$effIdx.'Periode');
$duration = $this->refSpells[$lookup]->getField('duration');
}
else
{
list($min, $max) = $this->calculateAmountForCurrent($effIdx);
list($min, $max, $modStrMin, $modStrMax) = $this->calculateAmountForCurrent($effIdx);
$periode = $this->getField('effect'.$effIdx.'Periode');
$duration = $this->getField('duration');
}
@@ -733,7 +731,10 @@ class SpellList extends BaseType
if ($equal)
eval("\$min = $min $op $oparg;");
return $min . (!$equal ? Lang::$game['valueDelim'] . $max : null);
if ($this->interactive)
return $modStrMin.$min . (!$equal ? Lang::$game['valueDelim'] . $modStrMax.$max : null);
else
return $min . (!$equal ? Lang::$game['valueDelim'] . $max : null);
case 'q': // EffectMiscValue
case 'Q':
if ($lookup)
@@ -760,13 +761,13 @@ class SpellList extends BaseType
case 'S':
if ($lookup)
{
list($min, $max) = $this->calculateAmountForCurrent($effIdx, $this->refSpells[$lookup]);
list($min, $max, $modStrMin, $modStrMax) = $this->calculateAmountForCurrent($effIdx, $this->refSpells[$lookup]);
$mv = $this->refSpells[$lookup]->getField('effect'.$effIdx.'MiscValue');
$aura = $this->refSpells[$lookup]->getField('effect'.$effIdx.'AuraId');
}
else
{
list($min, $max) = $this->calculateAmountForCurrent($effIdx);
list($min, $max, $modStrMin, $modStrMax) = $this->calculateAmountForCurrent($effIdx);
$mv = $this->getField('effect'.$effIdx.'MiscValue');
$aura = $this->getField('effect'.$effIdx.'AuraId');
}
@@ -801,6 +802,8 @@ class SpellList extends BaseType
return '<!--rtg'.$rType.'-->'.$min.'&nbsp;<small>('.sprintf(Util::$setRatingLevelString, $this->charLevel, $rType, $min, Util::setRatingLevel($this->charLevel, $rType, $min)).')</small>';
else if ($rType && $equal)
return '<!--rtg'.$rType.'-->'.$min.'&nbsp;<small>('.Util::setRatingLevel($this->charLevel, $rType, $min).')</small>';
else if ($this->interactive)
return $modStrMin.$min . (!$equal ? Lang::$game['valueDelim'] . $modStrMax.$max : null);
else
return $min . (!$equal ? Lang::$game['valueDelim'] . $max : null);
case 't': // Periode
@@ -1016,7 +1019,7 @@ class SpellList extends BaseType
// step 0: get text
$data = Util::localizedString($this->curTpl, $type);
if (empty($data) || $data == "[]") // empty tooltip shouldn't be displayed anyway
return null;
return array();
// step 1: if the text is supplemented with text-variables, get and replace them
if (empty($this->spellVars[$this->id]) && $this->curTpl['spellDescriptionVariableId'] > 0)
@@ -1055,19 +1058,29 @@ class SpellList extends BaseType
$condBrktCnt = 0;
$targetPart = 3; // we usually want the second pair of brackets
$curPart = 0; // parts: $? 0 [ 1 ] 2 [ 3 ] 4
$relSpells = []; // see spells_enus
$condOutStr = '';
if (!empty($matches[3])) // we can do this! -> eval
{
$cnd = eval('return ('.$matches[3].');');
if (is_numeric($cnd) && $cnd) // only case, deviating from normal; positive result -> use [true]
$cnd = $this->resolveEvaluation($matches[3]);
if ((is_numeric($cnd) || is_bool($cnd)) && $cnd) // only case, deviating from normal; positive result -> use [true]
$targetPart = 1;
$condStartPos = strpos($data, $matches[3]) - 2;
$condCurPos = $condStartPos;
}
/*
_[100].tooltip_enus = '<table><tr><td><b>Charge</b><br />8 - 25 yd range<table width="100%"><tr><td>Instant</td><th>20 sec cooldown</th></tr></table>Requires Warrior<br />Requires level 3</td></tr></table><table><tr><td><span class="q">Charge to an enemy, stunning it <!--sp58377:0--><!--sp58377-->for <!--sp103828:0-->1 sec<!--sp103828-->. Generates 20 Rage.</span></td></tr></table>';
_[100].buff_enus = '';
_[100].spells_enus = {"58377": [["", "and 2 additional nearby targets "]], "103828": [["1 sec", "3 sec and reducing movement speed by 50% for 15 sec"]]};
_[100].buffspells_enus = {};
Turns the Shaman into a Ghost Wolf, increasing speed by $s2%$?s59289[ and regenerating $59289s1% of your maximum health every 5 sec][].
Lasts 5 min. $?$gte($pl,68)[][Cannot be used on items level 138 and higher.]
*/
else if (!empty($matches[2])) // aura/spell-condition .. use false; TODO (low): catch cases and port "know"-param for tooltips from 5.0
{ // tooltip_enus: Charge to an enemy, stunning it <!--sp58377:0--><!--sp58377-->for <!--sp103828:0-->1 sec<!--sp103828-->.; spells_enus: {"58377": [["", "and 2 additional nearby targets "]], "103828": [["1 sec", "3 sec"]]};
$condStartPos = strpos($data, $matches[2]) - 2;
@@ -1212,20 +1225,20 @@ class SpellList extends BaseType
// line endings
$str = strtr($str, ["\r" => '', "\n" => '<br />']);
return $str;
return array($str, null/*$relSpells*/);
}
public function renderBuff($level = MAX_LEVEL, $interactive = false)
{
if (!$this->curTpl)
return null;
return array();
if (isset($this->buffs[$this->id]))
return $this->buffs[$this->id];
// doesn't have a buff
if (!Util::localizedString($this->curTpl, 'buff'))
return '';
return array();
$this->interactive = $interactive;
@@ -1243,7 +1256,8 @@ class SpellList extends BaseType
$x .= '<table><tr><td>';
// parse Buff-Text
$x .= $this->parseText('buff', $level, $this->interactive).'<br>';
$btt = $this->parseText('buff', $level, $this->interactive);
$x .= $btt[0].'<br>';
// duration
if ($this->curTpl['duration'] > 0)
@@ -1251,15 +1265,15 @@ class SpellList extends BaseType
$x .= '</td></tr></table>';
$this->buffs[$this->id] = $x;
$this->buffs[$this->id] = array($x, $btt[1]);
return $x;
return $this->buffs[$this->id];
}
public function renderTooltip($level = MAX_LEVEL, $interactive = false)
{
if (!$this->curTpl)
return null;
return array();
if (isset($this->tooltips[$this->id]))
return $this->tooltips[$this->id];
@@ -1402,7 +1416,7 @@ class SpellList extends BaseType
$xTmp[] = Lang::$game['requires2'].' '.$reqItems;
if ($desc)
$xTmp[] = '<span class="q">'.$desc.'</span>';
$xTmp[] = '<span class="q">'.$desc[0].'</span>';
if ($createItem)
$xTmp[] = '<br />'.$createItem;
@@ -1410,9 +1424,9 @@ class SpellList extends BaseType
if ($tools || $reagents || $reqItems || $desc || $createItem)
$x .= '<table><tr><td>'.implode('<br />', $xTmp).'</td></tr></table>';
$this->tooltips[$this->id] = $x;
$this->tooltips[$this->id] = array($x, $desc[1]);
return $x;
return $this->tooltips[$this->id];
}
public function getTalentHeadForCurrent()

View File

@@ -437,6 +437,7 @@ define('ITEM_MOD_SPELL_POWER', 45);
define('ITEM_MOD_HEALTH_REGEN', 46);
define('ITEM_MOD_SPELL_PENETRATION', 47);
define('ITEM_MOD_BLOCK_VALUE', 48);
// ITEM_MOD_MASTERY_RATING, 49
define('ITEM_MOD_ARMOR', 50); // resistances v
define('ITEM_MOD_FIRE_RESISTANCE', 51);
define('ITEM_MOD_FROST_RESISTANCE', 52);

View File

@@ -959,6 +959,17 @@ class Util
'arcres', 'firsplpwr', 'frosplpwr', 'holsplpwr', 'shasplpwr', 'natsplpwr', 'arcsplpwr'
);
public static $itemFilter = array(
20 => 'str', 21 => 'agi', 23 => 'int', 22 => 'sta', 24 => 'spi', 25 => 'arcres', 26 => 'firres', 27 => 'natres',
28 => 'frores', 29 => 'shares', 30 => 'holres', 37 => 'mleatkpwr', 32 => 'dps', 35 => 'damagetype', 33 => 'dmgmin1', 34 => 'dmgmax1',
36 => 'speed', 38 => 'rgdatkpwr', 39 => 'rgdhitrtng', 40 => 'rgdcritstrkrtng', 41 => 'armor', 44 => 'blockrtng', 43 => 'block', 42 => 'defrtng',
45 => 'dodgertng', 46 => 'parryrtng', 48 => 'splhitrtng', 49 => 'splcritstrkrtng', 50 => 'splheal', 51 => 'spldmg', 52 => 'arcsplpwr', 53 => 'firsplpwr',
54 => 'frosplpwr', 55 => 'holsplpwr', 56 => 'natsplpwr', 60 => 'healthrgn', 61 => 'manargn', 57 => 'shasplpwr', 77 => 'atkpwr', 78 => 'mlehastertng',
79 => 'resirtng', 84 => 'mlecritstrkrtng', 94 => 'splpen', 95 => 'mlehitrtng', 96 => 'critstrkrtng', 97 => 'feratkpwr', 100 => 'nsockets', 101 => 'rgdhastertng',
102 => 'splhastertng', 103 => 'hastertng', 114 => 'armorpenrtng', 115 => 'health', 116 => 'mana', 117 => 'exprtng', 119 => 'hitrtng', 123 => 'splpwr',
134 => 'mledps', 135 => 'mledmgmin', 136 => 'mledmgmax', 137 => 'mlespeed', 138 => 'rgddps', 139 => 'rgddmgmin', 140 => 'rgddmgmax', 141 => 'rgdspeed'
);
public static $ssdMaskFields = array(
'shoulderMultiplier', 'trinketMultiplier', 'weaponMultiplier', 'primBudged',
'rangedMultiplier', 'clothShoulderArmor', 'leatherShoulderArmor', 'mailShoulderArmor',

View File

@@ -128,6 +128,7 @@ $lang = array(
'school' => "Magieart",
'spell' => "Zauber",
'spells' => "Zauber",
'type' => "Art",
'valueDelim' => " - ", // " bis "
'zone' => "Zone",
'zones' => "Gebiete",
@@ -302,7 +303,6 @@ $lang = array(
'_pieces' => "Teile",
'_unavailable' => "Dieses Ausrüstungsset ist nicht für Spieler verfügbar.",
'_tag' => "Tag",
'_type' => "Art",
'notes' => array(
null, "Dungeon-Set 1", "Dungeon-Set 2", "Tier 1 Raid-Set",

View File

@@ -123,6 +123,7 @@ $lang = array(
'school' => "School",
'spell' => "spell",
'spells' => "Spells",
'type' => "Type",
'valueDelim' => " to ",
'zone' => "zone",
'zones' => "Zones",
@@ -297,7 +298,6 @@ $lang = array(
'_pieces' => "pieces",
'_unavailable' => "This item set is not available to players.",
'_tag' => "Tag",
'_type' => "Type",
'notes' => array(
null, "Dungeon Set 1", "Dungeon Set 2", "Tier 1 Raid Set",

View File

@@ -120,6 +120,7 @@ $lang = array(
'school' => "Escuela",
'spell' => "hechizo",
'spells' => "Hechizos",
'type' => "Tipo",
'valueDelim' => " - ",
'zone' => "zona",
'zones' => "Zonas",
@@ -255,7 +256,6 @@ $lang = array(
'_pieces' => "piezas",
'_unavailable' => "Este conjunto de objetos no está disponible para jugadores.",
'_tag' => "Etiqueta",
'_type' => "Tipo",
'notes' => array(
null, "Set de mazmorra 1", "Set de mazmorra 2", "Set de banda tier 1",

View File

@@ -120,6 +120,7 @@ $lang = array(
'school' => "École",
'spell' => "sort",
'spells' => "Sorts",
'type' => "Type",
'valueDelim' => " - ",
'zone' => "zone",
'zones' => "Zones",
@@ -254,7 +255,6 @@ $lang = array(
'_pieces' => "pièces",
'_unavailable' => "Cet objet n'est plus disponible aux joueurs.",
'_tag' => "Étiquette",
'_type' => "Type",
'notes' => array(
null, "Ensemble de donjon 1", "Ensemble de donjon 2", "Ensemble de raid palier 1",

View File

@@ -120,6 +120,7 @@ $lang = array(
'school' => "Школа",
'spell' => "заклинание",
'spells' => "Заклинания",
'type' => "Тип",
'valueDelim' => " - ",
'zone' => "игровая зона",
'zones' => "Местности",
@@ -254,7 +255,6 @@ $lang = array(
'_pieces' => "частей",
'_unavailable' => "Этот набор предметов не доступен игрокам.",
'_tag' => "Тэг",
'_type' => "Тип",
'notes' => array(
null, "Комплект подземелий 1", "Комплект подземелий 2", "Рейдовый комплект Tier 1",

View File

@@ -68,7 +68,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
// type
if ($ty)
$infobox[] = Lang::$itemset['_type'].lang::$colon.Lang::$itemset['types'][$ty];
$infobox[] = Lang::$game['type'].lang::$colon.Lang::$itemset['types'][$ty];
// tag
if ($ta)
@@ -134,7 +134,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
while ($setSpells->id != $s['id'])
$setSpells->iterate();
$s['desc'] = $setSpells->parseText('description');
$s['desc'] = $setSpells->parseText('description')[0];
}
// path

View File

@@ -28,8 +28,8 @@ if (isset($_GET['power']))
$x = '$WowheadPower.registerNpc('.$id.', '.User::$localeId.", {\n";
$x .= "\tname_".User::$localeString.": '".Util::jsEscape($npc->getField('name', true))."',\n";
$x .= "\ttooltip_".User::$localeString.': \''.$npc->renderTooltip()."',\n";
$x .= "\tmap: ".($s ? '{zone: '.$s[0].', coords: {0:'.json_encode($s[1], JSON_NUMERIC_CHECK).'}' : '{}')."\n";
$x .= "\ttooltip_".User::$localeString.': \''.Util::jsEscape($npc->renderTooltip())."',\n";
// $x .= "\tmap: ".($s ? '{zone: '.$s[0].', coords: {0:'.json_encode($s[1], JSON_NUMERIC_CHECK).'}' : '{}')."\n";
$x .= "});";
$smarty->saveCache($cacheKeyTooltip, $x);

View File

@@ -30,10 +30,16 @@ if (isset($_GET['power']))
$pt[] = "\tname_".User::$localeString.": '".Util::jsEscape($n)."'";
if ($i = $spell->getField('iconString'))
$pt[] = "\ticon: '".urlencode($i)."'";
if ($t = $spell->renderTooltip())
$pt[] = "\ttooltip_".User::$localeString.": '".Util::jsEscape($t)."'";
if ($b = $spell->renderBuff())
$pt[] = "\tbuff_".User::$localeString.": '".Util::jsEscape($b)."'";
if ($tt = $spell->renderTooltip())
{
$pt[] = "\ttooltip_".User::$localeString.": '".Util::jsEscape($tt[0])."'";
$pt[] = "\tspells_".User::$localeString.": ".json_encode($tt[1], JSON_UNESCAPED_UNICODE);
}
if ($btt = $spell->renderBuff())
{
$pt[] = "\tbuff_".User::$localeString.": '".Util::jsEscape($btt[0])."'";
$pt[] = "\tbuffspells_".User::$localeString.": ".json_encode($btt[1], JSON_UNESCAPED_UNICODE);;
}
$x .= implode(",\n", $pt)."\n});";
$smarty->saveCache($cacheKeyTooltip, $x);
@@ -106,10 +112,16 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
$pageData['page'] = $spell->getDetailPageData();
// description
$pageData['page']['info'] = $spell->renderTooltip(MAX_LEVEL, true);
@list(
$pageData['page']['info'],
$pageData['page']['spells']
) = $spell->renderTooltip(MAX_LEVEL, true);
// buff
$pageData['page']['buff'] = $spell->renderBuff(MAX_LEVEL, true);
@list(
$pageData['page']['buff'],
$pageData['page']['buffspells']
) = $spell->renderBuff(MAX_LEVEL, true);
// infobox
$infobox = [];

View File

@@ -58,6 +58,9 @@ $found = [];
$jsGlobals = [];
$maxResults = 500; // todo: move to config
$_wt = isset($_GET['wt']) ? explode(':', $_GET['wt']) : null;
$_wtv = isset($_GET['wtv']) ? explode(':', $_GET['wtv']) : null;
if (isset($_GET['json']))
{
if ($type == TYPE_ITEMSET)
@@ -97,7 +100,7 @@ if (strlen($query) < 3 || !($searchMask & SEARCH_MASK_ALL))
header("Content-type: text/javascript");
exit('["'.Util::jsEscape($query).'", []]');
}
else /* if ($searchMask & SEARCH_TYPE_JSON) */
else if (!$_wt || !$_wtv) // implicitly: SEARCH_TYPE_JSON
{
header("Content-type: text/javascript");
exit ("[\"".Util::jsEscape($query)."\", [\n],[\n]]\n");
@@ -324,14 +327,22 @@ if ($searchMask & 0x20)
// 7 Items
if ($searchMask & 0x40)
{
$miscData = $conditions = [];
if (($searchMask & SEARCH_TYPE_JSON) && $type == TYPE_ITEMSET && isset($found['itemset']))
{
$conditions = [['i.entry', array_keys($found['itemset']['pcsToSet'])], 0];
$miscData = ['pcsToSet' => @$found['itemset']['pcsToSet']];
}
else if (($searchMask & SEARCH_TYPE_JSON) && $type == TYPE_ITEM)
{
$conditions = [['i.class', [2, 4]], [User::$localeId ? 'name_loc'.User::$localeId : 'name', $query], $AoWoWconf['sqlLimit']];
$miscData = ['wt' => $_wt, 'wtv' => $_wtv];
}
else
$conditions = [[User::$localeId ? 'name_loc'.User::$localeId : 'name', $query], $maxResults];
$items = new ItemList($conditions, @$found['itemset']['pcsToSet']);
$items = new ItemList($conditions, $miscData);
if ($data = $items->getListviewData($searchMask & SEARCH_TYPE_JSON ? (ITEMINFO_SUBITEMS | ITEMINFO_JSON) : 0))
{
@@ -936,15 +947,6 @@ if ($searchMask & 0x1000000)
*/
if ($searchMask & SEARCH_TYPE_JSON)
{
/*
todo (med):
&wt=21:134:20:170:77:117:119:96:103&wtv=100:96:41:41:39:32:32:31:29
additional url-parameter 'wt':ratingId/statId; 'wtv':applyPct (dafault 0)
search for items with these stats (name becomes optional)
how the fuck should i modify item_template_addon to accomodate this search behaviour... x_X
- is it possible to use space separated integers and not cause the search to take forever to execute
- one column per mod is probably the most efficient way to search but a pain to look at .. there are at least 150 after all
*/
$outItems = '';
$outSets = '';

BIN
setup/item_stats.rar Normal file

Binary file not shown.

View File

@@ -81,7 +81,7 @@ if (!defined('AOWOW_REVISION'))
$glyphsOut[$pop['itemId']] = array(
'name' => Util::localizedString($pop, 'name'),
'description' => $glyphSpells->parseText(),
'description' => $glyphSpells->parseText()[0],
'icon' => $pop['icon'],
'type' => $pop['type'],
'classs' => $pop['classs'],

View File

@@ -116,7 +116,7 @@ if (!defined('AOWOW_REVISION'))
for ($k = 0; $k <= ($m - 1); $k++)
{
$tSpell = new SpellList(array(['s.id', (int)$talents[$j]['rank'.($k + 1)]]));
$d[] = $tSpell->parseText();
$d[] = $tSpell->parseText()[0];
$s[] = $talents[$j]['rank'.($k + 1)];
if ($talents[$j]['isSpell'])

64
setup/tools/sql/_item.php Normal file
View File

@@ -0,0 +1,64 @@
<?php
if (!defined('AOWOW_REVISION'))
die('illegal access');
class ItemSetup extends ItemList
{
private $cols = [];
public function __construct($start, $end) // i suggest steps of 5k at max (12 steps (0 - 60k)); otherwise eats your ram for breakfast
{
$this->cols = DB::Aowow()->selectCol('SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA`="world" AND `TABLE_NAME`="aowow_item_stats"');
set_time_limit(300);
$conditions = array(
['i.entry', $start, '>'],
['i.entry', $end, '<='],
[
'OR',
['class', 4],
['class', 2]
],
0
);
parent::__construct($conditions);
}
public function writeStatsTable()
{
while ($this->iterate())
{
$this->extendJsonStats();
$updateFields = [];
foreach (@$this->json[$this->id] as $k => $v)
{
if (!in_array($k, $this->cols) || !$v)
continue;
$updateFields[$k] = number_format($v, 2, ',', '');
}
if (isset($this->itemMods[$this->id]))
{
foreach ($this->itemMods[$this->id] as $k => $v)
{
if (!$v)
continue;
if ($str = Util::$itemMods[$k])
$updateFields[$str] = number_format($v, 2, ',', '');
}
}
if ($updateFields)
DB::Aowow()->query('REPLACE INTO ?_item_stats (`itemid`, `'.implode('`, `', array_keys($updateFields)).'`) VALUES (?d, "'.implode('", "', $updateFields).'")', $this->id);
}
}
}
?>

View File

@@ -289,7 +289,7 @@ foreach ($locales as $loc)
$name[$loc] = '"'.Util::sqlEscape(Util::localizedString($set, 'name')).'"';
while ($bonusSpells->iterate())
@$descText[$loc] .= $bonusSpells->parseText()."\n";
@$descText[$loc] .= $bonusSpells->parseText()[0]."\n";
$descText[$loc] = '"'.Util::sqlEscape($descText[$loc]).'"';
}