diff --git a/includes/kernel.php b/includes/kernel.php index 76a885dc..1a846556 100644 --- a/includes/kernel.php +++ b/includes/kernel.php @@ -54,6 +54,9 @@ foreach ($AoWoWconf['characters'] as $realm => $charDBInfo) // create Template-Object $smarty = new SmartyAoWoW($AoWoWconf); +// attach template to util (yes bandaid, shut up and code me a fix) +Util::$pageTemplate = &$smarty; + // Setup Session if (isset($_COOKIE[COOKIE_AUTH])) { diff --git a/includes/types/achievement.class.php b/includes/types/achievement.class.php index 56d0eed1..08663de2 100644 --- a/includes/types/achievement.class.php +++ b/includes/types/achievement.class.php @@ -13,8 +13,11 @@ class AchievementList extends BaseType public $criteria = []; public $tooltip = []; - protected $queryBase = 'SELECT *, id AS ARRAY_KEY FROM ?_achievement a'; - protected $queryOpts = ['a' => ['o' => 'orderInGroup ASC']]; + protected $queryBase = 'SELECT `a`.*, `a`.`id` AS ARRAY_KEY FROM ?_achievement a'; + protected $queryOpts = array( + 'a' => ['o' => 'orderInGroup ASC'], + 'ac' => ['j' => ['?_achievementcriteria AS `ac` ON `ac`.`refAchievement` = `a`.`id`', true], 'g' => '`a`.`id`'] + ); public function __construct($conditions = [], $applyFilter = false) { @@ -267,7 +270,7 @@ class AchievementListFilter extends Filter } unset($cr); - $this->error = 1; + $this->error = true; return [1]; } diff --git a/includes/types/gameobject.class.php b/includes/types/gameobject.class.php index 28f2c29f..4b4b704a 100644 --- a/includes/types/gameobject.class.php +++ b/includes/types/gameobject.class.php @@ -6,14 +6,74 @@ if (!defined('AOWOW_REVISION')) class GameObjectList extends BaseType { + use listviewHelper, spawnHelper; + public static $type = TYPE_OBJECT; protected $queryBase = 'SELECT *, go.entry AS ARRAY_KEY FROM gameobject_template go'; protected $queryOpts = array( 'go' => [['lg']], - 'lg' => ['j' => ['locales_gameobject lq ON go.entry = lq.entry', true]] + 'lg' => ['j' => ['locales_gameobject lq ON go.entry = lq.entry', true]], + 'l' => ['j' => ['?_lock l ON l.id = IF(go.type = 3, data0, null)', true], 's' => ', l.type1, l.properties1, l.reqSkill1, l.type2, l.properties2, l.reqSkill2'] ); + public function __construct($conditions = [], $applyFilter = false) + { + parent::__construct($conditions, $applyFilter); + + if ($this->error) + return; + + // post processing + // most of this will be obsolete, when gameobjects get their own table + foreach ($this->iterate() as $_id => &$curTpl) + { + switch ($curTpl['type']) + { + case OBJECT_CHEST: + $curTpl['lootId'] = $curTpl['data1']; + $curTpl['lootStack'] = [$curTpl['data4'], $curTpl['data5']]; + $curTpl['lockId'] = $curTpl['data0']; + + if (!isset($curTpl['properties1'])) + break; + + if ($curTpl['properties1'] == LOCK_PROPERTY_HERBALISM) + { + $curTpl['reqSkill'] = $curTpl['reqSkill1']; + $curTpl['type'] = -3; + } + else if ($curTpl['properties1'] == LOCK_PROPERTY_MINING) + { + $curTpl['reqSkill'] = $curTpl['reqSkill1']; + $curTpl['type'] = -4; + } + else if ($curTpl['properties1'] == LOCK_PROPERTY_FOOTLOCKER) + { + $curTpl['reqSkill'] = $curTpl['reqSkill1']; + $curTpl['type'] = -5; + } + else if( $curTpl['properties2'] == LOCK_PROPERTY_FOOTLOCKER) + { + $curTpl['reqSkill'] = $curTpl['reqSkill2']; + $curTpl['type'] = -5; + } + + break; + case OBJECT_FISHINGHOLE: + $curTpl['lootId'] = $curTpl['data1']; + $curTpl['lootStack'] = [$curTpl['data2'], $curTpl['data3']]; + break; + default: // adding more, when i need them + $curTpl['lockId'] = 0; + break; + } + + for ($i = 0; $i < 24; $i++) // kill indescriptive/unused fields + unset($curTpl['data'.$i]); + } + } + public static function getName($id) { $n = DB::Aowow()->SelectRow(' @@ -36,10 +96,47 @@ class GameObjectList extends BaseType return Util::localizedString($n, 'name'); } - public function getListviewData() { } - public function addGlobalsToJScript(&$template, $addMask = 0) { } - public function renderTooltip() { } + public function getListviewData() + { + $data = []; + foreach ($this->iterate() as $__) + { + $data[$this->id] = array( + 'id' => $this->id, + 'name' => $this->getField('name', true), + 'type' => $this->curTpl['type'] + ); + if (!empty($this->curTpl['reqSkill'])) + $data[$this->id]['skill'] = $this->curTpl['reqSkill']; + } + + return $data; + } + + public function renderTooltip($interactive = false) + { + if (!$this->curTpl) + return array(); + + if (isset($this->tooltips[$this->id])) + return $this->tooltips[$this->id]; + + $x = ''; + $x .= ''; + $x .= ''; + if ($locks = Lang::getLocks($this->curTpl['lockId'])) + foreach ($locks as $l) + $x .= ''; + + $x .= '
'.$this->getField('name', true).'
[TYPE '.$this->curTpl['type'].']
'.$l.'
'; + + $this->tooltips[$this->id] = $x; + + return $this->tooltips[$this->id]; + } + + public function addGlobalsToJScript(&$template, $addMask = 0) { } } ?> diff --git a/includes/types/itemset.class.php b/includes/types/itemset.class.php index 39f67c96..e7da2129 100644 --- a/includes/types/itemset.class.php +++ b/includes/types/itemset.class.php @@ -122,7 +122,7 @@ class ItemsetListFilter extends Filter } unset($cr); - $this->error = 1; + $this->error = true; return [1]; } diff --git a/includes/types/spell.class.php b/includes/types/spell.class.php index 021304f5..fc90b353 100644 --- a/includes/types/spell.class.php +++ b/includes/types/spell.class.php @@ -1840,7 +1840,7 @@ class SpellListFilter extends Filter } unset($cr); - $this->error = 1; + $this->error = true; return [1]; } diff --git a/includes/utilities.php b/includes/utilities.php index befb7690..508dcaf8 100644 --- a/includes/utilities.php +++ b/includes/utilities.php @@ -66,7 +66,7 @@ class Lang public static function getLocks($lockId, $interactive = false) { $locks = []; - $lock = DB::Aowow()->selectRow('SELECT * FROM ?_lock WHERE id = ?d', $lockId); + $lock = DB::Aowow()->selectRow('SELECT * FROM ?_lock WHERE id = ?d', $lockId); if (!$lock) return ''; @@ -279,6 +279,7 @@ class SmartyAoWoW extends Smarty { private $config = []; private $jsGlobals = []; + private $errors = []; public function __construct($config) { @@ -319,6 +320,12 @@ class SmartyAoWoW extends Smarty $this->_tpl_vars['page'][$var] = $val; } + // use, if you want to alert the staff to a problem with Trinity + public function internalError($str) + { + $this->errors[] = $str; + } + public function display($tpl) { $tv = &$this->_tpl_vars; @@ -355,19 +362,37 @@ class SmartyAoWoW extends Smarty } } + // display occured errors + if (User::isInGroup(U_GROUP_STAFF) && $this->errors) + { + if (!isset($tv['announcements'])) + $tv['announcements'] = []; + + $tv['announcements'][] = array( + 'id' => 0, + 'mode' => 1, + 'status' => 1, + 'name' => 'internal error', + 'style' => 'padding-left: 45px; background-image: url(template/images/report.gif); background-size: 15px 15px; background-position: 10px center; border: dashed 2px #C03030;', + 'text' => '- '.implode("
- ", $this->errors).'
', + ); + } + // fetch announcements if ($tv['query'][0] && !preg_match('/[^a-z]/i', $tv['query'][0])) { + if (!isset($tv['announcements'])) + $tv['announcements'] = []; + $ann = DB::Aowow()->Select('SELECT * FROM ?_announcements WHERE status = 1 AND (page = ? OR page = "*")', $tv['query'][0]); foreach ($ann as $k => $v) { if ($t = Util::localizedString($v, 'text')) + { $ann[$k]['text'] = Util::jsEscape($t); - else - unset($ann[$k]); + $tv['announcements'][] = $ann[$k]; + } } - - $tv['announcements'] = $ann; } $this->applyGlobals(); @@ -1233,6 +1258,8 @@ class Util public static $tcEncoding = '0zMcmVokRsaqbdrfwihuGINALpTjnyxtgevElBCDFHJKOPQSUWXYZ123456789'; + public static $pageTemplate = null; + private static $execTime = 0.0; public static function execTime($set = false) @@ -1676,7 +1703,7 @@ class Util case 0: return true; case 1: - return !$keys[0] || isset($struct[$keys[0]]); + return (is_int($keys) && in_array($keys, $struct)) || (is_array($keys) && isset($struct[$keys[0]])); case 2: if (!isset($struct[$keys[0]])) return false; @@ -1840,11 +1867,17 @@ class Util $set['max'] = $entry['maxcount']; } + if (!isset($groupChances[$entry['groupid']])) + { + $groupChances[$entry['groupid']] = 0; + $nGroupEquals[$entry['groupid']] = 0; + } + if ($set['quest'] || !$set['group']) $set['groupChance'] = abs($entry['ChanceOrQuestChance']); else if ($entry['groupid'] && !$entry['ChanceOrQuestChance']) { - @$nGroupEquals[$entry['groupid']]++; + $nGroupEquals[$entry['groupid']]++; $set['groupChance'] = &$groupChances[$entry['groupid']]; } else if ($entry['groupid'] && $entry['ChanceOrQuestChance']) @@ -1854,10 +1887,8 @@ class Util } else // shouldn't happened { - if (User::isInGroup(U_GROUP_DEV)) - die(var_dump($entry)); - else - continue; + Util::$pageTemplate->internalError('Loot by LootId: unhandled case in calculating chance for item '.$entry['item'].'!'); + continue; } $loot[] = $set; @@ -1868,8 +1899,11 @@ class Util $sum = $groupChances[$k]; if (!$sum) $sum = 0; - else if ($sum > 100) // group has > 100% dropchance .. hmm, display some kind of error..? + else if ($sum > 100) + { + Util::$pageTemplate->internalError('Loot by LootId: entry '.$lootId.' / group '.$k.' has a total chance of '.$sum.'%. Some items cannot drop!'); $sum = 100; + } $cnt = empty($nGroupEquals[$k]) ? 1 : $nGroupEquals[$k]; @@ -1879,8 +1913,7 @@ class Util return [$loot, array_unique($rawItems)]; } - // v this is bullshit, but as long as there is no integral template class.. - public static function handleLoot($table, $entry, &$pageTemplate, $debug = false) + public static function handleLoot($table, $entry, $debug = false, &$debugCols = []) { $lv = []; $loot = null; @@ -1902,7 +1935,7 @@ class Util return $lv; $items = new ItemList(array(['i.id', $struct[1]])); - $items->addGlobalsToJscript($pageTemplate, GLOBALINFO_SELF | GLOBALINFO_RELATED); + $items->addGlobalsToJscript(Util::$pageTemplate, GLOBALINFO_SELF | GLOBALINFO_RELATED); $foo = $items->getListviewData(); // assign listview LV rows to loot rows, not the other way round! The same item may be contained multiple times @@ -1950,7 +1983,7 @@ class Util ); $lv[] = array_merge($base, $data); - $pageTemplate->extendGlobalData(TYPE_ITEM, [$loot['content'] => $data]); + Util::$pageTemplate->extendGlobalData(TYPE_ITEM, [$loot['content'] => $data]); } } @@ -1973,6 +2006,20 @@ class Util $_['percent'] = 100; } } + else + { + $fields = ['mode', 'reference']; + $set = 0; + foreach ($lv as $foo) + foreach ($fields as $idx => $field) + if (!empty($foo[$field])) + $set |= 1 << $idx; + + $debugCols[] = "Listview.funcBox.createSimpleCol('group', 'Group', '7%', 'group')"; + foreach ($fields as $idx => $field) + if ($set & (1 << $idx)) + $debugCols[] = "Listview.funcBox.createSimpleCol('".$field."', '".Util::ucFirst($field)."', '7%', '".$field."')"; + } return $lv; } @@ -2009,13 +2056,15 @@ class Util foreach ($refs as $rId => $ref) { - // errör: item/ref is in group 0 without a chance set + // check for possible database inconsistencies if (!$ref['chance'] && !$ref['isGrouped']) - continue; // todo (low): create dubug output + Util::$pageTemplate->internalError('Loot by Item: ungrouped Item/Ref '.$ref['item'].' has 0% chance assigned!'); - // errör: item/ref is in group with >100% chance across all items contained if ($ref['isGrouped'] && $ref['sumChance'] > 100) - continue; // todo (low): create dubug output + Util::$pageTemplate->internalError('Loot by Item: group with Item/Ref '.$ref['item'].' has '.$ref['sumChance'].'% total chance! Some items cannot drop!'); + + if ($ref['isGrouped'] && $ref['sumChance'] == 100 && !$ref['chance']) + Util::$pageTemplate->internalError('Loot by Item: Item/Ref '.$ref['item'].' with adaptive chance cannot drop. Group already at 100%!'); $chance = ($ref['chance'] ? $ref['chance'] : (100 - $ref['sumChance']) / $ref['nZeroItems']) / 100; diff --git a/pages/currencies.php b/pages/currencies.php index badbace4..67ed0e29 100644 --- a/pages/currencies.php +++ b/pages/currencies.php @@ -10,7 +10,7 @@ $validCats = [1, 2, 3, 22]; $title = [Util::ucFirst(Lang::$game['currencies'])]; $cacheKey = implode('_', [CACHETYPE_PAGE, TYPE_CURRENCY, -1, isset($cat) ? $cat : -1, User::$localeId]); -if ($cat !== null && !in_array($cat, $validCats)) +if (!Util::isValidPage($validCats, $cat)) $smarty->error(); if (isset($cat)) diff --git a/pages/events.php b/pages/events.php index 2838c1d8..2e10dd55 100644 --- a/pages/events.php +++ b/pages/events.php @@ -11,7 +11,7 @@ $validCats = [0, 1, 2, 3]; $title = [Lang::$game['events']]; $cacheKey = implode('_', [CACHETYPE_PAGE, TYPE_WORLDEVENT, -1, $cat, User::$localeId]); -if (!in_array($cat, $validCats)) +if (!Util::isValidPage($validCats, $cat)) $smarty->error(); $path[] = $cat; diff --git a/pages/item.php b/pages/item.php index ecd9f80e..7f579a3e 100644 --- a/pages/item.php +++ b/pages/item.php @@ -75,10 +75,11 @@ if (!$smarty->loadCache($cacheKeyPage, $item)) $item->addGlobalsToJscript($smarty, GLOBALINFO_EXTRA | GLOBALINFO_SELF); - $_flags = $item->getField('flags'); - $_slot = $item->getField('slot'); - $_subClass = $item->getField('subClass'); - $_class = $item->getField('class'); + $_flags = $item->getField('flags'); + $_slot = $item->getField('slot'); + $_subClass = $item->getField('subClass'); + $_class = $item->getField('class'); + $_bagFamily = $item->getField('bagFamily'); /***********/ /* Infobox */ @@ -196,7 +197,7 @@ if (!$smarty->loadCache($cacheKeyPage, $item)) if ($item->getField('flagsExtra') & 0x0100) // cant roll need $quickInfo[] = '[tooltip=tooltip_cannotrollneed]'.Lang::$item['noNeedRoll'].'[/tooltip]'; - if ($item->getField('bagFamily') & 0x0100) // fits into keyring + if ($_bagFamily & 0x0100) // fits into keyring $quickInfo[] = Lang::$item['atKeyring']; @@ -308,29 +309,32 @@ if (!$smarty->loadCache($cacheKeyPage, $item)) /* Extra Tabs */ /**************/ + // tabs: this item is contained in.. $sourceTabs = array( // 0 => refLoot - 1 => ['item', '$LANG.tab_containedin', 'contained-in-item', [], []], - 2 => ['item', '$LANG.tab_disenchantedfrom', 'disenchanted-from', [], []], - 3 => ['item', '$LANG.tab_prospectedfrom', 'prospected-from', [], []], - 4 => ['item', '$LANG.tab_milledfrom', 'milled-from', [], []], - 5 => ['creature', '$LANG.tab_droppedby', 'dropped-by', [], []], - 6 => ['creature', '$LANG.tab_pickpocketedfrom', 'pickpocketed-from', [], []], - 7 => ['creature', '$LANG.tab_skinnedfrom', 'skinned-from', [], []], - 8 => ['creature', '$LANG.tab_minedfromnpc', 'mined-from-npc', [], []], - 9 => ['creature', '$LANG.tab_salvagedfrom', 'salvaged-from', [], []], - 10 => ['creature', '$LANG.tab_gatheredfromnpc', 'gathered-from-npc', [], []], - 11 => ['quest', '$LANG.tab_rewardfrom', 'reward-from-quest', [], []], - 12 => ['zone', '$LANG.tab_fishedin', 'fished-in', [], []], - 13 => ['object', '$LANG.tab_containedin', 'contained-in-go', [], []], - 14 => ['object', '$LANG.tab_minedfrom', 'mined-from-go', [], []], - 15 => ['object', '$LANG.tab_gatheredfrom', 'gathered-from-go', [], []], - 16 => ['spell', '$LANG.tab_createdby', 'created-by', [], []] + 1 => ['item', '$LANG.tab_containedin', 'contained-in-item', [], [], []], + 2 => ['item', '$LANG.tab_disenchantedfrom', 'disenchanted-from', [], [], []], + 3 => ['item', '$LANG.tab_prospectedfrom', 'prospected-from', [], [], []], + 4 => ['item', '$LANG.tab_milledfrom', 'milled-from', [], [], []], + 5 => ['creature', '$LANG.tab_droppedby', 'dropped-by', [], [], []], + 6 => ['creature', '$LANG.tab_pickpocketedfrom', 'pickpocketed-from', [], [], []], + 7 => ['creature', '$LANG.tab_skinnedfrom', 'skinned-from', [], [], []], + 8 => ['creature', '$LANG.tab_minedfromnpc', 'mined-from-npc', [], [], []], + 9 => ['creature', '$LANG.tab_salvagedfrom', 'salvaged-from', [], [], []], + 10 => ['creature', '$LANG.tab_gatheredfromnpc', 'gathered-from-npc', [], [], []], + 11 => ['quest', '$LANG.tab_rewardfrom', 'reward-from-quest', [], [], []], + 12 => ['zone', '$LANG.tab_fishedin', 'fished-in-zone', [], [], []], + 13 => ['object', '$LANG.tab_containedin', 'contained-in-go', [], [], []], + 14 => ['object', '$LANG.tab_minedfrom', 'mined-from-go', [], [], []], + 15 => ['object', '$LANG.tab_gatheredfrom', 'gathered-from-go', [], [], []], + 16 => ['object', '$LANG.tab_fishedin', 'fished-in-go', [], [], []], + 17 => ['spell', '$LANG.tab_createdby', 'created-by', [], [], []] ); - $data = []; - $xCols = ''; - $sources = Util::getLootSource($_id); + $data = []; + $questLoot = []; + $spellLoot = []; + $sources = Util::getLootSource($_id); foreach ($sources as $lootTpl => $lootData) { // cap fetched entries to the sql-limit to guarantee, that the highest chance items get selected first @@ -365,26 +369,16 @@ if (!$smarty->loadCache($cacheKeyPage, $item)) foreach ($srcType->iterate() as $curTpl) { + $tabId = 7; // general case (skinning) if ($curTpl['type_flags'] & NPC_TYPEFLAG_HERBLOOT) - { - $data[10][] = array_merge($srcData[$srcType->id], $lootData[$srcType->getField('skinLootId')]); - $sourceTabs[10][3][] = 'Listview.extraCols.percent'; - } + $tabId = 10; else if ($curTpl['type_flags'] & NPC_TYPEFLAG_ENGINEERLOOT) - { - $data[9][] = array_merge($srcData[$srcType->id], $lootData[$srcType->getField('skinLootId')]); - $sourceTabs[9][3][] = 'Listview.extraCols.percent'; - } + $tabId = 9; else if ($curTpl['type_flags'] & NPC_TYPEFLAG_MININGLOOT) - { - $data[8][] = array_merge($srcData[$srcType->id], $lootData[$srcType->getField('skinLootId')]); - $sourceTabs[8][3][] = 'Listview.extraCols.percent'; - } - else - { - $data[7][] = array_merge($srcData[$srcType->id], $lootData[$srcType->getField('skinLootId')]); - $sourceTabs[7][3][] = 'Listview.extraCols.percent'; - } + $tabId = 8; + + $data[$tabId][] = array_merge($srcData[$srcType->id], $lootData[$srcType->getField('skinLootId')]); + $sourceTabs[$tabId][3][] = 'Listview.extraCols.percent'; } break; @@ -400,23 +394,23 @@ if (!$smarty->loadCache($cacheKeyPage, $item)) $sourceTabs[12][3][] = 'Listview.extraCols.percent'; break; case LOOT_GAMEOBJECT: - // GO-loot - // contained in GO (chest) - // mined-from (vine) - // gathered-from (herb) - // like skinning with lock-properties instead of type_flags - // foreach($rows as $row) - // { - // // Залежи руды - // if($row['lockproperties1'] == LOCK_PROPERTIES_MINING) - // $item['minedfromobject'][] = array_merge(objectinfo2($row), $drop); - // // Собирается с трав - // elseif($row['lockproperties1'] == LOCK_PROPERTIES_HERBALISM) - // $item['gatheredfromobject'][] = array_merge(objectinfo2($row), $drop); - // // Сундуки - // else - // $item['containedinobject'][] = array_merge(objectinfo2($row), $drop); - // } + $srcType = new GameObjectList(array(['type', [OBJECT_CHEST, OBJECT_FISHINGHOLE]], ['data1', $ids])); + $srcData = $srcType->getListviewData(); + + foreach ($srcType->iterate() as $curTpl) + { + $tabId = 13; // general chest loot + if ($curTpl['type'] == -4) // vein + $tabId = 14; + else if ($curTpl['type'] == -3) // herb + $tabId = 15; + else if ($curTpl['type'] == 25) // fishing node + $tabId = 16; + + $data[$tabId][] = array_merge($srcData[$srcType->id], $lootData[$srcType->getField('lootId')]); + $sourceTabs[$tabId][3][] = 'Listview.extraCols.percent'; + $sourceTabs[$tabId][5][] = 'skill'; // conflicts a bit with fishing nodes (no real requirement) + } break; case LOOT_PROSPECTING: $sourceTab = 3; @@ -448,23 +442,55 @@ if (!$smarty->loadCache($cacheKeyPage, $item)) break; case LOOT_QUEST: // merge regular quest rewards into quest_mail_loot_template results - $conditions = array( - 'OR', ['qt.RewardMailTemplateId', $ids], - ['RewardChoiceItemId1', $_id], ['RewardChoiceItemId2', $_id], ['RewardChoiceItemId3', $_id], ['RewardChoiceItemId4', $_id], ['RewardChoiceItemId5', $_id], - ['RewardChoiceItemId6', $_id], ['RewardItemId1', $_id], ['RewardItemId2', $_id], ['RewardItemId3', $_id], ['RewardItemId4', $_id], - ); - $srcType = new QuestList($conditions); - $srcType->addGlobalsToJscript($smarty, GLOBALINFO_SELF | GLOBALINFO_REWARDS); - $data[11] = $srcType->getListviewData(); // dont merge chances; most are 100% anyway and regular reward loot has none - + $questLoot = $ids; break; case LOOT_SPELL: - // merge with: created by [spell] - + // merge with "created by [spell]" + $spellLoot = $ids; break; } } + // merge quest rewards with quest_mail_loot + $conditions = array( + 'OR', + ['RewardChoiceItemId1', $_id], ['RewardChoiceItemId2', $_id], ['RewardChoiceItemId3', $_id], ['RewardChoiceItemId4', $_id], ['RewardChoiceItemId5', $_id], + ['RewardChoiceItemId6', $_id], ['RewardItemId1', $_id], ['RewardItemId2', $_id], ['RewardItemId3', $_id], ['RewardItemId4', $_id], + ); + + if ($questLoot) + $conditions[] = ['qt.RewardMailTemplateId', $questLoot]; + + $questLoot = new QuestList($conditions); + if (!$questLoot->error) + { + $questLoot->addGlobalsToJscript($smarty, GLOBALINFO_SELF | GLOBALINFO_REWARDS); + $data[11] = $questLoot->getListviewData(); + } + + // merge spell_loot with "created by [spell]" + $conditions = ['OR', ['effect1CreateitemId', $_id], ['effect2CreateitemId', $_id], ['effect3CreateitemId', $_id]]; + if ($spellLoot) + $conditions[] = ['id', $spellLoot]; + + $spellLoot = new SpellList($conditions); + if (!$spellLoot->error) + { + $spellLoot->addGlobalsToJscript($smarty, GLOBALINFO_SELF | GLOBALINFO_REWARDS); + $spellData = $spellLoot->getListviewData(); + + if (!empty($sources[LOOT_SPELL])) + $sourceTabs[17][3][] = 'Listview.extraCols.percent'; + + foreach ($spellLoot->iterate() as $_) + { + if (!empty($sources[LOOT_SPELL][$spellLoot->id])) + $data[17][] = array_merge($spellData[$spellLoot->id], $sources[LOOT_SPELL][$spellLoot->id]); + else + $data[17][] = array_merge($spellData[$spellLoot->id], ['percent' => -1]); + } + } + foreach ($sourceTabs as $k => $tab) { if (empty($data[$k])) @@ -474,87 +500,223 @@ if (!$smarty->loadCache($cacheKeyPage, $item)) 'file' => $tab[0], 'data' => $data[$k], 'params' => [ - 'tabs' => '$tabsRelated', - 'name' => $tab[1], - 'id' => $tab[2], - 'extraCols' => $tab[3] ? '$['.implode(', ', array_unique($tab[3])).']' : null, - 'hiddenCols' => $tab[4] ? '$['.implode(', ', array_unique($tab[4])).']' : null + 'tabs' => '$tabsRelated', + 'name' => $tab[1], + 'id' => $tab[2], + 'extraCols' => $tab[3] ? '$['.implode(', ', array_unique($tab[3])).']' : null, + 'hiddenCols' => $tab[4] ? '$['.implode(', ', array_unique($tab[4])).']' : null, + 'visibleCols' => $tab[5] ? '$'.json_encode($tab[5]) : null ] ); } - /* this item contains.. */ - + // tabs: this item contains $sourceFor = array( - [LOOT_ITEM, $item->id, '$LANG.tab_contains', 'contains', ['Listview.extraCols.percent'], [] ], - [LOOT_PROSPECTING, $item->id, '$LANG.tab_prospecting', 'prospecting', ['Listview.extraCols.percent'], ['side', 'slot', 'reqlevel']], - [LOOT_MILLING, $item->id, '$LANG.tab_milling', 'milling', ['Listview.extraCols.percent'], ['side', 'slot', 'reqlevel']], - [LOOT_DISENCHANT, $item->getField('disenchantId'), '$LANG.tab_disenchanting', 'disenchanting', ['Listview.extraCols.percent'], ['side', 'slot', 'reqlevel']] + [LOOT_ITEM, $item->id, '$LANG.tab_contains', 'contains', ['Listview.extraCols.percent'], [] , []], + [LOOT_PROSPECTING, $item->id, '$LANG.tab_prospecting', 'prospecting', ['Listview.extraCols.percent'], ['side', 'slot', 'reqlevel'], []], + [LOOT_MILLING, $item->id, '$LANG.tab_milling', 'milling', ['Listview.extraCols.percent'], ['side', 'slot', 'reqlevel'], []], + [LOOT_DISENCHANT, $item->getField('disenchantId'), '$LANG.tab_disenchanting', 'disenchanting', ['Listview.extraCols.percent'], ['side', 'slot', 'reqlevel'], []] ); foreach ($sourceFor as $sf) { - $itemLoot = Util::handleLoot($sf[0], $sf[1], $smarty, User::isInGroup(U_GROUP_STAFF)); + $itemLoot = Util::handleLoot($sf[0], $sf[1], User::isInGroup(U_GROUP_STAFF), $sf[4]); if ($itemLoot) { - if (User::isInGroup(U_GROUP_STAFF)) - { - $sf[4][] = "Listview.funcBox.createSimpleCol('group', 'Group', '10%', 'group')"; - $sf[4][] = "Listview.funcBox.createSimpleCol('mode', 'Mode', '10%', 'mode')"; - $sf[4][] = "Listview.funcBox.createSimpleCol('reference', 'Reference', '10%', 'reference')"; - } - $pageData['relTabs'][] = array( 'file' => 'item', 'data' => $itemLoot, 'params' => [ - 'tabs' => '$tabsRelated', - 'name' => $sf[2], - 'id' => $sf[3], - 'extraCols' => $sf[4] ? "$[".implode(', ', $sf[4])."]" : null, - 'hiddenCols' => $sf[5] ? "$".json_encode($sf[5]) : null + 'tabs' => '$tabsRelated', + 'name' => $sf[2], + 'id' => $sf[3], + 'extraCols' => $sf[4] ? "$[".implode(', ', $sf[4])."]" : null, + 'hiddenCols' => $sf[5] ? "$".json_encode($sf[5]) : null, + 'visibleCols' => $sf[6] ? '$'.json_encode($sf[6]) : null ] ); } } + // tab: container can contain + if ($item->getField('slots') > 0) + { + $contains = new ItemList(array(['bagFamily', $_bagFamily, '&'], ['slots', 1, '<'], 0)); + if (!$contains->error) + { + $contains->addGlobalsToJscript($smarty); + + $hCols = ['side']; + if (!$contains->hasSetFields(['slot'])) + $hCols[] = 'slot'; + + $pageData['relTabs'][] = array( + 'file' => 'item', + 'data' => $contains->getListviewData(), + 'params' => [ + 'tabs' => '$tabsRelated', + 'name' => '$LANG.tab_cancontain', + 'id' => 'can-contain', + 'hiddenCols' => '$'.json_encode($hCols) + ] + ); + } + } + // tab: can be contained in (except keys) + else if ($_bagFamily != 0x0100) + { + $contains = new ItemList(array(['bagFamily', $_bagFamily, '&'], ['slots', 0, '>'], 0)); + if (!$contains->error) + { + $contains->addGlobalsToJscript($smarty); + + $pageData['relTabs'][] = array( + 'file' => 'item', + 'data' => $contains->getListviewData(), + 'params' => [ + 'tabs' => '$tabsRelated', + 'name' => '$LANG.tab_canbeplacedin', + 'id' => 'can-be-placed-in', + 'hiddenCols' => "$['side']" + ] + ); + } + } + + // tab: criteria of + $conditions = array( + ['ac.type', [ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM, ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM, ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM]], + ['ac.value1', $_id] + ); + + $criteriaOf = new AchievementList($conditions); + if (!$criteriaOf->error) + { + $criteriaOf->addGlobalsToJscript($smarty, GLOBALINFO_SELF | GLOBALINFO_REWARDS); + + $hCols = []; + if (!$criteriaOf->hasSetFields(['rewardIds'])) + $hCols = ['rewards']; + + $pageData['relTabs'][] = array( + 'file' => 'achievement', + 'data' => $criteriaOf->getListviewData(), + 'params' => [ + 'tabs' => '$tabsRelated', + 'name' => '$LANG.tab_criteriaof', + 'id' => 'criteria-of', + 'visibleCols' => "$['category']", + 'hiddenCols' => '$'.json_encode($hCols) + ] + ); + } + + // tab: reagent for + $conditions = array( + 'OR', + ['reagent1', $_id], ['reagent2', $_id], ['reagent3', $_id], ['reagent4', $_id], + ['reagent5', $_id], ['reagent6', $_id], ['reagent7', $_id], ['reagent8', $_id] + ); + + $reagent = new SpellList($conditions); + if (!$reagent->error) + { + $reagent->addGlobalsToJscript($smarty, GLOBALINFO_SELF | GLOBALINFO_RELATED); + + $pageData['relTabs'][] = array( + 'file' => 'spell', + 'data' => $reagent->getListviewData(), + 'params' => [ + 'tabs' => '$tabsRelated', + 'name' => '$LANG.tab_reagentfor', + 'id' => 'reagent-for', + 'visibleCols' => "$['reagents']" + ] + ); + } + + // tab: unlocks (object or item) + $lockIds = DB::Aowow()->selectCol( + 'SELECT id FROM ?_lock WHERE + (type1 = 1 AND properties1 = ?d) OR + (type2 = 1 AND properties2 = ?d) OR + (type3 = 1 AND properties3 = ?d) OR + (type4 = 1 AND properties4 = ?d) OR + (type5 = 1 AND properties5 = ?d)', + $_id, $_id, $_id, $_id, $_id + ); + + if ($lockIds) + { + // objects + $conditions = array( + 'OR', + ['AND', ['data0', $lockIds], ['type', [OBJECT_QUESTGIVER, OBJECT_CHEST, OBJECT_TRAP, OBJECT_GOOBER, OBJECT_CAMERA, OBJECT_FLAGSTAND, OBJECT_FLAGDROP]]], + ['AND', ['data1', $lockIds], ['type', [OBJECT_DOOR, OBJECT_BUTTON]]] + ); + + $lockedObj = new GameObjectList($conditions); + if (!$lockedObj->error) + { + $pageData['relTabs'][] = array( + 'file' => 'object', + 'data' => $lockedObj->getListviewData(), + 'params' => [ + 'tabs' => '$tabsRelated', + 'name' => '$LANG.tab_unlocks', + 'id' => 'unlocks-object' + ] + ); + } + + // items (generally unused. It's the spell on the item, that unlocks stuff) + $lockedItm = new ItemList(array(['lockId', $lockIds])); + if (!$lockedItm->error) + { + $lockedItm->addGlobalsToJscript($smarty, GLOBALINFO_SELF); + + $pageData['relTabs'][] = array( + 'file' => 'item', + 'data' => $lockedItm->getListviewData(), + 'params' => [ + 'tabs' => '$tabsRelated', + 'name' => '$LANG.tab_unlocks', + 'id' => 'unlocks-item' + ] + ); + } + } + + // tab: see also + $saItems = new ItemList(array(['id', $_id, '!'], ['name_loc'.User::$localeId, $item->getField('name', true)])); + if (!$saItems->error) + { + $saItems->addGlobalsToJscript($smarty, GLOBALINFO_SELF); + + $pageData['relTabs'][] = array( + 'file' => 'item', + 'data' => $saItems->getListviewData(), + 'params' => [ + 'tabs' => '$tabsRelated', + 'name' => '$LANG.tab_seealso', + 'id' => 'see-also' + ] + ); + } + // sold by [consult itemExtendedCost] // Objective of (quest) // provided for (quest) - // can be placed in - // if($item['BagFamily'] == 256) - // { - // // Если это ключ - // $item['key'] = true; - // } - - // reagent for - // currency for - // criteria of - // array(ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM, ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM, ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM), - // teaches // Same model as - // unlocks - // $locks_row = $DB->selectCol(' - // SELECT lockID - // FROM ?_lock - // WHERE - // (type1=1 AND lockproperties1=?d) OR - // (type2=1 AND lockproperties2=?d) OR - // (type3=1 AND lockproperties3=?d) OR - // (type4=1 AND lockproperties4=?d) OR - // (type5=1 AND lockproperties5=?d) - // ', - // $item['entry'], $item['entry'], $item['entry'], $item['entry'], $item['entry'] - // ); + // Shared cooldown $smarty->saveCache($cacheKeyPage, $pageData); } diff --git a/pages/npc.php b/pages/npc.php index 079f5603..7baf7e9f 100644 --- a/pages/npc.php +++ b/pages/npc.php @@ -22,13 +22,13 @@ if (isset($_GET['power'])) { $npc = new CreatureList(array(['ct.id', $_id])); if ($npc->error) - die('$WowheadPower.registerNpc(\''.$_id.'\', '.User::$localeId.', {})'); + die('$WowheadPower.registerNpc('.$_id.', '.User::$localeId.', {})'); $s = $npc->getSpawns(true); - $x = '$WowheadPower.registerNpc('.$_id.', '.User::$localeId.", {\n"; + $x = '$WowheadPower.registerNpc('.$_id.', '.User::$localeId.", {\n"; $x .= "\tname_".User::$localeString.": '".Util::jsEscape($npc->getField('name', true))."',\n"; - $x .= "\ttooltip_".User::$localeString.': \''.Util::jsEscape($npc->renderTooltip())."',\n"; + $x .= "\ttooltip_".User::$localeString.": '".Util::jsEscape($npc->renderTooltip())."',\n"; // $x .= "\tmap: ".($s ? '{zone: '.$s[0].', coords: {0:'.json_encode($s[1], JSON_NUMERIC_CHECK).'}' : '{}')."\n"; $x .= "});"; diff --git a/pages/object.php b/pages/object.php new file mode 100644 index 00000000..3f195f01 --- /dev/null +++ b/pages/object.php @@ -0,0 +1,113 @@ +loadCache($cacheKeyTooltip, $x)) + { + $object = new GameObjectList(array(['entry', $_id])); + if ($object->error) + die('$WowheadPower.registerObject('.$_id.', '.User::$localeId.', {});'); + + $s = $object->getSpawns(true); + + $x = '$WowheadPower.registerObject('.$_id.', '.User::$localeId.", {\n"; + $x .= "\tname_".User::$localeString.": '".Util::jsEscape($object->getField('name', true))."',\n"; + $x .= "\ttooltip_".User::$localeString.": '".Util::jsEscape($object->renderTooltip())."'\n"; + // $x .= "\tmap: ".($s ? '{zone: '.$s[0].', coords: {0:'.json_encode($s[1], JSON_NUMERIC_CHECK).'}' : '{}')."\n"; + $x .= "});"; + + $smarty->saveCache($cacheKeyTooltip, $x); + } + + die($x); +} + +// regular page +if (!$smarty->loadCache($cacheKeyPage, $pageData)) +{ + $object = new GameObjectList(array(['entry', $_id])); + if ($object->error) + $smarty->notFound(Lang::$game['gameObject']); + +/* + ListView for fishing holes + + id:'fished-in', + hiddenCols:['instancetype', 'level', 'territory', 'category'], + extraCols:[{if $percent}Listview.extraCols.percent{/if}], + sort:['-percent', 'name'], + +*/ + + // NYI -> die() + $smarty->error(); + + + + // path(0, 5, $object['type']), + + // $object['starts'] = array(); + // $object['ends'] = array(); + // array(ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT, ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT), + // $object['criteria_of'] = array(); + // object contains [..] + + $object['position'] = position($object['entry'], 'gameobject'); + // Исправить type, чтобы подсвечивались event-овые объекты + if ($object['position']) + foreach ($object['position'] as $z => $zone) + foreach ($zone['points'] as $p => $pos) + if ($pos['type'] == 0 && ($events = event_find(array('object_guid' => $pos['guid'])))) + { + $names = arraySelectKey(event_name($events), 'name'); + $object['position'][$z]['points'][$p]['type'] = 4; + $object['position'][$z]['points'][$p]['events'] = implode(", ", $names); + } + + + $smarty->saveCache($cacheKeyPage, $pageData); +} + + +// menuId 5: Object g_initPath() +// tabId 0: Database g_initHeader() +$smarty->updatePageVars(array( + 'title' => $pageData['title'].' - '.Util::ucFirst(Lang::$game['gameObject']), + 'path' => $pageData['path'], + 'tab' => 0, + 'type' => TYPE_OBJECT, + 'typeId' => $_id, + 'reqCSS' => array( + $object['pageText'] ? ['path' => 'template/css/Book.css'] : null, + ['path' => 'template/css/Mapper.css'], + ['path' => 'template/css/Mapper_ie6.css', 'ieCond' => 'lte IE 6'] + ), + 'reqJS' => array( + $object['pageText'] ? 'template/js/Book.js' : null, + 'template/js/Mapper.js' + ) +)); +$smarty->assign('community', CommunityContent::getAll(TYPE_OBJECT, $_id)); // comments, screenshots, videos +$smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$object, ['colon' => Lang::$colon])); +$smarty->assign('lvData', $pageData); + +// load the page +$smarty->display('object.tpl'); + +?> diff --git a/pages/objects.php b/pages/objects.php new file mode 100644 index 00000000..3cb2e5fa --- /dev/null +++ b/pages/objects.php @@ -0,0 +1,81 @@ +error(); + +if (isset($cat)) +{ + $path[] = $cat; // should be only one parameter anyway + // array_unshift($title, Lang::$object['cat'][$cat]); +} + +if (!$smarty->loadCache($cacheKey, $pageData)) +{ + $pageData = array( + 'listviews' => [] + ); + + $conditions = []; + + if ($cat == -3) + { + $conditions[] = ['type', 3]; + $conditions[] = ['l.properties1', LOCK_PROPERTY_HERBALISM]; + } + else if ($cat == -4) + { + $conditions[] = ['type', 3]; + $conditions[] = ['l.properties1', LOCK_PROPERTY_MINING]; + } + else if ($cat == -5) + { + $conditions[] = ['type', 3]; + $conditions[] = ['l.properties2', LOCK_PROPERTY_FOOTLOCKER]; + } + else + $conditions[] = ['type', (int)$cat]; // quest not supported + + $objects = new GameObjectList($conditions); + + $params = []; + if ($objects->hasSetFields(['reqSkill'])) + $params['visibleCols'] = "$['skill']"; + + $pageData['listviews'][] = array( + 'file' => 'object', + 'data' => $objects->getListviewData(), + 'params' => $params + ); + + + + $objects->addGlobalsToJscript($smarty); + + $smarty->saveCache($cacheKey, $pageData); +} + +// menuId 5: Object g_initPath() +// tabId 0: Database g_initHeader() +$smarty->updatePageVars(array( + 'tab' => 0, + 'title' => implode(" - ", $title), + 'path' => "[".implode(", ", $path)."]" +)); +$smarty->assign('lang', Lang::$main); +$smarty->assign('lvData', $pageData); + +// load the page +// $smarty->display('objects.tpl'); +$smarty->display('generic-no-filter.tpl'); + +?> diff --git a/pages/pets.php b/pages/pets.php index b5b7feee..fbce77df 100644 --- a/pages/pets.php +++ b/pages/pets.php @@ -10,7 +10,7 @@ $validCats = [0, 1, 2]; $title = [Util::ucFirst(Lang::$game['pets'])]; $cacheKey = implode('_', [CACHETYPE_PAGE, TYPE_PET, -1, isset($cat) ? $cat : -1, User::$localeId]); -if (!in_array($cat, $validCats)) +if (!Util::isValidPage($validCats, $cat)) $smarty->error(); $path[] = $cat; // should be only one parameter anyway diff --git a/pages/spell.php b/pages/spell.php index f8665b7a..51a57612 100644 --- a/pages/spell.php +++ b/pages/spell.php @@ -1180,19 +1180,11 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) // tab: contains // spell_loot_template & skill_extra_item_template $extraItem = DB::Aowow()->selectRow('SELECT * FROM skill_extra_item_template WHERE spellid = ?d', $spell->id); - $spellLoot = Util::handleLoot(LOOT_SPELL, $spell->id, $smarty, User::isInGroup(U_GROUP_STAFF)); + $spellLoot = Util::handleLoot(LOOT_SPELL, $spell->id, User::isInGroup(U_GROUP_STAFF), $extraCols); if ($extraItem || $spellLoot) { - $extraCols = ['Listview.extraCols.percent']; - - if ($spellLoot && User::isInGroup(U_GROUP_STAFF)) - { - $extraCols[] = "Listview.funcBox.createSimpleCol('group', 'Group', '10%', 'group')"; - $extraCols[] = "Listview.funcBox.createSimpleCol('mode', 'Mode', '10%', 'mode')"; - $extraCols[] = "Listview.funcBox.createSimpleCol('reference', 'Reference', '10%', 'reference')"; - } - + $extraCols[] = 'Listview.extraCols.percent'; $lv = $spellLoot; if ($extraItem && $spell->canCreateItem()) diff --git a/search.php b/search.php index d2404cf2..42ed7df8 100644 --- a/search.php +++ b/search.php @@ -38,7 +38,7 @@ if (!defined('AOWOW_REVISION')) 17: Listview - template: 'achievement', id: 'achievements', name: LANG.tab_achievements, 18: Listview - template: 'achievement', id: 'statistics', name: LANG.tab_statistics, 19: Listview - template: 'zone', id: 'zones', name: LANG.tab_zones, -todo 20: Listview - template: 'object', id: 'objects', name: LANG.tab_objects, + 20: Listview - template: 'object', id: 'objects', name: LANG.tab_objects, todo 21: Listview - template: 'faction', id: 'factions', name: LANG.tab_factions, 22: Listview - template: 'skill', id: 'skills', name: LANG.tab_skills, 23: Listview - template: 'pet', id: 'pets', name: LANG.tab_pets, @@ -835,7 +835,7 @@ if ($searchMask & 0x40000) 'file' => 'zone', 'data' => $data, 'params' => [ - 'tabs' => '$myTabs', + 'tabs' => '$myTabs' ] ); @@ -848,7 +848,37 @@ if ($searchMask & 0x40000) } // 20 Objects -// if ($searchMask & 0x80000) +if ($searchMask & 0x80000) +{ + $conditions = array( + ['name'.(User::$localeId ? '_loc'.User::$localeId : null), $query], + $maxResults + ); + + $objects = new GameObjectList($conditions); + + if ($data = $objects->getListviewData()) + { + $objects->addGlobalsToJScript($smarty); + + $found['zone'] = array( + 'type' => TYPE_OBJECT, + 'appendix' => ' (Object)', + 'matches' => $objects->getMatches(), + 'file' => 'object', + 'data' => $data, + 'params' => [ + 'tabs' => '$myTabs' + ] + ); + + if ($objects->getMatches() > $maxResults) + { + $found['zone']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_objectsfound', $objects->getMatches(), $maxResults); + $found['zone']['params']['_truncated'] = 1; + } + } +} // 21 Factions // if ($searchMask & 0x100000) @@ -869,7 +899,9 @@ if ($searchMask & 0x200000) 'matches' => $skills->getMatches(), 'file' => 'skill', 'data' => $data, - 'params' => ['tabs' => '$myTabs'] + 'params' => [ + 'tabs' => '$myTabs' + ] ); if ($skills->getMatches() > $maxResults) diff --git a/template/bricks/listviews/object.tpl b/template/bricks/listviews/object.tpl new file mode 100644 index 00000000..fb3818bd --- /dev/null +++ b/template/bricks/listviews/object.tpl @@ -0,0 +1,29 @@ +{strip} + new Listview({ldelim} + template:'object', + {if !isset($params.id)}id:'objects',{/if} + {if !isset($params.name)}name:LANG.tab_objects,{/if} + {if !isset($params.parent)}parent:'lv-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} + {foreach from=$curr key='name' item=val} + {if $name != 'id' && $name != 'name'} + {$name}:{$val|@json_encode:$smarty.const.JSON_NUMERIC_CHECK}, + {/if} + {/foreach} + name:'{$curr.name|escape:"quotes"}', + id:{$curr.id} + {rdelim} + {if $smarty.foreach.i.last}{else},{/if} + {/foreach} + ] + {rdelim}); +{/strip} diff --git a/template/js/global.js b/template/js/global.js index 369a1999..c3811a4c 100644 --- a/template/js/global.js +++ b/template/js/global.js @@ -5223,7 +5223,8 @@ Listview.extraCols = { g_addTooltip(td, text); } - var value = parseFloat(row.percent.toFixed(row.percent >= 1.95 ? 0 : (row.percent >= 0.195 ? 1 : 2))); + // var value = parseFloat(row.percent.toFixed(row.percent >= 1.95 ? 0 : (row.percent >= 0.195 ? 1 : 2))); + var value = parseFloat(row.percent.toFixed(row.percent >= 1.95 ? 1 : 2)); // sarjuuk: doesn't look as nice but i prefer accuracy if (row.pctstack) { var sp = $WH.ce('span'); @@ -5241,11 +5242,12 @@ Listview.extraCols = { } if (row.percent >= 1.95) { - return row.percent.toFixed(0); - } - else if (row.percent >= 0.195) { - return parseFloat(row.percent.toFixed(1)); + // return row.percent.toFixed(0); + return row.percent.toFixed(1); } + // else if (row.percent >= 0.195) { + // return parseFloat(row.percent.toFixed(1)); + // } else { return parseFloat(row.percent.toFixed(2)); } diff --git a/template/object.tpl b/template/object.tpl new file mode 100644 index 00000000..68ecb5e8 --- /dev/null +++ b/template/object.tpl @@ -0,0 +1,111 @@ +{include file='header.tpl'} + +
+ +
+
+ + + +{if isset($object.key) or isset($object.lockpicking) or isset($object.mining) or isset($object.herbalism)} + + + +
{#Quick_Facts#}
+
    + {if isset($object.key)}
  • {#Key#}{$lang.colon}[{$object.key.name}]
  • {/if} + {if isset($object.lockpicking)}
  • {#Lockpickable#} ({$object.lockpicking})
  • {/if} + {if isset($object.mining)}
  • {#Mining#} ({$object.mining})
  • {/if} + {if isset($object.herbalism)}
  • {#Herb#} ({$object.herbalism})
  • {/if} +
+
+{/if} + +
+ + WowheadWowhead +

{$object.name}

+ +{if $object.position} +
{#This_Object_can_be_found_in#} +{strip} + + {foreach from=$object.position item=zone name=zone} + +
',type:'{$point.type}' + {rdelim}] + {if !$smarty.foreach.point.last},{/if} + {/foreach} + ] + {/if} + {rdelim}); + g_setSelectedLink(this, 'mapper'); return false" onmousedown="return false"> + {$zone.name}{if $zone.population > 1} ({$zone.population}){/if}{if $smarty.foreach.zone.last}.{else}, {/if} + {/foreach} +
+{/strip} +
+
+ + + +{else} + {#This_Object_cant_be_found#} +{/if} + +{if isset($object.pagetext)} +

Content

+
+ {strip} + + {/strip} +{/if} + +

{$lang.related}

+
+ +{include file='bricks/tabsRelated.tpl' tabs=$lvData.relTabs} + +{include file='bricks/contribute.tpl'} + +
+ + +{include file='footer.tpl'} diff --git a/template/objects.tpl b/template/objects.tpl new file mode 100644 index 00000000..4cd43664 --- /dev/null +++ b/template/objects.tpl @@ -0,0 +1,20 @@ +{include file='header.tpl'} + +
+
+
+ + +
+ + + +
+
+
+ +{include file='footer.tpl'}