diff --git a/data.php b/data.php index 329a2c91..f4f2dedd 100644 --- a/data.php +++ b/data.php @@ -4,36 +4,132 @@ if (!defined('AOWOW_REVISION')) die('illegal access'); +// requires valid token to hinder automated access +// todo (low): research, when to use the token +if ($_GET['data'] != 'item-scaling') +{ + if (empty($_GET['t']) || empty($_SESSION['dataKey'])) + die(); + + if ($_GET['t'] != $_SESSION['dataKey']) + die(); +} + + header('Content-type: application/x-javascript'); // different data can be strung together - $datasets = array_unique(explode('.', $_GET['data'])); $params = ''; + +// great, we can set our locale .. just .. what for..? +if (isset($_GET['locale']) && is_numeric($_GET['locale'])) + User::useLocale($_GET['locale']); + foreach ($datasets as $data) { switch ($data) { - // Profiler + // Profiler (this .. _COULD_ be static . it's basicly just "ALL" available data of one type) case 'factions': case 'quests': case 'companions': case 'recipes': case 'mounts': - if (empty($_GET['callback']) || empty($_GET['t'])) + if (empty($_GET['callback'])) break; - $token = intVal($_GET['t']); + $catg = 'null'; // hm, looks like its just for preselection.. + $skill = []; $callback = $_GET['callback']; - if (!$token || substr($callback, 0, 17) != '$WowheadProfiler.') + + if (!empty($_GET['skill'])) + { + $skill = explode(',', $_GET['skill']); + array_walk($skill, function(&$v, $k) { + $v = intVal($v); + }); + } + + if (substr($callback, 0, 17) != '$WowheadProfiler.') break; -/* - get data via token: - > echo data in unknown format here - echo '$WowheadProfiler.loadOnDemand('.$data.', );'; -*/ + if ($data == 'factions') + { + $cnd = null; + $obj = 'FactionList'; + $glob = 'g_factions'; + + echo "g_faction_order = [0, 469, 891, 1037, 1118, 67, 1052, 892, 936, 1117, 169, 980, 1097];\n\n"; + } + else if ($data == 'quests') + { + // may have &partial set .. what to do .. what to do.. + + $cnd = null; + $obj = 'QuestList'; + $glob = 'g_quests'; + + echo "g_quest_catorder = [];\n\n"; + } + else if ($data == 'companions') + { + $cnd = ['typeCat', -6]; + $obj = 'SpellList'; + $glob = 'g_spells'; + $catg = 778; + } + else if ($data == 'recipes') + { + $cnd = ['OR', ['typeCat', 9], ['typeCat', 11]]; + if ($skill) + $cnd = ['AND', ['skillLine1', $skill], $cnd]; + + $obj = 'SpellList'; + $glob = 'g_spells'; + // $catg = 185; + + echo "g_skill_order = [171, 164, 333, 202, 182, 773, 755, 165, 186, 393, 197, 185, 129, 356, 762];\n\n"; + } + else if ($data == 'mounts') + { + $cnd = ['typeCat', -5]; + $obj = 'SpellList'; + $glob = 'g_spells'; + $catg = 777; + } + + $cnd = [[['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW], 0], $cnd, CFG_SQL_LIMIT_NONE]; + $list = new $obj($cnd); + $dataz = $list->getListviewData(ITEMINFO_MODEL); + foreach ($dataz as $i => $d) + { + if (isset($d['quality'])) // whoever thought of prepending quality to the name may burn in hell! + { + $d['name'] = $d['quality'].$d['name']; + unset($d['quality']); + } + + echo $glob.'['.$i.'] = '.json_encode($d, JSON_NUMERIC_CHECK).";\n"; + } + + if ($data == 'recipes') // todo: skip adding reagents + foreach ($list->relItems->iterate() as $iId => $tpl) + echo "g_items.add(".$iId.", {'icon':'".$tpl['iconString']."'});\n"; + + /* issue: + when we load onDemand, the jScript tries to generate the catg-tree before the it is initialized + it cant be initialized, without loading the data as empty catg are omitted + loading the data triggers the generation of the catg-tree + + obviously only, if we have no initial data set + + yay .. either way, we loose + */ + + echo "\n\$WowheadProfiler.loadOnDemand('".$data."', ".$catg.");\n"; + break; // locale independant case 'zones': diff --git a/includes/kernel.php b/includes/kernel.php index 4b1ed09f..56a39130 100644 --- a/includes/kernel.php +++ b/includes/kernel.php @@ -58,6 +58,18 @@ $e = CFG_DEBUG ? (E_ALL & ~(E_DEPRECATED | E_USER_DEPRECATED | E_STRICT)) : 0; error_reporting($e); +// php session (used for profiler: g_dataKey) (todo (high): merge to user-class at some point) +session_start(); +if (empty($_SESSION['timeout']) || $_SESSION['timeout'] < time()) +{ + $seed = "abcdefghijklmnopqrstuvwxyz0123456789"; + $_SESSION['dataKey'] = ''; // just some random numbers for identifictaion purpose + for ($i = 0; $i < 40; $i++) + $_SESSION['dataKey'] .= substr($seed, mt_rand(0, 35), 1); +} +$_SESSION['timeout'] = time() + CFG_SESSION_TIMEOUT_DELAY; + + // debug: measure execution times Util::execTime(CFG_DEBUG); diff --git a/includes/types/spell.class.php b/includes/types/spell.class.php index c97a2a43..19ceaf62 100644 --- a/includes/types/spell.class.php +++ b/includes/types/spell.class.php @@ -405,6 +405,93 @@ class SpellList extends BaseType return $this->tools; } + public function getModelInfo($targetId = 0) + { + $displays = [0 => []]; + foreach ($this->iterate() as $id => $__) + { + if ($targetId && $targetId != $id) + continue; + + for ($i = 1; $i < 4; $i++) + { + $effMV = $this->curTpl['effect'.$i.'MiscValue']; + if (!$effMV) + continue; + + // GO Model from MiscVal + if (in_array($this->curTpl['effect'.$i.'Id'], [50, 76, 104, 105, 106, 107])) + { + $displays[TYPE_OBJECT][$id] = $effMV; + break; + } + // NPC Model from MiscVal + else if (in_array($this->curTpl['effect'.$i.'Id'], [28, 90]) || in_array($this->curTpl['effect'.$i.'AuraId'], [56, 78])) + { + $displays[TYPE_NPC][$id] = $effMV; + break; + } + // Shapeshift + else if ($this->curTpl['effect'.$i.'AuraId'] == 36) + { + $subForms = array( + 892 => [892, 29407, 29406, 29408, 29405], // Cat - NE + 8571 => [8571, 29410, 29411, 29412], // Cat - Tauren + 2281 => [2281, 29413, 29414, 29416, 29417], // Bear - NE + 2289 => [2289, 29415, 29418, 29419, 29420, 29421] // Bear - Tauren + ); + + if ($st = DB::Aowow()->selectRow('SELECT *, displayIdA as model1, displayIdH as model2 FROM ?_shapeshiftForms WHERE id = ?d', $effMV)) + { + foreach ([1, 2] as $i) + if (isset($subForms[$st['model'.$i]])) + $st['model'.$i] = $subForms[$st['model'.$i]][array_rand($subForms[$st['model'.$i]])]; + + $displays[0][$id] = array( + 'npcId' => 0, + 'displayId' => [$st['model1'], $st['model2']], + 'creatureType' => $st['creatureType'], + 'displayName' => Util::localizedString($st, 'name') + ); + break; + } + } + } + } + + $results = $displays[0]; + + if (!empty($displays[TYPE_NPC])) + { + $nModels = new CreatureList(array(['id', $displays[TYPE_NPC]])); + foreach ($nModels->iterate() as $nId => $__) + { + $srcId = array_search($nId, $displays[TYPE_NPC]); + $results[$srcId] = array( + 'typeId' => $nId, + 'displayId' => $nModels->getRandomModelId(), + 'displayName' => $nModels->getField('name', true) + ); + } + } + + if (!empty($displays[TYPE_OBJECT])) + { + $oModels = new GameObjectList(array(['id', $displays[TYPE_OBJECT]])); + foreach ($oModels->iterate() as $oId => $__) + { + $srcId = array_search($oId, $displays[TYPE_OBJECT]); + $results[$srcId] = array( + 'typeId' => $oId, + 'displayId' => $oModels->getField('displayId'), + 'displayName' => $oModels->getField('name', true) + ); + } + } + + return $targetId ? @$results[$targetId] : $results; + } + private function createRangesForCurrent() { if (!$this->curTpl['rangeMaxHostile']) @@ -1433,17 +1520,20 @@ Lasts 5 min. $?$gte($pl,68)[][Cannot be used on items level 138 and higher.] // get created items (may need improvement) $createItem = ''; - if ($this->curTpl['typeCat'] == 11) // only Professions + if (in_array($this->curTpl['typeCat'], [9, 11])) // only Professions { - for ($i = 1; $i <= 3; $i++) + foreach ($this->canCreateItem() as $idx) { - if ($this->curTpl['effect'.$i.'Id'] == 53) // Enchantment (has createItem Scroll of Enchantment) + if ($this->curTpl['effect'.$idx.'Id'] == 53)// Enchantment (has createItem Scroll of Enchantment) continue; - if ($cId = $this->curTpl['effect'.$i.'CreateItemId']) + foreach ($this->relItems->iterate() as $cId => $__) { - $createItem = (new ItemList(array(['i.id', (int)$cId])))->renderTooltip([], true, $this->id); - break; + if ($cId != $this->curTpl['effect'.$idx.'CreateItemId']) + continue; + + $createItem = $this->relItems->renderTooltip([], true, $this->id); + break 2; } } } @@ -1589,9 +1679,13 @@ Lasts 5 min. $?$gte($pl,68)[][Cannot be used on items level 138 and higher.] return [$org, $ylw, $grn, $gry]; } - public function getListviewData() + public function getListviewData($addInfoMask = 0x0) { $data = []; + + if ($addInfoMask & ITEMINFO_MODEL) + $modelInfo = $this->getModelInfo(); + foreach ($this->iterate() as $__) { $quality = ($this->curTpl['cuFlags'] & SPELL_CU_QUALITY_MASK) >> 8; @@ -1655,6 +1749,17 @@ Lasts 5 min. $?$gte($pl,68)[][Cannot be used on items level 138 and higher.] if ($mask = $this->curTpl['reqRaceMask']) $data[$this->id]['reqrace'] = $mask; + + + if ($addInfoMask & ITEMINFO_MODEL) + { + if ($mi = @$modelInfo[$this->id]) + { + $data[$this->id]['npcId'] = $mi['typeId']; + $data[$this->id]['displayId'] = $mi['displayId']; + $data[$this->id]['displayName'] = $mi['displayName']; + } + } } return $data; diff --git a/pages/compare.php b/pages/compare.php index bc3f0ceb..0d088c30 100644 --- a/pages/compare.php +++ b/pages/compare.php @@ -21,7 +21,7 @@ $pageData = array( 'static/js/filters.js', 'static/js/Summary.js', 'static/js/swfobject.js', - '?data=weight-presets.gems.enchants.itemsets' + '?data=weight-presets.gems.enchants.itemsets&locale='.User::$localeId.'&t='.$_SESSION['dataKey'] ) ); $compareString = ''; diff --git a/pages/item.php b/pages/item.php index 70885581..870ef345 100644 --- a/pages/item.php +++ b/pages/item.php @@ -462,7 +462,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) 'static/js/swfobject.js', 'static/js/profile.js', 'static/js/filters.js', - '?data=weight-presets' + '?data=weight-presets&locale='.User::$localeId.'&t='.$_SESSION['dataKey'] ), 'reqCSS' => array( $pageText ? ['path' => 'static/css/Book.css'] : null, diff --git a/pages/items.php b/pages/items.php index 18305ca3..86404ce2 100644 --- a/pages/items.php +++ b/pages/items.php @@ -187,7 +187,7 @@ if (!$smarty->loadCache($cacheKey, $pageData, $filter)) 'reqJS' => array( 'static/js/filters.js', 'static/js/swfobject.js', - '?data=weight-presets' + '?data=weight-presets&locale='.User::$localeId.'&t='.$_SESSION['dataKey'] ) ), 'lv' => array( diff --git a/pages/itemsets.php b/pages/itemsets.php index b02e9bda..21f82ebb 100644 --- a/pages/itemsets.php +++ b/pages/itemsets.php @@ -34,7 +34,7 @@ if (!$smarty->loadCache($cacheKey, $pageData, $filter)) 'subCat' => $pageParam ? '='.$pageParam : '', 'reqJS' => array( 'static/js/filters.js', - '?data=weight-presets' + '?data=weight-presets&locale='.User::$localeId.'&t='.$_SESSION['dataKey'] ) ), 'lv' => [] diff --git a/pages/maps.php b/pages/maps.php index 5eca43cf..44c4e970 100644 --- a/pages/maps.php +++ b/pages/maps.php @@ -16,7 +16,7 @@ $smarty->updatePageVars(array( 'reqJS' => array( 'static/js/maps.js', 'static/js/Mapper.js', - '?data=zones' + '?data=zones&locale='.User::$localeId.'&t='.$_SESSION['dataKey'] ) )); $smarty->assign('lang', array_merge(Lang::$main, Lang::$maps)); diff --git a/pages/profile.php b/pages/profile.php index f6702da8..ff0d1d97 100644 --- a/pages/profile.php +++ b/pages/profile.php @@ -252,12 +252,12 @@ function handleLoad() [/*oneArrayPerPet*/], ), 'skills' => [333 => [150, 450]], // can contain anything, should be limited to prim/sec professions - 'reputation' => [], + 'reputation' => [70 => 42500], 'achievements' => [], 'achievementpoints' => 9001, // max you have 'titles' => [111 => 1, 144 => 1], 'quests' => [], - 'spells' => [], + 'spells' => [67527 => 1, 41252 => 1, 25659 => 1, 27984 => 1], // 'glyphs' => [], // not really used .. i guess..? 'inventory' => [], 'playedtime' => 1 * YEAR + 10 * MONTH + 21 * DAY, // exact to the day @@ -325,7 +325,7 @@ function handleLoad() if (empty($data[$iId])) continue; - $buff .= "\r\ng_items.add(".$iId.', {name_'.User::$localeString.':"'.Util::jsEscape($itemz->getField('name', true)).'", quality:'.$itemz->getField('quality').', icon:"'.$itemz->getField('iconString').'", jsonequip:'.json_encode($data[$iId], JSON_NUMERIC_CHECK).'})'; + $buff .= "\ng_items.add(".$iId.', {name_'.User::$localeString.':"'.Util::jsEscape($itemz->getField('name', true)).'", quality:'.$itemz->getField('quality').', icon:"'.$itemz->getField('iconString').'", jsonequip:'.json_encode($data[$iId], JSON_NUMERIC_CHECK).'})'; } /* CUSTOM AURAS */ @@ -334,7 +334,7 @@ function handleLoad() $dataz = $auraz->getListviewData(); $modz = $auraz->getProfilerMods(); - $buff .= "\r\n"; + $buff .= "\n"; foreach ($dataz as $id => $data) { if (!empty($modz[$id])) @@ -350,7 +350,7 @@ function handleLoad() } $json = preg_replace('/"\$([^$"]+)"/', '\1', json_encode($data, JSON_NUMERIC_CHECK)); - $buff .= "\r\ng_spells.add(".$id.', '.$json.');'; + $buff .= "\ng_spells.add(".$id.', '.$json.');'; } /* END CUSTOM */ @@ -358,7 +358,7 @@ function handleLoad() $mountz = new SpellList(array(['typeCat', -5])); $dataz = $mountz->getListviewData(); foreach ($dataz as $id => $data) - echo "\r\ng_spells.add(".$id.', '.json_encode($data, JSON_NUMERIC_CHECK).');'; + echo "\ng_spells.add(".$id.', '.json_encode($data, JSON_NUMERIC_CHECK).');'; @@ -371,11 +371,11 @@ function handleLoad() $titlez = new TitleList(array(CFG_SQL_LIMIT_NONE, [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0])); // all available $dataz = $titlez->getListviewData(); - $buff .= "\r\n\r\nvar _ = g_titles;"; + $buff .= "\n\nvar _ = g_titles;"; foreach ($dataz as $id => $data) { $s = !empty($data[$id]['source']) ? ', source: '.($data[$id]['source']) : null; - $buff .= "\r\n_[".$id."] = {name:'".Util::jsEscape($character['gender'] && !empty($data['namefemale']) ? $data['namefemale'] : $data['name'])."', gender:".$data['gender'].', category:'.$data['category'].$s.'};'; + $buff .= "\n_[".$id."] = {name:'".Util::jsEscape($character['gender'] && !empty($data['namefemale']) ? $data['namefemale'] : $data['name'])."', gender:".$data['gender'].', category:'.$data['category'].$s.'};'; } // buffer achievements / statistics @@ -389,27 +389,26 @@ function handleLoad() $dataz = $achievez->getListviewData(ACHIEVEMENTINFO_PROFILE); $sumPoints = 0; - $buff .= "\r\n\r\nvar _ = g_achievements;"; + $buff .= "\n\nvar _ = g_achievements;"; foreach ($dataz as $id => $data) { $sumPoints += $data['points']; - $buff .= "\r\n_[".$id.'] = '.json_encode($data, JSON_NUMERIC_CHECK).';'; + $buff .= "\n_[".$id.'] = '.json_encode($data, JSON_NUMERIC_CHECK).';'; } // this list below is correct and expected. HOW THE HELL DOES THE SCRIPT GENERATE A TREE FROM THAT?! [ORDER BY parentId, posOrChildCount ASC] - $buff .= "\r\n\r\ng_achievement_catorder = [96, 97, 95, 168, 169, 201, 155, 81, 1, 130, 141, 128, 122, 133, 14807, 132, 134, 131, 21, 152, 153, 154, 165, 14801, 14802, 14803, 14804, 14881, 14901, 15003, 14861, 14862, 14863, 14777, 14778, 14779, 14780, 123, 124, 125, 126, 127, 135, 136, 137, 140, 145, 147, 191, 178, 173, 160, 187, 159, 163, 161, 162, 158, 14981, 156, 14941, 14808, 14805, 14806, 14921, 14922, 14923, 14961, 14962, 15001, 15002, 15041, 15042, 170, 171, 172, 14864, 14865, 14866, 14821, 14822, 14823, 14963, 15021, 15062]"; + $buff .= "\n\ng_achievement_catorder = [92, 96, 97, 95, 168, 169, 201, 155, 81, 1, 130, 141, 128, 122, 133, 14807, 132, 134, 131, 21, 152, 153, 154, 165, 14801, 14802, 14803, 14804, 14881, 14901, 15003, 14861, 14862, 14863, 14777, 14778, 14779, 14780, 123, 124, 125, 126, 127, 135, 136, 137, 140, 145, 147, 191, 178, 173, 160, 187, 159, 163, 161, 162, 158, 14981, 156, 14941, 14808, 14805, 14806, 14921, 14922, 14923, 14961, 14962, 15001, 15002, 15041, 15042, 170, 171, 172, 14864, 14865, 14866, 14821, 14822, 14823, 14963, 15021, 15062]"; // max achievable achievementpoints come separately .. as array.. with only one element .. seriously? - $buff .= "\r\n\r\ng_achievement_points = [".$sumPoints."];"; + $buff .= "\n\ng_achievement_points = [".$sumPoints."];"; /*** END STATIC ***/ - // excludes - $buff .= "\r\n\r\ng_excludes = {};"; + $buff .= "\n\ng_excludes = {};"; // add profile to buffer - $buff .= "\r\n\r\n\$WowheadProfiler.registerProfile(".json_encode($character, JSON_PRETTY_PRINT, JSON_NUMERIC_CHECK).");"; + $buff .= "\n\n\$WowheadProfiler.registerProfile(".json_encode($character, JSON_PRETTY_PRINT, JSON_NUMERIC_CHECK).");"; return $buff; } @@ -471,7 +470,7 @@ function getModelForForm($form, $char) if ($char['race'] == 4) // RACE_NIGHTELF { if ($char['hairColor'] >= 0 && $char['hairColor'] <= 2) - return 29413; // 29415 + return 29413; else if ($char['hairColor'] == 3) return 29417; else if ($char['hairColor'] == 4) @@ -513,7 +512,7 @@ function getModelForForm($form, $char) } } - // hey, still here? you're not a Tauren/Nelf as bear or cat, are you? + // hey, still here? you're not a Tauren/Nelf as bear or cat, are you? return DB::Aowow()->selectCell('SELECT IF(?d == 1, IFNULL(displayIdA, displayIdH), IFNULL(displayIdH, displayIdA)) FROM ?_shapeshiftForm WHERE id = ?d AND XXX', Util::sideByRaceMask(1 << ($char['race'] - 1)), $form); } @@ -586,7 +585,7 @@ switch ($pageParam) $pageData = array( 'page' => array( 'profileId' => $_profileId, - 'dataKey' => $_profileId, // should be some unique integer to manage ?data=-requests + 'dataKey' => $_SESSION['dataKey'], 'path' => json_encode($_path, JSON_NUMERIC_CHECK), 'title' => Util::ucFirst(Lang::$game['profile']), // actual name is set per jScript 'tab' => 1, @@ -597,7 +596,7 @@ $pageData = array( 'static/js/profile_all.js', 'static/js/profile.js', 'static/js/Profiler.js', - '?data=enchants.gems.glyphs.itemsets.pets.pet-talents.quick-excludes.realms.statistics.weight-presets' // quick-excludes?! + '?data=enchants.gems.glyphs.itemsets.pets.pet-talents.quick-excludes.realms.statistics.weight-presets&locale='.User::$localeId.'&t='.$_SESSION['dataKey'] // quick-excludes?! // ?data=user&1270968639 ), 'reqCSS' => array( diff --git a/pages/profiles.php b/pages/profiles.php index 85a1ad87..1b447fe8 100644 --- a/pages/profiles.php +++ b/pages/profiles.php @@ -148,7 +148,7 @@ $smarty->updatePageVars(array( 'static/js/filters.js?978', 'static/js/profile_all.js?978', 'static/js/profile.js?978', - '?data=weight-presets.realms&978', + '?data=weight-presets.realms&locale='.User::$localeId.'&t='.$_SESSION['dataKey'], // '?data=user&1280640186' ), 'reqCSS' => array( diff --git a/pages/spell.php b/pages/spell.php index 3cf33291..c4f141f1 100644 --- a/pages/spell.php +++ b/pages/spell.php @@ -408,9 +408,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) 'tab' => 0, 'type' => TYPE_SPELL, 'typeId' => $_id, - 'reqJS' => array( - $pageData['buttons'][BUTTON_VIEW3D] ? 'static/js/swfobject.js' : null - ), + 'reqJS' => ['static/js/swfobject.js'], 'redButtons' => array( BUTTON_LINKS => ['color' => 'ff71d5ff', 'linkId' => Util::$typeStrings[TYPE_SPELL].':'.$_id], BUTTON_VIEW3D => false, @@ -715,11 +713,10 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) case 28: // Summon case 90: // Kill Credit $_ = Lang::$game['npc'].' #'.$effMV; - $summon = new CreatureList(array(['ct.id', $effMV])); - if (!$summon->error) + if ($summon = $spell->getModelInfo($_id)) { - $_ = '('.$summon->getField('name', true).')'; - $pageData['buttons'][BUTTON_VIEW3D] = ['type' => TYPE_NPC, 'displayId' => $summon->getRandomModelId()]; + $_ = '('.$summon['displayName'].')'; + $pageData['page']['redButtons'][BUTTON_VIEW3D] = ['type' => TYPE_NPC, 'displayId' => $summon['displayId']]; } $foo['name'] .= Lang::$colon.$_; @@ -768,13 +765,13 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) case 106: // Summon Object (slot 3) case 107: // Summon Object (slot 4) $_ = Util::ucFirst(Lang::$game['gameObject']).' #'.$effMV; - $summon = new GameObjectList(array(['o.id', $effMV])); - if (!$summon->error) + if ($summon = $spell->getModelInfo($_id)) { - $_ = '('.$summon->getField('name', true).')'; - $pageData['buttons'][BUTTON_VIEW3D] = ['type' => TYPE_OBJECT, 'displayId' => $summon->getField('displayId')]; + $_ = '('.$summon['displayName'].')'; + $pageData['page']['redButtons'][BUTTON_VIEW3D] = ['type' => TYPE_OBJECT, 'displayId' => $summon['displayId']]; } + $foo['name'] .= Lang::$colon.$_; break; case 74: // Apply Glyph @@ -888,17 +885,17 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) break; case 36: // Shapeshift - if ($st = DB::Aowow()->selectRow('SELECT *, displayIdA as model1, displayIdH as model2 FROM ?_shapeshiftForms WHERE id = ?d', $effMV)) + if ($st = $spell->getModelInfo($_id)) { - $pageData['buttons'][BUTTON_VIEW3D] = array( + $pageData['page']['redButtons'][BUTTON_VIEW3D] = array( 'type' => TYPE_NPC, - 'displayId' => $st['model2'] ? $st['model'.rand(1, 2)]: $st['model1'] + 'displayId' => $st['displayId'][1] ? $st['displayId'][rand(0, 1)] : $st['displayId'][0] ); if ($st['creatureType'] > 0) $pageData['page']['infobox'][] = '[li]'.Lang::$game['type'].Lang::$colon.Lang::$game['ct'][$st['creatureType']].'[/li]'; - if ($_ = Util::localizedString($st, 'name')) + if ($_ = $st['displayName']) $bar = User::isInGroup(U_GROUP_STAFF) ? sprintf(Util::$dfnString, Lang::$spell['_value'].Lang::$colon.$effMV, $_) : $_; } break; @@ -1039,12 +1036,10 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) case 78: // Mounted case 56: // Transform { - $transform = new CreatureList(array(['ct.id', $effMV])); - if (!$transform->error) + if ($transform = $spell->getModelInfo($_id)) { - $pageData['view3D'] = $transform->getRandomModelId(); - $pageData['buttons'][BUTTON_VIEW3D] = ['type' => TYPE_NPC, 'displayId' => $transform->getRandomModelId()]; - $bar = ' ('.$transform->getField('name', true).')'; + $pageData['page']['redButtons'][BUTTON_VIEW3D] = ['type' => TYPE_NPC, 'displayId' => $transform['displayId']]; + $bar = ' ('.$transform['displayName'].')'; } else $bar = Lang::$colon.Lang::$game['npc'].' #'.$effMV;; diff --git a/pages/talent.php b/pages/talent.php index 1bb28a3d..41d7dfd9 100644 --- a/pages/talent.php +++ b/pages/talent.php @@ -20,7 +20,7 @@ $smarty->updatePageVars(array( ), 'reqJS' => array( 'static/js/TalentCalc.js', - $petCalc ? '?data=pet-talents.pets' : '?data=glyphs', + ($petCalc ? '?data=pet-talents.pets' : '?data=glyphs').'&locale='.User::$localeId.'&t='.$_SESSION['dataKey'], $petCalc ? 'static/js/petcalc.js' : 'static/js/talent.js', $petCalc ? 'static/js/swfobject.js' : null ) diff --git a/static/js/Profiler.js b/static/js/Profiler.js index d555f92c..54e89452 100644 --- a/static/js/Profiler.js +++ b/static/js/Profiler.js @@ -4614,7 +4614,8 @@ function ProfilerInventory(_parent) { style: 'outline: none' }; - swfobject.embedSWF(g_staticUrl + '/modelviewer/ZAMviewerfp11.swf', _swfModel.id, '100%', '100%', '10.0.0', g_staticUrl + '/modelviewer/expressInstall.swf', flashVars, params, attributes); + // swfobject.embedSWF(g_staticUrl + '/modelviewer/ZAMviewerfp11.swf', _swfModel.id, '100%', '100%', '10.0.0', g_staticUrl + '/modelviewer/expressInstall.swf', flashVars, params, attributes); + swfobject.embedSWF('http://static.wowhead.com/modelviewer/ZAMviewerfp11.swf', _swfModel.id, '100%', '100%', '10.0.0', 'http://static.wowhead.com/modelviewer/expressInstall.swf', flashVars, params, attributes); _mvInited = true; } @@ -7389,6 +7390,9 @@ function ProfilerCompletion(_parent) { return _timer[wut] = setTimeout(_self.filterData.bind(_self, wut, value), 750); } + if (!_divTotals) // sarjuuk: prevent error on matching available data against empty known data + return; + var _ = 0; if (wut === 0) { // Simulate category click diff --git a/static/js/TalentCalc.js b/static/js/TalentCalc.js index 33dd4b38..f42b6bd8 100644 --- a/static/js/TalentCalc.js +++ b/static/js/TalentCalc.js @@ -2243,7 +2243,7 @@ function TalentCalc() { c.div.style.display = ""; } else { - $WH.g_ajaxIshRequest("?data=talents&class=" + classId + "&" + _versionBuild); + $WH.g_ajaxIshRequest('?data=talents&class=' + classId + '&locale=' + g_locale.id + '&t=' + g_dataKey + '&' + _versionBuild); } } diff --git a/static/js/global.js b/static/js/global.js index 3a400d4a..2ec15859 100644 --- a/static/js/global.js +++ b/static/js/global.js @@ -16492,8 +16492,8 @@ var ModelViewer = new function() { flashVars.equipList = equipList.join(','); } - // swfobject.embedSWF(http://static.wowhead.com/modelviewer/ZAMviewerfp11.swf', 'modelviewer-generic', '600', '400', "11.0.0", http://static.wowhead.com/modelviewer/expressInstall.swf', flashVars, params, attributes); - swfobject.embedSWF(g_staticUrl + '/modelviewer/ZAMviewerfp11.swf', 'modelviewer-generic', '600', '400', "11.0.0", g_staticUrl + '/modelviewer/expressInstall.swf', flashVars, params, attributes); + swfobject.embedSWF('http://static.wowhead.com/modelviewer/ZAMviewerfp11.swf', 'modelviewer-generic', '600', '400', "11.0.0", 'http://static.wowhead.com/modelviewer/expressInstall.swf', flashVars, params, attributes); + // swfobject.embedSWF(g_staticUrl + '/modelviewer/ZAMviewerfp11.swf', 'modelviewer-generic', '600', '400', "11.0.0", g_staticUrl + '/modelviewer/expressInstall.swf', flashVars, params, attributes); _w.style.display = ''; } var diff --git a/template/head.tpl b/template/head.tpl index ea99b4b0..8e4f97cd 100644 --- a/template/head.tpl +++ b/template/head.tpl @@ -27,7 +27,7 @@ {foreach from=$reqJS item=file} - + {/foreach}