mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Weight Scales/Presets:
* moved wt_presets to DB * scales are now saved sensibly instead of just being dumped as is (also, tables have now constrains) * added admin=weight-presets to edit presets * added an internal user on id:0 who 'owns' the wt-presets and the +1 rates on new comments * consequently added constraints to comment-related tables Misc: * Util::toJSON() priorizes its flags over CFG_DEBUG, wich fixes the modelviewer-redButton * moved terrible javascript-dump from admin-page to template
This commit is contained in:
@@ -1,74 +0,0 @@
|
||||
var wt_presets = {
|
||||
1: {
|
||||
pve: {
|
||||
arms: {__icon:'ability_rogue_eviscerate'},
|
||||
fury: {__icon:'ability_warrior_innerrage',exprtng:100,str:82,critstrkrtng:66,agi:53,armorpenrtng:52,hitrtng:48,hastertng:36,atkpwr:31,armor:5},
|
||||
prot: {__icon:'ability_warrior_defensivestance',sta:100,dodgertng:90,defrtng:86,block:81,agi:67,parryrtng:67,blockrtng:48,str:48,exprtng:19,hitrtng:10,armorpenrtng:10,critstrkrtng:7,armor:6,hastertng:1,atkpwr:1}
|
||||
}
|
||||
},
|
||||
2: {
|
||||
pve: {
|
||||
holy: {__icon:'spell_holy_holybolt',int:100,manargn:88,splpwr:58,critstrkrtng:46,hastertng:35},
|
||||
prot: {__icon:'ability_paladin_shieldofthetemplar',sta:100,dodgertng:94,block:86,defrtng:86,exprtng:79,agi:76,parryrtng:76,hitrtng:58,blockrtng:52,str:50,armor:6,atkpwr:6,splpwr:4,critstrkrtng:3},
|
||||
retrib: {__icon:'spell_holy_auraoflight',mledps:470,hitrtng:100,str:80,exprtng:66,critstrkrtng:40,atkpwr:34,agi:32,hastertng:30,armorpenrtng:22,splpwr:9}
|
||||
}
|
||||
},
|
||||
3: {
|
||||
pve: {
|
||||
beast: {__icon:'ability_hunter_beasttaming',rgddps:213,hitrtng:100,agi:58,critstrkrtng:40,int:37,atkpwr:30,armorpenrtng:28,hastertng:21},
|
||||
marks: {__icon:'ability_marksmanship',rgddps:379,hitrtng:100,agi:74,critstrkrtng:57,armorpenrtng:40,int:39,atkpwr:32,hastertng:24},
|
||||
surv: {__icon:'ability_hunter_swiftstrike',rgddps:181,hitrtng:100,agi:76,critstrkrtng:42,int:35,hastertng:31,atkpwr:29,armorpenrtng:26}
|
||||
}
|
||||
},
|
||||
4: {
|
||||
pve: {
|
||||
assas: {__icon:'ability_rogue_eviscerate',mledps:170,agi:100,exprtng:87,hitrtng:83,critstrkrtng:81,atkpwr:65,armorpenrtng:65,hastertng:64,str:55},
|
||||
combat: {__icon:'ability_backstab',mledps:220,armorpenrtng:100,agi:100,exprtng:82,hitrtng:80,critstrkrtng:75,hastertng:73,str:55,atkpwr:50},
|
||||
subtle: {__icon:'ability_stealth',mledps:228,exprtng:100,agi:100,hitrtng:80,armorpenrtng:75,critstrkrtng:75,hastertng:75,str:55,atkpwr:50}
|
||||
}
|
||||
},
|
||||
5: {
|
||||
pve: {
|
||||
disc: {__icon:'spell_holy_wordfortitude',splpwr:100,manargn:67,int:65,hastertng:59,critstrkrtng:48,spi:22},
|
||||
holy: {__icon:'spell_holy_guardianspirit',manargn:100,int:69,splpwr:60,spi:52,critstrkrtng:38,hastertng:31},
|
||||
shadow: {__icon:'spell_shadow_shadowwordpain',hitrtng:100,shasplpwr:76,splpwr:76,critstrkrtng:54,hastertng:50,spi:16,int:16}
|
||||
}
|
||||
},
|
||||
6: {
|
||||
pve: {
|
||||
blooddps: {__icon:'spell_deathknight_bloodpresence',mledps:360,armorpenrtng:100,str:99,hitrtng:91,exprtng:90,critstrkrtng:57,hastertng:55,atkpwr:36,armor:1},
|
||||
frostdps: {__icon:'spell_deathknight_frostpresence',mledps:337,hitrtng:100,str:97,exprtng:81,armorpenrtng:61,critstrkrtng:45,atkpwr:35,hastertng:28,armor:1},
|
||||
frosttank: {__icon:'spell_deathknight_frostpresence',mledps:419,parryrtng:100,hitrtng:97,str:96,defrtng:85,exprtng:69,dodgertng:61,agi:61,sta:61,critstrkrtng:49,atkpwr:41,armorpenrtng:31,armor:5},
|
||||
unholydps: {__icon:'spell_deathknight_unholypresence',mledps:209,str:100,hitrtng:66,exprtng:51,hastertng:48,critstrkrtng:45,atkpwr:34,armorpenrtng:32,armor:1}
|
||||
}
|
||||
},
|
||||
7: {
|
||||
pve: {
|
||||
elem: {__icon:'spell_nature_lightning',hitrtng:100,splpwr:60,hastertng:56,critstrkrtng:40,int:11},
|
||||
enhance: {__icon:'spell_nature_lightningshield',mledps:135,hitrtng:100,exprtng:84,agi:55,int:55,critstrkrtng:55,hastertng:42,str:35,atkpwr:32,splpwr:29,armorpenrtng:26},
|
||||
resto: {__icon:'spell_nature_magicimmunity',manargn:100,int:85,splpwr:77,critstrkrtng:62,hastertng:35}
|
||||
}
|
||||
},
|
||||
8: {
|
||||
pve: {
|
||||
arcane: {__icon:'spell_holy_magicalsentry',hitrtng:100,hastertng:54,arcsplpwr:49,splpwr:49,critstrkrtng:37,int:34,frosplpwr:24,firsplpwr:24,spi:14},
|
||||
fire: {__icon:'spell_fire_firebolt02',hitrtng:100,hastertng:53,firsplpwr:46,splpwr:46,critstrkrtng:43,frosplpwr:23,arcsplpwr:23,int:13},
|
||||
frost: {__icon:'spell_frost_frostbolt02',hitrtng:100,hastertng:42,frosplpwr:39,splpwr:39,arcsplpwr:19,firsplpwr:19,critstrkrtng:19,int:6}
|
||||
}
|
||||
},
|
||||
9: {
|
||||
pve: {
|
||||
afflic: {__icon:'spell_shadow_deathcoil',hitrtng:100,shasplpwr:72,splpwr:72,hastertng:61,critstrkrtng:38,firsplpwr:36,spi:34,int:15},
|
||||
demo: {__icon:'spell_shadow_metamorphosis',hitrtng:100,hastertng:50,firsplpwr:45,shasplpwr:45,splpwr:45,critstrkrtng:31,spi:29,int:13},
|
||||
destro: {__icon:'spell_shadow_rainoffire',hitrtng:100,firsplpwr:47,splpwr:47,hastertng:46,spi:26,shasplpwr:23,critstrkrtng:16,int:13}
|
||||
}
|
||||
},
|
||||
11: {
|
||||
pve: {
|
||||
balance: {__icon:'spell_nature_starfall',hitrtng:100,splpwr:66,hastertng:54,critstrkrtng:43,spi:22,int:22},
|
||||
feraltank: {__icon:'ability_racial_bearform',agi:100,sta:75,dodgertng:65,defrtng:60,exprtng:16,str:10,armor:10,hitrtng:8,hastertng:5,atkpwr:4,feratkpwr:4,critstrkrtng:3},
|
||||
resto: {__icon:'spell_nature_healingtouch',splpwr:100,manargn:73,hastertng:57,int:51,spi:32,critstrkrtng:11},
|
||||
feraldps: {__icon:'ability_druid_catform',agi:100,armorpenrtng:90,str:80,critstrkrtng:55,exprtng:50,hitrtng:50,feratkpwr:40,atkpwr:40,hastertng:35}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -50,19 +50,34 @@ class AjaxAccount extends AjaxHandler
|
||||
if (!$this->_post['scale'])
|
||||
return 0;
|
||||
|
||||
if (!$this->_post['id'])
|
||||
$id = 0;
|
||||
|
||||
if ($id = $this->_post['id'])
|
||||
{
|
||||
$res = DB::Aowow()->selectRow('SELECT MAX(id) AS max, count(id) AS num FROM ?_account_weightscales WHERE userId = ?d', User::$id);
|
||||
if ($res['num'] < 5) // more or less hard-defined in LANG.message_weightscalesaveerror
|
||||
$this->_post['id'] = ++$res['max'];
|
||||
else
|
||||
if (!DB::Aowow()->selectCell('SELECT 1 FROM ?_account_weightscales WHERE userId = ?d AND id = ?d', User::$id, $id))
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (DB::Aowow()->query('REPLACE INTO ?_account_weightscales VALUES (?d, ?d, ?, ?)', $this->_post['id'], User::$id, $this->_post['name'], $this->_post['scale']))
|
||||
return $this->_post['id'];
|
||||
else
|
||||
return 0;
|
||||
{
|
||||
$nScales = DB::Aowow()->selectCell('SELECT COUNT(id) FROM ?_account_weightscales WHERE userId = ?d', User::$id);
|
||||
if ($nScales >= 5) // more or less hard-defined in LANG.message_weightscalesaveerror
|
||||
return 0;
|
||||
|
||||
$id = DB::Aowow()->query('INSERT INTO ?_account_weightscales (`userId`, `name`) VALUES (?d, ?)', User::$id, $this->_post['name']);
|
||||
}
|
||||
|
||||
DB::Aowow()->query('DELETE FROM ?_account_weightscale_data WHERE id = ?d', $id);
|
||||
|
||||
foreach (explode(',', $this->_post['scale']) as $s)
|
||||
{
|
||||
list($k, $v) = explode(':', $s);
|
||||
if (!in_array($k, Util::$weightScales) || $v < 1)
|
||||
continue;
|
||||
|
||||
DB::Aowow()->query('INSERT INTO ?_account_weightscale_data VALUES (?d, ?, ?d)', $id, $k, $v);
|
||||
}
|
||||
|
||||
return $id;
|
||||
}
|
||||
else if ($this->_post['delete'] && $this->_post['id'])
|
||||
DB::Aowow()->query('DELETE FROM ?_account_weightscales WHERE id = ?d AND userId = ?d', $this->_post['id'], User::$id);
|
||||
@@ -77,4 +92,4 @@ class AjaxAccount extends AjaxHandler
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ if (!defined('AOWOW_REVISION'))
|
||||
|
||||
class AjaxAdmin extends AjaxHandler
|
||||
{
|
||||
protected $validParams = ['screenshots', 'siteconfig'];
|
||||
protected $validParams = ['screenshots', 'siteconfig', 'weight-presets'];
|
||||
protected $_get = array(
|
||||
'action' => [FILTER_SANITIZE_STRING, 0xC], // FILTER_FLAG_STRIP_LOW | *_HIGH
|
||||
'id' => [FILTER_CALLBACK, ['options' => 'AjaxAdmin::checkId']],
|
||||
@@ -17,7 +17,10 @@ class AjaxAdmin extends AjaxHandler
|
||||
'val' => [FILTER_UNSAFE_RAW, null]
|
||||
);
|
||||
protected $_post = array(
|
||||
'alt' => [FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW],
|
||||
'alt' => [FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW],
|
||||
'id' => [FILTER_SANITIZE_NUMBER_INT, null],
|
||||
'scale' => [FILTER_CALLBACK, ['options' => 'AjaxAccount::checkScale']],
|
||||
'__icon' => [FILTER_CALLBACK, ['options' => 'AjaxAdmin::checkKey']],
|
||||
);
|
||||
|
||||
public function __construct(array $params)
|
||||
@@ -30,7 +33,7 @@ class AjaxAdmin extends AjaxHandler
|
||||
|
||||
if ($this->params[0] == 'screenshots')
|
||||
{
|
||||
if (!User::isInGroup(U_GROUP_STAFF | U_GROUP_SCREENSHOT)) // comment_mod, handleSSmod, vi_mod ?
|
||||
if (!User::isInGroup(U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_SCREENSHOT))
|
||||
return;
|
||||
|
||||
if ($this->_get['action'] == 'list')
|
||||
@@ -60,6 +63,14 @@ class AjaxAdmin extends AjaxHandler
|
||||
else if ($this->_get['action'] == 'update')
|
||||
$this->handler = 'confUpdate';
|
||||
}
|
||||
else if ($this->params[0] == 'weight-presets')
|
||||
{
|
||||
if (!User::isInGroup(U_GROUP_DEV | U_GROUP_ADMIN | U_GROUP_BUREAU))
|
||||
return;
|
||||
|
||||
if ($this->_get['action'] == 'save')
|
||||
$this->handler = 'wtSave';
|
||||
}
|
||||
}
|
||||
|
||||
// get all => null (optional)
|
||||
@@ -304,6 +315,74 @@ class AjaxAdmin extends AjaxHandler
|
||||
return '';
|
||||
}
|
||||
|
||||
protected function wtSave()
|
||||
{
|
||||
if (!$this->_post['id'] || !$this->_post['__icon'])
|
||||
return 3;
|
||||
|
||||
$writeFile = function($file, $content)
|
||||
{
|
||||
$success = false;
|
||||
if ($handle = @fOpen($file, "w"))
|
||||
{
|
||||
if (fWrite($handle, $content))
|
||||
$success = true;
|
||||
|
||||
fClose($handle);
|
||||
}
|
||||
else
|
||||
die('me no file');
|
||||
|
||||
if ($success)
|
||||
@chmod($file, Util::FILE_ACCESS);
|
||||
|
||||
return $success;
|
||||
};
|
||||
|
||||
|
||||
// save to db
|
||||
|
||||
DB::Aowow()->query('DELETE FROM ?_account_weightscale_data WHERE id = ?d', $this->_post['id']);
|
||||
DB::Aowow()->query('UPDATE ?_account_weightscales SET `icon`= ? WHERE `id` = ?d', $this->_post['__icon'], $this->_post['id']);
|
||||
|
||||
foreach (explode(',', $this->_post['scale']) as $s)
|
||||
{
|
||||
list($k, $v) = explode(':', $s);
|
||||
|
||||
if (!in_array($k, Util::$weightScales) || $v < 1)
|
||||
continue;
|
||||
|
||||
if (DB::Aowow()->query('INSERT INTO ?_account_weightscale_data VALUES (?d, ?, ?d)', $this->_post['id'], $k, $v) === null)
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// write dataset
|
||||
|
||||
$wtPresets = [];
|
||||
$scales = DB::Aowow()->select('SELECT id, name, icon, class FROM ?_account_weightscales WHERE userId = 0 ORDER BY class, id ASC');
|
||||
|
||||
foreach ($scales as $s)
|
||||
{
|
||||
$weights = DB::Aowow()->selectCol('SELECT field AS ARRAY_KEY, val FROM ?_account_weightscale_data WHERE id = ?d', $s['id']);
|
||||
if (!$weights)
|
||||
continue;
|
||||
|
||||
$wtPresets[$s['class']]['pve'][$s['name']] = array_merge(['__icon' => $s['icon']], $weights);
|
||||
}
|
||||
|
||||
$toFile = "var wt_presets = ".Util::toJSON($wtPresets).";";
|
||||
$file = 'datasets/weight-presets';
|
||||
|
||||
if (!$writeFile($file, $toFile))
|
||||
return 2;
|
||||
|
||||
|
||||
// all done
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected function checkId($val)
|
||||
{
|
||||
// expecting id-list
|
||||
@@ -331,4 +410,12 @@ class AjaxAdmin extends AjaxHandler
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected function checkScale($val)
|
||||
{
|
||||
if (preg_match('/^((\w+:\d+)(,\w+:\d+)*)$/', $val))
|
||||
return $val;
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
define('AOWOW_REVISION', 18);
|
||||
define('AOWOW_REVISION', 19);
|
||||
define('CLI', PHP_SAPI === 'cli');
|
||||
|
||||
|
||||
|
||||
@@ -521,31 +521,17 @@ class User
|
||||
|
||||
public static function getWeightScales()
|
||||
{
|
||||
$data = [];
|
||||
$result = [];
|
||||
|
||||
$res = DB::Aowow()->select('SELECT * FROM ?_account_weightscales WHERE userId = ?d', self::$id);
|
||||
foreach ($res as $i)
|
||||
{
|
||||
$set = array (
|
||||
'name' => $i['name'],
|
||||
'id' => $i['id']
|
||||
);
|
||||
$res = DB::Aowow()->selectCol('SELECT id AS ARRAY_KEY, name FROM ?_account_weightscales WHERE userId = ?d', self::$id);
|
||||
if (!$res)
|
||||
return $result;
|
||||
|
||||
$weights = explode(',', $i['weights']);
|
||||
foreach ($weights as $weight)
|
||||
{
|
||||
$w = explode(':', $weight);
|
||||
$weights = DB::Aowow()->selectCol('SELECT id AS ARRAY_KEY, `field` AS ARRAY_KEY2, val FROM ?_account_weightscale_data WHERE id IN (?a)', array_keys($res));
|
||||
foreach ($weights as $id => $data)
|
||||
$result[] = array_merge(['name' => $res[$id], 'id' => $id], $data);
|
||||
|
||||
if ($w[1] === 'undefined')
|
||||
$w[1] = 0;
|
||||
|
||||
$set[$w[0]] = $w[1];
|
||||
}
|
||||
|
||||
$data[] = $set;
|
||||
}
|
||||
|
||||
return $data;
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function getCharacters()
|
||||
|
||||
@@ -174,6 +174,18 @@ class Util
|
||||
'clothChestArmor', 'leatherChestArmor', 'mailChestArmor', 'plateChestArmor'
|
||||
);
|
||||
|
||||
public static $weightScales = array(
|
||||
'agi', 'int', 'sta', 'spi', 'str', 'health', 'mana', 'healthrgn', 'manargn',
|
||||
'armor', 'blockrtng', 'block', 'defrtng', 'dodgertng', 'parryrtng', 'resirtng',
|
||||
'atkpwr', 'feratkpwr', 'armorpenrtng', 'critstrkrtng', 'exprtng', 'hastertng', 'hitrtng', 'splpen',
|
||||
'splpwr', 'arcsplpwr', 'firsplpwr', 'frosplpwr', 'holsplpwr', 'natsplpwr', 'shasplpwr',
|
||||
'dmg', 'mledps', 'rgddps', 'mledmgmin', 'rgddmgmin', 'mledmgmax', 'rgddmgmax', 'mlespeed', 'rgdspeed',
|
||||
'arcres', 'firres', 'frores', 'holres', 'natres', 'shares',
|
||||
'mleatkpwr', 'mlecritstrkrtng', 'mlehastertng', 'mlehitrtng', 'rgdatkpwr', 'rgdcritstrkrtng', 'rgdhastertng', 'rgdhitrtng',
|
||||
'splcritstrkrtng', 'splhastertng', 'splhitrtng', 'spldmg', 'splheal',
|
||||
'nsockets'
|
||||
);
|
||||
|
||||
public static $dateFormatInternal = "Y/m/d H:i:s";
|
||||
|
||||
public static $changeLevelString = '<a href="javascript:;" onmousedown="return false" class="tip" style="color: white; cursor: pointer" onclick="$WH.g_staticTooltipLevelClick(this, null, 0)" onmouseover="$WH.Tooltip.showAtCursor(event, \'<span class=\\\'q2\\\'>\' + LANG.tooltip_changelevel + \'</span>\')" onmousemove="$WH.Tooltip.cursorUpdate(event)" onmouseout="$WH.Tooltip.hide()"><!--lvl-->%s</a>';
|
||||
@@ -1573,7 +1585,7 @@ class Util
|
||||
{
|
||||
$flags = $forceFlags ?: (JSON_NUMERIC_CHECK | JSON_UNESCAPED_UNICODE);
|
||||
|
||||
if (CFG_DEBUG)
|
||||
if (CFG_DEBUG && !$forceFlags)
|
||||
$flags |= JSON_PRETTY_PRINT;
|
||||
|
||||
$json = json_encode($data, $flags);
|
||||
|
||||
308
pages/admin.php
308
pages/admin.php
@@ -20,7 +20,7 @@ class AdminPage extends GenericPage
|
||||
switch ($pageParam)
|
||||
{
|
||||
case 'screenshots':
|
||||
$this->reqUGroup = U_GROUP_STAFF | U_GROUP_SCREENSHOT;
|
||||
$this->reqUGroup = U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_SCREENSHOT;
|
||||
$this->generator = 'handleScreenshots';
|
||||
$this->tpl = 'admin/screenshots';
|
||||
|
||||
@@ -38,11 +38,19 @@ class AdminPage extends GenericPage
|
||||
case 'siteconfig':
|
||||
$this->reqUGroup = U_GROUP_ADMIN | U_GROUP_DEV;
|
||||
$this->generator = 'handleConfig';
|
||||
$this->tpl = 'list-page-generic';
|
||||
$this->tpl = 'admin/siteconfig';
|
||||
|
||||
array_push($this->path, 2, 18);
|
||||
$this->name = 'Site Configuration';
|
||||
break;
|
||||
case 'weight-presets':
|
||||
$this->reqUGroup = U_GROUP_ADMIN | U_GROUP_DEV | U_GROUP_BUREAU;
|
||||
$this->generator = 'handleWeightPresets';
|
||||
$this->tpl = 'admin/weight-presets';
|
||||
|
||||
array_push($this->path, 2, 16);
|
||||
$this->name = 'Weight Presets';
|
||||
break;
|
||||
default: // error out through unset template
|
||||
}
|
||||
|
||||
@@ -69,275 +77,6 @@ class AdminPage extends GenericPage
|
||||
['string' => '.grid .status { position:absolute; right:5px; }'],
|
||||
));
|
||||
|
||||
// well .. fuck!
|
||||
ob_start();
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function createStatusIcon(errTxt)
|
||||
{
|
||||
function fadeout()
|
||||
{
|
||||
$(this).animate({ opacity: '0.0' }, 250, null, function() {
|
||||
$WH.de(this);
|
||||
$WH.Tooltip.hide()
|
||||
});
|
||||
}
|
||||
|
||||
var a = $WH.ce('a');
|
||||
a.style.opacity = 0;
|
||||
a.className = errTxt ? 'icon-report' : 'icon-tick';
|
||||
g_addTooltip(a, errTxt || 'success', 'q');
|
||||
a.onclick = fadeout.bind(a);
|
||||
setTimeout(function () { $(a).animate({ opacity: '1.0' }, 250); }, 50);
|
||||
setTimeout(fadeout.bind(a), 10000);
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
function cfg_add(el)
|
||||
{
|
||||
_self = el.parentNode.parentNode;
|
||||
|
||||
var tr = $WH.ce('tr');
|
||||
|
||||
tr.style.position = 'relative';
|
||||
|
||||
var td = $WH.ce('td'),
|
||||
key = $WH.ce('input');
|
||||
|
||||
key.type = 'text';
|
||||
key.name = 'key';
|
||||
$WH.ae(td, key);
|
||||
$WH.ae(tr, td);
|
||||
|
||||
var td = $WH.ce('td'),
|
||||
val = $WH.ce('input');
|
||||
|
||||
val.type = 'text';
|
||||
val.name = 'value';
|
||||
$WH.ae(td, val);
|
||||
$WH.ae(tr, td);
|
||||
|
||||
var td = $WH.ce('td'),
|
||||
aCancel = $WH.ce('a'),
|
||||
aSubmit = $WH.ce('a'),
|
||||
status = $WH.ce('span');
|
||||
|
||||
aSubmit.className = 'icon-save tip';
|
||||
g_addTooltip(aSubmit, 'Submit Setting', 'q');
|
||||
|
||||
aCancel.className = 'icon-delete tip';
|
||||
g_addTooltip(aCancel, 'Cancel', 'q');
|
||||
|
||||
aSubmit.onclick = cfg_new.bind(aSubmit, key, val);
|
||||
aCancel.onclick = function () {
|
||||
$WH.Tooltip.hide();
|
||||
$WH.de(this.parentNode.parentNode);
|
||||
};
|
||||
|
||||
status.className = 'status';
|
||||
|
||||
$WH.ae(td, aSubmit);
|
||||
$WH.ae(td, $WH.ct('|'));
|
||||
$WH.ae(td, aCancel);
|
||||
$WH.ae(td, status);
|
||||
$WH.ae(tr, td);
|
||||
|
||||
_self.parentNode.insertBefore(tr, _self);
|
||||
key.focus();
|
||||
}
|
||||
|
||||
function cfg_new(elKey, elVal)
|
||||
{
|
||||
var
|
||||
_td = this.parentNode,
|
||||
_row = this.parentNode.parentNode,
|
||||
_status = $(_td).find('.status')[0];
|
||||
|
||||
// already performing action
|
||||
if (_status.lastChild && _status.lastChild.tagName == 'IMG')
|
||||
return;
|
||||
else if (_status.lastChild && _status.lastChild.tagName == 'A')
|
||||
$WH.ee(_status);
|
||||
|
||||
if (!elKey.value || !elVal.value)
|
||||
{
|
||||
$WH.ae(_status, createStatusIcon('key or value are empty'));
|
||||
return;
|
||||
}
|
||||
|
||||
var
|
||||
key = elKey.value.toLowerCase().trim(),
|
||||
value = elVal.value.trim();
|
||||
|
||||
$(_status).append(CreateAjaxLoader());
|
||||
|
||||
new Ajax('?admin=siteconfig&action=add&key=' + key + '&val=' + value, {
|
||||
method: 'get',
|
||||
onSuccess: function(xhr) {
|
||||
$WH.ee(_status);
|
||||
|
||||
if (!xhr.responseText) {
|
||||
$WH.ee(_row);
|
||||
$(_row).append($('<td>' + key + '</td>')).append($('<td><input id="' + key + '" type="text" name="' + key + '" value="' + value + '" /></td>'));
|
||||
|
||||
var
|
||||
td = $WH.ce('td'),
|
||||
a = $WH.ce('a'),
|
||||
sp = $WH.ce('span');
|
||||
|
||||
g_addTooltip(a, 'Save Changes', 'q');
|
||||
a.onclick = cfg_submit.bind(a, key);
|
||||
a.className = 'icon-save tip';
|
||||
$WH.ae(td, a);
|
||||
|
||||
a = $WH.ce('a');
|
||||
a.className = 'icon-refresh tip disabled';
|
||||
$WH.ae(td, $WH.ct('|'));
|
||||
$WH.ae(td, a);
|
||||
|
||||
a = $WH.ce('a');
|
||||
g_addTooltip(a, 'Remove Setting', 'q');
|
||||
a.onclick = cfg_remove.bind(a, key);
|
||||
a.className = 'icon-delete tip';
|
||||
$WH.ae(td, $WH.ct('|'));
|
||||
$WH.ae(td, a);
|
||||
|
||||
sp.className = 'status';
|
||||
$WH.ae(sp, createStatusIcon());
|
||||
$WH.ae(td, sp);
|
||||
$WH.ae(_row, td);
|
||||
}
|
||||
else {
|
||||
$WH.ae(_status, createStatusIcon(xhr.responseText));
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function cfg_submit(id)
|
||||
{
|
||||
var
|
||||
node = $WH.ge(id),
|
||||
_td = this.parentNode,
|
||||
_status = $(_td).find('.status')[0];
|
||||
|
||||
if (!node)
|
||||
return;
|
||||
|
||||
var value = 0;
|
||||
|
||||
// already performing action
|
||||
if (_status.lastChild && _status.lastChild.tagName == 'IMG')
|
||||
return;
|
||||
else if (_status.lastChild && _status.lastChild.tagName == 'A')
|
||||
$WH.ee(_status);
|
||||
|
||||
if (node.tagName == 'DIV')
|
||||
{
|
||||
// bitmask
|
||||
$(node).find('input[type="checkbox"]').each(function(idx, opt) {
|
||||
if (opt.checked)
|
||||
value |= (1 << opt.value);
|
||||
});
|
||||
|
||||
// boolean
|
||||
$(node).find('input[type="radio"]').each(function(idx, opt) {
|
||||
if (opt.checked)
|
||||
value = opt.value;
|
||||
});
|
||||
}
|
||||
else if (node.tagName == 'SELECT') // opt-list
|
||||
{
|
||||
$(node).find('option').each(function(idx, opt) {
|
||||
if (opt.selected)
|
||||
value = opt.value;
|
||||
});
|
||||
}
|
||||
else if (node.tagName == 'INPUT') // string or numeric
|
||||
{
|
||||
if (node.value && node.value.search(/[^\d\s\/\*\-\+\.]/i) == -1)
|
||||
node.value = eval(node.value);
|
||||
|
||||
value = node.value;
|
||||
}
|
||||
|
||||
value = value.toString().trim();
|
||||
|
||||
if (!value.length && (node.tagName != 'INPUT' || node.type != 'text'))
|
||||
{
|
||||
$WH.ae(_status, createStatusIcon('value is empty'));
|
||||
return;
|
||||
}
|
||||
|
||||
$(_status).append(CreateAjaxLoader());
|
||||
|
||||
new Ajax('?admin=siteconfig&action=update&key=' + id + '&val=' + value, {
|
||||
method: 'get',
|
||||
onSuccess: function(xhr) {
|
||||
$WH.ee(_status);
|
||||
$WH.ae(_status, createStatusIcon(xhr.responseText));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function cfg_default(id, val)
|
||||
{
|
||||
var node = $WH.ge(id);
|
||||
if (!node)
|
||||
return;
|
||||
|
||||
if (node.tagName == 'DIV')
|
||||
{
|
||||
// bitmask
|
||||
$(node).find('input[type="checkbox"]').each(function(idx, opt) { opt.checked = !!(val & (1 << opt.value)); });
|
||||
|
||||
// boolean
|
||||
$(node).find('input[type="radio"]').each(function(idx, opt) { opt.checked = !!opt.value == !!val; });
|
||||
}
|
||||
else if (node.tagName == 'SELECT') // opt-list
|
||||
$(node).find('option').each(function(idx, opt) { opt.selected = opt.value == val; });
|
||||
else if (node.tagName == 'INPUT') // string or numeric
|
||||
node.value = node.type == 'text' ? val : eval(val);
|
||||
}
|
||||
|
||||
function cfg_remove(id)
|
||||
{
|
||||
var
|
||||
_td = this.parentNode,
|
||||
_status = $(_td).find('.status')[0];
|
||||
|
||||
// already performing action
|
||||
if (_status.lastChild && _status.lastChild.tagName == 'IMG')
|
||||
return;
|
||||
else if (_status.lastChild && _status.lastChild.tagName == 'A')
|
||||
$WH.ee(_status);
|
||||
|
||||
if (!confirm('Confirm remove'))
|
||||
return;
|
||||
|
||||
$(_status).append(CreateAjaxLoader());
|
||||
|
||||
new Ajax('?admin=siteconfig&action=remove&key=' + id, {
|
||||
method: 'get',
|
||||
onSuccess: function(xhr) {
|
||||
if (!xhr.responseText)
|
||||
$WH.de(_td.parentNode);
|
||||
else {
|
||||
$WH.ee(_status);
|
||||
$WH.ae(_status, createStatusIcon(xhr.responseText));
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
$this->extraHTML = ob_get_contents();
|
||||
ob_end_clean();
|
||||
// eof (end of fuckup)
|
||||
|
||||
$head = '<table class="grid"><tr><th><b>Key</b></th><th><b>Value</b></th><th style="width:150px;"><b>Options</b></th></tr>';
|
||||
$mainTab = [];
|
||||
$miscTab = [];
|
||||
@@ -479,6 +218,33 @@ class AdminPage extends GenericPage
|
||||
$this->ssNFound = $nMatches; // ssm_numPagesFound
|
||||
}
|
||||
|
||||
private function handleWeightPresets()
|
||||
{
|
||||
$this->addCSS(['string' => '.wt-edit {display:inline-block; vertical-align:top; width:350px;}']);
|
||||
$this->addJS('filters.js');
|
||||
|
||||
$head = $body = '';
|
||||
|
||||
$scales = DB::Aowow()->select('SELECT class AS ARRAY_KEY, id AS ARRAY_KEY2, name, icon FROM ?_account_weightscales WHERE userId = 0');
|
||||
$weights = DB::Aowow()->selectCol('SELECT awd.id AS ARRAY_KEY, awd.field AS ARRAY_KEY2, awd.val FROM ?_account_weightscale_data awd JOIN ?_account_weightscales ad ON awd.id = ad.id WHERE ad.userId = 0');
|
||||
foreach ($scales as $cl => $data)
|
||||
{
|
||||
$ul = '';
|
||||
foreach ($data as $id => $s)
|
||||
{
|
||||
$weights[$id]['__icon'] = $s['icon'];
|
||||
$ul .= '[url=# onclick="loadScale.bind(this, '.$id.')();"]'.$s['name'].'[/url][br]';
|
||||
}
|
||||
|
||||
$head .= '[td=header]'.Lang::game('cl', $cl).'[/td]';
|
||||
$body .= '[td valign=top]'.$ul.'[/td]';
|
||||
}
|
||||
|
||||
$this->extraText = '[table class=grid][tr]'.$head.'[/tr][tr]'.$body.'[/tr][/table]';
|
||||
|
||||
$this->extraHTML = '<script type="text/javascript">var wt_presets = '.Util::toJSON($weights).";</script>\n\n";
|
||||
}
|
||||
|
||||
private function configAddRow($r)
|
||||
{
|
||||
$buff = '<tr>';
|
||||
|
||||
@@ -136,11 +136,28 @@ CREATE TABLE `aowow_account_weightscales` (
|
||||
`id` int(32) NOT NULL AUTO_INCREMENT,
|
||||
`userId` int(10) unsigned NOT NULL,
|
||||
`name` varchar(32) NOT NULL,
|
||||
`weights` text NOT NULL,
|
||||
`class` tinyint(3) unsigned NOT NULL DEFAULT '0',
|
||||
`icon` varchar(48) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`id`,`userId`),
|
||||
KEY `FK_acc_weights` (`userId`),
|
||||
CONSTRAINT `FK_acc_weights` FOREIGN KEY (`userId`) REFERENCES `aowow_account` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `aowow_account_weightscale_data`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `aowow_account_weightscale_data`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `aowow_account_weightscale_data` (
|
||||
`id` int(32) NOT NULL,
|
||||
`field` varchar(15) NOT NULL,
|
||||
`val` smallint(6) unsigned NOT NULL,
|
||||
KEY `id` (`id`),
|
||||
CONSTRAINT `FK_acc_weightscales` FOREIGN KEY (`id`) REFERENCES `aowow_account_weightscales` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
@@ -335,26 +352,28 @@ DROP TABLE IF EXISTS `aowow_comments`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `aowow_comments` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Comment ID',
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Comment ID',
|
||||
`type` smallint(5) unsigned NOT NULL COMMENT 'Type of Page',
|
||||
`typeId` mediumint(9) NOT NULL COMMENT 'ID Of Page',
|
||||
`userId` int(10) unsigned NOT NULL COMMENT 'User ID',
|
||||
`userId` int(10) unsigned NULL DEFAULT NULL COMMENT 'User ID',
|
||||
`roles` smallint(5) unsigned NOT NULL,
|
||||
`body` text NOT NULL COMMENT 'Comment text',
|
||||
`date` int(11) NOT NULL COMMENT 'Comment timestap',
|
||||
`flags` smallint(6) NOT NULL DEFAULT '0' COMMENT 'deleted, outofdate, sticky',
|
||||
`replyTo` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT 'Reply To, comment ID',
|
||||
`replyTo` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Reply To, comment ID',
|
||||
`editUserId` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Last Edit User ID',
|
||||
`editDate` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Last Edit Time',
|
||||
`editCount` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT 'Count Of Edits',
|
||||
`deleteUserId` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`deleteDate` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`responseUserId` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`responseBody` text,
|
||||
`responseBody` text NULL,
|
||||
`responseRoles` smallint(5) unsigned NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `type_typeId` (`type`,`typeId`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
|
||||
INDEX `type_typeId` (`type`, `typeId`),
|
||||
INDEX `FK_acc_co` (`userId`),
|
||||
CONSTRAINT `FK_acc_co` FOREIGN KEY (`userId`) REFERENCES `aowow_account` (`id`) ON UPDATE CASCADE ON DELETE SET NULL
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
@@ -369,8 +388,11 @@ CREATE TABLE `aowow_comments_rates` (
|
||||
`userId` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'User ID',
|
||||
`value` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Rating Set',
|
||||
PRIMARY KEY (`commentId`,`userId`),
|
||||
UNIQUE KEY `commentId_userId` (`commentId`,`userId`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
UNIQUE INDEX `commentId_userId` (`commentId`,`userId`),
|
||||
INDEX `FK_acc_co_rate_user` (`userId`),
|
||||
CONSTRAINT `FK_acc_co_rate` FOREIGN KEY (`commentId`) REFERENCES `aowow_comments` (`id`) ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
CONSTRAINT `FK_acc_co_rate_user` FOREIGN KEY (`userId`) REFERENCES `aowow_account` (`id`) ON UPDATE CASCADE ON DELETE NO ACTION
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
@@ -2420,6 +2442,38 @@ CREATE TABLE `aowow_zones` (
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `aowow_account`
|
||||
--
|
||||
|
||||
LOCK TABLES `aowow_account` WRITE;
|
||||
/*!40000 ALTER TABLE `aowow_account` DISABLE KEYS */;
|
||||
INSERT INTO `aowow_account` VALUES (0,0,'<system>','','AoWoW','',0,0,0,0,'','',0,0,0,0,'','','',0,0,0,0,0,'','');
|
||||
/*!40000 ALTER TABLE `aowow_account` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `aowow_account_weightscales`
|
||||
--
|
||||
|
||||
LOCK TABLES `aowow_account_weightscales` WRITE;
|
||||
/*!40000 ALTER TABLE `aowow_account_weightscales` DISABLE KEYS */;
|
||||
INSERT INTO `aowow_account_weightscales` VALUES (1,0,'arms',1,'ability_rogue_eviscerate'),(2,0,'fury',1,'ability_warrior_innerrage'),(3,0,'prot',1,'ability_warrior_defensivestance'),(4,0,'holy',2,'spell_holy_holybolt'),(5,0,'prot',2,'ability_paladin_shieldofthetempl'),(6,0,'retrib',2,'spell_holy_auraoflight'),(7,0,'beast',3,'ability_hunter_beasttaming'),(8,0,'marks',3,'ability_marksmanship'),(9,0,'surv',3,'ability_hunter_swiftstrike'),(10,0,'assas',4,'ability_rogue_eviscerate'),(11,0,'combat',4,'ability_backstab'),(12,0,'subtle',4,'ability_stealth'),(13,0,'disc',5,'spell_holy_wordfortitude'),(14,0,'holy',5,'spell_holy_guardianspirit'),(15,0,'shadow',5,'spell_shadow_shadowwordpain'),(16,0,'blooddps',6,'spell_deathknight_bloodpresence'),(17,0,'frostdps',6,'spell_deathknight_frostpresence'),(18,0,'frosttank',6,'spell_deathknight_frostpresence'),(19,0,'unholydps',6,'spell_deathknight_unholypresence'),(20,0,'elem',7,'spell_nature_lightning'),(21,0,'enhance',7,'spell_nature_lightningshield'),(22,0,'resto',7,'spell_nature_magicimmunity'),(23,0,'arcane',8,'spell_holy_magicalsentry'),(24,0,'fire',8,'spell_fire_firebolt02'),(25,0,'frost',8,'spell_frost_frostbolt02'),(26,0,'afflic',9,'spell_shadow_deathcoil'),(27,0,'demo',9,'spell_shadow_metamorphosis'),(28,0,'destro',9,'spell_shadow_rainoffire'),(29,0,'balance',11,'spell_nature_starfall'),(30,0,'feraltank',11,'ability_racial_bearform'),(31,0,'resto',11,'spell_nature_healingtouch'),(32,0,'feraldps',11,'ability_druid_catform');
|
||||
/*!40000 ALTER TABLE `aowow_account_weightscales` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Dumping data for table `aowow_account_weightscale_data`
|
||||
--
|
||||
|
||||
LOCK TABLES `aowow_account_weightscale_data` WRITE;
|
||||
/*!40000 ALTER TABLE `aowow_account_weightscale_data` DISABLE KEYS */;
|
||||
INSERT INTO `aowow_account_weightscale_data` VALUES (2,'exprtng',100),(2,'str',82),(2,'critstrkrtng',66),(2,'agi',53),(2,'armorpenrtng',52),(2,'hitrtng',48),(2,'hastertng',36),(2,'atkpwr',31),(2,'armor',5),(3,'sta',100),(3,'dodgertng',90),(3,'defrtng',86),(3,'block',81),(3,'agi',67),(3,'parryrtng',67),(3,'blockrtng',48),(3,'str',48),(3,'exprtng',19),(3,'hitrtng',10),(3,'armorpenrtng',10),(3,'critstrkrtng',7),(3,'armor',6),(3,'hastertng',1),(3,'atkpwr',1),(4,'int',100),(4,'manargn',88),(4,'splpwr',58),(4,'critstrkrtng',46),(4,'hastertng',35),(5,'sta',100),(5,'dodgertng',94),(5,'block',86),(5,'defrtng',86),(5,'exprtng',79),(5,'agi',76),(5,'parryrtng',76),(5,'hitrtng',58),(5,'blockrtng',52),(5,'str',50),(5,'armor',6),(5,'atkpwr',6),(5,'splpwr',4),(5,'critstrkrtng',3),(6,'mledps',470),(6,'hitrtng',100),(6,'str',80),(6,'exprtng',66),(6,'critstrkrtng',40),(6,'atkpwr',34),(6,'agi',32),(6,'hastertng',30),(6,'armorpenrtng',22),(6,'splpwr',9),(7,'rgddps',213),(7,'hitrtng',100),(7,'agi',58),(7,'critstrkrtng',40),(7,'int',37),(7,'atkpwr',30),(7,'armorpenrtng',28),(7,'hastertng',21),(8,'rgddps',379),(8,'hitrtng',100),(8,'agi',74),(8,'critstrkrtng',57),(8,'armorpenrtng',40),(8,'int',39),(8,'atkpwr',32),(8,'hastertng',24),(9,'rgddps',181),(9,'hitrtng',100),(9,'agi',76),(9,'critstrkrtng',42),(9,'int',35),(9,'hastertng',31),(9,'atkpwr',29),(9,'armorpenrtng',26),(10,'mledps',170),(10,'agi',100),(10,'exprtng',87),(10,'hitrtng',83),(10,'critstrkrtng',81),(10,'atkpwr',65),(10,'armorpenrtng',65),(10,'hastertng',64),(10,'str',55),(11,'mledps',220),(11,'armorpenrtng',100),(11,'agi',100),(11,'exprtng',82),(11,'hitrtng',80),(11,'critstrkrtng',75),(11,'hastertng',73),(11,'str',55),(11,'atkpwr',50),(12,'mledps',228),(12,'exprtng',100),(12,'agi',100),(12,'hitrtng',80),(12,'armorpenrtng',75),(12,'critstrkrtng',75),(12,'hastertng',75),(12,'str',55),(12,'atkpwr',50),(13,'splpwr',100),(13,'manargn',67),(13,'int',65),(13,'hastertng',59),(13,'critstrkrtng',48),(13,'spi',22),(14,'manargn',100),(14,'int',69),(14,'splpwr',60),(14,'spi',52),(14,'critstrkrtng',38),(14,'hastertng',31),(15,'hitrtng',100),(15,'shasplpwr',76),(15,'splpwr',76),(15,'critstrkrtng',54),(15,'hastertng',50),(15,'spi',16),(15,'int',16),(16,'mledps',360),(16,'armorpenrtng',100),(16,'str',99),(16,'hitrtng',91),(16,'exprtng',90),(16,'critstrkrtng',57),(16,'hastertng',55),(16,'atkpwr',36),(16,'armor',1),(17,'mledps',337),(17,'hitrtng',100),(17,'str',97),(17,'exprtng',81),(17,'armorpenrtng',61),(17,'critstrkrtng',45),(17,'atkpwr',35),(17,'hastertng',28),(17,'armor',1),(18,'mledps',419),(18,'parryrtng',100),(18,'hitrtng',97),(18,'str',96),(18,'defrtng',85),(18,'exprtng',69),(18,'dodgertng',61),(18,'agi',61),(18,'sta',61),(18,'critstrkrtng',49),(18,'atkpwr',41),(18,'armorpenrtng',31),(18,'armor',5),(19,'mledps',209),(19,'str',100),(19,'hitrtng',66),(19,'exprtng',51),(19,'hastertng',48),(19,'critstrkrtng',45),(19,'atkpwr',34),(19,'armorpenrtng',32),(19,'armor',1),(20,'hitrtng',100),(20,'splpwr',60),(20,'hastertng',56),(20,'critstrkrtng',40),(20,'int',11),(21,'mledps',135),(21,'hitrtng',100),(21,'exprtng',84),(21,'agi',55),(21,'int',55),(21,'critstrkrtng',55),(21,'hastertng',42),(21,'str',35),(21,'atkpwr',32),(21,'splpwr',29),(21,'armorpenrtng',26),(22,'manargn',100),(22,'int',85),(22,'splpwr',77),(22,'critstrkrtng',62),(22,'hastertng',35),(23,'hitrtng',100),(23,'hastertng',54),(23,'arcsplpwr',49),(23,'splpwr',49),(23,'critstrkrtng',37),(23,'int',34),(23,'frosplpwr',24),(23,'firsplpwr',24),(23,'spi',14),(24,'hitrtng',100),(24,'hastertng',53),(24,'firsplpwr',46),(24,'splpwr',46),(24,'critstrkrtng',43),(24,'frosplpwr',23),(24,'arcsplpwr',23),(24,'int',13),(25,'hitrtng',100),(25,'hastertng',42),(25,'frosplpwr',39),(25,'splpwr',39),(25,'arcsplpwr',19),(25,'firsplpwr',19),(25,'critstrkrtng',19),(25,'int',6),(26,'hitrtng',100),(26,'shasplpwr',72),(26,'splpwr',72),(26,'hastertng',61),(26,'critstrkrtng',38),(26,'firsplpwr',36),(26,'spi',34),(26,'int',15),(27,'hitrtng',100),(27,'hastertng',50),(27,'firsplpwr',45),(27,'shasplpwr',45),(27,'splpwr',45),(27,'critstrkrtng',31),(27,'spi',29),(27,'int',13),(28,'hitrtng',100),(28,'firsplpwr',47),(28,'splpwr',47),(28,'hastertng',46),(28,'spi',26),(28,'shasplpwr',23),(28,'critstrkrtng',16),(28,'int',13),(29,'hitrtng',100),(29,'splpwr',66),(29,'hastertng',54),(29,'critstrkrtng',43),(29,'spi',22),(29,'int',22),(30,'agi',100),(30,'sta',75),(30,'dodgertng',65),(30,'defrtng',60),(30,'exprtng',16),(30,'str',10),(30,'armor',10),(30,'hitrtng',8),(30,'hastertng',5),(30,'atkpwr',4),(30,'feratkpwr',4),(30,'critstrkrtng',3),(31,'splpwr',100),(31,'manargn',73),(31,'hastertng',57),(31,'int',51),(31,'spi',32),(31,'critstrkrtng',11),(32,'agi',100),(32,'armorpenrtng',90),(32,'str',80),(32,'critstrkrtng',55),(32,'exprtng',50),(32,'hitrtng',50),(32,'feratkpwr',40),(32,'atkpwr',40),(32,'hastertng',35);
|
||||
/*!40000 ALTER TABLE `aowow_account_weightscale_data` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `aowow_announcements`
|
||||
--
|
||||
|
||||
@@ -93,6 +93,7 @@ function firstrun()
|
||||
['FileGen::generate', 'enchants', null, null, null],
|
||||
['FileGen::generate', 'gems', null, null, null],
|
||||
['FileGen::generate', 'profiler', null, null, null],
|
||||
['FileGen::generate', 'weightPresets', null, null, null],
|
||||
// apply sql-updates from repository
|
||||
['update', null, null, null, null],
|
||||
['account', null, 'testAcc', 'Please create your admin account.', 'There is no user with administrator priviledges in the DB.'],
|
||||
|
||||
@@ -36,18 +36,19 @@ class FileGen
|
||||
'itemScaling' => ['item-scaling', 'datasets/', []]
|
||||
);
|
||||
public static $datasets = array( // name => [AowowDeps, TCDeps]
|
||||
'realms' => [null, ['realmlist']],
|
||||
'statistics' => [null, ['player_levelstats', 'player_classlevelstats']],
|
||||
'simpleImg' => [null, null],
|
||||
'complexImg' => [null, null],
|
||||
'talentCalc' => [null, null],
|
||||
'pets' => [['spawns', 'creature'], null],
|
||||
'talentIcons' => [null, null],
|
||||
'glyphs' => [['items', 'spell'], null],
|
||||
'itemsets' => [['itemset', 'spell'], null],
|
||||
'enchants' => [['items', 'spell', 'itemenchantment'], null],
|
||||
'gems' => [['items', 'spell', 'itemenchantment'], null],
|
||||
'profiler' => [['quests', 'quests_startend', 'spell', 'currencies', 'achievement', 'titles'], null]
|
||||
'realms' => [null, ['realmlist']],
|
||||
'statistics' => [null, ['player_levelstats', 'player_classlevelstats']],
|
||||
'simpleImg' => [null, null],
|
||||
'complexImg' => [null, null],
|
||||
'talentCalc' => [null, null],
|
||||
'pets' => [['spawns', 'creature'], null],
|
||||
'talentIcons' => [null, null],
|
||||
'glyphs' => [['items', 'spell'], null],
|
||||
'itemsets' => [['itemset', 'spell'], null],
|
||||
'enchants' => [['items', 'spell', 'itemenchantment'], null],
|
||||
'gems' => [['items', 'spell', 'itemenchantment'], null],
|
||||
'profiler' => [['quests', 'quests_startend', 'spell', 'currencies', 'achievement', 'titles'], null],
|
||||
'weightPresets' => [null, null]
|
||||
);
|
||||
|
||||
public static $defaultExecTime = 30;
|
||||
|
||||
41
setup/tools/filegen/weightPresets.func.php
Normal file
41
setup/tools/filegen/weightPresets.func.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
if (!defined('AOWOW_REVISION'))
|
||||
die('illegal access');
|
||||
|
||||
if (!CLI)
|
||||
die('not in cli mode');
|
||||
|
||||
|
||||
// Creates 'weight-presets'-file
|
||||
|
||||
function weightPresets()
|
||||
{
|
||||
// check directory-structure
|
||||
if (!CLISetup::writeDir('datasets/'))
|
||||
return false;
|
||||
|
||||
$wtPresets = [];
|
||||
$scales = DB::Aowow()->select('SELECT id, name, icon, class FROM ?_account_weightscales WHERE userId = 0 ORDER BY class, id ASC');
|
||||
|
||||
foreach ($scales as $s)
|
||||
{
|
||||
$weights = DB::Aowow()->selectCol('SELECT field AS ARRAY_KEY, val FROM ?_account_weightscale_data WHERE id = ?d', $s['id']);
|
||||
if (!$weights)
|
||||
{
|
||||
CLISetup::log('WeightScale \''.CLISetup::bold($s['name']).'\' has no data set. Skipping...', CLISetup::LOG_WARN);
|
||||
continue;
|
||||
}
|
||||
|
||||
$wtPresets[$s['class']]['pve'][$s['name']] = array_merge(['__icon' => $s['icon']], $weights);
|
||||
}
|
||||
|
||||
$toFile = "var wt_presets = ".Util::toJSON($wtPresets).";";
|
||||
$file = 'datasets/weight-presets';
|
||||
|
||||
if (!CLISetup::writeFile($file, $toFile))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
?>
|
||||
345
setup/updates/1456585695_01.sql
Normal file
345
setup/updates/1456585695_01.sql
Normal file
@@ -0,0 +1,345 @@
|
||||
-- create system account
|
||||
REPLACE INTO `aowow_account` (`id`, `user`, `displayName`) VALUES (0, '<system>', 'AoWoW');
|
||||
|
||||
-- restructure weightscales (sorry for your loss...)
|
||||
DROP TABLE IF EXISTS `aowow_account_weightscales`;
|
||||
CREATE TABLE IF NOT EXISTS `aowow_account_weightscales` (
|
||||
`id` int(32) NOT NULL AUTO_INCREMENT,
|
||||
`userId` int(10) unsigned NOT NULL,
|
||||
`name` varchar(32) NOT NULL,
|
||||
`class` tinyint(3) unsigned NOT NULL DEFAULT '0',
|
||||
`icon` varchar(48) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`id`,`userId`),
|
||||
KEY `FK_acc_weights` (`userId`),
|
||||
CONSTRAINT `FK_acc_weights` FOREIGN KEY (`userId`) REFERENCES `aowow_account` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;
|
||||
|
||||
INSERT INTO `aowow_account_weightscales` (`id`, `userId`, `name`, `class`, `icon`) VALUES
|
||||
(1, 0, 'arms', 1, 'ability_rogue_eviscerate'),
|
||||
(2, 0, 'fury', 1, 'ability_warrior_innerrage'),
|
||||
(3, 0, 'prot', 1, 'ability_warrior_defensivestance'),
|
||||
(4, 0, 'holy', 2, 'spell_holy_holybolt'),
|
||||
(5, 0, 'prot', 2, 'ability_paladin_shieldofthetemplar'),
|
||||
(6, 0, 'retrib', 2, 'spell_holy_auraoflight'),
|
||||
(7, 0, 'beast', 3, 'ability_hunter_beasttaming'),
|
||||
(8, 0, 'marks', 3, 'ability_marksmanship'),
|
||||
(9, 0, 'surv', 3, 'ability_hunter_swiftstrike'),
|
||||
(10, 0, 'assas', 4, 'ability_rogue_eviscerate'),
|
||||
(11, 0, 'combat', 4, 'ability_backstab'),
|
||||
(12, 0, 'subtle', 4, 'ability_stealth'),
|
||||
(13, 0, 'disc', 5, 'spell_holy_wordfortitude'),
|
||||
(14, 0, 'holy', 5, 'spell_holy_guardianspirit'),
|
||||
(15, 0, 'shadow', 5, 'spell_shadow_shadowwordpain'),
|
||||
(16, 0, 'blooddps', 6, 'spell_deathknight_bloodpresence'),
|
||||
(17, 0, 'frostdps', 6, 'spell_deathknight_frostpresence'),
|
||||
(18, 0, 'frosttank', 6, 'spell_deathknight_frostpresence'),
|
||||
(19, 0, 'unholydps', 6, 'spell_deathknight_unholypresence'),
|
||||
(20, 0, 'elem', 7, 'spell_nature_lightning'),
|
||||
(21, 0, 'enhance', 7, 'spell_nature_lightningshield'),
|
||||
(22, 0, 'resto', 7, 'spell_nature_magicimmunity'),
|
||||
(23, 0, 'arcane', 8, 'spell_holy_magicalsentry'),
|
||||
(24, 0, 'fire', 8, 'spell_fire_firebolt02'),
|
||||
(25, 0, 'frost', 8, 'spell_frost_frostbolt02'),
|
||||
(26, 0, 'afflic', 9, 'spell_shadow_deathcoil'),
|
||||
(27, 0, 'demo', 9, 'spell_shadow_metamorphosis'),
|
||||
(28, 0, 'destro', 9, 'spell_shadow_rainoffire'),
|
||||
(29, 0, 'balance', 11, 'spell_nature_starfall'),
|
||||
(30, 0, 'feraltank', 11, 'ability_racial_bearform'),
|
||||
(31, 0, 'resto', 11, 'spell_nature_healingtouch'),
|
||||
(32, 0, 'feraldps', 11, 'ability_druid_catform');
|
||||
|
||||
DROP TABLE IF EXISTS `aowow_account_weightscale_data`;
|
||||
CREATE TABLE IF NOT EXISTS `aowow_account_weightscale_data` (
|
||||
`id` int(32) NOT NULL,
|
||||
`field` varchar(15) NOT NULL,
|
||||
`val` smallint(6) unsigned NOT NULL,
|
||||
KEY `id` (`id`),
|
||||
CONSTRAINT `FK_acc_weightscales` FOREIGN KEY (`id`) REFERENCES `aowow_account_weightscales` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO `aowow_account_weightscale_data` (`id`, `field`, `val`) VALUES
|
||||
(2, 'exprtng', 100),
|
||||
(2, 'str', 82),
|
||||
(2, 'critstrkrtng', 66),
|
||||
(2, 'agi', 53),
|
||||
(2, 'armorpenrtng', 52),
|
||||
(2, 'hitrtng', 48),
|
||||
(2, 'hastertng', 36),
|
||||
(2, 'atkpwr', 31),
|
||||
(2, 'armor', 5),
|
||||
(3, 'sta', 100),
|
||||
(3, 'dodgertng', 90),
|
||||
(3, 'defrtng', 86),
|
||||
(3, 'block', 81),
|
||||
(3, 'agi', 67),
|
||||
(3, 'parryrtng', 67),
|
||||
(3, 'blockrtng', 48),
|
||||
(3, 'str', 48),
|
||||
(3, 'exprtng', 19),
|
||||
(3, 'hitrtng', 10),
|
||||
(3, 'armorpenrtng', 10),
|
||||
(3, 'critstrkrtng', 7),
|
||||
(3, 'armor', 6),
|
||||
(3, 'hastertng', 1),
|
||||
(3, 'atkpwr', 1),
|
||||
(4, 'int', 100),
|
||||
(4, 'manargn', 88),
|
||||
(4, 'splpwr', 58),
|
||||
(4, 'critstrkrtng', 46),
|
||||
(4, 'hastertng', 35),
|
||||
(5, 'sta', 100),
|
||||
(5, 'dodgertng', 94),
|
||||
(5, 'block', 86),
|
||||
(5, 'defrtng', 86),
|
||||
(5, 'exprtng', 79),
|
||||
(5, 'agi', 76),
|
||||
(5, 'parryrtng', 76),
|
||||
(5, 'hitrtng', 58),
|
||||
(5, 'blockrtng', 52),
|
||||
(5, 'str', 50),
|
||||
(5, 'armor', 6),
|
||||
(5, 'atkpwr', 6),
|
||||
(5, 'splpwr', 4),
|
||||
(5, 'critstrkrtng', 3),
|
||||
(6, 'mledps', 470),
|
||||
(6, 'hitrtng', 100),
|
||||
(6, 'str', 80),
|
||||
(6, 'exprtng', 66),
|
||||
(6, 'critstrkrtng', 40),
|
||||
(6, 'atkpwr', 34),
|
||||
(6, 'agi', 32),
|
||||
(6, 'hastertng', 30),
|
||||
(6, 'armorpenrtng', 22),
|
||||
(6, 'splpwr', 9),
|
||||
(7, 'rgddps', 213),
|
||||
(7, 'hitrtng', 100),
|
||||
(7, 'agi', 58),
|
||||
(7, 'critstrkrtng', 40),
|
||||
(7, 'int', 37),
|
||||
(7, 'atkpwr', 30),
|
||||
(7, 'armorpenrtng', 28),
|
||||
(7, 'hastertng', 21),
|
||||
(8, 'rgddps', 379),
|
||||
(8, 'hitrtng', 100),
|
||||
(8, 'agi', 74),
|
||||
(8, 'critstrkrtng', 57),
|
||||
(8, 'armorpenrtng', 40),
|
||||
(8, 'int', 39),
|
||||
(8, 'atkpwr', 32),
|
||||
(8, 'hastertng', 24),
|
||||
(9, 'rgddps', 181),
|
||||
(9, 'hitrtng', 100),
|
||||
(9, 'agi', 76),
|
||||
(9, 'critstrkrtng', 42),
|
||||
(9, 'int', 35),
|
||||
(9, 'hastertng', 31),
|
||||
(9, 'atkpwr', 29),
|
||||
(9, 'armorpenrtng', 26),
|
||||
(10, 'mledps', 170),
|
||||
(10, 'agi', 100),
|
||||
(10, 'exprtng', 87),
|
||||
(10, 'hitrtng', 83),
|
||||
(10, 'critstrkrtng', 81),
|
||||
(10, 'atkpwr', 65),
|
||||
(10, 'armorpenrtng', 65),
|
||||
(10, 'hastertng', 64),
|
||||
(10, 'str', 55),
|
||||
(11, 'mledps', 220),
|
||||
(11, 'armorpenrtng', 100),
|
||||
(11, 'agi', 100),
|
||||
(11, 'exprtng', 82),
|
||||
(11, 'hitrtng', 80),
|
||||
(11, 'critstrkrtng', 75),
|
||||
(11, 'hastertng', 73),
|
||||
(11, 'str', 55),
|
||||
(11, 'atkpwr', 50),
|
||||
(12, 'mledps', 228),
|
||||
(12, 'exprtng', 100),
|
||||
(12, 'agi', 100),
|
||||
(12, 'hitrtng', 80),
|
||||
(12, 'armorpenrtng', 75),
|
||||
(12, 'critstrkrtng', 75),
|
||||
(12, 'hastertng', 75),
|
||||
(12, 'str', 55),
|
||||
(12, 'atkpwr', 50),
|
||||
(13, 'splpwr', 100),
|
||||
(13, 'manargn', 67),
|
||||
(13, 'int', 65),
|
||||
(13, 'hastertng', 59),
|
||||
(13, 'critstrkrtng', 48),
|
||||
(13, 'spi', 22),
|
||||
(14, 'manargn', 100),
|
||||
(14, 'int', 69),
|
||||
(14, 'splpwr', 60),
|
||||
(14, 'spi', 52),
|
||||
(14, 'critstrkrtng', 38),
|
||||
(14, 'hastertng', 31),
|
||||
(15, 'hitrtng', 100),
|
||||
(15, 'shasplpwr', 76),
|
||||
(15, 'splpwr', 76),
|
||||
(15, 'critstrkrtng', 54),
|
||||
(15, 'hastertng', 50),
|
||||
(15, 'spi', 16),
|
||||
(15, 'int', 16),
|
||||
(16, 'mledps', 360),
|
||||
(16, 'armorpenrtng', 100),
|
||||
(16, 'str', 99),
|
||||
(16, 'hitrtng', 91),
|
||||
(16, 'exprtng', 90),
|
||||
(16, 'critstrkrtng', 57),
|
||||
(16, 'hastertng', 55),
|
||||
(16, 'atkpwr', 36),
|
||||
(16, 'armor', 1),
|
||||
(17, 'mledps', 337),
|
||||
(17, 'hitrtng', 100),
|
||||
(17, 'str', 97),
|
||||
(17, 'exprtng', 81),
|
||||
(17, 'armorpenrtng', 61),
|
||||
(17, 'critstrkrtng', 45),
|
||||
(17, 'atkpwr', 35),
|
||||
(17, 'hastertng', 28),
|
||||
(17, 'armor', 1),
|
||||
(18, 'mledps', 419),
|
||||
(18, 'parryrtng', 100),
|
||||
(18, 'hitrtng', 97),
|
||||
(18, 'str', 96),
|
||||
(18, 'defrtng', 85),
|
||||
(18, 'exprtng', 69),
|
||||
(18, 'dodgertng', 61),
|
||||
(18, 'agi', 61),
|
||||
(18, 'sta', 61),
|
||||
(18, 'critstrkrtng', 49),
|
||||
(18, 'atkpwr', 41),
|
||||
(18, 'armorpenrtng', 31),
|
||||
(18, 'armor', 5),
|
||||
(19, 'mledps', 209),
|
||||
(19, 'str', 100),
|
||||
(19, 'hitrtng', 66),
|
||||
(19, 'exprtng', 51),
|
||||
(19, 'hastertng', 48),
|
||||
(19, 'critstrkrtng', 45),
|
||||
(19, 'atkpwr', 34),
|
||||
(19, 'armorpenrtng', 32),
|
||||
(19, 'armor', 1),
|
||||
(20, 'hitrtng', 100),
|
||||
(20, 'splpwr', 60),
|
||||
(20, 'hastertng', 56),
|
||||
(20, 'critstrkrtng', 40),
|
||||
(20, 'int', 11),
|
||||
(21, 'mledps', 135),
|
||||
(21, 'hitrtng', 100),
|
||||
(21, 'exprtng', 84),
|
||||
(21, 'agi', 55),
|
||||
(21, 'int', 55),
|
||||
(21, 'critstrkrtng', 55),
|
||||
(21, 'hastertng', 42),
|
||||
(21, 'str', 35),
|
||||
(21, 'atkpwr', 32),
|
||||
(21, 'splpwr', 29),
|
||||
(21, 'armorpenrtng', 26),
|
||||
(22, 'manargn', 100),
|
||||
(22, 'int', 85),
|
||||
(22, 'splpwr', 77),
|
||||
(22, 'critstrkrtng', 62),
|
||||
(22, 'hastertng', 35),
|
||||
(23, 'hitrtng', 100),
|
||||
(23, 'hastertng', 54),
|
||||
(23, 'arcsplpwr', 49),
|
||||
(23, 'splpwr', 49),
|
||||
(23, 'critstrkrtng', 37),
|
||||
(23, 'int', 34),
|
||||
(23, 'frosplpwr', 24),
|
||||
(23, 'firsplpwr', 24),
|
||||
(23, 'spi', 14),
|
||||
(24, 'hitrtng', 100),
|
||||
(24, 'hastertng', 53),
|
||||
(24, 'firsplpwr', 46),
|
||||
(24, 'splpwr', 46),
|
||||
(24, 'critstrkrtng', 43),
|
||||
(24, 'frosplpwr', 23),
|
||||
(24, 'arcsplpwr', 23),
|
||||
(24, 'int', 13),
|
||||
(25, 'hitrtng', 100),
|
||||
(25, 'hastertng', 42),
|
||||
(25, 'frosplpwr', 39),
|
||||
(25, 'splpwr', 39),
|
||||
(25, 'arcsplpwr', 19),
|
||||
(25, 'firsplpwr', 19),
|
||||
(25, 'critstrkrtng', 19),
|
||||
(25, 'int', 6),
|
||||
(26, 'hitrtng', 100),
|
||||
(26, 'shasplpwr', 72),
|
||||
(26, 'splpwr', 72),
|
||||
(26, 'hastertng', 61),
|
||||
(26, 'critstrkrtng', 38),
|
||||
(26, 'firsplpwr', 36),
|
||||
(26, 'spi', 34),
|
||||
(26, 'int', 15),
|
||||
(27, 'hitrtng', 100),
|
||||
(27, 'hastertng', 50),
|
||||
(27, 'firsplpwr', 45),
|
||||
(27, 'shasplpwr', 45),
|
||||
(27, 'splpwr', 45),
|
||||
(27, 'critstrkrtng', 31),
|
||||
(27, 'spi', 29),
|
||||
(27, 'int', 13),
|
||||
(28, 'hitrtng', 100),
|
||||
(28, 'firsplpwr', 47),
|
||||
(28, 'splpwr', 47),
|
||||
(28, 'hastertng', 46),
|
||||
(28, 'spi', 26),
|
||||
(28, 'shasplpwr', 23),
|
||||
(28, 'critstrkrtng', 16),
|
||||
(28, 'int', 13),
|
||||
(29, 'hitrtng', 100),
|
||||
(29, 'splpwr', 66),
|
||||
(29, 'hastertng', 54),
|
||||
(29, 'critstrkrtng', 43),
|
||||
(29, 'spi', 22),
|
||||
(29, 'int', 22),
|
||||
(30, 'agi', 100),
|
||||
(30, 'sta', 75),
|
||||
(30, 'dodgertng', 65),
|
||||
(30, 'defrtng', 60),
|
||||
(30, 'exprtng', 16),
|
||||
(30, 'str', 10),
|
||||
(30, 'armor', 10),
|
||||
(30, 'hitrtng', 8),
|
||||
(30, 'hastertng', 5),
|
||||
(30, 'atkpwr', 4),
|
||||
(30, 'feratkpwr', 4),
|
||||
(30, 'critstrkrtng', 3),
|
||||
(31, 'splpwr', 100),
|
||||
(31, 'manargn', 73),
|
||||
(31, 'hastertng', 57),
|
||||
(31, 'int', 51),
|
||||
(31, 'spi', 32),
|
||||
(31, 'critstrkrtng', 11),
|
||||
(32, 'agi', 100),
|
||||
(32, 'armorpenrtng', 90),
|
||||
(32, 'str', 80),
|
||||
(32, 'critstrkrtng', 55),
|
||||
(32, 'exprtng', 50),
|
||||
(32, 'hitrtng', 50),
|
||||
(32, 'feratkpwr', 40),
|
||||
(32, 'atkpwr', 40),
|
||||
(32, 'hastertng', 35);
|
||||
|
||||
-- add cascading to comments
|
||||
DELETE r FROM aowow_comments_rates r LEFT JOIN aowow_comments c ON c.id = r.commentId WHERE c.Id IS NULL;
|
||||
DELETE r FROM aowow_comments_rates r LEFT JOIN aowow_account a ON a.id = r.userId WHERE a.Id IS NULL;
|
||||
|
||||
ALTER TABLE `aowow_comments`
|
||||
ENGINE=InnoDB,
|
||||
CHANGE COLUMN `id` `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Comment ID' FIRST,
|
||||
CHANGE COLUMN `replyTo` `replyTo` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Reply To, comment ID' AFTER `flags`,
|
||||
CHANGE COLUMN `userId` `userId` INT(10) UNSIGNED NULL COMMENT 'User ID' AFTER `typeId`,
|
||||
ADD CONSTRAINT `FK_acc_co` FOREIGN KEY (`userId`) REFERENCES `aowow_account` (`id`) ON UPDATE CASCADE ON DELETE SET NULL;
|
||||
|
||||
ALTER TABLE `aowow_comments_rates`
|
||||
ENGINE=InnoDB,
|
||||
ADD CONSTRAINT `FK_acc_co_rate` FOREIGN KEY (`commentId`) REFERENCES `aowow_comments` (`id`) ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
ADD CONSTRAINT `FK_acc_co_rate_user` FOREIGN KEY (`userId`) REFERENCES `aowow_account` (`id`) ON UPDATE CASCADE ON DELETE NO ACTION;
|
||||
|
||||
-- auto-create datasets/weight-presets
|
||||
UPDATE `aowow_dbversion` SET `build` = CONCAT(`build`, ' weightPresets');
|
||||
@@ -2841,7 +2841,7 @@ var Markup = {
|
||||
attr:
|
||||
{
|
||||
unnamed: { req: false, valid: /\S+/ },
|
||||
rel: { req: false, valid: /(item|quest|spell|achievement|npc|object)=([0-9]+)/ },
|
||||
rel: { req: false, valid: /(item|quest|spell|achievement|event|npc|object|itemset|currency)=([0-9]+)/ },
|
||||
onclick: { req: false, valid: /[\S ]+/ },
|
||||
tooltip: { req: false, valid: /\S+/ },
|
||||
tooltip2: { req: false, valid: /\S+/ }
|
||||
|
||||
@@ -41,7 +41,7 @@ var mn_dev = [
|
||||
// [17, 'Cookies', '?admin=cookies', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV}],
|
||||
[21, 'PHP Information', '?admin=phpinfo', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV}],
|
||||
[18, 'Site Configuration', '?admin=siteconfig', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV}],
|
||||
// [16, 'Weight Presets', '?admin=weight-presets', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_DEV}],
|
||||
[16, 'Weight Presets', '?admin=weight-presets', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_DEV}],
|
||||
// [22, 'API Keys', '?admin=apikey', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_DEV}],
|
||||
|
||||
// [, 'Cache'],
|
||||
|
||||
@@ -22,7 +22,7 @@ endif;
|
||||
// view in 3D
|
||||
if (isset($this->redButtons[BUTTON_VIEW3D])):
|
||||
if ($b = $this->redButtons[BUTTON_VIEW3D]): // json_encode puts property names in brackets wich is not cool with inline javascript
|
||||
echo '<a href="javascript:;" id="view3D-button" class="button-red" onclick="this.blur(); ModelViewer.show({'.strtr(Util::toJSON($b), ['"' => '']).'})"><em><b><i>'.Lang::main('view3D').'</i></b><span>'.Lang::main('view3D').'</span></em></a>';
|
||||
echo '<a href="javascript:;" id="view3D-button" class="button-red" onclick="this.blur(); ModelViewer.show('.strtr(Util::toJSON($b, JSON_NUMERIC_CHECK), ['"' => '']).')"><em><b><i>'.Lang::main('view3D').'</i></b><span>'.Lang::main('view3D').'</span></em></a>';
|
||||
else:
|
||||
echo '<a href="javascript:;" id="view3D-button" class="button-red button-red-disabled"><em><b><i>'.Lang::main('view3D').'</i></b><span>'.Lang::main('view3D').'</span></em></a>';
|
||||
endif;
|
||||
|
||||
280
template/pages/admin/siteconfig.tpl.php
Normal file
280
template/pages/admin/siteconfig.tpl.php
Normal file
@@ -0,0 +1,280 @@
|
||||
<?php $this->brick('header'); ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
function createStatusIcon(errTxt)
|
||||
{
|
||||
function fadeout()
|
||||
{
|
||||
$(this).animate({ opacity: '0.0' }, 250, null, function() {
|
||||
$WH.de(this);
|
||||
$WH.Tooltip.hide()
|
||||
});
|
||||
}
|
||||
|
||||
var a = $WH.ce('a');
|
||||
a.style.opacity = 0;
|
||||
a.className = errTxt ? 'icon-report' : 'icon-tick';
|
||||
g_addTooltip(a, errTxt || 'success', 'q');
|
||||
a.onclick = fadeout.bind(a);
|
||||
setTimeout(function () { $(a).animate({ opacity: '1.0' }, 250); }, 50);
|
||||
setTimeout(fadeout.bind(a), 10000);
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
function cfg_add(el)
|
||||
{
|
||||
_self = el.parentNode.parentNode;
|
||||
|
||||
var tr = $WH.ce('tr');
|
||||
|
||||
tr.style.position = 'relative';
|
||||
|
||||
var td = $WH.ce('td'),
|
||||
key = $WH.ce('input');
|
||||
|
||||
key.type = 'text';
|
||||
key.name = 'key';
|
||||
$WH.ae(td, key);
|
||||
$WH.ae(tr, td);
|
||||
|
||||
var td = $WH.ce('td'),
|
||||
val = $WH.ce('input');
|
||||
|
||||
val.type = 'text';
|
||||
val.name = 'value';
|
||||
$WH.ae(td, val);
|
||||
$WH.ae(tr, td);
|
||||
|
||||
var td = $WH.ce('td'),
|
||||
aCancel = $WH.ce('a'),
|
||||
aSubmit = $WH.ce('a'),
|
||||
status = $WH.ce('span');
|
||||
|
||||
aSubmit.className = 'icon-save tip';
|
||||
g_addTooltip(aSubmit, 'Submit Setting', 'q');
|
||||
|
||||
aCancel.className = 'icon-delete tip';
|
||||
g_addTooltip(aCancel, 'Cancel', 'q');
|
||||
|
||||
aSubmit.onclick = cfg_new.bind(aSubmit, key, val);
|
||||
aCancel.onclick = function () {
|
||||
$WH.Tooltip.hide();
|
||||
$WH.de(this.parentNode.parentNode);
|
||||
};
|
||||
|
||||
status.className = 'status';
|
||||
|
||||
$WH.ae(td, aSubmit);
|
||||
$WH.ae(td, $WH.ct('|'));
|
||||
$WH.ae(td, aCancel);
|
||||
$WH.ae(td, status);
|
||||
$WH.ae(tr, td);
|
||||
|
||||
_self.parentNode.insertBefore(tr, _self);
|
||||
key.focus();
|
||||
}
|
||||
|
||||
function cfg_new(elKey, elVal)
|
||||
{
|
||||
var
|
||||
_td = this.parentNode,
|
||||
_row = this.parentNode.parentNode,
|
||||
_status = $(_td).find('.status')[0];
|
||||
|
||||
// already performing action
|
||||
if (_status.lastChild && _status.lastChild.tagName == 'IMG')
|
||||
return;
|
||||
else if (_status.lastChild && _status.lastChild.tagName == 'A')
|
||||
$WH.ee(_status);
|
||||
|
||||
if (!elKey.value || !elVal.value)
|
||||
{
|
||||
$WH.ae(_status, createStatusIcon('key or value are empty'));
|
||||
return;
|
||||
}
|
||||
|
||||
var
|
||||
key = elKey.value.toLowerCase().trim(),
|
||||
value = elVal.value.trim();
|
||||
|
||||
$(_status).append(CreateAjaxLoader());
|
||||
|
||||
new Ajax('?admin=siteconfig&action=add&key=' + key + '&val=' + value, {
|
||||
method: 'get',
|
||||
onSuccess: function(xhr) {
|
||||
$WH.ee(_status);
|
||||
|
||||
if (!xhr.responseText) {
|
||||
$WH.ee(_row);
|
||||
$(_row).append($('<td>' + key + '</td>')).append($('<td><input id="' + key + '" type="text" name="' + key + '" value="' + value + '" /></td>'));
|
||||
|
||||
var
|
||||
td = $WH.ce('td'),
|
||||
a = $WH.ce('a'),
|
||||
sp = $WH.ce('span');
|
||||
|
||||
g_addTooltip(a, 'Save Changes', 'q');
|
||||
a.onclick = cfg_submit.bind(a, key);
|
||||
a.className = 'icon-save tip';
|
||||
$WH.ae(td, a);
|
||||
|
||||
a = $WH.ce('a');
|
||||
a.className = 'icon-refresh tip disabled';
|
||||
$WH.ae(td, $WH.ct('|'));
|
||||
$WH.ae(td, a);
|
||||
|
||||
a = $WH.ce('a');
|
||||
g_addTooltip(a, 'Remove Setting', 'q');
|
||||
a.onclick = cfg_remove.bind(a, key);
|
||||
a.className = 'icon-delete tip';
|
||||
$WH.ae(td, $WH.ct('|'));
|
||||
$WH.ae(td, a);
|
||||
|
||||
sp.className = 'status';
|
||||
$WH.ae(sp, createStatusIcon());
|
||||
$WH.ae(td, sp);
|
||||
$WH.ae(_row, td);
|
||||
}
|
||||
else {
|
||||
$WH.ae(_status, createStatusIcon(xhr.responseText));
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function cfg_submit(id)
|
||||
{
|
||||
var
|
||||
node = $WH.ge(id),
|
||||
_td = this.parentNode,
|
||||
_status = $(_td).find('.status')[0];
|
||||
|
||||
if (!node)
|
||||
return;
|
||||
|
||||
var value = 0;
|
||||
|
||||
// already performing action
|
||||
if (_status.lastChild && _status.lastChild.tagName == 'IMG')
|
||||
return;
|
||||
else if (_status.lastChild && _status.lastChild.tagName == 'A')
|
||||
$WH.ee(_status);
|
||||
|
||||
if (node.tagName == 'DIV')
|
||||
{
|
||||
// bitmask
|
||||
$(node).find('input[type="checkbox"]').each(function(idx, opt) {
|
||||
if (opt.checked)
|
||||
value |= (1 << opt.value);
|
||||
});
|
||||
|
||||
// boolean
|
||||
$(node).find('input[type="radio"]').each(function(idx, opt) {
|
||||
if (opt.checked)
|
||||
value = opt.value;
|
||||
});
|
||||
}
|
||||
else if (node.tagName == 'SELECT') // opt-list
|
||||
{
|
||||
$(node).find('option').each(function(idx, opt) {
|
||||
if (opt.selected)
|
||||
value = opt.value;
|
||||
});
|
||||
}
|
||||
else if (node.tagName == 'INPUT') // string or numeric
|
||||
{
|
||||
if (node.value && node.value.search(/[^\d\s\/\*\-\+\.]/i) == -1)
|
||||
node.value = eval(node.value);
|
||||
|
||||
value = node.value;
|
||||
}
|
||||
|
||||
value = value.toString().trim();
|
||||
|
||||
if (!value.length && (node.tagName != 'INPUT' || node.type != 'text'))
|
||||
{
|
||||
$WH.ae(_status, createStatusIcon('value is empty'));
|
||||
return;
|
||||
}
|
||||
|
||||
$(_status).append(CreateAjaxLoader());
|
||||
|
||||
new Ajax('?admin=siteconfig&action=update&key=' + id + '&val=' + value, {
|
||||
method: 'get',
|
||||
onSuccess: function(xhr) {
|
||||
$WH.ee(_status);
|
||||
$WH.ae(_status, createStatusIcon(xhr.responseText));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function cfg_default(id, val)
|
||||
{
|
||||
var node = $WH.ge(id);
|
||||
if (!node)
|
||||
return;
|
||||
|
||||
if (node.tagName == 'DIV')
|
||||
{
|
||||
// bitmask
|
||||
$(node).find('input[type="checkbox"]').each(function(idx, opt) { opt.checked = !!(val & (1 << opt.value)); });
|
||||
|
||||
// boolean
|
||||
$(node).find('input[type="radio"]').each(function(idx, opt) { opt.checked = !!opt.value == !!val; });
|
||||
}
|
||||
else if (node.tagName == 'SELECT') // opt-list
|
||||
$(node).find('option').each(function(idx, opt) { opt.selected = opt.value == val; });
|
||||
else if (node.tagName == 'INPUT') // string or numeric
|
||||
node.value = node.type == 'text' ? val : eval(val);
|
||||
}
|
||||
|
||||
function cfg_remove(id)
|
||||
{
|
||||
var
|
||||
_td = this.parentNode,
|
||||
_status = $(_td).find('.status')[0];
|
||||
|
||||
// already performing action
|
||||
if (_status.lastChild && _status.lastChild.tagName == 'IMG')
|
||||
return;
|
||||
else if (_status.lastChild && _status.lastChild.tagName == 'A')
|
||||
$WH.ee(_status);
|
||||
|
||||
if (!confirm('Confirm remove'))
|
||||
return;
|
||||
|
||||
$(_status).append(CreateAjaxLoader());
|
||||
|
||||
new Ajax('?admin=siteconfig&action=remove&key=' + id, {
|
||||
method: 'get',
|
||||
onSuccess: function(xhr) {
|
||||
if (!xhr.responseText)
|
||||
$WH.de(_td.parentNode);
|
||||
else {
|
||||
$WH.ee(_status);
|
||||
$WH.ae(_status, createStatusIcon(xhr.responseText));
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="main" id="main">
|
||||
<div class="main-precontents" id="main-precontents"></div>
|
||||
<div class="main-contents" id="main-contents">
|
||||
|
||||
<?php
|
||||
$this->brick('announcement');
|
||||
|
||||
$this->brick('pageTemplate');
|
||||
|
||||
$this->brick('lvTabs');
|
||||
?>
|
||||
<div class="clear"></div>
|
||||
</div><!-- main-contents -->
|
||||
</div><!-- main -->
|
||||
|
||||
<?php $this->brick('footer'); ?>
|
||||
591
template/pages/admin/weight-presets.tpl.php
Normal file
591
template/pages/admin/weight-presets.tpl.php
Normal file
@@ -0,0 +1,591 @@
|
||||
<?php $this->brick('header'); ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
var SummaryAdmin = {
|
||||
createControl: function(text, id, _class, onclick, href) {
|
||||
var a = $WH.ce('a');
|
||||
|
||||
if (href) {
|
||||
a.href = href;
|
||||
a.target = '_blank';
|
||||
}
|
||||
else {
|
||||
a.href = 'javascript:;';
|
||||
}
|
||||
|
||||
if (id) {
|
||||
a.id = id;
|
||||
}
|
||||
|
||||
if (_class) {
|
||||
a.className = _class;
|
||||
}
|
||||
|
||||
if (onclick) {
|
||||
a.onclick = onclick;
|
||||
}
|
||||
|
||||
$WH.ae(a, $WH.ct(text));
|
||||
|
||||
return a;
|
||||
},
|
||||
|
||||
updateControls: function() {
|
||||
var
|
||||
div = _suDiv,
|
||||
a,
|
||||
d2 = $WH.ce('div'),
|
||||
d = $WH.ce('div');
|
||||
|
||||
var div2 = $WH.ce('div');
|
||||
div2.className = 'summary-controls-right';
|
||||
$WH.ae(div, div2);
|
||||
|
||||
d2.id = 'su_weights';
|
||||
d.className = 'summary-weights-inner';
|
||||
$WH.ae(d2, d);
|
||||
$WH.ae(div2, d2);
|
||||
|
||||
var w = $WH.ce('div');
|
||||
w.id = 'su_weight';
|
||||
$WH.ae(d, w);
|
||||
_ = $WH.ce('div');
|
||||
$WH.ae(w, _);
|
||||
|
||||
s = $WH.ce('select');
|
||||
s.onchange = s.onkeyup = this.refreshWeights.bind(this, s);
|
||||
$WH.ae(s, $WH.ce('option'));
|
||||
$WH.ae(_, s);
|
||||
|
||||
a = $WH.ce('a');
|
||||
a.href = 'javascript:;';
|
||||
a.className = 'icon-refresh';
|
||||
a.appendChild($WH.ct(LANG.tc_restore));
|
||||
a.onclick = this.restorScale;
|
||||
a.onmousedown = $WH.rf;
|
||||
$WH.aef(_ctrlDiv, a);
|
||||
|
||||
$WH.aef(_ctrlDiv, $WH.ce('br'));
|
||||
|
||||
a = $WH.ce('a');
|
||||
a.href = 'javascript:;';
|
||||
a.className = 'icon-save';
|
||||
a.appendChild($WH.ct(LANG.fisavescale));
|
||||
a.onclick = this.saveScale;
|
||||
a.onmousedown = $WH.rf;
|
||||
$WH.aef(_ctrlDiv, a);
|
||||
|
||||
_ = false;
|
||||
|
||||
for (var i = 0, len = this.traits.length; i < len; ++i) {
|
||||
var p = this.traits[i];
|
||||
|
||||
if (p.type == 'sep') {
|
||||
if (_ && _.childNodes.length > 0) {
|
||||
$WH.ae(s, _);
|
||||
}
|
||||
_ = $WH.ce('optgroup');
|
||||
_.label = (LANG.traits[p.id] ? LANG.traits[p.id] : p.name);
|
||||
}
|
||||
else if (p.type != 'custom') {
|
||||
var o = $WH.ce('option');
|
||||
o.value = p.id;
|
||||
$WH.ae(o, $WH.ct((p.indent ? '- ' : '') + (LANG.traits[p.id] ? LANG.traits[p.id][0] : p.name)));
|
||||
$WH.ae(_, o);
|
||||
}
|
||||
}
|
||||
if (_ && _.childNodes.length > 0) {
|
||||
$WH.ae(s, _);
|
||||
}
|
||||
|
||||
_ = $WH.ce('div');
|
||||
a = this.createControl(LANG.su_addweight, 'su_addweight', '', this.addWeight.bind(this));
|
||||
$WH.ae(_, a);
|
||||
$WH.ae(d, _);
|
||||
|
||||
_ = $WH.ce('div');
|
||||
_.className = 'summary-weights-buttons';
|
||||
},
|
||||
|
||||
updateWeights: function(weights) {
|
||||
var _ = $WH.ge('su_weight');
|
||||
var c = _.childNodes[0].childNodes[0];
|
||||
var i = 0;
|
||||
|
||||
for (var w in weights) {
|
||||
if (!LANG.traits[w]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (i++ > 0) {
|
||||
c = this.addWeight();
|
||||
}
|
||||
|
||||
var opts = c.getElementsByTagName('option');
|
||||
|
||||
for (var j = 0, len = opts.length; j < len; ++j) {
|
||||
if (opts[j].value == w) {
|
||||
opts[j].selected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this.refreshWeights(c, weights[w]);
|
||||
}
|
||||
},
|
||||
|
||||
addWeight: function(e) {
|
||||
var _ = $WH.ge('su_weight');
|
||||
var a = $WH.ge('su_addweight');
|
||||
|
||||
if (_.childNodes.length >= 14) {
|
||||
a.style.display = 'none';
|
||||
}
|
||||
|
||||
a = _.childNodes[0].lastChild;
|
||||
if (a.nodeName != 'A') {
|
||||
$WH.ae(_.childNodes[0], $WH.ct(String.fromCharCode(160, 160)));
|
||||
$WH.ae(_.childNodes[0], this.createControl(LANG.firemove, '', '', this.deleteWeight.bind(this, _.childNodes[0].firstChild)));
|
||||
}
|
||||
else {
|
||||
a.firstChild.nodeValue = LANG.firemove;
|
||||
a.onmouseup = this.deleteWeight.bind(this, _.childNodes[0].firstChild);
|
||||
}
|
||||
|
||||
var
|
||||
d = $WH.ce('div'),
|
||||
c = _.childNodes[0].childNodes[0].cloneNode(true);
|
||||
|
||||
$WH.ae(_, d);
|
||||
|
||||
c.onchange = c.onkeyup = this.refreshWeights.bind(this, c);
|
||||
$WH.ae(d, c);
|
||||
|
||||
$WH.ae(d, $WH.ct(String.fromCharCode(160, 160)));
|
||||
$WH.ae(d, this.createControl(LANG.firemove, '', '', this.deleteWeight.bind(this, c)));
|
||||
|
||||
if (e) {
|
||||
$WH.sp($WH.$E(e));
|
||||
}
|
||||
|
||||
return c;
|
||||
},
|
||||
|
||||
resetWeights: function() {
|
||||
var _ = $WH.ge('su_weight');
|
||||
|
||||
while (_.childNodes.length >= 2) {
|
||||
_.removeChild(_.childNodes[1]);
|
||||
}
|
||||
|
||||
var d = _.childNodes[0];
|
||||
while (d.childNodes.length > 1) {
|
||||
d.removeChild(d.childNodes[1]);
|
||||
}
|
||||
d.firstChild.selectedIndex = 0;
|
||||
|
||||
var a = $WH.ge('su_addweight');
|
||||
if (_.childNodes.length < 15) {
|
||||
a.style.display = '';
|
||||
}
|
||||
},
|
||||
|
||||
deleteWeight: function(sel, e) {
|
||||
var
|
||||
d = sel.parentNode,
|
||||
c = d.parentNode;
|
||||
|
||||
$WH.de(d);
|
||||
|
||||
if (c.childNodes.length == 1) {
|
||||
var _ = c.firstChild;
|
||||
if (_.firstChild.selectedIndex > 0) {
|
||||
var a = _.lastChild;
|
||||
a.firstChild.nodeValue = LANG.ficlear;
|
||||
a.onmouseup = this.resetWeights.bind(this);
|
||||
}
|
||||
else {
|
||||
while (_.childNodes.length > 1) {
|
||||
$WH.de(_.childNodes[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var a = $WH.ge('su_addweight');
|
||||
if (c.childNodes.length < 15) {
|
||||
a.style.display = '';
|
||||
}
|
||||
|
||||
if (e) {
|
||||
$WH.sp($WH.$E(e));
|
||||
}
|
||||
},
|
||||
|
||||
refreshWeights: function(sel, value) {
|
||||
var d = sel.parentNode;
|
||||
|
||||
while (d.childNodes.length > 1) {
|
||||
$WH.de(d.childNodes[1]);
|
||||
}
|
||||
|
||||
if (sel.selectedIndex > 0) {
|
||||
$WH.ae(d, $WH.ct(' '));
|
||||
var _ = $WH.ce('input');
|
||||
_.type = 'text';
|
||||
_.value = (value | 0);
|
||||
_.maxLength = 7;
|
||||
_.style.textAlign = 'center';
|
||||
_.style.width = '4.5em';
|
||||
_.setAttribute('autocomplete', 'off');
|
||||
_.onchange = this.sortWeights.bind(this, _);
|
||||
$WH.ae(d, _);
|
||||
this.sortWeights(_);
|
||||
}
|
||||
|
||||
if (d.parentNode.childNodes.length == 1) {
|
||||
if (sel.selectedIndex > 0) {
|
||||
$WH.ae(d, $WH.ct(String.fromCharCode(160, 160)));
|
||||
$WH.ae(d, this.createControl(LANG.ficlear, '', '', this.resetWeights.bind(this)));
|
||||
}
|
||||
}
|
||||
else if (d.parentNode.childNodes.length > 1) {
|
||||
$WH.ae(d, $WH.ct(String.fromCharCode(160, 160)));
|
||||
$WH.ae(d, this.createControl(LANG.firemove, '', '', this.deleteWeight.bind(this, sel)));
|
||||
}
|
||||
},
|
||||
|
||||
sortWeights: function(input) {
|
||||
var
|
||||
_ = $WH.ge('su_weight'),
|
||||
v = Number(input.value),
|
||||
c = input.parentNode;
|
||||
|
||||
var n = 0;
|
||||
for (var i = 0, len = _.childNodes.length; i < len; ++i) {
|
||||
var d = _.childNodes[i];
|
||||
if (d.childNodes.length == 5) {
|
||||
if (d.childNodes[0].tagName == 'SELECT' && d.childNodes[2].tagName == 'INPUT') {
|
||||
if (v > Number(d.childNodes[2].value)) {
|
||||
_.insertBefore(c, d);
|
||||
return;
|
||||
}
|
||||
++n;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (n < len) {
|
||||
_.insertBefore(c, _.childNodes[n]);
|
||||
}
|
||||
else {
|
||||
$WH.ae(_, c);
|
||||
}
|
||||
},
|
||||
|
||||
saveScale: function() {
|
||||
if (!_curWT) {
|
||||
createStatusIcon('no scale selected');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var
|
||||
id = _curWT,
|
||||
scale = {},
|
||||
_ = $WH.ge('su_weight'),
|
||||
n = 0;
|
||||
|
||||
for (i = 0; i < _.childNodes.length; ++i) {
|
||||
var
|
||||
w = fi_Lookup($WH.gE(_.childNodes[i], 'select')[0].value, 'items'),
|
||||
inps = $WH.gE(_.childNodes[i], 'input'),
|
||||
v;
|
||||
|
||||
for (j in inps) {
|
||||
if (inps[j]) {
|
||||
v = inps[j].value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (w && v && v != 0) {
|
||||
scale[w.name] = v;
|
||||
++n;
|
||||
}
|
||||
}
|
||||
|
||||
var _ = _iconDiv.firstChild.firstChild.style;
|
||||
if (_.backgroundImage.length && (_.backgroundImage.indexOf(g_staticUrl) >= 4 || g_staticUrl == '')) {
|
||||
var
|
||||
start = _.backgroundImage.lastIndexOf('/'),
|
||||
end = _.backgroundImage.indexOf('.jpg');
|
||||
|
||||
if (start != -1 && end != -1) {
|
||||
__icon = _.backgroundImage.substring(start + 1, end);
|
||||
}
|
||||
}
|
||||
|
||||
wt_presets[id] = scale;
|
||||
|
||||
var data = [
|
||||
'id=' + id,
|
||||
'__icon=' + (__icon || '')
|
||||
];
|
||||
|
||||
n = 0;
|
||||
var scaStr = ''
|
||||
for (var w in scale) {
|
||||
if (!LANG.traits[w]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (n++ > 0) {
|
||||
scaStr += ',';
|
||||
}
|
||||
|
||||
scaStr += w + ':' + scale[w];
|
||||
}
|
||||
data.push('scale=' + scaStr);
|
||||
|
||||
$('#status-ic').append(CreateAjaxLoader());
|
||||
|
||||
new Ajax('?admin=weight-presets&action=save', {
|
||||
method: 'post',
|
||||
params: data.join('&'),
|
||||
onSuccess: function(xhr, opt) {
|
||||
switch (parseInt(xhr.responseText)) {
|
||||
case 0:
|
||||
createStatusIcon();
|
||||
break;
|
||||
case 1:
|
||||
createStatusIcon('could not write to DB');
|
||||
break;
|
||||
case 2:
|
||||
createStatusIcon('could not create file: datasets/weight-presets');
|
||||
break;
|
||||
default:
|
||||
createStatusIcon('an unknown error occured');
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
restorScale: function() {
|
||||
if (!_curWT)
|
||||
{
|
||||
createStatusIcon('no scale selected');
|
||||
return;
|
||||
}
|
||||
|
||||
loadScale(_curWT, true);
|
||||
}
|
||||
};
|
||||
|
||||
SummaryAdmin.traits = [
|
||||
{ id: 'sepbasestats', type: 'sep' },
|
||||
{ id: 'agi', type: 'sum' },
|
||||
{ id: 'int', type: 'sum' },
|
||||
{ id: 'sta', type: 'sum' },
|
||||
{ id: 'spi', type: 'sum' },
|
||||
{ id: 'str', type: 'sum' },
|
||||
{ id: 'health', type: 'sum' },
|
||||
{ id: 'mana', type: 'sum' },
|
||||
{ id: 'healthrgn', type: 'sum' },
|
||||
{ id: 'manargn', type: 'sum' },
|
||||
|
||||
{ id: 'sepdefensivestats', type: 'sep' },
|
||||
{ id: 'armor', type: 'sum' },
|
||||
{ id: 'blockrtng', type: 'sum', rating: 15 },
|
||||
{ id: 'block', type: 'sum' },
|
||||
{ id: 'defrtng', type: 'sum', rating: 12 },
|
||||
{ id: 'dodgertng', type: 'sum', rating: 13 },
|
||||
{ id: 'parryrtng', type: 'sum', rating: 14 },
|
||||
{ id: 'resirtng', type: 'sum', rating: 35 },
|
||||
|
||||
{ id: 'sepoffensivestats', type: 'sep' },
|
||||
{ id: 'atkpwr', type: 'sum' },
|
||||
{ id: 'feratkpwr', type: 'sum', indent: 1 },
|
||||
{ id: 'armorpenrtng', type: 'sum', rating: 44 },
|
||||
{ id: 'critstrkrtng', type: 'sum', rating: 32 },
|
||||
{ id: 'exprtng', type: 'sum', rating: 37 },
|
||||
{ id: 'hastertng', type: 'sum', rating: 36 },
|
||||
{ id: 'hitrtng', type: 'sum', rating: 31 },
|
||||
{ id: 'splpen', type: 'sum' },
|
||||
{ id: 'splpwr', type: 'sum' },
|
||||
{ id: 'arcsplpwr', type: 'sum', indent: 1 },
|
||||
{ id: 'firsplpwr', type: 'sum', indent: 1 },
|
||||
{ id: 'frosplpwr', type: 'sum', indent: 1 },
|
||||
{ id: 'holsplpwr', type: 'sum', indent: 1 },
|
||||
{ id: 'natsplpwr', type: 'sum', indent: 1 },
|
||||
{ id: 'shasplpwr', type: 'sum', indent: 1 },
|
||||
|
||||
{ id: 'sepweaponstats', type: 'sep' },
|
||||
|
||||
{ id: 'dmg', type: 'sum' },
|
||||
{ id: 'mledps', type: 'sum' },
|
||||
{ id: 'rgddps', type: 'sum' },
|
||||
|
||||
{ id: 'mledmgmin', type: 'sum' },
|
||||
{ id: 'rgddmgmin', type: 'sum' },
|
||||
|
||||
{ id: 'mledmgmax', type: 'sum' },
|
||||
{ id: 'rgddmgmax', type: 'sum' },
|
||||
|
||||
{ id: 'mlespeed', type: 'avg' },
|
||||
{ id: 'rgdspeed', type: 'avg' },
|
||||
|
||||
{ id: 'sepresistances', type: 'sep' },
|
||||
{ id: 'arcres', type: 'sum' },
|
||||
{ id: 'firres', type: 'sum' },
|
||||
{ id: 'frores', type: 'sum' },
|
||||
{ id: 'holres', type: 'sum' },
|
||||
{ id: 'natres', type: 'sum' },
|
||||
{ id: 'shares', type: 'sum' },
|
||||
|
||||
{ id: 'sepindividualstats', type: 'sep' },
|
||||
{ id: 'mleatkpwr', type: 'sum' },
|
||||
{ id: 'mlecritstrkrtng', type: 'sum', rating: 19 },
|
||||
{ id: 'mlehastertng', type: 'sum', rating: 28 },
|
||||
{ id: 'mlehitrtng', type: 'sum', rating: 16 },
|
||||
{ id: 'rgdatkpwr', type: 'sum' },
|
||||
{ id: 'rgdcritstrkrtng', type: 'sum', rating: 20 },
|
||||
{ id: 'rgdhastertng', type: 'sum', rating: 29 },
|
||||
{ id: 'rgdhitrtng', type: 'sum', rating: 17 },
|
||||
{ id: 'splcritstrkrtng', type: 'sum', rating: 21 },
|
||||
{ id: 'splhastertng', type: 'sum', rating: 30 },
|
||||
{ id: 'splhitrtng', type: 'sum', rating: 18 },
|
||||
{ id: 'spldmg', type: 'sum' },
|
||||
{ id: 'splheal', type: 'sum' },
|
||||
|
||||
{ id: '', name: LANG.sockets, type: 'sep' },
|
||||
{ id: 'nsockets', type: 'sum' },
|
||||
];
|
||||
|
||||
function createStatusIcon(errTxt)
|
||||
{
|
||||
_status = $WH.ge('status-ic');
|
||||
|
||||
$WH.ee(_status);
|
||||
|
||||
function fadeout()
|
||||
{
|
||||
$(this).animate({ opacity: '0.0' }, 250, null, function() {
|
||||
$WH.de(this);
|
||||
$WH.Tooltip.hide()
|
||||
});
|
||||
}
|
||||
|
||||
var a = $WH.ce('a');
|
||||
a.style.opacity = 0;
|
||||
a.className = errTxt ? 'icon-report' : 'icon-tick';
|
||||
g_addTooltip(a, errTxt || 'success', 'q');
|
||||
a.onclick = fadeout.bind(a);
|
||||
setTimeout(function () { $(a).animate({ opacity: '1.0' }, 250); }, 50);
|
||||
setTimeout(fadeout.bind(a), 5000);
|
||||
|
||||
$WH.ae(_status, a);
|
||||
}
|
||||
|
||||
function loadScale(wtId, restore)
|
||||
{
|
||||
if (!wtId)
|
||||
return;
|
||||
|
||||
src = restore ? wt_backup : wt_presets;
|
||||
|
||||
if (!restore)
|
||||
_nameSp.innerHTML = LANG.colon + this.innerHTML;
|
||||
|
||||
_iconInp.value = src[wtId].__icon;
|
||||
|
||||
_curWT = wtId;
|
||||
|
||||
SummaryAdmin.resetWeights();
|
||||
SummaryAdmin.updateWeights(src[wtId]);
|
||||
updateIcon();
|
||||
}
|
||||
|
||||
function updateIcon()
|
||||
{
|
||||
Icon.setTexture(_iconDiv.firstChild, 2, _iconInp.value.trim());
|
||||
}
|
||||
|
||||
var
|
||||
_iconDiv,
|
||||
_iconInp,
|
||||
_nameSp,
|
||||
_suDiv,
|
||||
_ctrlDiv,
|
||||
_curWT = null,
|
||||
wt_backup = {};
|
||||
|
||||
$(document).ready(function()
|
||||
{
|
||||
_iconDiv = $WH.ge('ic-container');
|
||||
_iconInp = $WH.ge('wt-icon');
|
||||
_nameSp = $WH.ge('wt-name');
|
||||
_suDiv = $WH.ge('su-container');
|
||||
_ctrlDiv = $WH.ge('su-controls');
|
||||
|
||||
_iconDiv.appendChild(Icon.create('inv_misc_questionmark', 2));
|
||||
|
||||
$WH.cO(wt_backup, wt_presets);
|
||||
|
||||
$('#text-generic td a').each(function(_, el) {
|
||||
el.innerHTML = LANG.presets[el.text];
|
||||
});
|
||||
|
||||
_iconInp.onchange = _iconInp.onkeyup = updateIcon.bind();
|
||||
|
||||
SummaryAdmin.updateControls();
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="main" id="main">
|
||||
<div class="main-precontents" id="main-precontents"></div>
|
||||
<div class="main-contents" id="main-contents">
|
||||
|
||||
<?php
|
||||
$this->brick('announcement');
|
||||
|
||||
$this->brick('pageTemplate');
|
||||
?>
|
||||
<div class="text">
|
||||
<h1><?=$this->name;?></h1>
|
||||
|
||||
<?php
|
||||
$this->brick('article');
|
||||
|
||||
if (isset($this->extraText)):
|
||||
?>
|
||||
<div id="text-generic" class="left"></div>
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
Markup.printHtml("<?=Util::jsEscape($this->extraText);?>", "text-generic", {
|
||||
allow: Markup.CLASS_ADMIN,
|
||||
dbpage: true
|
||||
});
|
||||
//]]></script>
|
||||
|
||||
<div class="pad2"></div>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
if (isset($this->extraHTML)):
|
||||
echo $this->extraHTML;
|
||||
endif;
|
||||
?>
|
||||
<h2>Edit<span id="wt-name"></span><span id="status-ic" style="float:right;"></span></h2>
|
||||
<div class="wt-edit">
|
||||
<div style="display:inline-block; vertical-align:top;"><div class="pad2" style="color: white; font-size: 15px; font-weight: bold;">Icon</div><input type="text" id="wt-icon" size="30" /></div>
|
||||
<div id="ic-container" style="display: inline-block; clear: left;"></div>
|
||||
</div>
|
||||
<div class="wt-edit">
|
||||
<div class="pad2" style="color: white; font-size: 15px; font-weight: bold;">Scale</div>
|
||||
<div id="su-container"></div>
|
||||
</div>
|
||||
<div id="su-controls" class="wt-edit" style="width:auto;"></div>
|
||||
</div>
|
||||
</div><!-- main-contents -->
|
||||
</div><!-- main -->
|
||||
|
||||
<?php $this->brick('footer'); ?>
|
||||
@@ -14,13 +14,13 @@ if (isset($this->notFound)):
|
||||
<div class="pad3"></div>
|
||||
|
||||
<div class="inputbox">
|
||||
<h1><?php echo $this->notFound['title']; ?></h1>
|
||||
<div id="inputbox-error"><?php echo $this->notFound['msg']; ?></div>
|
||||
<h1><?=$this->notFound['title'];?></h1>
|
||||
<div id="inputbox-error"><?=$this->notFound['msg'];?></div>
|
||||
<?php
|
||||
else:
|
||||
?>
|
||||
<div class="text">
|
||||
<h1><?php echo $this->name; ?></h1>
|
||||
<h1><?=$this->name;?></h1>
|
||||
|
||||
<?php
|
||||
$this->brick('article');
|
||||
@@ -29,7 +29,7 @@ else:
|
||||
?>
|
||||
<div id="text-generic" class="left"></div>
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
Markup.printHtml("<?php echo Util::jsEscape($this->extraText); ?>", "text-generic", {
|
||||
Markup.printHtml("<?=Util::jsEscape($this->extraText);?>", "text-generic", {
|
||||
allow: Markup.CLASS_ADMIN,
|
||||
dbpage: true
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user