diff --git a/includes/genericPage.class.php b/includes/genericPage.class.php
index 236eb530..99a5c2e8 100644
--- a/includes/genericPage.class.php
+++ b/includes/genericPage.class.php
@@ -31,6 +31,8 @@ trait ListPage
protected $typeId = 0;
protected $filter = [];
+ private $filterObj = null;
+
protected function generateCacheKey()
{
// mode, type, typeId, employee-flag, localeId,
@@ -40,7 +42,7 @@ trait ListPage
$key[] = $this->category ? implode('.', $this->category) : '-1';
// filter
- $key[] = $this->filter ? md5(serialize($this->filter)) : '-1';
+ $key[] = $this->filterObj ? md5(serialize($this->filterObj)) : '-1';
return implode('_', $key);
}
diff --git a/includes/types/basetype.class.php b/includes/types/basetype.class.php
index bb680cc5..b9a369bd 100644
--- a/includes/types/basetype.class.php
+++ b/includes/types/basetype.class.php
@@ -668,11 +668,15 @@ abstract class Filter
$this->error = true;
}
}
-
- $this->evaluateFilter();
}
}
+ // use to generate cacheKey for filterable pages
+ public function __sleep()
+ {
+ return ['formData'];
+ }
+
public function urlize(array $override = [], array $addCr = [])
{
$_ = [];
@@ -741,6 +745,9 @@ abstract class Filter
public function getConditions()
{
+ if (!$this->cndSet)
+ $this->evaluateFilter();
+
return $this->cndSet;
}
@@ -790,7 +797,7 @@ abstract class Filter
// single cnd?
if (!$qry)
- $this->error = 1;
+ $this->error = true;
else if (count($qry) > 1)
array_unshift($qry, 'OR');
else
diff --git a/includes/utilities.php b/includes/utilities.php
index 92e655ab..06dc07e8 100644
--- a/includes/utilities.php
+++ b/includes/utilities.php
@@ -832,11 +832,11 @@ class Util
else
{
$_ = $s['d'] + $s['h'] / 24;
- if ($_ && !($_ % 364)) // whole years
+ if ($_ > 1 && !($_ % 364)) // whole years
return round(($s['d'] + $s['h'] / 24) / 364, 2)." ".Lang::$timeUnits[$s['d'] / 364 == 1 && !$s['h'] ? 'sg' : 'pl'][0];
- if ($_ && !($_ % 30)) // whole month
+ if ($_ > 1 && !($_ % 30)) // whole month
return round(($s['d'] + $s['h'] / 24) / 30, 2)." ".Lang::$timeUnits[$s['d'] / 30 == 1 && !$s['h'] ? 'sg' : 'pl'][1];
- if ($_ && !($_ % 7)) // whole weeks
+ if ($_ > 1 && !($_ % 7)) // whole weeks
return round(($s['d'] + $s['h'] / 24) / 7, 2)." ".Lang::$timeUnits[$s['d'] / 7 == 1 && !$s['h'] ? 'sg' : 'pl'][2];
if ($s['d'])
return round($s['d'] + $s['h'] / 24, 2)." ".Lang::$timeUnits[$s['d'] == 1 && !$s['h'] ? 'sg' : 'pl'][3];
diff --git a/localization/locale_dede.php b/localization/locale_dede.php
index 4f84e24a..22727d93 100644
--- a/localization/locale_dede.php
+++ b/localization/locale_dede.php
@@ -426,8 +426,75 @@ $lang = array(
83 => "Legendär", 84 => "Eskorte", 85 => "Heroisch", 88 => "Schlachtzug (10)", 89 => "Schlachtzug (25)"
),
'cat' => array(
- // todo: after zones
- )
+ 0 => array( "Östliche Königreiche",
+ 36 => "Alteracgebirge", 45 => "Arathihochland", 46 => "Brennende Steppe", 279 => "Dalarankrater", 25 => "Der Schwarzfels",
+ 2257 => "Die Tiefenbahn", 1 => "Dun Morogh", 10 => "Dämmerwald", 1537 => "Eisenschmiede", 41 => "Gebirgspass der Totenwinde",
+ 3433 => "Geisterlande", 47 => "Hinterland", 3430 => "Immersangwald", 4080 => "Insel von Quel'Danas", 38 => "Loch Modan",
+ 4298 => "Pestländer: Die Scharlachrote Enklave", 44 => "Rotkammgebirge", 33 => "Schlingendorntal", 51 => "Sengende Schlucht", 3487 => "Silbermond",
+ 130 => "Silberwald", 1519 => "Sturmwind", 11 => "Sumpfland", 8 => "Sümpfe des Elends", 85 => "Tirisfal",
+ 1497 => "Unterstadt", 4 => "Verwüstete Lande", 267 => "Vorgebirge des Hügellands", 12 => "Wald von Elwynn", 40 => "Westfall",
+ 28 => "Westliche Pestländer", 3 => "Ödland", 139 => "Östliche Pestländer"
+ ),
+ 1 => array( "Kalimdor",
+ 16 => "Azshara", 3524 => "Azurmythosinsel", 3525 => "Blutmythosinsel", 17 => "Brachland", 1657 => "Darnassus",
+ 405 => "Desolace", 3557 => "Die Exodar", 1638 => "Donnerfels", 148 => "Dunkelküste", 14 => "Durotar",
+ 15 => "Düstermarschen", 331 => "Eschental", 357 => "Feralas", 1216 => "Holzschlundfeste", 490 => "Krater von Un'Goro",
+ 493 => "Mondlichtung", 215 => "Mulgore", 1637 => "Orgrimmar", 1377 => "Silithus", 406 => "Steinkrallengebirge",
+ 440 => "Tanaris", 400 => "Tausend Nadeln", 141 => "Teldrassil", 361 => "Teufelswald", 618 => "Winterquell"
+ ),
+ 8 => array( "Scherbenwelt",
+ 3483 => "Höllenfeuerhalbinsel", 3518 => "Nagrand", 3523 => "Nethersturm", 3520 => "Schattenmondtal", 3522 => "Schergrat",
+ 3703 => "Shattrath", 3679 => "Skettis", 3519 => "Wälder von Terokkar", 3521 => "Zangarmarschen"
+ ),
+ 10 => array( "Nordend",
+ 3537 => "Boreanische Tundra", 4395 => "Dalaran", 495 => "Der heulende Fjord", 4742 => "Hrothgar's Landeplatz", 67 => "Die Sturmgipfel",
+ 65 => "Drachenöde", 210 => "Eiskrone", 394 => "Grizzlyhügel", 4024 => "Kaltarra", 3711 => "Sholazarbecken",
+ 4197 => "Tausendwintersee", 66 => "Zul'Drak"
+ ),
+ 2 => array( "Dungeons",
+ 4494 => "Ahn'kahet: Das Alte Königreich", 3790 => "Auchenaikrypta", 4277 => "Azjol-Nerub", 209 => "Burg Schattenfang", 206 => "Burg Utgarde",
+ 4100 => "Das Ausmerzen von Stratholme", 4228 => "Das Oculus", 796 => "Das Scharlachrote Kloster", 717 => "Das Verlies", 3713 => "Der Blutkessel",
+ 3905 => "Der Echsenkessel", 2437 => "Der Flammenschlund", 4120 => "Der Nexus", 3716 => "Der Tiefensumpf", 2366 => "Der schwarze Morast",
+ 3848 => "Die Arkatraz", 3847 => "Die Botanika", 3715 => "Die Dampfkammer", 4272 => "Die Hallen der Blitze", 4264 => "Die Hallen des Steins",
+ 718 => "Die Höhlen des Wehklagens", 3849 => "Die Mechanar", 4809 => "Die Seelenschmiede", 3717 => "Die Sklavenunterkünfte", 1581 => "Die Todesminen",
+ 4415 => "Die Violette Festung", 3714 => "Die zerschmetterten Hallen", 2557 => "Düsterbruch", 4196 => "Feste Drak'Tharon", 3845 => "Festung der Stürme",
+ 721 => "Gnomeregan", 4813 => "Grube von Saron", 4416 => "Gundrak", 4820 => "Hallen der Reflexion", 1941 => "Höhlen der Zeit",
+ 3562 => "Höllenfeuerbollwerk", 3535 => "Höllenfeuerzitadelle", 722 => "Hügel der Klingenhauer", 491 => "Kral der Klingenhauer", 3792 => "Managruft",
+ 2100 => "Maraudon", 4723 => "Prüfung des Champions", 3789 => "Schattenlabyrinth", 2057 => "Scholomance", 1583 => "Schwarzfelsspitze",
+ 1584 => "Schwarzfelstiefen", 3791 => "Sethekkhallen", 2017 => "Stratholme", 4131 => "Terrasse der Magister", 719 => "Tiefschwarze Grotte",
+ 1196 => "Turm Utgarde", 1337 => "Uldaman", 1477 => "Versunkener Tempel", 2367 => "Vorgebirge des Alten Hügellands", 1176 => "Zul'Farrak"
+ ),
+ 3 => array( "Schlachtzüge",
+ 4603 => "Archavon's Kammer", 3842 => "Das Auge", 4500 => "Das Auge der Ewigkeit", 4493 => "Das Obsidiansanktum", 3959 => "Der Schwarze Tempel",
+ 4812 => "Eiskronenzitadelle", 2717 => "Geschmolzener Kern", 3923 => "Gruul's Unterschlupf", 3607 => "Höhle des Schlangenschreins", 3606 => "Hyjalgipfel",
+ 3457 => "Karazhan", 3836 => "Magtheridons Kammer", 3456 => "Naxxramas", 2159 => "Onyxias Hort", 2677 => "Pechschwingenhort",
+ 4722 => "Prüfung des Kreuzfahrers", 3429 => "Ruinen von Ahn'Qiraj", 4075 => "Sonnenbrunnenplateau", 3428 => "Tempel von Ahn'Qiraj", 4273 => "Ulduar",
+ 3805 => "Zul'Aman", 1977 => "Zul'Gurub"
+ ),
+ 4 => array( "Klassen",
+ -263 => "Druide", -61 => "Hexenmeister", -261 => "Jäger", -81 => "Krieger", -161 => "Magier",
+ -141 => "Paladin", -262 => "Priester", -82 => "Schamane", -162 => "Schurke", -372 => "Todesritter"
+ ),
+ 5 => array( "Berufe",
+ -181 => "Alchemie", -101 => "Angeln", -324 => "Erste Hilfe", -201 => "Ingenieurskunst", -371 => "Inschriftenkunde",
+ -373 => "Juwelenschleifen", -304 => "Kochkunst", -24 => "Kräuterkunde", -182 => "Lederverarbeitung", -121 => "Schmiedekunst",
+ -264 => "Schneiderei"
+ ),
+ 6 => array( "Schlachtfelder",
+ 2597 => "Alteractal", 3358 => "Arathibecken", 3820 => "Auge des Sturms", 4710 => "Insel der Eroberung", 3277 => "Kriegshymnenschlucht",
+ -25 => "Schlachtfelder", 4384 => "Strand der Uralten"
+ ),
+ 9 => array( "Weltereignisse",
+ -370 => "Braufest", -1002 => "Kinderwoche", -364 => "Dunkelmond-Jahrmarkt", -41 => "Tag der Toten", -1003 => "Schlotternächte",
+ -1005 => "Erntedankfest", -376 => "Liebe liegt in der Luft", -366 => "Mondfest", -369 => "Sonnenwende", -1006 => "Neujahr",
+ -375 => "Die Pilgerfreuden", -374 => "Nobelgarten", -1001 => "Winterhauch"
+ ),
+ 7 => array( "Verschiedenes",
+ -365 => "Krieg von Ahn'Qiraj", -1010 => "Dungeonfinder", -1 => "Episch", -344 => "Legendär", -367 => "Ruf",
+ -368 => "Invasion der Geißel", -241 => "Turnier"
+ ),
+ -2 => "Nicht kategorisiert"
+ )
),
'title' => array(
'cat' => array(
diff --git a/localization/locale_enus.php b/localization/locale_enus.php
index 221533b4..b18c3c98 100644
--- a/localization/locale_enus.php
+++ b/localization/locale_enus.php
@@ -413,7 +413,74 @@ $lang = array(
83 => "Legendary", 84 => "Escort", 85 => "Heroic", 88 => "Raid (10)", 89 => "Raid (25)"
),
'cat' => array(
- // todo: after zones
+ 0 => array( "Eastern Kingdoms",
+ 36 => "Alterac Mountains", 45 => "Arathi Highlands", 3 => "Badlands", 25 => "Blackrock Mountain", 4 => "Blasted Lands",
+ 46 => "Burning Steppes", 279 => "Dalaran Crater", 41 => "Deadwind Pass", 2257 => "Deeprun Tram", 1 => "Dun Morogh",
+ 10 => "Duskwood", 139 => "Eastern Plaguelands", 12 => "Elwynn Forest", 3430 => "Eversong Woods", 3433 => "Ghostlands",
+ 267 => "Hillsbrad Foothills", 1537 => "Ironforge", 4080 => "Isle of Quel'Danas", 38 => "Loch Modan", 44 => "Redridge Mountains",
+ 51 => "Searing Gorge", 3487 => "Silvermoon City", 130 => "Silverpine Forest", 1519 => "Stormwind City", 33 => "Stranglethorn Vale",
+ 8 => "Swamp of Sorrows", 47 => "The Hinterlands", 4298 => "The Scarlet Enclave", 85 => "Tirisfal Glades", 1497 => "Undercity",
+ 28 => "Western Plaguelands", 40 => "Westfall", 11 => "Wetlands"
+ ),
+ 1 => array( "Kalimdor",
+ 331 => "Ashenvale", 16 => "Azshara", 3524 => "Azuremyst Isle", 3525 => "Bloodmyst Isle", 148 => "Darkshore",
+ 1657 => "Darnassus", 405 => "Desolace", 14 => "Durotar", 15 => "Dustwallow Marsh", 361 => "Felwood",
+ 357 => "Feralas", 493 => "Moonglade", 215 => "Mulgore", 1637 => "Orgrimmar", 1377 => "Silithus",
+ 406 => "Stonetalon Mountains", 440 => "Tanaris", 141 => "Teldrassil", 17 => "The Barrens", 3557 => "The Exodar",
+ 457 => "The Veiled Sea", 400 => "Thousand Needles", 1638 => "Thunder Bluff", 490 => "Un'Goro Crater", 618 => "Winterspring"
+ ),
+ 8 => array( "Outland",
+ 3522 => "Blade's Edge Mountains", 3483 => "Hellfire Peninsula", 3518 => "Nagrand", 3523 => "Netherstorm", 3520 => "Shadowmoon Valley",
+ 703 => "Shattrath City", 3679 => "Skettis", 3519 => "Terokkar Forest", 3521 => "Zangarmarsh"
+ ),
+ 10 => array( "Northrend",
+ 3537 => "Borean Tundra", 2817 => "Crystalsong Forest", 4395 => "Dalaran", 65 => "Dragonblight", 394 => "Grizzly Hills",
+ 495 => "Howling Fjord", 4742 => "Hrothgar's Landing", 210 => "Icecrown", 3711 => "Sholazar Basin", 67 => "The Storm Peaks",
+ 4197 => "Wintergrasp", 66 => "Zul'Drak"
+ ),
+ 2 => array( "Dungeons",
+ 4494 => "Ahn'kahet: The Old Kingdom", 3790 => "Auchenai Crypts", 4277 => "Azjol-Nerub", 719 => "Blackfathom Deeps", 1584 => "Blackrock Depths",
+ 1583 => "Blackrock Spire", 1941 => "Caverns of Time", 3905 => "Coilfang Reservoir", 2557 => "Dire Maul", 4196 => "Drak'Tharon Keep",
+ 721 => "Gnomeregan", 4416 => "Gundrak", 4272 => "Halls of Lightning", 4820 => "Halls of Reflection", 4264 => "Halls of Stone",
+ 3562 => "Hellfire Ramparts", 3535 => "Hellfire Citadel", 4131 => "Magisters' Terrace", 3792 => "Mana-Tombs", 2100 => "Maraudon",
+ 2367 => "Old Hillsbrad Foothills", 4813 => "Pit of Saron", 2437 => "Ragefire Chasm", 722 => "Razorfen Downs", 491 => "Razorfen Kraul",
+ 796 => "Scarlet Monastery", 2057 => "Scholomance", 3791 => "Sethekk Halls", 3789 => "Shadow Labyrinth", 209 => "Shadowfang Keep",
+ 2017 => "Stratholme", 1477 => "Sunken Temple", 3845 => "Tempest Keep", 3848 => "The Arcatraz", 2366 => "The Black Morass",
+ 3713 => "The Blood Furnace", 3847 => "The Botanica", 4100 => "The Culling of Stratholme", 1581 => "The Deadmines", 4809 => "The Forge of Souls",
+ 3849 => "The Mechanar", 4120 => "The Nexus", 4228 => "The Oculus", 3714 => "The Shattered Halls", 3717 => "The Slave Pens",
+ 3715 => "The Steamvault", 717 => "The Stockade", 3716 => "The Underbog", 4415 => "The Violet Hold", 4723 => "Trial of the Champion",
+ 1337 => "Uldaman", 206 => "Utgarde Keep", 1196 => "Utgarde Pinnacle", 718 => "Wailing Caverns", 1176 => "Zul'Farrak"
+ ),
+ 3 => array( "Raids",
+ 3959 => "Black Temple", 2677 => "Blackwing Lair", 3923 => "Gruul's Lair", 3606 => "Hyjal Summit", 4812 => "Icecrown Citadel",
+ 3457 => "Karazhan", 3836 => "Magtheridon's Lair", 2717 => "Molten Core", 3456 => "Naxxramas", 2159 => "Onyxia's Lair",
+ 3429 => "Ruins of Ahn'Qiraj", 3607 => "Serpentshrine Cavern", 4075 => "Sunwell Plateau", 3428 => "Temple of Ahn'Qiraj", 3842 => "The Eye",
+ 4500 => "The Eye of Eternity", 4493 => "The Obsidian Sanctum", 4722 => "Trial of the Crusader", 4273 => "Ulduar", 4603 => "Vault of Archavon",
+ 3805 => "Zul'Aman", 1977 => "Zul'Gurub"
+ ),
+ 4 => array( "Classes",
+ -372 => "Death Knight", -263 => "Druid", -261 => "Hunter", -161 => "Mage", -141 => "Paladin",
+ -262 => "Priest", -162 => "Rogue", -82 => "Shaman", -61 => "Warlock", -81 => "Warrior"
+ ),
+ 5 => array( "Professions",
+ -181 => "Alchemy", -121 => "Blacksmithing", -304 => "Cooking", -201 => "Engineering", -324 => "First Aid",
+ -101 => "Fishing", -24 => "Herbalism", -371 => "Inscription", -373 => "Jewelcrafting", -182 => "Leatherworking",
+ -264 => "Tailoring"
+ ),
+ 6 => array( "Battlegrounds",
+ -25 => "All", 2597 => "Alterac Valley", 3358 => "Arathi Basin", 3820 => "Eye of the Storm", 4710 => "Isle of Conquest",
+ 4384 => "Strand of the Ancients", 3277 => "Warsong Gulch"
+ ),
+ 9 => array( "Seasonal",
+ -370 => "Brewfest", -1002 => "Children's Week", -364 => "Darkmoon Faire", -41 => "Day of the Dead", -1003 => "Hallow's End",
+ -1005 => "Harvest Festival", -376 => "Love is in the Air", -366 => "Lunar Festival", -369 => "Midsummer", -1006 => "New Year's Eve",
+ -375 => "Pilgrim's Bounty", -374 => "Noblegarden", -1001 => "Winter Veil"
+ ),
+ 7 => array( "Miscellaneous",
+ -365 => "Ahn'Qiraj War Effort", -241 => "Argent Tournament", -1010 => "Dungeon Finder", -1 => "Epic", -344 => "Legendary",
+ -367 => "Reputation", -368 => "Scourge Invasion"
+ ),
+ -2 => "Uncategorized"
)
),
'title' => array(
diff --git a/localization/locale_eses.php b/localization/locale_eses.php
index 7ad1e2eb..d2e63aed 100644
--- a/localization/locale_eses.php
+++ b/localization/locale_eses.php
@@ -381,7 +381,74 @@ $lang = array(
83 => "Legendaria", 84 => "Escolta", 85 => "Heroica", 88 => "Banda (10)", 89 => "Banda (25)"
),
'cat' => array(
- // todo: after zones
+ 0 => array( "Reinos del Este",
+ 3430 => "Bosque Canción Eterna", 130 => "Bosque de Argénteos", 12 => "Bosque de Elwynn", 10 => "Bosque del Ocaso", 3487 => "Ciudad de Lunargenta",
+ 1519 => "Ciudad de Ventormenta", 85 => "Claros de Tirisfal", 279 => "Cráter de Dalaran", 1 => "Dun Morogh", 1497 => "Entrañas",
+ 1537 => "Forjaz", 4080 => "Isla de Quel'Danas", 51 => "La Garganta de Fuego", 267 => "Laderas de Trabalomas", 46 => "Las Estepas Ardientes",
+ 4 => "Las Tierras Devastadas", 38 => "Loch Modan", 11 => "Los Humedales", 25 => "Montaña Roca Negra", 44 => "Montañas Crestagrana",
+ 36 => "Montañas de Alterac", 8 => "Pantano de las Penas", 41 => "Paso de la Muerte", 40 => "Páramos de Poniente", 45 => "Tierras Altas de Arathi",
+ 3433 => "Tierras Fantasma", 3 => "Tierras Inhóspitas", 139 => "Tierras de la Peste del Este", 28 => "Tierras de la Peste del Oeste",4298 => "Tierras de la Peste: El Enclave Escarlata",
+ 47 => "Tierras del Interior", 2257 => "Tranvía Subterráneo", 33 => "Vega de Tuercespina"
+ ),
+ 1 => array( "Kalimdor",
+ 16 => "Azshara", 1216 => "Bastión Fauces de Madera", 1638 => "Cima del Trueno", 493 => "Claro de la Luna", 148 => "Costa Oscura",
+ 490 => "Cráter de Un'Goro", 618 => "Cuna del Invierno", 1657 => "Darnassus", 405 => "Desolace", 14 => "Durotar",
+ 3557 => "El Exodar", 357 => "Feralas", 361 => "Frondavil", 3524 => "Isla Bruma Azur", 3525 => "Isla Bruma de Sangre",
+ 400 => "Las Mil Agujas", 17 => "Los Baldíos", 15 => "Marjal Revolcafango", 215 => "Mulgore", 1637 => "Orgrimmar",
+ 406 => "Sierra Espolón", 1377 => "Silithus", 440 => "Tanaris", 141 => "Teldrassil", 331 => "Vallefresno"
+ ),
+ 8 => array( "Terrallende",
+ 3519 => "Bosque de Terokkar", 3703 => "Ciudad de Shattrath", 3521 => "Marisma de Zangar", 3522 => "Montañas Filospada", 3518 => "Nagrand",
+ 3483 => "Península del Fuego Infernal", 3679 => "Skettis", 3523 => "Tormenta Abisal", 3520 => "Valle Sombraluna"
+ ),
+ 10 => array( "Rasganorte",
+ 65 => "Cementerio de Dragones", 394 => "Colinas Pardas", 4197 => "Conquista del Invierno", 210 => "Corona de Hielo", 3711 => "Cuenca de Sholazar",
+ 4395 => "Dalaran", 4742 => "Desembarco de Hrothgar", 495 => "Fiordo Aquilonal", 4024 => "Gelidar", 67 => "Las Cumbres Tormentosas",
+ 3537 => "Tundra Boreal", 66 => "Zul'Drak"
+ ),
+ 6 => array( "Campos de batalla",
+ -25 => "Campos de batalla", 3358 => "Cuenca de Arathi", 3277 => "Garganta Grito de Guerra", 4710 => "Isla de la Conquista", 3820 => "Ojo de la Tormenta",
+ 4384 => "Playa de los Ancestros", 2597 => "Valle de Alterac"
+ ),
+ 4 => array( "Clases",
+ -61 => "Brujo", -372 => "Caballero de la Muerte", -261 => "Cazador", -82 => "Chamán", -263 => "Druida",
+ -81 => "Guerrero", -161 => "Mago", -141 => "Paladín", -162 => "Pícaro", -262 => "Sacerdote"
+ ),
+ 2 => array( "Mazmorras",
+ 4494 => "Ahn'kahet: El Antiguo Reino", 2367 => "Antiguas Laderas de Trabalomas", 4277 => "Azjol-Nerub", 4131 => "Bancal del Magister", 209 => "Castillo de Colmillo Oscuro",
+ 719 => "Cavernas de Brazanegra", 1941 => "Cavernas del Tiempo", 3535 => "Ciudadela del Fuego Infernal", 3790 => "Criptas Auchenai", 718 => "Cuevas de los Lamentos",
+ 1583 => "Cumbre de Roca Negra", 4264 => "Cámaras de Piedra", 4820 => "Cámaras de Reflexión", 4272 => "Cámaras de Relámpagos", 3848 => "El Arcatraz",
+ 4415 => "El Bastión Violeta", 3845 => "El Castillo de la Tempestad", 3713 => "El Horno de Sangre", 3847 => "El Invernáculo", 3849 => "El Mechanar",
+ 4120 => "El Nexo", 4228 => "El Oculus", 4196 => "Fortaleza de Drak'Tharon", 206 => "Fortaleza de Utgarde", 4813 => "Foso de Saron",
+ 721 => "Gnomeregan", 4416 => "Gundrak", 491 => "Horado Rajacieno", 2366 => "La Ciénaga Negra", 3715 => "La Cámara de Vapor",
+ 4809 => "La Forja de Almas", 2557 => "La Masacre", 4100 => "La Matanza de Stratholme", 3716 => "La Sotiénaga", 3789 => "Laberinto de las Sombras",
+ 717 => "Las Mazmorras", 1581 => "Las Minas de la Muerte", 3714 => "Las Salas Arrasadas", 2100 => "Maraudon", 796 => "Monasterio Escarlata",
+ 3562 => "Murallas del Fuego Infernal", 1196 => "Pináculo de Utgarde", 1584 => "Profundidades de Roca Negra", 4723 => "Prueba del Campeón", 3717 => "Recinto de los Esclavos",
+ 3905 => "Reserva Colmillo Torcido", 3791 => "Salas Sethekk", 2057 => "Scholomance", 2437 => "Sima Ígnea", 2017 => "Stratholme",
+ 1477 => "Templo Sumergido", 3792 => "Tumbas de Maná", 1337 => "Uldaman", 722 => "Zahúrda Rajacieno", 1176 => "Zul'Farrak"
+ ),
+ 5 => array( "Profesiones",
+ -181 => "Alquimia", -304 => "Cocina", -24 => "Herboristería", -121 => "Herrería", -201 => "Ingeniería",
+ -371 => "Inscripción", -373 => "Joyería", -182 => "Peletería", -101 => "Pesca", -324 => "Primeros auxilios",
+ -264 => "Sastrería"
+ ),
+ 3 => array( "Bandas",
+ 3428 => "Ahn'Qiraj", 3607 => "Caverna Santuario Serpiente", 4812 => "Ciudadela de la Corona de Hielo", 3842 => "El Castillo de la Tempestad", 4500 => "El Ojo de la Eternidad",
+ 4493 => "El Sagrario Obsidiana", 3959 => "El Templo Oscuro", 2677 => "Guarida de Alanegra", 3923 => "Guarida de Gruul", 3836 => "Guarida de Magtheridon",
+ 2159 => "Guarida de Onyxia", 3457 => "Karazhan", 4603 => "La Cámara de Archavon", 3606 => "La Cima Hyjal", 4075 => "Meseta de La Fuente del Sol",
+ 3456 => "Naxxramas", 2717 => "Núcleo de Magma", 4722 => "Prueba del Cruzado", 3429 => "Ruinas de Ahn'Qiraj", 4273 => "Ulduar",
+ 805 => "Zul'Aman", 1977 => "Zul'Gurub"
+ ),
+ 9 => array( "Eventos del mundo",
+ -370 => "Fiesta de la cerveza", -1002 => "Los Niños", -364 => "Feria de la Luna Negra", -41 => "Día de los Muertos", -1003 => "Halloween",
+ -1005 => "Festival de la cosecha", -376 => "Amor en el aire", -366 => "Festival Lunar", -369 => "Solsticio", -1006 => "Año nuevo",
+ -375 => "Generosidad", -374 => "Jardín Noble", -1001 => "Festival de Invierno"
+ ),
+ 7 => array( "Miscelánea",
+ -365 => "Guerra de Ahn'Qiraj", -1010 => "Buscador de Mazmorras", -1 => "Épica", -344 => "Legendaria", -367 => "Reputación",
+ -368 => "Invasión", -241 => "Torneo"
+ ),
+ -2 => "Sin categoría"
)
),
'title' => array(
diff --git a/localization/locale_frfr.php b/localization/locale_frfr.php
index cdb4c426..a77b470d 100644
--- a/localization/locale_frfr.php
+++ b/localization/locale_frfr.php
@@ -381,7 +381,73 @@ $lang = array(
83 => "Légendaire", 84 => "Escorte", 85 => "Héroïque", 88 => "Raid (10)", 89 => "Raid (25)"
),
'cat' => array(
- // todo: after zones
+ 0 => array( "Royaumes de l'est",
+ 10 => "Bois de la Pénombre", 3430 => "Bois des Chants éternels", 85 => "Clairières de Tirisfal", 267 => "Contreforts de Hautebrande", 279 => "Cratère de Dalaran",
+ 1 => "Dun Morogh", 41 => "Défilé de Deuillevent", 1537 => "Forgefer", 12 => "Forêt d'Elwynn", 130 => "Forêt des Pins argentés",
+ 1497 => "Fossoyeuse", 51 => "Gorge des Vents brûlants", 45 => "Hautes-terres d'Arathi", 1519 => "Hurlevent", 44 => "Les Carmines",
+ 47 => "Les Hinterlands", 11 => "Les Paluns", 3433 => "Les Terres fantômes", 38 => "Loch Modan", 3487 => "Lune-d'argent",
+ 139 => "Maleterres de l'est", 28 => "Maleterres de l'ouest", 4298 => "Maleterres : l'enclave Écarlate", 8 => "Marais des Chagrins", 40 => "Marche de l'Ouest",
+ 25 => "Mont Rochenoire", 36 => "Montagnes d'Alterac", 46 => "Steppes ardentes", 4 => "Terres foudroyées", 3 => "Terres ingrates",
+ 2257 => "Tram des profondeurs", 33 => "Vallée de Strangleronce", 4080 => "Île de Quel'Danas"
+ ),
+ 1 => array( "Kalimdor",
+ 16 => "Azshara", 618 => "Berceau-de-l'Hiver", 490 => "Cratère d'Un'Goro", 1657 => "Darnassus", 14 => "Durotar",
+ 405 => "Désolace", 357 => "Féralas", 361 => "Gangrebois", 3557 => "L'Exodar", 1638 => "Les Pitons du Tonnerre",
+ 406 => "Les Serres-Rocheuses", 17 => "Les Tarides", 15 => "Marécage d'Âprefange", 400 => "Mille pointes", 215 => "Mulgore",
+ 1637 => "Orgrimmar", 331 => "Orneval", 493 => "Reflet-de-Lune", 1216 => "Repaire des Grumegueules", 1377 => "Silithus",
+ 148 => "Sombrivage", 440 => "Tanaris", 141 => "Teldrassil", 3524 => "Île de Brume-azur", 3525 => "Île de Brume-sang"
+ ),
+ 8 => array( "Outreterre",
+ 3519 => "Forêt de Terokkar", 3522 => "Les Tranchantes", 3521 => "Marécage de Zangar", 3518 => "Nagrand", 3483 => "Péninsule des Flammes infernales",
+ 3523 => "Raz-de-Néant", 3703 => "Shattrath", 3679 => "Skettis", 3520 => "Vallée d'Ombrelune"
+ ),
+ 10 => array( "Norfendre",
+ 4742 => "Accostage de Hrothgar", 3711 => "Bassin de Sholazar", 4395 => "Dalaran", 65 => "Désolation des dragons", 495 => "Fjord Hurlant",
+ 4024 => "Frimarra", 4197 => "Joug-d'hiver", 210 => "La Couronne de glace", 394 => "Les Grisonnes", 67 => "Les pics Foudroyés",
+ 3537 => "Toundra Boréenne", 66 => "Zul'Drak"
+ ),
+ 6 => array( "Champs de bataille",
+ 3358 => "Bassin d'Arathi", -25 => "Champs de bataille", 3277 => "Goulet des Chanteguerres", 3820 => "L'Œil du cyclone", 4384 => "Rivage des Anciens",
+ 2597 => "Vallée d'Alterac", 4710 => "Île des Conquérants"
+ ),
+ 4 => array( "Classes",
+ -82 => "Chaman", -261 => "Chasseur", -372 => "Chevalier de la mort", -263 => "Druide", -61 => "Démoniste",
+ -81 => "Guerrier", -161 => "Mage", -141 => "Paladin", -262 => "Prêtre", -162 => "Voleur"
+ ),
+ 2 => array( "Donjons",
+ 4494 => "Ahn'kahet : l'Ancien royaume", 4277 => "Azjol-Nérub", 718 => "Cavernes des lamentations", 1196 => "Cime d'Utgarde", 2367 => "Contreforts de Hautebrande d'antan",
+ 3790 => "Cryptes Auchenaï", 209 => "Donjon d'Ombrecroc", 206 => "Donjon d'Utgarde", 4196 => "Donjon de Drak'Tharon", 3845 => "Donjon de la Tempête",
+ 4813 => "Fosse de Saron", 721 => "Gnomeregan", 2437 => "Gouffre de Ragefeu", 1941 => "Grottes du temps", 4416 => "Gundrak",
+ 2557 => "Hache-tripes", 491 => "Kraal de Tranchebauge", 3848 => "L'Arcatraz", 4228 => "L'Oculus", 4100 => "L'Épuration de Stratholme",
+ 4723 => "L'épreuve du champion", 3716 => "La Basse-tourbière", 3847 => "La Botanica", 4809 => "La Forge des âmes", 3713 => "La Fournaise du sang",
+ 717 => "La Prison", 3789 => "Labyrinthe des ombres", 3715 => "Le Caveau de la vapeur", 3849 => "Le Méchanar", 4120 => "Le Nexus",
+ 2366 => "Le Noir Marécage", 4415 => "Le fort Pourpre", 1581 => "Les Mortemines", 3714 => "Les Salles brisées", 3717 => "Les enclos aux esclaves",
+ 4272 => "Les salles de Foudre", 4264 => "Les salles de Pierre", 3791 => "Les salles des Sethekk", 2100 => "Maraudon", 796 => "Monastère écarlate",
+ 1583 => "Pic Rochenoire", 719 => "Profondeurs de Brassenoire", 1584 => "Profondeurs de Rochenoire", 3562 => "Remparts des Flammes infernales", 3905 => "Réservoir de Glissecroc",
+ 4820 => "Salles des Reflets", 2057 => "Scholomance", 722 => "Souilles de Tranchebauge", 2017 => "Stratholme", 1477 => "Temple englouti",
+ 4131 => "Terrasse des Magistères", 3792 => "Tombes-mana", 1337 => "Uldaman", 1176 => "Zul'Farrak"
+ ),
+ 5 => array( "Métiers",
+ -181 => "Alchimiste", -371 => "Calligraphie", -304 => "Cuisinier", -121 => "Forgeron", -24 => "Herboristerie",
+ -201 => "Ingénieur", -373 => "Joaillerie", -101 => "Pêcheur", -324 => "Secourisme", -264 => "Tailleur",
+ -182 => "Travailleur du cuir"
+ ),
+ 3 => array( "Raids",
+ 3428 => "Ahn'Qiraj", 4603 => "Caveau d'Archavon", 4812 => "Citadelle de la Couronne de glace", 2717 => "Cœur du Magma", 3845 => "Donjon de la Tempête",
+ 3457 => "Karazhan", 4722 => "L'épreuve du croisé", 4500 => "L'Œil de l'éternité", 3836 => "Le repaire de Magtheridon", 4493 => "Le sanctum Obsidien",
+ 4987 => "Le sanctum Rubis", 3456 => "Naxxramas", 4075 => "Plateau du Puits de soleil", 3923 => "Repaire de Gruul", 2159 => "Repaire d'Onyxia",
+ 2677 => "Repaire de l'Aile noire", 3429 => "Ruines d'Ahn'Qiraj", 3606 => "Sommet d'Hyjal", 3959 => "Temple noir", 4273 => "Ulduar",
+ 3805 => "Zul'Aman", 1977 => "Zul'Gurub"
+ ),
+ 9 => array( "Évènements mondiaux",
+ -370 => "Fête des Brasseurs", -1002 => "Semaine des enfants", -364 => "Foire de Sombrelune", -41 => "Jour des Morts", -1003 => "Sanssaint",
+ -1005 => "Fête des moissons", -376 => "De l'amour dans l'air", -366 => "Fête lunaire", -369 => "Solstice d'été", -1006 => "Nouvel an",
+ -375 => "Bienfaits du pèlerin", -374 => "Jardin des nobles", -1001 => "Voile d'hiver"
+ ),
+ 7 => array( "Divers",
+ -365 => "Guerre d'Ahn'Qiraj", -1010 => "Chercheur de donjons", -1 => "Épique", -344 => "Légendaire", -367 => "Réputation",
+ -368 => "Invasion du fléau", -241 => "Tournoi"),
+ -2 => "Non classés"
)
),
'title' => array(
diff --git a/localization/locale_ruru.php b/localization/locale_ruru.php
index 14b7b51f..8536ef8a 100644
--- a/localization/locale_ruru.php
+++ b/localization/locale_ruru.php
@@ -381,7 +381,74 @@ $lang = array(
83 => "Легенда", 84 => "Сопровождение", 85 => "Героическое", 88 => "Рейд (10)", 89 => "Рейд (25)"
),
'cat' => array(
- // todo: after zones
+ 0 => array( "Восточные королевства",
+ 36 => "Альтеракские горы", 3 => "Бесплодные земли", 11 => "Болотина", 8 => "Болото Печали", 47 => "Внутренние земли",
+ 139 => "Восточные Чумные земли", 4 => "Выжженные земли", 279 => "Даларанский кратер", 1 => "Дун Морог", 28 => "Западные Чумные земли",
+ 40 => "Западный Край", 44 => "Красногорье", 3430 => "Леса Вечной Песни", 38 => "Лок Модан", 3487 => "Луносвет",
+ 45 => "Нагорье Арати", 4080 => "Остров Кель'Данас", 41 => "Перевал Мертвого Ветра", 1497 => "Подгород", 2257 => "Подземный поезд",
+ 267 => "Предгорья Хилсбрада", 3433 => "Призрачные земли", 46 => "Пылающие степи", 130 => "Серебряный бор", 1537 => "Стальгорн",
+ 10 => "Сумеречный лес", 33 => "Тернистая долина", 85 => "Тирисфальские леса", 51 => "Тлеющее ущелье", 25 => "Черная гора",
+ 4298 => "Чумные земли: Анклав Алого ордена",1519 => "Штормград", 12 => "Элвиннский лес"
+ ),
+ 1 => array( "Калимдор",
+ 16 => "Азшара", 1638 => "Громовой Утес", 1657 => "Дарнас", 14 => "Дуротар", 618 => "Зимние Ключи",
+ 406 => "Когтистые горы", 490 => "Кратер Ун'Горо", 1216 => "Крепость Древобрюхов", 493 => "Лунная поляна", 215 => "Мулгор",
+ 1637 => "Оргриммар", 361 => "Оскверненный лес", 3525 => "Остров Кровавой Дымки", 3524 => "Остров Лазурной Дымки", 405 => "Пустоши",
+ 15 => "Пылевые топи", 1377 => "Силитус", 17 => "Степи", 440 => "Танарис", 141 => "Тельдрассил",
+ 148 => "Темные берега", 400 => "Тысяча Игл", 357 => "Фералас", 3557 => "Экзодар", 331 => "Ясеневый лес"
+ ),
+ 8 => array( "Запределье",
+ 3520 => "Долина Призрачной Луны", 3521 => "Зангартопь", 3519 => "Лес Тероккар", 3518 => "Награнд", 3522 => "Острогорье",
+ 3483 => "Полуостров Адского Пламени", 3523 => "Пустоверть", 3679 => "Скеттис", 3703 => "Шаттрат"
+ ),
+ 10 => array( "Нордскол",
+ 3537 => "Борейская тундра", 67 => "Грозовая Гряда", 4742 => "Лагерь Хротгара", 4395 => "Даларан", 65 => "Драконий Погост",
+ 66 => "Зул'Драк", 210 => "Ледяная Корона", 3711 => "Низина Шолазар", 4197 => "Озеро Ледяных Оков", 495 => "Ревущий фьорд",
+ 394 => "Седые холмы", 4024 => "Хладарра"
+ ),
+ 6 => array( "Поля боя",
+ 2597 => "Альтеракская долина", 4384 => "Берег Древних", 3358 => "Низина Арати", 3820 => "Око Бури", 4710 => "Остров Завоеваний",
+ -25 => "Поля сражений", 3277 => "Ущелье Песни Войны"
+ ),
+ 4 => array( "Классы",
+ -81 => "Воин", -263 => "Друид", -262 => "Жрец", -161 => "Маг", -261 => "Охотник",
+ -141 => "Паладин", -162 => "Разбойник", -372 => "Рыцарь смерти", -61 => "Чернокнижник", -82 => "Шаман"
+ ),
+ 2 => array( "Подземелья",
+ 4277 => "Азжол-Неруб", 4415 => "Аметистовая крепость", 4494 => "Ан'кахет: Старое Королевство", 3848 => "Аркатрац", 3790 => "Аукенайские гробницы",
+ 3562 => "Бастионы Адского Пламени", 3847 => "Ботаника", 1196 => "Вершина Утгард", 1584 => "Глубины Черной горы", 721 => "Гномреган",
+ 3792 => "Гробницы Маны", 4416 => "Гундрак", 2557 => "Забытый Город", 4820 => "Залы Отражений", 1477 => "Затонувший храм",
+ 1176 => "Зул'Фаррак", 4723 => "Испытание чемпиона", 3845 => "Крепость Бурь", 4196 => "Крепость Драк'Тарон", 209 => "Крепость Темного Клыка",
+ 206 => "Крепость Утгард", 4809 => "Кузня Душ", 3713 => "Кузня Крови", 722 => "Курганы Иглошкурых", 491 => "Лабиринты Иглошкурых",
+ 2100 => "Мародон", 1581 => "Мертвые копи", 3849 => "Механар", 796 => "Монастырь Алого ордена", 2057 => "Некроситет",
+ 4120 => "Нексус", 719 => "Непроглядная Пучина", 3716 => "Нижетопь", 2437 => "Огненная пропасть", 4228 => "Окулус",
+ 4100 => "Очищение Стратхольма", 3715 => "Паровое подземелье", 1941 => "Пещеры Времени", 718 => "Пещеры Стенаний", 1583 => "Пик Черной горы",
+ 3714 => "Разрушенные залы", 3905 => "Резервуар Кривого Клыка", 3791 => "Сетеккские залы", 2367 => "Старые предгорья Хилсбрада", 2017 => "Стратхольм",
+ 3789 => "Темный лабиринт", 4131 => "Терраса Магистров", 717 => "Тюрьма", 3717 => "Узилище", 1337 => "Ульдаман",
+ 2366 => "Черные топи", 4264 => "Чертоги Камня", 4272 => "Чертоги Молний", 4813 => "Яма Сарона"
+ ),
+ 5 => array( "Профессии",
+ -181 => "Алхимия", -201 => "Инженерное дело", -182 => "Кожевничество", -121 => "Кузнечное дело", -304 => "Кулинария",
+ -371 => "Начертание", -324 => "Первая помощь", -264 => "Портняжное дело", -101 => "Рыбная ловля", -24 => "Травничество",
+ -373 => "Ювелирное дело"
+ ),
+ 3 => array( "Рейды",
+ 3923 => "Логово Груула", 3428 => "Ан'Кираж", 3606 => "Вершина Хиджала", 3805 => "Зул'Аман", 1977 => "Зул'Гуруб",
+ 4722 => "Испытание крестоносца", 3457 => "Каражан", 3845 => "Крепость Бурь", 2677 => "Логово Крыла Тьмы", 3836 => "Логово Магтеридона",
+ 2159 => "Логово Ониксии", 3456 => "Наксрамас", 4493 => "Обсидиановое святилище", 2717 => "Огненные Недра", 4500 => "Око Вечности",
+ 4075 => "Плато Солнечного Колодца", 4987 => "Рубиновое святилище", 3429 => "Руины Ан'Киража", 4603 => "Склеп Аркавона", 4273 => "Ульдуар",
+ 4812 => "Цитадель Ледяной Короны", 3959 => "Черный храм"
+ ),
+ 9 => array( "Игровые события",
+ -370 => "Хмельной фестиваль", -1002 => "Детская неделя", -364 => "Ярмарка Новолуния", -41 => "День Мертвых", -1003 => "Тыквовин",
+ -1005 => "Фестиваль урожая", -376 => "Любовная лихорадка", -366 => "Лунный фестиваль", -369 => "Огненный солнцеворот", -1006 => "Новый Год",
+ -375 => "Пиршество странников", -374 => "Сад чудес", -1001 => "Зимний Покров"
+ ),
+ 7 => array( "Разное",
+ -365 => "Ан'киражская война", -1010 => "Поиск подземелий", -1 => "Эпический", -344 => "Легендарный", -367 => "Репутация",
+ -368 => "Вторжение", -241 => "Турнир"
+ ),
+ -2 => "Разное"
)
),
'title' => array(
diff --git a/pages/achievements.php b/pages/achievements.php
index 98b15949..ea8e376c 100644
--- a/pages/achievements.php
+++ b/pages/achievements.php
@@ -42,6 +42,7 @@ class AchievementsPage extends GenericPage
public function __construct($pageCall, $pageParam)
{
+ $this->filterObj = new AchievementListFilter();
$this->getCategoryFromUrl($pageParam);
parent::__construct();
@@ -58,14 +59,12 @@ class AchievementsPage extends GenericPage
if ($this->category)
$conditions[] = ['category', (int)end($this->category)];
- $acvFilter = new AchievementListFilter();
-
// recreate form selection
- $this->filter = $acvFilter->getForm('form');
+ $this->filter = $this->filterObj->getForm('form');
$this->filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : null;
- $this->filter['fi'] = $acvFilter->getForm();
+ $this->filter['fi'] = $this->filterObj->getForm();
- if ($fiCnd = $acvFilter->getConditions())
+ if ($fiCnd = $this->filterObj->getConditions())
$conditions[] = $fiCnd;
$acvList = new AchievementList($conditions);
@@ -108,7 +107,7 @@ class AchievementsPage extends GenericPage
$params['_truncated'] = 1;
}
- if ($acvFilter->error)
+ if ($this->filterObj->error)
$params['_errors'] = '$1';
}
diff --git a/pages/items.php b/pages/items.php
index 0fae8d92..61adf210 100644
--- a/pages/items.php
+++ b/pages/items.php
@@ -81,7 +81,8 @@ class ItemsPage extends GenericPage
public function __construct($pageCall, $pageParam)
{
- $this->getCategoryFromUrl($pageParam);;
+ $this->filterObj = new ItemListFilter();
+ $this->getCategoryFromUrl($pageParam);
parent::__construct();
@@ -100,12 +101,10 @@ class ItemsPage extends GenericPage
/* evaluate filter */
/*******************/
- $itemFilter = new ItemListFilter();
-
// recreate form selection
- $this->filter = array_merge($itemFilter->getForm('form'), $this->filter);
+ $this->filter = array_merge($this->filterObj->getForm('form'), $this->filter);
$this->filter['query'] = @$_GET['filter'] ?: NULL;
- $this->filter['fi'] = $itemFilter->getForm();
+ $this->filter['fi'] = $this->filterObj->getForm();
$menu = $this->createExtraMenus();
@@ -120,21 +119,21 @@ class ItemsPage extends GenericPage
if (isset($this->filter['slot'][INVTYPE_SHIELD])) // "Off Hand" => "Shield"
$this->filter['slot'][INVTYPE_SHIELD] = Lang::$item['armorSubClass'][6];
- $xCols = $itemFilter->getForm('extraCols', true);
+ $xCols = $this->filterObj->getForm('extraCols', true);
$infoMask = ITEMINFO_JSON;
if (array_intersect([63, 64, 125], $xCols)) // 63:buyPrice; 64:sellPrice; 125:reqarenartng
$infoMask |= ITEMINFO_VENDOR;
- if ($itemFilter->error)
- $this->sharedLV['_errors'] = '$1';
-
if (!empty($this->filter['fi']['extraCols']))
$this->sharedLV['extraCols'] = '$fi_getExtraCols(fi_extraCols, '.($this->filter['gm'] ?: 0).', '.(array_intersect([63], $xCols) ? 1 : 0).')';
- if ($_ = $itemFilter->getConditions())
+ if ($_ = $this->filterObj->getConditions())
$conditions[] = $_;
+ if ($this->filterObj->error)
+ $this->sharedLV['_errors'] = '$1';
+
/******************/
/* set conditions */
/******************/
@@ -150,7 +149,7 @@ class ItemsPage extends GenericPage
/* handle auto-gemming */
/***********************/
- $this->gemScores = $this->createGemScores($itemFilter);
+ $this->gemScores = $this->createGemScores();
/*************************/
/* handle upgrade search */
@@ -159,7 +158,7 @@ class ItemsPage extends GenericPage
$upgItemData = [];
if (!empty($this->filter['upg']) && !empty($this->filter['fi']['setWeights']))
{
- $upgItems = new ItemList(array(['id', array_keys($this->filter['upg'])]), ['extraOpts' => $itemFilter->extraOpts]);
+ $upgItems = new ItemList(array(['id', array_keys($this->filter['upg'])]), ['extraOpts' => $this->filterObj->extraOpts]);
if (!$upgItems->error)
{
$this->extendGlobalData($upgItems->getJSGlobals());
@@ -245,7 +244,7 @@ class ItemsPage extends GenericPage
break;
case 2: // itemlevel: first, try to find 10 level steps within range (if given) as tabs
// ohkayy, maybe i need to rethink $this
- $this->filterOpts = $itemFilter->extraOpts;
+ $this->filterOpts = $this->filterObj->extraOpts;
$this->filterOpts['is']['o'] = [null]; // remove 'order by' from itemStats
$extraOpts = array_merge($this->filterOpts, ['i' => ['g' => ['itemlevel'], 'o' => ['itemlevel DESC']]]);
@@ -293,7 +292,7 @@ class ItemsPage extends GenericPage
{
$finalCnd = $gbField ? array_merge($conditions, [[$gbField, abs($group), $group > 0 ? null : '<'], $maxResults]) : $conditions;
- $items = new ItemList($finalCnd, ['extraOpts' => array_merge($extraOpts, $itemFilter->extraOpts)]);
+ $items = new ItemList($finalCnd, ['extraOpts' => array_merge($extraOpts, $this->filterObj->extraOpts)]);
if ($items->error)
continue;
@@ -373,7 +372,7 @@ class ItemsPage extends GenericPage
$override['upg'] = implode(':', $upg);
$cls = isset($this->category[0]) ? '='.$this->category[0] : '';
- $this->filterUrl = $itemFilter->urlize($override, $addCr);
+ $this->filterUrl = $this->filterObj->urlize($override, $addCr);
if ($note)
$tab['params']['note'] = '$$WH.sprintf(LANG.'.$note.', \''.$cls.'\', \''.$this->filterUrl.'\')';
@@ -436,13 +435,13 @@ class ItemsPage extends GenericPage
$this->path[] = $c;
// if slot-dropdown is available && Armor && $path points to Armor-Class
- $form = (new ItemListFilter())->getForm('form');
+ $form = $this->filterObj->getForm('form');
if (count($this->path) == 4 && $this->category[0] == 4 && isset($form['sl']) && !is_array($form['sl']))
$this->path[] = $form['sl'];
}
// fetch best possible gems for chosen weights
- private function createGemScores($itemFilter)
+ private function createGemScores()
{
$gemScores = [];
@@ -459,10 +458,10 @@ class ItemsPage extends GenericPage
if (!isset($this->filter['jc']))
$cnd[] = ['itemLimitCategory', 0]; // Jeweler's Gems
- If ($itemFilter->wtCnd)
- $cnd[] = $itemFilter->wtCnd;
+ If ($this->filterObj->wtCnd)
+ $cnd[] = $this->filterObj->wtCnd;
- $anyColor = new ItemList($cnd, ['extraOpts' => $itemFilter->extraOpts]);
+ $anyColor = new ItemList($cnd, ['extraOpts' => $this->filterObj->extraOpts]);
if (!$anyColor->error)
{
$this->extendGlobalData($anyColor->getJSGlobals());
@@ -473,7 +472,7 @@ class ItemsPage extends GenericPage
{
$mask = 1 << $i;
$q = !$i ? 3 : intVal($this->filter['gm']); // meta gems are always included.. ($q is backReferenced)
- $byColor = new ItemList($cnd, ['extraOpts' => $itemFilter->extraOpts]);
+ $byColor = new ItemList($cnd, ['extraOpts' => $this->filterObj->extraOpts]);
if (!$byColor->error)
{
$this->extendGlobalData($byColor->getJSGlobals());
diff --git a/pages/itemsets.php b/pages/itemsets.php
index 3a528bca..9a339077 100644
--- a/pages/itemsets.php
+++ b/pages/itemsets.php
@@ -19,7 +19,8 @@ class ItemsetsPage extends GenericPage
public function __construct($pageCall, $pageParam)
{
- $this->getCategoryFromUrl($pageParam);;
+ $this->filterObj = new ItemsetListFilter();
+ $this->getCategoryFromUrl($pageParam);
parent::__construct();
@@ -28,15 +29,13 @@ class ItemsetsPage extends GenericPage
protected function generateContent()
{
- $itemsetFilter = new ItemsetListFilter();
-
- $itemsets = new ItemsetList($itemsetFilter->getConditions());
+ $itemsets = new ItemsetList($this->filterObj->getConditions());
$this->extendGlobalData($itemsets->getJSGlobals());
// recreate form selection
- $this->filter = array_merge($itemsetFilter->getForm('form'), $this->filter);
+ $this->filter = array_merge($this->filterObj->getForm('form'), $this->filter);
$this->filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : NULL;
- $this->filter['fi'] = $itemsetFilter->getForm();
+ $this->filter['fi'] = $this->filterObj->getForm();
$this->addJS('?data=weight-presets&locale='.User::$localeId.'&t='.$_SESSION['dataKey']);
@@ -56,7 +55,7 @@ class ItemsetsPage extends GenericPage
$lv['params']['_truncated'] = 1;
}
- if ($itemsetFilter->error)
+ if ($this->filterObj->error)
$lv['params']['_errors'] = '$1';
$this->lvData = $lv;
@@ -70,14 +69,14 @@ class ItemsetsPage extends GenericPage
{
array_unshift($this->title, $this->name);
- $form = (new ItemsetListFilter())->getForm('form');
+ $form = $this->filterObj->getForm('form');
if (isset($form['cl']))
array_unshift($this->title, Lang::$game['cl'][$form['cl']]);
}
protected function generatePath()
{
- $form = (new ItemsetListFilter())->getForm('form');
+ $form = $this->filterObj->getForm('form');
if (isset($form['cl']))
$this->path[] = $form['cl'];
}
diff --git a/pages/npcs.php b/pages/npcs.php
index 980cfff4..20fafe5a 100644
--- a/pages/npcs.php
+++ b/pages/npcs.php
@@ -20,6 +20,7 @@ class NpcsPage extends GenericPage
public function __construct($pageCall, $pageParam)
{
+ $this->filterObj = new CreatureListFilter();
$this->getCategoryFromUrl($pageParam);;
parent::__construct();
@@ -40,17 +41,16 @@ class NpcsPage extends GenericPage
else
$this->petFamPanel = false;
- $npcFilter = new CreatureListFilter();
- if ($_ = $npcFilter->getConditions())
+ if ($_ = $this->filterObj->getConditions())
$conditions[] = $_;
// beast subtypes are selected via filter
- $npcs = new CreatureList($conditions, ['extraOpts' => $npcFilter->extraOpts]);
+ $npcs = new CreatureList($conditions, ['extraOpts' => $this->filterObj->extraOpts]);
// recreate form selection
- $this->filter = array_merge($npcFilter->getForm('form'), $this->filter);
+ $this->filter = array_merge($this->filterObj->getForm('form'), $this->filter);
$this->filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : NULL;
- $this->filter['fi'] = $npcFilter->getForm();
+ $this->filter['fi'] = $this->filterObj->getForm();
$lv = array(
'file' => 'creature',
@@ -68,7 +68,7 @@ class NpcsPage extends GenericPage
$lv['params']['_truncated'] = 1;
}
- if ($npcFilter->error)
+ if ($this->filterObj->error)
$lv['params']['_errors'] = '$1';
$this->lvData = $lv;
@@ -89,7 +89,7 @@ class NpcsPage extends GenericPage
if ($this->category)
$this->path[] = $this->category[0];
- $form = (new CreatureListFilter())->getForm('form');
+ $form = $this->filterObj->getForm('form');
if (isset($form['fa']) && !is_array($form['fa']))
$this->path[] = $form['fa'];
}
diff --git a/pages/objects.php b/pages/objects.php
index 780aabc7..379d6440 100644
--- a/pages/objects.php
+++ b/pages/objects.php
@@ -20,6 +20,7 @@ class ObjectsPage extends GenericPage
public function __construct($pageCall, $pageParam)
{
+ $this->filterObj = new GameObjectListFilter();
$this->getCategoryFromUrl($pageParam);;
parent::__construct();
@@ -35,18 +36,16 @@ class ObjectsPage extends GenericPage
if ($this->category)
$conditions[] = ['typeCat', (int)$this->category[0]];
- $objectFilter = new GameObjectListFilter();
-
// recreate form selection
- $this->filter = $objectFilter->getForm('form');
+ $this->filter = $this->filterObj->getForm('form');
$this->filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : null;
- $this->filter['fi'] = $objectFilter->getForm();
+ $this->filter['fi'] = $this->filterObj->getForm();
- if ($_ = $objectFilter->getConditions())
+ if ($_ = $this->filterObj->getConditions())
$conditions[] = $_;
$params = $data = [];
- $objects = new GameObjectList($conditions, ['extraOpts' => $objectFilter->extraOpts]);
+ $objects = new GameObjectList($conditions, ['extraOpts' => $this->filterObj->extraOpts]);
if (!$objects->error)
{
$data = $objects->getListviewData();
@@ -61,9 +60,8 @@ class ObjectsPage extends GenericPage
$params['_truncated'] = 1;
}
- if ($objectFilter->error)
+ if ($this->filterObj->error)
$params['_errors'] = '$1';
-
}
$this->lvData = array(
diff --git a/pages/quest.php b/pages/quest.php
index f0a49940..4de17ec1 100644
--- a/pages/quest.php
+++ b/pages/quest.php
@@ -4,544 +4,686 @@ if (!defined('AOWOW_REVISION'))
die('illegal access');
-require 'includes/community.class.php';
-
-$_id = intVal($pageParam);
-$_path = [0, 3];
-
-$cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_QUEST, $_id, -1, User::$localeId]);
-$cacheKeyTooltip = implode('_', [CACHETYPE_TOOLTIP, TYPE_QUEST, $_id, -1, User::$localeId]);
-
-// AowowPower-request
-if (isset($_GET['power']))
+// menuId 3: Quest g_initPath()
+// tabId 0: Database g_initHeader()
+class QuestPage extends GenericPage
{
- header('Content-type: application/x-javascript; charsetUTF-8');
+ use DetailPage;
- Util::powerUseLocale(@$_GET['domain']);
+ protected $type = TYPE_QUEST;
+ protected $typeId = 0;
+ protected $tpl = 'quest';
+ protected $path = [0, 3];
+ protected $tabId = 0;
+ protected $mode = CACHETYPE_PAGE;
+ protected $js = ['Mapper.js'];
+ protected $css = array(
+ ['path' => 'Book.css'],
+ ['path' => 'Mapper.css'],
+ ['path' => 'Mapper_ie6.css', 'ieCond' => 'lte IE 6']
+ );
- if (!$smarty->loadCache($cacheKeyTooltip, $x))
+ public function __construct($__, $id)
{
- $quest = new QuestList(array(['id', $_id]));
- if ($quest->error)
- die('$WowheadPower.registerQuest(\''.$_id.'\', '.User::$localeId.', {})');
+ parent::__construct();
- $x = '$WowheadPower.registerQuest('.$_id.', '.User::$localeId.", {\n";
- $x .= "\tname_".User::$localeString.": '".Util::jsEscape($quest->getField('name', true))."',\n";
- $x .= "\ttooltip_".User::$localeString.': \''.$quest->renderTooltip()."'";
- if ($quest->isDaily())
- $x .= ",\n\tdaily: 1";
- $x .= "\n});";
+ // temp locale
+ if ($this->mode == CACHETYPE_TOOLTIP && isset($_GET['domain']))
+ Util::powerUseLocale($_GET['domain']);
- $smarty->saveCache($cacheKeyTooltip, $x);
+ $this->typeId = intVal($id);
+
+ $this->subject = new QuestList(array(['id', $this->typeId]));
+ if ($this->subject->error)
+ $this->notFound(Lang::$game['quest']);
+
+ $this->name = $this->subject->getField('name', true);
}
- die($x);
-}
-
-// regular page
-if (!$smarty->loadCache($cacheKeyPage, $pageData))
-{
- $quest = new QuestList(array(['id', $_id]));
- if ($quest->error)
- $smarty->notFound(Lang::$game['quest'], $_id);
-
- // recreate path
- $_path[] = $quest->getField('cat2');
- if ($_ = $quest->getField('cat1'))
- $_path[] = $_;
-
- $_name = $quest->getField('name', true);
- $_level = $quest->getField('level');
- $_minLevel = $quest->getField('minLevel');
- $_maxLevel = $quest->getField('maxLevel');
- $_flags = $quest->getField('flags');
- $_specialFlags = $quest->getField('specialFlags');
- $_questMoney = $quest->getField('rewardOrReqMoney');
- $_side = Util::sideByRaceMask($quest->getField('reqRaceMask'));
-
- /***********/
- /* Infobox */
- /***********/
-
- $infobox = [];
-
- // event (todo: assign eventData)
- if ($_ = $quest->getField('holidayId'))
+ protected function generatePath()
{
- (new WorldEventList(array(['h.id', $_])))->addGlobalsToJscript();
- $infobox[] = Lang::$game['eventShort'].Lang::$colon.'[event='.$_.']';
+ // recreate path
+ $this->path[] = $this->subject->getField('cat2');
+ if ($_ = $this->subject->getField('cat1'))
+ $this->path[] = $_;
}
- // level
- if ($_ = $_level)
- if ($_ > 0)
- $infobox[] = Lang::$game['level'].Lang::$colon.$_;
-
- // reqlevel
- if ($_ = $_minLevel)
+ protected function generateTitle()
{
- $lvl = $_;
- if ($_ = $_maxLevel)
- $lvl .= ' - '.$_;
-
- $infobox[] = sprintf(Lang::$game['reqLevel'], $lvl);
+ array_unshift($this->title, $this->name, Util::ucFirst(Lang::$game['quest']));
}
- // loremaster (i dearly hope those flags cover every case...)
- if ($quest->getField('zoneOrSort') > 0 && !$quest->isRepeatable())
+ protected function generateContent()
{
- $conditions = array(
- ['ac.type', ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE],
- ['ac.value1', $quest->getField('zoneOrSort')],
- ['a.faction', $_side, '&']
- );
- $loremaster = new AchievementList($conditions);
- switch ($loremaster->getMatches())
+ $_level = $this->subject->getField('level');
+ $_minLevel = $this->subject->getField('minLevel');
+ $_flags = $this->subject->getField('flags');
+ $_specialFlags = $this->subject->getField('specialFlags');
+ $_side = Util::sideByRaceMask($this->subject->getField('reqRaceMask'));
+
+ /***********/
+ /* Infobox */
+ /***********/
+
+ $infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
+
+ // event (todo: assign eventData)
+ if ($_ = $this->subject->getField('holidayId'))
{
- case 0:
- break;
- case 1:
- $loremaster->addGlobalsToJscript(GLOBALINFO_SELF);
- $infobox[] = Lang::$quest['loremaster'].Lang::$colon.'[achievement='.$loremaster->id.']';
- break;
- default:
- $loremaster->addGlobalsToJscript(GLOBALINFO_SELF);
- $lm = Lang::$quest['loremaster'].Lang::$colon.'[ul]';
- foreach($loremaster->iterate() as $id => $__)
- $lm .= '[li][achievement='.$id.'][/li]';
-
- $infobox[] = $lm.'[/ul]';
- break;
+ $this->extendGlobalIds(TYPE_WORLDEVENT, $_);
+ $infobox[] = Lang::$game['eventShort'].Lang::$main['colon'].'[event='.$_.']';
}
- }
- // type (maybe expand uppon?)
- $_ = [];
- if ($_flags & QUEST_FLAG_DAILY)
- $_[] = Lang::$quest['daily'];
- else if ($_flags & QUEST_FLAG_WEEKLY)
- $_[] = Lang::$quest['weekly'];
- else if ($_specialFlags & QUEST_FLAG_SPECIAL_MONTHLY)
- $_[] = Lang::$quest['monthly'];
+ // level
+ if ($_level > 0)
+ $infobox[] = Lang::$game['level'].Lang::$main['colon'].$_level;
- if ($t = $quest->getField('type'))
- $_[] = Lang::$quest['questInfo'][$t];
-
- if ($_)
- $infobox[] = Lang::$game['type'].Lang::$colon.implode(' ', $_);
-
- // side
- $_ = Lang::$main['side'].lang::$colon;
- switch ($_side)
- {
- case 3: $infobox[] = $_.Lang::$game['si'][3]; break;
- case 2: $infobox[] = $_.'[span class=icon-horde]'.Lang::$game['si'][2].'[/span]'; break;
- case 1: $infobox[] = $_.'[span class=icon-alliance]'.Lang::$game['si'][1].'[/span]'; break;
- }
-
- // races
- if ($_ = Lang::getRaceString($quest->getField('reqRaceMask'), $__, false, $n))
- {
- if ($n)
+ // reqlevel
+ if ($_minLevel)
{
- $t = $n == 1 ? Lang::$game['race'] : Lang::$game['races'];
- $infobox[] = Util::ucFirst($t).Lang::$colon.$_;
+ $lvl = $_minLevel;
+ if ($_ = $this->subject->getField('maxLevel'))
+ $lvl .= ' - '.$_;
+
+ $infobox[] = sprintf(Lang::$game['reqLevel'], $lvl);
}
- }
- // classes
- if ($_ = Lang::getClassString($quest->getField('reqClassMask'), false, $n))
- {
- $t = $n == 1 ? Lang::$game['class'] : Lang::$game['classes'];
- $infobox[] = Util::ucFirst($t).Lang::$colon.$_;
- }
-
- // profession / skill
- if ($_ = $quest->getField('reqSkillId'))
- {
- Util::$pageTemplate->extendGlobalIds(TYPE_SKILL, $_);
- $sk = '[skill='.$_.']';
- if ($_ = $quest->getField('reqSkillPoints'))
- $sk .= ' ('.$_.')';
-
- $infobox[] = Lang::$quest['profession'].Lang::$colon.$sk;
- }
-
- // timer
- if ($_ = $quest->getField('timeLimit'))
- $infobox[] = Lang::$quest['timer'].Lang::$colon.Util::formatTime($_ * 1000);
-
- $startEnd = DB::Aowow()->select('SELECT * FROM ?_quests_startend WHERE questId = ?d', $_id);
-
- // start
- $start = '[icon name=quest_start'.($quest->isDaily() ? '_daily' : '').']'.lang::$event['start'].Lang::$colon.'[/icon]';
- $s = [];
- foreach ($startEnd as $se)
- {
- if ($se['method'] & 0x1)
+ // loremaster (i dearly hope those flags cover every case...)
+ if ($this->subject->getField('zoneOrSort') > 0 && !$this->subject->isRepeatable())
{
- Util::$pageTemplate->extendGlobalIds($se['type'], $se['typeId']);
- $s[] = ($s ? '[span=invisible]'.$start.'[/span] ' : $start.' ') .'['.Util::$typeStrings[$se['type']].'='.$se['typeId'].']';
+ $conditions = array(
+ ['ac.type', ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE],
+ ['ac.value1', $this->subject->getField('zoneOrSort')],
+ ['a.faction', $_side, '&']
+ );
+ $loremaster = new AchievementList($conditions);
+ $this->extendGlobalData($loremaster->getJSGlobals(GLOBALINFO_SELF));
+
+ switch ($loremaster->getMatches())
+ {
+ case 0:
+ break;
+ case 1:
+ $infobox[] = Lang::$quest['loremaster'].Lang::$main['colon'].'[achievement='.$loremaster->id.']';
+ break;
+ default:
+ $lm = Lang::$quest['loremaster'].Lang::$main['colon'].'[ul]';
+ foreach($loremaster->iterate() as $id => $__)
+ $lm .= '[li][achievement='.$id.'][/li]';
+
+ $infobox[] = $lm.'[/ul]';
+ break;
+ }
}
- }
- if ($s)
- $infobox[] = implode('[br]', $s);
-
- // end
- $end = '[icon name=quest_end'.($quest->isDaily() ? '_daily' : '').']'.lang::$event['end'].Lang::$colon.'[/icon]';
- $e = [];
- foreach ($startEnd as $se)
- {
- if ($se['method'] & 0x2)
- {
- Util::$pageTemplate->extendGlobalIds($se['type'], $se['typeId']);
- $e[] = ($e ? '[span=invisible]'.$end.'[/span] ' : $end.' ') . '['.Util::$typeStrings[$se['type']].'='.$se['typeId'].']';
- }
- }
-
- if ($e)
- $infobox[] = implode('[br]', $e);
-
- // Repeatable
- if ($_flags & QUEST_FLAG_REPEATABLE || $_specialFlags & QUEST_FLAG_SPECIAL_REPEATABLE)
- $infobox[] = Lang::$quest['repeatable'];
-
- // sharable | not sharable
- $infobox[] = $_flags & QUEST_FLAG_SHARABLE ? Lang::$quest['sharable'] : Lang::$quest['notSharable'];
-
- // Keeps you PvP flagged
- if ($quest->isPvPEnabled())
- $infobox[] = Lang::$quest['keepsPvpFlag'];
-
- // difficulty (todo (low): formula unclear. seems to be [minLevel,] -4, -2, (level), +3, +(9 to 15))
- if ($_level > 0)
- {
+ // type (maybe expand uppon?)
$_ = [];
- if ($_minLevel && $_minLevel < $_level - 4)
- $_[] = '[color=q10]'.$_minLevel.'[/color]'; // red
+ if ($_flags & QUEST_FLAG_DAILY)
+ $_[] = Lang::$quest['daily'];
+ else if ($_flags & QUEST_FLAG_WEEKLY)
+ $_[] = Lang::$quest['weekly'];
+ else if ($_specialFlags & QUEST_FLAG_SPECIAL_MONTHLY)
+ $_[] = Lang::$quest['monthly'];
- if (!$_minLevel || $_minLevel < $_level - 2) // orange
- $_[] = '[color=r1]'.(!$_ && $_minLevel > $_level - 4 ? $_minLevel : $_level - 4).'[/color]';
-
- $_[] = '[color=r2]'.(!$_ && $_minLevel > $_level - 2 ? $_minLevel : $_level - 2).'[/color]'; // yellow
- $_[] = '[color=r3]'.($_level + 3).'[/color]'; // green
- $_[] = '[color=r4]'.($_level + 3 + ceil(12 * $_level / MAX_LEVEL)).'[/color]'; // grey (is about +/-1 level off)
+ if ($t = $this->subject->getField('type'))
+ $_[] = Lang::$quest['questInfo'][$t];
if ($_)
- $infobox[] = Lang::$game['difficulty'].Lang::$colon.implode('[small] [/small]', $_);
- }
+ $infobox[] = Lang::$game['type'].Lang::$main['colon'].implode(' ', $_);
- /**********/
- /* Series */
- /**********/
-
- $series = [];
-
- // Quest Chain (are there cases where quests go in parallel?)
- $chain = array(
- array(
- array(
- 'side' => $_side,
- 'typeStr' => Util::$typeStrings[TYPE_QUEST],
- 'typeId' => $_id,
- 'name' => $_name,
- '_next' => $quest->getField('nextQuestIdChain')
- )
- )
- );
-
- $_ = $chain[0][0];
- while ($_)
- {
- if ($_ = DB::Aowow()->selectRow('SELECT id AS typeId, name_loc0, name_loc2, name_loc3, name_loc6, name_loc8, reqRaceMask FROM ?_quests WHERE nextQuestIdChain = ?d', $_['typeId']))
+ // side
+ $_ = Lang::$main['side'].Lang::$main['colon'];
+ switch ($_side)
{
- $n = Util::localizedString($_, 'name');
- array_unshift($chain, array(
- array(
- 'side' => Util::sideByRaceMask($_['reqRaceMask']),
- 'typeStr' => Util::$typeStrings[TYPE_QUEST],
- 'typeId' => $_['typeId'],
- 'name' => strlen($n) > 40 ? substr($n, 0, 40).'…' : $n
- )
- ));
- }
- }
-
- $_ = end($chain)[0];
- while($_)
- {
- if ($_ = DB::Aowow()->selectRow('SELECT id AS typeId, name_loc0, name_loc2, name_loc3, name_loc6, name_loc8, reqRaceMask, nextQuestIdChain AS _next FROM ?_quests WHERE id = ?d', $_['_next']))
- {
- $n = Util::localizedString($_, 'name');
- array_push($chain, array(
- array(
- 'side' => Util::sideByRaceMask($_['reqRaceMask']),
- 'typeStr' => Util::$typeStrings[TYPE_QUEST],
- 'typeId' => $_['typeId'],
- 'name' => strlen($n) > 40 ? substr($n, 0, 40).'…' : $n,
- '_next' => $_['_next'],
- )
- ));
- }
- }
-
- if (count($chain) > 1)
- $series[] = [$chain, null];
-
-
- // todo (low): sensibly merge te following lists into 'series'
- $listGen = function($cnd)
- {
- $chain = [];
- $list = new QuestList($cnd);
- if ($list->error)
- return null;
-
- foreach ($list->iterate() as $id => $__)
- {
- $n = $list->getField('name', true);
- $chain[] = array(array(
- 'side' => Util::sideByRaceMask($list->getField('reqRaceMask')),
- 'typeStr' => Util::$typeStrings[TYPE_QUEST],
- 'typeId' => $id,
- 'name' => strlen($n) > 40 ? substr($n, 0, 40).'…' : $n
- ));
+ case 3: $infobox[] = $_.Lang::$game['si'][3]; break;
+ case 2: $infobox[] = $_.'[span class=icon-horde]'.Lang::$game['si'][2].'[/span]'; break;
+ case 1: $infobox[] = $_.'[span class=icon-alliance]'.Lang::$game['si'][1].'[/span]'; break;
}
- return $chain;
- };
-
- $extraLists = array(
- array( // Requires all of these quests (Quests that you must follow to get this quest)
- 'reqQ',
- array(
- 'OR',
- ['AND', ['nextQuestId', $_id], ['exclusiveGroup', 0, '<']],
- ['AND', ['id', $quest->getField('prevQuestId')], ['nextQuestIdChain', $_id, '!']]
- )
- ),
- array( // Requires one of these quests (Requires one of the quests to choose from)
- 'reqOneQ',
- [['exclusiveGroup', 0, '>'], ['nextQuestId', $_id]]
- ),
- array( // Opens Quests (Quests that become available only after complete this quest (optionally only one))
- 'opensQ',
- array(
- 'OR',
- ['AND', ['prevQuestId', $_id], ['id', $quest->getField('nextQuestIdChain'), '!']],
- ['id', $quest->getField('nextQuestId')]
- )
- ),
- array( // Closes Quests (Quests that become inaccessible after completing this quest)
- 'closesQ',
- [['exclusiveGroup', 0, '!'], ['exclusiveGroup', $quest->getField('exclusiveGroup')], ['id', $_id, '!']]
- ),
- array( // During the quest available these quests (Quests that are available only at run time this quest)
- 'enablesQ',
- [['prevQuestId', -$_id]]
- ),
- array( // Requires an active quest (Quests during the execution of which is available on the quest)
- 'enabledByQ',
- [['id', -$quest->getField('prevQuestId')]]
- )
- );
-
- foreach ($extraLists as $el)
- if ($_ = $listGen($el[1]))
- $series[] = [$_, sprintf(Util::$dfnString, Lang::$quest[$el[0].'Desc'], Lang::$quest[$el[0]])];
-
-
- /*******************/
- /* Objectives List */
- /*******************/
-
- $objectiveList = [];
-
- $srcItemId = $quest->getField('sourceItemId');
- if ($srcItemId)
- {
- $item = new itemList(array(['id', $srcItemId]));
- if (!$item->error)
+ // races
+ if ($_ = Lang::getRaceString($this->subject->getField('reqRaceMask'), $__, $jsg, $n, false))
{
- $item->addGlobalsToJscript();
- $objectiveList[] = array(
- 'typeStr' => Util::$typeStrings[TYPE_ITEM],
- 'id' => $srcItemId,
- 'name' => $item->getField('name', true),
- 'qty' => $quest->getField('sourceItemCount'),
- 'quality' => $item->getField('quality'),
+ $this->extendGlobalIds(TYPE_RACE, $jsg);
+ $t = $n == 1 ? Lang::$game['race'] : Lang::$game['races'];
+ $infobox[] = Util::ucFirst($t).Lang::$main['colon'].$_;
+ }
+
+ // classes
+ if ($_ = Lang::getClassString($this->subject->getField('reqClassMask'), $jsg, $n, false))
+ {
+ $this->extendGlobalIds(TYPE_CLASS, $jsg);
+ $t = $n == 1 ? Lang::$game['class'] : Lang::$game['classes'];
+ $infobox[] = Util::ucFirst($t).Lang::$main['colon'].$_;
+ }
+
+ // profession / skill
+ if ($_ = $this->subject->getField('reqSkillId'))
+ {
+ $this->extendGlobalIds(TYPE_SKILL, $_);
+ $sk = '[skill='.$_.']';
+ if ($_ = $this->subject->getField('reqSkillPoints'))
+ $sk .= ' ('.$_.')';
+
+ $infobox[] = Lang::$quest['profession'].Lang::$main['colon'].$sk;
+ }
+
+ // timer
+ if ($_ = $this->subject->getField('timeLimit'))
+ $infobox[] = Lang::$quest['timer'].Lang::$main['colon'].Util::formatTime($_ * 1000);
+
+ $startEnd = DB::Aowow()->select('SELECT * FROM ?_quests_startend WHERE questId = ?d', $this->typeId);
+
+ // start
+ $start = '[icon name=quest_start'.($this->subject->isDaily() ? '_daily' : '').']'.lang::$event['start'].Lang::$main['colon'].'[/icon]';
+ $s = [];
+ foreach ($startEnd as $se)
+ {
+ if ($se['method'] & 0x1)
+ {
+ $this->extendGlobalIds($se['type'], $se['typeId']);
+ $s[] = ($s ? '[span=invisible]'.$start.'[/span] ' : $start.' ') .'['.Util::$typeStrings[$se['type']].'='.$se['typeId'].']';
+ }
+ }
+
+ if ($s)
+ $infobox[] = implode('[br]', $s);
+
+ // end
+ $end = '[icon name=quest_end'.($this->subject->isDaily() ? '_daily' : '').']'.lang::$event['end'].Lang::$main['colon'].'[/icon]';
+ $e = [];
+ foreach ($startEnd as $se)
+ {
+ if ($se['method'] & 0x2)
+ {
+ $this->extendGlobalIds($se['type'], $se['typeId']);
+ $e[] = ($e ? '[span=invisible]'.$end.'[/span] ' : $end.' ') . '['.Util::$typeStrings[$se['type']].'='.$se['typeId'].']';
+ }
+ }
+
+ if ($e)
+ $infobox[] = implode('[br]', $e);
+
+ // Repeatable
+ if ($_flags & QUEST_FLAG_REPEATABLE || $_specialFlags & QUEST_FLAG_SPECIAL_REPEATABLE)
+ $infobox[] = Lang::$quest['repeatable'];
+
+ // sharable | not sharable
+ $infobox[] = $_flags & QUEST_FLAG_SHARABLE ? Lang::$quest['sharable'] : Lang::$quest['notSharable'];
+
+ // Keeps you PvP flagged
+ if ($this->subject->isPvPEnabled())
+ $infobox[] = Lang::$quest['keepsPvpFlag'];
+
+ // difficulty (todo (low): formula unclear. seems to be [minLevel,] -4, -2, (level), +3, +(9 to 15))
+ if ($_level > 0)
+ {
+ $_ = [];
+
+ // red
+ if ($_minLevel && $_minLevel < $_level - 4)
+ $_[] = '[color=q10]'.$_minLevel.'[/color]';
+
+ // orange
+ if (!$_minLevel || $_minLevel < $_level - 2)
+ $_[] = '[color=r1]'.(!$_ && $_minLevel > $_level - 4 ? $_minLevel : $_level - 4).'[/color]';
+
+ // yellow
+ $_[] = '[color=r2]'.(!$_ && $_minLevel > $_level - 2 ? $_minLevel : $_level - 2).'[/color]';
+
+ // green
+ $_[] = '[color=r3]'.($_level + 3).'[/color]';
+
+ // grey (is about +/-1 level off)
+ $_[] = '[color=r4]'.($_level + 3 + ceil(12 * $_level / MAX_LEVEL)).'[/color]';
+
+ if ($_)
+ $infobox[] = Lang::$game['difficulty'].Lang::$main['colon'].implode('[small] [/small]', $_);
+ }
+
+ $this->infobox = '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]';
+
+ /**********/
+ /* Series */
+ /**********/
+
+ // Quest Chain (are there cases where quests go in parallel?)
+ $chain = array(
+ array(
+ array(
+ 'side' => $_side,
+ 'typeStr' => Util::$typeStrings[TYPE_QUEST],
+ 'typeId' => $this->typeId,
+ 'name' => $this->name,
+ '_next' => $this->subject->getField('nextQuestIdChain')
+ )
+ )
+ );
+
+ $_ = $chain[0][0];
+ while ($_)
+ {
+ if ($_ = DB::Aowow()->selectRow('SELECT id AS typeId, name_loc0, name_loc2, name_loc3, name_loc6, name_loc8, reqRaceMask FROM ?_quests WHERE nextQuestIdChain = ?d', $_['typeId']))
+ {
+ $n = Util::localizedString($_, 'name');
+ array_unshift($chain, array(
+ array(
+ 'side' => Util::sideByRaceMask($_['reqRaceMask']),
+ 'typeStr' => Util::$typeStrings[TYPE_QUEST],
+ 'typeId' => $_['typeId'],
+ 'name' => strlen($n) > 40 ? substr($n, 0, 40).'…' : $n
+ )
+ ));
+ }
+ }
+
+ $_ = end($chain)[0];
+ while ($_)
+ {
+ if ($_ = DB::Aowow()->selectRow('SELECT id AS typeId, name_loc0, name_loc2, name_loc3, name_loc6, name_loc8, reqRaceMask, nextQuestIdChain AS _next FROM ?_quests WHERE id = ?d', $_['_next']))
+ {
+ $n = Util::localizedString($_, 'name');
+ array_push($chain, array(
+ array(
+ 'side' => Util::sideByRaceMask($_['reqRaceMask']),
+ 'typeStr' => Util::$typeStrings[TYPE_QUEST],
+ 'typeId' => $_['typeId'],
+ 'name' => strlen($n) > 40 ? substr($n, 0, 40).'…' : $n,
+ '_next' => $_['_next'],
+ )
+ ));
+ }
+ }
+
+ if (count($chain) > 1)
+ $this->series[] = [$chain, null];
+
+
+ // todo (low): sensibly merge te following lists into 'series'
+ $listGen = function($cnd)
+ {
+ $chain = [];
+ $list = new QuestList($cnd);
+ if ($list->error)
+ return null;
+
+ foreach ($list->iterate() as $id => $__)
+ {
+ $n = $list->getField('name', true);
+ $chain[] = array(array(
+ 'side' => Util::sideByRaceMask($list->getField('reqRaceMask')),
+ 'typeStr' => Util::$typeStrings[TYPE_QUEST],
+ 'typeId' => $id,
+ 'name' => strlen($n) > 40 ? substr($n, 0, 40).'…' : $n
+ ));
+ }
+
+ return $chain;
+ };
+
+ $extraLists = array(
+ // Requires all of these quests (Quests that you must follow to get this quest)
+ ['reqQ', array('OR', ['AND', ['nextQuestId', $this->typeId], ['exclusiveGroup', 0, '<']], ['AND', ['id', $this->subject->getField('prevQuestId')], ['nextQuestIdChain', $this->typeId, '!']])],
+
+ // Requires one of these quests (Requires one of the quests to choose from)
+ ['reqOneQ', array(['exclusiveGroup', 0, '>'], ['nextQuestId', $this->typeId])],
+
+ // Opens Quests (Quests that become available only after complete this quest (optionally only one))
+ ['opensQ', array('OR', ['AND', ['prevQuestId', $this->typeId], ['id', $this->subject->getField('nextQuestIdChain'), '!']], ['id', $this->subject->getField('nextQuestId')])],
+
+ // Closes Quests (Quests that become inaccessible after completing this quest)
+ ['closesQ', array(['exclusiveGroup', 0, '!'], ['exclusiveGroup', $this->subject->getField('exclusiveGroup')], ['id', $this->typeId, '!'])],
+
+ // During the quest available these quests (Quests that are available only at run time this quest)
+ ['enablesQ', array(['prevQuestId', -$this->typeId])],
+
+ // Requires an active quest (Quests during the execution of which is available on the quest)
+ ['enabledByQ', array(['id', -$this->subject->getField('prevQuestId')])]
+ );
+
+ foreach ($extraLists as $el)
+ if ($_ = $listGen($el[1]))
+ $this->series[] = [$_, sprintf(Util::$dfnString, Lang::$quest[$el[0].'Desc'], Lang::$quest[$el[0]])];
+
+ /*******************/
+ /* Objectives List */
+ /*******************/
+
+ // gather ids for lookup
+ $olItems = $olNPCs = $olGOs = $olFactions = [];
+
+ // items
+ $olItems[0] = array( // srcItem on idx:0
+ $this->subject->getField('sourceItemId'),
+ $this->subject->getField('sourceItemCount')
+ );
+
+ for ($i = 1; $i < 7; $i++) // reqItem in idx:1-6
+ {
+ $id = $this->subject->getField('reqItemId'.$i);
+ $qty = $this->subject->getField('reqItemCount'.$i);
+ if (!$id || !$qty || $id == $olItems[0][0])
+ continue;
+
+ $olItems[$i] = [$id, $qty];
+ }
+
+ if ($ids = array_column($olItems, 0))
+ {
+ $olItemData = new ItemList(array(['id', $ids]));
+ $this->extendGlobalData($olItemData->getJSGlobals(GLOBALINFO_SELF));
+
+ foreach ($olItems as $i => $pair)
+ {
+ if (!$pair[0] || !in_array($pair[0], $olItemData->getFoundIDs()))
+ continue;
+
+ $this->objectiveList[] = array(
+ 'typeStr' => Util::$typeStrings[TYPE_ITEM],
+ 'id' => $pair[0],
+ 'name' => $olItemData->json[$pair[0]]['name'],
+ 'qty' => $pair[1] > 1 ? $pair[1] : 0,
+ 'quality' => 7 - $olItemData->json[$pair[0]]['quality'],
+ 'extraText' => $i ? '' : ' ('.Lang::$quest['provided'].')'
+ );
+ }
+ }
+
+ // creature or GO...
+ for ($i = 1; $i < 5; $i++)
+ {
+ $id = $this->subject->getField('reqNpcOrGo'.$i);
+ $qty = $this->subject->getField('reqNpcOrGoCount'.$i);
+ $altTxt = $this->subject->getField('objectiveText'.$i, true);
+ if ($id > 0 && $qty)
+ $olNPCs[$id] = [$qty, $altTxt, []];
+ else if ($id < 0 && $qty)
+ $olGOs[-$id] = [$qty, $altTxt];
+ }
+
+ // .. creature kills
+ if ($ids = array_keys($olNPCs))
+ {
+ $olNPCData = new CreatureList(array('OR', ['id', $ids], ['killCredit1', $ids], ['killCredit2', $ids]));
+ $this->extendGlobalData($olNPCData->getJSGlobals(GLOBALINFO_SELF));
+
+ // create proxy-references
+ foreach ($olNPCData->iterate() as $id => $__)
+ {
+ if ($p = $olNPCData->getField('KillCredit1'))
+ if (isset($olNPCs[$p]))
+ $olNPCs[$p][2][$id] = $olNPCData->getField('name', true);
+
+ if ($p = $olNPCData->getField('KillCredit2'))
+ if (isset($olNPCs[$p]))
+ $olNPCs[$p][2][$id] = $olNPCData->getField('name', true);
+ }
+
+ foreach ($olNPCs as $i => $pair)
+ {
+ if (!$i || !in_array($i, $olNPCData->getFoundIDs()))
+ continue;
+
+ $ol = array(
+ 'typeStr' => Util::$typeStrings[TYPE_NPC],
+ 'id' => $i,
+ 'name' => $pair[1] ?: Util::localizedString($olNPCData->getEntry($i), 'name'),
+ 'qty' => $pair[0] > 1 ? $pair[0] : 0,
+ 'extraText' => (($_specialFlags & QUEST_FLAG_SPECIAL_SPELLCAST) || $pair[1]) ? '' : ' '.Lang::$achievement['slain'],
+ 'proxy' => $pair[2]
+ );
+
+ if ($pair[2]) // has proxies assigned, add yourself as another proxy
+ $ol['proxy'][$i] = Util::localizedString($olNPCData->getEntry($i), 'name');
+
+ $this->objectiveList[] = $ol;
+ }
+ }
+
+ // .. GO interactions
+ if ($ids = array_keys($olGOs))
+ {
+ $olGOData = new GameObjectList(array(['id', $ids]));
+ $this->extendGlobalData($olGOData->getJSGlobals(GLOBALINFO_SELF));
+
+ foreach ($olNPCs as $i => $pair)
+ {
+ if (!$i || !in_array($i, $olGOData->getFoundIDs()))
+ continue;
+
+ $this->objectiveList[] = array(
+ 'typeStr' => Util::$typeStrings[TYPE_OBJECT],
+ 'id' => $i,
+ 'name' => $pair[1] ?: Util::localizedString($olGOData->getEntry($i), 'name'),
+ 'qty' => $pair[0] > 1 ? $pair[0] : 0,
+ );
+ }
+ }
+
+ // reputation required
+ for ($i = 1; $i < 3; $i++)
+ {
+ $id = $this->subject->getField('reqFactionId'.$i);
+ $val = $this->subject->getField('reqFactionValue'.$i);
+ if (!$id)
+ continue;
+
+ $olFactions[$id] = $val;
+ }
+
+ if ($ids = array_keys($olFactions))
+ {
+ $olFactionsData = new FactionList(array(['id', $ids]));
+ $this->extendGlobalData($olFactionsData->getJSGlobals(GLOBALINFO_SELF));
+
+ foreach ($olFactions as $i => $val)
+ {
+ if (!$i || !in_array($i, $olFactionsData->getFoundIDs()))
+ continue;
+
+ $this->objectiveList[] = array(
+ 'typeStr' => Util::$typeStrings[TYPE_FACTION],
+ 'id' => $i,
+ 'name' => Util::localizedString($olFactionsData->getEntry($i), 'name'),
+ 'qty' => sprintf(Util::$dfnString, $val.' '.Lang::$achievement['points'], Lang::getReputationLevelForPoints($val)),
+ 'extraText' => ''
+ );
+ }
+ }
+
+ // granted spell
+ if ($_ = $this->subject->getField('sourceSpellId'))
+ {
+ $this->extendGlobalIds(TYPE_SPELL, $_);
+ $this->objectiveList[] = array(
+ 'typeStr' => Util::$typeStrings[TYPE_SPELL],
+ 'id' => $_,
+ 'name' => SpellList::getName($_),
+ 'qty' => 0,
'extraText' => ' ('.Lang::$quest['provided'].')'
);
}
- }
- if ($_ = $quest->getField('sourceSpellId'))
- {
- Util::$pageTemplate->extendGlobalIds(TYPE_SPELL, $_);
- $objectiveList[] = array(
- 'typeStr' => Util::$typeStrings[TYPE_SPELL],
- 'id' => $_,
- 'name' => SpellList::getName($_),
- 'qty' => 0,
- 'quality' => '',
- 'extraText' => ' ('.Lang::$quest['provided'].')'
+ // required money
+ if ($this->subject->getField('rewardOrReqMoney') < 0)
+ $this->objectiveList[] = ['text' => Lang::$quest['reqMoney'].Lang::$main['colon'].Util::formatMoney(abs($this->subject->getField('rewardOrReqMoney')))];
+
+ // required pvp kills
+ if ($_ = $this->subject->getField('reqPlayerKills'))
+ $this->objectiveList[] = ['text' => Lang::$quest['playerSlain'].' ('.$_.')'];
+
+ /**********/
+ /* Mapper */
+ /**********/
+
+ /*
+ TODO (GODDAMNIT): jeez..
+ */
+
+ // $startend + reqNpcOrGo[1-4]
+
+ $this->map = array(
+ 'data' => ['zone' => $this->typeId],
+ // 'som' => json_encode($som, JSON_NUMERIC_CHECK)
);
- }
- for ($i = 1; $i < 5; $i++)
- {
- $id = $quest->getField('reqNpcOrGo'.$i);
- $qty = $quest->getField('reqNpcOrGoCount'.$i);
- $altTxt = $quest->getField('objectiveText'.$i, true);
- if (!$id || !$qty)
- continue;
+ /****************/
+ /* Main Content */
+ /****************/
- if ($id > 0)
+ $this->gains = $this->createGains();
+ $this->mail = $this->createMail($maTab);
+ $this->rewards = $this->createRewards();
+ $this->objectives = $this->subject->parseText('objectives', false);
+ $this->details = $this->subject->parseText('details', false);
+ $this->offerReward = $this->subject->parseText('offerReward', false);
+ $this->requestItems = $this->subject->parseText('requestItems', false);
+ $this->completed = $this->subject->parseText('completed', false);
+ $this->end = $this->subject->parseText('end', false);
+ $this->suggestedPl = $this->subject->getField('suggestedPlayers');
+ $this->unavailable = $_flags & QUEST_FLAG_UNAVAILABLE || $this->subject->getField('cuFlags') & CUSTOM_EXCLUDE_FOR_LISTVIEW;
+ $this->redButtons = array(
+ BUTTON_LINKS => ['color' => 'ffffff00', 'linkId' => 'quest:'.$this->typeId.':'.$_level.''],
+ BUTTON_WOWHEAD => true
+ );
+
+ if ($maTab)
+ $this->lvData[] = $maTab;
+
+ if ($_ = $this->subject->getField('reqMinRepFaction'))
{
- $proxy = new CreatureList(['OR', ['killCredit1', (int)$id], ['killCredit2', (int)$id]]);
- if (!$proxy->error)
- {
- // todo (low): now do it properly this time!
- $proxyList = ''.($altTxt ? $altTxt : CreatureList::getName($id)).((($_specialFlags & QUEST_FLAG_SPECIAL_SPELLCAST) || $altTxt) ? '' : ' '.Lang::$achievement['slain']).''.($qty > 1 ? ' ('.$qty.')' : null);
- $proxyList .= "
"];
- }
- else
- {
- $objectiveList[] = array(
- 'typeStr' => Util::$typeStrings[TYPE_NPC],
- 'id' => $id,
- 'name' => $altTxt ? $altTxt : CreatureList::getName($id),
- 'qty' => $qty,
- 'quality' => '',
- 'extraText' => (($_specialFlags & QUEST_FLAG_SPECIAL_SPELLCAST) || $altTxt) ? '' : ' '.Lang::$achievement['slain']
- );
- }
+ $val = $this->subject->getField('reqMinRepValue');
+ $this->reqMinRep = sprintf(Lang::$quest['reqRepWith'], $_, FactionList::getName($_), Lang::$quest['reqRepMin'], sprintf(Util::$dfnString, $val.' '.Lang::$achievement['points'], Lang::getReputationLevelForPoints($val)));
}
- else
+
+ if ($_ = $this->subject->getField('reqMaxRepFaction'))
{
- $objectiveList[] = array(
- 'typeStr' => Util::$typeStrings[TYPE_OBJECT],
- 'id' => -$id,
- 'name' => $altTxt ? $altTxt : GameObjectList::getName(-$id),
- 'qty' => $qty,
- 'quality' => '',
- 'extraText' => ''
+ $val = $this->subject->getField('reqMaxRepValue');
+ $this->reqMaxRep = sprintf(Lang::$quest['reqRepWith'], $_, FactionList::getName($_), Lang::$quest['reqRepMax'], sprintf(Util::$dfnString, $val.' '.Lang::$achievement['points'], Lang::getReputationLevelForPoints($val)));
+ }
+
+ // todo (low): create pendant from player_factionchange_quests
+
+ /**************/
+ /* Extra Tabs */
+ /**************/
+
+ // tab: see also
+ $seeAlso = new QuestList(array(['name_loc'.User::$localeId, '%'.$this->name.'%'], ['id', $this->typeId, '!']));
+ if (!$seeAlso->error)
+ {
+ $this->extendGlobalData($seeAlso->getJSGlobals());
+ $this->lvData[] = array(
+ 'file' => 'quest',
+ 'data' => $seeAlso->getListviewData(),
+ 'params' => [
+ 'tabs' => '$tabsRelated',
+ 'name' => '$LANG.tab_seealso',
+ 'id' => 'see-also'
+ ]
+ );
+ }
+
+ // tab: criteria of
+ $criteriaOf = new AchievementList(array(['ac.type', ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST], ['ac.value1', $this->typeId]));
+ if (!$criteriaOf->error)
+ {
+ $this->extendGlobalData($criteriaOf->getJSGlobals());
+ $this->lvData[] = array(
+ 'file' => 'achievement',
+ 'data' => $criteriaOf->getListviewData(),
+ 'params' => [
+ 'tabs' => '$tabsRelated',
+ 'name' => '$LANG.tab_criteriaof',
+ 'id' => 'criteria-of'
+ ]
);
}
}
- for ($i = 1; $i < 7; $i++)
- {
- $id = $quest->getField('reqItemId'.$i);
- $qty = $quest->getField('reqItemCount'.$i);
- if (!$id || !$qty || $id == $srcItemId)
- continue;
-
- $item = new itemList(array(['id', $id]));
- if (!$item->error)
- {
- $item->addGlobalsToJscript();
- $objectiveList[] = array(
- 'typeStr' => Util::$typeStrings[TYPE_ITEM],
- 'id' => $id,
- 'name' => $item->getField('name', true),
- 'qty' => $qty,
- 'quality' => $item->getField('quality'),
- 'extraText' => ''
- );
- }
- }
-
- for ($i = 1; $i < 3; $i++)
+ protected function generateTooltip($asError = false)
{
- $id = $quest->getField('reqFactionId'.$i);
- $val = $quest->getField('reqFactionValue'.$i);
- if (!$id)
- continue;
+ if ($asError)
+ return '$WowheadPower.registerQuest('.$this->typeId.', '.User::$localeId.', {});';
- $objectiveList[] = array(
- 'typeStr' => Util::$typeStrings[TYPE_FACTION],
- 'id' => $id,
- 'name' => FactionList::getName($id),
- 'qty' => '',
- 'quality' => '',
- 'extraText' => ' ('.sprintf(Util::$dfnString, $val.' '.Lang::$achievement['points'], Lang::getReputationLevelForPoints($val)).')'
- );
+ $x = '$WowheadPower.registerQuest('.$this->typeId.', '.User::$localeId.", {\n";
+ $x .= "\tname_".User::$localeString.": '".Util::jsEscape($this->subject->getField('name', true))."',\n";
+ $x .= "\ttooltip_".User::$localeString.': \''.$this->subject->renderTooltip()."'";
+ if ($this->subject->isDaily())
+ $x .= ",\n\tdaily: 1";
+ $x .= "\n});";
+
+ return $x;
}
- if ($_questMoney < 0)
- $objectiveList[] = ['text' => Lang::$quest['reqMoney'].Lang::$colon.Util::formatMoney(abs($_questMoney))];
-
- if ($_ = $quest->getField('reqPlayerKills'))
- $objectiveList[] = ['text' => Lang::$quest['playerSlain'].' ('.$_.')'];
-
-
- /**********/
- /* Mapper */
- /**********/
-
- /*
- TODO (GODDAMNIT): jeez..
- */
-
- // $startend + reqNpcOrGo[1-4]
- $map = [];
-
- /***********/
- /* Rewards */
- /***********/
-
- // rewards
- $rewards = [];
-
- $comp = $quest->getField('rewardMoneyMaxLevel');
- $money = '';
- if ($_questMoney > 0)
- $money .= Util::formatMoney($_questMoney);
- if ($_questMoney > 0 && $comp > 0)
- $money .= ' ' . sprintf(Lang::$quest['expConvert'], Util::formatMoney($_questMoney + $comp), MAX_LEVEL);
- else if ($_questMoney <= 0 && $_questMoney + $comp > 0)
- $money .= sprintf(Lang::$quest['expConvert2'], Util::formatMoney($_questMoney + $comp), MAX_LEVEL);
-
- $rewards['money'] = $money;
-
- if ($c = @$quest->choices[$_id][TYPE_ITEM])
+ public function display($override = '')
{
- $choiceItems = new ItemList(array(['id', array_keys($c)]));
- if (!$choiceItems->error)
+ if ($this->mode != CACHETYPE_TOOLTIP)
+ return parent::display($override);
+
+ if (!$this->loadCache($tt))
{
- $choiceItems->addGlobalsToJscript();
- foreach ($choiceItems->Iterate() as $id => $__)
+ $tt = $this->generateTooltip();
+ $this->saveCache($tt);
+ }
+
+ header('Content-type: application/x-javascript; charset=utf-8');
+ die($tt);
+ }
+
+ public function notFound($typeStr)
+ {
+ if ($this->mode != CACHETYPE_TOOLTIP)
+ return parent::notFound($typeStr);
+
+ header('Content-type: application/x-javascript; charset=utf-8');
+ echo $this->generateTooltip(true);
+ exit();
+ }
+
+ private function createRewards()
+ {
+ $rewards = [];
+
+ // moneyReward / maxLevelCompensation
+ $comp = $this->subject->getField('rewardMoneyMaxLevel');
+ $questMoney = $this->subject->getField('rewardOrReqMoney');
+ if ($questMoney > 0)
+ {
+ $rewards['money'] = Util::formatMoney($questMoney);
+ if ($comp > 0)
+ $rewards['money'] .= ' ' . sprintf(Lang::$quest['expConvert'], Util::formatMoney($questMoney + $comp), MAX_LEVEL);
+ }
+ else if ($questMoney <= 0 && $questMoney + $comp > 0)
+ $rewards['money'] = sprintf(Lang::$quest['expConvert2'], Util::formatMoney($questMoney + $comp), MAX_LEVEL);
+
+ // itemChoices
+ if ($c = @$this->subject->choices[$this->typeId][TYPE_ITEM])
+ {
+ $choiceItems = new ItemList(array(['id', array_keys($c)]));
+ if (!$choiceItems->error)
{
- $rewards['choice'][] = array(
- 'typeStr' => Util::$typeStrings[TYPE_ITEM],
- 'id' => $id,
- 'name' => $choiceItems->getField('name', true),
- 'quality' => $choiceItems->getField('quality'),
- 'qty' => $c[$id],
- 'globalStr' => 'g_items'
- );
+ $this->extendGlobalData($choiceItems->getJSGlobals());
+ foreach ($choiceItems->Iterate() as $id => $__)
+ {
+ $rewards['choice'][] = array(
+ 'typeStr' => Util::$typeStrings[TYPE_ITEM],
+ 'id' => $id,
+ 'name' => $choiceItems->getField('name', true),
+ 'quality' => $choiceItems->getField('quality'),
+ 'qty' => $c[$id],
+ 'globalStr' => 'g_items'
+ );
+ }
}
}
- }
- $rewards['items'] = []; // template requires initialization of this var
- if ($r = @$quest->rewards[$_id])
- {
- if (!empty($r[TYPE_ITEM]))
+ // itemRewards
+ if ($ri = @$this->subject->rewards[$this->typeId][TYPE_ITEM])
{
- $rewItems = new ItemList(array(['id', array_keys($r[TYPE_ITEM])]));
+ $rewItems = new ItemList(array(['id', array_keys($ri)]));
if (!$rewItems->error)
{
- $rewItems->addGlobalsToJscript();
+ $this->extendGlobalData($rewItems->getJSGlobals());
foreach ($rewItems->Iterate() as $id => $__)
{
$rewards['items'][] = array(
@@ -549,19 +691,19 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
'id' => $id,
'name' => $rewItems->getField('name', true),
'quality' => $rewItems->getField('quality'),
- 'qty' => $r[TYPE_ITEM][$id],
+ 'qty' => $ri[$id],
'globalStr' => 'g_items'
);
}
}
}
- if (!empty($r[TYPE_CURRENCY]))
+ if ($rc = @$this->subject->rewards[$this->typeId][TYPE_ITEM][TYPE_CURRENCY])
{
- $rewCurr = new CurrencyList(array(['id', array_keys($r[TYPE_CURRENCY])]));
+ $rewCurr = new CurrencyList(array(['id', array_keys($rc)]));
if (!$rewCurr->error)
{
- $rewCurr->addGlobalsToJscript();
+ $this->extendGlobalData($rewCurr->getJSGlobals());
foreach ($rewCurr->Iterate() as $id => $__)
{
$rewards['items'][] = array(
@@ -569,260 +711,167 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
'id' => $id,
'name' => $rewCurr->getField('name', true),
'quality' => 1,
- 'qty' => $r[TYPE_CURRENCY][$id] * ($_side == 2 ? -1 : 1), // toggles the icon
+ 'qty' => $rc[$id] * ($_side == 2 ? -1 : 1), // toggles the icon
'globalStr' => 'g_gatheredcurrencies'
);
}
}
}
- }
- $displ = $quest->getField('rewardSpell');
- $cast = $quest->getField('rewardSpellCast');
- if (!$cast && $displ)
- {
- $cast = $displ;
- $displ = 0;
- }
-
- if ($cast || $displ)
- {
- $rewSpells = new SpellList(array(['id', [$displ, $cast]]));
- $rewSpells->addGlobalsToJscript();
-
- if (User::isInGroup(U_GROUP_STAFF))
+ // spellRewards
+ $displ = $this->subject->getField('rewardSpell');
+ $cast = $this->subject->getField('rewardSpellCast');
+ if (!$cast && $displ)
{
- $extra = null;
- if ($_ = $rewSpells->getEntry($displ))
- $extra = sprintf(Lang::$quest['spellDisplayed'], $displ, Util::localizedString($_, 'name'));
-
- if ($_ = $rewSpells->getEntry($cast))
- {
- $rewards['spells']['extra'] = $extra;
- $rewards['spells']['cast'][] = array(
- 'typeStr' => Util::$typeStrings[TYPE_SPELL],
- 'id' => $cast,
- 'name' => Util::localizedString($_, 'name'),
- 'globalStr' => 'g_spells'
- );
- }
+ $cast = $displ;
+ $displ = 0;
}
- else // check if we have a learn spell
- {
- $teach = [];
- foreach ($rewSpells->iterate() as $id => $__)
- if ($_ = $rewSpells->canTeachSpell())
- foreach ($_ as $idx)
- $teach[$rewSpells->getField('effect'.$idx.'TriggerSpell')] = $id;
- if ($_ = $rewSpells->getEntry($displ))
+ if ($cast || $displ)
+ {
+ $rewSpells = new SpellList(array(['id', [$displ, $cast]]));
+ $this->extendGlobalData($rewSpells->getJSGlobals());
+
+ if (User::isInGroup(U_GROUP_EMPLOYEE)) // accurately display, what spell is what
{
- $rewards['spells']['extra'] = null;
- $rewards['spells'][$teach ? 'learn' : 'cast'][] = array(
- 'typeStr' => Util::$typeStrings[TYPE_SPELL],
- 'id' => $displ,
- 'name' => Util::localizedString($_, 'name'),
- 'globalStr' => 'g_spells'
- );
- }
- else if (($_ = $rewSpells->getEntry($cast)) && !$teach)
- {
- $rewards['spells']['extra'] = null;
- $rewards['spells']['cast'][] = array(
- 'typeStr' => Util::$typeStrings[TYPE_SPELL],
- 'id' => $cast,
- 'name' => Util::localizedString($_, 'name'),
- 'globalStr' => 'g_spells'
- );
- }
- else
- {
- $taught = new SpellList(array(['id', array_keys($teach)]));
- if (!$taught->error)
+ $extra = null;
+ if ($_ = $rewSpells->getEntry($displ))
+ $extra = sprintf(Lang::$quest['spellDisplayed'], $displ, Util::localizedString($_, 'name'));
+
+ if ($_ = $rewSpells->getEntry($cast))
+ {
+ $rewards['spells']['extra'] = $extra;
+ $rewards['spells']['cast'][] = array(
+ 'typeStr' => Util::$typeStrings[TYPE_SPELL],
+ 'id' => $cast,
+ 'name' => Util::localizedString($_, 'name'),
+ 'globalStr' => 'g_spells'
+ );
+ }
+ }
+ else // if it has effect:learnSpell display the taught spell instead
+ {
+ $teach = [];
+ foreach ($rewSpells->iterate() as $id => $__)
+ if ($_ = $rewSpells->canTeachSpell())
+ foreach ($_ as $idx)
+ $teach[$rewSpells->getField('effect'.$idx.'TriggerSpell')] = $id;
+
+ if ($_ = $rewSpells->getEntry($displ))
+ {
+ $rewards['spells']['extra'] = null;
+ $rewards['spells'][$teach ? 'learn' : 'cast'][] = array(
+ 'typeStr' => Util::$typeStrings[TYPE_SPELL],
+ 'id' => $displ,
+ 'name' => Util::localizedString($_, 'name'),
+ 'globalStr' => 'g_spells'
+ );
+ }
+ else if (($_ = $rewSpells->getEntry($cast)) && !$teach)
{
- $taught->addGlobalsToJscript();
$rewards['spells']['extra'] = null;
- foreach ($taught->iterate() as $id => $__)
+ $rewards['spells']['cast'][] = array(
+ 'typeStr' => Util::$typeStrings[TYPE_SPELL],
+ 'id' => $cast,
+ 'name' => Util::localizedString($_, 'name'),
+ 'globalStr' => 'g_spells'
+ );
+ }
+ else
+ {
+ $taught = new SpellList(array(['id', array_keys($teach)]));
+ if (!$taught->error)
{
- $rewards['spells']['learn'][] = array(
- 'typeStr' => Util::$typeStrings[TYPE_SPELL],
- 'id' => $id,
- 'name' => $taught->getField('name', true),
- 'globalStr' => 'g_spells'
- );
+ $this->extendGlobalData($taught->getJSGlobals());
+ $rewards['spells']['extra'] = null;
+ foreach ($taught->iterate() as $id => $__)
+ {
+ $rewards['spells']['learn'][] = array(
+ 'typeStr' => Util::$typeStrings[TYPE_SPELL],
+ 'id' => $id,
+ 'name' => $taught->getField('name', true),
+ 'globalStr' => 'g_spells'
+ );
+ }
}
}
}
}
+
+ return $rewards;
}
- // gains
- $gains = [];
-
- if ($_ = $quest->getField('rewardXP'))
- $gains['xp'] = $_;
-
- if ($_ = $quest->getField('rewardTalents'))
- $gains['tp'] = $_;
-
-
- for ($i = 1; $i < 6; $i++)
+ private function createMail(&$attachmentTab)
{
- $fac = $quest->getField('rewardFactionId'.$i);
- $qty = $quest->getField('rewardFactionValue'.$i);
- if (!$fac || !$qty)
- continue;
+ $mail = [];
- $gains['rep'][] = array(
- 'qty' => $qty,
- 'id' => $fac,
- 'name' => FactionList::getName($fac)
- );
- }
-
- if ($_ = (new TitleList(array(['id', $quest->getField('rewardTitleId')])))->getHtmlizedName())
- $gains['title'] = sprintf(Lang::$quest['theTitle'], $_);
-
- // reward mail
- $mail = [];
- $relTabs = [];
- if ($_ = $quest->getField('rewardMailTemplateId'))
- {
- $delay = $quest->getField('rewardMailDelay');
- $letter = DB::Aowow()->selectRow('SELECT * FROM ?_mailTemplate WHERE id = ?d', $_);
-
- $mail = array(
- 'delay' => $delay ? sprintf(Lang::$quest['mailIn'], Util::formatTime($delay * 1000)) : null,
- 'text' => $letter ? Util::parseHtmlText(Util::localizedString($letter, 'text')) : null,
- 'subject' => Util::parseHtmlText(Util::localizedString($letter, 'subject'))
- );
-
- $extraCols = ['Listview.extraCols.percent'];
- if ($loot = Util::handleLoot(LOOT_MAIL, $_, User::isInGroup(U_GROUP_STAFF), $extraCols))
+ if ($_ = $this->subject->getField('rewardMailTemplateId'))
{
- $relTabs[] = array(
- 'file' => 'item',
- 'data' => $loot,
- 'params' => [
- 'tabs' => '$tabsRelated',
- 'name' => '[Mail Attachments]',
- 'id' => 'mail-attachments',
- 'extraCols' => "$[".implode(', ', array_unique($extraCols))."]",
- 'hiddenCols' => "$".json_encode(['side', 'slot', 'reqlevel'])
- ]
+ $delay = $this->subject->getField('rewardMailDelay');
+ $letter = DB::Aowow()->selectRow('SELECT * FROM ?_mailTemplate WHERE id = ?d', $_);
+
+ $mail = array(
+ 'delay' => $delay ? sprintf(Lang::$quest['mailIn'], Util::formatTime($delay * 1000)) : null,
+ 'text' => $letter ? Util::parseHtmlText(Util::localizedString($letter, 'text')) : null,
+ 'subject' => Util::parseHtmlText(Util::localizedString($letter, 'subject'))
+ );
+
+ $extraCols = ['Listview.extraCols.percent'];
+ $mailLoot = new Loot();
+
+ if ($mailLoot->getByContainer(LOOT_MAIL, $_))
+ {
+ $this->extendGlobalData($mailLoot->jsGlobals);
+ $attachmentTab = array(
+ 'file' => 'item',
+ 'data' => $mailLoot->getResult(),
+ 'params' => [
+ 'tabs' => '$tabsRelated',
+ 'name' => '[Mail Attachments]',
+ 'id' => 'mail-attachments',
+ 'extraCols' => "$[".implode(', ', array_merge($extraCols, $mailLoot->extraCols))."]",
+ 'hiddenCols' => "$['side', 'slot', 'reqlevel']"
+ ]
+ );
+ }
+ }
+
+ return $mail;
+ }
+
+ private function createGains()
+ {
+ $gains = [];
+
+ // xp
+ if ($_ = $this->subject->getField('rewardXP'))
+ $gains['xp'] = $_;
+
+ // talent points
+ if ($_ = $this->subject->getField('rewardTalents'))
+ $gains['tp'] = $_;
+
+ // reputation
+ for ($i = 1; $i < 6; $i++)
+ {
+ $fac = $this->subject->getField('rewardFactionId'.$i);
+ $qty = $this->subject->getField('rewardFactionValue'.$i);
+ if (!$fac || !$qty)
+ continue;
+
+ $gains['rep'][] = array(
+ 'qty' => $qty,
+ 'id' => $fac,
+ 'name' => FactionList::getName($fac)
);
}
+
+ // title
+ if ($_ = (new TitleList(array(['id', $this->subject->getField('rewardTitleId')])))->getHtmlizedName())
+ $gains['title'] = $_;
+
+ return $gains;
}
-
- /****************/
- /* Main Content */
- /****************/
-
- // menuId 3: Quest g_initPath()
- // tabId 0: Database g_initHeader()
- $pageData = array(
- 'page' => array(
- 'title' => $_name.' - '.Util::ucFirst(Lang::$game['quest']),
- 'name' => $_name,
- 'path' => json_encode($_path, JSON_NUMERIC_CHECK),
- 'tab' => 0,
- 'type' => TYPE_QUEST,
- 'typeId' => $_id,
- 'objectives' => $quest->parseText('objectives', false),
- 'details' => $quest->parseText('details', false),
- 'offerReward' => $quest->parseText('offerReward', false),
- 'requestItems' => $quest->parseText('requestItems', false),
- 'completed' => $quest->parseText('completed', false),
- 'end' => $quest->parseText('end', false),
- 'suggestedPl' => $quest->getField('suggestedPlayers'),
- 'infobox' => '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]',
- 'series' => $series,
- 'objectiveList' => $objectiveList,
- 'rewards' => $rewards,
- 'gains' => $gains,
- 'mail' => $mail,
- // 'map' => array(
- // 'data' => ['zone' => $_id],
- // 'som' => json_encode($som, JSON_NUMERIC_CHECK)
- // ),
- 'reqJS' => array(
- // $map ? STATIC_URL.'/js/Mapper.js' : null
- ),
- 'reqCSS' => array(
- ['path' => STATIC_URL.'/css/Book.css'],
- // $map ? ['path' => STATIC_URL.'/css/Mapper.css'] : null,
- // $map ? ['path' => STATIC_URL.'/css/Mapper_ie6.css', 'ieCond' => 'lte IE 6'] : null
- ),
- 'redButtons' => array(
- BUTTON_LINKS => ['color' => 'ffffff00', 'linkId' => 'quest:'.$_id.':'.$_level.''],
- BUTTON_WOWHEAD => true
- )
- ),
- 'relTabs' => $relTabs
- );
-
- if ($_flags & QUEST_FLAG_UNAVAILABLE || $quest->getField('cuFlags') & CUSTOM_EXCLUDE_FOR_LISTVIEW)
- $pageData['page']['unavailable'] = true;
-
- if ($_ = $quest->getField('reqMinRepFaction'))
- {
- $val = $quest->getField('reqMinRepValue');
- $pageData['page']['reqMinRep'] = sprintf(Lang::$quest['reqRepWith'], $_, FactionList::getName($_), Lang::$quest['reqRepMin'], sprintf(Util::$dfnString, $val.' '.Lang::$achievement['points'], Lang::getReputationLevelForPoints($val)));
- }
-
- if ($_ = $quest->getField('reqMaxRepFaction'))
- {
- $val = $quest->getField('reqMaxRepValue');
- $pageData['page']['reqMaxRep'] = sprintf(Lang::$quest['reqRepWith'], $_, FactionList::getName($_), Lang::$quest['reqRepMax'], sprintf(Util::$dfnString, $val.' '.Lang::$achievement['points'], Lang::getReputationLevelForPoints($val)));
- }
-
-
- /**************/
- /* Extra Tabs */
- /**************/
-
- // tab: see also
- $seeAlso = new QuestList(array(['name_loc'.User::$localeId, '%'.$_name.'%'], ['id', $_id, '!']));
- if (!$seeAlso->error)
- {
- $seeAlso->addGlobalsToJScript();
- $pageData['relTabs'][] = array(
- 'file' => 'quest',
- 'data' => $seeAlso->getListviewData(),
- 'params' => [
- 'tabs' => '$tabsRelated',
- 'name' => '$LANG.tab_seealso',
- 'id' => 'see-also'
- ]
- );
- }
-
- // tab: criteria of
- $criteriaOf = new AchievementList(array(['ac.type', ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST], ['ac.value1', $_id]));
- if (!$criteriaOf->error)
- {
- $criteriaOf->addGlobalsToJScript();
- $pageData['relTabs'][] = array(
- 'file' => 'achievement',
- 'data' => $criteriaOf->getListviewData(),
- 'params' => [
- 'tabs' => '$tabsRelated',
- 'name' => '$LANG.tab_criteriaof',
- 'id' => 'criteria-of'
- ]
- );
- }
-
- $smarty->saveCache($cacheKeyPage, $pageData);
}
-
-$smarty->updatePageVars($pageData['page']);
-$smarty->assign('community', CommunityContent::getAll(TYPE_QUEST, $_id)); // comments, screenshots, videos
-$smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$item, Lang::$achievement, Lang::$npc, Lang::$quest, ['colon' => Lang::$colon]));
-$smarty->assign('lvData', $pageData['relTabs']);
-
-// load the page
-$smarty->display('quest.tpl');
-
?>
diff --git a/pages/quests.php b/pages/quests.php
index 5dcfd4d4..c31e344d 100644
--- a/pages/quests.php
+++ b/pages/quests.php
@@ -3,96 +3,97 @@
if (!defined('AOWOW_REVISION'))
die('illegal access');
-$filter = [];
-$cat = Util::extractURLParams($pageParam); // 0: type; 1:zoneOrSort
-$path = [0, 3];
-$title = [Util::ucFirst(Lang::$game['quests'])];
-$cacheKey = implode('_', [CACHETYPE_PAGE, TYPE_QUEST, -1, $cat ? implode('.', $cat) : -1, User::$localeId]);
-$validCats = Util::$questClasses; // to be reviewed
-
-if (!Util::isValidPage($validCats, $cat))
- $smarty->error();
-
-if (!$smarty->loadCache($cacheKey, $pageData, $filter))
+// menuId 3: Quest g_initPath()
+// tabId 0: Database g_initHeader()
+class QuestsPage extends GenericPage
{
- $conditions = [];
+ use ListPage;
- if ($cat)
+ protected $type = TYPE_QUEST;
+ protected $tpl = 'quests';
+ protected $path = [0, 3];
+ protected $tabId = 0;
+ protected $mode = CACHETYPE_PAGE;
+ protected $validCats = [];
+ protected $js = ['filters.js'];
+
+ public function __construct($pageCall, $pageParam)
{
- // path
- for ($i = 0; $i < count($cat); $i++)
- $path[] = $cat[$i];
+ $this->validCats = Util::$questClasses; // needs reviewing (not allowed to set this as default)
- // title
+ $this->filterObj = new QuestListFilter();
+ $this->getCategoryFromUrl($pageParam);;
+
+ parent::__construct();
+
+ $this->name = Util::ucFirst(Lang::$game['quests']);
+ $this->subCat = $pageParam ? '='.$pageParam : '';
+ }
+
+ protected function generateContent()
+ {
+ $conditions = [];
// cnd
- if (isset($cat[1]))
- $conditions[] = ['zoneOrSort', $cat[1]];
- else if (isset($cat[0]))
- $conditions[] = ['zoneOrSort', $validCats[$cat[0]]];
+ if (isset($this->category[1]))
+ $conditions[] = ['zoneOrSort', $this->category[1]];
+ else if (isset($this->category[0]))
+ $conditions[] = ['zoneOrSort', $this->validCats[$this->category[0]]];
+
+ if ($_ = $this->filterObj->getConditions())
+ $conditions[] = $_;
+
+ $quests = new QuestList($conditions, ['extraOpts' => $this->filterObj->extraOpts]);
+
+ $this->extendGlobalData($quests->getJSGlobals());
+
+ // recreate form selection
+ $this->filter = array_merge($this->filterObj->getForm('form'), $this->filter);
+ $this->filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : NULL;
+ $this->filter['fi'] = $this->filterObj->getForm();
+
+ $lv = array(
+ 'file' => 'quest',
+ 'data' => $quests->getListviewData(),
+ 'params' => []
+ );
+
+ if (!empty($this->filter['fi']['extraCols']))
+ $lv['params']['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)';
+
+ // create note if search limit was exceeded
+ if ($quests->getMatches() > CFG_SQL_LIMIT_DEFAULT)
+ {
+ $lv['params']['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_questsfound', $quests->getMatches(), CFG_SQL_LIMIT_DEFAULT);
+ $lv['params']['_truncated'] = 1;
+ }
+ else if (isset($this->category[1]) && $this->category[1] > 0)
+ $lv['params']['note'] = '$$WH.sprintf(LANG.lvnote_questgivers, '.$this->category[1].', g_zones['.$this->category[1].'], '.$this->category[1].')';
+
+ if ($this->filterObj->error)
+ $lv['params']['_errors'] = '$1';
+
+ $this->lvData = $lv;
}
- $questFilter = new QuestListFilter();
-
- if ($_ = $questFilter->getConditions())
- $conditions[] = $_;
-
- $quests = new QuestList($conditions, ['extraOpts' => $questFilter->extraOpts]);
-
- $quests->addGlobalsToJscript();
-
- // recreate form selection
- $filter = array_merge($questFilter->getForm('form'), $filter);
- $filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : NULL;
- $filter['fi'] = $questFilter->getForm();
-
- $lv = array(
- 'file' => 'quest',
- 'data' => $quests->getListviewData(),
- 'params' => []
- );
-
- if (!empty($filter['fi']['extraCols']))
- $lv['params']['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)';
-
- // create note if search limit was exceeded
- if ($quests->getMatches() > CFG_SQL_LIMIT_DEFAULT)
+ protected function generateTitle()
{
- $lv['params']['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_questsfound', $quests->getMatches(), CFG_SQL_LIMIT_DEFAULT);
- $lv['params']['_truncated'] = 1;
+ array_unshift($this->title, $this->name);
+
+ if (isset($this->category[1]))
+ array_unshift($this->title, Lang::$quest['cat'][$this->category[0]][$this->category[1]]);
+ else if (isset($this->category[0]))
+ {
+ $c0 = Lang::$quest['cat'][$this->category[0]];
+ array_unshift($this->title, is_array($c0) ? $c0[0] : $c0);
+ }
}
- else if (isset($cat[1]) && $cat[1] > 0)
- $lv['params']['note'] = '$$WH.sprintf(LANG.lvnote_questgivers, '.$cat[1].', g_zones['.$cat[1].'], '.$cat[1].')';
- if ($questFilter->error)
- $lv['params']['_errors'] = '$1';
-
-
- // menuId 3: Quest g_initPath()
- // tabId 0: Database g_initHeader()
- $pageData = array(
- 'page' => array(
- 'title' => implode(' - ', $title),
- 'path' => json_encode($path, JSON_NUMERIC_CHECK),
- 'tab' => 0,
- 'subCat' => $pageParam ? '='.$pageParam : '',
- 'reqJS' => array(
- STATIC_URL.'/js/filters.js'
- )
- ),
- 'lv' => $lv
- );
-
- $smarty->saveCache($cacheKey, $pageData, $filter);
+ protected function generatePath()
+ {
+ foreach ($this->category as $c)
+ $this->path[] = $c;
+ }
}
-
-$smarty->updatePageVars($pageData['page']);
-$smarty->assign('filter', $filter);
-$smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$quest, ['colon' => Lang::$colon]));
-$smarty->assign('lvData', $pageData['lv']);
-
-// load the page
-$smarty->display('quests.tpl');
-
?>
diff --git a/pages/skills.php b/pages/skills.php
index 88672a6b..5abd3114 100644
--- a/pages/skills.php
+++ b/pages/skills.php
@@ -29,8 +29,8 @@ class SkillsPage extends GenericPage
protected function generateContent()
{
$conditions = [];
- if (User::isInGroup(U_GROUP_EMPLOYEE))
- $conditions[] = ['categoryId', 12, '!']; // GENERIC (DND)
+ if (!User::isInGroup(U_GROUP_EMPLOYEE))
+ $conditions[] = ['categoryId', 12, '!']; // GENERIC (DND)
if ($this->category)
$conditions[] = ['typeCat', $this->category[0]];
diff --git a/pages/spells.php b/pages/spells.php
index a4c8dc92..af02d346 100644
--- a/pages/spells.php
+++ b/pages/spells.php
@@ -85,6 +85,7 @@ class SpellsPage extends GenericPage
public function __construct($pageCall, $pageParam)
{
+ $this->filterObj = new SpellListFilter();
$this->getCategoryFromUrl($pageParam);;
parent::__construct();
@@ -355,8 +356,7 @@ class SpellsPage extends GenericPage
}
}
- $spellFilter = new SpellListFilter();
- if ($_ = $spellFilter->getConditions())
+ if ($_ = $this->filterObj->getConditions())
$conditions[] = $_;
$spells = new SpellList($conditions);
@@ -365,9 +365,9 @@ class SpellsPage extends GenericPage
$this->lvData['data'] = $spells->getListviewData();
// recreate form selection
- $this->filter = array_merge($spellFilter->getForm('form'), $this->filter);
+ $this->filter = array_merge($this->filterObj->getForm('form'), $this->filter);
$this->filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : NULL;
- $this->filter['fi'] = $spellFilter->getForm();
+ $this->filter['fi'] = $this->filterObj->getForm();
if (!empty($this->filter['fi']['extraCols']))
$this->lvData['params']['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)';
@@ -379,7 +379,7 @@ class SpellsPage extends GenericPage
$this->lvData['params']['_truncated'] = 1;
}
- if ($spellFilter->error)
+ if ($this->filterObj->error)
$this->lvData['params']['_errors'] = '$1';
$mask = $spells->hasSetFields(['reagent1', 'skillLines', 'trainingCost']);
@@ -433,7 +433,7 @@ class SpellsPage extends GenericPage
foreach ($this->category as $c)
$this->path[] = $c;
- $form = (new SpellListFilter())->getForm('form');
+ $form = $this->filterObj->getForm('form');
if (count($this->path) == 4 && $this->category[0] == -13 && isset($form['gl']) && !is_array($form['gl']))
$this->path[] = $form['gl'];
}
diff --git a/pages/zones.php b/pages/zones.php
index fb92bfe8..1692dc05 100644
--- a/pages/zones.php
+++ b/pages/zones.php
@@ -4,149 +4,150 @@ if (!defined('AOWOW_REVISION'))
die('illegal access');
-$cats = Util::extractURLParams($pageParam);
-$path = [0, 6];
-$title = [Util::ucFirst(Lang::$game['zones'])];
-$cacheKey = implode('_', [CACHETYPE_PAGE, TYPE_ZONE, -1, $cats ? implode('.', $cats) : -1, User::$localeId]);
-$validCats = array(
- 0 => true,
- 1 => true,
- 2 => [0, 1, 2],
- 3 => [0, 1, 2],
- 4 => true,
- 6 => true,
- 8 => true,
- 9 => true,
- 10 => true
-);
-
-if (!Util::isValidPage($validCats, $cats))
- $smarty->error();
-
-if (!$smarty->loadCache($cacheKey, $pageData))
+// menuId 6: Zone g_initPath()
+// tabId 0: Database g_initHeader()
+class ZonesPage extends GenericPage
{
- $conditions = [];
- $visibleCols = [];
- $hiddenCols = [];
- $mapFile = 0;
- $spawnMap = -1;
+ use ListPage;
- if ($cats)
- {
- $conditions[] = ['z.category', $cats[0]];
-
- if (isset($cats[1]) && in_array($cats[0], [2, 3]))
- $conditions[] = ['z.expansion', $cats[1]];
-
- if (isset($cats[1]))
- array_unshift($title, Lang::$game['expansions'][$cats[1]]);
- else
- {
- switch ($cats[0])
- {
- case 0: $mapFile = -3; $spawnMap = 0; break;
- case 1: $mapFile = -6; $spawnMap = 1; break;
- case 8: $mapFile = -2; $spawnMap = 530; break;
- case 10: $mapFile = -5; $spawnMap = 571; break;
- }
- }
-
- $path = array_merge($path, $cats);
- array_unshift($title, Lang::$zone['cat'][$cats[0]]);
- }
-
- $zones = new ZoneList($conditions);
-
- // menuId 6: Zone g_initPath()
- // tabId 0: Database g_initHeader()
- $pageData = array(
- 'page' => array(
- 'title' => implode(' - ', $title),
- 'path' => json_encode($path, JSON_NUMERIC_CHECK),
- 'tab' => 0,
- 'map' => null,
- 'reqCSS' => array(
- ['path' => STATIC_URL.'/css/Mapper.css'],
- ['path' => STATIC_URL.'/css/Mapper_ie6.css', 'ieCond' => 'lte IE 6']
- ),
- 'reqJS' => array(
- STATIC_URL.'/js/Mapper.js',
- STATIC_URL.'/js/ShowOnMap.js'
- )
- ),
- 'lv' => array(
- array(
- 'file' => 'zone',
- 'data' => $zones->getListviewData(),
- 'params' => []
- )
- )
+ protected $type = TYPE_ZONE;
+ protected $tpl = 'list-page-generic';
+ protected $path = [0, 6];
+ protected $tabId = 0;
+ protected $mode = CACHETYPE_PAGE;
+ protected $validCats = [true, true, [0, 1, 2], [0, 1, 2], true, true, true, true, true];
+ protected $css = array(
+ ['path' => 'Mapper.css'],
+ ['path' => 'Mapper_ie6.css', 'ieCond' => 'lte IE 6']
+ );
+ protected $js = array(
+ 'Mapper.js',
+ 'ShowOnMap.js'
);
- if ($mapFile)
+ public function __construct($pageCall, $pageParam)
{
- $somData = ['flightmaster' => []];
- $nodes = DB::Aowow()->select('SELECT id AS ARRAY_KEY, tn.* FROM ?_taxiNodes tn WHERE mapId = ?d ', $spawnMap);
- $paths = DB::Aowow()->select('SELECT IF(tn1.reactA = tn1.reactH AND tn2.reactA = tn2.reactH, 1, 0) AS neutral, tp.startNodeId AS startId, tn1.posX AS startPosX, tn1.posY AS startPosY, tp.endNodeId AS endId, tn2.posX AS endPosX, tn2.posY AS endPosY FROM ?_taxiPath tp, ?_taxiNodes tn1 , ?_taxiNodes tn2 WHERE tn1.Id = tp.endNodeId AND tn2.Id = tp.startNodeId AND (tp.startNodeId IN (?a) OR tp.EndNodeId IN (?a))', array_keys($nodes), array_keys($nodes));
+ $this->getCategoryFromUrl($pageParam);;
- foreach ($nodes as $i => $n)
- {
- $neutral = $n['reactH'] == $n['reactA'];
+ parent::__construct();
- $data = array(
- 'coords' => [[$n['posX'], $n['posY']]],
- 'level' => 0, // floor
- 'name' => Util::localizedString($n, 'name'),
- 'type' => $n['type'],
- 'id' => $n['typeId'],
- 'reacthorde' => $n['reactH'],
- 'reactalliance' => $n['reactA'],
- 'paths' => []
- );
-
- foreach ($paths as $j => $p)
- {
- if ($i != $p['startId'] && $i != $p['endId'])
- continue;
-
- if ($i == $p['startId'] && (!$neutral || $p['neutral']))
- {
- $data['paths'][] = [$p['startPosX'], $p['startPosY']];
- unset($paths[$j]);
- }
- else if ($i == $p['endId'] && (!$neutral || $p['neutral']))
- {
- $data['paths'][] = [$p['endPosX'], $p['endPosY']];
- unset($paths[$j]);
- }
- }
-
- if (empty($data['paths']))
- unset($data['paths']);
-
- $somData['flightmaster'][] = $data;
- }
-
- $pageData['page']['map'] = array(
- 'data' => array(
- 'zone' => $mapFile,
- 'zoom' => 1,
- 'overlay' => 'true',
- 'zoomable' => 'false'
- ),
- 'som' => json_encode($somData, JSON_NUMERIC_CHECK)
- );
+ $this->name = Util::ucFirst(Lang::$game['zones']);
}
- $smarty->saveCache($cacheKey, $pageData);
+ protected function generateContent()
+ {
+ $conditions = [];
+ $visibleCols = [];
+ $hiddenCols = [];
+ $mapFile = 0;
+ $spawnMap = -1;
+
+ if (!User::isInGroup(U_GROUP_EMPLOYEE)) // sub-areas and unused zones
+ $conditions[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0];
+
+ if ($this->category)
+ {
+ $conditions[] = ['z.category', $this->category[0]];
+
+ if (isset($this->category[1]) && in_array($this->category[0], [2, 3]))
+ $conditions[] = ['z.expansion', $this->category[1]];
+
+ if (empty($this->category[1]))
+ {
+ switch ($this->category[0])
+ {
+ case 0: $mapFile = -3; $spawnMap = 0; break;
+ case 1: $mapFile = -6; $spawnMap = 1; break;
+ case 8: $mapFile = -2; $spawnMap = 530; break;
+ case 10: $mapFile = -5; $spawnMap = 571; break;
+ }
+ }
+ }
+
+ $zones = new ZoneList($conditions);
+
+ $this->map = null;
+ $this->lvData[] = array(
+ 'file' => 'zone',
+ 'data' => $zones->getListviewData(),
+ 'params' => []
+ );
+
+ // create flight map
+ if ($mapFile)
+ {
+ $somData = ['flightmaster' => []];
+ $nodes = DB::Aowow()->select('SELECT id AS ARRAY_KEY, tn.* FROM ?_taxiNodes tn WHERE mapId = ?d ', $spawnMap);
+ $paths = DB::Aowow()->select('SELECT IF(tn1.reactA = tn1.reactH AND tn2.reactA = tn2.reactH, 1, 0) AS neutral, tp.startNodeId AS startId, tn1.posX AS startPosX, tn1.posY AS startPosY, tp.endNodeId AS endId, tn2.posX AS endPosX, tn2.posY AS endPosY FROM ?_taxiPath tp, ?_taxiNodes tn1 , ?_taxiNodes tn2 WHERE tn1.Id = tp.endNodeId AND tn2.Id = tp.startNodeId AND (tp.startNodeId IN (?a) OR tp.EndNodeId IN (?a))', array_keys($nodes), array_keys($nodes));
+
+ foreach ($nodes as $i => $n)
+ {
+ $neutral = $n['reactH'] == $n['reactA'];
+
+ $data = array(
+ 'coords' => [[$n['posX'], $n['posY']]],
+ 'level' => 0, // floor
+ 'name' => Util::localizedString($n, 'name'),
+ 'type' => $n['type'],
+ 'id' => $n['typeId'],
+ 'reacthorde' => $n['reactH'],
+ 'reactalliance' => $n['reactA'],
+ 'paths' => []
+ );
+
+ foreach ($paths as $j => $p)
+ {
+ if ($i != $p['startId'] && $i != $p['endId'])
+ continue;
+
+ if ($i == $p['startId'] && (!$neutral || $p['neutral']))
+ {
+ $data['paths'][] = [$p['startPosX'], $p['startPosY']];
+ unset($paths[$j]);
+ }
+ else if ($i == $p['endId'] && (!$neutral || $p['neutral']))
+ {
+ $data['paths'][] = [$p['endPosX'], $p['endPosY']];
+ unset($paths[$j]);
+ }
+ }
+
+ if (empty($data['paths']))
+ unset($data['paths']);
+
+ $somData['flightmaster'][] = $data;
+ }
+
+ $this->map = array(
+ 'data' => array(
+ 'zone' => $mapFile,
+ 'zoom' => 1,
+ 'overlay' => true,
+ 'zoomable' => false,
+ 'parent' => 'mapper-generic'
+ ),
+ 'som' => $somData
+ );
+ }
+ }
+
+ protected function generateTitle()
+ {
+ if ($this->category)
+ {
+ if (isset($this->category[1]))
+ array_unshift($this->title, Lang::$game['expansions'][$this->category[1]]);
+
+ array_unshift($this->title, Lang::$zone['cat'][$this->category[0]]);
+ }
+ }
+
+ protected function generatePath()
+ {
+ foreach ($this->category as $c)
+ $this->path[] = $c;
+ }
}
-$smarty->updatePageVars($pageData['page']);
-$smarty->assign('lang', Lang::$main);
-$smarty->assign('lvData', $pageData['lv']);
-
-// load the page
-$smarty->display('list-page-generic.tpl');
-
?>
diff --git a/template/bricks/mapper.tpl.php b/template/bricks/mapper.tpl.php
index 1ac59b5e..3149a48d 100644
--- a/template/bricks/mapper.tpl.php
+++ b/template/bricks/mapper.tpl.php
@@ -31,9 +31,9 @@ if (!empty($this->map['data'])):
var g_mapperData = {map['data']['zone']; ?>: {}};
- var myMapper = new Mapper({map['data'], JSON_NUMERIC_CHECK); /* parent: 'mapper-generic' should come here? */ ?>, parent: 'mapper-generic'});
+ var myMapper = new Mapper(map['data'], JSON_NUMERIC_CHECK); /* dont forget to set "'parent' => 'mapper-generic'" */ ?>);
map['som'])): ?>
- new ShowOnMap(map['som']; ?>);
+ new ShowOnMap(map['som'], JSON_NUMERIC_CHECK); ?>);
//]]>
diff --git a/template/bricks/rewards.tpl.php b/template/bricks/rewards.tpl.php
index f1db532c..01710a90 100644
--- a/template/bricks/rewards.tpl.php
+++ b/template/bricks/rewards.tpl.php
@@ -3,21 +3,22 @@
if (!isset($offset)) // in case we have multiple icons on the page (prominently quest-rewards)
$offset = 0;
-if ($rewards['title']):
- echo $rewards['title'].Lang::$main['colon'].(isset($rewards['extra']) ? $rewards['extra'] : null);
+if ($rewTitle):
+ echo $rewTitle.Lang::$main['colon'].(isset($extra) ? $extra : null);
endif;
-if ($rewards['data']):
+
+if ($rewards):
?>
$i):
+ foreach ($rewards as $k => $i):
echo ' | '.$i['name']." | \n";
echo $k % 2 ? '
' : null;
endforeach;
- if (count($rewards['data']) % 2):
+ if (count($rewards) % 2):
echo ' | | ';
endif;
?>
@@ -26,7 +27,7 @@ if ($rewards['data']):
-
-{include file='bricks/infobox.tpl'}
-
-
-{include file='bricks/redButtons.tpl'}
-
-
{$name}
-{if isset($unavailable)}
-
-
{$lang.unavailable}
-{/if}
-
-{if isset($reqMinRep) || isset($reqMaxRep)}
-
{$lang.additionalReq}{$lang.colon}
-
- {if isset($reqMinRep)}{$reqMinRep}
{/if}
- {if isset($reqMaxRep)}{$reqMaxRep}
{/if}
-
{*shudder*}
-
-{/if}
-
-{if $objectives}
- {$objectives}
-{elseif $requestItems}
-
{$lang.progress}
- {$requestItems}
-{elseif $offerReward}
-
{$lang.completion}
- {$offerReward}
-{/if}
-
-{if $end}
-
- | {$end} |
- {if $suggestedPl}
- | {$lang.suggestedPl}{$lang.colon}{$suggestedPl} |
- {/if}
-
-
-{/if}
-
-{if $objectiveList}
- {if $end}
- {$lang.providedItem}{$lang.colon}
- {/if}
-
- {foreach from=$objectiveList item=i key=k}
- {if isset($i.typeStr) && ($i.typeStr == 'item' || $i.typeStr == 'spell')}
- | {$i.name}{if !$end}{$i.extraText}{/if}{if $i.qty > 1} ({$i.qty}){/if} |
- {elseif !empty($i.typeStr)}
- | {$i.name}{if !$end}{$i.extraText}{/if}{if $i.qty > 1} ({$i.qty}){/if} |
-{* todo: research, when we want plain text as unordered list element *}
- {else}
- | {$i.text} |
- {/if}
- {/foreach}
- {if $suggestedPl && !$end}
- | {$lang.suggestedPl}{$lang.colon}{$suggestedPl} |
- {/if}
-
-
-
-{/if}
-
-{include file='bricks/mapper.tpl'}
-
-{* Description *}
-{if $details}
-
{$lang.description}
- {$details}
-{/if}
-
-{* Progress (disclosed) *}
-{if $requestItems && $objectives}
-
-
{$requestItems}
-{/if}
-
-{* Completion (disclosed) *}
-{if $offerReward && ($requestItems || $objectives)}
-
-
{$offerReward}
-{/if}
-
-{* Rewards *}
-{if !empty($rewards.items) || !empty($rewards.money) || !empty($rewards.spells) || !empty($rewards.choice)}
- {assign var='offset' value=0}
-
{$lang.rewards}
-
- {if isset($rewards.choice)}
- {include file='bricks/rewards.tpl' rewTitle=$lang.chooseItems rewData=$rewards.choice offset=$offset}
- {math assign='offset' equation="x + y" x=$offset y=$rewards.choice|@count}
- {/if}
-
- {if isset($rewards.spells)}
- {if isset($rewards.choice)}
-
- {/if}
-
- {if isset($rewards.spells.learn)}
- {include file='bricks/rewards.tpl' rewTitle=$lang.spellLearn rewData=$rewards.spells.learn offset=$offset extra=$rewards.spells.extra}
- {math assign='offset' equation="x + y" x=$offset y=$rewards.spells.learn|@count}
- {else}
- {include file='bricks/rewards.tpl' rewTitle=$lang.spellCast rewData=$rewards.spells.cast offset=$offset extra=$rewards.spells.extra}
- {math assign='offset' equation="x + y" x=$offset y=$rewards.spells.cast|@count}
- {/if}
- {/if}
-
- {if !empty($rewards.items) || !empty($rewards.money)}
- {if isset($rewards.choice) || isset($rewards.spells)}
-
- {/if}
-
- {if isset($rewards.choice)} {* bullshit!! *}
- {include file='bricks/rewards.tpl' rewTitle=$lang.receiveAlso rewData=$rewards.items offset=$offset extra=$rewards.money}
- {else}
- {include file='bricks/rewards.tpl' rewTitle=$lang.receiveItems rewData=$rewards.items offset=$offset extra=$rewards.money}
- {/if}
- {/if}
-{/if}
-
-{* Gains *}
-{if $gains}
-
{$lang.gains}
- {$lang.gainsDesc}{$lang.colon}
-
{/strip}
-{/if}
-
-{if $mail}
-
{$lang.mailDelivery|sprintf:$mail.delay}
- {if $mail.subject}
-
- {/if}
- {if $mail.text}
-
- {/if}
-{/if}
-
{$lang.related}
-
-
-{include file='bricks/tabsRelated.tpl' tabs=$lvData}
-
-{include file='bricks/contribute.tpl'}
-
-
-
-
-{include file='footer.tpl'}
diff --git a/template/pages/quest.tpl.php b/template/pages/quest.tpl.php
new file mode 100644
index 00000000..d5303dcc
--- /dev/null
+++ b/template/pages/quest.tpl.php
@@ -0,0 +1,236 @@
+brick('header'); ?>
+
+
+
+
+
+brick('announcement'); ?>
+
+
+
+brick('infobox'); ?>
+
+
+brick('redButtons'); ?>
+
+
name; ?>
+unavailable): ?>
+
+
+reqMinRep) || isset($this->reqMaxRep)):
+?>
+
+
+reqMinRep)):
+ echo ' '.$this->reqMinRep."
\n";
+endif;
+if (isset($this->reqMaxRep)):
+ echo ' '.$this->reqMaxRep."
\n";
+endif;
+?>
+
+
+objectives):
+ echo $this->objectives."\n";
+elseif ($this->requestItems):
+ echo '
'.Lang::$quest['progress']."
\n";
+ echo $this->requestItems."\n";
+elseif ($this->offerReward):
+ echo '
'.Lang::$quest['completion']."
\n";
+ echo $this->offerReward."\n";
+endif;
+
+if ($e = $this->end):
+?>
+
+ | |
+suggestedPl): ?>
+ | |
+
+
+
+objectiveList):
+ if ($e = $this->end):
+ echo ' '.Lang::$quest['providedItem'].Lang::$main['colon']."\n";
+ endif;
+?>
+
+ $ol):
+
+ if (isset($ol['text'])):
+ echo ' | '.$ol['text']." |
\n";
+ elseif (!empty($ol['proxy'])): // this implies creatures
+ echo ' | '.$ol['name'].$ol['extraText'].''.($ol['qty'] > 1 ? ' ('.$ol['qty'].')' : null).'\n";
+
+ $block1 = array_slice($ol['proxy'], 0, ceil(count($ol['proxy']) / 2), true);
+ $block2 = array_slice($ol['proxy'], ceil(count($ol['proxy']) / 2), null, true);
+
+ echo " \n";
+ foreach ($block1 as $pId => $name):
+ echo ' | '.$name." | \n";
+ endforeach;
+ echo " \n";
+
+ if ($block2): // may be empty
+ echo " \n";
+ foreach ($block2 as $pId => $name):
+ echo ' | '.$name." | \n";
+ endforeach;
+ echo " \n";
+ endif;
+
+ echo " |
\n";
+ elseif (isset($ol['typeStr'])):
+ if (in_array($ol['typeStr'], ['item', 'spell'])):
+ echo ' | ';
+ else /* if (in_array($ol['typeStr'], ['npc', 'object', 'faction'])) */:
+ echo '
|---|
| ';
+ endif;
+
+ echo ''.$ol['name'].''.(!$this->end ? $ol['extraText'] : null).(!empty($ol['qty']) ? ' ('.$ol['qty'].')' : null)." |
\n";
+ endif;
+ endforeach;
+
+ if ($this->suggestedPl && !$this->end):
+ echo ' | '.Lang::$quest['suggestedPl'].lang::$main['colon'].$this->suggestedPl." |
\n";
+ endif;
+?>
+
+
+
+brick('mapper');
+
+if ($this->details):
+ echo '
'.Lang::$quest['description']."
\n" . $this->details."\n";
+endif;
+
+if ($this->requestItems && $this->objectives):
+?>
+
+
requestItems; ?>
+offerReward && ($this->requestItems || $this->objectives)):
+?>
+
+
offerReward; ?>
+rewards):
+ $offset = 0;
+
+ echo '
'.Lang::$main['rewards']."
\n";
+
+ if (!empty($r['choice'])):
+ $this->brick('rewards', ['rewTitle' => Lang::$quest['chooseItems'], 'rewards' => $r['choice'], 'offset' => $offset]);
+ $offset += count($r['choice']);
+ endif;
+
+ if (!empty($r['spells'])):
+ if (!empty($r['choice'])):
+ echo "
\n";
+ endif;
+
+ if (!empty($r['spells']['learn'])):
+ $this->brick('rewards', ['rewTitle' => Lang::$quest['spellLearn'], 'rewards' => $r['spells']['learn'], 'offset' => $offset, 'extra' => $r['spells']['extra']]);
+ $offset += count($r['spells']['learn']);
+ elseif (!empty($r['spells']['cast'])):
+ $this->brick('rewards', ['rewTitle' => Lang::$quest['spellCast'], 'rewards' => $r['spells']['cast'], 'offset' => $offset, 'extra' => $r['spells']['extra']]);
+ $offset += count($r['spells']['cast']);
+ endif;
+ endif;
+
+ if (!empty($r['items']) || !empty($r['money'])):
+ if (!empty($r['choice']) || !empty($r['spells'])):
+ echo "
\n";
+ endif;
+
+ $addData = ['rewards' => @$r['items'], 'offset' => $offset, 'extra' => @$r['money']];
+ $addData['rewTitle'] = empty($r['choice']) ? Lang::$quest['receiveItems'] : Lang::$quest['receiveAlso'];
+
+ $this->brick('rewards', $addData);
+ endif;
+
+endif;
+
+if ($g = $this->gains):
+ echo '
'.Lang::$main['gains']."
\n";
+ echo ' '.Lang::$quest['gainsDesc'].Lang::$main['colon']."\n";
+ echo "
\n";
+
+ if (!empty($g['xp'])):
+ echo ' '.number_format($g['xp']).' '.Lang::$quest['experience']."
\n";
+ endif;
+
+ if (!empty($g['rep'])):
+ foreach ($g['rep'] as $r):
+ echo ' '.($r['qty'] < 0 ? '
'.$r['qty'].'' : $r['qty']).' '.Lang::$npc['repWith'].'
'.$r['name']." \n";
+ endforeach;
+ endif;
+
+ if (!empty($g['title'])):
+ echo ' '.sprintf(Lang::$quest['theTitle'], $g['title'])."
\n";
+ endif;
+
+ if (!empty($g['tp'])):
+ echo ' '.$g['tp'].' '.Lang::$quest['bonusTalents']."
\n";
+ endif;
+
+ echo "
\n";
+endif;
+
+if ($m = $this->mail):
+ echo '
'.sprintf(Lang::$quest['mailDelivery'], $m['delay'])."
\n";
+
+ if ($m['subject']):
+ echo '
\n";
+ endif;
+
+ if ($m['text']):
+ echo '
\n";
+ endif;
+endif;
+?>
+
+
+
+brick('tabsRelated');
+
+$this->brick('contribute');
+?>
+
+
+
+
+brick('footer'); ?>
diff --git a/template/pages/quests.tpl b/template/pages/quests.tpl
deleted file mode 100644
index e699a6ad..00000000
--- a/template/pages/quests.tpl
+++ /dev/null
@@ -1,98 +0,0 @@
-{include file='header.tpl'}
-
-
-
-
-
-{if !empty($announcements)}
- {foreach from=$announcements item=item}
- {include file='bricks/announcement.tpl' an=$item}
- {/foreach}
-{/if}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-{include file='footer.tpl'}
diff --git a/template/pages/quests.tpl.php b/template/pages/quests.tpl.php
new file mode 100644
index 00000000..69f1142b
--- /dev/null
+++ b/template/pages/quests.tpl.php
@@ -0,0 +1,105 @@
+brick('header');
+$f = $this->filter; // shorthand
+?>
+
+
+
+
+
+brick('announcement'); ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+brick('footer'); ?>