diff --git a/includes/class.creature.php b/includes/class.creature.php index 300c113e..680c0948 100644 --- a/includes/class.creature.php +++ b/includes/class.creature.php @@ -10,8 +10,8 @@ class CreatureList extends BaseType public $tooltips = []; - protected $setupQuery = 'SELECT *, ct.entry AS ARRAY_KEY, ct.entry AS id FROM creature_template ct LEFT JOIN locales_creature lc ON lc.entry = ct.entry LEFT JOIN creature_template_addon cta on cta.entry = ct.entry WHERE [filter] [cond]'; - protected $matchQuery = 'SELECT COUNT(*) FROM creature_template ct WHERE [filter] [cond]'; + protected $setupQuery = 'SELECT ct.*, ct.id AS ARRAY_KEY, ft.A, ft.H, ft.factionId FROM ?_creature ct LEFT JOIN ?_factiontemplate ft ON ft.id = ct.faction_A WHERE [filter] [cond]'; + protected $matchQuery = 'SELECT COUNT(*) FROM ?_creature ct WHERE [filter] [cond]'; public static function getName($id) { @@ -23,13 +23,9 @@ class CreatureList extends BaseType name_loc6, name_loc8 FROM - creature_template ct - LEFT JOIN - locales_creature lc - ON - lc.entry = ct.entry + ?_creature WHERE - ct.entry = ?d', + id = ?d', $id ); return Util::localizedString($n, 'name'); @@ -95,8 +91,81 @@ class CreatureList extends BaseType return !$data ? 0 : $data[array_rand($data)]; } - public function getListviewData() { } - public function addGlobalsToJScript(&$refs) { } + public function getListviewData($addInfoMask = 0x0) + { + /* looks like this data differs per occasion + * + * NPCINFO_TAMEABLE (0x1): include texture & react + * NPCINFO_MODEL (0x2): + */ + + $data = []; + + while ($this->iterate()) + { + if ($addInfoMask & NPCINFO_MODEL) + { + $texStr = strtolower($this->curTpl['textureString']); + + if (isset($data[$texStr])) + { + if ($data[$texStr]['minlevel'] > $this->curTpl['minlevel']) + $data[$texStr]['minlevel'] = $this->curTpl['minlevel']; + + if ($data[$texStr]['maxlevel'] < $this->curTpl['maxlevel']) + $data[$texStr]['maxlevel'] = $this->curTpl['maxlevel']; + + $data[$texStr]['count']++; + } + else + $data[$texStr] = array( + 'family' => $this->curTpl['family'], + 'minlevel' => $this->curTpl['minlevel'], + 'maxlevel' => $this->curTpl['maxlevel'], + 'modelId' => $this->curTpl['modelId'], + 'displayId' => $this->curTpl['displayId1'], + 'skin' => $texStr, + 'count' => 1 + ); + } + else + { + $data[$this->id] = array( + 'family' => $this->curTpl['family'], + 'minlevel' => $this->curTpl['minlevel'], + 'maxlevel' => $this->curTpl['maxlevel'], + 'id' => $this->id, + 'boss' => $this->curTpl['type_flags'] & 0x4, + 'rank' => $this->curTpl['rank'], + 'location' => json_encode($this->getSpawns(SPAWNINFO_ZONES), JSON_NUMERIC_CHECK), + 'name' => $this->getField('name', true), + 'tag' => $this->getField('subname', true), + 'type' => $this->curTpl['type'] + ); + + if ($addInfoMask & NPCINFO_TAMEABLE) + { + // only first skin of first model ... we're omitting potentially 11 skins here .. but the lv accepts only one .. w/e + $data[$this->id]['skin'] = $this->curTpl['textureString']; + + $data[$this->id]['react'] = '['.$this->curTpl['A'].', '.$this->curTpl['H'].']'; + } + } + } + + ksort($data); + return $data; + } + + public function addGlobalsToJScript(&$refs) + { + if (!isset($refs['gCreatures'])) + $refs['gCreatures'] = []; + + while ($this->iterate()) + $refs['gCreatures'][$this->id] = ['name' => $this->getField('name', true)]; + } + public function addRewardsToJScript(&$refs) { } } diff --git a/includes/class.spell.php b/includes/class.spell.php index cf2270c0..8cf37fa1 100644 --- a/includes/class.spell.php +++ b/includes/class.spell.php @@ -582,9 +582,9 @@ class SpellList extends BaseType case 'i': // MaxAffectedTargets case 'I': if ($lookup) - $base = $this->refSpells[$lookup]->getField('targets'); + $base = $this->refSpells[$lookup]->getField('maxAffectedTargets'); else - $base = $this->getField('targets'); + $base = $this->getField('maxAffectedTargets'); if (in_array($op, $signs) && is_numeric($oparg) && is_numeric($base)) eval("\$base = $base $op $oparg;"); @@ -1606,8 +1606,11 @@ class SpellList extends BaseType ); } - (new CharClassList(array(['id', $classes])))->addGlobalsToJScript($refs); - (new CharRaceList(array(['id', $races])))->addGlobalsToJScript($refs); + if ($classes) + (new CharClassList(array(['id', $classes])))->addGlobalsToJScript($refs); + + if ($races) + (new CharRaceList(array(['id', $races])))->addGlobalsToJScript($refs); } public function addRewardsToJScript(&$refs) { } diff --git a/includes/defines.php b/includes/defines.php index 0de2e6c0..69e595e5 100644 --- a/includes/defines.php +++ b/includes/defines.php @@ -80,7 +80,6 @@ define('U_GROUP_MODERATOR', (U_GROUP_ADMIN|U_GROUP_MOD|U_GROUP_B define('U_GROUP_COMMENTS_MODERATOR', (U_GROUP_MODERATOR|U_GROUP_LOCALIZER)); define('U_GROUP_PREMIUM_PERMISSIONS', (U_GROUP_PREMIUM|U_GROUP_STAFF|U_GROUP_VIP)); - // Locales define('LOCALE_EN', 0); define('LOCALE_FR', 2); @@ -88,12 +87,19 @@ define('LOCALE_DE', 3); define('LOCALE_ES', 6); define('LOCALE_RU', 8); -// Additional info in item-listviews +// conditional information in listviews define('ITEMINFO_JSON', 0x1); define('ITEMINFO_SUBITEMS', 0x2); define('ITEMINFO_VENDOR', 0x4); define('ITEMINFO_LOOT', 0x8); +define('NPCINFO_TAMEABLE', 0x1); +define('NPCINFO_MODEL', 0x2); + +define('SPAWNINFO_ZONES', 1); // not a mask, mutually exclusive +define('SPAWNINFO_SHORT', 2); +define('SPAWNINFO_FULL', 3); + /* * Game */ diff --git a/includes/utilities.php b/includes/utilities.php index 5b424a11..4247158b 100644 --- a/includes/utilities.php +++ b/includes/utilities.php @@ -87,7 +87,8 @@ abstract class BaseType foreach ($c as $foo) if (is_array($foo)) - $sql[] = $resolveCondition($foo, $supLink); + if ($x = $resolveCondition($foo, $supLink)) + $sql[] = $x; return '('.implode($subLink, $sql).')'; } @@ -99,6 +100,9 @@ abstract class BaseType $field = $resolveCondition($c[0], $supLink); else if ($c[0]) $field = '`'.implode('`.`', explode('.', Util::sqlEscape($c[0]))).'`'; + else + return null; + if (is_array($c[1])) { $val = implode(',', Util::sqlEscape($c[1])); @@ -128,10 +132,7 @@ abstract class BaseType if (isset($c[2]) && $c[2] != '!') $op = $c[2]; - if (isset($field) && isset($op) && isset($val)) - return '('.$field.' '.$op.' '.$val.')'; - else - return null; + return '('.$field.' '.$op.' '.$val.')'; } }; @@ -152,6 +153,7 @@ abstract class BaseType unset($conditions[$i]); } } + foreach ($conditions as $c) if ($x = $resolveCondition($c, $linking)) $sql[] = $x; @@ -308,7 +310,6 @@ trait listviewHelper } - trait spawnHelper { private static $spawnQuery = " SELECT a.guid AS ARRAY_KEY, map, position_x, position_y, spawnMask, phaseMask, spawntimesecs, eventEntry, pool_entry AS pool FROM ?# a LEFT JOIN ?# b ON a.guid = b.guid LEFT JOIN ?# c ON a.guid = c.guid WHERE id = ?d"; @@ -329,17 +330,21 @@ trait spawnHelper } } - public function getSpawns($short = false) + /* + todo (med): implement this alpha-map-check-virtual-map-transform-wahey! + note: map in tooltips is activated by either '#map' as anchor (will automatic open mapviewer, when clicking link) in the href or as parameterless rel-parameter e.g. rel="map" in the anchor + */ + public function getSpawns($spawnInfo) { - // short: true => only the most populated area and only coordinates + // SPAWNINFO_SHORT: true => only the most populated area and only coordinates $data = []; - $raw = $this->fetch(); - if (!$raw) - return []; + // $raw = $this->fetch(); + // if (!$raw) + // return []; /* - long: + SPAWNINFO_FULL: $data = array( areaId => array( floorNo => array ( @@ -354,8 +359,9 @@ trait spawnHelper ) ) - short: zoneId, [pos-sets] - $data = [6456, [[51,42.2],[51,43]]]; + SPAWNINFO_SHORT: [zoneId, [[x1, y1], [x2, y2], ..]] // only the most populated zone + + SPAWNINFO_ZONES: [zoneId1, zoneId2, ..] // only zones */ return $data; diff --git a/localization/locale_dede.php b/localization/locale_dede.php index baad70cc..160ffb45 100644 --- a/localization/locale_dede.php +++ b/localization/locale_dede.php @@ -114,6 +114,7 @@ $lang = array( 'mechAbbr' => "Ausw.", 'pet' => "Begleiter", 'pets' => "Begleiter", + 'petCalc' => "Begleiterrechner", 'requires' => "Benötigt %s", 'requires2' => "Benötigt", 'reqLevel' => "Benötigt Stufe %s", @@ -286,9 +287,8 @@ $lang = array( ) ), 'pet' => array( - 'cat' => array( - 'Wildheit', 'Hartnäckigkeit', 'Gerissenheit' - ) + 'exotic' => "Exotisch", + 'cat' => ["Wildheit", "Hartnäckigkeit", "Gerissenheit"] ), 'itemset' => array( '_desc' => "%s ist das %s. Es enthält %s Teile.", diff --git a/localization/locale_enus.php b/localization/locale_enus.php index 2aa51714..ad348a24 100644 --- a/localization/locale_enus.php +++ b/localization/locale_enus.php @@ -109,6 +109,7 @@ $lang = array( 'mechAbbr' => "Mech.", 'pet' => "Pet", 'pets' => "Hunter Pets", + 'petCalc' => "Hunter Pet Calculator", 'requires' => "Requires %s", 'requires2' => "Requires", 'reqLevel' => "Requires Level %s", @@ -282,9 +283,8 @@ $lang = array( ) ), 'pet' => array( - 'cat' => array( - 'Ferocity', 'Tenacity', 'Cunning' - ) + 'exotic' => "Exotic", + 'cat' => ["Ferocity", "Tenacity", "Cunning"] ), 'itemset' => array( '_desc' => "%s is the %s. It contains %s pieces.", diff --git a/localization/locale_eses.php b/localization/locale_eses.php index c280ce98..c08e0de8 100644 --- a/localization/locale_eses.php +++ b/localization/locale_eses.php @@ -106,6 +106,7 @@ $lang = array( 'mechAbbr' => "Mec.", 'pet' => "Mascota", 'pets' => "Mascotas de cazador", + 'petCalc' => "Calculadora de mascotas", 'requires' => "Requiere %s", 'requires2' => "Requiere", 'reqLevel' => "Necesitas ser de nivel %s", @@ -240,9 +241,8 @@ $lang = array( ) ), 'pet' => array( - 'cat' => array( - 'Ferocidad', 'Tenacidad', 'Astucia' - ) + 'exotic' => "Exótica", + "cat" => ["Ferocidad", "Tenacidad", "Astucia"] ), 'itemset' => array( '_desc' => "%s es el %s. Contiene %s piezas.", diff --git a/localization/locale_frfr.php b/localization/locale_frfr.php index e0795ddc..227f0764 100644 --- a/localization/locale_frfr.php +++ b/localization/locale_frfr.php @@ -106,6 +106,7 @@ $lang = array( 'mechAbbr' => "Mécan.", 'pet' => "Familier", 'pets' => "Familiers de chasseur", + 'petCalc' => "Calculateur de familiers", 'requires' => "%s requis", 'requires2' => "Requiert", 'reqLevel' => "Niveau %s requis", @@ -239,9 +240,8 @@ $lang = array( ) ), 'pet' => array( - 'cat' => array( - 'Férocité', 'Tenacité', 'Ruse' - ) + 'exotic' => "Exotique" + "cat" => ["Férocité", "Tenacité", "Ruse"] ), 'itemset' => array( '_desc' => "%s est le %s. Il contient %s pièces.", diff --git a/localization/locale_ruru.php b/localization/locale_ruru.php index d9e3324d..08451d27 100644 --- a/localization/locale_ruru.php +++ b/localization/locale_ruru.php @@ -106,6 +106,7 @@ $lang = array( 'mechAbbr' => "Механика", 'pet' => "Питомец", 'pets' => "Питомцы охотников", + 'petCalc' => "Расчёт умений питомцев", 'requires' => "Требует %s", 'requires2' => "Требуется:", 'reqLevel' => "Требуется уровень: %s", @@ -239,9 +240,8 @@ $lang = array( ) ), 'pet' => array( - 'cat' => array( - 'Свирепость', 'Упорство', 'Хитрость' - ) + 'exotic' => "Экзотический", + "cat" => ["Свирепость", "Упорство", "Хитрость"] ), 'itemset' => array( '_desc' => "%s — %s. Он состоит из %s предметов.", diff --git a/pages/achievements.php b/pages/achievements.php index 28b16efb..4bc6e4b6 100644 --- a/pages/achievements.php +++ b/pages/achievements.php @@ -75,13 +75,16 @@ if (!$smarty->loadCache($cacheKey, $pageData, $filter)) array_unshift($title, Util::ucFirst(Lang::$game['achievements'])); } + // listview content + $pageData = array( + 'data' => $acvList->getListviewData(), + 'params' => [] + ); + // fill g_items, g_titles, g_achievements $acvList->addGlobalsToJscript($pageData); $acvList->addRewardsToJScript($pageData); - // listview content - $pageData['data'] = $acvList->getListviewData(); - // if we are have different cats display field if ($acvList->hasDiffFields(['category'])) $pageData['params']['visibleCols'] = "$['category']"; diff --git a/pages/pet.php b/pages/pet.php new file mode 100644 index 00000000..06aa344e --- /dev/null +++ b/pages/pet.php @@ -0,0 +1,186 @@ +loadCache($cacheKeyPage, $pageData)) +{ + $pet = new PetList(array(['id', $id])); + if ($pet->error) + $smarty->notFound(Lang::$game['pet']); + + $pet->addGlobalsToJscript($pageData); + $pet->reset(); + + $infobox = []; + + // level range + $infobox[] = '[li]'.Lang::$game['level'].Lang::$colon.$pet->getField('minLevel').' - '.$pet->getField('maxLevel').'[/li]'; + + // exotic + if ($pet->getField('exotic')) + $infobox[] = '[li][url=?spell=53270]'.Lang::$pet['exotic'].'[/url][/li]'; + + $pageData = array( + 'title' => $pet->getField('name', true), + 'path' => '[0, 8, '.$pet->getField('type').']', + 'page' => array( + 'petCalc' => $petCalc[(int)($id / 10)] . $petCalc[(2 * ($id % 10) + ($pet->getField('exotic') ? 1 : 0))], + 'name' => $pet->getField('name', true), + 'id' => $id, + 'icon' => $pet->getField('iconString'), + 'expansion' => Util::$expansionString[$pet->getField('expansion')] + ), + 'infobox' => '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]', + ); + + // tameable & gallery + $condition = array( + ['ct.type', 1], // Beast + ['ct.type_flags', 0x1, '&'], // tameable + ['ct.family', $id], // displayed petType + [ + 'OR', // at least neutral to at least one faction + ['ft.A', 1, '<'], + ['ft.H', 1, '<'] + ] + ); + $tng = new CreatureList($condition); + + $pageData['tameable'] = array( + 'data' => $tng->getListviewData(NPCINFO_TAMEABLE), + 'params' => [ + 'name' => '$LANG.tab_tameable', + 'tabs' => '$tabsRelated', + 'hiddenCols' => "$['type']", + 'visibleCols' => "$['skin']", + 'note' => '$sprintf(LANG.lvnote_filterresults, \'?npcs=1&filter=fa=38\')', + 'id' => 'tameable' + ] + ); + + $pageData['gallery'] = array( + 'data' => $tng->getListviewData(NPCINFO_MODEL), + 'params' => [ + 'tabs' => '$tabsRelated' + ] + ); + + // diet + $list = []; + $mask = $pet->getField('foodMask'); + for ($i = 1; $i < 7; $i++) + if ($mask & (1 << ($i - 1))) + $list[] = $i; + + $food = new ItemList(array(['i.subClass', [5, 8]], ['i.FoodType', $list])); + $food->addGlobalsToJscript($pageData); + + $pageData['diet'] = array( + 'data' => $food->getListviewData(), + 'params' => [ + 'name' => '$LANG.diet', + 'tabs' => '$tabsRelated', + 'hiddenCols' => "$['source', 'slot', 'side']", + 'sort' => "$['level']", + 'id' => 'diet' + ] + ); + + // spells + $mask = 0x0; + foreach (Util::$skillLineMask[-1] as $idx => $pair) + { + if ($pair[0] == $id) + { + $mask = 1 << $idx; + break; + } + } + $conditions = [ + ['s.typeCat', -3], // Pet-Ability + [ + 'OR', + ['skillLine1', $pet->getField('skillLineId')], // match: first skillLine + [ + 'AND', // match: second skillLine (if not mask) + ['skillLine1', 0, '>'], + ['skillLine2OrMask', $pet->getField('skillLineId')] + ], + [ + 'AND', // match: skillLineMask (if mask) + ['skillLine1', -1], + ['skillLine2OrMask', $mask, '&'] + ] + ] + ]; + + + $spells = new SpellList($conditions); + $spells->addGlobalsToJscript($pageData); + + $pageData['abilities'] = array( + 'data' => $spells->getListviewData(), + 'params' => [ + 'name' => '$LANG.tab_abilities', + 'tabs' => '$tabsRelated', + 'visibleCols' => "$['schools', 'level']", + 'id' => 'abilities' + ] + ); + + // talents + $conditions = [['s.typeCat', -7]]; + switch($pet->getField('type')) + { + case 0: $conditions[] = ['s.cuFlags', SPELL_CU_PET_TALENT_TYPE0, '&']; break; + case 1: $conditions[] = ['s.cuFlags', SPELL_CU_PET_TALENT_TYPE1, '&']; break; + case 2: $conditions[] = ['s.cuFlags', SPELL_CU_PET_TALENT_TYPE2, '&']; break; + } + + $talents = new SpellList($conditions); + $talents->addGlobalsToJscript($pageData); + + $pageData['talents'] = array( + 'data' => $talents->getListviewData(), + 'params' => [ + 'tabs' => '$tabsRelated', + 'visibleCols' => "$['tier', 'level']", + 'name' => '$LANG.tab_talents', + 'id' => 'talents', + 'sort' => "$['tier', 'name']", + '_petTalents' => 1 + ] + ); + + $smarty->saveCache($cacheKeyPage, $pageData); +} + +$smarty->updatePageVars(array( + 'title' => $pageData['title']." - ".Util::ucfirst(Lang::$game['pet']), + 'path' => $pageData['path'], + 'tab' => 0, // for g_initHeader($tab) + 'type' => TYPE_PET, // 9:Pets + 'typeId' => $id, + 'reqJS' => array( + array('path' => 'template/js/swfobject.js') + ) +)); + + +$smarty->assign('community', CommunityContent::getAll(TYPE_PET, $id)); // comments, screenshots, videos +$smarty->assign('lang', array_merge(Lang::$main, Lang::$game)); +$smarty->assign('lvData', $pageData); +$smarty->assign('mysql', DB::Aowow()->getStatistics()); +$smarty->display('pet.tpl'); + +?> diff --git a/pages/spells.php b/pages/spells.php index 9580fe18..b94017a8 100644 --- a/pages/spells.php +++ b/pages/spells.php @@ -29,7 +29,7 @@ $validCats = array( -4 => true, // Racial Traits -5 => true, // Mounts -6 => true, // Companions - -7 => [409, 410, 411], // PetTalents => TalenTtabId + -7 => [409, 410, 411], // PetTalents => TalentTabId -8 => true, // NPC Abilities -9 => true, // GM Abilities -11 => [6, 8, 10], // Proficiencies [Weapon, Armor, Language] diff --git a/setup/aowow_creature_pet.rar b/setup/aowow_creature_pet.rar new file mode 100644 index 00000000..2c9b3ac2 Binary files /dev/null and b/setup/aowow_creature_pet.rar differ diff --git a/setup/tools/sql/_pet.php b/setup/tools/sql/_pet.php index efab7da8..2efc584d 100644 --- a/setup/tools/sql/_pet.php +++ b/setup/tools/sql/_pet.php @@ -3,23 +3,83 @@ if (!defined('AOWOW_REVISION')) die('illegal access'); - -$ids = DB::Aowow()->selectCol('SELECT id AS ARRAY_KEY, skillLine1 FROM dbc.creatureFamily WHERE petTalentType <> -1'); - -foreach ($ids as $family => $skillLine) +class PetSetup extends PetList { - $rows = DB::Aowow()->select('SELECT MAX(s.id) as Id, IF(t.id, 1, 0) AS isTalent FROM dbc.spell s JOIN dbc.skillLineAbility sla ON sla.spellId = s.id LEFT JOIN dbc.talent t ON t.rank1 = s.id WHERE (s.attributes0 & 0x40) = 0 AND sla.skillLineId = ?d GROUP BY s.nameEN', $skillLine); - $i = 1; - foreach ($rows as $row) - { - if ($row['isTalent']) - continue; + private static $classicMods = array( // [Armor, Damage, Health] (see related "Tamed Pet Passive (DND)" spells per family. All values are set to +5% in wotlk) + 1 => [ 5, 0, 0], // Wolf + 2 => [ 0, 10, -2], // Cat + 3 => [ 0, 7, 0], // Spider + 4 => [ 5, -9, 8], // Bear + 5 => [ 9, -10, 4], // Boar + 6 => [ 10, 0, -5], // Crocolisk + 7 => [ 5, 0, 0], // Carrion bird + 8 => [ 13, -5, -4], // Crab + 9 => [ 0, 2, 4], // Gorilla + 11 => [ 3, 10, -5], // Raptor + 12 => [ 0, 0, 5], // Tallstrider + 20 => [ 10, -6, 0], // Scorpid + 21 => [ 13, -10, 0], // Turtle + 24 => [ 0, 7, 0], // Bat + 25 => [ 5, 0, 0], // Hyena + 26 => [ 0, 7, 0], // Bord of Prey (Owl) + 27 => [ 0, 7, 0], // Wind serpent + 30 => [ 0, 0, 0], // Dragonhawk + 31 => [ 5, 10, -7], // Ravager + 32 => [ 5, -6, 0], // Warp stalker + 33 => [ 0, 0, 0], // Sporebat + 34 => [-10, 3, 10], // Nether ray + 35 => [ 0, 0, 0] // Serpent + ); - DB::Aowow()->query('UPDATE ?_pet SET spellId'.$i.' = ?d WHERE id = ?d', $row['Id'], $family); - $i++; + private static $addonInfo = array( // i could have sworn that was somewhere in dbc + 30 => [1, 0], + 31 => [1, 0], + 32 => [1, 0], + 33 => [1, 0], + 34 => [1, 0], + 37 => [2, 0], + 38 => [2, 1], + 39 => [2, 1], + 41 => [2, 1], + 42 => [2, 1], + 43 => [2, 1], + 44 => [2, 0], + 45 => [2, 1], + 46 => [2, 1] + ), + + function setupPetSpells() + { + $ids = DB::Aowow()->selectCol('SELECT id AS ARRAY_KEY, skillLine1 FROM dbc.creatureFamily WHERE petTalentType <> -1'); + + foreach ($ids as $family => $skillLine) + { + $rows = DB::Aowow()->select('SELECT MAX(s.id) as Id, IF(t.id, 1, 0) AS isTalent FROM dbc.spell s JOIN dbc.skillLineAbility sla ON sla.spellId = s.id LEFT JOIN dbc.talent t ON t.rank1 = s.id WHERE (s.attributes0 & 0x40) = 0 AND sla.skillLineId = ?d GROUP BY s.nameEN', $skillLine); + $i = 1; + foreach ($rows as $row) + { + if ($row['isTalent']) + continue; + + DB::Aowow()->query('UPDATE ?_pet SET spellId'.$i.' = ?d WHERE id = ?d', $row['Id'], $family); + $i++; + } + } + + echo 'done'; + } + + function setupClassicMods() + { + foreach (self::$classicMods as $pet => $mods) + DB::Aowow()->query('UPDATE ?_pet SET armor = ?d, damage = ?d, health = ?d WHERE id = ?d', $mods[0], $mods[1], $mods[2], $pet); + } + + function setupAddonInfo() + { + foreach (self::$addonInfo as $pet => $info) + DB::Aowow()->query('UPDATE ?_pet SET expansion = ?d, exotic = ?d WHERE id = ?d', $info[0], $info[1], $pet); } } -echo 'done'; - ?> diff --git a/template/bricks/globals/creatures.tpl b/template/bricks/globals/creatures.tpl new file mode 100644 index 00000000..e7317440 --- /dev/null +++ b/template/bricks/globals/creatures.tpl @@ -0,0 +1,8 @@ +var _ = g_npcs; +{strip} +{foreach from=$data key=id item=item} + _[{$id}]={ldelim} + name_{$user.language}:'{$item.name|escape:"javascript"}' + {rdelim}; +{/foreach} +{/strip} diff --git a/template/bricks/globals/currencies.tpl b/template/bricks/globals/currencies.tpl index e7f08632..711cc60f 100644 --- a/template/bricks/globals/currencies.tpl +++ b/template/bricks/globals/currencies.tpl @@ -6,4 +6,4 @@ var _ = g_gatheredcurrencies; icon:'{$item.icon|escape:"javascript"}' {rdelim}; {/foreach} -{/strip} \ No newline at end of file +{/strip} diff --git a/template/bricks/listviews/achievement.tpl b/template/bricks/listviews/achievement.tpl index e2914806..521943d1 100644 --- a/template/bricks/listviews/achievement.tpl +++ b/template/bricks/listviews/achievement.tpl @@ -29,4 +29,4 @@ {/foreach} ] {rdelim}); -{/strip} \ No newline at end of file +{/strip} diff --git a/template/bricks/listviews/calendar.tpl b/template/bricks/listviews/calendar.tpl index 01e3ea27..b6234459 100644 --- a/template/bricks/listviews/calendar.tpl +++ b/template/bricks/listviews/calendar.tpl @@ -27,4 +27,4 @@ {/foreach} ] {rdelim}); -{/strip} \ No newline at end of file +{/strip} diff --git a/template/bricks/listviews/class.tpl b/template/bricks/listviews/class.tpl index 6754d0c1..e9e0f35b 100644 --- a/template/bricks/listviews/class.tpl +++ b/template/bricks/listviews/class.tpl @@ -32,4 +32,4 @@ {/foreach} ] {rdelim}); -{/strip} \ No newline at end of file +{/strip} diff --git a/template/bricks/listviews/creature.tpl b/template/bricks/listviews/creature.tpl new file mode 100644 index 00000000..355ffb86 --- /dev/null +++ b/template/bricks/listviews/creature.tpl @@ -0,0 +1,65 @@ +{strip} + new Listview({ldelim} + template:'npc', + {if !isset($params.id)}id:'spells',{/if} + {if !isset($params.name)}name:LANG.tab_npcs,{/if} + {if !isset($params.parent)}parent:'listview-generic',{/if} + {foreach name=params from=$params key=k item=v} + {if $v[0] == '$'} + {$k}:{$v|substr:1}, + {else if $v} + {$k}:'{$v}', + {/if} + {/foreach} + data:[ + {foreach name=i from=$data item=curr} + {ldelim} + name:'{$curr.name|escape:"quotes"}', + {if $curr.tag} + tag:'{$curr.tag|escape:"quotes"}', + {/if} + minlevel:{$curr.minlevel}, + maxlevel:{$curr.maxlevel}, + type:{$curr.type}, + classification:{$curr.rank}, + {if $curr.boss} + boss: 1, + {/if} + react:{$curr.react}, + location:{$curr.location}, + {if $curr.skin} + skin: '{$curr.skin}', + {/if} + {if isset($curr.percent)} + percent:{$curr.percent}, + {/if} + {if isset($curr.cost)} + stock:{$curr.stock}, + {if isset($curr.stack)} + stack:{$curr.stack}, + {/if} + cost:[ + {if isset($curr.cost.money)}{$curr.cost.money}{/if} + {if isset($curr.cost.honor) or isset($curr.cost.arena) or isset($curr.cost.items)} + ,{if isset($curr.cost.honor)}{$curr.cost.honor}{/if} + {if isset($curr.cost.arena) or isset($curr.cost.items)} + ,{if isset($curr.cost.arena)}{$curr.cost.arena}{/if} + {if isset($curr.cost.items)} + ,[ + {foreach from=$curr.cost.items item=curitem name=c} + [{$curitem.item},{$curitem.count}] + {if $smarty.foreach.c.last}{else},{/if} + {/foreach} + ] + {/if} + {/if} + {/if} + ], + {/if} + id:{$curr.id} + {rdelim} + {if $smarty.foreach.i.last}{else},{/if} + {/foreach} + ]{rdelim} + ); +{/strip} diff --git a/template/bricks/listviews/currency.tpl b/template/bricks/listviews/currency.tpl index ecd9e306..15997a4b 100644 --- a/template/bricks/listviews/currency.tpl +++ b/template/bricks/listviews/currency.tpl @@ -17,10 +17,10 @@ id:{$curr.id}, category:{$curr.category}, name:'{$curr.name|escape:"javascript"}', - icon:'{$curr.icon}', + icon:'{$curr.icon}' {rdelim} {if $smarty.foreach.i.last}{else},{/if} {/foreach} ] {rdelim}); -{/strip} \ No newline at end of file +{/strip} diff --git a/template/bricks/listviews/model.tpl b/template/bricks/listviews/model.tpl new file mode 100644 index 00000000..95f3a9b8 --- /dev/null +++ b/template/bricks/listviews/model.tpl @@ -0,0 +1,29 @@ +{strip} + new Listview({ldelim} + template:'model', + {if !isset($params.id)}id:'gallery',{/if} + {if !isset($params.name)}name:LANG.tab_gallery,{/if} + {if !isset($params.parent)}parent:'listview-generic',{/if} + {foreach from=$params key=k item=v} + {if $v[0] == '$'} + {$k}:{$v|substr:1}, + {else if $v} + {$k}:'{$v}', + {/if} + {/foreach} + data:[ + {foreach name=i from=$data item=curr} + {ldelim} + family:{$curr.family}, + modelId:{$curr.modelId}, + displayId:{$curr.displayId}, + skin:'{$curr.skin|escape:"javascript"}', + count:{$curr.count}, + minLevel:{$curr.minlevel}, + maxLevel:{$curr.maxlevel} + {rdelim} + {if $smarty.foreach.i.last}{else},{/if} + {/foreach} + ] + {rdelim}); +{/strip} diff --git a/template/bricks/listviews/pet.tpl b/template/bricks/listviews/pet.tpl index 379a68b5..ff4b7c17 100644 --- a/template/bricks/listviews/pet.tpl +++ b/template/bricks/listviews/pet.tpl @@ -54,4 +54,4 @@ var _ = function(family) {/foreach} ] {rdelim}); -{/strip} \ No newline at end of file +{/strip} diff --git a/template/bricks/listviews/title.tpl b/template/bricks/listviews/title.tpl index 9d533884..87e26ef7 100644 --- a/template/bricks/listviews/title.tpl +++ b/template/bricks/listviews/title.tpl @@ -31,4 +31,4 @@ {/foreach} ] {rdelim}); -{/strip} \ No newline at end of file +{/strip} diff --git a/template/bricks/listviews/zone.tpl b/template/bricks/listviews/zone.tpl index c3afb960..7cbba785 100644 --- a/template/bricks/listviews/zone.tpl +++ b/template/bricks/listviews/zone.tpl @@ -33,4 +33,3 @@ ] {rdelim}); {/strip} - diff --git a/template/css/global.css b/template/css/global.css index 1821b4c1..88e0d85d 100644 --- a/template/css/global.css +++ b/template/css/global.css @@ -2058,7 +2058,8 @@ a.star-icon-right span .screenshot-cell img { - border: 3px solid #404040; + border: 2px solid #404040; + background-color: #080808; margin-bottom: 3px; } diff --git a/template/header.tpl b/template/header.tpl index 40abff9a..c26fbfe9 100644 --- a/template/header.tpl +++ b/template/header.tpl @@ -39,5 +39,6 @@ {if isset($lvData.gRaces)} { include file='bricks/globals/races.tpl' data=$lvData.gRaces }{/if} {if isset($lvData.gSpells)} { include file='bricks/globals/spells.tpl' data=$lvData.gSpells }{/if} {if isset($lvData.gTitles)} { include file='bricks/globals/titles.tpl' data=$lvData.gTitles }{/if} - {* TODO: Factions, Quests, NPCs, Objects, g_gatheredzones(?) *} + {if isset($lvData.gCreatures)} { include file='bricks/globals/creatures.tpl' data=$lvData.gCreatures }{/if} + {* TODO: Factions, Quests, Objects, g_gatheredzones(?) *} {/strip} diff --git a/template/js/TalentCalc.js b/template/js/TalentCalc.js index 133447c9..0a922f92 100644 --- a/template/js/TalentCalc.js +++ b/template/js/TalentCalc.js @@ -2736,13 +2736,13 @@ function TalentCalc() { allowfullscreen: true, menu: false, bgcolor: '#181818', - wmode: 'opaque' + wmode: 'direct' }; var attributes = {}; swfobject.embedSWF( - swfUrl + '/modelviewer/ModelView.swf', + swfUrl + '/modelviewer/ZAMviewerfp11.swf', _swfModel.id, '100%', '100%', diff --git a/template/js/global.js b/template/js/global.js index c842d91f..f3b4d5ac 100644 --- a/template/js/global.js +++ b/template/js/global.js @@ -2250,109 +2250,6 @@ function g_numberFormat(f, b, l, h) { } return o } -function g_getPatchVersionIndex(e) { - var d = g_getPatchVersion; - var b = 0, - c = d.T.length - 2, - a; - while (c > b) { - a = Math.floor((c + b) / 2); - if (e >= d.T[a] && e < d.T[a + 1]) { - return a - } - if (e >= d.T[a]) { - b = a + 1 - } else { - c = a - 1 - } - } - a = Math.ceil((c + b) / 2); - return a -} -function g_getPatchVersion(b) { - var a = g_getPatchVersionIndex(b); - return g_getPatchVersion.V[a] -} -g_getPatchVersion.V = [ - "1.12.0", - "1.12.1", - "1.12.2", - "2.0.1", - "2.0.3", - "2.0.4", - "2.0.5", - "2.0.6", - "2.0.7", - "2.0.8", - "2.0.10", - "2.0.12", - "2.1.0", - "2.1.1", - "2.1.2", - "2.1.3", - "2.2.0", - "2.2.2", - "2.2.3", - "2.3.0", - "2.3.2", - "2.3.3", - "2.4.0", - "2.4.1", - "2.4.2", - "2.4.3", - "3.0.2", - "3.0.3", - "3.0.8", - "3.0.9", - "3.1.0", - "3.1.1", - "3.1.2", - "3.1.3", - "3.2.0", - "3.2.2", - "3.3.0", - "???" -]; -g_getPatchVersion.T = [ - 1153540800000, - 1159243200000, - 1160712000000, - 1165294800000, - 1168318800000, - 1168578000000, - 1168750800000, - 1169528400000, - 1171342800000, - 1171602000000, - 1173157200000, - 1175572800000, - 1179806400000, - 1181016000000, - 1182225600000, - 1184040000000, - 1190692800000, - 1191297600000, - 1191902400000, - 1194930000000, - 1199768400000, - 1200978000000, - 1206417600000, - 1207022400000, - 1210651200000, - 1216094400000, - 1223956800000, - 1225774800000, - 1232427600000, - 1234242000000, - 1239681600000, - 1240286400000, - 1242705600000, - 1243915200000, - 1249358400000, - 1253595600000, - 1260266400000, - 9999999999999 -]; function g_expandSite() { ge("wrapper").className = "nosidebar"; var a = ge("topbar-expand"); @@ -2446,10 +2343,6 @@ g_getIdFromTypeName.L = { currency: 17, profile: 100 }; -function g_getIngameLink(color, id, name) { - // prompt(LANG.prompt_ingamelink, '/script DEFAULT_CHAT_FRAME:AddMessage("\\124c' + a + "\\124H" + c + "\\124h[" + b + ']\\124h\\124r");') - return '/script DEFAULT_CHAT_FRAME:AddMessage("\\124c' + color + '\\124H' + id + '\\124h[' + name + ']\\124h\\124r");'; -} function g_isEmailValid(a) { return a.match(/^([a-z0-9._-]+)(\+[a-z0-9._-]+)?(@[a-z0-9.-]+\.[a-z]{2,4})$/i) != null } @@ -8164,7 +8057,7 @@ Listview.templates = { ae(a, ct(faction.name)); if (faction.expansion) { var sp = ce('span'); - sp.className = g_GetExpansionClassName(faction.expansion); + sp.className = g_GetExpansionClassName(faction.expansion); ae(sp, a); ae(td, sp); } @@ -8173,7 +8066,7 @@ Listview.templates = { } }, getVisibleText: function(faction) { - var buff = faction.name + Listview.funcBox.getExpansionText(faction); + var buff = faction.name + Listview.funcBox.getExpansionText(faction); return buff; } @@ -8933,12 +8826,12 @@ Listview.templates = { } }, - itemset: { - sort: [1], - nItemsPerPage: 75, - searchable: 1, - filtrable: 1, - columns: [ + itemset: { + sort: [1], + nItemsPerPage: 75, + searchable: 1, + filtrable: 1, + columns: [ { id: 'name', name: LANG.name, @@ -9087,274 +8980,302 @@ Listview.templates = { } ], - getItemLink: function(itemSet) { - return '?itemset=' + itemSet.id; - } - }, + getItemLink: function(itemSet) { + return '?itemset=' + itemSet.id; + } + }, - npc: { - sort: [1], - nItemsPerPage: 100, - searchable: 1, - filtrable: 1, - columns: [{ - id: "name", - name: LANG.name, - type: "text", - align: "left", - value: "name", - compute: function(c, f) { - if (c.boss) { - f.className = "boss-icon-padded" - } - var b = ce("a"); - b.style.fontFamily = "Verdana, sans-serif"; - b.href = this.template.getItemLink(c); - ae(b, ct(c.name)); - ae(f, b); - if (c.tag != null) { - var e = ce("div"); - e.className = "small"; - ae(e, ct("<" + c.tag + ">")); - ae(f, e) - } - }, - getVisibleText: function(a) { - var b = a.name; - if (a.tag) { - b += " <" + a.tag + ">" - } - if (a.boss) { - b += " boss skull" - } - return b - }, - sortFunc: function(d, c, e) { - return strcmp(c.boss, d.boss) || strcmp(d.name, c.name) - } - }, - { - id: "level", - name: LANG.level, - type: "range", - width: "10%", - getMinValue: function(a) { - return a.minlevel - }, - getMaxValue: function(a) { - return a.maxlevel - }, - compute: function(a, c) { - if (a.classification) { - var b = ce("div"); - b.className = "small"; - ae(b, ct(g_npc_classifications[a.classification])); - ae(c, b) - } - if (a.classification == 3) { - return "??" - } - if (a.minlevel > 0 && a.maxlevel > 0) { - if (a.minlevel != a.maxlevel) { - return a.minlevel + LANG.hyphen + a.maxlevel - } else { - return a.minlevel - } - } - return -1 - }, - getVisibleText: function(a) { - var b = ""; - if (a.classification) { - b += " " + g_npc_classifications[a.classification] - } - if (a.minlevel > 0 && a.maxlevel > 0) { - b += " "; - if (a.minlevel != a.maxlevel) { - b += a.minlevel + LANG.hyphen + a.maxlevel - } else { - b += a.minlevel - } - } - return b - }, - sortFunc: function(d, c, e) { - if (e > 0) { - return strcmp(d.minlevel, c.minlevel) || strcmp(d.maxlevel, c.maxlevel) || strcmp(d.classification, c.classification) - } else { - return strcmp(d.maxlevel, c.maxlevel) || strcmp(d.minlevel, c.minlevel) || strcmp(d.classification, c.classification) - } - } - }, - { - id: "location", - name: LANG.location, - type: "text", - compute: function(a, b) { - return Listview.funcBox.location(a, b) - }, - getVisibleText: function(a) { - return Listview.funcBox.arrayText(a.location, g_zones) - }, - sortFunc: function(d, c, e) { - return Listview.funcBox.assocArrCmp(d.location, c.location, g_zones) - } - }, - { - id: "react", - name: LANG.react, - type: "text", - width: "10%", - value: "react", - filtrable: 0, - compute: function(b, g) { - if (b.react == null) { - return -1 - } - var d = [LANG.lvnpc_alliance, LANG.lvnpc_horde]; - var f = 0; - for (var a = 0; a < 2; ++a) { - if (b.react[a] != null) { - if (f++>0) { - ae(g, ct(" ")) - } - var e = ce("span"); - e.className = (b.react[a] < 0 ? "q10": (b.react[a] > 0 ? "q2": "q")); - ae(e, ct(d[a])); - ae(g, e) - } - } - } - }, - { - id: "skin", - name: LANG.skin, - type: "text", - value: "skin", - compute: function(c, d) { - if (c.skin) { - var b = ce("a"); - b.className = "q1"; - b.href = "?npcs&filter=cr=35;crs=0;crv=" + c.skin; - ae(b, ct(c.skin)); - ae(d, b) - } - }, - hidden: 1 - }, - { - id: "petfamily", - name: LANG.petfamily, - type: "text", - width: "12%", - compute: function(c, d) { - d.className = "q1"; - var b = ce("a"); - b.href = "?pet=" + c.family; - ae(b, ct(g_pet_families[c.family])); - ae(d, b) - }, - getVisibleText: function(a) { - return g_pet_families[a.family] - }, - sortFunc: function(d, c, e) { - return strcmp(g_pet_families[d.family], g_pet_families[c.family]) - }, - hidden: 1 - }, - { - id: "type", - name: LANG.type, - type: "text", - width: "12%", - compute: function(c, d) { - d.className = "small q1"; - var b = ce("a"); - b.href = "?npcs=" + c.type; - ae(b, ct(g_npc_types[c.type])); - ae(d, b) - }, - getVisibleText: function(a) { - return g_npc_types[a.type] - }, - sortFunc: function(d, c, e) { - return strcmp(g_npc_types[d.type], g_npc_types[c.type]) - } - }], - getItemLink: function(a) { - return "?npc=" + a.id - } - }, - object: { - sort: [1], - nItemsPerPage: 100, - searchable: 1, - filtrable: 1, - columns: [{ - id: "name", - name: LANG.name, - type: "text", - align: "left", - value: "name", - compute: function(c, d) { - var b = ce("a"); - b.style.fontFamily = "Verdana, sans-serif"; - b.href = this.template.getItemLink(c); - ae(b, ct(c.name)); - ae(d, b) - } - }, - { - id: "location", - name: LANG.location, - type: "text", - compute: function(a, b) { - return Listview.funcBox.location(a, b) - }, - getVisibleText: function(a) { - return Listview.funcBox.arrayText(a.location, g_zones) - }, - sortFunc: function(d, c, e) { - return Listview.funcBox.assocArrCmp(d.location, c.location, g_zones) - } - }, - { - id: "skill", - name: LANG.skill, - width: "10%", - value: "skill", - hidden: true - }, - { - id: "type", - name: LANG.type, - type: "text", - width: "12%", - compute: function(c, d) { - d.className = "small q1"; - var b = ce("a"); - b.href = "?objects=" + c.type; - ae(b, ct(g_object_types[c.type])); - ae(d, b) - }, - getVisibleText: function(a) { - return g_object_types[a.type] - }, - sortFunc: function(d, c, e) { - return strcmp(g_object_types[d.type], g_object_types[c.type]) - } - }], - getItemLink: function(a) { - return "?object=" + a.id - } - }, + npc: { + sort: [1], + nItemsPerPage: 100, + searchable: 1, + filtrable: 1, - quest: { - sort: [1,2], - nItemsPerPage: 100, - searchable: 1, - filtrable: 1, - columns: [ + columns: [ + { + id: 'name', + name: LANG.name, + type: 'text', + align: 'left', + value: 'name', + compute: function(npc, td) { + if (npc.boss) { + td.className = 'boss-icon-padded'; + } + + var a = ce('a'); + a.style.fontFamily = 'Verdana, sans-serif'; + a.href = this.template.getItemLink(npc); + ae(a, ct(npc.name)); + ae(td, a); + + if (npc.tag != null) { + var d = ce('div'); + d.className = 'small'; + ae(d, ct('<' + npc.tag + '>')); + ae(td, d); + } + }, + getVisibleText: function(npc) { + var buff = npc.name; + if (npc.tag) { + buff += ' <' + npc.tag + '>'; + } + if (npc.boss) { + buff += ' boss skull'; + } + return buff; + }, + sortFunc: function(a, b, col) { + return strcmp(b.boss, a.boss) || strcmp(a.name, b.name); + } + }, + { + id: 'level', + name: LANG.level, + type: 'range', + width: '10%', + getMinValue: function(npc) { + return npc.minlevel; + }, + getMaxValue: function(npc) { + return npc.maxlevel; + }, + compute: function(npc, td) { + if (npc.classification) { + var d = ce('div'); + d.className = 'small'; + ae(d, ct(g_npc_classifications[npc.classification])); + ae(td, d); + } + + if (npc.classification == 3 || npc.maxlevel == 9999) { + return '??'; + } + + if (npc.minlevel > 0 && npc.maxlevel > 0) { + if (npc.minlevel != npc.maxlevel) { + return npc.minlevel + LANG.hyphen + npc.maxlevel; + } + else { + return npc.minlevel; + } + } + + return -1; + }, + getVisibleText: function(npc) { + var buff = ''; + + if (npc.classification) { + buff += ' ' + g_npc_classifications[npc.classification]; + } + + if (npc.minlevel > 0 && npc.maxlevel > 0) { + buff += ' '; + if(npc.maxlevel == 9999) { + buff += '??'; + } + else if (npc.minlevel != npc.maxlevel) { + buff += npc.minlevel + LANG.hyphen + npc.maxlevel; + } + else { + buff += npc.minlevel; + } + } + + return buff; + }, + sortFunc: function(a, b, col) { + if (col > 0) { + return strcmp(a.minlevel, b.minlevel) || strcmp(a.maxlevel, b.maxlevel) || strcmp(a.classification, b.classification); + } + else { + return strcmp(a.maxlevel, b.maxlevel) || strcmp(a.minlevel, b.minlevel) || strcmp(a.classification, b.classification); + } + } + }, + { + id: 'location', + name: LANG.location, + type: 'text', + compute: function(npc, td) { + return Listview.funcBox.location(npc, td); + }, + getVisibleText: function(npc) { + return Listview.funcBox.arrayText(npc.location, g_zones); + }, + sortFunc: function(a, b, col) { + return Listview.funcBox.assocArrCmp(a.location, b.location, g_zones); + } + }, + { + id: 'react', + name: LANG.react, + type: 'text', + width: '10%', + value: 'react', + filtrable: 0, + compute: function(npc, td) { + if (npc.react == null) { + return -1; + } + + var sides = [LANG.lvnpc_alliance, LANG.lvnpc_horde]; + var c = 0; + for (var k = 0; k < 2; ++k) { + if (npc.react[k] != null) { + if (c++ > 0) { + ae(td, ct(' ')); + } + var sp = ce('span'); + + sp.className = (npc.react[k] < 0 ? 'q10': (npc.react[k] > 0 ? 'q2': 'q')); + + ae(sp, ct(sides[k])); + ae(td, sp); + } + } + } + }, + { + id: 'skin', + name: LANG.skin, + type: 'text', + value: 'skin', + compute: function(npc, td) { + if (npc.skin) { + var a = ce('a'); + a.className = 'q1'; + a.href = '?npcs&filter=cr=35;crs=0;crv=' + npc.skin; + ae(a, ct(npc.skin)); + ae(td, a); + } + }, + hidden: 1 + }, + { + id: 'petfamily', + name: LANG.petfamily, + type: 'text', + width: '12%', + compute: function(npc, td) { + td.className = 'q1'; + + var a = ce('a'); + a.href = '?pet=' + npc.family; + ae(a, ct(g_pet_families[npc.family])); + ae(td, a); + }, + getVisibleText: function(npc) { + return g_pet_families[npc.family]; + }, + sortFunc: function(a, b, col) { + return strcmp(g_pet_families[a.family], g_pet_families[b.family]); + }, + hidden: 1 + }, + { + id: 'type', + name: LANG.type, + type: 'text', + width: '12%', + compute: function(npc, td) { + td.className = 'small q1'; + + var a = ce('a'); + a.href = '?npcs=' + npc.type; + ae(a, ct(g_npc_types[npc.type])); + ae(td, a); + }, + getVisibleText: function(npc) { + return g_npc_types[npc.type]; + }, + sortFunc: function(a, b, col) { + return strcmp(g_npc_types[a.type], g_npc_types[b.type]); + } + } + ], + + getItemLink: function(npc) { + return '?npc=' + npc.id; + } + }, + + object: { + sort: [1], + nItemsPerPage: 100, + searchable: 1, + filtrable: 1, + + columns: [ + { + id: 'name', + name: LANG.name, + type: 'text', + align: 'left', + value: 'name', + compute: function(object, td) { + var a = ce('a'); + a.style.fontFamily = 'Verdana, sans-serif'; + a.href = this.template.getItemLink(object); + ae(a, ct(object.name)); + ae(td, a); + } + }, + { + id: 'location', + name: LANG.location, + type: 'text', + compute: function(object, td) { + return Listview.funcBox.location(object, td); + }, + getVisibleText: function(object) { + return Listview.funcBox.arrayText(object.location, g_zones); + }, + sortFunc: function(a, b, col) { + return Listview.funcBox.assocArrCmp(a.location, b.location, g_zones); + } + }, + { + id: 'skill', + name: LANG.skill, + width: '10%', + value: 'skill', + hidden: true + }, + { + id: 'type', + name: LANG.type, + type: 'text', + width: '12%', + compute: function(object, td) { + td.className = 'small q1'; + var a = ce('a'); + a.href = '?objects=' + object.type; + ae(a, ct(g_object_types[object.type])); + ae(td, a); + }, + getVisibleText: function(object) { + return g_object_types[object.type]; + }, + sortFunc: function(a, b, col) { + return strcmp(g_object_types[a.type], g_object_types[b.type]); + } + } + ], + + getItemLink: function(object) { + return '?object=' + object.id; + } + }, + + quest: { + sort: [1,2], + nItemsPerPage: 100, + searchable: 1, + filtrable: 1, + columns: [ { id: 'name', name: LANG.name, @@ -9677,75 +9598,75 @@ Listview.templates = { } ], - getItemLink: function(quest) { - return '?quest=' + quest.id; - } - }, + getItemLink: function(quest) { + return '?quest=' + quest.id; + } + }, - skill: { - sort: [1], - searchable: 1, - filtrable: 1, - columns: [{ - id: "name", - name: LANG.name, - type: "text", - align: "left", - value: "name", - span: 2, - compute: function(c, h, f) { - var d = ce("td"); - d.style.width = "1px"; - d.style.padding = "0"; - d.style.borderRight = "none"; - ae(d, Icon.create(c.icon, 0, null, this.getItemLink(c))); - ae(f, d); - h.style.borderLeft = "none"; - var g = ce("div"); - var b = ce("a"); - b.style.fontFamily = "Verdana, sans-serif"; - b.href = this.getItemLink(c); - ae(b, ct(c.name)); - if (c.expansion) { - var e = ce("span"); - e.className = g_GetExpansionClassName(c.expansion); - ae(e, b); - ae(g, e) - } else { - ae(g, b) - } - ae(h, g) - }, - getVisibleText: function(a) { - var b = a.name + Listview.funcBox.getExpansionText(a); - return b - } - }, - { - id: "category", - name: LANG.category, - type: "text", - width: "16%", - compute: function(c, d) { - if (c.category != 0) { - d.className = "small q1"; - var b = ce("a"); - b.href = "?skills=" + c.category; - ae(b, ct(g_skill_categories[c.category])); - ae(d, b) - } - }, - getVisibleText: function(a) { - return g_skill_categories[skill.category] - }, - sortFunc: function(d, c, e) { - return strcmp(g_skill_categories[d.category], g_skill_categories[c.category]) - } - }], - getItemLink: function(a) { - return "?skill=" + a.id - } - }, + skill: { + sort: [1], + searchable: 1, + filtrable: 1, + columns: [{ + id: "name", + name: LANG.name, + type: "text", + align: "left", + value: "name", + span: 2, + compute: function(c, h, f) { + var d = ce("td"); + d.style.width = "1px"; + d.style.padding = "0"; + d.style.borderRight = "none"; + ae(d, Icon.create(c.icon, 0, null, this.getItemLink(c))); + ae(f, d); + h.style.borderLeft = "none"; + var g = ce("div"); + var b = ce("a"); + b.style.fontFamily = "Verdana, sans-serif"; + b.href = this.getItemLink(c); + ae(b, ct(c.name)); + if (c.expansion) { + var e = ce("span"); + e.className = g_GetExpansionClassName(c.expansion); + ae(e, b); + ae(g, e) + } else { + ae(g, b) + } + ae(h, g) + }, + getVisibleText: function(a) { + var b = a.name + Listview.funcBox.getExpansionText(a); + return b + } + }, + { + id: "category", + name: LANG.category, + type: "text", + width: "16%", + compute: function(c, d) { + if (c.category != 0) { + d.className = "small q1"; + var b = ce("a"); + b.href = "?skills=" + c.category; + ae(b, ct(g_skill_categories[c.category])); + ae(d, b) + } + }, + getVisibleText: function(a) { + return g_skill_categories[skill.category] + }, + sortFunc: function(d, c, e) { + return strcmp(g_skill_categories[d.category], g_skill_categories[c.category]) + } + }], + getItemLink: function(a) { + return "?skill=" + a.id + } + }, spell: { sort: ['name', 'skill', 'level'], @@ -10112,6 +10033,19 @@ Listview.templates = { } } }, + { + id: 'tp', // essentially unused, but if someone wants to backport classic + name: LANG.tp, + tooltip: LANG.tooltip_trainingpoints, + width: '7%', + hidden: true, + value: 'tp', + compute: function (spell, col) { + if (spell.tp > 0) { + return spell.tp; + } + } + }, { id: 'source', name: LANG.source, @@ -10311,13 +10245,13 @@ Listview.templates = { } }, - zone: { - sort: [1], - nItemsPerPage: -1, - searchable: 1, - filtrable: 1, + zone: { + sort: [1], + nItemsPerPage: -1, + searchable: 1, + filtrable: 1, - columns: [ + columns: [ { id: 'name', name: LANG.name, @@ -10525,18 +10459,18 @@ Listview.templates = { } ], - getItemLink: function(zone) { - return '?zone=' + zone.id; - } - }, + getItemLink: function(zone) { + return '?zone=' + zone.id; + } + }, - holiday: { - sort: [2, 1], - nItemsPerPage: -1, - searchable: 1, - filtrable: 1, + holiday: { + sort: [2, 1], + nItemsPerPage: -1, + searchable: 1, + filtrable: 1, - columns: [ + columns: [ { id: 'name', name: LANG.name, @@ -10625,14 +10559,14 @@ Listview.templates = { return datesA[0] - datesB[0]; } } - else if (a.startDate) { - return -1; - } - else if (b.startDate) { - return 1; - } + else if (a.startDate) { + return -1; + } + else if (b.startDate) { + return 1; + } - return 0; + return 0; } }, { @@ -10660,53 +10594,53 @@ Listview.templates = { ], getItemLink: function(holiday) { - return '?event=' + holiday.id; - } - }, + return '?event=' + holiday.id; + } + }, - holidaycal: { - sort: [1], - mode: 4, // Calendar - startOnMonth: new Date(g_serverTime.getFullYear(), 0, 1), - nMonthsToDisplay: 12, - rowOffset: g_serverTime.getMonth(), - poundable: 2, // Yes but w/o sort + holidaycal: { + sort: [1], + mode: 4, // Calendar + startOnMonth: new Date(g_serverTime.getFullYear(), 0, 1), + nMonthsToDisplay: 12, + rowOffset: g_serverTime.getMonth(), + poundable: 2, // Yes but w/o sort - columns: [], + columns: [], - compute: function(holiday, div, i) { - if (!holiday.events || !holiday.events.length) { - return; - } + compute: function(holiday, div, i) { + if (!holiday.events || !holiday.events.length) { + return; + } - for (var i = 0; i < holiday.events.length; ++i) { - var icon = g_holidays.createIcon(holiday.events[i].id, 1); - icon.onmouseover = Listview.funcBox.dateEventOver.bind(icon, holiday.date, holiday.events[i]); - icon.onmousemove = Tooltip.cursorUpdate; - icon.onmouseout = Tooltip.hide; - icon.style.cssFloat = icon.style.styleFloat = 'left'; - ae(div, icon); - } - }, - sortFunc: function(a, b) { - if (a.startDate && b.startDate) { - var datesA = Listview.funcBox.getEventNextDates(a.startDate, a.endDate, a.rec || 0); - var datesB = Listview.funcBox.getEventNextDates(b.startDate, b.endDate, b.rec || 0); + for (var i = 0; i < holiday.events.length; ++i) { + var icon = g_holidays.createIcon(holiday.events[i].id, 1); + icon.onmouseover = Listview.funcBox.dateEventOver.bind(icon, holiday.date, holiday.events[i]); + icon.onmousemove = Tooltip.cursorUpdate; + icon.onmouseout = Tooltip.hide; + icon.style.cssFloat = icon.style.styleFloat = 'left'; + ae(div, icon); + } + }, + sortFunc: function(a, b) { + if (a.startDate && b.startDate) { + var datesA = Listview.funcBox.getEventNextDates(a.startDate, a.endDate, a.rec || 0); + var datesB = Listview.funcBox.getEventNextDates(b.startDate, b.endDate, b.rec || 0); - for (var i = 0; i < 2; ++i) { - var + for (var i = 0; i < 2; ++i) { + var dA = datesA[i], dB = datesB[i]; - if (dA.getFullYear() == dB.getFullYear() && dA.getMonth() == dB.getMonth() && dA.getDate() == dB.getDate()) { - return dA - dB; - } - } - } + if (dA.getFullYear() == dB.getFullYear() && dA.getMonth() == dB.getMonth() && dA.getDate() == dB.getDate()) { + return dA - dB; + } + } + } - return strcmp(a.name, b.name); - } - }, + return strcmp(a.name, b.name); + } + }, comment: { sort: [1], @@ -11645,197 +11579,247 @@ Listview.templates = { } } }, - pet: { - sort: [1], - nItemsPerPage: -1, - searchable: 1, - filtrable: 1, - columns: [{ - id: "name", - name: LANG.name, - type: "text", - align: "left", - value: "name", - span: 2, - compute: function(b, k, g) { - var e = ce("td"); - e.style.width = "1px"; - e.style.padding = "0"; - e.style.borderRight = "none"; - ae(e, Icon.create(b.icon, 0)); - ae(g, e); - k.style.borderLeft = "none"; - var j = ce("div"); - var c = ce("a"); - c.style.fontFamily = "Verdana, sans-serif"; - c.href = this.template.getItemLink(b); - ae(c, ct(b.name)); - if (b.expansion) { - var f = ce("span"); - f.className = (b.expansion == 1 ? "bc-icon": "wotlk-icon"); - ae(f, c); - ae(j, f) - } else { - ae(j, c) - } - if (b.exotic) { - j.style.position = "relative"; - var h = ce("div"); - h.className = "small q1"; - h.style.fontStyle = "italic"; - h.style.position = "absolute"; - h.style.right = "3px"; - h.style.bottom = "0px"; - var c = ce("a"); - c.href = "?spell=53270"; - ae(c, ct(LANG.lvpet_exotic)); - ae(h, c); - ae(j, h) - } - ae(k, j) - }, - getVisibleText: function(a) { - var b = a.name + Listview.funcBox.getExpansionText(a); - if (a.exotic) { - b += " " + LANG.lvpet_exotic - } - return b - } - }, - { - id: "level", - name: LANG.level, - type: "range", - getMinValue: function(a) { - return a.minlevel - }, - getMaxValue: function(a) { - return a.maxlevel - }, - compute: function(a, b) { - if (a.minlevel > 0 && a.maxlevel > 0) { - if (a.minlevel != a.maxlevel) { - return a.minlevel + LANG.hyphen + a.maxlevel - } else { - return a.minlevel - } - } else { - return - 1 - } - }, - sortFunc: function(d, c, e) { - if (e > 0) { - return strcmp(d.minlevel, c.minlevel) || strcmp(d.maxlevel, c.maxlevel) - } else { - return strcmp(d.maxlevel, c.maxlevel) || strcmp(d.minlevel, c.minlevel) - } - } - }, - { - id: "abilities", - name: LANG.abilities, - type: "text", - getValue: function(b) { - if (!b.spells) { - return "" - } - if (b.spells.length > 0) { - var d = ""; - for (var c = 0, a = b.spells.length; c < a; ++c) { - if (b.spells[c]) { - d += g_spells[b.spells[c]]["name_" + Locale.getName()] - } - } - return d - } - }, - compute: function(a, b) { - if (!a.spells) { - return "" - } - if (a.spells.length > 0) { - b.style.padding = "0"; - Listview.funcBox.createCenteredIcons(a.spells, b, "", 1) - } - }, - sortFunc: function(d, c) { - if (!d.spells || !c.spells) { - return 0 - } - return strcmp(d.spellCount, c.spellCount) || strcmp(d.spells, c.spells) - }, - hidden: true - }, - { - id: "diet", - name: LANG.diet, - type: "text", - compute: function(a, e) { - if (e) { - e.className = "small" - } - var b = 0, - c = ""; - for (var d in g_pet_foods) { - if (a.diet & d) { - if (b++>0) { - c += LANG.comma - } - c += g_pet_foods[d] - } - } - return c - }, - sortFunc: function(d, c) { - return strcmp(c.foodCount, d.foodCount) || Listview.funcBox.assocArrCmp(d.diet, c.diet, g_pet_foods) - } - }, - { - id: "type", - name: LANG.type, - type: "text", - compute: function(b, d) { - if (b.type != null) { - d.className = "small q1"; - var c = ce("a"); - c.href = "?pets=" + b.type; - ae(c, ct(g_pet_types[b.type])); - ae(d, c) - } - }, - getVisibleText: function(a) { - if (a.type != null) { - return g_pet_types[a.type] - } - }, - sortFunc: function(d, c, e) { - return strcmp(g_pet_types[d.type], g_pet_types[c.type]) - } - }], - getItemLink: function(a) { - return "?pet=" + a.id - }, - getStatPct: function(b) { - var a = ce("span"); - if (!isNaN(b) && b > 0) { - a.className = "q2"; - ae(a, ct("+" + b + "%")) - } else { - if (!isNaN(b) && b < 0) { - a.className = "q10"; - ae(a, ct(b + "%")) - } - } - return a - } - }, - achievement: { - sort: [1, 2], - nItemsPerPage: 100, - searchable: 1, - filtrable: 1, - columns: [ + pet: { + sort: [1], + nItemsPerPage: -1, + searchable: 1, + filtrable: 1, + + columns: [ + { + id: 'name', + name: LANG.name, + type: 'text', + align: 'left', + value: 'name', + span: 2, + compute: function(pet, td, tr) { + var i = ce('td'); + i.style.width = '1px'; + i.style.padding = '0'; + i.style.borderRight = 'none'; + + ae(i, Icon.create(pet.icon, 0)); + ae(tr, i); + td.style.borderLeft = 'none'; + + var wrapper = ce('div'); + + var a = ce('a'); + a.style.fontFamily = 'Verdana, sans-serif'; + a.href = this.template.getItemLink(pet); + ae(a, ct(pet.name)); + + if (pet.expansion) { + var sp = ce('span'); + sp.className = g_GetExpansionClassName(pet.expansion); + ae(sp, a); + ae(wrapper, sp); + } + else { + ae(wrapper, a); + } + + if (pet.exotic) { + wrapper.style.position = 'relative'; + var d = ce('div'); + d.className = 'small q1'; + d.style.fontStyle = 'italic'; + d.style.position = 'absolute'; + d.style.right = '3px'; + d.style.bottom = '0px'; + var a = ce('a'); + a.href = '?spell=53270'; + ae(a, ct(LANG.lvpet_exotic)); + ae(d, a); + ae(wrapper, d); + } + ae(td, wrapper); + }, + getVisibleText: function(pet) { + var buff = pet.name + Listview.funcBox.getExpansionText(pet); + + if (pet.exotic) { + buff += ' ' + LANG.lvpet_exotic; + } + + return buff; + } + }, + { + id: 'level', + name: LANG.level, + type: 'range', + getMinValue: function(pet) { + return pet.minlevel; + }, + getMaxValue: function(pet) { + return pet.maxlevel; + }, + compute: function(pet, td) { + if (pet.minlevel > 0 && pet.maxlevel > 0) { + if (pet.minlevel != pet.maxlevel) { + return pet.minlevel + LANG.hyphen + pet.maxlevel; + } + else { + return pet.minlevel; + } + } + else { + return -1; + } + }, + sortFunc: function(a, b, col) { + if (col > 0) { + return strcmp(a.minlevel, b.minlevel) || strcmp(a.maxlevel, b.maxlevel); + } + else { + return strcmp(a.maxlevel, b.maxlevel) || strcmp(a.minlevel, b.minlevel); + } + } + }, + { + id: 'damage', // essentially unused, but if someone wants to backport classic + name: LANG.damage, + value: 'damage', + hidden: 1, + compute: function (pet, col) { + ae(col, this.template.getStatPct(pet.damage)) + } + }, + { + id: 'armor', // essentially unused, but if someone wants to backport classic + name: LANG.armor, + value: 'armor', + hidden: 1, + compute: function (pet, col) { + ae(col, this.template.getStatPct(pet.armor)) + } + }, + { + id: 'health', // essentially unused, but if someone wants to backport classic + name: LANG.health, + value: 'health', + hidden: 1, + compute: function (pet, col) { + ae(col, this.template.getStatPct(pet.health)) + } + }, + { + id: 'abilities', + name: LANG.abilities, + type: 'text', + getValue: function(pet) { + if (!pet.spells) { + return ''; + } + + if (pet.spells.length > 0) { + var spells = ''; + for (var i = 0, len = pet.spells.length; i < len; ++i) { + if (pet.spells[i]) { + spells += g_spells[pet.spells[i]]['name_' + g_locale.name]; + } + } + return spells; + } + }, + compute: function(pet, td) { + if (!pet.spells) { + return ''; + } + + if (pet.spells.length > 0) { + td.style.padding = '0'; + Listview.funcBox.createCenteredIcons(pet.spells, td, '', 1); + } + }, + sortFunc: function(a, b) { + if (!a.spells || !b.spells) { + return 0; + } + + return strcmp(a.spellCount, b.spellCount) || strcmp(a.spells, b.spells); + }, + hidden: true + }, + { + id: 'diet', + name: LANG.diet, + type: 'text', + compute: function(pet, td) { + if (td) { + td.className = 'small'; + } + + var + i = 0, + foods = ''; + + for (var food in g_pet_foods) { + if (pet.diet & food) { + if (i++ > 0) { + foods += LANG.comma; + } + foods += g_pet_foods[food]; + } + } + return foods; + }, + sortFunc: function(a, b) { + return strcmp(b.foodCount, a.foodCount) || Listview.funcBox.assocArrCmp(a.diet, b.diet, g_pet_foods); + } + }, + { + id: 'type', + name: LANG.type, + type: 'text', + compute: function(pet, td) { + if (pet.type != null) { + td.className = 'small q1'; + var a = ce('a'); + a.href = '?pets=' + pet.type; + ae(a, ct(g_pet_types[pet.type])); + ae(td, a); + } + }, + getVisibleText: function(pet) { + if (pet.type != null) { + return g_pet_types[pet.type]; + } + }, + sortFunc: function(a, b, col) { + return strcmp(g_pet_types[a.type], g_pet_types[b.type]); + } + } + ], + + getItemLink: function(pet) { + return '?pet=' + pet.id; + }, + + getStatPct: function(modifier) { + var _ = ce('span'); + if (!isNaN(modifier) && modifier > 0) { + _.className = 'q2'; + ae(_, ct('+' + modifier + '%')); + } + else if (!isNaN(modifier) && modifier < 0) { + _.className = 'q10'; + ae(_, ct(modifier + '%')); + } + + return _; + } + }, + + achievement: { + sort: [1, 2], + nItemsPerPage: 100, + searchable: 1, + filtrable: 1, + columns: [ { id: 'name', name: LANG.name, @@ -11884,6 +11868,28 @@ Listview.templates = { return buff; } }, + { + id: 'location', + name: LANG.location, + type: 'text', + width: '15%', + hidden: 1, + compute: function (achievement, td) { + if (achievement.zone) { + var a = ce('a'); + a.className = 'q1'; + a.href = '?zones=' + achievement.zone; + ae(a, ct(g_zones[achievement.zone])); + ae(td, a); + } + }, + getVisibleText: function (achievement) { + return Listview.funcBox.arrayText(achievement.zone, g_zones); + }, + sortFunc: function (a, b, col) { + return Listview.funcBox.assocArrCmp(a.zone, b.zone, g_zones); + } + }, { id: 'side', name: LANG.side, @@ -12068,18 +12074,18 @@ Listview.templates = { } ], - getItemLink: function(achievement) { - return '?achievement=' + achievement.id; - } - }, + getItemLink: function(achievement) { + return '?achievement=' + achievement.id; + } + }, - title: { - sort: [1], - nItemsPerPage: -1, - searchable: 1, - filtrable: 1, + title: { + sort: [1], + nItemsPerPage: -1, + searchable: 1, + filtrable: 1, - columns: [ + columns: [ { id: 'name', name: LANG.name, @@ -12096,12 +12102,12 @@ Listview.templates = { // nw(td) - sp.href = this.template.getItemLink(title); + sp.href = this.template.getItemLink(title); - if (title.who) { - ae(n, ct(title.who)); + if (title.who) { + ae(n, ct(title.who)); } - else { + else { ae(n, ct('<' + LANG.name + '>')); n.className = 'q0'; } @@ -12133,7 +12139,7 @@ Listview.templates = { return strcmp(aName, bName); }, getVisibleText: function(title) { - var buff = title.name + Listview.funcBox.getExpansionText(title); + var buff = title.name + Listview.funcBox.getExpansionText(title); return buff; } @@ -12267,25 +12273,25 @@ Listview.templates = { return m }, */ - getVisibleText: function(title) { - var buff = ''; + getVisibleText: function(title) { + var buff = ''; - if (title.source) { - for (var s in title.source) { - for (var i = 0, len = title.source[s].length; i < len; ++i) { - var sm = title.source[s][i]; - if (typeof sm == 'string') { - buff += ' ' + sm; + if (title.source) { + for (var s in title.source) { + for (var i = 0, len = title.source[s].length; i < len; ++i) { + var sm = title.source[s][i]; + if (typeof sm == 'string') { + buff += ' ' + sm; } - else if (sm.t){ - buff += ' ' + sm.n; + else if (sm.t){ + buff += ' ' + sm.n; } - } - } - } + } + } + } - return buff; - }, + return buff; + }, sortFunc: function(a, b, col) { return strcmp(this.getVisibleText(a), this.getVisibleText(b)); } @@ -12313,10 +12319,10 @@ Listview.templates = { } ], - getItemLink: function(title) { + getItemLink: function(title) { return '?title=' + title.id; - } - }, + } + }, profile: { sort: [], @@ -12550,12 +12556,12 @@ Listview.templates = { return; } - var spent = [profile.talenttree1, profile.talenttree2, profile.talenttree3]; - var specData = pr_getSpecFromTalents(profile.classs, spent); + var spent = [profile.talenttree1, profile.talenttree2, profile.talenttree3]; + var specData = pr_getSpecFromTalents(profile.classs, spent); var a = ce('a'); - a.className = 'icontiny tinyspecial tip q1'; - a.style.backgroundImage = 'url(' + g_staticUrl + '/images/wow/icons/tiny/' + specData.icon.toLowerCase() + '.gif)'; + a.className = 'icontiny tinyspecial tip q1'; + a.style.backgroundImage = 'url(' + g_staticUrl + '/images/wow/icons/tiny/' + specData.icon.toLowerCase() + '.gif)'; a.rel = 'np'; a.href = this.template.getItemLink(profile) + '#talents'; g_addTooltip(a, specData.name); @@ -12755,88 +12761,101 @@ Listview.templates = { getItemLink: function(profile) { if (profile.size !== undefined) { - return '?arena-team=' + profile.region + '.' + profile.realm + '.' + g_urlize(profile.name); + return '?arena-team=' + profile.region + '.' + profile.realm + '.' + g_urlize(profile.name); } else if (profile.members !== undefined) { return '?guild=' + profile.region + '.' + profile.realm + '.' + g_urlize(profile.name); } else { - return g_getProfileUrl(profile); + return g_getProfileUrl(profile); } } }, - model: { - sort: [], - mode: 3, - nItemsPerPage: 40, - nItemsPerRow: 4, - poundable: 2, - columns: [], - compute: function(e, k, f) { - k.className = "screenshot-cell"; - k.vAlign = "bottom"; - var b = ce("a"); - b.href = "javascript:;"; - b.onclick = this.template.modelShow.bind(this.template, e.npcId, e.displayId); - var c = ce("img"); - c.src = "http://static.wowhead.com/modelviewer/thumbs/npc/" + e.displayId + ".png"; - ae(b, c); - ae(k, b); - var j = ce("div"); - j.className = "screenshot-cell-user"; - b = ce("a"); - b.href = "?npcs=1&filter=" + (e.family ? "fa=" + e.family + ";": "") + "minle=1;cr=35;crs=0;crv=" + e.skin; - ae(b, ct(e.skin)); - ae(j, b); - ae(j, ct(" (" + e.count + ")")); - ae(k, j); - j = ce("div"); - j.style.position = "relative"; - j.style.height = "1em"; - var h = ce("div"); - h.className = "screenshot-caption"; - var g = ce("small"); - ae(g, ct(LANG.level + ": ")); - ae(g, ct(e.minLevel + (e.minLevel == e.maxLevel ? "": LANG.hyphen + (e.maxLevel == 9999 ? "??": e.maxLevel)))); - ae(g, ce("br")); - ae(h, g); - ae(j, h); - ae(k, j); - aE(k, "click", this.template.modelShow.bind(this.template, e.npcId, e.displayId, true)) - }, - modelShow: function(d, b, f, g) { - if (f) { - g = $E(g); - if (g.shiftKey || g.ctrlKey) { - return - } - var a = 0, - c = g._target; - while (c && a < 3) { - if (c.nodeName == "A") { - return - } - if (c.nodeName == "IMG") { - break - } - c = c.parentNode - } - } - ModelViewer.show({ - type: 1, - typeId: d, - displayId: b, - noPound: 1 - }) - } - }, + model: { + sort: [], + mode: 3, // Grid mode + nItemsPerPage: 40, + nItemsPerRow: 4, + poundable: 2, // Yes but w/o sort - currency: { - sort: [1], - searchable: 1, - filtrable: 1, - columns: [ + columns: [], + + compute: function(model, td, i) { + td.className = 'screenshot-cell'; + td.vAlign = 'bottom'; + + var a = ce('a'); + a.href = 'javascript:;'; + // a.className = 'pet-zoom'; // reference only + a.onclick = this.template.modelShow.bind(this.template, model.npcId, model.displayId, false); + + var img = ce('img'); + img.src = g_staticUrl + '/modelviewer/thumbs/npc/' + model.displayId + '.png'; + ae(a, img); + + ae(td, a); + + var d = ce('div'); + d.className = 'screenshot-cell-user'; + + a = ce('a'); + a.href = '?npcs=1&filter=' + (model.family ? 'fa=' + model.family + ';' : '') + 'minle=1;cr=35;crs=0;crv=' + model.skin; + ae(a, ct(model.skin)); + ae(d, a); + + ae(d, ct(' (' + model.count + ')')); + ae(td, d); + + d = ce('div'); + d.style.position = 'relative'; + d.style.height = '1em'; + + var d2 = ce('div'); + d2.className = 'screenshot-caption'; + + var s = ce('small'); + ae(s, ct(LANG.level + ': ')); + ae(s, ct((model.minLevel == 9999 ? '??' : model.minLevel) + (model.minLevel == model.maxLevel ? '' : LANG.hyphen + (model.maxLevel == 9999 ? '??' : model.maxLevel)))); + ae(s, ce('br')); + ae(d2, s); + ae(d, d2); + ae(td, d); + + aE(td, 'click', this.template.modelShow.bind(this.template, model.npcId, model.displayId, true)); + }, + + modelShow: function(npcId, displayId, sp, e) { + if (sp) { + e = $E(e); + + if (e.shiftKey || e.ctrlKey) { + return; + } + + var + j = 0, + el = e._target; + while (el && j < 3) { + if (el.nodeName == 'A') { + return; + } + if (el.nodeName == 'IMG') { + break; + } + el = el.parentNode; + } + } + + ModelViewer.show({type: 1, typeId: npcId, displayId: displayId, noPound: 1}); + } + }, + + currency: { + sort: [1], + searchable: 1, + filtrable: 1, + columns: [ { id: 'name', name: LANG.name, @@ -12889,16 +12908,16 @@ Listview.templates = { } ], - getItemLink: function(currency) { - return '?currency=' + currency.id; - } - }, + getItemLink: function(currency) { + return '?currency=' + currency.id; + } + }, - classs: { - sort: [1], - searchable: 1, - filtrable: 1, - columns: [ + classs: { + sort: [1], + searchable: 1, + filtrable: 1, + columns: [ { id: 'name', name: LANG.name, @@ -12982,16 +13001,16 @@ Listview.templates = { } ], - getItemLink: function(classs) { - return '?class=' + classs.id; - } - }, + getItemLink: function(classs) { + return '?class=' + classs.id; + } + }, - race: { - sort: [1], - searchable: 1, - filtrable: 1, - columns: [ + race: { + sort: [1], + searchable: 1, + filtrable: 1, + columns: [ { id: 'name', name: LANG.name, @@ -13101,10 +13120,10 @@ Listview.templates = { } ], - getItemLink: function(race) { - return '?race=' + race.id; - } - } + getItemLink: function(race) { + return '?race=' + race.id; + } + } }; Menu.fixUrls(mn_items, "?items="); @@ -13133,189 +13152,13 @@ var g_user = { name: "", roles: 0 }; -var g_npcs = {}; -var g_objects = {}; -var g_items = {}; -var g_itemsets = {}; -var g_quests = {}; -var g_spells = {}; -var g_titles = {}; // -var g_gatheredzones = {}; -var g_factions = {}; -var g_pets = {}; -var g_achievements = {}; -var g_holidays = {}; -var g_classes = {}; -var g_races = {}; -var g_skills={} -var g_gatheredcurrencies = {}; -var g_users = {}; -var g_types = { - 1 : "npc", - 2 : "object", - 3 : "item", - 4 : "itemset", - 5 : "quest", - 6 : "spell", - 7 : "zone", - 8 : "faction", - 9 : "pet", - 10 : "achievement", - 11 : "title", - 12 : "event", - 13 : "class", - 14 : "race", - 15 : "skill", - 17 : "currency" -}; + var g_locales = { - 0 : "enus", - 2 : "frfr", - 3 : "dede", - 6 : "eses", - 8 : "ruru" -}; -var g_file_races = { - 10 : "bloodelf", - 11 : "draenei", - 3 : "dwarf", - 7 : "gnome", - 1 : "human", - 4 : "nightelf", - 2 : "orc", - 6 : "tauren", - 8 : "troll", - 5 : "scourge" -}; -var g_file_classes = { - 6 : "deathknight", - 11 : "druid", - 3 : "hunter", - 8 : "mage", - 2 : "paladin", - 5 : "priest", - 4 : "rogue", - 7 : "shaman", - 9 : "warlock", - 1 : "warrior" -}; -var g_file_genders = { - 0 : "male", - 1 : "female" -}; -var g_file_factions = { - 1 : "alliance", - 2 : "horde" -}; -var g_file_gems = { - 1 : "meta", - 2 : "red", - 4 : "yellow", - 6 : "orange", - 8 : "blue", - 10 : "purple", - 12 : "green", - 14 : "prismatic" -}; -g_items.add = function(b, a) { - if (g_items[b] != null) { - cO(g_items[b], a) - } else { - g_items[b] = a - } -}; -g_items.getIcon = function(a) { - if (g_items[a] != null && g_items[a].icon) { - return g_items[a].icon - } else { - return "inv_misc_questionmark" - } -}; -g_items.createIcon = function(d, b, a, c) { - return Icon.create(g_items.getIcon(d), b, null, "?item=" + d, a, c) -}; -g_spells.add = function(b, a) { - if (g_spells[b] != null) { - cO(g_spells[b], a) - } else { - g_spells[b] = a - } -}; -g_spells.getIcon = function(a) { - if (g_spells[a] != null && g_spells[a].icon) { - return g_spells[a].icon - } else { - return "inv_misc_questionmark" - } -}; -g_spells.createIcon = function(d, b, a, c) { - return Icon.create(g_spells.getIcon(d), b, null, "?spell=" + d, a, c) -}; -g_achievements.getIcon = function(a) { - if (g_achievements[a] != null && g_achievements[a].icon) { - return g_achievements[a].icon - } else { - return "inv_misc_questionmark" - } -}; -g_achievements.createIcon = function(d, b, a, c) { - return Icon.create(g_achievements.getIcon(d), b, null, "?achievement=" + d, a, c) -}; -g_classes.getIcon = function(a) { - if (g_file_classes[a]) { - return "class_" + g_file_classes[a] - } else { - return "inv_misc_questionmark" - } -}; -g_classes.createIcon = function(d, b, a, c) { - return Icon.create(g_classes.getIcon(d), b, null, "?class=" + d, a, c) -}; -g_races.getIcon = function(b, a) { - if (a === undefined) { - a = 0 - } - if (g_file_races[b] && g_file_genders[a]) { - return "race_" + g_file_races[b] + "_" + g_file_genders[a] - } else { - return "inv_misc_questionmark" - } -}; -g_races.createIcon = function(d, b, a, c) { - return Icon.create(g_races.getIcon(d), b, null, "?race=" + d, a, c) -}; -g_skills.getIcon = function(a) { - if (g_skills[a] != null && g_skills[a].icon) { - return g_skills[a].icon - } else { - return "inv_misc_questionmark" - } -}; -g_skills.createIcon = function(d, b, a, c) { - return Icon.create(g_skills.getIcon(d), b, null, "?skill=" + d, a, c) -}; -g_gatheredcurrencies.getIcon = function(b, a) { - if (g_gatheredcurrencies[b] != null && g_gatheredcurrencies[b].icon) { - if (is_array(g_gatheredcurrencies[b].icon) && !isNaN(a)) { - return g_gatheredcurrencies[b].icon[a] - } - return g_gatheredcurrencies[b].icon - } else { - return "inv_misc_questionmark" - } -}; -g_gatheredcurrencies.createIcon = function(d, b, a, c) { - return Icon.create(g_gatheredcurrencies.getIcon(d, (a > 0 ? 0 : 1)), b, null, null, Math.abs(a), c) -}; -g_holidays.getIcon = function(a) { - if (g_holidays[a] != null && g_holidays[a].icon) { - return g_holidays[a].icon - } else { - return "inv_misc_questionmark" - } -}; -g_holidays.createIcon = function(d, b, a, c) { - return Icon.create(g_holidays.getIcon(d), b, null, "?event=" + d, a, c) + 0: 'enus', + 2: 'frfr', + 3: 'dede', + 6: 'eses', + 8: 'ruru' }; /* @@ -14686,6 +14529,7 @@ var ModelViewer = new function() { model: model, modelType: modelType, contentPath: 'http://static.wowhead.com/modelviewer/' + // contentPath: g_staticUrl + '/modelviewer/' }; var params = { @@ -14702,7 +14546,9 @@ var ModelViewer = new function() { if (modelType == 16 && equipList.length) { flashVars.equipList = equipList.join(','); } - swfobject.embedSWF('http://static.wowhead.com/modelviewer/ModelView.swf', 'dsjkgbdsg2346', '600', '400', '10.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', '10.0.0', 'http://static.wowhead.com/modelviewer/expressInstall.swf', flashVars, params, attributes); _w.style.display = ''; } } @@ -14789,20 +14635,24 @@ var ModelViewer = new function() { clear(); render(); } - function j(D) { - if (D == mode) { + + function j(newMode) { + if (newMode == mode) { return; } + g_setSelectedLink(this, 'modelviewer-mode'); + clear(); + if (mode == null) { - mode = D; + mode = newMode; setTimeout(render, 50); } else { - mode = D; - sc('modelviewer_mode', 7, D, '/', location.hostname); - // sc('modelviewer_mode', 7, D, '/', '.wowhead.com'); + mode = newMode; + sc('modelviewer_mode', 7, newMode, '/', location.hostname); + // sc('modelviewer_mode', 7, newMode, '/', '.wowhead.com'); render(); } } @@ -14944,7 +14794,7 @@ var ModelViewer = new function() { _o = ce('div'); _z = ce('div'); var flashDiv = ce('div'); - flashDiv.id = 'dsjkgbdsg2346'; + flashDiv.id = 'modelviewer-generic'; ae(_w, flashDiv); screen.className = 'modelviewer-screen'; _w.style.display = _o.style.display = _z.style.display = 'none'; @@ -17156,3 +17006,399 @@ Announcement.prototype = { ge(this.parent + '-markup').innerHTML = this.text; } }; + + +/* +Global WoW data +*/ + +var g_file_races = { + 1: 'human', + 2: 'orc', + 3: 'dwarf', + 4: 'nightelf', + 5: 'scourge', + 6: 'tauren', + 7: 'gnome', + 8: 'troll', + 10: 'bloodelf', + 11: 'draenei' +}; + +var g_file_classes = { + 1: 'warrior', + 2: 'paladin', + 3: 'hunter', + 4: 'rogue', + 5: 'priest', + 6: 'deathknight', + 7: 'shaman', + 8: 'mage', + 9: 'warlock', + 11: 'druid' +}; + +var g_file_genders = { + 0: 'male', + 1: 'female' +}; + +var g_file_factions = { + 1: 'alliance', + 2: 'horde' +}; + +var g_file_gems = { + 1: 'meta', + 2: 'red', + 4: 'yellow', + 6: 'orange', + 8: 'blue', + 10: 'purple', + 12: 'green', + 14: 'prismatic' +}; + +/* +Source: +http://www.wowwiki.com/Patches +http://www.wowwiki.com/Patches/1.x +*/ + +function g_getPatchVersionIndex(timestamp) { + var _ = g_getPatchVersion; + var l = 0, u = _.T.length - 2, m; + + while (u > l) { + m = Math.floor((u + l) / 2); + + if (timestamp >= _.T[m] && timestamp < _.T[m + 1]) { + return m; + } + + if (timestamp >= _.T[m]) { + l = m + 1; + } + else { + u = m - 1; + } + } + m = Math.ceil((u + l) / 2); + + return m; +} + +function g_getPatchVersion(timestamp) { + var m = g_getPatchVersionIndex(timestamp); + return g_getPatchVersion.V[m]; +} +g_getPatchVersion.V = [ + '1.12.0', + '1.12.1', + '1.12.2', + + '2.0.1', + '2.0.3', + '2.0.4', + '2.0.5', + '2.0.6', + '2.0.7', + '2.0.8', + '2.0.10', + '2.0.12', + + '2.1.0', + '2.1.1', + '2.1.2', + '2.1.3', + + '2.2.0', + '2.2.2', + '2.2.3', + + '2.3.0', + '2.3.2', + '2.3.3', + + '2.4.0', + '2.4.1', + '2.4.2', + '2.4.3', + + '3.0.2', + '3.0.3', + '3.0.8', + '3.0.9', + + '3.1.0', + '3.1.1', + '3.1.2', + '3.1.3', + + '3.2.0', + '3.2.2', + + '3.3.0', + '3.3.2', + '3.3.3', + '3.3.5', + + '?????' +]; + +g_getPatchVersion.T = [ + // 1.12: Drums of War + 1153540800000, // 1.12.0 22 August 2006 + 1159243200000, // 1.12.1 26 September 2006 + 1160712000000, // 1.12.2 13 October 2006 + + // 2.0: Before the Storm (The Burning Crusade) + 1165294800000, // 2.0.1 5 December 2006 + 1168318800000, // 2.0.3 9 January 2007 + 1168578000000, // 2.0.4 12 January 2007 + 1168750800000, // 2.0.5 14 January 2007 + 1169528400000, // 2.0.6 23 January 2007 + 1171342800000, // 2.0.7 13 February 2007 + 1171602000000, // 2.0.8 16 February 2007 + 1173157200000, // 2.0.10 6 March 2007 + 1175572800000, // 2.0.12 3 April 2007 + + // 2.1: The Black Temple + 1179806400000, // 2.1.0 22 May 2007 + 1181016000000, // 2.1.1 5 June 2007 + 1182225600000, // 2.1.2 19 June 2007 + 1184040000000, // 2.1.3 10 July 2007 + + // 2.2: Voice Chat! + 1190692800000, // 2.2.0 25 September 2007 + 1191297600000, // 2.2.2 2 October 2007 + 1191902400000, // 2.2.3 9 October 2007 + + // 2.3: The Gods of Zul'Aman + 1194930000000, // 2.3.0 13 November 2007 + 1199768400000, // 2.3.2 08 January 2008 + 1200978000000, // 2.3.3 22 January 2008 + + // 2.4: Fury of the Sunwell + 1206417600000, // 2.4.0 25 March 2008 + 1207022400000, // 2.4.1 1 April 2008 + 1210651200000, // 2.4.2 13 May 2008 + 1216094400000, // 2.4.3 15 July 2008 + + // 3.0: Echoes of Doom + 1223956800000, // 3.0.2 October 14 2008 + 1225774800000, // 3.0.3 November 4 2008 + 1232427600000, // 3.0.8 January 20 2009 + 1234242000000, // 3.0.9 February 10 2009 + + // 3.1: Secrets of Ulduar + 1239681600000, // 3.1.0 April 14 2009 + 1240286400000, // 3.1.1 April 21 2009 + 1242705600000, // 3.1.2 19 May 2009 + 1243915200000, // 3.1.3 2 June 2009 + + // 3.2: Call of the Crusader + 1249358400000, // 3.2.0 4 August 2009 + 1253595600000, // 3.2.2 22 September 2009 + + // 3.3: Fall of the Lich King + 1260266400000, // 3.3.0 8 December 2009 + 1265104800000, // 3.3.2 2 February 2010 + 1269320400000, // 3.3.3 23 March 2010 + 1277182800000, // 3.3.5 22 June 2010 + + 9999999999999 +]; + +/* +Global stuff related to WoW database entries +*/ + +var + g_npcs = {}, + g_objects = {}, + g_items = {}, + g_itemsets = {}, + g_quests = {}, + g_spells = {}, + g_gatheredzones = {}, + g_factions = {}, + g_pets = {}, + g_achievements = {}, + g_titles = {}, + g_holidays = {}, + g_classes = {}, + g_races = {}, + g_skills = {}, + g_gatheredcurrencies = {}, + g_users = {}; + +var g_types = { + 1: 'npc', + 2: 'object', + 3: 'item', + 4: 'itemset', + 5: 'quest', + 6: 'spell', + 7: 'zone', + 8: 'faction', + 9: 'pet', + 10: 'achievement', + 11: 'title', + 12: 'event', + 13: 'class', + 14: 'race', + 15: 'skill', + 17: 'currency' +}; + +// Items +cO(g_items, { + add: function(id, json) { + if (g_items[id] != null) { + cO(g_items[id], json); + } + else { + g_items[id] = json; + } + }, + getIcon: function(id) { + if (g_items[id] != null && g_items[id].icon) { + return g_items[id].icon; + } + else { + return 'inv_misc_questionmark'; + } + }, + createIcon: function(id, size, num, qty) { + return Icon.create(g_items.getIcon(id), size, null, '?item=' + id, num, qty); + } +}); + +// Spells +cO(g_spells, { + add: function(id, json) { + if (g_spells[id] != null) { + cO(g_spells[id], json); + } + else { + g_spells[id] = json; + } + }, + getIcon: function(id) { + if (g_spells[id] != null && g_spells[id].icon) { + return g_spells[id].icon; + } + else { + return 'inv_misc_questionmark'; + } + }, + createIcon: function(id, size, num, qty) { + return Icon.create(g_spells.getIcon(id), size, null, '?spell=' + id, num, qty); + } +}); + +// Achievements +cO(g_achievements, { + getIcon: function(id) { + if (g_achievements[id] != null && g_achievements[id].icon) { + return g_achievements[id].icon; + } + else { + return 'inv_misc_questionmark'; + } + }, + createIcon: function(id, size, num, qty) { + return Icon.create(g_achievements.getIcon(id), size, null, '?achievement=' + id, num, qty); + } +}); + +// Classes +cO(g_classes, { + getIcon: function(id) { + if (g_file_classes[id]) { + return 'class_' + g_file_classes[id]; + } + else { + return 'inv_misc_questionmark'; + } + }, + createIcon: function(id, size, num, qty) { + return Icon.create(g_classes.getIcon(id), size, null, '?class=' + id, num, qty); + } +}); + +// Races +cO(g_races, { + getIcon: function(id, gender) { + if (gender === undefined) { + gender = 0; + } + if (g_file_races[id] && g_file_genders[gender]) { + return 'race_' + g_file_races[id] + '_' + g_file_genders[gender]; + } + else { + return 'inv_misc_questionmark'; + } + }, + createIcon: function(id, size, num, qty) { + return Icon.create(g_races.getIcon(id), size, null, '?race=' + id, num, qty); + } +}); + +// Skills +cO(g_skills, { + getIcon: function(id) { + if (g_skills[id] != null && g_skills[id].icon) { + return g_skills[id].icon; + } + else { + return 'inv_misc_questionmark'; + } + }, + createIcon: function(id, size, num, qty) { + return Icon.create(g_skills.getIcon(id), size, null, '?skill=' + id, num, qty); + } +}); + +// Currencies +cO(g_gatheredcurrencies, { + getIcon: function(id, side) { + if (g_gatheredcurrencies[id] != null && g_gatheredcurrencies[id].icon) { + if (is_array(g_gatheredcurrencies[id].icon) && !isNaN(side)) { + return g_gatheredcurrencies[id].icon[side]; + } + return g_gatheredcurrencies[id].icon; + } + else + return 'inv_misc_questionmark'; + }, + createIcon: function(id, size, num, qty) { + return Icon.create(g_gatheredcurrencies.getIcon(id, (num > 0 ? 0 : 1)), size, null, null, Math.abs(num), qty); + } +}); + +// Holidays +cO(g_holidays, { + getIcon: function(id) { + if (g_holidays[id] != null && g_holidays[id].icon) { + return g_holidays[id].icon; + } + else { + return 'inv_misc_questionmark'; + } + }, + createIcon: function(id, size, num, qty) { + return Icon.create(g_holidays.getIcon(id), size, null, '?event=' + id, num, qty); + } +}); + +function g_getIngameLink(color, id, name) { + // prompt(LANG.prompt_ingamelink, '/script DEFAULT_CHAT_FRAME:AddMessage("\\124c' + a + "\\124H" + c + "\\124h[" + b + ']\\124h\\124r");') + return '/script DEFAULT_CHAT_FRAME:AddMessage("\\124c' + color + '\\124H' + id + '\\124h[' + name + ']\\124h\\124r");'; +} + +/* + * Wowhead Site Achievements (WSA) + * which i intend to ignore +*/ diff --git a/template/js/locale_enus.js b/template/js/locale_enus.js index a6dcee6e..af762954 100644 --- a/template/js/locale_enus.js +++ b/template/js/locale_enus.js @@ -858,7 +858,7 @@ var mn_database = [ ]; var mn_tools = [ [0,"Talent Calculator","?talent",mn_talentCalc], - [2,"Pet Calculator","?petcalc",mn_petCalc], + [2,"Hunter Pet Calculator","?petcalc",mn_petCalc], [3,"Item Comparison","?compare"], [5,"Profiler","?profiler",[ [0,"Characters","?profiles"], diff --git a/template/pet.tpl b/template/pet.tpl new file mode 100644 index 00000000..5344a6bc --- /dev/null +++ b/template/pet.tpl @@ -0,0 +1,59 @@ +{include file='header.tpl'} + +