From d47fa938069b9a75db1bac4f54f126aa44c8525b Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Sat, 28 Mar 2015 23:14:37 +0100 Subject: [PATCH] - enabled minimap in listviews for premium users & staff - NPCs: display information about mechImmune and extraFlags to staff --- pages/npc.php | 53 ++++++++++++++++++++++- pages/object.php | 2 +- setup/tools/filegen/templates/power.js.in | 2 +- static/js/global.js | 6 +++ 4 files changed, 60 insertions(+), 3 deletions(-) diff --git a/pages/npc.php b/pages/npc.php index 1df5c4a7..f14a668f 100644 --- a/pages/npc.php +++ b/pages/npc.php @@ -174,6 +174,57 @@ class NpcPage extends GenericPage $infobox[] = 'AI'.Lang::$main['colon'].$_; } + if (User::isInGroup(U_GROUP_STAFF)) + { + // Mechanic immune + if ($immuneMask = $this->subject->getField('mechanicImmuneMask')) + { + $buff = []; + for ($i = 0; $i < 31; $i++) + if ($immuneMask & (1 << $i)) + $buff[] = (!fMod(count($buff), 3) ? "\n" : null).'[url=?spells&filter=me='.($i + 1).']'.Lang::game('me', $i + 1).'[/url]'; + + $infobox[] = 'Not affected by mechanic'.Lang::main('colon').implode(', ', $buff); + } + + // extra flags + if ($flagsExtra = $this->subject->getField('flagsExtra')) + { + $buff = []; + if ($flagsExtra & 0x000001) + $buff[] = 'Binds attacker to instance on death'; + if ($flagsExtra & 0x000002) + $buff[] = '[tooltip name=civilian]does not aggro[/tooltip][span class=tip tooltip=civilian]Civilian[/span]'; + if ($flagsExtra & 0x000004) + $buff[] = 'Cannot parry'; + if ($flagsExtra & 0x000008) + $buff[] = 'Has no parry haste'; + if ($flagsExtra & 0x000010) + $buff[] = 'Cannot block'; + if ($flagsExtra & 0x000020) + $buff[] = 'Cannot deal Crushing Blows'; + if ($flagsExtra & 0x000040) + $buff[] = 'Rewards no experience'; + if ($flagsExtra & 0x000080) + $buff[] = 'Trigger-Creature'; + if ($flagsExtra & 0x000100) + $buff[] = 'Immune to Taunt'; + if ($flagsExtra & 0x008000) + $buff[] = '[tooltip name=guard]ignores enemy stealth, invisibility and Feign Death[/tooltip][span class=tip tooltip=guard]Guard[/span]'; + if ($flagsExtra & 0x020000) + $buff[] = 'Cannot deal Critical Hits'; + if ($flagsExtra & 0x040000) + $buff[] = 'Attacker does not gain weapon skill'; + if ($flagsExtra & 0x080000) + $buff[] = 'Taunt has diminishing returns'; + if ($flagsExtra & 0x100000) + $buff[] = 'Is subject to diminishing returns'; + + if ($buff) + $infobox[] = 'Extra Flags'.Lang::main('colon').'[ul][li]'.implode('[/li][li]', $buff).'[/li][/ul]'; + } + } + // > Stats $_nf = function ($num) { return number_format($num, 0, '', '.'); }; $stats = []; @@ -735,7 +786,7 @@ class NpcPage extends GenericPage $x = '$WowheadPower.registerNpc('.$this->typeId.', '.User::$localeId.", {\n"; $x .= "\tname_".User::$localeString.": '".Util::jsEscape($this->subject->getField('name', true))."',\n"; $x .= "\ttooltip_".User::$localeString.": '".Util::jsEscape($this->subject->renderTooltip())."',\n"; - $x .= "\tmap: ".($s ? Util::toJSON(['zone' => $s[0], 'coords' => [$s[1] => $s[2]]]) : '{}')."\n"; + $x .= "\tmap: ".($s ? "{zone: ".$s[0].", coords: {".$s[1].":".Util::toJSON($s[2])."}}" : '{}')."\n"; $x .= "});"; return $x; diff --git a/pages/object.php b/pages/object.php index 1eaf6f33..c8195d9e 100644 --- a/pages/object.php +++ b/pages/object.php @@ -465,7 +465,7 @@ class ObjectPage extends GenericPage $x = '$WowheadPower.registerObject('.$this->typeId.', '.User::$localeId.", {\n"; $x .= "\tname_".User::$localeString.": '".Util::jsEscape($this->subject->getField('name', true))."',\n"; $x .= "\ttooltip_".User::$localeString.": '".Util::jsEscape($this->subject->renderTooltip())."',\n"; - $x .= "\tmap: ".($s ? Util::toJSON(['zone' => $s[0], 'coords' => [$s[1] => $s[2]]]) : '{}')."\n"; + $x .= "\tmap: ".($s ? "{zone: ".$s[0].", coords: {".$s[1].":".Util::toJSON($s[2])."}}" : '{}')."\n"; $x .= "});"; return $x; diff --git a/setup/tools/filegen/templates/power.js.in b/setup/tools/filegen/templates/power.js.in index f6b50fe1..142d695f 100644 --- a/setup/tools/filegen/templates/power.js.in +++ b/setup/tools/filegen/templates/power.js.in @@ -666,7 +666,7 @@ if (typeof $WowheadPower == "undefined") { arr[id].timer = null; } - if (!$WH.wowheadRemote && json.map) { + if (!$WH.wowheadRemote && !$.isEmptyObject(json.map)) { if (arr[id].map == null) { arr[id].map = new Mapper({ parent: $WH.ce("div"), diff --git a/static/js/global.js b/static/js/global.js index 95865701..3c64a0e7 100644 --- a/static/js/global.js +++ b/static/js/global.js @@ -10493,6 +10493,9 @@ Listview.templates = { a.style.backgroundImage = "url(" + g_staticUrl + "/images/wow/icons/tiny/quest_start.gif)"; } + if (g_user.roles & U_GROUP_PREMIUM_PERMISSIONS) + a.rel = 'map'; + $WH.ae(wrapper, a); if (npc.tag != null) { @@ -10731,6 +10734,9 @@ Listview.templates = { a.style.backgroundImage = "url(" + g_staticUrl + "/images/wow/icons/tiny/quest_start.gif)"; } + if (g_user.roles & U_GROUP_PREMIUM_PERMISSIONS) + a.rel = 'map'; + $WH.ae(wrapper, a); if (object.method != null) {