implementation of Sound DB

Client sounds are cross-referenced with as many other DB-Types as possible. Including, but not limited to:
 * Character VOs (Errors, Emotes)
 * Creature VOs (Boss Dialogue)
 * Zone Music and Ambience
 * Sounds triggerd by spells
 * Sounds from general item/spell usage, creature behavior

Restrictions:
 * only one locale is supported. Choose wisely!
This commit is contained in:
Sarjuuk
2017-03-06 15:16:34 +01:00
committed by GitHub
parent 8fcd8ea429
commit 20a1829317
54 changed files with 3454 additions and 169 deletions

View File

@@ -115,6 +115,25 @@ $WH.strcmp = function(a, b) {
return a < b ? -1 : 1;
}
$WH.stringCompare = function (a, b) {
if (a == b)
return 0;
if (a == null)
return -1;
if (b == null)
return 1;
var fa = parseFloat(a);
var fb = parseFloat(b);
if (!isNaN(fa) && !isNaN(fb) && fa != fb)
return fa < fb ? -1 : 1;
if (typeof a == 'string' && typeof b == 'string')
return a.localeCompare(b);
return a < b ? -1 : 1;
};
$WH.trim = function(str) {
return str.replace(/(^\s*|\s*$)/g, '');
}
@@ -2110,9 +2129,173 @@ $WH.Tooltip = {
}
$WH.Tooltip.iconVisible = icon ? 1 : 0;
},
simple: function(element, text, className, fixed) {
if (fixed)
element.onmouseover = function(x) { $WH.Tooltip.show(element, text, false, false, className) };
else
{
element.onmouseover = function(x) { $WH.Tooltip.showAtCursor(x, text, false, false, className) };
element.onmousemove = $WH.Tooltip.cursorUpdate;
}
element.onmouseout = $WH.Tooltip.hide;
}
};
/* Aowow: totally incompatible with our styles. Only for reference use
$WH.g_createButton = function(text, href, opts) {
var aClass = 'btn btn-site';
var aTarget = '';
var aId = '';
var aStyle = '';
var UNUSED = '';
var classes = [];
var styles = [];
if (!opts)
opts = {};
if (!opts['no-margin'])
styles.push('margin-left:5px');
if (typeof href != 'string' || href === '')
href = 'javascript:;';
if (opts['new-window'])
aTarget = ' target="_blank"';
if (typeof opts.id == 'string')
aId = ' id="' + opts.id + '"';
if (typeof opts.size != 'undefined') {
switch (opts.size) {
case 'small':
case 'large':
classes.push('btn-' + opts.size);
break
}
}
else
classes.push('btn-small');
if (typeof opts['class'] == 'string')
classes.push(opts['class']);
if (typeof opts.type == 'string') {
switch (opts.type) {
case 'default':
case 'gray':
aClass = 'btn';
break;
default:
aClass = 'btn btn-' + opts.type
}
}
if (opts.disabled) {
classes.push('btn-disabled');
href = 'javascript:;';
}
if (classes.length)
aClass += ' ' + classes.join(' ');
if (aClass)
aClass = ' class="' + aClass + '"';
if (!(typeof opts['float'] != 'undefined' && !opts['float']))
styles.push('float:right');
if (typeof opts.style == 'string')
styles.push(opts.style);
if (styles.length)
aStyle = ' style="' + styles.join(';') + '"';
var a = '<a href="' + href + '"' + aTarget + aId + aClass + aStyle + '>' + (text || '') + '</a>';
var div = $WH.ce('div');
div.innerHTML = a;
var btn = div.childNodes[0];
if (typeof opts.click == 'function' && !opts.disabled)
btn.onclick = opts.click;
if (typeof opts.tooltip != 'undefined') {
if (opts.tooltip !== false)
btn.setAttribute('data-whattach', 'true');
if (opts.tooltip === false)
btn.rel = 'np';
else if (typeof opts.tooltip == 'string')
$WH.Tooltip.simple(btn, opts.tooltip, null, true);
else if (typeof opts.tooltip == 'object' && opts.tooltip['text'])
$WH.Tooltip.simple(btn, opts.tooltip['text'], opts.tooltip['class'], true);
}
return btn;
};
*/
$WH.g_createButton = function(text, href, opts)
{
var classes = [];
var styles = [];
var func = null;
if (!opts)
opts = {};
if (!opts['no-margin'])
styles.push('margin-left:5px');
if (typeof href != 'string' || href === '')
href = 'javascript:;';
if (typeof opts['class'] == 'string')
classes.push(opts['class']);
if (opts.disabled)
href = 'javascript:;';
if (typeof opts['float'] != 'undefined' && !opts['float'])
styles.push('float:inherit');
if (typeof opts.style == 'string')
styles.push(opts.style);
if (typeof opts.click == 'function' && !opts.disabled)
func = opts.click;
var btn = RedButton.create(text, !opts.disabled, func);
if (styles.length)
$(btn).attr('style', styles.join(';'));
if (classes.length)
$(btn).addClass(classes.join(' '));
btn.href = href;
if (opts['new-window'])
btn.target = '_blank';
if (typeof opts.id == 'string')
btn.id = opts.id;
if (typeof opts.tooltip != 'undefined') {
if (opts.tooltip === false)
btn.rel = 'np';
else if (typeof opts.tooltip == 'string')
$WH.Tooltip.simple(btn, opts.tooltip, null, true);
else if (typeof opts.tooltip == 'object' && opts.tooltip['text'])
$WH.Tooltip.simple(btn, opts.tooltip['text'], opts.tooltip['class'], true);
}
return btn;
}
/* Aowow: end replacement */
if ($WH.isset('$WowheadPower')) {
$WowheadPower.init();
}