Sounds/DetailPage

* fixed generating links to play via the WoW API
 * fixed usage of not yet available PlaySoundKitID() when selecting file from list
 * while internally it is pretty laissez-faire about cases in file paths, suddenly WoW DOES care, when it comes to its LUA API.
   so .. don't cast to lowercase when storing sounds in DB
This commit is contained in:
Sarjuuk
2018-06-11 23:17:55 +02:00
parent 04e183f5e3
commit 56ccc592a6
4 changed files with 12 additions and 9 deletions

View File

@@ -43,9 +43,11 @@ class SoundList extends BaseType
if ($this->fileBuffer) 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) 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 // skipp file extension
$data['title'] = substr($data['title'], 0, -4); $data['title'] = substr($data['title'], 0, -4);
// enum to string // enum to string

View File

@@ -88,7 +88,7 @@ class SoundPage extends GenericPage
} }
// get full path ingame for sound (workaround for missing PlaySoundKit()) // 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->map = $map;
$this->headIcons = [$this->subject->getField('iconString')]; $this->headIcons = [$this->subject->getField('iconString')];

View File

@@ -109,8 +109,8 @@ function sounds(/*array $ids = [] */)
$fileSets[] = array( $fileSets[] = array(
$soundFileIdx, $soundFileIdx,
strtolower($s['soundFile'.$i]), $s['soundFile'.$i],
strtolower($s['path']), $s['path'],
SOUND_TYPE_OGG SOUND_TYPE_OGG
); );
$s['soundFile'.$i] = $soundFileIdx; $s['soundFile'.$i] = $soundFileIdx;
@@ -122,8 +122,8 @@ function sounds(/*array $ids = [] */)
$fileSets[] = array( $fileSets[] = array(
$soundFileIdx, $soundFileIdx,
strtolower($s['soundFile'.$i]), $s['soundFile'.$i],
strtolower($s['path']), $s['path'],
SOUND_TYPE_MP3 SOUND_TYPE_MP3
); );
$s['soundFile'.$i] = $soundFileIdx; $s['soundFile'.$i] = $soundFileIdx;

View File

@@ -106,8 +106,9 @@ g_audioplaylist.setAudioControls($WH.ge('playlistcontrols'));
function showSoundLink(idx) function showSoundLink(idx)
{ {
var data = { 'ingamelink': '/script PlaySoundKitID(<?=$this->typeId; ?>)' }; // var data = { 'ingamelink': '/script PlaySoundKitID(<?=$this->typeId; ?>)' }; // aowow - PlaySoundKitID() not available in 3.3.5
sounddialog.show('sound', { data: data, onSubmit: function() { return false; } }); var data = { 'ingamelink': '/script PlaySoundFile("' + soundpaths[idx].path + '", "master")' };
sounddialog.show('sound', { data: data, onSubmit: $WH.rf });
} }
(new AudioControls()).init(soundpaths,$WH.ge('mainsound')); (new AudioControls()).init(soundpaths,$WH.ge('mainsound'));
@@ -119,7 +120,7 @@ g_audioplaylist.setAudioControls($WH.ge('playlistcontrols'));
var li = $WH.ce('li'); var li = $WH.ce('li');
var a = $WH.ce('a'); var a = $WH.ce('a');
a.href = 'javascript:;'; 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.st(a, soundpaths[x].title);
$WH.ae(li, a); $WH.ae(li, a);
$WH.ae(ol, li); $WH.ae(ol, li);