diff --git a/includes/types/sound.class.php b/includes/types/sound.class.php index 86001e76..19858050 100644 --- a/includes/types/sound.class.php +++ b/includes/types/sound.class.php @@ -43,9 +43,11 @@ class SoundList extends BaseType if ($this->fileBuffer) { - $files = DB::Aowow()->select('SELECT id AS ARRAY_KEY, `id`, `file` AS title, `type` FROM ?_sounds_files sf WHERE id IN (?a)', array_keys($this->fileBuffer)); + $files = DB::Aowow()->select('SELECT id AS ARRAY_KEY, `id`, `file` AS title, `type`, `path` FROM ?_sounds_files sf WHERE id IN (?a)', array_keys($this->fileBuffer)); foreach ($files as $id => $data) { + // 3.3.5 bandaid - need fullpath to play via wow API, remove for cata and later + $data['path'] = str_replace('\\', '\\\\', $data['path'] ? $data['path'] . '\\' . $data['title'] : $data['title']); // skipp file extension $data['title'] = substr($data['title'], 0, -4); // enum to string diff --git a/pages/sound.php b/pages/sound.php index 7bf5b4a8..db843225 100644 --- a/pages/sound.php +++ b/pages/sound.php @@ -88,7 +88,7 @@ class SoundPage extends GenericPage } // get full path ingame for sound (workaround for missing PlaySoundKit()) - $fullpath = DB::Aowow()->selectCell('SELECT IF(sf.`path`, CONCAT(sf.`path`, "\\\\", sf.`file`), sf.`file`) FROM ?_sounds_files sf JOIN ?_sounds s ON s.soundFile1 = sf.id WHERE s.id = ?d', $this->typeId); + $fullpath = DB::Aowow()->selectCell('SELECT IF(sf.`path` <> "", CONCAT(sf.`path`, "\\\\", sf.`file`), sf.`file`) FROM ?_sounds_files sf JOIN ?_sounds s ON s.soundFile1 = sf.id WHERE s.id = ?d', $this->typeId); $this->map = $map; $this->headIcons = [$this->subject->getField('iconString')]; diff --git a/setup/tools/sqlgen/sounds.func.php b/setup/tools/sqlgen/sounds.func.php index 38c08e73..0eee96e7 100644 --- a/setup/tools/sqlgen/sounds.func.php +++ b/setup/tools/sqlgen/sounds.func.php @@ -109,8 +109,8 @@ function sounds(/*array $ids = [] */) $fileSets[] = array( $soundFileIdx, - strtolower($s['soundFile'.$i]), - strtolower($s['path']), + $s['soundFile'.$i], + $s['path'], SOUND_TYPE_OGG ); $s['soundFile'.$i] = $soundFileIdx; @@ -122,8 +122,8 @@ function sounds(/*array $ids = [] */) $fileSets[] = array( $soundFileIdx, - strtolower($s['soundFile'.$i]), - strtolower($s['path']), + $s['soundFile'.$i], + $s['path'], SOUND_TYPE_MP3 ); $s['soundFile'.$i] = $soundFileIdx; diff --git a/template/pages/sound.tpl.php b/template/pages/sound.tpl.php index f5141ade..ce153046 100644 --- a/template/pages/sound.tpl.php +++ b/template/pages/sound.tpl.php @@ -106,8 +106,9 @@ g_audioplaylist.setAudioControls($WH.ge('playlistcontrols')); function showSoundLink(idx) { - var data = { 'ingamelink': '/script PlaySoundKitID(typeId; ?>)' }; - sounddialog.show('sound', { data: data, onSubmit: function() { return false; } }); + // var data = { 'ingamelink': '/script PlaySoundKitID(typeId; ?>)' }; // aowow - PlaySoundKitID() not available in 3.3.5 + var data = { 'ingamelink': '/script PlaySoundFile("' + soundpaths[idx].path + '", "master")' }; + sounddialog.show('sound', { data: data, onSubmit: $WH.rf }); } (new AudioControls()).init(soundpaths,$WH.ge('mainsound')); @@ -119,7 +120,7 @@ g_audioplaylist.setAudioControls($WH.ge('playlistcontrols')); var li = $WH.ce('li'); var a = $WH.ce('a'); a.href = 'javascript:;'; - $WH.aE(a, 'click', (function(xy){return function(){showSoundLink(xy);}})(x)); + $WH.aE(a, 'click', (function(xy) { return function() { showSoundLink(xy); } })(x)); $WH.st(a, soundpaths[x].title); $WH.ae(li, a); $WH.ae(ol, li);