From 4316d3ad405a91839acfb86c39c7f29191d13c0b Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Sat, 22 Apr 2017 22:25:11 +0200 Subject: [PATCH] Zones/DetailPage * directly display AudioControls for all ZoneMusic & Ambience --- localization/locale_dede.php | 3 ++ localization/locale_enus.php | 3 ++ localization/locale_eses.php | 3 ++ localization/locale_frfr.php | 3 ++ localization/locale_ruru.php | 3 ++ pages/zone.php | 48 +++++++++++++++++----- template/pages/detail-page-generic.tpl.php | 41 +++++++++++++++++- 7 files changed, 92 insertions(+), 12 deletions(-) diff --git a/localization/locale_dede.php b/localization/locale_dede.php index 687d0b05..4b53a588 100644 --- a/localization/locale_dede.php +++ b/localization/locale_dede.php @@ -711,6 +711,9 @@ $lang = array( 'notFound' => "Dieser Klang existiert nicht.", 'foundIn' => "Dieser Klang befindet sich in", 'goToPlaylist' => "Gehe zu meiner Playlist", + 'music' => "Musik", + 'intro' => "Intromusik", + 'ambience' => "Umgebung", 'cat' => array( null, "Spells", "User Interface", "Footsteps", "Weapons Impacts", null, "Weapons Misses", null, null, "Pick Up/Put Down", "NPC Combat", null, "Errors", "Nature", "Objects", null, "Death", "NPC Greetings", null, "Armor", diff --git a/localization/locale_enus.php b/localization/locale_enus.php index 20a99b21..7fad2c83 100644 --- a/localization/locale_enus.php +++ b/localization/locale_enus.php @@ -711,6 +711,9 @@ $lang = array( 'notFound' => "This sound doesn't exist.", 'foundIn' => "This sound can be found in", 'goToPlaylist' => "Go to My Playlist", + 'music' => "Music", + 'intro' => "Intro Music", + 'ambience' => "Ambience", 'cat' => array( null, "Spells", "User Interface", "Footsteps", "Weapons Impacts", null, "Weapons Misses", null, null, "Pick Up/Put Down", "NPC Combat", null, "Errors", "Nature", "Objects", null, "Death", "NPC Greetings", null, "Armor", diff --git a/localization/locale_eses.php b/localization/locale_eses.php index 3205a187..d374d1ba 100644 --- a/localization/locale_eses.php +++ b/localization/locale_eses.php @@ -711,6 +711,9 @@ $lang = array( 'notFound' => "Este sonido no existe.", 'foundIn' => "Este sonido se puede encontrar en", 'goToPlaylist' => "Ir a mi lista de reproducción", + 'music' => "Música", + 'intro' => "Música de introducción", + 'ambience' => "Ambiente", 'cat' => array( null, "Spells", "User Interface", "Footsteps", "Weapons Impacts", null, "Weapons Misses", null, null, "Pick Up/Put Down", "NPC Combat", null, "Errors", "Nature", "Objects", null, "Death", "NPC Greetings", null, "Armor", diff --git a/localization/locale_frfr.php b/localization/locale_frfr.php index 7cc4f087..86ca1bbd 100644 --- a/localization/locale_frfr.php +++ b/localization/locale_frfr.php @@ -711,6 +711,9 @@ $lang = array( 'notFound' => "Ce son n'existe pas.", 'foundIn' => "Ce son se trouve dans", 'goToPlaylist' => "Aller à votre playlist", + 'music' => "Musique", + 'intro' => "Musique d'introduction", + 'ambience' => "Ambiance", 'cat' => array( null, "Spells", "User Interface", "Footsteps", "Weapons Impacts", null, "Weapons Misses", null, null, "Pick Up/Put Down", "NPC Combat", null, "Errors", "Nature", "Objects", null, "Death", "NPC Greetings", null, "Armor", diff --git a/localization/locale_ruru.php b/localization/locale_ruru.php index be73d62b..9f33d2df 100644 --- a/localization/locale_ruru.php +++ b/localization/locale_ruru.php @@ -711,6 +711,9 @@ $lang = array( 'notFound' => "Этот звук не существует.", 'foundIn' => "Этот Звук может быть найден в следующих зонах:", 'goToPlaylist' => "Перейти к плейлисту", + 'music' => "Музыка", + 'intro' => "Начальная музыка", + 'ambience' => "Атмосфера", 'cat' => array( null, "Spells", "User Interface", "Footsteps", "Weapons Impacts", null, "Weapons Misses", null, null, "Pick Up/Put Down", "NPC Combat", null, "Errors", "Nature", "Objects", null, "Death", "NPC Greetings", null, "Armor", diff --git a/pages/zone.php b/pages/zone.php index 4a8ec996..52b121bb 100644 --- a/pages/zone.php +++ b/pages/zone.php @@ -10,11 +10,13 @@ class ZonePage extends GenericPage { use detailPage; - protected $path = [0, 6]; - protected $tabId = 0; - protected $type = TYPE_ZONE; - protected $tpl = 'detail-page-generic'; - protected $js = ['ShowOnMap.js']; + protected $path = [0, 6]; + protected $tabId = 0; + protected $type = TYPE_ZONE; + protected $tpl = 'detail-page-generic'; + protected $js = ['ShowOnMap.js']; + + protected $zoneMusic = []; public function __construct($pageCall, $id) { @@ -708,13 +710,13 @@ class ZonePage extends GenericPage $soundIds = []; $zoneMusic = DB::Aowow()->select(' SELECT - x.soundId AS ARRAY_KEY, x.soundId, x.worldStateId, x.worldStateValue + x.soundId AS ARRAY_KEY, x.soundId, x.worldStateId, x.worldStateValue, x.type FROM ( - SELECT ambienceDay AS soundId, worldStateId, worldStateValue FROM ?_zones_sounds WHERE id IN (?a) AND ambienceDay > 0 UNION - SELECT ambienceNight AS soundId, worldStateId, worldStateValue FROM ?_zones_sounds WHERE id IN (?a) AND ambienceNight > 0 UNION - SELECT musicDay AS soundId, worldStateId, worldStateValue FROM ?_zones_sounds WHERE id IN (?a) AND musicDay > 0 UNION - SELECT musicNight AS soundId, worldStateId, worldStateValue FROM ?_zones_sounds WHERE id IN (?a) AND musicNight > 0 UNION - SELECT intro AS soundId, worldStateId, worldStateValue FROM ?_zones_sounds WHERE id IN (?a) AND intro > 0 + SELECT ambienceDay AS soundId, worldStateId, worldStateValue, 1 AS `type` FROM ?_zones_sounds WHERE id IN (?a) AND ambienceDay > 0 UNION + SELECT ambienceNight AS soundId, worldStateId, worldStateValue, 1 AS `type` FROM ?_zones_sounds WHERE id IN (?a) AND ambienceNight > 0 UNION + SELECT musicDay AS soundId, worldStateId, worldStateValue, 2 AS `type` FROM ?_zones_sounds WHERE id IN (?a) AND musicDay > 0 UNION + SELECT musicNight AS soundId, worldStateId, worldStateValue, 2 AS `type` FROM ?_zones_sounds WHERE id IN (?a) AND musicNight > 0 UNION + SELECT intro AS soundId, worldStateId, worldStateValue, 3 AS `type` FROM ?_zones_sounds WHERE id IN (?a) AND intro > 0 ) x GROUP BY x.soundId, x.worldStateId, x.worldStateValue @@ -731,6 +733,7 @@ class ZonePage extends GenericPage $music = new SoundList(array(['id', array_unique($soundIds)])); if (!$music->error) { + // tab $data = $music->getListviewData(); $tabData = []; @@ -748,6 +751,29 @@ class ZonePage extends GenericPage $this->lvTabs[] = ['sound', $tabData]; $this->extendGlobalData($music->getJSGlobals(GLOBALINFO_SELF)); + + // audio controls + // ambience + if ($sounds = array_filter($zoneMusic, function ($x) { return $x['type'] == 1; } )) + foreach ($sounds as $sId => $_) + if (!empty($data[$sId]['files'])) + foreach ($data[$sId]['files'] as $f) + $this->zoneMusic['ambience'][] = $f; + + // music + if ($sounds = array_filter($zoneMusic, function ($x) { return $x['type'] == 2; } )) + foreach ($sounds as $sId => $_) + if (!empty($data[$sId]['files'])) + foreach ($data[$sId]['files'] as $f) + $this->zoneMusic['music'][] = $f; + + // intro + if ($sounds = array_filter($zoneMusic, function ($x) { return $x['type'] == 3; } )) + foreach ($sounds as $sId => $_) + if (!empty($data[$sId]['files'])) + foreach ($data[$sId]['files'] as $f) + $this->zoneMusic['intro'][] = $f; + } } } diff --git a/template/pages/detail-page-generic.tpl.php b/template/pages/detail-page-generic.tpl.php index 1a397203..c229417f 100644 --- a/template/pages/detail-page-generic.tpl.php +++ b/template/pages/detail-page-generic.tpl.php @@ -44,10 +44,49 @@ if (!empty($this->transfer)): echo "
\n ".$this->transfer."\n"; endif; +if ($this->zoneMusic): +?> +
+zoneMusic['music'])): +?> +
+

+
+ +zoneMusic['intro'])): +?> +
+

+ +
+ +zoneMusic['ambience'])): +?> +
+

+ +
+ + +
+

- brick('lvTabs', ['relTabs' => true]);