From fbfb81cd2588ee5290b02201c378298ed5520cfc Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Thu, 24 Jul 2025 17:17:40 +0200 Subject: [PATCH] Profiler/Talents * use icon from g_file_specs instead of weightscale data * fix detecting tank subspec for class 6 --- pages/admin.php | 4 +- setup/db_structure.sql | 5 ++- setup/tools/filegen/weightpresets.ss.php | 4 +- setup/updates/1753369288_01.sql | 27 +++++++++++++ static/js/Profiler.js | 49 ++++++++++++++++++------ static/js/global.js | 5 ++- 6 files changed, 75 insertions(+), 19 deletions(-) create mode 100644 setup/updates/1753369288_01.sql diff --git a/pages/admin.php b/pages/admin.php index dc29d567..3e665095 100644 --- a/pages/admin.php +++ b/pages/admin.php @@ -249,8 +249,8 @@ class AdminPage extends GenericPage $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'); + $scales = DB::Aowow()->select('SELECT `class` AS ARRAY_KEY, `id` AS ARRAY_KEY2, `name`, `icon` FROM ?_account_weightscales WHERE `userId` = 0 ORDER BY `class`, `orderIdx` ASC'); + $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 = ''; diff --git a/setup/db_structure.sql b/setup/db_structure.sql index c33b6210..e8e25242 100644 --- a/setup/db_structure.sql +++ b/setup/db_structure.sql @@ -208,6 +208,7 @@ CREATE TABLE `aowow_account_weightscales` ( `userId` int unsigned NOT NULL, `name` varchar(32) NOT NULL, `class` tinyint unsigned NOT NULL DEFAULT 0, + `orderIdx` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'check how Profiler handles classes with more than 3 specs before modifying', `icon` varchar(51) NOT NULL DEFAULT '', PRIMARY KEY (`id`), KEY `FK_acc_weights` (`userId`), @@ -3271,7 +3272,7 @@ UNLOCK TABLES; 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_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'); +INSERT INTO `aowow_account_weightscales` VALUES (1,0,'arms',1,0,'ability_rogue_eviscerate'),(2,0,'fury',1,1,'ability_warrior_innerrage'),(3,0,'prot',1,2,'ability_warrior_defensivestance'),(4,0,'holy',2,0,'spell_holy_holybolt'),(5,0,'prot',2,1,'ability_paladin_shieldofthetemplar'),(6,0,'retrib',2,2,'spell_holy_auraoflight'),(7,0,'beast',3,0,'ability_hunter_beasttaming'),(8,0,'marks',3,1,'ability_marksmanship'),(9,0,'surv',3,2,'ability_hunter_swiftstrike'),(10,0,'assas',4,0,'ability_rogue_eviscerate'),(11,0,'combat',4,1,'ability_backstab'),(12,0,'subtle',4,2,'ability_stealth'),(13,0,'disc',5,0,'spell_holy_wordfortitude'),(14,0,'holy',5,1,'spell_holy_guardianspirit'),(15,0,'shadow',5,2,'spell_shadow_shadowwordpain'),(16,0,'blooddps',6,0,'spell_deathknight_bloodpresence'),(17,0,'frostdps',6,1,'spell_deathknight_frostpresence'),(18,0,'frosttank',6,2,'spell_deathknight_frostpresence'),(19,0,'unholydps',6,3,'spell_deathknight_unholypresence'),(20,0,'elem',7,0,'spell_nature_lightning'),(21,0,'enhance',7,1,'spell_nature_lightningshield'),(22,0,'resto',7,2,'spell_nature_magicimmunity'),(23,0,'arcane',8,0,'spell_holy_magicalsentry'),(24,0,'fire',8,1,'spell_fire_firebolt02'),(25,0,'frost',8,2,'spell_frost_frostbolt02'),(26,0,'afflic',9,0,'spell_shadow_deathcoil'),(27,0,'demo',9,1,'spell_shadow_metamorphosis'),(28,0,'destro',9,2,'spell_shadow_rainoffire'),(29,0,'balance',11,0,'spell_nature_starfall'),(30,0,'feraltank',11,2,'ability_racial_bearform'),(31,0,'resto',11,3,'spell_nature_healingtouch'),(32,0,'feraldps',11,1,'ability_druid_catform'); /*!40000 ALTER TABLE `aowow_account_weightscales` ENABLE KEYS */; UNLOCK TABLES; @@ -3321,7 +3322,7 @@ UNLOCK TABLES; LOCK TABLES `aowow_dbversion` WRITE; /*!40000 ALTER TABLE `aowow_dbversion` DISABLE KEYS */; -INSERT INTO `aowow_dbversion` VALUES (1724095917,0,NULL,NULL); +INSERT INTO `aowow_dbversion` VALUES (1753369289,0,NULL,NULL); /*!40000 ALTER TABLE `aowow_dbversion` ENABLE KEYS */; UNLOCK TABLES; diff --git a/setup/tools/filegen/weightpresets.ss.php b/setup/tools/filegen/weightpresets.ss.php index 04a30701..e884fa2f 100644 --- a/setup/tools/filegen/weightpresets.ss.php +++ b/setup/tools/filegen/weightpresets.ss.php @@ -21,11 +21,11 @@ CLISetup::registerSetup("build", new class extends SetupScript public function generate() : bool { $wtPresets = []; - $scales = DB::Aowow()->select('SELECT id, name, icon, class FROM ?_account_weightscales WHERE userId = 0 ORDER BY class, id ASC'); + $scales = DB::Aowow()->select('SELECT `id`, `name`, `icon`, `class` FROM ?_account_weightscales WHERE `userId` = 0 ORDER BY `class`, `orderIdx` ASC'); foreach ($scales as $s) { - if ($weights = DB::Aowow()->selectCol('SELECT field AS ARRAY_KEY, val FROM ?_account_weightscale_data WHERE id = ?d', $s['id'])) + if ($weights = DB::Aowow()->selectCol('SELECT `field` AS ARRAY_KEY, `val` FROM ?_account_weightscale_data WHERE `id` = ?d', $s['id'])) $wtPresets[$s['class']]['pve'][$s['name']] = array_merge(['__icon' => $s['icon']], $weights); else { diff --git a/setup/updates/1753369288_01.sql b/setup/updates/1753369288_01.sql new file mode 100644 index 00000000..cc7a46fc --- /dev/null +++ b/setup/updates/1753369288_01.sql @@ -0,0 +1,27 @@ +ALTER TABLE aowow_account_weightscales + ADD COLUMN `orderIdx` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'check how Profiler handles classes with more than 3 specs before modifying' AFTER `class`; + +UPDATE aowow_account_weightscales SET `orderIdx` = 1 WHERE `userId` = 0 AND `class` = 1 AND `name` = 'fury'; +UPDATE aowow_account_weightscales SET `orderIdx` = 2 WHERE `userId` = 0 AND `class` = 1 AND `name` = 'prot'; +UPDATE aowow_account_weightscales SET `orderIdx` = 1 WHERE `userId` = 0 AND `class` = 2 AND `name` = 'prot'; +UPDATE aowow_account_weightscales SET `orderIdx` = 2 WHERE `userId` = 0 AND `class` = 2 AND `name` = 'retrib'; +UPDATE aowow_account_weightscales SET `orderIdx` = 1 WHERE `userId` = 0 AND `class` = 3 AND `name` = 'marks'; +UPDATE aowow_account_weightscales SET `orderIdx` = 2 WHERE `userId` = 0 AND `class` = 3 AND `name` = 'surv'; +UPDATE aowow_account_weightscales SET `orderIdx` = 1 WHERE `userId` = 0 AND `class` = 4 AND `name` = 'combat'; +UPDATE aowow_account_weightscales SET `orderIdx` = 2 WHERE `userId` = 0 AND `class` = 4 AND `name` = 'subtle'; +UPDATE aowow_account_weightscales SET `orderIdx` = 1 WHERE `userId` = 0 AND `class` = 5 AND `name` = 'holy'; +UPDATE aowow_account_weightscales SET `orderIdx` = 2 WHERE `userId` = 0 AND `class` = 5 AND `name` = 'shadow'; +UPDATE aowow_account_weightscales SET `orderIdx` = 1 WHERE `userId` = 0 AND `class` = 6 AND `name` = 'frostdps'; +UPDATE aowow_account_weightscales SET `orderIdx` = 2 WHERE `userId` = 0 AND `class` = 6 AND `name` = 'frosttank'; +UPDATE aowow_account_weightscales SET `orderIdx` = 3 WHERE `userId` = 0 AND `class` = 6 AND `name` = 'unholydps'; +UPDATE aowow_account_weightscales SET `orderIdx` = 1 WHERE `userId` = 0 AND `class` = 7 AND `name` = 'enhance'; +UPDATE aowow_account_weightscales SET `orderIdx` = 2 WHERE `userId` = 0 AND `class` = 7 AND `name` = 'resto'; +UPDATE aowow_account_weightscales SET `orderIdx` = 1 WHERE `userId` = 0 AND `class` = 8 AND `name` = 'fire'; +UPDATE aowow_account_weightscales SET `orderIdx` = 2 WHERE `userId` = 0 AND `class` = 8 AND `name` = 'frost'; +UPDATE aowow_account_weightscales SET `orderIdx` = 1 WHERE `userId` = 0 AND `class` = 9 AND `name` = 'demo'; +UPDATE aowow_account_weightscales SET `orderIdx` = 2 WHERE `userId` = 0 AND `class` = 9 AND `name` = 'destro'; +UPDATE aowow_account_weightscales SET `orderIdx` = 1 WHERE `userId` = 0 AND `class` = 11 AND `name` = 'feraldps'; +UPDATE aowow_account_weightscales SET `orderIdx` = 2 WHERE `userId` = 0 AND `class` = 11 AND `name` = 'feraltank'; +UPDATE aowow_account_weightscales SET `orderIdx` = 3 WHERE `userId` = 0 AND `class` = 11 AND `name` = 'resto'; + +UPDATE `aowow_dbversion` SET `build` = CONCAT(IFNULL(`build`, ''), ' weightpresets'); diff --git a/static/js/Profiler.js b/static/js/Profiler.js index 68e69217..0add9288 100644 --- a/static/js/Profiler.js +++ b/static/js/Profiler.js @@ -1622,7 +1622,8 @@ function Profiler() { specData = pr_getSpecFromTalents(_profile.classs, buildData.spent), spSpec = _divSpec.childNodes[1]; - spSpec.style.backgroundImage = 'url(' + g_staticUrl + '/images/wow/icons/tiny/' + specData.icon.toLowerCase() + '.gif)'; + // aowow - spSpec.style.backgroundImage = 'url(' + g_staticUrl + '/images/wow/icons/tiny/' + specData.icon.toLowerCase() + '.gif)'; + spSpec.style.backgroundImage = 'url(' + g_staticUrl + '/images/wow/icons/tiny/' + (g_file_specs[_profile.classs][specData.id - 1] ?? g_file_specs[specData.id]) + '.gif)'; $WH.st(spSpec, (buildData.spent ? buildData.spent.join('/') : '0/0/0')); spSpec.onmouseover = function (e) { @@ -2315,7 +2316,8 @@ function ProfilerTalents(_parent) { var specData = pr_getSpecFromTalents(_profile.classs, _builds[build].spent); if (sp) { - sp.style.backgroundImage = 'url(' + g_staticUrl + '/images/wow/icons/tiny/' + specData.icon.toLowerCase() + '.gif)'; + // aowow - sp.style.backgroundImage = 'url(' + g_staticUrl + '/images/wow/icons/tiny/' + specData.icon.toLowerCase() + '.gif)'; + sp.style.backgroundImage = 'url(' + g_staticUrl + '/images/wow/icons/tiny/' + (g_file_specs[_profile.classs][specData.id - 1] ?? g_file_specs[specData.id]) + '.gif)'; $WH.ae(sp, $WH.ct(specData.name + ' ')); $WH.st(sm, '(' + _builds[build].spent.join('/') + ')'); @@ -2461,17 +2463,42 @@ function ProfilerTalents(_parent) { pve = wt_presets[_profile.classs].pve, t = spec - 1; - if (_profile.classs == 11 && spec == 2) { // Feral Druid (2 specs) - // Protector of the Pack, Natural Reaction - var tankTalents = [2241, 2242]; - t += 2; - for (var i = 0, len = tankTalents.length; i < len; ++i) { - if (!_self.getTalentRanks(tankTalents[i])) { - continue; + if (_profile.classs == 11 && spec > 1) { // Feral Druid (2 specs) + if (spec > 2) + t++; + else { + // Protector of the Pack, Natural Reaction + var tankTalents = [2241, 2242]; + for (var i = 0, len = tankTalents.length; i < len; ++i) { + if (_self.getTalentRanks(tankTalents[i])) { + t++; + break; + } } + } + } - t -= 2; - break; + // aowow - DKs also have 2 specs in Frost .. why wasn't that handled, what did i miss..? + if (_profile.classs == 6 && spec > 1) { // Frost Deathknight (2 specs) + if (spec > 2) + t++; + else { + // Dark Command + var tankGlyphs = [43538]; + var usedGlyphs = _builds[_active].glyphs.split(':'); + if (usedGlyphs.filter(x => tankGlyphs.includes(x)).length) + t++; + else + { + // Toughness, Frigid Dreadplate, Improved Frost Presence + var tankTalents = [1968, 1990, 2029]; + for (var i = 0, len = tankTalents.length; i < len; ++i) { + if (_self.getTalentRanks(tankTalents[i])) { + t++; + break; + } + } + } } } diff --git a/static/js/global.js b/static/js/global.js index ea8dec09..d3f21901 100644 --- a/static/js/global.js +++ b/static/js/global.js @@ -16342,7 +16342,8 @@ Listview.templates = { var a = $WH.ce('a'); a.className = 'icontiny tinyspecial tip q1'; - a.style.backgroundImage = 'url(' + g_staticUrl + '/images/wow/icons/tiny/' + specData.icon.toLowerCase() + '.gif)'; + // aowow - a.style.backgroundImage = 'url(' + g_staticUrl + '/images/wow/icons/tiny/' + specData.icon.toLowerCase() + '.gif)'; + a.style.backgroundImage = 'url(' + g_staticUrl + '/images/wow/icons/tiny/' + (g_file_specs[profile.classs][specData.id - 1] ?? g_file_specs[specData.id]) + '.gif)'; a.rel = 'np'; a.href = this.getItemLink(profile) + '#talents'; g_addTooltip(a, specData.name); @@ -23253,7 +23254,7 @@ var g_file_classes = { }; var g_file_specs = { - "-1": 'inv_misc_questionmark', + "-1": 'spell_shadow_sacrificialshield', 0: 'spell_nature_elementalabsorption', 6: ['spell_deathknight_bloodpresence', 'spell_deathknight_frostpresence', 'spell_deathknight_unholypresence' ], 11: ['spell_nature_starfall', 'ability_racial_bearform', 'spell_nature_healingtouch' ],