Zone/DetailPage

* fix quests tab not displaying quests from zone
 * only include special quests (QuestSortID set) and quests directly related to zone instead of any quest in tab
 * adjust quest rewards tab accordingly
 * fix breadcrumbs for dungeon quests with sub category
This commit is contained in:
Sarjuuk
2023-06-08 19:45:57 +02:00
parent 6382302a30
commit 837fdf78a0
3 changed files with 64 additions and 23 deletions

View File

@@ -59,6 +59,28 @@ class Game
10 => [ 65, 66, 67, 210, 394, 495, 2817, 3537, 3711, 4024, 4197, 4395, 4742]
);
public static $questSubCats = array(
1 => [132], // Dun Morogh: Coldridge Valley
12 => [9], // Elwynn Forest: Northshire Valley
141 => [188], // Teldrassil: Shadowglen
3524 => [3526], // Azuremyst Isle: Ammen Vale
14 => [363], // Durotar: Valley of Trials
85 => [154], // Tirisfal Glades: Deathknell
215 => [220], // Mulgore: Red Cloud Mesa
3430 => [3431], // Eversong Woods: Sunstrider Isle
46 => [25], // Burning Steppes: Blackrock Mountain
361 => [1769], // Felwood: Timbermaw Hold
3519 => [3679], // Terokkar: Skettis
3535 => [3562, 3713, 3714], // Hellfire Citadel
3905 => [3715, 3716, 3717], // Coilfang Reservoir
3688 => [3789, 3790, 3792], // Auchindoun
1941 => [2366, 2367, 4100], // Caverns of Time
3842 => [3847, 3848, 3849], // Tempest Keep
4522 => [4809, 4813, 4820] // Icecrown Citadel
);
/* why:
Because petSkills (and ranged weapon skills) are the only ones with more than two skillLines attached. Because Left Joining ?_spell with ?_skillLineability causes more trouble than it has uses.
Because this is more or less the only reaonable way to fit all that information into one database field, so..

View File

@@ -20,19 +20,6 @@ class QuestPage extends GenericPage
protected $_get = ['domain' => ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkDomain']];
private $catExtra = array(
3526 => 3524,
363 => 14,
220 => 215,
188 => 141,
1769 => 361,
25 => 46,
132 => 1,
3431 => 3430,
154 => 85,
9 => 12
);
private $powerTpl = '$WowheadPower.registerQuest(%d, %d, %s);';
public function __construct($pageCall, $id)
@@ -57,12 +44,13 @@ class QuestPage extends GenericPage
{
// recreate path
$this->path[] = $this->subject->getField('cat2');
if ($_ = $this->subject->getField('cat1'))
if ($cat = $this->subject->getField('cat1'))
{
if (isset($this->catExtra[$_]))
$this->path[] = $this->catExtra[$_];
foreach (Game::$questSubCats as $parent => $children)
if (in_array($cat, $children))
$this->path[] = $parent;
$this->path[] = $_;
$this->path[] = $cat;
}
}

View File

@@ -183,6 +183,15 @@ class ZonePage extends GenericPage
$questsLV = $rewardsLV = [];
$relQuestZOS = [$this->typeId];
foreach (Game::$questSubCats as $parent => $children)
{
if (in_array($this->typeId, $children))
$relQuestZOS[] = $parent;
else if ($this->typeId == $parent)
$relQuestZOS = array_merge($relQuestZOS, $children);
}
// see if we can actually display a map
$hasMap = file_exists('static/images/wow/maps/'.Util::$localeStrings[User::$localeId].'/normal/'.$this->typeId.'.jpg');
if (!$hasMap) // try multilayered
@@ -256,6 +265,9 @@ class ZonePage extends GenericPage
// store data for misc tabs
foreach ($started->getListviewData() as $id => $data)
{
if ($started->getField('zoneOrSort') > 0 && !in_array($started->getField('zoneOrSort'), $relQuestZOS))
continue;
if (!empty($started->rewards[$id][Type::ITEM]))
$rewardsLV = array_merge($rewardsLV, array_keys($started->rewards[$id][Type::ITEM]));
@@ -353,6 +365,9 @@ class ZonePage extends GenericPage
// store data for misc tabs
foreach ($started->getListviewData() as $id => $data)
{
if ($started->getField('zoneOrSort') > 0 && !in_array($started->getField('zoneOrSort'), $relQuestZOS))
continue;
if (!empty($started->rewards[$id][Type::ITEM]))
$rewardsLV = array_merge($rewardsLV, array_keys($started->rewards[$id][Type::ITEM]));
@@ -527,18 +542,34 @@ class ZonePage extends GenericPage
$this->lvTabs[] = ['object', $tabData];
}
// tab: Quests [data collected by SOM-routine]
$quests = new QuestList(array(['zoneOrSort', $this->typeId]));
if (!$quests->error)
{
$this->extendGlobalData($quests->getJSGlobals());
foreach ($quests->getListviewData() as $id => $data)
{
if (!empty($quests->rewards[$id][Type::ITEM]))
$rewardsLV = array_merge($rewardsLV, array_keys($quests->rewards[$id][Type::ITEM]));
if (!empty($quests->choices[$id][Type::ITEM]))
$rewardsLV = array_merge($rewardsLV, array_keys($quests->choices[$id][Type::ITEM]));
$questsLV[$id] = $data;
}
}
// tab: Quests [including data collected by SOM-routine]
if ($questsLV)
{
$tabData = ['quest', ['data' => array_values($questsLV)]];
foreach (Game::$questClasses as $parent => $children)
{
if (in_array($this->typeId, $children))
{
$tabData[1]['note'] = '$$WH.sprintf(LANG.lvnote_zonequests, '.$parent.', '.$this->typeId.',"'.$this->subject->getField('name', true).'", '.$this->typeId.')';
break;
}
if (!in_array($this->typeId, $children))
continue;
$tabData[1]['note'] = '$$WH.sprintf(LANG.lvnote_zonequests, '.$parent.', '.$this->typeId.',"'.$this->subject->getField('name', true).'", '.$this->typeId.')';
break;
}
$this->lvTabs[] = $tabData;