diff --git a/.github/workflows/build-beta.yml b/.github/workflows/build-beta.yml index c8c0e1d179..92dc00c68f 100644 --- a/.github/workflows/build-beta.yml +++ b/.github/workflows/build-beta.yml @@ -22,6 +22,12 @@ jobs: args: "--no-color -q" annotate: warning + - uses: JohnnyMorganz/stylua-action@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + args: --check . --output-format=summary + version: v0.15.1 + - name: Generate Changelog run: ./generate_changelog.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 51450d33fc..dfd838780b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,6 +23,12 @@ jobs: args: "--no-color -q" annotate: warning + - uses: JohnnyMorganz/stylua-action@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + args: --check . --output-format=summary + version: v0.15.1 + - name: Update CurseForge Translations run: ./update_translations.sh env: diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index c4f01866dd..9fe978f166 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -7,9 +7,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 with: fetch-depth: 200 + ref: ${{ github.event.pull_request.head.sha }} - name: Install and run Luacheck uses: nebularg/actions-luacheck@v1 @@ -17,6 +18,12 @@ jobs: args: "--no-color -q" annotate: warning + - uses: JohnnyMorganz/stylua-action@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + args: --check . --output-format=summary + version: v0.15.1 + - name: Update Build Date run: sed -i "s/@build-time@/`date +%Y%m%d%H%M%S`/" WeakAuras/Init.lua diff --git a/.styluaignore b/.styluaignore new file mode 100644 index 0000000000..e2d88085e7 --- /dev/null +++ b/.styluaignore @@ -0,0 +1,6 @@ +WeakAurasModelPaths +Libs +babelfish.lua +WeakAuras_Main.lua +WeakAuras_Options.lua +WeakAuras_Templates.lua diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c0f9280983..dab9189506 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,11 +7,10 @@ There are a few things which we require in any contribution: - This repository comes with a `.editorconfig` file, so the following requirements will be taken care of if you have [EditorConfig](https://editorconfig.org/) installed: - Tabs consist of 2 spaces. - Files end with a newline. - - Line endings in addon files must be Windows-Style (CRLF). This is a WoW AddOn, pretty much everyone is going to be running Windows when using or developing WeakAuras. - No trailing whitespace at the end of a line. + - We use [StyLua](https://github.com/JohnnyMorganz/StyLua) for automatic code formatting. Make sure you apply it to your changes before commiting them. There are extensions for the most common IDEs and editors as well as CLI tools to do that. - All user-facing strings (`names` and `desc` fields in AceConfig tables, mostly) must be localized: - We use a locale scraper to find translation phrases and automatically export them to CurseForge for translation. This scraper parses the addon files, looking for tokens that look like: `L["some translation phrase"]`. You must use double quoted strings, and name the localization table (found at `WeakAuras.L`) `L` in your code for this to work properly. -- When writing a new file, avoid using semicolons. When modifying code in an existing file, try to be consistent, but err on the side of no semicolons. - New features should be indicated by concatenating `WeakAuras.newFeatureString` onto the associated translation phrase. We will remove the new feature indicator approximately 3 months after the first release. ## Pull Requests @@ -24,19 +23,19 @@ If you want to help, here's what you need to do: 1. Create a new topic branch (based on the `main` branch) to contain your feature, change, or fix. ```bash - > git checkout -b my-topic-branch + git checkout -b my-topic-branch ``` 1. Set `core.autocrlf` to true. ```bash - > git config core.autocrlf true + git config core.autocrlf true ``` 1. Set `pull.rebase`to true. ```bash - > git config pull.rebase true + git config pull.rebase true ``` 1. Set up your [Git identity](https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup) so your commits are attributed to your name and email address properly. @@ -45,11 +44,13 @@ If you want to help, here's what you need to do: 1. Install an [EditorConfig](https://editorconfig.org/) plugin for your text editor to automatically follow our indenting rules. +1. Install and run [StyLua](https://github.com/JohnnyMorganz/StyLua). + 1. Commit and push your changes to your new branch. ```bash - > git commit -a -m "commit-description" - > git push + git commit -a -m "commit-description" + git push ``` 1. [Open a Pull Request](https://github.com/WeakAuras/WeakAuras2/pulls) with a clear title and description. @@ -65,9 +66,9 @@ If you want to help, here's what you need to do: - In order to sync your fork with the upstream WeakAuras repository you would do ```bash - > git fetch upstream - > git checkout main - > git rebase upstream/main + git fetch upstream + git checkout main + git rebase upstream/main ``` - You are now all synced up. @@ -77,16 +78,16 @@ If you want to help, here's what you need to do: - In order to sync your pull request with the upstream WeakAuras repository in case there are any conflicts you would do ```bash - > git fetch upstream - > git checkout my-topic-branch - > git rebase upstream/main + git fetch upstream + git checkout my-topic-branch + git rebase upstream/main ``` - In case there are any conflicts, you will now have to [fix them manually](https://help.github.com/articles/resolving-merge-conflicts-after-a-git-rebase/). - After you're done with that, you are ready to force-push your changes. ```bash - > git push --force + git push --force ``` - Note: Force-pushing is a destructive operation, so make sure you don't lose something in the progress. diff --git a/README.md b/README.md index 5d2da01f1c..863ad98d84 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@ # WeakAuras -[![Build Status](https://github.com/WeakAuras/WeakAuras2/workflows/CI/badge.svg)](https://github.com/WeakAuras/WeakAuras2/actions?workflow=CI) +[![Build Status](https://github.com/WeakAuras/WeakAuras2/workflows/CI/badge.svg)](https://github.com/WeakAuras/WeakAuras2/actions?workflow=CI) [![Code Style: StyLua](https://img.shields.io/badge/code%20style-stylua-brightgreen.svg)](https://github.com/JohnnyMorganz/StyLua "StyLua") + [![WeakAuras on Discord](https://img.shields.io/badge/discord-weakauras-738bd7.svg?style=flat)](https://discord.gg/weakauras) [![Patreon](https://img.shields.io/badge/patreon-donate-orange.svg)](https://www.patreon.com/weakauras) ![Logo](https://i.imgur.com/wwbxeCG.jpeg) diff --git a/WeakAuras/Animations.lua b/WeakAuras/Animations.lua index db570e1ef1..0d21222c51 100644 --- a/WeakAuras/Animations.lua +++ b/WeakAuras/Animations.lua @@ -1,173 +1,173 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, Private = ... local L = WeakAuras.L -- Animations local animations = {} local pending_controls = {} -local anim_function_strings = Private.anim_function_strings; +local anim_function_strings = Private.anim_function_strings local function noopErrorHandler() end local frame = WeakAuras.frames["WeakAuras Main Frame"] -local updatingAnimations; -local last_update = GetTime(); +local updatingAnimations +local last_update = GetTime() local function UpdateAnimations() - Private.StartProfileSystem("animations"); + Private.StartProfileSystem("animations") for groupUid, groupRegion in pairs(pending_controls) do - pending_controls[groupUid] = nil; - groupRegion:DoPositionChildren(); + pending_controls[groupUid] = nil + groupRegion:DoPositionChildren() end - local time = GetTime(); - local elapsed = time - last_update; - last_update = time; - local num = 0; + local time = GetTime() + local elapsed = time - last_update + last_update = time + local num = 0 for key, anim in pairs(animations) do - Private.StartProfileUID(anim.auraUID); - num = num + 1; - local finished = false; - if(anim.duration_type == "seconds") then + Private.StartProfileUID(anim.auraUID) + num = num + 1 + local finished = false + if anim.duration_type == "seconds" then if anim.duration > 0 then - anim.progress = anim.progress + (elapsed / anim.duration); + anim.progress = anim.progress + (elapsed / anim.duration) else - anim.progress = anim.progress + (elapsed / 1); + anim.progress = anim.progress + (elapsed / 1) end - if(anim.progress >= 1) then - anim.progress = 1; - finished = true; + if anim.progress >= 1 then + anim.progress = 1 + finished = true end - elseif(anim.duration_type == "relative") then - local state = anim.region.state; - if (not state - or (state.progressType == "timed" and state.duration < 0.01) - or (state.progressType == "static" and state.value < 0.01)) then - anim.progress = 0; - if(anim.type == "start" or anim.type == "finish") then - finished = true; + elseif anim.duration_type == "relative" then + local state = anim.region.state + if not state or (state.progressType == "timed" and state.duration < 0.01) or (state.progressType == "static" and state.value < 0.01) then + anim.progress = 0 + if anim.type == "start" or anim.type == "finish" then + finished = true end else - local relativeProgress = 0; - if(state.progressType == "static") then - relativeProgress = state.value / state.total; - elseif (state.progressType == "timed") then - relativeProgress = 1 - ((state.expirationTime - time) / state.duration); + local relativeProgress = 0 + if state.progressType == "static" then + relativeProgress = state.value / state.total + elseif state.progressType == "timed" then + relativeProgress = 1 - ((state.expirationTime - time) / state.duration) end - relativeProgress = state.inverse and (1 - relativeProgress) or relativeProgress; - anim.progress = anim.duration > 0 and relativeProgress / anim.duration or 0 - local iteration = math.floor(anim.progress); + relativeProgress = state.inverse and (1 - relativeProgress) or relativeProgress + anim.progress = anim.duration > 0 and relativeProgress / anim.duration or 0 + local iteration = math.floor(anim.progress) --anim.progress = anim.progress - iteration; - if not(anim.iteration) then - anim.iteration = iteration; - elseif(anim.iteration ~= iteration) then - anim.iteration = nil; - finished = true; + if not anim.iteration then + anim.iteration = iteration + elseif anim.iteration ~= iteration then + anim.iteration = nil + finished = true end end else - anim.progress = 1; + anim.progress = 1 end - local progress = anim.inverse and (1 - anim.progress) or anim.progress; + local progress = anim.inverse and (1 - anim.progress) or anim.progress progress = anim.easeFunc(progress, anim.easeStrength or 3) Private.ActivateAuraEnvironmentForRegion(anim.region) - if(anim.translateFunc) then + if anim.translateFunc then local errorHandler = WeakAuras.IsOptionsOpen() and noopErrorHandler or Private.GetErrorHandlerUid(anim.auraUID, L["Slide Animation"]) - if (anim.region.SetOffsetAnim) then - local ok, x, y = xpcall(anim.translateFunc, errorHandler, progress, 0, 0, anim.dX, anim.dY); - anim.region:SetOffsetAnim(x, y); + if anim.region.SetOffsetAnim then + local ok, x, y = xpcall(anim.translateFunc, errorHandler, progress, 0, 0, anim.dX, anim.dY) + anim.region:SetOffsetAnim(x, y) else - anim.region:ClearAllPoints(); - local ok, x, y = xpcall(anim.translateFunc, errorHandler, progress, anim.startX, anim.startY, anim.dX, anim.dY); - if (ok) then - anim.region:SetPoint(anim.selfPoint, anim.anchor, anim.anchorPoint, x, y); + anim.region:ClearAllPoints() + local ok, x, y = xpcall(anim.translateFunc, errorHandler, progress, anim.startX, anim.startY, anim.dX, anim.dY) + if ok then + anim.region:SetPoint(anim.selfPoint, anim.anchor, anim.anchorPoint, x, y) end end end - if(anim.alphaFunc) then + if anim.alphaFunc then local errorHandler = WeakAuras.IsOptionsOpen() and noopErrorHandler or Private.GetErrorHandlerUid(anim.auraUID, L["Fade Animation"]) - local ok, alpha = xpcall(anim.alphaFunc, errorHandler, progress, anim.startAlpha, anim.dAlpha); - if (ok) then - if (anim.region.SetAnimAlpha) then - anim.region:SetAnimAlpha(alpha); + local ok, alpha = xpcall(anim.alphaFunc, errorHandler, progress, anim.startAlpha, anim.dAlpha) + if ok then + if anim.region.SetAnimAlpha then + anim.region:SetAnimAlpha(alpha) else - anim.region:SetAlpha(alpha); + anim.region:SetAlpha(alpha) end end end - if(anim.scaleFunc) then + if anim.scaleFunc then local errorHandler = WeakAuras.IsOptionsOpen() and noopErrorHandler or Private.GetErrorHandlerUid(anim.auraUID, L["Zoom Animation"]) - local ok, scaleX, scaleY = xpcall(anim.scaleFunc, errorHandler, progress, 1, 1, anim.scaleX, anim.scaleY); - if (ok) then - if(anim.region.Scale) then - anim.region:Scale(scaleX, scaleY); + local ok, scaleX, scaleY = xpcall(anim.scaleFunc, errorHandler, progress, 1, 1, anim.scaleX, anim.scaleY) + if ok then + if anim.region.Scale then + anim.region:Scale(scaleX, scaleY) else - anim.region:SetWidth(anim.startWidth * scaleX); - anim.region:SetHeight(anim.startHeight * scaleY); + anim.region:SetWidth(anim.startWidth * scaleX) + anim.region:SetHeight(anim.startHeight * scaleY) end end end - if(anim.rotateFunc and anim.region.Rotate) then + if anim.rotateFunc and anim.region.Rotate then local errorHandler = WeakAuras.IsOptionsOpen() and noopErrorHandler or Private.GetErrorHandlerUid(anim.auraUID, L["Rotate Animation"]) - local ok, rotate = xpcall(anim.rotateFunc, errorHandler, progress, anim.startRotation, anim.rotate); - if (ok) then - anim.region:Rotate(rotate); + local ok, rotate = xpcall(anim.rotateFunc, errorHandler, progress, anim.startRotation, anim.rotate) + if ok then + anim.region:Rotate(rotate) end end - if(anim.colorFunc and anim.region.ColorAnim) then + if anim.colorFunc and anim.region.ColorAnim then local errorHandler = WeakAuras.IsOptionsOpen() and noopErrorHandler or Private.GetErrorHandlerUid(anim.auraUID, L["Color Animation"]) - local startR, startG, startB, startA = anim.region:GetColor(); - startR, startG, startB, startA = startR or 1, startG or 1, startB or 1, startA or 1; - local ok, r, g, b, a = xpcall(anim.colorFunc, errorHandler, progress, startR, startG, startB, startA, anim.colorR, anim.colorG, anim.colorB, anim.colorA); - if (ok) then - anim.region:ColorAnim(r, g, b, a); + local startR, startG, startB, startA = anim.region:GetColor() + startR, startG, startB, startA = startR or 1, startG or 1, startB or 1, startA or 1 + local ok, r, g, b, a = xpcall(anim.colorFunc, errorHandler, progress, startR, startG, startB, startA, anim.colorR, anim.colorG, anim.colorB, anim.colorA) + if ok then + anim.region:ColorAnim(r, g, b, a) end end - Private.ActivateAuraEnvironment(nil); - if(finished) then - if not(anim.loop) then - if (anim.region.SetOffsetAnim) then - anim.region:SetOffsetAnim(0, 0); + Private.ActivateAuraEnvironment(nil) + if finished then + if not anim.loop then + if anim.region.SetOffsetAnim then + anim.region:SetOffsetAnim(0, 0) else - if(anim.startX) then - anim.region:SetPoint(anim.selfPoint, anim.anchor, anim.anchorPoint, anim.startX, anim.startY); + if anim.startX then + anim.region:SetPoint(anim.selfPoint, anim.anchor, anim.anchorPoint, anim.startX, anim.startY) end end - if (anim.region.SetAnimAlpha) then - anim.region:SetAnimAlpha(nil); - elseif(anim.startAlpha) then - anim.region:SetAlpha(anim.startAlpha); + if anim.region.SetAnimAlpha then + anim.region:SetAnimAlpha(nil) + elseif anim.startAlpha then + anim.region:SetAlpha(anim.startAlpha) end - if(anim.startWidth) then - if(anim.region.Scale) then - anim.region:Scale(1, 1); + if anim.startWidth then + if anim.region.Scale then + anim.region:Scale(1, 1) else - anim.region:SetWidth(anim.startWidth); - anim.region:SetHeight(anim.startHeight); + anim.region:SetWidth(anim.startWidth) + anim.region:SetHeight(anim.startHeight) end end - if(anim.startRotation) then - if(anim.region.Rotate) then - anim.region:Rotate(anim.startRotation); + if anim.startRotation then + if anim.region.Rotate then + anim.region:Rotate(anim.startRotation) end end - if(anim.region.ColorAnim) then - anim.region:ColorAnim(nil); + if anim.region.ColorAnim then + anim.region:ColorAnim(nil) end - animations[key] = nil; + animations[key] = nil end - if(anim.loop) then - Private.Animate(anim.namespace, anim.auraUID, anim.type, anim.anim, anim.region, anim.inverse, anim.onFinished, anim.loop, anim.region.cloneId); - elseif(anim.onFinished) then - anim.onFinished(); + if anim.loop then + Private.Animate(anim.namespace, anim.auraUID, anim.type, anim.anim, anim.region, anim.inverse, anim.onFinished, anim.loop, anim.region.cloneId) + elseif anim.onFinished then + anim.onFinished() end end - Private.StopProfileUID(anim.auraUID); + Private.StopProfileUID(anim.auraUID) end - Private.StopProfileSystem("animations"); + Private.StopProfileSystem("animations") end function Private.RegisterGroupForPositioning(uid, region) @@ -178,150 +178,155 @@ end function Private.Animate(namespace, uid, type, anim, region, inverse, onFinished, loop, cloneId) local auraDisplayName = Private.UIDtoID(uid) - local key = tostring(region); - local valid; - if(anim and anim.type == "custom" and (anim.use_translate or anim.use_alpha or (anim.use_scale and region.Scale) or (anim.use_rotate and region.Rotate) or (anim.use_color and region.Color))) then - valid = true; - elseif(anim and anim.type == "preset" and anim.preset and Private.anim_presets[anim.preset]) then - anim = Private.anim_presets[anim.preset]; - valid = true; + local key = tostring(region) + local valid + if + anim + and anim.type == "custom" + and (anim.use_translate or anim.use_alpha or (anim.use_scale and region.Scale) or (anim.use_rotate and region.Rotate) or (anim.use_color and region.Color)) + then + valid = true + elseif anim and anim.type == "preset" and anim.preset and Private.anim_presets[anim.preset] then + anim = Private.anim_presets[anim.preset] + valid = true end - if(valid) then - local progress, duration, selfPoint, anchor, anchorPoint, startX, startY, startAlpha, startWidth, startHeight, startRotation, easeType, easeStrength; - local translateFunc, alphaFunc, scaleFunc, rotateFunc, colorFunc, easeFunc; - if(animations[key]) then - if(animations[key].type == type and not loop) then - return "no replace"; + if valid then + local progress, duration, selfPoint, anchor, anchorPoint, startX, startY, startAlpha, startWidth, startHeight, startRotation, easeType, easeStrength + local translateFunc, alphaFunc, scaleFunc, rotateFunc, colorFunc, easeFunc + if animations[key] then + if animations[key].type == type and not loop then + return "no replace" end - anim.x = anim.x or 0; - anim.y = anim.y or 0; - selfPoint, anchor, anchorPoint, startX, startY = animations[key].selfPoint, animations[key].anchor, animations[key].anchorPoint, animations[key].startX, animations[key].startY; - anim.alpha = anim.alpha or 0; - startAlpha = animations[key].startAlpha; - anim.scalex = anim.scalex or 1; - anim.scaley = anim.scaley or 1; - startWidth, startHeight = animations[key].startWidth, animations[key].startHeight; - anim.rotate = anim.rotate or 0; - startRotation = animations[key].startRotation; - anim.colorR = anim.colorR or 1; - anim.colorG = anim.colorG or 1; - anim.colorB = anim.colorB or 1; - anim.colorA = anim.colorA or 1; + anim.x = anim.x or 0 + anim.y = anim.y or 0 + selfPoint, anchor, anchorPoint, startX, startY = + animations[key].selfPoint, animations[key].anchor, animations[key].anchorPoint, animations[key].startX, animations[key].startY + anim.alpha = anim.alpha or 0 + startAlpha = animations[key].startAlpha + anim.scalex = anim.scalex or 1 + anim.scaley = anim.scaley or 1 + startWidth, startHeight = animations[key].startWidth, animations[key].startHeight + anim.rotate = anim.rotate or 0 + startRotation = animations[key].startRotation + anim.colorR = anim.colorR or 1 + anim.colorG = anim.colorG or 1 + anim.colorB = anim.colorB or 1 + anim.colorA = anim.colorA or 1 else - anim.x = anim.x or 0; - anim.y = anim.y or 0; + anim.x = anim.x or 0 + anim.y = anim.y or 0 if not region.SetOffsetAnim then - selfPoint, anchor, anchorPoint, startX, startY = region:GetPoint(1); + selfPoint, anchor, anchorPoint, startX, startY = region:GetPoint(1) end - anim.alpha = anim.alpha or 0; - startAlpha = region:GetAlpha(); - anim.scalex = anim.scalex or 1; - anim.scaley = anim.scaley or 1; - startWidth, startHeight = region:GetWidth(), region:GetHeight(); - anim.rotate = anim.rotate or 0; - startRotation = region.GetRotation and region:GetRotation() or 0; - anim.colorR = anim.colorR or 1; - anim.colorG = anim.colorG or 1; - anim.colorB = anim.colorB or 1; - anim.colorA = anim.colorA or 1; + anim.alpha = anim.alpha or 0 + startAlpha = region:GetAlpha() + anim.scalex = anim.scalex or 1 + anim.scaley = anim.scaley or 1 + startWidth, startHeight = region:GetWidth(), region:GetHeight() + anim.rotate = anim.rotate or 0 + startRotation = region.GetRotation and region:GetRotation() or 0 + anim.colorR = anim.colorR or 1 + anim.colorG = anim.colorG or 1 + anim.colorB = anim.colorB or 1 + anim.colorA = anim.colorA or 1 end - if(anim.use_translate) then - if not(anim.translateType == "custom" and anim.translateFunc) then - anim.translateType = anim.translateType or "straightTranslate"; + if anim.use_translate then + if not (anim.translateType == "custom" and anim.translateFunc) then + anim.translateType = anim.translateType or "straightTranslate" anim.translateFunc = anim_function_strings[anim.translateType] end - if (anim.translateFunc) then - translateFunc = WeakAuras.LoadFunction("return " .. anim.translateFunc); + if anim.translateFunc then + translateFunc = WeakAuras.LoadFunction("return " .. anim.translateFunc) else - if (region.SetOffsetAnim) then - region:SetOffsetAnim(0, 0); + if region.SetOffsetAnim then + region:SetOffsetAnim(0, 0) else - region:SetPoint(selfPoint, anchor, anchorPoint, startX, startY); + region:SetPoint(selfPoint, anchor, anchorPoint, startX, startY) end end else - if (region.SetOffsetAnim) then - region:SetOffsetAnim(0, 0); + if region.SetOffsetAnim then + region:SetOffsetAnim(0, 0) else - region:SetPoint(selfPoint, anchor, anchorPoint, startX, startY); + region:SetPoint(selfPoint, anchor, anchorPoint, startX, startY) end end - if(anim.use_alpha) then - if not(anim.alphaType == "custom" and anim.alphaFunc) then - anim.alphaType = anim.alphaType or "straight"; + if anim.use_alpha then + if not (anim.alphaType == "custom" and anim.alphaFunc) then + anim.alphaType = anim.alphaType or "straight" anim.alphaFunc = anim_function_strings[anim.alphaType] end - if (anim.alphaFunc) then - alphaFunc = WeakAuras.LoadFunction("return " .. anim.alphaFunc); + if anim.alphaFunc then + alphaFunc = WeakAuras.LoadFunction("return " .. anim.alphaFunc) else - if (region.SetAnimAlpha) then - region:SetAnimAlpha(nil); + if region.SetAnimAlpha then + region:SetAnimAlpha(nil) else - region:SetAlpha(startAlpha); + region:SetAlpha(startAlpha) end end else - if (region.SetAnimAlpha) then - region:SetAnimAlpha(nil); + if region.SetAnimAlpha then + region:SetAnimAlpha(nil) else - region:SetAlpha(startAlpha); + region:SetAlpha(startAlpha) end end - if(anim.use_scale) then - if not(anim.scaleType == "custom" and anim.scaleFunc) then - anim.scaleType = anim.scaleType or "straightScale"; + if anim.use_scale then + if not (anim.scaleType == "custom" and anim.scaleFunc) then + anim.scaleType = anim.scaleType or "straightScale" anim.scaleFunc = anim_function_strings[anim.scaleType] end - if (anim.scaleFunc) then - scaleFunc = WeakAuras.LoadFunction("return " .. anim.scaleFunc); + if anim.scaleFunc then + scaleFunc = WeakAuras.LoadFunction("return " .. anim.scaleFunc) else - region:Scale(1, 1); + region:Scale(1, 1) end - elseif(region.Scale) then - region:Scale(1, 1); + elseif region.Scale then + region:Scale(1, 1) end - if(anim.use_rotate) then - if not(anim.rotateType == "custom" and anim.rotateFunc) then - anim.rotateType = anim.rotateType or "straight"; + if anim.use_rotate then + if not (anim.rotateType == "custom" and anim.rotateFunc) then + anim.rotateType = anim.rotateType or "straight" anim.rotateFunc = anim_function_strings[anim.rotateType] end - if (anim.rotateFunc) then - rotateFunc = WeakAuras.LoadFunction("return " .. anim.rotateFunc); + if anim.rotateFunc then + rotateFunc = WeakAuras.LoadFunction("return " .. anim.rotateFunc) else - region:Rotate(startRotation); + region:Rotate(startRotation) end - elseif(region.Rotate) then - region:Rotate(startRotation); + elseif region.Rotate then + region:Rotate(startRotation) end - if(anim.use_color) then - if not(anim.colorType == "custom" and anim.colorFunc) then - anim.colorType = anim.colorType or "straightColor"; + if anim.use_color then + if not (anim.colorType == "custom" and anim.colorFunc) then + anim.colorType = anim.colorType or "straightColor" anim.colorFunc = anim_function_strings[anim.colorType] end - if (anim.colorFunc) then - colorFunc = WeakAuras.LoadFunction("return " .. anim.colorFunc); + if anim.colorFunc then + colorFunc = WeakAuras.LoadFunction("return " .. anim.colorFunc) else - region:ColorAnim(nil); + region:ColorAnim(nil) end - elseif(region.ColorAnim) then - region:ColorAnim(nil); + elseif region.ColorAnim then + region:ColorAnim(nil) end easeFunc = Private.anim_ease_functions[anim.easeType or "none"] - duration = Private.ParseNumber(anim.duration) or 0; - progress = 0; - if(namespace == "display" and type == "main" and not onFinished and not anim.duration_type == "relative") then - local data = Private.GetDataByUID(uid); - if(data and data.parent) then - local parentRegion = WeakAuras.regions[data.parent].region; - if(parentRegion and parentRegion.controlledRegions) then + duration = Private.ParseNumber(anim.duration) or 0 + progress = 0 + if namespace == "display" and type == "main" and not onFinished and not anim.duration_type == "relative" then + local data = Private.GetDataByUID(uid) + if data and data.parent then + local parentRegion = WeakAuras.regions[data.parent].region + if parentRegion and parentRegion.controlledRegions then for index, regionData in pairs(parentRegion.controlledRegions) do - local childRegion = regionData.region; - local childKey = regionData.key; - if(childKey and childKey ~= tostring(region) and animations[childKey] and animations[childKey].type == "main" and duration == animations[childKey].duration) then - progress = animations[childKey].progress; - break; + local childRegion = regionData.region + local childKey = regionData.key + if childKey and childKey ~= tostring(region) and animations[childKey] and animations[childKey].type == "main" and duration == animations[childKey].duration then + progress = animations[childKey].progress + break end end end @@ -366,66 +371,66 @@ function Private.Animate(namespace, uid, type, anim, region, inverse, onFinished animation.type = type animation.loop = loop animation.onFinished = onFinished - animation.namespace = namespace; - animation.anim = anim; + animation.namespace = namespace + animation.anim = anim animation.auraUID = uid - if not(updatingAnimations) then - frame:SetScript("OnUpdate", UpdateAnimations); - updatingAnimations = true; + if not updatingAnimations then + frame:SetScript("OnUpdate", UpdateAnimations) + updatingAnimations = true end - return true; + return true else - if(animations[key]) then - if(animations[key].type ~= type or loop) then - Private.CancelAnimation(region, true, true, true, true, true); + if animations[key] then + if animations[key].type ~= type or loop then + Private.CancelAnimation(region, true, true, true, true, true) end end - return false; + return false end end function Private.CancelAnimation(region, resetPos, resetAlpha, resetScale, resetRotation, resetColor, doOnFinished) - local key = tostring(region); - local anim = animations[key]; + local key = tostring(region) + local anim = animations[key] - if(anim) then - if(resetPos) then - if (anim.region.SetOffsetAnim) then - anim.region:SetOffsetAnim(0, 0); + if anim then + if resetPos then + if anim.region.SetOffsetAnim then + anim.region:SetOffsetAnim(0, 0) else - anim.region:ClearAllPoints(); - anim.region:SetPoint(anim.selfPoint, anim.anchor, anim.anchorPoint, anim.startX, anim.startY); + anim.region:ClearAllPoints() + anim.region:SetPoint(anim.selfPoint, anim.anchor, anim.anchorPoint, anim.startX, anim.startY) end end - if(resetAlpha) then - if (anim.region.SetAnimAlpha) then - anim.region:SetAnimAlpha(nil); + if resetAlpha then + if anim.region.SetAnimAlpha then + anim.region:SetAnimAlpha(nil) else - anim.region:SetAlpha(anim.startAlpha); + anim.region:SetAlpha(anim.startAlpha) end end - if(resetScale) then - if(anim.region.Scale) then - anim.region:Scale(1, 1); + if resetScale then + if anim.region.Scale then + anim.region:Scale(1, 1) else - anim.region:SetWidth(anim.startWidth); - anim.region:SetHeight(anim.startHeight); + anim.region:SetWidth(anim.startWidth) + anim.region:SetHeight(anim.startHeight) end end - if(resetRotation and anim.region.Rotate) then - anim.region:Rotate(anim.startRotation); + if resetRotation and anim.region.Rotate then + anim.region:Rotate(anim.startRotation) end - if(resetColor and anim.region.ColorAnim) then - anim.region:ColorAnim(nil); + if resetColor and anim.region.ColorAnim then + anim.region:ColorAnim(nil) end - animations[key] = nil; - if(doOnFinished and anim.onFinished) then - anim.onFinished(); + animations[key] = nil + if doOnFinished and anim.onFinished then + anim.onFinished() end - return true; + return true else - return false; + return false end end diff --git a/WeakAuras/AuraEnvironment.lua b/WeakAuras/AuraEnvironment.lua index 12a39706d4..3be04544a9 100644 --- a/WeakAuras/AuraEnvironment.lua +++ b/WeakAuras/AuraEnvironment.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, Private = ... local WeakAuras = WeakAuras @@ -14,11 +16,13 @@ local UnitAura = UnitAura -- Unit Aura functions that return info about the first Aura matching the spellName or spellID given on the unit. local WA_GetUnitAura = function(unit, spell, filter) if filter and not filter:upper():find("FUL") then - filter = filter.."|HELPFUL" + filter = filter .. "|HELPFUL" end for i = 1, 255 do local name, _, _, _, _, _, _, _, _, spellId = UnitAura(unit, i, filter) - if not name then return end + if not name then + return + end if spell == spellId or spell == name then return UnitAura(unit, i, filter) end @@ -28,37 +32,52 @@ end if WeakAuras.IsClassic() then local WA_GetUnitAuraBase = WA_GetUnitAura WA_GetUnitAura = function(unit, spell, filter) - local name, icon, count, debuffType, duration, expirationTime, source, isStealable, nameplateShowPersonal, spellId, canApplyAura, isBossDebuff, castByPlayer, nameplateShowAll, timeMod = WA_GetUnitAuraBase(unit, spell, filter) + local name, icon, count, debuffType, duration, expirationTime, source, isStealable, nameplateShowPersonal, spellId, canApplyAura, isBossDebuff, castByPlayer, nameplateShowAll, timeMod = + WA_GetUnitAuraBase(unit, spell, filter) if spellId then local durationNew, expirationTimeNew = LCD:GetAuraDurationByUnit(unit, spellId, source, name) if duration == 0 and durationNew then - duration = durationNew - expirationTime = expirationTimeNew + duration = durationNew + expirationTime = expirationTimeNew end end - return name, icon, count, debuffType, duration, expirationTime, source, isStealable, nameplateShowPersonal, spellId, canApplyAura, isBossDebuff, castByPlayer, nameplateShowAll, timeMod + return name, + icon, + count, + debuffType, + duration, + expirationTime, + source, + isStealable, + nameplateShowPersonal, + spellId, + canApplyAura, + isBossDebuff, + castByPlayer, + nameplateShowAll, + timeMod end end local WA_GetUnitBuff = function(unit, spell, filter) - filter = filter and filter.."|HELPFUL" or "HELPFUL" + filter = filter and filter .. "|HELPFUL" or "HELPFUL" return WA_GetUnitAura(unit, spell, filter) end local WA_GetUnitDebuff = function(unit, spell, filter) - filter = filter and filter.."|HARMFUL" or "HARMFUL" + filter = filter and filter .. "|HARMFUL" or "HARMFUL" return WA_GetUnitAura(unit, spell, filter) end -- Function to assist iterating group members whether in a party or raid. local WA_IterateGroupMembers = function(reversed, forceParty) - local unit = (not forceParty and IsInRaid()) and 'raid' or 'party' - local numGroupMembers = unit == 'party' and GetNumSubgroupMembers() or GetNumGroupMembers() - local i = reversed and numGroupMembers or (unit == 'party' and 0 or 1) + local unit = (not forceParty and IsInRaid()) and "raid" or "party" + local numGroupMembers = unit == "party" and GetNumSubgroupMembers() or GetNumGroupMembers() + local i = reversed and numGroupMembers or (unit == "party" and 0 or 1) return function() local ret - if i == 0 and unit == 'party' then - ret = 'player' + if i == 0 and unit == "party" then + ret = "player" elseif i <= numGroupMembers and i > 0 then ret = unit .. i end @@ -93,7 +112,7 @@ local WA_Utf8Sub = function(input, size) return output end local i = 1 - while (size > 0) do + while size > 0 do local byte = input:byte(i) if not byte then return output @@ -114,7 +133,7 @@ local WA_Utf8Sub = function(input, size) end -- Add any bytes that are part of the sequence - while (true) do + while true do local byte = input:byte(i) if byte and byte >= 128 and byte < 192 then output = output .. input:sub(i, i) @@ -135,7 +154,7 @@ WeakAuras.HideOverlayGlow = LCG.ButtonGlow_Stop local LGF = LibStub("LibGetFrame-1.0") WeakAuras.GetUnitFrame = LGF.GetUnitFrame -WeakAuras.GetUnitNameplate = function(unit) +WeakAuras.GetUnitNameplate = function(unit) if Private.multiUnitUnits.nameplate[unit] then return LGF.GetUnitNameplate(unit) end @@ -170,7 +189,7 @@ local blockedFunctions = { GuildUninvite = true, securecall = true, DeleteCursorItem = true, - ChatEdit_SendText = true + ChatEdit_SendText = true, } local blockedTables = { @@ -180,7 +199,7 @@ local blockedTables = { MailFrameTab2 = true, ChatFrame1 = true, WeakAurasOptions = true, - WeakAurasOptionsSaved = true + WeakAurasOptionsSaved = true, } local aura_environments = {} @@ -209,7 +228,7 @@ local current_aura_env = nil local aura_env_stack = {} function Private.ClearAuraEnvironment(id) - environment_initialized[id] = nil; + environment_initialized[id] = nil end function Private.ActivateAuraEnvironmentForRegion(region, onlyConfig) @@ -240,7 +259,7 @@ function Private.ActivateAuraEnvironment(id, cloneId, state, states, onlyConfig) current_aura_env.states = states current_aura_env.region = region -- Push the new environment onto the stack - tinsert(aura_env_stack, {current_aura_env, data.uid}) + tinsert(aura_env_stack, { current_aura_env, data.uid }) elseif onlyConfig then environment_initialized[id] = 1 aura_environments[id] = {} @@ -251,7 +270,7 @@ function Private.ActivateAuraEnvironment(id, cloneId, state, states, onlyConfig) current_aura_env.state = state current_aura_env.states = states current_aura_env.region = region - tinsert(aura_env_stack, {current_aura_env, data.uid}) + tinsert(aura_env_stack, { current_aura_env, data.uid }) if not data.controlledChildren then current_aura_env.config = CopyTable(data.config) @@ -268,7 +287,7 @@ function Private.ActivateAuraEnvironment(id, cloneId, state, states, onlyConfig) current_aura_env.states = states current_aura_env.region = region -- push new environment onto the stack - tinsert(aura_env_stack, {current_aura_env, data.uid}) + tinsert(aura_env_stack, { current_aura_env, data.uid }) if data.controlledChildren then current_aura_env.child_envs = {} @@ -291,7 +310,7 @@ function Private.ActivateAuraEnvironment(id, cloneId, state, states, onlyConfig) end -- Finally, run the init function if supplied local actions = data.actions.init - if(actions and actions.do_custom and actions.custom) then + if actions and actions.do_custom and actions.custom then local func = Private.customActionsFunctions[id]["init"] if func then xpcall(func, Private.GetErrorHandlerId(id, "init")) @@ -306,28 +325,26 @@ local function DebugPrint(...) end local function blocked(key) - Private.AuraWarnings.UpdateWarning(current_uid, "SandboxForbidden", "error", - string.format(L["Forbidden function or table: %s"], key)) + Private.AuraWarnings.UpdateWarning(current_uid, "SandboxForbidden", "error", string.format(L["Forbidden function or table: %s"], key)) end local function MakeReadOnly(input, options) - return setmetatable({}, - { + return setmetatable({}, { __index = function(t, k) - if options.blockedFunctions[k] then - options.blocked(k) - return function() end - elseif options.blockedTables[k] then - options.blocked(k) - return {} - elseif options.override[k] then - return options.override[k] - else - return input[k] - end - end, - __newindex = options.setBlocked, - __metatable = false + if options.blockedFunctions[k] then + options.blocked(k) + return function() end + elseif options.blockedTables[k] then + options.blocked(k) + return {} + elseif options.override[k] then + return options.override[k] + else + return input[k] + end + end, + __newindex = options.setBlocked, + __metatable = false, }) end @@ -384,17 +401,16 @@ local FakeWeakAurasMixin = { frames = true, loadFrame = true, unitLoadFrame = true, - loaded = true + loaded = true, }, override = { me = GetUnitName("player", true), - myGUID = UnitGUID("player") + myGUID = UnitGUID("player"), }, blocked = blocked, setBlocked = function() - Private.AuraWarnings.UpdateWarning(current_uid, "FakeWeakAurasSet", "error", - L["Writing to the WeakAuras table is not allowed."], true) - end + Private.AuraWarnings.UpdateWarning(current_uid, "FakeWeakAurasSet", "error", L["Writing to the WeakAuras table is not allowed."], true) + end, } local FakeWeakAuras = MakeReadOnly(WeakAuras, FakeWeakAurasMixin) @@ -408,12 +424,11 @@ local overridden = { WA_Utf8Sub = WA_Utf8Sub, ActionButton_ShowOverlayGlow = WeakAuras.ShowOverlayGlow, ActionButton_HideOverlayGlow = WeakAuras.HideOverlayGlow, - WeakAuras = FakeWeakAuras + WeakAuras = FakeWeakAuras, } local env_getglobal -local exec_env = setmetatable({}, -{ +local exec_env = setmetatable({}, { __index = function(t, k) if k == "_G" then return t @@ -437,12 +452,16 @@ local exec_env = setmetatable({}, end, __newindex = function(table, key, value) if _G[key] then - Private.AuraWarnings.UpdateWarning(current_uid, "OverridingGlobal", "warning", - string.format(L["The aura has overwritten the global '%s', this might affect other auras."], key)) + Private.AuraWarnings.UpdateWarning( + current_uid, + "OverridingGlobal", + "warning", + string.format(L["The aura has overwritten the global '%s', this might affect other auras."], key) + ) end rawset(table, key, value) end, - __metatable = false + __metatable = false, }) function env_getglobal(k) diff --git a/WeakAuras/AuraWarnings.lua b/WeakAuras/AuraWarnings.lua index 227a86a558..8d95ffaa6f 100644 --- a/WeakAuras/AuraWarnings.lua +++ b/WeakAuras/AuraWarnings.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, Private = ... local WeakAuras = WeakAuras @@ -32,7 +34,7 @@ local function UpdateWarning(uid, key, severity, message, printOnConsole) if severity and message then warnings[uid][key] = { severity = severity, - message = message + message = message, } Private.callbacks:Fire("AuraWarningsUpdated", uid) else @@ -50,21 +52,21 @@ local severityLevel = { info = 0, sound = 1, warning = 2, - error = 3 + error = 3, } local icons = { info = [[Interface/friendsframe/informationicon.blp]], sound = [[chatframe-button-icon-voicechat]], warning = [[Interface/buttons/adventureguidemicrobuttonalert.blp]], - error = [[Interface/DialogFrame/UI-Dialog-Icon-AlertNew]] + error = [[Interface/DialogFrame/UI-Dialog-Icon-AlertNew]], } local titles = { info = L["Information"], sound = L["Sound"], warning = L["Warning"], - error = L["Error"] + error = L["Error"], } local function AddMessages(result, messages, icon, mixedSeverity) diff --git a/WeakAuras/BuffTrigger.lua b/WeakAuras/BuffTrigger.lua index 860f30a800..efb03aa032 100644 --- a/WeakAuras/BuffTrigger.lua +++ b/WeakAuras/BuffTrigger.lua @@ -1,8 +1,11 @@ --[[ BuffTrigger.lua This used to contains the "aura" trigger for buffs and debuffs. Nowadays all functions do essentially nothing -]]-- +]] +-- -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, Private = ... local L = WeakAuras.L @@ -42,9 +45,13 @@ function BuffTrigger.CanHaveDuration(data, triggernum) return false end -function BuffTrigger.GetOverlayInfo(data, triggernum) return {} end +function BuffTrigger.GetOverlayInfo(data, triggernum) + return {} +end -function BuffTrigger.CanHaveClones(data, triggernum) return false end +function BuffTrigger.CanHaveClones(data, triggernum) + return false +end function BuffTrigger.CanHaveTooltip(data, triggernum) end @@ -61,29 +68,29 @@ function BuffTrigger.GetTriggerConditions(data, triggernum) end function BuffTrigger.CreateFallbackState(data, triggernum, state) - state.show = true; - state.changed = true; - state.progressType = "timed"; - state.duration = 0; - state.expirationTime = math.huge; + state.show = true + state.changed = true + state.progressType = "timed" + state.duration = 0 + state.expirationTime = math.huge end function BuffTrigger.GetName(triggerType) - if (triggerType == "aura") then - return L["Legacy Aura (disabled)"]; + if triggerType == "aura" then + return L["Legacy Aura (disabled)"] end end function BuffTrigger.GetTriggerDescription(data, triggernum, namestable) - tinsert(namestable, {L["Legacy Aura (disabled):"], L[""]}); + tinsert(namestable, { L["Legacy Aura (disabled):"], L[""] }) end function BuffTrigger.CreateFakeStates(id, triggernum) - local allStates = WeakAuras.GetTriggerStateForTrigger(id, triggernum); + local allStates = WeakAuras.GetTriggerStateForTrigger(id, triggernum) local data = WeakAuras.GetData(id) local state = {} BuffTrigger.CreateFallbackState(data, triggernum, state) allStates[""] = state end -WeakAuras.RegisterTriggerSystem({"aura"}, BuffTrigger); +WeakAuras.RegisterTriggerSystem({ "aura" }, BuffTrigger) diff --git a/WeakAuras/BuffTrigger2.lua b/WeakAuras/BuffTrigger2.lua index 7576303374..ccf6756818 100644 --- a/WeakAuras/BuffTrigger2.lua +++ b/WeakAuras/BuffTrigger2.lua @@ -49,8 +49,11 @@ Returns the tooltip text for additional properties. GetTriggerConditions(data, triggernum) Returns the potential conditions for a trigger -]]-- -if not WeakAuras.IsLibsOK() then return end +]] +-- +if not WeakAuras.IsLibsOK() then + return +end local AddonName, Private = ... -- Lua APIs @@ -73,7 +76,9 @@ local triggerInfos = {} local watched_trigger_events = Private.watched_trigger_events -local UnitGroupRolesAssigned = WeakAuras.IsWrathOrRetail() and UnitGroupRolesAssigned or function() return "DAMAGER" end +local UnitGroupRolesAssigned = WeakAuras.IsWrathOrRetail() and UnitGroupRolesAssigned or function() + return "DAMAGER" +end -- keyed on unit, debuffType, spellname, with a scan object value -- scan object: id, triggernum, scanFunc @@ -166,8 +171,13 @@ local function GetSubTable(base, next, ...) end local function IsGroupTrigger(trigger) - return trigger.unit == "group" or trigger.unit == "party" or trigger.unit == "raid" - or trigger.unit == "boss" or trigger.unit == "nameplate" or trigger.unit == "arena" or trigger.unit == "multi" + return trigger.unit == "group" + or trigger.unit == "party" + or trigger.unit == "raid" + or trigger.unit == "boss" + or trigger.unit == "nameplate" + or trigger.unit == "arena" + or trigger.unit == "multi" end local function IsSingleMissing(trigger) @@ -209,9 +219,11 @@ end local function ScanMatchData(time, triggerInfo, unit, filter) if matchData[unit] and matchData[unit][filter] then for index, match in pairs(matchData[unit][filter]) do - if (not triggerInfo.auranames and not triggerInfo.auraspellids) - or (triggerInfo.auranames and tContains(triggerInfo.auranames, match.name)) - or (triggerInfo.auraspellids and tContains(triggerInfo.auraspellids, match.spellId)) then + if + (not triggerInfo.auranames and not triggerInfo.auraspellids) + or (triggerInfo.auranames and tContains(triggerInfo.auranames, match.name)) + or (triggerInfo.auraspellids and tContains(triggerInfo.auraspellids, match.spellId)) + then if triggerInfo.fetchTooltip then matchData[unit][filter][index]:UpdateTooltip(time) end @@ -261,8 +273,7 @@ local function UpdateToolTipDataInMatchData(matchData, time) if matchData.unit and matchData.index and matchData.filter then local tooltip, _, tooltip1, tooltip2, tooltip3 = WeakAuras.GetAuraTooltipInfo(matchData.unit, matchData.index, matchData.filter) - changed = matchData.tooltip ~= tooltip or matchData.tooltip1 ~= tooltip1 - or matchData.tooltip2 ~= tooltip2 or matchData.tooltip3 ~= tooltip3 + changed = matchData.tooltip ~= tooltip or matchData.tooltip1 ~= tooltip1 or matchData.tooltip2 ~= tooltip2 or matchData.tooltip3 ~= tooltip3 matchData.tooltip, matchData.tooltip1, matchData.tooltip2, matchData.tooltip3 = tooltip, tooltip1, tooltip2, tooltip3 end @@ -270,7 +281,25 @@ local function UpdateToolTipDataInMatchData(matchData, time) return changed end -local function UpdateMatchData(time, matchDataChanged, unit, index, filter, name, icon, stacks, debuffClass, duration, expirationTime, unitCaster, isStealable, isBossDebuff, isCastByPlayer, spellId, modRate) +local function UpdateMatchData( + time, + matchDataChanged, + unit, + index, + filter, + name, + icon, + stacks, + debuffClass, + duration, + expirationTime, + unitCaster, + isStealable, + isBossDebuff, + isCastByPlayer, + spellId, + modRate +) if not matchData[unit] then matchData[unit] = {} end @@ -301,7 +330,7 @@ local function UpdateMatchData(time, matchDataChanged, unit, index, filter, name filter = filter, index = index, UpdateTooltip = UpdateToolTipDataInMatchData, - auras = {} + auras = {}, } return true end @@ -500,10 +529,24 @@ end local roleIcons = { DAMAGER = CreateTextureMarkup([[Interface\LFGFrame\UI-LFG-ICON-ROLES]], 256, 256, 0, 0, GetTexCoordsForRole("DAMAGER")), HEALER = CreateTextureMarkup([[Interface\LFGFrame\UI-LFG-ICON-ROLES]], 256, 256, 0, 0, GetTexCoordsForRole("HEALER")), - TANK = CreateTextureMarkup([[Interface\LFGFrame\UI-LFG-ICON-ROLES]], 256, 256, 0, 0, GetTexCoordsForRole("TANK")) + TANK = CreateTextureMarkup([[Interface\LFGFrame\UI-LFG-ICON-ROLES]], 256, 256, 0, 0, GetTexCoordsForRole("TANK")), } -local function UpdateStateWithMatch(time, bestMatch, triggerStates, cloneId, matchCount, unitCount, maxUnitCount, matchCountPerUnit, totalStacks, affected, unaffected, role, raidMark) +local function UpdateStateWithMatch( + time, + bestMatch, + triggerStates, + cloneId, + matchCount, + unitCount, + maxUnitCount, + matchCountPerUnit, + totalStacks, + affected, + unaffected, + role, + raidMark +) local debuffClassIcon = WeakAuras.EJIcons[bestMatch.debuffClass] if not triggerStates[cloneId] then triggerStates[cloneId] = { @@ -630,7 +673,7 @@ local function UpdateStateWithMatch(time, bestMatch, triggerStates, cloneId, mat if state.expirationTime ~= bestMatch.expirationTime then -- A bit fuzzy checking - if state.expirationTime and bestMatch.expirationTime and bestMatch.expirationTime - state.expirationTime > 0.2 then + if state.expirationTime and bestMatch.expirationTime and bestMatch.expirationTime - state.expirationTime > 0.2 then state.refreshTime = time end state.expirationTime = bestMatch.expirationTime @@ -735,13 +778,28 @@ local function UpdateStateWithMatch(time, bestMatch, triggerStates, cloneId, mat end end -local function UpdateStateWithNoMatch(time, triggerStates, triggerInfo, cloneId, unit, matchCount, unitCount, maxUnitCount, matchCountPerUnit, totalStacks, affected, unaffected, role, raidMark) +local function UpdateStateWithNoMatch( + time, + triggerStates, + triggerInfo, + cloneId, + unit, + matchCount, + unitCount, + maxUnitCount, + matchCountPerUnit, + totalStacks, + affected, + unaffected, + role, + raidMark +) local fallbackName, fallbackIcon = BuffTrigger.GetNameAndIconSimple(WeakAuras.GetData(triggerInfo.id), triggerInfo.triggernum) if not triggerStates[cloneId] then triggerStates[cloneId] = { show = true, changed = true, - progressType = 'timed', + progressType = "timed", duration = 0, expirationTime = math.huge, modRate = 1, @@ -761,7 +819,7 @@ local function UpdateStateWithNoMatch(time, triggerStates, triggerInfo, cloneId, destName = "", name = fallbackName, icon = fallbackIcon, - totalStacks = totalStacks + totalStacks = totalStacks, } return true else @@ -1022,7 +1080,7 @@ local function GetAllUnits(unit, allUnits, includePets) local ret = pets and "pet" or "player" pets = not pets if pets then - i = i + 1 + i = i + 1 end return ret elseif includePets == "PetsOnly" then @@ -1108,7 +1166,6 @@ local function TriggerInfoApplies(triggerInfo, unit) controllingUnit = WeakAuras.petUnitToUnit[unit] end - if triggerInfo.ignoreSelf and UnitIsUnit("player", controllingUnit) then return false end @@ -1175,7 +1232,7 @@ local function TriggerInfoApplies(triggerInfo, unit) end -- Filter our player/party# while in raid - if (triggerInfo.unit == "group" and triggerInfo.groupSubType == "group" and IsInRaid() and not Private.multiUnitUnits.raid[unit]) then + if triggerInfo.unit == "group" and triggerInfo.groupSubType == "group" and IsInRaid() and not Private.multiUnitUnits.raid[unit] then return false end @@ -1187,7 +1244,7 @@ local function TriggerInfoApplies(triggerInfo, unit) return false end - if triggerInfo.npcId and select(6, strsplit('-', UnitGUID(unit) or '')) ~= triggerInfo.npcId then + if triggerInfo.npcId and select(6, strsplit("-", UnitGUID(unit) or "")) ~= triggerInfo.npcId then return false end @@ -1353,7 +1410,7 @@ local function UpdateTriggerState(time, id, triggernum) affected, unaffected = FormatAffectedUnaffected(triggerInfo, matchedUnits) end - local usedCloneIds = {}; + local usedCloneIds = {} for index, auraData in ipairs(auraDatas) do local cloneId = (auraData.GUID or auraData.unit or "unknown") .. " " .. auraData.spellId if usedCloneIds[cloneId] then @@ -1363,11 +1420,23 @@ local function UpdateTriggerState(time, id, triggernum) usedCloneIds[cloneId] = 1 end - local role = roleForTriggerInfo(triggerInfo, auraData.unit) local mark = markForTriggerInfo(triggerInfo, auraData.unit) - updated = UpdateStateWithMatch(time, auraData, triggerStates, cloneId, matchCount, unitCount, maxUnitCount, - matchCountPerUnit[auraData.unit], totalStacks, affected, unaffected, role, mark) or updated + updated = UpdateStateWithMatch( + time, + auraData, + triggerStates, + cloneId, + matchCount, + unitCount, + maxUnitCount, + matchCountPerUnit[auraData.unit], + totalStacks, + affected, + unaffected, + role, + mark + ) or updated cloneIds[cloneId] = true end @@ -1375,8 +1444,7 @@ local function UpdateTriggerState(time, id, triggernum) local unit = bestUnit(triggerInfo, nil) local role = roleForTriggerInfo(triggerInfo, unit) local mark = markForTriggerInfo(triggerInfo, unit) - updated = UpdateStateWithNoMatch(time, triggerStates, triggerInfo, "", nil, 0, 0, maxUnitCount, 0, totalStacks, - affected, unaffected, role, mark) or updated + updated = UpdateStateWithNoMatch(time, triggerStates, triggerInfo, "", nil, 0, 0, maxUnitCount, 0, totalStacks, affected, unaffected, role, mark) or updated cloneIds[""] = true end end @@ -1425,9 +1493,21 @@ local function UpdateTriggerState(time, id, triggernum) if bestMatch then local role = roleForTriggerInfo(triggerInfo, unit) local mark = markForTriggerInfo(triggerInfo, unit) - updated = UpdateStateWithMatch(time, bestMatch, triggerStates, unit, matchCount, unitCount, maxUnitCount, - matchCountPerUnit[unit], totalStacks, affected, unaffected, role, mark) - or updated + updated = UpdateStateWithMatch( + time, + bestMatch, + triggerStates, + unit, + matchCount, + unitCount, + maxUnitCount, + matchCountPerUnit[unit], + totalStacks, + affected, + unaffected, + role, + mark + ) or updated cloneIds[unit] = true end end @@ -1440,16 +1520,39 @@ local function UpdateTriggerState(time, id, triggernum) local mark = markForTriggerInfo(triggerInfo, unit) if bestMatch then if triggerInfo.perUnitMode == "all" then - updated = UpdateStateWithMatch(time, bestMatch, triggerStates, unit, matchCount, unitCount, maxUnitCount, - matchCountPerUnit[unit], totalStacks, affected, unaffected, role, mark) - or updated + updated = UpdateStateWithMatch( + time, + bestMatch, + triggerStates, + unit, + matchCount, + unitCount, + maxUnitCount, + matchCountPerUnit[unit], + totalStacks, + affected, + unaffected, + role, + mark + ) or updated cloneIds[unit] = true end else - updated = UpdateStateWithNoMatch(time, triggerStates, triggerInfo, unit, unit, matchCount, - unitCount, maxUnitCount, matchCountPerUnit[unit], totalStacks, - affected, unaffected, role) - or updated + updated = UpdateStateWithNoMatch( + time, + triggerStates, + triggerInfo, + unit, + unit, + matchCount, + unitCount, + maxUnitCount, + matchCountPerUnit[unit], + totalStacks, + affected, + unaffected, + role + ) or updated cloneIds[unit] = true end end @@ -1499,7 +1602,8 @@ local function PrepareMatchData(unit, filter) local time = GetTime() local index = 1 while true do - local name, icon, stacks, debuffClass, duration, expirationTime, unitCaster, isStealable, _, spellId, _, isBossDebuff, isCastByPlayer, _, modRate = UnitAura(unit, index, filter) + local name, icon, stacks, debuffClass, duration, expirationTime, unitCaster, isStealable, _, spellId, _, isBossDebuff, isCastByPlayer, _, modRate = + UnitAura(unit, index, filter) if not name then break end @@ -1512,7 +1616,25 @@ local function PrepareMatchData(unit, filter) debuffClass = string.lower(debuffClass) end - local updatedMatchData = UpdateMatchData(time, matchDataChanged, unit, index, filter, name, icon, stacks, debuffClass, duration, expirationTime, unitCaster, isStealable, isBossDebuff, isCastByPlayer, spellId, modRate) + local updatedMatchData = UpdateMatchData( + time, + matchDataChanged, + unit, + index, + filter, + name, + icon, + stacks, + debuffClass, + duration, + expirationTime, + unitCaster, + isStealable, + isBossDebuff, + isCastByPlayer, + spellId, + modRate + ) index = index + 1 end @@ -1527,14 +1649,14 @@ local function CleanUpOutdatedMatchData(removeIndex, unit, filter) for index = removeIndex, #matchData[unit][filter] do local data = matchData[unit][filter][index] if data.index >= removeIndex or not UnitExistsFixed(unit) then - matchData[unit][filter][index] = nil - for id, triggerData in pairs(data.auras) do - for triggernum in pairs(triggerData) do - matchDataByTrigger[id][triggernum][unit][index] = nil - matchDataChanged[id] = matchDataChanged[id] or {} - matchDataChanged[id][triggernum] = true - end - end + matchData[unit][filter][index] = nil + for id, triggerData in pairs(data.auras) do + for triggernum in pairs(triggerData) do + matchDataByTrigger[id][triggernum][unit][index] = nil + matchDataChanged[id] = matchDataChanged[id] or {} + matchDataChanged[id][triggernum] = true + end + end end end end @@ -1546,11 +1668,11 @@ local function CleanUpMatchDataForUnit(unit, filter) for index, data in pairs(matchData[unit][filter]) do matchData[unit][filter][index] = nil for id, triggerData in pairs(data.auras) do - for triggernum in pairs(triggerData) do - matchDataByTrigger[id][triggernum][unit][index] = nil - matchDataChanged[id] = matchDataChanged[id] or {} - matchDataChanged[id][triggernum] = true - end + for triggernum in pairs(triggerData) do + matchDataByTrigger[id][triggernum][unit][index] = nil + matchDataChanged[id] = matchDataChanged[id] or {} + matchDataChanged[id][triggernum] = true + end end end end @@ -1562,7 +1684,7 @@ local function DeactivateScanFuncs(toDeactivate) local id = triggerInfo.id local triggernum = triggerInfo.triggernum local matches = GetSubTable(matchDataByTrigger, id, triggernum, unit) - if (matches) then + if matches then for index, match in pairs(matches) do match.auras[id][triggernum] = nil end @@ -1591,9 +1713,8 @@ local function CheckScanFuncs(scanFuncs, unit, filter, index) end end -local function ScanUnitWithFilter(matchDataChanged, time, unit, filter, - scanFuncNameGroup, scanFuncSpellIdGroup, scanFuncGeneralGroup, - scanFuncName, scanFuncSpellId, scanFuncGeneral) +-- stylua: ignore +local function ScanUnitWithFilter(matchDataChanged, time, unit, filter, scanFuncNameGroup, scanFuncSpellIdGroup, scanFuncGeneralGroup, scanFuncName, scanFuncSpellId, scanFuncGeneral) if not scanFuncName and not scanFuncSpellId and not scanFuncGeneral and not scanFuncNameGroup and not scanFuncSpellIdGroup and not scanFuncGeneralGroup then if matchDataUpToDate[unit] then matchDataUpToDate[unit][filter] = nil @@ -1620,7 +1741,7 @@ local function ScanUnitWithFilter(matchDataChanged, time, unit, filter, end local updatedMatchData = UpdateMatchData(time, matchDataChanged, unit, index, filter, name, icon, stacks, debuffClass, duration, expirationTime, unitCaster, isStealable, isBossDebuff, isCastByPlayer, spellId, modRate) - + -- stylua: ignore if updatedMatchData then -- Aura data changed, check against triggerInfos CheckScanFuncs(scanFuncName and scanFuncName[name], unit, filter, index) CheckScanFuncs(scanFuncNameGroup and scanFuncNameGroup[name], unit, filter, index) @@ -1693,7 +1814,7 @@ local function ScanGroupUnit(time, matchDataChanged, unitType, unit) scanFuncNameGroup[unit] = scanFuncNameGroup[unit] or {} scanFuncSpellIdGroup[unit] = scanFuncSpellIdGroup[unit] or {} scanFuncGeneralGroup[unit] = scanFuncGeneralGroup[unit] or {} - + -- stylua: ignore start ScanUnitWithFilter(matchDataChanged, time, unit, "HELPFUL", scanFuncNameGroup[unit]["HELPFUL"], scanFuncSpellIdGroup[unit]["HELPFUL"], @@ -1710,22 +1831,17 @@ local function ScanGroupUnit(time, matchDataChanged, unitType, unit) scanFuncSpellId[unit]["HARMFUL"], scanFuncGeneral[unit]["HARMFUL"]) else - ScanUnitWithFilter(matchDataChanged, time, unit, "HELPFUL", nil, nil, nil, - scanFuncName[unit]["HELPFUL"], - scanFuncSpellId[unit]["HELPFUL"], - scanFuncGeneral[unit]["HELPFUL"]) + ScanUnitWithFilter(matchDataChanged, time, unit, "HELPFUL", nil, nil, nil, scanFuncName[unit]["HELPFUL"], scanFuncSpellId[unit]["HELPFUL"], scanFuncGeneral[unit]["HELPFUL"]) - ScanUnitWithFilter(matchDataChanged, time, unit, "HARMFUL", nil, nil, nil, - scanFuncName[unit]["HARMFUL"], - scanFuncSpellId[unit]["HARMFUL"], - scanFuncGeneral[unit]["HARMFUL"]) + ScanUnitWithFilter(matchDataChanged, time, unit, "HARMFUL", nil, nil, nil, scanFuncName[unit]["HARMFUL"], scanFuncSpellId[unit]["HARMFUL"], scanFuncGeneral[unit]["HARMFUL"]) end + -- stylua: ignore end end local function ScanUnit(time, arg1) - if (Private.multiUnitUnits.raid[arg1] and IsInRaid()) then + if Private.multiUnitUnits.raid[arg1] and IsInRaid() then ScanGroupUnit(time, matchDataChanged, "group", arg1) - elseif (Private.multiUnitUnits.party[arg1] and not IsInRaid()) then + elseif Private.multiUnitUnits.party[arg1] and not IsInRaid() then ScanGroupUnit(time, matchDataChanged, "group", arg1) elseif Private.multiUnitUnits.boss[arg1] then ScanGroupUnit(time, matchDataChanged, "boss", arg1) @@ -1799,7 +1915,7 @@ local function RecheckActive(triggerInfo, unit, unitsToRemoveScan) local isSelf, role, inParty, class local unitExists = UnitExistsFixed(unit) if unitExists and TriggerInfoApplies(triggerInfo, unit) then - if (not activeGroupScanFuncs[unit] or not activeGroupScanFuncs[unit][triggerInfo]) then + if not activeGroupScanFuncs[unit] or not activeGroupScanFuncs[unit][triggerInfo] then triggerInfo.maxUnitCount = triggerInfo.maxUnitCount + 1 if triggerInfo.debuffType == "BOTH" then AddScanFuncs(triggerInfo, "HELPFUL", unit, scanFuncNameGroup, scanFuncSpellIdGroup, scanFuncGeneralGroup) @@ -1889,7 +2005,7 @@ local function EventHandler(frame, event, arg1, arg2, ...) tinsert(unitsToRemove, unit) end end - elseif event =="ARENA_OPPONENT_UPDATE" then + elseif event == "ARENA_OPPONENT_UPDATE" then for unit in GetAllUnits("arena", true) do RecheckActiveForUnitType("arena", unit, deactivatedTriggerInfos) if not UnitExistsFixed(unit) then @@ -1905,9 +2021,7 @@ local function EventHandler(frame, event, arg1, arg2, ...) end end ScanGroupRoleScanFunc(matchDataChanged) - elseif event == "UNIT_FLAGS" or event == "UNIT_NAME_UPDATE" or event == "PLAYER_FLAGS_CHANGED" - or event == "PARTY_MEMBER_ENABLE" or event == "PARTY_MEMBER_DISABLE" - then + elseif event == "UNIT_FLAGS" or event == "UNIT_NAME_UPDATE" or event == "PLAYER_FLAGS_CHANGED" or event == "PARTY_MEMBER_ENABLE" or event == "PARTY_MEMBER_DISABLE" then if event == "PARTY_MEMBER_ENABLE" then unitVisible[arg1] = true elseif event == "PARTY_MEMBER_DISABLE" then @@ -2080,12 +2194,11 @@ function BuffTrigger.UnloadAll() wipe(activeGroupScanFuncs) end - local function LoadAura(id, triggernum, triggerInfo) if not triggerInfo.unit then return end - local time = GetTime(); + local time = GetTime() local unitsToCheck = {} @@ -2127,7 +2240,7 @@ local function LoadAura(id, triggernum, triggerInfo) end if triggerInfo.fetchRaidMark then - raidMarkScanFuncs[id] = raidMarkScanFuncs[id] or {} + raidMarkScanFuncs[id] = raidMarkScanFuncs[id] or {} tinsert(raidMarkScanFuncs[id], triggerInfo) end @@ -2150,7 +2263,6 @@ function BuffTrigger.LoadDisplays(toLoad) end end - function BuffTrigger.UnloadDisplays(toUnload) local updateGroupScanFuncs = false for id in pairs(toUnload) do @@ -2191,7 +2303,6 @@ function BuffTrigger.UnloadDisplays(toUnload) matchDataChanged[id] = nil end - for unitType, funcs in pairs(groupScanFuncs) do for i = #funcs, 1, -1 do if toUnload[funcs[i].id] then @@ -2216,7 +2327,7 @@ end --- Removes all data for an aura id -- @param id function BuffTrigger.Delete(id) - BuffTrigger.UnloadDisplays({[id] = true}) + BuffTrigger.UnloadDisplays({ [id] = true }) triggerInfos[id] = nil end @@ -2274,7 +2385,7 @@ local function createScanFunc(trigger) local use_total = canHaveMatchCheck and not isMulti and trigger.useTotal and trigger.total local use_ignore_name = canHaveMatchCheck and not isMulti and trigger.useIgnoreName and trigger.ignoreAuraNames local use_ignore_spellId = canHaveMatchCheck and not isMulti and trigger.useIgnoreExactSpellId and trigger.ignoreAuraSpellids - + -- stylua: ignore if not useStacks and use_stealable == nil and use_isBossDebuff == nil and use_castByPlayer == nil and not use_debuffClass and trigger.ownOnly == nil and not use_tooltip and not use_tooltipValue and not trigger.useNamePattern and not use_total @@ -2511,7 +2622,6 @@ function BuffTrigger.Add(data) for triggernum, triggerData in ipairs(data.triggers) do local trigger, untrigger = triggerData.trigger, triggerData.untrigger if trigger.type == "aura2" then - trigger.unit = trigger.unit or "player" trigger.debuffType = trigger.debuffType or "HELPFUL" @@ -2586,8 +2696,14 @@ function BuffTrigger.Add(data) end local matchPerUnitCountFunc - if IsGroupTrigger(trigger) and combineMode == "showPerUnit" and perUnitMode ~= "unaffected" and trigger.useMatchPerUnit_count - and tonumber(trigger.matchPerUnit_count) and trigger.matchPerUnit_countOperator then + if + IsGroupTrigger(trigger) + and combineMode == "showPerUnit" + and perUnitMode ~= "unaffected" + and trigger.useMatchPerUnit_count + and tonumber(trigger.matchPerUnit_count) + and trigger.matchPerUnit_countOperator + then local count = tonumber(trigger.matchPerUnit_count) local match_countFuncStr = Private.function_strings.count:format(trigger.matchPerUnit_countOperator, count) matchPerUnitCountFunc = WeakAuras.LoadFunction(match_countFuncStr) @@ -2675,7 +2791,7 @@ function BuffTrigger.Add(data) isMulti = trigger.unit == "multi", nameChecker = effectiveNameCheck and WeakAuras.ParseNameCheck(trigger.unitName), includePets = trigger.use_includePets and trigger.includePets or nil, - npcId = effectiveNpcId + npcId = effectiveNpcId, } triggerInfos[id] = triggerInfos[id] or {} triggerInfos[id][triggernum] = triggerInformation @@ -2729,7 +2845,6 @@ function BuffTrigger.SetToolTip(trigger, state) return true end - function BuffTrigger.GetNameAndIconSimple(data, triggernum) if not data then return @@ -2747,7 +2862,7 @@ function BuffTrigger.GetNameAndIconSimple(data, triggernum) end elseif not tonumber(spellName) then name, _, icon = GetSpellInfo(spellName) - if (name and icon) then + if name and icon then return name, icon end end @@ -2773,7 +2888,7 @@ end -- @return name and icon function BuffTrigger.GetNameAndIcon(data, triggernum) local name, icon = BuffTrigger.GetNameAndIconSimple(data, triggernum) - if (not name or not icon and WeakAuras.spellCache) then + if not name or not icon and WeakAuras.spellCache then local trigger = data.triggers[triggernum].trigger if trigger.useName and trigger.auranames then for index, spellName in ipairs(trigger.auranames) do @@ -2794,43 +2909,43 @@ end function BuffTrigger.GetAdditionalProperties(data, triggernum) local trigger = data.triggers[triggernum].trigger - local ret = "|cFFFF0000%".. triggernum .. ".spellId|r - " .. L["Spell ID"] .. "\n" - ret = ret .. "|cFFFF0000%".. triggernum .. ".debuffClass|r - " .. L["Debuff Class"] .. "\n" - ret = ret .. "|cFFFF0000%".. triggernum .. ".debuffClassIcon|r - " .. L["Debuff Class Icon"] .. "\n" - ret = ret .. "|cFFFF0000%".. triggernum .. ".unitCaster|r - " .. L["Caster Unit"] .. "\n" - ret = ret .. "|cFFFF0000%".. triggernum .. ".casterName|r - " .. L["Caster Name"] .. "\n" + local ret = "|cFFFF0000%" .. triggernum .. ".spellId|r - " .. L["Spell ID"] .. "\n" + ret = ret .. "|cFFFF0000%" .. triggernum .. ".debuffClass|r - " .. L["Debuff Class"] .. "\n" + ret = ret .. "|cFFFF0000%" .. triggernum .. ".debuffClassIcon|r - " .. L["Debuff Class Icon"] .. "\n" + ret = ret .. "|cFFFF0000%" .. triggernum .. ".unitCaster|r - " .. L["Caster Unit"] .. "\n" + ret = ret .. "|cFFFF0000%" .. triggernum .. ".casterName|r - " .. L["Caster Name"] .. "\n" if trigger.unit ~= "multi" then - ret = ret .. "|cFFFF0000%".. triggernum .. ".unit|r - " .. L["Unit"] .. "\n" + ret = ret .. "|cFFFF0000%" .. triggernum .. ".unit|r - " .. L["Unit"] .. "\n" end - ret = ret .. "|cFFFF0000%".. triggernum .. ".unitName|r - " .. L["Unit Name"] .. "\n" - ret = ret .. "|cFFFF0000%".. triggernum .. ".matchCount|r - " .. L["Match Count"] .. "\n" - ret = ret .. "|cFFFF0000%".. triggernum .. ".matchCountPerUnit|r - " .. L["Match Count per Unit"] .. "\n" - ret = ret .. "|cFFFF0000%".. triggernum .. ".unitCount|r - " .. L["Units Affected"] .. "\n" - ret = ret .. "|cFFFF0000%".. triggernum .. ".totalStacks|r - " .. L["Total stacks over all matches"] .. "\n" + ret = ret .. "|cFFFF0000%" .. triggernum .. ".unitName|r - " .. L["Unit Name"] .. "\n" + ret = ret .. "|cFFFF0000%" .. triggernum .. ".matchCount|r - " .. L["Match Count"] .. "\n" + ret = ret .. "|cFFFF0000%" .. triggernum .. ".matchCountPerUnit|r - " .. L["Match Count per Unit"] .. "\n" + ret = ret .. "|cFFFF0000%" .. triggernum .. ".unitCount|r - " .. L["Units Affected"] .. "\n" + ret = ret .. "|cFFFF0000%" .. triggernum .. ".totalStacks|r - " .. L["Total stacks over all matches"] .. "\n" if trigger.unit ~= "multi" then - ret = ret .. "|cFFFF0000%".. triggernum .. ".maxUnitCount|r - " .. L["Total Units"] .. "\n" + ret = ret .. "|cFFFF0000%" .. triggernum .. ".maxUnitCount|r - " .. L["Total Units"] .. "\n" end if not IsSingleMissing(trigger) and trigger.unit ~= "multi" and trigger.fetchTooltip then - ret = ret .. "|cFFFF0000%".. triggernum .. ".tooltip|r - " .. L["Tooltip"] .. "\n" - ret = ret .. "|cFFFF0000%".. triggernum .. ".tooltip1|r - " .. L["First Value of Tooltip Text"] .. "\n" - ret = ret .. "|cFFFF0000%".. triggernum .. ".tooltip2|r - " .. L["Second Value of Tooltip Text"] .. "\n" - ret = ret .. "|cFFFF0000%".. triggernum .. ".tooltip3|r - " .. L["Third Value of Tooltip Text"] .. "\n" + ret = ret .. "|cFFFF0000%" .. triggernum .. ".tooltip|r - " .. L["Tooltip"] .. "\n" + ret = ret .. "|cFFFF0000%" .. triggernum .. ".tooltip1|r - " .. L["First Value of Tooltip Text"] .. "\n" + ret = ret .. "|cFFFF0000%" .. triggernum .. ".tooltip2|r - " .. L["Second Value of Tooltip Text"] .. "\n" + ret = ret .. "|cFFFF0000%" .. triggernum .. ".tooltip3|r - " .. L["Third Value of Tooltip Text"] .. "\n" end if WeakAuras.IsRetail() and trigger.unit ~= "multi" and trigger.fetchRole then - ret = ret .. "|cFFFF0000%".. triggernum .. ".role|r - " .. L["Assigned Role"] .. "\n" - ret = ret .. "|cFFFF0000%".. triggernum .. ".roleIcon|r - " .. L["Assigned Role Icon"] .. "\n" + ret = ret .. "|cFFFF0000%" .. triggernum .. ".role|r - " .. L["Assigned Role"] .. "\n" + ret = ret .. "|cFFFF0000%" .. triggernum .. ".roleIcon|r - " .. L["Assigned Role Icon"] .. "\n" end if trigger.unit ~= "multi" and trigger.fetchRaidMark then - ret = ret .. "|cFFFF0000%".. triggernum .. ".raidMark|r - " .. L["Raid Mark"] .. "\n" + ret = ret .. "|cFFFF0000%" .. triggernum .. ".raidMark|r - " .. L["Raid Mark"] .. "\n" end if (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and trigger.useAffected then - ret = ret .. "|cFFFF0000%".. triggernum .. ".affected|r - " .. L["Names of affected Players"] .. "\n" - ret = ret .. "|cFFFF0000%".. triggernum .. ".unaffected|r - " .. L["Names of unaffected Players"] .. "\n" + ret = ret .. "|cFFFF0000%" .. triggernum .. ".affected|r - " .. L["Names of affected Players"] .. "\n" + ret = ret .. "|cFFFF0000%" .. triggernum .. ".unaffected|r - " .. L["Names of unaffected Players"] .. "\n" end return ret @@ -2843,66 +2958,66 @@ function BuffTrigger.GetTriggerConditions(data, triggernum) result["debuffClass"] = { display = L["Debuff Type"], type = "select", - values = Private.debuff_class_types + values = Private.debuff_class_types, } result["unitCaster"] = { display = L["Caster"], - type = "string" + type = "string", } result["expirationTime"] = { display = L["Remaining Duration"], type = "timer", - useModRate = true + useModRate = true, } result["duration"] = { display = L["Total Duration"], type = "number", - useModRate = true + useModRate = true, } result["stacks"] = { display = L["Stacks"], - type = "number" + type = "number", } result["name"] = { display = L["Name"], - type = "string" + type = "string", } result["spellId"] = { display = L["Spell Id"], type = "number", - operator_types = "only_equal" + operator_types = "only_equal", } result["matchCount"] = { display = L["Total Match Count"], - type = "number" + type = "number", } result["matchCountPerUnit"] = { display = L["Match Count per Unit"], - type = "number" + type = "number", } result["unitCount"] = { display = L["Affected Unit Count"], - type = "number" + type = "number", } result["totalStacks"] = { display = L["Total Stacks"], - type = "number" + type = "number", } if trigger.unit ~= "multi" then result["maxUnitCount"] = { display = L["Total Unit Count"], - type = "number" + type = "number", } end @@ -2912,41 +3027,41 @@ function BuffTrigger.GetTriggerConditions(data, triggernum) type = "bool", test = function(state, needle) return state and state.show and ((state.active and true or false) == (needle == 1)) - end + end, } end if not IsSingleMissing(trigger) and trigger.unit ~= "multi" and trigger.fetchTooltip then result["tooltip1"] = { display = L["Tooltip Value 1"], - type = "number" + type = "number", } result["tooltip2"] = { display = L["Tooltip Value 2"], - type = "number" + type = "number", } result["tooltip3"] = { display = L["Tooltip Value 3"], - type = "number" + type = "number", } end if trigger.unit ~= "multi" then result["stackGainTime"] = { display = L["Since Stack Gain"], - type = "elapsedTimer" + type = "elapsedTimer", } result["stackLostTime"] = { display = L["Since Stack Lost"], - type = "elapsedTimer" + type = "elapsedTimer", } result["initialTime"] = { display = L["Since Apply"], - type = "elapsedTimer" + type = "elapsedTimer", } result["refreshTime"] = { display = L["Since Apply/Refresh"], - type = "elapsedTimer" + type = "elapsedTimer", } end @@ -2985,7 +3100,8 @@ function Private.CanConvertBuffTrigger2(trigger) end if trigger.unit == "group" then - return true, L["Warning: Name info is now available via %affected, %unaffected. Number of affected group members via %unitCount. Some options behave differently now. This is not automatically adjusted."] + return true, + L["Warning: Name info is now available via %affected, %unaffected. Number of affected group members via %unitCount. Some options behave differently now. This is not automatically adjusted."] end if trigger.fullscan then @@ -3152,7 +3268,7 @@ local function TrackUid(unit) else ReleaseUID(unit) end - unit = unit.."target" + unit = unit .. "target" GUID = UnitGUID(unit) if GUID then SetUID(GUID, unit) @@ -3197,7 +3313,7 @@ local function CleanUpMulti(guid) else if not nextCheck then nextCheck = removeAt - elseif (removeAt < nextCheck) then + elseif removeAt < nextCheck then nextCheck = removeAt end end @@ -3210,7 +3326,7 @@ local function CleanUpMulti(guid) if timeUntilNext > 0 then cleanupTimerMulti[guid].handle = timer:ScheduleTimerFixed(CleanUpMulti, timeUntilNext, guid) cleanupTimerMulti[guid].nextTime = nextCheck - end + end end end @@ -3244,7 +3360,7 @@ local function UpdateMatchDataMulti(time, base, key, event, sourceGUID, sourceNa unitName = destName, casterName = sourceName, time = time, - auras = {} + auras = {}, } else base[key][sourceGUID] = base[key][sourceGUID] or {} @@ -3395,7 +3511,8 @@ local function AugmentMatchDataMulti(matchData, unit, filter, sourceGUID, nameKe end local auraSourceGuid = unitCaster and UnitGUID(unitCaster) if (name == nameKey or spellId == spellKey) and sourceGUID == auraSourceGuid then - local changed = AugmentMatchDataMultiWith(matchData, unit, name, icon, stacks, debuffClass, duration, expirationTime, unitCaster, isStealable, _, spellId, _, _, _, _, modRate) + local changed = + AugmentMatchDataMultiWith(matchData, unit, name, icon, stacks, debuffClass, duration, expirationTime, unitCaster, isStealable, _, spellId, _, _, _, _, modRate) return changed end index = index + 1 @@ -3485,7 +3602,25 @@ local function CheckAurasMulti(base, unit, filter) end local auraCasterGUID = unitCaster and UnitGUID(unitCaster) if base[name] and base[name][auraCasterGUID] then - local changed = AugmentMatchDataMultiWith(base[name][auraCasterGUID], unit, name, icon, stacks, debuffClass, duration, expirationTime, unitCaster, isStealable, _, spellId, _, _, _, _, modRate) + local changed = AugmentMatchDataMultiWith( + base[name][auraCasterGUID], + unit, + name, + icon, + stacks, + debuffClass, + duration, + expirationTime, + unitCaster, + isStealable, + _, + spellId, + _, + _, + _, + _, + modRate + ) if changed then for id, idData in pairs(base[name][auraCasterGUID].auras) do for triggernum in pairs(idData) do @@ -3496,7 +3631,25 @@ local function CheckAurasMulti(base, unit, filter) end end if base[spellId] and base[spellId][auraCasterGUID] then - local changed = AugmentMatchDataMultiWith(base[spellId][auraCasterGUID], unit, name, icon, stacks, debuffClass, duration, expirationTime, unitCaster, isStealable, _, spellId, _, _, _, _, modRate) + local changed = AugmentMatchDataMultiWith( + base[spellId][auraCasterGUID], + unit, + name, + icon, + stacks, + debuffClass, + duration, + expirationTime, + unitCaster, + isStealable, + _, + spellId, + _, + _, + _, + _, + modRate + ) if changed then for id, idData in pairs(base[spellId][auraCasterGUID].auras) do for triggernum in pairs(idData) do @@ -3552,7 +3705,7 @@ function BuffTrigger.HandleMultiEvent(frame, event, ...) elseif event == "NAME_PLATE_UNIT_REMOVED" then local unit = ... ReleaseUID(unit) - unit = unit.."target" + unit = unit .. "target" ReleaseUID(unit) elseif event == "UNIT_AURA" then local unit = ... @@ -3563,7 +3716,7 @@ function BuffTrigger.HandleMultiEvent(frame, event, ...) end elseif event == "PLAYER_LEAVING_WORLD" then -- Remove everything.. - for GUID, GUIDData in pairs(matchDataMulti) do + for GUID, GUIDData in pairs(matchDataMulti) do for key in pairs(GUIDData) do RemoveMatchDataMulti(GUIDData, GUID, key) end @@ -3578,9 +3731,9 @@ function BuffTrigger.GetTriggerDescription(data, triggernum, namestable) if trigger.useName and trigger.auranames then for index, name in pairs(trigger.auranames) do local left = " " - if(index == 1) then - if(#trigger.auranames > 0) then - if(#trigger.auranames > 1) then + if index == 1 then + if #trigger.auranames > 0 then + if #trigger.auranames > 1 then left = L["Auras:"] else left = L["Aura:"] @@ -3595,11 +3748,11 @@ function BuffTrigger.GetTriggerDescription(data, triggernum, namestable) icon = WeakAuras.spellCache.GetIcon(name) end icon = icon or "Interface\\Icons\\INV_Misc_QuestionMark" - tinsert(namestable, {left, name, icon}) + tinsert(namestable, { left, name, icon }) end end - if trigger.useExactSpellId and trigger.auraspellids then + if trigger.useExactSpellId and trigger.auraspellids then for index, spellId in pairs(trigger.auraspellids) do local left = " " if index == 1 then @@ -3613,13 +3766,13 @@ function BuffTrigger.GetTriggerDescription(data, triggernum, namestable) end local icon = select(3, GetSpellInfo(spellId)) or "Interface\\Icons\\INV_Misc_QuestionMark" - tinsert(namestable, {left, spellId, icon}) + tinsert(namestable, { left, spellId, icon }) end end end function BuffTrigger.CreateFakeStates(id, triggernum) - local allStates = WeakAuras.GetTriggerStateForTrigger(id, triggernum); + local allStates = WeakAuras.GetTriggerStateForTrigger(id, triggernum) local data = WeakAuras.GetData(id) local state = {} BuffTrigger.CreateFallbackState(data, triggernum, state) @@ -3641,4 +3794,4 @@ function BuffTrigger.CreateFakeStates(id, triggernum) end end -WeakAuras.RegisterTriggerSystem({"aura2"}, BuffTrigger) +WeakAuras.RegisterTriggerSystem({ "aura2" }, BuffTrigger) diff --git a/WeakAuras/Conditions.lua b/WeakAuras/Conditions.lua index 0ba4f51bbc..0f05ff0eb0 100644 --- a/WeakAuras/Conditions.lua +++ b/WeakAuras/Conditions.lua @@ -1,26 +1,28 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, Private = ... local L = WeakAuras.L local timer = WeakAuras.timer -- Dynamic Condition functions to run. keyed on event and uid -local dynamicConditions = {}; +local dynamicConditions = {} -- Global Dynamic Condition Funcs, keyed on the event -local globalDynamicConditionFuncs = {}; +local globalDynamicConditionFuncs = {} -- Check Conditions Functions, keyed on uid -local checkConditions = {}; +local checkConditions = {} -local conditionChecksTimers = {}; -conditionChecksTimers.recheckTime = {}; -conditionChecksTimers.recheckHandle = {}; +local conditionChecksTimers = {} +conditionChecksTimers.recheckTime = {} +conditionChecksTimers.recheckHandle = {} local function OnDelete(_, uid) checkConditions[uid] = nil conditionChecksTimers.recheckTime[uid] = nil - if (conditionChecksTimers.recheckHandle[uid]) then + if conditionChecksTimers.recheckHandle[uid] then for cloneId, v in pairs(conditionChecksTimers.recheckHandle[uid]) do timer:CancelTimer(v) end @@ -35,33 +37,34 @@ end Private.callbacks:RegisterCallback("Delete", OnDelete) local function formatValueForAssignment(vType, value, pathToCustomFunction, pathToFormatters) - if (value == nil) then - value = false; - end - if (vType == "bool") then - return value and tostring(value) or "false"; - elseif(vType == "number") then - return value and tostring(value) or "0"; - elseif (vType == "list") then + if value == nil then + value = false + end + if vType == "bool" then + return value and tostring(value) or "false" + elseif vType == "number" then + return value and tostring(value) or "0" + elseif vType == "list" then if type(value) == "string" then return string.format("%s", Private.QuotedString(value)) elseif type(value) == "number" then return tostring(value) end return "nil" - elseif (vType == "icon") then + elseif vType == "icon" then if type(value) == "string" then return string.format("%s", Private.QuotedString(value)) elseif type(value) == "number" then return tostring(value) end return "nil" - elseif(vType == "color") then - if (value and type(value) == "table") then - return string.format("{%s, %s, %s, %s}", tostring(value[1]), tostring(value[2]), tostring(value[3]), tostring(value[4])); + elseif vType == "color" then + if value and type(value) == "table" then + return string.format("{%s, %s, %s, %s}", tostring(value[1]), tostring(value[2]), tostring(value[3]), tostring(value[4])) end - return "{1, 1, 1, 1}"; - elseif(vType == "chat") then + return "{1, 1, 1, 1}" + elseif vType == "chat" then + -- stylua: ignore if (value and type(value) == "table") then local serialized = string.format("{message_type = %s, message = %s, message_dest = %s, message_dest_isunit = %s, r = %s, g = %s, b = %s, message_custom = %s, message_formaters = %s, message_voice = %s}", Private.QuotedString(tostring(value.message_type)), Private.QuotedString(tostring(value.message or "")), @@ -75,7 +78,8 @@ local function formatValueForAssignment(vType, value, pathToCustomFunction, path tostring(value.message_voice)) return serialized end - elseif(vType == "sound") then + elseif vType == "sound" then + -- stylua: ignore if (value and type(value) == "table") then return string.format("{ sound = %s, sound_channel = %s, sound_path = %s, sound_kit_id = %s, sound_type = %s, %s}", Private.QuotedString(tostring(value.sound or "")), Private.QuotedString(tostring(value.sound_channel or "")), @@ -83,9 +87,10 @@ local function formatValueForAssignment(vType, value, pathToCustomFunction, path Private.QuotedString(tostring(value.sound_type or "")), value.sound_repeat and "sound_repeat = " .. tostring(value.sound_repeat) or "nil"); end - elseif(vType == "customcode") then - return string.format("%s", pathToCustomFunction); + elseif vType == "customcode" then + return string.format("%s", pathToCustomFunction) elseif vType == "glowexternal" then + -- stylua: ignore if (value and type(value) == "table") then return ([[{ glow_action = %q, glow_frame_type = %q, glow_type = %q, glow_frame = %q, use_glow_color = %s, glow_color = {%s, %s, %s, %s}, @@ -111,172 +116,194 @@ local function formatValueForAssignment(vType, value, pathToCustomFunction, path ) end end - return "nil"; + return "nil" end local function formatValueForCall(type, property) - if (type == "bool" or type == "number" or type == "list" or type == "icon") then - return "propertyChanges['" .. property .. "']"; - elseif (type == "color") then - local pcp = "propertyChanges['" .. property .. "']"; - return pcp .. "[1], " .. pcp .. "[2], " .. pcp .. "[3], " .. pcp .. "[4]"; + if type == "bool" or type == "number" or type == "list" or type == "icon" then + return "propertyChanges['" .. property .. "']" + elseif type == "color" then + local pcp = "propertyChanges['" .. property .. "']" + return pcp .. "[1], " .. pcp .. "[2], " .. pcp .. "[3], " .. pcp .. "[4]" end - return "nil"; + return "nil" end - - function WeakAuras.scheduleConditionCheck(time, uid, cloneId) conditionChecksTimers.recheckTime[uid] = conditionChecksTimers.recheckTime[uid] or {} - conditionChecksTimers.recheckHandle[uid] = conditionChecksTimers.recheckHandle[uid] or {}; + conditionChecksTimers.recheckHandle[uid] = conditionChecksTimers.recheckHandle[uid] or {} - if (conditionChecksTimers.recheckTime[uid][cloneId] and conditionChecksTimers.recheckTime[uid][cloneId] > time) then - timer:CancelTimer(conditionChecksTimers.recheckHandle[uid][cloneId]); - conditionChecksTimers.recheckHandle[uid][cloneId] = nil; + if conditionChecksTimers.recheckTime[uid][cloneId] and conditionChecksTimers.recheckTime[uid][cloneId] > time then + timer:CancelTimer(conditionChecksTimers.recheckHandle[uid][cloneId]) + conditionChecksTimers.recheckHandle[uid][cloneId] = nil end - if (conditionChecksTimers.recheckHandle[uid][cloneId] == nil) then + if conditionChecksTimers.recheckHandle[uid][cloneId] == nil then conditionChecksTimers.recheckHandle[uid][cloneId] = timer:ScheduleTimerFixed(function() - conditionChecksTimers.recheckHandle[uid][cloneId] = nil; + conditionChecksTimers.recheckHandle[uid][cloneId] = nil local region = Private.GetRegionByUID(uid, cloneId) - if (region and region.toShow) then + if region and region.toShow then Private.ActivateAuraEnvironmentForRegion(region) - checkConditions[uid](region); + checkConditions[uid](region) Private.ActivateAuraEnvironment() end end, time - GetTime()) - conditionChecksTimers.recheckTime[uid][cloneId] = time; + conditionChecksTimers.recheckTime[uid][cloneId] = time end end function WeakAuras.CallCustomConditionTest(uid, testFunctionNumber, ...) - local ok, result = xpcall(WeakAuras.conditionHelpers[uid].customTestFunctions[testFunctionNumber], - Private.GetErrorHandlerUid(uid, L["Condition Custom Text"]), ...) - if (ok) then + local ok, result = xpcall(WeakAuras.conditionHelpers[uid].customTestFunctions[testFunctionNumber], Private.GetErrorHandlerUid(uid, L["Condition Custom Text"]), ...) + if ok then return result end end local function CreateTestForCondition(uid, input, allConditionsTemplate, usedStates) - local trigger = input and input.trigger; - local variable = input and input.variable; - local op = input and input.op; - local value = input and input.value; + local trigger = input and input.trigger + local variable = input and input.variable + local op = input and input.op + local value = input and input.value - local check = nil; - local recheckCode = nil; + local check = nil + local recheckCode = nil - if (variable == "AND" or variable == "OR") then - local test = {}; - if (input.checks) then + if variable == "AND" or variable == "OR" then + local test = {} + if input.checks then for i, subcheck in ipairs(input.checks) do - local subtest, subrecheckCode = CreateTestForCondition(uid, subcheck, allConditionsTemplate, usedStates); - if (subtest) then - tinsert(test, "(" .. subtest .. ")"); + local subtest, subrecheckCode = CreateTestForCondition(uid, subcheck, allConditionsTemplate, usedStates) + if subtest then + tinsert(test, "(" .. subtest .. ")") end - if (subrecheckCode) then - recheckCode = recheckCode or ""; - recheckCode = recheckCode .. subrecheckCode; + if subrecheckCode then + recheckCode = recheckCode or "" + recheckCode = recheckCode .. subrecheckCode end end end - if (next(test)) then - if (variable == "AND") then - check = table.concat(test, " and "); + if next(test) then + if variable == "AND" then + check = table.concat(test, " and ") else - check = table.concat(test, " or "); + check = table.concat(test, " or ") end end end - if (trigger and variable) then - usedStates[trigger] = true; + if trigger and variable then + usedStates[trigger] = true - local conditionTemplate = allConditionsTemplate[trigger] and allConditionsTemplate[trigger][variable]; - local cType = conditionTemplate and conditionTemplate.type; + local conditionTemplate = allConditionsTemplate[trigger] and allConditionsTemplate[trigger][variable] + local cType = conditionTemplate and conditionTemplate.type local useModRate = conditionTemplate and conditionTemplate.useModRate - local test = conditionTemplate and conditionTemplate.test; - local preamble = conditionTemplate and conditionTemplate.preamble; + local test = conditionTemplate and conditionTemplate.test + local preamble = conditionTemplate and conditionTemplate.preamble - local stateCheck = "state[" .. trigger .. "] and state[" .. trigger .. "].show and "; - local stateVariableCheck = string.format("state[" .. trigger .. "][%q]", variable) .. "~= nil and "; + local stateCheck = "state[" .. trigger .. "] and state[" .. trigger .. "].show and " + local stateVariableCheck = string.format("state[" .. trigger .. "][%q]", variable) .. "~= nil and " local preambleString if preamble then WeakAuras.conditionHelpers[uid] = WeakAuras.conditionHelpers[uid] or {} WeakAuras.conditionHelpers[uid].preambles = WeakAuras.conditionHelpers[uid].preambles or {} - tinsert(WeakAuras.conditionHelpers[uid].preambles, preamble(value) or ""); + tinsert(WeakAuras.conditionHelpers[uid].preambles, preamble(value) or "") local preambleNumber = #WeakAuras.conditionHelpers[uid].preambles preambleString = string.format("WeakAuras.conditionHelpers[%q].preambles[%s]", uid, preambleNumber) end - if (test) then - if (value) then + if test then + if value then WeakAuras.conditionHelpers[uid] = WeakAuras.conditionHelpers[uid] or {} WeakAuras.conditionHelpers[uid].customTestFunctions = WeakAuras.conditionHelpers[uid].customTestFunctions or {} - tinsert(WeakAuras.conditionHelpers[uid].customTestFunctions, test); - local testFunctionNumber = #(WeakAuras.conditionHelpers[uid].customTestFunctions); - local valueString = type(value) == "string" and string.format("%q", value) or value; - local opString = type(op) == "string" and string.format("%q", op) or op; - check = string.format("state and WeakAuras.CallCustomConditionTest(%q, %s, state[%s], %s, %s, %s)", - uid, testFunctionNumber, trigger, valueString, (opString or "nil"), preambleString or "nil"); + tinsert(WeakAuras.conditionHelpers[uid].customTestFunctions, test) + local testFunctionNumber = #WeakAuras.conditionHelpers[uid].customTestFunctions + local valueString = type(value) == "string" and string.format("%q", value) or value + local opString = type(op) == "string" and string.format("%q", op) or op + check = string.format( + "state and WeakAuras.CallCustomConditionTest(%q, %s, state[%s], %s, %s, %s)", + uid, + testFunctionNumber, + trigger, + valueString, + (opString or "nil"), + preambleString or "nil" + ) end - elseif (cType == "customcheck") then + elseif cType == "customcheck" then if value then local customCheck = WeakAuras.LoadFunction("return " .. value) if customCheck then WeakAuras.conditionHelpers[uid] = WeakAuras.conditionHelpers[uid] or {} WeakAuras.conditionHelpers[uid].customTestFunctions = WeakAuras.conditionHelpers[uid].customTestFunctions or {} - tinsert(WeakAuras.conditionHelpers[uid].customTestFunctions, customCheck); - local testFunctionNumber = #(WeakAuras.conditionHelpers[uid].customTestFunctions); + tinsert(WeakAuras.conditionHelpers[uid].customTestFunctions, customCheck) + local testFunctionNumber = #WeakAuras.conditionHelpers[uid].customTestFunctions - check = string.format("state and WeakAuras.CallCustomConditionTest(%q, %s, state)", - uid, testFunctionNumber, trigger); + check = string.format("state and WeakAuras.CallCustomConditionTest(%q, %s, state)", uid, testFunctionNumber, trigger) end end elseif cType == "alwaystrue" then check = "true" - elseif (cType == "number" and value and op) then + elseif cType == "number" and value and op then local v = tonumber(value) - if (v) then + if v then if useModRate then - check = stateCheck .. stateVariableCheck .. "(state[" .. trigger .. "]" .. string.format("[%q]", variable) - .. "/ (state[" .. trigger .. "].modRate or 1.0))" .. op .. v; + check = stateCheck .. stateVariableCheck .. "(state[" .. trigger .. "]" .. string.format("[%q]", variable) .. "/ (state[" .. trigger .. "].modRate or 1.0))" .. op .. v else - check = stateCheck .. stateVariableCheck .. "state[" .. trigger .. "]" .. string.format("[%q]", variable) .. op .. v; + check = stateCheck .. stateVariableCheck .. "state[" .. trigger .. "]" .. string.format("[%q]", variable) .. op .. v end end - elseif (cType == "timer" and value and op) then + elseif cType == "timer" and value and op then if useModRate then - if (op == "==") then - check = stateCheck .. stateVariableCheck .. "abs(((state[" .. trigger .. "]" .. string.format("[%q]", variable) .. "- now) " - .. "/ (state[" .. trigger .. "].modRate or 1.0))" .. " -" .. value .. ") < 0.05"; + if op == "==" then + check = stateCheck + .. stateVariableCheck + .. "abs(((state[" + .. trigger + .. "]" + .. string.format("[%q]", variable) + .. "- now) " + .. "/ (state[" + .. trigger + .. "].modRate or 1.0))" + .. " -" + .. value + .. ") < 0.05" else - check = stateCheck .. stateVariableCheck .. "((state[" .. trigger .. "]" .. string.format("[%q]", variable) - .. "- now) / (state[" .. trigger .. "].modRate or 1.0))" .. op .. value; + check = stateCheck + .. stateVariableCheck + .. "((state[" + .. trigger + .. "]" + .. string.format("[%q]", variable) + .. "- now) / (state[" + .. trigger + .. "].modRate or 1.0))" + .. op + .. value end else - if (op == "==") then - check = stateCheck .. stateVariableCheck .. "abs(state[" .. trigger .. "]" .. string.format("[%q]", variable) .. "- now -" .. value .. ") < 0.05"; + if op == "==" then + check = stateCheck .. stateVariableCheck .. "abs(state[" .. trigger .. "]" .. string.format("[%q]", variable) .. "- now -" .. value .. ") < 0.05" else - check = stateCheck .. stateVariableCheck .. "state[" .. trigger .. "]" .. string.format("[%q]", variable) .. "- now" .. op .. value; + check = stateCheck .. stateVariableCheck .. "state[" .. trigger .. "]" .. string.format("[%q]", variable) .. "- now" .. op .. value end end - elseif (cType == "elapsedTimer" and value and op) then - if (op == "==") then - check = stateCheck .. stateVariableCheck .. "abs(state[" .. trigger .. "]" .. string.format("[%q]", variable) .. "- now +" .. value .. ") < 0.05"; + elseif cType == "elapsedTimer" and value and op then + if op == "==" then + check = stateCheck .. stateVariableCheck .. "abs(state[" .. trigger .. "]" .. string.format("[%q]", variable) .. "- now +" .. value .. ") < 0.05" else - check = stateCheck .. stateVariableCheck .. "now - state[" .. trigger .. "]" .. string.format("[%q]", variable) .. op .. value; + check = stateCheck .. stateVariableCheck .. "now - state[" .. trigger .. "]" .. string.format("[%q]", variable) .. op .. value end - elseif (cType == "select" and value and op) then - if (tonumber(value)) then - check = stateCheck .. stateVariableCheck .. "state[" .. trigger .. "]" .. string.format("[%q]", variable) .. op .. tonumber(value); + elseif cType == "select" and value and op then + if tonumber(value) then + check = stateCheck .. stateVariableCheck .. "state[" .. trigger .. "]" .. string.format("[%q]", variable) .. op .. tonumber(value) else - check = stateCheck .. stateVariableCheck .. "state[" .. trigger .. "]".. string.format("[%q]", variable) .. op .. "'" .. value .. "'"; + check = stateCheck .. stateVariableCheck .. "state[" .. trigger .. "]" .. string.format("[%q]", variable) .. op .. "'" .. value .. "'" end - elseif (cType == "range" and value and op and input.type and input.op_range and input.range) then + elseif cType == "range" and value and op and input.type and input.op_range and input.range then local fn if input.type == "group" then fn = [[ @@ -315,63 +342,62 @@ local function CreateTestForCondition(uid, input, allConditionsTemplate, usedSta if customCheck then WeakAuras.conditionHelpers[uid] = WeakAuras.conditionHelpers[uid] or {} WeakAuras.conditionHelpers[uid].customTestFunctions = WeakAuras.conditionHelpers[uid].customTestFunctions or {} - tinsert(WeakAuras.conditionHelpers[uid].customTestFunctions, customCheck); - local testFunctionNumber = #(WeakAuras.conditionHelpers[uid].customTestFunctions); + tinsert(WeakAuras.conditionHelpers[uid].customTestFunctions, customCheck) + local testFunctionNumber = #WeakAuras.conditionHelpers[uid].customTestFunctions - check = string.format("state and WeakAuras.CallCustomConditionTest(%q, %s, state)", - uid, testFunctionNumber, trigger); + check = string.format("state and WeakAuras.CallCustomConditionTest(%q, %s, state)", uid, testFunctionNumber, trigger) end end - elseif (cType == "bool" and value) then - local rightSide = value == 0 and "false" or "true"; + elseif cType == "bool" and value then + local rightSide = value == 0 and "false" or "true" check = stateCheck .. stateVariableCheck .. "state[" .. trigger .. "]" .. string.format("[%q]", variable) .. "==" .. rightSide - elseif (cType == "string" and value) then - if(op == "==") then - check = stateCheck .. stateVariableCheck .. "state[" .. trigger .. "]" .. string.format("[%q]", variable) .. " == [[" .. value .. "]]"; - elseif (op == "find('%s')") then - check = stateCheck .. stateVariableCheck .. "state[" .. trigger .. "]" .. string.format("[%q]", variable) .. ":find([[" .. value .. "]], 1, true)"; - elseif (op == "match('%s')") then - check = stateCheck .. stateVariableCheck .. "state[" .. trigger .. "]" .. string.format("[%q]", variable) .. ":match([[" .. value .. "]], 1, true)"; + elseif cType == "string" and value then + if op == "==" then + check = stateCheck .. stateVariableCheck .. "state[" .. trigger .. "]" .. string.format("[%q]", variable) .. " == [[" .. value .. "]]" + elseif op == "find('%s')" then + check = stateCheck .. stateVariableCheck .. "state[" .. trigger .. "]" .. string.format("[%q]", variable) .. ":find([[" .. value .. "]], 1, true)" + elseif op == "match('%s')" then + check = stateCheck .. stateVariableCheck .. "state[" .. trigger .. "]" .. string.format("[%q]", variable) .. ":match([[" .. value .. "]], 1, true)" end end -- If adding a new condition type, don't forget to adjust the validator in the options code - - if (cType == "timer" and value) then - recheckCode = " nextTime = state[" .. trigger .. "] and state[" .. trigger .. "]" .. string.format("[%q]", variable) .. " and (state[" .. trigger .. "]" .. string.format("[%q]", variable) .. " - " .. value .. ")\n"; + -- stylua: ignore + if cType == "timer" and value then + recheckCode = " nextTime = state[" .. trigger .. "] and state[" .. trigger .. "]" .. string.format("[%q]", variable) .. " and (state[" .. trigger .. "]" .. string.format("[%q]", variable) .. " - " .. value .. ")\n" recheckCode = recheckCode .. " if (nextTime and (not recheckTime or nextTime < recheckTime) and nextTime >= now) then\n" - recheckCode = recheckCode .. " recheckTime = nextTime\n"; + recheckCode = recheckCode .. " recheckTime = nextTime\n" recheckCode = recheckCode .. " end\n" - elseif (cType == "elapsedTimer" and value) then - recheckCode = " nextTime = state[" .. trigger .. "] and state[" .. trigger .. "]" .. string.format("[%q]", variable) .. " and (state[" .. trigger .. "]" .. string.format("[%q]", variable) .. " +" .. value .. ")\n"; + elseif cType == "elapsedTimer" and value then + recheckCode = " nextTime = state[" .. trigger .. "] and state[" .. trigger .. "]" .. string.format("[%q]", variable) .. " and (state[" .. trigger .. "]" .. string.format("[%q]", variable) .. " +" .. value .. ")\n" recheckCode = recheckCode .. " if (nextTime and (not recheckTime or nextTime < recheckTime) and nextTime >= now) then\n" - recheckCode = recheckCode .. " recheckTime = nextTime\n"; + recheckCode = recheckCode .. " recheckTime = nextTime\n" recheckCode = recheckCode .. " end\n" end end - return check, recheckCode; + return check, recheckCode end local function CreateCheckCondition(uid, ret, condition, conditionNumber, allConditionsTemplate, nextIsLinked, debug) - local usedStates = {}; - local check, recheckCode = CreateTestForCondition(uid, condition.check, allConditionsTemplate, usedStates); + local usedStates = {} + local check, recheckCode = CreateTestForCondition(uid, condition.check, allConditionsTemplate, usedStates) if not check then check = "false" end if condition.linked and conditionNumber > 1 then - ret = ret .. " elseif (" .. check .. ") then\n"; + ret = ret .. " elseif (" .. check .. ") then\n" else - ret = ret .. " if (" .. check .. ") then\n"; + ret = ret .. " if (" .. check .. ") then\n" end - ret = ret .. " newActiveConditions[" .. conditionNumber .. "] = true;\n"; + ret = ret .. " newActiveConditions[" .. conditionNumber .. "] = true;\n" if not nextIsLinked then - ret = ret .. " end\n"; + ret = ret .. " end\n" end - if (check) then - ret = ret .. "\n"; + if check then + ret = ret .. "\n" end - return ret, recheckCode; + return ret, recheckCode end local function ParseProperty(property) @@ -384,8 +410,8 @@ local function ParseProperty(property) end local function GetBaseProperty(data, property, start) - if (not data) then - return nil; + if not data then + return nil end local subIndex, prop = ParseProperty(property) @@ -393,66 +419,91 @@ local function GetBaseProperty(data, property, start) return GetBaseProperty(data.subRegions[subIndex], prop, start) end - start = start or 1; - local next = string.find(property, ".", start, true); - if (next) then - return GetBaseProperty(data[string.sub(property, start, next - 1)], property, next + 1); + start = start or 1 + local next = string.find(property, ".", start, true) + if next then + return GetBaseProperty(data[string.sub(property, start, next - 1)], property, next + 1) end - local key = string.sub(property, start); - return data[key] or data[tonumber(key)]; + local key = string.sub(property, start) + return data[key] or data[tonumber(key)] end local function CreateDeactivateCondition(ret, condition, conditionNumber, data, properties, usedProperties, debug) - if (condition.changes) then - ret = ret .. " if (activatedConditions[".. conditionNumber .. "] and not newActiveConditions[" .. conditionNumber .. "]) then\n" - if (debug) then ret = ret .. " print('Deactivating condition " .. conditionNumber .. "' )\n"; end + if condition.changes then + ret = ret .. " if (activatedConditions[" .. conditionNumber .. "] and not newActiveConditions[" .. conditionNumber .. "]) then\n" + if debug then + ret = ret .. " print('Deactivating condition " .. conditionNumber .. "' )\n" + end for changeNum, change in ipairs(condition.changes) do - if (change.property) then + if change.property then local propertyData = properties and properties[change.property] - if (propertyData and propertyData.type and propertyData.setter) then - usedProperties[change.property] = true; - ret = ret .. " propertyChanges['" .. change.property .. "'] = " .. formatValueForAssignment(propertyData.type, GetBaseProperty(data, change.property)) .. "\n"; - if (debug) then ret = ret .. " print('- " .. change.property .. " " ..formatValueForAssignment(propertyData.type, GetBaseProperty(data, change.property)) .. "')\n"; end + if propertyData and propertyData.type and propertyData.setter then + usedProperties[change.property] = true + ret = ret .. " propertyChanges['" .. change.property .. "'] = " .. formatValueForAssignment(propertyData.type, GetBaseProperty(data, change.property)) .. "\n" + if debug then + ret = ret .. " print('- " .. change.property .. " " .. formatValueForAssignment(propertyData.type, GetBaseProperty(data, change.property)) .. "')\n" + end end end end ret = ret .. " end\n" end - return ret; + return ret end local function CreateActivateCondition(ret, id, condition, conditionNumber, properties, debug) - if (condition.changes) then + if condition.changes then ret = ret .. " if (newActiveConditions[" .. conditionNumber .. "]) then\n" - ret = ret .. " if (not activatedConditions[".. conditionNumber .. "]) then\n" - if (debug) then ret = ret .. " print('Activating condition " .. conditionNumber .. "' )\n"; end + ret = ret .. " if (not activatedConditions[" .. conditionNumber .. "]) then\n" + if debug then + ret = ret .. " print('Activating condition " .. conditionNumber .. "' )\n" + end -- non active => active for changeNum, change in ipairs(condition.changes) do - if (change.property) then + if change.property then local propertyData = properties and properties[change.property] - if (propertyData and propertyData.type) then - if (propertyData.setter) then - ret = ret .. " propertyChanges['" .. change.property .. "'] = " .. formatValueForAssignment(propertyData.type, change.value) .. "\n"; - if (debug) then ret = ret .. " print('- " .. change.property .. " " .. formatValueForAssignment(propertyData.type, change.value) .. "')\n"; end - elseif (propertyData.action) then - local pathToCustomFunction = "nil"; + if propertyData and propertyData.type then + if propertyData.setter then + ret = ret .. " propertyChanges['" .. change.property .. "'] = " .. formatValueForAssignment(propertyData.type, change.value) .. "\n" + if debug then + ret = ret .. " print('- " .. change.property .. " " .. formatValueForAssignment(propertyData.type, change.value) .. "')\n" + end + elseif propertyData.action then + local pathToCustomFunction = "nil" local pathToFormatter = "nil" - if (WeakAuras.customConditionsFunctions[id] + if + WeakAuras.customConditionsFunctions[id] and WeakAuras.customConditionsFunctions[id][conditionNumber] - and WeakAuras.customConditionsFunctions[id][conditionNumber].changes - and WeakAuras.customConditionsFunctions[id][conditionNumber].changes[changeNum]) then - pathToCustomFunction = string.format("WeakAuras.customConditionsFunctions[%q][%s].changes[%s]", id, conditionNumber, changeNum); + and WeakAuras.customConditionsFunctions[id][conditionNumber].changes + and WeakAuras.customConditionsFunctions[id][conditionNumber].changes[changeNum] + then + pathToCustomFunction = string.format("WeakAuras.customConditionsFunctions[%q][%s].changes[%s]", id, conditionNumber, changeNum) end - if WeakAuras.conditionTextFormatters[id] + if + WeakAuras.conditionTextFormatters[id] and WeakAuras.conditionTextFormatters[id][conditionNumber] and WeakAuras.conditionTextFormatters[id][conditionNumber].changes - and WeakAuras.conditionTextFormatters[id][conditionNumber].changes[changeNum] then - pathToFormatter = string.format("WeakAuras.conditionTextFormatters[%q][%s].changes[%s]", id, conditionNumber, changeNum); + and WeakAuras.conditionTextFormatters[id][conditionNumber].changes[changeNum] + then + pathToFormatter = string.format("WeakAuras.conditionTextFormatters[%q][%s].changes[%s]", id, conditionNumber, changeNum) + end + ret = ret + .. " region:" + .. propertyData.action + .. "(" + .. formatValueForAssignment(propertyData.type, change.value, pathToCustomFunction, pathToFormatter) + .. ")" + .. "\n" + if debug then + ret = ret + .. " print('# " + .. propertyData.action + .. "(" + .. formatValueForAssignment(propertyData.type, change.value, pathToCustomFunction, pathToFormatter) + .. "')\n" end - ret = ret .. " region:" .. propertyData.action .. "(" .. formatValueForAssignment(propertyData.type, change.value, pathToCustomFunction, pathToFormatter) .. ")" .. "\n"; - if (debug) then ret = ret .. " print('# " .. propertyData.action .. "(" .. formatValueForAssignment(propertyData.type, change.value, pathToCustomFunction, pathToFormatter) .. "')\n"; end end end end @@ -460,34 +511,36 @@ local function CreateActivateCondition(ret, id, condition, conditionNumber, prop ret = ret .. " else\n" -- active => active, only override properties for changeNum, change in ipairs(condition.changes) do - if (change.property) then + if change.property then local propertyData = properties and properties[change.property] - if (propertyData and propertyData.type and propertyData.setter) then + if propertyData and propertyData.type and propertyData.setter then ret = ret .. " if(propertyChanges['" .. change.property .. "'] ~= nil) then\n" - ret = ret .. " propertyChanges['" .. change.property .. "'] = " .. formatValueForAssignment(propertyData.type, change.value) .. "\n"; - if (debug) then ret = ret .. " print('- " .. change.property .. " " .. formatValueForAssignment(propertyData.type, change.value) .. "')\n"; end + ret = ret .. " propertyChanges['" .. change.property .. "'] = " .. formatValueForAssignment(propertyData.type, change.value) .. "\n" + if debug then + ret = ret .. " print('- " .. change.property .. " " .. formatValueForAssignment(propertyData.type, change.value) .. "')\n" + end ret = ret .. " end\n" end end end ret = ret .. " end\n" ret = ret .. " end\n" - ret = ret .. "\n"; - ret = ret .. " activatedConditions[".. conditionNumber .. "] = newActiveConditions[" .. conditionNumber .. "]\n"; + ret = ret .. "\n" + ret = ret .. " activatedConditions[" .. conditionNumber .. "] = newActiveConditions[" .. conditionNumber .. "]\n" end - return ret; + return ret end function Private.GetSubRegionProperties(data, properties) if data.subRegions then local subIndex = {} for index, subRegion in ipairs(data.subRegions) do - local subRegionTypeData = Private.subRegionTypes[subRegion.type]; + local subRegionTypeData = Private.subRegionTypes[subRegion.type] local propertiesFunction = subRegionTypeData and subRegionTypeData.properties - local subProperties; - if (type(propertiesFunction) == "function") then - subProperties = propertiesFunction(data, subRegion); + local subProperties + if type(propertiesFunction) == "function" then + subProperties = propertiesFunction(data, subRegion) elseif propertiesFunction then subProperties = CopyTable(propertiesFunction) end @@ -496,7 +549,7 @@ function Private.GetSubRegionProperties(data, properties) for key, property in pairs(subProperties) do subIndex[key] = subIndex[key] and subIndex[key] + 1 or 1 property.display = { subIndex[key] .. ". " .. subRegionTypeData.displayName, property.display, property.defaultProperty } - properties["sub." .. index .. "." .. key ] = property; + properties["sub." .. index .. "." .. key] = property end end end @@ -504,40 +557,40 @@ function Private.GetSubRegionProperties(data, properties) end function Private.GetProperties(data) - local properties; - local propertiesFunction = WeakAuras.regionTypes[data.regionType] and WeakAuras.regionTypes[data.regionType].properties; - if (type(propertiesFunction) == "function") then - properties = propertiesFunction(data); + local properties + local propertiesFunction = WeakAuras.regionTypes[data.regionType] and WeakAuras.regionTypes[data.regionType].properties + if type(propertiesFunction) == "function" then + properties = propertiesFunction(data) elseif propertiesFunction then - properties = CopyTable(propertiesFunction); + properties = CopyTable(propertiesFunction) else properties = {} end Private.GetSubRegionProperties(data, properties) - return properties; + return properties end function Private.LoadConditionPropertyFunctions(data) - local id = data.id; - if (data.conditions) then - WeakAuras.customConditionsFunctions[id] = {}; + local id = data.id + if data.conditions then + WeakAuras.customConditionsFunctions[id] = {} for conditionNumber, condition in ipairs(data.conditions) do - if (condition.changes) then + if condition.changes then for changeIndex, change in ipairs(condition.changes) do - if ( (change.property == "chat" or change.property == "customcode") and type(change.value) == "table" and change.value.custom) then - local custom = change.value.custom; - local prefix, suffix; - if (change.property == "chat") then - prefix, suffix = "return ", ""; + if (change.property == "chat" or change.property == "customcode") and type(change.value) == "table" and change.value.custom then + local custom = change.value.custom + local prefix, suffix + if change.property == "chat" then + prefix, suffix = "return ", "" else - prefix, suffix = "return function()", "\nend"; + prefix, suffix = "return function()", "\nend" end - local customFunc = WeakAuras.LoadFunction(prefix .. custom .. suffix); - if (customFunc) then - WeakAuras.customConditionsFunctions[id][conditionNumber] = WeakAuras.customConditionsFunctions[id][conditionNumber] or {}; - WeakAuras.customConditionsFunctions[id][conditionNumber].changes = WeakAuras.customConditionsFunctions[id][conditionNumber].changes or {}; - WeakAuras.customConditionsFunctions[id][conditionNumber].changes[changeIndex] = customFunc; + local customFunc = WeakAuras.LoadFunction(prefix .. custom .. suffix) + if customFunc then + WeakAuras.customConditionsFunctions[id][conditionNumber] = WeakAuras.customConditionsFunctions[id][conditionNumber] or {} + WeakAuras.customConditionsFunctions[id][conditionNumber].changes = WeakAuras.customConditionsFunctions[id][conditionNumber].changes or {} + WeakAuras.customConditionsFunctions[id][conditionNumber].changes[changeIndex] = customFunc end end if change.property == "chat" then @@ -550,9 +603,9 @@ function Private.LoadConditionPropertyFunctions(data) end local formatters = change.value and Private.CreateFormatters(change.value.message, getter, true) WeakAuras.conditionTextFormatters[id] = WeakAuras.conditionTextFormatters[id] or {} - WeakAuras.conditionTextFormatters[id][conditionNumber] = WeakAuras.conditionTextFormatters[id][conditionNumber] or {}; - WeakAuras.conditionTextFormatters[id][conditionNumber].changes = WeakAuras.conditionTextFormatters[id][conditionNumber].changes or {}; - WeakAuras.conditionTextFormatters[id][conditionNumber].changes[changeIndex] = formatters; + WeakAuras.conditionTextFormatters[id][conditionNumber] = WeakAuras.conditionTextFormatters[id][conditionNumber] or {} + WeakAuras.conditionTextFormatters[id][conditionNumber].changes = WeakAuras.conditionTextFormatters[id][conditionNumber].changes or {} + WeakAuras.conditionTextFormatters[id][conditionNumber].changes[changeIndex] = formatters end end end @@ -560,81 +613,82 @@ function Private.LoadConditionPropertyFunctions(data) end end -local globalConditions = -{ +local globalConditions = { ["incombat"] = { display = L["In Combat"], type = "bool", - events = {"PLAYER_REGEN_ENABLED", "PLAYER_REGEN_DISABLED"}, + events = { "PLAYER_REGEN_ENABLED", "PLAYER_REGEN_DISABLED" }, globalStateUpdate = function(state) - state.incombat = UnitAffectingCombat("player"); - end + state.incombat = UnitAffectingCombat("player") + end, }, ["hastarget"] = { display = L["Has Target"], type = "bool", - events = {"PLAYER_TARGET_CHANGED", "PLAYER_ENTERING_WORLD"}, + events = { "PLAYER_TARGET_CHANGED", "PLAYER_ENTERING_WORLD" }, globalStateUpdate = function(state) - state.hastarget = UnitExists("target"); - end + state.hastarget = UnitExists("target") + end, }, ["rangecheck"] = { display = WeakAuras.newFeatureString .. L["Range Check"], type = "range", - events = {"WA_SPELL_RANGECHECK"} + events = { "WA_SPELL_RANGECHECK" }, }, ["attackabletarget"] = { display = L["Attackable Target"], type = "bool", - events = {"PLAYER_TARGET_CHANGED", "UNIT_FACTION"}, + events = { "PLAYER_TARGET_CHANGED", "UNIT_FACTION" }, globalStateUpdate = function(state) - state.attackabletarget = UnitCanAttack("player", "target"); - end + state.attackabletarget = UnitCanAttack("player", "target") + end, }, ["customcheck"] = { display = L["Custom Check"], - type = "customcheck" + type = "customcheck", }, ["alwaystrue"] = { display = L["Always True"], - type = "alwaystrue" - } + type = "alwaystrue", + }, } function Private.GetGlobalConditions() - return globalConditions; + return globalConditions end local function ConstructConditionFunction(data) - local debug = false; - if (not data.conditions or #data.conditions == 0) then - return nil; + local debug = false + if not data.conditions or #data.conditions == 0 then + return nil end - local usedProperties = {}; + local usedProperties = {} - local allConditionsTemplate = Private.GetTriggerConditions(data); - allConditionsTemplate[-1] = Private.GetGlobalConditions(); + local allConditionsTemplate = Private.GetTriggerConditions(data) + allConditionsTemplate[-1] = Private.GetGlobalConditions() - local ret = ""; + local ret = "" ret = ret .. "local newActiveConditions = {};\n" ret = ret .. "local propertyChanges = {};\n" ret = ret .. "local nextTime;\n" ret = ret .. string.format("local uid = %q\n", data.uid) - ret = ret .. "return function(region, hideRegion)\n"; - if (debug) then ret = ret .. " print('check conditions for:', region.id, region.cloneId)\n"; end - ret = ret .. " local id = region.id\n"; - ret = ret .. " local cloneId = region.cloneId or ''\n"; + ret = ret .. "return function(region, hideRegion)\n" + if debug then + ret = ret .. " print('check conditions for:', region.id, region.cloneId)\n" + end + ret = ret .. " local id = region.id\n" + ret = ret .. " local cloneId = region.cloneId or ''\n" ret = ret .. " local state = region.states\n" - ret = ret .. " local activatedConditions = WeakAuras.GetActiveConditions(id, cloneId)\n"; - ret = ret .. " wipe(newActiveConditions)\n"; + ret = ret .. " local activatedConditions = WeakAuras.GetActiveConditions(id, cloneId)\n" + ret = ret .. " wipe(newActiveConditions)\n" ret = ret .. " local recheckTime;\n" ret = ret .. " local now = GetTime();\n" -- First Loop gather which conditions are active ret = ret .. " if (not hideRegion) then\n" local recheckCode = "" - if (data.conditions) then + if data.conditions then WeakAuras.conditionHelpers[data.uid] = nil for conditionNumber, condition in ipairs(data.conditions) do local nextIsLinked = data.conditions[conditionNumber + 1] and data.conditions[conditionNumber + 1].linked @@ -646,40 +700,40 @@ local function ConstructConditionFunction(data) end end ret = ret .. recheckCode - ret = ret .. " end\n"; + ret = ret .. " end\n" ret = ret .. " if (recheckTime) then\n" ret = ret .. " WeakAuras.scheduleConditionCheck(recheckTime, uid, cloneId);\n" ret = ret .. " end\n" - local properties = Private.GetProperties(data); + local properties = Private.GetProperties(data) -- Now build a property + change list -- Second Loop deals with conditions that are no longer active ret = ret .. " wipe(propertyChanges)\n" - if (data.conditions) then + if data.conditions then for conditionNumber, condition in ipairs(data.conditions) do ret = CreateDeactivateCondition(ret, condition, conditionNumber, data, properties, usedProperties, debug) end end - ret = ret .. "\n"; + ret = ret .. "\n" -- Third Loop deals with conditions that are newly active - if (data.conditions) then + if data.conditions then for conditionNumber, condition in ipairs(data.conditions) do ret = CreateActivateCondition(ret, data.id, condition, conditionNumber, properties, debug) end end -- Last apply changes to region - for property, _ in pairs(usedProperties) do + for property, _ in pairs(usedProperties) do ret = ret .. " if(propertyChanges['" .. property .. "'] ~= nil) then\n" - local arg1 = ""; - if (properties[property].arg1) then - if (type(properties[property].arg1) == "number") then - arg1 = tostring(properties[property].arg1) .. ", "; + local arg1 = "" + if properties[property].arg1 then + if type(properties[property].arg1) == "number" then + arg1 = tostring(properties[property].arg1) .. ", " else - arg1 = "'" .. properties[property].arg1 .. "', "; + arg1 = "'" .. properties[property].arg1 .. "', " end end @@ -689,62 +743,63 @@ local function ConstructConditionFunction(data) base = "region.subRegions[" .. subIndex .. "]:" end - ret = ret .. " " .. base .. properties[property].setter .. "(" .. arg1 .. formatValueForCall(properties[property].type, property) .. ")\n"; - if (debug) then ret = ret .. " print('Calling " .. properties[property].setter .. " with', " .. arg1 .. formatValueForCall(properties[property].type, property) .. ")\n"; end - ret = ret .. " end\n"; + ret = ret .. " " .. base .. properties[property].setter .. "(" .. arg1 .. formatValueForCall(properties[property].type, property) .. ")\n" + if debug then + ret = ret .. " print('Calling " .. properties[property].setter .. " with', " .. arg1 .. formatValueForCall(properties[property].type, property) .. ")\n" + end + ret = ret .. " end\n" end - ret = ret .. "end\n"; + ret = ret .. "end\n" - return ret; + return ret end local function CancelTimers(uid) - conditionChecksTimers.recheckTime[uid] = nil; - if (conditionChecksTimers.recheckHandle[uid]) then + conditionChecksTimers.recheckTime[uid] = nil + if conditionChecksTimers.recheckHandle[uid] then for _, v in pairs(conditionChecksTimers.recheckHandle[uid]) do - timer:CancelTimer(v); + timer:CancelTimer(v) end end - conditionChecksTimers.recheckHandle[uid] = nil; + conditionChecksTimers.recheckHandle[uid] = nil end function Private.LoadConditionFunction(data) CancelTimers(data.uid) - local checkConditionsFuncStr = ConstructConditionFunction(data); - local checkCondtionsFunc = checkConditionsFuncStr and WeakAuras.LoadFunction(checkConditionsFuncStr); + local checkConditionsFuncStr = ConstructConditionFunction(data) + local checkCondtionsFunc = checkConditionsFuncStr and WeakAuras.LoadFunction(checkConditionsFuncStr) - checkConditions[data.uid] = checkCondtionsFunc; + checkConditions[data.uid] = checkCondtionsFunc end function Private.RunConditions(region, uid, hideRegion) - if (checkConditions[uid]) then + if checkConditions[uid] then Private.ActivateAuraEnvironmentForRegion(region) - checkConditions[uid](region, hideRegion); + checkConditions[uid](region, hideRegion) Private.ActivateAuraEnvironment() end end - -local dynamicConditionsFrame = nil; +local dynamicConditionsFrame = nil local globalConditionAllState = { [""] = { - show = true; - } -}; + show = true, + }, +} -local globalConditionState = globalConditionAllState[""]; +local globalConditionState = globalConditionAllState[""] function Private.GetGlobalConditionState() - return globalConditionAllState; + return globalConditionAllState end local function runDynamicConditionFunctions(funcs) for uid in pairs(funcs) do local id = Private.UIDtoID(uid) Private.StartProfileAura(id) - if (Private.IsAuraActive(uid) and checkConditions[uid]) then + if Private.IsAuraActive(uid) and checkConditions[uid] then local activeStates = WeakAuras.GetActiveStates(id) for cloneId, state in pairs(activeStates) do local region = WeakAuras.GetRegion(id, cloneId) @@ -759,13 +814,13 @@ end local function handleDynamicConditions(self, event) Private.StartProfileSystem("dynamic conditions") - if (globalDynamicConditionFuncs[event]) then + if globalDynamicConditionFuncs[event] then for i, func in ipairs(globalDynamicConditionFuncs[event]) do - func(globalConditionState); + func(globalConditionState) end end - if (dynamicConditions[event]) then - runDynamicConditionFunctions(dynamicConditions[event]); + if dynamicConditions[event] then + runDynamicConditionFunctions(dynamicConditions[event]) end Private.StopProfileSystem("dynamic conditions") end @@ -773,113 +828,113 @@ end local function handleDynamicConditionsPerUnit(self, event, unit) Private.StartProfileSystem("dynamic conditions") if unit then - local unitEvent = event..":"..unit + local unitEvent = event .. ":" .. unit if globalDynamicConditionFuncs[unitEvent] then for i, func in ipairs(globalDynamicConditionFuncs[unitEvent]) do - func(globalConditionState); + func(globalConditionState) end end - if (dynamicConditions[unitEvent]) then - runDynamicConditionFunctions(dynamicConditions[unitEvent]); + if dynamicConditions[unitEvent] then + runDynamicConditionFunctions(dynamicConditions[unitEvent]) end end Private.StopProfileSystem("dynamic conditions") end -local lastDynamicConditionsUpdateCheck; +local lastDynamicConditionsUpdateCheck local function handleDynamicConditionsOnUpdate(self) - handleDynamicConditions(self, "FRAME_UPDATE"); - if (not lastDynamicConditionsUpdateCheck or GetTime() - lastDynamicConditionsUpdateCheck > 0.2) then - lastDynamicConditionsUpdateCheck = GetTime(); - handleDynamicConditions(self, "WA_SPELL_RANGECHECK"); + handleDynamicConditions(self, "FRAME_UPDATE") + if not lastDynamicConditionsUpdateCheck or GetTime() - lastDynamicConditionsUpdateCheck > 0.2 then + lastDynamicConditionsUpdateCheck = GetTime() + handleDynamicConditions(self, "WA_SPELL_RANGECHECK") end end -local registeredGlobalFunctions = {}; +local registeredGlobalFunctions = {} local function EvaluateCheckForRegisterForGlobalConditions(uid, check, allConditionsTemplate, register) - local trigger = check and check.trigger; - local variable = check and check.variable; + local trigger = check and check.trigger + local variable = check and check.variable - if (trigger == -2) then - if (check.checks) then + if trigger == -2 then + if check.checks then for _, subcheck in ipairs(check.checks) do - EvaluateCheckForRegisterForGlobalConditions(uid, subcheck, allConditionsTemplate, register); + EvaluateCheckForRegisterForGlobalConditions(uid, subcheck, allConditionsTemplate, register) end end elseif trigger == -1 and variable == "customcheck" then if check.op then for event in string.gmatch(check.op, "[%w_:]+") do - if (not dynamicConditions[event]) then - register[event] = true; - dynamicConditions[event] = {}; + if not dynamicConditions[event] then + register[event] = true + dynamicConditions[event] = {} end - dynamicConditions[event][uid] = true; + dynamicConditions[event][uid] = true end end - elseif (trigger and variable) then - local conditionTemplate = allConditionsTemplate[trigger] and allConditionsTemplate[trigger][variable]; - if (conditionTemplate and conditionTemplate.events) then + elseif trigger and variable then + local conditionTemplate = allConditionsTemplate[trigger] and allConditionsTemplate[trigger][variable] + if conditionTemplate and conditionTemplate.events then for _, event in ipairs(conditionTemplate.events) do - if (not dynamicConditions[event]) then - register[event] = true; - dynamicConditions[event] = {}; + if not dynamicConditions[event] then + register[event] = true + dynamicConditions[event] = {} end - dynamicConditions[event][uid] = true; + dynamicConditions[event][uid] = true end - if (conditionTemplate.globalStateUpdate and not registeredGlobalFunctions[variable]) then - registeredGlobalFunctions[variable] = true; + if conditionTemplate.globalStateUpdate and not registeredGlobalFunctions[variable] then + registeredGlobalFunctions[variable] = true for _, event in ipairs(conditionTemplate.events) do - globalDynamicConditionFuncs[event] = globalDynamicConditionFuncs[event] or {}; - tinsert(globalDynamicConditionFuncs[event], conditionTemplate.globalStateUpdate); + globalDynamicConditionFuncs[event] = globalDynamicConditionFuncs[event] or {} + tinsert(globalDynamicConditionFuncs[event], conditionTemplate.globalStateUpdate) end - conditionTemplate.globalStateUpdate(globalConditionState); + conditionTemplate.globalStateUpdate(globalConditionState) end end end end function Private.RegisterForGlobalConditions(uid) - local data = Private.GetDataByUID(uid); + local data = Private.GetDataByUID(uid) for event, conditionFunctions in pairs(dynamicConditions) do - conditionFunctions[uid] = nil; + conditionFunctions[uid] = nil end - local register = {}; - if (data.conditions) then - local allConditionsTemplate = Private.GetTriggerConditions(data); - allConditionsTemplate[-1] = Private.GetGlobalConditions(); + local register = {} + if data.conditions then + local allConditionsTemplate = Private.GetTriggerConditions(data) + allConditionsTemplate[-1] = Private.GetGlobalConditions() for conditionNumber, condition in ipairs(data.conditions) do - EvaluateCheckForRegisterForGlobalConditions(uid, condition.check, allConditionsTemplate, register); + EvaluateCheckForRegisterForGlobalConditions(uid, condition.check, allConditionsTemplate, register) end end - if (next(register) and not dynamicConditionsFrame) then - dynamicConditionsFrame = CreateFrame("Frame"); - dynamicConditionsFrame:SetScript("OnEvent", handleDynamicConditions); + if next(register) and not dynamicConditionsFrame then + dynamicConditionsFrame = CreateFrame("Frame") + dynamicConditionsFrame:SetScript("OnEvent", handleDynamicConditions) dynamicConditionsFrame.units = {} WeakAuras.frames["Rerun Conditions Frame"] = dynamicConditionsFrame end for event in pairs(register) do - if (event == "FRAME_UPDATE" or event == "WA_SPELL_RANGECHECK") then - if (not dynamicConditionsFrame.onUpdate) then - dynamicConditionsFrame:SetScript("OnUpdate", handleDynamicConditionsOnUpdate); - dynamicConditionsFrame.onUpdate = true; + if event == "FRAME_UPDATE" or event == "WA_SPELL_RANGECHECK" then + if not dynamicConditionsFrame.onUpdate then + dynamicConditionsFrame:SetScript("OnUpdate", handleDynamicConditionsOnUpdate) + dynamicConditionsFrame.onUpdate = true end else local unitEvent, unit = event:match("([^:]+):([^:]+)") if unitEvent and unit then unit = unit:lower() if not dynamicConditionsFrame.units[unit] then - dynamicConditionsFrame.units[unit] = CreateFrame("Frame"); - dynamicConditionsFrame.units[unit]:SetScript("OnEvent", handleDynamicConditionsPerUnit); + dynamicConditionsFrame.units[unit] = CreateFrame("Frame") + dynamicConditionsFrame.units[unit]:SetScript("OnEvent", handleDynamicConditionsPerUnit) end - pcall(dynamicConditionsFrame.units[unit].RegisterUnitEvent, dynamicConditionsFrame.units[unit], unitEvent, unit); + pcall(dynamicConditionsFrame.units[unit].RegisterUnitEvent, dynamicConditionsFrame.units[unit], unitEvent, unit) else - pcall(dynamicConditionsFrame.RegisterEvent, dynamicConditionsFrame, event); + pcall(dynamicConditionsFrame.RegisterEvent, dynamicConditionsFrame, event) end end end @@ -887,21 +942,19 @@ end function Private.UnregisterForGlobalConditions(uid) for event, condFuncs in pairs(dynamicConditions) do - condFuncs[uid] = nil; + condFuncs[uid] = nil if next(condFuncs) == nil then local unitEvent, unit = event:match("([^:]+):([^:]+)") if unitEvent and unit then unit = unit:lower() - pcall(dynamicConditionsFrame.units[unit].UnregisterEvent, dynamicConditionsFrame.units[unit], unitEvent); - elseif (event == "FRAME_UPDATE" or event == "WA_SPELL_RANGECHECK") then - if (event == "FRAME_UPDATE" and dynamicConditions["WA_SPELL_RANGECHECK"] == nil) - or (event == "WA_SPELL_RANGECHECK" and dynamicConditions["FRAME_UPDATE"] == nil) - then + pcall(dynamicConditionsFrame.units[unit].UnregisterEvent, dynamicConditionsFrame.units[unit], unitEvent) + elseif event == "FRAME_UPDATE" or event == "WA_SPELL_RANGECHECK" then + if (event == "FRAME_UPDATE" and dynamicConditions["WA_SPELL_RANGECHECK"] == nil) or (event == "WA_SPELL_RANGECHECK" and dynamicConditions["FRAME_UPDATE"] == nil) then dynamicConditionsFrame:SetScript("OnUpdate", nil) dynamicConditionsFrame.onUpdate = false end else - pcall(dynamicConditionsFrame.UnregisterEvent, dynamicConditionsFrame, event); + pcall(dynamicConditionsFrame.UnregisterEvent, dynamicConditionsFrame, event) end dynamicConditions[event] = nil end @@ -910,7 +963,7 @@ end function Private.UnloadAllConditions() for uid in pairs(conditionChecksTimers.recheckTime) do - if (conditionChecksTimers.recheckHandle[uid]) then + if conditionChecksTimers.recheckHandle[uid] then for _, v in pairs(conditionChecksTimers.recheckHandle[uid]) do timer:CancelTimer(v) end @@ -932,5 +985,5 @@ end function Private.UnloadConditions(uid) CancelTimers(uid) - Private.UnregisterForGlobalConditions(uid); + Private.UnregisterForGlobalConditions(uid) end diff --git a/WeakAuras/DebugLog.lua b/WeakAuras/DebugLog.lua index e1e00776b7..8d758a0b24 100644 --- a/WeakAuras/DebugLog.lua +++ b/WeakAuras/DebugLog.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, Private = ... local WeakAuras = WeakAuras @@ -44,12 +46,12 @@ function Private.DebugLog.Print(uid, text, ...) if enabled[uid] then local log = debugLogs[uid] tinsert(log, "") - if select('#', ...) == 0 then + if select("#", ...) == 0 then serialize(log, text) else serialize(log, text) - local texts = {...} - for i = 1, select('#', ...) do + local texts = { ... } + for i = 1, select("#", ...) do local v = select(i, ...) serialize(log, v) end @@ -68,7 +70,7 @@ end function Private.DebugLog.Clear(uid) if enabled[uid] then debugLogs[uid] = { - AddMessage = AddMessage + AddMessage = AddMessage, } -- Dance to clear a potential console message from the AuraWarnings Private.AuraWarnings.UpdateWarning(uid, "Debug Log", "info") @@ -83,7 +85,7 @@ function Private.DebugLog.SetEnabled(uid, enable) enabled[uid] = enable if enable then debugLogs[uid] = { - AddMessage = AddMessage + AddMessage = AddMessage, } Private.AuraWarnings.UpdateWarning(uid, "Debug Log", "info", L["Debug Logging enabled"]) else @@ -108,5 +110,3 @@ local function OnDelete(_, uid) end Private.callbacks:RegisterCallback("Delete", OnDelete) - - diff --git a/WeakAuras/GenericTrigger.lua b/WeakAuras/GenericTrigger.lua index e2fdba645f..e4e70a0711 100644 --- a/WeakAuras/GenericTrigger.lua +++ b/WeakAuras/GenericTrigger.lua @@ -48,47 +48,53 @@ Returns the a tooltip for the additional properties. GetTriggerConditions(data, triggernum) Returns potential conditions that this trigger provides. -]]-- -if not WeakAuras.IsLibsOK() then return end +]] +-- +if not WeakAuras.IsLibsOK() then + return +end local AddonName, Private = ... -- Lua APIs local tinsert, tconcat, wipe = table.insert, table.concat, wipe local tostring, pairs, type = tostring, pairs, type local error, setmetatable = error, setmetatable -local CombatLogGetCurrentEventInfo = CombatLogGetCurrentEventInfo; +local CombatLogGetCurrentEventInfo = CombatLogGetCurrentEventInfo -- WoW APIs local IsPlayerMoving = IsPlayerMoving -WeakAurasAceEvents = setmetatable({}, {__tostring=function() return "WeakAuras" end}); -LibStub("AceEvent-3.0"):Embed(WeakAurasAceEvents); +WeakAurasAceEvents = setmetatable({}, { + __tostring = function() + return "WeakAuras" + end, +}) +LibStub("AceEvent-3.0"):Embed(WeakAurasAceEvents) local aceEvents = WeakAurasAceEvents -local WeakAuras = WeakAuras; -local L = WeakAuras.L; -local GenericTrigger = {}; +local WeakAuras = WeakAuras +local L = WeakAuras.L +local GenericTrigger = {} local LCSA if WeakAuras.IsClassic() then LCSA = LibStub("LibClassicSpellActionCount-1.0") end -local event_prototypes = Private.event_prototypes; +local event_prototypes = Private.event_prototypes -local timer = WeakAuras.timer; +local timer = WeakAuras.timer local events = {} local loaded_events = {} -local loaded_unit_events = {}; +local loaded_unit_events = {} local watched_trigger_events = Private.watched_trigger_events -local loaded_auras = {}; -- id to bool map -local timers = WeakAuras.timers; +local loaded_auras = {} -- id to bool map +local timers = WeakAuras.timers -- Local functions local LoadEvent, HandleEvent, HandleUnitEvent, TestForTriState, TestForToggle, TestForLongString, TestForMultiSelect local ConstructTest, ConstructFunction - local nameplateExists = {} function WeakAuras.UnitExistsFixed(unit, smart) @@ -104,135 +110,141 @@ function WeakAuras.UnitExistsFixed(unit, smart) end function WeakAuras.split(input) - input = input or ""; - local ret = {}; - local split, element = true; - split = input:find("[,%s]"); - while(split) do - element, input = input:sub(1, split-1), input:sub(split+1); - if(element ~= "") then - tinsert(ret, element); + input = input or "" + local ret = {} + local split, element = true + split = input:find("[,%s]") + while split do + element, input = input:sub(1, split - 1), input:sub(split + 1) + if element ~= "" then + tinsert(ret, element) end - split = input:find("[,%s]"); + split = input:find("[,%s]") end - if(input ~= "") then - tinsert(ret, input); + if input ~= "" then + tinsert(ret, input) end - return ret; + return ret end function TestForTriState(trigger, arg) - local name = arg.name; - local test; - if(trigger["use_"..name] == false) then - test = "(not "..name..")"; - elseif(trigger["use_"..name]) then - if(arg.test) then - test = "("..arg.test:format(trigger[name])..")"; + local name = arg.name + local test + if trigger["use_" .. name] == false then + test = "(not " .. name .. ")" + elseif trigger["use_" .. name] then + if arg.test then + test = "(" .. arg.test:format(trigger[name]) .. ")" else - test = name; + test = name end end - return test; + return test end function TestForToggle(trigger, arg) - local name = arg.name; - local test; - if(trigger["use_"..name]) then - if(arg.test) then - test = "("..arg.test:format(trigger[name])..")"; + local name = arg.name + local test + if trigger["use_" .. name] then + if arg.test then + test = "(" .. arg.test:format(trigger[name]) .. ")" else - test = name; + test = name end end - return test; + return test end function TestForLongString(trigger, arg) - local name = arg.name; - local test; + local name = arg.name + local test local needle = trigger[name] - if(trigger[name.."_operator"] == "==") then + if trigger[name .. "_operator"] == "==" then test = ("(%s == %s)"):format(name, Private.QuotedString(needle)) - elseif(trigger[name.."_operator"] == "find('%s')") then + elseif trigger[name .. "_operator"] == "find('%s')" then test = "(" .. name .. " and " .. name .. string.format(":find(%s, 1, true)", Private.QuotedString(needle)) .. ")" - elseif(trigger[name.."_operator"] == "match('%s')") then + elseif trigger[name .. "_operator"] == "match('%s')" then test = "(" .. name .. " and " .. name .. string.format(":match(%s)", Private.QuotedString(needle)) .. ")" end - return test; + return test end function TestForMultiSelect(trigger, arg) - local name = arg.name; - local test; - if(trigger["use_"..name] == false) then -- multi selection - test = "("; - local any = false; + local name = arg.name + local test + if trigger["use_" .. name] == false then -- multi selection + test = "(" + local any = false if trigger[name] and trigger[name].multi then for value, _ in pairs(trigger[name].multi) do if not arg.test then - test = test..name.."=="..(tonumber(value) or ("[["..value.."]]")).." or "; + test = test .. name .. "==" .. (tonumber(value) or ("[[" .. value .. "]]")) .. " or " else - test = test..arg.test:format(tonumber(value) or ("[["..value.."]]")).." or "; + test = test .. arg.test:format(tonumber(value) or ("[[" .. value .. "]]")) .. " or " end - any = true; + any = true end end - if(any) then - test = test:sub(1, -5); + if any then + test = test:sub(1, -5) else - test = "(false"; + test = "(false" end - test = test..")"; - elseif(trigger["use_"..name]) then -- single selection - local value = trigger[name] and trigger[name].single; - if (not value) then - test = "false"; - return test; + test = test .. ")" + elseif trigger["use_" .. name] then -- single selection + local value = trigger[name] and trigger[name].single + if not value then + test = "false" + return test end if not arg.test then - test = trigger[name].single and "("..name.."=="..(tonumber(value) or ("[["..value.."]]"))..")"; + test = trigger[name].single and "(" .. name .. "==" .. (tonumber(value) or ("[[" .. value .. "]]")) .. ")" else - test = trigger[name].single and "("..arg.test:format(tonumber(value) or ("[["..value.."]]"))..")"; + test = trigger[name].single and "(" .. arg.test:format(tonumber(value) or ("[[" .. value .. "]]")) .. ")" end end - return test; + return test end function ConstructTest(trigger, arg) local test local preamble - local name = arg.name; - if(arg.hidden or arg.type == "tristate" or arg.type == "toggle" or (arg.type == "multiselect" and trigger["use_"..name] ~= nil) or ((trigger["use_"..name] or arg.required) and trigger[name])) then - local number = tonumber(trigger[name]); - if(arg.type == "tristate") then - test = TestForTriState(trigger, arg); - elseif(arg.type == "multiselect") then - test = TestForMultiSelect(trigger, arg); - elseif(arg.type == "toggle") then - test = TestForToggle(trigger, arg); - elseif (arg.type == "spell") then + local name = arg.name + if + arg.hidden + or arg.type == "tristate" + or arg.type == "toggle" + or (arg.type == "multiselect" and trigger["use_" .. name] ~= nil) + or ((trigger["use_" .. name] or arg.required) and trigger[name]) + then + local number = tonumber(trigger[name]) + if arg.type == "tristate" then + test = TestForTriState(trigger, arg) + elseif arg.type == "multiselect" then + test = TestForMultiSelect(trigger, arg) + elseif arg.type == "toggle" then + test = TestForToggle(trigger, arg) + elseif arg.type == "spell" then if arg.test then if arg.showExactOption then - test = "("..arg.test:format(trigger[name], tostring(trigger["use_exact_" .. name]) or "false") ..")"; + test = "(" .. arg.test:format(trigger[name], tostring(trigger["use_exact_" .. name]) or "false") .. ")" else - test = "("..arg.test:format(trigger[name])..")"; + test = "(" .. arg.test:format(trigger[name]) .. ")" end else - test = "(".. name .." and "..name.."==" ..(number or ("\""..(trigger[name] or "").."\""))..")"; - end - elseif(arg.test) then - test = "("..arg.test:format(tostring(trigger[name]) or "")..")"; - elseif(arg.type == "longstring" and trigger[name.."_operator"]) then - test = TestForLongString(trigger, arg); - elseif (arg.type == "string" or arg.type == "select" or arg.type == "item") then - test = "(".. name .." and "..name.."==" ..(number or ("\""..(trigger[name] or "").."\""))..")"; - elseif (arg.type == "number") then - test = "(".. name .." and "..name..(trigger[name.."_operator"] or "==")..(number or 0) ..")"; + test = "(" .. name .. " and " .. name .. "==" .. (number or ("\"" .. (trigger[name] or "") .. "\"")) .. ")" + end + elseif arg.test then + test = "(" .. arg.test:format(tostring(trigger[name]) or "") .. ")" + elseif arg.type == "longstring" and trigger[name .. "_operator"] then + test = TestForLongString(trigger, arg) + elseif arg.type == "string" or arg.type == "select" or arg.type == "item" then + test = "(" .. name .. " and " .. name .. "==" .. (number or ("\"" .. (trigger[name] or "") .. "\"")) .. ")" + elseif arg.type == "number" then + test = "(" .. name .. " and " .. name .. (trigger[name .. "_operator"] or "==") .. (number or 0) .. ")" else -- Should be unused - test = "(".. name .." and "..name..(trigger[name.."_operator"] or "==")..(number or ("\""..(trigger[name] or 0).."\""))..")"; + test = "(" .. name .. " and " .. name .. (trigger[name .. "_operator"] or "==") .. (number or ("\"" .. (trigger[name] or 0) .. "\"")) .. ")" end end @@ -240,7 +252,7 @@ function ConstructTest(trigger, arg) preamble = arg.preamble:format(trigger[name] or "") end - if (test == "(true)") then + if test == "(true)" then return nil, preamble end @@ -248,79 +260,79 @@ function ConstructTest(trigger, arg) end function ConstructFunction(prototype, trigger) - if (prototype.triggerFunction) then - return prototype.triggerFunction(trigger); + if prototype.triggerFunction then + return prototype.triggerFunction(trigger) end - local input; - if (prototype.statesParameter) then - input = {"state", "event"}; + local input + if prototype.statesParameter then + input = { "state", "event" } else - input = {"event"}; + input = { "event" } end - local required = {}; - local tests = {}; - local debug = {}; - local store = {}; - local init; + local required = {} + local tests = {} + local debug = {} + local store = {} + local init local preambles = "\n" - if(prototype.init) then - init = prototype.init(trigger); + if prototype.init then + init = prototype.init(trigger) else - init = ""; + init = "" end for index, arg in pairs(prototype.args) do - local enable = arg.type ~= "description"; - if(type(arg.enable) == "function") then - enable = arg.enable(trigger); + local enable = arg.type ~= "description" + if type(arg.enable) == "function" then + enable = arg.enable(trigger) elseif type(arg.enable) == "boolean" then enable = arg.enable end - if(enable) then - local name = arg.name; - if not(arg.name or arg.hidden) then - tinsert(input, "_"); + if enable then + local name = arg.name + if not (arg.name or arg.hidden) then + tinsert(input, "_") else - if(arg.init == "arg") then - tinsert(input, name); - elseif(arg.init) then - init = init.."local "..name.." = "..arg.init.."\n"; + if arg.init == "arg" then + tinsert(input, name) + elseif arg.init then + init = init .. "local " .. name .. " = " .. arg.init .. "\n" end - if (arg.store) then - tinsert(store, name); + if arg.store then + tinsert(store, name) end - local test, preamble = ConstructTest(trigger, arg); - if (test) then - if(arg.required) then - tinsert(required, test); + local test, preamble = ConstructTest(trigger, arg) + if test then + if arg.required then + tinsert(required, test) else - tinsert(tests, test); + tinsert(tests, test) end - if(arg.debug) then - tinsert(debug, arg.debug:format(trigger[name])); + if arg.debug then + tinsert(debug, arg.debug:format(trigger[name])) end end - if (preamble) then + if preamble then preambles = preambles .. preamble .. "\n" end end end end - local ret = preambles .. "return function("..tconcat(input, ", ")..")\n"; - ret = ret..(init or ""); + local ret = preambles .. "return function(" .. tconcat(input, ", ") .. ")\n" + ret = ret .. (init or "") - ret = ret..(#debug > 0 and tconcat(debug, "\n") or ""); + ret = ret .. (#debug > 0 and tconcat(debug, "\n") or "") - ret = ret.."if("; - ret = ret..((#required > 0) and tconcat(required, " and ").." and " or ""); - ret = ret..(#tests > 0 and tconcat(tests, " and ") or "true"); - ret = ret..") then\n"; - if(#debug > 0) then - ret = ret.."print('ret: true');\n"; + ret = ret .. "if(" + ret = ret .. ((#required > 0) and tconcat(required, " and ") .. " and " or "") + ret = ret .. (#tests > 0 and tconcat(tests, " and ") or "true") + ret = ret .. ") then\n" + if #debug > 0 then + ret = ret .. "print('ret: true');\n" end - if (prototype.statesParameter == "all") then + if prototype.statesParameter == "all" then ret = ret .. " state[cloneId] = state[cloneId] or {}\n" ret = ret .. " state = state[cloneId]\n" ret = ret .. " state.changed = true\n" @@ -332,70 +344,69 @@ function ConstructFunction(prototype, trigger) ret = ret .. " state.changed = true\n" ret = ret .. " end\n" end - ret = ret.."return true else return false end end"; + ret = ret .. "return true else return false end end" - return ret; + return ret end function Private.EndEvent(id, triggernum, force, state) if state then - if (state.show ~= false and state.show ~= nil) then - state.show = false; - state.changed = true; + if state.show ~= false and state.show ~= nil then + state.show = false + state.changed = true end - return state.changed; + return state.changed else return false end end local function RunOverlayFuncs(event, state, id, errorHandler) - state.additionalProgress = state.additionalProgress or {}; - local changed = false; + state.additionalProgress = state.additionalProgress or {} + local changed = false for i, overlayFunc in ipairs(event.overlayFuncs) do - state.additionalProgress[i] = state.additionalProgress[i] or {}; - local additionalProgress = state.additionalProgress[i]; - local ok, a, b, c = xpcall(overlayFunc, errorHandler or Private.GetErrorHandlerId(id, L["Overlay %s"]:format(i)), event.trigger, state); - if (not ok) then - additionalProgress.min = nil; - additionalProgress.max = nil; - additionalProgress.direction = nil; - additionalProgress.width = nil; - additionalProgress.offset = nil; - elseif (type(a) == "string") then - if (additionalProgress.direction ~= a) then - additionalProgress.direction = a; - changed = true; - end - if (additionalProgress.width ~= b) then - additionalProgress.width = b; - changed = true; - end - if (additionalProgress.offset ~= c) then - additionalProgress.offset = c; - changed = true; - end - additionalProgress.min = nil; - additionalProgress.max = nil; + state.additionalProgress[i] = state.additionalProgress[i] or {} + local additionalProgress = state.additionalProgress[i] + local ok, a, b, c = xpcall(overlayFunc, errorHandler or Private.GetErrorHandlerId(id, L["Overlay %s"]:format(i)), event.trigger, state) + if not ok then + additionalProgress.min = nil + additionalProgress.max = nil + additionalProgress.direction = nil + additionalProgress.width = nil + additionalProgress.offset = nil + elseif type(a) == "string" then + if additionalProgress.direction ~= a then + additionalProgress.direction = a + changed = true + end + if additionalProgress.width ~= b then + additionalProgress.width = b + changed = true + end + if additionalProgress.offset ~= c then + additionalProgress.offset = c + changed = true + end + additionalProgress.min = nil + additionalProgress.max = nil else - if (additionalProgress.min ~= a) then - additionalProgress.min = a; - changed = true; + if additionalProgress.min ~= a then + additionalProgress.min = a + changed = true end - if (additionalProgress.max ~= b) then - additionalProgress.max = b; - changed = true; + if additionalProgress.max ~= b then + additionalProgress.max = b + changed = true end if additionalProgress.direction then changed = true end - additionalProgress.direction = nil; - additionalProgress.width = nil; - additionalProgress.offset = nil; + additionalProgress.direction = nil + additionalProgress.width = nil + additionalProgress.offset = nil end - end - state.changed = changed or state.changed; + state.changed = changed or state.changed end local function callFunctionForActivateEvent(func, trigger, fallback, errorHandler) @@ -407,93 +418,93 @@ local function callFunctionForActivateEvent(func, trigger, fallback, errorHandle end function Private.ActivateEvent(id, triggernum, data, state, errorHandler) - local changed = state.changed or false; - if (state.show ~= true) then - state.show = true; - changed = true; + local changed = state.changed or false + if state.show ~= true then + state.show = true + changed = true end - if (data.duration) then - local expirationTime = GetTime() + data.duration; - if (state.expirationTime ~= expirationTime) then - state.expirationTime = expirationTime; - changed = true; + if data.duration then + local expirationTime = GetTime() + data.duration + if state.expirationTime ~= expirationTime then + state.expirationTime = expirationTime + changed = true end - if (state.duration ~= data.duration) then - state.duration = data.duration; - changed = true; + if state.duration ~= data.duration then + state.duration = data.duration + changed = true end - if (state.progressType ~= "timed") then - state.progressType = "timed"; - changed = true; + if state.progressType ~= "timed" then + state.progressType = "timed" + changed = true end - local autoHide = data.automaticAutoHide; - if (state.value or state.total or state.inverse or state.autoHide ~= autoHide) then - changed = true; + local autoHide = data.automaticAutoHide + if state.value or state.total or state.inverse or state.autoHide ~= autoHide then + changed = true end - state.value = nil; - state.total = nil; - state.inverse = nil; - state.autoHide = autoHide; - elseif (data.durationFunc) then - local ok, arg1, arg2, arg3, inverse = xpcall(data.durationFunc, errorHandler or Private.GetErrorHandlerId(id, L["Duration Function"]), data.trigger); - arg1 = ok and type(arg1) == "number" and arg1 or 0; - arg2 = ok and type(arg2) == "number" and arg2 or 0; - - if (state.inverse ~= inverse) then - state.inverse = inverse; - changed = true; + state.value = nil + state.total = nil + state.inverse = nil + state.autoHide = autoHide + elseif data.durationFunc then + local ok, arg1, arg2, arg3, inverse = xpcall(data.durationFunc, errorHandler or Private.GetErrorHandlerId(id, L["Duration Function"]), data.trigger) + arg1 = ok and type(arg1) == "number" and arg1 or 0 + arg2 = ok and type(arg2) == "number" and arg2 or 0 + + if state.inverse ~= inverse then + state.inverse = inverse + changed = true end - if (arg3) then - if (state.progressType ~= "static") then - state.progressType = "static"; - changed = true; + if arg3 then + if state.progressType ~= "static" then + state.progressType = "static" + changed = true end - if (state.duration) then - state.duration = nil; - changed = true; + if state.duration then + state.duration = nil + changed = true end - if (state.expirationTime) then - state.expirationTime = nil; - changed = true; + if state.expirationTime then + state.expirationTime = nil + changed = true end - local autoHide = nil; - if (state.autoHide ~= autoHide) then - changed = true; - state.autoHide = autoHide; + local autoHide = nil + if state.autoHide ~= autoHide then + changed = true + state.autoHide = autoHide end - if (state.value ~= arg1) then - state.value = arg1; - changed = true; + if state.value ~= arg1 then + state.value = arg1 + changed = true end - if (state.total ~= arg2) then - state.total = arg2; - changed = true; + if state.total ~= arg2 then + state.total = arg2 + changed = true end else - if (state.progressType ~= "timed") then - state.progressType = "timed"; - changed = true; + if state.progressType ~= "timed" then + state.progressType = "timed" + changed = true end - if (state.duration ~= arg1) then - state.duration = arg1; + if state.duration ~= arg1 then + state.duration = arg1 end - if (state.expirationTime ~= arg2) then - state.expirationTime = arg2; - changed = true; + if state.expirationTime ~= arg2 then + state.expirationTime = arg2 + changed = true end - local autoHide = data.automaticAutoHide and arg1 > 0.01; - if (state.autoHide ~= autoHide) then - changed = true; - state.autoHide = autoHide; + local autoHide = data.automaticAutoHide and arg1 > 0.01 + if state.autoHide ~= autoHide then + changed = true + state.autoHide = autoHide end - if (state.value or state.total) then - changed = true; + if state.value or state.total then + changed = true end - state.value = nil; - state.total = nil; + state.value = nil + state.total = nil end end @@ -502,74 +513,72 @@ function Private.ActivateEvent(id, triggernum, data, state, errorHandler) local texture = callFunctionForActivateEvent(data.textureFunc, data.trigger, state.texture, errorHandler or Private.GetErrorHandlerId(id, L["Texture Function"])) local stacks = callFunctionForActivateEvent(data.stacksFunc, data.trigger, state.stacks, errorHandler or Private.GetErrorHandlerId(id, L["Stacks Function"])) - if (state.name ~= name) then - state.name = name; - changed = true; + if state.name ~= name then + state.name = name + changed = true end - if (state.icon ~= icon) then - state.icon = icon; - changed = true; + if state.icon ~= icon then + state.icon = icon + changed = true end - if (state.texture ~= texture) then - state.texture = texture; - changed = true; + if state.texture ~= texture then + state.texture = texture + changed = true end - if (state.stacks ~= stacks) then - state.stacks = stacks; - changed = true; + if state.stacks ~= stacks then + state.stacks = stacks + changed = true end - if (data.overlayFuncs) then - RunOverlayFuncs(data, state, id, errorHandler); + if data.overlayFuncs then + RunOverlayFuncs(data, state, id, errorHandler) else - state.additionalProgress = nil; + state.additionalProgress = nil end - state.changed = state.changed or changed; + state.changed = state.changed or changed - return state.changed; + return state.changed end -local function ignoreErrorHandler() - -end +local function ignoreErrorHandler() end local function RunTriggerFunc(allStates, data, id, triggernum, event, arg1, arg2, ...) - local optionsEvent = event == "OPTIONS"; + local optionsEvent = event == "OPTIONS" local errorHandler = (optionsEvent and data.ignoreOptionsEventErrors) and ignoreErrorHandler or Private.GetErrorHandlerId(id, L["Trigger %s"]:format(triggernum)) - local updateTriggerState = false; + local updateTriggerState = false local unitForUnitTrigger local cloneIdForUnitTrigger - if(data.triggerFunc) then - local untriggerCheck = false; - if (data.statesParameter == "full") then - local ok, returnValue = xpcall(data.triggerFunc, errorHandler, allStates, event, arg1, arg2, ...); - if (ok and returnValue) then - updateTriggerState = true; + if data.triggerFunc then + local untriggerCheck = false + if data.statesParameter == "full" then + local ok, returnValue = xpcall(data.triggerFunc, errorHandler, allStates, event, arg1, arg2, ...) + if ok and returnValue then + updateTriggerState = true end for key, state in pairs(allStates) do - if (type(state) ~= "table") then + if type(state) ~= "table" then errorHandler(string.format(L["All States table contains a non table at key: '%s'."], key)) wipe(allStates) return end end - elseif (data.statesParameter == "all") then - local ok, returnValue = xpcall(data.triggerFunc, errorHandler, allStates, event, arg1, arg2, ...); - if( (ok and returnValue) or optionsEvent) then + elseif data.statesParameter == "all" then + local ok, returnValue = xpcall(data.triggerFunc, errorHandler, allStates, event, arg1, arg2, ...) + if (ok and returnValue) or optionsEvent then for id, state in pairs(allStates) do - if (state.changed) then - if (Private.ActivateEvent(id, triggernum, data, state)) then - updateTriggerState = true; + if state.changed then + if Private.ActivateEvent(id, triggernum, data, state) then + updateTriggerState = true end end end else - untriggerCheck = true; + untriggerCheck = true end - elseif (data.statesParameter == "unit") then + elseif data.statesParameter == "unit" then if optionsEvent then if Private.multiUnitUnits[data.trigger.unit] then arg1 = next(Private.multiUnitUnits[data.trigger.unit]) @@ -585,50 +594,50 @@ local function RunTriggerFunc(allStates, data, id, triggernum, event, arg1, arg2 unitForUnitTrigger = data.trigger.unit cloneIdForUnitTrigger = "" end - allStates[cloneIdForUnitTrigger] = allStates[cloneIdForUnitTrigger] or {}; - local state = allStates[cloneIdForUnitTrigger]; - local ok, returnValue = xpcall(data.triggerFunc, errorHandler, state, event, unitForUnitTrigger, arg1, arg2, ...); + allStates[cloneIdForUnitTrigger] = allStates[cloneIdForUnitTrigger] or {} + local state = allStates[cloneIdForUnitTrigger] + local ok, returnValue = xpcall(data.triggerFunc, errorHandler, state, event, unitForUnitTrigger, arg1, arg2, ...) if (ok and returnValue) or optionsEvent then - if(Private.ActivateEvent(id, triggernum, data, state)) then - updateTriggerState = true; + if Private.ActivateEvent(id, triggernum, data, state) then + updateTriggerState = true end else - untriggerCheck = true; + untriggerCheck = true end end - elseif (data.statesParameter == "one") then - allStates[""] = allStates[""] or {}; - local state = allStates[""]; - local ok, returnValue = xpcall(data.triggerFunc, errorHandler, state, event, arg1, arg2, ...); + elseif data.statesParameter == "one" then + allStates[""] = allStates[""] or {} + local state = allStates[""] + local ok, returnValue = xpcall(data.triggerFunc, errorHandler, state, event, arg1, arg2, ...) if (ok and returnValue) or optionsEvent then - if(Private.ActivateEvent(id, triggernum, data, state, (optionsEvent and data.ignoreOptionsEventErrors) and ignoreErrorHandler or nil)) then - updateTriggerState = true; + if Private.ActivateEvent(id, triggernum, data, state, (optionsEvent and data.ignoreOptionsEventErrors) and ignoreErrorHandler or nil) then + updateTriggerState = true end else - untriggerCheck = true; + untriggerCheck = true end else - local ok, returnValue = xpcall(data.triggerFunc, errorHandler, event, arg1, arg2, ...); + local ok, returnValue = xpcall(data.triggerFunc, errorHandler, event, arg1, arg2, ...) if (ok and returnValue) or optionsEvent then - allStates[""] = allStates[""] or {}; - local state = allStates[""]; - if(Private.ActivateEvent(id, triggernum, data, state, (optionsEvent and data.ignoreOptionsEventErrors) and ignoreErrorHandler or nil)) then - updateTriggerState = true; + allStates[""] = allStates[""] or {} + local state = allStates[""] + if Private.ActivateEvent(id, triggernum, data, state, (optionsEvent and data.ignoreOptionsEventErrors) and ignoreErrorHandler or nil) then + updateTriggerState = true end else - untriggerCheck = true; + untriggerCheck = true end end - if (untriggerCheck and not optionsEvent) then + if untriggerCheck and not optionsEvent then errorHandler = (optionsEvent and data.ignoreOptionsEventErrors) and ignoreErrorHandler or Private.GetErrorHandlerId(id, L["Untrigger %s"]:format(triggernum)) - if (data.statesParameter == "all") then + if data.statesParameter == "all" then if data.untriggerFunc then - local ok, returnValue = xpcall(data.untriggerFunc, errorHandler, allStates, event, arg1, arg2, ...); + local ok, returnValue = xpcall(data.untriggerFunc, errorHandler, allStates, event, arg1, arg2, ...) if ok and returnValue then for id, state in pairs(allStates) do - if (state.changed) then - if (Private.EndEvent(id, triggernum, nil, state)) then - updateTriggerState = true; + if state.changed then + if Private.EndEvent(id, triggernum, nil, state) then + updateTriggerState = true end end end @@ -639,10 +648,10 @@ local function RunTriggerFunc(allStates, data, id, triggernum, event, arg1, arg2 if arg1 then local state = allStates[cloneIdForUnitTrigger] if state then - local ok, returnValue = xpcall(data.untriggerFunc, errorHandler, state, event, unitForUnitTrigger, arg2, ...); + local ok, returnValue = xpcall(data.untriggerFunc, errorHandler, state, event, unitForUnitTrigger, arg2, ...) if ok and returnValue then - if (Private.EndEvent(id, triggernum, nil, state)) then - updateTriggerState = true; + if Private.EndEvent(id, triggernum, nil, state) then + updateTriggerState = true end end end @@ -653,25 +662,25 @@ local function RunTriggerFunc(allStates, data, id, triggernum, event, arg1, arg2 -- so remove it again allStates[cloneIdForUnitTrigger] = nil end - elseif (data.statesParameter == "one") then - allStates[""] = allStates[""] or {}; - local state = allStates[""]; + elseif data.statesParameter == "one" then + allStates[""] = allStates[""] or {} + local state = allStates[""] if data.untriggerFunc then - local ok, returnValue = xpcall(data.untriggerFunc, errorHandler, state, event, arg1, arg2, ...); - if (ok and returnValue) then - if (Private.EndEvent(id, triggernum, nil, state)) then - updateTriggerState = true; + local ok, returnValue = xpcall(data.untriggerFunc, errorHandler, state, event, arg1, arg2, ...) + if ok and returnValue then + if Private.EndEvent(id, triggernum, nil, state) then + updateTriggerState = true end end end else if data.untriggerFunc then - local ok, returnValue = xpcall(data.untriggerFunc, errorHandler, event, arg1, arg2, ...); + local ok, returnValue = xpcall(data.untriggerFunc, errorHandler, event, arg1, arg2, ...) if ok and returnValue then - allStates[""] = allStates[""] or {}; - local state = allStates[""]; - if(Private.EndEvent(id, triggernum, nil, state)) then - updateTriggerState = true; + allStates[""] = allStates[""] or {} + local state = allStates[""] + if Private.EndEvent(id, triggernum, nil, state) then + updateTriggerState = true end end end @@ -682,37 +691,36 @@ local function RunTriggerFunc(allStates, data, id, triggernum, event, arg1, arg2 -- if this trigger's updates are requested to be sent into one of the Aura's custom triggers Private.AddToWatchedTriggerDelay(id, triggernum) end - return updateTriggerState; + return updateTriggerState end function WeakAuras.ScanEvents(event, arg1, arg2, ...) - local orgEvent = event; - Private.StartProfileSystem("generictrigger " .. orgEvent ) - local event_list = loaded_events[event]; - if (not event_list) then - Private.StopProfileSystem("generictrigger " .. orgEvent ) + local orgEvent = event + Private.StartProfileSystem("generictrigger " .. orgEvent) + local event_list = loaded_events[event] + if not event_list then + Private.StopProfileSystem("generictrigger " .. orgEvent) return end - if(event == "COMBAT_LOG_EVENT_UNFILTERED") then - local arg1, arg2 = CombatLogGetCurrentEventInfo(); + if event == "COMBAT_LOG_EVENT_UNFILTERED" then + local arg1, arg2 = CombatLogGetCurrentEventInfo() - event_list = event_list[arg2]; - if (not event_list) then - Private.StopProfileSystem("generictrigger " .. orgEvent ) - return; + event_list = event_list[arg2] + if not event_list then + Private.StopProfileSystem("generictrigger " .. orgEvent) + return end - WeakAuras.ScanEventsInternal(event_list, event, CombatLogGetCurrentEventInfo()); - - elseif (event == "COMBAT_LOG_EVENT_UNFILTERED_CUSTOM") then + WeakAuras.ScanEventsInternal(event_list, event, CombatLogGetCurrentEventInfo()) + elseif event == "COMBAT_LOG_EVENT_UNFILTERED_CUSTOM" then -- This reverts the COMBAT_LOG_EVENT_UNFILTERED_CUSTOM workaround so that custom triggers that check the event argument will work as expected - if(event == "COMBAT_LOG_EVENT_UNFILTERED_CUSTOM") then - event = "COMBAT_LOG_EVENT_UNFILTERED"; + if event == "COMBAT_LOG_EVENT_UNFILTERED_CUSTOM" then + event = "COMBAT_LOG_EVENT_UNFILTERED" end - WeakAuras.ScanEventsInternal(event_list, event, CombatLogGetCurrentEventInfo()); + WeakAuras.ScanEventsInternal(event_list, event, CombatLogGetCurrentEventInfo()) else - WeakAuras.ScanEventsInternal(event_list, event, arg1, arg2, ...); + WeakAuras.ScanEventsInternal(event_list, event, arg1, arg2, ...) end - Private.StopProfileSystem("generictrigger " .. orgEvent ) + Private.StopProfileSystem("generictrigger " .. orgEvent) end function WeakAuras.ScanUnitEvents(event, unit, ...) @@ -722,48 +730,48 @@ function WeakAuras.ScanUnitEvents(event, unit, ...) local event_list = unit_list[event] if event_list then for id, triggers in pairs(event_list) do - Private.StartProfileAura(id); - Private.ActivateAuraEnvironment(id); - local updateTriggerState = false; + Private.StartProfileAura(id) + Private.ActivateAuraEnvironment(id) + local updateTriggerState = false for triggernum, data in pairs(triggers) do - local allStates = WeakAuras.GetTriggerStateForTrigger(id, triggernum); - if (RunTriggerFunc(allStates, data, id, triggernum, event, unit, ...)) then - updateTriggerState = true; + local allStates = WeakAuras.GetTriggerStateForTrigger(id, triggernum) + if RunTriggerFunc(allStates, data, id, triggernum, event, unit, ...) then + updateTriggerState = true end end - if (updateTriggerState) then - Private.UpdatedTriggerState(id); + if updateTriggerState then + Private.UpdatedTriggerState(id) end - Private.StopProfileAura(id); - Private.ActivateAuraEnvironment(nil); + Private.StopProfileAura(id) + Private.ActivateAuraEnvironment(nil) end end end Private.StopProfileSystem("generictrigger " .. event .. " " .. unit) end -function WeakAuras.ScanEventsInternal(event_list, event, arg1, arg2, ... ) +function WeakAuras.ScanEventsInternal(event_list, event, arg1, arg2, ...) for id, triggers in pairs(event_list) do - Private.StartProfileAura(id); - Private.ActivateAuraEnvironment(id); - local updateTriggerState = false; + Private.StartProfileAura(id) + Private.ActivateAuraEnvironment(id) + local updateTriggerState = false for triggernum, data in pairs(triggers) do - local allStates = WeakAuras.GetTriggerStateForTrigger(id, triggernum); - if (RunTriggerFunc(allStates, data, id, triggernum, event, arg1, arg2, ...)) then - updateTriggerState = true; + local allStates = WeakAuras.GetTriggerStateForTrigger(id, triggernum) + if RunTriggerFunc(allStates, data, id, triggernum, event, arg1, arg2, ...) then + updateTriggerState = true end end - if (updateTriggerState) then - Private.UpdatedTriggerState(id); + if updateTriggerState then + Private.UpdatedTriggerState(id) end - Private.StopProfileAura(id); - Private.ActivateAuraEnvironment(nil); + Private.StopProfileAura(id) + Private.ActivateAuraEnvironment(nil) end end function Private.ScanEventsWatchedTrigger(id, watchedTriggernums) - Private.StartProfileAura(id); - Private.ActivateAuraEnvironment(id); + Private.StartProfileAura(id) + Private.ActivateAuraEnvironment(id) local updateTriggerState = false for _, watchedTrigger in ipairs(watchedTriggernums) do @@ -780,7 +788,7 @@ function Private.ScanEventsWatchedTrigger(id, watchedTriggernums) end end end - if (updateTriggerState) then + if updateTriggerState then Private.UpdatedTriggerState(id) end Private.StopProfileAura(id) @@ -801,8 +809,8 @@ end function GenericTrigger.CreateFakeStates(id, triggernum) local data = WeakAuras.GetData(id) - Private.ActivateAuraEnvironment(id); - local allStates = WeakAuras.GetTriggerStateForTrigger(id, triggernum); + Private.ActivateAuraEnvironment(id) + local allStates = WeakAuras.GetTriggerStateForTrigger(id, triggernum) RunTriggerFunc(allStates, events[id][triggernum], id, triggernum, "OPTIONS") local canHaveDuration = events[id][triggernum].prototype and events[id][triggernum].prototype.canHaveDuration == "timed" @@ -830,27 +838,27 @@ function GenericTrigger.CreateFakeStates(id, triggernum) AddFakeTime(state) end - Private.ActivateAuraEnvironment(nil); + Private.ActivateAuraEnvironment(nil) end function GenericTrigger.ScanWithFakeEvent(id, fake) - local updateTriggerState = false; - Private.ActivateAuraEnvironment(id); + local updateTriggerState = false + Private.ActivateAuraEnvironment(id) for triggernum, event in pairs(events[id] or {}) do - local allStates = WeakAuras.GetTriggerStateForTrigger(id, triggernum); - if (event.force_events) then - if (type(event.force_events) == "string") then - updateTriggerState = RunTriggerFunc(allStates, events[id][triggernum], id, triggernum, event.force_events) or updateTriggerState; - elseif (type(event.force_events) == "table") then + local allStates = WeakAuras.GetTriggerStateForTrigger(id, triggernum) + if event.force_events then + if type(event.force_events) == "string" then + updateTriggerState = RunTriggerFunc(allStates, events[id][triggernum], id, triggernum, event.force_events) or updateTriggerState + elseif type(event.force_events) == "table" then for index, event_args in pairs(event.force_events) do - updateTriggerState = RunTriggerFunc(allStates, events[id][triggernum], id, triggernum, unpack(event_args)) or updateTriggerState; + updateTriggerState = RunTriggerFunc(allStates, events[id][triggernum], id, triggernum, unpack(event_args)) or updateTriggerState end - elseif (type(event.force_events) == "boolean" and event.force_events) then + elseif type(event.force_events) == "boolean" and event.force_events then for i, eventName in pairs(event.events) do if eventName == "COMBAT_LOG_EVENT_UNFILTERED_CUSTOM" then eventName = "COMBAT_LOG_EVENT_UNFILTERED" end - updateTriggerState = RunTriggerFunc(allStates, events[id][triggernum], id, triggernum, eventName) or updateTriggerState; + updateTriggerState = RunTriggerFunc(allStates, events[id][triggernum], id, triggernum, eventName) or updateTriggerState end for unit, unitData in pairs(event.unit_events) do for _, event in ipairs(unitData) do @@ -861,116 +869,114 @@ function GenericTrigger.ScanWithFakeEvent(id, fake) end end - if (updateTriggerState) then - Private.UpdatedTriggerState(id); + if updateTriggerState then + Private.UpdatedTriggerState(id) end - Private.ActivateAuraEnvironment(nil); + Private.ActivateAuraEnvironment(nil) end function HandleEvent(frame, event, arg1, arg2, ...) - Private.StartProfileSystem("generictrigger " .. event); + Private.StartProfileSystem("generictrigger " .. event) if event == "NAME_PLATE_UNIT_ADDED" then nameplateExists[arg1] = true elseif event == "NAME_PLATE_UNIT_REMOVED" then nameplateExists[arg1] = false end - if not(WeakAuras.IsPaused()) then - if(event == "COMBAT_LOG_EVENT_UNFILTERED") then - WeakAuras.ScanEvents(event); + if not (WeakAuras.IsPaused()) then + if event == "COMBAT_LOG_EVENT_UNFILTERED" then + WeakAuras.ScanEvents(event) -- This triggers the scanning of "hacked" COMBAT_LOG_EVENT_UNFILTERED events that were renamed in order to circumvent -- the "proper" COMBAT_LOG_EVENT_UNFILTERED checks - WeakAuras.ScanEvents("COMBAT_LOG_EVENT_UNFILTERED_CUSTOM"); + WeakAuras.ScanEvents("COMBAT_LOG_EVENT_UNFILTERED_CUSTOM") else - WeakAuras.ScanEvents(event, arg1, arg2, ...); + WeakAuras.ScanEvents(event, arg1, arg2, ...) end end - if (event == "PLAYER_ENTERING_WORLD") then + if event == "PLAYER_ENTERING_WORLD" then timer:ScheduleTimer(function() - Private.StartProfileSystem("generictrigger WA_DELAYED_PLAYER_ENTERING_WORLD"); - HandleEvent(frame, "WA_DELAYED_PLAYER_ENTERING_WORLD"); - Private.CheckCooldownReady(); - Private.StopProfileSystem("generictrigger WA_DELAYED_PLAYER_ENTERING_WORLD"); + Private.StartProfileSystem("generictrigger WA_DELAYED_PLAYER_ENTERING_WORLD") + HandleEvent(frame, "WA_DELAYED_PLAYER_ENTERING_WORLD") + Private.CheckCooldownReady() + Private.StopProfileSystem("generictrigger WA_DELAYED_PLAYER_ENTERING_WORLD") Private.PreShowModels() - end, - 0.8); -- Data not available + end, 0.8) -- Data not available timer:ScheduleTimer(function() Private.PreShowModels() - end, - 4); -- Data not available + end, 4) -- Data not available end - Private.StopProfileSystem("generictrigger " .. event); + Private.StopProfileSystem("generictrigger " .. event) end function HandleUnitEvent(frame, event, unit, ...) - Private.StartProfileSystem("generictrigger " .. event .. " " .. unit); - if not(WeakAuras.IsPaused()) then - if (UnitIsUnit(unit, frame.unit)) then - WeakAuras.ScanUnitEvents(event, frame.unit, ...); + Private.StartProfileSystem("generictrigger " .. event .. " " .. unit) + if not (WeakAuras.IsPaused()) then + if UnitIsUnit(unit, frame.unit) then + WeakAuras.ScanUnitEvents(event, frame.unit, ...) end end - Private.StopProfileSystem("generictrigger " .. event .. " " .. unit); + Private.StopProfileSystem("generictrigger " .. event .. " " .. unit) end function GenericTrigger.UnloadAll() - wipe(loaded_auras); - wipe(loaded_events); - wipe(loaded_unit_events); - Private.UnregisterAllEveryFrameUpdate(); + wipe(loaded_auras) + wipe(loaded_events) + wipe(loaded_unit_events) + Private.UnregisterAllEveryFrameUpdate() end function GenericTrigger.UnloadDisplays(toUnload) for id in pairs(toUnload) do - loaded_auras[id] = false; + loaded_auras[id] = false for eventname, events in pairs(loaded_events) do - if(eventname == "COMBAT_LOG_EVENT_UNFILTERED") then + if eventname == "COMBAT_LOG_EVENT_UNFILTERED" then for subeventname, subevents in pairs(events) do - subevents[id] = nil; + subevents[id] = nil end else - events[id] = nil; + events[id] = nil end end for unit, events in pairs(loaded_unit_events) do for eventname, auras in pairs(events) do - auras[id] = nil; + auras[id] = nil end end - Private.UnregisterEveryFrameUpdate(id); + Private.UnregisterEveryFrameUpdate(id) end end -local genericTriggerRegisteredEvents = {}; -local genericTriggerRegisteredUnitEvents = {}; -local frame = CreateFrame("Frame"); -frame.unitFrames = {}; -WeakAuras.frames["WeakAuras Generic Trigger Frame"] = frame; -frame:RegisterEvent("PLAYER_ENTERING_WORLD"); +local genericTriggerRegisteredEvents = {} +local genericTriggerRegisteredUnitEvents = {} +local frame = CreateFrame("Frame") +frame.unitFrames = {} +WeakAuras.frames["WeakAuras Generic Trigger Frame"] = frame +frame:RegisterEvent("PLAYER_ENTERING_WORLD") frame:RegisterEvent("NAME_PLATE_UNIT_ADDED") frame:RegisterEvent("NAME_PLATE_UNIT_REMOVED") -genericTriggerRegisteredEvents["PLAYER_ENTERING_WORLD"] = true; -genericTriggerRegisteredEvents["NAME_PLATE_UNIT_ADDED"] = true; -genericTriggerRegisteredEvents["NAME_PLATE_UNIT_REMOVED"] = true; -frame:SetScript("OnEvent", HandleEvent); +genericTriggerRegisteredEvents["PLAYER_ENTERING_WORLD"] = true +genericTriggerRegisteredEvents["NAME_PLATE_UNIT_ADDED"] = true +genericTriggerRegisteredEvents["NAME_PLATE_UNIT_REMOVED"] = true +frame:SetScript("OnEvent", HandleEvent) function GenericTrigger.Delete(id) - GenericTrigger.UnloadDisplays({[id] = true}); + GenericTrigger.UnloadDisplays({ [id] = true }) end function GenericTrigger.Rename(oldid, newid) - events[newid] = events[oldid]; - events[oldid] = nil; + events[newid] = events[oldid] + events[oldid] = nil for eventname, events in pairs(loaded_events) do - if(eventname == "COMBAT_LOG_EVENT_UNFILTERED") then + if eventname == "COMBAT_LOG_EVENT_UNFILTERED" then for subeventname, subevents in pairs(events) do - subevents[oldid] = subevents[newid]; - subevents[oldid] = nil; + subevents[oldid] = subevents[newid] + subevents[oldid] = nil end else - events[newid] = events[oldid]; - events[oldid] = nil; + events[newid] = events[oldid] + events[oldid] = nil end end @@ -991,15 +997,15 @@ local function MultiUnitLoop(Func, unit, includePets, ...) unit = string.lower(unit) if unit == "boss" then for i = 1, 10 do - Func(unit..i, ...) + Func(unit .. i, ...) end elseif unit == "arena" then for i = 1, 5 do - Func(unit..i, ...) + Func(unit .. i, ...) end elseif unit == "nameplate" then for i = 1, 40 do - Func(unit..i, ...) + Func(unit .. i, ...) end elseif unit == "group" then if includePets ~= "PetsOnly" then @@ -1010,18 +1016,18 @@ local function MultiUnitLoop(Func, unit, includePets, ...) end for i = 1, 4 do if includePets ~= "PetsOnly" then - Func("party"..i, ...) + Func("party" .. i, ...) end if includePets ~= nil then - Func("partypet"..i, ...) + Func("partypet" .. i, ...) end end for i = 1, 40 do if includePets ~= "PetsOnly" then - Func("raid"..i, ...) + Func("raid" .. i, ...) end if includePets ~= nil then - Func("raidpet"..i, ...) + Func("raidpet" .. i, ...) end end elseif unit == "party" then @@ -1033,19 +1039,19 @@ local function MultiUnitLoop(Func, unit, includePets, ...) end for i = 1, 4 do if includePets ~= "PetsOnly" then - Func("party"..i, ...) + Func("party" .. i, ...) end if includePets ~= nil then - Func("partypet"..i, ...) + Func("partypet" .. i, ...) end end elseif unit == "raid" then for i = 1, 40 do if includePets ~= "PetsOnly" then - Func("raid"..i, ...) + Func("raid" .. i, ...) end if includePets ~= nil then - Func("raidpet"..i, ...) + Func("raidpet" .. i, ...) end end else @@ -1056,24 +1062,24 @@ end function LoadEvent(id, triggernum, data) if data.events then for index, event in pairs(data.events) do - loaded_events[event] = loaded_events[event] or {}; - if(event == "COMBAT_LOG_EVENT_UNFILTERED" and data.subevents) then + loaded_events[event] = loaded_events[event] or {} + if event == "COMBAT_LOG_EVENT_UNFILTERED" and data.subevents then for i, subevent in pairs(data.subevents) do - loaded_events[event][subevent] = loaded_events[event][subevent] or {}; + loaded_events[event][subevent] = loaded_events[event][subevent] or {} loaded_events[event][subevent][id] = loaded_events[event][subevent][id] or {} - loaded_events[event][subevent][id][triggernum] = data; + loaded_events[event][subevent][id][triggernum] = data end else - loaded_events[event][id] = loaded_events[event][id] or {}; - loaded_events[event][id][triggernum] = data; + loaded_events[event][id] = loaded_events[event][id] or {} + loaded_events[event][id][triggernum] = data end end end - if (data.internal_events) then + if data.internal_events then for index, event in pairs(data.internal_events) do - loaded_events[event] = loaded_events[event] or {}; - loaded_events[event][id] = loaded_events[event][id] or {}; - loaded_events[event][id][triggernum] = data; + loaded_events[event] = loaded_events[event] or {} + loaded_events[event][id] = loaded_events[event][id] or {} + loaded_events[event][id][triggernum] = data end end if data.unit_events then @@ -1081,48 +1087,46 @@ function LoadEvent(id, triggernum, data) for unit, events in pairs(data.unit_events) do unit = string.lower(unit) for index, event in pairs(events) do - MultiUnitLoop( - function(u) - loaded_unit_events[u] = loaded_unit_events[u] or {}; - loaded_unit_events[u][event] = loaded_unit_events[u][event] or {}; - loaded_unit_events[u][event][id] = loaded_unit_events[u][event][id] or {} - loaded_unit_events[u][event][id][triggernum] = data; - end, unit, includePets - ) + MultiUnitLoop(function(u) + loaded_unit_events[u] = loaded_unit_events[u] or {} + loaded_unit_events[u][event] = loaded_unit_events[u][event] or {} + loaded_unit_events[u][event][id] = loaded_unit_events[u][event][id] or {} + loaded_unit_events[u][event][id][triggernum] = data + end, unit, includePets) end end end - if (data.loadFunc) then - data.loadFunc(data.trigger); + if data.loadFunc then + data.loadFunc(data.trigger) end end local function trueFunction() - return true; + return true end -local eventsToRegister = {}; -local unitEventsToRegister = {}; +local eventsToRegister = {} +local unitEventsToRegister = {} function GenericTrigger.LoadDisplays(toLoad, loadEvent, ...) for id in pairs(toLoad) do - local register_for_frame_updates = false; - if(events[id]) then - loaded_auras[id] = true; + local register_for_frame_updates = false + if events[id] then + loaded_auras[id] = true for triggernum, data in pairs(events[id]) do if data.events then for index, event in pairs(data.events) do - if (event == "COMBAT_LOG_EVENT_UNFILTERED_CUSTOM") then + if event == "COMBAT_LOG_EVENT_UNFILTERED_CUSTOM" then if not genericTriggerRegisteredEvents["COMBAT_LOG_EVENT_UNFILTERED"] then - eventsToRegister["COMBAT_LOG_EVENT_UNFILTERED"] = true; + eventsToRegister["COMBAT_LOG_EVENT_UNFILTERED"] = true end - elseif (event == "FRAME_UPDATE") then - register_for_frame_updates = true; + elseif event == "FRAME_UPDATE" then + register_for_frame_updates = true else - if (genericTriggerRegisteredEvents[event]) then + if genericTriggerRegisteredEvents[event] then -- Already registered event else - eventsToRegister[event] = true; + eventsToRegister[event] = true end end end @@ -1131,32 +1135,30 @@ function GenericTrigger.LoadDisplays(toLoad, loadEvent, ...) local includePets = data.includePets for unit, events in pairs(data.unit_events) do for index, event in pairs(events) do - MultiUnitLoop( - function (u) - if not (genericTriggerRegisteredUnitEvents[u] and genericTriggerRegisteredUnitEvents[u][event]) then - unitEventsToRegister[u] = unitEventsToRegister[u] or {} - unitEventsToRegister[u][event] = true - end - end, unit, includePets - ) + MultiUnitLoop(function(u) + if not (genericTriggerRegisteredUnitEvents[u] and genericTriggerRegisteredUnitEvents[u][event]) then + unitEventsToRegister[u] = unitEventsToRegister[u] or {} + unitEventsToRegister[u][event] = true + end + end, unit, includePets) end end end - LoadEvent(id, triggernum, data); + LoadEvent(id, triggernum, data) end end - if(register_for_frame_updates) then - Private.RegisterEveryFrameUpdate(id); + if register_for_frame_updates then + Private.RegisterEveryFrameUpdate(id) else - Private.UnregisterEveryFrameUpdate(id); + Private.UnregisterEveryFrameUpdate(id) end end for event in pairs(eventsToRegister) do xpcall(frame.RegisterEvent, trueFunction, frame, event) - genericTriggerRegisteredEvents[event] = true; + genericTriggerRegisteredEvents[event] = true end for unit, events in pairs(unitEventsToRegister) do @@ -1164,108 +1166,106 @@ function GenericTrigger.LoadDisplays(toLoad, loadEvent, ...) if not frame.unitFrames[unit] then frame.unitFrames[unit] = CreateFrame("Frame") frame.unitFrames[unit].unit = unit - frame.unitFrames[unit]:SetScript("OnEvent", HandleUnitEvent); + frame.unitFrames[unit]:SetScript("OnEvent", HandleUnitEvent) end xpcall(frame.unitFrames[unit].RegisterUnitEvent, trueFunction, frame.unitFrames[unit], event, unit) - genericTriggerRegisteredUnitEvents[unit] = genericTriggerRegisteredUnitEvents[unit] or {}; - genericTriggerRegisteredUnitEvents[unit][event] = true; + genericTriggerRegisteredUnitEvents[unit] = genericTriggerRegisteredUnitEvents[unit] or {} + genericTriggerRegisteredUnitEvents[unit][event] = true end end for id in pairs(toLoad) do - GenericTrigger.ScanWithFakeEvent(id); + GenericTrigger.ScanWithFakeEvent(id) end -- Replay events that lead to loading, if we weren't already registered for them - if (eventsToRegister[loadEvent]) then - WeakAuras.ScanEvents(loadEvent, ...); + if eventsToRegister[loadEvent] then + WeakAuras.ScanEvents(loadEvent, ...) end local loadUnit = ... if loadUnit and unitEventsToRegister[loadUnit] and unitEventsToRegister[loadUnit][loadEvent] then - WeakAuras.ScanUnitEvents(loadEvent, ...); + WeakAuras.ScanUnitEvents(loadEvent, ...) end - wipe(eventsToRegister); - wipe(unitEventsToRegister); + wipe(eventsToRegister) + wipe(unitEventsToRegister) end -function GenericTrigger.FinishLoadUnload() -end +function GenericTrigger.FinishLoadUnload() end --- Adds a display, creating all internal data structures for all triggers. -- @param data -- @param region function GenericTrigger.Add(data, region) - local id = data.id; - events[id] = nil; + local id = data.id + events[id] = nil watched_trigger_events[id] = nil for triggernum, triggerData in ipairs(data.triggers) do local trigger, untrigger = triggerData.trigger, triggerData.untrigger - local triggerType; - if(trigger and type(trigger) == "table") then - triggerType = trigger.type; - if(Private.category_event_prototype[triggerType] or triggerType == "custom") then - local triggerFuncStr, triggerFunc, untriggerFunc, statesParameter; - local trigger_events = {}; - local internal_events = {}; - local trigger_unit_events = {}; + local triggerType + if trigger and type(trigger) == "table" then + triggerType = trigger.type + if Private.category_event_prototype[triggerType] or triggerType == "custom" then + local triggerFuncStr, triggerFunc, untriggerFunc, statesParameter + local trigger_events = {} + local internal_events = {} + local trigger_unit_events = {} local includePets - local trigger_subevents = {}; - local force_events = false; - local durationFunc, overlayFuncs, nameFunc, iconFunc, textureFunc, stacksFunc, loadFunc; - local tsuConditionVariables; + local trigger_subevents = {} + local force_events = false + local durationFunc, overlayFuncs, nameFunc, iconFunc, textureFunc, stacksFunc, loadFunc + local tsuConditionVariables local prototype = nil local automaticAutoHide local duration - if(Private.category_event_prototype[triggerType]) then - if not(trigger.event) then - error("Improper arguments to WeakAuras.Add - trigger type is \"event\" but event is not defined"); - elseif not(event_prototypes[trigger.event]) then - if(event_prototypes["Health"]) then - trigger.event = "Health"; + if Private.category_event_prototype[triggerType] then + if not trigger.event then + error("Improper arguments to WeakAuras.Add - trigger type is \"event\" but event is not defined") + elseif not event_prototypes[trigger.event] then + if event_prototypes["Health"] then + trigger.event = "Health" else - error("Improper arguments to WeakAuras.Add - no event prototype can be found for event type \""..trigger.event.."\" and default prototype reset failed."); + error("Improper arguments to WeakAuras.Add - no event prototype can be found for event type \"" .. trigger.event .. "\" and default prototype reset failed.") end else - if (trigger.event == "Combat Log") then - if (not trigger.subeventPrefix) then + if trigger.event == "Combat Log" then + if not trigger.subeventPrefix then trigger.subeventPrefix = "" end - if (not trigger.subeventSuffix) then - trigger.subeventSuffix = ""; + if not trigger.subeventSuffix then + trigger.subeventSuffix = "" end - if not(Private.subevent_actual_prefix_types[trigger.subeventPrefix]) then - trigger.subeventSuffix = ""; + if not Private.subevent_actual_prefix_types[trigger.subeventPrefix] then + trigger.subeventSuffix = "" end end prototype = event_prototypes[trigger.event] - triggerFuncStr = ConstructFunction(prototype, trigger); + triggerFuncStr = ConstructFunction(prototype, trigger) - statesParameter = prototype.statesParameter; - triggerFunc = WeakAuras.LoadFunction(triggerFuncStr); + statesParameter = prototype.statesParameter + triggerFunc = WeakAuras.LoadFunction(triggerFuncStr) - durationFunc = prototype.durationFunc; - nameFunc = prototype.nameFunc; - iconFunc = prototype.iconFunc; - textureFunc = prototype.textureFunc; - stacksFunc = prototype.stacksFunc; - loadFunc = prototype.loadFunc; + durationFunc = prototype.durationFunc + nameFunc = prototype.nameFunc + iconFunc = prototype.iconFunc + textureFunc = prototype.textureFunc + stacksFunc = prototype.stacksFunc + loadFunc = prototype.loadFunc - if (prototype.overlayFuncs) then - overlayFuncs = {}; - local dest = 1; + if prototype.overlayFuncs then + overlayFuncs = {} + local dest = 1 for i, v in ipairs(prototype.overlayFuncs) do - if (v.enable(trigger)) then - overlayFuncs[dest] = v.func; - dest = dest + 1; + if v.enable(trigger) then + overlayFuncs[dest] = v.func + dest = dest + 1 end end end - - if (prototype.automaticrequired) then + if prototype.automaticrequired then untriggerFunc = trueFunction elseif prototype.timedrequired then automaticAutoHide = true @@ -1274,10 +1274,10 @@ function GenericTrigger.Add(data, region) WeakAuras.prettyPrint("Invalid Prototype found: " .. prototype.name) end - if(prototype) then - local trigger_all_events = prototype.events; - internal_events = prototype.internal_events; - force_events = prototype.force_events; + if prototype then + local trigger_all_events = prototype.events + internal_events = prototype.internal_events + force_events = prototype.force_events if prototype.subevents then trigger_subevents = prototype.subevents if trigger_subevents and type(trigger_subevents) == "function" then @@ -1289,69 +1289,68 @@ function GenericTrigger.Add(data, region) tinsert(trigger_subevents, trigger.subeventPrefix .. trigger.subeventSuffix) end - if (type(trigger_all_events) == "function") then - trigger_all_events = trigger_all_events(trigger, untrigger); + if type(trigger_all_events) == "function" then + trigger_all_events = trigger_all_events(trigger, untrigger) end trigger_events = trigger_all_events.events trigger_unit_events = trigger_all_events.unit_events - if (type(internal_events) == "function") then - internal_events = internal_events(trigger, untrigger); + if type(internal_events) == "function" then + internal_events = internal_events(trigger, untrigger) end - if (type(force_events) == "function") then + if type(force_events) == "function" then force_events = force_events(trigger, untrigger) end - if prototype.includePets then includePets = trigger.use_includePets == true and trigger.includePets or nil end end end else -- CUSTOM - triggerFunc = WeakAuras.LoadFunction("return "..(trigger.custom or "")); - if (trigger.custom_type == "stateupdate") then - tsuConditionVariables = WeakAuras.LoadFunction("return function() return \n" .. (trigger.customVariables or "") .. "\n end"); + triggerFunc = WeakAuras.LoadFunction("return " .. (trigger.custom or "")) + if trigger.custom_type == "stateupdate" then + tsuConditionVariables = WeakAuras.LoadFunction("return function() return \n" .. (trigger.customVariables or "") .. "\n end") if not tsuConditionVariables then tsuConditionVariables = function() end end end - if(trigger.custom_type == "status" or trigger.custom_type == "event" and trigger.custom_hide == "custom") then - untriggerFunc = WeakAuras.LoadFunction("return "..(untrigger.custom or "")); - if (not untriggerFunc) then - untriggerFunc = trueFunction; + if trigger.custom_type == "status" or trigger.custom_type == "event" and trigger.custom_hide == "custom" then + untriggerFunc = WeakAuras.LoadFunction("return " .. (untrigger.custom or "")) + if not untriggerFunc then + untriggerFunc = trueFunction end end - if(trigger.custom_type ~= "stateupdate" and trigger.customDuration and trigger.customDuration ~= "") then - durationFunc = WeakAuras.LoadFunction("return "..trigger.customDuration); + if trigger.custom_type ~= "stateupdate" and trigger.customDuration and trigger.customDuration ~= "" then + durationFunc = WeakAuras.LoadFunction("return " .. trigger.customDuration) end - if(trigger.custom_type ~= "stateupdate") then - overlayFuncs = {}; + if trigger.custom_type ~= "stateupdate" then + overlayFuncs = {} for i = 1, 7 do - local property = "customOverlay" .. i; - if (trigger[property] and trigger[property] ~= "") then - overlayFuncs[i] = WeakAuras.LoadFunction("return ".. trigger[property]); + local property = "customOverlay" .. i + if trigger[property] and trigger[property] ~= "" then + overlayFuncs[i] = WeakAuras.LoadFunction("return " .. trigger[property]) end end end - if(trigger.custom_type ~= "stateupdate" and trigger.customName and trigger.customName ~= "") then - nameFunc = WeakAuras.LoadFunction("return "..trigger.customName); + if trigger.custom_type ~= "stateupdate" and trigger.customName and trigger.customName ~= "" then + nameFunc = WeakAuras.LoadFunction("return " .. trigger.customName) end - if(trigger.custom_type ~= "stateupdate" and trigger.customIcon and trigger.customIcon ~= "") then - iconFunc = WeakAuras.LoadFunction("return "..trigger.customIcon); + if trigger.custom_type ~= "stateupdate" and trigger.customIcon and trigger.customIcon ~= "" then + iconFunc = WeakAuras.LoadFunction("return " .. trigger.customIcon) end - if(trigger.custom_type ~= "stateupdate" and trigger.customTexture and trigger.customTexture ~= "") then - textureFunc = WeakAuras.LoadFunction("return "..trigger.customTexture); + if trigger.custom_type ~= "stateupdate" and trigger.customTexture and trigger.customTexture ~= "" then + textureFunc = WeakAuras.LoadFunction("return " .. trigger.customTexture) end - if(trigger.custom_type ~= "stateupdate" and trigger.customStacks and trigger.customStacks ~= "") then - stacksFunc = WeakAuras.LoadFunction("return "..trigger.customStacks); + if trigger.custom_type ~= "stateupdate" and trigger.customStacks and trigger.customStacks ~= "" then + stacksFunc = WeakAuras.LoadFunction("return " .. trigger.customStacks) end - if((trigger.custom_type == "status" or trigger.custom_type == "stateupdate") and trigger.check == "update") then - trigger_events = {"FRAME_UPDATE"}; + if (trigger.custom_type == "status" or trigger.custom_type == "stateupdate") and trigger.check == "update" then + trigger_events = { "FRAME_UPDATE" } else - local rawEvents = WeakAuras.split(trigger.events); + local rawEvents = WeakAuras.split(trigger.events) for index, event in pairs(rawEvents) do -- custom events in the form of event:unit1:unit2:unitX are registered with RegisterUnitEvent local trueEvent @@ -1374,7 +1373,7 @@ function GenericTrigger.Add(data, region) isUnitEvent = true if string.lower(strsub(i, #i - 3)) == "pets" then - i = strsub(i, 1, #i-4) + i = strsub(i, 1, #i - 4) includePets = "PlayersAndPets" elseif string.lower(strsub(i, #i - 7)) == "petsonly" then includePets = "PetsOnly" @@ -1413,22 +1412,22 @@ function GenericTrigger.Add(data, region) else tinsert(trigger_events, event) end - force_events = trigger.custom_type == "status" or trigger.custom_type == "stateupdate"; + force_events = trigger.custom_type == "status" or trigger.custom_type == "stateupdate" end end - if (trigger.custom_type == "stateupdate") then - statesParameter = "full"; + if trigger.custom_type == "stateupdate" then + statesParameter = "full" end - if(trigger.custom_type == "event" and trigger.custom_hide == "timed") then - automaticAutoHide = true; - if (not trigger.dynamicDuration) then - duration = tonumber(trigger.duration); + if trigger.custom_type == "event" and trigger.custom_hide == "timed" then + automaticAutoHide = true + if not trigger.dynamicDuration then + duration = tonumber(trigger.duration) end end end - events[id] = events[id] or {}; + events[id] = events[id] or {} events[id][triggernum] = { trigger = trigger, triggerFunc = triggerFunc, @@ -1453,62 +1452,62 @@ function GenericTrigger.Add(data, region) automaticAutoHide = automaticAutoHide, tsuConditionVariables = tsuConditionVariables, prototype = prototype, - ignoreOptionsEventErrors = data.information.ignoreOptionsEventErrors - }; + ignoreOptionsEventErrors = data.information.ignoreOptionsEventErrors, + } end end end end do - local update_clients = {}; - local update_clients_num = 0; + local update_clients = {} + local update_clients_num = 0 local update_frame = nil - WeakAuras.frames["Custom Trigger Every Frame Updater"] = update_frame; - local updating = false; + WeakAuras.frames["Custom Trigger Every Frame Updater"] = update_frame + local updating = false function Private.RegisterEveryFrameUpdate(id) - if not(update_clients[id]) then - update_clients[id] = true; - update_clients_num = update_clients_num + 1; + if not update_clients[id] then + update_clients[id] = true + update_clients_num = update_clients_num + 1 end - if not(update_frame) then - update_frame = CreateFrame("Frame"); + if not update_frame then + update_frame = CreateFrame("Frame") end - if not(updating) then + if not updating then update_frame:SetScript("OnUpdate", function(self, elapsed) - if not(WeakAuras.IsPaused()) then - WeakAuras.ScanEvents("FRAME_UPDATE", elapsed); + if not (WeakAuras.IsPaused()) then + WeakAuras.ScanEvents("FRAME_UPDATE", elapsed) end - end); - updating = true; + end) + updating = true end end function Private.EveryFrameUpdateRename(oldid, newid) - update_clients[newid] = update_clients[oldid]; - update_clients[oldid] = nil; + update_clients[newid] = update_clients[oldid] + update_clients[oldid] = nil end function Private.UnregisterEveryFrameUpdate(id) - if(update_clients[id]) then - update_clients[id] = nil; - update_clients_num = update_clients_num - 1; + if update_clients[id] then + update_clients[id] = nil + update_clients_num = update_clients_num - 1 end - if(update_clients_num == 0 and update_frame and updating) then - update_frame:SetScript("OnUpdate", nil); - updating = false; + if update_clients_num == 0 and update_frame and updating then + update_frame:SetScript("OnUpdate", nil) + updating = false end end function Private.UnregisterAllEveryFrameUpdate() - if (not update_frame) then - return; + if not update_frame then + return end - wipe(update_clients); - update_clients_num = 0; - update_frame:SetScript("OnUpdate", nil); - updating = false; + wipe(update_clients) + update_clients_num = 0 + update_frame:SetScript("OnUpdate", nil) + updating = false end end @@ -1516,7 +1515,7 @@ local combatLogUpgrade = { ["sourceunit"] = "sourceUnit", ["source"] = "sourceName", ["destunit"] = "destUnit", - ["dest"] = "destName" + ["dest"] = "destName", } local oldPowerTriggers = { @@ -1525,7 +1524,7 @@ local oldPowerTriggers = { ["Insanity"] = 13, ["Chi Power"] = 12, ["Astral Power"] = 8, - ["Maelstrom"] = 11, + ["Maelstrom"] = 11, ["Arcane Charges"] = 16, ["Fury"] = 17, ["Pain"] = 18, @@ -1542,46 +1541,46 @@ do local oh = GetInventorySlotInfo("SecondaryHandSlot") local ranged = WeakAuras.IsClassicOrBCCOrWrath() and GetInventorySlotInfo("RangedSlot") - local swingTimerFrame; - local lastSwingMain, lastSwingOff, lastSwingRange; - local swingDurationMain, swingDurationOff, swingDurationRange, mainSwingOffset; - local mainTimer, offTimer, rangeTimer; - local selfGUID; + local swingTimerFrame + local lastSwingMain, lastSwingOff, lastSwingRange + local swingDurationMain, swingDurationOff, swingDurationRange, mainSwingOffset + local mainTimer, offTimer, rangeTimer + local selfGUID local mainSpeed, offSpeed = UnitAttackSpeed("player") local casting = false local skipNextAttack, skipNextAttackCount local isAttacking function WeakAuras.GetSwingTimerInfo(hand) - if(hand == "main") then - local itemId = GetInventoryItemID("player", mh); - local name, _, _, _, _, _, _, _, _, icon = GetItemInfo(itemId or 0); - if(lastSwingMain) then - return swingDurationMain, lastSwingMain + swingDurationMain - mainSwingOffset, name, icon; + if hand == "main" then + local itemId = GetInventoryItemID("player", mh) + local name, _, _, _, _, _, _, _, _, icon = GetItemInfo(itemId or 0) + if lastSwingMain then + return swingDurationMain, lastSwingMain + swingDurationMain - mainSwingOffset, name, icon elseif WeakAuras.IsRetail() and lastSwingRange then - return swingDurationRange, lastSwingRange + swingDurationRange, name, icon; + return swingDurationRange, lastSwingRange + swingDurationRange, name, icon else - return 0, math.huge, name, icon; + return 0, math.huge, name, icon end - elseif(hand == "off") then - local itemId = GetInventoryItemID("player", oh); - local name, _, _, _, _, _, _, _, _, icon = GetItemInfo(itemId or 0); - if(lastSwingOff) then - return swingDurationOff, lastSwingOff + swingDurationOff, name, icon; + elseif hand == "off" then + local itemId = GetInventoryItemID("player", oh) + local name, _, _, _, _, _, _, _, _, icon = GetItemInfo(itemId or 0) + if lastSwingOff then + return swingDurationOff, lastSwingOff + swingDurationOff, name, icon else - return 0, math.huge, name, icon; + return 0, math.huge, name, icon end - elseif(hand == "ranged") then - local itemId = GetInventoryItemID("player", ranged); - local name, _, _, _, _, _, _, _, _, icon = GetItemInfo(itemId or 0); - if (lastSwingRange) then - return swingDurationRange, lastSwingRange + swingDurationRange, name, icon; + elseif hand == "ranged" then + local itemId = GetInventoryItemID("player", ranged) + local name, _, _, _, _, _, _, _, _, icon = GetItemInfo(itemId or 0) + if lastSwingRange then + return swingDurationRange, lastSwingRange + swingDurationRange, name, icon else - return 0, math.huge, name, icon; + return 0, math.huge, name, icon end end - return 0, math.huge; + return 0, math.huge end local function swingTriggerUpdate() @@ -1589,12 +1588,12 @@ do end local function swingEnd(hand) - if(hand == "main") then - lastSwingMain, swingDurationMain, mainSwingOffset = nil, nil, nil; - elseif(hand == "off") then - lastSwingOff, swingDurationOff = nil, nil; - elseif(hand == "ranged") then - lastSwingRange, swingDurationRange = nil, nil; + if hand == "main" then + lastSwingMain, swingDurationMain, mainSwingOffset = nil, nil, nil + elseif hand == "off" then + lastSwingOff, swingDurationOff = nil, nil + elseif hand == "ranged" then + lastSwingRange, swingDurationRange = nil, nil end swingTriggerUpdate() end @@ -1642,47 +1641,49 @@ do end local function swingTimerCLEUCheck(ts, event, _, sourceGUID, _, _, _, destGUID, _, _, _, ...) - Private.StartProfileSystem("generictrigger swing"); - if(sourceGUID == selfGUID) then + Private.StartProfileSystem("generictrigger swing") + if sourceGUID == selfGUID then if event == "SPELL_EXTRA_ATTACKS" then skipNextAttack = ts skipNextAttackCount = select(4, ...) - elseif(event == "SWING_DAMAGE" or event == "SWING_MISSED") then + elseif event == "SWING_DAMAGE" or event == "SWING_MISSED" then if tonumber(skipNextAttack) and (ts - skipNextAttack) < 0.04 and tonumber(skipNextAttackCount) then if skipNextAttackCount > 0 then skipNextAttackCount = skipNextAttackCount - 1 return end end - local isOffHand = select(event == "SWING_DAMAGE" and 10 or 2, ...); + local isOffHand = select(event == "SWING_DAMAGE" and 10 or 2, ...) if not isOffHand then swingStart("main") - elseif(isOffHand) then + elseif isOffHand then swingStart("off") end swingTriggerUpdate() end - elseif (destGUID == selfGUID and (... == "PARRY" or select(4, ...) == "PARRY")) then - if (lastSwingMain) then - local timeLeft = lastSwingMain + swingDurationMain - GetTime() - (mainSwingOffset or 0); - if (timeLeft > 0.2 * swingDurationMain) then + elseif destGUID == selfGUID and (... == "PARRY" or select(4, ...) == "PARRY") then + if lastSwingMain then + local timeLeft = lastSwingMain + swingDurationMain - GetTime() - (mainSwingOffset or 0) + if timeLeft > 0.2 * swingDurationMain then local offset = 0.4 * swingDurationMain - if (timeLeft - offset < 0.2 * swingDurationMain) then + if timeLeft - offset < 0.2 * swingDurationMain then offset = timeLeft - 0.2 * swingDurationMain end - timer:CancelTimer(mainTimer); - mainTimer = timer:ScheduleTimerFixed(swingEnd, timeLeft - offset, "main"); + timer:CancelTimer(mainTimer) + mainTimer = timer:ScheduleTimerFixed(swingEnd, timeLeft - offset, "main") mainSwingOffset = (mainSwingOffset or 0) + offset swingTriggerUpdate() end end end - Private.StopProfileSystem("generictrigger swing"); + Private.StopProfileSystem("generictrigger swing") end local function swingTimerCheck(event, unit, guid, spell) - if event ~= "PLAYER_EQUIPMENT_CHANGED" and unit and unit ~= "player" then return end - Private.StartProfileSystem("generictrigger swing"); + if event ~= "PLAYER_EQUIPMENT_CHANGED" and unit and unit ~= "player" then + return + end + Private.StartProfileSystem("generictrigger swing") local now = GetTime() if event == "UNIT_ATTACK_SPEED" then local mainSpeedNew, offSpeedNew = UnitAttackSpeed("player") @@ -1750,117 +1751,116 @@ do elseif event == "PLAYER_LEAVE_COMBAT" then isAttacking = nil end - Private.StopProfileSystem("generictrigger swing"); + Private.StopProfileSystem("generictrigger swing") end function WeakAuras.InitSwingTimer() - if not(swingTimerFrame) then - swingTimerFrame = CreateFrame("Frame"); - swingTimerFrame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED"); - swingTimerFrame:RegisterEvent("PLAYER_ENTER_COMBAT"); - swingTimerFrame:RegisterEvent("PLAYER_LEAVE_COMBAT"); - swingTimerFrame:RegisterEvent("PLAYER_EQUIPMENT_CHANGED"); - swingTimerFrame:RegisterUnitEvent("UNIT_ATTACK_SPEED", "player"); - swingTimerFrame:RegisterUnitEvent("UNIT_SPELLCAST_SUCCEEDED", "player"); + if not swingTimerFrame then + swingTimerFrame = CreateFrame("Frame") + swingTimerFrame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") + swingTimerFrame:RegisterEvent("PLAYER_ENTER_COMBAT") + swingTimerFrame:RegisterEvent("PLAYER_LEAVE_COMBAT") + swingTimerFrame:RegisterEvent("PLAYER_EQUIPMENT_CHANGED") + swingTimerFrame:RegisterUnitEvent("UNIT_ATTACK_SPEED", "player") + swingTimerFrame:RegisterUnitEvent("UNIT_SPELLCAST_SUCCEEDED", "player") if WeakAuras.IsClassicOrBCCOrWrath() then swingTimerFrame:RegisterUnitEvent("UNIT_SPELLCAST_START", "player") swingTimerFrame:RegisterUnitEvent("UNIT_SPELLCAST_INTERRUPTED", "player") swingTimerFrame:RegisterUnitEvent("UNIT_SPELLCAST_FAILED", "player") end - swingTimerFrame:SetScript("OnEvent", - function(_, event, ...) - if event == "COMBAT_LOG_EVENT_UNFILTERED" then - swingTimerCLEUCheck(CombatLogGetCurrentEventInfo()) - else - swingTimerCheck(event, ...) - end - end); - selfGUID = UnitGUID("player"); + swingTimerFrame:SetScript("OnEvent", function(_, event, ...) + if event == "COMBAT_LOG_EVENT_UNFILTERED" then + swingTimerCLEUCheck(CombatLogGetCurrentEventInfo()) + else + swingTimerCheck(event, ...) + end + end) + selfGUID = UnitGUID("player") end end end -- CD/Rune/GCD support code do - local cdReadyFrame; + local cdReadyFrame - local spells = {}; - local spellKnown = {}; + local spells = {} + local spellKnown = {} - local spellCharges = {}; - local spellChargesMax = {}; + local spellCharges = {} + local spellChargesMax = {} local spellCounts = {} local spellChargeGainTime = {} local spellChargeLostTime = {} - local items = {}; - local itemCdDurs = {}; - local itemCdExps = {}; - local itemCdHandles = {}; - local itemCdEnabled = {}; - - local itemSlots = {}; - local itemSlotsCdDurs = {}; - local itemSlotsCdExps = {}; - local itemSlotsCdHandles = {}; - local itemSlotsEnable = {}; - - local runes = {}; - local runeCdDurs = {}; - local runeCdExps = {}; - local runeCdHandles = {}; - - local gcdStart; - local gcdDuration; - local gcdSpellName; - local gcdSpellIcon; - local gcdEndCheck; + local items = {} + local itemCdDurs = {} + local itemCdExps = {} + local itemCdHandles = {} + local itemCdEnabled = {} + + local itemSlots = {} + local itemSlotsCdDurs = {} + local itemSlotsCdExps = {} + local itemSlotsCdHandles = {} + local itemSlotsEnable = {} + + local runes = {} + local runeCdDurs = {} + local runeCdExps = {} + local runeCdHandles = {} + + local gcdStart + local gcdDuration + local gcdSpellName + local gcdSpellIcon + local gcdEndCheck local gcdModrate local shootStart local shootDuration local function GetRuneDuration() - local runeDuration = -100; + local runeDuration = -100 for id, _ in pairs(runes) do - local startTime, duration = GetRuneCooldown(id); - duration = duration or 0; + local startTime, duration = GetRuneCooldown(id) + duration = duration or 0 runeDuration = duration > 0 and duration or runeDuration end return runeDuration end local function CheckGCD() - local event; + local event local startTime, duration, _, modRate if WeakAuras.IsClassicOrBCCOrWrath() then - startTime, duration = GetSpellCooldown(29515); + startTime, duration = GetSpellCooldown(29515) shootStart, shootDuration = GetSpellCooldown(5019) else - startTime, duration, _, modRate = GetSpellCooldown(61304); + startTime, duration, _, modRate = GetSpellCooldown(61304) end - if(duration and duration > 0) then - if not(gcdStart) then - event = "GCD_START"; - elseif(gcdStart ~= startTime or gcdDuration ~= duration or gcdModrate ~= modRate) then - event = "GCD_CHANGE"; + if duration and duration > 0 then + if not gcdStart then + event = "GCD_START" + elseif gcdStart ~= startTime or gcdDuration ~= duration or gcdModrate ~= modRate then + event = "GCD_CHANGE" end gcdStart, gcdDuration, gcdModrate = startTime, duration, modRate - local endCheck = startTime + duration + 0.1; - if(gcdEndCheck ~= endCheck) then - gcdEndCheck = endCheck; - timer:ScheduleTimerFixed(CheckGCD, duration + 0.1); + local endCheck = startTime + duration + 0.1 + if gcdEndCheck ~= endCheck then + gcdEndCheck = endCheck + timer:ScheduleTimerFixed(CheckGCD, duration + 0.1) end else - if(gcdStart) then + if gcdStart then event = "GCD_END" end - gcdStart, gcdDuration, gcdModrate = nil, nil, nil; - gcdSpellName, gcdSpellIcon = nil, nil; - gcdEndCheck = 0; + gcdStart, gcdDuration, gcdModrate = nil, nil, nil + gcdSpellName, gcdSpellIcon = nil, nil + gcdEndCheck = 0 end - if(event and not WeakAuras.IsPaused()) then - WeakAuras.ScanEvents(event); + if event and not WeakAuras.IsPaused() then + WeakAuras.ScanEvents(event) end end @@ -1870,7 +1870,7 @@ do Recheck = function(self, id) self.handles[id] = nil self.expirationTime[id] = nil - CheckGCD(); + CheckGCD() Private.CheckSpellCooldown(id, GetRuneDuration()) end, Schedule = function(self, expirationTime, id) @@ -1887,7 +1887,7 @@ do self.expirationTime[id] = expirationTime end end - end + end, } local function FetchSpellCooldown(self, id) @@ -1907,7 +1907,7 @@ do changed = true nowReady = true end - local endTime = startTime + duration; + local endTime = startTime + duration if endTime <= time then startTime = 0 duration = 0 @@ -1915,9 +1915,7 @@ do end if duration > 0 then - if (startTime == gcdStart and duration == gcdDuration) - or (WeakAuras.IsClassicOrBCCOrWrath() and duration == shootDuration and startTime == shootStart) - then + if (startTime == gcdStart and duration == gcdDuration) or (WeakAuras.IsClassicOrBCCOrWrath() and duration == shootDuration and startTime == shootStart) then -- GCD cooldown, this could mean that the spell reset! if self.expirationTime[id] and self.expirationTime[id] > endTime and self.expirationTime[id] ~= 0 then self.duration[id] = 0 @@ -1969,83 +1967,89 @@ do modRate = {}, handles = {}, -- Share handles, and use lowest time to schedule HandleSpell = HandleSpell, - FetchSpellCooldown = FetchSpellCooldown + FetchSpellCooldown = FetchSpellCooldown, } return cd end - local spellCds = CreateSpellCDHandler(); - local spellCdsRune = CreateSpellCDHandler(); - local spellCdsOnlyCooldown = CreateSpellCDHandler(); - local spellCdsOnlyCooldownRune = CreateSpellCDHandler(); - local spellCdsCharges = CreateSpellCDHandler(); + local spellCds = CreateSpellCDHandler() + local spellCdsRune = CreateSpellCDHandler() + local spellCdsOnlyCooldown = CreateSpellCDHandler() + local spellCdsOnlyCooldownRune = CreateSpellCDHandler() + local spellCdsCharges = CreateSpellCDHandler() local spellDetails = {} function WeakAuras.InitCooldownReady() - cdReadyFrame = CreateFrame("Frame"); + cdReadyFrame = CreateFrame("Frame") WeakAuras.frames["Cooldown Trigger Handler"] = cdReadyFrame if WeakAuras.IsRetail() then - cdReadyFrame:RegisterEvent("RUNE_POWER_UPDATE"); - cdReadyFrame:RegisterEvent("PLAYER_TALENT_UPDATE"); - cdReadyFrame:RegisterEvent("PLAYER_PVP_TALENT_UPDATE"); + cdReadyFrame:RegisterEvent("RUNE_POWER_UPDATE") + cdReadyFrame:RegisterEvent("PLAYER_TALENT_UPDATE") + cdReadyFrame:RegisterEvent("PLAYER_PVP_TALENT_UPDATE") else - cdReadyFrame:RegisterEvent("CHARACTER_POINTS_CHANGED"); + cdReadyFrame:RegisterEvent("CHARACTER_POINTS_CHANGED") end - cdReadyFrame:RegisterEvent("SPELL_UPDATE_COOLDOWN"); - cdReadyFrame:RegisterEvent("SPELL_UPDATE_CHARGES"); - cdReadyFrame:RegisterEvent("UNIT_SPELLCAST_SENT"); - cdReadyFrame:RegisterEvent("BAG_UPDATE_COOLDOWN"); + cdReadyFrame:RegisterEvent("SPELL_UPDATE_COOLDOWN") + cdReadyFrame:RegisterEvent("SPELL_UPDATE_CHARGES") + cdReadyFrame:RegisterEvent("UNIT_SPELLCAST_SENT") + cdReadyFrame:RegisterEvent("BAG_UPDATE_COOLDOWN") cdReadyFrame:RegisterEvent("UNIT_INVENTORY_CHANGED") - cdReadyFrame:RegisterEvent("PLAYER_EQUIPMENT_CHANGED"); - cdReadyFrame:RegisterEvent("ACTIONBAR_UPDATE_COOLDOWN"); - cdReadyFrame:RegisterEvent("SPELLS_CHANGED"); - cdReadyFrame:RegisterEvent("PLAYER_ENTERING_WORLD"); + cdReadyFrame:RegisterEvent("PLAYER_EQUIPMENT_CHANGED") + cdReadyFrame:RegisterEvent("ACTIONBAR_UPDATE_COOLDOWN") + cdReadyFrame:RegisterEvent("SPELLS_CHANGED") + cdReadyFrame:RegisterEvent("PLAYER_ENTERING_WORLD") if WeakAuras.IsWrathClassic() then - cdReadyFrame:RegisterEvent("RUNE_POWER_UPDATE"); - cdReadyFrame:RegisterEvent("RUNE_TYPE_UPDATE"); + cdReadyFrame:RegisterEvent("RUNE_POWER_UPDATE") + cdReadyFrame:RegisterEvent("RUNE_TYPE_UPDATE") end cdReadyFrame:SetScript("OnEvent", function(self, event, ...) - Private.StartProfileSystem("generictrigger cd tracking"); - if(event == "SPELL_UPDATE_COOLDOWN" or event == "SPELL_UPDATE_CHARGES" - or event == "RUNE_POWER_UPDATE" or event == "ACTIONBAR_UPDATE_COOLDOWN" - or event == "PLAYER_TALENT_UPDATE" or event == "PLAYER_PVP_TALENT_UPDATE" - or event == "CHARACTER_POINTS_CHANGED" or event == "RUNE_TYPE_UPDATE") then - Private.CheckCooldownReady(); - elseif(event == "SPELLS_CHANGED") then - Private.CheckSpellKnown(); - Private.CheckCooldownReady(); - elseif(event == "UNIT_SPELLCAST_SENT") then - local unit, guid, castGUID, name = ...; - if(unit == "player") then - name = GetSpellInfo(name); - if(gcdSpellName ~= name) then - local icon = GetSpellTexture(name); - gcdSpellName = name; - gcdSpellIcon = icon; + Private.StartProfileSystem("generictrigger cd tracking") + if + event == "SPELL_UPDATE_COOLDOWN" + or event == "SPELL_UPDATE_CHARGES" + or event == "RUNE_POWER_UPDATE" + or event == "ACTIONBAR_UPDATE_COOLDOWN" + or event == "PLAYER_TALENT_UPDATE" + or event == "PLAYER_PVP_TALENT_UPDATE" + or event == "CHARACTER_POINTS_CHANGED" + or event == "RUNE_TYPE_UPDATE" + then + Private.CheckCooldownReady() + elseif event == "SPELLS_CHANGED" then + Private.CheckSpellKnown() + Private.CheckCooldownReady() + elseif event == "UNIT_SPELLCAST_SENT" then + local unit, guid, castGUID, name = ... + if unit == "player" then + name = GetSpellInfo(name) + if gcdSpellName ~= name then + local icon = GetSpellTexture(name) + gcdSpellName = name + gcdSpellIcon = icon if not WeakAuras.IsPaused() then WeakAuras.ScanEvents("GCD_UPDATE") end end end - elseif(event == "UNIT_INVENTORY_CHANGED" or event == "BAG_UPDATE_COOLDOWN" or event == "PLAYER_EQUIPMENT_CHANGED") then - Private.CheckItemSlotCooldowns(); + elseif event == "UNIT_INVENTORY_CHANGED" or event == "BAG_UPDATE_COOLDOWN" or event == "PLAYER_EQUIPMENT_CHANGED" then + Private.CheckItemSlotCooldowns() end - Private.StopProfileSystem("generictrigger cd tracking"); - end); + Private.StopProfileSystem("generictrigger cd tracking") + end) end function WeakAuras.GetRuneCooldown(id) - if(runes[id] and runeCdExps[id] and runeCdDurs[id]) then - return runeCdExps[id] - runeCdDurs[id], runeCdDurs[id]; + if runes[id] and runeCdExps[id] and runeCdDurs[id] then + return runeCdExps[id] - runeCdDurs[id], runeCdDurs[id] else - return 0, 0; + return 0, 0 end end function WeakAuras.GetSpellCooldown(id, ignoreRuneCD, showgcd, ignoreSpellKnown, track) - if (not spellKnown[id] and not ignoreSpellKnown) then - return; + if not spellKnown[id] and not ignoreSpellKnown then + return end local startTime, duration, gcdCooldown, readyTime, modRate if track == "charges" then @@ -2056,18 +2060,18 @@ do else startTime, duration, readyTime, modRate = spellCdsOnlyCooldown:FetchSpellCooldown(id) end - elseif (ignoreRuneCD) then + elseif ignoreRuneCD then startTime, duration, readyTime, modRate = spellCdsRune:FetchSpellCooldown(id) else startTime, duration, readyTime, modRate = spellCds:FetchSpellCooldown(id) end - if (showgcd) then - if ((gcdStart or 0) + (gcdDuration or 0) > startTime + duration) then - startTime = gcdStart; - duration = gcdDuration; + if showgcd then + if (gcdStart or 0) + (gcdDuration or 0) > startTime + duration then + startTime = gcdStart + duration = gcdDuration modRate = gcdModrate - gcdCooldown = true; + gcdCooldown = true end end @@ -2075,179 +2079,179 @@ do end function WeakAuras.GetSpellCharges(id, ignoreSpellKnown) - if (not spellKnown[id] and not ignoreSpellKnown) then - return; + if not spellKnown[id] and not ignoreSpellKnown then + return end return spellCharges[id], spellChargesMax[id], spellCounts[id], spellChargeGainTime[id], spellChargeLostTime[id] end function WeakAuras.GetItemCooldown(id, showgcd) - local startTime, duration, enabled, gcdCooldown; - if(items[id] and itemCdExps[id] and itemCdDurs[id]) then - startTime, duration, enabled = itemCdExps[id] - itemCdDurs[id], itemCdDurs[id], itemCdEnabled[id]; + local startTime, duration, enabled, gcdCooldown + if items[id] and itemCdExps[id] and itemCdDurs[id] then + startTime, duration, enabled = itemCdExps[id] - itemCdDurs[id], itemCdDurs[id], itemCdEnabled[id] else - startTime, duration, enabled = 0, 0, itemCdEnabled[id] or 1; + startTime, duration, enabled = 0, 0, itemCdEnabled[id] or 1 end - if (showgcd) then - if ((gcdStart or 0) + (gcdDuration or 0) > startTime + duration) then - startTime = gcdStart; - duration = gcdDuration; - gcdCooldown = true; + if showgcd then + if (gcdStart or 0) + (gcdDuration or 0) > startTime + duration then + startTime = gcdStart + duration = gcdDuration + gcdCooldown = true end end - return startTime, duration, enabled, gcdCooldown; + return startTime, duration, enabled, gcdCooldown end function WeakAuras.GetGCDInfo() - if(gcdStart) then - return gcdDuration, gcdStart + gcdDuration, gcdSpellName or "Invalid", gcdSpellIcon or "Interface\\Icons\\INV_Misc_QuestionMark", gcdModrate; + if gcdStart then + return gcdDuration, gcdStart + gcdDuration, gcdSpellName or "Invalid", gcdSpellIcon or "Interface\\Icons\\INV_Misc_QuestionMark", gcdModrate else - return 0, math.huge, gcdSpellName or "Invalid", gcdSpellIcon or "Interface\\Icons\\INV_Misc_QuestionMark", 1.0; + return 0, math.huge, gcdSpellName or "Invalid", gcdSpellIcon or "Interface\\Icons\\INV_Misc_QuestionMark", 1.0 end end function WeakAuras.gcdDuration() - return gcdDuration or 0; + return gcdDuration or 0 end function WeakAuras.GcdSpellName() - return gcdSpellName; + return gcdSpellName end function WeakAuras.GetItemSlotCooldown(id, showgcd) - local startTime, duration, enabled, gcdCooldown; - if(itemSlots[id] and itemSlotsCdExps[id] and itemSlotsCdDurs[id]) then - startTime, duration, enabled = itemSlotsCdExps[id] - itemSlotsCdDurs[id], itemSlotsCdDurs[id], itemSlotsEnable[id]; + local startTime, duration, enabled, gcdCooldown + if itemSlots[id] and itemSlotsCdExps[id] and itemSlotsCdDurs[id] then + startTime, duration, enabled = itemSlotsCdExps[id] - itemSlotsCdDurs[id], itemSlotsCdDurs[id], itemSlotsEnable[id] else - startTime, duration, enabled = 0, 0, itemSlotsEnable[id]; + startTime, duration, enabled = 0, 0, itemSlotsEnable[id] end - if (showgcd) then - if ((gcdStart or 0) + (gcdDuration or 0) > startTime + duration) then - startTime = gcdStart; - duration = gcdDuration; - gcdCooldown = true; + if showgcd then + if (gcdStart or 0) + (gcdDuration or 0) > startTime + duration then + startTime = gcdStart + duration = gcdDuration + gcdCooldown = true end end - return startTime, duration, enabled, gcdCooldown; + return startTime, duration, enabled, gcdCooldown end local function RuneCooldownFinished(id) - runeCdHandles[id] = nil; - runeCdDurs[id] = nil; - runeCdExps[id] = nil; - WeakAuras.ScanEvents("RUNE_COOLDOWN_READY", id); + runeCdHandles[id] = nil + runeCdDurs[id] = nil + runeCdExps[id] = nil + WeakAuras.ScanEvents("RUNE_COOLDOWN_READY", id) end local function ItemCooldownFinished(id) - itemCdHandles[id] = nil; - itemCdDurs[id] = nil; - itemCdExps[id] = nil; - itemCdEnabled[id] = 1; - WeakAuras.ScanEvents("ITEM_COOLDOWN_READY", id); + itemCdHandles[id] = nil + itemCdDurs[id] = nil + itemCdExps[id] = nil + itemCdEnabled[id] = 1 + WeakAuras.ScanEvents("ITEM_COOLDOWN_READY", id) end local function ItemSlotCooldownFinished(id) - itemSlotsCdHandles[id] = nil; - itemSlotsCdDurs[id] = nil; - itemSlotsCdExps[id] = nil; - WeakAuras.ScanEvents("ITEM_SLOT_COOLDOWN_READY", id); + itemSlotsCdHandles[id] = nil + itemSlotsCdDurs[id] = nil + itemSlotsCdExps[id] = nil + WeakAuras.ScanEvents("ITEM_SLOT_COOLDOWN_READY", id) end function Private.CheckRuneCooldown() - local runeDuration = -100; + local runeDuration = -100 for id, _ in pairs(runes) do - local startTime, duration = GetRuneCooldown(id); - startTime = startTime or 0; - duration = duration or 0; + local startTime, duration = GetRuneCooldown(id) + startTime = startTime or 0 + duration = duration or 0 runeDuration = duration > 0 and duration or runeDuration - local time = GetTime(); + local time = GetTime() - if(not startTime or startTime == 0) then + if not startTime or startTime == 0 then startTime = 0 duration = 0 end - if(duration > 0 and duration ~= WeakAuras.gcdDuration()) then + if duration > 0 and duration ~= WeakAuras.gcdDuration() then -- On non-GCD cooldown - local endTime = startTime + duration; + local endTime = startTime + duration - if not(runeCdExps[id]) then + if not runeCdExps[id] then -- New cooldown - runeCdDurs[id] = duration; - runeCdExps[id] = endTime; - runeCdHandles[id] = timer:ScheduleTimerFixed(RuneCooldownFinished, endTime - time, id); - WeakAuras.ScanEvents("RUNE_COOLDOWN_STARTED", id); - elseif(runeCdExps[id] ~= endTime) then + runeCdDurs[id] = duration + runeCdExps[id] = endTime + runeCdHandles[id] = timer:ScheduleTimerFixed(RuneCooldownFinished, endTime - time, id) + WeakAuras.ScanEvents("RUNE_COOLDOWN_STARTED", id) + elseif runeCdExps[id] ~= endTime then -- Cooldown is now different - if(runeCdHandles[id]) then - timer:CancelTimer(runeCdHandles[id]); + if runeCdHandles[id] then + timer:CancelTimer(runeCdHandles[id]) end - runeCdDurs[id] = duration; - runeCdExps[id] = endTime; - runeCdHandles[id] = timer:ScheduleTimerFixed(RuneCooldownFinished, endTime - time, id); - WeakAuras.ScanEvents("RUNE_COOLDOWN_CHANGED", id); + runeCdDurs[id] = duration + runeCdExps[id] = endTime + runeCdHandles[id] = timer:ScheduleTimerFixed(RuneCooldownFinished, endTime - time, id) + WeakAuras.ScanEvents("RUNE_COOLDOWN_CHANGED", id) end - elseif(duration > 0) then + elseif duration > 0 then -- GCD, do nothing else - if(runeCdExps[id]) then + if runeCdExps[id] then -- Somehow CheckCooldownReady caught the rune cooldown before the timer callback -- This shouldn't happen, but if it does, no problem - if(runeCdHandles[id]) then - timer:CancelTimer(runeCdHandles[id]); + if runeCdHandles[id] then + timer:CancelTimer(runeCdHandles[id]) end - RuneCooldownFinished(id); + RuneCooldownFinished(id) end end end - return runeDuration; + return runeDuration end function WeakAuras.GetSpellCooldownUnified(id, runeDuration) local startTimeCooldown, durationCooldown, enabled, modRate = GetSpellCooldown(id) - local charges, maxCharges, startTimeCharges, durationCharges, modRateCharges = GetSpellCharges(id); + local charges, maxCharges, startTimeCharges, durationCharges, modRateCharges = GetSpellCharges(id) - startTimeCooldown = startTimeCooldown or 0; - durationCooldown = durationCooldown or 0; + startTimeCooldown = startTimeCooldown or 0 + durationCooldown = durationCooldown or 0 - startTimeCharges = startTimeCharges or 0; - durationCharges = durationCharges or 0; + startTimeCharges = startTimeCharges or 0 + durationCharges = durationCharges or 0 - modRate = modRate or 1.0; - modRateCharges = modRateCharges or 1.0; + modRate = modRate or 1.0 + modRateCharges = modRateCharges or 1.0 -- WORKAROUND Sometimes the API returns very high bogus numbers causing client freezes, discard them here. CurseForge issue #1008 - if (durationCooldown > 604800) then - durationCooldown = 0; - startTimeCooldown = 0; + if durationCooldown > 604800 then + durationCooldown = 0 + startTimeCooldown = 0 end - if (startTimeCooldown > GetTime() + 2^31 / 1000) then + if startTimeCooldown > GetTime() + 2 ^ 31 / 1000 then -- WORKAROUND WoW wraps around negative values with 2^32/1000 -- So if we find a cooldown in the far future, then undo the wrapping - startTimeCooldown = startTimeCooldown - 2^32 / 1000 + startTimeCooldown = startTimeCooldown - 2 ^ 32 / 1000 end -- Default to GetSpellCharges - local unifiedCooldownBecauseRune, cooldownBecauseRune = false, false; - if (enabled == 0) then + local unifiedCooldownBecauseRune, cooldownBecauseRune = false, false + if enabled == 0 then startTimeCooldown, durationCooldown = 0, 0 end - local onNonGCDCD = durationCooldown and startTimeCooldown and durationCooldown > 0 and (durationCooldown ~= gcdDuration or startTimeCooldown ~= gcdStart); - if (onNonGCDCD) then - cooldownBecauseRune = runeDuration and durationCooldown and abs(durationCooldown - runeDuration) < 0.001; + local onNonGCDCD = durationCooldown and startTimeCooldown and durationCooldown > 0 and (durationCooldown ~= gcdDuration or startTimeCooldown ~= gcdStart) + if onNonGCDCD then + cooldownBecauseRune = runeDuration and durationCooldown and abs(durationCooldown - runeDuration) < 0.001 unifiedCooldownBecauseRune = cooldownBecauseRune end local startTime, duration, unifiedModRate = startTimeCooldown, durationCooldown, modRate - if (charges == nil) then + if charges == nil then -- charges is nil if the spell has no charges. -- Nothing to do in that case - elseif (charges == maxCharges) then + elseif charges == maxCharges then -- At max charges, - startTime, duration = 0, 0; + startTime, duration = 0, 0 startTimeCharges, durationCharges = 0, 0 else -- Spells can return both information via GetSpellCooldown and GetSpellCharges @@ -2269,16 +2273,27 @@ do count = GetSpellCount(id) end - return charges, maxCharges, startTime, duration, unifiedCooldownBecauseRune, - startTimeCooldown, durationCooldown, cooldownBecauseRune, startTimeCharges, durationCharges, - count, unifiedModRate, modRate, modRateCharges; + return charges, + maxCharges, + startTime, + duration, + unifiedCooldownBecauseRune, + startTimeCooldown, + durationCooldown, + cooldownBecauseRune, + startTimeCharges, + durationCharges, + count, + unifiedModRate, + modRate, + modRateCharges end function Private.CheckSpellKnown() for id, _ in pairs(spells) do - local known = WeakAuras.IsSpellKnownIncludingPet(id); + local known = WeakAuras.IsSpellKnownIncludingPet(id) local changed = false - if (known ~= spellKnown[id]) then + if known ~= spellKnown[id] then spellKnown[id] = known changed = true end @@ -2300,24 +2315,20 @@ do if changed and not WeakAuras.IsPaused() then WeakAuras.ScanEvents("SPELL_COOLDOWN_CHANGED", id) end - end end function Private.CheckSpellCooldown(id, runeDuration) - local charges, maxCharges, startTime, duration, unifiedCooldownBecauseRune, - startTimeCooldown, durationCooldown, cooldownBecauseRune, startTimeCharges, durationCharges, - spellCount, unifiedModRate, modRate, modRateCharges - = WeakAuras.GetSpellCooldownUnified(id, runeDuration); + local charges, maxCharges, startTime, duration, unifiedCooldownBecauseRune, startTimeCooldown, durationCooldown, cooldownBecauseRune, startTimeCharges, durationCharges, spellCount, unifiedModRate, modRate, modRateCharges = + WeakAuras.GetSpellCooldownUnified(id, runeDuration) - local time = GetTime(); - local remaining = startTime + duration - time; + local time = GetTime() + local remaining = startTime + duration - time - local chargesChanged = spellCharges[id] ~= charges or spellCounts[id] ~= spellCount - or spellChargesMax[id] ~= maxCharges + local chargesChanged = spellCharges[id] ~= charges or spellCounts[id] ~= spellCount or spellChargesMax[id] ~= maxCharges local chargesDifference = (charges or spellCount or 0) - (spellCharges[id] or spellCount or 0) - spellCharges[id] = charges; - spellChargesMax[id] = maxCharges; + spellCharges[id] = charges + spellChargesMax[id] = maxCharges spellCounts[id] = spellCount if chargesDifference ~= 0 then if chargesDifference > 0 then @@ -2345,15 +2356,15 @@ do if not WeakAuras.IsPaused() then if nowReady then - WeakAuras.ScanEvents("SPELL_COOLDOWN_READY", id); + WeakAuras.ScanEvents("SPELL_COOLDOWN_READY", id) end if changed or chargesChanged then - WeakAuras.ScanEvents("SPELL_COOLDOWN_CHANGED", id); + WeakAuras.ScanEvents("SPELL_COOLDOWN_CHANGED", id) end - if (chargesDifference ~= 0 ) then - WeakAuras.ScanEvents("SPELL_CHARGES_CHANGED", id, chargesDifference, charges or spellCount or 0); + if chargesDifference ~= 0 then + WeakAuras.ScanEvents("SPELL_CHARGES_CHANGED", id, chargesDifference, charges or spellCount or 0) end end end @@ -2366,198 +2377,200 @@ do function Private.CheckItemCooldowns() for id, _ in pairs(items) do - local startTime, duration, enabled = GetItemCooldown(id); - if (duration == 0) then - enabled = 1; + local startTime, duration, enabled = GetItemCooldown(id) + if duration == 0 then + enabled = 1 end - if (enabled == 0) then + if enabled == 0 then startTime, duration = 0, 0 end - local itemCdEnabledChanged = (itemCdEnabled[id] ~= enabled); - itemCdEnabled[id] = enabled; - startTime = startTime or 0; - duration = duration or 0; - local time = GetTime(); + local itemCdEnabledChanged = (itemCdEnabled[id] ~= enabled) + itemCdEnabled[id] = enabled + startTime = startTime or 0 + duration = duration or 0 + local time = GetTime() -- We check against 1.5 and gcdDuration, as apparently the durations might not match exactly. -- But there shouldn't be any trinket with a actual cd of less than 1.5 anyway - if(duration > 0 and duration > 1.5 and duration ~= WeakAuras.gcdDuration()) then + if duration > 0 and duration > 1.5 and duration ~= WeakAuras.gcdDuration() then -- On non-GCD cooldown - local endTime = startTime + duration; + local endTime = startTime + duration - if not(itemCdExps[id]) then + if not itemCdExps[id] then -- New cooldown - itemCdDurs[id] = duration; - itemCdExps[id] = endTime; - itemCdHandles[id] = timer:ScheduleTimerFixed(ItemCooldownFinished, endTime - time, id); + itemCdDurs[id] = duration + itemCdExps[id] = endTime + itemCdHandles[id] = timer:ScheduleTimerFixed(ItemCooldownFinished, endTime - time, id) if not WeakAuras.IsPaused() then WeakAuras.ScanEvents("ITEM_COOLDOWN_STARTED", id) end - itemCdEnabledChanged = false; - elseif(itemCdExps[id] ~= endTime) then + itemCdEnabledChanged = false + elseif itemCdExps[id] ~= endTime then -- Cooldown is now different - if(itemCdHandles[id]) then - timer:CancelTimer(itemCdHandles[id]); + if itemCdHandles[id] then + timer:CancelTimer(itemCdHandles[id]) end - itemCdDurs[id] = duration; - itemCdExps[id] = endTime; - itemCdHandles[id] = timer:ScheduleTimerFixed(ItemCooldownFinished, endTime - time, id); + itemCdDurs[id] = duration + itemCdExps[id] = endTime + itemCdHandles[id] = timer:ScheduleTimerFixed(ItemCooldownFinished, endTime - time, id) if not WeakAuras.IsPaused() then WeakAuras.ScanEvents("ITEM_COOLDOWN_CHANGED", id) end - itemCdEnabledChanged = false; + itemCdEnabledChanged = false end - elseif(duration > 0) then + elseif duration > 0 then -- GCD, do nothing else - if(itemCdExps[id]) then + if itemCdExps[id] then -- Somehow CheckCooldownReady caught the item cooldown before the timer callback -- This shouldn't happen, but if it does, no problem - if(itemCdHandles[id]) then - timer:CancelTimer(itemCdHandles[id]); + if itemCdHandles[id] then + timer:CancelTimer(itemCdHandles[id]) end - ItemCooldownFinished(id); - itemCdEnabledChanged = false; + ItemCooldownFinished(id) + itemCdEnabledChanged = false end end - if (itemCdEnabledChanged and not WeakAuras.IsPaused()) then - WeakAuras.ScanEvents("ITEM_COOLDOWN_CHANGED", id); + if itemCdEnabledChanged and not WeakAuras.IsPaused() then + WeakAuras.ScanEvents("ITEM_COOLDOWN_CHANGED", id) end end end function Private.CheckItemSlotCooldowns() for id, itemId in pairs(itemSlots) do - local startTime, duration, enable = GetInventoryItemCooldown("player", id); - itemSlotsEnable[id] = enable; - startTime = startTime or 0; - duration = duration or 0; - local time = GetTime(); + local startTime, duration, enable = GetInventoryItemCooldown("player", id) + itemSlotsEnable[id] = enable + startTime = startTime or 0 + duration = duration or 0 + local time = GetTime() -- We check against 1.5 and gcdDuration, as apparently the durations might not match exactly. -- But there shouldn't be any trinket with a actual cd of less than 1.5 anyway - if(duration > 0 and duration > 1.5 and duration ~= WeakAuras.gcdDuration()) then + if duration > 0 and duration > 1.5 and duration ~= WeakAuras.gcdDuration() then -- On non-GCD cooldown - local endTime = startTime + duration; + local endTime = startTime + duration - if not(itemSlotsCdExps[id]) then + if not itemSlotsCdExps[id] then -- New cooldown - itemSlotsCdDurs[id] = duration; - itemSlotsCdExps[id] = endTime; - itemSlotsCdHandles[id] = timer:ScheduleTimerFixed(ItemSlotCooldownFinished, endTime - time, id); + itemSlotsCdDurs[id] = duration + itemSlotsCdExps[id] = endTime + itemSlotsCdHandles[id] = timer:ScheduleTimerFixed(ItemSlotCooldownFinished, endTime - time, id) if not WeakAuras.IsPaused() then WeakAuras.ScanEvents("ITEM_SLOT_COOLDOWN_STARTED", id) end - elseif(itemSlotsCdExps[id] ~= endTime) then + elseif itemSlotsCdExps[id] ~= endTime then -- Cooldown is now different - if(itemSlotsCdHandles[id]) then - timer:CancelTimer(itemSlotsCdHandles[id]); + if itemSlotsCdHandles[id] then + timer:CancelTimer(itemSlotsCdHandles[id]) end - itemSlotsCdDurs[id] = duration; - itemSlotsCdExps[id] = endTime; - itemSlotsCdHandles[id] = timer:ScheduleTimerFixed(ItemSlotCooldownFinished, endTime - time, id); + itemSlotsCdDurs[id] = duration + itemSlotsCdExps[id] = endTime + itemSlotsCdHandles[id] = timer:ScheduleTimerFixed(ItemSlotCooldownFinished, endTime - time, id) if not WeakAuras.IsPaused() then WeakAuras.ScanEvents("ITEM_SLOT_COOLDOWN_CHANGED", id) end end - elseif(duration > 0) then + elseif duration > 0 then -- GCD, do nothing else - if(itemSlotsCdExps[id]) then + if itemSlotsCdExps[id] then -- Somehow CheckCooldownReady caught the item cooldown before the timer callback -- This shouldn't happen, but if it does, no problem - if(itemSlotsCdHandles[id]) then - timer:CancelTimer(itemSlotsCdHandles[id]); + if itemSlotsCdHandles[id] then + timer:CancelTimer(itemSlotsCdHandles[id]) end - ItemSlotCooldownFinished(id); + ItemSlotCooldownFinished(id) end end - local newItemId = GetInventoryItemID("player", id); - if (itemId ~= newItemId) then + local newItemId = GetInventoryItemID("player", id) + if itemId ~= newItemId then if not WeakAuras.IsPaused() then WeakAuras.ScanEvents("ITEM_SLOT_COOLDOWN_ITEM_CHANGED") end - itemSlots[id] = newItemId or 0; + itemSlots[id] = newItemId or 0 end end end function Private.CheckCooldownReady() - CheckGCD(); - local runeDuration = Private.CheckRuneCooldown(); - Private.CheckSpellCooldows(runeDuration); - Private.CheckItemCooldowns(); - Private.CheckItemSlotCooldowns(); + CheckGCD() + local runeDuration = Private.CheckRuneCooldown() + Private.CheckSpellCooldows(runeDuration) + Private.CheckItemCooldowns() + Private.CheckItemSlotCooldowns() end function WeakAuras.WatchGCD() - if not(cdReadyFrame) then - WeakAuras.InitCooldownReady(); + if not cdReadyFrame then + WeakAuras.InitCooldownReady() end end function WeakAuras.WatchRuneCooldown(id) - if not(cdReadyFrame) then - WeakAuras.InitCooldownReady(); + if not cdReadyFrame then + WeakAuras.InitCooldownReady() end - if not id or id == 0 then return end + if not id or id == 0 then + return + end - if not(runes[id]) then - runes[id] = true; - local startTime, duration = GetRuneCooldown(id); + if not runes[id] then + runes[id] = true + local startTime, duration = GetRuneCooldown(id) - if(not startTime or startTime == 0) then + if not startTime or startTime == 0 then startTime = 0 duration = 0 end - if(duration > 0 and duration ~= WeakAuras.gcdDuration()) then - local time = GetTime(); - local endTime = startTime + duration; - runeCdDurs[id] = duration; - runeCdExps[id] = endTime; - if not(runeCdHandles[id]) then - runeCdHandles[id] = timer:ScheduleTimerFixed(RuneCooldownFinished, endTime - time, id); + if duration > 0 and duration ~= WeakAuras.gcdDuration() then + local time = GetTime() + local endTime = startTime + duration + runeCdDurs[id] = duration + runeCdExps[id] = endTime + if not runeCdHandles[id] then + runeCdHandles[id] = timer:ScheduleTimerFixed(RuneCooldownFinished, endTime - time, id) end end end end function WeakAuras.WatchSpellCooldown(id, ignoreRunes) - if not(cdReadyFrame) then - WeakAuras.InitCooldownReady(); + if not cdReadyFrame then + WeakAuras.InitCooldownReady() end - if not id or id == 0 then return end + if not id or id == 0 then + return + end if ignoreRunes and WeakAuras.IsWrathOrRetail() then for i = 1, 6 do - WeakAuras.WatchRuneCooldown(i); + WeakAuras.WatchRuneCooldown(i) end end - if (spells[id]) then - return; + if spells[id] then + return end - spells[id] = true; + spells[id] = true local name, _, icon, _, _, _, spellId = GetSpellInfo(id) spellDetails[id] = { name = name, icon = icon, - id = spellId + id = spellId, } - spellKnown[id] = WeakAuras.IsSpellKnownIncludingPet(id); + spellKnown[id] = WeakAuras.IsSpellKnownIncludingPet(id) - local charges, maxCharges, startTime, duration, unifiedCooldownBecauseRune, - startTimeCooldown, durationCooldown, cooldownBecauseRune, startTimeCharges, durationCharges, - spellCount, unifiedModRate, modRate, modRateCharges - = WeakAuras.GetSpellCooldownUnified(id, GetRuneDuration()); + local charges, maxCharges, startTime, duration, unifiedCooldownBecauseRune, startTimeCooldown, durationCooldown, cooldownBecauseRune, startTimeCharges, durationCharges, spellCount, unifiedModRate, modRate, modRateCharges = + WeakAuras.GetSpellCooldownUnified(id, GetRuneDuration()) - spellCharges[id] = charges; - spellChargesMax[id] = maxCharges; + spellCharges[id] = charges + spellChargesMax[id] = maxCharges spellCounts[id] = spellCount spellCds:HandleSpell(id, startTime, duration, unifiedModRate) if not unifiedCooldownBecauseRune then @@ -2571,52 +2584,56 @@ do end function WeakAuras.WatchItemCooldown(id) - if not(cdReadyFrame) then - WeakAuras.InitCooldownReady(); + if not cdReadyFrame then + WeakAuras.InitCooldownReady() end - if not id or id == 0 then return end + if not id or id == 0 then + return + end - if not(items[id]) then - items[id] = true; - local startTime, duration, enabled = GetItemCooldown(id); - if (duration == 0) then - enabled = 1; + if not items[id] then + items[id] = true + local startTime, duration, enabled = GetItemCooldown(id) + if duration == 0 then + enabled = 1 end - if (enabled == 0) then + if enabled == 0 then startTime, duration = 0, 0 end - itemCdEnabled[id] = enabled; - if(duration > 0 and duration > 1.5 and duration ~= WeakAuras.gcdDuration()) then - local time = GetTime(); - local endTime = startTime + duration; - itemCdDurs[id] = duration; - itemCdExps[id] = endTime; - if not(itemCdHandles[id]) then - itemCdHandles[id] = timer:ScheduleTimerFixed(ItemCooldownFinished, endTime - time, id); + itemCdEnabled[id] = enabled + if duration > 0 and duration > 1.5 and duration ~= WeakAuras.gcdDuration() then + local time = GetTime() + local endTime = startTime + duration + itemCdDurs[id] = duration + itemCdExps[id] = endTime + if not itemCdHandles[id] then + itemCdHandles[id] = timer:ScheduleTimerFixed(ItemCooldownFinished, endTime - time, id) end end end end function WeakAuras.WatchItemSlotCooldown(id) - if not(cdReadyFrame) then - WeakAuras.InitCooldownReady(); - end - - if not id or id == 0 then return end - - if not(itemSlots[id]) then - itemSlots[id] = GetInventoryItemID("player", id); - local startTime, duration, enable = GetInventoryItemCooldown("player", id); - itemSlotsEnable[id] = enable; - if(duration > 0 and duration > 1.5 and duration ~= WeakAuras.gcdDuration()) then - local time = GetTime(); - local endTime = startTime + duration; - itemSlotsCdDurs[id] = duration; - itemSlotsCdExps[id] = endTime; - if not(itemSlotsCdHandles[id]) then - itemSlotsCdHandles[id] = timer:ScheduleTimerFixed(ItemSlotCooldownFinished, endTime - time, id); + if not cdReadyFrame then + WeakAuras.InitCooldownReady() + end + + if not id or id == 0 then + return + end + + if not itemSlots[id] then + itemSlots[id] = GetInventoryItemID("player", id) + local startTime, duration, enable = GetInventoryItemCooldown("player", id) + itemSlotsEnable[id] = enable + if duration > 0 and duration > 1.5 and duration ~= WeakAuras.gcdDuration() then + local time = GetTime() + local endTime = startTime + duration + itemSlotsCdDurs[id] = duration + itemSlotsCdExps[id] = endTime + if not itemSlotsCdHandles[id] then + itemSlotsCdHandles[id] = timer:ScheduleTimerFixed(ItemSlotCooldownFinished, endTime - time, id) end end end @@ -2624,18 +2641,18 @@ do end do - local spellActivationSpells = {}; - local spellActivationSpellsCurrent = {}; - local spellActivationFrame; + local spellActivationSpells = {} + local spellActivationSpellsCurrent = {} + local spellActivationFrame local function InitSpellActivation() - spellActivationFrame = CreateFrame("Frame"); - WeakAuras.frames["Spell Activation"] = spellActivationFrame; - spellActivationFrame:RegisterEvent("SPELL_ACTIVATION_OVERLAY_GLOW_SHOW"); - spellActivationFrame:RegisterEvent("SPELL_ACTIVATION_OVERLAY_GLOW_HIDE"); + spellActivationFrame = CreateFrame("Frame") + WeakAuras.frames["Spell Activation"] = spellActivationFrame + spellActivationFrame:RegisterEvent("SPELL_ACTIVATION_OVERLAY_GLOW_SHOW") + spellActivationFrame:RegisterEvent("SPELL_ACTIVATION_OVERLAY_GLOW_HIDE") spellActivationFrame:SetScript("OnEvent", function(self, event, spell) - Private.StartProfileSystem("generictrigger"); + Private.StartProfileSystem("generictrigger") local spellName = GetSpellInfo(spell) - if (spellActivationSpells[spell] or spellActivationSpells[spellName]) then + if spellActivationSpells[spell] or spellActivationSpells[spellName] then local active = (event == "SPELL_ACTIVATION_OVERLAY_GLOW_SHOW") spellActivationSpellsCurrent[spell] = active spellActivationSpellsCurrent[spellName] = active @@ -2644,22 +2661,22 @@ do end end - Private.StopProfileSystem("generictrigger"); - end); + Private.StopProfileSystem("generictrigger") + end) end function WeakAuras.WatchSpellActivation(id) - if (not id) then - return; + if not id then + return end - if (not spellActivationFrame) then - InitSpellActivation(); + if not spellActivationFrame then + InitSpellActivation() end - spellActivationSpells[id] = true; + spellActivationSpells[id] = true end function WeakAuras.SpellActivationActive(id) - return spellActivationSpellsCurrent[id]; + return spellActivationSpellsCurrent[id] end end @@ -2676,7 +2693,7 @@ end function WeakAuras.WatchUnitChange(unit) unit = string.lower(unit) if not watchUnitChange then - watchUnitChange = CreateFrame("Frame"); + watchUnitChange = CreateFrame("Frame") watchUnitChange.unitChangeGUIDS = {} watchUnitChange.unitRoles = {} watchUnitChange.unitRaidRole = {} @@ -2684,16 +2701,16 @@ function WeakAuras.WatchUnitChange(unit) watchUnitChange.nameplateFaction = {} watchUnitChange.raidmark = {} - WeakAuras.frames["Unit Change Frame"] = watchUnitChange; + WeakAuras.frames["Unit Change Frame"] = watchUnitChange watchUnitChange:RegisterEvent("PLAYER_TARGET_CHANGED") if not WeakAuras.IsClassic() then - watchUnitChange:RegisterEvent("PLAYER_FOCUS_CHANGED"); + watchUnitChange:RegisterEvent("PLAYER_FOCUS_CHANGED") else watchUnitChange:RegisterEvent("PLAYER_ROLES_ASSIGNED") end - watchUnitChange:RegisterEvent("UNIT_TARGET"); - watchUnitChange:RegisterEvent("INSTANCE_ENCOUNTER_ENGAGE_UNIT"); - watchUnitChange:RegisterEvent("GROUP_ROSTER_UPDATE"); + watchUnitChange:RegisterEvent("UNIT_TARGET") + watchUnitChange:RegisterEvent("INSTANCE_ENCOUNTER_ENGAGE_UNIT") + watchUnitChange:RegisterEvent("GROUP_ROSTER_UPDATE") watchUnitChange:RegisterEvent("NAME_PLATE_UNIT_ADDED") watchUnitChange:RegisterEvent("NAME_PLATE_UNIT_REMOVED") watchUnitChange:RegisterEvent("UNIT_FACTION") @@ -2702,7 +2719,7 @@ function WeakAuras.WatchUnitChange(unit) watchUnitChange:RegisterEvent("RAID_TARGET_UPDATE") watchUnitChange:SetScript("OnEvent", function(self, event, unit) - Private.StartProfileSystem("generictrigger unit change"); + Private.StartProfileSystem("generictrigger unit change") if event == "NAME_PLATE_UNIT_ADDED" or event == "NAME_PLATE_UNIT_REMOVED" then local newGuid = WeakAuras.UnitExistsFixed(unit) and UnitGUID(unit) or "" local newMarker = GetRaidTargetIndex(unit) or 0 @@ -2742,10 +2759,7 @@ function WeakAuras.WatchUnitChange(unit) for unit, guid in pairs(watchUnitChange.unitChangeGUIDS) do local newGuid = WeakAuras.UnitExistsFixed(unit) and UnitGUID(unit) or "" local newMarker = GetRaidTargetIndex(unit) or 0 - if guid ~= newGuid - or newMarker ~= watchUnitChange.raidmark[unit] - or event == "PLAYER_ENTERING_WORLD" - then + if guid ~= newGuid or newMarker ~= watchUnitChange.raidmark[unit] or event == "PLAYER_ENTERING_WORLD" then WeakAuras.ScanEvents("UNIT_CHANGED_" .. unit, unit) watchUnitChange.unitChangeGUIDS[unit] = newGuid watchUnitChange.raidmark[unit] = newMarker @@ -2773,7 +2787,7 @@ function WeakAuras.WatchUnitChange(unit) end watchUnitChange.inRaid = inRaid end - Private.StopProfileSystem("generictrigger unit change"); + Private.StopProfileSystem("generictrigger unit change") end) end watchUnitChange.unitChangeGUIDS = watchUnitChange.unitChangeGUIDS or {} @@ -2783,28 +2797,27 @@ function WeakAuras.WatchUnitChange(unit) end function WeakAuras.GetEquipmentSetInfo(itemSetName, partial) - local bestMatchNumItems = 0; - local bestMatchNumEquipped = 0; - local bestMatchName = nil; - local bestMatchIcon = nil; + local bestMatchNumItems = 0 + local bestMatchNumEquipped = 0 + local bestMatchName = nil + local bestMatchIcon = nil - local equipmentSetIds = C_EquipmentSet.GetEquipmentSetIDs(); + local equipmentSetIds = C_EquipmentSet.GetEquipmentSetIDs() for index, id in pairs(equipmentSetIds) do - local name, icon, _, _, numItems, numEquipped = C_EquipmentSet.GetEquipmentSetInfo(id); - if (itemSetName == nil or (name and itemSetName == name)) then - if (name ~= nil) then - local match = (not partial and numItems == numEquipped) - or (partial and (numEquipped or 0) > bestMatchNumEquipped); - if (match) then - bestMatchNumEquipped = numEquipped; - bestMatchNumItems = numItems; - bestMatchName = name; - bestMatchIcon = icon; + local name, icon, _, _, numItems, numEquipped = C_EquipmentSet.GetEquipmentSetInfo(id) + if itemSetName == nil or (name and itemSetName == name) then + if name ~= nil then + local match = (not partial and numItems == numEquipped) or (partial and (numEquipped or 0) > bestMatchNumEquipped) + if match then + bestMatchNumEquipped = numEquipped + bestMatchNumItems = numItems + bestMatchName = name + bestMatchIcon = icon end end end end - return bestMatchName, bestMatchIcon, bestMatchNumEquipped, bestMatchNumItems; + return bestMatchName, bestMatchIcon, bestMatchNumEquipped, bestMatchNumItems end -- DBM @@ -2871,7 +2884,7 @@ do else r, g, b = barOptions.StartColorR, barOptions.StartColorG, barOptions.StartColorB end - bar.dbmColor = {r, g, b} + bar.dbmColor = { r, g, b } WeakAuras.ScanEvents("DBM_TimerStart", id) if nextExpire == nil then @@ -2998,9 +3011,10 @@ do function WeakAuras.GetDBMTimer(id, message, operator, spellId, extendTimer, dbmType, count) local bestMatch for timerId, bar in pairs(bars) do - if WeakAuras.DBMTimerMatches(timerId, id, message, operator, spellId, dbmType, count) - and (bestMatch == nil or bar.expirationTime < bestMatch.expirationTime) - and bar.expirationTime + extendTimer > GetTime() + if + WeakAuras.DBMTimerMatches(timerId, id, message, operator, spellId, dbmType, count) + and (bestMatch == nil or bar.expirationTime < bestMatch.expirationTime) + and bar.expirationTime + extendTimer > GetTime() then bestMatch = bar end @@ -3010,7 +3024,9 @@ do function WeakAuras.CopyBarToState(bar, states, id, extendTimer) extendTimer = extendTimer or 0 - if extendTimer + bar.duration < 0 then return end + if extendTimer + bar.duration < 0 then + return + end states[id] = states[id] or {} local state = states[id] state.show = true @@ -3019,7 +3035,7 @@ do state.message = bar.message state.name = bar.message state.expirationTime = bar.expirationTime + extendTimer - state.progressType = 'timed' + state.progressType = "timed" state.duration = bar.duration + extendTimer state.timerType = bar.timerType state.spellId = bar.spellId @@ -3112,7 +3128,7 @@ do bar.bwTextColor = BWColorModule:GetColorTable("barText", addon, spellId) bar.bwBackgroundColor = BWColorModule:GetColorTable("barBackground", addon, spellId) bar.count = text:match("(%d+)") or "0" - bar.cast = not(text:match("^[^<]") and true) + bar.cast = not (text:match("^[^<]") and true) WeakAuras.ScanEvents("BigWigs_StartBar", text) if nextExpire == nil then @@ -3157,10 +3173,7 @@ do nextExpire = bar.expirationTime end end - elseif event == "BigWigs_StopBars" - or event == "BigWigs_OnBossDisable" - or event == "BigWigs_OnPluginDisable" - then + elseif event == "BigWigs_StopBars" or event == "BigWigs_OnBossDisable" or event == "BigWigs_OnPluginDisable" then local addon = ... for id, bar in pairs(bars) do if bar.addon == addon then @@ -3196,7 +3209,9 @@ do function WeakAuras.CopyBigWigsTimerToState(bar, states, id, extendTimer) extendTimer = extendTimer or 0 - if extendTimer + bar.duration < 0 then return end + if extendTimer + bar.duration < 0 then + return + end states[id] = states[id] or {} local state = states[id] state.show = true @@ -3271,9 +3286,10 @@ do function WeakAuras.GetBigWigsTimer(text, operator, spellId, extendTimer, count, cast) local bestMatch for id, bar in pairs(bars) do - if WeakAuras.BigWigsTimerMatches(id, text, operator, spellId, count, cast) - and (bestMatch == nil or bar.expirationTime < bestMatch.expirationTime) - and bar.expirationTime + extendTimer > GetTime() + if + WeakAuras.BigWigsTimerMatches(id, text, operator, spellId, count, cast) + and (bestMatch == nil or bar.expirationTime < bestMatch.expirationTime) + and bar.expirationTime + extendTimer > GetTime() then bestMatch = bar end @@ -3326,10 +3342,10 @@ end function WeakAuras.GetSpellCost(powerTypeToCheck) local spellID = select(9, WeakAuras.UnitCastingInfo("player")) if spellID then - local costTable = GetSpellPowerCost(spellID); + local costTable = GetSpellPowerCost(spellID) for _, costInfo in pairs(costTable) do if costInfo.type == powerTypeToCheck then - return costInfo.cost; + return costInfo.cost end end end @@ -3340,59 +3356,59 @@ do local mh = GetInventorySlotInfo("MainHandSlot") local oh = GetInventorySlotInfo("SecondaryHandSlot") - local mh_name, mh_shortenedName, mh_exp, mh_dur, mh_charges, mh_EnchantID; + local mh_name, mh_shortenedName, mh_exp, mh_dur, mh_charges, mh_EnchantID local mh_icon = GetInventoryItemTexture("player", mh) or "Interface\\Icons\\INV_Misc_QuestionMark" - local oh_name, oh_shortenedName, oh_exp, oh_dur, oh_charges, oh_EnchantID; + local oh_name, oh_shortenedName, oh_exp, oh_dur, oh_charges, oh_EnchantID local oh_icon = GetInventoryItemTexture("player", oh) or "Interface\\Icons\\INV_Misc_QuestionMark" local tenchFrame = nil - WeakAuras.frames["Temporary Enchant Handler"] = tenchFrame; - local tenchTip; + WeakAuras.frames["Temporary Enchant Handler"] = tenchFrame + local tenchTip function WeakAuras.TenchInit() - if not(tenchFrame) then - tenchFrame = CreateFrame("Frame"); - tenchFrame:RegisterEvent("UNIT_INVENTORY_CHANGED"); - tenchFrame:RegisterEvent("PLAYER_ENTERING_WORLD"); + if not tenchFrame then + tenchFrame = CreateFrame("Frame") + tenchFrame:RegisterEvent("UNIT_INVENTORY_CHANGED") + tenchFrame:RegisterEvent("PLAYER_ENTERING_WORLD") if WeakAuras.IsClassicOrBCCOrWrath() then - tenchFrame:RegisterEvent("PLAYER_EQUIPMENT_CHANGED"); + tenchFrame:RegisterEvent("PLAYER_EQUIPMENT_CHANGED") end - tenchTip = WeakAuras.GetHiddenTooltip(); + tenchTip = WeakAuras.GetHiddenTooltip() local function getTenchName(id) - tenchTip:SetInventoryItem("player", id); - local lines = { tenchTip:GetRegions() }; - for i,v in ipairs(lines) do - if(v:GetObjectType() == "FontString") then - local text = v:GetText(); - if(text) then - local _, _, name, shortenedName = text:find("^((.-) ?+?[VI%d]*) ?%(%d+.+%)$"); - if(name and name ~= "") then - return name, shortenedName; + tenchTip:SetInventoryItem("player", id) + local lines = { tenchTip:GetRegions() } + for i, v in ipairs(lines) do + if v:GetObjectType() == "FontString" then + local text = v:GetText() + if text then + local _, _, name, shortenedName = text:find("^((.-) ?+?[VI%d]*) ?%(%d+.+%)$") + if name and name ~= "" then + return name, shortenedName end - _, _, name, shortenedName = text:find("^((.-) ?+?[VI%d]*)%(%d+.+%)$"); - if(name and name ~= "") then - return name, shortenedName; + _, _, name, shortenedName = text:find("^((.-) ?+?[VI%d]*)%(%d+.+%)$") + if name and name ~= "" then + return name, shortenedName end end end end - return "Unknown", "Unknown"; + return "Unknown", "Unknown" end local function tenchUpdate() - Private.StartProfileSystem("generictrigger"); + Private.StartProfileSystem("generictrigger") local _, mh_rem, oh_rem - _, mh_rem, mh_charges, mh_EnchantID, _, oh_rem, oh_charges, oh_EnchantID = GetWeaponEnchantInfo(); - local time = GetTime(); - local mh_exp_new = mh_rem and (time + (mh_rem / 1000)); - local oh_exp_new = oh_rem and (time + (oh_rem / 1000)); - if(math.abs((mh_exp or 0) - (mh_exp_new or 0)) > 1) then - mh_exp = mh_exp_new; - mh_dur = mh_rem and mh_rem / 1000; + _, mh_rem, mh_charges, mh_EnchantID, _, oh_rem, oh_charges, oh_EnchantID = GetWeaponEnchantInfo() + local time = GetTime() + local mh_exp_new = mh_rem and (time + (mh_rem / 1000)) + local oh_exp_new = oh_rem and (time + (oh_rem / 1000)) + if math.abs((mh_exp or 0) - (mh_exp_new or 0)) > 1 then + mh_exp = mh_exp_new + mh_dur = mh_rem and mh_rem / 1000 if mh_exp then mh_name, mh_shortenedName = getTenchName(mh) else @@ -3400,9 +3416,9 @@ do end mh_icon = GetInventoryItemTexture("player", mh) end - if(math.abs((oh_exp or 0) - (oh_exp_new or 0)) > 1) then - oh_exp = oh_exp_new; - oh_dur = oh_rem and oh_rem / 1000; + if math.abs((oh_exp or 0) - (oh_exp_new or 0)) > 1 then + oh_exp = oh_exp_new + oh_dur = oh_rem and oh_rem / 1000 if oh_exp then oh_name, oh_shortenedName = getTenchName(oh) else @@ -3410,36 +3426,36 @@ do end oh_icon = GetInventoryItemTexture("player", oh) end - WeakAuras.ScanEvents("TENCH_UPDATE"); - Private.StopProfileSystem("generictrigger"); + WeakAuras.ScanEvents("TENCH_UPDATE") + Private.StopProfileSystem("generictrigger") end tenchFrame:SetScript("OnEvent", function() - Private.StartProfileSystem("generictrigger"); - timer:ScheduleTimer(tenchUpdate, 0.1); - Private.StopProfileSystem("generictrigger"); - end); + Private.StartProfileSystem("generictrigger") + timer:ScheduleTimer(tenchUpdate, 0.1) + Private.StopProfileSystem("generictrigger") + end) - tenchUpdate(); + tenchUpdate() end end function WeakAuras.GetMHTenchInfo() - return mh_exp, mh_dur, mh_name, mh_shortenedName, mh_icon, mh_charges, mh_EnchantID; + return mh_exp, mh_dur, mh_name, mh_shortenedName, mh_icon, mh_charges, mh_EnchantID end function WeakAuras.GetOHTenchInfo() - return oh_exp, oh_dur, oh_name, oh_shortenedName, oh_icon, oh_charges, oh_EnchantID; + return oh_exp, oh_dur, oh_name, oh_shortenedName, oh_icon, oh_charges, oh_EnchantID end end -- Pets do local petFrame = nil - WeakAuras.frames["Pet Use Handler"] = petFrame; + WeakAuras.frames["Pet Use Handler"] = petFrame function WeakAuras.WatchForPetDeath() - if not(petFrame) then - petFrame = CreateFrame("Frame"); + if not petFrame then + petFrame = CreateFrame("Frame") petFrame:RegisterUnitEvent("UNIT_PET", "player") petFrame:SetScript("OnEvent", function(event, unit) Private.StartProfileSystem("generictrigger") @@ -3471,7 +3487,7 @@ do local function nameplateTargetOnEvent(self, event, unit) if event == "NAME_PLATE_UNIT_ADDED" then - nameplateTargets[unit] = UnitGUID(unit.."-target") or true + nameplateTargets[unit] = UnitGUID(unit .. "-target") or true elseif event == "NAME_PLATE_UNIT_REMOVED" then nameplateTargets[unit] = nil end @@ -3483,10 +3499,8 @@ do throttle_update = throttle_update - delta if throttle_update < 0 then for unit, targetGUID in pairs(nameplateTargets) do - local newTargetGUID = UnitGUID(unit.."-target") - if (newTargetGUID == nil and targetGUID ~= true) - or (newTargetGUID ~= nil and targetGUID ~= newTargetGUID) - then + local newTargetGUID = UnitGUID(unit .. "-target") + if (newTargetGUID == nil and targetGUID ~= true) or (newTargetGUID ~= nil and targetGUID ~= newTargetGUID) then nameplateTargets[unit] = newTargetGUID or true WeakAuras.ScanEvents("WA_UNIT_TARGET_NAME_PLATE", unit) end @@ -3510,48 +3524,48 @@ end -- Player Moving do local playerMovingFrame = nil - local moving; + local moving local function PlayerMoveUpdate(self, event) - Private.StartProfileSystem("generictrigger"); + Private.StartProfileSystem("generictrigger") -- channeling e.g. Mind Flay results in lots of PLAYER_STARTED_MOVING, PLAYER_STOPPED_MOVING -- for each frame -- So check after 0.01 s if IsPlayerMoving() actually returns something different. timer:ScheduleTimer(function() - Private.StartProfileSystem("generictrigger"); - if (moving ~= IsPlayerMoving() or moving == nil) then - moving = IsPlayerMoving(); + Private.StartProfileSystem("generictrigger") + if moving ~= IsPlayerMoving() or moving == nil then + moving = IsPlayerMoving() WeakAuras.ScanEvents("PLAYER_MOVING_UPDATE") end - Private.StopProfileSystem("generictrigger"); - end, 0.01); - Private.StopProfileSystem("generictrigger"); + Private.StopProfileSystem("generictrigger") + end, 0.01) + Private.StopProfileSystem("generictrigger") end local function PlayerMoveSpeedUpdate() - Private.StartProfileSystem("generictrigger"); + Private.StartProfileSystem("generictrigger") local speed = GetUnitSpeed("player") if speed ~= playerMovingFrame.speed then playerMovingFrame.speed = speed WeakAuras.ScanEvents("PLAYER_MOVE_SPEED_UPDATE") end - Private.StopProfileSystem("generictrigger"); + Private.StopProfileSystem("generictrigger") end function WeakAuras.WatchForPlayerMoving() - if not(playerMovingFrame) then - playerMovingFrame = CreateFrame("Frame"); - WeakAuras.frames["Player Moving Frame"] = playerMovingFrame; + if not playerMovingFrame then + playerMovingFrame = CreateFrame("Frame") + WeakAuras.frames["Player Moving Frame"] = playerMovingFrame end - playerMovingFrame:RegisterEvent("PLAYER_STARTED_MOVING"); - playerMovingFrame:RegisterEvent("PLAYER_STOPPED_MOVING"); + playerMovingFrame:RegisterEvent("PLAYER_STARTED_MOVING") + playerMovingFrame:RegisterEvent("PLAYER_STOPPED_MOVING") playerMovingFrame:SetScript("OnEvent", PlayerMoveUpdate) end function WeakAuras.WatchPlayerMoveSpeed() - if not(playerMovingFrame) then - playerMovingFrame = CreateFrame("Frame"); - WeakAuras.frames["Player Moving Frame"] = playerMovingFrame; + if not playerMovingFrame then + playerMovingFrame = CreateFrame("Frame") + WeakAuras.frames["Player Moving Frame"] = playerMovingFrame end playerMovingFrame.speed = GetUnitSpeed("player") playerMovingFrame:SetScript("OnUpdate", PlayerMoveSpeedUpdate) @@ -3559,17 +3573,17 @@ do end -- Item Count -local itemCountWatchFrame; +local itemCountWatchFrame function WeakAuras.RegisterItemCountWatch() - if not(itemCountWatchFrame) then - itemCountWatchFrame = CreateFrame("Frame"); - itemCountWatchFrame:RegisterUnitEvent("UNIT_SPELLCAST_SUCCEEDED", "player"); + if not itemCountWatchFrame then + itemCountWatchFrame = CreateFrame("Frame") + itemCountWatchFrame:RegisterUnitEvent("UNIT_SPELLCAST_SUCCEEDED", "player") itemCountWatchFrame:SetScript("OnEvent", function() - Private.StartProfileSystem("generictrigger"); - timer:ScheduleTimer(WeakAuras.ScanEvents, 0.2, "ITEM_COUNT_UPDATE"); - timer:ScheduleTimer(WeakAuras.ScanEvents, 0.5, "ITEM_COUNT_UPDATE"); - Private.StopProfileSystem("generictrigger"); - end); + Private.StartProfileSystem("generictrigger") + timer:ScheduleTimer(WeakAuras.ScanEvents, 0.2, "ITEM_COUNT_UPDATE") + timer:ScheduleTimer(WeakAuras.ScanEvents, 0.5, "ITEM_COUNT_UPDATE") + Private.StopProfileSystem("generictrigger") + end) end end @@ -3583,58 +3597,58 @@ if WeakAuras.IsRetail() then end do - local scheduled_scans = {}; + local scheduled_scans = {} local function doScan(fireTime, event) - scheduled_scans[event][fireTime] = nil; - WeakAuras.ScanEvents(event); + scheduled_scans[event][fireTime] = nil + WeakAuras.ScanEvents(event) end function WeakAuras.ScheduleScan(fireTime, event) event = event or "COOLDOWN_REMAINING_CHECK" scheduled_scans[event] = scheduled_scans[event] or {} - if not(scheduled_scans[event][fireTime]) then - scheduled_scans[event][fireTime] = timer:ScheduleTimerFixed(doScan, fireTime - GetTime() + 0.1, fireTime, event); + if not scheduled_scans[event][fireTime] then + scheduled_scans[event][fireTime] = timer:ScheduleTimerFixed(doScan, fireTime - GetTime() + 0.1, fireTime, event) end end end do - local scheduled_scans = {}; + local scheduled_scans = {} local function doCastScan(firetime, unit) - scheduled_scans[unit][firetime] = nil; - WeakAuras.ScanEvents("CAST_REMAINING_CHECK_" .. string.lower(unit), unit); + scheduled_scans[unit][firetime] = nil + WeakAuras.ScanEvents("CAST_REMAINING_CHECK_" .. string.lower(unit), unit) end function WeakAuras.ScheduleCastCheck(fireTime, unit) scheduled_scans[unit] = scheduled_scans[unit] or {} - if not(scheduled_scans[unit][fireTime]) then - scheduled_scans[unit][fireTime] = timer:ScheduleTimerFixed(doCastScan, fireTime - GetTime() + 0.1, fireTime, unit); + if not scheduled_scans[unit][fireTime] then + scheduled_scans[unit][fireTime] = timer:ScheduleTimerFixed(doCastScan, fireTime - GetTime() + 0.1, fireTime, unit) end end end -local uniqueId = 0; +local uniqueId = 0 function WeakAuras.GetUniqueCloneId() - uniqueId = (uniqueId + 1) % 1000000; - return uniqueId; + uniqueId = (uniqueId + 1) % 1000000 + return uniqueId end function GenericTrigger.CanHaveDuration(data, triggernum) local trigger = data.triggers[triggernum].trigger - if (Private.category_event_prototype[trigger.type]) then + if Private.category_event_prototype[trigger.type] then if trigger.event and Private.event_prototypes[trigger.event] then if Private.event_prototypes[trigger.event].durationFunc then - if(type(Private.event_prototypes[trigger.event].init) == "function") then - Private.event_prototypes[trigger.event].init(trigger); + if type(Private.event_prototypes[trigger.event].init) == "function" then + Private.event_prototypes[trigger.event].init(trigger) end - local current, maximum, custom = Private.event_prototypes[trigger.event].durationFunc(trigger); + local current, maximum, custom = Private.event_prototypes[trigger.event].durationFunc(trigger) current = type(current) ~= "number" and current or 0 maximum = type(maximum) ~= "number" and maximum or 0 - if(custom) then - return {current = current, maximum = maximum}; + if custom then + return { current = current, maximum = maximum } else - return "timed"; + return "timed" end elseif Private.event_prototypes[trigger.event].canHaveDuration then return Private.event_prototypes[trigger.event].canHaveDuration, Private.event_prototypes[trigger.event].useModRate @@ -3642,13 +3656,13 @@ function GenericTrigger.CanHaveDuration(data, triggernum) return "timed" end end - elseif (trigger.type == "custom") then + elseif trigger.type == "custom" then if trigger.custom_type == "event" and trigger.custom_hide == "timed" and trigger.duration then - return "timed"; - elseif (trigger.customDuration and trigger.customDuration ~= "") then - return "timed"; - elseif (trigger.custom_type == "stateupdate") then - return "timed"; + return "timed" + elseif trigger.customDuration and trigger.customDuration ~= "" then + return "timed" + elseif trigger.custom_type == "stateupdate" then + return "timed" end end return false @@ -3658,77 +3672,77 @@ end -- @param data -- @param triggernum function GenericTrigger.GetOverlayInfo(data, triggernum) - local result; + local result local trigger = data.triggers[triggernum].trigger - if (trigger.type ~= "custom" and trigger.event and Private.event_prototypes[trigger.event] and Private.event_prototypes[trigger.event].overlayFuncs) then - result = {}; - local dest = 1; + if trigger.type ~= "custom" and trigger.event and Private.event_prototypes[trigger.event] and Private.event_prototypes[trigger.event].overlayFuncs then + result = {} + local dest = 1 for i, v in ipairs(Private.event_prototypes[trigger.event].overlayFuncs) do - if (v.enable(trigger)) then - result[dest] = v.name; - dest = dest + 1; + if v.enable(trigger) then + result[dest] = v.name + dest = dest + 1 end end end - if (trigger.type == "custom") then - if (trigger.custom_type == "stateupdate") then - local count = 0; - local variables = events[data.id][triggernum].tsuConditionVariables(); - if (type(variables) == "table") then - if (type(variables.additionalProgress) == "table") then - count = #variables.additionalProgress; - elseif (type(variables.additionalProgress) == "number") then - count = variables.additionalProgress; + if trigger.type == "custom" then + if trigger.custom_type == "stateupdate" then + local count = 0 + local variables = events[data.id][triggernum].tsuConditionVariables() + if type(variables) == "table" then + if type(variables.additionalProgress) == "table" then + count = #variables.additionalProgress + elseif type(variables.additionalProgress) == "number" then + count = variables.additionalProgress end else - local allStates = {}; - Private.ActivateAuraEnvironment(data.id); - RunTriggerFunc(allStates, events[data.id][triggernum], data.id, triggernum, "OPTIONS"); - Private.ActivateAuraEnvironment(nil); - local count = 0; + local allStates = {} + Private.ActivateAuraEnvironment(data.id) + RunTriggerFunc(allStates, events[data.id][triggernum], data.id, triggernum, "OPTIONS") + Private.ActivateAuraEnvironment(nil) + local count = 0 for id, state in pairs(allStates) do - if (type(state.additionalProgress) == "table") then - count = max(count, #state.additionalProgress); + if type(state.additionalProgress) == "table" then + count = max(count, #state.additionalProgress) end end end - count = min(count, 7); + count = min(count, 7) for i = 1, count do - result = result or {}; - result[i] = string.format(L["Overlay %s"], i); + result = result or {} + result[i] = string.format(L["Overlay %s"], i) end else for i = 1, 7 do - local property = "customOverlay" .. i; - if (trigger[property] and trigger[property] ~= "") then - result = result or {}; - result[i] = string.format(L["Overlay %s"], i); + local property = "customOverlay" .. i + if trigger[property] and trigger[property] ~= "" then + result = result or {} + result[i] = string.format(L["Overlay %s"], i) end end end end - return result; + return result end function GenericTrigger.CanHaveClones(data) - return false; + return false end function GenericTrigger.GetNameAndIcon(data, triggernum) local trigger = data.triggers[triggernum].trigger local icon, name - if (Private.category_event_prototype[trigger.type]) then - if(trigger.event and Private.event_prototypes[trigger.event]) then - if(Private.event_prototypes[trigger.event].iconFunc) then - icon = Private.event_prototypes[trigger.event].iconFunc(trigger); + if Private.category_event_prototype[trigger.type] then + if trigger.event and Private.event_prototypes[trigger.event] then + if Private.event_prototypes[trigger.event].iconFunc then + icon = Private.event_prototypes[trigger.event].iconFunc(trigger) end - if(Private.event_prototypes[trigger.event].nameFunc) then - name = Private.event_prototypes[trigger.event].nameFunc(trigger); + if Private.event_prototypes[trigger.event].nameFunc then + name = Private.event_prototypes[trigger.event].nameFunc(trigger) end end end @@ -3742,62 +3756,62 @@ end -- @return string function GenericTrigger.CanHaveTooltip(data, triggernum) local trigger = data.triggers[triggernum].trigger - if (Private.category_event_prototype[trigger.type]) then - if (trigger.event and Private.event_prototypes[trigger.event]) then - if(Private.event_prototypes[trigger.event].hasSpellID) then - return "spell"; - elseif(Private.event_prototypes[trigger.event].hasItemID) then - return "item"; + if Private.category_event_prototype[trigger.type] then + if trigger.event and Private.event_prototypes[trigger.event] then + if Private.event_prototypes[trigger.event].hasSpellID then + return "spell" + elseif Private.event_prototypes[trigger.event].hasItemID then + return "item" end end end - if (trigger.type == "custom") then - if (trigger.custom_type == "stateupdate") then - return true; + if trigger.type == "custom" then + if trigger.custom_type == "stateupdate" then + return true end end - return false; + return false end function GenericTrigger.SetToolTip(trigger, state) - if (trigger.type == "custom" and trigger.custom_type == "stateupdate") then - if (state.tooltip) then - local lines = { strsplit("\n", state.tooltip) }; - GameTooltip:ClearLines(); + if trigger.type == "custom" and trigger.custom_type == "stateupdate" then + if state.tooltip then + local lines = { strsplit("\n", state.tooltip) } + GameTooltip:ClearLines() for i, line in ipairs(lines) do - GameTooltip:AddLine(line, nil, nil, nil, state.tooltipWrap); + GameTooltip:AddLine(line, nil, nil, nil, state.tooltipWrap) end return true - elseif (state.spellId) then - GameTooltip:SetSpellByID(state.spellId); + elseif state.spellId then + GameTooltip:SetSpellByID(state.spellId) return true - elseif (state.link) then - GameTooltip:SetHyperlink(state.link); + elseif state.link then + GameTooltip:SetHyperlink(state.link) return true - elseif (state.itemId) then - GameTooltip:SetHyperlink("item:"..state.itemId..":0:0:0:0:0:0:0"); + elseif state.itemId then + GameTooltip:SetHyperlink("item:" .. state.itemId .. ":0:0:0:0:0:0:0") return true - elseif (state.unit and state.unitBuffIndex) then - GameTooltip:SetUnitBuff(state.unit, state.unitBuffIndex, state.unitBuffFilter); + elseif state.unit and state.unitBuffIndex then + GameTooltip:SetUnitBuff(state.unit, state.unitBuffIndex, state.unitBuffFilter) return true - elseif (state.unit and state.unitDebuffIndex) then - GameTooltip:SetUnitDebuff(state.unit, state.unitDebuffIndex, state.unitDebuffFilter); + elseif state.unit and state.unitDebuffIndex then + GameTooltip:SetUnitDebuff(state.unit, state.unitDebuffIndex, state.unitDebuffFilter) return true - elseif (state.unit and state.unitAuraIndex) then + elseif state.unit and state.unitAuraIndex then GameTooltip:SetUnitAura(state.unit, state.unitAuraIndex, state.unitAuraFilter) return true end end - if (Private.category_event_prototype[trigger.type]) then - if (trigger.event and Private.event_prototypes[trigger.event]) then - if(Private.event_prototypes[trigger.event].hasSpellID) then - GameTooltip:SetSpellByID(trigger.spellName); + if Private.category_event_prototype[trigger.type] then + if trigger.event and Private.event_prototypes[trigger.event] then + if Private.event_prototypes[trigger.event].hasSpellID then + GameTooltip:SetSpellByID(trigger.spellName) return true - elseif(Private.event_prototypes[trigger.event].hasItemID) then - GameTooltip:SetHyperlink("item:"..trigger.itemName..":0:0:0:0:0:0:0") + elseif Private.event_prototypes[trigger.event].hasItemID then + GameTooltip:SetHyperlink("item:" .. trigger.itemName .. ":0:0:0:0:0:0:0") return true end end @@ -3807,36 +3821,36 @@ end function GenericTrigger.GetAdditionalProperties(data, triggernum) local trigger = data.triggers[triggernum].trigger - local ret = ""; - if (Private.category_event_prototype[trigger.type]) then - if (trigger.event and Private.event_prototypes[trigger.event]) then - local found = false; + local ret = "" + if Private.category_event_prototype[trigger.type] then + if trigger.event and Private.event_prototypes[trigger.event] then + local found = false local additional = "" for _, v in pairs(Private.event_prototypes[trigger.event].args) do local enable = true - if(type(v.enable) == "function") then + if type(v.enable) == "function" then enable = v.enable(trigger) elseif type(v.enable) == "boolean" then enable = v.enable end - if (enable and v.store and v.name and v.display) then - found = true; - additional = additional .. "|cFFFF0000%".. triggernum .. "." .. v.name .. "|r - " .. v.display .. "\n"; + if enable and v.store and v.name and v.display then + found = true + additional = additional .. "|cFFFF0000%" .. triggernum .. "." .. v.name .. "|r - " .. v.display .. "\n" end end - if (found) then - ret = ret .. additional; + if found then + ret = ret .. additional end end else - if (trigger.custom_type == "stateupdate") then - local variables = events[data.id][triggernum].tsuConditionVariables(); - if (type(variables) == "table") then + if trigger.custom_type == "stateupdate" then + local variables = events[data.id][triggernum].tsuConditionVariables() + if type(variables) == "table" then for var, varData in pairs(variables) do - if (type(varData) == "table") then + if type(varData) == "table" then if varData.display then - ret = ret .. "|cFFFF0000%".. triggernum .. "." .. var .. "|r - " .. varData.display .. "\n" + ret = ret .. "|cFFFF0000%" .. triggernum .. "." .. var .. "|r - " .. varData.display .. "\n" end end end @@ -3844,7 +3858,7 @@ function GenericTrigger.GetAdditionalProperties(data, triggernum) end end - return ret; + return ret end local commonConditions = { @@ -3855,7 +3869,7 @@ local commonConditions = { expirationTimeModRate = { display = L["Remaining Duration"], type = "timer", - useModRate = true + useModRate = true, }, duration = { display = L["Total Duration"], @@ -3864,7 +3878,7 @@ local commonConditions = { durationModRate = { display = L["Total Duration"], type = "number", - useModRate = true + useModRate = true, }, value = { display = L["Progress Value"], @@ -3876,12 +3890,12 @@ local commonConditions = { }, stacks = { display = L["Stacks"], - type = "number" + type = "number", }, name = { display = L["Name"], - type = "string" - } + type = "string", + }, } function Private.ExpandCustomVariables(variables) @@ -3890,17 +3904,17 @@ function Private.ExpandCustomVariables(variables) -- By allowing a short-hand notation of just variable = type -- In addition to the long form of variable = { type = xyz, display = "desc"} for k, v in pairs(commonConditions) do - if (variables[k] and type(variables[k]) ~= "table") then - variables[k] = v; + if variables[k] and type(variables[k]) ~= "table" then + variables[k] = v end end for k, v in pairs(variables) do - if (type(v) == "string") then + if type(v) == "string" then variables[k] = { display = k, type = v, - }; + } end end end @@ -3908,218 +3922,218 @@ end function GenericTrigger.GetTriggerConditions(data, triggernum) local trigger = data.triggers[triggernum].trigger - if (Private.category_event_prototype[trigger.type]) then - if (trigger.event and Private.event_prototypes[trigger.event]) then - local result = {}; + if Private.category_event_prototype[trigger.type] then + if trigger.event and Private.event_prototypes[trigger.event] then + local result = {} - local canHaveDuration, modRated = GenericTrigger.CanHaveDuration(data, triggernum); - local timedDuration = canHaveDuration; - local valueDuration = canHaveDuration; - if (canHaveDuration == "timed") then - valueDuration = false; - elseif (type(canHaveDuration) == "table") then - timedDuration = false; + local canHaveDuration, modRated = GenericTrigger.CanHaveDuration(data, triggernum) + local timedDuration = canHaveDuration + local valueDuration = canHaveDuration + if canHaveDuration == "timed" then + valueDuration = false + elseif type(canHaveDuration) == "table" then + timedDuration = false end - if (timedDuration) then + if timedDuration then if modRated then - result.expirationTime = commonConditions.expirationTimeModRate; - result.duration = commonConditions.durationModRate; + result.expirationTime = commonConditions.expirationTimeModRate + result.duration = commonConditions.durationModRate else - result.expirationTime = commonConditions.expirationTime; - result.duration = commonConditions.duration; + result.expirationTime = commonConditions.expirationTime + result.duration = commonConditions.duration end end - if (valueDuration) then - result.value = commonConditions.value; - result.total = commonConditions.total; + if valueDuration then + result.value = commonConditions.value + result.total = commonConditions.total end - if (Private.event_prototypes[trigger.event].stacksFunc) then - result.stacks = commonConditions.stacks; + if Private.event_prototypes[trigger.event].stacksFunc then + result.stacks = commonConditions.stacks end - if (Private.event_prototypes[trigger.event].nameFunc) then - result.name = commonConditions.name; + if Private.event_prototypes[trigger.event].nameFunc then + result.name = commonConditions.name end for _, v in pairs(Private.event_prototypes[trigger.event].args) do - if (v.conditionType and v.name and v.display) then - local enable = true; - if (v.enable ~= nil) then + if v.conditionType and v.name and v.display then + local enable = true + if v.enable ~= nil then if type(v.enable) == "function" then - enable = v.enable(trigger); + enable = v.enable(trigger) elseif type(v.enable) == "boolean" then enable = v.enable end end - if (enable) then + if enable then result[v.name] = { display = v.display, - type = v.conditionType + type = v.conditionType, } - if (result[v.name].type == "select" or result[v.name].type == "unit") then - if (v.conditionValues) then - result[v.name].values = Private[v.conditionValues] or WeakAuras[v.conditionValues]; + if result[v.name].type == "select" or result[v.name].type == "unit" then + if v.conditionValues then + result[v.name].values = Private[v.conditionValues] or WeakAuras[v.conditionValues] else if type(v.values) == "function" then result[v.name].values = v.values() else - result[v.name].values = Private[v.values] or WeakAuras[v.values]; + result[v.name].values = Private[v.values] or WeakAuras[v.values] end end end - if (v.conditionPreamble) then - result[v.name].preamble = v.conditionPreamble; + if v.conditionPreamble then + result[v.name].preamble = v.conditionPreamble end - if (v.conditionTest) then - result[v.name].test = v.conditionTest; + if v.conditionTest then + result[v.name].test = v.conditionTest end - if (v.conditionEvents) then - result[v.name].events = v.conditionEvents; + if v.conditionEvents then + result[v.name].events = v.conditionEvents end - if (v.operator_types) then - result[v.name].operator_types = v.operator_types; + if v.operator_types then + result[v.name].operator_types = v.operator_types end end end end - return result; + return result end - elseif(trigger.type == "custom") then - if (trigger.custom_type == "status" or trigger.custom_type == "event") then - local result = {}; + elseif trigger.type == "custom" then + if trigger.custom_type == "status" or trigger.custom_type == "event" then + local result = {} - local canHaveDurationFunc = trigger.custom_type == "status" or (trigger.custom_type == "event" and (trigger.custom_hide ~= "timed" or trigger.dynamicDuration)); + local canHaveDurationFunc = trigger.custom_type == "status" or (trigger.custom_type == "event" and (trigger.custom_hide ~= "timed" or trigger.dynamicDuration)) - if (canHaveDurationFunc and trigger.customDuration and trigger.customDuration ~= "") then - result.expirationTime = commonConditions.expirationTime; - result.duration = commonConditions.duration; - result.value = commonConditions.value; - result.total = commonConditions.total; + if canHaveDurationFunc and trigger.customDuration and trigger.customDuration ~= "" then + result.expirationTime = commonConditions.expirationTime + result.duration = commonConditions.duration + result.value = commonConditions.value + result.total = commonConditions.total end - if (trigger.custom_type == "event" and trigger.custom_hide ~= "custom" and trigger.dynamicDuration ~= true) then + if trigger.custom_type == "event" and trigger.custom_hide ~= "custom" and trigger.dynamicDuration ~= true then -- This is the static duration of a event/timed trigger - result.expirationTime = commonConditions.expirationTime; - result.duration = commonConditions.duration; + result.expirationTime = commonConditions.expirationTime + result.duration = commonConditions.duration end - if (trigger.customStacks and trigger.customStacks ~= "") then - result.stacks = commonConditions.stacks; + if trigger.customStacks and trigger.customStacks ~= "" then + result.stacks = commonConditions.stacks end - if (trigger.customName and trigger.customName ~= "") then - result.name = commonConditions.name; + if trigger.customName and trigger.customName ~= "" then + result.name = commonConditions.name end - return result; - elseif (trigger.custom_type == "stateupdate") then - if (events[data.id][triggernum] and events[data.id][triggernum].tsuConditionVariables) then + return result + elseif trigger.custom_type == "stateupdate" then + if events[data.id][triggernum] and events[data.id][triggernum].tsuConditionVariables then Private.ActivateAuraEnvironment(data.id, nil, nil, nil, true) local result = events[data.id][triggernum].tsuConditionVariables() Private.ActivateAuraEnvironment(nil) if (type(result)) ~= "table" then - return nil; + return nil end Private.ExpandCustomVariables(result) for k, v in pairs(result) do - if (type(v) ~= "table") then - result[k] = nil; - elseif (v.display == nil or type(v.display) ~= "string") then - if (type(k) == "string") then - v.display = k; + if type(v) ~= "table" then + result[k] = nil + elseif v.display == nil or type(v.display) ~= "string" then + if type(k) == "string" then + v.display = k else - result[k] = nil; + result[k] = nil end end end - return result; + return result end end end - return nil; + return nil end function GenericTrigger.CreateFallbackState(data, triggernum, state) - state.show = true; - state.changed = true; - local event = events[data.id][triggernum]; + state.show = true + state.changed = true + local event = events[data.id][triggernum] - Private.ActivateAuraEnvironment(data.id, "", state); + Private.ActivateAuraEnvironment(data.id, "", state) local trigger = data.triggers[triggernum].trigger - if (event.nameFunc) then - local ok, name = xpcall(event.nameFunc, Private.GetErrorHandlerUid(data.uid, L["Name Function (fallback state)"]), trigger); - state.name = ok and name or nil; + if event.nameFunc then + local ok, name = xpcall(event.nameFunc, Private.GetErrorHandlerUid(data.uid, L["Name Function (fallback state)"]), trigger) + state.name = ok and name or nil end - if (event.iconFunc) then - local ok, icon = xpcall(event.iconFunc, Private.GetErrorHandlerUid(data.uid, L["Icon Function (fallback state)"]), trigger); - state.icon = ok and icon or nil; + if event.iconFunc then + local ok, icon = xpcall(event.iconFunc, Private.GetErrorHandlerUid(data.uid, L["Icon Function (fallback state)"]), trigger) + state.icon = ok and icon or nil end - if (event.textureFunc ) then - local ok, texture = xpcall(event.textureFunc, Private.GetErrorHandlerUid(data.uid, L["Texture Function (fallback state)"]), trigger); - state.texture = ok and texture or nil; + if event.textureFunc then + local ok, texture = xpcall(event.textureFunc, Private.GetErrorHandlerUid(data.uid, L["Texture Function (fallback state)"]), trigger) + state.texture = ok and texture or nil end - if (event.stacksFunc) then - local ok, stacks = xpcall(event.stacksFunc, Private.GetErrorHandlerUid(data.uid, L["Stacks Function (fallback state)"]), trigger); - state.stacks = ok and stacks or nil; + if event.stacksFunc then + local ok, stacks = xpcall(event.stacksFunc, Private.GetErrorHandlerUid(data.uid, L["Stacks Function (fallback state)"]), trigger) + state.stacks = ok and stacks or nil end - if (event.durationFunc) then - local ok, arg1, arg2, arg3, inverse = xpcall(event.durationFunc, Private.GetErrorHandlerUid(data.uid, L["Duration Function (fallback state)"]), trigger); - if (not ok) then - state.progressType = "timed"; - state.duration = 0; - state.expirationTime = math.huge; - state.value = nil; - state.total = nil; - return; + if event.durationFunc then + local ok, arg1, arg2, arg3, inverse = xpcall(event.durationFunc, Private.GetErrorHandlerUid(data.uid, L["Duration Function (fallback state)"]), trigger) + if not ok then + state.progressType = "timed" + state.duration = 0 + state.expirationTime = math.huge + state.value = nil + state.total = nil + return end - arg1 = type(arg1) == "number" and arg1 or 0; - arg2 = type(arg2) == "number" and arg2 or 0; + arg1 = type(arg1) == "number" and arg1 or 0 + arg2 = type(arg2) == "number" and arg2 or 0 - if(type(arg3) == "string") then - state.durationFunc = event.durationFunc; - elseif (type(arg3) == "function") then - state.durationFunc = arg3; + if type(arg3) == "string" then + state.durationFunc = event.durationFunc + elseif type(arg3) == "function" then + state.durationFunc = arg3 else - state.durationFunc = nil; + state.durationFunc = nil end - if (arg3) then - state.progressType = "static"; - state.duration = nil; - state.expirationTime = nil; - state.value = arg1; - state.total = arg2; - state.inverse = inverse; + if arg3 then + state.progressType = "static" + state.duration = nil + state.expirationTime = nil + state.value = arg1 + state.total = arg2 + state.inverse = inverse else - state.progressType = "timed"; - state.duration = arg1; - state.expirationTime = arg2; - state.autoHide = nil; - state.value = nil; - state.total = nil; - state.inverse = inverse; + state.progressType = "timed" + state.duration = arg1 + state.expirationTime = arg2 + state.autoHide = nil + state.value = nil + state.total = nil + state.inverse = inverse end else - state.progressType = "timed"; - state.duration = 0; - state.expirationTime = math.huge; - state.value = nil; - state.total = nil; + state.progressType = "timed" + state.duration = 0 + state.expirationTime = math.huge + state.value = nil + state.total = nil end - if (event.overlayFuncs) then - RunOverlayFuncs(event, state, data.id); + if event.overlayFuncs then + RunOverlayFuncs(event, state, data.id) end - Private.ActivateAuraEnvironment(nil); + Private.ActivateAuraEnvironment(nil) end function GenericTrigger.GetName(triggerType) @@ -4128,33 +4142,42 @@ end function GenericTrigger.GetTriggerDescription(data, triggernum, namestable) local trigger = data.triggers[triggernum].trigger - if (Private.category_event_prototype[trigger.type]) then - tinsert(namestable, {L["Trigger:"], (Private.event_prototypes[trigger.event].name or L["Undefined"])}); - if(trigger.event == "Combat Log" and trigger.subeventPrefix and trigger.subeventSuffix) then - tinsert(namestable, {L["Message type:"], (Private.subevent_prefix_types[trigger.subeventPrefix] or L["Undefined"]).." "..(Private.subevent_suffix_types[trigger.subeventSuffix] or L["Undefined"])}); + if Private.category_event_prototype[trigger.type] then + tinsert(namestable, { L["Trigger:"], (Private.event_prototypes[trigger.event].name or L["Undefined"]) }) + if trigger.event == "Combat Log" and trigger.subeventPrefix and trigger.subeventSuffix then + tinsert(namestable, { + L["Message type:"], + (Private.subevent_prefix_types[trigger.subeventPrefix] or L["Undefined"]) .. " " .. (Private.subevent_suffix_types[trigger.subeventSuffix] or L["Undefined"]), + }) end else - tinsert(namestable, {L["Trigger:"], L["Custom"]}); + tinsert(namestable, { L["Trigger:"], L["Custom"] }) end end do -- Based on Code by DejaCharacterStats. Ugly code to figure out the GCD local class = select(2, UnitClass("player")) - if class == "DEMONHUNTER" - or class == "HUNTER" or class == "SHAMAN" - or class == "MAGE" or class == "PRIEST" or class == "WARLOCK" - or class == "DEATHKNIGHT" or class == "PALADIN" or class == "WARRIOR" + if + class == "DEMONHUNTER" + or class == "HUNTER" + or class == "SHAMAN" + or class == "MAGE" + or class == "PRIEST" + or class == "WARLOCK" + or class == "DEATHKNIGHT" + or class == "PALADIN" + or class == "WARRIOR" then function WeakAuras.CalculatedGcdDuration() local haste = GetHaste() - return max(0.75, 1.5 * 100 / (100+haste)) + return max(0.75, 1.5 * 100 / (100 + haste)) end elseif class == "DRUID" then function WeakAuras.CalculatedGcdDuration() local id = GetShapeshiftFormID() local haste = GetHaste() - return id == 1 and 1 or max(0.75, 1.5 * 100 / (100+haste)) + return id == 1 and 1 or max(0.75, 1.5 * 100 / (100 + haste)) end elseif class == "MONK" then function WeakAuras.CalculatedGcdDuration() @@ -4164,7 +4187,7 @@ do return 1 end local haste = GetHaste() - return max(0.75, 1.5 * 100 / (100+haste)) + return max(0.75, 1.5 * 100 / (100 + haste)) end elseif class == "ROGUE" then function WeakAuras.CalculatedGcdDuration() @@ -4179,9 +4202,9 @@ local findIdInLink = function(id, itemLink) end WeakAuras.CheckForItemBonusId = function(ids) - for id in tostring(ids):gmatch('([^,]+)') do + for id in tostring(ids):gmatch("([^,]+)") do for slot in pairs(Private.item_slot_types) do - local itemLink = GetInventoryItemLink('player', slot) + local itemLink = GetInventoryItemLink("player", slot) if itemLink and findIdInLink(id, itemLink) then return true end @@ -4190,12 +4213,11 @@ WeakAuras.CheckForItemBonusId = function(ids) return false end - WeakAuras.GetBonusIdInfo = function(ids, specificSlot) - local checkSlots = specificSlot and {[specificSlot] = true} or Private.item_slot_types - for id in tostring(ids):gmatch('([^,]+)') do + local checkSlots = specificSlot and { [specificSlot] = true } or Private.item_slot_types + for id in tostring(ids):gmatch("([^,]+)") do for slot in pairs(checkSlots) do - local itemLink = GetInventoryItemLink('player', slot) + local itemLink = GetInventoryItemLink("player", slot) if itemLink and findIdInLink(id, itemLink) then local itemID, _, _, _, icon = GetItemInfoInstant(itemLink) local itemName = itemLink:match("%[(.*)%]") @@ -4238,7 +4260,6 @@ WeakAuras.GetHitChance = function() return max(melee, ranged, spell) end - local types = {} tinsert(types, "custom") for type in pairs(Private.category_event_prototype) do @@ -4252,4 +4273,4 @@ end -- So for now make it simply a member of WeakAuras WeakAuras.genericTriggerTypes = types -WeakAuras.RegisterTriggerSystem(types, GenericTrigger); +WeakAuras.RegisterTriggerSystem(types, GenericTrigger) diff --git a/WeakAuras/History.lua b/WeakAuras/History.lua index c63e91c8ef..8ba8a0c5e2 100644 --- a/WeakAuras/History.lua +++ b/WeakAuras/History.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, Private = ... local WeakAuras = WeakAuras diff --git a/WeakAuras/Init.lua b/WeakAuras/Init.lua index 45ad031842..890471a275 100644 --- a/WeakAuras/Init.lua +++ b/WeakAuras/Init.lua @@ -16,7 +16,7 @@ local flavorFromTocToNumber = { Vanilla = 1, TBC = 2, Wrath = 3, - Mainline = 10 + Mainline = 10, } local flavor = flavorFromTocToNumber[flavorFromToc] @@ -68,7 +68,6 @@ function WeakAuras.IsWrathOrRetail() return WeakAuras.IsRetail() or WeakAuras.IsWrathClassic() end - WeakAuras.prettyPrint = function(...) print("|cff9900ffWeakAuras:|r ", ...) end @@ -81,7 +80,7 @@ local libsAreOk = true do local StandAloneLibs = { "Archivist", - "LibStub" + "LibStub", } local LibStubLibs = { "CallbackHandler-1.0", @@ -112,16 +111,16 @@ do end for _, lib in ipairs(StandAloneLibs) do if not lib then - libsAreOk = false - WeakAuras.prettyPrint("Missing library:", lib) + libsAreOk = false + WeakAuras.prettyPrint("Missing library:", lib) end end if LibStub then for _, lib in ipairs(LibStubLibs) do - if not LibStub:GetLibrary(lib, true) then - libsAreOk = false - WeakAuras.prettyPrint("Missing library:", lib) - end + if not LibStub:GetLibrary(lib, true) then + libsAreOk = false + WeakAuras.prettyPrint("Missing library:", lib) + end end else libsAreOk = false @@ -133,43 +132,34 @@ function WeakAuras.IsLibsOK() end if not WeakAuras.IsLibsOK() then - C_Timer.After(1, function() WeakAuras.prettyPrint("WeakAuras is missing necessary libraries. Please reinstall a proper package.") end) + C_Timer.After(1, function() + WeakAuras.prettyPrint("WeakAuras is missing necessary libraries. Please reinstall a proper package.") + end) end -- These function stubs are defined here to reduce the number of errors that occur if WeakAuras.lua fails to compile -function WeakAuras.RegisterRegionType() -end +function WeakAuras.RegisterRegionType() end -function WeakAuras.RegisterRegionOptions() -end +function WeakAuras.RegisterRegionOptions() end -function Private.StartProfileSystem() -end +function Private.StartProfileSystem() end -function Private.StartProfileAura() -end +function Private.StartProfileAura() end -function Private.StopProfileSystem() -end +function Private.StopProfileSystem() end -function Private.StopProfileAura() -end +function Private.StopProfileAura() end -function Private.StartProfileUID() -end +function Private.StartProfileUID() end -function Private.StopProfileUID() -end +function Private.StopProfileUID() end -- If WeakAuras shuts down due to being installed on the wrong target, keep the bindings from erroring -function WeakAuras.StartProfile() -end +function WeakAuras.StartProfile() end -function WeakAuras.StopProfile() -end +function WeakAuras.StopProfile() end -function WeakAuras.PrintProfile() -end +function WeakAuras.PrintProfile() end function WeakAuras.CountWagoUpdates() -- XXX this is to work around the Companion app trying to use our stuff! diff --git a/WeakAuras/Legendaries.lua b/WeakAuras/Legendaries.lua index 63d580a863..c58a04a5df 100644 --- a/WeakAuras/Legendaries.lua +++ b/WeakAuras/Legendaries.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, Private = ... -- Legendaries based on https://wow.tools/dbc/?dbc=runeforgelegendaryability @@ -277,7 +279,7 @@ WeakAuras.GetLegendariesBonusIds = function() return "" end - local classId = select(3, UnitClass('player')) + local classId = select(3, UnitClass("player")) local specId = GetSpecializationInfo(GetSpecialization()) local powers = C_LegendaryCrafting.GetRuneforgePowersByClassSpecAndCovenant(classId, specId) @@ -286,7 +288,7 @@ WeakAuras.GetLegendariesBonusIds = function() for _, power in ipairs(powers) do local info = C_LegendaryCrafting.GetRuneforgePowerInfo(power) if legendariesToBonusId[info.runeforgePowerID] then - abilities[info.name] = {legendariesToBonusId[info.runeforgePowerID], info.iconFileID } + abilities[info.name] = { legendariesToBonusId[info.runeforgePowerID], info.iconFileID } tinsert(names, info.name) end end @@ -295,7 +297,7 @@ WeakAuras.GetLegendariesBonusIds = function() local result = "" for index, name in ipairs(names) do - result = result .. "|T".. abilities[name][2] .. ":16|t " .. name .. ": " .. abilities[name][1] .. "\n" + result = result .. "|T" .. abilities[name][2] .. ":16|t " .. name .. ": " .. abilities[name][1] .. "\n" end return result end @@ -310,4 +312,3 @@ WeakAuras.GetLegendaryData = function(id) return data.name, data.iconFileID end end - diff --git a/WeakAuras/LibSpecializationWrapper.lua b/WeakAuras/LibSpecializationWrapper.lua index ecb84a6017..82ce1e3c5a 100644 --- a/WeakAuras/LibSpecializationWrapper.lua +++ b/WeakAuras/LibSpecializationWrapper.lua @@ -1,12 +1,16 @@ -if not WeakAuras.IsLibsOK() then return end -if not WeakAuras.IsRetail() then return end +if not WeakAuras.IsLibsOK() then + return +end +if not WeakAuras.IsRetail() then + return +end local AddonName, Private = ... local LibSpec = LibStub("LibSpecialization") local nameToSpecMap = {} local nameToUnitMap = { - [GetUnitName("player", true)] = "player" + [GetUnitName("player", true)] = "player", } local subscribers = {} @@ -72,9 +76,7 @@ if LibSpec then return nameToSpecMap[GetUnitName(unit, true)] end else -- non retail - function Private.LibSpecWrapper.Register(f) - - end + function Private.LibSpecWrapper.Register(f) end function Private.LibSpecWrapper.SpecForUnit(unit) return nil diff --git a/WeakAuras/Locales/enUS.lua b/WeakAuras/Locales/enUS.lua index e4ad3bb59a..22c7a49821 100644 --- a/WeakAuras/Locales/enUS.lua +++ b/WeakAuras/Locales/enUS.lua @@ -3,8 +3,9 @@ local L = WeakAuras.L --@localization(locale="enUS", format="lua_additive_table", namespace="WeakAuras", handle-subnamespaces="none")@ -- Make missing translations available -setmetatable(WeakAuras.L, {__index = function(self, key) - self[key] = (key or "") - return key -end}) - +setmetatable(WeakAuras.L, { + __index = function(self, key) + self[key] = (key or "") + return key + end, +}) diff --git a/WeakAuras/Modernize.lua b/WeakAuras/Modernize.lua index 6888f32f93..b9dec1ecc2 100644 --- a/WeakAuras/Modernize.lua +++ b/WeakAuras/Modernize.lua @@ -1,43 +1,45 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, Private = ... local L = WeakAuras.L -- Takes as input a table of display data and attempts to update it to be compatible with the current version function Private.Modernize(data) - if (not data.internalVersion or data.internalVersion < 2) then + if not data.internalVersion or data.internalVersion < 2 then WeakAuras.prettyPrint(string.format("Data for '%s' is too old, can't modernize.", data.id)) - data.internalVersion = 2; + data.internalVersion = 2 end -- Version 3 was introduced April 2018 in Legion - if (data.internalVersion < 3) then - if (data.parent) then - local parentData = WeakAuras.GetData(data.parent); - if(parentData and parentData.regionType == "dynamicgroup") then + if data.internalVersion < 3 then + if data.parent then + local parentData = WeakAuras.GetData(data.parent) + if parentData and parentData.regionType == "dynamicgroup" then -- Version 3 allowed for offsets for dynamic groups, before that they were ignored -- Thus reset them in the V2 to V3 upgrade - data.xOffset = 0; - data.yOffset = 0; + data.xOffset = 0 + data.yOffset = 0 end end end -- Version 4 was introduced July 2018 in BfA - if (data.internalVersion < 4) then - if (data.conditions) then + if data.internalVersion < 4 then + if data.conditions then for conditionIndex, condition in ipairs(data.conditions) do - if (condition.check) then - local triggernum = condition.check.trigger; - if (triggernum) then - local trigger; - if (triggernum == 0) then - trigger = data.trigger; - elseif(data.additional_triggers and data.additional_triggers[triggernum]) then - trigger = data.additional_triggers[triggernum].trigger; + if condition.check then + local triggernum = condition.check.trigger + if triggernum then + local trigger + if triggernum == 0 then + trigger = data.trigger + elseif data.additional_triggers and data.additional_triggers[triggernum] then + trigger = data.additional_triggers[triggernum].trigger end - if (trigger and trigger.event == "Cooldown Progress (Spell)") then - if (condition.check.variable == "stacks") then - condition.check.variable = "charges"; + if trigger and trigger.event == "Cooldown Progress (Spell)" then + if condition.check.variable == "stacks" then + condition.check.variable = "charges" end end end @@ -67,7 +69,7 @@ function Private.Modernize(data) if data.internalVersion < 6 then if data.triggers then for triggernum, triggerData in ipairs(data.triggers) do - local trigger = triggerData.trigger; + local trigger = triggerData.trigger if trigger and trigger.type == "aura" then if trigger.showOn == "showOnMissing" then trigger.buffShowOn = "showOnMissing" @@ -90,7 +92,6 @@ function Private.Modernize(data) -- Triggers were cleaned up into a 1-indexed array if data.internalVersion < 7 then - -- migrate trigger data data.triggers = data.additional_triggers or {} tinsert(data.triggers, 1, { @@ -113,7 +114,9 @@ function Private.Modernize(data) data.disjunctive = nil -- migrate condition trigger references local function recurseRepairChecks(checks) - if not checks then return end + if not checks then + return + end for _, check in pairs(checks) do if check.trigger and check.trigger >= 0 then check.trigger = check.trigger + 1 @@ -136,28 +139,30 @@ function Private.Modernize(data) if data.internalVersion < 9 then local function repairCheck(check) if check and check.variable == "buffed" then - local trigger = check.trigger and data.triggers[check.trigger] and data.triggers[check.trigger].trigger; - if (trigger) then - if(trigger.buffShowOn == "showOnActive") then - check.variable = "show"; - elseif (trigger.buffShowOn == "showOnMissing") then - check.variable = "show"; - check.value = check.value == 0 and 1 or 0; + local trigger = check.trigger and data.triggers[check.trigger] and data.triggers[check.trigger].trigger + if trigger then + if trigger.buffShowOn == "showOnActive" then + check.variable = "show" + elseif trigger.buffShowOn == "showOnMissing" then + check.variable = "show" + check.value = check.value == 0 and 1 or 0 end end end end local function recurseRepairChecks(checks) - if not checks then return end + if not checks then + return + end for _, check in pairs(checks) do - repairCheck(check); - recurseRepairChecks(check.checks); + repairCheck(check) + recurseRepairChecks(check.checks) end end for _, condition in pairs(data.conditions) do - repairCheck(condition.check); - recurseRepairChecks(condition.check.checks); + repairCheck(condition.check) + recurseRepairChecks(condition.check.checks) end end @@ -177,7 +182,7 @@ function Private.Modernize(data) end -- Version 12 was introduced February 2019 in BfA - if (data.internalVersion < 12) then + if data.internalVersion < 12 then if data.cooldownTextEnabled ~= nil then data.cooldownTextDisabled = not data.cooldownTextEnabled data.cooldownTextEnabled = nil @@ -190,7 +195,7 @@ function Private.Modernize(data) local selfPoints = { default = "CENTER", RIGHT = function(data) - if data.align == "LEFT" then + if data.align == "LEFT" then return "TOPLEFT" elseif data.align == "RIGHT" then return "BOTTOMLEFT" @@ -199,7 +204,7 @@ function Private.Modernize(data) end end, LEFT = function(data) - if data.align == "LEFT" then + if data.align == "LEFT" then return "TOPRIGHT" elseif data.align == "RIGHT" then return "BOTTOMRIGHT" @@ -258,11 +263,12 @@ function Private.Modernize(data) if data.internalVersion < 14 then if data.triggers then for triggerId, triggerData in pairs(data.triggers) do - if type(triggerData) == "table" - and triggerData.trigger - and triggerData.trigger.debuffClass - and type(triggerData.trigger.debuffClass) == "string" - and triggerData.trigger.debuffClass ~= "" + if + type(triggerData) == "table" + and triggerData.trigger + and triggerData.trigger.debuffClass + and type(triggerData.trigger.debuffClass) == "string" + and triggerData.trigger.debuffClass ~= "" then local idx = triggerData.trigger.debuffClass data.triggers[triggerId].trigger.debuffClass = { [idx] = true } @@ -352,7 +358,7 @@ function Private.Modernize(data) text_anchorPoint = convertPoint(data.text1Containment, data.text1Point), anchorXOffset = 0, anchorYOffset = 0, - text_shadowColor = { 0, 0, 0, 1}, + text_shadowColor = { 0, 0, 0, 1 }, text_shadowXOffset = 0, text_shadowYOffset = 0, } @@ -371,7 +377,7 @@ function Private.Modernize(data) text_anchorPoint = convertPoint(data.text2Containment, data.text2Point), anchorXOffset = 0, anchorYOffset = 0, - text_shadowColor = { 0, 0, 0, 1}, + text_shadowColor = { 0, 0, 0, 1 }, text_shadowXOffset = 0, text_shadowYOffset = 0, } @@ -398,16 +404,16 @@ function Private.Modernize(data) text1Color = "sub.1.text_color", text1FontSize = "sub.1.text_fontSize", text2Color = "sub.2.text_color", - text2FontSize = "sub.2.text_fontSize" + text2FontSize = "sub.2.text_fontSize", } data.subRegions = data.subRegions or {} tinsert(data.subRegions, text1) - if (usetext2) then + if usetext2 then tinsert(data.subRegions, text2) end - if (data.conditions) then + if data.conditions then for conditionIndex, condition in ipairs(data.conditions) do for changeIndex, change in ipairs(condition.changes) do if propertyRenames[change.property] then @@ -426,7 +432,7 @@ function Private.Modernize(data) HORIZONTAL_INVERSE = { "INNER_LEFT", "INNER_RIGHT" }, HORIZONTAL = { "INNER_RIGHT", "INNER_LEFT" }, VERTICAL_INVERSE = { "INNER_BOTTOM", "INNER_TOP" }, - VERTICAL = {"INNER_TOP", "INNER_BOTTOM"} + VERTICAL = { "INNER_TOP", "INNER_BOTTOM" }, } local positions = orientationToPostion[data.orientation] or { "INNER_LEFT", "INNER_RIGHT" } @@ -443,10 +449,10 @@ function Private.Modernize(data) text_anchorPoint = positions[1], anchorXOffset = 0, anchorYOffset = 0, - text_shadowColor = { 0, 0, 0, 1}, + text_shadowColor = { 0, 0, 0, 1 }, text_shadowXOffset = 1, text_shadowYOffset = -1, - rotateText = data.rotateText + rotateText = data.rotateText, } local text2 = { @@ -461,10 +467,10 @@ function Private.Modernize(data) text_anchorPoint = positions[2], anchorXOffset = 0, anchorYOffset = 0, - text_shadowColor = { 0, 0, 0, 1}, + text_shadowColor = { 0, 0, 0, 1 }, text_shadowXOffset = 1, text_shadowYOffset = -1, - rotateText = data.rotateText + rotateText = data.rotateText, } local text3 = { @@ -479,10 +485,10 @@ function Private.Modernize(data) text_anchorPoint = "ICON_CENTER", anchorXOffset = 0, anchorYOffset = 0, - text_shadowColor = { 0, 0, 0, 1}, + text_shadowColor = { 0, 0, 0, 1 }, text_shadowXOffset = 1, text_shadowYOffset = -1, - rotateText = data.rotateText + rotateText = data.rotateText, } data.timer = nil @@ -518,7 +524,7 @@ function Private.Modernize(data) tinsert(data.subRegions, text2) tinsert(data.subRegions, text3) - if (data.conditions) then + if data.conditions then for conditionIndex, condition in ipairs(data.conditions) do for changeIndex, change in ipairs(condition.changes) do if propertyRenames[change.property] then @@ -527,7 +533,6 @@ function Private.Modernize(data) end end end - end end @@ -569,10 +574,10 @@ function Private.Modernize(data) end local propertyRenames = { - borderColor = "sub.".. #data.subRegions..".border_color", + borderColor = "sub." .. #data.subRegions .. ".border_color", } - if (data.conditions) then + if data.conditions then for conditionIndex, condition in ipairs(data.conditions) do for changeIndex, change in ipairs(condition.changes) do if propertyRenames[change.property] then @@ -596,7 +601,7 @@ function Private.Modernize(data) if value then trigger.form = { multi = { [value] = true } } else - trigger.form = { multi = { } } + trigger.form = { multi = {} } end elseif trigger.use_form then trigger.form = { single = value } @@ -632,7 +637,7 @@ function Private.Modernize(data) data.subRegions = data.subRegions or {} -- Need to check if glow is needed - local prefix = "sub.".. #data.subRegions + 1 .. "." + local prefix = "sub." .. #data.subRegions + 1 .. "." -- For Conditions local propertyRenames = { glow = prefix .. "glow", @@ -650,7 +655,7 @@ function Private.Modernize(data) } local needsGlow = data.glow - if (not needsGlow and data.conditions) then + if not needsGlow and data.conditions then for conditionIndex, condition in ipairs(data.conditions) do for changeIndex, change in ipairs(condition.changes) do if propertyRenames[change.property] then @@ -694,7 +699,7 @@ function Private.Modernize(data) data.glowXOffset = nil data.glowYOffset = nil - if (data.conditions) then + if data.conditions then for conditionIndex, condition in ipairs(data.conditions) do for changeIndex, change in ipairs(condition.changes) do if propertyRenames[change.property] then @@ -732,16 +737,10 @@ function Private.Modernize(data) if data.internalVersion < 29 then if data.actions then - if data.actions.start - and data.actions.start.do_glow - and data.actions.start.glow_type == nil - then + if data.actions.start and data.actions.start.do_glow and data.actions.start.glow_type == nil then data.actions.start.glow_type = "buttonOverlay" end - if data.actions.finish - and data.actions.finish.do_glow - and data.actions.finish.glow_type == nil - then + if data.actions.finish and data.actions.finish.do_glow and data.actions.finish.glow_type == nil then data.actions.finish.glow_type = "buttonOverlay" end end @@ -769,8 +768,8 @@ function Private.Modernize(data) sym = sym or symbol if sym == "p" or sym == "t" then data["displayText_format_" .. symbol .. "_format"] = "timed" - data["displayText_format_" .. symbol .. "_time_precision"], data["displayText_format_" .. symbol .. "_time_dynamic"] - = convertLegacyPrecision(sym == "p" and progressPrecision or totalPrecision) + data["displayText_format_" .. symbol .. "_time_precision"], data["displayText_format_" .. symbol .. "_time_dynamic"] = + convertLegacyPrecision(sym == "p" and progressPrecision or totalPrecision) end end seenSymbols[symbol] = symbol @@ -787,8 +786,8 @@ function Private.Modernize(data) sym = sym or symbol if sym == "p" or sym == "t" then subRegionData["text_text_format_" .. symbol .. "_format"] = "timed" - subRegionData["text_text_format_" .. symbol .. "_time_precision"], subRegionData["text_text_format_" .. symbol .. "_time_dynamic"] - = convertLegacyPrecision(sym == "p" and progressPrecision or totalPrecision) + subRegionData["text_text_format_" .. symbol .. "_time_precision"], subRegionData["text_text_format_" .. symbol .. "_time_dynamic"] = + convertLegacyPrecision(sym == "p" and progressPrecision or totalPrecision) end end seenSymbols[symbol] = symbol @@ -798,7 +797,7 @@ function Private.Modernize(data) end if data.actions then - for _, when in ipairs{ "start", "finish" } do + for _, when in ipairs({ "start", "finish" }) do if data.actions[when] then local seenSymbols = {} Private.ParseTextStr(data.actions[when].message, function(symbol) @@ -807,8 +806,8 @@ function Private.Modernize(data) sym = sym or symbol if sym == "p" or sym == "t" then data.actions[when]["message_format_" .. symbol .. "_format"] = "timed" - data.actions[when]["message_format_" .. symbol .. "_time_precision"], data.actions[when]["message_format_" .. symbol .. "_time_dynamic"] - = convertLegacyPrecision(sym == "p" and progressPrecision or totalPrecision) + data.actions[when]["message_format_" .. symbol .. "_time_precision"], data.actions[when]["message_format_" .. symbol .. "_time_dynamic"] = + convertLegacyPrecision(sym == "p" and progressPrecision or totalPrecision) end end seenSymbols[symbol] = symbol @@ -828,8 +827,8 @@ function Private.Modernize(data) sym = sym or symbol if sym == "p" or sym == "t" then change.value["message_format_" .. symbol .. "_format"] = "timed" - change.value["message_format_" .. symbol .. "_time_precision"], change.value["message_format_" .. symbol .. "_time_dynamic"] - = convertLegacyPrecision(sym == "p" and progressPrecision or totalPrecision) + change.value["message_format_" .. symbol .. "_time_precision"], change.value["message_format_" .. symbol .. "_time_dynamic"] = + convertLegacyPrecision(sym == "p" and progressPrecision or totalPrecision) end end seenSymbols[symbol] = symbol @@ -915,15 +914,17 @@ function Private.Modernize(data) end local function recurseRepairChecks(replacements, checks) - if not checks then return end + if not checks then + return + end for _, check in pairs(checks) do - repairCheck(replacements, check); - recurseRepairChecks(replacements, check.checks); + repairCheck(replacements, check) + recurseRepairChecks(replacements, check.checks) end end for _, condition in pairs(data.conditions) do - repairCheck(replacements, condition.check); - recurseRepairChecks(replacements, condition.check.checks); + repairCheck(replacements, condition.check) + recurseRepairChecks(replacements, condition.check.checks) end end end @@ -952,13 +953,11 @@ function Private.Modernize(data) triggerData.trigger.blackauraspellids = nil end end - end -- Introduced in July 2020 in Shadowlands if data.internalVersion < 34 then - if data.regionType == 'dynamicgroup' - and (data.grow == "CIRCLE" or data.grow == "COUNTERCIRCLE") then + if data.regionType == "dynamicgroup" and (data.grow == "CIRCLE" or data.grow == "COUNTERCIRCLE") then if data.arcLength == 360 then data.fullCircle = true else @@ -968,7 +967,7 @@ function Private.Modernize(data) end if data.internalVersion < 35 then - if data.regionType == 'texture' then + if data.regionType == "texture" then data.textureWrapMode = "CLAMP" end end @@ -1023,7 +1022,7 @@ function Private.Modernize(data) end if data.internalVersion < 39 then - if data.regionType == 'icon' or data.regionType == 'aurabar' then + if data.regionType == "icon" or data.regionType == "aurabar" then if data.auto then data.iconSource = -1 else @@ -1034,7 +1033,7 @@ function Private.Modernize(data) if data.internalVersion < 40 then data.information = data.information or {} - if data.regionType == 'group' then + if data.regionType == "group" then data.information.groupOffset = true end data.information.ignoreOptionsEventErrors = data.ignoreOptionsEventErrors @@ -1208,7 +1207,7 @@ function Private.Modernize(data) end if data.actions then - for _, when in ipairs{ "start", "finish" } do + for _, when in ipairs({ "start", "finish" }) do if data.actions[when] then fixUp(data.actions[when], "message_format_") end @@ -1237,13 +1236,13 @@ function Private.Modernize(data) trigger.use_instance_size = false trigger.instance_size.multi = { arena = true, - ratedarena = true + ratedarena = true, } elseif trigger.instance_size.single == "pvp" then trigger.use_instance_size = false trigger.instance_size.multi = { pvp = true, - ratedpvp = true + ratedpvp = true, } end end @@ -1266,13 +1265,13 @@ function Private.Modernize(data) data.load.use_size = false data.load.size.multi = { arena = true, - ratedarena = true + ratedarena = true, } elseif data.load.size.single == "pvp" then data.load.use_size = false data.load.size.multi = { pvp = true, - ratedpvp = true + ratedpvp = true, } end elseif data.load.use_size == false then @@ -1285,19 +1284,18 @@ function Private.Modernize(data) end end end - end - if (data.internalVersion < 46) then - if (data.conditions) then + if data.internalVersion < 46 then + if data.conditions then for conditionIndex, condition in ipairs(data.conditions) do - if (condition.check) then - local triggernum = condition.check.trigger; - if (triggernum) then + if condition.check then + local triggernum = condition.check.trigger + if triggernum then local trigger = data.triggers[triggernum] - if (trigger and trigger.trigger and trigger.trigger.event == "Power") then - if (condition.check.variable == "chargedComboPoint") then - condition.check.variable = "chargedComboPoint1"; + if trigger and trigger.trigger and trigger.trigger.event == "Power" then + if condition.check.variable == "chargedComboPoint" then + condition.check.variable = "chargedComboPoint1" end end end @@ -1306,7 +1304,7 @@ function Private.Modernize(data) end end - if (data.internalVersion < 49) then + if data.internalVersion < 49 then if not data.regionType:match("group") then data.subRegions = data.subRegions or {} -- rename aurabar_bar into subforeground, and subbarmodel into submodel @@ -1334,9 +1332,9 @@ function Private.Modernize(data) local prefix, property = change.property:match("(sub%.%d+%.)(.*)") if prefix and property then if property == "bar_model_visible" then - change.property = prefix.."model_visible" + change.property = prefix .. "model_visible" elseif property == "bar_model_alpha" then - change.property = prefix.."model_alpha" + change.property = prefix .. "model_alpha" end end end @@ -1347,7 +1345,7 @@ function Private.Modernize(data) end end - if (data.internalVersion == 49) then + if data.internalVersion == 49 then -- Version 49 was a dud and contained a broken validation. Try to salvage the data, as -- best as we can. local broken = false @@ -1363,7 +1361,7 @@ function Private.Modernize(data) local subRegionIndex, property = change.property:match("^sub%.(%d+)%.(.*)") if subRegionIndex and property then broken = true - for _, offset in ipairs({-1, 1}) do + for _, offset in ipairs({ -1, 1 }) do local newProperty = "sub." .. subRegionIndex + offset .. "." .. property if properties[newProperty] then change.property = newProperty @@ -1381,7 +1379,7 @@ function Private.Modernize(data) end end - if (data.internalVersion < 51) then + if data.internalVersion < 51 then for triggerId, triggerData in ipairs(data.triggers) do if triggerData.trigger.event == "Threat Situation" then triggerData.trigger.unit = triggerData.trigger.threatUnit @@ -1392,7 +1390,7 @@ function Private.Modernize(data) end end - if (data.internalVersion < 52) then + if data.internalVersion < 52 then local function matchTarget(input) return input == "target" or input == "'target'" or input == "\"target\"" or input == "%t" or input == "'%t'" or input == "\"%t\"" end @@ -1410,18 +1408,12 @@ function Private.Modernize(data) end end - if data.actions.start.do_message - and data.actions.start.message_type == "WHISPER" - and matchTarget(data.actions.start.message_dest) - then + if data.actions.start.do_message and data.actions.start.message_type == "WHISPER" and matchTarget(data.actions.start.message_dest) then data.actions.start.message_dest = "target" data.actions.start.message_dest_isunit = true end - if data.actions.finish.do_message - and data.actions.finish.message_type == "WHISPER" - and matchTarget(data.actions.finish.message_dest) - then + if data.actions.finish.do_message and data.actions.finish.message_type == "WHISPER" and matchTarget(data.actions.finish.message_dest) then data.actions.finish.message_dest = "target" data.actions.finish.message_dest_isunit = true end @@ -1432,9 +1424,7 @@ function Private.Modernize(data) local seenSymbols = {} Private.ParseTextStr(text, function(symbol) if not seenSymbols[symbol] then - if table[prefix .. symbol .. "_format"] == "timed" - and table[prefix .. symbol .. "_time_format"] == 0 - then + if table[prefix .. symbol .. "_format"] == "timed" and table[prefix .. symbol .. "_time_format"] == 0 then table[prefix .. symbol .. "_time_legacy_floor"] = true end end @@ -1474,5 +1464,5 @@ function Private.Modernize(data) end end - data.internalVersion = max(data.internalVersion or 0, WeakAuras.InternalVersion()); + data.internalVersion = max(data.internalVersion or 0, WeakAuras.InternalVersion()) end diff --git a/WeakAuras/Profiling.lua b/WeakAuras/Profiling.lua index cc3d1e4561..daa76af42a 100644 --- a/WeakAuras/Profiling.lua +++ b/WeakAuras/Profiling.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, Private = ... local WeakAuras = WeakAuras @@ -38,11 +40,11 @@ table_to_string = function(tbl, depth) elseif type(v) == "function" then v = "function" elseif type(v) == "string" then - v = '"'.. v ..'"' + v = "\"" .. v .. "\"" end if type(k) == "string" then - k = '"' .. k ..'"' + k = "\"" .. k .. "\"" end str = (str and str .. "|cff999999,|r " or "|cff999999{|r ") .. "|cffffff99[" .. tostring(k) .. "]|r |cff999999=|r |cffffffff" .. tostring(v) .. "|r" @@ -104,7 +106,9 @@ local function CreateProfilePopup() popupFrame:SetAutoFocus(false) popupFrame:SetFontObject(ChatFontNormal) popupFrame:SetSize(450, 300) - popupFrame:SetScript("OnChar", function() popupFrame:SetText(popupFrame.originalText) end); + popupFrame:SetScript("OnChar", function() + popupFrame:SetText(popupFrame.originalText) + end) popupFrame:Hide() popupFrame.orig_Hide = popupFrame.Hide @@ -123,7 +127,9 @@ local function CreateProfilePopup() end function popupFrame:AddText(v) - if not v then return end + if not v then + return + end local m = popupFrame:GetText() if m ~= "" then m = m .. "|n" @@ -163,7 +169,7 @@ local function CreateProfilePopup() tile = true, tileSize = 32, edgeSize = 32, - insets = { left = 4, right = 4, top = 4, bottom = 4 } + insets = { left = 4, right = 4, top = 4, bottom = 4 }, }) bg:SetPoint("TOPLEFT", scrollFrame, -20, 20) bg:SetPoint("BOTTOMRIGHT", scrollFrame, 35, -25) @@ -286,7 +292,9 @@ function Private.ProfileRenameAura(oldid, id) end local RegisterProfile = function(startType) - if startType == "boss" then startType = "encounter" end + if startType == "boss" then + startType = "encounter" + end local delayedStart if startType == "encounter" then RealTimeProfilingWindow:UnregisterAllEvents() @@ -346,11 +354,10 @@ function WeakAuras.StartProfile(startType) LGF.StartProfile() end -local function doNothing() -end +local function doNothing() end function WeakAuras.StopProfile() - if (currentProfileState ~= "profiling") then + if currentProfileState ~= "profiling" then prettyPrint(L["Profiling not running."]) return end @@ -378,7 +385,7 @@ function WeakAuras.StopProfile() end function WeakAuras.ToggleProfile() - if (not profileData.systems.time or profileData.systems.time.count ~= 1) then + if not profileData.systems.time or profileData.systems.time.count ~= 1 then WeakAuras.StartProfile() else WeakAuras.StopProfile() @@ -464,7 +471,7 @@ function WeakAuras.PrintProfile() popup:AddText("") popup:AddText("|cff9900ffAuras:|r") local total = TotalProfileTime(profileData.auras) - popup:AddText("Total time attributed to auras: ", floor(total) .."ms") + popup:AddText("Total time attributed to auras: ", floor(total) .. "ms") for i, k in ipairs(SortProfileMap(profileData.auras)) do PrintOneProfile(popup, k, profileData.auras[k], total) end @@ -473,7 +480,7 @@ function WeakAuras.PrintProfile() popup:AddText("|cff9900ffSystems:|r") for i, k in ipairs(SortProfileMap(profileData.systems)) do - if (k ~= "time" and k ~= "wa") then + if k ~= "time" and k ~= "wa" then PrintOneProfile(popup, k, profileData.systems[k], profileData.systems.wa.elapsed) end end @@ -529,7 +536,7 @@ function RealTimeProfilingWindow:GetBar(name) local txtPct = bar:CreateFontString(nil, "OVERLAY", "GameFontNormal") bar.txtPct = txtPct txtPct:SetPoint("TOPLEFT", bar, "TOPRIGHT", -55, 0) - txtPct:SetPoint("BOTTOMRIGHT", bar, "BOTTOMRIGHT", - margin, 0) + txtPct:SetPoint("BOTTOMRIGHT", bar, "BOTTOMRIGHT", -margin, 0) txtPct:SetJustifyH("RIGHT") function bar:SetValue(value) @@ -559,7 +566,7 @@ function RealTimeProfilingWindow:GetBar(name) self:Hide() else self:ClearAllPoints() - self:SetPoint("TOPLEFT", self.parent.barsFrame, "TOPLEFT", 0, - (pos - 1) * self.parent.barHeight) + self:SetPoint("TOPLEFT", self.parent.barsFrame, "TOPLEFT", 0, -(pos - 1) * self.parent.barHeight) if pos % 2 == 0 then bar.fg:SetColorTexture(0.7, 0.7, 0.7, 0.7) bar.bg:SetColorTexture(0, 0, 0, 0.2) @@ -582,7 +589,7 @@ function RealTimeProfilingWindow:RefreshBars() local total = TotalProfileTime(profileData.auras) for i, name in ipairs(SortProfileMap(profileData.auras)) do - if (name ~= "time" and name ~= "wa") then + if name ~= "time" and name ~= "wa" then local bar = self:GetBar(name) local elapsed = profileData.auras[name].elapsed local pct = 100 * elapsed / total @@ -594,11 +601,9 @@ function RealTimeProfilingWindow:RefreshBars() end if profileData.systems.wa then local timespent = debugprofilestop() - profileData.systems.time.start - self.statsFrameText:SetText(("|cFFFFFFFFTime in WA: %.2fs / %ds (%.1f%%)"):format( - profileData.systems.wa.elapsed / 1000, - timespent / 1000, - 100 * profileData.systems.wa.elapsed / timespent - )) + self.statsFrameText:SetText( + ("|cFFFFFFFFTime in WA: %.2fs / %ds (%.1f%%)"):format(profileData.systems.wa.elapsed / 1000, timespent / 1000, 100 * profileData.systems.wa.elapsed / timespent) + ) end end @@ -696,7 +701,7 @@ function RealTimeProfilingWindow:Init() toggleButton:SetText(L["Start Now"]) toggleButton:SetScript("OnClick", function(self) local parent = self:GetParent():GetParent() - if (not profileData.systems.time or profileData.systems.time.count ~= 1) then + if not profileData.systems.time or profileData.systems.time.count ~= 1 then parent:ResetBars() WeakAuras.StartProfile() else @@ -704,7 +709,6 @@ function RealTimeProfilingWindow:Init() end end) - local reportButton = CreateFrame("Button", nil, statsFrame, "UIPanelButtonTemplate") self.reportButton = reportButton reportButton:SetPoint("TOPLEFT", statsFrame, "BOTTOMLEFT", spacing, spacing) @@ -719,7 +723,7 @@ function RealTimeProfilingWindow:Init() local combatButton = CreateFrame("Button", nil, statsFrame, "UIPanelButtonTemplate") self.combatButton = combatButton - combatButton:SetPoint("TOPRIGHT", statsFrame, "BOTTOMRIGHT", -spacing - width , spacing) + combatButton:SetPoint("TOPRIGHT", statsFrame, "BOTTOMRIGHT", -spacing - width, spacing) combatButton:SetFrameLevel(statsFrame:GetFrameLevel() + 1) combatButton:SetHeight(20) combatButton:SetWidth(width) diff --git a/WeakAuras/Prototypes.lua b/WeakAuras/Prototypes.lua index 345d3d7140..590f7c6d9c 100644 --- a/WeakAuras/Prototypes.lua +++ b/WeakAuras/Prototypes.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, Private = ... -- Lua APIs @@ -28,25 +30,25 @@ end local LibRangeCheck = LibStub("LibRangeCheck-2.0") function WeakAuras.GetRange(unit, checkVisible) - return LibRangeCheck:GetRange(unit, checkVisible); + return LibRangeCheck:GetRange(unit, checkVisible) end function WeakAuras.CheckRange(unit, range, operator) - local min, max = LibRangeCheck:GetRange(unit, true); - if (type(range) ~= "number") then - range = tonumber(range); + local min, max = LibRangeCheck:GetRange(unit, true) + if type(range) ~= "number" then + range = tonumber(range) end - if (not range) then + if not range then return end - if (operator == "<=") then - return (max or 999) <= range; + if operator == "<=" then + return (max or 999) <= range else - return (min or 0) >= range; + return (min or 0) >= range end end -local RangeCacheStrings = {friend = "", harm = "", misc = ""} +local RangeCacheStrings = { friend = "", harm = "", misc = "" } local function RangeCacheUpdate() local friend, harm, misc = {}, {}, {} local friendString, harmString, miscString @@ -71,7 +73,7 @@ local function RangeCacheUpdate() harmString = (harmString and (harmString .. ", ") or "") .. key end for _, key in pairs(misc) do - miscString = (miscString and (miscString .. ", ") or "") .. key + miscString = (miscString and (miscString .. ", ") or "") .. key end RangeCacheStrings.friend, RangeCacheStrings.harm, RangeCacheStrings.misc = friendString, harmString, miscString end @@ -141,21 +143,19 @@ function WeakAuras.RaidFlagToIndex(flag) end local function get_zoneId_list() - if WeakAuras.IsClassic() then return "" end + if WeakAuras.IsClassic() then + return "" + end local currentmap_id = C_Map.GetBestMapForUnit("player") if not currentmap_id then - return ("%s\n\n%s"):format( - Private.get_zoneId_list(), - L["Supports multiple entries, separated by commas. Group Zone IDs must be prefixed with 'g', e.g. g277."] - ) + return ("%s\n\n%s"):format(Private.get_zoneId_list(), L["Supports multiple entries, separated by commas. Group Zone IDs must be prefixed with 'g', e.g. g277."]) end local currentmap_info = C_Map.GetMapInfo(currentmap_id) local currentmap_name = currentmap_info and currentmap_info.name or "" local currentmap_zone_name = "" local mapGroupId = C_Map.GetMapGroupID(currentmap_id) if mapGroupId then - currentmap_zone_name = string.format("|cffffd200%s|r%s: g%d\n\n", - L["Current Zone Group\n"], currentmap_name, mapGroupId) + currentmap_zone_name = string.format("|cffffd200%s|r%s: g%d\n\n", L["Current Zone Group\n"], currentmap_name, mapGroupId) -- if map is in a group, its real name is (or should be?) found in GetMapGroupMembersInfo for k, map in ipairs(C_Map.GetMapGroupMembersInfo(mapGroupId)) do @@ -203,8 +203,8 @@ Private.function_strings = { return function() return true end - ]] -}; + ]], +} local hsvFrame = CreateFrame("ColorSelect") @@ -227,78 +227,77 @@ function WeakAuras.GetHSVTransition(perc, r1, g1, b1, a1, r2, g2, b2, a2) end h3 = (h1 + perc * diff) % 360 - local s3 = s1 - ( s1 - s2 ) * perc - local v3 = v1 - ( v1 - v2 ) * perc + local s3 = s1 - (s1 - s2) * perc + local v3 = v1 - (v1 - v2) * perc --get the RGB values of the new color hsvFrame:SetColorHSV(h3, s3, v3) local r, g, b = hsvFrame:GetColorRGB() --interpolate alpha - local a = a1 - ( a1 - a2 ) * perc + local a = a1 - (a1 - a2) * perc --return the new color return r, g, b, a end - Private.anim_function_strings = { -straight = [[ + straight = [[ function(progress, start, delta) return start + (progress * delta) end ]], -straightTranslate = [[ + straightTranslate = [[ function(progress, startX, startY, deltaX, deltaY) return startX + (progress * deltaX), startY + (progress * deltaY) end ]], -straightScale = [[ + straightScale = [[ function(progress, startX, startY, scaleX, scaleY) return startX + (progress * (scaleX - startX)), startY + (progress * (scaleY - startY)) end ]], -straightColor = [[ + straightColor = [[ function(progress, r1, g1, b1, a1, r2, g2, b2, a2) return r1 + (progress * (r2 - r1)), g1 + (progress * (g2 - g1)), b1 + (progress * (b2 - b1)), a1 + (progress * (a2 - a1)) end ]], -straightHSV = [[ + straightHSV = [[ function(progress, r1, g1, b1, a1, r2, g2, b2, a2) return WeakAuras.GetHSVTransition(progress, r1, g1, b1, a1, r2, g2, b2, a2) end ]], -circle = [[ + circle = [[ function(progress, startX, startY, deltaX, deltaY) local angle = progress * 2 * math.pi return startX + (deltaX * math.cos(angle)), startY + (deltaY * math.sin(angle)) end ]], -circle2 = [[ + circle2 = [[ function(progress, startX, startY, deltaX, deltaY) local angle = progress * 2 * math.pi return startX + (deltaX * math.sin(angle)), startY + (deltaY * math.cos(angle)) end ]], -spiral = [[ + spiral = [[ function(progress, startX, startY, deltaX, deltaY) local angle = progress * 2 * math.pi return startX + (progress * deltaX * math.cos(angle)), startY + (progress * deltaY * math.sin(angle)) end ]], -spiralandpulse = [[ + spiralandpulse = [[ function(progress, startX, startY, deltaX, deltaY) local angle = (progress + 0.25) * 2 * math.pi return startX + (math.cos(angle) * deltaX * math.cos(angle*2)), startY + (math.abs(math.cos(angle)) * deltaY * math.sin(angle*2)) end ]], -shake = [[ + shake = [[ function(progress, startX, startY, deltaX, deltaY) local prog if(progress < 0.25) then @@ -312,7 +311,7 @@ function(progress, startX, startY, deltaX, deltaY) end ]], -starShakeDecay = [[ + starShakeDecay = [[ function(progress, startX, startY, deltaX, deltaY) local spokes = 10 local fullCircles = 4 @@ -341,7 +340,7 @@ function(progress, startX, startY, deltaX, deltaY) end ]], -bounceDecay = [[ + bounceDecay = [[ function(progress, startX, startY, deltaX, deltaY) local prog = (progress * 3.5) % 1 local bounce = math.ceil(progress * 3.5) @@ -350,14 +349,14 @@ function(progress, startX, startY, deltaX, deltaY) end ]], -bounce = [[ + bounce = [[ function(progress, startX, startY, deltaX, deltaY) local bounceDistance = math.sin(progress * math.pi) return startX + (bounceDistance * deltaX), startY + (bounceDistance * deltaY) end ]], -flash = [[ + flash = [[ function(progress, start, delta) local prog if(progress < 0.5) then @@ -369,21 +368,21 @@ function(progress, start, delta) end ]], -pulse = [[ + pulse = [[ function(progress, startX, startY, scaleX, scaleY) local angle = (progress * 2 * math.pi) - (math.pi / 2) return startX + (((math.sin(angle) + 1)/2) * (scaleX - 1)), startY + (((math.sin(angle) + 1)/2) * (scaleY - 1)) end ]], -alphaPulse = [[ + alphaPulse = [[ function(progress, start, delta) local angle = (progress * 2 * math.pi) - (math.pi / 2) return start + (((math.sin(angle) + 1)/2) * delta) end ]], -pulseColor = [[ + pulseColor = [[ function(progress, r1, g1, b1, a1, r2, g2, b2, a2) local angle = (progress * 2 * math.pi) - (math.pi / 2) local newProgress = ((math.sin(angle) + 1)/2); @@ -394,7 +393,7 @@ function(progress, r1, g1, b1, a1, r2, g2, b2, a2) end ]], -pulseHSV = [[ + pulseHSV = [[ function(progress, r1, g1, b1, a1, r2, g2, b2, a2) local angle = (progress * 2 * math.pi) - (math.pi / 2) local newProgress = ((math.sin(angle) + 1)/2); @@ -402,21 +401,21 @@ function(progress, r1, g1, b1, a1, r2, g2, b2, a2) end ]], -fauxspin = [[ + fauxspin = [[ function(progress, startX, startY, scaleX, scaleY) local angle = progress * 2 * math.pi return math.cos(angle) * scaleX, startY + (progress * (scaleY - startY)) end ]], -fauxflip = [[ + fauxflip = [[ function(progress, startX, startY, scaleX, scaleY) local angle = progress * 2 * math.pi return startX + (progress * (scaleX - startX)), math.cos(angle) * scaleY end ]], -backandforth = [[ + backandforth = [[ function(progress, start, delta) local prog if(progress < 0.25) then @@ -430,19 +429,19 @@ function(progress, start, delta) end ]], -wobble = [[ + wobble = [[ function(progress, start, delta) local angle = progress * 2 * math.pi return start + math.sin(angle) * delta end ]], -hide = [[ + hide = [[ function() return 0 end -]] -}; +]], +} Private.anim_presets = { -- Start and Finish @@ -450,9 +449,10 @@ Private.anim_presets = { type = "custom", duration = 0.25, use_translate = true, - x = 0, y = 50, + x = 0, + y = 50, use_alpha = true, - alpha = 0 + alpha = 0, }, slideleft = { type = "custom", @@ -461,7 +461,7 @@ Private.anim_presets = { x = -50, y = 0, use_alpha = true, - alpha = 0 + alpha = 0, }, slideright = { type = "custom", @@ -470,7 +470,7 @@ Private.anim_presets = { x = 50, y = 0, use_alpha = true, - alpha = 0 + alpha = 0, }, slidebottom = { type = "custom", @@ -479,13 +479,13 @@ Private.anim_presets = { x = 0, y = -50, use_alpha = true, - alpha = 0 + alpha = 0, }, fade = { type = "custom", duration = 0.25, use_alpha = true, - alpha = 0 + alpha = 0, }, grow = { type = "custom", @@ -494,7 +494,7 @@ Private.anim_presets = { scalex = 2, scaley = 2, use_alpha = true, - alpha = 0 + alpha = 0, }, shrink = { type = "custom", @@ -503,7 +503,7 @@ Private.anim_presets = { scalex = 0, scaley = 0, use_alpha = true, - alpha = 0 + alpha = 0, }, spiral = { type = "custom", @@ -513,7 +513,7 @@ Private.anim_presets = { y = 100, translateType = "spiral", use_alpha = true, - alpha = 0 + alpha = 0, }, bounceDecay = { type = "custom", @@ -523,7 +523,7 @@ Private.anim_presets = { y = 50, translateType = "bounceDecay", use_alpha = true, - alpha = 0 + alpha = 0, }, starShakeDecay = { type = "custom", @@ -533,7 +533,7 @@ Private.anim_presets = { y = 50, translateType = "starShakeDecay", use_alpha = true, - alpha = 0 + alpha = 0, }, -- Main shake = { @@ -542,7 +542,7 @@ Private.anim_presets = { use_translate = true, x = 10, y = 0, - translateType = "circle2" + translateType = "circle2", }, spin = { type = "custom", @@ -550,7 +550,7 @@ Private.anim_presets = { use_scale = true, scalex = 1, scaley = 1, - scaleType = "fauxspin" + scaleType = "fauxspin", }, flip = { type = "custom", @@ -558,14 +558,14 @@ Private.anim_presets = { use_scale = true, scalex = 1, scaley = 1, - scaleType = "fauxflip" + scaleType = "fauxflip", }, wobble = { type = "custom", duration = 0.5, use_rotate = true, rotate = 3, - rotateType = "wobble" + rotateType = "wobble", }, pulse = { type = "custom", @@ -573,26 +573,26 @@ Private.anim_presets = { use_scale = true, scalex = 1.05, scaley = 1.05, - scaleType = "pulse" + scaleType = "pulse", }, alphaPulse = { type = "custom", duration = 0.5, use_alpha = true, alpha = 0.5, - alphaType = "alphaPulse" + alphaType = "alphaPulse", }, rotateClockwise = { type = "custom", duration = 4, use_rotate = true, - rotate = -360 + rotate = -360, }, rotateCounterClockwise = { type = "custom", duration = 4, use_rotate = true, - rotate = 360 + rotate = 360, }, spiralandpulse = { type = "custom", @@ -600,7 +600,7 @@ Private.anim_presets = { use_translate = true, x = 100, y = 100, - translateType = "spiralandpulse" + translateType = "spiralandpulse", }, circle = { type = "custom", @@ -608,7 +608,7 @@ Private.anim_presets = { use_translate = true, x = 100, y = 100, - translateType = "circle" + translateType = "circle", }, orbit = { type = "custom", @@ -618,7 +618,7 @@ Private.anim_presets = { y = 100, translateType = "circle", use_rotate = true, - rotate = 360 + rotate = 360, }, bounce = { type = "custom", @@ -626,9 +626,9 @@ Private.anim_presets = { use_translate = true, x = 0, y = 25, - translateType = "bounce" - } -}; + translateType = "bounce", + }, +} WeakAuras.class_ids = {} for classID = 1, 20 do -- GetNumClasses not supported by wow classic @@ -642,7 +642,7 @@ if WeakAuras.IsClassicOrBCCOrWrath() then function WeakAuras.CheckTalentByIndex(index, extraOption) local tab = ceil(index / MAX_NUM_TALENTS) local num_talent = (index - 1) % MAX_NUM_TALENTS + 1 - local name, _, _, _, rank = GetTalentInfo(tab, num_talent) + local name, _, _, _, rank = GetTalentInfo(tab, num_talent) if name == nil then return nil end @@ -652,13 +652,13 @@ if WeakAuras.IsClassicOrBCCOrWrath() then elseif extraOption == 5 then return not result end - return result; + return result end else function WeakAuras.CheckTalentByIndex(index, extraOption) local tier = ceil(index / 3) local column = (index - 1) % 3 + 1 - local _, _, _, selected, _, _, _, _, _, _, known = GetTalentInfo(tier, column, 1) + local _, _, _, selected, _, _, _, _, _, _, known = GetTalentInfo(tier, column, 1) if extraOption == 4 then return selected or known elseif extraOption == 5 then @@ -688,48 +688,50 @@ function WeakAuras.CheckPvpTalentByIndex(index) end function WeakAuras.CheckNumericIds(loadids, currentId) - if (not loadids or not currentId) then - return false; + if not loadids or not currentId then + return false end - local searchFrom = 0; - local startI, endI = string.find(loadids, currentId, searchFrom); - while (startI) do - searchFrom = endI + 1; -- start next search from end - if (startI == 1 or tonumber(string.sub(loadids, startI - 1, startI - 1)) == nil) then + local searchFrom = 0 + local startI, endI = string.find(loadids, currentId, searchFrom) + while startI do + searchFrom = endI + 1 -- start next search from end + if startI == 1 or tonumber(string.sub(loadids, startI - 1, startI - 1)) == nil then -- Either right at start, or character before is not a number - if (endI == string.len(loadids) or tonumber(string.sub(loadids, endI + 1, endI + 1)) == nil) then - return true; + if endI == string.len(loadids) or tonumber(string.sub(loadids, endI + 1, endI + 1)) == nil then + return true end end - startI, endI = string.find(loadids, currentId, searchFrom); + startI, endI = string.find(loadids, currentId, searchFrom) end - return false; + return false end function WeakAuras.CheckString(ids, currentId) - if (not ids or not currentId) then - return false; + if not ids or not currentId then + return false end - for id in ids:gmatch('([^,]+)') do + for id in ids:gmatch("([^,]+)") do if id:trim() == currentId then return true end end - return false; + return false end function WeakAuras.ValidateNumeric(info, val) - if val ~= nil and val ~= "" and (not tonumber(val) or tonumber(val) >= 2^31) then - return false; + if val ~= nil and val ~= "" and (not tonumber(val) or tonumber(val) >= 2 ^ 31) then + return false end return true end function WeakAuras.ParseStringCheck(input) - if not input then return end + if not input then + return + end local matcher = { zones = {}, Check = function(self, zone) @@ -737,7 +739,7 @@ function WeakAuras.ParseStringCheck(input) end, Add = function(self, z) self.zones[z] = true - end + end, } local start = 1 @@ -747,12 +749,12 @@ function WeakAuras.ParseStringCheck(input) local c = input:sub(i, i) if escaped then escaped = false - elseif c == '\\' then - partial = partial .. input:sub(start, i -1) + elseif c == "\\" then + partial = partial .. input:sub(start, i - 1) start = i + 1 escaped = true elseif c == "," then - matcher:Add(partial .. input:sub(start, i -1):trim()) + matcher:Add(partial .. input:sub(start, i - 1):trim()) start = i + 1 partial = "" end @@ -766,8 +768,8 @@ function WeakAuras.ValidateNumericOrPercent(info, val) if val ~= nil and val ~= "" then local percent = string.match(val, "(%d+)%%") local number = percent and tonumber(percent) or tonumber(val) - if(not number or number >= 2^31) then - return false; + if not number or number >= 2 ^ 31 then + return false end end return true @@ -777,7 +779,7 @@ function WeakAuras.CheckMPlusAffixIds(loadids, currentId) if (not loadids or not currentId) or type(currentId) ~= "table" then return false end - for i=1, #currentId do + for i = 1, #currentId do if loadids == currentId[i] then return true end @@ -786,32 +788,34 @@ function WeakAuras.CheckMPlusAffixIds(loadids, currentId) end function WeakAuras.CheckChargesDirection(direction, triggerDirection) - return triggerDirection == "CHANGED" - or (triggerDirection == "GAINED" and direction > 0) - or (triggerDirection == "LOST" and direction < 0) + return triggerDirection == "CHANGED" or (triggerDirection == "GAINED" and direction > 0) or (triggerDirection == "LOST" and direction < 0) end function WeakAuras.CheckCombatLogFlags(flags, flagToCheck) - if type(flags) ~= "number" then return end - if(flagToCheck == "Mine") then + if type(flags) ~= "number" then + return + end + if flagToCheck == "Mine" then return bit.band(flags, COMBATLOG_OBJECT_AFFILIATION_MINE) > 0 - elseif (flagToCheck == "InGroup") then + elseif flagToCheck == "InGroup" then return bit.band(flags, COMBATLOG_OBJECT_AFFILIATION_OUTSIDER) == 0 - elseif (flagToCheck == "InParty") then + elseif flagToCheck == "InParty" then return bit.band(flags, COMBATLOG_OBJECT_AFFILIATION_PARTY) > 0 - elseif (flagToCheck == "NotInGroup") then + elseif flagToCheck == "NotInGroup" then return bit.band(flags, COMBATLOG_OBJECT_AFFILIATION_OUTSIDER) > 0 end end function WeakAuras.CheckCombatLogFlagsReaction(flags, flagToCheck) - if type(flags) ~= "number" then return end - if (flagToCheck == "Hostile") then - return bit.band(flags, 64) ~= 0; - elseif (flagToCheck == "Neutral") then - return bit.band(flags, 32) ~= 0; - elseif (flagToCheck == "Friendly") then - return bit.band(flags, 16) ~= 0; + if type(flags) ~= "number" then + return + end + if flagToCheck == "Hostile" then + return bit.band(flags, 64) ~= 0 + elseif flagToCheck == "Neutral" then + return bit.band(flags, 32) ~= 0 + elseif flagToCheck == "Friendly" then + return bit.band(flags, 16) ~= 0 end end @@ -824,21 +828,27 @@ local objectTypeToBit = { } function WeakAuras.CheckCombatLogFlagsObjectType(flags, flagToCheck) - if type(flags) ~= "number" then return end + if type(flags) ~= "number" then + return + end local bitToCheck = objectTypeToBit[flagToCheck] - if not bitToCheck then return end - return bit.band(flags, bitToCheck) ~= 0; + if not bitToCheck then + return + end + return bit.band(flags, bitToCheck) ~= 0 end function WeakAuras.CheckRaidFlags(flags, flagToCheck) flagToCheck = tonumber(flagToCheck) - if not flagToCheck or not flags then return end --bailout + if not flagToCheck or not flags then + return + end --bailout if flagToCheck == 0 then --no raid mark return bit.band(flags, COMBATLOG_OBJECT_RAIDTARGET_MASK) == 0 elseif flagToCheck == 9 then --any raid mark return bit.band(flags, COMBATLOG_OBJECT_RAIDTARGET_MASK) > 0 else -- specific raid mark - return bit.band(flags, _G['COMBATLOG_OBJECT_RAIDTARGET'..flagToCheck]) > 0 + return bit.band(flags, _G["COMBATLOG_OBJECT_RAIDTARGET" .. flagToCheck]) > 0 end end @@ -849,7 +859,7 @@ function WeakAuras.IsSpellKnownForLoad(spell, exact) end -- Dance through the spellname to the current spell id spell = GetSpellInfo(spell) - if (spell) then + if spell then spell = select(7, GetSpellInfo(spell)) end if spell then @@ -858,31 +868,31 @@ function WeakAuras.IsSpellKnownForLoad(spell, exact) end function WeakAuras.IsSpellKnown(spell, pet) - if (pet) then - return IsSpellKnown(spell, pet); + if pet then + return IsSpellKnown(spell, pet) end - return IsPlayerSpell(spell) or IsSpellKnown(spell); + return IsPlayerSpell(spell) or IsSpellKnown(spell) end function WeakAuras.IsSpellKnownIncludingPet(spell) - if (not tonumber(spell)) then - spell = select(7, GetSpellInfo(spell)); + if not tonumber(spell) then + spell = select(7, GetSpellInfo(spell)) end - if (not spell) then - return false; + if not spell then + return false end - if (WeakAuras.IsSpellKnown(spell) or WeakAuras.IsSpellKnown(spell, true)) then - return true; + if WeakAuras.IsSpellKnown(spell) or WeakAuras.IsSpellKnown(spell, true) then + return true end -- WORKAROUND brain damage around void eruption -- In shadow form void eruption is overridden by void bolt, yet IsSpellKnown for void bolt -- returns false, whereas it returns true for void eruption - local baseSpell = FindBaseSpellByID(spell); - if (not baseSpell) then - return false; + local baseSpell = FindBaseSpellByID(spell) + if not baseSpell then + return false end - if (baseSpell ~= spell) then - return WeakAuras.IsSpellKnown(baseSpell) or WeakAuras.IsSpellKnown(baseSpell, true); + if baseSpell ~= spell then + return WeakAuras.IsSpellKnown(baseSpell) or WeakAuras.IsSpellKnown(baseSpell, true) end end @@ -895,21 +905,23 @@ function WeakAuras.CompareSpellIds(a, b, exactCheck) end function WeakAuras.UnitPowerDisplayMod(powerType) - if (powerType == 7) then - return 10; + if powerType == 7 then + return 10 end - return 1; + return 1 end function WeakAuras.UseUnitPowerThirdArg(powerType) - if (powerType == 7) then - return true; + if powerType == 7 then + return true end - return nil; + return nil end function WeakAuras.GetNumSetItemsEquipped(setID) - if not setID or not type(setID) == "number" then return end + if not setID or not type(setID) == "number" then + return + end local equipped = 0 local setName = GetItemSetInfo(setID) for i = 1, 18 do @@ -930,14 +942,14 @@ local function valuesForTalentFunction(trigger) return function() local single_class = Private.checkForSingleLoadCondition(trigger, "class") if not single_class then - single_class = select(2, UnitClass("player")); + single_class = select(2, UnitClass("player")) end local single_spec if WeakAuras.IsRetail() then single_spec = Private.checkForSingleLoadCondition(trigger, "spec") if single_spec == nil then - single_spec = GetSpecialization(); + single_spec = GetSpecialization() end end --[[ dragonflight @@ -1000,10 +1012,7 @@ local function valuesForTalentFunction(trigger) end end end - if single_class and single_spec - and Private.talent_types_specific[single_class] - and Private.talent_types_specific[single_class][single_spec] - then + if single_class and single_spec and Private.talent_types_specific[single_class] and Private.talent_types_specific[single_class][single_spec] then return Private.talent_types_specific[single_class][single_spec] else return Private.talent_types @@ -1026,23 +1035,17 @@ end ---@param validateFn? fun(value: any): boolean values that do not validate are ignored ---@return any function Private.checkForSingleLoadCondition(trigger, name, validateFn) - local use_name = "use_"..name + local use_name = "use_" .. name local trigger_use_name = trigger[use_name] local trigger_name = trigger[name] - if trigger_use_name == true - and trigger_name - and trigger_name.single ~= nil - and (validateFn == nil or validateFn(trigger_name.single)) - then + if trigger_use_name == true and trigger_name and trigger_name.single ~= nil and (validateFn == nil or validateFn(trigger_name.single)) then return trigger_name.single end if trigger_use_name == false and trigger_name and trigger_name.multi ~= nil then local count = 0 local key for k, v in pairs(trigger_name.multi) do - if v ~= nil - and (validateFn == nil or validateFn(k)) - then + if v ~= nil and (validateFn == nil or validateFn(k)) then count = count + 1 key = k end @@ -1062,7 +1065,7 @@ Private.load_prototype = { width = WeakAuras.normalWidth, init = "arg", optional = true, - events = {"PLAYER_REGEN_DISABLED", "PLAYER_REGEN_ENABLED"} + events = { "PLAYER_REGEN_DISABLED", "PLAYER_REGEN_ENABLED" }, }, { name = "encounter", @@ -1071,7 +1074,7 @@ Private.load_prototype = { width = WeakAuras.normalWidth, init = "arg", optional = true, - events = {"ENCOUNTER_START", "ENCOUNTER_END"} + events = { "ENCOUNTER_START", "ENCOUNTER_END" }, }, { name = "alive", @@ -1080,7 +1083,7 @@ Private.load_prototype = { init = "arg", width = WeakAuras.normalWidth, optional = true, - events = {"PLAYER_DEAD", "PLAYER_ALIVE", "PLAYER_UNGHOST"} + events = { "PLAYER_DEAD", "PLAYER_ALIVE", "PLAYER_UNGHOST" }, }, { name = "warmode", @@ -1091,7 +1094,7 @@ Private.load_prototype = { optional = true, enable = WeakAuras.IsRetail(), hidden = not WeakAuras.IsRetail(), - events = {"PLAYER_FLAGS_CHANGED"} + events = { "PLAYER_FLAGS_CHANGED" }, }, { name = "never", @@ -1109,7 +1112,7 @@ Private.load_prototype = { optional = true, enable = WeakAuras.IsRetail(), hidden = not WeakAuras.IsRetail(), - events = {"PET_BATTLE_OPENING_START", "PET_BATTLE_CLOSE"} + events = { "PET_BATTLE_OPENING_START", "PET_BATTLE_CLOSE" }, }, { name = "vehicle", @@ -1118,8 +1121,7 @@ Private.load_prototype = { init = "arg", width = WeakAuras.normalWidth, optional = true, - events = (WeakAuras.IsClassicOrBCC()) and {"UNIT_FLAGS"} - or {"VEHICLE_UPDATE", "UNIT_ENTERED_VEHICLE", "UNIT_EXITED_VEHICLE", "UPDATE_OVERRIDE_ACTIONBAR", "UNIT_FLAGS"} + events = (WeakAuras.IsClassicOrBCC()) and { "UNIT_FLAGS" } or { "VEHICLE_UPDATE", "UNIT_ENTERED_VEHICLE", "UNIT_EXITED_VEHICLE", "UPDATE_OVERRIDE_ACTIONBAR", "UNIT_FLAGS" }, }, { name = "vehicleUi", @@ -1130,7 +1132,7 @@ Private.load_prototype = { optional = true, enable = WeakAuras.IsWrathOrRetail(), hidden = not WeakAuras.IsWrathOrRetail(), - events = {"VEHICLE_UPDATE", "UNIT_ENTERED_VEHICLE", "UNIT_EXITED_VEHICLE", "UPDATE_OVERRIDE_ACTIONBAR", "UPDATE_VEHICLE_ACTIONBAR"} + events = { "VEHICLE_UPDATE", "UNIT_ENTERED_VEHICLE", "UNIT_EXITED_VEHICLE", "UPDATE_OVERRIDE_ACTIONBAR", "UPDATE_VEHICLE_ACTIONBAR" }, }, { name = "ingroup", @@ -1139,19 +1141,19 @@ Private.load_prototype = { width = WeakAuras.normalWidth, init = "arg", values = "group_types", - events = {"GROUP_ROSTER_UPDATE"} + events = { "GROUP_ROSTER_UPDATE" }, }, { name = "player", hidden = true, init = "arg", - test = "true" + test = "true", }, { name = "realm", hidden = true, init = "arg", - test = "true" + test = "true", }, { name = "namerealm", @@ -1174,7 +1176,7 @@ Private.load_prototype = { display = L["Player Class"], type = "multiselect", values = "class_types", - init = "arg" + init = "arg", }, { name = "spec", @@ -1182,28 +1184,28 @@ Private.load_prototype = { type = "multiselect", values = function(trigger) return function() - local min_specs = 4; + local min_specs = 4 local single_class = Private.checkForSingleLoadCondition(trigger, "class") -- If that is not the case, see if it is on single-select - if((not single_class) and trigger.use_class and trigger.class and trigger.class.single) then + if not single_class and trigger.use_class and trigger.class and trigger.class.single then single_class = trigger.class.single end - if (trigger.use_class == nil) then -- no class selected, fallback to current class - single_class = select(2, UnitClass("player")); + if trigger.use_class == nil then -- no class selected, fallback to current class + single_class = select(2, UnitClass("player")) end -- If a single specific class was found, load the specific list for it - if(single_class) then - return WeakAuras.spec_types_specific[single_class]; + if single_class then + return WeakAuras.spec_types_specific[single_class] else -- List 4 specs if no class is specified, but if any multi-selected classes have less than 4 specs, list 3 instead - if (min_specs < 3) then - return Private.spec_types_2; - elseif(min_specs < 4) then - return Private.spec_types_3; + if min_specs < 3 then + return Private.spec_types_2 + elseif min_specs < 4 then + return Private.spec_types_3 else - return Private.spec_types; + return Private.spec_types end end end @@ -1211,7 +1213,7 @@ Private.load_prototype = { init = "arg", enable = WeakAuras.IsRetail(), hidden = not WeakAuras.IsRetail(), - events = {"PLAYER_TALENT_UPDATE"} + events = { "PLAYER_TALENT_UPDATE" }, }, { name = "class_and_spec", @@ -1221,7 +1223,7 @@ Private.load_prototype = { init = "arg", enable = WeakAuras.IsRetail(), hidden = not WeakAuras.IsRetail(), - events = {"PLAYER_TALENT_UPDATE"} + events = { "PLAYER_TALENT_UPDATE" }, }, { name = "talent", @@ -1232,9 +1234,9 @@ Private.load_prototype = { enableTest = function(...) return WeakAuras.CheckTalentByIndex(...) ~= nil end, - events = (WeakAuras.IsClassicOrBCC() and {"CHARACTER_POINTS_CHANGED"}) - or (WeakAuras.IsWrathClassic() and {"CHARACTER_POINTS_CHANGED", "PLAYER_TALENT_UPDATE"}) - or {"PLAYER_TALENT_UPDATE"}, + events = (WeakAuras.IsClassicOrBCC() and { "CHARACTER_POINTS_CHANGED" }) or (WeakAuras.IsWrathClassic() and { "CHARACTER_POINTS_CHANGED", "PLAYER_TALENT_UPDATE" }) or { + "PLAYER_TALENT_UPDATE", + }, inverse = function(load) -- Check for multi select! return (WeakAuras.IsClassicOrBCC() or WeakAuras.IsRetail()) and (load.talent_extraOption == 2 or load.talent_extraOption == 3) @@ -1243,20 +1245,18 @@ Private.load_prototype = { display = "", values = function() return Private.talent_extra_option_types - end + end, }, control = WeakAuras.IsWrathClassic() and "WeakAurasMiniTalent" or nil, multiNoSingle = WeakAuras.IsWrathClassic(), -- no single mode multiTristate = WeakAuras.IsWrathClassic(), -- values can be true/false/nil multiAll = WeakAuras.IsWrathClassic(), -- require all tests - orConjunctionGroup = WeakAuras.IsWrathClassic() and "talent", + orConjunctionGroup = WeakAuras.IsWrathClassic() and "talent", multiUseControlWhenFalse = WeakAuras.IsWrathClassic(), enable = function(trigger) local class = Private.checkForSingleLoadCondition(trigger, "class") - return WeakAuras.IsClassicOrBCC() - or WeakAuras.IsRetail() - or (WeakAuras.IsWrathClassic() and class ~= nil) - end + return WeakAuras.IsClassicOrBCC() or WeakAuras.IsRetail() or (WeakAuras.IsWrathClassic() and class ~= nil) + end, }, { name = "talent2", @@ -1267,9 +1267,9 @@ Private.load_prototype = { enableTest = function(...) return WeakAuras.CheckTalentByIndex(...) ~= nil end, - events = (WeakAuras.IsClassicOrBCC() and {"CHARACTER_POINTS_CHANGED"}) - or (WeakAuras.IsWrathClassic() and {"CHARACTER_POINTS_CHANGED", "PLAYER_TALENT_UPDATE"}) - or {"PLAYER_TALENT_UPDATE"}, + events = (WeakAuras.IsClassicOrBCC() and { "CHARACTER_POINTS_CHANGED" }) or (WeakAuras.IsWrathClassic() and { "CHARACTER_POINTS_CHANGED", "PLAYER_TALENT_UPDATE" }) or { + "PLAYER_TALENT_UPDATE", + }, inverse = function(load) return (WeakAuras.IsClassicOrBCC() or WeakAuras.IsRetail()) and (load.talent2_extraOption == 2 or load.talent2_extraOption == 3) end, @@ -1283,16 +1283,12 @@ Private.load_prototype = { multiNoSingle = WeakAuras.IsWrathClassic(), multiTristate = WeakAuras.IsWrathClassic(), multiAll = WeakAuras.IsWrathClassic(), - orConjunctionGroup = WeakAuras.IsWrathClassic() and "talent", + orConjunctionGroup = WeakAuras.IsWrathClassic() and "talent", multiUseControlWhenFalse = WeakAuras.IsWrathClassic(), enable = function(trigger) local class = Private.checkForSingleLoadCondition(trigger, "class") - return (trigger.use_talent ~= nil or trigger.use_talent2 ~= nil) and ( - WeakAuras.IsClassicOrBCC() - or WeakAuras.IsRetail() - or (WeakAuras.IsWrathClassic() and class ~= nil) - ) - end + return (trigger.use_talent ~= nil or trigger.use_talent2 ~= nil) and (WeakAuras.IsClassicOrBCC() or WeakAuras.IsRetail() or (WeakAuras.IsWrathClassic() and class ~= nil)) + end, }, { name = "talent3", @@ -1303,9 +1299,9 @@ Private.load_prototype = { enableTest = function(...) return WeakAuras.CheckTalentByIndex(...) ~= nil end, - events = (WeakAuras.IsClassicOrBCC() and {"CHARACTER_POINTS_CHANGED"}) - or (WeakAuras.IsWrathClassic() and {"CHARACTER_POINTS_CHANGED", "PLAYER_TALENT_UPDATE"}) - or {"PLAYER_TALENT_UPDATE"}, + events = (WeakAuras.IsClassicOrBCC() and { "CHARACTER_POINTS_CHANGED" }) or (WeakAuras.IsWrathClassic() and { "CHARACTER_POINTS_CHANGED", "PLAYER_TALENT_UPDATE" }) or { + "PLAYER_TALENT_UPDATE", + }, inverse = function(load) return (WeakAuras.IsClassicOrBCC() or WeakAuras.IsRetail()) and (load.talent3_extraOption == 2 or load.talent3_extraOption == 3) end, @@ -1319,16 +1315,13 @@ Private.load_prototype = { multiNoSingle = WeakAuras.IsWrathClassic(), multiTristate = WeakAuras.IsWrathClassic(), multiAll = WeakAuras.IsWrathClassic(), - orConjunctionGroup = WeakAuras.IsWrathClassic() and "talent", + orConjunctionGroup = WeakAuras.IsWrathClassic() and "talent", multiUseControlWhenFalse = WeakAuras.IsWrathClassic(), enable = function(trigger) local class = Private.checkForSingleLoadCondition(trigger, "class") - return ((trigger.use_talent ~= nil and trigger.use_talent2 ~= nil) or trigger.use_talent3 ~= nil) and ( - WeakAuras.IsClassicOrBCC() - or WeakAuras.IsRetail() - or (WeakAuras.IsWrathClassic() and class ~= nil) - ) - end + return ((trigger.use_talent ~= nil and trigger.use_talent2 ~= nil) or trigger.use_talent3 ~= nil) + and (WeakAuras.IsClassicOrBCC() or WeakAuras.IsRetail() or (WeakAuras.IsWrathClassic() and class ~= nil)) + end, }, { name = "pvptalent", @@ -1336,70 +1329,69 @@ Private.load_prototype = { type = "multiselect", values = function(trigger) return function() - local single_class; + local single_class -- First check to use if the class load is on multi-select with only one class selected - if(trigger.use_class == false and trigger.class and trigger.class.multi) then - local num_classes = 0; + if trigger.use_class == false and trigger.class and trigger.class.multi then + local num_classes = 0 for class in pairs(trigger.class.multi) do - single_class = class; - num_classes = num_classes + 1; + single_class = class + num_classes = num_classes + 1 end - if(num_classes ~= 1) then - single_class = nil; + if num_classes ~= 1 then + single_class = nil end end -- If that is not the case, see if it is on single-select - if((not single_class) and trigger.use_class and trigger.class and trigger.class.single) then + if not single_class and trigger.use_class and trigger.class and trigger.class.single then single_class = trigger.class.single end - if (trigger.use_class == nil) then -- no class selected, fallback to current class - single_class = select(2, UnitClass("player")); + if trigger.use_class == nil then -- no class selected, fallback to current class + single_class = select(2, UnitClass("player")) end - local single_spec; - if (single_class) then - if(trigger.use_spec == false and trigger.spec and trigger.spec.multi) then - local num_specs = 0; + local single_spec + if single_class then + if trigger.use_spec == false and trigger.spec and trigger.spec.multi then + local num_specs = 0 for spec in pairs(trigger.spec.multi) do - single_spec = spec; - num_specs = num_specs + 1; + single_spec = spec + num_specs = num_specs + 1 end - if (num_specs ~= 1) then - single_spec = nil; + if num_specs ~= 1 then + single_spec = nil end end end - if ((not single_spec) and trigger.use_spec and trigger.spec and trigger.spec.single) then - single_spec = trigger.spec.single; + if not single_spec and trigger.use_spec and trigger.spec and trigger.spec.single then + single_spec = trigger.spec.single end - if (trigger.use_spec == nil) then - single_spec = GetSpecialization(); + if trigger.use_spec == nil then + single_spec = GetSpecialization() end -- print ("Using talent cache", single_class, single_spec); -- If a single specific class was found, load the specific list for it - if(single_class and Private.pvp_talent_types_specific[single_class] - and single_spec and Private.pvp_talent_types_specific[single_class][single_spec]) then - return Private.pvp_talent_types_specific[single_class][single_spec]; + if single_class and Private.pvp_talent_types_specific[single_class] and single_spec and Private.pvp_talent_types_specific[single_class][single_spec] then + return Private.pvp_talent_types_specific[single_class][single_spec] else - return Private.pvp_talent_types; + return Private.pvp_talent_types end end end, test = "WeakAuras.CheckPvpTalentByIndex(%d)", enable = WeakAuras.IsRetail(), hidden = not WeakAuras.IsRetail(), - events = {"PLAYER_PVP_TALENT_UPDATE"} + events = { "PLAYER_PVP_TALENT_UPDATE" }, }, { name = "spellknown", display = L["Spell Known"], type = "spell", test = "WeakAuras.IsSpellKnownForLoad(%s, %s)", - events = WeakAuras.IsWrathClassic() and {"SPELLS_CHANGED", "UNIT_PET", "PLAYER_TALENT_UPDATE"} or {"SPELLS_CHANGED", "UNIT_PET"}, - showExactOption = true + events = WeakAuras.IsWrathClassic() and { "SPELLS_CHANGED", "UNIT_PET", "PLAYER_TALENT_UPDATE" } or { "SPELLS_CHANGED", "UNIT_PET" }, + showExactOption = true, }, { name = "covenant", @@ -1409,28 +1401,28 @@ Private.load_prototype = { init = "arg", enable = WeakAuras.IsRetail(), hidden = not WeakAuras.IsRetail(), - events = {"COVENANT_CHOSEN"} + events = { "COVENANT_CHOSEN" }, }, { name = "race", display = L["Player Race"], type = "multiselect", values = "race_types", - init = "arg" + init = "arg", }, { name = "faction", display = L["Player Faction"], type = "multiselect", values = "faction_group", - init = "arg" + init = "arg", }, { name = "level", display = L["Player Level"], type = "number", init = "arg", - events = {"PLAYER_LEVEL_UP"} + events = { "PLAYER_LEVEL_UP" }, }, { name = "effectiveLevel", @@ -1440,7 +1432,7 @@ Private.load_prototype = { desc = L["The effective level differs from the level in e.g. Time Walking dungeons."], enable = WeakAuras.IsRetail(), hidden = not WeakAuras.IsRetail(), - events = {"PLAYER_LEVEL_UP", "UNIT_FLAGS", "ZONE_CHANGED", "ZONE_CHANGED_INDOORS", "ZONE_CHANGED_NEW_AREA"} + events = { "PLAYER_LEVEL_UP", "UNIT_FLAGS", "ZONE_CHANGED", "ZONE_CHANGED_INDOORS", "ZONE_CHANGED_NEW_AREA" }, }, { name = "zone", @@ -1449,8 +1441,8 @@ Private.load_prototype = { init = "arg", preamble = "local checker = WeakAuras.ParseStringCheck(%q)", test = "checker:Check(zone)", - events = {"ZONE_CHANGED", "ZONE_CHANGED_INDOORS", "ZONE_CHANGED_NEW_AREA", "VEHICLE_UPDATE"}, - desc = L["Supports multiple entries, separated by commas. Escape ',' with \\"] + events = { "ZONE_CHANGED", "ZONE_CHANGED_INDOORS", "ZONE_CHANGED_NEW_AREA", "VEHICLE_UPDATE" }, + desc = L["Supports multiple entries, separated by commas. Escape ',' with \\"], }, { name = "zoneId", @@ -1472,10 +1464,10 @@ Private.load_prototype = { type = "string", enable = not WeakAuras.IsClassic(), hidden = WeakAuras.IsClassic(), - events = {"ZONE_CHANGED", "ZONE_CHANGED_INDOORS", "ZONE_CHANGED_NEW_AREA", "VEHICLE_UPDATE"}, + events = { "ZONE_CHANGED", "ZONE_CHANGED_INDOORS", "ZONE_CHANGED_NEW_AREA", "VEHICLE_UPDATE" }, desc = get_zoneId_list, preamble = "local zoneChecker = WeakAuras.ParseZoneCheck(%q)", - test = "zoneChecker:Check(zoneId, zonegroupId)" + test = "zoneChecker:Check(zoneId, zonegroupId)", }, { name = "encounterid", @@ -1484,7 +1476,7 @@ Private.load_prototype = { init = "arg", desc = Private.get_encounters_list, test = "WeakAuras.CheckNumericIds(%q, encounterid)", - events = {"ENCOUNTER_START", "ENCOUNTER_END"} + events = { "ENCOUNTER_START", "ENCOUNTER_END" }, }, { name = "size", @@ -1493,7 +1485,7 @@ Private.load_prototype = { values = "instance_types", init = "arg", control = "WeakAurasSortedDropdown", - events = {"ZONE_CHANGED", "ZONE_CHANGED_INDOORS", "ZONE_CHANGED_NEW_AREA"} + events = { "ZONE_CHANGED", "ZONE_CHANGED_INDOORS", "ZONE_CHANGED_NEW_AREA" }, }, { name = "difficulty", @@ -1503,7 +1495,7 @@ Private.load_prototype = { init = "arg", enable = not WeakAuras.IsClassic(), hidden = WeakAuras.IsClassic(), - events = {"PLAYER_DIFFICULTY_CHANGED", "ZONE_CHANGED", "ZONE_CHANGED_INDOORS", "ZONE_CHANGED_NEW_AREA"} + events = { "PLAYER_DIFFICULTY_CHANGED", "ZONE_CHANGED", "ZONE_CHANGED_INDOORS", "ZONE_CHANGED_NEW_AREA" }, }, { name = "instance_type", @@ -1512,7 +1504,7 @@ Private.load_prototype = { values = "instance_difficulty_types", init = "arg", control = "WeakAurasSortedDropdown", - events = {"PLAYER_DIFFICULTY_CHANGED", "ZONE_CHANGED", "ZONE_CHANGED_INDOORS", "ZONE_CHANGED_NEW_AREA"}, + events = { "PLAYER_DIFFICULTY_CHANGED", "ZONE_CHANGED", "ZONE_CHANGED_INDOORS", "ZONE_CHANGED_NEW_AREA" }, }, { name = "role", @@ -1522,7 +1514,7 @@ Private.load_prototype = { init = "arg", enable = WeakAuras.IsWrathOrRetail(), hidden = not WeakAuras.IsWrathOrRetail(), - events = {"PLAYER_ROLES_ASSIGNED", "PLAYER_TALENT_UPDATE"} + events = { "PLAYER_ROLES_ASSIGNED", "PLAYER_TALENT_UPDATE" }, }, { name = "raid_role", @@ -1532,14 +1524,14 @@ Private.load_prototype = { init = "arg", enable = WeakAuras.IsClassicOrBCCOrWrath(), hidden = WeakAuras.IsRetail(), - events = {"PLAYER_ROLES_ASSIGNED"} + events = { "PLAYER_ROLES_ASSIGNED" }, }, { name = "group_leader", display = WeakAuras.newFeatureString .. L["Group Leader"], type = "toggle", init = "arg", - events = {"PARTY_LEADER_CHANGED", "GROUP_ROSTER_UPDATE"}, + events = { "PARTY_LEADER_CHANGED", "GROUP_ROSTER_UPDATE" }, width = WeakAuras.doubleWidth, }, { @@ -1551,56 +1543,54 @@ Private.load_prototype = { test = "WeakAuras.CheckMPlusAffixIds(%d, affixes)", enable = WeakAuras.IsRetail(), hidden = not WeakAuras.IsRetail(), - events = {"CHALLENGE_MODE_START", "CHALLENGE_MODE_COMPLETED"}, + events = { "CHALLENGE_MODE_START", "CHALLENGE_MODE_COMPLETED" }, }, { name = "itemequiped", display = L["Item Equipped"], type = "item", test = "IsEquippedItem(GetItemInfo(%s))", - events = { "UNIT_INVENTORY_CHANGED", "PLAYER_EQUIPMENT_CHANGED"} + events = { "UNIT_INVENTORY_CHANGED", "PLAYER_EQUIPMENT_CHANGED" }, }, { name = "itemtypeequipped", display = L["Item Type Equipped"], type = "multiselect", test = "IsEquippedItemType(WeakAuras.GetItemSubClassInfo(%s))", - events = { "UNIT_INVENTORY_CHANGED", "PLAYER_EQUIPMENT_CHANGED"}, - values = "item_weapon_types" + events = { "UNIT_INVENTORY_CHANGED", "PLAYER_EQUIPMENT_CHANGED" }, + values = "item_weapon_types", }, { name = "item_bonusid_equipped", - display = L["Item Bonus Id Equipped"], + display = L["Item Bonus Id Equipped"], type = "string", test = "WeakAuras.CheckForItemBonusId(%q)", - events = { "UNIT_INVENTORY_CHANGED", "PLAYER_EQUIPMENT_CHANGED"}, + events = { "UNIT_INVENTORY_CHANGED", "PLAYER_EQUIPMENT_CHANGED" }, desc = function() - return WeakAuras.GetLegendariesBonusIds() - .. "\n\n" .. L["Supports multiple entries, separated by commas"] - end + return WeakAuras.GetLegendariesBonusIds() .. "\n\n" .. L["Supports multiple entries, separated by commas"] + end, }, { name = "not_item_bonusid_equipped", - display = WeakAuras.newFeatureString .. L["|cFFFF0000Not|r Item Bonus Id Equipped"], + display = WeakAuras.newFeatureString .. L["|cFFFF0000Not|r Item Bonus Id Equipped"], type = "string", test = "not WeakAuras.CheckForItemBonusId(%q)", - events = { "UNIT_INVENTORY_CHANGED", "PLAYER_EQUIPMENT_CHANGED"}, + events = { "UNIT_INVENTORY_CHANGED", "PLAYER_EQUIPMENT_CHANGED" }, desc = function() - return WeakAuras.GetLegendariesBonusIds() - .. "\n\n" .. L["Supports multiple entries, separated by commas"] - end - } - } -}; + return WeakAuras.GetLegendariesBonusIds() .. "\n\n" .. L["Supports multiple entries, separated by commas"] + end, + }, + }, +} local function AddUnitChangeInternalEvents(triggerUnit, t, includePets) - if (triggerUnit == nil) then + if triggerUnit == nil then return end - if (triggerUnit == "multi") then + if triggerUnit == "multi" then -- Handled by normal events" elseif triggerUnit == "pet" then - WeakAuras.WatchForPetDeath(); + WeakAuras.WatchForPetDeath() tinsert(t, "PET_UPDATE") else if Private.multiUnitUnits[triggerUnit] then @@ -1623,7 +1613,7 @@ local function AddUnitSpecChangeInternalEvents(triggerUnit, t) if Private.multiUnitUnits[triggerUnit] then for unit in pairs(Private.multiUnitUnits[triggerUnit]) do local isPet = WeakAuras.UnitIsPet(unit) - if (not isPet) then + if not isPet then tinsert(t, "UNIT_SPEC_CHANGED_" .. string.lower(unit)) end end @@ -1631,7 +1621,7 @@ local function AddUnitSpecChangeInternalEvents(triggerUnit, t) end local function AddUnitRoleChangeInternalEvents(triggerUnit, t) - if (triggerUnit == nil) then + if triggerUnit == nil then return end @@ -1649,7 +1639,7 @@ local function AddUnitRoleChangeInternalEvents(triggerUnit, t) end local function AddRemainingCastInternalEvents(triggerUnit, t) - if (triggerUnit == nil) then + if triggerUnit == nil then return end @@ -1688,12 +1678,12 @@ local unitHelperFunctions = { for unit in pairs(Private.multiUnitUnits[trigger.unit]) do isPet = WeakAuras.UnitIsPet(unit) if (includePets ~= nil and isPet) or (includePets ~= "PetsOnly" and not isPet) then - tinsert(events, {"UNIT_CHANGED_" .. unit, unit}) + tinsert(events, { "UNIT_CHANGED_" .. unit, unit }) end end else if trigger.unit then - tinsert(events, {"UNIT_CHANGED_" .. trigger.unit, trigger.unit}) + tinsert(events, { "UNIT_CHANGED_" .. trigger.unit, trigger.unit }) end end return events @@ -1704,12 +1694,12 @@ local unitHelperFunctions = { if Private.multiUnitUnits[trigger.unit] then for unit in pairs(Private.multiUnitUnits[trigger.unit]) do if not WeakAuras.UnitIsPet(unit) then - tinsert(events, {"UNIT_CHANGED_" .. unit, unit}) + tinsert(events, { "UNIT_CHANGED_" .. unit, unit }) end end else if trigger.unit then - tinsert(events, {"UNIT_CHANGED_" .. trigger.unit, trigger.unit}) + tinsert(events, { "UNIT_CHANGED_" .. trigger.unit, trigger.unit }) end end return events @@ -1724,28 +1714,31 @@ local unitHelperFunctions = { return "local specificUnitCheck = false\n" end - return string.format([=[ + return string.format( + [=[ local specificUnitCheck = UnitIsUnit(%q, unit) - ]=], trigger.unit or "") - end + ]=], + trigger.unit or "" + ) + end, } Private.event_categories = { spell = { name = L["Spell"], - default = "Cooldown Progress (Spell)" + default = "Cooldown Progress (Spell)", }, item = { name = L["Item"], - default = "Cooldown Progress (Item)" + default = "Cooldown Progress (Item)", }, unit = { name = L["Player/Unit Info"], - default = "Health" + default = "Health", }, addons = { name = L["Other Addons"], - default = "GTFO" + default = "GTFO", }, combatlog = { name = L["Combat Log"], @@ -1753,11 +1746,11 @@ Private.event_categories = { }, event = { name = L["Other Events"], - default = "Chat Message" + default = "Chat Message", }, custom = { name = L["Custom"], - } + }, } Private.event_prototypes = { @@ -1771,7 +1764,7 @@ Private.event_prototypes = { AddUnitEventForEvents(result, unit, "UNIT_NAME_UPDATE") AddUnitEventForEvents(result, unit, "UNIT_FLAGS") AddUnitEventForEvents(result, unit, "PLAYER_FLAGS_CHANGED") - return result; + return result end, internal_events = function(trigger) local unit = trigger.unit @@ -1789,17 +1782,17 @@ Private.event_prototypes = { force_events = unitHelperFunctions.UnitChangedForceEvents, name = L["Unit Characteristics"], init = function(trigger) - trigger.unit = trigger.unit or "target"; + trigger.unit = trigger.unit or "target" local ret = [=[ unit = string.lower(unit) local smart = %s local extraUnit = %q; local name, realm = WeakAuras.UnitNameWithRealm(unit) - ]=]; + ]=] ret = ret .. unitHelperFunctions.SpecificUnitCheck(trigger) - return ret:format(trigger.unit == "group" and "true" or "false", trigger.unitisunit or ""); + return ret:format(trigger.unit == "group" and "true" or "false", trigger.unitisunit or "") end, statesParameter = "unit", args = { @@ -1812,7 +1805,7 @@ Private.event_prototypes = { values = "actual_unit_types_cast", desc = Private.actual_unit_types_cast_tooltip, test = "true", - store = true + store = true, }, { name = "unitisunit", @@ -1823,8 +1816,12 @@ Private.event_prototypes = { test = "unitisunit", store = true, conditionType = "bool", - desc = function() return L["Can be used for e.g. checking if \"boss1target\" is the same as \"player\"."] end, - enable = function(trigger) return not Private.multiUnitUnits[trigger.unit] end + desc = function() + return L["Can be used for e.g. checking if \"boss1target\" is the same as \"player\"."] + end, + enable = function(trigger) + return not Private.multiUnitUnits[trigger.unit] + end, }, { name = "name", @@ -1832,7 +1829,7 @@ Private.event_prototypes = { type = "string", store = true, hidden = true, - test = "true" + test = "true", }, { name = "realm", @@ -1840,7 +1837,7 @@ Private.event_prototypes = { type = "string", store = true, hidden = true, - test = "true" + test = "true", }, { name = "namerealm", @@ -1865,7 +1862,7 @@ Private.event_prototypes = { init = "select(2, UnitClass(unit))", values = "class_types", store = true, - conditionType = "select" + conditionType = "select", }, { name = "specId", @@ -1887,7 +1884,7 @@ Private.event_prototypes = { init = "UnitClassification(unit)", values = "classification_types", store = true, - conditionType = "select" + conditionType = "select", }, { name = "role", @@ -1899,7 +1896,7 @@ Private.event_prototypes = { conditionType = "select", enable = function(trigger) return WeakAuras.IsWrathOrRetail() and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") - end + end, }, { name = "raid_role", @@ -1911,7 +1908,7 @@ Private.event_prototypes = { conditionType = "select", enable = function(trigger) return WeakAuras.IsClassicOrBCCOrWrath() and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") - end + end, }, { name = "raidMarkIndex", @@ -1920,7 +1917,7 @@ Private.event_prototypes = { values = "raid_mark_check_type", store = true, conditionType = "select", - init = "GetRaidTargetIndex(unit) or 0" + init = "GetRaidTargetIndex(unit) or 0", }, { name = "raidMark", @@ -1928,7 +1925,7 @@ Private.event_prototypes = { store = true, hidden = true, test = "true", - init = "raidMarkIndex > 0 and '{rt'..raidMarkIndex..'}' or ''" + init = "raidMarkIndex > 0 and '{rt'..raidMarkIndex..'}' or ''", }, { name = "ignoreSelf", @@ -1938,7 +1935,7 @@ Private.event_prototypes = { enable = function(trigger) return trigger.unit == "nameplate" or trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" end, - init = "not UnitIsUnit(\"player\", unit)" + init = "not UnitIsUnit(\"player\", unit)", }, { name = "ignoreDead", @@ -1948,7 +1945,7 @@ Private.event_prototypes = { enable = function(trigger) return trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" end, - init = "not UnitIsDeadOrGhost(unit)" + init = "not UnitIsDeadOrGhost(unit)", }, { name = "ignoreDisconnected", @@ -1958,7 +1955,7 @@ Private.event_prototypes = { enable = function(trigger) return trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" end, - init = "UnitIsConnected(unit)" + init = "UnitIsConnected(unit)", }, { name = "hostility", @@ -1976,7 +1973,7 @@ Private.event_prototypes = { init = "UnitIsPlayer(unit) and 'player' or 'npc'", values = "character_types", store = true, - conditionType = "select" + conditionType = "select", }, { name = "level", @@ -1984,7 +1981,7 @@ Private.event_prototypes = { type = "number", init = "UnitLevel(unit)", store = true, - conditionType = "number" + conditionType = "number", }, { name = "npcId", @@ -2000,7 +1997,7 @@ Private.event_prototypes = { type = "tristate", init = "UnitCanAttack('player', unit)", store = true, - conditionType = "bool" + conditionType = "bool", }, { name = "inCombat", @@ -2008,7 +2005,7 @@ Private.event_prototypes = { type = "tristate", init = "UnitAffectingCombat(unit)", store = true, - conditionType = "bool" + conditionType = "bool", }, { name = "afk", @@ -2016,7 +2013,7 @@ Private.event_prototypes = { type = "tristate", init = "UnitIsAFK(unit)", store = true, - conditionType = "bool" + conditionType = "bool", }, { name = "dnd", @@ -2024,14 +2021,14 @@ Private.event_prototypes = { type = "tristate", init = "UnitIsDND(unit)", store = true, - conditionType = "bool" + conditionType = "bool", }, { hidden = true, - test = "WeakAuras.UnitExistsFixed(unit, smart) and specificUnitCheck" - } + test = "WeakAuras.UnitExistsFixed(unit, smart) and specificUnitCheck", + }, }, - automaticrequired = true + automaticrequired = true, }, ["Faction Reputation"] = { type = "unit", @@ -2039,9 +2036,9 @@ Private.event_prototypes = { events = { ["events"] = { "UPDATE_FACTION", - } + }, }, - internal_events = {"WA_DELAYED_PLAYER_ENTERING_WORLD"}, + internal_events = { "WA_DELAYED_PLAYER_ENTERING_WORLD" }, force_events = "UPDATE_FACTION", name = L["Faction Reputation"], init = function(trigger) @@ -2060,7 +2057,8 @@ Private.event_prototypes = { end ]=] if WeakAuras.IsRetail() then - ret = ret .. [=[ + ret = ret + .. [=[ local friendshipRank, friendshipMaxRank if factionID then local friendID, friendRep, friendMaxRep, _, _, _, friendTextLevel, friendThreshold, nextFriendThreshold = GetFriendshipReputation(factionID) @@ -2117,7 +2115,7 @@ Private.event_prototypes = { return not trigger.use_watched end, test = "true", - control = "WeakAurasSortedDropdown" + control = "WeakAurasSortedDropdown", }, { name = "name", @@ -2126,7 +2124,7 @@ Private.event_prototypes = { store = "true", hidden = "true", init = "name", - test = "true" + test = "true", }, { name = "total", @@ -2155,7 +2153,7 @@ Private.event_prototypes = { values = function() local ret = {} for i = 1, 8 do - ret[i] = GetText("FACTION_STANDING_LABEL"..i, UnitSex("player")) + ret[i] = GetText("FACTION_STANDING_LABEL" .. i, UnitSex("player")) end return ret end, @@ -2170,7 +2168,7 @@ Private.event_prototypes = { init = "standing", store = "true", hidden = "true", - test = "true" + test = "true", }, { name = "friendshipRank", @@ -2181,7 +2179,7 @@ Private.event_prototypes = { test = "true", conditionType = "number", enable = WeakAuras.IsRetail(), - hidden = not WeakAuras.IsRetail() + hidden = not WeakAuras.IsRetail(), }, { name = "friendshipMaxRank", @@ -2192,17 +2190,17 @@ Private.event_prototypes = { test = "true", conditionType = "number", enable = WeakAuras.IsRetail(), - hidden = not WeakAuras.IsRetail() + hidden = not WeakAuras.IsRetail(), }, { name = "progressType", hidden = true, init = "'static'", store = true, - test = "true" + test = "true", }, }, - automaticrequired = true + automaticrequired = true, }, ["Experience"] = { type = "unit", @@ -2210,9 +2208,9 @@ Private.event_prototypes = { events = { ["events"] = { "PLAYER_XP_UPDATE", - } + }, }, - internal_events = {"WA_DELAYED_PLAYER_ENTERING_WORLD"}, + internal_events = { "WA_DELAYED_PLAYER_ENTERING_WORLD" }, force_events = "PLAYER_XP_UPDATE", name = L["Player Experience"], init = function(trigger) @@ -2266,7 +2264,7 @@ Private.event_prototypes = { hidden = true, init = "'static'", store = true, - test = "true" + test = "true", }, { name = "percentXP", @@ -2274,7 +2272,7 @@ Private.event_prototypes = { type = "number", init = "total ~= 0 and (value / total) * 100 or nil", store = true, - conditionType = "number" + conditionType = "number", }, { name = "showRested", @@ -2308,10 +2306,10 @@ Private.event_prototypes = { end, enable = function(trigger) return trigger.use_showRested - end + end, }, }, - automaticrequired = true + automaticrequired = true, }, ["Health"] = { type = "unit", @@ -2359,16 +2357,16 @@ Private.event_prototypes = { force_events = unitHelperFunctions.UnitChangedForceEventsWithPets, name = L["Health"], init = function(trigger) - trigger.unit = trigger.unit or "player"; + trigger.unit = trigger.unit or "player" local ret = [=[ unit = string.lower(unit) local name, realm = WeakAuras.UnitNameWithRealm(unit) local smart = %s - ]=]; + ]=] ret = ret .. unitHelperFunctions.SpecificUnitCheck(trigger) - return ret:format(trigger.unit == "group" and "true" or "false"); + return ret:format(trigger.unit == "group" and "true" or "false") end, statesParameter = "unit", args = { @@ -2381,7 +2379,7 @@ Private.event_prototypes = { values = "actual_unit_types_cast", desc = Private.actual_unit_types_cast_tooltip, test = "true", - store = true + store = true, }, { name = "health", @@ -2389,28 +2387,28 @@ Private.event_prototypes = { type = "number", init = "UnitHealth(unit)", store = true, - conditionType = "number" + conditionType = "number", }, { name = "value", hidden = true, init = "health", store = true, - test = "true" + test = "true", }, { name = "total", hidden = true, init = "UnitHealthMax(unit)", store = true, - test = "true" + test = "true", }, { name = "progressType", hidden = true, init = "'static'", store = true, - test = "true" + test = "true", }, { name = "percenthealth", @@ -2418,7 +2416,7 @@ Private.event_prototypes = { type = "number", init = "total ~= 0 and (value / total) * 100 or nil", store = true, - conditionType = "number" + conditionType = "number", }, { name = "deficit", @@ -2426,7 +2424,7 @@ Private.event_prototypes = { type = "number", init = "total - value", store = true, - conditionType = "number" + conditionType = "number", }, { name = "showAbsorb", @@ -2435,7 +2433,7 @@ Private.event_prototypes = { test = "true", reloadOptions = true, enable = WeakAuras.IsRetail(), - hidden = not WeakAuras.IsRetail() + hidden = not WeakAuras.IsRetail(), }, { name = "absorbMode", @@ -2444,8 +2442,10 @@ Private.event_prototypes = { test = "true", values = "absorb_modes", required = true, - enable = function(trigger) return WeakAuras.IsRetail() and trigger.use_showAbsorb end, - hidden = not WeakAuras.IsRetail() + enable = function(trigger) + return WeakAuras.IsRetail() and trigger.use_showAbsorb + end, + hidden = not WeakAuras.IsRetail(), }, { name = "showHealAbsorb", @@ -2454,7 +2454,7 @@ Private.event_prototypes = { test = "true", reloadOptions = true, enable = WeakAuras.IsRetail(), - hidden = not WeakAuras.IsRetail() + hidden = not WeakAuras.IsRetail(), }, { name = "absorbHealMode", @@ -2463,8 +2463,10 @@ Private.event_prototypes = { test = "true", values = "absorb_modes", required = true, - enable = function(trigger) return WeakAuras.IsRetail() and trigger.use_showHealAbsorb end, - hidden = not WeakAuras.IsRetail() + enable = function(trigger) + return WeakAuras.IsRetail() and trigger.use_showHealAbsorb + end, + hidden = not WeakAuras.IsRetail(), }, { name = "showIncomingHeal", @@ -2480,8 +2482,10 @@ Private.event_prototypes = { init = "UnitGetTotalAbsorbs(unit)", store = true, conditionType = "number", - enable = function(trigger) return WeakAuras.IsRetail() and trigger.use_showAbsorb end, - hidden = not WeakAuras.IsRetail() + enable = function(trigger) + return WeakAuras.IsRetail() and trigger.use_showAbsorb + end, + hidden = not WeakAuras.IsRetail(), }, { name = "healabsorb", @@ -2490,8 +2494,10 @@ Private.event_prototypes = { init = "UnitGetTotalHealAbsorbs(unit)", store = true, conditionType = "number", - enable = function(trigger) return WeakAuras.IsRetail() and trigger.use_showHealAbsorb end, - hidden = not WeakAuras.IsRetail() + enable = function(trigger) + return WeakAuras.IsRetail() and trigger.use_showHealAbsorb + end, + hidden = not WeakAuras.IsRetail(), }, { name = "healprediction", @@ -2500,7 +2506,9 @@ Private.event_prototypes = { init = "UnitGetIncomingHeals(unit)", store = true, conditionType = "number", - enable = function(trigger) return trigger.use_showIncomingHeal end, + enable = function(trigger) + return trigger.use_showIncomingHeal + end, }, { name = "name", @@ -2508,7 +2516,7 @@ Private.event_prototypes = { type = "string", store = true, hidden = true, - test = "true" + test = "true", }, { name = "realm", @@ -2516,7 +2524,7 @@ Private.event_prototypes = { type = "string", store = true, hidden = true, - test = "true" + test = "true", }, { name = "namerealm", @@ -2549,7 +2557,7 @@ Private.event_prototypes = { init = "select(2, UnitClass(unit))", values = "class_types", store = true, - conditionType = "select" + conditionType = "select", }, { name = "specId", @@ -2574,7 +2582,7 @@ Private.event_prototypes = { conditionType = "select", enable = function(trigger) return WeakAuras.IsWrathOrRetail() and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") - end + end, }, { name = "raid_role", @@ -2586,7 +2594,7 @@ Private.event_prototypes = { conditionType = "select", enable = function(trigger) return WeakAuras.IsClassicOrBCCOrWrath() and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") - end + end, }, { name = "raidMarkIndex", @@ -2595,7 +2603,7 @@ Private.event_prototypes = { values = "raid_mark_check_type", store = true, conditionType = "select", - init = "GetRaidTargetIndex(unit) or 0" + init = "GetRaidTargetIndex(unit) or 0", }, { name = "raidMark", @@ -2603,7 +2611,7 @@ Private.event_prototypes = { store = true, hidden = true, test = "true", - init = "raidMarkIndex > 0 and '{rt'..raidMarkIndex..'}' or ''" + init = "raidMarkIndex > 0 and '{rt'..raidMarkIndex..'}' or ''", }, { name = "includePets", @@ -2614,7 +2622,7 @@ Private.event_prototypes = { test = "true", enable = function(trigger) return trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" - end + end, }, { name = "ignoreSelf", @@ -2624,7 +2632,7 @@ Private.event_prototypes = { enable = function(trigger) return trigger.unit == "nameplate" or trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" end, - init = "not UnitIsUnit(\"player\", unit)" + init = "not UnitIsUnit(\"player\", unit)", }, { name = "ignoreDead", @@ -2634,7 +2642,7 @@ Private.event_prototypes = { enable = function(trigger) return trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" end, - init = "not UnitIsDeadOrGhost(unit)" + init = "not UnitIsDeadOrGhost(unit)", }, { name = "ignoreDisconnected", @@ -2644,7 +2652,7 @@ Private.event_prototypes = { enable = function(trigger) return trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" end, - init = "UnitIsConnected(unit)" + init = "UnitIsConnected(unit)", }, { name = "nameplateType", @@ -2656,62 +2664,62 @@ Private.event_prototypes = { store = true, enable = function(trigger) return trigger.unit == "nameplate" - end + end, }, { name = "name", hidden = true, init = "UnitName(unit)", - test = "true" + test = "true", }, { hidden = true, - test = "WeakAuras.UnitExistsFixed(unit, smart) and specificUnitCheck" - } + test = "WeakAuras.UnitExistsFixed(unit, smart) and specificUnitCheck", + }, }, overlayFuncs = { { name = L["Absorb"], func = function(trigger, state) local absorb = state.absorb - if (trigger.absorbMode == "OVERLAY_FROM_START") then - return 0, absorb; + if trigger.absorbMode == "OVERLAY_FROM_START" then + return 0, absorb else - return "forward", absorb; + return "forward", absorb end end, enable = function(trigger) - return WeakAuras.IsRetail() and trigger.use_showAbsorb; - end + return WeakAuras.IsRetail() and trigger.use_showAbsorb + end, }, { name = L["Heal Absorb"], func = function(trigger, state) local healabsorb = state.healabsorb - if (trigger.absorbHealMode == "OVERLAY_FROM_START") then - return 0, healabsorb; + if trigger.absorbHealMode == "OVERLAY_FROM_START" then + return 0, healabsorb else - return "forward", healabsorb; + return "forward", healabsorb end end, enable = function(trigger) - return WeakAuras.IsRetail() and trigger.use_showHealAbsorb; - end + return WeakAuras.IsRetail() and trigger.use_showHealAbsorb + end, }, { name = L["Incoming Heal"], func = function(trigger, state) - if (trigger.use_showIncomingHeal) then - local heal = state.healprediction; - return "forward", heal; + if trigger.use_showIncomingHeal then + local heal = state.healprediction + return "forward", heal end end, enable = function(trigger) - return trigger.use_showIncomingHeal; - end - } + return trigger.use_showIncomingHeal + end, + }, }, - automaticrequired = true + automaticrequired = true, }, ["Power"] = { type = "unit", @@ -2745,7 +2753,7 @@ Private.event_prototypes = { AddUnitEventForEvents(result, unit, "UNIT_TARGET") end end - return result; + return result end, internal_events = function(trigger) local unit = trigger.unit @@ -2763,7 +2771,7 @@ Private.event_prototypes = { force_events = unitHelperFunctions.UnitChangedForceEventsWithPets, name = L["Power"], init = function(trigger) - trigger.unit = trigger.unit or "player"; + trigger.unit = trigger.unit or "player" local ret = [=[ unit = string.lower(unit) local name, realm = WeakAuras.UnitNameWithRealm(unit) @@ -2773,30 +2781,35 @@ Private.event_prototypes = { local powerTypeToCheck = powerType or unitPowerType; local powerThirdArg = WeakAuras.UseUnitPowerThirdArg(powerTypeToCheck); if not WeakAuras.IsRetail() and powerType == 99 then powerType = 1 end - ]=]; - ret = ret:format(trigger.unit == "group" and "true" or "false", trigger.use_powertype and trigger.powertype or "nil"); + ]=] + ret = ret:format(trigger.unit == "group" and "true" or "false", trigger.use_powertype and trigger.powertype or "nil") ret = ret .. unitHelperFunctions.SpecificUnitCheck(trigger) - if (trigger.use_powertype and trigger.powertype == 99 and WeakAuras.IsRetail()) then - ret = ret ..[[ + if trigger.use_powertype and trigger.powertype == 99 and WeakAuras.IsRetail() then + ret = ret .. [[ local UnitPower = WeakAuras.UnitStagger ]] - if (trigger.use_scaleStagger and trigger.scaleStagger) then - ret = ret .. string.format([[ + if trigger.use_scaleStagger and trigger.scaleStagger then + ret = ret + .. string.format( + [[ local UnitPowerMax = function(unit) return UnitHealthMax(unit) * %s end - ]], trigger.scaleStagger) + ]], + trigger.scaleStagger + ) else ret = ret .. [[ local UnitPowerMax = UnitHealthMax; ]] end end - local canEnableShowCost = (not trigger.use_powertype or trigger.powertype ~= 99) and trigger.unit == "player"; - if (canEnableShowCost and trigger.use_showCost) then - ret = ret .. [[ + local canEnableShowCost = (not trigger.use_powertype or trigger.powertype ~= 99) and trigger.unit == "player" + if canEnableShowCost and trigger.use_showCost then + ret = ret + .. [[ if (event == "UNIT_DISPLAYPOWER") then local cost = WeakAuras.GetSpellCost(powerTypeToCheck) if state.cost ~= cost then @@ -2812,10 +2825,9 @@ Private.event_prototypes = { end ]] end - if WeakAuras.IsRetail() - and trigger.unit == 'player' and trigger.use_powertype and trigger.powertype == 4 - then - ret = ret .. [[ + if WeakAuras.IsRetail() and trigger.unit == "player" and trigger.use_powertype and trigger.powertype == 4 then + ret = ret + .. [[ local chargedComboPoint = GetUnitChargedPowerPoints('player') or {} if state.chargedComboPoint1 ~= chargedComboPoint[1] then state.chargedComboPoint = chargedComboPoint[1] -- For backwards compability @@ -2854,18 +2866,20 @@ Private.event_prototypes = { values = "actual_unit_types_cast", desc = Private.actual_unit_types_cast_tooltip, test = "true", - store = true + store = true, }, { name = "powertype", display = L["Power Type"], type = "select", - values = function() return not WeakAuras.IsRetail() and Private.power_types or Private.power_types_with_stagger end, + values = function() + return not WeakAuras.IsRetail() and Private.power_types or Private.power_types_with_stagger + end, init = "unitPowerType", test = "true", store = true, conditionType = "select", - reloadOptions = true + reloadOptions = true, }, { name = "requirePowerType", @@ -2882,9 +2896,9 @@ Private.event_prototypes = { type = "toggle", test = "true", enable = function(trigger) - return (not trigger.use_powertype or trigger.powertype ~= 99) and trigger.unit == "player"; + return (not trigger.use_powertype or trigger.powertype ~= 99) and trigger.unit == "player" end, - reloadOptions = true + reloadOptions = true, }, { name = "showChargedComboPoints", @@ -2893,9 +2907,9 @@ Private.event_prototypes = { test = "true", reloadOptions = true, enable = function(trigger) - return WeakAuras.IsRetail() and trigger.unit == 'player' and trigger.use_powertype and trigger.powertype == 4 + return WeakAuras.IsRetail() and trigger.unit == "player" and trigger.use_powertype and trigger.powertype == 4 end, - hidden = not WeakAuras.IsRetail() + hidden = not WeakAuras.IsRetail(), }, { name = "chargedComboPoint1", @@ -2903,10 +2917,10 @@ Private.event_prototypes = { display = L["Charged Combo Point 1"], conditionType = "number", enable = function(trigger) - return WeakAuras.IsRetail() and trigger.unit == 'player'and trigger.use_powertype and trigger.powertype == 4 + return WeakAuras.IsRetail() and trigger.unit == "player" and trigger.use_powertype and trigger.powertype == 4 end, hidden = true, - test = "true" + test = "true", }, { name = "chargedComboPoint2", @@ -2914,10 +2928,10 @@ Private.event_prototypes = { display = L["Charged Combo Point 2"], conditionType = "number", enable = function(trigger) - return WeakAuras.IsRetail() and trigger.unit == 'player'and trigger.use_powertype and trigger.powertype == 4 + return WeakAuras.IsRetail() and trigger.unit == "player" and trigger.use_powertype and trigger.powertype == 4 end, hidden = true, - test = "true" + test = "true", }, { name = "chargedComboPoint3", @@ -2925,10 +2939,10 @@ Private.event_prototypes = { display = L["Charged Combo Point 3"], conditionType = "number", enable = function(trigger) - return WeakAuras.IsRetail() and trigger.unit == 'player'and trigger.use_powertype and trigger.powertype == 4 + return WeakAuras.IsRetail() and trigger.unit == "player" and trigger.use_powertype and trigger.powertype == 4 end, hidden = true, - test = "true" + test = "true", }, { name = "chargedComboPoint4", @@ -2936,10 +2950,10 @@ Private.event_prototypes = { display = L["Charged Combo Point 4"], conditionType = "number", enable = function(trigger) - return WeakAuras.IsRetail() and trigger.unit == 'player'and trigger.use_powertype and trigger.powertype == 4 + return WeakAuras.IsRetail() and trigger.unit == "player" and trigger.use_powertype and trigger.powertype == 4 end, hidden = true, - test = "true" + test = "true", }, { name = "scaleStagger", @@ -2949,14 +2963,14 @@ Private.event_prototypes = { enable = function(trigger) return trigger.use_powertype and trigger.powertype == 99 end, - test = "true" + test = "true", }, { name = "power", display = L["Power"], type = "number", init = not WeakAuras.IsRetail() and "powerType == 4 and GetComboPoints(unit, unit .. '-target') or UnitPower(unit, powerType, powerThirdArg)" - or "UnitPower(unit, powerType, powerThirdArg) / WeakAuras.UnitPowerDisplayMod(powerTypeToCheck)", + or "UnitPower(unit, powerType, powerThirdArg) / WeakAuras.UnitPowerDisplayMod(powerTypeToCheck)", store = true, conditionType = "number", }, @@ -2965,29 +2979,29 @@ Private.event_prototypes = { hidden = true, init = "power", store = true, - test = "true" + test = "true", }, { name = "total", hidden = true, init = not WeakAuras.IsRetail() and "powerType == 4 and (math.max(1, UnitPowerMax(unit, 14))) or math.max(1, UnitPowerMax(unit, powerType, powerThirdArg))" - or "math.max(1, UnitPowerMax(unit, powerType, powerThirdArg)) / WeakAuras.UnitPowerDisplayMod(powerTypeToCheck)", + or "math.max(1, UnitPowerMax(unit, powerType, powerThirdArg)) / WeakAuras.UnitPowerDisplayMod(powerTypeToCheck)", store = true, - test = "true" + test = "true", }, { name = "stacks", hidden = true, init = "power", store = true, - test = "true" + test = "true", }, { name = "progressType", hidden = true, init = "'static'", store = true, - test = "true" + test = "true", }, { name = "percentpower", @@ -2995,7 +3009,7 @@ Private.event_prototypes = { type = "number", init = "total ~= 0 and (value / total) * 100 or nil", store = true, - conditionType = "number" + conditionType = "number", }, { name = "deficit", @@ -3003,7 +3017,7 @@ Private.event_prototypes = { type = "number", init = "total - value", store = true, - conditionType = "number" + conditionType = "number", }, { name = "name", @@ -3011,7 +3025,7 @@ Private.event_prototypes = { type = "string", store = true, hidden = true, - test = "true" + test = "true", }, { name = "realm", @@ -3019,7 +3033,7 @@ Private.event_prototypes = { type = "string", store = true, hidden = true, - test = "true" + test = "true", }, { name = "namerealm", @@ -3052,7 +3066,7 @@ Private.event_prototypes = { init = "select(2, UnitClass(unit))", values = "class_types", store = true, - conditionType = "select" + conditionType = "select", }, { name = "specId", @@ -3077,7 +3091,7 @@ Private.event_prototypes = { conditionType = "select", enable = function(trigger) return WeakAuras.IsWrathOrRetail() and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") - end + end, }, { name = "raid_role", @@ -3089,7 +3103,7 @@ Private.event_prototypes = { conditionType = "select", enable = function(trigger) return not WeakAuras.IsRetail() and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") - end + end, }, { name = "raidMarkIndex", @@ -3098,7 +3112,7 @@ Private.event_prototypes = { values = "raid_mark_check_type", store = true, conditionType = "select", - init = "GetRaidTargetIndex(unit) or 0" + init = "GetRaidTargetIndex(unit) or 0", }, { name = "raidMark", @@ -3106,7 +3120,7 @@ Private.event_prototypes = { store = true, hidden = true, test = "true", - init = "raidMarkIndex > 0 and '{rt'..raidMarkIndex..'}' or ''" + init = "raidMarkIndex > 0 and '{rt'..raidMarkIndex..'}' or ''", }, { name = "includePets", @@ -3117,7 +3131,7 @@ Private.event_prototypes = { test = "true", enable = function(trigger) return trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" - end + end, }, { name = "ignoreSelf", @@ -3127,7 +3141,7 @@ Private.event_prototypes = { enable = function(trigger) return trigger.unit == "nameplate" or trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" end, - init = "not UnitIsUnit(\"player\", unit)" + init = "not UnitIsUnit(\"player\", unit)", }, { name = "ignoreDead", @@ -3137,7 +3151,7 @@ Private.event_prototypes = { enable = function(trigger) return trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" end, - init = "not UnitIsDeadOrGhost(unit)" + init = "not UnitIsDeadOrGhost(unit)", }, { name = "ignoreDisconnected", @@ -3147,7 +3161,7 @@ Private.event_prototypes = { enable = function(trigger) return trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" end, - init = "UnitIsConnected(unit)" + init = "UnitIsConnected(unit)", }, { name = "nameplateType", @@ -3159,22 +3173,22 @@ Private.event_prototypes = { conditionType = "select", enable = function(trigger) return trigger.unit == "nameplate" - end + end, }, { hidden = true, - test = "WeakAuras.UnitExistsFixed(unit, smart) and specificUnitCheck" - } + test = "WeakAuras.UnitExistsFixed(unit, smart) and specificUnitCheck", + }, }, overlayFuncs = { { name = L["Spell Cost"], func = function(trigger, state) - return "back", type(state.cost) == "number" and state.cost; + return "back", type(state.cost) == "number" and state.cost end, enable = function(trigger) - return trigger.use_showCost and (not trigger.use_powertype or trigger.powertype ~= 99) and trigger.unit == "player"; - end + return trigger.use_showCost and (not trigger.use_powertype or trigger.powertype ~= 99) and trigger.unit == "player" + end, }, { name = L["Charged Combo Point (1)"], @@ -3185,7 +3199,7 @@ Private.event_prototypes = { return 0, 0 end, enable = function(trigger) - return WeakAuras.IsRetail() and trigger.unit == 'player' and trigger.use_powertype and trigger.powertype == 4 and trigger.use_showChargedComboPoints + return WeakAuras.IsRetail() and trigger.unit == "player" and trigger.use_powertype and trigger.powertype == 4 and trigger.use_showChargedComboPoints end, }, { @@ -3197,7 +3211,7 @@ Private.event_prototypes = { return 0, 0 end, enable = function(trigger) - return WeakAuras.IsRetail() and trigger.unit == 'player' and trigger.use_powertype and trigger.powertype == 4 and trigger.use_showChargedComboPoints + return WeakAuras.IsRetail() and trigger.unit == "player" and trigger.use_powertype and trigger.powertype == 4 and trigger.use_showChargedComboPoints end, }, { @@ -3209,7 +3223,7 @@ Private.event_prototypes = { return 0, 0 end, enable = function(trigger) - return WeakAuras.IsRetail() and trigger.unit == 'player' and trigger.use_powertype and trigger.powertype == 4 and trigger.use_showChargedComboPoints + return WeakAuras.IsRetail() and trigger.unit == "player" and trigger.use_powertype and trigger.powertype == 4 and trigger.use_showChargedComboPoints end, }, { @@ -3221,11 +3235,11 @@ Private.event_prototypes = { return 0, 0 end, enable = function(trigger) - return WeakAuras.IsRetail() and trigger.unit == 'player' and trigger.use_powertype and trigger.powertype == 4 and trigger.use_showChargedComboPoints + return WeakAuras.IsRetail() and trigger.unit == "player" and trigger.use_powertype and trigger.powertype == 4 and trigger.use_showChargedComboPoints end, - } + }, }, - automaticrequired = true + automaticrequired = true, }, ["Alternate Power"] = { type = "unit", @@ -3243,7 +3257,7 @@ Private.event_prototypes = { end, internal_events = function(trigger) local unit = trigger.unit - local result = { } + local result = {} AddUnitChangeInternalEvents(unit, result) AddUnitRoleChangeInternalEvents(unit, result) if trigger.use_specId then @@ -3254,7 +3268,7 @@ Private.event_prototypes = { force_events = unitHelperFunctions.UnitChangedForceEvents, name = L["Alternate Power"], init = function(trigger) - trigger.unit = trigger.unit or "player"; + trigger.unit = trigger.unit or "player" local ret = [=[ unit = string.lower(unit) local unitname, realm = WeakAuras.UnitNameWithRealm(unit) @@ -3263,7 +3277,7 @@ Private.event_prototypes = { ret = ret .. unitHelperFunctions.SpecificUnitCheck(trigger) - return ret:format(trigger.unit == "group" and "true" or "false"); + return ret:format(trigger.unit == "group" and "true" or "false") end, statesParameter = "unit", args = { @@ -3276,41 +3290,41 @@ Private.event_prototypes = { values = "actual_unit_types_cast", desc = Private.actual_unit_types_cast_tooltip, test = "true", - store = true + store = true, }, { name = "power", display = L["Alternate Power"], type = "number", - init = "UnitPower(unit, 10)" + init = "UnitPower(unit, 10)", }, { name = "value", hidden = true, init = "power", store = true, - test = "true" + test = "true", }, { name = "total", hidden = true, init = "UnitPowerMax(unit, 10)", store = true, - test = "true" + test = "true", }, { name = "progressType", hidden = true, init = "'static'", store = true, - test = "true" + test = "true", }, { name = "name", hidden = true, init = "GetUnitPowerBarStrings(unit)", store = true, - test = "true" + test = "true", }, { name = "unitname", @@ -3318,7 +3332,7 @@ Private.event_prototypes = { type = "string", store = true, hidden = true, - test = "true" + test = "true", }, { name = "unitrealm", @@ -3326,7 +3340,7 @@ Private.event_prototypes = { type = "string", store = true, hidden = true, - test = "true" + test = "true", }, { name = "namerealm", @@ -3349,7 +3363,7 @@ Private.event_prototypes = { hidden = true, init = "GetUnitPowerBarTextureInfo(unit, 1)", store = true, - test = "true" + test = "true", }, { name = "class", @@ -3358,7 +3372,7 @@ Private.event_prototypes = { init = "select(2, UnitClass(unit))", values = "class_types", store = true, - conditionType = "select" + conditionType = "select", }, { name = "specId", @@ -3383,7 +3397,7 @@ Private.event_prototypes = { conditionType = "select", enable = function(trigger) return WeakAuras.IsWrathOrRetail() and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") - end + end, }, { name = "raid_role", @@ -3395,7 +3409,7 @@ Private.event_prototypes = { conditionType = "select", enable = function(trigger) return not WeakAuras.IsRetail() and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") - end + end, }, { name = "raidMarkIndex", @@ -3404,7 +3418,7 @@ Private.event_prototypes = { values = "raid_mark_check_type", store = true, conditionType = "select", - init = "GetRaidTargetIndex(unit) or 0" + init = "GetRaidTargetIndex(unit) or 0", }, { name = "raidMark", @@ -3412,7 +3426,7 @@ Private.event_prototypes = { store = true, hidden = true, test = "true", - init = "raidMarkIndex > 0 and '{rt'..raidMarkIndex..'}' or ''" + init = "raidMarkIndex > 0 and '{rt'..raidMarkIndex..'}' or ''", }, { name = "ignoreSelf", @@ -3422,7 +3436,7 @@ Private.event_prototypes = { enable = function(trigger) return trigger.unit == "nameplate" or trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" end, - init = "not UnitIsUnit(\"player\", unit)" + init = "not UnitIsUnit(\"player\", unit)", }, { name = "ignoreDead", @@ -3432,7 +3446,7 @@ Private.event_prototypes = { enable = function(trigger) return trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" end, - init = "not UnitIsDeadOrGhost(unit)" + init = "not UnitIsDeadOrGhost(unit)", }, { name = "ignoreDisconnected", @@ -3442,7 +3456,7 @@ Private.event_prototypes = { enable = function(trigger) return trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" end, - init = "UnitIsConnected(unit)" + init = "UnitIsConnected(unit)", }, { name = "nameplateType", @@ -3454,25 +3468,25 @@ Private.event_prototypes = { conditionType = "select", enable = function(trigger) return trigger.unit == "nameplate" - end + end, }, { hidden = true, - test = "name and WeakAuras.UnitExistsFixed(unit, smart) and specificUnitCheck" - } + test = "name and WeakAuras.UnitExistsFixed(unit, smart) and specificUnitCheck", + }, }, - automaticrequired = true + automaticrequired = true, }, ["Combat Log"] = { type = "combatlog", events = { - ["events"] = {"COMBAT_LOG_EVENT_UNFILTERED"} + ["events"] = { "COMBAT_LOG_EVENT_UNFILTERED" }, }, init = function(trigger) local ret = [[ local use_cloneId = %s; - ]]; - return ret:format(trigger.use_cloneId and "true" or "false"); + ]] + return ret:format(trigger.use_cloneId and "true" or "false") end, name = L["Combat Log"], statesParameter = "all", @@ -3486,7 +3500,7 @@ Private.event_prototypes = { hidden = "true", test = "true", store = true, - display = L["Source GUID"] + display = L["Source GUID"], }, { name = "sourceUnit", @@ -3500,8 +3514,8 @@ Private.event_prototypes = { store = true, conditionType = "select", conditionTest = function(state, needle, op) - return state and state.show and ((state.sourceGUID or '') == (UnitGUID(needle) or '')) == (op == "==") - end + return state and state.show and ((state.sourceGUID or "") == (UnitGUID(needle) or "")) == (op == "==") + end, }, { name = "sourceName", @@ -3509,7 +3523,7 @@ Private.event_prototypes = { type = "string", init = "arg", store = true, - conditionType = "string" + conditionType = "string", }, { name = "sourceNpcId", @@ -3530,8 +3544,8 @@ Private.event_prototypes = { test = "WeakAuras.CheckCombatLogFlags(sourceFlags, %q)", conditionType = "select", conditionTest = function(state, needle) - return state and state.show and WeakAuras.CheckCombatLogFlags(state.sourceFlags, needle); - end + return state and state.show and WeakAuras.CheckCombatLogFlags(state.sourceFlags, needle) + end, }, { name = "sourceFlags2", @@ -3541,8 +3555,8 @@ Private.event_prototypes = { test = "WeakAuras.CheckCombatLogFlagsReaction(sourceFlags, %q)", conditionType = "select", conditionTest = function(state, needle) - return state and state.show and WeakAuras.CheckCombatLogFlagsReaction(state.sourceFlags, needle); - end + return state and state.show and WeakAuras.CheckCombatLogFlagsReaction(state.sourceFlags, needle) + end, }, { name = "sourceFlags3", @@ -3552,8 +3566,8 @@ Private.event_prototypes = { test = "WeakAuras.CheckCombatLogFlagsObjectType(sourceFlags, %q)", conditionType = "select", conditionTest = function(state, needle) - return state and state.show and WeakAuras.CheckCombatLogFlagsObjectType(state.sourceFlags, needle); - end + return state and state.show and WeakAuras.CheckCombatLogFlagsObjectType(state.sourceFlags, needle) + end, }, { name = "sourceRaidFlags", @@ -3565,8 +3579,8 @@ Private.event_prototypes = { test = "WeakAuras.CheckRaidFlags(sourceRaidFlags, %q)", conditionType = "select", conditionTest = function(state, needle) - return state and state.show and WeakAuras.CheckRaidFlags(state.sourceRaidFlags, needle); - end + return state and state.show and WeakAuras.CheckRaidFlags(state.sourceRaidFlags, needle) + end, }, { name = "sourceRaidMarkIndex", @@ -3590,7 +3604,7 @@ Private.event_prototypes = { hidden = "true", test = "true", store = true, - display = L["Destination GUID"] + display = L["Destination GUID"], }, { name = "destUnit", @@ -3599,13 +3613,13 @@ Private.event_prototypes = { test = "(destGUID or '') == (UnitGUID(%q) or '') and destGUID", values = "actual_unit_types_with_specific", enable = function(trigger) - return not (trigger.subeventPrefix == "SPELL" and trigger.subeventSuffix == "_CAST_START"); + return not (trigger.subeventPrefix == "SPELL" and trigger.subeventSuffix == "_CAST_START") end, store = true, conditionType = "select", conditionTest = function(state, needle, op) - return state and state.show and ((state.destGUID or '') == (UnitGUID(needle) or '')) == (op == "==") - end + return state and state.show and ((state.destGUID or "") == (UnitGUID(needle) or "")) == (op == "==") + end, }, { name = "destName", @@ -3613,10 +3627,10 @@ Private.event_prototypes = { type = "string", init = "arg", enable = function(trigger) - return not (trigger.subeventPrefix == "SPELL" and trigger.subeventSuffix == "_CAST_START"); + return not (trigger.subeventPrefix == "SPELL" and trigger.subeventSuffix == "_CAST_START") end, store = true, - conditionType = "string" + conditionType = "string", }, { name = "destNpcId", @@ -3624,13 +3638,13 @@ Private.event_prototypes = { type = "string", test = "select(6, strsplit('-', destGUID or '')) == %q", enable = function(trigger) - return not (trigger.subeventPrefix == "SPELL" and trigger.subeventSuffix == "_CAST_START"); + return not (trigger.subeventPrefix == "SPELL" and trigger.subeventSuffix == "_CAST_START") end, }, { -- destName ignore for SPELL_CAST_START enable = function(trigger) - return (trigger.subeventPrefix == "SPELL" and trigger.subeventSuffix == "_CAST_START"); - end + return (trigger.subeventPrefix == "SPELL" and trigger.subeventSuffix == "_CAST_START") + end, }, { name = "destFlags", @@ -3642,10 +3656,10 @@ Private.event_prototypes = { test = "WeakAuras.CheckCombatLogFlags(destFlags, %q)", conditionType = "select", conditionTest = function(state, needle) - return state and state.show and WeakAuras.CheckCombatLogFlags(state.destFlags, needle); + return state and state.show and WeakAuras.CheckCombatLogFlags(state.destFlags, needle) end, enable = function(trigger) - return not (trigger.subeventPrefix == "SPELL" and trigger.subeventSuffix == "_CAST_START"); + return not (trigger.subeventPrefix == "SPELL" and trigger.subeventSuffix == "_CAST_START") end, }, { @@ -3656,10 +3670,10 @@ Private.event_prototypes = { test = "WeakAuras.CheckCombatLogFlagsReaction(destFlags, %q)", conditionType = "select", conditionTest = function(state, needle) - return state and state.show and WeakAuras.CheckCombatLogFlagsReaction(state.destFlags, needle); + return state and state.show and WeakAuras.CheckCombatLogFlagsReaction(state.destFlags, needle) end, enable = function(trigger) - return not (trigger.subeventPrefix == "SPELL" and trigger.subeventSuffix == "_CAST_START"); + return not (trigger.subeventPrefix == "SPELL" and trigger.subeventSuffix == "_CAST_START") end, }, { @@ -3670,15 +3684,15 @@ Private.event_prototypes = { test = "WeakAuras.CheckCombatLogFlagsObjectType(destFlags, %q)", conditionType = "select", conditionTest = function(state, needle) - return state and state.show and WeakAuras.CheckCombatLogFlagsObjectType(state.destFlags, needle); + return state and state.show and WeakAuras.CheckCombatLogFlagsObjectType(state.destFlags, needle) end, enable = function(trigger) - return not (trigger.subeventPrefix == "SPELL" and trigger.subeventSuffix == "_CAST_START"); + return not (trigger.subeventPrefix == "SPELL" and trigger.subeventSuffix == "_CAST_START") end, }, - {-- destFlags ignore for SPELL_CAST_START + { -- destFlags ignore for SPELL_CAST_START enable = function(trigger) - return (trigger.subeventPrefix == "SPELL" and trigger.subeventSuffix == "_CAST_START"); + return (trigger.subeventPrefix == "SPELL" and trigger.subeventSuffix == "_CAST_START") end, }, { @@ -3691,16 +3705,16 @@ Private.event_prototypes = { test = "WeakAuras.CheckRaidFlags(destRaidFlags, %q)", conditionType = "select", conditionTest = function(state, needle) - return state and state.show and WeakAuras.CheckRaidFlags(state.destRaidFlags, needle); + return state and state.show and WeakAuras.CheckRaidFlags(state.destRaidFlags, needle) end, enable = function(trigger) - return not (trigger.subeventPrefix == "SPELL" and trigger.subeventSuffix == "_CAST_START"); + return not (trigger.subeventPrefix == "SPELL" and trigger.subeventSuffix == "_CAST_START") end, }, { -- destRaidFlags ignore for SPELL_CAST_START enable = function(trigger) - return (trigger.subeventPrefix == "SPELL" and trigger.subeventSuffix == "_CAST_START"); - end + return (trigger.subeventPrefix == "SPELL" and trigger.subeventSuffix == "_CAST_START") + end, }, { name = "destRaidMarkIndex", @@ -3710,7 +3724,7 @@ Private.event_prototypes = { store = true, hidden = true, enable = function(trigger) - return not (trigger.subeventPrefix == "SPELL" and trigger.subeventSuffix == "_CAST_START"); + return not (trigger.subeventPrefix == "SPELL" and trigger.subeventSuffix == "_CAST_START") end, }, { @@ -3721,7 +3735,7 @@ Private.event_prototypes = { store = true, hidden = true, enable = function(trigger) - return not (trigger.subeventPrefix == "SPELL" and trigger.subeventSuffix == "_CAST_START"); + return not (trigger.subeventPrefix == "SPELL" and trigger.subeventSuffix == "_CAST_START") end, }, { @@ -3734,7 +3748,7 @@ Private.event_prototypes = { end, test = WeakAuras.IsClassic() and "GetSpellInfo(%q) == spellName" or nil, store = true, - conditionType = "number" + conditionType = "number", }, { name = "spellName", @@ -3745,7 +3759,7 @@ Private.event_prototypes = { return trigger.subeventPrefix and (trigger.subeventPrefix:find("SPELL") or trigger.subeventPrefix == "RANGE" or trigger.subeventPrefix:find("DAMAGE")) end, store = true, - conditionType = "string" + conditionType = "string", }, { name = "spellSchool", @@ -3759,7 +3773,7 @@ Private.event_prototypes = { store = true, enable = function(trigger) return trigger.subeventPrefix and (trigger.subeventPrefix:find("SPELL") or trigger.subeventPrefix == "RANGE" or trigger.subeventPrefix:find("DAMAGE")) - end + end, }, { name = "environmentalType", @@ -3771,7 +3785,7 @@ Private.event_prototypes = { return trigger.subeventPrefix == "ENVIRONMENTAL" end, store = true, - conditionType = "select" + conditionType = "select", }, { name = "missType", @@ -3783,32 +3797,40 @@ Private.event_prototypes = { return trigger.subeventSuffix and trigger.subeventPrefix and (trigger.subeventSuffix == "_MISSED" or trigger.subeventPrefix == "DAMAGE_SHIELD_MISSED") end, conditionType = "select", - store = true + store = true, }, { enable = function(trigger) return trigger.subeventSuffix and (trigger.subeventSuffix == "_ABSORBED") - end + end, }, -- source of absorb GUID ignored with SPELL_ABSORBED { enable = function(trigger) return trigger.subeventSuffix and (trigger.subeventSuffix == "_ABSORBED") - end + end, }, -- source of absorb Name ignored with SPELL_ABSORBED { enable = function(trigger) return trigger.subeventSuffix and (trigger.subeventSuffix == "_ABSORBED") - end + end, }, -- source of absorb Flags ignored with SPELL_ABSORBED { enable = function(trigger) return trigger.subeventSuffix and (trigger.subeventSuffix == "_ABSORBED") - end + end, }, -- source of absorb Raid Flags ignored with SPELL_ABSORBED { enable = function(trigger) - return trigger.subeventSuffix and (trigger.subeventSuffix == "_ABSORBED" or trigger.subeventSuffix == "_INTERRUPT" or trigger.subeventSuffix == "_DISPEL" or trigger.subeventSuffix == "_DISPEL_FAILED" or trigger.subeventSuffix == "_STOLEN" or trigger.subeventSuffix == "_AURA_BROKEN_SPELL") - end + return trigger.subeventSuffix + and ( + trigger.subeventSuffix == "_ABSORBED" + or trigger.subeventSuffix == "_INTERRUPT" + or trigger.subeventSuffix == "_DISPEL" + or trigger.subeventSuffix == "_DISPEL_FAILED" + or trigger.subeventSuffix == "_STOLEN" + or trigger.subeventSuffix == "_AURA_BROKEN_SPELL" + ) + end, }, -- extraSpellId ignored with SPELL_ABSORBED { name = "extraSpellName", @@ -3816,15 +3838,31 @@ Private.event_prototypes = { type = "string", init = "arg", enable = function(trigger) - return trigger.subeventSuffix and (trigger.subeventSuffix == "_ABSORBED" or trigger.subeventSuffix == "_INTERRUPT" or trigger.subeventSuffix == "_DISPEL" or trigger.subeventSuffix == "_DISPEL_FAILED" or trigger.subeventSuffix == "_STOLEN" or trigger.subeventSuffix == "_AURA_BROKEN_SPELL") + return trigger.subeventSuffix + and ( + trigger.subeventSuffix == "_ABSORBED" + or trigger.subeventSuffix == "_INTERRUPT" + or trigger.subeventSuffix == "_DISPEL" + or trigger.subeventSuffix == "_DISPEL_FAILED" + or trigger.subeventSuffix == "_STOLEN" + or trigger.subeventSuffix == "_AURA_BROKEN_SPELL" + ) end, store = true, - conditionType = "string" + conditionType = "string", }, { enable = function(trigger) - return trigger.subeventSuffix and (trigger.subeventSuffix == "_ABSORBED" or trigger.subeventSuffix == "_INTERRUPT" or trigger.subeventSuffix == "_DISPEL" or trigger.subeventSuffix == "_DISPEL_FAILED" or trigger.subeventSuffix == "_STOLEN" or trigger.subeventSuffix == "_AURA_BROKEN_SPELL") - end + return trigger.subeventSuffix + and ( + trigger.subeventSuffix == "_ABSORBED" + or trigger.subeventSuffix == "_INTERRUPT" + or trigger.subeventSuffix == "_DISPEL" + or trigger.subeventSuffix == "_DISPEL_FAILED" + or trigger.subeventSuffix == "_STOLEN" + or trigger.subeventSuffix == "_AURA_BROKEN_SPELL" + ) + end, }, -- extraSchool ignored with _ argument { name = "auraType", @@ -3836,7 +3874,7 @@ Private.event_prototypes = { enable = function(trigger) return trigger.subeventSuffix and (trigger.subeventSuffix:find("AURA") or trigger.subeventSuffix == "_DISPEL" or trigger.subeventSuffix == "_STOLEN") end, - conditionType = "select" + conditionType = "select", }, { name = "amount", @@ -3844,10 +3882,20 @@ Private.event_prototypes = { type = "number", init = "arg", enable = function(trigger) - return trigger.subeventSuffix and trigger.subeventPrefix and (trigger.subeventSuffix == "_ABSORBED" or trigger.subeventSuffix == "_DAMAGE" or trigger.subeventSuffix == "_HEAL" or trigger.subeventSuffix == "_ENERGIZE" or trigger.subeventSuffix == "_DRAIN" or trigger.subeventSuffix == "_LEECH" or trigger.subeventPrefix:find("DAMAGE")) + return trigger.subeventSuffix + and trigger.subeventPrefix + and ( + trigger.subeventSuffix == "_ABSORBED" + or trigger.subeventSuffix == "_DAMAGE" + or trigger.subeventSuffix == "_HEAL" + or trigger.subeventSuffix == "_ENERGIZE" + or trigger.subeventSuffix == "_DRAIN" + or trigger.subeventSuffix == "_LEECH" + or trigger.subeventPrefix:find("DAMAGE") + ) end, store = true, - conditionType = "number" + conditionType = "number", }, { name = "overkill", @@ -3855,10 +3903,12 @@ Private.event_prototypes = { type = "number", init = "arg", enable = function(trigger) - return trigger.subeventSuffix and trigger.subeventPrefix and (trigger.subeventSuffix == "_DAMAGE" or trigger.subeventPrefix == "DAMAGE_SHIELD" or trigger.subeventPrefix == "DAMAGE_SPLIT") + return trigger.subeventSuffix + and trigger.subeventPrefix + and (trigger.subeventSuffix == "_DAMAGE" or trigger.subeventPrefix == "DAMAGE_SHIELD" or trigger.subeventPrefix == "DAMAGE_SPLIT") end, store = true, - conditionType = "number" + conditionType = "number", }, { name = "overhealing", @@ -3869,12 +3919,14 @@ Private.event_prototypes = { return trigger.subeventSuffix and trigger.subeventSuffix == "_HEAL" end, store = true, - conditionType = "number" + conditionType = "number", }, { enable = function(trigger) - return trigger.subeventSuffix and trigger.subeventPrefix and (trigger.subeventSuffix == "_DAMAGE" or trigger.subeventPrefix == "DAMAGE_SHIELD" or trigger.subeventPrefix == "DAMAGE_SPLIT") - end + return trigger.subeventSuffix + and trigger.subeventPrefix + and (trigger.subeventSuffix == "_DAMAGE" or trigger.subeventPrefix == "DAMAGE_SHIELD" or trigger.subeventPrefix == "DAMAGE_SPLIT") + end, }, -- damage school ignored with _ argument { name = "resisted", @@ -3882,10 +3934,12 @@ Private.event_prototypes = { type = "number", init = "arg", enable = function(trigger) - return trigger.subeventSuffix and trigger.subeventPrefix and (trigger.subeventSuffix == "_DAMAGE" or trigger.subeventPrefix == "DAMAGE_SHIELD" or trigger.subeventPrefix == "DAMAGE_SPLIT") + return trigger.subeventSuffix + and trigger.subeventPrefix + and (trigger.subeventSuffix == "_DAMAGE" or trigger.subeventPrefix == "DAMAGE_SHIELD" or trigger.subeventPrefix == "DAMAGE_SPLIT") end, store = true, - conditionType = "number" + conditionType = "number", }, { name = "blocked", @@ -3893,10 +3947,12 @@ Private.event_prototypes = { type = "number", init = "arg", enable = function(trigger) - return trigger.subeventSuffix and trigger.subeventPrefix and (trigger.subeventSuffix == "_DAMAGE" or trigger.subeventPrefix == "DAMAGE_SHIELD" or trigger.subeventPrefix == "DAMAGE_SPLIT") + return trigger.subeventSuffix + and trigger.subeventPrefix + and (trigger.subeventSuffix == "_DAMAGE" or trigger.subeventPrefix == "DAMAGE_SHIELD" or trigger.subeventPrefix == "DAMAGE_SPLIT") end, store = true, - conditionType = "number" + conditionType = "number", }, { name = "absorbed", @@ -3904,10 +3960,12 @@ Private.event_prototypes = { type = "number", init = "arg", enable = function(trigger) - return trigger.subeventSuffix and trigger.subeventPrefix and (trigger.subeventSuffix == "_DAMAGE" or trigger.subeventPrefix == "DAMAGE_SHIELD" or trigger.subeventPrefix == "DAMAGE_SPLIT" or trigger.subeventSuffix == "_HEAL") + return trigger.subeventSuffix + and trigger.subeventPrefix + and (trigger.subeventSuffix == "_DAMAGE" or trigger.subeventPrefix == "DAMAGE_SHIELD" or trigger.subeventPrefix == "DAMAGE_SPLIT" or trigger.subeventSuffix == "_HEAL") end, store = true, - conditionType = "number" + conditionType = "number", }, { name = "critical", @@ -3915,10 +3973,12 @@ Private.event_prototypes = { type = "tristate", init = "arg", enable = function(trigger) - return trigger.subeventSuffix and trigger.subeventPrefix and (trigger.subeventSuffix == "_DAMAGE" or trigger.subeventPrefix == "DAMAGE_SHIELD" or trigger.subeventPrefix == "DAMAGE_SPLIT" or trigger.subeventSuffix == "_HEAL") + return trigger.subeventSuffix + and trigger.subeventPrefix + and (trigger.subeventSuffix == "_DAMAGE" or trigger.subeventPrefix == "DAMAGE_SHIELD" or trigger.subeventPrefix == "DAMAGE_SPLIT" or trigger.subeventSuffix == "_HEAL") end, store = true, - conditionType = "bool" + conditionType = "bool", }, { name = "glancing", @@ -3926,10 +3986,12 @@ Private.event_prototypes = { type = "tristate", init = "arg", enable = function(trigger) - return trigger.subeventSuffix and trigger.subeventPrefix and (trigger.subeventSuffix == "_DAMAGE" or trigger.subeventPrefix == "DAMAGE_SHIELD" or trigger.subeventPrefix == "DAMAGE_SPLIT") + return trigger.subeventSuffix + and trigger.subeventPrefix + and (trigger.subeventSuffix == "_DAMAGE" or trigger.subeventPrefix == "DAMAGE_SHIELD" or trigger.subeventPrefix == "DAMAGE_SPLIT") end, store = true, - conditionType = "bool" + conditionType = "bool", }, { name = "crushing", @@ -3937,10 +3999,12 @@ Private.event_prototypes = { type = "tristate", init = "arg", enable = function(trigger) - return trigger.subeventSuffix and trigger.subeventPrefix and (trigger.subeventSuffix == "_DAMAGE" or trigger.subeventPrefix == "DAMAGE_SHIELD" or trigger.subeventPrefix == "DAMAGE_SPLIT") + return trigger.subeventSuffix + and trigger.subeventPrefix + and (trigger.subeventSuffix == "_DAMAGE" or trigger.subeventPrefix == "DAMAGE_SHIELD" or trigger.subeventPrefix == "DAMAGE_SPLIT") end, store = true, - conditionType = "bool" + conditionType = "bool", }, { name = "isOffHand", @@ -3948,12 +4012,18 @@ Private.event_prototypes = { type = "tristate", init = "arg", enable = function(trigger) - return trigger.subeventSuffix and trigger.subeventPrefix and ( - trigger.subeventSuffix == "_DAMAGE" or trigger.subeventPrefix == "DAMAGE_SHIELD" or trigger.subeventPrefix == "DAMAGE_SPLIT" - or trigger.subeventSuffix == "_MISSED" or trigger.subeventPrefix == "DAMAGE_SHIELD_MISSED") + return trigger.subeventSuffix + and trigger.subeventPrefix + and ( + trigger.subeventSuffix == "_DAMAGE" + or trigger.subeventPrefix == "DAMAGE_SHIELD" + or trigger.subeventPrefix == "DAMAGE_SPLIT" + or trigger.subeventSuffix == "_MISSED" + or trigger.subeventPrefix == "DAMAGE_SHIELD_MISSED" + ) end, store = true, - conditionType = "bool" + conditionType = "bool", }, { name = "number", @@ -3964,12 +4034,12 @@ Private.event_prototypes = { return trigger.subeventSuffix and (trigger.subeventSuffix == "_EXTRA_ATTACKS" or trigger.subeventSuffix:find("DOSE")) end, store = true, - conditionType = "number" + conditionType = "number", }, { enable = function(trigger) return trigger.subeventSuffix and (trigger.subeventSuffix == "_ENERGIZE") - end + end, }, -- unknown argument for _ENERGIZE ignored { name = "powerType", @@ -3981,7 +4051,7 @@ Private.event_prototypes = { enable = function(trigger) return trigger.subeventSuffix and (trigger.subeventSuffix == "_ENERGIZE" or trigger.subeventSuffix == "_DRAIN" or trigger.subeventSuffix == "_LEECH") end, - conditionType = "select" + conditionType = "select", }, { name = "extraAmount", @@ -3992,54 +4062,53 @@ Private.event_prototypes = { return trigger.subeventSuffix and (trigger.subeventSuffix == "_ENERGIZE" or trigger.subeventSuffix == "_DRAIN" or trigger.subeventSuffix == "_LEECH") end, store = true, - conditionType = "number" + conditionType = "number", }, { enable = function(trigger) return trigger.subeventSuffix == "_CAST_FAILED" - end + end, }, -- failedType ignored with _ argument - theoretically this is not necessary because it is the last argument in the event, but it is added here for completeness { name = "cloneId", display = L["Clone per Event"], type = "toggle", test = "true", - init = "use_cloneId and WeakAuras.GetUniqueCloneId() or ''" + init = "use_cloneId and WeakAuras.GetUniqueCloneId() or ''", }, { hidden = true, name = "icon", init = "(WeakAuras.IsClassic() and spellName and select(3, GetSpellInfo(spellName))) or (spellId and select(3, GetSpellInfo(spellId))) or 'Interface\\\\Icons\\\\INV_Misc_QuestionMark'", store = true, - test = "true" + test = "true", }, }, - timedrequired = true + timedrequired = true, }, ["Spell Activation Overlay"] = { type = "spell", - events = { - }, + events = {}, internal_events = { - "WA_UPDATE_OVERLAY_GLOW" + "WA_UPDATE_OVERLAY_GLOW", }, force_events = "WA_UPDATE_OVERLAY_GLOW", name = L["Spell Activation Overlay Glow"], loadFunc = function(trigger) - if (trigger.use_exact_spellName) then - WeakAuras.WatchSpellActivation(tonumber(trigger.spellName)); + if trigger.use_exact_spellName then + WeakAuras.WatchSpellActivation(tonumber(trigger.spellName)) else - WeakAuras.WatchSpellActivation(type(trigger.spellName) == "number" and GetSpellInfo(trigger.spellName) or trigger.spellName); + WeakAuras.WatchSpellActivation(type(trigger.spellName) == "number" and GetSpellInfo(trigger.spellName) or trigger.spellName) end end, init = function(trigger) local spellName - if (trigger.use_exact_spellName) then + if trigger.use_exact_spellName then spellName = trigger.spellName - return string.format("local spellName = %s\n", tonumber(spellName) or "nil"); + return string.format("local spellName = %s\n", tonumber(spellName) or "nil") else - spellName = type(trigger.spellName) == "number" and GetSpellInfo(trigger.spellName) or trigger.spellName; - return string.format("local spellName = %q\n", spellName or ""); + spellName = type(trigger.spellName) == "number" and GetSpellInfo(trigger.spellName) or trigger.spellName + return string.format("local spellName = %q\n", spellName or "") end end, args = { @@ -4049,25 +4118,25 @@ Private.event_prototypes = { display = L["Spell"], type = "spell", test = "true", - showExactOption = true + showExactOption = true, }, { hidden = true, - test = "WeakAuras.SpellActivationActive(spellName)"; - } + test = "WeakAuras.SpellActivationActive(spellName)", + }, }, iconFunc = function(trigger) - local _, _, icon = GetSpellInfo(trigger.spellName or 0); - return icon; + local _, _, icon = GetSpellInfo(trigger.spellName or 0) + return icon end, - automaticrequired = true + automaticrequired = true, }, ["Cooldown Progress (Spell)"] = { type = "spell", events = function(trigger) if trigger.use_showlossofcontrol then return { - ["events"] = {"LOSS_OF_CONTROL_UPDATE", "LOSS_OF_CONTROL_ADDED"} + ["events"] = { "LOSS_OF_CONTROL_UPDATE", "LOSS_OF_CONTROL_ADDED" }, } else return {} @@ -4077,39 +4146,39 @@ Private.event_prototypes = { local events = { "SPELL_COOLDOWN_CHANGED", "COOLDOWN_REMAINING_CHECK", - "WA_DELAYED_PLAYER_ENTERING_WORLD" - }; - if (trigger.use_showgcd) then - tinsert(events, "GCD_START"); - tinsert(events, "GCD_CHANGE"); - tinsert(events, "GCD_END"); + "WA_DELAYED_PLAYER_ENTERING_WORLD", + } + if trigger.use_showgcd then + tinsert(events, "GCD_START") + tinsert(events, "GCD_CHANGE") + tinsert(events, "GCD_END") end - return events; + return events end, force_events = "SPELL_COOLDOWN_FORCE", name = L["Cooldown/Charges/Count"], loadFunc = function(trigger) - trigger.spellName = trigger.spellName or 0; - local spellName; - if (trigger.use_exact_spellName) then - spellName = trigger.spellName; + trigger.spellName = trigger.spellName or 0 + local spellName + if trigger.use_exact_spellName then + spellName = trigger.spellName else - spellName = type(trigger.spellName) == "number" and GetSpellInfo(trigger.spellName) or trigger.spellName; + spellName = type(trigger.spellName) == "number" and GetSpellInfo(trigger.spellName) or trigger.spellName end - WeakAuras.WatchSpellCooldown(spellName, trigger.use_matchedRune); - if (trigger.use_showgcd) then - WeakAuras.WatchGCD(); + WeakAuras.WatchSpellCooldown(spellName, trigger.use_matchedRune) + if trigger.use_showgcd then + WeakAuras.WatchGCD() end end, init = function(trigger) - trigger.spellName = trigger.spellName or 0; - local spellName; - if (trigger.use_exact_spellName) then - spellName = trigger.spellName; + trigger.spellName = trigger.spellName or 0 + local spellName + if trigger.use_exact_spellName then + spellName = trigger.spellName else - spellName = type(trigger.spellName) == "number" and GetSpellInfo(trigger.spellName) or trigger.spellName; + spellName = type(trigger.spellName) == "number" and GetSpellInfo(trigger.spellName) or trigger.spellName end - trigger.realSpellName = spellName; -- Cache + trigger.realSpellName = spellName -- Cache local ret = [=[ local spellname = %s local ignoreRuneCD = %s @@ -4134,31 +4203,33 @@ Private.event_prototypes = { local genericShowOn = %s local expirationTime = startTime and duration and startTime + duration state.spellname = spellname; - ]=]; + ]=] - local showOnCheck = "false"; - if (trigger.genericShowOn == "showOnReady") then - showOnCheck = "startTime and startTime == 0 or gcdCooldown"; - elseif (trigger.genericShowOn == "showOnCooldown") then - showOnCheck = "startTime and startTime > 0 and not gcdCooldown"; - elseif (trigger.genericShowOn == "showAlways") then - showOnCheck = "startTime ~= nil"; + local showOnCheck = "false" + if trigger.genericShowOn == "showOnReady" then + showOnCheck = "startTime and startTime == 0 or gcdCooldown" + elseif trigger.genericShowOn == "showOnCooldown" then + showOnCheck = "startTime and startTime > 0 and not gcdCooldown" + elseif trigger.genericShowOn == "showAlways" then + showOnCheck = "startTime ~= nil" end - if (type(spellName) == "string") then - spellName = "[[" .. spellName .. "]]"; + if type(spellName) == "string" then + spellName = "[[" .. spellName .. "]]" end - ret = ret:format(spellName, + ret = ret:format( + spellName, (trigger.use_matchedRune and "true" or "false"), (trigger.use_showgcd and "true" or "false"), (trigger.use_showlossofcontrol and "true" or "false"), (trigger.use_ignoreSpellKnown and "true" or "false"), (trigger.track or "auto"), showOnCheck - ); + ) - if (not trigger.use_trackcharge or not trigger.trackcharge) then - ret = ret .. [=[ + if not trigger.use_trackcharge or not trigger.trackcharge then + ret = ret + .. [=[ if (state.expirationTime ~= expirationTime) then state.expirationTime = expirationTime; state.changed = true; @@ -4172,7 +4243,7 @@ Private.event_prototypes = { state.changed = true; end state.progressType = 'timed'; - ]=]; + ]=] else local ret2 = [=[ local trackedCharge = %s @@ -4220,11 +4291,11 @@ Private.event_prototypes = { state.total = nil; state.progressType = 'timed'; end - ]=]; - local trackedCharge = tonumber(trigger.trackcharge or 1) or 1; - ret = ret .. ret2:format(trackedCharge - 1); + ]=] + local trackedCharge = tonumber(trigger.trackcharge or 1) or 1 + ret = ret .. ret2:format(trackedCharge - 1) end - if(trigger.use_remaining and trigger.genericShowOn ~= "showOnReady") then + if trigger.use_remaining and trigger.genericShowOn ~= "showOnReady" then local ret2 = [[ local remaining = 0; if (expirationTime and expirationTime > 0) then @@ -4235,18 +4306,17 @@ Private.event_prototypes = { WeakAuras.ScheduleScan(expirationTime - remainingCheck * (modRate or 1)); end end - ]]; - ret = ret..ret2:format(tonumber(trigger.remaining or 0) or 0); + ]] + ret = ret .. ret2:format(tonumber(trigger.remaining or 0) or 0) end - return ret; + return ret end, statesParameter = "one", canHaveDuration = "timed", useModRate = true, args = { - { - }, -- Ignore first argument (id) + {}, -- Ignore first argument (id) { name = "spellName", required = true, @@ -4259,35 +4329,45 @@ Private.event_prototypes = { name = "extra Cooldown Progress (Spell)", display = function(trigger) return function() - local text = ""; + local text = "" if trigger.track == "charges" then text = L["Tracking Charge CDs"] elseif trigger.track == "cooldown" then text = L["Tracking Only Cooldown"] end if trigger.use_showgcd then - if text ~= "" then text = text .. "; " end + if text ~= "" then + text = text .. "; " + end text = text .. L["Show GCD"] end if trigger.use_showlossofcontrol then - if text ~= "" then text = text .. "; " end + if text ~= "" then + text = text .. "; " + end text = text .. L["Show Loss of Control"] end if trigger.use_matchedRune then - if text ~= "" then text = text .. "; " end - text = text ..L["Ignore Rune CDs"] + if text ~= "" then + text = text .. "; " + end + text = text .. L["Ignore Rune CDs"] end if trigger.use_ignoreSpellKnown then - if text ~= "" then text = text .. "; " end + if text ~= "" then + text = text .. "; " + end text = text .. L["Disabled Spell Known Check"] end if trigger.genericShowOn ~= "showOnReady" and trigger.track ~= "cooldown" then if trigger.use_trackcharge and trigger.trackcharge then - if text ~= "" then text = text .. "; " end + if text ~= "" then + text = text .. "; " + end text = text .. L["Tracking Charge %i"]:format(trigger.trackcharge) end end @@ -4307,14 +4387,14 @@ Private.event_prototypes = { collapse = "extra Cooldown Progress (Spell)", test = "true", required = true, - default = "auto" + default = "auto", }, { name = "showgcd", display = L["Show Global Cooldown"], type = "toggle", test = "true", - collapse = "extra Cooldown Progress (Spell)" + collapse = "extra Cooldown Progress (Spell)", }, { name = "showlossofcontrol", @@ -4323,21 +4403,21 @@ Private.event_prototypes = { test = "true", collapse = "extra Cooldown Progress (Spell)", enable = WeakAuras.IsRetail(), - hidden = not WeakAuras.IsRetail() + hidden = not WeakAuras.IsRetail(), }, { name = "matchedRune", display = L["Ignore Rune CD"], type = "toggle", test = "true", - collapse = "extra Cooldown Progress (Spell)" + collapse = "extra Cooldown Progress (Spell)", }, { name = "ignoreSpellKnown", display = L["Disable Spell Known Check"], type = "toggle", test = "true", - collapse = "extra Cooldown Progress (Spell)" + collapse = "extra Cooldown Progress (Spell)", }, { name = "trackcharge", @@ -4348,37 +4428,39 @@ Private.event_prototypes = { end, test = "true", noOperator = true, - collapse = "extra Cooldown Progress (Spell)" + collapse = "extra Cooldown Progress (Spell)", }, { name = "remaining", display = L["Remaining Time"], type = "number", - enable = function(trigger) return (trigger.genericShowOn ~= "showOnReady") end + enable = function(trigger) + return (trigger.genericShowOn ~= "showOnReady") + end, }, { name = "charges", display = L["Charges"], type = "number", store = true, - conditionType = "number" + conditionType = "number", }, { name = "spellCount", display = L["Spell Count"], type = "number", store = true, - conditionType = "number" + conditionType = "number", }, { name = "stacks", init = "stacks", hidden = true, test = "true", - store = true + store = true, }, { - hidden = true, + hidden = true, name = "maxCharges", store = true, display = L["Max Charges"], @@ -4391,7 +4473,7 @@ Private.event_prototypes = { display = L["Since Ready"], conditionType = "elapsedTimer", store = true, - test = "true" + test = "true", }, { hidden = true, @@ -4399,7 +4481,7 @@ Private.event_prototypes = { display = L["Since Charge Gain"], conditionType = "elapsedTimer", store = true, - test = "true" + test = "true", }, { hidden = true, @@ -4407,16 +4489,16 @@ Private.event_prototypes = { display = L["Since Charge Lost"], conditionType = "elapsedTimer", store = true, - test = "true" + test = "true", }, { name = "genericShowOn", - display = L["Show"], + display = L["Show"], type = "select", values = "cooldown_progress_behavior_types", test = "true", required = true, - default = "showOnCooldown" + default = "showOnCooldown", }, { hidden = true, @@ -4432,7 +4514,7 @@ Private.event_prototypes = { hidden = true, name = "gcdCooldown", store = true, - test = "true" + test = "true", }, { name = "spellUsable", @@ -4446,7 +4528,7 @@ Private.event_prototypes = { conditionEvents = { "SPELL_UPDATE_USABLE", "PLAYER_TARGET_CHANGED", - "UNIT_POWER_FREQUENT:player" + "UNIT_POWER_FREQUENT:player", }, }, { @@ -4456,12 +4538,12 @@ Private.event_prototypes = { test = "true", conditionType = "bool", conditionTest = function(state, needle) - return state and state.show and (select(2, IsUsableSpell(state.spellname)) == (needle == 1)); + return state and state.show and (select(2, IsUsableSpell(state.spellname)) == (needle == 1)) end, conditionEvents = { "SPELL_UPDATE_USABLE", "PLAYER_TARGET_CHANGED", - "UNIT_POWER_FREQUENT:player" + "UNIT_POWER_FREQUENT:player", }, }, { @@ -4471,7 +4553,7 @@ Private.event_prototypes = { test = "true", conditionType = "bool", conditionTest = function(state, needle) - return state and state.show and (UnitExists('target') and state.spellname and WeakAuras.IsSpellInRange(state.spellname, 'target') == needle) + return state and state.show and (UnitExists("target") and state.spellname and WeakAuras.IsSpellInRange(state.spellname, "target") == needle) end, conditionEvents = { "PLAYER_TARGET_CHANGED", @@ -4480,26 +4562,26 @@ Private.event_prototypes = { }, { hidden = true, - test = "genericShowOn" - } + test = "genericShowOn", + }, }, nameFunc = function(trigger) - local name = GetSpellInfo(trigger.realSpellName or 0); - if(name) then - return name; + local name = GetSpellInfo(trigger.realSpellName or 0) + if name then + return name end - name = GetSpellInfo(trigger.spellName or 0); - if (name) then - return name; + name = GetSpellInfo(trigger.spellName or 0) + if name then + return name end - return "Invalid"; + return "Invalid" end, iconFunc = function(trigger) - local _, _, icon = GetSpellInfo(trigger.realSpellName or 0); - if (not icon) then - icon = select(3, GetSpellInfo(trigger.spellName or 0)); + local _, _, icon = GetSpellInfo(trigger.realSpellName or 0) + if not icon then + icon = select(3, GetSpellInfo(trigger.spellName or 0)) end - return icon; + return icon end, hasSpellID = true, automaticrequired = true, @@ -4512,33 +4594,33 @@ Private.event_prototypes = { }, name = L["Cooldown Ready Event"], loadFunc = function(trigger) - trigger.spellName = trigger.spellName or 0; - local spellName; - if (trigger.use_exact_spellName) then - spellName = trigger.spellName; + trigger.spellName = trigger.spellName or 0 + local spellName + if trigger.use_exact_spellName then + spellName = trigger.spellName else - spellName = type(trigger.spellName) == "number" and GetSpellInfo(trigger.spellName) or trigger.spellName; + spellName = type(trigger.spellName) == "number" and GetSpellInfo(trigger.spellName) or trigger.spellName end - trigger.realSpellName = spellName; -- Cache - WeakAuras.WatchSpellCooldown(spellName); + trigger.realSpellName = spellName -- Cache + WeakAuras.WatchSpellCooldown(spellName) end, init = function(trigger) - trigger.spellName = trigger.spellName or 0; - local spellName; - if (trigger.use_exact_spellName) then - spellName = trigger.spellName; + trigger.spellName = trigger.spellName or 0 + local spellName + if trigger.use_exact_spellName then + spellName = trigger.spellName else - spellName = type(trigger.spellName) == "number" and GetSpellInfo(trigger.spellName) or trigger.spellName; + spellName = type(trigger.spellName) == "number" and GetSpellInfo(trigger.spellName) or trigger.spellName end - if (type(spellName) == "string") then - spellName = "[[" .. spellName .. "]]"; + if type(spellName) == "string" then + spellName = "[[" .. spellName .. "]]" end local ret = [=[ local spellname = %s ]=] - return ret:format(spellName); + return ret:format(spellName) end, args = { { @@ -4548,29 +4630,29 @@ Private.event_prototypes = { type = "spell", init = "arg", showExactOption = true, - test = "spellname == spellName" - } + test = "spellname == spellName", + }, }, nameFunc = function(trigger) - local name = GetSpellInfo(trigger.realSpellName or 0); - if(name) then - return name; + local name = GetSpellInfo(trigger.realSpellName or 0) + if name then + return name end - name = GetSpellInfo(trigger.spellName or 0); - if (name) then - return name; + name = GetSpellInfo(trigger.spellName or 0) + if name then + return name end - return "Invalid"; + return "Invalid" end, iconFunc = function(trigger) - local _, _, icon = GetSpellInfo(trigger.realSpellName or 0); - if (not icon) then - icon = select(3, GetSpellInfo(trigger.spellName or 0)); + local _, _, icon = GetSpellInfo(trigger.realSpellName or 0) + if not icon then + icon = select(3, GetSpellInfo(trigger.spellName or 0)) end - return icon; + return icon end, hasSpellID = true, - timedrequired = true + timedrequired = true, }, ["Charges Changed"] = { type = "spell", @@ -4580,25 +4662,25 @@ Private.event_prototypes = { }, name = L["Charges Changed Event"], loadFunc = function(trigger) - trigger.spellName = trigger.spellName or 0; - local spellName; - if (trigger.use_exact_spellName) then - spellName = trigger.spellName; + trigger.spellName = trigger.spellName or 0 + local spellName + if trigger.use_exact_spellName then + spellName = trigger.spellName else - spellName = type(trigger.spellName) == "number" and GetSpellInfo(trigger.spellName) or trigger.spellName; + spellName = type(trigger.spellName) == "number" and GetSpellInfo(trigger.spellName) or trigger.spellName end - trigger.realSpellName = spellName; -- Cache - WeakAuras.WatchSpellCooldown(spellName); + trigger.realSpellName = spellName -- Cache + WeakAuras.WatchSpellCooldown(spellName) end, init = function(trigger) - local spellName; - if (trigger.use_exact_spellName) then - spellName = trigger.spellName; + local spellName + if trigger.use_exact_spellName then + spellName = trigger.spellName else - spellName = type(trigger.spellName) == "number" and GetSpellInfo(trigger.spellName) or trigger.spellName; + spellName = type(trigger.spellName) == "number" and GetSpellInfo(trigger.spellName) or trigger.spellName end - spellName = string.format("%q", spellName or ""); - return string.format("local spell = %s;\n", spellName); + spellName = string.format("%q", spellName or "") + return string.format("local spell = %s;\n", spellName) end, statesParameter = "one", args = { @@ -4609,7 +4691,7 @@ Private.event_prototypes = { type = "spell", init = "arg", showExactOption = true, - test = "spell == spellName" + test = "spell == spellName", }, { name = "direction", @@ -4621,7 +4703,7 @@ Private.event_prototypes = { test = "WeakAuras.CheckChargesDirection(direction, %q)", store = true, conditionType = "select", - conditionValues = "charges_change_condition_type"; + conditionValues = "charges_change_condition_type", conditionTest = function(state, needle) return state and state.show and state.direction and WeakAuras.CheckChargesDirection(state.direction, needle) end, @@ -4632,29 +4714,29 @@ Private.event_prototypes = { type = "number", init = "arg", store = true, - conditionType = "number" - } + conditionType = "number", + }, }, nameFunc = function(trigger) - local name = GetSpellInfo(trigger.realSpellName or 0); - if(name) then - return name; + local name = GetSpellInfo(trigger.realSpellName or 0) + if name then + return name end - name = GetSpellInfo(trigger.spellName or 0); - if (name) then - return name; + name = GetSpellInfo(trigger.spellName or 0) + if name then + return name end - return "Invalid"; + return "Invalid" end, iconFunc = function(trigger) - local _, _, icon = GetSpellInfo(trigger.realSpellName or 0); - if (not icon) then - icon = select(3, GetSpellInfo(trigger.spellName or 0)); + local _, _, icon = GetSpellInfo(trigger.realSpellName or 0) + if not icon then + icon = select(3, GetSpellInfo(trigger.spellName or 0)) end - return icon; + return icon end, hasSpellID = true, - timedrequired = true + timedrequired = true, }, ["Cooldown Progress (Item)"] = { type = "item", @@ -4666,34 +4748,34 @@ Private.event_prototypes = { "ITEM_COOLDOWN_STARTED", "COOLDOWN_REMAINING_CHECK", } - if (trigger.use_showgcd) then - tinsert(events, "GCD_START"); - tinsert(events, "GCD_CHANGE"); - tinsert(events, "GCD_END"); + if trigger.use_showgcd then + tinsert(events, "GCD_START") + tinsert(events, "GCD_CHANGE") + tinsert(events, "GCD_END") end return events end, force_events = "ITEM_COOLDOWN_FORCE", name = L["Cooldown Progress (Item)"], loadFunc = function(trigger) - trigger.itemName = trigger.itemName or 0; - local itemName = type(trigger.itemName) == "number" and trigger.itemName or "[["..trigger.itemName.."]]"; - WeakAuras.WatchItemCooldown(trigger.itemName); - if (trigger.use_showgcd) then - WeakAuras.WatchGCD(); + trigger.itemName = trigger.itemName or 0 + local itemName = type(trigger.itemName) == "number" and trigger.itemName or "[[" .. trigger.itemName .. "]]" + WeakAuras.WatchItemCooldown(trigger.itemName) + if trigger.use_showgcd then + WeakAuras.WatchGCD() end end, init = function(trigger) - trigger.itemName = trigger.itemName or 0; - local itemName = type(trigger.itemName) == "number" and trigger.itemName or "[["..trigger.itemName.."]]"; + trigger.itemName = trigger.itemName or 0 + local itemName = type(trigger.itemName) == "number" and trigger.itemName or "[[" .. trigger.itemName .. "]]" local ret = [=[ local itemname = %s; local showgcd = %s local startTime, duration, enabled, gcdCooldown = WeakAuras.GetItemCooldown(itemname, showgcd); local genericShowOn = %s state.itemname = itemname; - ]=]; - if(trigger.use_remaining and trigger.genericShowOn ~= "showOnReady") then + ]=] + if trigger.use_remaining and trigger.genericShowOn ~= "showOnReady" then local ret2 = [[ local expirationTime = startTime + duration local remaining = expirationTime > 0 and (expirationTime - GetTime()) or 0; @@ -4701,12 +4783,10 @@ Private.event_prototypes = { if(remaining >= remainingCheck and remaining > 0) then WeakAuras.ScheduleScan(expirationTime - remainingCheck); end - ]]; - ret = ret..ret2:format(tonumber(trigger.remaining or 0) or 0); + ]] + ret = ret .. ret2:format(tonumber(trigger.remaining or 0) or 0) end - return ret:format(itemName, - trigger.use_showgcd and "true" or "false", - "[[" .. (trigger.genericShowOn or "") .. "]]"); + return ret:format(itemName, trigger.use_showgcd and "true" or "false", "[[" .. (trigger.genericShowOn or "") .. "]]") end, statesParameter = "one", args = { @@ -4715,22 +4795,26 @@ Private.event_prototypes = { required = true, display = L["Item"], type = "item", - test = "true" + test = "true", }, { name = "remaining", display = L["Remaining Time"], type = "number", - enable = function(trigger) return (trigger.genericShowOn ~= "showOnReady") end, - init = "remaining" + enable = function(trigger) + return (trigger.genericShowOn ~= "showOnReady") + end, + init = "remaining", }, { name = "extra Cooldown Progress (Item)", display = function(trigger) return function() - local text = ""; + local text = "" if trigger.use_showgcd then - if text ~= "" then text = text .. "; " end + if text ~= "" then + text = text .. "; " + end text = text .. L["Show GCD"] end if text == "" then @@ -4746,16 +4830,16 @@ Private.event_prototypes = { display = L["Show Global Cooldown"], type = "toggle", test = "true", - collapse = "extra Cooldown Progress (Item)" + collapse = "extra Cooldown Progress (Item)", }, { name = "genericShowOn", - display = L["Show"], + display = L["Show"], type = "select", values = "cooldown_progress_behavior_types", test = "true", required = true, - default = "showOnCooldown" + default = "showOnCooldown", }, { hidden = true, @@ -4780,43 +4864,43 @@ Private.event_prototypes = { test = "true", conditionType = "bool", conditionTest = function(state, needle) - return state and state.show and (UnitExists('target') and IsItemInRange(state.itemname, 'target')) == (needle == 1) + return state and state.show and (UnitExists("target") and IsItemInRange(state.itemname, "target")) == (needle == 1) end, conditionEvents = { "PLAYER_TARGET_CHANGED", "WA_SPELL_RANGECHECK", - } + }, }, { hidden = true, name = "gcdCooldown", store = true, - test = "true" + test = "true", }, { hidden = true, - test = "(genericShowOn == \"showOnReady\" and (startTime == 0 and enabled == 1 or gcdCooldown))" .. - "or (genericShowOn == \"showOnCooldown\" and (startTime > 0 or enabled == 0) and not gcdCooldown) " .. - "or (genericShowOn == \"showAlways\")" - } + test = "(genericShowOn == \"showOnReady\" and (startTime == 0 and enabled == 1 or gcdCooldown))" + .. "or (genericShowOn == \"showOnCooldown\" and (startTime > 0 or enabled == 0) and not gcdCooldown) " + .. "or (genericShowOn == \"showAlways\")", + }, }, durationFunc = function(trigger) - local startTime, duration = WeakAuras.GetItemCooldown(type(trigger.itemName) == "number" and trigger.itemName or 0, trigger.use_showgcd); - startTime = startTime or 0; - duration = duration or 0; - return duration, startTime + duration; + local startTime, duration = WeakAuras.GetItemCooldown(type(trigger.itemName) == "number" and trigger.itemName or 0, trigger.use_showgcd) + startTime = startTime or 0 + duration = duration or 0 + return duration, startTime + duration end, nameFunc = function(trigger) - local name = GetItemInfo(trigger.itemName or 0); - if(name) then - return name; + local name = GetItemInfo(trigger.itemName or 0) + if name then + return name else - return "Invalid"; + return "Invalid" end end, iconFunc = function(trigger) - local _, _, _, _, icon = GetItemInfoInstant(trigger.itemName or 0); - return icon; + local _, _, _, _, icon = GetItemInfoInstant(trigger.itemName or 0) + return icon end, hasItemID = true, automaticrequired = true, @@ -4825,8 +4909,8 @@ Private.event_prototypes = { type = "item", events = { ["unit_events"] = { - ["player"] = {"UNIT_INVENTORY_CHANGED"} - } + ["player"] = { "UNIT_INVENTORY_CHANGED" }, + }, }, internal_events = function(trigger, untrigger) local events = { @@ -4835,13 +4919,13 @@ Private.event_prototypes = { "COOLDOWN_REMAINING_CHECK", "ITEM_SLOT_COOLDOWN_ITEM_CHANGED", "ITEM_SLOT_COOLDOWN_READY", - "WA_DELAYED_PLAYER_ENTERING_WORLD" + "WA_DELAYED_PLAYER_ENTERING_WORLD", } - if (trigger.use_showgcd) then - tinsert(events, "GCD_START"); - tinsert(events, "GCD_CHANGE"); - tinsert(events, "GCD_END"); + if trigger.use_showgcd then + tinsert(events, "GCD_START") + tinsert(events, "GCD_CHANGE") + tinsert(events, "GCD_END") end return events @@ -4849,9 +4933,9 @@ Private.event_prototypes = { force_events = "ITEM_COOLDOWN_FORCE", name = L["Cooldown Progress (Slot)"], loadFunc = function(trigger) - WeakAuras.WatchItemSlotCooldown(trigger.itemSlot); - if (trigger.use_showgcd) then - WeakAuras.WatchGCD(); + WeakAuras.WatchItemSlotCooldown(trigger.itemSlot) + if trigger.use_showgcd then + WeakAuras.WatchGCD() end end, init = function(trigger) @@ -4860,8 +4944,8 @@ Private.event_prototypes = { local startTime, duration, enable, gcdCooldown = WeakAuras.GetItemSlotCooldown(%s, showgcd); local genericShowOn = %s local remaining = startTime + duration - GetTime(); - ]]; - if(trigger.use_remaining and trigger.genericShowOn ~= "showOnReady") then + ]] + if trigger.use_remaining and trigger.genericShowOn ~= "showOnReady" then local ret2 = [[ local expirationTime = startTime + duration local remaining = expirationTime > 0 and (expirationTime - GetTime()) or 0; @@ -4869,12 +4953,10 @@ Private.event_prototypes = { if(remaining >= remainingCheck and remaining > 0) then WeakAuras.ScheduleScan(expirationTime - remainingCheck); end - ]]; - ret = ret..ret2:format(tonumber(trigger.remaining or 0) or 0); + ]] + ret = ret .. ret2:format(tonumber(trigger.remaining or 0) or 0) end - return ret:format(trigger.use_showgcd and "true" or "false", - trigger.itemSlot or "0", - "[[" .. (trigger.genericShowOn or "") .. "]]"); + return ret:format(trigger.use_showgcd and "true" or "false", trigger.itemSlot or "0", "[[" .. (trigger.genericShowOn or "") .. "]]") end, statesParameter = "one", args = { @@ -4884,15 +4966,17 @@ Private.event_prototypes = { display = L["Equipment Slot"], type = "select", values = "item_slot_types", - test = "true" + test = "true", }, { name = "extra Cooldown Progress (Equipment Slot)", display = function(trigger) return function() - local text = ""; + local text = "" if trigger.use_showgcd then - if text ~= "" then text = text .. "; " end + if text ~= "" then + text = text .. "; " + end text = text .. L["Show GCD"] end if text == "" then @@ -4908,29 +4992,31 @@ Private.event_prototypes = { display = L["Show Global Cooldown"], type = "toggle", test = "true", - collapse = "extra Cooldown Progress (Equipment Slot)" + collapse = "extra Cooldown Progress (Equipment Slot)", }, { name = "remaining", display = L["Remaining Time"], type = "number", - enable = function(trigger) return (trigger.genericShowOn ~= "showOnReady") end, - init = "remaining" + enable = function(trigger) + return (trigger.genericShowOn ~= "showOnReady") + end, + init = "remaining", }, { name = "testForCooldown", display = L["is useable"], type = "toggle", - test = "enable == 1" + test = "enable == 1", }, { name = "genericShowOn", - display = L["Show"], + display = L["Show"], type = "select", values = "cooldown_progress_behavior_types", test = "true", required = true, - default = "showOnCooldown" + default = "showOnCooldown", }, { hidden = true, @@ -4939,43 +5025,43 @@ Private.event_prototypes = { display = L["On Cooldown"], conditionType = "bool", conditionTest = function(state, needle) - return state and state.show and (not state.gcdCooldown and state.expirationTime and state.expirationTime > GetTime()) == (needle == 1); + return state and state.show and (not state.gcdCooldown and state.expirationTime and state.expirationTime > GetTime()) == (needle == 1) end, }, { hidden = true, name = "gcdCooldown", store = true, - test = "true" + test = "true", }, { hidden = true, - test = "(genericShowOn == \"showOnReady\" and (startTime == 0 or gcdCooldown)) " .. - "or (genericShowOn == \"showOnCooldown\" and startTime > 0 and not gcdCooldown) " .. - "or (genericShowOn == \"showAlways\")" - } + test = "(genericShowOn == \"showOnReady\" and (startTime == 0 or gcdCooldown)) " + .. "or (genericShowOn == \"showOnCooldown\" and startTime > 0 and not gcdCooldown) " + .. "or (genericShowOn == \"showAlways\")", + }, }, durationFunc = function(trigger) - local startTime, duration = WeakAuras.GetItemSlotCooldown(trigger.itemSlot or 0, trigger.use_showgcd); - startTime = startTime or 0; - duration = duration or 0; - return duration, startTime + duration; + local startTime, duration = WeakAuras.GetItemSlotCooldown(trigger.itemSlot or 0, trigger.use_showgcd) + startTime = startTime or 0 + duration = duration or 0 + return duration, startTime + duration end, nameFunc = function(trigger) - local item = GetInventoryItemID("player", trigger.itemSlot or 0); - if (item) then - return GetItemInfo(item); + local item = GetInventoryItemID("player", trigger.itemSlot or 0) + if item then + return GetItemInfo(item) end end, stacksFunc = function(trigger) local count = GetInventoryItemCount("player", trigger.itemSlot or 0) - if ((count == 1) and (not GetInventoryItemTexture("player", trigger.itemSlot or 0))) then + if (count == 1) and (not GetInventoryItemTexture("player", trigger.itemSlot or 0)) then count = 0 end return count end, iconFunc = function(trigger) - return GetInventoryItemTexture("player", trigger.itemSlot or 0) or "Interface\\Icons\\INV_Misc_QuestionMark"; + return GetInventoryItemTexture("player", trigger.itemSlot or 0) or "Interface\\Icons\\INV_Misc_QuestionMark" end, automaticrequired = true, }, @@ -4987,11 +5073,11 @@ Private.event_prototypes = { }, name = L["Cooldown Ready Event (Item)"], loadFunc = function(trigger) - trigger.itemName = trigger.itemName or 0; - WeakAuras.WatchItemCooldown(trigger.itemName); + trigger.itemName = trigger.itemName or 0 + WeakAuras.WatchItemCooldown(trigger.itemName) end, init = function(trigger) - trigger.itemName = trigger.itemName or 0; + trigger.itemName = trigger.itemName or 0 end, args = { { @@ -4999,36 +5085,35 @@ Private.event_prototypes = { required = true, display = L["Item"], type = "item", - init = "arg" - } + init = "arg", + }, }, nameFunc = function(trigger) - local name = GetItemInfo(trigger.itemName or 0); - if(name) then - return name; + local name = GetItemInfo(trigger.itemName or 0) + if name then + return name else - return "Invalid"; + return "Invalid" end end, iconFunc = function(trigger) - local _, _, _, _, icon = GetItemInfoInstant(trigger.itemName or 0); - return icon; + local _, _, _, _, icon = GetItemInfoInstant(trigger.itemName or 0) + return icon end, hasItemID = true, - timedrequired = true + timedrequired = true, }, ["Cooldown Ready (Equipment Slot)"] = { type = "item", events = {}, internal_events = { - "ITEM_SLOT_COOLDOWN_READY" + "ITEM_SLOT_COOLDOWN_READY", }, name = L["Cooldown Ready Event (Slot)"], - loadFunc = function(trigger) - WeakAuras.WatchItemSlotCooldown(trigger.itemSlot); - end, - init = function(trigger) + loadFunc = function(trigger) + WeakAuras.WatchItemSlotCooldown(trigger.itemSlot) end, + init = function(trigger) end, args = { { name = "itemSlot", @@ -5036,27 +5121,27 @@ Private.event_prototypes = { display = L["Equipment Slot"], type = "select", values = "item_slot_types", - init = "arg" - } + init = "arg", + }, }, nameFunc = function(trigger) - local item = GetInventoryItemID("player", trigger.itemSlot or 0); - if (item) then + local item = GetInventoryItemID("player", trigger.itemSlot or 0) + if item then return GetItemInfo(item) else return "" end end, iconFunc = function(trigger) - return GetInventoryItemTexture("player", trigger.itemSlot or 0) or "Interface\\Icons\\INV_Misc_QuestionMark"; + return GetInventoryItemTexture("player", trigger.itemSlot or 0) or "Interface\\Icons\\INV_Misc_QuestionMark" end, hasItemID = true, - timedrequired = true + timedrequired = true, }, ["GTFO"] = { type = "addons", events = { - ["events"] = {"GTFO_DISPLAY"} + ["events"] = { "GTFO_DISPLAY" }, }, name = L["GTFO Alert"], statesParameter = "one", @@ -5068,21 +5153,21 @@ Private.event_prototypes = { init = "arg", values = "gtfo_types", store = true, - conditionType = "select" + conditionType = "select", }, }, - timedrequired = true + timedrequired = true, }, -- DBM events ["DBM Stage"] = { type = "addons", events = {}, internal_events = { - "DBM_SetStage" + "DBM_SetStage", }, name = L["DBM Stage"], init = function(trigger) - WeakAuras.RegisterDBMCallback("DBM_SetStage"); + WeakAuras.RegisterDBMCallback("DBM_SetStage") return "" end, args = { @@ -5112,13 +5197,13 @@ Private.event_prototypes = { type = "addons", events = {}, internal_events = { - "DBM_Announce" + "DBM_Announce", }, name = L["DBM Announce"], init = function(trigger) - WeakAuras.RegisterDBMCallback("DBM_Announce"); + WeakAuras.RegisterDBMCallback("DBM_Announce") local ret = "local use_cloneId = %s;" - return ret:format(trigger.use_cloneId and "true" or "false"); + return ret:format(trigger.use_cloneId and "true" or "false") end, statesParameter = "all", args = { @@ -5128,7 +5213,7 @@ Private.event_prototypes = { display = L["Message"], type = "longstring", store = true, - conditionType = "string" + conditionType = "string", }, { name = "name", @@ -5142,23 +5227,29 @@ Private.event_prototypes = { init = "arg", store = true, hidden = true, - test = "true" + test = "true", }, { name = "cloneId", display = L["Clone per Event"], type = "toggle", test = "true", - init = "use_cloneId and WeakAuras.GetUniqueCloneId() or ''" + init = "use_cloneId and WeakAuras.GetUniqueCloneId() or ''", }, }, - timedrequired = true + timedrequired = true, }, ["DBM Timer"] = { type = "addons", events = {}, internal_events = { - "DBM_TimerStart", "DBM_TimerStop", "DBM_TimerStopAll", "DBM_TimerUpdate", "DBM_TimerForce", "DBM_TimerResume", "DBM_TimerPause" + "DBM_TimerStart", + "DBM_TimerStop", + "DBM_TimerStopAll", + "DBM_TimerUpdate", + "DBM_TimerForce", + "DBM_TimerResume", + "DBM_TimerPause", }, force_events = "DBM_TimerForce", name = L["DBM Timer"], @@ -5309,14 +5400,14 @@ Private.event_prototypes = { display = L["Spell Id"], type = "string", store = true, - conditionType = "string" + conditionType = "string", }, { name = "message", display = L["Message"], type = "longstring", store = true, - conditionType = "string" + conditionType = "string", }, { name = "remaining", @@ -5341,13 +5432,13 @@ Private.event_prototypes = { type = "select", values = "dbm_types", conditionType = "select", - test = "true" + test = "true", }, { name = "cloneId", display = L["Clone per Event"], - type = "toggle" - } + type = "toggle", + }, }, automaticrequired = true, }, @@ -5356,11 +5447,11 @@ Private.event_prototypes = { type = "addons", events = {}, internal_events = { - "BigWigs_SetStage" + "BigWigs_SetStage", }, name = L["BigWigs Stage"], init = function(trigger) - WeakAuras.RegisterBigWigsCallback("BigWigs_SetStage"); + WeakAuras.RegisterBigWigsCallback("BigWigs_SetStage") return "" end, args = { @@ -5371,7 +5462,7 @@ Private.event_prototypes = { type = "number", conditionType = "number", store = true, - } + }, }, automaticrequired = true, statesParameter = "one", @@ -5380,13 +5471,13 @@ Private.event_prototypes = { type = "addons", events = {}, internal_events = { - "BigWigs_Message" + "BigWigs_Message", }, name = L["BigWigs Message"], init = function(trigger) - WeakAuras.RegisterBigWigsCallback("BigWigs_Message"); + WeakAuras.RegisterBigWigsCallback("BigWigs_Message") local ret = "local use_cloneId = %s;" - return ret:format(trigger.use_cloneId and "true" or "false"); + return ret:format(trigger.use_cloneId and "true" or "false") end, statesParameter = "all", args = { @@ -5394,13 +5485,13 @@ Private.event_prototypes = { name = "addon", init = "arg", display = L["BigWigs Addon"], - type = "string" + type = "string", }, { name = "spellId", init = "arg", display = L["Spell Id"], - type = "longstring" + type = "longstring", }, { name = "text", @@ -5408,14 +5499,14 @@ Private.event_prototypes = { display = L["Message"], type = "longstring", store = true, - conditionType = "string" + conditionType = "string", }, { name = "name", init = "text", hidden = true, test = "true", - store = true + store = true, }, {}, -- Importance, might be useful { @@ -5423,23 +5514,27 @@ Private.event_prototypes = { init = "arg", hidden = true, test = "true", - store = true + store = true, }, { name = "cloneId", display = L["Clone per Event"], type = "toggle", test = "true", - init = "use_cloneId and WeakAuras.GetUniqueCloneId() or ''" + init = "use_cloneId and WeakAuras.GetUniqueCloneId() or ''", }, }, - timedrequired = true + timedrequired = true, }, ["BigWigs Timer"] = { type = "addons", events = {}, internal_events = { - "BigWigs_StartBar", "BigWigs_StopBar", "BigWigs_Timer_Update", "BigWigs_PauseBar", "BigWigs_ResumeBar" + "BigWigs_StartBar", + "BigWigs_StopBar", + "BigWigs_Timer_Update", + "BigWigs_PauseBar", + "BigWigs_ResumeBar", }, force_events = "BigWigs_Timer_Force", name = L["BigWigs Timer"], @@ -5572,7 +5667,7 @@ Private.event_prototypes = { display = L["Message"], type = "longstring", store = true, - conditionType = "string" + conditionType = "string", }, { name = "remaining", @@ -5599,14 +5694,14 @@ Private.event_prototypes = { type = "tristate", test = "true", init = "false", - conditionType = "bool" + conditionType = "bool", }, { name = "cloneId", display = L["Clone per Event"], type = "toggle", test = "true", - init = "false" + init = "false", }, }, automaticrequired = true, @@ -5619,44 +5714,44 @@ Private.event_prototypes = { "GCD_CHANGE", "GCD_END", "GCD_UPDATE", - "WA_DELAYED_PLAYER_ENTERING_WORLD" + "WA_DELAYED_PLAYER_ENTERING_WORLD", }, force_events = "GCD_UPDATE", name = L["Global Cooldown"], loadFunc = function(trigger) - WeakAuras.WatchGCD(); + WeakAuras.WatchGCD() end, init = function(trigger) local ret = [[ local inverse = %s; local onGCD = WeakAuras.GetGCDInfo(); local hasSpellName = WeakAuras.GcdSpellName(); - ]]; - return ret:format(trigger.use_inverse and "true" or "false"); + ]] + return ret:format(trigger.use_inverse and "true" or "false") end, args = { { name = "inverse", display = L["Inverse"], type = "toggle", - test = "true" + test = "true", }, { hidden = true, - test = "(inverse and onGCD == 0) or (not inverse and onGCD > 0 and hasSpellName)" - } + test = "(inverse and onGCD == 0) or (not inverse and onGCD > 0 and hasSpellName)", + }, }, durationFunc = function(trigger) - local duration, expirationTime = WeakAuras.GetGCDInfo(); - return duration, expirationTime; + local duration, expirationTime = WeakAuras.GetGCDInfo() + return duration, expirationTime end, nameFunc = function(trigger) - local _, _, name = WeakAuras.GetGCDInfo(); - return name; + local _, _, name = WeakAuras.GetGCDInfo() + return name end, iconFunc = function(trigger) - local _, _, _, icon = WeakAuras.GetGCDInfo(); - return icon; + local _, _, _, icon = WeakAuras.GetGCDInfo() + return icon end, hasSpellID = true, automaticrequired = true, @@ -5665,12 +5760,12 @@ Private.event_prototypes = { type = "unit", events = {}, internal_events = { - "SWING_TIMER_UPDATE" + "SWING_TIMER_UPDATE", }, force_events = "SWING_TIMER_UPDATE", name = L["Swing Timer"], loadFunc = function() - WeakAuras.InitSwingTimer(); + WeakAuras.InitSwingTimer() end, init = function(trigger) local ret = [=[ @@ -5684,13 +5779,13 @@ Private.event_prototypes = { if triggerRemaining and remaining and remaining >= triggerRemaining and remaining > 0 then WeakAuras.ScheduleScan(expirationTime - triggerRemaining, "SWING_TIMER_UPDATE") end - ]=]; + ]=] return ret:format( (trigger.use_inverse and "true" or "false"), trigger.hand or "main", trigger.use_remaining and tonumber(trigger.remaining or 0) or "nil", trigger.remaining_operator or "<" - ); + ) end, args = { { @@ -5702,7 +5797,6 @@ Private.event_prototypes = { return L["Note: Due to how complicated the swing timer behavior is and the lack of APIs from Blizzard, results are inaccurate in edge cases."] end end, - }, { name = "hand", @@ -5710,68 +5804,70 @@ Private.event_prototypes = { display = L["Weapon"], type = "select", values = "swing_types", - test = "true" + test = "true", }, { name = "duration", hidden = true, init = "duration", test = "true", - store = true + store = true, }, { name = "expirationTime", init = "expirationTime", hidden = true, test = "true", - store = true + store = true, }, { name = "progressType", hidden = true, init = "'timed'", test = "true", - store = true + store = true, }, { name = "name", hidden = true, init = "spell", test = "true", - store = true + store = true, }, { name = "icon", hidden = true, init = "icon or 'Interface\\AddOns\\WeakAuras\\Media\\Textures\\icon'", test = "true", - store = true + store = true, }, { name = "remaining", display = L["Remaining Time"], type = "number", - enable = function(trigger) return not trigger.use_inverse end, - test = "true" + enable = function(trigger) + return not trigger.use_inverse + end, + test = "true", }, { name = "inverse", display = L["Inverse"], type = "toggle", - test = "true" + test = "true", }, { hidden = true, - test = "(inverse and duration == 0) or (not inverse and duration > 0)" + test = "(inverse and duration == 0) or (not inverse and duration > 0)", }, { hidden = true, - test = "remainingCheck" - } + test = "remainingCheck", + }, }, automaticrequired = true, canHaveDuration = true, - statesParameter = "one" + statesParameter = "one", }, ["Action Usable"] = { type = "spell", @@ -5788,8 +5884,8 @@ Private.event_prototypes = { return { ["events"] = events, ["unit_events"] = { - ["player"] = { "UNIT_POWER_FREQUENT" } - } + ["player"] = { "UNIT_POWER_FREQUENT" }, + }, } end, internal_events = { @@ -5799,25 +5895,25 @@ Private.event_prototypes = { name = L["Action Usable"], statesParameter = "one", loadFunc = function(trigger) - trigger.spellName = trigger.spellName or 0; - local spellName; - if (trigger.use_exact_spellName) then - spellName = trigger.spellName; + trigger.spellName = trigger.spellName or 0 + local spellName + if trigger.use_exact_spellName then + spellName = trigger.spellName else - spellName = type(trigger.spellName) == "number" and GetSpellInfo(trigger.spellName) or trigger.spellName; + spellName = type(trigger.spellName) == "number" and GetSpellInfo(trigger.spellName) or trigger.spellName end - trigger.realSpellName = spellName; -- Cache - WeakAuras.WatchSpellCooldown(spellName); + trigger.realSpellName = spellName -- Cache + WeakAuras.WatchSpellCooldown(spellName) end, init = function(trigger) - trigger.spellName = trigger.spellName or 0; - local spellName; - if (trigger.use_exact_spellName) then - spellName = trigger.spellName; + trigger.spellName = trigger.spellName or 0 + local spellName + if trigger.use_exact_spellName then + spellName = trigger.spellName else - spellName = type(trigger.spellName) == "number" and GetSpellInfo(trigger.spellName) or trigger.spellName; + spellName = type(trigger.spellName) == "number" and GetSpellInfo(trigger.spellName) or trigger.spellName end - trigger.realSpellName = spellName; -- Cache + trigger.realSpellName = spellName -- Cache local ret = [=[ local spellName = %s local startTime, duration, gcdCooldown, readyTime = WeakAuras.GetSpellCooldown(spellName); @@ -5828,15 +5924,15 @@ Private.event_prototypes = { local ready = startTime == 0 or charges > 0 local active = IsUsableSpell(spellName) and ready ]=] - if(trigger.use_targetRequired) then - ret = ret.."active = active and WeakAuras.IsSpellInRange(spellName or '', 'target')\n"; + if trigger.use_targetRequired then + ret = ret .. "active = active and WeakAuras.IsSpellInRange(spellName or '', 'target')\n" end - if(trigger.use_inverse) then - ret = ret.."active = not active\n"; + if trigger.use_inverse then + ret = ret .. "active = not active\n" end - if (type(spellName) == "string") then - spellName = "[[" .. spellName .. "]]"; + if type(spellName) == "string" then + spellName = "[[" .. spellName .. "]]" end return ret:format(spellName) @@ -5849,7 +5945,7 @@ Private.event_prototypes = { type = "spell", test = "true", showExactOption = true, - store = true + store = true, }, -- This parameter uses the IsSpellInRange API function, but it does not check spell range at all -- IsSpellInRange returns nil for invalid targets, 0 for out of range, 1 for in range (0 and 1 are both "positive" values) @@ -5857,23 +5953,27 @@ Private.event_prototypes = { name = "targetRequired", display = L["Require Valid Target"], type = "toggle", - test = "true" + test = "true", }, { name = "charges", display = L["Charges"], type = "number", - enable = function(trigger) return not(trigger.use_inverse) end, + enable = function(trigger) + return not trigger.use_inverse + end, store = true, - conditionType = "number" + conditionType = "number", }, { name = "spellCount", display = L["Spell Count"], type = "number", - enable = function(trigger) return not(trigger.use_inverse) end, + enable = function(trigger) + return not trigger.use_inverse + end, store = true, - conditionType = "number" + conditionType = "number", }, { hidden = true, @@ -5881,7 +5981,7 @@ Private.event_prototypes = { display = L["Since Ready"], conditionType = "elapsedTimer", store = true, - test = "true" + test = "true", }, { hidden = true, @@ -5889,7 +5989,7 @@ Private.event_prototypes = { display = L["Since Charge Gain"], conditionType = "elapsedTimer", store = true, - test = "true" + test = "true", }, { hidden = true, @@ -5897,14 +5997,14 @@ Private.event_prototypes = { display = L["Since Charge Lost"], conditionType = "elapsedTimer", store = true, - test = "true" + test = "true", }, { name = "inverse", display = L["Inverse"], type = "toggle", test = "true", - reloadOptions = true + reloadOptions = true, }, { name = "spellInRange", @@ -5913,38 +6013,38 @@ Private.event_prototypes = { test = "true", conditionType = "bool", conditionTest = function(state, needle) - return state and state.show and (UnitExists('target') and state.spellName and WeakAuras.IsSpellInRange(state.spellName, 'target') == needle) + return state and state.show and (UnitExists("target") and state.spellName and WeakAuras.IsSpellInRange(state.spellName, "target") == needle) end, conditionEvents = { "PLAYER_TARGET_CHANGED", "WA_SPELL_RANGECHECK", - } + }, }, { hidden = true, - test = "active" - } + test = "active", + }, }, nameFunc = function(trigger) - local name = GetSpellInfo(trigger.realSpellName or 0); - if(name) then - return name; + local name = GetSpellInfo(trigger.realSpellName or 0) + if name then + return name end - name = GetSpellInfo(trigger.spellName or 0); - if (name) then - return name; + name = GetSpellInfo(trigger.spellName or 0) + if name then + return name end - return "Invalid"; + return "Invalid" end, iconFunc = function(trigger) - local _, _, icon = GetSpellInfo(trigger.realSpellName or 0); - if (not icon) then - icon = select(3, GetSpellInfo(trigger.spellName or 0)); + local _, _, icon = GetSpellInfo(trigger.realSpellName or 0) + if not icon then + icon = select(3, GetSpellInfo(trigger.spellName or 0)) end - return icon; + return icon end, stacksFunc = function(trigger) - local charges, maxCharges, spellCount = WeakAuras.GetSpellCharges(trigger.realSpellName); + local charges, maxCharges, spellCount = WeakAuras.GetSpellCharges(trigger.realSpellName) if maxCharges and maxCharges > 1 then return charges elseif spellCount and spellCount > 0 then @@ -5952,7 +6052,7 @@ Private.event_prototypes = { end end, hasSpellID = true, - automaticrequired = true + automaticrequired = true, }, ["Talent Known"] = { type = "unit", @@ -5961,28 +6061,28 @@ Private.event_prototypes = { if WeakAuras.IsClassicOrBCCOrWrath() then events = { "CHARACTER_POINTS_CHANGED", - "SPELLS_CHANGED" + "SPELLS_CHANGED", } elseif WeakAuras.IsWrathClassic() then events = { "CHARACTER_POINTS_CHANGED", "SPELLS_CHANGED", - "PLAYER_TALENT_UPDATE" + "PLAYER_TALENT_UPDATE", } else events = { "PLAYER_TALENT_UPDATE" } end return { - ["events"] = events + ["events"] = events, } end, force_events = WeakAuras.IsRetail() and "PLAYER_TALENT_UPDATE" or "CHARACTER_POINTS_CHANGED", name = L["Talent Known"], init = function(trigger) - local inverse = trigger.use_inverse; - if (trigger.use_talent) then + local inverse = trigger.use_inverse + if trigger.use_talent then -- Single selection - local index = trigger.talent and trigger.talent.single; + local index = trigger.talent and trigger.talent.single local tier, column if WeakAuras.IsClassicOrBCCOrWrath() then tier = index and ceil(index / MAX_NUM_TALENTS) @@ -6004,27 +6104,29 @@ Private.event_prototypes = { ]] else if trigger.use_onlySelected then - ret = ret .. [[ + ret = ret + .. [[ local active, _, activeName, activeIcon, selected, known _, activeName, activeIcon, selected, _, _, _, _, _, _, known = GetTalentInfo(tier, column, 1) active = selected ]] else - ret = ret .. [[ + ret = ret + .. [[ local active, _, activeName, activeIcon, selected, known _, activeName, activeIcon, selected, _, _, _, _, _, _, known = GetTalentInfo(tier, column, 1) active = selected or known ]] end end - if (inverse) then + if inverse then ret = ret .. [[ active = not (active); ]] end return ret:format(tier or 0, column or 0) - elseif (trigger.use_talent == false) then - if (trigger.talent.multi) then + elseif trigger.use_talent == false then + if trigger.talent.multi then local ret = [[ local tier local column @@ -6047,7 +6149,8 @@ Private.event_prototypes = { column = %s ]] if WeakAuras.IsClassicOrBCCOrWrath() then - ret2 = ret2 .. [[ + ret2 = ret2 + .. [[ local name, icon, _, _, rank = GetTalentInfo(tier, column) if rank > 0 then active = true; @@ -6057,7 +6160,8 @@ Private.event_prototypes = { ]] else if trigger.use_onlySelected then - ret2 = ret2 .. [[ + ret2 = ret2 + .. [[ local _, name, icon, selected, _, _, _, _, _, _, known = GetTalentInfo(tier, column, 1) if (selected) then active = true; @@ -6066,7 +6170,8 @@ Private.event_prototypes = { end ]] else - ret2 = ret2 .. [[ + ret2 = ret2 + .. [[ local _, name, icon, selected, _, _, _, _, _, _, known = GetTalentInfo(tier, column, 1) if (selected or known) then active = true; @@ -6079,17 +6184,17 @@ Private.event_prototypes = { ret2 = ret2 .. [[ end ]] - ret = ret .. ret2:format(tier, column); + ret = ret .. ret2:format(tier, column) end - if (inverse) then + if inverse then ret = ret .. [[ active = not (active); ]] end - return ret; + return ret end end - return ""; + return "" end, args = { { @@ -6097,14 +6202,14 @@ Private.event_prototypes = { display = L["Talent"], type = "multiselect", values = function() - local class = select(2, UnitClass("player")); - local spec = WeakAuras.IsRetail() and GetSpecialization(); - if(Private.talent_types_specific[class] and Private.talent_types_specific[class][spec]) then - return Private.talent_types_specific[class][spec]; + local class = select(2, UnitClass("player")) + local spec = WeakAuras.IsRetail() and GetSpecialization() + if Private.talent_types_specific[class] and Private.talent_types_specific[class][spec] then + return Private.talent_types_specific[class][spec] elseif not WeakAuras.IsRetail() and Private.talent_types_specific[class] then - return Private.talent_types_specific[class]; + return Private.talent_types_specific[class] else - return Private.talent_types; + return Private.talent_types end end, test = "active", @@ -6121,21 +6226,21 @@ Private.event_prototypes = { name = "inverse", display = L["Inverse"], type = "toggle", - test = "true" + test = "true", }, { hidden = true, name = "icon", init = "activeIcon", store = "true", - test = "true" + test = "true", }, { hidden = true, name = "name", init = "activeName", store = "true", - test = "true" + test = "true", }, }, automaticrequired = true, @@ -6145,16 +6250,16 @@ Private.event_prototypes = { type = "unit", events = function() return { - ["events"] = { "PLAYER_PVP_TALENT_UPDATE" } + ["events"] = { "PLAYER_PVP_TALENT_UPDATE" }, } end, force_events = "PLAYER_PVP_TALENT_UPDATE", name = L["PvP Talent Selected"], init = function(trigger) - local inverse = trigger.use_inverse; - if (trigger.use_talent) then + local inverse = trigger.use_inverse + if trigger.use_talent then -- Single selection - local index = trigger.talent and trigger.talent.single; + local index = trigger.talent and trigger.talent.single local ret = [[ local index = %s local activeName, activeIcon, _ @@ -6164,14 +6269,14 @@ Private.event_prototypes = { _, activeName, activeIcon = GetPvpTalentInfoByID(talentId) end ]] - if (inverse) then + if inverse then ret = ret .. [[ active = not (active); ]] end return ret:format(index or 0) - elseif (trigger.use_talent == false) then - if (trigger.talent.multi) then + elseif trigger.use_talent == false then + if trigger.talent.multi then local ret = [[ local active = false; local activeIcon; @@ -6191,15 +6296,15 @@ Private.event_prototypes = { ]] ret = ret .. ret2:format(index) end - if (inverse) then + if inverse then ret = ret .. [[ active = not (active); ]] end - return ret; + return ret end end - return ""; + return "" end, args = { { @@ -6207,12 +6312,12 @@ Private.event_prototypes = { display = L["Talent selected"], type = "multiselect", values = function() - local class = select(2, UnitClass("player")); - local spec = GetSpecialization(); - if(Private.pvp_talent_types_specific[class] and Private.pvp_talent_types_specific[class][spec]) then - return Private.pvp_talent_types_specific[class][spec]; + local class = select(2, UnitClass("player")) + local spec = GetSpecialization() + if Private.pvp_talent_types_specific[class] and Private.pvp_talent_types_specific[class][spec] then + return Private.pvp_talent_types_specific[class][spec] else - return Private.pvp_talent_types; + return Private.pvp_talent_types end end, test = "active", @@ -6221,21 +6326,21 @@ Private.event_prototypes = { name = "inverse", display = L["Inverse"], type = "toggle", - test = "true" + test = "true", }, { hidden = true, name = "icon", init = "activeIcon", store = "true", - test = "true" + test = "true", }, { hidden = true, name = "name", init = "activeName", store = "true", - test = "true" + test = "true", }, }, automaticrequired = true, @@ -6246,7 +6351,7 @@ Private.event_prototypes = { events = function() local events = { "PLAYER_TALENT_UPDATE" } return { - ["events"] = events + ["events"] = events, } end, force_events = "PLAYER_TALENT_UPDATE", @@ -6268,14 +6373,14 @@ Private.event_prototypes = { name = "icon", init = "specIcon", store = "true", - test = "true" + test = "true", }, { hidden = true, name = "name", init = "specName", store = "true", - test = "true" + test = "true", }, }, automaticrequired = true, @@ -6286,8 +6391,8 @@ Private.event_prototypes = { events = { ["events"] = { "PLAYER_TOTEM_UPDATE", - "PLAYER_ENTERING_WORLD" - } + "PLAYER_ENTERING_WORLD", + }, }, internal_events = { "COOLDOWN_REMAINING_CHECK", @@ -6401,31 +6506,33 @@ Private.event_prototypes = { end return true; end - ]]; - local totemName = tonumber(trigger.totemName) and GetSpellInfo(tonumber(trigger.totemName)) or trigger.totemName; - ret = ret:format(trigger.use_totemType and tonumber(trigger.totemType) or "nil", + ]] + local totemName = tonumber(trigger.totemName) and GetSpellInfo(tonumber(trigger.totemName)) or trigger.totemName + ret = ret:format( + trigger.use_totemType and tonumber(trigger.totemType) or "nil", trigger.use_totemName and totemName or "", trigger.use_totemNamePattern and trigger.totemNamePattern or "", trigger.use_totemNamePattern and trigger.totemNamePattern_operator or "", trigger.use_clones and "true" or "false", trigger.use_inverse and "true" or "false", trigger.use_remaining and trigger.remaining or "nil", - trigger.use_remaining and trigger.remaining_operator or "<"); - return ret; + trigger.use_remaining and trigger.remaining_operator or "<" + ) + return ret end, args = { { name = "totemType", display = L["Totem Number"], type = "select", - values = "totem_types" + values = "totem_types", }, { name = "totemName", display = L["Totem Name"], type = "string", conditionType = "string", - store = true + store = true, }, { name = "totemNamePattern", @@ -6437,23 +6544,29 @@ Private.event_prototypes = { display = L["Clone per Match"], type = "toggle", test = "true", - enable = function(trigger) return not trigger.use_totemType end, + enable = function(trigger) + return not trigger.use_totemType + end, }, { name = "remaining", display = L["Remaining Time"], type = "number", - enable = function(trigger) return not(trigger.use_inverse) end + enable = function(trigger) + return not trigger.use_inverse + end, }, { name = "inverse", display = L["Inverse"], type = "toggle", test = "true", - enable = function(trigger) return (trigger.use_totemName or trigger.use_totemNamePattern) and not trigger.use_clones end - } + enable = function(trigger) + return (trigger.use_totemName or trigger.use_totemNamePattern) and not trigger.use_clones + end, + }, }, - automaticrequired = true + automaticrequired = true, }, ["Item Count"] = { type = "item", @@ -6461,8 +6574,8 @@ Private.event_prototypes = { ["events"] = { "BAG_UPDATE", "BAG_UPDATE_COOLDOWN", - "PLAYER_ENTERING_WORLD" - } + "PLAYER_ENTERING_WORLD", + }, }, internal_events = { "ITEM_COUNT_UPDATE", @@ -6470,17 +6583,17 @@ Private.event_prototypes = { force_events = "BAG_UPDATE", name = L["Item Count"], loadFunc = function(trigger) - if(trigger.use_includeCharges) then - WeakAuras.RegisterItemCountWatch(); + if trigger.use_includeCharges then + WeakAuras.RegisterItemCountWatch() end end, init = function(trigger) - trigger.itemName = trigger.itemName or 0; - local itemName = type(trigger.itemName) == "number" and trigger.itemName or "[["..trigger.itemName.."]]"; + trigger.itemName = trigger.itemName or 0 + local itemName = type(trigger.itemName) == "number" and trigger.itemName or "[[" .. trigger.itemName .. "]]" local ret = [[ local count = GetItemCount(%s, %s, %s); - ]]; - return ret:format(itemName, trigger.use_includeBank and "true" or "nil", trigger.use_includeCharges and "true" or "nil"); + ]] + return ret:format(itemName, trigger.use_includeBank and "true" or "nil", trigger.use_includeCharges and "true" or "nil") end, args = { { @@ -6488,56 +6601,56 @@ Private.event_prototypes = { required = true, display = L["Item"], type = "item", - test = "true" + test = "true", }, { name = "includeBank", display = L["Include Bank"], type = "toggle", - test = "true" + test = "true", }, { name = "includeCharges", display = L["Include Charges"], type = "toggle", - test = "true" + test = "true", }, { name = "count", display = L["Item Count"], - type = "number" - } + type = "number", + }, }, durationFunc = function(trigger) - local count = GetItemCount(trigger.itemName, trigger.use_includeBank, trigger.use_includeCharges); - return count, 0, true; + local count = GetItemCount(trigger.itemName, trigger.use_includeBank, trigger.use_includeCharges) + return count, 0, true end, stacksFunc = function(trigger) - local count = GetItemCount(trigger.itemName, trigger.use_includeBank, trigger.use_includeCharges); - return count, 0, true; + local count = GetItemCount(trigger.itemName, trigger.use_includeBank, trigger.use_includeCharges) + return count, 0, true end, nameFunc = function(trigger) - return C_Item.GetItemNameByID(trigger.itemName) or trigger.itemName; + return C_Item.GetItemNameByID(trigger.itemName) or trigger.itemName end, iconFunc = function(trigger) - return GetItemIcon(trigger.itemName); + return GetItemIcon(trigger.itemName) end, hasItemID = true, - automaticrequired = true + automaticrequired = true, }, ["Stance/Form/Aura"] = { type = "unit", events = { ["events"] = { "UPDATE_SHAPESHIFT_FORM", - "UPDATE_SHAPESHIFT_COOLDOWN" - } + "UPDATE_SHAPESHIFT_COOLDOWN", + }, }, internal_events = { "WA_DELAYED_PLAYER_ENTERING_WORLD" }, force_events = "WA_DELAYED_PLAYER_ENTERING_WORLD", name = L["Stance/Form/Aura"], init = function(trigger) - local inverse = trigger.use_inverse; + local inverse = trigger.use_inverse local ret = [[ local form = GetShapeshiftForm() local active = false @@ -6586,31 +6699,33 @@ Private.event_prototypes = { values = "form_types", test = "active", store = true, - conditionType = "select" + conditionType = "select", }, { name = "inverse", display = L["Inverse"], type = "toggle", test = "true", - enable = function(trigger) return type(trigger.use_form) == "boolean" end + enable = function(trigger) + return type(trigger.use_form) == "boolean" + end, }, }, nameFunc = function(trigger) - local _, class = UnitClass("player"); + local _, class = UnitClass("player") local name - if(class == trigger.class) then - local form = GetShapeshiftForm(); + if class == trigger.class then + local form = GetShapeshiftForm() if form > 0 then - local _, name = GetShapeshiftFormInfo(form); + local _, name = GetShapeshiftFormInfo(form) else - name = "Humanoid"; + name = "Humanoid" end - return name; + return name else - local types = WeakAuras[class:lower().."_form_types"]; - if(types) then - return types[GetShapeshiftForm()]; + local types = WeakAuras[class:lower() .. "_form_types"] + if types then + return types[GetShapeshiftForm()] end end end, @@ -6618,11 +6733,11 @@ Private.event_prototypes = { local icon = "136116" local form = GetShapeshiftForm() if form and form > 0 then - icon = GetShapeshiftFormInfo(form); + icon = GetShapeshiftFormInfo(form) end return icon or "136116" end, - automaticrequired = true + automaticrequired = true, }, ["Weapon Enchant"] = { type = "item", @@ -6633,7 +6748,7 @@ Private.event_prototypes = { force_events = "TENCH_UPDATE", name = WeakAuras.IsRetail() and L["Weapon Enchant / Fishing Lure"] or L["Weapon Enchant"], init = function(trigger) - WeakAuras.TenchInit(); + WeakAuras.TenchInit() local ret = [[ local triggerWeaponType = %q @@ -6665,17 +6780,19 @@ Private.event_prototypes = { duration = nil remaining = nil end - ]]; + ]] - local showOnActive = trigger.showOn == 'showOnActive' or not trigger.showOn + local showOnActive = trigger.showOn == "showOnActive" or not trigger.showOn - return ret:format(trigger.weapon or "main", - trigger.use_enchant and trigger.enchant or "", - showOnActive and trigger.use_stack and tonumber(trigger.stack or 0) or "nil", - showOnActive and trigger.use_remaining and tonumber(trigger.remaining or 0) or "nil", - trigger.showOn or "showOnActive", - trigger.stack_operator or "<", - trigger.remaining_operator or "<") + return ret:format( + trigger.weapon or "main", + trigger.use_enchant and trigger.enchant or "", + showOnActive and trigger.use_stack and tonumber(trigger.stack or 0) or "nil", + showOnActive and trigger.use_remaining and tonumber(trigger.remaining or 0) or "nil", + trigger.showOn or "showOnActive", + trigger.stack_operator or "<", + trigger.remaining_operator or "<" + ) end, args = { { @@ -6685,14 +6802,14 @@ Private.event_prototypes = { values = "weapon_types", test = "true", default = "main", - required = true + required = true, }, { name = "enchant", display = L["Weapon Enchant"], desc = L["Enchant Name or ID"], type = "string", - test = "true" + test = "true", }, { name = "stacks", @@ -6703,42 +6820,42 @@ Private.event_prototypes = { return not WeakAuras.IsRetail() and (not trigger.showOn or trigger.showOn == "showOnActive") end, hidden = WeakAuras.IsRetail(), - store = true + store = true, }, { name = "duration", hidden = true, init = "duration", test = "true", - store = true + store = true, }, { name = "expirationTime", init = "expirationTime", hidden = true, test = "true", - store = true + store = true, }, { name = "progressType", hidden = true, init = "duration and 'timed'", test = "true", - store = true + store = true, }, { name = "name", hidden = true, init = "name", test = "true", - store = true + store = true, }, { name = "icon", hidden = true, init = "icon or 'Interface\\AddOns\\WeakAuras\\Media\\Textures\\icon'", test = "true", - store = true + store = true, }, { name = "enchanted", @@ -6759,27 +6876,25 @@ Private.event_prototypes = { test = "true", enable = function(trigger) return not trigger.showOn or trigger.showOn == "showOnActive" - end + end, }, { name = "showOn", display = L["Show On"], type = "select", values = "weapon_enchant_types", - test = 'true', + test = "true", default = "showOnActive", - required = true + required = true, }, { hidden = true, - test = "(triggerShowOn == 'showOnActive' and found) " .. - "or (triggerShowOn == 'showOnMissing' and not found) " .. - "or (triggerShowOn == 'showAlways')" - } + test = "(triggerShowOn == 'showOnActive' and found) " .. "or (triggerShowOn == 'showOnMissing' and not found) " .. "or (triggerShowOn == 'showAlways')", + }, }, automaticrequired = true, canHaveDuration = true, - statesParameter = "one" + statesParameter = "one", }, ["Chat Message"] = { type = "event", @@ -6811,8 +6926,8 @@ Private.event_prototypes = { "CHAT_MSG_WHISPER", "CHAT_MSG_YELL", "CHAT_MSG_SYSTEM", - "CHAT_MSG_TEXT_EMOTE" - } + "CHAT_MSG_TEXT_EMOTE", + }, }, name = L["Chat Message"], init = function(trigger) @@ -6824,8 +6939,8 @@ Private.event_prototypes = { event = 'CHAT_MSG_EMOTE'; end local use_cloneId = %s; - ]]; - return ret:format(trigger.use_cloneId and "true" or "false"); + ]] + return ret:format(trigger.use_cloneId and "true" or "false") end, statesParameter = "all", args = { @@ -6835,7 +6950,7 @@ Private.event_prototypes = { type = "select", values = "chat_message_types", test = "event == %q", - control = "WeakAurasSortedDropdown" + control = "WeakAurasSortedDropdown", }, { name = "message", @@ -6871,15 +6986,15 @@ Private.event_prototypes = { type = "toggle", test = "true", init = "use_cloneId and WeakAuras.GetUniqueCloneId() or ''", - reloadOptions = true + reloadOptions = true, }, }, - timedrequired = true + timedrequired = true, }, ["Spell Cast Succeeded"] = { type = "event", events = { - ["events"] = {"UNIT_SPELLCAST_SUCCEEDED"} + ["events"] = { "UNIT_SPELLCAST_SUCCEEDED" }, }, name = L["Spell Cast Succeeded"], statesParameter = "one", @@ -6894,8 +7009,8 @@ Private.event_prototypes = { store = true, conditionType = "select", conditionTest = function(state, needle, op) - return state and state.show and (UnitIsUnit(needle, state.unit or '') == (op == "==")) - end + return state and state.show and (UnitIsUnit(needle, state.unit or "") == (op == "==")) + end, }, {}, -- castGUID { @@ -6904,7 +7019,7 @@ Private.event_prototypes = { type = "string", init = "arg", store = true, - conditionType = "number" + conditionType = "number", }, { @@ -6912,27 +7027,27 @@ Private.event_prototypes = { hidden = true, init = "select(3, GetSpellInfo(spellId))", store = true, - test = "true" + test = "true", }, }, - timedrequired = true + timedrequired = true, }, ["Ready Check"] = { type = "event", events = { - ["events"] = {"READY_CHECK"} + ["events"] = { "READY_CHECK" }, }, name = L["Ready Check"], args = {}, - timedrequired = true + timedrequired = true, }, ["Combat Events"] = { type = "event", events = { ["events"] = { "PLAYER_REGEN_ENABLED", - "PLAYER_REGEN_DISABLED" - } + "PLAYER_REGEN_DISABLED", + }, }, name = L["Entering/Leaving Combat"], args = { @@ -6942,16 +7057,16 @@ Private.event_prototypes = { display = L["Type"], type = "select", values = "combat_event_type", - test = "event == %q" - } + test = "event == %q", + }, }, - timedrequired = true + timedrequired = true, }, ["Death Knight Rune"] = { type = "unit", events = function() if WeakAuras.IsWrathClassic() then - return { events = { "RUNE_POWER_UPDATE", "RUNE_TYPE_UPDATE"} } + return { events = { "RUNE_POWER_UPDATE", "RUNE_TYPE_UPDATE" } } else return { events = { "RUNE_POWER_UPDATE" } } end @@ -6961,22 +7076,22 @@ Private.event_prototypes = { "RUNE_COOLDOWN_CHANGED", "RUNE_COOLDOWN_STARTED", "COOLDOWN_REMAINING_CHECK", - "WA_DELAYED_PLAYER_ENTERING_WORLD" + "WA_DELAYED_PLAYER_ENTERING_WORLD", }, force_events = "RUNE_COOLDOWN_FORCE", name = L["Death Knight Rune"], loadFunc = function(trigger) - trigger.rune = trigger.rune or 0; - if (trigger.use_rune) then - WeakAuras.WatchRuneCooldown(trigger.rune); + trigger.rune = trigger.rune or 0 + if trigger.use_rune then + WeakAuras.WatchRuneCooldown(trigger.rune) else for i = 1, 6 do - WeakAuras.WatchRuneCooldown(i); + WeakAuras.WatchRuneCooldown(i) end end end, init = function(trigger) - trigger.rune = trigger.rune or 0; + trigger.rune = trigger.rune or 0 local ret if WeakAuras.IsWrathClassic() then ret = [[ @@ -7011,7 +7126,7 @@ Private.event_prototypes = { numUnholyRunes = numUnholyRunes + numDeathRunes; numFrostRunes = numFrostRunes + numDeathRunes; end - ]]; + ]] else ret = [[ local rune = %s; @@ -7024,7 +7139,7 @@ Private.event_prototypes = { numRunes = numRunes + 1; end end - ]]; + ]] end if trigger.use_remaining then local ret2 = [[ @@ -7034,20 +7149,13 @@ Private.event_prototypes = { if(remaining >= remainingCheck and remaining > 0) then WeakAuras.ScheduleScan(expirationTime - remainingCheck); end - ]]; - ret = ret..ret2:format(tonumber(trigger.remaining or 0) or 0); + ]] + ret = ret .. ret2:format(tonumber(trigger.remaining or 0) or 0) end if WeakAuras.IsWrathClassic() then - return ret:format( - trigger.rune, - "[[" .. (trigger.genericShowOn or "") .. "]]", - (trigger.use_includeDeathRunes and "true" or "false") - ); + return ret:format(trigger.rune, "[[" .. (trigger.genericShowOn or "") .. "]]", (trigger.use_includeDeathRunes and "true" or "false")) else - return ret:format( - trigger.rune, - "[[" .. (trigger.genericShowOn or "") .. "]]" - ); + return ret:format(trigger.rune, "[[" .. (trigger.genericShowOn or "") .. "]]") end end, statesParameter = "one", @@ -7057,10 +7165,10 @@ Private.event_prototypes = { display = L["Rune"], type = "select", values = "rune_specific_types", - test = "(genericShowOn == \"showOnReady\" and (startTime == 0)) " .. - "or (genericShowOn == \"showOnCooldown\" and startTime > 0) " .. - "or (genericShowOn == \"showAlways\")", - reloadOptions = true + test = "(genericShowOn == \"showOnReady\" and (startTime == 0)) " + .. "or (genericShowOn == \"showOnCooldown\" and startTime > 0) " + .. "or (genericShowOn == \"showAlways\")", + reloadOptions = true, }, { name = "isDeathRune", @@ -7069,30 +7177,38 @@ Private.event_prototypes = { init = "isDeathRune", store = true, conditionType = "bool", - enable = function(trigger) return WeakAuras.IsWrathClassic() and trigger.use_rune end, - hidden = not WeakAuras.IsWrathClassic() + enable = function(trigger) + return WeakAuras.IsWrathClassic() and trigger.use_rune + end, + hidden = not WeakAuras.IsWrathClassic(), }, { name = "remaining", display = L["Remaining Time"], type = "number", - enable = function(trigger) return trigger.use_rune and not(trigger.genericShowOn == "showOnReady") end + enable = function(trigger) + return trigger.use_rune and not (trigger.genericShowOn == "showOnReady") + end, }, { name = "genericShowOn", - display = L["Show"], + display = L["Show"], type = "select", values = "cooldown_progress_behavior_types", test = "true", - enable = function(trigger) return trigger.use_rune end, - required = true + enable = function(trigger) + return trigger.use_rune + end, + required = true, }, { name = "runesCount", display = L["Rune Count"], type = "number", init = "numRunes", - enable = function(trigger) return not trigger.use_rune end + enable = function(trigger) + return not trigger.use_rune + end, }, { hidden = true, @@ -7103,7 +7219,9 @@ Private.event_prototypes = { conditionTest = function(state, needle) return state and state.show and (state.expirationTime and state.expirationTime > GetTime()) == (needle == 1) end, - enable = function(trigger) return trigger.use_rune end + enable = function(trigger) + return trigger.use_rune + end, }, { name = "bloodRunes", @@ -7112,8 +7230,10 @@ Private.event_prototypes = { init = "numBloodRunes", store = true, conditionType = "number", - enable = function(trigger) return WeakAuras.IsWrathClassic() and not trigger.use_rune end, - hidden = not WeakAuras.IsWrathClassic() + enable = function(trigger) + return WeakAuras.IsWrathClassic() and not trigger.use_rune + end, + hidden = not WeakAuras.IsWrathClassic(), }, { name = "frostRunes", @@ -7122,8 +7242,10 @@ Private.event_prototypes = { init = "numFrostRunes", store = true, conditionType = "number", - enable = function(trigger) return WeakAuras.IsWrathClassic() and not trigger.use_rune end, - hidden = not WeakAuras.IsWrathClassic() + enable = function(trigger) + return WeakAuras.IsWrathClassic() and not trigger.use_rune + end, + hidden = not WeakAuras.IsWrathClassic(), }, { name = "unholyRunes", @@ -7132,16 +7254,20 @@ Private.event_prototypes = { init = "numUnholyRunes", store = true, conditionType = "number", - enable = function(trigger) return WeakAuras.IsWrathClassic() and not trigger.use_rune end, - hidden = not WeakAuras.IsWrathClassic() + enable = function(trigger) + return WeakAuras.IsWrathClassic() and not trigger.use_rune + end, + hidden = not WeakAuras.IsWrathClassic(), }, { name = "includeDeathRunes", display = L["Include Death Runes"], type = "toggle", test = "true", - enable = function(trigger) return WeakAuras.IsWrathClassic() and trigger.use_bloodRunes or trigger.use_unholyRunes or trigger.use_frostRunes end, - hidden = not WeakAuras.IsWrathClassic() + enable = function(trigger) + return WeakAuras.IsWrathClassic() and trigger.use_bloodRunes or trigger.use_unholyRunes or trigger.use_frostRunes + end, + hidden = not WeakAuras.IsWrathClassic(), }, }, durationFunc = function(trigger) @@ -7149,28 +7275,28 @@ Private.event_prototypes = { local startTime, duration = WeakAuras.GetRuneCooldown(trigger.rune) return duration, startTime + duration else - local numRunes = 0; + local numRunes = 0 for index = 1, 6 do if GetRuneCooldown(index) == 0 then - numRunes = numRunes + 1; + numRunes = numRunes + 1 end end - return numRunes, 6, true; + return numRunes, 6, true end end, stacksFunc = function(trigger) - local numRunes = 0; + local numRunes = 0 for index = 1, 6 do if GetRuneCooldown(index) == 0 then - numRunes = numRunes + 1; + numRunes = numRunes + 1 end end - return numRunes; + return numRunes end, nameFunc = function(trigger) if WeakAuras.IsWrathClassic() then local runeNames = { L["Blood"], L["Frost"], L["Unholy"], L["Death"] } - return runeNames[GetRuneType(trigger.rune)]; + return runeNames[GetRuneType(trigger.rune)] end end, iconFunc = function(trigger) @@ -7180,12 +7306,12 @@ Private.event_prototypes = { "Interface\\PlayerFrame\\UI-PlayerFrame-Deathknight-Blood", "Interface\\PlayerFrame\\UI-PlayerFrame-Deathknight-Frost", "Interface\\PlayerFrame\\UI-PlayerFrame-Deathknight-Unholy", - "Interface\\PlayerFrame\\UI-PlayerFrame-Deathknight-Death" - }; - return runeIcons[GetRuneType(trigger.rune)]; + "Interface\\PlayerFrame\\UI-PlayerFrame-Deathknight-Death", + } + return runeIcons[GetRuneType(trigger.rune)] end else - return "Interface\\PlayerFrame\\UI-PlayerFrame-Deathknight-SingleRune"; + return "Interface\\PlayerFrame\\UI-PlayerFrame-Deathknight-SingleRune" end end, automaticrequired = true, @@ -7196,23 +7322,23 @@ Private.event_prototypes = { ["events"] = { "UNIT_INVENTORY_CHANGED", "PLAYER_EQUIPMENT_CHANGED", - } + }, }, - internal_events = { "WA_DELAYED_PLAYER_ENTERING_WORLD", }, + internal_events = { "WA_DELAYED_PLAYER_ENTERING_WORLD" }, force_events = "UNIT_INVENTORY_CHANGED", name = L["Item Equipped"], init = function(trigger) - trigger.itemName = trigger.itemName or 0; - local itemName = type(trigger.itemName) == "number" and trigger.itemName or "[[" .. trigger.itemName .. "]]"; + trigger.itemName = trigger.itemName or 0 + local itemName = type(trigger.itemName) == "number" and trigger.itemName or "[[" .. trigger.itemName .. "]]" local ret = [[ local inverse = %s; local itemName = GetItemInfo(%s); local itemSlot = %s; local equipped = WeakAuras.CheckForItemEquipped(itemName, itemSlot); - ]]; + ]] - return ret:format(trigger.use_inverse and "true" or "false", itemName, trigger.use_itemSlot and trigger.itemSlot or "nil"); + return ret:format(trigger.use_inverse and "true" or "false", itemName, trigger.use_itemSlot and trigger.itemSlot or "nil") end, args = { { @@ -7220,7 +7346,7 @@ Private.event_prototypes = { display = L["Item"], type = "item", required = true, - test = "true" + test = "true", }, { name = "itemSlot", @@ -7233,31 +7359,31 @@ Private.event_prototypes = { name = "inverse", display = L["Inverse"], type = "toggle", - test = "true" + test = "true", }, { hidden = true, - test = "(inverse and not equipped) or (equipped and not inverse)" - } + test = "(inverse and not equipped) or (equipped and not inverse)", + }, }, nameFunc = function(trigger) if not trigger.use_inverse then - local name = GetItemInfo(trigger.itemName); - return name; + local name = GetItemInfo(trigger.itemName) + return name else - return nil; + return nil end end, iconFunc = function(trigger) if not trigger.use_inverse then - local _, _, _, _, icon = GetItemInfoInstant(trigger.itemName or 0); - return icon; + local _, _, _, _, icon = GetItemInfoInstant(trigger.itemName or 0) + return icon else - return nil; + return nil end end, hasItemID = true, - automaticrequired = true + automaticrequired = true, }, ["Item Type Equipped"] = { type = "item", @@ -7265,9 +7391,9 @@ Private.event_prototypes = { ["events"] = { "UNIT_INVENTORY_CHANGED", "PLAYER_EQUIPMENT_CHANGED", - } + }, }, - internal_events = { "WA_DELAYED_PLAYER_ENTERING_WORLD", }, + internal_events = { "WA_DELAYED_PLAYER_ENTERING_WORLD" }, force_events = "UNIT_INVENTORY_CHANGED", name = L["Item Type Equipped"], args = { @@ -7276,10 +7402,10 @@ Private.event_prototypes = { display = L["Item Type"], type = "multiselect", values = "item_weapon_types", - test = "IsEquippedItemType(WeakAuras.GetItemSubClassInfo(%s))" + test = "IsEquippedItemType(WeakAuras.GetItemSubClassInfo(%s))", }, }, - automaticrequired = true + automaticrequired = true, }, ["Item Bonus Id Equipped"] = { type = "item", @@ -7287,9 +7413,9 @@ Private.event_prototypes = { ["events"] = { "UNIT_INVENTORY_CHANGED", "PLAYER_EQUIPMENT_CHANGED", - } + }, }, - internal_events = { "WA_DELAYED_PLAYER_ENTERING_WORLD", }, + internal_events = { "WA_DELAYED_PLAYER_ENTERING_WORLD" }, force_events = "UNIT_INVENTORY_CHANGED", name = L["Item Bonus Id Equipped"], statesParameter = "one", @@ -7308,8 +7434,13 @@ Private.event_prototypes = { local slotValidation = (useItemSlot and itemSlot == slotSelected) or (not useItemSlot) ]=] - return ret:format(trigger.use_legendaryIcon and "true" or "false", trigger.itemBonusId or "", trigger.use_inverse and "true" or "false", - trigger.use_itemSlot and "true" or "false", trigger.itemSlot) + return ret:format( + trigger.use_legendaryIcon and "true" or "false", + trigger.itemBonusId or "", + trigger.use_inverse and "true" or "false", + trigger.use_itemSlot and "true" or "false", + trigger.itemSlot + ) end, args = { { @@ -7320,8 +7451,7 @@ Private.event_prototypes = { test = "true", required = true, desc = function() - return WeakAuras.GetLegendariesBonusIds() - .. "\n\n" .. L["Supports multiple entries, separated by commas"] + return WeakAuras.GetLegendariesBonusIds() .. "\n\n" .. L["Supports multiple entries, separated by commas"] end, conditionType = "number", }, @@ -7383,20 +7513,20 @@ Private.event_prototypes = { { hidden = true, test = "not inverse == (itemBonusId and slotValidation or false)", - } + }, }, - automaticrequired = true + automaticrequired = true, }, ["Item Set"] = { type = "item", events = { - ["events"] = {"PLAYER_EQUIPMENT_CHANGED"} + ["events"] = { "PLAYER_EQUIPMENT_CHANGED" }, }, force_events = "PLAYER_EQUIPMENT_CHANGED", name = L["Item Set Equipped"], automaticrequired = true, init = function(trigger) - return string.format("local setid = %s;\n", trigger.itemSetId and tonumber(trigger.itemSetId) or "0"); + return string.format("local setid = %s;\n", trigger.itemSetId and tonumber(trigger.itemSetId) or "0") end, statesParameter = "one", args = { @@ -7418,7 +7548,7 @@ Private.event_prototypes = { elseif WeakAuras.IsWrath() then return L["Set IDs can be found on websites such as wowhead.com/wotlk/item-sets"] end - end + end, }, { name = "equipped", @@ -7427,15 +7557,15 @@ Private.event_prototypes = { init = "WeakAuras.GetNumSetItemsEquipped(setid)", store = true, required = true, - conditionType = "number" - } + conditionType = "number", + }, }, durationFunc = function(trigger) return WeakAuras.GetNumSetItemsEquipped(trigger.itemSetId and tonumber(trigger.itemSetId) or 0) end, nameFunc = function(trigger) - return select(3, WeakAuras.GetNumSetItemsEquipped(trigger.itemSetId and tonumber(trigger.itemSetId) or 0)); - end + return select(3, WeakAuras.GetNumSetItemsEquipped(trigger.itemSetId and tonumber(trigger.itemSetId) or 0)) + end, }, ["Equipment Set"] = { type = "item", @@ -7445,14 +7575,14 @@ Private.event_prototypes = { "WEAR_EQUIPMENT_SET", "EQUIPMENT_SETS_CHANGED", "EQUIPMENT_SWAP_FINISHED", - } + }, }, - internal_events = {"WA_DELAYED_PLAYER_ENTERING_WORLD"}, + internal_events = { "WA_DELAYED_PLAYER_ENTERING_WORLD" }, force_events = "PLAYER_EQUIPMENT_CHANGED", name = L["Equipment Set Equipped"], init = function(trigger) - trigger.itemSetName = trigger.itemSetName or ""; - local itemSetName = type(trigger.itemSetName) == "string" and ("[=[" .. trigger.itemSetName .. "]=]") or "nil"; + trigger.itemSetName = trigger.itemSetName or "" + local itemSetName = type(trigger.itemSetName) == "string" and ("[=[" .. trigger.itemSetName .. "]=]") or "nil" local ret = [[ local useItemSetName = %s; @@ -7460,9 +7590,9 @@ Private.event_prototypes = { local inverse = %s; local partial = %s; - ]]; + ]] - return ret:format(trigger.use_itemSetName and "true" or "false", itemSetName, trigger.use_inverse and "true" or "false", trigger.use_partial and "true" or "false"); + return ret:format(trigger.use_itemSetName and "true" or "false", itemSetName, trigger.use_inverse and "true" or "false", trigger.use_partial and "true" or "false") end, statesParameter = "one", args = { @@ -7473,38 +7603,38 @@ Private.event_prototypes = { test = "true", store = true, conditionType = "string", - init = "WeakAuras.GetEquipmentSetInfo(useItemSetName and triggerItemSetName or nil, partial)" + init = "WeakAuras.GetEquipmentSetInfo(useItemSetName and triggerItemSetName or nil, partial)", }, { name = "partial", display = L["Allow partial matches"], type = "toggle", - test = "true" + test = "true", }, { name = "inverse", display = L["Inverse"], type = "toggle", - test = "true" + test = "true", }, { hidden = true, - test = "(inverse and itemSetName == nil) or (not inverse and itemSetName)" - } + test = "(inverse and itemSetName == nil) or (not inverse and itemSetName)", + }, }, nameFunc = function(trigger) - return WeakAuras.GetEquipmentSetInfo(trigger.use_itemSetName and trigger.itemSetName or nil, trigger.use_partial); + return WeakAuras.GetEquipmentSetInfo(trigger.use_itemSetName and trigger.itemSetName or nil, trigger.use_partial) end, iconFunc = function(trigger) - local _, icon = WeakAuras.GetEquipmentSetInfo(trigger.use_itemSetName and trigger.itemSetName or nil, trigger.use_partial); - return icon; + local _, icon = WeakAuras.GetEquipmentSetInfo(trigger.use_itemSetName and trigger.itemSetName or nil, trigger.use_partial) + return icon end, durationFunc = function(trigger) - local _, _, numEquipped, numItems = WeakAuras.GetEquipmentSetInfo(trigger.use_itemSetName and trigger.itemSetName or nil, trigger.use_partial); - return numEquipped, numItems, true; + local _, _, numEquipped, numItems = WeakAuras.GetEquipmentSetInfo(trigger.use_itemSetName and trigger.itemSetName or nil, trigger.use_partial) + return numEquipped, numItems, true end, hasItemID = true, - automaticrequired = true + automaticrequired = true, }, ["Threat Situation"] = { type = "unit", @@ -7529,7 +7659,7 @@ Private.event_prototypes = { force_events = unitHelperFunctions.UnitChangedForceEvents, name = L["Threat Situation"], init = function(trigger) - trigger.unit = trigger.unit or "target"; + trigger.unit = trigger.unit or "target" local ret = [[ unit = string.lower(unit) local ok = true @@ -7542,8 +7672,8 @@ Private.event_prototypes = { aggro = status == 2 or status == 3 threatpct, rawthreatpct, threatvalue, threattotal = 100, 100, 0, 100 end - ]]; - return ret .. unitHelperFunctions.SpecificUnitCheck(trigger); + ]] + return ret .. unitHelperFunctions.SpecificUnitCheck(trigger) end, canHaveDuration = true, statesParameter = "unit", @@ -7557,7 +7687,7 @@ Private.event_prototypes = { values = "threat_unit_types", test = "true", store = true, - default = "target" + default = "target", }, { name = "status", @@ -7565,7 +7695,7 @@ Private.event_prototypes = { type = "select", values = "unit_threat_situation_types", store = true, - conditionType = "select" + conditionType = "select", }, { name = "aggro", @@ -7581,7 +7711,9 @@ Private.event_prototypes = { type = "number", store = true, conditionType = "number", - enable = function(trigger) return trigger.unit ~= "none" end, + enable = function(trigger) + return trigger.unit ~= "none" + end, }, { name = "rawthreatpct", @@ -7590,7 +7722,9 @@ Private.event_prototypes = { type = "number", store = true, conditionType = "number", - enable = function(trigger) return trigger.unit ~= "none" end, + enable = function(trigger) + return trigger.unit ~= "none" + end, }, { name = "threatvalue", @@ -7599,47 +7733,49 @@ Private.event_prototypes = { type = "number", store = true, conditionType = "number", - enable = function(trigger) return trigger.unit ~= "none" end, + enable = function(trigger) + return trigger.unit ~= "none" + end, }, { name = "value", hidden = true, init = "threatvalue", store = true, - test = "true" + test = "true", }, { name = "total", hidden = true, init = "threattotal", store = true, - test = "true" + test = "true", }, { name = "progressType", hidden = true, init = "'static'", store = true, - test = "true" + test = "true", }, { hidden = true, - test = "status ~= nil and ok" + test = "status ~= nil and ok", }, { hidden = true, - test = "WeakAuras.UnitExistsFixed(unit, smart) and specificUnitCheck" - } + test = "WeakAuras.UnitExistsFixed(unit, smart) and specificUnitCheck", + }, }, - automaticrequired = true + automaticrequired = true, }, ["Crowd Controlled"] = { type = "unit", events = { ["events"] = { "LOSS_OF_CONTROL_UPDATE", - "PLAYER_ENTERING_WORLD" - } + "PLAYER_ENTERING_WORLD", + }, }, force_events = "LOSS_OF_CONTROL_UPDATE", name = L["Crowd Controlled"], @@ -7677,7 +7813,7 @@ Private.event_prototypes = { ]=] ret = ret:format( trigger.use_controlType and "true" or "false", - type(trigger.controlType) == "string" and "[["..trigger.controlType.."]]" or [["STUN"]], + type(trigger.controlType) == "string" and "[[" .. trigger.controlType .. "]]" or [["STUN"]], trigger.use_inverse and "true" or "false", trigger.use_interruptSchool and "true" or "false", trigger.interruptSchool or 0 @@ -7704,7 +7840,9 @@ Private.event_prototypes = { conditionType = "select", default = 1, test = "true", - enable = function(trigger) return trigger.controlType == "SCHOOL_INTERRUPT" end, + enable = function(trigger) + return trigger.controlType == "SCHOOL_INTERRUPT" + end, init = "lockoutSchool", store = true, }, @@ -7837,7 +7975,7 @@ Private.event_prototypes = { canHaveDuration = "timed", name = L["Cast"], init = function(trigger) - trigger.unit = trigger.unit or "player"; + trigger.unit = trigger.unit or "player" local ret = [=[ unit = string.lower(unit) local destUnit = unit .. '-target' @@ -7867,10 +8005,9 @@ Private.event_prototypes = { if remainingCheck and remaining >= remainingCheck and remaining > 0 then WeakAuras.ScheduleCastCheck(expirationTime - remainingCheck, unit) end - ]=]; - ret = ret:format(trigger.unit == "group" and "true" or "false", - trigger.use_remaining and tonumber(trigger.remaining or 0) or "nil", - trigger.use_inverse and "true" or "false"); + ]=] + ret = + ret:format(trigger.unit == "group" and "true" or "false", trigger.use_remaining and tonumber(trigger.remaining or 0) or "nil", trigger.use_inverse and "true" or "false") ret = ret .. unitHelperFunctions.SpecificUnitCheck(trigger) @@ -7893,13 +8030,15 @@ Private.event_prototypes = { end, desc = Private.actual_unit_types_cast_tooltip, test = "true", - store = true + store = true, }, { name = "spellId", display = L["Spell"], type = "spell", - enable = function(trigger) return not trigger.use_inverse end, + enable = function(trigger) + return not trigger.use_inverse + end, conditionType = "number", showExactOption = true, test = "WeakAuras.CompareSpellIds(spellId, %s, %s)", @@ -7909,7 +8048,9 @@ Private.event_prototypes = { name = "spell", display = L["Legacy Spellname"], type = "string", - enable = function(trigger) return not trigger.use_inverse end, + enable = function(trigger) + return not trigger.use_inverse + end, conditionType = "string", store = true, }, @@ -7918,73 +8059,79 @@ Private.event_prototypes = { display = L["Cast Type"], type = "select", values = "cast_types", - enable = function(trigger) return not trigger.use_inverse end, + enable = function(trigger) + return not trigger.use_inverse + end, store = true, - conditionType = "select" + conditionType = "select", }, { name = "interruptible", display = L["Interruptible"], type = "tristate", - enable = function(trigger) return not WeakAuras.IsBCC() and not trigger.use_inverse end, + enable = function(trigger) + return not WeakAuras.IsBCC() and not trigger.use_inverse + end, store = true, conditionType = "bool", - hidden = WeakAuras.IsBCC() + hidden = WeakAuras.IsBCC(), }, { name = "remaining", display = L["Remaining Time"], type = "number", - enable = function(trigger) return not trigger.use_inverse end, + enable = function(trigger) + return not trigger.use_inverse + end, }, { name = "name", hidden = true, init = "spell", test = "true", - store = true + store = true, }, { name = "icon", hidden = true, init = "icon or 'Interface\\AddOns\\WeakAuras\\Media\\Textures\\icon'", test = "true", - store = true + store = true, }, { name = "duration", hidden = true, init = "endTime and startTime and (endTime - startTime)/1000 or 0", test = "true", - store = true + store = true, }, { name = "expirationTime", init = "expirationTime", hidden = true, test = "true", - store = true + store = true, }, { name = "progressType", hidden = true, init = "'timed'", test = "true", - store = true + store = true, }, { name = "inverse", hidden = true, init = "castType == 'cast'", test = "true", - store = true + store = true, }, { name = "autoHide", hidden = true, init = "true", test = "true", - store = true + store = true, }, { name = "npcId", @@ -7995,7 +8142,7 @@ Private.event_prototypes = { test = "select(6, strsplit('-', UnitGUID(unit) or '')) == %q", enable = function(trigger) return not trigger.use_inverse - end + end, }, { name = "class", @@ -8007,7 +8154,7 @@ Private.event_prototypes = { conditionType = "select", enable = function(trigger) return not trigger.use_inverse - end + end, }, { name = "role", @@ -8018,9 +8165,8 @@ Private.event_prototypes = { store = true, conditionType = "select", enable = function(trigger) - return WeakAuras.IsWrathOrRetail() and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") - and not trigger.use_inverse - end + return WeakAuras.IsWrathOrRetail() and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and not trigger.use_inverse + end, }, { name = "raid_role", @@ -8031,9 +8177,8 @@ Private.event_prototypes = { store = true, conditionType = "select", enable = function(trigger) - return not WeakAuras.IsRetail() and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") - and not trigger.use_inverse - end + return not WeakAuras.IsRetail() and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and not trigger.use_inverse + end, }, { name = "raidMarkIndex", @@ -8042,7 +8187,7 @@ Private.event_prototypes = { values = "raid_mark_check_type", store = true, conditionType = "select", - init = "GetRaidTargetIndex(unit) or 0" + init = "GetRaidTargetIndex(unit) or 0", }, { name = "raidMark", @@ -8050,7 +8195,7 @@ Private.event_prototypes = { store = true, hidden = true, test = "true", - init = "raidMarkIndex > 0 and '{rt'..raidMarkIndex..'}' or ''" + init = "raidMarkIndex > 0 and '{rt'..raidMarkIndex..'}' or ''", }, { name = "includePets", @@ -8061,7 +8206,7 @@ Private.event_prototypes = { test = "true", enable = function(trigger) return trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" - end + end, }, { name = "ignoreSelf", @@ -8071,7 +8216,7 @@ Private.event_prototypes = { enable = function(trigger) return trigger.unit == "nameplate" or trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" end, - init = "not UnitIsUnit(\"player\", unit)" + init = "not UnitIsUnit(\"player\", unit)", }, { name = "nameplateType", @@ -8082,8 +8227,8 @@ Private.event_prototypes = { store = true, conditionType = "select", enable = function(trigger) - return trigger.unit == "nameplate" - end + return trigger.unit == "nameplate" + end, }, { name = "sourceUnit", @@ -8097,8 +8242,10 @@ Private.event_prototypes = { end, store = true, hidden = true, - enable = function(trigger) return not trigger.use_inverse end, - test = "true" + enable = function(trigger) + return not trigger.use_inverse + end, + test = "true", }, { name = "sourceName", @@ -8107,7 +8254,9 @@ Private.event_prototypes = { store = true, hidden = true, test = "true", - enable = function(trigger) return not trigger.use_inverse end, + enable = function(trigger) + return not trigger.use_inverse + end, }, { name = "sourceRealm", @@ -8116,7 +8265,9 @@ Private.event_prototypes = { store = true, hidden = true, test = "true", - enable = function(trigger) return not trigger.use_inverse end, + enable = function(trigger) + return not trigger.use_inverse + end, }, { name = "sourceNameRealm", @@ -8132,7 +8283,9 @@ Private.event_prototypes = { return preamble:Check(state.sourceName, state.sourceRealm) end, operator_types = "none", - enable = function(trigger) return not trigger.use_inverse end, + enable = function(trigger) + return not trigger.use_inverse + end, desc = constants.nameRealmFilterDesc, }, { @@ -8145,8 +8298,10 @@ Private.event_prototypes = { return state and state.show and state.destUnit and (UnitIsUnit(state.destUnit, unit) == (op == "==")) end, store = true, - enable = function(trigger) return not trigger.use_inverse end, - test = "UnitIsUnit(destUnit, [[%s]])" + enable = function(trigger) + return not trigger.use_inverse + end, + test = "UnitIsUnit(destUnit, [[%s]])", }, { name = "destName", @@ -8155,7 +8310,9 @@ Private.event_prototypes = { store = true, hidden = true, test = "true", - enable = function(trigger) return not trigger.use_inverse end, + enable = function(trigger) + return not trigger.use_inverse + end, }, { name = "destRealm", @@ -8164,7 +8321,9 @@ Private.event_prototypes = { store = true, hidden = true, test = "true", - enable = function(trigger) return not trigger.use_inverse end, + enable = function(trigger) + return not trigger.use_inverse + end, }, { name = "destNameRealm", @@ -8180,7 +8339,9 @@ Private.event_prototypes = { return preamble:Check(state.destName, state.destRealm) end, operator_types = "none", - enable = function(trigger) return not trigger.use_inverse end, + enable = function(trigger) + return not trigger.use_inverse + end, desc = constants.nameRealmFilterDesc, }, { @@ -8191,7 +8352,7 @@ Private.event_prototypes = { enable = function(trigger) return trigger.unit == "player" end, - reloadOptions = true + reloadOptions = true, }, { name = "onUpdateUnitTarget", @@ -8201,30 +8362,32 @@ Private.event_prototypes = { test = "true", enable = function(trigger) return trigger.unit == "nameplate" - end + end, }, { name = "inverse", display = L["Inverse"], type = "toggle", test = "true", - reloadOptions = true + reloadOptions = true, }, { hidden = true, - test = "WeakAuras.UnitExistsFixed(unit, smart) and ((not inverseTrigger and spell) or (inverseTrigger and not spell)) and specificUnitCheck" - } + test = "WeakAuras.UnitExistsFixed(unit, smart) and ((not inverseTrigger and spell) or (inverseTrigger and not spell)) and specificUnitCheck", + }, }, overlayFuncs = { { name = L["Latency"], func = function(trigger, state) - if not state.expirationTime or not state.duration then return 0, 0 end + if not state.expirationTime or not state.duration then + return 0, 0 + end return 0, (state.expirationTime - state.duration) - (Private.LAST_CURRENT_SPELL_CAST_CHANGED or 0) end, enable = function(trigger) return trigger.use_showLatency and trigger.unit == "player" - end + end, }, }, automaticrequired = true, @@ -8235,11 +8398,11 @@ Private.event_prototypes = { events = { ["events"] = { "COMBAT_RATING_UPDATE", - "PLAYER_TARGET_CHANGED" + "PLAYER_TARGET_CHANGED", }, ["unit_events"] = { - ["player"] = {"UNIT_STATS", "UNIT_ATTACK_POWER", "UNIT_AURA", "PLAYER_DAMAGE_DONE_MODS", "UNIT_RESISTANCES"} - } + ["player"] = { "UNIT_STATS", "UNIT_ATTACK_POWER", "UNIT_AURA", "PLAYER_DAMAGE_DONE_MODS", "UNIT_RESISTANCES" }, + }, }, internal_events = function(trigger, untrigger) local events = { "WA_DELAYED_PLAYER_ENTERING_WORLD", "PLAYER_MOVING_UPDATE" } @@ -8261,7 +8424,7 @@ Private.event_prototypes = { _, _, _, _, _, main_stat = GetSpecializationInfo(GetSpecialization() or 0) end ]] - return ret; + return ret end, force_events = "CONDITIONS_CHECK", statesParameter = "one", @@ -8274,7 +8437,7 @@ Private.event_prototypes = { store = true, enable = WeakAuras.IsRetail(), conditionType = "number", - hidden = not WeakAuras.IsRetail() + hidden = not WeakAuras.IsRetail(), }, { name = "strength", @@ -8284,7 +8447,7 @@ Private.event_prototypes = { store = true, enable = WeakAuras.IsClassicOrBCCOrWrath(), conditionType = "number", - hidden = WeakAuras.IsRetail() + hidden = WeakAuras.IsRetail(), }, { name = "agility", @@ -8294,7 +8457,7 @@ Private.event_prototypes = { store = true, enable = WeakAuras.IsClassicOrBCCOrWrath(), conditionType = "number", - hidden = WeakAuras.IsRetail() + hidden = WeakAuras.IsRetail(), }, { name = "intellect", @@ -8304,7 +8467,7 @@ Private.event_prototypes = { store = true, enable = WeakAuras.IsClassicOrBCCOrWrath(), conditionType = "number", - hidden = WeakAuras.IsRetail() + hidden = WeakAuras.IsRetail(), }, { name = "spirit", @@ -8314,7 +8477,7 @@ Private.event_prototypes = { store = true, enable = WeakAuras.IsClassicOrBCCOrWrath(), conditionType = "number", - hidden = WeakAuras.IsRetail() + hidden = WeakAuras.IsRetail(), }, { name = "stamina", @@ -8322,7 +8485,7 @@ Private.event_prototypes = { type = "number", init = "select(2, UnitStat('player', LE_UNIT_STAT_STAMINA)) * GetUnitMaxHealthModifier('player')", store = true, - conditionType = "number" + conditionType = "number", }, { name = "criticalrating", @@ -8332,7 +8495,7 @@ Private.event_prototypes = { store = true, enable = WeakAuras.IsBCCOrWrathOrRetail(), conditionType = "number", - hidden = not WeakAuras.IsBCCOrWrathOrRetail() + hidden = not WeakAuras.IsBCCOrWrathOrRetail(), }, { name = "criticalpercent", @@ -8340,7 +8503,7 @@ Private.event_prototypes = { type = "number", init = "WeakAuras.GetCritChance()", store = true, - conditionType = "number" + conditionType = "number", }, { name = "hitrating", @@ -8350,7 +8513,7 @@ Private.event_prototypes = { store = true, enable = WeakAuras.IsBCCOrWrath(), conditionType = "number", - hidden = not WeakAuras.IsBCCOrWrath() + hidden = not WeakAuras.IsBCCOrWrath(), }, { name = "hitpercent", @@ -8360,7 +8523,7 @@ Private.event_prototypes = { store = true, conditionType = "number", enable = WeakAuras.IsBCCOrWrath(), - hidden = not WeakAuras.IsBCCOrWrath() + hidden = not WeakAuras.IsBCCOrWrath(), }, { name = "hasterating", @@ -8370,7 +8533,7 @@ Private.event_prototypes = { store = true, enable = WeakAuras.IsBCCOrWrathOrRetail(), conditionType = "number", - hidden = not WeakAuras.IsBCCOrWrathOrRetail() + hidden = not WeakAuras.IsBCCOrWrathOrRetail(), }, { name = "hastepercent", @@ -8378,7 +8541,7 @@ Private.event_prototypes = { type = "number", init = "GetHaste()", store = true, - conditionType = "number" + conditionType = "number", }, { name = "masteryrating", @@ -8388,7 +8551,7 @@ Private.event_prototypes = { store = true, enable = WeakAuras.IsRetail(), conditionType = "number", - hidden = not WeakAuras.IsRetail() + hidden = not WeakAuras.IsRetail(), }, { name = "masterypercent", @@ -8398,7 +8561,7 @@ Private.event_prototypes = { store = true, enable = WeakAuras.IsRetail(), conditionType = "number", - hidden = not WeakAuras.IsRetail() + hidden = not WeakAuras.IsRetail(), }, { name = "versatilityrating", @@ -8408,7 +8571,7 @@ Private.event_prototypes = { store = true, enable = WeakAuras.IsRetail(), conditionType = "number", - hidden = not WeakAuras.IsRetail() + hidden = not WeakAuras.IsRetail(), }, { name = "versatilitypercent", @@ -8418,7 +8581,7 @@ Private.event_prototypes = { store = true, enable = WeakAuras.IsRetail(), conditionType = "number", - hidden = not WeakAuras.IsRetail() + hidden = not WeakAuras.IsRetail(), }, { name = "attackpower", @@ -8426,7 +8589,7 @@ Private.event_prototypes = { type = "number", init = "WeakAuras.GetEffectiveAttackPower()", store = true, - conditionType = "number" + conditionType = "number", }, { name = "resistanceholy", @@ -8436,7 +8599,7 @@ Private.event_prototypes = { store = true, enable = WeakAuras.IsClassicOrBCCOrWrath(), conditionType = "number", - hidden = WeakAuras.IsRetail() + hidden = WeakAuras.IsRetail(), }, { name = "resistancefire", @@ -8446,7 +8609,7 @@ Private.event_prototypes = { store = true, enable = WeakAuras.IsClassicOrBCCOrWrath(), conditionType = "number", - hidden = WeakAuras.IsRetail() + hidden = WeakAuras.IsRetail(), }, { name = "resistancenature", @@ -8456,7 +8619,7 @@ Private.event_prototypes = { store = true, enable = WeakAuras.IsClassicOrBCCOrWrath(), conditionType = "number", - hidden = WeakAuras.IsRetail() + hidden = WeakAuras.IsRetail(), }, { name = "resistancefrost", @@ -8466,7 +8629,7 @@ Private.event_prototypes = { store = true, enable = WeakAuras.IsClassicOrBCCOrWrath(), conditionType = "number", - hidden = WeakAuras.IsRetail() + hidden = WeakAuras.IsRetail(), }, { name = "resistanceshadow", @@ -8476,7 +8639,7 @@ Private.event_prototypes = { store = true, enable = WeakAuras.IsClassicOrBCCOrWrath(), conditionType = "number", - hidden = WeakAuras.IsRetail() + hidden = WeakAuras.IsRetail(), }, { name = "resistancearcane", @@ -8486,7 +8649,7 @@ Private.event_prototypes = { store = true, enable = WeakAuras.IsClassicOrBCCOrWrath(), conditionType = "number", - hidden = WeakAuras.IsRetail() + hidden = WeakAuras.IsRetail(), }, { name = "leechrating", @@ -8496,7 +8659,7 @@ Private.event_prototypes = { store = true, enable = WeakAuras.IsRetail(), conditionType = "number", - hidden = not WeakAuras.IsRetail() + hidden = not WeakAuras.IsRetail(), }, { name = "leechpercent", @@ -8506,7 +8669,7 @@ Private.event_prototypes = { store = true, enable = WeakAuras.IsRetail(), conditionType = "number", - hidden = not WeakAuras.IsRetail() + hidden = not WeakAuras.IsRetail(), }, { name = "movespeedrating", @@ -8516,14 +8679,14 @@ Private.event_prototypes = { store = true, enable = WeakAuras.IsRetail(), conditionType = "number", - hidden = not WeakAuras.IsRetail() + hidden = not WeakAuras.IsRetail(), }, { name = "moveSpeed", display = L["Continuously update Movement Speed"], type = "boolean", test = true, - width = WeakAuras.doubleWidth + width = WeakAuras.doubleWidth, }, { name = "movespeedpercent", @@ -8531,7 +8694,7 @@ Private.event_prototypes = { type = "number", init = "GetUnitSpeed('player') / 7 * 100", store = true, - conditionType = "number" + conditionType = "number", }, { name = "runspeedpercent", @@ -8539,7 +8702,7 @@ Private.event_prototypes = { type = "number", init = "select(2, GetUnitSpeed('player')) / 7 * 100", store = true, - conditionType = "number" + conditionType = "number", }, { name = "avoidancerating", @@ -8549,7 +8712,7 @@ Private.event_prototypes = { store = true, enable = WeakAuras.IsRetail(), conditionType = "number", - hidden = not WeakAuras.IsRetail() + hidden = not WeakAuras.IsRetail(), }, { name = "avoidancepercent", @@ -8559,7 +8722,7 @@ Private.event_prototypes = { store = true, enable = WeakAuras.IsRetail(), conditionType = "number", - hidden = not WeakAuras.IsRetail() + hidden = not WeakAuras.IsRetail(), }, { name = "defense", @@ -8569,7 +8732,7 @@ Private.event_prototypes = { store = true, enable = WeakAuras.IsBCCOrWrath(), conditionType = "number", - hidden = not WeakAuras.IsBCCOrWrath() + hidden = not WeakAuras.IsBCCOrWrath(), }, { name = "dodgerating", @@ -8579,7 +8742,7 @@ Private.event_prototypes = { store = true, enable = WeakAuras.IsBCCOrWrathOrRetail(), conditionType = "number", - hidden = not WeakAuras.IsBCCOrWrathOrRetail() + hidden = not WeakAuras.IsBCCOrWrathOrRetail(), }, { name = "dodgepercent", @@ -8587,7 +8750,7 @@ Private.event_prototypes = { type = "number", init = "GetDodgeChance()", store = true, - conditionType = "number" + conditionType = "number", }, { name = "parryrating", @@ -8597,7 +8760,7 @@ Private.event_prototypes = { store = true, enable = WeakAuras.IsBCCOrWrathOrRetail(), conditionType = "number", - hidden = not WeakAuras.IsBCCOrWrathOrRetail() + hidden = not WeakAuras.IsBCCOrWrathOrRetail(), }, { name = "parrypercent", @@ -8605,7 +8768,7 @@ Private.event_prototypes = { type = "number", init = "GetParryChance()", store = true, - conditionType = "number" + conditionType = "number", }, { name = "blockpercent", @@ -8613,7 +8776,7 @@ Private.event_prototypes = { type = "number", init = "GetBlockChance()", store = true, - conditionType = "number" + conditionType = "number", }, { name = "blocktargetpercent", @@ -8623,7 +8786,7 @@ Private.event_prototypes = { store = true, enable = WeakAuras.IsRetail(), conditionType = "number", - hidden = not WeakAuras.IsRetail() + hidden = not WeakAuras.IsRetail(), }, { name = "blockvalue", @@ -8631,7 +8794,7 @@ Private.event_prototypes = { type = "number", init = "GetShieldBlock()", store = true, - conditionType = "number" + conditionType = "number", }, { name = "armorrating", @@ -8639,7 +8802,7 @@ Private.event_prototypes = { type = "number", init = "select(2, UnitArmor('player'))", store = true, - conditionType = "number" + conditionType = "number", }, { name = "armorpercent", @@ -8649,7 +8812,7 @@ Private.event_prototypes = { store = true, enable = WeakAuras.IsBCCOrWrathOrRetail(), conditionType = "number", - hidden = not WeakAuras.IsBCCOrWrathOrRetail() + hidden = not WeakAuras.IsBCCOrWrathOrRetail(), }, { name = "armortargetpercent", @@ -8659,10 +8822,10 @@ Private.event_prototypes = { store = true, enable = WeakAuras.IsRetail(), conditionType = "number", - hidden = not WeakAuras.IsRetail() + hidden = not WeakAuras.IsRetail(), }, }, - automaticrequired = true + automaticrequired = true, }, ["Conditions"] = { type = "unit", @@ -8724,45 +8887,45 @@ Private.event_prototypes = { ["events"] = events, ["unit_events"] = { ["player"] = unit_events, - ["pet"] = pet_unit_events - } + ["pet"] = pet_unit_events, + }, } end, internal_events = function(trigger, untrigger) - local events = { "CONDITIONS_CHECK"}; + local events = { "CONDITIONS_CHECK" } - if (trigger.use_ismoving ~= nil) then - tinsert(events, "PLAYER_MOVING_UPDATE"); + if trigger.use_ismoving ~= nil then + tinsert(events, "PLAYER_MOVING_UPDATE") end - if (trigger.use_HasPet ~= nil) then + if trigger.use_HasPet ~= nil then AddUnitChangeInternalEvents("pet", events) end - return events; + return events end, force_events = "CONDITIONS_CHECK", name = L["Conditions"], loadFunc = function(trigger) - if (trigger.use_ismoving ~= nil) then - WeakAuras.WatchForPlayerMoving(); + if trigger.use_ismoving ~= nil then + WeakAuras.WatchForPlayerMoving() end end, init = function(trigger) - return ""; + return "" end, args = { { name = "alwaystrue", display = L["Always active trigger"], type = "tristate", - init = "true" + init = "true", }, { name = "incombat", display = L["In Combat"], type = "tristate", - init = "UnitAffectingCombat('player')" + init = "UnitAffectingCombat('player')", }, { name = "pvpflagged", @@ -8770,13 +8933,13 @@ Private.event_prototypes = { type = "tristate", init = "UnitIsPVP('player')", enable = WeakAuras.IsRetail(), - hidden = not WeakAuras.IsRetail() + hidden = not WeakAuras.IsRetail(), }, { name = "alive", display = L["Alive"], type = "tristate", - init = "not UnitIsDeadOrGhost('player')" + init = "not UnitIsDeadOrGhost('player')", }, { name = "vehicle", @@ -8788,31 +8951,31 @@ Private.event_prototypes = { name = "resting", display = L["Resting"], type = "tristate", - init = "IsResting()" + init = "IsResting()", }, { name = "mounted", display = L["Mounted"], type = "tristate", - init = "IsMounted()" + init = "IsMounted()", }, { name = "HasPet", display = L["HasPet"], type = "tristate", - init = "UnitExists('pet') and not UnitIsDead('pet')" + init = "UnitExists('pet') and not UnitIsDead('pet')", }, { name = "ismoving", display = L["Is Moving"], type = "tristate", - init = "IsPlayerMoving()" + init = "IsPlayerMoving()", }, { name = "afk", display = L["Is Away from Keyboard"], type = "tristate", - init = "UnitIsAFK('player')" + init = "UnitIsAFK('player')", }, { name = "ingroup", @@ -8848,27 +9011,27 @@ Private.event_prototypes = { hidden = not WeakAuras.IsRetail(), }, }, - automaticrequired = true + automaticrequired = true, }, ["Spell Known"] = { type = "spell", events = { - ["events"] = WeakAuras.IsWrathClassic() and {"SPELLS_CHANGED","PLAYER_TALENT_UPDATE"} or {"SPELLS_CHANGED"}, + ["events"] = WeakAuras.IsWrathClassic() and { "SPELLS_CHANGED", "PLAYER_TALENT_UPDATE" } or { "SPELLS_CHANGED" }, ["unit_events"] = { - ["player"] = {"UNIT_PET"} - } + ["player"] = { "UNIT_PET" }, + }, }, internal_events = { - "WA_DELAYED_PLAYER_ENTERING_WORLD" + "WA_DELAYED_PLAYER_ENTERING_WORLD", }, force_events = "SPELLS_CHANGED", name = L["Spell Known"], init = function(trigger) - local spellName; - local ret; - if (trigger.use_exact_spellName) then - spellName = tonumber(trigger.spellName) or "nil"; + local spellName + local ret + if trigger.use_exact_spellName then + spellName = tonumber(trigger.spellName) or "nil" if spellName == 0 then spellName = "nil" end @@ -8877,14 +9040,14 @@ Private.event_prototypes = { ]] ret = ret:format(spellName) else - local name = type(trigger.spellName) == "number" and GetSpellInfo(trigger.spellName) or trigger.spellName or ""; + local name = type(trigger.spellName) == "number" and GetSpellInfo(trigger.spellName) or trigger.spellName or "" ret = [[ local spellName = select(7, GetSpellInfo(%q)); ]] ret = ret:format(name) end local ret2 - if (trigger.use_inverse) then + if trigger.use_inverse then ret2 = [[ local usePet = %s; local active = not spellName or not WeakAuras.IsSpellKnown(spellName, usePet) @@ -8910,7 +9073,7 @@ Private.event_prototypes = { name = "petspell", display = L["Pet Spell"], type = "toggle", - test = "true" + test = "true", }, { name = "inverse", @@ -8920,44 +9083,44 @@ Private.event_prototypes = { }, { hidden = true, - test = "active" - } + test = "active", + }, }, nameFunc = function(trigger) return GetSpellInfo(trigger.spellName or 0) end, iconFunc = function(trigger) - local _, _, icon = GetSpellInfo(trigger.spellName or 0); - return icon; + local _, _, icon = GetSpellInfo(trigger.spellName or 0) + return icon end, - automaticrequired = true + automaticrequired = true, }, ["Pet Behavior"] = { type = "unit", events = function(trigger) - local result = {}; - if (trigger.use_behavior) then - tinsert(result, "PET_BAR_UPDATE"); + local result = {} + if trigger.use_behavior then + tinsert(result, "PET_BAR_UPDATE") end - if (trigger.use_petspec) then - tinsert(result, "PET_SPECIALIZATION_CHANGED"); + if trigger.use_petspec then + tinsert(result, "PET_SPECIALIZATION_CHANGED") end return { ["events"] = result, ["unit_events"] = { - ["player"] = {"UNIT_PET"} - } - }; + ["player"] = { "UNIT_PET" }, + }, + } end, internal_events = { - "WA_DELAYED_PLAYER_ENTERING_WORLD" + "WA_DELAYED_PLAYER_ENTERING_WORLD", }, force_events = "WA_DELAYED_PLAYER_ENTERING_WORLD", name = L["Pet"], init = function(trigger) - local ret = "local activeIcon\n"; - if (trigger.use_behavior) then + local ret = "local activeIcon\n" + if trigger.use_behavior then ret = [[ local inverse = %s local check_behavior = %s @@ -8985,17 +9148,18 @@ Private.event_prototypes = { end end ]] - ret = ret:format(trigger.use_inverse and "true" or "false", trigger.use_behavior and ('"' .. (trigger.behavior or "") .. '"') or "nil"); + ret = ret:format(trigger.use_inverse and "true" or "false", trigger.use_behavior and ("\"" .. (trigger.behavior or "") .. "\"") or "nil") end - if (trigger.use_petspec) then - ret = ret .. [[ + if trigger.use_petspec then + ret = ret + .. [[ local petspec = GetSpecialization(false, true) if (petspec) then activeIcon = select(4, GetSpecializationInfo(petspec, false, true)); end ]] end - return ret; + return ret end, statesParameter = "one", args = { @@ -9011,7 +9175,9 @@ Private.event_prototypes = { display = L["Inverse Pet Behavior"], type = "toggle", test = "true", - enable = function(trigger) return trigger.use_behavior end + enable = function(trigger) + return trigger.use_behavior + end, }, { name = "petspec", @@ -9024,20 +9190,20 @@ Private.event_prototypes = { name = "icon", init = "activeIcon", store = "true", - test = "true" + test = "true", }, }, - automaticrequired = true + automaticrequired = true, }, ["Queued Action"] = { type = "spell", events = { - ["events"] = {"ACTIONBAR_UPDATE_STATE"} + ["events"] = { "ACTIONBAR_UPDATE_STATE" }, }, internal_events = { "ACTIONBAR_SLOT_CHANGED", - "ACTIONBAR_PAGE_CHANGED" + "ACTIONBAR_PAGE_CHANGED", }, name = L["Queued Action"], init = function(trigger) @@ -9070,24 +9236,24 @@ Private.event_prototypes = { }, { hidden = true, - test = "button and IsCurrentAction(button)"; + test = "button and IsCurrentAction(button)", }, }, iconFunc = function(trigger) - local _, _, icon = GetSpellInfo(trigger.spellName or 0); - return icon; + local _, _, icon = GetSpellInfo(trigger.spellName or 0) + return icon end, - automaticrequired = true + automaticrequired = true, }, ["Range Check"] = { type = "unit", events = { - ["events"] = {"FRAME_UPDATE"} + ["events"] = { "FRAME_UPDATE" }, }, name = L["Range Check"], init = function(trigger) - trigger.unit = trigger.unit or "target"; + trigger.unit = trigger.unit or "target" local ret = [=[ local unit = %q; local min, max = WeakAuras.GetRange(unit, true); @@ -9095,15 +9261,15 @@ Private.event_prototypes = { max = max or 999; local triggerResult = true; ]=] - if (trigger.use_range) then - trigger.range = trigger.range or 8; - if (trigger.range_operator == "<=") then - ret = ret .. "triggerResult = max <= " .. tostring(trigger.range) .. "\n"; + if trigger.use_range then + trigger.range = trigger.range or 8 + if trigger.range_operator == "<=" then + ret = ret .. "triggerResult = max <= " .. tostring(trigger.range) .. "\n" else - ret = ret .. "triggerResult = min >= " .. tostring(trigger.range).. "\n"; + ret = ret .. "triggerResult = min >= " .. tostring(trigger.range) .. "\n" end end - return ret:format(trigger.unit); + return ret:format(trigger.unit) end, statesParameter = "one", args = { @@ -9111,7 +9277,13 @@ Private.event_prototypes = { name = "note", type = "description", display = "", - text = function() return L["Note: This trigger type estimates the range to the hitbox of a unit. The actual range of friendly players is usually 3 yards more than the estimate. Range checking capabilities depend on your current class and known abilities as well as the type of unit being checked. Some of the ranges may also not work with certain NPCs.|n|n|cFFAAFFAAFriendly Units:|r %s|n|cFFFFAAAAHarmful Units:|r %s|n|cFFAAAAFFMiscellanous Units:|r %s"]:format(RangeCacheStrings.friend or "", RangeCacheStrings.harm or "", RangeCacheStrings.misc or "") end + text = function() + return L["Note: This trigger type estimates the range to the hitbox of a unit. The actual range of friendly players is usually 3 yards more than the estimate. Range checking capabilities depend on your current class and known abilities as well as the type of unit being checked. Some of the ranges may also not work with certain NPCs.|n|n|cFFAAFFAAFriendly Units:|r %s|n|cFFFFAAAAHarmful Units:|r %s|n|cFFAAAAFFMiscellanous Units:|r %s"]:format( + RangeCacheStrings.friend or "", + RangeCacheStrings.harm or "", + RangeCacheStrings.misc or "" + ) + end, }, { name = "unit", @@ -9121,7 +9293,7 @@ Private.event_prototypes = { init = "unit", values = "unit_types_range_check", test = "true", - store = true + store = true, }, { hidden = true, @@ -9130,7 +9302,7 @@ Private.event_prototypes = { type = "number", init = "min", store = true, - test = "true" + test = "true", }, { hidden = true, @@ -9139,7 +9311,7 @@ Private.event_prototypes = { type = "number", init = "max", store = true, - test = "true" + test = "true", }, { name = "range", @@ -9149,17 +9321,17 @@ Private.event_prototypes = { test = "triggerResult", conditionType = "number", conditionTest = function(state, needle, needle2) - return state and state.show and WeakAuras.CheckRange(state.unit, needle, needle2); + return state and state.show and WeakAuras.CheckRange(state.unit, needle, needle2) end, }, { hidden = true, - test = "UnitExists(unit)" - } + test = "UnitExists(unit)", + }, }, - automaticrequired = true + automaticrequired = true, }, -}; +} if WeakAuras.IsClassicOrBCCOrWrath() then if not UnitDetailedThreatSituation then @@ -9191,7 +9363,9 @@ end Private.dynamic_texts = { ["p"] = { get = function(state) - if not state then return nil end + if not state then + return nil + end if state.progressType == "static" then return state.value or nil end @@ -9203,7 +9377,7 @@ Private.dynamic_texts = { if not state.expirationTime or not state.duration then return nil end - local remaining = state.expirationTime - GetTime(); + local remaining = state.expirationTime - GetTime() return remaining >= 0 and remaining or nil end end, @@ -9217,34 +9391,36 @@ Private.dynamic_texts = { return "" end - local remainingStr = ""; + local remainingStr = "" if remaining == math.huge then - remainingStr = " "; + remainingStr = " " elseif remaining > 60 then - remainingStr = string.format("%i:", math.floor(remaining / 60)); - remaining = remaining % 60; - remainingStr = remainingStr..string.format("%02i", remaining); + remainingStr = string.format("%i:", math.floor(remaining / 60)) + remaining = remaining % 60 + remainingStr = remainingStr .. string.format("%02i", remaining) elseif remaining > 0 then if progressPrecision == 4 and remaining <= 3 then - remainingStr = remainingStr..string.format("%.1f", remaining); + remainingStr = remainingStr .. string.format("%.1f", remaining) elseif progressPrecision == 5 and remaining <= 3 then - remainingStr = remainingStr..string.format("%.2f", remaining); + remainingStr = remainingStr .. string.format("%.2f", remaining) elseif progressPrecision == 6 and remaining <= 3 then - remainingStr = remainingStr..string.format("%.3f", remaining); + remainingStr = remainingStr .. string.format("%.3f", remaining) elseif (progressPrecision == 4 or progressPrecision == 5 or progressPrecision == 6) and remaining > 3 then - remainingStr = remainingStr..string.format("%d", remaining); + remainingStr = remainingStr .. string.format("%d", remaining) else - remainingStr = remainingStr..string.format("%.".. progressPrecision .."f", remaining); + remainingStr = remainingStr .. string.format("%." .. progressPrecision .. "f", remaining) end else - remainingStr = " "; + remainingStr = " " end return remainingStr - end + end, }, ["t"] = { get = function(state) - if not state then return "" end + if not state then + return "" + end if state.progressType == "static" then return state.total, false end @@ -9262,59 +9438,65 @@ Private.dynamic_texts = { if type(duration) ~= "number" then return "" end - local durationStr = ""; + local durationStr = "" if math.abs(duration) == math.huge or tostring(duration) == "nan" then - durationStr = " "; + durationStr = " " elseif duration > 60 then - durationStr = string.format("%i:", math.floor(duration / 60)); - duration = duration % 60; - durationStr = durationStr..string.format("%02i", duration); + durationStr = string.format("%i:", math.floor(duration / 60)) + duration = duration % 60 + durationStr = durationStr .. string.format("%02i", duration) elseif duration > 0 then if totalPrecision == 4 and duration <= 3 then - durationStr = durationStr..string.format("%.1f", duration); + durationStr = durationStr .. string.format("%.1f", duration) elseif totalPrecision == 5 and duration <= 3 then - durationStr = durationStr..string.format("%.2f", duration); + durationStr = durationStr .. string.format("%.2f", duration) elseif totalPrecision == 6 and duration <= 3 then - durationStr = durationStr..string.format("%.3f", duration); + durationStr = durationStr .. string.format("%.3f", duration) elseif (totalPrecision == 4 or totalPrecision == 5 or totalPrecision == 6) and duration > 3 then - durationStr = durationStr..string.format("%d", duration); + durationStr = durationStr .. string.format("%d", duration) else - durationStr = durationStr..string.format("%."..totalPrecision.."f", duration); + durationStr = durationStr .. string.format("%." .. totalPrecision .. "f", duration) end else - durationStr = " "; + durationStr = " " end return durationStr - end + end, }, ["n"] = { get = function(state) - if not state then return "" end + if not state then + return "" + end return state.name or state.id or "", true end, func = function(v) return v - end + end, }, ["i"] = { get = function(state) - if not state then return "" end + if not state then + return "" + end return state.icon or "Interface\\Icons\\INV_Misc_QuestionMark" end, func = function(v) - return "|T".. v ..":12:12:0:0:64:64:4:60:4:60|t" - end + return "|T" .. v .. ":12:12:0:0:64:64:4:60:4:60|t" + end, }, ["s"] = { get = function(state) - if not state or state.stacks == 0 then return "" end + if not state or state.stacks == 0 then + return "" + end return state.stacks end, func = function(v) return v - end - } -}; + end, + }, +} -- Events in that list can be filtered by unitID Private.UnitEventList = { @@ -9338,5 +9520,5 @@ Private.UnitEventList = { PLAYER_SPECIALIZATION_CHANGED = true, PLAYER_TRIAL_XP_UPDATE = true, PLAYER_XP_UPDATE = true, - PVP_TIMER_UPDATE = true + PVP_TIMER_UPDATE = true, } diff --git a/WeakAuras/RegionTypes/AuraBar.lua b/WeakAuras/RegionTypes/AuraBar.lua index 00e3c3b7e6..4b27aa4719 100644 --- a/WeakAuras/RegionTypes/AuraBar.lua +++ b/WeakAuras/RegionTypes/AuraBar.lua @@ -1,8 +1,10 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, Private = ... -local SharedMedia = LibStub("LibSharedMedia-3.0"); -local L = WeakAuras.L; +local SharedMedia = LibStub("LibSharedMedia-3.0") +local L = WeakAuras.L -- Default settings local default = { @@ -14,12 +16,12 @@ local default = { height = 15, orientation = "HORIZONTAL", inverse = false, - barColor = {1.0, 0.0, 0.0, 1.0}, - backgroundColor = {0.0, 0.0, 0.0, 0.5}, + barColor = { 1.0, 0.0, 0.0, 1.0 }, + backgroundColor = { 0.0, 0.0, 0.0, 0.5 }, spark = false, sparkWidth = 10, sparkHeight = 30, - sparkColor = {1.0, 1.0, 1.0, 1.0}, + sparkColor = { 1.0, 1.0, 1.0, 1.0 }, sparkTexture = "Interface\\CastingBar\\UI-CastingBar-Spark", sparkBlendMode = "ADD", sparkOffsetX = 0, @@ -33,15 +35,15 @@ local default = { xOffset = 0, yOffset = 0, icon_side = "RIGHT", - icon_color = {1.0, 1.0, 1.0, 1.0}, + icon_color = { 1.0, 1.0, 1.0, 1.0 }, frameStrata = 1, - zoom = 0 -}; + zoom = 0, +} -WeakAuras.regionPrototype.AddAdjustedDurationToDefault(default); -WeakAuras.regionPrototype.AddAlphaToDefault(default); +WeakAuras.regionPrototype.AddAdjustedDurationToDefault(default) +WeakAuras.regionPrototype.AddAlphaToDefault(default) -local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ceil(GetScreenHeight() / 20) * 20; +local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ceil(GetScreenHeight() / 20) * 20 local properties = { barColor = { @@ -50,56 +52,56 @@ local properties = { type = "color", }, icon_visible = { - display = {L["Icon"], L["Visibility"]}, + display = { L["Icon"], L["Visibility"] }, setter = "SetIconVisible", - type = "bool" + type = "bool", }, icon_color = { - display = {L["Icon"], L["Color"]}, + display = { L["Icon"], L["Color"] }, setter = "SetIconColor", - type = "color" + type = "color", }, iconSource = { - display = {L["Icon"], L["Source"]}, + display = { L["Icon"], L["Source"] }, setter = "SetIconSource", type = "list", - values = {} + values = {}, }, displayIcon = { - display = {L["Icon"], L["Fallback"]}, + display = { L["Icon"], L["Fallback"] }, setter = "SetIcon", type = "icon", }, desaturate = { - display = {L["Icon"], L["Desaturate"]}, + display = { L["Icon"], L["Desaturate"] }, setter = "SetIconDesaturated", type = "bool", }, backgroundColor = { display = L["Background Color"], setter = "SetBackgroundColor", - type = "color" + type = "color", }, sparkColor = { - display = {L["Spark"], L["Color"]}, + display = { L["Spark"], L["Color"] }, setter = "SetSparkColor", - type = "color" + type = "color", }, sparkHeight = { - display = {L["Spark"], L["Height"]}, + display = { L["Spark"], L["Height"] }, setter = "SetSparkHeight", type = "number", min = 1, softMax = screenHeight, - bigStep = 1 + bigStep = 1, }, sparkWidth = { - display = {L["Spark"], L["Width"]}, + display = { L["Spark"], L["Width"] }, setter = "SetSparkWidth", type = "number", min = 1, softMax = screenWidth, - bigStep = 1 + bigStep = 1, }, width = { display = L["Width"], @@ -117,27 +119,27 @@ local properties = { min = 1, softMax = screenHeight, bigStep = 1, - default = 32 + default = 32, }, orientation = { display = L["Orientation"], setter = "SetOrientation", type = "list", - values = Private.orientation_types + values = Private.orientation_types, }, inverse = { display = L["Inverse"], setter = "SetInverse", - type = "bool" + type = "bool", }, -}; +} -WeakAuras.regionPrototype.AddProperties(properties, default); +WeakAuras.regionPrototype.AddProperties(properties, default) local function GetProperties(data) - local overlayInfo = Private.GetOverlayInfo(data); + local overlayInfo = Private.GetOverlayInfo(data) local auraProperties = CopyTable(properties) - if (overlayInfo and next(overlayInfo)) then + if overlayInfo and next(overlayInfo) then for id, display in ipairs(overlayInfo) do auraProperties["overlays." .. id] = { display = string.format(L["%s Overlay Color"], display), @@ -149,27 +151,27 @@ local function GetProperties(data) end auraProperties.iconSource.values = Private.IconSources(data) - return auraProperties; + return auraProperties end -- Returns tex Coord for 90° rotations + x or y flip - +-- stylua: ignore local texCoords = { 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1 -}; +} -- only supports multipliers of 90° degree -- returns in order: TLx, TLy, TRx, TRy, BLx, BLy, BRx, BRy local GetTexCoordSpark = function(degree, mirror) local offset = (degree or 0) / 90 - local TLx, TLy = texCoords[2 + offset], texCoords[1 + offset] - local TRx, TRy = texCoords[3 + offset], texCoords[2 + offset] - local BLx, BLy = texCoords[1 + offset], texCoords[4 + offset] - local BRx, BRy = texCoords[4 + offset], texCoords[3 + offset] + local TLx, TLy = texCoords[2 + offset], texCoords[1 + offset] + local TRx, TRy = texCoords[3 + offset], texCoords[2 + offset] + local BLx, BLy = texCoords[1 + offset], texCoords[4 + offset] + local BRx, BRy = texCoords[4 + offset], texCoords[3 + offset] - if (mirror) then + if mirror then TLx, TRx = TRx, TLx TLy, TRy = TRy, TLy BLx, BRx = BRx, BLx @@ -179,276 +181,275 @@ local GetTexCoordSpark = function(degree, mirror) return TLx, TLy, TRx, TRy, BLx, BLy, BRx, BRy end -local GetTexCoordFunctions = - { - ["HORIZONTAL"] = function(startProgress, endProgress) - local TLx, TLy = startProgress, 0; - local TRx, TRy = endProgress, 0; - local BLx, BLy = startProgress, 1; - local BRx, BRy = endProgress, 1; - return TLx, TLy, BLx, BLy, TRx, TRy, BRx, BRy; - end, - ["HORIZONTAL_INVERSE"] = function(startProgress, endProgress) - local TLx, TLy = endProgress, 0; - local TRx, TRy = startProgress, 0; - local BLx, BLy = endProgress, 1; - local BRx, BRy = startProgress, 1; - return TLx, TLy, BLx, BLy, TRx, TRy, BRx, BRy; - end, - ["VERTICAL"] = function(startProgress, endProgress) - local TLx, TLy = startProgress, 1; - local TRx, TRy = startProgress, 0; - local BLx, BLy = endProgress, 1; - local BRx, BRy = endProgress, 0; - return TLx, TLy, BLx, BLy, TRx, TRy, BRx, BRy; - end, - ["VERTICAL_INVERSE"] = function(startProgress, endProgress) - local TLx, TLy = endProgress, 0; - local TRx, TRy = endProgress, 1; - local BLx, BLy = startProgress, 0; - local BRx, BRy = startProgress, 1; - return TLx, TLy, BLx, BLy, TRx, TRy, BRx, BRy; - end - } +local GetTexCoordFunctions = { + ["HORIZONTAL"] = function(startProgress, endProgress) + local TLx, TLy = startProgress, 0 + local TRx, TRy = endProgress, 0 + local BLx, BLy = startProgress, 1 + local BRx, BRy = endProgress, 1 + return TLx, TLy, BLx, BLy, TRx, TRy, BRx, BRy + end, + ["HORIZONTAL_INVERSE"] = function(startProgress, endProgress) + local TLx, TLy = endProgress, 0 + local TRx, TRy = startProgress, 0 + local BLx, BLy = endProgress, 1 + local BRx, BRy = startProgress, 1 + return TLx, TLy, BLx, BLy, TRx, TRy, BRx, BRy + end, + ["VERTICAL"] = function(startProgress, endProgress) + local TLx, TLy = startProgress, 1 + local TRx, TRy = startProgress, 0 + local BLx, BLy = endProgress, 1 + local BRx, BRy = endProgress, 0 + return TLx, TLy, BLx, BLy, TRx, TRy, BRx, BRy + end, + ["VERTICAL_INVERSE"] = function(startProgress, endProgress) + local TLx, TLy = endProgress, 0 + local TRx, TRy = endProgress, 1 + local BLx, BLy = startProgress, 0 + local BRx, BRy = startProgress, 1 + return TLx, TLy, BLx, BLy, TRx, TRy, BRx, BRy + end, +} local anchorAlignment = { ["HORIZONTAL"] = { "TOPLEFT", "BOTTOMLEFT", "RIGHT" }, ["HORIZONTAL_INVERSE"] = { "TOPRIGHT", "BOTTOMRIGHT", "LEFT" }, ["VERTICAL"] = { "TOPLEFT", "TOPRIGHT", "BOTTOM" }, - ["VERTICAL_INVERSE"] = { "BOTTOMLEFT", "BOTTOMRIGHT", "TOP" } + ["VERTICAL_INVERSE"] = { "BOTTOMLEFT", "BOTTOMRIGHT", "TOP" }, } -local extraTextureWrapMode = "REPEAT"; +local extraTextureWrapMode = "REPEAT" -- Emulate blizzard statusbar with advanced features (more grow directions) local barPrototype = { ["UpdateAnchors"] = function(self) -- Do not flip/rotate textures - local orientation = self.orientation; + local orientation = self.orientation if not self.rotate then if orientation == "HORIZONTAL_INVERSE" then - orientation = "HORIZONTAL"; + orientation = "HORIZONTAL" elseif orientation == "VERTICAL_INVERSE" then - orientation = "VERTICAL"; + orientation = "VERTICAL" end end - self.GetTexCoord = GetTexCoordFunctions[orientation]; - local anchorAlignment = anchorAlignment[orientation]; - self.align1 = anchorAlignment[1]; - self.align2 = anchorAlignment[2]; - self.alignSpark = anchorAlignment[3]; + self.GetTexCoord = GetTexCoordFunctions[orientation] + local anchorAlignment = anchorAlignment[orientation] + self.align1 = anchorAlignment[1] + self.align2 = anchorAlignment[2] + self.alignSpark = anchorAlignment[3] self.horizontal = (self.orientation == "HORIZONTAL_INVERSE") or (self.orientation == "HORIZONTAL") self.directionInverse = (self.orientation == "HORIZONTAL_INVERSE") or (self.orientation == "VERTICAL") - local TLx, TLy, BLx, BLy, TRx, TRy, BRx, BRy = self.GetTexCoord(0, 1); - self.bg:SetTexCoord(TLx , TLy , BLx , BLy , TRx , TRy , BRx , BRy ); + local TLx, TLy, BLx, BLy, TRx, TRy, BRx, BRy = self.GetTexCoord(0, 1) + self.bg:SetTexCoord(TLx, TLy, BLx, BLy, TRx, TRy, BRx, BRy) -- Set alignment - self.fg:ClearAllPoints(); - self.fg:SetPoint(self.align1); - self.fg:SetPoint(self.align2); + self.fg:ClearAllPoints() + self.fg:SetPoint(self.align1) + self.fg:SetPoint(self.align2) self.fgFrame:ClearAllPoints() - self.fgFrame:SetPoint(self.align1); - self.fgFrame:SetPoint(self.align2); + self.fgFrame:SetPoint(self.align1) + self.fgFrame:SetPoint(self.align2) - self.spark:SetPoint("CENTER", self.fg, self.alignSpark, self.spark.sparkOffsetX or 0, self.spark.sparkOffsetY or 0); + self.spark:SetPoint("CENTER", self.fg, self.alignSpark, self.spark.sparkOffsetX or 0, self.spark.sparkOffsetY or 0) - local sparkMirror = self.spark.sparkMirror; - local sparkRotationMode = self.spark.sparkRotationMode; - local sTLx, sTLy, sBLx, sBLy, sTRx, sTRy, sBRx, sBRy; -- spark rotation - if (sparkRotationMode == "AUTO") then - sTLx, sTLy, sBLx, sBLy, sTRx, sTRy, sBRx, sBRy = TLx, TLy, BLx, BLy, TRx, TRy, BRx, BRy; + local sparkMirror = self.spark.sparkMirror + local sparkRotationMode = self.spark.sparkRotationMode + local sTLx, sTLy, sBLx, sBLy, sTRx, sTRy, sBRx, sBRy -- spark rotation + if sparkRotationMode == "AUTO" then + sTLx, sTLy, sBLx, sBLy, sTRx, sTRy, sBRx, sBRy = TLx, TLy, BLx, BLy, TRx, TRy, BRx, BRy else - local sparkRotation = tonumber(self.spark.sparkRotation); + local sparkRotation = tonumber(self.spark.sparkRotation) sTLx, sTLy, sTRx, sTRy, sBLx, sBLy, sBRx, sBRy = GetTexCoordSpark(sparkRotation, sparkMirror) end - self.spark:SetTexCoord(sTLx , sTLy , sBLx , sBLy , sTRx , sTRy , sBRx , sBRy); + self.spark:SetTexCoord(sTLx, sTLy, sBLx, sBLy, sTRx, sTRy, sBRx, sBRy) end, ["UpdateProgress"] = function(self) -- Limit values - local value = self.value; - value = math.max(self.min, value); - value = math.min(self.max, value); + local value = self.value + value = math.max(self.min, value) + value = math.min(self.max, value) -- Alignment variables - local progress = (value - self.min) / (self.max - self.min); + local progress = (value - self.min) / (self.max - self.min) -- Create statusbar illusion - if (self.horizontal) then - local xProgress = self:GetRealSize() * progress; - self.fg:SetWidth(xProgress > 0.0001 and xProgress or 0.0001); - self.fgFrame:SetWidth(xProgress > 0.0001 and xProgress or 0.0001); + if self.horizontal then + local xProgress = self:GetRealSize() * progress + self.fg:SetWidth(xProgress > 0.0001 and xProgress or 0.0001) + self.fgFrame:SetWidth(xProgress > 0.0001 and xProgress or 0.0001) else - local yProgress = select(2, self:GetRealSize()) * progress; - self.fg:SetHeight(yProgress > 0.0001 and yProgress or 0.0001); - self.fgFrame:SetHeight(yProgress > 0.0001 and yProgress or 0.0001); + local yProgress = select(2, self:GetRealSize()) * progress + self.fg:SetHeight(yProgress > 0.0001 and yProgress or 0.0001) + self.fgFrame:SetHeight(yProgress > 0.0001 and yProgress or 0.0001) end -- Stretch texture - local TLx_, TLy_, BLx_, BLy_, TRx_, TRy_, BRx_, BRy_ = self.GetTexCoord(0, progress); - self.fg:SetTexCoord(TLx_, TLy_, BLx_, BLy_, TRx_, TRy_, BRx_, BRy_); + local TLx_, TLy_, BLx_, BLy_, TRx_, TRy_, BRx_, BRy_ = self.GetTexCoord(0, progress) + self.fg:SetTexCoord(TLx_, TLy_, BLx_, BLy_, TRx_, TRy_, BRx_, BRy_) - local sparkHidden = self.spark.sparkHidden; + local sparkHidden = self.spark.sparkHidden local sparkVisible = sparkHidden == "NEVER" or (sparkHidden == "FULL" and progress < 1) or (sparkHidden == "EMPTY" and progress > 0) - or (sparkHidden == "BOTH" and progress < 1 and progress > 0); + or (sparkHidden == "BOTH" and progress < 1 and progress > 0) - if (sparkVisible) then - self.spark:Show(); + if sparkVisible then + self.spark:Show() else - self.spark:Hide(); + self.spark:Hide() end end, ["UpdateAdditionalBars"] = function(self) - if (type(self.additionalBars) == "table") then + if type(self.additionalBars) == "table" then for index, additionalBar in ipairs(self.additionalBars) do - if (not self.extraTextures[index]) then - local extraTexture = self:CreateTexture(nil, "ARTWORK"); + if not self.extraTextures[index] then + local extraTexture = self:CreateTexture(nil, "ARTWORK") extraTexture:SetSnapToPixelGrid(false) extraTexture:SetTexelSnappingBias(0) - extraTexture:SetDrawLayer("ARTWORK", min(index, 7)); - self.extraTextures[index] = extraTexture; + extraTexture:SetDrawLayer("ARTWORK", min(index, 7)) + self.extraTextures[index] = extraTexture end - local extraTexture = self.extraTextures[index]; + local extraTexture = self.extraTextures[index] local valueStart = self.additionalBarsMin - local valueWidth = self.additionalBarsMax - valueStart; + local valueWidth = self.additionalBarsMax - valueStart - local startProgress = 0; - local endProgress = 0; + local startProgress = 0 + local endProgress = 0 - if (additionalBar.min and additionalBar.max) then - if (valueWidth ~= 0) then - startProgress = (additionalBar.min - valueStart) / valueWidth; - endProgress = (additionalBar.max - valueStart) / valueWidth; + if additionalBar.min and additionalBar.max then + if valueWidth ~= 0 then + startProgress = (additionalBar.min - valueStart) / valueWidth + endProgress = (additionalBar.max - valueStart) / valueWidth - if (self.additionalBarsInverse) then - startProgress = 1 - startProgress; - endProgress = 1 - endProgress; + if self.additionalBarsInverse then + startProgress = 1 - startProgress + endProgress = 1 - endProgress end end - elseif (additionalBar.direction) then - local forwardDirection = (additionalBar.direction or "forward") == "forward"; - if (self.additionalBarsInverse) then - forwardDirection = not forwardDirection; + elseif additionalBar.direction then + local forwardDirection = (additionalBar.direction or "forward") == "forward" + if self.additionalBarsInverse then + forwardDirection = not forwardDirection end - local width = additionalBar.width or 0; - local offset = additionalBar.offset or 0; + local width = additionalBar.width or 0 + local offset = additionalBar.offset or 0 - if (width ~= 0) then - if (forwardDirection) then - startProgress = self.value + offset / valueWidth; - endProgress = self.value + (width + offset) / valueWidth; + if width ~= 0 then + if forwardDirection then + startProgress = self.value + offset / valueWidth + endProgress = self.value + (width + offset) / valueWidth else - startProgress = self.value - (width + offset) / valueWidth; - endProgress = self.value - offset / valueWidth; + startProgress = self.value - (width + offset) / valueWidth + endProgress = self.value - offset / valueWidth end end end - if (self.additionalBarsClip) then - startProgress = max(0, min(1, startProgress)); - endProgress = max(0, min(1, endProgress)); + if self.additionalBarsClip then + startProgress = max(0, min(1, startProgress)) + endProgress = max(0, min(1, endProgress)) else - startProgress = max(-10, min(11, startProgress)); - endProgress = max(-10, min(11, endProgress)); + startProgress = max(-10, min(11, startProgress)) + endProgress = max(-10, min(11, endProgress)) end - if ((endProgress - startProgress) == 0) then - extraTexture:Hide(); + if (endProgress - startProgress) == 0 then + extraTexture:Hide() else - extraTexture:Show(); - local TLx_, TLy_, BLx_, BLy_, TRx_, TRy_, BRx_, BRy_ = self.GetTexCoord(startProgress, endProgress); - extraTexture:SetTexCoord(TLx_, TLy_, BLx_, BLy_, TRx_, TRy_, BRx_, BRy_); + extraTexture:Show() + local TLx_, TLy_, BLx_, BLy_, TRx_, TRy_, BRx_, BRy_ = self.GetTexCoord(startProgress, endProgress) + extraTexture:SetTexCoord(TLx_, TLy_, BLx_, BLy_, TRx_, TRy_, BRx_, BRy_) - local color = self.additionalBarsColors and self.additionalBarsColors[index]; - if (color) then - extraTexture:SetVertexColor(unpack(color)); + local color = self.additionalBarsColors and self.additionalBarsColors[index] + if color then + extraTexture:SetVertexColor(unpack(color)) else - extraTexture:SetVertexColor(1, 1, 1, 1); + extraTexture:SetVertexColor(1, 1, 1, 1) end - local texture = self.additionalBarsTextures and self.additionalBarsTextures[index]; + local texture = self.additionalBarsTextures and self.additionalBarsTextures[index] if texture then local texturePath = SharedMedia:Fetch("statusbar", texture) or "" extraTexture:SetTexture(texturePath, extraTextureWrapMode, extraTextureWrapMode) else - extraTexture:SetTexture(self:GetStatusBarTexture(), extraTextureWrapMode, extraTextureWrapMode); + extraTexture:SetTexture(self:GetStatusBarTexture(), extraTextureWrapMode, extraTextureWrapMode) end - local xOffset = 0; - local yOffset = 0; + local xOffset = 0 + local yOffset = 0 local width, height = self:GetRealSize() - if (self.horizontal) then - xOffset = startProgress * width; - local width = (endProgress - startProgress) * width; - extraTexture:SetWidth( width ); - extraTexture:SetHeight( height ); + if self.horizontal then + xOffset = startProgress * width + local width = (endProgress - startProgress) * width + extraTexture:SetWidth(width) + extraTexture:SetHeight(height) else - yOffset = startProgress * height; - local height = (endProgress - startProgress) * height; - extraTexture:SetWidth( width ); - extraTexture:SetHeight( height ); + yOffset = startProgress * height + local height = (endProgress - startProgress) * height + extraTexture:SetWidth(width) + extraTexture:SetHeight(height) end - if (self.directionInverse) then - xOffset = -xOffset; - yOffset = -yOffset; + if self.directionInverse then + xOffset = -xOffset + yOffset = -yOffset end - extraTexture:ClearAllPoints(); - extraTexture:SetPoint(self.align1, self, self.align1, xOffset, yOffset); - extraTexture:SetPoint(self.align2, self, self.align2, xOffset, yOffset); + extraTexture:ClearAllPoints() + extraTexture:SetPoint(self.align1, self, self.align1, xOffset, yOffset) + extraTexture:SetPoint(self.align2, self, self.align2, xOffset, yOffset) end end - if (#self.additionalBars < #self.extraTextures) then + if #self.additionalBars < #self.extraTextures then for i = #self.additionalBars + 1, #self.extraTextures do - self.extraTextures[i]:Hide(); + self.extraTextures[i]:Hide() end end else for i = 1, #self.extraTextures do - self.extraTextures[i]:Hide(); + self.extraTextures[i]:Hide() end end end, ["Update"] = function(self) - self:UpdateAnchors(); - self:UpdateProgress(); - self:UpdateAdditionalBars(); + self:UpdateAnchors() + self:UpdateProgress() + self:UpdateAdditionalBars() end, -- Need to update progress! ["OnSizeChanged"] = function(self, width, height) - self:UpdateProgress(); - self:UpdateAdditionalBars(); + self:UpdateProgress() + self:UpdateAdditionalBars() self:GetParent().subRegionEvents:Notify("OnRegionSizeChanged") end, -- Blizzard like SetMinMaxValues ["SetMinMaxValues"] = function(self, minVal, maxVal) - local update = false; + local update = false if minVal and type(minVal) == "number" then - self.min = minVal; - update = true; + self.min = minVal + update = true end if maxVal and type(maxVal) == "number" then - self.max = maxVal; - update = true; + self.max = maxVal + update = true end if update then - self:UpdateProgress(); - self:UpdateAdditionalBars(); + self:UpdateProgress() + self:UpdateAdditionalBars() end end, @@ -459,21 +460,21 @@ local barPrototype = { -- Blizzard like SetValue ["SetValue"] = function(self, value) if value and type(value) == "number" then - self.value = value; - self:UpdateProgress(); - self:UpdateAdditionalBars(); + self.value = value + self:UpdateProgress() + self:UpdateAdditionalBars() end end, ["SetAdditionalBars"] = function(self, additionalBars, colors, textures, min, max, inverse, overlayclip) - self.additionalBars = additionalBars; - self.additionalBarsColors = colors; - self.additionalBarsTextures = textures; - self.additionalBarsMin = min or 0; - self.additionalBarsMax = max or 0; - self.additionalBarsInverse = inverse; - self.additionalBarsClip = overlayclip; - self:UpdateAdditionalBars(); + self.additionalBars = additionalBars + self.additionalBarsColors = colors + self.additionalBarsTextures = textures + self.additionalBarsMin = min or 0 + self.additionalBarsMax = max or 0 + self.additionalBarsInverse = inverse + self.additionalBarsClip = overlayclip + self:UpdateAdditionalBars() end, ["GetAdditionalBarsInverse"] = function(self) @@ -481,95 +482,91 @@ local barPrototype = { end, ["SetAdditionalBarsInverse"] = function(self, value) - self.additionalBarsInverse = value; - self:UpdateAdditionalBars(); + self.additionalBarsInverse = value + self:UpdateAdditionalBars() end, ["SetAdditionalBarColor"] = function(self, id, color) - self.additionalBarsColors[id] = color; + self.additionalBarsColors[id] = color if self.extraTextures[id] then - self.extraTextures[id]:SetVertexColor(unpack(color)); + self.extraTextures[id]:SetVertexColor(unpack(color)) end end, ["GetValue"] = function(self) - return self.value; + return self.value end, -- Blizzard like SetOrientation (added: HORIZONTAL_INVERSE, VERTICAL_INVERSE) ["SetOrientation"] = function(self, orientation) - if orientation == "HORIZONTAL" - or orientation == "HORIZONTAL_INVERSE" - or orientation == "VERTICAL" - or orientation == "VERTICAL_INVERSE" - then - self.orientation = orientation; - self:Update(); + if orientation == "HORIZONTAL" or orientation == "HORIZONTAL_INVERSE" or orientation == "VERTICAL" or orientation == "VERTICAL_INVERSE" then + self.orientation = orientation + self:Update() end end, ["GetOrientation"] = function(self) - return self.orientation; + return self.orientation end, -- Blizzard like SetRotatesTexture (added: flip texture for right->left, bottom->top) ["SetRotatesTexture"] = function(self, rotate) if rotate and type(rotate) == "boolean" then - self.rotate = rotate; - self:Update(); + self.rotate = rotate + self:Update() end end, ["GetRotatesTexture"] = function(self) - return self.rotate; + return self.rotate end, -- Blizzard like SetStatusBarTexture ["SetStatusBarTexture"] = function(self, texture) - self.fg:SetTexture(texture); - self.bg:SetTexture(texture); + self.fg:SetTexture(texture) + self.bg:SetTexture(texture) for index, extraTexture in ipairs(self.extraTextures) do - extraTexture:SetTexture(texture, extraTextureWrapMode, extraTextureWrapMode); + extraTexture:SetTexture(texture, extraTextureWrapMode, extraTextureWrapMode) end end, ["GetStatusBarTexture"] = function(self) - return self.fg:GetTexture(); + return self.fg:GetTexture() end, -- Set bar color ["SetForegroundColor"] = function(self, r, g, b, a) - self.fg:SetVertexColor(r, g, b, a); + self.fg:SetVertexColor(r, g, b, a) end, ["GetForegroundColor"] = function(self) - return self.fg:GetVertexColor(); + return self.fg:GetVertexColor() end, -- Set background color ["SetBackgroundColor"] = function(self, r, g, b, a) - self.bg:SetVertexColor(r, g, b, a); + self.bg:SetVertexColor(r, g, b, a) end, ["GetBackgroundColor"] = function(self) - return self.bg:GetVertexColor(); + return self.bg:GetVertexColor() end, -- Convenience methods ["SetTexture"] = function(self, texture) - self:SetStatusBarTexture(texture); + self:SetStatusBarTexture(texture) end, ["GetTexture"] = function(self) - return self:GetStatusBarTexture(); + return self:GetStatusBarTexture() end, ["SetVertexColor"] = function(self, r, g, b, a) - self:SetForegroundColor(r, g, b, a); + self:SetForegroundColor(r, g, b, a) end, ["GetVertexColor"] = function(self) - return self.fg:GetVertexColor(); + return self.fg:GetVertexColor() end, ["GetRealSize"] = function(self) @@ -591,7 +588,7 @@ local GetRealSize = { end, [false] = function(self) return self.totalWidth, self.totalHeight - end + end, }, ["VERTICAL"] = { [true] = function(self) @@ -599,133 +596,133 @@ local GetRealSize = { end, [false] = function(self) return self.totalWidth, self.totalHeight - end + end, }, } -- Orientation helper methods local function orientHorizontalInverse(region) -- Localize - local bar, icon = region.bar, region.icon; + local bar, icon = region.bar, region.icon -- Reset - icon:ClearAllPoints(); - bar:ClearAllPoints(); + icon:ClearAllPoints() + bar:ClearAllPoints() bar.GetRealSize = GetRealSize["HORIZONTAL"][region.iconVisible or false] -- Align icon and bar if region.iconVisible then if region.icon_side == "LEFT" then - icon:SetPoint("LEFT", region, "LEFT"); - bar:SetPoint("BOTTOMRIGHT", region, "BOTTOMRIGHT"); - bar:SetPoint("TOPLEFT", icon, "TOPRIGHT"); + icon:SetPoint("LEFT", region, "LEFT") + bar:SetPoint("BOTTOMRIGHT", region, "BOTTOMRIGHT") + bar:SetPoint("TOPLEFT", icon, "TOPRIGHT") else - icon:SetPoint("RIGHT", region, "RIGHT"); - bar:SetPoint("BOTTOMLEFT", region, "BOTTOMLEFT"); - bar:SetPoint("TOPRIGHT", icon, "TOPLEFT"); + icon:SetPoint("RIGHT", region, "RIGHT") + bar:SetPoint("BOTTOMLEFT", region, "BOTTOMLEFT") + bar:SetPoint("TOPRIGHT", icon, "TOPLEFT") end else - bar:SetPoint("BOTTOMRIGHT", region, "BOTTOMRIGHT"); - bar:SetPoint("TOPLEFT", region, "TOPLEFT"); + bar:SetPoint("BOTTOMRIGHT", region, "BOTTOMRIGHT") + bar:SetPoint("TOPLEFT", region, "TOPLEFT") end -- Save orientation - bar:SetOrientation(region.effectiveOrientation); + bar:SetOrientation(region.effectiveOrientation) end local function orientHorizontal(region) -- Localize - local bar, icon = region.bar, region.icon; + local bar, icon = region.bar, region.icon bar.GetRealSize = GetRealSize["HORIZONTAL"][region.iconVisible or false] -- Reset - icon:ClearAllPoints(); - bar:ClearAllPoints(); + icon:ClearAllPoints() + bar:ClearAllPoints() -- Align icon and bar if region.iconVisible then if region.icon_side == "LEFT" then - icon:SetPoint("LEFT", region, "LEFT"); - bar:SetPoint("BOTTOMRIGHT", region, "BOTTOMRIGHT"); - bar:SetPoint("TOPLEFT", icon, "TOPRIGHT"); + icon:SetPoint("LEFT", region, "LEFT") + bar:SetPoint("BOTTOMRIGHT", region, "BOTTOMRIGHT") + bar:SetPoint("TOPLEFT", icon, "TOPRIGHT") else - icon:SetPoint("RIGHT", region, "RIGHT"); - bar:SetPoint("BOTTOMLEFT", region, "BOTTOMLEFT"); - bar:SetPoint("TOPRIGHT", icon, "TOPLEFT"); + icon:SetPoint("RIGHT", region, "RIGHT") + bar:SetPoint("BOTTOMLEFT", region, "BOTTOMLEFT") + bar:SetPoint("TOPRIGHT", icon, "TOPLEFT") end else - bar:SetPoint("BOTTOMRIGHT", region, "BOTTOMRIGHT"); - bar:SetPoint("TOPLEFT", region, "TOPLEFT"); + bar:SetPoint("BOTTOMRIGHT", region, "BOTTOMRIGHT") + bar:SetPoint("TOPLEFT", region, "TOPLEFT") end -- Save orientation - bar:SetOrientation(region.effectiveOrientation); + bar:SetOrientation(region.effectiveOrientation) end local function orientVerticalInverse(region) -- Localize - local bar, icon = region.bar, region.icon; + local bar, icon = region.bar, region.icon bar.GetRealSize = GetRealSize["VERTICAL"][region.iconVisible or false] -- Reset - icon:ClearAllPoints(); - bar:ClearAllPoints(); + icon:ClearAllPoints() + bar:ClearAllPoints() -- Align icon and bar if region.iconVisible then if region.icon_side == "LEFT" then - icon:SetPoint("TOP", region, "TOP"); - bar:SetPoint("BOTTOMRIGHT", region, "BOTTOMRIGHT"); - bar:SetPoint("TOPLEFT", icon, "BOTTOMLEFT"); + icon:SetPoint("TOP", region, "TOP") + bar:SetPoint("BOTTOMRIGHT", region, "BOTTOMRIGHT") + bar:SetPoint("TOPLEFT", icon, "BOTTOMLEFT") else - icon:SetPoint("BOTTOM", region, "BOTTOM"); - bar:SetPoint("TOPRIGHT", region, "TOPRIGHT"); - bar:SetPoint("BOTTOMLEFT", icon, "TOPLEFT"); + icon:SetPoint("BOTTOM", region, "BOTTOM") + bar:SetPoint("TOPRIGHT", region, "TOPRIGHT") + bar:SetPoint("BOTTOMLEFT", icon, "TOPLEFT") end else - bar:SetPoint("BOTTOMRIGHT", region, "BOTTOMRIGHT"); - bar:SetPoint("TOPLEFT", region, "TOPLEFT"); + bar:SetPoint("BOTTOMRIGHT", region, "BOTTOMRIGHT") + bar:SetPoint("TOPLEFT", region, "TOPLEFT") end -- Save orientation - bar:SetOrientation("VERTICAL_INVERSE"); + bar:SetOrientation("VERTICAL_INVERSE") end local function orientVertical(region) -- Localize - local bar, icon = region.bar, region.icon; + local bar, icon = region.bar, region.icon bar.GetRealSize = GetRealSize["VERTICAL"][region.iconVisible or false] -- Reset - icon:ClearAllPoints(); - bar:ClearAllPoints(); + icon:ClearAllPoints() + bar:ClearAllPoints() -- Align icon and bar if region.iconVisible then if region.icon_side == "LEFT" then - icon:SetPoint("TOP", region, "TOP"); - bar:SetPoint("BOTTOMRIGHT", region, "BOTTOMRIGHT"); - bar:SetPoint("TOPLEFT", icon, "BOTTOMLEFT"); + icon:SetPoint("TOP", region, "TOP") + bar:SetPoint("BOTTOMRIGHT", region, "BOTTOMRIGHT") + bar:SetPoint("TOPLEFT", icon, "BOTTOMLEFT") else - icon:SetPoint("BOTTOM", region, "BOTTOM"); - bar:SetPoint("TOPRIGHT", region, "TOPRIGHT"); - bar:SetPoint("BOTTOMLEFT", icon, "TOPLEFT"); + icon:SetPoint("BOTTOM", region, "BOTTOM") + bar:SetPoint("TOPRIGHT", region, "TOPRIGHT") + bar:SetPoint("BOTTOMLEFT", icon, "TOPLEFT") end else - bar:SetPoint("BOTTOMRIGHT", region, "BOTTOMRIGHT"); - bar:SetPoint("TOPLEFT", region, "TOPLEFT"); + bar:SetPoint("BOTTOMRIGHT", region, "BOTTOMRIGHT") + bar:SetPoint("TOPLEFT", region, "TOPLEFT") end -- Save orientation - bar:SetOrientation("VERTICAL"); + bar:SetOrientation("VERTICAL") end local function GetTexCoordZoom(texWidth) - local texCoord = {texWidth, texWidth, texWidth, 1 - texWidth, 1 - texWidth, texWidth, 1 - texWidth, 1 - texWidth} + local texCoord = { texWidth, texWidth, texWidth, 1 - texWidth, 1 - texWidth, texWidth, 1 - texWidth, 1 - texWidth } return unpack(texCoord) end @@ -747,7 +744,7 @@ local funcs = { anchorYOffset = anchorYOffset or 0 subRegion:ClearAllPoints() subRegion:SetPoint("bottomleft", anchor, "bottomleft", -anchorXOffset, -anchorYOffset) - subRegion:SetPoint("topright", anchor, "topright", anchorXOffset, anchorYOffset) + subRegion:SetPoint("topright", anchor, "topright", anchorXOffset, anchorYOffset) else subRegion:ClearAllPoints() anchorPoint = anchorPoint or "CENTER" @@ -793,80 +790,76 @@ local funcs = { end end, SetIconColor = function(self, r, g, b, a) - self.icon_color = {r, g, b, a} - self.icon:SetVertexColor(r, g, b, a); + self.icon_color = { r, g, b, a } + self.icon:SetVertexColor(r, g, b, a) end, SetIconDesaturated = function(self, b) self.desaturateIcon = b - self.icon:SetDesaturated(b); + self.icon:SetDesaturated(b) end, - SetBackgroundColor = function (self, r, g, b, a) - self.bar:SetBackgroundColor(r, g, b, a); + SetBackgroundColor = function(self, r, g, b, a) + self.bar:SetBackgroundColor(r, g, b, a) end, SetSparkColor = function(self, r, g, b, a) - self.bar.spark:SetVertexColor(r, g, b, a); + self.bar.spark:SetVertexColor(r, g, b, a) end, SetSparkHeight = function(self, height) - self.bar.spark:SetHeight(height); + self.bar.spark:SetHeight(height) end, SetSparkWidth = function(self, width) - self.bar.spark:SetWidth(width); + self.bar.spark:SetWidth(width) end, SetRegionWidth = function(self, width) - self.width = width; - self:Scale(self.scalex, self.scaley); + self.width = width + self:Scale(self.scalex, self.scaley) end, SetRegionHeight = function(self, height) - self.height = height; - self:Scale(self.scalex, self.scaley); + self.height = height + self:Scale(self.scalex, self.scaley) end, SetValue = function(self, value, total) - local progress = 0; - if (total ~= 0) then - progress = value / total; + local progress = 0 + if total ~= 0 then + progress = value / total end if self.inverseDirection then - progress = 1 - progress; + progress = 1 - progress end - if (self.smoothProgress) then + if self.smoothProgress then self.bar.targetValue = progress - self.bar:SetSmoothedValue(progress); + self.bar:SetSmoothedValue(progress) else - self.bar:SetValue(progress); + self.bar:SetValue(progress) end end, SetTime = function(self, duration, expirationTime, inverse) - local remaining = expirationTime - GetTime(); - local progress = duration ~= 0 and remaining / duration or 0; + local remaining = expirationTime - GetTime() + local progress = duration ~= 0 and remaining / duration or 0 -- Need to invert? - if ( - (self.inverseDirection and not inverse) - or (inverse and not self.inverseDirection) - ) - then - progress = 1 - progress; + if (self.inverseDirection and not inverse) or (inverse and not self.inverseDirection) then + progress = 1 - progress end - if (self.smoothProgress) then + if self.smoothProgress then self.bar.targetValue = progress - self.bar:SetSmoothedValue(progress); + self.bar:SetSmoothedValue(progress) else - self.bar:SetValue(progress); + self.bar:SetValue(progress) end end, SetInverse = function(self, inverse) - if (self.inverseDirection == inverse) then - return; + if self.inverseDirection == inverse then + return end - self.inverseDirection = inverse; - if (self.smoothProgress) then - if (self.bar.targetValue) then + self.inverseDirection = inverse + if self.smoothProgress then + if self.bar.targetValue then self.bar.targetValue = 1 - self.bar.targetValue - self.bar:SetSmoothedValue(self.bar.targetValue); + self.bar:SetSmoothedValue(self.bar.targetValue) end else - self.bar:SetValue(1 - self.bar:GetValue()); + self.bar:SetValue(1 - self.bar:GetValue()) end self.bar:SetAdditionalBarsInverse(not self.bar:GetAdditionalBarsInverse()) self.subRegionEvents:Notify("InverseChanged") @@ -874,17 +867,17 @@ local funcs = { SetOrientation = function(self, orientation) self.orientation = orientation self:UpdateEffectiveOrientation() - if (self.smoothProgress) then + if self.smoothProgress then if self.bar.targetValue then - self.bar:SetSmoothedValue(self.bar.targetValue); + self.bar:SetSmoothedValue(self.bar.targetValue) end else - self.bar:SetValue(self.bar:GetValue()); + self.bar:SetValue(self.bar:GetValue()) end end, SetIconVisible = function(self, iconVisible) - if (self.iconVisible == iconVisible) then + if self.iconVisible == iconVisible then return end @@ -893,22 +886,22 @@ local funcs = { local icon = self.icon if self.iconVisible then -- Update icon - local iconsize = math.min(self.height, self.width); - icon:SetWidth(iconsize); - icon:SetHeight(iconsize); + local iconsize = math.min(self.height, self.width) + icon:SetWidth(iconsize) + icon:SetHeight(iconsize) self.bar.iconWidth = iconsize self.bar.iconHeight = iconsize - local texWidth = 0.25 * self.zoom; + local texWidth = 0.25 * self.zoom icon:SetTexCoord(GetTexCoordZoom(texWidth)) - icon:SetDesaturated(self.desaturateIcon); - icon:SetVertexColor(self.icon_color[1], self.icon_color[2], self.icon_color[3], self.icon_color[4]); + icon:SetDesaturated(self.desaturateIcon) + icon:SetVertexColor(self.icon_color[1], self.icon_color[2], self.icon_color[3], self.icon_color[4]) -- Update icon visibility - icon:Show(); + icon:Show() else self.bar.iconWidth = 0 self.bar.iconHeight = 0 - icon:Hide(); + icon:Hide() end self:ReOrient() @@ -946,7 +939,7 @@ local funcs = { WeakAuras.SetTextureOrAtlas(self.icon, iconPath) end, SetOverlayColor = function(self, id, r, g, b, a) - self.bar:SetAdditionalBarColor(id, { r, g, b, a}); + self.bar:SetAdditionalBarColor(id, { r, g, b, a }) end, GetEffectiveOrientation = function(self) return self.effectiveOrientation @@ -956,13 +949,13 @@ local funcs = { end, ReOrient = function(self) if self.effectiveOrientation == "HORIZONTAL_INVERSE" then - orientHorizontalInverse(self); + orientHorizontalInverse(self) elseif self.effectiveOrientation == "HORIZONTAL" then - orientHorizontal(self); + orientHorizontal(self) elseif self.effectiveOrientation == "VERTICAL_INVERSE" then - orientVerticalInverse(self); + orientVerticalInverse(self) elseif self.effectiveOrientation == "VERTICAL" then - orientVertical(self); + orientVertical(self) end end, UpdateEffectiveOrientation = function(self) @@ -989,81 +982,81 @@ local funcs = { end self.subRegionEvents:Notify("OrientationChanged") - end + end, } -- Called when first creating a new region/display local function create(parent) -- Create overall region (containing everything else) - local region = CreateFrame("Frame", nil, parent); + local region = CreateFrame("Frame", nil, parent) region.regionType = "aurabar" - region:SetMovable(true); - region:SetResizable(true); - region:SetMinResize(1, 1); + region:SetMovable(true) + region:SetResizable(true) + region:SetMinResize(1, 1) -- Create statusbar (inherit prototype) - local bar = CreateFrame("Frame", nil, region); - Mixin(bar, SmoothStatusBarMixin); - local fg = bar:CreateTexture(nil, "ARTWORK"); + local bar = CreateFrame("Frame", nil, region) + Mixin(bar, SmoothStatusBarMixin) + local fg = bar:CreateTexture(nil, "ARTWORK") fg:SetSnapToPixelGrid(false) fg:SetTexelSnappingBias(0) - local bg = bar:CreateTexture(nil, "ARTWORK"); + local bg = bar:CreateTexture(nil, "ARTWORK") bg:SetSnapToPixelGrid(false) bg:SetTexelSnappingBias(0) - bg:SetAllPoints(); + bg:SetAllPoints() local fgFrame = CreateFrame("Frame", nil, bar) - local spark = bar:CreateTexture(nil, "ARTWORK"); + local spark = bar:CreateTexture(nil, "ARTWORK") spark:SetSnapToPixelGrid(false) spark:SetTexelSnappingBias(0) - fg:SetDrawLayer("ARTWORK", 0); - bg:SetDrawLayer("ARTWORK", -1); - spark:SetDrawLayer("ARTWORK", 7); - bar.fg = fg; + fg:SetDrawLayer("ARTWORK", 0) + bg:SetDrawLayer("ARTWORK", -1) + spark:SetDrawLayer("ARTWORK", 7) + bar.fg = fg bar.fgFrame = fgFrame - bar.bg = bg; - bar.spark = spark; + bar.bg = bg + bar.spark = spark for key, value in pairs(barPrototype) do - bar[key] = value; + bar[key] = value end - bar.extraTextures = {}; - bar:SetRotatesTexture(true); - bar:HookScript("OnSizeChanged", bar.OnSizeChanged); - region.bar = bar; + bar.extraTextures = {} + bar:SetRotatesTexture(true) + bar:HookScript("OnSizeChanged", bar.OnSizeChanged) + region.bar = bar -- Create icon - local iconFrame = CreateFrame("Frame", nil, region); - region.iconFrame = iconFrame; - local icon = iconFrame:CreateTexture(nil, "OVERLAY"); + local iconFrame = CreateFrame("Frame", nil, region) + region.iconFrame = iconFrame + local icon = iconFrame:CreateTexture(nil, "OVERLAY") icon:SetSnapToPixelGrid(false) icon:SetTexelSnappingBias(0) - region.icon = icon; - icon:SetTexture("Interface\\Icons\\INV_Misc_QuestionMark"); + region.icon = icon + icon:SetTexture("Interface\\Icons\\INV_Misc_QuestionMark") - local oldSetFrameLevel = region.SetFrameLevel; + local oldSetFrameLevel = region.SetFrameLevel function region.SetFrameLevel(self, frameLevel) - oldSetFrameLevel(self, frameLevel); + oldSetFrameLevel(self, frameLevel) - if (self.__WAGlowFrame) then - self.__WAGlowFrame:SetFrameLevel(frameLevel + 5); + if self.__WAGlowFrame then + self.__WAGlowFrame:SetFrameLevel(frameLevel + 5) end end - WeakAuras.regionPrototype.create(region); + WeakAuras.regionPrototype.create(region) for k, f in pairs(funcs) do region[k] = f end -- Return new display/region - return region; + return region end local function TimerTick(self) local state = self.state local duration = state.duration or 0 - local adjustMin = self.adjustedMin or self.adjustedMinRel or 0; - local expirationTime = state.expirationTime and state.expirationTime > 0 and state.expirationTime or math.huge; - self:SetTime((duration ~= 0 and (self.adjustedMax or self.adjustedMaxRel) or duration) - adjustMin, expirationTime - adjustMin, state.inverse); + local adjustMin = self.adjustedMin or self.adjustedMinRel or 0 + local expirationTime = state.expirationTime and state.expirationTime > 0 and state.expirationTime or math.huge + self:SetTime((duration ~= 0 and (self.adjustedMax or self.adjustedMaxRel) or duration) - adjustMin, expirationTime - adjustMin, state.inverse) end -- Modify a given region/display @@ -1072,37 +1065,37 @@ local function modify(parent, region, data) region.text = nil region.stacks = nil - WeakAuras.regionPrototype.modify(parent, region, data); + WeakAuras.regionPrototype.modify(parent, region, data) -- Localize - local bar, iconFrame, icon = region.bar, region.iconFrame, region.icon; + local bar, iconFrame, icon = region.bar, region.iconFrame, region.icon region.iconSource = data.iconSource region.displayIcon = data.displayIcon -- Adjust region size - region:SetWidth(data.width); - region:SetHeight(data.height); + region:SetWidth(data.width) + region:SetHeight(data.height) region.bar.totalWidth = data.width region.bar.totalHeight = data.height - region.width = data.width; - region.height = data.height; - region.scalex = 1; - region.scaley = 1; + region.width = data.width + region.height = data.height + region.scalex = 1 + region.scaley = 1 region.flipX = false region.flipY = false region.orientation = data.orientation region.effectiveOrientation = nil - region.overlayclip = data.overlayclip; + region.overlayclip = data.overlayclip region.iconVisible = data.icon region.icon_side = data.icon_side region.icon_color = CopyTable(data.icon_color) region.desaturateIcon = data.desaturate region.zoom = data.zoom - if (data.overlays) then - region.overlays = CopyTable(data.overlays); + if data.overlays then + region.overlays = CopyTable(data.overlays) else region.overlays = {} end @@ -1113,92 +1106,92 @@ local function modify(parent, region, data) end -- Update texture settings - local texturePath = SharedMedia:Fetch("statusbar", data.texture) or ""; - bar:SetStatusBarTexture(texturePath); - bar:SetBackgroundColor(data.backgroundColor[1], data.backgroundColor[2], data.backgroundColor[3], data.backgroundColor[4]); + local texturePath = SharedMedia:Fetch("statusbar", data.texture) or "" + bar:SetStatusBarTexture(texturePath) + bar:SetBackgroundColor(data.backgroundColor[1], data.backgroundColor[2], data.backgroundColor[3], data.backgroundColor[4]) -- Update spark settings - WeakAuras.SetTextureOrAtlas(bar.spark, data.sparkTexture); - bar.spark:SetVertexColor(data.sparkColor[1], data.sparkColor[2], data.sparkColor[3], data.sparkColor[4]); - bar.spark:SetWidth(data.sparkWidth); - bar.spark:SetHeight(data.sparkHeight); - bar.spark.sparkHidden = data.spark and data.sparkHidden or "ALWAYS"; - bar.spark:SetBlendMode(data.sparkBlendMode); - bar.spark:SetDesaturated(data.sparkDesaturate); - bar.spark.sparkOffsetX = data.sparkOffsetX; - bar.spark.sparkOffsetY = data.sparkOffsetY; - bar.spark.sparkRotationMode = data.sparkRotationMode; - bar.spark.sparkRotation = data.sparkRotation; - bar.spark.sparkMirror = data.sparkMirror; + WeakAuras.SetTextureOrAtlas(bar.spark, data.sparkTexture) + bar.spark:SetVertexColor(data.sparkColor[1], data.sparkColor[2], data.sparkColor[3], data.sparkColor[4]) + bar.spark:SetWidth(data.sparkWidth) + bar.spark:SetHeight(data.sparkHeight) + bar.spark.sparkHidden = data.spark and data.sparkHidden or "ALWAYS" + bar.spark:SetBlendMode(data.sparkBlendMode) + bar.spark:SetDesaturated(data.sparkDesaturate) + bar.spark.sparkOffsetX = data.sparkOffsetX + bar.spark.sparkOffsetY = data.sparkOffsetY + bar.spark.sparkRotationMode = data.sparkRotationMode + bar.spark.sparkRotation = data.sparkRotation + bar.spark.sparkMirror = data.sparkMirror -- Color update function - region.Color = region.Color or function(self, r, g, b, a) - self.color_r = r; - self.color_g = g; - self.color_b = b; - self.color_a = a; - self.bar:SetForegroundColor(self.color_anim_r or r, self.color_anim_g or g, self.color_anim_b or b, self.color_anim_a or a); - end + region.Color = region.Color + or function(self, r, g, b, a) + self.color_r = r + self.color_g = g + self.color_b = b + self.color_a = a + self.bar:SetForegroundColor(self.color_anim_r or r, self.color_anim_g or g, self.color_anim_b or b, self.color_anim_a or a) + end region.ColorAnim = function(self, r, g, b, a) - self.color_anim_r = r; - self.color_anim_g = g; - self.color_anim_b = b; - self.color_anim_a = a; - self.bar:SetForegroundColor(r or self.color_r, g or self.color_g, b or self.color_b, a or self.color_a); + self.color_anim_r = r + self.color_anim_g = g + self.color_anim_b = b + self.color_anim_a = a + self.bar:SetForegroundColor(r or self.color_r, g or self.color_g, b or self.color_b, a or self.color_a) end region.GetColor = region.GetColor or function(self) return self.color_r, self.color_g, self.color_b, self.color_a end - region:Color(data.barColor[1], data.barColor[2], data.barColor[3], data.barColor[4]); + region:Color(data.barColor[1], data.barColor[2], data.barColor[3], data.barColor[4]) -- Rotate text - local textDegrees = data.rotateText == "LEFT" and 90 or data.rotateText == "RIGHT" and -90 or 0; + local textDegrees = data.rotateText == "LEFT" and 90 or data.rotateText == "RIGHT" and -90 or 0 -- Update icon visibility if region.iconVisible then -- Update icon - local iconsize = math.min(region.height, region.width); - icon:SetWidth(iconsize); - icon:SetHeight(iconsize); + local iconsize = math.min(region.height, region.width) + icon:SetWidth(iconsize) + icon:SetHeight(iconsize) region.bar.iconWidth = iconsize region.bar.iconHeight = iconsize - local texWidth = 0.25 * data.zoom; + local texWidth = 0.25 * data.zoom icon:SetTexCoord(GetTexCoordZoom(texWidth)) - icon:SetDesaturated(data.desaturate); - icon:SetVertexColor(data.icon_color[1], data.icon_color[2], data.icon_color[3], data.icon_color[4]); + icon:SetDesaturated(data.desaturate) + icon:SetVertexColor(data.icon_color[1], data.icon_color[2], data.icon_color[3], data.icon_color[4]) -- Update icon visibility - icon:Show(); - + icon:Show() else region.bar.iconWidth = 0 region.bar.iconHeight = 0 - icon:Hide(); + icon:Hide() end - region.inverseDirection = data.inverse; + region.inverseDirection = data.inverse -- Apply orientation alignment region:UpdateEffectiveOrientation() -- Update tooltip availability - local tooltipType = Private.CanHaveTooltip(data); + local tooltipType = Private.CanHaveTooltip(data) if tooltipType and data.useTooltip then -- Create and enable tooltip-hover frame if not region.tooltipFrame then - region.tooltipFrame = CreateFrame("Frame", nil, region); - region.tooltipFrame:SetAllPoints(icon); + region.tooltipFrame = CreateFrame("Frame", nil, region) + region.tooltipFrame:SetAllPoints(icon) region.tooltipFrame:SetScript("OnEnter", function() - Private.ShowMouseoverTooltip(region, region.tooltipFrame); - end); - region.tooltipFrame:SetScript("OnLeave", Private.HideTooltip); + Private.ShowMouseoverTooltip(region, region.tooltipFrame) + end) + region.tooltipFrame:SetScript("OnLeave", Private.HideTooltip) end - region.tooltipFrame:EnableMouse(true); + region.tooltipFrame:EnableMouse(true) elseif region.tooltipFrame then -- Disable tooltip - region.tooltipFrame:EnableMouse(false); + region.tooltipFrame:EnableMouse(false) end function region:UpdateMinMax() @@ -1211,7 +1204,7 @@ local function modify(parent, region, data) region.adjustedMinRel = region.adjustedMinRelPercent * duration end - min = region.adjustedMin or region.adjustedMinRel or 0; + min = region.adjustedMin or region.adjustedMinRel or 0 if duration == 0 then max = 0 @@ -1224,11 +1217,11 @@ local function modify(parent, region, data) max = duration end elseif state.progressType == "static" then - local total = state.total or 0; + local total = state.total or 0 if region.adjustedMinRelPercent then region.adjustedMinRel = region.adjustedMinRelPercent * total end - min = region.adjustedMin or region.adjustedMinRel or 0; + min = region.adjustedMin or region.adjustedMinRel or 0 if region.adjustedMax then max = region.adjustedMax @@ -1268,19 +1261,19 @@ local function modify(parent, region, data) region.TimerTick = TimerTick region:UpdateRegionHasTimerTick() end - expirationTime = state.expirationTime and state.expirationTime > 0 and state.expirationTime or math.huge; + expirationTime = state.expirationTime and state.expirationTime > 0 and state.expirationTime or math.huge end local duration = state.duration or 0 - region:SetTime(region.currentMax - region.currentMin, expirationTime - region.currentMin, state.inverse); + region:SetTime(region.currentMax - region.currentMin, expirationTime - region.currentMin, state.inverse) elseif state.progressType == "static" then if region.paused then region:Resume() end - local value = state.value or 0; - local total = state.total or 0; + local value = state.value or 0 + local total = state.total or 0 - region:SetValue(value - region.currentMin, region.currentMax - region.currentMin); + region:SetValue(value - region.currentMin, region.currentMax - region.currentMin) if region.TimerTick then region.TimerTick = nil region:UpdateRegionHasTimerTick() @@ -1299,20 +1292,20 @@ local function modify(parent, region, data) region:UpdateIcon() local duration = state.duration or 0 - local effectiveInverse = (state.inverse and not region.inverseDirection) or (not state.inverse and region.inverseDirection); - region.bar:SetAdditionalBars(state.additionalProgress, region.overlays, region.overlaysTexture, region.currentMin, region.currentMax, effectiveInverse, region.overlayclip); + local effectiveInverse = (state.inverse and not region.inverseDirection) or (not state.inverse and region.inverseDirection) + region.bar:SetAdditionalBars(state.additionalProgress, region.overlays, region.overlaysTexture, region.currentMin, region.currentMax, effectiveInverse, region.overlayclip) end -- Scale update function function region:Scale(scalex, scaley) - region.scalex = scalex; - region.scaley = scaley; + region.scalex = scalex + region.scaley = scaley -- Icon size - local iconsize = math.min(region.height, region.width); + local iconsize = math.min(region.height, region.width) -- Re-orientate region if scalex < 0 then - scalex = -scalex; + scalex = -scalex region.flipX = true else region.flipX = false @@ -1322,12 +1315,12 @@ local function modify(parent, region, data) self.bar.totalWidth = region.width * scalex self.bar.iconWidth = iconsize * scalex - self:SetWidth(self.bar.totalWidth); - icon:SetWidth(self.bar.iconWidth); + self:SetWidth(self.bar.totalWidth) + icon:SetWidth(self.bar.iconWidth) -- Re-orientate region if scaley < 0 then - scaley = -scaley; + scaley = -scaley region.flipY = true else region.flipY = false @@ -1336,15 +1329,15 @@ local function modify(parent, region, data) -- Update height self.bar.totalHeight = region.height * scaley self.bar.iconHeight = iconsize * scaley - self:SetHeight(self.bar.totalHeight); - icon:SetHeight(self.bar.iconHeight); + self:SetHeight(self.bar.totalHeight) + icon:SetHeight(self.bar.iconHeight) region:UpdateEffectiveOrientation() end -- region:Scale(1.0, 1.0); if data.smoothProgress then region.PreShow = function() - region.bar:ResetSmoothedValue(); + region.bar:ResetSmoothedValue() end else region.PreShow = nil @@ -1352,9 +1345,9 @@ local function modify(parent, region, data) region.smoothProgress = data.smoothProgress --- Update internal bar alignment - region.bar:Update(); + region.bar:Update() - WeakAuras.regionPrototype.modifyFinish(parent, region, data); + WeakAuras.regionPrototype.modifyFinish(parent, region, data) end local function validate(data) @@ -1371,4 +1364,4 @@ local function validate(data) end -- Register new region type with WeakAuras -WeakAuras.RegisterRegionType("aurabar", create, modify, default, GetProperties, validate); +WeakAuras.RegisterRegionType("aurabar", create, modify, default, GetProperties, validate) diff --git a/WeakAuras/RegionTypes/DynamicGroup.lua b/WeakAuras/RegionTypes/DynamicGroup.lua index 7be2f4099b..be514161e0 100644 --- a/WeakAuras/RegionTypes/DynamicGroup.lua +++ b/WeakAuras/RegionTypes/DynamicGroup.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, Private = ... local WeakAuras = WeakAuras @@ -8,8 +10,8 @@ local SharedMedia = LibStub("LibSharedMedia-3.0") local default = { controlledChildren = {}, border = false, - borderColor = {0, 0, 0, 1}, - backdropColor = {1, 1, 1, 0.5}, + borderColor = { 0, 0, 0, 1 }, + backdropColor = { 1, 1, 1, 0.5 }, borderEdge = "Square Full White", borderOffset = 4, borderInset = 1, @@ -38,12 +40,12 @@ local default = { gridType = "RD", gridWidth = 5, rowSpace = 1, - columnSpace = 1 + columnSpace = 1, } local controlPointFunctions = { ["SetAnchorPoint"] = function(self, point, relativeFrame, relativePoint, offsetX, offsetY) - self:ClearAllPoints(); + self:ClearAllPoints() self.point, self.relativeFrame, self.relativePoint, self.offsetX, self.offsetY = point, relativeFrame, relativePoint, offsetX, offsetY self.totalOffsetX = (self.animOffsetX or 0) + (self.offsetX or 0) self.totalOffsetY = (self.animOffsetY or 0) + (self.offsetY or 0) @@ -76,7 +78,7 @@ local controlPointFunctions = { else self:SetPoint(self.point, self.totalOffsetX, self.totalOffsetY) end - end + end, } local function createControlPoint(self) @@ -129,12 +131,12 @@ local function create(parent) end function WeakAuras.GetPolarCoordinates(x, y, originX, originY) - local dX, dY = x - originX, y - originY; + local dX, dY = x - originX, y - originY - local r = math.sqrt(dX * dX + dY * dY); - local theta = atan2(dY, dX); + local r = math.sqrt(dX * dX + dY * dY) + local theta = atan2(dY, dX) - return r, theta; + return r, theta end function WeakAuras.InvertSort(sortFunc) @@ -146,7 +148,9 @@ function WeakAuras.InvertSort(sortFunc) else return function(...) local result = sortFunc(...) - if result == nil then return nil end + if result == nil then + return nil + end return not result end end @@ -180,7 +184,7 @@ function WeakAuras.SortNilFirst(a, b) -- hence this special case return false else - return sortNilFirst(a,b) + return sortNilFirst(a, b) end end @@ -224,8 +228,12 @@ function WeakAuras.SortRegionData(path, sortFunc) return function(a, b) local aValue, bValue = a, b for _, key in ipairs(path) do - if type(aValue) ~= "table" then return nil end - if type(bValue) ~= "table" then return nil end + if type(aValue) ~= "table" then + return nil + end + if type(bValue) ~= "table" then + return nil + end aValue, bValue = aValue[key], bValue[key] end return sortFunc(aValue, bValue) @@ -268,18 +276,19 @@ local function noop() end local sorters = { none = function(data) - return WeakAuras.ComposeSorts( - WeakAuras.SortAscending({"dataIndex"}), - WeakAuras.SortAscending({"region", "state", "index"}) - ) + return WeakAuras.ComposeSorts(WeakAuras.SortAscending({ "dataIndex" }), WeakAuras.SortAscending({ "region", "state", "index" })) end, hybrid = function(data) local sortHybridTable = data.sortHybridTable or {} local hybridSortAscending = data.hybridSortMode == "ascending" local hybridFirst = data.hybridPosition == "hybridFirst" local function sortHybridStatus(a, b) - if not b then return true end - if not a then return false end + if not b then + return true + end + if not a then + return false + end local aIsHybrid = sortHybridTable[a.id] local bIsHybrid = sortHybridTable[b.id] @@ -294,27 +303,17 @@ local sorters = { end local sortExpirationTime if hybridSortAscending then - sortExpirationTime = WeakAuras.SortAscending({"region", "state", "expirationTime"}) + sortExpirationTime = WeakAuras.SortAscending({ "region", "state", "expirationTime" }) else - sortExpirationTime = WeakAuras.SortDescending({"region", "state", "expirationTime"}) + sortExpirationTime = WeakAuras.SortDescending({ "region", "state", "expirationTime" }) end - return WeakAuras.ComposeSorts( - sortHybridStatus, - sortExpirationTime, - WeakAuras.SortAscending({"dataIndex"}) - ) + return WeakAuras.ComposeSorts(sortHybridStatus, sortExpirationTime, WeakAuras.SortAscending({ "dataIndex" })) end, ascending = function(data) - return WeakAuras.ComposeSorts( - WeakAuras.SortAscending({"region", "state", "expirationTime"}), - WeakAuras.SortAscending({"dataIndex"}) - ) + return WeakAuras.ComposeSorts(WeakAuras.SortAscending({ "region", "state", "expirationTime" }), WeakAuras.SortAscending({ "dataIndex" })) end, descending = function(data) - return WeakAuras.ComposeSorts( - WeakAuras.SortDescending({"region", "state", "expirationTime"}), - WeakAuras.SortAscending({"dataIndex"}) - ) + return WeakAuras.ComposeSorts(WeakAuras.SortDescending({ "region", "state", "expirationTime" }), WeakAuras.SortAscending({ "dataIndex" })) end, custom = function(data) local sortStr = data.customSort or "" @@ -327,7 +326,7 @@ local sorters = { return result end end - end + end, } WeakAuras.SortFunctions = sorters @@ -403,7 +402,7 @@ local anchorers = { xpcall(anchorFunc, Private.GetErrorHandlerUid(data.uid, L["Custom Anchor"]), frames, activeRegions) Private.ActivateAuraEnvironment() end - end + end, } local function createAnchorPerUnitFunc(data) @@ -465,7 +464,7 @@ local growers = { for i, regionData in ipairs(regionDatas) do if i <= numVisible then newPositions[frame][regionData] = { x, y, true } - x = x + (regionData.dimensions.width) + space + x = x + regionData.dimensions.width + space y = y + stagger end end @@ -494,7 +493,7 @@ local growers = { if i <= numVisible then newPositions[frame][regionData] = { x, y, true } x = x + stagger - y = y + (regionData.dimensions.height) + space + y = y + regionData.dimensions.height + space end end end @@ -522,7 +521,7 @@ local growers = { if i <= numVisible then newPositions[frame][regionData] = { x, y, true } x = x + stagger - y = y - (regionData.dimensions.height) - space + y = y - regionData.dimensions.height - space end end end @@ -546,15 +545,15 @@ local growers = { local totalWidth = (numVisible - 1) * space for i = 1, numVisible do local regionData = regionDatas[i] - totalWidth = totalWidth + (regionData.dimensions.width) + totalWidth = totalWidth + regionData.dimensions.width end - local x, y = midX - totalWidth/2, midY - (stagger * (numVisible - 1)/2) + local x, y = midX - totalWidth / 2, midY - (stagger * (numVisible - 1) / 2) newPositions[frame] = {} for i, regionData in ipairs(regionDatas) do if i <= numVisible then - x = x + (regionData.dimensions.width) / 2 + x = x + regionData.dimensions.width / 2 newPositions[frame][regionData] = { x, y, true } - x = x + (regionData.dimensions.width) / 2 + space + x = x + regionData.dimensions.width / 2 + space y = y + stagger end end @@ -579,16 +578,16 @@ local growers = { local totalHeight = (numVisible - 1) * space for i = 1, numVisible do local regionData = regionDatas[i] - totalHeight = totalHeight + (regionData.dimensions.height) + totalHeight = totalHeight + regionData.dimensions.height end - local x, y = midX - (stagger * (numVisible - 1)/2), midY - totalHeight/2 + local x, y = midX - (stagger * (numVisible - 1) / 2), midY - totalHeight / 2 newPositions[frame] = {} for i, regionData in ipairs(regionDatas) do if i <= numVisible then - y = y + (regionData.dimensions.height) / 2 + y = y + regionData.dimensions.height / 2 newPositions[frame][regionData] = { x, y, true } x = x + stagger - y = y + (regionData.dimensions.height) / 2 + space + y = y + regionData.dimensions.height / 2 + space end end end @@ -714,7 +713,7 @@ local growers = { coord = 1, mul = colMul, space = colSpace, - current = 0 + current = 0, } local secondary = { -- y direction @@ -722,7 +721,7 @@ local growers = { coord = 2, mul = rowMul, space = rowSpace, - current = 0 + current = 0, } if not rowFirst then primary, secondary = secondary, primary @@ -768,7 +767,7 @@ local growers = { wipe(newPositions) end end - end + end, } WeakAuras.GrowFunctions = growers @@ -777,8 +776,7 @@ local function createGrowFunc(data) return grower(data) end -local nullErrorHandler = function() -end +local nullErrorHandler = function() end local function SafeGetPos(region, func) local ok, value1, value2 = xpcall(func, nullErrorHandler, region) @@ -802,18 +800,18 @@ local function modify(parent, region, data) left = data.borderInset, right = data.borderInset, top = data.borderInset, - bottom = data.borderInset, + bottom = data.borderInset, }, - }); - background:SetBackdropBorderColor(data.borderColor[1], data.borderColor[2], data.borderColor[3], data.borderColor[4]); - background:SetBackdropColor(data.backdropColor[1], data.backdropColor[2], data.backdropColor[3], data.backdropColor[4]); + }) + background:SetBackdropBorderColor(data.borderColor[1], data.borderColor[2], data.borderColor[3], data.borderColor[4]) + background:SetBackdropColor(data.backdropColor[1], data.backdropColor[2], data.backdropColor[3], data.backdropColor[4]) - background:ClearAllPoints(); + background:ClearAllPoints() background:SetPoint("bottomleft", region, "bottomleft", -1 * data.borderOffset, -1 * data.borderOffset) background:SetPoint("topright", region, "topright", data.borderOffset, data.borderOffset) - background:Show(); + background:Show() else - region.background:Hide(); + region.background:Hide() end function region:IsSuspended() @@ -863,7 +861,7 @@ local function modify(parent, region, data) cloneId = cloneID, dataIndex = dataIndex, controlPoint = controlPoint, - parent = region + parent = region, } if childData.regionType == "text" then @@ -877,10 +875,10 @@ local function modify(parent, region, data) region.controlledChildren[childID] = region.controlledChildren[childID] or {} region.controlledChildren[childID][cloneID] = controlPoint childRegion:SetAnchor(data.selfPoint, controlPoint, data.selfPoint) - if(childData.frameStrata == 1) then - childRegion:SetFrameStrata(region:GetFrameStrata()); + if childData.frameStrata == 1 then + childRegion:SetFrameStrata(region:GetFrameStrata()) else - childRegion:SetFrameStrata(Private.frame_strata_types[childData.frameStrata]); + childRegion:SetFrameStrata(Private.frame_strata_types[childData.frameStrata]) end Private.ApplyFrameLevel(childRegion) return regionData @@ -890,7 +888,9 @@ local function modify(parent, region, data) cloneID = cloneID or "" local controlPoint controlPoint = region.controlledChildren[childID] and region.controlledChildren[childID][cloneID] - if not controlPoint then return end + if not controlPoint then + return + end return controlPoint.regionData end @@ -946,10 +946,14 @@ local function modify(parent, region, data) return end local dataIndex = tIndexOf(data.controlledChildren, childID) - if not dataIndex then return end + if not dataIndex then + return + end local childData = WeakAuras.GetData(childID) local childRegion = WeakAuras.GetRegion(childID, cloneID) - if not childData or not childRegion then return end + if not childData or not childRegion then + return + end local regionData = createRegionData(childData, childRegion, childID, cloneID, dataIndex) if childRegion.toShow then tinsert(self.sortedChildren, regionData) @@ -965,7 +969,9 @@ local function modify(parent, region, data) if not regionData then return self:AddChild(childID, cloneID) end - if not regionData.region.toShow then return end + if not regionData.region.toShow then + return + end -- it's possible that while paused, we might get Activate, Deactivate, Activate on the same child -- so we need to check if this child has been updated since the last Sort -- if it has been, then don't insert it again @@ -980,7 +986,9 @@ local function modify(parent, region, data) -- removes something from the store. Mostly useful when a clone gets released -- so that we don't step on our own feet. local regionData = getRegionData(childID, cloneID) - if not regionData then return end + if not regionData then + return + end releaseRegionData(regionData) self.updatedChildren[regionData] = false self:SortUpdatedChildren() @@ -1020,8 +1028,7 @@ local function modify(parent, region, data) local j = i while j > 1 do local otherRegionData = self.sortedChildren[j - 1] - if not (active or self.updatedChildren[otherRegionData]) - or not self.sortFunc(regionData, otherRegionData) then + if not (active or self.updatedChildren[otherRegionData]) or not self.sortFunc(regionData, otherRegionData) then break else self.sortedChildren[j] = otherRegionData @@ -1067,15 +1074,17 @@ local function modify(parent, region, data) function region:DoPositionChildrenPerFrame(frame, positions, handledRegionData) for regionData, pos in pairs(positions) do if type(regionData) ~= "table" then - break; + break end handledRegionData[regionData] = true + -- stylua: ignore local x, y, show = type(pos[1]) == "number" and pos[1] or 0, type(pos[2]) == "number" and pos[2] or 0, type(pos[3]) ~= "boolean" and true or pos[3] local controlPoint = regionData.controlPoint controlPoint:ClearAnchorPoint() + -- stylua: ignore controlPoint:SetAnchorPoint( data.selfPoint, frame == "" and self.relativeTo or frame, @@ -1102,12 +1111,12 @@ local function modify(parent, region, data) if show and (abs(xDelta) > 0.01 or abs(yDelta) > 0.01) then local anim if data.grow == "CIRCLE" or data.grow == "COUNTERCIRCLE" then - local originX, originY = 0,0 + local originX, originY = 0, 0 local radius1, previousAngle = WeakAuras.GetPolarCoordinates(xPrev, yPrev, originX, originY) local radius2, newAngle = WeakAuras.GetPolarCoordinates(x, y, originX, originY) local dAngle = newAngle - previousAngle dAngle = ((dAngle > 180 and dAngle - 360) or (dAngle < -180 and dAngle + 360) or dAngle) - if(math.abs(radius1 - radius2) > 0.1) then + if math.abs(radius1 - radius2) > 0.1 then local translateFunc = [[ function(progress, _, _, previousAngle, dAngle) local previousRadius, dRadius = %f, %f; @@ -1152,7 +1161,7 @@ local function modify(parent, region, data) } end end - if not(anim) then + if not anim then anim = { type = "custom", duration = 0.2, @@ -1212,7 +1221,6 @@ local function modify(parent, region, data) self:Resize() end - function region:Resize() -- Resizes the dynamic group, for background and border purposes if not self:IsSuspended() then @@ -1225,11 +1233,12 @@ local function modify(parent, region, data) if regionData.shown then numVisible = numVisible + 1 local childRegion = regionData.region + -- stylua: ignore local regionLeft, regionRight, regionTop, regionBottom = SafeGetPos(childRegion, childRegion.GetLeft), SafeGetPos(childRegion, childRegion.GetRight), SafeGetPos(childRegion, childRegion.GetTop), SafeGetPos(childRegion, childRegion.GetBottom) - if(regionLeft and regionRight and regionTop and regionBottom) then + if regionLeft and regionRight and regionTop and regionBottom then minX = minX and min(regionLeft, minX) or regionLeft maxX = maxX and max(regionRight, maxX) or regionRight minY = minY and min(regionBottom, minY) or regionBottom diff --git a/WeakAuras/RegionTypes/Group.lua b/WeakAuras/RegionTypes/Group.lua index 77e6dd2a8c..ea9a7a84f1 100644 --- a/WeakAuras/RegionTypes/Group.lua +++ b/WeakAuras/RegionTypes/Group.lua @@ -1,7 +1,9 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, Private = ... -local SharedMedia = LibStub("LibSharedMedia-3.0"); +local SharedMedia = LibStub("LibSharedMedia-3.0") -- Default settings local default = { @@ -20,22 +22,22 @@ local default = { borderSize = 2, borderBackdrop = "Blizzard Tooltip", scale = 1, -}; +} -- Called when first creating a new region/display local function create(parent) -- Main region - local region = CreateFrame("Frame", nil, parent); + local region = CreateFrame("Frame", nil, parent) region.regionType = "group" - region:SetMovable(true); - region:SetWidth(2); - region:SetHeight(2); + region:SetMovable(true) + region:SetWidth(2) + region:SetHeight(2) -- Border region local border = CreateFrame("Frame", nil, region, "BackdropTemplate") - region.border = border; + region.border = border - WeakAuras.regionPrototype.create(region); + WeakAuras.regionPrototype.create(region) local oldSetFrameLevel = region.SetFrameLevel region.SetFrameLevel = function(self, level) @@ -43,105 +45,105 @@ local function create(parent) self.border:SetFrameLevel(level) end - return region; + return region end -- Calculate bounding box local function getRect(data, region) -- Temp variables - local blx, bly, trx, try; - blx, bly = data.xOffset or 0, data.yOffset or 0; + local blx, bly, trx, try + blx, bly = data.xOffset or 0, data.yOffset or 0 - local width = data.width or (region and region.width) - local height = data.height or (region and region.height) + local width = data.width or (region and region.width) + local height = data.height or (region and region.height) if width == nil or height == nil then - return blx, bly, blx, bly; + return blx, bly, blx, bly end -- Calc bounding box - if(data.selfPoint:find("LEFT")) then - trx = blx + width; - elseif(data.selfPoint:find("RIGHT")) then - trx = blx; - blx = blx - width; + if data.selfPoint:find("LEFT") then + trx = blx + width + elseif data.selfPoint:find("RIGHT") then + trx = blx + blx = blx - width else - blx = blx - (width/2); - trx = blx + width; + blx = blx - (width / 2) + trx = blx + width end - if(data.selfPoint:find("BOTTOM")) then - try = bly + height; - elseif(data.selfPoint:find("TOP")) then - try = bly; - bly = bly - height; + if data.selfPoint:find("BOTTOM") then + try = bly + height + elseif data.selfPoint:find("TOP") then + try = bly + bly = bly - height else - bly = bly - (height/2); - try = bly + height; + bly = bly - (height / 2) + try = bly + height end -- Return data - return blx, bly, trx, try; + return blx, bly, trx, try end -- Modify a given region/display local function modify(parent, region, data) if data.information.groupOffset then - data.selfPoint = "BOTTOMLEFT"; + data.selfPoint = "BOTTOMLEFT" else - data.selfPoint = "CENTER"; + data.selfPoint = "CENTER" end - WeakAuras.regionPrototype.modify(parent, region, data); + WeakAuras.regionPrototype.modify(parent, region, data) -- Localize - local border = region.border; + local border = region.border -- Scale region:SetScale(data.scale and data.scale > 0 and data.scale <= 10 and data.scale or 1) -- Get overall bounding box - local leftest, rightest, lowest, highest = 0, 0, 0, 0; + local leftest, rightest, lowest, highest = 0, 0, 0, 0 for child in Private.TraverseLeafs(data) do local childRegion = WeakAuras.GetRegion(child.id) - if(child) then - local blx, bly, trx, try = getRect(child, childRegion); - leftest = math.min(leftest, blx); - rightest = math.max(rightest, trx); - lowest = math.min(lowest, bly); - highest = math.max(highest, try); + if child then + local blx, bly, trx, try = getRect(child, childRegion) + leftest = math.min(leftest, blx) + rightest = math.max(rightest, trx) + lowest = math.min(lowest, bly) + highest = math.max(highest, try) end end - region.blx = leftest; - region.bly = lowest; - region.trx = rightest; - region.try = highest; + region.blx = leftest + region.bly = lowest + region.trx = rightest + region.try = highest -- Adjust frame-level sorting - Private.FixGroupChildrenOrderForGroup(data); + Private.FixGroupChildrenOrderForGroup(data) local hasDynamicSubGroups = false for index, childId in pairs(data.controlledChildren) do - local childData = WeakAuras.GetData(childId); + local childData = WeakAuras.GetData(childId) if childData.regionType == "dynamicgroup" then hasDynamicSubGroups = true - break; + break end end if not hasDynamicSubGroups then -- Control children (does not happen with "group") function region:UpdateBorder(childRegion) - local border = region.border; + local border = region.border -- Apply border settings if data.border then -- Initial visibility (of child that originated UpdateBorder(...)) - local childVisible = childRegion and childRegion.toShow or false; + local childVisible = childRegion and childRegion.toShow or false -- Scan children for visibility if not childVisible then for child in Private.TraverseLeafs(data) do - local childRegion = WeakAuras.regions[child.id] and WeakAuras.regions[child.id].region; + local childRegion = WeakAuras.regions[child.id] and WeakAuras.regions[child.id].region if childRegion and childRegion.toShow then - childVisible = true; - break; + childVisible = true + break end end end @@ -153,24 +155,24 @@ local function modify(parent, region, data) edgeSize = data.borderSize, bgFile = data.borderBackdrop ~= "None" and SharedMedia:Fetch("background", data.borderBackdrop) or "", insets = { - left = data.borderInset, - right = data.borderInset, - top = data.borderInset, - bottom = data.borderInset, + left = data.borderInset, + right = data.borderInset, + top = data.borderInset, + bottom = data.borderInset, }, - }); - border:SetBackdropBorderColor(data.borderColor[1], data.borderColor[2], data.borderColor[3], data.borderColor[4]); - border:SetBackdropColor(data.backdropColor[1], data.backdropColor[2], data.backdropColor[3], data.backdropColor[4]); - - border:ClearAllPoints(); - border:SetPoint("bottomleft", region, "bottomleft", leftest-data.borderOffset, lowest-data.borderOffset); - border:SetPoint("topright", region, "topright", rightest+data.borderOffset, highest+data.borderOffset); - border:Show(); + }) + border:SetBackdropBorderColor(data.borderColor[1], data.borderColor[2], data.borderColor[3], data.borderColor[4]) + border:SetBackdropColor(data.backdropColor[1], data.backdropColor[2], data.backdropColor[3], data.backdropColor[4]) + + border:ClearAllPoints() + border:SetPoint("bottomleft", region, "bottomleft", leftest - data.borderOffset, lowest - data.borderOffset) + border:SetPoint("topright", region, "topright", rightest + data.borderOffset, highest + data.borderOffset) + border:Show() else - border:Hide(); + border:Hide() end else - border:Hide(); + border:Hide() end end region:UpdateBorder() @@ -179,8 +181,8 @@ local function modify(parent, region, data) region.border:Hide() end - WeakAuras.regionPrototype.modifyFinish(parent, region, data); + WeakAuras.regionPrototype.modifyFinish(parent, region, data) end -- Register new region type with WeakAuras -WeakAuras.RegisterRegionType("group", create, modify, default); +WeakAuras.RegisterRegionType("group", create, modify, default) diff --git a/WeakAuras/RegionTypes/Icon.lua b/WeakAuras/RegionTypes/Icon.lua index e51b86d747..74ef271fd6 100644 --- a/WeakAuras/RegionTypes/Icon.lua +++ b/WeakAuras/RegionTypes/Icon.lua @@ -1,10 +1,12 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, Private = ... local L = WeakAuras.L -local MSQ = LibStub("Masque", true); +local MSQ = LibStub("Masque", true) if MSQ then - MSQ:AddType("WA_Aura", {"Icon", "Cooldown"}) + MSQ:AddType("WA_Aura", { "Icon", "Cooldown" }) end -- WoW API @@ -17,7 +19,7 @@ local default = { inverse = false, width = 64, height = 64, - color = {1, 1, 1, 1}, + color = { 1, 1, 1, 1 }, selfPoint = "CENTER", anchorPoint = "CENTER", anchorFrameType = "SCREEN", @@ -30,12 +32,12 @@ local default = { cooldownTextDisabled = false, cooldownSwipe = true, cooldownEdge = false, - useCooldownModRate = true -}; + useCooldownModRate = true, +} -WeakAuras.regionPrototype.AddAlphaToDefault(default); +WeakAuras.regionPrototype.AddAlphaToDefault(default) -local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ceil(GetScreenHeight() / 20) * 20; +local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ceil(GetScreenHeight() / 20) * 20 local properties = { desaturate = { @@ -50,7 +52,7 @@ local properties = { min = 1, softMax = screenWidth, bigStep = 1, - default = 32 + default = 32, }, height = { display = L["Height"], @@ -59,30 +61,30 @@ local properties = { min = 1, softMax = screenHeight, bigStep = 1, - default = 32 + default = 32, }, color = { display = L["Color"], setter = "Color", - type = "color" + type = "color", }, inverse = { display = L["Inverse"], setter = "SetInverse", - type = "bool" + type = "bool", }, cooldownSwipe = { - display = { L["Cooldown"], L["Swipe"], true}, + display = { L["Cooldown"], L["Swipe"], true }, setter = "SetCooldownSwipe", type = "bool", }, cooldownEdge = { - display = { L["Cooldown"], L["Edge"]}, + display = { L["Cooldown"], L["Edge"] }, setter = "SetCooldownEdge", type = "bool", }, cooldownText = { - display = { L["Cooldown"], L["Hide Timer Text"]}, + display = { L["Cooldown"], L["Hide Timer Text"] }, setter = "SetHideCountdownNumbers", type = "bool", }, @@ -94,22 +96,22 @@ local properties = { max = 1, step = 0.01, default = 0, - isPercent = true + isPercent = true, }, iconSource = { - display = {L["Icon"], L["Source"]}, + display = { L["Icon"], L["Source"] }, setter = "SetIconSource", type = "list", - values = {} + values = {}, }, displayIcon = { - display = {L["Icon"], L["Fallback"]}, + display = { L["Icon"], L["Fallback"] }, setter = "SetIcon", type = "icon", - } -}; + }, +} -WeakAuras.regionPrototype.AddProperties(properties, default); +WeakAuras.regionPrototype.AddProperties(properties, default) local function GetProperties(data) local result = CopyTable(properties) @@ -124,18 +126,20 @@ local function GetTexCoord(region, texWidth, aspectRatio) local db = region.MSQGroup.db if db and not db.Disabled then usesMasque = true - region.currentCoord[1], region.currentCoord[2], region.currentCoord[3], region.currentCoord[4], region.currentCoord[5], region.currentCoord[6], region.currentCoord[7], region.currentCoord[8] = region.icon:GetTexCoord() + region.currentCoord[1], region.currentCoord[2], region.currentCoord[3], region.currentCoord[4], region.currentCoord[5], region.currentCoord[6], region.currentCoord[7], region.currentCoord[8] = + region.icon:GetTexCoord() end end - if (not usesMasque) then - region.currentCoord[1], region.currentCoord[2], region.currentCoord[3], region.currentCoord[4], region.currentCoord[5], region.currentCoord[6], region.currentCoord[7], region.currentCoord[8] = 0, 0, 0, 1, 1, 0, 1, 1; + if not usesMasque then + region.currentCoord[1], region.currentCoord[2], region.currentCoord[3], region.currentCoord[4], region.currentCoord[5], region.currentCoord[6], region.currentCoord[7], region.currentCoord[8] = + 0, 0, 0, 1, 1, 0, 1, 1 end - local xRatio = aspectRatio < 1 and aspectRatio or 1; - local yRatio = aspectRatio > 1 and 1 / aspectRatio or 1; + local xRatio = aspectRatio < 1 and aspectRatio or 1 + local yRatio = aspectRatio > 1 and 1 / aspectRatio or 1 for i, coord in ipairs(region.currentCoord) do - local aspectRatio = (i % 2 == 1) and xRatio or yRatio; - region.currentCoord[i] = (coord - 0.5) * texWidth * aspectRatio + 0.5; + local aspectRatio = (i % 2 == 1) and xRatio or yRatio + region.currentCoord[i] = (coord - 0.5) * texWidth * aspectRatio + 0.5 end return unpack(region.currentCoord) @@ -181,17 +185,17 @@ local function AnchorSubRegion(self, subRegion, anchorType, selfPoint, anchorPoi end local function create(parent, data) - local font = "GameFontHighlight"; + local font = "GameFontHighlight" - local region = CreateFrame("Frame", nil, parent); + local region = CreateFrame("Frame", nil, parent) region.regionType = "icon" - region:SetMovable(true); - region:SetResizable(true); - region:SetMinResize(1, 1); + region:SetMovable(true) + region:SetResizable(true) + region:SetMinResize(1, 1) function region.UpdateInnerOuterSize() - local width = region.width * math.abs(region.scalex); - local height = region.height * math.abs(region.scaley); + local width = region.width * math.abs(region.scalex) + local height = region.height * math.abs(region.scaley) local iconWidth local iconHeight @@ -216,61 +220,61 @@ local function create(parent, data) if MSQ then button = CreateFrame("Button", nil, region) button.data = data - region.button = button; - button:EnableMouse(false); - button:Disable(); - button:SetAllPoints(); + region.button = button + button:EnableMouse(false) + button:Disable() + button:SetAllPoints() end - local icon = region:CreateTexture(nil, "BACKGROUND"); + local icon = region:CreateTexture(nil, "BACKGROUND") icon:SetSnapToPixelGrid(false) icon:SetTexelSnappingBias(0) if MSQ then - icon:SetAllPoints(button); - button:SetScript("OnSizeChanged", region.UpdateInnerOuterSize); + icon:SetAllPoints(button) + button:SetScript("OnSizeChanged", region.UpdateInnerOuterSize) else - icon:SetAllPoints(region); - region:SetScript("OnSizeChanged", region.UpdateInnerOuterSize); + icon:SetAllPoints(region) + region:SetScript("OnSizeChanged", region.UpdateInnerOuterSize) end - region.icon = icon; - icon:SetTexture("Interface\\Icons\\INV_Misc_QuestionMark"); + region.icon = icon + icon:SetTexture("Interface\\Icons\\INV_Misc_QuestionMark") --This section creates a unique frame id for the cooldown frame so that it can be created with a global reference --The reason is so that WeakAuras cooldown frames can interact properly with OmniCC (i.e., put on its ignore list for timer overlays) - local id = data.id; - local frameId = id:lower():gsub(" ", "_"); - if(_G["WeakAurasCooldown"..frameId]) then - local baseFrameId = frameId; - local num = 2; - while(_G["WeakAurasCooldown"..frameId]) do - frameId = baseFrameId..num; - num = num + 1; + local id = data.id + local frameId = id:lower():gsub(" ", "_") + if _G["WeakAurasCooldown" .. frameId] then + local baseFrameId = frameId + local num = 2 + while _G["WeakAurasCooldown" .. frameId] do + frameId = baseFrameId .. num + num = num + 1 end end - region.frameId = frameId; + region.frameId = frameId - local cooldown = CreateFrame("Cooldown", "WeakAurasCooldown"..frameId, region, "CooldownFrameTemplate"); - region.cooldown = cooldown; - cooldown:SetAllPoints(icon); + local cooldown = CreateFrame("Cooldown", "WeakAurasCooldown" .. frameId, region, "CooldownFrameTemplate") + region.cooldown = cooldown + cooldown:SetAllPoints(icon) cooldown:SetDrawBling(false) cooldown.SetDrawSwipeOrg = cooldown.SetDrawSwipe cooldown.SetDrawSwipe = function() end - local SetFrameLevel = region.SetFrameLevel; + local SetFrameLevel = region.SetFrameLevel function region.SetFrameLevel(self, level) - SetFrameLevel(region, level); - cooldown:SetFrameLevel(level); + SetFrameLevel(region, level) + cooldown:SetFrameLevel(level) if button then - button:SetFrameLevel(level); + button:SetFrameLevel(level) end end - WeakAuras.regionPrototype.create(region); + WeakAuras.regionPrototype.create(region) region.AnchorSubRegion = AnchorSubRegion - return region; + return region end local function modify(parent, region, data) @@ -278,71 +282,71 @@ local function modify(parent, region, data) region.stacks = nil region.text2 = nil - WeakAuras.regionPrototype.modify(parent, region, data); + WeakAuras.regionPrototype.modify(parent, region, data) - local button, icon, cooldown = region.button, region.icon, region.cooldown; + local button, icon, cooldown = region.button, region.icon, region.cooldown region.iconSource = data.iconSource region.displayIcon = data.displayIcon if MSQ then - local masqueId = data.id:lower():gsub(" ", "_"); + local masqueId = data.id:lower():gsub(" ", "_") if region.masqueId ~= masqueId then region.masqueId = masqueId - region.MSQGroup = MSQ:Group("WeakAuras", region.masqueId, data.uid); + region.MSQGroup = MSQ:Group("WeakAuras", region.masqueId, data.uid) region.MSQGroup:SetName(data.id) - region.MSQGroup:AddButton(button, {Icon = icon, Cooldown = cooldown}, "WA_Aura", true); + region.MSQGroup:AddButton(button, { Icon = icon, Cooldown = cooldown }, "WA_Aura", true) button.data = data end end function region:UpdateSize() - local width = region.width * math.abs(region.scalex); - local height = region.height * math.abs(region.scaley); - region:SetWidth(width); - region:SetHeight(height); + local width = region.width * math.abs(region.scalex) + local height = region.height * math.abs(region.scaley) + region:SetWidth(width) + region:SetHeight(height) if MSQ then - button:SetWidth(width); - button:SetHeight(height); - button:SetAllPoints(); + button:SetWidth(width) + button:SetHeight(height) + button:SetAllPoints() end - region:UpdateTexCoords(); + region:UpdateTexCoords() end function region:UpdateTexCoords() - local mirror_h = region.scalex < 0; - local mirror_v = region.scaley < 0; + local mirror_h = region.scalex < 0 + local mirror_v = region.scaley < 0 - local texWidth = 1 - 0.5 * region.zoom; + local texWidth = 1 - 0.5 * region.zoom local aspectRatio if not region.keepAspectRatio then - aspectRatio = 1; + aspectRatio = 1 else - local width = region.width * math.abs(region.scalex); - local height = region.height * math.abs(region.scaley); + local width = region.width * math.abs(region.scalex) + local height = region.height * math.abs(region.scaley) if width == 0 or height == 0 then - aspectRatio = 1; + aspectRatio = 1 else - aspectRatio = width / height; + aspectRatio = width / height end end if region.MSQGroup then region.MSQGroup:RemoveButton(button) - region.MSQGroup:AddButton(button, {Icon = icon, Cooldown = cooldown}, "WA_Aura", true) + region.MSQGroup:AddButton(button, { Icon = icon, Cooldown = cooldown }, "WA_Aura", true) end local ulx, uly, llx, lly, urx, ury, lrx, lry = GetTexCoord(region, texWidth, aspectRatio) - if(mirror_h) then - if(mirror_v) then + if mirror_h then + if mirror_v then icon:SetTexCoord(lrx, lry, urx, ury, llx, lly, ulx, uly) else icon:SetTexCoord(urx, ury, lrx, lry, ulx, uly, llx, lly) end else - if(mirror_v) then + if mirror_v then icon:SetTexCoord(llx, lly, ulx, uly, lrx, lry, urx, ury) else icon:SetTexCoord(ulx, uly, llx, lly, urx, ury, lrx, lry) @@ -350,35 +354,35 @@ local function modify(parent, region, data) end end - region.width = data.width; - region.height = data.height; - region.scalex = 1; - region.scaley = 1; - region.keepAspectRatio = data.keepAspectRatio; - region.zoom = data.zoom; + region.width = data.width + region.height = data.height + region.scalex = 1 + region.scaley = 1 + region.keepAspectRatio = data.keepAspectRatio + region.zoom = data.zoom region:UpdateSize() - icon:SetDesaturated(data.desaturate); + icon:SetDesaturated(data.desaturate) - local tooltipType = Private.CanHaveTooltip(data); - if(tooltipType and data.useTooltip) then + local tooltipType = Private.CanHaveTooltip(data) + if tooltipType and data.useTooltip then if not region.tooltipFrame then - region.tooltipFrame = CreateFrame("Frame", nil, region); - region.tooltipFrame:SetAllPoints(region); + region.tooltipFrame = CreateFrame("Frame", nil, region) + region.tooltipFrame:SetAllPoints(region) region.tooltipFrame:SetScript("OnEnter", function() - Private.ShowMouseoverTooltip(region, region); - end); - region.tooltipFrame:SetScript("OnLeave", Private.HideTooltip); + Private.ShowMouseoverTooltip(region, region) + end) + region.tooltipFrame:SetScript("OnLeave", Private.HideTooltip) end - region.tooltipFrame:EnableMouse(true); + region.tooltipFrame:EnableMouse(true) elseif region.tooltipFrame then - region.tooltipFrame:EnableMouse(false); + region.tooltipFrame:EnableMouse(false) end - cooldown:SetReverse(not data.inverse); + cooldown:SetReverse(not data.inverse) function region:SetHideCountdownNumbers(cooldownTextDisabled) - cooldown:SetHideCountdownNumbers(cooldownTextDisabled); + cooldown:SetHideCountdownNumbers(cooldownTextDisabled) if OmniCC and OmniCC.Cooldown and OmniCC.Cooldown.SetNoCooldownCount then OmniCC.Cooldown.SetNoCooldownCount(cooldown, cooldownTextDisabled) end @@ -386,39 +390,38 @@ local function modify(parent, region, data) region:SetHideCountdownNumbers(data.cooldownTextDisabled) function region:Color(r, g, b, a) - region.color_r = r; - region.color_g = g; - region.color_b = b; - region.color_a = a; - if (r or g or b) then - a = a or 1; + region.color_r = r + region.color_g = g + region.color_b = b + region.color_a = a + if r or g or b then + a = a or 1 end - icon:SetVertexColor(region.color_anim_r or r, region.color_anim_g or g, region.color_anim_b or b, region.color_anim_a or a); + icon:SetVertexColor(region.color_anim_r or r, region.color_anim_g or g, region.color_anim_b or b, region.color_anim_a or a) if region.button then - region.button:SetAlpha(region.color_anim_a or a or 1); + region.button:SetAlpha(region.color_anim_a or a or 1) end end function region:ColorAnim(r, g, b, a) - region.color_anim_r = r; - region.color_anim_g = g; - region.color_anim_b = b; - region.color_anim_a = a; - if (r or g or b) then - a = a or 1; + region.color_anim_r = r + region.color_anim_g = g + region.color_anim_b = b + region.color_anim_a = a + if r or g or b then + a = a or 1 end - icon:SetVertexColor(r or region.color_r, g or region.color_g, b or region.color_b, a or region.color_a); + icon:SetVertexColor(r or region.color_r, g or region.color_g, b or region.color_b, a or region.color_a) if MSQ then - region.button:SetAlpha(a or region.color_a or 1); + region.button:SetAlpha(a or region.color_a or 1) end end function region:GetColor() - return region.color_r or data.color[1], region.color_g or data.color[2], - region.color_b or data.color[3], region.color_a or data.color[4]; + return region.color_r or data.color[1], region.color_g or data.color[2], region.color_b or data.color[3], region.color_a or data.color[4] end - region:Color(data.color[1], data.color[2], data.color[3], data.color[4]); + region:Color(data.color[1], data.color[2], data.color[3], data.color[4]) function region:SetIcon(iconPath) if self.displayIcon == iconPath then @@ -458,91 +461,89 @@ local function modify(parent, region, data) if region.scalex == scalex and region.scaley == scaley then return end - region.scalex = scalex; - region.scaley = scaley; - region:UpdateSize(); + region.scalex = scalex + region.scaley = scaley + region:UpdateSize() end function region:SetDesaturated(b) - icon:SetDesaturated(b); + icon:SetDesaturated(b) end function region:SetRegionWidth(width) region.width = width - region:UpdateSize(); + region:UpdateSize() end function region:SetRegionHeight(height) region.height = height - region:UpdateSize(); + region:UpdateSize() end function region:SetInverse(inverse) - cooldown:SetReverse(not inverse); - if (cooldown.expirationTime and cooldown.duration and cooldown:IsShown()) then + cooldown:SetReverse(not inverse) + if cooldown.expirationTime and cooldown.duration and cooldown:IsShown() then -- WORKAROUND SetReverse not applying until next frame - cooldown:SetCooldown(0, 0); - cooldown:SetCooldown(cooldown.expirationTime - cooldown.duration, - cooldown.duration, - cooldown.useCooldownModRate and cooldown.modRate); + cooldown:SetCooldown(0, 0) + cooldown:SetCooldown(cooldown.expirationTime - cooldown.duration, cooldown.duration, cooldown.useCooldownModRate and cooldown.modRate) end end function region:SetCooldownSwipe(cooldownSwipe) - region.cooldownSwipe = cooldownSwipe; - cooldown:SetDrawSwipeOrg(cooldownSwipe); + region.cooldownSwipe = cooldownSwipe + cooldown:SetDrawSwipeOrg(cooldownSwipe) end function region:SetCooldownEdge(cooldownEdge) - region.cooldownEdge = cooldownEdge; - cooldown:SetDrawEdge(cooldownEdge); + region.cooldownEdge = cooldownEdge + cooldown:SetDrawEdge(cooldownEdge) end region:SetCooldownSwipe(data.cooldownSwipe) region:SetCooldownEdge(data.cooldownEdge) function region:SetZoom(zoom) - region.zoom = zoom; - region:UpdateTexCoords(); + region.zoom = zoom + region:UpdateTexCoords() end - cooldown.expirationTime = nil; - cooldown.duration = nil; + cooldown.expirationTime = nil + cooldown.duration = nil cooldown.modRate = nil cooldown.useCooldownModRate = data.useCooldownModRate cooldown:Hide() - if(data.cooldown) then + if data.cooldown then function region:SetValue(value, total) cooldown.value = value cooldown.total = total cooldown.modRate = nil - if (value >= 0 and value <= total) then + if value >= 0 and value <= total then cooldown:Show() cooldown:SetCooldown(GetTime() - (total - value), total) else - cooldown:Hide(); + cooldown:Hide() end end function region:SetTime(duration, expirationTime, modRate) - if (duration > 0 and expirationTime > GetTime()) then - cooldown:Show(); - cooldown.expirationTime = expirationTime; - cooldown.duration = duration; - cooldown.modRate = modRate; - cooldown:SetCooldown(expirationTime - duration, duration, cooldown.useCooldownModRate and modRate); + if duration > 0 and expirationTime > GetTime() then + cooldown:Show() + cooldown.expirationTime = expirationTime + cooldown.duration = duration + cooldown.modRate = modRate + cooldown:SetCooldown(expirationTime - duration, duration, cooldown.useCooldownModRate and modRate) else - cooldown.expirationTime = expirationTime; - cooldown.duration = duration; - cooldown.modRate = modRate; - cooldown:Hide(); + cooldown.expirationTime = expirationTime + cooldown.duration = duration + cooldown.modRate = modRate + cooldown:Hide() end end function region:PreShow() - if (cooldown.duration and cooldown.duration > 0.01) then - cooldown:Show(); - cooldown:SetCooldown(cooldown.expirationTime - cooldown.duration, cooldown.duration, cooldown.useCooldownModRate and cooldown.modRate); + if cooldown.duration and cooldown.duration > 0.01 then + cooldown:Show() + cooldown:SetCooldown(cooldown.expirationTime - cooldown.duration, cooldown.duration, cooldown.useCooldownModRate and cooldown.modRate) cooldown:Resume() end end @@ -562,14 +563,14 @@ local function modify(parent, region, data) region:Resume() end cooldown:Resume() - expirationTime = state.expirationTime and state.expirationTime > 0 and state.expirationTime or math.huge; + expirationTime = state.expirationTime and state.expirationTime > 0 and state.expirationTime or math.huge end local duration = state.duration or 0 if region.adjustedMinRelPercent then region.adjustedMinRel = region.adjustedMinRelPercent * duration end - local adjustMin = region.adjustedMin or region.adjustedMinRel or 0; + local adjustMin = region.adjustedMin or region.adjustedMinRel or 0 local max if duration == 0 then @@ -583,16 +584,16 @@ local function modify(parent, region, data) max = duration end - region:SetTime(max - adjustMin, expirationTime - adjustMin, state.modRate); + region:SetTime(max - adjustMin, expirationTime - adjustMin, state.modRate) elseif state.progressType == "static" then - local value = state.value or 0; - local total = state.total or 0; + local value = state.value or 0 + local total = state.total or 0 if region.adjustedMinRelPercent then region.adjustedMinRel = region.adjustedMinRelPercent * total end - local adjustMin = region.adjustedMin or region.adjustedMinRel or 0; - local max = region.adjustedMax or region.adjustedMaxRel or total; - region:SetValue(value - adjustMin, max - adjustMin); + local adjustMin = region.adjustedMin or region.adjustedMinRel or 0 + local max = region.adjustedMax or region.adjustedMaxRel or total + region:SetValue(value - adjustMin, max - adjustMin) cooldown:Pause() else region:SetTime(0, math.huge) @@ -619,7 +620,7 @@ local function modify(parent, region, data) end end - WeakAuras.regionPrototype.modifyFinish(parent, region, data); + WeakAuras.regionPrototype.modifyFinish(parent, region, data) --- WORKAROUND -- This fixes a issue with barmodels not appearing on icons if the diff --git a/WeakAuras/RegionTypes/Model.lua b/WeakAuras/RegionTypes/Model.lua index d3c77135e8..d9ad7d1f44 100644 --- a/WeakAuras/RegionTypes/Model.lua +++ b/WeakAuras/RegionTypes/Model.lua @@ -1,8 +1,10 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, Private = ... -local SharedMedia = LibStub("LibSharedMedia-3.0"); -local L = WeakAuras.L; +local SharedMedia = LibStub("LibSharedMedia-3.0") +local L = WeakAuras.L -- Default settings local default = { @@ -34,16 +36,16 @@ local default = { yOffset = 0, frameStrata = 1, border = false, - borderColor = {1.0, 1.0, 1.0, 0.5}, - backdropColor = {1.0, 1.0, 1.0, 0.5}, + borderColor = { 1.0, 1.0, 1.0, 0.5 }, + backdropColor = { 1.0, 1.0, 1.0, 0.5 }, borderEdge = "None", borderOffset = 5, borderInset = 11, borderSize = 16, - borderBackdrop = "Blizzard Tooltip" -}; + borderBackdrop = "Blizzard Tooltip", +} -local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ceil(GetScreenHeight() / 20) * 20; +local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ceil(GetScreenHeight() / 20) * 20 local properties = { width = { @@ -53,7 +55,7 @@ local properties = { min = 1, softMax = screenWidth, bigStep = 1, - default = 32 + default = 32, }, height = { display = L["Height"], @@ -62,43 +64,43 @@ local properties = { min = 1, softMax = screenHeight, bigStep = 1, - default = 32 + default = 32, }, } -WeakAuras.regionPrototype.AddProperties(properties, default); +WeakAuras.regionPrototype.AddProperties(properties, default) local function GetProperties(data) - return properties; + return properties end local regionFunctions = { - Update = function() end + Update = function() end, } -- Called when first creating a new region/display local function create(parent) -- Main region - local region = CreateFrame("Frame", nil, UIParent); + local region = CreateFrame("Frame", nil, UIParent) region.regionType = "model" - region:SetMovable(true); - region:SetResizable(true); - region:SetMinResize(1, 1); + region:SetMovable(true) + region:SetResizable(true) + region:SetMinResize(1, 1) -- Border region - local border = CreateFrame("Frame", nil, region, "BackdropTemplate"); - region.border = border; + local border = CreateFrame("Frame", nil, region, "BackdropTemplate") + region.border = border - WeakAuras.regionPrototype.create(region); + WeakAuras.regionPrototype.create(region) - for k, v in pairs (regionFunctions) do + for k, v in pairs(regionFunctions) do region[k] = v end region.AnchorSubRegion = WeakAuras.regionPrototype.AnchorSubRegion -- Return complete region - return region; + return region end local function CreateModel() @@ -120,19 +122,26 @@ local function ConfigureModel(region, model, data) -- Adjust model WeakAuras.SetModel(model, data.model_path, data.model_fileId, data.modelIsUnit, data.modelDisplayInfo) - model:SetPortraitZoom(data.portraitZoom and 1 or 0); + model:SetPortraitZoom(data.portraitZoom and 1 or 0) model:ClearTransform() - if (data.api) then + if data.api then model:MakeCurrentCameraCustom() - model:SetTransform(data.model_st_tx / 1000, data.model_st_ty / 1000, data.model_st_tz / 1000, - rad(data.model_st_rx), rad(data.model_st_ry), rad(region.rotation), data.model_st_us / 1000); + model:SetTransform( + data.model_st_tx / 1000, + data.model_st_ty / 1000, + data.model_st_tz / 1000, + rad(data.model_st_rx), + rad(data.model_st_ry), + rad(region.rotation), + data.model_st_us / 1000 + ) else - model:SetPosition(data.model_z, data.model_x, data.model_y); - model:SetFacing(rad(region.rotation)); + model:SetPosition(data.model_z, data.model_x, data.model_y) + model:SetFacing(rad(region.rotation)) end if data.modelIsUnit then - model:RegisterEvent("UNIT_MODEL_CHANGED"); + model:RegisterEvent("UNIT_MODEL_CHANGED") local unit if not WeakAuras.IsRetail() then @@ -141,30 +150,29 @@ local function ConfigureModel(region, model, data) unit = data.model_fileId end - if (unit == "target") then - model:RegisterEvent("PLAYER_TARGET_CHANGED"); + if unit == "target" then + model:RegisterEvent("PLAYER_TARGET_CHANGED") elseif not WeakAuras.IsClassic() and unit == "focus" then - model:RegisterEvent("PLAYER_FOCUS_CHANGED"); + model:RegisterEvent("PLAYER_FOCUS_CHANGED") end model:SetScript("OnEvent", function(self, event, unitId) - Private.StartProfileSystem("model"); - if (event ~= "UNIT_MODEL_CHANGED" or UnitIsUnit(unitId, unit)) then + Private.StartProfileSystem("model") + if event ~= "UNIT_MODEL_CHANGED" or UnitIsUnit(unitId, unit) then WeakAuras.SetModel(model, data.model_path, data.model_fileId, data.modelIsUnit, data.modelDisplayInfo) end - Private.StopProfileSystem("model"); - end - ); + Private.StopProfileSystem("model") + end) else - model:UnregisterEvent("UNIT_MODEL_CHANGED"); - model:UnregisterEvent("PLAYER_TARGET_CHANGED"); + model:UnregisterEvent("UNIT_MODEL_CHANGED") + model:UnregisterEvent("PLAYER_TARGET_CHANGED") if not WeakAuras.IsClassic() then - model:UnregisterEvent("PLAYER_FOCUS_CHANGED"); + model:UnregisterEvent("PLAYER_FOCUS_CHANGED") end - model:SetScript("OnEvent", nil); + model:SetScript("OnEvent", nil) end -- Enable model animation - if(data.advance and model:HasAnimation(data.sequence)) then + if data.advance and model:HasAnimation(data.sequence) then model:SetAnimation(data.sequence) else model:SetAnimation(0) @@ -181,21 +189,21 @@ end local function ReleaseModel(model) model:SetKeepModelOnHide(false) model:Hide() - model:UnregisterEvent("UNIT_MODEL_CHANGED"); - model:UnregisterEvent("PLAYER_TARGET_CHANGED"); + model:UnregisterEvent("UNIT_MODEL_CHANGED") + model:UnregisterEvent("PLAYER_TARGET_CHANGED") if not WeakAuras.IsClassic() then - model:UnregisterEvent("PLAYER_FOCUS_CHANGED"); + model:UnregisterEvent("PLAYER_FOCUS_CHANGED") end - model:SetScript("OnEvent", nil); + model:SetScript("OnEvent", nil) local pool = model.api and poolNewApi or poolOldApi pool:Release(model) end -- Modify a given region/display local function modify(parent, region, data) - WeakAuras.regionPrototype.modify(parent, region, data); + WeakAuras.regionPrototype.modify(parent, region, data) -- Localize - local border = region.border; + local border = region.border if region.model then ReleaseModel(region.model) @@ -203,12 +211,12 @@ local function modify(parent, region, data) end -- Reset position and size - region:SetWidth(data.width); - region:SetHeight(data.height); - region.width = data.width; - region.height = data.height; - region.scalex = 1; - region.scaley = 1; + region:SetWidth(data.width) + region:SetHeight(data.height) + region.width = data.width + region.height = data.height + region.scalex = 1 + region.scaley = 1 -- Update border if data.border then @@ -217,72 +225,79 @@ local function modify(parent, region, data) edgeSize = data.borderSize, bgFile = SharedMedia:Fetch("background", data.borderBackdrop), insets = { - left = data.borderInset, - right = data.borderInset, - top = data.borderInset, - bottom = data.borderInset, + left = data.borderInset, + right = data.borderInset, + top = data.borderInset, + bottom = data.borderInset, }, - }); - border:SetBackdropBorderColor(data.borderColor[1], data.borderColor[2], data.borderColor[3], data.borderColor[4]); - border:SetBackdropColor(data.backdropColor[1], data.backdropColor[2], data.backdropColor[3], data.backdropColor[4]); + }) + border:SetBackdropBorderColor(data.borderColor[1], data.borderColor[2], data.borderColor[3], data.borderColor[4]) + border:SetBackdropColor(data.backdropColor[1], data.backdropColor[2], data.backdropColor[3], data.backdropColor[4]) - border:SetPoint("bottomleft", region, "bottomleft", -data.borderOffset, -data.borderOffset); - border:SetPoint("topright", region, "topright", data.borderOffset, data.borderOffset); + border:SetPoint("bottomleft", region, "bottomleft", -data.borderOffset, -data.borderOffset) + border:SetPoint("topright", region, "topright", data.borderOffset, data.borderOffset) - border:Show(); + border:Show() else - border:Hide(); + border:Hide() end -- Rescale model display function region:Scale(scalex, scaley) - if(scalex < 0) then - region.mirror_h = true; - scalex = scalex * -1; + if scalex < 0 then + region.mirror_h = true + scalex = scalex * -1 else - region.mirror_h = nil; + region.mirror_h = nil end - region:SetWidth(region.width * scalex); - if(scaley < 0) then - scaley = scaley * -1; - region.mirror_v = true; + region:SetWidth(region.width * scalex) + if scaley < 0 then + scaley = scaley * -1 + region.mirror_v = true else - region.mirror_v = nil; + region.mirror_v = nil end - region:SetHeight(region.height * scaley); + region:SetHeight(region.height * scaley) end function region:SetRegionWidth(width) - region.width = width; - region:Scale(region.scalex, region.scaley); + region.width = width + region:Scale(region.scalex, region.scaley) end function region:SetRegionHeight(height) - region.height = height; - region:Scale(region.scalex, region.scaley); + region.height = height + region:Scale(region.scalex, region.scaley) end -- Rotate model function region:Rotate(degrees) - region.rotation = degrees; + region.rotation = degrees if region.model then - if (data.api) then - region.model:SetTransform(data.model_st_tx / 1000, data.model_st_ty / 1000, data.model_st_tz / 1000, - rad(data.model_st_rx), rad(data.model_st_ry), rad(degrees), data.model_st_us / 1000); + if data.api then + region.model:SetTransform( + data.model_st_tx / 1000, + data.model_st_ty / 1000, + data.model_st_tz / 1000, + rad(data.model_st_rx), + rad(data.model_st_ry), + rad(degrees), + data.model_st_us / 1000 + ) else - region.model:SetFacing(rad(region.rotation)); + region.model:SetFacing(rad(region.rotation)) end end end - if (data.api) then - region:Rotate(data.model_st_rz); + if data.api then + region:Rotate(data.model_st_rz) else - region:Rotate(data.rotation); + region:Rotate(data.rotation) end -- Get model rotation function region:GetRotation() - return region.rotation; + return region.rotation end function region:PreShow() @@ -300,26 +315,26 @@ local function modify(parent, region, data) end end - WeakAuras.regionPrototype.modifyFinish(parent, region, data); + WeakAuras.regionPrototype.modifyFinish(parent, region, data) end -- Work around for movies and world map hiding all models do function Private.PreShowModels(self, event) - Private.StartProfileSystem("model"); + Private.StartProfileSystem("model") for id, data in pairs(WeakAuras.regions) do - Private.StartProfileAura(id); + Private.StartProfileAura(id) if data.region.toShow then - if (data.regionType == "model") then - data.region:PreShow(); + if data.regionType == "model" then + data.region:PreShow() end end - Private.StopProfileAura(id); + Private.StopProfileAura(id) end for model in pairs(Private.barmodels) do model:PreShow() end - Private.StopProfileSystem("model"); + Private.StopProfileSystem("model") end end @@ -328,4 +343,4 @@ local function validate(data) end -- Register new region type with WeakAuras -WeakAuras.RegisterRegionType("model", create, modify, default, GetProperties, validate); +WeakAuras.RegisterRegionType("model", create, modify, default, GetProperties, validate) diff --git a/WeakAuras/RegionTypes/ProgressTexture.lua b/WeakAuras/RegionTypes/ProgressTexture.lua index 3b1d777d22..30a91a5f17 100644 --- a/WeakAuras/RegionTypes/ProgressTexture.lua +++ b/WeakAuras/RegionTypes/ProgressTexture.lua @@ -1,7 +1,9 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, Private = ... -local L = WeakAuras.L; +local L = WeakAuras.L local defaultFont = WeakAuras.defaultFont local defaultFontSize = WeakAuras.defaultFontSize @@ -35,8 +37,8 @@ local default = { height = 200, orientation = "VERTICAL", inverse = false, - foregroundColor = {1, 1, 1, 1}, - backgroundColor = {0.5, 0.5, 0.5, 0.5}, + foregroundColor = { 1, 1, 1, 1 }, + backgroundColor = { 0.5, 0.5, 0.5, 0.5 }, startAngle = 0, endAngle = 360, user_x = 0, @@ -53,14 +55,14 @@ local default = { fontSize = defaultFontSize, mirror = false, frameStrata = 1, - slantMode = "INSIDE" -}; + slantMode = "INSIDE", +} -WeakAuras.regionPrototype.AddAlphaToDefault(default); +WeakAuras.regionPrototype.AddAlphaToDefault(default) -WeakAuras.regionPrototype.AddAdjustedDurationToDefault(default); +WeakAuras.regionPrototype.AddAdjustedDurationToDefault(default) -local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ceil(GetScreenHeight() / 20) * 20; +local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ceil(GetScreenHeight() / 20) * 20 local properties = { desaturateForeground = { @@ -76,12 +78,12 @@ local properties = { foregroundColor = { display = L["Foreground Color"], setter = "Color", - type = "color" + type = "color", }, backgroundColor = { display = L["Background Color"], setter = "SetBackgroundColor", - type = "color" + type = "color", }, width = { display = L["Width"], @@ -90,7 +92,7 @@ local properties = { min = 1, softMax = screenWidth, bigStep = 1, - default = 32 + default = 32, }, height = { display = L["Height"], @@ -99,32 +101,32 @@ local properties = { min = 1, softMax = screenHeight, bigStep = 1, - default = 32 + default = 32, }, orientation = { display = L["Orientation"], setter = "SetOrientation", type = "list", - values = Private.orientation_with_circle_types + values = Private.orientation_with_circle_types, }, inverse = { display = L["Inverse"], setter = "SetInverse", - type = "bool" + type = "bool", }, mirror = { display = L["Mirror"], setter = "SetMirror", - type = "bool" - } + type = "bool", + }, } -WeakAuras.regionPrototype.AddProperties(properties, default); +WeakAuras.regionPrototype.AddProperties(properties, default) local function GetProperties(data) - local overlayInfo = Private.GetOverlayInfo(data); - if (overlayInfo and next(overlayInfo)) then - local auraProperties = CopyTable(properties); + local overlayInfo = Private.GetOverlayInfo(data) + if overlayInfo and next(overlayInfo) then + local auraProperties = CopyTable(properties) for id, display in ipairs(overlayInfo) do auraProperties["overlays." .. id] = { @@ -135,13 +137,13 @@ local function GetProperties(data) } end - return auraProperties; + return auraProperties else - return CopyTable(properties); + return CopyTable(properties) end end -local spinnerFunctions = {}; +local spinnerFunctions = {} function spinnerFunctions.SetTextureOrAtlas(self, texture) for i = 1, 3 do @@ -151,132 +153,132 @@ end function spinnerFunctions.SetDesaturated(self, desaturate) for i = 1, 3 do - self.textures[i]:SetDesaturated(desaturate); + self.textures[i]:SetDesaturated(desaturate) end end function spinnerFunctions.SetBlendMode(self, blendMode) for i = 1, 3 do - self.textures[i]:SetBlendMode(blendMode); + self.textures[i]:SetBlendMode(blendMode) end end function spinnerFunctions.Show(self) for i = 1, 3 do - self.textures[i]:Show(); + self.textures[i]:Show() end end function spinnerFunctions.Hide(self) for i = 1, 3 do - self.textures[i]:Hide(); + self.textures[i]:Hide() end end function spinnerFunctions.Color(self, r, g, b, a) for i = 1, 3 do - self.textures[i]:SetVertexColor(r, g, b, a); + self.textures[i]:SetVertexColor(r, g, b, a) end end function spinnerFunctions.UpdateSize(self) - if (self.region) then - self:SetProgress(self.region, self.angle1, self.angle2); + if self.region then + self:SetProgress(self.region, self.angle1, self.angle2) end end function spinnerFunctions.SetProgress(self, region, angle1, angle2) - self.region = region; - self.angle1 = angle1; - self.angle2 = angle2; - - local crop_x = region.crop_x or 1; - local crop_y = region.crop_y or 1; - local rotation = region.rotation or 0; - local mirror_h = region.mirror_h or false; + self.region = region + self.angle1 = angle1 + self.angle2 = angle2 + + local crop_x = region.crop_x or 1 + local crop_y = region.crop_y or 1 + local rotation = region.rotation or 0 + local mirror_h = region.mirror_h or false if region.mirror then mirror_h = not mirror_h end - local mirror_v = region.mirror_v or false; + local mirror_v = region.mirror_v or false - local width = region.width * (region.scalex or 1) + 2 * self.offset; - local height = region.height * (region.scaley or 1) + 2 * self.offset; + local width = region.width * (region.scalex or 1) + 2 * self.offset + local height = region.height * (region.scaley or 1) + 2 * self.offset - if (angle2 - angle1 >= 360) then + if angle2 - angle1 >= 360 then -- SHOW everything - self.coords[1]:SetFull(); - self.coords[1]:Transform(crop_x, crop_y, rotation, mirror_h, mirror_v); - self.coords[1]:Show(); - - self.coords[2]:Hide(); - self.coords[3]:Hide(); - return; - end - if (angle1 == angle2) then - self.coords[1]:Hide(); - self.coords[2]:Hide(); - self.coords[3]:Hide(); - return; - end - - local index1 = floor((angle1 + 45) / 90); - local index2 = floor((angle2 + 45) / 90); - - if (index1 + 1 >= index2) then - self.coords[1]:SetAngle(width, height, angle1, angle2); - self.coords[1]:Transform(crop_x, crop_y, rotation, mirror_h, mirror_v); - self.coords[1]:Show(); - self.coords[2]:Hide(); - self.coords[3]:Hide(); - elseif(index1 + 3 >= index2) then - local firstEndAngle = (index1 + 1) * 90 + 45; - self.coords[1]:SetAngle(width, height, angle1, firstEndAngle); - self.coords[1]:Transform(crop_x, crop_y, rotation, mirror_h, mirror_v); - self.coords[1]:Show(); - - self.coords[2]:SetAngle(width, height, firstEndAngle, angle2); - self.coords[2]:Transform(crop_x, crop_y, rotation, mirror_h, mirror_v); - self.coords[2]:Show(); - - self.coords[3]:Hide(); + self.coords[1]:SetFull() + self.coords[1]:Transform(crop_x, crop_y, rotation, mirror_h, mirror_v) + self.coords[1]:Show() + + self.coords[2]:Hide() + self.coords[3]:Hide() + return + end + if angle1 == angle2 then + self.coords[1]:Hide() + self.coords[2]:Hide() + self.coords[3]:Hide() + return + end + + local index1 = floor((angle1 + 45) / 90) + local index2 = floor((angle2 + 45) / 90) + + if index1 + 1 >= index2 then + self.coords[1]:SetAngle(width, height, angle1, angle2) + self.coords[1]:Transform(crop_x, crop_y, rotation, mirror_h, mirror_v) + self.coords[1]:Show() + self.coords[2]:Hide() + self.coords[3]:Hide() + elseif index1 + 3 >= index2 then + local firstEndAngle = (index1 + 1) * 90 + 45 + self.coords[1]:SetAngle(width, height, angle1, firstEndAngle) + self.coords[1]:Transform(crop_x, crop_y, rotation, mirror_h, mirror_v) + self.coords[1]:Show() + + self.coords[2]:SetAngle(width, height, firstEndAngle, angle2) + self.coords[2]:Transform(crop_x, crop_y, rotation, mirror_h, mirror_v) + self.coords[2]:Show() + + self.coords[3]:Hide() else - local firstEndAngle = (index1 + 1) * 90 + 45; - local secondEndAngle = firstEndAngle + 180; + local firstEndAngle = (index1 + 1) * 90 + 45 + local secondEndAngle = firstEndAngle + 180 - self.coords[1]:SetAngle(width, height, angle1, firstEndAngle); - self.coords[1]:Transform(crop_x, crop_y, rotation, mirror_h, mirror_v); - self.coords[1]:Show(); + self.coords[1]:SetAngle(width, height, angle1, firstEndAngle) + self.coords[1]:Transform(crop_x, crop_y, rotation, mirror_h, mirror_v) + self.coords[1]:Show() - self.coords[2]:SetAngle(width, height, firstEndAngle, secondEndAngle); - self.coords[2]:Transform(crop_x, crop_y, rotation, mirror_h, mirror_v); - self.coords[2]:Show(); + self.coords[2]:SetAngle(width, height, firstEndAngle, secondEndAngle) + self.coords[2]:Transform(crop_x, crop_y, rotation, mirror_h, mirror_v) + self.coords[2]:Show() - self.coords[3]:SetAngle(width, height, secondEndAngle, angle2); - self.coords[3]:Transform(crop_x, crop_y, rotation, mirror_h, mirror_v); - self.coords[3]:Show(); + self.coords[3]:SetAngle(width, height, secondEndAngle, angle2) + self.coords[3]:Transform(crop_x, crop_y, rotation, mirror_h, mirror_v) + self.coords[3]:Show() end end function spinnerFunctions.SetBackgroundOffset(self, region, offset) - self.offset = offset; + self.offset = offset for i = 1, 3 do - self.textures[i]:SetPoint('TOPRIGHT', region, offset, offset) - self.textures[i]:SetPoint('BOTTOMRIGHT', region, offset, -offset) - self.textures[i]:SetPoint('BOTTOMLEFT', region, -offset, -offset) - self.textures[i]:SetPoint('TOPLEFT', region, -offset, offset) + self.textures[i]:SetPoint("TOPRIGHT", region, offset, offset) + self.textures[i]:SetPoint("BOTTOMRIGHT", region, offset, -offset) + self.textures[i]:SetPoint("BOTTOMLEFT", region, -offset, -offset) + self.textures[i]:SetPoint("TOPLEFT", region, -offset, offset) end - self:UpdateSize(); + self:UpdateSize() end function spinnerFunctions:SetHeight(height) for i = 1, 3 do - self.textures[i]:SetHeight(height); + self.textures[i]:SetHeight(height) end end function spinnerFunctions:SetWidth(width) for i = 1, 3 do - self.textures[i]:SetWidth(width); + self.textures[i]:SetWidth(width) end end @@ -289,7 +291,7 @@ local defaultTexCoord = { URy = 0, LRx = 1, LRy = 1, -}; +} local function createTexCoord(texture) local coord = { @@ -311,114 +313,114 @@ local function createTexCoord(texture) LRvx = 0, LRvy = 0, - texture = texture; - }; + texture = texture, + } function coord:MoveCorner(width, height, corner, x, y) - local rx = defaultTexCoord[corner .. "x"] - x; - local ry = defaultTexCoord[corner .. "y"] - y; - coord[corner .. "vx"] = -rx * width; - coord[corner .. "vy"] = ry * height; + local rx = defaultTexCoord[corner .. "x"] - x + local ry = defaultTexCoord[corner .. "y"] - y + coord[corner .. "vx"] = -rx * width + coord[corner .. "vy"] = ry * height - coord[corner .. "x"] = x; - coord[corner .. "y"] = y; + coord[corner .. "x"] = x + coord[corner .. "y"] = y end function coord:Hide() - coord.texture:Hide(); + coord.texture:Hide() end function coord:Show() - coord:Apply(); - coord.texture:Show(); + coord:Apply() + coord.texture:Show() end function coord:SetFull() - coord.ULx = 0; - coord.ULy = 0; - coord.LLx = 0; - coord.LLy = 1; - coord.URx = 1; - coord.URy = 0; - coord.LRx = 1; - coord.LRy = 1; - - coord.ULvx = 0; - coord.ULvy = 0; - coord.LLvx = 0; - coord.LLvy = 0; - coord.URvx = 0; - coord.URvy = 0; - coord.LRvx = 0; - coord.LRvy = 0; + coord.ULx = 0 + coord.ULy = 0 + coord.LLx = 0 + coord.LLy = 1 + coord.URx = 1 + coord.URy = 0 + coord.LRx = 1 + coord.LRy = 1 + + coord.ULvx = 0 + coord.ULvy = 0 + coord.LLvx = 0 + coord.LLvy = 0 + coord.URvx = 0 + coord.URvy = 0 + coord.LRvx = 0 + coord.LRvy = 0 end function coord:Apply() - coord.texture:SetVertexOffset(UPPER_RIGHT_VERTEX, coord.URvx, coord.URvy); - coord.texture:SetVertexOffset(UPPER_LEFT_VERTEX, coord.ULvx, coord.ULvy); - coord.texture:SetVertexOffset(LOWER_RIGHT_VERTEX, coord.LRvx, coord.LRvy); - coord.texture:SetVertexOffset(LOWER_LEFT_VERTEX, coord.LLvx, coord.LLvy); + coord.texture:SetVertexOffset(UPPER_RIGHT_VERTEX, coord.URvx, coord.URvy) + coord.texture:SetVertexOffset(UPPER_LEFT_VERTEX, coord.ULvx, coord.ULvy) + coord.texture:SetVertexOffset(LOWER_RIGHT_VERTEX, coord.LRvx, coord.LRvy) + coord.texture:SetVertexOffset(LOWER_LEFT_VERTEX, coord.LLvx, coord.LLvy) - coord.texture:SetTexCoord(coord.ULx, coord.ULy, coord.LLx, coord.LLy, coord.URx, coord.URy, coord.LRx, coord.LRy); + coord.texture:SetTexCoord(coord.ULx, coord.ULy, coord.LLx, coord.LLy, coord.URx, coord.URy, coord.LRx, coord.LRy) end local exactAngles = { - {0.5, 0}, -- 0° - {1, 0}, -- 45° - {1, 0.5}, -- 90° - {1, 1}, -- 135° - {0.5, 1}, -- 180° - {0, 1}, -- 225° - {0, 0.5}, -- 270° - {0, 0} -- 315° + { 0.5, 0 }, -- 0° + { 1, 0 }, -- 45° + { 1, 0.5 }, -- 90° + { 1, 1 }, -- 135° + { 0.5, 1 }, -- 180° + { 0, 1 }, -- 225° + { 0, 0.5 }, -- 270° + { 0, 0 }, -- 315° } local function angleToCoord(angle) - angle = angle % 360; + angle = angle % 360 - if (angle % 45 == 0) then - local index = floor (angle / 45) + 1; - return exactAngles[index][1], exactAngles[index][2]; + if angle % 45 == 0 then + local index = floor(angle / 45) + 1 + return exactAngles[index][1], exactAngles[index][2] end - if (angle < 45) then - return 0.5 + tan(angle) / 2, 0; - elseif (angle < 135) then - return 1, 0.5 + tan(angle - 90) / 2 ; - elseif (angle < 225) then - return 0.5 - tan(angle) / 2, 1; - elseif (angle < 315) then - return 0, 0.5 - tan(angle - 90) / 2; - elseif (angle < 360) then - return 0.5 + tan(angle) / 2, 0; + if angle < 45 then + return 0.5 + tan(angle) / 2, 0 + elseif angle < 135 then + return 1, 0.5 + tan(angle - 90) / 2 + elseif angle < 225 then + return 0.5 - tan(angle) / 2, 1 + elseif angle < 315 then + return 0, 0.5 - tan(angle - 90) / 2 + elseif angle < 360 then + return 0.5 + tan(angle) / 2, 0 end end local pointOrder = { "LL", "UL", "UR", "LR", "LL", "UL", "UR", "LR", "LL", "UL", "UR", "LR" } function coord:SetAngle(width, height, angle1, angle2) - local index = floor((angle1 + 45) / 90); + local index = floor((angle1 + 45) / 90) - local middleCorner = pointOrder[index + 1]; - local startCorner = pointOrder[index + 2]; - local endCorner1 = pointOrder[index + 3]; - local endCorner2 = pointOrder[index + 4]; + local middleCorner = pointOrder[index + 1] + local startCorner = pointOrder[index + 2] + local endCorner1 = pointOrder[index + 3] + local endCorner2 = pointOrder[index + 4] -- LL => 32, 32 -- UL => 32, -32 self:MoveCorner(width, height, middleCorner, 0.5, 0.5) - self:MoveCorner(width, height, startCorner, angleToCoord(angle1)); + self:MoveCorner(width, height, startCorner, angleToCoord(angle1)) - local edge1 = floor((angle1 - 45) / 90); - local edge2 = floor((angle2 -45) / 90); + local edge1 = floor((angle1 - 45) / 90) + local edge2 = floor((angle2 - 45) / 90) - if (edge1 == edge2) then - self:MoveCorner(width, height, endCorner1, angleToCoord(angle2)); + if edge1 == edge2 then + self:MoveCorner(width, height, endCorner1, angleToCoord(angle2)) else - self:MoveCorner(width, height, endCorner1, defaultTexCoord[endCorner1 .. "x"], defaultTexCoord[endCorner1 .. "y"]); + self:MoveCorner(width, height, endCorner1, defaultTexCoord[endCorner1 .. "x"], defaultTexCoord[endCorner1 .. "y"]) end - self:MoveCorner(width, height, endCorner2, angleToCoord(angle2)); + self:MoveCorner(width, height, endCorner2, angleToCoord(angle2)) end local function TransformPoint(x, y, scalex, scaley, rotation, mirror_h, mirror_v, user_x, user_y) @@ -443,8 +445,8 @@ local function createTexCoord(texture) y = -y end - local cos_rotation = cos(rotation); - local sin_rotation = sin(rotation); + local cos_rotation = cos(rotation) + local sin_rotation = sin(rotation) -- 5) Rotate texture by user-defined value x, y = cos_rotation * x - sin_rotation * y, sin_rotation * x + cos_rotation * y @@ -453,366 +455,364 @@ local function createTexCoord(texture) x = x + 0.5 y = y + 0.5 - x = x + (user_x or 0); - y = y + (user_y or 0); + x = x + (user_x or 0) + y = y + (user_y or 0) return x, y end function coord:Transform(scalex, scaley, rotation, mirror_h, mirror_v, user_x, user_y) - coord.ULx, coord.ULy = TransformPoint(coord.ULx, coord.ULy, scalex, scaley, rotation, mirror_h, mirror_v, user_x, user_y); - coord.LLx, coord.LLy = TransformPoint(coord.LLx, coord.LLy, scalex, scaley, rotation, mirror_h, mirror_v, user_x, user_y); - coord.URx, coord.URy = TransformPoint(coord.URx, coord.URy, scalex, scaley, rotation, mirror_h, mirror_v, user_x, user_y); - coord.LRx, coord.LRy = TransformPoint(coord.LRx, coord.LRy, scalex, scaley, rotation, mirror_h, mirror_v, user_x, user_y); + coord.ULx, coord.ULy = TransformPoint(coord.ULx, coord.ULy, scalex, scaley, rotation, mirror_h, mirror_v, user_x, user_y) + coord.LLx, coord.LLy = TransformPoint(coord.LLx, coord.LLy, scalex, scaley, rotation, mirror_h, mirror_v, user_x, user_y) + coord.URx, coord.URy = TransformPoint(coord.URx, coord.URy, scalex, scaley, rotation, mirror_h, mirror_v, user_x, user_y) + coord.LRx, coord.LRy = TransformPoint(coord.LRx, coord.LRy, scalex, scaley, rotation, mirror_h, mirror_v, user_x, user_y) end - return coord; + return coord end - local function createSpinner(parent, layer, drawlayer) - local spinner = {}; - spinner.textures = {}; - spinner.coords = {}; - spinner.offset = 0; + local spinner = {} + spinner.textures = {} + spinner.coords = {} + spinner.offset = 0 for i = 1, 3 do - local texture = parent:CreateTexture(nil, layer); + local texture = parent:CreateTexture(nil, layer) texture:SetSnapToPixelGrid(false) texture:SetTexelSnappingBias(0) - texture:SetDrawLayer(layer, drawlayer); - texture:SetAllPoints(parent); - spinner.textures[i] = texture; + texture:SetDrawLayer(layer, drawlayer) + texture:SetAllPoints(parent) + spinner.textures[i] = texture - spinner.coords[i] = createTexCoord(texture); + spinner.coords[i] = createTexCoord(texture) end for k, v in pairs(spinnerFunctions) do - spinner[k] = v; + spinner[k] = v end - return spinner; + return spinner end -- Make available for the thumbnail display -WeakAuras.createSpinner = createSpinner; +WeakAuras.createSpinner = createSpinner local orientationToAnchorPoint = { ["HORIZONTAL"] = "LEFT", ["HORIZONTAL_INVERSE"] = "RIGHT", ["VERTICAL"] = "BOTTOM", - ["VERTICAL_INVERSE"] = "TOP" + ["VERTICAL_INVERSE"] = "TOP", } local textureFunctions = { SetValueFunctions = { ["HORIZONTAL"] = function(self, startProgress, endProgress) - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UL", startProgress, 0 ); - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LL", startProgress, 1 ); + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UL", startProgress, 0) + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LL", startProgress, 1) - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UR", endProgress, 0 ); - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LR", endProgress, 1 ); + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UR", endProgress, 0) + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LR", endProgress, 1) end, ["HORIZONTAL_INVERSE"] = function(self, startProgress, endProgress) - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UL", 1 - endProgress, 0 ); - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LL", 1 - endProgress, 1 ); + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UL", 1 - endProgress, 0) + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LL", 1 - endProgress, 1) - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UR", 1 - startProgress, 0 ); - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LR", 1 - startProgress, 1 ); + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UR", 1 - startProgress, 0) + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LR", 1 - startProgress, 1) end, ["VERTICAL"] = function(self, startProgress, endProgress) - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UL", 0, 1 - endProgress ); - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UR", 1, 1 - endProgress ); + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UL", 0, 1 - endProgress) + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UR", 1, 1 - endProgress) - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LL", 0, 1 - startProgress ); - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LR", 1, 1 - startProgress ); + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LL", 0, 1 - startProgress) + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LR", 1, 1 - startProgress) end, ["VERTICAL_INVERSE"] = function(self, startProgress, endProgress) - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UL", 0, startProgress ); - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UR", 1, startProgress ); + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UL", 0, startProgress) + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UR", 1, startProgress) - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LL", 0, endProgress ); - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LR", 1, endProgress ); + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LL", 0, endProgress) + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LR", 1, endProgress) end, }, SetValueFunctionsSlanted = { ["HORIZONTAL"] = function(self, startProgress, endProgress) - local slant = self.slant or 0; - if (self.slantMode == "EXTEND") then - startProgress = startProgress * (1 + slant) - slant; - endProgress = endProgress * (1 + slant) - slant; + local slant = self.slant or 0 + if self.slantMode == "EXTEND" then + startProgress = startProgress * (1 + slant) - slant + endProgress = endProgress * (1 + slant) - slant else - startProgress = startProgress * (1 - slant); - endProgress = endProgress * (1 - slant); + startProgress = startProgress * (1 - slant) + endProgress = endProgress * (1 - slant) end - local slant1 = self.slantFirst and 0 or slant; - local slant2 = self.slantFirst and slant or 0; + local slant1 = self.slantFirst and 0 or slant + local slant2 = self.slantFirst and slant or 0 - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UL", startProgress + slant1, 0 ); - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LL", startProgress + slant2, 1 ); + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UL", startProgress + slant1, 0) + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LL", startProgress + slant2, 1) - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UR", endProgress + slant1, 0 ); - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LR", endProgress + slant2, 1 ); + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UR", endProgress + slant1, 0) + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LR", endProgress + slant2, 1) end, ["HORIZONTAL_INVERSE"] = function(self, startProgress, endProgress) - local slant = self.slant or 0; - if (self.slantMode == "EXTEND") then - startProgress = startProgress * (1 + slant) - slant; - endProgress = endProgress * (1 + slant) - slant; + local slant = self.slant or 0 + if self.slantMode == "EXTEND" then + startProgress = startProgress * (1 + slant) - slant + endProgress = endProgress * (1 + slant) - slant else - startProgress = startProgress * (1 - slant); - endProgress = endProgress * (1 - slant); + startProgress = startProgress * (1 - slant) + endProgress = endProgress * (1 - slant) end - local slant1 = self.slantFirst and slant or 0; - local slant2 = self.slantFirst and 0 or slant; + local slant1 = self.slantFirst and slant or 0 + local slant2 = self.slantFirst and 0 or slant - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UL", 1 - endProgress - slant1, 0 ); - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LL", 1 - endProgress - slant2, 1 ); + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UL", 1 - endProgress - slant1, 0) + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LL", 1 - endProgress - slant2, 1) - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UR", 1 - startProgress - slant1, 0 ); - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LR", 1 - startProgress - slant2, 1 ); + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UR", 1 - startProgress - slant1, 0) + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LR", 1 - startProgress - slant2, 1) end, ["VERTICAL"] = function(self, startProgress, endProgress) - local slant = self.slant or 0; - if (self.slantMode == "EXTEND") then - startProgress = startProgress * (1 + slant) - slant; - endProgress = endProgress * (1 + slant) - slant; + local slant = self.slant or 0 + if self.slantMode == "EXTEND" then + startProgress = startProgress * (1 + slant) - slant + endProgress = endProgress * (1 + slant) - slant else - startProgress = startProgress * (1 - slant); - endProgress = endProgress * (1 - slant); + startProgress = startProgress * (1 - slant) + endProgress = endProgress * (1 - slant) end - local slant1 = self.slantFirst and slant or 0; - local slant2 = self.slantFirst and 0 or slant; + local slant1 = self.slantFirst and slant or 0 + local slant2 = self.slantFirst and 0 or slant - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UL", 0, 1 - endProgress - slant1 ); - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UR", 1, 1 - endProgress - slant2 ); + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UL", 0, 1 - endProgress - slant1) + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UR", 1, 1 - endProgress - slant2) - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LL", 0, 1 - startProgress - slant1 ); - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LR", 1, 1 - startProgress - slant2 ); + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LL", 0, 1 - startProgress - slant1) + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LR", 1, 1 - startProgress - slant2) end, ["VERTICAL_INVERSE"] = function(self, startProgress, endProgress) - local slant = self.slant or 0; - if (self.slantMode == "EXTEND") then - startProgress = startProgress * (1 + slant) - slant; - endProgress = endProgress * (1 + slant) - slant; + local slant = self.slant or 0 + if self.slantMode == "EXTEND" then + startProgress = startProgress * (1 + slant) - slant + endProgress = endProgress * (1 + slant) - slant else - startProgress = startProgress * (1 - slant); - endProgress = endProgress * (1 - slant); + startProgress = startProgress * (1 - slant) + endProgress = endProgress * (1 - slant) end - local slant1 = self.slantFirst and 0 or slant; - local slant2 = self.slantFirst and slant or 0; + local slant1 = self.slantFirst and 0 or slant + local slant2 = self.slantFirst and slant or 0 - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UL", 0, startProgress + slant1 ); - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UR", 1, startProgress + slant2 ); + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UL", 0, startProgress + slant1) + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UR", 1, startProgress + slant2) - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LL", 0, endProgress + slant1 ); - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LR", 1, endProgress + slant2 ); + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LL", 0, endProgress + slant1) + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LR", 1, endProgress + slant2) end, }, SetBackgroundOffset = function(self, backgroundOffset) - self.backgroundOffset = backgroundOffset; + self.backgroundOffset = backgroundOffset end, SetOrientation = function(self, orientation, compress, slanted, slant, slantFirst, slantMode) - self.SetValueFunction = slanted and self.SetValueFunctionsSlanted[orientation] or self.SetValueFunctions[orientation]; - self.compress = compress; - self.slanted = slanted; - self.slant = slant; - self.slantFirst = slantFirst; - self.slantMode = slantMode; - if (self.compress) then - self:ClearAllPoints(); - local anchor = orientationToAnchorPoint[orientation]; - self:SetPoint(anchor, self.region, anchor); - self.horizontal = orientation == "HORIZONTAL" or orientation == "HORIZONTAL_INVERSE"; + self.SetValueFunction = slanted and self.SetValueFunctionsSlanted[orientation] or self.SetValueFunctions[orientation] + self.compress = compress + self.slanted = slanted + self.slant = slant + self.slantFirst = slantFirst + self.slantMode = slantMode + if self.compress then + self:ClearAllPoints() + local anchor = orientationToAnchorPoint[orientation] + self:SetPoint(anchor, self.region, anchor) + self.horizontal = orientation == "HORIZONTAL" or orientation == "HORIZONTAL_INVERSE" else - local offset = self.backgroundOffset or 0; - self:ClearAllPoints(); - self:SetPoint("BOTTOMLEFT", self.region, "BOTTOMLEFT", -1 * offset, -1 * offset); - self:SetPoint("TOPRIGHT", self.region, "TOPRIGHT", offset, offset); + local offset = self.backgroundOffset or 0 + self:ClearAllPoints() + self:SetPoint("BOTTOMLEFT", self.region, "BOTTOMLEFT", -1 * offset, -1 * offset) + self:SetPoint("TOPRIGHT", self.region, "TOPRIGHT", offset, offset) end - self:Update(); + self:Update() end, SetValue = function(self, startProgress, endProgress) - self.startProgress = startProgress; - self.endProgress = endProgress; - - if (self.compress) then - local progress = self.region.progress or 1; - local horScale = self.horizontal and progress or 1; - local verScale = self.horizontal and 1 or progress; - self:SetWidth(self.region:GetWidth() * horScale); - self:SetHeight(self.region:GetHeight() * verScale); - - if (progress > 0.1) then - startProgress = startProgress / progress; - endProgress = endProgress / progress; + self.startProgress = startProgress + self.endProgress = endProgress + + if self.compress then + local progress = self.region.progress or 1 + local horScale = self.horizontal and progress or 1 + local verScale = self.horizontal and 1 or progress + self:SetWidth(self.region:GetWidth() * horScale) + self:SetHeight(self.region:GetHeight() * verScale) + + if progress > 0.1 then + startProgress = startProgress / progress + endProgress = endProgress / progress else - startProgress, endProgress = 0, 0; + startProgress, endProgress = 0, 0 end end - self.coord:SetFull(); - self:SetValueFunction(startProgress, endProgress); + self.coord:SetFull() + self:SetValueFunction(startProgress, endProgress) - local region = self.region; - local crop_x = region.crop_x or 1; - local crop_y = region.crop_y or 1; - local rotation = region.rotation or 0; - local mirror_h = region.mirror_h or false; + local region = self.region + local crop_x = region.crop_x or 1 + local crop_y = region.crop_y or 1 + local rotation = region.rotation or 0 + local mirror_h = region.mirror_h or false if region.mirror then mirror_h = not mirror_h end - local mirror_v = region.mirror_v or false; - local user_x = region.user_x; - local user_y = region.user_y; + local mirror_v = region.mirror_v or false + local user_x = region.user_x + local user_y = region.user_y - self.coord:Transform(crop_x, crop_y, rotation, mirror_h, mirror_v, user_x, user_y); - self.coord:Apply(); + self.coord:Transform(crop_x, crop_y, rotation, mirror_h, mirror_v, user_x, user_y) + self.coord:Apply() end, Update = function(self) - self:SetValue(self.startProgress, self.endProgress); + self:SetValue(self.startProgress, self.endProgress) end, } - local function createTexture(region, layer, drawlayer) - local texture = region:CreateTexture(nil, layer); + local texture = region:CreateTexture(nil, layer) texture:SetSnapToPixelGrid(false) texture:SetTexelSnappingBias(0) - texture:SetDrawLayer(layer, drawlayer); + texture:SetDrawLayer(layer, drawlayer) for k, v in pairs(textureFunctions) do - texture[k] = v; + texture[k] = v end - texture.coord = createTexCoord(texture); - texture.region = region; - texture.startProgress = 0; - texture.endProgress = 1; + texture.coord = createTexCoord(texture) + texture.region = region + texture.startProgress = 0 + texture.endProgress = 1 - texture:SetAllPoints(region); + texture:SetAllPoints(region) - return texture; + return texture end local TextureSetValueFunction = function(self, progress) - self.progress = progress; - progress = max(0, progress); - progress = min(1, progress); - self.foreground:SetValue(0, progress); + self.progress = progress + progress = max(0, progress) + progress = min(1, progress) + self.foreground:SetValue(0, progress) end local CircularSetValueFunctions = { ["CLOCKWISE"] = function(self, progress) - local startAngle = self.startAngle; - local endAngle = self.endAngle; - progress = progress or 0; - self.progress = progress; + local startAngle = self.startAngle + local endAngle = self.endAngle + progress = progress or 0 + self.progress = progress - if (progress < 0) then - progress = 0; + if progress < 0 then + progress = 0 end - if (progress > 1) then - progress = 1; + if progress > 1 then + progress = 1 end - local pAngle = (endAngle - startAngle) * progress + startAngle; - self.foregroundSpinner:SetProgress(self, startAngle, pAngle); + local pAngle = (endAngle - startAngle) * progress + startAngle + self.foregroundSpinner:SetProgress(self, startAngle, pAngle) end, ["ANTICLOCKWISE"] = function(self, progress) - local startAngle = self.startAngle; - local endAngle = self.endAngle; - progress = progress or 0; - self.progress = progress; + local startAngle = self.startAngle + local endAngle = self.endAngle + progress = progress or 0 + self.progress = progress - if (progress < 0) then - progress = 0; + if progress < 0 then + progress = 0 end - if (progress > 1) then - progress = 1; + if progress > 1 then + progress = 1 end - progress = 1 - progress; + progress = 1 - progress - local pAngle = (endAngle - startAngle) * progress + startAngle; - self.foregroundSpinner:SetProgress(self, pAngle, endAngle); - end + local pAngle = (endAngle - startAngle) * progress + startAngle + self.foregroundSpinner:SetProgress(self, pAngle, endAngle) + end, } local function hideExtraTextures(extraTextures, from) for i = from, #extraTextures do - extraTextures[i]:Hide(); + extraTextures[i]:Hide() end end local function ensureExtraTextures(region, count) for i = #region.extraTextures + 1, count do - local extraTexture = createTexture(region, "ARTWORK", min(i, 7)); + local extraTexture = createTexture(region, "ARTWORK", min(i, 7)) WeakAuras.SetTextureOrAtlas(extraTexture, region.currentTexture, region.textureWrapMode, region.textureWrapMode) - extraTexture:SetBlendMode(region.foreground:GetBlendMode()); - extraTexture:SetOrientation(region.orientation, region.compress, region.slanted, region.slant, region.slantFirst, region.slantMode); - region.extraTextures[i] = extraTexture; + extraTexture:SetBlendMode(region.foreground:GetBlendMode()) + extraTexture:SetOrientation(region.orientation, region.compress, region.slanted, region.slant, region.slantFirst, region.slantMode) + region.extraTextures[i] = extraTexture end end local function ensureExtraSpinners(region, count) - local parent = region:GetParent(); + local parent = region:GetParent() for i = #region.extraSpinners + 1, count do - local extraSpinner = createSpinner(region, "OVERLAY", min(i, 7)); - extraSpinner:SetTextureOrAtlas(region.currentTexture); - extraSpinner:SetBlendMode(region.foreground:GetBlendMode()); - region.extraSpinners[i] = extraSpinner; + local extraSpinner = createSpinner(region, "OVERLAY", min(i, 7)) + extraSpinner:SetTextureOrAtlas(region.currentTexture) + extraSpinner:SetBlendMode(region.foreground:GetBlendMode()) + region.extraSpinners[i] = extraSpinner end end local function convertToProgress(rprogress, additionalProgress, adjustMin, totalWidth, inverse, clamp) - local startProgress = 0; - local endProgress = 0; + local startProgress = 0 + local endProgress = 0 - if (additionalProgress.min and additionalProgress.max) then - if (totalWidth ~= 0) then - startProgress = (additionalProgress.min - adjustMin) / totalWidth; - endProgress = (additionalProgress.max - adjustMin) / totalWidth; + if additionalProgress.min and additionalProgress.max then + if totalWidth ~= 0 then + startProgress = (additionalProgress.min - adjustMin) / totalWidth + endProgress = (additionalProgress.max - adjustMin) / totalWidth - if (inverse) then - startProgress = 1 - startProgress; - endProgress = 1 - endProgress; + if inverse then + startProgress = 1 - startProgress + endProgress = 1 - endProgress end end - elseif (additionalProgress.direction) then - local forwardDirection = (additionalProgress.direction or "forward") == "forward"; - if (inverse) then - forwardDirection = not forwardDirection; + elseif additionalProgress.direction then + local forwardDirection = (additionalProgress.direction or "forward") == "forward" + if inverse then + forwardDirection = not forwardDirection end - local width = additionalProgress.width or 0; - local offset = additionalProgress.offset or 0; - if (width ~= 0) then - if (forwardDirection) then - startProgress = rprogress + offset / totalWidth ; - endProgress = rprogress + (offset + width) / totalWidth; + local width = additionalProgress.width or 0 + local offset = additionalProgress.offset or 0 + if width ~= 0 then + if forwardDirection then + startProgress = rprogress + offset / totalWidth + endProgress = rprogress + (offset + width) / totalWidth else - startProgress = rprogress - (width + offset) / totalWidth; - endProgress = rprogress - offset / totalWidth; + startProgress = rprogress - (width + offset) / totalWidth + endProgress = rprogress - offset / totalWidth end end end - if (clamp) then - startProgress = max(0, min(1, startProgress)); - endProgress = max(0, min(1, endProgress)); + if clamp then + startProgress = max(0, min(1, startProgress)) + endProgress = max(0, min(1, endProgress)) end - return startProgress, endProgress; + return startProgress, endProgress end local function UpdateAdditionalProgress(self) @@ -820,272 +820,271 @@ local function UpdateAdditionalProgress(self) end local function SetAdditionalProgress(self, additionalProgress, min, max, inverse) - self.additionalProgress = additionalProgress; - self.additionalProgressMin = min; - self.additionalProgressMax = max; - self.additionalProgressInverse = inverse; + self.additionalProgress = additionalProgress + self.additionalProgressMin = min + self.additionalProgressMax = max + self.additionalProgressInverse = inverse - local effectiveInverse = (inverse and not self.inverseDirection) or (not inverse and self.inverseDirection); + local effectiveInverse = (inverse and not self.inverseDirection) or (not inverse and self.inverseDirection) - if (additionalProgress) then - ensureExtraTextures(self, #additionalProgress); + if additionalProgress then + ensureExtraTextures(self, #additionalProgress) for index, additionalProgress in ipairs(additionalProgress) do - local extraTexture = self.extraTextures[index]; + local extraTexture = self.extraTextures[index] - local totalWidth = max - min; - local startProgress, endProgress = convertToProgress(self.progress, additionalProgress, min, totalWidth, effectiveInverse, self.overlayclip); - if ((endProgress - startProgress) == 0) then - extraTexture:Hide(); + local totalWidth = max - min + local startProgress, endProgress = convertToProgress(self.progress, additionalProgress, min, totalWidth, effectiveInverse, self.overlayclip) + if (endProgress - startProgress) == 0 then + extraTexture:Hide() else - extraTexture:Show(); - local color = self.overlays[index]; - if (color) then - extraTexture:SetVertexColor(unpack(color)); + extraTexture:Show() + local color = self.overlays[index] + if color then + extraTexture:SetVertexColor(unpack(color)) else - extraTexture:SetVertexColor(1, 1, 1, 1); + extraTexture:SetVertexColor(1, 1, 1, 1) end extraTexture:SetValue(startProgress, endProgress) end end - hideExtraTextures(self.extraTextures, #additionalProgress + 1); + hideExtraTextures(self.extraTextures, #additionalProgress + 1) else - hideExtraTextures(self.extraTextures, 1); + hideExtraTextures(self.extraTextures, 1) end end local function SetAdditionalProgressCircular(self, additionalProgress, min, max, inverse) - self.additionalProgress = additionalProgress; - self.additionalProgressMin = min; - self.additionalProgressMax = max; - self.additionalProgressInverse = inverse; + self.additionalProgress = additionalProgress + self.additionalProgressMin = min + self.additionalProgressMax = max + self.additionalProgressInverse = inverse - local effectiveInverse = (inverse and not self.inverseDirection) or (not inverse and self.inverseDirection); + local effectiveInverse = (inverse and not self.inverseDirection) or (not inverse and self.inverseDirection) - if (additionalProgress) then - ensureExtraSpinners(self, #additionalProgress); + if additionalProgress then + ensureExtraSpinners(self, #additionalProgress) for index, additionalProgress in ipairs(additionalProgress) do - local extraSpinner = self.extraSpinners[index]; + local extraSpinner = self.extraSpinners[index] - local totalWidth = max - min; - local startProgress, endProgress = convertToProgress(self.progress, additionalProgress, min, totalWidth, effectiveInverse, self.overlayclip); - if (endProgress < startProgress) then - startProgress, endProgress = endProgress, startProgress; + local totalWidth = max - min + local startProgress, endProgress = convertToProgress(self.progress, additionalProgress, min, totalWidth, effectiveInverse, self.overlayclip) + if endProgress < startProgress then + startProgress, endProgress = endProgress, startProgress end - if (self.orientation == "ANTICLOCKWISE") then - startProgress, endProgress = 1 - endProgress, 1 - startProgress; + if self.orientation == "ANTICLOCKWISE" then + startProgress, endProgress = 1 - endProgress, 1 - startProgress end - if ((endProgress - startProgress) == 0) then - extraSpinner:SetProgress(self, 0, 0); + if (endProgress - startProgress) == 0 then + extraSpinner:SetProgress(self, 0, 0) else - local color = self.overlays[index]; - if (color) then - extraSpinner:Color(unpack(color)); + local color = self.overlays[index] + if color then + extraSpinner:Color(unpack(color)) else - extraSpinner:Color(1, 1, 1, 1); + extraSpinner:Color(1, 1, 1, 1) end - local startAngle = self.startAngle; - local diffAngle = self.endAngle - startAngle; - local pAngleStart = diffAngle * startProgress + startAngle; - local pAngleEnd = diffAngle * endProgress + startAngle; + local startAngle = self.startAngle + local diffAngle = self.endAngle - startAngle + local pAngleStart = diffAngle * startProgress + startAngle + local pAngleEnd = diffAngle * endProgress + startAngle - if (pAngleStart < 0) then - pAngleStart = pAngleStart + 360; - pAngleEnd = pAngleEnd + 360; + if pAngleStart < 0 then + pAngleStart = pAngleStart + 360 + pAngleEnd = pAngleEnd + 360 end - extraSpinner:SetProgress(self, pAngleStart, pAngleEnd); + extraSpinner:SetProgress(self, pAngleStart, pAngleEnd) end end - else - hideExtraTextures(self.extraSpinners, 1); + hideExtraTextures(self.extraSpinners, 1) end end local function showCircularProgress(region) - region.foreground:Hide(); - region.background:Hide(); - region.foregroundSpinner:Show(); - region.backgroundSpinner:Show(); + region.foreground:Hide() + region.background:Hide() + region.foregroundSpinner:Show() + region.backgroundSpinner:Show() for i = 1, #region.extraTextures do - region.extraTextures[i]:Hide(); + region.extraTextures[i]:Hide() end end local function hideCircularProgress(region) - region.foreground:Show(); - region.background:Show(); - region.foregroundSpinner:Hide(); - region.backgroundSpinner:Hide(); + region.foreground:Show() + region.background:Show() + region.foregroundSpinner:Hide() + region.backgroundSpinner:Hide() for i = 1, #region.extraSpinners do - region.extraSpinners[i]:Hide(); + region.extraSpinners[i]:Hide() end end local function SetOrientation(region, orientation) - region.orientation = orientation; - if(region.orientation == "CLOCKWISE" or region.orientation == "ANTICLOCKWISE") then - showCircularProgress(region); - region.foregroundSpinner:UpdateSize(); - region.backgroundSpinner:UpdateSize(); - region.SetValueOnTexture = CircularSetValueFunctions[region.orientation]; - region.SetAdditionalProgress = SetAdditionalProgressCircular; + region.orientation = orientation + if region.orientation == "CLOCKWISE" or region.orientation == "ANTICLOCKWISE" then + showCircularProgress(region) + region.foregroundSpinner:UpdateSize() + region.backgroundSpinner:UpdateSize() + region.SetValueOnTexture = CircularSetValueFunctions[region.orientation] + region.SetAdditionalProgress = SetAdditionalProgressCircular else - hideCircularProgress(region); - region.background:SetOrientation(orientation, nil, region.slanted, region.slant, region.slantFirst, region.slantMode); - region.foreground:SetOrientation(orientation, region.compress, region.slanted, region.slant, region.slantFirst, region.slantMode); - region.SetValueOnTexture = TextureSetValueFunction; - region.SetAdditionalProgress = SetAdditionalProgress; + hideCircularProgress(region) + region.background:SetOrientation(orientation, nil, region.slanted, region.slant, region.slantFirst, region.slantMode) + region.foreground:SetOrientation(orientation, region.compress, region.slanted, region.slant, region.slantFirst, region.slantMode) + region.SetValueOnTexture = TextureSetValueFunction + region.SetAdditionalProgress = SetAdditionalProgress for _, extraTexture in ipairs(region.extraTextures) do - extraTexture:SetOrientation(orientation, region.compress, region.slanted, region.slant, region.slantFirst, region.slantMode); + extraTexture:SetOrientation(orientation, region.compress, region.slanted, region.slant, region.slantFirst, region.slantMode) end end - region:SetValueOnTexture(region.progress); - region:UpdateAdditionalProgress(); + region:SetValueOnTexture(region.progress) + region:UpdateAdditionalProgress() end local function create(parent) - local font = "GameFontHighlight"; + local font = "GameFontHighlight" - local region = CreateFrame("Frame", nil, parent); + local region = CreateFrame("Frame", nil, parent) region.regionType = "progresstexture" - region:SetMovable(true); - region:SetResizable(true); - region:SetMinResize(1, 1); + region:SetMovable(true) + region:SetResizable(true) + region:SetMinResize(1, 1) - local background = createTexture(region, "BACKGROUND", 0); - region.background = background; + local background = createTexture(region, "BACKGROUND", 0) + region.background = background -- For horizontal/vertical progress - local foreground = createTexture(region, "ARTWORK", 0); - region.foreground = foreground; + local foreground = createTexture(region, "ARTWORK", 0) + region.foreground = foreground - region.foregroundSpinner = createSpinner(region, "ARTWORK", 1); - region.backgroundSpinner = createSpinner(region, "BACKGROUND", 1); + region.foregroundSpinner = createSpinner(region, "ARTWORK", 1) + region.backgroundSpinner = createSpinner(region, "BACKGROUND", 1) - region.extraTextures = {}; - region.extraSpinners = {}; + region.extraTextures = {} + region.extraSpinners = {} -- Use a dummy object for the SmoothStatusBarMixin, because our SetValue -- is used for a different purpose - region.smoothProgress = {}; - Mixin(region.smoothProgress, SmoothStatusBarMixin); + region.smoothProgress = {} + Mixin(region.smoothProgress, SmoothStatusBarMixin) region.smoothProgress.SetValue = function(self, progress) - region:SetValueOnTexture(progress); - region:UpdateAdditionalProgress(); + region:SetValueOnTexture(progress) + region:UpdateAdditionalProgress() end region.smoothProgress.GetValue = function(self) - return region.progress; + return region.progress end region.smoothProgress.GetMinMaxValues = function(self) - return 0, 1; + return 0, 1 end - region.SetOrientation = SetOrientation; + region.SetOrientation = SetOrientation - WeakAuras.regionPrototype.create(region); + WeakAuras.regionPrototype.create(region) - return region; + return region end local function TimerTick(self) - local adjustMin = self.adjustedMin or self.adjustedMinRel or 0; + local adjustMin = self.adjustedMin or self.adjustedMinRel or 0 local duration = self.state.duration - self:SetTime( (duration ~= 0 and (self.adjustedMax or self.adjustedMaxRel) or duration) - adjustMin, self.state.expirationTime - adjustMin, self.state.inverse); + self:SetTime((duration ~= 0 and (self.adjustedMax or self.adjustedMaxRel) or duration) - adjustMin, self.state.expirationTime - adjustMin, self.state.inverse) end local function modify(parent, region, data) - WeakAuras.regionPrototype.modify(parent, region, data); + WeakAuras.regionPrototype.modify(parent, region, data) - local background, foreground = region.background, region.foreground; - local foregroundSpinner, backgroundSpinner = region.foregroundSpinner, region.backgroundSpinner; + local background, foreground = region.background, region.foreground + local foregroundSpinner, backgroundSpinner = region.foregroundSpinner, region.backgroundSpinner - region:SetWidth(data.width); - region:SetHeight(data.height); - region.width = data.width; - region.height = data.height; - region.scalex = 1; - region.scaley = 1; - region.aspect = data.width / data.height; - region.overlayclip = data.overlayclip; + region:SetWidth(data.width) + region:SetHeight(data.height) + region.width = data.width + region.height = data.height + region.scalex = 1 + region.scaley = 1 + region.aspect = data.width / data.height + region.overlayclip = data.overlayclip - region.textureWrapMode = data.textureWrapMode; + region.textureWrapMode = data.textureWrapMode - background:SetBackgroundOffset(data.backgroundOffset); - WeakAuras.SetTextureOrAtlas(background, data.sameTexture and data.foregroundTexture or data.backgroundTexture, region.textureWrapMode, region.textureWrapMode); + background:SetBackgroundOffset(data.backgroundOffset) + WeakAuras.SetTextureOrAtlas(background, data.sameTexture and data.foregroundTexture or data.backgroundTexture, region.textureWrapMode, region.textureWrapMode) background:SetDesaturated(data.desaturateBackground) - background:SetVertexColor(data.backgroundColor[1], data.backgroundColor[2], data.backgroundColor[3], data.backgroundColor[4]); - background:SetBlendMode(data.blendMode); + background:SetVertexColor(data.backgroundColor[1], data.backgroundColor[2], data.backgroundColor[3], data.backgroundColor[4]) + background:SetBlendMode(data.blendMode) - backgroundSpinner:SetTextureOrAtlas(data.sameTexture and data.foregroundTexture or data.backgroundTexture); + backgroundSpinner:SetTextureOrAtlas(data.sameTexture and data.foregroundTexture or data.backgroundTexture) backgroundSpinner:SetDesaturated(data.desaturateBackground) - backgroundSpinner:Color(data.backgroundColor[1], data.backgroundColor[2], data.backgroundColor[3], data.backgroundColor[4]); - backgroundSpinner:SetBlendMode(data.blendMode); + backgroundSpinner:Color(data.backgroundColor[1], data.backgroundColor[2], data.backgroundColor[3], data.backgroundColor[4]) + backgroundSpinner:SetBlendMode(data.blendMode) - region.currentTexture = data.foregroundTexture; - WeakAuras.SetTextureOrAtlas(foreground, data.foregroundTexture, region.textureWrapMode, region.textureWrapMode); + region.currentTexture = data.foregroundTexture + WeakAuras.SetTextureOrAtlas(foreground, data.foregroundTexture, region.textureWrapMode, region.textureWrapMode) foreground:SetDesaturated(data.desaturateForeground) - foreground:SetBlendMode(data.blendMode); + foreground:SetBlendMode(data.blendMode) - foregroundSpinner:SetTextureOrAtlas(data.foregroundTexture); - foregroundSpinner:SetDesaturated(data.desaturateForeground); - foregroundSpinner:SetBlendMode(data.blendMode); + foregroundSpinner:SetTextureOrAtlas(data.foregroundTexture) + foregroundSpinner:SetDesaturated(data.desaturateForeground) + foregroundSpinner:SetBlendMode(data.blendMode) for _, extraTexture in ipairs(region.extraTextures) do WeakAuras.SetTextureOrAtlas(extraTexture, data.foregroundTexture, region.textureWrapMode, region.textureWrapMode) - extraTexture:SetBlendMode(data.blendMode); + extraTexture:SetBlendMode(data.blendMode) end for _, extraSpinner in ipairs(region.extraSpinners) do - extraSpinner:SetTextureOrAtlas(data.foregroundTexture); - extraSpinner:SetBlendMode(data.blendMode); + extraSpinner:SetTextureOrAtlas(data.foregroundTexture) + extraSpinner:SetBlendMode(data.blendMode) end region.mirror = data.mirror - region.crop_x = 1 + (data.crop_x or 0.41); - region.crop_y = 1 + (data.crop_y or 0.41); - region.rotation = data.rotation or 0; - region.user_x = -1 * (data.user_x or 0); - region.user_y = data.user_y or 0; + region.crop_x = 1 + (data.crop_x or 0.41) + region.crop_y = 1 + (data.crop_y or 0.41) + region.rotation = data.rotation or 0 + region.user_x = -1 * (data.user_x or 0) + region.user_y = data.user_y or 0 - region.startAngle = (data.startAngle or 0) % 360; - region.endAngle = (data.endAngle or 360) % 360; + region.startAngle = (data.startAngle or 0) % 360 + region.endAngle = (data.endAngle or 360) % 360 - if (region.endAngle <= region.startAngle) then - region.endAngle = region.endAngle + 360; + if region.endAngle <= region.startAngle then + region.endAngle = region.endAngle + 360 end - region.compress = data.compress; + region.compress = data.compress - region.inverseDirection = data.inverse; - region.progress = 0.667; - backgroundSpinner:SetProgress(region, region.startAngle, region.endAngle); - backgroundSpinner:SetBackgroundOffset(region, data.backgroundOffset); + region.inverseDirection = data.inverse + region.progress = 0.667 + backgroundSpinner:SetProgress(region, region.startAngle, region.endAngle) + backgroundSpinner:SetBackgroundOffset(region, data.backgroundOffset) - if (data.overlays) then + if data.overlays then region.overlays = CopyTable(data.overlays) else region.overlays = {} end - region.UpdateAdditionalProgress = UpdateAdditionalProgress; + region.UpdateAdditionalProgress = UpdateAdditionalProgress - region.slanted = data.slanted; - region.slant = data.slant; - region.slantFirst = data.slantFirst; - region.slantMode = data.slantMode; - region:SetOrientation(data.orientation); + region.slanted = data.slanted + region.slant = data.slant + region.slantFirst = data.slantFirst + region.slantMode = data.slantMode + region:SetOrientation(data.orientation) local function DoPosition(region) local mirror = region.mirror_h @@ -1093,65 +1092,65 @@ local function modify(parent, region, data) mirror = not mirror end - if(mirror) then - if(data.orientation == "HORIZONTAL_INVERSE") then - foreground:SetPoint("RIGHT", region, "RIGHT"); - elseif(data.orientation == "HORIZONTAL") then - foreground:SetPoint("LEFT", region, "LEFT"); + if mirror then + if data.orientation == "HORIZONTAL_INVERSE" then + foreground:SetPoint("RIGHT", region, "RIGHT") + elseif data.orientation == "HORIZONTAL" then + foreground:SetPoint("LEFT", region, "LEFT") end else - if(data.orientation == "HORIZONTAL") then - foreground:SetPoint("LEFT", region, "LEFT"); - elseif(data.orientation == "HORIZONTAL_INVERSE") then - foreground:SetPoint("RIGHT", region, "RIGHT"); + if data.orientation == "HORIZONTAL" then + foreground:SetPoint("LEFT", region, "LEFT") + elseif data.orientation == "HORIZONTAL_INVERSE" then + foreground:SetPoint("RIGHT", region, "RIGHT") end end - if(region.mirror_v) then - if(data.orientation == "VERTICAL_INVERSE") then - foreground:SetPoint("TOP", region, "TOP"); - elseif(data.orientation == "VERTICAL") then - foreground:SetPoint("BOTTOM", region, "BOTTOM"); + if region.mirror_v then + if data.orientation == "VERTICAL_INVERSE" then + foreground:SetPoint("TOP", region, "TOP") + elseif data.orientation == "VERTICAL" then + foreground:SetPoint("BOTTOM", region, "BOTTOM") end else - if(data.orientation == "VERTICAL") then - foreground:SetPoint("BOTTOM", region, "BOTTOM"); - elseif(data.orientation == "VERTICAL_INVERSE") then - foreground:SetPoint("TOP", region, "TOP"); + if data.orientation == "VERTICAL" then + foreground:SetPoint("BOTTOM", region, "BOTTOM") + elseif data.orientation == "VERTICAL_INVERSE" then + foreground:SetPoint("TOP", region, "TOP") end end - region:SetWidth(region.width * region.scalex); - region:SetHeight(region.height * region.scaley); + region:SetWidth(region.width * region.scalex) + region:SetHeight(region.height * region.scaley) - if (data.orientation == "CLOCKWISE" or data.orientation == "ANTICLOCKWISE") then - region.foregroundSpinner:UpdateSize(); - region.backgroundSpinner:UpdateSize(); + if data.orientation == "CLOCKWISE" or data.orientation == "ANTICLOCKWISE" then + region.foregroundSpinner:UpdateSize() + region.backgroundSpinner:UpdateSize() for i = 1, #region.extraSpinners do - region.extraSpinners[i]:UpdateSize(); + region.extraSpinners[i]:UpdateSize() end else - region.background:Update(); - region.foreground:Update(); + region.background:Update() + region.foreground:Update() for _, extraTexture in ipairs(region.extraTextures) do - extraTexture:Update(); + extraTexture:Update() end end end function region:Scale(scalex, scaley) - if(scalex < 0) then - region.mirror_h = true; - scalex = scalex * -1; + if scalex < 0 then + region.mirror_h = true + scalex = scalex * -1 end - if(scaley < 0) then - region.mirror_v = true; - scaley = scaley * -1; + if scaley < 0 then + region.mirror_v = true + scaley = scaley * -1 end - region.scalex = scalex; - region.scaley = scaley; + region.scalex = scalex + region.scaley = scaley DoPosition(region) end @@ -1162,91 +1161,93 @@ local function modify(parent, region, data) end function region:Rotate(angle) - region.rotation = angle or 0; - if (data.orientation == "CLOCKWISE" or data.orientation == "ANTICLOCKWISE") then - region.foregroundSpinner:UpdateSize(); - region.backgroundSpinner:UpdateSize(); + region.rotation = angle or 0 + if data.orientation == "CLOCKWISE" or data.orientation == "ANTICLOCKWISE" then + region.foregroundSpinner:UpdateSize() + region.backgroundSpinner:UpdateSize() for i = 1, #region.extraSpinners do - region.extraSpinners[i]:UpdateSize(); + region.extraSpinners[i]:UpdateSize() end else - region.background:Update(); - region.foreground:Update(); + region.background:Update() + region.foreground:Update() for _, extraTexture in ipairs(region.extraTextures) do - extraTexture:Update(); + extraTexture:Update() end end end function region:GetRotation() - return region.rotation; + return region.rotation end function region:Color(r, g, b, a) - region.color_r = r; - region.color_g = g; - region.color_b = b; - if (r or g or b) then - a = a or 1; + region.color_r = r + region.color_g = g + region.color_b = b + if r or g or b then + a = a or 1 end - region.color_a = a; - foreground:SetVertexColor(region.color_anim_r or r, region.color_anim_g or g, region.color_anim_b or b, region.color_anim_a or a); - foregroundSpinner:Color(region.color_anim_r or r, region.color_anim_g or g, region.color_anim_b or b, region.color_anim_a or a); + region.color_a = a + foreground:SetVertexColor(region.color_anim_r or r, region.color_anim_g or g, region.color_anim_b or b, region.color_anim_a or a) + foregroundSpinner:Color(region.color_anim_r or r, region.color_anim_g or g, region.color_anim_b or b, region.color_anim_a or a) end function region:ColorAnim(r, g, b, a) - region.color_anim_r = r; - region.color_anim_g = g; - region.color_anim_b = b; - region.color_anim_a = a; - if (r or g or b) then - a = a or 1; + region.color_anim_r = r + region.color_anim_g = g + region.color_anim_b = b + region.color_anim_a = a + if r or g or b then + a = a or 1 end - foreground:SetVertexColor(r or region.color_r, g or region.color_g, b or region.color_b, a or region.color_a); - foregroundSpinner:Color(r or region.color_r, g or region.color_g, b or region.color_b, a or region.color_a); + foreground:SetVertexColor(r or region.color_r, g or region.color_g, b or region.color_b, a or region.color_a) + foregroundSpinner:Color(r or region.color_r, g or region.color_g, b or region.color_b, a or region.color_a) end function region:GetColor() - return region.color_r or data.foregroundColor[1], region.color_g or data.foregroundColor[2], - region.color_b or data.foregroundColor[3], region.color_a or data.foregroundColor[4]; + return region.color_r or data.foregroundColor[1], + region.color_g or data.foregroundColor[2], + region.color_b or data.foregroundColor[3], + region.color_a or data.foregroundColor[4] end - region:Color(data.foregroundColor[1], data.foregroundColor[2], data.foregroundColor[3], data.foregroundColor[4]); + region:Color(data.foregroundColor[1], data.foregroundColor[2], data.foregroundColor[3], data.foregroundColor[4]) function region:SetTime(duration, expirationTime, inverse) - local progress = 1; - if (duration ~= 0) then - local remaining = expirationTime - GetTime(); - progress = remaining / duration; - local inversed = (not inverse and region.inverseDirection) or (inverse and not region.inverseDirection); - if(inversed) then - progress = 1 - progress; + local progress = 1 + if duration ~= 0 then + local remaining = expirationTime - GetTime() + progress = remaining / duration + local inversed = (not inverse and region.inverseDirection) or (inverse and not region.inverseDirection) + if inversed then + progress = 1 - progress end end - progress = progress > 0.0001 and progress or 0.0001; - if (data.smoothProgress) then - region.smoothProgress:SetSmoothedValue(progress); + progress = progress > 0.0001 and progress or 0.0001 + if data.smoothProgress then + region.smoothProgress:SetSmoothedValue(progress) else - region:SetValueOnTexture(progress); - region:UpdateAdditionalProgress(); + region:SetValueOnTexture(progress) + region:UpdateAdditionalProgress() end end function region:SetValue(value, total) local progress = 1 - if(total > 0) then - progress = value / total; - if(region.inverseDirection) then - progress = 1 - progress; + if total > 0 then + progress = value / total + if region.inverseDirection then + progress = 1 - progress end end - progress = progress > 0.0001 and progress or 0.0001; - if (data.smoothProgress) then - region.smoothProgress:SetSmoothedValue(progress); + progress = progress > 0.0001 and progress or 0.0001 + if data.smoothProgress then + region.smoothProgress:SetSmoothedValue(progress) else - region:SetValueOnTexture(progress); - region:UpdateAdditionalProgress(); + region:SetValueOnTexture(progress) + region:UpdateAdditionalProgress() end end @@ -1273,14 +1274,14 @@ local function modify(parent, region, data) region.TimerTick = TimerTick region:UpdateRegionHasTimerTick() end - expirationTime = state.expirationTime and state.expirationTime > 0 and state.expirationTime or math.huge; + expirationTime = state.expirationTime and state.expirationTime > 0 and state.expirationTime or math.huge end local duration = state.duration or 0 if region.adjustedMinRelPercent then region.adjustedMinRel = region.adjustedMinRelPercent * duration end - local adjustMin = region.adjustedMin or region.adjustedMinRel or 0; + local adjustMin = region.adjustedMin or region.adjustedMinRel or 0 if duration == 0 then max = 0 elseif region.adjustedMax then @@ -1292,18 +1293,18 @@ local function modify(parent, region, data) max = duration end - region:SetTime(max - adjustMin, expirationTime - adjustMin, state.inverse); + region:SetTime(max - adjustMin, expirationTime - adjustMin, state.inverse) elseif state.progressType == "static" then if region.paused then region:Resume() end - local value = state.value or 0; - local total = state.total or 0; + local value = state.value or 0 + local total = state.total or 0 if region.adjustedMinRelPercent then region.adjustedMinRel = region.adjustedMinRelPercent * total end - local adjustMin = region.adjustedMin or region.adjustedMinRel or 0; + local adjustMin = region.adjustedMin or region.adjustedMinRel or 0 if region.adjustedMax then max = region.adjustedMax @@ -1314,7 +1315,7 @@ local function modify(parent, region, data) max = total end - region:SetValue(value - adjustMin, max - adjustMin); + region:SetValue(value - adjustMin, max - adjustMin) if region.TimerTick then region.TimerTick = nil region:UpdateRegionHasTimerTick() @@ -1340,12 +1341,12 @@ local function modify(parent, region, data) end function region:SetTexture(texture) - region.currentTexture = texture; - WeakAuras.SetTextureOrAtlas(region.foreground, texture, region.textureWrapMode, region.textureWrapMode); - foregroundSpinner:SetTextureOrAtlas(texture); - if (data.sameTexture) then - WeakAuras.SetTextureOrAtlas(background, texture, region.textureWrapMode, region.textureWrapMode); - backgroundSpinner:SetTextureOrAtlas(texture); + region.currentTexture = texture + WeakAuras.SetTextureOrAtlas(region.foreground, texture, region.textureWrapMode, region.textureWrapMode) + foregroundSpinner:SetTextureOrAtlas(texture) + if data.sameTexture then + WeakAuras.SetTextureOrAtlas(background, texture, region.textureWrapMode, region.textureWrapMode) + backgroundSpinner:SetTextureOrAtlas(texture) end for _, extraTexture in ipairs(region.extraTextures) do @@ -1353,61 +1354,61 @@ local function modify(parent, region, data) end for _, extraSpinner in ipairs(region.extraSpinners) do - extraSpinner:SetTextureOrAtlas(texture); + extraSpinner:SetTextureOrAtlas(texture) end end function region:SetForegroundDesaturated(b) - region.foreground:SetDesaturated(b); - region.foregroundSpinner:SetDesaturated(b); + region.foreground:SetDesaturated(b) + region.foregroundSpinner:SetDesaturated(b) end function region:SetBackgroundDesaturated(b) - region.background:SetDesaturated(b); - region.backgroundSpinner:SetDesaturated(b); + region.background:SetDesaturated(b) + region.backgroundSpinner:SetDesaturated(b) end function region:SetBackgroundColor(r, g, b, a) - region.background:SetVertexColor(r, g, b, a); - region.backgroundSpinner:Color(r, g, b, a); + region.background:SetVertexColor(r, g, b, a) + region.backgroundSpinner:Color(r, g, b, a) end function region:SetRegionWidth(width) - region.width = width; - region:Scale(region.scalex, region.scaley); + region.width = width + region:Scale(region.scalex, region.scaley) end function region:SetRegionHeight(height) - region.height = height; - region:Scale(region.scalex, region.scaley); + region.height = height + region:Scale(region.scalex, region.scaley) end function region:SetInverse(inverse) - if (region.inverseDirection == inverse) then - return; + if region.inverseDirection == inverse then + return end - region.inverseDirection = inverse; - local progress = 1 - region.progress; - progress = progress > 0.0001 and progress or 0.0001; - region:SetValueOnTexture(progress); - region:UpdateAdditionalProgress(); + region.inverseDirection = inverse + local progress = 1 - region.progress + progress = progress > 0.0001 and progress or 0.0001 + region:SetValueOnTexture(progress) + region:UpdateAdditionalProgress() end function region:SetOverlayColor(id, r, g, b, a) - self.overlays[id] = { r, g, b, a}; - if (self.extraTextures[id]) then - self.extraTextures[id]:SetVertexColor(r, g, b, a); + self.overlays[id] = { r, g, b, a } + if self.extraTextures[id] then + self.extraTextures[id]:SetVertexColor(r, g, b, a) end - if (self.extraSpinners[id]) then - self.extraSpinners[id]:Color(r, g, b, a); + if self.extraSpinners[id] then + self.extraSpinners[id]:Color(r, g, b, a) end end - WeakAuras.regionPrototype.modifyFinish(parent, region, data); + WeakAuras.regionPrototype.modifyFinish(parent, region, data) end local function validate(data) Private.EnforceSubregionExists(data, "subbackground") end -WeakAuras.RegisterRegionType("progresstexture", create, modify, default, GetProperties, validate); +WeakAuras.RegisterRegionType("progresstexture", create, modify, default, GetProperties, validate) diff --git a/WeakAuras/RegionTypes/RegionPrototype.lua b/WeakAuras/RegionTypes/RegionPrototype.lua index e836d1a58d..d2bf5ea206 100644 --- a/WeakAuras/RegionTypes/RegionPrototype.lua +++ b/WeakAuras/RegionTypes/RegionPrototype.lua @@ -1,15 +1,15 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, Private = ... -local WeakAuras = WeakAuras; -local L = WeakAuras.L; +local WeakAuras = WeakAuras +local L = WeakAuras.L local GetAtlasInfo = WeakAuras.IsClassic() and GetAtlasInfo or C_Texture.GetAtlasInfo -WeakAuras.regionPrototype = {}; - +WeakAuras.regionPrototype = {} -local SubRegionEventSystem = -{ +local SubRegionEventSystem = { ClearSubscribers = function(self) self.events = {} end, @@ -34,7 +34,7 @@ local SubRegionEventSystem = subRegion[event](subRegion, ...) end end - end + end, } local function CreateSubRegionEventSystem() @@ -48,14 +48,14 @@ end -- Alpha function WeakAuras.regionPrototype.AddAlphaToDefault(default) - default.alpha = 1.0; + default.alpha = 1.0 end -- Adjusted Duration function WeakAuras.regionPrototype.AddAdjustedDurationToDefault(default) - default.useAdjustededMax = false; - default.useAdjustededMin = false; + default.useAdjustededMax = false + default.useAdjustededMin = false end function WeakAuras.regionPrototype.AddAdjustedDurationOptions(options, data, order) @@ -64,8 +64,8 @@ function WeakAuras.regionPrototype.AddAdjustedDurationOptions(options, data, ord width = WeakAuras.normalWidth, name = L["Set Minimum Progress"], desc = L["Values/Remaining Time below this value are displayed as no progress."], - order = order - }; + order = order, + } options.adjustedMin = { type = "input", @@ -73,25 +73,29 @@ function WeakAuras.regionPrototype.AddAdjustedDurationOptions(options, data, ord width = WeakAuras.normalWidth, order = order + 0.01, name = L["Minimum"], - hidden = function() return not data.useAdjustededMin end, - desc = L["Enter static or relative values with %"] - }; + hidden = function() + return not data.useAdjustededMin + end, + desc = L["Enter static or relative values with %"], + } options.useAdjustedMinSpacer = { type = "description", width = WeakAuras.normalWidth, name = "", order = order + 0.02, - hidden = function() return not (not data.useAdjustededMin and data.useAdjustededMax) end, - }; + hidden = function() + return not (not data.useAdjustededMin and data.useAdjustededMax) + end, + } options.useAdjustededMax = { type = "toggle", width = WeakAuras.normalWidth, name = L["Set Maximum Progress"], desc = L["Values/Remaining Time above this value are displayed as full progress."], - order = order + 0.03 - }; + order = order + 0.03, + } options.adjustedMax = { type = "input", @@ -99,22 +103,26 @@ function WeakAuras.regionPrototype.AddAdjustedDurationOptions(options, data, ord validate = WeakAuras.ValidateNumericOrPercent, order = order + 0.04, name = L["Maximum"], - hidden = function() return not data.useAdjustededMax end, - desc = L["Enter static or relative values with %"] - }; + hidden = function() + return not data.useAdjustededMax + end, + desc = L["Enter static or relative values with %"], + } options.useAdjustedMaxSpacer = { type = "description", width = WeakAuras.normalWidth, name = "", order = order + 0.05, - hidden = function() return not (data.useAdjustededMin and not data.useAdjustededMax) end, - }; + hidden = function() + return not (data.useAdjustededMin and not data.useAdjustededMax) + end, + } - return options; + return options end -local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ceil(GetScreenHeight() / 20) * 20; +local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ceil(GetScreenHeight() / 20) * 20 function Private.GetAnchorsForData(parentData, type) local result @@ -145,16 +153,16 @@ function WeakAuras.regionPrototype.AddProperties(properties, defaultsForRegion) display = L["Sound"], action = "SoundPlay", type = "sound", - }; + } properties["chat"] = { display = L["Chat Message"], action = "SendChat", type = "chat", - }; + } properties["customcode"] = { display = L["Run Custom Code"], action = "RunCode", - type = "customcode" + type = "customcode", } properties["xOffsetRelative"] = { display = L["Relative X-Offset"], @@ -162,7 +170,7 @@ function WeakAuras.regionPrototype.AddProperties(properties, defaultsForRegion) type = "number", softMin = -screenWidth, softMax = screenWidth, - bigStep = 1 + bigStep = 1, } properties["yOffsetRelative"] = { display = L["Relative Y-Offset"], @@ -170,15 +178,15 @@ function WeakAuras.regionPrototype.AddProperties(properties, defaultsForRegion) type = "number", softMin = -screenHeight, softMax = screenHeight, - bigStep = 1 + bigStep = 1, } properties["glowexternal"] = { display = L["Glow External Element"], action = "GlowExternal", - type = "glowexternal" + type = "glowexternal", } - if (defaultsForRegion and defaultsForRegion.alpha) then + if defaultsForRegion and defaultsForRegion.alpha then properties["alpha"] = { display = L["Alpha"], setter = "SetRegionAlpha", @@ -186,121 +194,135 @@ function WeakAuras.regionPrototype.AddProperties(properties, defaultsForRegion) min = 0, max = 1, bigStep = 0.01, - isPercent = true + isPercent = true, } end end local function SoundRepeatStop(self) - Private.StartProfileSystem("sound"); - if (self.soundRepeatTimer) then - WeakAuras.timer:CancelTimer(self.soundRepeatTimer); - self.soundRepeatTimer = nil; + Private.StartProfileSystem("sound") + if self.soundRepeatTimer then + WeakAuras.timer:CancelTimer(self.soundRepeatTimer) + self.soundRepeatTimer = nil end - Private.StopProfileSystem("sound"); + Private.StopProfileSystem("sound") end local function SoundStop(self) - Private.StartProfileSystem("sound"); - if (self.soundHandle) then - StopSound(self.soundHandle); + Private.StartProfileSystem("sound") + if self.soundHandle then + StopSound(self.soundHandle) end - Private.StopProfileSystem("sound"); + Private.StopProfileSystem("sound") end local function SoundPlayHelper(self) - Private.StartProfileSystem("sound"); - local options = self.soundOptions; - self.soundHandle = nil; - if (not options or options.sound_type == "Stop") then - Private.StopProfileSystem("sound"); - return; + Private.StartProfileSystem("sound") + local options = self.soundOptions + self.soundHandle = nil + if not options or options.sound_type == "Stop" then + Private.StopProfileSystem("sound") + return end - if (WeakAuras.IsOptionsOpen() or Private.SquelchingActions() or WeakAuras.InLoadingScreen()) then - Private.StopProfileSystem("sound"); - return; + if WeakAuras.IsOptionsOpen() or Private.SquelchingActions() or WeakAuras.InLoadingScreen() then + Private.StopProfileSystem("sound") + return end - if (options.sound == " custom") then - if (options.sound_path) then - local ok, _, handle = pcall(PlaySoundFile, options.sound_path, options.sound_channel or "Master"); + if options.sound == " custom" then + if options.sound_path then + local ok, _, handle = pcall(PlaySoundFile, options.sound_path, options.sound_channel or "Master") if ok then - self.soundHandle = handle; + self.soundHandle = handle end end - elseif (options.sound == " KitID") then - if (options.sound_kit_id) then - local ok, _, handle = pcall(PlaySound,options.sound_kit_id, options.sound_channel or "Master"); + elseif options.sound == " KitID" then + if options.sound_kit_id then + local ok, _, handle = pcall(PlaySound, options.sound_kit_id, options.sound_channel or "Master") if ok then - self.soundHandle = handle; + self.soundHandle = handle end end else - local ok, _, handle = pcall(PlaySoundFile, options.sound, options.sound_channel or "Master"); + local ok, _, handle = pcall(PlaySoundFile, options.sound, options.sound_channel or "Master") if ok then - self.soundHandle = handle; + self.soundHandle = handle end end - Private.StopProfileSystem("sound"); + Private.StopProfileSystem("sound") end local function SoundPlay(self, options) - if (not options or WeakAuras.IsOptionsOpen()) then + if not options or WeakAuras.IsOptionsOpen() then return end - Private.StartProfileSystem("sound"); - self:SoundStop(); - self:SoundRepeatStop(); + Private.StartProfileSystem("sound") + self:SoundStop() + self:SoundRepeatStop() - self.soundOptions = options; - SoundPlayHelper(self); + self.soundOptions = options + SoundPlayHelper(self) - local loop = options.do_loop or options.sound_type == "Loop"; - if (loop and options.sound_repeat and options.sound_repeat < Private.maxTimerDuration) then - self.soundRepeatTimer = WeakAuras.timer:ScheduleRepeatingTimer(SoundPlayHelper, options.sound_repeat, self); + local loop = options.do_loop or options.sound_type == "Loop" + if loop and options.sound_repeat and options.sound_repeat < Private.maxTimerDuration then + self.soundRepeatTimer = WeakAuras.timer:ScheduleRepeatingTimer(SoundPlayHelper, options.sound_repeat, self) end - Private.StopProfileSystem("sound"); + Private.StopProfileSystem("sound") end local function SendChat(self, options) - if (not options or WeakAuras.IsOptionsOpen()) then + if not options or WeakAuras.IsOptionsOpen() then return end - Private.HandleChatAction(options.message_type, options.message, options.message_dest, options.message_dest_isunit, options.message_channel, options.r, options.g, options.b, self, options.message_custom, nil, options.message_formaters, options.message_voice); + Private.HandleChatAction( + options.message_type, + options.message, + options.message_dest, + options.message_dest_isunit, + options.message_channel, + options.r, + options.g, + options.b, + self, + options.message_custom, + nil, + options.message_formaters, + options.message_voice + ) end local function RunCode(self, func) if func and not WeakAuras.IsOptionsOpen() then - Private.ActivateAuraEnvironment(self.id, self.cloneId, self.state, self.states); - xpcall(func, Private.GetErrorHandlerId(self.id, L["Custom Condition Code"])); - Private.ActivateAuraEnvironment(nil); + Private.ActivateAuraEnvironment(self.id, self.cloneId, self.state, self.states) + xpcall(func, Private.GetErrorHandlerId(self.id, L["Custom Condition Code"])) + Private.ActivateAuraEnvironment(nil) end end local function GlowExternal(self, options) - if (not options or WeakAuras.IsOptionsOpen()) then + if not options or WeakAuras.IsOptionsOpen() then return end Private.HandleGlowAction(options, self) end local function UpdatePosition(self) - if (not self.anchorPoint or not self.relativeTo or not self.relativePoint) then - return; + if not self.anchorPoint or not self.relativeTo or not self.relativePoint then + return end local xOffset = self.xOffset + (self.xOffsetAnim or 0) + (self.xOffsetRelative or 0) local yOffset = self.yOffset + (self.yOffsetAnim or 0) + (self.yOffsetRelative or 0) - self:RealClearAllPoints(); + self:RealClearAllPoints() - xpcall(self.SetPoint, Private.GetErrorHandlerId(self.id, L["Update Position"]), self, self.anchorPoint, self.relativeTo, self.relativePoint, xOffset, yOffset); + xpcall(self.SetPoint, Private.GetErrorHandlerId(self.id, L["Update Position"]), self, self.anchorPoint, self.relativeTo, self.relativePoint, xOffset, yOffset) end local function ResetPosition(self) - self.anchorPoint = nil; - self.relativeTo = nil; - self.relativePoint = nil; + self.anchorPoint = nil + self.relativeTo = nil + self.relativePoint = nil end local function SetAnchor(self, anchorPoint, relativeTo, relativePoint) @@ -308,40 +330,40 @@ local function SetAnchor(self, anchorPoint, relativeTo, relativePoint) return end - self.anchorPoint = anchorPoint; - self.relativeTo = relativeTo; - self.relativePoint = relativePoint; + self.anchorPoint = anchorPoint + self.relativeTo = relativeTo + self.relativePoint = relativePoint - UpdatePosition(self); + UpdatePosition(self) end local function SetOffset(self, xOffset, yOffset) - if (self.xOffset == xOffset and self.yOffset == yOffset) then - return; + if self.xOffset == xOffset and self.yOffset == yOffset then + return end - self.xOffset = xOffset; - self.yOffset = yOffset; - UpdatePosition(self); + self.xOffset = xOffset + self.yOffset = yOffset + UpdatePosition(self) end local function SetXOffset(self, xOffset) - self:SetOffset(xOffset, self:GetYOffset()); + self:SetOffset(xOffset, self:GetYOffset()) end local function SetYOffset(self, yOffset) - self:SetOffset(self:GetXOffset(), yOffset); + self:SetOffset(self:GetXOffset(), yOffset) end local function GetXOffset(self) - return self.xOffset; + return self.xOffset end local function GetYOffset(self) - return self.yOffset; + return self.yOffset end local function SetOffsetRelative(self, xOffsetRelative, yOffsetRelative) - if (self.xOffsetRelative == xOffsetRelative and self.yOffsetRelative == yOffsetRelative) then + if self.xOffsetRelative == xOffsetRelative and self.yOffsetRelative == yOffsetRelative then return end self.xOffsetRelative = xOffsetRelative @@ -366,37 +388,37 @@ local function GetYOffsetRelative(self) end local function SetOffsetAnim(self, xOffset, yOffset) - if (self.xOffsetAnim == xOffset and self.yOffsetAnim == yOffset) then - return; + if self.xOffsetAnim == xOffset and self.yOffsetAnim == yOffset then + return end - self.xOffsetAnim = xOffset; - self.yOffsetAnim = yOffset; - UpdatePosition(self); + self.xOffsetAnim = xOffset + self.yOffsetAnim = yOffset + UpdatePosition(self) end local function SetRegionAlpha(self, alpha) - if (self.alpha == alpha) then - return; + if self.alpha == alpha then + return end - self.alpha = alpha; - self:SetAlpha(self.animAlpha or self.alpha or 1); + self.alpha = alpha + self:SetAlpha(self.animAlpha or self.alpha or 1) self.subRegionEvents:Notify("AlphaChanged") end local function GetRegionAlpha(self) - return self.animAlpha or self.alpha or 1; + return self.animAlpha or self.alpha or 1 end local function SetAnimAlpha(self, alpha) - if (self.animAlpha == alpha) then - return; + if self.animAlpha == alpha then + return end - self.animAlpha = alpha; - if (WeakAuras.IsOptionsOpen()) then - self:SetAlpha(max(self.animAlpha or self.alpha or 1, 0.5)); + self.animAlpha = alpha + if WeakAuras.IsOptionsOpen() then + self:SetAlpha(max(self.animAlpha or self.alpha or 1, 0.5)) else - self:SetAlpha(self.animAlpha or self.alpha or 1); + self:SetAlpha(self.animAlpha or self.alpha or 1) end self.subRegionEvents:Notify("AlphaChanged") end @@ -410,11 +432,11 @@ local function UpdateRegionHasTimerTick(self) local hasTimerTick = false if self.TimerTick then hasTimerTick = true - elseif (self.subRegions) then + elseif self.subRegions then for index, subRegion in pairs(self.subRegions) do if subRegion.TimerTick then hasTimerTick = true - break; + break end end end @@ -425,13 +447,13 @@ end local function TimerTickForRegion(region) Private.StartProfileSystem("timer tick") - Private.StartProfileAura(region.id); + Private.StartProfileAura(region.id) if region.TimerTick then - region:TimerTick(); + region:TimerTick() end region.subRegionEvents:Notify("TimerTick") - Private.StopProfileAura(region.id); + Private.StopProfileAura(region.id) Private.StopProfileSystem("timer tick") end @@ -440,11 +462,11 @@ local function UpdateTimerTick(self) if not self:GetScript("OnUpdate") then self:SetScript("OnUpdate", function() TimerTickForRegion(self) - end); + end) end else if self:GetScript("OnUpdate") then - self:SetScript("OnUpdate", nil); + self:SetScript("OnUpdate", nil) end end end @@ -455,51 +477,49 @@ local function AnchorSubRegion(self, subRegion, anchorType, selfPoint, anchorPoi if anchorType == "point" then local xOffset = anchorXOffset or 0 local yOffset = anchorYOffset or 0 - subRegion:SetPoint(Private.point_types[selfPoint] and selfPoint or "CENTER", - self, Private.point_types[anchorPoint] and anchorPoint or "CENTER", - xOffset, yOffset) + subRegion:SetPoint(Private.point_types[selfPoint] and selfPoint or "CENTER", self, Private.point_types[anchorPoint] and anchorPoint or "CENTER", xOffset, yOffset) else anchorXOffset = anchorXOffset or 0 anchorYOffset = anchorYOffset or 0 subRegion:SetPoint("bottomleft", self, "bottomleft", -anchorXOffset, -anchorYOffset) - subRegion:SetPoint("topright", self, "topright", anchorXOffset, anchorYOffset) + subRegion:SetPoint("topright", self, "topright", anchorXOffset, anchorYOffset) end end WeakAuras.regionPrototype.AnchorSubRegion = AnchorSubRegion function WeakAuras.regionPrototype.create(region) - local defaultsForRegion = WeakAuras.regionTypes[region.regionType] and WeakAuras.regionTypes[region.regionType].default; - region.SoundPlay = SoundPlay; - region.SoundStop = SoundStop; - region.SoundRepeatStop = SoundRepeatStop; - region.SendChat = SendChat; - region.RunCode = RunCode; - region.GlowExternal = GlowExternal; - - region.SetAnchor = SetAnchor; - region.SetOffset = SetOffset; - region.SetXOffset = SetXOffset; - region.SetYOffset = SetYOffset; - region.GetXOffset = GetXOffset; - region.GetYOffset = GetYOffset; + local defaultsForRegion = WeakAuras.regionTypes[region.regionType] and WeakAuras.regionTypes[region.regionType].default + region.SoundPlay = SoundPlay + region.SoundStop = SoundStop + region.SoundRepeatStop = SoundRepeatStop + region.SendChat = SendChat + region.RunCode = RunCode + region.GlowExternal = GlowExternal + + region.SetAnchor = SetAnchor + region.SetOffset = SetOffset + region.SetXOffset = SetXOffset + region.SetYOffset = SetYOffset + region.GetXOffset = GetXOffset + region.GetYOffset = GetYOffset region.SetOffsetRelative = SetOffsetRelative region.SetXOffsetRelative = SetXOffsetRelative region.SetYOffsetRelative = SetYOffsetRelative region.GetXOffsetRelative = GetXOffsetRelative region.GetYOffsetRelative = GetYOffsetRelative - region.SetOffsetAnim = SetOffsetAnim; - region.ResetPosition = ResetPosition; - region.RealClearAllPoints = region.ClearAllPoints; + region.SetOffsetAnim = SetOffsetAnim + region.ResetPosition = ResetPosition + region.RealClearAllPoints = region.ClearAllPoints region.ClearAllPoints = function() - region:RealClearAllPoints(); - region:ResetPosition(); + region:RealClearAllPoints() + region:ResetPosition() end - if (defaultsForRegion and defaultsForRegion.alpha) then - region.SetRegionAlpha = SetRegionAlpha; - region.GetRegionAlpha = GetRegionAlpha; + if defaultsForRegion and defaultsForRegion.alpha then + region.SetRegionAlpha = SetRegionAlpha + region.GetRegionAlpha = GetRegionAlpha end - region.SetAnimAlpha = SetAnimAlpha; + region.SetAnimAlpha = SetAnimAlpha region.SetTriggerProvidesTimer = SetTriggerProvidesTimer region.UpdateRegionHasTimerTick = UpdateRegionHasTimerTick @@ -519,16 +539,14 @@ function WeakAuras.regionPrototype.modify(parent, region, data) region.states = nil region.subRegionEvents:ClearSubscribers() - local defaultsForRegion = WeakAuras.regionTypes[data.regionType] and WeakAuras.regionTypes[data.regionType].default; + local defaultsForRegion = WeakAuras.regionTypes[data.regionType] and WeakAuras.regionTypes[data.regionType].default if region.SetRegionAlpha then region:SetRegionAlpha(data.alpha) end - local hasAdjustedMin = defaultsForRegion and defaultsForRegion.useAdjustededMin ~= nil and data.useAdjustededMin - and data.adjustedMin; - local hasAdjustedMax = defaultsForRegion and defaultsForRegion.useAdjustededMax ~= nil and data.useAdjustededMax - and data.adjustedMax; + local hasAdjustedMin = defaultsForRegion and defaultsForRegion.useAdjustededMin ~= nil and data.useAdjustededMin and data.adjustedMin + local hasAdjustedMax = defaultsForRegion and defaultsForRegion.useAdjustededMax ~= nil and data.useAdjustededMax and data.adjustedMax region.adjustedMin = nil region.adjustedMinRel = nil @@ -537,15 +555,15 @@ function WeakAuras.regionPrototype.modify(parent, region, data) region.adjustedMaxRel = nil region.adjustedMaxRelPercent = nil - if (hasAdjustedMin) then + if hasAdjustedMin then local percent = string.match(data.adjustedMin, "(%d+)%%") if percent then region.adjustedMinRelPercent = tonumber(percent) / 100 else - region.adjustedMin = tonumber(data.adjustedMin); + region.adjustedMin = tonumber(data.adjustedMin) end end - if (hasAdjustedMax) then + if hasAdjustedMax then local percent = string.match(data.adjustedMax, "(%d+)%%") if percent then region.adjustedMaxRelPercent = tonumber(percent) / 100 @@ -554,9 +572,9 @@ function WeakAuras.regionPrototype.modify(parent, region, data) end end - region:SetOffset(data.xOffset or 0, data.yOffset or 0); + region:SetOffset(data.xOffset or 0, data.yOffset or 0) region:SetOffsetRelative(0, 0) - region:SetOffsetAnim(0, 0); + region:SetOffsetAnim(0, 0) if data.anchorFrameType == "CUSTOM" and data.customAnchor then region.customAnchorFunc = WeakAuras.LoadFunction("return " .. data.customAnchor) @@ -568,17 +586,13 @@ function WeakAuras.regionPrototype.modify(parent, region, data) if -- Don't anchor single Auras that with custom anchoring, -- these will be anchored in expand - not ( - data.anchorFrameType == "CUSTOM" - or data.anchorFrameType == "UNITFRAME" - or data.anchorFrameType == "NAMEPLATE" - ) + not (data.anchorFrameType == "CUSTOM" or data.anchorFrameType == "UNITFRAME" or data.anchorFrameType == "NAMEPLATE") -- Group Auras that will never be expanded, so those need -- to be always anchored here or data.regionType == "dynamicgroup" or data.regionType == "group" then - Private.AnchorFrame(data, region, parent); + Private.AnchorFrame(data, region, parent) end end @@ -597,7 +611,6 @@ function WeakAuras.regionPrototype.modify(parent, region, data) end return data.actions.finish[fullKey] end, true) - end function WeakAuras.regionPrototype.modifyFinish(parent, region, data) @@ -634,15 +647,15 @@ function WeakAuras.regionPrototype.modifyFinish(parent, region, data) end local function SetProgressValue(region, value, total) - local adjustMin = region.adjustedMin or 0; - local max = region.adjustedMax or total; + local adjustMin = region.adjustedMin or 0 + local max = region.adjustedMax or total - region:SetValue(value - adjustMin, max - adjustMin); + region:SetValue(value - adjustMin, max - adjustMin) end local regionsForFrameTick = {} -local frameForFrameTick = CreateFrame("Frame"); +local frameForFrameTick = CreateFrame("Frame") WeakAuras.frames["Frame Tick Frame"] = frameForFrameTick @@ -652,12 +665,12 @@ local function FrameTick() end Private.StartProfileSystem("frame tick") for region in pairs(regionsForFrameTick) do - Private.StartProfileAura(region.id); + Private.StartProfileAura(region.id) if region.FrameTick then region.FrameTick() end region.subRegionEvents:Notify("FrameTick") - Private.StopProfileAura(region.id); + Private.StopProfileAura(region.id) end Private.StopProfileSystem("frame tick") end @@ -666,7 +679,7 @@ local function RegisterForFrameTick(region) -- Check for a Frame Tick function local hasFrameTick = region.FrameTick if not hasFrameTick then - if (region.subRegions) then + if region.subRegions then for index, subRegion in pairs(region.subRegions) do if subRegion.FrameTick then hasFrameTick = true @@ -682,7 +695,7 @@ local function RegisterForFrameTick(region) regionsForFrameTick[region] = true if not frameForFrameTick:GetScript("OnUpdate") then - frameForFrameTick:SetScript("OnUpdate", FrameTick); + frameForFrameTick:SetScript("OnUpdate", FrameTick) end end @@ -695,7 +708,7 @@ end local function TimerTickForSetDuration(self) local duration = self.duration - local adjustMin = self.adjustedMin or 0; + local adjustMin = self.adjustedMin or 0 local max if duration == 0 then @@ -706,35 +719,35 @@ local function TimerTickForSetDuration(self) max = duration end - self:SetTime(max - adjustMin, self.expirationTime - adjustMin, self.inverse); + self:SetTime(max - adjustMin, self.expirationTime - adjustMin, self.inverse) end function WeakAuras.regionPrototype.AddSetDurationInfo(region) - if (region.SetValue and region.SetTime) then - region.generatedSetDurationInfo = true; + if region.SetValue and region.SetTime then + region.generatedSetDurationInfo = true -- WeakAuras no longer calls SetDurationInfo, but some people do that, -- In that case we also need to overwrite TimerTick region.SetDurationInfo = function(self, duration, expirationTime, customValue, inverse) self.duration = duration or 0 - self.expirationTime = expirationTime; - self.inverse = inverse; + self.expirationTime = expirationTime + self.inverse = inverse if customValue then - SetProgressValue(region, duration, expirationTime); + SetProgressValue(region, duration, expirationTime) region.TimerTick = nil region:UpdateRegionHasTimerTick() else - local adjustMin = region.adjustedMin or 0; - region:SetTime((duration ~= 0 and region.adjustedMax or duration) - adjustMin, expirationTime - adjustMin, inverse); + local adjustMin = region.adjustedMin or 0 + region:SetTime((duration ~= 0 and region.adjustedMax or duration) - adjustMin, expirationTime - adjustMin, inverse) region.TimerTick = TimerTickForSetDuration region:UpdateRegionHasTimerTick() end end - elseif (region.generatedSetDurationInfo) then - region.generatedSetDurationInfo = nil; - region.SetDurationInfo = nil; + elseif region.generatedSetDurationInfo then + region.generatedSetDurationInfo = nil + region.SetDurationInfo = nil end end @@ -742,11 +755,11 @@ end function WeakAuras.regionPrototype.AddExpandFunction(data, region, cloneId, parent, parentRegionType) local uid = data.uid local id = data.id - local inDynamicGroup = parentRegionType == "dynamicgroup"; - local inGroup = parentRegionType == "group"; + local inDynamicGroup = parentRegionType == "dynamicgroup" + local inGroup = parentRegionType == "group" local startMainAnimation = function() - Private.Animate("display", uid, "main", data.animation.main, region, false, nil, true, cloneId); + Private.Animate("display", uid, "main", data.animation.main, region, false, nil, true, cloneId) end function region:OptionsClosed() @@ -764,8 +777,8 @@ function WeakAuras.regionPrototype.AddExpandFunction(data, region, cloneId, pare end end - local hideRegion; - if(inDynamicGroup) then + local hideRegion + if inDynamicGroup then hideRegion = function() if region.PreHide then region:PreHide() @@ -775,12 +788,20 @@ function WeakAuras.regionPrototype.AddExpandFunction(data, region, cloneId, pare region.subRegionEvents:Notify("PreHide") if region:IsProtected() then if InCombatLockdown() then - Private.AuraWarnings.UpdateWarning(uid, "protected_frame_error", "error", - L["Cannot change secure frame in combat lockdown. Find more information:\nhttps://github.com/WeakAuras/WeakAuras2/wiki/Protected-Frames"], - true) + Private.AuraWarnings.UpdateWarning( + uid, + "protected_frame_error", + "error", + L["Cannot change secure frame in combat lockdown. Find more information:\nhttps://github.com/WeakAuras/WeakAuras2/wiki/Protected-Frames"], + true + ) else - Private.AuraWarnings.UpdateWarning(uid, "protected_frame", "warning", - L["Secure frame detected. Find more information:\nhttps://github.com/WeakAuras/WeakAuras2/wiki/Protected-Frames"]) + Private.AuraWarnings.UpdateWarning( + uid, + "protected_frame", + "warning", + L["Secure frame detected. Find more information:\nhttps://github.com/WeakAuras/WeakAuras2/wiki/Protected-Frames"] + ) region:Hide() end else @@ -789,11 +810,11 @@ function WeakAuras.regionPrototype.AddExpandFunction(data, region, cloneId, pare end region.states = nil region.state = nil - if (cloneId) then - Private.ReleaseClone(region.id, cloneId, data.regionType); + if cloneId then + Private.ReleaseClone(region.id, cloneId, data.regionType) parent:RemoveChild(id, cloneId) else - parent:DeactivateChild(id, cloneId); + parent:DeactivateChild(id, cloneId) end end else @@ -806,12 +827,20 @@ function WeakAuras.regionPrototype.AddExpandFunction(data, region, cloneId, pare if region:IsProtected() then if InCombatLockdown() then - Private.AuraWarnings.UpdateWarning(uid, "protected_frame_error", "error", - L["Cannot change secure frame in combat lockdown. Find more information:\nhttps://github.com/WeakAuras/WeakAuras2/wiki/Protected-Frames"], - true) + Private.AuraWarnings.UpdateWarning( + uid, + "protected_frame_error", + "error", + L["Cannot change secure frame in combat lockdown. Find more information:\nhttps://github.com/WeakAuras/WeakAuras2/wiki/Protected-Frames"], + true + ) else - Private.AuraWarnings.UpdateWarning(uid, "protected_frame", "warning", - L["Secure frame detected. Find more information:\nhttps://github.com/WeakAuras/WeakAuras2/wiki/Protected-Frames"]) + Private.AuraWarnings.UpdateWarning( + uid, + "protected_frame", + "warning", + L["Secure frame detected. Find more information:\nhttps://github.com/WeakAuras/WeakAuras2/wiki/Protected-Frames"] + ) region:Hide() end else @@ -821,39 +850,39 @@ function WeakAuras.regionPrototype.AddExpandFunction(data, region, cloneId, pare region.states = nil region.state = nil - if (cloneId) then - Private.ReleaseClone(region.id, cloneId, data.regionType); + if cloneId then + Private.ReleaseClone(region.id, cloneId, data.regionType) end end end - if(inDynamicGroup) then + if inDynamicGroup then function region:Collapse() - if (not region.toShow) then - return; + if not region.toShow then + return end - region.toShow = false; + region.toShow = false region:SetScript("OnUpdate", nil) - Private.PerformActions(data, "finish", region); - if (not Private.Animate("display", data.uid, "finish", data.animation.finish, region, false, hideRegion, nil, cloneId)) then - hideRegion(); + Private.PerformActions(data, "finish", region) + if not Private.Animate("display", data.uid, "finish", data.animation.finish, region, false, hideRegion, nil, cloneId) then + hideRegion() end - if (region.SoundRepeatStop) then - region:SoundRepeatStop(); + if region.SoundRepeatStop then + region:SoundRepeatStop() end UnRegisterForFrameTick(region) region:UpdateTimerTick() end function region:Expand() - if (region.toShow) then - return; + if region.toShow then + return end - region.toShow = true; - if(region.PreShow) then - region:PreShow(); + region.toShow = true + if region.PreShow then + region:PreShow() end region.subRegionEvents:Notify("PreShow") @@ -861,12 +890,20 @@ function WeakAuras.regionPrototype.AddExpandFunction(data, region, cloneId, pare Private.ApplyFrameLevel(region) if region:IsProtected() then if InCombatLockdown() then - Private.AuraWarnings.UpdateWarning(uid, "protected_frame_error", "error", + Private.AuraWarnings.UpdateWarning( + uid, + "protected_frame_error", + "error", L["Cannot change secure frame in combat lockdown. Find more information:\nhttps://github.com/WeakAuras/WeakAuras2/wiki/Protected-Frames"], - true) + true + ) else - Private.AuraWarnings.UpdateWarning(uid, "protected_frame", "warning", - L["Secure frame detected. Find more information:\nhttps://github.com/WeakAuras/WeakAuras2/wiki/Protected-Frames"]) + Private.AuraWarnings.UpdateWarning( + uid, + "protected_frame", + "warning", + L["Secure frame detected. Find more information:\nhttps://github.com/WeakAuras/WeakAuras2/wiki/Protected-Frames"] + ) region:Show() end else @@ -874,55 +911,51 @@ function WeakAuras.regionPrototype.AddExpandFunction(data, region, cloneId, pare region:Show() end - Private.PerformActions(data, "start", region); - if not(Private.Animate("display", data.uid, "start", data.animation.start, region, true, startMainAnimation, nil, cloneId)) then - startMainAnimation(); + Private.PerformActions(data, "start", region) + if not (Private.Animate("display", data.uid, "start", data.animation.start, region, true, startMainAnimation, nil, cloneId)) then + startMainAnimation() end - parent:ActivateChild(data.id, cloneId); + parent:ActivateChild(data.id, cloneId) RegisterForFrameTick(region) region:UpdateTimerTick() end - elseif not(data.controlledChildren) then + elseif not data.controlledChildren then function region:Collapse() - if (not region.toShow) then - return; + if not region.toShow then + return end - region.toShow = false; + region.toShow = false region:SetScript("OnUpdate", nil) - Private.PerformActions(data, "finish", region); - if (not Private.Animate("display", data.uid, "finish", data.animation.finish, region, false, hideRegion, nil, cloneId)) then - hideRegion(); + Private.PerformActions(data, "finish", region) + if not Private.Animate("display", data.uid, "finish", data.animation.finish, region, false, hideRegion, nil, cloneId) then + hideRegion() end if inGroup then - parent:UpdateBorder(region); + parent:UpdateBorder(region) end - if (region.SoundRepeatStop) then - region:SoundRepeatStop(); + if region.SoundRepeatStop then + region:SoundRepeatStop() end UnRegisterForFrameTick(region) region:UpdateTimerTick() end function region:Expand() - if data.anchorFrameType == "SELECTFRAME" - or data.anchorFrameType == "CUSTOM" - or data.anchorFrameType == "UNITFRAME" - or data.anchorFrameType == "NAMEPLATE" - then - Private.AnchorFrame(data, region, parent); + if data.anchorFrameType == "SELECTFRAME" or data.anchorFrameType == "CUSTOM" or data.anchorFrameType == "UNITFRAME" or data.anchorFrameType == "NAMEPLATE" then + Private.AnchorFrame(data, region, parent) end - if (region.toShow) then - return; + if region.toShow then + return end region.toShow = true - if(region.PreShow) then - region:PreShow(); + if region.PreShow then + region:PreShow() end region.subRegionEvents:Notify("PreShow") @@ -930,12 +963,20 @@ function WeakAuras.regionPrototype.AddExpandFunction(data, region, cloneId, pare if region:IsProtected() then if InCombatLockdown() then - Private.AuraWarnings.UpdateWarning(uid, "protected_frame_error", "error", + Private.AuraWarnings.UpdateWarning( + uid, + "protected_frame_error", + "error", L["Cannot change secure frame in combat lockdown. Find more information:\nhttps://github.com/WeakAuras/WeakAuras2/wiki/Protected-Frames"], - true) + true + ) else - Private.AuraWarnings.UpdateWarning(uid, "protected_frame", "warning", - L["Secure frame detected. Find more information:\nhttps://github.com/WeakAuras/WeakAuras2/wiki/Protected-Frames"]) + Private.AuraWarnings.UpdateWarning( + uid, + "protected_frame", + "warning", + L["Secure frame detected. Find more information:\nhttps://github.com/WeakAuras/WeakAuras2/wiki/Protected-Frames"] + ) region:Show() end else @@ -943,13 +984,13 @@ function WeakAuras.regionPrototype.AddExpandFunction(data, region, cloneId, pare region:Show() end - Private.PerformActions(data, "start", region); - if not(Private.Animate("display", data.uid, "start", data.animation.start, region, true, startMainAnimation, nil, cloneId)) then - startMainAnimation(); + Private.PerformActions(data, "start", region) + if not (Private.Animate("display", data.uid, "start", data.animation.start, region, true, startMainAnimation, nil, cloneId)) then + startMainAnimation() end if inGroup then - parent:UpdateBorder(region); + parent:UpdateBorder(region) end RegisterForFrameTick(region) @@ -977,7 +1018,7 @@ end function WeakAuras.SetTextureOrAtlas(texture, path, wrapModeH, wrapModeV) if type(path) == "string" and GetAtlasInfo(path) then - return texture:SetAtlas(path); + return texture:SetAtlas(path) else if (texture.wrapModeH and texture.wrapModeH ~= wrapModeH) or (texture.wrapModeV and texture.wrapModeV ~= wrapModeV) then -- WORKAROUND https://github.com/Stanzilla/WoWUIBugs/issues/250 @@ -985,7 +1026,7 @@ function WeakAuras.SetTextureOrAtlas(texture, path, wrapModeH, wrapModeV) end texture.wrapModeH = wrapModeH texture.wrapModeV = wrapModeV - return texture:SetTexture(path, wrapModeH, wrapModeV); + return texture:SetTexture(path, wrapModeH, wrapModeV) end end @@ -999,7 +1040,7 @@ do local subRegionIndex, property = change.property:match("^sub%.(%d+)%.(.*)") subRegionIndex = tonumber(subRegionIndex) if subRegionIndex and property then - if (subRegionIndex >= afterPos) then + if subRegionIndex >= afterPos then change.property = "sub." .. subRegionIndex + offset .. "." .. property end end @@ -1022,7 +1063,7 @@ do -- add if missing if #indexes == 0 then tinsert(data.subRegions, 1, { - ["type"] = subregionType + ["type"] = subregionType, }) move_condition_subregions(data, 1, 1) -- delete duplicate diff --git a/WeakAuras/RegionTypes/StopMotion.lua b/WeakAuras/RegionTypes/StopMotion.lua index 93797aae55..0a0e5232d3 100644 --- a/WeakAuras/RegionTypes/StopMotion.lua +++ b/WeakAuras/RegionTypes/StopMotion.lua @@ -1,50 +1,52 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, Private = ... -local texture_data = WeakAuras.StopMotion.texture_data; -local L = WeakAuras.L; +local texture_data = WeakAuras.StopMotion.texture_data +local L = WeakAuras.L local default = { - foregroundTexture = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\stopmotion", - backgroundTexture = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\stopmotion", - desaturateBackground = false, - desaturateForeground = false, - sameTexture = true, - width = 128, - height = 128, - foregroundColor = {1, 1, 1, 1}, - backgroundColor = {0.5, 0.5, 0.5, 0.5}, - blendMode = "BLEND", - rotation = 0, - discrete_rotation = 0, - mirror = false, - rotate = true, - selfPoint = "CENTER", - anchorPoint = "CENTER", - anchorFrameType = "SCREEN", - xOffset = 0, - yOffset = 0, - frameStrata = 1, - startPercent = 0, - endPercent = 1, - backgroundPercent = 1, - frameRate = 15, - animationType = "loop", - inverse = false, - customForegroundFrames = 0, - customForegroundRows = 16, - customForegroundColumns = 16, - customBackgroundFrames = 0, - customForegroundFileWidth = 0, - customForegroundFileHeight = 0, - customForegroundFrameWidth = 0, - customForegroundFrameHeight = 0, - customBackgroundRows = 16, - customBackgroundColumns = 16, - hideBackground = true -}; - -local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ceil(GetScreenHeight() / 20) * 20; + foregroundTexture = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\stopmotion", + backgroundTexture = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\stopmotion", + desaturateBackground = false, + desaturateForeground = false, + sameTexture = true, + width = 128, + height = 128, + foregroundColor = { 1, 1, 1, 1 }, + backgroundColor = { 0.5, 0.5, 0.5, 0.5 }, + blendMode = "BLEND", + rotation = 0, + discrete_rotation = 0, + mirror = false, + rotate = true, + selfPoint = "CENTER", + anchorPoint = "CENTER", + anchorFrameType = "SCREEN", + xOffset = 0, + yOffset = 0, + frameStrata = 1, + startPercent = 0, + endPercent = 1, + backgroundPercent = 1, + frameRate = 15, + animationType = "loop", + inverse = false, + customForegroundFrames = 0, + customForegroundRows = 16, + customForegroundColumns = 16, + customBackgroundFrames = 0, + customForegroundFileWidth = 0, + customForegroundFileHeight = 0, + customForegroundFrameWidth = 0, + customForegroundFrameHeight = 0, + customBackgroundRows = 16, + customBackgroundColumns = 16, + hideBackground = true, +} + +local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ceil(GetScreenHeight() / 20) * 20 local properties = { desaturateForeground = { @@ -60,12 +62,12 @@ local properties = { foregroundColor = { display = L["Foreground Color"], setter = "Color", - type = "color" + type = "color", }, backgroundColor = { display = L["Background Color"], setter = "SetBackgroundColor", - type = "color" + type = "color", }, width = { display = L["Width"], @@ -81,53 +83,55 @@ local properties = { type = "number", min = 1, softMax = screenHeight, - bigStep = 1 + bigStep = 1, }, } -WeakAuras.regionPrototype.AddProperties(properties, default); +WeakAuras.regionPrototype.AddProperties(properties, default) local function create(parent) - local frame = CreateFrame("Frame", nil, UIParent); - frame.regionType = "stopmotion" - frame:SetMovable(true); - frame:SetResizable(true); - frame:SetMinResize(1, 1); + local frame = CreateFrame("Frame", nil, UIParent) + frame.regionType = "stopmotion" + frame:SetMovable(true) + frame:SetResizable(true) + frame:SetMinResize(1, 1) - local background = frame:CreateTexture(nil, "BACKGROUND"); - frame.background = background; - background:SetAllPoints(frame); + local background = frame:CreateTexture(nil, "BACKGROUND") + frame.background = background + background:SetAllPoints(frame) - local foreground = frame:CreateTexture(nil, "ART"); - frame.foreground = foreground; - foreground:SetAllPoints(frame); + local foreground = frame:CreateTexture(nil, "ART") + frame.foreground = foreground + foreground:SetAllPoints(frame) - WeakAuras.regionPrototype.create(frame); + WeakAuras.regionPrototype.create(frame) - return frame; + return frame end local function SetTextureViaAtlas(self, texture) - self:SetTexture(texture); + self:SetTexture(texture) end local function setTile(texture, frame, rows, columns, frameScaleW, frameScaleH) - frame = frame - 1; - local row = floor(frame / columns); - local column = frame % columns; + frame = frame - 1 + local row = floor(frame / columns) + local column = frame % columns local deltaX = frameScaleW / columns local deltaY = frameScaleH / rows - local left = deltaX * column; - local right = left + deltaX; + local left = deltaX * column + local right = left + deltaX - local top = deltaY * row; - local bottom = top + deltaY; - pcall(function() texture:SetTexCoord(left, right, top, bottom) end) + local top = deltaY * row + local bottom = top + deltaY + pcall(function() + texture:SetTexCoord(left, right, top, bottom) + end) end -WeakAuras.setTile = setTile; +WeakAuras.setTile = setTile local function SetFrameViaAtlas(self, texture, frame) local frameScaleW = 1 @@ -138,351 +142,349 @@ local function SetFrameViaAtlas(self, texture, frame) if self.fileHeight and self.frameHeight and self.fileHeight > 0 and self.frameHeight > 0 then frameScaleH = (self.frameHeight * self.rows) / self.fileHeight end - setTile(self, frame, self.rows, self.columns, frameScaleW, frameScaleH); + setTile(self, frame, self.rows, self.columns, frameScaleW, frameScaleH) end local function SetTextureViaFrames(self, texture) - self:SetTexture(texture .. format("%03d", 0)); - self:SetTexCoord(0, 1, 0, 1); + self:SetTexture(texture .. format("%03d", 0)) + self:SetTexCoord(0, 1, 0, 1) end local function SetFrameViaFrames(self, texture, frame) - self:SetTexture(texture .. format("%03d", frame)); + self:SetTexture(texture .. format("%03d", frame)) end local function modify(parent, region, data) - WeakAuras.regionPrototype.modify(parent, region, data); - region.foreground = region.foreground or {} - region.background = region.background or {} - local pattern = "%.x(%d+)y(%d+)f(%d+)%.[tb][gl][ap]" - local pattern2 = "%.x(%d+)y(%d+)f(%d+)w(%d+)h(%d+)W(%d+)H(%d+)%.[tb][gl][ap]" - - do - local tdata = texture_data[data.foregroundTexture]; - if (tdata) then - local lastFrame = tdata.count - 1; + WeakAuras.regionPrototype.modify(parent, region, data) + region.foreground = region.foreground or {} + region.background = region.background or {} + local pattern = "%.x(%d+)y(%d+)f(%d+)%.[tb][gl][ap]" + local pattern2 = "%.x(%d+)y(%d+)f(%d+)w(%d+)h(%d+)W(%d+)H(%d+)%.[tb][gl][ap]" + + do + local tdata = texture_data[data.foregroundTexture] + if tdata then + local lastFrame = tdata.count - 1 + region.foreground.lastFrame = lastFrame + region.startFrame = floor((data.startPercent or 0) * lastFrame) + 1 + region.endFrame = floor((data.endPercent or 1) * lastFrame) + 1 + region.foreground.rows = tdata.rows + region.foreground.columns = tdata.columns + region.foreground.fileWidth = 0 + region.foreground.fileHeight = 0 + region.foreground.frameWidth = 0 + region.foreground.frameHeight = 0 + else + local rows, columns, frames = data.foregroundTexture:lower():match(pattern) + if rows then + local lastFrame = tonumber(frames) - 1 region.foreground.lastFrame = lastFrame - region.startFrame = floor( (data.startPercent or 0) * lastFrame) + 1; - region.endFrame = floor( (data.endPercent or 1) * lastFrame) + 1; - region.foreground.rows = tdata.rows; - region.foreground.columns = tdata.columns; + region.startFrame = floor((data.startPercent or 0) * lastFrame) + 1 + region.endFrame = floor((data.endPercent or 1) * lastFrame) + 1 + region.foreground.rows = tonumber(rows) + region.foreground.columns = tonumber(columns) region.foreground.fileWidth = 0 region.foreground.fileHeight = 0 region.foreground.frameWidth = 0 region.foreground.frameHeight = 0 else - local rows, columns, frames = data.foregroundTexture:lower():match(pattern) + local rows, columns, frames, frameWidth, frameHeight, fileWidth, fileHeight = data.foregroundTexture:match(pattern2) if rows then - local lastFrame = tonumber(frames) - 1; + local lastFrame = tonumber(frames) - 1 region.foreground.lastFrame = lastFrame - region.startFrame = floor( (data.startPercent or 0) * lastFrame) + 1; - region.endFrame = floor( (data.endPercent or 1) * lastFrame) + 1; + region.startFrame = floor((data.startPercent or 0) * lastFrame) + 1 + region.endFrame = floor((data.endPercent or 1) * lastFrame) + 1 region.foreground.rows = tonumber(rows) region.foreground.columns = tonumber(columns) - region.foreground.fileWidth = 0 - region.foreground.fileHeight = 0 - region.foreground.frameWidth = 0 - region.foreground.frameHeight = 0 + region.foreground.fileWidth = tonumber(fileWidth) + region.foreground.fileHeight = tonumber(fileHeight) + region.foreground.frameWidth = tonumber(frameWidth) + region.foreground.frameHeight = tonumber(frameHeight) else - local rows, columns, frames, frameWidth, frameHeight, fileWidth, fileHeight = data.foregroundTexture:match(pattern2) - if rows then - local lastFrame = tonumber(frames) - 1; - region.foreground.lastFrame = lastFrame - region.startFrame = floor( (data.startPercent or 0) * lastFrame) + 1; - region.endFrame = floor( (data.endPercent or 1) * lastFrame) + 1; - region.foreground.rows = tonumber(rows) - region.foreground.columns = tonumber(columns) - region.foreground.fileWidth = tonumber(fileWidth) - region.foreground.fileHeight = tonumber(fileHeight) - region.foreground.frameWidth = tonumber(frameWidth) - region.foreground.frameHeight = tonumber(frameHeight) - else - local lastFrame = (data.customForegroundFrames or 256) - 1; - region.foreground.lastFrame = lastFrame - region.startFrame = floor( (data.startPercent or 0) * lastFrame) + 1; - region.endFrame = floor( (data.endPercent or 1) * lastFrame) + 1; - region.foreground.rows = data.customForegroundRows; - region.foreground.columns = data.customForegroundColumns; - region.foreground.fileWidth = data.customForegroundFileWidth - region.foreground.fileHeight = data.customForegroundFileHeight - region.foreground.frameWidth = data.customForegroundFrameWidth - region.foreground.frameHeight = data.customForegroundFrameHeight - end + local lastFrame = (data.customForegroundFrames or 256) - 1 + region.foreground.lastFrame = lastFrame + region.startFrame = floor((data.startPercent or 0) * lastFrame) + 1 + region.endFrame = floor((data.endPercent or 1) * lastFrame) + 1 + region.foreground.rows = data.customForegroundRows + region.foreground.columns = data.customForegroundColumns + region.foreground.fileWidth = data.customForegroundFileWidth + region.foreground.fileHeight = data.customForegroundFileHeight + region.foreground.frameWidth = data.customForegroundFrameWidth + region.foreground.frameHeight = data.customForegroundFrameHeight end end end + end - local backgroundTexture = data.sameTexture - and data.foregroundTexture - or data.backgroundTexture; - - do - if data.sameTexture then - region.backgroundFrame = floor( (data.backgroundPercent or 1) * region.foreground.lastFrame + 1); - region.background.rows = region.foreground.rows - region.background.columns = region.foreground.columns - region.background.fileWidth = region.foreground.fileWidth - region.background.fileHeight = region.foreground.fileHeight - region.background.frameWidth = region.foreground.frameWidth - region.background.frameHeight = region.foreground.frameHeight + local backgroundTexture = data.sameTexture and data.foregroundTexture or data.backgroundTexture + + do + if data.sameTexture then + region.backgroundFrame = floor((data.backgroundPercent or 1) * region.foreground.lastFrame + 1) + region.background.rows = region.foreground.rows + region.background.columns = region.foreground.columns + region.background.fileWidth = region.foreground.fileWidth + region.background.fileHeight = region.foreground.fileHeight + region.background.frameWidth = region.foreground.frameWidth + region.background.frameHeight = region.foreground.frameHeight + else + local tdata = texture_data[data.backgroundTexture] + if tdata then + local lastFrame = tdata.count - 1 + region.backgroundFrame = floor((data.backgroundPercent or 1) * lastFrame + 1) + region.background.rows = tdata.rows + region.background.columns = tdata.columns + region.background.fileWidth = 0 + region.background.fileHeight = 0 + region.background.frameWidth = 0 + region.background.frameHeight = 0 else - local tdata = texture_data[data.backgroundTexture]; - if (tdata) then - local lastFrame = tdata.count - 1; - region.backgroundFrame = floor( (data.backgroundPercent or 1) * lastFrame + 1); - region.background.rows = tdata.rows; - region.background.columns = tdata.columns; + local rows, columns, frames = data.backgroundTexture:lower():match(pattern) + if rows then + local lastFrame = frames - 1 + region.backgroundFrame = floor((data.backgroundPercent or 1) * lastFrame + 1) + region.background.rows = tonumber(rows) + region.background.columns = tonumber(columns) region.background.fileWidth = 0 region.background.fileHeight = 0 region.background.frameWidth = 0 region.background.frameHeight = 0 else - local rows, columns, frames = data.backgroundTexture:lower():match(pattern) + local rows, columns, frames, frameWidth, frameHeight, fileWidth, fileHeight = data.backgroundTexture:match(pattern2) if rows then - local lastFrame = frames - 1; - region.backgroundFrame = floor( (data.backgroundPercent or 1) * lastFrame + 1); + local lastFrame = frames - 1 + region.backgroundFrame = floor((data.backgroundPercent or 1) * lastFrame + 1) region.background.rows = tonumber(rows) region.background.columns = tonumber(columns) - region.background.fileWidth = 0 - region.background.fileHeight = 0 - region.background.frameWidth = 0 - region.background.frameHeight = 0 + region.background.fileWidth = tonumber(fileWidth) + region.background.fileHeight = tonumber(fileHeight) + region.background.frameWidth = tonumber(frameWidth) + region.background.frameHeight = tonumber(frameHeight) else - local rows, columns, frames, frameWidth, frameHeight, fileWidth, fileHeight = data.backgroundTexture:match(pattern2) - if rows then - local lastFrame = frames - 1; - region.backgroundFrame = floor( (data.backgroundPercent or 1) * lastFrame + 1); - region.background.rows = tonumber(rows) - region.background.columns = tonumber(columns) - region.background.fileWidth = tonumber(fileWidth) - region.background.fileHeight = tonumber(fileHeight) - region.background.frameWidth = tonumber(frameWidth) - region.background.frameHeight = tonumber(frameHeight) - else - local lastFrame = (data.customBackgroundFrames or 256) - 1; - region.backgroundFrame = floor( (data.backgroundPercent or 1) * lastFrame + 1); - region.background.rows = data.customBackgroundRows; - region.background.columns = data.customBackgroundColumns; - region.background.fileWidth = data.customBackgroundFileWidth - region.background.fileHeight = data.customBackgroundFileHeight - region.background.frameWidth = data.customBackgroundFrameWidth - region.background.frameHeight = data.customBackgroundFrameHeight - end + local lastFrame = (data.customBackgroundFrames or 256) - 1 + region.backgroundFrame = floor((data.backgroundPercent or 1) * lastFrame + 1) + region.background.rows = data.customBackgroundRows + region.background.columns = data.customBackgroundColumns + region.background.fileWidth = data.customBackgroundFileWidth + region.background.fileHeight = data.customBackgroundFileHeight + region.background.frameWidth = data.customBackgroundFrameWidth + region.background.frameHeight = data.customBackgroundFrameHeight end end end end + end - if (region.foreground.rows and region.foreground.columns) then - region.foreground.SetBaseTexture = SetTextureViaAtlas; - region.foreground.SetFrame = SetFrameViaAtlas; - else - region.foreground.SetBaseTexture = SetTextureViaFrames; - region.foreground.SetFrame = SetFrameViaFrames; - end + if region.foreground.rows and region.foreground.columns then + region.foreground.SetBaseTexture = SetTextureViaAtlas + region.foreground.SetFrame = SetFrameViaAtlas + else + region.foreground.SetBaseTexture = SetTextureViaFrames + region.foreground.SetFrame = SetFrameViaFrames + end - if (region.background.rows and region.background.columns) then - region.background.SetBaseTexture = SetTextureViaAtlas; - region.background.SetFrame = SetFrameViaAtlas; - else - region.background.SetBaseTexture = SetTextureViaFrames; - region.background.SetFrame = SetFrameViaFrames; - end + if region.background.rows and region.background.columns then + region.background.SetBaseTexture = SetTextureViaAtlas + region.background.SetFrame = SetFrameViaAtlas + else + region.background.SetBaseTexture = SetTextureViaFrames + region.background.SetFrame = SetFrameViaFrames + end + region.background:SetBaseTexture(backgroundTexture) + region.background:SetFrame(backgroundTexture, region.backgroundFrame or 1) + region.background:SetDesaturated(data.desaturateBackground) + region.background:SetVertexColor(data.backgroundColor[1], data.backgroundColor[2], data.backgroundColor[3], data.backgroundColor[4]) + region.background:SetBlendMode(data.blendMode) - region.background:SetBaseTexture(backgroundTexture); - region.background:SetFrame(backgroundTexture, region.backgroundFrame or 1); - region.background:SetDesaturated(data.desaturateBackground) - region.background:SetVertexColor(data.backgroundColor[1], data.backgroundColor[2], data.backgroundColor[3], data.backgroundColor[4]); - region.background:SetBlendMode(data.blendMode); + if data.hideBackground then + region.background:Hide() + else + region.background:Show() + end - if (data.hideBackground) then - region.background:Hide(); + region.foreground:SetBaseTexture(data.foregroundTexture) + region.foreground:SetFrame(data.foregroundTexture, 1) + region.foreground:SetDesaturated(data.desaturateForeground) + region.foreground:SetBlendMode(data.blendMode) + + region:SetWidth(data.width) + region:SetHeight(data.height) + region.width = data.width + region.height = data.height + region.scalex = 1 + region.scaley = 1 + + function region:Scale(scalex, scaley) + region.scalex = scalex + region.scaley = scaley + if scalex < 0 then + region.mirror_h = true + scalex = scalex * -1 else - region.background:Show(); + region.mirror_h = nil end - - region.foreground:SetBaseTexture(data.foregroundTexture); - region.foreground:SetFrame(data.foregroundTexture, 1); - region.foreground:SetDesaturated(data.desaturateForeground); - region.foreground:SetBlendMode(data.blendMode); - - region:SetWidth(data.width); - region:SetHeight(data.height); - region.width = data.width; - region.height = data.height; - region.scalex = 1; - region.scaley = 1; - - function region:Scale(scalex, scaley) - region.scalex = scalex; - region.scaley = scaley; - if(scalex < 0) then - region.mirror_h = true; - scalex = scalex * -1; - else - region.mirror_h = nil; - end - region:SetWidth(region.width * scalex); - if(scaley < 0) then - scaley = scaley * -1; - region.mirror_v = true; - else - region.mirror_v = nil; - end - region:SetHeight(region.height * scaley); + region:SetWidth(region.width * scalex) + if scaley < 0 then + scaley = scaley * -1 + region.mirror_v = true + else + region.mirror_v = nil end + region:SetHeight(region.height * scaley) + end - function region:Color(r, g, b, a) - region.color_r = r; - region.color_g = g; - region.color_b = b; - region.color_a = a; - if (r or g or b) then - a = a or 1; - end - region.foreground:SetVertexColor(region.color_anim_r or r, region.color_anim_g or g, region.color_anim_b or b, region.color_anim_a or a); + function region:Color(r, g, b, a) + region.color_r = r + region.color_g = g + region.color_b = b + region.color_a = a + if r or g or b then + a = a or 1 end + region.foreground:SetVertexColor(region.color_anim_r or r, region.color_anim_g or g, region.color_anim_b or b, region.color_anim_a or a) + end - function region:ColorAnim(r, g, b, a) - region.color_anim_r = r; - region.color_anim_g = g; - region.color_anim_b = b; - region.color_anim_a = a; - if (r or g or b) then - a = a or 1; - end - region.foreground:SetVertexColor(r or region.color_r, g or region.color_g, b or region.color_b, a or region.color_a); + function region:ColorAnim(r, g, b, a) + region.color_anim_r = r + region.color_anim_g = g + region.color_anim_b = b + region.color_anim_a = a + if r or g or b then + a = a or 1 end + region.foreground:SetVertexColor(r or region.color_r, g or region.color_g, b or region.color_b, a or region.color_a) + end - function region:GetColor() - return region.color_r or data.color[1], region.color_g or data.color[2], - region.color_b or data.color[3], region.color_a or data.color[4]; - end + function region:GetColor() + return region.color_r or data.color[1], region.color_g or data.color[2], region.color_b or data.color[3], region.color_a or data.color[4] + end - region:Color(data.foregroundColor[1], data.foregroundColor[2], data.foregroundColor[3], data.foregroundColor[4]); + region:Color(data.foregroundColor[1], data.foregroundColor[2], data.foregroundColor[3], data.foregroundColor[4]) - function region:PreShow() - region.startTime = GetTime(); + function region:PreShow() + region.startTime = GetTime() + end + + local function onUpdate() + if not region.startTime then + return end - local function onUpdate() - if (not region.startTime) then return end - - Private.StartProfileAura(region.id); - Private.StartProfileSystem("stopmotion") - local timeSinceStart = (GetTime() - region.startTime); - local newCurrentFrame = floor(timeSinceStart * (data.frameRate or 15)); - if (newCurrentFrame == region.currentFrame) then - Private.StopProfileAura(region.id); - Private.StopProfileSystem("stopmotion") - return; - end + Private.StartProfileAura(region.id) + Private.StartProfileSystem("stopmotion") + local timeSinceStart = (GetTime() - region.startTime) + local newCurrentFrame = floor(timeSinceStart * (data.frameRate or 15)) + if newCurrentFrame == region.currentFrame then + Private.StopProfileAura(region.id) + Private.StopProfileSystem("stopmotion") + return + end - region.currentFrame = newCurrentFrame; + region.currentFrame = newCurrentFrame - local frames; - local startFrame = region.startFrame; - local endFrame = region.endFrame; - local inverse = data.inverse; - if (endFrame >= startFrame) then - frames = endFrame - startFrame + 1; + local frames + local startFrame = region.startFrame + local endFrame = region.endFrame + local inverse = data.inverse + if endFrame >= startFrame then + frames = endFrame - startFrame + 1 + else + frames = startFrame - endFrame + 1 + startFrame, endFrame = endFrame, startFrame + inverse = not inverse + end + + local frame = 0 + if data.animationType == "loop" then + frame = (newCurrentFrame % frames) + startFrame + elseif data.animationType == "bounce" then + local direction = floor(newCurrentFrame / frames) % 2 + if direction == 0 then + frame = (newCurrentFrame % frames) + startFrame else - frames = startFrame - endFrame + 1; - startFrame, endFrame = endFrame, startFrame; - inverse = not inverse; + frame = endFrame - (newCurrentFrame % frames) end - - local frame = 0; - if (data.animationType == "loop") then - frame = (newCurrentFrame % frames) + startFrame; - elseif (data.animationType == "bounce") then - local direction = floor(newCurrentFrame / frames) % 2; - if (direction == 0) then - frame = (newCurrentFrame % frames) + startFrame; - else - frame = endFrame - (newCurrentFrame % frames); - end - elseif (data.animationType == "once") then - frame = newCurrentFrame + startFrame - if (frame > endFrame) then - frame = endFrame; - end - elseif (data.animationType == "progress") then - if (not region.state) then - -- Do nothing - elseif (region.state.progressType == "static") then - local value = region.state.value or 0 - local total = region.state.total ~= 0 and region.state.total or 1 - frame = floor((frames - 1) * value / total) + startFrame; + elseif data.animationType == "once" then + frame = newCurrentFrame + startFrame + if frame > endFrame then + frame = endFrame + end + elseif data.animationType == "progress" then + if not region.state then + -- Do nothing + elseif region.state.progressType == "static" then + local value = region.state.value or 0 + local total = region.state.total ~= 0 and region.state.total or 1 + frame = floor((frames - 1) * value / total) + startFrame + else + local remaining + if region.state.paused then + remaining = region.state.remaining or 0 else - local remaining - if region.state.paused then - remaining = region.state.remaining or 0; - else - remaining = region.state.expirationTime and (region.state.expirationTime - GetTime()) or 0; - end - local progress = region.state.duration and region.state.duration > 0 and (1 - (remaining / region.state.duration)) or 0; - frame = floor( (frames - 1) * progress) + startFrame; + remaining = region.state.expirationTime and (region.state.expirationTime - GetTime()) or 0 end + local progress = region.state.duration and region.state.duration > 0 and (1 - (remaining / region.state.duration)) or 0 + frame = floor((frames - 1) * progress) + startFrame end + end - if (inverse) then - frame = endFrame - frame + startFrame; - end + if inverse then + frame = endFrame - frame + startFrame + end - if (frame > endFrame) then - frame = endFrame - end - if (frame < startFrame) then - frame = startFrame - end - region.foreground:SetFrame(data.foregroundTexture, frame); + if frame > endFrame then + frame = endFrame + end + if frame < startFrame then + frame = startFrame + end + region.foreground:SetFrame(data.foregroundTexture, frame) - Private.StopProfileAura(region.id); - Private.StopProfileSystem("stopmotion") - end; + Private.StopProfileAura(region.id) + Private.StopProfileSystem("stopmotion") + end - region.FrameTick = onUpdate; + region.FrameTick = onUpdate - function region:Update() - if region.state.paused then - if not region.paused then - region:Pause() - end - else - if region.paused then - region:Resume() - end + function region:Update() + if region.state.paused then + if not region.paused then + region:Pause() + end + else + if region.paused then + region:Resume() end - onUpdate(); end + onUpdate() + end - function region:SetForegroundDesaturated(b) - region.foreground:SetDesaturated(b); - end + function region:SetForegroundDesaturated(b) + region.foreground:SetDesaturated(b) + end - function region:SetBackgroundDesaturated(b) - region.background:SetDesaturated(b); - end + function region:SetBackgroundDesaturated(b) + region.background:SetDesaturated(b) + end - function region:SetBackgroundColor(r, g, b, a) - region.background:SetVertexColor(r, g, b, a); - end + function region:SetBackgroundColor(r, g, b, a) + region.background:SetVertexColor(r, g, b, a) + end - function region:SetRegionWidth(width) - region.width = width; - region:Scale(region.scalex, region.scaley); - end + function region:SetRegionWidth(width) + region.width = width + region:Scale(region.scalex, region.scaley) + end - function region:SetRegionHeight(height) - region.height = height; - region:Scale(region.scalex, region.scaley); - end + function region:SetRegionHeight(height) + region.height = height + region:Scale(region.scalex, region.scaley) + end end local function validate(data) Private.EnforceSubregionExists(data, "subbackground") end -WeakAuras.RegisterRegionType("stopmotion", create, modify, default, properties, validate); +WeakAuras.RegisterRegionType("stopmotion", create, modify, default, properties, validate) diff --git a/WeakAuras/RegionTypes/Text.lua b/WeakAuras/RegionTypes/Text.lua index d568edbaff..ba21518e9a 100644 --- a/WeakAuras/RegionTypes/Text.lua +++ b/WeakAuras/RegionTypes/Text.lua @@ -1,8 +1,10 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, Private = ... -local SharedMedia = LibStub("LibSharedMedia-3.0"); -local L = WeakAuras.L; +local SharedMedia = LibStub("LibSharedMedia-3.0") +local L = WeakAuras.L local defaultFont = WeakAuras.defaultFont local defaultFontSize = WeakAuras.defaultFontSize @@ -10,7 +12,7 @@ local defaultFontSize = WeakAuras.defaultFontSize local default = { displayText = "%p", outline = "OUTLINE", - color = {1, 1, 1, 1}, + color = { 1, 1, 1, 1 }, justify = "LEFT", selfPoint = "BOTTOM", anchorPoint = "CENTER", @@ -25,10 +27,10 @@ local default = { fixedWidth = 200, wordWrap = "WordWrap", - shadowColor = { 0, 0, 0, 1}, + shadowColor = { 0, 0, 0, 1 }, shadowXOffset = 1, - shadowYOffset = -1 -}; + shadowYOffset = -1, +} local properties = { color = { @@ -43,123 +45,123 @@ local properties = { min = 6, softMax = 72, step = 1, - default = 12 - } + default = 12, + }, } -WeakAuras.regionPrototype.AddProperties(properties, default); +WeakAuras.regionPrototype.AddProperties(properties, default) local function GetProperties(data) - return properties; + return properties end local function create(parent) - local region = CreateFrame("Frame", nil, parent); + local region = CreateFrame("Frame", nil, parent) region.regionType = "text" - region:SetMovable(true); + region:SetMovable(true) - local text = region:CreateFontString(nil, "OVERLAY"); - region.text = text; - text:SetWordWrap(true); - text:SetNonSpaceWrap(true); + local text = region:CreateFontString(nil, "OVERLAY") + region.text = text + text:SetWordWrap(true) + text:SetNonSpaceWrap(true) - region.duration = 0; - region.expirationTime = math.huge; + region.duration = 0 + region.expirationTime = math.huge - WeakAuras.regionPrototype.create(region); + WeakAuras.regionPrototype.create(region) - return region; + return region end local function modify(parent, region, data) - WeakAuras.regionPrototype.modify(parent, region, data); - local text = region.text; + WeakAuras.regionPrototype.modify(parent, region, data) + local text = region.text - local fontPath = SharedMedia:Fetch("font", data.font); - text:SetFont(fontPath, data.fontSize, data.outline); + local fontPath = SharedMedia:Fetch("font", data.font) + text:SetFont(fontPath, data.fontSize, data.outline) if not text:GetFont() then -- Font invalid, set the font but keep the setting - text:SetFont(STANDARD_TEXT_FONT, data.fontSize, data.outline); + text:SetFont(STANDARD_TEXT_FONT, data.fontSize, data.outline) end - text:SetJustifyH(data.justify); + text:SetJustifyH(data.justify) - text:ClearAllPoints(); - text:SetPoint("CENTER", UIParent, "CENTER"); + text:ClearAllPoints() + text:SetPoint("CENTER", UIParent, "CENTER") - region.width = text:GetWidth(); - region.height = text:GetStringHeight(); - region:SetWidth(region.width); - region:SetHeight(region.height); + region.width = text:GetWidth() + region.height = text:GetStringHeight() + region:SetWidth(region.width) + region:SetHeight(region.height) - local tooltipType = Private.CanHaveTooltip(data); - if(tooltipType and data.useTooltip) then + local tooltipType = Private.CanHaveTooltip(data) + if tooltipType and data.useTooltip then if not region.tooltipFrame then - region.tooltipFrame = CreateFrame("Frame", nil, region); - region.tooltipFrame:SetAllPoints(region); + region.tooltipFrame = CreateFrame("Frame", nil, region) + region.tooltipFrame:SetAllPoints(region) region.tooltipFrame:SetScript("OnEnter", function() - Private.ShowMouseoverTooltip(region, region); - end); - region.tooltipFrame:SetScript("OnLeave", Private.HideTooltip); + Private.ShowMouseoverTooltip(region, region) + end) + region.tooltipFrame:SetScript("OnLeave", Private.HideTooltip) end - region.tooltipFrame:EnableMouse(true); + region.tooltipFrame:EnableMouse(true) elseif region.tooltipFrame then - region.tooltipFrame:EnableMouse(false); + region.tooltipFrame:EnableMouse(false) end - text:SetTextHeight(data.fontSize); + text:SetTextHeight(data.fontSize) text:SetShadowColor(unpack(data.shadowColor)) text:SetShadowOffset(data.shadowXOffset, data.shadowYOffset) - text:ClearAllPoints(); - text:SetPoint(data.justify, region, data.justify); + text:ClearAllPoints() + text:SetPoint(data.justify, region, data.justify) - local SetText; + local SetText - if (data.automaticWidth == "Fixed") then - if (data.wordWrap == "WordWrap") then - text:SetWordWrap(true); - text:SetNonSpaceWrap(true); + if data.automaticWidth == "Fixed" then + if data.wordWrap == "WordWrap" then + text:SetWordWrap(true) + text:SetNonSpaceWrap(true) else - text:SetWordWrap(false); - text:SetNonSpaceWrap(false); + text:SetWordWrap(false) + text:SetNonSpaceWrap(false) end - text:SetWidth(data.fixedWidth); - region:SetWidth(data.fixedWidth); - region.width = data.fixedWidth; + text:SetWidth(data.fixedWidth) + region:SetWidth(data.fixedWidth) + region.width = data.fixedWidth SetText = function(textStr) if text:GetFont() then - text:SetText(WeakAuras.ReplaceRaidMarkerSymbols(textStr)); + text:SetText(WeakAuras.ReplaceRaidMarkerSymbols(textStr)) end - local height = text:GetStringHeight(); + local height = text:GetStringHeight() - if(region.height ~= height) then + if region.height ~= height then region.height = height region:SetHeight(height) - if(data.parent and WeakAuras.regions[data.parent].region.PositionChildren) then - WeakAuras.regions[data.parent].region:PositionChildren(); + if data.parent and WeakAuras.regions[data.parent].region.PositionChildren then + WeakAuras.regions[data.parent].region:PositionChildren() end end end else - text:SetWidth(0); - text:SetWordWrap(true); - text:SetNonSpaceWrap(true); + text:SetWidth(0) + text:SetWordWrap(true) + text:SetNonSpaceWrap(true) SetText = function(textStr) - if(textStr ~= text.displayText) then + if textStr ~= text.displayText then if text:GetFont() then - text:SetText(WeakAuras.ReplaceRaidMarkerSymbols(textStr)); + text:SetText(WeakAuras.ReplaceRaidMarkerSymbols(textStr)) end end - local width = text:GetWidth(); - local height = text:GetStringHeight(); - if(width ~= region.width or height ~= region.height ) then - region.width = width; - region.height = height; - region:SetWidth(region.width); - region:SetHeight(region.height); - if(data.parent and WeakAuras.regions[data.parent].region.PositionChildren) then - WeakAuras.regions[data.parent].region:PositionChildren(); + local width = text:GetWidth() + local height = text:GetStringHeight() + if width ~= region.width or height ~= region.height then + region.width = width + region.height = height + region:SetWidth(region.width) + region:SetHeight(region.height) + if data.parent and WeakAuras.regions[data.parent].region.PositionChildren then + WeakAuras.regions[data.parent].region:PositionChildren() end end end @@ -169,17 +171,17 @@ local function modify(parent, region, data) if Private.ContainsAnyPlaceHolders(data.displayText) then local getter = function(key, default) local fullKey = "displayText_format_" .. key - if (data[fullKey] == nil) then + if data[fullKey] == nil then data[fullKey] = default end return data[fullKey] end local formatters = Private.CreateFormatters(data.displayText, getter) UpdateText = function() - local textStr = data.displayText; - textStr = Private.ReplacePlaceHolders(textStr, region, nil, false, formatters); - if (textStr == nil or textStr == "") then - textStr = " "; + local textStr = data.displayText + textStr = Private.ReplacePlaceHolders(textStr, region, nil, false, formatters) + if textStr == nil or textStr == "" then + textStr = " " end SetText(textStr) @@ -187,8 +189,8 @@ local function modify(parent, region, data) end local customTextFunc = nil - if(Private.ContainsCustomPlaceHolder(data.displayText) and data.customText) then - customTextFunc = WeakAuras.LoadFunction("return "..data.customText) + if Private.ContainsCustomPlaceHolder(data.displayText) and data.customText then + customTextFunc = WeakAuras.LoadFunction("return " .. data.customText) end local Update @@ -222,74 +224,73 @@ local function modify(parent, region, data) if not UpdateText then local textStr = data.displayText - textStr = textStr:gsub("\\n", "\n"); + textStr = textStr:gsub("\\n", "\n") SetText(textStr) end function region:Color(r, g, b, a) - region.color_r = r; - region.color_g = g; - region.color_b = b; - region.color_a = a; - if (r or g or b) then - a = a or 1; + region.color_r = r + region.color_g = g + region.color_b = b + region.color_a = a + if r or g or b then + a = a or 1 end - text:SetTextColor(region.color_anim_r or r, region.color_anim_g or g, region.color_anim_b or b, region.color_anim_a or a); + text:SetTextColor(region.color_anim_r or r, region.color_anim_g or g, region.color_anim_b or b, region.color_anim_a or a) end function region:ColorAnim(r, g, b, a) - region.color_anim_r = r; - region.color_anim_g = g; - region.color_anim_b = b; - region.color_anim_a = a; - if (r or g or b) then - a = a or 1; + region.color_anim_r = r + region.color_anim_g = g + region.color_anim_b = b + region.color_anim_a = a + if r or g or b then + a = a or 1 end - text:SetTextColor(r or region.color_r, g or region.color_g, b or region.color_b, a or region.color_a); + text:SetTextColor(r or region.color_r, g or region.color_g, b or region.color_b, a or region.color_a) end function region:GetColor() - return region.color_r or data.color[1], region.color_g or data.color[2], - region.color_b or data.color[3], region.color_a or data.color[4]; + return region.color_r or data.color[1], region.color_g or data.color[2], region.color_b or data.color[3], region.color_a or data.color[4] end - region:Color(data.color[1], data.color[2], data.color[3], data.color[4]); + region:Color(data.color[1], data.color[2], data.color[3], data.color[4]) function region:SetTextHeight(size) - local fontPath = SharedMedia:Fetch("font", data.font); - region.text:SetFont(fontPath, size, data.outline); + local fontPath = SharedMedia:Fetch("font", data.font) + region.text:SetFont(fontPath, size, data.outline) region.text:SetTextHeight(size) end - WeakAuras.regionPrototype.modifyFinish(parent, region, data); + WeakAuras.regionPrototype.modifyFinish(parent, region, data) end local function validate(data) Private.EnforceSubregionExists(data, "subbackground") end -WeakAuras.RegisterRegionType("text", create, modify, default, GetProperties, validate); +WeakAuras.RegisterRegionType("text", create, modify, default, GetProperties, validate) -- Fallback region type local function fallbackmodify(parent, region, data) - WeakAuras.regionPrototype.modify(parent, region, data); - local text = region.text; + WeakAuras.regionPrototype.modify(parent, region, data) + local text = region.text - text:SetFont(STANDARD_TEXT_FONT, data.fontSize, data.outline and "OUTLINE" or nil); + text:SetFont(STANDARD_TEXT_FONT, data.fontSize, data.outline and "OUTLINE" or nil) if text:GetFont() then - text:SetText(WeakAuras.L["Region type %s not supported"]:format(data.regionType)); + text:SetText(WeakAuras.L["Region type %s not supported"]:format(data.regionType)) end - text:ClearAllPoints(); - text:SetPoint("CENTER", region, "CENTER"); + text:ClearAllPoints() + text:SetPoint("CENTER", region, "CENTER") - region:SetWidth(text:GetWidth()); - region:SetHeight(text:GetStringHeight()); + region:SetWidth(text:GetWidth()) + region:SetHeight(text:GetStringHeight()) region.Update = function() end - WeakAuras.regionPrototype.modifyFinish(parent, region, data); + WeakAuras.regionPrototype.modifyFinish(parent, region, data) end -WeakAuras.RegisterRegionType("fallback", create, fallbackmodify, default); +WeakAuras.RegisterRegionType("fallback", create, fallbackmodify, default) diff --git a/WeakAuras/RegionTypes/Texture.lua b/WeakAuras/RegionTypes/Texture.lua index fa57b834bd..f615212f52 100644 --- a/WeakAuras/RegionTypes/Texture.lua +++ b/WeakAuras/RegionTypes/Texture.lua @@ -1,14 +1,16 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, Private = ... -local L = WeakAuras.L; +local L = WeakAuras.L local default = { texture = "Interface\\Addons\\WeakAuras\\PowerAurasMedia\\Auras\\Aura3", desaturate = false, width = 200, height = 200, - color = {1, 1, 1, 1}, + color = { 1, 1, 1, 1 }, blendMode = "BLEND", textureWrapMode = "CLAMPTOBLACKADDITIVE", rotation = 0, @@ -20,12 +22,12 @@ local default = { anchorFrameType = "SCREEN", xOffset = 0, yOffset = 0, - frameStrata = 1 -}; + frameStrata = 1, +} -WeakAuras.regionPrototype.AddAlphaToDefault(default); +WeakAuras.regionPrototype.AddAlphaToDefault(default) -local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ceil(GetScreenHeight() / 20) * 20; +local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ceil(GetScreenHeight() / 20) * 20 local properties = { color = { @@ -36,7 +38,7 @@ local properties = { desaturate = { display = L["Desaturate"], setter = "SetDesaturated", - type = "bool" + type = "bool", }, width = { display = L["Width"], @@ -45,7 +47,7 @@ local properties = { min = 1, softMax = screenWidth, bigStep = 1, - default = 32 + default = 32, }, height = { display = L["Height"], @@ -54,124 +56,124 @@ local properties = { min = 1, softMax = screenHeight, bigStep = 1, - default = 32 + default = 32, }, mirror = { display = L["Mirror"], setter = "SetMirror", - type = "bool" - } + type = "bool", + }, } -WeakAuras.regionPrototype.AddProperties(properties, default); +WeakAuras.regionPrototype.AddProperties(properties, default) local function create(parent) - local region = CreateFrame("Frame", nil, UIParent); + local region = CreateFrame("Frame", nil, UIParent) region.regionType = "texture" - region:SetMovable(true); - region:SetResizable(true); - region:SetMinResize(1, 1); + region:SetMovable(true) + region:SetResizable(true) + region:SetMinResize(1, 1) - local texture = region:CreateTexture(); + local texture = region:CreateTexture() texture:SetSnapToPixelGrid(false) texture:SetTexelSnappingBias(0) - region.texture = texture; - texture:SetAllPoints(region); + region.texture = texture + texture:SetAllPoints(region) - WeakAuras.regionPrototype.create(region); + WeakAuras.regionPrototype.create(region) - return region; + return region end local function modify(parent, region, data) - WeakAuras.regionPrototype.modify(parent, region, data); - WeakAuras.SetTextureOrAtlas(region.texture, data.texture, data.textureWrapMode, data.textureWrapMode); + WeakAuras.regionPrototype.modify(parent, region, data) + WeakAuras.SetTextureOrAtlas(region.texture, data.texture, data.textureWrapMode, data.textureWrapMode) region.texture:SetDesaturated(data.desaturate) - region:SetWidth(data.width); - region:SetHeight(data.height); - region.width = data.width; - region.height = data.height; - region.scalex = 1; - region.scaley = 1; - region.texture:SetBlendMode(data.blendMode); + region:SetWidth(data.width) + region:SetHeight(data.height) + region.width = data.width + region.height = data.height + region.scalex = 1 + region.scaley = 1 + region.texture:SetBlendMode(data.blendMode) --region.texture:SetRotation((data.rotation / 180) * math.pi); local function GetRotatedPoints(degrees) - local angle = rad(135 - degrees); - local vx = math.cos(angle); - local vy = math.sin(angle); + local angle = rad(135 - degrees) + local vx = math.cos(angle) + local vy = math.sin(angle) - return 0.5+vx,0.5-vy , 0.5-vy,0.5-vx , 0.5+vy,0.5+vx , 0.5-vx,0.5+vy + return 0.5 + vx, 0.5 - vy, 0.5 - vy, 0.5 - vx, 0.5 + vy, 0.5 + vx, 0.5 - vx, 0.5 + vy end region.mirror = data.mirror local function DoTexCoord() - local mirror_h, mirror_v = region.mirror_h, region.mirror_v; - if(region.mirror) then - mirror_h = not mirror_h; + local mirror_h, mirror_v = region.mirror_h, region.mirror_v + if region.mirror then + mirror_h = not mirror_h end - local ulx,uly , llx,lly , urx,ury , lrx,lry; - if(data.rotate) then - ulx,uly , llx,lly , urx,ury , lrx,lry = GetRotatedPoints(region.rotation); + local ulx, uly, llx, lly, urx, ury, lrx, lry + if data.rotate then + ulx, uly, llx, lly, urx, ury, lrx, lry = GetRotatedPoints(region.rotation) else - if(data.discrete_rotation == 0 or data.discrete_rotation == 360) then - ulx,uly , llx,lly , urx,ury , lrx,lry = 0,0 , 0,1 , 1,0 , 1,1; - elseif(data.discrete_rotation == 90) then - ulx,uly , llx,lly , urx,ury , lrx,lry = 1,0 , 0,0 , 1,1 , 0,1; - elseif(data.discrete_rotation == 180) then - ulx,uly , llx,lly , urx,ury , lrx,lry = 1,1 , 1,0 , 0,1 , 0,0; - elseif(data.discrete_rotation == 270) then - ulx,uly , llx,lly , urx,ury , lrx,lry = 0,1 , 1,1 , 0,0 , 1,0; + if data.discrete_rotation == 0 or data.discrete_rotation == 360 then + ulx, uly, llx, lly, urx, ury, lrx, lry = 0, 0, 0, 1, 1, 0, 1, 1 + elseif data.discrete_rotation == 90 then + ulx, uly, llx, lly, urx, ury, lrx, lry = 1, 0, 0, 0, 1, 1, 0, 1 + elseif data.discrete_rotation == 180 then + ulx, uly, llx, lly, urx, ury, lrx, lry = 1, 1, 1, 0, 0, 1, 0, 0 + elseif data.discrete_rotation == 270 then + ulx, uly, llx, lly, urx, ury, lrx, lry = 0, 1, 1, 1, 0, 0, 1, 0 end end - if(mirror_h) then - if(mirror_v) then - region.texture:SetTexCoord(lrx,lry , urx,ury , llx,lly , ulx,uly); + if mirror_h then + if mirror_v then + region.texture:SetTexCoord(lrx, lry, urx, ury, llx, lly, ulx, uly) else - region.texture:SetTexCoord(urx,ury , lrx,lry , ulx,uly , llx,lly); + region.texture:SetTexCoord(urx, ury, lrx, lry, ulx, uly, llx, lly) end else - if(mirror_v) then - region.texture:SetTexCoord(llx,lly , ulx,uly , lrx,lry , urx,ury); + if mirror_v then + region.texture:SetTexCoord(llx, lly, ulx, uly, lrx, lry, urx, ury) else - region.texture:SetTexCoord(ulx,uly , llx,lly , urx,ury , lrx,lry); + region.texture:SetTexCoord(ulx, uly, llx, lly, urx, ury, lrx, lry) end end end - region.rotation = data.rotation; - DoTexCoord(); + region.rotation = data.rotation + DoTexCoord() function region:Scale(scalex, scaley) - region.scalex = scalex; - region.scaley = scaley; - if(scalex < 0) then - region.mirror_h = true; - scalex = scalex * -1; + region.scalex = scalex + region.scaley = scaley + if scalex < 0 then + region.mirror_h = true + scalex = scalex * -1 else - region.mirror_h = nil; + region.mirror_h = nil end - region:SetWidth(region.width * scalex); - if(scaley < 0) then - scaley = scaley * -1; - region.mirror_v = true; + region:SetWidth(region.width * scalex) + if scaley < 0 then + scaley = scaley * -1 + region.mirror_v = true else - region.mirror_v = nil; + region.mirror_v = nil end - region:SetHeight(region.height * scaley); + region:SetHeight(region.height * scaley) - DoTexCoord(); + DoTexCoord() end function region:SetRegionWidth(width) - region.width = width; - region:Scale(region.scalex, region.scaley); + region.width = width + region:Scale(region.scalex, region.scaley) end function region:SetRegionHeight(height) - region.height = height; - region:Scale(region.scalex, region.scaley); + region.height = height + region:Scale(region.scalex, region.scaley) end function region:SetMirror(mirror) @@ -181,62 +183,61 @@ local function modify(parent, region, data) function region:Update() if region.state.texture then - WeakAuras.SetTextureOrAtlas(region.texture, region.state.texture, data.textureWrapMode, data.textureWrapMode); + WeakAuras.SetTextureOrAtlas(region.texture, region.state.texture, data.textureWrapMode, data.textureWrapMode) end end function region:Color(r, g, b, a) - region.color_r = r; - region.color_g = g; - region.color_b = b; - region.color_a = a; - if (r or g or b) then - a = a or 1; + region.color_r = r + region.color_g = g + region.color_b = b + region.color_a = a + if r or g or b then + a = a or 1 end - region.texture:SetVertexColor(region.color_anim_r or r, region.color_anim_g or g, region.color_anim_b or b, region.color_anim_a or a); + region.texture:SetVertexColor(region.color_anim_r or r, region.color_anim_g or g, region.color_anim_b or b, region.color_anim_a or a) end function region:ColorAnim(r, g, b, a) - region.color_anim_r = r; - region.color_anim_g = g; - region.color_anim_b = b; - region.color_anim_a = a; - if (r or g or b) then - a = a or 1; + region.color_anim_r = r + region.color_anim_g = g + region.color_anim_b = b + region.color_anim_a = a + if r or g or b then + a = a or 1 end - region.texture:SetVertexColor(r or region.color_r, g or region.color_g, b or region.color_b, a or region.color_a); + region.texture:SetVertexColor(r or region.color_r, g or region.color_g, b or region.color_b, a or region.color_a) end function region:GetColor() - return region.color_r or data.color[1], region.color_g or data.color[2], - region.color_b or data.color[3], region.color_a or data.color[4]; + return region.color_r or data.color[1], region.color_g or data.color[2], region.color_b or data.color[3], region.color_a or data.color[4] end - region:Color(data.color[1], data.color[2], data.color[3], data.color[4]); + region:Color(data.color[1], data.color[2], data.color[3], data.color[4]) function region:SetDesaturated(b) - region.texture:SetDesaturated(b); + region.texture:SetDesaturated(b) end - if(data.rotate) then + if data.rotate then function region:Rotate(degrees) - region.rotation = degrees; - DoTexCoord(); + region.rotation = degrees + DoTexCoord() end function region:GetRotation() - return region.rotation; + return region.rotation end else - region.Rotate = nil; - region.GetRotation = nil; + region.Rotate = nil + region.GetRotation = nil end - WeakAuras.regionPrototype.modifyFinish(parent, region, data); + WeakAuras.regionPrototype.modifyFinish(parent, region, data) end local function validate(data) Private.EnforceSubregionExists(data, "subbackground") end -WeakAuras.RegisterRegionType("texture", create, modify, default, properties, validate); +WeakAuras.RegisterRegionType("texture", create, modify, default, properties, validate) diff --git a/WeakAuras/SubRegionTypes/Background.lua b/WeakAuras/SubRegionTypes/Background.lua index 229427f16b..53299ffb10 100644 --- a/WeakAuras/SubRegionTypes/Background.lua +++ b/WeakAuras/SubRegionTypes/Background.lua @@ -1,56 +1,56 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, Private = ... -local L = WeakAuras.L; +local L = WeakAuras.L do - local function subSupports(regionType) - return regionType ~= "group" and regionType ~= "dynamicgroup" - end + local function subSupports(regionType) + return regionType ~= "group" and regionType ~= "dynamicgroup" + end - local function noop() - end + local function noop() end - local function subSetFrameLevel(self, level) - self.parent:SetFrameLevel(level) - end + local function subSetFrameLevel(self, level) + self.parent:SetFrameLevel(level) + end - local function subCreate() - return { Update = noop, SetFrameLevel = subSetFrameLevel} - end + local function subCreate() + return { Update = noop, SetFrameLevel = subSetFrameLevel } + end - local function subModify(parent, region) - region.parent = parent - end + local function subModify(parent, region) + region.parent = parent + end - WeakAuras.RegisterSubRegionType("subbackground", L["Background"], subSupports, subCreate, subModify, noop, noop, {}, nil, {}, false); + WeakAuras.RegisterSubRegionType("subbackground", L["Background"], subSupports, subCreate, subModify, noop, noop, {}, nil, {}, false) end -- Foreground for aurabar do - local function subSupports(regionType) - return regionType == "aurabar" - end + local function subSupports(regionType) + return regionType == "aurabar" + end - local function noop() - end + local function noop() end - local function subSetFrameLevel(self, level) - if self.parent.bar then - self.parent.bar:SetFrameLevel(level) - end - if self.parent.iconFrame then - self.parent.iconFrame:SetFrameLevel(level) - end + local function subSetFrameLevel(self, level) + if self.parent.bar then + self.parent.bar:SetFrameLevel(level) end - - local function subCreate() - return { Update = noop, SetFrameLevel = subSetFrameLevel} + if self.parent.iconFrame then + self.parent.iconFrame:SetFrameLevel(level) end + end - local function subModify(parent, region) - region.parent = parent - end + local function subCreate() + return { Update = noop, SetFrameLevel = subSetFrameLevel } + end + + local function subModify(parent, region) + region.parent = parent + end - WeakAuras.RegisterSubRegionType("subforeground", L["Foreground"], subSupports, subCreate, subModify, noop, noop, {}, nil, {}, false); + WeakAuras.RegisterSubRegionType("subforeground", L["Foreground"], subSupports, subCreate, subModify, noop, noop, {}, nil, {}, false) end diff --git a/WeakAuras/SubRegionTypes/Border.lua b/WeakAuras/SubRegionTypes/Border.lua index 24c8128e53..62c5b6bc7a 100644 --- a/WeakAuras/SubRegionTypes/Border.lua +++ b/WeakAuras/SubRegionTypes/Border.lua @@ -1,13 +1,15 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, Private = ... -local SharedMedia = LibStub("LibSharedMedia-3.0"); -local L = WeakAuras.L; +local SharedMedia = LibStub("LibSharedMedia-3.0") +local L = WeakAuras.L local default = function(parentType) local options = { border_visible = true, - border_color = {1, 1, 1, 1}, + border_color = { 1, 1, 1, 1 }, border_edge = "Square Full White", border_offset = 0, border_size = 2, @@ -23,16 +25,15 @@ local properties = { display = L["Visibility"], setter = "SetVisible", type = "bool", - defaultProperty = true + defaultProperty = true, }, border_color = { display = L["Color"], setter = "SetBorderColor", - type = "color" + type = "color", }, } - local function create() local region = CreateFrame("Frame", nil, UIParent, "BackdropTemplate") return region @@ -66,7 +67,7 @@ local function modify(parent, region, parentData, data, first) self:SetBackdropBorderColor(r, g, b, a or 1) end - region:SetBorderColor(data.border_color[1], data.border_color[2], data.border_color[3], data.border_color[4]); + region:SetBorderColor(data.border_color[1], data.border_color[2], data.border_color[3], data.border_color[4]) function region:SetVisible(visible) if visible then @@ -80,10 +81,7 @@ local function modify(parent, region, parentData, data, first) end local function supports(regionType) - return regionType == "texture" - or regionType == "progresstexture" - or regionType == "icon" - or regionType == "aurabar" + return regionType == "texture" or regionType == "progresstexture" or regionType == "icon" or regionType == "aurabar" end -WeakAuras.RegisterSubRegionType("subborder", L["Border"], supports, create, modify, onAcquire, onRelease, default, nil, properties); +WeakAuras.RegisterSubRegionType("subborder", L["Border"], supports, create, modify, onAcquire, onRelease, default, nil, properties) diff --git a/WeakAuras/SubRegionTypes/Glow.lua b/WeakAuras/SubRegionTypes/Glow.lua index 5a01c8009c..3e252f8746 100644 --- a/WeakAuras/SubRegionTypes/Glow.lua +++ b/WeakAuras/SubRegionTypes/Glow.lua @@ -1,20 +1,22 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, Private = ... local LCG = LibStub("LibCustomGlow-1.0") -local MSQ, MSQ_Version = LibStub("Masque", true); +local MSQ, MSQ_Version = LibStub("Masque", true) if MSQ then if MSQ_Version <= 80100 then MSQ = nil end end -local L = WeakAuras.L; +local L = WeakAuras.L local default = function(parentType) local options = { glow = false, useGlowColor = false, - glowColor = {1, 1, 1, 1}, + glowColor = { 1, 1, 1, 1 }, glowType = "buttonOverlay", glowLines = 8, glowFrequency = 0.25, @@ -37,10 +39,10 @@ local properties = { display = L["Visibility"], setter = "SetVisible", type = "bool", - defaultProperty = true + defaultProperty = true, }, glowType = { - display =L["Type"], + display = L["Type"], setter = "SetGlowType", type = "list", values = Private.glow_types, @@ -48,12 +50,12 @@ local properties = { useGlowColor = { display = L["Use Custom Color"], setter = "SetUseGlowColor", - type = "bool" + type = "bool", }, glowColor = { display = L["Custom Color"], setter = "SetGlowColor", - type = "color" + type = "color", }, glowLines = { display = L["Lines & Particles"], @@ -62,7 +64,7 @@ local properties = { min = 1, softMax = 30, bigStep = 1, - default = 4 + default = 4, }, glowFrequency = { display = L["Frequency"], @@ -71,7 +73,7 @@ local properties = { softMin = -2, softMax = 2, bigStep = 0.1, - default = 0.25 + default = 0.25, }, glowLength = { display = L["Length"], @@ -80,7 +82,7 @@ local properties = { min = 1, softMax = 20, bigStep = 1, - default = 10 + default = 10, }, glowThickness = { display = L["Thickness"], @@ -89,7 +91,7 @@ local properties = { min = 1, softMax = 20, bigStep = 1, - default = 1 + default = 1, }, glowScale = { display = L["Scale"], @@ -99,12 +101,12 @@ local properties = { softMax = 10, bigStep = 0.05, default = 1, - isPercent = true + isPercent = true, }, glowBorder = { display = L["Border"], setter = "SetGlowBorder", - type = "bool" + type = "bool", }, glowXOffset = { display = L["X-Offset"], @@ -113,7 +115,7 @@ local properties = { softMin = -100, softMax = 100, bigStep = 1, - default = 0 + default = 0, }, glowYOffset = { display = L["Y-Offset"], @@ -122,12 +124,11 @@ local properties = { softMin = -100, softMax = 100, bigStep = 1, - default = 0 + default = 0, }, } local function glowStart(self, frame, color) - if frame:GetWidth() < 1 or frame:GetHeight() < 1 then self.glowStop(frame) return @@ -136,6 +137,7 @@ local function glowStart(self, frame, color) if self.glowType == "buttonOverlay" then self.glowStart(frame, color, self.glowFrequency, 0) elseif self.glowType == "Pixel" then + -- stylua: ignore self.glowStart( frame, color, @@ -150,6 +152,7 @@ local function glowStart(self, frame, color) 0 ) elseif self.glowType == "ACShine" then + -- stylua: ignore self.glowStart( frame, color, @@ -181,19 +184,19 @@ local funcs = { end if MSQ and self.parentType == "icon" then - if (visible) then + if visible then self.__MSQ_Shape = self:GetParent().button.__MSQ_Shape self:Show() - glowStart(self, self, color); + glowStart(self, self, color) else - self.glowStop(self); + self.glowStop(self) self:Hide() end - elseif (visible) then + elseif visible then self:Show() - glowStart(self, self, color); + glowStart(self, self, color) else - self.glowStop(self); + self.glowStop(self) self:Hide() end end, @@ -239,7 +242,7 @@ local funcs = { end end, SetGlowColor = function(self, r, g, b, a) - self.glowColor = {r, g, b, a} + self.glowColor = { r, g, b, a } if self.glow then self:SetVisible(true) end @@ -299,13 +302,13 @@ local funcs = { if self.glow then self:SetVisible(true) end - end + end, } local function create() local region = CreateFrame("Frame", nil, UIParent) - for name, func in pairs(funcs) do + for name, func in pairs(funcs) do region[name] = func end @@ -362,7 +365,7 @@ function WeakAuras.getDefaultGlow(regionType) ["type"] = "subglow", glow = false, useGlowColor = false, - glowColor = {1, 1, 1, 1}, + glowColor = { 1, 1, 1, 1 }, glowType = "Pixel", glowLines = 8, glowFrequency = 0.25, @@ -372,14 +375,14 @@ function WeakAuras.getDefaultGlow(regionType) glowBorder = false, glowXOffset = 0, glowYOffset = 0, - glow_anchor = "bar" + glow_anchor = "bar", } elseif regionType == "icon" then return { ["type"] = "subglow", glow = false, useGlowColor = false, - glowColor = {1, 1, 1, 1}, + glowColor = { 1, 1, 1, 1 }, glowType = "buttonOverlay", glowLines = 8, glowFrequency = 0.25, @@ -394,8 +397,7 @@ function WeakAuras.getDefaultGlow(regionType) end local function supports(regionType) - return regionType == "icon" - or regionType == "aurabar" + return regionType == "icon" or regionType == "aurabar" end local function addDefaultsForNewAura(data) @@ -404,7 +406,7 @@ local function addDefaultsForNewAura(data) ["type"] = "subglow", glow = false, useGlowColor = false, - glowColor = {1, 1, 1, 1}, + glowColor = { 1, 1, 1, 1 }, glowType = "buttonOverlay", glowLines = 8, glowFrequency = 0.25, @@ -418,4 +420,4 @@ local function addDefaultsForNewAura(data) end end -WeakAuras.RegisterSubRegionType("subglow", L["Glow"], supports, create, modify, onAcquire, onRelease, default, addDefaultsForNewAura, properties); +WeakAuras.RegisterSubRegionType("subglow", L["Glow"], supports, create, modify, onAcquire, onRelease, default, addDefaultsForNewAura, properties) diff --git a/WeakAuras/SubRegionTypes/Model.lua b/WeakAuras/SubRegionTypes/Model.lua index e7c8675697..d0dc52f3a6 100644 --- a/WeakAuras/SubRegionTypes/Model.lua +++ b/WeakAuras/SubRegionTypes/Model.lua @@ -1,7 +1,9 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, Private = ... -local L = WeakAuras.L; +local L = WeakAuras.L Private.barmodels = {} @@ -25,7 +27,7 @@ local default = function(parentType) model_fileId = "235338", model_path = "spells/arcanepower_state_chest.m2", - bar_model_clip = true + bar_model_clip = true, } end @@ -34,7 +36,7 @@ local properties = { display = L["Visibility"], setter = "SetVisible", type = "bool", - defaultProperty = true + defaultProperty = true, }, model_alpha = { display = L["Alpha"], @@ -42,8 +44,8 @@ local properties = { type = "number", min = 0, max = 1, - bigStep = 0.1 - } + bigStep = 0.1, + }, } local function PreShow(self) @@ -63,21 +65,27 @@ local function PreShow(self) end self:ClearTransform() - if (data.api) then + if data.api then self:MakeCurrentCameraCustom() - self:SetTransform(data.model_st_tx / 1000, data.model_st_ty / 1000, data.model_st_tz / 1000, - rad(data.model_st_rx), rad(data.model_st_ry), rad(data.model_st_rz), - data.model_st_us / 1000); + self:SetTransform( + data.model_st_tx / 1000, + data.model_st_ty / 1000, + data.model_st_tz / 1000, + rad(data.model_st_rx), + rad(data.model_st_ry), + rad(data.model_st_rz), + data.model_st_us / 1000 + ) else - self:SetPosition(data.model_z, data.model_x, data.model_y); - self:SetFacing(0); + self:SetPosition(data.model_z, data.model_x, data.model_y) + self:SetFacing(0) end self:SetModelAlpha(self.region.alpha) end local function CreateModel() - local model = CreateFrame("PlayerModel", nil, UIParent) - model.PreShow = PreShow; + local model = CreateFrame("PlayerModel", nil, UIParent) + model.PreShow = PreShow return model end @@ -85,7 +93,6 @@ end local poolOldApi = CreateObjectPool(CreateModel) local poolNewApi = CreateObjectPool(CreateModel) - local function AcquireModel(region, data) local pool = data.api and poolNewApi or poolOldApi local model = pool:Acquire() @@ -103,13 +110,13 @@ local function AcquireModel(region, data) end local extra_width, extra_height = 0, 0 - if not(data.bar_model_clip and region.parentType == "aurabar") then + if not (data.bar_model_clip and region.parentType == "aurabar") then extra_width = data.extra_width or 0 extra_height = data.extra_height or 0 end - model:SetPoint("TOPLEFT", anchor ,"TOPLEFT", -extra_width/2, extra_height/2) - model:SetPoint("BOTTOMRIGHT", anchor ,"BOTTOMRIGHT", extra_width/2, -extra_height/2) + model:SetPoint("TOPLEFT", anchor, "TOPLEFT", -extra_width / 2, extra_height / 2) + model:SetPoint("BOTTOMRIGHT", anchor, "BOTTOMRIGHT", extra_width / 2, -extra_height / 2) model:SetParent(region) model:SetKeepModelOnHide(true) @@ -127,14 +134,20 @@ local function AcquireModel(region, data) end model:ClearTransform() - if (data.api) then + if data.api then model:MakeCurrentCameraCustom() - model:SetTransform(data.model_st_tx / 1000, data.model_st_ty / 1000, data.model_st_tz / 1000, - rad(data.model_st_rx), rad(data.model_st_ry), rad(data.model_st_rz), - data.model_st_us / 1000); + model:SetTransform( + data.model_st_tx / 1000, + data.model_st_ty / 1000, + data.model_st_tz / 1000, + rad(data.model_st_rx), + rad(data.model_st_ry), + rad(data.model_st_rz), + data.model_st_us / 1000 + ) else - model:SetPosition(data.model_z, data.model_x, data.model_y); - model:SetFacing(0); + model:SetPosition(data.model_z, data.model_x, data.model_y) + model:SetFacing(0) end return model end @@ -192,7 +205,7 @@ local funcs = { self.toosmall = false end self:UpdateVisible() - end + end, } local function create() @@ -215,8 +228,6 @@ local function onRelease(subRegion) subRegion:Hide() end - - local function modify(parent, region, parentData, data, first) if region.model then ReleaseModel(region.model) @@ -241,13 +252,13 @@ local function modify(parent, region, parentData, data, first) end local extra_width, extra_height = 0, 0 - if not(data.bar_model_clip and parentData.regionType == "aurabar") then + if not (data.bar_model_clip and parentData.regionType == "aurabar") then extra_width = data.extra_width or 0 extra_height = data.extra_height or 0 end - region:SetPoint("TOPLEFT", anchor ,"TOPLEFT", -extra_width/2, extra_height/2) - region:SetPoint("BOTTOMRIGHT", anchor ,"BOTTOMRIGHT", extra_width/2, -extra_height/2) + region:SetPoint("TOPLEFT", anchor, "TOPLEFT", -extra_width / 2, extra_height / 2) + region:SetPoint("BOTTOMRIGHT", anchor, "BOTTOMRIGHT", extra_width / 2, -extra_height / 2) region:SetAlpha(data.model_alpha) region:SetVisible(data.model_visible) @@ -257,6 +268,7 @@ local function modify(parent, region, parentData, data, first) parent.subRegionEvents:AddSubscriber("PreHide", region) end +-- stylua: ignore local function supports(regionType) return regionType == "texture" or regionType == "progresstexture" @@ -265,4 +277,4 @@ local function supports(regionType) or regionType == "text" end -WeakAuras.RegisterSubRegionType("submodel", L["Model"], supports, create, modify, onAcquire, onRelease, default, nil, properties); +WeakAuras.RegisterSubRegionType("submodel", L["Model"], supports, create, modify, onAcquire, onRelease, default, nil, properties) diff --git a/WeakAuras/SubRegionTypes/SubText.lua b/WeakAuras/SubRegionTypes/SubText.lua index b6dc72fff8..30db715022 100644 --- a/WeakAuras/SubRegionTypes/SubText.lua +++ b/WeakAuras/SubRegionTypes/SubText.lua @@ -1,8 +1,10 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, Private = ... -local SharedMedia = LibStub("LibSharedMedia-3.0"); -local L = WeakAuras.L; +local SharedMedia = LibStub("LibSharedMedia-3.0") +local L = WeakAuras.L local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ceil(GetScreenHeight() / 20) * 20 @@ -14,7 +16,7 @@ local default = function(parentType) -- No Shadow, but Outline return { text_text = "%p", - text_color = {1, 1, 1, 1}, + text_color = { 1, 1, 1, 1 }, text_font = defaultFont, text_fontSize = defaultFontSize, text_fontType = "OUTLINE", @@ -26,7 +28,7 @@ local default = function(parentType) anchorXOffset = 0, anchorYOffset = 0, - text_shadowColor = { 0, 0, 0, 1}, + text_shadowColor = { 0, 0, 0, 1 }, text_shadowXOffset = 0, text_shadowYOffset = 0, rotateText = "NONE", @@ -39,7 +41,7 @@ local default = function(parentType) -- With Shadow, without Outline return { text_text = "%n", - text_color = {1, 1, 1, 1}, + text_color = { 1, 1, 1, 1 }, text_font = defaultFont, text_fontSize = defaultFontSize, text_fontType = "None", @@ -51,7 +53,7 @@ local default = function(parentType) anchorXOffset = 0, anchorYOffset = 0, - text_shadowColor = { 0, 0, 0, 1}, + text_shadowColor = { 0, 0, 0, 1 }, text_shadowXOffset = 1, text_shadowYOffset = -1, rotateText = "NONE", @@ -68,7 +70,7 @@ local properties = { display = L["Visibility"], setter = "SetVisible", type = "bool", - defaultProperty = true + defaultProperty = true, }, text_color = { display = L["Color"], @@ -82,7 +84,7 @@ local properties = { min = 6, softMax = 72, step = 1, - default = 12 + default = 12, }, text_anchorXOffset = { display = L["X-Offset"], @@ -102,31 +104,30 @@ local properties = { }, } - -- Rotate object around its origin local function animRotate(object, degrees, anchor) - if (not anchor) then - anchor = "CENTER"; + if not anchor then + anchor = "CENTER" end -- Something to rotate if object.animationGroup or degrees ~= 0 then -- Create AnimationGroup and rotation animation - object.animationGroup = object.animationGroup or object:CreateAnimationGroup(); - local group = object.animationGroup; - group.rotate = group.rotate or group:CreateAnimation("rotation"); - local rotate = group.rotate; + object.animationGroup = object.animationGroup or object:CreateAnimationGroup() + local group = object.animationGroup + group.rotate = group.rotate or group:CreateAnimation("rotation") + local rotate = group.rotate if rotate:GetDegrees() == degrees and rotate:GetOrigin() == anchor then return end - rotate:SetOrigin(anchor, 0, 0); - rotate:SetDegrees(degrees); - rotate:SetDuration(0); - rotate:SetEndDelay(2147483647); - group:Play(); - rotate:SetSmoothProgress(1); - group:Pause(); + rotate:SetOrigin(anchor, 0, 0) + rotate:SetDegrees(degrees) + rotate:SetDuration(0) + rotate:SetEndDelay(2147483647) + group:Play() + rotate:SetSmoothProgress(1) + group:Pause() end end @@ -135,36 +136,36 @@ local function getRotateOffset(object, degrees, point) -- Any rotation at all? if degrees ~= 0 then -- Basic offset - local originoffset = object:GetStringHeight() / 2; - local xo = -1 * originoffset * sin(degrees); - local yo = originoffset * (cos(degrees) - 1); + local originoffset = object:GetStringHeight() / 2 + local xo = -1 * originoffset * sin(degrees) + local yo = originoffset * (cos(degrees) - 1) -- Alignment dependant offset if point:find("BOTTOM", 1, true) then - yo = yo + (1 - cos(degrees)) * (object:GetStringWidth() / 2 - originoffset); + yo = yo + (1 - cos(degrees)) * (object:GetStringWidth() / 2 - originoffset) elseif point:find("TOP", 1, true) then - yo = yo - (1 - cos(degrees)) * (object:GetStringWidth() / 2 - originoffset); + yo = yo - (1 - cos(degrees)) * (object:GetStringWidth() / 2 - originoffset) end if point:find("RIGHT", 1, true) then - xo = xo + (1 - cos(degrees)) * (object:GetStringWidth() / 2 - originoffset); + xo = xo + (1 - cos(degrees)) * (object:GetStringWidth() / 2 - originoffset) elseif point:find("LEFT", 1, true) then - xo = xo - (1 - cos(degrees)) * (object:GetStringWidth() / 2 - originoffset); + xo = xo - (1 - cos(degrees)) * (object:GetStringWidth() / 2 - originoffset) end -- Done - return xo, yo; + return xo, yo -- No rotation else - return 0, 0; + return 0, 0 end end local function create() - local region = CreateFrame("Frame", nil, UIParent); + local region = CreateFrame("Frame", nil, UIParent) - local text = region:CreateFontString(nil, "OVERLAY"); - region.text = text; + local text = region:CreateFontString(nil, "OVERLAY") + region.text = text -- WOW's layout system works best if frames and all their parents are anchored -- In this case, it appears that a text doesn't get the right size on the initial @@ -177,7 +178,7 @@ local function create() text:SetWordWrap(true) text:SetNonSpaceWrap(true) - return region; + return region end local function onAcquire(subRegion) @@ -190,7 +191,7 @@ end local function modify(parent, region, parentData, data, first) region:SetParent(parent) - local text = region.text; + local text = region.text -- Legacy members in icon -- Can we remove them with 9.0 ? @@ -210,37 +211,37 @@ local function modify(parent, region, parentData, data, first) end end - local fontPath = SharedMedia:Fetch("font", data.text_font); - text:SetFont(fontPath, data.text_fontSize, data.text_fontType); + local fontPath = SharedMedia:Fetch("font", data.text_font) + text:SetFont(fontPath, data.text_fontSize, data.text_fontType) if not text:GetFont() then -- Font invalid, set the font but keep the setting - text:SetFont(STANDARD_TEXT_FONT, data.text_fontSize, data.text_fontType); + text:SetFont(STANDARD_TEXT_FONT, data.text_fontSize, data.text_fontType) end if text:GetFont() then - text:SetText(WeakAuras.ReplaceRaidMarkerSymbols(data.text_text)); + text:SetText(WeakAuras.ReplaceRaidMarkerSymbols(data.text_text)) end - text:SetTextHeight(data.text_fontSize); + text:SetTextHeight(data.text_fontSize) text:SetShadowColor(unpack(data.text_shadowColor)) text:SetShadowOffset(data.text_shadowXOffset, data.text_shadowYOffset) text:SetJustifyH(data.text_justify or "CENTER") - if (data.text_automaticWidth == "Fixed") then - if (data.text_wordWrap == "WordWrap") then - text:SetWordWrap(true); - text:SetNonSpaceWrap(true); + if data.text_automaticWidth == "Fixed" then + if data.text_wordWrap == "WordWrap" then + text:SetWordWrap(true) + text:SetNonSpaceWrap(true) else - text:SetWordWrap(false); - text:SetNonSpaceWrap(false); + text:SetWordWrap(false) + text:SetNonSpaceWrap(false) end - text:SetWidth(data.text_fixedWidth); - region:SetWidth(data.text_fixedWidth); - region.width = data.text_fixedWidth; + text:SetWidth(data.text_fixedWidth) + region:SetWidth(data.text_fixedWidth) + region.width = data.text_fixedWidth else - text:SetWidth(0); - text:SetWordWrap(true); - text:SetNonSpaceWrap(true); + text:SetWidth(0) + text:SetWordWrap(true) + text:SetNonSpaceWrap(true) end if first then @@ -253,7 +254,7 @@ local function modify(parent, region, parentData, data, first) end if containsCustomText and parentData.customText and parentData.customText ~= "" then - parent.customTextFunc = WeakAuras.LoadFunction("return "..parentData.customText) + parent.customTextFunc = WeakAuras.LoadFunction("return " .. parentData.customText) else parent.customTextFunc = nil end @@ -341,33 +342,33 @@ local function modify(parent, region, parentData, data, first) if not UpdateText then if text:GetFont() then local textStr = data.text_text - textStr = textStr:gsub("\\n", "\n"); + textStr = textStr:gsub("\\n", "\n") text:SetText(WeakAuras.ReplaceRaidMarkerSymbols(textStr)) end end function region:Color(r, g, b, a) - region.color_r = r; - region.color_g = g; - region.color_b = b; - region.color_a = a; - if (r or g or b) then - a = a or 1; + region.color_r = r + region.color_g = g + region.color_b = b + region.color_a = a + if r or g or b then + a = a or 1 end - text:SetTextColor(region.color_anim_r or r, region.color_anim_g or g, region.color_anim_b or b, region.color_anim_a or a); + text:SetTextColor(region.color_anim_r or r, region.color_anim_g or g, region.color_anim_b or b, region.color_anim_a or a) end - region:Color(data.text_color[1], data.text_color[2], data.text_color[3], data.text_color[4]); + region:Color(data.text_color[1], data.text_color[2], data.text_color[3], data.text_color[4]) function region:SetTextHeight(size) - local fontPath = SharedMedia:Fetch("font", data.text_font); + local fontPath = SharedMedia:Fetch("font", data.text_font) if not text:GetFont() then -- Font invalid, set the font but keep the setting - text:SetFont(STANDARD_TEXT_FONT, size, data.text_fontType); + text:SetFont(STANDARD_TEXT_FONT, size, data.text_fontType) else - region.text:SetFont(fontPath, size, data.text_fontType); + region.text:SetFont(fontPath, size, data.text_fontType) end region.text:SetTextHeight(size) - region:UpdateAnchorOnTextChange(); + region:UpdateAnchorOnTextChange() end function region:SetVisible(visible) @@ -408,7 +409,7 @@ local function modify(parent, region, parentData, data, first) region.text_anchorXOffset = data.text_anchorXOffset region.text_anchorYOffset = data.text_anchorYOffset - local textDegrees = data.rotateText == "LEFT" and 90 or data.rotateText == "RIGHT" and -90 or 0; + local textDegrees = data.rotateText == "LEFT" and 90 or data.rotateText == "RIGHT" and -90 or 0 region.UpdateAnchor = function(self) local xo, yo = getRotateOffset(text, textDegrees, selfPoint) @@ -446,7 +447,7 @@ local function addDefaultsForNewAura(data) tinsert(data.subRegions, { ["type"] = "subtext", text_text = "%p", - text_color = {1, 1, 1, 1}, + text_color = { 1, 1, 1, 1 }, text_font = defaultFont, text_fontSize = defaultFontSize, text_fontType = "None", @@ -458,17 +459,17 @@ local function addDefaultsForNewAura(data) anchorXOffset = 0, anchorYOffset = 0, - text_shadowColor = { 0, 0, 0, 1}, + text_shadowColor = { 0, 0, 0, 1 }, text_shadowXOffset = 1, text_shadowYOffset = -1, rotateText = "NONE", - }); + }) tinsert(data.subRegions, { ["type"] = "subtext", text_text = "%n", - text_color = {1, 1, 1, 1}, + text_color = { 1, 1, 1, 1 }, text_font = defaultFont, text_fontSize = defaultFontSize, text_fontType = "None", @@ -480,17 +481,17 @@ local function addDefaultsForNewAura(data) anchorXOffset = 0, anchorYOffset = 0, - text_shadowColor = { 0, 0, 0, 1}, + text_shadowColor = { 0, 0, 0, 1 }, text_shadowXOffset = 1, text_shadowYOffset = -1, rotateText = "NONE", - }); + }) elseif data.regionType == "icon" then tinsert(data.subRegions, { ["type"] = "subtext", text_text = "%s", - text_color = {1, 1, 1, 1}, + text_color = { 1, 1, 1, 1 }, text_font = defaultFont, text_fontSize = defaultFontSize, text_fontType = "OUTLINE", @@ -502,15 +503,16 @@ local function addDefaultsForNewAura(data) anchorXOffset = 0, anchorYOffset = 0, - text_shadowColor = { 0, 0, 0, 1}, + text_shadowColor = { 0, 0, 0, 1 }, text_shadowXOffset = 0, text_shadowYOffset = 0, rotateText = "NONE", - }); + }) end end +-- stylua: ignore local function supports(regionType) return regionType == "texture" or regionType == "progresstexture" @@ -518,4 +520,4 @@ local function supports(regionType) or regionType == "aurabar" end -WeakAuras.RegisterSubRegionType("subtext", L["Text"], supports, create, modify, onAcquire, onRelease, default, addDefaultsForNewAura, properties); +WeakAuras.RegisterSubRegionType("subtext", L["Text"], supports, create, modify, onAcquire, onRelease, default, addDefaultsForNewAura, properties) diff --git a/WeakAuras/SubRegionTypes/Tick.lua b/WeakAuras/SubRegionTypes/Tick.lua index c4b0dd7f70..79d4afda2c 100644 --- a/WeakAuras/SubRegionTypes/Tick.lua +++ b/WeakAuras/SubRegionTypes/Tick.lua @@ -1,12 +1,14 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, Private = ... -local L = WeakAuras.L; +local L = WeakAuras.L local default = function() return { tick_visible = true, - tick_color = {1, 1, 1, 1}, + tick_color = { 1, 1, 1, 1 }, tick_placement_mode = "AtValue", tick_placement = "50", automatic_length = true, @@ -133,7 +135,7 @@ local funcs = { self.trigger_total = nil end self:UpdateVisible() - self:UpdateTickPlacement(); + self:UpdateTickPlacement() self:UpdateTimerTick() end, OrientationChanged = function(self) @@ -264,7 +266,7 @@ local funcs = { offset = -offset end - if (self.vertical) then + if self.vertical then offsety = offset else offsetx = offset @@ -321,8 +323,8 @@ local funcs = { end end, UpdateTickRotation = function(self) - local rad = math.rad(self.tick_rotation) - self.texture:SetRotation(rad) + local rad = math.rad(self.tick_rotation) + self.texture:SetRotation(rad) end, SetTickMirror = function(self, mirror) if self.mirror ~= mirror then @@ -332,9 +334,9 @@ local funcs = { end, UpdateTickMirror = function(self) if self.mirror then - self.texture:SetTexCoord(0, 1, 1, 1, 0, 0, 1, 0) + self.texture:SetTexCoord(0, 1, 1, 1, 0, 0, 1, 0) else - self.texture:SetTexCoord(0, 0, 1, 0, 0, 1, 1, 1) + self.texture:SetTexCoord(0, 0, 1, 0, 0, 1, 1, 1) end end, SetTickBlendMode = function(self, mode) @@ -353,13 +355,12 @@ local funcs = { } local function modify(parent, region, parentData, data, first) - region:SetParent(parent) region.orientation = parent.effectiveOrientation region.inverse = parentData.inverse region.trigger_inverse = false region.vertical = region.orientation == "VERTICAL" or region.orientation == "VERTICAL_INVERSE" - if (region.vertical) then + if region.vertical then region.parentMinorSize, region.parentMajorSize = parent.bar:GetRealSize() else region.parentMajorSize, region.parentMinorSize = parent.bar:GetRealSize() @@ -409,4 +410,4 @@ local function supports(regionType) return regionType == "aurabar" end -WeakAuras.RegisterSubRegionType("subtick", L["Tick"], supports, create, modify, onAcquire, onRelease, default, nil, properties); +WeakAuras.RegisterSubRegionType("subtick", L["Tick"], supports, create, modify, onAcquire, onRelease, default, nil, properties) diff --git a/WeakAuras/Transmission.lua b/WeakAuras/Transmission.lua index bd79520f0d..775b180115 100644 --- a/WeakAuras/Transmission.lua +++ b/WeakAuras/Transmission.lua @@ -17,8 +17,11 @@ Import(str, [target]) Imports an aura from a table, which may or may not be encoded as a B64 string. If target is installed data, or is a uid which points to installed data, then the import will be an update to that aura -]]-- -if not WeakAuras.IsLibsOK() then return end +]] +-- +if not WeakAuras.IsLibsOK() then + return +end local AddonName, Private = ... -- Lua APIs @@ -28,16 +31,16 @@ local pairs, type, unpack = pairs, type, unpack local error = error local bit_band, bit_lshift, bit_rshift = bit.band, bit.lshift, bit.rshift -local WeakAuras = WeakAuras; -local L = WeakAuras.L; +local WeakAuras = WeakAuras +local L = WeakAuras.L -local versionString = WeakAuras.versionString; +local versionString = WeakAuras.versionString -- Local functions local decodeB64, GenerateUniqueID local CompressDisplay, ShowTooltip, TableToString, StringToTable local RequestDisplay, TransmitError, TransmitDisplay - +-- stylua: ignore start local bytetoB64 = { [0]="a","b","c","d","e","f","g","h", "i","j","k","l","m","n","o","p", @@ -59,33 +62,33 @@ local B64tobyte = { W = 48, X = 49, Y = 50, Z = 51,["0"]=52,["1"]=53,["2"]=54,["3"]=55, ["4"]=56,["5"]=57,["6"]=58,["7"]=59,["8"]=60,["9"]=61,["("]=62,[")"]=63 } - +-- stylua: ignore end -- This code is based on the Encode7Bit algorithm from LibCompress -- Credit goes to Galmok (galmok@gmail.com) local decodeB64Table = {} function decodeB64(str) - local bit8 = decodeB64Table; - local decoded_size = 0; - local ch; - local i = 1; - local bitfield_len = 0; - local bitfield = 0; - local l = #str; + local bit8 = decodeB64Table + local decoded_size = 0 + local ch + local i = 1 + local bitfield_len = 0 + local bitfield = 0 + local l = #str while true do if bitfield_len >= 8 then - decoded_size = decoded_size + 1; - bit8[decoded_size] = string_char(bit_band(bitfield, 255)); - bitfield = bit_rshift(bitfield, 8); - bitfield_len = bitfield_len - 8; + decoded_size = decoded_size + 1 + bit8[decoded_size] = string_char(bit_band(bitfield, 255)) + bitfield = bit_rshift(bitfield, 8) + bitfield_len = bitfield_len - 8 end - ch = B64tobyte[str:sub(i, i)]; - bitfield = bitfield + bit_lshift(ch or 0, bitfield_len); - bitfield_len = bitfield_len + 6; + ch = B64tobyte[str:sub(i, i)] + bitfield = bitfield + bit_lshift(ch or 0, bitfield_len) + bitfield_len = bitfield_len + 6 if i > l then - break; + break end - i = i + 1; + i = i + 1 end return table.concat(bit8, "", 1, decoded_size) end @@ -93,7 +96,7 @@ end function GenerateUniqueID() -- generates a unique random 11 digit number in base64 local s = {} - for i=1,11 do + for i = 1, 11 do tinsert(s, bytetoB64[math.random(0, 63)]) end return table.concat(s) @@ -118,15 +121,15 @@ function CompressDisplay(data, version) for triggernum, triggerData in ipairs(data.triggers) do local trigger, untrigger = triggerData.trigger, triggerData.untrigger - if (trigger and trigger.type ~= "custom") then - trigger.custom = nil; - trigger.customDuration = nil; - trigger.customName = nil; - trigger.customIcon = nil; - trigger.customTexture = nil; - trigger.customStacks = nil; - if (untrigger) then - untrigger.custom = nil; + if trigger and trigger.type ~= "custom" then + trigger.custom = nil + trigger.customDuration = nil + trigger.customName = nil + trigger.customIcon = nil + trigger.customTexture = nil + trigger.customStacks = nil + if untrigger then + untrigger.custom = nil end end end @@ -135,7 +138,7 @@ function CompressDisplay(data, version) local non_transmissable_fields = version >= 2000 and Private.non_transmissable_fields_v2000 or Private.non_transmissable_fields stripNonTransmissableFields(copiedData, non_transmissable_fields) copiedData.tocversion = WeakAuras.BuildInfo - return copiedData; + return copiedData end local function filterFunc(_, event, msg, player, l, cs, t, flag, channelId, ...) @@ -143,47 +146,47 @@ local function filterFunc(_, event, msg, player, l, cs, t, flag, channelId, ...) return end - local newMsg = ""; - local remaining = msg; - local done; + local newMsg = "" + local remaining = msg + local done repeat - local start, finish, characterName, displayName = remaining:find("%[WeakAuras: ([^%s]+) %- (.*)%]"); - if(characterName and displayName) then - characterName = characterName:gsub("|c[Ff][Ff]......", ""):gsub("|r", ""); - displayName = displayName:gsub("|c[Ff][Ff]......", ""):gsub("|r", ""); - newMsg = newMsg..remaining:sub(1, start-1); - newMsg = newMsg.."|Hgarrmission:weakauras|h|cFF8800FF["..characterName.." |r|cFF8800FF- "..displayName.."]|h|r"; - remaining = remaining:sub(finish + 1); + local start, finish, characterName, displayName = remaining:find("%[WeakAuras: ([^%s]+) %- (.*)%]") + if characterName and displayName then + characterName = characterName:gsub("|c[Ff][Ff]......", ""):gsub("|r", "") + displayName = displayName:gsub("|c[Ff][Ff]......", ""):gsub("|r", "") + newMsg = newMsg .. remaining:sub(1, start - 1) + newMsg = newMsg .. "|Hgarrmission:weakauras|h|cFF8800FF[" .. characterName .. " |r|cFF8800FF- " .. displayName .. "]|h|r" + remaining = remaining:sub(finish + 1) else - done = true; + done = true end - until(done) + until done if newMsg ~= "" then local trimmedPlayer = Ambiguate(player, "none") if event == "CHAT_MSG_WHISPER" and not UnitInRaid(trimmedPlayer) and not UnitInParty(trimmedPlayer) then -- XXX: Need a guild check local _, num = BNGetNumFriends() - for i=1, num do + for i = 1, num do if C_BattleNet then -- introduced in 8.2.5 PTR local toon = C_BattleNet.GetFriendNumGameAccounts(i) - for j=1, toon do - local gameAccountInfo = C_BattleNet.GetFriendGameAccountInfo(i, j); + for j = 1, toon do + local gameAccountInfo = C_BattleNet.GetFriendGameAccountInfo(i, j) if gameAccountInfo.characterName == trimmedPlayer and gameAccountInfo.clientProgram == "WoW" then - return false, newMsg, player, l, cs, t, flag, channelId, ...; -- Player is a real id friend, allow it + return false, newMsg, player, l, cs, t, flag, channelId, ... -- Player is a real id friend, allow it end end else -- keep old method for 8.2 and Classic local toon = BNGetNumFriendGameAccounts(i) - for j=1, toon do + for j = 1, toon do local _, rName, rGame = BNGetFriendGameAccountInfo(i, j) if rName == trimmedPlayer and rGame == "WoW" then - return false, newMsg, player, l, cs, t, flag, channelId, ...; -- Player is a real id friend, allow it + return false, newMsg, player, l, cs, t, flag, channelId, ... -- Player is a real id friend, allow it end end end end return true -- Filter strangers else - return false, newMsg, player, l, cs, t, flag, channelId, ...; + return false, newMsg, player, l, cs, t, flag, channelId, ... end end end @@ -209,53 +212,53 @@ local LibDeflate = LibStub:GetLibrary("LibDeflate") local Serializer = LibStub:GetLibrary("AceSerializer-3.0") local LibSerialize = LibStub("LibSerialize") local Comm = LibStub:GetLibrary("AceComm-3.0") -local configForDeflate = {level = 9} -- the biggest bottleneck by far is in transmission and printing; so use maximal compression +local configForDeflate = { level = 9 } -- the biggest bottleneck by far is in transmission and printing; so use maximal compression local configForLS = { - errorOnUnserializableType = false + errorOnUnserializableType = false, } -local tooltipLoading; -local receivedData; +local tooltipLoading +local receivedData hooksecurefunc("SetItemRef", function(link, text) - if(link == "garrmission:weakauras") then - local _, _, characterName, displayName = text:find("|Hgarrmission:weakauras|h|cFF8800FF%[([^%s]+) |r|cFF8800FF%- (.*)%]|h"); - if(characterName and displayName) then - characterName = characterName:gsub("|c[Ff][Ff]......", ""):gsub("|r", ""); - displayName = displayName:gsub("|c[Ff][Ff]......", ""):gsub("|r", ""); - if(IsShiftKeyDown()) then - local editbox = GetCurrentKeyBoardFocus(); - if(editbox) then - editbox:Insert("[WeakAuras: "..characterName.." - "..displayName.."]"); + if link == "garrmission:weakauras" then + local _, _, characterName, displayName = text:find("|Hgarrmission:weakauras|h|cFF8800FF%[([^%s]+) |r|cFF8800FF%- (.*)%]|h") + if characterName and displayName then + characterName = characterName:gsub("|c[Ff][Ff]......", ""):gsub("|r", "") + displayName = displayName:gsub("|c[Ff][Ff]......", ""):gsub("|r", "") + if IsShiftKeyDown() then + local editbox = GetCurrentKeyBoardFocus() + if editbox then + editbox:Insert("[WeakAuras: " .. characterName .. " - " .. displayName .. "]") end else characterName = characterName:gsub("%.", "") ShowTooltip({ - {2, "WeakAuras", displayName, 0.5, 0, 1, 1, 1, 1}, - {1, L["Requesting display information from %s ..."]:format(characterName), 1, 0.82, 0}, - {1, L["Note, that cross realm transmission is possible if you are on the same group"], 1, 0.82, 0} - }); - tooltipLoading = true; - receivedData = false; - RequestDisplay(characterName, displayName); + { 2, "WeakAuras", displayName, 0.5, 0, 1, 1, 1, 1 }, + { 1, L["Requesting display information from %s ..."]:format(characterName), 1, 0.82, 0 }, + { 1, L["Note, that cross realm transmission is possible if you are on the same group"], 1, 0.82, 0 }, + }) + tooltipLoading = true + receivedData = false + RequestDisplay(characterName, displayName) WeakAuras.timer:ScheduleTimer(function() - if (tooltipLoading and not receivedData and ItemRefTooltip:IsVisible()) then + if tooltipLoading and not receivedData and ItemRefTooltip:IsVisible() then ShowTooltip({ - {2, "WeakAuras", displayName, 0.5, 0, 1, 1, 1, 1}, - {1, L["Error not receiving display information from %s"]:format(characterName), 1, 0, 0}, - {1, L["Note, that cross realm transmission is possible if you are on the same group"], 1, 0.82, 0} + { 2, "WeakAuras", displayName, 0.5, 0, 1, 1, 1, 1 }, + { 1, L["Error not receiving display information from %s"]:format(characterName), 1, 0, 0 }, + { 1, L["Note, that cross realm transmission is possible if you are on the same group"], 1, 0.82, 0 }, }) end - end, 5); + end, 5) end else ShowTooltip({ - {1, "WeakAuras", 0.5, 0, 1}, - {1, L["Malformed WeakAuras link"], 1, 0, 0} - }); + { 1, "WeakAuras", 0.5, 0, 1 }, + { 1, L["Malformed WeakAuras link"], 1, 0, 0 }, + }) end end -end); +end) local compressedTablesCache = {} @@ -280,7 +283,7 @@ function TableToString(inTable, forChat) end end local encoded = "!WA:2!" - if(forChat) then + if forChat then encoded = encoded .. LibDeflate:EncodeForPrint(compressed) else encoded = encoded .. LibDeflate:EncodeForWoWAddonChannel(compressed) @@ -302,7 +305,7 @@ function StringToTable(inString, fromChat) end local decoded - if(fromChat) then + if fromChat then if encodeVersion > 0 then decoded = LibDeflate:DecodeForPrint(encoded) else @@ -322,7 +325,7 @@ function StringToTable(inString, fromChat) else decompressed, errorMsg = Compresser:Decompress(decoded) end - if not(decompressed) then + if not decompressed then return "Error decompressing: " .. errorMsg end @@ -332,32 +335,32 @@ function StringToTable(inString, fromChat) else success, deserialized = LibSerialize:Deserialize(decompressed) end - if not(success) then - return "Error deserializing "..deserialized + if not success then + return "Error deserializing " .. deserialized end return deserialized end Private.StringToTable = StringToTable function Private.DisplayToString(id, forChat) - local data = WeakAuras.GetData(id); - if(data) then + local data = WeakAuras.GetData(id) + if data then data.uid = data.uid or GenerateUniqueID() -- Check which transmission version we want to use local version = 1421 for child in Private.TraverseSubGroups(data) do -- luacheck: ignore version = 2000 - break; + break end - local transmitData = CompressDisplay(data, version); + local transmitData = CompressDisplay(data, version) local transmit = { m = "d", d = transmitData, v = version, - s = versionString - }; - if(data.controlledChildren) then - transmit.c = {}; + s = versionString, + } + if data.controlledChildren then + transmit.c = {} local uids = {} local index = 1 for child in Private.TraverseAllChildren(data) do @@ -370,13 +373,13 @@ function Private.DisplayToString(id, forChat) else child.uid = GenerateUniqueID() end - transmit.c[index] = CompressDisplay(child, version); + transmit.c[index] = CompressDisplay(child, version) index = index + 1 end end - return TableToString(transmit, forChat); + return TableToString(transmit, forChat) else - return ""; + return "" end end @@ -420,24 +423,24 @@ function Private.DataToString(id) end function Private.SerializeTable(data) - local lines = {"{"} + local lines = { "{" } recurseStringify(data, 1, lines) tinsert(lines, "}") return table.concat(lines, "\n") end function ShowTooltip(lines) - ItemRefTooltip:Show(); + ItemRefTooltip:Show() if not ItemRefTooltip:IsVisible() then - ItemRefTooltip:SetOwner(UIParent, "ANCHOR_PRESERVE"); + ItemRefTooltip:SetOwner(UIParent, "ANCHOR_PRESERVE") end - ItemRefTooltip:ClearLines(); + ItemRefTooltip:ClearLines() for i, line in ipairs(lines) do - local sides, a1, a2, a3, a4, a5, a6, a7, a8 = unpack(line); - if(sides == 1) then - ItemRefTooltip:AddLine(a1, a2, a3, a4, a5); - elseif(sides == 2) then - ItemRefTooltip:AddDoubleLine(a1, a2, a3, a4, a5, a6, a7, a8); + local sides, a1, a2, a3, a4, a5, a6, a7, a8 = unpack(line) + if sides == 1 then + ItemRefTooltip:AddLine(a1, a2, a3, a4, a5) + elseif sides == 2 then + ItemRefTooltip:AddDoubleLine(a1, a2, a3, a4, a5, a6, a7, a8) end end ItemRefTooltip:Show() @@ -467,22 +470,22 @@ end function WeakAuras.Import(inData, target, callbackFunc) local data, children, version - if type(inData) == 'string' then + if type(inData) == "string" then -- encoded data local received = StringToTable(inData, true) - if type(received) == 'string' then + if type(received) == "string" then -- this is probably an error message from LibDeflate. Display it. - ShowTooltip{ - {1, "WeakAuras", 0.5333, 0, 1}, - {1, received, 1, 0, 0, 1} - } + ShowTooltip({ + { 1, "WeakAuras", 0.5333, 0, 1 }, + { 1, received, 1, 0, 0, 1 }, + }) return nil, received elseif received.m == "d" then data = received.d children = received.c version = received.v end - elseif type(inData.d) == 'table' then + elseif type(inData.d) == "table" then data = inData.d children = inData.c version = inData.v @@ -502,8 +505,8 @@ function WeakAuras.Import(inData, target, callbackFunc) end local status, msg = true, "" - if type(target) ~= 'nil' then - local uid = type(target) == 'table' and target.uid or target + if type(target) ~= "nil" then + local uid = type(target) == "table" and target.uid or target local targetData = Private.GetDataByUID(uid) if not targetData then return false, "Invalid update target." @@ -518,7 +521,7 @@ function WeakAuras.Import(inData, target, callbackFunc) end end - tooltipLoading = nil; + tooltipLoading = nil return ImportNow(data, children, target, nil, callbackFunc) end @@ -542,28 +545,28 @@ function RequestDisplay(characterName, displayName) safeSenders[Ambiguate(characterName, "none")] = true local transmit = { m = "dR", - d = displayName - }; - local transmitString = TableToString(transmit); - crossRealmSendCommMessage("WeakAuras", transmitString, characterName); + d = displayName, + } + local transmitString = TableToString(transmit) + crossRealmSendCommMessage("WeakAuras", transmitString, characterName) end function TransmitError(errorMsg, characterName) local transmit = { m = "dE", - eM = errorMsg - }; - crossRealmSendCommMessage("WeakAuras", TableToString(transmit), characterName); + eM = errorMsg, + } + crossRealmSendCommMessage("WeakAuras", TableToString(transmit), characterName) end function TransmitDisplay(id, characterName) - local encoded = Private.DisplayToString(id); - if(encoded ~= "") then + local encoded = Private.DisplayToString(id) + if encoded ~= "" then crossRealmSendCommMessage("WeakAuras", encoded, characterName, "BULK", function(displayName, done, total) - crossRealmSendCommMessage("WeakAurasProg", done.." "..total.." "..displayName, characterName, "ALERT"); - end, id); + crossRealmSendCommMessage("WeakAurasProg", done .. " " .. total .. " " .. displayName, characterName, "ALERT") + end, id) else - TransmitError("dne", characterName); + TransmitError("dne", characterName) end end @@ -581,17 +584,17 @@ Comm:RegisterComm("WeakAurasProg", function(prefix, message, distribution, sende end end if tooltipLoading and ItemRefTooltip:IsVisible() and safeSenders[sender] then - receivedData = true; + receivedData = true local done, total, displayName = strsplit(" ", message, 3) done = tonumber(done) total = tonumber(total) - if(done and total and total >= done) then + if done and total and total >= done then local red = min(255, (1 - done / total) * 511) local green = min(255, (done / total) * 511) ShowTooltip({ - {2, "WeakAuras", displayName, 0.5, 0, 1, 1, 1, 1}, - {1, L["Receiving display information"]:format(sender), 1, 0.82, 0}, - {2, " ", ("|cFF%2x%2x00"):format(red, green)..done.."|cFF00FF00/"..total} + { 2, "WeakAuras", displayName, 0.5, 0, 1, 1, 1, 1 }, + { 1, L["Receiving display information"]:format(sender), 1, 0.82, 0 }, + { 2, " ", ("|cFF%2x%2x00"):format(red, green) .. done .. "|cFF00FF00/" .. total }, }) end end @@ -626,10 +629,10 @@ Comm:RegisterComm("WeakAuras", function(prefix, message, distribution, sender) return end - local received = StringToTable(message); - if(received and type(received) == "table" and received.m) then - if(received.m == "d") then - tooltipLoading = nil; + local received = StringToTable(message) + if received and type(received) == "table" and received.m then + if received.m == "d" then + tooltipLoading = nil local data, children, version = received.d, received.c, received.v WeakAuras.PreAdd(data) if children then @@ -649,28 +652,28 @@ Comm:RegisterComm("WeakAuras", function(prefix, message, distribution, sender) ItemRefTooltip:Hide() ImportNow(data, children, nil, sender) - elseif(received.m == "dR") then - if(Private.linked and Private.linked[received.d] and Private.linked[received.d] > GetTime() - linkValidityDuration) then - TransmitDisplay(received.d, sender); + elseif received.m == "dR" then + if Private.linked and Private.linked[received.d] and Private.linked[received.d] > GetTime() - linkValidityDuration then + TransmitDisplay(received.d, sender) end - elseif(received.m == "dE") then - tooltipLoading = nil; - if(received.eM == "dne") then + elseif received.m == "dE" then + tooltipLoading = nil + if received.eM == "dne" then ShowTooltip({ - {1, "WeakAuras", 0.5333, 0, 1}, - {1, L["Requested display does not exist"], 1, 0, 0} - }); - elseif(received.eM == "na") then + { 1, "WeakAuras", 0.5333, 0, 1 }, + { 1, L["Requested display does not exist"], 1, 0, 0 }, + }) + elseif received.eM == "na" then ShowTooltip({ - {1, "WeakAuras", 0.5333, 0, 1}, - {1, L["Requested display not authorized"], 1, 0, 0} - }); + { 1, "WeakAuras", 0.5333, 0, 1 }, + { 1, L["Requested display not authorized"], 1, 0, 0 }, + }) end end - elseif(ItemRefTooltip.WeakAuras_Tooltip_Thumbnail and ItemRefTooltip.WeakAuras_Tooltip_Thumbnail:IsVisible()) then + elseif ItemRefTooltip.WeakAuras_Tooltip_Thumbnail and ItemRefTooltip.WeakAuras_Tooltip_Thumbnail:IsVisible() then ShowTooltip({ - {1, "WeakAuras", 0.5333, 0, 1}, - {1, L["Transmission error"], 1, 0, 0} - }); + { 1, "WeakAuras", 0.5333, 0, 1 }, + { 1, L["Transmission error"], 1, 0, 0 }, + }) end -end); +end) diff --git a/WeakAuras/Types.lua b/WeakAuras/Types.lua index fa1e10b13b..8175b25db7 100644 --- a/WeakAuras/Types.lua +++ b/WeakAuras/Types.lua @@ -1,10 +1,12 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, Private = ... -local WeakAuras = WeakAuras; -local L = WeakAuras.L; +local WeakAuras = WeakAuras +local L = WeakAuras.L -local LSM = LibStub("LibSharedMedia-3.0"); +local LSM = LibStub("LibSharedMedia-3.0") local wipe, tinsert = wipe, tinsert local GetNumShapeshiftForms, GetShapeshiftFormInfo = GetNumShapeshiftForms, GetShapeshiftFormInfo @@ -23,18 +25,18 @@ end Private.glow_action_types = { show = L["Show"], - hide = L["Hide"] + hide = L["Hide"], } Private.glow_frame_types = { UNITFRAME = L["Unit Frame"], NAMEPLATE = L["Nameplate"], - FRAMESELECTOR = L["Frame Selector"] + FRAMESELECTOR = L["Frame Selector"], } Private.circular_group_constant_factor_types = { RADIUS = L["Radius"], - SPACING = L["Spacing"] + SPACING = L["Spacing"], } Private.frame_strata_types = { @@ -46,36 +48,35 @@ Private.frame_strata_types = { [6] = "DIALOG", [7] = "FULLSCREEN", [8] = "FULLSCREEN_DIALOG", - [9] = "TOOLTIP" + [9] = "TOOLTIP", } Private.hostility_types = { hostile = L["Hostile"], - friendly = L["Friendly"] + friendly = L["Friendly"], } Private.character_types = { player = L["Player Character"], - npc = L["Non-player Character"] + npc = L["Non-player Character"], } - Private.group_sort_types = { ascending = L["Ascending"], descending = L["Descending"], hybrid = L["Hybrid"], none = L["None"], - custom = L["Custom"] + custom = L["Custom"], } Private.group_hybrid_position_types = { hybridFirst = L["Marked First"], - hybridLast = L["Marked Last"] + hybridLast = L["Marked Last"], } Private.group_hybrid_sort_types = { ascending = L["Ascending"], - descending = L["Descending"] + descending = L["Descending"], } if WeakAuras.IsClassic() then @@ -106,25 +107,25 @@ Private.precision_types = { Private.big_number_types = { ["AbbreviateNumbers"] = L["AbbreviateNumbers (Blizzard)"], - ["AbbreviateLargeNumbers"] = L["AbbreviateLargeNumbers (Blizzard)"] + ["AbbreviateLargeNumbers"] = L["AbbreviateLargeNumbers (Blizzard)"], } Private.round_types = { floor = L["Floor"], ceil = L["Ceil"], - round = L["Round"] + round = L["Round"], } Private.unit_color_types = { none = L["None"], - class = L["Class"] + class = L["Class"], } Private.unit_realm_name_types = { never = L["Never"], star = L["* Suffix"], differentServer = L["Only if on a different realm"], - always = L["Always include realm"] + always = L["Always include realm"], } local timeFormatter = {} @@ -156,28 +157,40 @@ end local simpleFormatters = { AbbreviateNumbers = function(value) - if type(value) == "string" then value = tonumber(value) end + if type(value) == "string" then + value = tonumber(value) + end return (type(value) == "number") and AbbreviateNumbers(value) or value end, AbbreviateLargeNumbers = function(value) - if type(value) == "string" then value = tonumber(value) end + if type(value) == "string" then + value = tonumber(value) + end return (type(value) == "number") and AbbreviateLargeNumbers(Round(value)) or value end, floor = function(value) - if type(value) == "string" then value = tonumber(value) end + if type(value) == "string" then + value = tonumber(value) + end return (type(value) == "number") and floor(value) or value end, ceil = function(value) - if type(value) == "string" then value = tonumber(value) end + if type(value) == "string" then + value = tonumber(value) + end return (type(value) == "number") and ceil(value) or value end, round = function(value) - if type(value) == "string" then value = tonumber(value) end + if type(value) == "string" then + value = tonumber(value) + end return (type(value) == "number") and Round(value) or value end, time = { [0] = function(value) - if type(value) == "string" then value = tonumber(value) end + if type(value) == "string" then + value = tonumber(value) + end if type(value) == "number" then if value > 60 then return string.format("%i:", math.floor(value / 60)) .. string.format("%02i", value % 60) @@ -198,7 +211,9 @@ local simpleFormatters = { end, -- Fixed built-in formatter [99] = function(value) - if type(value) == "string" then value = tonumber(value) end + if type(value) == "string" then + value = tonumber(value) + end if type(value) == "number" then value = ceil(value) if value > 60 then @@ -215,7 +230,7 @@ Private.format_types = { none = { display = L["None"], AddOptions = function() end, - CreateFormatter = function() end + CreateFormatter = function() end, }, string = { display = L["String"], @@ -236,7 +251,7 @@ Private.format_types = { step = 1, disabled = function() return not get(symbol .. "_abbreviate") - end + end, }) end, CreateFormatter = function(symbol, get) @@ -248,7 +263,7 @@ Private.format_types = { end end return nil - end + end, }, timed = { display = L["Time Format"], @@ -258,7 +273,7 @@ Private.format_types = { name = L["Format"], width = WeakAuras.doubleWidth, values = Private.time_format_types, - hidden = hidden + hidden = hidden, }) addOption(symbol .. "_time_dynamic_threshold", { @@ -277,7 +292,9 @@ Private.format_types = { width = WeakAuras.normalWidth, values = Private.time_precision_types, hidden = hidden, - disabled = function() return get(symbol .. "_time_dynamic_threshold") == 0 end + disabled = function() + return get(symbol .. "_time_dynamic_threshold") == 0 + end, }) addOption(symbol .. "_time_mod_rate", { @@ -294,7 +311,9 @@ Private.format_types = { desc = L["Enables (incorrect) round down of seconds, which was the previous default behavior."], width = WeakAuras.normalWidth, hidden = hidden, - disabled = function() return get(symbol .. "_time_format", 0) ~= 0 end + disabled = function() + return get(symbol .. "_time_format", 0) ~= 0 + end, }) end, CreateFormatter = function(symbol, get) @@ -315,7 +334,7 @@ Private.format_types = { local formatter if threshold == 0 then formatter = function(value, state) - if type(value) ~= 'number' or value == math.huge then + if type(value) ~= "number" or value == math.huge then return "" end if value <= 0 then @@ -331,7 +350,7 @@ Private.format_types = { else local formatString = "%." .. precision .. "f" formatter = function(value, state) - if type(value) ~= 'number' or value == math.huge then + if type(value) ~= "number" or value == math.huge then return "" end if value <= 0 then @@ -363,7 +382,7 @@ Private.format_types = { else return formatter end - end + end, }, BigNumber = { display = L["Big Number"], @@ -373,22 +392,22 @@ Private.format_types = { name = L["Format"], width = WeakAuras.normalWidth, values = Private.big_number_types, - hidden = hidden + hidden = hidden, }) addOption(symbol .. "_big_number_space", { type = "description", name = "", width = WeakAuras.normalWidth, - hidden = hidden + hidden = hidden, }) end, CreateFormatter = function(symbol, get) local format = get(symbol .. "_big_number_format", "AbbreviateNumbers") - if (format == "AbbreviateNumbers") then + if format == "AbbreviateNumbers" then return simpleFormatters.AbbreviateNumbers end return simpleFormatters.AbbreviateLargeNumbers - end + end, }, Number = { display = L["Number"], @@ -398,7 +417,7 @@ Private.format_types = { name = L["Precision"], width = WeakAuras.normalWidth, values = Private.precision_types, - hidden = hidden + hidden = hidden, }) addOption(symbol .. "_round_type", { type = "select", @@ -408,7 +427,7 @@ Private.format_types = { hidden = hidden, disabled = function() return get(symbol .. "_decimal_precision") ~= 0 - end + end, }) end, CreateFormatter = function(symbol, get) @@ -422,7 +441,7 @@ Private.format_types = { return (type(value) == "number") and string.format(format, value) or value end end - end + end, }, Unit = { display = L["Formats |cFFFF0000%unit|r"], @@ -459,7 +478,7 @@ Private.format_types = { step = 1, disabled = function() return not get(symbol .. "_abbreviate") - end + end, }) end, CreateFormatter = function(symbol, get, withoutColor) @@ -549,7 +568,7 @@ Private.format_types = { return nameFunc end end - end + end, }, guid = { display = L["Formats Player's |cFFFF0000%guid|r"], @@ -585,7 +604,7 @@ Private.format_types = { hidden = hidden, disabled = function() return not get(symbol .. "_abbreviate") - end + end, }) end, CreateFormatter = function(symbol, get, withoutColor) @@ -676,7 +695,7 @@ Private.format_types = { end end end - end + end, }, GCDTime = { display = L["Time in GCDs"], @@ -685,25 +704,25 @@ Private.format_types = { type = "toggle", name = L["Subtract GCD"], width = WeakAuras.normalWidth, - hidden = hidden + hidden = hidden, }) addOption(symbol .. "_gcd_cast", { type = "toggle", name = L["Subtract Cast"], width = WeakAuras.normalWidth, - hidden = hidden + hidden = hidden, }) addOption(symbol .. "_gcd_channel", { type = "toggle", name = L["Subtract Channel"], width = WeakAuras.normalWidth, - hidden = hidden + hidden = hidden, }) addOption(symbol .. "_gcd_hide_zero", { type = "toggle", name = L["Hide 0 cooldowns"], width = WeakAuras.normalWidth, - hidden = hidden + hidden = hidden, }) addOption(symbol .. "_decimal_precision", { @@ -711,7 +730,7 @@ Private.format_types = { name = L["Precision"], width = WeakAuras.normalWidth, values = Private.precision_types, - hidden = hidden + hidden = hidden, }) addOption(symbol .. "_round_type", { type = "select", @@ -721,7 +740,7 @@ Private.format_types = { hidden = hidden, disabled = function() return get(symbol .. "_decimal_precision") ~= 0 - end + end, }) end, CreateFormatter = function(symbol, get) @@ -778,37 +797,38 @@ Private.format_types = { return numberToStringFunc(result / WeakAuras.CalculatedGcdDuration()) end - end - } + end, + }, } Private.format_types_display = {} -for k, v in pairs(Private.format_types) do Private.format_types_display[k] = v.display end - +for k, v in pairs(Private.format_types) do + Private.format_types_display[k] = v.display +end Private.sound_channel_types = { Master = L["Master"], SFX = ENABLE_SOUNDFX, Ambience = ENABLE_AMBIENCE, Music = ENABLE_MUSIC, - Dialog = ENABLE_DIALOG + Dialog = ENABLE_DIALOG, } Private.sound_condition_types = { Play = L["Play"], Loop = L["Loop"], - Stop = L["Stop"] + Stop = L["Stop"], } Private.trigger_require_types = { any = L["Any Triggers"], all = L["All Triggers"], - custom = L["Custom Function"] + custom = L["Custom Function"], } Private.trigger_require_types_one = { any = L["Trigger 1"], - custom = L["Custom Function"] + custom = L["Custom Function"], } Private.trigger_modes = { @@ -818,13 +838,13 @@ Private.trigger_modes = { Private.debuff_types = { HELPFUL = L["Buff"], HARMFUL = L["Debuff"], - BOTH = L["Buff/Debuff"] + BOTH = L["Buff/Debuff"], } Private.tooltip_count = { [1] = L["First"], [2] = L["Second"], - [3] = L["Third"] + [3] = L["Third"], } Private.aura_types = { @@ -832,14 +852,13 @@ Private.aura_types = { DEBUFF = L["Debuff"], } - Private.debuff_class_types = { magic = L["Magic"], curse = L["Curse"], disease = L["Disease"], poison = L["Poison"], enrage = L["Enrage"], - none = L["None"] + none = L["None"], } Private.unit_types = { @@ -849,7 +868,7 @@ Private.unit_types = { group = L["Group"], member = L["Specific Unit"], pet = L["Pet"], - multi = L["Multi-target"] + multi = L["Multi-target"], } Private.unit_types_bufftrigger_2 = { @@ -864,7 +883,7 @@ Private.unit_types_bufftrigger_2 = { nameplate = L["Nameplate"], pet = L["Pet"], member = L["Specific Unit"], - multi = L["Multi-target"] + multi = L["Multi-target"], } Private.actual_unit_types_with_specific = { @@ -872,7 +891,7 @@ Private.actual_unit_types_with_specific = { target = L["Target"], focus = L["Focus"], pet = L["Pet"], - member = L["Specific Unit"] + member = L["Specific Unit"], } Private.actual_unit_types_cast = { @@ -889,7 +908,8 @@ Private.actual_unit_types_cast = { member = L["Specific Unit"], } -Private.actual_unit_types_cast_tooltip = L["• |cff00ff00Player|r, |cff00ff00Target|r, |cff00ff00Focus|r, and |cff00ff00Pet|r correspond directly to those individual unitIDs.\n• |cff00ff00Specific Unit|r lets you provide a specific valid unitID to watch.\n|cffff0000Note|r: The game will not fire events for all valid unitIDs, making some untrackable by this trigger.\n• |cffffff00Party|r, |cffffff00Raid|r, |cffffff00Boss|r, |cffffff00Arena|r, and |cffffff00Nameplate|r can match multiple corresponding unitIDs.\n• |cffffff00Smart Group|r adjusts to your current group type, matching just the \"player\" when solo, \"party\" units (including \"player\") in a party or \"raid\" units in a raid.\n\n|cffffff00*|r Yellow Unit settings will create clones for each matching unit while this trigger is providing Dynamic Info to the Aura."] +Private.actual_unit_types_cast_tooltip = + L["• |cff00ff00Player|r, |cff00ff00Target|r, |cff00ff00Focus|r, and |cff00ff00Pet|r correspond directly to those individual unitIDs.\n• |cff00ff00Specific Unit|r lets you provide a specific valid unitID to watch.\n|cffff0000Note|r: The game will not fire events for all valid unitIDs, making some untrackable by this trigger.\n• |cffffff00Party|r, |cffffff00Raid|r, |cffffff00Boss|r, |cffffff00Arena|r, and |cffffff00Nameplate|r can match multiple corresponding unitIDs.\n• |cffffff00Smart Group|r adjusts to your current group type, matching just the \"player\" when solo, \"party\" units (including \"player\") in a party or \"raid\" units in a raid.\n\n|cffffff00*|r Yellow Unit settings will create clones for each matching unit while this trigger is providing Dynamic Info to the Aura."] Private.threat_unit_types = { target = L["Target"], @@ -897,22 +917,22 @@ Private.threat_unit_types = { nameplate = L["Nameplate"], boss = L["Boss"], member = L["Specific Unit"], - none = L["At Least One Enemy"] + none = L["At Least One Enemy"], } Private.unit_types_range_check = { target = L["Target"], focus = L["Focus"], pet = L["Pet"], - member = L["Specific Unit"] + member = L["Specific Unit"], } Private.unit_threat_situation_types = { [-1] = L["Not On Threat Table"], - [0] = "|cFFB0B0B0"..L["Lower Than Tank"].."|r", - [1] = "|cFFFFFF77"..L["Higher Than Tank"].."|r", - [2] = "|cFFFF9900"..L["Tanking But Not Highest"].."|r", - [3] = "|cFFFF0000"..L["Tanking And Highest"].."|r" + [0] = "|cFFB0B0B0" .. L["Lower Than Tank"] .. "|r", + [1] = "|cFFFFFF77" .. L["Higher Than Tank"] .. "|r", + [2] = "|cFFFF9900" .. L["Tanking But Not Highest"] .. "|r", + [3] = "|cFFFF0000" .. L["Tanking And Highest"] .. "|r", } WeakAuras.class_types = {} @@ -923,7 +943,6 @@ for classID = 1, 20 do -- 20 is for GetNumClasses() but that function doesn't ex end end - WeakAuras.race_types = {} do local unplayableRace = { @@ -938,7 +957,7 @@ do [20] = true, [21] = true, [23] = true, - [33] = true + [33] = true, } if WeakAuras.IsClassicOrBCCOrWrath() then unplayableRace[9] = true @@ -966,53 +985,53 @@ end Private.faction_group = { Alliance = L["Alliance"], Horde = L["Horde"], - Neutral = L["Neutral"] + Neutral = L["Neutral"], } -Private.form_types = {}; +Private.form_types = {} local function update_forms() - wipe(Private.form_types); - Private.form_types[0] = "0 - "..L["Humanoid"] + wipe(Private.form_types) + Private.form_types[0] = "0 - " .. L["Humanoid"] for i = 1, GetNumShapeshiftForms() do - local _, _, _, id = GetShapeshiftFormInfo(i); - if(id) then - local name = GetSpellInfo(id); - if(name) then - Private.form_types[i] = i.." - "..name + local _, _, _, id = GetShapeshiftFormInfo(i) + if id then + local name = GetSpellInfo(id) + if name then + Private.form_types[i] = i .. " - " .. name end end end end -local form_frame = CreateFrame("Frame"); +local form_frame = CreateFrame("Frame") form_frame:RegisterEvent("UPDATE_SHAPESHIFT_FORMS") form_frame:RegisterEvent("PLAYER_LOGIN") -form_frame:SetScript("OnEvent", update_forms); +form_frame:SetScript("OnEvent", update_forms) Private.blend_types = { ADD = L["Glow"], - BLEND = L["Opaque"] + BLEND = L["Opaque"], } Private.texture_wrap_types = { CLAMP = L["Clamp"], MIRROR = L["Mirror"], REPEAT = L["Repeat"], - CLAMPTOBLACKADDITIVE = L["No Extend"] + CLAMPTOBLACKADDITIVE = L["No Extend"], } Private.slant_mode = { INSIDE = L["Keep Inside"], - EXTEND = L["Extend Outside"] + EXTEND = L["Extend Outside"], } Private.text_check_types = { update = L["Every Frame"], - event = L["Trigger Update"] + event = L["Trigger Update"], } Private.check_types = { update = L["Every Frame (High CPU usage)"], - event = L["Event(s)"] + event = L["Event(s)"], } Private.point_types = { @@ -1024,20 +1043,20 @@ Private.point_types = { TOP = L["Top"], TOPLEFT = L["Top Left"], LEFT = L["Left"], - CENTER = L["Center"] + CENTER = L["Center"], } Private.default_types_for_anchor = {} for k, v in pairs(Private.point_types) do Private.default_types_for_anchor[k] = { display = v, - type = "point" + type = "point", } end Private.default_types_for_anchor["ALL"] = { display = L["Whole Area"], - type = "area" + type = "area", } Private.aurabar_anchor_areas = { @@ -1056,7 +1075,7 @@ Private.inverse_point_types = { TOP = "BOTTOM", TOPLEFT = "BOTTOMRIGHT", LEFT = "RIGHT", - CENTER = "CENTER" + CENTER = "CENTER", } Private.anchor_frame_types = { @@ -1066,7 +1085,7 @@ Private.anchor_frame_types = { SELECTFRAME = L["Select Frame"], NAMEPLATE = L["Nameplates"], UNITFRAME = L["Unit Frames"], - CUSTOM = L["Custom"] + CUSTOM = L["Custom"], } Private.anchor_frame_types_group = { @@ -1074,50 +1093,50 @@ Private.anchor_frame_types_group = { PRD = L["Personal Resource Display"], MOUSE = L["Mouse Cursor"], SELECTFRAME = L["Select Frame"], - CUSTOM = L["Custom"] + CUSTOM = L["Custom"], } Private.spark_rotation_types = { AUTO = L["Automatic Rotation"], - MANUAL = L["Manual Rotation"] + MANUAL = L["Manual Rotation"], } Private.spark_hide_types = { NEVER = L["Never"], - FULL = L["Full"], + FULL = L["Full"], EMPTY = L["Empty"], - BOTH = L["Full/Empty"] + BOTH = L["Full/Empty"], } Private.tick_placement_modes = { AtValue = L["At Value"], AtMissingValue = L["At missing Value"], AtPercent = L["At Percent"], - ValueOffset = L["Offset from progress"] + ValueOffset = L["Offset from progress"], } Private.font_flags = { None = L["None"], MONOCHROME = L["Monochrome"], OUTLINE = L["Outline"], - THICKOUTLINE = L["Thick Outline"], + THICKOUTLINE = L["Thick Outline"], ["MONOCHROME|OUTLINE"] = L["Monochrome Outline"], - ["MONOCHROME|THICKOUTLINE"] = L["Monochrome Thick Outline"] + ["MONOCHROME|THICKOUTLINE"] = L["Monochrome Thick Outline"], } Private.text_automatic_width = { Auto = L["Automatic"], - Fixed = L["Fixed"] + Fixed = L["Fixed"], } Private.text_word_wrap = { WordWrap = L["Wrap"], - Elide = L["Elide"] + Elide = L["Elide"], } Private.include_pets_types = { PlayersAndPets = L["Players and Pets"], - PetsOnly = L["Pets only"] + PetsOnly = L["Pets only"], } Private.subevent_prefix_types = { @@ -1135,7 +1154,7 @@ Private.subevent_prefix_types = { UNIT_DESTROYED = L["Unit Destroyed"], UNIT_DISSIPATES = L["Unit Dissipates"], ENCHANT_APPLIED = L["Enchant Applied"], - ENCHANT_REMOVED = L["Enchant Removed"] + ENCHANT_REMOVED = L["Enchant Removed"], } Private.subevent_actual_prefix_types = { @@ -1144,7 +1163,7 @@ Private.subevent_actual_prefix_types = { SPELL = L["Spell"], SPELL_PERIODIC = L["Periodic Spell"], SPELL_BUILDING = L["Spell (Building)"], - ENVIRONMENTAL = L["Environmental"] + ENVIRONMENTAL = L["Environmental"], } Private.subevent_suffix_types = { @@ -1176,7 +1195,7 @@ Private.subevent_suffix_types = { _DURABILITY_DAMAGE_ALL = L["Durability Damage All"], _CREATE = L["Create"], _SUMMON = L["Summon"], - _RESURRECT = L["Resurrect"] + _RESURRECT = L["Resurrect"], } Private.power_types = { @@ -1194,7 +1213,7 @@ Private.power_types = { [13] = POWER_TYPE_INSANITY, [16] = POWER_TYPE_ARCANE_CHARGES, [17] = POWER_TYPE_FURY_DEMONHUNTER, - [18] = POWER_TYPE_PAIN + [18] = POWER_TYPE_PAIN, } Private.power_types_with_stagger = { @@ -1213,7 +1232,7 @@ Private.power_types_with_stagger = { [16] = POWER_TYPE_ARCANE_CHARGES, [17] = POWER_TYPE_FURY_DEMONHUNTER, [18] = POWER_TYPE_PAIN, - [99] = STAGGER + [99] = STAGGER, } Private.miss_types = { @@ -1226,7 +1245,7 @@ Private.miss_types = { MISS = L["Miss"], PARRY = L["Parry"], REFLECT = L["Reflect"], - RESIST = L["Resist"] + RESIST = L["Resist"], } Private.environmental_types = { @@ -1235,20 +1254,20 @@ Private.environmental_types = { Fatigue = STRING_ENVIRONMENTAL_DAMAGE_FATIGUE, Fire = STRING_ENVIRONMENTAL_DAMAGE_FIRE, Lava = STRING_ENVIRONMENTAL_DAMAGE_LAVA, - Slime = STRING_ENVIRONMENTAL_DAMAGE_SLIME + Slime = STRING_ENVIRONMENTAL_DAMAGE_SLIME, } Private.combatlog_flags_check_type = { Mine = L["Mine"], InGroup = L["In Group"], InParty = L["In Party"], - NotInGroup = L["Not in Smart Group"] + NotInGroup = L["Not in Smart Group"], } Private.combatlog_flags_check_reaction = { Hostile = L["Hostile"], Neutral = L["Neutral"], - Friendly = L["Friendly"] + Friendly = L["Friendly"], } Private.combatlog_flags_check_object_type = { @@ -1256,7 +1275,7 @@ Private.combatlog_flags_check_object_type = { Guardian = L["Guardian"], Pet = L["Pet"], NPC = L["NPC"], - Player = L["Player"] + Player = L["Player"], } Private.combatlog_spell_school_types = { @@ -1311,7 +1330,7 @@ Private.combatlog_raid_mark_check_type = { "|TInterface\\TARGETINGFRAME\\UI-RaidTargetingIcon_6:14|t " .. RAID_TARGET_6, -- Square "|TInterface\\TARGETINGFRAME\\UI-RaidTargetingIcon_7:14|t " .. RAID_TARGET_7, -- Cross "|TInterface\\TARGETINGFRAME\\UI-RaidTargetingIcon_8:14|t " .. RAID_TARGET_8, -- Skull - L["Any"] + L["Any"], } Private.combatlog_raidFlags = { @@ -1333,7 +1352,7 @@ Private.orientation_types = { HORIZONTAL_INVERSE = L["Left to Right"], HORIZONTAL = L["Right to Left"], VERTICAL = L["Bottom to Top"], - VERTICAL_INVERSE = L["Top to Bottom"] + VERTICAL_INVERSE = L["Top to Bottom"], } Private.orientation_with_circle_types = { @@ -1342,25 +1361,25 @@ Private.orientation_with_circle_types = { VERTICAL = L["Bottom to Top"], VERTICAL_INVERSE = L["Top to Bottom"], CLOCKWISE = L["Clockwise"], - ANTICLOCKWISE = L["Anticlockwise"] + ANTICLOCKWISE = L["Anticlockwise"], } Private.spec_types = { - [1] = SPECIALIZATION.." 1", - [2] = SPECIALIZATION.." 2", - [3] = SPECIALIZATION.." 3", - [4] = SPECIALIZATION.." 4" + [1] = SPECIALIZATION .. " 1", + [2] = SPECIALIZATION .. " 2", + [3] = SPECIALIZATION .. " 3", + [4] = SPECIALIZATION .. " 4", } Private.spec_types_3 = { - [1] = SPECIALIZATION.." 1", - [2] = SPECIALIZATION.." 2", - [3] = SPECIALIZATION.." 3" + [1] = SPECIALIZATION .. " 1", + [2] = SPECIALIZATION .. " 2", + [3] = SPECIALIZATION .. " 3", } Private.spec_types_2 = { - [1] = SPECIALIZATION.." 1", - [2] = SPECIALIZATION.." 2" + [1] = SPECIALIZATION .. " 1", + [2] = SPECIALIZATION .. " 2", } WeakAuras.spec_types_specific = {} @@ -1370,31 +1389,39 @@ local function update_specs() WeakAuras.spec_types_specific[classFileName] = {} local classTexcoords = CLASS_ICON_TCOORDS[classFileName] local numSpecs = GetNumSpecializationsForClassID(classID) - for i=1, numSpecs do - local specId, tabName, _, icon = GetSpecializationInfoForClassID(classID, i); + for i = 1, numSpecs do + local specId, tabName, _, icon = GetSpecializationInfoForClassID(classID, i) if tabName then - tinsert(WeakAuras.spec_types_specific[classFileName], "|T"..(icon or "error")..":0|t "..(tabName or "error")); + tinsert(WeakAuras.spec_types_specific[classFileName], "|T" .. (icon or "error") .. ":0|t " .. (tabName or "error")) Private.spec_types_all[specId] = "|TInterface\\GLUES\\CHARACTERCREATE\\UI-CHARACTERCREATE-CLASSES:0:0:0:0:256:256:" - .. classTexcoords[1] * 256 .. ":" .. classTexcoords[2] * 256 .. ":" .. classTexcoords[3] * 256 .. ":" .. classTexcoords[4] * 256 - .. ":0|t" - .. "|T"..(icon or "error")..":0|t "..(tabName or "error"); + .. classTexcoords[1] * 256 + .. ":" + .. classTexcoords[2] * 256 + .. ":" + .. classTexcoords[3] * 256 + .. ":" + .. classTexcoords[4] * 256 + .. ":0|t" + .. "|T" + .. (icon or "error") + .. ":0|t " + .. (tabName or "error") end end end end - Private.talent_types = {} if WeakAuras.IsRetail() then - local spec_frame = CreateFrame("Frame"); + local spec_frame = CreateFrame("Frame") spec_frame:RegisterEvent("PLAYER_LOGIN") - spec_frame:SetScript("OnEvent", update_specs); + spec_frame:SetScript("OnEvent", update_specs) local numTalents, numTiers, numColumns = MAX_TALENT_TIERS * NUM_TALENT_COLUMNS, MAX_TALENT_TIERS, NUM_TALENT_COLUMNS local talentId, tier, column = 1, 1, 1 while talentId <= numTalents do while tier <= numTiers do while column <= numColumns do - Private.talent_types[talentId] = L["Tier "]..tier.." - "..column + Private.talent_types[talentId] = L["Tier "] .. tier .. " - " .. column column = column + 1 talentId = talentId + 1 end @@ -1407,30 +1434,30 @@ else for tab = 1, GetNumTalentTabs() do for num_talent = 1, GetNumTalents(tab) do local talentId = (tab - 1) * MAX_NUM_TALENTS + num_talent - Private.talent_types[talentId] = L["Tab "]..tab.." - "..num_talent + Private.talent_types[talentId] = L["Tab "] .. tab .. " - " .. num_talent end end end Private.pvp_talent_types = {} if WeakAuras.IsRetail() then - for i = 1,10 do - tinsert(Private.pvp_talent_types, string.format(L["PvP Talent %i"], i)); + for i = 1, 10 do + tinsert(Private.pvp_talent_types, string.format(L["PvP Talent %i"], i)) end end Private.talent_extra_option_types = { - [0] = L["Talent Known"], - [1] = L["Talent Selected"], - [2] = L["Talent |cFFFF0000Not|r Known"], - [3] = L["Talent |cFFFF0000Not|r Selected"], + [0] = L["Talent Known"], + [1] = L["Talent Selected"], + [2] = L["Talent |cFFFF0000Not|r Known"], + [3] = L["Talent |cFFFF0000Not|r Selected"], } -- GetTotemInfo() only works for the first 5 totems -Private.totem_types = {}; -local totemString = L["Totem #%i"]; +Private.totem_types = {} +local totemString = L["Totem #%i"] for i = 1, 5 do - Private.totem_types[i] = totemString:format(i); + Private.totem_types[i] = totemString:format(i) end Private.loss_of_control_types = { @@ -1462,86 +1489,86 @@ Private.main_spell_schools = { Private.texture_types = { ["Blizzard Alerts"] = { - ["1027131"] = "Arcane Missiles 1", - ["1027132"] = "Arcane Missiles 2", - ["1027133"] = "Arcane Missiles 3", - ["450913"] = "Art of War", - ["801266"] = "Backlash_Green", - ["460830"] = "Backslash", - ["1030393"] = "Bandits Guile", - ["510822"] = "Berserk", - ["511104"] = "Blood Boil", - ["449487"] = "Blood Surge", - ["449488"] = "Brain Freeze", - ["603338"] = "Dark Tiger", - ["461878"] = "Dark Transformation", - ["459313"] = "Daybreak", - ["511469"] = "Denounce", + ["1027131"] = "Arcane Missiles 1", + ["1027132"] = "Arcane Missiles 2", + ["1027133"] = "Arcane Missiles 3", + ["450913"] = "Art of War", + ["801266"] = "Backlash_Green", + ["460830"] = "Backslash", + ["1030393"] = "Bandits Guile", + ["510822"] = "Berserk", + ["511104"] = "Blood Boil", + ["449487"] = "Blood Surge", + ["449488"] = "Brain Freeze", + ["603338"] = "Dark Tiger", + ["461878"] = "Dark Transformation", + ["459313"] = "Daybreak", + ["511469"] = "Denounce", ["2851787"] = "Demonic Core", ["2888300"] = "Demonic Core Vertical", - ["1057288"] = "Echo of the Elements", - ["450914"] = "Eclipse Moon", - ["450915"] = "Eclipse Sun", - ["450916"] = "Focus Fire", - ["449489"] = "Frozen Fingers", - ["467696"] = "Fulmination", - ["460831"] = "Fury of Stormrage", - ["450917"] = "Generic Arc 1", - ["450918"] = "Generic Arc 2", - ["450919"] = "Generic Arc 3", - ["450920"] = "Generic Arc 4", - ["450921"] = "Generic Arc 5", - ["450922"] = "Generic Arc 6", - ["450923"] = "Generic Top 1", - ["450924"] = "Generic Top 2", - ["450925"] = "Grand Crusader", - ["459314"] = "Hand of Light", + ["1057288"] = "Echo of the Elements", + ["450914"] = "Eclipse Moon", + ["450915"] = "Eclipse Sun", + ["450916"] = "Focus Fire", + ["449489"] = "Frozen Fingers", + ["467696"] = "Fulmination", + ["460831"] = "Fury of Stormrage", + ["450917"] = "Generic Arc 1", + ["450918"] = "Generic Arc 2", + ["450919"] = "Generic Arc 3", + ["450920"] = "Generic Arc 4", + ["450921"] = "Generic Arc 5", + ["450922"] = "Generic Arc 6", + ["450923"] = "Generic Top 1", + ["450924"] = "Generic Top 2", + ["450925"] = "Grand Crusader", + ["459314"] = "Hand of Light", ["2851788"] = "High Tide", - ["449490"] = "Hot Streak", - ["801267"] = "Imp Empowerment Green", - ["449491"] = "Imp Empowerment", - ["457658"] = "Impact", - ["458740"] = "Killing Machine", - ["450926"] = "Lock and Load", - ["1028136"] = "Maelstrom Weapon 1", - ["1028137"] = "Maelstrom Weapon 2", - ["1028138"] = "Maelstrom Weapon 3", - ["1028139"] = "Maelstrom Weapon 4", - ["450927"] = "Maelstrom Weapon", - ["450928"] = "Master Marksman", - ["801268"] = "Molten Core Green", - ["458741"] = "Molten Core", - ["1001511"] = "Monk Blackout Kick", - ["1028091"] = "Monk Ox 2", - ["1028092"] = "Monk Ox 3", - ["623950"] = "Monk Ox", - ["623951"] = "Monk Serpent", - ["1001512"] = "Monk Tiger Palm", - ["623952"] = "Monk Tiger", - ["450929"] = "Nature's Grace", - ["511105"] = "Necropolis", - ["449492"] = "Nightfall", - ["510823"] = "Omen of Clarity (Feral)", - ["898423"] = "Predatory Swiftness", - ["962497"] = "Raging Blow", - ["450930"] = "Rime", - ["469752"] = "Serendipity", - ["656728"] = "Shadow Word Insanity", - ["627609"] = "Shadow of Death", - ["463452"] = "Shooting Stars", - ["450931"] = "Slice and Dice", - ["424570"] = "Spell Activation Overlay 0", - ["449493"] = "Sudden Death", - ["450932"] = "Sudden Doom", - ["592058"] = "Surge of Darkness", - ["450933"] = "Surge of Light", - ["449494"] = "Sword and Board", - ["1029138"] = "Thrill of the Hunt 1", - ["1029139"] = "Thrill of the Hunt 2", - ["1029140"] = "Thrill of the Hunt 3", - ["774420"] = "Tooth and Claw", - ["627610"] = "Ultimatum", - ["603339"] = "White Tiger", + ["449490"] = "Hot Streak", + ["801267"] = "Imp Empowerment Green", + ["449491"] = "Imp Empowerment", + ["457658"] = "Impact", + ["458740"] = "Killing Machine", + ["450926"] = "Lock and Load", + ["1028136"] = "Maelstrom Weapon 1", + ["1028137"] = "Maelstrom Weapon 2", + ["1028138"] = "Maelstrom Weapon 3", + ["1028139"] = "Maelstrom Weapon 4", + ["450927"] = "Maelstrom Weapon", + ["450928"] = "Master Marksman", + ["801268"] = "Molten Core Green", + ["458741"] = "Molten Core", + ["1001511"] = "Monk Blackout Kick", + ["1028091"] = "Monk Ox 2", + ["1028092"] = "Monk Ox 3", + ["623950"] = "Monk Ox", + ["623951"] = "Monk Serpent", + ["1001512"] = "Monk Tiger Palm", + ["623952"] = "Monk Tiger", + ["450929"] = "Nature's Grace", + ["511105"] = "Necropolis", + ["449492"] = "Nightfall", + ["510823"] = "Omen of Clarity (Feral)", + ["898423"] = "Predatory Swiftness", + ["962497"] = "Raging Blow", + ["450930"] = "Rime", + ["469752"] = "Serendipity", + ["656728"] = "Shadow Word Insanity", + ["627609"] = "Shadow of Death", + ["463452"] = "Shooting Stars", + ["450931"] = "Slice and Dice", + ["424570"] = "Spell Activation Overlay 0", + ["449493"] = "Sudden Death", + ["450932"] = "Sudden Doom", + ["592058"] = "Surge of Darkness", + ["450933"] = "Surge of Light", + ["449494"] = "Sword and Board", + ["1029138"] = "Thrill of the Hunt 1", + ["1029139"] = "Thrill of the Hunt 2", + ["1029140"] = "Thrill of the Hunt 3", + ["774420"] = "Tooth and Claw", + ["627610"] = "Ultimatum", + ["603339"] = "White Tiger", }, ["Icons"] = { ["166662"] = "Shield", @@ -1579,7 +1606,6 @@ Private.texture_types = { ["Interface\\AddOns\\WeakAuras\\Media\\Textures\\eyes.tga"] = "Eyes", ["Interface\\AddOns\\WeakAuras\\Media\\Textures\\ok-icon.tga"] = "Ok Icon", ["Interface\\AddOns\\WeakAuras\\Media\\Textures\\targeting-mark.tga"] = "Targeting Mark", - }, ["Runes"] = { ["165630"] = "Ringed Aura Rune", @@ -1716,7 +1742,7 @@ Private.texture_types = { ["Interface\\PVPFrame\\Icons\\PVP-Banner-Emblem-98"] = "Lollipop", ["Interface\\PVPFrame\\Icons\\PVP-Banner-Emblem-99"] = "5-Toed Pawprint", ["Interface\\PVPFrame\\Icons\\PVP-Banner-Emblem-100"] = "Frightened Cat", - ["Interface\\PVPFrame\\Icons\\PVP-Banner-Emblem-101"] = "Eagle Face" + ["Interface\\PVPFrame\\Icons\\PVP-Banner-Emblem-101"] = "Eagle Face", }, ["Beams"] = { ["186198"] = "Lightning", @@ -1797,9 +1823,9 @@ Private.texture_types = { ["Insanity-Spark"] = "Blizzard Insanity Spark", ["XPBarAnim-OrangeSpark"] = "Blizzard XPBar Spark", ["GarrMission_EncounterBar-Spark"] = "Blizzard Garrison Mission Encounter Spark", - ["Legionfall_BarSpark"]= "Blizzard Legionfall Spark", + ["Legionfall_BarSpark"] = "Blizzard Legionfall Spark", ["honorsystem-bar-spark"] = "Blizzard Honor System Spark", - ["bonusobjectives-bar-spark"] = "Bonus Objectives Spark" + ["bonusobjectives-bar-spark"] = "Bonus Objectives Spark", }, [BINDING_HEADER_RAID_TARGET] = { ["Interface\\TargetingFrame\\UI-RaidTargetingIcon_1"] = RAID_TARGET_1, @@ -1813,8 +1839,8 @@ Private.texture_types = { }, ["WeakAuras"] = { ["Interface\\AddOns\\WeakAuras\\Media\\Textures\\logo_64.tga"] = "WeakAuras logo 64px", - ["Interface\\AddOns\\WeakAuras\\Media\\Textures\\logo_256.tga"] = "WeakAuras logo 256px" - } + ["Interface\\AddOns\\WeakAuras\\Media\\Textures\\logo_256.tga"] = "WeakAuras logo 256px", + }, } local BuildInfo = select(4, GetBuildInfo()) if BuildInfo <= 80100 then -- 8.1.5 @@ -1825,21 +1851,21 @@ if WeakAuras.IsClassic() then -- Classic Private.texture_types["Blizzard Alerts"] = nil do local beams = Private.texture_types["Beams"] - local beams_ids = {167096, 167097, 167098, 167099, 167100, 167101, 167102, 167103, 167104, 167105, 186192, 186193, 186194, 241098, 241099, 369749, 369750} + local beams_ids = { 167096, 167097, 167098, 167099, 167100, 167101, 167102, 167103, 167104, 167105, 186192, 186193, 186194, 241098, 241099, 369749, 369750 } for _, v in ipairs(beams_ids) do beams[tostring(v)] = nil end end do local icons = Private.texture_types["Icons"] - local icons_ids = {165605, 166036, 166680, 166948, 166989, 240925, 240961, 240972, 241049} + local icons_ids = { 165605, 166036, 166680, 166948, 166989, 240925, 240961, 240972, 241049 } for _, v in ipairs(icons_ids) do icons[tostring(v)] = nil end end do local runes = Private.texture_types["Runes"] - local runes_ids = {165633, 165885, 165922, 166340, 166753, 166754, 241003, 241004, 241005} + local runes_ids = { 165633, 165885, 165922, 166340, 166753, 166754, 241003, 241004, 241005 } for _, v in ipairs(runes_ids) do runes[tostring(v)] = nil end @@ -1848,21 +1874,21 @@ elseif WeakAuras.IsBCCOrWrath() then Private.texture_types["Blizzard Alerts"] = nil do local beams = Private.texture_types["Beams"] - local beams_ids = {186193, 186194, 241098, 241099, 369749, 369750} + local beams_ids = { 186193, 186194, 241098, 241099, 369749, 369750 } for _, v in ipairs(beams_ids) do beams[tostring(v)] = nil end end do local icons = Private.texture_types["Icons"] - local icons_ids = {165605, 240925, 240961, 240972, 241049} + local icons_ids = { 165605, 240925, 240961, 240972, 241049 } for _, v in ipairs(icons_ids) do icons[tostring(v)] = nil end end do local runes = Private.texture_types["Runes"] - local runes_ids = {165922, 241003, 241004, 241005} + local runes_ids = { 165922, 241003, 241004, 241005 } for _, v in ipairs(runes_ids) do runes[tostring(v)] = nil end @@ -1871,160 +1897,160 @@ end local PowerAurasPath = "Interface\\Addons\\WeakAuras\\PowerAurasMedia\\Auras\\" Private.texture_types["PowerAuras Heads-Up"] = { - [PowerAurasPath.."Aura1"] = "Runed Text", - [PowerAurasPath.."Aura2"] = "Runed Text On Ring", - [PowerAurasPath.."Aura3"] = "Power Waves", - [PowerAurasPath.."Aura4"] = "Majesty", - [PowerAurasPath.."Aura5"] = "Runed Ends", - [PowerAurasPath.."Aura6"] = "Extra Majesty", - [PowerAurasPath.."Aura7"] = "Triangular Highlights", - [PowerAurasPath.."Aura11"] = "Oblong Highlights", - [PowerAurasPath.."Aura16"] = "Thin Crescents", - [PowerAurasPath.."Aura17"] = "Crescent Highlights", - [PowerAurasPath.."Aura18"] = "Dense Runed Text", - [PowerAurasPath.."Aura23"] = "Runed Spiked Ring", - [PowerAurasPath.."Aura24"] = "Smoke", - [PowerAurasPath.."Aura28"] = "Flourished Text", - [PowerAurasPath.."Aura33"] = "Droplet Highlights" + [PowerAurasPath .. "Aura1"] = "Runed Text", + [PowerAurasPath .. "Aura2"] = "Runed Text On Ring", + [PowerAurasPath .. "Aura3"] = "Power Waves", + [PowerAurasPath .. "Aura4"] = "Majesty", + [PowerAurasPath .. "Aura5"] = "Runed Ends", + [PowerAurasPath .. "Aura6"] = "Extra Majesty", + [PowerAurasPath .. "Aura7"] = "Triangular Highlights", + [PowerAurasPath .. "Aura11"] = "Oblong Highlights", + [PowerAurasPath .. "Aura16"] = "Thin Crescents", + [PowerAurasPath .. "Aura17"] = "Crescent Highlights", + [PowerAurasPath .. "Aura18"] = "Dense Runed Text", + [PowerAurasPath .. "Aura23"] = "Runed Spiked Ring", + [PowerAurasPath .. "Aura24"] = "Smoke", + [PowerAurasPath .. "Aura28"] = "Flourished Text", + [PowerAurasPath .. "Aura33"] = "Droplet Highlights", } Private.texture_types["PowerAuras Icons"] = { - [PowerAurasPath.."Aura8"] = "Rune", - [PowerAurasPath.."Aura9"] = "Stylized Ghost", - [PowerAurasPath.."Aura10"] = "Skull and Crossbones", - [PowerAurasPath.."Aura12"] = "Snowflake", - [PowerAurasPath.."Aura13"] = "Flame", - [PowerAurasPath.."Aura14"] = "Holy Rune", - [PowerAurasPath.."Aura15"] = "Zig-Zag Exclamation Point", - [PowerAurasPath.."Aura19"] = "Crossed Swords", - [PowerAurasPath.."Aura21"] = "Shield", - [PowerAurasPath.."Aura22"] = "Glow", - [PowerAurasPath.."Aura25"] = "Cross", - [PowerAurasPath.."Aura26"] = "Droplet", - [PowerAurasPath.."Aura27"] = "Alert", - [PowerAurasPath.."Aura29"] = "Paw", - [PowerAurasPath.."Aura30"] = "Bull", + [PowerAurasPath .. "Aura8"] = "Rune", + [PowerAurasPath .. "Aura9"] = "Stylized Ghost", + [PowerAurasPath .. "Aura10"] = "Skull and Crossbones", + [PowerAurasPath .. "Aura12"] = "Snowflake", + [PowerAurasPath .. "Aura13"] = "Flame", + [PowerAurasPath .. "Aura14"] = "Holy Rune", + [PowerAurasPath .. "Aura15"] = "Zig-Zag Exclamation Point", + [PowerAurasPath .. "Aura19"] = "Crossed Swords", + [PowerAurasPath .. "Aura21"] = "Shield", + [PowerAurasPath .. "Aura22"] = "Glow", + [PowerAurasPath .. "Aura25"] = "Cross", + [PowerAurasPath .. "Aura26"] = "Droplet", + [PowerAurasPath .. "Aura27"] = "Alert", + [PowerAurasPath .. "Aura29"] = "Paw", + [PowerAurasPath .. "Aura30"] = "Bull", -- [PowerAurasPath.."Aura31"] = "Hieroglyphics Horizontal", - [PowerAurasPath.."Aura32"] = "Hieroglyphics", - [PowerAurasPath.."Aura34"] = "Circled Arrow", - [PowerAurasPath.."Aura35"] = "Short Sword", + [PowerAurasPath .. "Aura32"] = "Hieroglyphics", + [PowerAurasPath .. "Aura34"] = "Circled Arrow", + [PowerAurasPath .. "Aura35"] = "Short Sword", -- [PowerAurasPath.."Aura36"] = "Short Sword Horizontal", - [PowerAurasPath.."Aura45"] = "Circular Glow", - [PowerAurasPath.."Aura48"] = "Totem", - [PowerAurasPath.."Aura49"] = "Dragon Blade", - [PowerAurasPath.."Aura50"] = "Ornate Design", - [PowerAurasPath.."Aura51"] = "Inverted Holy Rune", - [PowerAurasPath.."Aura52"] = "Stylized Skull", - [PowerAurasPath.."Aura53"] = "Exclamation Point", - [PowerAurasPath.."Aura54"] = "Nonagon", - [PowerAurasPath.."Aura68"] = "Wings", - [PowerAurasPath.."Aura69"] = "Rectangle", - [PowerAurasPath.."Aura70"] = "Low Mana", - [PowerAurasPath.."Aura71"] = "Ghostly Eye", - [PowerAurasPath.."Aura72"] = "Circle", - [PowerAurasPath.."Aura73"] = "Ring", - [PowerAurasPath.."Aura74"] = "Square", - [PowerAurasPath.."Aura75"] = "Square Brackets", - [PowerAurasPath.."Aura76"] = "Bob-omb", - [PowerAurasPath.."Aura77"] = "Goldfish", - [PowerAurasPath.."Aura78"] = "Check", - [PowerAurasPath.."Aura79"] = "Ghostly Face", - [PowerAurasPath.."Aura84"] = "Overlapping Boxes", + [PowerAurasPath .. "Aura45"] = "Circular Glow", + [PowerAurasPath .. "Aura48"] = "Totem", + [PowerAurasPath .. "Aura49"] = "Dragon Blade", + [PowerAurasPath .. "Aura50"] = "Ornate Design", + [PowerAurasPath .. "Aura51"] = "Inverted Holy Rune", + [PowerAurasPath .. "Aura52"] = "Stylized Skull", + [PowerAurasPath .. "Aura53"] = "Exclamation Point", + [PowerAurasPath .. "Aura54"] = "Nonagon", + [PowerAurasPath .. "Aura68"] = "Wings", + [PowerAurasPath .. "Aura69"] = "Rectangle", + [PowerAurasPath .. "Aura70"] = "Low Mana", + [PowerAurasPath .. "Aura71"] = "Ghostly Eye", + [PowerAurasPath .. "Aura72"] = "Circle", + [PowerAurasPath .. "Aura73"] = "Ring", + [PowerAurasPath .. "Aura74"] = "Square", + [PowerAurasPath .. "Aura75"] = "Square Brackets", + [PowerAurasPath .. "Aura76"] = "Bob-omb", + [PowerAurasPath .. "Aura77"] = "Goldfish", + [PowerAurasPath .. "Aura78"] = "Check", + [PowerAurasPath .. "Aura79"] = "Ghostly Face", + [PowerAurasPath .. "Aura84"] = "Overlapping Boxes", -- [PowerAurasPath.."Aura85"] = "Overlapping Boxes 45°", -- [PowerAurasPath.."Aura86"] = "Overlapping Boxes 270°", - [PowerAurasPath.."Aura87"] = "Fairy", - [PowerAurasPath.."Aura88"] = "Comet", - [PowerAurasPath.."Aura95"] = "Dual Spiral", - [PowerAurasPath.."Aura96"] = "Japanese Character", - [PowerAurasPath.."Aura97"] = "Japanese Character", - [PowerAurasPath.."Aura98"] = "Japanese Character", - [PowerAurasPath.."Aura99"] = "Japanese Character", - [PowerAurasPath.."Aura100"] = "Japanese Character", - [PowerAurasPath.."Aura101"] = "Ball of Flame", - [PowerAurasPath.."Aura102"] = "Zig-Zag", - [PowerAurasPath.."Aura103"] = "Thorny Ring", - [PowerAurasPath.."Aura110"] = "Hunter's Mark", + [PowerAurasPath .. "Aura87"] = "Fairy", + [PowerAurasPath .. "Aura88"] = "Comet", + [PowerAurasPath .. "Aura95"] = "Dual Spiral", + [PowerAurasPath .. "Aura96"] = "Japanese Character", + [PowerAurasPath .. "Aura97"] = "Japanese Character", + [PowerAurasPath .. "Aura98"] = "Japanese Character", + [PowerAurasPath .. "Aura99"] = "Japanese Character", + [PowerAurasPath .. "Aura100"] = "Japanese Character", + [PowerAurasPath .. "Aura101"] = "Ball of Flame", + [PowerAurasPath .. "Aura102"] = "Zig-Zag", + [PowerAurasPath .. "Aura103"] = "Thorny Ring", + [PowerAurasPath .. "Aura110"] = "Hunter's Mark", -- [PowerAurasPath.."Aura111"] = "Hunter's Mark Horizontal", - [PowerAurasPath.."Aura112"] = "Kaleidoscope", - [PowerAurasPath.."Aura113"] = "Jesus Face", - [PowerAurasPath.."Aura114"] = "Green Mushroom", - [PowerAurasPath.."Aura115"] = "Red Mushroom", - [PowerAurasPath.."Aura116"] = "Fire Flower", - [PowerAurasPath.."Aura117"] = "Radioactive", - [PowerAurasPath.."Aura118"] = "X", - [PowerAurasPath.."Aura119"] = "Flower", - [PowerAurasPath.."Aura120"] = "Petal", - [PowerAurasPath.."Aura130"] = "Shoop Da Woop", - [PowerAurasPath.."Aura131"] = "8-Bit Symbol", - [PowerAurasPath.."Aura132"] = "Cartoon Skull", - [PowerAurasPath.."Aura138"] = "Stop", - [PowerAurasPath.."Aura139"] = "Thumbs Up", - [PowerAurasPath.."Aura140"] = "Palette", - [PowerAurasPath.."Aura141"] = "Blue Ring", - [PowerAurasPath.."Aura142"] = "Ornate Ring", - [PowerAurasPath.."Aura143"] = "Ghostly Skull" + [PowerAurasPath .. "Aura112"] = "Kaleidoscope", + [PowerAurasPath .. "Aura113"] = "Jesus Face", + [PowerAurasPath .. "Aura114"] = "Green Mushroom", + [PowerAurasPath .. "Aura115"] = "Red Mushroom", + [PowerAurasPath .. "Aura116"] = "Fire Flower", + [PowerAurasPath .. "Aura117"] = "Radioactive", + [PowerAurasPath .. "Aura118"] = "X", + [PowerAurasPath .. "Aura119"] = "Flower", + [PowerAurasPath .. "Aura120"] = "Petal", + [PowerAurasPath .. "Aura130"] = "Shoop Da Woop", + [PowerAurasPath .. "Aura131"] = "8-Bit Symbol", + [PowerAurasPath .. "Aura132"] = "Cartoon Skull", + [PowerAurasPath .. "Aura138"] = "Stop", + [PowerAurasPath .. "Aura139"] = "Thumbs Up", + [PowerAurasPath .. "Aura140"] = "Palette", + [PowerAurasPath .. "Aura141"] = "Blue Ring", + [PowerAurasPath .. "Aura142"] = "Ornate Ring", + [PowerAurasPath .. "Aura143"] = "Ghostly Skull", } Private.texture_types["PowerAuras Separated"] = { - [PowerAurasPath.."Aura46"] = "8-Part Ring 1", - [PowerAurasPath.."Aura47"] = "8-Part Ring 2", - [PowerAurasPath.."Aura55"] = "Skull on Gear 1", - [PowerAurasPath.."Aura56"] = "Skull on Gear 2", - [PowerAurasPath.."Aura57"] = "Skull on Gear 3", - [PowerAurasPath.."Aura58"] = "Skull on Gear 4", - [PowerAurasPath.."Aura59"] = "Rune Ring Full", - [PowerAurasPath.."Aura60"] = "Rune Ring Empty", - [PowerAurasPath.."Aura61"] = "Rune Ring Left", - [PowerAurasPath.."Aura62"] = "Rune Ring Right", - [PowerAurasPath.."Aura63"] = "Spiked Rune Ring Full", - [PowerAurasPath.."Aura64"] = "Spiked Rune Ring Empty", - [PowerAurasPath.."Aura65"] = "Spiked Rune Ring Left", - [PowerAurasPath.."Aura66"] = "Spiked Rune Ring Bottom", - [PowerAurasPath.."Aura67"] = "Spiked Rune Ring Right", - [PowerAurasPath.."Aura80"] = "Spiked Helm Background", - [PowerAurasPath.."Aura81"] = "Spiked Helm Full", - [PowerAurasPath.."Aura82"] = "Spiked Helm Bottom", - [PowerAurasPath.."Aura83"] = "Spiked Helm Top", - [PowerAurasPath.."Aura89"] = "5-Part Ring 1", - [PowerAurasPath.."Aura90"] = "5-Part Ring 2", - [PowerAurasPath.."Aura91"] = "5-Part Ring 3", - [PowerAurasPath.."Aura92"] = "5-Part Ring 4", - [PowerAurasPath.."Aura93"] = "5-Part Ring 5", - [PowerAurasPath.."Aura94"] = "5-Part Ring Full", - [PowerAurasPath.."Aura104"] = "Shield Center", - [PowerAurasPath.."Aura105"] = "Shield Full", - [PowerAurasPath.."Aura106"] = "Shield Top Right", - [PowerAurasPath.."Aura107"] = "Shield Top Left", - [PowerAurasPath.."Aura108"] = "Shield Bottom Right", - [PowerAurasPath.."Aura109"] = "Shield Bottom Left", - [PowerAurasPath.."Aura121"] = "Vine Top Right Leaf", - [PowerAurasPath.."Aura122"] = "Vine Left Leaf", - [PowerAurasPath.."Aura123"] = "Vine Bottom Right Leaf", - [PowerAurasPath.."Aura124"] = "Vine Stem", - [PowerAurasPath.."Aura125"] = "Vine Thorns", - [PowerAurasPath.."Aura126"] = "3-Part Circle 1", - [PowerAurasPath.."Aura127"] = "3-Part Circle 2", - [PowerAurasPath.."Aura128"] = "3-Part Circle 3", - [PowerAurasPath.."Aura129"] = "3-Part Circle Full", - [PowerAurasPath.."Aura133"] = "Sliced Orb 1", - [PowerAurasPath.."Aura134"] = "Sliced Orb 2", - [PowerAurasPath.."Aura135"] = "Sliced Orb 3", - [PowerAurasPath.."Aura136"] = "Sliced Orb 4", - [PowerAurasPath.."Aura137"] = "Sliced Orb 5", - [PowerAurasPath.."Aura144"] = "Taijitu Bottom", - [PowerAurasPath.."Aura145"] = "Taijitu Top" + [PowerAurasPath .. "Aura46"] = "8-Part Ring 1", + [PowerAurasPath .. "Aura47"] = "8-Part Ring 2", + [PowerAurasPath .. "Aura55"] = "Skull on Gear 1", + [PowerAurasPath .. "Aura56"] = "Skull on Gear 2", + [PowerAurasPath .. "Aura57"] = "Skull on Gear 3", + [PowerAurasPath .. "Aura58"] = "Skull on Gear 4", + [PowerAurasPath .. "Aura59"] = "Rune Ring Full", + [PowerAurasPath .. "Aura60"] = "Rune Ring Empty", + [PowerAurasPath .. "Aura61"] = "Rune Ring Left", + [PowerAurasPath .. "Aura62"] = "Rune Ring Right", + [PowerAurasPath .. "Aura63"] = "Spiked Rune Ring Full", + [PowerAurasPath .. "Aura64"] = "Spiked Rune Ring Empty", + [PowerAurasPath .. "Aura65"] = "Spiked Rune Ring Left", + [PowerAurasPath .. "Aura66"] = "Spiked Rune Ring Bottom", + [PowerAurasPath .. "Aura67"] = "Spiked Rune Ring Right", + [PowerAurasPath .. "Aura80"] = "Spiked Helm Background", + [PowerAurasPath .. "Aura81"] = "Spiked Helm Full", + [PowerAurasPath .. "Aura82"] = "Spiked Helm Bottom", + [PowerAurasPath .. "Aura83"] = "Spiked Helm Top", + [PowerAurasPath .. "Aura89"] = "5-Part Ring 1", + [PowerAurasPath .. "Aura90"] = "5-Part Ring 2", + [PowerAurasPath .. "Aura91"] = "5-Part Ring 3", + [PowerAurasPath .. "Aura92"] = "5-Part Ring 4", + [PowerAurasPath .. "Aura93"] = "5-Part Ring 5", + [PowerAurasPath .. "Aura94"] = "5-Part Ring Full", + [PowerAurasPath .. "Aura104"] = "Shield Center", + [PowerAurasPath .. "Aura105"] = "Shield Full", + [PowerAurasPath .. "Aura106"] = "Shield Top Right", + [PowerAurasPath .. "Aura107"] = "Shield Top Left", + [PowerAurasPath .. "Aura108"] = "Shield Bottom Right", + [PowerAurasPath .. "Aura109"] = "Shield Bottom Left", + [PowerAurasPath .. "Aura121"] = "Vine Top Right Leaf", + [PowerAurasPath .. "Aura122"] = "Vine Left Leaf", + [PowerAurasPath .. "Aura123"] = "Vine Bottom Right Leaf", + [PowerAurasPath .. "Aura124"] = "Vine Stem", + [PowerAurasPath .. "Aura125"] = "Vine Thorns", + [PowerAurasPath .. "Aura126"] = "3-Part Circle 1", + [PowerAurasPath .. "Aura127"] = "3-Part Circle 2", + [PowerAurasPath .. "Aura128"] = "3-Part Circle 3", + [PowerAurasPath .. "Aura129"] = "3-Part Circle Full", + [PowerAurasPath .. "Aura133"] = "Sliced Orb 1", + [PowerAurasPath .. "Aura134"] = "Sliced Orb 2", + [PowerAurasPath .. "Aura135"] = "Sliced Orb 3", + [PowerAurasPath .. "Aura136"] = "Sliced Orb 4", + [PowerAurasPath .. "Aura137"] = "Sliced Orb 5", + [PowerAurasPath .. "Aura144"] = "Taijitu Bottom", + [PowerAurasPath .. "Aura145"] = "Taijitu Top", } Private.texture_types["PowerAuras Words"] = { - [PowerAurasPath.."Aura20"] = "Power", - [PowerAurasPath.."Aura37"] = "Slow", - [PowerAurasPath.."Aura38"] = "Stun", - [PowerAurasPath.."Aura39"] = "Silence", - [PowerAurasPath.."Aura40"] = "Root", - [PowerAurasPath.."Aura41"] = "Disorient", - [PowerAurasPath.."Aura42"] = "Dispel", - [PowerAurasPath.."Aura43"] = "Danger", - [PowerAurasPath.."Aura44"] = "Buff", - [PowerAurasPath.."Aura44"] = "Buff", - ["Interface\\AddOns\\WeakAuras\\Media\\Textures\\interrupt"] = "Interrupt" + [PowerAurasPath .. "Aura20"] = "Power", + [PowerAurasPath .. "Aura37"] = "Slow", + [PowerAurasPath .. "Aura38"] = "Stun", + [PowerAurasPath .. "Aura39"] = "Silence", + [PowerAurasPath .. "Aura40"] = "Root", + [PowerAurasPath .. "Aura41"] = "Disorient", + [PowerAurasPath .. "Aura42"] = "Dispel", + [PowerAurasPath .. "Aura43"] = "Danger", + [PowerAurasPath .. "Aura44"] = "Buff", + [PowerAurasPath .. "Aura44"] = "Buff", + ["Interface\\AddOns\\WeakAuras\\Media\\Textures\\interrupt"] = "Interrupt", } Private.operator_types = { @@ -2033,33 +2059,33 @@ Private.operator_types = { [">"] = ">", ["<"] = "<", [">="] = ">=", - ["<="] = "<=" + ["<="] = "<=", } Private.equality_operator_types = { ["=="] = "=", - ["~="] = "!=" + ["~="] = "!=", } Private.operator_types_without_equal = { [">="] = ">=", - ["<="] = "<=" + ["<="] = "<=", } Private.string_operator_types = { ["=="] = L["Is Exactly"], ["find('%s')"] = L["Contains"], - ["match('%s')"] = L["Matches (Pattern)"] + ["match('%s')"] = L["Matches (Pattern)"], } Private.weapon_types = { ["main"] = MAINHANDSLOT, - ["off"] = SECONDARYHANDSLOT + ["off"] = SECONDARYHANDSLOT, } Private.swing_types = { ["main"] = MAINHANDSLOT, - ["off"] = SECONDARYHANDSLOT + ["off"] = SECONDARYHANDSLOT, } if WeakAuras.IsClassicOrBCCOrWrath() then @@ -2082,19 +2108,19 @@ else [3] = L["Rune #3"], [4] = L["Rune #4"], [5] = L["Rune #5"], - [6] = L["Rune #6"] + [6] = L["Rune #6"], } end Private.custom_trigger_types = { ["event"] = L["Event"], ["status"] = L["Status"], - ["stateupdate"] = L["Trigger State Updater (Advanced)"] + ["stateupdate"] = L["Trigger State Updater (Advanced)"], } Private.eventend_types = { ["timed"] = L["Timed"], - ["custom"] = L["Custom"] + ["custom"] = L["Custom"], } Private.timedeventend_types = { @@ -2104,7 +2130,7 @@ Private.timedeventend_types = { Private.justify_types = { ["LEFT"] = L["Left"], ["CENTER"] = L["Center"], - ["RIGHT"] = L["Right"] + ["RIGHT"] = L["Right"], } Private.grow_types = { @@ -2136,58 +2162,60 @@ Private.grid_types = { Private.text_rotate_types = { ["LEFT"] = L["Left"], ["NONE"] = L["None"], - ["RIGHT"] = L["Right"] + ["RIGHT"] = L["Right"], } Private.align_types = { ["LEFT"] = L["Left"], ["CENTER"] = L["Center"], - ["RIGHT"] = L["Right"] + ["RIGHT"] = L["Right"], } Private.rotated_align_types = { ["LEFT"] = L["Top"], ["CENTER"] = L["Center"], - ["RIGHT"] = L["Bottom"] + ["RIGHT"] = L["Bottom"], } Private.icon_side_types = { ["LEFT"] = L["Left"], - ["RIGHT"] = L["Right"] + ["RIGHT"] = L["Right"], } Private.rotated_icon_side_types = { ["LEFT"] = L["Top"], - ["RIGHT"] = L["Bottom"] + ["RIGHT"] = L["Bottom"], } Private.anim_types = { none = L["None"], preset = L["Preset"], - custom = L["Custom"] + custom = L["Custom"], } Private.anim_ease_types = { none = L["None"], easeIn = L["Ease In"], easeOut = L["Ease Out"], - easeOutIn = L["Ease In and Out"] + easeOutIn = L["Ease In and Out"], } Private.anim_ease_functions = { - none = function(percent) return percent end, + none = function(percent) + return percent + end, easeIn = function(percent, power) - return percent ^ power; + return percent ^ power end, easeOut = function(percent, power) - return 1.0 - (1.0 - percent) ^ power; + return 1.0 - (1.0 - percent) ^ power end, easeOutIn = function(percent, power) - if percent < .5 then - return (percent * 2.0) ^ power * .5; + if percent < 0.5 then + return (percent * 2.0) ^ power * 0.5 end - return 1.0 - ((1.0 - percent) * 2.0) ^ power * .5; - end + return 1.0 - ((1.0 - percent) * 2.0) ^ power * 0.5 + end, } Private.anim_translate_types = { @@ -2198,7 +2226,7 @@ Private.anim_translate_types = { shake = L["Shake"], bounce = L["Bounce"], bounceDecay = L["Bounce with Decay"], - custom = L["Custom Function"] + custom = L["Custom Function"], } Private.anim_scale_types = { @@ -2206,21 +2234,21 @@ Private.anim_scale_types = { pulse = L["Pulse"], fauxspin = L["Spin"], fauxflip = L["Flip"], - custom = L["Custom Function"] + custom = L["Custom Function"], } Private.anim_alpha_types = { straight = L["Normal"], alphaPulse = L["Pulse"], hide = L["Hide"], - custom = L["Custom Function"] + custom = L["Custom Function"], } Private.anim_rotate_types = { straight = L["Normal"], backandforth = L["Back and Forth"], wobble = L["Wobble"], - custom = L["Custom Function"] + custom = L["Custom Function"], } Private.anim_color_types = { @@ -2228,7 +2256,7 @@ Private.anim_color_types = { straightHSV = L["Gradient"], pulseColor = L["Legacy RGB Gradient Pulse"], pulseHSV = L["Gradient Pulse"], - custom = L["Custom Function"] + custom = L["Custom Function"], } Private.instance_types = { @@ -2243,7 +2271,7 @@ Private.instance_types = { pvp = L["Battleground"], arena = L["Arena"], ratedpvp = L["Rated Battleground"], - ratedarena = L["Rated Arena"] + ratedarena = L["Rated Arena"], } if WeakAuras.IsClassic() then @@ -2252,9 +2280,7 @@ if WeakAuras.IsClassic() then Private.instance_types["ratedarena"] = nil end -Private.instance_difficulty_types = { - -} +Private.instance_difficulty_types = {} do -- Fill out instance_difficulty_types automatically. @@ -2332,22 +2358,22 @@ do end Private.TocToExpansion = { - [1] = L["Classic"], - [2] = L["Burning Crusade"], - [3] = L["Wrath of the Lich King"], - [4] = L["Cataclysm"], - [5] = L["Mists of Pandaria"], - [6] = L["Warlords of Draenor"], - [7] = L["Legion"], - [8] = L["Battle for Azeroth"], - [9] = L["Shadowlands"], - [10] = L["Dragonflight"] + [1] = L["Classic"], + [2] = L["Burning Crusade"], + [3] = L["Wrath of the Lich King"], + [4] = L["Cataclysm"], + [5] = L["Mists of Pandaria"], + [6] = L["Warlords of Draenor"], + [7] = L["Legion"], + [8] = L["Battle for Azeroth"], + [9] = L["Shadowlands"], + [10] = L["Dragonflight"], } Private.group_types = { solo = L["Not in Group"], group = L["In Party"], - raid = L["In Raid"] + raid = L["In Raid"], } if WeakAuras.IsRetail() then @@ -2358,7 +2384,7 @@ if WeakAuras.IsRetail() then mythic = PLAYER_DIFFICULTY6, timewalking = PLAYER_DIFFICULTY_TIMEWALKER, lfr = PLAYER_DIFFICULTY3, - challenge = PLAYER_DIFFICULTY5 + challenge = PLAYER_DIFFICULTY5, } elseif WeakAuras.IsBCCOrWrath() then Private.difficulty_types = { @@ -2368,19 +2394,18 @@ elseif WeakAuras.IsBCCOrWrath() then } end - if WeakAuras.IsClassicOrBCCOrWrath() then Private.raid_role_types = { - MAINTANK = "|TInterface\\GroupFrame\\UI-Group-maintankIcon:16:16|t "..MAINTANK, - MAINASSIST = "|TInterface\\GroupFrame\\UI-Group-mainassistIcon:16:16|t "..MAINASSIST, - NONE = L["Other"] + MAINTANK = "|TInterface\\GroupFrame\\UI-Group-maintankIcon:16:16|t " .. MAINTANK, + MAINASSIST = "|TInterface\\GroupFrame\\UI-Group-mainassistIcon:16:16|t " .. MAINASSIST, + NONE = L["Other"], } end if WeakAuras.IsWrathOrRetail() then Private.role_types = { - TANK = INLINE_TANK_ICON.." "..TANK, - DAMAGER = INLINE_DAMAGER_ICON.." "..DAMAGER, - HEALER = INLINE_HEALER_ICON.." "..HEALER + TANK = INLINE_TANK_ICON .. " " .. TANK, + DAMAGER = INLINE_DAMAGER_ICON .. " " .. DAMAGER, + HEALER = INLINE_HEALER_ICON .. " " .. HEALER, } end @@ -2391,7 +2416,7 @@ Private.classification_types = { rare = L["Rare"], normal = L["Normal"], trivial = L["Trivial (Low Level)"], - minus = L["Minus (Small Nameplate)"] + minus = L["Minus (Small Nameplate)"], } Private.anim_start_preset_types = { @@ -2418,7 +2443,7 @@ Private.anim_main_preset_types = { rotateCounterClockwise = L["Rotate Left"], spiralandpulse = L["Spiral"], orbit = L["Orbit"], - bounce = L["Bounce"] + bounce = L["Bounce"], } Private.anim_finish_preset_types = { @@ -2428,11 +2453,11 @@ Private.anim_finish_preset_types = { slidebottom = L["Slide to Bottom"], fade = L["Fade Out"], shrink = L["Shrink"], - grow =L["Grow"], + grow = L["Grow"], spiral = L["Spiral"], bounceDecay = L["Bounce"], starShakeDecay = L["Star Shake"], -}; +} Private.chat_message_types = { CHAT_MSG_INSTANCE_CHAT = L["Instance"], @@ -2457,7 +2482,7 @@ Private.chat_message_types = { CHAT_MSG_SAY = L["Say"], CHAT_MSG_WHISPER = L["Whisper"], CHAT_MSG_YELL = L["Yell"], - CHAT_MSG_SYSTEM = L["System"] + CHAT_MSG_SYSTEM = L["System"], } Private.send_chat_message_types = { @@ -2474,10 +2499,9 @@ Private.send_chat_message_types = { INSTANCE_CHAT = L["Instance"], COMBAT = L["Blizzard Combat Text"], PRINT = L["Chat Frame"], - ERROR = L["Error Frame"] + ERROR = L["Error Frame"], } - Private.send_chat_message_types.TTS = L["Text-to-speech"] Private.tts_voices = {} for i, voiceInfo in pairs(C_VoiceChat.GetTtsVoices()) do @@ -2487,17 +2511,17 @@ end Private.group_aura_name_info_types = { aura = L["Aura Name"], players = L["Player(s) Affected"], - nonplayers = L["Player(s) Not Affected"] + nonplayers = L["Player(s) Not Affected"], } Private.group_aura_stack_info_types = { count = L["Number Affected"], - stack = L["Aura Stack"] + stack = L["Aura Stack"], } Private.cast_types = { cast = L["Cast"], - channel = L["Channel (Spell)"] + channel = L["Channel (Spell)"], } -- register sounds @@ -2570,53 +2594,52 @@ LSM:Register("sound", "Voice: Taunt", "Interface\\AddOns\\WeakAuras\\Media\\Soun LSM:Register("sound", "Voice: Triangle", "Interface\\AddOns\\WeakAuras\\Media\\Sounds\\Triangle.ogg") local PowerAurasSoundPath = "Interface\\Addons\\WeakAuras\\PowerAurasMedia\\Sounds\\" -LSM:Register("sound", "Aggro", PowerAurasSoundPath.."aggro.ogg") -LSM:Register("sound", "Arrow Swoosh", PowerAurasSoundPath.."Arrow_swoosh.ogg") -LSM:Register("sound", "Bam", PowerAurasSoundPath.."bam.ogg") -LSM:Register("sound", "Polar Bear", PowerAurasSoundPath.."bear_polar.ogg") -LSM:Register("sound", "Big Kiss", PowerAurasSoundPath.."bigkiss.ogg") -LSM:Register("sound", "Bite", PowerAurasSoundPath.."BITE.ogg") -LSM:Register("sound", "Burp", PowerAurasSoundPath.."burp4.ogg") -LSM:Register("sound", "Cat", PowerAurasSoundPath.."cat2.ogg") -LSM:Register("sound", "Chant Major 2nd", PowerAurasSoundPath.."chant2.ogg") -LSM:Register("sound", "Chant Minor 3rd", PowerAurasSoundPath.."chant4.ogg") -LSM:Register("sound", "Chimes", PowerAurasSoundPath.."chimes.ogg") -LSM:Register("sound", "Cookie Monster", PowerAurasSoundPath.."cookie.ogg") -LSM:Register("sound", "Electrical Spark", PowerAurasSoundPath.."ESPARK1.ogg") -LSM:Register("sound", "Fireball", PowerAurasSoundPath.."Fireball.ogg") -LSM:Register("sound", "Gasp", PowerAurasSoundPath.."Gasp.ogg") -LSM:Register("sound", "Heartbeat", PowerAurasSoundPath.."heartbeat.ogg") -LSM:Register("sound", "Hiccup", PowerAurasSoundPath.."hic3.ogg") -LSM:Register("sound", "Huh?", PowerAurasSoundPath.."huh_1.ogg") -LSM:Register("sound", "Hurricane", PowerAurasSoundPath.."hurricane.ogg") -LSM:Register("sound", "Hyena", PowerAurasSoundPath.."hyena.ogg") -LSM:Register("sound", "Kaching", PowerAurasSoundPath.."kaching.ogg") -LSM:Register("sound", "Moan", PowerAurasSoundPath.."moan.ogg") -LSM:Register("sound", "Panther", PowerAurasSoundPath.."panther1.ogg") -LSM:Register("sound", "Phone", PowerAurasSoundPath.."phone.ogg") -LSM:Register("sound", "Punch", PowerAurasSoundPath.."PUNCH.ogg") -LSM:Register("sound", "Rain", PowerAurasSoundPath.."rainroof.ogg") -LSM:Register("sound", "Rocket", PowerAurasSoundPath.."rocket.ogg") -LSM:Register("sound", "Ship's Whistle", PowerAurasSoundPath.."shipswhistle.ogg") -LSM:Register("sound", "Gunshot", PowerAurasSoundPath.."shot.ogg") -LSM:Register("sound", "Snake Attack", PowerAurasSoundPath.."snakeatt.ogg") -LSM:Register("sound", "Sneeze", PowerAurasSoundPath.."sneeze.ogg") -LSM:Register("sound", "Sonar", PowerAurasSoundPath.."sonar.ogg") -LSM:Register("sound", "Splash", PowerAurasSoundPath.."splash.ogg") -LSM:Register("sound", "Squeaky Toy", PowerAurasSoundPath.."Squeakypig.ogg") -LSM:Register("sound", "Sword Ring", PowerAurasSoundPath.."swordecho.ogg") -LSM:Register("sound", "Throwing Knife", PowerAurasSoundPath.."throwknife.ogg") -LSM:Register("sound", "Thunder", PowerAurasSoundPath.."thunder.ogg") -LSM:Register("sound", "Wicked Male Laugh", PowerAurasSoundPath.."wickedmalelaugh1.ogg") -LSM:Register("sound", "Wilhelm Scream", PowerAurasSoundPath.."wilhelm.ogg") -LSM:Register("sound", "Wicked Female Laugh", PowerAurasSoundPath.."wlaugh.ogg") -LSM:Register("sound", "Wolf Howl", PowerAurasSoundPath.."wolf5.ogg") -LSM:Register("sound", "Yeehaw", PowerAurasSoundPath.."yeehaw.ogg") - +LSM:Register("sound", "Aggro", PowerAurasSoundPath .. "aggro.ogg") +LSM:Register("sound", "Arrow Swoosh", PowerAurasSoundPath .. "Arrow_swoosh.ogg") +LSM:Register("sound", "Bam", PowerAurasSoundPath .. "bam.ogg") +LSM:Register("sound", "Polar Bear", PowerAurasSoundPath .. "bear_polar.ogg") +LSM:Register("sound", "Big Kiss", PowerAurasSoundPath .. "bigkiss.ogg") +LSM:Register("sound", "Bite", PowerAurasSoundPath .. "BITE.ogg") +LSM:Register("sound", "Burp", PowerAurasSoundPath .. "burp4.ogg") +LSM:Register("sound", "Cat", PowerAurasSoundPath .. "cat2.ogg") +LSM:Register("sound", "Chant Major 2nd", PowerAurasSoundPath .. "chant2.ogg") +LSM:Register("sound", "Chant Minor 3rd", PowerAurasSoundPath .. "chant4.ogg") +LSM:Register("sound", "Chimes", PowerAurasSoundPath .. "chimes.ogg") +LSM:Register("sound", "Cookie Monster", PowerAurasSoundPath .. "cookie.ogg") +LSM:Register("sound", "Electrical Spark", PowerAurasSoundPath .. "ESPARK1.ogg") +LSM:Register("sound", "Fireball", PowerAurasSoundPath .. "Fireball.ogg") +LSM:Register("sound", "Gasp", PowerAurasSoundPath .. "Gasp.ogg") +LSM:Register("sound", "Heartbeat", PowerAurasSoundPath .. "heartbeat.ogg") +LSM:Register("sound", "Hiccup", PowerAurasSoundPath .. "hic3.ogg") +LSM:Register("sound", "Huh?", PowerAurasSoundPath .. "huh_1.ogg") +LSM:Register("sound", "Hurricane", PowerAurasSoundPath .. "hurricane.ogg") +LSM:Register("sound", "Hyena", PowerAurasSoundPath .. "hyena.ogg") +LSM:Register("sound", "Kaching", PowerAurasSoundPath .. "kaching.ogg") +LSM:Register("sound", "Moan", PowerAurasSoundPath .. "moan.ogg") +LSM:Register("sound", "Panther", PowerAurasSoundPath .. "panther1.ogg") +LSM:Register("sound", "Phone", PowerAurasSoundPath .. "phone.ogg") +LSM:Register("sound", "Punch", PowerAurasSoundPath .. "PUNCH.ogg") +LSM:Register("sound", "Rain", PowerAurasSoundPath .. "rainroof.ogg") +LSM:Register("sound", "Rocket", PowerAurasSoundPath .. "rocket.ogg") +LSM:Register("sound", "Ship's Whistle", PowerAurasSoundPath .. "shipswhistle.ogg") +LSM:Register("sound", "Gunshot", PowerAurasSoundPath .. "shot.ogg") +LSM:Register("sound", "Snake Attack", PowerAurasSoundPath .. "snakeatt.ogg") +LSM:Register("sound", "Sneeze", PowerAurasSoundPath .. "sneeze.ogg") +LSM:Register("sound", "Sonar", PowerAurasSoundPath .. "sonar.ogg") +LSM:Register("sound", "Splash", PowerAurasSoundPath .. "splash.ogg") +LSM:Register("sound", "Squeaky Toy", PowerAurasSoundPath .. "Squeakypig.ogg") +LSM:Register("sound", "Sword Ring", PowerAurasSoundPath .. "swordecho.ogg") +LSM:Register("sound", "Throwing Knife", PowerAurasSoundPath .. "throwknife.ogg") +LSM:Register("sound", "Thunder", PowerAurasSoundPath .. "thunder.ogg") +LSM:Register("sound", "Wicked Male Laugh", PowerAurasSoundPath .. "wickedmalelaugh1.ogg") +LSM:Register("sound", "Wilhelm Scream", PowerAurasSoundPath .. "wilhelm.ogg") +LSM:Register("sound", "Wicked Female Laugh", PowerAurasSoundPath .. "wlaugh.ogg") +LSM:Register("sound", "Wolf Howl", PowerAurasSoundPath .. "wolf5.ogg") +LSM:Register("sound", "Yeehaw", PowerAurasSoundPath .. "yeehaw.ogg") Private.sound_types = { [" custom"] = " " .. L["Custom"], - [" KitID"] = " " .. L["Sound by Kit ID"] + [" KitID"] = " " .. L["Sound by Kit ID"], } for name, path in next, LSM:HashTable("sound") do @@ -2647,24 +2670,24 @@ LSM:Register("border", "Drop Shadow", [[Interface\AddOns\WeakAuras\Media\Texture Private.duration_types = { seconds = L["Seconds"], - relative = L["Relative"] + relative = L["Relative"], } Private.duration_types_no_choice = { - seconds = L["Seconds"] + seconds = L["Seconds"], } Private.gtfo_types = { [1] = L["High Damage"], [2] = L["Low Damage"], [3] = L["Fail Alert"], - [4] = L["Friendly Fire"] + [4] = L["Friendly Fire"], } Private.pet_behavior_types = { passive = PET_MODE_PASSIVE, defensive = PET_MODE_DEFENSIVE, - assist = PET_MODE_ASSIST + assist = PET_MODE_ASSIST, } if WeakAuras.IsClassic() then @@ -2676,7 +2699,7 @@ if WeakAuras.IsRetail() then Private.pet_spec_types = { [1] = select(2, GetSpecializationInfoByID(74)), -- Ferocity [2] = select(2, GetSpecializationInfoByID(81)), -- Tenacity - [3] = select(2, GetSpecializationInfoByID(79)) -- Cunning + [3] = select(2, GetSpecializationInfoByID(79)), -- Cunning } else Private.pet_spec_types = {} @@ -2685,48 +2708,48 @@ end Private.cooldown_progress_behavior_types = { showOnCooldown = L["On Cooldown"], showOnReady = L["Not on Cooldown"], - showAlways = L["Always"] + showAlways = L["Always"], } Private.cooldown_types = { auto = L["Auto"], charges = L["Charges"], - cooldown = L["Cooldown"] + cooldown = L["Cooldown"], } Private.bufftrigger_progress_behavior_types = { showOnActive = L["Buffed/Debuffed"], showOnMissing = L["Missing"], - showAlways= L["Always"] + showAlways = L["Always"], } Private.bufftrigger_2_progress_behavior_types = { showOnActive = L["Aura(s) Found"], showOnMissing = L["Aura(s) Missing"], showAlways = L["Always"], - showOnMatches = L["Match Count"] + showOnMatches = L["Match Count"], } Private.bufftrigger_2_preferred_match_types = { showLowest = L["Least remaining time"], - showHighest = L["Most remaining time"] + showHighest = L["Most remaining time"], } Private.bufftrigger_2_per_unit_mode = { affected = L["Affected"], unaffected = L["Unaffected"], - all = L["All"] + all = L["All"], } Private.item_slot_types = { - [1] = HEADSLOT, - [2] = NECKSLOT, - [3] = SHOULDERSLOT, - [5] = CHESTSLOT, - [6] = WAISTSLOT, - [7] = LEGSSLOT, - [8] = FEETSLOT, - [9] = WRISTSLOT, + [1] = HEADSLOT, + [2] = NECKSLOT, + [3] = SHOULDERSLOT, + [5] = CHESTSLOT, + [6] = WAISTSLOT, + [7] = LEGSSLOT, + [8] = FEETSLOT, + [9] = WRISTSLOT, [10] = HANDSSLOT, [11] = FINGER0SLOT_UNIQUE, [12] = FINGER1SLOT_UNIQUE, @@ -2735,40 +2758,40 @@ Private.item_slot_types = { [15] = BACKSLOT, [16] = MAINHANDSLOT, [17] = SECONDARYHANDSLOT, - [19] = TABARDSLOT + [19] = TABARDSLOT, } Private.charges_change_type = { GAINED = L["Gained"], LOST = L["Lost"], - CHANGED = L["Changed"] + CHANGED = L["Changed"], } Private.charges_change_condition_type = { GAINED = L["Gained"], - LOST = L["Lost"] + LOST = L["Lost"], } Private.combat_event_type = { PLAYER_REGEN_ENABLED = L["Leaving"], - PLAYER_REGEN_DISABLED = L["Entering"] + PLAYER_REGEN_DISABLED = L["Entering"], } Private.bool_types = { [0] = L["False"], - [1] = L["True"] + [1] = L["True"], } Private.absorb_modes = { OVERLAY_FROM_START = L["Attach to Start"], - OVERLAY_FROM_END = L["Attach to End"] + OVERLAY_FROM_END = L["Attach to End"], } Private.mythic_plus_affixes = {} local mythic_plus_ignorelist = { [1] = true, - [15] = true + [15] = true, } if WeakAuras.IsRetail() then @@ -2802,13 +2825,13 @@ Private.update_categories = { }, { name = "userconfig", - fields = {"config"}, + fields = { "config" }, default = false, label = L["Custom Configuration"], }, { name = "name", - fields = {"id"}, + fields = { "id" }, default = true, label = L["Aura Names"], }, @@ -2820,39 +2843,39 @@ Private.update_categories = { }, { name = "trigger", - fields = {"triggers"}, + fields = { "triggers" }, default = true, label = L["Trigger"], }, { name = "conditions", - fields = {"conditions"}, + fields = { "conditions" }, default = true, label = L["Conditions"], }, { name = "load", - fields = {"load"}, + fields = { "load" }, default = true, label = L["Load Conditions"], }, { name = "action", - fields = {"actions"}, + fields = { "actions" }, default = true, label = L["Actions"], }, { name = "animation", - fields = {"animation"}, + fields = { "animation" }, default = true, label = L["Animations"], }, { name = "authoroptions", - fields = {"authorOptions"}, + fields = { "authorOptions" }, default = true, - label = L["Author Options"] + label = L["Author Options"], }, { name = "arrangement", @@ -2876,14 +2899,14 @@ Private.update_categories = { fields = {}, default = true, label = L["Remove Obsolete Auras"], - skipInSummary = true + skipInSummary = true, }, { name = "newchildren", fields = {}, default = true, label = L["Add Missing Auras"], - skipInSummary = true + skipInSummary = true, }, { name = "metadata", @@ -2906,7 +2929,7 @@ Private.internal_fields = { tocversion = true, parent = true, controlledChildren = true, - source = true + source = true, } -- fields that are not included in exported data @@ -3003,7 +3026,7 @@ Private.author_option_classes = { description = "noninteractive", space = "noninteractive", header = "noninteractive", - group = "group" + group = "group", } Private.author_option_types = { @@ -3032,13 +3055,13 @@ Private.author_option_fields = { number = { min = 0, max = 1, - step = .05, + step = 0.05, default = 0, }, range = { min = 0, max = 1, - step = .05, + step = 0.05, default = 0, }, input = { @@ -3055,10 +3078,10 @@ Private.author_option_fields = { fontSize = "medium", }, color = { - default = {1, 1, 1, 1}, + default = { 1, 1, 1, 1 }, }, select = { - values = {"val1"}, + values = { "val1" }, default = 1, }, space = { @@ -3067,13 +3090,13 @@ Private.author_option_fields = { height = 1, }, multiselect = { - default = {true}, - values = {"val1"}, + default = { true }, + values = { "val1" }, }, header = { useName = false, text = "", - noMerge = false + noMerge = false, }, group = { groupType = "simple", @@ -3086,7 +3109,7 @@ Private.author_option_fields = { entryNames = nil, -- handled as a special case in code subOptions = {}, noMerge = false, - } + }, } Private.array_entry_name_types = { @@ -3206,7 +3229,7 @@ Private.difficulty_info = { [176] = { size = "twentyfive", difficulty = "heroic", - } + }, } Private.glow_types = { @@ -3227,7 +3250,7 @@ Private.baseUnitId = { ["target"] = true, ["pet"] = true, ["focus"] = true, - ["vehicle"] = true + ["vehicle"] = true, } Private.multiUnitId = { @@ -3249,7 +3272,7 @@ Private.multiUnitUnits = { ["arena"] = {}, ["group"] = {}, ["party"] = {}, - ["raid"] = {} + ["raid"] = {}, } Private.multiUnitUnits.group["player"] = true @@ -3259,37 +3282,37 @@ Private.multiUnitUnits.group["pet"] = true Private.multiUnitUnits.party["pet"] = true for i = 1, 4 do - Private.baseUnitId["party"..i] = true - Private.baseUnitId["partypet"..i] = true - Private.multiUnitUnits.group["party"..i] = true - Private.multiUnitUnits.party["party"..i] = true - Private.multiUnitUnits.group["partypet"..i] = true - Private.multiUnitUnits.party["partypet"..i] = true + Private.baseUnitId["party" .. i] = true + Private.baseUnitId["partypet" .. i] = true + Private.multiUnitUnits.group["party" .. i] = true + Private.multiUnitUnits.party["party" .. i] = true + Private.multiUnitUnits.group["partypet" .. i] = true + Private.multiUnitUnits.party["partypet" .. i] = true end if WeakAuras.IsRetail() then for i = 1, 10 do - Private.baseUnitId["boss"..i] = true - Private.multiUnitUnits.boss["boss"..i] = true + Private.baseUnitId["boss" .. i] = true + Private.multiUnitUnits.boss["boss" .. i] = true end end if WeakAuras.IsBCCOrWrathOrRetail() then for i = 1, 5 do - Private.baseUnitId["arena"..i] = true - Private.multiUnitUnits.arena["arena"..i] = true + Private.baseUnitId["arena" .. i] = true + Private.multiUnitUnits.arena["arena" .. i] = true end end for i = 1, 40 do - Private.baseUnitId["raid"..i] = true - Private.baseUnitId["raidpet"..i] = true - Private.baseUnitId["nameplate"..i] = true - Private.multiUnitUnits.nameplate["nameplate"..i] = true - Private.multiUnitUnits.group["raid"..i] = true - Private.multiUnitUnits.raid["raid"..i] = true - Private.multiUnitUnits.group["raidpet"..i] = true - Private.multiUnitUnits.raid["raidpet"..i] = true + Private.baseUnitId["raid" .. i] = true + Private.baseUnitId["raidpet" .. i] = true + Private.baseUnitId["nameplate" .. i] = true + Private.multiUnitUnits.nameplate["nameplate" .. i] = true + Private.multiUnitUnits.group["raid" .. i] = true + Private.multiUnitUnits.raid["raid" .. i] = true + Private.multiUnitUnits.group["raidpet" .. i] = true + Private.multiUnitUnits.raid["raidpet" .. i] = true end Private.dbm_types = { @@ -3299,7 +3322,7 @@ Private.dbm_types = { [4] = L["Interrupt"], [5] = L["Role"], [6] = L["Phase"], - [7] = L["Important"] + [7] = L["Important"], } Private.weapon_enchant_types = { @@ -3309,19 +3332,19 @@ Private.weapon_enchant_types = { } WeakAuras.EJIcons = { - tank = "|TInterface\\EncounterJournal\\UI-EJ-Icons:::::256:64:7:25:7:25|t", - dps = "|TInterface\\EncounterJournal\\UI-EJ-Icons:::::256:64:39:57:7:25|t", - healer = "|TInterface\\EncounterJournal\\UI-EJ-Icons:::::256:64:71:89:7:25|t", - mythic = "|TInterface\\EncounterJournal\\UI-EJ-Icons:::::256:64:103:121:7:25|t", - deadly = "|TInterface\\EncounterJournal\\UI-EJ-Icons:::::256:64:135:153:7:25|t", + tank = "|TInterface\\EncounterJournal\\UI-EJ-Icons:::::256:64:7:25:7:25|t", + dps = "|TInterface\\EncounterJournal\\UI-EJ-Icons:::::256:64:39:57:7:25|t", + healer = "|TInterface\\EncounterJournal\\UI-EJ-Icons:::::256:64:71:89:7:25|t", + mythic = "|TInterface\\EncounterJournal\\UI-EJ-Icons:::::256:64:103:121:7:25|t", + deadly = "|TInterface\\EncounterJournal\\UI-EJ-Icons:::::256:64:135:153:7:25|t", important = "|TInterface\\EncounterJournal\\UI-EJ-Icons:::::256:64:167:185:7:25|t", interrupt = "|TInterface\\EncounterJournal\\UI-EJ-Icons:::::256:64:199:217:7:25|t", - magic = "|TInterface\\EncounterJournal\\UI-EJ-Icons:::::256:64:231:249:7:25|t", - curse = "|TInterface\\EncounterJournal\\UI-EJ-Icons:::::256:64:7:25:39:57|t", - poison = "|TInterface\\EncounterJournal\\UI-EJ-Icons:::::256:64:39:57:39:57|t", - disease = "|TInterface\\EncounterJournal\\UI-EJ-Icons:::::256:64:71:89:39:57|t", - enrage = "|TInterface\\EncounterJournal\\UI-EJ-Icons:::::256:64:103:121:39:57|t", - bleed = "|TInterface\\EncounterJournal\\UI-EJ-Icons:::::256:64:158:192:32:64|t", + magic = "|TInterface\\EncounterJournal\\UI-EJ-Icons:::::256:64:231:249:7:25|t", + curse = "|TInterface\\EncounterJournal\\UI-EJ-Icons:::::256:64:7:25:39:57|t", + poison = "|TInterface\\EncounterJournal\\UI-EJ-Icons:::::256:64:39:57:39:57|t", + disease = "|TInterface\\EncounterJournal\\UI-EJ-Icons:::::256:64:71:89:39:57|t", + enrage = "|TInterface\\EncounterJournal\\UI-EJ-Icons:::::256:64:103:121:39:57|t", + bleed = "|TInterface\\EncounterJournal\\UI-EJ-Icons:::::256:64:158:192:32:64|t", } Private.reset_swing_spells = {} @@ -3397,134 +3420,129 @@ Private.item_weapon_types[4 * 256 + 6] = GetItemSubClassInfo(4, 6) WeakAuras.item_weapon_types = Private.item_weapon_types WeakAuras.StopMotion = {} -WeakAuras.StopMotion.texture_types = { -} +WeakAuras.StopMotion.texture_types = {} WeakAuras.StopMotion.texture_types.Basic = { ["Interface\\AddOns\\WeakAuras\\Media\\Textures\\stopmotion"] = "Example", } -WeakAuras.StopMotion.texture_data = { -} +WeakAuras.StopMotion.texture_data = {} WeakAuras.StopMotion.texture_data["Interface\\AddOns\\WeakAuras\\Media\\Textures\\stopmotion"] = { - ["count"] = 64, - ["rows"] = 8, - ["columns"] = 8 - } + ["count"] = 64, + ["rows"] = 8, + ["columns"] = 8, +} WeakAuras.StopMotion.texture_data["Interface\\AddOns\\WeakAurasStopMotion\\Textures\\Basic\\circle"] = { - ["count"] = 256, - ["rows"] = 16, - ["columns"] = 16 - } + ["count"] = 256, + ["rows"] = 16, + ["columns"] = 16, +} WeakAuras.StopMotion.texture_data["Interface\\AddOns\\WeakAurasStopMotion\\Textures\\Basic\\checkmark"] = { - ["count"] = 64, - ["rows"] = 8, - ["columns"] = 8 - } + ["count"] = 64, + ["rows"] = 8, + ["columns"] = 8, +} WeakAuras.StopMotion.texture_data["Interface\\AddOns\\WeakAurasStopMotion\\Textures\\Basic\\redx"] = { - ["count"] = 64, - ["rows"] = 8, - ["columns"] = 8 - } + ["count"] = 64, + ["rows"] = 8, + ["columns"] = 8, +} WeakAuras.StopMotion.texture_data["Interface\\AddOns\\WeakAurasStopMotion\\Textures\\Basic\\leftarc"] = { - ["count"] = 256, - ["rows"] = 16, - ["columns"] = 16 - } + ["count"] = 256, + ["rows"] = 16, + ["columns"] = 16, +} WeakAuras.StopMotion.texture_data["Interface\\AddOns\\WeakAurasStopMotion\\Textures\\Basic\\rightarc"] = { - ["count"] = 256, - ["rows"] = 16, - ["columns"] = 16 - } + ["count"] = 256, + ["rows"] = 16, + ["columns"] = 16, +} WeakAuras.StopMotion.texture_data["Interface\\AddOns\\WeakAurasStopMotion\\Textures\\Basic\\fireball"] = { - ["count"] = 7, - ["rows"] = 5, - ["columns"] = 5 - } - + ["count"] = 7, + ["rows"] = 5, + ["columns"] = 5, +} WeakAuras.StopMotion.texture_data["Interface\\AddOns\\WeakAurasStopMotion\\Textures\\Runes\\AURARUNE8"] = { - ["count"] = 256, - ["rows"] = 16, - ["columns"] = 16 - } + ["count"] = 256, + ["rows"] = 16, + ["columns"] = 16, +} WeakAuras.StopMotion.texture_data["Interface\\AddOns\\WeakAurasStopMotion\\Textures\\Runes\\legionv"] = { - ["count"] = 64, - ["rows"] = 8, - ["columns"] = 8 - } + ["count"] = 64, + ["rows"] = 8, + ["columns"] = 8, +} WeakAuras.StopMotion.texture_data["Interface\\AddOns\\WeakAurasStopMotion\\Textures\\Runes\\legionw"] = { - ["count"] = 64, - ["rows"] = 8, - ["columns"] = 8 - } + ["count"] = 64, + ["rows"] = 8, + ["columns"] = 8, +} WeakAuras.StopMotion.texture_data["Interface\\AddOns\\WeakAurasStopMotion\\Textures\\Runes\\legionf"] = { - ["count"] = 64, - ["rows"] = 8, - ["columns"] = 8 - } + ["count"] = 64, + ["rows"] = 8, + ["columns"] = 8, +} WeakAuras.StopMotion.texture_data["Interface\\AddOns\\WeakAurasStopMotion\\Textures\\Runes\\legionword"] = { - ["count"] = 64, - ["rows"] = 8, - ["columns"] = 8 - } + ["count"] = 64, + ["rows"] = 8, + ["columns"] = 8, +} WeakAuras.StopMotion.texture_data["Interface\\AddOns\\WeakAurasStopMotion\\Textures\\Kaitan\\CellRing"] = { - ["count"] = 32, - ["rows"] = 8, - ["columns"] = 4 - } + ["count"] = 32, + ["rows"] = 8, + ["columns"] = 4, +} WeakAuras.StopMotion.texture_data["Interface\\AddOns\\WeakAurasStopMotion\\Textures\\Kaitan\\Gadget"] = { - ["count"] = 32, - ["rows"] = 8, - ["columns"] = 4 - } + ["count"] = 32, + ["rows"] = 8, + ["columns"] = 4, +} WeakAuras.StopMotion.texture_data["Interface\\AddOns\\WeakAurasStopMotion\\Textures\\Kaitan\\Radar"] = { - ["count"] = 32, - ["rows"] = 8, - ["columns"] = 4 - } + ["count"] = 32, + ["rows"] = 8, + ["columns"] = 4, +} WeakAuras.StopMotion.texture_data["Interface\\AddOns\\WeakAurasStopMotion\\Textures\\Kaitan\\RadarComplex"] = { - ["count"] = 32, - ["rows"] = 8, - ["columns"] = 4 - } + ["count"] = 32, + ["rows"] = 8, + ["columns"] = 4, +} WeakAuras.StopMotion.texture_data["Interface\\AddOns\\WeakAurasStopMotion\\Textures\\Kaitan\\Saber"] = { - ["count"] = 32, - ["rows"] = 8, - ["columns"] = 4 - } + ["count"] = 32, + ["rows"] = 8, + ["columns"] = 4, +} WeakAuras.StopMotion.texture_data["Interface\\AddOns\\WeakAurasStopMotion\\Textures\\Kaitan\\Waveform"] = { - ["count"] = 32, - ["rows"] = 8, - ["columns"] = 4 - } - + ["count"] = 32, + ["rows"] = 8, + ["columns"] = 4, +} WeakAuras.StopMotion.animation_types = { loop = L["Loop"], bounce = L["Forward, Reverse Loop"], once = L["Forward"], - progress = L["Progress"] + progress = L["Progress"], } - if WeakAuras.IsClassic() then Private.baseUnitId.focus = nil Private.baseUnitId.vehicle = nil @@ -3548,13 +3566,45 @@ if WeakAuras.IsClassic() then Private.talent_extra_option_types[2] = nil local reset_swing_spell_list = { - 1464, 8820, 11604, 11605, -- Slam - 78, 284, 285, 1608, 11564, 11565, 11566, 11567, 25286, -- Heroic Strike - 845, 7369, 11608, 11609, 20569, -- Cleave - 2973, 14260, 14261, 14262, 14263, 14264, 14265, 14266, -- Raptor Strike - 6807, 6808, 6809, 8972, 9745, 9880, 9881, -- Maul + 1464, + 8820, + 11604, + 11605, -- Slam + 78, + 284, + 285, + 1608, + 11564, + 11565, + 11566, + 11567, + 25286, -- Heroic Strike + 845, + 7369, + 11608, + 11609, + 20569, -- Cleave + 2973, + 14260, + 14261, + 14262, + 14263, + 14264, + 14265, + 14266, -- Raptor Strike + 6807, + 6808, + 6809, + 8972, + 9745, + 9880, + 9881, -- Maul 20549, -- War Stomp - 2480, 7919, 7918, 2764, 5019, -- Shoots + 2480, + 7919, + 7918, + 2764, + 5019, -- Shoots 5384, -- Feign Death } for _, spellid in ipairs(reset_swing_spell_list) do @@ -3573,19 +3623,68 @@ if WeakAuras.IsBCCOrWrath() then Private.actual_unit_types_cast.boss = nil local reset_swing_spell_list = { - 1464, 8820, 11604, 11605, 25241, 25242, -- Slam - 78, 284, 285, 1608, 11564, 11565, 11566, 11567, 25286, 29707, 30324, -- Heroic Strike - 845, 7369, 11608, 11609, 20569, 25231, -- Cleave - 2973, 14260, 14261, 14262, 14263, 14264, 14265, 14266, 27014, -- Raptor Strike - 6807, 6808, 6809, 8972, 9745, 9880, 9881, 26996, -- Maul + 1464, + 8820, + 11604, + 11605, + 25241, + 25242, -- Slam + 78, + 284, + 285, + 1608, + 11564, + 11565, + 11566, + 11567, + 25286, + 29707, + 30324, -- Heroic Strike + 845, + 7369, + 11608, + 11609, + 20569, + 25231, -- Cleave + 2973, + 14260, + 14261, + 14262, + 14263, + 14264, + 14265, + 14266, + 27014, -- Raptor Strike + 6807, + 6808, + 6809, + 8972, + 9745, + 9880, + 9881, + 26996, -- Maul 20549, -- War Stomp - 2764, 3018, -- Shoots, - 19434, 20900, 20901, 20902, 20903, 20904, 27065, -- Aimed Shot + 2764, + 3018, -- Shoots, + 19434, + 20900, + 20901, + 20902, + 20903, + 20904, + 27065, -- Aimed Shot 20066, -- Repentance 11350, -- Fire Shield (Oil of Immolation) 50986, -- Sulfuron Slammer - 439, 440, 441, 2024, 4042, 17534, 28495, -- Minor/Lesser/Greater/Superior/Major/Super Healing Potion - 41619, 41620, -- Cenarion Healing Salve/Bottled Nethergon Vapor + 439, + 440, + 441, + 2024, + 4042, + 17534, + 28495, -- Minor/Lesser/Greater/Superior/Major/Super Healing Potion + 41619, + 41620, -- Cenarion Healing Salve/Bottled Nethergon Vapor 5384, -- Feign Death } for _, spellid in ipairs(reset_swing_spell_list) do @@ -3593,8 +3692,15 @@ if WeakAuras.IsBCCOrWrath() then end local reset_ranged_swing_spell_list = { - 2764, 3018, -- Shoots - 19434, 20900, 20901, 20902, 20903, 20904, 27065 -- Aimed Shot + 2764, + 3018, -- Shoots + 19434, + 20900, + 20901, + 20902, + 20903, + 20904, + 27065, -- Aimed Shot } for _, spellid in ipairs(reset_ranged_swing_spell_list) do diff --git a/WeakAuras/Types_Retail.lua b/WeakAuras/Types_Retail.lua index d9089a8283..cb6ebabdac 100644 --- a/WeakAuras/Types_Retail.lua +++ b/WeakAuras/Types_Retail.lua @@ -1,8 +1,10 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, Private = ... -local WeakAuras = WeakAuras; -local L = WeakAuras.L; +local WeakAuras = WeakAuras +local L = WeakAuras.L local encounter_list = "" local zoneId_list = "" @@ -12,7 +14,7 @@ function Private.InitializeEncounterAndZoneLists() end EJ_SelectTier(EJ_GetCurrentTier()) - for _, inRaid in ipairs({false, true}) do + for _, inRaid in ipairs({ false, true }) do local instance_index = 1 local instance_id = EJ_GetInstanceByIndex(instance_index, inRaid) local title = inRaid and L["Raids"] or L["Dungeons"] @@ -65,4 +67,3 @@ end function Private.get_zoneId_list() return zoneId_list end - diff --git a/WeakAuras/Types_TBC.lua b/WeakAuras/Types_TBC.lua index c96fa5e214..41aa206797 100644 --- a/WeakAuras/Types_TBC.lua +++ b/WeakAuras/Types_TBC.lua @@ -1,8 +1,10 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, Private = ... -local WeakAuras = WeakAuras; -local L = WeakAuras.L; +local WeakAuras = WeakAuras +local L = WeakAuras.L local encounter_list = "" function Private.InitializeEncounterAndZoneLists() @@ -24,20 +26,20 @@ function Private.InitializeEncounterAndZoneLists() { L["Chess Event"], 660 }, { L["Prince Malchezaar"], 661 }, { L["Nightbane"], 662 }, - } + }, }, { L["Gruul's Lair"], { { L["High King Maulgar"], 649 }, { L["Gruul the Dragonkiller"], 650 }, - } + }, }, { L["Magtheridon's Lair"], { { L["Magtheridon"], 651 }, - } + }, }, { L["Coilfang: Serpentshrine Cavern"], @@ -48,7 +50,7 @@ function Private.InitializeEncounterAndZoneLists() { L["Fathom-Lord Karathress"], 626 }, { L["Morogrim Tidewalker"], 627 }, { L["Lady Vashj"], 628 }, - } + }, }, { L["Tempest Keep"], @@ -57,7 +59,7 @@ function Private.InitializeEncounterAndZoneLists() { L["Void Reaver"], 731 }, { L["High Astromancer Solarian"], 732 }, { L["Kael'thas Sunstrider"], 733 }, - } + }, }, { L["The Battle for Mount Hyjal"], @@ -67,7 +69,7 @@ function Private.InitializeEncounterAndZoneLists() { L["Kaz'rogal"], 620 }, { L["Azgalor"], 621 }, { L["Archimonde"], 622 }, - } + }, }, { L["Black Temple"], @@ -81,7 +83,7 @@ function Private.InitializeEncounterAndZoneLists() { L["Mother Shahraz"], 607 }, { L["The Illidari Council"], 608 }, { L["Illidan Stormrage"], 609 }, - } + }, }, { L["Zul'Aman"], @@ -92,7 +94,7 @@ function Private.InitializeEncounterAndZoneLists() { L["Halazzi"], 1192 }, { L["Hex Lord Malacrass"], 1193 }, { L["Daakara"], 1194 }, - } + }, }, { L["The Sunwell Plateau"], @@ -103,14 +105,14 @@ function Private.InitializeEncounterAndZoneLists() { L["Eredar Twins"], 727 }, { L["M'uru"], 728 }, { L["Kil'jaeden"], 729 }, - } - } + }, + }, } for _, raid in ipairs(raids) do encounter_list = ("%s|cffffd200%s|r\n"):format(encounter_list, raid[1]) for _, boss in ipairs(raid[2]) do - encounter_list = ("%s%s: %d\n"):format(encounter_list, boss[1], boss[2]) + encounter_list = ("%s%s: %d\n"):format(encounter_list, boss[1], boss[2]) end encounter_list = encounter_list .. "\n" end @@ -122,7 +124,6 @@ function Private.get_encounters_list() return encounter_list end - function Private.get_zoneId_list() return "" -end \ No newline at end of file +end diff --git a/WeakAuras/Types_Vanilla.lua b/WeakAuras/Types_Vanilla.lua index d800e32729..1bb6b4d235 100644 --- a/WeakAuras/Types_Vanilla.lua +++ b/WeakAuras/Types_Vanilla.lua @@ -1,8 +1,10 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, Private = ... -local WeakAuras = WeakAuras; -local L = WeakAuras.L; +local WeakAuras = WeakAuras +local L = WeakAuras.L local encounter_list = "" function Private.InitializeEncounterAndZoneLists() @@ -13,15 +15,15 @@ function Private.InitializeEncounterAndZoneLists() { L["Black Wing Lair"], { - { L["Razorgore the Untamed"], 610 }, - { L["Vaelastrasz the Corrupt"], 611 }, - { L["Broodlord Lashlayer"], 612 }, - { L["Firemaw"], 613 }, - { L["Ebonroc"], 614 }, - { L["Flamegor"], 615 }, - { L["Chromaggus"], 616 }, - { L["Nefarian"], 617 } - } + { L["Razorgore the Untamed"], 610 }, + { L["Vaelastrasz the Corrupt"], 611 }, + { L["Broodlord Lashlayer"], 612 }, + { L["Firemaw"], 613 }, + { L["Ebonroc"], 614 }, + { L["Flamegor"], 615 }, + { L["Chromaggus"], 616 }, + { L["Nefarian"], 617 }, + }, }, { L["Molten Core"], @@ -35,8 +37,8 @@ function Private.InitializeEncounterAndZoneLists() { L["Sulfuron Harbinger"], 669 }, { L["Golemagg the Incinerator"], 670 }, { L["Majordomo Executus"], 671 }, - { L["Ragnaros"], 672 } - } + { L["Ragnaros"], 672 }, + }, }, { L["Ahn'Qiraj"], @@ -49,8 +51,8 @@ function Private.InitializeEncounterAndZoneLists() { L["Princess Huhuran"], 714 }, { L["Twin Emperors"], 715 }, { L["Ouro"], 716 }, - { L["C'thun"], 717 } - } + { L["C'thun"], 717 }, + }, }, { L["Ruins of Ahn'Qiraj"], @@ -60,8 +62,8 @@ function Private.InitializeEncounterAndZoneLists() { L["Moam"], 720 }, { L["Buru the Gorger"], 721 }, { L["Ayamiss the Hunter"], 722 }, - { L["Ossirian the Unscarred"], 723 } - } + { L["Ossirian the Unscarred"], 723 }, + }, }, { L["Zul'Gurub"], @@ -75,14 +77,14 @@ function Private.InitializeEncounterAndZoneLists() { L["Gahz'ranka"], 790 }, { L["High Priestess Arlokk"], 791 }, { L["Jin'do the Hexxer"], 792 }, - { L["Hakkar"], 793 } - } + { L["Hakkar"], 793 }, + }, }, { L["Onyxia's Lair"], { - { L["Onyxia"], 1084 } - } + { L["Onyxia"], 1084 }, + }, }, { L["Naxxramas"], @@ -106,14 +108,14 @@ function Private.InitializeEncounterAndZoneLists() { L["Thaddius"], 1120 }, -- Frostwyrm Lair { L["Sapphiron"], 1119 }, - { L["Kel'Thuzad"], 1114 } - } - } + { L["Kel'Thuzad"], 1114 }, + }, + }, } for _, raid in ipairs(raids) do encounter_list = ("%s|cffffd200%s|r\n"):format(encounter_list, raid[1]) for _, boss in ipairs(raid[2]) do - encounter_list = ("%s%s: %d\n"):format(encounter_list, boss[1], boss[2]) + encounter_list = ("%s%s: %d\n"):format(encounter_list, boss[1], boss[2]) end encounter_list = encounter_list .. "\n" end diff --git a/WeakAuras/Types_Wrath.lua b/WeakAuras/Types_Wrath.lua index 3e2eb839dd..6696325494 100644 --- a/WeakAuras/Types_Wrath.lua +++ b/WeakAuras/Types_Wrath.lua @@ -1,8 +1,10 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, Private = ... -local WeakAuras = WeakAuras; -local L = WeakAuras.L; +local WeakAuras = WeakAuras +local L = WeakAuras.L local encounter_list = "" function Private.InitializeEncounterAndZoneLists() @@ -17,7 +19,7 @@ function Private.InitializeEncounterAndZoneLists() { L["Emalon the Storm Watcher"], 1127 }, { L["Koralon the Flame Watcher"], 1128 }, { L["Toravon the Ice Watcher"], 1129 }, - } + }, }, { L["Naxxramas"], @@ -41,8 +43,8 @@ function Private.InitializeEncounterAndZoneLists() { L["Thaddius"], 1120 }, -- Frostwyrm Lair { L["Sapphiron"], 1119 }, - { L["Kel'Thuzad"], 1114 } - } + { L["Kel'Thuzad"], 1114 }, + }, }, { L["The Obsidian Sanctum"], @@ -51,13 +53,13 @@ function Private.InitializeEncounterAndZoneLists() { L["Shadron"], 1091 }, { L["Vesperon"], 1093 }, { L["Sartharion"], 1090 }, - } + }, }, { L["The Eye of Eternity"], { { L["Malygos"], 1094 }, - } + }, }, { L["Ulduar"], @@ -81,7 +83,7 @@ function Private.InitializeEncounterAndZoneLists() { L["Yogg-Saron"], 1143 }, -- Celestial Planetarium { L["Algalon the Observer"], 1130 }, - } + }, }, { L["Trial of the Crusader"], @@ -91,13 +93,13 @@ function Private.InitializeEncounterAndZoneLists() { L["Faction Champions"], 1086 }, { L["Val'kyr Twins"], 1089 }, { L["Anub'arak"], 1085 }, - } + }, }, { L["Onyxia's Lair"], { { L["Onyxia"], 1084 }, - } + }, }, { L["Icecrown Citadel"], @@ -119,7 +121,7 @@ function Private.InitializeEncounterAndZoneLists() { L["Sindragosa"], 1105 }, -- The Frozen Throne { L["The Lich King"], 1106 }, - } + }, }, { L["The Ruby Sanctum"], @@ -128,13 +130,13 @@ function Private.InitializeEncounterAndZoneLists() { L["General Zarithrian"], 1148 }, { L["Saviana Ragefire"], 1149 }, { L["Halion"], 1150 }, - } + }, }, } for _, raid in ipairs(raids) do encounter_list = ("%s|cffffd200%s|r\n"):format(encounter_list, raid[1]) for _, boss in ipairs(raid[2]) do - encounter_list = ("%s%s: %d\n"):format(encounter_list, boss[1], boss[2]) + encounter_list = ("%s%s: %d\n"):format(encounter_list, boss[1], boss[2]) end encounter_list = encounter_list .. "\n" end @@ -5440,4 +5442,4 @@ Private.talentInfo = { "RogueSubtlety", -- [3] }, }, -} \ No newline at end of file +} diff --git a/WeakAuras/WeakAuras.lua b/WeakAuras/WeakAuras.lua index 4c20459793..3ae5d267a8 100644 --- a/WeakAuras/WeakAuras.lua +++ b/WeakAuras/WeakAuras.lua @@ -7,16 +7,13 @@ local insert = table.insert -- WoW APIs local GetTalentInfo, IsAddOnLoaded, InCombatLockdown = GetTalentInfo, IsAddOnLoaded, InCombatLockdown -local LoadAddOn, UnitName, GetRealmName, UnitRace, UnitFactionGroup, IsInRaid - = LoadAddOn, UnitName, GetRealmName, UnitRace, UnitFactionGroup, IsInRaid -local UnitClass, UnitExists, UnitGUID, UnitAffectingCombat, GetInstanceInfo, IsInInstance - = UnitClass, UnitExists, UnitGUID, UnitAffectingCombat, GetInstanceInfo, IsInInstance -local UnitIsUnit, GetRaidRosterInfo, GetSpecialization, UnitInVehicle, UnitHasVehicleUI, GetSpellInfo - = UnitIsUnit, GetRaidRosterInfo, GetSpecialization, UnitInVehicle, UnitHasVehicleUI, GetSpellInfo -local SendChatMessage, UnitInBattleground, UnitInRaid, UnitInParty, GetTime - = SendChatMessage, UnitInBattleground, UnitInRaid, UnitInParty, GetTime -local CreateFrame, IsShiftKeyDown, GetScreenWidth, GetScreenHeight, GetCursorPosition, UpdateAddOnCPUUsage, GetFrameCPUUsage, debugprofilestop - = CreateFrame, IsShiftKeyDown, GetScreenWidth, GetScreenHeight, GetCursorPosition, UpdateAddOnCPUUsage, GetFrameCPUUsage, debugprofilestop +local LoadAddOn, UnitName, GetRealmName, UnitRace, UnitFactionGroup, IsInRaid = LoadAddOn, UnitName, GetRealmName, UnitRace, UnitFactionGroup, IsInRaid +local UnitClass, UnitExists, UnitGUID, UnitAffectingCombat, GetInstanceInfo, IsInInstance = UnitClass, UnitExists, UnitGUID, UnitAffectingCombat, GetInstanceInfo, IsInInstance +local UnitIsUnit, GetRaidRosterInfo, GetSpecialization, UnitInVehicle, UnitHasVehicleUI, GetSpellInfo = + UnitIsUnit, GetRaidRosterInfo, GetSpecialization, UnitInVehicle, UnitHasVehicleUI, GetSpellInfo +local SendChatMessage, UnitInBattleground, UnitInRaid, UnitInParty, GetTime = SendChatMessage, UnitInBattleground, UnitInRaid, UnitInParty, GetTime +local CreateFrame, IsShiftKeyDown, GetScreenWidth, GetScreenHeight, GetCursorPosition, UpdateAddOnCPUUsage, GetFrameCPUUsage, debugprofilestop = + CreateFrame, IsShiftKeyDown, GetScreenWidth, GetScreenHeight, GetCursorPosition, UpdateAddOnCPUUsage, GetFrameCPUUsage, debugprofilestop local debugstack = debugstack local GetNumTalentTabs, GetNumTalents = GetNumTalentTabs, GetNumTalents local MAX_NUM_TALENTS = MAX_NUM_TALENTS or 20 @@ -27,11 +24,15 @@ local L = WeakAuras.L local versionString = WeakAuras.versionString local prettyPrint = WeakAuras.prettyPrint -WeakAurasTimers = setmetatable({}, {__tostring=function() return "WeakAuras" end}) +WeakAurasTimers = setmetatable({}, { + __tostring = function() + return "WeakAuras" + end, +}) LibStub("AceTimer-3.0"):Embed(WeakAurasTimers) -Private.maxTimerDuration = 604800; -- A week, in seconds -local maxUpTime = 4294967; -- 2^32 / 1000 +Private.maxTimerDuration = 604800 -- A week, in seconds +local maxUpTime = 4294967 -- 2^32 / 1000 Private.watched_trigger_events = {} @@ -54,9 +55,11 @@ function Private.callbacks:Fire(event, ...) end function WeakAurasTimers:ScheduleTimerFixed(func, delay, ...) - if (delay < Private.maxTimerDuration) then + if delay < Private.maxTimerDuration then if delay + GetTime() > maxUpTime then - WeakAuras.prettyPrint(WeakAuras.L["Can't schedule timer with %i, due to a World of Warcraft bug with high computer uptime. (Uptime: %i). Please restart your computer."]:format(delay, GetTime())) + WeakAuras.prettyPrint( + WeakAuras.L["Can't schedule timer with %i, due to a World of Warcraft bug with high computer uptime. (Uptime: %i). Please restart your computer."]:format(delay, GetTime()) + ) return end return self:ScheduleTimer(func, delay, ...) @@ -75,7 +78,7 @@ local loginQueue = {} local queueshowooc function WeakAuras.InternalVersion() - return internalVersion; + return internalVersion end do @@ -91,8 +94,13 @@ do data = Private.GetDataByUID(currentErrorHandlerUid) end if data then - Private.AuraWarnings.UpdateWarning(data.uid, "LuaError", "error", - L["This aura has caused a Lua error."] .. "\n" .. L["Install the addons BugSack and BugGrabber for detailed error logs."], true) + Private.AuraWarnings.UpdateWarning( + data.uid, + "LuaError", + "error", + L["This aura has caused a Lua error."] .. "\n" .. L["Install the addons BugSack and BugGrabber for detailed error logs."], + true + ) prefix = L["Lua error in aura '%s': %s"]:format(data.id, currentErrorHandlerContext or L["unknown location"]) .. "\n" else prefix = L["Lua error"] .. "\n" @@ -121,33 +129,33 @@ do end function Private.LoadOptions(msg) - if not(IsAddOnLoaded("WeakAurasOptions")) then + if not (IsAddOnLoaded("WeakAurasOptions")) then if not WeakAuras.IsLoginFinished() then prettyPrint(Private.LoginMessage()) loginQueue[#loginQueue + 1] = WeakAuras.OpenOptions elseif InCombatLockdown() then -- inform the user and queue ooc prettyPrint(L["Options will finish loading after combat ends."]) - queueshowooc = msg or ""; + queueshowooc = msg or "" WeakAuras.frames["Addon Initialization Handler"]:RegisterEvent("PLAYER_REGEN_ENABLED") - return false; + return false else - local loaded, reason = LoadAddOn("WeakAurasOptions"); - if not(loaded) then + local loaded, reason = LoadAddOn("WeakAurasOptions") + if not loaded then reason = string.lower("|cffff2020" .. _G["ADDON_" .. reason] .. "|r.") - WeakAuras.prettyPrint(string.format(L["Options could not be loaded, the addon is %s"], reason)); - return false; + WeakAuras.prettyPrint(string.format(L["Options could not be loaded, the addon is %s"], reason)) + return false end end end - return true; + return true end function WeakAuras.OpenOptions(msg) if Private.NeedToRepairDatabase() then - StaticPopup_Show("WEAKAURAS_CONFIRM_REPAIR", nil, nil, {reason = "downgrade"}) - elseif (WeakAuras.IsLoginFinished() and Private.LoadOptions(msg)) then - WeakAuras.ToggleOptions(msg, Private); + StaticPopup_Show("WEAKAURAS_CONFIRM_REPAIR", nil, nil, { reason = "downgrade" }) + elseif WeakAuras.IsLoginFinished() and Private.LoadOptions(msg) then + WeakAuras.ToggleOptions(msg, Private) end end @@ -155,14 +163,16 @@ function Private.PrintHelp() print(L["Usage:"]) print(L["/wa help - Show this message"]) print(L["/wa minimap - Toggle the minimap icon"]) - print(L["/wa pstart - Start profiling. Optionally include a duration in seconds after which profiling automatically stops. To profile the next combat/encounter, pass a \"combat\" or \"encounter\" argument."]) + print( + L["/wa pstart - Start profiling. Optionally include a duration in seconds after which profiling automatically stops. To profile the next combat/encounter, pass a \"combat\" or \"encounter\" argument."] + ) print(L["/wa pstop - Finish profiling"]) print(L["/wa pprint - Show the results from the most recent profiling"]) print(L["/wa repair - Repair tool"]) print(L["If you require additional assistance, please open a ticket on GitHub or visit our Discord at https://discord.gg/weakauras!"]) end -SLASH_WEAKAURAS1, SLASH_WEAKAURAS2 = "/weakauras", "/wa"; +SLASH_WEAKAURAS1, SLASH_WEAKAURAS2 = "/weakauras", "/wa" function SlashCmdList.WEAKAURAS(input) local args, msg = {}, nil @@ -175,33 +185,35 @@ function SlashCmdList.WEAKAURAS(input) end if msg == "pstart" then - WeakAuras.StartProfile(args[1]); + WeakAuras.StartProfile(args[1]) elseif msg == "pstop" then - WeakAuras.StopProfile(); + WeakAuras.StopProfile() elseif msg == "pprint" then - WeakAuras.PrintProfile(); + WeakAuras.PrintProfile() elseif msg == "pcancel" then WeakAuras.CancelScheduledProfile() elseif msg == "minimap" then - Private.ToggleMinimap(); + Private.ToggleMinimap() elseif msg == "help" then - Private.PrintHelp(); + Private.PrintHelp() elseif msg == "repair" then - StaticPopup_Show("WEAKAURAS_CONFIRM_REPAIR", nil, nil, {reason = "user"}) + StaticPopup_Show("WEAKAURAS_CONFIRM_REPAIR", nil, nil, { reason = "user" }) else - WeakAuras.OpenOptions(msg); + WeakAuras.OpenOptions(msg) end end -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end function Private.ToggleMinimap() WeakAurasSaved.minimap.hide = not WeakAurasSaved.minimap.hide if WeakAurasSaved.minimap.hide then - LDBIcon:Hide("WeakAuras"); + LDBIcon:Hide("WeakAuras") prettyPrint(L["Use /wa minimap to show the minimap icon again."]) else - LDBIcon:Show("WeakAuras"); + LDBIcon:Show("WeakAuras") end end @@ -214,59 +226,59 @@ BINDING_NAME_WEAKAURASPRINTPROFILING = L["Print Profiling Results"] -- Noteable properties: -- debug: If set to true, WeakAura.debug() outputs messages to the chat frame -- displays: All aura settings, keyed on their id -local db; +local db -- While true no events are handled. E.g. WeakAuras is paused while the Options dialog is open -local paused = true; -local importing = false; +local paused = true +local importing = false -- squelches actions and sounds from auras. is used e.g. to prevent lots of actions/sounds from triggering -- on login or after closing the options dialog -local squelch_actions = true; -local in_loading_screen = false; +local squelch_actions = true +local in_loading_screen = false -- Load functions, keyed on id -local loadFuncs = {}; +local loadFuncs = {} -- Load functions for the Options window that ignore various load options -local loadFuncsForOptions = {}; +local loadFuncsForOptions = {} -- Mapping of events to ids, contains true if a aura should be checked for a certain event local loadEvents = {} -- All regions keyed on id, has properties: region, regionType, also see clones -WeakAuras.regions = {}; -local regions = WeakAuras.regions; +WeakAuras.regions = {} +local regions = WeakAuras.regions -- keyed on id, contains bool indicating whether the aura is loaded -Private.loaded = {}; -local loaded = Private.loaded; +Private.loaded = {} +local loaded = Private.loaded -- contains regions for clones -WeakAuras.clones = {}; -local clones = WeakAuras.clones; +WeakAuras.clones = {} +local clones = WeakAuras.clones -- Unused regions that are kept around for clones local clonePool = {} -- One table per regionType, see RegisterRegionType, notable properties: create, modify and default -WeakAuras.regionTypes = {}; -local regionTypes = WeakAuras.regionTypes; +WeakAuras.regionTypes = {} +local regionTypes = WeakAuras.regionTypes Private.subRegionTypes = {} local subRegionTypes = Private.subRegionTypes -- One table per regionType, see RegisterRegionOptions -WeakAuras.regionOptions = {}; -local regionOptions = WeakAuras.regionOptions; +WeakAuras.regionOptions = {} +local regionOptions = WeakAuras.regionOptions Private.subRegionOptions = {} local subRegionOptions = Private.subRegionOptions -- Maps from trigger type to trigger system -Private.triggerTypes = {}; -local triggerTypes = Private.triggerTypes; +Private.triggerTypes = {} +local triggerTypes = Private.triggerTypes -- Maps from trigger type to a function that can create options for the trigger -Private.triggerTypesOptions = {}; +Private.triggerTypesOptions = {} -- Trigger State, updated by trigger systems, then applied to regions by UpdatedTriggerState -- keyed on id, triggernum, cloneid @@ -294,36 +306,36 @@ Private.triggerTypesOptions = {}; local triggerState = {} -- Fallback states -local fallbacksStates = {}; +local fallbacksStates = {} -- List of all trigger systems, contains each system once local triggerSystems = {} -local timers = {}; -- Timers for autohiding, keyed on id, triggernum, cloneid -WeakAuras.timers = timers; +local timers = {} -- Timers for autohiding, keyed on id, triggernum, cloneid +WeakAuras.timers = timers -WeakAuras.raidUnits = {}; -WeakAuras.raidpetUnits = {}; -WeakAuras.partyUnits = {}; -WeakAuras.partypetUnits = {}; +WeakAuras.raidUnits = {} +WeakAuras.raidpetUnits = {} +WeakAuras.partyUnits = {} +WeakAuras.partypetUnits = {} WeakAuras.petUnitToUnit = { - pet = "player" + pet = "player", } WeakAuras.unitToPetUnit = { - player = "pet" + player = "pet", } do - for i=1,40 do - WeakAuras.raidUnits[i] = "raid"..i - WeakAuras.raidpetUnits[i] = "raidpet"..i - WeakAuras.petUnitToUnit["raidpet"..i] = "raid"..i - WeakAuras.unitToPetUnit["raid"..i] = "raidpet"..i + for i = 1, 40 do + WeakAuras.raidUnits[i] = "raid" .. i + WeakAuras.raidpetUnits[i] = "raidpet" .. i + WeakAuras.petUnitToUnit["raidpet" .. i] = "raid" .. i + WeakAuras.unitToPetUnit["raid" .. i] = "raidpet" .. i end - for i=1,4 do - WeakAuras.partyUnits[i] = "party"..i - WeakAuras.partypetUnits[i] = "partypet"..i - WeakAuras.petUnitToUnit["partypet"..i] = "party"..i - WeakAuras.unitToPetUnit["party"..i] = "partypet"..i + for i = 1, 4 do + WeakAuras.partyUnits[i] = "party" .. i + WeakAuras.partypetUnits[i] = "partypet" .. i + WeakAuras.petUnitToUnit["partypet" .. i] = "party" .. i + WeakAuras.unitToPetUnit["party" .. i] = "partypet" .. i end end @@ -331,14 +343,14 @@ WeakAuras.UnitIsPet = function(unit) return WeakAuras.petUnitToUnit[unit] ~= nil end -local playerLevel = UnitLevel("player"); +local playerLevel = UnitLevel("player") local currentInstanceType = "none" -- Custom Action Functions, keyed on id, "init" / "start" / "finish" -Private.customActionsFunctions = {}; +Private.customActionsFunctions = {} -- Custom Functions used in conditions, keyed on id, condition number, "changes", property number -WeakAuras.customConditionsFunctions = {}; +WeakAuras.customConditionsFunctions = {} -- Text format functions for chat messages, keyed on id, condition number, changes, property number WeakAuras.conditionTextFormatters = {} @@ -346,49 +358,49 @@ WeakAuras.conditionTextFormatters = {} -- keyed on UID not on id! WeakAuras.conditionHelpers = {} -local load_prototype = Private.load_prototype; +local load_prototype = Private.load_prototype local levelColors = { [0] = "|cFFFFFFFF", [1] = "|cFF40FF40", [2] = "|cFF6060FF", - [3] = "|cFFFF4040" -}; + [3] = "|cFFFF4040", +} function WeakAuras.validate(input, default) for field, defaultValue in pairs(default) do - if(type(defaultValue) == "table" and type(input[field]) ~= "table") then - input[field] = {}; - elseif(input[field] == nil) or (type(input[field]) ~= type(defaultValue)) then - input[field] = defaultValue; + if type(defaultValue) == "table" and type(input[field]) ~= "table" then + input[field] = {} + elseif (input[field] == nil) or (type(input[field]) ~= type(defaultValue)) then + input[field] = defaultValue end - if(type(input[field]) == "table") then - WeakAuras.validate(input[field], defaultValue); + if type(input[field]) == "table" then + WeakAuras.validate(input[field], defaultValue) end end end function WeakAuras.RegisterRegionType(name, createFunction, modifyFunction, default, properties, validate) - if not(name) then - error("Improper arguments to WeakAuras.RegisterRegionType - name is not defined", 2); - elseif(type(name) ~= "string") then - error("Improper arguments to WeakAuras.RegisterRegionType - name is not a string", 2); - elseif not(createFunction) then - error("Improper arguments to WeakAuras.RegisterRegionType - creation function is not defined", 2); - elseif(type(createFunction) ~= "function") then - error("Improper arguments to WeakAuras.RegisterRegionType - creation function is not a function", 2); - elseif not(modifyFunction) then - error("Improper arguments to WeakAuras.RegisterRegionType - modification function is not defined", 2); - elseif(type(modifyFunction) ~= "function") then + if not name then + error("Improper arguments to WeakAuras.RegisterRegionType - name is not defined", 2) + elseif type(name) ~= "string" then + error("Improper arguments to WeakAuras.RegisterRegionType - name is not a string", 2) + elseif not createFunction then + error("Improper arguments to WeakAuras.RegisterRegionType - creation function is not defined", 2) + elseif type(createFunction) ~= "function" then + error("Improper arguments to WeakAuras.RegisterRegionType - creation function is not a function", 2) + elseif not modifyFunction then + error("Improper arguments to WeakAuras.RegisterRegionType - modification function is not defined", 2) + elseif type(modifyFunction) ~= "function" then error("Improper arguments to WeakAuras.RegisterRegionType - modification function is not a function", 2) - elseif not(default) then - error("Improper arguments to WeakAuras.RegisterRegionType - default options are not defined", 2); - elseif(type(default) ~= "table") then - error("Improper arguments to WeakAuras.RegisterRegionType - default options are not a table", 2); - elseif(type(default) ~= "table" and type(default) ~= "nil") then - error("Improper arguments to WeakAuras.RegisterRegionType - properties options are not a table", 2); - elseif(regionTypes[name]) then - error("Improper arguments to WeakAuras.RegisterRegionType - region type \""..name.."\" already defined", 2); + elseif not default then + error("Improper arguments to WeakAuras.RegisterRegionType - default options are not defined", 2) + elseif type(default) ~= "table" then + error("Improper arguments to WeakAuras.RegisterRegionType - default options are not a table", 2) + elseif type(default) ~= "table" and type(default) ~= "nil" then + error("Improper arguments to WeakAuras.RegisterRegionType - properties options are not a table", 2) + elseif regionTypes[name] then + error("Improper arguments to WeakAuras.RegisterRegionType - region type \"" .. name .. "\" already defined", 2) else regionTypes[name] = { create = createFunction, @@ -396,47 +408,59 @@ function WeakAuras.RegisterRegionType(name, createFunction, modifyFunction, defa default = default, validate = validate, properties = properties, - }; - end -end - -function WeakAuras.RegisterSubRegionType(name, displayName, supportFunction, createFunction, modifyFunction, onAcquire, onRelease, default, addDefaultsForNewAura, properties, supportsAdd) - if not(name) then - error("Improper arguments to WeakAuras.RegisterSubRegionType - name is not defined", 2); - elseif(type(name) ~= "string") then - error("Improper arguments to WeakAuras.RegisterSubRegionType - name is not a string", 2); - elseif not(displayName) then - error("Improper arguments to WeakAuras.RegisterSubRegionType - display name is not defined".." "..name, 2); - elseif(type(displayName) ~= "string") then - error("Improper arguments to WeakAuras.RegisterSubRegionType - display name is not a string", 2); - elseif not(supportFunction) then - error("Improper arguments to WeakAuras.RegisterSubRegionType - support function is not defined", 2); - elseif(type(supportFunction) ~= "function") then - error("Improper arguments to WeakAuras.RegisterSubRegionType - support function is not a function", 2); - elseif not(createFunction) then - error("Improper arguments to WeakAuras.RegisterSubRegionType - creation function is not defined", 2); - elseif(type(createFunction) ~= "function") then - error("Improper arguments to WeakAuras.RegisterSubRegionType - creation function is not a function", 2); - elseif not(modifyFunction) then - error("Improper arguments to WeakAuras.RegisterSubRegionType - modification function is not defined", 2); - elseif(type(modifyFunction) ~= "function") then + } + end +end + +function WeakAuras.RegisterSubRegionType( + name, + displayName, + supportFunction, + createFunction, + modifyFunction, + onAcquire, + onRelease, + default, + addDefaultsForNewAura, + properties, + supportsAdd +) + if not name then + error("Improper arguments to WeakAuras.RegisterSubRegionType - name is not defined", 2) + elseif type(name) ~= "string" then + error("Improper arguments to WeakAuras.RegisterSubRegionType - name is not a string", 2) + elseif not displayName then + error("Improper arguments to WeakAuras.RegisterSubRegionType - display name is not defined" .. " " .. name, 2) + elseif type(displayName) ~= "string" then + error("Improper arguments to WeakAuras.RegisterSubRegionType - display name is not a string", 2) + elseif not supportFunction then + error("Improper arguments to WeakAuras.RegisterSubRegionType - support function is not defined", 2) + elseif type(supportFunction) ~= "function" then + error("Improper arguments to WeakAuras.RegisterSubRegionType - support function is not a function", 2) + elseif not createFunction then + error("Improper arguments to WeakAuras.RegisterSubRegionType - creation function is not defined", 2) + elseif type(createFunction) ~= "function" then + error("Improper arguments to WeakAuras.RegisterSubRegionType - creation function is not a function", 2) + elseif not modifyFunction then + error("Improper arguments to WeakAuras.RegisterSubRegionType - modification function is not defined", 2) + elseif type(modifyFunction) ~= "function" then error("Improper arguments to WeakAuras.RegisterSubRegionType - modification function is not a function", 2) - elseif not(onAcquire) then - error("Improper arguments to WeakAuras.RegisterSubRegionType - onAcquire function is not defined", 2); - elseif(type(onAcquire) ~= "function") then + elseif not onAcquire then + error("Improper arguments to WeakAuras.RegisterSubRegionType - onAcquire function is not defined", 2) + elseif type(onAcquire) ~= "function" then error("Improper arguments to WeakAuras.RegisterSubRegionType - onAcquire function is not a function", 2) - elseif not(onRelease) then - error("Improper arguments to WeakAuras.RegisterSubRegionType - onRelease function is not defined", 2); - elseif(type(onRelease) ~= "function") then + elseif not onRelease then + error("Improper arguments to WeakAuras.RegisterSubRegionType - onRelease function is not defined", 2) + elseif type(onRelease) ~= "function" then error("Improper arguments to WeakAuras.RegisterSubRegionType - onRelease function is not a function", 2) - elseif not(default) then - error("Improper arguments to WeakAuras.RegisterSubRegionType - default options are not defined", 2); - elseif(type(default) ~= "table" and type(default) ~= "function") then - error("Improper arguments to WeakAuras.RegisterSubRegionType - default options are not a table or a function", 2); - elseif(addDefaultsForNewAura and type(addDefaultsForNewAura) ~= "function") then + elseif not default then + error("Improper arguments to WeakAuras.RegisterSubRegionType - default options are not defined", 2) + elseif type(default) ~= "table" and type(default) ~= "function" then + error("Improper arguments to WeakAuras.RegisterSubRegionType - default options are not a table or a function", 2) + elseif addDefaultsForNewAura and type(addDefaultsForNewAura) ~= "function" then error("Improper arguments to WeakAuras.RegisterSubRegionType - addDefaultsForNewAura function is not nil or a function", 2) - elseif(subRegionTypes[name]) then - error("Improper arguments to WeakAuras.RegisterSubRegionType - region type \""..name.."\" already defined", 2); + elseif subRegionTypes[name] then + error("Improper arguments to WeakAuras.RegisterSubRegionType - region type \"" .. name .. "\" already defined", 2) else local pool = CreateObjectPool(createFunction) @@ -457,35 +481,35 @@ function WeakAuras.RegisterSubRegionType(name, displayName, supportFunction, cre release = function(subRegion) onRelease(subRegion) pool:Release(subRegion) - end - }; + end, + } end end function WeakAuras.RegisterRegionOptions(name, createFunction, icon, displayName, createThumbnail, modifyThumbnail, description, templates, getAnchors) - if not(name) then - error("Improper arguments to WeakAuras.RegisterRegionOptions - name is not defined", 2); - elseif(type(name) ~= "string") then - error("Improper arguments to WeakAuras.RegisterRegionOptions - name is not a string", 2); - elseif not(createFunction) then - error("Improper arguments to WeakAuras.RegisterRegionOptions - creation function is not defined", 2); - elseif(type(createFunction) ~= "function") then - error("Improper arguments to WeakAuras.RegisterRegionOptions - creation function is not a function", 2); - elseif not(icon) then - error("Improper arguments to WeakAuras.RegisterRegionOptions - icon is not defined", 2); - elseif not(type(icon) == "string" or type(icon) == "function") then + if not name then + error("Improper arguments to WeakAuras.RegisterRegionOptions - name is not defined", 2) + elseif type(name) ~= "string" then + error("Improper arguments to WeakAuras.RegisterRegionOptions - name is not a string", 2) + elseif not createFunction then + error("Improper arguments to WeakAuras.RegisterRegionOptions - creation function is not defined", 2) + elseif type(createFunction) ~= "function" then + error("Improper arguments to WeakAuras.RegisterRegionOptions - creation function is not a function", 2) + elseif not icon then + error("Improper arguments to WeakAuras.RegisterRegionOptions - icon is not defined", 2) + elseif not (type(icon) == "string" or type(icon) == "function") then error("Improper arguments to WeakAuras.RegisterRegionOptions - icon is not a string or a function", 2) - elseif not(displayName) then - error("Improper arguments to WeakAuras.RegisterRegionOptions - display name is not defined".." "..name, 2); - elseif(type(displayName) ~= "string") then - error("Improper arguments to WeakAuras.RegisterRegionOptions - display name is not a string", 2); - elseif (getAnchors and type(getAnchors) ~= "function") then - error("Improper arguments to WeakAuras.RegisterRegionOptions - anchors is not a function", 2); - elseif(regionOptions[name]) then - error("Improper arguments to WeakAuras.RegisterRegionOptions - region type \""..name.."\" already defined", 2); + elseif not displayName then + error("Improper arguments to WeakAuras.RegisterRegionOptions - display name is not defined" .. " " .. name, 2) + elseif type(displayName) ~= "string" then + error("Improper arguments to WeakAuras.RegisterRegionOptions - display name is not a string", 2) + elseif getAnchors and type(getAnchors) ~= "function" then + error("Improper arguments to WeakAuras.RegisterRegionOptions - anchors is not a function", 2) + elseif regionOptions[name] then + error("Improper arguments to WeakAuras.RegisterRegionOptions - region type \"" .. name .. "\" already defined", 2) else local templateIcon - if (type(icon) == "function") then + if type(icon) == "function" then -- We only want to create two icons and reparent it as needed templateIcon = icon() templateIcon:Hide() @@ -520,70 +544,70 @@ function WeakAuras.RegisterRegionOptions(name, createFunction, icon, displayName releaseThumbnail = releaseThumbnail, description = description, templates = templates, - getAnchors = getAnchors - }; + getAnchors = getAnchors, + } end end function WeakAuras.RegisterSubRegionOptions(name, createFunction, description) - if not(name) then - error("Improper arguments to WeakAuras.RegisterSubRegionOptions - name is not defined", 2); - elseif(type(name) ~= "string") then - error("Improper arguments to WeakAuras.RegisterSubRegionOptions - name is not a string", 2); - elseif not(createFunction) then - error("Improper arguments to WeakAuras.RegisterSubRegionOptions - creation function is not defined", 2); - elseif(type(createFunction) ~= "function") then - error("Improper arguments to WeakAuras.RegisterSubRegionOptions - creation function is not a function", 2); - elseif(subRegionOptions[name]) then - error("Improper arguments to WeakAuras.RegisterSubRegionOptions - region type \""..name.."\" already defined", 2); + if not name then + error("Improper arguments to WeakAuras.RegisterSubRegionOptions - name is not defined", 2) + elseif type(name) ~= "string" then + error("Improper arguments to WeakAuras.RegisterSubRegionOptions - name is not a string", 2) + elseif not createFunction then + error("Improper arguments to WeakAuras.RegisterSubRegionOptions - creation function is not defined", 2) + elseif type(createFunction) ~= "function" then + error("Improper arguments to WeakAuras.RegisterSubRegionOptions - creation function is not a function", 2) + elseif subRegionOptions[name] then + error("Improper arguments to WeakAuras.RegisterSubRegionOptions - region type \"" .. name .. "\" already defined", 2) else subRegionOptions[name] = { create = createFunction, description = description, - }; + } end end -- This function is replaced in WeakAurasOptions.lua function WeakAuras.IsOptionsOpen() - return false; + return false end function Private.ParseNumber(numString) - if not(numString and type(numString) == "string") then - if(type(numString) == "number") then - return numString, "notastring"; + if not (numString and type(numString) == "string") then + if type(numString) == "number" then + return numString, "notastring" else - return nil; + return nil end - elseif(numString:sub(-1) == "%") then - local percent = tonumber(numString:sub(1, -2)); - if(percent) then - return percent / 100, "percent"; + elseif numString:sub(-1) == "%" then + local percent = tonumber(numString:sub(1, -2)) + if percent then + return percent / 100, "percent" else - return nil; + return nil end else -- Matches any string with two integers separated by a forward slash -- Captures the two integers - local _, _, numerator, denominator = numString:find("(%d+)%s*/%s*(%d+)"); - numerator, denominator = tonumber(numerator), tonumber(denominator); - if(numerator and denominator) then - if(denominator == 0) then - return nil; + local _, _, numerator, denominator = numString:find("(%d+)%s*/%s*(%d+)") + numerator, denominator = tonumber(numerator), tonumber(denominator) + if numerator and denominator then + if denominator == 0 then + return nil else - return numerator / denominator, "fraction"; + return numerator / denominator, "fraction" end else local num = tonumber(numString) - if(num) then - if(math.floor(num) ~= num) then - return num, "decimal"; + if num then + if math.floor(num) ~= num then + return num, "decimal" else - return num, "whole"; + return num, "whole" end else - return nil; + return nil end end end @@ -592,80 +616,85 @@ end -- Used for the load function, could be simplified a bit -- It used to be also used for the generic trigger system local function ConstructFunction(prototype, trigger, skipOptional) - local input = {"event"}; - local required = {}; - local tests = {}; - local debug = {}; + local input = { "event" } + local required = {} + local tests = {} + local debug = {} local events = {} - local init; + local init local preambles = "" local orConjunctionGroups = {} - if(prototype.init) then - init = prototype.init(trigger); + if prototype.init then + init = prototype.init(trigger) else - init = ""; + init = "" end for index, arg in pairs(prototype.args) do - local enable = arg.type ~= "collpase"; - if(type(arg.enable) == "function") then - enable = arg.enable(trigger); + local enable = arg.type ~= "collpase" + if type(arg.enable) == "function" then + enable = arg.enable(trigger) elseif type(arg.enable) == "boolean" then enable = arg.enable end - if(enable) then - local name = arg.name; - if not(arg.name or arg.hidden) then - tinsert(input, "_"); + if enable then + local name = arg.name + if not (arg.name or arg.hidden) then + tinsert(input, "_") else - if(arg.init == "arg") then - tinsert(input, name); + if arg.init == "arg" then + tinsert(input, name) end - if (arg.optional and skipOptional) then + if arg.optional and skipOptional then -- Do nothing - elseif(arg.hidden or arg.type == "tristate" or arg.type == "toggle" or arg.type == "tristatestring" - or (arg.type == "multiselect" and trigger["use_"..name] ~= nil) - or ((trigger["use_"..name] or arg.required) and trigger[name])) then - if(arg.init and arg.init ~= "arg") then - init = init.."local "..name.." = "..arg.init.."\n"; + elseif + arg.hidden + or arg.type == "tristate" + or arg.type == "toggle" + or arg.type == "tristatestring" + or (arg.type == "multiselect" and trigger["use_" .. name] ~= nil) + or ((trigger["use_" .. name] or arg.required) and trigger[name]) + then + if arg.init and arg.init ~= "arg" then + init = init .. "local " .. name .. " = " .. arg.init .. "\n" end - local number = trigger[name] and tonumber(trigger[name]); - local test; - if(arg.type == "tristate") then - if(trigger["use_"..name] == false) then - test = "(not "..name..")"; - elseif(trigger["use_"..name]) then - if(arg.test) then - test = "("..arg.test:format(trigger[name])..")"; + local number = trigger[name] and tonumber(trigger[name]) + local test + if arg.type == "tristate" then + if trigger["use_" .. name] == false then + test = "(not " .. name .. ")" + elseif trigger["use_" .. name] then + if arg.test then + test = "(" .. arg.test:format(trigger[name]) .. ")" else - test = name; + test = name end end - elseif(arg.type == "tristatestring") then - if(trigger["use_"..name] == false) then - test = "("..name.. "~=".. (number or string.format("%s", Private.QuotedString(trigger[name] or ""))) .. ")" - elseif(trigger["use_"..name]) then - test = "("..name.. "==".. (number or string.format("%s", Private.QuotedString(trigger[name] or ""))) .. ")" + elseif arg.type == "tristatestring" then + if trigger["use_" .. name] == false then + test = "(" .. name .. "~=" .. (number or string.format("%s", Private.QuotedString(trigger[name] or ""))) .. ")" + elseif trigger["use_" .. name] then + test = "(" .. name .. "==" .. (number or string.format("%s", Private.QuotedString(trigger[name] or ""))) .. ")" end - elseif(arg.type == "multiselect") then + elseif arg.type == "multiselect" then if arg.multiNoSingle then -- convert single to multi -- this is a lazy migration because multiNoSingle is not set for all game versions - if trigger["use_"..name] == true then - trigger["use_"..name] = false + if trigger["use_" .. name] == true then + trigger["use_" .. name] = false trigger[name] = trigger[name] or {} - trigger[name].multi = {}; + trigger[name].multi = {} if trigger[name].single ~= nil then - trigger[name].multi[trigger[name].single] = true; + trigger[name].multi[trigger[name].single] = true trigger[name].single = nil end end end - if(trigger["use_"..name] == false) then -- multi selection - local any = false; - if (trigger[name] and trigger[name].multi) then - test = "("; + if trigger["use_" .. name] == false then -- multi selection + local any = false + if trigger[name] and trigger[name].multi then + test = "(" for value, positive in pairs(trigger[name].multi) do - local arg1 = tonumber(value) or ("[["..value.."]]") + local arg1 = tonumber(value) or ("[[" .. value .. "]]") local arg2 if arg.extraOption then arg2 = trigger[name .. "_extraOption"] or 0 @@ -679,24 +708,24 @@ local function ConstructFunction(prototype, trigger, skipOptional) if testEnabled then local check if not arg.test then - check = name.."=="..arg1 + check = name .. "==" .. arg1 else check = arg.test:format(arg1, arg2) end if arg.multiAll then - test = test..check.." and " + test = test .. check .. " and " else - test = test..check.." or " + test = test .. check .. " or " end - any = true; + any = true end end - if(any) then - test = test:sub(1, -6); + if any then + test = test:sub(1, -6) else - test = "(false"; + test = "(false" end - test = test..")" + test = test .. ")" if arg.inverse then if type(arg.inverse) == "boolean" then test = "not " .. test @@ -707,59 +736,59 @@ local function ConstructFunction(prototype, trigger, skipOptional) end end end - elseif(trigger["use_"..name]) then -- single selection - local value = trigger[name] and trigger[name].single; + elseif trigger["use_" .. name] then -- single selection + local value = trigger[name] and trigger[name].single if not arg.test then - test = trigger[name] and trigger[name].single and "("..name.."=="..(tonumber(value) or ("[["..value.."]]"))..")"; + test = trigger[name] and trigger[name].single and "(" .. name .. "==" .. (tonumber(value) or ("[[" .. value .. "]]")) .. ")" else - test = trigger[name] and trigger[name].single and "("..arg.test:format(tonumber(value) or ("[["..value.."]]"))..")"; + test = trigger[name] and trigger[name].single and "(" .. arg.test:format(tonumber(value) or ("[[" .. value .. "]]")) .. ")" end end - elseif(arg.type == "toggle") then - if(trigger["use_"..name]) then - if(arg.test) then - test = "("..arg.test:format(trigger[name])..")"; + elseif arg.type == "toggle" then + if trigger["use_" .. name] then + if arg.test then + test = "(" .. arg.test:format(trigger[name]) .. ")" else - test = name; + test = name end end - elseif (arg.type == "spell") then + elseif arg.type == "spell" then if arg.showExactOption then - test = "("..arg.test:format(trigger[name], tostring(trigger["use_exact_" .. name]) or "false") ..")"; + test = "(" .. arg.test:format(trigger[name], tostring(trigger["use_exact_" .. name]) or "false") .. ")" else - test = "("..arg.test:format(trigger[name])..")"; + test = "(" .. arg.test:format(trigger[name]) .. ")" end - elseif(arg.test) then - test = "("..arg.test:format(trigger[name])..")"; - elseif(arg.type == "longstring" and trigger[name.."_operator"]) then - if(trigger[name.."_operator"] == "==") then - test = "("..name.."==[["..trigger[name].."]])"; + elseif arg.test then + test = "(" .. arg.test:format(trigger[name]) .. ")" + elseif arg.type == "longstring" and trigger[name .. "_operator"] then + if trigger[name .. "_operator"] == "==" then + test = "(" .. name .. "==[[" .. trigger[name] .. "]])" else - test = "("..name..":"..trigger[name.."_operator"]:format(trigger[name])..")"; + test = "(" .. name .. ":" .. trigger[name .. "_operator"]:format(trigger[name]) .. ")" end - elseif(arg.type == "number") then + elseif arg.type == "number" then if number then - test = "("..name..(trigger[name.."_operator"] or "==").. number ..")"; + test = "(" .. name .. (trigger[name .. "_operator"] or "==") .. number .. ")" end else - if(type(trigger[name]) == "table") then - trigger[name] = "error"; + if type(trigger[name]) == "table" then + trigger[name] = "error" end - test = "("..name..(trigger[name.."_operator"] or "==")..(number or ("[["..(trigger[name] or "").."]]"))..")"; + test = "(" .. name .. (trigger[name .. "_operator"] or "==") .. (number or ("[[" .. (trigger[name] or "") .. "]]")) .. ")" end - if (arg.preamble) then + if arg.preamble then preambles = preambles .. arg.preamble:format(trigger[name]) .. "\n" end if test ~= "(test)" then - if(arg.required) then - tinsert(required, test); + if arg.required then + tinsert(required, test) elseif test ~= nil then - if arg.orConjunctionGroup then - orConjunctionGroups[arg.orConjunctionGroup ] = orConjunctionGroups[arg.orConjunctionGroup ] or {} - tinsert(orConjunctionGroups[arg.orConjunctionGroup ], "("..test..")") + if arg.orConjunctionGroup then + orConjunctionGroups[arg.orConjunctionGroup] = orConjunctionGroups[arg.orConjunctionGroup] or {} + tinsert(orConjunctionGroups[arg.orConjunctionGroup], "(" .. test .. ")") else - tinsert(tests, test); + tinsert(tests, test) end end end @@ -770,68 +799,68 @@ local function ConstructFunction(prototype, trigger, skipOptional) end end - if(arg.debug) then - tinsert(debug, arg.debug:format(trigger[name])); + if arg.debug then + tinsert(debug, arg.debug:format(trigger[name])) end end end end end - for _, orConjunctionGroup in pairs(orConjunctionGroups) do - tinsert(tests, "("..table.concat(orConjunctionGroup , " or ")..")") + for _, orConjunctionGroup in pairs(orConjunctionGroups) do + tinsert(tests, "(" .. table.concat(orConjunctionGroup, " or ") .. ")") end - local ret = preambles .. "return function("..table.concat(input, ", ")..")\n"; - ret = ret..(init or ""); - ret = ret..(#debug > 0 and table.concat(debug, "\n") or ""); - ret = ret.."if("; - ret = ret..((#required > 0) and table.concat(required, " and ").." and " or ""); - ret = ret..(#tests > 0 and table.concat(tests, " and ") or "true"); - ret = ret..") then\n"; - if(#debug > 0) then - ret = ret.."print('ret: true');\n"; + local ret = preambles .. "return function(" .. table.concat(input, ", ") .. ")\n" + ret = ret .. (init or "") + ret = ret .. (#debug > 0 and table.concat(debug, "\n") or "") + ret = ret .. "if(" + ret = ret .. ((#required > 0) and table.concat(required, " and ") .. " and " or "") + ret = ret .. (#tests > 0 and table.concat(tests, " and ") or "true") + ret = ret .. ") then\n" + if #debug > 0 then + ret = ret .. "print('ret: true');\n" end - ret = ret.."return true else return false end end"; + ret = ret .. "return true else return false end end" - return ret, events; + return ret, events end function WeakAuras.GetActiveConditions(id, cloneId) - triggerState[id].activatedConditions[cloneId] = triggerState[id].activatedConditions[cloneId] or {}; - return triggerState[id].activatedConditions[cloneId]; + triggerState[id].activatedConditions[cloneId] = triggerState[id].activatedConditions[cloneId] or {} + return triggerState[id].activatedConditions[cloneId] end local function LoadCustomActionFunctions(data) - local id = data.id; - Private.customActionsFunctions[id] = {}; + local id = data.id + Private.customActionsFunctions[id] = {} - if (data.actions) then - if (data.actions.init and data.actions.init.do_custom and data.actions.init.custom) then - local func = WeakAuras.LoadFunction("return function() "..(data.actions.init.custom).."\n end"); - Private.customActionsFunctions[id]["init"] = func; + if data.actions then + if data.actions.init and data.actions.init.do_custom and data.actions.init.custom then + local func = WeakAuras.LoadFunction("return function() " .. data.actions.init.custom .. "\n end") + Private.customActionsFunctions[id]["init"] = func end - if (data.actions.start) then - if (data.actions.start.do_custom and data.actions.start.custom) then - local func = WeakAuras.LoadFunction("return function() "..(data.actions.start.custom).."\n end"); - Private.customActionsFunctions[id]["start"] = func; + if data.actions.start then + if data.actions.start.do_custom and data.actions.start.custom then + local func = WeakAuras.LoadFunction("return function() " .. data.actions.start.custom .. "\n end") + Private.customActionsFunctions[id]["start"] = func end - if (data.actions.start.do_message and data.actions.start.message_custom) then - local func = WeakAuras.LoadFunction("return "..(data.actions.start.message_custom)); - Private.customActionsFunctions[id]["start_message"] = func; + if data.actions.start.do_message and data.actions.start.message_custom then + local func = WeakAuras.LoadFunction("return " .. data.actions.start.message_custom) + Private.customActionsFunctions[id]["start_message"] = func end end - if (data.actions.finish) then - if (data.actions.finish.do_custom and data.actions.finish.custom) then - local func = WeakAuras.LoadFunction("return function() "..(data.actions.finish.custom).."\n end"); - Private.customActionsFunctions[id]["finish"] = func; + if data.actions.finish then + if data.actions.finish.do_custom and data.actions.finish.custom then + local func = WeakAuras.LoadFunction("return function() " .. data.actions.finish.custom .. "\n end") + Private.customActionsFunctions[id]["finish"] = func end - if (data.actions.finish.do_message and data.actions.finish.message_custom) then - local func = WeakAuras.LoadFunction("return "..(data.actions.finish.message_custom)); - Private.customActionsFunctions[id]["finish_message"] = func; + if data.actions.finish.do_message and data.actions.finish.message_custom then + local func = WeakAuras.LoadFunction("return " .. data.actions.finish.message_custom) + Private.customActionsFunctions[id]["finish_message"] = func end end end @@ -842,30 +871,30 @@ Private.pvp_talent_types_specific = {} local function CreateTalentCache() local _, player_class = UnitClass("player") - Private.talent_types_specific[player_class] = Private.talent_types_specific[player_class] or {}; + Private.talent_types_specific[player_class] = Private.talent_types_specific[player_class] or {} if WeakAuras.IsClassicOrBCCOrWrath() then for tab = 1, GetNumTalentTabs() do for num_talent = 1, GetNumTalents(tab) do - local talentName, talentIcon = GetTalentInfo(tab, num_talent); + local talentName, talentIcon = GetTalentInfo(tab, num_talent) local talentId = (tab - 1) * MAX_NUM_TALENTS + num_talent - if (talentName and talentIcon) then - Private.talent_types_specific[player_class][talentId] = "|T"..talentIcon..":0|t "..talentName + if talentName and talentIcon then + Private.talent_types_specific[player_class][talentId] = "|T" .. talentIcon .. ":0|t " .. talentName end end - end + end else local spec = GetSpecialization() - Private.talent_types_specific[player_class][spec] = Private.talent_types_specific[player_class][spec] or {}; + Private.talent_types_specific[player_class][spec] = Private.talent_types_specific[player_class][spec] or {} for tier = 1, MAX_TALENT_TIERS do for column = 1, NUM_TALENT_COLUMNS do -- Get name and icon info for the current talent of the current class and save it local _, talentName, talentIcon = GetTalentInfo(tier, column, 1) - local talentId = (tier-1)*3+column + local talentId = (tier - 1) * 3 + column -- Get the icon and name from the talent cache and record it in the table that will be used by WeakAurasOptions - if (talentName and talentIcon) then - Private.talent_types_specific[player_class][spec][talentId] = "|T"..talentIcon..":0|t "..talentName + if talentName and talentIcon then + Private.talent_types_specific[player_class][spec][talentId] = "|T" .. talentIcon .. ":0|t " .. talentName end end end @@ -876,26 +905,25 @@ local function CreatePvPTalentCache() local _, player_class = UnitClass("player") local spec = GetSpecialization() - if (not player_class or not spec) then - return; + if not player_class or not spec then + return end - Private.pvp_talent_types_specific[player_class] = Private.pvp_talent_types_specific[player_class] or {}; - Private.pvp_talent_types_specific[player_class][spec] = Private.pvp_talent_types_specific[player_class][spec] or {}; + Private.pvp_talent_types_specific[player_class] = Private.pvp_talent_types_specific[player_class] or {} + Private.pvp_talent_types_specific[player_class][spec] = Private.pvp_talent_types_specific[player_class][spec] or {} local function formatTalent(talentId) - local _, name, icon = GetPvpTalentInfoByID(talentId); - return "|T"..icon..":0|t "..name + local _, name, icon = GetPvpTalentInfoByID(talentId) + return "|T" .. icon .. ":0|t " .. name end - local slotInfo = C_SpecializationInfo.GetPvpTalentSlotInfo(1); - if (slotInfo) then - - Private.pvp_talent_types_specific[player_class][spec] = {}; + local slotInfo = C_SpecializationInfo.GetPvpTalentSlotInfo(1) + if slotInfo then + Private.pvp_talent_types_specific[player_class][spec] = {} - local pvpSpecTalents = slotInfo.availableTalentIDs; + local pvpSpecTalents = slotInfo.availableTalentIDs for i, talentId in ipairs(pvpSpecTalents) do - Private.pvp_talent_types_specific[player_class][spec][i] = formatTalent(talentId); + Private.pvp_talent_types_specific[player_class][spec][i] = formatTalent(talentId) end end end @@ -930,7 +958,7 @@ function Private.PostAddCompanion() end function Private.CountWagoUpdates() - if not (Private.CompanionData.slugs) then + if not Private.CompanionData.slugs then return 0 end local updatedSlugs, updatedSlugsCount = {}, 0 @@ -957,66 +985,68 @@ function Private.CountWagoUpdates() end local function tooltip_draw() - local tooltip = GameTooltip; - tooltip:ClearLines(); - tooltip:AddDoubleLine("WeakAuras", versionString); + local tooltip = GameTooltip + tooltip:ClearLines() + tooltip:AddDoubleLine("WeakAuras", versionString) if Private.CompanionData.slugs then local count = Private.CountWagoUpdates() if count > 0 then - tooltip:AddLine(" "); - tooltip:AddLine((L["There are %i updates to your auras ready to be installed!"]):format(count)); + tooltip:AddLine(" ") + tooltip:AddLine((L["There are %i updates to your auras ready to be installed!"]):format(count)) end end - tooltip:AddLine(" "); - tooltip:AddLine(L["|cffeda55fLeft-Click|r to toggle showing the main window."], 0.2, 1, 0.2); + tooltip:AddLine(" ") + tooltip:AddLine(L["|cffeda55fLeft-Click|r to toggle showing the main window."], 0.2, 1, 0.2) if not WeakAuras.IsOptionsOpen() then if paused then - tooltip:AddLine("|cFFFF0000"..L["Paused"].." - "..L["Shift-Click to resume addon execution."], 0.2, 1, 0.2); + tooltip:AddLine("|cFFFF0000" .. L["Paused"] .. " - " .. L["Shift-Click to resume addon execution."], 0.2, 1, 0.2) else - tooltip:AddLine(L["|cffeda55fShift-Click|r to pause addon execution."], 0.2, 1, 0.2); + tooltip:AddLine(L["|cffeda55fShift-Click|r to pause addon execution."], 0.2, 1, 0.2) end end - tooltip:AddLine(L["|cffeda55fRight-Click|r to toggle performance profiling window."], 0.2, 1, 0.2); - tooltip:AddLine(L["|cffeda55fMiddle-Click|r to toggle the minimap icon on or off."], 0.2, 1, 0.2); - tooltip:Show(); + tooltip:AddLine(L["|cffeda55fRight-Click|r to toggle performance profiling window."], 0.2, 1, 0.2) + tooltip:AddLine(L["|cffeda55fMiddle-Click|r to toggle the minimap icon on or off."], 0.2, 1, 0.2) + tooltip:Show() end -local colorFrame = CreateFrame("Frame"); -WeakAuras.frames["LDB Icon Recoloring"] = colorFrame; +local colorFrame = CreateFrame("Frame") +WeakAuras.frames["LDB Icon Recoloring"] = colorFrame -local colorElapsed = 0; -local colorDelay = 2; -local r, g, b = 0.8, 0, 1; -local r2, g2, b2 = random(2)-1, random(2)-1, random(2)-1; +local colorElapsed = 0 +local colorDelay = 2 +local r, g, b = 0.8, 0, 1 +local r2, g2, b2 = random(2) - 1, random(2) - 1, random(2) - 1 -local tooltip_update_frame = CreateFrame("Frame"); -WeakAuras.frames["LDB Tooltip Updater"] = tooltip_update_frame; +local tooltip_update_frame = CreateFrame("Frame") +WeakAuras.frames["LDB Tooltip Updater"] = tooltip_update_frame -- function copied from LibDBIcon-1.0.lua local function getAnchors(frame) - local x, y = frame:GetCenter() - if not x or not y then return "CENTER" end - local hHalf = (x > UIParent:GetWidth()*2/3) and "RIGHT" or (x < UIParent:GetWidth()/3) and "LEFT" or "" - local vHalf = (y > UIParent:GetHeight()/2) and "TOP" or "BOTTOM" - return vHalf..hHalf, frame, (vHalf == "TOP" and "BOTTOM" or "TOP")..hHalf + local x, y = frame:GetCenter() + if not x or not y then + return "CENTER" + end + local hHalf = (x > UIParent:GetWidth() * 2 / 3) and "RIGHT" or (x < UIParent:GetWidth() / 3) and "LEFT" or "" + local vHalf = (y > UIParent:GetHeight() / 2) and "TOP" or "BOTTOM" + return vHalf .. hHalf, frame, (vHalf == "TOP" and "BOTTOM" or "TOP") .. hHalf end -local Broker_WeakAuras; +local Broker_WeakAuras Broker_WeakAuras = LDB:NewDataObject("WeakAuras", { type = "launcher", text = "WeakAuras", icon = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\icon.blp", OnClick = function(self, button) - if button == 'LeftButton' then - if(IsShiftKeyDown()) then - if not(WeakAuras.IsOptionsOpen()) then - WeakAuras.Toggle(); + if button == "LeftButton" then + if IsShiftKeyDown() then + if not (WeakAuras.IsOptionsOpen()) then + WeakAuras.Toggle() end else - WeakAuras.OpenOptions(); + WeakAuras.OpenOptions() end - elseif(button == 'MiddleButton') then - Private.ToggleMinimap(); + elseif button == "MiddleButton" then + Private.ToggleMinimap() else WeakAuras.RealTimeProfilingWindow:Toggle() end @@ -1024,38 +1054,38 @@ Broker_WeakAuras = LDB:NewDataObject("WeakAuras", { end, OnEnter = function(self) colorFrame:SetScript("OnUpdate", function(self, elaps) - colorElapsed = colorElapsed + elaps; - if(colorElapsed > colorDelay) then - colorElapsed = colorElapsed - colorDelay; - r, g, b = r2, g2, b2; - r2, g2, b2 = random(2)-1, random(2)-1, random(2)-1; - end - Broker_WeakAuras.iconR = r + (r2 - r) * colorElapsed / colorDelay; - Broker_WeakAuras.iconG = g + (g2 - g) * colorElapsed / colorDelay; - Broker_WeakAuras.iconB = b + (b2 - b) * colorElapsed / colorDelay; - end); - local elapsed = 0; - local delay = 1; + colorElapsed = colorElapsed + elaps + if colorElapsed > colorDelay then + colorElapsed = colorElapsed - colorDelay + r, g, b = r2, g2, b2 + r2, g2, b2 = random(2) - 1, random(2) - 1, random(2) - 1 + end + Broker_WeakAuras.iconR = r + (r2 - r) * colorElapsed / colorDelay + Broker_WeakAuras.iconG = g + (g2 - g) * colorElapsed / colorDelay + Broker_WeakAuras.iconB = b + (b2 - b) * colorElapsed / colorDelay + end) + local elapsed = 0 + local delay = 1 tooltip_update_frame:SetScript("OnUpdate", function(self, elap) - elapsed = elapsed + elap; - if(elapsed > delay) then - elapsed = 0; - tooltip_draw(); + elapsed = elapsed + elap + if elapsed > delay then + elapsed = 0 + tooltip_draw() end - end); - GameTooltip:SetOwner(self, "ANCHOR_NONE"); + end) + GameTooltip:SetOwner(self, "ANCHOR_NONE") GameTooltip:SetPoint(getAnchors(self)) - tooltip_draw(); + tooltip_draw() end, OnLeave = function(self) - colorFrame:SetScript("OnUpdate", nil); - tooltip_update_frame:SetScript("OnUpdate", nil); - GameTooltip:Hide(); + colorFrame:SetScript("OnUpdate", nil) + tooltip_update_frame:SetScript("OnUpdate", nil) + GameTooltip:Hide() end, iconR = 0.6, iconG = 0, - iconB = 1 -}); + iconB = 1, +}) do -- Archive stuff local Archivist = select(2, ...).Archivist @@ -1092,11 +1122,11 @@ function Private.LoginMessage() end local function CheckForPreviousEncounter() - if (UnitAffectingCombat ("player") or InCombatLockdown()) then + if UnitAffectingCombat("player") or InCombatLockdown() then for i = 1, 10 do - if (UnitExists ("boss" .. i)) then - local guid = UnitGUID ("boss" .. i) - if (guid and db.CurrentEncounter.boss_guids [guid]) then + if UnitExists("boss" .. i) then + local guid = UnitGUID("boss" .. i) + if guid and db.CurrentEncounter.boss_guids[guid] then -- we are in the same encounter WeakAuras.CurrentEncounter = db.CurrentEncounter return true @@ -1111,7 +1141,7 @@ end function Private.Login(initialTime, takeNewSnapshots) local loginThread = coroutine.create(function() - Private.Pause(); + Private.Pause() if db.history then local histRepo = WeakAuras.LoadFromArchive("Repository", "history") @@ -1123,47 +1153,47 @@ function Private.Login(initialTime, takeNewSnapshots) end -- history is now in archive so we can shrink WeakAurasSaved db.history = nil - coroutine.yield(); + coroutine.yield() end - local toAdd = {}; + local toAdd = {} loginFinished = false loginMessage = L["Options will open after the login process has completed."] for id, data in pairs(db.displays) do - if(id ~= data.id) then - print("|cFF8800FFWeakAuras|r detected a corrupt entry in WeakAuras saved displays - '"..tostring(id).."' vs '"..tostring(data.id).."'" ); - data.id = id; + if id ~= data.id then + print("|cFF8800FFWeakAuras|r detected a corrupt entry in WeakAuras saved displays - '" .. tostring(id) .. "' vs '" .. tostring(data.id) .. "'") + data.id = id end - tinsert(toAdd, data); + tinsert(toAdd, data) end - coroutine.yield(); + coroutine.yield() - WeakAuras.AddMany(toAdd, takeNewSnapshots); - coroutine.yield(); + WeakAuras.AddMany(toAdd, takeNewSnapshots) + coroutine.yield() -- check in case of a disconnect during an encounter. - if (db.CurrentEncounter) then + if db.CurrentEncounter then CheckForPreviousEncounter() end - coroutine.yield(); - Private.RegisterLoadEvents(); - Private.Resume(); - coroutine.yield(); + coroutine.yield() + Private.RegisterLoadEvents() + Private.Resume() + coroutine.yield() - local nextCallback = loginQueue[1]; + local nextCallback = loginQueue[1] while nextCallback do - tremove(loginQueue, 1); - if type(nextCallback) == 'table' then + tremove(loginQueue, 1) + if type(nextCallback) == "table" then nextCallback[1](unpack(nextCallback[2])) else nextCallback() end - coroutine.yield(); - nextCallback = loginQueue[1]; + coroutine.yield() + nextCallback = loginQueue[1] end loginFinished = true - Private.ResumeAllDynamicGroups(); + Private.ResumeAllDynamicGroups() end) if initialTime then @@ -1171,74 +1201,75 @@ function Private.Login(initialTime, takeNewSnapshots) local finishTime = debugprofilestop() local ok, msg -- hard limit seems to be 19 seconds. We'll do 15 for now. - while coroutine.status(loginThread) ~= 'dead' and finishTime - startTime < 15000 do + while coroutine.status(loginThread) ~= "dead" and finishTime - startTime < 15000 do ok, msg = coroutine.resume(loginThread) finishTime = debugprofilestop() end - if coroutine.status(loginThread) ~= 'dead' then - Private.dynFrame:AddAction('login', loginThread) + if coroutine.status(loginThread) ~= "dead" then + Private.dynFrame:AddAction("login", loginThread) end if not ok then loginMessage = L["WeakAuras has encountered an error during the login process. Please report this issue at https://github.com/WeakAuras/Weakauras2/issues/new."] - .. "\nMessage:" .. msg - geterrorhandler()(msg .. '\n' .. debugstack(loginThread)) + .. "\nMessage:" + .. msg + geterrorhandler()(msg .. "\n" .. debugstack(loginThread)) end else - Private.dynFrame:AddAction('login', loginThread) + Private.dynFrame:AddAction("login", loginThread) end end -local WeakAurasFrame = CreateFrame("Frame", "WeakAurasFrame", UIParent); -WeakAuras.frames["WeakAuras Main Frame"] = WeakAurasFrame; -WeakAurasFrame:SetAllPoints(UIParent); +local WeakAurasFrame = CreateFrame("Frame", "WeakAurasFrame", UIParent) +WeakAuras.frames["WeakAuras Main Frame"] = WeakAurasFrame +WeakAurasFrame:SetAllPoints(UIParent) -local loadedFrame = CreateFrame("Frame"); -WeakAuras.frames["Addon Initialization Handler"] = loadedFrame; -loadedFrame:RegisterEvent("ADDON_LOADED"); -loadedFrame:RegisterEvent("PLAYER_LOGIN"); -loadedFrame:RegisterEvent("PLAYER_ENTERING_WORLD"); -loadedFrame:RegisterEvent("LOADING_SCREEN_ENABLED"); -loadedFrame:RegisterEvent("LOADING_SCREEN_DISABLED"); +local loadedFrame = CreateFrame("Frame") +WeakAuras.frames["Addon Initialization Handler"] = loadedFrame +loadedFrame:RegisterEvent("ADDON_LOADED") +loadedFrame:RegisterEvent("PLAYER_LOGIN") +loadedFrame:RegisterEvent("PLAYER_ENTERING_WORLD") +loadedFrame:RegisterEvent("LOADING_SCREEN_ENABLED") +loadedFrame:RegisterEvent("LOADING_SCREEN_DISABLED") if WeakAuras.IsRetail() then - loadedFrame:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED"); - loadedFrame:RegisterEvent("PLAYER_PVP_TALENT_UPDATE"); + loadedFrame:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED") + loadedFrame:RegisterEvent("PLAYER_PVP_TALENT_UPDATE") else - loadedFrame:RegisterEvent("CHARACTER_POINTS_CHANGED"); - loadedFrame:RegisterEvent("SPELLS_CHANGED"); + loadedFrame:RegisterEvent("CHARACTER_POINTS_CHANGED") + loadedFrame:RegisterEvent("SPELLS_CHANGED") end loadedFrame:SetScript("OnEvent", function(self, event, addon) - if(event == "ADDON_LOADED") then - if(addon == ADDON_NAME) then - WeakAurasSaved = WeakAurasSaved or {}; - db = WeakAurasSaved; + if event == "ADDON_LOADED" then + if addon == ADDON_NAME then + WeakAurasSaved = WeakAurasSaved or {} + db = WeakAurasSaved -- Defines the action squelch period after login -- Stored in SavedVariables so it can be changed by the user if they find it necessary - db.login_squelch_time = db.login_squelch_time or 10; + db.login_squelch_time = db.login_squelch_time or 10 -- Deprecated fields with *lots* of data, clear them out - db.iconCache = nil; - db.iconHash = nil; - db.tempIconCache = nil; - db.dynamicIconCache = db.dynamicIconCache or {}; + db.iconCache = nil + db.iconHash = nil + db.tempIconCache = nil + db.dynamicIconCache = db.dynamicIconCache or {} - db.displays = db.displays or {}; - db.registered = db.registered or {}; + db.displays = db.displays or {} + db.registered = db.registered or {} - Private.UpdateCurrentInstanceType(); - Private.SyncParentChildRelationships(); - local isFirstUIDValidation = db.dbVersion == nil or db.dbVersion < 26; - Private.ValidateUniqueDataIds(isFirstUIDValidation); + Private.UpdateCurrentInstanceType() + Private.SyncParentChildRelationships() + local isFirstUIDValidation = db.dbVersion == nil or db.dbVersion < 26 + Private.ValidateUniqueDataIds(isFirstUIDValidation) if db.lastArchiveClear == nil then - db.lastArchiveClear = time(); + db.lastArchiveClear = time() elseif db.lastArchiveClear < time() - 86400 then - Private.CleanArchive(db.historyCutoff, db.migrationCutoff); + Private.CleanArchive(db.historyCutoff, db.migrationCutoff) end - db.minimap = db.minimap or { hide = false }; - LDBIcon:Register("WeakAuras", Broker_WeakAuras, db.minimap); + db.minimap = db.minimap or { hide = false } + LDBIcon:Register("WeakAuras", Broker_WeakAuras, db.minimap) end - elseif(event == "PLAYER_LOGIN") then + elseif event == "PLAYER_LOGIN" then local dbIsValid, takeNewSnapshots if not db.dbVersion or db.dbVersion < internalVersion then -- db is out of date, will run any necessary migrations in AddMany @@ -1258,35 +1289,37 @@ loadedFrame:SetScript("OnEvent", function(self, event, addon) Private.Login(15000, takeNewSnapshots) else -- db isn't valid. Request permission to run repair tool before logging in - StaticPopup_Show("WEAKAURAS_CONFIRM_REPAIR", nil, nil, {reason = "downgrade"}) + StaticPopup_Show("WEAKAURAS_CONFIRM_REPAIR", nil, nil, { reason = "downgrade" }) end - elseif(event == "LOADING_SCREEN_ENABLED") then - in_loading_screen = true; - elseif(event == "LOADING_SCREEN_DISABLED") then - in_loading_screen = false; + elseif event == "LOADING_SCREEN_ENABLED" then + in_loading_screen = true + elseif event == "LOADING_SCREEN_DISABLED" then + in_loading_screen = false else local callback - if(event == "PLAYER_ENTERING_WORLD") then + if event == "PLAYER_ENTERING_WORLD" then -- Schedule events that need to be handled some time after login local now = GetTime() callback = function() local elapsed = GetTime() - now local remainingSquelch = db.login_squelch_time - elapsed if remainingSquelch > 0 then - timer:ScheduleTimer(function() squelch_actions = false; end, remainingSquelch); -- No sounds while loading + timer:ScheduleTimer(function() + squelch_actions = false + end, remainingSquelch) -- No sounds while loading end CreateTalentCache() -- It seems that GetTalentInfo might give info about whatever class was previously being played, until PLAYER_ENTERING_WORLD - Private.UpdateCurrentInstanceType(); + Private.UpdateCurrentInstanceType() Private.InitializeEncounterAndZoneLists() end Private.PostAddCompanion() - elseif(event == "PLAYER_PVP_TALENT_UPDATE") then - callback = CreatePvPTalentCache; - elseif(event == "ACTIVE_TALENT_GROUP_CHANGED" or event == "CHARACTER_POINTS_CHANGED" or event == "SPELLS_CHANGED") then - callback = CreateTalentCache; - elseif(event == "PLAYER_REGEN_ENABLED") then + elseif event == "PLAYER_PVP_TALENT_UPDATE" then + callback = CreatePvPTalentCache + elseif event == "ACTIVE_TALENT_GROUP_CHANGED" or event == "CHARACTER_POINTS_CHANGED" or event == "SPELLS_CHANGED" then + callback = CreateTalentCache + elseif event == "PLAYER_REGEN_ENABLED" then callback = function() - if (queueshowooc) then + if queueshowooc then WeakAuras.OpenOptions(queueshowooc) queueshowooc = nil WeakAuras.frames["Addon Initialization Handler"]:UnregisterEvent("PLAYER_REGEN_ENABLED") @@ -1302,15 +1335,15 @@ loadedFrame:SetScript("OnEvent", function(self, event, addon) end) function Private.SetImporting(b) - importing = b; + importing = b end function WeakAuras.IsImporting() - return importing; + return importing end function WeakAuras.IsPaused() - return paused; + return paused end function Private.Pause() @@ -1324,37 +1357,37 @@ function Private.Pause() end end - paused = true; + paused = true end function WeakAuras.Toggle() - if(paused) then - Private.Resume(); + if paused then + Private.Resume() else - Private.Pause(); + Private.Pause() end end function Private.SquelchingActions() - return squelch_actions; + return squelch_actions end function WeakAuras.InLoadingScreen() - return in_loading_screen; + return in_loading_screen end function Private.PauseAllDynamicGroups() for id, region in pairs(regions) do - if (region.region.Suspend) then - region.region:Suspend(); + if region.region.Suspend then + region.region:Suspend() end end end function Private.ResumeAllDynamicGroups() for id, region in pairs(regions) do - if (region.region.Resume) then - region.region:Resume(); + if region.region.Resume then + region.region:Resume() end end end @@ -1362,12 +1395,12 @@ end -- Encounter stuff local function StoreBossGUIDs() Private.StartProfileSystem("boss_guids") - if (WeakAuras.CurrentEncounter and WeakAuras.CurrentEncounter.boss_guids) then + if WeakAuras.CurrentEncounter and WeakAuras.CurrentEncounter.boss_guids then for i = 1, 10 do - if (UnitExists ("boss" .. i)) then - local guid = UnitGUID ("boss" .. i) - if (guid) then - WeakAuras.CurrentEncounter.boss_guids [guid] = true + if UnitExists("boss" .. i) then + local guid = UnitGUID("boss" .. i) + if guid then + WeakAuras.CurrentEncounter.boss_guids[guid] = true end end end @@ -1377,7 +1410,7 @@ local function StoreBossGUIDs() end local function DestroyEncounterTable() - if (WeakAuras.CurrentEncounter) then + if WeakAuras.CurrentEncounter then wipe(WeakAuras.CurrentEncounter) end WeakAuras.CurrentEncounter = nil @@ -1398,19 +1431,19 @@ end local encounterScriptsDeferred = {} local function LoadEncounterInitScriptsImpl(id) - if (currentInstanceType ~= "raid") then + if currentInstanceType ~= "raid" then return end - if (id) then + if id then local data = db.displays[id] - if (data and data.load.use_encounterid and not Private.IsEnvironmentInitialized(id) and data.actions.init and data.actions.init.do_custom) then + if data and data.load.use_encounterid and not Private.IsEnvironmentInitialized(id) and data.actions.init and data.actions.init.do_custom then Private.ActivateAuraEnvironment(id) Private.ActivateAuraEnvironment(nil) end encounterScriptsDeferred[id] = nil else for id, data in pairs(db.displays) do - if (data.load.use_encounterid and not Private.IsEnvironmentInitialized(id) and data.actions.init and data.actions.init.do_custom) then + if data.load.use_encounterid and not Private.IsEnvironmentInitialized(id) and data.actions.init and data.actions.init.do_custom then Private.ActivateAuraEnvironment(id) Private.ActivateAuraEnvironment(nil) end @@ -1423,7 +1456,7 @@ local function LoadEncounterInitScripts(id) if encounterScriptsDeferred[id] then return end - loginQueue[#loginQueue + 1] = {LoadEncounterInitScriptsImpl, {id}} + loginQueue[#loginQueue + 1] = { LoadEncounterInitScriptsImpl, { id } } encounterScriptsDeferred[id] = true return end @@ -1431,37 +1464,37 @@ local function LoadEncounterInitScripts(id) end function Private.UpdateCurrentInstanceType(instanceType) - if (not IsInInstance()) then + if not IsInInstance() then currentInstanceType = "none" else - currentInstanceType = instanceType or select (2, GetInstanceInfo()) + currentInstanceType = instanceType or select(2, GetInstanceInfo()) end end -local pausedOptionsProcessing = false; +local pausedOptionsProcessing = false function Private.pauseOptionsProcessing(enable) - pausedOptionsProcessing = enable; + pausedOptionsProcessing = enable end function Private.IsOptionsProcessingPaused() - return pausedOptionsProcessing; + return pausedOptionsProcessing end function WeakAuras.GroupType() - if (IsInRaid()) then - return "raid"; + if IsInRaid() then + return "raid" end - if (IsInGroup()) then - return "group"; + if IsInGroup() then + return "group" end - return "solo"; + return "solo" end local function GetInstanceTypeAndSize() local size, difficulty local inInstance, Type = IsInInstance() local _, instanceType, difficultyIndex, _, _, _, _, ZoneMapID = GetInstanceInfo() - if (inInstance) then + if inInstance then size = Type local difficultyInfo = Private.difficulty_info[difficultyIndex] if difficultyInfo then @@ -1497,10 +1530,10 @@ function WeakAuras.InstanceTypeRaw() end local toLoad = {} -local toUnload = {}; +local toUnload = {} local function scanForLoadsImpl(toCheck, event, arg1, ...) - if (Private.IsOptionsProcessingPaused()) then - return; + if Private.IsOptionsProcessingPaused() then + return end toCheck = toCheck or loadEvents[event or "SCAN_ALL"] @@ -1508,10 +1541,12 @@ local function scanForLoadsImpl(toCheck, event, arg1, ...) -- PET_BATTLE_CLOSE fires twice at the end of a pet battle. IsInBattle evaluates to TRUE during the -- first firing, and FALSE during the second. I am not sure if this check is necessary, but the -- following IF statement limits the impact of the PET_BATTLE_CLOSE event to the second one. - if (event == "PET_BATTLE_CLOSE" and C_PetBattles.IsInBattle()) then return end + if event == "PET_BATTLE_CLOSE" and C_PetBattles.IsInBattle() then + return + end - if (event == "PLAYER_LEVEL_UP") then - playerLevel = arg1; + if event == "PLAYER_LEVEL_UP" then + playerLevel = arg1 end -- encounter id stuff, we are holding the current combat id to further load checks. @@ -1519,10 +1554,10 @@ local function scanForLoadsImpl(toCheck, event, arg1, ...) -- regen_enabled isn't good due to combat drop abilities such invisibility, vanish, fake death, etc. local encounter_id = WeakAuras.CurrentEncounter and WeakAuras.CurrentEncounter.id or 0 - if (event == "ENCOUNTER_START") then - encounter_id = tonumber (arg1) - CreateEncounterTable (encounter_id) - elseif (event == "ENCOUNTER_END") then + if event == "ENCOUNTER_START" then + encounter_id = tonumber(arg1) + CreateEncounterTable(encounter_id) + elseif event == "ENCOUNTER_END" then encounter_id = 0 DestroyEncounterTable() end @@ -1540,8 +1575,8 @@ local function scanForLoadsImpl(toCheck, event, arg1, ...) local faction = UnitFactionGroup("player") local _, class = UnitClass("player") local inCombat = UnitAffectingCombat("player") - local inEncounter = encounter_id ~= 0; - local alive = not UnitIsDeadOrGhost('player') + local inEncounter = encounter_id ~= 0 + local alive = not UnitIsDeadOrGhost("player") local isLeader = UnitIsGroupLeader("player") if WeakAuras.IsClassicOrBCCOrWrath() then @@ -1556,10 +1591,10 @@ local function scanForLoadsImpl(toCheck, event, arg1, ...) if role == "NONE" then role = GetTalentGroupRole(GetActiveTalentGroup()) or "NONE" end - vehicle = UnitInVehicle('player') or UnitOnTaxi('player') - vehicleUi = UnitHasVehicleUI('player') or HasOverrideActionBar() or HasVehicleActionBar() + vehicle = UnitInVehicle("player") or UnitOnTaxi("player") + vehicleUi = UnitHasVehicleUI("player") or HasOverrideActionBar() or HasVehicleActionBar() else - vehicle = UnitOnTaxi('player') + vehicle = UnitOnTaxi("player") end else spec = GetSpecialization() @@ -1567,22 +1602,22 @@ local function scanForLoadsImpl(toCheck, event, arg1, ...) role = select(5, GetSpecializationInfo(spec)) covenant = C_Covenants.GetActiveCovenantID() inPetBattle = C_PetBattles.IsInBattle() - vehicle = UnitInVehicle('player') or UnitOnTaxi('player') - vehicleUi = UnitHasVehicleUI('player') or HasOverrideActionBar() or HasVehicleActionBar() + vehicle = UnitInVehicle("player") or UnitOnTaxi("player") + vehicleUi = UnitHasVehicleUI("player") or HasOverrideActionBar() or HasVehicleActionBar() end local size, difficulty, instanceType, ZoneMapID, difficultyIndex = GetInstanceTypeAndSize() Private.UpdateCurrentInstanceType(instanceType) - if (WeakAuras.CurrentEncounter) then - if (ZoneMapID ~= WeakAuras.CurrentEncounter.zone_id and not inCombat) then + if WeakAuras.CurrentEncounter then + if ZoneMapID ~= WeakAuras.CurrentEncounter.zone_id and not inCombat then encounter_id = 0 DestroyEncounterTable() end end - if (event == "ZONE_CHANGED_NEW_AREA") then - LoadEncounterInitScripts(); + if event == "ZONE_CHANGED_NEW_AREA" then + LoadEncounterInitScripts() end local group = WeakAuras.GroupType() @@ -1591,89 +1626,285 @@ local function scanForLoadsImpl(toCheck, event, arg1, ...) if WeakAuras.IsRetail() then effectiveLevel = UnitEffectiveLevel("player") affixes = C_ChallengeMode.IsChallengeModeActive() and select(2, C_ChallengeMode.GetActiveKeystoneInfo()) - warmodeActive = C_PvP.IsWarModeDesired(); + warmodeActive = C_PvP.IsWarModeDesired() end - local changed = 0; - local shouldBeLoaded, couldBeLoaded; + local changed = 0 + local shouldBeLoaded, couldBeLoaded local parentsToCheck = {} - wipe(toLoad); - wipe(toUnload); + wipe(toLoad) + wipe(toUnload) for id in pairs(toCheck) do local data = WeakAuras.GetData(id) - if (data and not data.controlledChildren) then - local loadFunc = loadFuncs[id]; - local loadOpt = loadFuncsForOptions[id]; + if data and not data.controlledChildren then + local loadFunc = loadFuncs[id] + local loadOpt = loadFuncsForOptions[id] if WeakAuras.IsClassic() then - shouldBeLoaded = loadFunc and loadFunc("ScanForLoads_Auras", inCombat, inEncounter, alive, vehicle, group, player, realm, class, race, faction, playerLevel, zone, encounter_id, size, raidRole, isLeader); - couldBeLoaded = loadOpt and loadOpt("ScanForLoads_Auras", inCombat, inEncounter, alive, vehicle, group, player, realm, class, race, faction, playerLevel, zone, encounter_id, size, raidRole, isLeader); + shouldBeLoaded = loadFunc + and loadFunc( + "ScanForLoads_Auras", + inCombat, + inEncounter, + alive, + vehicle, + group, + player, + realm, + class, + race, + faction, + playerLevel, + zone, + encounter_id, + size, + raidRole, + isLeader + ) + couldBeLoaded = loadOpt + and loadOpt( + "ScanForLoads_Auras", + inCombat, + inEncounter, + alive, + vehicle, + group, + player, + realm, + class, + race, + faction, + playerLevel, + zone, + encounter_id, + size, + raidRole, + isLeader + ) elseif WeakAuras.IsBCC() then - shouldBeLoaded = loadFunc and loadFunc("ScanForLoads_Auras", inCombat, inEncounter, alive, vehicle, group, player, realm, class, race, faction, playerLevel, zone, zoneId, zonegroupId, encounter_id, size, difficulty, difficultyIndex, raidRole, isLeader); - couldBeLoaded = loadOpt and loadOpt("ScanForLoads_Auras", inCombat, inEncounter, alive, vehicle, group, player, realm, class, race, faction, playerLevel, zone, zoneId, zonegroupId, encounter_id, size, difficulty, difficultyIndex, raidRole, isLeader); + shouldBeLoaded = loadFunc + and loadFunc( + "ScanForLoads_Auras", + inCombat, + inEncounter, + alive, + vehicle, + group, + player, + realm, + class, + race, + faction, + playerLevel, + zone, + zoneId, + zonegroupId, + encounter_id, + size, + difficulty, + difficultyIndex, + raidRole, + isLeader + ) + couldBeLoaded = loadOpt + and loadOpt( + "ScanForLoads_Auras", + inCombat, + inEncounter, + alive, + vehicle, + group, + player, + realm, + class, + race, + faction, + playerLevel, + zone, + zoneId, + zonegroupId, + encounter_id, + size, + difficulty, + difficultyIndex, + raidRole, + isLeader + ) elseif WeakAuras.IsWrathClassic() then - shouldBeLoaded = loadFunc and loadFunc("ScanForLoads_Auras", inCombat, inEncounter, alive, vehicle, vehicleUi, group, player, realm, class, race, faction, playerLevel, zone, zoneId, zonegroupId, encounter_id, size, difficulty, difficultyIndex, role, raidRole, isLeader); - couldBeLoaded = loadOpt and loadOpt("ScanForLoads_Auras", inCombat, inEncounter, alive, vehicle, vehicleUi, group, player, realm, class, race, faction, playerLevel, zone, zoneId, zonegroupId, encounter_id, size, difficulty, difficultyIndex, role, raidRole, isLeader); + shouldBeLoaded = loadFunc + and loadFunc( + "ScanForLoads_Auras", + inCombat, + inEncounter, + alive, + vehicle, + vehicleUi, + group, + player, + realm, + class, + race, + faction, + playerLevel, + zone, + zoneId, + zonegroupId, + encounter_id, + size, + difficulty, + difficultyIndex, + role, + raidRole, + isLeader + ) + couldBeLoaded = loadOpt + and loadOpt( + "ScanForLoads_Auras", + inCombat, + inEncounter, + alive, + vehicle, + vehicleUi, + group, + player, + realm, + class, + race, + faction, + playerLevel, + zone, + zoneId, + zonegroupId, + encounter_id, + size, + difficulty, + difficultyIndex, + role, + raidRole, + isLeader + ) elseif WeakAuras.IsRetail() then - shouldBeLoaded = loadFunc and loadFunc("ScanForLoads_Auras", inCombat, inEncounter, alive, warmodeActive, inPetBattle, vehicle, vehicleUi, group, player, realm, class, spec, specId, covenant, race, faction, playerLevel, effectiveLevel, zone, zoneId, zonegroupId, encounter_id, size, difficulty, difficultyIndex, role, isLeader, affixes); - couldBeLoaded = loadOpt and loadOpt("ScanForLoads_Auras", inCombat, inEncounter, alive, warmodeActive, inPetBattle, vehicle, vehicleUi, group, player, realm, class, spec, specId, covenant, race, faction, playerLevel, effectiveLevel, zone, zoneId, zonegroupId, encounter_id, size, difficulty, difficultyIndex, role, isLeader, affixes); - end - - if(shouldBeLoaded and not loaded[id]) then - changed = changed + 1; - toLoad[id] = true; + shouldBeLoaded = loadFunc + and loadFunc( + "ScanForLoads_Auras", + inCombat, + inEncounter, + alive, + warmodeActive, + inPetBattle, + vehicle, + vehicleUi, + group, + player, + realm, + class, + spec, + specId, + covenant, + race, + faction, + playerLevel, + effectiveLevel, + zone, + zoneId, + zonegroupId, + encounter_id, + size, + difficulty, + difficultyIndex, + role, + isLeader, + affixes + ) + couldBeLoaded = loadOpt + and loadOpt( + "ScanForLoads_Auras", + inCombat, + inEncounter, + alive, + warmodeActive, + inPetBattle, + vehicle, + vehicleUi, + group, + player, + realm, + class, + spec, + specId, + covenant, + race, + faction, + playerLevel, + effectiveLevel, + zone, + zoneId, + zonegroupId, + encounter_id, + size, + difficulty, + difficultyIndex, + role, + isLeader, + affixes + ) + end + + if shouldBeLoaded and not loaded[id] then + changed = changed + 1 + toLoad[id] = true for parent in Private.TraverseParents(data) do parentsToCheck[parent.id] = true end end - if(loaded[id] and not shouldBeLoaded) then - toUnload[id] = true; - changed = changed + 1; + if loaded[id] and not shouldBeLoaded then + toUnload[id] = true + changed = changed + 1 for parent in Private.TraverseParents(data) do parentsToCheck[parent.id] = true end end - if(shouldBeLoaded) then - loaded[id] = true; - elseif(couldBeLoaded) then - loaded[id] = false; + if shouldBeLoaded then + loaded[id] = true + elseif couldBeLoaded then + loaded[id] = false else - loaded[id] = nil; + loaded[id] = nil end end end - if(changed > 0 and not paused) then - Private.LoadDisplays(toLoad, event, arg1, ...); - Private.UnloadDisplays(toUnload, event, arg1, ...); - Private.FinishLoadUnload(); + if changed > 0 and not paused then + Private.LoadDisplays(toLoad, event, arg1, ...) + Private.UnloadDisplays(toUnload, event, arg1, ...) + Private.FinishLoadUnload() end Private.ScanForLoadsGroup(parentsToCheck) Private.callbacks:Fire("ScanForLoads") - wipe(toLoad); + wipe(toLoad) wipe(toUnload) end function Private.ScanForLoadsGroup(toCheck) for id in pairs(toCheck) do local data = WeakAuras.GetData(id) - if(data.controlledChildren) then - if(#data.controlledChildren > 0) then - local any_loaded = false; + if data.controlledChildren then + if #data.controlledChildren > 0 then + local any_loaded = false for child in Private.TraverseLeafs(data) do - if(loaded[child.id] ~= nil) then - any_loaded = true; - break; + if loaded[child.id] ~= nil then + any_loaded = true + break else any_loaded = nil end end - loaded[id] = any_loaded; + loaded[id] = any_loaded else - loaded[id] = true; + loaded[id] = true end end end @@ -1686,22 +1917,22 @@ function Private.ScanForLoads(toCheck, event, arg1, ...) scanForLoadsImpl(toCheck, event, arg1, ...) end -local loadFrame = CreateFrame("Frame"); -WeakAuras.loadFrame = loadFrame; -WeakAuras.frames["Display Load Handling"] = loadFrame; +local loadFrame = CreateFrame("Frame") +WeakAuras.loadFrame = loadFrame +WeakAuras.frames["Display Load Handling"] = loadFrame -loadFrame:RegisterEvent("ENCOUNTER_START"); -loadFrame:RegisterEvent("ENCOUNTER_END"); +loadFrame:RegisterEvent("ENCOUNTER_START") +loadFrame:RegisterEvent("ENCOUNTER_END") if WeakAuras.IsRetail() then - loadFrame:RegisterEvent("PLAYER_TALENT_UPDATE"); - loadFrame:RegisterEvent("PLAYER_PVP_TALENT_UPDATE"); - loadFrame:RegisterEvent("PLAYER_DIFFICULTY_CHANGED"); - loadFrame:RegisterEvent("PET_BATTLE_OPENING_START"); - loadFrame:RegisterEvent("PET_BATTLE_CLOSE"); - loadFrame:RegisterEvent("VEHICLE_UPDATE"); + loadFrame:RegisterEvent("PLAYER_TALENT_UPDATE") + loadFrame:RegisterEvent("PLAYER_PVP_TALENT_UPDATE") + loadFrame:RegisterEvent("PLAYER_DIFFICULTY_CHANGED") + loadFrame:RegisterEvent("PET_BATTLE_OPENING_START") + loadFrame:RegisterEvent("PET_BATTLE_CLOSE") + loadFrame:RegisterEvent("VEHICLE_UPDATE") loadFrame:RegisterEvent("UPDATE_VEHICLE_ACTIONBAR") - loadFrame:RegisterEvent("UPDATE_OVERRIDE_ACTIONBAR"); + loadFrame:RegisterEvent("UPDATE_OVERRIDE_ACTIONBAR") loadFrame:RegisterEvent("CHALLENGE_MODE_COMPLETED") loadFrame:RegisterEvent("CHALLENGE_MODE_START") loadFrame:RegisterEvent("COVENANT_CHOSEN") @@ -1709,20 +1940,20 @@ else loadFrame:RegisterEvent("CHARACTER_POINTS_CHANGED") end if WeakAuras.IsWrathClassic() then - loadFrame:RegisterEvent("PLAYER_TALENT_UPDATE"); - loadFrame:RegisterEvent("VEHICLE_UPDATE"); + loadFrame:RegisterEvent("PLAYER_TALENT_UPDATE") + loadFrame:RegisterEvent("VEHICLE_UPDATE") loadFrame:RegisterEvent("UPDATE_VEHICLE_ACTIONBAR") - loadFrame:RegisterEvent("UPDATE_OVERRIDE_ACTIONBAR"); -end -loadFrame:RegisterEvent("GROUP_ROSTER_UPDATE"); -loadFrame:RegisterEvent("ZONE_CHANGED"); -loadFrame:RegisterEvent("ZONE_CHANGED_INDOORS"); -loadFrame:RegisterEvent("ZONE_CHANGED_NEW_AREA"); -loadFrame:RegisterEvent("PLAYER_LEVEL_UP"); -loadFrame:RegisterEvent("PLAYER_REGEN_DISABLED"); -loadFrame:RegisterEvent("PLAYER_REGEN_ENABLED"); -loadFrame:RegisterEvent("PLAYER_ROLES_ASSIGNED"); -loadFrame:RegisterEvent("SPELLS_CHANGED"); + loadFrame:RegisterEvent("UPDATE_OVERRIDE_ACTIONBAR") +end +loadFrame:RegisterEvent("GROUP_ROSTER_UPDATE") +loadFrame:RegisterEvent("ZONE_CHANGED") +loadFrame:RegisterEvent("ZONE_CHANGED_INDOORS") +loadFrame:RegisterEvent("ZONE_CHANGED_NEW_AREA") +loadFrame:RegisterEvent("PLAYER_LEVEL_UP") +loadFrame:RegisterEvent("PLAYER_REGEN_DISABLED") +loadFrame:RegisterEvent("PLAYER_REGEN_ENABLED") +loadFrame:RegisterEvent("PLAYER_ROLES_ASSIGNED") +loadFrame:RegisterEvent("SPELLS_CHANGED") loadFrame:RegisterEvent("UNIT_INVENTORY_CHANGED") loadFrame:RegisterEvent("PLAYER_EQUIPMENT_CHANGED") loadFrame:RegisterEvent("PLAYER_DEAD") @@ -1730,41 +1961,41 @@ loadFrame:RegisterEvent("PLAYER_ALIVE") loadFrame:RegisterEvent("PLAYER_UNGHOST") loadFrame:RegisterEvent("PARTY_LEADER_CHANGED") -local unitLoadFrame = CreateFrame("Frame"); -WeakAuras.unitLoadFrame = unitLoadFrame; -WeakAuras.frames["Display Load Handling 2"] = unitLoadFrame; +local unitLoadFrame = CreateFrame("Frame") +WeakAuras.unitLoadFrame = unitLoadFrame +WeakAuras.frames["Display Load Handling 2"] = unitLoadFrame -unitLoadFrame:RegisterUnitEvent("UNIT_FLAGS", "player"); +unitLoadFrame:RegisterUnitEvent("UNIT_FLAGS", "player") if WeakAuras.IsWrathOrRetail() then - unitLoadFrame:RegisterUnitEvent("UNIT_ENTERED_VEHICLE", "player"); - unitLoadFrame:RegisterUnitEvent("UNIT_EXITED_VEHICLE", "player"); - unitLoadFrame:RegisterUnitEvent("PLAYER_FLAGS_CHANGED", "player"); + unitLoadFrame:RegisterUnitEvent("UNIT_ENTERED_VEHICLE", "player") + unitLoadFrame:RegisterUnitEvent("UNIT_EXITED_VEHICLE", "player") + unitLoadFrame:RegisterUnitEvent("PLAYER_FLAGS_CHANGED", "player") end function Private.RegisterLoadEvents() loadFrame:SetScript("OnEvent", function(frame, ...) - Private.StartProfileSystem("load"); + Private.StartProfileSystem("load") Private.ScanForLoads(nil, ...) - Private.StopProfileSystem("load"); - end); + Private.StopProfileSystem("load") + end) C_Timer.NewTicker(0.5, function() - Private.StartProfileSystem("load"); - local zoneId = C_Map.GetBestMapForUnit("player"); + Private.StartProfileSystem("load") + local zoneId = C_Map.GetBestMapForUnit("player") if loadFrame.zoneId ~= zoneId then Private.ScanForLoads(nil, "ZONE_CHANGED") - loadFrame.zoneId = zoneId; + loadFrame.zoneId = zoneId end - Private.StopProfileSystem("load"); + Private.StopProfileSystem("load") end) unitLoadFrame:SetScript("OnEvent", function(frame, e, arg1, ...) - Private.StartProfileSystem("load"); - if (arg1 == "player") then + Private.StartProfileSystem("load") + if arg1 == "player" then Private.ScanForLoads(nil, e, arg1, ...) end - Private.StopProfileSystem("load"); - end); + Private.StopProfileSystem("load") + end) end local function UnloadAll() @@ -1780,8 +2011,8 @@ local function UnloadAll() for _, v in pairs(triggerState) do for i = 1, v.numTriggers do - if (v[i]) then - wipe(v[i]); + if v[i] then + wipe(v[i]) end end end @@ -1789,97 +2020,95 @@ local function UnloadAll() for _, aura in pairs(timers) do for _, trigger in pairs(aura) do for _, record in pairs(trigger) do - if (record.handle) then - timer:CancelTimer(record.handle); + if record.handle then + timer:CancelTimer(record.handle) end end end end - wipe(timers); + wipe(timers) Private.UnloadAllConditions() for _, triggerSystem in pairs(triggerSystems) do - triggerSystem.UnloadAll(); + triggerSystem.UnloadAll() end - wipe(loaded); + wipe(loaded) end function Private.Resume() - paused = false; + paused = false - Private.PauseAllDynamicGroups(); + Private.PauseAllDynamicGroups() for id, region in pairs(regions) do - region.region:Collapse(); + region.region:Collapse() end for id, cloneList in pairs(clones) do for cloneId, clone in pairs(cloneList) do - clone:Collapse(); + clone:Collapse() end end - - UnloadAll(); - scanForLoadsImpl(); + UnloadAll() + scanForLoadsImpl() if loadEvents["GROUP"] then Private.ScanForLoadsGroup(loadEvents["GROUP"]) end - Private.ResumeAllDynamicGroups(); + Private.ResumeAllDynamicGroups() end function Private.LoadDisplays(toLoad, ...) for id in pairs(toLoad) do local uid = WeakAuras.GetData(id).uid - Private.RegisterForGlobalConditions(uid); - triggerState[id].triggers = {}; - triggerState[id].triggerCount = 0; - triggerState[id].show = false; - triggerState[id].activeTrigger = nil; - triggerState[id].activatedConditions = {}; + Private.RegisterForGlobalConditions(uid) + triggerState[id].triggers = {} + triggerState[id].triggerCount = 0 + triggerState[id].show = false + triggerState[id].activeTrigger = nil + triggerState[id].activatedConditions = {} if Private.DebugLog.IsEnabled(uid) then WeakAuras.prettyPrint(L["Debug Logging enabled for '%s'"]:format(id)) Private.DebugLog.Print(uid, L["Aura loaded"]) end end for _, triggerSystem in pairs(triggerSystems) do - triggerSystem.LoadDisplays(toLoad, ...); + triggerSystem.LoadDisplays(toLoad, ...) end end function Private.UnloadDisplays(toUnload, ...) for _, triggerSystem in pairs(triggerSystems) do - triggerSystem.UnloadDisplays(toUnload, ...); + triggerSystem.UnloadDisplays(toUnload, ...) end for id in pairs(toUnload) do - for i = 1, triggerState[id].numTriggers do - if (triggerState[id][i]) then - wipe(triggerState[id][i]); + if triggerState[id][i] then + wipe(triggerState[id][i]) end end - triggerState[id].show = nil; - triggerState[id].activeTrigger = nil; + triggerState[id].show = nil + triggerState[id].activeTrigger = nil - if (timers[id]) then + if timers[id] then for _, trigger in pairs(timers[id]) do for _, record in pairs(trigger) do - if (record.handle) then - timer:CancelTimer(record.handle); + if record.handle then + timer:CancelTimer(record.handle) end end end - timers[id] = nil; + timers[id] = nil end local uid = WeakAuras.GetData(id).uid Private.UnloadConditions(uid) - WeakAuras.regions[id].region:Collapse(); - Private.CollapseAllClones(id); + WeakAuras.regions[id].region:Collapse() + Private.CollapseAllClones(id) -- Even though auras are collapsed, their finish animation can be running Private.CancelAnimation(WeakAuras.regions[id].region, true, true, true, true, true, true) @@ -1893,7 +2122,7 @@ end function Private.FinishLoadUnload() for _, triggerSystem in pairs(triggerSystems) do - triggerSystem.FinishLoadUnload(); + triggerSystem.FinishLoadUnload() end end @@ -1912,43 +2141,43 @@ function Private.UIDtoID(uid) end function WeakAuras.Delete(data) - local id = data.id; + local id = data.id local uid = data.uid local parentId = data.parent local parentUid = data.parent and db.displays[data.parent].uid Private.callbacks:Fire("AboutToDelete", uid, id, parentUid, parentId) - if(data.parent) then - local parentData = db.displays[data.parent]; - if(parentData and parentData.controlledChildren) then + if data.parent then + local parentData = db.displays[data.parent] + if parentData and parentData.controlledChildren then for index, childId in pairs(parentData.controlledChildren) do - if(childId == id) then - tremove(parentData.controlledChildren, index); + if childId == id then + tremove(parentData.controlledChildren, index) end end if parentData.sortHybridTable then parentData.sortHybridTable[id] = nil end for parent in Private.TraverseParents(data) do - Private.ClearAuraEnvironment(parent.id); + Private.ClearAuraEnvironment(parent.id) end end end UIDtoID[data.uid] = nil - if(data.controlledChildren) then + if data.controlledChildren then for _, childId in pairs(data.controlledChildren) do - local childData = db.displays[childId]; - if(childData) then - childData.parent = nil; - WeakAuras.Add(childData); + local childData = db.displays[childId] + if childData then + childData.parent = nil + WeakAuras.Add(childData) end end end regions[id].region:Collapse() - Private.CollapseAllClones(id); + Private.CollapseAllClones(id) Private.CancelAnimation(WeakAuras.regions[id].region, true, true, true, true, true, true) @@ -1958,43 +2187,43 @@ function WeakAuras.Delete(data) end end - regions[id].region:SetScript("OnUpdate", nil); - regions[id].region:SetScript("OnShow", nil); - regions[id].region:SetScript("OnHide", nil); - regions[id].region:Hide(); + regions[id].region:SetScript("OnUpdate", nil) + regions[id].region:SetScript("OnShow", nil) + regions[id].region:SetScript("OnHide", nil) + regions[id].region:Hide() - db.registered[id] = nil; + db.registered[id] = nil for _, triggerSystem in pairs(triggerSystems) do - triggerSystem.Delete(id); + triggerSystem.Delete(id) end - regions[id].region = nil; - regions[id] = nil; - loaded[id] = nil; - loadFuncs[id] = nil; - loadFuncsForOptions[id] = nil; + regions[id].region = nil + regions[id] = nil + loaded[id] = nil + loadFuncs[id] = nil + loadFuncsForOptions[id] = nil for event, eventData in pairs(loadEvents) do eventData[id] = nil end - db.displays[id] = nil; + db.displays[id] = nil Private.DeleteAuraEnvironment(id) - triggerState[id] = nil; + triggerState[id] = nil - if (Private.personalRessourceDisplayFrame) then - Private.personalRessourceDisplayFrame:delete(id); + if Private.personalRessourceDisplayFrame then + Private.personalRessourceDisplayFrame:delete(id) end - if (Private.mouseFrame) then - Private.mouseFrame:delete(id); + if Private.mouseFrame then + Private.mouseFrame:delete(id) end - Private.customActionsFunctions[id] = nil; - WeakAuras.customConditionsFunctions[id] = nil; + Private.customActionsFunctions[id] = nil + WeakAuras.customConditionsFunctions[id] = nil WeakAuras.conditionTextFormatters[id] = nil - Private.frameLevels[id] = nil; + Private.frameLevels[id] = nil WeakAuras.conditionHelpers[data.uid] = nil Private.RemoveHistory(data.uid) @@ -2005,12 +2234,12 @@ end function WeakAuras.Rename(data, newid) local oldid = data.id - if(data.parent) then - local parentData = db.displays[data.parent]; - if(parentData.controlledChildren) then + if data.parent then + local parentData = db.displays[data.parent] + if parentData.controlledChildren then for index, childId in pairs(parentData.controlledChildren) do - if(childId == data.id) then - parentData.controlledChildren[index] = newid; + if childId == data.id then + parentData.controlledChildren[index] = newid end end if parentData.sortHybridTable and parentData.sortHybridTable[oldid] then @@ -2025,53 +2254,53 @@ function WeakAuras.Rename(data, newid) end UIDtoID[data.uid] = newid - regions[newid] = regions[oldid]; - regions[oldid] = nil; - regions[newid].region.id = newid; + regions[newid] = regions[oldid] + regions[oldid] = nil + regions[newid].region.id = newid for _, triggerSystem in pairs(triggerSystems) do - triggerSystem.Rename(oldid, newid); + triggerSystem.Rename(oldid, newid) end - loaded[newid] = loaded[oldid]; - loaded[oldid] = nil; - loadFuncs[newid] = loadFuncs[oldid]; - loadFuncs[oldid] = nil; + loaded[newid] = loaded[oldid] + loaded[oldid] = nil + loadFuncs[newid] = loadFuncs[oldid] + loadFuncs[oldid] = nil loadFuncsForOptions[newid] = loadFuncsForOptions[oldid] - loadFuncsForOptions[oldid] = nil; + loadFuncsForOptions[oldid] = nil for event, eventData in pairs(loadEvents) do eventData[newid] = eventData[oldid] eventData[oldid] = nil end - timers[newid] = timers[oldid]; - timers[oldid] = nil; + timers[newid] = timers[oldid] + timers[oldid] = nil - triggerState[newid] = triggerState[oldid]; - triggerState[oldid] = nil; + triggerState[newid] = triggerState[oldid] + triggerState[oldid] = nil Private.RenameAuraEnvironment(oldid, newid) - db.displays[newid] = db.displays[oldid]; - db.displays[oldid] = nil; + db.displays[newid] = db.displays[oldid] + db.displays[oldid] = nil - if(clones[oldid]) then - clones[newid] = clones[oldid]; - clones[oldid] = nil; + if clones[oldid] then + clones[newid] = clones[oldid] + clones[oldid] = nil for cloneid, clone in pairs(clones[newid]) do - clone.id = newid; + clone.id = newid end end - db.displays[newid].id = newid; + db.displays[newid].id = newid - if(data.controlledChildren) then + if data.controlledChildren then for index, childId in pairs(data.controlledChildren) do - local childData = db.displays[childId]; - if(childData) then - childData.parent = data.id; + local childData = db.displays[childId] + if childData then + childData.parent = data.id end end if regions[newid].ReloadControlledChildren then @@ -2079,27 +2308,27 @@ function WeakAuras.Rename(data, newid) end end - if (Private.personalRessourceDisplayFrame) then - Private.personalRessourceDisplayFrame:rename(oldid, newid); + if Private.personalRessourceDisplayFrame then + Private.personalRessourceDisplayFrame:rename(oldid, newid) end - if (Private.mouseFrame) then - Private.mouseFrame:rename(oldid, newid); + if Private.mouseFrame then + Private.mouseFrame:rename(oldid, newid) end - Private.customActionsFunctions[newid] = Private.customActionsFunctions[oldid]; - Private.customActionsFunctions[oldid] = nil; + Private.customActionsFunctions[newid] = Private.customActionsFunctions[oldid] + Private.customActionsFunctions[oldid] = nil - WeakAuras.customConditionsFunctions[newid] = WeakAuras.customConditionsFunctions[oldid]; - WeakAuras.customConditionsFunctions[oldid] = nil; + WeakAuras.customConditionsFunctions[newid] = WeakAuras.customConditionsFunctions[oldid] + WeakAuras.customConditionsFunctions[oldid] = nil WeakAuras.conditionTextFormatters[newid] = WeakAuras.conditionTextFormatters[oldid] WeakAuras.conditionTextFormatters[oldid] = nil - Private.frameLevels[newid] = Private.frameLevels[oldid]; - Private.frameLevels[oldid] = nil; + Private.frameLevels[newid] = Private.frameLevels[oldid] + Private.frameLevels[oldid] = nil - Private.ProfileRenameAura(oldid, newid); + Private.ProfileRenameAura(oldid, newid) -- TODO: This should not be necessary WeakAuras.Add(data) @@ -2108,17 +2337,17 @@ function WeakAuras.Rename(data, newid) end function Private.Convert(data, newType) - local id = data.id; - regions[id].region:SetScript("OnUpdate", nil); - regions[id].region:Hide(); - Private.EndEvent(id, 0, true); + local id = data.id + regions[id].region:SetScript("OnUpdate", nil) + regions[id].region:Hide() + Private.EndEvent(id, 0, true) Private.FakeStatesFor(id, false) - regions[id].region = nil; - regions[id] = nil; + regions[id].region = nil + regions[id] = nil - data.regionType = newType; + data.regionType = newType -- Clean up sub regions if data.subRegions then @@ -2144,7 +2373,7 @@ function Private.Convert(data, newType) if subRegionIndex == index then change.property = nil elseif subRegionIndex > index then - change.property = "sub." .. subRegionIndex -1 .. "." .. property + change.property = "sub." .. subRegionIndex - 1 .. "." .. property end end end @@ -2156,8 +2385,7 @@ function Private.Convert(data, newType) end end - - WeakAuras.Add(data); + WeakAuras.Add(data) Private.FakeStatesFor(id, true) @@ -2170,16 +2398,16 @@ end -- The default mixin doesn't recurse, this does function WeakAuras.DeepMixin(dest, source) local function recurse(source, dest) - for i,v in pairs(source) do - if(type(v) == "table") then - dest[i] = type(dest[i]) == "table" and dest[i] or {}; - recurse(v, dest[i]); + for i, v in pairs(source) do + if type(v) == "table" then + dest[i] = type(dest[i]) == "table" and dest[i] or {} + recurse(v, dest[i]) else - dest[i] = v; + dest[i] = v end end end - recurse(source, dest); + recurse(source, dest) end local function LastUpgrade() @@ -2219,11 +2447,13 @@ StaticPopupDialogs["WEAKAURAS_CONFIRM_REPAIR"] = { button1 = L["Repair"], button2 = L["Cancel"], OnAccept = function(self) - RepairDatabase() + RepairDatabase() end, OnShow = function(self) - local AutomaticRepairText = L["WeakAuras has detected that it has been downgraded.\nYour saved auras may no longer work properly.\nWould you like to run the |cffff0000EXPERIMENTAL|r repair tool? This will overwrite any changes you have made since the last database upgrade.\nLast upgrade: %s"] - local ManualRepairText = L["Are you sure you want to run the |cffff0000EXPERIMENTAL|r repair tool?\nThis will overwrite any changes you have made since the last database upgrade.\nLast upgrade: %s"] + local AutomaticRepairText = + L["WeakAuras has detected that it has been downgraded.\nYour saved auras may no longer work properly.\nWould you like to run the |cffff0000EXPERIMENTAL|r repair tool? This will overwrite any changes you have made since the last database upgrade.\nLast upgrade: %s"] + local ManualRepairText = + L["Are you sure you want to run the |cffff0000EXPERIMENTAL|r repair tool?\nThis will overwrite any changes you have made since the last database upgrade.\nLast upgrade: %s"] if self.data.reason == "user" then self.text:SetText(ManualRepairText:format(LastUpgrade())) @@ -2239,7 +2469,7 @@ StaticPopupDialogs["WEAKAURAS_CONFIRM_REPAIR"] = { whileDead = true, showAlert = true, timeout = 0, - preferredindex = STATICPOPUP_NUMDIALOGS + preferredindex = STATICPOPUP_NUMDIALOGS, } function Private.ValidateUniqueDataIds(silent) @@ -2249,7 +2479,7 @@ function Private.ValidateUniqueDataIds(silent) if type(data.uid) == "string" then if seenUIDs[data.uid] then if not silent then - prettyPrint("Duplicate uid \""..data.uid.."\" detected in saved variables between \""..data.id.."\" and \""..seenUIDs[data.uid].id.."\".") + prettyPrint("Duplicate uid \"" .. data.uid .. "\" detected in saved variables between \"" .. data.id .. "\" and \"" .. seenUIDs[data.uid].id .. "\".") end data.uid = WeakAuras.GenerateUniqueID() seenUIDs[data.uid] = data @@ -2258,7 +2488,7 @@ function Private.ValidateUniqueDataIds(silent) end elseif data.uid ~= nil then if not silent then - prettyPrint("Invalid uid detected in saved variables for \""..data.id.."\"") + prettyPrint("Invalid uid detected in saved variables for \"" .. data.id .. "\"") end data.uid = WeakAuras.GenerateUniqueID() seenUIDs[data.uid] = data @@ -2286,14 +2516,13 @@ function Private.SyncParentChildRelationships(silent) for id, data in pairs(db.displays) do if data.parent then if not db.displays[data.parent] then - if not(silent) then - prettyPrint("Detected corruption in saved variables: "..id.." has a nonexistent parent.") + if not silent then + prettyPrint("Detected corruption in saved variables: " .. id .. " has a nonexistent parent.") end data.parent = nil elseif not db.displays[data.parent].controlledChildren then if not silent then - prettyPrint("Detected corruption in saved variables: "..id.." thinks "..data.parent.. - " controls it, but "..data.parent.." is not a group.") + prettyPrint("Detected corruption in saved variables: " .. id .. " thinks " .. data.parent .. " controls it, but " .. data.parent .. " is not a group.") end data.parent = nil else @@ -2313,24 +2542,24 @@ function Private.SyncParentChildRelationships(silent) local child = children[childID] if not child then if not silent then - prettyPrint("Detected corruption in saved variables: "..id.." thinks it controls "..childID.." which doesn't exist.") + prettyPrint("Detected corruption in saved variables: " .. id .. " thinks it controls " .. childID .. " which doesn't exist.") end childrenToRemove[index] = true elseif child.parent ~= id then if not silent then - prettyPrint("Detected corruption in saved variables: "..id.." thinks it controls "..childID.." which it does not.") + prettyPrint("Detected corruption in saved variables: " .. id .. " thinks it controls " .. childID .. " which it does not.") end childrenToRemove[index] = true elseif dynamicGroup and child.controlledChildren then if not silent then - prettyPrint("Detected corruption in saved variables: "..id.." is a dynamic group and controls "..childID.." which is a group/dynamicgroup.") + prettyPrint("Detected corruption in saved variables: " .. id .. " is a dynamic group and controls " .. childID .. " which is a group/dynamicgroup.") end child.parent = nil children[child.id] = nil childrenToRemove[index] = true elseif groupChildren[childID] then if not silent then - prettyPrint("Detected corruption in saved variables: "..id.." has "..childID.." as a child in multiple positions.") + prettyPrint("Detected corruption in saved variables: " .. id .. " has " .. childID .. " as a child in multiple positions.") end childrenToRemove[index] = true else @@ -2350,7 +2579,7 @@ function Private.SyncParentChildRelationships(silent) for id, data in pairs(children) do if not childHasParent[id] then if not silent then - prettyPrint("Detected corruption in saved variables: "..id.." should be controlled by "..data.parent.." but isn't.") + prettyPrint("Detected corruption in saved variables: " .. id .. " should be controlled by " .. data.parent .. " but isn't.") end local parent = parents[data.parent] tinsert(parent.controlledChildren, id) @@ -2359,40 +2588,40 @@ function Private.SyncParentChildRelationships(silent) end function WeakAuras.AddMany(table, takeSnapshots) - local idtable = {}; + local idtable = {} for _, data in ipairs(table) do - idtable[data.id] = data; + idtable[data.id] = data end - local loaded = {}; + local loaded = {} local function load(id, depends) - local data = idtable[id]; - if(data.parent) then - if(idtable[data.parent]) then - if(tContains(depends, data.parent)) then - error("Circular dependency in WeakAuras.AddMany between "..table.concat(depends, ", ")); + local data = idtable[id] + if data.parent then + if idtable[data.parent] then + if tContains(depends, data.parent) then + error("Circular dependency in WeakAuras.AddMany between " .. table.concat(depends, ", ")) else - if not(loaded[data.parent]) then - local dependsOut = {}; - for i,v in pairs(depends) do - dependsOut[i] = v; + if not loaded[data.parent] then + local dependsOut = {} + for i, v in pairs(depends) do + dependsOut[i] = v end - tinsert(dependsOut, data.parent); - load(data.parent, dependsOut); + tinsert(dependsOut, data.parent) + load(data.parent, dependsOut) end end else - data.parent = nil; + data.parent = nil end end - if not(loaded[id]) then - WeakAuras.Add(data, takeSnapshots); - coroutine.yield(); - loaded[id] = true; + if not loaded[id] then + WeakAuras.Add(data, takeSnapshots) + coroutine.yield() + loaded[id] = true end end local groups = {} for id, data in pairs(idtable) do - load(id, {}); + load(id, {}) if data.regionType == "dynamicgroup" or data.regionType == "group" then groups[data] = true end @@ -2403,7 +2632,7 @@ function WeakAuras.AddMany(table, takeSnapshots) else WeakAuras.Add(data) end - coroutine.yield(); + coroutine.yield() end end @@ -2411,16 +2640,11 @@ local function customOptionIsValid(option) if not option.type then return false elseif Private.author_option_classes[option.type] == "simple" then - if not option.key - or not option.name - or not option.default == nil then + if not option.key or not option.name or not option.default == nil then return false end elseif Private.author_option_classes[option.type] == "group" then - if not option.key - or not option.name - or not option.default == nil - or not option.subOptions then + if not option.key or not option.name or not option.default == nil or not option.subOptions then return false end end @@ -2513,7 +2737,7 @@ local function validateUserConfig(data, options, config) else if option.type == "number" and option.step then local min = option.min or 0 - config[key] = option.step * Round((value - min)/option.step) + min + config[key] = option.step * Round((value - min) / option.step) + min end end elseif option.type == "select" then @@ -2563,14 +2787,14 @@ local function removeSpellNames(data) if type(trigger.spellName) == "number" then trigger.realSpellName = GetSpellInfo(trigger.spellName) or trigger.realSpellName end - if (trigger.spellId) then - trigger.name = GetSpellInfo(trigger.spellId) or trigger.name; + if trigger.spellId then + trigger.name = GetSpellInfo(trigger.spellId) or trigger.name end - if (trigger.spellIds) then + if trigger.spellIds then for i = 1, 10 do - if (trigger.spellIds[i]) then - trigger.names = trigger.names or {}; - trigger.names[i] = GetSpellInfo(trigger.spellIds[i]) or trigger.names[i]; + if trigger.spellIds[i] then + trigger.names = trigger.names or {} + trigger.names[i] = GetSpellInfo(trigger.spellIds[i]) or trigger.names[i] end end end @@ -2701,14 +2925,13 @@ function Private.UpdateSoundIcon(data) else Private.AuraWarnings.UpdateWarning(data.uid, "sound_condition") end - end function WeakAuras.PreAdd(data) -- Readd what Compress removed before version 8 - if (not data.internalVersion or data.internalVersion < 7) then + if not data.internalVersion or data.internalVersion < 7 then WeakAuras.validate(data, oldDataStub) - elseif (data.internalVersion < 8) then + elseif data.internalVersion < 8 then WeakAuras.validate(data, oldDataStub2) end @@ -2722,8 +2945,8 @@ function WeakAuras.PreAdd(data) regionValidate(data) end - Private.Modernize(data); - WeakAuras.validate(data, WeakAuras.data_stub); + Private.Modernize(data) + WeakAuras.validate(data, WeakAuras.data_stub) if data.subRegions then for _, subRegionData in ipairs(data.subRegions) do local subType = subRegionData.type @@ -2750,10 +2973,10 @@ function WeakAuras.PreAdd(data) end local function pAdd(data, simpleChange) - local id = data.id; - if not(id) then - error("Improper arguments to WeakAuras.Add - id not defined"); - return; + local id = data.id + if not id then + error("Improper arguments to WeakAuras.Add - id not defined") + return end data.uid = data.uid or WeakAuras.GenerateUniqueID() @@ -2785,44 +3008,44 @@ local function pAdd(data, simpleChange) else Private.DebugLog.SetEnabled(data.uid, data.information.debugLog) - if (data.controlledChildren) then - Private.ClearAuraEnvironment(id); + if data.controlledChildren then + Private.ClearAuraEnvironment(id) for parent in Private.TraverseParents(data) do - Private.ClearAuraEnvironment(parent.id); + Private.ClearAuraEnvironment(parent.id) end - db.displays[id] = data; - WeakAuras.SetRegion(data); - Private.ScanForLoadsGroup({[id] = true}); + db.displays[id] = data + WeakAuras.SetRegion(data) + Private.ScanForLoadsGroup({ [id] = true }) loadEvents["GROUP"] = loadEvents["GROUP"] or {} loadEvents["GROUP"][id] = true else -- Non group aura local visible - if (WeakAuras.IsOptionsOpen()) then + if WeakAuras.IsOptionsOpen() then visible = Private.FakeStatesFor(id, false) else - if (WeakAuras.regions[id] and WeakAuras.regions[id].region) then + if WeakAuras.regions[id] and WeakAuras.regions[id].region then WeakAuras.regions[id].region:Collapse() else Private.CollapseAllClones(id) end end - Private.ClearAuraEnvironment(id); + Private.ClearAuraEnvironment(id) for parent in Private.TraverseParents(data) do - Private.ClearAuraEnvironment(parent.id); + Private.ClearAuraEnvironment(parent.id) end - db.displays[id] = data; + db.displays[id] = data - if (not data.triggers.activeTriggerMode or data.triggers.activeTriggerMode > #data.triggers) then - data.triggers.activeTriggerMode = Private.trigger_modes.first_active; + if not data.triggers.activeTriggerMode or data.triggers.activeTriggerMode > #data.triggers then + data.triggers.activeTriggerMode = Private.trigger_modes.first_active end for _, triggerSystem in pairs(triggerSystems) do - triggerSystem.Add(data); + triggerSystem.Add(data) end - local loadFuncStr, events = ConstructFunction(load_prototype, data.load); + local loadFuncStr, events = ConstructFunction(load_prototype, data.load) for event, eventData in pairs(loadEvents) do eventData[id] = nil end @@ -2833,34 +3056,34 @@ local function pAdd(data, simpleChange) loadEvents["SCAN_ALL"] = loadEvents["SCAN_ALL"] or {} loadEvents["SCAN_ALL"][id] = true - local loadForOptionsFuncStr = ConstructFunction(load_prototype, data.load, true); - local loadFunc = WeakAuras.LoadFunction(loadFuncStr); - local loadForOptionsFunc = WeakAuras.LoadFunction(loadForOptionsFuncStr); - local triggerLogicFunc; + local loadForOptionsFuncStr = ConstructFunction(load_prototype, data.load, true) + local loadFunc = WeakAuras.LoadFunction(loadFuncStr) + local loadForOptionsFunc = WeakAuras.LoadFunction(loadForOptionsFuncStr) + local triggerLogicFunc if data.triggers.disjunctive == "custom" then - triggerLogicFunc = WeakAuras.LoadFunction("return "..(data.triggers.customTriggerLogic or "")); + triggerLogicFunc = WeakAuras.LoadFunction("return " .. (data.triggers.customTriggerLogic or "")) end - LoadCustomActionFunctions(data); - Private.LoadConditionPropertyFunctions(data); + LoadCustomActionFunctions(data) + Private.LoadConditionPropertyFunctions(data) Private.LoadConditionFunction(data) - loadFuncs[id] = loadFunc; - loadFuncsForOptions[id] = loadForOptionsFunc; - clones[id] = clones[id] or {}; + loadFuncs[id] = loadFunc + loadFuncsForOptions[id] = loadForOptionsFunc + clones[id] = clones[id] or {} - if (timers[id]) then + if timers[id] then for _, trigger in pairs(timers[id]) do for _, record in pairs(trigger) do - if (record.handle) then - timer:CancelTimer(record.handle); + if record.handle then + timer:CancelTimer(record.handle) end end end - timers[id] = nil; + timers[id] = nil end - WeakAuras.SetRegion(data); + WeakAuras.SetRegion(data) triggerState[id] = { disjunctive = data.triggers.disjunctive or "all", @@ -2870,16 +3093,16 @@ local function pAdd(data, simpleChange) triggers = {}, triggerCount = 0, activatedConditions = {}, - }; + } - LoadEncounterInitScripts(id); + LoadEncounterInitScripts(id) - if (WeakAuras.IsOptionsOpen()) then + if WeakAuras.IsOptionsOpen() then Private.FakeStatesFor(id, visible) end - if not(paused) then - Private.ScanForLoads({[id] = true}); + if not paused then + Private.ScanForLoads({ [id] = true }) end end @@ -2903,7 +3126,7 @@ end function Private.AddParents(data) local parent = data.parent - if (parent) then + if parent then local parentData = WeakAuras.GetData(parent) WeakAuras.Add(parentData) Private.AddParents(parentData) @@ -2911,45 +3134,45 @@ function Private.AddParents(data) end function WeakAuras.SetRegion(data, cloneId) - local regionType = data.regionType; - if not(regionType) then - error("Improper arguments to WeakAuras.SetRegion - regionType not defined"); + local regionType = data.regionType + if not regionType then + error("Improper arguments to WeakAuras.SetRegion - regionType not defined") else - if(not regionTypes[regionType]) then - regionType = "fallback"; - print("Improper arguments to WeakAuras.CreateRegion - regionType \""..data.regionType.."\" is not supported"); + if not regionTypes[regionType] then + regionType = "fallback" + print("Improper arguments to WeakAuras.CreateRegion - regionType \"" .. data.regionType .. "\" is not supported") end - local id = data.id; - if not(id) then - error("Improper arguments to WeakAuras.SetRegion - id not defined"); + local id = data.id + if not id then + error("Improper arguments to WeakAuras.SetRegion - id not defined") else - local region; - if(cloneId) then - region = clones[id][cloneId]; - if (not region or region.regionType ~= data.regionType) then - if (region) then - clonePool[region.regionType] = clonePool[region.regionType] or {}; - tinsert(clonePool[region.regionType], region); - region:Hide(); + local region + if cloneId then + region = clones[id][cloneId] + if not region or region.regionType ~= data.regionType then + if region then + clonePool[region.regionType] = clonePool[region.regionType] or {} + tinsert(clonePool[region.regionType], region) + region:Hide() end - if(clonePool[data.regionType] and clonePool[data.regionType][1]) then - clones[id][cloneId] = tremove(clonePool[data.regionType]); + if clonePool[data.regionType] and clonePool[data.regionType][1] then + clones[id][cloneId] = tremove(clonePool[data.regionType]) else - local clone = regionTypes[data.regionType].create(WeakAurasFrame, data); - clone.regionType = data.regionType; - clone:Hide(); - clones[id][cloneId] = clone; + local clone = regionTypes[data.regionType].create(WeakAurasFrame, data) + clone.regionType = data.regionType + clone:Hide() + clones[id][cloneId] = clone end - region = clones[id][cloneId]; + region = clones[id][cloneId] end else - if((not regions[id]) or (not regions[id].region) or regions[id].regionType ~= regionType) then - region = regionTypes[regionType].create(WeakAurasFrame, data); + if not regions[id] or not regions[id].region or regions[id].regionType ~= regionType then + region = regionTypes[regionType].create(WeakAurasFrame, data) regions[id] = { regionType = regionType, - region = region - }; + region = region, + } if regionType ~= "dynamicgroup" and regionType ~= "group" then region.toShow = false region:Hide() @@ -2957,184 +3180,198 @@ function WeakAuras.SetRegion(data, cloneId) region.toShow = true end else - region = regions[id].region; + region = regions[id].region end end - region.id = id; - region.cloneId = cloneId or ""; - WeakAuras.validate(data, regionTypes[regionType].default); + region.id = id + region.cloneId = cloneId or "" + WeakAuras.validate(data, regionTypes[regionType].default) - local parent = WeakAurasFrame; - if(data.parent) then - if(regions[data.parent]) then - parent = regions[data.parent].region; + local parent = WeakAurasFrame + if data.parent then + if regions[data.parent] then + parent = regions[data.parent].region else - data.parent = nil; + data.parent = nil end end - local loginFinished = WeakAuras.IsLoginFinished(); - local anim_cancelled = loginFinished and Private.CancelAnimation(region, true, true, true, true, true, true); + local loginFinished = WeakAuras.IsLoginFinished() + local anim_cancelled = loginFinished and Private.CancelAnimation(region, true, true, true, true, true, true) - regionTypes[regionType].modify(parent, region, data); - WeakAuras.regionPrototype.AddSetDurationInfo(region); + regionTypes[regionType].modify(parent, region, data) + WeakAuras.regionPrototype.AddSetDurationInfo(region) WeakAuras.regionPrototype.AddExpandFunction(data, region, cloneId, parent, parent.regionType) - data.animation = data.animation or {}; - data.animation.start = data.animation.start or {type = "none"}; - data.animation.main = data.animation.main or {type = "none"}; - data.animation.finish = data.animation.finish or {type = "none"}; - if(Private.CanHaveDuration(data)) then - data.animation.start.duration_type = data.animation.start.duration_type or "seconds"; - data.animation.main.duration_type = data.animation.main.duration_type or "seconds"; - data.animation.finish.duration_type = data.animation.finish.duration_type or "seconds"; + data.animation = data.animation or {} + data.animation.start = data.animation.start or { type = "none" } + data.animation.main = data.animation.main or { type = "none" } + data.animation.finish = data.animation.finish or { type = "none" } + if Private.CanHaveDuration(data) then + data.animation.start.duration_type = data.animation.start.duration_type or "seconds" + data.animation.main.duration_type = data.animation.main.duration_type or "seconds" + data.animation.finish.duration_type = data.animation.finish.duration_type or "seconds" else - data.animation.start.duration_type = "seconds"; - data.animation.main.duration_type = "seconds"; - data.animation.finish.duration_type = "seconds"; + data.animation.start.duration_type = "seconds" + data.animation.main.duration_type = "seconds" + data.animation.finish.duration_type = "seconds" end - if(cloneId) then - clonePool[regionType] = clonePool[regionType] or {}; + if cloneId then + clonePool[regionType] = clonePool[regionType] or {} end - if(anim_cancelled) then - Private.Animate("display", data.uid, "main", data.animation.main, region, false, nil, true, cloneId); + if anim_cancelled then + Private.Animate("display", data.uid, "main", data.animation.main, region, false, nil, true, cloneId) end - return region; + return region end end end local function EnsureClone(id, cloneId) - clones[id] = clones[id] or {}; - if not(clones[id][cloneId]) then - local data = WeakAuras.GetData(id); - WeakAuras.SetRegion(data, cloneId); + clones[id] = clones[id] or {} + if not clones[id][cloneId] then + local data = WeakAuras.GetData(id) + WeakAuras.SetRegion(data, cloneId) end - return clones[id][cloneId]; + return clones[id][cloneId] end function WeakAuras.GetRegion(id, cloneId) - if(cloneId and cloneId ~= "") then - return EnsureClone(id, cloneId); + if cloneId and cloneId ~= "" then + return EnsureClone(id, cloneId) end - return WeakAuras.regions[id] and WeakAuras.regions[id].region; + return WeakAuras.regions[id] and WeakAuras.regions[id].region end -- Note, does not create a clone! function Private.GetRegionByUID(uid, cloneId) local id = Private.UIDtoID(uid) - if(cloneId and cloneId ~= "") then - return id and clones[id] and clones[id][cloneId]; + if cloneId and cloneId ~= "" then + return id and clones[id] and clones[id][cloneId] end return id and WeakAuras.regions[id] and WeakAuras.regions[id].region end function Private.CollapseAllClones(id, triggernum) - if(clones[id]) then - for i,v in pairs(clones[id]) do - v:Collapse(); + if clones[id] then + for i, v in pairs(clones[id]) do + v:Collapse() end end end function Private.SetAllStatesHidden(id, triggernum) - local triggerState = WeakAuras.GetTriggerStateForTrigger(id, triggernum); + local triggerState = WeakAuras.GetTriggerStateForTrigger(id, triggernum) local changed = false for _, state in pairs(triggerState) do changed = changed or state.show - state.show = false; - state.changed = true; + state.show = false + state.changed = true end return changed end function Private.SetAllStatesHiddenExcept(id, triggernum, list) - local triggerState = WeakAuras.GetTriggerStateForTrigger(id, triggernum); - for cloneId, state in pairs(triggerState) do - if (not (list[cloneId])) then - state.show = false; - state.changed = true; + local triggerState = WeakAuras.GetTriggerStateForTrigger(id, triggernum) + for cloneId, state in pairs(triggerState) do + if not list[cloneId] then + state.show = false + state.changed = true end end end function Private.ReleaseClone(id, cloneId, regionType) - if (not clones[id]) then - return; + if not clones[id] then + return end - local region = clones[id][cloneId]; - clones[id][cloneId] = nil; + local region = clones[id][cloneId] + clones[id][cloneId] = nil if region:IsProtected() then - WeakAuras.prettyPrint(L["Error '%s' created a secure clone. We advise deleting the aura. For more information:\nhttps://github.com/WeakAuras/WeakAuras2/wiki/Protected-Frames"]:format(id)) + WeakAuras.prettyPrint( + L["Error '%s' created a secure clone. We advise deleting the aura. For more information:\nhttps://github.com/WeakAuras/WeakAuras2/wiki/Protected-Frames"]:format(id) + ) else - clonePool[regionType][#clonePool[regionType] + 1] = region; + clonePool[regionType][#clonePool[regionType] + 1] = region end end function Private.HandleChatAction(message_type, message, message_dest, message_dest_isunit, message_channel, r, g, b, region, customFunc, when, formatters, voice) local useHiddenStates = when == "finish" - if (message:find('%%')) then - message = Private.ReplacePlaceHolders(message, region, customFunc, useHiddenStates, formatters); + if message:find("%%") then + message = Private.ReplacePlaceHolders(message, region, customFunc, useHiddenStates, formatters) end - if(message_type == "PRINT") then - DEFAULT_CHAT_FRAME:AddMessage(message, r or 1, g or 1, b or 1); + if message_type == "PRINT" then + DEFAULT_CHAT_FRAME:AddMessage(message, r or 1, g or 1, b or 1) elseif message_type == "TTS" then local validVoice = voice and Private.tts_voices[voice] if not Private.SquelchingActions() then pcall(function() - C_VoiceChat.SpeakText( - validVoice and voice or 0, - message, - 0, - C_TTSSettings and C_TTSSettings.GetSpeechRate() or 0, - C_TTSSettings and C_TTSSettings.GetSpeechVolume() or 100 - ); + C_VoiceChat.SpeakText(validVoice and voice or 0, message, 0, C_TTSSettings and C_TTSSettings.GetSpeechRate() or 0, C_TTSSettings and C_TTSSettings.GetSpeechVolume() or 100) end) end elseif message_type == "ERROR" then UIErrorsFrame:AddMessage(message, r or 1, g or 1, b or 1) - elseif(message_type == "COMBAT") then - if(CombatText_AddMessage) then - CombatText_AddMessage(message, COMBAT_TEXT_SCROLL_FUNCTION, r or 1, g or 1, b or 1); + elseif message_type == "COMBAT" then + if CombatText_AddMessage then + CombatText_AddMessage(message, COMBAT_TEXT_SCROLL_FUNCTION, r or 1, g or 1, b or 1) end - elseif(message_type == "WHISPER") then - if(message_dest) then - if (message_dest:find('%%')) then - message_dest = Private.ReplacePlaceHolders(message_dest, region, customFunc, useHiddenStates, formatters); + elseif message_type == "WHISPER" then + if message_dest then + if message_dest:find("%%") then + message_dest = Private.ReplacePlaceHolders(message_dest, region, customFunc, useHiddenStates, formatters) end if message_dest_isunit == true then message_dest = UnitName(message_dest) end - pcall(function() SendChatMessage(message, "WHISPER", nil, message_dest) end); + pcall(function() + SendChatMessage(message, "WHISPER", nil, message_dest) + end) end - elseif(message_type == "SMARTRAID") then + elseif message_type == "SMARTRAID" then local isInstanceGroup = IsInGroup(LE_PARTY_CATEGORY_INSTANCE) if UnitInBattleground("player") then - pcall(function() SendChatMessage(message, "INSTANCE_CHAT") end) + pcall(function() + SendChatMessage(message, "INSTANCE_CHAT") + end) elseif UnitInRaid("player") then - pcall(function() SendChatMessage(message, "RAID") end) + pcall(function() + SendChatMessage(message, "RAID") + end) elseif UnitInParty("player") then if isInstanceGroup then - pcall(function() SendChatMessage(message, "INSTANCE_CHAT") end) + pcall(function() + SendChatMessage(message, "INSTANCE_CHAT") + end) else - pcall(function() SendChatMessage(message, "PARTY") end) + pcall(function() + SendChatMessage(message, "PARTY") + end) end else if IsInInstance() then - pcall(function() SendChatMessage(message, "SAY") end) + pcall(function() + SendChatMessage(message, "SAY") + end) end end - elseif(message_type == "SAY" or message_type == "YELL") then + elseif message_type == "SAY" or message_type == "YELL" then if IsInInstance() then - pcall(function() SendChatMessage(message, message_type, nil, nil) end) + pcall(function() + SendChatMessage(message, message_type, nil, nil) + end) end else - pcall(function() SendChatMessage(message, message_type, nil, nil) end); + pcall(function() + SendChatMessage(message, message_type, nil, nil) + end) end end local function actionGlowStop(actions, frame, id) - if not frame.__WAGlowFrame then return end + if not frame.__WAGlowFrame then + return + end if actions.glow_type == "buttonOverlay" then LCG.ButtonGlow_Stop(frame.__WAGlowFrame) elseif actions.glow_type == "Pixel" then @@ -3172,16 +3409,7 @@ local function actionGlowStart(actions, frame, id) id ) elseif actions.glow_type == "ACShine" then - LCG.AutoCastGlow_Start( - glow_frame, - color, - actions.glow_lines, - actions.glow_frequency, - actions.glow_scale, - actions.glow_XOffset, - actions.glow_YOffset, - id - ) + LCG.AutoCastGlow_Start(glow_frame, color, actions.glow_lines, actions.glow_frequency, actions.glow_scale, actions.glow_XOffset, actions.glow_YOffset, id) end end @@ -3197,9 +3425,7 @@ do if type(glow_frame_monitor) == "table" then for region, data in pairs(glow_frame_monitor) do - if region.state and region.state.unit == unit - and (data.frame ~= frame) == update_frame - then + if region.state and region.state.unit == unit and (data.frame ~= frame) == update_frame then if not new_frame then new_frame = WeakAuras.GetUnitFrame(unit) or WeakAuras.HiddenFrames end @@ -3225,9 +3451,7 @@ do end if type(anchor_unitframe_monitor) == "table" then for region, data in pairs(anchor_unitframe_monitor) do - if region.state and region.state.unit == unit - and (data.frame ~= frame) == update_frame - then + if region.state and region.state.unit == unit and (data.frame ~= frame) == update_frame then if not new_frame then new_frame = WeakAuras.GetUnitFrame(unit) or WeakAuras.HiddenFrames end @@ -3238,9 +3462,7 @@ do end end for regionData, data_frame in pairs(Private.dyngroup_unitframe_monitor) do - if regionData.region and regionData.region.state and regionData.region.state.unit == unit - and (data_frame ~= frame) == update_frame - then + if regionData.region and regionData.region.state and regionData.region.state.unit == unit and (data_frame ~= frame) == update_frame then if not new_frame then new_frame = WeakAuras.GetUnitFrame(unit) or WeakAuras.HiddenFrames end @@ -3253,7 +3475,6 @@ do for frame in pairs(dynamicGroupsToUpdate) do frame:DoPositionChildren() end - end LGF.RegisterCallback("WeakAuras", "FRAME_UNIT_UPDATE", frame_monitor_callback) @@ -3261,14 +3482,12 @@ do end function Private.HandleGlowAction(actions, region) - if actions.glow_action - and ( - ( - (actions.glow_frame_type == "UNITFRAME" or actions.glow_frame_type == "NAMEPLATE") - and region.state.unit + if + actions.glow_action + and ( + ((actions.glow_frame_type == "UNITFRAME" or actions.glow_frame_type == "NAMEPLATE") and region.state.unit) + or (actions.glow_frame_type == "FRAMESELECTOR" and actions.glow_frame) ) - or (actions.glow_frame_type == "FRAMESELECTOR" and actions.glow_frame) - ) then local glow_frame, should_glow_frame if actions.glow_frame_type == "FRAMESELECTOR" then @@ -3295,9 +3514,7 @@ function Private.HandleGlowAction(actions, region) if actions.glow_action == "show" then -- remove previous glow if glow_frame then - if region.active_glows_hidefunc - and region.active_glows_hidefunc[glow_frame] - then + if region.active_glows_hidefunc and region.active_glows_hidefunc[glow_frame] then region.active_glows_hidefunc[glow_frame]() end -- start glow @@ -3319,14 +3536,10 @@ function Private.HandleGlowAction(actions, region) glow_frame_monitor = glow_frame_monitor or {} glow_frame_monitor[region] = { actions = actions, - frame = glow_frame + frame = glow_frame, } end - elseif actions.glow_action == "hide" - and glow_frame - and region.active_glows_hidefunc - and region.active_glows_hidefunc[glow_frame] - then + elseif actions.glow_action == "hide" and glow_frame and region.active_glows_hidefunc and region.active_glows_hidefunc[glow_frame] then region.active_glows_hidefunc[glow_frame]() region.active_glows_hidefunc[glow_frame] = nil end @@ -3335,44 +3548,58 @@ function Private.HandleGlowAction(actions, region) end function Private.PerformActions(data, when, region) - if (paused or WeakAuras.IsOptionsOpen()) then - return; - end; - local actions; + if paused or WeakAuras.IsOptionsOpen() then + return + end + local actions local formatters - if(when == "start") then - actions = data.actions.start; + if when == "start" then + actions = data.actions.start formatters = region.startFormatters - elseif(when == "finish") then - actions = data.actions.finish; + elseif when == "finish" then + actions = data.actions.finish formatters = region.finishFormatters else - return; + return end - if(actions.do_message and actions.message_type and actions.message) then - local customFunc = Private.customActionsFunctions[data.id][when .. "_message"]; - Private.HandleChatAction(actions.message_type, actions.message, actions.message_dest, actions.message_dest_isunit, actions.message_channel, actions.r, actions.g, actions.b, region, customFunc, when, formatters, actions.message_tts_voice); + if actions.do_message and actions.message_type and actions.message then + local customFunc = Private.customActionsFunctions[data.id][when .. "_message"] + Private.HandleChatAction( + actions.message_type, + actions.message, + actions.message_dest, + actions.message_dest_isunit, + actions.message_channel, + actions.r, + actions.g, + actions.b, + region, + customFunc, + when, + formatters, + actions.message_tts_voice + ) end - if (actions.stop_sound) then - if (region.SoundStop) then - region:SoundStop(); + if actions.stop_sound then + if region.SoundStop then + region:SoundStop() end end - if(actions.do_sound and actions.sound) then - if (region.SoundPlay) then - region:SoundPlay(actions); + if actions.do_sound and actions.sound then + if region.SoundPlay then + region:SoundPlay(actions) end end - if(actions.do_custom and actions.custom) then + if actions.do_custom and actions.custom then local func = Private.customActionsFunctions[data.id][when] if func then - Private.ActivateAuraEnvironment(region.id, region.cloneId, region.state, region.states); - xpcall(func, Private.GetErrorHandlerId(data.id, L["Custom Action"])); - Private.ActivateAuraEnvironment(nil); + Private.ActivateAuraEnvironment(region.id, region.cloneId, region.state, region.states) + xpcall(func, Private.GetErrorHandlerId(data.id, L["Custom Action"])) + Private.ActivateAuraEnvironment(nil) end end @@ -3394,7 +3621,7 @@ function Private.PerformActions(data, when, region) end function WeakAuras.GetData(id) - return id and db.displays[id]; + return id and db.displays[id] end local function GetTriggerSystem(data, triggernum) @@ -3403,167 +3630,169 @@ local function GetTriggerSystem(data, triggernum) end local function wrapTriggerSystemFunction(functionName, mode) - local func; + local func func = function(data, triggernum, ...) - if (not triggernum) then - return func(data, data.triggers.activeTriggerMode or -1, ...); - elseif (triggernum < 0) then - local result; - if (mode == "or") then - result = false; + if not triggernum then + return func(data, data.triggers.activeTriggerMode or -1, ...) + elseif triggernum < 0 then + local result + if mode == "or" then + result = false for i = 1, #data.triggers do - result = result or func(data, i); + result = result or func(data, i) end - elseif (mode == "and") then - result = true; + elseif mode == "and" then + result = true for i = 1, #data.triggers do - result = result and func(data, i); + result = result and func(data, i) end - elseif (mode == "table") then - result = {}; + elseif mode == "table" then + result = {} for i = 1, #data.triggers do - local tmp = func(data, i); - if (tmp) then + local tmp = func(data, i) + if tmp then for k, v in pairs(tmp) do - result[k] = v; + result[k] = v end end end - elseif (mode == "call") then + elseif mode == "call" then for i = 1, #data.triggers do - func(data, i, ...); + func(data, i, ...) end - elseif (mode == "firstValue") then - result = nil; + elseif mode == "firstValue" then + result = nil for i = 1, #data.triggers do - local tmp = func(data, i); - if (tmp) then - result = tmp; - break; + local tmp = func(data, i) + if tmp then + result = tmp + break end end - elseif (mode == "nameAndIcon") then + elseif mode == "nameAndIcon" then for i = 1, #data.triggers do - local tmp1, tmp2 = func(data, i); - if (tmp1) then - return tmp1, tmp2; + local tmp1, tmp2 = func(data, i) + if tmp1 then + return tmp1, tmp2 end end end - return result; + return result else -- triggernum >= 1 - local triggerSystem = GetTriggerSystem(data, triggernum); - if (not triggerSystem) then + local triggerSystem = GetTriggerSystem(data, triggernum) + if not triggerSystem then return false end - return triggerSystem[functionName](data, triggernum, ...); + return triggerSystem[functionName](data, triggernum, ...) end end - return func; + return func end -Private.CanHaveDuration = wrapTriggerSystemFunction("CanHaveDuration", "firstValue"); -Private.CanHaveClones = wrapTriggerSystemFunction("CanHaveClones", "or"); -Private.CanHaveTooltip = wrapTriggerSystemFunction("CanHaveTooltip", "or"); +Private.CanHaveDuration = wrapTriggerSystemFunction("CanHaveDuration", "firstValue") +Private.CanHaveClones = wrapTriggerSystemFunction("CanHaveClones", "or") +Private.CanHaveTooltip = wrapTriggerSystemFunction("CanHaveTooltip", "or") -- This has to be in WeakAuras for now, because GetNameAndIcon can be called from the options -WeakAuras.GetNameAndIcon = wrapTriggerSystemFunction("GetNameAndIcon", "nameAndIcon"); -Private.GetTriggerDescription = wrapTriggerSystemFunction("GetTriggerDescription", "call"); +WeakAuras.GetNameAndIcon = wrapTriggerSystemFunction("GetNameAndIcon", "nameAndIcon") +Private.GetTriggerDescription = wrapTriggerSystemFunction("GetTriggerDescription", "call") -local wrappedGetOverlayInfo = wrapTriggerSystemFunction("GetOverlayInfo", "table"); +local wrappedGetOverlayInfo = wrapTriggerSystemFunction("GetOverlayInfo", "table") Private.GetAdditionalProperties = function(data, triggernum, ...) local additionalProperties = "" for i = 1, #data.triggers do - local triggerSystem = GetTriggerSystem(data, i); - if (triggerSystem) then + local triggerSystem = GetTriggerSystem(data, i) + if triggerSystem then local add = triggerSystem.GetAdditionalProperties(data, i) - if (add and add ~= "") then + if add and add ~= "" then if additionalProperties ~= "" then additionalProperties = additionalProperties .. "\n" end - additionalProperties = additionalProperties .. add; + additionalProperties = additionalProperties .. add end end end if additionalProperties ~= "" then additionalProperties = "\n\n" - .. L["Additional Trigger Replacements"] .. "\n" - .. additionalProperties .. "\n\n" - .. L["The trigger number is optional, and uses the trigger providing dynamic information if not specified."] + .. L["Additional Trigger Replacements"] + .. "\n" + .. additionalProperties + .. "\n\n" + .. L["The trigger number is optional, and uses the trigger providing dynamic information if not specified."] end return additionalProperties end function Private.GetOverlayInfo(data, triggernum) - local overlayInfo; - if (data.controlledChildren) then - overlayInfo = {}; + local overlayInfo + if data.controlledChildren then + overlayInfo = {} for child in Private.TraverseLeafs(data) do - local tmp = wrappedGetOverlayInfo(child, triggernum); - if (tmp) then + local tmp = wrappedGetOverlayInfo(child, triggernum) + if tmp then for k, v in pairs(tmp) do - overlayInfo[k] = v; + overlayInfo[k] = v end end end else - overlayInfo = wrappedGetOverlayInfo(data, triggernum); + overlayInfo = wrappedGetOverlayInfo(data, triggernum) end - return overlayInfo; + return overlayInfo end function Private.GetTriggerConditions(data) - local conditions = {}; + local conditions = {} for i = 1, #data.triggers do - local triggerSystem = GetTriggerSystem(data, i); - if (triggerSystem) then - conditions[i] = triggerSystem.GetTriggerConditions(data, i); - conditions[i] = conditions[i] or {}; + local triggerSystem = GetTriggerSystem(data, i) + if triggerSystem then + conditions[i] = triggerSystem.GetTriggerConditions(data, i) + conditions[i] = conditions[i] or {} conditions[i].show = { display = L["Active"], type = "bool", test = function(state, needle) - return (state and state.id and triggerState[state.id].triggers[i] or false) == (needle == 1); - end + return (state and state.id and triggerState[state.id].triggers[i] or false) == (needle == 1) + end, } end end - return conditions; + return conditions end local function CreateFallbackState(id, triggernum) - fallbacksStates[id] = fallbacksStates[id] or {}; - fallbacksStates[id][triggernum] = fallbacksStates[id][triggernum] or {}; + fallbacksStates[id] = fallbacksStates[id] or {} + fallbacksStates[id][triggernum] = fallbacksStates[id][triggernum] or {} - local states = fallbacksStates[id][triggernum]; - states[""] = states[""] or {}; - local state = states[""]; + local states = fallbacksStates[id][triggernum] + states[""] = states[""] or {} + local state = states[""] - local data = db.displays[id]; - local triggerSystem = GetTriggerSystem(data, triggernum); - if (triggerSystem) then + local data = db.displays[id] + local triggerSystem = GetTriggerSystem(data, triggernum) + if triggerSystem then triggerSystem.CreateFallbackState(data, triggernum, state) state.trigger = data.triggers[triggernum].trigger state.triggernum = triggernum else - state.show = true; - state.changed = true; - state.progressType = "timed"; - state.duration = 0; - state.expirationTime = math.huge; + state.show = true + state.changed = true + state.progressType = "timed" + state.duration = 0 + state.expirationTime = math.huge end state.id = id - return states; + return states end -local currentTooltipRegion; -local currentTooltipOwner; +local currentTooltipRegion +local currentTooltipOwner local function UpdateMouseoverTooltip(region) - if(region == currentTooltipRegion) then - Private.ShowMouseoverTooltip(currentTooltipRegion, currentTooltipOwner); + if region == currentTooltipRegion then + Private.ShowMouseoverTooltip(currentTooltipRegion, currentTooltipOwner) end end @@ -3576,112 +3805,112 @@ function Private.ShowMouseoverTooltip(region, owner) return end - currentTooltipRegion = region; - currentTooltipOwner = owner; + currentTooltipRegion = region + currentTooltipOwner = owner - GameTooltip:SetOwner(owner, "ANCHOR_NONE"); - GameTooltip:SetPoint("LEFT", owner, "RIGHT"); - GameTooltip:ClearLines(); + GameTooltip:SetOwner(owner, "ANCHOR_NONE") + GameTooltip:SetPoint("LEFT", owner, "RIGHT") + GameTooltip:ClearLines() - local triggerType; - if (region.state) then - triggerType = region.state.trigger.type; + local triggerType + if region.state then + triggerType = region.state.trigger.type end - local triggerSystem = triggerType and triggerTypes[triggerType]; - if (not triggerSystem) then - GameTooltip:Hide(); - return; + local triggerSystem = triggerType and triggerTypes[triggerType] + if not triggerSystem then + GameTooltip:Hide() + return end - if (triggerSystem.SetToolTip(region.state.trigger, region.state)) then - GameTooltip:Show(); + if triggerSystem.SetToolTip(region.state.trigger, region.state) then + GameTooltip:Show() else - GameTooltip:Hide(); + GameTooltip:Hide() end end function Private.HideTooltip() - currentTooltipRegion = nil; - currentTooltipOwner = nil; + currentTooltipRegion = nil + currentTooltipOwner = nil -- If a tooltip was shown for a "restricted" frame, that is e.g. for a aura -- anchored to a nameplate, then that frame is no longer clamped to the screen, -- because restricted frames can't be clamped. So dance to make the tooltip -- unrestricted and then clamp it again. GameTooltip:ClearAllPoints() - GameTooltip:SetPoint("RIGHT", UIParent, "LEFT"); + GameTooltip:SetPoint("RIGHT", UIParent, "LEFT") GameTooltip:SetClampedToScreen(true) GameTooltip:Hide() end do - local hiddenTooltip; + local hiddenTooltip function WeakAuras.GetHiddenTooltip() - if not(hiddenTooltip) then - hiddenTooltip = CreateFrame("GameTooltip", "WeakAurasTooltip", nil, "GameTooltipTemplate"); - hiddenTooltip:SetOwner(WorldFrame, "ANCHOR_NONE"); + if not hiddenTooltip then + hiddenTooltip = CreateFrame("GameTooltip", "WeakAurasTooltip", nil, "GameTooltipTemplate") + hiddenTooltip:SetOwner(WorldFrame, "ANCHOR_NONE") hiddenTooltip:AddFontStrings( hiddenTooltip:CreateFontString("$parentTextLeft1", nil, "GameTooltipText"), hiddenTooltip:CreateFontString("$parentTextRight1", nil, "GameTooltipText") - ); + ) end - return hiddenTooltip; + return hiddenTooltip end end function WeakAuras.GetAuraTooltipInfo(unit, index, filter) - local tooltip = WeakAuras.GetHiddenTooltip(); - tooltip:ClearLines(); - tooltip:SetUnitAura(unit, index, filter); + local tooltip = WeakAuras.GetHiddenTooltip() + tooltip:ClearLines() + tooltip:SetUnitAura(unit, index, filter) local tooltipTextLine = select(5, tooltip:GetRegions()) - local tooltipText = tooltipTextLine and tooltipTextLine:GetObjectType() == "FontString" and tooltipTextLine:GetText() or ""; - local debuffType = "none"; - local found = false; - local tooltipSize = {}; - if(tooltipText) then + local tooltipText = tooltipTextLine and tooltipTextLine:GetObjectType() == "FontString" and tooltipTextLine:GetText() or "" + local debuffType = "none" + local found = false + local tooltipSize = {} + if tooltipText then for t in tooltipText:gmatch("(%d[%d%.,]*)") do - if (LARGE_NUMBER_SEPERATOR == ",") then - t = t:gsub(",", ""); + if LARGE_NUMBER_SEPERATOR == "," then + t = t:gsub(",", "") else - t = t:gsub("%.", ""); - t = t:gsub(",", "."); + t = t:gsub("%.", "") + t = t:gsub(",", ".") end - tinsert(tooltipSize, tonumber(t)); + tinsert(tooltipSize, tonumber(t)) end end - if (#tooltipSize) then - return tooltipText, debuffType, unpack(tooltipSize); + if #tooltipSize then + return tooltipText, debuffType, unpack(tooltipSize) else - return tooltipText, debuffType, 0; + return tooltipText, debuffType, 0 end end -local FrameTimes = {}; +local FrameTimes = {} function WeakAuras.ProfileFrames(all) - UpdateAddOnCPUUsage(); + UpdateAddOnCPUUsage() for name, frame in pairs(WeakAuras.frames) do - local FrameTime = GetFrameCPUUsage(frame); - FrameTimes[name] = FrameTimes[name] or 0; - if(all or FrameTime > FrameTimes[name]) then - print("|cFFFF0000"..name.."|r -", FrameTime, "-", FrameTime - FrameTimes[name]); + local FrameTime = GetFrameCPUUsage(frame) + FrameTimes[name] = FrameTimes[name] or 0 + if all or FrameTime > FrameTimes[name] then + print("|cFFFF0000" .. name .. "|r -", FrameTime, "-", FrameTime - FrameTimes[name]) end - FrameTimes[name] = FrameTime; + FrameTimes[name] = FrameTime end end -local DisplayTimes = {}; +local DisplayTimes = {} function WeakAuras.ProfileDisplays(all) - UpdateAddOnCPUUsage(); + UpdateAddOnCPUUsage() for id, regionData in pairs(WeakAuras.regions) do - local DisplayTime = GetFrameCPUUsage(regionData.region, true); - DisplayTimes[id] = DisplayTimes[id] or 0; - if(all or DisplayTime > DisplayTimes[id]) then - print("|cFFFF0000"..id.."|r -", DisplayTime, "-", DisplayTime - DisplayTimes[id]); + local DisplayTime = GetFrameCPUUsage(regionData.region, true) + DisplayTimes[id] = DisplayTimes[id] or 0 + if all or DisplayTime > DisplayTimes[id] then + print("|cFFFF0000" .. id .. "|r -", DisplayTime, "-", DisplayTime - DisplayTimes[id]) end - DisplayTimes[id] = DisplayTime; + DisplayTimes[id] = DisplayTime end end @@ -3689,16 +3918,16 @@ function Private.ValueFromPath(data, path) if not data then return nil end - if (#path == 0) then + if #path == 0 then return data - elseif(#path == 1) then - return data[path[1]]; + elseif #path == 1 then + return data[path[1]] else - local reducedPath = {}; - for i=2,#path do - reducedPath[i-1] = path[i]; + local reducedPath = {} + for i = 2, #path do + reducedPath[i - 1] = path[i] end - return Private.ValueFromPath(data[path[1]], reducedPath); + return Private.ValueFromPath(data[path[1]], reducedPath) end end @@ -3706,45 +3935,45 @@ function Private.ValueToPath(data, path, value) if not data then return end - if(#path == 1) then - data[path[1]] = value; + if #path == 1 then + data[path[1]] = value else - local reducedPath = {}; - for i=2,#path do - reducedPath[i-1] = path[i]; + local reducedPath = {} + for i = 2, #path do + reducedPath[i - 1] = path[i] end - Private.ValueToPath(data[path[1]], reducedPath, value); + Private.ValueToPath(data[path[1]], reducedPath, value) end end -Private.frameLevels = {}; +Private.frameLevels = {} local function SetFrameLevel(id, frameLevel) - if (Private.frameLevels[id] == frameLevel) then - return; + if Private.frameLevels[id] == frameLevel then + return end - if (WeakAuras.regions[id] and WeakAuras.regions[id].region) then + if WeakAuras.regions[id] and WeakAuras.regions[id].region then Private.ApplyFrameLevel(WeakAuras.regions[id].region, frameLevel) end - if (clones[id]) then - for i,v in pairs(clones[id]) do + if clones[id] then + for i, v in pairs(clones[id]) do Private.ApplyFrameLevel(v, frameLevel) end end - Private.frameLevels[id] = frameLevel; + Private.frameLevels[id] = frameLevel end function Private.FixGroupChildrenOrderForGroup(data) - local frameLevel = 1; + local frameLevel = 1 if data.parent == nil then for child in Private.TraverseAll(data) do - SetFrameLevel(child.id, frameLevel); - frameLevel = frameLevel + 4; + SetFrameLevel(child.id, frameLevel) + frameLevel = frameLevel + 4 end end end local function GetFrameLevelFor(id) - return Private.frameLevels[id] or 5; + return Private.frameLevels[id] or 5 end function Private.ApplyFrameLevel(region, frameLevel) @@ -3765,96 +3994,96 @@ function Private.ApplyFrameLevel(region, frameLevel) end function WeakAuras.EnsureString(input) - if (input == nil) then - return ""; + if input == nil then + return "" end - return tostring(input); + return tostring(input) end -- Handle coroutines -local dynFrame = {}; +local dynFrame = {} do -- Internal data - dynFrame.frame = CreateFrame("Frame"); - dynFrame.update = {}; - dynFrame.size = 0; + dynFrame.frame = CreateFrame("Frame") + dynFrame.update = {} + dynFrame.size = 0 -- Add an action to be resumed via OnUpdate function dynFrame.AddAction(self, name, func) if not name then - name = string.format("NIL", dynFrame.size+1); + name = string.format("NIL", dynFrame.size + 1) end if not dynFrame.update[name] then - dynFrame.update[name] = func; + dynFrame.update[name] = func dynFrame.size = dynFrame.size + 1 - dynFrame.frame:Show(); + dynFrame.frame:Show() end end -- Remove an action from OnUpdate function dynFrame.RemoveAction(self, name) if dynFrame.update[name] then - dynFrame.update[name] = nil; + dynFrame.update[name] = nil dynFrame.size = dynFrame.size - 1 if dynFrame.size == 0 then - dynFrame.frame:Hide(); + dynFrame.frame:Hide() end end end -- Setup frame - dynFrame.frame:Hide(); + dynFrame.frame:Hide() dynFrame.frame:SetScript("OnUpdate", function(self, elapsed) -- Start timing - local start = debugprofilestop(); - local hasData = true; + local start = debugprofilestop() + local hasData = true -- Resume as often as possible (Limit to 16ms per frame -> 60 FPS) - while (debugprofilestop() - start < 16 and hasData) do + while debugprofilestop() - start < 16 and hasData do -- Stop loop without data - hasData = false; + hasData = false -- Resume all coroutines for name, func in pairs(dynFrame.update) do -- Loop has data - hasData = true; + hasData = true -- Resume or remove if coroutine.status(func) ~= "dead" then local ok, msg = coroutine.resume(func) if not ok then - geterrorhandler()(msg .. '\n' .. debugstack(func)) + geterrorhandler()(msg .. "\n" .. debugstack(func)) end else - dynFrame:RemoveAction(name); + dynFrame:RemoveAction(name) end end end - end); + end) end -Private.dynFrame = dynFrame; +Private.dynFrame = dynFrame function WeakAuras.RegisterTriggerSystem(types, triggerSystem) for _, v in ipairs(types) do - triggerTypes[v] = triggerSystem; + triggerTypes[v] = triggerSystem end - tinsert(triggerSystems, triggerSystem); + tinsert(triggerSystems, triggerSystem) end function WeakAuras.RegisterTriggerSystemOptions(types, func) for _, v in ipairs(types) do - Private.triggerTypesOptions[v] = func; + Private.triggerTypesOptions[v] = func end end function WeakAuras.GetTriggerStateForTrigger(id, triggernum) - if (triggernum == -1) then - return Private.GetGlobalConditionState(); + if triggernum == -1 then + return Private.GetGlobalConditionState() end triggerState[id][triggernum] = triggerState[id][triggernum] or {} - return triggerState[id][triggernum]; + return triggerState[id][triggernum] end function WeakAuras.GetActiveStates(id) @@ -3937,9 +4166,9 @@ do end function Private.UpdateFakeStatesFor(id) - if (WeakAuras.IsOptionsOpen() and visibleFakeStates[id]) then + if WeakAuras.IsOptionsOpen() and visibleFakeStates[id] then local data = WeakAuras.GetData(id) - if (data) then + if data then for triggernum in ipairs(data.triggers) do Private.SetAllStatesHidden(id, triggernum) local triggerSystem = GetTriggerSystem(data, triggernum) @@ -3957,111 +4186,109 @@ do end local function startStopTimers(id, cloneId, triggernum, state) - if (state.show) then - if (state.autoHide and state.duration and state.duration > 0 and not state.paused) then -- autohide, update timer - timers[id] = timers[id] or {}; - timers[id][triggernum] = timers[id][triggernum] or {}; - timers[id][triggernum][cloneId] = timers[id][triggernum][cloneId] or {}; - local record = timers[id][triggernum][cloneId]; - if (state.expirationTime == nil) then - state.expirationTime = GetTime() + state.duration; - end - if (record.expirationTime ~= state.expirationTime or record.state ~= state) then - if (record.handle ~= nil) then - timer:CancelTimer(record.handle); + if state.show then + if state.autoHide and state.duration and state.duration > 0 and not state.paused then -- autohide, update timer + timers[id] = timers[id] or {} + timers[id][triggernum] = timers[id][triggernum] or {} + timers[id][triggernum][cloneId] = timers[id][triggernum][cloneId] or {} + local record = timers[id][triggernum][cloneId] + if state.expirationTime == nil then + state.expirationTime = GetTime() + state.duration + end + if record.expirationTime ~= state.expirationTime or record.state ~= state then + if record.handle ~= nil then + timer:CancelTimer(record.handle) end - record.handle = timer:ScheduleTimerFixed( - function() - if (state.show ~= false and state.show ~= nil) then - state.show = false; - state.changed = true; - Private.UpdatedTriggerState(id); - end - end, - state.expirationTime - GetTime()); - record.expirationTime = state.expirationTime; + record.handle = timer:ScheduleTimerFixed(function() + if state.show ~= false and state.show ~= nil then + state.show = false + state.changed = true + Private.UpdatedTriggerState(id) + end + end, state.expirationTime - GetTime()) + record.expirationTime = state.expirationTime record.state = state end else -- no auto hide, delete timer - if (timers[id] and timers[id][triggernum] and timers[id][triggernum][cloneId]) then - local record = timers[id][triggernum][cloneId]; - if (record.handle) then - timer:CancelTimer(record.handle); + if timers[id] and timers[id][triggernum] and timers[id][triggernum][cloneId] then + local record = timers[id][triggernum][cloneId] + if record.handle then + timer:CancelTimer(record.handle) end - record.handle = nil; - record.expirationTime = nil; + record.handle = nil + record.expirationTime = nil record.state = nil end end else -- not shown - if(timers[id] and timers[id][triggernum] and timers[id][triggernum][cloneId]) then - local record = timers[id][triggernum][cloneId]; - if (record.handle) then - timer:CancelTimer(record.handle); + if timers[id] and timers[id][triggernum] and timers[id][triggernum][cloneId] then + local record = timers[id][triggernum][cloneId] + if record.handle then + timer:CancelTimer(record.handle) end - record.handle = nil; - record.expirationTime = nil; + record.handle = nil + record.expirationTime = nil record.state = nil end end end local function ApplyStateToRegion(id, cloneId, region, parent) - region:Update(); + region:Update() region.subRegionEvents:Notify("Update", region.state, region.states) - UpdateMouseoverTooltip(region); - region:Expand(); + UpdateMouseoverTooltip(region) + region:Expand() if parent and parent.ActivateChild then parent:ActivateChild(id, cloneId) end end -- Fallbacks if the states are empty -local emptyState = {}; -emptyState[""] = {}; +local emptyState = {} +emptyState[""] = {} local function applyToTriggerStateTriggers(stateShown, id, triggernum) - if (stateShown and not triggerState[id].triggers[triggernum]) then - triggerState[id].triggers[triggernum] = true; - triggerState[id].triggerCount = triggerState[id].triggerCount + 1; + if stateShown and not triggerState[id].triggers[triggernum] then + triggerState[id].triggers[triggernum] = true + triggerState[id].triggerCount = triggerState[id].triggerCount + 1 - return true; - elseif (not stateShown and triggerState[id].triggers[triggernum]) then - triggerState[id].triggers[triggernum] = false; - triggerState[id].triggerCount = triggerState[id].triggerCount - 1; + return true + elseif not stateShown and triggerState[id].triggers[triggernum] then + triggerState[id].triggers[triggernum] = false + triggerState[id].triggerCount = triggerState[id].triggerCount - 1 - return true; + return true end - return false; + return false end local function evaluateTriggerStateTriggers(id) - local result = false; - Private.ActivateAuraEnvironment(id); + local result = false + Private.ActivateAuraEnvironment(id) if WeakAuras.IsOptionsOpen() then -- While the options are open ignore the combination function return triggerState[id].triggerCount > 0 end - if (triggerState[id].disjunctive == "any" and triggerState[id].triggerCount > 0) then - result = true; - elseif(triggerState[id].disjunctive == "all" and triggerState[id].triggerCount == triggerState[id].numTriggers) then - result = true; + if triggerState[id].disjunctive == "any" and triggerState[id].triggerCount > 0 then + result = true + elseif triggerState[id].disjunctive == "all" and triggerState[id].triggerCount == triggerState[id].numTriggers then + result = true else - if (triggerState[id].disjunctive == "custom" and triggerState[id].triggerLogicFunc) then - local ok, returnValue = xpcall(triggerState[id].triggerLogicFunc, Private.GetErrorHandlerId(id, L["Custom Trigger Combination"]), triggerState[id].triggers); - result = ok and returnValue; + if triggerState[id].disjunctive == "custom" and triggerState[id].triggerLogicFunc then + local ok, returnValue = xpcall(triggerState[id].triggerLogicFunc, Private.GetErrorHandlerId(id, L["Custom Trigger Combination"]), triggerState[id].triggers) + result = ok and returnValue end end - Private.ActivateAuraEnvironment(); + Private.ActivateAuraEnvironment() - return result; + return result end local function ApplyStatesToRegions(id, activeTrigger, states) @@ -4075,8 +4302,8 @@ local function ApplyStatesToRegions(id, activeTrigger, states) parent:Suspend() end for cloneId, state in pairs(states) do - if (state.show) then - local region = WeakAuras.GetRegion(id, cloneId); + if state.show then + local region = WeakAuras.GetRegion(id, cloneId) local applyChanges = not region.toShow or state.changed or region.state ~= state region.state = state region.states = region.states or {} @@ -4090,9 +4317,11 @@ local function ApplyStatesToRegions(id, activeTrigger, states) triggerState = triggerStates[cloneId] or triggerStates[""] or {} end if triggernum > 0 then - applyChanges = applyChanges or region.states[triggernum] ~= triggerState or (triggerState and triggerState.changed) - or region.states[triggernum] ~= triggerState - or (triggerState and triggerState.changed) + applyChanges = applyChanges + or region.states[triggernum] ~= triggerState + or (triggerState and triggerState.changed) + or region.states[triggernum] ~= triggerState + or (triggerState and triggerState.changed) end region.states[triggernum] = triggerState @@ -4101,8 +4330,8 @@ local function ApplyStatesToRegions(id, activeTrigger, states) region:SetTriggerProvidesTimer(needsTimerTick) - if (applyChanges) then - ApplyStateToRegion(id, cloneId, region, parent); + if applyChanges then + ApplyStateToRegion(id, cloneId, region, parent) Private.RunConditions(region, data.uid, not state.show) end end @@ -4131,105 +4360,105 @@ function Private.SendDelayedWatchedTriggers() end function Private.UpdatedTriggerState(id) - if (not triggerState[id]) then - return; + if not triggerState[id] then + return end - local changed = false; + local changed = false for triggernum = 1, triggerState[id].numTriggers do - triggerState[id][triggernum] = triggerState[id][triggernum] or {}; + triggerState[id][triggernum] = triggerState[id][triggernum] or {} - local anyStateShown = false; + local anyStateShown = false for cloneId, state in pairs(triggerState[id][triggernum]) do - state.trigger = db.displays[id].triggers[triggernum] and db.displays[id].triggers[triggernum].trigger; - state.triggernum = triggernum; - state.id = id; + state.trigger = db.displays[id].triggers[triggernum] and db.displays[id].triggers[triggernum].trigger + state.triggernum = triggernum + state.id = id - if (state.changed) then - startStopTimers(id, cloneId, triggernum, state); + if state.changed then + startStopTimers(id, cloneId, triggernum, state) end - anyStateShown = anyStateShown or state.show; + anyStateShown = anyStateShown or state.show end -- Update triggerState.triggers - changed = applyToTriggerStateTriggers(anyStateShown, id, triggernum) or changed; + changed = applyToTriggerStateTriggers(anyStateShown, id, triggernum) or changed end -- Figure out whether we should be shown or not - local show = triggerState[id].show; + local show = triggerState[id].show - if (changed or show == nil) then - show = evaluateTriggerStateTriggers(id); + if changed or show == nil then + show = evaluateTriggerStateTriggers(id) end -- Figure out which subtrigger is active, and if it changed - local newActiveTrigger = triggerState[id].activeTriggerMode; - if (newActiveTrigger == Private.trigger_modes.first_active) then + local newActiveTrigger = triggerState[id].activeTriggerMode + if newActiveTrigger == Private.trigger_modes.first_active then -- Mode is first active trigger, so find a active trigger for i = 1, triggerState[id].numTriggers do - if (triggerState[id].triggers[i]) then - newActiveTrigger = i; - break; + if triggerState[id].triggers[i] then + newActiveTrigger = i + break end end end - local oldShow = triggerState[id].show; - triggerState[id].activeTrigger = newActiveTrigger; - triggerState[id].show = show; + local oldShow = triggerState[id].show + triggerState[id].activeTrigger = newActiveTrigger + triggerState[id].show = show triggerState[id].fallbackStates = nil - local activeTriggerState = WeakAuras.GetTriggerStateForTrigger(id, newActiveTrigger); - if (not next(activeTriggerState)) then - if (show) then + local activeTriggerState = WeakAuras.GetTriggerStateForTrigger(id, newActiveTrigger) + if not next(activeTriggerState) then + if show then activeTriggerState = CreateFallbackState(id, newActiveTrigger) else - activeTriggerState = emptyState; + activeTriggerState = emptyState end - elseif (show) then - local needsFallback = true; + elseif show then + local needsFallback = true for _, state in pairs(activeTriggerState) do - if (state.show) then - needsFallback = false; - break; + if state.show then + needsFallback = false + break end end - if (needsFallback) then + if needsFallback then activeTriggerState = CreateFallbackState(id, newActiveTrigger) end end triggerState[id].activeStates = activeTriggerState - local region; + local region -- Now apply - if (show and not oldShow) then -- Hide => Show - ApplyStatesToRegions(id, newActiveTrigger, activeTriggerState); - elseif (not show and oldShow) then -- Show => Hide + if show and not oldShow then -- Hide => Show + ApplyStatesToRegions(id, newActiveTrigger, activeTriggerState) + elseif not show and oldShow then -- Show => Hide for _, clone in pairs(clones[id]) do clone:Collapse() end WeakAuras.regions[id].region:Collapse() - elseif (show and oldShow) then -- Already shown, update regions + elseif show and oldShow then -- Already shown, update regions -- Hide old clones for cloneId, clone in pairs(clones[id]) do - if (not activeTriggerState[cloneId] or not activeTriggerState[cloneId].show) then + if not activeTriggerState[cloneId] or not activeTriggerState[cloneId].show then clone:Collapse() end end - if (not activeTriggerState[""] or not activeTriggerState[""].show) then + if not activeTriggerState[""] or not activeTriggerState[""].show then WeakAuras.regions[id].region:Collapse() end -- Show new states - ApplyStatesToRegions(id, newActiveTrigger, activeTriggerState); + ApplyStatesToRegions(id, newActiveTrigger, activeTriggerState) end for triggernum = 1, triggerState[id].numTriggers do - triggerState[id][triggernum] = triggerState[id][triggernum] or {}; + triggerState[id][triggernum] = triggerState[id][triggernum] or {} for cloneId, state in pairs(triggerState[id][triggernum]) do - if (not state.show) then - triggerState[id][triggernum][cloneId] = nil; + if not state.show then + triggerState[id][triggernum][cloneId] = nil end - state.changed = false; + state.changed = false end end -- once updatedTriggerStates is complete, and empty states removed, etc., then check for queued watched triggers update @@ -4237,14 +4466,13 @@ function Private.UpdatedTriggerState(id) end function Private.RunCustomTextFunc(region, customFunc) - if not customFunc then return nil end local state = region.state - Private.ActivateAuraEnvironment(region.id, region.cloneId, region.state, region.states); + Private.ActivateAuraEnvironment(region.id, region.cloneId, region.state, region.states) local progress = Private.dynamic_texts.p.func(Private.dynamic_texts.p.get(state), state, 1) local dur = Private.dynamic_texts.t.func(Private.dynamic_texts.t.get(state), state, 1) @@ -4264,14 +4492,16 @@ function Private.RunCustomTextFunc(region, customFunc) end end - local custom = {select(2, xpcall(customFunc, Private.GetErrorHandlerId(region.id, L["Custom Text Function"]), expirationTime or math.huge, duration or 0, progress, dur, name, icon, stacks))} + local custom = { + select(2, xpcall(customFunc, Private.GetErrorHandlerId(region.id, L["Custom Text Function"]), expirationTime or math.huge, duration or 0, progress, dur, name, icon, stacks)), + } Private.ActivateAuraEnvironment(nil) return custom end local function ReplaceValuePlaceHolders(textStr, region, customFunc, state, formatter) - local value; + local value if string.sub(textStr, 1, 1) == "c" then local custom if customFunc then @@ -4286,7 +4516,9 @@ local function ReplaceValuePlaceHolders(textStr, region, customFunc, state, form value = custom[index] end - if value == nil then value = "" end + if value == nil then + value = "" + end if formatter then value = formatter(value, state) @@ -4296,9 +4528,9 @@ local function ReplaceValuePlaceHolders(textStr, region, customFunc, state, form value = WeakAuras.EnsureString(value) end else - local variable = Private.dynamic_texts[textStr]; - if (not variable) then - return nil; + local variable = Private.dynamic_texts[textStr] + if not variable then + return nil end value = variable.get(state) if formatter then @@ -4308,7 +4540,7 @@ local function ReplaceValuePlaceHolders(textStr, region, customFunc, state, form end end - return value or ""; + return value or "" end -- States: @@ -4328,7 +4560,7 @@ local function nextState(char, state) elseif char == 123 then -- { sign return 3 -- Enter Braced state elseif (char >= 48 and char <= 57) or (char >= 65 and char <= 90) or (char >= 97 and char <= 122) or char == 46 then - -- 0-9a-zA-Z or dot character + -- 0-9a-zA-Z or dot character return 2 -- Enter Percent rest state end return 0 -- % followed by non alpha-numeric. Back to normal state @@ -4355,12 +4587,12 @@ local function ContainsPlaceHolders(textStr, symbolFunc) return false end - local endPos = textStr:len(); + local endPos = textStr:len() local state = 0 local currentPos = 1 local start = 1 while currentPos <= endPos do - local char = string.byte(textStr, currentPos); + local char = string.byte(textStr, currentPos) local nextState = nextState(char, state) if state == 1 then -- Last char was a % @@ -4401,23 +4633,25 @@ end function Private.ContainsPlaceHolders(textStr, toCheck) return ContainsPlaceHolders(textStr, function(symbol) if symbol:len() == 1 and toCheck:find(symbol, 1, true) then - return true + return true end - local _, last = symbol:find("^%d+%.") - if not last then - return false - end + local _, last = symbol:find("^%d+%.") + if not last then + return false + end - symbol = symbol:sub(last + 1) - if symbol:len() == 1 and toCheck:find(symbol, 1, true) then - return true - end + symbol = symbol:sub(last + 1) + if symbol:len() == 1 and toCheck:find(symbol, 1, true) then + return true + end end) end function Private.ContainsAnyPlaceHolders(textStr) - return ContainsPlaceHolders(textStr, function(symbol) return true end) + return ContainsPlaceHolders(textStr, function(symbol) + return true + end) end local function ValueForSymbol(symbol, region, customFunc, regionState, regionStates, useHiddenStates, formatters) @@ -4425,7 +4659,7 @@ local function ValueForSymbol(symbol, region, customFunc, regionState, regionSta triggerNum = triggerNum and tonumber(triggerNum) if triggerNum and sym then if regionStates[triggerNum] then - if (useHiddenStates or regionStates[triggerNum].show) then + if useHiddenStates or regionStates[triggerNum].show then if regionStates[triggerNum][sym] then local value = regionStates[triggerNum][sym] if formatters[symbol] then @@ -4434,14 +4668,14 @@ local function ValueForSymbol(symbol, region, customFunc, regionState, regionSta return tostring(value) or "" end else - local value = ReplaceValuePlaceHolders(sym, region, customFunc, regionStates[triggerNum], formatters[symbol]); + local value = ReplaceValuePlaceHolders(sym, region, customFunc, regionStates[triggerNum], formatters[symbol]) return value or "" end end end return "" elseif regionState[symbol] then - if(useHiddenStates or regionState.show) then + if useHiddenStates or regionState.show then local value = regionState[symbol] if formatters[symbol] then return tostring(formatters[symbol](value, regionState) or "") or "" @@ -4450,34 +4684,34 @@ local function ValueForSymbol(symbol, region, customFunc, regionState, regionSta end end else - local value = (useHiddenStates or regionState.show) and ReplaceValuePlaceHolders(symbol, region, customFunc, regionState, formatters[symbol]); + local value = (useHiddenStates or regionState.show) and ReplaceValuePlaceHolders(symbol, region, customFunc, regionState, formatters[symbol]) return value or "" end end function Private.ReplacePlaceHolders(textStr, region, customFunc, useHiddenStates, formatters) - local regionValues = region.values; - local regionState = region.state or {}; - local regionStates = region.states or {}; - if (not regionState and not regionValues) then - return; + local regionValues = region.values + local regionState = region.state or {} + local regionStates = region.states or {} + if not regionState and not regionValues then + return end - local endPos = textStr:len(); - if (endPos < 2) then - textStr = textStr:gsub("\\n", "\n"); - return textStr; + local endPos = textStr:len() + if endPos < 2 then + textStr = textStr:gsub("\\n", "\n") + return textStr end - if (endPos == 2) then + if endPos == 2 then if string.byte(textStr, 1) == 37 then local symbol = string.sub(textStr, 2) - local value = ValueForSymbol(symbol, region, customFunc, regionState, regionStates, useHiddenStates, formatters); - if (value) then - textStr = tostring(value); + local value = ValueForSymbol(symbol, region, customFunc, regionState, regionStates, useHiddenStates, formatters) + if value then + textStr = tostring(value) end end - textStr = textStr:gsub("\\n", "\n"); - return textStr; + textStr = textStr:gsub("\\n", "\n") + return textStr end local result = "" @@ -4486,7 +4720,7 @@ function Private.ReplacePlaceHolders(textStr, region, customFunc, useHiddenState local start = 1 -- Start of whatever "word" we are currently considering, doesn't include % or {} symbols while currentPos <= endPos do - local char = string.byte(textStr, currentPos); + local char = string.byte(textStr, currentPos) if state == 0 then -- Normal State if char == 37 then -- % sign if currentPos > start then @@ -4532,21 +4766,21 @@ function Private.ReplacePlaceHolders(textStr, region, customFunc, useHiddenState result = result .. "%" end - textStr = result:gsub("\\n", "\n"); - return textStr; + textStr = result:gsub("\\n", "\n") + return textStr end function Private.ParseTextStr(textStr, symbolCallback) if not textStr then return end - local endPos = textStr:len(); + local endPos = textStr:len() local currentPos = 1 -- Position of the "cursor" local state = 0 local start = 1 -- Start of whatever "word" we are currently considering, doesn't include % or {} symbols while currentPos <= endPos do - local char = string.byte(textStr, currentPos); + local char = string.byte(textStr, currentPos) if state == 0 then -- Normal State elseif state == 1 then -- Percent Start State if char == 123 then @@ -4594,8 +4828,8 @@ function Private.CreateFormatters(input, getter, withoutColor) -- Do nothing else local default = (sym == "p" or sym == "t") and "timed" or "none" - local selectedFormat = getter(symbol .. "_format", default) - if (Private.format_types[selectedFormat]) then + local selectedFormat = getter(symbol .. "_format", default) + if Private.format_types[selectedFormat] then formatters[symbol] = Private.format_types[selectedFormat].CreateFormatter(symbol, getter, withoutColor) end end @@ -4608,9 +4842,9 @@ end function Private.IsAuraActive(uid) local id = Private.UIDtoID(uid) - local active = triggerState[id]; + local active = triggerState[id] - return active and active.show; + return active and active.show end function WeakAuras.IsAuraActive(id) @@ -4629,436 +4863,436 @@ end -- Very simple function to convert a hsv angle to a color with -- value hardcoded to 1 and saturation hardcoded to 0.75 local function colorWheel(angle) - local hh = angle / 60; - local i = floor(hh); - local ff = hh - i; - local p = 0; - local q = 0.75 * (1.0 - ff); - local t = 0.75 * ff; - if (i == 0) then - return 0.75, t, p; - elseif (i == 1) then - return q, 0.75, p; - elseif (i == 2) then - return p, 0.75, t; - elseif (i == 3) then - return p, q, 0.75; - elseif (i == 4) then - return t, p, 0.75; + local hh = angle / 60 + local i = floor(hh) + local ff = hh - i + local p = 0 + local q = 0.75 * (1.0 - ff) + local t = 0.75 * ff + if i == 0 then + return 0.75, t, p + elseif i == 1 then + return q, 0.75, p + elseif i == 2 then + return p, 0.75, t + elseif i == 3 then + return p, q, 0.75 + elseif i == 4 then + return t, p, 0.75 else - return 0.75, p, q; + return 0.75, p, q end end local function xPositionNextToOptions() - local xOffset; - local optionsFrame = WeakAuras.OptionsFrame(); - local centerX = (optionsFrame:GetLeft() + optionsFrame:GetRight()) / 2; - if (centerX > GetScreenWidth() / 2) then - if (optionsFrame:GetLeft() > 400) then - xOffset = optionsFrame:GetLeft() - 200; + local xOffset + local optionsFrame = WeakAuras.OptionsFrame() + local centerX = (optionsFrame:GetLeft() + optionsFrame:GetRight()) / 2 + if centerX > GetScreenWidth() / 2 then + if optionsFrame:GetLeft() > 400 then + xOffset = optionsFrame:GetLeft() - 200 else - xOffset = optionsFrame:GetLeft() / 2; + xOffset = optionsFrame:GetLeft() / 2 end else - if (GetScreenWidth() - optionsFrame:GetRight() > 400 ) then - xOffset = optionsFrame:GetRight() + 200; + if GetScreenWidth() - optionsFrame:GetRight() > 400 then + xOffset = optionsFrame:GetRight() + 200 else - xOffset = (GetScreenWidth() + optionsFrame:GetRight()) / 2; + xOffset = (GetScreenWidth() + optionsFrame:GetRight()) / 2 end end - return xOffset; + return xOffset end -local mouseFrame; +local mouseFrame local function ensureMouseFrame() - if (mouseFrame) then - return; + if mouseFrame then + return end - mouseFrame = CreateFrame("Frame", "WeakAurasAttachToMouseFrame", UIParent); - mouseFrame.attachedVisibleFrames = {}; - mouseFrame:SetWidth(1); - mouseFrame:SetHeight(1); + mouseFrame = CreateFrame("Frame", "WeakAurasAttachToMouseFrame", UIParent) + mouseFrame.attachedVisibleFrames = {} + mouseFrame:SetWidth(1) + mouseFrame:SetHeight(1) - local moverFrame = CreateFrame("Frame", "WeakAurasMousePointerFrame", mouseFrame); - mouseFrame.moverFrame = moverFrame; - moverFrame:SetPoint("TOPLEFT", mouseFrame, "CENTER"); - moverFrame:SetWidth(32); - moverFrame:SetHeight(32); - moverFrame:SetFrameStrata("FULLSCREEN"); -- above settings dialog + local moverFrame = CreateFrame("Frame", "WeakAurasMousePointerFrame", mouseFrame) + mouseFrame.moverFrame = moverFrame + moverFrame:SetPoint("TOPLEFT", mouseFrame, "CENTER") + moverFrame:SetWidth(32) + moverFrame:SetHeight(32) + moverFrame:SetFrameStrata("FULLSCREEN") -- above settings dialog moverFrame:EnableMouse(true) moverFrame:SetScript("OnMouseDown", function() - mouseFrame:SetMovable(true); + mouseFrame:SetMovable(true) mouseFrame:StartMoving() - end); + end) moverFrame:SetScript("OnMouseUp", function() - mouseFrame:StopMovingOrSizing(); - mouseFrame:SetMovable(false); - local xOffset = mouseFrame:GetRight() - GetScreenWidth(); - local yOffset = mouseFrame:GetTop() - GetScreenHeight(); - db.mousePointerFrame = db.mousePointerFrame or {}; - db.mousePointerFrame.xOffset = xOffset; - db.mousePointerFrame.yOffset = yOffset; - end); + mouseFrame:StopMovingOrSizing() + mouseFrame:SetMovable(false) + local xOffset = mouseFrame:GetRight() - GetScreenWidth() + local yOffset = mouseFrame:GetTop() - GetScreenHeight() + db.mousePointerFrame = db.mousePointerFrame or {} + db.mousePointerFrame.xOffset = xOffset + db.mousePointerFrame.yOffset = yOffset + end) moverFrame.colorWheelAnimation = function() - local angle = ((GetTime() - moverFrame.startTime) % 5) / 5 * 360; - moverFrame.texture:SetVertexColor(colorWheel(angle)); - end; - local texture = moverFrame:CreateTexture(nil, "BACKGROUND"); - moverFrame.texture = texture; - texture:SetAllPoints(moverFrame); - texture:SetTexture("Interface\\Cursor\\Point"); + local angle = ((GetTime() - moverFrame.startTime) % 5) / 5 * 360 + moverFrame.texture:SetVertexColor(colorWheel(angle)) + end + local texture = moverFrame:CreateTexture(nil, "BACKGROUND") + moverFrame.texture = texture + texture:SetAllPoints(moverFrame) + texture:SetTexture("Interface\\Cursor\\Point") local label = moverFrame:CreateFontString(nil, "BACKGROUND", "GameFontHighlightSmall") label:SetJustifyH("LEFT") label:SetJustifyV("TOP") - label:SetPoint("TOPLEFT", moverFrame, "BOTTOMLEFT"); - label:SetText("WeakAuras Anchor"); + label:SetPoint("TOPLEFT", moverFrame, "BOTTOMLEFT") + label:SetText("WeakAuras Anchor") - moverFrame:Hide(); + moverFrame:Hide() mouseFrame.OptionsOpened = function() - if (db.mousePointerFrame) then + if db.mousePointerFrame then -- Restore from settings - mouseFrame:ClearAllPoints(); - mouseFrame:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", db.mousePointerFrame.xOffset, db.mousePointerFrame.yOffset); + mouseFrame:ClearAllPoints() + mouseFrame:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", db.mousePointerFrame.xOffset, db.mousePointerFrame.yOffset) else -- Fnd a suitable position - local optionsFrame = WeakAuras.OptionsFrame(); - local yOffset = (optionsFrame:GetTop() + optionsFrame:GetBottom()) / 2; - local xOffset = xPositionNextToOptions(); + local optionsFrame = WeakAuras.OptionsFrame() + local yOffset = (optionsFrame:GetTop() + optionsFrame:GetBottom()) / 2 + local xOffset = xPositionNextToOptions() -- We use the top right, because the main frame uses the top right as the reference too - mouseFrame:ClearAllPoints(); - mouseFrame:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", xOffset - GetScreenWidth(), yOffset - GetScreenHeight()); + mouseFrame:ClearAllPoints() + mouseFrame:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", xOffset - GetScreenWidth(), yOffset - GetScreenHeight()) end -- Change the color of the mouse cursor - moverFrame.startTime = GetTime(); - moverFrame:SetScript("OnUpdate", moverFrame.colorWheelAnimation); - mouseFrame:SetScript("OnUpdate", nil); + moverFrame.startTime = GetTime() + moverFrame:SetScript("OnUpdate", moverFrame.colorWheelAnimation) + mouseFrame:SetScript("OnUpdate", nil) end mouseFrame.moveWithMouse = function() - local scale = 1 / UIParent:GetEffectiveScale(); - local x, y = GetCursorPosition(); - mouseFrame:SetPoint("CENTER", UIParent, "BOTTOMLEFT", x * scale, y * scale); + local scale = 1 / UIParent:GetEffectiveScale() + local x, y = GetCursorPosition() + mouseFrame:SetPoint("CENTER", UIParent, "BOTTOMLEFT", x * scale, y * scale) end mouseFrame.OptionsClosed = function() - moverFrame:Hide(); - mouseFrame:ClearAllPoints(); - mouseFrame:SetScript("OnUpdate", mouseFrame.moveWithMouse); - moverFrame:SetScript("OnUpdate", nil); - wipe(mouseFrame.attachedVisibleFrames); + moverFrame:Hide() + mouseFrame:ClearAllPoints() + mouseFrame:SetScript("OnUpdate", mouseFrame.moveWithMouse) + moverFrame:SetScript("OnUpdate", nil) + wipe(mouseFrame.attachedVisibleFrames) end mouseFrame.expand = function(self, id) - local data = WeakAuras.GetData(id); - if (data.anchorFrameType == "MOUSE") then - self.attachedVisibleFrames[id] = true; - self:updateVisible(); + local data = WeakAuras.GetData(id) + if data.anchorFrameType == "MOUSE" then + self.attachedVisibleFrames[id] = true + self:updateVisible() end end mouseFrame.collapse = function(self, id) - self.attachedVisibleFrames[id] = nil; - self:updateVisible(); + self.attachedVisibleFrames[id] = nil + self:updateVisible() end mouseFrame.rename = function(self, oldid, newid) - self.attachedVisibleFrames[newid] = self.attachedVisibleFrames[oldid]; - self.attachedVisibleFrames[oldid] = nil; - self:updateVisible(); + self.attachedVisibleFrames[newid] = self.attachedVisibleFrames[oldid] + self.attachedVisibleFrames[oldid] = nil + self:updateVisible() end mouseFrame.delete = function(self, id) - self.attachedVisibleFrames[id] = nil; - self:updateVisible(); + self.attachedVisibleFrames[id] = nil + self:updateVisible() end mouseFrame.anchorFrame = function(self, id, anchorFrameType) - if (anchorFrameType == "MOUSE") then - self.attachedVisibleFrames[id] = true; + if anchorFrameType == "MOUSE" then + self.attachedVisibleFrames[id] = true else - self.attachedVisibleFrames[id] = nil; + self.attachedVisibleFrames[id] = nil end - self:updateVisible(); + self:updateVisible() end mouseFrame.updateVisible = function(self) - if (not WeakAuras.IsOptionsOpen()) then - return; + if not WeakAuras.IsOptionsOpen() then + return end - if (next(self.attachedVisibleFrames)) then - mouseFrame.moverFrame:Show(); + if next(self.attachedVisibleFrames) then + mouseFrame.moverFrame:Show() else - mouseFrame.moverFrame:Hide(); + mouseFrame.moverFrame:Hide() end end - if (WeakAuras.IsOptionsOpen()) then - mouseFrame:OptionsOpened(); + if WeakAuras.IsOptionsOpen() then + mouseFrame:OptionsOpened() else - mouseFrame:OptionsClosed(); + mouseFrame:OptionsClosed() end - Private.mouseFrame = mouseFrame; + Private.mouseFrame = mouseFrame end -local personalRessourceDisplayFrame; +local personalRessourceDisplayFrame function Private.ensurePRDFrame() - if (personalRessourceDisplayFrame) then - return; + if personalRessourceDisplayFrame then + return end - personalRessourceDisplayFrame = CreateFrame("Frame", "WeakAurasAttachToPRD", UIParent); - personalRessourceDisplayFrame:Hide(); - personalRessourceDisplayFrame.attachedVisibleFrames = {}; - Private.personalRessourceDisplayFrame = personalRessourceDisplayFrame; + personalRessourceDisplayFrame = CreateFrame("Frame", "WeakAurasAttachToPRD", UIParent) + personalRessourceDisplayFrame:Hide() + personalRessourceDisplayFrame.attachedVisibleFrames = {} + Private.personalRessourceDisplayFrame = personalRessourceDisplayFrame - local moverFrame = CreateFrame("Frame", "WeakAurasPRDMoverFrame", personalRessourceDisplayFrame); - personalRessourceDisplayFrame.moverFrame = moverFrame; - moverFrame:SetPoint("TOPLEFT", personalRessourceDisplayFrame, "TOPLEFT", -2, 2); - moverFrame:SetPoint("BOTTOMRIGHT", personalRessourceDisplayFrame, "BOTTOMRIGHT", 2, -2); - moverFrame:SetFrameStrata("FULLSCREEN"); -- above settings dialog + local moverFrame = CreateFrame("Frame", "WeakAurasPRDMoverFrame", personalRessourceDisplayFrame) + personalRessourceDisplayFrame.moverFrame = moverFrame + moverFrame:SetPoint("TOPLEFT", personalRessourceDisplayFrame, "TOPLEFT", -2, 2) + moverFrame:SetPoint("BOTTOMRIGHT", personalRessourceDisplayFrame, "BOTTOMRIGHT", 2, -2) + moverFrame:SetFrameStrata("FULLSCREEN") -- above settings dialog moverFrame:EnableMouse(true) moverFrame:SetScript("OnMouseDown", function() - personalRessourceDisplayFrame:SetMovable(true); + personalRessourceDisplayFrame:SetMovable(true) personalRessourceDisplayFrame:StartMoving() - end); + end) moverFrame:SetScript("OnMouseUp", function() - personalRessourceDisplayFrame:StopMovingOrSizing(); - personalRessourceDisplayFrame:SetMovable(false); - local xOffset = personalRessourceDisplayFrame:GetRight(); - local yOffset = personalRessourceDisplayFrame:GetTop(); - - db.personalRessourceDisplayFrame = db.personalRessourceDisplayFrame or {}; - local scale = UIParent:GetEffectiveScale() / personalRessourceDisplayFrame:GetEffectiveScale(); - db.personalRessourceDisplayFrame.xOffset = xOffset / scale - GetScreenWidth(); - db.personalRessourceDisplayFrame.yOffset = yOffset / scale - GetScreenHeight(); - end); - moverFrame:Hide(); - - local texture = moverFrame:CreateTexture(nil, "BACKGROUND"); - personalRessourceDisplayFrame.texture = texture; - texture:SetAllPoints(moverFrame); - texture:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\PRDFrame"); + personalRessourceDisplayFrame:StopMovingOrSizing() + personalRessourceDisplayFrame:SetMovable(false) + local xOffset = personalRessourceDisplayFrame:GetRight() + local yOffset = personalRessourceDisplayFrame:GetTop() + + db.personalRessourceDisplayFrame = db.personalRessourceDisplayFrame or {} + local scale = UIParent:GetEffectiveScale() / personalRessourceDisplayFrame:GetEffectiveScale() + db.personalRessourceDisplayFrame.xOffset = xOffset / scale - GetScreenWidth() + db.personalRessourceDisplayFrame.yOffset = yOffset / scale - GetScreenHeight() + end) + moverFrame:Hide() + + local texture = moverFrame:CreateTexture(nil, "BACKGROUND") + personalRessourceDisplayFrame.texture = texture + texture:SetAllPoints(moverFrame) + texture:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\PRDFrame") local label = moverFrame:CreateFontString(nil, "BACKGROUND", "GameFontHighlight") - label:SetPoint("CENTER", moverFrame, "CENTER"); - label:SetText("WeakAuras Anchor"); + label:SetPoint("CENTER", moverFrame, "CENTER") + label:SetText("WeakAuras Anchor") - personalRessourceDisplayFrame:RegisterEvent('NAME_PLATE_UNIT_ADDED'); - personalRessourceDisplayFrame:RegisterEvent('NAME_PLATE_UNIT_REMOVED'); + personalRessourceDisplayFrame:RegisterEvent("NAME_PLATE_UNIT_ADDED") + personalRessourceDisplayFrame:RegisterEvent("NAME_PLATE_UNIT_REMOVED") personalRessourceDisplayFrame.Attach = function(self, frame, frameTL, frameBR) - self:SetParent(frame); - self:ClearAllPoints(); - self:SetPoint("TOPLEFT", frameTL, "TOPLEFT"); - self:SetPoint("BOTTOMRIGHT", frameBR, "BOTTOMRIGHT"); + self:SetParent(frame) + self:ClearAllPoints() + self:SetPoint("TOPLEFT", frameTL, "TOPLEFT") + self:SetPoint("BOTTOMRIGHT", frameBR, "BOTTOMRIGHT") self:Show() end personalRessourceDisplayFrame.Detach = function(self, frame) - self:ClearAllPoints(); + self:ClearAllPoints() self:Hide() self:SetParent(UIParent) end personalRessourceDisplayFrame.OptionsOpened = function() - personalRessourceDisplayFrame:Detach(); - personalRessourceDisplayFrame:SetScript("OnEvent", nil); - personalRessourceDisplayFrame:ClearAllPoints(); + personalRessourceDisplayFrame:Detach() + personalRessourceDisplayFrame:SetScript("OnEvent", nil) + personalRessourceDisplayFrame:ClearAllPoints() personalRessourceDisplayFrame:Show() - local xOffset, yOffset; - if (db.personalRessourceDisplayFrame) then - xOffset = db.personalRessourceDisplayFrame.xOffset; - yOffset = db.personalRessourceDisplayFrame.yOffset; + local xOffset, yOffset + if db.personalRessourceDisplayFrame then + xOffset = db.personalRessourceDisplayFrame.xOffset + yOffset = db.personalRessourceDisplayFrame.yOffset end -- Calculate size of self nameplate - local prdWidth; - local prdHeight; - - if (KuiNameplatesCore and KuiNameplatesCore.profile) then - prdWidth = KuiNameplatesCore.profile.frame_width_personal; - prdHeight = KuiNameplatesCore.profile.frame_height_personal; - if (KuiNameplatesCore.profile.ignore_uiscale) then - local _, screenWidth = GetPhysicalScreenSize(); - local uiScale = 1; - if (screenWidth) then - uiScale = 768 / screenWidth; + local prdWidth + local prdHeight + + if KuiNameplatesCore and KuiNameplatesCore.profile then + prdWidth = KuiNameplatesCore.profile.frame_width_personal + prdHeight = KuiNameplatesCore.profile.frame_height_personal + if KuiNameplatesCore.profile.ignore_uiscale then + local _, screenWidth = GetPhysicalScreenSize() + local uiScale = 1 + if screenWidth then + uiScale = 768 / screenWidth end - personalRessourceDisplayFrame:SetScale(uiScale / UIParent:GetEffectiveScale()); + personalRessourceDisplayFrame:SetScale(uiScale / UIParent:GetEffectiveScale()) else - personalRessourceDisplayFrame:SetScale(1); + personalRessourceDisplayFrame:SetScale(1) end - personalRessourceDisplayFrame.texture:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\PRDFrameKui"); + personalRessourceDisplayFrame.texture:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\PRDFrameKui") else - local namePlateVerticalScale = tonumber(GetCVar("NamePlateVerticalScale")); - local zeroBasedScale = namePlateVerticalScale - 1.0; - local clampedZeroBasedScale = Saturate(zeroBasedScale); - local horizontalScale = tonumber(GetCVar("NamePlateHorizontalScale")); - local baseNamePlateWidth = NamePlateDriverFrame.baseNamePlateWidth; - prdWidth = baseNamePlateWidth * horizontalScale * Lerp(1.1, 1.0, clampedZeroBasedScale) - 24; - prdHeight = 4 * namePlateVerticalScale * Lerp(1.2, 1.0, clampedZeroBasedScale) * 2 + 1; - personalRessourceDisplayFrame:SetScale(1 / UIParent:GetEffectiveScale()); - personalRessourceDisplayFrame.texture:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\PRDFrame"); + local namePlateVerticalScale = tonumber(GetCVar("NamePlateVerticalScale")) + local zeroBasedScale = namePlateVerticalScale - 1.0 + local clampedZeroBasedScale = Saturate(zeroBasedScale) + local horizontalScale = tonumber(GetCVar("NamePlateHorizontalScale")) + local baseNamePlateWidth = NamePlateDriverFrame.baseNamePlateWidth + prdWidth = baseNamePlateWidth * horizontalScale * Lerp(1.1, 1.0, clampedZeroBasedScale) - 24 + prdHeight = 4 * namePlateVerticalScale * Lerp(1.2, 1.0, clampedZeroBasedScale) * 2 + 1 + personalRessourceDisplayFrame:SetScale(1 / UIParent:GetEffectiveScale()) + personalRessourceDisplayFrame.texture:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\PRDFrame") end - local scale = UIParent:GetEffectiveScale() / personalRessourceDisplayFrame:GetEffectiveScale(); - if (not xOffset or not yOffset) then - local optionsFrame = WeakAuras.OptionsFrame(); - yOffset = optionsFrame:GetBottom() + prdHeight / scale - GetScreenHeight(); - xOffset = xPositionNextToOptions() + prdWidth / 2 / scale - GetScreenWidth(); + local scale = UIParent:GetEffectiveScale() / personalRessourceDisplayFrame:GetEffectiveScale() + if not xOffset or not yOffset then + local optionsFrame = WeakAuras.OptionsFrame() + yOffset = optionsFrame:GetBottom() + prdHeight / scale - GetScreenHeight() + xOffset = xPositionNextToOptions() + prdWidth / 2 / scale - GetScreenWidth() end - xOffset = xOffset * scale; - yOffset = yOffset * scale; + xOffset = xOffset * scale + yOffset = yOffset * scale - personalRessourceDisplayFrame:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", xOffset, yOffset); - personalRessourceDisplayFrame:SetPoint("BOTTOMLEFT", UIParent, "TOPRIGHT", xOffset - prdWidth, yOffset - prdHeight); + personalRessourceDisplayFrame:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", xOffset, yOffset) + personalRessourceDisplayFrame:SetPoint("BOTTOMLEFT", UIParent, "TOPRIGHT", xOffset - prdWidth, yOffset - prdHeight) end personalRessourceDisplayFrame.OptionsClosed = function() - personalRessourceDisplayFrame:SetScale(1); - local frame = C_NamePlate.GetNamePlateForUnit("player"); - if (frame) then - if (Plater and frame.unitFrame.PlaterOnScreen) then - personalRessourceDisplayFrame:Attach(frame, frame.unitFrame.healthBar, frame.unitFrame.powerBar); - elseif (frame.kui and frame.kui.bg and frame.kui:IsShown()) then - personalRessourceDisplayFrame:Attach(frame.kui, frame.kui.bg, frame.kui.bg); - elseif (ElvUIPlayerNamePlateAnchor) then - personalRessourceDisplayFrame:Attach(ElvUIPlayerNamePlateAnchor, ElvUIPlayerNamePlateAnchor, ElvUIPlayerNamePlateAnchor); + personalRessourceDisplayFrame:SetScale(1) + local frame = C_NamePlate.GetNamePlateForUnit("player") + if frame then + if Plater and frame.unitFrame.PlaterOnScreen then + personalRessourceDisplayFrame:Attach(frame, frame.unitFrame.healthBar, frame.unitFrame.powerBar) + elseif frame.kui and frame.kui.bg and frame.kui:IsShown() then + personalRessourceDisplayFrame:Attach(frame.kui, frame.kui.bg, frame.kui.bg) + elseif ElvUIPlayerNamePlateAnchor then + personalRessourceDisplayFrame:Attach(ElvUIPlayerNamePlateAnchor, ElvUIPlayerNamePlateAnchor, ElvUIPlayerNamePlateAnchor) else - personalRessourceDisplayFrame:Attach(frame, frame.UnitFrame.healthBar, NamePlateDriverFrame.classNamePlatePowerBar); + personalRessourceDisplayFrame:Attach(frame, frame.UnitFrame.healthBar, NamePlateDriverFrame.classNamePlatePowerBar) end else - personalRessourceDisplayFrame:Detach(); - personalRessourceDisplayFrame:Hide(); + personalRessourceDisplayFrame:Detach() + personalRessourceDisplayFrame:Hide() end - personalRessourceDisplayFrame:SetScript("OnEvent", personalRessourceDisplayFrame.eventHandler); - personalRessourceDisplayFrame.texture:Hide(); - personalRessourceDisplayFrame.moverFrame:Hide(); - wipe(personalRessourceDisplayFrame.attachedVisibleFrames); + personalRessourceDisplayFrame:SetScript("OnEvent", personalRessourceDisplayFrame.eventHandler) + personalRessourceDisplayFrame.texture:Hide() + personalRessourceDisplayFrame.moverFrame:Hide() + wipe(personalRessourceDisplayFrame.attachedVisibleFrames) end personalRessourceDisplayFrame.eventHandler = function(self, event, nameplate) - Private.StartProfileSystem("prd"); - if (event == "NAME_PLATE_UNIT_ADDED") then - if (UnitIsUnit(nameplate, "player")) then - local frame = C_NamePlate.GetNamePlateForUnit("player"); - if (frame) then - if (Plater and frame.unitFrame.PlaterOnScreen) then - personalRessourceDisplayFrame:Attach(frame, frame.unitFrame.healthBar, frame.unitFrame.powerBar); - elseif (frame.kui and frame.kui.bg and frame.kui:IsShown()) then - personalRessourceDisplayFrame:Attach(frame.kui, KuiNameplatesPlayerAnchor, KuiNameplatesPlayerAnchor); - elseif (ElvUIPlayerNamePlateAnchor) then - personalRessourceDisplayFrame:Attach(ElvUIPlayerNamePlateAnchor, ElvUIPlayerNamePlateAnchor, ElvUIPlayerNamePlateAnchor); + Private.StartProfileSystem("prd") + if event == "NAME_PLATE_UNIT_ADDED" then + if UnitIsUnit(nameplate, "player") then + local frame = C_NamePlate.GetNamePlateForUnit("player") + if frame then + if Plater and frame.unitFrame.PlaterOnScreen then + personalRessourceDisplayFrame:Attach(frame, frame.unitFrame.healthBar, frame.unitFrame.powerBar) + elseif frame.kui and frame.kui.bg and frame.kui:IsShown() then + personalRessourceDisplayFrame:Attach(frame.kui, KuiNameplatesPlayerAnchor, KuiNameplatesPlayerAnchor) + elseif ElvUIPlayerNamePlateAnchor then + personalRessourceDisplayFrame:Attach(ElvUIPlayerNamePlateAnchor, ElvUIPlayerNamePlateAnchor, ElvUIPlayerNamePlateAnchor) else - personalRessourceDisplayFrame:Attach(frame, frame.UnitFrame.healthBar, NamePlateDriverFrame.classNamePlatePowerBar); + personalRessourceDisplayFrame:Attach(frame, frame.UnitFrame.healthBar, NamePlateDriverFrame.classNamePlatePowerBar) end - personalRessourceDisplayFrame:Show(); - db.personalRessourceDisplayFrame = db.personalRessourceDisplayFrame or {}; + personalRessourceDisplayFrame:Show() + db.personalRessourceDisplayFrame = db.personalRessourceDisplayFrame or {} else - personalRessourceDisplayFrame:Detach(); - personalRessourceDisplayFrame:Hide(); + personalRessourceDisplayFrame:Detach() + personalRessourceDisplayFrame:Hide() end end - elseif (event == "NAME_PLATE_UNIT_REMOVED") then - if (UnitIsUnit(nameplate, "player")) then - personalRessourceDisplayFrame:Detach(); - personalRessourceDisplayFrame:Hide(); + elseif event == "NAME_PLATE_UNIT_REMOVED" then + if UnitIsUnit(nameplate, "player") then + personalRessourceDisplayFrame:Detach() + personalRessourceDisplayFrame:Hide() end end - Private.StopProfileSystem("prd"); + Private.StopProfileSystem("prd") end personalRessourceDisplayFrame.expand = function(self, id) - local data = WeakAuras.GetData(id); - if (data.anchorFrameType == "PRD") then - self.attachedVisibleFrames[id] = true; - self:updateVisible(); + local data = WeakAuras.GetData(id) + if data.anchorFrameType == "PRD" then + self.attachedVisibleFrames[id] = true + self:updateVisible() end end personalRessourceDisplayFrame.collapse = function(self, id) - self.attachedVisibleFrames[id] = nil; - self:updateVisible(); + self.attachedVisibleFrames[id] = nil + self:updateVisible() end personalRessourceDisplayFrame.rename = function(self, oldid, newid) - self.attachedVisibleFrames[newid] = self.attachedVisibleFrames[oldid]; - self.attachedVisibleFrames[oldid] = nil; - self:updateVisible(); + self.attachedVisibleFrames[newid] = self.attachedVisibleFrames[oldid] + self.attachedVisibleFrames[oldid] = nil + self:updateVisible() end personalRessourceDisplayFrame.delete = function(self, id) - self.attachedVisibleFrames[id] = nil; - self:updateVisible(); + self.attachedVisibleFrames[id] = nil + self:updateVisible() end personalRessourceDisplayFrame.anchorFrame = function(self, id, anchorFrameType) - if (anchorFrameType == "PRD" or anchorFrameType == "NAMEPLATE") then - self.attachedVisibleFrames[id] = true; + if anchorFrameType == "PRD" or anchorFrameType == "NAMEPLATE" then + self.attachedVisibleFrames[id] = true else - self.attachedVisibleFrames[id] = nil; + self.attachedVisibleFrames[id] = nil end - self:updateVisible(); + self:updateVisible() end personalRessourceDisplayFrame.updateVisible = function(self) - if (not WeakAuras.IsOptionsOpen()) then - return; + if not WeakAuras.IsOptionsOpen() then + return end - if (next(self.attachedVisibleFrames)) then - personalRessourceDisplayFrame.texture:Show(); - personalRessourceDisplayFrame.moverFrame:Show(); - personalRessourceDisplayFrame:Show(); + if next(self.attachedVisibleFrames) then + personalRessourceDisplayFrame.texture:Show() + personalRessourceDisplayFrame.moverFrame:Show() + personalRessourceDisplayFrame:Show() else - personalRessourceDisplayFrame.texture:Hide(); - personalRessourceDisplayFrame.moverFrame:Hide(); - personalRessourceDisplayFrame:Hide(); + personalRessourceDisplayFrame.texture:Hide() + personalRessourceDisplayFrame.moverFrame:Hide() + personalRessourceDisplayFrame:Hide() end end - if (WeakAuras.IsOptionsOpen()) then - personalRessourceDisplayFrame.OptionsOpened(); + if WeakAuras.IsOptionsOpen() then + personalRessourceDisplayFrame.OptionsOpened() else - personalRessourceDisplayFrame.OptionsClosed(); + personalRessourceDisplayFrame.OptionsClosed() end Private.personalRessourceDisplayFrame = personalRessourceDisplayFrame end -local postPonedAnchors = {}; +local postPonedAnchors = {} local anchorTimer local function tryAnchorAgain() - local delayed = postPonedAnchors; - postPonedAnchors = {}; - anchorTimer = nil; + local delayed = postPonedAnchors + postPonedAnchors = {} + anchorTimer = nil for id, _ in pairs(delayed) do - local data = WeakAuras.GetData(id); - local region = WeakAuras.GetRegion(id); - if (data and region) then - local parent = WeakAurasFrame; - if (data.parent and regions[data.parent]) then - parent = regions[data.parent].region; + local data = WeakAuras.GetData(id) + local region = WeakAuras.GetRegion(id) + if data and region then + local parent = WeakAurasFrame + if data.parent and regions[data.parent] then + parent = regions[data.parent].region end - Private.AnchorFrame(data, region, parent); + Private.AnchorFrame(data, region, parent) end end end local function postponeAnchor(id) - postPonedAnchors[id] = true; - if (not anchorTimer) then - anchorTimer = timer:ScheduleTimer(tryAnchorAgain, 1); + postPonedAnchors[id] = true + if not anchorTimer then + anchorTimer = timer:ScheduleTimer(tryAnchorAgain, 1) end end @@ -5070,35 +5304,39 @@ local function GetAnchorFrame(data, region, parent) local id = region.id local anchorFrameType = data.anchorFrameType local anchorFrameFrame = data.anchorFrameFrame - if not id then return end - if (personalRessourceDisplayFrame) then - personalRessourceDisplayFrame:anchorFrame(id, anchorFrameType); + if not id then + return + end + if personalRessourceDisplayFrame then + personalRessourceDisplayFrame:anchorFrame(id, anchorFrameType) end - if (mouseFrame) then - mouseFrame:anchorFrame(id, anchorFrameType); + if mouseFrame then + mouseFrame:anchorFrame(id, anchorFrameType) end - if (anchorFrameType == "SCREEN") then - return parent; + if anchorFrameType == "SCREEN" then + return parent end - if (anchorFrameType == "PRD") then - Private.ensurePRDFrame(); - personalRessourceDisplayFrame:anchorFrame(id, anchorFrameType); - return personalRessourceDisplayFrame; + if anchorFrameType == "PRD" then + Private.ensurePRDFrame() + personalRessourceDisplayFrame:anchorFrame(id, anchorFrameType) + return personalRessourceDisplayFrame end - if (anchorFrameType == "MOUSE") then - ensureMouseFrame(); - mouseFrame:anchorFrame(id, anchorFrameType); - return mouseFrame; + if anchorFrameType == "MOUSE" then + ensureMouseFrame() + mouseFrame:anchorFrame(id, anchorFrameType) + return mouseFrame end - if (anchorFrameType == "NAMEPLATE") then + if anchorFrameType == "NAMEPLATE" then local unit = region.state.unit local frame = unit and WeakAuras.GetUnitNameplate(unit) - if frame then return frame end + if frame then + return frame + end if WeakAuras.IsOptionsOpen() then Private.ensurePRDFrame() personalRessourceDisplayFrame:anchorFrame(id, anchorFrameType) @@ -5106,7 +5344,7 @@ local function GetAnchorFrame(data, region, parent) end end - if (anchorFrameType == "UNITFRAME") then + if anchorFrameType == "UNITFRAME" then local unit = region.state.unit if unit then local frame = WeakAuras.GetUnitFrame(unit) or WeakAuras.HiddenFrames @@ -5115,33 +5353,33 @@ local function GetAnchorFrame(data, region, parent) anchor_unitframe_monitor[region] = { data = data, parent = parent, - frame = frame + frame = frame, } return frame end end end - if (anchorFrameType == "SELECTFRAME" and anchorFrameFrame) then - if(anchorFrameFrame:sub(1, 10) == "WeakAuras:") then - local frame_name = anchorFrameFrame:sub(11); - if (frame_name == id) then - return parent; + if anchorFrameType == "SELECTFRAME" and anchorFrameFrame then + if anchorFrameFrame:sub(1, 10) == "WeakAuras:" then + local frame_name = anchorFrameFrame:sub(11) + if frame_name == id then + return parent end - if(regions[frame_name]) then - return regions[frame_name].region; + if regions[frame_name] then + return regions[frame_name].region end - postponeAnchor(id); + postponeAnchor(id) else - if (Private.GetSanitizedGlobal(anchorFrameFrame)) then - return Private.GetSanitizedGlobal(anchorFrameFrame); + if Private.GetSanitizedGlobal(anchorFrameFrame) then + return Private.GetSanitizedGlobal(anchorFrameFrame) end - postponeAnchor(id); - return parent; + postponeAnchor(id) + return parent end end - if (anchorFrameType == "CUSTOM" and region.customAnchorFunc) then + if anchorFrameType == "CUSTOM" and region.customAnchorFunc then Private.StartProfileSystem("custom region anchor") Private.StartProfileAura(region.id) Private.ActivateAuraEnvironment(region.id, region.cloneId, region.state) @@ -5158,27 +5396,29 @@ local function GetAnchorFrame(data, region, parent) end end -- Fallback - return parent; + return parent end local anchorFrameDeferred = {} function Private.AnchorFrame(data, region, parent) - if data.anchorFrameType == "CUSTOM" - and (data.regionType == "group" or data.regionType == "dynamicgroup") - and not WeakAuras.IsLoginFinished() - and not anchorFrameDeferred[data.id] + if + data.anchorFrameType == "CUSTOM" + and (data.regionType == "group" or data.regionType == "dynamicgroup") + and not WeakAuras.IsLoginFinished() + and not anchorFrameDeferred[data.id] then - loginQueue[#loginQueue + 1] = {Private.AnchorFrame, {data, region, parent}} + loginQueue[#loginQueue + 1] = { Private.AnchorFrame, { data, region, parent } } anchorFrameDeferred[data.id] = true else - local anchorParent = GetAnchorFrame(data, region, parent); - if not anchorParent then return end - if (data.anchorFrameParent or data.anchorFrameParent == nil - or data.anchorFrameType == "SCREEN" or data.anchorFrameType == "MOUSE") then - xpcall(region.SetParent, Private.GetErrorHandlerId(data.id, L["Anchoring"]), region, anchorParent); + local anchorParent = GetAnchorFrame(data, region, parent) + if not anchorParent then + return + end + if data.anchorFrameParent or data.anchorFrameParent == nil or data.anchorFrameType == "SCREEN" or data.anchorFrameType == "MOUSE" then + xpcall(region.SetParent, Private.GetErrorHandlerId(data.id, L["Anchoring"]), region, anchorParent) else - region:SetParent(parent or WeakAurasFrame); + region:SetParent(parent or WeakAurasFrame) end local anchorPoint = data.anchorPoint @@ -5192,12 +5432,12 @@ function Private.AnchorFrame(data, region, parent) end end - region:SetAnchor(data.selfPoint, anchorParent, anchorPoint); + region:SetAnchor(data.selfPoint, anchorParent, anchorPoint) - if(data.frameStrata == 1) then - region:SetFrameStrata(region:GetParent():GetFrameStrata()); + if data.frameStrata == 1 then + region:SetFrameStrata(region:GetParent():GetFrameStrata()) else - region:SetFrameStrata(Private.frame_strata_types[data.frameStrata]); + region:SetFrameStrata(Private.frame_strata_types[data.frameStrata]) end Private.ApplyFrameLevel(region) anchorFrameDeferred[data.id] = nil @@ -5206,11 +5446,11 @@ end function WeakAuras.FindUnusedId(prefix) prefix = prefix or "New" - local num = 2; + local num = 2 local id = prefix - while(db.displays[id]) do - id = prefix .. " " .. num; - num = num + 1; + while db.displays[id] do + id = prefix .. " " .. num + num = num + 1 end return id end @@ -5237,7 +5477,7 @@ end function Private.IsCLEUSubevent(subevent) if Private.subevent_prefix_types[subevent] then - return true + return true else for prefix in pairs(Private.subevent_prefix_types) do if subevent:match(prefix) then @@ -5259,14 +5499,14 @@ function WeakAuras.SafeToNumber(input) end local textSymbols = { - ["{rt1}"] = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_1:0|t", - ["{rt2}"] = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_2:0|t ", - ["{rt3}"] = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_3:0|t ", - ["{rt4}"] = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_4:0|t ", - ["{rt5}"] = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_5:0|t ", - ["{rt6}"] = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_6:0|t ", - ["{rt7}"] = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_7:0|t ", - ["{rt8}"] = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_8:0|t " + ["{rt1}"] = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_1:0|t", + ["{rt2}"] = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_2:0|t ", + ["{rt3}"] = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_3:0|t ", + ["{rt4}"] = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_4:0|t ", + ["{rt5}"] = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_5:0|t ", + ["{rt6}"] = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_6:0|t ", + ["{rt7}"] = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_7:0|t ", + ["{rt8}"] = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_8:0|t ", } function WeakAuras.ReplaceRaidMarkerSymbols(txt) @@ -5314,7 +5554,7 @@ function Private.ReplaceLocalizedRaidMarkers(txt) start = lastChar end else - start = lastChar + start = lastChar end end end @@ -5384,7 +5624,6 @@ function WeakAuras.ParseNameCheck(name) local name = "" local realm = "" - for index = 1, #match do local c = match:sub(index, index) @@ -5430,17 +5669,19 @@ function WeakAuras.ParseNameCheck(name) return false end return self.name[name] or self.realm[realm] or self.full[name .. "-" .. realm] - end + end, } - if not name then return end + if not name then + return + end local start = 1 - local last = name:find(',', start, true) + local last = name:find(",", start, true) - while (last) do + while last do matches:AddMatch(name, start, last - 1) start = last + 1 - last = name:find(',', start, true) + last = name:find(",", start, true) end last = #name @@ -5450,7 +5691,9 @@ function WeakAuras.ParseNameCheck(name) end function WeakAuras.ParseZoneCheck(input) - if not input then return end + if not input then + return + end local matcher = { Check = function(self, zoneId, zonegroupId) @@ -5460,7 +5703,7 @@ function WeakAuras.ParseZoneCheck(input) local id = tonumber(strtrim(input:sub(start, last))) if id then local prevChar = input:sub(start - 1, start - 1) - if prevChar == 'g' or prevChar == 'G' then + if prevChar == "g" or prevChar == "G" then self.zoneGroupIds[id] = true else self.zoneIds[id] = true @@ -5468,15 +5711,15 @@ function WeakAuras.ParseZoneCheck(input) end end, zoneIds = {}, - zoneGroupIds = {} + zoneGroupIds = {}, } - local start = input:find('%d', 1) - local last = input:find('%D', start) - while (last) do + local start = input:find("%d", 1) + local last = input:find("%D", start) + while last do matcher:AddId(input, start, last - 1) - start = input:find('%d', last + 1) - last = input:find('%D', start) + start = input:find("%d", last + 1) + last = input:find("%D", start) end last = #input @@ -5607,5 +5850,3 @@ do return coroutine.wrap(TraverseParents), data end end - - diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGUIContainer-WeakAurasInlineGroup.lua b/WeakAurasOptions/AceGUI-Widgets/AceGUIContainer-WeakAurasInlineGroup.lua index fe78a51c25..b05b14b139 100644 --- a/WeakAurasOptions/AceGUI-Widgets/AceGUIContainer-WeakAurasInlineGroup.lua +++ b/WeakAurasOptions/AceGUI-Widgets/AceGUIContainer-WeakAurasInlineGroup.lua @@ -3,11 +3,15 @@ WeakAurasInlineGroup based on InlineGroup Container Simple container widget that has the same API as a InlineGroup, without actually showing any borders or a title. -------------------------------------------------------------------------------]] -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local Type, Version = "WeakAurasInlineGroup", 2 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) -if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end +if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then + return +end -- Lua APIs local pairs = pairs @@ -19,59 +23,60 @@ local CreateFrame, UIParent = CreateFrame, UIParent Methods -------------------------------------------------------------------------------]] local methods = { - ["OnAcquire"] = function(self) - self:SetWidth(300) - self:SetHeight(100) - self:SetTitle("") - end, + ["OnAcquire"] = function(self) + self:SetWidth(300) + self:SetHeight(100) + self:SetTitle("") + end, - -- ["OnRelease"] = nil, + -- ["OnRelease"] = nil, - ["SetTitle"] = function(self) + ["SetTitle"] = function(self) -- Do nothing - end, - + end, - ["LayoutFinished"] = function(self, width, height) - if self.noAutoHeight then return end - self:SetHeight(height or 0) - end, + ["LayoutFinished"] = function(self, width, height) + if self.noAutoHeight then + return + end + self:SetHeight(height or 0) + end, - ["OnWidthSet"] = function(self, width) - local content = self.content - content:SetWidth(width) - content.width = width - end, + ["OnWidthSet"] = function(self, width) + local content = self.content + content:SetWidth(width) + content.width = width + end, - ["OnHeightSet"] = function(self, height) - local content = self.content - content:SetHeight(height) - content.height = height - end + ["OnHeightSet"] = function(self, height) + local content = self.content + content:SetHeight(height) + content.height = height + end, } --[[----------------------------------------------------------------------------- Constructor -------------------------------------------------------------------------------]] local function Constructor() - local frame = CreateFrame("Frame", nil, UIParent) - frame:SetFrameStrata("FULLSCREEN_DIALOG") + local frame = CreateFrame("Frame", nil, UIParent) + frame:SetFrameStrata("FULLSCREEN_DIALOG") - --Container Support - local content = CreateFrame("Frame", nil, frame) - content:SetPoint("TOPLEFT", 0, 0) - content:SetPoint("BOTTOMRIGHT", 0, 0) + --Container Support + local content = CreateFrame("Frame", nil, frame) + content:SetPoint("TOPLEFT", 0, 0) + content:SetPoint("BOTTOMRIGHT", 0, 0) - local widget = { - frame = frame, - content = content, - type = Type - } - for method, func in pairs(methods) do - widget[method] = func - end + local widget = { + frame = frame, + content = content, + type = Type, + } + for method, func in pairs(methods) do + widget[method] = func + end - return AceGUI:RegisterAsContainer(widget) + return AceGUI:RegisterAsContainer(widget) end AceGUI:RegisterWidgetType(Type, Constructor, Version) diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGUIContainer-WeakAurasTreeGroup.lua b/WeakAurasOptions/AceGUI-Widgets/AceGUIContainer-WeakAurasTreeGroup.lua index 51b621e288..37c4c834d2 100644 --- a/WeakAurasOptions/AceGUI-Widgets/AceGUIContainer-WeakAurasTreeGroup.lua +++ b/WeakAurasOptions/AceGUI-Widgets/AceGUIContainer-WeakAurasTreeGroup.lua @@ -3,11 +3,15 @@ WeakAurasTreeGroup Container Container that uses a tree control to switch between groups. This file was forked from AceGUIContainer-TreeGroup.lua version 41 -------------------------------------------------------------------------------]] -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local Type, Version = "WeakAurasTreeGroup", 3 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) -if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end +if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then + return +end local WoW80 = select(4, GetBuildInfo()) >= 80000 @@ -26,22 +30,22 @@ local CreateFrame, UIParent = CreateFrame, UIParent -- Recycling functions local new, del do - local pool = setmetatable({},{__mode='k'}) - function new() - local t = next(pool) - if t then - pool[t] = nil - return t - else - return {} - end - end - function del(t) - for k in pairs(t) do - t[k] = nil - end - pool[t] = true - end + local pool = setmetatable({}, { __mode = "k" }) + function new() + local t = next(pool) + if t then + pool[t] = nil + return t + else + return {} + end + end + function del(t) + for k in pairs(t) do + t[k] = nil + end + pool[t] = true + end end local DEFAULT_TREE_WIDTH = 175 @@ -51,676 +55,688 @@ local DEFAULT_TREE_SIZABLE = true Support functions -------------------------------------------------------------------------------]] local function GetButtonUniqueValue(line) - local parent = line.parent - if parent and parent.value then - return GetButtonUniqueValue(parent).."\001"..line.value - else - return line.value - end + local parent = line.parent + if parent and parent.value then + return GetButtonUniqueValue(parent) .. "\001" .. line.value + else + return line.value + end end local function UpdateButton(button, treeline, selected, canExpand, isExpanded) - local self = button.obj - local toggle = button.toggle - local text = treeline.text or "" - local icon = treeline.icon - local iconCoords = treeline.iconCoords - local level = treeline.level - local value = treeline.value - local fileId = treeline.fileId - local uniquevalue = treeline.uniquevalue - local disabled = treeline.disabled - - button.treeline = treeline - button.value = value - button.fileId = fileId - button.uniquevalue = uniquevalue - if selected then - button:LockHighlight() - button.selected = true - else - button:UnlockHighlight() - button.selected = false - end - button.level = level - if level == 1 then - button:SetNormalFontObject("GameFontNormal") - button:SetHighlightFontObject("GameFontHighlight") - button.text:SetPoint("LEFT", (icon and 16 or 0) + 8, 2) - else - button:SetNormalFontObject("GameFontHighlightSmall") - button:SetHighlightFontObject("GameFontHighlightSmall") - button.text:SetPoint("LEFT", (icon and 16 or 0) + 8 * level, 2) - end - - if disabled then - button:EnableMouse(false) - button.text:SetText("|cff808080"..text..FONT_COLOR_CODE_CLOSE) - else - button.text:SetText(text) - button:EnableMouse(true) - end - - if icon then - button.icon:SetTexture(icon) - button.icon:SetPoint("LEFT", 8 * level, (level == 1) and 0 or 1) - else - button.icon:SetTexture(nil) - end - - if iconCoords then - button.icon:SetTexCoord(unpack(iconCoords)) - else - button.icon:SetTexCoord(0, 1, 0, 1) - end - - if canExpand then - if not isExpanded then - toggle:SetNormalTexture(130838) -- Interface\\Buttons\\UI-PlusButton-UP - toggle:SetPushedTexture(130836) -- Interface\\Buttons\\UI-PlusButton-DOWN - else - toggle:SetNormalTexture(130821) -- Interface\\Buttons\\UI-MinusButton-UP - toggle:SetPushedTexture(130820) -- Interface\\Buttons\\UI-MinusButton-DOWN - end - toggle:Show() - else - toggle:Hide() - end + local self = button.obj + local toggle = button.toggle + local text = treeline.text or "" + local icon = treeline.icon + local iconCoords = treeline.iconCoords + local level = treeline.level + local value = treeline.value + local fileId = treeline.fileId + local uniquevalue = treeline.uniquevalue + local disabled = treeline.disabled + + button.treeline = treeline + button.value = value + button.fileId = fileId + button.uniquevalue = uniquevalue + if selected then + button:LockHighlight() + button.selected = true + else + button:UnlockHighlight() + button.selected = false + end + button.level = level + if level == 1 then + button:SetNormalFontObject("GameFontNormal") + button:SetHighlightFontObject("GameFontHighlight") + button.text:SetPoint("LEFT", (icon and 16 or 0) + 8, 2) + else + button:SetNormalFontObject("GameFontHighlightSmall") + button:SetHighlightFontObject("GameFontHighlightSmall") + button.text:SetPoint("LEFT", (icon and 16 or 0) + 8 * level, 2) + end + + if disabled then + button:EnableMouse(false) + button.text:SetText("|cff808080" .. text .. FONT_COLOR_CODE_CLOSE) + else + button.text:SetText(text) + button:EnableMouse(true) + end + + if icon then + button.icon:SetTexture(icon) + button.icon:SetPoint("LEFT", 8 * level, (level == 1) and 0 or 1) + else + button.icon:SetTexture(nil) + end + + if iconCoords then + button.icon:SetTexCoord(unpack(iconCoords)) + else + button.icon:SetTexCoord(0, 1, 0, 1) + end + + if canExpand then + if not isExpanded then + toggle:SetNormalTexture(130838) -- Interface\\Buttons\\UI-PlusButton-UP + toggle:SetPushedTexture(130836) -- Interface\\Buttons\\UI-PlusButton-DOWN + else + toggle:SetNormalTexture(130821) -- Interface\\Buttons\\UI-MinusButton-UP + toggle:SetPushedTexture(130820) -- Interface\\Buttons\\UI-MinusButton-DOWN + end + toggle:Show() + else + toggle:Hide() + end end local function ShouldDisplayLevel(tree) - local result = false - for k, v in ipairs(tree) do - if v.children == nil and v.visible ~= false then - result = true - elseif v.children then - result = result or ShouldDisplayLevel(v.children) - end - if result then return result end - end - return false + local result = false + for k, v in ipairs(tree) do + if v.children == nil and v.visible ~= false then + result = true + elseif v.children then + result = result or ShouldDisplayLevel(v.children) + end + if result then + return result + end + end + return false end local function addLine(self, v, tree, level, parent) - local line = new() - line.value = v.value - line.text = v.text - line.icon = v.icon - line.iconCoords = v.iconCoords - line.disabled = v.disabled - line.tree = tree - line.level = level - line.parent = parent - line.visible = v.visible - line.uniquevalue = GetButtonUniqueValue(line) - line.fileId = v.fileId - if v.children then - line.hasChildren = true - else - line.hasChildren = nil - end - self.lines[#self.lines+1] = line - return line + local line = new() + line.value = v.value + line.text = v.text + line.icon = v.icon + line.iconCoords = v.iconCoords + line.disabled = v.disabled + line.tree = tree + line.level = level + line.parent = parent + line.visible = v.visible + line.uniquevalue = GetButtonUniqueValue(line) + line.fileId = v.fileId + if v.children then + line.hasChildren = true + else + line.hasChildren = nil + end + self.lines[#self.lines + 1] = line + return line end --fire an update after one frame to catch the treeframes height local function FirstFrameUpdate(frame) - local self = frame.obj - frame:SetScript("OnUpdate", nil) - self:RefreshTree(nil, true) + local self = frame.obj + frame:SetScript("OnUpdate", nil) + self:RefreshTree(nil, true) end local function BuildUniqueValue(...) - local n = select('#', ...) - if n == 1 then - return ... - else - return (...).."\001"..BuildUniqueValue(select(2,...)) - end + local n = select("#", ...) + if n == 1 then + return ... + else + return (...) .. "\001" .. BuildUniqueValue(select(2, ...)) + end end --[[----------------------------------------------------------------------------- Scripts -------------------------------------------------------------------------------]] local function Expand_OnClick(frame) - local button = frame.button - local self = button.obj - local status = (self.status or self.localstatus).groups - status[button.uniquevalue] = not status[button.uniquevalue] - self:RefreshTree() + local button = frame.button + local self = button.obj + local status = (self.status or self.localstatus).groups + status[button.uniquevalue] = not status[button.uniquevalue] + self:RefreshTree() end local function Button_OnClick(frame) - local self = frame.obj - self:Fire("OnClick", frame.uniquevalue, frame.selected) - if not frame.selected then - self:SetSelected(frame.uniquevalue, frame.fileId) - frame.selected = true - frame:LockHighlight() - self:RefreshTree() - end - AceGUI:ClearFocus() + local self = frame.obj + self:Fire("OnClick", frame.uniquevalue, frame.selected) + if not frame.selected then + self:SetSelected(frame.uniquevalue, frame.fileId) + frame.selected = true + frame:LockHighlight() + self:RefreshTree() + end + AceGUI:ClearFocus() end local function Button_OnDoubleClick(button) - local self = button.obj - local status = (self.status or self.localstatus).groups - status[button.uniquevalue] = not status[button.uniquevalue] - self:RefreshTree() + local self = button.obj + local status = (self.status or self.localstatus).groups + status[button.uniquevalue] = not status[button.uniquevalue] + self:RefreshTree() end local function Button_OnEnter(frame) - local self = frame.obj - self:Fire("OnButtonEnter", frame.uniquevalue, frame) + local self = frame.obj + self:Fire("OnButtonEnter", frame.uniquevalue, frame) - if self.enabletooltips then - GameTooltip:SetOwner(frame, "ANCHOR_NONE") - GameTooltip:SetPoint("LEFT",frame,"RIGHT") - GameTooltip:SetText(frame.text:GetText() or "", 1, .82, 0, true) + if self.enabletooltips then + GameTooltip:SetOwner(frame, "ANCHOR_NONE") + GameTooltip:SetPoint("LEFT", frame, "RIGHT") + GameTooltip:SetText(frame.text:GetText() or "", 1, 0.82, 0, true) - GameTooltip:Show() - end + GameTooltip:Show() + end end local function Button_OnLeave(frame) - local self = frame.obj - self:Fire("OnButtonLeave", frame.uniquevalue, frame) + local self = frame.obj + self:Fire("OnButtonLeave", frame.uniquevalue, frame) - if self.enabletooltips then - GameTooltip:Hide() - end + if self.enabletooltips then + GameTooltip:Hide() + end end local function OnScrollValueChanged(frame, value) - if frame.obj.noupdate then return end - local self = frame.obj - local status = self.status or self.localstatus - status.scrollvalue = floor(value + 0.5) - self:RefreshTree() - AceGUI:ClearFocus() + if frame.obj.noupdate then + return + end + local self = frame.obj + local status = self.status or self.localstatus + status.scrollvalue = floor(value + 0.5) + self:RefreshTree() + AceGUI:ClearFocus() end local function Tree_OnSizeChanged(frame) - frame.obj:RefreshTree() + frame.obj:RefreshTree() end local function Tree_OnMouseWheel(frame, delta) - local self = frame.obj - if self.showscroll then - local scrollbar = self.scrollbar - local min, max = scrollbar:GetMinMaxValues() - local value = scrollbar:GetValue() - local newvalue = math_min(max,math_max(min,value - delta)) - if value ~= newvalue then - scrollbar:SetValue(newvalue) - end - end + local self = frame.obj + if self.showscroll then + local scrollbar = self.scrollbar + local min, max = scrollbar:GetMinMaxValues() + local value = scrollbar:GetValue() + local newvalue = math_min(max, math_max(min, value - delta)) + if value ~= newvalue then + scrollbar:SetValue(newvalue) + end + end end local function Dragger_OnLeave(frame) - frame:SetBackdropColor(1, 1, 1, 0) + frame:SetBackdropColor(1, 1, 1, 0) end local function Dragger_OnEnter(frame) - frame:SetBackdropColor(1, 1, 1, 0.8) + frame:SetBackdropColor(1, 1, 1, 0.8) end local function Dragger_OnMouseDown(frame) - local treeframe = frame:GetParent() - treeframe:StartSizing("RIGHT") + local treeframe = frame:GetParent() + treeframe:StartSizing("RIGHT") end local function Dragger_OnMouseUp(frame) - local treeframe = frame:GetParent() - local self = treeframe.obj - local parentFrame = treeframe:GetParent() - treeframe:StopMovingOrSizing() - --treeframe:SetScript("OnUpdate", nil) - treeframe:SetUserPlaced(false) - --Without this :GetHeight will get stuck on the current height, causing the tree contents to not resize - treeframe:SetHeight(0) - treeframe:SetPoint("TOPLEFT", parentFrame, "TOPLEFT",0,0) - treeframe:SetPoint("BOTTOMLEFT", parentFrame, "BOTTOMLEFT",0,0) - - local status = self.status or self.localstatus - status.treewidth = treeframe:GetWidth() - - treeframe.obj:Fire("OnTreeResize",treeframe:GetWidth()) - -- recalculate the content width - treeframe.obj:OnWidthSet(status.fullwidth) - -- update the layout of the content - treeframe.obj:DoLayout() + local treeframe = frame:GetParent() + local self = treeframe.obj + local parentFrame = treeframe:GetParent() + treeframe:StopMovingOrSizing() + --treeframe:SetScript("OnUpdate", nil) + treeframe:SetUserPlaced(false) + --Without this :GetHeight will get stuck on the current height, causing the tree contents to not resize + treeframe:SetHeight(0) + treeframe:SetPoint("TOPLEFT", parentFrame, "TOPLEFT", 0, 0) + treeframe:SetPoint("BOTTOMLEFT", parentFrame, "BOTTOMLEFT", 0, 0) + + local status = self.status or self.localstatus + status.treewidth = treeframe:GetWidth() + + treeframe.obj:Fire("OnTreeResize", treeframe:GetWidth()) + -- recalculate the content width + treeframe.obj:OnWidthSet(status.fullwidth) + -- update the layout of the content + treeframe.obj:DoLayout() end --[[----------------------------------------------------------------------------- Methods -------------------------------------------------------------------------------]] local methods = { - ["OnAcquire"] = function(self) - self:SetTreeWidth(DEFAULT_TREE_WIDTH, DEFAULT_TREE_SIZABLE) - self:EnableButtonTooltips(true) - self.frame:SetScript("OnUpdate", FirstFrameUpdate) - end, - - ["OnRelease"] = function(self) - self.status = nil - self.tree = nil - self.frame:SetScript("OnUpdate", nil) - for k, v in pairs(self.localstatus) do - if k == "groups" then - for k2 in pairs(v) do - v[k2] = nil - end - else - self.localstatus[k] = nil - end - end - self.localstatus.scrollvalue = 0 - self.localstatus.treewidth = DEFAULT_TREE_WIDTH - self.localstatus.treesizable = DEFAULT_TREE_SIZABLE - end, - - ["EnableButtonTooltips"] = function(self, enable) - self.enabletooltips = enable - end, - - ["CreateButton"] = function(self) - local num = AceGUI:GetNextWidgetNum("TreeGroupButton") - local button = CreateFrame("Button", ("AceGUI30TreeButton%d"):format(num), self.treeframe, "OptionsListButtonTemplate") - button.obj = self - - local icon = button:CreateTexture(nil, "OVERLAY") - icon:SetWidth(14) - icon:SetHeight(14) - button.icon = icon - - button:SetScript("OnClick",Button_OnClick) - button:SetScript("OnDoubleClick", Button_OnDoubleClick) - button:SetScript("OnEnter",Button_OnEnter) - button:SetScript("OnLeave",Button_OnLeave) - - button.toggle.button = button - button.toggle:SetScript("OnClick",Expand_OnClick) - - button.text:SetHeight(14) -- Prevents text wrapping - - return button - end, - - ["SetStatusTable"] = function(self, status) - assert(type(status) == "table") - self.status = status - if not status.groups then - status.groups = {} - end - if not status.scrollvalue then - status.scrollvalue = 0 - end - if not status.treewidth then - status.treewidth = DEFAULT_TREE_WIDTH - end - if status.treesizable == nil then - status.treesizable = DEFAULT_TREE_SIZABLE - end - self:SetTreeWidth(status.treewidth,status.treesizable) - self:RefreshTree() - end, - - --sets the tree to be displayed - ["SetTree"] = function(self, tree, filter) - self.filter = filter - if tree then - assert(type(tree) == "table") - end - self.tree = tree - self:RefreshTree() - end, - - ["BuildLevel"] = function(self, tree, level, parent) - local groups = (self.status or self.localstatus).groups - - for i, v in ipairs(tree) do - if v.children then - if not self.filter or ShouldDisplayLevel(v.children) then - local line = addLine(self, v, tree, level, parent) - if groups[line.uniquevalue] then - self:BuildLevel(v.children, level+1, line) - end - end - elseif v.visible ~= false or not self.filter then - addLine(self, v, tree, level, parent) - end - end - end, - - ["RefreshTree"] = function(self,scrollToSelection,fromOnUpdate) - local buttons = self.buttons - local lines = self.lines - - for i, v in ipairs(buttons) do - v:Hide() - end - while lines[1] do - local t = tremove(lines) - for k in pairs(t) do - t[k] = nil - end - del(t) - end - - if not self.tree then return end - --Build the list of visible entries from the tree and status tables - local status = self.status or self.localstatus - local groupstatus = status.groups - local tree = self.tree - - local treeframe = self.treeframe - - status.scrollToSelection = status.scrollToSelection or scrollToSelection -- needs to be cached in case the control hasn't been drawn yet (code bails out below) - - self:BuildLevel(tree, 1) - - local numlines = #lines - - local maxlines = (floor(((self.treeframe:GetHeight()or 0) - 20 ) / 18)) - if maxlines <= 0 then return end - - -- WORKAROUND for lag spikes on WoW 8.0 - if WoW80 and self.frame:GetParent() == UIParent and not fromOnUpdate then - self.frame:SetScript("OnUpdate", FirstFrameUpdate) - return - end - - local first, last - - scrollToSelection = status.scrollToSelection - status.scrollToSelection = nil - - if numlines <= maxlines then - --the whole tree fits in the frame - status.scrollvalue = 0 - self:ShowScroll(false) - first, last = 1, numlines - else - self:ShowScroll(true) - --scrolling will be needed - self.noupdate = true - self.scrollbar:SetMinMaxValues(0, numlines - maxlines) - --check if we are scrolled down too far - if numlines - status.scrollvalue < maxlines then - status.scrollvalue = numlines - maxlines - end - self.noupdate = nil - first, last = status.scrollvalue+1, status.scrollvalue + maxlines - --show selection? - if scrollToSelection and status.selected then - local show - for i,line in ipairs(lines) do -- find the line number - if line.uniquevalue==status.selected then - show=i - end - end - if not show then - -- selection was deleted or something? - elseif show >= first and show <= last then - -- all good - else - -- scrolling needed! - if show < first then - status.scrollvalue = show - 1 - else - status.scrollvalue = show-maxlines - end - first, last = status.scrollvalue + 1, status.scrollvalue + maxlines - end - end - if self.scrollbar:GetValue() ~= status.scrollvalue then - self.scrollbar:SetValue(status.scrollvalue) - end - end - - local buttonnum = 1 - for i = first, last do - local line = lines[i] - local button = buttons[buttonnum] - if not button then - button = self:CreateButton() - - buttons[buttonnum] = button - button:SetParent(treeframe) - button:SetFrameLevel(treeframe:GetFrameLevel() + 1) - button:ClearAllPoints() - if buttonnum == 1 then - if self.showscroll then - button:SetPoint("TOPRIGHT", -22, -10) - button:SetPoint("TOPLEFT", 0, -10) - else - button:SetPoint("TOPRIGHT", 0, -10) - button:SetPoint("TOPLEFT", 0, -10) - end - else - button:SetPoint("TOPRIGHT", buttons[buttonnum - 1], "BOTTOMRIGHT", 0, 0) - button:SetPoint("TOPLEFT", buttons[buttonnum - 1], "BOTTOMLEFT", 0, 0) - end - end - - UpdateButton(button, line, status.selected == line.uniquevalue, line.hasChildren, groupstatus[line.uniquevalue]) - button:Show() - buttonnum = buttonnum + 1 - end - - end, - - ["SetSelected"] = function(self, value, fileId) - local status = self.status or self.localstatus - if status.selected ~= value then - status.selected = value - self:Fire("OnGroupSelected", value, fileId) - end - end, - - ["Select"] = function(self, uniquevalue, ...) - self.filter = false - local status = self.status or self.localstatus - local groups = status.groups - local path = {...} - for i = 1, #path do - groups[tconcat(path, "\001", 1, i)] = true - end - status.selected = uniquevalue - self:RefreshTree(true) - - self:Fire("OnGroupSelected", uniquevalue) - end, - - ["SelectByPath"] = function(self, ...) - self:Select(BuildUniqueValue(...), ...) - end, - - ["SelectByValue"] = function(self, uniquevalue) - self:Select(uniquevalue, ("\001"):split(uniquevalue)) - end, - - ["ShowScroll"] = function(self, show) - self.showscroll = show - if show then - self.scrollbar:Show() - if self.buttons[1] then - self.buttons[1]:SetPoint("TOPRIGHT", self.treeframe, "TOPRIGHT", -22, -10) - end - else - self.scrollbar:Hide() - if self.buttons[1] then - self.buttons[1]:SetPoint("TOPRIGHT", self.treeframe, "TOPRIGHT", 0, -10) - end - end - end, - - ["OnWidthSet"] = function(self, width) - local content = self.content - local treeframe = self.treeframe - local status = self.status or self.localstatus - status.fullwidth = width - - local contentwidth = width - status.treewidth - 20 - if contentwidth < 0 then - contentwidth = 0 - end - content:SetWidth(contentwidth) - content.width = contentwidth - - local maxtreewidth = math_min(400, width - 50) - - if maxtreewidth > 100 and status.treewidth > maxtreewidth then - self:SetTreeWidth(maxtreewidth, status.treesizable) - end - treeframe:SetMaxResize(maxtreewidth, 1600) - end, - - ["OnHeightSet"] = function(self, height) - local content = self.content - local contentheight = height - 20 - if contentheight < 0 then - contentheight = 0 - end - content:SetHeight(contentheight) - content.height = contentheight - end, - - ["SetTreeWidth"] = function(self, treewidth, resizable) - if not resizable then - if type(treewidth) == 'number' then - resizable = false - elseif type(treewidth) == 'boolean' then - resizable = treewidth - treewidth = DEFAULT_TREE_WIDTH - else - resizable = false - treewidth = DEFAULT_TREE_WIDTH - end - end - self.treeframe:SetWidth(treewidth) - self.dragger:EnableMouse(resizable) - - local status = self.status or self.localstatus - status.treewidth = treewidth - status.treesizable = resizable - - -- recalculate the content width - if status.fullwidth then - self:OnWidthSet(status.fullwidth) - end - end, - - ["GetTreeWidth"] = function(self) - local status = self.status or self.localstatus - return status.treewidth or DEFAULT_TREE_WIDTH - end, - - ["LayoutFinished"] = function(self, width, height) - if self.noAutoHeight then return end - self:SetHeight((height or 0) + 20) - end + ["OnAcquire"] = function(self) + self:SetTreeWidth(DEFAULT_TREE_WIDTH, DEFAULT_TREE_SIZABLE) + self:EnableButtonTooltips(true) + self.frame:SetScript("OnUpdate", FirstFrameUpdate) + end, + + ["OnRelease"] = function(self) + self.status = nil + self.tree = nil + self.frame:SetScript("OnUpdate", nil) + for k, v in pairs(self.localstatus) do + if k == "groups" then + for k2 in pairs(v) do + v[k2] = nil + end + else + self.localstatus[k] = nil + end + end + self.localstatus.scrollvalue = 0 + self.localstatus.treewidth = DEFAULT_TREE_WIDTH + self.localstatus.treesizable = DEFAULT_TREE_SIZABLE + end, + + ["EnableButtonTooltips"] = function(self, enable) + self.enabletooltips = enable + end, + + ["CreateButton"] = function(self) + local num = AceGUI:GetNextWidgetNum("TreeGroupButton") + local button = CreateFrame("Button", ("AceGUI30TreeButton%d"):format(num), self.treeframe, "OptionsListButtonTemplate") + button.obj = self + + local icon = button:CreateTexture(nil, "OVERLAY") + icon:SetWidth(14) + icon:SetHeight(14) + button.icon = icon + + button:SetScript("OnClick", Button_OnClick) + button:SetScript("OnDoubleClick", Button_OnDoubleClick) + button:SetScript("OnEnter", Button_OnEnter) + button:SetScript("OnLeave", Button_OnLeave) + + button.toggle.button = button + button.toggle:SetScript("OnClick", Expand_OnClick) + + button.text:SetHeight(14) -- Prevents text wrapping + + return button + end, + + ["SetStatusTable"] = function(self, status) + assert(type(status) == "table") + self.status = status + if not status.groups then + status.groups = {} + end + if not status.scrollvalue then + status.scrollvalue = 0 + end + if not status.treewidth then + status.treewidth = DEFAULT_TREE_WIDTH + end + if status.treesizable == nil then + status.treesizable = DEFAULT_TREE_SIZABLE + end + self:SetTreeWidth(status.treewidth, status.treesizable) + self:RefreshTree() + end, + + --sets the tree to be displayed + ["SetTree"] = function(self, tree, filter) + self.filter = filter + if tree then + assert(type(tree) == "table") + end + self.tree = tree + self:RefreshTree() + end, + + ["BuildLevel"] = function(self, tree, level, parent) + local groups = (self.status or self.localstatus).groups + + for i, v in ipairs(tree) do + if v.children then + if not self.filter or ShouldDisplayLevel(v.children) then + local line = addLine(self, v, tree, level, parent) + if groups[line.uniquevalue] then + self:BuildLevel(v.children, level + 1, line) + end + end + elseif v.visible ~= false or not self.filter then + addLine(self, v, tree, level, parent) + end + end + end, + + ["RefreshTree"] = function(self, scrollToSelection, fromOnUpdate) + local buttons = self.buttons + local lines = self.lines + + for i, v in ipairs(buttons) do + v:Hide() + end + while lines[1] do + local t = tremove(lines) + for k in pairs(t) do + t[k] = nil + end + del(t) + end + + if not self.tree then + return + end + --Build the list of visible entries from the tree and status tables + local status = self.status or self.localstatus + local groupstatus = status.groups + local tree = self.tree + + local treeframe = self.treeframe + + status.scrollToSelection = status.scrollToSelection or scrollToSelection -- needs to be cached in case the control hasn't been drawn yet (code bails out below) + + self:BuildLevel(tree, 1) + + local numlines = #lines + + local maxlines = (floor(((self.treeframe:GetHeight() or 0) - 20) / 18)) + if maxlines <= 0 then + return + end + + -- WORKAROUND for lag spikes on WoW 8.0 + if WoW80 and self.frame:GetParent() == UIParent and not fromOnUpdate then + self.frame:SetScript("OnUpdate", FirstFrameUpdate) + return + end + + local first, last + + scrollToSelection = status.scrollToSelection + status.scrollToSelection = nil + + if numlines <= maxlines then + --the whole tree fits in the frame + status.scrollvalue = 0 + self:ShowScroll(false) + first, last = 1, numlines + else + self:ShowScroll(true) + --scrolling will be needed + self.noupdate = true + self.scrollbar:SetMinMaxValues(0, numlines - maxlines) + --check if we are scrolled down too far + if numlines - status.scrollvalue < maxlines then + status.scrollvalue = numlines - maxlines + end + self.noupdate = nil + first, last = status.scrollvalue + 1, status.scrollvalue + maxlines + --show selection? + if scrollToSelection and status.selected then + local show + for i, line in ipairs(lines) do -- find the line number + if line.uniquevalue == status.selected then + show = i + end + end + if not show then + -- selection was deleted or something? + elseif show >= first and show <= last then + -- all good + else + -- scrolling needed! + if show < first then + status.scrollvalue = show - 1 + else + status.scrollvalue = show - maxlines + end + first, last = status.scrollvalue + 1, status.scrollvalue + maxlines + end + end + if self.scrollbar:GetValue() ~= status.scrollvalue then + self.scrollbar:SetValue(status.scrollvalue) + end + end + + local buttonnum = 1 + for i = first, last do + local line = lines[i] + local button = buttons[buttonnum] + if not button then + button = self:CreateButton() + + buttons[buttonnum] = button + button:SetParent(treeframe) + button:SetFrameLevel(treeframe:GetFrameLevel() + 1) + button:ClearAllPoints() + if buttonnum == 1 then + if self.showscroll then + button:SetPoint("TOPRIGHT", -22, -10) + button:SetPoint("TOPLEFT", 0, -10) + else + button:SetPoint("TOPRIGHT", 0, -10) + button:SetPoint("TOPLEFT", 0, -10) + end + else + button:SetPoint("TOPRIGHT", buttons[buttonnum - 1], "BOTTOMRIGHT", 0, 0) + button:SetPoint("TOPLEFT", buttons[buttonnum - 1], "BOTTOMLEFT", 0, 0) + end + end + + UpdateButton(button, line, status.selected == line.uniquevalue, line.hasChildren, groupstatus[line.uniquevalue]) + button:Show() + buttonnum = buttonnum + 1 + end + end, + + ["SetSelected"] = function(self, value, fileId) + local status = self.status or self.localstatus + if status.selected ~= value then + status.selected = value + self:Fire("OnGroupSelected", value, fileId) + end + end, + + ["Select"] = function(self, uniquevalue, ...) + self.filter = false + local status = self.status or self.localstatus + local groups = status.groups + local path = { ... } + for i = 1, #path do + groups[tconcat(path, "\001", 1, i)] = true + end + status.selected = uniquevalue + self:RefreshTree(true) + + self:Fire("OnGroupSelected", uniquevalue) + end, + + ["SelectByPath"] = function(self, ...) + self:Select(BuildUniqueValue(...), ...) + end, + + ["SelectByValue"] = function(self, uniquevalue) + self:Select(uniquevalue, ("\001"):split(uniquevalue)) + end, + + ["ShowScroll"] = function(self, show) + self.showscroll = show + if show then + self.scrollbar:Show() + if self.buttons[1] then + self.buttons[1]:SetPoint("TOPRIGHT", self.treeframe, "TOPRIGHT", -22, -10) + end + else + self.scrollbar:Hide() + if self.buttons[1] then + self.buttons[1]:SetPoint("TOPRIGHT", self.treeframe, "TOPRIGHT", 0, -10) + end + end + end, + + ["OnWidthSet"] = function(self, width) + local content = self.content + local treeframe = self.treeframe + local status = self.status or self.localstatus + status.fullwidth = width + + local contentwidth = width - status.treewidth - 20 + if contentwidth < 0 then + contentwidth = 0 + end + content:SetWidth(contentwidth) + content.width = contentwidth + + local maxtreewidth = math_min(400, width - 50) + + if maxtreewidth > 100 and status.treewidth > maxtreewidth then + self:SetTreeWidth(maxtreewidth, status.treesizable) + end + treeframe:SetMaxResize(maxtreewidth, 1600) + end, + + ["OnHeightSet"] = function(self, height) + local content = self.content + local contentheight = height - 20 + if contentheight < 0 then + contentheight = 0 + end + content:SetHeight(contentheight) + content.height = contentheight + end, + + ["SetTreeWidth"] = function(self, treewidth, resizable) + if not resizable then + if type(treewidth) == "number" then + resizable = false + elseif type(treewidth) == "boolean" then + resizable = treewidth + treewidth = DEFAULT_TREE_WIDTH + else + resizable = false + treewidth = DEFAULT_TREE_WIDTH + end + end + self.treeframe:SetWidth(treewidth) + self.dragger:EnableMouse(resizable) + + local status = self.status or self.localstatus + status.treewidth = treewidth + status.treesizable = resizable + + -- recalculate the content width + if status.fullwidth then + self:OnWidthSet(status.fullwidth) + end + end, + + ["GetTreeWidth"] = function(self) + local status = self.status or self.localstatus + return status.treewidth or DEFAULT_TREE_WIDTH + end, + + ["LayoutFinished"] = function(self, width, height) + if self.noAutoHeight then + return + end + self:SetHeight((height or 0) + 20) + end, } --[[----------------------------------------------------------------------------- Constructor -------------------------------------------------------------------------------]] -local PaneBackdrop = { - bgFile = "Interface\\ChatFrame\\ChatFrameBackground", - edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", - tile = true, tileSize = 16, edgeSize = 16, - insets = { left = 3, right = 3, top = 5, bottom = 3 } +local PaneBackdrop = { + bgFile = "Interface\\ChatFrame\\ChatFrameBackground", + edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", + tile = true, + tileSize = 16, + edgeSize = 16, + insets = { left = 3, right = 3, top = 5, bottom = 3 }, } -local DraggerBackdrop = { - bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", - edgeFile = nil, - tile = true, tileSize = 16, - insets = { left = 3, right = 3, top = 7, bottom = 7 } +local DraggerBackdrop = { + bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", + edgeFile = nil, + tile = true, + tileSize = 16, + insets = { left = 3, right = 3, top = 7, bottom = 7 }, } local function Constructor() - local num = AceGUI:GetNextWidgetNum(Type) - local frame = CreateFrame("Frame", nil, UIParent) - - local treeframe = CreateFrame("Frame", nil, frame) - treeframe:SetPoint("TOPLEFT") - treeframe:SetPoint("BOTTOMLEFT") - treeframe:SetWidth(DEFAULT_TREE_WIDTH) - treeframe:EnableMouseWheel(true) - - treeframe:SetResizable(true) - treeframe:SetMinResize(100, 1) - treeframe:SetMaxResize(400, 1600) - treeframe:SetScript("OnUpdate", FirstFrameUpdate) - treeframe:SetScript("OnSizeChanged", Tree_OnSizeChanged) - treeframe:SetScript("OnMouseWheel", Tree_OnMouseWheel) - - local treeframeBG = CreateFrame("Frame", nil, treeframe, "BackdropTemplate") - treeframeBG:SetBackdrop(PaneBackdrop) - treeframeBG:SetBackdropColor(0.1, 0.1, 0.1, 0.5) - treeframeBG:SetBackdropBorderColor(0.4, 0.4, 0.4) - treeframeBG:SetAllPoints(treeframe) - - local dragger = CreateFrame("Frame", nil, treeframe, "BackdropTemplate") - dragger:SetWidth(8) - dragger:SetPoint("TOP", treeframe, "TOPRIGHT") - dragger:SetPoint("BOTTOM", treeframe, "BOTTOMRIGHT") - dragger:SetBackdrop(DraggerBackdrop) - dragger:SetBackdropColor(1, 1, 1, 0) - dragger:SetScript("OnEnter", Dragger_OnEnter) - dragger:SetScript("OnLeave", Dragger_OnLeave) - dragger:SetScript("OnMouseDown", Dragger_OnMouseDown) - dragger:SetScript("OnMouseUp", Dragger_OnMouseUp) - - local scrollbar = CreateFrame("Slider", ("AceConfigDialogTreeGroup%dScrollBar"):format(num), treeframe, "UIPanelScrollBarTemplate") - scrollbar:SetScript("OnValueChanged", nil) - scrollbar:SetPoint("TOPRIGHT", -10, -26) - scrollbar:SetPoint("BOTTOMRIGHT", -10, 26) - scrollbar:SetMinMaxValues(0, 0) - scrollbar:SetValueStep(1) - scrollbar:SetValue(0) - scrollbar:SetWidth(16) - scrollbar:SetScript("OnValueChanged", OnScrollValueChanged) - - local scrollbg = scrollbar:CreateTexture(nil, "BACKGROUND") - scrollbg:SetAllPoints(scrollbar) - scrollbg:SetColorTexture(0, 0, 0, 0.4) - - local border = CreateFrame("Frame", nil, frame, "BackdropTemplate") - border:SetPoint("TOPLEFT", treeframe, "TOPRIGHT") - border:SetPoint("BOTTOMRIGHT") - border:SetBackdrop(PaneBackdrop) - border:SetBackdropColor(0.1, 0.1, 0.1, 0.5) - border:SetBackdropBorderColor(0.4, 0.4, 0.4) - - --Container Support - local content = CreateFrame("Frame", nil, border) - content:SetPoint("TOPLEFT", 10, -10) - content:SetPoint("BOTTOMRIGHT", -10, 10) - - local widget = { - frame = frame, - lines = {}, - levels = {}, - buttons = {}, - hasChildren = {}, - localstatus = { groups = {}, scrollvalue = 0 }, - filter = false, - treeframe = treeframe, - dragger = dragger, - scrollbar = scrollbar, - border = border, - content = content, - type = Type - } - for method, func in pairs(methods) do - widget[method] = func - end - treeframe.obj, dragger.obj, scrollbar.obj = widget, widget, widget - - return AceGUI:RegisterAsContainer(widget) + local num = AceGUI:GetNextWidgetNum(Type) + local frame = CreateFrame("Frame", nil, UIParent) + + local treeframe = CreateFrame("Frame", nil, frame) + treeframe:SetPoint("TOPLEFT") + treeframe:SetPoint("BOTTOMLEFT") + treeframe:SetWidth(DEFAULT_TREE_WIDTH) + treeframe:EnableMouseWheel(true) + + treeframe:SetResizable(true) + treeframe:SetMinResize(100, 1) + treeframe:SetMaxResize(400, 1600) + treeframe:SetScript("OnUpdate", FirstFrameUpdate) + treeframe:SetScript("OnSizeChanged", Tree_OnSizeChanged) + treeframe:SetScript("OnMouseWheel", Tree_OnMouseWheel) + + local treeframeBG = CreateFrame("Frame", nil, treeframe, "BackdropTemplate") + treeframeBG:SetBackdrop(PaneBackdrop) + treeframeBG:SetBackdropColor(0.1, 0.1, 0.1, 0.5) + treeframeBG:SetBackdropBorderColor(0.4, 0.4, 0.4) + treeframeBG:SetAllPoints(treeframe) + + local dragger = CreateFrame("Frame", nil, treeframe, "BackdropTemplate") + dragger:SetWidth(8) + dragger:SetPoint("TOP", treeframe, "TOPRIGHT") + dragger:SetPoint("BOTTOM", treeframe, "BOTTOMRIGHT") + dragger:SetBackdrop(DraggerBackdrop) + dragger:SetBackdropColor(1, 1, 1, 0) + dragger:SetScript("OnEnter", Dragger_OnEnter) + dragger:SetScript("OnLeave", Dragger_OnLeave) + dragger:SetScript("OnMouseDown", Dragger_OnMouseDown) + dragger:SetScript("OnMouseUp", Dragger_OnMouseUp) + + local scrollbar = CreateFrame("Slider", ("AceConfigDialogTreeGroup%dScrollBar"):format(num), treeframe, "UIPanelScrollBarTemplate") + scrollbar:SetScript("OnValueChanged", nil) + scrollbar:SetPoint("TOPRIGHT", -10, -26) + scrollbar:SetPoint("BOTTOMRIGHT", -10, 26) + scrollbar:SetMinMaxValues(0, 0) + scrollbar:SetValueStep(1) + scrollbar:SetValue(0) + scrollbar:SetWidth(16) + scrollbar:SetScript("OnValueChanged", OnScrollValueChanged) + + local scrollbg = scrollbar:CreateTexture(nil, "BACKGROUND") + scrollbg:SetAllPoints(scrollbar) + scrollbg:SetColorTexture(0, 0, 0, 0.4) + + local border = CreateFrame("Frame", nil, frame, "BackdropTemplate") + border:SetPoint("TOPLEFT", treeframe, "TOPRIGHT") + border:SetPoint("BOTTOMRIGHT") + border:SetBackdrop(PaneBackdrop) + border:SetBackdropColor(0.1, 0.1, 0.1, 0.5) + border:SetBackdropBorderColor(0.4, 0.4, 0.4) + + --Container Support + local content = CreateFrame("Frame", nil, border) + content:SetPoint("TOPLEFT", 10, -10) + content:SetPoint("BOTTOMRIGHT", -10, 10) + + local widget = { + frame = frame, + lines = {}, + levels = {}, + buttons = {}, + hasChildren = {}, + localstatus = { groups = {}, scrollvalue = 0 }, + filter = false, + treeframe = treeframe, + dragger = dragger, + scrollbar = scrollbar, + border = border, + content = content, + type = Type, + } + for method, func in pairs(methods) do + widget[method] = func + end + treeframe.obj, dragger.obj, scrollbar.obj = widget, widget, widget + + return AceGUI:RegisterAsContainer(widget) end AceGUI:RegisterWidgetType(Type, Constructor, Version) diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasAnchorButtons.lua b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasAnchorButtons.lua index 3734932619..de9efe4132 100644 --- a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasAnchorButtons.lua +++ b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasAnchorButtons.lua @@ -1,8 +1,12 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local Type, Version = "WeakAurasAnchorButtons", 2 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) -if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end +if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then + return +end local directions = { "TOPLEFT", "TOP", "TOPRIGHT", "LEFT", "CENTER", "RIGHT", "BOTTOMLEFT", "BOTTOM", "BOTTOMRIGHT" } local buttonSize = 10 @@ -18,7 +22,9 @@ local methods = { end, ["SetValue"] = function(self, text) - if not tContains(directions, text) then return end + if not tContains(directions, text) then + return + end for direction, button in pairs(self.buttons) do if direction == text then button.tex:SetVertexColor(0.9, 0.9, 0, 1) @@ -36,7 +42,7 @@ local methods = { ["SetLabel"] = function(self, text) if text and text ~= "" then - self.label:SetText(text); + self.label:SetText(text) self.label:Show() else self.label:SetText("") @@ -49,12 +55,12 @@ local methods = { ["SetDisabled"] = function(self, disabled) self.disabled = disabled if disabled then - self.label:SetTextColor(0.5,0.5,0.5) + self.label:SetTextColor(0.5, 0.5, 0.5) for _, button in pairs(self.buttons) do button:EnableMouse(false) end else - self.label:SetTextColor(1,.82,0) + self.label:SetTextColor(1, 0.82, 0) for _, button in pairs(self.buttons) do button:EnableMouse(true) end @@ -76,35 +82,31 @@ local function Constructor() frame:SetSize(frameWidth, frameHeight) frame:SetFrameStrata("FULLSCREEN_DIALOG") - local label = frame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall"); - label:SetHeight(titleHeight); - label:SetJustifyH("CENTER"); - label:SetPoint("TOP", frame, "TOP"); + local label = frame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall") + label:SetHeight(titleHeight) + label:SetJustifyH("CENTER") + label:SetPoint("TOP", frame, "TOP") local background = CreateFrame("Frame", nil, frame, "BackdropTemplate") background:SetSize(frameWidth, frameHeight) background:SetPoint("TOP", frame, "TOP", 0, -(titleHeight + 4)) background:SetBackdrop({ - bgFile = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\Square_FullWhite.tga", - edgeFile = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\Square_FullWhite.tga", - tile = true, - tileEdge = true, - --tileSize = 8, - edgeSize = 2 - --insets = { left = 1, right = 1, top = 1, bottom = 1 }, + bgFile = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\Square_FullWhite.tga", + edgeFile = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\Square_FullWhite.tga", + tile = true, + tileEdge = true, + --tileSize = 8, + edgeSize = 2, + --insets = { left = 1, right = 1, top = 1, bottom = 1 }, }) - background:SetBackdropColor(0.2,0.2,0.2,0.5) - background:SetBackdropBorderColor(1,1,1,0.6) + background:SetBackdropColor(0.2, 0.2, 0.2, 0.5) + background:SetBackdropBorderColor(1, 1, 1, 0.6) local buttons = {} for _, direction in ipairs(directions) do local button = CreateFrame("Button", nil, frame) button:SetSize(buttonSize, buttonSize) - button:SetPoint( - "CENTER", - background, - direction - ) + button:SetPoint("CENTER", background, direction) local buttonTex = button:CreateTexture() buttonTex:SetAllPoints() @@ -122,13 +124,13 @@ local function Constructor() frame = frame, type = Type, buttons = buttons, - label = label + label = label, } for method, func in pairs(methods) do widget[method] = func end - return AceGUI:RegisterAsWidget(widget); + return AceGUI:RegisterAsWidget(widget) end AceGUI:RegisterWidgetType(Type, Constructor, Version) diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasDisplayButton.lua b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasDisplayButton.lua index 1269a21c0f..6ac05e8830 100644 --- a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasDisplayButton.lua +++ b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasDisplayButton.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... local tinsert, tremove = table.insert, table.remove @@ -7,14 +9,16 @@ local error = error local Type, Version = "WeakAurasDisplayButton", 59 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) -if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end +if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then + return +end -local L = WeakAuras.L; -local fullName; -local clipboard = {}; +local L = WeakAuras.L +local fullName +local clipboard = {} local function IsRegionAGroup(data) - return data and (data.regionType == "group" or data.regionType == "dynamicgroup"); + return data and (data.regionType == "group" or data.regionType == "dynamicgroup") end local ignoreForCopyingDisplay = { @@ -33,246 +37,245 @@ local ignoreForCopyingDisplay = { semver = true, version = true, internalVersion = true, - tocversion = true + tocversion = true, } local function copyAuraPart(source, destination, part) - local all = (part == "all"); - if (part == "display" or all) then + local all = (part == "all") + if part == "display" or all then for k, v in pairs(source) do - if (not ignoreForCopyingDisplay[k]) then - if (type(v) == "table") then - destination[k] = CopyTable(v); + if not ignoreForCopyingDisplay[k] then + if type(v) == "table" then + destination[k] = CopyTable(v) else - destination[k] = v; + destination[k] = v end end end end if (part == "trigger" or all) and not IsRegionAGroup(source) then - destination.triggers = CopyTable(source.triggers); + destination.triggers = CopyTable(source.triggers) end if (part == "condition" or all) and not IsRegionAGroup(source) then - destination.conditions = CopyTable(source.conditions); + destination.conditions = CopyTable(source.conditions) end if (part == "load" or all) and not IsRegionAGroup(source) then - destination.load = CopyTable(source.load); + destination.load = CopyTable(source.load) end if (part == "action" or all) and not IsRegionAGroup(source) then - destination.actions = CopyTable(source.actions); + destination.actions = CopyTable(source.actions) end if (part == "animation" or all) and not IsRegionAGroup(source) then - destination.animation = CopyTable(source.animation); + destination.animation = CopyTable(source.animation) end if (part == "authorOptions" or all) and not IsRegionAGroup(source) then - destination.authorOptions = CopyTable(source.authorOptions); + destination.authorOptions = CopyTable(source.authorOptions) end if (part == "config" or all) and not IsRegionAGroup(source) then - destination.config = CopyTable(source.config); + destination.config = CopyTable(source.config) end - end local function CopyToClipboard(part, description) - clipboard.part = part; - clipboard.pasteText = description; - clipboard.source = CopyTable(clipboard.current); + clipboard.part = part + clipboard.pasteText = description + clipboard.source = CopyTable(clipboard.current) end clipboard.pasteMenuEntry = { text = nil, -- Hidden by default notCheckable = true, func = function() - if (not IsRegionAGroup(clipboard.source) and IsRegionAGroup(clipboard.current)) then + if not IsRegionAGroup(clipboard.source) and IsRegionAGroup(clipboard.current) then -- Copy from a single aura to a group => paste it to each individual aura for child in OptionsPrivate.Private.TraverseLeafs(clipboard.current) do - copyAuraPart(clipboard.source, child, clipboard.part); + copyAuraPart(clipboard.source, child, clipboard.part) WeakAuras.Add(child) WeakAuras.ClearAndUpdateOptions(child.id) end else - copyAuraPart(clipboard.source, clipboard.current, clipboard.part); + copyAuraPart(clipboard.source, clipboard.current, clipboard.part) WeakAuras.Add(clipboard.current) WeakAuras.ClearAndUpdateOptions(clipboard.current.id) end WeakAuras.FillOptions() - OptionsPrivate.Private.ScanForLoads({[clipboard.current.id] = true}); - OptionsPrivate.SortDisplayButtons(nil, true); - WeakAuras.PickDisplay(clipboard.current.id); - WeakAuras.UpdateThumbnail(clipboard.current.id); - WeakAuras.ClearAndUpdateOptions(clipboard.current.id); - end + OptionsPrivate.Private.ScanForLoads({ [clipboard.current.id] = true }) + OptionsPrivate.SortDisplayButtons(nil, true) + WeakAuras.PickDisplay(clipboard.current.id) + WeakAuras.UpdateThumbnail(clipboard.current.id) + WeakAuras.ClearAndUpdateOptions(clipboard.current.id) + end, } clipboard.copyEverythingEntry = { text = L["Everything"], notCheckable = true, func = function() - WeakAuras_DropDownMenu:Hide(); + WeakAuras_DropDownMenu:Hide() CopyToClipboard("all", L["Paste Settings"]) - end -}; + end, +} clipboard.copyGroupEntry = { text = L["Group"], notCheckable = true, func = function() - WeakAuras_DropDownMenu:Hide(); + WeakAuras_DropDownMenu:Hide() CopyToClipboard("display", L["Paste Group Settings"]) - end -}; + end, +} clipboard.copyDisplayEntry = { text = L["Display"], notCheckable = true, func = function() - WeakAuras_DropDownMenu:Hide(); + WeakAuras_DropDownMenu:Hide() CopyToClipboard("display", L["Paste Display Settings"]) - end -}; + end, +} clipboard.copyTriggerEntry = { text = L["Trigger"], notCheckable = true, func = function() - WeakAuras_DropDownMenu:Hide(); + WeakAuras_DropDownMenu:Hide() CopyToClipboard("trigger", L["Paste Trigger Settings"]) - end -}; + end, +} clipboard.copyConditionsEntry = { text = L["Conditions"], notCheckable = true, func = function() - WeakAuras_DropDownMenu:Hide(); + WeakAuras_DropDownMenu:Hide() CopyToClipboard("condition", L["Paste Condition Settings"]) - end -}; + end, +} clipboard.copyLoadEntry = { text = L["Load"], notCheckable = true, func = function() - WeakAuras_DropDownMenu:Hide(); + WeakAuras_DropDownMenu:Hide() CopyToClipboard("load", L["Paste Load Settings"]) - end -}; + end, +} clipboard.copyActionsEntry = { text = L["Actions"], notCheckable = true, func = function() - WeakAuras_DropDownMenu:Hide(); + WeakAuras_DropDownMenu:Hide() CopyToClipboard("action", L["Paste Action Settings"]) - end -}; + end, +} clipboard.copyAnimationsEntry = { text = L["Animations"], notCheckable = true, func = function() - WeakAuras_DropDownMenu:Hide(); + WeakAuras_DropDownMenu:Hide() CopyToClipboard("animation", L["Paste Animations Settings"]) - end -}; + end, +} clipboard.copyAuthorOptionsEntry = { text = L["Author Options"], notCheckable = true, func = function() - WeakAuras_DropDownMenu:Hide(); + WeakAuras_DropDownMenu:Hide() CopyToClipboard("authorOptions", L["Paste Author Options Settings"]) - end -}; + end, +} clipboard.copyUserConfigEntry = { text = L["Custom Configuration"], notCheckable = true, func = function() - WeakAuras_DropDownMenu:Hide(); + WeakAuras_DropDownMenu:Hide() CopyToClipboard("config", L["Paste Custom Configuration"]) - end -}; + end, +} local function UpdateClipboardMenuEntry(data) - clipboard.current = data; + clipboard.current = data - if (IsRegionAGroup(clipboard.source) and not IsRegionAGroup(clipboard.current)) then + if IsRegionAGroup(clipboard.source) and not IsRegionAGroup(clipboard.current) then -- Don't copy from a group to a non group - clipboard.pasteMenuEntry.text = nil; + clipboard.pasteMenuEntry.text = nil else - clipboard.pasteMenuEntry.text = clipboard.pasteText; + clipboard.pasteMenuEntry.text = clipboard.pasteText end - if (IsRegionAGroup(clipboard.current)) then - clipboard.copyEverythingEntry.text = nil; - clipboard.copyDisplayEntry.text = nil; - clipboard.copyTriggerEntry.text = nil; - clipboard.copyConditionsEntry.text = nil; - clipboard.copyLoadEntry.text = nil; - clipboard.copyActionsEntry.text = nil; - clipboard.copyAnimationsEntry.text = nil; - clipboard.copyAuthorOptionsEntry = nil; - clipboard.copyUserConfigEntry = nil; - clipboard.copyGroupEntry.text = L["Group"]; + if IsRegionAGroup(clipboard.current) then + clipboard.copyEverythingEntry.text = nil + clipboard.copyDisplayEntry.text = nil + clipboard.copyTriggerEntry.text = nil + clipboard.copyConditionsEntry.text = nil + clipboard.copyLoadEntry.text = nil + clipboard.copyActionsEntry.text = nil + clipboard.copyAnimationsEntry.text = nil + clipboard.copyAuthorOptionsEntry = nil + clipboard.copyUserConfigEntry = nil + clipboard.copyGroupEntry.text = L["Group"] else - clipboard.copyEverythingEntry.text = L["Everything"]; - clipboard.copyDisplayEntry.text = L["Display"]; - clipboard.copyTriggerEntry.text = L["Trigger"]; - clipboard.copyConditionsEntry.text = L["Conditions"]; - clipboard.copyLoadEntry.text = L["Load"]; - clipboard.copyActionsEntry.text = L["Actions"]; - clipboard.copyAnimationsEntry.text = L["Animations"]; - clipboard.copyAuthorOptionsEntry = L["Author Options"]; - clipboard.copyUserConfigEntry = L["Custom Configuration"]; - clipboard.copyGroupEntry.text = nil; + clipboard.copyEverythingEntry.text = L["Everything"] + clipboard.copyDisplayEntry.text = L["Display"] + clipboard.copyTriggerEntry.text = L["Trigger"] + clipboard.copyConditionsEntry.text = L["Conditions"] + clipboard.copyLoadEntry.text = L["Load"] + clipboard.copyActionsEntry.text = L["Actions"] + clipboard.copyAnimationsEntry.text = L["Animations"] + clipboard.copyAuthorOptionsEntry = L["Author Options"] + clipboard.copyUserConfigEntry = L["Custom Configuration"] + clipboard.copyGroupEntry.text = nil end end local function Hide_Tooltip() - GameTooltip:Hide(); + GameTooltip:Hide() end local function Show_Tooltip(owner, line1, line2) - GameTooltip:SetOwner(owner, "ANCHOR_NONE"); - GameTooltip:SetPoint("LEFT", owner, "RIGHT"); - GameTooltip:ClearLines(); - GameTooltip:AddLine(line1); - GameTooltip:AddLine(line2, 1, 1, 1, 1); - GameTooltip:Show(); + GameTooltip:SetOwner(owner, "ANCHOR_NONE") + GameTooltip:SetPoint("LEFT", owner, "RIGHT") + GameTooltip:ClearLines() + GameTooltip:AddLine(line1) + GameTooltip:AddLine(line2, 1, 1, 1, 1) + GameTooltip:Show() end local function Show_Long_Tooltip(owner, description) - GameTooltip:SetOwner(owner, "ANCHOR_NONE"); - GameTooltip:SetPoint("LEFT", owner, "RIGHT"); - GameTooltip:ClearLines(); - local line = 1; - for i,v in pairs(description) do - if(type(v) == "string") then - if(line > 1) then - GameTooltip:AddLine(v, 1, 1, 1, 1); + GameTooltip:SetOwner(owner, "ANCHOR_NONE") + GameTooltip:SetPoint("LEFT", owner, "RIGHT") + GameTooltip:ClearLines() + local line = 1 + for i, v in pairs(description) do + if type(v) == "string" then + if line > 1 then + GameTooltip:AddLine(v, 1, 1, 1, 1) else - GameTooltip:AddLine(v); + GameTooltip:AddLine(v) end - elseif(type(v) == "table") then - if(i == 1) then - GameTooltip:AddDoubleLine(v[1], v[2]..(v[3] and (" |T"..v[3]..":12:12:0:0:64:64:4:60:4:60|t") or "")); + elseif type(v) == "table" then + if i == 1 then + GameTooltip:AddDoubleLine(v[1], v[2] .. (v[3] and (" |T" .. v[3] .. ":12:12:0:0:64:64:4:60:4:60|t") or "")) else - GameTooltip:AddDoubleLine(v[1], v[2]..(v[3] and (" |T"..v[3]..":12:12:0:0:64:64:4:60:4:60|t") or ""), - 1, 1, 1, 1, 1, 1, 1, 1); + GameTooltip:AddDoubleLine(v[1], v[2] .. (v[3] and (" |T" .. v[3] .. ":12:12:0:0:64:64:4:60:4:60|t") or ""), 1, 1, 1, 1, 1, 1, 1, 1) end end - line = line + 1; + line = line + 1 end - GameTooltip:Show(); + GameTooltip:Show() end local function ensure(t, k, v) return t and k and v and t[k] == v end ---[[ Actions ]]-- +--[[ Actions ]] +-- local Actions = { -- move source into group or top-level list / optionally place it before or after target @@ -286,7 +289,7 @@ local Actions = { local index = target:GetGroupOrder() if ensure(children, index, target.data.id) then -- account for insert position - index = before and index or index+1 + index = before and index or index + 1 tinsert(children, index, source.data.id) else error("Calling 'Group' with invalid target. Reload your UI to fix the display list.") @@ -304,7 +307,7 @@ local Actions = { WeakAuras.ClearAndUpdateOptions(group.data.id) WeakAuras.ClearAndUpdateOptions(source.data.id) WeakAuras.FillOptions() - group.callbacks.UpdateExpandButton(); + group.callbacks.UpdateExpandButton() group:ReloadTooltip() else WeakAuras.Add(source.data) @@ -322,7 +325,7 @@ local Actions = { end end, -- remove source from its group or top-level list - ["Ungroup"] = function(source) + ["Ungroup"] = function(source) if source and source.data.parent then local parent = WeakAuras.GetData(source.data.parent) local children = parent.controlledChildren @@ -331,12 +334,12 @@ local Actions = { tremove(children, index) source:SetGroup() source.data.parent = nil - WeakAuras.Add(parent); + WeakAuras.Add(parent) OptionsPrivate.Private.AddParents(parent) - WeakAuras.UpdateGroupOrders(parent); - WeakAuras.ClearAndUpdateOptions(parent.id); + WeakAuras.UpdateGroupOrders(parent) + WeakAuras.ClearAndUpdateOptions(parent.id) local group = WeakAuras.GetDisplayButton(parent.id) - group.callbacks.UpdateExpandButton(); + group.callbacks.UpdateExpandButton() group:ReloadTooltip() else error("Display thinks it is a member of a group which does not control it") @@ -344,7 +347,7 @@ local Actions = { else error("Calling 'Ungroup' with invalid source. Reload your UI to fix the display list.") end - end + end, } local function GetAction(target, area) @@ -420,11 +423,11 @@ end -- * Force enable the profanity filter for the chinese region -- * Add a realm name's part to the profanity filter local function ObfuscateName(name) - if (GetCurrentRegion() == 5) then + if GetCurrentRegion() == 5 then local result = "" for i = 1, #name do local b = name:byte(i) - if (b >= 196 and i ~= 1) then + if b >= 196 and i ~= 1 then -- UTF8 Start byte result = result .. string.char(46, b) else @@ -452,35 +455,35 @@ Methods -------------------------------------------------------------------------------]] local methods = { ["OnAcquire"] = function(self) - self:SetWidth(1000); - self:SetHeight(32); + self:SetWidth(1000) + self:SetHeight(32) self.hasThumbnail = false self.first = false self.last = false end, ["Initialize"] = function(self) - self.callbacks = {}; + self.callbacks = {} function self.callbacks.OnClickNormal(_, mouseButton) - if(IsControlKeyDown() and not self.data.controlledChildren) then - if (OptionsPrivate.IsDisplayPicked(self.data.id)) then - OptionsPrivate.ClearPick(self.data.id); + if IsControlKeyDown() and not self.data.controlledChildren then + if OptionsPrivate.IsDisplayPicked(self.data.id) then + OptionsPrivate.ClearPick(self.data.id) else - OptionsPrivate.PickDisplayMultiple(self.data.id); + OptionsPrivate.PickDisplayMultiple(self.data.id) end - self:ReloadTooltip(); - elseif(IsShiftKeyDown()) then - local editbox = GetCurrentKeyBoardFocus(); - if(editbox) then - if (not fullName) then + self:ReloadTooltip() + elseif IsShiftKeyDown() then + local editbox = GetCurrentKeyBoardFocus() + if editbox then + if not fullName then local name, realm = UnitFullName("player") if realm then - fullName = name.."-".. ObfuscateName(realm) + fullName = name .. "-" .. ObfuscateName(realm) else fullName = name end end - editbox:Insert("[WeakAuras: "..fullName.." - "..self.data.id.."]"); + editbox:Insert("[WeakAuras: " .. fullName .. " - " .. self.data.id .. "]") OptionsPrivate.Private.linked = OptionsPrivate.Private.linked or {} OptionsPrivate.Private.linked[self.data.id] = GetTime() elseif not self.data.controlledChildren then @@ -488,65 +491,66 @@ local methods = { OptionsPrivate.PickDisplayMultipleShift(self.data.id) end else - if(mouseButton == "RightButton") then - Hide_Tooltip(); - if(OptionsPrivate.IsDisplayPicked(self.data.id) and OptionsPrivate.IsPickedMultiple()) then - EasyMenu(OptionsPrivate.MultipleDisplayTooltipMenu(), WeakAuras_DropDownMenu, self.frame, 0, 0, "MENU"); + if mouseButton == "RightButton" then + Hide_Tooltip() + if OptionsPrivate.IsDisplayPicked(self.data.id) and OptionsPrivate.IsPickedMultiple() then + EasyMenu(OptionsPrivate.MultipleDisplayTooltipMenu(), WeakAuras_DropDownMenu, self.frame, 0, 0, "MENU") else - UpdateClipboardMenuEntry(self.data); - EasyMenu(self.menu, WeakAuras_DropDownMenu, self.frame, 0, 0, "MENU"); - if not(OptionsPrivate.IsDisplayPicked(self.data.id)) then + UpdateClipboardMenuEntry(self.data) + EasyMenu(self.menu, WeakAuras_DropDownMenu, self.frame, 0, 0, "MENU") + if not (OptionsPrivate.IsDisplayPicked(self.data.id)) then if self.data.controlledChildren then WeakAuras.PickDisplay(self.data.id, "group") else - WeakAuras.PickDisplay(self.data.id); + WeakAuras.PickDisplay(self.data.id) end end end else - if (OptionsPrivate.IsDisplayPicked(self.data.id)) then - OptionsPrivate.ClearPicks(); + if OptionsPrivate.IsDisplayPicked(self.data.id) then + OptionsPrivate.ClearPicks() else if self.data.controlledChildren then WeakAuras.PickDisplay(self.data.id, "group") else - WeakAuras.PickDisplay(self.data.id); + WeakAuras.PickDisplay(self.data.id) end end - self:ReloadTooltip(); + self:ReloadTooltip() end end end function self.callbacks.UpdateExpandButton() - if(not self.data.controlledChildren or #self.data.controlledChildren == 0) then - self:DisableExpand(); + if not self.data.controlledChildren or #self.data.controlledChildren == 0 then + self:DisableExpand() else - self:EnableExpand(); + self:EnableExpand() end end - function self.callbacks.OnClickGrouping() - if (WeakAuras.IsImporting()) then return end; + if WeakAuras.IsImporting() then + return + end for index, selectedId in ipairs(self.grouping) do - local selectedData = WeakAuras.GetData(selectedId); - tinsert(self.data.controlledChildren, selectedId); - local selectedButton = WeakAuras.GetDisplayButton(selectedId); + local selectedData = WeakAuras.GetData(selectedId) + tinsert(self.data.controlledChildren, selectedId) + local selectedButton = WeakAuras.GetDisplayButton(selectedId) while selectedData.parent do - selectedButton:Ungroup(); + selectedButton:Ungroup() end - selectedButton:SetGroup(self.data.id, self.data.regionType == "dynamicgroup"); - selectedButton:SetGroupOrder(#self.data.controlledChildren, #self.data.controlledChildren); - selectedData.parent = self.data.id; - if (self.data.regionType == "dynamicgroup") then + selectedButton:SetGroup(self.data.id, self.data.regionType == "dynamicgroup") + selectedButton:SetGroupOrder(#self.data.controlledChildren, #self.data.controlledChildren) + selectedData.parent = self.data.id + if self.data.regionType == "dynamicgroup" then selectedData.xOffset = 0 selectedData.yOffset = 0 end - WeakAuras.Add(selectedData); + WeakAuras.Add(selectedData) OptionsPrivate.ClearOptions(selectedId) - if (selectedData.controlledChildren) then + if selectedData.controlledChildren then for child in OptionsPrivate.Private.TraverseAllChildren(selectedData) do local childButton = WeakAuras.GetDisplayButton(child.id) childButton:UpdateOffset() @@ -554,26 +558,26 @@ local methods = { end end - WeakAuras.Add(self.data); + WeakAuras.Add(self.data) OptionsPrivate.Private.AddParents(self.data) - self.callbacks.UpdateExpandButton(); - OptionsPrivate.StopGrouping(); - OptionsPrivate.ClearOptions(self.data.id); - WeakAuras.FillOptions(); - WeakAuras.UpdateGroupOrders(self.data); - OptionsPrivate.SortDisplayButtons(); - self:ReloadTooltip(); + self.callbacks.UpdateExpandButton() + OptionsPrivate.StopGrouping() + OptionsPrivate.ClearOptions(self.data.id) + WeakAuras.FillOptions() + WeakAuras.UpdateGroupOrders(self.data) + OptionsPrivate.SortDisplayButtons() + self:ReloadTooltip() self:Expand() - OptionsPrivate.ResetMoverSizer(); + OptionsPrivate.ResetMoverSizer() end function self.callbacks.OnClickGroupingSelf() - OptionsPrivate.StopGrouping(); - self:ReloadTooltip(); + OptionsPrivate.StopGrouping() + self:ReloadTooltip() end function self.callbacks.OnGroupClick() - OptionsPrivate.StartGrouping(self.data); + OptionsPrivate.StartGrouping(self.data) end local function addParents(hash, data) @@ -588,8 +592,10 @@ local methods = { end function self.callbacks.OnDeleteClick() - if (WeakAuras.IsImporting()) then return end; - local toDelete = {self.data} + if WeakAuras.IsImporting() then + return + end + local toDelete = { self.data } local parents = {} addParents(parents, self.data) OptionsPrivate.ConfirmDelete(toDelete, parents) @@ -618,7 +624,9 @@ local methods = { end function self.callbacks.OnDuplicateClick() - if (WeakAuras.IsImporting()) then return end; + if WeakAuras.IsImporting() then + return + end if self.data.controlledChildren then local newGroup = OptionsPrivate.DuplicateAura(self.data) @@ -650,446 +658,480 @@ local methods = { end function self.callbacks.OnDeleteAllClick() - if (WeakAuras.IsImporting()) then return end; + if WeakAuras.IsImporting() then + return + end local toDelete = {} - if(self.data.controlledChildren) then - local region = WeakAuras.regions[self.data.id]; + if self.data.controlledChildren then + local region = WeakAuras.regions[self.data.id] for child in OptionsPrivate.Private.TraverseAllChildren(self.data) do - tinsert(toDelete, child); + tinsert(toDelete, child) end end tinsert(toDelete, self.data) local parents = {} addParents(parents, self.data) - OptionsPrivate.ConfirmDelete(toDelete, parents); + OptionsPrivate.ConfirmDelete(toDelete, parents) end function self.callbacks.OnUngroupClick() - OptionsPrivate.Ungroup(self.data); + OptionsPrivate.Ungroup(self.data) end function self.callbacks.OnUpGroupClick() - if (WeakAuras.IsImporting()) then return end; - if(self.data.parent) then - local id = self.data.id; - local parentData = WeakAuras.GetData(self.data.parent); - local index; + if WeakAuras.IsImporting() then + return + end + if self.data.parent then + local id = self.data.id + local parentData = WeakAuras.GetData(self.data.parent) + local index for childIndex, childId in pairs(parentData.controlledChildren) do - if(childId == id) then - index = childIndex; - break; + if childId == id then + index = childIndex + break end end - if(index) then - if(index <= 1) then - error("Attempt to move up the first element in a group"); + if index then + if index <= 1 then + error("Attempt to move up the first element in a group") else - tremove(parentData.controlledChildren, index); - tinsert(parentData.controlledChildren, index - 1, id); - WeakAuras.Add(parentData); + tremove(parentData.controlledChildren, index) + tinsert(parentData.controlledChildren, index - 1, id) + WeakAuras.Add(parentData) OptionsPrivate.Private.AddParents(parentData) WeakAuras.ClearAndUpdateOptions(parentData.id) - self:SetGroupOrder(index - 1, #parentData.controlledChildren); - local otherbutton = WeakAuras.GetDisplayButton(parentData.controlledChildren[index]); - otherbutton:SetGroupOrder(index, #parentData.controlledChildren); - OptionsPrivate.SortDisplayButtons(); - local updata = {duration = 0.15, type = "custom", use_translate = true, x = 0, y = -32}; - local downdata = {duration = 0.15, type = "custom", use_translate = true, x = 0, y = 32}; - OptionsPrivate.Private.Animate("button", WeakAuras.GetData(parentData.controlledChildren[index-1]).uid, "main", updata, self.frame, true, function() OptionsPrivate.SortDisplayButtons() end); - OptionsPrivate.Private.Animate("button", WeakAuras.GetData(parentData.controlledChildren[index]).uid, "main", downdata, otherbutton.frame, true, function() OptionsPrivate.SortDisplayButtons() end); + self:SetGroupOrder(index - 1, #parentData.controlledChildren) + local otherbutton = WeakAuras.GetDisplayButton(parentData.controlledChildren[index]) + otherbutton:SetGroupOrder(index, #parentData.controlledChildren) + OptionsPrivate.SortDisplayButtons() + local updata = { duration = 0.15, type = "custom", use_translate = true, x = 0, y = -32 } + local downdata = { duration = 0.15, type = "custom", use_translate = true, x = 0, y = 32 } + OptionsPrivate.Private.Animate("button", WeakAuras.GetData(parentData.controlledChildren[index - 1]).uid, "main", updata, self.frame, true, function() + OptionsPrivate.SortDisplayButtons() + end) + OptionsPrivate.Private.Animate("button", WeakAuras.GetData(parentData.controlledChildren[index]).uid, "main", downdata, otherbutton.frame, true, function() + OptionsPrivate.SortDisplayButtons() + end) WeakAuras.FillOptions() end else - error("Display thinks it is a member of a group which does not control it"); + error("Display thinks it is a member of a group which does not control it") end else - error("This display is not in a group. You should not have been able to click this button"); + error("This display is not in a group. You should not have been able to click this button") end end function self.callbacks.OnDownGroupClick() - if (WeakAuras.IsImporting()) then return end; - if(self.data.parent) then - local id = self.data.id; - local parentData = WeakAuras.GetData(self.data.parent); - local index; + if WeakAuras.IsImporting() then + return + end + if self.data.parent then + local id = self.data.id + local parentData = WeakAuras.GetData(self.data.parent) + local index for childIndex, childId in pairs(parentData.controlledChildren) do - if(childId == id) then - index = childIndex; - break; + if childId == id then + index = childIndex + break end end - if(index) then - if(index >= #parentData.controlledChildren) then - error("Attempt to move down the last element in a group"); + if index then + if index >= #parentData.controlledChildren then + error("Attempt to move down the last element in a group") else - tremove(parentData.controlledChildren, index); - tinsert(parentData.controlledChildren, index + 1, id); - WeakAuras.Add(parentData); + tremove(parentData.controlledChildren, index) + tinsert(parentData.controlledChildren, index + 1, id) + WeakAuras.Add(parentData) OptionsPrivate.Private.AddParents(parentData) WeakAuras.ClearAndUpdateOptions(parentData.id) - self:SetGroupOrder(index + 1, #parentData.controlledChildren); - local otherbutton = WeakAuras.GetDisplayButton(parentData.controlledChildren[index]); - otherbutton:SetGroupOrder(index, #parentData.controlledChildren); + self:SetGroupOrder(index + 1, #parentData.controlledChildren) + local otherbutton = WeakAuras.GetDisplayButton(parentData.controlledChildren[index]) + otherbutton:SetGroupOrder(index, #parentData.controlledChildren) OptionsPrivate.SortDisplayButtons() - local updata = {duration = 0.15, type = "custom", use_translate = true, x = 0, y = -32}; - local downdata = {duration = 0.15, type = "custom", use_translate = true, x = 0, y = 32}; - OptionsPrivate.Private.Animate("button", WeakAuras.GetData(parentData.controlledChildren[index+1]).uid, "main", downdata, self.frame, true, function() OptionsPrivate.SortDisplayButtons() end); - OptionsPrivate.Private.Animate("button", WeakAuras.GetData(parentData.controlledChildren[index]).uid, "main", updata, otherbutton.frame, true, function() OptionsPrivate.SortDisplayButtons() end); + local updata = { duration = 0.15, type = "custom", use_translate = true, x = 0, y = -32 } + local downdata = { duration = 0.15, type = "custom", use_translate = true, x = 0, y = 32 } + OptionsPrivate.Private.Animate("button", WeakAuras.GetData(parentData.controlledChildren[index + 1]).uid, "main", downdata, self.frame, true, function() + OptionsPrivate.SortDisplayButtons() + end) + OptionsPrivate.Private.Animate("button", WeakAuras.GetData(parentData.controlledChildren[index]).uid, "main", updata, otherbutton.frame, true, function() + OptionsPrivate.SortDisplayButtons() + end) WeakAuras.FillOptions() end else - error("Display thinks it is a member of a group which does not control it"); + error("Display thinks it is a member of a group which does not control it") end else - error("This display is not in a group. You should not have been able to click this button"); + error("This display is not in a group. You should not have been able to click this button") end end function self.callbacks.OnViewClick() - OptionsPrivate.Private.PauseAllDynamicGroups(); - if(self.view.visibility == 2) then + OptionsPrivate.Private.PauseAllDynamicGroups() + if self.view.visibility == 2 then for child in OptionsPrivate.Private.TraverseAllChildren(self.data) do - WeakAuras.GetDisplayButton(child.id):PriorityHide(2); + WeakAuras.GetDisplayButton(child.id):PriorityHide(2) end self:PriorityHide(2) else for child in OptionsPrivate.Private.TraverseAllChildren(self.data) do - WeakAuras.GetDisplayButton(child.id):PriorityShow(2); + WeakAuras.GetDisplayButton(child.id):PriorityShow(2) end self:PriorityShow(2) end self:RecheckParentVisibility() - OptionsPrivate.Private.ResumeAllDynamicGroups(); + OptionsPrivate.Private.ResumeAllDynamicGroups() end function self.callbacks.OnRenameClick() - if (WeakAuras.IsImporting()) then return end; - if(self.title:IsVisible()) then - self.title:Hide(); - self.renamebox:SetText(self.title:GetText()); - self.renamebox:Show(); + if WeakAuras.IsImporting() then + return + end + if self.title:IsVisible() then + self.title:Hide() + self.renamebox:SetText(self.title:GetText()) + self.renamebox:Show() else - self.title:Show(); - self.renamebox:Hide(); + self.title:Show() + self.renamebox:Hide() end end function self.callbacks.OnRenameAction(newid) - if (WeakAuras.IsImporting()) then return end; - local oldid = self.data.id; - if not(newid == oldid) then - WeakAuras.Rename(self.data, newid); + if WeakAuras.IsImporting() then + return + end + local oldid = self.data.id + if not (newid == oldid) then + WeakAuras.Rename(self.data, newid) end end function self.callbacks.OnDragStart() - if WeakAuras.IsImporting() then return end; + if WeakAuras.IsImporting() then + return + end if not OptionsPrivate.IsDisplayPicked(self.data.id) then WeakAuras.PickDisplay(self.data.id) end - OptionsPrivate.StartDrag(self.data); + OptionsPrivate.StartDrag(self.data) end function self.callbacks.OnDragStop() - if not self.dragging then return end + if not self.dragging then + return + end local target, area = select(2, GetDropTarget()) local action = GetAction(target, area) OptionsPrivate.Drop(self.data, target, action, area) end function self.callbacks.OnKeyDown(self, key) - if (key == "ESCAPE") then + if key == "ESCAPE" then OptionsPrivate.DragReset() end end self.frame:SetScript("OnEnter", function() - if(OptionsPrivate.IsPickedMultiple() and OptionsPrivate.IsDisplayPicked(self.frame.id)) then - Show_Long_Tooltip(self.frame, OptionsPrivate.MultipleDisplayTooltipDesc()); + if OptionsPrivate.IsPickedMultiple() and OptionsPrivate.IsDisplayPicked(self.frame.id) then + Show_Long_Tooltip(self.frame, OptionsPrivate.MultipleDisplayTooltipDesc()) else if not self.grouping then - self:SetNormalTooltip(); + self:SetNormalTooltip() end - Show_Long_Tooltip(self.frame, self.frame.description); + Show_Long_Tooltip(self.frame, self.frame.description) end - end); - self.frame:SetScript("OnLeave", Hide_Tooltip); - - local copyEntries = {}; - tinsert(copyEntries, clipboard.copyEverythingEntry); - tinsert(copyEntries, clipboard.copyGroupEntry); - tinsert(copyEntries, clipboard.copyDisplayEntry); - tinsert(copyEntries, clipboard.copyTriggerEntry); - tinsert(copyEntries, clipboard.copyConditionsEntry); - tinsert(copyEntries, clipboard.copyLoadEntry); - tinsert(copyEntries, clipboard.copyActionsEntry); - tinsert(copyEntries, clipboard.copyAnimationsEntry); - tinsert(copyEntries, clipboard.copyAuthorOptionsEntry); - tinsert(copyEntries, clipboard.copyUserConfigEntry); - - self:SetTitle(self.data.id); + end) + self.frame:SetScript("OnLeave", Hide_Tooltip) + + local copyEntries = {} + tinsert(copyEntries, clipboard.copyEverythingEntry) + tinsert(copyEntries, clipboard.copyGroupEntry) + tinsert(copyEntries, clipboard.copyDisplayEntry) + tinsert(copyEntries, clipboard.copyTriggerEntry) + tinsert(copyEntries, clipboard.copyConditionsEntry) + tinsert(copyEntries, clipboard.copyLoadEntry) + tinsert(copyEntries, clipboard.copyActionsEntry) + tinsert(copyEntries, clipboard.copyAnimationsEntry) + tinsert(copyEntries, clipboard.copyAuthorOptionsEntry) + tinsert(copyEntries, clipboard.copyUserConfigEntry) + + self:SetTitle(self.data.id) self.menu = { { text = L["Rename"], notCheckable = true, - func = self.callbacks.OnRenameClick + func = self.callbacks.OnRenameClick, }, { text = L["Copy settings..."], notCheckable = true, hasArrow = true, - menuList = copyEntries; + menuList = copyEntries, }, - }; + } - tinsert(self.menu, clipboard.pasteMenuEntry); + tinsert(self.menu, clipboard.pasteMenuEntry) - if (not self.data.controlledChildren) then - local convertMenu = {}; + if not self.data.controlledChildren then + local convertMenu = {} for regionType, regionData in pairs(WeakAuras.regionOptions) do - if(regionType ~= "group" and regionType ~= "dynamicgroup" and regionType ~= self.data.regionType) then + if regionType ~= "group" and regionType ~= "dynamicgroup" and regionType ~= self.data.regionType then tinsert(convertMenu, { text = regionData.displayName, notCheckable = true, func = function() - OptionsPrivate.ConvertDisplay(self.data, regionType); - WeakAuras_DropDownMenu:Hide(); - end - }); + OptionsPrivate.ConvertDisplay(self.data, regionType) + WeakAuras_DropDownMenu:Hide() + end, + }) end end tinsert(self.menu, { text = L["Convert to..."], notCheckable = true, hasArrow = true, - menuList = convertMenu - }); + menuList = convertMenu, + }) end tinsert(self.menu, { text = L["Duplicate"], notCheckable = true, - func = self.callbacks.OnDuplicateClick - }); + func = self.callbacks.OnDuplicateClick, + }) tinsert(self.menu, { text = L["Export..."], notCheckable = true, - func = function() OptionsPrivate.ExportToString(self.data.id) end - }); + func = function() + OptionsPrivate.ExportToString(self.data.id) + end, + }) tinsert(self.menu, { text = L["Export debug table..."], notCheckable = true, - func = function() OptionsPrivate.ExportToTable(self.data.id) end - }); + func = function() + OptionsPrivate.ExportToTable(self.data.id) + end, + }) tinsert(self.menu, { text = " ", notClickable = true, notCheckable = true, - }); + }) if not self.data.controlledChildren then tinsert(self.menu, { text = L["Delete"], notCheckable = true, - func = self.callbacks.OnDeleteClick - }); + func = self.callbacks.OnDeleteClick, + }) end - if (self.data.controlledChildren) then + if self.data.controlledChildren then tinsert(self.menu, { text = L["Delete children and group"], notCheckable = true, - func = self.callbacks.OnDeleteAllClick - }); + func = self.callbacks.OnDeleteAllClick, + }) end tinsert(self.menu, { text = " ", notClickable = true, notCheckable = true, - }); + }) tinsert(self.menu, { text = L["Close"], notCheckable = true, - func = function() WeakAuras_DropDownMenu:Hide() end - }); - if(self.data.controlledChildren) then - self.loaded:Hide(); - self.expand:Show(); - self.callbacks.UpdateExpandButton(); - self:SetOnExpandCollapse(function() OptionsPrivate.SortDisplayButtons(nil, true) end); + func = function() + WeakAuras_DropDownMenu:Hide() + end, + }) + if self.data.controlledChildren then + self.loaded:Hide() + self.expand:Show() + self.callbacks.UpdateExpandButton() + self:SetOnExpandCollapse(function() + OptionsPrivate.SortDisplayButtons(nil, true) + end) else - self:SetViewRegion(WeakAuras.regions[self.data.id].region); - self.loaded:Show(); - self.expand:Hide(); - end - self.group:Show(); - - self:SetNormalTooltip(); - self.frame:SetScript("OnClick", self.callbacks.OnClickNormal); - self.frame:SetScript("OnKeyDown", self.callbacks.OnKeyDown); - self.frame:EnableKeyboard(false); - self.frame:SetMovable(true); - self.frame:RegisterForDrag("LeftButton"); - self.frame:SetScript("OnDragStart", self.callbacks.OnDragStart); - self.frame:SetScript("OnDragStop", self.callbacks.OnDragStop); - - self:Enable(); - self:SetRenameAction(self.callbacks.OnRenameAction); - self.group:SetScript("OnClick", self.callbacks.OnGroupClick); - self.ungroup:SetScript("OnClick", self.callbacks.OnUngroupClick); - self.upgroup:SetScript("OnClick", self.callbacks.OnUpGroupClick); - self.downgroup:SetScript("OnClick", self.callbacks.OnDownGroupClick); - self.view:SetScript("OnClick", self.callbacks.OnViewClick); + self:SetViewRegion(WeakAuras.regions[self.data.id].region) + self.loaded:Show() + self.expand:Hide() + end + self.group:Show() + + self:SetNormalTooltip() + self.frame:SetScript("OnClick", self.callbacks.OnClickNormal) + self.frame:SetScript("OnKeyDown", self.callbacks.OnKeyDown) + self.frame:EnableKeyboard(false) + self.frame:SetMovable(true) + self.frame:RegisterForDrag("LeftButton") + self.frame:SetScript("OnDragStart", self.callbacks.OnDragStart) + self.frame:SetScript("OnDragStop", self.callbacks.OnDragStop) + + self:Enable() + self:SetRenameAction(self.callbacks.OnRenameAction) + self.group:SetScript("OnClick", self.callbacks.OnGroupClick) + self.ungroup:SetScript("OnClick", self.callbacks.OnUngroupClick) + self.upgroup:SetScript("OnClick", self.callbacks.OnUpGroupClick) + self.downgroup:SetScript("OnClick", self.callbacks.OnDownGroupClick) + self.view:SetScript("OnClick", self.callbacks.OnViewClick) if self.data.parent then - local parentData = WeakAuras.GetData(self.data.parent); - local index; + local parentData = WeakAuras.GetData(self.data.parent) + local index for childIndex, childId in pairs(parentData.controlledChildren) do - if(childId == self.data.id) then - index = childIndex; - break; + if childId == self.data.id then + index = childIndex + break end end - if(index) then - self:SetGroup(self.data.parent); - self:SetGroupOrder(index, #parentData.controlledChildren); + if index then + self:SetGroup(self.data.parent) + self:SetGroupOrder(index, #parentData.controlledChildren) else - error("Display \""..self.data.id.."\" thinks it is a member of group \""..self.data.parent.."\" which does not control it"); + error("Display \"" .. self.data.id .. "\" thinks it is a member of group \"" .. self.data.parent .. "\" which does not control it") end end self.frame:Hide() end, ["SetNormalTooltip"] = function(self) - local data = self.data; - local namestable = {}; - if(data.controlledChildren) then - namestable[1] = ""; + local data = self.data + local namestable = {} + if data.controlledChildren then + namestable[1] = "" local function addChildrenNames(data, indent) for index, childId in pairs(data.controlledChildren) do - tinsert(namestable, indent .. childId); + tinsert(namestable, indent .. childId) local childData = WeakAuras.GetData(childId) - if (childData.controlledChildren) then + if childData.controlledChildren then addChildrenNames(childData, indent .. " ") end end end addChildrenNames(data, " ") - if (#namestable > 30) then - local size = #namestable; - namestable[26] = {" ", "[...]"}; - namestable[27] = {L[string.format(L["%s total auras"], #namestable)], " " } + if #namestable > 30 then + local size = #namestable + namestable[26] = { " ", "[...]" } + namestable[27] = { L[string.format(L["%s total auras"], #namestable)], " " } for i = 28, size do - namestable[i] = nil; + namestable[i] = nil end end - if(#namestable > 1) then - namestable[1] = L["Children:"]; + if #namestable > 1 then + namestable[1] = L["Children:"] else - namestable[1] = L["No Children"]; + namestable[1] = L["No Children"] end else OptionsPrivate.Private.GetTriggerDescription(data, -1, namestable) end - if(OptionsPrivate.Private.CanHaveClones(data)) then - tinsert(namestable, {" ", "|cFF00FF00"..L["Auto-cloning enabled"]}) + if OptionsPrivate.Private.CanHaveClones(data) then + tinsert(namestable, { " ", "|cFF00FF00" .. L["Auto-cloning enabled"] }) end - local hasDescription = data.desc and data.desc ~= ""; - local hasUrl = data.url and data.url ~= ""; - local hasVersion = (data.semver and data.semver ~= "") or (data.version and data.version ~= ""); + local hasDescription = data.desc and data.desc ~= "" + local hasUrl = data.url and data.url ~= "" + local hasVersion = (data.semver and data.semver ~= "") or (data.version and data.version ~= "") - if(hasDescription or hasUrl or hasVersion) then - tinsert(namestable, " "); + if hasDescription or hasUrl or hasVersion then + tinsert(namestable, " ") end - if(hasDescription) then - tinsert(namestable, "|cFFFFD100\""..data.desc.."\""); + if hasDescription then + tinsert(namestable, "|cFFFFD100\"" .. data.desc .. "\"") end - if (hasUrl) then - tinsert(namestable, "|cFFFFD100" .. data.url .. "|r"); + if hasUrl then + tinsert(namestable, "|cFFFFD100" .. data.url .. "|r") end - if (hasVersion) then - tinsert(namestable, "|cFFFFD100" .. L["Version: "] .. (data.semver or data.version) .. "|r"); + if hasVersion then + tinsert(namestable, "|cFFFFD100" .. L["Version: "] .. (data.semver or data.version) .. "|r") end - tinsert(namestable, " "); - tinsert(namestable, {" ", "|cFF00FFFF"..L["Right-click for more options"]}); - tinsert(namestable, {" ", "|cFF00FFFF"..L["Drag to move"]}); - if not(data.controlledChildren) then - tinsert(namestable, {" ", "|cFF00FFFF"..L["Control-click to select multiple displays"]}); + tinsert(namestable, " ") + tinsert(namestable, { " ", "|cFF00FFFF" .. L["Right-click for more options"] }) + tinsert(namestable, { " ", "|cFF00FFFF" .. L["Drag to move"] }) + if not data.controlledChildren then + tinsert(namestable, { " ", "|cFF00FFFF" .. L["Control-click to select multiple displays"] }) end - tinsert(namestable, {" ", "|cFF00FFFF"..L["Shift-click to create chat link"]}); + tinsert(namestable, { " ", "|cFF00FFFF" .. L["Shift-click to create chat link"] }) local regionData = WeakAuras.regionOptions[data.regionType or ""] - local displayName = regionData and regionData.displayName or ""; - self:SetDescription({data.id, displayName}, unpack(namestable)); + local displayName = regionData and regionData.displayName or "" + self:SetDescription({ data.id, displayName }, unpack(namestable)) end, ["ReloadTooltip"] = function(self) - if(OptionsPrivate.IsPickedMultiple() and OptionsPrivate.IsDisplayPicked(self.data.id)) then - Show_Long_Tooltip(self.frame, OptionsPrivate.MultipleDisplayTooltipDesc()); + if OptionsPrivate.IsPickedMultiple() and OptionsPrivate.IsDisplayPicked(self.data.id) then + Show_Long_Tooltip(self.frame, OptionsPrivate.MultipleDisplayTooltipDesc()) else - Show_Long_Tooltip(self.frame, self.frame.description); + Show_Long_Tooltip(self.frame, self.frame.description) end end, ["StartGrouping"] = function(self, groupingData, selected, groupingGroup, childOfGrouing) - self.grouping = groupingData; + self.grouping = groupingData self:UpdateIconsVisible() - if(selected) then - self.frame:SetScript("OnClick", self.callbacks.OnClickGroupingSelf); - self:SetDescription(L["Cancel"], L["Do not group this display"]); - elseif (childOfGrouing) then - self:Disable(); + if selected then + self.frame:SetScript("OnClick", self.callbacks.OnClickGroupingSelf) + self:SetDescription(L["Cancel"], L["Do not group this display"]) + elseif childOfGrouing then + self:Disable() else - if(self.data.regionType == "dynamicgroup" and groupingGroup) then - self:Disable(); - elseif (self.data.regionType == "group" or self.data.regionType == "dynamicgroup") then - self.frame:SetScript("OnClick", self.callbacks.OnClickGrouping); - self:SetDescription(self.data.id, L["Add to group %s"]:format(self.data.id)); + if self.data.regionType == "dynamicgroup" and groupingGroup then + self:Disable() + elseif self.data.regionType == "group" or self.data.regionType == "dynamicgroup" then + self.frame:SetScript("OnClick", self.callbacks.OnClickGrouping) + self:SetDescription(self.data.id, L["Add to group %s"]:format(self.data.id)) else - self:Disable(); + self:Disable() end end end, ["StopGrouping"] = function(self) - self.grouping = nil; + self.grouping = nil self:UpdateIconsVisible() - self:SetNormalTooltip(); - self.frame:SetScript("OnClick", self.callbacks.OnClickNormal); - self:Enable(); + self:SetNormalTooltip() + self.frame:SetScript("OnClick", self.callbacks.OnClickNormal) + self:Enable() end, ["Ungroup"] = function(self) - if (WeakAuras.IsImporting()) then return end; - local parentData = WeakAuras.GetData(self.data.parent); - if not parentData then return end; - local index = tIndexOf(parentData.controlledChildren, self.data.id); - if(index) then - tremove(parentData.controlledChildren, index); - WeakAuras.Add(parentData); + if WeakAuras.IsImporting() then + return + end + local parentData = WeakAuras.GetData(self.data.parent) + if not parentData then + return + end + local index = tIndexOf(parentData.controlledChildren, self.data.id) + if index then + tremove(parentData.controlledChildren, index) + WeakAuras.Add(parentData) OptionsPrivate.Private.AddParents(parentData) - WeakAuras.ClearAndUpdateOptions(parentData.id); + WeakAuras.ClearAndUpdateOptions(parentData.id) else - error("Display thinks it is a member of a group which does not control it"); + error("Display thinks it is a member of a group which does not control it") end local newParent = parentData.parent and WeakAuras.GetData(parentData.parent) if newParent then local insertIndex = tIndexOf(newParent.controlledChildren, parentData.id) if not insertIndex then - error("Parent Display thinks it is a member of a group which does not control it"); + error("Parent Display thinks it is a member of a group which does not control it") end insertIndex = insertIndex + 1 tinsert(newParent.controlledChildren, insertIndex, self.data.id) end - self:SetGroup(newParent and newParent.id); - self.data.parent = newParent and newParent.id; - WeakAuras.Add(self.data); + self:SetGroup(newParent and newParent.id) + self.data.parent = newParent and newParent.id + WeakAuras.Add(self.data) self:UpdateIconsVisible() if newParent then WeakAuras.Add(newParent) @@ -1097,9 +1139,9 @@ local methods = { WeakAuras.ClearAndUpdateOptions(newParent.id) WeakAuras.UpdateGroupOrders(newParent) end - WeakAuras.ClearAndUpdateOptions(self.data.id); - WeakAuras.UpdateGroupOrders(parentData); - if(#parentData.controlledChildren == 0) then + WeakAuras.ClearAndUpdateOptions(self.data.id) + WeakAuras.UpdateGroupOrders(parentData) + if #parentData.controlledChildren == 0 then local parentButton = WeakAuras.GetDisplayButton(parentData.id) parentButton:DisableExpand() end @@ -1109,7 +1151,7 @@ local methods = { button:UpdateOffset() end - OptionsPrivate.SortDisplayButtons(); + OptionsPrivate.SortDisplayButtons() end, ["UpdateIconsVisible"] = function(self) if self.dragging or self.grouping then @@ -1152,13 +1194,13 @@ local methods = { self.frame:SetParent(UIParent) self.frame:SetFrameStrata("FULLSCREEN_DIALOG") if self.data.id == mainAura.id then - self.frame:SetPoint("Center", UIParent, "BOTTOMLEFT", (x+w/2)*scale/uiscale, y/uiscale) + self.frame:SetPoint("Center", UIParent, "BOTTOMLEFT", (x + w / 2) * scale / uiscale, y / uiscale) if mode == "MULTI" then -- change label & icon - self.frame:SetPoint("Center", UIParent, "BOTTOMLEFT", (x+w/2)*scale/uiscale, y/uiscale) + self.frame:SetPoint("Center", UIParent, "BOTTOMLEFT", (x + w / 2) * scale / uiscale, y / uiscale) self.frame.temp.title = self.title:GetText() self.title:SetText((L["%i auras selected"]):format(size)) - self:OverrideIcon(); + self:OverrideIcon() end else -- Hide frames @@ -1168,7 +1210,7 @@ local methods = { -- attach OnUpdate event to update drop indicator if self.data.id == mainAura.id then local id = self.data.id - self.frame:SetScript("OnUpdate", function(self,elapsed) + self.frame:SetScript("OnUpdate", function(self, elapsed) self.elapsed = (self.elapsed or 0) + elapsed if self.elapsed > 0.1 then Show_DropIndicator(id) @@ -1191,7 +1233,7 @@ local methods = { self:Disable() else local parentData = self.data.parent and WeakAuras.GetData(self.data.parent) - if (parentData and parentData.regionType == "dynamicgroup") then + if parentData and parentData.regionType == "dynamicgroup" then self:Disable() end end @@ -1224,7 +1266,7 @@ local methods = { Show_DropIndicator() self.frame:SetScript("OnClick", self.callbacks.OnClickNormal) - self.frame:EnableKeyboard(false); -- disables self.callbacks.OnKeyDown + self.frame:EnableKeyboard(false) -- disables self.callbacks.OnKeyDown self.view:Show() if self.data.controlledChildren then self.expand:Show() @@ -1240,7 +1282,7 @@ local methods = { if self.frame.temp.title then -- restore title and icon self.title:SetText(self.frame.temp.title) - self:RestoreIcon(); + self:RestoreIcon() end self.frame:SetParent(self.frame.temp.parent) self.frame:SetFrameStrata(self.frame.temp.strata) @@ -1249,13 +1291,12 @@ local methods = { self.dragging = false self:UpdateIconsVisible() end, - ["ShowTooltip"] = function(self) - end, + ["ShowTooltip"] = function(self) end, ["UpdateOffset"] = function(self) local group = self.frame.dgroup if group then local depth = 0 - while(group) do + while group do depth = depth + 1 group = WeakAuras.GetData(group).parent end @@ -1268,103 +1309,105 @@ local methods = { return self.offset:GetWidth() end, ["GetGroupOrCopying"] = function(self) - return self.group; + return self.group end, ["SetTitle"] = function(self, title) - self.titletext = title; - self.title:SetText(title); + self.titletext = title + self.title:SetText(title) end, ["GetTitle"] = function(self) - return self.titletext; + return self.titletext end, ["SetDescription"] = function(self, ...) - self.frame.description = {...}; + self.frame.description = { ... } end, ["SetViewRegion"] = function(self, region) - self.view.region = region; + self.view.region = region end, ["SetRenameAction"] = function(self, func) self.renamebox.func = function() - func(self.renamebox:GetText()); + func(self.renamebox:GetText()) end end, - ["EnableGroup"] = function(self) - - end, + ["EnableGroup"] = function(self) end, ["SetIds"] = function(self, ids) - self.renamebox.ids = ids; + self.renamebox.ids = ids end, ["SetGroup"] = function(self, group) - self.frame.dgroup = group; - if(group) then - self.icon:SetPoint("LEFT", self.ungroup, "RIGHT"); - self.background:SetPoint("LEFT", self.offset, "RIGHT"); + self.frame.dgroup = group + if group then + self.icon:SetPoint("LEFT", self.ungroup, "RIGHT") + self.background:SetPoint("LEFT", self.offset, "RIGHT") else - self.icon:SetPoint("LEFT", self.frame, "LEFT"); - self.background:SetPoint("LEFT", self.frame, "LEFT"); + self.icon:SetPoint("LEFT", self.frame, "LEFT") + self.background:SetPoint("LEFT", self.frame, "LEFT") end self:UpdateIconsVisible() self:UpdateOffset() end, ["GetGroup"] = function(self) - return self.frame.dgroup; + return self.frame.dgroup end, ["IsGroup"] = function(self) return self.data.regionType == "group" or self.data.regionType == "dynamicgroup" end, ["SetData"] = function(self, data) - self.data = data; - self.frame.id = data.id; + self.data = data + self.frame.id = data.id end, ["GetData"] = function(self) - return self.data; + return self.data end, ["Expand"] = function(self, reloadTooltip) - self.expand:Enable(); + self.expand:Enable() OptionsPrivate.SetCollapsed(self.data.id, "displayButton", "", false) - self.expand:SetNormalTexture("Interface\\BUTTONS\\UI-MinusButton-Up.blp"); - self.expand:SetPushedTexture("Interface\\BUTTONS\\UI-MinusButton-Down.blp"); - self.expand.title = L["Collapse"]; - self.expand.desc = L["Hide this group's children"]; - self.expand:SetScript("OnClick", function() self:Collapse(true) end); - self.expand.func(); - if(reloadTooltip) then - Hide_Tooltip(); - Show_Tooltip(self.frame, self.expand.title, self.expand.desc); + self.expand:SetNormalTexture("Interface\\BUTTONS\\UI-MinusButton-Up.blp") + self.expand:SetPushedTexture("Interface\\BUTTONS\\UI-MinusButton-Down.blp") + self.expand.title = L["Collapse"] + self.expand.desc = L["Hide this group's children"] + self.expand:SetScript("OnClick", function() + self:Collapse(true) + end) + self.expand.func() + if reloadTooltip then + Hide_Tooltip() + Show_Tooltip(self.frame, self.expand.title, self.expand.desc) end end, ["Collapse"] = function(self, reloadTooltip) - self.expand:Enable(); + self.expand:Enable() OptionsPrivate.SetCollapsed(self.data.id, "displayButton", "", true) - self.expand:SetNormalTexture("Interface\\BUTTONS\\UI-PlusButton-Up.blp"); - self.expand:SetPushedTexture("Interface\\BUTTONS\\UI-PlusButton-Down.blp"); - self.expand.title = L["Expand"]; - self.expand.desc = L["Show this group's children"]; - self.expand:SetScript("OnClick", function() self:Expand(true) end); - self.expand.func(); - if(reloadTooltip) then - Hide_Tooltip(); - Show_Tooltip(self.frame, self.expand.title, self.expand.desc); + self.expand:SetNormalTexture("Interface\\BUTTONS\\UI-PlusButton-Up.blp") + self.expand:SetPushedTexture("Interface\\BUTTONS\\UI-PlusButton-Down.blp") + self.expand.title = L["Expand"] + self.expand.desc = L["Show this group's children"] + self.expand:SetScript("OnClick", function() + self:Expand(true) + end) + self.expand.func() + if reloadTooltip then + Hide_Tooltip() + Show_Tooltip(self.frame, self.expand.title, self.expand.desc) end end, ["SetOnExpandCollapse"] = function(self, func) - self.expand.func = func; + self.expand.func = func end, ["GetExpanded"] = function(self) return not OptionsPrivate.IsCollapsed(self.data.id, "displayButton", "", true) end, ["DisableExpand"] = function(self) - self.expand:Disable(); - self.expand.disabled = true; - self.expand.expanded = false; - self.expand:SetNormalTexture("Interface\\BUTTONS\\UI-PlusButton-Disabled.blp"); + self.expand:Disable() + self.expand.disabled = true + self.expand.expanded = false + self.expand:SetNormalTexture("Interface\\BUTTONS\\UI-PlusButton-Disabled.blp") end, ["EnableExpand"] = function(self) - self.expand.disabled = false; - if(self:GetExpanded()) then - self:Expand(); + self.expand.disabled = false + if self:GetExpanded() then + self:Expand() else - self:Collapse(); + self:Collapse() end end, ["UpdateWarning"] = function(self) @@ -1377,11 +1420,7 @@ local methods = { self.warning:SetNormalTexture(icon) end self.warning:SetScript("OnEnter", function() - Show_Tooltip( - self.frame, - title, - warningText - ) + Show_Tooltip(self.frame, title, warningText) end) self.warning:SetScript("OnClick", function() WeakAuras.PickDisplay(self.data.id, "information") @@ -1393,96 +1432,96 @@ local methods = { ["SetGroupOrder"] = function(self, order, max) self.first = (order == 1) self.last = (order == max) - self.frame.dgrouporder = order; + self.frame.dgrouporder = order self:UpdateUpDownButtons() end, ["UpdateUpDownButtons"] = function(self) if self.first or not self:IsEnabled() then - self.upgroup:Disable(); - self.upgroup.texture:SetVertexColor(0.3, 0.3, 0.3); + self.upgroup:Disable() + self.upgroup.texture:SetVertexColor(0.3, 0.3, 0.3) else - self.upgroup:Enable(); - self.upgroup.texture:SetVertexColor(1, 1, 1); + self.upgroup:Enable() + self.upgroup.texture:SetVertexColor(1, 1, 1) end if self.last or not self:IsEnabled() then - self.downgroup:Disable(); - self.downgroup.texture:SetVertexColor(0.3, 0.3, 0.3); + self.downgroup:Disable() + self.downgroup.texture:SetVertexColor(0.3, 0.3, 0.3) else - self.downgroup:Enable(); - self.downgroup.texture:SetVertexColor(1, 1, 1); + self.downgroup:Enable() + self.downgroup.texture:SetVertexColor(1, 1, 1) end end, ["GetGroupOrder"] = function(self) - return self.frame.dgrouporder; + return self.frame.dgrouporder end, ["DisableLoaded"] = function(self) - self.loaded.title = L["Not Loaded"]; - self.loaded.desc = L["This display is not currently loaded"]; - self.loaded:SetNormalTexture("Interface\\BUTTONS\\UI-GuildButton-OfficerNote-Disabled.blp"); + self.loaded.title = L["Not Loaded"] + self.loaded.desc = L["This display is not currently loaded"] + self.loaded:SetNormalTexture("Interface\\BUTTONS\\UI-GuildButton-OfficerNote-Disabled.blp") end, ["EnableLoaded"] = function(self) - self.loaded.title = L["Loaded"]; - self.loaded.desc = L["This display is currently loaded"]; - self.loaded:SetNormalTexture("Interface\\BUTTONS\\UI-GuildButton-OfficerNote-Up.blp"); + self.loaded.title = L["Loaded"] + self.loaded.desc = L["This display is currently loaded"] + self.loaded:SetNormalTexture("Interface\\BUTTONS\\UI-GuildButton-OfficerNote-Up.blp") end, ["Pick"] = function(self) - self.frame:LockHighlight(); - self:PriorityShow(1); + self.frame:LockHighlight() + self:PriorityShow(1) self:RecheckParentVisibility() end, ["ClearPick"] = function(self, noHide) - self.frame:UnlockHighlight(); + self.frame:UnlockHighlight() if not noHide then - self:PriorityHide(1); + self:PriorityHide(1) self:RecheckParentVisibility() end end, ["SyncVisibility"] = function(self) - if (not WeakAuras.IsOptionsOpen()) then - return; + if not WeakAuras.IsOptionsOpen() then + return end if self.view.visibility >= 1 then - if(self.view.region and self.view.region.Expand) then + if self.view.region and self.view.region.Expand then OptionsPrivate.Private.FakeStatesFor(self.view.region.id, true) - if (OptionsPrivate.Private.personalRessourceDisplayFrame) then - OptionsPrivate.Private.personalRessourceDisplayFrame:expand(self.view.region.id); + if OptionsPrivate.Private.personalRessourceDisplayFrame then + OptionsPrivate.Private.personalRessourceDisplayFrame:expand(self.view.region.id) end - if (OptionsPrivate.Private.mouseFrame) then - OptionsPrivate.Private.mouseFrame:expand(self.view.region.id); + if OptionsPrivate.Private.mouseFrame then + OptionsPrivate.Private.mouseFrame:expand(self.view.region.id) end end else - if(self.view.region and self.view.region.Collapse) then + if self.view.region and self.view.region.Collapse then OptionsPrivate.Private.FakeStatesFor(self.view.region.id, false) - if (OptionsPrivate.Private.personalRessourceDisplayFrame) then - OptionsPrivate.Private.personalRessourceDisplayFrame:collapse(self.view.region.id); + if OptionsPrivate.Private.personalRessourceDisplayFrame then + OptionsPrivate.Private.personalRessourceDisplayFrame:collapse(self.view.region.id) end - if (OptionsPrivate.Private.mouseFrame) then - OptionsPrivate.Private.mouseFrame:collapse(self.view.region.id); + if OptionsPrivate.Private.mouseFrame then + OptionsPrivate.Private.mouseFrame:collapse(self.view.region.id) end end end end, ["PriorityShow"] = function(self, priority) - if (not WeakAuras.IsOptionsOpen()) then - return; + if not WeakAuras.IsOptionsOpen() then + return end - if(priority >= self.view.visibility and self.view.visibility ~= priority) then - self.view.visibility = priority; + if priority >= self.view.visibility and self.view.visibility ~= priority then + self.view.visibility = priority self:SyncVisibility() self:UpdateViewTexture() end if self.view.region and self.view.region.ClickToPick then - self.view.region:ClickToPick(); + self.view.region:ClickToPick() end end, ["PriorityHide"] = function(self, priority) - if (not WeakAuras.IsOptionsOpen()) then - return; + if not WeakAuras.IsOptionsOpen() then + return end - if(priority >= self.view.visibility and self.view.visibility ~= 0) then - self.view.visibility = 0; + if priority >= self.view.visibility and self.view.visibility ~= 0 then + self.view.visibility = 0 self:SyncVisibility() self:UpdateViewTexture() end @@ -1497,25 +1536,25 @@ local methods = { end end, ["RecheckVisibility"] = function(self) - local none, all = true, true; + local none, all = true, true for child in OptionsPrivate.Private.TraverseAllChildren(self.data) do - local childButton = WeakAuras.GetDisplayButton(child.id); - if(childButton) then - if(childButton:GetVisibility() ~= 2) then - all = false; + local childButton = WeakAuras.GetDisplayButton(child.id) + if childButton then + if childButton:GetVisibility() ~= 2 then + all = false end - if(childButton:GetVisibility() ~= 0) then - none = false; + if childButton:GetVisibility() ~= 0 then + none = false end end end local newVisibility - if(all) then - newVisibility = 2; - elseif(none) then - newVisibility = 0; + if all then + newVisibility = 2 + elseif none then + newVisibility = 0 else - newVisibility = 1; + newVisibility = 1 end if newVisibility ~= self.view.visibility then self.view.visibility = newVisibility @@ -1526,60 +1565,60 @@ local methods = { end, ["UpdateViewTexture"] = function(self) local visibility = self.view.visibility - if(visibility == 2) then - self.view.texture:SetTexture("Interface\\LFGFrame\\BattlenetWorking0.blp"); - elseif(visibility == 1) then - self.view.texture:SetTexture("Interface\\LFGFrame\\BattlenetWorking2.blp"); + if visibility == 2 then + self.view.texture:SetTexture("Interface\\LFGFrame\\BattlenetWorking0.blp") + elseif visibility == 1 then + self.view.texture:SetTexture("Interface\\LFGFrame\\BattlenetWorking2.blp") else - self.view.texture:SetTexture("Interface\\LFGFrame\\BattlenetWorking4.blp"); + self.view.texture:SetTexture("Interface\\LFGFrame\\BattlenetWorking4.blp") end end, ["GetVisibility"] = function(self) - return self.view.visibility; + return self.view.visibility end, ["Disable"] = function(self) - self.background:Hide(); - self.frame:Disable(); - self.view:Disable(); - self.group:Disable(); - self.ungroup:Disable(); - self.loaded:Disable(); - self.expand:Disable(); + self.background:Hide() + self.frame:Disable() + self.view:Disable() + self.group:Disable() + self.ungroup:Disable() + self.loaded:Disable() + self.expand:Disable() self:UpdateUpDownButtons() end, ["Enable"] = function(self) - self.background:Show(); - self.frame:Enable(); - self.view:Enable(); - self.group:Enable(); - self.ungroup:Enable(); - self.loaded:Enable(); + self.background:Show() + self.frame:Enable() + self.view:Enable() + self.group:Enable() + self.ungroup:Enable() + self.loaded:Enable() self:UpdateUpDownButtons() - if not(self.expand.disabled) then - self.expand:Enable(); + if not self.expand.disabled then + self.expand:Enable() end end, ["IsEnabled"] = function(self) - return self.frame:IsEnabled(); + return self.frame:IsEnabled() end, ["OnRelease"] = function(self) self:ReleaseThumbnail() - self:SetViewRegion(); - self:Enable(); - self:SetGroup(); - self.renamebox:Hide(); - self.title:Show(); - local id = self.data.id; - self.frame:SetScript("OnEnter", nil); - self.frame:SetScript("OnLeave", nil); - self.frame:SetScript("OnClick", nil); - self.frame:SetScript("OnDragStart", nil); - self.frame:SetScript("OnDragStop", nil); + self:SetViewRegion() + self:Enable() + self:SetGroup() + self.renamebox:Hide() + self.title:Show() + local id = self.data.id + self.frame:SetScript("OnEnter", nil) + self.frame:SetScript("OnLeave", nil) + self.frame:SetScript("OnClick", nil) + self.frame:SetScript("OnDragStart", nil) + self.frame:SetScript("OnDragStop", nil) --self.frame:EnableMouse(false); - self.frame:ClearAllPoints(); - self.frame:Hide(); - self.frame = nil; - self.data = nil; + self.frame:ClearAllPoints() + self.frame:Hide() + self.frame = nil + self.data = nil end, ["UpdateThumbnail"] = function(self) if not self.hasThumbnail then @@ -1633,31 +1672,31 @@ local methods = { end end, ["SetIcon"] = function(self, icon) - self.orgIcon = icon; - if(type(icon) == "string" or type(icon) == "number") then - self.icon:SetTexture(icon); - self.icon:Show(); - if(self.iconRegion and self.iconRegion.Hide) then - self.iconRegion:Hide(); + self.orgIcon = icon + if type(icon) == "string" or type(icon) == "number" then + self.icon:SetTexture(icon) + self.icon:Show() + if self.iconRegion and self.iconRegion.Hide then + self.iconRegion:Hide() end else - self.iconRegion = icon; - icon:SetAllPoints(self.icon); - icon:SetParent(self.frame); + self.iconRegion = icon + icon:SetAllPoints(self.icon) + icon:SetParent(self.frame) icon:Show() - self.iconRegion:Show(); - self.icon:Hide(); + self.iconRegion:Show() + self.icon:Hide() end end, ["OverrideIcon"] = function(self) self.icon:SetTexture("Interface\\Addons\\WeakAuras\\Media\\Textures\\icon.blp") self.icon:Show() - if(self.iconRegion and self.iconRegion.Hide) then - self.iconRegion:Hide(); + if self.iconRegion and self.iconRegion.Hide then + self.iconRegion:Hide() end end, ["RestoreIcon"] = function(self) - self:SetIcon(self.orgIcon); + self:SetIcon(self.orgIcon) end, } @@ -1666,185 +1705,200 @@ Constructor -------------------------------------------------------------------------------]] local function Constructor() - local name = "WeakAurasDisplayButton"..AceGUI:GetNextWidgetNum(Type); - local button = CreateFrame("Button", name, UIParent, "OptionsListButtonTemplate"); - button:SetHeight(32); - button:SetWidth(1000); - button.dgroup = nil; - button.data = {}; + local name = "WeakAurasDisplayButton" .. AceGUI:GetNextWidgetNum(Type) + local button = CreateFrame("Button", name, UIParent, "OptionsListButtonTemplate") + button:SetHeight(32) + button:SetWidth(1000) + button.dgroup = nil + button.data = {} local offset = CreateFrame("Frame", nil, button) button.offset = offset - offset:SetPoint("TOP", button, "TOP"); - offset:SetPoint("BOTTOM", button, "BOTTOM"); - offset:SetPoint("LEFT", button, "LEFT"); + offset:SetPoint("TOP", button, "TOP") + offset:SetPoint("BOTTOM", button, "BOTTOM") + offset:SetPoint("LEFT", button, "LEFT") offset:SetWidth(1) - local background = button:CreateTexture(nil, "BACKGROUND"); - button.background = background; - background:SetTexture("Interface\\BUTTONS\\UI-Listbox-Highlight2.blp"); - background:SetBlendMode("ADD"); - background:SetVertexColor(0.5, 0.5, 0.5, 0.25); - background:SetPoint("TOP", button, "TOP"); - background:SetPoint("BOTTOM", button, "BOTTOM"); + local background = button:CreateTexture(nil, "BACKGROUND") + button.background = background + background:SetTexture("Interface\\BUTTONS\\UI-Listbox-Highlight2.blp") + background:SetBlendMode("ADD") + background:SetVertexColor(0.5, 0.5, 0.5, 0.25) + background:SetPoint("TOP", button, "TOP") + background:SetPoint("BOTTOM", button, "BOTTOM") background:SetPoint("LEFT", button, "LEFT") - background:SetPoint("RIGHT", button, "RIGHT"); - - local icon = button:CreateTexture(nil, "OVERLAY"); - button.icon = icon; - icon:SetWidth(32); - icon:SetHeight(32); - icon:SetPoint("LEFT", offset, "RIGHT"); - - local title = button:CreateFontString(nil, "OVERLAY", "GameFontNormal"); - button.title = title; - title:SetHeight(14); - title:SetJustifyH("LEFT"); - title:SetPoint("TOP", button, "TOP", 0, -2); - title:SetPoint("LEFT", icon, "RIGHT", 2, 0); - title:SetPoint("RIGHT", button, "RIGHT"); - - button.description = {}; - - local view = CreateFrame("Button", nil, button); - button.view = view; - view:SetWidth(16); - view:SetHeight(16); - view:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -2, 0); + background:SetPoint("RIGHT", button, "RIGHT") + + local icon = button:CreateTexture(nil, "OVERLAY") + button.icon = icon + icon:SetWidth(32) + icon:SetHeight(32) + icon:SetPoint("LEFT", offset, "RIGHT") + + local title = button:CreateFontString(nil, "OVERLAY", "GameFontNormal") + button.title = title + title:SetHeight(14) + title:SetJustifyH("LEFT") + title:SetPoint("TOP", button, "TOP", 0, -2) + title:SetPoint("LEFT", icon, "RIGHT", 2, 0) + title:SetPoint("RIGHT", button, "RIGHT") + + button.description = {} + + local view = CreateFrame("Button", nil, button) + button.view = view + view:SetWidth(16) + view:SetHeight(16) + view:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -2, 0) local viewTexture = view:CreateTexture() - view.texture = viewTexture; - viewTexture:SetTexture("Interface\\LFGFrame\\BattlenetWorking4.blp"); - viewTexture:SetTexCoord(0.1, 0.9, 0.1, 0.9); - viewTexture:SetAllPoints(view); - view:SetNormalTexture(viewTexture); - view:SetHighlightTexture("Interface\\BUTTONS\\UI-Panel-MinimizeButton-Highlight.blp"); - view:SetScript("OnEnter", function() Show_Tooltip(button, L["View"], L["Toggle the visibility of this display"]) end); - view:SetScript("OnLeave", Hide_Tooltip); - - view.visibility = 0; - - local loaded = CreateFrame("Button", nil, button); - button.loaded = loaded; - loaded:SetWidth(16); - loaded:SetHeight(16); - loaded:SetPoint("BOTTOM", button, "BOTTOM"); - loaded:SetPoint("LEFT", icon, "RIGHT", 0, 0); - loaded:SetNormalTexture("Interface\\BUTTONS\\UI-GuildButton-OfficerNote-Up.blp"); - loaded:SetDisabledTexture("Interface\\BUTTONS\\UI-GuildButton-OfficerNote-Disabled.blp"); + view.texture = viewTexture + viewTexture:SetTexture("Interface\\LFGFrame\\BattlenetWorking4.blp") + viewTexture:SetTexCoord(0.1, 0.9, 0.1, 0.9) + viewTexture:SetAllPoints(view) + view:SetNormalTexture(viewTexture) + view:SetHighlightTexture("Interface\\BUTTONS\\UI-Panel-MinimizeButton-Highlight.blp") + view:SetScript("OnEnter", function() + Show_Tooltip(button, L["View"], L["Toggle the visibility of this display"]) + end) + view:SetScript("OnLeave", Hide_Tooltip) + + view.visibility = 0 + + local loaded = CreateFrame("Button", nil, button) + button.loaded = loaded + loaded:SetWidth(16) + loaded:SetHeight(16) + loaded:SetPoint("BOTTOM", button, "BOTTOM") + loaded:SetPoint("LEFT", icon, "RIGHT", 0, 0) + loaded:SetNormalTexture("Interface\\BUTTONS\\UI-GuildButton-OfficerNote-Up.blp") + loaded:SetDisabledTexture("Interface\\BUTTONS\\UI-GuildButton-OfficerNote-Disabled.blp") --loaded:SetHighlightTexture("Interface\\BUTTONS\\UI-Panel-MinimizeButton-Highlight.blp"); - loaded.title = L["Loaded"]; - loaded.desc = L["This display is currently loaded"]; - loaded:SetScript("OnEnter", function() Show_Tooltip(button, loaded.title, loaded.desc) end); - loaded:SetScript("OnLeave", Hide_Tooltip); - - local renamebox = CreateFrame("EditBox", nil, button, "InputBoxTemplate"); - renamebox:SetHeight(14); - renamebox:SetPoint("TOP", button, "TOP"); - renamebox:SetPoint("LEFT", icon, "RIGHT", 6, 0); - renamebox:SetPoint("RIGHT", button, "RIGHT", -4, 0); - renamebox:SetFont(STANDARD_TEXT_FONT, 10); - renamebox:Hide(); - - renamebox.func = function() --[[By default, do nothing!]] end; + loaded.title = L["Loaded"] + loaded.desc = L["This display is currently loaded"] + loaded:SetScript("OnEnter", function() + Show_Tooltip(button, loaded.title, loaded.desc) + end) + loaded:SetScript("OnLeave", Hide_Tooltip) + + local renamebox = CreateFrame("EditBox", nil, button, "InputBoxTemplate") + renamebox:SetHeight(14) + renamebox:SetPoint("TOP", button, "TOP") + renamebox:SetPoint("LEFT", icon, "RIGHT", 6, 0) + renamebox:SetPoint("RIGHT", button, "RIGHT", -4, 0) + renamebox:SetFont(STANDARD_TEXT_FONT, 10) + renamebox:Hide() + + renamebox.func = function() --[[By default, do nothing!]] + end renamebox:SetScript("OnEnterPressed", function() - local oldid = button.title:GetText(); - local newid = renamebox:GetText(); - if(newid == "" or (newid ~= oldid and WeakAuras.GetData(newid))) then - renamebox:SetText(button.title:GetText()); + local oldid = button.title:GetText() + local newid = renamebox:GetText() + if newid == "" or (newid ~= oldid and WeakAuras.GetData(newid)) then + renamebox:SetText(button.title:GetText()) else - renamebox.func(); - title:SetText(renamebox:GetText()); - title:Show(); - renamebox:Hide(); + renamebox.func() + title:SetText(renamebox:GetText()) + title:Show() + renamebox:Hide() end - end); + end) renamebox:SetScript("OnEscapePressed", function() - title:Show(); - renamebox:Hide(); - end); - - local group = CreateFrame("Button", nil, button); - button.group = group; - group:SetWidth(16); - group:SetHeight(16); - group:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -18, 0); - local grouptexture = group:CreateTexture(nil, "OVERLAY"); - group.texture = grouptexture; - grouptexture:SetTexture("Interface\\GLUES\\CharacterCreate\\UI-RotationRight-Big-Up.blp"); - grouptexture:SetTexCoord(0.15, 0.85, 0.15, 0.85); - grouptexture:SetAllPoints(group); - group:SetNormalTexture(grouptexture); - group:SetHighlightTexture("Interface\\BUTTONS\\UI-Panel-MinimizeButton-Highlight.blp"); - group:SetScript("OnEnter", function() Show_Tooltip(button, L["Group (verb)"], L["Put this display in a group"]) end); - group:SetScript("OnLeave", Hide_Tooltip); - - local ungroup = CreateFrame("Button", nil, button); - button.ungroup = ungroup; - ungroup:SetWidth(11); - ungroup:SetHeight(11); - ungroup:SetPoint("LEFT", offset, "RIGHT", 0, 0); - local ungrouptexture = group:CreateTexture(nil, "OVERLAY"); - ungrouptexture:SetTexture("Interface\\MoneyFrame\\Arrow-Left-Down.blp"); - ungrouptexture:SetTexCoord(0.5, 0, 0.5, 1, 1, 0, 1, 1); - ungrouptexture:SetAllPoints(ungroup); - ungroup:SetNormalTexture(ungrouptexture); - ungroup:SetHighlightTexture("Interface\\BUTTONS\\UI-Panel-MinimizeButton-Highlight.blp"); - ungroup:SetScript("OnEnter", function() Show_Tooltip(button, L["Ungroup"], L["Remove this display from its group"]) end); - ungroup:SetScript("OnLeave", Hide_Tooltip); - ungroup:Hide(); - - local upgroup = CreateFrame("Button", nil, button); - button.upgroup = upgroup; - upgroup:SetWidth(11); - upgroup:SetHeight(11); - upgroup:SetPoint("TOPLEFT", offset, "TOPRIGHT", 0, 0); - local upgrouptexture = group:CreateTexture(nil, "OVERLAY"); - upgroup.texture = upgrouptexture; - upgrouptexture:SetTexture("Interface\\MoneyFrame\\Arrow-Left-Down.blp"); - upgrouptexture:SetTexCoord(0.5, 1, 1, 1, 0.5, 0, 1, 0); - upgrouptexture:SetVertexColor(1, 1, 1); - upgrouptexture:SetAllPoints(upgroup); - upgroup:SetNormalTexture(upgrouptexture); - upgroup:SetHighlightTexture("Interface\\BUTTONS\\UI-Panel-MinimizeButton-Highlight.blp"); - upgroup:SetScript("OnEnter", function() Show_Tooltip(button, L["Move Up"], L["Move this display up in its group's order"]) end); - upgroup:SetScript("OnLeave", Hide_Tooltip); - upgroup:Hide(); - - local downgroup = CreateFrame("Button", nil, button); - button.downgroup = downgroup; - downgroup:SetWidth(11); - downgroup:SetHeight(11); - downgroup:SetPoint("BOTTOMLEFT", offset, "BOTTOMRIGHT", 0, 0); - local downgrouptexture = group:CreateTexture(nil, "OVERLAY"); - downgroup.texture = downgrouptexture; - downgrouptexture:SetTexture("Interface\\MoneyFrame\\Arrow-Left-Down.blp"); - downgrouptexture:SetTexCoord(1, 0, 0.5, 0, 1, 1, 0.5, 1); - downgrouptexture:SetAllPoints(downgroup); - downgroup:SetNormalTexture(downgrouptexture); - downgroup:SetHighlightTexture("Interface\\BUTTONS\\UI-Panel-MinimizeButton-Highlight.blp"); - downgroup:SetScript("OnEnter", function() Show_Tooltip(button, L["Move Down"], L["Move this display down in its group's order"]) end); - downgroup:SetScript("OnLeave", Hide_Tooltip); - downgroup:Hide(); - - local expand = CreateFrame("Button", nil, button); - button.expand = expand; - expand.expanded = true; - expand.disabled = true; - expand.func = function() end; - expand:SetNormalTexture("Interface\\BUTTONS\\UI-PlusButton-Disabled.blp"); - expand:Disable(); - expand:SetWidth(16); - expand:SetHeight(16); - expand:SetPoint("BOTTOM", button, "BOTTOM"); - expand:SetPoint("LEFT", icon, "RIGHT", 0, 0); - expand:SetHighlightTexture("Interface\\BUTTONS\\UI-Panel-MinimizeButton-Highlight.blp"); - expand.title = L["Disabled"]; - expand.desc = L["Expansion is disabled because this group has no children"]; - expand:SetScript("OnEnter", function() Show_Tooltip(button, expand.title, expand.desc) end); - expand:SetScript("OnLeave", Hide_Tooltip); - - local warning = CreateFrame("Button", nil, button); + title:Show() + renamebox:Hide() + end) + + local group = CreateFrame("Button", nil, button) + button.group = group + group:SetWidth(16) + group:SetHeight(16) + group:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -18, 0) + local grouptexture = group:CreateTexture(nil, "OVERLAY") + group.texture = grouptexture + grouptexture:SetTexture("Interface\\GLUES\\CharacterCreate\\UI-RotationRight-Big-Up.blp") + grouptexture:SetTexCoord(0.15, 0.85, 0.15, 0.85) + grouptexture:SetAllPoints(group) + group:SetNormalTexture(grouptexture) + group:SetHighlightTexture("Interface\\BUTTONS\\UI-Panel-MinimizeButton-Highlight.blp") + group:SetScript("OnEnter", function() + Show_Tooltip(button, L["Group (verb)"], L["Put this display in a group"]) + end) + group:SetScript("OnLeave", Hide_Tooltip) + + local ungroup = CreateFrame("Button", nil, button) + button.ungroup = ungroup + ungroup:SetWidth(11) + ungroup:SetHeight(11) + ungroup:SetPoint("LEFT", offset, "RIGHT", 0, 0) + local ungrouptexture = group:CreateTexture(nil, "OVERLAY") + ungrouptexture:SetTexture("Interface\\MoneyFrame\\Arrow-Left-Down.blp") + ungrouptexture:SetTexCoord(0.5, 0, 0.5, 1, 1, 0, 1, 1) + ungrouptexture:SetAllPoints(ungroup) + ungroup:SetNormalTexture(ungrouptexture) + ungroup:SetHighlightTexture("Interface\\BUTTONS\\UI-Panel-MinimizeButton-Highlight.blp") + ungroup:SetScript("OnEnter", function() + Show_Tooltip(button, L["Ungroup"], L["Remove this display from its group"]) + end) + ungroup:SetScript("OnLeave", Hide_Tooltip) + ungroup:Hide() + + local upgroup = CreateFrame("Button", nil, button) + button.upgroup = upgroup + upgroup:SetWidth(11) + upgroup:SetHeight(11) + upgroup:SetPoint("TOPLEFT", offset, "TOPRIGHT", 0, 0) + local upgrouptexture = group:CreateTexture(nil, "OVERLAY") + upgroup.texture = upgrouptexture + upgrouptexture:SetTexture("Interface\\MoneyFrame\\Arrow-Left-Down.blp") + upgrouptexture:SetTexCoord(0.5, 1, 1, 1, 0.5, 0, 1, 0) + upgrouptexture:SetVertexColor(1, 1, 1) + upgrouptexture:SetAllPoints(upgroup) + upgroup:SetNormalTexture(upgrouptexture) + upgroup:SetHighlightTexture("Interface\\BUTTONS\\UI-Panel-MinimizeButton-Highlight.blp") + upgroup:SetScript("OnEnter", function() + Show_Tooltip(button, L["Move Up"], L["Move this display up in its group's order"]) + end) + upgroup:SetScript("OnLeave", Hide_Tooltip) + upgroup:Hide() + + local downgroup = CreateFrame("Button", nil, button) + button.downgroup = downgroup + downgroup:SetWidth(11) + downgroup:SetHeight(11) + downgroup:SetPoint("BOTTOMLEFT", offset, "BOTTOMRIGHT", 0, 0) + local downgrouptexture = group:CreateTexture(nil, "OVERLAY") + downgroup.texture = downgrouptexture + downgrouptexture:SetTexture("Interface\\MoneyFrame\\Arrow-Left-Down.blp") + downgrouptexture:SetTexCoord(1, 0, 0.5, 0, 1, 1, 0.5, 1) + downgrouptexture:SetAllPoints(downgroup) + downgroup:SetNormalTexture(downgrouptexture) + downgroup:SetHighlightTexture("Interface\\BUTTONS\\UI-Panel-MinimizeButton-Highlight.blp") + downgroup:SetScript("OnEnter", function() + Show_Tooltip(button, L["Move Down"], L["Move this display down in its group's order"]) + end) + downgroup:SetScript("OnLeave", Hide_Tooltip) + downgroup:Hide() + + local expand = CreateFrame("Button", nil, button) + button.expand = expand + expand.expanded = true + expand.disabled = true + expand.func = function() end + expand:SetNormalTexture("Interface\\BUTTONS\\UI-PlusButton-Disabled.blp") + expand:Disable() + expand:SetWidth(16) + expand:SetHeight(16) + expand:SetPoint("BOTTOM", button, "BOTTOM") + expand:SetPoint("LEFT", icon, "RIGHT", 0, 0) + expand:SetHighlightTexture("Interface\\BUTTONS\\UI-Panel-MinimizeButton-Highlight.blp") + expand.title = L["Disabled"] + expand.desc = L["Expansion is disabled because this group has no children"] + expand:SetScript("OnEnter", function() + Show_Tooltip(button, expand.title, expand.desc) + end) + expand:SetScript("OnLeave", Hide_Tooltip) + + local warning = CreateFrame("Button", nil, button) button.warning = warning warning:SetWidth(16) warning:SetHeight(16) @@ -1867,13 +1921,13 @@ local function Constructor() expand = expand, warning = warning, type = Type, - offset = offset + offset = offset, } for method, func in pairs(methods) do widget[method] = func end - return AceGUI:RegisterAsWidget(widget); + return AceGUI:RegisterAsWidget(widget) end AceGUI:RegisterWidgetType(Type, Constructor, Version) diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasExpand.lua b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasExpand.lua index 7fa05562d5..5a6b811549 100644 --- a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasExpand.lua +++ b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasExpand.lua @@ -1,12 +1,16 @@ --[[----------------------------------------------------------------------------- Button Widget for our Expand button -------------------------------------------------------------------------------]] -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local Type, Version = "WeakAurasExpand", 4 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) -if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end +if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then + return +end -- Lua APIs local select, pairs = select, pairs @@ -18,129 +22,129 @@ local CreateFrame, UIParent = CreateFrame, UIParent Scripts -------------------------------------------------------------------------------]] local function Control_OnEnter(frame) - frame.obj:Fire("OnEnter") + frame.obj:Fire("OnEnter") end local function Control_OnLeave(frame) - frame.obj:Fire("OnLeave") + frame.obj:Fire("OnLeave") end local function Button_OnClick(frame, button) - frame.obj:Fire("OnClick", button) - AceGUI:ClearFocus() + frame.obj:Fire("OnClick", button) + AceGUI:ClearFocus() end --[[----------------------------------------------------------------------------- Methods -------------------------------------------------------------------------------]] local methods = { - ["OnAcquire"] = function(self) - self:SetHeight(110) - self:SetWidth(110) - self:SetLabel() - self:SetImage(nil) - self:SetImageSize(64, 64) - self:SetDisabled(false) - end, - - -- ["OnRelease"] = nil, - - ["SetLabel"] = function(self, text) - if text and text ~= "" then - self.label:Show() - self.label:SetText(text) - self:SetHeight(max(self.label:GetStringHeight(), self.image:GetHeight())) - else - self.label:Hide() - self:SetHeight(self.image:GetHeight()) - end - end, - - ["SetImage"] = function(self, path, ...) - local image = self.image - image:SetTexture(path) - - if image:GetTexture() then - local n = select("#", ...) - if n == 4 or n == 8 then - image:SetTexCoord(...) - else - image:SetTexCoord(0, 1, 0, 1) - end - end - end, - - ["SetImageSize"] = function(self, width, height) - self.image:SetWidth(width) - self.image:SetHeight(height) - --self.frame:SetWidth(width + 30) - if self.label:IsShown() then - self:SetHeight(max(self.label:GetStringHeight(), self.image:GetHeight())) - else - self:SetHeight(self.image:GetHeight()) - end - end, - - ["SetDisabled"] = function(self, disabled) - self.disabled = disabled - if disabled then - self.frame:Disable() - self.label:SetTextColor(0.5, 0.5, 0.5) - self.image:SetVertexColor(0.5, 0.5, 0.5, 0.5) - else - self.frame:Enable() - self.label:SetTextColor(1, 1, 1) - self.image:SetVertexColor(1, 1, 1, 1) - end - end, + ["OnAcquire"] = function(self) + self:SetHeight(110) + self:SetWidth(110) + self:SetLabel() + self:SetImage(nil) + self:SetImageSize(64, 64) + self:SetDisabled(false) + end, + + -- ["OnRelease"] = nil, + + ["SetLabel"] = function(self, text) + if text and text ~= "" then + self.label:Show() + self.label:SetText(text) + self:SetHeight(max(self.label:GetStringHeight(), self.image:GetHeight())) + else + self.label:Hide() + self:SetHeight(self.image:GetHeight()) + end + end, + + ["SetImage"] = function(self, path, ...) + local image = self.image + image:SetTexture(path) + + if image:GetTexture() then + local n = select("#", ...) + if n == 4 or n == 8 then + image:SetTexCoord(...) + else + image:SetTexCoord(0, 1, 0, 1) + end + end + end, + + ["SetImageSize"] = function(self, width, height) + self.image:SetWidth(width) + self.image:SetHeight(height) + --self.frame:SetWidth(width + 30) + if self.label:IsShown() then + self:SetHeight(max(self.label:GetStringHeight(), self.image:GetHeight())) + else + self:SetHeight(self.image:GetHeight()) + end + end, + + ["SetDisabled"] = function(self, disabled) + self.disabled = disabled + if disabled then + self.frame:Disable() + self.label:SetTextColor(0.5, 0.5, 0.5) + self.image:SetVertexColor(0.5, 0.5, 0.5, 0.5) + else + self.frame:Enable() + self.label:SetTextColor(1, 1, 1) + self.image:SetVertexColor(1, 1, 1, 1) + end + end, ["SetFontObject"] = function(self, fontObject) self.label:SetFontObject(fontObject) - end + end, } --[[----------------------------------------------------------------------------- Constructor -------------------------------------------------------------------------------]] local function Constructor() - local frame = CreateFrame("Button", nil, UIParent) - frame:Hide() - - frame:EnableMouse(true) - frame:SetScript("OnEnter", Control_OnEnter) - frame:SetScript("OnLeave", Control_OnLeave) - frame:SetScript("OnClick", Button_OnClick) - - local image = frame:CreateTexture(nil, "BACKGROUND") - image:SetWidth(64) - image:SetHeight(64) - image:SetPoint("LEFT", 0, 0) - - local label = frame:CreateFontString(nil, "BACKGROUND", "GameFontHighlightLarge") - label:SetJustifyH("LEFT") - label:SetJustifyV("TOP") - label:SetPoint("LEFT", image, "RIGHT", 5, 0) - label:SetPoint("TOP") - label:SetPoint("BOTTOM") - label:SetPoint("RIGHT") - - local highlight = frame:CreateTexture(nil, "HIGHLIGHT") - highlight:SetAllPoints(frame) - highlight:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\Square_White") - highlight:SetVertexColor(0.2, 0.4, 0.8, 0.2) - highlight:SetBlendMode("ADD") - - local widget = { - label = label, - image = image, - frame = frame, - type = Type - } - for method, func in pairs(methods) do - widget[method] = func - end - - return AceGUI:RegisterAsWidget(widget) + local frame = CreateFrame("Button", nil, UIParent) + frame:Hide() + + frame:EnableMouse(true) + frame:SetScript("OnEnter", Control_OnEnter) + frame:SetScript("OnLeave", Control_OnLeave) + frame:SetScript("OnClick", Button_OnClick) + + local image = frame:CreateTexture(nil, "BACKGROUND") + image:SetWidth(64) + image:SetHeight(64) + image:SetPoint("LEFT", 0, 0) + + local label = frame:CreateFontString(nil, "BACKGROUND", "GameFontHighlightLarge") + label:SetJustifyH("LEFT") + label:SetJustifyV("TOP") + label:SetPoint("LEFT", image, "RIGHT", 5, 0) + label:SetPoint("TOP") + label:SetPoint("BOTTOM") + label:SetPoint("RIGHT") + + local highlight = frame:CreateTexture(nil, "HIGHLIGHT") + highlight:SetAllPoints(frame) + highlight:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\Square_White") + highlight:SetVertexColor(0.2, 0.4, 0.8, 0.2) + highlight:SetBlendMode("ADD") + + local widget = { + label = label, + image = image, + frame = frame, + type = Type, + } + for method, func in pairs(methods) do + widget[method] = func + end + + return AceGUI:RegisterAsWidget(widget) end AceGUI:RegisterWidgetType(Type, Constructor, Version) diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasExpandAnchor.lua b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasExpandAnchor.lua index 2ff8593df6..bfe3f6aca9 100644 --- a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasExpandAnchor.lua +++ b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasExpandAnchor.lua @@ -1,11 +1,15 @@ --[[----------------------------------------------------------------------------- Anchor for a Expandable section -------------------------------------------------------------------------------]] -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... local Type, Version = "WeakAurasExpandAnchor", 3 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) -if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end +if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then + return +end local methods = { ["OnAcquire"] = function(self) @@ -15,14 +19,11 @@ local methods = { -- ["OnRelease"] = nil, - ["OnWidthSet"] = function(self, width) - end, + ["OnWidthSet"] = function(self, width) end, - ["SetText"] = function(self, text) - end, + ["SetText"] = function(self, text) end, - ["SetFontObject"] = function(self, font) - end, + ["SetFontObject"] = function(self, font) end, } local function OnFrameShow(frame) @@ -50,7 +51,6 @@ local function OnFrameHide(frame) end end - local function Constructor() local frame = CreateFrame("Frame", nil, UIParent) frame:Hide() @@ -61,7 +61,7 @@ local function Constructor() -- create widget local widget = { frame = frame, - type = Type + type = Type, } for method, func in pairs(methods) do widget[method] = func diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasExpandSmall.lua b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasExpandSmall.lua index ced766ba4c..de31f198e9 100644 --- a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasExpandSmall.lua +++ b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasExpandSmall.lua @@ -1,13 +1,17 @@ --[[----------------------------------------------------------------------------- Button Widget for our Expand button -------------------------------------------------------------------------------]] -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... local Type, Version = "WeakAurasExpandSmall", 3 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) -if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end +if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then + return +end -- Lua APIs local select, pairs = select, pairs @@ -130,7 +134,7 @@ local methods = { else self:SetHeight(self.image:GetHeight()) end - self.expandedBackground:SetHeight(self.frame:GetHeight()*2) + self.expandedBackground:SetHeight(self.frame:GetHeight() * 2) end, ["SetAnchor"] = function(self, otherWidget) @@ -138,7 +142,7 @@ local methods = { if otherWidget then expandedBackground:SetPoint("BOTTOMLEFT", otherWidget.frame, "TOPLEFT", -4, -2) end - end + end, } local function OnFrameShow(frame) @@ -167,9 +171,6 @@ local function OnFrameHide(frame) end end - - - --[[----------------------------------------------------------------------------- Constructor -------------------------------------------------------------------------------]] @@ -221,7 +222,7 @@ local function Constructor() label = label, image = image, frame = frame, - type = Type, + type = Type, expanded = false, expandedBackground = expandedBackground, expandedHighlight = expandedHighlight, diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasIcon.lua b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasIcon.lua index 99f4db47f1..d73078b0da 100644 --- a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasIcon.lua +++ b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasIcon.lua @@ -3,17 +3,21 @@ Icon Widget that allows for a tooltip, by preventing SetLabel from actually setting a label Graphical Button. -------------------------------------------------------------------------------]] -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local Type, Version = "WeakAurasIcon", 2 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) -if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end +if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then + return +end local function Constructor() - local button = AceGUI:Create("Icon") - button.type = Type - button.SetLabel = function() end - return button + local button = AceGUI:Create("Icon") + button.type = Type + button.SetLabel = function() end + return button end AceGUI:RegisterWidgetType(Type, Constructor, Version) diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasIconButton.lua b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasIconButton.lua index 917a3c12df..66a62f4119 100644 --- a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasIconButton.lua +++ b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasIconButton.lua @@ -1,20 +1,24 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local Type, Version = "WeakAurasIconButton", 22 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) -if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end +if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then + return +end local function Hide_Tooltip() - GameTooltip:Hide(); + GameTooltip:Hide() end local function Show_Tooltip(owner, line1, line2) - GameTooltip:SetOwner(owner, "ANCHOR_NONE"); - GameTooltip:SetPoint("BOTTOM", owner, "TOP"); - GameTooltip:ClearLines(); - GameTooltip:AddLine(line1); - GameTooltip:AddLine(line2, 1, 1, 1, 1); - GameTooltip:Show(); + GameTooltip:SetOwner(owner, "ANCHOR_NONE") + GameTooltip:SetPoint("BOTTOM", owner, "TOP") + GameTooltip:ClearLines() + GameTooltip:AddLine(line1) + GameTooltip:AddLine(line2, 1, 1, 1, 1) + GameTooltip:Show() end --[[----------------------------------------------------------------------------- @@ -22,39 +26,39 @@ Methods -------------------------------------------------------------------------------]] local methods = { ["OnAcquire"] = function(self) - self:SetWidth(52); - self:SetHeight(52); + self:SetWidth(52) + self:SetHeight(52) end, ["OnRelease"] = function(self) - self:ClearPick(); - self.texture:SetTexture(); + self:ClearPick() + self.texture:SetTexture() end, ["SetName"] = function(self, name) - self.texture.name = name; + self.texture.name = name end, ["GetName"] = function(self) - return self.texture.name; + return self.texture.name end, ["SetTexture"] = function(self, texturePath) - self.texture.path = texturePath; - local success = self.texture:SetTexture(texturePath); - if not(success) then - self.texture:SetTexture("Interface\\BUTTONS\\UI-Quickslot-Depress.blp"); + self.texture.path = texturePath + local success = self.texture:SetTexture(texturePath) + if not success then + self.texture:SetTexture("Interface\\BUTTONS\\UI-Quickslot-Depress.blp") end - return success; + return success end, ["GetTexturePath"] = function(self) - return self.texture.path; + return self.texture.path end, ["SetClick"] = function(self, func) - self.frame:SetScript("OnClick", func); + self.frame:SetScript("OnClick", func) end, ["Pick"] = function(self) - self.frame:LockHighlight(); + self.frame:LockHighlight() end, ["ClearPick"] = function(self) - self.frame:UnlockHighlight(); - end + self.frame:UnlockHighlight() + end, } --[[----------------------------------------------------------------------------- @@ -62,30 +66,32 @@ Constructor -------------------------------------------------------------------------------]] local function Constructor() - local button = CreateFrame("Button", nil, UIParent); - button:SetHeight(52); - button:SetWidth(52); + local button = CreateFrame("Button", nil, UIParent) + button:SetHeight(52) + button:SetWidth(52) - local highlighttexture = button:CreateTexture(nil, "OVERLAY"); + local highlighttexture = button:CreateTexture(nil, "OVERLAY") --highlighttexture:SetTexture("Interface\\BUTTONS\\ButtonHilight-SquareQuickslot.blp"); --highlighttexture:SetTexCoord(0.175, 0.875, 0.125, 0.825); - highlighttexture:SetTexture("Interface\\BUTTONS\\UI-Listbox-Highlight.blp"); - highlighttexture:SetVertexColor(0.25, 0.5, 1); - highlighttexture:SetPoint("BOTTOMLEFT", button, 4, 4); - highlighttexture:SetPoint("TOPRIGHT", button, -4, -4); - button:SetHighlightTexture(highlighttexture); + highlighttexture:SetTexture("Interface\\BUTTONS\\UI-Listbox-Highlight.blp") + highlighttexture:SetVertexColor(0.25, 0.5, 1) + highlighttexture:SetPoint("BOTTOMLEFT", button, 4, 4) + highlighttexture:SetPoint("TOPRIGHT", button, -4, -4) + button:SetHighlightTexture(highlighttexture) - local texture = button:CreateTexture(nil, "OVERLAY"); - texture:SetAllPoints(button); - texture.name = "Undefined"; + local texture = button:CreateTexture(nil, "OVERLAY") + texture:SetAllPoints(button) + texture.name = "Undefined" - button:SetScript("OnEnter", function() Show_Tooltip(button, texture.name, texture.path) end); - button:SetScript("OnLeave", Hide_Tooltip); + button:SetScript("OnEnter", function() + Show_Tooltip(button, texture.name, texture.path) + end) + button:SetScript("OnLeave", Hide_Tooltip) local widget = { frame = button, texture = texture, - type = Type + type = Type, } for method, func in pairs(methods) do widget[method] = func diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasImportButton.lua b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasImportButton.lua index 8d0ce8d470..7c146cafe1 100644 --- a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasImportButton.lua +++ b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasImportButton.lua @@ -1,22 +1,26 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local Type, Version = "WeakAurasImportButton", 21 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) -if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end +if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then + return +end -local L = WeakAuras.L; +local L = WeakAuras.L local function Hide_Tooltip() - GameTooltip:Hide(); + GameTooltip:Hide() end local function Show_Tooltip(owner, line1, line2) - GameTooltip:SetOwner(owner, "ANCHOR_NONE"); - GameTooltip:SetPoint("LEFT", owner, "RIGHT"); - GameTooltip:ClearLines(); - GameTooltip:AddLine(line1); - GameTooltip:AddLine(line2, 1, 1, 1, 1); - GameTooltip:Show(); + GameTooltip:SetOwner(owner, "ANCHOR_NONE") + GameTooltip:SetPoint("LEFT", owner, "RIGHT") + GameTooltip:ClearLines() + GameTooltip:AddLine(line1) + GameTooltip:AddLine(line2, 1, 1, 1, 1) + GameTooltip:Show() end --[[----------------------------------------------------------------------------- @@ -24,27 +28,27 @@ Methods -------------------------------------------------------------------------------]] local methods = { ["OnAcquire"] = function(self) - self:SetWidth(380); - self:SetHeight(18); + self:SetWidth(380) + self:SetHeight(18) end, ["SetTitle"] = function(self, title) - self.title:SetText(title); + self.title:SetText(title) end, ["GetTitle"] = function(self) - return self.title:GetText(); + return self.title:GetText() end, ["SetDescription"] = function(self, desc) - self.frame.description = desc; + self.frame.description = desc end, ["SetIcon"] = function(self, iconPath) - if(iconPath) then - local icon = self.frame:CreateTexture(); - icon:SetTexture(iconPath); - icon:SetPoint("RIGHT", self.frame, "RIGHT"); - icon:SetPoint("BOTTOM", self.frame, "BOTTOM"); - icon:SetWidth(16); - icon:SetHeight(16); - self.title:SetPoint("RIGHT", icon, "LEFT"); + if iconPath then + local icon = self.frame:CreateTexture() + icon:SetTexture(iconPath) + icon:SetPoint("RIGHT", self.frame, "RIGHT") + icon:SetPoint("BOTTOM", self.frame, "BOTTOM") + icon:SetWidth(16) + icon:SetHeight(16) + self.title:SetPoint("RIGHT", icon, "LEFT") end end, -- ["SetChecked"] = function(self, value) @@ -58,64 +62,68 @@ local methods = { -- return checked; -- end, ["SetClick"] = function(self, func) - self.checkbox:SetScript("OnClick", func); + self.checkbox:SetScript("OnClick", func) end, ["Expand"] = function(self, reloadTooltip) - self.expand:Enable(); - self.expand.expanded = true; - self.expand:SetNormalTexture("Interface\\BUTTONS\\UI-MinusButton-Up.blp"); - self.expand:SetPushedTexture("Interface\\BUTTONS\\UI-MinusButton-Down.blp"); - self.expand.title = L["Collapse"]; - self.expand:SetScript("OnClick", function() self:Collapse(true) end); - self.expand.func(); - if(reloadTooltip) then - Hide_Tooltip(); - Show_Tooltip(self.frame, self.expand.title, nil); + self.expand:Enable() + self.expand.expanded = true + self.expand:SetNormalTexture("Interface\\BUTTONS\\UI-MinusButton-Up.blp") + self.expand:SetPushedTexture("Interface\\BUTTONS\\UI-MinusButton-Down.blp") + self.expand.title = L["Collapse"] + self.expand:SetScript("OnClick", function() + self:Collapse(true) + end) + self.expand.func() + if reloadTooltip then + Hide_Tooltip() + Show_Tooltip(self.frame, self.expand.title, nil) end end, ["Collapse"] = function(self, reloadTooltip) - self.expand:Enable(); - self.expand.expanded = nil; - self.expand:SetNormalTexture("Interface\\BUTTONS\\UI-PlusButton-Up.blp"); - self.expand:SetPushedTexture("Interface\\BUTTONS\\UI-PlusButton-Down.blp"); - self.expand.title = L["Expand"]; - self.expand:SetScript("OnClick", function() self:Expand(true) end); - self.expand.func(); - if(reloadTooltip) then - Hide_Tooltip(); - Show_Tooltip(self.frame, self.expand.title, nil); + self.expand:Enable() + self.expand.expanded = nil + self.expand:SetNormalTexture("Interface\\BUTTONS\\UI-PlusButton-Up.blp") + self.expand:SetPushedTexture("Interface\\BUTTONS\\UI-PlusButton-Down.blp") + self.expand.title = L["Expand"] + self.expand:SetScript("OnClick", function() + self:Expand(true) + end) + self.expand.func() + if reloadTooltip then + Hide_Tooltip() + Show_Tooltip(self.frame, self.expand.title, nil) end end, ["SetOnExpandCollapse"] = function(self, func) - self.expand.func = func; + self.expand.func = func end, ["GetExpanded"] = function(self) - return self.expand.expanded; + return self.expand.expanded end, ["DisableExpand"] = function(self) - self.expand:Disable(); - self.expand.disabled = true; - self.expand.expanded = false; - self.expand:SetNormalTexture("Interface\\BUTTONS\\UI-PlusButton-Disabled.blp"); + self.expand:Disable() + self.expand.disabled = true + self.expand.expanded = false + self.expand:SetNormalTexture("Interface\\BUTTONS\\UI-PlusButton-Disabled.blp") end, ["EnableExpand"] = function(self) - self.expand.disabled = false; - if(self:GetExpanded()) then - self:Expand(); + self.expand.disabled = false + if self:GetExpanded() then + self:Expand() else - self:Collapse(); + self:Collapse() end end, ["SetExpandVisible"] = function(self, value) - if(value) then - self.expand:Show(); + if value then + self.expand:Show() else - self.expand:Hide(); + self.expand:Hide() end end, ["SetLevel"] = function(self, level) - self.checkbox:SetPoint("left", self.frame, "left", level * 16, 0); - end + self.checkbox:SetPoint("left", self.frame, "left", level * 16, 0) + end, } --[[----------------------------------------------------------------------------- @@ -123,56 +131,62 @@ Constructor -------------------------------------------------------------------------------]] local function Constructor() - local name = "WeakAurasImportButton"..AceGUI:GetNextWidgetNum(Type); - local button = CreateFrame("Button", name, UIParent, "OptionsListButtonTemplate"); - button:SetHeight(18); - button:SetWidth(380); - button.dgroup = nil; - - local background = button:CreateTexture(nil, "BACKGROUND"); - button.background = background; - background:SetTexture("Interface\\BUTTONS\\UI-Listbox-Highlight2.blp"); - background:SetBlendMode("ADD"); - background:SetVertexColor(0.5, 0.5, 0.5, 0.25); - background:SetAllPoints(button); - - local expand = CreateFrame("Button", nil, button); - button.expand = expand; - expand.expanded = true; - expand.disabled = true; - expand.func = function() end; - expand:SetNormalTexture("Interface\\BUTTONS\\UI-PlusButton-Disabled.blp"); - expand:Disable(); - expand:SetWidth(16); - expand:SetHeight(16); - expand:SetPoint("BOTTOM", button, "BOTTOM"); - expand:SetPoint("LEFT", button, "LEFT"); - expand:SetHighlightTexture("Interface\\BUTTONS\\UI-Panel-MinimizeButton-Highlight.blp"); - expand.title = L["Disabled"]; - expand:SetScript("OnEnter", function() Show_Tooltip(button, expand.title, nil) end); - expand:SetScript("OnLeave", Hide_Tooltip); - - local checkbox = CreateFrame("CheckButton", nil, button, "ChatConfigCheckButtonTemplate"); - button.checkbox = checkbox; - checkbox:EnableMouse(false); - checkbox:SetWidth(18); - checkbox:SetHeight(18); - checkbox:SetPoint("BOTTOM", button, "BOTTOM"); - checkbox:SetPoint("LEFT", button, "LEFT", 16); - - local title = button:CreateFontString(nil, "OVERLAY", "GameFontNormalLarge"); - button.title = title; - title:SetHeight(14); - title:SetJustifyH("LEFT"); - title:SetPoint("LEFT", checkbox, "RIGHT", 2, 0); - title:SetPoint("RIGHT", button, "RIGHT"); - - button.description = ""; - - button:SetScript("OnEnter", function() Show_Tooltip(button, title:GetText(), button.description) end); - button:SetScript("OnLeave", Hide_Tooltip); - - button:SetScript("OnClick", function() checkbox:Click() end); + local name = "WeakAurasImportButton" .. AceGUI:GetNextWidgetNum(Type) + local button = CreateFrame("Button", name, UIParent, "OptionsListButtonTemplate") + button:SetHeight(18) + button:SetWidth(380) + button.dgroup = nil + + local background = button:CreateTexture(nil, "BACKGROUND") + button.background = background + background:SetTexture("Interface\\BUTTONS\\UI-Listbox-Highlight2.blp") + background:SetBlendMode("ADD") + background:SetVertexColor(0.5, 0.5, 0.5, 0.25) + background:SetAllPoints(button) + + local expand = CreateFrame("Button", nil, button) + button.expand = expand + expand.expanded = true + expand.disabled = true + expand.func = function() end + expand:SetNormalTexture("Interface\\BUTTONS\\UI-PlusButton-Disabled.blp") + expand:Disable() + expand:SetWidth(16) + expand:SetHeight(16) + expand:SetPoint("BOTTOM", button, "BOTTOM") + expand:SetPoint("LEFT", button, "LEFT") + expand:SetHighlightTexture("Interface\\BUTTONS\\UI-Panel-MinimizeButton-Highlight.blp") + expand.title = L["Disabled"] + expand:SetScript("OnEnter", function() + Show_Tooltip(button, expand.title, nil) + end) + expand:SetScript("OnLeave", Hide_Tooltip) + + local checkbox = CreateFrame("CheckButton", nil, button, "ChatConfigCheckButtonTemplate") + button.checkbox = checkbox + checkbox:EnableMouse(false) + checkbox:SetWidth(18) + checkbox:SetHeight(18) + checkbox:SetPoint("BOTTOM", button, "BOTTOM") + checkbox:SetPoint("LEFT", button, "LEFT", 16) + + local title = button:CreateFontString(nil, "OVERLAY", "GameFontNormalLarge") + button.title = title + title:SetHeight(14) + title:SetJustifyH("LEFT") + title:SetPoint("LEFT", checkbox, "RIGHT", 2, 0) + title:SetPoint("RIGHT", button, "RIGHT") + + button.description = "" + + button:SetScript("OnEnter", function() + Show_Tooltip(button, title:GetText(), button.description) + end) + button:SetScript("OnLeave", Hide_Tooltip) + + button:SetScript("OnClick", function() + checkbox:Click() + end) local widget = { frame = button, @@ -180,7 +194,7 @@ local function Constructor() checkbox = checkbox, expand = expand, background = background, - type = Type + type = Type, } for method, func in pairs(methods) do widget[method] = func diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasLoadedHeaderButton.lua b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasLoadedHeaderButton.lua index f2be183f6b..ac4cdaeb60 100644 --- a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasLoadedHeaderButton.lua +++ b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasLoadedHeaderButton.lua @@ -1,22 +1,26 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local Type, Version = "WeakAurasLoadedHeaderButton", 21 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) -if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end +if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then + return +end local L = WeakAuras.L local function Hide_Tooltip() - GameTooltip:Hide(); + GameTooltip:Hide() end local function Show_Tooltip(owner, line1, line2) - GameTooltip:SetOwner(owner, "ANCHOR_NONE"); - GameTooltip:SetPoint("LEFT", owner, "RIGHT"); - GameTooltip:ClearLines(); - GameTooltip:AddLine(line1); - GameTooltip:AddLine(line2, 1, 1, 1, 1); - GameTooltip:Show(); + GameTooltip:SetOwner(owner, "ANCHOR_NONE") + GameTooltip:SetPoint("LEFT", owner, "RIGHT") + GameTooltip:ClearLines() + GameTooltip:AddLine(line1) + GameTooltip:AddLine(line2, 1, 1, 1, 1) + GameTooltip:Show() end --[[----------------------------------------------------------------------------- @@ -24,115 +28,119 @@ Methods -------------------------------------------------------------------------------]] local methods = { ["OnAcquire"] = function(self) - self:SetWidth(1000); - self:SetHeight(20); + self:SetWidth(1000) + self:SetHeight(20) end, ["SetText"] = function(self, text) - self.frame:SetText(" "..text); + self.frame:SetText(" " .. text) end, ["SetClick"] = function(self, func) - self.frame:SetScript("OnClick", func); + self.frame:SetScript("OnClick", func) end, ["Disable"] = function(self) - self.frame:Disable(); + self.frame:Disable() end, ["Enable"] = function(self) - self.frame:Enable(); + self.frame:Enable() end, ["Pick"] = function(self) - self.frame:LockHighlight(); + self.frame:LockHighlight() end, ["ClearPick"] = function(self) - self.frame:UnlockHighlight(); + self.frame:UnlockHighlight() end, ["Expand"] = function(self, reloadTooltip) - self.expand:Enable(); - self.expanded = true; - self.expand:SetNormalTexture("Interface\\BUTTONS\\UI-MinusButton-Up.blp"); - self.expand:SetPushedTexture("Interface\\BUTTONS\\UI-MinusButton-Down.blp"); - self.expand.title = L["Collapse"]; - self.expand.desc = self.expand.collapsedesc; - self.expand:SetScript("OnClick", function() self:Collapse(true) end); - self.expand.func(); - if(reloadTooltip) then - Hide_Tooltip(); - Show_Tooltip(self.frame, self.expand.title, self.expand.desc); + self.expand:Enable() + self.expanded = true + self.expand:SetNormalTexture("Interface\\BUTTONS\\UI-MinusButton-Up.blp") + self.expand:SetPushedTexture("Interface\\BUTTONS\\UI-MinusButton-Down.blp") + self.expand.title = L["Collapse"] + self.expand.desc = self.expand.collapsedesc + self.expand:SetScript("OnClick", function() + self:Collapse(true) + end) + self.expand.func() + if reloadTooltip then + Hide_Tooltip() + Show_Tooltip(self.frame, self.expand.title, self.expand.desc) end end, ["Collapse"] = function(self, reloadTooltip) - self.expand:Enable(); - self.expanded = false; - self.expand:SetNormalTexture("Interface\\BUTTONS\\UI-PlusButton-Up.blp"); - self.expand:SetPushedTexture("Interface\\BUTTONS\\UI-PlusButton-Down.blp"); - self.expand.title = L["Expand"]; - self.expand.desc = self.expand.expanddesc; - self.expand:SetScript("OnClick", function() self:Expand(true) end); - self.expand.func(); - if(reloadTooltip) then - Hide_Tooltip(); - Show_Tooltip(self.frame, self.expand.title, self.expand.desc); + self.expand:Enable() + self.expanded = false + self.expand:SetNormalTexture("Interface\\BUTTONS\\UI-PlusButton-Up.blp") + self.expand:SetPushedTexture("Interface\\BUTTONS\\UI-PlusButton-Down.blp") + self.expand.title = L["Expand"] + self.expand.desc = self.expand.expanddesc + self.expand:SetScript("OnClick", function() + self:Expand(true) + end) + self.expand.func() + if reloadTooltip then + Hide_Tooltip() + Show_Tooltip(self.frame, self.expand.title, self.expand.desc) end end, ["SetOnExpandCollapse"] = function(self, func) - self.expand.func = func; + self.expand.func = func end, ["GetExpanded"] = function(self) - return self.expanded; + return self.expanded end, ["DisableExpand"] = function(self) - self.expand:Disable(); - self.expand.disabled = true; - self.expand.expanded = false; - self.expand:SetNormalTexture("Interface\\BUTTONS\\UI-PlusButton-Disabled.blp"); + self.expand:Disable() + self.expand.disabled = true + self.expand.expanded = false + self.expand:SetNormalTexture("Interface\\BUTTONS\\UI-PlusButton-Disabled.blp") end, ["EnableExpand"] = function(self) - self.expand.disabled = false; - if(self:GetExpanded()) then - self:Expand(); + self.expand.disabled = false + if self:GetExpanded() then + self:Expand() else - self:Collapse(); + self:Collapse() end end, ["SetViewClick"] = function(self, func) - self.view:SetScript("OnClick", func); + self.view:SetScript("OnClick", func) end, ["PriorityShow"] = function(self, priority) - if (not WeakAuras.IsOptionsOpen()) then - return; + if not WeakAuras.IsOptionsOpen() then + return end - if(priority >= self.view.visibility and self.view.visibility ~= priority) then - self.view.visibility = priority; + if priority >= self.view.visibility and self.view.visibility ~= priority then + self.view.visibility = priority self:UpdateViewTexture() end end, ["PriorityHide"] = function(self, priority) - if (not WeakAuras.IsOptionsOpen()) then - return; + if not WeakAuras.IsOptionsOpen() then + return end - if(priority >= self.view.visibility and self.view.visibility ~= 0) then - self.view.visibility = 0; + if priority >= self.view.visibility and self.view.visibility ~= 0 then + self.view.visibility = 0 self:UpdateViewTexture() end end, ["UpdateViewTexture"] = function(self) local visibility = self.view.visibility - if(visibility == 2) then - self.view.texture:SetTexture("Interface\\LFGFrame\\BattlenetWorking0.blp"); - elseif(visibility == 1) then - self.view.texture:SetTexture("Interface\\LFGFrame\\BattlenetWorking2.blp"); + if visibility == 2 then + self.view.texture:SetTexture("Interface\\LFGFrame\\BattlenetWorking0.blp") + elseif visibility == 1 then + self.view.texture:SetTexture("Interface\\LFGFrame\\BattlenetWorking2.blp") else - self.view.texture:SetTexture("Interface\\LFGFrame\\BattlenetWorking4.blp"); + self.view.texture:SetTexture("Interface\\LFGFrame\\BattlenetWorking4.blp") end end, ["SetViewDescription"] = function(self, desc) - self.view.desc = desc; + self.view.desc = desc end, ["SetExpandDescription"] = function(self, desc) - self.expand.expanddesc = desc; + self.expand.expanddesc = desc end, ["SetCollapseDescription"] = function(self, desc) - self.expand.collapsedesc = desc; - self.expand.desc = desc; + self.expand.collapsedesc = desc + self.expand.desc = desc end, } @@ -141,59 +149,63 @@ Constructor -------------------------------------------------------------------------------]] local function Constructor() - local name = Type..AceGUI:GetNextWidgetNum(Type) - local button = CreateFrame("Button", name, UIParent, "OptionsListButtonTemplate"); - button:SetHeight(20); - button:SetWidth(1000); - button:SetDisabledFontObject("GameFontNormal"); + local name = Type .. AceGUI:GetNextWidgetNum(Type) + local button = CreateFrame("Button", name, UIParent, "OptionsListButtonTemplate") + button:SetHeight(20) + button:SetWidth(1000) + button:SetDisabledFontObject("GameFontNormal") - local background = button:CreateTexture(nil, "BACKGROUND"); - button.background = background; - background:SetTexture("Interface\\BUTTONS\\UI-Listbox-Highlight2.blp"); - background:SetBlendMode("ADD"); - background:SetVertexColor(0.5, 0.5, 0.5, 0.25); - background:SetAllPoints(button); + local background = button:CreateTexture(nil, "BACKGROUND") + button.background = background + background:SetTexture("Interface\\BUTTONS\\UI-Listbox-Highlight2.blp") + background:SetBlendMode("ADD") + background:SetVertexColor(0.5, 0.5, 0.5, 0.25) + background:SetAllPoints(button) - local expand = CreateFrame("Button", nil, button); - button.expand = expand; - expand.expanded = true; - expand.disabled = true; - expand.func = function() end; - expand:SetNormalTexture("Interface\\BUTTONS\\UI-PlusButton-Disabled.blp"); - expand:Disable(); - expand:SetWidth(16); - expand:SetHeight(16); - expand:SetPoint("RIGHT", button, "RIGHT"); - expand:SetHighlightTexture("Interface\\BUTTONS\\UI-Panel-MinimizeButton-Highlight.blp"); - expand.title = L["Disabled"]; - expand.desc = L["Expansion is disabled because this group has no children"]; - expand.expanddesc = ""; - expand.collapsedesc = ""; - expand:SetScript("OnEnter", function() Show_Tooltip(button, expand.title, expand.desc) end); - expand:SetScript("OnLeave", Hide_Tooltip); + local expand = CreateFrame("Button", nil, button) + button.expand = expand + expand.expanded = true + expand.disabled = true + expand.func = function() end + expand:SetNormalTexture("Interface\\BUTTONS\\UI-PlusButton-Disabled.blp") + expand:Disable() + expand:SetWidth(16) + expand:SetHeight(16) + expand:SetPoint("RIGHT", button, "RIGHT") + expand:SetHighlightTexture("Interface\\BUTTONS\\UI-Panel-MinimizeButton-Highlight.blp") + expand.title = L["Disabled"] + expand.desc = L["Expansion is disabled because this group has no children"] + expand.expanddesc = "" + expand.collapsedesc = "" + expand:SetScript("OnEnter", function() + Show_Tooltip(button, expand.title, expand.desc) + end) + expand:SetScript("OnLeave", Hide_Tooltip) - local view = CreateFrame("Button", nil, button); - button.view = view; - view:SetWidth(16); - view:SetHeight(16); - view:SetPoint("RIGHT", button, "RIGHT", -16, 0); + local view = CreateFrame("Button", nil, button) + button.view = view + view:SetWidth(16) + view:SetHeight(16) + view:SetPoint("RIGHT", button, "RIGHT", -16, 0) local viewTexture = view:CreateTexture() - view.texture = viewTexture; - viewTexture:SetTexture("Interface\\LFGFrame\\BattlenetWorking1.blp"); - viewTexture:SetTexCoord(0.1, 0.9, 0.1, 0.9); - viewTexture:SetAllPoints(view); - view:SetNormalTexture(viewTexture); - view:SetHighlightTexture("Interface\\BUTTONS\\UI-Panel-MinimizeButton-Highlight.blp"); - view.desc = ""; - view:SetScript("OnEnter", function() Show_Tooltip(button, L["View"], view.desc) end); - view:SetScript("OnLeave", Hide_Tooltip); - view.visibility = 0; + view.texture = viewTexture + viewTexture:SetTexture("Interface\\LFGFrame\\BattlenetWorking1.blp") + viewTexture:SetTexCoord(0.1, 0.9, 0.1, 0.9) + viewTexture:SetAllPoints(view) + view:SetNormalTexture(viewTexture) + view:SetHighlightTexture("Interface\\BUTTONS\\UI-Panel-MinimizeButton-Highlight.blp") + view.desc = "" + view:SetScript("OnEnter", function() + Show_Tooltip(button, L["View"], view.desc) + end) + view:SetScript("OnLeave", Hide_Tooltip) + view.visibility = 0 local widget = { frame = button, expand = expand, view = view, - type = Type + type = Type, } for method, func in pairs(methods) do widget[method] = func diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasMultiLineEditBox.lua b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasMultiLineEditBox.lua index abfcd67b5e..7ae72743ea 100644 --- a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasMultiLineEditBox.lua +++ b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasMultiLineEditBox.lua @@ -1,8 +1,12 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local Type, Version = "WeakAurasMultiLineEditBox", 36 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) -if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end +if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then + return +end -- Lua APIs local pairs = pairs @@ -18,7 +22,9 @@ Support functions if not AceGUIWeakAurasMultiLineEditBoxInsertLink then -- upgradeable hook - hooksecurefunc("ChatEdit_InsertLink", function(...) return _G.AceGUIWeakAurasMultiLineEditBoxInsertLink(...) end) + hooksecurefunc("ChatEdit_InsertLink", function(...) + return _G.AceGUIWeakAurasMultiLineEditBoxInsertLink(...) + end) end function _G.AceGUIWeakAurasMultiLineEditBoxInsertLink(text) @@ -31,7 +37,6 @@ function _G.AceGUIWeakAurasMultiLineEditBoxInsertLink(text) end end - local function Layout(self) self:SetHeight(self.numlines * 14 + (self.disablebutton and 19 or 41) + self.labelHeight) @@ -53,7 +58,7 @@ end --[[----------------------------------------------------------------------------- Scripts -------------------------------------------------------------------------------]] -local function OnClick(self) -- Button +local function OnClick(self) -- Button self = self.obj self.editBox:ClearFocus() if not self:Fire("OnEnterPressed", IndentationLib.decode(self.editBox:GetText())) then @@ -61,7 +66,7 @@ local function OnClick(self) end end -local function OnCursorChanged(self, _, y, _, cursorHeight) -- EditBox +local function OnCursorChanged(self, _, y, _, cursorHeight) -- EditBox self, y = self.obj.scrollFrame, -y local offset = self:GetVerticalScroll() if y < offset then @@ -74,13 +79,13 @@ local function OnCursorChanged(self, _, y, _, cursorHeight) end end -local function OnEditFocusLost(self) -- EditBox +local function OnEditFocusLost(self) -- EditBox self:HighlightText(0, 0) self.obj:Fire("OnEditFocusLost") - self.obj.scrollFrame:EnableMouseWheel(false); + self.obj.scrollFrame:EnableMouseWheel(false) end -local function OnEnter(self) -- EditBox / ScrollFrame +local function OnEnter(self) -- EditBox / ScrollFrame self = self.obj if not self.entered then self.entered = true @@ -88,7 +93,7 @@ local function OnEnter(self) end end -local function OnLeave(self) -- EditBox / ScrollFrame +local function OnLeave(self) -- EditBox / ScrollFrame self = self.obj if self.entered then self.entered = nil @@ -96,13 +101,13 @@ local function OnLeave(self) end end -local function OnMouseUp(self) -- ScrollFrame +local function OnMouseUp(self) -- ScrollFrame self = self.obj.editBox self:SetFocus() self:SetCursorPosition(self:GetNumLetters()) end -local function OnReceiveDrag(self) -- EditBox / ScrollFrame +local function OnReceiveDrag(self) -- EditBox / ScrollFrame local type, id, info = GetCursorInfo() if type == "spell" then info = GetSpellInfo(id, info) @@ -120,64 +125,64 @@ local function OnReceiveDrag(self) self.button:Enable() end -local function OnSizeChanged(self, width, height) -- ScrollFrame +local function OnSizeChanged(self, width, height) -- ScrollFrame self.obj.editBox:SetWidth(width) end -local function OnTextChanged(self, userInput) -- EditBox +local function OnTextChanged(self, userInput) -- EditBox if userInput then self = self.obj self:Fire("OnTextChanged", IndentationLib.decode(self.editBox:GetText())) self.button:Enable() -end + end end -local function OnTextSet(self) -- EditBox +local function OnTextSet(self) -- EditBox self:HighlightText(0, 0) self:SetCursorPosition(self:GetNumLetters()) self:SetCursorPosition(0) self.obj.button:Disable() end -local function OnVerticalScroll(self, offset) -- ScrollFrame +local function OnVerticalScroll(self, offset) -- ScrollFrame local editBox = self.obj.editBox editBox:SetHitRectInsets(0, 0, offset, editBox:GetHeight() - offset - self:GetHeight()) end local function OnFrameShow(frame) - if (frame.focusOnShow) then + if frame.focusOnShow then frame.obj.editBox:SetFocus() - frame.focusOnShow = nil; + frame.focusOnShow = nil end - local self = frame.obj; - local option = self.userdata.option; - local numExtraButtons = 0; - if (option and option.arg and option.arg.extraFunctions) then - numExtraButtons = #option.arg.extraFunctions; + local self = frame.obj + local option = self.userdata.option + local numExtraButtons = 0 + if option and option.arg and option.arg.extraFunctions then + numExtraButtons = #option.arg.extraFunctions for index, data in ipairs(option.arg.extraFunctions) do - if (not self.extraButtons[index]) then + if not self.extraButtons[index] then local extraButton = CreateFrame("Button", ("%s%dExpandButton%d"):format(Type, self.widgetNum, index), frame, "UIPanelButtonTemplate") - extraButton:SetPoint("LEFT", self.extraButtons[index - 1], "RIGHT"); + extraButton:SetPoint("LEFT", self.extraButtons[index - 1], "RIGHT") extraButton:SetHeight(22) - extraButton:SetWidth(100); - self.extraButtons[index] = extraButton; + extraButton:SetWidth(100) + self.extraButtons[index] = extraButton end - local extraButton = self.extraButtons[index]; - extraButton:SetText(data.buttonLabel); - extraButton:SetScript("OnClick", data.func); - extraButton:Show(); + local extraButton = self.extraButtons[index] + extraButton:SetText(data.buttonLabel) + extraButton:SetScript("OnClick", data.func) + extraButton:Show() end end for i = numExtraButtons + 1, #self.extraButtons do - self.extraButtons[i]:Hide(); + self.extraButtons[i]:Hide() end end local function OnEditFocusGained(frame) AceGUI:SetFocus(frame.obj) frame.obj:Fire("OnEditFocusGained") - frame.obj.scrollFrame:EnableMouseWheel(true); + frame.obj.scrollFrame:EnableMouseWheel(true) end --[[----------------------------------------------------------------------------- @@ -245,7 +250,7 @@ local methods = { return IndentationLib.decode(self.editBox:GetText()) end, - ["SetMaxLetters"] = function (self, num) + ["SetMaxLetters"] = function(self, num) self.editBox:SetMaxLetters(num or 0) end, @@ -261,13 +266,13 @@ local methods = { ["ClearFocus"] = function(self) self.editBox:ClearFocus() - self.frame.focusOnShow = nil; + self.frame.focusOnShow = nil end, ["SetFocus"] = function(self) self.editBox:SetFocus() if not self.frame:IsShown() then - self.frame.focusOnShow = true; + self.frame.focusOnShow = true end end, @@ -289,15 +294,16 @@ Constructor -------------------------------------------------------------------------------]] local backdrop = { bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], - edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]], edgeSize = 16, - insets = { left = 4, right = 3, top = 4, bottom = 3 } + edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]], + edgeSize = 16, + insets = { left = 4, right = 3, top = 4, bottom = 3 }, } local function Constructor() local frame = CreateFrame("Frame", nil, UIParent) frame:Hide() - frame:SetScript("OnShow", OnFrameShow); + frame:SetScript("OnShow", OnFrameShow) local widgetNum = AceGUI:GetNextWidgetNum(Type) local label = frame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall") @@ -315,8 +321,8 @@ local function Constructor() button:SetScript("OnClick", OnClick) button:Disable() - local extraButtons = {}; - extraButtons[0] = button; + local extraButtons = {} + extraButtons[0] = button local scrollBG = CreateFrame("Frame", nil, frame, "BackdropTemplate") scrollBG:SetBackdrop(backdrop) @@ -324,7 +330,7 @@ local function Constructor() scrollBG:SetBackdropBorderColor(0.4, 0.4, 0.4) local scrollFrame = CreateFrame("ScrollFrame", ("%s%dScrollFrame"):format(Type, widgetNum), frame, "UIPanelScrollFrameTemplate") - scrollFrame:EnableMouseWheel(false); + scrollFrame:EnableMouseWheel(false) local scrollBar = _G[scrollFrame:GetName() .. "ScrollBar"] scrollBar:ClearAllPoints() @@ -362,22 +368,21 @@ local function Constructor() editBox:SetScript("OnTextSet", OnTextSet) editBox:SetScript("OnEditFocusGained", OnEditFocusGained) - scrollFrame:SetScrollChild(editBox) local widget = { - button = button, + button = button, extraButtons = extraButtons, - editBox = editBox, - frame = frame, - label = label, + editBox = editBox, + frame = frame, + label = label, labelHeight = 10, - numlines = 4, - scrollBar = scrollBar, - scrollBG = scrollBG, + numlines = 4, + scrollBar = scrollBar, + scrollBG = scrollBG, scrollFrame = scrollFrame, - type = Type, - widgetNum = widgetNum, + type = Type, + widgetNum = widgetNum, } for method, func in pairs(methods) do widget[method] = func diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasNewButton.lua b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasNewButton.lua index 3bc471e48f..9a03047356 100644 --- a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasNewButton.lua +++ b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasNewButton.lua @@ -1,20 +1,24 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local Type, Version = "WeakAurasNewButton", 25 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) -if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end +if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then + return +end local function Hide_Tooltip() - GameTooltip:Hide(); + GameTooltip:Hide() end local function Show_Tooltip(owner, line1, line2) - GameTooltip:SetOwner(owner, "ANCHOR_NONE"); - GameTooltip:SetPoint("LEFT", owner, "RIGHT"); - GameTooltip:ClearLines(); - GameTooltip:AddLine(line1); - GameTooltip:AddLine(line2, 1, 1, 1, 1); - GameTooltip:Show(); + GameTooltip:SetOwner(owner, "ANCHOR_NONE") + GameTooltip:SetPoint("LEFT", owner, "RIGHT") + GameTooltip:ClearLines() + GameTooltip:AddLine(line1) + GameTooltip:AddLine(line2, 1, 1, 1, 1) + GameTooltip:Show() end --[[----------------------------------------------------------------------------- @@ -22,36 +26,36 @@ Methods -------------------------------------------------------------------------------]] local methods = { ["OnAcquire"] = function(self) - self:SetWidth(570); - self:SetHeight(40); + self:SetWidth(570) + self:SetHeight(40) end, ["SetTitle"] = function(self, title) - self.title:SetText(title); + self.title:SetText(title) end, ["GetTitle"] = function(self) - return self.title:GetText(); + return self.title:GetText() end, ["SetDescription"] = function(self, desc) - self.frame.description = desc; - self.description:SetText(desc); + self.frame.description = desc + self.description:SetText(desc) end, ["SetClick"] = function(self, func) - self.frame:SetScript("OnClick", func); + self.frame:SetScript("OnClick", func) end, ["SetIcon"] = function(self, icon) - if(type(icon) == "string" or type(icon) == "number") then - self.icon:SetTexture(icon); - self.icon:Show(); - if(self.iconRegion and self.iconRegion.Hide) then - self.iconRegion:Hide(); + if type(icon) == "string" or type(icon) == "number" then + self.icon:SetTexture(icon) + self.icon:Show() + if self.iconRegion and self.iconRegion.Hide then + self.iconRegion:Hide() end self.iconRegion = nil else - self.iconRegion = icon; - icon:SetAllPoints(self.icon); - icon:SetParent(self.frame); + self.iconRegion = icon + icon:SetAllPoints(self.icon) + icon:SetParent(self.frame) icon:Show() - self.icon:Hide(); + self.icon:Hide() end end, ["SetThumbnail"] = function(self, regionType, data) @@ -75,13 +79,13 @@ local methods = { end, ["OnRelease"] = function(self) self:ReleaseThumbnail() - if(self.iconRegion and self.iconRegion.Hide) then - self.iconRegion:Hide(); + if self.iconRegion and self.iconRegion.Hide then + self.iconRegion:Hide() end self.iconRegion = nil - self.icon:Hide(); - self.frame:UnlockHighlight(); - end + self.icon:Hide() + self.frame:UnlockHighlight() + end, } --[[----------------------------------------------------------------------------- @@ -89,47 +93,47 @@ Constructor -------------------------------------------------------------------------------]] local function Constructor() - local name = "WeakAurasDisplayButton"..AceGUI:GetNextWidgetNum(Type); - local button = CreateFrame("Button", name, UIParent, "OptionsListButtonTemplate"); - button:SetHeight(40); - button:SetWidth(380); - button.dgroup = nil; - - local background = button:CreateTexture(nil, "BACKGROUND"); - button.background = background; - background:SetTexture("Interface\\BUTTONS\\UI-Listbox-Highlight2.blp"); - background:SetBlendMode("ADD"); - background:SetVertexColor(0.5, 0.5, 0.5, 0.25); - background:SetAllPoints(button); - - local icon = button:CreateTexture(nil, "OVERLAY"); - button.icon = icon; - icon:SetWidth(40); - icon:SetHeight(40); - icon:SetPoint("LEFT", button, "LEFT"); - - local title = button:CreateFontString(nil, "OVERLAY", "GameFontNormalLarge"); - button.title = title; - title:SetHeight(14); - title:SetJustifyH("LEFT"); - title:SetPoint("TOP", button, "TOP", 0, -5); - title:SetPoint("LEFT", icon, "RIGHT", 2, 0); - title:SetPoint("RIGHT", button, "RIGHT"); - - local description = button:CreateFontString(nil, "OVERLAY", "GameFontHighlight"); - button.description = description; - description:SetHeight(14); - description:SetJustifyH("LEFT"); - description:SetPoint("BOTTOM", button, "BOTTOM", 0, 2); - description:SetPoint("LEFT", icon, "RIGHT", 2, 0); - description:SetPoint("RIGHT", button, "RIGHT"); - - - button.description = ""; - - button:SetScript("OnEnter", function() Show_Tooltip(button, title:GetText(), button.description) end); - button:SetScript("OnLeave", Hide_Tooltip); - + local name = "WeakAurasDisplayButton" .. AceGUI:GetNextWidgetNum(Type) + local button = CreateFrame("Button", name, UIParent, "OptionsListButtonTemplate") + button:SetHeight(40) + button:SetWidth(380) + button.dgroup = nil + + local background = button:CreateTexture(nil, "BACKGROUND") + button.background = background + background:SetTexture("Interface\\BUTTONS\\UI-Listbox-Highlight2.blp") + background:SetBlendMode("ADD") + background:SetVertexColor(0.5, 0.5, 0.5, 0.25) + background:SetAllPoints(button) + + local icon = button:CreateTexture(nil, "OVERLAY") + button.icon = icon + icon:SetWidth(40) + icon:SetHeight(40) + icon:SetPoint("LEFT", button, "LEFT") + + local title = button:CreateFontString(nil, "OVERLAY", "GameFontNormalLarge") + button.title = title + title:SetHeight(14) + title:SetJustifyH("LEFT") + title:SetPoint("TOP", button, "TOP", 0, -5) + title:SetPoint("LEFT", icon, "RIGHT", 2, 0) + title:SetPoint("RIGHT", button, "RIGHT") + + local description = button:CreateFontString(nil, "OVERLAY", "GameFontHighlight") + button.description = description + description:SetHeight(14) + description:SetJustifyH("LEFT") + description:SetPoint("BOTTOM", button, "BOTTOM", 0, 2) + description:SetPoint("LEFT", icon, "RIGHT", 2, 0) + description:SetPoint("RIGHT", button, "RIGHT") + + button.description = "" + + button:SetScript("OnEnter", function() + Show_Tooltip(button, title:GetText(), button.description) + end) + button:SetScript("OnLeave", Hide_Tooltip) local widget = { frame = button, @@ -137,7 +141,7 @@ local function Constructor() icon = icon, description = description, background = background, - type = Type + type = Type, } for method, func in pairs(methods) do widget[method] = func diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasNewHeaderButton.lua b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasNewHeaderButton.lua index 543a8248e0..8915748e0e 100644 --- a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasNewHeaderButton.lua +++ b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasNewHeaderButton.lua @@ -1,22 +1,26 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local Type, Version = "WeakAurasNewHeaderButton", 21 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) -if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end +if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then + return +end -local L = WeakAuras.L; +local L = WeakAuras.L local function Hide_Tooltip() - GameTooltip:Hide(); + GameTooltip:Hide() end local function Show_Tooltip(owner, line1, line2) - GameTooltip:SetOwner(owner, "ANCHOR_NONE"); - GameTooltip:SetPoint("LEFT", owner, "RIGHT"); - GameTooltip:ClearLines(); - GameTooltip:AddLine(line1); - GameTooltip:AddLine(line2, 1, 1, 1, 1); - GameTooltip:Show(); + GameTooltip:SetOwner(owner, "ANCHOR_NONE") + GameTooltip:SetPoint("LEFT", owner, "RIGHT") + GameTooltip:ClearLines() + GameTooltip:AddLine(line1) + GameTooltip:AddLine(line2, 1, 1, 1, 1) + GameTooltip:Show() end --[[----------------------------------------------------------------------------- @@ -24,30 +28,30 @@ Methods -------------------------------------------------------------------------------]] local methods = { ["OnAcquire"] = function(self) - self:SetWidth(1000); - self:SetHeight(20); + self:SetWidth(1000) + self:SetHeight(20) end, ["SetText"] = function(self, text) - self.frame:SetText(" "..text); + self.frame:SetText(" " .. text) end, ["SetDescription"] = function(self, description) - self.frame.description = description; + self.frame.description = description end, ["SetClick"] = function(self, func) - self.frame:SetScript("OnClick", func); + self.frame:SetScript("OnClick", func) end, ["Disable"] = function(self) - self.frame:Disable(); + self.frame:Disable() end, ["Enable"] = function(self) - self.frame:Enable(); + self.frame:Enable() end, ["Pick"] = function(self) - self.frame:LockHighlight(); + self.frame:LockHighlight() end, ["ClearPick"] = function(self) - self.frame:UnlockHighlight(); - end + self.frame:UnlockHighlight() + end, } --[[----------------------------------------------------------------------------- @@ -55,25 +59,27 @@ Constructor -------------------------------------------------------------------------------]] local function Constructor() - local name = Type..AceGUI:GetNextWidgetNum(Type) - local button = CreateFrame("Button", name, UIParent, "OptionsListButtonTemplate"); - button:SetHeight(20); - button:SetWidth(1000); - button:SetDisabledFontObject("GameFontNormal"); + local name = Type .. AceGUI:GetNextWidgetNum(Type) + local button = CreateFrame("Button", name, UIParent, "OptionsListButtonTemplate") + button:SetHeight(20) + button:SetWidth(1000) + button:SetDisabledFontObject("GameFontNormal") - local background = button:CreateTexture(nil, "BACKGROUND"); - button.background = background; - background:SetTexture("Interface\\BUTTONS\\UI-Listbox-Highlight2.blp"); - background:SetBlendMode("ADD"); - background:SetVertexColor(0.5, 0.5, 0.5, 0.25); - background:SetAllPoints(button); + local background = button:CreateTexture(nil, "BACKGROUND") + button.background = background + background:SetTexture("Interface\\BUTTONS\\UI-Listbox-Highlight2.blp") + background:SetBlendMode("ADD") + background:SetVertexColor(0.5, 0.5, 0.5, 0.25) + background:SetAllPoints(button) - button:SetScript("OnEnter", function() Show_Tooltip(button, button:GetText():sub(2), button.description or L["Add a new display"]) end); - button:SetScript("OnLeave", Hide_Tooltip); + button:SetScript("OnEnter", function() + Show_Tooltip(button, button:GetText():sub(2), button.description or L["Add a new display"]) + end) + button:SetScript("OnLeave", Hide_Tooltip) local widget = { frame = button, - type = Type + type = Type, } for method, func in pairs(methods) do widget[method] = func diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasPendingInstallButton.lua b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasPendingInstallButton.lua index 6ab510c5d4..2cbe1d18ca 100644 --- a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasPendingInstallButton.lua +++ b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasPendingInstallButton.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... local pairs, next, type, unpack = pairs, next, type, unpack @@ -133,10 +135,10 @@ local methods = { end, ["SetIcon"] = function(self, icon) self.orgIcon = icon - if (type(icon) == "string" or type(icon) == "number") then + if type(icon) == "string" or type(icon) == "number" then self.icon:SetTexture(icon) self.icon:Show() - if (self.iconRegion and self.iconRegion.Hide) then + if self.iconRegion and self.iconRegion.Hide then self.iconRegion:Hide() end else @@ -190,8 +192,7 @@ local function Constructor() local update = CreateFrame("Button", nil, button) button.update = update update.disabled = true - update.func = function() - end + update.func = function() end update:SetNormalTexture([[Interface\AddOns\WeakAuras\Media\Textures\wagoupdate_refresh.tga]]) update:Disable() update:SetWidth(24) @@ -208,7 +209,7 @@ local function Constructor() updateLogo:SetSize(24, 24) updateLogo:SetPoint("CENTER", update) updateLogo:SetFrameStrata(update:GetFrameStrata()) - updateLogo:SetFrameLevel(update:GetFrameLevel()-1) + updateLogo:SetFrameLevel(update:GetFrameLevel() - 1) -- Animation On Hover local animGroup = update:CreateAnimationGroup() @@ -219,7 +220,7 @@ local function Constructor() animRotate:SetDuration(1) animRotate:SetSmoothing("OUT") animGroup:SetScript("OnFinished", function() - if (MouseIsOver(update)) then + if MouseIsOver(update) then animGroup:Play() end end) diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasPendingUpdateButton.lua b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasPendingUpdateButton.lua index ec8a3d442b..ece9ba050d 100644 --- a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasPendingUpdateButton.lua +++ b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasPendingUpdateButton.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... local L = WeakAuras.L @@ -16,27 +18,27 @@ local function Hide_Tooltip() end local function Show_Long_Tooltip(owner, description) - GameTooltip:SetOwner(owner, "ANCHOR_NONE"); - GameTooltip:SetPoint("LEFT", owner, "RIGHT"); - GameTooltip:ClearLines(); - local line = 1; - for i,v in pairs(description) do - if(type(v) == "string") then - if(line > 1) then - GameTooltip:AddLine(v, 1, 1, 1, 1); + GameTooltip:SetOwner(owner, "ANCHOR_NONE") + GameTooltip:SetPoint("LEFT", owner, "RIGHT") + GameTooltip:ClearLines() + local line = 1 + for i, v in pairs(description) do + if type(v) == "string" then + if line > 1 then + GameTooltip:AddLine(v, 1, 1, 1, 1) else - GameTooltip:AddLine(v); + GameTooltip:AddLine(v) end - elseif(type(v) == "table") then - if(i == 1) then - GameTooltip:AddDoubleLine(v[1], v[2]..(v[3] and (" |T"..v[3]..":12:12:0:0:64:64:4:60:4:60|t") or "")); + elseif type(v) == "table" then + if i == 1 then + GameTooltip:AddDoubleLine(v[1], v[2] .. (v[3] and (" |T" .. v[3] .. ":12:12:0:0:64:64:4:60:4:60|t") or "")) else - GameTooltip:AddDoubleLine(v[1], v[2]..(v[3] and (" |T"..v[3]..":12:12:0:0:64:64:4:60:4:60|t") or ""), 1, 1, 1, 1, 1, 1, 1, 1); + GameTooltip:AddDoubleLine(v[1], v[2] .. (v[3] and (" |T" .. v[3] .. ":12:12:0:0:64:64:4:60:4:60|t") or ""), 1, 1, 1, 1, 1, 1, 1, 1) end end - line = line + 1; + line = line + 1 end - GameTooltip:Show(); + GameTooltip:Show() end --[[----------------------------------------------------------------------------- @@ -86,32 +88,30 @@ local methods = { wipe(self.menu) for auraId in pairs(self.linkedAuras) do if not self.linkedChildren[auraId] then - tinsert(self.menu, - { - text = auraId, - notCheckable = true, - hasArrow = true, - menuList = { - { - text = L["Update"], - notCheckable = true, - func = function() - local auraData = WeakAuras.GetData(auraId) - if auraData then - WeakAuras.Import(self.companionData.encoded, auraData) - end + tinsert(self.menu, { + text = auraId, + notCheckable = true, + hasArrow = true, + menuList = { + { + text = L["Update"], + notCheckable = true, + func = function() + local auraData = WeakAuras.GetData(auraId) + if auraData then + WeakAuras.Import(self.companionData.encoded, auraData) end - }, - { - text = L["Ignore updates"], - notCheckable = true, - func = function() - StaticPopup_Show("WEAKAURAS_CONFIRM_IGNORE_UPDATES", "", "", auraId) - end - } - } - } - ) + end, + }, + { + text = L["Ignore updates"], + notCheckable = true, + func = function() + StaticPopup_Show("WEAKAURAS_CONFIRM_IGNORE_UPDATES", "", "", auraId) + end, + }, + }, + }) end end end, @@ -146,46 +146,46 @@ local methods = { self.data = nil end, ["SetNormalTooltip"] = function(self) - local data = self.data; - local namestable = {}; + local data = self.data + local namestable = {} - local hasDescription = data.desc and data.desc ~= ""; - local hasUrl = data.url and data.url ~= ""; - local hasVersion = (data.semver and data.semver ~= "") or (data.version and data.version ~= ""); + local hasDescription = data.desc and data.desc ~= "" + local hasUrl = data.url and data.url ~= "" + local hasVersion = (data.semver and data.semver ~= "") or (data.version and data.version ~= "") local hasVersionNote = self.companionData.versionNote and self.companionData.versionNote ~= "" - if(hasDescription or hasUrl or hasVersion or hasVersionNote) then + if hasDescription or hasUrl or hasVersion or hasVersionNote then tinsert(namestable, " ") end if hasVersionNote then - tinsert(namestable, "|cFFFFD100"..self.companionData.versionNote) + tinsert(namestable, "|cFFFFD100" .. self.companionData.versionNote) tinsert(namestable, " ") end for auraId in pairs(self.linkedAuras) do if not self.linkedChildren[auraId] then - tinsert(namestable, "|cFFFFD100" .. L["Linked aura: "] .. auraId .. "|r") + tinsert(namestable, "|cFFFFD100" .. L["Linked aura: "] .. auraId .. "|r") end end tinsert(namestable, " ") - if(hasDescription) then - tinsert(namestable, "|cFFFFD100"..data.desc) + if hasDescription then + tinsert(namestable, "|cFFFFD100" .. data.desc) end - if (hasUrl) then + if hasUrl then tinsert(namestable, "|cFFFFD100" .. data.url .. "|r") end - if (hasVersion) then - tinsert(namestable, "|cFFFFD100" .. L["Version: "] .. (data.semver or data.version) .. "|r") + if hasVersion then + tinsert(namestable, "|cFFFFD100" .. L["Version: "] .. (data.semver or data.version) .. "|r") end - self:SetDescription({self.companionData.name or self.data.id, self.companionData.author or ""}, unpack(namestable)) + self:SetDescription({ self.companionData.name or self.data.id, self.companionData.author or "" }, unpack(namestable)) end, ["SetDescription"] = function(self, ...) - self.frame.description = {...}; + self.frame.description = { ... } end, ["SetTitle"] = function(self, title) self.titletext = title @@ -263,10 +263,10 @@ local methods = { end, ["SetIcon"] = function(self, icon) self.orgIcon = icon - if (type(icon) == "string" or type(icon) == "number") then + if type(icon) == "string" or type(icon) == "number" then self.icon:SetTexture(icon) self.icon:Show() - if (self.iconRegion and self.iconRegion.Hide) then + if self.iconRegion and self.iconRegion.Hide then self.iconRegion:Hide() end else @@ -320,8 +320,7 @@ local function Constructor() local update = CreateFrame("Button", nil, button) button.update = update update.disabled = true - update.func = function() - end + update.func = function() end update:SetNormalTexture([[Interface\AddOns\WeakAuras\Media\Textures\wagoupdate_refresh.tga]]) update:Disable() update:SetWidth(24) @@ -338,7 +337,7 @@ local function Constructor() updateLogo:SetSize(24, 24) updateLogo:SetPoint("CENTER", update) updateLogo:SetFrameStrata(update:GetFrameStrata()) - updateLogo:SetFrameLevel(update:GetFrameLevel()-1) + updateLogo:SetFrameLevel(update:GetFrameLevel() - 1) -- Animation On Hover local animGroup = update:CreateAnimationGroup() @@ -349,7 +348,7 @@ local function Constructor() animRotate:SetDuration(1) animRotate:SetSmoothing("OUT") animGroup:SetScript("OnFinished", function() - if (MouseIsOver(update)) then + if MouseIsOver(update) then animGroup:Play() end end) diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasSnippetButton.lua b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasSnippetButton.lua index 1637c3737f..f7b963c253 100644 --- a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasSnippetButton.lua +++ b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasSnippetButton.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end --[[----------------------------------------------------------------------------- SnippetButton Widget, based on AceGUI Button (and WA ToolbarButton) Graphical Button. @@ -119,7 +121,7 @@ local methods = { self.renameEditBox:HighlightText() self.renameEditBox:SetFocus() end - end + end, } --[[----------------------------------------------------------------------------- @@ -196,26 +198,20 @@ local function Constructor() renameEditBox:SetPoint("BOTTOMRIGHT", title, "BOTTOMRIGHT") renameEditBox:Disable() renameEditBox:Hide() - renameEditBox:SetScript( - "OnEscapePressed", - function(self) - self:ClearFocus() - AceGUI:ClearFocus() - self:Disable() - self:Hide() - title:Show() - end - ) - renameEditBox:SetScript( - "OnEditFocusLost", - function(self) - self:ClearFocus() - AceGUI:ClearFocus() - self:Disable() - self:Hide() - title:Show() - end - ) + renameEditBox:SetScript("OnEscapePressed", function(self) + self:ClearFocus() + AceGUI:ClearFocus() + self:Disable() + self:Hide() + title:Show() + end) + renameEditBox:SetScript("OnEditFocusLost", function(self) + self:ClearFocus() + AceGUI:ClearFocus() + self:Disable() + self:Hide() + title:Show() + end) renameEditBox:SetScript("OnEnterPressed", rename_complete) button.renameEditBox = renameEditBox @@ -226,7 +222,7 @@ local function Constructor() htex = htex, ptex = ptex, deleteButton = deleteButton, - renameEditBox = renameEditBox + renameEditBox = renameEditBox, } for method, func in pairs(methods) do widget[method] = func diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasSortedDropDown.lua b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasSortedDropDown.lua index 3fad597e61..c174330247 100644 --- a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasSortedDropDown.lua +++ b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasSortedDropDown.lua @@ -1,42 +1,46 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local Type, Version = "WeakAurasSortedDropdown", 2 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) -if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end +if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then + return +end local function Constructor() - local DropDownConstructor = AceGUI.WidgetRegistry["Dropdown"]; - if (not DropDownConstructor) then - return nil; + local DropDownConstructor = AceGUI.WidgetRegistry["Dropdown"] + if not DropDownConstructor then + return nil end - local widget = DropDownConstructor(); - if (not widget) then - return nil; + local widget = DropDownConstructor() + if not widget then + return nil end local oldSetList = widget.SetList widget.SetList = function(self, list, _, itemType) - local orderTable = {}; + local orderTable = {} for k, v in pairs(list) do - tinsert(orderTable, { key = k, value = v }); + tinsert(orderTable, { key = k, value = v }) end - local order = {}; + local order = {} table.sort(orderTable, function(a, b) - return a.value < b.value; - end); + return a.value < b.value + end) for i, item in ipairs(orderTable) do - order[i] = item.key; + order[i] = item.key end oldSetList(self, list, order, itemType) end - widget.type = Type; + widget.type = Type - return widget; + return widget end AceGUI:RegisterWidgetType(Type, Constructor, Version) diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasSpacer.lua b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasSpacer.lua index 769b2eb7fe..c41b829a92 100644 --- a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasSpacer.lua +++ b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasSpacer.lua @@ -1,32 +1,36 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end --[[----------------------------------------------------------------------------- Spacer Widget Just uses up a bit of horizontal space -------------------------------------------------------------------------------]] local Type, Version = "WeakAurasSpacer", 2 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) -if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end +if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then + return +end local methods = { - ["OnAcquire"] = function(self) - self:SetFullWidth(true) + ["OnAcquire"] = function(self) + self:SetFullWidth(true) self:SetHeight(4) - end, + end, } local function Constructor() - local frame = CreateFrame("Frame", nil, UIParent) - frame:Hide() + local frame = CreateFrame("Frame", nil, UIParent) + frame:Hide() - local widget = { - frame = frame, - type = Type - } - for method, func in pairs(methods) do - widget[method] = func - end + local widget = { + frame = frame, + type = Type, + } + for method, func in pairs(methods) do + widget[method] = func + end - return AceGUI:RegisterAsWidget(widget) + return AceGUI:RegisterAsWidget(widget) end AceGUI:RegisterWidgetType(Type, Constructor, Version) diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasTextureButton.lua b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasTextureButton.lua index de66316459..3a8b8cccbd 100644 --- a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasTextureButton.lua +++ b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasTextureButton.lua @@ -1,21 +1,25 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local Type, Version = "WeakAurasTextureButton", 24 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) -if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end +if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then + return +end local GetAtlasInfo = WeakAuras.IsClassic() and GetAtlasInfo or C_Texture.GetAtlasInfo local function Hide_Tooltip() - GameTooltip:Hide(); + GameTooltip:Hide() end local function Show_Tooltip(owner, line1, line2) - GameTooltip:SetOwner(owner, "ANCHOR_NONE"); - GameTooltip:SetPoint("BOTTOM", owner, "TOP"); - GameTooltip:ClearLines(); - GameTooltip:AddLine(line1); - GameTooltip:AddLine(line2, 1, 1, 1, 1); - GameTooltip:Show(); + GameTooltip:SetOwner(owner, "ANCHOR_NONE") + GameTooltip:SetPoint("BOTTOM", owner, "TOP") + GameTooltip:ClearLines() + GameTooltip:AddLine(line1) + GameTooltip:AddLine(line2, 1, 1, 1, 1) + GameTooltip:Show() end --[[----------------------------------------------------------------------------- @@ -23,67 +27,67 @@ Methods -------------------------------------------------------------------------------]] local methods = { ["OnAcquire"] = function(self) - self:SetWidth(128); - self:SetHeight(128); + self:SetWidth(128) + self:SetHeight(128) end, ["OnRelease"] = function(self) - self:ClearPick(); - self.texture:SetTexture(); + self:ClearPick() + self.texture:SetTexture() end, ["SetTexture"] = function(self, texturePath, name) - if (GetAtlasInfo(texturePath)) then - self.texture:SetAtlas(texturePath); + if GetAtlasInfo(texturePath) then + self.texture:SetAtlas(texturePath) else - self.texture:SetTexture(texturePath, "CLAMPTOBLACKADDITIVE", "CLAMPTOBLACKADDITIVE"); + self.texture:SetTexture(texturePath, "CLAMPTOBLACKADDITIVE", "CLAMPTOBLACKADDITIVE") end - self.texture.path = texturePath; - self.texture.name = name; + self.texture.path = texturePath + self.texture.name = name end, ["ChangeTexture"] = function(self, r, g, b, a, rotate, discrete_rotation, rotation, mirror, blendMode) - local ulx,uly , llx,lly , urx,ury , lrx,lry; - if(rotate) then - local angle = rad(135 - rotation); - local vx = math.cos(angle); - local vy = math.sin(angle); + local ulx, uly, llx, lly, urx, ury, lrx, lry + if rotate then + local angle = rad(135 - rotation) + local vx = math.cos(angle) + local vy = math.sin(angle) - ulx,uly , llx,lly , urx,ury , lrx,lry = 0.5+vx,0.5-vy , 0.5-vy,0.5-vx , 0.5+vy,0.5+vx , 0.5-vx,0.5+vy; + ulx, uly, llx, lly, urx, ury, lrx, lry = 0.5 + vx, 0.5 - vy, 0.5 - vy, 0.5 - vx, 0.5 + vy, 0.5 + vx, 0.5 - vx, 0.5 + vy else - if(discrete_rotation == 0 or discrete_rotation == 360) then - ulx,uly , llx,lly , urx,ury , lrx,lry = 0,0 , 0,1 , 1,0 , 1,1; - elseif(discrete_rotation == 90) then - ulx,uly , llx,lly , urx,ury , lrx,lry = 1,0 , 0,0 , 1,1 , 0,1; - elseif(discrete_rotation == 180) then - ulx,uly , llx,lly , urx,ury , lrx,lry = 1,1 , 1,0 , 0,1 , 0,0; - elseif(discrete_rotation == 270) then - ulx,uly , llx,lly , urx,ury , lrx,lry = 0,1 , 1,1 , 0,0 , 1,0; + if discrete_rotation == 0 or discrete_rotation == 360 then + ulx, uly, llx, lly, urx, ury, lrx, lry = 0, 0, 0, 1, 1, 0, 1, 1 + elseif discrete_rotation == 90 then + ulx, uly, llx, lly, urx, ury, lrx, lry = 1, 0, 0, 0, 1, 1, 0, 1 + elseif discrete_rotation == 180 then + ulx, uly, llx, lly, urx, ury, lrx, lry = 1, 1, 1, 0, 0, 1, 0, 0 + elseif discrete_rotation == 270 then + ulx, uly, llx, lly, urx, ury, lrx, lry = 0, 1, 1, 1, 0, 0, 1, 0 end end - if(mirror) then - self.texture:SetTexCoord(urx,ury , lrx,lry , ulx,uly , llx,lly); + if mirror then + self.texture:SetTexCoord(urx, ury, lrx, lry, ulx, uly, llx, lly) else - self.texture:SetTexCoord(ulx,uly , llx,lly , urx,ury , lrx,lry); + self.texture:SetTexCoord(ulx, uly, llx, lly, urx, ury, lrx, lry) end - self.texture:SetVertexColor(r, g, b, a); - self.texture:SetBlendMode(blendMode); + self.texture:SetVertexColor(r, g, b, a) + self.texture:SetBlendMode(blendMode) end, ["SetTexCoord"] = function(self, left, right, top, bottom) - self.texture:SetTexCoord(left, right, top, bottom); + self.texture:SetTexCoord(left, right, top, bottom) end, ["SetOnUpdate"] = function(self, func) - self.frame:SetScript("OnUpdate", func); + self.frame:SetScript("OnUpdate", func) end, ["GetTexturePath"] = function(self) - return self.texture.path; + return self.texture.path end, ["SetClick"] = function(self, func) - self.frame:SetScript("OnClick", func); + self.frame:SetScript("OnClick", func) end, ["Pick"] = function(self) - self.frame:LockHighlight(); + self.frame:LockHighlight() end, ["ClearPick"] = function(self) - self.frame:UnlockHighlight(); - end + self.frame:UnlockHighlight() + end, } --[[----------------------------------------------------------------------------- @@ -91,40 +95,44 @@ Constructor -------------------------------------------------------------------------------]] local function Constructor() - local name = "WeakAurasTextureButton"..AceGUI:GetNextWidgetNum(Type); - local button = CreateFrame("Button", name, UIParent, "OptionsListButtonTemplate"); + local name = "WeakAurasTextureButton" .. AceGUI:GetNextWidgetNum(Type) + local button = CreateFrame("Button", name, UIParent, "OptionsListButtonTemplate") if BackdropTemplateMixin then Mixin(button, BackdropTemplateMixin) end - button:SetHeight(128); - button:SetWidth(128); + button:SetHeight(128) + button:SetWidth(128) button:SetBackdrop({ bgFile = "Interface\\ChatFrame\\ChatFrameBackground", edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", - tile = true, tileSize = 16, edgeSize = 16, - insets = { left = 4, right = 4, top = 4, bottom = 4 } - }); - button:SetBackdropColor(0.1,0.1,0.1); - button:SetBackdropBorderColor(0.4,0.4,0.4); + tile = true, + tileSize = 16, + edgeSize = 16, + insets = { left = 4, right = 4, top = 4, bottom = 4 }, + }) + button:SetBackdropColor(0.1, 0.1, 0.1) + button:SetBackdropBorderColor(0.4, 0.4, 0.4) - local highlighttexture = button:CreateTexture(nil, "OVERLAY"); - highlighttexture:SetTexture("Interface\\BUTTONS\\ButtonHilight-SquareQuickslot.blp"); - highlighttexture:SetTexCoord(0.175, 0.875, 0.125, 0.825); - highlighttexture:SetPoint("BOTTOMLEFT", button, 4, 4); - highlighttexture:SetPoint("TOPRIGHT", button, -4, -4); - button:SetHighlightTexture(highlighttexture); + local highlighttexture = button:CreateTexture(nil, "OVERLAY") + highlighttexture:SetTexture("Interface\\BUTTONS\\ButtonHilight-SquareQuickslot.blp") + highlighttexture:SetTexCoord(0.175, 0.875, 0.125, 0.825) + highlighttexture:SetPoint("BOTTOMLEFT", button, 4, 4) + highlighttexture:SetPoint("TOPRIGHT", button, -4, -4) + button:SetHighlightTexture(highlighttexture) - local texture = button:CreateTexture(nil, "OVERLAY"); - texture:SetPoint("BOTTOMLEFT", button, 4, 4); - texture:SetPoint("TOPRIGHT", button, -4, -4); + local texture = button:CreateTexture(nil, "OVERLAY") + texture:SetPoint("BOTTOMLEFT", button, 4, 4) + texture:SetPoint("TOPRIGHT", button, -4, -4) - button:SetScript("OnEnter", function() Show_Tooltip(button, texture.name, texture.path:gsub("\\", "\n")) end); - button:SetScript("OnLeave", Hide_Tooltip); + button:SetScript("OnEnter", function() + Show_Tooltip(button, texture.name, texture.path:gsub("\\", "\n")) + end) + button:SetScript("OnLeave", Hide_Tooltip) local widget = { frame = button, texture = texture, - type = Type + type = Type, } for method, func in pairs(methods) do widget[method] = func diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasToolbarButton.lua b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasToolbarButton.lua index 8b30a57304..1f91db2dec 100644 --- a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasToolbarButton.lua +++ b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasToolbarButton.lua @@ -1,11 +1,15 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end --[[----------------------------------------------------------------------------- ToolbarButton Widget, based on AceGUI Button Graphical Button. -------------------------------------------------------------------------------]] local Type, Version = "WeakAurasToolbarButton", 5 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) -if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end +if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then + return +end -- Lua APIs local pairs = pairs @@ -18,130 +22,127 @@ local PlaySound, CreateFrame, UIParent = PlaySound, CreateFrame, UIParent Scripts -------------------------------------------------------------------------------]] local function Button_OnClick(frame, ...) - AceGUI:ClearFocus() - PlaySound(852) -- SOUNDKIT.IG_MAINMENU_OPTION - frame.obj:Fire("OnClick", ...) + AceGUI:ClearFocus() + PlaySound(852) -- SOUNDKIT.IG_MAINMENU_OPTION + frame.obj:Fire("OnClick", ...) end local function Control_OnEnter(frame) - frame.obj:Fire("OnEnter") + frame.obj:Fire("OnEnter") end local function Control_OnLeave(frame) - frame.obj:Fire("OnLeave") + frame.obj:Fire("OnLeave") end --[[----------------------------------------------------------------------------- Methods -------------------------------------------------------------------------------]] local methods = { - ["OnAcquire"] = function(self) - -- restore default values - self:SetHeight(16) - self:SetWidth(16) - self:SetDisabled(false) - self:SetText() - self.hTex:SetVertexColor(1, 1, 1, 0.1) - end, - - -- ["OnRelease"] = nil, - - ["SetText"] = function(self, text) - self.text:SetText(text) - if text ~= "" then - self:SetWidth(self.text:GetStringWidth() + 24) - else - self:SetWidth(16) - end - end, - - ["SetDisabled"] = function(self, disabled) - self.disabled = disabled - if disabled then - self.frame:Disable() - else - self.frame:Enable() - end - end, - - ["SetTexture"] = function(self, path) - self.icon:SetTexture(path) - end, - ["LockHighlight"] = function(self) - self.frame:LockHighlight() - end, - ["UnlockHighlight"] = function(self) - self.frame:UnlockHighlight() - end, - ["SetStrongHighlight"] = function(self, enable) - if enable then - self.hTex:SetVertexColor(1, 1, 1, 0.3) - else - self.hTex:SetVertexColor(1, 1, 1, 0.1) - end - end - + ["OnAcquire"] = function(self) + -- restore default values + self:SetHeight(16) + self:SetWidth(16) + self:SetDisabled(false) + self:SetText() + self.hTex:SetVertexColor(1, 1, 1, 0.1) + end, + + -- ["OnRelease"] = nil, + + ["SetText"] = function(self, text) + self.text:SetText(text) + if text ~= "" then + self:SetWidth(self.text:GetStringWidth() + 24) + else + self:SetWidth(16) + end + end, + + ["SetDisabled"] = function(self, disabled) + self.disabled = disabled + if disabled then + self.frame:Disable() + else + self.frame:Enable() + end + end, + + ["SetTexture"] = function(self, path) + self.icon:SetTexture(path) + end, + ["LockHighlight"] = function(self) + self.frame:LockHighlight() + end, + ["UnlockHighlight"] = function(self) + self.frame:UnlockHighlight() + end, + ["SetStrongHighlight"] = function(self, enable) + if enable then + self.hTex:SetVertexColor(1, 1, 1, 0.3) + else + self.hTex:SetVertexColor(1, 1, 1, 0.1) + end + end, } --[[----------------------------------------------------------------------------- Constructor -------------------------------------------------------------------------------]] local function Constructor() - local name = "AceGUI30Button" .. AceGUI:GetNextWidgetNum(Type) - local frame = CreateFrame("Button", name, UIParent) - frame:Hide() - - frame:EnableMouse(true) - frame:SetScript("OnClick", Button_OnClick) - frame:SetScript("OnEnter", Control_OnEnter) - frame:SetScript("OnLeave", Control_OnLeave) - - - local icon = frame:CreateTexture() - icon:SetTexture("aaa") - icon:SetPoint("TOPLEFT", frame, "TOPLEFT") - icon:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT") - icon:SetWidth(16) - - local text = frame:CreateFontString() - text:SetFontObject("GameFontNormal") - text:ClearAllPoints() - text:SetPoint("TOPLEFT", 20, -1) - text:SetPoint("BOTTOMRIGHT", -4, 1) - text:SetJustifyV("MIDDLE") - - --local nTex = frame:CreateTexture() - --nTex:SetTexture("Interface/Buttons/UI-Panel-Button-Up") - --nTex:SetTexCoord(0, 0.625, 0, 0.6875) - --nTex:SetAllPoints() - --frame:SetNormalTexture(nTex) - - local hTex = frame:CreateTexture() - hTex:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\Square_FullWhite") - hTex:SetVertexColor(1, 1, 1, 0.1) - - hTex:SetAllPoints() - frame:SetHighlightTexture(hTex) - - local pTex = frame:CreateTexture() - pTex:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\Square_FullWhite") - pTex:SetVertexColor(1, 1, 1, 0.2) - pTex:SetAllPoints() - frame:SetPushedTexture(pTex) - - - local widget = { - text = text, - icon = icon, - frame = frame, - type = Type, - hTex = hTex - } - for method, func in pairs(methods) do - widget[method] = func - end - - return AceGUI:RegisterAsWidget(widget) + local name = "AceGUI30Button" .. AceGUI:GetNextWidgetNum(Type) + local frame = CreateFrame("Button", name, UIParent) + frame:Hide() + + frame:EnableMouse(true) + frame:SetScript("OnClick", Button_OnClick) + frame:SetScript("OnEnter", Control_OnEnter) + frame:SetScript("OnLeave", Control_OnLeave) + + local icon = frame:CreateTexture() + icon:SetTexture("aaa") + icon:SetPoint("TOPLEFT", frame, "TOPLEFT") + icon:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT") + icon:SetWidth(16) + + local text = frame:CreateFontString() + text:SetFontObject("GameFontNormal") + text:ClearAllPoints() + text:SetPoint("TOPLEFT", 20, -1) + text:SetPoint("BOTTOMRIGHT", -4, 1) + text:SetJustifyV("MIDDLE") + + --local nTex = frame:CreateTexture() + --nTex:SetTexture("Interface/Buttons/UI-Panel-Button-Up") + --nTex:SetTexCoord(0, 0.625, 0, 0.6875) + --nTex:SetAllPoints() + --frame:SetNormalTexture(nTex) + + local hTex = frame:CreateTexture() + hTex:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\Square_FullWhite") + hTex:SetVertexColor(1, 1, 1, 0.1) + + hTex:SetAllPoints() + frame:SetHighlightTexture(hTex) + + local pTex = frame:CreateTexture() + pTex:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\Square_FullWhite") + pTex:SetVertexColor(1, 1, 1, 0.2) + pTex:SetAllPoints() + frame:SetPushedTexture(pTex) + + local widget = { + text = text, + icon = icon, + frame = frame, + type = Type, + hTex = hTex, + } + for method, func in pairs(methods) do + widget[method] = func + end + + return AceGUI:RegisterAsWidget(widget) end AceGUI:RegisterWidgetType(Type, Constructor, Version) diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasTwoColumnDropDown.lua b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasTwoColumnDropDown.lua index 61787bbc1c..e84420dc78 100644 --- a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasTwoColumnDropDown.lua +++ b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasTwoColumnDropDown.lua @@ -1,8 +1,12 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local Type, Version = "WeakAurasTwoColumnDropdown", 4 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) -if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end +if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then + return +end local function errorhandler(err) return geterrorhandler()(err) @@ -14,38 +18,37 @@ local function safecall(func, ...) end end -AceGUI:RegisterLayout("TwoColumn", - function(content, children) - local height = 0 - local width = content.width or content:GetWidth() or 0 - for i = 1, #children do - local child = children[i] - - local frame = child.frame - frame:ClearAllPoints() - if child.userdata.hideMe then - frame:Hide() - else - frame:Show() - end - if i == 1 then - frame:SetPoint("TOPLEFT", content) - else - frame:SetPoint("TOPLEFT", children[i-1].frame, "TOPRIGHT") - end +AceGUI:RegisterLayout("TwoColumn", function(content, children) + local height = 0 + local width = content.width or content:GetWidth() or 0 + for i = 1, #children do + local child = children[i] + + local frame = child.frame + frame:ClearAllPoints() + if child.userdata.hideMe then + frame:Hide() + else + frame:Show() + end + if i == 1 then + frame:SetPoint("TOPLEFT", content) + else + frame:SetPoint("TOPLEFT", children[i - 1].frame, "TOPRIGHT") + end - if child.width == "relative" then - child:SetWidth(width * child.relWidth) + if child.width == "relative" then + child:SetWidth(width * child.relWidth) - if child.DoLayout then - child:DoLayout() - end + if child.DoLayout then + child:DoLayout() end - - height = max(height, frame.height or frame:GetHeight() or 0) end - safecall(content.obj.LayoutFinished, content.obj, nil, height) - end) + + height = max(height, frame.height or frame:GetHeight() or 0) + end + safecall(content.obj.LayoutFinished, content.obj, nil, height) +end) local methods = { ["OnAcquire"] = function(widget) @@ -95,11 +98,11 @@ local methods = { widget.secondDropDown.userdata.hideMe = false widget:DoLayout() - if (oldValueIndex) then + if oldValueIndex then widget.secondDropDown:SetValue(oldValueIndex) local v = widget:GetValue() - if (v) then + if v then widget:Fire("OnValueChanged", v) end else @@ -108,7 +111,7 @@ local methods = { local index = tIndexOf(secondList, default) widget.secondDropDown:SetValue(index) local v = widget:GetValue() - if (v) then + if v then widget:Fire("OnValueChanged", v) end else @@ -146,8 +149,7 @@ local methods = { secondDropDown:SetCallback("OnEnter", FireOnEnter) secondDropDown:SetCallback("OnLeave", FireOnLeave) end, - ["OnRelease"] = function(self) - end, + ["OnRelease"] = function(self) end, ["SetLabel"] = function(self, ...) self.firstDropdown:SetLabel(...) end, @@ -161,12 +163,12 @@ local methods = { return elseif type(treeValue) == "table" then for displayName2, key in pairs(treeValue) do - if (key == value) then + if key == value then self.firstDropdown:SetRelativeWidth(0.5) self.secondDropDown:SetRelativeWidth(0.5) self.secondDropDown.userdata.hideMe = false self:DoLayout() - local index = tIndexOf(self.userdata.firstList, displayName); + local index = tIndexOf(self.userdata.firstList, displayName) self.firstDropdown:SetValue(index) self.firstDropdown:OnFirstDropdownValueChanged("", index) self.secondDropDown:SetValue(tIndexOf(self.userdata.secondList, displayName2)) @@ -222,7 +224,7 @@ local methods = { table.sort(firstList) self.userdata.firstList = firstList self.firstDropdown:SetList(firstList, order, itemType) - end + end, } local function Constructor() @@ -237,7 +239,7 @@ local function Constructor() local widget = { frame = frame, content = content, - type = Type + type = Type, } for method, func in pairs(methods) do widget[method] = func diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGuiWidget-WeakAurasProgressBar.lua b/WeakAurasOptions/AceGUI-Widgets/AceGuiWidget-WeakAurasProgressBar.lua index ff3d2a35ef..6d932cacc3 100644 --- a/WeakAurasOptions/AceGUI-Widgets/AceGuiWidget-WeakAurasProgressBar.lua +++ b/WeakAurasOptions/AceGUI-Widgets/AceGuiWidget-WeakAurasProgressBar.lua @@ -1,19 +1,23 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end --[[----------------------------------------------------------------------------- Progress Bar Widget A simple progress bar -------------------------------------------------------------------------------]] local Type, Version = "WeakAurasProgressBar", 2 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) -if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end +if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then + return +end local methods = { - ["OnAcquire"] = function(self) - self:SetFullWidth(true) + ["OnAcquire"] = function(self) + self:SetFullWidth(true) self:SetHeight(10) self.value = 0 self.total = 1 - end, + end, ["SetProgress"] = function(self, value, total) self.value = value self.total = total @@ -25,37 +29,37 @@ local methods = { end, ["OnWidthSet"] = function(self) self:SetProgress(self.value, self.total) - end + end, } local function Constructor() - local frame = CreateFrame("Frame", nil, UIParent) + local frame = CreateFrame("Frame", nil, UIParent) local foreground = frame:CreateTexture(nil, "ARTWORK") local background = frame:CreateTexture(nil, "ARTWORK") foreground:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\Square_White") background:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\Square_White") background:SetVertexColor(0.5, 0.5, 0.5) - foreground:SetDrawLayer("ARTWORK", 0); - background:SetDrawLayer("ARTWORK", -1); + foreground:SetDrawLayer("ARTWORK", 0) + background:SetDrawLayer("ARTWORK", -1) background:SetAllPoints() foreground:SetPoint("TOPLEFT") foreground:SetPoint("BOTTOMLEFT") foreground:SetPoint("RIGHT", background, "LEFT", 0, 0) - frame:Hide() + frame:Hide() - local widget = { - frame = frame, + local widget = { + frame = frame, foreground = foreground, background = background, - type = Type - } - for method, func in pairs(methods) do - widget[method] = func - end + type = Type, + } + for method, func in pairs(methods) do + widget[method] = func + end - return AceGUI:RegisterAsWidget(widget) + return AceGUI:RegisterAsWidget(widget) end AceGUI:RegisterWidgetType(Type, Constructor, Version) diff --git a/WeakAurasOptions/ActionOptions.lua b/WeakAurasOptions/ActionOptions.lua index 6eec7506e5..6d57fdc841 100644 --- a/WeakAurasOptions/ActionOptions.lua +++ b/WeakAurasOptions/ActionOptions.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... local L = WeakAuras.L @@ -29,46 +31,46 @@ function OptionsPrivate.GetActionOptions(data) name = L["Actions"], order = 50, get = function(info) - local split = info[#info]:find("_"); - if(split) then - local field, value = info[#info]:sub(1, split-1), info[#info]:sub(split+1); - if(data.actions and data.actions[field]) then - if (info.type == "color") then + local split = info[#info]:find("_") + if split then + local field, value = info[#info]:sub(1, split - 1), info[#info]:sub(split + 1) + if data.actions and data.actions[field] then + if info.type == "color" then if type(data.actions[field][value]) == "table" then local c = data.actions[field][value] - return c[1], c[2], c[3], c[4]; + return c[1], c[2], c[3], c[4] else return 1, 1, 1, 1 end else - return data.actions[field][value]; + return data.actions[field][value] end else - return nil; + return nil end end end, set = function(info, v, g, b, a) - local split = info[#info]:find("_"); - local field, value = info[#info]:sub(1, split-1), info[#info]:sub(split+1); - data.actions = data.actions or {}; - data.actions[field] = data.actions[field] or {}; - if (info.type == "color") then + local split = info[#info]:find("_") + local field, value = info[#info]:sub(1, split - 1), info[#info]:sub(split + 1) + data.actions = data.actions or {} + data.actions[field] = data.actions[field] or {} + if info.type == "color" then if not data.actions[field][value] or type(data.actions[field][value]) ~= "table" then data.actions[field][value] = {} end local c = data.actions[field][value] - c[1], c[2], c[3], c[4] = v, g, b, a; + c[1], c[2], c[3], c[4] = v, g, b, a else - data.actions[field][value] = v; + data.actions[field][value] = v end - if(value == "sound" or value == "sound_path") then - pcall(PlaySoundFile, v, "Master"); - elseif(value == "sound_kit_id") then - pcall(PlaySound, v, "Master"); + if value == "sound" or value == "sound_path" then + pcall(PlaySoundFile, v, "Master") + elseif value == "sound_kit_id" then + pcall(PlaySound, v, "Master") end - WeakAuras.Add(data); - if(value == "message") then + WeakAuras.Add(data) + if value == "message" then WeakAuras.ClearAndUpdateOptions(data.id) end end, @@ -76,25 +78,25 @@ function OptionsPrivate.GetActionOptions(data) init_header = { type = "header", name = L["On Init"], - order = 0.005 + order = 0.005, }, init_do_custom = { type = "toggle", name = L["Custom"], order = 0.011, - width = WeakAuras.doubleWidth + width = WeakAuras.doubleWidth, }, -- texteditor added here by AddCodeOption start_header = { type = "header", name = L["On Show"], - order = 0.5 + order = 0.5, }, start_do_message = { type = "toggle", width = WeakAuras.normalWidth, name = L["Chat Message"], - order = 1 + order = 1, }, start_message_type = { type = "select", @@ -102,26 +104,31 @@ function OptionsPrivate.GetActionOptions(data) name = L["Message Type"], order = 2, values = OptionsPrivate.Private.send_chat_message_types, - disabled = function() return not data.actions.start.do_message end, - control = "WeakAurasSortedDropdown" + disabled = function() + return not data.actions.start.do_message + end, + control = "WeakAurasSortedDropdown", }, start_message_warning = { type = "description", width = WeakAuras.doubleWidth, name = L["Note: Automated Messages to SAY and YELL are blocked outside of Instances."], order = 2.5, - hidden = function() return not RestrictedChannelCheck(data.actions.start) end + hidden = function() + return not RestrictedChannelCheck(data.actions.start) + end, }, start_message_space = { type = "execute", width = WeakAuras.normalWidth, name = "", order = 3, - image = function() return "", 0, 0 end, + image = function() + return "", 0, 0 + end, hidden = function() - return not(data.actions.start.message_type == "COMBAT" - or data.actions.start.message_type == "PRINT" or data.actions.start.message_type == "ERROR") - end + return not (data.actions.start.message_type == "COMBAT" or data.actions.start.message_type == "PRINT" or data.actions.start.message_type == "ERROR") + end, }, start_message_color = { type = "color", @@ -130,25 +137,29 @@ function OptionsPrivate.GetActionOptions(data) order = 3, hasAlpha = false, hidden = function() - return not(data.actions.start.message_type == "COMBAT" - or data.actions.start.message_type == "PRINT" - or data.actions.start.message_type == "ERROR") + return not (data.actions.start.message_type == "COMBAT" or data.actions.start.message_type == "PRINT" or data.actions.start.message_type == "ERROR") + end, + get = function() + return data.actions.start.r or 1, data.actions.start.g or 1, data.actions.start.b or 1 end, - get = function() return data.actions.start.r or 1, data.actions.start.g or 1, data.actions.start.b or 1 end, set = function(info, r, g, b) - data.actions.start.r = r; - data.actions.start.g = g; - data.actions.start.b = b; - WeakAuras.Add(data); - end + data.actions.start.r = r + data.actions.start.g = g + data.actions.start.b = b + WeakAuras.Add(data) + end, }, start_message_dest = { type = "input", width = WeakAuras.normalWidth, name = L["Send To"], order = 3.1, - disabled = function() return not data.actions.start.do_message end, - hidden = function() return data.actions.start.message_type ~= "WHISPER" end, + disabled = function() + return not data.actions.start.do_message + end, + hidden = function() + return data.actions.start.message_type ~= "WHISPER" + end, desc = function() return L["Dynamic text tooltip"] .. OptionsPrivate.Private.GetAdditionalProperties(data) end, @@ -160,24 +171,30 @@ function OptionsPrivate.GetActionOptions(data) order = 3.15, hidden = function() return data.actions.start.message_type ~= "WHISPER" - end + end, }, start_message_tts_voice = { type = "select", width = WeakAuras.doubleWidth, name = L["Voice"], order = 3.2, - disabled = function() return not data.actions.start.do_message end, - hidden = function() return (WeakAuras.IsClassic()) or data.actions.start.message_type ~= "TTS" end, + disabled = function() + return not data.actions.start.do_message + end, + hidden = function() + return (WeakAuras.IsClassic()) or data.actions.start.message_type ~= "TTS" + end, values = OptionsPrivate.Private.tts_voices, - desc = L["Available Voices are system specific"] + desc = L["Available Voices are system specific"], }, start_message = { type = "input", width = WeakAuras.doubleWidth, name = L["Message"], order = 4, - disabled = function() return not data.actions.start.do_message end, + disabled = function() + return not data.actions.start.do_message + end, desc = function() return L["Dynamic text tooltip"] .. OptionsPrivate.Private.GetAdditionalProperties(data) end, @@ -187,22 +204,28 @@ function OptionsPrivate.GetActionOptions(data) type = "toggle", width = WeakAuras.normalWidth, name = L["Play Sound"], - order = 8 + order = 8, }, start_do_loop = { type = "toggle", width = WeakAuras.normalWidth, name = L["Loop"], order = 8.1, - disabled = function() return not data.actions.start.do_sound end, + disabled = function() + return not data.actions.start.do_sound + end, }, start_sound_repeat = { type = "range", width = WeakAuras.normalWidth, name = L["Repeat After"], order = 8.2, - hidden = function() return not data.actions.start.do_loop end, - disabled = function() return not data.actions.start.do_sound end, + hidden = function() + return not data.actions.start.do_loop + end, + disabled = function() + return not data.actions.start.do_sound + end, min = 0, softMax = 100, }, @@ -211,7 +234,9 @@ function OptionsPrivate.GetActionOptions(data) width = WeakAuras.normalWidth, order = 8.3, name = "", - hidden = function() return not data.actions.start.do_loop end, + hidden = function() + return not data.actions.start.do_loop + end, }, start_sound = { type = "select", @@ -219,8 +244,10 @@ function OptionsPrivate.GetActionOptions(data) name = L["Sound"], order = 8.4, values = OptionsPrivate.Private.sound_types, - disabled = function() return not data.actions.start.do_sound end, - control = "WeakAurasSortedDropdown" + disabled = function() + return not data.actions.start.do_sound + end, + control = "WeakAurasSortedDropdown", }, start_sound_channel = { type = "select", @@ -228,30 +255,42 @@ function OptionsPrivate.GetActionOptions(data) name = L["Sound Channel"], order = 8.5, values = OptionsPrivate.Private.sound_channel_types, - disabled = function() return not data.actions.start.do_sound end, - get = function() return data.actions.start.sound_channel or "Master" end + disabled = function() + return not data.actions.start.do_sound + end, + get = function() + return data.actions.start.sound_channel or "Master" + end, }, start_sound_path = { type = "input", width = WeakAuras.doubleWidth, name = L["Sound File Path"], order = 9, - hidden = function() return data.actions.start.sound ~= " custom" end, - disabled = function() return not data.actions.start.do_sound end + hidden = function() + return data.actions.start.sound ~= " custom" + end, + disabled = function() + return not data.actions.start.do_sound + end, }, start_sound_kit_id = { type = "input", width = WeakAuras.doubleWidth, name = L["Sound Kit ID"], order = 9, - hidden = function() return data.actions.start.sound ~= " KitID" end, - disabled = function() return not data.actions.start.do_sound end + hidden = function() + return data.actions.start.sound ~= " KitID" + end, + disabled = function() + return not data.actions.start.do_sound + end, }, start_do_glow = { type = "toggle", width = WeakAuras.normalWidth, name = L["Glow External Element"], - order = 10.1 + order = 10.1, }, start_glow_action = { type = "select", @@ -259,29 +298,26 @@ function OptionsPrivate.GetActionOptions(data) name = L["Glow Action"], order = 10.2, values = OptionsPrivate.Private.glow_action_types, - disabled = function() return not data.actions.start.do_glow end + disabled = function() + return not data.actions.start.do_glow + end, }, start_glow_frame_type = { type = "select", width = WeakAuras.normalWidth, desc = function() - return ( - data.actions.start.glow_frame_type == "UNITFRAME" - or data.actions.start.glow_frame_type == "NAMEPLATE" - ) - and L["Require unit from trigger"] or nil + return (data.actions.start.glow_frame_type == "UNITFRAME" or data.actions.start.glow_frame_type == "NAMEPLATE") and L["Require unit from trigger"] or nil end, name = L["Glow Frame Type"], order = 10.3, values = { UNITFRAME = L["Unit Frame"], NAMEPLATE = L["Nameplate"], - FRAMESELECTOR = L["Frame Selector"] + FRAMESELECTOR = L["Frame Selector"], }, hidden = function() - return not data.actions.start.do_glow - or data.actions.start.glow_action == nil - end + return not data.actions.start.do_glow or data.actions.start.glow_action == nil + end, }, start_glow_type_spacer = { type = "description", @@ -289,8 +325,7 @@ function OptionsPrivate.GetActionOptions(data) name = "", order = 10.35, hidden = function() - return not data.actions.start.do_glow - or not (data.actions.start.glow_action == "hide" and data.actions.start.glow_frame_type == "FRAMESELECTOR") + return not data.actions.start.do_glow or not (data.actions.start.glow_action == "hide" and data.actions.start.glow_frame_type == "FRAMESELECTOR") end, }, start_glow_type = { @@ -300,9 +335,7 @@ function OptionsPrivate.GetActionOptions(data) order = 10.4, values = OptionsPrivate.Private.glow_types, hidden = function() - return not data.actions.start.do_glow - or data.actions.start.glow_action ~= "show" - or data.actions.start.glow_frame_type == nil + return not data.actions.start.do_glow or data.actions.start.glow_action ~= "show" or data.actions.start.glow_frame_type == nil end, }, start_glow_frame = { @@ -311,24 +344,25 @@ function OptionsPrivate.GetActionOptions(data) name = L["Frame"], order = 10.5, hidden = function() - return not data.actions.start.do_glow - or data.actions.start.glow_frame_type ~= "FRAMESELECTOR" - end + return not data.actions.start.do_glow or data.actions.start.glow_frame_type ~= "FRAMESELECTOR" + end, }, start_choose_glow_frame = { type = "execute", width = WeakAuras.normalWidth, name = L["Choose"], order = 10.55, - hidden = function() return not data.actions.start.do_glow or data.actions.start.glow_frame_type ~= "FRAMESELECTOR" end, + hidden = function() + return not data.actions.start.do_glow or data.actions.start.glow_frame_type ~= "FRAMESELECTOR" + end, func = function() - if(data.controlledChildren and data.controlledChildren[1]) then - WeakAuras.PickDisplay(data.controlledChildren[1]); - OptionsPrivate.StartFrameChooser(WeakAuras.GetData(data.controlledChildren[1]), {"actions", "start", "glow_frame"}); + if data.controlledChildren and data.controlledChildren[1] then + WeakAuras.PickDisplay(data.controlledChildren[1]) + OptionsPrivate.StartFrameChooser(WeakAuras.GetData(data.controlledChildren[1]), { "actions", "start", "glow_frame" }) else - OptionsPrivate.StartFrameChooser(data, {"actions", "start", "glow_frame"}); + OptionsPrivate.StartFrameChooser(data, { "actions", "start", "glow_frame" }) end - end + end, }, start_use_glow_color = { type = "toggle", @@ -336,10 +370,7 @@ function OptionsPrivate.GetActionOptions(data) name = L["Glow Color"], order = 10.7, hidden = function() - return not data.actions.start.do_glow - or data.actions.start.glow_action ~= "show" - or data.actions.start.glow_frame_type == nil - or data.actions.start.glow_type == nil + return not data.actions.start.do_glow or data.actions.start.glow_action ~= "show" or data.actions.start.glow_frame_type == nil or data.actions.start.glow_type == nil end, }, start_glow_color = { @@ -349,12 +380,11 @@ function OptionsPrivate.GetActionOptions(data) name = L["Glow Color"], order = 10.8, hidden = function() - return not data.actions.start.do_glow - or data.actions.start.glow_action ~= "show" - or data.actions.start.glow_frame_type == nil - or data.actions.start.glow_type == nil + return not data.actions.start.do_glow or data.actions.start.glow_action ~= "show" or data.actions.start.glow_frame_type == nil or data.actions.start.glow_type == nil + end, + disabled = function() + return not data.actions.start.use_glow_color end, - disabled = function() return not data.actions.start.use_glow_color end, }, start_glow_lines = { type = "range", @@ -369,10 +399,10 @@ function OptionsPrivate.GetActionOptions(data) end, hidden = function() return not data.actions.start.do_glow - or data.actions.start.glow_action ~= "show" - or not data.actions.start.glow_type - or data.actions.start.glow_type == "buttonOverlay" - or data.actions.start.glow_frame_type == nil + or data.actions.start.glow_action ~= "show" + or not data.actions.start.glow_type + or data.actions.start.glow_type == "buttonOverlay" + or data.actions.start.glow_frame_type == nil end, }, start_glow_frequency = { @@ -388,10 +418,10 @@ function OptionsPrivate.GetActionOptions(data) end, hidden = function() return not data.actions.start.do_glow - or data.actions.start.glow_action ~= "show" - or not data.actions.start.glow_type - or data.actions.start.glow_type == "buttonOverlay" - or data.actions.start.glow_frame_type == nil + or data.actions.start.glow_action ~= "show" + or not data.actions.start.glow_type + or data.actions.start.glow_type == "buttonOverlay" + or data.actions.start.glow_frame_type == nil end, }, start_glow_length = { @@ -406,10 +436,7 @@ function OptionsPrivate.GetActionOptions(data) return data.actions.start.glow_length or 10 end, hidden = function() - return not data.actions.start.do_glow - or data.actions.start.glow_action ~= "show" - or data.actions.start.glow_type ~= "Pixel" - or data.actions.start.glow_frame_type == nil + return not data.actions.start.do_glow or data.actions.start.glow_action ~= "show" or data.actions.start.glow_type ~= "Pixel" or data.actions.start.glow_frame_type == nil end, }, start_glow_thickness = { @@ -424,10 +451,7 @@ function OptionsPrivate.GetActionOptions(data) return data.actions.start.glow_thickness or 1 end, hidden = function() - return not data.actions.start.do_glow - or data.actions.start.glow_action ~= "show" - or data.actions.start.glow_type ~= "Pixel" - or data.actions.start.glow_frame_type == nil + return not data.actions.start.do_glow or data.actions.start.glow_action ~= "show" or data.actions.start.glow_type ~= "Pixel" or data.actions.start.glow_frame_type == nil end, }, start_glow_XOffset = { @@ -440,10 +464,10 @@ function OptionsPrivate.GetActionOptions(data) step = 0.5, hidden = function() return not data.actions.start.do_glow - or data.actions.start.glow_action ~= "show" - or not data.actions.start.glow_type - or data.actions.start.glow_type == "buttonOverlay" - or data.actions.start.glow_frame_type == nil + or data.actions.start.glow_action ~= "show" + or not data.actions.start.glow_type + or data.actions.start.glow_type == "buttonOverlay" + or data.actions.start.glow_frame_type == nil end, }, start_glow_YOffset = { @@ -456,10 +480,10 @@ function OptionsPrivate.GetActionOptions(data) step = 0.5, hidden = function() return not data.actions.start.do_glow - or data.actions.start.glow_action ~= "show" - or not data.actions.start.glow_type - or data.actions.start.glow_type == "buttonOverlay" - or data.actions.start.glow_frame_type == nil + or data.actions.start.glow_action ~= "show" + or not data.actions.start.glow_type + or data.actions.start.glow_type == "buttonOverlay" + or data.actions.start.glow_frame_type == nil end, }, start_glow_scale = { @@ -476,9 +500,9 @@ function OptionsPrivate.GetActionOptions(data) end, hidden = function() return not data.actions.start.do_glow - or data.actions.start.glow_action ~= "show" - or data.actions.start.glow_type ~= "ACShine" - or data.actions.start.glow_frame_type == nil + or data.actions.start.glow_action ~= "show" + or data.actions.start.glow_type ~= "ACShine" + or data.actions.start.glow_frame_type == nil end, }, start_glow_border = { @@ -487,10 +511,7 @@ function OptionsPrivate.GetActionOptions(data) name = L["Border"], order = 10.88, hidden = function() - return not data.actions.start.do_glow - or data.actions.start.glow_action ~= "show" - or data.actions.start.glow_type ~= "Pixel" - or data.actions.start.glow_frame_type == nil + return not data.actions.start.do_glow or data.actions.start.glow_action ~= "show" or data.actions.start.glow_type ~= "Pixel" or data.actions.start.glow_frame_type == nil end, }, start_do_custom = { @@ -503,13 +524,13 @@ function OptionsPrivate.GetActionOptions(data) finish_header = { type = "header", name = L["On Hide"], - order = 20.5 + order = 20.5, }, finish_do_message = { type = "toggle", width = WeakAuras.normalWidth, name = L["Chat Message"], - order = 21 + order = 21, }, finish_message_type = { type = "select", @@ -517,26 +538,31 @@ function OptionsPrivate.GetActionOptions(data) name = L["Message Type"], order = 22, values = OptionsPrivate.Private.send_chat_message_types, - disabled = function() return not data.actions.finish.do_message end, - control = "WeakAurasSortedDropdown" + disabled = function() + return not data.actions.finish.do_message + end, + control = "WeakAurasSortedDropdown", }, finish_message_warning = { type = "description", width = WeakAuras.doubleWidth, name = L["Note: Automated Messages to SAY and YELL are blocked outside of Instances."], order = 22.5, - hidden = function() return not RestrictedChannelCheck(data.actions.finish) end + hidden = function() + return not RestrictedChannelCheck(data.actions.finish) + end, }, finish_message_space = { type = "execute", width = WeakAuras.normalWidth, name = "", order = 23, - image = function() return "", 0, 0 end, + image = function() + return "", 0, 0 + end, hidden = function() - return not(data.actions.finish.message_type == "COMBAT" - or data.actions.finish.message_type == "PRINT" or data.actions.finish.message_type == "ERROR") - end + return not (data.actions.finish.message_type == "COMBAT" or data.actions.finish.message_type == "PRINT" or data.actions.finish.message_type == "ERROR") + end, }, finish_message_color = { type = "color", @@ -544,26 +570,30 @@ function OptionsPrivate.GetActionOptions(data) name = L["Color"], order = 23, hasAlpha = false, - hidden = function() return - not(data.actions.finish.message_type == "COMBAT" - or data.actions.finish.message_type == "PRINT" - or data.actions.finish.message_type == "ERROR") - end, - get = function() return data.actions.finish.r or 1, data.actions.finish.g or 1, data.actions.finish.b or 1 end, + hidden = function() + return not (data.actions.finish.message_type == "COMBAT" or data.actions.finish.message_type == "PRINT" or data.actions.finish.message_type == "ERROR") + end, + get = function() + return data.actions.finish.r or 1, data.actions.finish.g or 1, data.actions.finish.b or 1 + end, set = function(info, r, g, b) - data.actions.finish.r = r; - data.actions.finish.g = g; - data.actions.finish.b = b; - WeakAuras.Add(data); - end + data.actions.finish.r = r + data.actions.finish.g = g + data.actions.finish.b = b + WeakAuras.Add(data) + end, }, finish_message_dest = { type = "input", width = WeakAuras.normalWidth, name = L["Send To"], order = 23.1, - disabled = function() return not data.actions.finish.do_message end, - hidden = function() return data.actions.finish.message_type ~= "WHISPER" end + disabled = function() + return not data.actions.finish.do_message + end, + hidden = function() + return data.actions.finish.message_type ~= "WHISPER" + end, }, finish_message_dest_isunit = { type = "toggle", @@ -572,24 +602,30 @@ function OptionsPrivate.GetActionOptions(data) order = 23.15, hidden = function() return data.actions.finish.message_type ~= "WHISPER" - end + end, }, finish_message_tts_voice = { type = "select", width = WeakAuras.doubleWidth, name = L["Voice"], order = 23.2, - disabled = function() return not data.actions.finish.do_message end, - hidden = function() return (not WeakAuras.IsRetail()) or data.actions.finish.message_type ~= "TTS" end, + disabled = function() + return not data.actions.finish.do_message + end, + hidden = function() + return (not WeakAuras.IsRetail()) or data.actions.finish.message_type ~= "TTS" + end, values = OptionsPrivate.Private.tts_voices, - desc = L["Available Voices are system specific"] + desc = L["Available Voices are system specific"], }, finish_message = { type = "input", width = WeakAuras.doubleWidth, name = L["Message"], order = 24, - disabled = function() return not data.actions.finish.do_message end, + disabled = function() + return not data.actions.finish.do_message + end, desc = function() return L["Dynamic text tooltip"] .. OptionsPrivate.Private.GetAdditionalProperties(data) end, @@ -599,7 +635,7 @@ function OptionsPrivate.GetActionOptions(data) type = "toggle", width = WeakAuras.normalWidth, name = L["Play Sound"], - order = 28 + order = 28, }, finish_sound = { type = "select", @@ -607,8 +643,10 @@ function OptionsPrivate.GetActionOptions(data) name = L["Sound"], order = 28.1, values = OptionsPrivate.Private.sound_types, - disabled = function() return not data.actions.finish.do_sound end, - control = "WeakAurasSortedDropdown" + disabled = function() + return not data.actions.finish.do_sound + end, + control = "WeakAurasSortedDropdown", }, finish_sound_channel = { type = "select", @@ -616,24 +654,36 @@ function OptionsPrivate.GetActionOptions(data) name = L["Sound Channel"], order = 28.5, values = OptionsPrivate.Private.sound_channel_types, - disabled = function() return not data.actions.finish.do_sound end, - get = function() return data.actions.finish.sound_channel or "Master" end + disabled = function() + return not data.actions.finish.do_sound + end, + get = function() + return data.actions.finish.sound_channel or "Master" + end, }, finish_sound_path = { type = "input", width = WeakAuras.doubleWidth, name = L["Sound File Path"], order = 29, - hidden = function() return data.actions.finish.sound ~= " custom" end, - disabled = function() return not data.actions.finish.do_sound end + hidden = function() + return data.actions.finish.sound ~= " custom" + end, + disabled = function() + return not data.actions.finish.do_sound + end, }, finish_sound_kit_id = { type = "input", width = WeakAuras.doubleWidth, name = L["Sound Kit ID"], order = 29, - hidden = function() return data.actions.finish.sound ~= " KitID" end, - disabled = function() return not data.actions.finish.do_sound end + hidden = function() + return data.actions.finish.sound ~= " KitID" + end, + disabled = function() + return not data.actions.finish.do_sound + end, }, finish_stop_sound = { type = "toggle", @@ -645,7 +695,7 @@ function OptionsPrivate.GetActionOptions(data) type = "toggle", width = WeakAuras.normalWidth, name = L["Glow External Element"], - order = 30.1 + order = 30.1, }, finish_glow_action = { type = "select", @@ -653,29 +703,26 @@ function OptionsPrivate.GetActionOptions(data) name = L["Glow Action"], order = 30.2, values = OptionsPrivate.Private.glow_action_types, - disabled = function() return not data.actions.finish.do_glow end + disabled = function() + return not data.actions.finish.do_glow + end, }, finish_glow_frame_type = { type = "select", width = WeakAuras.normalWidth, desc = function() - return ( - data.actions.finish.glow_frame_type == "UNITFRAME" - or data.actions.finish.glow_frame_type == "NAMEPLATE" - ) - and L["Require unit from trigger"] or nil + return (data.actions.finish.glow_frame_type == "UNITFRAME" or data.actions.finish.glow_frame_type == "NAMEPLATE") and L["Require unit from trigger"] or nil end, name = L["Glow Frame Type"], order = 30.3, values = { UNITFRAME = L["Unit Frame"], NAMEPLATE = L["Nameplate"], - FRAMESELECTOR = L["Frame Selector"] + FRAMESELECTOR = L["Frame Selector"], }, hidden = function() - return not data.actions.finish.do_glow - or data.actions.finish.glow_action == nil - end + return not data.actions.finish.do_glow or data.actions.finish.glow_action == nil + end, }, finish_glow_type_spacer = { type = "description", @@ -683,8 +730,7 @@ function OptionsPrivate.GetActionOptions(data) name = "", order = 30.35, hidden = function() - return not data.actions.finish.do_glow - or not (data.actions.finish.glow_action == "hide" and data.actions.finish.glow_frame_type == "FRAMESELECTOR") + return not data.actions.finish.do_glow or not (data.actions.finish.glow_action == "hide" and data.actions.finish.glow_frame_type == "FRAMESELECTOR") end, }, finish_glow_type = { @@ -694,9 +740,7 @@ function OptionsPrivate.GetActionOptions(data) order = 30.4, values = OptionsPrivate.Private.glow_types, hidden = function() - return not data.actions.finish.do_glow - or data.actions.finish.glow_action ~= "show" - or data.actions.finish.glow_frame_type == nil + return not data.actions.finish.do_glow or data.actions.finish.glow_action ~= "show" or data.actions.finish.glow_frame_type == nil end, }, finish_glow_frame = { @@ -705,24 +749,25 @@ function OptionsPrivate.GetActionOptions(data) name = L["Frame"], order = 30.5, hidden = function() - return not data.actions.finish.do_glow - or data.actions.finish.glow_frame_type ~= "FRAMESELECTOR" - end + return not data.actions.finish.do_glow or data.actions.finish.glow_frame_type ~= "FRAMESELECTOR" + end, }, finish_choose_glow_frame = { type = "execute", width = WeakAuras.normalWidth, name = L["Choose"], order = 30.55, - hidden = function() return not data.actions.finish.do_glow or data.actions.finish.glow_frame_type ~= "FRAMESELECTOR" end, + hidden = function() + return not data.actions.finish.do_glow or data.actions.finish.glow_frame_type ~= "FRAMESELECTOR" + end, func = function() - if(data.controlledChildren and data.controlledChildren[1]) then - WeakAuras.PickDisplay(data.controlledChildren[1]); - OptionsPrivate.StartFrameChooser(WeakAuras.GetData(data.controlledChildren[1]), {"actions", "finish", "glow_frame"}); + if data.controlledChildren and data.controlledChildren[1] then + WeakAuras.PickDisplay(data.controlledChildren[1]) + OptionsPrivate.StartFrameChooser(WeakAuras.GetData(data.controlledChildren[1]), { "actions", "finish", "glow_frame" }) else - OptionsPrivate.StartFrameChooser(data, {"actions", "finish", "glow_frame"}); + OptionsPrivate.StartFrameChooser(data, { "actions", "finish", "glow_frame" }) end - end + end, }, finish_use_glow_color = { type = "toggle", @@ -730,10 +775,7 @@ function OptionsPrivate.GetActionOptions(data) name = L["Glow Color"], order = 30.7, hidden = function() - return not data.actions.finish.do_glow - or data.actions.finish.glow_action ~= "show" - or data.actions.finish.glow_frame_type == nil - or data.actions.finish.glow_type == nil + return not data.actions.finish.do_glow or data.actions.finish.glow_action ~= "show" or data.actions.finish.glow_frame_type == nil or data.actions.finish.glow_type == nil end, }, finish_glow_color = { @@ -743,12 +785,11 @@ function OptionsPrivate.GetActionOptions(data) name = L["Glow Color"], order = 30.8, hidden = function() - return not data.actions.finish.do_glow - or data.actions.finish.glow_action ~= "show" - or data.actions.finish.glow_frame_type == nil - or data.actions.finish.glow_type == nil + return not data.actions.finish.do_glow or data.actions.finish.glow_action ~= "show" or data.actions.finish.glow_frame_type == nil or data.actions.finish.glow_type == nil + end, + disabled = function() + return not data.actions.finish.use_glow_color end, - disabled = function() return not data.actions.finish.use_glow_color end, }, finish_glow_lines = { type = "range", @@ -763,10 +804,10 @@ function OptionsPrivate.GetActionOptions(data) end, hidden = function() return not data.actions.finish.do_glow - or data.actions.finish.glow_action ~= "show" - or not data.actions.finish.glow_type - or data.actions.finish.glow_type == "buttonOverlay" - or data.actions.finish.glow_frame_type == nil + or data.actions.finish.glow_action ~= "show" + or not data.actions.finish.glow_type + or data.actions.finish.glow_type == "buttonOverlay" + or data.actions.finish.glow_frame_type == nil end, }, finish_glow_frequency = { @@ -782,10 +823,10 @@ function OptionsPrivate.GetActionOptions(data) end, hidden = function() return not data.actions.finish.do_glow - or data.actions.finish.glow_action ~= "show" - or not data.actions.finish.glow_type - or data.actions.finish.glow_type == "buttonOverlay" - or data.actions.finish.glow_frame_type == nil + or data.actions.finish.glow_action ~= "show" + or not data.actions.finish.glow_type + or data.actions.finish.glow_type == "buttonOverlay" + or data.actions.finish.glow_frame_type == nil end, }, finish_glow_length = { @@ -801,9 +842,9 @@ function OptionsPrivate.GetActionOptions(data) end, hidden = function() return not data.actions.finish.do_glow - or data.actions.finish.glow_action ~= "show" - or data.actions.finish.glow_type ~= "Pixel" - or data.actions.finish.glow_frame_type == nil + or data.actions.finish.glow_action ~= "show" + or data.actions.finish.glow_type ~= "Pixel" + or data.actions.finish.glow_frame_type == nil end, }, finish_glow_thickness = { @@ -819,9 +860,9 @@ function OptionsPrivate.GetActionOptions(data) end, hidden = function() return not data.actions.finish.do_glow - or data.actions.finish.glow_action ~= "show" - or data.actions.finish.glow_type ~= "Pixel" - or data.actions.finish.glow_frame_type == nil + or data.actions.finish.glow_action ~= "show" + or data.actions.finish.glow_type ~= "Pixel" + or data.actions.finish.glow_frame_type == nil end, }, finish_glow_XOffset = { @@ -834,10 +875,10 @@ function OptionsPrivate.GetActionOptions(data) step = 0.5, hidden = function() return not data.actions.finish.do_glow - or data.actions.finish.glow_action ~= "show" - or not data.actions.finish.glow_type - or data.actions.finish.glow_type == "buttonOverlay" - or data.actions.finish.glow_frame_type == nil + or data.actions.finish.glow_action ~= "show" + or not data.actions.finish.glow_type + or data.actions.finish.glow_type == "buttonOverlay" + or data.actions.finish.glow_frame_type == nil end, }, finish_glow_YOffset = { @@ -850,10 +891,10 @@ function OptionsPrivate.GetActionOptions(data) step = 0.5, hidden = function() return not data.actions.finish.do_glow - or data.actions.finish.glow_action ~= "show" - or not data.actions.finish.glow_type - or data.actions.finish.glow_type == "buttonOverlay" - or data.actions.finish.glow_frame_type == nil + or data.actions.finish.glow_action ~= "show" + or not data.actions.finish.glow_type + or data.actions.finish.glow_type == "buttonOverlay" + or data.actions.finish.glow_frame_type == nil end, }, finish_glow_scale = { @@ -870,9 +911,9 @@ function OptionsPrivate.GetActionOptions(data) end, hidden = function() return not data.actions.finish.do_glow - or data.actions.finish.glow_action ~= "show" - or data.actions.finish.glow_type ~= "ACShine" - or data.actions.finish.glow_frame_type == nil + or data.actions.finish.glow_action ~= "show" + or data.actions.finish.glow_type ~= "ACShine" + or data.actions.finish.glow_frame_type == nil end, }, finish_glow_border = { @@ -882,9 +923,9 @@ function OptionsPrivate.GetActionOptions(data) order = 30.88, hidden = function() return not data.actions.finish.do_glow - or data.actions.finish.glow_action ~= "show" - or data.actions.finish.glow_type ~= "Pixel" - or data.actions.finish.glow_frame_type == nil + or data.actions.finish.glow_action ~= "show" + or data.actions.finish.glow_type ~= "Pixel" + or data.actions.finish.glow_frame_type == nil end, }, finish_hide_all_glows = { @@ -899,17 +940,45 @@ function OptionsPrivate.GetActionOptions(data) name = L["Custom"], order = 32, }, - -- Text editor added below + -- Text editor added below }, } -- Text format option helpers - OptionsPrivate.commonOptions.AddCodeOption(action.args, data, L["Custom Code"], "init", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#on-init", - 0.011, function() return not data.actions.init.do_custom end, {"actions", "init", "custom"}, true); + OptionsPrivate.commonOptions.AddCodeOption( + action.args, + data, + L["Custom Code"], + "init", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#on-init", + 0.011, + function() + return not data.actions.init.do_custom + end, + { "actions", "init", "custom" }, + true + ) - OptionsPrivate.commonOptions.AddCodeOption(action.args, data, L["Custom Code"], "start_message", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#chat-message---custom-code", - 5, function() return not (data.actions.start.do_message and (OptionsPrivate.Private.ContainsCustomPlaceHolder(data.actions.start.message) or (data.actions.start.message_type == "WHISPER" and OptionsPrivate.Private.ContainsCustomPlaceHolder(data.actions.start.message_dest)))) end, {"actions", "start", "message_custom"}, false); + OptionsPrivate.commonOptions.AddCodeOption( + action.args, + data, + L["Custom Code"], + "start_message", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#chat-message---custom-code", + 5, + function() + return not ( + data.actions.start.do_message + and ( + OptionsPrivate.Private.ContainsCustomPlaceHolder(data.actions.start.message) + or (data.actions.start.message_type == "WHISPER" and OptionsPrivate.Private.ContainsCustomPlaceHolder(data.actions.start.message_dest)) + ) + ) + end, + { "actions", "start", "message_custom" }, + false + ) local startHidden = function() return OptionsPrivate.IsCollapsed("format_option", "actions", "start_message", true) @@ -944,9 +1013,13 @@ function OptionsPrivate.GetActionOptions(data) if option.hidden then local hidden = option.hidden - option.hidden = function() return not data.actions.start.do_message or hidden() end + option.hidden = function() + return not data.actions.start.do_message or hidden() + end else - option.hidden = function() return not data.actions.start.do_message end + option.hidden = function() + return not data.actions.start.do_message + end end action.args["start_message_format_" .. key] = option @@ -968,12 +1041,29 @@ function OptionsPrivate.GetActionOptions(data) OptionsPrivate.AddTextFormatOption(data.actions and data.actions.start.message, true, startGet, startAddOption, startHidden, startSetHidden, true) end + OptionsPrivate.commonOptions.AddCodeOption(action.args, data, L["Custom Code"], "start", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#on-show", 13, function() + return not data.actions.start.do_custom + end, { "actions", "start", "custom" }, true) - OptionsPrivate.commonOptions.AddCodeOption(action.args, data, L["Custom Code"], "start", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#on-show", - 13, function() return not data.actions.start.do_custom end, {"actions", "start", "custom"}, true); - - OptionsPrivate.commonOptions.AddCodeOption(action.args, data, L["Custom Code"], "finish_message", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#chat-message---custom-code", - 25, function() return not (data.actions.finish.do_message and (OptionsPrivate.Private.ContainsCustomPlaceHolder(data.actions.finish.message) or (data.actions.finish.message_type == "WHISPER" and OptionsPrivate.Private.ContainsCustomPlaceHolder(data.actions.finish.message_dest)))) end, {"actions", "finish", "message_custom"}, false); + OptionsPrivate.commonOptions.AddCodeOption( + action.args, + data, + L["Custom Code"], + "finish_message", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#chat-message---custom-code", + 25, + function() + return not ( + data.actions.finish.do_message + and ( + OptionsPrivate.Private.ContainsCustomPlaceHolder(data.actions.finish.message) + or (data.actions.finish.message_type == "WHISPER" and OptionsPrivate.Private.ContainsCustomPlaceHolder(data.actions.finish.message_dest)) + ) + ) + end, + { "actions", "finish", "message_custom" }, + false + ) local finishHidden = function() return OptionsPrivate.IsCollapsed("format_option", "actions", "finish_message", true) @@ -1007,9 +1097,13 @@ function OptionsPrivate.GetActionOptions(data) if option.hidden then local hidden = option.hidden - option.hidden = function() return not data.actions.finish.do_message or hidden() end + option.hidden = function() + return not data.actions.finish.do_message or hidden() + end else - option.hidden = function() return not data.actions.finish.do_message end + option.hidden = function() + return not data.actions.finish.do_message + end end action.args["finish_message_format_" .. key] = option @@ -1030,8 +1124,19 @@ function OptionsPrivate.GetActionOptions(data) OptionsPrivate.AddTextFormatOption(data.actions and data.actions.finish.message, true, finishGet, finishAddOption, finishHidden, finishSetHidden, true) end - OptionsPrivate.commonOptions.AddCodeOption(action.args, data, L["Custom Code"], "finish", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#on-hide", - 32, function() return not data.actions.finish.do_custom end, {"actions", "finish", "custom"}, true); + OptionsPrivate.commonOptions.AddCodeOption( + action.args, + data, + L["Custom Code"], + "finish", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#on-hide", + 32, + function() + return not data.actions.finish.do_custom + end, + { "actions", "finish", "custom" }, + true + ) if data.controlledChildren then removeFuncs(action) @@ -1039,18 +1144,24 @@ function OptionsPrivate.GetActionOptions(data) replaceImageFuncs(action, data, "action") replaceValuesFuncs(action, data, "action") - action.get = function(info, ...) return getAll(data, info, ...); end; + action.get = function(info, ...) + return getAll(data, info, ...) + end action.set = function(info, ...) - setAll(data, info, ...); - if(type(data.id) == "string") then - WeakAuras.Add(data); - WeakAuras.UpdateThumbnail(data); - OptionsPrivate.ResetMoverSizer(); + setAll(data, info, ...) + if type(data.id) == "string" then + WeakAuras.Add(data) + WeakAuras.UpdateThumbnail(data) + OptionsPrivate.ResetMoverSizer() end end - action.hidden = function(info, ...) return hiddenAll(data, info, ...); end; - action.disabled = function(info, ...) return disabledAll(data, info, ...); end; + action.hidden = function(info, ...) + return hiddenAll(data, info, ...) + end + action.disabled = function(info, ...) + return disabledAll(data, info, ...) + end end - return action; + return action end diff --git a/WeakAurasOptions/AnimationOptions.lua b/WeakAurasOptions/AnimationOptions.lua index cdc8420796..090f0007d2 100644 --- a/WeakAurasOptions/AnimationOptions.lua +++ b/WeakAurasOptions/AnimationOptions.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... local L = WeakAuras.L @@ -12,44 +14,42 @@ local hiddenAll = OptionsPrivate.commonOptions.CreateHiddenAll("animation") local getAll = OptionsPrivate.commonOptions.CreateGetAll("animation") local setAll = OptionsPrivate.commonOptions.CreateSetAll("animation", getAll) - - local function filterAnimPresetTypes(intable, id) - local ret = {}; - local region = WeakAuras.regions[id] and WeakAuras.regions[id].region; - local regionType = WeakAuras.regions[id] and WeakAuras.regions[id].regionType; - local data = WeakAuras.GetData(id); + local ret = {} + local region = WeakAuras.regions[id] and WeakAuras.regions[id].region + local regionType = WeakAuras.regions[id] and WeakAuras.regions[id].regionType + local data = WeakAuras.GetData(id) if data.controlledChildren then return ret end - if(region and regionType and data) then + if region and regionType and data then for key, value in pairs(intable) do - local preset = OptionsPrivate.Private.anim_presets[key]; - if(preset) then - if not((preset.use_scale and not region.Scale) or (preset.use_rotate and not region.Rotate)) then - ret[key] = value; + local preset = OptionsPrivate.Private.anim_presets[key] + if preset then + if not ((preset.use_scale and not region.Scale) or (preset.use_rotate and not region.Rotate)) then + ret[key] = value end end end end - return ret; + return ret end function OptionsPrivate.GetAnimationOptions(data) local anim_types = OptionsPrivate.Private.anim_types - local anim_translate_types = OptionsPrivate.Private.anim_translate_types; - local anim_scale_types = OptionsPrivate.Private.anim_scale_types; - local anim_alpha_types = OptionsPrivate.Private.anim_alpha_types; - local anim_rotate_types = OptionsPrivate.Private.anim_rotate_types; - local anim_color_types = OptionsPrivate.Private.anim_color_types; - local anim_start_preset_types = OptionsPrivate.Private.anim_start_preset_types; - local anim_main_preset_types = OptionsPrivate.Private.anim_main_preset_types; - local anim_finish_preset_types = OptionsPrivate.Private.anim_finish_preset_types; - local duration_types = OptionsPrivate.Private.duration_types; - local duration_types_no_choice = OptionsPrivate.Private.duration_types_no_choice; - local anim_ease_types = OptionsPrivate.Private.anim_ease_types; + local anim_translate_types = OptionsPrivate.Private.anim_translate_types + local anim_scale_types = OptionsPrivate.Private.anim_scale_types + local anim_alpha_types = OptionsPrivate.Private.anim_alpha_types + local anim_rotate_types = OptionsPrivate.Private.anim_rotate_types + local anim_color_types = OptionsPrivate.Private.anim_color_types + local anim_start_preset_types = OptionsPrivate.Private.anim_start_preset_types + local anim_main_preset_types = OptionsPrivate.Private.anim_main_preset_types + local anim_finish_preset_types = OptionsPrivate.Private.anim_finish_preset_types + local duration_types = OptionsPrivate.Private.duration_types + local duration_types_no_choice = OptionsPrivate.Private.duration_types_no_choice + local anim_ease_types = OptionsPrivate.Private.anim_ease_types local id = data.id local animation = { @@ -57,39 +57,39 @@ function OptionsPrivate.GetAnimationOptions(data) name = L["Animations"], order = 60, get = function(info) - local split = info[#info]:find("_"); - if(split) then - local field, value = info[#info]:sub(1, split-1), info[#info]:sub(split+1); + local split = info[#info]:find("_") + if split then + local field, value = info[#info]:sub(1, split - 1), info[#info]:sub(split + 1) - if(data.animation and data.animation[field]) then - return data.animation[field][value]; + if data.animation and data.animation[field] then + return data.animation[field][value] else - if(value == "scalex" or value == "scaley") then - return 1; + if value == "scalex" or value == "scaley" then + return 1 else - return nil; + return nil end end end end, set = function(info, v) - local split = info[#info]:find("_"); - local field, value = info[#info]:sub(1, split-1), info[#info]:sub(split+1); - data.animation = data.animation or {}; - data.animation[field] = data.animation[field] or {}; - data.animation[field][value] = v; - if(field == "main") then - OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, WeakAuras.regions[id].region, false, nil, true); - if(WeakAuras.clones[id]) then + local split = info[#info]:find("_") + local field, value = info[#info]:sub(1, split - 1), info[#info]:sub(split + 1) + data.animation = data.animation or {} + data.animation[field] = data.animation[field] or {} + data.animation[field][value] = v + if field == "main" then + OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, WeakAuras.regions[id].region, false, nil, true) + if WeakAuras.clones[id] then for cloneId, cloneRegion in pairs(WeakAuras.clones[id]) do - OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, cloneRegion, false, nil, true, cloneId); + OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, cloneRegion, false, nil, true, cloneId) end end end - WeakAuras.Add(data); + WeakAuras.Add(data) end, disabled = function(info, v) - local split = info[#info]:find("_"); + local split = info[#info]:find("_") local valueToType = { alphaType = "use_alpha", alpha = "use_alpha", @@ -102,28 +102,28 @@ function OptionsPrivate.GetAnimationOptions(data) rotateType = "use_rotate", rotate = "use_rotate", colorType = "use_color", - color = "use_color" + color = "use_color", } - if(split) then - local field, value = info[#info]:sub(1, split-1), info[#info]:sub(split+1); - if(data.animation and data.animation[field]) then - if(valueToType[value]) then - return not data.animation[field][valueToType[value]]; + if split then + local field, value = info[#info]:sub(1, split - 1), info[#info]:sub(split + 1) + if data.animation and data.animation[field] then + if valueToType[value] then + return not data.animation[field][valueToType[value]] else - return false; + return false end else - return true; + return true end else - return false; + return false end end, args = { start_header = { type = "header", name = L["Start"], - order = 30 + order = 30, }, start_type = { type = "select", @@ -131,15 +131,19 @@ function OptionsPrivate.GetAnimationOptions(data) name = L["Type"], order = 32, values = anim_types, - disabled = false + disabled = false, }, start_preset = { type = "select", width = WeakAuras.normalWidth, name = L["Preset"], order = 33, - values = function() return filterAnimPresetTypes(anim_start_preset_types, id) end, - hidden = function() return data.animation.start.type ~= "preset" end + values = function() + return filterAnimPresetTypes(anim_start_preset_types, id) + end, + hidden = function() + return data.animation.start.type ~= "preset" + end, }, start_duration_type_no_choice = { type = "select", @@ -148,8 +152,12 @@ function OptionsPrivate.GetAnimationOptions(data) order = 33, values = duration_types_no_choice, disabled = true, - hidden = function() return data.animation.start.type ~= "custom" or OptionsPrivate.Private.CanHaveDuration(data) end, - get = function() return "seconds" end + hidden = function() + return data.animation.start.type ~= "custom" or OptionsPrivate.Private.CanHaveDuration(data) + end, + get = function() + return "seconds" + end, }, start_duration_type = { type = "select", @@ -157,27 +165,31 @@ function OptionsPrivate.GetAnimationOptions(data) name = L["Time in"], order = 33, values = duration_types, - hidden = function() return data.animation.start.type ~= "custom" or not OptionsPrivate.Private.CanHaveDuration(data) end + hidden = function() + return data.animation.start.type ~= "custom" or not OptionsPrivate.Private.CanHaveDuration(data) + end, }, start_duration = { type = "input", width = WeakAuras.halfWidth, name = function() - if(data.animation.start.duration_type == "relative") then - return L["% of Progress"]; + if data.animation.start.duration_type == "relative" then + return L["% of Progress"] else - return L["Duration (s)"]; + return L["Duration (s)"] end end, desc = function() - if(data.animation.start.duration_type == "relative") then - return L["Animation relative duration description"]; + if data.animation.start.duration_type == "relative" then + return L["Animation relative duration description"] else - return L["The duration of the animation in seconds."]; + return L["The duration of the animation in seconds."] end end, order = 33.5, - hidden = function() return data.animation.start.type ~= "custom" end + hidden = function() + return data.animation.start.type ~= "custom" + end, }, start_easeType = { type = "select", @@ -185,7 +197,9 @@ function OptionsPrivate.GetAnimationOptions(data) name = L["Ease type"], values = anim_ease_types, order = 33.7, - hidden = function() return data.animation.start.type ~= "custom" end + hidden = function() + return data.animation.start.type ~= "custom" + end, }, start_easeStrength = { type = "range", @@ -195,15 +209,21 @@ function OptionsPrivate.GetAnimationOptions(data) min = 1, max = 5, bigStep = 1, - hidden = function() return data.animation.start.type ~= "custom" end, - disabled = function() return data.animation.start.easeType == "none" end + hidden = function() + return data.animation.start.type ~= "custom" + end, + disabled = function() + return data.animation.start.easeType == "none" + end, }, start_use_alpha = { type = "toggle", width = WeakAuras.normalWidth, name = L["Fade In"], order = 34, - hidden = function() return data.animation.start.type ~= "custom" end + hidden = function() + return data.animation.start.type ~= "custom" + end, }, start_alphaType = { type = "select", @@ -211,7 +231,9 @@ function OptionsPrivate.GetAnimationOptions(data) name = L["Type"], order = 35, values = anim_alpha_types, - hidden = function() return data.animation.start.type ~= "custom" end + hidden = function() + return data.animation.start.type ~= "custom" + end, }, -- text editor added below start_alpha = { @@ -223,14 +245,18 @@ function OptionsPrivate.GetAnimationOptions(data) max = 1, bigStep = 0.01, isPercent = true, - hidden = function() return data.animation.start.type ~= "custom" end + hidden = function() + return data.animation.start.type ~= "custom" + end, }, start_use_translate = { type = "toggle", width = WeakAuras.normalWidth, name = L["Slide In"], order = 38, - hidden = function() return data.animation.start.type ~= "custom" end + hidden = function() + return data.animation.start.type ~= "custom" + end, }, start_translateType = { type = "select", @@ -238,7 +264,9 @@ function OptionsPrivate.GetAnimationOptions(data) name = L["Type"], order = 39, values = anim_translate_types, - hidden = function() return data.animation.start.type ~= "custom" end + hidden = function() + return data.animation.start.type ~= "custom" + end, }, -- texteditor added below start_x = { @@ -250,7 +278,9 @@ function OptionsPrivate.GetAnimationOptions(data) softMax = 200, step = 1, bigStep = 5, - hidden = function() return data.animation.start.type ~= "custom" end + hidden = function() + return data.animation.start.type ~= "custom" + end, }, start_y = { type = "range", @@ -261,7 +291,9 @@ function OptionsPrivate.GetAnimationOptions(data) softMax = 200, step = 1, bigStep = 5, - hidden = function() return data.animation.start.type ~= "custom" end + hidden = function() + return data.animation.start.type ~= "custom" + end, }, start_use_scale = { type = "toggle", @@ -269,10 +301,8 @@ function OptionsPrivate.GetAnimationOptions(data) name = L["Zoom In"], order = 42, hidden = function() - return ( - data.animation.start.type ~= "custom" - or not WeakAuras.regions[id].region.Scale - ) end + return (data.animation.start.type ~= "custom" or not WeakAuras.regions[id].region.Scale) + end, }, start_scaleType = { type = "select", @@ -280,7 +310,9 @@ function OptionsPrivate.GetAnimationOptions(data) name = L["Type"], order = 43, values = anim_scale_types, - hidden = function() return (data.animation.start.type ~= "custom" or not WeakAuras.regions[id].region.Scale) end + hidden = function() + return (data.animation.start.type ~= "custom" or not WeakAuras.regions[id].region.Scale) + end, }, -- texteditor added below start_scalex = { @@ -292,7 +324,9 @@ function OptionsPrivate.GetAnimationOptions(data) softMax = 5, step = 0.01, bigStep = 0.1, - hidden = function() return (data.animation.start.type ~= "custom" or not WeakAuras.regions[id].region.Scale) end + hidden = function() + return (data.animation.start.type ~= "custom" or not WeakAuras.regions[id].region.Scale) + end, }, start_scaley = { type = "range", @@ -303,14 +337,18 @@ function OptionsPrivate.GetAnimationOptions(data) softMax = 5, step = 0.01, bigStep = 0.1, - hidden = function() return (data.animation.start.type ~= "custom" or not WeakAuras.regions[id].region.Scale) end + hidden = function() + return (data.animation.start.type ~= "custom" or not WeakAuras.regions[id].region.Scale) + end, }, start_use_rotate = { type = "toggle", width = WeakAuras.normalWidth, name = L["Rotate In"], order = 46, - hidden = function() return (data.animation.start.type ~= "custom" or not WeakAuras.regions[id].region.Rotate) end + hidden = function() + return (data.animation.start.type ~= "custom" or not WeakAuras.regions[id].region.Rotate) + end, }, start_rotateType = { type = "select", @@ -318,7 +356,9 @@ function OptionsPrivate.GetAnimationOptions(data) name = L["Type"], order = 47, values = anim_rotate_types, - hidden = function() return (data.animation.start.type ~= "custom" or not WeakAuras.regions[id].region.Rotate) end + hidden = function() + return (data.animation.start.type ~= "custom" or not WeakAuras.regions[id].region.Rotate) + end, }, -- texteditor added below start_rotate = { @@ -329,14 +369,18 @@ function OptionsPrivate.GetAnimationOptions(data) softMin = 0, softMax = 360, bigStep = 3, - hidden = function() return (data.animation.start.type ~= "custom" or not WeakAuras.regions[id].region.Rotate) end + hidden = function() + return (data.animation.start.type ~= "custom" or not WeakAuras.regions[id].region.Rotate) + end, }, start_use_color = { type = "toggle", width = WeakAuras.normalWidth, name = L["Color"], order = 48.2, - hidden = function() return (data.animation.start.type ~= "custom" or not WeakAuras.regions[id].region.Color) end + hidden = function() + return (data.animation.start.type ~= "custom" or not WeakAuras.regions[id].region.Color) + end, }, start_colorType = { type = "select", @@ -344,7 +388,9 @@ function OptionsPrivate.GetAnimationOptions(data) name = L["Type"], order = 48.5, values = anim_color_types, - hidden = function() return (data.animation.start.type ~= "custom" or not WeakAuras.regions[id].region.Color) end + hidden = function() + return (data.animation.start.type ~= "custom" or not WeakAuras.regions[id].region.Color) + end, }, -- texteditor added below start_color = { @@ -352,24 +398,23 @@ function OptionsPrivate.GetAnimationOptions(data) width = WeakAuras.doubleWidth, name = L["Color"], order = 49.5, - hidden = function() return (data.animation.start.type ~= "custom" or not WeakAuras.regions[id].region.Color) end, + hidden = function() + return (data.animation.start.type ~= "custom" or not WeakAuras.regions[id].region.Color) + end, get = function() - return data.animation.start.colorR, - data.animation.start.colorG, - data.animation.start.colorB, - data.animation.start.colorA; + return data.animation.start.colorR, data.animation.start.colorG, data.animation.start.colorB, data.animation.start.colorA end, set = function(info, r, g, b, a) - data.animation.start.colorR = r; - data.animation.start.colorG = g; - data.animation.start.colorB = b; - data.animation.start.colorA = a; - end + data.animation.start.colorR = r + data.animation.start.colorG = g + data.animation.start.colorB = b + data.animation.start.colorA = a + end, }, main_header = { type = "header", name = L["Main"], - order = 50 + order = 50, }, main_type = { type = "select", @@ -377,15 +422,19 @@ function OptionsPrivate.GetAnimationOptions(data) name = L["Type"], order = 52, values = anim_types, - disabled = false + disabled = false, }, main_preset = { type = "select", width = WeakAuras.normalWidth, name = L["Preset"], order = 53, - values = function() return filterAnimPresetTypes(anim_main_preset_types, id) end, - hidden = function() return data.animation.main.type ~= "preset" end + values = function() + return filterAnimPresetTypes(anim_main_preset_types, id) + end, + hidden = function() + return data.animation.main.type ~= "preset" + end, }, main_duration_type_no_choice = { type = "select", @@ -394,8 +443,12 @@ function OptionsPrivate.GetAnimationOptions(data) order = 53, values = duration_types_no_choice, disabled = true, - hidden = function() return data.animation.main.type ~= "custom" or OptionsPrivate.Private.CanHaveDuration(data) end, - get = function() return "seconds" end + hidden = function() + return data.animation.main.type ~= "custom" or OptionsPrivate.Private.CanHaveDuration(data) + end, + get = function() + return "seconds" + end, }, main_duration_type = { type = "select", @@ -403,30 +456,34 @@ function OptionsPrivate.GetAnimationOptions(data) name = L["Time in"], order = 53, values = duration_types, - hidden = function() return data.animation.main.type ~= "custom" or not OptionsPrivate.Private.CanHaveDuration(data) end + hidden = function() + return data.animation.main.type ~= "custom" or not OptionsPrivate.Private.CanHaveDuration(data) + end, }, main_duration = { type = "input", width = WeakAuras.halfWidth, name = function() - if(data.animation.main.duration_type == "relative") then - return L["% of Progress"]; + if data.animation.main.duration_type == "relative" then + return L["% of Progress"] else - return L["Duration (s)"]; + return L["Duration (s)"] end end, desc = function() - if(data.animation.main.duration_type == "relative") then - return L["Animation relative duration description"]; + if data.animation.main.duration_type == "relative" then + return L["Animation relative duration description"] else - local ret = ""; - ret = ret..L["The duration of the animation in seconds."].."\n"; - ret = ret..L["Unlike the start or finish animations, the main animation will loop over and over until the display is hidden."] - return ret; + local ret = "" + ret = ret .. L["The duration of the animation in seconds."] .. "\n" + ret = ret .. L["Unlike the start or finish animations, the main animation will loop over and over until the display is hidden."] + return ret end end, order = 53.5, - hidden = function() return data.animation.main.type ~= "custom" end + hidden = function() + return data.animation.main.type ~= "custom" + end, }, main_easeType = { type = "select", @@ -434,7 +491,9 @@ function OptionsPrivate.GetAnimationOptions(data) name = L["Ease type"], values = anim_ease_types, order = 53.7, - hidden = function() return data.animation.main.type ~= "custom" end + hidden = function() + return data.animation.main.type ~= "custom" + end, }, main_easeStrength = { type = "range", @@ -444,15 +503,21 @@ function OptionsPrivate.GetAnimationOptions(data) min = 1, max = 5, bigStep = 1, - hidden = function() return data.animation.main.type ~= "custom" end, - disabled = function() return data.animation.main.easeType == "none" end + hidden = function() + return data.animation.main.type ~= "custom" + end, + disabled = function() + return data.animation.main.easeType == "none" + end, }, main_use_alpha = { type = "toggle", width = WeakAuras.normalWidth, name = L["Fade"], order = 54, - hidden = function() return data.animation.main.type ~= "custom" end + hidden = function() + return data.animation.main.type ~= "custom" + end, }, main_alphaType = { type = "select", @@ -460,7 +525,9 @@ function OptionsPrivate.GetAnimationOptions(data) name = L["Type"], order = 55, values = anim_alpha_types, - hidden = function() return data.animation.main.type ~= "custom" end + hidden = function() + return data.animation.main.type ~= "custom" + end, }, -- texteditor added below main_alpha = { @@ -472,14 +539,18 @@ function OptionsPrivate.GetAnimationOptions(data) max = 1, bigStep = 0.01, isPercent = true, - hidden = function() return data.animation.main.type ~= "custom" end + hidden = function() + return data.animation.main.type ~= "custom" + end, }, main_use_translate = { type = "toggle", width = WeakAuras.normalWidth, name = L["Slide"], order = 58, - hidden = function() return data.animation.main.type ~= "custom" end + hidden = function() + return data.animation.main.type ~= "custom" + end, }, main_translateType = { type = "select", @@ -487,7 +558,9 @@ function OptionsPrivate.GetAnimationOptions(data) name = L["Type"], order = 59, values = anim_translate_types, - hidden = function() return data.animation.main.type ~= "custom" end + hidden = function() + return data.animation.main.type ~= "custom" + end, }, -- texteditor added below main_x = { @@ -499,7 +572,9 @@ function OptionsPrivate.GetAnimationOptions(data) softMax = 200, step = 1, bigStep = 5, - hidden = function() return data.animation.main.type ~= "custom" end + hidden = function() + return data.animation.main.type ~= "custom" + end, }, main_y = { type = "range", @@ -510,14 +585,18 @@ function OptionsPrivate.GetAnimationOptions(data) softMax = 200, step = 1, bigStep = 5, - hidden = function() return data.animation.main.type ~= "custom" end + hidden = function() + return data.animation.main.type ~= "custom" + end, }, main_use_scale = { type = "toggle", width = WeakAuras.normalWidth, name = L["Zoom"], order = 62, - hidden = function() return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Scale) end + hidden = function() + return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Scale) + end, }, main_scaleType = { type = "select", @@ -525,7 +604,9 @@ function OptionsPrivate.GetAnimationOptions(data) name = L["Type"], order = 63, values = anim_scale_types, - hidden = function() return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Scale) end + hidden = function() + return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Scale) + end, }, -- texteditor added below main_scalex = { @@ -537,7 +618,9 @@ function OptionsPrivate.GetAnimationOptions(data) softMax = 5, step = 0.01, bigStep = 0.1, - hidden = function() return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Scale) end + hidden = function() + return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Scale) + end, }, main_scaley = { type = "range", @@ -548,14 +631,18 @@ function OptionsPrivate.GetAnimationOptions(data) softMax = 5, step = 0.01, bigStep = 0.1, - hidden = function() return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Scale) end + hidden = function() + return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Scale) + end, }, main_use_rotate = { type = "toggle", width = WeakAuras.normalWidth, name = L["Rotate"], order = 66, - hidden = function() return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Rotate) end + hidden = function() + return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Rotate) + end, }, main_rotateType = { type = "select", @@ -563,7 +650,9 @@ function OptionsPrivate.GetAnimationOptions(data) name = L["Type"], order = 67, values = anim_rotate_types, - hidden = function() return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Rotate) end + hidden = function() + return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Rotate) + end, }, -- text editor added below main_rotate = { @@ -574,14 +663,18 @@ function OptionsPrivate.GetAnimationOptions(data) softMin = 0, softMax = 360, bigStep = 3, - hidden = function() return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Rotate) end + hidden = function() + return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Rotate) + end, }, main_use_color = { type = "toggle", width = WeakAuras.normalWidth, name = L["Color"], order = 68.2, - hidden = function() return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Color) end + hidden = function() + return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Color) + end, }, main_colorType = { type = "select", @@ -589,7 +682,9 @@ function OptionsPrivate.GetAnimationOptions(data) name = L["Type"], order = 68.5, values = anim_color_types, - hidden = function() return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Color) end + hidden = function() + return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Color) + end, }, -- texteditor added below main_color = { @@ -597,24 +692,23 @@ function OptionsPrivate.GetAnimationOptions(data) width = WeakAuras.doubleWidth, name = L["Color"], order = 69.5, - hidden = function() return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Color) end, + hidden = function() + return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Color) + end, get = function() - return data.animation.main.colorR, - data.animation.main.colorG, - data.animation.main.colorB, - data.animation.main.colorA; + return data.animation.main.colorR, data.animation.main.colorG, data.animation.main.colorB, data.animation.main.colorA end, set = function(info, r, g, b, a) - data.animation.main.colorR = r; - data.animation.main.colorG = g; - data.animation.main.colorB = b; - data.animation.main.colorA = a; - end + data.animation.main.colorR = r + data.animation.main.colorG = g + data.animation.main.colorB = b + data.animation.main.colorA = a + end, }, finish_header = { type = "header", name = L["Finish"], - order = 70 + order = 70, }, finish_type = { type = "select", @@ -622,15 +716,19 @@ function OptionsPrivate.GetAnimationOptions(data) name = L["Type"], order = 72, values = anim_types, - disabled = false + disabled = false, }, finish_preset = { type = "select", width = WeakAuras.normalWidth, name = L["Preset"], order = 73, - values = function() return filterAnimPresetTypes(anim_finish_preset_types, id) end, - hidden = function() return data.animation.finish.type ~= "preset" end + values = function() + return filterAnimPresetTypes(anim_finish_preset_types, id) + end, + hidden = function() + return data.animation.finish.type ~= "preset" + end, }, finish_duration_type_no_choice = { type = "select", @@ -639,8 +737,12 @@ function OptionsPrivate.GetAnimationOptions(data) order = 73, values = duration_types_no_choice, disabled = true, - hidden = function() return data.animation.finish.type ~= "custom" end, - get = function() return "seconds" end + hidden = function() + return data.animation.finish.type ~= "custom" + end, + get = function() + return "seconds" + end, }, finish_duration = { type = "input", @@ -648,7 +750,9 @@ function OptionsPrivate.GetAnimationOptions(data) name = L["Duration (s)"], desc = L["The duration of the animation in seconds. The finish animation does not start playing until after the display would normally be hidden."], order = 73.5, - hidden = function() return data.animation.finish.type ~= "custom" end + hidden = function() + return data.animation.finish.type ~= "custom" + end, }, finish_easeType = { type = "select", @@ -656,7 +760,9 @@ function OptionsPrivate.GetAnimationOptions(data) name = L["Ease type"], values = anim_ease_types, order = 73.7, - hidden = function() return data.animation.finish.type ~= "custom" end + hidden = function() + return data.animation.finish.type ~= "custom" + end, }, finish_easeStrength = { type = "range", @@ -666,15 +772,21 @@ function OptionsPrivate.GetAnimationOptions(data) min = 1, max = 5, bigStep = 1, - hidden = function() return data.animation.finish.type ~= "custom" end, - disabled = function() return data.animation.finish.easeType == "none" end + hidden = function() + return data.animation.finish.type ~= "custom" + end, + disabled = function() + return data.animation.finish.easeType == "none" + end, }, finish_use_alpha = { type = "toggle", width = WeakAuras.normalWidth, name = L["Fade Out"], order = 74, - hidden = function() return data.animation.finish.type ~= "custom" end + hidden = function() + return data.animation.finish.type ~= "custom" + end, }, finish_alphaType = { type = "select", @@ -682,7 +794,9 @@ function OptionsPrivate.GetAnimationOptions(data) name = L["Type"], order = 75, values = anim_alpha_types, - hidden = function() return data.animation.finish.type ~= "custom" end + hidden = function() + return data.animation.finish.type ~= "custom" + end, }, -- texteditor added below finish_alpha = { @@ -694,14 +808,18 @@ function OptionsPrivate.GetAnimationOptions(data) max = 1, bigStep = 0.01, isPercent = true, - hidden = function() return data.animation.finish.type ~= "custom" end + hidden = function() + return data.animation.finish.type ~= "custom" + end, }, finish_use_translate = { type = "toggle", width = WeakAuras.normalWidth, name = L["Slide Out"], order = 78, - hidden = function() return data.animation.finish.type ~= "custom" end + hidden = function() + return data.animation.finish.type ~= "custom" + end, }, finish_translateType = { type = "select", @@ -709,7 +827,9 @@ function OptionsPrivate.GetAnimationOptions(data) name = L["Type"], order = 79, values = anim_translate_types, - hidden = function() return data.animation.finish.type ~= "custom" end + hidden = function() + return data.animation.finish.type ~= "custom" + end, }, -- texteditor added below finish_x = { @@ -721,7 +841,9 @@ function OptionsPrivate.GetAnimationOptions(data) softMax = 200, step = 1, bigStep = 5, - hidden = function() return data.animation.finish.type ~= "custom" end + hidden = function() + return data.animation.finish.type ~= "custom" + end, }, finish_y = { type = "range", @@ -732,14 +854,18 @@ function OptionsPrivate.GetAnimationOptions(data) softMax = 200, step = 1, bigStep = 5, - hidden = function() return data.animation.finish.type ~= "custom" end + hidden = function() + return data.animation.finish.type ~= "custom" + end, }, finish_use_scale = { type = "toggle", width = WeakAuras.normalWidth, name = L["Zoom Out"], order = 82, - hidden = function() return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Scale) end + hidden = function() + return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Scale) + end, }, finish_scaleType = { type = "select", @@ -747,7 +873,9 @@ function OptionsPrivate.GetAnimationOptions(data) name = L["Type"], order = 83, values = anim_scale_types, - hidden = function() return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Scale) end + hidden = function() + return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Scale) + end, }, -- texteditor added below finish_scalex = { @@ -759,7 +887,9 @@ function OptionsPrivate.GetAnimationOptions(data) softMax = 5, step = 0.01, bigStep = 0.1, - hidden = function() return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Scale) end + hidden = function() + return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Scale) + end, }, finish_scaley = { type = "range", @@ -770,14 +900,18 @@ function OptionsPrivate.GetAnimationOptions(data) softMax = 5, step = 0.01, bigStep = 0.1, - hidden = function() return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Scale) end + hidden = function() + return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Scale) + end, }, finish_use_rotate = { type = "toggle", width = WeakAuras.normalWidth, name = L["Rotate Out"], order = 86, - hidden = function() return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Rotate) end + hidden = function() + return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Rotate) + end, }, finish_rotateType = { type = "select", @@ -785,7 +919,9 @@ function OptionsPrivate.GetAnimationOptions(data) name = L["Type"], order = 87, values = anim_rotate_types, - hidden = function() return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Rotate) end + hidden = function() + return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Rotate) + end, }, -- texteditor added below finish_rotate = { @@ -796,14 +932,18 @@ function OptionsPrivate.GetAnimationOptions(data) softMin = 0, softMax = 360, bigStep = 3, - hidden = function() return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Rotate) end + hidden = function() + return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Rotate) + end, }, finish_use_color = { type = "toggle", width = WeakAuras.normalWidth, name = L["Color"], order = 88.2, - hidden = function() return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Color) end + hidden = function() + return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Color) + end, }, finish_colorType = { type = "select", @@ -811,7 +951,9 @@ function OptionsPrivate.GetAnimationOptions(data) name = L["Type"], order = 88.5, values = anim_color_types, - hidden = function() return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Color) end + hidden = function() + return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Color) + end, }, -- texteditor added below finish_color = { @@ -819,28 +961,27 @@ function OptionsPrivate.GetAnimationOptions(data) width = WeakAuras.doubleWidth, name = L["Color"], order = 89.5, - hidden = function() return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Color) end, + hidden = function() + return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Color) + end, get = function() - return data.animation.finish.colorR, - data.animation.finish.colorG, - data.animation.finish.colorB, - data.animation.finish.colorA; + return data.animation.finish.colorR, data.animation.finish.colorG, data.animation.finish.colorB, data.animation.finish.colorA end, set = function(info, r, g, b, a) - data.animation.finish.colorR = r; - data.animation.finish.colorG = g; - data.animation.finish.colorB = b; - data.animation.finish.colorA = a; - end - } - } + data.animation.finish.colorR = r + data.animation.finish.colorG = g + data.animation.finish.colorB = b + data.animation.finish.colorA = a + end, + }, + }, } local function extraSetFunction() - OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, WeakAuras.regions[id].region, false, nil, true); - if(WeakAuras.clones[id]) then + OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, WeakAuras.regions[id].region, false, nil, true) + if WeakAuras.clones[id] then for cloneId, cloneRegion in pairs(WeakAuras.clones[id]) do - OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, cloneRegion, false, nil, true, cloneId); + OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, cloneRegion, false, nil, true, cloneId) end end end @@ -849,114 +990,260 @@ function OptionsPrivate.GetAnimationOptions(data) local function hideStartAlphaFunc() return data.animation.start.type ~= "custom" or data.animation.start.alphaType ~= "custom" or not data.animation.start.use_alpha end - OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_alphaFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#alpha-opacity", - 35.3, hideStartAlphaFunc, {"animation", "start", "alphaFunc"}, false); + OptionsPrivate.commonOptions.AddCodeOption( + animation.args, + data, + L["Custom Function"], + "start_alphaFunc", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#alpha-opacity", + 35.3, + hideStartAlphaFunc, + { "animation", "start", "alphaFunc" }, + false + ) local function hideStartTranslate() return data.animation.start.type ~= "custom" or data.animation.start.translateType ~= "custom" or not data.animation.start.use_translate end - OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_translateFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#translate-position", - 39.3, hideStartTranslate, {"animation", "start", "translateFunc"}, false); + OptionsPrivate.commonOptions.AddCodeOption( + animation.args, + data, + L["Custom Function"], + "start_translateFunc", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#translate-position", + 39.3, + hideStartTranslate, + { "animation", "start", "translateFunc" }, + false + ) local function hideStartScale() return data.animation.start.type ~= "custom" or data.animation.start.scaleType ~= "custom" or not (data.animation.start.use_scale and WeakAuras.regions[id].region.Scale) end - OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_scaleFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#scale-size", - 43.3, hideStartScale, {"animation", "start", "scaleFunc"}, false); + OptionsPrivate.commonOptions.AddCodeOption( + animation.args, + data, + L["Custom Function"], + "start_scaleFunc", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#scale-size", + 43.3, + hideStartScale, + { "animation", "start", "scaleFunc" }, + false + ) local function hideStartRotateFunc() return data.animation.start.type ~= "custom" or data.animation.start.rotateType ~= "custom" or not (data.animation.start.use_rotate and WeakAuras.regions[id].region.Rotate) end - OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_rotateFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#rotate", - 47.3, hideStartRotateFunc, {"animation", "start", "rotateFunc"}, false); + OptionsPrivate.commonOptions.AddCodeOption( + animation.args, + data, + L["Custom Function"], + "start_rotateFunc", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#rotate", + 47.3, + hideStartRotateFunc, + { "animation", "start", "rotateFunc" }, + false + ) local function hideStartColorFunc() return data.animation.start.type ~= "custom" or data.animation.start.colorType ~= "custom" or not (data.animation.start.use_color and WeakAuras.regions[id].region.Color) end - OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_colorFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#color", - 48.7, hideStartColorFunc, {"animation", "start", "colorFunc"}, false); + OptionsPrivate.commonOptions.AddCodeOption( + animation.args, + data, + L["Custom Function"], + "start_colorFunc", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#color", + 48.7, + hideStartColorFunc, + { "animation", "start", "colorFunc" }, + false + ) -- Text Editors for "main" local function hideMainAlphaFunc() return data.animation.main.type ~= "custom" or data.animation.main.alphaType ~= "custom" or not data.animation.main.use_alpha end local mainCodeOptions = { extraSetFunction = extraSetFunction } - OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_alphaFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#alpha-opacity", - 55.3, hideMainAlphaFunc, {"animation", "main", "alphaFunc"}, false, mainCodeOptions); + OptionsPrivate.commonOptions.AddCodeOption( + animation.args, + data, + L["Custom Function"], + "main_alphaFunc", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#alpha-opacity", + 55.3, + hideMainAlphaFunc, + { "animation", "main", "alphaFunc" }, + false, + mainCodeOptions + ) local function hideMainTranslate() return data.animation.main.type ~= "custom" or data.animation.main.translateType ~= "custom" or not data.animation.main.use_translate end - OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_translateFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#translate-position", - 59.3, hideMainTranslate, {"animation", "main", "translateFunc"}, false, mainCodeOptions); + OptionsPrivate.commonOptions.AddCodeOption( + animation.args, + data, + L["Custom Function"], + "main_translateFunc", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#translate-position", + 59.3, + hideMainTranslate, + { "animation", "main", "translateFunc" }, + false, + mainCodeOptions + ) local function hideMainScale() return data.animation.main.type ~= "custom" or data.animation.main.scaleType ~= "custom" or not (data.animation.main.use_scale and WeakAuras.regions[id].region.Scale) end - OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_scaleFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#scale-sizes", - 63.3, hideMainScale, {"animation", "main", "scaleFunc"}, false, mainCodeOptions); + OptionsPrivate.commonOptions.AddCodeOption( + animation.args, + data, + L["Custom Function"], + "main_scaleFunc", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#scale-sizes", + 63.3, + hideMainScale, + { "animation", "main", "scaleFunc" }, + false, + mainCodeOptions + ) local function hideMainRotateFunc() return data.animation.main.type ~= "custom" or data.animation.main.rotateType ~= "custom" or not (data.animation.main.use_rotate and WeakAuras.regions[id].region.Rotate) end - OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_rotateFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#rotate", - 67.3, hideMainRotateFunc, {"animation", "main", "rotateFunc"}, false, mainCodeOptions); + OptionsPrivate.commonOptions.AddCodeOption( + animation.args, + data, + L["Custom Function"], + "main_rotateFunc", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#rotate", + 67.3, + hideMainRotateFunc, + { "animation", "main", "rotateFunc" }, + false, + mainCodeOptions + ) local function hideMainColorFunc() return data.animation.main.type ~= "custom" or data.animation.main.colorType ~= "custom" or not (data.animation.main.use_color and WeakAuras.regions[id].region.Color) end - OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_colorFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#color", - 68.7, hideMainColorFunc, {"animation", "main", "colorFunc"}, false, mainCodeOptions); + OptionsPrivate.commonOptions.AddCodeOption( + animation.args, + data, + L["Custom Function"], + "main_colorFunc", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#color", + 68.7, + hideMainColorFunc, + { "animation", "main", "colorFunc" }, + false, + mainCodeOptions + ) -- Text Editors for "finish" local function hideFinishAlphaFunc() return data.animation.finish.type ~= "custom" or data.animation.finish.alphaType ~= "custom" or not data.animation.finish.use_alpha end - OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_alphaFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#alpha-opacity", - 75.3, hideFinishAlphaFunc, {"animation", "finish", "alphaFunc"}, false); + OptionsPrivate.commonOptions.AddCodeOption( + animation.args, + data, + L["Custom Function"], + "finish_alphaFunc", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#alpha-opacity", + 75.3, + hideFinishAlphaFunc, + { "animation", "finish", "alphaFunc" }, + false + ) local function hideFinishTranslate() return data.animation.finish.type ~= "custom" or data.animation.finish.translateType ~= "custom" or not data.animation.finish.use_translate end - OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_translateFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#translate-position", - 79.3, hideFinishTranslate, {"animation", "finish", "translateFunc"}, false); + OptionsPrivate.commonOptions.AddCodeOption( + animation.args, + data, + L["Custom Function"], + "finish_translateFunc", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#translate-position", + 79.3, + hideFinishTranslate, + { "animation", "finish", "translateFunc" }, + false + ) local function hideFinishScale() return data.animation.finish.type ~= "custom" or data.animation.finish.scaleType ~= "custom" or not (data.animation.finish.use_scale and WeakAuras.regions[id].region.Scale) end - OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_scaleFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#scale-size", - 83.3, hideFinishScale, {"animation", "finish", "scaleFunc"}, false); + OptionsPrivate.commonOptions.AddCodeOption( + animation.args, + data, + L["Custom Function"], + "finish_scaleFunc", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#scale-size", + 83.3, + hideFinishScale, + { "animation", "finish", "scaleFunc" }, + false + ) local function hideFinishRotateFunc() return data.animation.finish.type ~= "custom" or data.animation.finish.rotateType ~= "custom" or not (data.animation.finish.use_rotate and WeakAuras.regions[id].region.Rotate) end - OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_rotateFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#rotate", - 87.3, hideFinishRotateFunc, {"animation", "finish", "rotateFunc"}, false); + OptionsPrivate.commonOptions.AddCodeOption( + animation.args, + data, + L["Custom Function"], + "finish_rotateFunc", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#rotate", + 87.3, + hideFinishRotateFunc, + { "animation", "finish", "rotateFunc" }, + false + ) local function hideFinishColorFunc() return data.animation.finish.type ~= "custom" or data.animation.finish.colorType ~= "custom" or not (data.animation.finish.use_color and WeakAuras.regions[id].region.Color) end - OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_colorFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#color", - 88.7, hideFinishColorFunc, {"animation", "finish", "colorFunc"}, false); + OptionsPrivate.commonOptions.AddCodeOption( + animation.args, + data, + L["Custom Function"], + "finish_colorFunc", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#color", + 88.7, + hideFinishColorFunc, + { "animation", "finish", "colorFunc" }, + false + ) - if(data.controlledChildren) then - removeFuncs(animation); - replaceNameDescFuncs(animation, data, "animation"); - replaceImageFuncs(animation, data, "animation"); - replaceValuesFuncs(animation, data, "animation"); + if data.controlledChildren then + removeFuncs(animation) + replaceNameDescFuncs(animation, data, "animation") + replaceImageFuncs(animation, data, "animation") + replaceValuesFuncs(animation, data, "animation") - animation.get = function(info, ...) return getAll(data, info, ...); end; + animation.get = function(info, ...) + return getAll(data, info, ...) + end animation.set = function(info, ...) - setAll(data, info, ...); - if(type(data.id) == "string") then - WeakAuras.Add(data); - WeakAuras.UpdateThumbnail(data); - OptionsPrivate.ResetMoverSizer(); + setAll(data, info, ...) + if type(data.id) == "string" then + WeakAuras.Add(data) + WeakAuras.UpdateThumbnail(data) + OptionsPrivate.ResetMoverSizer() end end - animation.hidden = function(info, ...) return hiddenAll(data, info, ...); end; - animation.disabled = function(info, ...) return disabledAll(data, info, ...); end; + animation.hidden = function(info, ...) + return hiddenAll(data, info, ...) + end + animation.disabled = function(info, ...) + return disabledAll(data, info, ...) + end end - return animation; + return animation end diff --git a/WeakAurasOptions/AuthorOptions.lua b/WeakAurasOptions/AuthorOptions.lua index cf04cce9a0..bd5d292107 100644 --- a/WeakAurasOptions/AuthorOptions.lua +++ b/WeakAurasOptions/AuthorOptions.lua @@ -58,7 +58,9 @@ bigStep (optional) -> step size of the slider. Defaults to 0.05 step (optional) -> like bigStep, but applies to number input as well ]] -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... local WeakAuras = WeakAuras @@ -179,10 +181,7 @@ local function desc(option, key, phrase) local childOption = optionData.options[optionData.index] local childData = optionData.data if childOption[key] ~= nil then - tinsert( - desc, - ("%s #%i: %s"):format(childData.id, optionData.path[#optionData.path], tostring(childOption[key])) - ) + tinsert(desc, ("%s #%i: %s"):format(childData.id, optionData.path[#optionData.path], tostring(childOption[key]))) end end return tconcat(desc, "\n") @@ -192,7 +191,7 @@ end local function descType(option) local desc = { L["This setting controls what widget is generated in user mode."], - L["Used in Auras:"] + L["Used in Auras:"], } for id, optionData in pairs(option.references) do tinsert(desc, ("%s - Option %i"):format(id, optionData.path[#optionData.path])) @@ -204,14 +203,11 @@ local function descSelect(option, key) if option.values then return "" else - local desc = {L["Values:"]} + local desc = { L["Values:"] } for id, optionData in pairs(option.references) do local childOption = optionData.options[optionData.index] if childOption.values[key] ~= nil then - tinsert( - desc, - ("%s %i: - %s"):format(id, optionData.path[#optionData.path], tostring(childOption.values[key])) - ) + tinsert(desc, ("%s %i: - %s"):format(id, optionData.path[#optionData.path], tostring(childOption.values[key]))) end end return tconcat(desc, "\n") @@ -224,19 +220,12 @@ local function descColor(option, key) else local desc = { L["Values are in normalized rgba format."], - L["Values:"] + L["Values:"], } for id, optionData in pairs(option.references) do local childOption = optionData.options[optionData.index] if childOption[key] ~= nil then - tinsert( - desc, - ("%s #%i: %.2f %.2f %.2f %.2f"):format( - id, - childOption.path[#childOption.path], - unpack(childOption[key]) - ) - ) + tinsert(desc, ("%s #%i: %.2f %.2f %.2f %.2f"):format(id, childOption.path[#childOption.path], unpack(childOption[key]))) end end return tconcat(desc, "\n") @@ -259,7 +248,7 @@ local function descUser(option) end local function descArray(option, array, index, phrase) - local desc, values, isConflict = {phrase}, {}, false + local desc, values, isConflict = { phrase }, {}, false local initialValue = nil for id, optionData in pairs(option.references) do local childOption = optionData.options[optionData.index] @@ -272,7 +261,7 @@ local function descArray(option, array, index, phrase) end if isConflict then for id, value in pairs(values) do - tinsert(desc, ("%s - %s"):format(id, value)) + tinsert(desc, ("%s - %s"):format(id, value)) end end return tconcat(desc, "\n") @@ -390,7 +379,7 @@ end local function getArrayStr(option, array, index) return function() if option[array][index] then - return option[array][index]:gsub("|","||") + return option[array][index]:gsub("|", "||") else return "" end @@ -464,7 +453,9 @@ local function setUserNum(data, option) return function(_, value) if value ~= "" then local num = tonumber(value) - if not num or math.abs(num) == math.huge or tostring(num) == "nan" then return end + if not num or math.abs(num) == math.huge or tostring(num) == "nan" then + return + end for _, optionData in pairs(option.references) do local childData = optionData.data local childConfig = optionData.config @@ -478,7 +469,7 @@ end local function setColor(data, option, key) return function(_, r, g, b, a) - local color = {r, g, b, a} + local color = { r, g, b, a } for id, optionData in pairs(option.references) do local childOption = optionData.options[optionData.index] local childData = optionData.data @@ -491,7 +482,7 @@ end local function setUserColor(data, option) return function(_, r, g, b, a) - local color = {r, g, b, a} + local color = { r, g, b, a } for id, optionData in pairs(option.references) do local childData = optionData.data local childConfig = optionData.config @@ -516,7 +507,7 @@ end local function setArrayStr(data, option, array, index) return function(_, value) - value = value:gsub("||","|") + value = value:gsub("||", "|") for id, optionData in pairs(option.references) do local childOption = optionData.options[optionData.index] local childData = optionData.data @@ -581,7 +572,7 @@ typeControlAdders = { WeakAuras.Add(childData) end WeakAuras.ClearAndUpdateOptions(data.id, true) - end + end, } end, input = function(options, args, data, order, prefix, i) @@ -593,7 +584,7 @@ typeControlAdders = { desc = desc(option, "default"), order = order(), get = get(option, "default"), - set = set(data, option, "default") + set = set(data, option, "default"), } args[prefix .. "useLength"] = { type = "toggle", @@ -602,7 +593,7 @@ typeControlAdders = { desc = desc(option, "useLength"), order = order(), get = get(option, "useLength"), - set = set(data, option, "useLength") + set = set(data, option, "useLength"), } args[prefix .. "length"] = { type = "range", @@ -617,7 +608,7 @@ typeControlAdders = { set = set(data, option, "length"), disabled = function() return not option.useLength - end + end, } args[prefix .. "multiline"] = { type = "toggle", @@ -638,7 +629,7 @@ typeControlAdders = { desc = desc(option, "default"), order = order(), get = getNumAsString(option, "default"), - set = setNum(data, option, "default", true) + set = setNum(data, option, "default", true), } args[prefix .. "min"] = { type = "input", @@ -647,7 +638,7 @@ typeControlAdders = { desc = desc(option, "min"), order = order(), get = getNumAsString(option, "min"), - set = setNum(data, option, "min") + set = setNum(data, option, "min"), } args[prefix .. "max"] = { type = "input", @@ -656,7 +647,7 @@ typeControlAdders = { desc = desc(option, "min"), order = order(), get = getNumAsString(option, "max"), - set = setNum(data, option, "max") + set = setNum(data, option, "max"), } args[prefix .. "step"] = { type = "input", @@ -665,7 +656,7 @@ typeControlAdders = { desc = desc(option, "step"), order = order(), get = getNumAsString(option, "step"), - set = setNum(data, option, "step") + set = setNum(data, option, "step"), } end, range = function(options, args, data, order, prefix, i) @@ -678,7 +669,7 @@ typeControlAdders = { max = option.max local effectiveMin = softMin or min or 0 local effectiveMax = softMax or max or 100 - if (effectiveMin > effectiveMax) then + if effectiveMin > effectiveMax then -- This will cause a error inside the slider -- Fix up either softMax or max, depending on which one is the effective one if softMax then @@ -713,7 +704,7 @@ typeControlAdders = { desc = desc(option, "min"), order = order(), get = getNumAsString(option, "min"), - set = setNum(data, option, "min") + set = setNum(data, option, "min"), } args[prefix .. "max"] = { @@ -723,7 +714,7 @@ typeControlAdders = { desc = desc(option, "max"), order = order(), get = getNumAsString(option, "max"), - set = setNum(data, option, "max") + set = setNum(data, option, "max"), } args[prefix .. "step"] = { @@ -733,7 +724,7 @@ typeControlAdders = { desc = desc(option, "step"), order = order(), get = getNumAsString(option, "step"), - set = setNum(data, option, "step") + set = setNum(data, option, "step"), } args[prefix .. "softmin"] = { @@ -743,7 +734,7 @@ typeControlAdders = { desc = desc(option, "softMin"), order = order(), get = getNumAsString(option, "softMin"), - set = setNum(data, option, "softMin") + set = setNum(data, option, "softMin"), } args[prefix .. "softmax"] = { @@ -753,7 +744,7 @@ typeControlAdders = { desc = desc(option, "softMax"), order = order(), get = getNumAsString(option, "softMax"), - set = setNum(data, option, "softMax") + set = setNum(data, option, "softMax"), } args[prefix .. "bigstep"] = { @@ -763,7 +754,7 @@ typeControlAdders = { desc = desc(option, "bigStep"), order = order(), get = getNumAsString(option, "bigStep"), - set = setNum(data, option, "bigStep") + set = setNum(data, option, "bigStep"), } end, description = function(options, args, data, order, prefix, i) @@ -778,7 +769,7 @@ typeControlAdders = { order = order(), values = OptionsPrivate.Private.font_sizes, get = get(option, "fontSize"), - set = set(data, option, "fontSize") + set = set(data, option, "fontSize"), } args[prefix .. "descinput"] = { type = "input", @@ -788,7 +779,7 @@ typeControlAdders = { order = order(), multiline = true, get = getStr(option, "text"), - set = setStr(data, option, "text") + set = setStr(data, option, "text"), } end, color = function(options, args, data, order, prefix, i) @@ -801,7 +792,7 @@ typeControlAdders = { desc = descColor(option, "default"), order = order(), get = getColor(option, "default"), - set = setColor(data, option, "default") + set = setColor(data, option, "default"), } end, select = function(options, args, data, order, prefix, i) @@ -823,7 +814,7 @@ typeControlAdders = { order = order(), values = defaultValues, get = get(option, "default"), - set = setSelectDefault(data, option) + set = setSelectDefault(data, option), } for j, value in ipairs(values) do args[prefix .. "space" .. j] = { @@ -837,8 +828,7 @@ typeControlAdders = { get = function() return true end, - set = function() - end + set = function() end, } args[prefix .. "value" .. j] = { type = "input", @@ -865,7 +855,7 @@ typeControlAdders = { WeakAuras.Add(childData) end WeakAuras.ClearAndUpdateOptions(data.id, true) - end + end, } args[prefix .. "valdelete" .. j] = { type = "execute", @@ -884,7 +874,7 @@ typeControlAdders = { image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\delete", imageWidth = 24, imageHeight = 24, - control = "WeakAurasIcon" + control = "WeakAurasIcon", } end args[prefix .. "newvaluespace"] = { @@ -898,8 +888,7 @@ typeControlAdders = { get = function() return true end, - set = function() - end + set = function() end, } args[prefix .. "newvalue"] = { type = "input", @@ -918,7 +907,7 @@ typeControlAdders = { WeakAuras.Add(childData) end WeakAuras.ClearAndUpdateOptions(data.id, true) - end + end, } end, space = function(options, args, data, order, prefix, i) @@ -929,13 +918,9 @@ typeControlAdders = { width = WeakAuras.normalWidth, order = order(), name = name(option, "variableWidth", L["Width"]), - desc = desc( - option, - "variableWidth", - L["If unchecked, then this space will fill the entire line it is on in User Mode."] - ), + desc = desc(option, "variableWidth", L["If unchecked, then this space will fill the entire line it is on in User Mode."]), get = get(option, "variableWidth"), - set = set(data, option, "variableWidth") + set = set(data, option, "variableWidth"), } args[prefix .. "widthSpace"] = nil @@ -953,7 +938,7 @@ typeControlAdders = { name = name(option, "useHeight", L["Height"]), desc = desc(option, "useHeight", L["If checked, then this space will span across multiple lines."]), get = get(option, "useHeight"), - set = set(data, option, "useHeight") + set = set(data, option, "useHeight"), } args[prefix .. "height"] = { @@ -969,7 +954,7 @@ typeControlAdders = { end, min = 1, softMax = 10, - step = 1 + step = 1, } end, multiselect = function(options, args, data, order, prefix, i) @@ -1000,7 +985,7 @@ typeControlAdders = { WeakAuras.Add(childData) end WeakAuras.ClearAndUpdateOptions(data.id, true) - end + end, } for j, value in ipairs(values) do args[prefix .. "space" .. j] = { @@ -1014,8 +999,7 @@ typeControlAdders = { get = function() return true end, - set = function() - end + set = function() end, } args[prefix .. "value" .. j] = { type = "input", @@ -1043,7 +1027,7 @@ typeControlAdders = { WeakAuras.Add(childData) end WeakAuras.ClearAndUpdateOptions(data.id, true) - end + end, } args[prefix .. "valdelete" .. j] = { type = "execute", @@ -1062,7 +1046,7 @@ typeControlAdders = { end, image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\delete", imageWidth = 24, - imageHeight = 24 + imageHeight = 24, } end args[prefix .. "newvaluespace"] = { @@ -1076,8 +1060,7 @@ typeControlAdders = { get = function() return true end, - set = function() - end + set = function() end, } args[prefix .. "newvalue"] = { type = "input", @@ -1097,7 +1080,7 @@ typeControlAdders = { WeakAuras.Add(childData) end WeakAuras.ClearAndUpdateOptions(data.id, true) - end + end, } end, header = function(options, args, data, order, prefix, i) @@ -1106,15 +1089,11 @@ typeControlAdders = { args[prefix .. "useName"] = { type = "toggle", name = name(option, "useName", L["Separator text"]), - desc = desc( - option, - "useName", - L["If checked, then this separator will include text. Otherwise, it will be just a horizontal line."] - ), + desc = desc(option, "useName", L["If checked, then this separator will include text. Otherwise, it will be just a horizontal line."]), order = order(), width = WeakAuras.normalWidth, get = get(option, "useName"), - set = set(data, option, "useName") + set = set(data, option, "useName"), } args[prefix .. "text"] = { type = "input", @@ -1126,7 +1105,7 @@ typeControlAdders = { set = setStr(data, option, "text"), disabled = function() return not option.useName - end + end, } args[prefix .. "noMerge"] = { type = "toggle", @@ -1156,7 +1135,7 @@ typeControlAdders = { WeakAuras.Add(childData) end WeakAuras.ClearAndUpdateOptions(data.id, true) - end + end, } args[prefix .. "useCollapse"] = { type = "toggle", @@ -1184,7 +1163,9 @@ typeControlAdders = { end WeakAuras.ClearAndUpdateOptions(data.id, true) end, - disabled = function() return not option.useCollapse end + disabled = function() + return not option.useCollapse + end, } args[prefix .. "noMerge"] = { type = "toggle", @@ -1195,7 +1176,7 @@ typeControlAdders = { get = get(option, "noMerge"), set = set(data, option, "noMerge"), } - if option.groupType ~="simple" then + if option.groupType ~= "simple" then args[prefix .. "limitType"] = { type = "select", name = name(option, "limitType", L["Number of Entries"]), @@ -1248,7 +1229,9 @@ typeControlAdders = { end WeakAuras.ClearAndUpdateOptions(data.id, true) end, - disabled = function() return option.limitType == "none" end, + disabled = function() + return option.limitType == "none" + end, } args[prefix .. "hideReorder"] = { type = "toggle", @@ -1335,7 +1318,7 @@ typeControlAdders = { args[prefix .. "groupStart"] = { type = "header", name = L["Start of %s"]:format(option.name), - order = order() + order = order(), } local subPrefix = prefix .. "option" for subIndex, subOption in ipairs(option.subOptions) do @@ -1368,14 +1351,14 @@ typeControlAdders = { WeakAuras.Add(childData) end WeakAuras.ClearAndUpdateOptions(data.id, true) - end + end, } args[prefix .. "groupEnd"] = { type = "header", name = L["End of %s"]:format(option.name), - order = order() + order = order(), } - end + end, } local function up(data, options, index) @@ -1386,26 +1369,27 @@ local function up(data, options, index) return true end end - end, function() - for id, optionData in pairs(option.references) do - -- move the option up in the subOptions - local path = optionData.path - local optionID = optionData.index - local childData = optionData.data - local childOptions = optionData.options - local parent = optionData.parent - if parent and parent.groupType == "array" then - local dereferencedParent = parent.references[id].options[parent.references[id].index] - if dereferencedParent.nameSource == optionID then - dereferencedParent.nameSource = optionID - 1 + end, + function() + for id, optionData in pairs(option.references) do + -- move the option up in the subOptions + local path = optionData.path + local optionID = optionData.index + local childData = optionData.data + local childOptions = optionData.options + local parent = optionData.parent + if parent and parent.groupType == "array" then + local dereferencedParent = parent.references[id].options[parent.references[id].index] + if dereferencedParent.nameSource == optionID then + dereferencedParent.nameSource = optionID - 1 + end end + OptionsPrivate.MoveCollapseDataUp(id, "author", path) + childOptions[optionID], childOptions[optionID - 1] = childOptions[optionID - 1], childOptions[optionID] + WeakAuras.Add(childData) end - OptionsPrivate.MoveCollapseDataUp(id, "author", path) - childOptions[optionID], childOptions[optionID - 1] = childOptions[optionID - 1], childOptions[optionID] - WeakAuras.Add(childData) + WeakAuras.ClearAndUpdateOptions(data.id, true) end - WeakAuras.ClearAndUpdateOptions(data.id, true) - end end local function down(data, options, index) @@ -1416,26 +1400,27 @@ local function down(data, options, index) return true end end - end, function() - for id, optionData in pairs(option.references) do - -- move the option down in the subOptions - local path = optionData.path - local optionID = optionData.index - local childData = optionData.data - local parent = optionData.parent - if parent and parent.groupType == "array" then - local dereferencedParent = parent.references[id].options[parent.references[id].index] - if dereferencedParent.nameSource == optionID then - dereferencedParent.nameSource = optionID + 1 + end, + function() + for id, optionData in pairs(option.references) do + -- move the option down in the subOptions + local path = optionData.path + local optionID = optionData.index + local childData = optionData.data + local parent = optionData.parent + if parent and parent.groupType == "array" then + local dereferencedParent = parent.references[id].options[parent.references[id].index] + if dereferencedParent.nameSource == optionID then + dereferencedParent.nameSource = optionID + 1 + end end + local childOptions = optionData.options + OptionsPrivate.MoveCollapseDataDown(id, "author", path) + childOptions[optionID], childOptions[optionID + 1] = childOptions[optionID + 1], childOptions[optionID] + WeakAuras.Add(childData) end - local childOptions = optionData.options - OptionsPrivate.MoveCollapseDataDown(id, "author", path) - childOptions[optionID], childOptions[optionID + 1] = childOptions[optionID + 1], childOptions[optionID] - WeakAuras.Add(childData) + WeakAuras.ClearAndUpdateOptions(data.id, true) end - WeakAuras.ClearAndUpdateOptions(data.id, true) - end end local function duplicate(data, options, index) @@ -1519,8 +1504,7 @@ function addAuthorModeOption(options, args, data, order, prefix, i) buttonWidth = buttonWidth + 0.15 end local optionClass = OptionsPrivate.Private.author_option_classes[option.type] - local optionName = optionClass == "noninteractive" and OptionsPrivate.Private.author_option_types[option.type] - or option.name + local optionName = optionClass == "noninteractive" and OptionsPrivate.Private.author_option_types[option.type] or option.name args[prefix .. "collapse"] = { type = "execute", @@ -1533,11 +1517,10 @@ function addAuthorModeOption(options, args, data, order, prefix, i) end WeakAuras.ClearAndUpdateOptions(data.id, true) end, - image = collapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\expand" or - "Interface\\AddOns\\WeakAuras\\Media\\Textures\\collapse", + image = collapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\expand" or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\collapse", imageWidth = 18, imageHeight = 18, - control = "WeakAurasExpand" + control = "WeakAurasExpand", } args[prefix .. "upAndIn"] = { @@ -1545,7 +1528,9 @@ function addAuthorModeOption(options, args, data, order, prefix, i) width = 0.15, name = L["Move Into Above Group"], order = order(), - hidden = function() return not isBelowGroup end, + hidden = function() + return not isBelowGroup + end, func = function() for id, optionData in pairs(option.references) do local groupData = optionAbove.references[id] @@ -1568,14 +1553,16 @@ function addAuthorModeOption(options, args, data, order, prefix, i) image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\upright", imageWidth = 24, imageHeight = 24, - control = "WeakAurasIcon" + control = "WeakAurasIcon", } args[prefix .. "downAndIn"] = { type = "execute", width = 0.15, name = L["Move Into Below Group"], order = order(), - hidden = function() return not isAboveGroup end, + hidden = function() + return not isAboveGroup + end, func = function() for id, optionData in pairs(option.references) do local groupData = optionBelow.references[id] @@ -1598,7 +1585,7 @@ function addAuthorModeOption(options, args, data, order, prefix, i) image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\downright", imageWidth = 24, imageHeight = 24, - control = "WeakAurasIcon" + control = "WeakAurasIcon", } args[prefix .. "upAndOut"] = { @@ -1606,7 +1593,9 @@ function addAuthorModeOption(options, args, data, order, prefix, i) width = 0.15, name = L["Move Above Group"], order = order(), - hidden = function() return not isInGroup end, + hidden = function() + return not isInGroup + end, func = function() for id, optionData in pairs(option.references) do local path = optionData.path @@ -1633,14 +1622,16 @@ function addAuthorModeOption(options, args, data, order, prefix, i) image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\upleft", imageWidth = 24, imageHeight = 24, - control = "WeakAurasIcon" + control = "WeakAurasIcon", } args[prefix .. "downAndOut"] = { type = "execute", width = 0.15, name = L["Move Below Group"], order = order(), - hidden = function() return not isInGroup end, + hidden = function() + return not isInGroup + end, func = function() for id, optionData in pairs(option.references) do local path = optionData.path @@ -1668,7 +1659,7 @@ function addAuthorModeOption(options, args, data, order, prefix, i) image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\downleft", imageWidth = 24, imageHeight = 24, - control = "WeakAurasIcon" + control = "WeakAurasIcon", } local upDisable, upFunc = up(data, options, i) args[prefix .. "up"] = { @@ -1681,7 +1672,7 @@ function addAuthorModeOption(options, args, data, order, prefix, i) image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\moveup", imageWidth = 24, imageHeight = 24, - control = "WeakAurasIcon" + control = "WeakAurasIcon", } local downDisable, downFunc = down(data, options, i) @@ -1695,7 +1686,7 @@ function addAuthorModeOption(options, args, data, order, prefix, i) image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\movedown", imageWidth = 24, imageHeight = 24, - control = "WeakAurasIcon" + control = "WeakAurasIcon", } args[prefix .. "duplicate"] = { @@ -1707,7 +1698,7 @@ function addAuthorModeOption(options, args, data, order, prefix, i) image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\duplicate", imageWidth = 24, imageHeight = 24, - control = "WeakAurasIcon" + control = "WeakAurasIcon", } args[prefix .. "delete"] = { @@ -1736,10 +1727,12 @@ function addAuthorModeOption(options, args, data, order, prefix, i) image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\delete", imageWidth = 24, imageHeight = 24, - control = "WeakAurasIcon" + control = "WeakAurasIcon", } - if collapsed then return end + if collapsed then + return + end args[prefix .. "type"] = { type = "select", @@ -1808,7 +1801,7 @@ function addAuthorModeOption(options, args, data, order, prefix, i) WeakAuras.Add(childData) end WeakAuras.ClearAndUpdateOptions(data.id, true) - end + end, } if optionClass ~= "noninteractive" then @@ -1819,7 +1812,7 @@ function addAuthorModeOption(options, args, data, order, prefix, i) desc = desc(option, "name"), order = order(), get = getStr(option, "name"), - set = setStr(data, option, "name") + set = setStr(data, option, "name"), } args[prefix .. "key"] = { @@ -1829,7 +1822,7 @@ function addAuthorModeOption(options, args, data, order, prefix, i) order = order(), validate = validateNonDuplicateKey(option), get = get(option, "key"), - set = set(data, option, "key") + set = set(data, option, "key"), } end @@ -1838,7 +1831,7 @@ function addAuthorModeOption(options, args, data, order, prefix, i) type = "description", width = WeakAuras.doubleWidth, name = "", - order = order + order = order, } args[prefix .. "usetooltip"] = { type = "toggle", @@ -1846,7 +1839,7 @@ function addAuthorModeOption(options, args, data, order, prefix, i) order = order(), width = WeakAuras.halfWidth, get = get(option, "useDesc"), - set = set(data, option, "useDesc") + set = set(data, option, "useDesc"), } args[prefix .. "tooltip"] = { type = "input", @@ -1858,7 +1851,7 @@ function addAuthorModeOption(options, args, data, order, prefix, i) set = setStr(data, option, "desc"), disabled = function() return not option.useDesc - end + end, } end @@ -1872,7 +1865,7 @@ function addAuthorModeOption(options, args, data, order, prefix, i) max = 2, step = 0.05, get = get(option, "width"), - set = set(data, option, "width") + set = set(data, option, "width"), } local addControlsForType = typeControlAdders[option.type] @@ -1925,14 +1918,14 @@ local function addUserModeOption(options, args, data, order, prefix, i) width = (option.width or 1) * WeakAuras.normalWidth, order = order(), get = getUser(option), - set = setUser(data, option) + set = setUser(data, option), } elseif optionClass == "noninteractive" then userOption = { type = "description", order = order(), name = "", - width = (option.width or 1) * WeakAuras.normalWidth + width = (option.width or 1) * WeakAuras.normalWidth, } elseif optionClass == "group" then local collapsed = false @@ -1958,11 +1951,10 @@ local function addUserModeOption(options, args, data, order, prefix, i) end WeakAuras.ClearAndUpdateOptions(data.id, true) end, - image = collapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\expand" or - "Interface\\AddOns\\WeakAuras\\Media\\Textures\\collapse", + image = collapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\expand" or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\collapse", imageWidth = 18, imageHeight = 18, - control = "WeakAurasExpand" + control = "WeakAurasExpand", } end if not collapsed then @@ -2075,7 +2067,7 @@ local function addUserModeOption(options, args, data, order, prefix, i) image = "Interface\\Addons\\WeakAuras\\Media\\Textures\\reset", imageWidth = 18, imageHeight = 18, - control = "WeakAurasIcon" + control = "WeakAurasIcon", } if option.limitType ~= "fixed" then args[prefix .. "createEntry"] = { @@ -2113,7 +2105,7 @@ local function addUserModeOption(options, args, data, order, prefix, i) image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\add", imageWidth = 18, imageHeight = 18, - control = "WeakAurasIcon" + control = "WeakAurasIcon", } args[prefix .. "deleteEntry"] = { type = "execute", @@ -2141,7 +2133,7 @@ local function addUserModeOption(options, args, data, order, prefix, i) image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\delete", imageWidth = 18, imageHeight = 18, - control = "WeakAurasIcon" + control = "WeakAurasIcon", } end if option.nameSource ~= -1 and not option.hideReorder then @@ -2174,7 +2166,7 @@ local function addUserModeOption(options, args, data, order, prefix, i) image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\moveup", imageWidth = 18, imageHeight = 18, - control = "WeakAurasIcon" + control = "WeakAurasIcon", } args[prefix .. "moveEntryDown"] = { type = "execute", @@ -2208,7 +2200,7 @@ local function addUserModeOption(options, args, data, order, prefix, i) image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\movedown", imageWidth = 18, imageHeight = 18, - control = "WeakAurasIcon" + control = "WeakAurasIcon", } end end @@ -2240,7 +2232,7 @@ local function addUserModeOption(options, args, data, order, prefix, i) userOption.max = option.max local effectiveMin = userOption.softMin or userOption.min or 0 local effectiveMax = userOption.softMax or userOption.max or 100 - if (effectiveMin > effectiveMax) then + if effectiveMin > effectiveMax then -- This will cause a error inside the slider -- Fix up either softMax or max, depending on which one is the effective one if userOption.softMax then @@ -2323,7 +2315,7 @@ local function initReferences(mergedOption, data, options, index, config, path, config = config, path = path, parent = parent, - } + }, } if mergedOption.subOptions then local subConfig @@ -2361,7 +2353,7 @@ local significantFieldsForMerge = { -- these fields are special cases, generally reserved for when the UI displays something based on the merged options -- e.g. array name source displays options in merged order, so the dereferenced source is not useful at that level. local specialCasesForMerge = { - nameSource = true + nameSource = true, } local function mergeOptions(mergedOptions, data, options, config, prepath, parent) @@ -2540,7 +2532,7 @@ function OptionsPrivate.GetAuthorOptions(data) type = "group", name = L["Custom Options"], order = 100, - args = {} + args = {}, } local args = authorOptions.args local isAuthorMode = true @@ -2565,12 +2557,12 @@ function OptionsPrivate.GetAuthorOptions(data) -- no need to add, author mode is picked up by ClearAndUpdateOptions end WeakAuras.ClearAndUpdateOptions(data.id, true) - end + end, } args["enterUserModeSpacer"] = { type = "description", name = "", - order = order() + order = order(), } for i = 1, #options do addAuthorModeOption(options, args, data, order, "option" .. i, i) @@ -2595,7 +2587,7 @@ function OptionsPrivate.GetAuthorOptions(data) WeakAuras.Add(child) end WeakAuras.ClearAndUpdateOptions(data.id, true) - end + end, } else for i = 1, #options do @@ -2604,7 +2596,7 @@ function OptionsPrivate.GetAuthorOptions(data) args["userConfigFooter"] = { type = "header", name = "", - order = order() + order = order(), } args["resetToDefault"] = { type = "execute", @@ -2624,16 +2616,16 @@ function OptionsPrivate.GetAuthorOptions(data) local path = {} for child in OptionsPrivate.Private.TraverseLeafsOrAura(data) do local config = child.config - for i, option in ipairs(child.authorOptions) do - path[1] = i - local result = allChoicesAreDefault(option, config, child.id, path) - if result == false then - return false - end + for i, option in ipairs(child.authorOptions) do + path[1] = i + local result = allChoicesAreDefault(option, config, child.id, path) + if result == false then + return false end + end end return true - end + end, } args["enterAuthorMode"] = { type = "execute", @@ -2647,7 +2639,7 @@ function OptionsPrivate.GetAuthorOptions(data) configData.authorMode = true end WeakAuras.ClearAndUpdateOptions(data.id, true) - end + end, } end return authorOptions diff --git a/WeakAurasOptions/BuffTrigger.lua b/WeakAurasOptions/BuffTrigger.lua index c78a9937c0..3a0f41345a 100644 --- a/WeakAurasOptions/BuffTrigger.lua +++ b/WeakAurasOptions/BuffTrigger.lua @@ -1,60 +1,62 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... -local L = WeakAuras.L; +local L = WeakAuras.L local function getAuraMatchesLabel(name) local ids = WeakAuras.spellCache.GetSpellsMatching(name) - if(ids) then - local numMatches = 0; + if ids then + local numMatches = 0 for _ in pairs(ids) do - numMatches = numMatches + 1; + numMatches = numMatches + 1 end - if(numMatches == 1) then - return L["1 Match"]; + if numMatches == 1 then + return L["1 Match"] else - return L["%i Matches"]:format(numMatches); + return L["%i Matches"]:format(numMatches) end else - return ""; + return "" end end local function getAuraMatchesList(name) local ids = WeakAuras.spellCache.GetSpellsMatching(name) - if(ids) then - local descText = ""; + if ids then + local descText = "" for id in pairs(ids) do - local _, _, icon = GetSpellInfo(id); - if(icon) then - if(descText == "") then - descText = "|T"..icon..":0|t: "..id; + local _, _, icon = GetSpellInfo(id) + if icon then + if descText == "" then + descText = "|T" .. icon .. ":0|t: " .. id else - descText = descText.."\n|T"..icon..":0|t: "..id; + descText = descText .. "\n|T" .. icon .. ":0|t: " .. id end end end - return descText; + return descText else - return ""; + return "" end end local noop = function() end local function CanShowNameInfo(data) - if(data.regionType == "aurabar" or data.regionType == "icon" or data.regionType == "text") then - return true; + if data.regionType == "aurabar" or data.regionType == "icon" or data.regionType == "text" then + return true else - return false; + return false end end local function CanShowStackInfo(data) - if(data.regionType == "aurabar" or data.regionType == "icon" or data.regionType == "text") then - return true; + if data.regionType == "aurabar" or data.regionType == "icon" or data.regionType == "text" then + return true else - return false; + return false end end @@ -62,14 +64,14 @@ local function GetBuffTriggerOptions(data, triggernum) local trigger = data.triggers[triggernum].trigger trigger.names = trigger.names or {} trigger.spellIds = trigger.spellIds or {} - local spellCache = WeakAuras.spellCache; - local ValidateNumeric = WeakAuras.ValidateNumeric; + local spellCache = WeakAuras.spellCache + local ValidateNumeric = WeakAuras.ValidateNumeric local aura_options = { deleteNote = { type = "description", order = 8, name = L["Note: The legacy buff trigger is now permanently disabled. It will be removed in the near future."], - fontSize = "large" + fontSize = "large", }, convertToBuffTrigger2SpaceBeforeDesc = { type = "description", @@ -82,11 +84,11 @@ local function GetBuffTriggerOptions(data, triggernum) width = WeakAuras.doubleWidth - 0.8, order = 8.2, name = function() - if (not OptionsPrivate.Private.CanConvertBuffTrigger2) then - return ""; + if not OptionsPrivate.Private.CanConvertBuffTrigger2 then + return "" end - local _, err = OptionsPrivate.Private.CanConvertBuffTrigger2(trigger); - return err or ""; + local _, err = OptionsPrivate.Private.CanConvertBuffTrigger2(trigger) + return err or "" end, }, convertToBuffTrigger2SpaceAfterDesc = { @@ -107,24 +109,24 @@ local function GetBuffTriggerOptions(data, triggernum) name = L["Convert to New Aura Trigger"], order = 8.5, disabled = function() - if (not OptionsPrivate.Private.CanConvertBuffTrigger2) then - return true; + if not OptionsPrivate.Private.CanConvertBuffTrigger2 then + return true end - if (not OptionsPrivate.Private.CanConvertBuffTrigger2(trigger)) then - return true; + if not OptionsPrivate.Private.CanConvertBuffTrigger2(trigger) then + return true end - return false; + return false end, desc = function() - local _, err = OptionsPrivate.Private.CanConvertBuffTrigger2(trigger); + local _, err = OptionsPrivate.Private.CanConvertBuffTrigger2(trigger) return err or "" end, func = function() - OptionsPrivate.Private.ConvertBuffTrigger2(trigger); - WeakAuras.Add(data); + OptionsPrivate.Private.ConvertBuffTrigger2(trigger) + WeakAuras.Add(data) WeakAuras.UpdateThumbnail(data) - WeakAuras.ClearAndUpdateOptions(data.id); - end + WeakAuras.ClearAndUpdateOptions(data.id) + end, }, convertToBuffTrigger2SpaceAfter = { type = "description", @@ -138,156 +140,215 @@ local function GetBuffTriggerOptions(data, triggernum) name = L["Use Full Scan (High CPU)"], width = WeakAuras.doubleWidth, order = 9, - set = noop + set = noop, }, autoclone = { type = "toggle", name = L["Show all matches (Auto-clone)"], width = WeakAuras.doubleWidth, - hidden = function() return not (trigger.type == "aura" and trigger.fullscan); end, + hidden = function() + return not (trigger.type == "aura" and trigger.fullscan) + end, order = 9.5, - set = noop + set = noop, }, useName = { type = "toggle", name = L["Aura(s)"], width = WeakAuras.halfWidth, order = 10, - hidden = function() return not (trigger.type == "aura" and not trigger.fullscan and trigger.unit ~= "multi"); end, + hidden = function() + return not (trigger.type == "aura" and not trigger.fullscan and trigger.unit ~= "multi") + end, disabled = true, - get = function() return true end, - set = noop + get = function() + return true + end, + set = noop, }, use_name = { type = "toggle", width = WeakAuras.normalWidth, name = L["Aura Name"], order = 10, - hidden = function() return not (trigger.type == "aura" and trigger.fullscan); end, - set = noop + hidden = function() + return not (trigger.type == "aura" and trigger.fullscan) + end, + set = noop, }, name_operator = { type = "select", width = WeakAuras.normalWidth, name = L["Operator"], order = 11, - disabled = function() return not trigger.use_name end, - hidden = function() return not (trigger.type == "aura" and trigger.fullscan); end, + disabled = function() + return not trigger.use_name + end, + hidden = function() + return not (trigger.type == "aura" and trigger.fullscan) + end, values = OptionsPrivate.Private.string_operator_types, - set = noop + set = noop, }, name = { type = "input", name = L["Aura Name"], width = WeakAuras.doubleWidth, order = 12, - disabled = function() return not trigger.use_name end, - hidden = function() return not (trigger.type == "aura" and trigger.fullscan); end, - set = noop + disabled = function() + return not trigger.use_name + end, + hidden = function() + return not (trigger.type == "aura" and trigger.fullscan) + end, + set = noop, }, use_tooltip = { type = "toggle", width = WeakAuras.normalWidth, name = L["Tooltip"], order = 13, - hidden = function() return not (trigger.type == "aura" and trigger.fullscan and trigger.unit ~= "multi"); end, - set = noop + hidden = function() + return not (trigger.type == "aura" and trigger.fullscan and trigger.unit ~= "multi") + end, + set = noop, }, tooltip_operator = { type = "select", width = WeakAuras.normalWidth, name = L["Operator"], order = 14, - disabled = function() return not trigger.use_tooltip end, - hidden = function() return not (trigger.type == "aura" and trigger.fullscan and trigger.unit ~= "multi"); end, + disabled = function() + return not trigger.use_tooltip + end, + hidden = function() + return not (trigger.type == "aura" and trigger.fullscan and trigger.unit ~= "multi") + end, values = OptionsPrivate.Private.string_operator_types, - set = noop + set = noop, }, tooltip = { type = "input", width = WeakAuras.doubleWidth, name = L["Tooltip"], order = 15, - disabled = function() return not trigger.use_tooltip end, - hidden = function() return not (trigger.type == "aura" and trigger.fullscan and trigger.unit ~= "multi"); end, - set = noop + disabled = function() + return not trigger.use_tooltip + end, + hidden = function() + return not (trigger.type == "aura" and trigger.fullscan and trigger.unit ~= "multi") + end, + set = noop, }, use_stealable = { type = "toggle", width = WeakAuras.doubleWidth, name = function(input) - local value = trigger.use_stealable; - if(value == nil) then return L["Stealable"]; - elseif(value == false) then return "|cFFFF0000 "..L["Negator"].." "..L["Stealable"]; - else return "|cFF00FF00"..L["Stealable"]; end + local value = trigger.use_stealable + if value == nil then + return L["Stealable"] + elseif value == false then + return "|cFFFF0000 " .. L["Negator"] .. " " .. L["Stealable"] + else + return "|cFF00FF00" .. L["Stealable"] + end end, order = 16, - hidden = function() return not (trigger.type == "aura" and trigger.fullscan and trigger.unit ~= "multi"); end, + hidden = function() + return not (trigger.type == "aura" and trigger.fullscan and trigger.unit ~= "multi") + end, get = function() - local value = trigger.use_stealable; - if(value == nil) then return false; - elseif(value == false) then return "false"; - else return "true"; end + local value = trigger.use_stealable + if value == nil then + return false + elseif value == false then + return "false" + else + return "true" + end end, - set = noop + set = noop, }, use_spellId = { type = "toggle", width = WeakAuras.normalWidth, name = L["Spell ID"], order = 17, - hidden = function() return not (trigger.type == "aura" and trigger.fullscan and trigger.unit ~= "multi"); end, - set = noop + hidden = function() + return not (trigger.type == "aura" and trigger.fullscan and trigger.unit ~= "multi") + end, + set = noop, }, spellId = { type = "input", width = WeakAuras.normalWidth, name = L["Spell ID"], order = 18, - disabled = function() return not trigger.use_spellId end, - hidden = function() return not (trigger.type == "aura" and trigger.fullscan and trigger.unit ~= "multi"); end, - set = noop + disabled = function() + return not trigger.use_spellId + end, + hidden = function() + return not (trigger.type == "aura" and trigger.fullscan and trigger.unit ~= "multi") + end, + set = noop, }, use_debuffClass = { type = "toggle", width = WeakAuras.normalWidth, name = L["Debuff Type"], order = 19, - hidden = function() return not (trigger.type == "aura" and trigger.fullscan); end, - set = noop + hidden = function() + return not (trigger.type == "aura" and trigger.fullscan) + end, + set = noop, }, debuffClass = { type = "select", width = WeakAuras.normalWidth, name = L["Debuff Type"], order = 20, - disabled = function() return not trigger.use_debuffClass end, - hidden = function() return not (trigger.type == "aura" and trigger.fullscan); end, + disabled = function() + return not trigger.use_debuffClass + end, + hidden = function() + return not (trigger.type == "aura" and trigger.fullscan) + end, values = OptionsPrivate.Private.debuff_class_types, - set = noop + set = noop, }, multiuse_name = { type = "toggle", width = WeakAuras.halfWidth, name = L["Aura Name"], order = 10, - hidden = function() return not (trigger.type == "aura" and not trigger.fullscan and trigger.unit == "multi"); end, + hidden = function() + return not (trigger.type == "aura" and not trigger.fullscan and trigger.unit == "multi") + end, disabled = true, - get = function() return true end, - set = noop + get = function() + return true + end, + set = noop, }, multiicon = { type = "execute", width = WeakAuras.halfWidth, name = "", image = function() - if (not trigger.name) then return "" end; - local icon = spellCache.GetIcon(trigger.name); - return icon and tostring(icon) or "", 18, 18 end, + if not trigger.name then + return "" + end + local icon = spellCache.GetIcon(trigger.name) + return icon and tostring(icon) or "", 18, 18 + end, order = 11, - disabled = function() return not trigger.name and spellCache.GetIcon(trigger.name) end, - hidden = function() return not (trigger.type == "aura" and not trigger.fullscan and trigger.unit == "multi"); end, - set = noop + disabled = function() + return not trigger.name and spellCache.GetIcon(trigger.name) + end, + hidden = function() + return not (trigger.type == "aura" and not trigger.fullscan and trigger.unit == "multi") + end, + set = noop, }, multiname = { type = "input", @@ -295,23 +356,35 @@ local function GetBuffTriggerOptions(data, triggernum) name = L["Aura Name"], desc = L["Enter an aura name, partial aura name, or spell id"], order = 12, - hidden = function() return not (trigger.type == "aura" and not trigger.fullscan and trigger.unit == "multi"); end, - get = function(info) return trigger.spellId and tostring(trigger.spellId) or trigger.name end, - set = noop + hidden = function() + return not (trigger.type == "aura" and not trigger.fullscan and trigger.unit == "multi") + end, + get = function(info) + return trigger.spellId and tostring(trigger.spellId) or trigger.name + end, + set = noop, }, name1icon = { type = "execute", width = WeakAuras.halfWidth, - name = function() return getAuraMatchesLabel(trigger.names[1]) end, - desc = function() return getAuraMatchesList(trigger.names[1]) end, + name = function() + return getAuraMatchesLabel(trigger.names[1]) + end, + desc = function() + return getAuraMatchesList(trigger.names[1]) + end, image = function() - local icon = spellCache.GetIcon(trigger.names[1]); + local icon = spellCache.GetIcon(trigger.names[1]) return icon and tostring(icon) or "", 18, 18 end, order = 11, - disabled = function() return not spellCache.GetIcon(trigger.names[1]) end, - hidden = function() return not (trigger.type == "aura" and not trigger.fullscan and trigger.unit ~= "multi"); end, - set = noop + disabled = function() + return not spellCache.GetIcon(trigger.names[1]) + end, + hidden = function() + return not (trigger.type == "aura" and not trigger.fullscan and trigger.unit ~= "multi") + end, + set = noop, }, name1 = { type = "input", @@ -319,248 +392,380 @@ local function GetBuffTriggerOptions(data, triggernum) name = L["Aura Name"], desc = L["Enter an aura name, partial aura name, or spell id"], order = 12, - hidden = function() return not (trigger.type == "aura" and not trigger.fullscan and trigger.unit ~= "multi"); end, - get = function(info) return trigger.spellIds[1] and tostring(trigger.spellIds[1]) or trigger.names[1] end, - set = noop + hidden = function() + return not (trigger.type == "aura" and not trigger.fullscan and trigger.unit ~= "multi") + end, + get = function(info) + return trigger.spellIds[1] and tostring(trigger.spellIds[1]) or trigger.names[1] + end, + set = noop, }, name2space = { type = "execute", width = WeakAuras.halfWidth, name = L["or"], - image = function() return "", 0, 0 end, + image = function() + return "", 0, 0 + end, order = 13, - hidden = function() return not (trigger.type == "aura" and trigger.names[1] and not trigger.fullscan and trigger.unit ~= "multi"); end, + hidden = function() + return not (trigger.type == "aura" and trigger.names[1] and not trigger.fullscan and trigger.unit ~= "multi") + end, }, name2icon = { type = "execute", width = WeakAuras.halfWidth, - name = function() return getAuraMatchesLabel(trigger.names[2]) end, - desc = function() return getAuraMatchesList(trigger.names[2]) end, + name = function() + return getAuraMatchesLabel(trigger.names[2]) + end, + desc = function() + return getAuraMatchesList(trigger.names[2]) + end, image = function() - local icon = spellCache.GetIcon(trigger.names[2]); + local icon = spellCache.GetIcon(trigger.names[2]) return icon and tostring(icon) or "", 18, 18 end, order = 14, - disabled = function() return not spellCache.GetIcon(trigger.names[2]) end, - hidden = function() return not (trigger.type == "aura" and trigger.names[1] and not trigger.fullscan and trigger.unit ~= "multi"); end, + disabled = function() + return not spellCache.GetIcon(trigger.names[2]) + end, + hidden = function() + return not (trigger.type == "aura" and trigger.names[1] and not trigger.fullscan and trigger.unit ~= "multi") + end, }, name2 = { type = "input", width = WeakAuras.normalWidth, order = 15, name = "", - hidden = function() return not (trigger.type == "aura" and trigger.names[1] and not trigger.fullscan and trigger.unit ~= "multi"); end, - get = function(info) return trigger.spellIds[2] and tostring(trigger.spellIds[2]) or trigger.names[2] end, - set = noop + hidden = function() + return not (trigger.type == "aura" and trigger.names[1] and not trigger.fullscan and trigger.unit ~= "multi") + end, + get = function(info) + return trigger.spellIds[2] and tostring(trigger.spellIds[2]) or trigger.names[2] + end, + set = noop, }, name3space = { type = "execute", width = WeakAuras.halfWidth, name = "", - image = function() return "", 0, 0 end, + image = function() + return "", 0, 0 + end, order = 16, - hidden = function() return not (trigger.type == "aura" and trigger.names[2] and not trigger.fullscan and trigger.unit ~= "multi"); end, + hidden = function() + return not (trigger.type == "aura" and trigger.names[2] and not trigger.fullscan and trigger.unit ~= "multi") + end, }, name3icon = { type = "execute", width = WeakAuras.halfWidth, - name = function() return getAuraMatchesLabel(trigger.names[3]) end, - desc = function() return getAuraMatchesList(trigger.names[3]) end, + name = function() + return getAuraMatchesLabel(trigger.names[3]) + end, + desc = function() + return getAuraMatchesList(trigger.names[3]) + end, image = function() - local icon = spellCache.GetIcon(trigger.names[3]); + local icon = spellCache.GetIcon(trigger.names[3]) return icon and tostring(icon) or "", 18, 18 end, order = 17, - disabled = function() return not spellCache.GetIcon(trigger.names[3]) end, - hidden = function() return not (trigger.type == "aura" and trigger.names[2] and not trigger.fullscan and trigger.unit ~= "multi"); end, + disabled = function() + return not spellCache.GetIcon(trigger.names[3]) + end, + hidden = function() + return not (trigger.type == "aura" and trigger.names[2] and not trigger.fullscan and trigger.unit ~= "multi") + end, }, name3 = { type = "input", width = WeakAuras.normalWidth, order = 18, name = "", - hidden = function() return not (trigger.type == "aura" and trigger.names[2] and not trigger.fullscan and trigger.unit ~= "multi"); end, - get = function(info) return trigger.spellIds[3] and tostring(trigger.spellIds[3]) or trigger.names[3] end, - set = noop + hidden = function() + return not (trigger.type == "aura" and trigger.names[2] and not trigger.fullscan and trigger.unit ~= "multi") + end, + get = function(info) + return trigger.spellIds[3] and tostring(trigger.spellIds[3]) or trigger.names[3] + end, + set = noop, }, name4space = { type = "execute", width = WeakAuras.halfWidth, name = "", - image = function() return "", 0, 0 end, + image = function() + return "", 0, 0 + end, order = 19, - hidden = function() return not (trigger.type == "aura" and trigger.names[3] and not trigger.fullscan and trigger.unit ~= "multi"); end, + hidden = function() + return not (trigger.type == "aura" and trigger.names[3] and not trigger.fullscan and trigger.unit ~= "multi") + end, }, name4icon = { type = "execute", width = WeakAuras.halfWidth, - name = function() return getAuraMatchesLabel(trigger.names[4]) end, - desc = function() return getAuraMatchesList(trigger.names[4]) end, + name = function() + return getAuraMatchesLabel(trigger.names[4]) + end, + desc = function() + return getAuraMatchesList(trigger.names[4]) + end, image = function() - local icon = spellCache.GetIcon(trigger.names[4]); + local icon = spellCache.GetIcon(trigger.names[4]) return icon and tostring(icon) or "", 18, 18 end, order = 20, - disabled = function() return not spellCache.GetIcon(trigger.names[4]) end, - hidden = function() return not (trigger.type == "aura" and trigger.names[3] and not trigger.fullscan and trigger.unit ~= "multi"); end, + disabled = function() + return not spellCache.GetIcon(trigger.names[4]) + end, + hidden = function() + return not (trigger.type == "aura" and trigger.names[3] and not trigger.fullscan and trigger.unit ~= "multi") + end, }, name4 = { type = "input", order = 21, name = "", - hidden = function() return not (trigger.type == "aura" and trigger.names[3] and not trigger.fullscan and trigger.unit ~= "multi"); end, - get = function(info) return trigger.spellIds[4] and tostring(trigger.spellIds[4]) or trigger.names[4] end, - set = noop + hidden = function() + return not (trigger.type == "aura" and trigger.names[3] and not trigger.fullscan and trigger.unit ~= "multi") + end, + get = function(info) + return trigger.spellIds[4] and tostring(trigger.spellIds[4]) or trigger.names[4] + end, + set = noop, }, name5space = { type = "execute", width = WeakAuras.halfWidth, name = "", - image = function() return "", 0, 0 end, + image = function() + return "", 0, 0 + end, order = 22, - disabled = function() return not spellCache.GetIcon(trigger.names[5]) end, - hidden = function() return not (trigger.type == "aura" and trigger.names[4] and not trigger.fullscan and trigger.unit ~= "multi"); end, + disabled = function() + return not spellCache.GetIcon(trigger.names[5]) + end, + hidden = function() + return not (trigger.type == "aura" and trigger.names[4] and not trigger.fullscan and trigger.unit ~= "multi") + end, }, name5icon = { type = "execute", width = WeakAuras.halfWidth, - name = function() return getAuraMatchesLabel(trigger.names[5]) end, - desc = function() return getAuraMatchesList(trigger.names[5]) end, + name = function() + return getAuraMatchesLabel(trigger.names[5]) + end, + desc = function() + return getAuraMatchesList(trigger.names[5]) + end, image = function() - local icon = spellCache.GetIcon(trigger.names[5]); + local icon = spellCache.GetIcon(trigger.names[5]) return icon and tostring(icon) or "", 18, 18 end, order = 23, - hidden = function() return not (trigger.type == "aura" and trigger.names[4] and not trigger.fullscan and trigger.unit ~= "multi"); end, + hidden = function() + return not (trigger.type == "aura" and trigger.names[4] and not trigger.fullscan and trigger.unit ~= "multi") + end, }, name5 = { type = "input", width = WeakAuras.normalWidth, order = 24, name = "", - hidden = function() return not (trigger.type == "aura" and trigger.names[4] and not trigger.fullscan and trigger.unit ~= "multi"); end, - get = function(info) return trigger.spellIds[5] and tostring(trigger.spellIds[5]) or trigger.names[5] end, - set = noop + hidden = function() + return not (trigger.type == "aura" and trigger.names[4] and not trigger.fullscan and trigger.unit ~= "multi") + end, + get = function(info) + return trigger.spellIds[5] and tostring(trigger.spellIds[5]) or trigger.names[5] + end, + set = noop, }, name6space = { type = "execute", name = "", width = WeakAuras.halfWidth, - image = function() return "", 0, 0 end, + image = function() + return "", 0, 0 + end, order = 25, - hidden = function() return not (trigger.type == "aura" and trigger.names[5] and not trigger.fullscan and trigger.unit ~= "multi"); end, + hidden = function() + return not (trigger.type == "aura" and trigger.names[5] and not trigger.fullscan and trigger.unit ~= "multi") + end, }, name6icon = { type = "execute", - name = function() return getAuraMatchesLabel(trigger.names[6]) end, - desc = function() return getAuraMatchesList(trigger.names[6]) end, + name = function() + return getAuraMatchesLabel(trigger.names[6]) + end, + desc = function() + return getAuraMatchesList(trigger.names[6]) + end, width = WeakAuras.halfWidth, image = function() - local icon = spellCache.GetIcon(trigger.names[6]); + local icon = spellCache.GetIcon(trigger.names[6]) return icon and tostring(icon) or "", 18, 18 end, order = 26, - disabled = function() return not spellCache.GetIcon(trigger.names[6]) end, - hidden = function() return not (trigger.type == "aura" and trigger.names[5] and not trigger.fullscan and trigger.unit ~= "multi"); end, + disabled = function() + return not spellCache.GetIcon(trigger.names[6]) + end, + hidden = function() + return not (trigger.type == "aura" and trigger.names[5] and not trigger.fullscan and trigger.unit ~= "multi") + end, }, name6 = { type = "input", width = WeakAuras.normalWidth, order = 27, name = "", - hidden = function() return not (trigger.type == "aura" and trigger.names[5] and not trigger.fullscan and trigger.unit ~= "multi"); end, - get = function(info) return trigger.spellIds[6] and tostring(trigger.spellIds[6]) or trigger.names[6] end, - set = noop + hidden = function() + return not (trigger.type == "aura" and trigger.names[5] and not trigger.fullscan and trigger.unit ~= "multi") + end, + get = function(info) + return trigger.spellIds[6] and tostring(trigger.spellIds[6]) or trigger.names[6] + end, + set = noop, }, name7space = { type = "execute", name = "", width = WeakAuras.halfWidth, - image = function() return "", 0, 0 end, + image = function() + return "", 0, 0 + end, order = 28, - hidden = function() return not (trigger.type == "aura" and trigger.names[6] and not trigger.fullscan and trigger.unit ~= "multi"); end, + hidden = function() + return not (trigger.type == "aura" and trigger.names[6] and not trigger.fullscan and trigger.unit ~= "multi") + end, }, name7icon = { type = "execute", - name = function() return getAuraMatchesLabel(trigger.names[7]) end, - desc = function() return getAuraMatchesList(trigger.names[7]) end, + name = function() + return getAuraMatchesLabel(trigger.names[7]) + end, + desc = function() + return getAuraMatchesList(trigger.names[7]) + end, width = WeakAuras.halfWidth, image = function() - local icon = spellCache.GetIcon(trigger.names[7]); + local icon = spellCache.GetIcon(trigger.names[7]) return icon and tostring(icon) or "", 18, 18 end, order = 29, - disabled = function() return not spellCache.GetIcon(trigger.names[7]) end, - hidden = function() return not (trigger.type == "aura" and trigger.names[6] and not trigger.fullscan and trigger.unit ~= "multi"); end, + disabled = function() + return not spellCache.GetIcon(trigger.names[7]) + end, + hidden = function() + return not (trigger.type == "aura" and trigger.names[6] and not trigger.fullscan and trigger.unit ~= "multi") + end, }, name7 = { type = "input", width = WeakAuras.normalWidth, order = 30, name = "", - hidden = function() return not (trigger.type == "aura" and trigger.names[6] and not trigger.fullscan and trigger.unit ~= "multi"); end, - get = function(info) return trigger.spellIds[7] and tostring(trigger.spellIds[7]) or trigger.names[7] end, - set = noop + hidden = function() + return not (trigger.type == "aura" and trigger.names[6] and not trigger.fullscan and trigger.unit ~= "multi") + end, + get = function(info) + return trigger.spellIds[7] and tostring(trigger.spellIds[7]) or trigger.names[7] + end, + set = noop, }, name8space = { type = "execute", name = "", width = WeakAuras.halfWidth, - image = function() return "", 0, 0 end, + image = function() + return "", 0, 0 + end, order = 31, - hidden = function() return not (trigger.type == "aura" and trigger.names[7] and not trigger.fullscan and trigger.unit ~= "multi"); end, + hidden = function() + return not (trigger.type == "aura" and trigger.names[7] and not trigger.fullscan and trigger.unit ~= "multi") + end, }, name8icon = { type = "execute", - name = function() return getAuraMatchesLabel(trigger.names[8]) end, - desc = function() return getAuraMatchesList(trigger.names[8]) end, + name = function() + return getAuraMatchesLabel(trigger.names[8]) + end, + desc = function() + return getAuraMatchesList(trigger.names[8]) + end, width = WeakAuras.halfWidth, image = function() - local icon = spellCache.GetIcon(trigger.names[8]); + local icon = spellCache.GetIcon(trigger.names[8]) return icon and tostring(icon) or "", 18, 18 end, order = 32, - disabled = function() return not spellCache.GetIcon(trigger.names[8]) end, - hidden = function() return not (trigger.type == "aura" and trigger.names[7] and not trigger.fullscan and trigger.unit ~= "multi"); end, + disabled = function() + return not spellCache.GetIcon(trigger.names[8]) + end, + hidden = function() + return not (trigger.type == "aura" and trigger.names[7] and not trigger.fullscan and trigger.unit ~= "multi") + end, }, name8 = { type = "input", width = WeakAuras.normalWidth, order = 33, name = "", - hidden = function() return not (trigger.type == "aura" and trigger.names[7] and not trigger.fullscan and trigger.unit ~= "multi"); end, - get = function(info) return trigger.spellIds[8] and tostring(trigger.spellIds[8]) or trigger.names[8] end, - set = noop + hidden = function() + return not (trigger.type == "aura" and trigger.names[7] and not trigger.fullscan and trigger.unit ~= "multi") + end, + get = function(info) + return trigger.spellIds[8] and tostring(trigger.spellIds[8]) or trigger.names[8] + end, + set = noop, }, name9space = { type = "execute", name = "", width = WeakAuras.halfWidth, - image = function() return "", 0, 0 end, + image = function() + return "", 0, 0 + end, order = 34, - hidden = function() return not (trigger.type == "aura" and trigger.names[8] and not trigger.fullscan and trigger.unit ~= "multi"); end, + hidden = function() + return not (trigger.type == "aura" and trigger.names[8] and not trigger.fullscan and trigger.unit ~= "multi") + end, }, name9icon = { type = "execute", - name = function() return getAuraMatchesLabel(trigger.names[9]) end, - desc = function() return getAuraMatchesList(trigger.names[9]) end, + name = function() + return getAuraMatchesLabel(trigger.names[9]) + end, + desc = function() + return getAuraMatchesList(trigger.names[9]) + end, width = WeakAuras.halfWidth, image = function() - local icon = spellCache.GetIcon(trigger.names[9]); + local icon = spellCache.GetIcon(trigger.names[9]) return icon and tostring(icon) or "", 18, 18 end, order = 35, - disabled = function() return not spellCache.GetIcon(trigger.names[9]) end, - hidden = function() return not (trigger.type == "aura" and trigger.names[8] and not trigger.fullscan and trigger.unit ~= "multi"); end, + disabled = function() + return not spellCache.GetIcon(trigger.names[9]) + end, + hidden = function() + return not (trigger.type == "aura" and trigger.names[8] and not trigger.fullscan and trigger.unit ~= "multi") + end, }, name9 = { type = "input", width = WeakAuras.normalWidth, order = 36, name = "", - hidden = function() return not (trigger.type == "aura" and trigger.names[8] and not trigger.fullscan and trigger.unit ~= "multi"); end, - get = function(info) return trigger.spellIds[9] and tostring(trigger.spellIds[9]) or trigger.names[9] end, - set = noop + hidden = function() + return not (trigger.type == "aura" and trigger.names[8] and not trigger.fullscan and trigger.unit ~= "multi") + end, + get = function(info) + return trigger.spellIds[9] and tostring(trigger.spellIds[9]) or trigger.names[9] + end, + set = noop, }, useUnit = { type = "toggle", @@ -568,9 +773,13 @@ local function GetBuffTriggerOptions(data, triggernum) name = L["Unit"], order = 40, disabled = true, - hidden = function() return not (trigger.type == "aura"); end, - get = function() return true end, - set = noop + hidden = function() + return not (trigger.type == "aura") + end, + get = function() + return true + end, + set = noop, }, unit = { type = "select", @@ -578,20 +787,22 @@ local function GetBuffTriggerOptions(data, triggernum) name = L["Unit"], order = 41, values = function() - if(trigger.fullscan) then - return OptionsPrivate.Private.actual_unit_types_with_specific; + if trigger.fullscan then + return OptionsPrivate.Private.actual_unit_types_with_specific else - return OptionsPrivate.Private.unit_types; + return OptionsPrivate.Private.unit_types end end, - hidden = function() return not (trigger.type == "aura"); end, + hidden = function() + return not (trigger.type == "aura") + end, get = function() - if(trigger.fullscan and (trigger.unit == "group" or trigger.unit == "multi")) then - trigger.unit = "player"; + if trigger.fullscan and (trigger.unit == "group" or trigger.unit == "multi") then + trigger.unit = "player" end - return trigger.unit; + return trigger.unit end, - set = noop + set = noop, }, useSpecificUnit = { type = "toggle", @@ -599,9 +810,13 @@ local function GetBuffTriggerOptions(data, triggernum) name = L["Specific Unit"], order = 42, disabled = true, - hidden = function() return not (trigger.type == "aura" and trigger.unit == "member") end, - get = function() return true end, - set = noop + hidden = function() + return not (trigger.type == "aura" and trigger.unit == "member") + end, + get = function() + return true + end, + set = noop, }, specificUnit = { type = "input", @@ -609,18 +824,24 @@ local function GetBuffTriggerOptions(data, triggernum) name = L["Specific Unit"], order = 43, desc = L["Can be a Name or a Unit ID (e.g. party1). A name only works on friendly players in your group."], - hidden = function() return not (trigger.type == "aura" and trigger.unit == "member") end, - set = noop + hidden = function() + return not (trigger.type == "aura" and trigger.unit == "member") + end, + set = noop, }, useGroup_count = { type = "toggle", width = WeakAuras.normalWidth, name = L["Group Member Count"], disabled = true, - hidden = function() return not (trigger.type == "aura" and trigger.unit == "group"); end, - get = function() return true; end, + hidden = function() + return not (trigger.type == "aura" and trigger.unit == "group") + end, + get = function() + return true + end, order = 45, - set = noop + set = noop, }, group_countOperator = { type = "select", @@ -628,99 +849,129 @@ local function GetBuffTriggerOptions(data, triggernum) order = 46, width = WeakAuras.halfWidth, values = OptionsPrivate.Private.operator_types, - hidden = function() return not (trigger.type == "aura" and trigger.unit == "group"); end, - get = function() return trigger.group_countOperator; end, - set = noop + hidden = function() + return not (trigger.type == "aura" and trigger.unit == "group") + end, + get = function() + return trigger.group_countOperator + end, + set = noop, }, group_count = { type = "input", name = L["Count"], desc = function() - local groupType = OptionsPrivate.Private.unit_types[trigger.unit or "group"] or "|cFFFF0000error|r"; - return L["Group aura count description"]:format(groupType, groupType, groupType, groupType, groupType, groupType, groupType); + local groupType = OptionsPrivate.Private.unit_types[trigger.unit or "group"] or "|cFFFF0000error|r" + return L["Group aura count description"]:format(groupType, groupType, groupType, groupType, groupType, groupType, groupType) end, order = 47, width = WeakAuras.halfWidth, - hidden = function() return not (trigger.type == "aura" and trigger.unit == "group"); end, - get = function() return trigger.group_count; end, - set = noop + hidden = function() + return not (trigger.type == "aura" and trigger.unit == "group") + end, + get = function() + return trigger.group_count + end, + set = noop, }, useGroupRole = { type = "toggle", width = WeakAuras.normalWidth, name = L["Filter by Group Role"], order = 47.1, - hidden = function() return not (trigger.type == "aura" and trigger.unit == "group"); end, - set = noop + hidden = function() + return not (trigger.type == "aura" and trigger.unit == "group") + end, + set = noop, }, group_role = { type = "select", width = WeakAuras.normalWidth, name = L["Group Role"], values = OptionsPrivate.Private.role_types, - hidden = function() return not (trigger.type == "aura" and trigger.unit == "group"); end, - disabled = function() return not trigger.useGroupRole; end, - get = function() return trigger.group_role; end, + hidden = function() + return not (trigger.type == "aura" and trigger.unit == "group") + end, + disabled = function() + return not trigger.useGroupRole + end, + get = function() + return trigger.group_role + end, order = 47.2, - set = noop + set = noop, }, ignoreSelf = { type = "toggle", name = L["Ignore self"], order = 47.3, width = WeakAuras.doubleWidth, - hidden = function() return not (trigger.type == "aura" and trigger.unit == "group"); end, - set = noop + hidden = function() + return not (trigger.type == "aura" and trigger.unit == "group") + end, + set = noop, }, groupclone = { type = "toggle", name = L["Show all matches (Auto-clone)"], width = WeakAuras.doubleWidth, - hidden = function() return not (trigger.type == "aura" and trigger.unit == "group"); end, + hidden = function() + return not (trigger.type == "aura" and trigger.unit == "group") + end, order = 47.4, - set = noop + set = noop, }, name_info = { type = "select", width = WeakAuras.normalWidth, name = L["Name Info"], order = 47.5, - hidden = function() return not (trigger.type == "aura" and trigger.unit == "group" and not trigger.groupclone); end, - disabled = function() return not CanShowNameInfo(data); end, + hidden = function() + return not (trigger.type == "aura" and trigger.unit == "group" and not trigger.groupclone) + end, + disabled = function() + return not CanShowNameInfo(data) + end, get = function() - if(CanShowNameInfo(data)) then - return trigger.name_info; + if CanShowNameInfo(data) then + return trigger.name_info else - return nil; + return nil end end, values = OptionsPrivate.Private.group_aura_name_info_types, - set = noop + set = noop, }, stack_info = { type = "select", width = WeakAuras.normalWidth, name = L["Stack Info"], order = 47.6, - hidden = function() return not (trigger.type == "aura" and trigger.unit == "group" and not trigger.groupclone); end, - disabled = function() return not CanShowStackInfo(data); end, + hidden = function() + return not (trigger.type == "aura" and trigger.unit == "group" and not trigger.groupclone) + end, + disabled = function() + return not CanShowStackInfo(data) + end, get = function() - if(CanShowStackInfo(data)) then - return trigger.stack_info; + if CanShowStackInfo(data) then + return trigger.stack_info else - return nil; + return nil end end, values = OptionsPrivate.Private.group_aura_stack_info_types, - set = noop + set = noop, }, hideAlone = { type = "toggle", name = L["Hide When Not In Group"], order = 47.7, width = WeakAuras.doubleWidth, - hidden = function() return not (trigger.type == "aura" and trigger.unit == "group"); end, - set = noop + hidden = function() + return not (trigger.type == "aura" and trigger.unit == "group") + end, + set = noop, }, useDebuffType = { type = "toggle", @@ -728,9 +979,13 @@ local function GetBuffTriggerOptions(data, triggernum) name = L["Aura Type"], order = 50, disabled = true, - hidden = function() return not (trigger.type == "aura"); end, - get = function() return true end, - set = noop + hidden = function() + return not (trigger.type == "aura") + end, + get = function() + return true + end, + set = noop, }, debuffType = { type = "select", @@ -738,33 +993,41 @@ local function GetBuffTriggerOptions(data, triggernum) name = L["Aura Type"], order = 51, values = OptionsPrivate.Private.debuff_types, - hidden = function() return not (trigger.type == "aura"); end, - set = noop + hidden = function() + return not (trigger.type == "aura") + end, + set = noop, }, subcount = { type = "toggle", width = WeakAuras.doubleWidth, name = L["Use tooltip \"size\" instead of stacks"], - hidden = function() return not (trigger.type == "aura" and trigger.fullscan) end, + hidden = function() + return not (trigger.type == "aura" and trigger.fullscan) + end, order = 55, - set = noop + set = noop, }, subcountCount = { type = "select", values = OptionsPrivate.Private.tooltip_count, width = WeakAuras.doubleWidth, name = L["Use nth value from tooltip:"], - hidden = function() return not (trigger.type == "aura" and trigger.fullscan and trigger.subcount) end, + hidden = function() + return not (trigger.type == "aura" and trigger.fullscan and trigger.subcount) + end, order = 55.5, - set = noop + set = noop, }, useRem = { type = "toggle", width = WeakAuras.normalWidth, name = L["Remaining Time"], - hidden = function() return not (trigger.type == "aura" and trigger.unit ~= "multi"); end, + hidden = function() + return not (trigger.type == "aura" and trigger.unit ~= "multi") + end, order = 56, - set = noop + set = noop, }, remOperator = { type = "select", @@ -772,10 +1035,16 @@ local function GetBuffTriggerOptions(data, triggernum) order = 57, width = WeakAuras.halfWidth, values = OptionsPrivate.Private.operator_types, - disabled = function() return not trigger.useRem; end, - hidden = function() return not (trigger.type == "aura" and trigger.unit ~= "multi"); end, - get = function() return trigger.useRem and trigger.remOperator or nil end, - set = noop + disabled = function() + return not trigger.useRem + end, + hidden = function() + return not (trigger.type == "aura" and trigger.unit ~= "multi") + end, + get = function() + return trigger.useRem and trigger.remOperator or nil + end, + set = noop, }, rem = { type = "input", @@ -783,18 +1052,26 @@ local function GetBuffTriggerOptions(data, triggernum) validate = ValidateNumeric, order = 58, width = WeakAuras.halfWidth, - disabled = function() return not trigger.useRem; end, - hidden = function() return not (trigger.type == "aura" and trigger.unit ~= "multi"); end, - get = function() return trigger.useRem and trigger.rem or nil end, - set = noop + disabled = function() + return not trigger.useRem + end, + hidden = function() + return not (trigger.type == "aura" and trigger.unit ~= "multi") + end, + get = function() + return trigger.useRem and trigger.rem or nil + end, + set = noop, }, useCount = { type = "toggle", width = WeakAuras.normalWidth, name = L["Stack Count"], - hidden = function() return not (trigger.type == "aura" and trigger.unit ~= "multi"); end, + hidden = function() + return not (trigger.type == "aura" and trigger.unit ~= "multi") + end, order = 60, - set = noop + set = noop, }, countOperator = { type = "select", @@ -802,10 +1079,16 @@ local function GetBuffTriggerOptions(data, triggernum) order = 62, width = WeakAuras.halfWidth, values = OptionsPrivate.Private.operator_types, - disabled = function() return not trigger.useCount; end, - hidden = function() return not (trigger.type == "aura" and trigger.unit ~= "multi"); end, - get = function() return trigger.useCount and trigger.countOperator or nil end, - set = noop + disabled = function() + return not trigger.useCount + end, + hidden = function() + return not (trigger.type == "aura" and trigger.unit ~= "multi") + end, + get = function() + return trigger.useCount and trigger.countOperator or nil + end, + set = noop, }, count = { type = "input", @@ -813,35 +1096,55 @@ local function GetBuffTriggerOptions(data, triggernum) validate = ValidateNumeric, order = 65, width = WeakAuras.halfWidth, - disabled = function() return not trigger.useCount; end, - hidden = function() return not (trigger.type == "aura" and trigger.unit ~= "multi"); end, - get = function() return trigger.useCount and trigger.count or nil end, - set = noop + disabled = function() + return not trigger.useCount + end, + hidden = function() + return not (trigger.type == "aura" and trigger.unit ~= "multi") + end, + get = function() + return trigger.useCount and trigger.count or nil + end, + set = noop, }, ownOnly = { type = "toggle", width = WeakAuras.doubleWidth, name = function() - local value = trigger.ownOnly; - if(value == nil) then return L["Own Only"]; - elseif(value == false) then return "|cFFFF0000 "..L["Negator"].." "..L["Own Only"]; - else return "|cFF00FF00"..L["Own Only"]; end + local value = trigger.ownOnly + if value == nil then + return L["Own Only"] + elseif value == false then + return "|cFFFF0000 " .. L["Negator"] .. " " .. L["Own Only"] + else + return "|cFF00FF00" .. L["Own Only"] + end end, desc = function() - local value = trigger.ownOnly; - if(value == nil) then return L["Only match auras cast by the player"]; - elseif(value == false) then return L["Only match auras cast by people other than the player"]; - else return L["Only match auras cast by the player"]; end + local value = trigger.ownOnly + if value == nil then + return L["Only match auras cast by the player"] + elseif value == false then + return L["Only match auras cast by people other than the player"] + else + return L["Only match auras cast by the player"] + end end, get = function() - local value = trigger.ownOnly; - if(value == nil) then return false; - elseif(value == false) then return "false"; - else return "true"; end + local value = trigger.ownOnly + if value == nil then + return false + elseif value == false then + return "false" + else + return "true" + end end, order = 70, - hidden = function() return not (trigger.type == "aura"); end, - set = noop + hidden = function() + return not (trigger.type == "aura") + end, + set = noop, }, useBuffShowOn = { type = "toggle", @@ -850,10 +1153,17 @@ local function GetBuffTriggerOptions(data, triggernum) order = 71, disabled = true, hidden = function() - return not (trigger.type == "aura" and not(trigger.unit ~= "group" and trigger.fullscan and trigger.autoclone) and trigger.unit ~= "multi" and not(trigger.unit == "group" and not trigger.groupclone)); + return not ( + trigger.type == "aura" + and not (trigger.unit ~= "group" and trigger.fullscan and trigger.autoclone) + and trigger.unit ~= "multi" + and not (trigger.unit == "group" and not trigger.groupclone) + ) + end, + get = function() + return true end, - get = function() return true end, - set = noop + set = noop, }, buffShowOn = { type = "select", @@ -861,11 +1171,18 @@ local function GetBuffTriggerOptions(data, triggernum) name = "", values = OptionsPrivate.Private.bufftrigger_progress_behavior_types, order = 71.1, - get = function() return trigger.buffShowOn end, + get = function() + return trigger.buffShowOn + end, hidden = function() - return not (trigger.type == "aura" and not(trigger.unit ~= "group" and trigger.fullscan and trigger.autoclone) and trigger.unit ~= "multi" and not(trigger.unit == "group" and not trigger.groupclone)); + return not ( + trigger.type == "aura" + and not (trigger.unit ~= "group" and trigger.fullscan and trigger.autoclone) + and trigger.unit ~= "multi" + and not (trigger.unit == "group" and not trigger.groupclone) + ) end, - set = noop + set = noop, }, unitExists = { type = "toggle", @@ -873,13 +1190,15 @@ local function GetBuffTriggerOptions(data, triggernum) name = L["Show If Unit Is Invalid"], order = 72, hidden = function() - return not (trigger.type == "aura" - and not(trigger.unit ~= "group" and trigger.fullscan and trigger.autoclone) - and trigger.unit ~= "multi" - and trigger.unit ~= "group" - and trigger.unit ~= "player"); + return not ( + trigger.type == "aura" + and not (trigger.unit ~= "group" and trigger.fullscan and trigger.autoclone) + and trigger.unit ~= "multi" + and trigger.unit ~= "group" + and trigger.unit ~= "player" + ) end, - set = noop + set = noop, }, linespacer = { type = "description", @@ -891,16 +1210,15 @@ local function GetBuffTriggerOptions(data, triggernum) return not OptionsPrivate.Private.CanConvertBuffTrigger2 end, }, - - }; + } OptionsPrivate.commonOptions.AddCommonTriggerOptions(aura_options, data, triggernum, true) OptionsPrivate.commonOptions.AddTriggerGetterSetter(aura_options, data, triggernum) OptionsPrivate.AddTriggerMetaFunctions(aura_options, data, triggernum) return { - ["trigger." .. triggernum .. ".legacy_aura_options"] = aura_options + ["trigger." .. triggernum .. ".legacy_aura_options"] = aura_options, } end -WeakAuras.RegisterTriggerSystemOptions({"aura"}, GetBuffTriggerOptions); +WeakAuras.RegisterTriggerSystemOptions({ "aura" }, GetBuffTriggerOptions) diff --git a/WeakAurasOptions/BuffTrigger2.lua b/WeakAurasOptions/BuffTrigger2.lua index d7d2fb76bc..cd52d7a31b 100644 --- a/WeakAurasOptions/BuffTrigger2.lua +++ b/WeakAurasOptions/BuffTrigger2.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... local L = WeakAuras.L @@ -24,9 +26,9 @@ local function getAuraMatchesList(name) local _, _, icon = GetSpellInfo(id) if icon then if descText == "" then - descText = "|T"..icon..":0|t: "..id + descText = "|T" .. icon .. ":0|t: " .. id else - descText = descText.."\n|T"..icon..":0|t: "..id + descText = descText .. "\n|T" .. icon .. ":0|t: " .. id end end end @@ -54,8 +56,13 @@ local function CountNames(data, triggernum, name) end local function IsGroupTrigger(trigger) - return trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" - or trigger.unit == "boss" or trigger.unit == "nameplate" or trigger.unit == "arena" or trigger.unit == "multi" + return trigger.unit == "group" + or trigger.unit == "raid" + or trigger.unit == "party" + or trigger.unit == "boss" + or trigger.unit == "nameplate" + or trigger.unit == "arena" + or trigger.unit == "multi" end local function IsSingleMissing(trigger) @@ -83,7 +90,13 @@ local function CreateNameOptions(aura_options, data, trigger, size, isExactSpell local hiddenFunction if isIgnoreList then hiddenFunction = function() - return not (trigger.type == "aura2" and trigger[useKey] and (i == 1 or trigger[optionKey] and trigger[optionKey][i - 1]) and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger)) + return not ( + trigger.type == "aura2" + and trigger[useKey] + and (i == 1 or trigger[optionKey] and trigger[optionKey][i - 1]) + and trigger.unit ~= "multi" + and CanHaveMatchCheck(trigger) + ) end else hiddenFunction = function() @@ -96,9 +109,11 @@ local function CreateNameOptions(aura_options, data, trigger, size, isExactSpell type = "execute", name = inverse and L["and"] or L["or"], width = WeakAuras.normalWidth - 0.2, - image = function() return "", 0, 0 end, + image = function() + return "", 0, 0 + end, order = baseOrder + i / 100 + 0.0001, - hidden = hiddenFunction + hidden = hiddenFunction, } end @@ -108,7 +123,7 @@ local function CreateNameOptions(aura_options, data, trigger, size, isExactSpell width = 0.2, order = baseOrder + i / 100 + 0.0002, hidden = hiddenFunction, - control = "WeakAurasIcon" + control = "WeakAurasIcon", } if isExactSpellId then @@ -166,7 +181,9 @@ local function CreateNameOptions(aura_options, data, trigger, size, isExactSpell desc = desc, order = baseOrder + i / 100 + 0.0003, hidden = hiddenFunction, - get = function(info) return trigger[optionKey] and trigger[optionKey][i] end, + get = function(info) + return trigger[optionKey] and trigger[optionKey][i] + end, set = function(info, v) trigger[optionKey] = trigger[optionKey] or {} if v == "" then @@ -189,7 +206,7 @@ local function CreateNameOptions(aura_options, data, trigger, size, isExactSpell WeakAuras.UpdateThumbnail(data) WeakAuras.ClearAndUpdateOptions(data.id) end, - validate = isExactSpellId and WeakAuras.ValidateNumeric or nil + validate = isExactSpellId and WeakAuras.ValidateNumeric or nil, } end -- VALIDATE ? @@ -207,9 +224,7 @@ local function GetBuffTriggerOptions(data, triggernum) end local function HasMatchPerUnitCount(trigger) - if trigger.type == "aura2" and IsGroupTrigger(trigger) - and trigger.showClones and trigger.combinePerUnit and trigger.perUnitMode ~= "unaffected" - then + if trigger.type == "aura2" and IsGroupTrigger(trigger) and trigger.showClones and trigger.combinePerUnit and trigger.perUnitMode ~= "unaffected" then return trigger.useMatchPerUnit_count end end @@ -222,8 +237,12 @@ local function GetBuffTriggerOptions(data, triggernum) name = L["Unit"], order = 10, disabled = true, - hidden = function() return not trigger.type == "aura2" end, - get = function() return true end + hidden = function() + return not trigger.type == "aura2" + end, + get = function() + return true + end, }, unit = { type = "select", @@ -233,7 +252,9 @@ local function GetBuffTriggerOptions(data, triggernum) values = function() return OptionsPrivate.Private.unit_types_bufftrigger_2 end, - hidden = function() return not trigger.type == "aura2" end, + hidden = function() + return not trigger.type == "aura2" + end, desc = L["• |cff00ff00Player|r, |cff00ff00Target|r, |cff00ff00Focus|r, and |cff00ff00Pet|r correspond directly to those individual unitIDs.\n• |cff00ff00Specific Unit|r lets you provide a specific valid unitID to watch.\n|cffff0000Note|r: The game will not fire events for all valid unitIDs, making some untrackable by this trigger.\n• |cffffff00Party|r, |cffffff00Raid|r, |cffffff00Boss|r, |cffffff00Arena|r, and |cffffff00Nameplate|r can match multiple corresponding unitIDs.\n• |cffffff00Smart Group|r adjusts to your current group type, matching just the \"player\" when solo, \"party\" units (including \"player\") in a party or \"raid\" units in a raid.\n• |cffffff00Multi-target|r attempts to use the Combat Log events, rather than unitID, to track affected units.\n|cffff0000Note|r: Without a direct relationship to actual unitIDs, results may vary.\n\n|cffffff00*|r Yellow Unit settings can match multiple units and will default to being active even while no affected units are found without a Unit Count or Match Count setting."], }, useSpecificUnit = { @@ -242,8 +263,12 @@ local function GetBuffTriggerOptions(data, triggernum) name = L["Specific Unit"], order = 10.2, disabled = true, - hidden = function() return not (trigger.type == "aura2" and trigger.unit == "member") end, - get = function() return true end + hidden = function() + return not (trigger.type == "aura2" and trigger.unit == "member") + end, + get = function() + return true + end, }, specificUnit = { type = "input", @@ -251,7 +276,9 @@ local function GetBuffTriggerOptions(data, triggernum) name = L["Specific Unit"], order = 10.3, desc = L["A Unit ID (e.g., party1)."], - hidden = function() return not (trigger.type == "aura2" and trigger.unit == "member") end + hidden = function() + return not (trigger.type == "aura2" and trigger.unit == "member") + end, }, warnSpecifcUnit = { type = "description", @@ -260,7 +287,9 @@ local function GetBuffTriggerOptions(data, triggernum) return L["|cFFFF0000Note:|r The unit '%s' is not a trackable unit."]:format(trigger.specificUnit or "") end, order = 10.4, - hidden = function() return not (trigger.type == "aura2" and trigger.unit == "member" and WeakAuras.UntrackableUnit(trigger.specificUnit)) end + hidden = function() + return not (trigger.type == "aura2" and trigger.unit == "member" and WeakAuras.UntrackableUnit(trigger.specificUnit)) + end, }, useDebuffType = { type = "toggle", @@ -268,8 +297,12 @@ local function GetBuffTriggerOptions(data, triggernum) name = L["Aura Type"], order = 11, disabled = true, - hidden = function() return not trigger.type == "aura2" end, - get = function() return true end + hidden = function() + return not trigger.type == "aura2" + end, + get = function() + return true + end, }, debuffType = { type = "select", @@ -277,7 +310,9 @@ local function GetBuffTriggerOptions(data, triggernum) name = L["Aura Type"], order = 11.1, values = OptionsPrivate.Private.debuff_types, - hidden = function() return not trigger.type == "aura2" end + hidden = function() + return not trigger.type == "aura2" + end, }, spell_filters_header = { type = "header", @@ -290,7 +325,9 @@ local function GetBuffTriggerOptions(data, triggernum) name = L["Debuff Type"], order = 11.2, desc = L["Filter to only dispellable de/buffs of the given type(s)"], - hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger)) end + hidden = function() + return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger)) + end, }, debuffClass = { type = "multiselect", @@ -298,9 +335,7 @@ local function GetBuffTriggerOptions(data, triggernum) name = L["Debuff Type"], order = 11.3, hidden = function() - return not (trigger.type == "aura2" and trigger.unit ~= "multi" - and CanHaveMatchCheck(trigger) - and trigger.use_debuffClass) + return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.use_debuffClass) end, values = OptionsPrivate.Private.debuff_class_types, }, @@ -310,66 +345,80 @@ local function GetBuffTriggerOptions(data, triggernum) name = "", order = 11.4, hidden = function() - return not (trigger.type == "aura2" and trigger.unit ~= "multi" - and CanHaveMatchCheck(trigger) - and not trigger.use_debuffClass) - end + return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and not trigger.use_debuffClass) + end, }, useName = { type = "toggle", name = L["Name(s)"], order = 12, width = WeakAuras.normalWidth - 0.2, - hidden = function() return not trigger.type == "aura2" end + hidden = function() + return not trigger.type == "aura2" + end, }, useNameSpace = { type = "description", name = "", order = 12.1, width = WeakAuras.normalWidth, - hidden = function() return not (trigger.type == "aura2" and not trigger.useName) end + hidden = function() + return not (trigger.type == "aura2" and not trigger.useName) + end, }, useExactSpellId = { type = "toggle", name = L["Exact Spell ID(s)"], width = WeakAuras.normalWidth - 0.2, order = 22, - hidden = function() return not trigger.type == "aura2" end + hidden = function() + return not trigger.type == "aura2" + end, }, useExactSpellIdSpace = { type = "description", name = "", order = 22.1, width = WeakAuras.normalWidth, - hidden = function() return not (trigger.type == "aura2" and not trigger.useExactSpellId) end + hidden = function() + return not (trigger.type == "aura2" and not trigger.useExactSpellId) + end, }, useIgnoreName = { type = "toggle", name = L["Ignored Name(s)"], order = 32, width = WeakAuras.normalWidth - 0.2, - hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger)) end + hidden = function() + return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger)) + end, }, useIgnoreNameSpace = { type = "description", name = "", order = 32.1, width = WeakAuras.normalWidth, - hidden = function() return not (trigger.type == "aura2" and not trigger.useIgnoreName and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger)) end + hidden = function() + return not (trigger.type == "aura2" and not trigger.useIgnoreName and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger)) + end, }, useIgnoreExactSpellId = { type = "toggle", name = L["Ignored Exact Spell ID(s)"], width = WeakAuras.normalWidth - 0.2, order = 42, - hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger)) end + hidden = function() + return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger)) + end, }, useIgnoreExactSpellIddSpace = { type = "description", name = "", order = 42.1, width = WeakAuras.normalWidth, - hidden = function() return not (trigger.type == "aura2" and not trigger.useIgnoreExactSpellId and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger)) end + hidden = function() + return not (trigger.type == "aura2" and not trigger.useIgnoreExactSpellId and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger)) + end, }, useNamePattern = { @@ -378,29 +427,37 @@ local function GetBuffTriggerOptions(data, triggernum) name = L["Name Pattern Match"], desc = L["Filter based on the spell Name string."], order = 55, - hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi") end + hidden = function() + return not (trigger.type == "aura2" and trigger.unit ~= "multi") + end, }, useNamePatternSpace = { type = "description", name = "", order = 55.2, width = WeakAuras.normalWidth, - hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and not trigger.useNamePattern) end + hidden = function() + return not (trigger.type == "aura2" and trigger.unit ~= "multi" and not trigger.useNamePattern) + end, }, namePattern_operator = { type = "select", width = WeakAuras.normalWidth, name = L["Operator"], order = 55.1, - hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and trigger.useNamePattern) end, - values = OptionsPrivate.Private.string_operator_types + hidden = function() + return not (trigger.type == "aura2" and trigger.unit ~= "multi" and trigger.useNamePattern) + end, + values = OptionsPrivate.Private.string_operator_types, }, namePattern_name = { type = "input", name = L["Aura Name Pattern"], width = WeakAuras.doubleWidth, order = 55.2, - hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and trigger.useNamePattern) end + hidden = function() + return not (trigger.type == "aura2" and trigger.unit ~= "multi" and trigger.useNamePattern) + end, }, aura_filters_header = { type = "header", @@ -411,8 +468,10 @@ local function GetBuffTriggerOptions(data, triggernum) type = "toggle", width = WeakAuras.normalWidth, name = L["Stack Count"], - hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger)) end, - order = 60 + hidden = function() + return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger)) + end, + order = 60, }, stacksOperator = { type = "select", @@ -420,9 +479,15 @@ local function GetBuffTriggerOptions(data, triggernum) order = 60.1, width = WeakAuras.halfWidth, values = OptionsPrivate.Private.operator_types, - disabled = function() return not trigger.useStacks end, - hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.useStacks) end, - get = function() return trigger.useStacks and trigger.stacksOperator or nil end + disabled = function() + return not trigger.useStacks + end, + hidden = function() + return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.useStacks) + end, + get = function() + return trigger.useStacks and trigger.stacksOperator or nil + end, }, stacks = { type = "input", @@ -430,22 +495,30 @@ local function GetBuffTriggerOptions(data, triggernum) validate = ValidateNumeric, order = 60.2, width = WeakAuras.halfWidth, - hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.useStacks) end, - get = function() return trigger.useStacks and trigger.stacks or nil end + hidden = function() + return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.useStacks) + end, + get = function() + return trigger.useStacks and trigger.stacks or nil + end, }, useStacksSpace = { type = "description", width = WeakAuras.normalWidth, name = "", order = 60.3, - hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and not trigger.useStacks) end + hidden = function() + return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and not trigger.useStacks) + end, }, useRem = { type = "toggle", width = WeakAuras.normalWidth, name = L["Remaining Time"], - hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger)) end, - order = 61 + hidden = function() + return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger)) + end, + order = 61, }, remOperator = { type = "select", @@ -453,9 +526,15 @@ local function GetBuffTriggerOptions(data, triggernum) order = 61.1, width = WeakAuras.halfWidth, values = OptionsPrivate.Private.operator_types, - disabled = function() return not trigger.useRem end, - hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.useRem) end, - get = function() return trigger.useRem and trigger.remOperator or nil end + disabled = function() + return not trigger.useRem + end, + hidden = function() + return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.useRem) + end, + get = function() + return trigger.useRem and trigger.remOperator or nil + end, }, rem = { type = "input", @@ -463,22 +542,30 @@ local function GetBuffTriggerOptions(data, triggernum) validate = ValidateNumeric, order = 61.2, width = WeakAuras.halfWidth, - hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.useRem) end, - get = function() return trigger.useRem and trigger.rem or nil end + hidden = function() + return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.useRem) + end, + get = function() + return trigger.useRem and trigger.rem or nil + end, }, useRemSpace = { type = "description", width = WeakAuras.normalWidth, name = "", order = 61.3, - hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and not trigger.useRem) end + hidden = function() + return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and not trigger.useRem) + end, }, useTotal = { type = "toggle", width = WeakAuras.normalWidth, name = L["Total Time"], - hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger)) end, - order = 61.4 + hidden = function() + return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger)) + end, + order = 61.4, }, totalOperator = { type = "select", @@ -486,9 +573,15 @@ local function GetBuffTriggerOptions(data, triggernum) order = 61.5, width = WeakAuras.halfWidth, values = OptionsPrivate.Private.operator_types, - disabled = function() return not trigger.useTotal end, - hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.useTotal) end, - get = function() return trigger.useTotal and trigger.totalOperator or nil end + disabled = function() + return not trigger.useTotal + end, + hidden = function() + return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.useTotal) + end, + get = function() + return trigger.useTotal and trigger.totalOperator or nil + end, }, total = { type = "input", @@ -496,134 +589,196 @@ local function GetBuffTriggerOptions(data, triggernum) validate = ValidateNumeric, order = 61.6, width = WeakAuras.halfWidth, - hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.useTotal) end, - get = function() return trigger.useTotal and trigger.total or nil end + hidden = function() + return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.useTotal) + end, + get = function() + return trigger.useTotal and trigger.total or nil + end, }, useTotalSpace = { type = "description", width = WeakAuras.normalWidth, name = "", order = 61.7, - hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and not trigger.useTotal) end + hidden = function() + return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and not trigger.useTotal) + end, }, use_stealable = { type = "toggle", name = function(input) local value = trigger.use_stealable - if value == nil then return L["Is Stealable"] - elseif value == false then return "|cFFFF0000 " .. L["Negator"] .. " " .. L["Is Stealable"] .. "|r" - else return "|cFF00FF00" .. L["Is Stealable"] .. "|r" end + if value == nil then + return L["Is Stealable"] + elseif value == false then + return "|cFFFF0000 " .. L["Negator"] .. " " .. L["Is Stealable"] .. "|r" + else + return "|cFF00FF00" .. L["Is Stealable"] .. "|r" + end end, width = WeakAuras.doubleWidth, order = 64, - hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger)) end, + hidden = function() + return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger)) + end, get = function() local value = trigger.use_stealable - if value == nil then return false - elseif value == false then return "false" - else return "true" end + if value == nil then + return false + elseif value == false then + return "false" + else + return "true" + end end, set = function(info, v) if v then trigger.use_stealable = true else local value = trigger.use_stealable - if value == false then trigger.use_stealable = nil - else trigger.use_stealable = false end + if value == false then + trigger.use_stealable = nil + else + trigger.use_stealable = false + end end WeakAuras.Add(data) - end + end, }, use_isBossDebuff = { type = "toggle", name = function(input) local value = trigger.use_isBossDebuff - if value == nil then return L["Is Boss Debuff"] - elseif value == false then return "|cFFFF0000 " .. L["Negator"] .. " " .. L["Is Boss Debuff"] .. "|r" - else return "|cFF00FF00" .. L["Is Boss Debuff"] .. "|r" end + if value == nil then + return L["Is Boss Debuff"] + elseif value == false then + return "|cFFFF0000 " .. L["Negator"] .. " " .. L["Is Boss Debuff"] .. "|r" + else + return "|cFF00FF00" .. L["Is Boss Debuff"] .. "|r" + end end, width = WeakAuras.doubleWidth, order = 64.1, - hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger)) end, + hidden = function() + return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger)) + end, get = function() local value = trigger.use_isBossDebuff - if value == nil then return false - elseif value == false then return "false" - else return "true" end + if value == nil then + return false + elseif value == false then + return "false" + else + return "true" + end end, set = function(info, v) if v then trigger.use_isBossDebuff = true else local value = trigger.use_isBossDebuff - if value == false then trigger.use_isBossDebuff = nil - else trigger.use_isBossDebuff = false end + if value == false then + trigger.use_isBossDebuff = nil + else + trigger.use_isBossDebuff = false + end end WeakAuras.Add(data) - end + end, }, use_castByPlayer = { type = "toggle", name = function() local value = trigger.use_castByPlayer - if value == nil then return L["Cast by a Player Character"] - elseif value == false then return "|cFFFF0000 "..L["Negator"].." "..L["Cast by a Player Character"] - else return "|cFF00FF00"..L["Cast by a Player Character"] end + if value == nil then + return L["Cast by a Player Character"] + elseif value == false then + return "|cFFFF0000 " .. L["Negator"] .. " " .. L["Cast by a Player Character"] + else + return "|cFF00FF00" .. L["Cast by a Player Character"] + end end, desc = L["Only Match auras cast by a player (not an npc)"], width = WeakAuras.doubleWidth, order = 64.2, - hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger)) end, + hidden = function() + return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger)) + end, get = function() local value = trigger.use_castByPlayer - if value == nil then return false - elseif value == false then return "false" - else return "true" end + if value == nil then + return false + elseif value == false then + return "false" + else + return "true" + end end, set = function(info, v) if v then trigger.use_castByPlayer = true else local value = trigger.use_castByPlayer - if value == false then trigger.use_castByPlayer = nil - else trigger.use_castByPlayer = false end + if value == false then + trigger.use_castByPlayer = nil + else + trigger.use_castByPlayer = false + end end WeakAuras.Add(data) - end + end, }, ownOnly = { type = "toggle", width = WeakAuras.doubleWidth, name = function() local value = trigger.ownOnly - if value == nil then return L["Own Only"] - elseif value == false then return "|cFFFF0000 " .. L["Negator"] .. " " .. L["Own Only"] .. "|r" - else return "|cFF00FF00" .. L["Own Only"] .. "|r" end + if value == nil then + return L["Own Only"] + elseif value == false then + return "|cFFFF0000 " .. L["Negator"] .. " " .. L["Own Only"] .. "|r" + else + return "|cFF00FF00" .. L["Own Only"] .. "|r" + end end, desc = function() local value = trigger.ownOnly - if value == nil then return L["Only match auras cast by the player or his pet"] - elseif value == false then return L["Only match auras cast by people other than the player or his pet"] - else return L["Only match auras cast by the player or his pet"] end + if value == nil then + return L["Only match auras cast by the player or his pet"] + elseif value == false then + return L["Only match auras cast by people other than the player or his pet"] + else + return L["Only match auras cast by the player or his pet"] + end end, get = function() local value = trigger.ownOnly - if value == nil then return false - elseif value == false then return "false" - else return "true" end + if value == nil then + return false + elseif value == false then + return "false" + else + return "true" + end end, set = function(info, v) if v then trigger.ownOnly = true else local value = trigger.ownOnly - if value == false then trigger.ownOnly = nil - else trigger.ownOnly = false end + if value == false then + trigger.ownOnly = nil + else + trigger.ownOnly = false + end end WeakAuras.Add(data) end, order = 64.3, - hidden = function() return not trigger.type == "aura2" end + hidden = function() + return not trigger.type == "aura2" + end, }, fetchTooltip = { @@ -632,68 +787,90 @@ local function GetBuffTriggerOptions(data, triggernum) desc = L["This adds %tooltip, %tooltip1, %tooltip2, %tooltip3 as text replacements and also allows filtering based on the tooltip content/values."], order = 64.5, width = WeakAuras.doubleWidth, - hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and not IsSingleMissing(trigger)) end + hidden = function() + return not (trigger.type == "aura2" and trigger.unit ~= "multi" and not IsSingleMissing(trigger)) + end, }, use_tooltip = { type = "toggle", width = WeakAuras.normalWidth, name = L["Tooltip Pattern Match"], order = 64.51, - hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.fetchTooltip) end + hidden = function() + return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.fetchTooltip) + end, }, use_tooltipSpace = { type = "description", name = "", order = 64.52, width = WeakAuras.normalWidth, - hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and not trigger.use_tooltip and trigger.fetchTooltip) end + hidden = function() + return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and not trigger.use_tooltip and trigger.fetchTooltip) + end, }, tooltip_operator = { type = "select", width = WeakAuras.normalWidth, name = L["Operator"], order = 64.53, - disabled = function() return not trigger.use_tooltip end, - hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.use_tooltip and trigger.fetchTooltip) end, - values = OptionsPrivate.Private.string_operator_types + disabled = function() + return not trigger.use_tooltip + end, + hidden = function() + return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.use_tooltip and trigger.fetchTooltip) + end, + values = OptionsPrivate.Private.string_operator_types, }, tooltip = { type = "input", name = L["Tooltip Content"], width = WeakAuras.doubleWidth, order = 64.54, - disabled = function() return not trigger.use_tooltip end, - hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.use_tooltip and trigger.fetchTooltip) end + disabled = function() + return not trigger.use_tooltip + end, + hidden = function() + return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.use_tooltip and trigger.fetchTooltip) + end, }, use_tooltipValue = { type = "toggle", width = WeakAuras.normalWidth, name = L["Tooltip Value"], order = 64.55, - hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.fetchTooltip) end + hidden = function() + return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.fetchTooltip) + end, }, tooltipValueNumber = { type = "select", width = WeakAuras.normalWidth, name = L["Tooltip Value #"], order = 64.56, - hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.use_tooltipValue and trigger.fetchTooltip) end, - values = OptionsPrivate.Private.tooltip_count + hidden = function() + return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.use_tooltipValue and trigger.fetchTooltip) + end, + values = OptionsPrivate.Private.tooltip_count, }, use_tooltipValueSpace = { type = "description", name = "", order = 64.57, width = WeakAuras.normalWidth, - hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and not trigger.use_tooltipValue and trigger.fetchTooltip) end + hidden = function() + return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and not trigger.use_tooltipValue and trigger.fetchTooltip) + end, }, tooltipValue_operator = { type = "select", width = WeakAuras.normalWidth, name = L["Operator"], order = 64.58, - hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.use_tooltipValue and trigger.fetchTooltip) end, - values = OptionsPrivate.Private.operator_types + hidden = function() + return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.use_tooltipValue and trigger.fetchTooltip) + end, + values = OptionsPrivate.Private.operator_types, }, tooltipValue = { type = "input", @@ -701,20 +878,26 @@ local function GetBuffTriggerOptions(data, triggernum) width = WeakAuras.normalWidth, validate = ValidateNumeric, order = 64.59, - hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.use_tooltipValue and trigger.fetchTooltip) end + hidden = function() + return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.use_tooltipValue and trigger.fetchTooltip) + end, }, unit_filters_header = { type = "header", name = L["Affected Unit Filters and Info"], order = 65, - hidden = function() return trigger.unit == "multi" end, + hidden = function() + return trigger.unit == "multi" + end, }, useAffected = { type = "toggle", name = L["Fetch Affected/Unaffected Names"], width = WeakAuras.doubleWidth, order = 65.1, - hidden = function() return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")) end + hidden = function() + return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")) + end, }, fetchRole = { type = "toggle", @@ -723,9 +906,8 @@ local function GetBuffTriggerOptions(data, triggernum) order = 65.2, width = WeakAuras.doubleWidth, hidden = function() - return not (trigger.type == "aura2" and trigger.unit ~= "multi") - or WeakAuras.IsClassicOrBCCOrWrath() - end + return not (trigger.type == "aura2" and trigger.unit ~= "multi") or WeakAuras.IsClassicOrBCCOrWrath() + end, }, fetchRaidMark = { type = "toggle", @@ -735,16 +917,16 @@ local function GetBuffTriggerOptions(data, triggernum) width = WeakAuras.doubleWidth, hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi") - end + end, }, use_includePets = { type = "toggle", width = WeakAuras.normalWidth, name = L["Include Pets"], order = 66.1, - hidden = function() return - not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")) - end + hidden = function() + return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")) + end, }, includePets = { type = "select", @@ -752,7 +934,9 @@ local function GetBuffTriggerOptions(data, triggernum) width = WeakAuras.normalWidth, name = L["Include Pets"], order = 66.15, - hidden = function() return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and trigger.use_includePets) end, + hidden = function() + return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and trigger.use_includePets) + end, }, includePetsSpace = { type = "description", @@ -760,9 +944,8 @@ local function GetBuffTriggerOptions(data, triggernum) order = 66.16, width = WeakAuras.normalWidth, hidden = function() - return not (trigger.type == "aura2" - and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and not trigger.use_includePets) - end + return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and not trigger.use_includePets) + end, }, useActualSpec = { @@ -771,9 +954,8 @@ local function GetBuffTriggerOptions(data, triggernum) name = L["Filter by Specialization"], desc = L["Requires LibSpecialization, that is e.g. a up-to date WeakAuras version"], order = 66.3, - hidden = function() return - not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") - and WeakAuras.IsRetail()) + hidden = function() + return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and WeakAuras.IsRetail()) end, }, actualSpec = { @@ -783,12 +965,9 @@ local function GetBuffTriggerOptions(data, triggernum) desc = L["Requires syncing the specialization via LibSpecialization."], values = OptionsPrivate.Private.spec_types_all, hidden = function() - return not (trigger.type == "aura2" - and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") - and trigger.useActualSpec - and WeakAuras.IsRetail()) + return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and trigger.useActualSpec and WeakAuras.IsRetail()) end, - order = 66.4 + order = 66.4, }, actualSpecSpace = { type = "description", @@ -796,11 +975,13 @@ local function GetBuffTriggerOptions(data, triggernum) order = 66.5, width = WeakAuras.normalWidth, hidden = function() - return not (trigger.type == "aura2" - and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") - and not trigger.useActualSpec - and WeakAuras.IsRetail()) - end + return not ( + trigger.type == "aura2" + and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") + and not trigger.useActualSpec + and WeakAuras.IsRetail() + ) + end, }, useGroupRole = { @@ -808,71 +989,67 @@ local function GetBuffTriggerOptions(data, triggernum) width = WeakAuras.normalWidth, name = L["Filter by Group Role"], order = 67.1, - hidden = function() return - not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")) - or WeakAuras.IsClassicOrBCC() - end + hidden = function() + return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")) or WeakAuras.IsClassicOrBCC() + end, }, group_role = { type = "multiselect", width = WeakAuras.normalWidth, name = L["Group Role"], values = OptionsPrivate.Private.role_types, - hidden = function() return - not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and trigger.useGroupRole) - or WeakAuras.IsClassicOrBCC() + hidden = function() + return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and trigger.useGroupRole) + or WeakAuras.IsClassicOrBCC() end, - order = 67.2 + order = 67.2, }, group_roleSpace = { type = "description", name = "", order = 67.2, width = WeakAuras.normalWidth, - hidden = function() return - not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and not trigger.useGroupRole) - or WeakAuras.IsClassicOrBCC() - end + hidden = function() + return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and not trigger.useGroupRole) + or WeakAuras.IsClassicOrBCC() + end, }, useRaidRole = { type = "toggle", width = WeakAuras.normalWidth, name = L["Filter by Raid Role"], order = 67.1, - hidden = function() return - not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")) - or WeakAuras.IsRetail() - end + hidden = function() + return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")) or WeakAuras.IsRetail() + end, }, raid_role = { type = "multiselect", width = WeakAuras.normalWidth, name = L["Raid Role"], values = OptionsPrivate.Private.raid_role_types, - hidden = function() return - not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and trigger.useRaidRole) - or WeakAuras.IsRetail() + hidden = function() + return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and trigger.useRaidRole) or WeakAuras.IsRetail() end, - order = 67.2 + order = 67.2, }, raid_roleSpace = { type = "description", name = "", order = 67.2, width = WeakAuras.normalWidth, - hidden = function() return - not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and not trigger.useRaidRole) - or WeakAuras.IsRetail() - end + hidden = function() + return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and not trigger.useRaidRole) or WeakAuras.IsRetail() + end, }, useArenaSpec = { type = "toggle", width = WeakAuras.normalWidth, name = L["Filter by Arena Spec"], order = 67.3, - hidden = function() return - not (WeakAuras.IsRetail() and trigger.type == "aura2" and trigger.unit == "arena") - end + hidden = function() + return not (WeakAuras.IsRetail() and trigger.type == "aura2" and trigger.unit == "arena") + end, }, arena_spec = { type = "multiselect", @@ -882,7 +1059,7 @@ local function GetBuffTriggerOptions(data, triggernum) hidden = function() return not (WeakAuras.IsRetail() and trigger.type == "aura2" and trigger.unit == "arena" and trigger.useArenaSpec) end, - order = 67.4 + order = 67.4, }, arena_specSpace = { type = "description", @@ -899,24 +1076,28 @@ local function GetBuffTriggerOptions(data, triggernum) width = WeakAuras.normalWidth, name = L["Filter by Class"], order = 68.1, - hidden = function() return - not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")) - end + hidden = function() + return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")) + end, }, class = { type = "multiselect", width = WeakAuras.normalWidth, name = L["Class"], values = WeakAuras.class_types, - hidden = function() return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and trigger.useClass) end, - order = 68.2 + hidden = function() + return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and trigger.useClass) + end, + order = 68.2, }, classSpace = { type = "description", name = "", order = 68.3, width = WeakAuras.normalWidth, - hidden = function() return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and not trigger.useClass) end + hidden = function() + return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and not trigger.useClass) + end, }, useUnitName = { @@ -924,9 +1105,9 @@ local function GetBuffTriggerOptions(data, triggernum) width = WeakAuras.normalWidth, name = L["Filter by Unit Name"], order = 68.4, - hidden = function() return - not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")) - end + hidden = function() + return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")) + end, }, unitName = { type = "input", @@ -935,9 +1116,8 @@ local function GetBuffTriggerOptions(data, triggernum) desc = L["Filter formats: 'Name', 'Name-Realm', '-Realm'.\n\nSupports multiple entries, separated by commas\nCan use \\ to escape -."], order = 68.5, hidden = function() - return not (trigger.type == "aura2" - and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and trigger.useUnitName) - end + return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and trigger.useUnitName) + end, }, unitNameSpace = { type = "description", @@ -945,9 +1125,8 @@ local function GetBuffTriggerOptions(data, triggernum) order = 68.5, width = WeakAuras.normalWidth, hidden = function() - return not (trigger.type == "aura2" - and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and not trigger.useUnitName) - end + return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and not trigger.useUnitName) + end, }, useHostility = { @@ -955,24 +1134,28 @@ local function GetBuffTriggerOptions(data, triggernum) width = WeakAuras.normalWidth, name = L["Filter by Nameplate Type"], order = 69.1, - hidden = function() return - not (trigger.type == "aura2" and trigger.unit == "nameplate") - end + hidden = function() + return not (trigger.type == "aura2" and trigger.unit == "nameplate") + end, }, hostility = { type = "select", width = WeakAuras.normalWidth, name = L["Hostility"], values = OptionsPrivate.Private.hostility_types, - hidden = function() return not (trigger.type == "aura2" and trigger.unit == "nameplate" and trigger.useHostility) end, - order = 69.2 + hidden = function() + return not (trigger.type == "aura2" and trigger.unit == "nameplate" and trigger.useHostility) + end, + order = 69.2, }, hostilitySpace = { type = "description", name = "", order = 69.3, width = WeakAuras.normalWidth, - hidden = function() return not (trigger.type == "aura2" and trigger.unit == "nameplate" and not trigger.useHostility) end + hidden = function() + return not (trigger.type == "aura2" and trigger.unit == "nameplate" and not trigger.useHostility) + end, }, useNpcId = { @@ -980,24 +1163,28 @@ local function GetBuffTriggerOptions(data, triggernum) width = WeakAuras.normalWidth, name = L["Filter by Npc ID"], order = 69.31, - hidden = function() return - not (trigger.type == "aura2" and trigger.unit == "nameplate") - end + hidden = function() + return not (trigger.type == "aura2" and trigger.unit == "nameplate") + end, }, npcId = { type = "input", width = WeakAuras.normalWidth, name = L["Npc ID"], validate = ValidateNumeric, - hidden = function() return not (trigger.type == "aura2" and trigger.unit == "nameplate" and trigger.useNpcId) end, - order = 69.32 + hidden = function() + return not (trigger.type == "aura2" and trigger.unit == "nameplate" and trigger.useNpcId) + end, + order = 69.32, }, npcIdSpace = { type = "description", name = "", order = 69.33, width = WeakAuras.normalWidth, - hidden = function() return not (trigger.type == "aura2" and trigger.unit == "nameplate" and not trigger.useNpcId) end + hidden = function() + return not (trigger.type == "aura2" and trigger.unit == "nameplate" and not trigger.useNpcId) + end, }, ignoreSelf = { @@ -1005,7 +1192,9 @@ local function GetBuffTriggerOptions(data, triggernum) name = L["Ignore Self"], order = 69.35, width = WeakAuras.doubleWidth, - hidden = function() return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" or trigger.unit == "nameplate")) end + hidden = function() + return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" or trigger.unit == "nameplate")) + end, }, ignoreDead = { @@ -1013,7 +1202,9 @@ local function GetBuffTriggerOptions(data, triggernum) name = L["Ignore Dead"], order = 69.4, width = WeakAuras.doubleWidth, - hidden = function() return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")) end + hidden = function() + return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")) + end, }, ignoreDisconnected = { @@ -1021,7 +1212,9 @@ local function GetBuffTriggerOptions(data, triggernum) name = L["Ignore Disconnected"], order = 69.8, width = WeakAuras.doubleWidth, - hidden = function() return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")) end + hidden = function() + return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")) + end, }, ignoreInvisible = { type = "toggle", @@ -1029,7 +1222,9 @@ local function GetBuffTriggerOptions(data, triggernum) desc = L["Uses UnitIsVisible() to check if in range. This is polled every second."], order = 69.9, width = WeakAuras.doubleWidth, - hidden = function() return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")) end + hidden = function() + return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")) + end, }, show_settings_header = { @@ -1041,28 +1236,34 @@ local function GetBuffTriggerOptions(data, triggernum) type = "description", order = 69.92, width = WeakAuras.doubleWidth, - hidden = function() return not (trigger.type == "aura2" and IsGroupTrigger(trigger)) end, + hidden = function() + return not (trigger.type == "aura2" and IsGroupTrigger(trigger)) + end, name = L["|cff999999Triggers tracking multiple units will default to being active even while no affected units are found without a Unit Count or Match Count setting applied.|r"], }, useGroup_count = { type = "toggle", width = WeakAuras.normalWidth, name = L["Unit Count"], - hidden = function() return not (trigger.type == "aura2" and IsGroupTrigger(trigger)) end, - order = 70 + hidden = function() + return not (trigger.type == "aura2" and IsGroupTrigger(trigger)) + end, + order = 70, }, useGroup_countSpace = { type = "description", name = "", order = 70.1, width = WeakAuras.normalWidth, - hidden = function() return not (trigger.type == "aura2" and IsGroupTrigger(trigger) and not trigger.useGroup_count) end + hidden = function() + return not (trigger.type == "aura2" and IsGroupTrigger(trigger) and not trigger.useGroup_count) + end, }, group_countOperator = { type = "select", name = L["Operator"], desc = function() - if (trigger.unit == "multi") then + if trigger.unit == "multi" then return L["Compare against the number of units affected."] else local groupType = OptionsPrivate.Private.unit_types_bufftrigger_2[trigger.unit or "group"] or "|cFFFF0000Error|r" @@ -1072,14 +1273,18 @@ local function GetBuffTriggerOptions(data, triggernum) order = 70.2, width = WeakAuras.halfWidth, values = OptionsPrivate.Private.operator_types, - hidden = function() return not (trigger.type == "aura2" and IsGroupTrigger(trigger) and trigger.useGroup_count) end, - get = function() return trigger.group_countOperator end + hidden = function() + return not (trigger.type == "aura2" and IsGroupTrigger(trigger) and trigger.useGroup_count) + end, + get = function() + return trigger.group_countOperator + end, }, group_count = { type = "input", name = L["Count"], desc = function() - if (trigger.unit == "multi") then + if trigger.unit == "multi" then return L["Compare against the number of units affected."] else local groupType = OptionsPrivate.Private.unit_types_bufftrigger_2[trigger.unit or "group"] or "|cFFFF0000Error|r" @@ -1088,7 +1293,9 @@ local function GetBuffTriggerOptions(data, triggernum) end, order = 70.3, width = WeakAuras.halfWidth, - hidden = function() return not (trigger.type == "aura2" and IsGroupTrigger(trigger) and trigger.useGroup_count) end, + hidden = function() + return not (trigger.type == "aura2" and IsGroupTrigger(trigger) and trigger.useGroup_count) + end, }, use_matchesShowOn = { @@ -1096,9 +1303,13 @@ local function GetBuffTriggerOptions(data, triggernum) width = WeakAuras.normalWidth, name = L["Show On"], order = 71, - hidden = function() return not (trigger.type == "aura2" and not IsGroupTrigger(trigger)) end, - get = function() return true end, - disabled = true + hidden = function() + return not (trigger.type == "aura2" and not IsGroupTrigger(trigger)) + end, + get = function() + return true + end, + disabled = true, }, matchesShowOn = { type = "select", @@ -1106,17 +1317,21 @@ local function GetBuffTriggerOptions(data, triggernum) name = L["Show On"], values = OptionsPrivate.Private.bufftrigger_2_progress_behavior_types, order = 71.1, - hidden = function() return not (trigger.type == "aura2" and not IsGroupTrigger(trigger)) end, + hidden = function() + return not (trigger.type == "aura2" and not IsGroupTrigger(trigger)) + end, get = function() return trigger.matchesShowOn or "showOnActive" - end + end, }, useMatch_count = { type = "toggle", width = WeakAuras.normalWidth, name = L["Match Count"], - hidden = function() return not (trigger.type == "aura2" and IsGroupTrigger(trigger)) end, - order = 71.2 + hidden = function() + return not (trigger.type == "aura2" and IsGroupTrigger(trigger)) + end, + order = 71.2, }, useMatch_countSpace = { type = "description", @@ -1132,7 +1347,7 @@ local function GetBuffTriggerOptions(data, triggernum) else return trigger.matchesShowOn ~= "showOnMatches" end - end + end, }, match_countOperator = { type = "select", @@ -1140,25 +1355,30 @@ local function GetBuffTriggerOptions(data, triggernum) order = 71.4, width = WeakAuras.halfWidth, values = OptionsPrivate.Private.operator_types, - hidden = function() return not (trigger.type == "aura2" and HasMatchCount(trigger)) end, - desc = L["Counts the number of matches over all units."] + hidden = function() + return not (trigger.type == "aura2" and HasMatchCount(trigger)) + end, + desc = L["Counts the number of matches over all units."], }, match_count = { type = "input", name = L["Count"], order = 71.5, width = WeakAuras.halfWidth, - hidden = function() return not (trigger.type == "aura2" and HasMatchCount(trigger)) end, + hidden = function() + return not (trigger.type == "aura2" and HasMatchCount(trigger)) + end, validate = ValidateNumeric, - desc = L["Counts the number of matches over all units."] + desc = L["Counts the number of matches over all units."], }, useMatchPerUnit_count = { type = "toggle", width = WeakAuras.normalWidth, name = L["Match Count per Unit"], - hidden = function() return not (trigger.type == "aura2" and IsGroupTrigger(trigger) - and trigger.showClones and trigger.combinePerUnit and trigger.perUnitMode ~= "unaffected") end, - order = 71.6 + hidden = function() + return not (trigger.type == "aura2" and IsGroupTrigger(trigger) and trigger.showClones and trigger.combinePerUnit and trigger.perUnitMode ~= "unaffected") + end, + order = 71.6, }, useMatchPerUnit_countSpace = { type = "description", @@ -1166,12 +1386,11 @@ local function GetBuffTriggerOptions(data, triggernum) order = 71.7, width = WeakAuras.normalWidth, hidden = function() - if trigger.type == "aura2" and IsGroupTrigger(trigger) - and trigger.showClones and trigger.combinePerUnit and trigger.perUnitMode ~= "unaffected" then - return trigger.useMatchPerUnit_count + if trigger.type == "aura2" and IsGroupTrigger(trigger) and trigger.showClones and trigger.combinePerUnit and trigger.perUnitMode ~= "unaffected" then + return trigger.useMatchPerUnit_count end return true - end + end, }, matchPerUnit_countOperator = { type = "select", @@ -1179,28 +1398,34 @@ local function GetBuffTriggerOptions(data, triggernum) order = 71.8, width = WeakAuras.halfWidth, values = OptionsPrivate.Private.operator_types, - hidden = function() return not (HasMatchPerUnitCount(trigger)) end, - desc = L["Counts the number of matches per unit."] + hidden = function() + return not (HasMatchPerUnitCount(trigger)) + end, + desc = L["Counts the number of matches per unit."], }, matchPerUnit_count = { type = "input", name = L["Count"], order = 71.9, width = WeakAuras.halfWidth, - hidden = function() return not (HasMatchPerUnitCount(trigger)) end, + hidden = function() + return not (HasMatchPerUnitCount(trigger)) + end, validate = ValidateNumeric, - desc = L["Counts the number of matches per unit."] + desc = L["Counts the number of matches per unit."], }, showClones = { type = "toggle", name = L["Auto-Clone (Show All Matches)"], order = 72, - hidden = function() return not (trigger.type == "aura2" and not IsSingleMissing(trigger)) end, + hidden = function() + return not (trigger.type == "aura2" and not IsSingleMissing(trigger)) + end, width = WeakAuras.doubleWidth, set = function(info, v) trigger.showClones = v WeakAuras.Add(data) - end + end, }, combinePerUnit = { type = "toggle", @@ -1209,7 +1434,7 @@ local function GetBuffTriggerOptions(data, triggernum) order = 72.2, hidden = function() return not (trigger.type == "aura2" and IsGroupTrigger(trigger) and trigger.showClones) - end + end, }, use_perUnitMode = { type = "toggle", @@ -1219,8 +1444,10 @@ local function GetBuffTriggerOptions(data, triggernum) hidden = function() return not (trigger.type == "aura2" and IsGroupTrigger(trigger) and trigger.showClones and trigger.unit ~= "multi" and trigger.combinePerUnit) end, - get = function() return true end, - disabled = true + get = function() + return true + end, + disabled = true, }, perUnitMode = { type = "select", @@ -1233,7 +1460,7 @@ local function GetBuffTriggerOptions(data, triggernum) end, get = function() return trigger.perUnitMode or "affected" - end + end, }, use_combineMode = { type = "toggle", @@ -1241,8 +1468,8 @@ local function GetBuffTriggerOptions(data, triggernum) name = L["Preferred Match"], order = 72.5, hidden = function() - if (trigger.type == "aura2") then - if (IsGroupTrigger(trigger)) then + if trigger.type == "aura2" then + if IsGroupTrigger(trigger) then if trigger.showClones then return not (trigger.combinePerUnit and trigger.perUnitMode ~= "unaffected") else @@ -1254,8 +1481,10 @@ local function GetBuffTriggerOptions(data, triggernum) end return true end, - get = function() return true end, - disabled = true + get = function() + return true + end, + disabled = true, }, combineMode = { type = "select", @@ -1264,8 +1493,8 @@ local function GetBuffTriggerOptions(data, triggernum) order = 72.6, width = WeakAuras.normalWidth, hidden = function() - if (trigger.type == "aura2") then - if (IsGroupTrigger(trigger)) then + if trigger.type == "aura2" then + if IsGroupTrigger(trigger) then if trigger.showClones then return not (trigger.combinePerUnit and trigger.perUnitMode ~= "unaffected") else @@ -1279,7 +1508,7 @@ local function GetBuffTriggerOptions(data, triggernum) end, get = function() return trigger.combineMode or "showLowest" - end + end, }, unitExists = { type = "toggle", @@ -1298,37 +1527,77 @@ local function GetBuffTriggerOptions(data, triggernum) local ignoreNameOptionSize = CountNames(data, triggernum, "ignoreAuraNames") + 1 local ignoreSpellOptionsSize = CountNames(data, triggernum, "ignoreAuraSpellids") + 1 - CreateNameOptions(aura_options, data, trigger, nameOptionSize, - false, false, "name", 12, "useName", "auranames", - L["Aura Name"], - L["Enter an Aura Name, partial Aura Name, or Spell ID. A Spell ID will match any spells with the same name."], - IsSingleMissing(trigger)) + CreateNameOptions( + aura_options, + data, + trigger, + nameOptionSize, + false, + false, + "name", + 12, + "useName", + "auranames", + L["Aura Name"], + L["Enter an Aura Name, partial Aura Name, or Spell ID. A Spell ID will match any spells with the same name."], + IsSingleMissing(trigger) + ) + CreateNameOptions( + aura_options, + data, + trigger, + spellOptionsSize, + true, + false, + "spellid", + 22, + "useExactSpellId", + "auraspellids", + L["Spell ID"], + L["Enter a Spell ID"], + IsSingleMissing(trigger) + ) - CreateNameOptions(aura_options, data, trigger, spellOptionsSize, - true, false, "spellid", 22, "useExactSpellId", "auraspellids", - L["Spell ID"], L["Enter a Spell ID"], - IsSingleMissing(trigger)) + CreateNameOptions( + aura_options, + data, + trigger, + ignoreNameOptionSize, + false, + true, + "ignorename", + 32, + "useIgnoreName", + "ignoreAuraNames", + L["Ignored Aura Name"], + L["Enter an Aura Name, partial Aura Name, or Spell ID. A Spell ID will match any spells with the same name."], + IsSingleMissing(trigger) + ) - CreateNameOptions(aura_options, data, trigger, ignoreNameOptionSize, - false, true, "ignorename", 32, "useIgnoreName", "ignoreAuraNames", - L["Ignored Aura Name"], - L["Enter an Aura Name, partial Aura Name, or Spell ID. A Spell ID will match any spells with the same name."], - IsSingleMissing(trigger)) - - CreateNameOptions(aura_options, data, trigger, ignoreSpellOptionsSize, - true, true, "ignorespellid", 42, "useIgnoreExactSpellId", "ignoreAuraSpellids", - L["Ignored Spell ID"], L["Enter a Spell ID"], - IsSingleMissing(trigger)) + CreateNameOptions( + aura_options, + data, + trigger, + ignoreSpellOptionsSize, + true, + true, + "ignorespellid", + 42, + "useIgnoreExactSpellId", + "ignoreAuraSpellids", + L["Ignored Spell ID"], + L["Enter a Spell ID"], + IsSingleMissing(trigger) + ) OptionsPrivate.commonOptions.AddCommonTriggerOptions(aura_options, data, triggernum, true) OptionsPrivate.commonOptions.AddTriggerGetterSetter(aura_options, data, triggernum) OptionsPrivate.AddTriggerMetaFunctions(aura_options, data, triggernum) - return { - ["trigger." .. triggernum .. ".aura_options"] = aura_options + ["trigger." .. triggernum .. ".aura_options"] = aura_options, } end -WeakAuras.RegisterTriggerSystemOptions({"aura2"}, GetBuffTriggerOptions) +WeakAuras.RegisterTriggerSystemOptions({ "aura2" }, GetBuffTriggerOptions) diff --git a/WeakAurasOptions/Cache.lua b/WeakAurasOptions/Cache.lua index dc37ed4aae..c4c3bd157f 100644 --- a/WeakAurasOptions/Cache.lua +++ b/WeakAurasOptions/Cache.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... -- Lua APIs @@ -19,7 +21,7 @@ local bestIcon = {} -- Builds a cache of name/icon pairs from existing spell data -- This is a rather slow operation, so it's only done once, and the result is subsequently saved function spellCache.Build() - if not cache then + if not cache then error("spellCache has not been loaded. Call WeakAuras.spellCache.Load(...) first.") end @@ -35,8 +37,8 @@ function spellCache.Build() id = id + 1 local name, _, icon = GetSpellInfo(id) - if(icon == 136243) then -- 136243 is the a gear icon, we can ignore those spells - misses = 0; + if icon == 136243 then -- 136243 is the a gear icon, we can ignore those spells + misses = 0 elseif name and name ~= "" and icon then cache[name] = cache[name] or {} @@ -56,7 +58,7 @@ function spellCache.Build() for _, category in pairs(GetCategoryList()) do local total = GetCategoryNumAchievements(category, true) for i = 1, total do - local id,name,_,_,_,_,_,_,_,iconID = GetAchievementInfo(category, i) + local id, name, _, _, _, _, _, _, _, iconID = GetAchievementInfo(category, i) if name and iconID then cache[name] = cache[name] or {} if not cache[name].achievements or cache[name].achievements == "" then @@ -86,18 +88,18 @@ function spellCache.Build() end function spellCache.GetIcon(name) - if (name == nil) then - return nil; + if name == nil then + return nil end if cache then - if (bestIcon[name]) then + if bestIcon[name] then return bestIcon[name] end local icons = cache[name] local bestMatch = nil - if (icons) then - if (icons.spells) then + if icons then + if icons.spells then for spell, icon in icons.spells:gmatch("(%d+)=(%d+)") do local spellId = tonumber(spell) @@ -157,19 +159,19 @@ function spellCache.Load(data) metaData = data cache = metaData.spellCache - local _, build = GetBuildInfo(); - local locale = GetLocale(); + local _, build = GetBuildInfo() + local locale = GetLocale() local version = WeakAuras.versionString - local num = 0; - for i,v in pairs(cache) do - num = num + 1; + local num = 0 + for i, v in pairs(cache) do + num = num + 1 end - if(num < 39000 or metaData.locale ~= locale or metaData.build ~= build or metaData.version ~= version or not metaData.spellCacheStrings) then - metaData.build = build; - metaData.locale = locale; - metaData.version = version; + if num < 39000 or metaData.locale ~= locale or metaData.build ~= build or metaData.version ~= version or not metaData.spellCacheStrings then + metaData.build = build + metaData.locale = locale + metaData.version = version metaData.spellCacheAchivements = true metaData.spellCacheStrings = true metaData.needsRebuild = true @@ -181,30 +183,30 @@ end -- It is used in this program to match spell icon textures with "good" spell names; i.e., -- spell names that are very similar to the name of the texture local function Lev(str1, str2) - local matrix = {}; - for i=0, str1:len() do - matrix[i] = {[0] = i}; + local matrix = {} + for i = 0, str1:len() do + matrix[i] = { [0] = i } end - for j=0, str2:len() do - matrix[0][j] = j; + for j = 0, str2:len() do + matrix[0][j] = j end - for j=1, str2:len() do - for i =1, str1:len() do - if(str1:sub(i, i) == str2:sub(j, j)) then - matrix[i][j] = matrix[i-1][j-1]; + for j = 1, str2:len() do + for i = 1, str1:len() do + if str1:sub(i, i) == str2:sub(j, j) then + matrix[i][j] = matrix[i - 1][j - 1] else - matrix[i][j] = math.min(matrix[i-1][j], matrix[i][j-1], matrix[i-1][j-1]) + 1; + matrix[i][j] = math.min(matrix[i - 1][j], matrix[i][j - 1], matrix[i - 1][j - 1]) + 1 end end end - return matrix[str1:len()][str2:len()]; + return matrix[str1:len()][str2:len()] end function spellCache.BestKeyMatch(nearkey) - local bestKey = ""; - local bestDistance = math.huge; - local partialMatches = {}; + local bestKey = "" + local bestDistance = math.huge + local partialMatches = {} if cache[nearkey] then return nearkey end @@ -212,41 +214,41 @@ function spellCache.BestKeyMatch(nearkey) if key:lower() == nearkey:lower() then return key end - if(key:lower():find(nearkey:lower(), 1, true)) then - partialMatches[key] = value; + if key:lower():find(nearkey:lower(), 1, true) then + partialMatches[key] = value end end for key, value in pairs(partialMatches) do - local distance = Lev(nearkey, key); - if(distance < bestDistance) then - bestKey = key; - bestDistance = distance; + local distance = Lev(nearkey, key) + if distance < bestDistance then + bestKey = key + bestDistance = distance end end - return bestKey; + return bestKey end function spellCache.CorrectAuraName(input) - if (not cache) then + if not cache then error("spellCache has not been loaded. Call WeakAuras.spellCache.Load(...) first.") end - local spellId = WeakAuras.SafeToNumber(input); - if(spellId) then - local name, _, icon = GetSpellInfo(spellId); - if(name) then + local spellId = WeakAuras.SafeToNumber(input) + if spellId then + local name, _, icon = GetSpellInfo(spellId) + if name then spellCache.AddIcon(name, spellId, icon) - return name, spellId; + return name, spellId else - return "Invalid Spell ID"; + return "Invalid Spell ID" end else - local ret = spellCache.BestKeyMatch(input); - if(ret == "") then - return "No Match Found", nil; + local ret = spellCache.BestKeyMatch(input) + if ret == "" then + return "No Match Found", nil else - return ret, nil; + return ret, nil end end end diff --git a/WeakAurasOptions/CommonOptions.lua b/WeakAurasOptions/CommonOptions.lua index f822a86328..b4befa2136 100644 --- a/WeakAurasOptions/CommonOptions.lua +++ b/WeakAurasOptions/CommonOptions.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... local L = WeakAuras.L @@ -57,7 +59,6 @@ commonOptionsCache.Clear = function(self) self.data = {} end - local parsePrefix = function(input, data, create) local subRegionIndex, property = string.match(input, "^sub%.(%d+)%..-%.(.+)") subRegionIndex = tonumber(subRegionIndex) @@ -72,9 +73,9 @@ local parsePrefix = function(input, data, create) end return data.subRegions[subRegionIndex], property end - local index = string.find(input, ".", 1, true); - if (index) then - return data, string.sub(input, index + 1); + local index = string.find(input, ".", 1, true) + if index then + return data, string.sub(input, index + 1) end return data, input end @@ -122,8 +123,13 @@ local function addCollapsibleHeader(options, key, input, order, isGroupTab) end end - local titleWidth = WeakAuras.doubleWidth - (hasAdd and 0.15 or 0) - (hasDelete and 0.15 or 0) - (hasUp and 0.15 or 0) - - (hasDown and 0.15 or 0) - (hasDuplicate and 0.15 or 0) - (hasApplyTemplate and 0.15 or 0) + local titleWidth = WeakAuras.doubleWidth + - (hasAdd and 0.15 or 0) + - (hasDelete and 0.15 or 0) + - (hasUp and 0.15 or 0) + - (hasDown and 0.15 or 0) + - (hasDuplicate and 0.15 or 0) + - (hasApplyTemplate and 0.15 or 0) options[key .. "collapseSpacer"] = { type = marginTop and "header" or "description", @@ -148,7 +154,7 @@ local function addCollapsibleHeader(options, key, input, order, isGroupTab) end end, control = "WeakAurasExpand", - hidden = hiddenFunc + hidden = hiddenFunc, } if hasAdd then @@ -161,7 +167,7 @@ local function addCollapsibleHeader(options, key, input, order, isGroupTab) imageWidth = 24, imageHeight = 24, control = "WeakAurasIcon", - hidden = hiddenFunc + hidden = hiddenFunc, } setFuncs(options[key .. "addButton"], input.__add) end @@ -176,7 +182,7 @@ local function addCollapsibleHeader(options, key, input, order, isGroupTab) imageWidth = 24, imageHeight = 24, control = "WeakAurasIcon", - hidden = hiddenFunc + hidden = hiddenFunc, } setFuncs(options[key .. "upButton"], input.__up) end @@ -191,7 +197,7 @@ local function addCollapsibleHeader(options, key, input, order, isGroupTab) imageWidth = 24, imageHeight = 24, control = "WeakAurasIcon", - hidden = hiddenFunc + hidden = hiddenFunc, } setFuncs(options[key .. "downButton"], input.__down) end @@ -206,7 +212,7 @@ local function addCollapsibleHeader(options, key, input, order, isGroupTab) imageWidth = 24, imageHeight = 24, control = "WeakAurasIcon", - hidden = hiddenFunc + hidden = hiddenFunc, } setFuncs(options[key .. "duplicateButton"], input.__duplicate) end @@ -221,7 +227,7 @@ local function addCollapsibleHeader(options, key, input, order, isGroupTab) imageWidth = 24, imageHeight = 24, control = "WeakAurasIcon", - hidden = hiddenFunc + hidden = hiddenFunc, } setFuncs(options[key .. "deleteButton"], input.__delete) end @@ -236,7 +242,7 @@ local function addCollapsibleHeader(options, key, input, order, isGroupTab) imageWidth = 24, imageHeight = 24, control = "WeakAurasIcon", - hidden = hiddenFunc + hidden = hiddenFunc, } setFuncs(options[key .. "applyTemplate"], input.__applyTemplate) end @@ -252,14 +258,16 @@ local function addCollapsibleHeader(options, key, input, order, isGroupTab) end local function copyOptionTable(input, orderAdjustment, collapsedFunc) - local resultOption = CopyTable(input); - resultOption.order = orderAdjustment + resultOption.order; + local resultOption = CopyTable(input) + resultOption.order = orderAdjustment + resultOption.order if collapsedFunc then - local oldHidden = resultOption.hidden; + local oldHidden = resultOption.hidden if oldHidden ~= nil then local oldFunc if type(oldHidden) ~= "function" then - oldFunc = function(...) return oldHidden end + oldFunc = function(...) + return oldHidden + end else oldFunc = oldHidden end @@ -271,15 +279,15 @@ local function copyOptionTable(input, orderAdjustment, collapsedFunc) end end else - resultOption.hidden = collapsedFunc; + resultOption.hidden = collapsedFunc end end - return resultOption; + return resultOption end local flattenRegionOptions = function(allOptions, isGroupTab) - local result = {}; - local base = 1000; + local result = {} + local base = 1000 for optionGroup, options in pairs(allOptions) do local groupBase = base * options.__order @@ -288,12 +296,12 @@ local flattenRegionOptions = function(allOptions, isGroupTab) for optionName, option in pairs(options) do if not optionName:find("^__") then - result[optionGroup .. "." .. optionName] = copyOptionTable(option, groupBase, collapsedFunc); + result[optionGroup .. "." .. optionName] = copyOptionTable(option, groupBase, collapsedFunc) end end end - return result; + return result end local function fixMetaOrders(allOptions) @@ -324,33 +332,33 @@ local function fixMetaOrders(allOptions) end local function removeFuncs(intable, removeFunc) - for i,v in pairs(intable) do - if(i == "get" or i == "set" or i == "hidden" or i == "disabled") then - intable[i] = nil; - elseif (i == "func" and removeFunc) then + for i, v in pairs(intable) do + if i == "get" or i == "set" or i == "hidden" or i == "disabled" then + intable[i] = nil + elseif i == "func" and removeFunc then intable[i] = nil - elseif(type(v) == "table" and i ~= "values" and i ~= "extraFunctions") then + elseif type(v) == "table" and i ~= "values" and i ~= "extraFunctions" then removeFuncs(v, removeFunc) end end end local function getChildOption(options, info) - for i=1,#info do - options = options.args[info[i]]; - if not(options) then - return nil; + for i = 1, #info do + options = options.args[info[i]] + if not options then + return nil end - if (options.hidden) then - local type = type(options.hidden); - if (type == "bool") then - if (options.hidden) then - return nil; + if options.hidden then + local type = type(options.hidden) + if type == "bool" then + if options.hidden then + return nil end - elseif (type == "function") then - if (options.hidden(info)) then - return nil; + elseif type == "function" then + if options.hidden(info) then + return nil end end end @@ -359,161 +367,160 @@ local function getChildOption(options, info) end local function hiddenChild(childOptionTable, info) - for i=#childOptionTable,0,-1 do - if(childOptionTable[i].hidden ~= nil) then - if(type(childOptionTable[i].hidden) == "boolean") then - return childOptionTable[i].hidden; - elseif(type(childOptionTable[i].hidden) == "function") then - return childOptionTable[i].hidden(info); + for i = #childOptionTable, 0, -1 do + if childOptionTable[i].hidden ~= nil then + if type(childOptionTable[i].hidden) == "boolean" then + return childOptionTable[i].hidden + elseif type(childOptionTable[i].hidden) == "function" then + return childOptionTable[i].hidden(info) end end end - return false; + return false end local function CreateHiddenAll(subOption) return function(data, info) - if(#data.controlledChildren == 0) then - return true; + if #data.controlledChildren == 0 then + return true end - for child in OptionsPrivate.Private.TraverseLeafs(data) do + for child in OptionsPrivate.Private.TraverseLeafs(data) do local childOptions = OptionsPrivate.EnsureOptions(child, subOption) - local childOption = childOptions; - local childOptionTable = {[0] = childOption}; - for i=1,#info do - childOption = childOption.args[info[i]]; - childOptionTable[i] = childOption; + local childOption = childOptions + local childOptionTable = { [0] = childOption } + for i = 1, #info do + childOption = childOption.args[info[i]] + childOptionTable[i] = childOption end - if (childOption) then - if (not hiddenChild(childOptionTable, info)) then - return false; + if childOption then + if not hiddenChild(childOptionTable, info) then + return false end end end - return true; + return true end end local function disabledChild(childOptionTable, info) - for i=#childOptionTable,0,-1 do - if(childOptionTable[i].disabled ~= nil) then - if(type(childOptionTable[i].disabled) == "boolean") then - return childOptionTable[i].disabled; - elseif(type(childOptionTable[i].disabled) == "function") then - return childOptionTable[i].disabled(info); + for i = #childOptionTable, 0, -1 do + if childOptionTable[i].disabled ~= nil then + if type(childOptionTable[i].disabled) == "boolean" then + return childOptionTable[i].disabled + elseif type(childOptionTable[i].disabled) == "function" then + return childOptionTable[i].disabled(info) end end end - return false; + return false end local function CreateDisabledAll(subOption) return function(data, info) for child in OptionsPrivate.Private.TraverseLeafs(data) do - local childOptions = OptionsPrivate.EnsureOptions(child, subOption); - local childOption = childOptions; - local childOptionTable = {[0] = childOption}; - for i=1,#info do - childOption = childOption.args[info[i]]; - childOptionTable[i] = childOption; + local childOptions = OptionsPrivate.EnsureOptions(child, subOption) + local childOption = childOptions + local childOptionTable = { [0] = childOption } + for i = 1, #info do + childOption = childOption.args[info[i]] + childOptionTable[i] = childOption end - if (childOption) then - if (not disabledChild(childOptionTable, info)) then - return false; + if childOption then + if not disabledChild(childOptionTable, info) then + return false end end end - return true; + return true end end local function disabledOrHiddenChild(childOptionTable, info) - return hiddenChild(childOptionTable, info) or disabledChild(childOptionTable, info); + return hiddenChild(childOptionTable, info) or disabledChild(childOptionTable, info) end - local function replaceNameDescFuncs(intable, data, subOption) local function compareTables(tableA, tableB) - if(#tableA == #tableB) then - for j=1,#tableA do - if(type(tableA[j]) == "number" and type(tableB[j]) == "number") then - if((math.floor(tableA[j] * 100) / 100) ~= (math.floor(tableB[j] * 100) / 100)) then - return false; + if #tableA == #tableB then + for j = 1, #tableA do + if type(tableA[j]) == "number" and type(tableB[j]) == "number" then + if (math.floor(tableA[j] * 100) / 100) ~= (math.floor(tableB[j] * 100) / 100) then + return false end else - if(tableA[j] ~= tableB[j]) then - return false; + if tableA[j] ~= tableB[j] then + return false end end end else - return false; + return false end - return true; + return true end local function getValueFor(options, info, key) - local childOptionTable = {[0] = options}; - for i=1,#info do - options = options.args[info[i]]; - if (not options) then - return nil; + local childOptionTable = { [0] = options } + for i = 1, #info do + options = options.args[info[i]] + if not options then + return nil end - childOptionTable[i] = options; + childOptionTable[i] = options end - if (disabledOrHiddenChild(childOptionTable, info)) then - return nil; + if disabledOrHiddenChild(childOptionTable, info) then + return nil end - for i=#childOptionTable,0,-1 do - if(childOptionTable[i][key]) then - return childOptionTable[i][key]; + for i = #childOptionTable, 0, -1 do + if childOptionTable[i][key] then + return childOptionTable[i][key] end end - return nil; + return nil end local function combineKeys(info) - local combinedKeys = nil; + local combinedKeys = nil for child in OptionsPrivate.Private.TraverseLeafs(data) do - local values = getValueFor(OptionsPrivate.EnsureOptions(child, subOption), info, "values"); - if (values) then - if (type(values) == "function") then - values = values(info); + local values = getValueFor(OptionsPrivate.EnsureOptions(child, subOption), info, "values") + if values then + if type(values) == "function" then + values = values(info) end - if (type(values) == "table") then - combinedKeys = combinedKeys or {}; + if type(values) == "table" then + combinedKeys = combinedKeys or {} for k, v in pairs(values) do - combinedKeys[k] = v; + combinedKeys[k] = v end end end end - return combinedKeys; + return combinedKeys end local function regionPrefix(input) - local index = string.find(input, ".", 1, true); - if (index) then - local regionType = string.sub(input, 1, index - 1); - return regionOptions[regionType] and regionType; + local index = string.find(input, ".", 1, true) + if index then + local regionType = string.sub(input, 1, index - 1) + return regionOptions[regionType] and regionType end - return nil; + return nil end local function sameAll(info) local cached = commonOptionsCache:GetSameAll(info) - if (cached ~= nil) then + if cached ~= nil then return cached end - local combinedValues = {}; - local first = true; - local combinedKeys = combineKeys(info); + local combinedValues = {} + local first = true + local combinedKeys = combineKeys(info) local isToggle = nil @@ -523,40 +530,40 @@ local function replaceNameDescFuncs(intable, data, subOption) isToggle = childOption and childOption.type == "toggle" end - local regionType = regionPrefix(info[#info]); - if(child and (not regionType or child.regionType == regionType or regionType == "sub")) then + local regionType = regionPrefix(info[#info]) + if child and (not regionType or child.regionType == regionType or regionType == "sub") then local childOptions = OptionsPrivate.EnsureOptions(child, subOption) - local get = getValueFor(childOptions, info, "get"); - if (combinedKeys) then + local get = getValueFor(childOptions, info, "get") + if combinedKeys then for key, _ in pairs(combinedKeys) do - local values = {}; - if (get) then - values = { get(info, key) }; + local values = {} + if get then + values = { get(info, key) } end - if (combinedValues[key] == nil) then - combinedValues[key] = values; + if combinedValues[key] == nil then + combinedValues[key] = values else - if (not compareTables(combinedValues[key], values)) then + if not compareTables(combinedValues[key], values) then commonOptionsCache:SetSameAll(info, false) - return nil; + return nil end end end else - local values = {}; - if (get) then - values = { get(info) }; + local values = {} + if get then + values = { get(info) } if isToggle and values[1] == nil then values[1] = false end end - if(first) then - combinedValues = values; - first = false; + if first then + combinedValues = values + first = false else - if (not compareTables(combinedValues, values)) then + if not compareTables(combinedValues, values) then commonOptionsCache:SetSameAll(info, false) - return nil; + return nil end end end @@ -564,46 +571,46 @@ local function replaceNameDescFuncs(intable, data, subOption) end commonOptionsCache:SetSameAll(info, true) - return true; + return true end local function nameAll(info) local cached = commonOptionsCache:GetNameAll(info) - if (cached ~= nil) then + if cached ~= nil then return cached end - local combinedName; - local first = true; - local foundNames = {}; + local combinedName + local first = true + local foundNames = {} for child in OptionsPrivate.Private.TraverseLeafs(data) do - local childOption = getChildOption(OptionsPrivate.EnsureOptions(child, subOption), info); - if (childOption) then - local name; - if(type(childOption.name) == "function") then - name = childOption.name(info); + local childOption = getChildOption(OptionsPrivate.EnsureOptions(child, subOption), info) + if childOption then + local name + if type(childOption.name) == "function" then + name = childOption.name(info) else - name = childOption.name; + name = childOption.name commonOptionsCache:SetNameAll(info, name) return name end - if (not name) then + if not name then -- Do nothing - elseif(first) then - if (name ~= "") then - combinedName = name; - first = false; + elseif first then + if name ~= "" then + combinedName = name + first = false end - foundNames[name] = true; - elseif not(foundNames[name]) then - if (name ~= "") then - if (childOption.type == "description") then - combinedName = combinedName .. "\n\n" .. name; + foundNames[name] = true + elseif not foundNames[name] then + if name ~= "" then + if childOption.type == "description" then + combinedName = combinedName .. "\n\n" .. name else - combinedName = combinedName .. " / " .. name; + combinedName = combinedName .. " / " .. name end end - foundNames[name] = true; + foundNames[name] = true end end end @@ -615,235 +622,235 @@ local function replaceNameDescFuncs(intable, data, subOption) end local function descAll(info) - local combinedDesc; - local first = true; + local combinedDesc + local first = true for child in OptionsPrivate.Private.TraverseLeafs(data) do - local childOption = getChildOption(OptionsPrivate.EnsureOptions(child, subOption), info); - if (childOption) then - local desc; - if(type(childOption.desc) == "function") then - desc = childOption.desc(info); + local childOption = getChildOption(OptionsPrivate.EnsureOptions(child, subOption), info) + if childOption then + local desc + if type(childOption.desc) == "function" then + desc = childOption.desc(info) else - desc = childOption.desc; + desc = childOption.desc end - if(first) then - combinedDesc = desc; - first = false; - elseif not(combinedDesc == desc) then - return L["Not all children have the same value for this option"]; + if first then + combinedDesc = desc + first = false + elseif not (combinedDesc == desc) then + return L["Not all children have the same value for this option"] end end end - return combinedDesc; + return combinedDesc end local function recurse(intable) - for i,v in pairs(intable) do - if(i == "name" and type(v) ~= "table") then + for i, v in pairs(intable) do + if i == "name" and type(v) ~= "table" then intable.name = function(info) - local name = nameAll(info); - if(sameAll(info)) then - return name; + local name = nameAll(info) + if sameAll(info) then + return name else - if(name == "") then - return name; + if name == "" then + return name else - return "|cFF4080FF"..(name or "error").."|r"; + return "|cFF4080FF" .. (name or "error") .. "|r" end end end intable.desc = function(info) - if(sameAll(info)) then - return descAll(info); + if sameAll(info) then + return descAll(info) else - local combinedKeys = nil; - if (intable.type == "multiselect") then + local combinedKeys = nil + if intable.type == "multiselect" then combinedKeys = combineKeys(info) end - local values = {}; + local values = {} for child in OptionsPrivate.Private.TraverseLeafs(data) do local childOptions = OptionsPrivate.EnsureOptions(child, subOption) - local childOption = childOptions; - local childOptionTable = {[0] = childOption}; - for i=1,#info do - childOption = childOption.args[info[i]]; - childOptionTable[i] = childOption; + local childOption = childOptions + local childOptionTable = { [0] = childOption } + for i = 1, #info do + childOption = childOption.args[info[i]] + childOptionTable[i] = childOption end - if (childOption and not hiddenChild(childOptionTable, info)) then - for i=#childOptionTable,0,-1 do - if(childOptionTable[i].get) then - if(intable.type == "toggle") then - local name, tri; - if(type(childOption.name) == "function") then - name = childOption.name(info); - tri = true; + if childOption and not hiddenChild(childOptionTable, info) then + for i = #childOptionTable, 0, -1 do + if childOptionTable[i].get then + if intable.type == "toggle" then + local name, tri + if type(childOption.name) == "function" then + name = childOption.name(info) + tri = true else - name = childOption.name; + name = childOption.name end - if(tri and childOptionTable[i].get(info)) then - tinsert(values, "|cFFE0E000"..child.id..": |r"..name); - elseif(tri) then - tinsert(values, "|cFFE0E000"..child.id..": |r"..L["Ignored"]); - elseif(childOptionTable[i].get(info)) then - tinsert(values, "|cFFE0E000"..child.id..": |r|cFF00FF00"..L["Enabled"].."|r"); + if tri and childOptionTable[i].get(info) then + tinsert(values, "|cFFE0E000" .. child.id .. ": |r" .. name) + elseif tri then + tinsert(values, "|cFFE0E000" .. child.id .. ": |r" .. L["Ignored"]) + elseif childOptionTable[i].get(info) then + tinsert(values, "|cFFE0E000" .. child.id .. ": |r|cFF00FF00" .. L["Enabled"] .. "|r") else - tinsert(values, "|cFFE0E000"..child.id..": |r|cFFFF0000"..L["Disabled"].."|r"); + tinsert(values, "|cFFE0E000" .. child.id .. ": |r|cFFFF0000" .. L["Disabled"] .. "|r") end - elseif(intable.type == "color") then - local r, g, b = childOptionTable[i].get(info); - r, g, b = r or 1, g or 1, b or 1; - tinsert(values, ("|cFF%2x%2x%2x%s|r"):format(r * 220 + 35, g * 220 + 35, b * 220 + 35, child.id)); - elseif(intable.type == "select") then - local selectValues = type(intable.values) == "table" and intable.values or intable.values(info); - local key = childOptionTable[i].get(info); - local display = key and selectValues[key] or L["None"]; + elseif intable.type == "color" then + local r, g, b = childOptionTable[i].get(info) + r, g, b = r or 1, g or 1, b or 1 + tinsert(values, ("|cFF%2x%2x%2x%s|r"):format(r * 220 + 35, g * 220 + 35, b * 220 + 35, child.id)) + elseif intable.type == "select" then + local selectValues = type(intable.values) == "table" and intable.values or intable.values(info) + local key = childOptionTable[i].get(info) + local display = key and selectValues[key] or L["None"] if intable.dialogControl == "LSM30_Font" then - tinsert(values, "|cFFE0E000"..child.id..": |r" .. key); + tinsert(values, "|cFFE0E000" .. child.id .. ": |r" .. key) else if type(display) == "string" then - tinsert(values, "|cFFE0E000"..child.id..": |r"..display); + tinsert(values, "|cFFE0E000" .. child.id .. ": |r" .. display) elseif type(display) == "table" then - tinsert(values, "|cFFE0E000"..child.id..": |r"..display[1].."/"..display[2] ); + tinsert(values, "|cFFE0E000" .. child.id .. ": |r" .. display[1] .. "/" .. display[2]) end end - elseif(intable.type == "multiselect") then - local selectedValues = {}; + elseif intable.type == "multiselect" then + local selectedValues = {} for k, v in pairs(combinedKeys) do - if (childOptionTable[i].get(info, k)) then + if childOptionTable[i].get(info, k) then tinsert(selectedValues, tostring(v)) end end - tinsert(values, "|cFFE0E000"..child.id..": |r"..table.concat(selectedValues, ",")); + tinsert(values, "|cFFE0E000" .. child.id .. ": |r" .. table.concat(selectedValues, ",")) else - local display = childOptionTable[i].get(info) or L["None"]; - if(type(display) == "number") then - display = math.floor(display * 100) / 100; + local display = childOptionTable[i].get(info) or L["None"] + if type(display) == "number" then + display = math.floor(display * 100) / 100 else if #display > 50 then display = display:sub(1, 50) .. "..." end end - tinsert(values, "|cFFE0E000"..child.id..": |r"..display); + tinsert(values, "|cFFE0E000" .. child.id .. ": |r" .. display) end - break; + break end end end end - return table.concat(values, "\n"); + return table.concat(values, "\n") end end - elseif(type(v) == "table" and i ~= "values") then - recurse(v); + elseif type(v) == "table" and i ~= "values" then + recurse(v) end end end - recurse(intable); + recurse(intable) end local function replaceImageFuncs(intable, data, subOption) local function imageAll(info) - local combinedImage = {}; - local first = true; + local combinedImage = {} + local first = true for child in OptionsPrivate.Private.TraverseLeafs(data) do local childOption = OptionsPrivate.EnsureOptions(child, subOption) - if not(childOption) then + if not childOption then return "error" end - childOption = getChildOption(childOption, info); + childOption = getChildOption(childOption, info) if childOption and childOption.image then - local image = {childOption.image(info)}; - if(first) then - combinedImage = image; - first = false; + local image = { childOption.image(info) } + if first then + combinedImage = image + first = false else - if not(combinedImage[1] == image[1]) then - return "", 0, 0; + if not (combinedImage[1] == image[1]) then + return "", 0, 0 end end end end - return unpack(combinedImage); + return unpack(combinedImage) end local function recurse(intable) - for i,v in pairs(intable) do - if(i == "image" and type(v) == "function") then - intable[i] = imageAll; - elseif(type(v) == "table" and i ~= "values") then - recurse(v); + for i, v in pairs(intable) do + if i == "image" and type(v) == "function" then + intable[i] = imageAll + elseif type(v) == "table" and i ~= "values" then + recurse(v) end end end - recurse(intable); + recurse(intable) end local concatenableTypes = { string = true, - number = true + number = true, } local function isConcatenableValue(value) return value and concatenableTypes[type(value)] end local function replaceValuesFuncs(intable, data, subOption) local function valuesAll(info) - local combinedValues = {}; - local handledValues = {}; - local first = true; + local combinedValues = {} + local handledValues = {} + local first = true for child in OptionsPrivate.Private.TraverseLeafs(data) do local childOption = OptionsPrivate.EnsureOptions(child, subOption) - if not(childOption) then + if not childOption then return "error" end - childOption = getChildOption(childOption, info); - if (childOption) then - local values = childOption.values; - if (type(values) == "function") then - values = values(info); + childOption = getChildOption(childOption, info) + if childOption then + local values = childOption.values + if type(values) == "function" then + values = values(info) end - if(first) then + if first then for k, v in pairs(values) do - handledValues[k] = handledValues[k] or {}; - handledValues[k][v] = true; - combinedValues[k] = v; + handledValues[k] = handledValues[k] or {} + handledValues[k][v] = true + combinedValues[k] = v end - first = false; + first = false else for k, v in pairs(values) do - if (handledValues[k] and handledValues[k][v]) then + if handledValues[k] and handledValues[k][v] then -- Already known key/value pair else - if (combinedValues[k]) then + if combinedValues[k] then if isConcatenableValue(k) and isConcatenableValue(v) then - combinedValues[k] = combinedValues[k] .. "/" .. v; + combinedValues[k] = combinedValues[k] .. "/" .. v end else - combinedValues[k] = v; + combinedValues[k] = v end - handledValues[k] = handledValues[k] or {}; - handledValues[k][v] = true; + handledValues[k] = handledValues[k] or {} + handledValues[k][v] = true end end end end end - return combinedValues; + return combinedValues end local function recurse(intable) - for i,v in pairs(intable) do - if(i == "values" and type(v) == "function") then - intable[i] = valuesAll; - elseif(type(v) == "table" and i ~= "values") then - recurse(v); + for i, v in pairs(intable) do + if i == "values" and type(v) == "function" then + intable[i] = valuesAll + elseif type(v) == "table" and i ~= "values" then + recurse(v) end end end - recurse(intable); + recurse(intable) end local getHelper = { @@ -854,27 +861,27 @@ local getHelper = { if self.same == false then return false end - if(self.first) then - self.combinedValues = values; - self.first = false; + if self.first then + self.combinedValues = values + self.first = false return true else - if(#self.combinedValues == #values) then - for j=1,#self.combinedValues do - if(type(self.combinedValues[j]) == "number" and type(values[j]) == "number") then - if((math.floor(self.combinedValues[j] * 100) / 100) ~= (math.floor(values[j] * 100) / 100)) then - self.same = false; - break; + if #self.combinedValues == #values then + for j = 1, #self.combinedValues do + if type(self.combinedValues[j]) == "number" and type(values[j]) == "number" then + if (math.floor(self.combinedValues[j] * 100) / 100) ~= (math.floor(values[j] * 100) / 100) then + self.same = false + break end else - if(self.combinedValues[j] ~= values[j]) then - self.same = false; - break; + if self.combinedValues[j] ~= values[j] then + self.same = false + break end end end else - self.same = false; + self.same = false end return self.same end @@ -887,10 +894,9 @@ local getHelper = { end, HasValue = function(self) return not self.first - end + end, } - local function CreateGetAll(subOption) return function(data, info, ...) local isToggle = nil @@ -904,29 +910,29 @@ local function CreateGetAll(subOption) end local childOptions = OptionsPrivate.EnsureOptions(child, subOption) - local childOption = childOptions; - local childOptionTable = {[0] = childOption}; - for i=1,#info do - childOption = childOption.args[info[i]]; - childOptionTable[i] = childOption; + local childOption = childOptions + local childOptionTable = { [0] = childOption } + for i = 1, #info do + childOption = childOption.args[info[i]] + childOptionTable[i] = childOption end - if (childOption) then - for i=#childOptionTable,0,-1 do - if(childOptionTable[i].get) then - local values = {childOptionTable[i].get(info, ...)}; + if childOption then + for i = #childOptionTable, 0, -1 do + if childOptionTable[i].get then + local values = { childOptionTable[i].get(info, ...) } if isToggle and values[1] == nil then values[1] = false end allChildren:Set(values) if not disabledOrHiddenChild(childOptionTable, info) then - enabledChildren:Set(values) + enabledChildren:Set(values) end if not allChildren:GetSame() and not enabledChildren:GetSame() then - return nil; + return nil end - break; + break end end end @@ -943,23 +949,23 @@ end local function CreateSetAll(subOption, getAll) return function(data, info, ...) - OptionsPrivate.Private.pauseOptionsProcessing(true); + OptionsPrivate.Private.pauseOptionsProcessing(true) OptionsPrivate.Private.PauseAllDynamicGroups() local before = getAll(data, info, ...) for child in OptionsPrivate.Private.TraverseLeafs(data) do local childOptions = OptionsPrivate.EnsureOptions(child, subOption) - local childOption = childOptions; - local childOptionTable = {[0] = childOption}; - for i=1,#info do - childOption = childOption.args[info[i]]; - childOptionTable[i] = childOption; + local childOption = childOptions + local childOptionTable = { [0] = childOption } + for i = 1, #info do + childOption = childOption.args[info[i]] + childOptionTable[i] = childOption end - if (childOption and not disabledOrHiddenChild(childOptionTable, info)) then - for i=#childOptionTable,0,-1 do + if childOption and not disabledOrHiddenChild(childOptionTable, info) then + for i = #childOptionTable, 0, -1 do local optionTable = childOptionTable[i] - if(optionTable.set) then - if (optionTable.type == "multiselect") then + if optionTable.set then + if optionTable.type == "multiselect" then local newValue if optionTable.multiTristate then if before == true then @@ -974,18 +980,18 @@ local function CreateSetAll(subOption, getAll) end optionTable.set(info, ..., newValue) else - optionTable.set(info, ...); + optionTable.set(info, ...) end - break; + break end end end end OptionsPrivate.Private.ResumeAllDynamicGroups() - OptionsPrivate.Private.pauseOptionsProcessing(false); - OptionsPrivate.Private.ScanForLoads(); - OptionsPrivate.SortDisplayButtons(nil, true); + OptionsPrivate.Private.pauseOptionsProcessing(false) + OptionsPrivate.Private.ScanForLoads() + OptionsPrivate.SortDisplayButtons(nil, true) OptionsPrivate.UpdateOptions() end end @@ -995,14 +1001,14 @@ local function CreateExecuteAll(subOption) local secondCall = nil for child in OptionsPrivate.Private.TraverseLeafs(data) do local childOptions = OptionsPrivate.EnsureOptions(child, subOption) - local childOption = childOptions; - local childOptionTable = {[0] = childOption}; - for i=1,#info do - childOption = childOption.args[info[i]]; - childOptionTable[i] = childOption; + local childOption = childOptions + local childOptionTable = { [0] = childOption } + for i = 1, #info do + childOption = childOption.args[info[i]] + childOptionTable[i] = childOption end - if (childOption and not disabledOrHiddenChild(childOptionTable, info)) then + if childOption and not disabledOrHiddenChild(childOptionTable, info) then -- Some functions, that is the expand/collapse functions need to be -- effectively called only once. Passing in the secondCall parameter allows -- them to distinguish between the first and every other call @@ -1027,7 +1033,7 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint, g return data.regionType == "dynamicgroup" and data.useAnchorPerUnit end - local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ceil(GetScreenHeight() / 20) * 20; + local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ceil(GetScreenHeight() / 20) * 20 local positionOptions = { __title = L["Position Settings"], __order = metaOrder, @@ -1070,10 +1076,10 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint, g desc = L["Sets the anchored frame as the aura's parent, causing the aura to inherit attributes such as visibility and scale."], order = 71, get = function() - return data.anchorFrameParent or data.anchorFrameParent == nil; + return data.anchorFrameParent or data.anchorFrameParent == nil end, hidden = function() - return not IsGroupByFrame() and (data.anchorFrameType == "SCREEN" or data.anchorFrameType == "MOUSE" or IsParentDynamicGroup()); + return not IsGroupByFrame() and (data.anchorFrameType == "SCREEN" or data.anchorFrameType == "MOUSE" or IsParentDynamicGroup()) end, }, anchorFrameSpaceOne = { @@ -1081,7 +1087,9 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint, g width = WeakAuras.normalWidth, name = "", order = 72, - image = function() return "", 0, 0 end, + image = function() + return "", 0, 0 + end, hidden = function() return IsParentDynamicGroup() or not (data.anchorFrameType == "SCREEN" or data.anchorFrameType == "MOUSE") end, @@ -1093,11 +1101,11 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint, g name = L["Frame"], order = 73, hidden = function() - if (IsParentDynamicGroup()) then - return true; + if IsParentDynamicGroup() then + return true end return not (data.anchorFrameType == "SELECTFRAME") - end + end, }, -- Button to select frame to anchor on chooseAnchorFrameFrame = { @@ -1106,14 +1114,14 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint, g name = L["Choose"], order = 74, hidden = function() - if (IsParentDynamicGroup()) then - return true; + if IsParentDynamicGroup() then + return true end return not (data.anchorFrameType == "SELECTFRAME") end, func = function() - OptionsPrivate.StartFrameChooser(data, {"anchorFrameFrame"}); - end + OptionsPrivate.StartFrameChooser(data, { "anchorFrameFrame" }) + end, }, selfPoint = { type = "select", @@ -1129,26 +1137,26 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint, g type = "select", width = WeakAuras.normalWidth, name = function() - if (data.anchorFrameType == "SCREEN") then + if data.anchorFrameType == "SCREEN" then return L["To Screen's"] - elseif (data.anchorFrameType == "PRD") then - return L["To Personal Ressource Display's"]; + elseif data.anchorFrameType == "PRD" then + return L["To Personal Ressource Display's"] else - return L["To Frame's"]; + return L["To Frame's"] end end, order = 76, hidden = function() - if (data.parent) then + if data.parent then if IsGroupByFrame() then return false end if IsParentDynamicGroup() then return true end - return data.anchorFrameType == "SCREEN" or data.anchorFrameType == "MOUSE"; + return data.anchorFrameType == "SCREEN" or data.anchorFrameType == "MOUSE" else - return data.anchorFrameType == "MOUSE"; + return data.anchorFrameType == "MOUSE" end end, values = OptionsPrivate.Private.point_types, @@ -1163,17 +1171,19 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint, g if IsGroupByFrame() then return true end - if (data.anchorFrameType ~= "SCREEN") then - return true; + if data.anchorFrameType ~= "SCREEN" then + return true end - if (data.parent) then - return IsParentDynamicGroup(); + if data.parent then + return IsParentDynamicGroup() end - return true; + return true end, disabled = true, - values = {["CENTER"] = L["Anchor Point"]}, - get = function() return "CENTER"; end, + values = { ["CENTER"] = L["Anchor Point"] }, + get = function() + return "CENTER" + end, control = "WeakAurasAnchorButtons", }, anchorFramePoints = { @@ -1181,10 +1191,12 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint, g width = WeakAuras.normalWidth, name = "", order = 78, - image = function() return "", 0, 0 end, + image = function() + return "", 0, 0 + end, hidden = function() - return not (data.anchorFrameType == "MOUSE") or IsParentDynamicGroup(); - end + return not (data.anchorFrameType == "MOUSE") or IsParentDynamicGroup() + end, }, xOffset = { type = "range", @@ -1196,14 +1208,16 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint, g softMax = screenWidth, max = 4 * screenWidth, bigStep = 10, - get = function() return data.xOffset end, + get = function() + return data.xOffset + end, set = function(info, v) - data.xOffset = v; - WeakAuras.Add(data); - WeakAuras.UpdateThumbnail(data); - OptionsPrivate.ResetMoverSizer(); + data.xOffset = v + WeakAuras.Add(data) + WeakAuras.UpdateThumbnail(data) + OptionsPrivate.ResetMoverSizer() OptionsPrivate.Private.AddParents(data) - end + end, }, yOffset = { type = "range", @@ -1215,37 +1229,53 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint, g softMax = screenHeight, max = 4 * screenHeight, bigStep = 10, - get = function() return data.yOffset end, + get = function() + return data.yOffset + end, set = function(info, v) - data.yOffset = v; - WeakAuras.Add(data); - WeakAuras.UpdateThumbnail(data); - OptionsPrivate.ResetMoverSizer(); + data.yOffset = v + WeakAuras.Add(data) + WeakAuras.UpdateThumbnail(data) + OptionsPrivate.ResetMoverSizer() OptionsPrivate.Private.AddParents(data) - end + end, }, frameStrata = { type = "select", width = WeakAuras.normalWidth, name = L["Frame Strata"], order = 81, - values = OptionsPrivate.Private.frame_strata_types + values = OptionsPrivate.Private.frame_strata_types, }, anchorFrameSpace = { type = "execute", width = WeakAuras.normalWidth, name = "", order = 82, - image = function() return "", 0, 0 end, + image = function() + return "", 0, 0 + end, hidden = function() - return not (data.anchorFrameType ~= "SCREEN" or IsParentDynamicGroup()); - end + return not (data.anchorFrameType ~= "SCREEN" or IsParentDynamicGroup()) + end, }, - }; + } - OptionsPrivate.commonOptions.AddCodeOption(positionOptions, data, L["Custom Anchor"], "custom_anchor", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-anchor-function", - 71.5, function() return not(data.anchorFrameType == "CUSTOM" and not IsParentDynamicGroup()) end, {"customAnchor"}, false, { setOnParent = group }) - return positionOptions; + OptionsPrivate.commonOptions.AddCodeOption( + positionOptions, + data, + L["Custom Anchor"], + "custom_anchor", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-anchor-function", + 71.5, + function() + return not (data.anchorFrameType == "CUSTOM" and not IsParentDynamicGroup()) + end, + { "customAnchor" }, + false, + { setOnParent = group } + ) + return positionOptions end local function BorderOptions(id, data, showBackDropOptions, hiddenFunc, order) @@ -1270,7 +1300,9 @@ local function BorderOptions(id, data, showBackDropOptions, hiddenFunc, order) name = L["Border Style"], order = order + 0.2, values = AceGUIWidgetLSMlists.border, - hidden = function() return hiddenFunc and hiddenFunc() or not data.border end, + hidden = function() + return hiddenFunc and hiddenFunc() or not data.border + end, }, borderBackdrop = { type = "select", @@ -1279,7 +1311,9 @@ local function BorderOptions(id, data, showBackDropOptions, hiddenFunc, order) name = L["Backdrop Style"], order = order + 0.3, values = AceGUIWidgetLSMlists.background, - hidden = function() return hiddenFunc and hiddenFunc() or not data.border end, + hidden = function() + return hiddenFunc and hiddenFunc() or not data.border + end, }, borderOffset = { type = "range", @@ -1289,7 +1323,9 @@ local function BorderOptions(id, data, showBackDropOptions, hiddenFunc, order) softMin = 0, softMax = 32, bigStep = 1, - hidden = function() return hiddenFunc and hiddenFunc() or not data.border end, + hidden = function() + return hiddenFunc and hiddenFunc() or not data.border + end, }, borderSize = { type = "range", @@ -1299,7 +1335,9 @@ local function BorderOptions(id, data, showBackDropOptions, hiddenFunc, order) min = 1, softMax = 64, bigStep = 1, - hidden = function() return hiddenFunc and hiddenFunc() or not data.border end, + hidden = function() + return hiddenFunc and hiddenFunc() or not data.border + end, }, borderInset = { type = "range", @@ -1309,14 +1347,18 @@ local function BorderOptions(id, data, showBackDropOptions, hiddenFunc, order) softMin = 1, softMax = 32, bigStep = 1, - hidden = function() return hiddenFunc and hiddenFunc() or not data.border end, + hidden = function() + return hiddenFunc and hiddenFunc() or not data.border + end, }, border_spacer = { type = "description", name = "", width = WeakAuras.normalWidth, - hidden = function() return hiddenFunc and hiddenFunc() or not data.border end, - order = order + 0.6 + hidden = function() + return hiddenFunc and hiddenFunc() or not data.border + end, + order = order + 0.6, }, borderColor = { type = "color", @@ -1324,14 +1366,18 @@ local function BorderOptions(id, data, showBackDropOptions, hiddenFunc, order) name = L["Border Color"], hasAlpha = true, order = order + 0.7, - hidden = function() return hiddenFunc and hiddenFunc() or not data.border end, + hidden = function() + return hiddenFunc and hiddenFunc() or not data.border + end, }, - borderInFront = { + borderInFront = { type = "toggle", width = WeakAuras.normalWidth, name = L["Border in Front"], order = order + 0.8, - hidden = function() return hiddenFunc and hiddenFunc() or not data.border or not showBackDropOptions end, + hidden = function() + return hiddenFunc and hiddenFunc() or not data.border or not showBackDropOptions + end, }, backdropColor = { type = "color", @@ -1339,42 +1385,54 @@ local function BorderOptions(id, data, showBackDropOptions, hiddenFunc, order) name = L["Backdrop Color"], hasAlpha = true, order = order + 0.9, - hidden = function() return hiddenFunc and hiddenFunc() or not data.border end, + hidden = function() + return hiddenFunc and hiddenFunc() or not data.border + end, }, - backdropInFront = { + backdropInFront = { type = "toggle", width = WeakAuras.normalWidth, name = L["Backdrop in Front"], order = order + 1, - hidden = function() return hiddenFunc and hiddenFunc() or not data.border or not showBackDropOptions end, + hidden = function() + return hiddenFunc and hiddenFunc() or not data.border or not showBackDropOptions + end, }, } - return borderOptions; + return borderOptions end -local function noop() -end +local function noop() end local function GetCustomCode(data, path) for _, key in ipairs(path) do - if (not data or not data[key]) then - return nil; + if not data or not data[key] then + return nil end - data = data[key]; + data = data[key] end - return data; + return data end local function AddCodeOption(args, data, name, prefix, url, order, hiddenFunc, path, encloseInFunction, options) options = options and CopyTable(options) or {} - options.extraFunctions = options.extraFunctions or {}; + options.extraFunctions = options.extraFunctions or {} tinsert(options.extraFunctions, 1, { buttonLabel = L["Expand"], func = function() - OptionsPrivate.OpenTextEditor(OptionsPrivate.GetPickedDisplay(), path, encloseInFunction, options.multipath, options.reloadOptions, options.setOnParent, url, options.validator) - end - }); + OptionsPrivate.OpenTextEditor( + OptionsPrivate.GetPickedDisplay(), + path, + encloseInFunction, + options.multipath, + options.reloadOptions, + options.setOnParent, + url, + options.validator + ) + end, + }) args[prefix .. "_custom"] = { type = "input", @@ -1388,79 +1446,81 @@ local function AddCodeOption(args, data, name, prefix, url, order, hiddenFunc, p extraFunctions = options.extraFunctions, }, set = function(info, v) - local subdata = data; - for i = 1, #path -1 do - local key = path[i]; - subdata[key] = subdata[key] or {}; - subdata = subdata[key]; + local subdata = data + for i = 1, #path - 1 do + local key = path[i] + subdata[key] = subdata[key] or {} + subdata = subdata[key] end - subdata[path[#path]] = v; - WeakAuras.Add(data); - if (options.extraSetFunction) then - options.extraSetFunction(); + subdata[path[#path]] = v + WeakAuras.Add(data) + if options.extraSetFunction then + options.extraSetFunction() end - if (options.reloadOptions) then + if options.reloadOptions then OptionsPrivate.ClearOptions(data.id) end end, get = function(info) - return GetCustomCode(data, path); - end - }; + return GetCustomCode(data, path) + end, + } args[prefix .. "_customError"] = { type = "description", name = function() if hiddenFunc() then - return ""; + return "" end - local code = GetCustomCode(data, path); + local code = GetCustomCode(data, path) - if (not code or code:trim() == "") then + if not code or code:trim() == "" then return "" end - if (encloseInFunction) then - code = "function() "..code.."\n end"; + if encloseInFunction then + code = "function() " .. code .. "\n end" end - code = "return " .. code; + code = "return " .. code - local loadedFunction, errorString = loadstring(code); + local loadedFunction, errorString = loadstring(code) if not errorString then if options.validator then - local ok, validate = xpcall(loadedFunction, function(err) errorString = err end) + local ok, validate = xpcall(loadedFunction, function(err) + errorString = err + end) if ok then errorString = options.validator(validate) end end end - return errorString and "|cFFFF0000"..errorString or ""; + return errorString and "|cFFFF0000" .. errorString or "" end, width = WeakAuras.doubleWidth, order = order + 0.002, hidden = function() - if (hiddenFunc()) then - return true; + if hiddenFunc() then + return true end - local code = GetCustomCode(data, path); - if (not code or code:trim() == "") then - return true; + local code = GetCustomCode(data, path) + if not code or code:trim() == "" then + return true end - if (encloseInFunction) then - code = "function() "..code.."\n end"; + if encloseInFunction then + code = "function() " .. code .. "\n end" end - code = "return " .. code; + code = "return " .. code - local loadedFunction, errorString = loadstring(code); - if(errorString and not loadedFunction) then - return false; + local loadedFunction, errorString = loadstring(code) + if errorString and not loadedFunction then + return false else if options.validator then local ok, validate = xpcall(loadedFunction, noop) @@ -1469,18 +1529,18 @@ local function AddCodeOption(args, data, name, prefix, url, order, hiddenFunc, p end return false end - return true; + return true end - end - }; + end, + } end local function AddCommonTriggerOptions(options, data, triggernum, doubleWidth) local trigger = data.triggers[triggernum].trigger - local trigger_types = {}; + local trigger_types = {} for type, triggerSystem in pairs(OptionsPrivate.Private.triggerTypes) do - trigger_types[type] = triggerSystem.GetName(type); + trigger_types[type] = triggerSystem.GetName(type) end options.type = { @@ -1494,18 +1554,18 @@ local function AddCommonTriggerOptions(options, data, triggernum, doubleWidth) return trigger.type end, set = function(info, v) - trigger.type = v; - local prototype = trigger.event and OptionsPrivate.Private.event_prototypes[trigger.event]; + trigger.type = v + local prototype = trigger.event and OptionsPrivate.Private.event_prototypes[trigger.event] if OptionsPrivate.Private.event_categories[v] and OptionsPrivate.Private.event_categories[v].default then if not prototype or prototype.type ~= v then trigger.event = OptionsPrivate.Private.event_categories[v].default end end - WeakAuras.Add(data); - WeakAuras.UpdateThumbnail(data); - WeakAuras.ClearAndUpdateOptions(data.id); + WeakAuras.Add(data) + WeakAuras.UpdateThumbnail(data) + WeakAuras.ClearAndUpdateOptions(data.id) end, - control = "WeakAurasSortedDropdown" + control = "WeakAurasSortedDropdown", } end @@ -1562,7 +1622,6 @@ local function AddTriggerGetterSetter(options, data, triggernum) end end - OptionsPrivate.commonOptions = {} OptionsPrivate.commonOptions.parsePrefix = parsePrefix OptionsPrivate.commonOptions.flattenRegionOptions = flattenRegionOptions diff --git a/WeakAurasOptions/ConditionOptions.lua b/WeakAurasOptions/ConditionOptions.lua index 02909241da..ca74559e83 100644 --- a/WeakAurasOptions/ConditionOptions.lua +++ b/WeakAurasOptions/ConditionOptions.lua @@ -1,4 +1,3 @@ - -- A bit of terminology -- Templates: -- The potential conditions that are offered by the triggers @@ -44,164 +43,164 @@ -- - setter: The setter function, called both on activating and deactivating a property change --- - action: The action function, called on activating a condition -- - type: The type -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... -local WeakAuras = WeakAuras; -local L = WeakAuras.L; +local WeakAuras = WeakAuras +local L = WeakAuras.L local function addSpace(args, order) args["space" .. order] = { type = "description", name = "", - image = function() return "", 0, 0 end, + image = function() + return "", 0, 0 + end, order = order, - width = WeakAuras.normalWidth + width = WeakAuras.normalWidth, } - order = order + 1; - return order; + order = order + 1 + return order end local function compareValues(a, b, propertytype) - if (propertytype == "color") then - if (type(a) ~= "table" or type(b) ~= "table") then - return a == b; + if propertytype == "color" then + if type(a) ~= "table" or type(b) ~= "table" then + return a == b end - return a[1] == b[1] - and a[2] == b[2] - and a[3] == b[3] - and a[4] == b[4]; + return a[1] == b[1] and a[2] == b[2] and a[3] == b[3] and a[4] == b[4] end - return a == b; + return a == b end local function valueToString(a, propertytype) - if (propertytype == "color") then - if (type(a) == "table") then + if propertytype == "color" then + if type(a) == "table" then local r, g, b, alpha = floor((a[1] or 0) * 255), floor((a[2] or 0) * 255), floor((a[3] or 0) * 255), floor((a[4] or 0) * 255) - return string.format("|c%02X%02X%02X%02X", alpha, r, g, b) .. L["color"]; + return string.format("|c%02X%02X%02X%02X", alpha, r, g, b) .. L["color"] else - return ""; + return "" end - elseif (propertytype == "chat" or propertytype == "sound" or propertytype == "customcode" - or propertytype == "glowexternal" or propertytype == "customcheck") then - return tostring(a); - elseif (propertytype == "alwaystrue") then + elseif propertytype == "chat" or propertytype == "sound" or propertytype == "customcode" or propertytype == "glowexternal" or propertytype == "customcheck" then + return tostring(a) + elseif propertytype == "alwaystrue" then return "" - elseif (propertytype == "bool") then - return (a == 1 or a == true) and L["True"] or L["False"]; + elseif propertytype == "bool" then + return (a == 1 or a == true) and L["True"] or L["False"] end - return tostring(a); + return tostring(a) end local function isSubset(data, reference, totalAuraCount) - if (data.controlledChildren) then - if (totalAuraCount > reference.referenceCount) then - return true; + if data.controlledChildren then + if totalAuraCount > reference.referenceCount then + return true end end - return false; + return false end local function blueIfSubset(data, reference, totalAuraCount) - if (isSubset(data, reference, totalAuraCount)) then - return "|cFF4080FF"; + if isSubset(data, reference, totalAuraCount) then + return "|cFF4080FF" end - return ""; + return "" end local function blueIfNoValue(data, object, variable, blueString, normalString) - if (data.controlledChildren) then - if (object["same" .. variable] == false) then - return "|cFF4080FF" .. blueString; + if data.controlledChildren then + if object["same" .. variable] == false then + return "|cFF4080FF" .. blueString end end - return normalString or ""; + return normalString or "" end local function blueIfNoValue2(data, object, variable, subvariable, blueString, normalString) - if (data.controlledChildren) then - if (not object["same" .. variable] or not object["same" .. variable][subvariable]) then - return "|cFF4080FF" .. blueString; + if data.controlledChildren then + if not object["same" .. variable] or not object["same" .. variable][subvariable] then + return "|cFF4080FF" .. blueString end end - return normalString or ""; + return normalString or "" end local function descIfSubset(data, reference, totalAuraCount) - if (isSubset(data, reference, totalAuraCount)) then - local desc = L["Used in auras:"]; + if isSubset(data, reference, totalAuraCount) then + local desc = L["Used in auras:"] for id in pairs(reference.references) do - desc = desc .. "\n" .. id; + desc = desc .. "\n" .. id end - return desc; + return desc end - return ""; + return "" end local function descIfNoValue(data, object, variable, type, values) - if (data.controlledChildren) then - if (object["same" .. variable] == false) then - local desc = ""; + if data.controlledChildren then + if object["same" .. variable] == false then + local desc = "" for id, reference in pairs(object.references) do - if (type == "list" and values) then - desc = desc .."|cFFE0E000".. id .. ": |r" .. (values[reference[variable]] or "") .. "\n"; + if type == "list" and values then + desc = desc .. "|cFFE0E000" .. id .. ": |r" .. (values[reference[variable]] or "") .. "\n" else - desc = desc .."|cFFE0E000".. id .. ": |r" .. (valueToString(reference[variable], type) or "") .. "\n"; + desc = desc .. "|cFFE0E000" .. id .. ": |r" .. (valueToString(reference[variable], type) or "") .. "\n" end end - return desc; + return desc end end - return nil; + return nil end local function descIfNoValue2(data, object, variable, subvariable, type, values) - if (data.controlledChildren) then - if (object["same" .. variable] and object["same" .. variable][subvariable] == false) then - local desc = ""; + if data.controlledChildren then + if object["same" .. variable] and object["same" .. variable][subvariable] == false then + local desc = "" for id, reference in pairs(object.references) do - if (values) then - desc = desc .."|cFFE0E000".. id .. ": |r" .. (values[reference[variable][subvariable]] or "") .. "\n"; + if values then + desc = desc .. "|cFFE0E000" .. id .. ": |r" .. (values[reference[variable][subvariable]] or "") .. "\n" else - desc = desc .."|cFFE0E000".. id .. ": |r" .. valueToString(reference[variable][subvariable], type or "") .. "\n"; + desc = desc .. "|cFFE0E000" .. id .. ": |r" .. valueToString(reference[variable][subvariable], type or "") .. "\n" end end - return desc; + return desc end end - return nil; + return nil end local function filterUsedProperties(indexToProperty, allDisplays, usedProperties, ownProperty) - local filtered = {}; + local filtered = {} for index, value in pairs(allDisplays) do - local property = indexToProperty[index]; - local isUsed = property and usedProperties[property]; - local isOwn = ownProperty and property == ownProperty; - if ( not isUsed or isOwn) then - filtered[index] = value; + local property = indexToProperty[index] + local isUsed = property and usedProperties[property] + local isOwn = ownProperty and property == ownProperty + if not isUsed or isOwn then + filtered[index] = value end end - return filtered; + return filtered end local function wrapWithPlaySound(func, kit) return function(info, v) - func(info, v); - if (tonumber(v)) then - pcall(PlaySound, tonumber(v), "Master"); + func(info, v) + if tonumber(v) then + pcall(PlaySound, tonumber(v), "Master") else - pcall(PlaySoundFile, v, "Master"); + pcall(PlaySoundFile, v, "Master") end end end local function addControlsForChange(args, order, data, conditionVariable, totalAuraCount, conditions, i, j, allProperties, usedProperties) - local thenText = (j == 1) and L["Then "] or L["And "]; - local display = isSubset(data, conditions[i].changes[j], totalAuraCount) and allProperties.displayWithCopy or allProperties.display; - local valuesForProperty = filterUsedProperties(allProperties.indexToProperty, display, usedProperties, conditions[i].changes[j].property); + local thenText = (j == 1) and L["Then "] or L["And "] + local display = isSubset(data, conditions[i].changes[j], totalAuraCount) and allProperties.displayWithCopy or allProperties.display + local valuesForProperty = filterUsedProperties(allProperties.indexToProperty, display, usedProperties, conditions[i].changes[j].property) args["condition" .. i .. "property" .. j] = { type = "select", width = WeakAuras.normalWidth, @@ -211,135 +210,135 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA values = valuesForProperty, control = "WeakAurasTwoColumnDropdown", get = function() - local property = conditions[i].changes[j].property; - return property and allProperties.propertyToIndex[property]; + local property = conditions[i].changes[j].property + return property and allProperties.propertyToIndex[property] end, set = function(info, index) - local property = allProperties.indexToProperty[index]; - if (property == "COPY") then + local property = allProperties.indexToProperty[index] + if property == "COPY" then for child in OptionsPrivate.Private.TraverseLeafs(data) do - if (conditions[i].changes[j].references[child.id]) then + if conditions[i].changes[j].references[child.id] then -- Already exist else - local insertPoint = 1; + local insertPoint = 1 for index = j, 1, -1 do - if (conditions[i].changes[index].references[child.id]) then - insertPoint = index + 1; - break; + if conditions[i].changes[index].references[child.id] then + insertPoint = index + 1 + break end end - local change = {}; - change.property = conditions[i].changes[j].property; - if (type(conditions[i].changes[j].value) == "table") then + local change = {} + change.property = conditions[i].changes[j].property + if type(conditions[i].changes[j].value) == "table" then change.value = CopyTable(conditions[i].changes[j].value) else - change.value = conditions[i].changes[j].value; + change.value = conditions[i].changes[j].value end local reference = conditions[i].check.references[child.id] if reference then - local conditionIndex = reference.conditionIndex; - tinsert(child[conditionVariable][conditionIndex].changes, insertPoint, change); - WeakAuras.Add(child); + local conditionIndex = reference.conditionIndex + tinsert(child[conditionVariable][conditionIndex].changes, insertPoint, change) + WeakAuras.Add(child) OptionsPrivate.ClearOptions(child.id) end end end WeakAuras.ClearAndUpdateOptions(data.id) - return; - elseif (property == "DELETE") then - if (data.controlledChildren) then + return + elseif property == "DELETE" then + if data.controlledChildren then for id, reference in pairs(conditions[i].changes[j].references) do - local auraData = WeakAuras.GetData(id); - local conditionIndex = conditions[i].check.references[id].conditionIndex; - tremove(auraData[conditionVariable][conditionIndex].changes, reference.changeIndex); - WeakAuras.Add(auraData); + local auraData = WeakAuras.GetData(id) + local conditionIndex = conditions[i].check.references[id].conditionIndex + tremove(auraData[conditionVariable][conditionIndex].changes, reference.changeIndex) + WeakAuras.Add(auraData) OptionsPrivate.ClearOptions(auraData.id) end WeakAuras.ClearAndUpdateOptions(data.id) else - tremove(conditions[i].changes, j); - WeakAuras.Add(data); + tremove(conditions[i].changes, j) + WeakAuras.Add(data) WeakAuras.ClearAndUpdateOptions(data.id) end - return; + return end - local default = allProperties.propertyMap[property].default; - if (data.controlledChildren) then + local default = allProperties.propertyMap[property].default + if data.controlledChildren then for id, reference in pairs(conditions[i].changes[j].references) do - local auraData = WeakAuras.GetData(id); - local conditionIndex = conditions[i].check.references[id].conditionIndex; - auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].property = property; - auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value = default; - WeakAuras.Add(auraData); + local auraData = WeakAuras.GetData(id) + local conditionIndex = conditions[i].check.references[id].conditionIndex + auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].property = property + auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value = default + WeakAuras.Add(auraData) OptionsPrivate.ClearOptions(auraData.id) end - conditions[i].changes[j].property = property; + conditions[i].changes[j].property = property WeakAuras.ClearAndUpdateOptions(data.id) else - conditions[i].changes[j].property = property; - conditions[i].changes[j].value = default; - WeakAuras.Add(data); + conditions[i].changes[j].property = property + conditions[i].changes[j].value = default + WeakAuras.Add(data) WeakAuras.ClearAndUpdateOptions(data.id) end - end + end, } - order = order + 1; + order = order + 1 - local setValue; - local setValueColor; - local setValueComplex; - local setValueColorComplex; - if (data.controlledChildren) then + local setValue + local setValueColor + local setValueComplex + local setValueColorComplex + if data.controlledChildren then setValue = function(info, v) for id, reference in pairs(conditions[i].changes[j].references) do - local auraData = WeakAuras.GetData(id); - local conditionIndex = conditions[i].check.references[id].conditionIndex; - auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value = v; - WeakAuras.Add(auraData); + local auraData = WeakAuras.GetData(id) + local conditionIndex = conditions[i].check.references[id].conditionIndex + auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value = v + WeakAuras.Add(auraData) OptionsPrivate.ClearOptions(auraData.id) end - conditions[i].changes[j].value = v; + conditions[i].changes[j].value = v WeakAuras.ClearAndUpdateOptions(data.id) end setValueColor = function(info, r, g, b, a) for id, reference in pairs(conditions[i].changes[j].references) do - local auraData = WeakAuras.GetData(id); - local conditionIndex = conditions[i].check.references[id].conditionIndex; - auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value = auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value or {}; - auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value[1] = r; - auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value[2] = g; - auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value[3] = b; - auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value[4] = a; - WeakAuras.Add(auraData); + local auraData = WeakAuras.GetData(id) + local conditionIndex = conditions[i].check.references[id].conditionIndex + auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value = auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value or {} + auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value[1] = r + auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value[2] = g + auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value[3] = b + auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value[4] = a + WeakAuras.Add(auraData) OptionsPrivate.ClearOptions(auraData.id) end - conditions[i].changes[j].value = conditions[i].changes[j].value or {}; - conditions[i].changes[j].value[1] = r; - conditions[i].changes[j].value[2] = g; - conditions[i].changes[j].value[3] = b; - conditions[i].changes[j].value[4] = a; + conditions[i].changes[j].value = conditions[i].changes[j].value or {} + conditions[i].changes[j].value[1] = r + conditions[i].changes[j].value[2] = g + conditions[i].changes[j].value[3] = b + conditions[i].changes[j].value[4] = a WeakAuras.ClearAndUpdateOptions(data.id) end setValueComplex = function(property) return function(info, v) for id, reference in pairs(conditions[i].changes[j].references) do - local auraData = WeakAuras.GetData(id); - local conditionIndex = conditions[i].check.references[id].conditionIndex; - if (type(auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value) ~= "table") then - auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value = {}; + local auraData = WeakAuras.GetData(id) + local conditionIndex = conditions[i].check.references[id].conditionIndex + if type(auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value) ~= "table" then + auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value = {} end - auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value[property] = v; - WeakAuras.Add(auraData); + auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value[property] = v + WeakAuras.Add(auraData) OptionsPrivate.ClearOptions(auraData.id) end - if (type(conditions[i].changes[j].value) ~= "table") then - conditions[i].changes[j].value = {}; + if type(conditions[i].changes[j].value) ~= "table" then + conditions[i].changes[j].value = {} end - conditions[i].changes[j].value[property] = v; + conditions[i].changes[j].value[property] = v WeakAuras.Add(data) WeakAuras.ClearAndUpdateOptions(data.id) @@ -349,85 +348,85 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA setValueColorComplex = function(property) return function(info, r, g, b, a) for id, reference in pairs(conditions[i].changes[j].references) do - local auraData = WeakAuras.GetData(id); - local conditionIndex = conditions[i].check.references[id].conditionIndex; - if (type(auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value) ~= "table") then - auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value = {}; + local auraData = WeakAuras.GetData(id) + local conditionIndex = conditions[i].check.references[id].conditionIndex + if type(auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value) ~= "table" then + auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value = {} end - if (type(auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value[property]) ~= "table") then - auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value[property] = {}; + if type(auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value[property]) ~= "table" then + auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value[property] = {} end - auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value[property][1] = r; - auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value[property][2] = g; - auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value[property][3] = b; - auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value[property][4] = a; - WeakAuras.Add(auraData); + auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value[property][1] = r + auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value[property][2] = g + auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value[property][3] = b + auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value[property][4] = a + WeakAuras.Add(auraData) OptionsPrivate.ClearOptions(auraData.id) end - if (type(conditions[i].changes[j].value) ~= "table") then - conditions[i].changes[j].value = {}; + if type(conditions[i].changes[j].value) ~= "table" then + conditions[i].changes[j].value = {} end - if (type(conditions[i].changes[j].value[property]) ~= "table") then - conditions[i].changes[j].value[property] = {}; + if type(conditions[i].changes[j].value[property]) ~= "table" then + conditions[i].changes[j].value[property] = {} end - conditions[i].changes[j].value[property][1] = r; - conditions[i].changes[j].value[property][2] = g; - conditions[i].changes[j].value[property][3] = b; - conditions[i].changes[j].value[property][4] = a; + conditions[i].changes[j].value[property][1] = r + conditions[i].changes[j].value[property][2] = g + conditions[i].changes[j].value[property][3] = b + conditions[i].changes[j].value[property][4] = a WeakAuras.ClearAndUpdateOptions(data.id) end end else setValue = function(info, v) - conditions[i].changes[j].value = v; - WeakAuras.Add(data); + conditions[i].changes[j].value = v + WeakAuras.Add(data) WeakAuras.ClearAndUpdateOptions(data.id) end setValueColor = function(info, r, g, b, a) - conditions[i].changes[j].value = conditions[i].changes[j].value or {}; - conditions[i].changes[j].value[1] = r; - conditions[i].changes[j].value[2] = g; - conditions[i].changes[j].value[3] = b; - conditions[i].changes[j].value[4] = a; - WeakAuras.Add(data); + conditions[i].changes[j].value = conditions[i].changes[j].value or {} + conditions[i].changes[j].value[1] = r + conditions[i].changes[j].value[2] = g + conditions[i].changes[j].value[3] = b + conditions[i].changes[j].value[4] = a + WeakAuras.Add(data) WeakAuras.ClearAndUpdateOptions(data.id) end setValueComplex = function(property) return function(info, v) - if (type (conditions[i].changes[j].value) ~= "table") then - conditions[i].changes[j].value = {}; + if type(conditions[i].changes[j].value) ~= "table" then + conditions[i].changes[j].value = {} end - conditions[i].changes[j].value[property] = v; - WeakAuras.Add(data); + conditions[i].changes[j].value[property] = v + WeakAuras.Add(data) WeakAuras.ClearAndUpdateOptions(data.id) end end setValueColorComplex = function(property) return function(info, r, g, b, a) - if (type (conditions[i].changes[j].value) ~= "table") then - conditions[i].changes[j].value = {}; + if type(conditions[i].changes[j].value) ~= "table" then + conditions[i].changes[j].value = {} end - if (type (conditions[i].changes[j].value[property]) ~= "table") then - conditions[i].changes[j].value[property] = {}; + if type(conditions[i].changes[j].value[property]) ~= "table" then + conditions[i].changes[j].value[property] = {} end - conditions[i].changes[j].value[property][1] = r; - conditions[i].changes[j].value[property][2] = g; - conditions[i].changes[j].value[property][3] = b; - conditions[i].changes[j].value[property][4] = a; - WeakAuras.Add(data); + conditions[i].changes[j].value[property][1] = r + conditions[i].changes[j].value[property][2] = g + conditions[i].changes[j].value[property][3] = b + conditions[i].changes[j].value[property][4] = a + WeakAuras.Add(data) WeakAuras.ClearAndUpdateOptions(data.id) end end end - local propertyType; - local property = conditions[i].changes[j].property; - if (property) then - propertyType = allProperties.propertyMap[property] and allProperties.propertyMap[property].type; + local propertyType + local property = conditions[i].changes[j].property + if property then + propertyType = allProperties.propertyMap[property] and allProperties.propertyMap[property].type end - if (propertyType == "bool" or propertyType == "number") then + if propertyType == "bool" or propertyType == "number" then args["condition" .. i .. "value" .. j] = { type = "toggle", width = WeakAuras.normalWidth, @@ -435,28 +434,28 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA desc = descIfNoValue(data, conditions[i].changes[j], "value", propertyType), order = order, get = function() - return conditions[i].changes[j].value; + return conditions[i].changes[j].value end, - set = setValue + set = setValue, } - order = order + 1; - if (propertyType == "number") then - local properties = allProperties.propertyMap[property]; + order = order + 1 + if propertyType == "number" then + local properties = allProperties.propertyMap[property] if (properties.min or properties.softMin) and (properties.max or properties.softMax) then - args["condition" .. i .. "value" .. j].type = "range"; - args["condition" .. i .. "value" .. j].min = properties.min; - args["condition" .. i .. "value" .. j].softMin = properties.softMin; - args["condition" .. i .. "value" .. j].max = properties.max; - args["condition" .. i .. "value" .. j].softMax = properties.softMax; - args["condition" .. i .. "value" .. j].step = properties.step; - args["condition" .. i .. "value" .. j].bigStep = properties.bigStep; - args["condition" .. i .. "value" .. j].isPercent = properties.isPercent; + args["condition" .. i .. "value" .. j].type = "range" + args["condition" .. i .. "value" .. j].min = properties.min + args["condition" .. i .. "value" .. j].softMin = properties.softMin + args["condition" .. i .. "value" .. j].max = properties.max + args["condition" .. i .. "value" .. j].softMax = properties.softMax + args["condition" .. i .. "value" .. j].step = properties.step + args["condition" .. i .. "value" .. j].bigStep = properties.bigStep + args["condition" .. i .. "value" .. j].isPercent = properties.isPercent else - args["condition" .. i .. "value" .. j].type = "input"; - args["condition" .. i .. "value" .. j].validate = WeakAuras.ValidateNumeric; + args["condition" .. i .. "value" .. j].type = "input" + args["condition" .. i .. "value" .. j].validate = WeakAuras.ValidateNumeric end end - elseif (propertyType == "icon") then + elseif propertyType == "icon" then args["condition" .. i .. "value" .. j] = { type = "input", width = WeakAuras.normalWidth - 0.15, @@ -467,7 +466,7 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA local v = conditions[i].changes[j].value return v and tostring(v) end, - set = setValue + set = setValue, } order = order + 1 args["condition" .. i .. "value_browse" .. j] = { @@ -479,11 +478,11 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA if data.controlledChildren then local paths = {} for id, reference in pairs(conditions[i].changes[j].references) do - paths[id] = {"conditions", conditions[i].check.references[id].conditionIndex, "changes", reference.changeIndex, "value"} + paths[id] = { "conditions", conditions[i].check.references[id].conditionIndex, "changes", reference.changeIndex, "value" } end OptionsPrivate.OpenIconPicker(data, paths) else - OptionsPrivate.OpenIconPicker(data, {[data.id] = { "conditions", i, "changes", j, "value" } }) + OptionsPrivate.OpenIconPicker(data, { [data.id] = { "conditions", i, "changes", j, "value" } }) end end, imageWidth = 24, @@ -491,7 +490,7 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA control = "WeakAurasIcon", image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\browse", } - elseif (propertyType == "color") then + elseif propertyType == "color" then args["condition" .. i .. "value" .. j] = { type = "color", width = WeakAuras.normalWidth, @@ -500,16 +499,16 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA order = order, hasAlpha = true, get = function() - if (conditions[i].changes[j].value and type(conditions[i].changes[j].value) == "table") then - return conditions[i].changes[j].value[1], conditions[i].changes[j].value[2], conditions[i].changes[j].value[3], conditions[i].changes[j].value[4]; + if conditions[i].changes[j].value and type(conditions[i].changes[j].value) == "table" then + return conditions[i].changes[j].value[1], conditions[i].changes[j].value[2], conditions[i].changes[j].value[3], conditions[i].changes[j].value[4] end - return 1, 1, 1, 1; + return 1, 1, 1, 1 end, - set = setValueColor + set = setValueColor, } - order = order + 1; - elseif (propertyType == "list") then - local values = property and allProperties.propertyMap[property] and allProperties.propertyMap[property].values; + order = order + 1 + elseif propertyType == "list" then + local values = property and allProperties.propertyMap[property] and allProperties.propertyMap[property].values args["condition" .. i .. "value" .. j] = { type = "select", width = WeakAuras.normalWidth, @@ -518,12 +517,12 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA desc = descIfNoValue(data, conditions[i].changes[j], "value", propertyType, values), order = order, get = function() - return conditions[i].changes[j].value; + return conditions[i].changes[j].value end, - set = setValue + set = setValue, } - order = order + 1; - elseif (propertyType == "sound") then + order = order + 1 + elseif propertyType == "sound" then args["condition" .. i .. "value" .. j .. "sound_type"] = { type = "select", width = WeakAuras.normalWidth, @@ -532,25 +531,25 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA desc = descIfNoValue2(data, conditions[i].changes[j], "value", "sound_type", propertyType, OptionsPrivate.Private.sound_condition_types), order = order, get = function() - return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.sound_type; + return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.sound_type end, set = setValueComplex("sound_type"), } - order = order + 1; + order = order + 1 local function anySoundType(needle) - local sound_type = type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.sound_type; - if (sound_type) then - return sound_type == needle; + local sound_type = type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.sound_type + if sound_type then + return sound_type == needle end - if (conditions[i].changes[j].references) then + if conditions[i].changes[j].references then for id, reference in pairs(conditions[i].changes[j].references) do - if (type(reference.value) == "table" and reference.value.sound_type == needle) then - return true; + if type(reference.value) == "table" and reference.value.sound_type == needle then + return true end end end - return false; + return false end args["condition" .. i .. "value" .. j .. "sound"] = { @@ -561,13 +560,15 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA desc = descIfNoValue2(data, conditions[i].changes[j], "value", "sound", propertyType, OptionsPrivate.Private.sound_types), order = order, get = function() - return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.sound; + return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.sound end, set = wrapWithPlaySound(setValueComplex("sound")), control = "WeakAurasSortedDropdown", - hidden = function() return not (anySoundType("Play") or anySoundType("Loop")) end + hidden = function() + return not (anySoundType("Play") or anySoundType("Loop")) + end, } - order = order + 1; + order = order + 1 args["condition" .. i .. "value" .. j .. "sound_channel"] = { type = "select", @@ -577,12 +578,14 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA desc = descIfNoValue2(data, conditions[i].changes[j], "value", "sound_channel", propertyType, OptionsPrivate.Private.sound_channel_types), order = order, get = function() - return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.sound_channel; + return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.sound_channel end, set = setValueComplex("sound_channel"), - hidden = function() return not (anySoundType("Loop") or anySoundType("Play")) end + hidden = function() + return not (anySoundType("Loop") or anySoundType("Play")) + end, } - order = order + 1; + order = order + 1 args["condition" .. i .. "value" .. j .. "sound_repeat"] = { type = "range", @@ -594,36 +597,42 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA desc = descIfNoValue2(data, conditions[i].changes[j], "value", "sound_repeat", propertyType), order = order, get = function() - return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.sound_repeat; + return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.sound_repeat end, set = setValueComplex("sound_repeat"), - disabled = function() return not anySoundType("Loop") end, - hidden = function() return not (anySoundType("Loop")) end + disabled = function() + return not anySoundType("Loop") + end, + hidden = function() + return not (anySoundType("Loop")) + end, } - order = order + 1; + order = order + 1 args["condition" .. i .. "value" .. j .. "sound_repeat_space"] = { type = "description", width = WeakAuras.normalWidth, name = "", order = order, - hidden = function() return not (anySoundType("Loop")) end + hidden = function() + return not (anySoundType("Loop")) + end, } - order = order + 1; + order = order + 1 local function anySoundValue(needle) - local sound_type = type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.sound; - if (sound_type) then - return sound_type == needle; + local sound_type = type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.sound + if sound_type then + return sound_type == needle end - if (conditions[i].changes[j].references) then + if conditions[i].changes[j].references then for id, reference in pairs(conditions[i].changes[j].references) do - if (type(reference.value) == "table" and reference.value.sound == needle) then - return true; + if type(reference.value) == "table" and reference.value.sound == needle then + return true end end end - return false; + return false end args["condition" .. i .. "value" .. j .. "sound_path"] = { @@ -633,12 +642,14 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA desc = descIfNoValue2(data, conditions[i].changes[j], "value", "sound_path", propertyType), order = order, get = function() - return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.sound_path; + return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.sound_path end, set = wrapWithPlaySound(setValueComplex("sound_path")), - hidden = function() return not (anySoundValue(" custom") and (anySoundType("Loop") or anySoundType("Play"))) end + hidden = function() + return not (anySoundValue(" custom") and (anySoundType("Loop") or anySoundType("Play"))) + end, } - order = order + 1; + order = order + 1 args["condition" .. i .. "value" .. j .. "sound_kit_id"] = { type = "input", @@ -647,15 +658,15 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA desc = descIfNoValue2(data, conditions[i].changes[j], "value", "sound_kit_id", propertyType), order = order, get = function() - return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.sound_kit_id; + return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.sound_kit_id end, set = wrapWithPlaySound(setValueComplex("sound_kit_id")), - hidden = function() return not (anySoundValue(" KitID") and (anySoundType("Loop") or anySoundType("Play"))) end + hidden = function() + return not (anySoundValue(" KitID") and (anySoundType("Loop") or anySoundType("Play"))) + end, } - order = order + 1; - - - elseif (propertyType == "chat") then + order = order + 1 + elseif propertyType == "chat" then args["condition" .. i .. "value" .. j .. "message type"] = { type = "select", width = WeakAuras.normalWidth, @@ -664,26 +675,26 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA desc = descIfNoValue2(data, conditions[i].changes[j], "value", "message_type", propertyType, OptionsPrivate.Private.send_chat_message_types), order = order, get = function() - return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.message_type; + return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.message_type end, set = setValueComplex("message_type"), - control = "WeakAurasSortedDropdown" + control = "WeakAurasSortedDropdown", } - order = order + 1; + order = order + 1 local function anyMessageType(needle) - local message_type = type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.message_type; - if (message_type) then - return message_type == needle; + local message_type = type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.message_type + if message_type then + return message_type == needle end - if (conditions[i].changes[j].references) then + if conditions[i].changes[j].references then for id, reference in pairs(conditions[i].changes[j].references) do - if (type(reference.value) == "table" and reference.value.message_type == needle) then - return true; + if type(reference.value) == "table" and reference.value.message_type == needle then + return true end end end - return false; + return false end if WeakAuras.IsRetail() then @@ -693,10 +704,10 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA name = L["Note: Automated Messages to SAY and YELL are blocked outside of Instances."], order = order, hidden = function() - return not (anyMessageType("SAY") or anyMessageType("YELL") or anyMessageType("SMARTRAID")); - end + return not (anyMessageType("SAY") or anyMessageType("YELL") or anyMessageType("SMARTRAID")) + end, } - order = order + 1; + order = order + 1 end args["condition" .. i .. "value" .. j .. "_indent"] = { @@ -705,10 +716,10 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA name = "", order = order, hidden = function() - return anyMessageType("WHISPER"); - end + return anyMessageType("WHISPER") + end, } - order = order + 1; + order = order + 1 args["condition" .. i .. "value" .. j .. "message color"] = { type = "color", @@ -719,19 +730,19 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA order = order, get = function() if (conditions[i].changes[j].value and type(conditions[i].changes[j].value) == "table") and type(conditions[i].changes[j].value.message_color) == "table" then - return conditions[i].changes[j].value.message_color[1], conditions[i].changes[j].value.message_color[2], conditions[i].changes[j].value.message_color[3]; + return conditions[i].changes[j].value.message_color[1], conditions[i].changes[j].value.message_color[2], conditions[i].changes[j].value.message_color[3] end - return 1, 1, 1, 1; + return 1, 1, 1, 1 end, set = setValueColorComplex("message_color"), hidden = function() - return not (anyMessageType("COMBAT") or anyMessageType("PRINT") or anyMessageType("ERROR")); - end + return not (anyMessageType("COMBAT") or anyMessageType("PRINT") or anyMessageType("ERROR")) + end, } - order = order + 1; + order = order + 1 - local descMessage = descIfNoValue2(data, conditions[i].changes[j], "value", "message", propertyType); - if (not descMessage and data ~= OptionsPrivate.tempGroup) then + local descMessage = descIfNoValue2(data, conditions[i].changes[j], "value", "message", propertyType) + if not descMessage and data ~= OptionsPrivate.tempGroup then descMessage = L["Dynamic text tooltip"] .. OptionsPrivate.Private.GetAdditionalProperties(data) end @@ -742,14 +753,14 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA desc = descMessage, order = order, get = function() - return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.message_dest; + return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.message_dest end, set = setValueComplex("message_dest"), hidden = function() - return not anyMessageType("WHISPER"); - end + return not anyMessageType("WHISPER") + end, } - order = order + 1; + order = order + 1 args["condition" .. i .. "value" .. j] = { type = "toggle", @@ -758,34 +769,36 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA desc = descIfNoValue(data, conditions[i].changes[j], "value", "message_dest_isunit", propertyType), order = order, get = function() - return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.message_dest_isunit; + return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.message_dest_isunit end, set = setValueComplex("message_dest_isunit"), hidden = function() - return not anyMessageType("WHISPER"); - end + return not anyMessageType("WHISPER") + end, } - order = order + 1; + order = order + 1 args["condition" .. i .. "value" .. j .. "message voice"] = { type = "select", width = WeakAuras.doubleWidth, name = blueIfNoValue2(data, conditions[i].changes[j], "value", "message_voice", L["Voice"], L["Voice"]), - desc = (descIfNoValue2(data, conditions[i].changes[j], "value", "message_voice", propertyType, OptionsPrivate.Private.tts_voices) or "") .. "\n" .. L["Available Voices are system specific"], + desc = (descIfNoValue2(data, conditions[i].changes[j], "value", "message_voice", propertyType, OptionsPrivate.Private.tts_voices) or "") + .. "\n" + .. L["Available Voices are system specific"], values = OptionsPrivate.Private.tts_voices, order = order, get = function() - return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.message_voice; + return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.message_voice end, set = setValueComplex("message_voice"), hidden = function() - return not anyMessageType("TTS"); + return not anyMessageType("TTS") end, } - order = order + 1; + order = order + 1 local message_getter = function() - return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.message; + return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.message end args["condition" .. i .. "value" .. j .. "message"] = { @@ -795,10 +808,9 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA desc = descMessage, order = order, get = message_getter, - set = setValueComplex("message") + set = setValueComplex("message"), } - order = order + 1; - + order = order + 1 local formatGet = function(key) return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value["message_format_" .. key] @@ -814,7 +826,7 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA order = order + 0.01 local fullKey = "condition" .. i .. "value" .. j .. "message_format_" .. key option.get = function() - return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value["message_format_" .. key]; + return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value["message_format_" .. key] end local originalName = option.name if option.type ~= "header" then @@ -830,7 +842,7 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA local hasTextFormatOption local hidden = function() - return OptionsPrivate.IsCollapsed("format_option", "conditions", i .. "#" .. j , true) + return OptionsPrivate.IsCollapsed("format_option", "conditions", i .. "#" .. j, true) end local setHidden = function(hidden) @@ -855,16 +867,20 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA local footerOption = { type = "header", name = "", - width = WeakAuras.doubleWidth + width = WeakAuras.doubleWidth, } addOption("footer", footerOption) end local function customHidden() - local message = type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.message; - local message_dest = type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.message_type == "WHISPER" and conditions[i].changes[j].value.message_dest - if (not message and not message_dest) then return true; end - return not OptionsPrivate.Private.ContainsCustomPlaceHolder(message) and not OptionsPrivate.Private.ContainsCustomPlaceHolder(message_dest); + local message = type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.message + local message_dest = type(conditions[i].changes[j].value) == "table" + and conditions[i].changes[j].value.message_type == "WHISPER" + and conditions[i].changes[j].value.message_dest + if not message and not message_dest then + return true + end + return not OptionsPrivate.Private.ContainsCustomPlaceHolder(message) and not OptionsPrivate.Private.ContainsCustomPlaceHolder(message_dest) end args["condition" .. i .. "value" .. j .. "custom"] = { @@ -876,7 +892,7 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA multiline = true, hidden = customHidden, get = function() - return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.custom; + return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.custom end, control = "WeakAurasMultiLineEditBox", set = setValueComplex("custom"), @@ -885,65 +901,72 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA { buttonLabel = L["Expand"], func = function() - if (data.controlledChildren) then + if data.controlledChildren then -- Collect multi paths - local multipath = {}; + local multipath = {} for id, reference in pairs(conditions[i].changes[j].references) do - local conditionIndex = conditions[i].check.references[id].conditionIndex; - local changeIndex = reference.changeIndex; - multipath[id] = {"conditions", conditionIndex, "changes", changeIndex, "value", "custom"}; + local conditionIndex = conditions[i].check.references[id].conditionIndex + local changeIndex = reference.changeIndex + multipath[id] = { "conditions", conditionIndex, "changes", changeIndex, "value", "custom" } end - OptionsPrivate.OpenTextEditor(data, multipath, nil, true, nil, nil, "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#chat-message---custom-code-1"); + OptionsPrivate.OpenTextEditor(data, multipath, nil, true, nil, nil, "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#chat-message---custom-code-1") else - OptionsPrivate.OpenTextEditor(data, {"conditions", i, "changes", j, "value", "custom"}, nil, nil, nil, nil, "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#chat-message---custom-code-1"); + OptionsPrivate.OpenTextEditor( + data, + { "conditions", i, "changes", j, "value", "custom" }, + nil, + nil, + nil, + nil, + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#chat-message---custom-code-1" + ) end - end - } - } - } + end, + }, + }, + }, } - order = order + 1; + order = order + 1 args["condition" .. i .. "value" .. j .. "custom_error"] = { type = "description", name = function() - local custom = type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.custom; + local custom = type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.custom if not custom then - return ""; + return "" end - local _, errorString = loadstring("return " .. custom); - return errorString and "|cFFFF0000"..errorString or ""; + local _, errorString = loadstring("return " .. custom) + return errorString and "|cFFFF0000" .. errorString or "" end, width = WeakAuras.doubleWidth, order = order, hidden = function() - local message = type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.message; - if (not message) then - return true; + local message = type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.message + if not message then + return true end - if (not OptionsPrivate.Private.ContainsCustomPlaceHolder(message)) then - return true; + if not OptionsPrivate.Private.ContainsCustomPlaceHolder(message) then + return true end - local custom = type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.custom; + local custom = type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.custom - if (not custom) then - return true; + if not custom then + return true end - local loadedFunction, errorString = loadstring("return " .. custom); - if(errorString and not loadedFunction) then - return false; + local loadedFunction, errorString = loadstring("return " .. custom) + if errorString and not loadedFunction then + return false else - return true; + return true end - end + end, } - order = order + 1; - - elseif(propertyType == "customcode") then - order = addSpace(args, order); + order = order + 1 + elseif propertyType == "customcode" then + order = addSpace(args, order) args["condition" .. i .. "value" .. j .. "custom"] = { type = "input", @@ -953,7 +976,7 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA order = order, multiline = true, get = function() - return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.custom; + return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.custom end, control = "WeakAurasMultiLineEditBox", set = setValueComplex("custom"), @@ -962,56 +985,64 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA { buttonLabel = L["Expand"], func = function() - if (data.controlledChildren) then + if data.controlledChildren then -- Collect multi paths - local multipath = {}; + local multipath = {} for id, reference in pairs(conditions[i].changes[j].references) do - local conditionIndex = conditions[i].check.references[id].conditionIndex; - local changeIndex = reference.changeIndex; - local childData = WeakAuras.GetData(id); - childData.conditions[conditionIndex].changes[changeIndex].value = childData.conditions[conditionIndex].changes[changeIndex].value or {}; - multipath[id] = {"conditions", conditionIndex, "changes", changeIndex, "value", "custom"}; + local conditionIndex = conditions[i].check.references[id].conditionIndex + local changeIndex = reference.changeIndex + local childData = WeakAuras.GetData(id) + childData.conditions[conditionIndex].changes[changeIndex].value = childData.conditions[conditionIndex].changes[changeIndex].value or {} + multipath[id] = { "conditions", conditionIndex, "changes", changeIndex, "value", "custom" } end - OptionsPrivate.OpenTextEditor(data, multipath, true, true, nil, nil, "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#run-custom-code"); + OptionsPrivate.OpenTextEditor(data, multipath, true, true, nil, nil, "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#run-custom-code") else - data.conditions[i].changes[j].value = data.conditions[i].changes[j].value or {}; - OptionsPrivate.OpenTextEditor(data, {"conditions", i, "changes", j, "value", "custom"}, true, nil, nil, nil, "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#run-custom-code"); + data.conditions[i].changes[j].value = data.conditions[i].changes[j].value or {} + OptionsPrivate.OpenTextEditor( + data, + { "conditions", i, "changes", j, "value", "custom" }, + true, + nil, + nil, + nil, + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#run-custom-code" + ) end - end - } - } - } + end, + }, + }, + }, } - order = order + 1; + order = order + 1 args["condition" .. i .. "value" .. j .. "custom_error"] = { type = "description", name = function() - local custom = type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.custom; + local custom = type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.custom if not custom then - return ""; + return "" end - local _, errorString = loadstring("return function() " .. custom .. "\n end"); - return errorString and "|cFFFF0000"..errorString or ""; + local _, errorString = loadstring("return function() " .. custom .. "\n end") + return errorString and "|cFFFF0000" .. errorString or "" end, width = WeakAuras.doubleWidth, order = order, hidden = function() - local custom = type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.custom; + local custom = type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.custom - if (not custom) then - return true; + if not custom then + return true end - local loadedFunction, errorString = loadstring("return function() " .. custom .. "\n end"); - if(errorString and not loadedFunction) then - return false; + local loadedFunction, errorString = loadstring("return function() " .. custom .. "\n end") + if errorString and not loadedFunction then + return false else - return true; + return true end - end + end, } - order = order + 1; - elseif (propertyType == "glowexternal") then + order = order + 1 + elseif propertyType == "glowexternal" then local function anyGlowExternal(property, needle) local ref = type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value[property] if ref then @@ -1050,9 +1081,9 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA desc = descIfNoValue2(data, conditions[i].changes[j], "value", "glow_action", propertyType, OptionsPrivate.Private.glow_action_types), order = order, get = function() - return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.glow_action; + return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.glow_action end, - set = setValueComplex("glow_action") + set = setValueComplex("glow_action"), } order = order + 1 args["condition" .. i .. "value" .. j .. "glow_frame_type"] = { @@ -1063,14 +1094,16 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA desc = descIfNoValue2(data, conditions[i].changes[j], "value", "glow_frame_type", propertyType, { UNITFRAME = L["Unit Frame"], NAMEPLATE = L["Nameplate"], - FRAMESELECTOR = L["Frame Selector"] + FRAMESELECTOR = L["Frame Selector"], }), order = order, get = function() - return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.glow_frame_type; + return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.glow_frame_type end, - hidden = function() return not anyGlowExternal("glow_action", OptionsPrivate.Private.glow_action_types) end, - set = setValueComplex("glow_frame_type") + hidden = function() + return not anyGlowExternal("glow_action", OptionsPrivate.Private.glow_action_types) + end, + set = setValueComplex("glow_frame_type"), } order = order + 1 args["condition" .. i .. "value" .. j .. "glow_type"] = { @@ -1081,12 +1114,12 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA desc = descIfNoValue2(data, conditions[i].changes[j], "value", "glow_type", propertyType, OptionsPrivate.Private.glow_types), order = order, get = function() - return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.glow_type; + return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.glow_type end, set = setValueComplex("glow_type"), hidden = function() return not (anyGlowExternal("glow_action", "show") and anyGlowExternal("glow_frame_type", OptionsPrivate.Private.glow_frame_types)) - end + end, } order = order + 1 args["condition" .. i .. "value" .. j .. "glow_frame"] = { @@ -1096,12 +1129,12 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA desc = descIfNoValue2(data, conditions[i].changes[j], "value", "glow_frame", propertyType), order = order, get = function() - return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.glow_frame; + return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.glow_frame end, set = setValueComplex("glow_frame"), hidden = function() return not anyGlowExternal("glow_frame_type", "FRAMESELECTOR") - end + end, } order = order + 1 args["condition" .. i .. "value" .. j .. "choose_glow_frame"] = { @@ -1111,11 +1144,11 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA desc = descIfNoValue2(data, conditions[i].changes[j], "value", "glow_frame", propertyType), order = order, func = function() - OptionsPrivate.StartFrameChooser(data, {"conditions", i, "changes", j, "value", "glow_frame"}); + OptionsPrivate.StartFrameChooser(data, { "conditions", i, "changes", j, "value", "glow_frame" }) end, hidden = function() return not anyGlowExternal("glow_frame_type", "FRAMESELECTOR") - end + end, } order = order + 1 args["condition" .. i .. "value" .. j .. "use_glow_color"] = { @@ -1125,12 +1158,12 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA desc = descIfNoValue2(data, conditions[i].changes[j], "value", "use_glow_color", propertyType), order = order, get = function() - return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.use_glow_color; + return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.use_glow_color end, set = setValueComplex("use_glow_color"), hidden = function() return not (anyGlowExternal("glow_action", "show") and anyGlowExternal("glow_type", OptionsPrivate.Private.glow_types)) - end + end, } order = order + 1 args["condition" .. i .. "value" .. j .. "glow_color"] = { @@ -1142,17 +1175,24 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA order = order, get = function() if (conditions[i].changes[j].value and type(conditions[i].changes[j].value) == "table") and type(conditions[i].changes[j].value.glow_color) == "table" then - return conditions[i].changes[j].value.glow_color[1], conditions[i].changes[j].value.glow_color[2], conditions[i].changes[j].value.glow_color[3], conditions[i].changes[j].value.glow_color[4]; + return conditions[i].changes[j].value.glow_color[1], + conditions[i].changes[j].value.glow_color[2], + conditions[i].changes[j].value.glow_color[3], + conditions[i].changes[j].value.glow_color[4] end - return 1, 1, 1, 1; + return 1, 1, 1, 1 end, set = setValueColorComplex("glow_color"), hidden = function() - return not (anyGlowExternal("glow_action", "show") - and anyGlowExternal("glow_frame_type", OptionsPrivate.Private.glow_frame_types) - and anyGlowExternal("glow_type", OptionsPrivate.Private.glow_types)) + return not ( + anyGlowExternal("glow_action", "show") + and anyGlowExternal("glow_frame_type", OptionsPrivate.Private.glow_frame_types) + and anyGlowExternal("glow_type", OptionsPrivate.Private.glow_types) + ) + end, + disabled = function() + return not anyGlowExternal("use_glow_color", true) end, - disabled = function() return not anyGlowExternal("use_glow_color", true) end } order = order + 1 args["condition" .. i .. "value" .. j .. "glow_lines"] = { @@ -1165,7 +1205,7 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA softMax = 30, step = 1, get = function() - return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.glow_lines or 8; + return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.glow_lines or 8 end, set = setValueComplex("glow_lines"), hidden = function() @@ -1183,7 +1223,7 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA softMax = 2, step = 0.05, get = function() - return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.glow_frequency or 0.25; + return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.glow_frequency or 0.25 end, set = setValueComplex("glow_frequency"), hidden = function() @@ -1201,7 +1241,7 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA softMax = 20, step = 0.05, get = function() - return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.glow_length or 10; + return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.glow_length or 10 end, set = setValueComplex("glow_length"), hidden = function() @@ -1219,7 +1259,7 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA softMax = 20, step = 0.05, get = function() - return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.glow_thickness or 1; + return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.glow_thickness or 1 end, set = setValueComplex("glow_thickness"), hidden = function() @@ -1237,7 +1277,7 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA softMax = 100, step = 0.5, get = function() - return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.glow_XOffset or 0; + return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.glow_XOffset or 0 end, set = setValueComplex("glow_XOffset"), hidden = function() @@ -1255,7 +1295,7 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA softMax = 100, step = 0.5, get = function() - return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.glow_YOffset or 0; + return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.glow_YOffset or 0 end, set = setValueComplex("glow_YOffset"), hidden = function() @@ -1274,7 +1314,7 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA step = 0.05, isPercent = true, get = function() - return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.glow_scale or 1; + return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.glow_scale or 1 end, set = setValueComplex("glow_scale"), hidden = function() @@ -1289,11 +1329,11 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA desc = descIfNoValue2(data, conditions[i].changes[j], "value", "glow_border", propertyType), order = order, get = function() - return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.glow_border; + return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.glow_border end, set = setValueComplex("glow_border"), - hidden = function() return - not (anyGlowExternal("glow_action", "show") and anyGlowExternal("glow_type", "Pixel")) + hidden = function() + return not (anyGlowExternal("glow_action", "show") and anyGlowExternal("glow_type", "Pixel")) end, } order = order + 1 @@ -1306,95 +1346,106 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA } order = order + 1 else -- Unknown property type - order = addSpace(args, order); + order = addSpace(args, order) end - return order; + return order end - local function checkSameValue(samevalue, propertyType) - if (propertyType == "chat") then - return samevalue.message_type and samevalue.message; - elseif (propertyType == "sound") then - return samevalue.sound and samevalue.sound_type; - elseif (propertyType == "customcode") then - return samevalue.custom; + if propertyType == "chat" then + return samevalue.message_type and samevalue.message + elseif propertyType == "sound" then + return samevalue.sound and samevalue.sound_type + elseif propertyType == "customcode" then + return samevalue.custom else - return samevalue; + return samevalue end end local function getOrCreateSubCheck(base, path) for _, i in ipairs(path) do - base.checks = base.checks or {}; - base.checks[i] = base.checks[i] or {}; - base = base.checks[i]; + base.checks = base.checks or {} + base.checks[i] = base.checks[i] or {} + base = base.checks[i] end - return base; + return base end - local function getSubCheck(base, path) for _, i in ipairs(path) do - if (not base.checks or not base.checks[i]) then - return nil; + if not base.checks or not base.checks[i] then + return nil end - base = base.checks[i]; + base = base.checks[i] end - return base; + return base end local function removeSubCheck(base, path) -- Ensures that the parents exists - getOrCreateSubCheck(base, path); + getOrCreateSubCheck(base, path) - local choppedPath = CopyTable(path); - tremove(choppedPath, #path); + local choppedPath = CopyTable(path) + tremove(choppedPath, #path) - local parent = getSubCheck(base, choppedPath); - tremove(parent.checks, path[#path]); + local parent = getSubCheck(base, choppedPath) + tremove(parent.checks, path[#path]) end -local function addControlsForIfLine(args, order, data, conditionVariable, totalAuraCount, conditions, i, path, conditionTemplates, conditionTemplateWithoutCombinations, allProperties, parentType) - local check = getSubCheck(conditions[i].check, path); - - local indentDepth = min(#path, 3); -- Be reasonable - local indentWidth = (indentDepth > 0 and 0.02 or 0) + indentDepth * 0.03; - local normalWidth = WeakAuras.normalWidth - indentWidth; - - local conditionTemplatesToUse = indentDepth < 3 and conditionTemplates or conditionTemplateWithoutCombinations; - - local optionsName = blueIfSubset(data, conditions[i].check, totalAuraCount); - local needsTriggerName = check and check.trigger and check.trigger ~= -1 and check.trigger ~= -2; - if (parentType) then - local isFirst = path[#path] == 1; - if (isFirst) then - if (needsTriggerName) then - optionsName = optionsName .. string.format(L["Trigger %s"], check.trigger); +local function addControlsForIfLine( + args, + order, + data, + conditionVariable, + totalAuraCount, + conditions, + i, + path, + conditionTemplates, + conditionTemplateWithoutCombinations, + allProperties, + parentType +) + local check = getSubCheck(conditions[i].check, path) + + local indentDepth = min(#path, 3) -- Be reasonable + local indentWidth = (indentDepth > 0 and 0.02 or 0) + indentDepth * 0.03 + local normalWidth = WeakAuras.normalWidth - indentWidth + + local conditionTemplatesToUse = indentDepth < 3 and conditionTemplates or conditionTemplateWithoutCombinations + + local optionsName = blueIfSubset(data, conditions[i].check, totalAuraCount) + local needsTriggerName = check and check.trigger and check.trigger ~= -1 and check.trigger ~= -2 + if parentType then + local isFirst = path[#path] == 1 + if isFirst then + if needsTriggerName then + optionsName = optionsName .. string.format(L["Trigger %s"], check.trigger) end else - if (needsTriggerName) then - if (parentType == "AND") then - optionsName = optionsName .. string.format(L["and Trigger %s"], check.trigger); + if needsTriggerName then + if parentType == "AND" then + optionsName = optionsName .. string.format(L["and Trigger %s"], check.trigger) else - optionsName = optionsName .. string.format(L["or Trigger %s"], check.trigger); + optionsName = optionsName .. string.format(L["or Trigger %s"], check.trigger) end end end else local isLinked = conditions[i].linked and i > 1 - if (needsTriggerName) then + if needsTriggerName then if isLinked then - optionsName = optionsName .. string.format(L["Else If Trigger %s"], check.trigger); + optionsName = optionsName .. string.format(L["Else If Trigger %s"], check.trigger) else - optionsName = optionsName .. string.format(L["If Trigger %s"], check.trigger); + optionsName = optionsName .. string.format(L["If Trigger %s"], check.trigger) end else - optionsName = optionsName .. (isLinked and L["Else If"] or L["If"]) + optionsName = optionsName .. (isLinked and L["Else If"] or L["If"]) end end - if (indentWidth > 0) then + if indentWidth > 0 then -- Our container frame is not exactly at width = 2, due to some legacy -- Typically that works fine because the next widget doesn't fit into -- previous line. But the bullets are so small that we need to ensure @@ -1402,20 +1453,22 @@ local function addControlsForIfLine(args, order, data, conditionVariable, totalA args["space" .. order] = { type = "description", name = "", - image = function() return "", 0, 0 end, + image = function() + return "", 0, 0 + end, order = order, width = WeakAuras.doubleWidth * 1.5, } - order = order + 1; + order = order + 1 - if (indentWidth > 0.05) then + if indentWidth > 0.05 then args["condition" .. i .. tostring(path) .. "indent"] = { type = "description", width = indentWidth - 0.05, name = "", - order = order + order = order, } - order = order + 1; + order = order + 1 end args["condition" .. i .. tostring(path) .. "bullet"] = { @@ -1427,14 +1480,14 @@ local function addControlsForIfLine(args, order, data, conditionVariable, totalA imageWidth = 10, imageHeight = 10, } - order = order + 1; + order = order + 1 end - local valuesForIf; - if (indentDepth > 0) then - valuesForIf = conditionTemplatesToUse.displayWithRemove; + local valuesForIf + if indentDepth > 0 then + valuesForIf = conditionTemplatesToUse.displayWithRemove else - valuesForIf = isSubset(data, conditions[i].check, totalAuraCount) and conditionTemplatesToUse.displayWithCopy or conditionTemplatesToUse.display; + valuesForIf = isSubset(data, conditions[i].check, totalAuraCount) and conditionTemplatesToUse.displayWithCopy or conditionTemplatesToUse.display end args["condition" .. i .. tostring(path) .. "if"] = { @@ -1443,163 +1496,176 @@ local function addControlsForIfLine(args, order, data, conditionVariable, totalA desc = descIfSubset(data, conditions[i].check, totalAuraCount), order = order, values = valuesForIf, - width = normalWidth; + width = normalWidth, set = function(info, v) - if (conditionTemplatesToUse.indexToTrigger[v] == "COPY") then + if conditionTemplatesToUse.indexToTrigger[v] == "COPY" then for child in OptionsPrivate.Private.TraverseLeafs(data) do - if (conditions[i].check.references[child.id]) then + if conditions[i].check.references[child.id] then -- Already exists else -- find a good insertion point, if any other condition has a reference to this -- insert directly after that - local insertPoint = 1; + local insertPoint = 1 for index = i, 1, -1 do - if (conditions[index].check.references[child.id]) then - insertPoint = index + 1; - break; + if conditions[index].check.references[child.id] then + insertPoint = index + 1 + break end end - local condition = {}; - condition.check = {}; - condition.check.trigger = conditions[i].check.trigger; - condition.check.variable = conditions[i].check.variable; - condition.check.op = conditions[i].check.op; - condition.check.value = conditions[i].check.value; - if (conditions[i].check.checks) then - condition.check.checks = CopyTable(conditions[i].check.checks); + local condition = {} + condition.check = {} + condition.check.trigger = conditions[i].check.trigger + condition.check.variable = conditions[i].check.variable + condition.check.op = conditions[i].check.op + condition.check.value = conditions[i].check.value + if conditions[i].check.checks then + condition.check.checks = CopyTable(conditions[i].check.checks) end - condition.changes = {}; + condition.changes = {} for changeIndex, change in ipairs(conditions[i].changes) do local propertyType = change.property and allProperties.propertyMap[change.property] and allProperties.propertyMap[change.property].type - if (checkSameValue(change.samevalue, propertyType)) then - local copy = {}; - copy.property = change.property; - if (type(change.value) == "table") then - copy.value = CopyTable(change.value); + if checkSameValue(change.samevalue, propertyType) then + local copy = {} + copy.property = change.property + if type(change.value) == "table" then + copy.value = CopyTable(change.value) else - copy.value = change.value; + copy.value = change.value end - tinsert(condition.changes, copy); + tinsert(condition.changes, copy) end end - tinsert(child[conditionVariable], insertPoint, condition); - WeakAuras.Add(child); + tinsert(child[conditionVariable], insertPoint, condition) + WeakAuras.Add(child) OptionsPrivate.ClearOptions(child.id) end end WeakAuras.ClearAndUpdateOptions(data.id) - return; + return end - if (conditionTemplatesToUse.indexToTrigger[v] == "REMOVE") then - if (data.controlledChildren) then + if conditionTemplatesToUse.indexToTrigger[v] == "REMOVE" then + if data.controlledChildren then for id, reference in pairs(conditions[i].check.references) do - local auraData = WeakAuras.GetData(id); - removeSubCheck(auraData[conditionVariable][reference.conditionIndex].check, path); + local auraData = WeakAuras.GetData(id) + removeSubCheck(auraData[conditionVariable][reference.conditionIndex].check, path) WeakAuras.Add(auraData) WeakAuras.ClearAndUpdateOptions(auraData.id) end else - removeSubCheck(conditions[i].check, path); + removeSubCheck(conditions[i].check, path) WeakAuras.Add(data) WeakAuras.ClearAndUpdateOptions(data.id) end - return; + return end - local trigger = conditionTemplatesToUse.indexToTrigger[v]; - local variable = conditionTemplatesToUse.indexToVariable[v]; - if (not trigger or not variable) then - return; + local trigger = conditionTemplatesToUse.indexToTrigger[v] + local variable = conditionTemplatesToUse.indexToVariable[v] + if not trigger or not variable then + return end - if (data.controlledChildren) then + if data.controlledChildren then for id, reference in pairs(conditions[i].check.references) do - local auraData = WeakAuras.GetData(id); - local childCheck = getOrCreateSubCheck(auraData[conditionVariable][reference.conditionIndex].check, path); - childCheck.variable = variable; - childCheck.trigger = trigger; - childCheck.value = nil; - WeakAuras.Add(auraData); + local auraData = WeakAuras.GetData(id) + local childCheck = getOrCreateSubCheck(auraData[conditionVariable][reference.conditionIndex].check, path) + childCheck.variable = variable + childCheck.trigger = trigger + childCheck.value = nil + WeakAuras.Add(auraData) OptionsPrivate.ClearOptions(auraData.id) end WeakAuras.ClearAndUpdateOptions(data.id) else - local oldType; - check = getOrCreateSubCheck(conditions[i].check, path); - if (check.trigger and check.variable) then - local templatesForTrigger = conditionTemplatesToUse.all[check.trigger]; - local templatesForTriggerAndCondition = templatesForTrigger and templatesForTrigger[check.variable]; - oldType = templatesForTriggerAndCondition and templatesForTriggerAndCondition.type; - end - check.variable = variable; - check.trigger = trigger; - local newType = conditionTemplatesToUse.all[trigger][variable].type; - if (newType ~= oldType) then - check.value = nil; + local oldType + check = getOrCreateSubCheck(conditions[i].check, path) + if check.trigger and check.variable then + local templatesForTrigger = conditionTemplatesToUse.all[check.trigger] + local templatesForTriggerAndCondition = templatesForTrigger and templatesForTrigger[check.variable] + oldType = templatesForTriggerAndCondition and templatesForTriggerAndCondition.type + end + check.variable = variable + check.trigger = trigger + local newType = conditionTemplatesToUse.all[trigger][variable].type + if newType ~= oldType then + check.value = nil end - WeakAuras.Add(data); + WeakAuras.Add(data) WeakAuras.ClearAndUpdateOptions(data.id) end end, get = function() - local trigger = check and check.trigger; - local variable = check and check.variable; - if ( trigger and variable ) then - return conditionTemplatesToUse.conditionToIndex[trigger .. "-" .. variable]; + local trigger = check and check.trigger + local variable = check and check.variable + if trigger and variable then + return conditionTemplatesToUse.conditionToIndex[trigger .. "-" .. variable] end - return ""; - end - }; + return "" + end, + } - order = order + 1; + order = order + 1 - if (check and (check.variable == "AND" or check.variable == "OR")) then - order = addSpace(args, order); + if check and (check.variable == "AND" or check.variable == "OR") then + order = addSpace(args, order) - local subCheckCount = check.checks and #check.checks or 0; + local subCheckCount = check.checks and #check.checks or 0 -- We always want one more control than there are existing checks - subCheckCount = subCheckCount + 1; + subCheckCount = subCheckCount + 1 for subCheck = 1, subCheckCount do - local subPath = CopyTable(path); - tinsert(subPath, subCheck); - order = addControlsForIfLine(args, order, data, conditionVariable, totalAuraCount, conditions, i, subPath, conditionTemplates, conditionTemplateWithoutCombinations, allProperties, check.variable); + local subPath = CopyTable(path) + tinsert(subPath, subCheck) + order = addControlsForIfLine( + args, + order, + data, + conditionVariable, + totalAuraCount, + conditions, + i, + subPath, + conditionTemplates, + conditionTemplateWithoutCombinations, + allProperties, + check.variable + ) end end - local currentConditionTemplate = nil; - local trigger = check and check.trigger; - local variable = check and check.variable; - if (trigger and variable) then - if (conditionTemplatesToUse.all[trigger]) then - currentConditionTemplate = conditionTemplatesToUse.all[trigger][variable]; + local currentConditionTemplate = nil + local trigger = check and check.trigger + local variable = check and check.variable + if trigger and variable then + if conditionTemplatesToUse.all[trigger] then + currentConditionTemplate = conditionTemplatesToUse.all[trigger][variable] end end - if (currentConditionTemplate and currentConditionTemplate.type and type(currentConditionTemplate.type) == "string") then + if currentConditionTemplate and currentConditionTemplate.type and type(currentConditionTemplate.type) == "string" then local function makeSetter(field) - if (data.controlledChildren) then + if data.controlledChildren then return function(info, v) - check = getOrCreateSubCheck(conditions[i].check, path); + check = getOrCreateSubCheck(conditions[i].check, path) for id, reference in pairs(conditions[i].check.references) do - local auraData = WeakAuras.GetData(id); - local childCheck = getOrCreateSubCheck(auraData[conditionVariable][reference.conditionIndex].check, path); - childCheck[field] = v; - WeakAuras.Add(auraData); + local auraData = WeakAuras.GetData(id) + local childCheck = getOrCreateSubCheck(auraData[conditionVariable][reference.conditionIndex].check, path) + childCheck[field] = v + WeakAuras.Add(auraData) OptionsPrivate.ClearOptions(auraData.id) end - check[field] = v; + check[field] = v WeakAuras.ClearAndUpdateOptions(data.id) end else return function(info, v) - check = getOrCreateSubCheck(conditions[i].check, path); - check[field] = v; - WeakAuras.Add(data); + check = getOrCreateSubCheck(conditions[i].check, path) + check[field] = v + WeakAuras.Add(data) WeakAuras.ClearAndUpdateOptions(data.id) end end @@ -1608,7 +1674,7 @@ local function addControlsForIfLine(args, order, data, conditionVariable, totalA local setOp = makeSetter("op") local setValue = makeSetter("value") - if (currentConditionTemplate.type == "number" or currentConditionTemplate.type == "timer" or currentConditionTemplate.type == "elapsedTimer") then + if currentConditionTemplate.type == "number" or currentConditionTemplate.type == "timer" or currentConditionTemplate.type == "elapsedTimer" then local opTypes = OptionsPrivate.Private.operator_types if currentConditionTemplate.operator_types == "without_equal" then opTypes = OptionsPrivate.Private.operator_types_without_equal @@ -1624,11 +1690,11 @@ local function addControlsForIfLine(args, order, data, conditionVariable, totalA values = opTypes, width = WeakAuras.halfWidth, get = function() - return check.op; + return check.op end, set = setOp, } - order = order + 1; + order = order + 1 args["condition" .. i .. tostring(path) .. "_value"] = { type = "input", @@ -1638,13 +1704,13 @@ local function addControlsForIfLine(args, order, data, conditionVariable, totalA order = order, validate = WeakAuras.ValidateNumeric, get = function() - return check.value; + return check.value end, - set = setValue + set = setValue, } - order = order + 1; + order = order + 1 elseif (currentConditionTemplate.type == "select") or (currentConditionTemplate.type == "unit") then - if (type(currentConditionTemplate.values) == "table") then + if type(currentConditionTemplate.values) == "table" then args["condition" .. i .. tostring(path) .. "_op"] = { name = blueIfNoValue(data, conditions[i].check, "op", L["Differences"]), desc = descIfNoValue(data, conditions[i].check, "op", currentConditionTemplate.type), @@ -1653,15 +1719,15 @@ local function addControlsForIfLine(args, order, data, conditionVariable, totalA order = order, values = OptionsPrivate.Private.equality_operator_types, get = function() - return check.op; + return check.op end, set = setOp, } - order = order + 1; + order = order + 1 - order = addSpace(args, order); + order = addSpace(args, order) - if (currentConditionTemplate.type == "unit") then + if currentConditionTemplate.type == "unit" then args["condition" .. i .. tostring(path) .. "_value"] = { type = "select", width = WeakAuras.normalWidth, @@ -1672,9 +1738,9 @@ local function addControlsForIfLine(args, order, data, conditionVariable, totalA get = function() return currentConditionTemplate.values[check.value] and check.value or (check.value and "member") end, - set = setValue + set = setValue, } - order = order + 1; + order = order + 1 args["condition" .. i .. tostring(path) .. "_member"] = { type = "input", @@ -1688,9 +1754,9 @@ local function addControlsForIfLine(args, order, data, conditionVariable, totalA set = setValue, hidden = function() return not conditions[i].check.value or currentConditionTemplate.values[conditions[i].check.value] and conditions[i].check.value ~= "member" - end + end, } - order = order + 1; + order = order + 1 else args["condition" .. i .. tostring(path) .. "_value"] = { type = "select", @@ -1702,12 +1768,12 @@ local function addControlsForIfLine(args, order, data, conditionVariable, totalA get = function() return check.value end, - set = setValue + set = setValue, } - order = order + 1; + order = order + 1 end end - elseif (currentConditionTemplate.type == "bool") then + elseif currentConditionTemplate.type == "bool" then args["condition" .. i .. tostring(path) .. "_value"] = { type = "select", width = WeakAuras.normalWidth, @@ -1716,12 +1782,12 @@ local function addControlsForIfLine(args, order, data, conditionVariable, totalA order = order, values = OptionsPrivate.Private.bool_types, get = function() - return check and check.value; + return check and check.value end, - set = setValue + set = setValue, } - order = order + 1; - elseif (currentConditionTemplate.type == "string") then + order = order + 1 + elseif currentConditionTemplate.type == "string" then if currentConditionTemplate.operator_types ~= "none" then args["condition" .. i .. tostring(path) .. "_op"] = { name = blueIfNoValue(data, conditions[i].check, "op", L["Differences"]), @@ -1731,12 +1797,12 @@ local function addControlsForIfLine(args, order, data, conditionVariable, totalA order = order, values = OptionsPrivate.Private.string_operator_types, get = function() - return check and check.op; + return check and check.op end, - set = setOp + set = setOp, } - order = order + 1; - order = addSpace(args, order); + order = order + 1 + order = addSpace(args, order) end args["condition" .. i .. tostring(path) .. "_value"] = { @@ -1746,14 +1812,14 @@ local function addControlsForIfLine(args, order, data, conditionVariable, totalA desc = descIfNoValue(data, conditions[i].check, "value", currentConditionTemplate.type), order = order, get = function() - return check and check.value; + return check and check.value end, - set = setValue + set = setValue, } - order = order + 1; + order = order + 1 elseif currentConditionTemplate.type == "alwaystrue" then order = addSpace(args, order) - elseif (currentConditionTemplate.type == "range") then + elseif currentConditionTemplate.type == "range" then args["condition" .. i .. tostring(path) .. "_op_range"] = { name = blueIfNoValue(data, conditions[i].check, "op_range", L["Differences"]), desc = descIfNoValue(data, conditions[i].check, "op_range", currentConditionTemplate.type), @@ -1762,11 +1828,11 @@ local function addControlsForIfLine(args, order, data, conditionVariable, totalA values = OptionsPrivate.Private.operator_types_without_equal, width = WeakAuras.halfWidth, get = function() - return check.op_range; + return check.op_range end, set = makeSetter("op_range"), } - order = order + 1; + order = order + 1 args["condition" .. i .. tostring(path) .. "_range"] = { type = "input", @@ -1776,27 +1842,27 @@ local function addControlsForIfLine(args, order, data, conditionVariable, totalA order = order, validate = WeakAuras.ValidateNumeric, get = function() - return check.range; + return check.range end, - set = makeSetter("range") + set = makeSetter("range"), } - order = order + 1; + order = order + 1 - if (indentWidth > 0) then + if indentWidth > 0 then args["condition" .. i .. tostring(path) .. "_space"] = { type = "description", name = "", order = order, width = WeakAuras.doubleWidth * 1.5, } - order = order + 1; + order = order + 1 args["condition" .. i .. tostring(path) .. "_indent"] = { type = "description", width = indentWidth, name = "", - order = order + order = order, } - order = order + 1; + order = order + 1 end args["condition" .. i .. tostring(path) .. "_type"] = { @@ -1807,14 +1873,14 @@ local function addControlsForIfLine(args, order, data, conditionVariable, totalA order = order, values = { group = L["Group player(s) found"], - enemies = L["Enemy nameplate(s) found"] + enemies = L["Enemy nameplate(s) found"], }, get = function() return check.type end, set = makeSetter("type"), } - order = order + 1; + order = order + 1 args["condition" .. i .. tostring(path) .. "_op"] = { name = blueIfNoValue(data, conditions[i].check, "op", L["Differences"]), @@ -1824,11 +1890,11 @@ local function addControlsForIfLine(args, order, data, conditionVariable, totalA values = OptionsPrivate.Private.operator_types, width = WeakAuras.halfWidth, get = function() - return check.op; + return check.op end, set = setOp, } - order = order + 1; + order = order + 1 args["condition" .. i .. tostring(path) .. "_value"] = { type = "input", @@ -1838,11 +1904,11 @@ local function addControlsForIfLine(args, order, data, conditionVariable, totalA order = order, validate = WeakAuras.ValidateNumeric, get = function() - return check.value; + return check.value end, - set = setValue + set = setValue, } - order = order + 1; + order = order + 1 elseif currentConditionTemplate.type == "customcheck" then args["condition" .. i .. tostring(path) .. "_op"] = { name = blueIfNoValue(data, conditions[i].check, "op", L["Additional Events"], L["Additional Events"]), @@ -1851,11 +1917,11 @@ local function addControlsForIfLine(args, order, data, conditionVariable, totalA width = WeakAuras.doubleWidth, order = order, get = function() - return check and check.op; + return check and check.op end, - set = setOp + set = setOp, } - order = order + 1; + order = order + 1 args["condition" .. i .. tostring(path) .. "_value"] = { type = "input", @@ -1864,7 +1930,7 @@ local function addControlsForIfLine(args, order, data, conditionVariable, totalA desc = descIfNoValue(data, conditions[i].check, "value", currentConditionTemplate.type) or "", order = order, get = function() - return check and check.value; + return check and check.value end, set = setValue, multiline = true, @@ -1874,19 +1940,19 @@ local function addControlsForIfLine(args, order, data, conditionVariable, totalA { buttonLabel = L["Expand"], func = function() - if (data.controlledChildren) then + if data.controlledChildren then -- Collect multi paths - local multipath = {}; + local multipath = {} for id in pairs(conditions[i].check.references) do - local conditionIndex = conditions[i].check.references[id].conditionIndex; - multipath[id] ={ "conditions", conditionIndex, "check" } + local conditionIndex = conditions[i].check.references[id].conditionIndex + multipath[id] = { "conditions", conditionIndex, "check" } for _, v in ipairs(path) do tinsert(multipath[id], "checks") tinsert(multipath[id], v) end tinsert(multipath[id], "value") end - OptionsPrivate.OpenTextEditor(data, multipath, nil, true, nil, nil, "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-check"); + OptionsPrivate.OpenTextEditor(data, multipath, nil, true, nil, nil, "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-check") else local fullPath = { "conditions", i, "check" } for _, v in ipairs(path) do @@ -1895,49 +1961,49 @@ local function addControlsForIfLine(args, order, data, conditionVariable, totalA end tinsert(fullPath, "value") - OptionsPrivate.OpenTextEditor(data, fullPath, nil, nil, nil, nil, "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-check"); + OptionsPrivate.OpenTextEditor(data, fullPath, nil, nil, nil, nil, "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-check") end - end - } - } - } + end, + }, + }, + }, } order = order + 1 args["condition" .. i .. tostring(path) .. "_value_error"] = { type = "description", name = function() - if (not check.value) then + if not check.value then return "" end - local _, errorString = loadstring("return " .. check.value); - return errorString and "|cFFFF0000"..errorString or ""; + local _, errorString = loadstring("return " .. check.value) + return errorString and "|cFFFF0000" .. errorString or "" end, width = WeakAuras.doubleWidth, order = order, hidden = function() - if (not check.value) then - return true; + if not check.value then + return true end - local loadedFunction, errorString = loadstring("return " .. check.value); - if(errorString and not loadedFunction) then - return false; + local loadedFunction, errorString = loadstring("return " .. check.value) + if errorString and not loadedFunction then + return false else - return true; + return true end - end + end, } order = order + 1 - elseif (currentConditionTemplate.type == "combination") then + elseif currentConditionTemplate.type == "combination" then -- Do nothing else - order = addSpace(args, order); + order = addSpace(args, order) end else - order = addSpace(args, order); + order = addSpace(args, order) end - return order; + return order end local function fixUpLinkedInFirstCondition(conditions) @@ -1947,22 +2013,22 @@ local function fixUpLinkedInFirstCondition(conditions) end local function addControlsForCondition(args, order, data, conditionVariable, totalAuraCount, conditions, i, conditionTemplates, conditionTemplateWithoutCombinations, allProperties) - if (not conditions[i].check) then - return order; + if not conditions[i].check then + return order end local defaultCollapsed = #conditions > 2 - local collapsed = false; + local collapsed = false if data.controlledChildren then for id, reference in pairs(conditions[i].check.references) do - local index = reference.conditionIndex; + local index = reference.conditionIndex if OptionsPrivate.IsCollapsed(id, "condition", index, defaultCollapsed) then - collapsed = true; - break; + collapsed = true + break end end else - collapsed = OptionsPrivate.IsCollapsed(data.id, "condition", i, defaultCollapsed); + collapsed = OptionsPrivate.IsCollapsed(data.id, "condition", i, defaultCollapsed) end args["condition" .. i .. "header"] = { @@ -1974,62 +2040,62 @@ local function addControlsForCondition(args, order, data, conditionVariable, tot if data.controlledChildren then for id, reference in pairs(conditions[i].check.references) do local index = reference.conditionIndex - OptionsPrivate.SetCollapsed(id, "condition", index, not collapsed); + OptionsPrivate.SetCollapsed(id, "condition", index, not collapsed) OptionsPrivate.ClearOptions(id) end else - OptionsPrivate.SetCollapsed(data.id, "condition", i, not collapsed); + OptionsPrivate.SetCollapsed(data.id, "condition", i, not collapsed) end WeakAuras.ClearAndUpdateOptions(data.id) end, - image = collapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\expand" or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\collapse" , + image = collapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\expand" or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\collapse", imageWidth = 18, imageHeight = 18, - control = "WeakAurasExpand" - }; - order = order + 1; + control = "WeakAurasExpand", + } + order = order + 1 args["condition" .. i .. "up"] = { type = "execute", name = L["Move Up"], order = order, disabled = function() - if (data.controlledChildren) then + if data.controlledChildren then for _, reference in pairs(conditions[i].check.references) do - local index = reference.conditionIndex; - if (index > 1) then - return false; + local index = reference.conditionIndex + if index > 1 then + return false end end - return true; + return true else - return i == 1; + return i == 1 end end, func = function() - if (data.controlledChildren) then + if data.controlledChildren then for id, reference in pairs(conditions[i].check.references) do - local auraData = WeakAuras.GetData(id); - local index = reference.conditionIndex; - if (index > 1) then - local tmp = auraData[conditionVariable][reference.conditionIndex]; - tremove(auraData[conditionVariable], reference.conditionIndex); - tinsert(auraData[conditionVariable], reference.conditionIndex - 1, tmp); + local auraData = WeakAuras.GetData(id) + local index = reference.conditionIndex + if index > 1 then + local tmp = auraData[conditionVariable][reference.conditionIndex] + tremove(auraData[conditionVariable], reference.conditionIndex) + tinsert(auraData[conditionVariable], reference.conditionIndex - 1, tmp) fixUpLinkedInFirstCondition(auraData[conditionVariable]) - WeakAuras.Add(auraData); - OptionsPrivate.MoveCollapseDataUp(auraData.id, "condition", {reference.conditionIndex}) + WeakAuras.Add(auraData) + OptionsPrivate.MoveCollapseDataUp(auraData.id, "condition", { reference.conditionIndex }) OptionsPrivate.ClearOptions(auraData.id) end end WeakAuras.ClearAndUpdateOptions(data.id) else - if (i > 1) then - local tmp = conditions[i]; - tremove(conditions, i); - tinsert(conditions, i - 1, tmp); + if i > 1 then + local tmp = conditions[i] + tremove(conditions, i) + tinsert(conditions, i - 1, tmp) fixUpLinkedInFirstCondition(conditions) - WeakAuras.Add(data); - OptionsPrivate.MoveCollapseDataUp(data.id, "condition", {i}) + WeakAuras.Add(data) + OptionsPrivate.MoveCollapseDataUp(data.id, "condition", { i }) WeakAuras.ClearAndUpdateOptions(data.id) end end @@ -2038,55 +2104,55 @@ local function addControlsForCondition(args, order, data, conditionVariable, tot image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\moveup", imageWidth = 24, imageHeight = 24, - control = "WeakAurasIcon" - }; - order = order + 1; + control = "WeakAurasIcon", + } + order = order + 1 args["condition" .. i .. "down"] = { type = "execute", name = L["Move Down"], order = order, disabled = function() - if (data.controlledChildren) then + if data.controlledChildren then for id, reference in pairs(conditions[i].check.references) do - local index = reference.conditionIndex; - local auraData = WeakAuras.GetData(id); - if (index < #auraData[conditionVariable]) then - return false; + local index = reference.conditionIndex + local auraData = WeakAuras.GetData(id) + if index < #auraData[conditionVariable] then + return false end end - return true; + return true else - return i == #conditions; + return i == #conditions end end, func = function() - if (data.controlledChildren) then + if data.controlledChildren then for id, reference in pairs(conditions[i].check.references) do - local auraData = WeakAuras.GetData(id); - local index = reference.conditionIndex; - if (index < #auraData[conditionVariable]) then - local tmp = auraData[conditionVariable][reference.conditionIndex]; - tremove(auraData[conditionVariable], reference.conditionIndex); - tinsert(auraData[conditionVariable], reference.conditionIndex + 1, tmp); + local auraData = WeakAuras.GetData(id) + local index = reference.conditionIndex + if index < #auraData[conditionVariable] then + local tmp = auraData[conditionVariable][reference.conditionIndex] + tremove(auraData[conditionVariable], reference.conditionIndex) + tinsert(auraData[conditionVariable], reference.conditionIndex + 1, tmp) fixUpLinkedInFirstCondition(auraData[conditionVariable]) - WeakAuras.Add(auraData); - OptionsPrivate.MoveCollapseDataDown(auraData.id, "condition", {reference.conditionIndex}) + WeakAuras.Add(auraData) + OptionsPrivate.MoveCollapseDataDown(auraData.id, "condition", { reference.conditionIndex }) OptionsPrivate.ClearOptions(auraData.id) end end WeakAuras.ClearAndUpdateOptions(data.id) - return; + return else - if (i < #conditions) then - local tmp = conditions[i]; - tremove(conditions, i); - tinsert(conditions, i + 1, tmp); + if i < #conditions then + local tmp = conditions[i] + tremove(conditions, i) + tinsert(conditions, i + 1, tmp) fixUpLinkedInFirstCondition(conditions) - WeakAuras.Add(data); - OptionsPrivate.MoveCollapseDataDown(data.id, "condition", {i}) + WeakAuras.Add(data) + OptionsPrivate.MoveCollapseDataDown(data.id, "condition", { i }) WeakAuras.ClearAndUpdateOptions(data.id) - return; + return end end end, @@ -2094,94 +2160,94 @@ local function addControlsForCondition(args, order, data, conditionVariable, tot image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\movedown", imageWidth = 24, imageHeight = 24, - control = "WeakAurasIcon" - }; - order = order + 1; + control = "WeakAurasIcon", + } + order = order + 1 args["condition" .. i .. "duplicate"] = { type = "execute", name = L["Duplicate"], order = order, func = function() - if (data.controlledChildren) then + if data.controlledChildren then for id, reference in pairs(conditions[i].check.references) do - local auraData = WeakAuras.GetData(id); + local auraData = WeakAuras.GetData(id) local clone = CopyTable(auraData[conditionVariable][reference.conditionIndex]) - tinsert(auraData[conditionVariable], reference.conditionIndex + 1, clone); - WeakAuras.Add(auraData); - OptionsPrivate.DuplicateCollapseData(auraData.id, "condition", {reference.conditionIndex}) + tinsert(auraData[conditionVariable], reference.conditionIndex + 1, clone) + WeakAuras.Add(auraData) + OptionsPrivate.DuplicateCollapseData(auraData.id, "condition", { reference.conditionIndex }) OptionsPrivate.ClearOptions(auraData.id) end WeakAuras.ClearAndUpdateOptions(data.id) - return; + return else local clone = CopyTable(conditions[i]) - tinsert(conditions, i + 1, clone); - WeakAuras.Add(data); - OptionsPrivate.DuplicateCollapseData(data.id, "condition", {i}) + tinsert(conditions, i + 1, clone) + WeakAuras.Add(data) + OptionsPrivate.DuplicateCollapseData(data.id, "condition", { i }) WeakAuras.ClearAndUpdateOptions(data.id) - return; + return end end, width = 0.15, image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\duplicate", imageWidth = 24, imageHeight = 24, - control = "WeakAurasIcon" - }; - order = order + 1; + control = "WeakAurasIcon", + } + order = order + 1 args["condition" .. i .. "delete"] = { type = "execute", name = L["Delete"], order = order, func = function() - if (data.controlledChildren) then + if data.controlledChildren then for id, reference in pairs(conditions[i].check.references) do - local auraData = WeakAuras.GetData(id); - tremove(auraData[conditionVariable], reference.conditionIndex); + local auraData = WeakAuras.GetData(id) + tremove(auraData[conditionVariable], reference.conditionIndex) fixUpLinkedInFirstCondition(auraData[conditionVariable]) - WeakAuras.Add(auraData); - OptionsPrivate.RemoveCollapsed(auraData.id, "condition", {reference.conditionIndex}) + WeakAuras.Add(auraData) + OptionsPrivate.RemoveCollapsed(auraData.id, "condition", { reference.conditionIndex }) OptionsPrivate.ClearOptions(auraData.id) end WeakAuras.ClearAndUpdateOptions(data.id) - return; + return else - tremove(conditions, i); + tremove(conditions, i) fixUpLinkedInFirstCondition(conditions) - WeakAuras.Add(data); - OptionsPrivate.RemoveCollapsed(data.id, "condition", {i}) + WeakAuras.Add(data) + OptionsPrivate.RemoveCollapsed(data.id, "condition", { i }) WeakAuras.ClearAndUpdateOptions(data.id) - return; + return end end, width = 0.15, image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\delete", imageWidth = 24, imageHeight = 24, - control = "WeakAurasIcon" - }; - order = order + 1; + control = "WeakAurasIcon", + } + order = order + 1 if collapsed then - return order; + return order end - order = addControlsForIfLine(args, order, data, conditionVariable, totalAuraCount, conditions, i, {}, conditionTemplates, conditionTemplateWithoutCombinations, allProperties); + order = addControlsForIfLine(args, order, data, conditionVariable, totalAuraCount, conditions, i, {}, conditionTemplates, conditionTemplateWithoutCombinations, allProperties) -- Add Property changes - local usedProperties = {}; + local usedProperties = {} for j = 1, conditions[i].changes and #conditions[i].changes or 0 do - local property = conditions[i].changes[j].property; - if (property) then - usedProperties[property] = true; + local property = conditions[i].changes[j].property + if property then + usedProperties[property] = true end end for j = 1, conditions[i].changes and #conditions[i].changes or 0 do - order = addControlsForChange(args, order, data, conditionVariable, totalAuraCount, conditions, i, j, allProperties, usedProperties); + order = addControlsForChange(args, order, data, conditionVariable, totalAuraCount, conditions, i, j, allProperties, usedProperties) end args["condition" .. i .. "_addChange"] = { @@ -2190,35 +2256,35 @@ local function addControlsForCondition(args, order, data, conditionVariable, tot name = L["Add Property Change"], order = order, func = function() - if (data.controlledChildren) then + if data.controlledChildren then for id, reference in pairs(conditions[i].check.references) do - local auradata = WeakAuras.GetData(id); + local auradata = WeakAuras.GetData(id) auradata[conditionVariable][reference.conditionIndex].changes = auradata[conditionVariable][reference.conditionIndex].changes or {} tinsert(auradata[conditionVariable][reference.conditionIndex].changes, {}) - WeakAuras.Add(auradata); + WeakAuras.Add(auradata) OptionsPrivate.ClearOptions(auradata.id) end WeakAuras.ClearAndUpdateOptions(data.id) else - conditions[i].changes = conditions[i].changes or {}; - conditions[i].changes[#conditions[i].changes + 1] = {}; - WeakAuras.Add(data); + conditions[i].changes = conditions[i].changes or {} + conditions[i].changes[#conditions[i].changes + 1] = {} + WeakAuras.Add(data) WeakAuras.ClearAndUpdateOptions(data.id) end - end + end, } - order = order + 1; + order = order + 1 local showElseIf = false local isLinked = false - if (data.controlledChildren) then + if data.controlledChildren then for id, reference in pairs(conditions[i].check.references) do if reference.conditionIndex > 1 then - local auradata = WeakAuras.GetData(id); + local auradata = WeakAuras.GetData(id) isLinked = auradata[conditionVariable][reference.conditionIndex].linked showElseIf = true - break; + break end end else @@ -2238,45 +2304,45 @@ local function addControlsForCondition(args, order, data, conditionVariable, tot return isLinked end, set = function() - if (data.controlledChildren) then + if data.controlledChildren then for id, reference in pairs(conditions[i].check.references) do - local auradata = WeakAuras.GetData(id); + local auradata = WeakAuras.GetData(id) if reference.conditionIndex > 1 then auradata[conditionVariable][reference.conditionIndex].linked = not isLinked - WeakAuras.Add(auradata); + WeakAuras.Add(auradata) OptionsPrivate.ClearOptions(auradata.id) end end WeakAuras.ClearAndUpdateOptions(data.id) else conditions[i].linked = not isLinked - WeakAuras.Add(data); + WeakAuras.Add(data) WeakAuras.ClearAndUpdateOptions(data.id) end - end + end, } - order = order + 1; + order = order + 1 else order = addSpace(args, order) end - return order; + return order end local function mergeConditionTemplates(allConditionTemplates, auraConditionsTemplate, numTriggers) for triggernum = 1, numTriggers do - local auraTemplatesForTrigger = auraConditionsTemplate[triggernum]; - if (auraTemplatesForTrigger) then - allConditionTemplates[triggernum] = allConditionTemplates[triggernum] or {}; + local auraTemplatesForTrigger = auraConditionsTemplate[triggernum] + if auraTemplatesForTrigger then + allConditionTemplates[triggernum] = allConditionTemplates[triggernum] or {} for conditionName in pairs(auraTemplatesForTrigger) do if not allConditionTemplates[triggernum][conditionName] then - allConditionTemplates[triggernum][conditionName] = CopyTable(auraTemplatesForTrigger[conditionName]); + allConditionTemplates[triggernum][conditionName] = CopyTable(auraTemplatesForTrigger[conditionName]) else - if (allConditionTemplates[triggernum][conditionName].type ~= auraTemplatesForTrigger[conditionName].type) then + if allConditionTemplates[triggernum][conditionName].type ~= auraTemplatesForTrigger[conditionName].type then -- Two different trigger types have a condition of the same name, with incompatible types -- Setting the type to incompatible prevents the interface from showing options for it -- This can't currently happen - allConditionTemplates[triggernum][conditionName].type = "incompatible"; + allConditionTemplates[triggernum][conditionName].type = "incompatible" end end end @@ -2285,57 +2351,57 @@ local function mergeConditionTemplates(allConditionTemplates, auraConditionsTemp end local function createConditionTemplatesValueList(allConditionTemplates, numTriggers, excludeCombinations) - local conditionTemplates = {}; - conditionTemplates.all = allConditionTemplates; - conditionTemplates.indexToTrigger = {}; - conditionTemplates.indexToVariable = {}; - conditionTemplates.conditionToIndex = {}; - conditionTemplates.display = {}; - - local index = 1; - local startTriggernum = excludeCombinations and -1 or -2; + local conditionTemplates = {} + conditionTemplates.all = allConditionTemplates + conditionTemplates.indexToTrigger = {} + conditionTemplates.indexToVariable = {} + conditionTemplates.conditionToIndex = {} + conditionTemplates.display = {} + + local index = 1 + local startTriggernum = excludeCombinations and -1 or -2 for triggernum = startTriggernum, numTriggers do - local templatesForTrigger = allConditionTemplates[triggernum]; + local templatesForTrigger = allConditionTemplates[triggernum] if triggernum ~= 0 then -- Sort Conditions for one trigger - local sorted = {}; - if (templatesForTrigger) then + local sorted = {} + if templatesForTrigger then for conditionName in pairs(templatesForTrigger) do - tinsert(sorted, conditionName); + tinsert(sorted, conditionName) end table.sort(sorted, function(a, b) - return templatesForTrigger[a].display < templatesForTrigger[b].display; - end); + return templatesForTrigger[a].display < templatesForTrigger[b].display + end) - if (#sorted > 0) then - if (triggernum == -2) then + if #sorted > 0 then + if triggernum == -2 then -- Do Nothing - conditionTemplates.display[index] = string.format(L["Combinations"]); - elseif (triggernum == -1) then - conditionTemplates.display[index] = string.format(L["Global Conditions"]); + conditionTemplates.display[index] = string.format(L["Combinations"]) + elseif triggernum == -1 then + conditionTemplates.display[index] = string.format(L["Global Conditions"]) else - conditionTemplates.display[index] = string.format(L["Trigger %d"], triggernum); + conditionTemplates.display[index] = string.format(L["Trigger %d"], triggernum) end - index = index + 1; + index = index + 1 for _, conditionName in ipairs(sorted) do - conditionTemplates.display[index] = " " .. templatesForTrigger[conditionName].display; - conditionTemplates.indexToTrigger[index] = triggernum; - conditionTemplates.indexToVariable[index] = conditionName; - conditionTemplates.conditionToIndex[triggernum .. "-" .. conditionName] = index; - index = index + 1; + conditionTemplates.display[index] = " " .. templatesForTrigger[conditionName].display + conditionTemplates.indexToTrigger[index] = triggernum + conditionTemplates.indexToVariable[index] = conditionName + conditionTemplates.conditionToIndex[triggernum .. "-" .. conditionName] = index + index = index + 1 end end end end end - conditionTemplates.displayWithRemove = CopyTable(conditionTemplates.display); - conditionTemplates.displayWithRemove[9997] = "•" .. L["Remove"] .. "•"; - conditionTemplates.indexToTrigger[9997] = "REMOVE"; - conditionTemplates.indexToVariable[9997] = "REMOVE"; + conditionTemplates.displayWithRemove = CopyTable(conditionTemplates.display) + conditionTemplates.displayWithRemove[9997] = "•" .. L["Remove"] .. "•" + conditionTemplates.indexToTrigger[9997] = "REMOVE" + conditionTemplates.indexToVariable[9997] = "REMOVE" - return conditionTemplates; + return conditionTemplates end local function createConditionTemplates(data) @@ -2346,67 +2412,67 @@ local function createConditionTemplates(data) -- And two auxillary data structures which map to the index from triggernum/conditionvalue -- And from the index to triggernum/conditionvalue - local allConditionTemplates; - local numTriggers = 0; - if (data.controlledChildren) then - allConditionTemplates = {}; + local allConditionTemplates + local numTriggers = 0 + if data.controlledChildren then + allConditionTemplates = {} for child in OptionsPrivate.Private.TraverseLeafs(data) do - numTriggers = max(numTriggers, #child.triggers); + numTriggers = max(numTriggers, #child.triggers) - local auraConditionsTemplate = OptionsPrivate.Private.GetTriggerConditions(child); + local auraConditionsTemplate = OptionsPrivate.Private.GetTriggerConditions(child) mergeConditionTemplates(allConditionTemplates, auraConditionsTemplate, numTriggers) end else - allConditionTemplates = OptionsPrivate.Private.GetTriggerConditions(data); - numTriggers = #data.triggers; + allConditionTemplates = OptionsPrivate.Private.GetTriggerConditions(data) + numTriggers = #data.triggers end allConditionTemplates[-2] = { ["AND"] = { display = L["All of"], - type = "combination" + type = "combination", }, ["OR"] = { display = L["Any of"], - type = "combination" - } + type = "combination", + }, } - allConditionTemplates[-1] = OptionsPrivate.Private.GetGlobalConditions(); + allConditionTemplates[-1] = OptionsPrivate.Private.GetGlobalConditions() - local conditionTemplates = createConditionTemplatesValueList(allConditionTemplates, numTriggers); + local conditionTemplates = createConditionTemplatesValueList(allConditionTemplates, numTriggers) - if (data.controlledChildren) then - conditionTemplates.displayWithCopy = CopyTable(conditionTemplates.display); + if data.controlledChildren then + conditionTemplates.displayWithCopy = CopyTable(conditionTemplates.display) - conditionTemplates.displayWithCopy[9998] = "•" .. L["Copy to all auras"] .. "•"; - conditionTemplates.indexToTrigger[9998] = "COPY"; - conditionTemplates.indexToVariable[9998] = "COPY"; + conditionTemplates.displayWithCopy[9998] = "•" .. L["Copy to all auras"] .. "•" + conditionTemplates.indexToTrigger[9998] = "COPY" + conditionTemplates.indexToVariable[9998] = "COPY" end - local conditionTemplateWithoutCombinations = createConditionTemplatesValueList(allConditionTemplates, numTriggers, true); + local conditionTemplateWithoutCombinations = createConditionTemplatesValueList(allConditionTemplates, numTriggers, true) - return conditionTemplates, conditionTemplateWithoutCombinations; + return conditionTemplates, conditionTemplateWithoutCombinations end local function buildAllPotentialProperties(data, category) - local allProperties = {}; - allProperties.propertyMap = {}; + local allProperties = {} + allProperties.propertyMap = {} for child in OptionsPrivate.Private.TraverseLeafsOrAura(data) do - local regionProperties = OptionsPrivate.Private.GetProperties(child); + local regionProperties = OptionsPrivate.Private.GetProperties(child) - if (regionProperties) then + if regionProperties then for k, v in pairs(regionProperties) do - if (v.category == category) then - if (allProperties.propertyMap[k]) then - if (allProperties.propertyMap[k].type ~= v.type) then - allProperties.propertyMap[k].type = "incompatible"; + if v.category == category then + if allProperties.propertyMap[k] then + if allProperties.propertyMap[k].type ~= v.type then + allProperties.propertyMap[k].type = "incompatible" end - if (allProperties.propertyMap[k].type == "list") then + if allProperties.propertyMap[k].type == "list" then -- Merge value lists for key, value in pairs(v.values) do - if (allProperties.propertyMap[k].values[key] == nil) then - allProperties.propertyMap[k].values[key] = value; + if allProperties.propertyMap[k].values[key] == nil then + allProperties.propertyMap[k].values[key] = value end end end @@ -2418,9 +2484,9 @@ local function buildAllPotentialProperties(data, category) end end - allProperties.indexToProperty = {}; + allProperties.indexToProperty = {} for k in pairs(allProperties.propertyMap) do - tinsert(allProperties.indexToProperty, k); + tinsert(allProperties.indexToProperty, k) end table.sort(allProperties.indexToProperty, function(a, b) local av = allProperties.propertyMap[a].display @@ -2429,127 +2495,136 @@ local function buildAllPotentialProperties(data, category) local bv = allProperties.propertyMap[b].display bv = type(bv) == "table" and bv[1] or bv return av < bv - end); + end) - allProperties.propertyToIndex = {}; + allProperties.propertyToIndex = {} for index, property in ipairs(allProperties.indexToProperty) do - allProperties.propertyToIndex[property] = index; + allProperties.propertyToIndex[property] = index end - allProperties.display = {}; + allProperties.display = {} for index, property in ipairs(allProperties.indexToProperty) do - allProperties.display[index] = allProperties.propertyMap[property].display; + allProperties.display[index] = allProperties.propertyMap[property].display end - allProperties.display[9999] = "•" .. L["Remove this property"] .. "•"; - allProperties.indexToProperty[9999] = "DELETE"; + allProperties.display[9999] = "•" .. L["Remove this property"] .. "•" + allProperties.indexToProperty[9999] = "DELETE" - if (data.controlledChildren) then - allProperties.displayWithCopy = CopyTable(allProperties.display); + if data.controlledChildren then + allProperties.displayWithCopy = CopyTable(allProperties.display) - allProperties.displayWithCopy[9998] = "•" .. L["Copy to all auras"] .. "•"; - allProperties.indexToProperty[9998] = "COPY"; + allProperties.displayWithCopy[9998] = "•" .. L["Copy to all auras"] .. "•" + allProperties.indexToProperty[9998] = "COPY" end - return allProperties; + return allProperties end local function compareSubChecks(a, b, allConditionTemplates) - if (a == nil and b == nil) then - return true; + if a == nil and b == nil then + return true end - if (a == nil or b == nil) then - return false; + if a == nil or b == nil then + return false end - if (#a ~= #b) then - return false; + if #a ~= #b then + return false end - local count = #a; + local count = #a for i = 1, count do - if (a[i].trigger ~= b[i].trigger or a[i].variable ~= b[i].variable) then - return false; + if a[i].trigger ~= b[i].trigger or a[i].variable ~= b[i].variable then + return false end - if (a[i].trigger == -2) then - if (not compareSubChecks(a[i].checks, b[i].checks, allConditionTemplates)) then - return false; + if a[i].trigger == -2 then + if not compareSubChecks(a[i].checks, b[i].checks, allConditionTemplates) then + return false end else - local currentConditionTemplate = allConditionTemplates[a[i].trigger] and allConditionTemplates[a[i].trigger][a[i].variable]; - if (not currentConditionTemplate) then - return true; + local currentConditionTemplate = allConditionTemplates[a[i].trigger] and allConditionTemplates[a[i].trigger][a[i].variable] + if not currentConditionTemplate then + return true end - local type = currentConditionTemplate.type; - if (type == "number" or type == "timer" or type == "elapsedTimer" or type == "select" or type == "string" or type == "customcheck") then - if (a[i].op ~= b[i].op or a[i].value ~= b[i].value) then - return false; + local type = currentConditionTemplate.type + if type == "number" or type == "timer" or type == "elapsedTimer" or type == "select" or type == "string" or type == "customcheck" then + if a[i].op ~= b[i].op or a[i].value ~= b[i].value then + return false end - elseif (type == "bool") then - if (a[i].value ~= b[i].value) then - return false; + elseif type == "bool" then + if a[i].value ~= b[i].value then + return false end - elseif (type == "alwaystrue") then + elseif type == "alwaystrue" then return true end end end - return true; + return true end local function findMatchingCondition(all, needle, start, allConditionTemplates) - while (true) do - local condition = all[start]; - if (not condition) then - return nil; + while true do + local condition = all[start] + if not condition then + return nil end - if (condition.check.trigger == needle.check.trigger and condition.check.variable == needle.check.variable - and condition.linked == needle.linked) then + if condition.check.trigger == needle.check.trigger and condition.check.variable == needle.check.variable and condition.linked == needle.linked then if condition.check.variable == "customcheck" then -- Be a bit more strict for custom checks, there's little benefit in merging them if condition.check.op == needle.check.op and condition.check.value == needle.check.value then return start end - elseif (condition.check.trigger == -2) then - if (compareSubChecks(condition.check.checks, needle.check.checks, allConditionTemplates)) then - return start; + elseif condition.check.trigger == -2 then + if compareSubChecks(condition.check.checks, needle.check.checks, allConditionTemplates) then + return start end else - return start; + return start end end - start = start + 1; + start = start + 1 end end local function findMatchingProperty(all, change, id) for index, allChange in ipairs(all) do - if (allChange.property == change.property) then - local alreadyReferenced = allChange.references and allChange.references[id]; - if (not alreadyReferenced) then - return index; + if allChange.property == change.property then + local alreadyReferenced = allChange.references and allChange.references[id] + if not alreadyReferenced then + return index end end end - return nil; + return nil end local function SubPropertiesForChange(change) if change.property == "sound" then - return { "sound", "sound_channel", "sound_path", "sound_kit_id", "sound_repeat", "sound_type"} + return { "sound", "sound_channel", "sound_path", "sound_kit_id", "sound_repeat", "sound_type" } elseif change.property == "customcode" then return { "custom" } elseif change.property == "glowexternal" then return { - "glow_action", "glow_frame_type", "glow_type", - "glow_frame", "choose_glow_frame", - "use_glow_color", "glow_color", - "glow_lines", "glow_frequency", "glow_length", "glow_thickness", "glow_XOffset", "glow_YOffset", - "glow_scale", "glow_border" + "glow_action", + "glow_frame_type", + "glow_type", + "glow_frame", + "choose_glow_frame", + "use_glow_color", + "glow_color", + "glow_lines", + "glow_frequency", + "glow_length", + "glow_thickness", + "glow_XOffset", + "glow_YOffset", + "glow_scale", + "glow_border", } elseif change.property == "chat" then local result = { "message_type", "message_dest", "message_channel", "message_color", "message", "custom", "message_voice" } @@ -2568,20 +2643,20 @@ end local subPropertyToType = { glow_color = "color", - message_color = "color" + message_color = "color", } local function mergeConditionChange(all, change, id, changeIndex, allProperties) local propertyType = all.property and allProperties.propertyMap[all.property] and allProperties.propertyMap[all.property].type - if (propertyType == "chat" or propertyType == "sound" or propertyType == "customcode" or propertyType == "glowexternal") then - if (type(all.value) ~= type(change.value)) then - all.value = nil; - all.samevalue = nil; + if propertyType == "chat" or propertyType == "sound" or propertyType == "customcode" or propertyType == "glowexternal" then + if type(all.value) ~= type(change.value) then + all.value = nil + all.samevalue = nil else - if (type(change.value) ~= "table") then + if type(change.value) ~= "table" then if not compareValues(all.value, change.value, propertyType) then - all.value = nil; - all.samevalue = false; + all.value = nil + all.samevalue = false end else for _, propertyName in ipairs(SubPropertiesForChange(change)) do @@ -2590,9 +2665,9 @@ local function mergeConditionChange(all, change, id, changeIndex, allProperties) all.value[propertyName] = change.value[propertyName] all.samevalue[propertyName] = true elseif not compareValues(all.value[propertyName], change.value[propertyName], subPropertyToType[propertyName]) then - all.value[propertyName] = nil; + all.value[propertyName] = nil if all.samevalue then - all.samevalue[propertyName] = false; + all.samevalue[propertyName] = false end end end @@ -2600,117 +2675,115 @@ local function mergeConditionChange(all, change, id, changeIndex, allProperties) end else if not compareValues(all.value, change.value, propertyType) then - all.value = nil; - all.samevalue = false; + all.value = nil + all.samevalue = false end end - all.references = all.references or {}; + all.references = all.references or {} all.references[id] = { ["changeIndex"] = changeIndex, - ["value"] = change.value - }; - all.referenceCount = (all.referenceCount or 0) + 1; - + ["value"] = change.value, + } + all.referenceCount = (all.referenceCount or 0) + 1 end local function mergeCondition(all, aura, id, conditionIndex, allProperties) - if (all.check.op ~= aura.check.op) then - all.check.op = nil; - all.check.sameop = false; + if all.check.op ~= aura.check.op then + all.check.op = nil + all.check.sameop = false end - if (all.check.value ~= aura.check.value) then - all.check.value = nil; - all.check.samevalue = false; + if all.check.value ~= aura.check.value then + all.check.value = nil + all.check.samevalue = false end - - all.check.references = all.check.references or {}; + all.check.references = all.check.references or {} all.check.references[id] = { ["conditionIndex"] = conditionIndex, ["op"] = aura.check.op, - ["value"] = aura.check.value - }; - all.check.referenceCount = (all.check.referenceCount or 0) + 1; + ["value"] = aura.check.value, + } + all.check.referenceCount = (all.check.referenceCount or 0) + 1 -- Merge properties - local currentInsertPoint = 1; + local currentInsertPoint = 1 for changeIndex, change in ipairs(aura.changes) do - local matchIndex = findMatchingProperty(all.changes, change, id); - if (not matchIndex) then - local copy = CopyTable(change); + local matchIndex = findMatchingProperty(all.changes, change, id) + if not matchIndex then + local copy = CopyTable(change) - local propertyType = change.property and allProperties.propertyMap[change.property] and allProperties.propertyMap[change.property].type; - if (propertyType == "chat" or propertyType == "sound" or propertyType == "customcode" or propertyType == "glowexternal") then - copy.samevalue = {}; + local propertyType = change.property and allProperties.propertyMap[change.property] and allProperties.propertyMap[change.property].type + if propertyType == "chat" or propertyType == "sound" or propertyType == "customcode" or propertyType == "glowexternal" then + copy.samevalue = {} for _, propertyName in ipairs(SubPropertiesForChange(change)) do - copy.samevalue[propertyName] = true; + copy.samevalue[propertyName] = true end else - copy.samevalue = true; + copy.samevalue = true end - copy.references = {}; + copy.references = {} copy.references[id] = { ["changeIndex"] = changeIndex, - ["value"] = copy.value + ["value"] = copy.value, } - copy.referenceCount = 1; - tinsert(all.changes, currentInsertPoint, copy); - currentInsertPoint = currentInsertPoint + 1; + copy.referenceCount = 1 + tinsert(all.changes, currentInsertPoint, copy) + currentInsertPoint = currentInsertPoint + 1 else - mergeConditionChange(all.changes[matchIndex], change, id, changeIndex, allProperties); - currentInsertPoint = matchIndex + 1; + mergeConditionChange(all.changes[matchIndex], change, id, changeIndex, allProperties) + currentInsertPoint = matchIndex + 1 end end end local function mergeConditions(all, aura, id, allConditionTemplates, propertyTypes) - if (not aura) then - return; + if not aura then + return end - local currentInsertPoint = 1; + local currentInsertPoint = 1 for conditionIndex, condition in ipairs(aura) do - local match = findMatchingCondition(all, condition, currentInsertPoint, allConditionTemplates); - if (not match) then - local copy = CopyTable(condition); - copy.check.samevalue = true; - copy.check.sameop = true; - copy.check.references = {}; + local match = findMatchingCondition(all, condition, currentInsertPoint, allConditionTemplates) + if not match then + local copy = CopyTable(condition) + copy.check.samevalue = true + copy.check.sameop = true + copy.check.references = {} copy.check.references[id] = { ["conditionIndex"] = conditionIndex, ["op"] = condition.check.op, - ["value"] = condition.check.value - }; - copy.check.referenceCount = 1; + ["value"] = condition.check.value, + } + copy.check.referenceCount = 1 - if (copy.changes) then + if copy.changes then for changeIndex, change in pairs(copy.changes) do - local propertyType = change.property and propertyTypes.propertyMap[change.property] and propertyTypes.propertyMap[change.property].type; - if (propertyType == "chat" or propertyType == "sound" or propertyType == "customcode" or propertyType == "glowexternal") then - change.samevalue = {}; + local propertyType = change.property and propertyTypes.propertyMap[change.property] and propertyTypes.propertyMap[change.property].type + if propertyType == "chat" or propertyType == "sound" or propertyType == "customcode" or propertyType == "glowexternal" then + change.samevalue = {} for _, propertyName in ipairs(SubPropertiesForChange(change)) do - change.samevalue[propertyName] = true; + change.samevalue[propertyName] = true end else - change.samevalue = true; + change.samevalue = true end - change.references = {}; + change.references = {} change.references[id] = { ["changeIndex"] = changeIndex, - ["value"] = condition.changes[changeIndex].value - }; - change.referenceCount = 1; + ["value"] = condition.changes[changeIndex].value, + } + change.referenceCount = 1 end end - tinsert(all, currentInsertPoint, copy); - currentInsertPoint = currentInsertPoint + 1; + tinsert(all, currentInsertPoint, copy) + currentInsertPoint = currentInsertPoint + 1 else - mergeCondition(all[match], condition, id, conditionIndex, propertyTypes); - currentInsertPoint = match + 1; + mergeCondition(all[match], condition, id, conditionIndex, propertyTypes) + currentInsertPoint = match + 1 end end end @@ -2723,11 +2796,11 @@ local fixupConditions = function(conditions) end function OptionsPrivate.GetConditionOptions(data) - local options = { + local options = { type = "group", name = L["Conditions"], order = 25, - args = {} + args = {}, } local args = options.args @@ -2736,45 +2809,45 @@ function OptionsPrivate.GetConditionOptions(data) local startorder = 0 local category = nil -- Build potential Conditions Templates structure - local conditionTemplates, conditionTemplateWithoutCombinations = createConditionTemplates(data); + local conditionTemplates, conditionTemplateWithoutCombinations = createConditionTemplates(data) -- Build potential properties structure - local allProperties = buildAllPotentialProperties(data, category); + local allProperties = buildAllPotentialProperties(data, category) -- Build currently selected conditions - local conditions; + local conditions local totalAuraCount - if (data.controlledChildren) then + if data.controlledChildren then local allChildren = {} for child in OptionsPrivate.Private.TraverseLeafs(data) do tinsert(allChildren, child) end totalAuraCount = #allChildren - conditions = {}; + conditions = {} for index = totalAuraCount, 1, -1 do local child = allChildren[index] fixupConditions(child[conditionVariable]) - mergeConditions(conditions, child[conditionVariable], child.id, conditionTemplates.all, allProperties); + mergeConditions(conditions, child[conditionVariable], child.id, conditionTemplates.all, allProperties) end else totalAuraCount = 1 - data[conditionVariable] = data[conditionVariable] or {}; - conditions = data[conditionVariable]; + data[conditionVariable] = data[conditionVariable] or {} + conditions = data[conditionVariable] fixupConditions(data[conditionVariable]) end - local order = startorder; + local order = startorder for i = 1, #conditions do - order = addControlsForCondition(args, order, data, conditionVariable, totalAuraCount, conditions, i, conditionTemplates, conditionTemplateWithoutCombinations, allProperties); + order = addControlsForCondition(args, order, data, conditionVariable, totalAuraCount, conditions, i, conditionTemplates, conditionTemplateWithoutCombinations, allProperties) end args["addConditionHeader"] = { type = "header", width = WeakAuras.doubleWidth, name = "", - order = order + order = order, } order = order + 1 @@ -2785,19 +2858,19 @@ function OptionsPrivate.GetConditionOptions(data) order = order, func = function() for child in OptionsPrivate.Private.TraverseLeafsOrAura(data) do - child[conditionVariable][#child[conditionVariable] + 1] = {}; - child[conditionVariable][#child[conditionVariable]].check = {}; - child[conditionVariable][#child[conditionVariable]].changes = {}; + child[conditionVariable][#child[conditionVariable] + 1] = {} + child[conditionVariable][#child[conditionVariable]].check = {} + child[conditionVariable][#child[conditionVariable]].changes = {} child[conditionVariable][#child[conditionVariable]].changes[1] = {} - child[conditionVariable][#child[conditionVariable]].category = category; - OptionsPrivate.SetCollapsed(child.id, "condition", #child[conditionVariable], false); - WeakAuras.Add(child); + child[conditionVariable][#child[conditionVariable]].category = category + OptionsPrivate.SetCollapsed(child.id, "condition", #child[conditionVariable], false) + WeakAuras.Add(child) OptionsPrivate.ClearOptions(child.id) end WeakAuras.ClearAndUpdateOptions(data.id) - end + end, } - order = order + 1; + order = order + 1 - return options; + return options end diff --git a/WeakAurasOptions/DisplayOptions.lua b/WeakAurasOptions/DisplayOptions.lua index 3a4c50bda2..cb53b7d055 100644 --- a/WeakAurasOptions/DisplayOptions.lua +++ b/WeakAurasOptions/DisplayOptions.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... local L = WeakAuras.L local regionOptions = WeakAuras.regionOptions @@ -66,32 +68,32 @@ local function AddOptionsForSupportedSubRegion(regionOption, data, supported) order = order + 1 end end - regionOption["sub"] = result; + regionOption["sub"] = result return hasSubRegions end local function union(table1, table2) - local meta = {}; - for i,v in pairs(table1) do - meta[i] = v; + local meta = {} + for i, v in pairs(table1) do + meta[i] = v end - for i,v in pairs(table2) do - meta[i] = v; + for i, v in pairs(table2) do + meta[i] = v end - return meta; + return meta end function OptionsPrivate.GetDisplayOptions(data) local id = data.id if not data.controlledChildren then - local regionOption; - local commonOption = {}; + local regionOption + local commonOption = {} local hasSubElements = false - if(regionOptions[data.regionType]) then - regionOption = regionOptions[data.regionType].create(id, data); + if regionOptions[data.regionType] then + regionOption = regionOptions[data.regionType].create(id, data) if data.subRegions then local subIndex = {} @@ -131,9 +133,9 @@ function OptionsPrivate.GetDisplayOptions(data) type = "description", name = L["This region of type \"%s\" is not supported."]:format(data.regionType), order = 2, - } - } - }; + }, + }, + } end if hasSubElements then @@ -143,8 +145,8 @@ function OptionsPrivate.GetDisplayOptions(data) header = { type = "header", name = L["Sub Elements"], - order = 1 - } + order = 1, + }, } end @@ -155,36 +157,36 @@ function OptionsPrivate.GetDisplayOptions(data) name = L["Display"], order = 10, get = function(info) - local base, property = parsePrefix(info[#info], data); + local base, property = parsePrefix(info[#info], data) if not base then return nil end - if(info.type == "color") then - base[property] = base[property] or {}; - local c = base[property]; - return c[1], c[2], c[3], c[4]; + if info.type == "color" then + base[property] = base[property] or {} + local c = base[property] + return c[1], c[2], c[3], c[4] else - return base[property]; + return base[property] end end, set = function(info, v, g, b, a) - local base, property = parsePrefix(info[#info], data, true); - if(info.type == "color") then - base[property] = base[property] or {}; - local c = base[property]; - c[1], c[2], c[3], c[4] = v, g, b, a; - elseif(info.type == "toggle") then - base[property] = v; + local base, property = parsePrefix(info[#info], data, true) + if info.type == "color" then + base[property] = base[property] or {} + local c = base[property] + c[1], c[2], c[3], c[4] = v, g, b, a + elseif info.type == "toggle" then + base[property] = v else - base[property] = (v ~= "" and v) or nil; + base[property] = (v ~= "" and v) or nil end - WeakAuras.Add(data); - WeakAuras.UpdateThumbnail(data); + WeakAuras.Add(data) + WeakAuras.UpdateThumbnail(data) OptionsPrivate.Private.AddParents(data) - OptionsPrivate.ResetMoverSizer(); + OptionsPrivate.ResetMoverSizer() end, - args = options - }; + args = options, + } return region else -- Multiple Auras @@ -195,26 +197,26 @@ function OptionsPrivate.GetDisplayOptions(data) local handledRegionTypes = {} local handledSubRegionTypes = {} - local allOptions = {}; - local commonOption = {}; + local allOptions = {} + local commonOption = {} local unsupportedCount = 0 local supportedSubRegions = {} local hasSubElements = false for child in OptionsPrivate.Private.TraverseLeafs(data) do if child and not handledRegionTypes[child.regionType] then - handledRegionTypes[child.regionType] = true; + handledRegionTypes[child.regionType] = true if regionOptions[child.regionType] then - allOptions = union(allOptions, regionOptions[child.regionType].create(id, data)); + allOptions = union(allOptions, regionOptions[child.regionType].create(id, data)) else unsupportedCount = unsupportedCount + 1 - allOptions["__unsupported" .. unsupportedCount] = { + allOptions["__unsupported" .. unsupportedCount] = { __title = "|cFFFFFF00" .. child.regionType, __order = 1, warning = { type = "description", name = L["Regions of type \"%s\" are not supported."]:format(child.regionType), - order = 1 + order = 1, }, } end @@ -262,36 +264,41 @@ function OptionsPrivate.GetDisplayOptions(data) order = 1, type = "header", name = L["Sub Elements"], - } + }, } end - fixMetaOrders(allOptions); + fixMetaOrders(allOptions) local region = { type = "group", name = L["Display"], order = 10, - args = flattenRegionOptions(allOptions, false); - }; + args = flattenRegionOptions(allOptions, false), + } - removeFuncs(region); - replaceNameDescFuncs(region, data, "region"); - replaceImageFuncs(region, data, "region"); - replaceValuesFuncs(region, data, "region"); + removeFuncs(region) + replaceNameDescFuncs(region, data, "region") + replaceImageFuncs(region, data, "region") + replaceValuesFuncs(region, data, "region") - region.get = function(info, ...) return getAll(data, info, ...); end; + region.get = function(info, ...) + return getAll(data, info, ...) + end region.set = function(info, ...) - setAll(data, info, ...); - if(type(data.id) == "string") then - WeakAuras.Add(data); - WeakAuras.UpdateThumbnail(data); - OptionsPrivate.ResetMoverSizer(); + setAll(data, info, ...) + if type(data.id) == "string" then + WeakAuras.Add(data) + WeakAuras.UpdateThumbnail(data) + OptionsPrivate.ResetMoverSizer() end end - region.hidden = function(info, ...) return hiddenAll(data, info, ...); end; - region.disabled = function(info, ...) return disabledAll(data, info, ...); end; + region.hidden = function(info, ...) + return hiddenAll(data, info, ...) + end + region.disabled = function(info, ...) + return disabledAll(data, info, ...) + end return region end - end diff --git a/WeakAurasOptions/ForAllIndentsAndPurposes.lua b/WeakAurasOptions/ForAllIndentsAndPurposes.lua index 10d90ab337..1331c7ac5a 100644 --- a/WeakAurasOptions/ForAllIndentsAndPurposes.lua +++ b/WeakAurasOptions/ForAllIndentsAndPurposes.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end -- For All Indents And Purposes local revision = 23 @@ -27,1258 +29,1260 @@ local revision = 23 -- luacheck: globals IndentationLib if not IndentationLib then - IndentationLib = {} + IndentationLib = {} end if not IndentationLib.revision or revision > IndentationLib.revision then - local lib = IndentationLib - lib.revision = revision - - local stringlen = string.len - local stringformat = string.format - local stringfind = string.find - local stringsub = string.sub - local stringbyte = string.byte - local stringchar = string.char - local stringrep = string.rep - local stringgsub = string.gsub - - local defaultTabWidth = 2 - local defaultColorTable - - local workingTable = {} - local workingTable2 = {} - local function tableclear(t) - for k in next,t do - t[k] = nil - end + local lib = IndentationLib + lib.revision = revision + + local stringlen = string.len + local stringformat = string.format + local stringfind = string.find + local stringsub = string.sub + local stringbyte = string.byte + local stringchar = string.char + local stringrep = string.rep + local stringgsub = string.gsub + + local defaultTabWidth = 2 + local defaultColorTable + + local workingTable = {} + local workingTable2 = {} + local function tableclear(t) + for k in next, t do + t[k] = nil end + end - local function stringinsert(s, pos, insertStr) - return stringsub(s, 1, pos) .. insertStr .. stringsub(s, pos + 1) + local function stringinsert(s, pos, insertStr) + return stringsub(s, 1, pos) .. insertStr .. stringsub(s, pos + 1) + end + lib.stringinsert = stringinsert + + local function stringdelete(s, pos1, pos2) + return stringsub(s, 1, pos1 - 1) .. stringsub(s, pos2 + 1) + end + lib.stringdelete = stringdelete + + -- token types + local tokens = {} + lib.tokens = tokens + tokens.TOKEN_UNKNOWN = 0 + tokens.TOKEN_NUMBER = 1 + tokens.TOKEN_LINEBREAK = 2 + tokens.TOKEN_WHITESPACE = 3 + tokens.TOKEN_IDENTIFIER = 4 + tokens.TOKEN_ASSIGNMENT = 5 + tokens.TOKEN_EQUALITY = 6 + tokens.TOKEN_MINUS = 7 + tokens.TOKEN_COMMENT_SHORT = 8 + tokens.TOKEN_COMMENT_LONG = 9 + tokens.TOKEN_STRING = 10 + tokens.TOKEN_LEFTBRACKET = 11 + tokens.TOKEN_PERIOD = 12 + tokens.TOKEN_DOUBLEPERIOD = 13 + tokens.TOKEN_TRIPLEPERIOD = 14 + tokens.TOKEN_LTE = 15 + tokens.TOKEN_LT = 16 + tokens.TOKEN_GTE = 17 + tokens.TOKEN_GT = 18 + tokens.TOKEN_NOTEQUAL = 19 + tokens.TOKEN_COMMA = 20 + tokens.TOKEN_SEMICOLON = 21 + tokens.TOKEN_COLON = 22 + tokens.TOKEN_LEFTPAREN = 23 + tokens.TOKEN_RIGHTPAREN = 24 + tokens.TOKEN_PLUS = 25 + tokens.TOKEN_SLASH = 27 + tokens.TOKEN_LEFTWING = 28 + tokens.TOKEN_RIGHTWING = 29 + tokens.TOKEN_CIRCUMFLEX = 30 + tokens.TOKEN_ASTERISK = 31 + tokens.TOKEN_RIGHTBRACKET = 32 + tokens.TOKEN_KEYWORD = 33 + tokens.TOKEN_SPECIAL = 34 + tokens.TOKEN_VERTICAL = 35 + tokens.TOKEN_TILDE = 36 + -- WoW specific tokens + tokens.TOKEN_COLORCODE_START = 37 + tokens.TOKEN_COLORCODE_STOP = 38 + -- new as of lua 5.1 + tokens.TOKEN_HASH = 39 + tokens.TOKEN_PERCENT = 40 + + -- ascii codes + local bytes = {} + lib.bytes = bytes + bytes.BYTE_LINEBREAK_UNIX = stringbyte("\n") + bytes.BYTE_LINEBREAK_MAC = stringbyte("\r") + bytes.BYTE_SINGLE_QUOTE = stringbyte("'") + bytes.BYTE_DOUBLE_QUOTE = stringbyte("\"") + bytes.BYTE_0 = stringbyte("0") + bytes.BYTE_9 = stringbyte("9") + bytes.BYTE_PERIOD = stringbyte(".") + bytes.BYTE_SPACE = stringbyte(" ") + bytes.BYTE_TAB = stringbyte("\t") + bytes.BYTE_E = stringbyte("E") + bytes.BYTE_e = stringbyte("e") + bytes.BYTE_MINUS = stringbyte("-") + bytes.BYTE_EQUALS = stringbyte("=") + bytes.BYTE_LEFTBRACKET = stringbyte("[") + bytes.BYTE_RIGHTBRACKET = stringbyte("]") + bytes.BYTE_BACKSLASH = stringbyte("\\") + bytes.BYTE_COMMA = stringbyte(",") + bytes.BYTE_SEMICOLON = stringbyte(";") + bytes.BYTE_COLON = stringbyte(":") + bytes.BYTE_LEFTPAREN = stringbyte("(") + bytes.BYTE_RIGHTPAREN = stringbyte(")") + bytes.BYTE_TILDE = stringbyte("~") + bytes.BYTE_PLUS = stringbyte("+") + bytes.BYTE_SLASH = stringbyte("/") + bytes.BYTE_LEFTWING = stringbyte("{") + bytes.BYTE_RIGHTWING = stringbyte("}") + bytes.BYTE_CIRCUMFLEX = stringbyte("^") + bytes.BYTE_ASTERISK = stringbyte("*") + bytes.BYTE_LESSTHAN = stringbyte("<") + bytes.BYTE_GREATERTHAN = stringbyte(">") + -- WoW specific chars + bytes.BYTE_VERTICAL = stringbyte("|") + bytes.BYTE_r = stringbyte("r") + bytes.BYTE_c = stringbyte("c") + -- new as of lua 5.1 + bytes.BYTE_HASH = stringbyte("#") + bytes.BYTE_PERCENT = stringbyte("%") + + local linebreakCharacters = {} + lib.linebreakCharacters = linebreakCharacters + linebreakCharacters[bytes.BYTE_LINEBREAK_UNIX] = 1 + linebreakCharacters[bytes.BYTE_LINEBREAK_MAC] = 1 + + local whitespaceCharacters = {} + lib.whitespaceCharacters = whitespaceCharacters + whitespaceCharacters[bytes.BYTE_SPACE] = 1 + whitespaceCharacters[bytes.BYTE_TAB] = 1 + + local specialCharacters = {} + lib.specialCharacters = specialCharacters + specialCharacters[bytes.BYTE_PERIOD] = -1 + specialCharacters[bytes.BYTE_LESSTHAN] = -1 + specialCharacters[bytes.BYTE_GREATERTHAN] = -1 + specialCharacters[bytes.BYTE_LEFTBRACKET] = -1 + specialCharacters[bytes.BYTE_EQUALS] = -1 + specialCharacters[bytes.BYTE_MINUS] = -1 + specialCharacters[bytes.BYTE_SINGLE_QUOTE] = -1 + specialCharacters[bytes.BYTE_DOUBLE_QUOTE] = -1 + specialCharacters[bytes.BYTE_TILDE] = -1 + specialCharacters[bytes.BYTE_RIGHTBRACKET] = tokens.TOKEN_RIGHTBRACKET + specialCharacters[bytes.BYTE_COMMA] = tokens.TOKEN_COMMA + specialCharacters[bytes.BYTE_COLON] = tokens.TOKEN_COLON + specialCharacters[bytes.BYTE_SEMICOLON] = tokens.TOKEN_SEMICOLON + specialCharacters[bytes.BYTE_LEFTPAREN] = tokens.TOKEN_LEFTPAREN + specialCharacters[bytes.BYTE_RIGHTPAREN] = tokens.TOKEN_RIGHTPAREN + specialCharacters[bytes.BYTE_PLUS] = tokens.TOKEN_PLUS + specialCharacters[bytes.BYTE_SLASH] = tokens.TOKEN_SLASH + specialCharacters[bytes.BYTE_LEFTWING] = tokens.TOKEN_LEFTWING + specialCharacters[bytes.BYTE_RIGHTWING] = tokens.TOKEN_RIGHTWING + specialCharacters[bytes.BYTE_CIRCUMFLEX] = tokens.TOKEN_CIRCUMFLEX + specialCharacters[bytes.BYTE_ASTERISK] = tokens.TOKEN_ASTERISK + -- WoW specific + specialCharacters[bytes.BYTE_VERTICAL] = -1 + -- new as of lua 5.1 + specialCharacters[bytes.BYTE_HASH] = tokens.TOKEN_HASH + specialCharacters[bytes.BYTE_PERCENT] = tokens.TOKEN_PERCENT + + local function nextNumberExponentPartInt(text, pos) + while true do + local byte = stringbyte(text, pos) + if not byte then + return tokens.TOKEN_NUMBER, pos + end + + if byte >= bytes.BYTE_0 and byte <= bytes.BYTE_9 then + pos = pos + 1 + else + return tokens.TOKEN_NUMBER, pos + end end - lib.stringinsert = stringinsert + end - local function stringdelete(s, pos1, pos2) - return stringsub(s, 1, pos1 - 1) .. stringsub(s, pos2 + 1) + local function nextNumberExponentPart(text, pos) + local byte = stringbyte(text, pos) + if not byte then + return tokens.TOKEN_NUMBER, pos end - lib.stringdelete = stringdelete - - -- token types - local tokens = {} - lib.tokens = tokens - tokens.TOKEN_UNKNOWN = 0 - tokens.TOKEN_NUMBER = 1 - tokens.TOKEN_LINEBREAK = 2 - tokens.TOKEN_WHITESPACE = 3 - tokens.TOKEN_IDENTIFIER = 4 - tokens.TOKEN_ASSIGNMENT = 5 - tokens.TOKEN_EQUALITY = 6 - tokens.TOKEN_MINUS = 7 - tokens.TOKEN_COMMENT_SHORT = 8 - tokens.TOKEN_COMMENT_LONG = 9 - tokens.TOKEN_STRING = 10 - tokens.TOKEN_LEFTBRACKET = 11 - tokens.TOKEN_PERIOD = 12 - tokens.TOKEN_DOUBLEPERIOD = 13 - tokens.TOKEN_TRIPLEPERIOD = 14 - tokens.TOKEN_LTE = 15 - tokens.TOKEN_LT = 16 - tokens.TOKEN_GTE = 17 - tokens.TOKEN_GT = 18 - tokens.TOKEN_NOTEQUAL = 19 - tokens.TOKEN_COMMA = 20 - tokens.TOKEN_SEMICOLON = 21 - tokens.TOKEN_COLON = 22 - tokens.TOKEN_LEFTPAREN = 23 - tokens.TOKEN_RIGHTPAREN = 24 - tokens.TOKEN_PLUS = 25 - tokens.TOKEN_SLASH = 27 - tokens.TOKEN_LEFTWING = 28 - tokens.TOKEN_RIGHTWING = 29 - tokens.TOKEN_CIRCUMFLEX = 30 - tokens.TOKEN_ASTERISK = 31 - tokens.TOKEN_RIGHTBRACKET = 32 - tokens.TOKEN_KEYWORD = 33 - tokens.TOKEN_SPECIAL = 34 - tokens.TOKEN_VERTICAL = 35 - tokens.TOKEN_TILDE = 36 - -- WoW specific tokens - tokens.TOKEN_COLORCODE_START = 37 - tokens.TOKEN_COLORCODE_STOP = 38 - -- new as of lua 5.1 - tokens.TOKEN_HASH = 39 - tokens.TOKEN_PERCENT = 40 - - - -- ascii codes - local bytes = {} - lib.bytes = bytes - bytes.BYTE_LINEBREAK_UNIX = stringbyte("\n") - bytes.BYTE_LINEBREAK_MAC = stringbyte("\r") - bytes.BYTE_SINGLE_QUOTE = stringbyte("'") - bytes.BYTE_DOUBLE_QUOTE = stringbyte('"') - bytes.BYTE_0 = stringbyte("0") - bytes.BYTE_9 = stringbyte("9") - bytes.BYTE_PERIOD = stringbyte(".") - bytes.BYTE_SPACE = stringbyte(" ") - bytes.BYTE_TAB = stringbyte("\t") - bytes.BYTE_E = stringbyte("E") - bytes.BYTE_e = stringbyte("e") - bytes.BYTE_MINUS = stringbyte("-") - bytes.BYTE_EQUALS = stringbyte("=") - bytes.BYTE_LEFTBRACKET = stringbyte("[") - bytes.BYTE_RIGHTBRACKET = stringbyte("]") - bytes.BYTE_BACKSLASH = stringbyte("\\") - bytes.BYTE_COMMA = stringbyte(",") - bytes.BYTE_SEMICOLON = stringbyte(";") - bytes.BYTE_COLON = stringbyte(":") - bytes.BYTE_LEFTPAREN = stringbyte("(") - bytes.BYTE_RIGHTPAREN = stringbyte(")") - bytes.BYTE_TILDE = stringbyte("~") - bytes.BYTE_PLUS = stringbyte("+") - bytes.BYTE_SLASH = stringbyte("/") - bytes.BYTE_LEFTWING = stringbyte("{") - bytes.BYTE_RIGHTWING = stringbyte("}") - bytes.BYTE_CIRCUMFLEX = stringbyte("^") - bytes.BYTE_ASTERISK = stringbyte("*") - bytes.BYTE_LESSTHAN = stringbyte("<") - bytes.BYTE_GREATERTHAN = stringbyte(">") - -- WoW specific chars - bytes.BYTE_VERTICAL = stringbyte("|") - bytes.BYTE_r = stringbyte("r") - bytes.BYTE_c = stringbyte("c") - -- new as of lua 5.1 - bytes.BYTE_HASH = stringbyte("#") - bytes.BYTE_PERCENT = stringbyte("%") - - - local linebreakCharacters = {} - lib.linebreakCharacters = linebreakCharacters - linebreakCharacters[bytes.BYTE_LINEBREAK_UNIX] = 1 - linebreakCharacters[bytes.BYTE_LINEBREAK_MAC] = 1 - - local whitespaceCharacters = {} - lib.whitespaceCharacters = whitespaceCharacters - whitespaceCharacters[bytes.BYTE_SPACE] = 1 - whitespaceCharacters[bytes.BYTE_TAB] = 1 - - local specialCharacters = {} - lib.specialCharacters = specialCharacters - specialCharacters[bytes.BYTE_PERIOD] = -1 - specialCharacters[bytes.BYTE_LESSTHAN] = -1 - specialCharacters[bytes.BYTE_GREATERTHAN] = -1 - specialCharacters[bytes.BYTE_LEFTBRACKET] = -1 - specialCharacters[bytes.BYTE_EQUALS] = -1 - specialCharacters[bytes.BYTE_MINUS] = -1 - specialCharacters[bytes.BYTE_SINGLE_QUOTE] = -1 - specialCharacters[bytes.BYTE_DOUBLE_QUOTE] = -1 - specialCharacters[bytes.BYTE_TILDE] = -1 - specialCharacters[bytes.BYTE_RIGHTBRACKET] = tokens.TOKEN_RIGHTBRACKET - specialCharacters[bytes.BYTE_COMMA] = tokens.TOKEN_COMMA - specialCharacters[bytes.BYTE_COLON] = tokens.TOKEN_COLON - specialCharacters[bytes.BYTE_SEMICOLON] = tokens.TOKEN_SEMICOLON - specialCharacters[bytes.BYTE_LEFTPAREN] = tokens.TOKEN_LEFTPAREN - specialCharacters[bytes.BYTE_RIGHTPAREN] = tokens.TOKEN_RIGHTPAREN - specialCharacters[bytes.BYTE_PLUS] = tokens.TOKEN_PLUS - specialCharacters[bytes.BYTE_SLASH] = tokens.TOKEN_SLASH - specialCharacters[bytes.BYTE_LEFTWING] = tokens.TOKEN_LEFTWING - specialCharacters[bytes.BYTE_RIGHTWING] = tokens.TOKEN_RIGHTWING - specialCharacters[bytes.BYTE_CIRCUMFLEX] = tokens.TOKEN_CIRCUMFLEX - specialCharacters[bytes.BYTE_ASTERISK] = tokens.TOKEN_ASTERISK - -- WoW specific - specialCharacters[bytes.BYTE_VERTICAL] = -1 - -- new as of lua 5.1 - specialCharacters[bytes.BYTE_HASH] = tokens.TOKEN_HASH - specialCharacters[bytes.BYTE_PERCENT] = tokens.TOKEN_PERCENT - - local function nextNumberExponentPartInt(text, pos) - while true do - local byte = stringbyte(text, pos) - if not byte then - return tokens.TOKEN_NUMBER, pos - end - if byte >= bytes.BYTE_0 and byte <= bytes.BYTE_9 then - pos = pos + 1 - else - return tokens.TOKEN_NUMBER, pos - end - end + if byte == bytes.BYTE_MINUS then + -- handle this case: a = 1.2e-- some comment + -- i decide to let 1.2e be parsed as a a number + byte = stringbyte(text, pos + 1) + if byte == bytes.BYTE_MINUS then + return tokens.TOKEN_NUMBER, pos + end + return nextNumberExponentPartInt(text, pos + 1) end - local function nextNumberExponentPart(text, pos) - local byte = stringbyte(text, pos) - if not byte then - return tokens.TOKEN_NUMBER, pos - end + return nextNumberExponentPartInt(text, pos) + end - if byte == bytes.BYTE_MINUS then - -- handle this case: a = 1.2e-- some comment - -- i decide to let 1.2e be parsed as a a number - byte = stringbyte(text, pos + 1) - if byte == bytes.BYTE_MINUS then - return tokens.TOKEN_NUMBER, pos - end - return nextNumberExponentPartInt(text, pos + 1) - end + local function nextNumberFractionPart(text, pos) + while true do + local byte = stringbyte(text, pos) + if not byte then + return tokens.TOKEN_NUMBER, pos + end + + if byte >= bytes.BYTE_0 and byte <= bytes.BYTE_9 then + pos = pos + 1 + elseif byte == bytes.BYTE_E or byte == bytes.BYTE_e then + return nextNumberExponentPart(text, pos + 1) + else + return tokens.TOKEN_NUMBER, pos + end + end + end - return nextNumberExponentPartInt(text, pos) + local function nextNumberIntPart(text, pos) + while true do + local byte = stringbyte(text, pos) + if not byte then + return tokens.TOKEN_NUMBER, pos + end + + if byte >= bytes.BYTE_0 and byte <= bytes.BYTE_9 then + pos = pos + 1 + elseif byte == bytes.BYTE_PERIOD then + return nextNumberFractionPart(text, pos + 1) + elseif byte == bytes.BYTE_E or byte == bytes.BYTE_e then + return nextNumberExponentPart(text, pos + 1) + else + return tokens.TOKEN_NUMBER, pos + end end + end - local function nextNumberFractionPart(text, pos) - while true do - local byte = stringbyte(text, pos) - if not byte then - return tokens.TOKEN_NUMBER, pos - end + local function nextIdentifier(text, pos) + while true do + local byte = stringbyte(text, pos) - if byte >= bytes.BYTE_0 and byte <= bytes.BYTE_9 then - pos = pos + 1 - elseif byte == bytes.BYTE_E or byte == bytes.BYTE_e then - return nextNumberExponentPart(text, pos + 1) - else - return tokens.TOKEN_NUMBER, pos - end - end + if not byte or linebreakCharacters[byte] or whitespaceCharacters[byte] or specialCharacters[byte] then + return tokens.TOKEN_IDENTIFIER, pos + end + pos = pos + 1 end + end - local function nextNumberIntPart(text, pos) - while true do - local byte = stringbyte(text, pos) - if not byte then - return tokens.TOKEN_NUMBER, pos - end + -- returns false or: true, nextPos, equalsCount + local function isBracketStringNext(text, pos) + local byte = stringbyte(text, pos) + if byte == bytes.BYTE_LEFTBRACKET then + local pos2 = pos + 1 + byte = stringbyte(text, pos2) + while byte == bytes.BYTE_EQUALS do + pos2 = pos2 + 1 + byte = stringbyte(text, pos2) + end + if byte == bytes.BYTE_LEFTBRACKET then + return true, pos2 + 1, (pos2 - 1) - pos + else + return false + end + else + return false + end + end - if byte >= bytes.BYTE_0 and byte <= bytes.BYTE_9 then - pos = pos + 1 - elseif byte == bytes.BYTE_PERIOD then - return nextNumberFractionPart(text, pos + 1) - elseif byte == bytes.BYTE_E or byte == bytes.BYTE_e then - return nextNumberExponentPart(text, pos + 1) - else - return tokens.TOKEN_NUMBER, pos - end + -- Already parsed the [==[ part when get here + local function nextBracketString(text, pos, equalsCount) + local state = 0 + while true do + local byte = stringbyte(text, pos) + if not byte then + return tokens.TOKEN_STRING, pos + end + + if byte == bytes.BYTE_RIGHTBRACKET then + if state == 0 then + state = 1 + elseif state == equalsCount + 1 then + return tokens.TOKEN_STRING, pos + 1 + else + state = 0 + end + elseif byte == bytes.BYTE_EQUALS then + if state > 0 then + state = state + 1 end + else + state = 0 + end + pos = pos + 1 end + end - local function nextIdentifier(text, pos) - while true do - local byte = stringbyte(text, pos) + local function nextComment(text, pos) + -- When we get here we have already parsed the "--" + -- Check for long comment + local isBracketString, nextPos, equalsCount = isBracketStringNext(text, pos) + if isBracketString then + local tokenType, nextPos2 = nextBracketString(text, nextPos, equalsCount) + return tokens.TOKEN_COMMENT_LONG, nextPos2 + end - if not byte or - linebreakCharacters[byte] or - whitespaceCharacters[byte] or - specialCharacters[byte] then - return tokens.TOKEN_IDENTIFIER, pos - end - pos = pos + 1 - end + local byte = stringbyte(text, pos) + + -- Short comment, find the first linebreak + while true do + byte = stringbyte(text, pos) + if not byte then + return tokens.TOKEN_COMMENT_SHORT, pos + end + if linebreakCharacters[byte] then + return tokens.TOKEN_COMMENT_SHORT, pos + end + pos = pos + 1 end + end - -- returns false or: true, nextPos, equalsCount - local function isBracketStringNext(text, pos) - local byte = stringbyte(text, pos) - if byte == bytes.BYTE_LEFTBRACKET then - local pos2 = pos + 1 - byte = stringbyte(text, pos2) - while byte == bytes.BYTE_EQUALS do - pos2 = pos2 + 1 - byte = stringbyte(text, pos2) - end - if byte == bytes.BYTE_LEFTBRACKET then - return true, pos2 + 1, (pos2 - 1) - pos - else - return false - end - else - return false + local function nextString(text, pos, character) + local even = true + while true do + local byte = stringbyte(text, pos) + if not byte then + return tokens.TOKEN_STRING, pos + end + + if byte == character then + if even then + return tokens.TOKEN_STRING, pos + 1 end + end + if byte == bytes.BYTE_BACKSLASH then + even = not even + else + even = true + end + + pos = pos + 1 + end + end + + -- INPUT + -- 1: text: text to search in + -- 2: tokenPos: where to start searching + -- OUTPUT + -- 1: token type + -- 2: position after the last character of the token + local function nextToken(text, pos) + local byte = stringbyte(text, pos) + if not byte then + return nil end - -- Already parsed the [==[ part when get here - local function nextBracketString(text, pos, equalsCount) - local state = 0 - while true do - local byte = stringbyte(text, pos) - if not byte then - return tokens.TOKEN_STRING, pos - end + if linebreakCharacters[byte] then + return tokens.TOKEN_LINEBREAK, pos + 1 + end - if byte == bytes.BYTE_RIGHTBRACKET then - if state == 0 then - state = 1 - elseif state == equalsCount + 1 then - return tokens.TOKEN_STRING, pos + 1 - else - state = 0 - end - elseif byte == bytes.BYTE_EQUALS then - if state > 0 then - state = state + 1 - end - else - state = 0 - end - pos = pos + 1 + if whitespaceCharacters[byte] then + while true do + pos = pos + 1 + byte = stringbyte(text, pos) + if not byte or not whitespaceCharacters[byte] then + return tokens.TOKEN_WHITESPACE, pos end + end end - local function nextComment(text, pos) - -- When we get here we have already parsed the "--" - -- Check for long comment - local isBracketString, nextPos, equalsCount = isBracketStringNext(text, pos) - if isBracketString then - local tokenType, nextPos2 = nextBracketString(text, nextPos, equalsCount) - return tokens.TOKEN_COMMENT_LONG, nextPos2 + local token = specialCharacters[byte] + if token then + if token ~= -1 then + return token, pos + 1 + end + + -- WoW specific (for color codes) + if byte == bytes.BYTE_VERTICAL then + byte = stringbyte(text, pos + 1) + if byte == bytes.BYTE_VERTICAL then + return tokens.TOKEN_VERTICAL, pos + 2 end + if byte == bytes.BYTE_c then + return tokens.TOKEN_COLORCODE_START, pos + 10 + end + if byte == bytes.BYTE_r then + return tokens.TOKEN_COLORCODE_STOP, pos + 2 + end + return tokens.TOKEN_UNKNOWN, pos + 1 + end - local byte = stringbyte(text, pos) - - -- Short comment, find the first linebreak - while true do - byte = stringbyte(text, pos) - if not byte then - return tokens.TOKEN_COMMENT_SHORT, pos - end - if linebreakCharacters[byte] then - return tokens.TOKEN_COMMENT_SHORT, pos - end - pos = pos + 1 + if byte == bytes.BYTE_MINUS then + byte = stringbyte(text, pos + 1) + if byte == bytes.BYTE_MINUS then + return nextComment(text, pos + 2) end - end + return tokens.TOKEN_MINUS, pos + 1 + end - local function nextString(text, pos, character) - local even = true - while true do - local byte = stringbyte(text, pos) - if not byte then - return tokens.TOKEN_STRING, pos - end + if byte == bytes.BYTE_SINGLE_QUOTE then + return nextString(text, pos + 1, bytes.BYTE_SINGLE_QUOTE) + end - if byte == character then - if even then - return tokens.TOKEN_STRING, pos + 1 - end - end - if byte == bytes.BYTE_BACKSLASH then - even = not even - else - even = true - end + if byte == bytes.BYTE_DOUBLE_QUOTE then + return nextString(text, pos + 1, bytes.BYTE_DOUBLE_QUOTE) + end - pos = pos + 1 + if byte == bytes.BYTE_LEFTBRACKET then + local isBracketString, nextPos, equalsCount = isBracketStringNext(text, pos) + if isBracketString then + return nextBracketString(text, nextPos, equalsCount) + else + return tokens.TOKEN_LEFTBRACKET, pos + 1 end - end + end - -- INPUT - -- 1: text: text to search in - -- 2: tokenPos: where to start searching - -- OUTPUT - -- 1: token type - -- 2: position after the last character of the token - local function nextToken(text, pos) - local byte = stringbyte(text, pos) + if byte == bytes.BYTE_EQUALS then + byte = stringbyte(text, pos + 1) if not byte then - return nil + return tokens.TOKEN_ASSIGNMENT, pos + 1 + end + if byte == bytes.BYTE_EQUALS then + return tokens.TOKEN_EQUALITY, pos + 2 end + return tokens.TOKEN_ASSIGNMENT, pos + 1 + end - if linebreakCharacters[byte] then - return tokens.TOKEN_LINEBREAK, pos + 1 + if byte == bytes.BYTE_PERIOD then + byte = stringbyte(text, pos + 1) + if not byte then + return tokens.TOKEN_PERIOD, pos + 1 end + if byte == bytes.BYTE_PERIOD then + byte = stringbyte(text, pos + 2) + if byte == bytes.BYTE_PERIOD then + return tokens.TOKEN_TRIPLEPERIOD, pos + 3 + end + return tokens.TOKEN_DOUBLEPERIOD, pos + 2 + elseif byte >= bytes.BYTE_0 and byte <= bytes.BYTE_9 then + return nextNumberFractionPart(text, pos + 2) + end + return tokens.TOKEN_PERIOD, pos + 1 + end - if whitespaceCharacters[byte] then - while true do - pos = pos + 1 - byte = stringbyte(text, pos) - if not byte or not whitespaceCharacters[byte] then - return tokens.TOKEN_WHITESPACE, pos - end - end + if byte == bytes.BYTE_LESSTHAN then + byte = stringbyte(text, pos + 1) + if byte == bytes.BYTE_EQUALS then + return tokens.TOKEN_LTE, pos + 2 end + return tokens.TOKEN_LT, pos + 1 + end - local token = specialCharacters[byte] - if token then - if token ~= -1 then - return token, pos + 1 - end + if byte == bytes.BYTE_GREATERTHAN then + byte = stringbyte(text, pos + 1) + if byte == bytes.BYTE_EQUALS then + return tokens.TOKEN_GTE, pos + 2 + end + return tokens.TOKEN_GT, pos + 1 + end - -- WoW specific (for color codes) - if byte == bytes.BYTE_VERTICAL then - byte = stringbyte(text, pos + 1) - if byte == bytes.BYTE_VERTICAL then - return tokens.TOKEN_VERTICAL, pos + 2 - end - if byte == bytes.BYTE_c then - return tokens.TOKEN_COLORCODE_START, pos + 10 - end - if byte == bytes.BYTE_r then - return tokens.TOKEN_COLORCODE_STOP, pos + 2 - end - return tokens.TOKEN_UNKNOWN, pos + 1 - end + if byte == bytes.BYTE_TILDE then + byte = stringbyte(text, pos + 1) + if byte == bytes.BYTE_EQUALS then + return tokens.TOKEN_NOTEQUAL, pos + 2 + end + return tokens.TOKEN_TILDE, pos + 1 + end + + return tokens.TOKEN_UNKNOWN, pos + 1 + elseif byte >= bytes.BYTE_0 and byte <= bytes.BYTE_9 then + return nextNumberIntPart(text, pos + 1) + else + return nextIdentifier(text, pos + 1) + end + end - if byte == bytes.BYTE_MINUS then - byte = stringbyte(text, pos + 1) - if byte == bytes.BYTE_MINUS then - return nextComment(text, pos + 2) - end - return tokens.TOKEN_MINUS, pos + 1 - end + -- Cool stuff begins here! (indentation and highlighting) + + local noIndentEffect = { 0, 0 } + local indentLeft = { -1, 0 } + local indentRight = { 0, 1 } + local indentBoth = { -1, 1 } + + local keywords = {} + lib.keywords = keywords + keywords["and"] = noIndentEffect + keywords["break"] = noIndentEffect + keywords["false"] = noIndentEffect + keywords["for"] = noIndentEffect + keywords["if"] = noIndentEffect + keywords["in"] = noIndentEffect + keywords["local"] = noIndentEffect + keywords["nil"] = noIndentEffect + keywords["not"] = noIndentEffect + keywords["or"] = noIndentEffect + keywords["return"] = noIndentEffect + keywords["true"] = noIndentEffect + keywords["while"] = noIndentEffect + + keywords["until"] = indentLeft + keywords["elseif"] = indentLeft + keywords["end"] = indentLeft + + keywords["do"] = indentRight + keywords["then"] = indentRight + keywords["repeat"] = indentRight + keywords["function"] = indentRight + + keywords["else"] = indentBoth + + local tokenIndentation = {} + lib.tokenIndentation = tokenIndentation + tokenIndentation[tokens.TOKEN_LEFTPAREN] = indentRight + tokenIndentation[tokens.TOKEN_LEFTBRACKET] = indentRight + tokenIndentation[tokens.TOKEN_LEFTWING] = indentRight + + tokenIndentation[tokens.TOKEN_RIGHTPAREN] = indentLeft + tokenIndentation[tokens.TOKEN_RIGHTBRACKET] = indentLeft + tokenIndentation[tokens.TOKEN_RIGHTWING] = indentLeft + + local function fillWithTabs(n) + return stringrep("\t", n) + end - if byte == bytes.BYTE_SINGLE_QUOTE then - return nextString(text, pos + 1, bytes.BYTE_SINGLE_QUOTE) - end + local function fillWithSpaces(a, b) + return stringrep(" ", a * b) + end - if byte == bytes.BYTE_DOUBLE_QUOTE then - return nextString(text, pos + 1, bytes.BYTE_DOUBLE_QUOTE) - end + function lib.colorCodeCode(code, colorTable, caretPosition) + local stopColor = colorTable and colorTable[0] + if not stopColor then + return code, caretPosition + end - if byte == bytes.BYTE_LEFTBRACKET then - local isBracketString, nextPos, equalsCount = isBracketStringNext(text, pos) - if isBracketString then - return nextBracketString(text, nextPos, equalsCount) - else - return tokens.TOKEN_LEFTBRACKET, pos + 1 - end - end + local stopColorLen = stringlen(stopColor) - if byte == bytes.BYTE_EQUALS then - byte = stringbyte(text, pos + 1) - if not byte then - return tokens.TOKEN_ASSIGNMENT, pos + 1 - end - if byte == bytes.BYTE_EQUALS then - return tokens.TOKEN_EQUALITY, pos + 2 - end - return tokens.TOKEN_ASSIGNMENT, pos + 1 - end + tableclear(workingTable) + local tsize = 0 + local totalLen = 0 - if byte == bytes.BYTE_PERIOD then - byte = stringbyte(text, pos + 1) - if not byte then - return tokens.TOKEN_PERIOD, pos + 1 - end - if byte == bytes.BYTE_PERIOD then - byte = stringbyte(text, pos + 2) - if byte == bytes.BYTE_PERIOD then - return tokens.TOKEN_TRIPLEPERIOD, pos + 3 - end - return tokens.TOKEN_DOUBLEPERIOD, pos + 2 - elseif byte >= bytes.BYTE_0 and byte <= bytes.BYTE_9 then - return nextNumberFractionPart(text, pos + 2) - end - return tokens.TOKEN_PERIOD, pos + 1 - end + local numLines = 0 + local newCaretPosition + local prevTokenWasColored = false + local prevTokenWidth = 0 - if byte == bytes.BYTE_LESSTHAN then - byte = stringbyte(text, pos + 1) - if byte == bytes.BYTE_EQUALS then - return tokens.TOKEN_LTE, pos + 2 - end - return tokens.TOKEN_LT, pos + 1 - end + local pos = 1 + local level = 0 - if byte == bytes.BYTE_GREATERTHAN then - byte = stringbyte(text, pos + 1) - if byte == bytes.BYTE_EQUALS then - return tokens.TOKEN_GTE, pos + 2 - end - return tokens.TOKEN_GT, pos + 1 - end + while true do + if caretPosition and not newCaretPosition and pos >= caretPosition then + if pos == caretPosition then + newCaretPosition = totalLen + else + newCaretPosition = totalLen + local diff = pos - caretPosition + if diff > prevTokenWidth then + diff = prevTokenWidth + end + if prevTokenWasColored then + diff = diff + stopColorLen + end + newCaretPosition = newCaretPosition - diff + end + end + + prevTokenWasColored = false + prevTokenWidth = 0 + + local tokenType, nextPos = nextToken(code, pos) + + if not tokenType then + break + end + + if tokenType == tokens.TOKEN_COLORCODE_START or tokenType == tokens.TOKEN_COLORCODE_STOP or tokenType == tokens.TOKEN_UNKNOWN then + -- ignore color codes + elseif tokenType == tokens.TOKEN_LINEBREAK or tokenType == tokens.TOKEN_WHITESPACE then + if tokenType == tokens.TOKEN_LINEBREAK then + numLines = numLines + 1 + end + local str = stringsub(code, pos, nextPos - 1) + prevTokenWidth = nextPos - pos + + tsize = tsize + 1 + workingTable[tsize] = str + totalLen = totalLen + stringlen(str) + else + local str = stringsub(code, pos, nextPos - 1) + + prevTokenWidth = nextPos - pos - if byte == bytes.BYTE_TILDE then - byte = stringbyte(text, pos + 1) - if byte == bytes.BYTE_EQUALS then - return tokens.TOKEN_NOTEQUAL, pos + 2 - end - return tokens.TOKEN_TILDE, pos + 1 + -- Add coloring + if keywords[str] then + tokenType = tokens.TOKEN_KEYWORD + end + + local color + if stopColor then + color = colorTable[str] + if not color then + color = colorTable[tokenType] + if not color then + if tokenType == tokens.TOKEN_IDENTIFIER then + color = colorTable[tokens.TOKEN_IDENTIFIER] + else + color = colorTable[tokens.TOKEN_SPECIAL] + end end + end + end - return tokens.TOKEN_UNKNOWN, pos + 1 - elseif byte >= bytes.BYTE_0 and byte <= bytes.BYTE_9 then - return nextNumberIntPart(text, pos + 1) + if color then + tsize = tsize + 1 + workingTable[tsize] = color + tsize = tsize + 1 + workingTable[tsize] = str + tsize = tsize + 1 + workingTable[tsize] = stopColor + + totalLen = totalLen + stringlen(color) + (nextPos - pos) + stopColorLen + prevTokenWasColored = true else - return nextIdentifier(text, pos + 1) + tsize = tsize + 1 + workingTable[tsize] = str + + totalLen = totalLen + stringlen(str) end - end + end - -- Cool stuff begins here! (indentation and highlighting) - - local noIndentEffect = {0, 0} - local indentLeft = {-1, 0} - local indentRight = {0, 1} - local indentBoth = {-1, 1} - - local keywords = {} - lib.keywords = keywords - keywords["and"] = noIndentEffect - keywords["break"] = noIndentEffect - keywords["false"] = noIndentEffect - keywords["for"] = noIndentEffect - keywords["if"] = noIndentEffect - keywords["in"] = noIndentEffect - keywords["local"] = noIndentEffect - keywords["nil"] = noIndentEffect - keywords["not"] = noIndentEffect - keywords["or"] = noIndentEffect - keywords["return"] = noIndentEffect - keywords["true"] = noIndentEffect - keywords["while"] = noIndentEffect - - keywords["until"] = indentLeft - keywords["elseif"] = indentLeft - keywords["end"] = indentLeft - - keywords["do"] = indentRight - keywords["then"] = indentRight - keywords["repeat"] = indentRight - keywords["function"] = indentRight - - keywords["else"] = indentBoth - - local tokenIndentation = {} - lib.tokenIndentation = tokenIndentation - tokenIndentation[tokens.TOKEN_LEFTPAREN] = indentRight - tokenIndentation[tokens.TOKEN_LEFTBRACKET] = indentRight - tokenIndentation[tokens.TOKEN_LEFTWING] = indentRight - - tokenIndentation[tokens.TOKEN_RIGHTPAREN] = indentLeft - tokenIndentation[tokens.TOKEN_RIGHTBRACKET] = indentLeft - tokenIndentation[tokens.TOKEN_RIGHTWING] = indentLeft - - local function fillWithTabs(n) - return stringrep("\t", n) + pos = nextPos end + return table.concat(workingTable), newCaretPosition, numLines + end - local function fillWithSpaces(a, b) - return stringrep(" ", a*b) + function lib.indentCode(code, tabWidth, colorTable, caretPosition) + local fillFunction + if tabWidth == nil then + tabWidth = defaultTabWidth + end + if tabWidth then + fillFunction = fillWithSpaces + else + fillFunction = fillWithTabs end - function lib.colorCodeCode(code, colorTable, caretPosition) - local stopColor = colorTable and colorTable[0] - if not stopColor then - return code, caretPosition + tableclear(workingTable) + local tsize = 0 + local totalLen = 0 + + tableclear(workingTable2) + local tsize2 = 0 + local totalLen2 = 0 + + local stopColor = colorTable and colorTable[0] + local stopColorLen = not stopColor or stringlen(stopColor) + + local newCaretPosition + local newCaretPositionFinalized = false + local prevTokenWasColored = false + local prevTokenWidth = 0 + + local pos = 1 + local level = 0 + + local hitNonWhitespace = false + local hitIndentRight = false + local preIndent = 0 + local postIndent = 0 + while true do + if caretPosition and not newCaretPosition and pos >= caretPosition then + if pos == caretPosition then + newCaretPosition = totalLen + totalLen2 + else + newCaretPosition = totalLen + totalLen2 + local diff = pos - caretPosition + if diff > prevTokenWidth then + diff = prevTokenWidth + end + if prevTokenWasColored then + diff = diff + stopColorLen + end + newCaretPosition = newCaretPosition - diff end + end - local stopColorLen = stringlen(stopColor) - - tableclear(workingTable) - local tsize = 0 - local totalLen = 0 - - local numLines = 0 - local newCaretPosition - local prevTokenWasColored = false - local prevTokenWidth = 0 - - local pos = 1 - local level = 0 - - while true do - if caretPosition and not newCaretPosition and pos >= caretPosition then - if pos == caretPosition then - newCaretPosition = totalLen - else - newCaretPosition = totalLen - local diff = pos - caretPosition - if diff > prevTokenWidth then - diff = prevTokenWidth - end - if prevTokenWasColored then - diff = diff + stopColorLen - end - newCaretPosition = newCaretPosition - diff - end - end + prevTokenWasColored = false + prevTokenWidth = 0 - prevTokenWasColored = false - prevTokenWidth = 0 + local tokenType, nextPos = nextToken(code, pos) - local tokenType, nextPos = nextToken(code, pos) + if not tokenType or tokenType == tokens.TOKEN_LINEBREAK then + level = level + preIndent + if level < 0 then + level = 0 + end - if not tokenType then - break - end + local s = fillFunction(level, tabWidth) - if tokenType == tokens.TOKEN_COLORCODE_START or tokenType == tokens.TOKEN_COLORCODE_STOP or tokenType == tokens.TOKEN_UNKNOWN then - -- ignore color codes - elseif tokenType == tokens.TOKEN_LINEBREAK or tokenType == tokens.TOKEN_WHITESPACE then - if tokenType == tokens.TOKEN_LINEBREAK then - numLines = numLines + 1 - end - local str = stringsub(code, pos, nextPos - 1) - prevTokenWidth = nextPos - pos - - tsize = tsize + 1 - workingTable[tsize] = str - totalLen = totalLen + stringlen(str) - else - local str = stringsub(code, pos, nextPos - 1) - - prevTokenWidth = nextPos - pos - - -- Add coloring - if keywords[str] then - tokenType = tokens.TOKEN_KEYWORD - end - - local color - if stopColor then - color = colorTable[str] - if not color then - color = colorTable[tokenType] - if not color then - if tokenType == tokens.TOKEN_IDENTIFIER then - color = colorTable[tokens.TOKEN_IDENTIFIER] - else - color = colorTable[tokens.TOKEN_SPECIAL] - end - end - end - end - - if color then - tsize = tsize + 1 - workingTable[tsize] = color - tsize = tsize + 1 - workingTable[tsize] = str - tsize = tsize + 1 - workingTable[tsize] = stopColor - - totalLen = totalLen + stringlen(color) + (nextPos - pos) + stopColorLen - prevTokenWasColored = true - else - tsize = tsize + 1 - workingTable[tsize] = str - - totalLen = totalLen + stringlen(str) - end - end + tsize = tsize + 1 + workingTable[tsize] = s + totalLen = totalLen + stringlen(s) - pos = nextPos + if newCaretPosition and not newCaretPositionFinalized then + newCaretPosition = newCaretPosition + stringlen(s) + newCaretPositionFinalized = true end - return table.concat(workingTable), newCaretPosition, numLines - end - function lib.indentCode(code, tabWidth, colorTable, caretPosition) - local fillFunction - if tabWidth == nil then - tabWidth = defaultTabWidth + for k, v in next, workingTable2 do + tsize = tsize + 1 + workingTable[tsize] = v + totalLen = totalLen + stringlen(v) end - if tabWidth then - fillFunction = fillWithSpaces - else - fillFunction = fillWithTabs + + if not tokenType then + break end - tableclear(workingTable) - local tsize = 0 - local totalLen = 0 + tsize = tsize + 1 + workingTable[tsize] = stringsub(code, pos, nextPos - 1) + totalLen = totalLen + nextPos - pos + + level = level + postIndent + if level < 0 then + level = 0 + end tableclear(workingTable2) - local tsize2 = 0 - local totalLen2 = 0 - - local stopColor = colorTable and colorTable[0] - local stopColorLen = not stopColor or stringlen(stopColor) - - local newCaretPosition - local newCaretPositionFinalized = false - local prevTokenWasColored = false - local prevTokenWidth = 0 - - local pos = 1 - local level = 0 - - local hitNonWhitespace = false - local hitIndentRight = false - local preIndent = 0 - local postIndent = 0 - while true do - if caretPosition and not newCaretPosition and pos >= caretPosition then - if pos == caretPosition then - newCaretPosition = totalLen + totalLen2 - else - newCaretPosition = totalLen + totalLen2 - local diff = pos - caretPosition - if diff > prevTokenWidth then - diff = prevTokenWidth - end - if prevTokenWasColored then - diff = diff + stopColorLen - end - newCaretPosition = newCaretPosition - diff - end - end + tsize2 = 0 + totalLen2 = 0 + + hitNonWhitespace = false + hitIndentRight = false + preIndent = 0 + postIndent = 0 + elseif tokenType == tokens.TOKEN_WHITESPACE then + if hitNonWhitespace then + prevTokenWidth = nextPos - pos + tsize2 = tsize2 + 1 + local s = stringsub(code, pos, nextPos - 1) + workingTable2[tsize2] = s + totalLen2 = totalLen2 + stringlen(s) + end + elseif tokenType == tokens.TOKEN_COLORCODE_START or tokenType == tokens.TOKEN_COLORCODE_STOP or tokenType == tokens.TOKEN_UNKNOWN then + -- skip these, though they shouldn't be encountered here anyway + else + hitNonWhitespace = true + local str = stringsub(code, pos, nextPos - 1) + prevTokenWidth = nextPos - pos + + -- See if this is an indent-modifier + local indentTable + if tokenType == tokens.TOKEN_IDENTIFIER then + indentTable = keywords[str] + else + indentTable = lib.tokenIndentation[tokenType] + end - prevTokenWasColored = false - prevTokenWidth = 0 - - local tokenType, nextPos = nextToken(code, pos) - - if not tokenType or tokenType == tokens.TOKEN_LINEBREAK then - level = level + preIndent - if level < 0 then level = 0 end - - local s = fillFunction(level, tabWidth) - - tsize = tsize + 1 - workingTable[tsize] = s - totalLen = totalLen + stringlen(s) - - if newCaretPosition and not newCaretPositionFinalized then - newCaretPosition = newCaretPosition + stringlen(s) - newCaretPositionFinalized = true - end - - for k, v in next,workingTable2 do - tsize = tsize + 1 - workingTable[tsize] = v - totalLen = totalLen + stringlen(v) - end - - if not tokenType then - break - end - - tsize = tsize + 1 - workingTable[tsize] = stringsub(code, pos, nextPos - 1) - totalLen = totalLen + nextPos - pos - - level = level + postIndent - if level < 0 then level = 0 end - - tableclear(workingTable2) - tsize2 = 0 - totalLen2 = 0 - - hitNonWhitespace = false - hitIndentRight = false - preIndent = 0 - postIndent = 0 - elseif tokenType == tokens.TOKEN_WHITESPACE then - if hitNonWhitespace then - prevTokenWidth = nextPos - pos - tsize2 = tsize2 + 1 - local s = stringsub(code, pos, nextPos - 1) - workingTable2[tsize2] = s - totalLen2 = totalLen2 + stringlen(s) - end - elseif tokenType == tokens.TOKEN_COLORCODE_START or tokenType == tokens.TOKEN_COLORCODE_STOP or tokenType == tokens.TOKEN_UNKNOWN then - -- skip these, though they shouldn't be encountered here anyway - else - hitNonWhitespace = true - local str = stringsub(code, pos, nextPos - 1) - prevTokenWidth = nextPos - pos - - -- See if this is an indent-modifier - local indentTable - if tokenType == tokens.TOKEN_IDENTIFIER then - indentTable = keywords[str] - else - indentTable = lib.tokenIndentation[tokenType] - end - - if indentTable then - if hitIndentRight then - postIndent = postIndent + indentTable[1] + indentTable[2] - else - local pre = indentTable[1] - local post = indentTable[2] - if post > 0 then - hitIndentRight = true - end - preIndent = preIndent + pre - postIndent = postIndent + post - end - end - - -- Add coloring - if keywords[str] then - tokenType = tokens.TOKEN_KEYWORD - end - - local color - if stopColor then - color = colorTable[str] - if not color then - color = colorTable[tokenType] - if not color then - if tokenType == tokens.TOKEN_IDENTIFIER then - color = colorTable[tokens.TOKEN_IDENTIFIER] - else - color = colorTable[tokens.TOKEN_SPECIAL] - end - end - end - end - - if color then - tsize2 = tsize2 + 1 - workingTable2[tsize2] = color - totalLen2 = totalLen2 + stringlen(color) - - tsize2 = tsize2 + 1 - workingTable2[tsize2] = str - totalLen2 = totalLen2 + nextPos - pos - - tsize2 = tsize2 + 1 - workingTable2[tsize2] = stopColor - totalLen2 = totalLen2 + stopColorLen - - prevTokenWasColored = true - else - tsize2 = tsize2 + 1 - workingTable2[tsize2] = str - totalLen2 = totalLen2 + nextPos - pos - - end + if indentTable then + if hitIndentRight then + postIndent = postIndent + indentTable[1] + indentTable[2] + else + local pre = indentTable[1] + local post = indentTable[2] + if post > 0 then + hitIndentRight = true end - pos = nextPos + preIndent = preIndent + pre + postIndent = postIndent + post + end end - return table.concat(workingTable), newCaretPosition - end - - -- WoW specific code: - local GetTime = GetTime - - local editboxSetText - local editboxGetText - -- Caret code (thanks Tem!) - local function critical_enter(editbox) - local script = editbox:GetScript("OnTextSet") - if script then - editbox:SetScript("OnTextSet", nil) + -- Add coloring + if keywords[str] then + tokenType = tokens.TOKEN_KEYWORD end - return script - end - local function critical_leave(editbox, script) - if script then - editbox:SetScript("OnTextSet", script) + local color + if stopColor then + color = colorTable[str] + if not color then + color = colorTable[tokenType] + if not color then + if tokenType == tokens.TOKEN_IDENTIFIER then + color = colorTable[tokens.TOKEN_IDENTIFIER] + else + color = colorTable[tokens.TOKEN_SPECIAL] + end + end + end end - end - local function setCaretPos_main(editbox, pos) - local text = editboxGetText(editbox) + if color then + tsize2 = tsize2 + 1 + workingTable2[tsize2] = color + totalLen2 = totalLen2 + stringlen(color) + + tsize2 = tsize2 + 1 + workingTable2[tsize2] = str + totalLen2 = totalLen2 + nextPos - pos - if stringlen(text) > 0 then - editboxSetText(editbox, stringinsert(text, pos, "a")) - editbox:HighlightText(pos, pos + 1) - editbox:Insert("\0") + tsize2 = tsize2 + 1 + workingTable2[tsize2] = stopColor + totalLen2 = totalLen2 + stopColorLen + + prevTokenWasColored = true + else + tsize2 = tsize2 + 1 + workingTable2[tsize2] = str + totalLen2 = totalLen2 + nextPos - pos end + end + pos = nextPos end + return table.concat(workingTable), newCaretPosition + end - local function getCaretPos(editbox) - local script = critical_enter(editbox) - - local text = editboxGetText(editbox) - editbox:Insert("") - local pos = stringfind(editboxGetText(editbox), "", 1, 1) - editboxSetText(editbox, text) + -- WoW specific code: + local GetTime = GetTime - if pos then - setCaretPos_main(editbox, pos - 1) - end - critical_leave(editbox, script) + local editboxSetText + local editboxGetText - return (pos or 0) - 1 + -- Caret code (thanks Tem!) + local function critical_enter(editbox) + local script = editbox:GetScript("OnTextSet") + if script then + editbox:SetScript("OnTextSet", nil) end + return script + end - local function setCaretPos(editbox, pos) - local script, script2 = critical_enter(editbox) - setCaretPos_main(editbox, pos) - critical_leave(editbox, script, script2) + local function critical_leave(editbox, script) + if script then + editbox:SetScript("OnTextSet", script) end - -- end of caret code + end + + local function setCaretPos_main(editbox, pos) + local text = editboxGetText(editbox) - function lib.stripWowColors(code) + if stringlen(text) > 0 then + editboxSetText(editbox, stringinsert(text, pos, "a")) + editbox:HighlightText(pos, pos + 1) + editbox:Insert("\0") + end + end - -- HACK! - -- This is a fix for a bug, where an unfinished string causes a lot of newlines to be created. - -- The reason for the bug, is that a |r\n\n gets converted to \n\n|r after the next indent-run - -- The fix is to remove those last two linebreaks when stripping - code = stringgsub(code, "|r\n\n$", "|r") + local function getCaretPos(editbox) + local script = critical_enter(editbox) - tableclear(workingTable) - local tsize = 0 + local text = editboxGetText(editbox) + editbox:Insert("") + local pos = stringfind(editboxGetText(editbox), "", 1, 1) + editboxSetText(editbox, text) - local pos = 1 + if pos then + setCaretPos_main(editbox, pos - 1) + end + critical_leave(editbox, script) - local prevVertical = false - local even = true - local selectionStart = 1 + return (pos or 0) - 1 + end - while true do - local byte = stringbyte(code, pos) - if not byte then - break + local function setCaretPos(editbox, pos) + local script, script2 = critical_enter(editbox) + setCaretPos_main(editbox, pos) + critical_leave(editbox, script, script2) + end + -- end of caret code + + function lib.stripWowColors(code) + -- HACK! + -- This is a fix for a bug, where an unfinished string causes a lot of newlines to be created. + -- The reason for the bug, is that a |r\n\n gets converted to \n\n|r after the next indent-run + -- The fix is to remove those last two linebreaks when stripping + code = stringgsub(code, "|r\n\n$", "|r") + + tableclear(workingTable) + local tsize = 0 + + local pos = 1 + + local prevVertical = false + local even = true + local selectionStart = 1 + + while true do + local byte = stringbyte(code, pos) + if not byte then + break + end + if byte == bytes.BYTE_VERTICAL then + even = not even + prevVertical = true + else + if prevVertical and not even then + if byte == bytes.BYTE_c then + if pos - 2 >= selectionStart then + tsize = tsize + 1 + workingTable[tsize] = stringsub(code, selectionStart, pos - 2) end - if byte == bytes.BYTE_VERTICAL then - even = not even - prevVertical = true - else - if prevVertical and not even then - if byte == bytes.BYTE_c then - - if pos - 2 >= selectionStart then - tsize = tsize + 1 - workingTable[tsize] = stringsub(code, selectionStart, pos - 2) - end - - pos = pos + 8 - selectionStart = pos + 1 - elseif byte == bytes.BYTE_r then - - if pos - 2 >= selectionStart then - tsize = tsize + 1 - workingTable[tsize] = stringsub(code, selectionStart, pos - 2) - end - selectionStart = pos + 1 - end - end - prevVertical = false - even = true + + pos = pos + 8 + selectionStart = pos + 1 + elseif byte == bytes.BYTE_r then + if pos - 2 >= selectionStart then + tsize = tsize + 1 + workingTable[tsize] = stringsub(code, selectionStart, pos - 2) end - pos = pos + 1 - end - if pos >= selectionStart then - tsize = tsize + 1 - workingTable[tsize] = stringsub(code, selectionStart, pos - 1) + selectionStart = pos + 1 + end end - return table.concat(workingTable) + prevVertical = false + even = true + end + pos = pos + 1 end - - function lib.decode(code) - if code then - code = lib.stripWowColors(code) - code = stringgsub(code, "||", "|") - end - return code or "" + if pos >= selectionStart then + tsize = tsize + 1 + workingTable[tsize] = stringsub(code, selectionStart, pos - 1) end + return table.concat(workingTable) + end - function lib.encode(code) - if code then - code = stringgsub(code, "|", "||") - end - return code or "" + function lib.decode(code) + if code then + code = lib.stripWowColors(code) + code = stringgsub(code, "||", "|") end + return code or "" + end - function lib.stripWowColorsWithPos(code, pos) - code = stringinsert(code, pos, "\2") - code = lib.stripWowColors(code) - pos = stringfind(code, "\2", 1, 1) - code = stringdelete(code, pos, pos) - return code, pos + function lib.encode(code) + if code then + code = stringgsub(code, "|", "||") end + return code or "" + end - -- returns the padded code, and true if modified, false if unmodified - local linebreak = stringbyte("\n") - function lib.padWithLinebreaks(code) - local len = stringlen(code) - local linebreakcount = 0 - while len > 0 and linebreakcount < 2 do - local b = stringbyte(code, len) - if b == linebreak then - linebreakcount = linebreakcount + 1 - elseif whitespaceCharacters[b] then - -- Ignore whitespace characters - else - break - end - len = len - 1 - end + function lib.stripWowColorsWithPos(code, pos) + code = stringinsert(code, pos, "\2") + code = lib.stripWowColors(code) + pos = stringfind(code, "\2", 1, 1) + code = stringdelete(code, pos, pos) + return code, pos + end - if linebreakcount == 0 then - return code .. "\n\n", true - elseif linebreakcount == 1 then - return code .. "\n", true - else - return code, false - end + -- returns the padded code, and true if modified, false if unmodified + local linebreak = stringbyte("\n") + function lib.padWithLinebreaks(code) + local len = stringlen(code) + local linebreakcount = 0 + while len > 0 and linebreakcount < 2 do + local b = stringbyte(code, len) + if b == linebreak then + linebreakcount = linebreakcount + 1 + elseif whitespaceCharacters[b] then + -- Ignore whitespace characters + else + break + end + len = len - 1 end - -- Data tables - -- No weak table magic, since editboxes can never be removed in WoW - local enabled = {} - local dirty = {} + if linebreakcount == 0 then + return code .. "\n\n", true + elseif linebreakcount == 1 then + return code .. "\n", true + else + return code, false + end + end - local editboxIndentCache = {} - local decodeCache = {} - local editboxStringCache = {} - local editboxNumLinesCache = {} + -- Data tables + -- No weak table magic, since editboxes can never be removed in WoW + local enabled = {} + local dirty = {} - function lib.colorCodeEditbox(editbox) - dirty[editbox] = nil + local editboxIndentCache = {} + local decodeCache = {} + local editboxStringCache = {} + local editboxNumLinesCache = {} - local colorTable = editbox.faiap_colorTable or defaultColorTable - local tabWidth = editbox.faiap_tabWidth + function lib.colorCodeEditbox(editbox) + dirty[editbox] = nil - local orgCode = editboxGetText(editbox) - local prevCode = editboxStringCache[editbox] - if prevCode == orgCode then - return - end + local colorTable = editbox.faiap_colorTable or defaultColorTable + local tabWidth = editbox.faiap_tabWidth - local pos = getCaretPos(editbox) + local orgCode = editboxGetText(editbox) + local prevCode = editboxStringCache[editbox] + if prevCode == orgCode then + return + end - local code - code, pos = lib.stripWowColorsWithPos(orgCode, pos) + local pos = getCaretPos(editbox) - colorTable[0] = "|r" + local code + code, pos = lib.stripWowColorsWithPos(orgCode, pos) - local newCode, newPos, numLines = lib.colorCodeCode(code, colorTable, pos) - newCode = lib.padWithLinebreaks(newCode) + colorTable[0] = "|r" - editboxStringCache[editbox] = newCode - if orgCode ~= newCode then - local script, script2 = critical_enter(editbox) - decodeCache[editbox] = nil - local stringlenNewCode = stringlen(newCode) + local newCode, newPos, numLines = lib.colorCodeCode(code, colorTable, pos) + newCode = lib.padWithLinebreaks(newCode) - editboxSetText(editbox, newCode) - if newPos then - if newPos < 0 then newPos = 0 end - if newPos > stringlenNewCode then newPos = stringlenNewCode end + editboxStringCache[editbox] = newCode + if orgCode ~= newCode then + local script, script2 = critical_enter(editbox) + decodeCache[editbox] = nil + local stringlenNewCode = stringlen(newCode) - setCaretPos(editbox, newPos) - end - critical_leave(editbox, script, script2) + editboxSetText(editbox, newCode) + if newPos then + if newPos < 0 then + newPos = 0 end - - if editboxNumLinesCache[editbox] ~= numLines then - lib.indentEditbox(editbox) + if newPos > stringlenNewCode then + newPos = stringlenNewCode end - editboxNumLinesCache[editbox] = numLines + + setCaretPos(editbox, newPos) + end + critical_leave(editbox, script, script2) end - function lib.indentEditbox(editbox) - dirty[editbox] = nil + if editboxNumLinesCache[editbox] ~= numLines then + lib.indentEditbox(editbox) + end + editboxNumLinesCache[editbox] = numLines + end - local colorTable = editbox.faiap_colorTable or defaultColorTable - local tabWidth = editbox.faiap_tabWidth + function lib.indentEditbox(editbox) + dirty[editbox] = nil - local orgCode = editboxGetText(editbox) - local prevCode = editboxIndentCache[editbox] - if prevCode == orgCode then - return - end + local colorTable = editbox.faiap_colorTable or defaultColorTable + local tabWidth = editbox.faiap_tabWidth - local pos = getCaretPos(editbox) + local orgCode = editboxGetText(editbox) + local prevCode = editboxIndentCache[editbox] + if prevCode == orgCode then + return + end - local code - code, pos = lib.stripWowColorsWithPos(orgCode, pos) + local pos = getCaretPos(editbox) - colorTable[0] = "|r" - local newCode, newPos = lib.indentCode(code, tabWidth, colorTable, pos) - newCode = lib.padWithLinebreaks(newCode) - editboxIndentCache[editbox] = newCode - if code ~= newCode then - local script, script2 = critical_enter(editbox) - decodeCache[editbox] = nil + local code + code, pos = lib.stripWowColorsWithPos(orgCode, pos) - local stringlenNewCode = stringlen(newCode) + colorTable[0] = "|r" + local newCode, newPos = lib.indentCode(code, tabWidth, colorTable, pos) + newCode = lib.padWithLinebreaks(newCode) + editboxIndentCache[editbox] = newCode + if code ~= newCode then + local script, script2 = critical_enter(editbox) + decodeCache[editbox] = nil - editboxSetText(editbox, newCode) + local stringlenNewCode = stringlen(newCode) - if newPos then - if newPos < 0 then newPos = 0 end - if newPos > stringlenNewCode then newPos = stringlenNewCode end + editboxSetText(editbox, newCode) - setCaretPos(editbox, newPos) - end - critical_leave(editbox, script, script2) + if newPos then + if newPos < 0 then + newPos = 0 end - end - - local function hookHandler(editbox, handler, newFun) - local oldFun = editbox:GetScript(handler) - if oldFun == newFun then - -- already hooked, ignore it - return + if newPos > stringlenNewCode then + newPos = stringlenNewCode end - editbox["faiap_old_" .. handler] = oldFun - editbox:SetScript(handler, newFun) - end - local function textChangedHook(editbox, ...) - local oldFun = editbox["faiap_old_OnTextChanged"] - if oldFun then - oldFun(editbox, ...) - end - if enabled[editbox] and not editbox:IsInIMECompositionMode() then - dirty[editbox] = GetTime() - end + setCaretPos(editbox, newPos) + end + critical_leave(editbox, script, script2) end + end - local function tabPressedHook(editbox, ...) - local oldFun = editbox["faiap_old_OnTabPressed"] - if oldFun then - oldFun(editbox, ...) - end - if enabled[editbox] then - return lib.indentEditbox(editbox) - end + local function hookHandler(editbox, handler, newFun) + local oldFun = editbox:GetScript(handler) + if oldFun == newFun then + -- already hooked, ignore it + return end + editbox["faiap_old_" .. handler] = oldFun + editbox:SetScript(handler, newFun) + end - local function onUpdateHook(editbox, ...) - local oldFun = editbox["faiap_old_OnUpdate"] - if oldFun then - oldFun(editbox, ...) - end - if enabled[editbox] and not editbox:IsInIMECompositionMode() then - local now = GetTime() - local lastUpdate = dirty[editbox] or now - if now - lastUpdate > 0.2 then - decodeCache[editbox] = nil - return lib.colorCodeEditbox(editbox) - end - end + local function textChangedHook(editbox, ...) + local oldFun = editbox["faiap_old_OnTextChanged"] + if oldFun then + oldFun(editbox, ...) end + if enabled[editbox] and not editbox:IsInIMECompositionMode() then + dirty[editbox] = GetTime() + end + end - local function newGetText(editbox) - local decoded = decodeCache[editbox] - if not decoded then - decoded = lib.decode(editboxGetText(editbox)) - decodeCache[editbox] = decoded - end - return decoded or "" + local function tabPressedHook(editbox, ...) + local oldFun = editbox["faiap_old_OnTabPressed"] + if oldFun then + oldFun(editbox, ...) + end + if enabled[editbox] then + return lib.indentEditbox(editbox) end + end - local function newSetText(editbox, text) + local function onUpdateHook(editbox, ...) + local oldFun = editbox["faiap_old_OnUpdate"] + if oldFun then + oldFun(editbox, ...) + end + if enabled[editbox] and not editbox:IsInIMECompositionMode() then + local now = GetTime() + local lastUpdate = dirty[editbox] or now + if now - lastUpdate > 0.2 then decodeCache[editbox] = nil - if text then - local encoded = lib.encode(text) - - return editboxSetText(editbox, encoded) - end + return lib.colorCodeEditbox(editbox) + end end + end - function lib.enable(editbox, colorTable, tabWidth) - if not editboxSetText then - editboxSetText = editbox.SetText - editboxGetText = editbox.GetText - end - - local modified - if editbox.faiap_colorTable ~= colorTable then - editbox.faiap_colorTable = colorTable - modified = true - end - if editbox.faiap_tabWidth ~= tabWidth then - editbox.faiap_tabWidth = tabWidth - modified = true - end - - if enabled[editbox] then - if modified then - lib.indentEditbox(editbox) - end - return - end + local function newGetText(editbox) + local decoded = decodeCache[editbox] + if not decoded then + decoded = lib.decode(editboxGetText(editbox)) + decodeCache[editbox] = decoded + end + return decoded or "" + end - -- Editbox is possibly hooked, but disabled - enabled[editbox] = true + local function newSetText(editbox, text) + decodeCache[editbox] = nil + if text then + local encoded = lib.encode(text) - editbox.oldMaxBytes = editbox:GetMaxBytes() - editbox.oldMaxLetters = editbox:GetMaxLetters() - editbox:SetMaxBytes(0) - editbox:SetMaxLetters(0) + return editboxSetText(editbox, encoded) + end + end - editbox.GetText = newGetText - editbox.SetText = newSetText + function lib.enable(editbox, colorTable, tabWidth) + if not editboxSetText then + editboxSetText = editbox.SetText + editboxGetText = editbox.GetText + end - hookHandler(editbox, "OnTextChanged", textChangedHook) - hookHandler(editbox, "OnTabPressed", tabPressedHook) - hookHandler(editbox, "OnUpdate", onUpdateHook) + local modified + if editbox.faiap_colorTable ~= colorTable then + editbox.faiap_colorTable = colorTable + modified = true + end + if editbox.faiap_tabWidth ~= tabWidth then + editbox.faiap_tabWidth = tabWidth + modified = true + end + if enabled[editbox] then + if modified then lib.indentEditbox(editbox) + end + return end - -- Deprecated function - lib.addSmartCode = lib.enable + -- Editbox is possibly hooked, but disabled + enabled[editbox] = true - function lib.disable(editbox) - if not enabled[editbox] then - return - end - enabled[editbox] = nil + editbox.oldMaxBytes = editbox:GetMaxBytes() + editbox.oldMaxLetters = editbox:GetMaxLetters() + editbox:SetMaxBytes(0) + editbox:SetMaxLetters(0) - -- revert settings for max bytes / letters - editbox:SetMaxBytes(editbox.oldMaxBytes) - editbox:SetMaxLetters(editbox.oldMaxLetters) + editbox.GetText = newGetText + editbox.SetText = newSetText - -- try a real unhooking, if possible - if editbox:GetScript("OnTextChanged") == textChangedHook then - editbox:SetScript("OnTextChanged", editbox.faiap_old_OnTextChanged) - editbox.faiap_old_OnTextChanged = nil - end + hookHandler(editbox, "OnTextChanged", textChangedHook) + hookHandler(editbox, "OnTabPressed", tabPressedHook) + hookHandler(editbox, "OnUpdate", onUpdateHook) - if editbox:GetScript("OnTabPressed") == tabPressedHook then - editbox:SetScript("OnTabPressed", editbox.faiap_old_OnTabPressed) - editbox.faiap_old_OnTabPressed = nil - end + lib.indentEditbox(editbox) + end - if editbox:GetScript("OnUpdate") == onUpdateHook then - editbox:SetScript("OnUpdate", editbox.faiap_old_OnUpdate) - editbox.faiap_old_OnUpdate = nil - end + -- Deprecated function + lib.addSmartCode = lib.enable - editbox.GetText = nil - editbox.SetText = nil + function lib.disable(editbox) + if not enabled[editbox] then + return + end + enabled[editbox] = nil - -- change the text back to unformatted - editbox:SetText(newGetText(editbox)) + -- revert settings for max bytes / letters + editbox:SetMaxBytes(editbox.oldMaxBytes) + editbox:SetMaxLetters(editbox.oldMaxLetters) - -- clear caches - editboxIndentCache[editbox] = nil - decodeCache[editbox] = nil - editboxStringCache[editbox] = nil - editboxNumLinesCache[editbox] = nil + -- try a real unhooking, if possible + if editbox:GetScript("OnTextChanged") == textChangedHook then + editbox:SetScript("OnTextChanged", editbox.faiap_old_OnTextChanged) + editbox.faiap_old_OnTextChanged = nil end - defaultColorTable = {} - lib.defaultColorTable = defaultColorTable - defaultColorTable[tokens.TOKEN_SPECIAL] = "|c00ff99ff" - defaultColorTable[tokens.TOKEN_KEYWORD] = "|c006666ff" - defaultColorTable[tokens.TOKEN_COMMENT_SHORT] = "|c00999999" - defaultColorTable[tokens.TOKEN_COMMENT_LONG] = "|c00999999" - - local stringColor = "|c00ffff77" - defaultColorTable[tokens.TOKEN_STRING] = stringColor - defaultColorTable[".."] = stringColor - - local tableColor = "|c00ff9900" - defaultColorTable["..."] = tableColor - defaultColorTable["{"] = tableColor - defaultColorTable["}"] = tableColor - defaultColorTable["["] = tableColor - defaultColorTable["]"] = tableColor - - local arithmeticColor = "|c0033ff55" - defaultColorTable[tokens.TOKEN_NUMBER] = arithmeticColor - defaultColorTable["+"] = arithmeticColor - defaultColorTable["-"] = arithmeticColor - defaultColorTable["/"] = arithmeticColor - defaultColorTable["*"] = arithmeticColor - - local logicColor1 = "|c0055ff88" - defaultColorTable["=="] = logicColor1 - defaultColorTable["<"] = logicColor1 - defaultColorTable["<="] = logicColor1 - defaultColorTable[">"] = logicColor1 - defaultColorTable[">="] = logicColor1 - defaultColorTable["~="] = logicColor1 - - local logicColor2 = "|c0088ffbb" - defaultColorTable["and"] = logicColor2 - defaultColorTable["or"] = logicColor2 - defaultColorTable["not"] = logicColor2 - - defaultColorTable[0] = "|r" + if editbox:GetScript("OnTabPressed") == tabPressedHook then + editbox:SetScript("OnTabPressed", editbox.faiap_old_OnTabPressed) + editbox.faiap_old_OnTabPressed = nil + end + + if editbox:GetScript("OnUpdate") == onUpdateHook then + editbox:SetScript("OnUpdate", editbox.faiap_old_OnUpdate) + editbox.faiap_old_OnUpdate = nil + end + + editbox.GetText = nil + editbox.SetText = nil + + -- change the text back to unformatted + editbox:SetText(newGetText(editbox)) + + -- clear caches + editboxIndentCache[editbox] = nil + decodeCache[editbox] = nil + editboxStringCache[editbox] = nil + editboxNumLinesCache[editbox] = nil + end + defaultColorTable = {} + lib.defaultColorTable = defaultColorTable + defaultColorTable[tokens.TOKEN_SPECIAL] = "|c00ff99ff" + defaultColorTable[tokens.TOKEN_KEYWORD] = "|c006666ff" + defaultColorTable[tokens.TOKEN_COMMENT_SHORT] = "|c00999999" + defaultColorTable[tokens.TOKEN_COMMENT_LONG] = "|c00999999" + + local stringColor = "|c00ffff77" + defaultColorTable[tokens.TOKEN_STRING] = stringColor + defaultColorTable[".."] = stringColor + + local tableColor = "|c00ff9900" + defaultColorTable["..."] = tableColor + defaultColorTable["{"] = tableColor + defaultColorTable["}"] = tableColor + defaultColorTable["["] = tableColor + defaultColorTable["]"] = tableColor + + local arithmeticColor = "|c0033ff55" + defaultColorTable[tokens.TOKEN_NUMBER] = arithmeticColor + defaultColorTable["+"] = arithmeticColor + defaultColorTable["-"] = arithmeticColor + defaultColorTable["/"] = arithmeticColor + defaultColorTable["*"] = arithmeticColor + + local logicColor1 = "|c0055ff88" + defaultColorTable["=="] = logicColor1 + defaultColorTable["<"] = logicColor1 + defaultColorTable["<="] = logicColor1 + defaultColorTable[">"] = logicColor1 + defaultColorTable[">="] = logicColor1 + defaultColorTable["~="] = logicColor1 + + local logicColor2 = "|c0088ffbb" + defaultColorTable["and"] = logicColor2 + defaultColorTable["or"] = logicColor2 + defaultColorTable["not"] = logicColor2 + + defaultColorTable[0] = "|r" end -- just for testing diff --git a/WeakAurasOptions/GenericTrigger.lua b/WeakAurasOptions/GenericTrigger.lua index c7fc55802f..8abca59513 100644 --- a/WeakAurasOptions/GenericTrigger.lua +++ b/WeakAurasOptions/GenericTrigger.lua @@ -1,44 +1,47 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... -local L = WeakAuras.L; +local L = WeakAuras.L local function GetCustomTriggerOptions(data, triggernum) local trigger = data.triggers[triggernum].trigger local function appendToTriggerPath(...) - local ret = {...}; - tinsert(ret, 1, "trigger"); - tinsert(ret, 1, triggernum); - tinsert(ret, 1, "triggers"); - return ret; + local ret = { ... } + tinsert(ret, 1, "trigger") + tinsert(ret, 1, triggernum) + tinsert(ret, 1, "triggers") + return ret end local function appendToUntriggerPath(...) - local ret = {...}; - tinsert(ret, 1, "untrigger"); - tinsert(ret, 1, triggernum); - tinsert(ret, 1, "triggers"); - return ret; + local ret = { ... } + tinsert(ret, 1, "untrigger") + tinsert(ret, 1, triggernum) + tinsert(ret, 1, "triggers") + return ret end - local customOptions = - { + local customOptions = { custom_type = { type = "select", name = L["Event Type"], order = 7, width = WeakAuras.doubleWidth, values = OptionsPrivate.Private.custom_trigger_types, - hidden = function() return not (trigger.type == "custom") end, + hidden = function() + return not (trigger.type == "custom") + end, get = function() return trigger.custom_type end, set = function(info, v) - trigger.custom_type = v; - WeakAuras.Add(data); - WeakAuras.UpdateThumbnail(data); - WeakAuras.ClearAndUpdateOptions(data.id); - end + trigger.custom_type = v + WeakAuras.Add(data) + WeakAuras.UpdateThumbnail(data) + WeakAuras.ClearAndUpdateOptions(data.id) + end, }, check = { type = "select", @@ -46,15 +49,16 @@ local function GetCustomTriggerOptions(data, triggernum) width = WeakAuras.doubleWidth / 3, order = 8, values = OptionsPrivate.Private.check_types, - hidden = function() return not (trigger.type == "custom" - and (trigger.custom_type == "status" or trigger.custom_type == "stateupdate") - and trigger.check ~= "update") + hidden = function() + return not (trigger.type == "custom" and (trigger.custom_type == "status" or trigger.custom_type == "stateupdate") and trigger.check ~= "update") + end, + get = function() + return trigger.check end, - get = function() return trigger.check end, set = function(info, v) - trigger.check = v; - WeakAuras.Add(data); - end + trigger.check = v + WeakAuras.Add(data) + end, }, check2 = { type = "select", @@ -62,15 +66,16 @@ local function GetCustomTriggerOptions(data, triggernum) order = 9, width = WeakAuras.doubleWidth, values = OptionsPrivate.Private.check_types, - hidden = function() return not (trigger.type == "custom" - and (trigger.custom_type == "status" or trigger.custom_type == "stateupdate") - and trigger.check == "update") + hidden = function() + return not (trigger.type == "custom" and (trigger.custom_type == "status" or trigger.custom_type == "stateupdate") and trigger.check == "update") + end, + get = function() + return trigger.check end, - get = function() return trigger.check end, set = function(info, v) - trigger.check = v; - WeakAuras.Add(data); - end + trigger.check = v + WeakAuras.Add(data) + end, }, events = { type = "input", @@ -78,14 +83,16 @@ local function GetCustomTriggerOptions(data, triggernum) name = L["Event(s)"], desc = L["Custom trigger status tooltip"], order = 8.1, - hidden = function() return not (trigger.type == "custom" - and (trigger.custom_type == "status" or trigger.custom_type == "stateupdate") - and trigger.check ~= "update") end, - get = function() return trigger.events end, + hidden = function() + return not (trigger.type == "custom" and (trigger.custom_type == "status" or trigger.custom_type == "stateupdate") and trigger.check ~= "update") + end, + get = function() + return trigger.events + end, set = function(info, v) - trigger.events = v; - WeakAuras.Add(data); - end + trigger.events = v + WeakAuras.Add(data) + end, }, events2 = { type = "input", @@ -93,12 +100,16 @@ local function GetCustomTriggerOptions(data, triggernum) desc = L["Custom trigger event tooltip"], width = WeakAuras.doubleWidth, order = 9.1, - hidden = function() return not (trigger.type == "custom" and trigger.custom_type == "event") end, - get = function() return trigger.events end, + hidden = function() + return not (trigger.type == "custom" and trigger.custom_type == "event") + end, + get = function() + return trigger.events + end, set = function(info, v) - trigger.events = v; - WeakAuras.Add(data); - end + trigger.events = v + WeakAuras.Add(data) + end, }, event_customError = { type = "description", @@ -112,20 +123,22 @@ local function GetCustomTriggerOptions(data, triggernum) elseif trueEvent == "CLEU" or trueEvent == "COMBAT_LOG_EVENT_UNFILTERED" then local subevent = string.upper(i) if not OptionsPrivate.Private.IsCLEUSubevent(subevent) then - return "|cFFFF0000"..L["%s is not a valid SubEvent for COMBAT_LOG_EVENT_UNFILTERED"]:format(subevent) + return "|cFFFF0000" .. L["%s is not a valid SubEvent for COMBAT_LOG_EVENT_UNFILTERED"]:format(subevent) end elseif trueEvent:match("^UNIT_") then local unit = string.lower(i) if not OptionsPrivate.Private.baseUnitId[unit] and not OptionsPrivate.Private.multiUnitId[unit] then - return "|cFFFF0000"..L["Unit %s is not a valid unit for RegisterUnitEvent"]:format(unit) + return "|cFFFF0000" .. L["Unit %s is not a valid unit for RegisterUnitEvent"]:format(unit) end elseif trueEvent == "TRIGGER" then local requestedTriggernum = tonumber(i) if requestedTriggernum then - if OptionsPrivate.Private.watched_trigger_events[data.id] - and OptionsPrivate.Private.watched_trigger_events[data.id][triggernum] - and OptionsPrivate.Private.watched_trigger_events[data.id][triggernum][requestedTriggernum] then - return "|cFFFF0000"..L["Reciprocal TRIGGER:# requests will be ignored!"] + if + OptionsPrivate.Private.watched_trigger_events[data.id] + and OptionsPrivate.Private.watched_trigger_events[data.id][triggernum] + and OptionsPrivate.Private.watched_trigger_events[data.id][triggernum][requestedTriggernum] + then + return "|cFFFF0000" .. L["Reciprocal TRIGGER:# requests will be ignored!"] end end end @@ -136,11 +149,12 @@ local function GetCustomTriggerOptions(data, triggernum) width = WeakAuras.doubleWidth, order = 9.201, hidden = function() - if not ( - trigger.type == "custom" - and (trigger.custom_type == "status" or trigger.custom_type == "stateupdate" or trigger.custom_type == "event") - and trigger.check ~= "update" - ) + if + not ( + trigger.type == "custom" + and (trigger.custom_type == "status" or trigger.custom_type == "stateupdate" or trigger.custom_type == "event") + and trigger.check ~= "update" + ) then return true end @@ -162,9 +176,11 @@ local function GetCustomTriggerOptions(data, triggernum) elseif trueEvent == "TRIGGER" then local requestedTriggernum = tonumber(i) if requestedTriggernum then - if OptionsPrivate.Private.watched_trigger_events[data.id] - and OptionsPrivate.Private.watched_trigger_events[data.id][triggernum] - and OptionsPrivate.Private.watched_trigger_events[data.id][triggernum][requestedTriggernum] then + if + OptionsPrivate.Private.watched_trigger_events[data.id] + and OptionsPrivate.Private.watched_trigger_events[data.id][triggernum] + and OptionsPrivate.Private.watched_trigger_events[data.id][triggernum][requestedTriggernum] + then return false end end @@ -172,7 +188,7 @@ local function GetCustomTriggerOptions(data, triggernum) end end return true - end + end, }, -- texteditor below custom_hide = { @@ -180,48 +196,61 @@ local function GetCustomTriggerOptions(data, triggernum) width = WeakAuras.normalWidth, name = L["Hide"], order = 12, - hidden = function() return not (trigger.type == "custom" and trigger.custom_type == "event" and trigger.custom_hide ~= "custom") end, + hidden = function() + return not (trigger.type == "custom" and trigger.custom_type == "event" and trigger.custom_hide ~= "custom") + end, values = OptionsPrivate.Private.eventend_types, - get = function() trigger.custom_hide = trigger.custom_hide or "timed"; return trigger.custom_hide end, + get = function() + trigger.custom_hide = trigger.custom_hide or "timed" + return trigger.custom_hide + end, set = function(info, v) - trigger.custom_hide = v; - WeakAuras.Add(data); - end + trigger.custom_hide = v + WeakAuras.Add(data) + end, }, custom_hide2 = { type = "select", name = L["Hide"], order = 12, width = WeakAuras.doubleWidth, - hidden = function() return not (trigger.type == "custom" and trigger.custom_type == "event" and trigger.custom_hide == "custom") end, + hidden = function() + return not (trigger.type == "custom" and trigger.custom_type == "event" and trigger.custom_hide == "custom") + end, values = OptionsPrivate.Private.eventend_types, - get = function() return trigger.custom_hide end, + get = function() + return trigger.custom_hide + end, set = function(info, v) - trigger.custom_hide = v; - WeakAuras.Add(data); - end + trigger.custom_hide = v + WeakAuras.Add(data) + end, }, dynamicDuration = { type = "toggle", width = WeakAuras.normalWidth, name = L["Dynamic Duration"], order = 12.5, - hidden = function() return not (trigger.type == "custom" and trigger.custom_type == "event" and trigger.custom_hide ~= "custom") end, + hidden = function() + return not (trigger.type == "custom" and trigger.custom_type == "event" and trigger.custom_hide ~= "custom") + end, get = function() return trigger.dynamicDuration end, set = function(info, v) - trigger.dynamicDuration = v; - WeakAuras.Add(data); - WeakAuras.ClearAndUpdateOptions(data.id); - end + trigger.dynamicDuration = v + WeakAuras.Add(data) + WeakAuras.ClearAndUpdateOptions(data.id) + end, }, duration = { type = "input", width = WeakAuras.normalWidth, name = L["Duration (s)"], order = 13, - hidden = function() return not (trigger.type == "custom" and trigger.custom_type == "event" and trigger.custom_hide ~= "custom" and not trigger.dynamicDuration) end, + hidden = function() + return not (trigger.type == "custom" and trigger.custom_type == "event" and trigger.custom_hide ~= "custom" and not trigger.dynamicDuration) + end, get = function() return trigger.duration end, @@ -229,7 +258,7 @@ local function GetCustomTriggerOptions(data, triggernum) trigger.duration = v WeakAuras.Add(data) WeakAuras.ClearAndUpdateOptions(data.id) - end + end, }, addOverlayFunction = { type = "execute", @@ -237,50 +266,60 @@ local function GetCustomTriggerOptions(data, triggernum) order = 17.9, width = WeakAuras.doubleWidth, hidden = function() - if (trigger.type ~= "custom") then - return true; + if trigger.type ~= "custom" then + return true end - if (trigger.custom_type == "stateupdate") then - return true; + if trigger.custom_type == "stateupdate" then + return true end for i = 1, 7 do - if (trigger["customOverlay" .. i] == nil) then - return false; + if trigger["customOverlay" .. i] == nil then + return false end end - return true; + return true end, func = function() for i = 1, 7 do - if (trigger["customOverlay" .. i] == nil) then - trigger["customOverlay" .. i] = ""; - break; + if trigger["customOverlay" .. i] == nil then + trigger["customOverlay" .. i] = "" + break end end - WeakAuras.Add(data); + WeakAuras.Add(data) WeakAuras.ClearAndUpdateOptions(data.id) - end - } - }; + end, + }, + } local function extraSetFunction() - WeakAuras.UpdateThumbnail(data); + WeakAuras.UpdateThumbnail(data) end local function extraSetFunctionReload() - extraSetFunction(); - WeakAuras.ClearAndUpdateOptions(data.id); + extraSetFunction() + WeakAuras.ClearAndUpdateOptions(data.id) end local function hideCustomTrigger() return not (trigger.type == "custom") end - OptionsPrivate.commonOptions.AddCodeOption(customOptions, data, L["Custom Trigger"], "custom_trigger", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-trigger", - 10, hideCustomTrigger, appendToTriggerPath("custom"), false, {multipath = false, extraSetFunction = extraSetFunction, reloadOptions = true}); + OptionsPrivate.commonOptions.AddCodeOption( + customOptions, + data, + L["Custom Trigger"], + "custom_trigger", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-trigger", + 10, + hideCustomTrigger, + appendToTriggerPath("custom"), + false, + { multipath = false, extraSetFunction = extraSetFunction, reloadOptions = true } + ) local function hideCustomVariables() - return not (trigger.type == "custom" and trigger.custom_type == "stateupdate"); + return not (trigger.type == "custom" and trigger.custom_type == "stateupdate") end local validTypes = { @@ -301,7 +340,7 @@ local function GetCustomTriggerOptions(data, triggernum) } local function validateCustomVariables(variables) - if (type(variables) ~= "table") then + if type(variables) ~= "table" then return L["Not a table"] end @@ -329,24 +368,50 @@ local function GetCustomTriggerOptions(data, triggernum) end end - OptionsPrivate.commonOptions.AddCodeOption(customOptions, data, L["Custom Variables"], "custom_variables", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-variables", - 11, hideCustomVariables, appendToTriggerPath("customVariables"), false, - {multipath = false, extraSetFunction = extraSetFunctionReload, reloadOptions = true, validator = validateCustomVariables }); + OptionsPrivate.commonOptions.AddCodeOption( + customOptions, + data, + L["Custom Variables"], + "custom_variables", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-variables", + 11, + hideCustomVariables, + appendToTriggerPath("customVariables"), + false, + { multipath = false, extraSetFunction = extraSetFunctionReload, reloadOptions = true, validator = validateCustomVariables } + ) local function hideCustomUntrigger() - return not (trigger.type == "custom" - and (trigger.custom_type == "status" or (trigger.custom_type == "event" and trigger.custom_hide == "custom"))) + return not (trigger.type == "custom" and (trigger.custom_type == "status" or (trigger.custom_type == "event" and trigger.custom_hide == "custom"))) end - OptionsPrivate.commonOptions.AddCodeOption(customOptions, data, L["Custom Untrigger"], "custom_untrigger", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-untrigger", - 14, hideCustomUntrigger, appendToUntriggerPath("custom"), false, {multipath = false, extraSetFunction = extraSetFunction}); + OptionsPrivate.commonOptions.AddCodeOption( + customOptions, + data, + L["Custom Untrigger"], + "custom_untrigger", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-untrigger", + 14, + hideCustomUntrigger, + appendToUntriggerPath("custom"), + false, + { multipath = false, extraSetFunction = extraSetFunction } + ) local function hideCustomDuration() - return not (trigger.type == "custom" - and (trigger.custom_type == "status" - or (trigger.custom_type == "event" and (trigger.custom_hide ~= "timed" or trigger.dynamicDuration)))) + return not (trigger.type == "custom" and (trigger.custom_type == "status" or (trigger.custom_type == "event" and (trigger.custom_hide ~= "timed" or trigger.dynamicDuration)))) end - OptionsPrivate.commonOptions.AddCodeOption(customOptions, data, L["Duration Info"], "custom_duration", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#duration-info", - 16, hideCustomDuration, appendToTriggerPath("customDuration"), false, { multipath = false, extraSetFunction = extraSetFunctionReload }); + OptionsPrivate.commonOptions.AddCodeOption( + customOptions, + data, + L["Duration Info"], + "custom_duration", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#duration-info", + 16, + hideCustomDuration, + appendToTriggerPath("customDuration"), + false, + { multipath = false, extraSetFunction = extraSetFunctionReload } + ) local function hideIfTriggerStateUpdate() return not (trigger.type == "custom" and trigger.custom_type ~= "stateupdate") @@ -354,17 +419,17 @@ local function GetCustomTriggerOptions(data, triggernum) for i = 1, 7 do local function hideOverlay() - if (trigger["customOverlay" .. i] == nil) then - return true; + if trigger["customOverlay" .. i] == nil then + return true end - return hideIfTriggerStateUpdate(); + return hideIfTriggerStateUpdate() end local function removeOverlay() for j = i, 7 do - trigger["customOverlay" .. j] = trigger["customOverlay" .. (j +1)]; + trigger["customOverlay" .. j] = trigger["customOverlay" .. (j + 1)] end - WeakAuras.Add(data); + WeakAuras.Add(data) WeakAuras.ClearAndUpdateOptions(data.id) WeakAuras.FillOptions() end @@ -372,31 +437,81 @@ local function GetCustomTriggerOptions(data, triggernum) local extraFunctions = { { buttonLabel = L["Remove"], - func = removeOverlay - } + func = removeOverlay, + }, } - OptionsPrivate.commonOptions.AddCodeOption(customOptions, data, string.format(L["Overlay %s Info"], i), "custom_overlay" .. i, "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#overlay-info", - 17 + i / 10, hideOverlay, appendToTriggerPath("customOverlay" .. i), false, { multipath = false, extraSetFunction = extraSetFunctionReload, extraFunctions = extraFunctions}); + OptionsPrivate.commonOptions.AddCodeOption( + customOptions, + data, + string.format(L["Overlay %s Info"], i), + "custom_overlay" .. i, + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#overlay-info", + 17 + i / 10, + hideOverlay, + appendToTriggerPath("customOverlay" .. i), + false, + { multipath = false, extraSetFunction = extraSetFunctionReload, extraFunctions = extraFunctions } + ) end - OptionsPrivate.commonOptions.AddCodeOption(customOptions, data, L["Name Info"], "custom_name", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#name-info", - 18, hideIfTriggerStateUpdate, appendToTriggerPath("customName"), false, { multipath = false, extraSetFunction = extraSetFunctionReload}); - OptionsPrivate.commonOptions.AddCodeOption(customOptions, data, L["Icon Info"], "custom_icon", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#icon-info", - 20, hideIfTriggerStateUpdate, appendToTriggerPath("customIcon"), false, { multipath = false, extraSetFunction = extraSetFunction}); - OptionsPrivate.commonOptions.AddCodeOption(customOptions, data, L["Texture Info"], "custom_texture", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#texture-info", - 22, hideIfTriggerStateUpdate, appendToTriggerPath("customTexture"), false, { multipath = false, extraSetFunction = extraSetFunction}); - OptionsPrivate.commonOptions.AddCodeOption(customOptions, data, L["Stack Info"], "custom_stacks", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#stack-info", - 23, hideIfTriggerStateUpdate, appendToTriggerPath("customStacks"), false, { multipath = false, extraSetFunction = extraSetFunctionReload}); - - return customOptions; + OptionsPrivate.commonOptions.AddCodeOption( + customOptions, + data, + L["Name Info"], + "custom_name", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#name-info", + 18, + hideIfTriggerStateUpdate, + appendToTriggerPath("customName"), + false, + { multipath = false, extraSetFunction = extraSetFunctionReload } + ) + OptionsPrivate.commonOptions.AddCodeOption( + customOptions, + data, + L["Icon Info"], + "custom_icon", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#icon-info", + 20, + hideIfTriggerStateUpdate, + appendToTriggerPath("customIcon"), + false, + { multipath = false, extraSetFunction = extraSetFunction } + ) + OptionsPrivate.commonOptions.AddCodeOption( + customOptions, + data, + L["Texture Info"], + "custom_texture", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#texture-info", + 22, + hideIfTriggerStateUpdate, + appendToTriggerPath("customTexture"), + false, + { multipath = false, extraSetFunction = extraSetFunction } + ) + OptionsPrivate.commonOptions.AddCodeOption( + customOptions, + data, + L["Stack Info"], + "custom_stacks", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#stack-info", + 23, + hideIfTriggerStateUpdate, + appendToTriggerPath("customStacks"), + false, + { multipath = false, extraSetFunction = extraSetFunctionReload } + ) + + return customOptions end local function GetGenericTriggerOptions(data, triggernum) - local id = data.id; + local id = data.id - local trigger = data.triggers[triggernum].trigger; - local triggerType = trigger.type; + local trigger = data.triggers[triggernum].trigger + local triggerType = trigger.type local subtypes = OptionsPrivate.Private.category_event_prototype[trigger.type] @@ -429,8 +544,7 @@ local function GetGenericTriggerOptions(data, triggernum) OptionsPrivate.AddTriggerMetaFunctions(options, data, triggernum) local combatLogCategory = WeakAuras.GetTriggerCategoryFor("Combat Log") - local combatLogOptions = - { + local combatLogOptions = { subeventPrefix = { type = "select", name = L["Message Prefix"], @@ -438,14 +552,16 @@ local function GetGenericTriggerOptions(data, triggernum) order = 8, values = OptionsPrivate.Private.subevent_prefix_types, control = "WeakAurasSortedDropdown", - hidden = function() return not (trigger.type == combatLogCategory and trigger.event == "Combat Log"); end, + hidden = function() + return not (trigger.type == combatLogCategory and trigger.event == "Combat Log") + end, get = function(info) return trigger.subeventPrefix end, set = function(info, v) trigger.subeventPrefix = v WeakAuras.Add(data) - end + end, }, subeventSuffix = { type = "select", @@ -454,45 +570,48 @@ local function GetGenericTriggerOptions(data, triggernum) order = 9, values = OptionsPrivate.Private.subevent_suffix_types, control = "WeakAurasSortedDropdown", - hidden = function() return not (trigger.type == combatLogCategory and trigger.event == "Combat Log" and OptionsPrivate.Private.subevent_actual_prefix_types[trigger.subeventPrefix]); end, + hidden = function() + return not (trigger.type == combatLogCategory and trigger.event == "Combat Log" and OptionsPrivate.Private.subevent_actual_prefix_types[trigger.subeventPrefix]) + end, get = function(info) return trigger.subeventSuffix end, set = function(info, v) trigger.subeventSuffix = v WeakAuras.Add(data) - end + end, }, spacer_suffix = { type = "description", name = "", order = 9.1, - hidden = function() return not (trigger.type == combatLogCategory and trigger.event == "Combat Log"); end + hidden = function() + return not (trigger.type == combatLogCategory and trigger.event == "Combat Log") + end, }, } - if (triggerType == "custom") then - Mixin(options, GetCustomTriggerOptions(data, triggernum)); - elseif (OptionsPrivate.Private.category_event_prototype[triggerType]) then - local prototypeOptions; + if triggerType == "custom" then + Mixin(options, GetCustomTriggerOptions(data, triggernum)) + elseif OptionsPrivate.Private.category_event_prototype[triggerType] then + local prototypeOptions local trigger = data.triggers[triggernum].trigger - if(OptionsPrivate.Private.event_prototypes[trigger.event]) then - prototypeOptions = OptionsPrivate.ConstructOptions(OptionsPrivate.Private.event_prototypes[trigger.event], data, 10, triggernum); - if (trigger.event == "Combat Log") then - Mixin(prototypeOptions, combatLogOptions); + if OptionsPrivate.Private.event_prototypes[trigger.event] then + prototypeOptions = OptionsPrivate.ConstructOptions(OptionsPrivate.Private.event_prototypes[trigger.event], data, 10, triggernum) + if trigger.event == "Combat Log" then + Mixin(prototypeOptions, combatLogOptions) end else - print("|cFF8800FFWeakAuras|r: No prototype for", trigger.event); + print("|cFF8800FFWeakAuras|r: No prototype for", trigger.event) end - if (prototypeOptions) then - Mixin(options, prototypeOptions); + if prototypeOptions then + Mixin(options, prototypeOptions) end end - return { - ["trigger." .. triggernum .. "." .. (trigger.event or "unknown")] = options + ["trigger." .. triggernum .. "." .. (trigger.event or "unknown")] = options, } end -WeakAuras.RegisterTriggerSystemOptions(WeakAuras.genericTriggerTypes, GetGenericTriggerOptions); +WeakAuras.RegisterTriggerSystemOptions(WeakAuras.genericTriggerTypes, GetGenericTriggerOptions) diff --git a/WeakAurasOptions/GroupOptions.lua b/WeakAurasOptions/GroupOptions.lua index 817be4f6dc..6341fb2a15 100644 --- a/WeakAurasOptions/GroupOptions.lua +++ b/WeakAurasOptions/GroupOptions.lua @@ -1,16 +1,18 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... local L = WeakAuras.L -local regionOptions = WeakAuras.regionOptions; +local regionOptions = WeakAuras.regionOptions local parsePrefix = OptionsPrivate.commonOptions.parsePrefix local flattenRegionOptions = OptionsPrivate.commonOptions.flattenRegionOptions function OptionsPrivate.GetGroupOptions(data) - local regionOption; + local regionOption local id = data.id - if (regionOptions[data.regionType]) then - regionOption = regionOptions[data.regionType].create(id, data); + if regionOptions[data.regionType] then + regionOption = regionOptions[data.regionType].create(id, data) else regionOption = { [data.regionType] = { @@ -18,47 +20,51 @@ function OptionsPrivate.GetGroupOptions(data) __order = 1, unsupported = { type = "description", - name = L["This region of type \"%s\" is not supported."]:format(data.regionType) - } - }; - }; + name = L["This region of type \"%s\" is not supported."]:format(data.regionType), + }, + }, + } end - local groupOptions = { + local groupOptions = { type = "group", name = L["Group Options"], order = 0, get = function(info) - local base, property = parsePrefix(info[#info], data); + local base, property = parsePrefix(info[#info], data) if not base then return nil end - if(info.type == "color") then - base[property] = base[property] or {}; - local c = base[property]; - return c[1], c[2], c[3], c[4]; + if info.type == "color" then + base[property] = base[property] or {} + local c = base[property] + return c[1], c[2], c[3], c[4] else - return base[property]; + return base[property] end end, set = function(info, v, g, b, a) - local base, property = parsePrefix(info[#info], data, true); - if(info.type == "color") then - base[property] = base[property] or {}; - local c = base[property]; - c[1], c[2], c[3], c[4] = v, g, b, a; - elseif(info.type == "toggle") then - base[property] = v; + local base, property = parsePrefix(info[#info], data, true) + if info.type == "color" then + base[property] = base[property] or {} + local c = base[property] + c[1], c[2], c[3], c[4] = v, g, b, a + elseif info.type == "toggle" then + base[property] = v else - base[property] = (v ~= "" and v) or nil; + base[property] = (v ~= "" and v) or nil end - WeakAuras.Add(data); - WeakAuras.UpdateThumbnail(data); - OptionsPrivate.ResetMoverSizer(); + WeakAuras.Add(data) + WeakAuras.UpdateThumbnail(data) + OptionsPrivate.ResetMoverSizer() + end, + hidden = function() + return false + end, + disabled = function() + return false end, - hidden = function() return false end, - disabled = function() return false end, - args = flattenRegionOptions(regionOption, true); + args = flattenRegionOptions(regionOption, true), } return groupOptions diff --git a/WeakAurasOptions/InformationOptions.lua b/WeakAurasOptions/InformationOptions.lua index cb4596783c..5c92818eaa 100644 --- a/WeakAurasOptions/InformationOptions.lua +++ b/WeakAurasOptions/InformationOptions.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... local L = WeakAuras.L @@ -11,9 +13,7 @@ function OptionsPrivate.GetInformationOptions(data) type = "group", name = L["Information"], order = 1, - args = { - - } + args = {}, } local order = 1 @@ -34,9 +34,9 @@ function OptionsPrivate.GetInformationOptions(data) set = function(info, newid) if data.id ~= newid and not WeakAuras.GetData(newid) then local oldid = data.id - WeakAuras.Rename(data, newid); + WeakAuras.Rename(data, newid) end - end + end, } order = order + 1 end @@ -51,7 +51,7 @@ function OptionsPrivate.GetInformationOptions(data) local traverseForUrl = isTmpGroup and OptionsPrivate.Private.TraverseAllChildren or OptionsPrivate.Private.TraverseAll for child in traverseForUrl(data) do if child.url then - desc = desc .. "|cFFE0E000"..child.id..": |r"..child.url .. "\n" + desc = desc .. "|cFFE0E000" .. child.id .. ": |r" .. child.url .. "\n" end if not commonURL then commonURL = child.url or "" @@ -77,22 +77,20 @@ function OptionsPrivate.GetInformationOptions(data) WeakAuras.ClearAndUpdateOptions(data.id) end, desc = sameURL and "" or desc, - order = order + order = order, } order = order + 1 if isGroup then args.url_note = { type = "description", - name = isTmpGroup and L["|cFFE0E000Note:|r This sets the URL on all selected auras"] - or L["|cFFE0E000Note:|r This sets the URL on this group and all its members."], + name = isTmpGroup and L["|cFFE0E000Note:|r This sets the URL on all selected auras"] or L["|cFFE0E000Note:|r This sets the URL on this group and all its members."], width = WeakAuras.doubleWidth, - order = order + order = order, } order = order + 1 end - -- Description -- One Aura/Group: Edit description of the aura or group -- Multi-selection: No editing @@ -110,7 +108,7 @@ function OptionsPrivate.GetInformationOptions(data) data.desc = v WeakAuras.Add(data) WeakAuras.ClearAndUpdateOptions(data.id) - end + end, } order = order + 1 @@ -142,13 +140,13 @@ function OptionsPrivate.GetInformationOptions(data) name = message, width = WeakAuras.doubleWidth, order = order, - fontSize = "medium" + fontSize = "medium", } order = order + 1 end end - -- compatibility Options + -- compatibility Options args.compabilityTitle = { type = "header", name = L["Compatibility Options"], @@ -164,22 +162,18 @@ function OptionsPrivate.GetInformationOptions(data) groupOffset = { name = L["Offset by 1px"], onParent = true, - regionType = "group" - } + regionType = "group", + }, } local same = { ignoreOptionsEventErrors = true, - groupOffset = true + groupOffset = true, } - local common = { + local common = {} - } - - local mergedDesc = { - - } + local mergedDesc = {} for property, propertyData in pairs(properties) do if propertyData.onParent then @@ -198,8 +192,7 @@ function OptionsPrivate.GetInformationOptions(data) effectiveProperty = false end - mergedDesc[property] = (mergedDesc[property] or "") .. "|cFFE0E000" .. child.id .. ": |r" - .. (effectiveProperty and "true" or "false") .. "\n" + mergedDesc[property] = (mergedDesc[property] or "") .. "|cFFE0E000" .. child.id .. ": |r" .. (effectiveProperty and "true" or "false") .. "\n" if common[property] == nil then common[property] = effectiveProperty @@ -239,7 +232,7 @@ function OptionsPrivate.GetInformationOptions(data) WeakAuras.ClearAndUpdateOptions(data.id) end, desc = same[property] and "" or mergedDesc[property], - order = order + order = order, } order = order + 1 end @@ -268,7 +261,7 @@ function OptionsPrivate.GetInformationOptions(data) for child in OptionsPrivate.Private.TraverseLeafsOrAura(data) do local effectiveDebugLog = child.information.debugLog and true or false - debugLogDesc = debugLogDesc .. "|cFFE0E000"..child.id..": |r".. (effectiveDebugLog and "true" or "false") .. "\n" + debugLogDesc = debugLogDesc .. "|cFFE0E000" .. child.id .. ": |r" .. (effectiveDebugLog and "true" or "false") .. "\n" if commonDebugLog == nil then commonDebugLog = effectiveDebugLog elseif effectiveDebugLog ~= commonDebugLog then @@ -293,7 +286,7 @@ function OptionsPrivate.GetInformationOptions(data) end WeakAuras.ClearAndUpdateOptions(data.id) - end + end, } order = order + 1 @@ -312,7 +305,7 @@ function OptionsPrivate.GetInformationOptions(data) haveLogs = true fullMessage = fullMessage .. L["Aura: '%s'"]:format(child.id) local version = child.semver or child.version - if (version) then + if version then fullMessage = fullMessage .. "\n" .. L["Version: %s"]:format(version) end fullMessage = fullMessage .. "\n" .. L["Debug Log:"] .. "\n" .. auraLog .. "\n\n" @@ -324,7 +317,7 @@ function OptionsPrivate.GetInformationOptions(data) else OptionsPrivate.OpenDebugLog(L["No Logs saved."]) end - end + end, } order = order + 1 @@ -337,7 +330,7 @@ function OptionsPrivate.GetInformationOptions(data) for child in OptionsPrivate.Private.TraverseLeafsOrAura(data) do OptionsPrivate.Private.DebugLog.Clear(child.uid) end - end + end, } order = order + 1 end diff --git a/WeakAurasOptions/LoadOptions.lua b/WeakAurasOptions/LoadOptions.lua index a3047799c1..72bc59d606 100644 --- a/WeakAurasOptions/LoadOptions.lua +++ b/WeakAurasOptions/LoadOptions.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... local L = WeakAuras.L @@ -12,41 +14,41 @@ local hiddenAll = OptionsPrivate.commonOptions.CreateHiddenAll("load") local getAll = OptionsPrivate.commonOptions.CreateGetAll("load") local setAll = OptionsPrivate.commonOptions.CreateSetAll("load", getAll) -local ValidateNumeric = WeakAuras.ValidateNumeric; +local ValidateNumeric = WeakAuras.ValidateNumeric -local spellCache = WeakAuras.spellCache; +local spellCache = WeakAuras.spellCache local function CorrectSpellName(input) - local inputId = tonumber(input); - if(inputId) then - local name = GetSpellInfo(inputId); - if(name) then - return inputId; + local inputId = tonumber(input) + if inputId then + local name = GetSpellInfo(inputId) + if name then + return inputId else - return nil; + return nil end elseif WeakAuras.IsClassic() and input then local _, _, _, _, _, _, spellId = GetSpellInfo(input) if spellId then return spellId end - elseif(input) then - local link; - if(input:sub(1,1) == "\124") then - link = input; + elseif input then + local link + if input:sub(1, 1) == "\124" then + link = input else - link = GetSpellLink(input); + link = GetSpellLink(input) end - if(link) and link ~= "" then - local itemId = link:match("spell:(%d+)"); - return tonumber(itemId); + if link and link ~= "" then + local itemId = link:match("spell:(%d+)") + return tonumber(itemId) elseif WeakAuras.IsRetail() then for tier = 1, MAX_TALENT_TIERS do for column = 1, NUM_TALENT_COLUMNS do local _, _, _, _, _, spellId = GetTalentInfo(tier, column, 1) - local name = GetSpellInfo(spellId); + local name = GetSpellInfo(spellId) if name == input then - return spellId; + return spellId end end end @@ -55,16 +57,16 @@ local function CorrectSpellName(input) end local function CorrectItemName(input) - local inputId = tonumber(input); - if(inputId) then - return inputId; - elseif(input) then - local _, link = GetItemInfo(input); - if(link) then - local itemId = link:match("item:(%d+)"); - return tonumber(itemId); + local inputId = tonumber(input) + if inputId then + return inputId + elseif input then + local _, link = GetItemInfo(input) + if link then + local itemId = link:match("item:(%d+)") + return tonumber(itemId) else - return nil; + return nil end end end @@ -72,37 +74,39 @@ end -- Also used by the GenericTrigger function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum, triggertype) local trigger - if(data.controlledChildren) then + if data.controlledChildren then trigger = {} - elseif(triggertype == "load") then - trigger = data.load; + elseif triggertype == "load" then + trigger = data.load elseif data.triggers[triggernum] then trigger = data.triggers[triggernum].trigger else - error("Improper argument to WeakAuras.ConstructOptions - trigger number not in range"); + error("Improper argument to WeakAuras.ConstructOptions - trigger number not in range") end - local options = {}; - local order = startorder or 10; + local options = {} + local order = startorder or 10 - local isCollapsedFunctions; + local isCollapsedFunctions local positionsForCollapseAnchor = {} for index, arg in pairs(prototype.args) do - local hidden = nil; - if(arg.collapse and isCollapsedFunctions[arg.collapse] and type(arg.enable) == "function") then + local hidden = nil + if arg.collapse and isCollapsedFunctions[arg.collapse] and type(arg.enable) == "function" then local isCollapsed = isCollapsedFunctions[arg.collapse] hidden = function() return isCollapsed() or not arg.enable(trigger) end - elseif(type(arg.enable) == "function") then - hidden = function() return not arg.enable(trigger) end; - elseif(arg.collapse and isCollapsedFunctions[arg.collapse]) then + elseif type(arg.enable) == "function" then + hidden = function() + return not arg.enable(trigger) + end + elseif arg.collapse and isCollapsedFunctions[arg.collapse] then hidden = isCollapsedFunctions[arg.collapse] positionsForCollapseAnchor[arg.collapse] = order end - local name = arg.name; - local validate = arg.validate; - local reloadOptions = arg.reloadOptions; - if (name and arg.type == "collapse") then + local name = arg.name + local validate = arg.validate + local reloadOptions = arg.reloadOptions + if name and arg.type == "collapse" then options["summary_" .. arg.name] = { type = "execute", control = "WeakAurasExpandSmall", @@ -122,143 +126,157 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum end end, arg = { - expanderName = triggernum .. "#" .. tostring(prototype) .. "#" .. name - } + expanderName = triggernum .. "#" .. tostring(prototype) .. "#" .. name, + }, } - order = order + 1; + order = order + 1 - isCollapsedFunctions = isCollapsedFunctions or {}; + isCollapsedFunctions = isCollapsedFunctions or {} isCollapsedFunctions[name] = function() - return OptionsPrivate.IsCollapsed("trigger", name, "", true); + return OptionsPrivate.IsCollapsed("trigger", name, "", true) end - elseif(name and not arg.hidden) then - local realname = name; - if (arg.type == "multiselect") then + elseif name and not arg.hidden then + local realname = name + if arg.type == "multiselect" then -- Ensure new line for non-toggle options - options["spacer_"..name] = { + options["spacer_" .. name] = { type = "description", width = WeakAuras.doubleWidth, name = "", order = order, hidden = hidden, } - order = order + 1; + order = order + 1 end - if(arg.type == "tristate" or arg.type == "tristatestring") then - options["use_"..name] = { + if arg.type == "tristate" or arg.type == "tristatestring" then + options["use_" .. name] = { type = "toggle", width = WeakAuras.normalWidth, name = function(input) - local value = trigger["use_"..realname]; - if(value == nil) then return arg.display; - elseif(value == false) then return "|cFFFF0000 "..L["Negator"].." "..arg.display.."|r"; - else return "|cFF00FF00"..arg.display.."|r"; end + local value = trigger["use_" .. realname] + if value == nil then + return arg.display + elseif value == false then + return "|cFFFF0000 " .. L["Negator"] .. " " .. arg.display .. "|r" + else + return "|cFF00FF00" .. arg.display .. "|r" + end end, desc = arg.desc, get = function() - local value = trigger["use_"..realname]; - if(value == nil) then return false; - elseif(value == false) then return "false"; - else return "true"; end + local value = trigger["use_" .. realname] + if value == nil then + return false + elseif value == false then + return "false" + else + return "true" + end end, set = function(info, v) - if(v) then - trigger["use_"..realname] = true; + if v then + trigger["use_" .. realname] = true else - local value = trigger["use_"..realname]; - if(value == false) then - trigger["use_"..realname] = nil; + local value = trigger["use_" .. realname] + if value == false then + trigger["use_" .. realname] = nil else - trigger["use_"..realname] = false + trigger["use_" .. realname] = false end end - WeakAuras.Add(data); - if (reloadOptions) then + WeakAuras.Add(data) + if reloadOptions then WeakAuras.ClearAndUpdateOptions(data.id) end - OptionsPrivate.Private.ScanForLoads({[data.id] = true}); - WeakAuras.UpdateThumbnail(data); - OptionsPrivate.SortDisplayButtons(nil, true); + OptionsPrivate.Private.ScanForLoads({ [data.id] = true }) + WeakAuras.UpdateThumbnail(data) + OptionsPrivate.SortDisplayButtons(nil, true) end, hidden = hidden, - order = order - }; - elseif(arg.type == "multiselect") then - options["use_"..name] = { + order = order, + } + elseif arg.type == "multiselect" then + options["use_" .. name] = { type = "toggle", width = WeakAuras.normalWidth, name = arg.display, desc = function() - if arg.multiNoSingle then return arg.desc end - local v = trigger["use_"..realname]; - if(v == true) then - return L["Multiselect single tooltip"]; - elseif(v == false) then - return L["Multiselect multiple tooltip"]; + if arg.multiNoSingle then + return arg.desc + end + local v = trigger["use_" .. realname] + if v == true then + return L["Multiselect single tooltip"] + elseif v == false then + return L["Multiselect multiple tooltip"] else - return L["Multiselect ignored tooltip"]; + return L["Multiselect ignored tooltip"] end end, get = function() - local value = trigger["use_"..realname]; + local value = trigger["use_" .. realname] if arg.multiNoSingle then if value == nil then - return false; + return false else return "false" end else - if(value == nil) then return false; - elseif(value == false) then return "false"; - else return "true"; end + if value == nil then + return false + elseif value == false then + return "false" + else + return "true" + end end end, set = function(info, v) if arg.multiNoSingle then - trigger[realname] = trigger[realname] or {}; - trigger[realname].multi = trigger[realname].multi or {}; + trigger[realname] = trigger[realname] or {} + trigger[realname].multi = trigger[realname].multi or {} if v == true then - trigger["use_"..realname] = false; + trigger["use_" .. realname] = false else - trigger["use_"..realname] = nil; + trigger["use_" .. realname] = nil end else if v then - trigger["use_"..realname] = true; + trigger["use_" .. realname] = true else - local value = trigger["use_"..realname]; - if(value == false) then - trigger["use_"..realname] = nil; + local value = trigger["use_" .. realname] + if value == false then + trigger["use_" .. realname] = nil else - trigger["use_"..realname] = false - trigger[realname] = trigger[realname] or {}; - if(trigger[realname].single) then - trigger[realname].multi = trigger[realname].multi or {}; - trigger[realname].multi[trigger[realname].single] = true; + trigger["use_" .. realname] = false + trigger[realname] = trigger[realname] or {} + if trigger[realname].single then + trigger[realname].multi = trigger[realname].multi or {} + trigger[realname].multi[trigger[realname].single] = true end end end end - WeakAuras.Add(data); - if (reloadOptions) then + WeakAuras.Add(data) + if reloadOptions then WeakAuras.ClearAndUpdateOptions(data.id) end - OptionsPrivate.Private.ScanForLoads({[data.id] = true}); - WeakAuras.UpdateThumbnail(data); - OptionsPrivate.SortDisplayButtons(nil, true); + OptionsPrivate.Private.ScanForLoads({ [data.id] = true }) + WeakAuras.UpdateThumbnail(data) + OptionsPrivate.SortDisplayButtons(nil, true) end, hidden = hidden, - order = order - }; - elseif (arg.type == "description") then - options["description_space_"..name] = { + order = order, + } + elseif arg.type == "description" then + options["description_space_" .. name] = { type = "description", width = WeakAuras.doubleWidth, name = "", order = order, hidden = hidden, } - options["description_title_"..name] = { + options["description_title_" .. name] = { type = "description", width = WeakAuras.doubleWidth, name = arg.display, @@ -266,92 +284,98 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum hidden = hidden, fontSize = "large", } - order = order + 1; - options["description_"..name] = { + order = order + 1 + options["description_" .. name] = { type = "description", width = WeakAuras.doubleWidth, name = arg.text, order = order, hidden = hidden, } - order = order + 1; + order = order + 1 else - options["use_"..name] = { + options["use_" .. name] = { type = "toggle", width = arg.width or WeakAuras.normalWidth, name = arg.display, order = order, hidden = hidden, desc = arg.desc, - get = function() return trigger["use_"..realname]; end, + get = function() + return trigger["use_" .. realname] + end, set = function(info, v) - trigger["use_"..realname] = v; - WeakAuras.Add(data); - if (reloadOptions) then + trigger["use_" .. realname] = v + WeakAuras.Add(data) + if reloadOptions then WeakAuras.ClearAndUpdateOptions(data.id) end - OptionsPrivate.Private.ScanForLoads({[data.id] = true}); - WeakAuras.UpdateThumbnail(data); - OptionsPrivate.SortDisplayButtons(nil, true); - end - }; + OptionsPrivate.Private.ScanForLoads({ [data.id] = true }) + WeakAuras.UpdateThumbnail(data) + OptionsPrivate.SortDisplayButtons(nil, true) + end, + } end - if(arg.type == "toggle" or arg.type == "tristate") then - options["use_"..name].width = arg.width or WeakAuras.doubleWidth; + if arg.type == "toggle" or arg.type == "tristate" then + options["use_" .. name].width = arg.width or WeakAuras.doubleWidth end - if(arg.type == "spell" or arg.type == "aura" or arg.type == "item") then + if arg.type == "spell" or arg.type == "aura" or arg.type == "item" then if not arg.showExactOption then - options["use_"..name].width = arg.width or WeakAuras.normalWidth - 0.1; + options["use_" .. name].width = arg.width or WeakAuras.normalWidth - 0.1 end end - if(arg.type == "toggle") then - options["use_"..name].desc = arg.desc; + if arg.type == "toggle" then + options["use_" .. name].desc = arg.desc end - if(arg.required) then - trigger["use_"..realname] = true; - if not(triggertype) then - options["use_"..name].disabled = true; + if arg.required then + trigger["use_" .. realname] = true + if not triggertype then + options["use_" .. name].disabled = true else - options["use_"..name] = nil; - order = order - 1; + options["use_" .. name] = nil + order = order - 1 end end - order = order + 1; - if(arg.type == "number") then - if (not arg.noOperator) then - options[name.."_operator"] = { + order = order + 1 + if arg.type == "number" then + if not arg.noOperator then + options[name .. "_operator"] = { type = "select", width = WeakAuras.halfWidth, name = L["Operator"], order = order, hidden = hidden, values = arg.operator_types == "without_equal" and OptionsPrivate.Private.operator_types_without_equal or OptionsPrivate.Private.operator_types, - disabled = function() return not trigger["use_"..realname]; end, - get = function() return trigger["use_"..realname] and trigger[realname.."_operator"] or nil; end, + disabled = function() + return not trigger["use_" .. realname] + end, + get = function() + return trigger["use_" .. realname] and trigger[realname .. "_operator"] or nil + end, set = function(info, v) - trigger[realname.."_operator"] = v; - WeakAuras.Add(data); - if (reloadOptions) then + trigger[realname .. "_operator"] = v + WeakAuras.Add(data) + if reloadOptions then WeakAuras.ClearAndUpdateOptions(data.id) end - OptionsPrivate.Private.ScanForLoads({[data.id] = true}); - WeakAuras.UpdateThumbnail(data); - OptionsPrivate.SortDisplayButtons(nil, true); - end - }; - if(arg.required and not triggertype) then - options[name.."_operator"].set = function(info, v) - trigger[realname.."_operator"] = v; - WeakAuras.Add(data); - if (reloadOptions) then + OptionsPrivate.Private.ScanForLoads({ [data.id] = true }) + WeakAuras.UpdateThumbnail(data) + OptionsPrivate.SortDisplayButtons(nil, true) + end, + } + if arg.required and not triggertype then + options[name .. "_operator"].set = function(info, v) + trigger[realname .. "_operator"] = v + WeakAuras.Add(data) + if reloadOptions then WeakAuras.ClearAndUpdateOptions(data.id) end - OptionsPrivate.Private.ScanForLoads({[data.id] = true}); - OptionsPrivate.SortDisplayButtons(nil, true); + OptionsPrivate.Private.ScanForLoads({ [data.id] = true }) + OptionsPrivate.SortDisplayButtons(nil, true) end end - order = order + 1; + order = order + 1 end options[name] = { type = "input", @@ -361,32 +385,36 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum order = order, hidden = hidden, desc = arg.desc, - disabled = function() return not trigger["use_"..realname]; end, - get = function() return trigger["use_"..realname] and trigger[realname] or nil; end, + disabled = function() + return not trigger["use_" .. realname] + end, + get = function() + return trigger["use_" .. realname] and trigger[realname] or nil + end, set = function(info, v) - trigger[realname] = v; - WeakAuras.Add(data); - if (reloadOptions) then + trigger[realname] = v + WeakAuras.Add(data) + if reloadOptions then WeakAuras.ClearAndUpdateOptions(data.id) end - OptionsPrivate.Private.ScanForLoads({[data.id] = true}); - WeakAuras.UpdateThumbnail(data); - OptionsPrivate.SortDisplayButtons(nil, true); - end - }; - if(arg.required and not triggertype) then + OptionsPrivate.Private.ScanForLoads({ [data.id] = true }) + WeakAuras.UpdateThumbnail(data) + OptionsPrivate.SortDisplayButtons(nil, true) + end, + } + if arg.required and not triggertype then options[name].set = function(info, v) - trigger[realname] = v; - WeakAuras.Add(data); - if (reloadOptions) then + trigger[realname] = v + WeakAuras.Add(data) + if reloadOptions then WeakAuras.ClearAndUpdateOptions(data.id) end - OptionsPrivate.Private.ScanForLoads({[data.id] = true}); - OptionsPrivate.SortDisplayButtons(nil, true); + OptionsPrivate.Private.ScanForLoads({ [data.id] = true }) + OptionsPrivate.SortDisplayButtons(nil, true) end end - order = order + 1; - elseif(arg.type == "string" or arg.type == "tristatestring") then + order = order + 1 + elseif arg.type == "string" or arg.type == "tristatestring" then options[name] = { type = "input", width = WeakAuras.normalWidth, @@ -396,70 +424,82 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum validate = validate, desc = arg.desc, set = function(info, v) - trigger[realname] = v; - WeakAuras.Add(data); - if (reloadOptions) then + trigger[realname] = v + WeakAuras.Add(data) + if reloadOptions then WeakAuras.ClearAndUpdateOptions(data.id) end - OptionsPrivate.Private.ScanForLoads({[data.id] = true}); - WeakAuras.UpdateThumbnail(data); - OptionsPrivate.SortDisplayButtons(nil, true); - end - }; + OptionsPrivate.Private.ScanForLoads({ [data.id] = true }) + WeakAuras.UpdateThumbnail(data) + OptionsPrivate.SortDisplayButtons(nil, true) + end, + } if arg.type == "string" then - options[name].disabled = function() return not trigger["use_"..realname] end - options[name].get = function() return trigger["use_"..realname] and trigger[realname] or nil; end + options[name].disabled = function() + return not trigger["use_" .. realname] + end + options[name].get = function() + return trigger["use_" .. realname] and trigger[realname] or nil + end else - options[name].disabled = function() return trigger["use_"..realname] == nil end - options[name].get = function() return trigger["use_"..realname] ~= nil and trigger[realname] or nil; end + options[name].disabled = function() + return trigger["use_" .. realname] == nil + end + options[name].get = function() + return trigger["use_" .. realname] ~= nil and trigger[realname] or nil + end end - if(arg.required and not triggertype) then + if arg.required and not triggertype then options[name].set = function(info, v) - trigger[realname] = v; - WeakAuras.Add(data); - if (reloadOptions) then + trigger[realname] = v + WeakAuras.Add(data) + if reloadOptions then WeakAuras.ClearAndUpdateOptions(data.id) end - OptionsPrivate.Private.ScanForLoads({[data.id] = true}); - OptionsPrivate.SortDisplayButtons(nil, true); + OptionsPrivate.Private.ScanForLoads({ [data.id] = true }) + OptionsPrivate.SortDisplayButtons(nil, true) end end - order = order + 1; - elseif(arg.type == "longstring") then - options[name.."_operator"] = { + order = order + 1 + elseif arg.type == "longstring" then + options[name .. "_operator"] = { type = "select", width = WeakAuras.normalWidth, name = L["Operator"], order = order, hidden = hidden, values = OptionsPrivate.Private.string_operator_types, - disabled = function() return not trigger["use_"..realname]; end, - get = function() return trigger["use_"..realname] and trigger[realname.."_operator"] or nil; end, + disabled = function() + return not trigger["use_" .. realname] + end, + get = function() + return trigger["use_" .. realname] and trigger[realname .. "_operator"] or nil + end, set = function(info, v) - trigger[realname.."_operator"] = v; - WeakAuras.Add(data); - if (reloadOptions) then + trigger[realname .. "_operator"] = v + WeakAuras.Add(data) + if reloadOptions then WeakAuras.ClearAndUpdateOptions(data.id) end - OptionsPrivate.Private.ScanForLoads({[data.id] = true}); - WeakAuras.UpdateThumbnail(data); - OptionsPrivate.SortDisplayButtons(nil, true); - end - }; - if(arg.required and not triggertype) then - options[name.."_operator"].set = function(info, v) - trigger[realname.."_operator"] = v; - WeakAuras.Add(data); - if (reloadOptions) then + OptionsPrivate.Private.ScanForLoads({ [data.id] = true }) + WeakAuras.UpdateThumbnail(data) + OptionsPrivate.SortDisplayButtons(nil, true) + end, + } + if arg.required and not triggertype then + options[name .. "_operator"].set = function(info, v) + trigger[realname .. "_operator"] = v + WeakAuras.Add(data) + if reloadOptions then WeakAuras.ClearAndUpdateOptions(data.id) end - OptionsPrivate.Private.ScanForLoads({[data.id] = true}); - OptionsPrivate.SortDisplayButtons(nil, true); + OptionsPrivate.Private.ScanForLoads({ [data.id] = true }) + OptionsPrivate.SortDisplayButtons(nil, true) end end - order = order + 1; + order = order + 1 options[name] = { type = "input", width = WeakAuras.doubleWidth, @@ -467,77 +507,87 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum order = order, hidden = hidden, validate = validate, - disabled = function() return not trigger["use_"..realname]; end, - get = function() return trigger["use_"..realname] and trigger[realname] or nil; end, + disabled = function() + return not trigger["use_" .. realname] + end, + get = function() + return trigger["use_" .. realname] and trigger[realname] or nil + end, set = function(info, v) - trigger[realname] = v; - WeakAuras.Add(data); - if (reloadOptions) then + trigger[realname] = v + WeakAuras.Add(data) + if reloadOptions then WeakAuras.ClearAndUpdateOptions(data.id) end - OptionsPrivate.Private.ScanForLoads({[data.id] = true}); - WeakAuras.UpdateThumbnail(data); - OptionsPrivate.SortDisplayButtons(nil, true); - end - }; - if(arg.required and not triggertype) then + OptionsPrivate.Private.ScanForLoads({ [data.id] = true }) + WeakAuras.UpdateThumbnail(data) + OptionsPrivate.SortDisplayButtons(nil, true) + end, + } + if arg.required and not triggertype then options[name].set = function(info, v) - trigger[realname] = v; - WeakAuras.Add(data); - if (reloadOptions) then + trigger[realname] = v + WeakAuras.Add(data) + if reloadOptions then WeakAuras.ClearAndUpdateOptions(data.id) end - OptionsPrivate.Private.ScanForLoads({[data.id] = true}); - OptionsPrivate.SortDisplayButtons(nil, true); + OptionsPrivate.Private.ScanForLoads({ [data.id] = true }) + OptionsPrivate.SortDisplayButtons(nil, true) end end - order = order + 1; - elseif(arg.type == "spell" or arg.type == "aura" or arg.type == "item") then - if (arg.showExactOption) then - options["exact"..name] = { + order = order + 1 + elseif arg.type == "spell" or arg.type == "aura" or arg.type == "item" then + if arg.showExactOption then + options["exact" .. name] = { type = "toggle", width = WeakAuras.normalWidth - 0.1, name = L["Exact Spell Match"], order = order, hidden = hidden, get = function() - return trigger["use_exact_"..realname]; + return trigger["use_exact_" .. realname] end, set = function(info, v) - trigger["use_exact_"..realname] = v; - WeakAuras.Add(data); - OptionsPrivate.Private.ScanForLoads({[data.id] = true}); - WeakAuras.UpdateThumbnail(data); - OptionsPrivate.SortDisplayButtons(nil, true); + trigger["use_exact_" .. realname] = v + WeakAuras.Add(data) + OptionsPrivate.Private.ScanForLoads({ [data.id] = true }) + WeakAuras.UpdateThumbnail(data) + OptionsPrivate.SortDisplayButtons(nil, true) end, - }; - order = order + 1; + } + order = order + 1 end - options["icon"..name] = { + options["icon" .. name] = { type = "execute", width = 0.1, name = "", order = order, hidden = hidden, image = function() - if(trigger["use_"..realname] and trigger[realname]) then - if(arg.type == "aura") then - local icon = spellCache.GetIcon(trigger[realname]); - return icon and tostring(icon) or "", 18, 18; - elseif(arg.type == "spell") then - local _, _, icon = GetSpellInfo(trigger[realname]); - return icon and tostring(icon) or "", 18, 18; - elseif(arg.type == "item") then - local _, _, _, _, _, _, _, _, _, icon = GetItemInfo(trigger[realname]); - return icon and tostring(icon) or "", 18, 18; + if trigger["use_" .. realname] and trigger[realname] then + if arg.type == "aura" then + local icon = spellCache.GetIcon(trigger[realname]) + return icon and tostring(icon) or "", 18, 18 + elseif arg.type == "spell" then + local _, _, icon = GetSpellInfo(trigger[realname]) + return icon and tostring(icon) or "", 18, 18 + elseif arg.type == "item" then + local _, _, _, _, _, _, _, _, _, icon = GetItemInfo(trigger[realname]) + return icon and tostring(icon) or "", 18, 18 end else - return "", 18, 18; + return "", 18, 18 end end, - disabled = function() return not ((arg.type == "aura" and trigger[realname] and spellCache.GetIcon(trigger[realname])) or (arg.type == "spell" and trigger[realname] and GetSpellInfo(trigger[realname])) or (arg.type == "item" and trigger[realname] and GetItemIcon(trigger[realname]))) end - }; - order = order + 1; + disabled = function() + return not ( + (arg.type == "aura" and trigger[realname] and spellCache.GetIcon(trigger[realname])) + or (arg.type == "spell" and trigger[realname] and GetSpellInfo(trigger[realname])) + or (arg.type == "item" and trigger[realname] and GetItemIcon(trigger[realname])) + ) + end, + } + order = order + 1 options[name] = { type = "input", width = arg.showExactOption and WeakAuras.doubleWidth or WeakAuras.normalWidth, @@ -545,76 +595,78 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum order = order, hidden = hidden, validate = validate, - disabled = function() return not trigger["use_"..realname]; end, + disabled = function() + return not trigger["use_" .. realname] + end, get = function() - if(arg.type == "item") then - if(trigger["use_"..realname] and trigger[realname] and trigger[realname] ~= "") then - local name = GetItemInfo(trigger[realname]); - if(name) then - return name; + if arg.type == "item" then + if trigger["use_" .. realname] and trigger[realname] and trigger[realname] ~= "" then + local name = GetItemInfo(trigger[realname]) + if name then + return name else local itemId = tonumber(trigger[realname]) if itemId and itemId ~= 0 then return tostring(trigger[realname]) end - return L["Invalid Item Name/ID/Link"]; + return L["Invalid Item Name/ID/Link"] end else - return nil; + return nil end - elseif(arg.type == "spell") then - local useExactSpellId = (arg.showExactOption and trigger["use_exact_"..realname]) - if(trigger["use_"..realname]) then - if (trigger[realname] and trigger[realname] ~= "") then + elseif arg.type == "spell" then + local useExactSpellId = (arg.showExactOption and trigger["use_exact_" .. realname]) + if trigger["use_" .. realname] then + if trigger[realname] and trigger[realname] ~= "" then if useExactSpellId then local spellId = tonumber(trigger[realname]) - if (spellId and spellId ~= 0) then - return tostring(spellId); + if spellId and spellId ~= 0 then + return tostring(spellId) end else - local name = GetSpellInfo(trigger[realname]); - if(name) then - return name; + local name = GetSpellInfo(trigger[realname]) + if name then + return name end end end - return useExactSpellId and L["Invalid Spell ID"] or L["Invalid Spell Name/ID/Link"]; + return useExactSpellId and L["Invalid Spell ID"] or L["Invalid Spell Name/ID/Link"] else - return nil; + return nil end else - return trigger["use_"..realname] and trigger[realname] or nil; + return trigger["use_" .. realname] and trigger[realname] or nil end end, set = function(info, v) - local fixedInput = v; - if(arg.type == "aura") then - fixedInput = WeakAuras.spellCache.CorrectAuraName(v); - elseif(arg.type == "spell") then - fixedInput = CorrectSpellName(v); - elseif(arg.type == "item") then - fixedInput = CorrectItemName(v); - end - trigger[realname] = fixedInput; - WeakAuras.Add(data); - if (reloadOptions) then + local fixedInput = v + if arg.type == "aura" then + fixedInput = WeakAuras.spellCache.CorrectAuraName(v) + elseif arg.type == "spell" then + fixedInput = CorrectSpellName(v) + elseif arg.type == "item" then + fixedInput = CorrectItemName(v) + end + trigger[realname] = fixedInput + WeakAuras.Add(data) + if reloadOptions then WeakAuras.ClearAndUpdateOptions(data.id) end - OptionsPrivate.Private.ScanForLoads({[data.id] = true}); - WeakAuras.UpdateThumbnail(data); - OptionsPrivate.SortDisplayButtons(nil, true); - end - }; - order = order + 1; - elseif(arg.type == "select" or arg.type == "unit") then - local values; - if(type(arg.values) == "function") then - values = arg.values(trigger); + OptionsPrivate.Private.ScanForLoads({ [data.id] = true }) + WeakAuras.UpdateThumbnail(data) + OptionsPrivate.SortDisplayButtons(nil, true) + end, + } + order = order + 1 + elseif arg.type == "select" or arg.type == "unit" then + local values + if type(arg.values) == "function" then + values = arg.values(trigger) else if OptionsPrivate.Private[arg.values] then values = OptionsPrivate.Private[arg.values] else - values = WeakAuras[arg.values]; + values = WeakAuras[arg.values] end end options[name] = { @@ -625,103 +677,117 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum hidden = hidden, values = values, desc = arg.desc, - disabled = function() return not trigger["use_"..realname]; end, + disabled = function() + return not trigger["use_" .. realname] + end, get = function() - if(arg.type == "unit" and trigger["use_specific_"..realname]) then - return "member"; + if arg.type == "unit" and trigger["use_specific_" .. realname] then + return "member" end - if (not trigger["use_"..realname]) then - return nil; + if not trigger["use_" .. realname] then + return nil end - if (arg.default and (not trigger[realname] or not values[trigger[realname]])) then - trigger[realname] = arg.default; - return arg.default; + if arg.default and (not trigger[realname] or not values[trigger[realname]]) then + trigger[realname] = arg.default + return arg.default end - return trigger[realname] or nil; + return trigger[realname] or nil end, set = function(info, v) - trigger[realname] = v; - if(arg.type == "unit" and v == "member") then - trigger["use_specific_"..realname] = true; - trigger[realname] = UnitName("player"); + trigger[realname] = v + if arg.type == "unit" and v == "member" then + trigger["use_specific_" .. realname] = true + trigger[realname] = UnitName("player") else - trigger["use_specific_"..realname] = nil; + trigger["use_specific_" .. realname] = nil end - WeakAuras.Add(data); - if (reloadOptions) then + WeakAuras.Add(data) + if reloadOptions then WeakAuras.ClearAndUpdateOptions(data.id) end - OptionsPrivate.Private.ScanForLoads({[data.id] = true}); - WeakAuras.UpdateThumbnail(data); - OptionsPrivate.SortDisplayButtons(nil, true); - end - }; - if(arg.required and not triggertype) then + OptionsPrivate.Private.ScanForLoads({ [data.id] = true }) + WeakAuras.UpdateThumbnail(data) + OptionsPrivate.SortDisplayButtons(nil, true) + end, + } + if arg.required and not triggertype then options[name].set = function(info, v) - trigger[realname] = v; - if(arg.type == "unit" and v == "member") then - trigger["use_specific_"..realname] = true; + trigger[realname] = v + if arg.type == "unit" and v == "member" then + trigger["use_specific_" .. realname] = true else - trigger["use_specific_"..realname] = nil; + trigger["use_specific_" .. realname] = nil end - WeakAuras.Add(data); - if (reloadOptions) then + WeakAuras.Add(data) + if reloadOptions then WeakAuras.ClearAndUpdateOptions(data.id) end - OptionsPrivate.Private.ScanForLoads({[data.id] = true}); - WeakAuras.UpdateThumbnail(data); - OptionsPrivate.SortDisplayButtons(nil, true); + OptionsPrivate.Private.ScanForLoads({ [data.id] = true }) + WeakAuras.UpdateThumbnail(data) + OptionsPrivate.SortDisplayButtons(nil, true) end end - if (arg.control) then - options[name].control = arg.control; + if arg.control then + options[name].control = arg.control end - order = order + 1; - if(arg.type == "unit") then - options["use_specific_"..name] = { + order = order + 1 + if arg.type == "unit" then + options["use_specific_" .. name] = { type = "toggle", width = WeakAuras.normalWidth, name = L["Specific Unit"], order = order, - hidden = function() return (not trigger["use_specific_"..realname] and trigger[realname] ~= "member") or (type(hidden) == "function" and hidden(trigger)) or (type(hidden) ~= "function" and hidden) end, - get = function() return true end, + hidden = function() + return (not trigger["use_specific_" .. realname] and trigger[realname] ~= "member") + or (type(hidden) == "function" and hidden(trigger)) + or (type(hidden) ~= "function" and hidden) + end, + get = function() + return true + end, set = function(info, v) - trigger["use_specific_"..realname] = nil; - options[name].set(info, "player"); + trigger["use_specific_" .. realname] = nil + options[name].set(info, "player") WeakAuras.Add(data) - end + end, } - order = order + 1; - options["specific_"..name] = { + order = order + 1 + options["specific_" .. name] = { type = "input", width = WeakAuras.normalWidth, name = L["Specific Unit"], desc = L["Can be a UID (e.g., party1)."], order = order, - hidden = function() return (not trigger["use_specific_"..realname] and trigger[realname] ~= "member") or (type(hidden) == "function" and hidden(trigger)) or (type(hidden) ~= "function" and hidden) end, - get = function() return trigger[realname] end, + hidden = function() + return (not trigger["use_specific_" .. realname] and trigger[realname] ~= "member") + or (type(hidden) == "function" and hidden(trigger)) + or (type(hidden) ~= "function" and hidden) + end, + get = function() + return trigger[realname] + end, set = function(info, v) - trigger[realname] = v; - WeakAuras.Add(data); - if (reloadOptions) then + trigger[realname] = v + WeakAuras.Add(data) + if reloadOptions then WeakAuras.ClearAndUpdateOptions(data.id) end - end - }; - order = order + 1; + end, + } + order = order + 1 end - elseif(arg.type == "multiselect") then - local values; - if(type(arg.values) == "function") then - values = arg.values(trigger); + elseif arg.type == "multiselect" then + local values + if type(arg.values) == "function" then + values = arg.values(trigger) else if OptionsPrivate.Private[arg.values] then values = OptionsPrivate.Private[arg.values] else - values = WeakAuras[arg.values]; + values = WeakAuras[arg.values] end end options[name] = { @@ -732,107 +798,114 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum values = values, control = arg.control, hidden = function() - return (type(hidden) == "function" and hidden(trigger)) or (type(hidden) ~= "function" and hidden) or trigger["use_"..realname] == false; + return (type(hidden) == "function" and hidden(trigger)) or (type(hidden) ~= "function" and hidden) or trigger["use_" .. realname] == false + end, + disabled = function() + return not trigger["use_" .. realname] + end, + get = function() + return trigger["use_" .. realname] and trigger[realname] and trigger[realname].single or nil end, - disabled = function() return not trigger["use_"..realname]; end, - get = function() return trigger["use_"..realname] and trigger[realname] and trigger[realname].single or nil; end, set = function(info, v) - trigger[realname] = trigger[realname] or {}; - trigger[realname].single = v; - WeakAuras.Add(data); - if (reloadOptions) then + trigger[realname] = trigger[realname] or {} + trigger[realname].single = v + WeakAuras.Add(data) + if reloadOptions then WeakAuras.ClearAndUpdateOptions(data.id) end - OptionsPrivate.Private.ScanForLoads({[data.id] = true}); - WeakAuras.UpdateThumbnail(data); - OptionsPrivate.SortDisplayButtons(nil, true); - end - }; - if(arg.required and not triggertype) then + OptionsPrivate.Private.ScanForLoads({ [data.id] = true }) + WeakAuras.UpdateThumbnail(data) + OptionsPrivate.SortDisplayButtons(nil, true) + end, + } + if arg.required and not triggertype then options[name].set = function(info, v) - trigger[realname].single = v; - WeakAuras.Add(data); - if (reloadOptions) then + trigger[realname].single = v + WeakAuras.Add(data) + if reloadOptions then WeakAuras.ClearAndUpdateOptions(data.id) end - OptionsPrivate.Private.ScanForLoads({[data.id] = true}); - WeakAuras.UpdateThumbnail(data); - OptionsPrivate.SortDisplayButtons(nil, true); + OptionsPrivate.Private.ScanForLoads({ [data.id] = true }) + WeakAuras.UpdateThumbnail(data) + OptionsPrivate.SortDisplayButtons(nil, true) end end if arg.extraOption then - options["multiselect_extraOption_" .. name] = - { + options["multiselect_extraOption_" .. name] = { name = arg.extraOption.display, type = "select", values = arg.extraOption.values, order = order, width = WeakAuras.normalWidth, - hidden = function() return (type(hidden) == "function" and hidden(trigger)) or (type(hidden) ~= "function" and hidden) or trigger["use_"..realname] ~= false; end, + hidden = function() + return (type(hidden) == "function" and hidden(trigger)) or (type(hidden) ~= "function" and hidden) or trigger["use_" .. realname] ~= false + end, get = function(info, v) return trigger[realname .. "_extraOption"] or 0 end, set = function(info, v) trigger[realname .. "_extraOption"] = v WeakAuras.Add(data) - OptionsPrivate.Private.ScanForLoads({[data.id] = true}) + OptionsPrivate.Private.ScanForLoads({ [data.id] = true }) OptionsPrivate.SortDisplayButtons(nil, true) - end + end, } order = order + 1 end - options["multiselect_"..name] = { + options["multiselect_" .. name] = { type = "multiselect", name = arg.display, width = WeakAuras.doubleWidth, order = order, - hidden = function() return (type(hidden) == "function" and hidden(trigger)) or (type(hidden) ~= "function" and hidden) or trigger["use_"..realname] ~= false; end, + hidden = function() + return (type(hidden) == "function" and hidden(trigger)) or (type(hidden) ~= "function" and hidden) or trigger["use_" .. realname] ~= false + end, values = values, control = arg.multiUseControlWhenFalse and arg.control, multiTristate = arg.multiTristate, get = function(info, v) - if(trigger["use_"..realname] == false and trigger[realname] and trigger[realname].multi) then - return trigger[realname].multi[v]; + if trigger["use_" .. realname] == false and trigger[realname] and trigger[realname].multi then + return trigger[realname].multi[v] end end, set = function(info, v, calledFromSetAll) - trigger[realname].multi = trigger[realname].multi or {}; - if (calledFromSetAll or arg.multiTristate) then - trigger[realname].multi[v] = calledFromSetAll; - elseif(trigger[realname].multi[v]) then - trigger[realname].multi[v] = nil; + trigger[realname].multi = trigger[realname].multi or {} + if calledFromSetAll or arg.multiTristate then + trigger[realname].multi[v] = calledFromSetAll + elseif trigger[realname].multi[v] then + trigger[realname].multi[v] = nil else - trigger[realname].multi[v] = true; + trigger[realname].multi[v] = true end - WeakAuras.Add(data); - if (reloadOptions) then + WeakAuras.Add(data) + if reloadOptions then WeakAuras.ClearAndUpdateOptions(data.id) end - OptionsPrivate.Private.ScanForLoads({[data.id] = true}); - WeakAuras.UpdateThumbnail(data); - OptionsPrivate.SortDisplayButtons(nil, true); - end - }; - if(arg.required and not triggertype) then + OptionsPrivate.Private.ScanForLoads({ [data.id] = true }) + WeakAuras.UpdateThumbnail(data) + OptionsPrivate.SortDisplayButtons(nil, true) + end, + } + if arg.required and not triggertype then options[name].set = function(info, v) - if(trigger[realname].multi[v]) then - trigger[realname].multi[v] = nil; + if trigger[realname].multi[v] then + trigger[realname].multi[v] = nil else - trigger[realname].multi[v] = true; + trigger[realname].multi[v] = true end - WeakAuras.Add(data); - if (reloadOptions) then + WeakAuras.Add(data) + if reloadOptions then WeakAuras.ClearAndUpdateOptions(data.id) end - OptionsPrivate.Private.ScanForLoads({[data.id] = true}); - WeakAuras.UpdateThumbnail(data); - OptionsPrivate.SortDisplayButtons(nil, true); + OptionsPrivate.Private.ScanForLoads({ [data.id] = true }) + WeakAuras.UpdateThumbnail(data) + OptionsPrivate.SortDisplayButtons(nil, true) end end - order = order + 1; + order = order + 1 end end end @@ -849,9 +922,9 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum end, set = function(info, v) -- unevent is no longer used - end - }; - order = order + 1; + end, + } + order = order + 1 options.duration = { type = "input", @@ -866,7 +939,7 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum WeakAuras.Add(data) end, } - order = order + 1; + order = order + 1 end for name, order in pairs(positionsForCollapseAnchor) do @@ -876,13 +949,13 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum control = "WeakAurasExpandAnchor", order = order + 0.5, arg = { - expanderName = triggernum .. "#" .. tostring(prototype) .. "#" .. name + expanderName = triggernum .. "#" .. tostring(prototype) .. "#" .. name, }, - hidden = isCollapsedFunctions[name] + hidden = isCollapsedFunctions[name], } end - return options; + return options end function OptionsPrivate.GetLoadOptions(data) @@ -890,36 +963,44 @@ function OptionsPrivate.GetLoadOptions(data) type = "group", name = L["Load"], order = 0, - get = function(info) return data.load[info[#info]] end, + get = function(info) + return data.load[info[#info]] + end, set = function(info, v) - data.load[info[#info]] = (v ~= "" and v) or nil; - WeakAuras.Add(data); - WeakAuras.UpdateThumbnail(data); - OptionsPrivate.Private.ScanForLoads({[data.id] = true}); - OptionsPrivate.SortDisplayButtons(nil, true); - end, - args = {} - } + data.load[info[#info]] = (v ~= "" and v) or nil + WeakAuras.Add(data) + WeakAuras.UpdateThumbnail(data) + OptionsPrivate.Private.ScanForLoads({ [data.id] = true }) + OptionsPrivate.SortDisplayButtons(nil, true) + end, + args = {}, + } - load.args = OptionsPrivate.ConstructOptions(OptionsPrivate.Private.load_prototype, data, 10, nil, "load"); + load.args = OptionsPrivate.ConstructOptions(OptionsPrivate.Private.load_prototype, data, 10, nil, "load") - if(data.controlledChildren) then - removeFuncs(load); - replaceNameDescFuncs(load, data, "load"); - replaceImageFuncs(load, data, "load"); - replaceValuesFuncs(load, data, "load"); + if data.controlledChildren then + removeFuncs(load) + replaceNameDescFuncs(load, data, "load") + replaceImageFuncs(load, data, "load") + replaceValuesFuncs(load, data, "load") - load.get = function(info, ...) return getAll(data, info, ...); end; - load.set = function(info, ...) - setAll(data, info, ...); - if(type(data.id) == "string") then - WeakAuras.Add(data); - WeakAuras.UpdateThumbnail(data); - OptionsPrivate.ResetMoverSizer(); - end + load.get = function(info, ...) + return getAll(data, info, ...) + end + load.set = function(info, ...) + setAll(data, info, ...) + if type(data.id) == "string" then + WeakAuras.Add(data) + WeakAuras.UpdateThumbnail(data) + OptionsPrivate.ResetMoverSizer() end - load.hidden = function(info, ...) return hiddenAll(data, info, ...); end; - load.disabled = function(info, ...) return disabledAll(data, info, ...); end; end - return load + load.hidden = function(info, ...) + return hiddenAll(data, info, ...) + end + load.disabled = function(info, ...) + return disabledAll(data, info, ...) + end + end + return load end diff --git a/WeakAurasOptions/Locales/deDE.lua b/WeakAurasOptions/Locales/deDE.lua index fb18baaf80..5af5d48bca 100644 --- a/WeakAurasOptions/Locales/deDE.lua +++ b/WeakAurasOptions/Locales/deDE.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end if GetLocale() ~= "deDE" then return @@ -7,4 +9,3 @@ end local L = WeakAuras.L --@localization(locale="deDE", format="lua_additive_table", namespace="WeakAuras / Options")@ - diff --git a/WeakAurasOptions/Locales/enUS.lua b/WeakAurasOptions/Locales/enUS.lua index 4c19d58b58..0b41eaa15c 100644 --- a/WeakAurasOptions/Locales/enUS.lua +++ b/WeakAurasOptions/Locales/enUS.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local L = WeakAuras.L @@ -65,7 +67,8 @@ L["Border Size"] = "Border Size" L["Border Style"] = "Border Style" L["Bottom Text"] = "Bottom Text" L["Button Glow"] = "Button Glow" -L["Can be a name or a UID (e.g., party1). A name only works on friendly players in your group."] = "Can be a name or a UID (e.g., party1). A name only works on friendly players in your group." +L["Can be a name or a UID (e.g., party1). A name only works on friendly players in your group."] = + "Can be a name or a UID (e.g., party1). A name only works on friendly players in your group." L["Cancel"] = "Cancel" L["Cat"] = "Cat" L["Change the name of this display"] = "Change the name of this display" @@ -286,7 +289,8 @@ L["Player Character"] = "Player Character" L["Play Sound"] = "Play Sound" L["Presence (DK)"] = "Presence" L["Presence (Rogue)"] = "Presence" -L["Prevents duration information from decreasing when an aura refreshes. May cause problems if used with multiple auras with different durations."] = "Prevents duration information from decreasing when an aura refreshes. May cause problems if used with multiple auras with different durations." +L["Prevents duration information from decreasing when an aura refreshes. May cause problems if used with multiple auras with different durations."] = + "Prevents duration information from decreasing when an aura refreshes. May cause problems if used with multiple auras with different durations." L["Primary"] = "Primary" L["Progress Bar"] = "Progress Bar" L["Progress Texture"] = "Progress Texture" @@ -324,7 +328,8 @@ L["Shows a custom texture"] = "Shows a custom texture" L["Shows a progress bar with name, timer, and icon"] = "Shows a progress bar with name, timer, and icon" L["Shows a spell icon with an optional cooldown overlay"] = "Shows a spell icon with an optional cooldown overlay" L["Shows a texture that changes based on duration"] = "Shows a texture that changes based on duration" -L["Shows one or more lines of text, which can include dynamic information such as progress or stacks"] = "Shows one or more lines of text, which can include dynamic information such as progress or stacks" +L["Shows one or more lines of text, which can include dynamic information such as progress or stacks"] = + "Shows one or more lines of text, which can include dynamic information such as progress or stacks" L["Shows the remaining or expended time for an aura or timed event"] = "Shows the remaining or expended time for an aura or timed event" L["Show this group's children"] = "Show this group's children" L["Size"] = "Size" @@ -362,7 +367,8 @@ L["Text Position"] = "Text Position" L["Text Settings"] = "Text Settings" L["Texture"] = "Texture" L["Texture Info"] = "Texture Info" -L["The children of this group have different display types, so their display options cannot be set as a group."] = "The children of this group have different display types, so their display options cannot be set as a group." +L["The children of this group have different display types, so their display options cannot be set as a group."] = + "The children of this group have different display types, so their display options cannot be set as a group." L["The duration of the animation in seconds."] = "The duration of the animation in seconds." L["The type of trigger"] = "The type of trigger" L["This condition will not be tested"] = "This condition will not be tested" @@ -392,7 +398,8 @@ L["Type"] = "Type" L["Ungroup"] = "Ungroup" L["Unholy"] = "Unholy" L["Unit Exists"] = "Unit Exists" -L["Unlike the start or finish animations, the main animation will loop over and over until the display is hidden."] = "Unlike the start or finish animations, the main animation will loop over and over until the display is hidden." +L["Unlike the start or finish animations, the main animation will loop over and over until the display is hidden."] = + "Unlike the start or finish animations, the main animation will loop over and over until the display is hidden." L["Unstealthed"] = "Unstealthed" L["Update Custom Text On..."] = "Update Custom Text On..." L["Use Full Scan (High CPU)"] = "Use Full Scan (High CPU)" diff --git a/WeakAurasOptions/Locales/esES.lua b/WeakAurasOptions/Locales/esES.lua index 006ef3f07e..27fac432ca 100644 --- a/WeakAurasOptions/Locales/esES.lua +++ b/WeakAurasOptions/Locales/esES.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end if GetLocale() ~= "esES" then return diff --git a/WeakAurasOptions/Locales/esMX.lua b/WeakAurasOptions/Locales/esMX.lua index d29a653078..19850b364e 100644 --- a/WeakAurasOptions/Locales/esMX.lua +++ b/WeakAurasOptions/Locales/esMX.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end if GetLocale() ~= "esMX" then return diff --git a/WeakAurasOptions/Locales/frFR.lua b/WeakAurasOptions/Locales/frFR.lua index e4e4c7050c..2fc79bd39d 100644 --- a/WeakAurasOptions/Locales/frFR.lua +++ b/WeakAurasOptions/Locales/frFR.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end if GetLocale() ~= "frFR" then return diff --git a/WeakAurasOptions/Locales/itIT.lua b/WeakAurasOptions/Locales/itIT.lua index 5616d28ba0..fa67a781de 100644 --- a/WeakAurasOptions/Locales/itIT.lua +++ b/WeakAurasOptions/Locales/itIT.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end if GetLocale() ~= "itIT" then return diff --git a/WeakAurasOptions/Locales/koKR.lua b/WeakAurasOptions/Locales/koKR.lua index e85edd7005..dad6a15d6e 100644 --- a/WeakAurasOptions/Locales/koKR.lua +++ b/WeakAurasOptions/Locales/koKR.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end if GetLocale() ~= "koKR" then return diff --git a/WeakAurasOptions/Locales/ptBR.lua b/WeakAurasOptions/Locales/ptBR.lua index 74a38c53b0..5dcfb8f66e 100644 --- a/WeakAurasOptions/Locales/ptBR.lua +++ b/WeakAurasOptions/Locales/ptBR.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end if GetLocale() ~= "ptBR" then return diff --git a/WeakAurasOptions/Locales/ruRU.lua b/WeakAurasOptions/Locales/ruRU.lua index dbd1ca2ffd..9e0fa3c6d5 100644 --- a/WeakAurasOptions/Locales/ruRU.lua +++ b/WeakAurasOptions/Locales/ruRU.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end if GetLocale() ~= "ruRU" then return diff --git a/WeakAurasOptions/Locales/zhCN.lua b/WeakAurasOptions/Locales/zhCN.lua index f2001e7aa6..0280c22a54 100644 --- a/WeakAurasOptions/Locales/zhCN.lua +++ b/WeakAurasOptions/Locales/zhCN.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end if GetLocale() ~= "zhCN" then return diff --git a/WeakAurasOptions/Locales/zhTW.lua b/WeakAurasOptions/Locales/zhTW.lua index dd62c4a148..1f359220b8 100644 --- a/WeakAurasOptions/Locales/zhTW.lua +++ b/WeakAurasOptions/Locales/zhTW.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end if GetLocale() ~= "zhTW" then return diff --git a/WeakAurasOptions/OptionsFrames/CodeReview.lua b/WeakAurasOptions/OptionsFrames/CodeReview.lua index 7c0ff40d77..493e1459a6 100644 --- a/WeakAurasOptions/OptionsFrames/CodeReview.lua +++ b/WeakAurasOptions/OptionsFrames/CodeReview.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... -- Lua APIs @@ -56,12 +58,12 @@ local colorScheme = { } local function ConstructCodeReview(frame) - local group = AceGUI:Create("WeakAurasInlineGroup"); - group.frame:SetParent(frame); - group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 16, -16); - group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -16, 46); - group.frame:Hide(); - group:SetLayout("flow"); + local group = AceGUI:Create("WeakAurasInlineGroup") + group.frame:SetParent(frame) + group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 16, -16) + group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -16, 46) + group.frame:Hide() + group:SetLayout("flow") local title = AceGUI:Create("Label") title:SetFontObject(GameFontNormalHuge) @@ -69,7 +71,7 @@ local function ConstructCodeReview(frame) title:SetText(L["Custom Code Viewer"]) group:AddChild(title) - local codeTree = AceGUI:Create("TreeGroup"); + local codeTree = AceGUI:Create("TreeGroup") codeTree:SetTreeWidth(300, false) codeTree:SetFullWidth(true) codeTree:SetFullHeight(true) @@ -77,37 +79,39 @@ local function ConstructCodeReview(frame) codeTree.dragger:Hide() codeTree.border:SetBackdrop(nil) codeTree.content:SetAllPoints() - group.codeTree = codeTree; - group:AddChild(codeTree); + group.codeTree = codeTree + group:AddChild(codeTree) - local codebox = AceGUI:Create("MultiLineEditBox"); - codebox:SetLabel(""); + local codebox = AceGUI:Create("MultiLineEditBox") + codebox:SetLabel("") codebox:DisableButton(true) codebox:SetFullWidth(true) codebox:SetFullHeight(true) codeTree:AddChild(codebox) - IndentationLib.enable(codebox.editBox, colorScheme, 4); - local fontPath = SharedMedia:Fetch("font", "Fira Mono Medium"); - if(fontPath) then - codebox.editBox:SetFont(fontPath, 12); + IndentationLib.enable(codebox.editBox, colorScheme, 4) + local fontPath = SharedMedia:Fetch("font", "Fira Mono Medium") + if fontPath then + codebox.editBox:SetFont(fontPath, 12) end - group.codebox = codebox; + group.codebox = codebox codeTree:SetCallback("OnGroupSelected", function(self, event, value) for _, v in pairs(group.data) do - if (v.value == value) then - codebox:SetText(v.code); + if v.value == value then + codebox:SetText(v.code) end end - end); + end) - local cancel = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate"); - cancel:SetScript("OnClick", function() group:Close() end); - cancel:SetPoint("BOTTOMRIGHT", -20, -24); - cancel:SetHeight(20); - cancel:SetWidth(100); - cancel:SetText(L["Okay"]); + local cancel = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate") + cancel:SetScript("OnClick", function() + group:Close() + end) + cancel:SetPoint("BOTTOMRIGHT", -20, -24) + cancel:SetHeight(20) + cancel:SetWidth(100) + cancel:SetText(L["Okay"]) function group.Open(self, data) if frame.window == "codereview" then @@ -115,16 +119,16 @@ local function ConstructCodeReview(frame) end local _, firstEntry = next(data) - self.data = data; - self.codeTree:SetTree(data); + self.data = data + self.codeTree:SetTree(data) self.codeTree:SelectByValue(firstEntry.value) - frame.window = "codereview"; + frame.window = "codereview" frame:UpdateFrameVisible() end function group.Close() - frame.window = "update"; + frame.window = "update" frame:UpdateFrameVisible() end diff --git a/WeakAurasOptions/OptionsFrames/DebugLogFrame.lua b/WeakAurasOptions/OptionsFrames/DebugLogFrame.lua index a5f3411a6b..fb95211838 100644 --- a/WeakAurasOptions/OptionsFrames/DebugLogFrame.lua +++ b/WeakAurasOptions/OptionsFrames/DebugLogFrame.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... -- Lua APIs @@ -15,12 +17,12 @@ local L = WeakAuras.L local debugLog local function ConstructDebugLog(frame) - local group = AceGUI:Create("WeakAurasInlineGroup"); - group.frame:SetParent(frame); - group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 16, -16); - group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -16, 46); - group.frame:Hide(); - group:SetLayout("flow"); + local group = AceGUI:Create("WeakAurasInlineGroup") + group.frame:SetParent(frame) + group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 16, -16) + group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -16, 46) + group.frame:Hide() + group:SetLayout("flow") local title = AceGUI:Create("Label") title:SetFontObject(GameFontNormalHuge) @@ -34,40 +36,51 @@ local function ConstructDebugLog(frame) copyLabel:SetText(L["Press Ctrl+C to copy"]) group:AddChild(copyLabel) - local input = AceGUI:Create("MultiLineEditBox"); + local input = AceGUI:Create("MultiLineEditBox") input:DisableButton(true) - input.frame:SetClipsChildren(true); - input.editBox:SetScript("OnEscapePressed", function() group:Close(); end); - input.editBox:SetScript("OnMouseUp", function() input.editBox:HighlightText(); end); + input.frame:SetClipsChildren(true) + input.editBox:SetScript("OnEscapePressed", function() + group:Close() + end) + input.editBox:SetScript("OnMouseUp", function() + input.editBox:HighlightText() + end) input:SetFullWidth(true) input:SetFullHeight(true) - group:AddChild(input); + group:AddChild(input) - local close = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate"); - close:SetScript("OnClick", function() group:Close() end); - close:SetPoint("BOTTOMRIGHT", -20, -24); + local close = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate") + close:SetScript("OnClick", function() + group:Close() + end) + close:SetPoint("BOTTOMRIGHT", -20, -24) close:SetFrameLevel(close:GetFrameLevel() + 1) - close:SetHeight(20); - close:SetWidth(100); + close:SetHeight(20) + close:SetWidth(100) close:SetText(L["Close"]) function group.Open(self, text) - frame.window = "debuglog"; + frame.window = "debuglog" frame:UpdateFrameVisible() - input.editBox:SetScript("OnTextChanged", function() input:SetText(text); input.editBox:HighlightText(); end); - input.editBox:SetScript("OnMouseUp", function() input.editBox:HighlightText(); end); - input:SetLabel(""); - input.button:Hide(); - input:SetText(text); - input.editBox:HighlightText(); + input.editBox:SetScript("OnTextChanged", function() + input:SetText(text) + input.editBox:HighlightText() + end) + input.editBox:SetScript("OnMouseUp", function() + input.editBox:HighlightText() + end) + input:SetLabel("") + input.button:Hide() + input:SetText(text) + input.editBox:HighlightText() input:SetFocus() group:DoLayout() end function group.Close(self) - input:ClearFocus(); - frame.window = "default"; + input:ClearFocus() + frame.window = "default" frame:UpdateFrameVisible() end diff --git a/WeakAurasOptions/OptionsFrames/FrameChooser.lua b/WeakAurasOptions/OptionsFrames/FrameChooser.lua index 2f1afcbbd2..fd1a70e2b2 100644 --- a/WeakAurasOptions/OptionsFrames/FrameChooser.lua +++ b/WeakAurasOptions/OptionsFrames/FrameChooser.lua @@ -1,12 +1,13 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... -- Lua APIs local pairs = pairs -- WoW APIs -local CreateFrame, IsMouseButtonDown, SetCursor, GetMouseFocus, MouseIsOver, ResetCursor - = CreateFrame, IsMouseButtonDown, SetCursor, GetMouseFocus, MouseIsOver, ResetCursor +local CreateFrame, IsMouseButtonDown, SetCursor, GetMouseFocus, MouseIsOver, ResetCursor = CreateFrame, IsMouseButtonDown, SetCursor, GetMouseFocus, MouseIsOver, ResetCursor local WeakAuras = WeakAuras local L = WeakAuras.L @@ -17,80 +18,80 @@ local frameChooserBox local oldFocus local oldFocusName function OptionsPrivate.StartFrameChooser(data, path) - local frame = WeakAuras.OptionsFrame(); - if not(frameChooserFrame) then - frameChooserFrame = CreateFrame("Frame"); - frameChooserBox = CreateFrame("Frame", nil, frameChooserFrame, "BackdropTemplate"); - frameChooserBox:SetFrameStrata("TOOLTIP"); + local frame = WeakAuras.OptionsFrame() + if not frameChooserFrame then + frameChooserFrame = CreateFrame("Frame") + frameChooserBox = CreateFrame("Frame", nil, frameChooserFrame, "BackdropTemplate") + frameChooserBox:SetFrameStrata("TOOLTIP") frameChooserBox:SetBackdrop({ edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", edgeSize = 12, - insets = {left = 0, right = 0, top = 0, bottom = 0} - }); - frameChooserBox:SetBackdropBorderColor(0, 1, 0); - frameChooserBox:Hide(); + insets = { left = 0, right = 0, top = 0, bottom = 0 }, + }) + frameChooserBox:SetBackdropBorderColor(0, 1, 0) + frameChooserBox:Hide() end - local givenValue = OptionsPrivate.Private.ValueFromPath(data, path); + local givenValue = OptionsPrivate.Private.ValueFromPath(data, path) frameChooserFrame:SetScript("OnUpdate", function() - if(IsMouseButtonDown("RightButton")) then - OptionsPrivate.Private.ValueToPath(data, path, givenValue); - OptionsPrivate.StopFrameChooser(data); + if IsMouseButtonDown("RightButton") then + OptionsPrivate.Private.ValueToPath(data, path, givenValue) + OptionsPrivate.StopFrameChooser(data) WeakAuras.FillOptions() - elseif(IsMouseButtonDown("LeftButton") and oldFocusName) then - OptionsPrivate.StopFrameChooser(data); + elseif IsMouseButtonDown("LeftButton") and oldFocusName then + OptionsPrivate.StopFrameChooser(data) else - SetCursor("CAST_CURSOR"); + SetCursor("CAST_CURSOR") - local focus = GetMouseFocus(); - local focusName; + local focus = GetMouseFocus() + local focusName - if(focus) then - focusName = focus:GetName(); - if(focusName == "WorldFrame" or not focusName) then - focusName = nil; - local focusIsGroup = false; + if focus then + focusName = focus:GetName() + if focusName == "WorldFrame" or not focusName then + focusName = nil + local focusIsGroup = false for id, regionData in pairs(WeakAuras.regions) do - if(regionData.region:IsVisible() and MouseIsOver(regionData.region)) then - local isGroup = regionData.regionType == "group" or regionData.regionType == "dynamicgroup"; - if (not focusName or (not isGroup and focusIsGroup)) then - focus = regionData.region; - focusName = "WeakAuras:"..id; - focusIsGroup = focusIsGroup; + if regionData.region:IsVisible() and MouseIsOver(regionData.region) then + local isGroup = regionData.regionType == "group" or regionData.regionType == "dynamicgroup" + if not focusName or (not isGroup and focusIsGroup) then + focus = regionData.region + focusName = "WeakAuras:" .. id + focusIsGroup = focusIsGroup end end end end - if(focus ~= oldFocus) then - if(focusName) then - frameChooserBox:ClearAllPoints(); - frameChooserBox:SetPoint("bottomleft", focus, "bottomleft", -4, -4); - frameChooserBox:SetPoint("topright", focus, "topright", 4, 4); - frameChooserBox:Show(); + if focus ~= oldFocus then + if focusName then + frameChooserBox:ClearAllPoints() + frameChooserBox:SetPoint("bottomleft", focus, "bottomleft", -4, -4) + frameChooserBox:SetPoint("topright", focus, "topright", 4, 4) + frameChooserBox:Show() end - if(focusName ~= oldFocusName) then - OptionsPrivate.Private.ValueToPath(data, path, focusName); - oldFocusName = focusName; + if focusName ~= oldFocusName then + OptionsPrivate.Private.ValueToPath(data, path, focusName) + oldFocusName = focusName WeakAuras.FillOptions() end - oldFocus = focus; + oldFocus = focus end end - if not(focusName) then - frameChooserBox:Hide(); + if not focusName then + frameChooserBox:Hide() end end - end); + end) end function OptionsPrivate.StopFrameChooser(data) - if(frameChooserFrame) then - frameChooserFrame:SetScript("OnUpdate", nil); - frameChooserBox:Hide(); + if frameChooserFrame then + frameChooserFrame:SetScript("OnUpdate", nil) + frameChooserBox:Hide() end - ResetCursor(); - WeakAuras.Add(data); + ResetCursor() + WeakAuras.Add(data) end diff --git a/WeakAurasOptions/OptionsFrames/IconPicker.lua b/WeakAurasOptions/OptionsFrames/IconPicker.lua index 3d3e39a8ef..ab913309a1 100644 --- a/WeakAurasOptions/OptionsFrames/IconPicker.lua +++ b/WeakAurasOptions/OptionsFrames/IconPicker.lua @@ -1,8 +1,10 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... -- Lua APIs -local pairs = pairs +local pairs = pairs -- WoW APIs local CreateFrame, GetSpellInfo = CreateFrame, GetSpellInfo @@ -17,105 +19,112 @@ local iconPicker local spellCache = WeakAuras.spellCache local function ConstructIconPicker(frame) - local group = AceGUI:Create("InlineGroup"); - group.frame:SetParent(frame); - group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 30); -- 12 - group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 17, -50); - group.frame:Hide(); - group:SetLayout("fill"); - - local scroll = AceGUI:Create("ScrollFrame"); - scroll:SetLayout("flow"); - scroll.frame:SetClipsChildren(true); - group:AddChild(scroll); + local group = AceGUI:Create("InlineGroup") + group.frame:SetParent(frame) + group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 30) -- 12 + group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 17, -50) + group.frame:Hide() + group:SetLayout("fill") + + local scroll = AceGUI:Create("ScrollFrame") + scroll:SetLayout("flow") + scroll.frame:SetClipsChildren(true) + group:AddChild(scroll) local function iconPickerFill(subname, doSort) - scroll:ReleaseChildren(); + scroll:ReleaseChildren() -- Work around special numbers such as inf and nan - if (tonumber(subname)) then - local spellId = tonumber(subname); - if (abs(spellId) < math.huge and tostring(spellId) ~= "nan") then + if tonumber(subname) then + local spellId = tonumber(subname) + if abs(spellId) < math.huge and tostring(spellId) ~= "nan" then subname = GetSpellInfo(spellId) end end if subname then - subname = subname:lower(); + subname = subname:lower() end - local usedIcons = {}; + local usedIcons = {} local AddButton = function(name, icon) - local button = AceGUI:Create("WeakAurasIconButton"); - button:SetName(name); - button:SetTexture(icon); + local button = AceGUI:Create("WeakAurasIconButton") + button:SetName(name) + button:SetTexture(icon) button:SetClick(function() - group:Pick(icon); - end); - scroll:AddChild(button); + group:Pick(icon) + end) + scroll:AddChild(button) - usedIcons[icon] = true; + usedIcons[icon] = true end - local num = 0; - if(subname and subname ~= "") then + local num = 0 + if subname and subname ~= "" then for name, icons in pairs(spellCache.Get()) do - if(name:lower():find(subname, 1, true)) then + if name:lower():find(subname, 1, true) then if icons.spells then for spell, icon in icons.spells:gmatch("(%d+)=(%d+)") do local iconId = tonumber(icon) - if (not usedIcons[iconId]) then + if not usedIcons[iconId] then AddButton(name, iconId) - num = num + 1; - if(num >= 500) then - break; + num = num + 1 + if num >= 500 then + break end end end elseif icons.achievements then for _, icon in icons.achievements:gmatch("(%d+)=(%d+)") do local iconId = tonumber(icon) - if (not usedIcons[iconId]) then + if not usedIcons[iconId] then AddButton(name, iconId) - num = num + 1; - if(num >= 500) then - break; + num = num + 1 + if num >= 500 then + break end end end end end - if(num >= 500) then - break; + if num >= 500 then + break end end end end - local input = CreateFrame("EditBox", nil, group.frame, "InputBoxTemplate"); - input:SetScript("OnTextChanged", function(...) iconPickerFill(input:GetText(), false); end); - input:SetScript("OnEnterPressed", function(...) iconPickerFill(input:GetText(), true); end); - input:SetScript("OnEscapePressed", function(...) input:SetText(""); iconPickerFill(input:GetText(), true); end); - input:SetWidth(170); - input:SetHeight(15); - input:SetPoint("BOTTOMRIGHT", group.frame, "TOPRIGHT", -12, -5); - - local inputLabel = input:CreateFontString(nil, "OVERLAY", "GameFontNormal"); - inputLabel:SetText(L["Search"]); - inputLabel:SetJustifyH("RIGHT"); - inputLabel:SetPoint("BOTTOMLEFT", input, "TOPLEFT", 0, 5); - - local icon = AceGUI:Create("WeakAurasIconButton"); - icon.frame:Disable(); - icon.frame:SetParent(group.frame); - icon.frame:SetPoint("BOTTOMLEFT", group.frame, "TOPLEFT", 15, -15); - - local iconLabel = input:CreateFontString(nil, "OVERLAY", "GameFontNormalHuge"); - iconLabel:SetNonSpaceWrap("true"); - iconLabel:SetJustifyH("LEFT"); - iconLabel:SetPoint("LEFT", icon.frame, "RIGHT", 5, 0); - iconLabel:SetPoint("RIGHT", input, "LEFT", -50, 0); + local input = CreateFrame("EditBox", nil, group.frame, "InputBoxTemplate") + input:SetScript("OnTextChanged", function(...) + iconPickerFill(input:GetText(), false) + end) + input:SetScript("OnEnterPressed", function(...) + iconPickerFill(input:GetText(), true) + end) + input:SetScript("OnEscapePressed", function(...) + input:SetText("") + iconPickerFill(input:GetText(), true) + end) + input:SetWidth(170) + input:SetHeight(15) + input:SetPoint("BOTTOMRIGHT", group.frame, "TOPRIGHT", -12, -5) + + local inputLabel = input:CreateFontString(nil, "OVERLAY", "GameFontNormal") + inputLabel:SetText(L["Search"]) + inputLabel:SetJustifyH("RIGHT") + inputLabel:SetPoint("BOTTOMLEFT", input, "TOPLEFT", 0, 5) + + local icon = AceGUI:Create("WeakAurasIconButton") + icon.frame:Disable() + icon.frame:SetParent(group.frame) + icon.frame:SetPoint("BOTTOMLEFT", group.frame, "TOPLEFT", 15, -15) + + local iconLabel = input:CreateFontString(nil, "OVERLAY", "GameFontNormalHuge") + iconLabel:SetNonSpaceWrap("true") + iconLabel:SetJustifyH("LEFT") + iconLabel:SetPoint("LEFT", icon.frame, "RIGHT", 5, 0) + iconLabel:SetPoint("RIGHT", input, "LEFT", -50, 0) function group.Pick(self, texturePath) local valueToPath = OptionsPrivate.Private.ValueToPath @@ -129,14 +138,14 @@ local function ConstructIconPicker(frame) valueToPath(child, self.paths[child.id], texturePath) WeakAuras.Add(child) WeakAuras.ClearAndUpdateOptions(child.id) - WeakAuras.UpdateThumbnail(child); + WeakAuras.UpdateThumbnail(child) end end - local success = icon:SetTexture(texturePath) and texturePath; - if(success) then - iconLabel:SetText(texturePath); + local success = icon:SetTexture(texturePath) and texturePath + if success then + iconLabel:SetText(texturePath) else - iconLabel:SetText(); + iconLabel:SetText() end end @@ -149,22 +158,22 @@ local function ConstructIconPicker(frame) local value = valueFromPath(self.baseObject, paths[self.baseObject.id]) self.givenPath = value else - self.givenPath = {}; + self.givenPath = {} for child in OptionsPrivate.Private.TraverseLeafsOrAura(baseObject) do - if(child) then + if child then local value = valueFromPath(child, paths[child.id]) - self.givenPath[child.id] = value or ""; + self.givenPath[child.id] = value or "" end end end -- group:Pick(self.givenPath); - frame.window = "icon"; + frame.window = "icon" frame:UpdateFrameVisible() - input:SetText(""); + input:SetText("") end function group.Close() - frame.window = "default"; + frame.window = "default" frame:UpdateFrameVisible() WeakAuras.FillOptions() end @@ -178,31 +187,31 @@ local function ConstructIconPicker(frame) WeakAuras.UpdateThumbnail(group.baseObject) else for child in OptionsPrivate.Private.TraverseLeafsOrAura(group.baseObject) do - if (group.givenPath[child.id]) then + if group.givenPath[child.id] then valueToPath(child, group.paths[child.id], group.givenPath[child.id]) - WeakAuras.Add(child); + WeakAuras.Add(child) WeakAuras.ClearAndUpdateOptions(child.id) - WeakAuras.UpdateThumbnail(child); + WeakAuras.UpdateThumbnail(child) end end end - group.Close(); + group.Close() end - local cancel = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate"); - cancel:SetScript("OnClick", group.CancelClose); - cancel:SetPoint("bottomright", frame, "bottomright", -27, 11); - cancel:SetHeight(20); - cancel:SetWidth(100); - cancel:SetText(L["Cancel"]); - - local close = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate"); - close:SetScript("OnClick", group.Close); - close:SetPoint("RIGHT", cancel, "LEFT", -10, 0); - close:SetHeight(20); - close:SetWidth(100); - close:SetText(L["Okay"]); + local cancel = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate") + cancel:SetScript("OnClick", group.CancelClose) + cancel:SetPoint("bottomright", frame, "bottomright", -27, 11) + cancel:SetHeight(20) + cancel:SetWidth(100) + cancel:SetText(L["Cancel"]) + + local close = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate") + close:SetScript("OnClick", group.Close) + close:SetPoint("RIGHT", cancel, "LEFT", -10, 0) + close:SetHeight(20) + close:SetWidth(100) + close:SetText(L["Okay"]) return group end diff --git a/WeakAurasOptions/OptionsFrames/ImportExport.lua b/WeakAurasOptions/OptionsFrames/ImportExport.lua index cf523e17ad..0fd33b62b1 100644 --- a/WeakAurasOptions/OptionsFrames/ImportExport.lua +++ b/WeakAurasOptions/OptionsFrames/ImportExport.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... -- WoW APIs @@ -12,63 +14,72 @@ local L = WeakAuras.L local importexport local function ConstructImportExport(frame) - local group = AceGUI:Create("WeakAurasInlineGroup"); - group.frame:SetParent(frame); - group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 16, -16); - group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -16, 46); - group.frame:Hide(); - group:SetLayout("flow"); + local group = AceGUI:Create("WeakAurasInlineGroup") + group.frame:SetParent(frame) + group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 16, -16) + group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -16, 46) + group.frame:Hide() + group:SetLayout("flow") local title = AceGUI:Create("Label") title:SetFontObject(GameFontNormalHuge) title:SetFullWidth(true) group:AddChild(title) - local input = AceGUI:Create("MultiLineEditBox"); + local input = AceGUI:Create("MultiLineEditBox") input:DisableButton(true) - input.frame:SetClipsChildren(true); + input.frame:SetClipsChildren(true) input:SetFullWidth(true) input:SetFullHeight(true) - group:AddChild(input); + group:AddChild(input) - local close = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate"); - close:SetScript("OnClick", function() group:Close() end); - close:SetPoint("BOTTOMRIGHT", -20, -24); + local close = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate") + close:SetScript("OnClick", function() + group:Close() + end) + close:SetPoint("BOTTOMRIGHT", -20, -24) close:SetFrameLevel(close:GetFrameLevel() + 1) - close:SetHeight(20); - close:SetWidth(100); + close:SetHeight(20) + close:SetWidth(100) close:SetText(L["Close"]) function group.Open(self, mode, id) - if(frame.window == "texture") then - frame.texturePicker:CancelClose(); - elseif(frame.window == "icon") then - frame.iconPicker:CancelClose(); - elseif(frame.window == "model") then - frame.modelPicker:CancelClose(); + if frame.window == "texture" then + frame.texturePicker:CancelClose() + elseif frame.window == "icon" then + frame.iconPicker:CancelClose() + elseif frame.window == "model" then + frame.modelPicker:CancelClose() end - frame.window = "importexport"; + frame.window = "importexport" frame:UpdateFrameVisible() - if(mode == "export" or mode == "table") then + if mode == "export" or mode == "table" then title:SetText(L["Exporting"]) - if(id) then - local displayStr; - if(mode == "export") then - displayStr = OptionsPrivate.Private.DisplayToString(id, true); - elseif(mode == "table") then - displayStr = OptionsPrivate.Private.DataToString(id); + if id then + local displayStr + if mode == "export" then + displayStr = OptionsPrivate.Private.DisplayToString(id, true) + elseif mode == "table" then + displayStr = OptionsPrivate.Private.DataToString(id) end - input.editBox:SetMaxBytes(nil); - input.editBox:SetScript("OnEscapePressed", function() group:Close(); end); - input.editBox:SetScript("OnTextChanged", function() input:SetText(displayStr); input.editBox:HighlightText(); end); - input.editBox:SetScript("OnMouseUp", function() input.editBox:HighlightText(); end); - input:SetLabel(id.." - "..#displayStr); - input.button:Hide(); - input:SetText(displayStr); - input.editBox:HighlightText(); - input:SetFocus(); + input.editBox:SetMaxBytes(nil) + input.editBox:SetScript("OnEscapePressed", function() + group:Close() + end) + input.editBox:SetScript("OnTextChanged", function() + input:SetText(displayStr) + input.editBox:HighlightText() + end) + input.editBox:SetScript("OnMouseUp", function() + input.editBox:HighlightText() + end) + input:SetLabel(id .. " - " .. #displayStr) + input.button:Hide() + input:SetText(displayStr) + input.editBox:HighlightText() + input:SetFocus() end - elseif(mode == "import") then + elseif mode == "import" then title:SetText(L["Importing"]) input.editBox:SetScript("OnTextChanged", function(self) local pasted = self:GetText() @@ -77,18 +88,20 @@ local function ConstructImportExport(frame) WeakAuras.Import(pasted) end end) - input.editBox:SetText(""); - input.editBox:SetScript("OnEscapePressed", function() group:Close(); end); - input.editBox:SetScript("OnMouseUp", nil); - input:SetLabel(L["Paste text below"]); - input:SetFocus(); + input.editBox:SetText("") + input.editBox:SetScript("OnEscapePressed", function() + group:Close() + end) + input.editBox:SetScript("OnMouseUp", nil) + input:SetLabel(L["Paste text below"]) + input:SetFocus() end group:DoLayout() end function group.Close() - input:ClearFocus(); - frame.window = "default"; + input:ClearFocus() + frame.window = "default" frame:UpdateFrameVisible() end diff --git a/WeakAurasOptions/OptionsFrames/ModelPicker.lua b/WeakAurasOptions/OptionsFrames/ModelPicker.lua index 5f1c3c5746..e4affcd5ee 100644 --- a/WeakAurasOptions/OptionsFrames/ModelPicker.lua +++ b/WeakAurasOptions/OptionsFrames/ModelPicker.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... -- Lua APIs @@ -49,12 +51,12 @@ local function ConstructModelPicker(frame) end end - local group = AceGUI:Create("InlineGroup"); - group.frame:SetParent(frame); - group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 87); - group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 17, -15); - group.frame:Hide(); - group:SetLayout("flow"); + local group = AceGUI:Create("InlineGroup") + group.frame:SetParent(frame) + group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 87) + group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 17, -15) + group.frame:Hide() + group:SetLayout("flow") local filterInput = CreateFrame("EditBox", "WeakAurasFilterInput", group.frame, "SearchBoxTemplate") filterInput:SetScript("OnTextChanged", function(self) @@ -72,164 +74,163 @@ local function ConstructModelPicker(frame) group.frame.filterInput = filterInput -- Old X Y Z controls - local modelPickerZ = AceGUI:Create("Slider"); - modelPickerZ:SetSliderValues(-20, 20, 0.05); - modelPickerZ:SetLabel(L["Z Offset"]); - modelPickerZ.frame:SetParent(group.frame); + local modelPickerZ = AceGUI:Create("Slider") + modelPickerZ:SetSliderValues(-20, 20, 0.05) + modelPickerZ:SetLabel(L["Z Offset"]) + modelPickerZ.frame:SetParent(group.frame) modelPickerZ:SetCallback("OnValueChanged", function() - group:Pick(nil, nil, modelPickerZ:GetValue()); - end); + group:Pick(nil, nil, modelPickerZ:GetValue()) + end) - local modelPickerX = AceGUI:Create("Slider"); - modelPickerX:SetSliderValues(-20, 20, 0.05); - modelPickerX:SetLabel(L["X Offset"]); - modelPickerX.frame:SetParent(group.frame); + local modelPickerX = AceGUI:Create("Slider") + modelPickerX:SetSliderValues(-20, 20, 0.05) + modelPickerX:SetLabel(L["X Offset"]) + modelPickerX.frame:SetParent(group.frame) modelPickerX:SetCallback("OnValueChanged", function() - group:Pick(nil, nil, nil, modelPickerX:GetValue()); - end); + group:Pick(nil, nil, nil, modelPickerX:GetValue()) + end) - local modelPickerY = AceGUI:Create("Slider"); - modelPickerY:SetSliderValues(-20, 20, 0.05); - modelPickerY:SetLabel(L["Y Offset"]); - modelPickerY.frame:SetParent(group.frame); + local modelPickerY = AceGUI:Create("Slider") + modelPickerY:SetSliderValues(-20, 20, 0.05) + modelPickerY:SetLabel(L["Y Offset"]) + modelPickerY.frame:SetParent(group.frame) modelPickerY:SetCallback("OnValueChanged", function() - group:Pick(nil, nil, nil, nil, modelPickerY:GetValue()); - end); + group:Pick(nil, nil, nil, nil, modelPickerY:GetValue()) + end) - local modelPickerRotation = AceGUI:Create("Slider"); - modelPickerRotation:SetSliderValues(0, 360, 0.05); - modelPickerRotation:SetLabel(L["Rotation"]); - modelPickerRotation.frame:SetParent(group.frame); + local modelPickerRotation = AceGUI:Create("Slider") + modelPickerRotation:SetSliderValues(0, 360, 0.05) + modelPickerRotation:SetLabel(L["Rotation"]) + modelPickerRotation.frame:SetParent(group.frame) modelPickerRotation:SetCallback("OnValueChanged", function() - group:Pick(nil, nil, nil, nil, nil, modelPickerRotation:GetValue()); - end); + group:Pick(nil, nil, nil, nil, nil, modelPickerRotation:GetValue()) + end) -- New TX TY TZ, RX, RY, RZ, US controls - local modelPickerTX = AceGUI:Create("Slider"); - modelPickerTX:SetSliderValues(-1000, 1000, 1); - modelPickerTX:SetLabel(L["X Offset"]); - modelPickerTX.frame:SetParent(group.frame); + local modelPickerTX = AceGUI:Create("Slider") + modelPickerTX:SetSliderValues(-1000, 1000, 1) + modelPickerTX:SetLabel(L["X Offset"]) + modelPickerTX.frame:SetParent(group.frame) modelPickerTX:SetCallback("OnValueChanged", function() - group:PickSt(nil, nil, modelPickerTX:GetValue()); - end); + group:PickSt(nil, nil, modelPickerTX:GetValue()) + end) - local modelPickerTY = AceGUI:Create("Slider"); - modelPickerTY:SetSliderValues(-1000, 1000, 1); - modelPickerTY:SetLabel(L["Y Offset"]); - modelPickerTY.frame:SetParent(group.frame); + local modelPickerTY = AceGUI:Create("Slider") + modelPickerTY:SetSliderValues(-1000, 1000, 1) + modelPickerTY:SetLabel(L["Y Offset"]) + modelPickerTY.frame:SetParent(group.frame) modelPickerTY:SetCallback("OnValueChanged", function() - group:PickSt(nil, nil, nil, modelPickerTY:GetValue()); - end); + group:PickSt(nil, nil, nil, modelPickerTY:GetValue()) + end) - local modelPickerTZ = AceGUI:Create("Slider"); - modelPickerTZ:SetSliderValues(-1000, 1000, 1); - modelPickerTZ:SetLabel(L["Z Offset"]); - modelPickerTZ.frame:SetParent(group.frame); + local modelPickerTZ = AceGUI:Create("Slider") + modelPickerTZ:SetSliderValues(-1000, 1000, 1) + modelPickerTZ:SetLabel(L["Z Offset"]) + modelPickerTZ.frame:SetParent(group.frame) modelPickerTZ:SetCallback("OnValueChanged", function() - group:PickSt(nil, nil, nil, nil, modelPickerTZ:GetValue()); - end); + group:PickSt(nil, nil, nil, nil, modelPickerTZ:GetValue()) + end) - local modelPickerRX = AceGUI:Create("Slider"); - modelPickerRX:SetSliderValues(0, 360, 1); - modelPickerRX:SetLabel(L["X Rotation"]); - modelPickerRX.frame:SetParent(group.frame); + local modelPickerRX = AceGUI:Create("Slider") + modelPickerRX:SetSliderValues(0, 360, 1) + modelPickerRX:SetLabel(L["X Rotation"]) + modelPickerRX.frame:SetParent(group.frame) modelPickerRX:SetCallback("OnValueChanged", function() - group:PickSt(nil, nil, nil, nil, nil, modelPickerRX:GetValue()); - end); + group:PickSt(nil, nil, nil, nil, nil, modelPickerRX:GetValue()) + end) - local modelPickerRY = AceGUI:Create("Slider"); - modelPickerRY:SetSliderValues(0, 360, 1); - modelPickerRY:SetLabel(L["Y Rotation"]); - modelPickerRY.frame:SetParent(group.frame); + local modelPickerRY = AceGUI:Create("Slider") + modelPickerRY:SetSliderValues(0, 360, 1) + modelPickerRY:SetLabel(L["Y Rotation"]) + modelPickerRY.frame:SetParent(group.frame) modelPickerRY:SetCallback("OnValueChanged", function() - group:PickSt(nil, nil, nil, nil, nil, nil, modelPickerRY:GetValue()); - end); + group:PickSt(nil, nil, nil, nil, nil, nil, modelPickerRY:GetValue()) + end) - local modelPickerRZ = AceGUI:Create("Slider"); - modelPickerRZ:SetSliderValues(0, 360, 1); - modelPickerRZ:SetLabel(L["Z Rotation"]); - modelPickerRZ.frame:SetParent(group.frame); + local modelPickerRZ = AceGUI:Create("Slider") + modelPickerRZ:SetSliderValues(0, 360, 1) + modelPickerRZ:SetLabel(L["Z Rotation"]) + modelPickerRZ.frame:SetParent(group.frame) modelPickerRZ:SetCallback("OnValueChanged", function() - group:PickSt(nil, nil, nil, nil, nil, nil, nil, modelPickerRZ:GetValue()); - end); + group:PickSt(nil, nil, nil, nil, nil, nil, nil, modelPickerRZ:GetValue()) + end) - local modelPickerUS = AceGUI:Create("Slider"); - modelPickerUS:SetSliderValues(5, 1000, 1); - modelPickerUS:SetLabel(L["Scale"]); - modelPickerUS.frame:SetParent(group.frame); + local modelPickerUS = AceGUI:Create("Slider") + modelPickerUS:SetSliderValues(5, 1000, 1) + modelPickerUS:SetLabel(L["Scale"]) + modelPickerUS.frame:SetParent(group.frame) modelPickerUS:SetCallback("OnValueChanged", function() - group:PickSt(nil, nil, nil, nil, nil, nil, nil, nil, modelPickerUS:GetValue()); - end); + group:PickSt(nil, nil, nil, nil, nil, nil, nil, nil, modelPickerUS:GetValue()) + end) - local modelTree = AceGUI:Create("WeakAurasTreeGroup"); - group.modelTree = modelTree; + local modelTree = AceGUI:Create("WeakAurasTreeGroup") + group.modelTree = modelTree group.frame:SetScript("OnSizeChanged", function() - local frameWidth = frame:GetWidth(); - local sliderWidth = (frameWidth - 50) / 4; - local narrowSliderWidth = (frameWidth - 50) / 7; + local frameWidth = frame:GetWidth() + local sliderWidth = (frameWidth - 50) / 4 + local narrowSliderWidth = (frameWidth - 50) / 7 - modelTree:SetTreeWidth(frameWidth - 370); + modelTree:SetTreeWidth(frameWidth - 370) - modelPickerZ.frame:SetPoint("bottomleft", frame, "bottomleft", 15, 43); - modelPickerZ.frame:SetPoint("bottomright", frame, "bottomleft", 15 + sliderWidth, 43); + modelPickerZ.frame:SetPoint("bottomleft", frame, "bottomleft", 15, 43) + modelPickerZ.frame:SetPoint("bottomright", frame, "bottomleft", 15 + sliderWidth, 43) - modelPickerX.frame:SetPoint("bottomleft", frame, "bottomleft", 25 + sliderWidth, 43); - modelPickerX.frame:SetPoint("bottomright", frame, "bottomleft", 25 + (2 * sliderWidth), 43); + modelPickerX.frame:SetPoint("bottomleft", frame, "bottomleft", 25 + sliderWidth, 43) + modelPickerX.frame:SetPoint("bottomright", frame, "bottomleft", 25 + (2 * sliderWidth), 43) - modelPickerY.frame:SetPoint("bottomleft", frame, "bottomleft", 35 + (2 * sliderWidth), 43); - modelPickerY.frame:SetPoint("bottomright", frame, "bottomleft", 35 + (3 * sliderWidth), 43); + modelPickerY.frame:SetPoint("bottomleft", frame, "bottomleft", 35 + (2 * sliderWidth), 43) + modelPickerY.frame:SetPoint("bottomright", frame, "bottomleft", 35 + (3 * sliderWidth), 43) - modelPickerRotation.frame:SetPoint("bottomleft", frame, "bottomleft", 45 + (3 * sliderWidth), 43); - modelPickerRotation.frame:SetPoint("bottomright", frame, "bottomleft", 45 + (4 * sliderWidth), 43); + modelPickerRotation.frame:SetPoint("bottomleft", frame, "bottomleft", 45 + (3 * sliderWidth), 43) + modelPickerRotation.frame:SetPoint("bottomright", frame, "bottomleft", 45 + (4 * sliderWidth), 43) -- New controls - modelPickerTX.frame:SetPoint("bottomleft", frame, "bottomleft", 15, 43); - modelPickerTX.frame:SetPoint("bottomright", frame, "bottomleft", 15 + narrowSliderWidth, 43); + modelPickerTX.frame:SetPoint("bottomleft", frame, "bottomleft", 15, 43) + modelPickerTX.frame:SetPoint("bottomright", frame, "bottomleft", 15 + narrowSliderWidth, 43) - modelPickerTY.frame:SetPoint("bottomleft", frame, "bottomleft", 20 + narrowSliderWidth, 43); - modelPickerTY.frame:SetPoint("bottomright", frame, "bottomleft", 20 + (2 * narrowSliderWidth), 43); + modelPickerTY.frame:SetPoint("bottomleft", frame, "bottomleft", 20 + narrowSliderWidth, 43) + modelPickerTY.frame:SetPoint("bottomright", frame, "bottomleft", 20 + (2 * narrowSliderWidth), 43) - modelPickerTZ.frame:SetPoint("bottomleft", frame, "bottomleft", 25 + (2 * narrowSliderWidth), 43); - modelPickerTZ.frame:SetPoint("bottomright", frame, "bottomleft", 25 + (3 * narrowSliderWidth), 43); + modelPickerTZ.frame:SetPoint("bottomleft", frame, "bottomleft", 25 + (2 * narrowSliderWidth), 43) + modelPickerTZ.frame:SetPoint("bottomright", frame, "bottomleft", 25 + (3 * narrowSliderWidth), 43) - modelPickerRX.frame:SetPoint("bottomleft", frame, "bottomleft", 30 + (3 * narrowSliderWidth), 43); - modelPickerRX.frame:SetPoint("bottomright", frame, "bottomleft", 30 + (4 * narrowSliderWidth), 43); + modelPickerRX.frame:SetPoint("bottomleft", frame, "bottomleft", 30 + (3 * narrowSliderWidth), 43) + modelPickerRX.frame:SetPoint("bottomright", frame, "bottomleft", 30 + (4 * narrowSliderWidth), 43) - modelPickerRY.frame:SetPoint("bottomleft", frame, "bottomleft", 35 + (4 * narrowSliderWidth), 43); - modelPickerRY.frame:SetPoint("bottomright", frame, "bottomleft", 35 + (5 * narrowSliderWidth), 43); + modelPickerRY.frame:SetPoint("bottomleft", frame, "bottomleft", 35 + (4 * narrowSliderWidth), 43) + modelPickerRY.frame:SetPoint("bottomright", frame, "bottomleft", 35 + (5 * narrowSliderWidth), 43) - modelPickerRZ.frame:SetPoint("bottomleft", frame, "bottomleft", 40 + (5 * narrowSliderWidth), 43); - modelPickerRZ.frame:SetPoint("bottomright", frame, "bottomleft", 40 + (6 * narrowSliderWidth), 43); + modelPickerRZ.frame:SetPoint("bottomleft", frame, "bottomleft", 40 + (5 * narrowSliderWidth), 43) + modelPickerRZ.frame:SetPoint("bottomright", frame, "bottomleft", 40 + (6 * narrowSliderWidth), 43) - modelPickerUS.frame:SetPoint("bottomleft", frame, "bottomleft", 45 + (6 * narrowSliderWidth), 43); - modelPickerUS.frame:SetPoint("bottomright", frame, "bottomleft", 45 + (7 * narrowSliderWidth), 43); - - end); - group:SetLayout("fill"); - modelTree:SetTree(WeakAuras.ModelPaths); + modelPickerUS.frame:SetPoint("bottomleft", frame, "bottomleft", 45 + (6 * narrowSliderWidth), 43) + modelPickerUS.frame:SetPoint("bottomright", frame, "bottomleft", 45 + (7 * narrowSliderWidth), 43) + end) + group:SetLayout("fill") + modelTree:SetTree(WeakAuras.ModelPaths) modelTree:SetCallback("OnGroupSelected", function(self, event, value, fileId) - local path = string.gsub(value, "\001", "/"); - if(string.lower(string.sub(path, -3, -1)) == ".m2") then - local model_path = path; - if (group.selectedValues.api) then - group:PickSt(model_path, fileId); + local path = string.gsub(value, "\001", "/") + if string.lower(string.sub(path, -3, -1)) == ".m2" then + local model_path = path + if group.selectedValues.api then + group:PickSt(model_path, fileId) else - group:Pick(model_path, fileId); + group:Pick(model_path, fileId) end end - end); - group:AddChild(modelTree); + end) + group:AddChild(modelTree) - local model = CreateFrame("PlayerModel", nil, group.content); - model:SetAllPoints(modelTree.content); - model:SetFrameStrata("FULLSCREEN"); - group.model = model; + local model = CreateFrame("PlayerModel", nil, group.content) + model:SetAllPoints(modelTree.content) + model:SetFrameStrata("FULLSCREEN") + group.model = model local startX, rotation local function OnUpdateScript() local uiScale, x = UIParent:GetEffectiveScale(), GetCursorPosition() local screenW, screenH = GetScreenWidth(), GetScreenHeight() - local diffX = startX/uiScale - x/uiScale + local diffX = startX / uiScale - x / uiScale rotation = (rotation + 180 / screenW * diffX) % 360 model:SetFacing(rad(rotation)) end @@ -286,23 +287,29 @@ local function ConstructModelPicker(frame) self.selectedValues.model_st_ty = model_ty or self.selectedValues.model_st_ty self.selectedValues.model_st_tz = model_tz or self.selectedValues.model_st_tz - self.selectedValues.model_st_rx = model_rx or self.selectedValues.model_st_rx; - self.selectedValues.model_st_ry = model_ry or self.selectedValues.model_st_ry; - self.selectedValues.model_st_rz = model_rz or self.selectedValues.model_st_rz; + self.selectedValues.model_st_rx = model_rx or self.selectedValues.model_st_rx + self.selectedValues.model_st_ry = model_ry or self.selectedValues.model_st_ry + self.selectedValues.model_st_rz = model_rz or self.selectedValues.model_st_rz - self.selectedValues.model_st_us = model_us or self.selectedValues.model_st_us; + self.selectedValues.model_st_us = model_us or self.selectedValues.model_st_us WeakAuras.SetModel(self.model, self.selectedValues.model_path, self.selectedValues.model_fileId) - self.model:SetTransform(self.selectedValues.model_st_tx / 1000, self.selectedValues.model_st_ty / 1000, self.selectedValues.model_st_tz / 1000, - rad(self.selectedValues.model_st_rx), rad(self.selectedValues.model_st_ry), rad(self.selectedValues.model_st_rz), - self.selectedValues.model_st_us / 1000); + self.model:SetTransform( + self.selectedValues.model_st_tx / 1000, + self.selectedValues.model_st_ty / 1000, + self.selectedValues.model_st_tz / 1000, + rad(self.selectedValues.model_st_rx), + rad(self.selectedValues.model_st_ry), + rad(self.selectedValues.model_st_rz), + self.selectedValues.model_st_us / 1000 + ) for child in OptionsPrivate.Private.TraverseLeafsOrAura(self.baseObject) do local object = valueFromPath(child, self.path) - if(object) then + if object then SetStOnObject(object, model_path, model_fileId, model_tx, model_ty, model_tz, model_rx, model_ry, model_rz, model_us) - WeakAuras.Add(child); - WeakAuras.UpdateThumbnail(child); + WeakAuras.Add(child) + WeakAuras.UpdateThumbnail(child) end end end @@ -340,13 +347,13 @@ local function ConstructModelPicker(frame) WeakAuras.SetModel(self.model, self.selectedValues.model_path, self.selectedValues.model_fileId) - self.model:ClearTransform(); - self.model:SetPosition(self.selectedValues.model_z, self.selectedValues.model_x, self.selectedValues.model_y); - self.model:SetFacing(rad(self.selectedValues.rotation)); + self.model:ClearTransform() + self.model:SetPosition(self.selectedValues.model_z, self.selectedValues.model_x, self.selectedValues.model_y) + self.model:SetFacing(rad(self.selectedValues.rotation)) for child in OptionsPrivate.Private.TraverseLeafsOrAura(self.baseObject) do local object = valueFromPath(child, self.path) - if(object) then + if object then SetOnObject(object, model_path, model_fileId, model_z, model_x, model_y, rotation) WeakAuras.Add(child) WeakAuras.UpdateThumbnail(child) @@ -382,130 +389,135 @@ local function ConstructModelPicker(frame) self.selectedValues.model_z = GetAll(baseObject, path, "model_z", 0) self.selectedValues.rotation = GetAll(baseObject, path, "rotation", 0) - - if (self.selectedValues.api) then - self.model:SetTransform(self.selectedValues.model_st_tx / 1000, self.selectedValues.model_st_ty / 1000, self.selectedValues.model_st_tz / 1000, - rad(self.selectedValues.model_st_rx), rad(self.selectedValues.model_st_ry), rad(self.selectedValues.model_st_rz), - self.selectedValues.model_st_us / 1000); - - modelPickerTX:SetValue(self.selectedValues.model_st_tx); - modelPickerTX.editbox:SetText(("%.2f"):format(self.selectedValues.model_st_tx)); - - modelPickerTY:SetValue(self.selectedValues.model_st_ty); - modelPickerTY.editbox:SetText(("%.2f"):format(self.selectedValues.model_st_ty)); - modelPickerTZ:SetValue(self.selectedValues.model_st_tz); - modelPickerTZ.editbox:SetText(("%.2f"):format(self.selectedValues.model_st_tz)); - - modelPickerRX:SetValue(self.selectedValues.model_st_rx); - modelPickerRX.editbox:SetText(("%.2f"):format(self.selectedValues.model_st_rx)); - modelPickerRY:SetValue(self.selectedValues.model_st_ry); - modelPickerRY.editbox:SetText(("%.2f"):format(self.selectedValues.model_st_ry)); - modelPickerRZ:SetValue(self.selectedValues.model_st_rz); - modelPickerRZ.editbox:SetText(("%.2f"):format(self.selectedValues.model_st_rz)); - - modelPickerUS:SetValue(self.selectedValues.model_st_us); - modelPickerUS.editbox:SetText(("%.2f"):format(self.selectedValues.model_st_us)); - - modelPickerZ.frame:Hide(); - modelPickerY.frame:Hide(); - modelPickerX.frame:Hide(); - modelPickerRotation.frame:Hide(); - - modelPickerTX.frame:Show(); - modelPickerTY.frame:Show(); - modelPickerTZ.frame:Show(); - modelPickerRX.frame:Show(); - modelPickerRY.frame:Show(); - modelPickerRZ.frame:Show(); - modelPickerUS.frame:Show(); + if self.selectedValues.api then + self.model:SetTransform( + self.selectedValues.model_st_tx / 1000, + self.selectedValues.model_st_ty / 1000, + self.selectedValues.model_st_tz / 1000, + rad(self.selectedValues.model_st_rx), + rad(self.selectedValues.model_st_ry), + rad(self.selectedValues.model_st_rz), + self.selectedValues.model_st_us / 1000 + ) + + modelPickerTX:SetValue(self.selectedValues.model_st_tx) + modelPickerTX.editbox:SetText(("%.2f"):format(self.selectedValues.model_st_tx)) + + modelPickerTY:SetValue(self.selectedValues.model_st_ty) + modelPickerTY.editbox:SetText(("%.2f"):format(self.selectedValues.model_st_ty)) + modelPickerTZ:SetValue(self.selectedValues.model_st_tz) + modelPickerTZ.editbox:SetText(("%.2f"):format(self.selectedValues.model_st_tz)) + + modelPickerRX:SetValue(self.selectedValues.model_st_rx) + modelPickerRX.editbox:SetText(("%.2f"):format(self.selectedValues.model_st_rx)) + modelPickerRY:SetValue(self.selectedValues.model_st_ry) + modelPickerRY.editbox:SetText(("%.2f"):format(self.selectedValues.model_st_ry)) + modelPickerRZ:SetValue(self.selectedValues.model_st_rz) + modelPickerRZ.editbox:SetText(("%.2f"):format(self.selectedValues.model_st_rz)) + + modelPickerUS:SetValue(self.selectedValues.model_st_us) + modelPickerUS.editbox:SetText(("%.2f"):format(self.selectedValues.model_st_us)) + + modelPickerZ.frame:Hide() + modelPickerY.frame:Hide() + modelPickerX.frame:Hide() + modelPickerRotation.frame:Hide() + + modelPickerTX.frame:Show() + modelPickerTY.frame:Show() + modelPickerTZ.frame:Show() + modelPickerRX.frame:Show() + modelPickerRY.frame:Show() + modelPickerRZ.frame:Show() + modelPickerUS.frame:Show() else - self.model:ClearTransform(); - self.model:SetPosition(self.selectedValues.model_z, self.selectedValues.model_x, self.selectedValues.model_y); - self.model:SetFacing(rad(self.selectedValues.rotation)); - modelPickerZ:SetValue(self.selectedValues.model_z); - modelPickerZ.editbox:SetText(("%.2f"):format(self.selectedValues.model_z)); - modelPickerX:SetValue(self.selectedValues.model_x); - modelPickerX.editbox:SetText(("%.2f"):format(self.selectedValues.model_x)); - modelPickerY:SetValue(self.selectedValues.model_y); - modelPickerY.editbox:SetText(("%.2f"):format(self.selectedValues.model_y)); - modelPickerRotation:SetValue(self.selectedValues.rotation); - modelPickerRotation.editbox:SetText(("%.2f"):format(self.selectedValues.rotation)); - - modelPickerZ.frame:Show(); - modelPickerY.frame:Show(); - modelPickerX.frame:Show(); - modelPickerRotation.frame:Show(); - - modelPickerTX.frame:Hide(); - modelPickerTY.frame:Hide(); - modelPickerTZ.frame:Hide(); - modelPickerRX.frame:Hide(); - modelPickerRY.frame:Hide(); - modelPickerRZ.frame:Hide(); - modelPickerUS.frame:Hide(); + self.model:ClearTransform() + self.model:SetPosition(self.selectedValues.model_z, self.selectedValues.model_x, self.selectedValues.model_y) + self.model:SetFacing(rad(self.selectedValues.rotation)) + modelPickerZ:SetValue(self.selectedValues.model_z) + modelPickerZ.editbox:SetText(("%.2f"):format(self.selectedValues.model_z)) + modelPickerX:SetValue(self.selectedValues.model_x) + modelPickerX.editbox:SetText(("%.2f"):format(self.selectedValues.model_x)) + modelPickerY:SetValue(self.selectedValues.model_y) + modelPickerY.editbox:SetText(("%.2f"):format(self.selectedValues.model_y)) + modelPickerRotation:SetValue(self.selectedValues.rotation) + modelPickerRotation.editbox:SetText(("%.2f"):format(self.selectedValues.rotation)) + + modelPickerZ.frame:Show() + modelPickerY.frame:Show() + modelPickerX.frame:Show() + modelPickerRotation.frame:Show() + + modelPickerTX.frame:Hide() + modelPickerTY.frame:Hide() + modelPickerTZ.frame:Hide() + modelPickerRX.frame:Hide() + modelPickerRY.frame:Hide() + modelPickerRZ.frame:Hide() + modelPickerUS.frame:Hide() end - if(baseObject.controlledChildren) then - self.givenModel = {}; - self.givenModelId = {}; - self.givenApi = {}; - self.givenZ = {}; - self.givenX = {}; - self.givenY = {}; - self.givenRotation = {}; - self.givenTX = {}; - self.givenTY = {}; - self.givenTZ = {}; - self.givenRX = {}; - self.givenRY = {}; - self.givenRZ = {}; - self.givenUS = {}; + if baseObject.controlledChildren then + self.givenModel = {} + self.givenModelId = {} + self.givenApi = {} + self.givenZ = {} + self.givenX = {} + self.givenY = {} + self.givenRotation = {} + self.givenTX = {} + self.givenTY = {} + self.givenTZ = {} + self.givenRX = {} + self.givenRY = {} + self.givenRZ = {} + self.givenUS = {} for child in OptionsPrivate.Private.TraverseLeafs(baseObject) do local childId = child.id local object = valueFromPath(child, path) - if(object) then - self.givenModel[childId] = object.model_path; - self.givenModelId[childId] = object.model_fileId; - self.givenApi[childId] = object.api; - if (object.api) then - self.givenTX[childId] = object.model_st_tx; - self.givenTY[childId] = object.model_st_ty; - self.givenTZ[childId] = object.model_st_tz; - self.givenRX[childId] = object.model_st_rx; - self.givenRY[childId] = object.model_st_ry; - self.givenRZ[childId] = object.model_st_rz; - self.givenUS[childId] = object.model_st_us; + if object then + self.givenModel[childId] = object.model_path + self.givenModelId[childId] = object.model_fileId + self.givenApi[childId] = object.api + if object.api then + self.givenTX[childId] = object.model_st_tx + self.givenTY[childId] = object.model_st_ty + self.givenTZ[childId] = object.model_st_tz + self.givenRX[childId] = object.model_st_rx + self.givenRY[childId] = object.model_st_ry + self.givenRZ[childId] = object.model_st_rz + self.givenUS[childId] = object.model_st_us else - self.givenZ[childId] = object.model_z; - self.givenX[childId] = object.model_x; - self.givenY[childId] = object.model_y; - self.givenRotation[childId] = object.rotation; + self.givenZ[childId] = object.model_z + self.givenX[childId] = object.model_x + self.givenY[childId] = object.model_y + self.givenRotation[childId] = object.rotation end end end else local object = valueFromPath(baseObject, path) - self.givenModel = object.model_path; - self.givenModelId = object.model_fileId; - self.givenApi = object.api; - - if (object.api) then - self.givenTX = object.model_st_tx; - self.givenTY = object.model_st_ty; - self.givenTZ = object.model_st_tz; - self.givenRX = object.model_st_rx; - self.givenRY = object.model_st_ry; - self.givenRZ = object.model_st_rz; - self.givenUS = object.model_st_us; + self.givenModel = object.model_path + self.givenModelId = object.model_fileId + self.givenApi = object.api + + if object.api then + self.givenTX = object.model_st_tx + self.givenTY = object.model_st_ty + self.givenTZ = object.model_st_tz + self.givenRX = object.model_st_rx + self.givenRY = object.model_st_ry + self.givenRZ = object.model_st_rz + self.givenUS = object.model_st_us else - self.givenZ = object.model_z; - self.givenX = object.model_x; - self.givenY = object.model_y; - self.givenRotation = object.rotation; + self.givenZ = object.model_z + self.givenX = object.model_x + self.givenY = object.model_y + self.givenRotation = object.rotation end end - frame.window = "model"; + frame.window = "model" frame:UpdateFrameVisible() end @@ -517,40 +529,40 @@ local function ConstructModelPicker(frame) function group.CancelClose() local valueFromPath = OptionsPrivate.Private.ValueFromPath - if(group.baseObject.controlledChildren) then + if group.baseObject.controlledChildren then for child in OptionsPrivate.Private.TraverseLeafs(group.baseObject) do local childId = child.id local object = valueFromPath(child, group.path) - if(object) then - object.model_path = group.givenModel[childId]; - object.model_fileId = group.givenModelId[childId]; - object.api = group.givenApi[childId]; - if (object.api) then - object.model_st_tx = group.givenTX[childId]; - object.model_st_ty = group.givenTY[childId]; - object.model_st_tz = group.givenTZ[childId]; - object.model_st_rx = group.givenRX[childId]; - object.model_st_ry = group.givenRY[childId]; - object.model_st_rz = group.givenRZ[childId]; - object.model_st_us = group.givenUS[childId]; + if object then + object.model_path = group.givenModel[childId] + object.model_fileId = group.givenModelId[childId] + object.api = group.givenApi[childId] + if object.api then + object.model_st_tx = group.givenTX[childId] + object.model_st_ty = group.givenTY[childId] + object.model_st_tz = group.givenTZ[childId] + object.model_st_rx = group.givenRX[childId] + object.model_st_ry = group.givenRY[childId] + object.model_st_rz = group.givenRZ[childId] + object.model_st_us = group.givenUS[childId] else - object.model_z = group.givenZ[childId]; - object.model_x = group.givenX[childId]; - object.model_y = group.givenY[childId]; - object.rotation = group.givenRotation[childId]; + object.model_z = group.givenZ[childId] + object.model_x = group.givenX[childId] + object.model_y = group.givenY[childId] + object.rotation = group.givenRotation[childId] end - WeakAuras.Add(child); - WeakAuras.UpdateThumbnail(child); + WeakAuras.Add(child) + WeakAuras.UpdateThumbnail(child) end end else local object = valueFromPath(group.baseObject, group.path) - if(object) then + if object then object.model_path = group.givenModel object.model_fileId = group.givenModelId object.api = group.givenApi - if (object.api) then + if object.api then object.model_st_tx = group.givenTX object.model_st_ty = group.givenTY object.model_st_tz = group.givenTZ @@ -564,26 +576,26 @@ local function ConstructModelPicker(frame) object.model_y = group.givenY object.rotation = group.givenRotation end - WeakAuras.Add(group.baseObject); - WeakAuras.UpdateThumbnail(group.baseObject); + WeakAuras.Add(group.baseObject) + WeakAuras.UpdateThumbnail(group.baseObject) end end - group.Close(); + group.Close() end - local cancel = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate"); - cancel:SetScript("OnClick", group.CancelClose); - cancel:SetPoint("bottomright", frame, "bottomright", -27, 16); - cancel:SetHeight(20); - cancel:SetWidth(100); - cancel:SetText(L["Cancel"]); - - local close = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate"); - close:SetScript("OnClick", group.Close); - close:SetPoint("RIGHT", cancel, "LEFT", -10, 0); - close:SetHeight(20); - close:SetWidth(100); - close:SetText(L["Okay"]); + local cancel = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate") + cancel:SetScript("OnClick", group.CancelClose) + cancel:SetPoint("bottomright", frame, "bottomright", -27, 16) + cancel:SetHeight(20) + cancel:SetWidth(100) + cancel:SetText(L["Cancel"]) + + local close = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate") + close:SetScript("OnClick", group.Close) + close:SetPoint("RIGHT", cancel, "LEFT", -10, 0) + close:SetHeight(20) + close:SetWidth(100) + close:SetText(L["Okay"]) return group end diff --git a/WeakAurasOptions/OptionsFrames/MoverSizer.lua b/WeakAurasOptions/OptionsFrames/MoverSizer.lua index 53347217ab..eec0e0ab42 100644 --- a/WeakAurasOptions/OptionsFrames/MoverSizer.lua +++ b/WeakAurasOptions/OptionsFrames/MoverSizer.lua @@ -1,12 +1,13 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... - -- Lua APIs local pairs = pairs -- WoW APIs -local IsShiftKeyDown, CreateFrame = IsShiftKeyDown, CreateFrame +local IsShiftKeyDown, CreateFrame = IsShiftKeyDown, CreateFrame local WeakAuras = WeakAuras local L = WeakAuras.L @@ -80,7 +81,9 @@ local function ConstructMover(frame) top:SetNormalTexture("interface\\buttons\\ui-scrollbar-scrollupbutton-up.blp") top:SetHighlightTexture("interface\\buttons\\ui-scrollbar-scrollupbutton-highlight.blp") top:SetPushedTexture("interface\\buttons\\ui-scrollbar-scrollupbutton-down.blp") - top:SetScript("OnClick", function() moveOnePxl("top") end) + top:SetScript("OnClick", function() + moveOnePxl("top") + end) bottom:SetNormalTexture("interface\\buttons\\ui-scrollbar-scrollupbutton-up.blp") bottom:GetNormalTexture():SetTexCoord(0, 1, 1, 0) @@ -88,23 +91,29 @@ local function ConstructMover(frame) bottom:GetHighlightTexture():SetTexCoord(0, 1, 1, 0) bottom:SetPushedTexture("interface\\buttons\\ui-scrollbar-scrollupbutton-down.blp") bottom:GetPushedTexture():SetTexCoord(0, 1, 1, 0) - bottom:SetScript("OnClick", function() moveOnePxl("bottom") end) + bottom:SetScript("OnClick", function() + moveOnePxl("bottom") + end) left:SetNormalTexture("interface\\buttons\\ui-scrollbar-scrollupbutton-up.blp") - left:GetNormalTexture():SetRotation(math.pi/2) + left:GetNormalTexture():SetRotation(math.pi / 2) left:SetHighlightTexture("interface\\buttons\\ui-scrollbar-scrollupbutton-highlight.blp") - left:GetHighlightTexture():SetRotation(math.pi/2) + left:GetHighlightTexture():SetRotation(math.pi / 2) left:SetPushedTexture("interface\\buttons\\ui-scrollbar-scrollupbutton-down.blp") - left:GetPushedTexture():SetRotation(math.pi/2) - left:SetScript("OnClick", function() moveOnePxl("left") end) + left:GetPushedTexture():SetRotation(math.pi / 2) + left:SetScript("OnClick", function() + moveOnePxl("left") + end) right:SetNormalTexture("interface\\buttons\\ui-scrollbar-scrollupbutton-up.blp") - right:GetNormalTexture():SetRotation(-math.pi/2) + right:GetNormalTexture():SetRotation(-math.pi / 2) right:SetHighlightTexture("interface\\buttons\\ui-scrollbar-scrollupbutton-highlight.blp") - right:GetHighlightTexture():SetRotation(-math.pi/2) + right:GetHighlightTexture():SetRotation(-math.pi / 2) right:SetPushedTexture("interface\\buttons\\ui-scrollbar-scrollupbutton-down.blp") - right:GetPushedTexture():SetRotation(-math.pi/2) - right:SetScript("OnClick", function() moveOnePxl("right") end) + right:GetPushedTexture():SetRotation(-math.pi / 2) + right:SetScript("OnClick", function() + moveOnePxl("right") + end) local arrow = CreateFrame("Frame", nil, frame) arrow:SetClampedToScreen(true) @@ -118,14 +127,14 @@ local function ConstructMover(frame) arrowTexture:SetVertexColor(0.8, 0.8, 0.2) arrowTexture:Hide() local offscreenText = arrow:CreateFontString(nil, "OVERLAY") - offscreenText:SetFont(STANDARD_TEXT_FONT, 14, "THICKOUTLINE"); + offscreenText:SetFont(STANDARD_TEXT_FONT, 14, "THICKOUTLINE") offscreenText:SetText(L["Aura is\nOff Screen"]) offscreenText:Hide() offscreenText:SetPoint("CENTER", arrow, "CENTER") local lineX = frame:CreateLine(nil, "OVERLAY", 7) lineX:SetThickness(2) - lineX:SetColorTexture(1,1,0) + lineX:SetColorTexture(1, 1, 0) lineX:SetStartPoint("BOTTOMLEFT", UIParent) lineX:SetEndPoint("BOTTOMRIGHT", UIParent) lineX:Hide() @@ -133,7 +142,7 @@ local function ConstructMover(frame) local lineY = frame:CreateLine(nil, "OVERLAY", 7) lineY:SetThickness(2) - lineY:SetColorTexture(1,1,0) + lineY:SetColorTexture(1, 1, 0) lineY:SetStartPoint("TOPLEFT", UIParent) lineY:SetEndPoint("BOTTOMLEFT", UIParent) lineY:SetIgnoreParentAlpha(true) @@ -373,7 +382,7 @@ local function BuildAlignLines(mover) local data = mover.moving.data local align = { x = {}, - y = {} + y = {}, } local x, y = {}, {} local skipIds = {} @@ -403,12 +412,12 @@ local function BuildAlignLines(mover) table.sort(x) table.sort(y) for index, value in ipairs(x) do - if value ~= x[index+1] then + if value ~= x[index + 1] then tinsert(align.x, value) end end for index, value in ipairs(y) do - if value ~= y[index+1] then + if value ~= y[index + 1] then tinsert(align.y, value) end end @@ -420,12 +429,11 @@ local function ConstructMoverSizer(parent) frame:SetBackdrop({ edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", edgeSize = 12, - insets = {left = 0, right = 0, top = 0, bottom = 0} + insets = { left = 0, right = 0, top = 0, bottom = 0 }, }) frame:EnableMouse() - frame.top, frame.topright, frame.right, frame.bottomright, frame.bottom, frame.bottomleft, frame.left, frame.topleft - = ConstructSizer(frame) + frame.top, frame.topright, frame.right, frame.bottomright, frame.bottom, frame.bottomleft, frame.left, frame.topleft = ConstructSizer(frame) frame.lineX, frame.lineY, frame.arrowTexture, frame.offscreenText = ConstructMover(frame) @@ -466,7 +474,7 @@ local function ConstructMoverSizer(parent) local limit = math.min(width, height) + 16 local size = 16 if limit <= 40 then - size = limit * (2/5) + size = limit * (2 / 5) end frame.bottomleft:SetWidth(size) frame.bottomleft:SetHeight(size) @@ -569,8 +577,7 @@ local function ConstructMoverSizer(parent) mover.isMoving = false mover.text:Hide() - local align = (WeakAurasOptionsSaved.magnetAlign and not IsShiftKeyDown()) - or (not WeakAurasOptionsSaved.magnetAlign and IsShiftKeyDown()) + local align = (WeakAurasOptionsSaved.magnetAlign and not IsShiftKeyDown()) or (not WeakAurasOptionsSaved.magnetAlign and IsShiftKeyDown()) if align and (mover.alignXFrom or mover.alignYFrom) then if mover.alignXFrom == "LEFT" then @@ -722,8 +729,7 @@ local function ConstructMoverSizer(parent) local width = region:GetWidth() local height = region:GetHeight() - local align = (WeakAurasOptionsSaved.magnetAlign and not IsShiftKeyDown()) - or (not WeakAurasOptionsSaved.magnetAlign and IsShiftKeyDown()) + local align = (WeakAurasOptionsSaved.magnetAlign and not IsShiftKeyDown()) or (not WeakAurasOptionsSaved.magnetAlign and IsShiftKeyDown()) if not IsControlKeyDown() then if point:find("RIGHT") then @@ -782,36 +788,68 @@ local function ConstructMoverSizer(parent) mover.sizePoint = nil end - frame.bottomleft:SetScript("OnMouseDown", function() frame.startSizing("BOTTOMLEFT") end) - frame.bottomleft:SetScript("OnMouseUp", function() frame.doneSizing("BOTTOMLEFT") end) + frame.bottomleft:SetScript("OnMouseDown", function() + frame.startSizing("BOTTOMLEFT") + end) + frame.bottomleft:SetScript("OnMouseUp", function() + frame.doneSizing("BOTTOMLEFT") + end) frame.bottomleft:SetScript("OnEnter", frame.bottomleft.Highlight) frame.bottomleft:SetScript("OnLeave", frame.bottomleft.Clear) - frame.bottom:SetScript("OnMouseDown", function() frame.startSizing("BOTTOM") end) - frame.bottom:SetScript("OnMouseUp", function() frame.doneSizing("BOTTOM") end) + frame.bottom:SetScript("OnMouseDown", function() + frame.startSizing("BOTTOM") + end) + frame.bottom:SetScript("OnMouseUp", function() + frame.doneSizing("BOTTOM") + end) frame.bottom:SetScript("OnEnter", frame.bottom.Highlight) frame.bottom:SetScript("OnLeave", frame.bottom.Clear) - frame.bottomright:SetScript("OnMouseDown", function() frame.startSizing("BOTTOMRIGHT") end) - frame.bottomright:SetScript("OnMouseUp", function() frame.doneSizing("BOTTOMRIGHT") end) + frame.bottomright:SetScript("OnMouseDown", function() + frame.startSizing("BOTTOMRIGHT") + end) + frame.bottomright:SetScript("OnMouseUp", function() + frame.doneSizing("BOTTOMRIGHT") + end) frame.bottomright:SetScript("OnEnter", frame.bottomright.Highlight) frame.bottomright:SetScript("OnLeave", frame.bottomright.Clear) - frame.right:SetScript("OnMouseDown", function() frame.startSizing("RIGHT") end) - frame.right:SetScript("OnMouseUp", function() frame.doneSizing("RIGHT") end) + frame.right:SetScript("OnMouseDown", function() + frame.startSizing("RIGHT") + end) + frame.right:SetScript("OnMouseUp", function() + frame.doneSizing("RIGHT") + end) frame.right:SetScript("OnEnter", frame.right.Highlight) frame.right:SetScript("OnLeave", frame.right.Clear) - frame.topright:SetScript("OnMouseDown", function() frame.startSizing("TOPRIGHT") end) - frame.topright:SetScript("OnMouseUp", function() frame.doneSizing("TOPRIGHT") end) + frame.topright:SetScript("OnMouseDown", function() + frame.startSizing("TOPRIGHT") + end) + frame.topright:SetScript("OnMouseUp", function() + frame.doneSizing("TOPRIGHT") + end) frame.topright:SetScript("OnEnter", frame.topright.Highlight) frame.topright:SetScript("OnLeave", frame.topright.Clear) - frame.top:SetScript("OnMouseDown", function() frame.startSizing("TOP") end) - frame.top:SetScript("OnMouseUp", function() frame.doneSizing("TOP") end) + frame.top:SetScript("OnMouseDown", function() + frame.startSizing("TOP") + end) + frame.top:SetScript("OnMouseUp", function() + frame.doneSizing("TOP") + end) frame.top:SetScript("OnEnter", frame.top.Highlight) frame.top:SetScript("OnLeave", frame.top.Clear) - frame.topleft:SetScript("OnMouseDown", function() frame.startSizing("TOPLEFT") end) - frame.topleft:SetScript("OnMouseUp", function() frame.doneSizing("TOPLEFT") end) + frame.topleft:SetScript("OnMouseDown", function() + frame.startSizing("TOPLEFT") + end) + frame.topleft:SetScript("OnMouseUp", function() + frame.doneSizing("TOPLEFT") + end) frame.topleft:SetScript("OnEnter", frame.topleft.Highlight) frame.topleft:SetScript("OnLeave", frame.topleft.Clear) - frame.left:SetScript("OnMouseDown", function() frame.startSizing("LEFT") end) - frame.left:SetScript("OnMouseUp", function() frame.doneSizing("LEFT") end) + frame.left:SetScript("OnMouseDown", function() + frame.startSizing("LEFT") + end) + frame.left:SetScript("OnMouseUp", function() + frame.doneSizing("LEFT") + end) frame.left:SetScript("OnEnter", frame.left.Highlight) frame.left:SetScript("OnLeave", frame.left.Clear) @@ -856,8 +894,7 @@ local function ConstructMoverSizer(parent) self.currentAlpha = newAlpha end - local align = (WeakAurasOptionsSaved.magnetAlign and not IsShiftKeyDown()) - or (not WeakAurasOptionsSaved.magnetAlign and IsShiftKeyDown()) + local align = (WeakAurasOptionsSaved.magnetAlign and not IsShiftKeyDown()) or (not WeakAurasOptionsSaved.magnetAlign and IsShiftKeyDown()) if align then self.alignGoalAlpha = 1 else @@ -902,15 +939,15 @@ local function ConstructMoverSizer(parent) local dX = selfX - anchorX local dY = selfY - anchorY - local distance = sqrt(dX^2 + dY^2) + local distance = sqrt(dX ^ 2 + dY ^ 2) local angle = atan2(dY, dX) - local numInterim = floor(distance/40) + local numInterim = floor(distance / 40) for _, texture in pairs(self.interims) do texture:Hide() end - for i = 1, numInterim do + for i = 1, numInterim do local x = (distance - (i * 40)) * cos(angle) local y = (distance - (i * 40)) * sin(angle) self.interims[i] = EnsureTexture(self, self.interims[i]) @@ -933,19 +970,17 @@ local function ConstructMoverSizer(parent) local arrowAngle = atan2(y - arrowY, x - arrowX) frame.offscreenText:Show() frame.arrowTexture:Show() - frame.arrowTexture:SetRotation( (arrowAngle - 90) / 180 * math.pi) + frame.arrowTexture:SetRotation((arrowAngle - 90) / 180 * math.pi) end end local regionScale = self.moving.region:GetScale() - self.text:SetText(("(%.2f, %.2f)"):format(dX*1/regionScale, dY*1/regionScale)) + self.text:SetText(("(%.2f, %.2f)"):format(dX * 1 / regionScale, dY * 1 / regionScale)) local midX = (distance / 2) * cos(angle) local midY = (distance / 2) * sin(angle) self.text:SetPoint("CENTER", self.anchorPointIcon, "CENTER", midX, midY) local left, right, top, bottom, centerX, centerY = frame:GetLeft(), frame:GetRight(), frame:GetTop(), frame:GetBottom(), frame:GetCenter() - if (midX > 0 and (self.text:GetRight() or 0) > (left or 0)) - or (midX < 0 and (self.text:GetLeft() or 0) < (right or 0)) - then + if (midX > 0 and (self.text:GetRight() or 0) > (left or 0)) or (midX < 0 and (self.text:GetLeft() or 0) < (right or 0)) then if midY > 0 and (self.text:GetTop() or 0) > (top or 0) then midY = midY - ((self.text:GetTop() or 0) - (bottom or 0)) elseif midY < 0 and (self.text:GetBottom() or 0) < (top or 0) then @@ -965,14 +1000,12 @@ local function ConstructMoverSizer(parent) start = reverse and #mover.align.x or 1 finish = reverse and 1 or #mover.align.x step = reverse and -1 or 1 - for i=start,finish,step do + for i = start, finish, step do local v = mover.align.x[i] - if not ctrlDown and ( - ((left >= v - 5 and left <= v + 5) and (not point or point:find("LEFT"))) - or ((right >= v - 5 and right <= v + 5) and (not point or point:find("RIGHT"))) - ) or ( - ctrlDown and centerX >= v - 5 and centerX <= v + 5 - ) + if + not ctrlDown + and (((left >= v - 5 and left <= v + 5) and (not point or point:find("LEFT"))) or ((right >= v - 5 and right <= v + 5) and (not point or point:find("RIGHT")))) + or (ctrlDown and centerX >= v - 5 and centerX <= v + 5) then frame.lineY:SetStartPoint("TOPLEFT", UIParent, v, 0) frame.lineY:SetEndPoint("BOTTOMLEFT", UIParent, v, 0) @@ -997,14 +1030,12 @@ local function ConstructMoverSizer(parent) start = reverse and #mover.align.y or 1 finish = reverse and 1 or #mover.align.y step = reverse and -1 or 1 - for i=start,finish,step do + for i = start, finish, step do local v = mover.align.y[i] - if not ctrlDown and ( - ((top >= v - 5 and top <= v + 5) and (not point or point:find("TOP"))) - or ((bottom >= v - 5 and bottom <= v + 5) and (not point or point:find("BOTTOM"))) - ) or ( - ctrlDown and centerY >= v - 5 and centerY <= v + 5 - ) + if + not ctrlDown + and (((top >= v - 5 and top <= v + 5) and (not point or point:find("TOP"))) or ((bottom >= v - 5 and bottom <= v + 5) and (not point or point:find("BOTTOM")))) + or (ctrlDown and centerY >= v - 5 and centerY <= v + 5) then frame.lineX:SetStartPoint("BOTTOMLEFT", UIParent, 0, v) frame.lineX:SetEndPoint("BOTTOMRIGHT", UIParent, 0, v) diff --git a/WeakAurasOptions/OptionsFrames/OptionsFrame.lua b/WeakAurasOptions/OptionsFrames/OptionsFrame.lua index f9d2a36b9f..7a1f6b3846 100644 --- a/WeakAurasOptions/OptionsFrames/OptionsFrame.lua +++ b/WeakAurasOptions/OptionsFrames/OptionsFrame.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... -- Lua APIs @@ -7,8 +9,7 @@ local pairs, type, error = pairs, type, error local _G = _G -- WoW APIs -local GetScreenWidth, GetScreenHeight, CreateFrame, UnitName - = GetScreenWidth, GetScreenHeight, CreateFrame, UnitName +local GetScreenWidth, GetScreenHeight, CreateFrame, UnitName = GetScreenWidth, GetScreenHeight, CreateFrame, UnitName local AceGUI = LibStub("AceGUI-3.0") local AceConfig = LibStub("AceConfig-3.0") @@ -68,7 +69,7 @@ local function CreateDecorationWide(frame, width) end local function CreateFrameSizer(frame, callback, position) - callback = callback or (function() end) + callback = callback or function() end local left, right, top, bottom, xOffset1, yOffset1, xOffset2, yOffset2 if position == "BOTTOMLEFT" then @@ -147,7 +148,7 @@ function OptionsPrivate.CreateFrame() tile = true, tileSize = 32, edgeSize = 32, - insets = { left = 8, right = 8, top = 8, bottom = 8 } + insets = { left = 8, right = 8, top = 8, bottom = 8 }, }) frame:SetBackdropColor(0.1, 0.1, 0.1, 0.85) frame:EnableMouse(true) @@ -175,7 +176,6 @@ function OptionsPrivate.CreateFrame() OptionsPrivate.Private.ClearFakeStates() - for id, data in pairs(WeakAuras.regions) do data.region:Collapse() data.region:OptionsClosed() @@ -231,7 +231,6 @@ function OptionsPrivate.CreateFrame() titleBG:SetPoint("TOP", 0, 24) titleText:SetPoint("TOP", titleBG, "TOP", 0, -14) - local function commitWindowChanges() local xOffset = frame:GetRight() - GetScreenWidth() local yOffset = frame:GetTop() - GetScreenHeight() @@ -257,7 +256,9 @@ function OptionsPrivate.CreateFrame() end title:EnableMouse(true) - title:SetScript("OnMouseDown", function() frame:StartMoving() end) + title:SetScript("OnMouseDown", function() + frame:StartMoving() + end) title:SetScript("OnMouseUp", function() frame:StopMovingOrSizing() commitWindowChanges() @@ -289,7 +290,7 @@ function OptionsPrivate.CreateFrame() self.loadProgress:Hide() self.toolbarContainer.frame:Hide() - self.filterInput:Hide(); + self.filterInput:Hide() self.tipFrame.frame:Hide() self.bottomLeftResizer:Hide() self.bottomRightResizer:Hide() @@ -366,17 +367,17 @@ function OptionsPrivate.CreateFrame() if self.loadProgessVisible then self.loadProgress:Show() self.toolbarContainer.frame:Hide() - self.filterInput:Hide(); + self.filterInput:Hide() else self.loadProgress:Hide() self.toolbarContainer.frame:Show() - self.filterInput:Show(); + self.filterInput:Show() --self.filterInputClear:Show(); end else self.loadProgress:Hide() self.toolbarContainer.frame:Hide() - self.filterInput:Hide(); + self.filterInput:Hide() end end end @@ -426,7 +427,7 @@ function OptionsPrivate.CreateFrame() tile = true, tileSize = 16, edgeSize = 16, - insets = { left = 4, right = 4, top = 4, bottom = 4 } + insets = { left = 4, right = 4, top = 4, bottom = 4 }, }) tipPopup:SetBackdropColor(0, 0, 0, 0.8) --tipPopup:SetHeight(100) @@ -448,9 +449,16 @@ function OptionsPrivate.CreateFrame() urlWidget:SetFont(STANDARD_TEXT_FONT, 12) urlWidget:SetPoint("TOPLEFT", tipPopupLabel, "BOTTOMLEFT", 6, 0) urlWidget:SetPoint("TOPRIGHT", tipPopupLabel, "BOTTOMRIGHT", 0, 0) - urlWidget:SetScript("OnChar", function() urlWidget:SetText(urlWidget.text); urlWidget:HighlightText(); end); - urlWidget:SetScript("OnMouseUp", function() urlWidget:HighlightText(); end); - urlWidget:SetScript("OnEscapePressed", function() tipPopup:Hide() end) + urlWidget:SetScript("OnChar", function() + urlWidget:SetText(urlWidget.text) + urlWidget:HighlightText() + end) + urlWidget:SetScript("OnMouseUp", function() + urlWidget:HighlightText() + end) + urlWidget:SetScript("OnEscapePressed", function() + tipPopup:Hide() + end) urlWidget:SetHeight(34) local tipPopupCtrlC = tipPopup:CreateFontString(nil, "BACKGROUND", "GameFontWhite") @@ -488,22 +496,32 @@ function OptionsPrivate.CreateFrame() tipFrame:AddChild(button) end - addFooter(L["Get Help"], [[Interface\AddOns\WeakAuras\Media\Textures\discord.tga]], "https://discord.gg/weakauras", - L["Chat with WeakAuras experts on our Discord server."]) + addFooter(L["Get Help"], [[Interface\AddOns\WeakAuras\Media\Textures\discord.tga]], "https://discord.gg/weakauras", L["Chat with WeakAuras experts on our Discord server."]) - addFooter(L["Documentation"], [[Interface\AddOns\WeakAuras\Media\Textures\GitHub.tga]], "https://github.com/WeakAuras/WeakAuras2/wiki", - L["Check out our wiki for a large collection of examples and snippets."]) + addFooter( + L["Documentation"], + [[Interface\AddOns\WeakAuras\Media\Textures\GitHub.tga]], + "https://github.com/WeakAuras/WeakAuras2/wiki", + L["Check out our wiki for a large collection of examples and snippets."] + ) - addFooter(L["Find Auras"], [[Interface\AddOns\WeakAuras\Media\Textures\wagoupdate_logo.tga]], "https://wago.io", - L["Browse Wago, the largest collection of auras."]) + addFooter(L["Find Auras"], [[Interface\AddOns\WeakAuras\Media\Textures\wagoupdate_logo.tga]], "https://wago.io", L["Browse Wago, the largest collection of auras."]) if not OptionsPrivate.Private.CompanionData.slugs then - addFooter(L["Update Auras"], [[Interface\AddOns\WeakAuras\Media\Textures\wagoupdate_refresh.tga]], "https://weakauras.wtf", - L["Keep your Wago imports up to date with the Companion App."]) + addFooter( + L["Update Auras"], + [[Interface\AddOns\WeakAuras\Media\Textures\wagoupdate_refresh.tga]], + "https://weakauras.wtf", + L["Keep your Wago imports up to date with the Companion App."] + ) end - addFooter(L["Found a Bug?"], [[Interface\AddOns\WeakAuras\Media\Textures\bug_report.tga]], "https://github.com/WeakAuras/WeakAuras2/issues/new?assignees=&labels=%F0%9F%90%9B+Bug&template=bug_report.md&title=", - L["Report bugs on our issue tracker."]) + addFooter( + L["Found a Bug?"], + [[Interface\AddOns\WeakAuras\Media\Textures\bug_report.tga]], + "https://github.com/WeakAuras/WeakAuras2/issues/new?assignees=&labels=%F0%9F%90%9B+Bug&template=bug_report.md&title=", + L["Report bugs on our issue tracker."] + ) -- Disable for now --local closeTipButton = CreateFrame("Button", nil, tipFrame.frame, "UIPanelCloseButton") @@ -641,7 +659,7 @@ function OptionsPrivate.CreateFrame() local loadProgress = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal") loadProgress:SetPoint("TOP", buttonsContainer.frame, "TOP", 0, -4) - loadProgress:SetText(L["Creating options: "].."0/0") + loadProgress:SetText(L["Creating options: "] .. "0/0") frame.loadProgress = loadProgress frame.SetLoadProgressVisible = function(self, visible) @@ -649,7 +667,6 @@ function OptionsPrivate.CreateFrame() self:UpdateFrameVisible() end - local buttonsScroll = AceGUI:Create("ScrollFrame") buttonsScroll:SetLayout("ButtonsScrollLayout") buttonsScroll.width = "fill" @@ -884,7 +901,6 @@ function OptionsPrivate.CreateFrame() unloadedButton:SetViewDescription(L["Toggle the visibility of all non-loaded displays"]) frame.unloadedButton = unloadedButton - frame.ClearOptions = function(self, id) aceOptions[id] = nil OptionsPrivate.commonOptionsCache:Clear() @@ -894,7 +910,7 @@ function OptionsPrivate.CreateFrame() frame:ClearOptions(data.parent) end for child in OptionsPrivate.Private.TraverseAllChildren(tempGroup) do - if (id == child.id) then + if id == child.id then frame:ClearOptions(tempGroup.id) end end @@ -916,9 +932,7 @@ function OptionsPrivate.CreateFrame() frame:ClearOptions(child.id) end end - if (type(self.pickedDisplay) == "string" and self.pickedDisplay == id) - or (type(self.pickedDisplay) == "table" and id == tempGroup.id) - then + if (type(self.pickedDisplay) == "string" and self.pickedDisplay == id) or (type(self.pickedDisplay) == "table" and id == tempGroup.id) then frame:UpdateOptions() end end @@ -952,10 +966,9 @@ function OptionsPrivate.CreateFrame() local id = data.id aceOptions[id] = aceOptions[id] or {} if not aceOptions[id][tab] then - local optionsGenerator = - { + local optionsGenerator = { group = OptionsPrivate.GetGroupOptions, - region = OptionsPrivate.GetDisplayOptions, + region = OptionsPrivate.GetDisplayOptions, trigger = OptionsPrivate.GetTriggerOptions, conditions = OptionsPrivate.GetConditionOptions, load = OptionsPrivate.GetLoadOptions, @@ -1001,18 +1014,18 @@ function OptionsPrivate.CreateFrame() tabsWidget = AceGUI:Create("TabGroup") local tabs = { - { value = "region", text = L["Display"]}, - { value = "trigger", text = L["Trigger"]}, - { value = "conditions", text = L["Conditions"]}, - { value = "action", text = L["Actions"]}, - { value = "animation", text = L["Animations"]}, - { value = "load", text = L["Load"]}, - { value = "authorOptions", text = L["Custom Options"]}, - { value = "information", text = L["Information"]}, + { value = "region", text = L["Display"] }, + { value = "trigger", text = L["Trigger"] }, + { value = "conditions", text = L["Conditions"] }, + { value = "action", text = L["Actions"] }, + { value = "animation", text = L["Animations"] }, + { value = "load", text = L["Load"] }, + { value = "authorOptions", text = L["Custom Options"] }, + { value = "information", text = L["Information"] }, } -- Check if group and not the temp group if data.controlledChildren and type(data.id) == "string" then - tinsert(tabs, 1, { value = "group", text = L["Group"]}) + tinsert(tabs, 1, { value = "group", text = L["Group"] }) end tabsWidget:SetTabs(tabs) @@ -1024,9 +1037,9 @@ function OptionsPrivate.CreateFrame() tabsWidget:AddChild(group) tabsWidget:SetCallback("OnGroupSelected", function(self, event, tab) - frame.selectedTab = tab - frame:FillOptions() - end) + frame.selectedTab = tab + frame:FillOptions() + end) AceConfigDialog:Open("WeakAuras", group) tabsWidget:SetTitle("") @@ -1060,7 +1073,7 @@ function OptionsPrivate.CreateFrame() frame.pickedDisplay = newid else for i, childId in pairs(tempGroup.controlledChildren) do - if (childId == newid) then + if childId == newid then tempGroup.controlledChildren[i] = newid end end @@ -1183,18 +1196,18 @@ function OptionsPrivate.CreateFrame() -- Sort group + dynamic group first, then the others alphabetically table.sort(regionTypesSorted, function(a, b) - if (a == "group") then + if a == "group" then return true end - if (b == "group") then + if b == "group" then return false end - if (a == "dynamicgroup") then + if a == "dynamicgroup" then return true end - if (b == "dynamicgroup") then + if b == "dynamicgroup" then return false end @@ -1202,13 +1215,13 @@ function OptionsPrivate.CreateFrame() end) for index, regionType in ipairs(regionTypesSorted) do - if (targetIsDynamicGroup and (regionType == "group" or regionType == "dynamicgroup")) then + if targetIsDynamicGroup and (regionType == "group" or regionType == "dynamicgroup") then -- Dynamic groups can't contain group/dynamic groups else local regionData = regionOptions[regionType] local button = AceGUI:Create("WeakAurasNewButton") button:SetTitle(regionData.displayName) - if(type(regionData.icon) == "string" or type(regionData.icon) == "table") then + if type(regionData.icon) == "string" or type(regionData.icon) == "table" then button:SetIcon(regionData.icon) end button:SetDescription(regionData.description) @@ -1240,7 +1253,7 @@ function OptionsPrivate.CreateFrame() local data = { outline = false, - color = {1, 1, 1, 1}, + color = { 1, 1, 1, 1 }, justify = "CENTER", font = "Friz Quadrata TT", fontSize = 8, @@ -1255,7 +1268,7 @@ function OptionsPrivate.CreateFrame() jNxtLgzEnLt LDNx051u25L tXmdmY4fDE5 - ]] + ]], } if not frame.importThumbnail then @@ -1311,7 +1324,6 @@ function OptionsPrivate.CreateFrame() displayButtons[id]:Pick() self.pickedDisplay = id - if tab then self.selectedTab = tab end @@ -1400,7 +1412,7 @@ function OptionsPrivate.CreateFrame() frame:SetClampedToScreen(true) local w, h = frame:GetSize() - local left, right, top, bottom = w/2,-w/2, 0, h-25 + local left, right, top, bottom = w / 2, -w / 2, 0, h - 25 frame:SetClampRectInsets(left, right, top, bottom) return frame diff --git a/WeakAurasOptions/OptionsFrames/TextEditor.lua b/WeakAurasOptions/OptionsFrames/TextEditor.lua index 2ab27384f6..19d46a6fe5 100644 --- a/WeakAurasOptions/OptionsFrames/TextEditor.lua +++ b/WeakAurasOptions/OptionsFrames/TextEditor.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... -- Lua APIs @@ -28,7 +30,7 @@ local editor_themes = { ["Keyword"] = "|c004444ff", ["Comment"] = "|c0000aa00", ["Number"] = "|c00ff9900", - ["String"] = "|c00999999" + ["String"] = "|c00999999", }, ["Monokai"] = { ["Table"] = "|c00ffffff", @@ -39,7 +41,7 @@ local editor_themes = { ["Keyword"] = "|c00f92672", ["Comment"] = "|c0075715e", ["Number"] = "|c00ae81ff", - ["String"] = "|c00e6db74" + ["String"] = "|c00e6db74", }, ["Obsidian"] = { ["Table"] = "|c00AFC0E5", @@ -50,13 +52,17 @@ local editor_themes = { ["Keyword"] = "|c0093C763", ["Comment"] = "|c0066747B", ["Number"] = "|c00FFCD22", - ["String"] = "|c00EC7600" - } + ["String"] = "|c00EC7600", + }, } -if not WeakAurasSaved.editor_tab_spaces then WeakAurasSaved.editor_tab_spaces = 4 end -if not WeakAurasSaved.editor_font_size then WeakAurasSaved.editor_font_size = 12 end -- set default font size if missing -local color_scheme = {[0] = "|r"} +if not WeakAurasSaved.editor_tab_spaces then + WeakAurasSaved.editor_tab_spaces = 4 +end +if not WeakAurasSaved.editor_font_size then + WeakAurasSaved.editor_font_size = 12 +end -- set default font size if missing +local color_scheme = { [0] = "|r" } local function set_scheme() if not WeakAurasSaved.editor_theme then WeakAurasSaved.editor_theme = "Monokai" @@ -101,14 +107,14 @@ local premadeSnippets = { function() return -end]=] +end]=], }, { name = "Custom Activation", snippet = [=[ function(trigger) return trigger[1] and (trigger[2] or trigger[3]) -end]=] +end]=], }, { name = "Trigger: CLEU", @@ -116,7 +122,7 @@ end]=] function(event, timestamp, subEvent, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags, ...) return -end]=] +end]=], }, { name = "Simple throttle", @@ -124,7 +130,7 @@ end]=] if not aura_env.last or aura_env.last < GetTime() - 1 then aura_env.last = GetTime() -end]=] +end]=], }, { name = "Trigger State Updater", @@ -145,15 +151,15 @@ function(allstates, event, ...) index = , } return true -end]=] +end]=], }, } local function ConstructTextEditor(frame) local group = AceGUI:Create("WeakAurasInlineGroup") group.frame:SetParent(frame) - group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 16, -16); - group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -16, 46); + group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 16, -16) + group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -16, 46) group.frame:Hide() group:SetLayout("flow") @@ -168,7 +174,7 @@ local function ConstructTextEditor(frame) editor:SetFullHeight(true) editor:DisableButton(true) local fontPath = SharedMedia:Fetch("font", "Fira Mono Medium") - if (fontPath) then + if fontPath then editor.editBox:SetFont(fontPath, WeakAurasSaved.editor_font_size) end group:AddChild(editor) @@ -193,12 +199,9 @@ local function ConstructTextEditor(frame) IndentationLib.enable(editor.editBox, color_scheme, WeakAurasSaved.editor_tab_spaces) local cancel = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate") - cancel:SetScript( - "OnClick", - function() - group:CancelClose() - end - ) + cancel:SetScript("OnClick", function() + group:CancelClose() + end) cancel:SetPoint("BOTTOMRIGHT", -20, -24) cancel:SetFrameLevel(cancel:GetFrameLevel() + 1) cancel:SetHeight(20) @@ -206,12 +209,9 @@ local function ConstructTextEditor(frame) cancel:SetText(L["Cancel"]) local close = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate") - close:SetScript( - "OnClick", - function() - group:Close() - end - ) + close:SetScript("OnClick", function() + group:Close() + end) close:SetPoint("RIGHT", cancel, "LEFT", -10, 0) close:SetFrameLevel(close:GetFrameLevel() + 1) close:SetHeight(20) @@ -263,84 +263,71 @@ local function ConstructTextEditor(frame) WeakAurasSaved.editor_theme = k set_scheme() editor.editBox:SetText(editor.editBox:GetText()) - end + end, } UIDropDownMenu_AddButton(item, level) end - UIDropDownMenu_AddButton( - { - text = L["Bracket Matching"], - isNotRadio = true, + UIDropDownMenu_AddButton({ + text = L["Bracket Matching"], + isNotRadio = true, + checked = function() + return WeakAurasSaved.editor_bracket_matching + end, + func = function() + WeakAurasSaved.editor_bracket_matching = not WeakAurasSaved.editor_bracket_matching + end, + }, level) + UIDropDownMenu_AddButton({ + text = L["Indent Size"], + hasArrow = true, + notCheckable = true, + menuList = "spaces", + }, level) + UIDropDownMenu_AddButton({ + text = WeakAuras.newFeatureString .. L["Font Size"], + hasArrow = true, + notCheckable = true, + menuList = "sizes", + }, level) + elseif menu == "spaces" then + local spaces = { 2, 4 } + for _, i in pairs(spaces) do + UIDropDownMenu_AddButton({ + text = i, + isNotRadio = false, checked = function() - return WeakAurasSaved.editor_bracket_matching + return WeakAurasSaved.editor_tab_spaces == i end, func = function() - WeakAurasSaved.editor_bracket_matching = not WeakAurasSaved.editor_bracket_matching - end - }, - level) - UIDropDownMenu_AddButton( - { - text = L["Indent Size"], - hasArrow = true, - notCheckable = true, - menuList = "spaces" - }, - level) - UIDropDownMenu_AddButton( - { - text = WeakAuras.newFeatureString .. L["Font Size"], - hasArrow = true, - notCheckable = true, - menuList = "sizes" - }, - level) - elseif menu == "spaces" then - local spaces = {2,4} - for _, i in pairs(spaces) do - UIDropDownMenu_AddButton( - { - text = i, - isNotRadio = false, - checked = function() - return WeakAurasSaved.editor_tab_spaces == i - end, - func = function() - WeakAurasSaved.editor_tab_spaces = i - IndentationLib.enable(editor.editBox, color_scheme, WeakAurasSaved.editor_tab_spaces) - editor.editBox:SetText(editor.editBox:GetText().."\n") - IndentationLib.indentEditbox(editor.editBox) - end - }, - level) + WeakAurasSaved.editor_tab_spaces = i + IndentationLib.enable(editor.editBox, color_scheme, WeakAurasSaved.editor_tab_spaces) + editor.editBox:SetText(editor.editBox:GetText() .. "\n") + IndentationLib.indentEditbox(editor.editBox) + end, + }, level) end elseif menu == "sizes" then - local sizes = {10, 12, 14, 16} + local sizes = { 10, 12, 14, 16 } for _, i in pairs(sizes) do - UIDropDownMenu_AddButton( - { - text = i, - isNotRadio = false, - checked = function() - return WeakAurasSaved.editor_font_size == i - end, - func = function() - WeakAurasSaved.editor_font_size = i - editor.editBox:SetFont(fontPath, WeakAurasSaved.editor_font_size) - end - }, - level) + UIDropDownMenu_AddButton({ + text = i, + isNotRadio = false, + checked = function() + return WeakAurasSaved.editor_font_size == i + end, + func = function() + WeakAurasSaved.editor_font_size = i + editor.editBox:SetFont(fontPath, WeakAurasSaved.editor_font_size) + end, + }, level) end end end UIDropDownMenu_Initialize(dropdown, settings_dropdown_initialize, "MENU") - settings_frame:SetScript( - "OnClick", - function(self, button, down) - ToggleDropDownMenu(1, nil, dropdown, settings_frame, 0, 0) - end - ) + settings_frame:SetScript("OnClick", function(self, button, down) + ToggleDropDownMenu(1, nil, dropdown, settings_frame, 0, 0) + end) -- Make Snippets button (top right, near the line number) local snippetsButton = CreateFrame("Button", "WASnippetsButton", group.frame, "UIPanelButtonTemplate") @@ -359,12 +346,9 @@ local function ConstructTextEditor(frame) local function UpdateSnippets(frame) -- release first before rebuilding frame:ReleaseChildren() - table.sort( - savedSnippets, - function(a, b) - return a.name < b.name - end - ) + table.sort(savedSnippets, function(a, b) + return a.name < b.name + end) local heading1 = AceGUI:Create("Heading") heading1:SetText(L["Premade Snippets"]) @@ -376,13 +360,10 @@ local function ConstructTextEditor(frame) local button = AceGUI:Create("WeakAurasSnippetButton") button:SetTitle(snippet.name) button:SetDescription(snippet.snippet) - button:SetCallback( - "OnClick", - function() - editor.editBox:Insert(snippet.snippet) - editor:SetFocus() - end - ) + button:SetCallback("OnClick", function() + editor.editBox:Insert(snippet.snippet) + editor:SetFocus() + end) button:SetRelativeWidth(1) frame:AddChild(button) end @@ -402,39 +383,30 @@ local function ConstructTextEditor(frame) button:SetRelativeWidth(1) button:SetNew(snippet.new) snippet.new = false - button:SetCallback( - "OnClick", - function() - editor.editBox:Insert(snippetInsert) - editor:SetFocus() - end - ) - button.deleteButton:SetScript( - "OnClick", - function() - table.remove(savedSnippets, order) - UpdateSnippets(frame) - end - ) - button:SetCallback( - "OnEnterPressed", - function() - local newName = button.renameEditBox:GetText() - if newName and #newName > 0 then - local found = false - for _, snippet in ipairs(savedSnippets) do - if snippet.name == newName then - found = true - break - end - end - if not found then - savedSnippets[order].name = newName - UpdateSnippets(frame) + button:SetCallback("OnClick", function() + editor.editBox:Insert(snippetInsert) + editor:SetFocus() + end) + button.deleteButton:SetScript("OnClick", function() + table.remove(savedSnippets, order) + UpdateSnippets(frame) + end) + button:SetCallback("OnEnterPressed", function() + local newName = button.renameEditBox:GetText() + if newName and #newName > 0 then + local found = false + for _, snippet in ipairs(savedSnippets) do + if snippet.name == newName then + found = true + break end end + if not found then + savedSnippets[order].name = newName + UpdateSnippets(frame) + end end - ) + end) frame:AddChild(button) end end @@ -444,16 +416,14 @@ local function ConstructTextEditor(frame) snippetsFrame:SetPoint("TOPLEFT", group.frame, "TOPRIGHT", 20, 0) snippetsFrame:SetPoint("BOTTOMLEFT", group.frame, "BOTTOMRIGHT", 20, 0) snippetsFrame:SetWidth(250) - snippetsFrame:SetBackdrop( - { - bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background", - edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", - tile = true, - tileSize = 32, - edgeSize = 32, - insets = {left = 8, right = 8, top = 8, bottom = 8} - } - ) + snippetsFrame:SetBackdrop({ + bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background", + edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", + tile = true, + tileSize = 32, + edgeSize = 32, + insets = { left = 8, right = 8, top = 8, bottom = 8 }, + }) snippetsFrame:SetBackdropColor(0, 0, 0, 1) -- Add button to save new snippet @@ -477,79 +447,64 @@ local function ConstructTextEditor(frame) snippetsScroll:SetLayout("List") snippetsScrollContainer:AddChild(snippetsScroll) snippetsScroll:FixScroll(true) - snippetsScroll.scrollframe:SetScript( - "OnScrollRangeChanged", - function(frame) - frame.obj:DoLayout() - end - ) + snippetsScroll.scrollframe:SetScript("OnScrollRangeChanged", function(frame) + frame.obj:DoLayout() + end) snippetsFrame:Hide() -- Toggle the side bar on click - snippetsButton:SetScript( - "OnClick", - function(self, button, down) - if not snippetsFrame:IsShown() then - snippetsFrame:Show() - UpdateSnippets(snippetsScroll) - else - snippetsFrame:Hide() - end + snippetsButton:SetScript("OnClick", function(self, button, down) + if not snippetsFrame:IsShown() then + snippetsFrame:Show() + UpdateSnippets(snippetsScroll) + else + snippetsFrame:Hide() end - ) - - AddSnippetButton:SetScript( - "OnClick", - function(self) - local snippet = editor.editBox:GetText() - if snippet and #snippet > 0 then - local baseName, name, index = "New Snippet", "New Snippet", 0 - local snippetExists = function(name) - for _, snippet in ipairs(savedSnippets) do - if snippet.name == name then - return true - end + end) + + AddSnippetButton:SetScript("OnClick", function(self) + local snippet = editor.editBox:GetText() + if snippet and #snippet > 0 then + local baseName, name, index = "New Snippet", "New Snippet", 0 + local snippetExists = function(name) + for _, snippet in ipairs(savedSnippets) do + if snippet.name == name then + return true end end - while snippetExists(name) do - index = index + 1 - name = format("%s %d", baseName, index) - end - table.insert(savedSnippets, {name = name, snippet = snippet, new = true}) - UpdateSnippets(snippetsScroll) - end end - ) + while snippetExists(name) do + index = index + 1 + name = format("%s %d", baseName, index) + end + table.insert(savedSnippets, { name = name, snippet = snippet, new = true }) + UpdateSnippets(snippetsScroll) + end + end) -- CTRL + S saves and closes - editor.editBox:HookScript( - "OnKeyDown", - function(_, key) - if IsControlKeyDown() and key == "S" then - group:Close() - end + editor.editBox:HookScript("OnKeyDown", function(_, key) + if IsControlKeyDown() and key == "S" then + group:Close() end - ) + end) -- bracket matching - editor.editBox:HookScript( - "OnChar", - function(_, char) - if not IsControlKeyDown() and WeakAurasSaved.editor_bracket_matching then - if char == "(" then - editor.editBox:Insert(")") - editor.editBox:SetCursorPosition(editor.editBox:GetCursorPosition() - 1) - elseif char == "{" then - editor.editBox:Insert("}") - editor.editBox:SetCursorPosition(editor.editBox:GetCursorPosition() - 1) - elseif char == "[" then - editor.editBox:Insert("]") - editor.editBox:SetCursorPosition(editor.editBox:GetCursorPosition() - 1) - end + editor.editBox:HookScript("OnChar", function(_, char) + if not IsControlKeyDown() and WeakAurasSaved.editor_bracket_matching then + if char == "(" then + editor.editBox:Insert(")") + editor.editBox:SetCursorPosition(editor.editBox:GetCursorPosition() - 1) + elseif char == "{" then + editor.editBox:Insert("}") + editor.editBox:SetCursorPosition(editor.editBox:GetCursorPosition() - 1) + elseif char == "[" then + editor.editBox:Insert("]") + editor.editBox:SetCursorPosition(editor.editBox:GetCursorPosition() - 1) end end - ) + end) local editorError = group.frame:CreateFontString(nil, "OVERLAY") editorError:SetFont(STANDARD_TEXT_FONT, 12) @@ -570,68 +525,53 @@ local function ConstructTextEditor(frame) editorLine:SetTextInsets(10, 10, 0, 0) editorLine:SetAutoFocus(false) - urlText:SetScript( - "OnChar", - function(self) - self:SetText(group.url) - self:HighlightText() - end - ) - urlText:SetScript( - "OnEscapePressed", - function() - urlText:ClearFocus() - urlText:Hide() - urlCopyLabel:Hide() - helpButton:Show() - editor:SetFocus() - end - ) - - helpButton:SetScript( - "OnClick", - function() - urlText:Show() - urlText:SetFocus() - urlText:HighlightText() - urlCopyLabel:Show() - helpButton:Hide() - editorError:Hide() - end - ) + urlText:SetScript("OnChar", function(self) + self:SetText(group.url) + self:HighlightText() + end) + urlText:SetScript("OnEscapePressed", function() + urlText:ClearFocus() + urlText:Hide() + urlCopyLabel:Hide() + helpButton:Show() + editor:SetFocus() + end) + + helpButton:SetScript("OnClick", function() + urlText:Show() + urlText:SetFocus() + urlText:HighlightText() + urlCopyLabel:Show() + helpButton:Hide() + editorError:Hide() + end) local oldOnCursorChanged = editor.editBox:GetScript("OnCursorChanged") - editor.editBox:SetScript( - "OnCursorChanged", - function(...) - oldOnCursorChanged(...) - local cursorPosition = editor.editBox:GetCursorPosition() - local next = -1 - local line = 0 - while (next and cursorPosition >= next) do - next = originalGetText(editor.editBox):find("[\n]", next + 1) - line = line + 1 - end - editorLine:SetNumber(line) + editor.editBox:SetScript("OnCursorChanged", function(...) + oldOnCursorChanged(...) + local cursorPosition = editor.editBox:GetCursorPosition() + local next = -1 + local line = 0 + while next and cursorPosition >= next do + next = originalGetText(editor.editBox):find("[\n]", next + 1) + line = line + 1 end - ) - - editorLine:SetScript( - "OnEnterPressed", - function() - local newLine = editorLine:GetNumber() - local newPosition = 0 - while (newLine > 1 and newPosition) do - newPosition = originalGetText(editor.editBox):find("[\n]", newPosition + 1) - newLine = newLine - 1 - end + editorLine:SetNumber(line) + end) - if (newPosition) then - editor.editBox:SetCursorPosition(newPosition) - editor.editBox:SetFocus() - end + editorLine:SetScript("OnEnterPressed", function() + local newLine = editorLine:GetNumber() + local newPosition = 0 + while newLine > 1 and newPosition do + newPosition = originalGetText(editor.editBox):find("[\n]", newPosition + 1) + newLine = newLine - 1 end - ) + + if newPosition then + editor.editBox:SetCursorPosition(newPosition) + editor.editBox:SetFocus() + end + end) function group.Open(self, data, path, enclose, multipath, reloadOptions, setOnParent, url, validator) self.data = data @@ -648,64 +588,60 @@ local function ConstructTextEditor(frame) else helpButton:Hide() end - if (frame.window == "texture") then + if frame.window == "texture" then frame.texturePicker:CancelClose() - elseif (frame.window == "icon") then + elseif frame.window == "icon" then frame.iconPicker:CancelClose() end frame.window = "texteditor" frame:UpdateFrameVisible() local title = (type(data.id) == "string" and data.id or L["Temporary Group"]) .. " -" - if (not multipath) then + if not multipath then for index, field in pairs(path) do - if (type(field) == "number") then + if type(field) == "number" then field = "Trigger " .. field end title = title .. " " .. field:sub(1, 1):upper() .. field:sub(2) end end editor:SetLabel(title) - editor.editBox:SetScript( - "OnEscapePressed", - function() - -- catch it so that escape doesn't default to losing focus (after which another escape would close config) - end - ) + editor.editBox:SetScript("OnEscapePressed", function() + -- catch it so that escape doesn't default to losing focus (after which another escape would close config) + end) self.oldOnTextChanged = editor.editBox:GetScript("OnTextChanged") - editor.editBox:SetScript( - "OnTextChanged", - function(...) - local str = editor.editBox:GetText() - if not str or str:trim() == "" or editor.combinedText == true then - editorError:SetText("") + editor.editBox:SetScript("OnTextChanged", function(...) + local str = editor.editBox:GetText() + if not str or str:trim() == "" or editor.combinedText == true then + editorError:SetText("") + else + local func, errorString + if enclose then + func, errorString = loadstring("return function() " .. str .. "\n end") else - local func, errorString - if (enclose) then - func, errorString = loadstring("return function() " .. str .. "\n end") - else - func, errorString = loadstring("return " .. str) - end - if not errorString and validator then - local ok, validate = xpcall(func, function(err) errorString = err end) - if ok then - errorString = validator(validate) - end + func, errorString = loadstring("return " .. str) + end + if not errorString and validator then + local ok, validate = xpcall(func, function(err) + errorString = err + end) + if ok then + errorString = validator(validate) end - if errorString then - urlText:Hide() - urlCopyLabel:Hide() - if self.url then - helpButton:Show() - end - editorError:Show() - editorError:SetText(errorString) - else - editorError:SetText("") + end + if errorString then + urlText:Hide() + urlCopyLabel:Hide() + if self.url then + helpButton:Show() end + editorError:Show() + editorError:SetText(errorString) + else + editorError:SetText("") end - self.oldOnTextChanged(...) end - ) + self.oldOnTextChanged(...) + end) if setOnParent then editor:SetText(OptionsPrivate.Private.ValueFromPath(data, path) or "") @@ -721,7 +657,7 @@ local function ConstructTextEditor(frame) text = OptionsPrivate.Private.ValueFromPath(child, path) end if text then - if not (singleText) then + if not singleText then singleText = text else if singleText ~= text then @@ -732,12 +668,11 @@ local function ConstructTextEditor(frame) combinedText = combinedText .. "\n\n" end - combinedText = - combinedText .. L["-- Do not remove this comment, it is part of this aura: "] .. child.id .. "\n" + combinedText = combinedText .. L["-- Do not remove this comment, it is part of this aura: "] .. child.id .. "\n" combinedText = combinedText .. (text or "") end end - if (sameTexts) then + if sameTexts then editor:SetText(singleText or "") editor.combinedText = false else @@ -759,21 +694,20 @@ local function ConstructTextEditor(frame) local texts = {} local currentPos, id, startIdLine, startId, endId, endIdLine - while (true) do - startIdLine, startId = - string.find(input, L["-- Do not remove this comment, it is part of this aura: "], currentPos, true) - if (not startId) then + while true do + startIdLine, startId = string.find(input, L["-- Do not remove this comment, it is part of this aura: "], currentPos, true) + if not startId then break end endId, endIdLine = string.find(input, "\n", startId, true) - if (not endId) then + if not endId then break end - if (currentPos) then + if currentPos then local trimmedPosition = startIdLine - 1 - while (string.sub(input, trimmedPosition, trimmedPosition) == "\n") do + while string.sub(input, trimmedPosition, trimmedPosition) == "\n" do trimmedPosition = trimmedPosition - 1 end @@ -785,7 +719,7 @@ local function ConstructTextEditor(frame) currentPos = endIdLine + 1 end - if (id) then + if id then texts[id] = string.sub(input, currentPos, string.len(input)) end diff --git a/WeakAurasOptions/OptionsFrames/TexturePicker.lua b/WeakAurasOptions/OptionsFrames/TexturePicker.lua index cbee269590..b5d3fcc38c 100644 --- a/WeakAurasOptions/OptionsFrames/TexturePicker.lua +++ b/WeakAurasOptions/OptionsFrames/TexturePicker.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... -- Lua APIs @@ -64,50 +66,50 @@ local function SetAll(baseObject, path, property, value) local valueFromPath = OptionsPrivate.Private.ValueFromPath for child in OptionsPrivate.Private.TraverseLeafsOrAura(baseObject) do local object = valueFromPath(child, path) - if object then - object[property] = value - WeakAuras.Add(child) - WeakAuras.UpdateThumbnail(child) - end + if object then + object[property] = value + WeakAuras.Add(child) + WeakAuras.UpdateThumbnail(child) + end end end local texturePicker local function ConstructTexturePicker(frame) - local group = AceGUI:Create("InlineGroup"); - group.frame:SetParent(frame); - group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 42); - group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 17, -10); - group.frame:Hide(); - group.children = {}; - group.categories = {}; - - local dropdown = AceGUI:Create("DropdownGroup"); - dropdown:SetLayout("fill"); - dropdown.width = "fill"; - dropdown:SetHeight(390); - group:SetLayout("fill"); - group:AddChild(dropdown); - dropdown.list = {}; - dropdown:SetGroupList(dropdown.list); - - local scroll = AceGUI:Create("ScrollFrame"); - scroll:SetWidth(540); - scroll:SetLayout("flow"); - scroll.frame:SetClipsChildren(true); - dropdown:AddChild(scroll); + local group = AceGUI:Create("InlineGroup") + group.frame:SetParent(frame) + group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 42) + group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 17, -10) + group.frame:Hide() + group.children = {} + group.categories = {} + + local dropdown = AceGUI:Create("DropdownGroup") + dropdown:SetLayout("fill") + dropdown.width = "fill" + dropdown:SetHeight(390) + group:SetLayout("fill") + group:AddChild(dropdown) + dropdown.list = {} + dropdown:SetGroupList(dropdown.list) + + local scroll = AceGUI:Create("ScrollFrame") + scroll:SetWidth(540) + scroll:SetLayout("flow") + scroll.frame:SetClipsChildren(true) + dropdown:AddChild(scroll) local function texturePickerGroupSelected(widget, event, uniquevalue) - scroll:ReleaseChildren(); + scroll:ReleaseChildren() for texturePath, textureName in pairs(group.textures[uniquevalue]) do - local textureWidget = AceGUI:Create("WeakAurasTextureButton"); - if (group.SetTextureFunc) then - group.SetTextureFunc(textureWidget, texturePath, textureName); + local textureWidget = AceGUI:Create("WeakAurasTextureButton") + if group.SetTextureFunc then + group.SetTextureFunc(textureWidget, texturePath, textureName) else - textureWidget:SetTexture(texturePath, textureName); - local d = group.textureData; - textureWidget:ChangeTexture(d.r, d.g, d.b, d.a, d.rotate, d.discrete_rotation, d.rotation, d.mirror, d.blendMode); + textureWidget:SetTexture(texturePath, textureName) + local d = group.textureData + textureWidget:ChangeTexture(d.r, d.g, d.b, d.a, d.rotate, d.discrete_rotation, d.rotation, d.mirror, d.blendMode) end if group.selectedTextures[texturePath] then @@ -115,19 +117,19 @@ local function ConstructTexturePicker(frame) end textureWidget:SetClick(function() - group:Pick(texturePath); - end); - scroll:AddChild(textureWidget); + group:Pick(texturePath) + end) + scroll:AddChild(textureWidget) table.sort(scroll.children, function(a, b) - local aPath, bPath = a:GetTexturePath(), b:GetTexturePath(); - local aNum, bNum = tonumber(aPath:match("%d+")), tonumber(bPath:match("%d+")); + local aPath, bPath = a:GetTexturePath(), b:GetTexturePath() + local aNum, bNum = tonumber(aPath:match("%d+")), tonumber(bPath:match("%d+")) local aNonNumber, bNonNumber = aPath:match("[^%d]+"), bPath:match("[^%d]+") - if(aNum and bNum and aNonNumber == bNonNumber) then - return aNum < bNum; + if aNum and bNum and aNonNumber == bNonNumber then + return aNum < bNum else - return aPath < bPath; + return aPath < bPath end - end); + end) end end @@ -135,30 +137,30 @@ local function ConstructTexturePicker(frame) function group.UpdateList(self) dropdown.dropdown.pullout:Close() - wipe(dropdown.list); + wipe(dropdown.list) for categoryName, category in pairs(self.textures) do - local match = false; + local match = false for texturePath, textureName in pairs(category) do - if(self.selectedTextures[texturePath]) then - match = true; - break; + if self.selectedTextures[texturePath] then + match = true + break end end - dropdown.list[categoryName] = (match and "|cFF80A0FF" or "")..categoryName; + dropdown.list[categoryName] = (match and "|cFF80A0FF" or "") .. categoryName end - dropdown:SetGroupList(dropdown.list); + dropdown:SetGroupList(dropdown.list) end function group.Pick(self, texturePath) - local pickedwidget; + local pickedwidget for index, widget in ipairs(scroll.children) do - widget:ClearPick(); - if(widget:GetTexturePath() == texturePath) then - pickedwidget = widget; + widget:ClearPick() + if widget:GetTexturePath() == texturePath then + pickedwidget = widget end end - if(pickedwidget) then - pickedwidget:Pick(); + if pickedwidget then + pickedwidget:Pick() end wipe(group.selectedTextures) @@ -166,9 +168,9 @@ local function ConstructTexturePicker(frame) SetAll(self.baseObject, self.path, self.properties.texture, texturePath) - group:UpdateList(); + group:UpdateList() local status = dropdown.status or dropdown.localstatus - dropdown.dropdown:SetText(dropdown.list[status.selected]); + dropdown.dropdown:SetText(dropdown.list[status.selected]) end function group.Open(self, baseObject, path, properties, textures, SetTextureFunc) @@ -176,9 +178,9 @@ local function ConstructTexturePicker(frame) self.baseObject = baseObject self.path = path self.properties = properties - self.textures = textures; + self.textures = textures self.SetTextureFunc = SetTextureFunc - self.givenPath = {}; + self.givenPath = {} self.selectedTextures = {} for child in OptionsPrivate.Private.TraverseLeafsOrAura(baseObject) do @@ -189,7 +191,7 @@ local function ConstructTexturePicker(frame) end end - local colorAll = GetAll(baseObject, path, properties.color, {1, 1, 1, 1}); + local colorAll = GetAll(baseObject, path, properties.color, { 1, 1, 1, 1 }) self.textureData = { r = colorAll[1] or 1, g = colorAll[2] or 1, @@ -199,35 +201,35 @@ local function ConstructTexturePicker(frame) discrete_rotation = GetAll(baseObject, path, properties.discrete_rotation, 0), rotation = GetAll(baseObject, path, properties.rotation, 0), mirror = GetAll(baseObject, path, properties.mirror, false), - blendMode = GetAll(baseObject, path, properties.blendMode, "ADD") + blendMode = GetAll(baseObject, path, properties.blendMode, "ADD"), } - frame.window = "texture"; + frame.window = "texture" frame:UpdateFrameVisible() group:UpdateList() local _, givenPath = next(self.givenPath) - local picked = false; + local picked = false for categoryName, category in pairs(self.textures) do - if not(picked) then + if not picked then for texturePath, textureName in pairs(category) do - if(self.selectedTextures[texturePath]) then - dropdown:SetGroup(categoryName); - picked = true; - break; + if self.selectedTextures[texturePath] then + dropdown:SetGroup(categoryName) + picked = true + break end end end end - if not(picked) then + if not picked then local categoryName = next(self.textures) - if(categoryName) then - dropdown:SetGroup(categoryName); + if categoryName then + dropdown:SetGroup(categoryName) end end end function group.Close() - frame.window = "default"; + frame.window = "default" frame:UpdateFrameVisible() WeakAuras.FillOptions() end @@ -238,11 +240,11 @@ local function ConstructTexturePicker(frame) local childObject = valueFromPath(child, group.path) if childObject then childObject[group.properties.texture] = group.givenPath[child.id] - WeakAuras.Add(child); - WeakAuras.UpdateThumbnail(child); + WeakAuras.Add(child) + WeakAuras.UpdateThumbnail(child) end end - group.Close(); + group.Close() end local cancel = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate") diff --git a/WeakAurasOptions/OptionsFrames/Update.lua b/WeakAurasOptions/OptionsFrames/Update.lua index 2b0fdf6da6..aaaafdc528 100644 --- a/WeakAurasOptions/OptionsFrames/Update.lua +++ b/WeakAurasOptions/OptionsFrames/Update.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... local AceGUI = LibStub("AceGUI-3.0") @@ -15,23 +17,25 @@ local function addCode(codes, text, code, ...) -- The 4th parameter is a "check" if the code is active -- The following line let's distinguish between addCode(a, b, c, nil) and addCode(a, b, c) -- If the 4th parameter is nil, then we want to return - if (select("#", ...) > 0) then + if select("#", ...) > 0 then if not select(1, ...) then return end end if code and notEmptyString(code) then - local t = {}; - t.text = text; + local t = {} + t.text = text t.value = text t.code = code - tinsert(codes, t); + tinsert(codes, t) end end local function checkTrigger(codes, id, trigger, untrigger) - if not trigger or trigger.type ~= "custom" then return end; + if not trigger or trigger.type ~= "custom" then + return + end addCode(codes, L["%s Trigger Function"]:format(id), trigger.custom) @@ -42,17 +46,19 @@ local function checkTrigger(codes, id, trigger, untrigger) addCode(codes, L["%s Duration Function"]:format(id), trigger.customDuration) addCode(codes, L["%s Name Function"]:format(id), trigger.customName) addCode(codes, L["%s Icon Function"]:format(id), trigger.customIcon) - addCode(codes, L["%s Texture Function"]:format(id),trigger.customTexture) + addCode(codes, L["%s Texture Function"]:format(id), trigger.customTexture) addCode(codes, L["%s Stacks Function"]:format(id), trigger.customStacks) for i = 1, 7 do - local property = "customOverlay" .. i; + local property = "customOverlay" .. i addCode(codes, L["%s %u. Overlay Function"]:format(id, i), trigger[property]) end end end local function checkAnimation(codes, id, a) - if not a or a.type ~= "custom" then return end + if not a or a.type ~= "custom" then + return + end addCode(codes, L["%s - Alpha Animation"]:format(id), a.alphaFunc, a.alphaType == "custom" and a.use_alpha) addCode(codes, L["%s - Translate Animation"]:format(id), a.translateFunc, a.translateType == "custom" and a.use_translate) addCode(codes, L["%s - Scale Animation"]:format(id), a.scaleFunc, a.scaleType == "custom" and a.use_scale) @@ -62,14 +68,14 @@ end local function scamCheck(codes, data) for i, v in ipairs(data.triggers) do - checkTrigger(codes, L["%s - %i. Trigger"]:format(data.id, i), v.trigger, v.untrigger); + checkTrigger(codes, L["%s - %i. Trigger"]:format(data.id, i), v.trigger, v.untrigger) end - addCode(codes, L["%s - Trigger Logic"]:format(data.id), data.triggers.customTriggerLogic, data.triggers.disjunctive == "custom"); + addCode(codes, L["%s - Trigger Logic"]:format(data.id), data.triggers.customTriggerLogic, data.triggers.disjunctive == "custom") addCode(codes, L["%s - Custom Text"]:format(data.id), data.customText) addCode(codes, L["%s - Custom Anchor"]:format(data.id), data.customAnchor, data.anchorFrameType == "CUSTOM") - if (data.actions) then + if data.actions then if data.actions.init then addCode(codes, L["%s - Init Action"]:format(data.id), data.actions.init.custom, data.actions.init.do_custom) end @@ -83,30 +89,34 @@ local function scamCheck(codes, data) end end - if (data.animation) then - checkAnimation(codes, L["%s - Start"]:format(data.id), data.animation.start); - checkAnimation(codes, L["%s - Main"]:format(data.id), data.animation.main); - checkAnimation(codes, L["%s - Finish"]:format(data.id), data.animation.finish); + if data.animation then + checkAnimation(codes, L["%s - Start"]:format(data.id), data.animation.start) + checkAnimation(codes, L["%s - Main"]:format(data.id), data.animation.main) + checkAnimation(codes, L["%s - Finish"]:format(data.id), data.animation.finish) end addCode(codes, L["%s - Custom Grow"]:format(data.id), data.customGrow, data.regionType == "dynamicgroup" and data.grow == "CUSTOM") addCode(codes, L["%s - Custom Sort"]:format(data.id), data.customSort, data.regionType == "dynamicgroup" and data.sort == "custom") - addCode(codes, L["%s - Custom Anchor"]:format(data.id), data.customAnchorPerUnit, - data.regionType == "dynamicgroup" and data.grow ~= "CUSTOM" and data.useAnchorPerUnit and data.anchorPerUnit == "CUSTOM") - - if (data.conditions) then + addCode( + codes, + L["%s - Custom Anchor"]:format(data.id), + data.customAnchorPerUnit, + data.regionType == "dynamicgroup" and data.grow ~= "CUSTOM" and data.useAnchorPerUnit and data.anchorPerUnit == "CUSTOM" + ) + + if data.conditions then local customChat = 1 local customCode = 1 local customCheck = 1 for _, condition in ipairs(data.conditions) do - if (condition.changes) then + if condition.changes then for _, property in ipairs(condition.changes) do if type(property.value) == "table" and property.value.custom then if property.property == "chat" then - addCode(codes, L["%s - Condition Custom Chat %s"]:format(data.id, customChat), property.value.custom); + addCode(codes, L["%s - Condition Custom Chat %s"]:format(data.id, customChat), property.value.custom) customChat = customChat + 1 elseif property.property == "customcode" then - addCode(codes, L["%s - Condition Custom Code %s"]:format(data.id, customCode), property.value.custom); + addCode(codes, L["%s - Condition Custom Code %s"]:format(data.id, customCode), property.value.custom) customCode = customCode + 1 end end @@ -114,10 +124,12 @@ local function scamCheck(codes, data) end local function recurseAddCustomCheck(checks) - if not checks then return end + if not checks then + return + end for _, check in pairs(checks) do if check.trigger == -1 and check.variable == "customcheck" then - addCode(codes, L["%s - Condition Custom Check %s"]:format(data.id, customCheck), check.value); + addCode(codes, L["%s - Condition Custom Check %s"]:format(data.id, customCheck), check.value) customCheck = customCheck + 1 end recurseAddCustomCheck(check.checks) @@ -126,7 +138,7 @@ local function scamCheck(codes, data) if condition.check then if condition.check.trigger == -1 and condition.check.variable == "customcheck" then - addCode(codes, L["%s - Condition Custom Check %s"]:format(data.id, customCheck), condition.check.value); + addCode(codes, L["%s - Condition Custom Check %s"]:format(data.id, customCheck), condition.check.value) customCheck = customCheck + 1 end recurseAddCustomCheck(condition.check.checks) @@ -171,10 +183,10 @@ local function FieldToCategory(field, isRoot) end local function recurseUpdate(data, chunk) - for k,v in pairs(chunk) do + for k, v in pairs(chunk) do if v == deleted then data[k] = nil - elseif type(v) == 'table' and type(data[k]) == 'table' then + elseif type(v) == "table" and type(data[k]) == "table" then recurseUpdate(data[k], v) else data[k] = v @@ -195,12 +207,14 @@ local function RecurseDiff(ours, theirs) diff[key] = diffVal same = false end - elseif ourVal ~= theirVal and -- of course, floating points can be nonequal by less than we could possibly care - not(type(ourVal) == "number" and type(theirVal) == "number" and math.abs(ourVal - theirVal) < 1e-6) then - if (theirVal == nil) then + elseif + ourVal ~= theirVal -- of course, floating points can be nonequal by less than we could possibly care + and not (type(ourVal) == "number" and type(theirVal) == "number" and math.abs(ourVal - theirVal) < 1e-6) + then + if theirVal == nil then diff[key] = deleted else - diff[key] = theirVal; + diff[key] = theirVal end same = false end @@ -212,7 +226,9 @@ local function RecurseDiff(ours, theirs) same = false end end - if not same then return diff end + if not same then + return diff + end end -- for debug purposes @@ -244,13 +260,14 @@ end local function Diff(ours, theirs) if not ignoredForDiffChecking then - ignoredForDiffChecking = CreateFromMixins(OptionsPrivate.Private.internal_fields, - OptionsPrivate.Private.non_transmissable_fields) + ignoredForDiffChecking = CreateFromMixins(OptionsPrivate.Private.internal_fields, OptionsPrivate.Private.non_transmissable_fields) end -- generates a diff which WeakAuras.Update can use local debug = false - if not ours or not theirs then return end + if not ours or not theirs then + return + end local diff = RecurseDiff(ours, theirs) if diff then if debug then @@ -302,7 +319,7 @@ local function BuildUidMap(data, children, type) -- index, total, parentIsDynamicGroup: helpers that transport data between phase 1 and 2 }, - type = type -- Either old or new, only used for error checking + type = type, -- Either old or new, only used for error checking -- root: uid of the root -- totalCount: count of members -- idToUid maps from id to uid @@ -315,7 +332,7 @@ local function BuildUidMap(data, children, type) idToUid[data.id] = data.uid for i, child in ipairs(children) do if idToUid[child.id] then - error("Duplicate id in import data: "..child.id) + error("Duplicate id in import data: " .. child.id) end idToUid[child.id] = child.uid end @@ -327,7 +344,7 @@ local function BuildUidMap(data, children, type) uidMap.map[data.uid] = { originalName = data.id, id = data.id, - data = data + data = data, } -- Add controlled children @@ -376,7 +393,6 @@ local function BuildUidMap(data, children, type) handleSortHybridTable(child) end - uidMap.InsertData = function(self, data, parentUid, children, sortHybrid, index) self.idToUid[data.id] = data.uid self.totalCount = self.totalCount + 1 @@ -403,7 +419,7 @@ local function BuildUidMap(data, children, type) parent = parentUid, matchedUid = data.uid, controlledChildren = children, - sortHybrid = sortHybrid + sortHybrid = sortHybrid, } if index then @@ -458,11 +474,11 @@ local function BuildUidMap(data, children, type) data.id = self.map[uid].id - if (data.controlledChildren) then + if data.controlledChildren then data.controlledChildren = {} end - if (data.sortHybridTable) then + if data.sortHybridTable then data.sortHybridTable = {} end @@ -537,7 +553,7 @@ local function BuildUidMap(data, children, type) end local oldId = self.map[uid].id - if (oldId == id) then + if oldId == id then return end uidMap.idToUid[oldId] = nil @@ -565,7 +581,7 @@ local function BuildUidMap(data, children, type) for i, childUid in ipairs(parentMap.controlledChildren) do if childUid == uid then parentMap.controlledChildren[i] = newUid - break; + break end end end @@ -575,7 +591,6 @@ local function BuildUidMap(data, children, type) self.map[childUid].parent = newUid end end - end end @@ -721,8 +736,8 @@ local function BuildUidMap(data, children, type) local children = otherUidMap:GetChildren(otherUid) local lastMatchUid = nil -- our uid local waitingForMatch = {} -- Auras that we haven't assigned to a match yet - -- Will be added to before on finding a match - -- or the parent will be added + -- Will be added to before on finding a match + -- or the parent will be added local matchToInsert = { -- from our uid to -- before: array of other uids that should be inserted before the uid @@ -850,7 +865,6 @@ local function BuildUidMap(data, children, type) return uidMap, uidMap.root end - local function hasChildren(data) return data.controlledChildren and true or false end @@ -865,7 +879,6 @@ local function MatchChild(uid, newUidMap, oldUidMap) for _, childUid in ipairs(newChildren) do MatchChild(childUid, newUidMap, oldUidMap) end - end local function BuildMatches(newUidMap, oldUidMap) @@ -956,8 +969,6 @@ local function SetCategories(globalCategories, categories) end end - - local function GetCategories(diff, isRoot) local categories = {} for key in pairs(diff) do @@ -1104,12 +1115,12 @@ end local function hasChanges(matchInfo) return matchInfo.modifiedCount > 0 - or matchInfo.modifiedGroupCount > 0 - or matchInfo.addedCount > 0 - or matchInfo.addedGroupCount > 0 - or matchInfo.deletedCount > 0 - or matchInfo.deletedGroupCount > 0 - or matchInfo.activeCategories.arrangement + or matchInfo.modifiedGroupCount > 0 + or matchInfo.addedCount > 0 + or matchInfo.addedGroupCount > 0 + or matchInfo.deletedCount > 0 + or matchInfo.deletedGroupCount > 0 + or matchInfo.activeCategories.arrangement end local function BuildDiffs(newUidMap, oldUidMap) @@ -1126,7 +1137,7 @@ local function BuildDiffs(newUidMap, oldUidMap) unmodified = {}, -- Contains new uids that had a empty diff added = {}, -- Contains new uids that were added deleted = {}, -- Contains old uids that were removed - activeCategories = {} -- maps from name of Private.update_categories to true/nil + activeCategories = {}, -- maps from name of Private.update_categories to true/nil } -- Handles addition + modification BuildDiffsHelper(newUidMap:GetRootUID(), newUidMap, oldUidMap, matchInfo) @@ -1196,8 +1207,7 @@ end local function AddAuraList(container, uidMap, list, expandText) local expand = AceGUI:Create("WeakAurasExpand") local collapsed = true - local image = collapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\expand" - or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\collapse" + local image = collapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\expand" or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\collapse" expand:SetImage(image) expand:SetImageSize(10, 10) expand:SetFontObject(GameFontHighlight) @@ -1218,8 +1228,7 @@ local function AddAuraList(container, uidMap, list, expandText) expand:SetCallback("OnClick", function() collapsed = not collapsed - local image = collapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\expand" - or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\collapse" + local image = collapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\expand" or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\collapse" expand:SetImage(image) if collapsed then @@ -1243,14 +1252,14 @@ end local methods = { Open = function(self, data, children, target, sender, callbackFunc) - if(self.optionsWindow.window == "importexport") then - self.optionsWindow.importexport:Close(); - elseif(self.optionsWindow.window == "texture") then - self.optionsWindow.texturePicker:CancelClose(); - elseif(self.optionsWindow.window == "icon") then - self.optionsWindow.iconPicker:CancelClose(); - elseif(self.optionsWindow.window == "model") then - self.optionsWindow.modelPicker:CancelClose(); + if self.optionsWindow.window == "importexport" then + self.optionsWindow.importexport:Close() + elseif self.optionsWindow.window == "texture" then + self.optionsWindow.texturePicker:CancelClose() + elseif self.optionsWindow.window == "icon" then + self.optionsWindow.iconPicker:CancelClose() + elseif self.optionsWindow.window == "model" then + self.optionsWindow.modelPicker:CancelClose() end self.optionsWindow.window = "update" self.optionsWindow:UpdateFrameVisible() @@ -1259,11 +1268,9 @@ local methods = { data = data, children = children or {}, target = target, - sender = sender - } - self.userChoices = { - + sender = sender, } + self.userChoices = {} self.callbackFunc = callbackFunc self:ReleaseChildren() @@ -1290,7 +1297,7 @@ local methods = { else local oldRootId = matchInfo.oldUidMap:GetIdFor(matchInfo.oldUidMap:GetRootUID()) local preferToUpdate = matchInfo.oldUidMap:GetRawData(matchInfo.oldUidMap:GetRootUID()).preferToUpdate - if (data.regionType == "group" or data.regionType == "dynamicgroup") then + if data.regionType == "group" or data.regionType == "dynamicgroup" then local matchInfoText = L["This is a modified version of your group: |cff9900FF%s|r"]:format(oldRootId) matchInfoResult:SetText(matchInfoText) if matchInfo.addedCount ~= 0 then @@ -1348,7 +1355,7 @@ local methods = { else self.userChoices.mode = "import" local matchInfoText = "" - if (errorMessage) then + if errorMessage then matchInfoText = matchInfoText .. "|cFFFF0000" .. errorMessage .. "|r\n" end @@ -1372,7 +1379,7 @@ local methods = { end self.scamCheckResult = scamCheckResult - if (#scamCheckResult > 0) then + if #scamCheckResult > 0 then self:AddChild(AceGUI:Create("WeakAurasSpacer")) local scamCheckText = AceGUI:Create("Label") @@ -1390,7 +1397,7 @@ local methods = { end end - if (highestVersion > WeakAuras.InternalVersion()) then + if highestVersion > WeakAuras.InternalVersion() then local highestVersionWarning = AceGUI:Create("Label") highestVersionWarning:SetFontObject(GameFontHighlight) highestVersionWarning:SetFullWidth(true) @@ -1399,7 +1406,6 @@ local methods = { self:AddChild(highestVersionWarning) end - local currentBuild = floor(WeakAuras.BuildInfo / 10000) local importBuild = data.tocversion and floor(data.tocversion / 10000) @@ -1407,12 +1413,14 @@ local methods = { local flavorWarning = AceGUI:Create("Label") flavorWarning:SetFontObject(GameFontHighlight) flavorWarning:SetFullWidth(true) - flavorWarning:SetText(L["This aura was created with a different version (%s) of World of Warcraft.\nIt might not work correctly!"]:format(OptionsPrivate.Private.TocToExpansion[importBuild])) + flavorWarning:SetText( + L["This aura was created with a different version (%s) of World of Warcraft.\nIt might not work correctly!"]:format(OptionsPrivate.Private.TocToExpansion[importBuild]) + ) flavorWarning:SetColor(1, 0, 0) self:AddChild(flavorWarning) end - if (#scamCheckResult > 0) then + if #scamCheckResult > 0 then self.viewCodeButton:Show() else self.viewCodeButton:Hide() @@ -1443,7 +1451,6 @@ local methods = { button:SetCallback("OnValueChanged", function(_, _, value) self.userChoices.activeCategories[name] = value end) - end end @@ -1467,9 +1474,12 @@ local methods = { end end, Import = function(self) - OptionsPrivate.Private.dynFrame:AddAction("import", coroutine.create(function() - self:ImportImpl() - end)) + OptionsPrivate.Private.dynFrame:AddAction( + "import", + coroutine.create(function() + self:ImportImpl() + end) + ) end, ImportImpl = function(self) local pendingData = self.pendingData @@ -1503,7 +1513,7 @@ local methods = { self:ImportPhase2(uidMap, phase2Order) pendingPickData = { - id = uidMap:GetIdFor(uidMap:GetRootUID()) + id = uidMap:GetIdFor(uidMap:GetRootUID()), } if #pendingData.children > 0 then pendingPickData.tabToShow = "group" @@ -1512,7 +1522,9 @@ local methods = { OptionsPrivate.SortDisplayButtons() elseif userChoices.mode == "update" then local onePhaseProgress = matchInfo.oldUidMap:GetTotalCount() + matchInfo.newUidMap:GetTotalCount() - local IncProgress = function() self:IncProgress() end + local IncProgress = function() + self:IncProgress() + end -- The progress is more for appearances than anything resembling real calculation -- The estimate for the total work is wonky, as is how the code compensates for that @@ -1541,7 +1553,7 @@ local methods = { local targetNames = {} local structureUidMap -- We iterate either over new or old, depending on the mode - local GetPhase1Data -- Getting the right data is a bit tricky, and depends on the mode + local GetPhase1Data -- Getting the right data is a bit tricky, and depends on the mode local GetPhase2Data if userChoices.activeCategories.arrangement then -- new arrangement @@ -1606,7 +1618,7 @@ local methods = { self:GatherTargetNames(matchInfo.oldUidMap, matchInfo.newUidMap, useNewNames, targetNames) self:SetMinimumProgress(6 * onePhaseProgress) - GetPhase1Data = function(uid) + GetPhase1Data = function(uid) return matchInfo.oldUidMap:GetPhase1Data(uid, true, userChoices.activeCategories) end GetPhase2Data = function(uid) @@ -1620,14 +1632,14 @@ local methods = { self:UpdatePhase2(structureUidMap, GetPhase2Data, phase2Order) self:SetMinimumProgress(26 * onePhaseProgress) - while(self:RenameAuras(targetNames)) do + while self:RenameAuras(targetNames) do -- Try renaming again and again... end self:SetMaxProgress() coroutine.yield() pendingPickData = { - id = OptionsPrivate.Private.GetDataByUID(matchInfo.oldUidMap:GetRootUID()).id + id = OptionsPrivate.Private.GetDataByUID(matchInfo.oldUidMap:GetRootUID()).id, } if matchInfo.oldUidMap:GetGroupRegionType(matchInfo.oldUidMap:GetRootUID()) then pendingPickData.tabToShow = "group" @@ -1825,7 +1837,7 @@ local methods = { OptionsPrivate.Private.SetHistory(data.uid, data, "import") local button = WeakAuras.GetDisplayButton(data.id) button:SetData(data) - if (data.parent) then + if data.parent then local parentIsDynamicGroup = structureUidMap:GetParentIsDynamicGroup(uid) local index, total = structureUidMap:GetGroupOrder(uid) button:SetGroup(data.parent, parentIsDynamicGroup) @@ -1886,7 +1898,7 @@ local methods = { local button = WeakAuras.GetDisplayButton(data.id) button:SetData(data) - if (data.parent) then + if data.parent then local parentIsDynamicGroup = uidMap:GetParentIsDynamicGroup(uid) local index, total = uidMap:GetGroupOrder(uid) button:SetGroup(data.parent, parentIsDynamicGroup) @@ -1909,7 +1921,6 @@ local methods = { local displayButton = WeakAuras.GetDisplayButton(data.id) displayButton:UpdateOffset() end - end, InitializeProgress = function(self, total) self.progress = 0 @@ -1941,7 +1952,7 @@ local methods = { self.progressBar:SetProgress(self.progress, self.total) end, Close = function(self, success, id) - self.optionsWindow.window = "default"; + self.optionsWindow.window = "default" self.optionsWindow:UpdateFrameVisible() if self.CallbackFunc then self.CallbackFunc(success, id) @@ -1994,43 +2005,48 @@ local methods = { local progress = AceGUI:Create("WeakAurasProgressBar") self.progressBar = progress self:AddChild(progress) - end + end, } local updateFrame local function ConstructUpdateFrame(frame) - local group = AceGUI:Create("ScrollFrame"); - group.frame:SetParent(frame); - group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 16, -16); - group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -16, 46); - group.frame:Hide(); - group:SetLayout("flow"); + local group = AceGUI:Create("ScrollFrame") + group.frame:SetParent(frame) + group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 16, -16) + group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -16, 46) + group.frame:Hide() + group:SetLayout("flow") group.optionsWindow = frame - -- Action buttons - local viewCodeButton = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate"); - viewCodeButton:SetScript("OnClick", function() OptionsPrivate.OpenCodeReview(group.scamCheckResult) end); - viewCodeButton:SetPoint("BOTTOMLEFT", 20, -24); + local viewCodeButton = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate") + viewCodeButton:SetScript("OnClick", function() + OptionsPrivate.OpenCodeReview(group.scamCheckResult) + end) + viewCodeButton:SetPoint("BOTTOMLEFT", 20, -24) viewCodeButton:SetFrameLevel(viewCodeButton:GetFrameLevel() + 1) - viewCodeButton:SetHeight(20); - viewCodeButton:SetWidth(160); + viewCodeButton:SetHeight(20) + viewCodeButton:SetWidth(160) viewCodeButton:SetText(L["View custom code"]) - local importButton = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate"); - importButton:SetScript("OnClick", function() group:Import() end); - importButton:SetPoint("BOTTOMRIGHT", -190, -24); + local importButton = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate") + importButton:SetScript("OnClick", function() + group:Import() + end) + importButton:SetPoint("BOTTOMRIGHT", -190, -24) importButton:SetFrameLevel(importButton:GetFrameLevel() + 1) - importButton:SetHeight(20); - importButton:SetWidth(160); + importButton:SetHeight(20) + importButton:SetWidth(160) importButton:SetText(L["Import"]) - local closeButton = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate"); - closeButton:SetScript("OnClick", function() group:Close(false) end); - closeButton:SetPoint("BOTTOMRIGHT", -20, -24); + local closeButton = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate") + closeButton:SetScript("OnClick", function() + group:Close(false) + end) + closeButton:SetPoint("BOTTOMRIGHT", -20, -24) closeButton:SetFrameLevel(closeButton:GetFrameLevel() + 1) - closeButton:SetHeight(20); - closeButton:SetWidth(160); + closeButton:SetHeight(20) + closeButton:SetWidth(160) closeButton:SetText(L["Close"]) group.viewCodeButton = viewCodeButton diff --git a/WeakAurasOptions/RegionOptions/AuraBar.lua b/WeakAurasOptions/RegionOptions/AuraBar.lua index a55e1ab2d7..d17de096ce 100644 --- a/WeakAurasOptions/RegionOptions/AuraBar.lua +++ b/WeakAurasOptions/RegionOptions/AuraBar.lua @@ -1,13 +1,15 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... -local SharedMedia = LibStub("LibSharedMedia-3.0"); -local L = WeakAuras.L; +local SharedMedia = LibStub("LibSharedMedia-3.0") +local L = WeakAuras.L -- Create region options table local function createOptions(id, data) -- Region options - local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ceil(GetScreenHeight() / 20) * 20; + local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ceil(GetScreenHeight() / 20) * 20 local options = { __title = L["Progress Bar Settings"], __order = 1, @@ -17,7 +19,7 @@ local function createOptions(id, data) order = 1, width = WeakAuras.doubleWidth, name = L["Bar Texture"], - values = AceGUIWidgetLSMlists.statusbar + values = AceGUIWidgetLSMlists.statusbar, }, orientation = { type = "select", @@ -26,85 +28,69 @@ local function createOptions(id, data) order = 25, values = OptionsPrivate.Private.orientation_types, set = function(info, v) - if( - ( - data.orientation:find("INVERSE") - and not v:find("INVERSE") - ) - or ( - v:find("INVERSE") - and not data.orientation:find("INVERSE") - ) - ) then - data.icon_side = data.icon_side == "LEFT" and "RIGHT" or "LEFT"; + if (data.orientation:find("INVERSE") and not v:find("INVERSE")) or (v:find("INVERSE") and not data.orientation:find("INVERSE")) then + data.icon_side = data.icon_side == "LEFT" and "RIGHT" or "LEFT" end - if( - ( - data.orientation:find("HORIZONTAL") - and v:find("VERTICAL") - ) - or ( - data.orientation:find("VERTICAL") - and v:find("HORIZONTAL") - ) - ) then - local temp = data.width; - data.width = data.height; - data.height = temp; - data.icon_side = data.icon_side == "LEFT" and "RIGHT" or "LEFT"; - - if(data.rotateText == "LEFT" or data.rotateText == "RIGHT") then - data.rotateText = "NONE"; - elseif(data.rotateText == "NONE") then + if (data.orientation:find("HORIZONTAL") and v:find("VERTICAL")) or (data.orientation:find("VERTICAL") and v:find("HORIZONTAL")) then + local temp = data.width + data.width = data.height + data.height = temp + data.icon_side = data.icon_side == "LEFT" and "RIGHT" or "LEFT" + + if data.rotateText == "LEFT" or data.rotateText == "RIGHT" then + data.rotateText = "NONE" + elseif data.rotateText == "NONE" then data.rotateText = "LEFT" end end - data.orientation = v; - WeakAuras.Add(data); - WeakAuras.UpdateThumbnail(data); - OptionsPrivate.ResetMoverSizer(); - end + data.orientation = v + WeakAuras.Add(data) + WeakAuras.UpdateThumbnail(data) + OptionsPrivate.ResetMoverSizer() + end, }, inverse = { type = "toggle", width = WeakAuras.normalWidth, name = L["Inverse"], - order = 35 + order = 35, }, smoothProgress = { type = "toggle", width = WeakAuras.normalWidth, name = L["Smooth Progress"], desc = L["Animates progress changes"], - order = 37 + order = 37, }, useTooltip = { type = "toggle", width = WeakAuras.normalWidth, name = L["Tooltip on Mouseover"], - hidden = function() return not OptionsPrivate.Private.CanHaveTooltip(data) end, - order = 38 + hidden = function() + return not OptionsPrivate.Private.CanHaveTooltip(data) + end, + order = 38, }, bar_header = { type = "header", name = L["Bar Color Settings"], - order = 39 + order = 39, }, barColor = { type = "color", width = WeakAuras.normalWidth, name = L["Bar Color"], hasAlpha = true, - order = 39.1 + order = 39.1, }, backgroundColor = { type = "color", width = WeakAuras.normalWidth, name = L["Background Color"], hasAlpha = true, - order = 39.2 + order = 39.2, }, alpha = { type = "range", @@ -114,12 +100,12 @@ local function createOptions(id, data) min = 0, max = 1, bigStep = 0.01, - isPercent = true + isPercent = true, }, icon_header = { type = "header", name = L["Icon Settings"], - order = 40.1 + order = 40.1, }, icon = { type = "toggle", @@ -132,7 +118,9 @@ local function createOptions(id, data) width = WeakAuras.normalWidth, name = L["Icon Position"], values = OptionsPrivate.Private.icon_side_types, - hidden = function() return data.orientation:find("VERTICAL") or not data.icon end, + hidden = function() + return data.orientation:find("VERTICAL") or not data.icon + end, order = 40.3, }, icon_side2 = { @@ -140,16 +128,18 @@ local function createOptions(id, data) width = WeakAuras.normalWidth, name = L["Icon Position"], values = OptionsPrivate.Private.rotated_icon_side_types, - hidden = function() return data.orientation:find("HORIZONTAL") or not data.icon end, + hidden = function() + return data.orientation:find("HORIZONTAL") or not data.icon + end, order = 40.3, get = function() - return data.icon_side; + return data.icon_side end, set = function(info, v) - data.icon_side = v; - WeakAuras.Add(data); - WeakAuras.UpdateThumbnail(data); - end + data.icon_side = v + WeakAuras.Add(data) + WeakAuras.UpdateThumbnail(data) + end, }, iconSource = { type = "select", @@ -157,32 +147,40 @@ local function createOptions(id, data) name = L["Source"], order = 40.4, values = OptionsPrivate.Private.IconSources(data), - hidden = function() return not data.icon end, + hidden = function() + return not data.icon + end, }, displayIcon = { type = "input", width = WeakAuras.normalWidth - 0.15, name = L["Fallback"], - disabled = function() return not data.icon end, + disabled = function() + return not data.icon + end, order = 40.5, get = function() - return data.displayIcon and tostring(data.displayIcon) or ""; + return data.displayIcon and tostring(data.displayIcon) or "" end, set = function(info, v) - data.displayIcon = v; - WeakAuras.Add(data); - WeakAuras.UpdateThumbnail(data); + data.displayIcon = v + WeakAuras.Add(data) + WeakAuras.UpdateThumbnail(data) + end, + hidden = function() + return not data.icon end, - hidden = function() return not data.icon end, }, chooseIcon = { type = "execute", width = 0.15, name = L["Choose"], - disabled = function() return not data.icon end, + disabled = function() + return not data.icon + end, order = 40.6, func = function() - local path = {"displayIcon"} + local path = { "displayIcon" } local paths = {} for child in OptionsPrivate.Private.TraverseLeafsOrAura(data) do paths[child.id] = path @@ -193,14 +191,18 @@ local function createOptions(id, data) imageHeight = 24, control = "WeakAurasIcon", image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\browse", - hidden = function() return not data.icon end, + hidden = function() + return not data.icon + end, }, desaturate = { type = "toggle", width = WeakAuras.normalWidth, name = L["Desaturate"], order = 40.8, - hidden = function() return not data.icon end, + hidden = function() + return not data.icon + end, }, icon_color = { type = "color", @@ -208,7 +210,9 @@ local function createOptions(id, data) name = L["Color"], hasAlpha = true, order = 40.9, - hidden = function() return not data.icon end, + hidden = function() + return not data.icon + end, }, zoom = { type = "range", @@ -219,26 +223,32 @@ local function createOptions(id, data) max = 1, bigStep = 0.01, isPercent = true, - hidden = function() return not data.icon end, + hidden = function() + return not data.icon + end, }, spark_header = { type = "header", name = L["Spark Settings"], - order = 42 + order = 42, }, spark = { type = "toggle", width = WeakAuras.normalWidth, name = L["Show Spark"], - order = 43 + order = 43, }, sparkTexture = { type = "input", name = L["Spark Texture"], order = 44, width = WeakAuras.doubleWidth - 0.15, - disabled = function() return not data.spark end, - hidden = function() return not data.spark end, + disabled = function() + return not data.spark + end, + hidden = function() + return not data.spark + end, }, sparkChooseTexture = { type = "execute", @@ -251,11 +261,15 @@ local function createOptions(id, data) color = "sparkColor", rotation = "sparkRotation", mirror = "sparkMirror", - blendMode = "sparkBlendMode" + blendMode = "sparkBlendMode", }, OptionsPrivate.Private.texture_types) end, - disabled = function() return not data.spark end, - hidden = function() return not data.spark end, + disabled = function() + return not data.spark + end, + hidden = function() + return not data.spark + end, imageWidth = 24, imageHeight = 24, control = "WeakAurasIcon", @@ -266,17 +280,27 @@ local function createOptions(id, data) width = WeakAuras.normalWidth, name = L["Desaturate"], order = 44.2, - disabled = function() return not data.spark end, - hidden = function() return not data.spark end, + disabled = function() + return not data.spark + end, + hidden = function() + return not data.spark + end, }, spaceSpark = { type = "execute", name = "", width = WeakAuras.normalWidth, order = 44.3, - image = function() return "", 0, 0 end, - disabled = function() return not data.spark end, - hidden = function() return not data.spark end, + image = function() + return "", 0, 0 + end, + disabled = function() + return not data.spark + end, + hidden = function() + return not data.spark + end, }, sparkColor = { type = "color", @@ -284,8 +308,12 @@ local function createOptions(id, data) name = L["Color"], hasAlpha = true, order = 44.4, - disabled = function() return not data.spark end, - hidden = function() return not data.spark end, + disabled = function() + return not data.spark + end, + hidden = function() + return not data.spark + end, }, sparkBlendMode = { type = "select", @@ -293,8 +321,12 @@ local function createOptions(id, data) name = L["Blend Mode"], order = 44.5, values = OptionsPrivate.Private.blend_types, - disabled = function() return not data.spark end, - hidden = function() return not data.spark end, + disabled = function() + return not data.spark + end, + hidden = function() + return not data.spark + end, }, sparkWidth = { type = "range", @@ -304,8 +336,12 @@ local function createOptions(id, data) min = 1, softMax = screenWidth, bigStep = 1, - disabled = function() return not data.spark end, - hidden = function() return not data.spark end, + disabled = function() + return not data.spark + end, + hidden = function() + return not data.spark + end, }, sparkHeight = { type = "range", @@ -315,8 +351,12 @@ local function createOptions(id, data) min = 1, softMax = screenHeight, bigStep = 1, - disabled = function() return not data.spark end, - hidden = function() return not data.spark end, + disabled = function() + return not data.spark + end, + hidden = function() + return not data.spark + end, }, sparkOffsetX = { type = "range", @@ -326,8 +366,12 @@ local function createOptions(id, data) min = -screenWidth, max = screenWidth, bigStep = 1, - disabled = function() return not data.spark end, - hidden = function() return not data.spark end, + disabled = function() + return not data.spark + end, + hidden = function() + return not data.spark + end, }, sparkOffsetY = { type = "range", @@ -337,8 +381,12 @@ local function createOptions(id, data) min = -screenHeight, max = screenHeight, bigStep = 1, - disabled = function() return not data.spark end, - hidden = function() return not data.spark end, + disabled = function() + return not data.spark + end, + hidden = function() + return not data.spark + end, }, sparkRotationMode = { type = "select", @@ -346,8 +394,12 @@ local function createOptions(id, data) values = OptionsPrivate.Private.spark_rotation_types, name = L["Rotation Mode"], order = 45, - disabled = function() return not data.spark end, - hidden = function() return not data.spark end, + disabled = function() + return not data.spark + end, + hidden = function() + return not data.spark + end, }, sparkRotation = { type = "range", @@ -357,16 +409,24 @@ local function createOptions(id, data) max = 360, step = 90, order = 45.1, - disabled = function() return not data.spark or data.sparkRotationMode == "AUTO" end, - hidden = function() return not data.spark or data.sparkRotationMode == "AUTO" end, + disabled = function() + return not data.spark or data.sparkRotationMode == "AUTO" + end, + hidden = function() + return not data.spark or data.sparkRotationMode == "AUTO" + end, }, sparkMirror = { type = "toggle", width = WeakAuras.normalWidth, name = L["Mirror"], order = 45.2, - disabled = function() return not data.spark end, - hidden = function() return not data.spark end, + disabled = function() + return not data.spark + end, + hidden = function() + return not data.spark + end, }, sparkHidden = { type = "select", @@ -374,24 +434,28 @@ local function createOptions(id, data) values = OptionsPrivate.Private.spark_hide_types, name = L["Hide on"], order = 45.3, - disabled = function() return not data.spark end, - hidden = function() return not data.spark end, + disabled = function() + return not data.spark + end, + hidden = function() + return not data.spark + end, }, endHeader = { type = "header", order = 100, name = "", }, - }; + } - options = WeakAuras.regionPrototype.AddAdjustedDurationOptions(options, data, 36.5); + options = WeakAuras.regionPrototype.AddAdjustedDurationOptions(options, data, 36.5) - local overlayInfo = OptionsPrivate.Private.GetOverlayInfo(data); - if (overlayInfo and next(overlayInfo)) then + local overlayInfo = OptionsPrivate.Private.GetOverlayInfo(data) + if overlayInfo and next(overlayInfo) then options["overlayheader"] = { type = "header", name = L["Overlays"], - order = 58 + order = 58, } local index = 0.01 for id, display in ipairs(overlayInfo) do @@ -403,17 +467,17 @@ local function createOptions(id, data) values = AceGUIWidgetLSMlists.statusbar, order = 58.1 + index, set = function(info, texture) - if (not data.overlaysTexture) then - data.overlaysTexture = {}; + if not data.overlaysTexture then + data.overlaysTexture = {} end - data.overlaysTexture[id] = texture; - WeakAuras.Add(data); + data.overlaysTexture[id] = texture + WeakAuras.Add(data) end, get = function() if data.overlaysTexture and data.overlaysTexture[id] then return data.overlaysTexture[id] end - end + end, } options["overlaycolor" .. id] = { type = "color", @@ -422,18 +486,18 @@ local function createOptions(id, data) hasAlpha = true, order = 58.2 + index, get = function() - if (data.overlays and data.overlays[id]) then - return unpack(data.overlays[id]); + if data.overlays and data.overlays[id] then + return unpack(data.overlays[id]) end - return 1, 1, 1, 1; + return 1, 1, 1, 1 end, set = function(info, r, g, b, a) - if (not data.overlays) then - data.overlays = {}; + if not data.overlays then + data.overlays = {} end - data.overlays[id] = { r, g, b, a}; - WeakAuras.Add(data); - end + data.overlays[id] = { r, g, b, a } + WeakAuras.Add(data) + end, } index = index + 0.01 end @@ -442,162 +506,161 @@ local function createOptions(id, data) type = "toggle", width = WeakAuras.normalWidth, name = L["Clip Overlays"], - order = 58.3 + index; + order = 58.3 + index, } - end return { aurabar = options, position = OptionsPrivate.commonOptions.PositionOptions(id, data), - }; + } end -- Create preview thumbnail local function createThumbnail() -- Preview frame - local borderframe = CreateFrame("Frame", nil, UIParent); - borderframe:SetWidth(32); - borderframe:SetHeight(32); + local borderframe = CreateFrame("Frame", nil, UIParent) + borderframe:SetWidth(32) + borderframe:SetHeight(32) -- Preview border - local border = borderframe:CreateTexture(nil, "OVERLAY"); - border:SetAllPoints(borderframe); - border:SetTexture("Interface\\BUTTONS\\UI-Quickslot2.blp"); - border:SetTexCoord(0.2, 0.8, 0.2, 0.8); + local border = borderframe:CreateTexture(nil, "OVERLAY") + border:SetAllPoints(borderframe) + border:SetTexture("Interface\\BUTTONS\\UI-Quickslot2.blp") + border:SetTexCoord(0.2, 0.8, 0.2, 0.8) -- Main region - local region = CreateFrame("Frame", nil, borderframe); - borderframe.region = region; - region:SetWidth(32); - region:SetHeight(32); + local region = CreateFrame("Frame", nil, borderframe) + borderframe.region = region + region:SetWidth(32) + region:SetHeight(32) -- Status-bar frame - local bar = CreateFrame("Frame", nil, region); - borderframe.bar = bar; + local bar = CreateFrame("Frame", nil, region) + borderframe.bar = bar -- Fake status-bar - local texture = bar:CreateTexture(nil, "OVERLAY"); - borderframe.texture = texture; + local texture = bar:CreateTexture(nil, "OVERLAY") + borderframe.texture = texture -- Fake icon - local icon = region:CreateTexture(); - borderframe.icon = icon; - icon:SetTexture("Interface\\Icons\\INV_Misc_QuestionMark"); + local icon = region:CreateTexture() + borderframe.icon = icon + icon:SetTexture("Interface\\Icons\\INV_Misc_QuestionMark") -- Return preview - return borderframe; + return borderframe end -- Modify preview thumbnail local function modifyThumbnail(parent, borderframe, data, fullModify, width, height) -- Localize - local region, bar, texture, icon = borderframe.region, borderframe.bar, borderframe.texture, borderframe.icon; + local region, bar, texture, icon = borderframe.region, borderframe.bar, borderframe.texture, borderframe.icon borderframe:SetParent(parent) -- Default size - width = width or 26; - height = height or 15; + width = width or 26 + height = height or 15 -- Fake orientation (main region) - if(data.orientation:find("HORIZONTAL")) then - region:SetWidth(width); - region:SetHeight(height); - region:ClearAllPoints(); - if(data.orientation == "HORIZONTAL_INVERSE") then - region:SetPoint("RIGHT", borderframe, "RIGHT", -2, 0); + if data.orientation:find("HORIZONTAL") then + region:SetWidth(width) + region:SetHeight(height) + region:ClearAllPoints() + if data.orientation == "HORIZONTAL_INVERSE" then + region:SetPoint("RIGHT", borderframe, "RIGHT", -2, 0) else - region:SetPoint("LEFT", borderframe, "LEFT", 2, 0); + region:SetPoint("LEFT", borderframe, "LEFT", 2, 0) end else - region:SetWidth(height); - region:SetHeight(width); - region:ClearAllPoints(); - if(data.orientation == "VERTICAL_INVERSE") then - region:SetPoint("TOP", borderframe, "TOP", 0, -2); + region:SetWidth(height) + region:SetHeight(width) + region:ClearAllPoints() + if data.orientation == "VERTICAL_INVERSE" then + region:SetPoint("TOP", borderframe, "TOP", 0, -2) else - region:SetPoint("BOTTOM", borderframe, "BOTTOM", 0, 2); + region:SetPoint("BOTTOM", borderframe, "BOTTOM", 0, 2) end end -- Fake status-bar style - texture:SetTexture(SharedMedia:Fetch("statusbar", data.texture)); - texture:SetVertexColor(data.barColor[1], data.barColor[2], data.barColor[3], data.barColor[4]); + texture:SetTexture(SharedMedia:Fetch("statusbar", data.texture)) + texture:SetVertexColor(data.barColor[1], data.barColor[2], data.barColor[3], data.barColor[4]) -- Fake icon size - local iconsize = height; - icon:SetWidth(iconsize); - icon:SetHeight(iconsize); + local iconsize = height + icon:SetWidth(iconsize) + icon:SetHeight(iconsize) -- Fake layout variables - local percent, length; - if(data.icon) then - length = width - height; - percent = 1 - (width / 100); + local percent, length + if data.icon then + length = width - height + percent = 1 - (width / 100) else - length = width; - percent = 1 - (width / 100); + length = width + percent = 1 - (width / 100) end -- Reset region members - icon:ClearAllPoints(); - bar:ClearAllPoints(); - texture:ClearAllPoints(); + icon:ClearAllPoints() + bar:ClearAllPoints() + texture:ClearAllPoints() -- Fake orientation (region members) - if(data.orientation == "HORIZONTAL_INVERSE") then - icon:SetPoint("LEFT", region, "LEFT"); - bar:SetPoint("BOTTOMRIGHT", region, "BOTTOMRIGHT"); - if(data.icon) then - bar:SetPoint("TOPLEFT", icon, "TOPRIGHT"); + if data.orientation == "HORIZONTAL_INVERSE" then + icon:SetPoint("LEFT", region, "LEFT") + bar:SetPoint("BOTTOMRIGHT", region, "BOTTOMRIGHT") + if data.icon then + bar:SetPoint("TOPLEFT", icon, "TOPRIGHT") else - bar:SetPoint("TOPLEFT", region, "TOPLEFT"); + bar:SetPoint("TOPLEFT", region, "TOPLEFT") end - texture:SetPoint("BOTTOMRIGHT", bar, "BOTTOMRIGHT"); - texture:SetPoint("TOPRIGHT", bar, "TOPRIGHT"); - texture:SetTexCoord(1, 0, 1, 1, percent, 0, percent, 1); - texture:SetWidth(length); - elseif(data.orientation == "HORIZONTAL") then - icon:SetPoint("RIGHT", region, "RIGHT"); - bar:SetPoint("BOTTOMLEFT", region, "BOTTOMLEFT"); - if(data.icon) then - bar:SetPoint("TOPRIGHT", icon, "TOPLEFT"); + texture:SetPoint("BOTTOMRIGHT", bar, "BOTTOMRIGHT") + texture:SetPoint("TOPRIGHT", bar, "TOPRIGHT") + texture:SetTexCoord(1, 0, 1, 1, percent, 0, percent, 1) + texture:SetWidth(length) + elseif data.orientation == "HORIZONTAL" then + icon:SetPoint("RIGHT", region, "RIGHT") + bar:SetPoint("BOTTOMLEFT", region, "BOTTOMLEFT") + if data.icon then + bar:SetPoint("TOPRIGHT", icon, "TOPLEFT") else - bar:SetPoint("TOPRIGHT", region, "TOPRIGHT"); + bar:SetPoint("TOPRIGHT", region, "TOPRIGHT") end - texture:SetPoint("BOTTOMLEFT", bar, "BOTTOMLEFT"); - texture:SetPoint("TOPLEFT", bar, "TOPLEFT"); - texture:SetTexCoord(percent, 0, percent, 1, 1, 0, 1, 1); - texture:SetWidth(length); - elseif(data.orientation == "VERTICAL_INVERSE") then - icon:SetPoint("BOTTOM", region, "BOTTOM"); - bar:SetPoint("TOPLEFT", region, "TOPLEFT"); - if(data.icon) then - bar:SetPoint("BOTTOMRIGHT", icon, "TOPRIGHT"); + texture:SetPoint("BOTTOMLEFT", bar, "BOTTOMLEFT") + texture:SetPoint("TOPLEFT", bar, "TOPLEFT") + texture:SetTexCoord(percent, 0, percent, 1, 1, 0, 1, 1) + texture:SetWidth(length) + elseif data.orientation == "VERTICAL_INVERSE" then + icon:SetPoint("BOTTOM", region, "BOTTOM") + bar:SetPoint("TOPLEFT", region, "TOPLEFT") + if data.icon then + bar:SetPoint("BOTTOMRIGHT", icon, "TOPRIGHT") else - bar:SetPoint("BOTTOMRIGHT", region, "BOTTOMRIGHT"); + bar:SetPoint("BOTTOMRIGHT", region, "BOTTOMRIGHT") end - texture:SetPoint("TOPLEFT", bar, "TOPLEFT"); - texture:SetPoint("TOPRIGHT", bar, "TOPRIGHT"); - texture:SetTexCoord(percent, 0, 1, 0, percent, 1, 1, 1); - texture:SetHeight(length); - elseif(data.orientation == "VERTICAL") then - icon:SetPoint("TOP", region, "TOP"); - bar:SetPoint("BOTTOMRIGHT", region, "BOTTOMRIGHT"); - if(data.icon) then - bar:SetPoint("TOPLEFT", icon, "BOTTOMLEFT"); + texture:SetPoint("TOPLEFT", bar, "TOPLEFT") + texture:SetPoint("TOPRIGHT", bar, "TOPRIGHT") + texture:SetTexCoord(percent, 0, 1, 0, percent, 1, 1, 1) + texture:SetHeight(length) + elseif data.orientation == "VERTICAL" then + icon:SetPoint("TOP", region, "TOP") + bar:SetPoint("BOTTOMRIGHT", region, "BOTTOMRIGHT") + if data.icon then + bar:SetPoint("TOPLEFT", icon, "BOTTOMLEFT") else - bar:SetPoint("TOPLEFT", region, "TOPLEFT"); + bar:SetPoint("TOPLEFT", region, "TOPLEFT") end - texture:SetPoint("BOTTOMLEFT", bar, "BOTTOMLEFT"); - texture:SetPoint("BOTTOMRIGHT", bar, "BOTTOMRIGHT"); - texture:SetTexCoord(1, 0, percent, 0, 1, 1, percent, 1); - texture:SetHeight(length); + texture:SetPoint("BOTTOMLEFT", bar, "BOTTOMLEFT") + texture:SetPoint("BOTTOMRIGHT", bar, "BOTTOMRIGHT") + texture:SetTexCoord(1, 0, percent, 0, 1, 1, percent, 1) + texture:SetHeight(length) end -- Fake icon (code) - if(data.icon) then + if data.icon then function borderframe:SetIcon(path) local iconPath if data.iconSource == 0 then @@ -618,9 +681,9 @@ local function modifyThumbnail(parent, borderframe, data, fullModify, width, hei borderframe:SetIcon(icon) end - icon:Show(); + icon:Show() else - icon:Hide(); + icon:Hide() end end @@ -633,17 +696,17 @@ local function createIcon() texture = "Runes", orientation = "HORIZONTAL", alpha = 1.0, - barColor = {1, 0, 0, 1}, - triggers = {} - }; + barColor = { 1, 0, 0, 1 }, + triggers = {}, + } -- Create and configure thumbnail - local thumbnail = createThumbnail(); - modifyThumbnail(UIParent, thumbnail, data, nil, 32, 18); - thumbnail:SetIcon("Interface\\Icons\\INV_Sword_62"); + local thumbnail = createThumbnail() + modifyThumbnail(UIParent, thumbnail, data, nil, 32, 18) + thumbnail:SetIcon("Interface\\Icons\\INV_Sword_62") -- Return thumbnail - return thumbnail; + return thumbnail end local templates = { @@ -652,150 +715,160 @@ local templates = { data = { width = 200, height = 30, - barColor = { 0, 1, 0, 1}, + barColor = { 0, 1, 0, 1 }, inverse = true, smoothProgress = true, - } + }, }, { title = L["Vertical Bar"], data = { width = 30, height = 200, - barColor = { 0, 1, 0, 1}, + barColor = { 0, 1, 0, 1 }, rotateText = "LEFT", orientation = "VERTICAL_INVERSE", inverse = true, smoothProgress = true, - } + }, }, } local anchorPoints = { BOTTOMLEFT = { display = { L["Background"], L["Bottom Left"] }, - type = "point" + type = "point", }, BOTTOM = { display = { L["Background"], L["Bottom"] }, - type = "point" + type = "point", }, BOTTOMRIGHT = { display = { L["Background"], L["Bottom Right"] }, - type = "point" + type = "point", }, RIGHT = { display = { L["Background"], L["Right"] }, - type = "point" + type = "point", }, TOPRIGHT = { display = { L["Background"], L["Top Right"] }, - type = "point" + type = "point", }, TOP = { display = { L["Background"], L["Top"] }, - type = "point" + type = "point", }, TOPLEFT = { display = { L["Background"], L["Top Left"] }, - type = "point" + type = "point", }, LEFT = { display = { L["Background"], L["Left"] }, - type = "point" + type = "point", }, CENTER = { display = { L["Background"], L["Center"] }, - type = "point" + type = "point", }, INNER_BOTTOMLEFT = { display = { L["Background Inner"], L["Bottom Left"] }, - type = "point" + type = "point", }, INNER_BOTTOM = { display = { L["Background Inner"], L["Bottom"] }, - type = "point" + type = "point", }, INNER_BOTTOMRIGHT = { display = { L["Background Inner"], L["Bottom Right"] }, - type = "point" + type = "point", }, INNER_RIGHT = { display = { L["Background Inner"], L["Right"] }, - type = "point" + type = "point", }, INNER_TOPRIGHT = { display = { L["Background Inner"], L["Top Right"] }, - type = "point" + type = "point", }, INNER_TOP = { display = { L["Background Inner"], L["Top"] }, - type = "point" + type = "point", }, INNER_TOPLEFT = { display = { L["Background Inner"], L["Top Left"] }, - type = "point" + type = "point", }, INNER_LEFT = { display = { L["Background Inner"], L["Left"] }, - type = "point" + type = "point", }, INNER_CENTER = { display = { L["Background Inner"], L["Center"] }, - type = "point" + type = "point", }, ICON_BOTTOMLEFT = { display = { L["Icon"], L["Bottom Left"] }, - type = "point" + type = "point", }, ICON_BOTTOM = { display = { L["Icon"], L["Bottom"] }, - type = "point" + type = "point", }, ICON_BOTTOMRIGHT = { display = { L["Icon"], L["Bottom Right"] }, - type = "point" + type = "point", }, ICON_RIGHT = { display = { L["Icon"], L["Right"] }, - type = "point" + type = "point", }, ICON_TOPRIGHT = { display = { L["Icon"], L["Top Right"] }, - type = "point" + type = "point", }, ICON_TOP = { display = { L["Icon"], L["Top"] }, - type = "point" + type = "point", }, ICON_TOPLEFT = { display = { L["Icon"], L["Top Left"] }, - type = "point" + type = "point", }, ICON_LEFT = { display = { L["Icon"], L["Left"] }, - type = "point" + type = "point", }, ICON_CENTER = { display = { L["Icon"], L["Center"] }, - type = "point" + type = "point", }, SPARK = { display = L["Spark"], - type = "point" + type = "point", }, ALL = { display = L["Whole Area"], - type = "area" + type = "area", }, } local function GetAnchors(data) - return anchorPoints; + return anchorPoints end -- Register new region type options with WeakAuras -WeakAuras.RegisterRegionOptions("aurabar", createOptions, createIcon, L["Progress Bar"], createThumbnail, modifyThumbnail, L["Shows a progress bar with name, timer, and icon"], templates, GetAnchors); +WeakAuras.RegisterRegionOptions( + "aurabar", + createOptions, + createIcon, + L["Progress Bar"], + createThumbnail, + modifyThumbnail, + L["Shows a progress bar with name, timer, and icon"], + templates, + GetAnchors +) diff --git a/WeakAurasOptions/RegionOptions/DynamicGroup.lua b/WeakAurasOptions/RegionOptions/DynamicGroup.lua index dfb58fb97c..3d56e968a9 100644 --- a/WeakAurasOptions/RegionOptions/DynamicGroup.lua +++ b/WeakAurasOptions/RegionOptions/DynamicGroup.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... local L = WeakAuras.L @@ -6,7 +8,7 @@ local L = WeakAuras.L local selfPoints = { default = "CENTER", RIGHT = function(data) - if data.align == "LEFT" then + if data.align == "LEFT" then return "TOPLEFT" elseif data.align == "RIGHT" then return "BOTTOMLEFT" @@ -15,7 +17,7 @@ local selfPoints = { end end, LEFT = function(data) - if data.align == "LEFT" then + if data.align == "LEFT" then return "TOPRIGHT" elseif data.align == "RIGHT" then return "BOTTOMRIGHT" @@ -91,7 +93,7 @@ local function createOptions(id, data) data.groupIcon = v WeakAuras.Add(data) WeakAuras.UpdateThumbnail(data) - end + end, }, chooseIcon = { type = "execute", @@ -99,7 +101,7 @@ local function createOptions(id, data) name = L["Choose"], order = 0.51, func = function() - OptionsPrivate.OpenIconPicker(data, { [data.id] = {"groupIcon"} }, true) + OptionsPrivate.OpenIconPicker(data, { [data.id] = { "groupIcon" } }, true) end, imageWidth = 24, imageHeight = 24, @@ -135,7 +137,9 @@ local function createOptions(id, data) width = WeakAuras.normalWidth, name = L["Group by Frame"], desc = L["Group and anchor each auras by frame.\n\n- Nameplates: attach to nameplates per unit.\n- Unit Frames: attach to unit frame buttons per unit.\n- Custom Frames: choose which frame each region should be anchored to."], - hidden = function() return data.grow == "CUSTOM" end, + hidden = function() + return data.grow == "CUSTOM" + end, }, anchorPerUnit = { type = "select", @@ -147,8 +151,12 @@ local function createOptions(id, data) ["NAMEPLATE"] = L["Nameplates"], ["CUSTOM"] = L["Custom Frames"], }, - hidden = function() return data.grow == "CUSTOM" end, - disabled = function() return not data.useAnchorPerUnit end + hidden = function() + return data.grow == "CUSTOM" + end, + disabled = function() + return not data.useAnchorPerUnit + end, }, -- custom grow option added below align = { @@ -168,8 +176,20 @@ local function createOptions(id, data) WeakAuras.ClearAndUpdateOptions(data.id) OptionsPrivate.ResetMoverSizer() end, - hidden = function() return (data.grow == "CUSTOM" or data.grow == "LEFT" or data.grow == "RIGHT" or data.grow == "HORIZONTAL" or data.grow == "CIRCLE" or data.grow == "COUNTERCIRCLE" or data.grow == "GRID") end, - disabled = function() return data.grow == "CIRCLE" or data.grow == "COUNTERCIRCLE" end + hidden = function() + return ( + data.grow == "CUSTOM" + or data.grow == "LEFT" + or data.grow == "RIGHT" + or data.grow == "HORIZONTAL" + or data.grow == "CIRCLE" + or data.grow == "COUNTERCIRCLE" + or data.grow == "GRID" + ) + end, + disabled = function() + return data.grow == "CIRCLE" or data.grow == "COUNTERCIRCLE" + end, }, rotated_align = { type = "select", @@ -177,8 +197,20 @@ local function createOptions(id, data) name = L["Align"], order = 3, values = OptionsPrivate.Private.rotated_align_types, - hidden = function() return (data.grow == "CUSTOM" or data.grow == "UP" or data.grow == "DOWN" or data.grow == "VERTICAL" or data.grow == "CIRCLE" or data.grow == "COUNTERCIRCLE" or data.grow == "GRID") end, - get = function() return data.align; end, + hidden = function() + return ( + data.grow == "CUSTOM" + or data.grow == "UP" + or data.grow == "DOWN" + or data.grow == "VERTICAL" + or data.grow == "CIRCLE" + or data.grow == "COUNTERCIRCLE" + or data.grow == "GRID" + ) + end, + get = function() + return data.align + end, set = function(info, v) data.align = v local selfPoint = selfPoints[data.grow] or selfPoints.default @@ -198,7 +230,9 @@ local function createOptions(id, data) name = L["Constant Factor"], order = 4, values = OptionsPrivate.Private.circular_group_constant_factor_types, - hidden = function() return data.grow ~= "CIRCLE" and data.grow ~= "COUNTERCIRCLE" end + hidden = function() + return data.grow ~= "CIRCLE" and data.grow ~= "COUNTERCIRCLE" + end, }, rotation = { type = "range", @@ -208,14 +242,18 @@ local function createOptions(id, data) min = 0, max = 360, bigStep = 3, - hidden = function() return data.grow ~= "CIRCLE" and data.grow ~= "COUNTERCIRCLE" end + hidden = function() + return data.grow ~= "CIRCLE" and data.grow ~= "COUNTERCIRCLE" + end, }, fullCircle = { type = "toggle", width = WeakAuras.normalWidth, name = L["Full Circle"], order = 7, - hidden = function() return data.grow ~= "CIRCLE" and data.grow ~= "COUNTERCIRCLE" end + hidden = function() + return data.grow ~= "CIRCLE" and data.grow ~= "COUNTERCIRCLE" + end, }, arcLength = { type = "range", @@ -225,8 +263,12 @@ local function createOptions(id, data) min = 0, max = 360, bigStep = 3, - disabled = function() return data.fullCircle end, - hidden = function() return data.grow ~= "CIRCLE" and data.grow ~= "COUNTERCIRCLE" end + disabled = function() + return data.fullCircle + end, + hidden = function() + return data.grow ~= "CIRCLE" and data.grow ~= "COUNTERCIRCLE" + end, }, radius = { type = "range", @@ -236,7 +278,9 @@ local function createOptions(id, data) softMin = 0, softMax = 500, bigStep = 1, - hidden = function() return data.grow == "CUSTOM" or not((data.grow == "CIRCLE" or data.grow == "COUNTERCIRCLE") and data.constantFactor == "RADIUS") end + hidden = function() + return data.grow == "CUSTOM" or not ((data.grow == "CIRCLE" or data.grow == "COUNTERCIRCLE") and data.constantFactor == "RADIUS") + end, }, -- grid grow options gridType = { @@ -245,7 +289,9 @@ local function createOptions(id, data) name = L["Grid direction"], order = 8, values = OptionsPrivate.Private.grid_types, - hidden = function() return data.grow ~= "GRID" end, + hidden = function() + return data.grow ~= "GRID" + end, set = function(info, value) data.selfPoint = gridSelfPoints[value] data.gridType = value @@ -257,7 +303,9 @@ local function createOptions(id, data) type = "range", width = WeakAuras.normalWidth, name = function() - if not data.gridType then return "" end + if not data.gridType then + return "" + end if data.gridType:find("^[RL]") then return L["Row Width"] else @@ -268,7 +316,9 @@ local function createOptions(id, data) min = 1, softMax = 20, step = 1, - hidden = function() return data.grow ~= "GRID" end, + hidden = function() + return data.grow ~= "GRID" + end, }, rowSpace = { type = "range", @@ -278,7 +328,9 @@ local function createOptions(id, data) softMin = 0, softMax = 300, step = 1, - hidden = function() return data.grow ~= "GRID" end, + hidden = function() + return data.grow ~= "GRID" + end, }, columnSpace = { type = "range", @@ -288,7 +340,9 @@ local function createOptions(id, data) softMin = 0, softMax = 300, step = 1, - hidden = function() return data.grow ~= "GRID" end, + hidden = function() + return data.grow ~= "GRID" + end, }, -- generic grow options space = { @@ -300,10 +354,8 @@ local function createOptions(id, data) softMax = 300, bigStep = 1, hidden = function() - return data.grow == "CUSTOM" - or data.grow == "GRID" - or ((data.grow == "CIRCLE" or data.grow == "COUNTERCIRCLE") and data.constantFactor == "RADIUS") - end + return data.grow == "CUSTOM" or data.grow == "GRID" or ((data.grow == "CIRCLE" or data.grow == "COUNTERCIRCLE") and data.constantFactor == "RADIUS") + end, }, stagger = { type = "range", @@ -315,11 +367,8 @@ local function createOptions(id, data) step = 0.1, bigStep = 1, hidden = function() - return data.grow == "CUSTOM" - or data.grow == "CIRCLE" - or data.grow == "COUNTERCIRCLE" - or data.grow == "GRID" - end + return data.grow == "CUSTOM" or data.grow == "CIRCLE" or data.grow == "COUNTERCIRCLE" or data.grow == "GRID" + end, }, -- sort options sort = { @@ -327,7 +376,7 @@ local function createOptions(id, data) width = WeakAuras.doubleWidth, name = L["Sort"], order = 20, - values = OptionsPrivate.Private.group_sort_types + values = OptionsPrivate.Private.group_sort_types, }, -- custom sort option added below hybridPosition = { @@ -336,7 +385,9 @@ local function createOptions(id, data) name = L["Hybrid Position"], order = 21, values = OptionsPrivate.Private.group_hybrid_position_types, - hidden = function() return not(data.sort == "hybrid") end, + hidden = function() + return not (data.sort == "hybrid") + end, }, hybridSortMode = { type = "select", @@ -344,26 +395,32 @@ local function createOptions(id, data) name = L["Hybrid Sort Mode"], order = 22, values = OptionsPrivate.Private.group_hybrid_sort_types, - hidden = function() return not(data.sort == "hybrid") end, + hidden = function() + return not (data.sort == "hybrid") + end, }, sortHybrid = { type = "multiselect", width = "full", name = L["Select the auras you always want to be listed first"], order = 23, - hidden = function() return not(data.sort == "hybrid") end, + hidden = function() + return not (data.sort == "hybrid") + end, values = function() return data.controlledChildren end, get = function(info, index) local id = data.controlledChildren[index] - return data.sortHybridTable and data.sortHybridTable[id] or false; + return data.sortHybridTable and data.sortHybridTable[id] or false end, set = function(info, index) - if not data.sortHybridTable then data.sortHybridTable = {}; end + if not data.sortHybridTable then + data.sortHybridTable = {} + end local id = data.controlledChildren[index] - local cur = data.sortHybridTable and data.sortHybridTable[id] or false; - data.sortHybridTable[id] = not(cur); + local cur = data.sortHybridTable and data.sortHybridTable[id] or false + data.sortHybridTable[id] = not cur end, }, sortSpace = { @@ -371,14 +428,18 @@ local function createOptions(id, data) name = "", width = WeakAuras.doubleWidth, order = 24, - hidden = function() return data.sort == "hybrid" end + hidden = function() + return data.sort == "hybrid" + end, }, useLimit = { type = "toggle", order = 25, width = WeakAuras.normalWidth, name = L["Limit"], - hidden = function() return data.grow == "CUSTOM" end, + hidden = function() + return data.grow == "CUSTOM" + end, }, limit = { type = "range", @@ -388,14 +449,18 @@ local function createOptions(id, data) min = 0, softMax = 20, step = 1, - disabled = function() return not data.useLimit end, - hidden = function() return data.grow == "CUSTOM" end, + disabled = function() + return not data.useLimit + end, + hidden = function() + return data.grow == "CUSTOM" + end, }, animate = { type = "toggle", width = WeakAuras.normalWidth, name = L["Animated Expand and Collapse"], - order = 27 + order = 27, }, scale = { type = "range", @@ -411,30 +476,59 @@ local function createOptions(id, data) end, set = function(info, v) data.scale = data.scale or 1 - local change = 1 - (v/data.scale) - data.xOffset = data.xOffset/(1-change) - data.yOffset = data.yOffset/(1-change) + local change = 1 - (v / data.scale) + data.xOffset = data.xOffset / (1 - change) + data.yOffset = data.yOffset / (1 - change) data.scale = v - WeakAuras.Add(data); - OptionsPrivate.ResetMoverSizer(); - end + WeakAuras.Add(data) + OptionsPrivate.ResetMoverSizer() + end, }, endHeader = { type = "header", order = 100, name = "", }, - }; + } - OptionsPrivate.commonOptions.AddCodeOption(options, data, L["Custom Grow"], "custom_grow", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#grow", - 2, function() return data.grow ~= "CUSTOM" end, {"customGrow"}, false, { setOnParent = true }) - OptionsPrivate.commonOptions.AddCodeOption(options, data, L["Custom Sort"], "custom_sort", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-sort", - 21, function() return data.sort ~= "custom" end, {"customSort"}, false, { setOnParent = true }) - OptionsPrivate.commonOptions.AddCodeOption(options, data, L["Custom Anchor"], "custom_anchor_per_unit", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#group-by-frame", - 1.7, function() return not(data.grow ~= "CUSTOM" and data.useAnchorPerUnit and data.anchorPerUnit == "CUSTOM") end, {"customAnchorPerUnit"}, false, { setOnParent = true }) + OptionsPrivate.commonOptions.AddCodeOption(options, data, L["Custom Grow"], "custom_grow", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#grow", 2, function() + return data.grow ~= "CUSTOM" + end, { "customGrow" }, false, { setOnParent = true }) + OptionsPrivate.commonOptions.AddCodeOption( + options, + data, + L["Custom Sort"], + "custom_sort", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-sort", + 21, + function() + return data.sort ~= "custom" + end, + { "customSort" }, + false, + { setOnParent = true } + ) + OptionsPrivate.commonOptions.AddCodeOption( + options, + data, + L["Custom Anchor"], + "custom_anchor_per_unit", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#group-by-frame", + 1.7, + function() + return not (data.grow ~= "CUSTOM" and data.useAnchorPerUnit and data.anchorPerUnit == "CUSTOM") + end, + { "customAnchorPerUnit" }, + false, + { setOnParent = true } + ) - local borderHideFunc = function() return data.useAnchorPerUnit or data.grow == "CUSTOM" end - local disableSelfPoint = function() return data.grow ~= "CUSTOM" and data.grow ~= "GRID" and not data.useAnchorPerUnit end + local borderHideFunc = function() + return data.useAnchorPerUnit or data.grow == "CUSTOM" + end + local disableSelfPoint = function() + return data.grow ~= "CUSTOM" and data.grow ~= "GRID" and not data.useAnchorPerUnit + end for k, v in pairs(OptionsPrivate.commonOptions.BorderOptions(id, data, nil, borderHideFunc, 70)) do options[k] = v @@ -443,35 +537,35 @@ local function createOptions(id, data) return { dynamicgroup = options, position = OptionsPrivate.commonOptions.PositionOptions(id, data, nil, true, disableSelfPoint, true), - }; + } end local function createThumbnail() -- frame - local thumbnail = CreateFrame("Frame", nil, UIParent); - thumbnail:SetWidth(32); - thumbnail:SetHeight(32); + local thumbnail = CreateFrame("Frame", nil, UIParent) + thumbnail:SetWidth(32) + thumbnail:SetHeight(32) -- border - local border = thumbnail:CreateTexture(nil, "OVERLAY"); - border:SetAllPoints(thumbnail); - border:SetTexture("Interface\\BUTTONS\\UI-Quickslot2.blp"); - border:SetTexCoord(0.2, 0.8, 0.2, 0.8); + local border = thumbnail:CreateTexture(nil, "OVERLAY") + border:SetAllPoints(thumbnail) + border:SetTexture("Interface\\BUTTONS\\UI-Quickslot2.blp") + border:SetTexCoord(0.2, 0.8, 0.2, 0.8) return thumbnail end local function defaultIconAnimation(self, elapsed) self.elapsed = self.elapsed + elapsed - if(self.elapsed < 0.5) then + if self.elapsed < 0.5 then self.t2:SetPoint("TOP", self.t1, "BOTTOM", 0, -2 + (28 * self.elapsed)) self.t2:SetAlpha(1 - (2 * self.elapsed)) - elseif(self.elapsed < 1.5) then + elseif self.elapsed < 1.5 then -- do nothing - elseif(self.elapsed < 2) then + elseif self.elapsed < 2 then self.t2:SetPoint("TOP", self.t1, "BOTTOM", 0, -2 + (28 * (2 - self.elapsed))) self.t2:SetAlpha((2 * self.elapsed) - 3) - elseif(self.elapsed < 3) then + elseif self.elapsed < 3 then -- do nothing else self.elapsed = self.elapsed - 3 @@ -479,37 +573,41 @@ local function defaultIconAnimation(self, elapsed) end local function createAnimatedDefaultIcon(parent) - local defaultIcon = CreateFrame("Frame", nil, parent); - parent.defaultIcon = defaultIcon; + local defaultIcon = CreateFrame("Frame", nil, parent) + parent.defaultIcon = defaultIcon - local t1 = defaultIcon:CreateTexture(nil, "ARTWORK"); - t1:SetWidth(24); - t1:SetHeight(6); - t1:SetColorTexture(0.8, 0, 0); - t1:SetPoint("TOP", parent, "TOP", 0, -6); - local t2 = defaultIcon:CreateTexture(nil, "ARTWORK"); - t2:SetWidth(12); - t2:SetHeight(12); - t2:SetColorTexture(0.2, 0.8, 0.2); - t2:SetPoint("TOP", t1, "BOTTOM", 0, -2); - local t3 = defaultIcon:CreateTexture(nil, "ARTWORK"); - t3:SetWidth(30); - t3:SetHeight(4); - t3:SetColorTexture(0.1, 0.25, 1); - t3:SetPoint("TOP", t2, "BOTTOM", 0, -2); - local t4 = defaultIcon:CreateTexture(nil, "OVERLAY"); - t4:SetWidth(1); - t4:SetHeight(36); - t4:SetColorTexture(1, 1, 1); - t4:SetPoint("CENTER", parent, "CENTER"); + local t1 = defaultIcon:CreateTexture(nil, "ARTWORK") + t1:SetWidth(24) + t1:SetHeight(6) + t1:SetColorTexture(0.8, 0, 0) + t1:SetPoint("TOP", parent, "TOP", 0, -6) + local t2 = defaultIcon:CreateTexture(nil, "ARTWORK") + t2:SetWidth(12) + t2:SetHeight(12) + t2:SetColorTexture(0.2, 0.8, 0.2) + t2:SetPoint("TOP", t1, "BOTTOM", 0, -2) + local t3 = defaultIcon:CreateTexture(nil, "ARTWORK") + t3:SetWidth(30) + t3:SetHeight(4) + t3:SetColorTexture(0.1, 0.25, 1) + t3:SetPoint("TOP", t2, "BOTTOM", 0, -2) + local t4 = defaultIcon:CreateTexture(nil, "OVERLAY") + t4:SetWidth(1) + t4:SetHeight(36) + t4:SetColorTexture(1, 1, 1) + t4:SetPoint("CENTER", parent, "CENTER") defaultIcon.t1 = t1 defaultIcon.t2 = t2 - defaultIcon.elapsed = 0; + defaultIcon.elapsed = 0 defaultIcon:SetScript("OnUpdate", defaultIconAnimation) - defaultIcon:SetScript("OnHide", function(self) self:SetScript("OnUpdate", nil) end) - defaultIcon:SetScript("OnShow", function(self) self:SetScript("OnUpdate", defaultIconAnimation) end) + defaultIcon:SetScript("OnHide", function(self) + self:SetScript("OnUpdate", nil) + end) + defaultIcon:SetScript("OnShow", function(self) + self:SetScript("OnUpdate", defaultIconAnimation) + end) return defaultIcon end @@ -547,4 +645,12 @@ local function createIcon() return thumbnail end -WeakAuras.RegisterRegionOptions("dynamicgroup", createOptions, createIcon, L["Dynamic Group"], createThumbnail, modifyThumbnail, L["A group that dynamically controls the positioning of its children"]); +WeakAuras.RegisterRegionOptions( + "dynamicgroup", + createOptions, + createIcon, + L["Dynamic Group"], + createThumbnail, + modifyThumbnail, + L["A group that dynamically controls the positioning of its children"] +) diff --git a/WeakAurasOptions/RegionOptions/Group.lua b/WeakAurasOptions/RegionOptions/Group.lua index 76064b2fe4..88cc53d1d8 100644 --- a/WeakAurasOptions/RegionOptions/Group.lua +++ b/WeakAurasOptions/RegionOptions/Group.lua @@ -1,40 +1,42 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... -local L = WeakAuras.L; +local L = WeakAuras.L -- Calculate bounding box local function getRect(data) -- Temp variables - local blx, bly, trx, try; - blx, bly = data.xOffset or 0, data.yOffset or 0; + local blx, bly, trx, try + blx, bly = data.xOffset or 0, data.yOffset or 0 - if (data.width == nil or data.height == nil or data.regionType == "text") then - return blx, bly, blx, bly; + if data.width == nil or data.height == nil or data.regionType == "text" then + return blx, bly, blx, bly end -- Calc bounding box - if(data.selfPoint:find("LEFT")) then - trx = blx + data.width; - elseif(data.selfPoint:find("RIGHT")) then - trx = blx; - blx = blx - data.width; + if data.selfPoint:find("LEFT") then + trx = blx + data.width + elseif data.selfPoint:find("RIGHT") then + trx = blx + blx = blx - data.width else - blx = blx - (data.width/2); - trx = blx + data.width; + blx = blx - (data.width / 2) + trx = blx + data.width end - if(data.selfPoint:find("BOTTOM")) then - try = bly + data.height; - elseif(data.selfPoint:find("TOP")) then - try = bly; - bly = bly - data.height; + if data.selfPoint:find("BOTTOM") then + try = bly + data.height + elseif data.selfPoint:find("TOP") then + try = bly + bly = bly - data.height else - bly = bly - (data.height/2); - try = bly + data.height; + bly = bly - (data.height / 2) + try = bly + data.height end -- Return data - return blx, bly, trx, try; + return blx, bly, trx, try end local function getHeight(data, region) @@ -45,7 +47,6 @@ local function getHeight(data, region) end end - local function getWidth(data, region) if data.regionType == "text" then return region.width @@ -63,64 +64,64 @@ local function createDistributeAlignOptions(id, data) order = 10, values = OptionsPrivate.Private.align_types, get = function() - if(#data.controlledChildren < 1) then - return nil; + if #data.controlledChildren < 1 then + return nil end - local alignedCenter, alignedRight, alignedLeft = "CENTER", "RIGHT", "LEFT"; + local alignedCenter, alignedRight, alignedLeft = "CENTER", "RIGHT", "LEFT" for index, childId in pairs(data.controlledChildren) do - local childData = WeakAuras.GetData(childId); - if(childData) then - local left, _, right = getRect(childData); - local center = (left + right) / 2; - if(math.abs(right) >= 0.01) then - alignedRight = nil; + local childData = WeakAuras.GetData(childId) + if childData then + local left, _, right = getRect(childData) + local center = (left + right) / 2 + if math.abs(right) >= 0.01 then + alignedRight = nil end - if(math.abs(left) >= 0.01) then - alignedLeft = nil; + if math.abs(left) >= 0.01 then + alignedLeft = nil end - if(math.abs(center) >= 0.01) then - alignedCenter = nil; + if math.abs(center) >= 0.01 then + alignedCenter = nil end end end - return (alignedCenter or alignedRight or alignedLeft); + return (alignedCenter or alignedRight or alignedLeft) end, set = function(info, v) for index, childId in pairs(data.controlledChildren) do - local childData = WeakAuras.GetData(childId); + local childData = WeakAuras.GetData(childId) local childRegion = WeakAuras.GetRegion(childId) - if(childData and childRegion) then - if(v == "CENTER") then - if(childData.selfPoint:find("LEFT")) then - childData.xOffset = 0 - (getWidth(childData, childRegion) / 2); - elseif(childData.selfPoint:find("RIGHT")) then - childData.xOffset = 0 + (getWidth(childData, childRegion) / 2); + if childData and childRegion then + if v == "CENTER" then + if childData.selfPoint:find("LEFT") then + childData.xOffset = 0 - (getWidth(childData, childRegion) / 2) + elseif childData.selfPoint:find("RIGHT") then + childData.xOffset = 0 + (getWidth(childData, childRegion) / 2) else - childData.xOffset = 0; + childData.xOffset = 0 end - elseif(v == "LEFT") then - if(childData.selfPoint:find("LEFT")) then - childData.xOffset = 0; - elseif(childData.selfPoint:find("RIGHT")) then - childData.xOffset = 0 + getWidth(childData, childRegion); + elseif v == "LEFT" then + if childData.selfPoint:find("LEFT") then + childData.xOffset = 0 + elseif childData.selfPoint:find("RIGHT") then + childData.xOffset = 0 + getWidth(childData, childRegion) else - childData.xOffset = 0 + (getWidth(childData, childRegion) / 2); + childData.xOffset = 0 + (getWidth(childData, childRegion) / 2) end - elseif(v == "RIGHT") then - if(childData.selfPoint:find("LEFT")) then - childData.xOffset = 0 - getWidth(childData, childRegion); - elseif(childData.selfPoint:find("RIGHT")) then - childData.xOffset = 0; + elseif v == "RIGHT" then + if childData.selfPoint:find("LEFT") then + childData.xOffset = 0 - getWidth(childData, childRegion) + elseif childData.selfPoint:find("RIGHT") then + childData.xOffset = 0 else - childData.xOffset = 0 - (getWidth(childData, childRegion) / 2); + childData.xOffset = 0 - (getWidth(childData, childRegion) / 2) end end - WeakAuras.Add(childData); + WeakAuras.Add(childData) end end - WeakAuras.Add(data); - OptionsPrivate.ResetMoverSizer(); - end + WeakAuras.Add(data) + OptionsPrivate.ResetMoverSizer() + end, }, align_v = { type = "select", @@ -129,64 +130,64 @@ local function createDistributeAlignOptions(id, data) order = 15, values = OptionsPrivate.Private.rotated_align_types, get = function() - if(#data.controlledChildren < 1) then - return nil; + if #data.controlledChildren < 1 then + return nil end - local alignedCenter, alignedBottom, alignedTop = "CENTER", "RIGHT", "LEFT"; + local alignedCenter, alignedBottom, alignedTop = "CENTER", "RIGHT", "LEFT" for index, childId in pairs(data.controlledChildren) do - local childData = WeakAuras.GetData(childId); - if(childData) then - local _, bottom, _, top = getRect(childData); - local center = (bottom + top) / 2; - if(math.abs(bottom) >= 0.01) then - alignedBottom = nil; + local childData = WeakAuras.GetData(childId) + if childData then + local _, bottom, _, top = getRect(childData) + local center = (bottom + top) / 2 + if math.abs(bottom) >= 0.01 then + alignedBottom = nil end - if(math.abs(top) >= 0.01) then - alignedTop = nil; + if math.abs(top) >= 0.01 then + alignedTop = nil end - if(math.abs(center) >= 0.01) then - alignedCenter = nil; + if math.abs(center) >= 0.01 then + alignedCenter = nil end end end - return alignedCenter or alignedBottom or alignedTop; + return alignedCenter or alignedBottom or alignedTop end, set = function(info, v) for index, childId in pairs(data.controlledChildren) do - local childData = WeakAuras.GetData(childId); + local childData = WeakAuras.GetData(childId) local childRegion = WeakAuras.GetRegion(childId) - if(childData and childRegion) then - if(v == "CENTER") then - if(childData.selfPoint:find("BOTTOM")) then - childData.yOffset = 0 - (getHeight(childData, childRegion) / 2); - elseif(childData.selfPoint:find("TOP")) then - childData.yOffset = 0 + (getHeight(childData, childRegion) / 2); + if childData and childRegion then + if v == "CENTER" then + if childData.selfPoint:find("BOTTOM") then + childData.yOffset = 0 - (getHeight(childData, childRegion) / 2) + elseif childData.selfPoint:find("TOP") then + childData.yOffset = 0 + (getHeight(childData, childRegion) / 2) else - childData.yOffset = 0; + childData.yOffset = 0 end - elseif(v == "RIGHT") then - if(childData.selfPoint:find("BOTTOM")) then - childData.yOffset = 0; - elseif(childData.selfPoint:find("TOP")) then - childData.yOffset = 0 + getHeight(childData, childRegion); + elseif v == "RIGHT" then + if childData.selfPoint:find("BOTTOM") then + childData.yOffset = 0 + elseif childData.selfPoint:find("TOP") then + childData.yOffset = 0 + getHeight(childData, childRegion) else - childData.yOffset = 0 + (getHeight(childData, childRegion) / 2); + childData.yOffset = 0 + (getHeight(childData, childRegion) / 2) end - elseif(v == "LEFT") then - if(childData.selfPoint:find("BOTTOM")) then - childData.yOffset = 0 - ( childData.height or childRegion.height); - elseif(childData.selfPoint:find("TOP")) then - childData.yOffset = 0; + elseif v == "LEFT" then + if childData.selfPoint:find("BOTTOM") then + childData.yOffset = 0 - (childData.height or childRegion.height) + elseif childData.selfPoint:find("TOP") then + childData.yOffset = 0 else - childData.yOffset = 0 - (getHeight(childData, childRegion) / 2); + childData.yOffset = 0 - (getHeight(childData, childRegion) / 2) end end - WeakAuras.Add(childData); + WeakAuras.Add(childData) end end - WeakAuras.Add(data); - OptionsPrivate.ResetMoverSizer(); - end + WeakAuras.Add(data) + OptionsPrivate.ResetMoverSizer() + end, }, distribute_h = { type = "range", @@ -197,79 +198,79 @@ local function createDistributeAlignOptions(id, data) softMax = 100, bigStep = 1, get = function() - if(#data.controlledChildren < 2) then - return nil; + if #data.controlledChildren < 2 then + return nil end - local spaced; - local previousData; + local spaced + local previousData for index, childId in pairs(data.controlledChildren) do - local childData = WeakAuras.GetData(childId); - if(childData) then - local left, _, right = getRect(childData); - if not(previousData) then - if not(math.abs(left) < 0.01 or math.abs(right) < 0.01) then - return nil; + local childData = WeakAuras.GetData(childId) + if childData then + local left, _, right = getRect(childData) + if not previousData then + if not (math.abs(left) < 0.01 or math.abs(right) < 0.01) then + return nil end - previousData = childData; + previousData = childData else - local pleft, _, pright = getRect(previousData); - if(left - pleft > 0) then - if not(spaced) then - spaced = left - pleft; + local pleft, _, pright = getRect(previousData) + if left - pleft > 0 then + if not spaced then + spaced = left - pleft else - if(math.abs(spaced - (left - pleft)) > 0.01) then - return nil; + if math.abs(spaced - (left - pleft)) > 0.01 then + return nil end end - elseif(right - pright < 0) then - if not(spaced) then - spaced = right - pright; + elseif right - pright < 0 then + if not spaced then + spaced = right - pright else - if(math.abs(spaced - (right - pright)) > 0.01) then - return nil; + if math.abs(spaced - (right - pright)) > 0.01 then + return nil end end else - return nil; + return nil end end - previousData = childData; + previousData = childData end end - return spaced; + return spaced end, set = function(info, v) - local xOffset = 0; + local xOffset = 0 for index, childId in pairs(data.controlledChildren) do - local childData = WeakAuras.GetData(childId); + local childData = WeakAuras.GetData(childId) local childRegion = WeakAuras.GetRegion(childId) - if(childData and childRegion) then - if(v > 0) then - if(childData.selfPoint:find("LEFT")) then - childData.xOffset = xOffset; - elseif(childData.selfPoint:find("RIGHT")) then - childData.xOffset = xOffset + getWidth(childData, childRegion); + if childData and childRegion then + if v > 0 then + if childData.selfPoint:find("LEFT") then + childData.xOffset = xOffset + elseif childData.selfPoint:find("RIGHT") then + childData.xOffset = xOffset + getWidth(childData, childRegion) else - childData.xOffset = xOffset + (getWidth(childData, childRegion) / 2); + childData.xOffset = xOffset + (getWidth(childData, childRegion) / 2) end - xOffset = xOffset + v; - elseif(v < 0) then - if(childData.selfPoint:find("LEFT")) then - childData.xOffset = xOffset - getWidth(childData, childRegion); - elseif(childData.selfPoint:find("RIGHT")) then - childData.xOffset = xOffset; + xOffset = xOffset + v + elseif v < 0 then + if childData.selfPoint:find("LEFT") then + childData.xOffset = xOffset - getWidth(childData, childRegion) + elseif childData.selfPoint:find("RIGHT") then + childData.xOffset = xOffset else - childData.xOffset = xOffset - (getWidth(childData, childRegion) / 2); + childData.xOffset = xOffset - (getWidth(childData, childRegion) / 2) end - xOffset = xOffset + v; + xOffset = xOffset + v end - WeakAuras.Add(childData); + WeakAuras.Add(childData) end end - WeakAuras.Add(data); - OptionsPrivate.ResetMoverSizer(); - end + WeakAuras.Add(data) + OptionsPrivate.ResetMoverSizer() + end, }, distribute_v = { type = "range", @@ -280,79 +281,79 @@ local function createDistributeAlignOptions(id, data) softMax = 100, bigStep = 1, get = function() - if(#data.controlledChildren < 2) then - return nil; + if #data.controlledChildren < 2 then + return nil end - local spaced; - local previousData; + local spaced + local previousData for index, childId in pairs(data.controlledChildren) do - local childData = WeakAuras.GetData(childId); - if(childData) then - local _, bottom, _, top = getRect(childData); - if not(previousData) then - if not(math.abs(bottom) < 0.01 or math.abs(top) < 0.01) then - return nil; + local childData = WeakAuras.GetData(childId) + if childData then + local _, bottom, _, top = getRect(childData) + if not previousData then + if not (math.abs(bottom) < 0.01 or math.abs(top) < 0.01) then + return nil end - previousData = childData; + previousData = childData else - local _, pbottom, _, ptop = getRect(previousData); - if(bottom - pbottom > 0) then - if not(spaced) then - spaced = bottom - pbottom; + local _, pbottom, _, ptop = getRect(previousData) + if bottom - pbottom > 0 then + if not spaced then + spaced = bottom - pbottom else - if(math.abs(spaced - (bottom - pbottom)) > 0.01) then - return nil; + if math.abs(spaced - (bottom - pbottom)) > 0.01 then + return nil end end - elseif(top - ptop < 0) then - if not(spaced) then - spaced = top - ptop; + elseif top - ptop < 0 then + if not spaced then + spaced = top - ptop else - if(math.abs(spaced - (top - ptop)) > 0.01) then - return nil; + if math.abs(spaced - (top - ptop)) > 0.01 then + return nil end end else - return nil; + return nil end end - previousData = childData; + previousData = childData end end - return spaced; + return spaced end, set = function(info, v) - local yOffset = 0; + local yOffset = 0 for index, childId in pairs(data.controlledChildren) do - local childData = WeakAuras.GetData(childId); + local childData = WeakAuras.GetData(childId) local childRegion = WeakAuras.GetRegion(childId) - if(childData and childRegion) then - if(v > 0) then - if(childData.selfPoint:find("BOTTOM")) then - childData.yOffset = yOffset; - elseif(childData.selfPoint:find("TOP")) then - childData.yOffset = yOffset + getHeight(childData, childRegion); + if childData and childRegion then + if v > 0 then + if childData.selfPoint:find("BOTTOM") then + childData.yOffset = yOffset + elseif childData.selfPoint:find("TOP") then + childData.yOffset = yOffset + getHeight(childData, childRegion) else - childData.yOffset = yOffset + (getHeight(childData, childRegion) / 2); + childData.yOffset = yOffset + (getHeight(childData, childRegion) / 2) end - yOffset = yOffset + v; - elseif(v < 0) then - if(childData.selfPoint:find("BOTTOM")) then - childData.yOffset = yOffset - getHeight(childData, childRegion); - elseif(childData.selfPoint:find("TOP")) then - childData.yOffset = yOffset; + yOffset = yOffset + v + elseif v < 0 then + if childData.selfPoint:find("BOTTOM") then + childData.yOffset = yOffset - getHeight(childData, childRegion) + elseif childData.selfPoint:find("TOP") then + childData.yOffset = yOffset else - childData.yOffset = yOffset - (getHeight(childData, childRegion) / 2); + childData.yOffset = yOffset - (getHeight(childData, childRegion) / 2) end - yOffset = yOffset + v; + yOffset = yOffset + v end - WeakAuras.Add(childData); + WeakAuras.Add(childData) end end - WeakAuras.Add(data); - OptionsPrivate.ResetMoverSizer(); - end + WeakAuras.Add(data) + OptionsPrivate.ResetMoverSizer() + end, }, space_h = { type = "range", @@ -363,79 +364,79 @@ local function createDistributeAlignOptions(id, data) softMax = 100, bigStep = 1, get = function() - if(#data.controlledChildren < 2) then - return nil; + if #data.controlledChildren < 2 then + return nil end - local spaced; - local previousData; + local spaced + local previousData for index, childId in pairs(data.controlledChildren) do - local childData = WeakAuras.GetData(childId); - if(childData) then - local left, _, right = getRect(childData); - if not(previousData) then - if not(math.abs(left) < 0.01 or math.abs(right) < 0.01) then - return nil; + local childData = WeakAuras.GetData(childId) + if childData then + local left, _, right = getRect(childData) + if not previousData then + if not (math.abs(left) < 0.01 or math.abs(right) < 0.01) then + return nil end - previousData = childData; + previousData = childData else - local pleft, _, pright = getRect(previousData); - if(left - pright > 0) then - if not(spaced) then - spaced = left - pright; + local pleft, _, pright = getRect(previousData) + if left - pright > 0 then + if not spaced then + spaced = left - pright else - if(math.abs(spaced - (left - pright)) > 0.01) then - return nil; + if math.abs(spaced - (left - pright)) > 0.01 then + return nil end end - elseif(right - pleft < 0) then - if not(spaced) then - spaced = right - pleft; + elseif right - pleft < 0 then + if not spaced then + spaced = right - pleft else - if(math.abs(spaced - (right - pleft)) > 0.01) then - return nil; + if math.abs(spaced - (right - pleft)) > 0.01 then + return nil end end else - return nil; + return nil end end - previousData = childData; + previousData = childData end end - return spaced; + return spaced end, set = function(info, v) - local xOffset = 0; + local xOffset = 0 for index, childId in pairs(data.controlledChildren) do - local childData = WeakAuras.GetData(childId); + local childData = WeakAuras.GetData(childId) local childRegion = WeakAuras.GetRegion(childId) - if(childData and childRegion) then - if(v >= 0) then - if(childData.selfPoint:find("LEFT")) then - childData.xOffset = xOffset; - elseif(childData.selfPoint:find("RIGHT")) then - childData.xOffset = xOffset + getWidth(childData, childRegion); + if childData and childRegion then + if v >= 0 then + if childData.selfPoint:find("LEFT") then + childData.xOffset = xOffset + elseif childData.selfPoint:find("RIGHT") then + childData.xOffset = xOffset + getWidth(childData, childRegion) else - childData.xOffset = xOffset + (getWidth(childData, childRegion) / 2); + childData.xOffset = xOffset + (getWidth(childData, childRegion) / 2) end - xOffset = xOffset + v + getWidth(childData, childRegion); - elseif(v < 0) then - if(childData.selfPoint:find("LEFT")) then - childData.xOffset = xOffset - getWidth(childData, childRegion); - elseif(childData.selfPoint:find("RIGHT")) then - childData.xOffset = xOffset; + xOffset = xOffset + v + getWidth(childData, childRegion) + elseif v < 0 then + if childData.selfPoint:find("LEFT") then + childData.xOffset = xOffset - getWidth(childData, childRegion) + elseif childData.selfPoint:find("RIGHT") then + childData.xOffset = xOffset else - childData.xOffset = xOffset - (getWidth(childData, childRegion) / 2); + childData.xOffset = xOffset - (getWidth(childData, childRegion) / 2) end - xOffset = xOffset + v - getWidth(childData, childRegion); + xOffset = xOffset + v - getWidth(childData, childRegion) end - WeakAuras.Add(childData); + WeakAuras.Add(childData) end end - WeakAuras.Add(data); - OptionsPrivate.ResetMoverSizer(); - end + WeakAuras.Add(data) + OptionsPrivate.ResetMoverSizer() + end, }, space_v = { type = "range", @@ -446,80 +447,80 @@ local function createDistributeAlignOptions(id, data) softMax = 100, bigStep = 1, get = function() - if(#data.controlledChildren < 2) then - return nil; + if #data.controlledChildren < 2 then + return nil end - local spaced; - local previousData; + local spaced + local previousData for _, childId in pairs(data.controlledChildren) do - local childData = WeakAuras.GetData(childId); - if(childData) then - local _, bottom, _, top = getRect(childData); - if not(previousData) then - if not(math.abs(bottom) < 0.01 or math.abs(top) < 0.01) then - return nil; + local childData = WeakAuras.GetData(childId) + if childData then + local _, bottom, _, top = getRect(childData) + if not previousData then + if not (math.abs(bottom) < 0.01 or math.abs(top) < 0.01) then + return nil end - previousData = childData; + previousData = childData else - local _, pbottom, _, ptop = getRect(previousData); - if(bottom - ptop > 0) then - if not(spaced) then - spaced = bottom - ptop; + local _, pbottom, _, ptop = getRect(previousData) + if bottom - ptop > 0 then + if not spaced then + spaced = bottom - ptop else - if(math.abs(spaced - (bottom - ptop)) > 0.01) then - return nil; + if math.abs(spaced - (bottom - ptop)) > 0.01 then + return nil end end - elseif(top - pbottom < 0) then - if not(spaced) then - spaced = top - pbottom; + elseif top - pbottom < 0 then + if not spaced then + spaced = top - pbottom else - if(math.abs(spaced - (top - pbottom)) > 0.01) then - return nil; + if math.abs(spaced - (top - pbottom)) > 0.01 then + return nil end end else - return nil; + return nil end end - previousData = childData; + previousData = childData end end - return spaced; + return spaced end, set = function(info, v) - local yOffset = 0; + local yOffset = 0 for index, childId in pairs(data.controlledChildren) do - local childData = WeakAuras.GetData(childId); + local childData = WeakAuras.GetData(childId) local childRegion = WeakAuras.GetRegion(childId) - if(childData and childRegion) then - if(v >= 0) then - if(childData.selfPoint:find("BOTTOM")) then - childData.yOffset = yOffset; - elseif(childData.selfPoint:find("TOP")) then - childData.yOffset = yOffset + getHeight(childData, childRegion); + if childData and childRegion then + if v >= 0 then + if childData.selfPoint:find("BOTTOM") then + childData.yOffset = yOffset + elseif childData.selfPoint:find("TOP") then + childData.yOffset = yOffset + getHeight(childData, childRegion) else - childData.yOffset = yOffset + (getHeight(childData, childRegion) / 2); + childData.yOffset = yOffset + (getHeight(childData, childRegion) / 2) end - yOffset = yOffset + v + getHeight(childData, childRegion); - elseif(v < 0) then - if(childData.selfPoint:find("BOTTOM")) then - childData.yOffset = yOffset - getHeight(childData, childRegion); - elseif(childData.selfPoint:find("TOP")) then - childData.yOffset = yOffset; + yOffset = yOffset + v + getHeight(childData, childRegion) + elseif v < 0 then + if childData.selfPoint:find("BOTTOM") then + childData.yOffset = yOffset - getHeight(childData, childRegion) + elseif childData.selfPoint:find("TOP") then + childData.yOffset = yOffset else - childData.yOffset = yOffset - (getHeight(childData, childRegion) / 2); + childData.yOffset = yOffset - (getHeight(childData, childRegion) / 2) end - yOffset = yOffset + v - getHeight(childData, childRegion); + yOffset = yOffset + v - getHeight(childData, childRegion) end - WeakAuras.Add(childData); + WeakAuras.Add(childData) end end - WeakAuras.Add(data); - OptionsPrivate.ResetMoverSizer(); - end - } + WeakAuras.Add(data) + OptionsPrivate.ResetMoverSizer() + end, + }, } end @@ -542,7 +543,7 @@ local function createOptions(id, data) data.groupIcon = v WeakAuras.Add(data) WeakAuras.UpdateThumbnail(data) - end + end, }, chooseIcon = { type = "execute", @@ -550,12 +551,12 @@ local function createOptions(id, data) name = L["Choose"], order = 0.51, func = function() - OptionsPrivate.OpenIconPicker(data, { [data.id] = {"groupIcon"} }, true) - end, - imageWidth = 24, - imageHeight = 24, - control = "WeakAurasIcon", - image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\browse", + OptionsPrivate.OpenIconPicker(data, { [data.id] = { "groupIcon" } }, true) + end, + imageWidth = 24, + imageHeight = 24, + control = "WeakAurasIcon", + image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\browse", }, -- Alignment/Distribute options are added below scale = { @@ -572,25 +573,25 @@ local function createOptions(id, data) end, set = function(info, v) data.scale = data.scale or 1 - local change = 1 - (v/data.scale) - data.xOffset = data.xOffset/(1-change) - data.yOffset = data.yOffset/(1-change) + local change = 1 - (v / data.scale) + data.xOffset = data.xOffset / (1 - change) + data.yOffset = data.yOffset / (1 - change) data.scale = v - WeakAuras.Add(data); - OptionsPrivate.ResetMoverSizer(); - end + WeakAuras.Add(data) + OptionsPrivate.ResetMoverSizer() + end, }, endHeader = { type = "header", order = 100, name = "", }, - }; + } local hasSubGroups = false local hasDynamicSubGroup = false for index, childId in pairs(data.controlledChildren) do - local childData = WeakAuras.GetData(childId); + local childData = WeakAuras.GetData(childId) if childData.controlledChildren then hasSubGroups = true end @@ -603,7 +604,6 @@ local function createOptions(id, data) end end - if not hasSubGroups then for k, v in pairs(createDistributeAlignOptions(id, data)) do options[k] = v @@ -619,20 +619,20 @@ local function createOptions(id, data) return { group = options, position = OptionsPrivate.commonOptions.PositionOptions(id, data, nil, true, true, true), - }; + } end local function createThumbnail() -- frame - local thumbnail = CreateFrame("Frame", nil, UIParent); - thumbnail:SetWidth(32); - thumbnail:SetHeight(32); + local thumbnail = CreateFrame("Frame", nil, UIParent) + thumbnail:SetWidth(32) + thumbnail:SetHeight(32) -- border - local border = thumbnail:CreateTexture(nil, "OVERLAY"); - border:SetAllPoints(thumbnail); - border:SetTexture("Interface\\BUTTONS\\UI-Quickslot2.blp"); - border:SetTexCoord(0.2, 0.8, 0.2, 0.8); + local border = thumbnail:CreateTexture(nil, "OVERLAY") + border:SetAllPoints(thumbnail) + border:SetTexture("Interface\\BUTTONS\\UI-Quickslot2.blp") + border:SetTexCoord(0.2, 0.8, 0.2, 0.8) local icon = thumbnail:CreateTexture(nil, "OVERLAY") icon:SetAllPoints(thumbnail) @@ -643,24 +643,24 @@ end local function createDefaultIcon(parent) -- default Icon - local defaultIcon = CreateFrame("Frame", nil, parent); - parent.defaultIcon = defaultIcon; - - local t1 = defaultIcon:CreateTexture(nil, "ARTWORK"); - t1:SetWidth(24); - t1:SetHeight(8); - t1:SetColorTexture(0.8, 0, 0, 0.5); - t1:SetPoint("TOP", parent, "TOP", 0, -6); - local t2 = defaultIcon:CreateTexture(nil, "ARTWORK"); - t2:SetWidth(20); - t2:SetHeight(20); - t2:SetColorTexture(0.2, 0.8, 0.2, 0.5); - t2:SetPoint("TOP", t1, "BOTTOM", 0, 5); - local t3 = defaultIcon:CreateTexture(nil, "ARTWORK"); - t3:SetWidth(20); - t3:SetHeight(12); - t3:SetColorTexture(0.1, 0.25, 1, 0.5); - t3:SetPoint("TOP", t2, "BOTTOM", -5, 8); + local defaultIcon = CreateFrame("Frame", nil, parent) + parent.defaultIcon = defaultIcon + + local t1 = defaultIcon:CreateTexture(nil, "ARTWORK") + t1:SetWidth(24) + t1:SetHeight(8) + t1:SetColorTexture(0.8, 0, 0, 0.5) + t1:SetPoint("TOP", parent, "TOP", 0, -6) + local t2 = defaultIcon:CreateTexture(nil, "ARTWORK") + t2:SetWidth(20) + t2:SetHeight(20) + t2:SetColorTexture(0.2, 0.8, 0.2, 0.5) + t2:SetPoint("TOP", t1, "BOTTOM", 0, 5) + local t3 = defaultIcon:CreateTexture(nil, "ARTWORK") + t3:SetWidth(20) + t3:SetHeight(12) + t3:SetColorTexture(0.1, 0.25, 1, 0.5) + t3:SetPoint("TOP", t2, "BOTTOM", -5, 8) return defaultIcon end @@ -699,4 +699,12 @@ local function createIcon() end -- Register new region type options with WeakAuras -WeakAuras.RegisterRegionOptions("group", createOptions, createIcon, L["Group"], createThumbnail, modifyThumbnail, L["Controls the positioning and configuration of multiple displays at the same time"]); +WeakAuras.RegisterRegionOptions( + "group", + createOptions, + createIcon, + L["Group"], + createThumbnail, + modifyThumbnail, + L["Controls the positioning and configuration of multiple displays at the same time"] +) diff --git a/WeakAurasOptions/RegionOptions/Icon.lua b/WeakAurasOptions/RegionOptions/Icon.lua index b57196140e..bc25b68b07 100644 --- a/WeakAurasOptions/RegionOptions/Icon.lua +++ b/WeakAurasOptions/RegionOptions/Icon.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... local Masque = LibStub("Masque", true) @@ -6,7 +8,7 @@ local L = WeakAuras.L local function createOptions(id, data) local hiddenIconExtra = function() - return OptionsPrivate.IsCollapsed("icon", "icon", "iconextra", true); + return OptionsPrivate.IsCollapsed("icon", "icon", "iconextra", true) end local indentWidth = 0.15 @@ -18,7 +20,7 @@ local function createOptions(id, data) width = WeakAuras.normalWidth, name = L["Color"], hasAlpha = true, - order = 1 + order = 1, }, desaturate = { type = "toggle", @@ -31,7 +33,7 @@ local function createOptions(id, data) width = WeakAuras.normalWidth, name = L["Icon Source"], order = 3, - values = OptionsPrivate.Private.IconSources(data) + values = OptionsPrivate.Private.IconSources(data), }, displayIcon = { type = "input", @@ -39,13 +41,13 @@ local function createOptions(id, data) name = L["Fallback Icon"], order = 4, get = function() - return data.displayIcon and tostring(data.displayIcon) or ""; + return data.displayIcon and tostring(data.displayIcon) or "" end, set = function(info, v) - data.displayIcon = v; - WeakAuras.Add(data); - WeakAuras.UpdateThumbnail(data); - end + data.displayIcon = v + WeakAuras.Add(data) + WeakAuras.UpdateThumbnail(data) + end, }, chooseIcon = { type = "execute", @@ -53,7 +55,7 @@ local function createOptions(id, data) name = L["Choose"], order = 5, func = function() - local path = {"displayIcon"} + local path = { "displayIcon" } local paths = {} for child in OptionsPrivate.Private.TraverseLeafsOrAura(data) do paths[child.id] = path @@ -69,8 +71,10 @@ local function createOptions(id, data) type = "toggle", width = WeakAuras.normalWidth, name = L["Tooltip on Mouseover"], - hidden = function() return not OptionsPrivate.Private.CanHaveTooltip(data) end, - order = 6 + hidden = function() + return not OptionsPrivate.Private.CanHaveTooltip(data) + end, + order = 6, }, iconExtraDescription = { type = "execute", @@ -79,15 +83,15 @@ local function createOptions(id, data) local line = L["|cFFffcc00Extra Options:|r"] local changed = false if data.alpha ~= 1 then - line = L["%s Alpha: %d%%"]:format(line, data.alpha*100) + line = L["%s Alpha: %d%%"]:format(line, data.alpha * 100) changed = true end if data.zoom ~= 0 then - line = L["%s Zoom: %d%%"]:format(line, data.zoom*100) + line = L["%s Zoom: %d%%"]:format(line, data.zoom * 100) changed = true end if data.iconInset and data.iconInset ~= 0 then - line = L["%s Inset: %d%%"]:format(line, data.iconInset*100) + line = L["%s Inset: %d%%"]:format(line, data.iconInset * 100) changed = true end if data.keepAspectRatio then @@ -102,18 +106,18 @@ local function createOptions(id, data) width = WeakAuras.doubleWidth, order = 7, image = function() - local collapsed = OptionsPrivate.IsCollapsed("icon", "icon", "iconextra", true); + local collapsed = OptionsPrivate.IsCollapsed("icon", "icon", "iconextra", true) return collapsed and "collapsed" or "expanded" end, imageWidth = 15, imageHeight = 15, func = function(info, button) - local collapsed = OptionsPrivate.IsCollapsed("icon", "icon", "iconextra", true); - OptionsPrivate.SetCollapsed("icon", "icon", "iconextra", not collapsed); + local collapsed = OptionsPrivate.IsCollapsed("icon", "icon", "iconextra", true) + OptionsPrivate.SetCollapsed("icon", "icon", "iconextra", not collapsed) end, arg = { - expanderName = "icon" - } + expanderName = "icon", + }, }, iconExtra_space1 = { type = "description", @@ -161,8 +165,8 @@ local function createOptions(id, data) bigStep = 0.01, isPercent = true, hidden = function() - return not Masque or hiddenIconExtra(); - end + return not Masque or hiddenIconExtra() + end, }, keepAspectRatio = { type = "toggle", @@ -178,8 +182,8 @@ local function createOptions(id, data) hidden = hiddenIconExtra, control = "WeakAurasExpandAnchor", arg = { - expanderName = "icon" - } + expanderName = "icon", + }, }, cooldownHeader = { type = "header", @@ -192,8 +196,12 @@ local function createOptions(id, data) name = L["Enable Swipe"], order = 11.1, desc = L["Enable the \"Swipe\" radial overlay"], - disabled = function() return not OptionsPrivate.Private.CanHaveDuration(data); end, - get = function() return OptionsPrivate.Private.CanHaveDuration(data) and data.cooldown; end + disabled = function() + return not OptionsPrivate.Private.CanHaveDuration(data) + end, + get = function() + return OptionsPrivate.Private.CanHaveDuration(data) and data.cooldown + end, }, inverse = { type = "toggle", @@ -201,27 +209,41 @@ local function createOptions(id, data) name = L["Inverse"], order = 11.2, desc = L["Invert the direction of progress"], - disabled = function() return not (OptionsPrivate.Private.CanHaveDuration(data) and data.cooldown); end, - get = function() return data.inverse and OptionsPrivate.Private.CanHaveDuration(data) and data.cooldown; end, - hidden = function() return not data.cooldown end + disabled = function() + return not (OptionsPrivate.Private.CanHaveDuration(data) and data.cooldown) + end, + get = function() + return data.inverse and OptionsPrivate.Private.CanHaveDuration(data) and data.cooldown + end, + hidden = function() + return not data.cooldown + end, }, cooldownSwipe = { type = "toggle", width = WeakAuras.normalWidth, name = L["Show \"Swipe\""], order = 11.3, - desc = "|TInterface\\AddOns\\WeakAuras\\Media\\Textures\\swipe-example:30|t\n"..L["Enable \"swipe\" part of the overlay"], - disabled = function() return not OptionsPrivate.Private.CanHaveDuration(data) end, - hidden = function() return not data.cooldown end, + desc = "|TInterface\\AddOns\\WeakAuras\\Media\\Textures\\swipe-example:30|t\n" .. L["Enable \"swipe\" part of the overlay"], + disabled = function() + return not OptionsPrivate.Private.CanHaveDuration(data) + end, + hidden = function() + return not data.cooldown + end, }, cooldownEdge = { type = "toggle", width = WeakAuras.normalWidth, name = L["Show \"Edge\""], order = 11.4, - desc = "|TInterface\\AddOns\\WeakAuras\\Media\\Textures\\edge-example:30|t\n"..L["Enable \"Edge\" part of the overlay"], - disabled = function() return not OptionsPrivate.Private.CanHaveDuration(data) end, - hidden = function() return not data.cooldown end, + desc = "|TInterface\\AddOns\\WeakAuras\\Media\\Textures\\edge-example:30|t\n" .. L["Enable \"Edge\" part of the overlay"], + disabled = function() + return not OptionsPrivate.Private.CanHaveDuration(data) + end, + hidden = function() + return not data.cooldown + end, }, cooldownTextDisabled = { type = "toggle", @@ -229,8 +251,12 @@ local function createOptions(id, data) name = L["Hide Timer Text"], order = 11.5, desc = L["A timer will automatically be displayed according to default Interface Settings (overridden by some addons).\nEnable this setting if you want this timer to be hidden, or when using a WeakAuras text to display the timer"], - disabled = function() return not OptionsPrivate.Private.CanHaveDuration(data); end, - hidden = function() return not data.cooldown end, + disabled = function() + return not OptionsPrivate.Private.CanHaveDuration(data) + end, + hidden = function() + return not data.cooldown + end, }, useCooldownModRate = { type = "toggle", @@ -238,34 +264,38 @@ local function createOptions(id, data) name = L["Blizzard Cooldown Reduction"], order = 11.6, desc = L["Cooldown Reduction changes the duration of seconds instead of showing the real time seconds."], - disabled = function() return not OptionsPrivate.Private.CanHaveDuration(data); end, - hidden = function() return not data.cooldown end, + disabled = function() + return not OptionsPrivate.Private.CanHaveDuration(data) + end, + hidden = function() + return not data.cooldown + end, }, endHeader = { type = "header", order = 100, name = "", }, - }; + } return { icon = options, position = OptionsPrivate.commonOptions.PositionOptions(id, data), - }; + } end local function createThumbnail() local frame = CreateFrame("Frame", nil, UIParent) - local icon = frame:CreateTexture(); - icon:SetTexture("Interface\\Icons\\INV_Misc_QuestionMark"); + local icon = frame:CreateTexture() + icon:SetTexture("Interface\\Icons\\INV_Misc_QuestionMark") icon:SetAllPoints(frame) frame.icon = icon - return frame; + return frame end local function modifyThumbnail(parent, frame, data) - local texWidth = 0.25 * data.zoom; - frame.icon:SetTexCoord(texWidth, 1 - texWidth, texWidth, 1 - texWidth); + local texWidth = 0.25 * data.zoom + frame.icon:SetTexCoord(texWidth, 1 - texWidth, texWidth, 1 - texWidth) frame:SetParent(parent) function frame:SetIcon(path) @@ -283,7 +313,7 @@ local function modifyThumbnail(parent, frame, data) end if data then - local name, icon = WeakAuras.GetNameAndIcon(data); + local name, icon = WeakAuras.GetNameAndIcon(data) frame:SetIcon(icon) end end @@ -295,7 +325,7 @@ local templates = { data = { cooldown = true, inverse = true, - }; + }, }, { title = L["Tiny Icon"], @@ -306,7 +336,7 @@ local templates = { height = 20, cooldown = true, inverse = true, - }; + }, }, { title = L["Small Icon"], @@ -317,7 +347,7 @@ local templates = { height = 32, cooldown = true, inverse = true, - }; + }, }, { title = L["Medium Icon"], @@ -328,7 +358,7 @@ local templates = { height = 40, cooldown = true, inverse = true, - }; + }, }, { title = L["Big Icon"], @@ -339,7 +369,7 @@ local templates = { height = 48, cooldown = true, inverse = true, - }; + }, }, { title = L["Huge Icon"], @@ -350,119 +380,129 @@ local templates = { height = 64, cooldown = true, inverse = true, - }; - } + }, + }, } local anchorPoints = { BOTTOMLEFT = { display = { L["Edge"], L["Bottom Left"] }, - type = "point" + type = "point", }, BOTTOM = { display = { L["Edge"], L["Bottom"] }, - type = "point" + type = "point", }, BOTTOMRIGHT = { display = { L["Edge"], L["Bottom Right"] }, - type = "point" + type = "point", }, RIGHT = { display = { L["Edge"], L["Right"] }, - type = "point" + type = "point", }, TOPRIGHT = { display = { L["Edge"], L["Top Right"] }, - type = "point" + type = "point", }, TOP = { display = { L["Edge"], L["Top"] }, - type = "point" + type = "point", }, TOPLEFT = { display = { L["Edge"], L["Top Left"] }, - type = "point" + type = "point", }, LEFT = { display = { L["Edge"], L["Left"] }, - type = "point" + type = "point", }, CENTER = { display = L["Center"], - type = "point" + type = "point", }, INNER_BOTTOMLEFT = { display = { L["Inner"], L["Bottom Left"] }, - type = "point" + type = "point", }, INNER_BOTTOM = { display = { L["Inner"], L["Bottom"] }, - type = "point" + type = "point", }, INNER_BOTTOMRIGHT = { display = { L["Inner"], L["Bottom Right"] }, - type = "point" + type = "point", }, INNER_RIGHT = { display = { L["Inner"], L["Right"] }, - type = "point" + type = "point", }, INNER_TOPRIGHT = { display = { L["Inner"], L["Top Right"] }, - type = "point" + type = "point", }, INNER_TOP = { display = { L["Inner"], L["Top"] }, - type = "point" + type = "point", }, INNER_TOPLEFT = { display = { L["Inner"], L["Top Left"] }, - type = "point" + type = "point", }, INNER_LEFT = { display = { L["Inner"], L["Left"] }, - type = "point" + type = "point", }, OUTER_BOTTOMLEFT = { display = { L["Outer"], L["Bottom Left"] }, - type = "point" + type = "point", }, OUTER_BOTTOM = { display = { L["Outer"], L["Bottom"] }, - type = "point" + type = "point", }, OUTER_BOTTOMRIGHT = { display = { L["Outer"], L["Bottom Right"] }, - type = "point" + type = "point", }, OUTER_RIGHT = { display = { L["Outer"], L["Right"] }, - type = "point" + type = "point", }, OUTER_TOPRIGHT = { display = { L["Outer"], L["Top Right"] }, - type = "point" + type = "point", }, OUTER_TOP = { display = { L["Outer"], L["Top"] }, - type = "point" + type = "point", }, OUTER_TOPLEFT = { display = { L["Outer"], L["Top Left"] }, - type = "point" + type = "point", }, OUTER_LEFT = { display = { L["Outer"], L["Left"] }, - type = "point" + type = "point", }, ALL = { display = L["Whole Area"], - type = "area" - } + type = "area", + }, } local function GetAnchors(data) - return anchorPoints; + return anchorPoints end -WeakAuras.RegisterRegionOptions("icon", createOptions, "interface\\icons\\spell_holy_sealofsalvation.blp", L["Icon"], createThumbnail, modifyThumbnail, L["Shows a spell icon with an optional cooldown overlay"], templates, GetAnchors); +WeakAuras.RegisterRegionOptions( + "icon", + createOptions, + "interface\\icons\\spell_holy_sealofsalvation.blp", + L["Icon"], + createThumbnail, + modifyThumbnail, + L["Shows a spell icon with an optional cooldown overlay"], + templates, + GetAnchors +) diff --git a/WeakAurasOptions/RegionOptions/Model.lua b/WeakAurasOptions/RegionOptions/Model.lua index 8755ab6adb..55d3f35354 100644 --- a/WeakAurasOptions/RegionOptions/Model.lua +++ b/WeakAurasOptions/RegionOptions/Model.lua @@ -1,7 +1,9 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... -local L = WeakAuras.L; +local L = WeakAuras.L local function createOptions(id, data) local options = { @@ -12,7 +14,9 @@ local function createOptions(id, data) width = WeakAuras.normalWidth, name = L["Show model of unit "], order = 0.5, - hidden = function() return data.modelDisplayInfo and WeakAuras.BuildInfo > 80100 end + hidden = function() + return data.modelDisplayInfo and WeakAuras.BuildInfo > 80100 + end, }, -- Option for modelIsDisplayInfo added below @@ -23,9 +27,11 @@ local function createOptions(id, data) name = L["Choose"], order = 2, func = function() - OptionsPrivate.OpenModelPicker(data, {}); + OptionsPrivate.OpenModelPicker(data, {}) + end, + disabled = function() + return data.modelIsUnit or (WeakAuras.BuildInfo > 80100 and data.modelDisplayInfo) end, - disabled = function() return data.modelIsUnit or (WeakAuras.BuildInfo > 80100 and data.modelDisplayInfo) end, imageWidth = 24, imageHeight = 24, control = "WeakAurasIcon", @@ -46,13 +52,15 @@ local function createOptions(id, data) step = 1, bigStep = 1, order = 6, - disabled = function() return not data.advance end + disabled = function() + return not data.advance + end, }, api = { type = "toggle", name = L["Use SetTransform"], order = 7, - width = WeakAuras.normalWidth + width = WeakAuras.normalWidth, }, portraitZoom = { type = "toggle", @@ -67,10 +75,12 @@ local function createOptions(id, data) name = L["Z Offset"], softMin = -20, softMax = 20, - step = .001, + step = 0.001, bigStep = 0.05, order = 20, - hidden = function() return data.api end + hidden = function() + return data.api + end, }, model_x = { type = "range", @@ -78,10 +88,12 @@ local function createOptions(id, data) name = L["X Offset"], softMin = -20, softMax = 20, - step = .001, + step = 0.001, bigStep = 0.05, order = 30, - hidden = function() return data.api end + hidden = function() + return data.api + end, }, model_y = { type = "range", @@ -89,10 +101,12 @@ local function createOptions(id, data) name = L["Y Offset"], softMin = -20, softMax = 20, - step = .001, + step = 0.001, bigStep = 0.05, order = 40, - hidden = function() return data.api end + hidden = function() + return data.api + end, }, rotation = { type = "range", @@ -103,7 +117,9 @@ local function createOptions(id, data) step = 1, bigStep = 3, order = 45, - hidden = function() return data.api end + hidden = function() + return data.api + end, }, -- New Settings model_st_tx = { @@ -115,7 +131,9 @@ local function createOptions(id, data) step = 1, bigStep = 5, order = 20, - hidden = function() return not data.api end + hidden = function() + return not data.api + end, }, model_st_ty = { type = "range", @@ -126,7 +144,9 @@ local function createOptions(id, data) step = 1, bigStep = 5, order = 21, - hidden = function() return not data.api end + hidden = function() + return not data.api + end, }, model_st_tz = { type = "range", @@ -137,7 +157,9 @@ local function createOptions(id, data) step = 1, bigStep = 5, order = 22, - hidden = function() return not data.api end + hidden = function() + return not data.api + end, }, model_st_rx = { type = "range", @@ -148,7 +170,9 @@ local function createOptions(id, data) step = 1, bigStep = 3, order = 23, - hidden = function() return not data.api end + hidden = function() + return not data.api + end, }, model_st_ry = { type = "range", @@ -159,7 +183,9 @@ local function createOptions(id, data) step = 1, bigStep = 3, order = 24, - hidden = function() return not data.api end + hidden = function() + return not data.api + end, }, model_st_rz = { type = "range", @@ -170,7 +196,9 @@ local function createOptions(id, data) step = 1, bigStep = 3, order = 25, - hidden = function() return not data.api end + hidden = function() + return not data.api + end, }, model_st_us = { type = "range", @@ -181,14 +209,16 @@ local function createOptions(id, data) step = 0.1, bigStep = 5, order = 26, - hidden = function() return not data.api end + hidden = function() + return not data.api + end, }, endHeader = { type = "header", order = 100, name = "", }, - }; + } if WeakAuras.BuildInfo > 80100 then options.modelDisplayInfo = { @@ -196,20 +226,22 @@ local function createOptions(id, data) width = WeakAuras.normalWidth, name = L["Use Display Info Id"], order = 0.6, - hidden = function() return data.modelIsUnit end + hidden = function() + return data.modelIsUnit + end, } options.model_fileId = { type = "input", width = WeakAuras.doubleWidth - 0.15, name = L["Model"], - order = 1 + order = 1, } else options.model_path = { type = "input", width = WeakAuras.doubleWidth - 0.15, name = L["Model"], - order = 1 + order = 1, } end @@ -220,24 +252,24 @@ local function createOptions(id, data) return { model = options, position = OptionsPrivate.commonOptions.PositionOptions(id, data, nil, nil, nil), - }; + } end local function createThumbnail() - local borderframe = CreateFrame("Frame", nil, UIParent); - borderframe:SetWidth(32); - borderframe:SetHeight(32); + local borderframe = CreateFrame("Frame", nil, UIParent) + borderframe:SetWidth(32) + borderframe:SetHeight(32) - local border = borderframe:CreateTexture(nil, "Overlay"); - border:SetAllPoints(borderframe); - border:SetTexture("Interface\\BUTTONS\\UI-Quickslot2.blp"); - border:SetTexCoord(0.2, 0.8, 0.2, 0.8); + local border = borderframe:CreateTexture(nil, "Overlay") + border:SetAllPoints(borderframe) + border:SetTexture("Interface\\BUTTONS\\UI-Quickslot2.blp") + border:SetTexCoord(0.2, 0.8, 0.2, 0.8) - local model = CreateFrame("PlayerModel", nil, borderframe); - borderframe.model = model; - model:SetFrameStrata("FULLSCREEN"); + local model = CreateFrame("PlayerModel", nil, borderframe) + borderframe.model = model + model:SetFrameStrata("FULLSCREEN") - return borderframe; + return borderframe end local function modifyThumbnail(parent, region, data) @@ -245,33 +277,45 @@ local function modifyThumbnail(parent, region, data) local model = region.model - model:SetAllPoints(region); - model:SetFrameStrata(region:GetParent():GetFrameStrata()); - model:SetWidth(region:GetWidth() - 2); - model:SetHeight(region:GetHeight() - 2); - model:SetPoint("center", region, "center"); + model:SetAllPoints(region) + model:SetFrameStrata(region:GetParent():GetFrameStrata()) + model:SetWidth(region:GetWidth() - 2) + model:SetHeight(region:GetHeight() - 2) + model:SetPoint("center", region, "center") WeakAuras.SetModel(model, data.model_path, data.model_fileId, data.modelIsUnit, data.modelDisplayInfo) model:SetScript("OnShow", function() WeakAuras.SetModel(model, data.model_path, data.model_fileId, data.modelIsUnit, data.modelDisplayInfo) model:SetPortraitZoom(data.portraitZoom and 1 or 0) - if (data.api) then - model:SetTransform(data.model_st_tx / 1000, data.model_st_ty / 1000, data.model_st_tz / 1000, - rad(data.model_st_rx), rad(data.model_st_ry), rad(data.model_st_rz), - data.model_st_us / 1000); + if data.api then + model:SetTransform( + data.model_st_tx / 1000, + data.model_st_ty / 1000, + data.model_st_tz / 1000, + rad(data.model_st_rx), + rad(data.model_st_ry), + rad(data.model_st_rz), + data.model_st_us / 1000 + ) else - model:ClearTransform(); - model:SetPosition(data.model_z, data.model_x, data.model_y); - model:SetFacing(rad(data.rotation)); + model:ClearTransform() + model:SetPosition(data.model_z, data.model_x, data.model_y) + model:SetFacing(rad(data.rotation)) end - end); + end) - if (data.api) then - model:SetTransform(data.model_st_tx / 1000, data.model_st_ty / 1000, data.model_st_tz / 1000, - rad(data.model_st_rx), rad(data.model_st_ry), rad(data.model_st_rz), - data.model_st_us / 1000); + if data.api then + model:SetTransform( + data.model_st_tx / 1000, + data.model_st_ty / 1000, + data.model_st_tz / 1000, + rad(data.model_st_rx), + rad(data.model_st_ry), + rad(data.model_st_rz), + data.model_st_us / 1000 + ) else - model:SetPosition(data.model_z, data.model_x, data.model_y); - model:SetFacing(rad(data.rotation)); + model:SetPosition(data.model_z, data.model_x, data.model_y) + model:SetFacing(rad(data.rotation)) end end @@ -288,21 +332,20 @@ local function createIcon() rotation = 0, scale = 1, height = 40, - width = 40 - }; + width = 40, + } - local thumbnail = createThumbnail(); - modifyThumbnail(UIParent, thumbnail, data); + local thumbnail = createThumbnail() + modifyThumbnail(UIParent, thumbnail, data) - return thumbnail; + return thumbnail end local templates = { { title = L["Default"], - data = { - }; - } + data = {}, + }, } if WeakAuras.IsRetail() then @@ -316,7 +359,7 @@ if WeakAuras.IsRetail() then model_fileId = "937416", -- spells/6fx_smallfire.m2 model_x = 0, model_y = -0.5, - model_z = -1.5 + model_z = -1.5, }, }) tinsert(templates, { @@ -331,7 +374,7 @@ if WeakAuras.IsRetail() then model_fileId = "1322288", -- spells/7fx_druid_halfmoon_missile.m2 model_x = 0, model_y = 0.7, - model_z = 1.5 + model_z = 1.5, }, }) tinsert(templates, { @@ -346,7 +389,7 @@ if WeakAuras.IsRetail() then model_fileId = "1042743", -- spells/proc_arcane_impact_low.m2 model_x = 0, model_y = 0.8, - model_z = 2 + model_z = 2, }, }) tinsert(templates, { @@ -371,7 +414,7 @@ if WeakAuras.IsRetail() then sequence = 1, model_path = "spells/7fx_godking_bluerune_state.m2", model_fileId = "1307354", -- spells/7fx_godking_bluerune_state.m2 - } + }, }) tinsert(templates, { title = L["Yellow Rune"], @@ -383,7 +426,7 @@ if WeakAuras.IsRetail() then sequence = 1, model_path = "spells/7fx_godking_yellowrune_state.m2", model_fileId = "1307358", -- spells/7fx_godking_yellowrune_state.m2 - } + }, }) tinsert(templates, { title = L["Purple Rune"], @@ -395,7 +438,7 @@ if WeakAuras.IsRetail() then sequence = 1, model_path = "spells/7fx_godking_purplerune_state.m2", model_fileId = "1307355", -- spells/7fx_godking_purplerune_state.m2 - } + }, }) tinsert(templates, { title = L["Green Rune"], @@ -407,8 +450,8 @@ if WeakAuras.IsRetail() then sequence = 1, model_path = "spells/7fx_godking_greenrune_state.m2", model_fileId = "1307357", -- spells/7fx_godking_greenrune_state.m2 - } + }, }) end -WeakAuras.RegisterRegionOptions("model", createOptions, createIcon, L["Model"], createThumbnail, modifyThumbnail, L["Shows a 3D model from the game files"], templates); +WeakAuras.RegisterRegionOptions("model", createOptions, createIcon, L["Model"], createThumbnail, modifyThumbnail, L["Shows a 3D model from the game files"], templates) diff --git a/WeakAurasOptions/RegionOptions/ProgressTexture.lua b/WeakAurasOptions/RegionOptions/ProgressTexture.lua index f7df5a04b2..1e0c55195b 100644 --- a/WeakAurasOptions/RegionOptions/ProgressTexture.lua +++ b/WeakAurasOptions/RegionOptions/ProgressTexture.lua @@ -1,7 +1,9 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... -local L = WeakAuras.L; +local L = WeakAuras.L local GetAtlasInfo = WeakAuras.IsClassic() and GetAtlasInfo or C_Texture.GetAtlasInfo local function createOptions(id, data) local options = { @@ -11,7 +13,7 @@ local function createOptions(id, data) width = WeakAuras.normalWidth - 0.15, type = "input", name = L["Foreground Texture"], - order = 1 + order = 1, }, chooseForegroundTexture = { type = "execute", @@ -24,8 +26,8 @@ local function createOptions(id, data) color = "foregroundColor", rotation = "rotation", mirror = "mirror", - blendMode = "blendMode" - }, OptionsPrivate.Private.texture_types); + blendMode = "blendMode", + }, OptionsPrivate.Private.texture_types) end, imageWidth = 24, imageHeight = 24, @@ -37,8 +39,12 @@ local function createOptions(id, data) width = WeakAuras.normalWidth - 0.15, name = L["Background Texture"], order = 5, - disabled = function() return data.sameTexture; end, - get = function() return data.sameTexture and data.foregroundTexture or data.backgroundTexture; end + disabled = function() + return data.sameTexture + end, + get = function() + return data.sameTexture and data.foregroundTexture or data.backgroundTexture + end, }, chooseBackgroundTexture = { type = "execute", @@ -51,10 +57,12 @@ local function createOptions(id, data) color = "backgroundColor", rotation = "rotation", mirror = "mirror", - blendMode = "blendMode" - }, OptionsPrivate.Private.texture_types); + blendMode = "blendMode", + }, OptionsPrivate.Private.texture_types) + end, + disabled = function() + return data.sameTexture end, - disabled = function() return data.sameTexture; end, imageWidth = 24, imageHeight = 24, control = "WeakAurasIcon", @@ -65,13 +73,15 @@ local function createOptions(id, data) width = WeakAuras.normalWidth, name = L["Mirror"], order = 10, - disabled = function() return data.orientation == "CLOCKWISE" or data.orientation == "ANTICLOCKWISE"; end + disabled = function() + return data.orientation == "CLOCKWISE" or data.orientation == "ANTICLOCKWISE" + end, }, sameTexture = { type = "toggle", name = L["Same"], width = WeakAuras.normalWidth, - order = 15 + order = 15, }, desaturateForeground = { type = "toggle", @@ -90,7 +100,7 @@ local function createOptions(id, data) width = WeakAuras.normalWidth, name = L["Blend Mode"], order = 20, - values = OptionsPrivate.Private.blend_types + values = OptionsPrivate.Private.blend_types, }, backgroundOffset = { type = "range", @@ -99,41 +109,43 @@ local function createOptions(id, data) min = 0, softMax = 25, bigStep = 1, - order = 25 + order = 25, }, orientation = { type = "select", width = WeakAuras.normalWidth, name = L["Orientation"], order = 35, - values = OptionsPrivate.Private.orientation_with_circle_types + values = OptionsPrivate.Private.orientation_with_circle_types, }, compress = { type = "toggle", width = WeakAuras.halfWidth, name = L["Compress"], order = 40, - disabled = function() return data.orientation == "CLOCKWISE" or data.orientation == "ANTICLOCKWISE"; end + disabled = function() + return data.orientation == "CLOCKWISE" or data.orientation == "ANTICLOCKWISE" + end, }, inverse = { type = "toggle", width = WeakAuras.halfWidth, name = L["Inverse"], - order = 41 + order = 41, }, foregroundColor = { type = "color", width = WeakAuras.normalWidth, name = L["Foreground Color"], hasAlpha = true, - order = 30 + order = 30, }, backgroundColor = { type = "color", width = WeakAuras.normalWidth, name = L["Background Color"], hasAlpha = true, - order = 37 + order = 37, }, user_x = { type = "range", @@ -143,7 +155,9 @@ local function createOptions(id, data) min = -0.5, max = 0.5, bigStep = 0.01, - hidden = function() return data.orientation == "CLOCKWISE" or data.orientation == "ANTICLOCKWISE"; end + hidden = function() + return data.orientation == "CLOCKWISE" or data.orientation == "ANTICLOCKWISE" + end, }, user_y = { type = "range", @@ -153,7 +167,9 @@ local function createOptions(id, data) min = -0.5, max = 0.5, bigStep = 0.01, - hidden = function() return data.orientation == "CLOCKWISE" or data.orientation == "ANTICLOCKWISE"; end + hidden = function() + return data.orientation == "CLOCKWISE" or data.orientation == "ANTICLOCKWISE" + end, }, startAngle = { type = "range", @@ -163,7 +179,9 @@ local function createOptions(id, data) min = 0, max = 360, bigStep = 1, - hidden = function() return data.orientation ~= "CLOCKWISE" and data.orientation ~= "ANTICLOCKWISE"; end + hidden = function() + return data.orientation ~= "CLOCKWISE" and data.orientation ~= "ANTICLOCKWISE" + end, }, endAngle = { type = "range", @@ -173,7 +191,9 @@ local function createOptions(id, data) min = 0, max = 360, bigStep = 1, - hidden = function() return data.orientation ~= "CLOCKWISE" and data.orientation ~= "ANTICLOCKWISE"; end + hidden = function() + return data.orientation ~= "CLOCKWISE" and data.orientation ~= "ANTICLOCKWISE" + end, }, crop_x = { type = "range", @@ -185,11 +205,11 @@ local function createOptions(id, data) bigStep = 0.01, isPercent = true, set = function(info, v) - data.width = data.width * ((1 + data.crop_x) / (1 + v)); - data.crop_x = v; - WeakAuras.Add(data); - WeakAuras.UpdateThumbnail(data); - OptionsPrivate.ResetMoverSizer(); + data.width = data.width * ((1 + data.crop_x) / (1 + v)) + data.crop_x = v + WeakAuras.Add(data) + WeakAuras.UpdateThumbnail(data) + OptionsPrivate.ResetMoverSizer() end, }, crop_y = { @@ -202,11 +222,11 @@ local function createOptions(id, data) bigStep = 0.01, isPercent = true, set = function(info, v) - data.height = data.height * ((1 + data.crop_y) / (1 + v)); - data.crop_y = v; - WeakAuras.Add(data); - WeakAuras.UpdateThumbnail(data); - OptionsPrivate.ResetMoverSizer(); + data.height = data.height * ((1 + data.crop_y) / (1 + v)) + data.crop_y = v + WeakAuras.Add(data) + WeakAuras.UpdateThumbnail(data) + OptionsPrivate.ResetMoverSizer() end, }, rotation = { @@ -216,7 +236,7 @@ local function createOptions(id, data) order = 52, min = 0, max = 360, - bigStep = 1 + bigStep = 1, }, alpha = { type = "range", @@ -226,28 +246,30 @@ local function createOptions(id, data) min = 0, max = 1, bigStep = 0.01, - isPercent = true + isPercent = true, }, smoothProgress = { type = "toggle", width = WeakAuras.normalWidth, name = L["Smooth Progress"], desc = L["Animates progress changes"], - order = 55.1 + order = 55.1, }, textureWrapMode = { type = "select", width = WeakAuras.normalWidth, name = L["Texture Wrap"], order = 55.2, - values = OptionsPrivate.Private.texture_wrap_types + values = OptionsPrivate.Private.texture_wrap_types, }, slanted = { type = "toggle", width = WeakAuras.normalWidth, name = L["Slanted"], order = 55.3, - hidden = function() return data.orientation == "CLOCKWISE" or data.orientation == "ANTICLOCKWISE"; end + hidden = function() + return data.orientation == "CLOCKWISE" or data.orientation == "ANTICLOCKWISE" + end, }, slant = { type = "range", @@ -257,42 +279,48 @@ local function createOptions(id, data) min = 0, max = 1, bigStep = 0.1, - hidden = function() return not data.slanted or data.orientation == "CLOCKWISE" or data.orientation == "ANTICLOCKWISE" end + hidden = function() + return not data.slanted or data.orientation == "CLOCKWISE" or data.orientation == "ANTICLOCKWISE" + end, }, slantFirst = { type = "toggle", width = WeakAuras.normalWidth, name = L["Inverse Slant"], order = 55.5, - hidden = function() return not data.slanted or data.orientation == "CLOCKWISE" or data.orientation == "ANTICLOCKWISE" end + hidden = function() + return not data.slanted or data.orientation == "CLOCKWISE" or data.orientation == "ANTICLOCKWISE" + end, }, slantMode = { type = "select", width = WeakAuras.normalWidth, name = L["Slant Mode"], order = 55.6, - hidden = function() return not data.slanted or data.orientation == "CLOCKWISE" or data.orientation == "ANTICLOCKWISE" end, - values = OptionsPrivate.Private.slant_mode + hidden = function() + return not data.slanted or data.orientation == "CLOCKWISE" or data.orientation == "ANTICLOCKWISE" + end, + values = OptionsPrivate.Private.slant_mode, }, spacer = { type = "header", name = "", - order = 56 + order = 56, }, endHeader = { type = "header", order = 100, name = "", }, - }; - options = WeakAuras.regionPrototype.AddAdjustedDurationOptions(options, data, 57); + } + options = WeakAuras.regionPrototype.AddAdjustedDurationOptions(options, data, 57) - local overlayInfo = OptionsPrivate.Private.GetOverlayInfo(data); - if (overlayInfo and next(overlayInfo)) then + local overlayInfo = OptionsPrivate.Private.GetOverlayInfo(data) + if overlayInfo and next(overlayInfo) then options["overlayheader"] = { type = "header", name = L["Overlays"], - order = 58 + order = 58, } local index = 58.01 for id, display in ipairs(overlayInfo) do @@ -303,18 +331,18 @@ local function createOptions(id, data) hasAlpha = true, order = index, get = function() - if (data.overlays and data.overlays[id]) then - return unpack(data.overlays[id]); + if data.overlays and data.overlays[id] then + return unpack(data.overlays[id]) end - return 1, 1, 1, 1; + return 1, 1, 1, 1 end, set = function(info, r, g, b, a) - if (not data.overlays) then - data.overlays = {}; + if not data.overlays then + data.overlays = {} end - data.overlays[id] = { r, g, b, a}; - WeakAuras.Add(data); - end + data.overlays[id] = { r, g, b, a } + WeakAuras.Add(data) + end, } index = index + 0.01 end @@ -323,14 +351,14 @@ local function createOptions(id, data) type = "toggle", width = WeakAuras.normalWidth, name = L["Clip Overlays"], - order = index + order = index, } end return { progresstexture = options, position = OptionsPrivate.commonOptions.PositionOptions(id, data), - }; + } end -- Credit to CommanderSirow for taking the time to properly craft the ApplyTransform function @@ -349,7 +377,6 @@ end -- region.scale (1.0) - user defined scaling [1, INF] -- region.full_rotation (false) - Allow full rotation [bool] - local function ApplyTransform(x, y, region) -- 1) Translate texture-coords to user-defined center x = x - 0.5 @@ -398,329 +425,327 @@ local function Transform(tx, x, y, angle, aspect) -- Translates texture to x, y end local function createThumbnail() - local borderframe = CreateFrame("Frame", nil, UIParent); - borderframe:SetWidth(32); - borderframe:SetHeight(32); + local borderframe = CreateFrame("Frame", nil, UIParent) + borderframe:SetWidth(32) + borderframe:SetHeight(32) - local border = borderframe:CreateTexture(nil, "OVERLAY"); - border:SetAllPoints(borderframe); - border:SetTexture("Interface\\BUTTONS\\UI-Quickslot2.blp"); - border:SetTexCoord(0.2, 0.8, 0.2, 0.8); + local border = borderframe:CreateTexture(nil, "OVERLAY") + border:SetAllPoints(borderframe) + border:SetTexture("Interface\\BUTTONS\\UI-Quickslot2.blp") + border:SetTexCoord(0.2, 0.8, 0.2, 0.8) - local region = CreateFrame("Frame", nil, borderframe); - borderframe.region = region; - region:SetWidth(32); - region:SetHeight(32); + local region = CreateFrame("Frame", nil, borderframe) + borderframe.region = region + region:SetWidth(32) + region:SetHeight(32) - local background = region:CreateTexture(nil, "BACKGROUND"); - borderframe.background = background; + local background = region:CreateTexture(nil, "BACKGROUND") + borderframe.background = background - local foreground = region:CreateTexture(nil, "ARTWORK"); - borderframe.foreground = foreground; + local foreground = region:CreateTexture(nil, "ARTWORK") + borderframe.foreground = foreground - local OrgSetTexture = foreground.SetTexture; + local OrgSetTexture = foreground.SetTexture -- WORKAROUND, setting the same texture with a different wrap mode does not change the wrap mode foreground.SetTexture = function(self, texture, horWrapMode, verWrapMode) - if (GetAtlasInfo(texture)) then - self:SetAtlas(texture); + if GetAtlasInfo(texture) then + self:SetAtlas(texture) else - local needToClear = (self.horWrapMode and self.horWrapMode ~= horWrapMode) or (self.verWrapMode and self.verWrapMode ~= verWrapMode); - self.horWrapMode = horWrapMode; - self.verWrapMode = verWrapMode; - if (needToClear) then - OrgSetTexture(self, nil); + local needToClear = (self.horWrapMode and self.horWrapMode ~= horWrapMode) or (self.verWrapMode and self.verWrapMode ~= verWrapMode) + self.horWrapMode = horWrapMode + self.verWrapMode = verWrapMode + if needToClear then + OrgSetTexture(self, nil) end - OrgSetTexture(self, texture, horWrapMode, verWrapMode); + OrgSetTexture(self, texture, horWrapMode, verWrapMode) end end - background.SetTexture = foreground.SetTexture; + background.SetTexture = foreground.SetTexture - borderframe.backgroundSpinner = WeakAuras.createSpinner(region, "BACKGROUND", 1); - borderframe.foregroundSpinner = WeakAuras.createSpinner(region, "ARTWORK", 1); + borderframe.backgroundSpinner = WeakAuras.createSpinner(region, "BACKGROUND", 1) + borderframe.foregroundSpinner = WeakAuras.createSpinner(region, "ARTWORK", 1) - return borderframe; + return borderframe end local function modifyThumbnail(parent, borderframe, data, fullModify, size) - local region, background, foreground = borderframe.region, borderframe.background, borderframe.foreground; - local foregroundSpinner, backgroundSpinner = borderframe.foregroundSpinner, borderframe.backgroundSpinner; - - size = size or 30; - local scale; - if(data.height > data.width) then - scale = size/data.height; - region:SetWidth(scale * data.width); - region:SetHeight(size); - foreground:SetWidth(scale * data.width); - foreground:SetHeight(size); - foregroundSpinner:SetWidth(scale * data.width); - foregroundSpinner:SetHeight(size); + local region, background, foreground = borderframe.region, borderframe.background, borderframe.foreground + local foregroundSpinner, backgroundSpinner = borderframe.foregroundSpinner, borderframe.backgroundSpinner + + size = size or 30 + local scale + if data.height > data.width then + scale = size / data.height + region:SetWidth(scale * data.width) + region:SetHeight(size) + foreground:SetWidth(scale * data.width) + foreground:SetHeight(size) + foregroundSpinner:SetWidth(scale * data.width) + foregroundSpinner:SetHeight(size) backgroundSpinner:SetWidth(scale * data.width) - backgroundSpinner:SetHeight(size); - region.width = scale * data.width; - region.height = size; + backgroundSpinner:SetHeight(size) + region.width = scale * data.width + region.height = size else - scale = size/data.width; - region:SetWidth(size); - region:SetHeight(scale * data.height); - foreground:SetWidth(size); - foreground:SetHeight(scale * data.height); - foregroundSpinner:SetWidth(size); - foregroundSpinner:SetHeight(scale * data.height); + scale = size / data.width + region:SetWidth(size) + region:SetHeight(scale * data.height) + foreground:SetWidth(size) + foreground:SetHeight(scale * data.height) + foregroundSpinner:SetWidth(size) + foregroundSpinner:SetHeight(scale * data.height) backgroundSpinner:SetWidth(size) - backgroundSpinner:SetHeight(scale * data.height); - region.width = size; - region.height = scale * data.height; + backgroundSpinner:SetHeight(scale * data.height) + region.width = size + region.height = scale * data.height end - region:ClearAllPoints(); - region:SetPoint("CENTER", borderframe, "CENTER"); + region:ClearAllPoints() + region:SetPoint("CENTER", borderframe, "CENTER") - background:SetTexture(data.sameTexture and data.foregroundTexture or data.backgroundTexture); + background:SetTexture(data.sameTexture and data.foregroundTexture or data.backgroundTexture) background:SetDesaturated(data.desaturateBackground) - background:SetVertexColor(data.backgroundColor[1], data.backgroundColor[2], data.backgroundColor[3], data.backgroundColor[4]); - background:SetBlendMode(data.blendMode); + background:SetVertexColor(data.backgroundColor[1], data.backgroundColor[2], data.backgroundColor[3], data.backgroundColor[4]) + background:SetBlendMode(data.blendMode) - backgroundSpinner:SetTextureOrAtlas(data.sameTexture and data.foregroundTexture or data.backgroundTexture); + backgroundSpinner:SetTextureOrAtlas(data.sameTexture and data.foregroundTexture or data.backgroundTexture) backgroundSpinner:SetDesaturated(data.desaturateBackground) - backgroundSpinner:Color(data.backgroundColor[1], data.backgroundColor[2], data.backgroundColor[3], data.backgroundColor[4]); - backgroundSpinner:SetBlendMode(data.blendMode); + backgroundSpinner:Color(data.backgroundColor[1], data.backgroundColor[2], data.backgroundColor[3], data.backgroundColor[4]) + backgroundSpinner:SetBlendMode(data.blendMode) - foreground:SetTexture(data.foregroundTexture); - foreground:SetVertexColor(data.foregroundColor[1], data.foregroundColor[2], data.foregroundColor[3], data.foregroundColor[4]); - foreground:SetBlendMode(data.blendMode); + foreground:SetTexture(data.foregroundTexture) + foreground:SetVertexColor(data.foregroundColor[1], data.foregroundColor[2], data.foregroundColor[3], data.foregroundColor[4]) + foreground:SetBlendMode(data.blendMode) - foregroundSpinner:SetTextureOrAtlas(data.foregroundTexture); - foregroundSpinner:SetDesaturated(data.desaturateForeground); + foregroundSpinner:SetTextureOrAtlas(data.foregroundTexture) + foregroundSpinner:SetDesaturated(data.desaturateForeground) foregroundSpinner:Color(data.foregroundColor[1], data.foregroundColor[2], data.foregroundColor[3], data.foregroundColor[4]) - foregroundSpinner:SetBlendMode(data.blendMode); - - background:ClearAllPoints(); - foreground:ClearAllPoints(); - background:SetPoint("BOTTOMLEFT", region, "BOTTOMLEFT"); - background:SetPoint("TOPRIGHT", region, "TOPRIGHT"); - - region.mirror_h = data.mirror; - region.scale_x = 1 + (data.crop_x or 0.41); - region.scale_y = 1 + (data.crop_y or 0.41); - region.rotation = data.rotation or 0; - region.cos_rotation = cos(region.rotation); - region.sin_rotation = sin(region.rotation); - region.user_x = -1 * (data.user_x or 0); - region.user_y = data.user_y or 0; - region.aspect = 1; + foregroundSpinner:SetBlendMode(data.blendMode) + + background:ClearAllPoints() + foreground:ClearAllPoints() + background:SetPoint("BOTTOMLEFT", region, "BOTTOMLEFT") + background:SetPoint("TOPRIGHT", region, "TOPRIGHT") + + region.mirror_h = data.mirror + region.scale_x = 1 + (data.crop_x or 0.41) + region.scale_y = 1 + (data.crop_y or 0.41) + region.rotation = data.rotation or 0 + region.cos_rotation = cos(region.rotation) + region.sin_rotation = sin(region.rotation) + region.user_x = -1 * (data.user_x or 0) + region.user_y = data.user_y or 0 + region.aspect = 1 local function orientHorizontal() - foreground:ClearAllPoints(); - foreground:SetPoint("LEFT", region, "LEFT"); - region.orientation = "HORIZONTAL_INVERSE"; - if(data.compress) then + foreground:ClearAllPoints() + foreground:SetPoint("LEFT", region, "LEFT") + region.orientation = "HORIZONTAL_INVERSE" + if data.compress then function region:SetValue(progress) - region.progress = progress; + region.progress = progress local ULx, ULy = ApplyTransform(0, 0, region) local LLx, LLy = ApplyTransform(0, 1, region) local URx, URy = ApplyTransform(1, 0, region) local LRx, LRy = ApplyTransform(1, 1, region) - foreground:SetTexCoord(ULx, ULy, LLx, LLy, URx, URy, LRx, LRy); - foreground:SetWidth(region:GetWidth() * progress); - background:SetTexCoord(ULx, ULy, LLx, LLy, URx, URy, LRx, LRy); + foreground:SetTexCoord(ULx, ULy, LLx, LLy, URx, URy, LRx, LRy) + foreground:SetWidth(region:GetWidth() * progress) + background:SetTexCoord(ULx, ULy, LLx, LLy, URx, URy, LRx, LRy) end else function region:SetValue(progress) - region.progress = progress; + region.progress = progress - local ULx , ULy = ApplyTransform(0, 0, region) - local LLx , LLy = ApplyTransform(0, 1, region) - local URx , URy = ApplyTransform(progress, 0, region) + local ULx, ULy = ApplyTransform(0, 0, region) + local LLx, LLy = ApplyTransform(0, 1, region) + local URx, URy = ApplyTransform(progress, 0, region) local URx_, URy_ = ApplyTransform(1, 0, region) - local LRx , LRy = ApplyTransform(progress, 1, region) + local LRx, LRy = ApplyTransform(progress, 1, region) local LRx_, LRy_ = ApplyTransform(1, 1, region) - foreground:SetTexCoord(ULx, ULy, LLx, LLy, URx , URy , LRx , LRy ); - foreground:SetWidth(region:GetWidth() * progress); - background:SetTexCoord(ULx, ULy, LLx, LLy, URx_, URy_, LRx_, LRy_); + foreground:SetTexCoord(ULx, ULy, LLx, LLy, URx, URy, LRx, LRy) + foreground:SetWidth(region:GetWidth() * progress) + background:SetTexCoord(ULx, ULy, LLx, LLy, URx_, URy_, LRx_, LRy_) end end end local function orientHorizontalInverse() - foreground:ClearAllPoints(); - foreground:SetPoint("RIGHT", region, "RIGHT"); - region.orientation = "HORIZONTAL"; - if(data.compress) then + foreground:ClearAllPoints() + foreground:SetPoint("RIGHT", region, "RIGHT") + region.orientation = "HORIZONTAL" + if data.compress then function region:SetValue(progress) - region.progress = progress; + region.progress = progress local ULx, ULy = ApplyTransform(0, 0, region) local LLx, LLy = ApplyTransform(0, 1, region) local URx, URy = ApplyTransform(1, 0, region) local LRx, LRy = ApplyTransform(1, 1, region) - foreground:SetTexCoord(ULx, ULy, LLx, LLy, URx, URy, LRx, LRy); - foreground:SetWidth(region:GetWidth() * progress); - background:SetTexCoord(ULx, ULy, LLx, LLy, URx, URy, LRx, LRy); + foreground:SetTexCoord(ULx, ULy, LLx, LLy, URx, URy, LRx, LRy) + foreground:SetWidth(region:GetWidth() * progress) + background:SetTexCoord(ULx, ULy, LLx, LLy, URx, URy, LRx, LRy) end else function region:SetValue(progress) - region.progress = progress; + region.progress = progress - local ULx , ULy = ApplyTransform(1-progress, 0, region) + local ULx, ULy = ApplyTransform(1 - progress, 0, region) local ULx_, ULy_ = ApplyTransform(0, 0, region) - local LLx , LLy = ApplyTransform(1-progress, 1, region) + local LLx, LLy = ApplyTransform(1 - progress, 1, region) local LLx_, LLy_ = ApplyTransform(0, 1, region) - local URx , URy = ApplyTransform(1, 0, region) - local LRx , LRy = ApplyTransform(1, 1, region) + local URx, URy = ApplyTransform(1, 0, region) + local LRx, LRy = ApplyTransform(1, 1, region) - foreground:SetTexCoord(ULx , ULy , LLx , LLy , URx, URy, LRx, LRy); - foreground:SetWidth(region:GetWidth() * progress); - background:SetTexCoord(ULx_, ULy_, LLx_, LLy_, URx, URy, LRx, LRy); + foreground:SetTexCoord(ULx, ULy, LLx, LLy, URx, URy, LRx, LRy) + foreground:SetWidth(region:GetWidth() * progress) + background:SetTexCoord(ULx_, ULy_, LLx_, LLy_, URx, URy, LRx, LRy) end end end local function orientVertical() - foreground:ClearAllPoints(); - foreground:SetPoint("BOTTOM", region, "BOTTOM"); - region.orientation = "VERTICAL_INVERSE"; - if(data.compress) then + foreground:ClearAllPoints() + foreground:SetPoint("BOTTOM", region, "BOTTOM") + region.orientation = "VERTICAL_INVERSE" + if data.compress then function region:SetValue(progress) - region.progress = progress; - + region.progress = progress local ULx, ULy = ApplyTransform(0, 0, region) local LLx, LLy = ApplyTransform(0, 1, region) local URx, URy = ApplyTransform(1, 0, region) local LRx, LRy = ApplyTransform(1, 1, region) - foreground:SetTexCoord(ULx, ULy, LLx, LLy, URx, URy, LRx, LRy); - foreground:SetHeight(region:GetHeight() * progress); - background:SetTexCoord(ULx, ULy, LLx, LLy, URx, URy, LRx, LRy); + foreground:SetTexCoord(ULx, ULy, LLx, LLy, URx, URy, LRx, LRy) + foreground:SetHeight(region:GetHeight() * progress) + background:SetTexCoord(ULx, ULy, LLx, LLy, URx, URy, LRx, LRy) end else function region:SetValue(progress) - region.progress = progress; + region.progress = progress - local ULx , ULy = ApplyTransform(0, 1-progress, region) + local ULx, ULy = ApplyTransform(0, 1 - progress, region) local ULx_, ULy_ = ApplyTransform(0, 0, region) - local LLx , LLy = ApplyTransform(0, 1, region) - local URx , URy = ApplyTransform(1, 1-progress, region) + local LLx, LLy = ApplyTransform(0, 1, region) + local URx, URy = ApplyTransform(1, 1 - progress, region) local URx_, URy_ = ApplyTransform(1, 0, region) - local LRx , LRy = ApplyTransform(1, 1, region) + local LRx, LRy = ApplyTransform(1, 1, region) - foreground:SetTexCoord(ULx, ULy, LLx, LLy, URx, URy, LRx, LRy); - foreground:SetHeight(region:GetHeight() * progress); - background:SetTexCoord(ULx_, ULy_, LLx, LLy, URx_, URy_, LRx, LRy); + foreground:SetTexCoord(ULx, ULy, LLx, LLy, URx, URy, LRx, LRy) + foreground:SetHeight(region:GetHeight() * progress) + background:SetTexCoord(ULx_, ULy_, LLx, LLy, URx_, URy_, LRx, LRy) end end end local function orientVerticalInverse() - foreground:ClearAllPoints(); - foreground:SetPoint("TOP", region, "TOP"); - region.orientation = "VERTICAL"; - if(data.compress) then + foreground:ClearAllPoints() + foreground:SetPoint("TOP", region, "TOP") + region.orientation = "VERTICAL" + if data.compress then function region:SetValue(progress) - region.progress = progress; - + region.progress = progress local ULx, ULy = ApplyTransform(0, 0, region) local LLx, LLy = ApplyTransform(0, 1, region) local URx, URy = ApplyTransform(1, 0, region) local LRx, LRy = ApplyTransform(1, 1, region) - foreground:SetTexCoord(ULx, ULy, LLx, LLy, URx, URy, LRx, LRy); - foreground:SetHeight(region:GetHeight() * progress); - background:SetTexCoord(ULx, ULy, LLx, LLy, URx, URy, LRx, LRy); + foreground:SetTexCoord(ULx, ULy, LLx, LLy, URx, URy, LRx, LRy) + foreground:SetHeight(region:GetHeight() * progress) + background:SetTexCoord(ULx, ULy, LLx, LLy, URx, URy, LRx, LRy) end else function region:SetValue(progress) - region.progress = progress; + region.progress = progress - local ULx , ULy = ApplyTransform(0, 0, region) - local LLx , LLy = ApplyTransform(0, progress, region) + local ULx, ULy = ApplyTransform(0, 0, region) + local LLx, LLy = ApplyTransform(0, progress, region) local LLx_, LLy_ = ApplyTransform(0, 1, region) - local URx , URy = ApplyTransform(1, 0, region) - local LRx , LRy = ApplyTransform(1, progress, region) + local URx, URy = ApplyTransform(1, 0, region) + local LRx, LRy = ApplyTransform(1, progress, region) local LRx_, LRy_ = ApplyTransform(1, 1, region) - foreground:SetTexCoord(ULx, ULy, LLx, LLy, URx, URy, LRx, LRy); - foreground:SetHeight(region:GetHeight() * progress); - background:SetTexCoord(ULx, ULy, LLx_, LLy_, URx, URy, LRx_, LRy_); + foreground:SetTexCoord(ULx, ULy, LLx, LLy, URx, URy, LRx, LRy) + foreground:SetHeight(region:GetHeight() * progress) + background:SetTexCoord(ULx, ULy, LLx_, LLy_, URx, URy, LRx_, LRy_) end end end local function orientCircular(clockwise) - local startAngle = data.startAngle % 360; - local endAngle = data.endAngle % 360; + local startAngle = data.startAngle % 360 + local endAngle = data.endAngle % 360 - if (endAngle <= startAngle) then - endAngle = endAngle + 360; + if endAngle <= startAngle then + endAngle = endAngle + 360 end - backgroundSpinner:SetProgress(region, startAngle, endAngle); - foregroundSpinner:SetProgress(region, startAngle, endAngle); + backgroundSpinner:SetProgress(region, startAngle, endAngle) + foregroundSpinner:SetProgress(region, startAngle, endAngle) function region:SetValue(progress) - region.progress = progress; + region.progress = progress - if (progress < 0) then - progress = 0; + if progress < 0 then + progress = 0 end - if (progress > 1) then - progress = 1; + if progress > 1 then + progress = 1 end - if (not clockwise) then - progress = 1 - progress; + if not clockwise then + progress = 1 - progress end - local pAngle = (endAngle - startAngle) * progress + startAngle; + local pAngle = (endAngle - startAngle) * progress + startAngle - if (clockwise) then - foregroundSpinner:SetProgress(region, startAngle, pAngle); + if clockwise then + foregroundSpinner:SetProgress(region, startAngle, pAngle) else - foregroundSpinner:SetProgress(region, pAngle, endAngle); + foregroundSpinner:SetProgress(region, pAngle, endAngle) end end end local function showCircularProgress() - foreground:Hide(); - background:Hide(); - foregroundSpinner:Show(); - backgroundSpinner:Show(); + foreground:Hide() + background:Hide() + foregroundSpinner:Show() + backgroundSpinner:Show() end local function hideCircularProgress() - foreground:Show(); - background:Show(); - foregroundSpinner:Hide(); - backgroundSpinner:Hide(); + foreground:Show() + background:Show() + foregroundSpinner:Hide() + backgroundSpinner:Hide() end - if(data.orientation == "HORIZONTAL_INVERSE") then - hideCircularProgress(); - orientHorizontalInverse(); - elseif(data.orientation == "HORIZONTAL") then - hideCircularProgress(); - orientHorizontal(); - elseif(data.orientation == "VERTICAL_INVERSE") then - hideCircularProgress(); - orientVerticalInverse(); - elseif(data.orientation == "VERTICAL") then - hideCircularProgress(); - orientVertical(); - elseif(data.orientation == "CLOCKWISE") then - showCircularProgress(); - orientCircular(true); - elseif(data.orientation == "ANTICLOCKWISE") then - showCircularProgress(); - orientCircular(false); + if data.orientation == "HORIZONTAL_INVERSE" then + hideCircularProgress() + orientHorizontalInverse() + elseif data.orientation == "HORIZONTAL" then + hideCircularProgress() + orientHorizontal() + elseif data.orientation == "VERTICAL_INVERSE" then + hideCircularProgress() + orientVerticalInverse() + elseif data.orientation == "VERTICAL" then + hideCircularProgress() + orientVertical() + elseif data.orientation == "CLOCKWISE" then + showCircularProgress() + orientCircular(true) + elseif data.orientation == "ANTICLOCKWISE" then + showCircularProgress() + orientCircular(false) end - if (region.SetValue) then - region:SetValue(3/5); + if region.SetValue then + region:SetValue(3 / 5) end end @@ -735,23 +760,23 @@ local function createIcon() height = 200, orientation = "VERTICAL", alpha = 1.0, - foregroundColor = {1, 1, 1, 1}, - backgroundColor = {0.5, 0.5, 0.5, 0.5} - }; + foregroundColor = { 1, 1, 1, 1 }, + backgroundColor = { 0.5, 0.5, 0.5, 0.5 }, + } - local thumbnail = createThumbnail(); - modifyThumbnail(UIParent, thumbnail, data, nil, 32); + local thumbnail = createThumbnail() + modifyThumbnail(UIParent, thumbnail, data, nil, 32) - thumbnail.elapsed = 0; + thumbnail.elapsed = 0 thumbnail:SetScript("OnUpdate", function(self, elapsed) - thumbnail.elapsed = thumbnail.elapsed + elapsed; - if(thumbnail.elapsed > 4) then - thumbnail.elapsed = thumbnail.elapsed - 4; + thumbnail.elapsed = thumbnail.elapsed + elapsed + if thumbnail.elapsed > 4 then + thumbnail.elapsed = thumbnail.elapsed - 4 end - thumbnail.region:SetValue((4 - thumbnail.elapsed) / 4); - end); + thumbnail.region:SetValue((4 - thumbnail.elapsed) / 4) + end) - return thumbnail; + return thumbnail end local templates = { @@ -759,7 +784,7 @@ local templates = { title = L["Default"], data = { inverse = true, - }; + }, }, { title = L["Top HUD position"], @@ -827,4 +852,13 @@ if WeakAuras.IsClassic() then table.remove(templates, 2) end -WeakAuras.RegisterRegionOptions("progresstexture", createOptions, createIcon, L["Progress Texture"], createThumbnail, modifyThumbnail, L["Shows a texture that changes based on duration"], templates); +WeakAuras.RegisterRegionOptions( + "progresstexture", + createOptions, + createIcon, + L["Progress Texture"], + createThumbnail, + modifyThumbnail, + L["Shows a texture that changes based on duration"], + templates +) diff --git a/WeakAurasOptions/RegionOptions/StopMotion.lua b/WeakAurasOptions/RegionOptions/StopMotion.lua index a7e1abd718..45b5314e81 100644 --- a/WeakAurasOptions/RegionOptions/StopMotion.lua +++ b/WeakAurasOptions/RegionOptions/StopMotion.lua @@ -1,14 +1,14 @@ local L = WeakAuras.L local AddonName, OptionsPrivate = ... -local texture_types = WeakAuras.StopMotion.texture_types; -local texture_data = WeakAuras.StopMotion.texture_data; -local animation_types = WeakAuras.StopMotion.animation_types; -local setTile = WeakAuras.setTile; +local texture_types = WeakAuras.StopMotion.texture_types +local texture_data = WeakAuras.StopMotion.texture_data +local animation_types = WeakAuras.StopMotion.animation_types +local setTile = WeakAuras.setTile local function setTextureFunc(textureWidget, texturePath, textureName) - local data = texture_data[texturePath]; - if not(data) then + local data = texture_data[texturePath] + if not data then local pattern = "%.x(%d+)y(%d+)f(%d+)%.[tb][gl][ap]" local pattern2 = "%.x(%d+)y(%d+)f(%d+)w(%d+)h(%d+)W(%d+)H(%d+)%.[tb][gl][ap]" local rows, columns, frames = texturePath:lower():match(pattern) @@ -16,12 +16,13 @@ local function setTextureFunc(textureWidget, texturePath, textureName) data = { count = tonumber(frames), rows = tonumber(rows), - columns = tonumber(columns) + columns = tonumber(columns), } else local rows, columns, frames, frameWidth, frameHeight, fileWidth, fileHeight = texturePath:match(pattern2) if rows then - rows, columns, frames, frameWidth, frameHeight, fileWidth, fileHeight = tonumber(rows), tonumber(columns), tonumber(frames), tonumber(frameWidth), tonumber(frameHeight), tonumber(fileWidth), tonumber(fileHeight) + rows, columns, frames, frameWidth, frameHeight, fileWidth, fileHeight = + tonumber(rows), tonumber(columns), tonumber(frames), tonumber(frameWidth), tonumber(frameHeight), tonumber(fileWidth), tonumber(fileHeight) local frameScaleW = 1 local frameScaleH = 1 if fileWidth > 0 and frameWidth > 0 then @@ -35,52 +36,52 @@ local function setTextureFunc(textureWidget, texturePath, textureName) rows = rows, columns = columns, frameScaleW = frameScaleW, - frameScaleH = frameScaleH + frameScaleH = frameScaleH, } end end end - textureWidget.frameNr = 0; - if (data) then - if (data.rows and data.columns) then - -- Texture Atlas - textureWidget:SetTexture(texturePath, textureName); + textureWidget.frameNr = 0 + if data then + if data.rows and data.columns then + -- Texture Atlas + textureWidget:SetTexture(texturePath, textureName) - setTile(textureWidget, data.count, data.rows, data.columns, data.frameScaleW or 1, data.frameScaleH or 1); + setTile(textureWidget, data.count, data.rows, data.columns, data.frameScaleW or 1, data.frameScaleH or 1) - textureWidget:SetOnUpdate(function(self, elapsed) - self.elapsed = (self.elapsed or 0) + elapsed - if(self.elapsed > 0.1) then - self.elapsed = self.elapsed - 0.1; - textureWidget.frameNr = textureWidget.frameNr + 1; - if (textureWidget.frameNr == data.count) then - textureWidget.frameNr = 1; - end - setTile(textureWidget, textureWidget.frameNr, data.rows, data.columns, data.frameScaleW or 1, data.frameScaleH or 1); + textureWidget:SetOnUpdate(function(self, elapsed) + self.elapsed = (self.elapsed or 0) + elapsed + if self.elapsed > 0.1 then + self.elapsed = self.elapsed - 0.1 + textureWidget.frameNr = textureWidget.frameNr + 1 + if textureWidget.frameNr == data.count then + textureWidget.frameNr = 1 end - end) - else - -- Numbered Textures - local texture = texturePath .. format("%03d", texture_data[texturePath].count) - textureWidget:SetTexture(texture, textureName) - textureWidget:SetTexCoord(0, 1, 0, 1); + setTile(textureWidget, textureWidget.frameNr, data.rows, data.columns, data.frameScaleW or 1, data.frameScaleH or 1) + end + end) + else + -- Numbered Textures + local texture = texturePath .. format("%03d", texture_data[texturePath].count) + textureWidget:SetTexture(texture, textureName) + textureWidget:SetTexCoord(0, 1, 0, 1) - textureWidget:SetOnUpdate(function(self, elapsed) - self.elapsed = (self.elapsed or 0) + elapsed - if(self.elapsed > 0.1) then - self.elapsed = self.elapsed - 0.1; - textureWidget.frameNr = textureWidget.frameNr + 1; - if (textureWidget.frameNr == data.count) then - textureWidget.frameNr = 1; - end - local texture = texturePath .. format("%03d", textureWidget.frameNr) - textureWidget:SetTexture(texture, textureName); + textureWidget:SetOnUpdate(function(self, elapsed) + self.elapsed = (self.elapsed or 0) + elapsed + if self.elapsed > 0.1 then + self.elapsed = self.elapsed - 0.1 + textureWidget.frameNr = textureWidget.frameNr + 1 + if textureWidget.frameNr == data.count then + textureWidget.frameNr = 1 end - end); - end + local texture = texturePath .. format("%03d", textureWidget.frameNr) + textureWidget:SetTexture(texture, textureName) + end + end) + end else local texture = texturePath .. format("%03d", 1) - textureWidget:SetTexture(texture, textureName); + textureWidget:SetTexture(texture, textureName) end end @@ -88,616 +89,676 @@ local function textureNameHasData(textureName) local pattern = "%.x(%d+)y(%d+)f(%d+)%.[tb][gl][ap]$" local pattern2 = "%.x(%d+)y(%d+)f(%d+)w(%d+)h(%d+)W(%d+)H(%d+)%.[tb][gl][ap]$" local ok = textureName:lower():match(pattern) - if ok then return true end + if ok then + return true + end local ok2 = textureName:match(pattern2) if ok2 then - return true + return true else - return false + return false end end local function createOptions(id, data) - local options = { - __title = L["Stop Motion Settings"], - __order = 1, - foregroundTexture = { - type = "input", - width = WeakAuras.doubleWidth - 0.15, - name = L["Texture"], - order = 1, - }, - chooseForegroundTexture = { - type = "execute", - width = 0.15, - name = L["Choose"], - order = 2, - func = function() - OptionsPrivate.OpenTexturePicker(data, {}, { - texture = "foregroundTexture", - color = "foregroundColor", - rotation = "rotation", - mirror = "mirror", - blendMode = "blendMode" - }, texture_types, setTextureFunc); - end, - imageWidth = 24, - imageHeight = 24, - control = "WeakAurasIcon", - image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\browse", - }, - foregroundColor = { - type = "color", - width = WeakAuras.normalWidth, - name = L["Color"], - hasAlpha = true, - order = 3 - }, - desaturateForeground = { - type = "toggle", - width = WeakAuras.normalWidth, - name = L["Desaturate"], - order = 3.5, - }, - customForegroundRows = { - type = "input", - width = WeakAuras.doubleWidth / 3, - name = L["Rows"], - validate = WeakAuras.ValidateNumeric, - get = function() - return data.customForegroundRows and tostring(data.customForegroundRows) or ""; - end, - set = function(info, v) - data.customForegroundRows = v and tonumber(v) or 0 - WeakAuras.Add(data); - WeakAuras.UpdateThumbnail(data); - end, - order = 4, - hidden = function() return texture_data[data.foregroundTexture] or textureNameHasData(data.foregroundTexture) end - }, - customForegroundColumns = { - type = "input", - width = WeakAuras.doubleWidth / 3, - name = L["Columns"], - validate = WeakAuras.ValidateNumeric, - get = function() - return data.customForegroundColumns and tostring(data.customForegroundColumns) or ""; - end, - set = function(info, v) - data.customForegroundColumns = v and tonumber(v) or 0 - WeakAuras.Add(data); - WeakAuras.UpdateThumbnail(data); - end, - order = 5, - hidden = function() return texture_data[data.foregroundTexture] or textureNameHasData(data.foregroundTexture) end - }, - customForegroundFrames = { - type = "input", - width = WeakAuras.doubleWidth / 3, - name = L["Frame Count"], - validate = WeakAuras.ValidateNumeric, - get = function() - return data.customForegroundFrames and tostring(data.customForegroundFrames) or ""; - end, - set = function(info, v) - data.customForegroundFrames = v and tonumber(v) or 0 - WeakAuras.Add(data); - WeakAuras.UpdateThumbnail(data); - end, - order = 6, - hidden = function() return texture_data[data.foregroundTexture] or textureNameHasData(data.foregroundTexture) end - }, - customForegroundFileWidth = { - type = "input", - width = WeakAuras.normalWidth / 2, - name = L["File Width"], - desc = L["Must be a power of 2"], - validate = function(info, val) - if val ~= nil and val ~= "" and (not tonumber(val) or tonumber(val) >= 2^31 or math.frexp(val) ~= 0.5) then - return false; - end - return true - end, - get = function() - return data.customForegroundFileWidth and tostring(data.customForegroundFileWidth) or ""; - end, - set = function(info, v) - data.customForegroundFileWidth = v and tonumber(v) or 0 - WeakAuras.Add(data); - WeakAuras.UpdateThumbnail(data); - end, - order = 7, - hidden = function() return texture_data[data.foregroundTexture] or textureNameHasData(data.foregroundTexture) end - }, - customForegroundFileHeight = { - type = "input", - width = WeakAuras.normalWidth / 2, - name = L["File Height"], - desc = L["Must be a power of 2"], - validate = function(info, val) - if val ~= nil and val ~= "" and (not tonumber(val) or tonumber(val) >= 2^31 or math.frexp(val) ~= 0.5) then - return false; - end - return true - end, - get = function() - return data.customForegroundFileHeight and tostring(data.customForegroundFileHeight) or ""; - end, - set = function(info, v) - data.customForegroundFileHeight = v and tonumber(v) or 0 - WeakAuras.Add(data); - WeakAuras.UpdateThumbnail(data); - end, - order = 8, - hidden = function() return texture_data[data.foregroundTexture] or textureNameHasData(data.foregroundTexture) end - }, - customForegroundFrameWidth = { - type = "input", - width = WeakAuras.normalWidth / 2, - name = L["Frame Width"], - validate = WeakAuras.ValidateNumeric, - desc = L["Can set to 0 if Columns * Width equal File Width"], - get = function() - return data.customForegroundFrameWidth and tostring(data.customForegroundFrameWidth) or ""; - end, - set = function(info, v) - data.customForegroundFrameWidth = v and tonumber(v) or 0 - WeakAuras.Add(data); - WeakAuras.UpdateThumbnail(data); - end, - order = 9, - hidden = function() return texture_data[data.foregroundTexture] or textureNameHasData(data.foregroundTexture) end - }, - customForegroundFrameHeight = { - type = "input", - width = WeakAuras.normalWidth / 2, - name = L["Frame Height"], - validate = WeakAuras.ValidateNumeric, - desc = L["Can set to 0 if Rows * Height equal File Height"], - get = function() - return data.customForegroundFrameHeight and tostring(data.customForegroundFrameHeight) or ""; - end, - set = function(info, v) - data.customForegroundFrameHeight = v and tonumber(v) or 0 - WeakAuras.Add(data); - WeakAuras.UpdateThumbnail(data); - end, - order = 10, - hidden = function() return texture_data[data.foregroundTexture] or textureNameHasData(data.foregroundTexture) end - }, - blendMode = { - type = "select", - width = WeakAuras.normalWidth, - name = L["Blend Mode"], - order = 11, - values = OptionsPrivate.Private.blend_types - }, - animationType = { - type = "select", - width = WeakAuras.normalWidth, - name = L["Animation Mode"], - order = 12, - values = animation_types - }, - startPercent = { - type = "range", - width = WeakAuras.normalWidth, - name = L["Animation Start"], - min = 0, - max = 1, - --bigStep = 0.01, - order = 13, - isPercent = true - }, - endPercent = { - type = "range", - width = WeakAuras.normalWidth, - name = L["Animation End"], - min = 0, - max = 1, - --bigStep = 0.01, - order = 14, - isPercent = true - }, - frameRate = { - type = "range", - width = WeakAuras.normalWidth, - name = L["Frame Rate"], - min = 3, - max = 120, - step = 1, - bigStep = 3, - order = 15, - disabled = function() return data.animationType == "progress" end; - }, - inverse = { - type = "toggle", - width = WeakAuras.normalWidth, - name = L["Inverse"], - order = 15.5 - }, - customBackgroundHeader = { - type = "header", - name = L["Background Texture"], - order = 16, - }, - hideBackground = { - type = "toggle", - name = L["Hide Background"], - order = 17, - width = WeakAuras.normalWidth, - }, - sameTexture = { - type = "toggle", - width = WeakAuras.normalWidth, - name = L["Same texture as Foreground"], - order = 18, - disabled = function() return data.hideBackground; end, - hidden = function() return data.hideBackground; end - }, - backgroundTexture = { - type = "input", - width = WeakAuras.doubleWidth - 0.15, - name = L["Background Texture"], - order = 19, - disabled = function() return data.sameTexture or data.hideBackground end, - hidden = function() return data.hideBackground end, - get = function() return data.sameTexture and data.foregroundTexture or data.backgroundTexture; end, - }, - chooseBackgroundTexture = { - type = "execute", - width = 0.15, - name = L["Choose"], - order = 20, - func = function() - OptionsPrivate.OpenTexturePicker(data, {}, { - texture = "backgroundTexture", - color = "backgroundColor", - rotation = "rotation", - mirror = "mirror", - blendMode = "blendMode" - }, texture_types, setTextureFunc); - end, - disabled = function() return data.sameTexture or data.hideBackground; end, - hidden = function() return data.hideBackground end, - imageWidth = 24, - imageHeight = 24, - control = "WeakAurasIcon", - image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\browse", - }, - backgroundColor = { - type = "color", - width = WeakAuras.normalWidth, - name = L["Color"], - hasAlpha = true, - order = 21, - disabled = function() return data.hideBackground; end, - hidden = function() return data.hideBackground; end - }, - desaturateBackground = { - type = "toggle", - name = L["Desaturate"], - order = 22, - width = WeakAuras.normalWidth, - disabled = function() return data.hideBackground; end, - hidden = function() return data.hideBackground; end - }, - backgroundColorHiddenSpacer = { - type = "execute", - width = WeakAuras.normalWidth, - name = "", - order = 23, - image = function() return "", 0, 0 end, - hidden = function() return not data.hideBackground end - }, - customBackgroundRows = { - type = "input", - width = WeakAuras.doubleWidth / 3, - name = L["Rows"], - validate = WeakAuras.ValidateNumeric, - get = function() - return data.customBackgroundRows and tostring(data.customBackgroundRows) or ""; - end, - set = function(info, v) - data.customBackgroundRows = v and tonumber(v) or 0 - WeakAuras.Add(data); - WeakAuras.UpdateThumbnail(data); - end, - order = 24, - hidden = function() return data.sameTexture or texture_data[data.backgroundTexture] or textureNameHasData(data.backgroundTexture) end - }, - customBackgroundColumns = { - type = "input", - width = WeakAuras.doubleWidth / 3, - name = L["Columns"], - validate = WeakAuras.ValidateNumeric, - get = function() - return data.customBackgroundColumns and tostring(data.customBackgroundColumns) or ""; - end, - set = function(info, v) - data.customBackgroundColumns = v and tonumber(v) or 0 - WeakAuras.Add(data); - WeakAuras.UpdateThumbnail(data); - end, - order = 25, - hidden = function() return data.sameTexture or texture_data[data.backgroundTexture] or textureNameHasData(data.backgroundTexture) end - }, - customBackgroundFrames = { - type = "input", - width = WeakAuras.doubleWidth / 3, - name = L["Frame Count"], - validate = WeakAuras.ValidateNumeric, - get = function() - return data.customBackgroundFrames and tostring(data.customBackgroundFrames) or ""; - end, - set = function(info, v) - data.customBackgroundFrames = v and tonumber(v) or 0 - WeakAuras.Add(data); - WeakAuras.UpdateThumbnail(data); - end, - order = 26, - hidden = function() return data.sameTexture or texture_data[data.backgroundTexture] or textureNameHasData(data.backgroundTexture) end - }, - customBackgroundFileWidth = { - type = "input", - width = WeakAuras.normalWidth / 2, - name = L["File Width"], - desc = L["Must be a power of 2"], - validate = function(info, val) - if val ~= nil and val ~= "" and (not tonumber(val) or tonumber(val) >= 2^31 or math.frexp(val) ~= 0.5) then - return false; - end - return true - end, - get = function() - return data.customBackgroundFileWidth and tostring(data.customBackgroundFileWidth) or ""; - end, - set = function(info, v) - data.customBackgroundFileWidth = v and tonumber(v) or 0 - WeakAuras.Add(data); - WeakAuras.UpdateThumbnail(data); - end, - order = 27, - hidden = function() return data.sameTexture or texture_data[data.backgroundTexture] or textureNameHasData(data.backgroundTexture) end - }, - customBackgroundFileHeight = { - type = "input", - width = WeakAuras.normalWidth / 2, - name = L["File Height"], - desc = L["Must be a power of 2"], - validate = function(info, val) - if val ~= nil and val ~= "" and (not tonumber(val) or tonumber(val) >= 2^31 or math.frexp(val) ~= 0.5) then - return false; - end - return true - end, - get = function() - return data.customBackgroundFileHeight and tostring(data.customBackgroundFileHeight) or ""; - end, - set = function(info, v) - data.customBackgroundFileHeight = v and tonumber(v) or 0 - WeakAuras.Add(data); - WeakAuras.UpdateThumbnail(data); - end, - order = 28, - hidden = function() return data.sameTexture or texture_data[data.backgroundTexture] or textureNameHasData(data.backgroundTexture) end - }, - customBackgroundFrameWidth = { - type = "input", - width = WeakAuras.normalWidth / 2, - name = L["Frame Width"], - validate = WeakAuras.ValidateNumeric, - desc = L["Can set to 0 if Columns * Width equal File Width"], - get = function() - return data.customBackgroundFrameWidth and tostring(data.customBackgroundFrameWidth) or ""; - end, - set = function(info, v) - data.customBackgroundFrameWidth = v and tonumber(v) or 0 - WeakAuras.Add(data); - WeakAuras.UpdateThumbnail(data); - end, - order = 29, - hidden = function() return data.sameTexture or texture_data[data.backgroundTexture] or textureNameHasData(data.backgroundTexture) end - }, - customBackgroundFrameHeight = { - type = "input", - width = WeakAuras.normalWidth / 2, - name = L["Frame Height"], - validate = WeakAuras.ValidateNumeric, - desc = L["Can set to 0 if Rows * Height equal File Height"], - get = function() - return data.customBackgroundFrameHeight and tostring(data.customBackgroundFrameHeight) or ""; - end, - set = function(info, v) - data.customBackgroundFrameHeight = v and tonumber(v) or 0 - WeakAuras.Add(data); - WeakAuras.UpdateThumbnail(data); - end, - order = 30, - hidden = function() return data.sameTexture or texture_data[data.backgroundTexture] or textureNameHasData(data.backgroundTexture) end - }, - backgroundPercent = { - type = "range", - width = WeakAuras.normalWidth, - name = L["Selected Frame"], - min = 0, - max = 1, - order = 31, - isPercent = true, - hidden = function() return data.hideBackground; end - } - }; + local options = { + __title = L["Stop Motion Settings"], + __order = 1, + foregroundTexture = { + type = "input", + width = WeakAuras.doubleWidth - 0.15, + name = L["Texture"], + order = 1, + }, + chooseForegroundTexture = { + type = "execute", + width = 0.15, + name = L["Choose"], + order = 2, + func = function() + OptionsPrivate.OpenTexturePicker(data, {}, { + texture = "foregroundTexture", + color = "foregroundColor", + rotation = "rotation", + mirror = "mirror", + blendMode = "blendMode", + }, texture_types, setTextureFunc) + end, + imageWidth = 24, + imageHeight = 24, + control = "WeakAurasIcon", + image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\browse", + }, + foregroundColor = { + type = "color", + width = WeakAuras.normalWidth, + name = L["Color"], + hasAlpha = true, + order = 3, + }, + desaturateForeground = { + type = "toggle", + width = WeakAuras.normalWidth, + name = L["Desaturate"], + order = 3.5, + }, + customForegroundRows = { + type = "input", + width = WeakAuras.doubleWidth / 3, + name = L["Rows"], + validate = WeakAuras.ValidateNumeric, + get = function() + return data.customForegroundRows and tostring(data.customForegroundRows) or "" + end, + set = function(info, v) + data.customForegroundRows = v and tonumber(v) or 0 + WeakAuras.Add(data) + WeakAuras.UpdateThumbnail(data) + end, + order = 4, + hidden = function() + return texture_data[data.foregroundTexture] or textureNameHasData(data.foregroundTexture) + end, + }, + customForegroundColumns = { + type = "input", + width = WeakAuras.doubleWidth / 3, + name = L["Columns"], + validate = WeakAuras.ValidateNumeric, + get = function() + return data.customForegroundColumns and tostring(data.customForegroundColumns) or "" + end, + set = function(info, v) + data.customForegroundColumns = v and tonumber(v) or 0 + WeakAuras.Add(data) + WeakAuras.UpdateThumbnail(data) + end, + order = 5, + hidden = function() + return texture_data[data.foregroundTexture] or textureNameHasData(data.foregroundTexture) + end, + }, + customForegroundFrames = { + type = "input", + width = WeakAuras.doubleWidth / 3, + name = L["Frame Count"], + validate = WeakAuras.ValidateNumeric, + get = function() + return data.customForegroundFrames and tostring(data.customForegroundFrames) or "" + end, + set = function(info, v) + data.customForegroundFrames = v and tonumber(v) or 0 + WeakAuras.Add(data) + WeakAuras.UpdateThumbnail(data) + end, + order = 6, + hidden = function() + return texture_data[data.foregroundTexture] or textureNameHasData(data.foregroundTexture) + end, + }, + customForegroundFileWidth = { + type = "input", + width = WeakAuras.normalWidth / 2, + name = L["File Width"], + desc = L["Must be a power of 2"], + validate = function(info, val) + if val ~= nil and val ~= "" and (not tonumber(val) or tonumber(val) >= 2 ^ 31 or math.frexp(val) ~= 0.5) then + return false + end + return true + end, + get = function() + return data.customForegroundFileWidth and tostring(data.customForegroundFileWidth) or "" + end, + set = function(info, v) + data.customForegroundFileWidth = v and tonumber(v) or 0 + WeakAuras.Add(data) + WeakAuras.UpdateThumbnail(data) + end, + order = 7, + hidden = function() + return texture_data[data.foregroundTexture] or textureNameHasData(data.foregroundTexture) + end, + }, + customForegroundFileHeight = { + type = "input", + width = WeakAuras.normalWidth / 2, + name = L["File Height"], + desc = L["Must be a power of 2"], + validate = function(info, val) + if val ~= nil and val ~= "" and (not tonumber(val) or tonumber(val) >= 2 ^ 31 or math.frexp(val) ~= 0.5) then + return false + end + return true + end, + get = function() + return data.customForegroundFileHeight and tostring(data.customForegroundFileHeight) or "" + end, + set = function(info, v) + data.customForegroundFileHeight = v and tonumber(v) or 0 + WeakAuras.Add(data) + WeakAuras.UpdateThumbnail(data) + end, + order = 8, + hidden = function() + return texture_data[data.foregroundTexture] or textureNameHasData(data.foregroundTexture) + end, + }, + customForegroundFrameWidth = { + type = "input", + width = WeakAuras.normalWidth / 2, + name = L["Frame Width"], + validate = WeakAuras.ValidateNumeric, + desc = L["Can set to 0 if Columns * Width equal File Width"], + get = function() + return data.customForegroundFrameWidth and tostring(data.customForegroundFrameWidth) or "" + end, + set = function(info, v) + data.customForegroundFrameWidth = v and tonumber(v) or 0 + WeakAuras.Add(data) + WeakAuras.UpdateThumbnail(data) + end, + order = 9, + hidden = function() + return texture_data[data.foregroundTexture] or textureNameHasData(data.foregroundTexture) + end, + }, + customForegroundFrameHeight = { + type = "input", + width = WeakAuras.normalWidth / 2, + name = L["Frame Height"], + validate = WeakAuras.ValidateNumeric, + desc = L["Can set to 0 if Rows * Height equal File Height"], + get = function() + return data.customForegroundFrameHeight and tostring(data.customForegroundFrameHeight) or "" + end, + set = function(info, v) + data.customForegroundFrameHeight = v and tonumber(v) or 0 + WeakAuras.Add(data) + WeakAuras.UpdateThumbnail(data) + end, + order = 10, + hidden = function() + return texture_data[data.foregroundTexture] or textureNameHasData(data.foregroundTexture) + end, + }, + blendMode = { + type = "select", + width = WeakAuras.normalWidth, + name = L["Blend Mode"], + order = 11, + values = OptionsPrivate.Private.blend_types, + }, + animationType = { + type = "select", + width = WeakAuras.normalWidth, + name = L["Animation Mode"], + order = 12, + values = animation_types, + }, + startPercent = { + type = "range", + width = WeakAuras.normalWidth, + name = L["Animation Start"], + min = 0, + max = 1, + --bigStep = 0.01, + order = 13, + isPercent = true, + }, + endPercent = { + type = "range", + width = WeakAuras.normalWidth, + name = L["Animation End"], + min = 0, + max = 1, + --bigStep = 0.01, + order = 14, + isPercent = true, + }, + frameRate = { + type = "range", + width = WeakAuras.normalWidth, + name = L["Frame Rate"], + min = 3, + max = 120, + step = 1, + bigStep = 3, + order = 15, + disabled = function() + return data.animationType == "progress" + end, + }, + inverse = { + type = "toggle", + width = WeakAuras.normalWidth, + name = L["Inverse"], + order = 15.5, + }, + customBackgroundHeader = { + type = "header", + name = L["Background Texture"], + order = 16, + }, + hideBackground = { + type = "toggle", + name = L["Hide Background"], + order = 17, + width = WeakAuras.normalWidth, + }, + sameTexture = { + type = "toggle", + width = WeakAuras.normalWidth, + name = L["Same texture as Foreground"], + order = 18, + disabled = function() + return data.hideBackground + end, + hidden = function() + return data.hideBackground + end, + }, + backgroundTexture = { + type = "input", + width = WeakAuras.doubleWidth - 0.15, + name = L["Background Texture"], + order = 19, + disabled = function() + return data.sameTexture or data.hideBackground + end, + hidden = function() + return data.hideBackground + end, + get = function() + return data.sameTexture and data.foregroundTexture or data.backgroundTexture + end, + }, + chooseBackgroundTexture = { + type = "execute", + width = 0.15, + name = L["Choose"], + order = 20, + func = function() + OptionsPrivate.OpenTexturePicker(data, {}, { + texture = "backgroundTexture", + color = "backgroundColor", + rotation = "rotation", + mirror = "mirror", + blendMode = "blendMode", + }, texture_types, setTextureFunc) + end, + disabled = function() + return data.sameTexture or data.hideBackground + end, + hidden = function() + return data.hideBackground + end, + imageWidth = 24, + imageHeight = 24, + control = "WeakAurasIcon", + image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\browse", + }, + backgroundColor = { + type = "color", + width = WeakAuras.normalWidth, + name = L["Color"], + hasAlpha = true, + order = 21, + disabled = function() + return data.hideBackground + end, + hidden = function() + return data.hideBackground + end, + }, + desaturateBackground = { + type = "toggle", + name = L["Desaturate"], + order = 22, + width = WeakAuras.normalWidth, + disabled = function() + return data.hideBackground + end, + hidden = function() + return data.hideBackground + end, + }, + backgroundColorHiddenSpacer = { + type = "execute", + width = WeakAuras.normalWidth, + name = "", + order = 23, + image = function() + return "", 0, 0 + end, + hidden = function() + return not data.hideBackground + end, + }, + customBackgroundRows = { + type = "input", + width = WeakAuras.doubleWidth / 3, + name = L["Rows"], + validate = WeakAuras.ValidateNumeric, + get = function() + return data.customBackgroundRows and tostring(data.customBackgroundRows) or "" + end, + set = function(info, v) + data.customBackgroundRows = v and tonumber(v) or 0 + WeakAuras.Add(data) + WeakAuras.UpdateThumbnail(data) + end, + order = 24, + hidden = function() + return data.sameTexture or texture_data[data.backgroundTexture] or textureNameHasData(data.backgroundTexture) + end, + }, + customBackgroundColumns = { + type = "input", + width = WeakAuras.doubleWidth / 3, + name = L["Columns"], + validate = WeakAuras.ValidateNumeric, + get = function() + return data.customBackgroundColumns and tostring(data.customBackgroundColumns) or "" + end, + set = function(info, v) + data.customBackgroundColumns = v and tonumber(v) or 0 + WeakAuras.Add(data) + WeakAuras.UpdateThumbnail(data) + end, + order = 25, + hidden = function() + return data.sameTexture or texture_data[data.backgroundTexture] or textureNameHasData(data.backgroundTexture) + end, + }, + customBackgroundFrames = { + type = "input", + width = WeakAuras.doubleWidth / 3, + name = L["Frame Count"], + validate = WeakAuras.ValidateNumeric, + get = function() + return data.customBackgroundFrames and tostring(data.customBackgroundFrames) or "" + end, + set = function(info, v) + data.customBackgroundFrames = v and tonumber(v) or 0 + WeakAuras.Add(data) + WeakAuras.UpdateThumbnail(data) + end, + order = 26, + hidden = function() + return data.sameTexture or texture_data[data.backgroundTexture] or textureNameHasData(data.backgroundTexture) + end, + }, + customBackgroundFileWidth = { + type = "input", + width = WeakAuras.normalWidth / 2, + name = L["File Width"], + desc = L["Must be a power of 2"], + validate = function(info, val) + if val ~= nil and val ~= "" and (not tonumber(val) or tonumber(val) >= 2 ^ 31 or math.frexp(val) ~= 0.5) then + return false + end + return true + end, + get = function() + return data.customBackgroundFileWidth and tostring(data.customBackgroundFileWidth) or "" + end, + set = function(info, v) + data.customBackgroundFileWidth = v and tonumber(v) or 0 + WeakAuras.Add(data) + WeakAuras.UpdateThumbnail(data) + end, + order = 27, + hidden = function() + return data.sameTexture or texture_data[data.backgroundTexture] or textureNameHasData(data.backgroundTexture) + end, + }, + customBackgroundFileHeight = { + type = "input", + width = WeakAuras.normalWidth / 2, + name = L["File Height"], + desc = L["Must be a power of 2"], + validate = function(info, val) + if val ~= nil and val ~= "" and (not tonumber(val) or tonumber(val) >= 2 ^ 31 or math.frexp(val) ~= 0.5) then + return false + end + return true + end, + get = function() + return data.customBackgroundFileHeight and tostring(data.customBackgroundFileHeight) or "" + end, + set = function(info, v) + data.customBackgroundFileHeight = v and tonumber(v) or 0 + WeakAuras.Add(data) + WeakAuras.UpdateThumbnail(data) + end, + order = 28, + hidden = function() + return data.sameTexture or texture_data[data.backgroundTexture] or textureNameHasData(data.backgroundTexture) + end, + }, + customBackgroundFrameWidth = { + type = "input", + width = WeakAuras.normalWidth / 2, + name = L["Frame Width"], + validate = WeakAuras.ValidateNumeric, + desc = L["Can set to 0 if Columns * Width equal File Width"], + get = function() + return data.customBackgroundFrameWidth and tostring(data.customBackgroundFrameWidth) or "" + end, + set = function(info, v) + data.customBackgroundFrameWidth = v and tonumber(v) or 0 + WeakAuras.Add(data) + WeakAuras.UpdateThumbnail(data) + end, + order = 29, + hidden = function() + return data.sameTexture or texture_data[data.backgroundTexture] or textureNameHasData(data.backgroundTexture) + end, + }, + customBackgroundFrameHeight = { + type = "input", + width = WeakAuras.normalWidth / 2, + name = L["Frame Height"], + validate = WeakAuras.ValidateNumeric, + desc = L["Can set to 0 if Rows * Height equal File Height"], + get = function() + return data.customBackgroundFrameHeight and tostring(data.customBackgroundFrameHeight) or "" + end, + set = function(info, v) + data.customBackgroundFrameHeight = v and tonumber(v) or 0 + WeakAuras.Add(data) + WeakAuras.UpdateThumbnail(data) + end, + order = 30, + hidden = function() + return data.sameTexture or texture_data[data.backgroundTexture] or textureNameHasData(data.backgroundTexture) + end, + }, + backgroundPercent = { + type = "range", + width = WeakAuras.normalWidth, + name = L["Selected Frame"], + min = 0, + max = 1, + order = 31, + isPercent = true, + hidden = function() + return data.hideBackground + end, + }, + } - if OptionsPrivate.commonOptions then - return { - stopmotion = options, - position = OptionsPrivate.commonOptions.PositionOptions(id, data, 2), - }; - else - return { - stopmotion = options, - position = WeakAuras.PositionOptions(id, data, 2), - }; - end + if OptionsPrivate.commonOptions then + return { + stopmotion = options, + position = OptionsPrivate.commonOptions.PositionOptions(id, data, 2), + } + else + return { + stopmotion = options, + position = WeakAuras.PositionOptions(id, data, 2), + } + end end local function createThumbnail() - local borderframe = CreateFrame("Frame", nil, UIParent); - borderframe:SetWidth(32); - borderframe:SetHeight(32); + local borderframe = CreateFrame("Frame", nil, UIParent) + borderframe:SetWidth(32) + borderframe:SetHeight(32) - local border = borderframe:CreateTexture(nil, "OVERLAY"); - border:SetAllPoints(borderframe); - border:SetTexture("Interface\\BUTTONS\\UI-Quickslot2.blp"); - border:SetTexCoord(0.2, 0.8, 0.2, 0.8); + local border = borderframe:CreateTexture(nil, "OVERLAY") + border:SetAllPoints(borderframe) + border:SetTexture("Interface\\BUTTONS\\UI-Quickslot2.blp") + border:SetTexCoord(0.2, 0.8, 0.2, 0.8) - local texture = borderframe:CreateTexture(); - borderframe.texture = texture; - texture:SetPoint("CENTER", borderframe, "CENTER"); + local texture = borderframe:CreateTexture() + borderframe.texture = texture + texture:SetPoint("CENTER", borderframe, "CENTER") - return borderframe; + return borderframe end local function modifyThumbnail(parent, region, data, fullModify, size) - region:SetParent(parent) + region:SetParent(parent) - size = size or 30; - local scale; - if(data.height > data.width) then - scale = size/data.height; - region.texture:SetWidth(scale * data.width); - region.texture:SetHeight(size); - else - scale = size/data.width; - region.texture:SetWidth(size); - region.texture:SetHeight(scale * data.height); - end + size = size or 30 + local scale + if data.height > data.width then + scale = size / data.height + region.texture:SetWidth(scale * data.width) + region.texture:SetHeight(size) + else + scale = size / data.width + region.texture:SetWidth(size) + region.texture:SetHeight(scale * data.height) + end - local frame = 1; - region.foreground = region.foreground or {} - local tdata = texture_data[data.foregroundTexture]; - if (tdata) then - local lastFrame = tdata.count - 1; - region.startFrame = floor( (data.startPercent or 0) * lastFrame) + 1; - region.endFrame = floor( (data.endPercent or 1) * lastFrame) + 1; - region.foreground.rows = tdata.rows; - region.foreground.columns = tdata.columns; + local frame = 1 + region.foreground = region.foreground or {} + local tdata = texture_data[data.foregroundTexture] + if tdata then + local lastFrame = tdata.count - 1 + region.startFrame = floor((data.startPercent or 0) * lastFrame) + 1 + region.endFrame = floor((data.endPercent or 1) * lastFrame) + 1 + region.foreground.rows = tdata.rows + region.foreground.columns = tdata.columns + region.foreground.fileWidth = 0 + region.foreground.fileHeight = 0 + region.foreground.frameWidth = 0 + region.foreground.frameHeight = 0 + else + local pattern = "%.x(%d+)y(%d+)f(%d+)%.[tb][gl][ap]" + local pattern2 = "%.x(%d+)y(%d+)f(%d+)w(%d+)h(%d+)W(%d+)H(%d+)%.[tb][gl][ap]" + local rows, columns, frames = data.foregroundTexture:lower():match(pattern) + if rows then + local lastFrame = frames - 1 + region.startFrame = floor((data.startPercent or 0) * lastFrame) + 1 + region.endFrame = floor((data.endPercent or 1) * lastFrame) + 1 + region.foreground.rows = tonumber(rows) + region.foreground.columns = tonumber(columns) region.foreground.fileWidth = 0 region.foreground.fileHeight = 0 region.foreground.frameWidth = 0 region.foreground.frameHeight = 0 else - local pattern = "%.x(%d+)y(%d+)f(%d+)%.[tb][gl][ap]" - local pattern2 = "%.x(%d+)y(%d+)f(%d+)w(%d+)h(%d+)W(%d+)H(%d+)%.[tb][gl][ap]" - local rows, columns, frames = data.foregroundTexture:lower():match(pattern) + local rows, columns, frames, frameWidth, frameHeight, fileWidth, fileHeight = data.foregroundTexture:match(pattern2) if rows then - local lastFrame = frames - 1; - region.startFrame = floor( (data.startPercent or 0) * lastFrame) + 1; - region.endFrame = floor( (data.endPercent or 1) * lastFrame) + 1; - region.foreground.rows = tonumber(rows); - region.foreground.columns = tonumber(columns); - region.foreground.fileWidth = 0 - region.foreground.fileHeight = 0 - region.foreground.frameWidth = 0 - region.foreground.frameHeight = 0 + local lastFrame = frames - 1 + region.startFrame = floor((data.startPercent or 0) * lastFrame) + 1 + region.endFrame = floor((data.endPercent or 1) * lastFrame) + 1 + region.foreground.rows = tonumber(rows) + region.foreground.columns = tonumber(columns) + region.foreground.fileWidth = tonumber(fileWidth) + region.foreground.fileHeight = tonumber(fileHeight) + region.foreground.frameWidth = tonumber(frameWidth) + region.foreground.frameHeight = tonumber(frameHeight) else - local rows, columns, frames, frameWidth, frameHeight, fileWidth, fileHeight = data.foregroundTexture:match(pattern2) - if rows then - local lastFrame = frames - 1; - region.startFrame = floor( (data.startPercent or 0) * lastFrame) + 1; - region.endFrame = floor( (data.endPercent or 1) * lastFrame) + 1; - region.foreground.rows = tonumber(rows) - region.foreground.columns = tonumber(columns) - region.foreground.fileWidth = tonumber(fileWidth) - region.foreground.fileHeight = tonumber(fileHeight) - region.foreground.frameWidth = tonumber(frameWidth) - region.foreground.frameHeight = tonumber(frameHeight) - else - local lastFrame = data.customForegroundFrames - 1; - region.startFrame = floor( (data.startPercent or 0) * lastFrame) + 1; - region.endFrame = floor( (data.endPercent or 1) * lastFrame) + 1; - region.foreground.rows = data.customForegroundRows; - region.foreground.columns = data.customForegroundColumns; - region.foreground.fileWidth = data.customForegroundFileWidth - region.foreground.fileHeight = data.customForegroundFileHeight - region.foreground.frameWidth = data.customForegroundFrameWidth - region.foreground.frameHeight = data.customForegroundFrameHeight - end + local lastFrame = data.customForegroundFrames - 1 + region.startFrame = floor((data.startPercent or 0) * lastFrame) + 1 + region.endFrame = floor((data.endPercent or 1) * lastFrame) + 1 + region.foreground.rows = data.customForegroundRows + region.foreground.columns = data.customForegroundColumns + region.foreground.fileWidth = data.customForegroundFileWidth + region.foreground.fileHeight = data.customForegroundFileHeight + region.foreground.frameWidth = data.customForegroundFrameWidth + region.foreground.frameHeight = data.customForegroundFrameHeight end end + end - if (region.startFrame and region.endFrame) then - frame = floor(region.startFrame + (region.endFrame - region.startFrame) * 0.75); - end + if region.startFrame and region.endFrame then + frame = floor(region.startFrame + (region.endFrame - region.startFrame) * 0.75) + end - local texture = data.foregroundTexture or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\stopmotion"; + local texture = data.foregroundTexture or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\stopmotion" - if (region.foreground.rows and region.foreground.columns) then - region.texture:SetTexture(texture); - local frameScaleW, frameScaleH = 1, 1 - if region.foreground.fileWidth and region.foreground.frameWidth and region.foreground.fileWidth > 0 and region.foreground.frameWidth > 0 then - frameScaleW = (region.foreground.frameWidth * region.foreground.columns) / region.foreground.fileWidth - end - if region.foreground.fileHeight and region.foreground.frameHeight and region.foreground.fileHeight > 0 and region.foreground.frameHeight > 0 then - frameScaleH = (region.foreground.frameHeight * region.foreground.rows) / region.foreground.fileHeight - end - setTile(region.texture, frame, region.foreground.rows, region.foreground.columns, frameScaleW, frameScaleH); + if region.foreground.rows and region.foreground.columns then + region.texture:SetTexture(texture) + local frameScaleW, frameScaleH = 1, 1 + if region.foreground.fileWidth and region.foreground.frameWidth and region.foreground.fileWidth > 0 and region.foreground.frameWidth > 0 then + frameScaleW = (region.foreground.frameWidth * region.foreground.columns) / region.foreground.fileWidth + end + if region.foreground.fileHeight and region.foreground.frameHeight and region.foreground.fileHeight > 0 and region.foreground.frameHeight > 0 then + frameScaleH = (region.foreground.frameHeight * region.foreground.rows) / region.foreground.fileHeight + end + setTile(region.texture, frame, region.foreground.rows, region.foreground.columns, frameScaleW, frameScaleH) - region.SetValue = function(self, percent) - local frame = floor(percent * (region.endFrame - region.startFrame) + region.startFrame); - setTile(self.texture, frame, region.foreground.rows, region.foreground.columns, frameScaleW, frameScaleH); - end - else - region.texture:SetTexture(texture .. format("%03d", frame)); - region.texture:SetTexCoord(0, 1, 0, 1); + region.SetValue = function(self, percent) + local frame = floor(percent * (region.endFrame - region.startFrame) + region.startFrame) + setTile(self.texture, frame, region.foreground.rows, region.foreground.columns, frameScaleW, frameScaleH) + end + else + region.texture:SetTexture(texture .. format("%03d", frame)) + region.texture:SetTexCoord(0, 1, 0, 1) - region.SetValue = function(self, percent) - local frame = floor(percent * (region.endFrame - region.startFrame) + region.startFrame); - self.texture:SetTexture((data.foregroundTexture) .. format("%03d", frame)); - end + region.SetValue = function(self, percent) + local frame = floor(percent * (region.endFrame - region.startFrame) + region.startFrame) + self.texture:SetTexture(data.foregroundTexture .. format("%03d", frame)) end + end - region.texture:SetVertexColor(data.foregroundColor[1], data.foregroundColor[2], data.foregroundColor[3], data.foregroundColor[4]); - region.texture:SetBlendMode(data.blendMode); + region.texture:SetVertexColor(data.foregroundColor[1], data.foregroundColor[2], data.foregroundColor[3], data.foregroundColor[4]) + region.texture:SetBlendMode(data.blendMode) - region.elapsed = 0; - region:SetScript("OnUpdate", function(self, elapsed) - region.elapsed = region.elapsed + elapsed; - if(region.elapsed > 4) then - region.elapsed = region.elapsed - 4; - end - region:SetValue(region.elapsed / 4); - end); + region.elapsed = 0 + region:SetScript("OnUpdate", function(self, elapsed) + region.elapsed = region.elapsed + elapsed + if region.elapsed > 4 then + region.elapsed = region.elapsed - 4 + end + region:SetValue(region.elapsed / 4) + end) end local function createIcon() - local data = { - height = 30, - width = 30, - foregroundTexture = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\stopmotion", - foregroundColor = {1, 1, 1, 1}, - blendMode = "ADD", - rotate = false, - rotation = 0, - startPercent = 0, - endPercent = 1, - backgroundPercent = 1, - animationType = "progress" - }; + local data = { + height = 30, + width = 30, + foregroundTexture = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\stopmotion", + foregroundColor = { 1, 1, 1, 1 }, + blendMode = "ADD", + rotate = false, + rotation = 0, + startPercent = 0, + endPercent = 1, + backgroundPercent = 1, + animationType = "progress", + } - local thumbnail = createThumbnail(); - modifyThumbnail(UIParent, thumbnail, data, nil, 75); + local thumbnail = createThumbnail() + modifyThumbnail(UIParent, thumbnail, data, nil, 75) - thumbnail.elapsed = 0; - thumbnail:SetScript("OnUpdate", function(self, elapsed) - thumbnail.elapsed = thumbnail.elapsed + elapsed; - if(thumbnail.elapsed > 2) then - thumbnail.elapsed = thumbnail.elapsed - 2; - end - thumbnail:SetValue(thumbnail.elapsed / 2); - end); + thumbnail.elapsed = 0 + thumbnail:SetScript("OnUpdate", function(self, elapsed) + thumbnail.elapsed = thumbnail.elapsed + elapsed + if thumbnail.elapsed > 2 then + thumbnail.elapsed = thumbnail.elapsed - 2 + end + thumbnail:SetValue(thumbnail.elapsed / 2) + end) - return thumbnail; + return thumbnail end -WeakAuras.RegisterRegionOptions("stopmotion", createOptions, createIcon, L["Stop Motion"], createThumbnail, modifyThumbnail, L["Shows a stop motion texture"]); +WeakAuras.RegisterRegionOptions("stopmotion", createOptions, createIcon, L["Stop Motion"], createThumbnail, modifyThumbnail, L["Shows a stop motion texture"]) diff --git a/WeakAurasOptions/RegionOptions/Text.lua b/WeakAurasOptions/RegionOptions/Text.lua index 7154b3ff8a..cf319eb4cd 100644 --- a/WeakAurasOptions/RegionOptions/Text.lua +++ b/WeakAurasOptions/RegionOptions/Text.lua @@ -1,10 +1,12 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... -local SharedMedia = LibStub("LibSharedMedia-3.0"); -local L = WeakAuras.L; +local SharedMedia = LibStub("LibSharedMedia-3.0") +local L = WeakAuras.L -local screenWidth = math.ceil(GetScreenWidth() / 20) * 20; +local screenWidth = math.ceil(GetScreenWidth() / 20) * 20 local indentWidth = 0.15 local hiddenFontExtra = function() @@ -25,23 +27,25 @@ local function createOptions(id, data) name = L["Display Text"], order = 10, get = function() - return data.displayText; + return data.displayText end, set = function(info, v) - data.displayText = OptionsPrivate.Private.ReplaceLocalizedRaidMarkers(v); - WeakAuras.Add(data); + data.displayText = OptionsPrivate.Private.ReplaceLocalizedRaidMarkers(v) + WeakAuras.Add(data) WeakAuras.ClearAndUpdateOptions(data.id) - WeakAuras.UpdateThumbnail(data); - OptionsPrivate.ResetMoverSizer(); + WeakAuras.UpdateThumbnail(data) + OptionsPrivate.ResetMoverSizer() end, }, customTextUpdate = { type = "select", width = WeakAuras.doubleWidth, - hidden = function() return not OptionsPrivate.Private.ContainsCustomPlaceHolder(data.displayText); end, + hidden = function() + return not OptionsPrivate.Private.ContainsCustomPlaceHolder(data.displayText) + end, name = L["Update Custom Text On..."], values = OptionsPrivate.Private.text_check_types, - order = 36 + order = 36, }, -- code editor added below @@ -51,7 +55,7 @@ local function createOptions(id, data) dialogControl = "LSM30_Font", name = L["Font"], order = 45, - values = AceGUIWidgetLSMlists.font + values = AceGUIWidgetLSMlists.font, }, fontSize = { type = "range", @@ -60,14 +64,14 @@ local function createOptions(id, data) order = 46, min = 6, softMax = 72, - step = 1 + step = 1, }, color = { type = "color", width = WeakAuras.normalWidth, name = L["Text Color"], hasAlpha = true, - order = 47 + order = 47, }, fontFlagsDescription = { @@ -77,9 +81,7 @@ local function createOptions(id, data) control = "WeakAurasExpandSmall", name = function() local textFlags = OptionsPrivate.Private.font_flags[data.outline] - local color = format("%02x%02x%02x%02x", - data.shadowColor[4] * 255, data.shadowColor[1] * 255, - data.shadowColor[2] * 255, data.shadowColor[3]*255) + local color = format("%02x%02x%02x%02x", data.shadowColor[4] * 255, data.shadowColor[1] * 255, data.shadowColor[2] * 255, data.shadowColor[3] * 255) local textJustify = "" if data.justify == "CENTER" then @@ -87,7 +89,7 @@ local function createOptions(id, data) elseif data.justify == "LEFT" then textJustify = " " .. L["and aligned left"] elseif data.justify == "RIGHT" then - textJustify = " " .. L["and aligned right"] + textJustify = " " .. L["and aligned right"] end local textWidth = "" @@ -98,10 +100,17 @@ local function createOptions(id, data) else wordWarp = L["eliding"] end - textWidth = " "..L["and with width |cFFFF0000%s|r and %s"]:format(data.fixedWidth, wordWarp) + textWidth = " " .. L["and with width |cFFFF0000%s|r and %s"]:format(data.fixedWidth, wordWarp) end - local secondline = L["|cFFffcc00Font Flags:|r |cFFFF0000%s|r and shadow |c%sColor|r with offset |cFFFF0000%s/%s|r%s%s"]:format(textFlags, color, data.shadowXOffset, data.shadowYOffset, textJustify, textWidth) + local secondline = L["|cFFffcc00Font Flags:|r |cFFFF0000%s|r and shadow |c%sColor|r with offset |cFFFF0000%s/%s|r%s%s"]:format( + textFlags, + color, + data.shadowXOffset, + data.shadowYOffset, + textJustify, + textWidth + ) return secondline end, @@ -116,8 +125,8 @@ local function createOptions(id, data) imageWidth = 15, imageHeight = 15, arg = { - expanderName = "text" - } + expanderName = "text", + }, }, text_font_space = { @@ -125,7 +134,7 @@ local function createOptions(id, data) name = "", order = 48.1, hidden = hiddenFontExtra, - width = indentWidth + width = indentWidth, }, outline = { type = "select", @@ -133,7 +142,7 @@ local function createOptions(id, data) name = L["Outline"], order = 48.2, values = OptionsPrivate.Private.font_flags, - hidden = hiddenFontExtra + hidden = hiddenFontExtra, }, shadowColor = { type = "color", @@ -141,7 +150,7 @@ local function createOptions(id, data) width = WeakAuras.normalWidth, name = L["Shadow Color"], order = 48.3, - hidden = hiddenFontExtra + hidden = hiddenFontExtra, }, text_font_space3 = { @@ -149,7 +158,7 @@ local function createOptions(id, data) name = "", order = 48.4, hidden = hiddenFontExtra, - width = indentWidth + width = indentWidth, }, shadowXOffset = { type = "range", @@ -159,7 +168,7 @@ local function createOptions(id, data) softMax = 15, bigStep = 1, order = 48.5, - hidden = hiddenFontExtra + hidden = hiddenFontExtra, }, shadowYOffset = { type = "range", @@ -169,7 +178,7 @@ local function createOptions(id, data) softMax = 15, bigStep = 1, order = 48.6, - hidden = hiddenFontExtra + hidden = hiddenFontExtra, }, text_font_space4 = { @@ -177,7 +186,7 @@ local function createOptions(id, data) name = "", order = 48.7, hidden = hiddenFontExtra, - width = indentWidth + width = indentWidth, }, justify = { type = "select", @@ -192,7 +201,7 @@ local function createOptions(id, data) name = "", order = 48.85, hidden = hiddenFontExtra, - width = WeakAuras.normalWidth + width = WeakAuras.normalWidth, }, text_font_space5 = { @@ -200,7 +209,7 @@ local function createOptions(id, data) name = "", order = 48.9, hidden = hiddenFontExtra, - width = indentWidth + width = indentWidth, }, automaticWidth = { type = "select", @@ -218,14 +227,18 @@ local function createOptions(id, data) min = 1, softMax = screenWidth, bigStep = 1, - hidden = function() return hiddenFontExtra() or data.automaticWidth ~= "Fixed" end + hidden = function() + return hiddenFontExtra() or data.automaticWidth ~= "Fixed" + end, }, text_font_space7 = { type = "description", name = "", order = 49.3, width = indentWidth, - hidden = function() return hiddenFontExtra() or data.automaticWidth ~= "Fixed" end + hidden = function() + return hiddenFontExtra() or data.automaticWidth ~= "Fixed" + end, }, wordWrap = { type = "select", @@ -233,7 +246,9 @@ local function createOptions(id, data) name = L["Overflow"], order = 49.4, values = OptionsPrivate.Private.text_word_wrap, - hidden = function() return hiddenFontExtra() or data.automaticWidth ~= "Fixed" end + hidden = function() + return hiddenFontExtra() or data.automaticWidth ~= "Fixed" + end, }, fontExtraAnchor = { @@ -243,16 +258,18 @@ local function createOptions(id, data) hidden = hiddenFontExtra, control = "WeakAurasExpandAnchor", arg = { - expanderName = "text" - } + expanderName = "text", + }, }, useTooltip = { type = "toggle", width = WeakAuras.normalWidth, name = L["Tooltip on Mouseover"], - hidden = function() return not OptionsPrivate.Private.CanHaveTooltip(data) end, - order = 51 + hidden = function() + return not OptionsPrivate.Private.CanHaveTooltip(data) + end, + order = 51, }, endHeader = { @@ -260,10 +277,21 @@ local function createOptions(id, data) order = 100, name = "", }, - }; + } - OptionsPrivate.commonOptions.AddCodeOption(options, data, L["Custom Function"], "customText", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-text", - 37, function() return not OptionsPrivate.Private.ContainsCustomPlaceHolder(data.displayText) end, {"customText"}, false); + OptionsPrivate.commonOptions.AddCodeOption( + options, + data, + L["Custom Function"], + "customText", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-text", + 37, + function() + return not OptionsPrivate.Private.ContainsCustomPlaceHolder(data.displayText) + end, + { "customText" }, + false + ) -- Add Text Format Options local hidden = function() @@ -307,121 +335,129 @@ local function createOptions(id, data) type = "description", name = "", width = WeakAuras.doubleWidth, - hidden = hidden + hidden = hidden, }) return { - text = options; - position = OptionsPrivate.commonOptions.PositionOptions(id, data, nil, true); - }; + text = options, + position = OptionsPrivate.commonOptions.PositionOptions(id, data, nil, true), + } end local function createThumbnail() - local borderframe = CreateFrame("Frame", nil, UIParent); - borderframe:SetWidth(32); - borderframe:SetHeight(32); + local borderframe = CreateFrame("Frame", nil, UIParent) + borderframe:SetWidth(32) + borderframe:SetHeight(32) - local border = borderframe:CreateTexture(nil, "OVERLAY"); - border:SetAllPoints(borderframe); - border:SetTexture("Interface\\BUTTONS\\UI-Quickslot2.blp"); - border:SetTexCoord(0.2, 0.8, 0.2, 0.8); + local border = borderframe:CreateTexture(nil, "OVERLAY") + border:SetAllPoints(borderframe) + border:SetTexture("Interface\\BUTTONS\\UI-Quickslot2.blp") + border:SetTexCoord(0.2, 0.8, 0.2, 0.8) - local mask = CreateFrame("ScrollFrame", nil, borderframe); - borderframe.mask = mask; - mask:SetPoint("BOTTOMLEFT", borderframe, "BOTTOMLEFT", 2, 2); - mask:SetPoint("TOPRIGHT", borderframe, "TOPRIGHT", -2, -2); + local mask = CreateFrame("ScrollFrame", nil, borderframe) + borderframe.mask = mask + mask:SetPoint("BOTTOMLEFT", borderframe, "BOTTOMLEFT", 2, 2) + mask:SetPoint("TOPRIGHT", borderframe, "TOPRIGHT", -2, -2) - local content = CreateFrame("Frame", nil, mask); - borderframe.content = content; - content:SetPoint("CENTER", mask, "CENTER"); - mask:SetScrollChild(content); + local content = CreateFrame("Frame", nil, mask) + borderframe.content = content + content:SetPoint("CENTER", mask, "CENTER") + mask:SetScrollChild(content) - local text = content:CreateFontString(nil, "OVERLAY"); - borderframe.text = text; - text:SetNonSpaceWrap(true); + local text = content:CreateFontString(nil, "OVERLAY") + borderframe.text = text + text:SetNonSpaceWrap(true) - borderframe.values = {}; + borderframe.values = {} - return borderframe; + return borderframe end local function modifyThumbnail(parent, borderframe, data, fullModify, size) - local mask, content, text = borderframe.mask, borderframe.content, borderframe.text; + local mask, content, text = borderframe.mask, borderframe.content, borderframe.text - size = size or 28; + size = size or 28 - local fontPath = SharedMedia:Fetch("font", data.font) or data.font; - text:SetFont(fontPath, data.fontSize, data.outline and "OUTLINE" or nil); - text:SetTextHeight(data.fontSize); - text:SetText(data.displayText); - text:SetTextColor(data.color[1], data.color[2], data.color[3], data.color[4]); - text:SetJustifyH(data.justify); + local fontPath = SharedMedia:Fetch("font", data.font) or data.font + text:SetFont(fontPath, data.fontSize, data.outline and "OUTLINE" or nil) + text:SetTextHeight(data.fontSize) + text:SetText(data.displayText) + text:SetTextColor(data.color[1], data.color[2], data.color[3], data.color[4]) + text:SetJustifyH(data.justify) - text:ClearAllPoints(); - text:SetPoint("CENTER", UIParent, "CENTER"); - content:SetWidth(math.max(text:GetStringWidth(), size)); - content:SetHeight(math.max(text:GetStringHeight(), size)); - text:ClearAllPoints(); - text:SetPoint("CENTER", content, "CENTER"); + text:ClearAllPoints() + text:SetPoint("CENTER", UIParent, "CENTER") + content:SetWidth(math.max(text:GetStringWidth(), size)) + content:SetHeight(math.max(text:GetStringHeight(), size)) + text:ClearAllPoints() + text:SetPoint("CENTER", content, "CENTER") local function rescroll() - content:SetWidth(math.max(text:GetStringWidth(), size)); - content:SetHeight(math.max(text:GetStringHeight(), size)); - local xo = 0; - if(data.justify == "CENTER") then - xo = mask:GetHorizontalScrollRange() / 2; - elseif(data.justify == "RIGHT") then - xo = mask:GetHorizontalScrollRange(); + content:SetWidth(math.max(text:GetStringWidth(), size)) + content:SetHeight(math.max(text:GetStringHeight(), size)) + local xo = 0 + if data.justify == "CENTER" then + xo = mask:GetHorizontalScrollRange() / 2 + elseif data.justify == "RIGHT" then + xo = mask:GetHorizontalScrollRange() end - mask:SetHorizontalScroll(xo); - mask:SetVerticalScroll(mask:GetVerticalScrollRange() / 2); + mask:SetHorizontalScroll(xo) + mask:SetVerticalScroll(mask:GetVerticalScrollRange() / 2) end - rescroll(); - mask:SetScript("OnScrollRangeChanged", rescroll); + rescroll() + mask:SetScript("OnScrollRangeChanged", rescroll) local function UpdateText() - local textStr = data.displayText; - text:SetText(textStr); - rescroll(); + local textStr = data.displayText + text:SetText(textStr) + rescroll() end function borderframe:SetIcon(path) - UpdateText(); + UpdateText() end function borderframe:SetName(name) - UpdateText(); + UpdateText() end - UpdateText(); + UpdateText() end local function createIcon() local data = { outline = true, - color = {1, 1, 0, 1}, + color = { 1, 1, 0, 1 }, justify = "CENTER", font = "Friz Quadrata TT", fontSize = 12, - displayText = "World\nof\nWarcraft"; - }; + displayText = "World\nof\nWarcraft", + } - local thumbnail = createThumbnail(); - modifyThumbnail(UIParent, thumbnail, data); - thumbnail.mask:SetPoint("BOTTOMLEFT", thumbnail, "BOTTOMLEFT", 3, 3); - thumbnail.mask:SetPoint("TOPRIGHT", thumbnail, "TOPRIGHT", -3, -3); + local thumbnail = createThumbnail() + modifyThumbnail(UIParent, thumbnail, data) + thumbnail.mask:SetPoint("BOTTOMLEFT", thumbnail, "BOTTOMLEFT", 3, 3) + thumbnail.mask:SetPoint("TOPRIGHT", thumbnail, "TOPRIGHT", -3, -3) - return thumbnail; + return thumbnail end local templates = { { title = L["Default"], description = L["Displays a text, works best in combination with other displays"], - data = { - }; - } + data = {}, + }, } -WeakAuras.RegisterRegionOptions("text", createOptions, createIcon, L["Text"], createThumbnail, modifyThumbnail, L["Shows one or more lines of text, which can include dynamic information such as progress or stacks"], templates); +WeakAuras.RegisterRegionOptions( + "text", + createOptions, + createIcon, + L["Text"], + createThumbnail, + modifyThumbnail, + L["Shows one or more lines of text, which can include dynamic information such as progress or stacks"], + templates +) diff --git a/WeakAurasOptions/RegionOptions/Texture.lua b/WeakAurasOptions/RegionOptions/Texture.lua index 0d9c50c919..e461919ed1 100644 --- a/WeakAurasOptions/RegionOptions/Texture.lua +++ b/WeakAurasOptions/RegionOptions/Texture.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... local L = WeakAuras.L @@ -11,7 +13,7 @@ local function createOptions(id, data) type = "input", width = WeakAuras.doubleWidth - 0.15, name = L["Texture"], - order = 1 + order = 1, }, chooseTexture = { type = "execute", @@ -26,8 +28,8 @@ local function createOptions(id, data) discrete_rotation = "discrete_rotation", rotation = "rotation", mirror = "mirror", - blendMode = "blendMode" - }, OptionsPrivate.Private.texture_types); + blendMode = "blendMode", + }, OptionsPrivate.Private.texture_types) end, imageWidth = 24, imageHeight = 24, @@ -45,27 +47,29 @@ local function createOptions(id, data) name = "", width = WeakAuras.normalWidth, order = 5, - image = function() return "", 0, 0 end, + image = function() + return "", 0, 0 + end, }, color = { type = "color", width = WeakAuras.normalWidth, name = L["Color"], hasAlpha = true, - order = 10 + order = 10, }, blendMode = { type = "select", width = WeakAuras.normalWidth, name = L["Blend Mode"], order = 12, - values = OptionsPrivate.Private.blend_types + values = OptionsPrivate.Private.blend_types, }, mirror = { type = "toggle", width = WeakAuras.normalWidth, name = L["Mirror"], - order = 20 + order = 20, }, alpha = { type = "range", @@ -75,13 +79,13 @@ local function createOptions(id, data) min = 0, max = 1, bigStep = 0.01, - isPercent = true + isPercent = true, }, rotate = { type = "toggle", width = WeakAuras.normalWidth, name = L["Allow Full Rotation"], - order = 30 + order = 30, }, rotation = { type = "range", @@ -92,7 +96,9 @@ local function createOptions(id, data) step = 1, bigStep = 3, order = 35, - hidden = function() return not data.rotate end + hidden = function() + return not data.rotate + end, }, discrete_rotation = { type = "range", @@ -102,84 +108,86 @@ local function createOptions(id, data) max = 360, step = 90, order = 35, - hidden = function() return data.rotate end + hidden = function() + return data.rotate + end, }, textureWrapMode = { type = "select", width = WeakAuras.normalWidth, name = L["Texture Wrap"], order = 36, - values = OptionsPrivate.Private.texture_wrap_types + values = OptionsPrivate.Private.texture_wrap_types, }, endHeader = { type = "header", order = 100, name = "", }, - }; + } return { texture = options, position = OptionsPrivate.commonOptions.PositionOptions(id, data), - }; + } end local function createThumbnail() - local borderframe = CreateFrame("Frame", nil, UIParent); - borderframe:SetWidth(32); - borderframe:SetHeight(32); + local borderframe = CreateFrame("Frame", nil, UIParent) + borderframe:SetWidth(32) + borderframe:SetHeight(32) - local border = borderframe:CreateTexture(nil, "OVERLAY"); - border:SetAllPoints(borderframe); - border:SetTexture("Interface\\BUTTONS\\UI-Quickslot2.blp"); - border:SetTexCoord(0.2, 0.8, 0.2, 0.8); + local border = borderframe:CreateTexture(nil, "OVERLAY") + border:SetAllPoints(borderframe) + border:SetTexture("Interface\\BUTTONS\\UI-Quickslot2.blp") + border:SetTexCoord(0.2, 0.8, 0.2, 0.8) - local texture = borderframe:CreateTexture(); - borderframe.texture = texture; - texture:SetPoint("CENTER", borderframe, "CENTER"); + local texture = borderframe:CreateTexture() + borderframe.texture = texture + texture:SetPoint("CENTER", borderframe, "CENTER") - return borderframe; + return borderframe end local function modifyThumbnail(parent, region, data, fullModify, size) - size = size or 30; - local scale; - if(data.height > data.width) then - scale = size/data.height; - region.texture:SetWidth(scale * data.width); - region.texture:SetHeight(size); + size = size or 30 + local scale + if data.height > data.width then + scale = size / data.height + region.texture:SetWidth(scale * data.width) + region.texture:SetHeight(size) else - scale = size/data.width; - region.texture:SetWidth(size); - region.texture:SetHeight(scale * data.height); + scale = size / data.width + region.texture:SetWidth(size) + region.texture:SetHeight(scale * data.height) end - WeakAuras.SetTextureOrAtlas(region.texture, data.texture, data.textureWrapMode, data.textureWrapMode); - region.texture:SetVertexColor(data.color[1], data.color[2], data.color[3], data.color[4]); - region.texture:SetBlendMode(data.blendMode); + WeakAuras.SetTextureOrAtlas(region.texture, data.texture, data.textureWrapMode, data.textureWrapMode) + region.texture:SetVertexColor(data.color[1], data.color[2], data.color[3], data.color[4]) + region.texture:SetBlendMode(data.blendMode) - local ulx,uly , llx,lly , urx,ury , lrx,lry; - if(data.rotate) then - local angle = rad(135 - data.rotation); - local vx = math.cos(angle); - local vy = math.sin(angle); + local ulx, uly, llx, lly, urx, ury, lrx, lry + if data.rotate then + local angle = rad(135 - data.rotation) + local vx = math.cos(angle) + local vy = math.sin(angle) - ulx,uly , llx,lly , urx,ury , lrx,lry = 0.5+vx,0.5-vy , 0.5-vy,0.5-vx , 0.5+vy,0.5+vx , 0.5-vx,0.5+vy; + ulx, uly, llx, lly, urx, ury, lrx, lry = 0.5 + vx, 0.5 - vy, 0.5 - vy, 0.5 - vx, 0.5 + vy, 0.5 + vx, 0.5 - vx, 0.5 + vy else - if(data.discrete_rotation == 0 or data.discrete_rotation == 360) then - ulx,uly , llx,lly , urx,ury , lrx,lry = 0,0 , 0,1 , 1,0 , 1,1; - elseif(data.discrete_rotation == 90) then - ulx,uly , llx,lly , urx,ury , lrx,lry = 1,0 , 0,0 , 1,1 , 0,1; - elseif(data.discrete_rotation == 180) then - ulx,uly , llx,lly , urx,ury , lrx,lry = 1,1 , 1,0 , 0,1 , 0,0; - elseif(data.discrete_rotation == 270) then - ulx,uly , llx,lly , urx,ury , lrx,lry = 0,1 , 1,1 , 0,0 , 1,0; + if data.discrete_rotation == 0 or data.discrete_rotation == 360 then + ulx, uly, llx, lly, urx, ury, lrx, lry = 0, 0, 0, 1, 1, 0, 1, 1 + elseif data.discrete_rotation == 90 then + ulx, uly, llx, lly, urx, ury, lrx, lry = 1, 0, 0, 0, 1, 1, 0, 1 + elseif data.discrete_rotation == 180 then + ulx, uly, llx, lly, urx, ury, lrx, lry = 1, 1, 1, 0, 0, 1, 0, 0 + elseif data.discrete_rotation == 270 then + ulx, uly, llx, lly, urx, ury, lrx, lry = 0, 1, 1, 1, 0, 0, 1, 0 end end - if(data.mirror) then - region.texture:SetTexCoord(urx,ury , lrx,lry , ulx,uly , llx,lly); + if data.mirror then + region.texture:SetTexCoord(urx, ury, lrx, lry, ulx, uly, llx, lly) else - region.texture:SetTexCoord(ulx,uly , llx,lly , urx,ury , lrx,lry); + region.texture:SetTexCoord(ulx, uly, llx, lly, urx, ury, lrx, lry) end end @@ -188,23 +196,22 @@ local function createIcon() height = 40, width = 40, texture = "Interface\\Addons\\WeakAuras\\PowerAurasMedia\\Auras\\Aura3", - color = {1, 1, 1, 1}, + color = { 1, 1, 1, 1 }, blendMode = "ADD", - rotate = true; - rotation = 0; - }; + rotate = true, + rotation = 0, + } - local thumbnail = createThumbnail(); - modifyThumbnail(UIParent, thumbnail, data, nil, 50); + local thumbnail = createThumbnail() + modifyThumbnail(UIParent, thumbnail, data, nil, 50) - return thumbnail; + return thumbnail end local templates = { { title = L["Default"], - data = { - }; + data = {}, }, { title = L["Star"], @@ -214,7 +221,7 @@ local templates = { width = 200, height = 200, discrete_rotation = 0, - } + }, }, { title = L["Leaf"], @@ -224,7 +231,7 @@ local templates = { width = 200, height = 200, discrete_rotation = 0, - } + }, }, { title = L["Hawk"], @@ -234,7 +241,7 @@ local templates = { width = 200, height = 200, discrete_rotation = 0, - } + }, }, { title = L["Low Mana"], @@ -244,7 +251,7 @@ local templates = { width = 200, height = 200, discrete_rotation = 0, - } + }, }, } @@ -252,4 +259,4 @@ if WeakAuras.IsClassic() then table.remove(templates, 2) end -WeakAuras.RegisterRegionOptions("texture", createOptions, createIcon, L["Texture"], createThumbnail, modifyThumbnail, L["Shows a custom texture"], templates); +WeakAuras.RegisterRegionOptions("texture", createOptions, createIcon, L["Texture"], createThumbnail, modifyThumbnail, L["Shows a custom texture"], templates) diff --git a/WeakAurasOptions/SubRegionOptions/Background.lua b/WeakAurasOptions/SubRegionOptions/Background.lua index 8ed24cac2e..c2aef5ec25 100644 --- a/WeakAurasOptions/SubRegionOptions/Background.lua +++ b/WeakAurasOptions/SubRegionOptions/Background.lua @@ -1,30 +1,32 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... -local L = WeakAuras.L; +local L = WeakAuras.L do local function subCreateOptions(parentData, data, index, subIndex) - local options = { - __title = L["Background"], - __order = 1, - __up = function() - for child in OptionsPrivate.Private.TraverseLeafsOrAura(parentData) do - OptionsPrivate.MoveSubRegionUp(child, index, "subbackground") - end - WeakAuras.ClearAndUpdateOptions(parentData.id) - end, - __down = function() - for child in OptionsPrivate.Private.TraverseLeafsOrAura(parentData) do - OptionsPrivate.MoveSubRegionDown(child, index, "subbackground") - end - WeakAuras.ClearAndUpdateOptions(parentData.id) - end, - __notcollapsable = true - } - return options - end + local options = { + __title = L["Background"], + __order = 1, + __up = function() + for child in OptionsPrivate.Private.TraverseLeafsOrAura(parentData) do + OptionsPrivate.MoveSubRegionUp(child, index, "subbackground") + end + WeakAuras.ClearAndUpdateOptions(parentData.id) + end, + __down = function() + for child in OptionsPrivate.Private.TraverseLeafsOrAura(parentData) do + OptionsPrivate.MoveSubRegionDown(child, index, "subbackground") + end + WeakAuras.ClearAndUpdateOptions(parentData.id) + end, + __notcollapsable = true, + } + return options + end - WeakAuras.RegisterSubRegionOptions("subbackground", subCreateOptions, L["Background"]); + WeakAuras.RegisterSubRegionOptions("subbackground", subCreateOptions, L["Background"]) end -- Foreground for aurabar @@ -46,10 +48,10 @@ do end WeakAuras.ClearAndUpdateOptions(parentData.id) end, - __notcollapsable = true + __notcollapsable = true, } return options end - WeakAuras.RegisterSubRegionOptions("subforeground", subCreateOptions, L["Foreground"]); -end \ No newline at end of file + WeakAuras.RegisterSubRegionOptions("subforeground", subCreateOptions, L["Foreground"]) +end diff --git a/WeakAurasOptions/SubRegionOptions/Border.lua b/WeakAurasOptions/SubRegionOptions/Border.lua index dd6df47210..5acc27e7e1 100644 --- a/WeakAurasOptions/SubRegionOptions/Border.lua +++ b/WeakAurasOptions/SubRegionOptions/Border.lua @@ -1,7 +1,9 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... -local L = WeakAuras.L; +local L = WeakAuras.L local function createOptions(parentData, data, index, subIndex) local options = { @@ -52,8 +54,10 @@ local function createOptions(parentData, data, index, subIndex) name = L["Border Anchor"], order = 7, values = OptionsPrivate.Private.aurabar_anchor_areas, - hidden = function() return parentData.regionType ~= "aurabar" end - } + hidden = function() + return parentData.regionType ~= "aurabar" + end, + }, } OptionsPrivate.AddUpDownDeleteDuplicate(options, parentData, index, "subborder") @@ -61,4 +65,4 @@ local function createOptions(parentData, data, index, subIndex) return options end -WeakAuras.RegisterSubRegionOptions("subborder", createOptions, L["Shows a border"]); +WeakAuras.RegisterSubRegionOptions("subborder", createOptions, L["Shows a border"]) diff --git a/WeakAurasOptions/SubRegionOptions/Glow.lua b/WeakAurasOptions/SubRegionOptions/Glow.lua index fcd8836f08..c70f6fa023 100644 --- a/WeakAurasOptions/SubRegionOptions/Glow.lua +++ b/WeakAurasOptions/SubRegionOptions/Glow.lua @@ -1,13 +1,14 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... -local L = WeakAuras.L; +local L = WeakAuras.L local indentWidth = 0.15 local function createOptions(parentData, data, index, subIndex) - local hiddenGlowExtra = function() - return OptionsPrivate.IsCollapsed("glow", "glow", "glowextra" .. index, true); + return OptionsPrivate.IsCollapsed("glow", "glow", "glowextra" .. index, true) end local options = { @@ -32,7 +33,9 @@ local function createOptions(parentData, data, index, subIndex) name = L["Glow Anchor"], order = 3, values = OptionsPrivate.Private.aurabar_anchor_areas, - hidden = function() return parentData.regionType ~= "aurabar" end + hidden = function() + return parentData.regionType ~= "aurabar" + end, }, glowExtraDescription = { type = "execute", @@ -41,35 +44,17 @@ local function createOptions(parentData, data, index, subIndex) local line = L["|cFFffcc00Extra Options:|r"] local color = L["Default Color"] if data.useGlowColor then - color = L["|c%02x%02x%02x%02xCustom Color|r"]:format( - data.glowColor[4] * 255, - data.glowColor[1] * 255, - data.glowColor[2] * 255, - data.glowColor[3] * 255 - ) + color = L["|c%02x%02x%02x%02xCustom Color|r"]:format(data.glowColor[4] * 255, data.glowColor[1] * 255, data.glowColor[2] * 255, data.glowColor[3] * 255) end if data.glowType == "buttonOverlay" then line = ("%s %s"):format(line, color) elseif data.glowType == "ACShine" then - line = L["%s %s, Particles: %d, Frequency: %0.2f, Scale: %0.2f"]:format( - line, - color, - data.glowLines, - data.glowFrequency, - data.glowScale - ) + line = L["%s %s, Particles: %d, Frequency: %0.2f, Scale: %0.2f"]:format(line, color, data.glowLines, data.glowFrequency, data.glowScale) if data.glowXOffset ~= 0 or data.glowYOffset ~= 0 then line = L["%s, offset: %0.2f;%0.2f"]:format(line, data.glowXOffset, data.glowYOffset) end elseif data.glowType == "Pixel" then - line = L["%s %s, Lines: %d, Frequency: %0.2f, Length: %d, Thickness: %d"]:format( - line, - color, - data.glowLines, - data.glowFrequency, - data.glowLength, - data.glowThickness - ) + line = L["%s %s, Lines: %d, Frequency: %0.2f, Length: %d, Thickness: %d"]:format(line, color, data.glowLines, data.glowFrequency, data.glowLength, data.glowThickness) if data.glowXOffset ~= 0 or data.glowYOffset ~= 0 then line = L["%s, Offset: %0.2f;%0.2f"]:format(line, data.glowXOffset, data.glowYOffset) end @@ -82,18 +67,18 @@ local function createOptions(parentData, data, index, subIndex) width = WeakAuras.doubleWidth, order = 4, image = function() - local collapsed = OptionsPrivate.IsCollapsed("glow", "glow", "glowextra" .. index, true); + local collapsed = OptionsPrivate.IsCollapsed("glow", "glow", "glowextra" .. index, true) return collapsed and "collapsed" or "expanded" end, imageWidth = 15, imageHeight = 15, func = function(info, button) - local collapsed = OptionsPrivate.IsCollapsed("glow", "glow", "glowextra" .. index, true); - OptionsPrivate.SetCollapsed("glow", "glow", "glowextra" .. index, not collapsed); + local collapsed = OptionsPrivate.IsCollapsed("glow", "glow", "glowextra" .. index, true) + OptionsPrivate.SetCollapsed("glow", "glow", "glowextra" .. index, not collapsed) end, arg = { - expanderName = "glow" .. index .. "#" .. subIndex - } + expanderName = "glow" .. index .. "#" .. subIndex, + }, }, glow_space1 = { type = "description", @@ -108,7 +93,7 @@ local function createOptions(parentData, data, index, subIndex) name = L["Use Custom Color"], desc = L["If unchecked, then a default color will be used (usually yellow)"], order = 6, - hidden = hiddenGlowExtra + hidden = hiddenGlowExtra, }, glowColor = { type = "color", @@ -116,8 +101,10 @@ local function createOptions(parentData, data, index, subIndex) width = WeakAuras.normalWidth, name = L["Custom Color"], order = 7, - disabled = function() return not data.useGlowColor end, - hidden = hiddenGlowExtra + disabled = function() + return not data.useGlowColor + end, + hidden = hiddenGlowExtra, }, glow_space2 = { type = "description", @@ -134,7 +121,9 @@ local function createOptions(parentData, data, index, subIndex) min = 1, softMax = 30, step = 1, - hidden = function() return hiddenGlowExtra() or data.glowType == "buttonOverlay" end, + hidden = function() + return hiddenGlowExtra() or data.glowType == "buttonOverlay" + end, }, glowFrequency = { type = "range", @@ -144,14 +133,18 @@ local function createOptions(parentData, data, index, subIndex) softMin = -2, softMax = 2, step = 0.05, - hidden = function() return hiddenGlowExtra() or data.glowType == "buttonOverlay" end, + hidden = function() + return hiddenGlowExtra() or data.glowType == "buttonOverlay" + end, }, glow_space3 = { type = "description", name = "", width = indentWidth, order = 11, - hidden = function() return hiddenGlowExtra() or data.glowType ~= "Pixel" end, + hidden = function() + return hiddenGlowExtra() or data.glowType ~= "Pixel" + end, }, glowLength = { type = "range", @@ -161,7 +154,9 @@ local function createOptions(parentData, data, index, subIndex) min = 1, softMax = 20, step = 0.05, - hidden = function() return hiddenGlowExtra() or data.glowType ~= "Pixel" end, + hidden = function() + return hiddenGlowExtra() or data.glowType ~= "Pixel" + end, }, glowThickness = { type = "range", @@ -171,7 +166,9 @@ local function createOptions(parentData, data, index, subIndex) min = 0.05, softMax = 20, step = 0.05, - hidden = function() return hiddenGlowExtra() or data.glowType ~= "Pixel" end, + hidden = function() + return hiddenGlowExtra() or data.glowType ~= "Pixel" + end, }, glow_space4 = { type = "description", @@ -188,7 +185,9 @@ local function createOptions(parentData, data, index, subIndex) softMin = -100, softMax = 100, step = 0.5, - hidden = function() return hiddenGlowExtra() or data.glowType == "buttonOverlay" end, + hidden = function() + return hiddenGlowExtra() or data.glowType == "buttonOverlay" + end, }, glowYOffset = { type = "range", @@ -198,7 +197,9 @@ local function createOptions(parentData, data, index, subIndex) softMin = -100, softMax = 100, step = 0.5, - hidden = function() return hiddenGlowExtra() or data.glowType == "buttonOverlay" end, + hidden = function() + return hiddenGlowExtra() or data.glowType == "buttonOverlay" + end, }, glow_space5 = { type = "description", @@ -216,14 +217,18 @@ local function createOptions(parentData, data, index, subIndex) softMax = 10, step = 0.05, isPercent = true, - hidden = function() return hiddenGlowExtra() or data.glowType ~= "ACShine" end, + hidden = function() + return hiddenGlowExtra() or data.glowType ~= "ACShine" + end, }, glowBorder = { type = "toggle", width = WeakAuras.normalWidth - indentWidth, name = L["Border"], order = 19, - hidden = function() return hiddenGlowExtra() or data.glowType ~= "Pixel" end, + hidden = function() + return hiddenGlowExtra() or data.glowType ~= "Pixel" + end, }, glow_expand_anchor = { @@ -233,9 +238,9 @@ local function createOptions(parentData, data, index, subIndex) hidden = hiddenGlowExtra, control = "WeakAurasExpandAnchor", arg = { - expanderName = "glow" .. index .. "#" .. subIndex - } - } + expanderName = "glow" .. index .. "#" .. subIndex, + }, + }, } OptionsPrivate.AddUpDownDeleteDuplicate(options, parentData, index, "subglow") @@ -243,4 +248,4 @@ local function createOptions(parentData, data, index, subIndex) return options end -WeakAuras.RegisterSubRegionOptions("subglow", createOptions, L["Shows a glow"]); +WeakAuras.RegisterSubRegionOptions("subglow", createOptions, L["Shows a glow"]) diff --git a/WeakAurasOptions/SubRegionOptions/Model.lua b/WeakAurasOptions/SubRegionOptions/Model.lua index 140905f1d4..6cdd933d62 100644 --- a/WeakAurasOptions/SubRegionOptions/Model.lua +++ b/WeakAurasOptions/SubRegionOptions/Model.lua @@ -1,7 +1,9 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... -local L = WeakAuras.L; +local L = WeakAuras.L local function createOptions(parentData, data, index, subIndex) local options = { @@ -17,23 +19,23 @@ local function createOptions(parentData, data, index, subIndex) type = "input", width = WeakAuras.doubleWidth - 0.15, name = L["Model"], - order = 10, - hidden = WeakAuras.IsClassic() + order = 10, + hidden = WeakAuras.IsClassic(), }, model_path = { type = "input", width = WeakAuras.doubleWidth - 0.15, name = L["Model"], - order = 10.5, - hidden = not WeakAuras.IsClassic() + order = 10.5, + hidden = not WeakAuras.IsClassic(), }, chooseModel = { type = "execute", width = 0.15, name = L["Choose"], - order = 11, + order = 11, func = function() - OptionsPrivate.OpenModelPicker(parentData, {"subRegions", index}); + OptionsPrivate.OpenModelPicker(parentData, { "subRegions", index }) end, imageWidth = 24, imageHeight = 24, @@ -45,7 +47,9 @@ local function createOptions(parentData, data, index, subIndex) width = WeakAuras.doubleWidth, name = L["Clipped by Progress"], order = 12, - hidden = function() return parentData.regionType ~= "aurabar" end + hidden = function() + return parentData.regionType ~= "aurabar" + end, }, extra_width = { type = "range", @@ -55,7 +59,9 @@ local function createOptions(parentData, data, index, subIndex) softMin = -100, softMax = 500, step = 1, - hidden = function() return data.bar_model_clip and parentData.regionType == "aurabar" end + hidden = function() + return data.bar_model_clip and parentData.regionType == "aurabar" + end, }, extra_height = { type = "range", @@ -65,7 +71,9 @@ local function createOptions(parentData, data, index, subIndex) softMin = -100, softMax = 500, step = 1, - hidden = function() return data.bar_model_clip and parentData.regionType == "aurabar" end + hidden = function() + return data.bar_model_clip and parentData.regionType == "aurabar" + end, }, model_alpha = { type = "range", @@ -74,13 +82,13 @@ local function createOptions(parentData, data, index, subIndex) order = 13, min = 0, max = 1, - bigStep = 0.1 + bigStep = 0.1, }, api = { type = "toggle", name = L["Use SetTransform"], order = 14, - width = WeakAuras.normalWidth + width = WeakAuras.normalWidth, }, model_z = { type = "range", @@ -88,10 +96,12 @@ local function createOptions(parentData, data, index, subIndex) name = L["Z Offset"], softMin = -20, softMax = 20, - step = .001, + step = 0.001, bigStep = 0.05, order = 20, - hidden = function() return data.api end + hidden = function() + return data.api + end, }, model_x = { type = "range", @@ -99,10 +109,12 @@ local function createOptions(parentData, data, index, subIndex) name = L["X Offset"], softMin = -20, softMax = 20, - step = .001, + step = 0.001, bigStep = 0.05, order = 30, - hidden = function() return data.api end + hidden = function() + return data.api + end, }, model_y = { type = "range", @@ -110,10 +122,12 @@ local function createOptions(parentData, data, index, subIndex) name = L["Y Offset"], softMin = -20, softMax = 20, - step = .001, + step = 0.001, bigStep = 0.05, order = 40, - hidden = function() return data.api end + hidden = function() + return data.api + end, }, rotation = { type = "range", @@ -124,7 +138,9 @@ local function createOptions(parentData, data, index, subIndex) step = 1, bigStep = 3, order = 45, - hidden = function() return data.api end + hidden = function() + return data.api + end, }, -- New Settings model_st_tx = { @@ -136,7 +152,9 @@ local function createOptions(parentData, data, index, subIndex) step = 1, bigStep = 5, order = 20, - hidden = function() return not data.api end + hidden = function() + return not data.api + end, }, model_st_ty = { type = "range", @@ -147,7 +165,9 @@ local function createOptions(parentData, data, index, subIndex) step = 1, bigStep = 5, order = 21, - hidden = function() return not data.api end + hidden = function() + return not data.api + end, }, model_st_tz = { type = "range", @@ -158,7 +178,9 @@ local function createOptions(parentData, data, index, subIndex) step = 1, bigStep = 5, order = 22, - hidden = function() return not data.api end + hidden = function() + return not data.api + end, }, model_st_rx = { type = "range", @@ -169,7 +191,9 @@ local function createOptions(parentData, data, index, subIndex) step = 1, bigStep = 3, order = 23, - hidden = function() return not data.api end + hidden = function() + return not data.api + end, }, model_st_ry = { type = "range", @@ -180,7 +204,9 @@ local function createOptions(parentData, data, index, subIndex) step = 1, bigStep = 3, order = 24, - hidden = function() return not data.api end + hidden = function() + return not data.api + end, }, model_st_rz = { type = "range", @@ -191,7 +217,9 @@ local function createOptions(parentData, data, index, subIndex) step = 1, bigStep = 3, order = 25, - hidden = function() return not data.api end + hidden = function() + return not data.api + end, }, model_st_us = { type = "range", @@ -202,7 +230,9 @@ local function createOptions(parentData, data, index, subIndex) step = 0.1, bigStep = 5, order = 26, - hidden = function() return not data.api end + hidden = function() + return not data.api + end, }, } @@ -211,4 +241,4 @@ local function createOptions(parentData, data, index, subIndex) return options end -WeakAuras.RegisterSubRegionOptions("submodel", createOptions, L["Shows a model"]); +WeakAuras.RegisterSubRegionOptions("submodel", createOptions, L["Shows a model"]) diff --git a/WeakAurasOptions/SubRegionOptions/SubRegionCommon.lua b/WeakAurasOptions/SubRegionOptions/SubRegionCommon.lua index 8197233131..e110a6e959 100644 --- a/WeakAurasOptions/SubRegionOptions/SubRegionCommon.lua +++ b/WeakAurasOptions/SubRegionOptions/SubRegionCommon.lua @@ -1,11 +1,13 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... -- Magic constant local deleteCondition = {} local function AdjustConditions(data, replacements) - if (data.conditions) then + if data.conditions then for conditionIndex, condition in ipairs(data.conditions) do for changeIndex, change in ipairs(condition.changes) do if change.property then @@ -31,14 +33,14 @@ function WeakAuras.DeleteSubRegion(data, index, regionType) tremove(data.subRegions, index) local replacements = { - ["sub." .. index .. "."] = deleteCondition + ["sub." .. index .. "."] = deleteCondition, } for i = index + 1, #data.subRegions + 1 do replacements["sub." .. i .. "."] = "sub." .. (i - 1) .. "." end - AdjustConditions(data, replacements); + AdjustConditions(data, replacements) WeakAuras.Add(data) OptionsPrivate.ClearOptions(data.id) @@ -53,11 +55,11 @@ function OptionsPrivate.MoveSubRegionUp(data, index, regionType) data.subRegions[index - 1], data.subRegions[index] = data.subRegions[index], data.subRegions[index - 1] local replacements = { - ["sub." .. (index -1) .. "."] = "sub." .. index .. ".", + ["sub." .. (index - 1) .. "."] = "sub." .. index .. ".", ["sub." .. index .. "."] = "sub." .. (index - 1) .. ".", } - AdjustConditions(data, replacements); + AdjustConditions(data, replacements) WeakAuras.Add(data) OptionsPrivate.ClearOptions(data.id) @@ -76,7 +78,7 @@ function OptionsPrivate.MoveSubRegionDown(data, index, regionType) ["sub." .. (index + 1) .. "."] = "sub." .. index .. ".", } - AdjustConditions(data, replacements); + AdjustConditions(data, replacements) WeakAuras.Add(data) OptionsPrivate.ClearOptions(data.id) @@ -90,12 +92,11 @@ function OptionsPrivate.DuplicateSubRegion(data, index, regionType) if data.subRegions[index] and data.subRegions[index].type == regionType then tinsert(data.subRegions, index, CopyTable(data.subRegions[index])) - local replacements = {} for i = index + 1, #data.subRegions do replacements["sub." .. i .. "."] = "sub." .. (i + 1) .. "." end - AdjustConditions(data, replacements); + AdjustConditions(data, replacements) WeakAuras.Add(data) OptionsPrivate.ClearOptions(data.id) diff --git a/WeakAurasOptions/SubRegionOptions/SubText.lua b/WeakAurasOptions/SubRegionOptions/SubText.lua index dd4e89ab88..6ec7f7374e 100644 --- a/WeakAurasOptions/SubRegionOptions/SubText.lua +++ b/WeakAurasOptions/SubRegionOptions/SubText.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... local L = WeakAuras.L @@ -15,7 +17,7 @@ local self_point_types = { TOPLEFT = L["Top Left"], LEFT = L["Left"], CENTER = L["Center"], - AUTO = L["Automatic"] + AUTO = L["Automatic"], } local function createOptions(parentData, data, index, subIndex) @@ -55,7 +57,7 @@ local function createOptions(parentData, data, index, subIndex) data.text_text = OptionsPrivate.Private.ReplaceLocalizedRaidMarkers(v) WeakAuras.Add(parentData) WeakAuras.ClearAndUpdateOptions(parentData.id) - end + end, }, text_font = { type = "select", @@ -79,9 +81,7 @@ local function createOptions(parentData, data, index, subIndex) control = "WeakAurasExpandSmall", name = function() local textFlags = OptionsPrivate.Private.font_flags[data.text_fontType] - local color = format("%02x%02x%02x%02x", - data.text_shadowColor[4] * 255, data.text_shadowColor[1] * 255, - data.text_shadowColor[2] * 255, data.text_shadowColor[3]*255) + local color = format("%02x%02x%02x%02x", data.text_shadowColor[4] * 255, data.text_shadowColor[1] * 255, data.text_shadowColor[2] * 255, data.text_shadowColor[3] * 255) local textJustify = "" if data.text_justify == "CENTER" then @@ -89,7 +89,7 @@ local function createOptions(parentData, data, index, subIndex) elseif data.text_justify == "LEFT" then textJustify = " " .. L["and aligned left"] elseif data.text_justify == "RIGHT" then - textJustify = " " .. L["and aligned right"] + textJustify = " " .. L["and aligned right"] end local textRotate = "" @@ -107,10 +107,18 @@ local function createOptions(parentData, data, index, subIndex) else wordWarp = L["eliding"] end - textWidth = " "..L["and with width |cFFFF0000%s|r and %s"]:format(data.text_fixedWidth, wordWarp) + textWidth = " " .. L["and with width |cFFFF0000%s|r and %s"]:format(data.text_fixedWidth, wordWarp) end - local secondline = L["|cFFffcc00Font Flags:|r |cFFFF0000%s|r and shadow |c%sColor|r with offset |cFFFF0000%s/%s|r%s%s%s"]:format(textFlags, color, data.text_shadowXOffset, data.text_shadowYOffset, textRotate, textJustify, textWidth) + local secondline = L["|cFFffcc00Font Flags:|r |cFFFF0000%s|r and shadow |c%sColor|r with offset |cFFFF0000%s/%s|r%s%s%s"]:format( + textFlags, + color, + data.text_shadowXOffset, + data.text_shadowYOffset, + textRotate, + textJustify, + textWidth + ) return secondline end, @@ -127,8 +135,8 @@ local function createOptions(parentData, data, index, subIndex) imageWidth = 15, imageHeight = 15, arg = { - expanderName = "subtext" .. index .. "#" .. subIndex - } + expanderName = "subtext" .. index .. "#" .. subIndex, + }, }, text_font_space = { @@ -136,7 +144,7 @@ local function createOptions(parentData, data, index, subIndex) name = "", order = 45, hidden = hiddenFontExtra, - width = indentWidth + width = indentWidth, }, text_fontType = { @@ -145,7 +153,7 @@ local function createOptions(parentData, data, index, subIndex) name = L["Outline"], order = 46, values = OptionsPrivate.Private.font_flags, - hidden = hiddenFontExtra + hidden = hiddenFontExtra, }, text_shadowColor = { type = "color", @@ -153,7 +161,7 @@ local function createOptions(parentData, data, index, subIndex) width = WeakAuras.normalWidth, name = L["Shadow Color"], order = 47, - hidden = hiddenFontExtra + hidden = hiddenFontExtra, }, text_font_space3 = { @@ -161,7 +169,7 @@ local function createOptions(parentData, data, index, subIndex) name = "", order = 47.5, hidden = hiddenFontExtra, - width = indentWidth + width = indentWidth, }, text_shadowXOffset = { type = "range", @@ -171,7 +179,7 @@ local function createOptions(parentData, data, index, subIndex) softMax = 15, bigStep = 1, order = 48, - hidden = hiddenFontExtra + hidden = hiddenFontExtra, }, text_shadowYOffset = { type = "range", @@ -181,7 +189,7 @@ local function createOptions(parentData, data, index, subIndex) softMax = 15, bigStep = 1, order = 49, - hidden = hiddenFontExtra + hidden = hiddenFontExtra, }, text_font_space4 = { @@ -189,7 +197,7 @@ local function createOptions(parentData, data, index, subIndex) name = "", order = 49.5, hidden = hiddenFontExtra, - width = indentWidth + width = indentWidth, }, rotateText = { type = "select", @@ -197,7 +205,7 @@ local function createOptions(parentData, data, index, subIndex) name = L["Rotate Text"], values = OptionsPrivate.Private.text_rotate_types, order = 50, - hidden = hiddenFontExtra + hidden = hiddenFontExtra, }, text_justify = { type = "select", @@ -205,14 +213,14 @@ local function createOptions(parentData, data, index, subIndex) name = L["Alignment"], values = OptionsPrivate.Private.justify_types, order = 50.5, - hidden = hiddenFontExtra + hidden = hiddenFontExtra, }, text_font_space5 = { type = "description", name = "", order = 51, hidden = hiddenFontExtra, - width = indentWidth + width = indentWidth, }, text_automaticWidth = { type = "select", @@ -220,21 +228,23 @@ local function createOptions(parentData, data, index, subIndex) name = L["Width"], order = 51.5, values = OptionsPrivate.Private.text_automatic_width, - hidden = hiddenFontExtra + hidden = hiddenFontExtra, }, text_font_space6 = { type = "description", name = "", order = 52, hidden = hiddenFontExtra, - width = WeakAuras.normalWidth + width = WeakAuras.normalWidth, }, text_font_space7 = { type = "description", name = "", order = 52.5, width = indentWidth, - hidden = function() return hiddenFontExtra() or data.text_automaticWidth ~= "Fixed" end + hidden = function() + return hiddenFontExtra() or data.text_automaticWidth ~= "Fixed" + end, }, text_fixedWidth = { name = L["Width"], @@ -244,7 +254,9 @@ local function createOptions(parentData, data, index, subIndex) min = 1, softMax = 200, bigStep = 1, - hidden = function() return hiddenFontExtra() or data.text_automaticWidth ~= "Fixed" end + hidden = function() + return hiddenFontExtra() or data.text_automaticWidth ~= "Fixed" + end, }, text_wordWrap = { type = "select", @@ -252,7 +264,9 @@ local function createOptions(parentData, data, index, subIndex) name = L["Overflow"], order = 54, values = OptionsPrivate.Private.text_word_wrap, - hidden = function() return hiddenFontExtra() or data.text_automaticWidth ~= "Fixed" end + hidden = function() + return hiddenFontExtra() or data.text_automaticWidth ~= "Fixed" + end, }, text_anchor = { @@ -262,9 +276,9 @@ local function createOptions(parentData, data, index, subIndex) hidden = hiddenFontExtra, control = "WeakAurasExpandAnchor", arg = { - expanderName = "subtext" .. index .. "#" .. subIndex - } - } + expanderName = "subtext" .. index .. "#" .. subIndex, + }, + }, } -- Note: Anchor Options need to be generalized once there are multiple sub regions @@ -288,7 +302,7 @@ local function createOptions(parentData, data, index, subIndex) local xOffset = data.text_anchorXOffset or 0 local yOffset = data.text_anchorYOffset or 0 - if (type(anchorPoint) == "table") then + if type(anchorPoint) == "table" then anchorPoint = anchorPoint[1] .. "/" .. anchorPoint[2] end @@ -319,11 +333,10 @@ local function createOptions(parentData, data, index, subIndex) OptionsPrivate.SetCollapsed("subregion", "text_anchors", tostring(index), not collapsed) end, arg = { - expanderName = "subtext_anchor" .. index .. "#" .. subIndex - } + expanderName = "subtext_anchor" .. index .. "#" .. subIndex, + }, } - local hiddenFunction = function() return OptionsPrivate.IsCollapsed("subregion", "text_anchors", tostring(index), true) end @@ -333,7 +346,7 @@ local function createOptions(parentData, data, index, subIndex) name = "", order = 60.15, hidden = hiddenFunction, - width = indentWidth + width = indentWidth, } options.text_selfPoint = { @@ -342,7 +355,7 @@ local function createOptions(parentData, data, index, subIndex) name = L["Anchor"], order = 60.2, values = self_point_types, - hidden = hiddenFunction + hidden = hiddenFunction, } options.text_anchorPoint = { @@ -354,7 +367,7 @@ local function createOptions(parentData, data, index, subIndex) order = 60.3, values = anchors, hidden = hiddenFunction, - control = "WeakAurasTwoColumnDropdown" + control = "WeakAurasTwoColumnDropdown", } options.text_anchor_space2 = { @@ -362,7 +375,7 @@ local function createOptions(parentData, data, index, subIndex) name = "", order = 60.35, hidden = hiddenFunction, - width = indentWidth + width = indentWidth, } options.text_anchorXOffset = { @@ -373,7 +386,7 @@ local function createOptions(parentData, data, index, subIndex) softMin = (-1 * screenWidth), softMax = screenWidth, bigStep = 10, - hidden = hiddenFunction + hidden = hiddenFunction, } options.text_anchorYOffset = { @@ -384,7 +397,7 @@ local function createOptions(parentData, data, index, subIndex) softMin = (-1 * screenHeight), softMax = screenHeight, bigStep = 10, - hidden = hiddenFunction + hidden = hiddenFunction, } options.text_anchor_anchor = { @@ -394,8 +407,8 @@ local function createOptions(parentData, data, index, subIndex) hidden = hiddenFunction, control = "WeakAurasExpandAnchor", arg = { - expanderName = "subtext_anchor" .. index .. "#" .. subIndex - } + expanderName = "subtext_anchor" .. index .. "#" .. subIndex, + }, } local function hideCustomTextOption() @@ -413,7 +426,9 @@ local function createOptions(parentData, data, index, subIndex) local commonTextOptions = { __title = L["Common Text"], - __hidden = function() return hideCustomTextOption() end, + __hidden = function() + return hideCustomTextOption() + end, text_customTextUpdate = { type = "select", width = WeakAuras.doubleWidth, @@ -421,17 +436,28 @@ local function createOptions(parentData, data, index, subIndex) name = L["Update Custom Text On..."], values = OptionsPrivate.Private.text_check_types, order = 3, - get = function() return parentData.customTextUpdate or "event" end, + get = function() + return parentData.customTextUpdate or "event" + end, set = function(info, v) parentData.customTextUpdate = v WeakAuras.Add(parentData) WeakAuras.ClearAndUpdateOptions(parentData.id) - end + end, }, } - OptionsPrivate.commonOptions.AddCodeOption(commonTextOptions, parentData, L["Custom Function"], "customText", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-text", - 4, hideCustomTextOption, {"customText"}, false) + OptionsPrivate.commonOptions.AddCodeOption( + commonTextOptions, + parentData, + L["Custom Function"], + "customText", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-text", + 4, + hideCustomTextOption, + { "customText" }, + false + ) -- Add Text Format Options local hidden = function() @@ -487,7 +513,7 @@ local function createOptions(parentData, data, index, subIndex) type = "description", name = "", width = WeakAuras.doubleWidth, - hidden = hidden + hidden = hidden, }) OptionsPrivate.AddUpDownDeleteDuplicate(options, parentData, index, "subtext") diff --git a/WeakAurasOptions/SubRegionOptions/Tick.lua b/WeakAurasOptions/SubRegionOptions/Tick.lua index bd07611390..481a73539a 100644 --- a/WeakAurasOptions/SubRegionOptions/Tick.lua +++ b/WeakAurasOptions/SubRegionOptions/Tick.lua @@ -1,7 +1,9 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... -local L = WeakAuras.L; +local L = WeakAuras.L local function createOptions(parentData, data, index, subIndex) local hiddentickextras = function() @@ -70,7 +72,7 @@ local function createOptions(parentData, data, index, subIndex) end local offsettext = "" - if data.tick_xOffset ~=0 or data.tick_yOffset ~=0 then + if data.tick_xOffset ~= 0 or data.tick_yOffset ~= 0 then offsettext = L["Offset by |cFFFF0000%s|r/|cFFFF0000%s|r"]:format(data.tick_xOffset, data.tick_yOffset) end @@ -91,8 +93,8 @@ local function createOptions(parentData, data, index, subIndex) imageWidth = 15, imageHeight = 15, arg = { - expanderName = "tick" .. index .. "#" .. subIndex - } + expanderName = "tick" .. index .. "#" .. subIndex, + }, }, automatic_length = { type = "toggle", @@ -110,7 +112,9 @@ local function createOptions(parentData, data, index, subIndex) min = 0, softMax = 50, step = 1, - disabled = function() return data.automatic_length end, + disabled = function() + return data.automatic_length + end, hidden = hiddentickextras, }, use_texture = { @@ -126,7 +130,9 @@ local function createOptions(parentData, data, index, subIndex) name = L["Blend Mode"], order = 10, values = OptionsPrivate.Private.blend_types, - disabled = function() return not data.use_texture end, + disabled = function() + return not data.use_texture + end, hidden = hiddentickextras, }, tick_texture = { @@ -134,7 +140,9 @@ local function createOptions(parentData, data, index, subIndex) name = L["Texture"], order = 11, width = WeakAuras.doubleWidth - 0.15, - disabled = function() return not data.use_texture end, + disabled = function() + return not data.use_texture + end, hidden = hiddentickextras, }, texture_chooser = { @@ -144,14 +152,17 @@ local function createOptions(parentData, data, index, subIndex) order = 11.5, func = function() OptionsPrivate.OpenTexturePicker(parentData, { - "subRegions", index + "subRegions", + index, }, { texture = "tick_texture", color = "tick_color", - blendMode = "tick_blend_mode" - }, OptionsPrivate.Private.texture_types); + blendMode = "tick_blend_mode", + }, OptionsPrivate.Private.texture_types) + end, + disabled = function() + return not data.use_texture end, - disabled = function() return not data.use_texture end, hidden = hiddentickextras, imageWidth = 24, imageHeight = 24, @@ -179,7 +190,9 @@ local function createOptions(parentData, data, index, subIndex) width = WeakAuras.normalWidth, name = L["Mirror"], order = 15, - disabled = function() return not data.use_texture end, + disabled = function() + return not data.use_texture + end, hidden = hiddentickextras, }, tick_xOffset = { @@ -208,9 +221,9 @@ local function createOptions(parentData, data, index, subIndex) hidden = hiddentickextras, control = "WeakAurasExpandAnchor", arg = { - expanderName = "tick" .. index .. "#" .. subIndex - } - } + expanderName = "tick" .. index .. "#" .. subIndex, + }, + }, } OptionsPrivate.AddUpDownDeleteDuplicate(options, parentData, index, "subtick") @@ -218,4 +231,4 @@ local function createOptions(parentData, data, index, subIndex) return options end -WeakAuras.RegisterSubRegionOptions("subtick", createOptions, L["Places a tick on the bar"]); +WeakAuras.RegisterSubRegionOptions("subtick", createOptions, L["Places a tick on the bar"]) diff --git a/WeakAurasOptions/TriggerOptions.lua b/WeakAurasOptions/TriggerOptions.lua index fbb852fcfd..41d1592eae 100644 --- a/WeakAurasOptions/TriggerOptions.lua +++ b/WeakAurasOptions/TriggerOptions.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... local L = WeakAuras.L @@ -17,18 +19,17 @@ local flattenRegionOptions = OptionsPrivate.commonOptions.flattenRegionOptions local fixMetaOrders = OptionsPrivate.commonOptions.fixMetaOrders local function union(table1, table2) - local meta = {}; - for i,v in pairs(table1) do - meta[i] = v; + local meta = {} + for i, v in pairs(table1) do + meta[i] = v end - for i,v in pairs(table2) do - meta[i] = v; + for i, v in pairs(table2) do + meta[i] = v end - return meta; + return meta end local function GetGlobalOptions(data) - local globalTriggerOptions = { __title = L["Trigger Combination"], __order = 1, @@ -39,22 +40,22 @@ local function GetGlobalOptions(data) order = 2, values = function() if #data.triggers > 1 then - return OptionsPrivate.Private.trigger_require_types; + return OptionsPrivate.Private.trigger_require_types else - return OptionsPrivate.Private.trigger_require_types_one; + return OptionsPrivate.Private.trigger_require_types_one end end, get = function() if #data.triggers > 1 then - return data.triggers.disjunctive or "all"; + return data.triggers.disjunctive or "all" else - return (data.triggers.disjunctive and data.triggers.disjunctive ~= "all") and data.triggers.disjunctive or "any"; + return (data.triggers.disjunctive and data.triggers.disjunctive ~= "all") and data.triggers.disjunctive or "any" end end, set = function(info, v) - data.triggers.disjunctive = v; - WeakAuras.Add(data); - end + data.triggers.disjunctive = v + WeakAuras.Add(data) + end, }, -- custom trigger combiner text editor added below activeTriggerMode = { @@ -63,33 +64,44 @@ local function GetGlobalOptions(data) width = WeakAuras.doubleWidth, order = 2.3, values = function() - local vals = {}; - vals[OptionsPrivate.Private.trigger_modes.first_active] = L["Dynamic information from first active trigger"]; + local vals = {} + vals[OptionsPrivate.Private.trigger_modes.first_active] = L["Dynamic information from first active trigger"] for i = 1, #data.triggers do - vals[i] = L["Dynamic information from Trigger %i"]:format(i); + vals[i] = L["Dynamic information from Trigger %i"]:format(i) end - return vals; + return vals end, get = function() - return data.triggers.activeTriggerMode or OptionsPrivate.Private.trigger_modes.first_active; + return data.triggers.activeTriggerMode or OptionsPrivate.Private.trigger_modes.first_active end, set = function(info, v) - data.triggers.activeTriggerMode = v; - WeakAuras.Add(data); - WeakAuras.UpdateThumbnail(data); + data.triggers.activeTriggerMode = v + WeakAuras.Add(data) + WeakAuras.UpdateThumbnail(data) end, - hidden = function() return #data.triggers <= 1 end - } + hidden = function() + return #data.triggers <= 1 + end, + }, } local function hideTriggerCombiner() return not (data.triggers.disjunctive == "custom") end - OptionsPrivate.commonOptions.AddCodeOption(globalTriggerOptions, data, L["Custom"], "custom_trigger_combination", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-activation", - 2.4, hideTriggerCombiner, {"triggers", "customTriggerLogic"}, false); + OptionsPrivate.commonOptions.AddCodeOption( + globalTriggerOptions, + data, + L["Custom"], + "custom_trigger_combination", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-activation", + 2.4, + hideTriggerCombiner, + { "triggers", "customTriggerLogic" }, + false + ) return { - global = globalTriggerOptions + global = globalTriggerOptions, } end @@ -102,15 +114,15 @@ local function AddOptions(allOptions, data) local triggerOptions = {} for index, trigger in ipairs(data.triggers) do local triggerSystemOptionsFunction = trigger.trigger.type and OptionsPrivate.Private.triggerTypesOptions[trigger.trigger.type] - if (triggerSystemOptionsFunction) then + if triggerSystemOptionsFunction then triggerOptions = union(triggerOptions, triggerSystemOptionsFunction(data, index)) else -- Unknown trigger system, empty options - local options = {}; + local options = {} OptionsPrivate.commonOptions.AddCommonTriggerOptions(options, data, index) OptionsPrivate.AddTriggerMetaFunctions(options, data, index) triggerOptions = union(triggerOptions, { - ["trigger." .. index .. ".unknown"] = options + ["trigger." .. index .. ".unknown"] = options, }) end end @@ -127,21 +139,18 @@ local function AddOptions(allOptions, data) name = L["Add Trigger"], order = 1, func = function() - tinsert(data.triggers, - { - trigger = - { - type = "aura2" - }, - untrigger = { - } - }) + tinsert(data.triggers, { + trigger = { + type = "aura2", + }, + untrigger = {}, + }) WeakAuras.Add(data) OptionsPrivate.SetCollapsed(collapsedId, "trigger", #data.triggers, false) maxTriggerNumForExpand = max(maxTriggerNumForExpand, #data.triggers) WeakAuras.ClearAndUpdateOptions(data.id) - end - } + end, + }, } return union(allOptions, triggerOptions) @@ -159,14 +168,14 @@ function OptionsPrivate.GetTriggerOptions(data) type = "group", name = L["Trigger"], order = 20, - args = flattenRegionOptions(allOptions, false) + args = flattenRegionOptions(allOptions, false), } if data.controlledChildren then - removeFuncs(triggerOptions, true); - replaceNameDescFuncs(triggerOptions, data, "trigger"); - replaceImageFuncs(triggerOptions, data, "trigger"); - replaceValuesFuncs(triggerOptions, data, "trigger"); + removeFuncs(triggerOptions, true) + replaceNameDescFuncs(triggerOptions, data, "trigger") + replaceImageFuncs(triggerOptions, data, "trigger") + replaceValuesFuncs(triggerOptions, data, "trigger") triggerOptions.get = function(info, ...) return getAll(data, info, ...) @@ -191,59 +200,59 @@ end local function DeleteConditionsForTriggerHandleSubChecks(checks, triggernum) for _, check in ipairs(checks) do - if (check.trigger == triggernum) then - check.trigger = nil; + if check.trigger == triggernum then + check.trigger = nil end - if (check.trigger and check.trigger > triggernum) then - check.trigger = check.trigger - 1; + if check.trigger and check.trigger > triggernum then + check.trigger = check.trigger - 1 end - if (checks.checks) then - DeleteConditionsForTriggerHandleSubChecks(checks.checks, triggernum); + if checks.checks then + DeleteConditionsForTriggerHandleSubChecks(checks.checks, triggernum) end end end local function DeleteConditionsForTrigger(data, triggernum) for _, condition in ipairs(data.conditions) do - if (condition.check and condition.check.trigger == triggernum) then - condition.check.trigger = nil; + if condition.check and condition.check.trigger == triggernum then + condition.check.trigger = nil end - if (condition.check and condition.check.trigger and condition.check.trigger > triggernum) then - condition.check.trigger = condition.check.trigger - 1; + if condition.check and condition.check.trigger and condition.check.trigger > triggernum then + condition.check.trigger = condition.check.trigger - 1 end - if (condition.check and condition.check.checks) then + if condition.check and condition.check.checks then DeleteConditionsForTriggerHandleSubChecks(condition.check.checks, triggernum) end end end local function moveTriggerDownConditionCheck(check, i) - if (check.trigger == i) then - check.trigger = i + 1; - elseif (check.trigger == i + 1) then - check.trigger = i; + if check.trigger == i then + check.trigger = i + 1 + elseif check.trigger == i + 1 then + check.trigger = i end - if (check.checks) then + if check.checks then for _, subCheck in ipairs(check.checks) do - moveTriggerDownConditionCheck(subCheck, i); + moveTriggerDownConditionCheck(subCheck, i) end end end local function moveTriggerDownImpl(data, i) - if (i < 1 or i >= #data.triggers) then - return false; + if i < 1 or i >= #data.triggers then + return false end data.triggers[i], data.triggers[i + 1] = data.triggers[i + 1], data.triggers[i] for _, condition in ipairs(data.conditions) do - moveTriggerDownConditionCheck(condition.check, i); + moveTriggerDownConditionCheck(condition.check, i) end - return true; + return true end function OptionsPrivate.ClearTriggerExpandState() @@ -269,31 +278,29 @@ function OptionsPrivate.AddTriggerMetaFunctions(options, data, triggernum) maxTriggerNumForExpand = max(maxTriggerNumForExpand, triggernum) end end - options.__up = - { + options.__up = { disabled = function() return triggernum < 2 end, func = function() - if (moveTriggerDownImpl(data, triggernum - 1)) then - WeakAuras.Add(data); - OptionsPrivate.MoveCollapseDataUp(collapsedId, "trigger", {triggernum}) - WeakAuras.ClearAndUpdateOptions(data.id); + if moveTriggerDownImpl(data, triggernum - 1) then + WeakAuras.Add(data) + OptionsPrivate.MoveCollapseDataUp(collapsedId, "trigger", { triggernum }) + WeakAuras.ClearAndUpdateOptions(data.id) end - end + end, } - options.__down = - { + options.__down = { disabled = function() return triggernum == #data.triggers end, func = function() - if (moveTriggerDownImpl(data, triggernum)) then - WeakAuras.Add(data); - OptionsPrivate.MoveCollapseDataDown(collapsedId, "trigger", {triggernum}) - WeakAuras.ClearAndUpdateOptions(data.id); + if moveTriggerDownImpl(data, triggernum) then + WeakAuras.Add(data) + OptionsPrivate.MoveCollapseDataDown(collapsedId, "trigger", { triggernum }) + WeakAuras.ClearAndUpdateOptions(data.id) end - end + end, } options.__duplicate = function() local trigger = CopyTable(data.triggers[triggernum]) @@ -317,7 +324,7 @@ function OptionsPrivate.AddTriggerMetaFunctions(options, data, triggernum) for child in OptionsPrivate.Private.TraverseLeafsOrAura(picked) do if #child.triggers > 1 and #child.triggers >= triggernum then canDelete = true - break; + break end end @@ -332,7 +339,7 @@ function OptionsPrivate.AddTriggerMetaFunctions(options, data, triggernum) tremove(child.triggers, triggernum) DeleteConditionsForTrigger(child, triggernum) WeakAuras.Add(child) - OptionsPrivate.RemoveCollapsed(collapsedId, "trigger", {triggernum}) + OptionsPrivate.RemoveCollapsed(collapsedId, "trigger", { triggernum }) OptionsPrivate.ClearOptions(child.id) end end @@ -350,9 +357,9 @@ function OptionsPrivate.AddTriggerMetaFunctions(options, data, triggernum) triggerDeleteDialogOpen = true StaticPopup_Show("WEAKAURAS_CONFIRM_TRIGGER_DELETE") end - end + end, } - if (GetAddOnEnableState(UnitName("player"), "WeakAurasTemplates") ~= 0) then + if GetAddOnEnableState(UnitName("player"), "WeakAurasTemplates") ~= 0 then options.__applyTemplate = function() -- If we have more than a single aura selected, -- we want to open the template view with the group/multi selection diff --git a/WeakAurasOptions/WeakAurasOptions.lua b/WeakAurasOptions/WeakAurasOptions.lua index 7d017dc0af..da28f6136f 100644 --- a/WeakAurasOptions/WeakAurasOptions.lua +++ b/WeakAurasOptions/WeakAurasOptions.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local AddonName, OptionsPrivate = ... -- Lua APIs @@ -16,14 +18,14 @@ local AceGUI = LibStub("AceGUI-3.0") local WeakAuras = WeakAuras local L = WeakAuras.L -local ADDON_NAME = "WeakAurasOptions"; +local ADDON_NAME = "WeakAurasOptions" -local displayButtons = {}; -WeakAuras.displayButtons = displayButtons; +local displayButtons = {} +WeakAuras.displayButtons = displayButtons -local spellCache = WeakAuras.spellCache; -local savedVars = {}; -OptionsPrivate.savedVars = savedVars; +local spellCache = WeakAuras.spellCache +local savedVars = {} +OptionsPrivate.savedVars = savedVars OptionsPrivate.expanderAnchors = {} OptionsPrivate.expanderButtons = {} @@ -32,19 +34,19 @@ local collapsedOptions = {} local collapsed = {} -- magic value local tempGroup = { - id = {"tempGroup"}, + id = { "tempGroup" }, regionType = "group", controlledChildren = {}, load = {}, - triggers = {{}}, + triggers = { {} }, config = {}, authorOptions = {}, anchorPoint = "CENTER", anchorFrameType = "SCREEN", xOffset = 0, - yOffset = 0 -}; -OptionsPrivate.tempGroup = tempGroup; + yOffset = 0, +} +OptionsPrivate.tempGroup = tempGroup -- Does not duplicate child auras. function OptionsPrivate.DuplicateAura(data, newParent, massEdit, targetIndex) @@ -54,13 +56,13 @@ function OptionsPrivate.DuplicateAura(data, newParent, massEdit, targetIndex) -- if the old id ends with a number increment the number local matchName, matchNumber = string.match(data.id, "^(.-)(%d*)$") matchNumber = tonumber(matchNumber) - if (matchName ~= "" and matchNumber ~= nil) then + if matchName ~= "" and matchNumber ~= nil then base_id = matchName num = matchNumber + 1 end local new_id = base_id .. num - while(WeakAuras.GetData(new_id)) do + while WeakAuras.GetData(new_id) do new_id = base_id .. num num = num + 1 end @@ -74,7 +76,7 @@ function OptionsPrivate.DuplicateAura(data, newParent, massEdit, targetIndex) end WeakAuras.Add(newData) WeakAuras.NewDisplayButton(newData, massEdit) - if(newParent or data.parent) then + if newParent or data.parent then local parentId = newParent or data.parent local parentData = WeakAuras.GetData(parentId) local index @@ -85,7 +87,7 @@ function OptionsPrivate.DuplicateAura(data, newParent, massEdit, targetIndex) else index = tIndexOf(parentData.controlledChildren, data.id) + 1 end - if(index) then + if index then tinsert(parentData.controlledChildren, index, newData.id) newData.parent = parentId WeakAuras.Add(newData) @@ -109,98 +111,97 @@ function OptionsPrivate.DuplicateAura(data, newParent, massEdit, targetIndex) end AceGUI:RegisterLayout("AbsoluteList", function(content, children) - local yOffset = 0; + local yOffset = 0 for i = 1, #children do local child = children[i] - local frame = child.frame; - frame:ClearAllPoints(); - frame:Show(); + local frame = child.frame + frame:ClearAllPoints() + frame:Show() - frame:SetPoint("LEFT", content); - frame:SetPoint("RIGHT", content); + frame:SetPoint("LEFT", content) + frame:SetPoint("RIGHT", content) frame:SetPoint("TOP", content, "TOP", 0, yOffset) if child.DoLayout then child:DoLayout() end - yOffset = yOffset - ((frame.height or frame:GetHeight() or 0) + 2); + yOffset = yOffset - ((frame.height or frame:GetHeight() or 0) + 2) end - if(content.obj.LayoutFinished) then - content.obj:LayoutFinished(nil, yOffset * -1); + if content.obj.LayoutFinished then + content.obj:LayoutFinished(nil, yOffset * -1) end -end); +end) AceGUI:RegisterLayout("ButtonsScrollLayout", function(content, children, skipLayoutFinished) local yOffset = 0 local scrollTop, scrollBottom = content.obj:GetScrollPos() for i = 1, #children do local child = children[i] - local frame = child.frame; + local frame = child.frame if not child.dragging then - local frameHeight = (frame.height or frame:GetHeight() or 0); - frame:ClearAllPoints(); - if (-yOffset + frameHeight > scrollTop and -yOffset - frameHeight < scrollBottom) then - frame:Show(); - frame:SetPoint("LEFT", content); - frame:SetPoint("RIGHT", content); + local frameHeight = (frame.height or frame:GetHeight() or 0) + frame:ClearAllPoints() + if -yOffset + frameHeight > scrollTop and -yOffset - frameHeight < scrollBottom then + frame:Show() + frame:SetPoint("LEFT", content) + frame:SetPoint("RIGHT", content) frame:SetPoint("TOP", content, "TOP", 0, yOffset) else - frame:Hide(); + frame:Hide() frame.yOffset = yOffset end - yOffset = yOffset - (frameHeight + 2); + yOffset = yOffset - (frameHeight + 2) end if child.DoLayout then child:DoLayout() end - end - if(content.obj.LayoutFinished and not skipLayoutFinished) then + if content.obj.LayoutFinished and not skipLayoutFinished then content.obj:LayoutFinished(nil, yOffset * -1) end end) function OptionsPrivate.MultipleDisplayTooltipDesc() - local desc = {{L["Multiple Displays"], L["Temporary Group"]}}; + local desc = { { L["Multiple Displays"], L["Temporary Group"] } } for index, id in pairs(tempGroup.controlledChildren) do - desc[index + 1] = {" ", id}; + desc[index + 1] = { " ", id } end desc[2][1] = L["Children:"] - tinsert(desc, " "); - tinsert(desc, {" ", "|cFF00FFFF"..L["Right-click for more options"]}); - tinsert(desc, {" ", "|cFF00FFFF"..L["Drag to move"]}); - return desc; -end - -local frame; -local db; -local odb; -local reopenAfterCombat = false; -local loadedFrame = CreateFrame("Frame"); -loadedFrame:RegisterEvent("ADDON_LOADED"); -loadedFrame:RegisterEvent("PLAYER_REGEN_ENABLED"); -loadedFrame:RegisterEvent("PLAYER_REGEN_DISABLED"); + tinsert(desc, " ") + tinsert(desc, { " ", "|cFF00FFFF" .. L["Right-click for more options"] }) + tinsert(desc, { " ", "|cFF00FFFF" .. L["Drag to move"] }) + return desc +end + +local frame +local db +local odb +local reopenAfterCombat = false +local loadedFrame = CreateFrame("Frame") +loadedFrame:RegisterEvent("ADDON_LOADED") +loadedFrame:RegisterEvent("PLAYER_REGEN_ENABLED") +loadedFrame:RegisterEvent("PLAYER_REGEN_DISABLED") loadedFrame:SetScript("OnEvent", function(self, event, addon) - if (event == "ADDON_LOADED") then - if(addon == ADDON_NAME) then - db = WeakAurasSaved; - WeakAurasOptionsSaved = WeakAurasOptionsSaved or {}; + if event == "ADDON_LOADED" then + if addon == ADDON_NAME then + db = WeakAurasSaved + WeakAurasOptionsSaved = WeakAurasOptionsSaved or {} - odb = WeakAurasOptionsSaved; + odb = WeakAurasOptionsSaved -- Remove icon and id cache (replaced with spellCache) - if (odb.iconCache) then - odb.iconCache = nil; + if odb.iconCache then + odb.iconCache = nil end - if (odb.idCache) then - odb.idCache = nil; + if odb.idCache then + odb.idCache = nil end - odb.spellCache = odb.spellCache or {}; - spellCache.Load(odb); + odb.spellCache = odb.spellCache or {} + spellCache.Load(odb) if odb.magnetAlign == nil then odb.magnetAlign = true @@ -210,21 +211,21 @@ loadedFrame:SetScript("OnEvent", function(self, event, addon) db.import_disabled = nil end - savedVars.db = db; - savedVars.odb = odb; + savedVars.db = db + savedVars.odb = odb end - elseif (event == "PLAYER_REGEN_DISABLED") then - if(frame and frame:IsVisible()) then - reopenAfterCombat = true; - WeakAuras.HideOptions(); + elseif event == "PLAYER_REGEN_DISABLED" then + if frame and frame:IsVisible() then + reopenAfterCombat = true + WeakAuras.HideOptions() end - elseif (event == "PLAYER_REGEN_ENABLED") then - if (reopenAfterCombat) then - reopenAfterCombat = nil; + elseif event == "PLAYER_REGEN_ENABLED" then + if reopenAfterCombat then + reopenAfterCombat = nil WeakAuras.ShowOptions() end end -end); +end) local function addParents(hash, data) local parent = data.parent @@ -242,11 +243,11 @@ local function commonParent(controlledChildren) local parent = nil local targetIndex = math.huge for index, id in ipairs(controlledChildren) do - local childData = WeakAuras.GetData(id); + local childData = WeakAuras.GetData(id) local childButton = WeakAuras.GetDisplayButton(id) targetIndex = min(targetIndex, childButton:GetGroupOrder() or math.huge) - if (parent == nil) then + if parent == nil then parent = childData.parent elseif not childData.parent then allSame = false @@ -261,42 +262,42 @@ end local function CreateNewGroupFromSelection(regionType, resetChildPositions) local data = { - id = WeakAuras.FindUnusedId(tempGroup.controlledChildren[1].." Group"), + id = WeakAuras.FindUnusedId(tempGroup.controlledChildren[1] .. " Group"), regionType = regionType, - }; + } WeakAuras.DeepMixin(data, WeakAuras.data_stub) data.internalVersion = WeakAuras.InternalVersion() - WeakAuras.validate(data, WeakAuras.regionTypes[regionType].default); + WeakAuras.validate(data, WeakAuras.regionTypes[regionType].default) local parent, targetIndex = commonParent(tempGroup.controlledChildren) - if (parent) then + if parent then local parentData = WeakAuras.GetData(parent) tinsert(parentData.controlledChildren, targetIndex, data.id) data.parent = parent - WeakAuras.Add(data); - WeakAuras.Add(parentData); + WeakAuras.Add(data) + WeakAuras.Add(parentData) OptionsPrivate.Private.AddParents(parentData) - WeakAuras.NewDisplayButton(data); - WeakAuras.UpdateGroupOrders(parentData); - OptionsPrivate.ClearOptions(parentData.id); + WeakAuras.NewDisplayButton(data) + WeakAuras.UpdateGroupOrders(parentData) + OptionsPrivate.ClearOptions(parentData.id) local parentButton = WeakAuras.GetDisplayButton(parent) - parentButton.callbacks.UpdateExpandButton(); - parentButton:Expand(); - parentButton:ReloadTooltip(); + parentButton.callbacks.UpdateExpandButton() + parentButton:Expand() + parentButton:ReloadTooltip() else - WeakAuras.Add(data); - WeakAuras.NewDisplayButton(data); + WeakAuras.Add(data) + WeakAuras.NewDisplayButton(data) end for index, childId in pairs(tempGroup.controlledChildren) do - local childData = WeakAuras.GetData(childId); + local childData = WeakAuras.GetData(childId) local childButton = WeakAuras.GetDisplayButton(childId) local oldParent = childData.parent local oldParentData = WeakAuras.GetData(oldParent) - if (oldParent) then + if oldParent then local oldIndex = childButton:GetGroupOrder() print("CHILD ID", childId, "OLD PARENT", oldParent, "OLD INDEX", oldIndex) print("###", oldParentData.controlledChildren[oldIndex]) @@ -304,31 +305,31 @@ local function CreateNewGroupFromSelection(regionType, resetChildPositions) tremove(oldParentData.controlledChildren, oldIndex) WeakAuras.Add(oldParentData) OptionsPrivate.Private.AddParents(oldParentData) - WeakAuras.UpdateGroupOrders(oldParentData); - WeakAuras.ClearAndUpdateOptions(oldParent); + WeakAuras.UpdateGroupOrders(oldParentData) + WeakAuras.ClearAndUpdateOptions(oldParent) local oldParentButton = WeakAuras.GetDisplayButton(oldParent) - oldParentButton.callbacks.UpdateExpandButton(); + oldParentButton.callbacks.UpdateExpandButton() oldParentButton:ReloadTooltip() end - tinsert(data.controlledChildren, childId); - childData.parent = data.id; + tinsert(data.controlledChildren, childId) + childData.parent = data.id if resetChildPositions then - childData.xOffset = 0; - childData.yOffset = 0; + childData.xOffset = 0 + childData.yOffset = 0 end - WeakAuras.Add(data); - WeakAuras.Add(childData); + WeakAuras.Add(data) + WeakAuras.Add(childData) OptionsPrivate.ClearOptions(childData.id) - childButton:SetGroup(data.id, data.regionType == "dynamicgroup"); - childButton:SetGroupOrder(index, #data.controlledChildren); + childButton:SetGroup(data.id, data.regionType == "dynamicgroup") + childButton:SetGroupOrder(index, #data.controlledChildren) end - local button = WeakAuras.GetDisplayButton(data.id); - button.callbacks.UpdateExpandButton(); - OptionsPrivate.SortDisplayButtons(); - button:Expand(); + local button = WeakAuras.GetDisplayButton(data.id) + button.callbacks.UpdateExpandButton() + OptionsPrivate.SortDisplayButtons() + button:Expand() if data.parent then OptionsPrivate.Private.AddParents(data) @@ -336,53 +337,53 @@ local function CreateNewGroupFromSelection(regionType, resetChildPositions) end function OptionsPrivate.MultipleDisplayTooltipMenu() - local frame = frame; + local frame = frame local menu = { { text = L["Add to new Group"], notCheckable = 1, func = function() CreateNewGroupFromSelection("group") - end + end, }, { text = L["Add to new Dynamic Group"], notCheckable = 1, func = function() CreateNewGroupFromSelection("dynamicgroup", true) - end + end, }, { text = L["Duplicate All"], notCheckable = 1, func = function() - local duplicated = {}; + local duplicated = {} for child in OptionsPrivate.Private.TraverseAllChildren(tempGroup) do local newData = OptionsPrivate.DuplicateAura(child) - tinsert(duplicated, newData.id); + tinsert(duplicated, newData.id) end - OptionsPrivate.ClearPicks(); - frame:PickDisplayBatch(duplicated); - end + OptionsPrivate.ClearPicks() + frame:PickDisplayBatch(duplicated) + end, }, { text = " ", notCheckable = 1, - notClickable = 1 + notClickable = 1, }, { text = L["Delete all"], notCheckable = 1, func = function() - local toDelete = {}; - local parents = {}; + local toDelete = {} + local parents = {} for child in OptionsPrivate.Private.TraverseAllChildren(tempGroup) do tinsert(toDelete, child) addParents(parents, child) end OptionsPrivate.ConfirmDelete(toDelete, parents) - end + end, }, { text = " ", @@ -392,21 +393,23 @@ function OptionsPrivate.MultipleDisplayTooltipMenu() { text = L["Close"], notCheckable = 1, - func = function() WeakAuras_DropDownMenu:Hide() end - } - }; + func = function() + WeakAuras_DropDownMenu:Hide() + end, + }, + } - local anyGroup = false; + local anyGroup = false local allSameParent = true local commonParent = nil local first = true for _, id in pairs(tempGroup.controlledChildren) do - local childData = WeakAuras.GetData(id); - if(childData and childData.controlledChildren) then - anyGroup = true; + local childData = WeakAuras.GetData(id) + if childData and childData.controlledChildren then + anyGroup = true end - if (first) then + if first then commonParent = childData.parent first = false elseif childData.parent ~= commonParent then @@ -414,25 +417,25 @@ function OptionsPrivate.MultipleDisplayTooltipMenu() end end - if(anyGroup) then + if anyGroup then -- Disable "Add to New Dynamic Group" - menu[2].notClickable = 1; - menu[2].text = "|cFF777777"..menu[2].text; + menu[2].notClickable = 1 + menu[2].text = "|cFF777777" .. menu[2].text end -- Also disable Add to New Dynamic Group/Group if that would create -- a group inside a dynamic group - if (allSameParent and commonParent) then - local parentData = WeakAuras.GetData(commonParent); - if (parentData and parentData.regionType == "dynamicgroup") then - menu[1].notClickable = 1; - menu[1].text = "|cFF777777"..menu[1].text; - menu[2].notClickable = 1; - menu[2].text = "|cFF777777"..menu[1].text; + if allSameParent and commonParent then + local parentData = WeakAuras.GetData(commonParent) + if parentData and parentData.regionType == "dynamicgroup" then + menu[1].notClickable = 1 + menu[1].text = "|cFF777777" .. menu[1].text + menu[2].notClickable = 1 + menu[2].text = "|cFF777777" .. menu[1].text end end - return menu; + return menu end StaticPopupDialogs["WEAKAURAS_CONFIRM_DELETE"] = { @@ -453,7 +456,7 @@ StaticPopupDialogs["WEAKAURAS_CONFIRM_DELETE"] = { local parentData = WeakAuras.GetData(id) local parentButton = WeakAuras.GetDisplayButton(id) WeakAuras.UpdateGroupOrders(parentData) - if(#parentData.controlledChildren == 0) then + if #parentData.controlledChildren == 0 then parentButton:DisableExpand() else parentButton:EnableExpand() @@ -499,51 +502,51 @@ function OptionsPrivate.ConfirmDelete(toDelete, parents) if toDelete then local warningForm = L["You are about to delete %d aura(s). |cFFFF0000This cannot be undone!|r Would you like to continue?"] StaticPopupDialogs["WEAKAURAS_CONFIRM_DELETE"].text = warningForm:format(#toDelete) - StaticPopup_Show("WEAKAURAS_CONFIRM_DELETE", "", "", {toDelete = toDelete, parents = parents}) + StaticPopup_Show("WEAKAURAS_CONFIRM_DELETE", "", "", { toDelete = toDelete, parents = parents }) end end function WeakAuras.OptionsFrame() - if(frame) then - return frame; + if frame then + return frame else - return nil; + return nil end end local function AfterScanForLoads() - if(frame) then - if (frame:IsVisible()) then - OptionsPrivate.SortDisplayButtons(nil, true); + if frame then + if frame:IsVisible() then + OptionsPrivate.SortDisplayButtons(nil, true) else - frame.needsSort = true; + frame.needsSort = true end end end local function OnAboutToDelete(event, uid, id, parentUid, parentId) local data = OptionsPrivate.Private.GetDataByUID(uid) - if(data.controlledChildren) then + if data.controlledChildren then for index, childId in pairs(data.controlledChildren) do - local childButton = displayButtons[childId]; - if(childButton) then - childButton:SetGroup(); + local childButton = displayButtons[childId] + if childButton then + childButton:SetGroup() end - local childData = db.displays[childId]; - if(childData) then - childData.parent = nil; + local childData = db.displays[childId] + if childData then + childData.parent = nil end end end - OptionsPrivate.Private.CollapseAllClones(id); + OptionsPrivate.Private.CollapseAllClones(id) OptionsPrivate.ClearOptions(id) - frame:ClearPicks(); + frame:ClearPicks() - if(displayButtons[id])then - frame.buttonsScroll:DeleteChild(displayButtons[id]); - displayButtons[id] = nil; + if displayButtons[id] then + frame.buttonsScroll:DeleteChild(displayButtons[id]) + displayButtons[id] = nil end collapsedOptions[id] = nil @@ -552,17 +555,17 @@ end local function OnRename(event, uid, oldid, newid) local data = OptionsPrivate.Private.GetDataByUID(uid) - WeakAuras.displayButtons[newid] = WeakAuras.displayButtons[oldid]; + WeakAuras.displayButtons[newid] = WeakAuras.displayButtons[oldid] WeakAuras.displayButtons[newid]:SetData(data) - WeakAuras.displayButtons[oldid] = nil; + WeakAuras.displayButtons[oldid] = nil OptionsPrivate.ClearOptions(oldid) - WeakAuras.displayButtons[newid]:SetTitle(newid); + WeakAuras.displayButtons[newid]:SetTitle(newid) collapsedOptions[newid] = collapsedOptions[oldid] collapsedOptions[oldid] = nil - if(data.controlledChildren) then + if data.controlledChildren then for _, childId in pairs(data.controlledChildren) do WeakAuras.displayButtons[childId]:SetGroup(newid) end @@ -603,235 +606,239 @@ function WeakAuras.ToggleOptions(msg, Private) OptionsPrivate.Private.OpenUpdate = OptionsPrivate.OpenUpdate end - if(frame and frame:IsVisible()) then - WeakAuras.HideOptions(); - elseif (InCombatLockdown()) then + if frame and frame:IsVisible() then + WeakAuras.HideOptions() + elseif InCombatLockdown() then WeakAuras.prettyPrint(L["Options will open after combat ends."]) - reopenAfterCombat = true; + reopenAfterCombat = true else - WeakAuras.ShowOptions(msg); + WeakAuras.ShowOptions(msg) end end function WeakAuras.HideOptions() - if(frame) then + if frame then frame:Hide() end end function WeakAuras.IsOptionsOpen() - if(frame and frame:IsVisible()) then - return true; + if frame and frame:IsVisible() then + return true else - return false; + return false end end local function EnsureDisplayButton(data) - local id = data.id; - if not(displayButtons[id]) then - displayButtons[id] = AceGUI:Create("WeakAurasDisplayButton"); - if(displayButtons[id]) then - displayButtons[id]:SetData(data); - displayButtons[id]:Initialize(); + local id = data.id + if not displayButtons[id] then + displayButtons[id] = AceGUI:Create("WeakAurasDisplayButton") + if displayButtons[id] then + displayButtons[id]:SetData(data) + displayButtons[id]:Initialize() displayButtons[id]:UpdateWarning() else - print("|cFF8800FFWeakAuras|r: Error creating button for", id); + print("|cFF8800FFWeakAuras|r: Error creating button for", id) end end end local function GetSortedOptionsLists() - local loadedSorted, unloadedSorted = {}, {}; - local to_sort = {}; + local loadedSorted, unloadedSorted = {}, {} + local to_sort = {} for id, data in pairs(db.displays) do - if(data.parent) then + if data.parent then -- Do nothing; children will be added later - elseif(OptionsPrivate.Private.loaded[id]) then - tinsert(to_sort, id); + elseif OptionsPrivate.Private.loaded[id] then + tinsert(to_sort, id) end end - table.sort(to_sort, function(a, b) return a < b end); + table.sort(to_sort, function(a, b) + return a < b + end) for _, id in ipairs(to_sort) do - local data = WeakAuras.GetData(id); + local data = WeakAuras.GetData(id) for child in OptionsPrivate.Private.TraverseAll(data) do tinsert(loadedSorted, child.id) end end - wipe(to_sort); + wipe(to_sort) for id, data in pairs(db.displays) do - if(data.parent) then + if data.parent then -- Do nothing; children will be added later - elseif not(OptionsPrivate.Private.loaded[id]) then - tinsert(to_sort, id); + elseif not OptionsPrivate.Private.loaded[id] then + tinsert(to_sort, id) end end - table.sort(to_sort, function(a, b) return a < b end); + table.sort(to_sort, function(a, b) + return a < b + end) for _, id in ipairs(to_sort) do - local data = WeakAuras.GetData(id); + local data = WeakAuras.GetData(id) for child in OptionsPrivate.Private.TraverseAll(data) do tinsert(unloadedSorted, child.id) end end - return loadedSorted, unloadedSorted; + return loadedSorted, unloadedSorted end local function LayoutDisplayButtons(msg) - local total = 0; - for _,_ in pairs(db.displays) do - total = total + 1; + local total = 0 + for _, _ in pairs(db.displays) do + total = total + 1 end - local loadedSorted, unloadedSorted = GetSortedOptionsLists(); + local loadedSorted, unloadedSorted = GetSortedOptionsLists() frame:SetLoadProgressVisible(true) if OptionsPrivate.Private.CompanionData.slugs then - frame.buttonsScroll:AddChild(frame.pendingInstallButton); - frame.buttonsScroll:AddChild(frame.pendingUpdateButton); + frame.buttonsScroll:AddChild(frame.pendingInstallButton) + frame.buttonsScroll:AddChild(frame.pendingUpdateButton) end - frame.buttonsScroll:AddChild(frame.loadedButton); - frame.buttonsScroll:AddChild(frame.unloadedButton); + frame.buttonsScroll:AddChild(frame.loadedButton) + frame.buttonsScroll:AddChild(frame.unloadedButton) local func2 = function() - local num = frame.loadProgressNum or 0; + local num = frame.loadProgressNum or 0 for _, id in pairs(unloadedSorted) do - local data = WeakAuras.GetData(id); - if(data) then - EnsureDisplayButton(data); - WeakAuras.UpdateThumbnail(data); + local data = WeakAuras.GetData(id) + if data then + EnsureDisplayButton(data) + WeakAuras.UpdateThumbnail(data) - frame.buttonsScroll:AddChild(displayButtons[data.id]); + frame.buttonsScroll:AddChild(displayButtons[data.id]) - if (num % 50 == 0) then + if num % 50 == 0 then frame.buttonsScroll:ResumeLayout() frame.buttonsScroll:PerformLayout() frame.buttonsScroll:PauseLayout() end - num = num + 1; + num = num + 1 end - frame.loadProgress:SetText(L["Creating buttons: "]..num.."/"..total); - frame.loadProgressNum = num; - coroutine.yield(); + frame.loadProgress:SetText(L["Creating buttons: "] .. num .. "/" .. total) + frame.loadProgressNum = num + coroutine.yield() end frame.buttonsScroll:ResumeLayout() frame.buttonsScroll:PerformLayout() - OptionsPrivate.SortDisplayButtons(msg); + OptionsPrivate.SortDisplayButtons(msg) - OptionsPrivate.Private.PauseAllDynamicGroups(); - if (WeakAuras.IsOptionsOpen()) then + OptionsPrivate.Private.PauseAllDynamicGroups() + if WeakAuras.IsOptionsOpen() then for id, button in pairs(displayButtons) do - if(OptionsPrivate.Private.loaded[id] ~= nil) then - button:PriorityShow(1); + if OptionsPrivate.Private.loaded[id] ~= nil then + button:PriorityShow(1) end end WeakAuras.OptionsFrame().loadedButton:RecheckVisibility() end - OptionsPrivate.Private.ResumeAllDynamicGroups(); + OptionsPrivate.Private.ResumeAllDynamicGroups() frame:SetLoadProgressVisible(false) end local func1 = function() - local num = frame.loadProgressNum or 0; + local num = frame.loadProgressNum or 0 frame.buttonsScroll:PauseLayout() for _, id in pairs(loadedSorted) do - local data = WeakAuras.GetData(id); - if(data) then - EnsureDisplayButton(data); - WeakAuras.UpdateThumbnail(data); + local data = WeakAuras.GetData(id) + if data then + EnsureDisplayButton(data) + WeakAuras.UpdateThumbnail(data) local button = displayButtons[data.id] - frame.buttonsScroll:AddChild(button); - num = num + 1; + frame.buttonsScroll:AddChild(button) + num = num + 1 end - if (num % 50 == 0) then + if num % 50 == 0 then frame.buttonsScroll:ResumeLayout() frame.buttonsScroll:PerformLayout() frame.buttonsScroll:PauseLayout() end - frame.loadProgress:SetText(L["Creating buttons: "]..num.."/"..total); - frame.loadProgressNum = num; - coroutine.yield(); + frame.loadProgress:SetText(L["Creating buttons: "] .. num .. "/" .. total) + frame.loadProgressNum = num + coroutine.yield() end - local co2 = coroutine.create(func2); - OptionsPrivate.Private.dynFrame:AddAction("LayoutDisplayButtons2", co2); + local co2 = coroutine.create(func2) + OptionsPrivate.Private.dynFrame:AddAction("LayoutDisplayButtons2", co2) end - local co1 = coroutine.create(func1); - OptionsPrivate.Private.dynFrame:AddAction("LayoutDisplayButtons1", co1); + local co1 = coroutine.create(func1) + OptionsPrivate.Private.dynFrame:AddAction("LayoutDisplayButtons1", co1) end function WeakAuras.ShowOptions(msg) - local firstLoad = not(frame); - OptionsPrivate.Private.Pause(); + local firstLoad = not frame + OptionsPrivate.Private.Pause() OptionsPrivate.Private.SetFakeStates() WeakAuras.spellCache.Build() - if (firstLoad) then - frame = OptionsPrivate.CreateFrame(); - frame.buttonsScroll.frame:Show(); + if firstLoad then + frame = OptionsPrivate.CreateFrame() + frame.buttonsScroll.frame:Show() - LayoutDisplayButtons(msg); + LayoutDisplayButtons(msg) end - if (frame:GetWidth() > GetScreenWidth()) then + if frame:GetWidth() > GetScreenWidth() then frame:SetWidth(GetScreenWidth()) end - if (frame:GetHeight() > GetScreenHeight() - 50) then + if frame:GetHeight() > GetScreenHeight() - 50 then frame:SetHeight(GetScreenHeight() - 50) end - frame.buttonsScroll.frame:Show(); + frame.buttonsScroll.frame:Show() - if (frame.needsSort) then - OptionsPrivate.SortDisplayButtons(); - frame.needsSort = nil; + if frame.needsSort then + OptionsPrivate.SortDisplayButtons() + frame.needsSort = nil end - frame:Show(); + frame:Show() - if (OptionsPrivate.Private.mouseFrame) then - OptionsPrivate.Private.mouseFrame:OptionsOpened(); + if OptionsPrivate.Private.mouseFrame then + OptionsPrivate.Private.mouseFrame:OptionsOpened() end - if (OptionsPrivate.Private.personalRessourceDisplayFrame) then - OptionsPrivate.Private.personalRessourceDisplayFrame:OptionsOpened(); + if OptionsPrivate.Private.personalRessourceDisplayFrame then + OptionsPrivate.Private.personalRessourceDisplayFrame:OptionsOpened() end - if not(firstLoad) then + if not firstLoad then -- Show what was last shown - OptionsPrivate.Private.PauseAllDynamicGroups(); + OptionsPrivate.Private.PauseAllDynamicGroups() for id, button in pairs(displayButtons) do button:SyncVisibility() end - OptionsPrivate.Private.ResumeAllDynamicGroups(); + OptionsPrivate.Private.ResumeAllDynamicGroups() end - if (frame.pickedDisplay) then - if (OptionsPrivate.IsPickedMultiple()) then + if frame.pickedDisplay then + if OptionsPrivate.IsPickedMultiple() then local children = {} - for k,v in pairs(tempGroup.controlledChildren) do + for k, v in pairs(tempGroup.controlledChildren) do children[k] = v end - frame:PickDisplayBatch(children); + frame:PickDisplayBatch(children) else - WeakAuras.PickDisplay(frame.pickedDisplay); + WeakAuras.PickDisplay(frame.pickedDisplay) end else - frame:NewAura(); + frame:NewAura() end - if (frame.window == "codereview") then - frame.codereview:Close(); + if frame.window == "codereview" then + frame.codereview:Close() end if firstLoad then @@ -864,19 +871,19 @@ function OptionsPrivate.GetPickedDisplay() end function OptionsPrivate.OpenTextEditor(...) - frame.texteditor:Open(...); + frame.texteditor:Open(...) end function OptionsPrivate.ExportToString(id) - frame.importexport:Open("export", id); + frame.importexport:Open("export", id) end function OptionsPrivate.ExportToTable(id) - frame.importexport:Open("table", id); + frame.importexport:Open("table", id) end function OptionsPrivate.ImportFromString() - frame.importexport:Open("import"); + frame.importexport:Open("import") end function OptionsPrivate.OpenDebugLog(text) @@ -888,57 +895,59 @@ function OptionsPrivate.OpenUpdate(data, children, target, sender, callbackFunc) end function OptionsPrivate.ConvertDisplay(data, newType) - local id = data.id; - local visibility = displayButtons[id]:GetVisibility(); - displayButtons[id]:PriorityHide(2); + local id = data.id + local visibility = displayButtons[id]:GetVisibility() + displayButtons[id]:PriorityHide(2) - WeakAuras.regions[id].region:Collapse(); - OptionsPrivate.Private.CollapseAllClones(id); + WeakAuras.regions[id].region:Collapse() + OptionsPrivate.Private.CollapseAllClones(id) - OptionsPrivate.Private.Convert(data, newType); - displayButtons[id]:SetViewRegion(WeakAuras.regions[id].region); - displayButtons[id]:Initialize(); - displayButtons[id]:PriorityShow(visibility); + OptionsPrivate.Private.Convert(data, newType) + displayButtons[id]:SetViewRegion(WeakAuras.regions[id].region) + displayButtons[id]:Initialize() + displayButtons[id]:PriorityShow(visibility) frame:ClearOptions(id) - frame:FillOptions(); - WeakAuras.UpdateThumbnail(data); + frame:FillOptions() + WeakAuras.UpdateThumbnail(data) WeakAuras.SetMoverSizer(id) - OptionsPrivate.ResetMoverSizer(); + OptionsPrivate.ResetMoverSizer() OptionsPrivate.SortDisplayButtons() end function WeakAuras.NewDisplayButton(data, massEdit) - local id = data.id; - OptionsPrivate.Private.ScanForLoads({[id] = true}); - EnsureDisplayButton(db.displays[id]); - WeakAuras.UpdateThumbnail(db.displays[id]); - frame.buttonsScroll:AddChild(displayButtons[id]); + local id = data.id + OptionsPrivate.Private.ScanForLoads({ [id] = true }) + EnsureDisplayButton(db.displays[id]) + WeakAuras.UpdateThumbnail(db.displays[id]) + frame.buttonsScroll:AddChild(displayButtons[id]) if not massEdit then OptionsPrivate.SortDisplayButtons() end end function WeakAuras.UpdateGroupOrders(data) - if(data.controlledChildren) then - local total = #data.controlledChildren; + if data.controlledChildren then + local total = #data.controlledChildren for index, id in pairs(data.controlledChildren) do - local button = WeakAuras.GetDisplayButton(id); - button:SetGroupOrder(index, total); + local button = WeakAuras.GetDisplayButton(id) + button:SetGroupOrder(index, total) end end end function OptionsPrivate.UpdateButtonsScroll() - if OptionsPrivate.Private.IsOptionsProcessingPaused() then return end + if OptionsPrivate.Private.IsOptionsProcessingPaused() then + return + end frame.buttonsScroll:DoLayout() end local function addButton(button, aurasMatchingFilter, visible) - button.frame:Show(); + button.frame:Show() if button.AcquireThumbnail then button:AcquireThumbnail() end - tinsert(frame.buttonsScroll.children, button); + tinsert(frame.buttonsScroll.children, button) visible[button] = true if button.data.controlledChildren and button:GetExpanded() then @@ -950,26 +959,26 @@ local function addButton(button, aurasMatchingFilter, visible) end end -local previousFilter; +local previousFilter local pendingUpdateButtons = {} local pendingInstallButtons = {} function OptionsPrivate.SortDisplayButtons(filter, overrideReset, id) - if (OptionsPrivate.Private.IsOptionsProcessingPaused()) then - return; + if OptionsPrivate.Private.IsOptionsProcessingPaused() then + return end - local recenter = false; - filter = filter or (overrideReset and previousFilter or ""); - if(frame.filterInput:GetText() ~= filter) then - frame.filterInput:SetText(filter); + local recenter = false + filter = filter or (overrideReset and previousFilter or "") + if frame.filterInput:GetText() ~= filter then + frame.filterInput:SetText(filter) end - if(previousFilter and previousFilter ~= "" and (filter == "" or not filter)) then - recenter = true; + if previousFilter and previousFilter ~= "" and (filter == "" or not filter) then + recenter = true end - previousFilter = filter; - filter = filter:lower(); + previousFilter = filter + filter = filter:lower() - wipe(frame.buttonsScroll.children); + wipe(frame.buttonsScroll.children) local pendingInstallButtonShown = false if OptionsPrivate.Private.CompanionData.stash then @@ -1083,7 +1092,7 @@ function OptionsPrivate.SortDisplayButtons(filter, overrideReset, id) frame.pendingUpdateButton.frame:Hide() end - tinsert(frame.buttonsScroll.children, frame.loadedButton); + tinsert(frame.buttonsScroll.children, frame.loadedButton) local aurasMatchingFilter = {} local useTextFilter = filter and filter ~= "" @@ -1092,14 +1101,14 @@ function OptionsPrivate.SortDisplayButtons(filter, overrideReset, id) local visible = {} for id, child in pairs(displayButtons) do - if(OptionsPrivate.Private.loaded[id]) then - child:EnableLoaded(); + if OptionsPrivate.Private.loaded[id] then + child:EnableLoaded() else - child:DisableLoaded(); + child:DisableLoaded() end if useTextFilter then - if(id:lower():find(filter, 1, true)) then + if id:lower():find(filter, 1, true) then aurasMatchingFilter[id] = true for parent in OptionsPrivate.Private.TraverseParents(child.data) do aurasMatchingFilter[parent.id] = true @@ -1128,7 +1137,7 @@ function OptionsPrivate.SortDisplayButtons(filter, overrideReset, id) end end - tinsert(frame.buttonsScroll.children, frame.unloadedButton); + tinsert(frame.buttonsScroll.children, frame.unloadedButton) if frame.unloadedButton:GetExpanded() then table.sort(topLevelUnloadedAuras) @@ -1140,39 +1149,38 @@ function OptionsPrivate.SortDisplayButtons(filter, overrideReset, id) end for _, child in pairs(displayButtons) do - if(not visible[child]) then - child.frame:Hide(); + if not visible[child] then + child.frame:Hide() if child.ReleaseThumbnail then child:ReleaseThumbnail() end end end - frame.buttonsScroll:DoLayout(); - if(recenter) then - frame:CenterOnPicked(); + frame.buttonsScroll:DoLayout() + if recenter then + frame:CenterOnPicked() end end - function OptionsPrivate.IsPickedMultiple() - if(frame.pickedDisplay == tempGroup) then - return true; + if frame.pickedDisplay == tempGroup then + return true else - return false; + return false end end function OptionsPrivate.IsDisplayPicked(id) - if(frame.pickedDisplay == tempGroup) then + if frame.pickedDisplay == tempGroup then for child in OptionsPrivate.Private.TraverseLeafs(tempGroup) do - if(id == child.id) then - return true; + if id == child.id then + return true end end - return false; + return false else - return frame.pickedDisplay == id; + return frame.pickedDisplay == id end end @@ -1182,106 +1190,106 @@ function WeakAuras.PickDisplay(id, tab, noHide) end function OptionsPrivate.PickAndEditDisplay(id) - frame:PickDisplay(id); + frame:PickDisplay(id) OptionsPrivate.UpdateButtonsScroll() - displayButtons[id].callbacks.OnRenameClick(); + displayButtons[id].callbacks.OnRenameClick() end function OptionsPrivate.ClearPick(id) - frame:ClearPick(id); + frame:ClearPick(id) end function OptionsPrivate.ClearPicks() - frame:ClearPicks(); + frame:ClearPicks() end function OptionsPrivate.PickDisplayMultiple(id) - frame:PickDisplayMultiple(id); + frame:PickDisplayMultiple(id) end function OptionsPrivate.PickDisplayMultipleShift(target) - if (frame.pickedDisplay) then + if frame.pickedDisplay then -- get first aura selected - local first; - if (OptionsPrivate.IsPickedMultiple()) then - first = tempGroup.controlledChildren[#tempGroup.controlledChildren]; + local first + if OptionsPrivate.IsPickedMultiple() then + first = tempGroup.controlledChildren[#tempGroup.controlledChildren] else - first = frame.pickedDisplay; + first = frame.pickedDisplay end - if (first and first ~= target) then + if first and first ~= target then -- check if target and first are in same group and are not a group - local firstData = WeakAuras.GetData(first); - local targetData = WeakAuras.GetData(target); - if (firstData.parent == targetData.parent and not targetData.controlledChildren and not firstData.controlledChildren) then - local batchSelection = {}; + local firstData = WeakAuras.GetData(first) + local targetData = WeakAuras.GetData(target) + if firstData.parent == targetData.parent and not targetData.controlledChildren and not firstData.controlledChildren then + local batchSelection = {} -- in a group - if (firstData.parent) then - local group = WeakAuras.GetData(targetData.parent); + if firstData.parent then + local group = WeakAuras.GetData(targetData.parent) for index, child in ipairs(group.controlledChildren) do -- 1st button - if (child == target or child == first) then - table.insert(batchSelection, child); + if child == target or child == first then + table.insert(batchSelection, child) for i = index + 1, #group.controlledChildren do - local current = group.controlledChildren[i]; - if (WeakAuras.GetData(current).controlledChildren) then + local current = group.controlledChildren[i] + if WeakAuras.GetData(current).controlledChildren then -- Skip sub groups else - table.insert(batchSelection, current); + table.insert(batchSelection, current) end -- last button: stop selection - if (current == target or current == first) then - break; + if current == target or current == first then + break end end - break; + break end end - elseif (firstData.parent == nil and targetData.parent == nil) then + elseif firstData.parent == nil and targetData.parent == nil then -- top-level for index, button in ipairs(frame.buttonsScroll.children) do if button.type == "WeakAurasDisplayButton" then - local data = button.data; + local data = button.data -- 1st button - if (data and (data.id == target or data.id == first)) then - table.insert(batchSelection, data.id); + if data and (data.id == target or data.id == first) then + table.insert(batchSelection, data.id) for i = index + 1, #frame.buttonsScroll.children do - local current = frame.buttonsScroll.children[i]; - local currentData = current.data; + local current = frame.buttonsScroll.children[i] + local currentData = current.data if currentData and not currentData.parent and not currentData.controlledChildren then - table.insert(batchSelection, currentData.id); + table.insert(batchSelection, currentData.id) -- last button: stop selection - if (currentData.id == target or currentData.id == first) then - break; + if currentData.id == target or currentData.id == first then + break end end end - break; + break end end end end if #batchSelection > 0 then - frame:PickDisplayBatch(batchSelection); + frame:PickDisplayBatch(batchSelection) end end end else - WeakAuras.PickDisplay(target); + WeakAuras.PickDisplay(target) end end function WeakAuras.GetDisplayButton(id) - if(id and displayButtons[id]) then - return displayButtons[id]; + if id and displayButtons[id] then + return displayButtons[id] end end function OptionsPrivate.AddDisplayButton(data) - EnsureDisplayButton(data); - WeakAuras.UpdateThumbnail(data); - frame.buttonsScroll:AddChild(displayButtons[data.id]); - if(WeakAuras.regions[data.id] and WeakAuras.regions[data.id].region.SetStacks) then - WeakAuras.regions[data.id].region:SetStacks(1); + EnsureDisplayButton(data) + WeakAuras.UpdateThumbnail(data) + frame.buttonsScroll:AddChild(displayButtons[data.id]) + if WeakAuras.regions[data.id] and WeakAuras.regions[data.id].region.SetStacks then + WeakAuras.regions[data.id].region:SetStacks(1) end end @@ -1294,35 +1302,35 @@ function OptionsPrivate.StartGrouping(data) WeakAuras.PickDisplay(data.id) end - if (frame.pickedDisplay == tempGroup and #tempGroup.controlledChildren > 0) then - local children = {}; + if frame.pickedDisplay == tempGroup and #tempGroup.controlledChildren > 0 then + local children = {} -- start grouping for selected buttons for index, childId in ipairs(tempGroup.controlledChildren) do - local button = WeakAuras.GetDisplayButton(childId); - button:StartGrouping(tempGroup.controlledChildren, true); - children[childId] = true; + local button = WeakAuras.GetDisplayButton(childId) + button:StartGrouping(tempGroup.controlledChildren, true) + children[childId] = true end -- set grouping for non selected buttons for _, button in pairs(displayButtons) do if not children[button.data.id] then - button:StartGrouping(tempGroup.controlledChildren, false); + button:StartGrouping(tempGroup.controlledChildren, false) end end else - local children = {}; + local children = {} for child in OptionsPrivate.Private.TraverseAllChildren(data) do children[child.id] = true end for id, button in pairs(displayButtons) do - button:StartGrouping({data.id}, data.id == id, data.regionType == "dynamicgroup" or data.regionType == "group", children[id]); + button:StartGrouping({ data.id }, data.id == id, data.regionType == "dynamicgroup" or data.regionType == "group", children[id]) end end end function OptionsPrivate.StopGrouping(data) for id, button in pairs(displayButtons) do - button:StopGrouping(); + button:StopGrouping() end end @@ -1331,28 +1339,28 @@ function OptionsPrivate.Ungroup(data) WeakAuras.PickDisplay(data.id) end - if (frame.pickedDisplay == tempGroup and #tempGroup.controlledChildren > 0) then + if frame.pickedDisplay == tempGroup and #tempGroup.controlledChildren > 0 then for index, childId in ipairs(tempGroup.controlledChildren) do - local button = WeakAuras.GetDisplayButton(childId); - button:Ungroup(data); + local button = WeakAuras.GetDisplayButton(childId) + button:Ungroup(data) end else - local button = WeakAuras.GetDisplayButton(data.id); - button:Ungroup(data); + local button = WeakAuras.GetDisplayButton(data.id) + button:Ungroup(data) end WeakAuras.FillOptions() end function OptionsPrivate.DragReset() for _, button in pairs(displayButtons) do - button:DragReset(); + button:DragReset() end OptionsPrivate.UpdateButtonsScroll() end local function CompareButtonOrder(a, b) - if (a.data.parent == b.data.parent) then - if (a.data.parent) then + if a.data.parent == b.data.parent then + if a.data.parent then return a:GetGroupOrder() < b:GetGroupOrder() else return a.data.id < b.data.id @@ -1367,9 +1375,9 @@ local function CompareButtonOrder(a, b) local aNode = a.data.id local lastAParent = aNode - while(aNode) do + while aNode do local parent = WeakAuras.GetData(aNode).parent - if (parent) then + if parent then parents[parent] = aNode lastAParent = parent end @@ -1379,10 +1387,10 @@ local function CompareButtonOrder(a, b) local bNode = b.data.id local lastBParent = bNode - while(bNode) do + while bNode do local parent = WeakAuras.GetData(bNode).parent if parent then - if (parents[parent]) then + if parents[parent] then -- We have found the common parent, the last node in the chain is -- Compare the previous nodes GroupOrder local aButton = WeakAuras.GetDisplayButton(parents[parent]) @@ -1409,7 +1417,7 @@ function OptionsPrivate.Drop(mainAura, target, action, area) WeakAuras_DropDownMenu:Hide() local mode = "" - if (frame.pickedDisplay == tempGroup and #tempGroup.controlledChildren > 0) then + if frame.pickedDisplay == tempGroup and #tempGroup.controlledChildren > 0 then mode = "MULTI" elseif mainAura.controlledChildren then mode = "GROUP" @@ -1423,7 +1431,7 @@ function OptionsPrivate.Drop(mainAura, target, action, area) if button:IsDragging() then tinsert(buttonsToSort, button) else - button:Drop(mode, mainAura, target, action); + button:Drop(mode, mainAura, target, action) end end @@ -1447,7 +1455,7 @@ function OptionsPrivate.Drop(mainAura, target, action, area) -- Update offset, this is a bit wasteful to do for every aura -- But we also need to update the offset if a parent was dragged for _, button in pairs(displayButtons) do - button:UpdateOffset(); + button:UpdateOffset() end OptionsPrivate.SortDisplayButtons() @@ -1457,42 +1465,42 @@ end function OptionsPrivate.StartDrag(mainAura) WeakAuras_DropDownMenu:Hide() - if (frame.pickedDisplay == tempGroup and #tempGroup.controlledChildren > 0) then + if frame.pickedDisplay == tempGroup and #tempGroup.controlledChildren > 0 then -- Multi selection - local children = {}; - local size = #tempGroup.controlledChildren; + local children = {} + local size = #tempGroup.controlledChildren -- set dragging for selected buttons in reverse for ordering for child in OptionsPrivate.Private.TraverseAllChildren(tempGroup) do - local button = WeakAuras.GetDisplayButton(child.id); + local button = WeakAuras.GetDisplayButton(child.id) button:DragStart("MULTI", true, mainAura, size) children[child.id] = true end -- set dragging for non selected buttons for id, button in pairs(displayButtons) do if not children[button.data.id] then - button:DragStart("MULTI", false, mainAura); + button:DragStart("MULTI", false, mainAura) end end else if mainAura.controlledChildren then -- Group aura local mode = "GROUP" - local children = {}; + local children = {} for child in OptionsPrivate.Private.TraverseAll(mainAura) do - local button = WeakAuras.GetDisplayButton(child.id); + local button = WeakAuras.GetDisplayButton(child.id) button:DragStart(mode, true, mainAura) children[child.id] = true end -- set dragging for non selected buttons for _, button in pairs(displayButtons) do if not children[button.data.id] then - button:DragStart(mode, false, mainAura); + button:DragStart(mode, false, mainAura) end end else for id, button in pairs(displayButtons) do - button:DragStart("SINGLE", id == mainAura.id, mainAura); + button:DragStart("SINGLE", id == mainAura.id, mainAura) end end end @@ -1548,7 +1556,6 @@ function OptionsPrivate.DropIndicator() self.lineTexture:Hide() end end - end return indicator end @@ -1556,7 +1563,7 @@ end function WeakAuras.UpdateThumbnail(data) local id = data.id local button = displayButtons[id] - if (not button) then + if not button then return end button:UpdateThumbnail() @@ -1571,41 +1578,41 @@ function OptionsPrivate.OpenIconPicker(baseObject, paths, groupIcon) end function OptionsPrivate.OpenModelPicker(baseObject, path) - if not(IsAddOnLoaded("WeakAurasModelPaths")) then - local loaded, reason = LoadAddOn("WeakAurasModelPaths"); - if not(loaded) then + if not (IsAddOnLoaded("WeakAurasModelPaths")) then + local loaded, reason = LoadAddOn("WeakAurasModelPaths") + if not loaded then reason = string.lower("|cffff2020" .. _G["ADDON_" .. reason] .. "|r.") - WeakAuras.prettyPrint(string.format(L["ModelPaths could not be loaded, the addon is %s"], reason)); - WeakAuras.ModelPaths = {}; + WeakAuras.prettyPrint(string.format(L["ModelPaths could not be loaded, the addon is %s"], reason)) + WeakAuras.ModelPaths = {} end - frame.modelPicker.modelTree:SetTree(WeakAuras.ModelPaths); + frame.modelPicker.modelTree:SetTree(WeakAuras.ModelPaths) end - frame.modelPicker:Open(baseObject, path); + frame.modelPicker:Open(baseObject, path) end function OptionsPrivate.OpenCodeReview(data) - frame.codereview:Open(data); + frame.codereview:Open(data) end function OptionsPrivate.OpenTriggerTemplate(data, targetId) - if not(IsAddOnLoaded("WeakAurasTemplates")) then - local loaded, reason = LoadAddOn("WeakAurasTemplates"); - if not(loaded) then + if not (IsAddOnLoaded("WeakAurasTemplates")) then + local loaded, reason = LoadAddOn("WeakAurasTemplates") + if not loaded then reason = string.lower("|cffff2020" .. _G["ADDON_" .. reason] .. "|r.") - WeakAuras.prettyPrint(string.format(L["Templates could not be loaded, the addon is %s"], reason)); - return; + WeakAuras.prettyPrint(string.format(L["Templates could not be loaded, the addon is %s"], reason)) + return end - frame.newView = WeakAuras.CreateTemplateView(OptionsPrivate.Private, frame); + frame.newView = WeakAuras.CreateTemplateView(OptionsPrivate.Private, frame) end -- This is called multiple times if a group is selected if frame.window ~= "newView" then - frame.newView:Open(data, targetId); + frame.newView:Open(data, targetId) end end function OptionsPrivate.ResetMoverSizer() - if(frame and frame.mover and frame.moversizer and frame.mover.moving.region and frame.mover.moving.data) then - frame.moversizer:SetToRegion(frame.mover.moving.region, frame.mover.moving.data); + if frame and frame.mover and frame.moversizer and frame.mover.moving.region and frame.mover.moving.data then + frame.moversizer:SetToRegion(frame.mover.moving.region, frame.mover.moving.data) end end @@ -1640,70 +1647,69 @@ function WeakAuras.NewAura(sourceData, regionType, targetId) return t and k and v and t[k] == v end local new_id = WeakAuras.FindUnusedId("New") - local data = {id = new_id, regionType = regionType, uid = WeakAuras.GenerateUniqueID()} - WeakAuras.DeepMixin(data, WeakAuras.data_stub); - if (sourceData) then - WeakAuras.DeepMixin(data, sourceData); + local data = { id = new_id, regionType = regionType, uid = WeakAuras.GenerateUniqueID() } + WeakAuras.DeepMixin(data, WeakAuras.data_stub) + if sourceData then + WeakAuras.DeepMixin(data, sourceData) end - data.internalVersion = WeakAuras.InternalVersion(); - WeakAuras.validate(data, WeakAuras.regionTypes[regionType].default); + data.internalVersion = WeakAuras.InternalVersion() + WeakAuras.validate(data, WeakAuras.regionTypes[regionType].default) AddDefaultSubRegions(data) if targetId then - local target = WeakAuras.GetDisplayButton(targetId); + local target = WeakAuras.GetDisplayButton(targetId) local group - if (target) then - if (target:IsGroup()) then - group = target; + if target then + if target:IsGroup() then + group = target else - group = WeakAuras.GetDisplayButton(target.data.parent); + group = WeakAuras.GetDisplayButton(target.data.parent) end - if (group) then + if group then -- Sanity check so that we don't create a group/dynamic group in a group if (regionType == "group" or regionType == "dynamicgroup") and group.data.regionType == "dynamicgroup" then return end - local children = group.data.controlledChildren; - local index = target:GetGroupOrder(); - if (ensure(children, index, target.data.id)) then + local children = group.data.controlledChildren + local index = target:GetGroupOrder() + if ensure(children, index, target.data.id) then -- account for insert position - index = index + 1; - tinsert(children, index, data.id); + index = index + 1 + tinsert(children, index, data.id) else -- move source into group as the first child - tinsert(children, 1, data.id); + tinsert(children, 1, data.id) end - data.parent = group.data.id; - WeakAuras.Add(data); - WeakAuras.Add(group.data); + data.parent = group.data.id + WeakAuras.Add(data) + WeakAuras.Add(group.data) OptionsPrivate.Private.AddParents(group.data) - WeakAuras.NewDisplayButton(data); - WeakAuras.UpdateGroupOrders(group.data); - OptionsPrivate.ClearOptions(group.data.id); - group.callbacks.UpdateExpandButton(); - group:Expand(); - group:ReloadTooltip(); - OptionsPrivate.PickAndEditDisplay(data.id); + WeakAuras.NewDisplayButton(data) + WeakAuras.UpdateGroupOrders(group.data) + OptionsPrivate.ClearOptions(group.data.id) + group.callbacks.UpdateExpandButton() + group:Expand() + group:ReloadTooltip() + OptionsPrivate.PickAndEditDisplay(data.id) else -- move source into the top-level list - WeakAuras.Add(data); - WeakAuras.NewDisplayButton(data); - OptionsPrivate.PickAndEditDisplay(data.id); + WeakAuras.Add(data) + WeakAuras.NewDisplayButton(data) + OptionsPrivate.PickAndEditDisplay(data.id) end else error(string.format("Calling 'WeakAuras.NewAura' with invalid groupId %s. Reload your UI to fix the display list.", targetId)) end else -- move source into the top-level list - WeakAuras.Add(data); - WeakAuras.NewDisplayButton(data); - OptionsPrivate.PickAndEditDisplay(data.id); + WeakAuras.Add(data) + WeakAuras.NewDisplayButton(data) + OptionsPrivate.PickAndEditDisplay(data.id) end end - function OptionsPrivate.ResetCollapsed(id, namespace) if id then if namespace and collapsedOptions[id] then @@ -1716,10 +1722,14 @@ end function OptionsPrivate.IsCollapsed(id, namespace, path, default) local tmp = collapsedOptions[id] - if tmp == nil then return default end + if tmp == nil then + return default + end tmp = tmp[namespace] - if tmp == nil then return default end + if tmp == nil then + return default + end if type(path) ~= "table" then tmp = tmp[path] @@ -1845,14 +1855,14 @@ function OptionsPrivate.InsertCollapsed(id, namespace, path, value) data[i + 1] = data[i] end end - data[insertPoint] = {[collapsed] = value} + data[insertPoint] = { [collapsed] = value } end function OptionsPrivate.DuplicateCollapseData(id, namespace, path) collapsedOptions[id] = collapsedOptions[id] or {} collapsedOptions[id][namespace] = collapsedOptions[id][namespace] or {} if type(path) ~= "table" then - if (collapsedOptions[id][namespace][path]) then + if collapsedOptions[id][namespace][path] then tinsert(collapsedOptions[id][namespace], path + 1, CopyTable(collapsedOptions[id][namespace][path])) end else @@ -1863,7 +1873,7 @@ function OptionsPrivate.DuplicateCollapseData(id, namespace, path) tmp = tmp[key] end - if (tmp[lastKey]) then + if tmp[lastKey] then tinsert(tmp, lastKey + 1, CopyTable(tmp[lastKey])) end end @@ -1872,7 +1882,7 @@ end function OptionsPrivate.AddTextFormatOption(input, withHeader, get, addOption, hidden, setHidden, withoutColor, index, total) local headerOption if withHeader and (not index or index == 1) then - headerOption = { + headerOption = { type = "execute", control = "WeakAurasExpandSmall", name = L["|cffffcc00Format Options|r"], @@ -1886,15 +1896,14 @@ function OptionsPrivate.AddTextFormatOption(input, withHeader, get, addOption, h imageWidth = 15, imageHeight = 15, arg = { - expanderName = tostring(addOption) - } + expanderName = tostring(addOption), + }, } addOption("header", headerOption) else hidden = false end - local seenSymbols = {} OptionsPrivate.Private.ParseTextStr(input, function(symbol) if not seenSymbols[symbol] then @@ -1908,7 +1917,7 @@ function OptionsPrivate.AddTextFormatOption(input, withHeader, get, addOption, h type = "description", name = L["Format for %s"]:format("%" .. symbol), width = WeakAuras.normalWidth, - hidden = hidden + hidden = hidden, }) addOption(symbol .. "_format", { type = "select", @@ -1916,11 +1925,11 @@ function OptionsPrivate.AddTextFormatOption(input, withHeader, get, addOption, h width = WeakAuras.normalWidth, values = OptionsPrivate.Private.format_types_display, hidden = hidden, - reloadOptions = true + reloadOptions = true, }) local selectedFormat = get(symbol .. "_format") - if (OptionsPrivate.Private.format_types[selectedFormat]) then + if OptionsPrivate.Private.format_types[selectedFormat] then OptionsPrivate.Private.format_types[selectedFormat].AddOptions(symbol, hidden, addOption, get, withoutColor) end seenSymbols[symbol] = true @@ -1929,17 +1938,14 @@ function OptionsPrivate.AddTextFormatOption(input, withHeader, get, addOption, h end) if withHeader and (not index or index == total) then - addOption("header_anchor", - { + addOption("header_anchor", { type = "description", name = "", control = "WeakAurasExpandAnchor", arg = { - expanderName = tostring(addOption) - } - } - - ) + expanderName = tostring(addOption), + }, + }) end if not next(seenSymbols) and headerOption and not index then diff --git a/WeakAurasTemplates/AceGUI-Widgets/AceGUIContainer-WeakAurasTemplateGroup.lua b/WeakAurasTemplates/AceGUI-Widgets/AceGUIContainer-WeakAurasTemplateGroup.lua index ad48e4720e..ffbf478687 100644 --- a/WeakAurasTemplates/AceGUI-Widgets/AceGUIContainer-WeakAurasTemplateGroup.lua +++ b/WeakAurasTemplates/AceGUI-Widgets/AceGUIContainer-WeakAurasTemplateGroup.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end --[[----------------------------------------------------------------------------- WeakAurasTemplateGroup Container @@ -6,7 +8,9 @@ Simple container that is used in the template selection -------------------------------------------------------------------------------]] local Type, Version = "WeakAurasTemplateGroup", 1 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) -if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end +if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then + return +end -- Lua APIs local pairs = pairs @@ -24,7 +28,9 @@ local methods = { end, ["LayoutFinished"] = function(self, width, height) - if self.noAutoHeight then return end + if self.noAutoHeight then + return + end self:SetHeight((height or 0) + 15) end, @@ -46,17 +52,19 @@ local methods = { end content:SetHeight(contentheight) content.height = contentheight - end + end, } --[[----------------------------------------------------------------------------- Constructor -------------------------------------------------------------------------------]] -local PaneBackdrop = { +local PaneBackdrop = { bgFile = "Interface\\ChatFrame\\ChatFrameBackground", edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", - tile = true, tileSize = 16, edgeSize = 16, - insets = { left = 3, right = 3, top = 5, bottom = 3 } + tile = true, + tileSize = 16, + edgeSize = 16, + insets = { left = 3, right = 3, top = 5, bottom = 3 }, } local function Constructor() @@ -69,9 +77,9 @@ local function Constructor() content:SetPoint("BOTTOMRIGHT", 0, 15) local widget = { - frame = frame, - content = content, - type = Type + frame = frame, + content = content, + type = Type, } for method, func in pairs(methods) do widget[method] = func diff --git a/WeakAurasTemplates/Locales/deDE.lua b/WeakAurasTemplates/Locales/deDE.lua index 9a474c0178..d2a76fef75 100644 --- a/WeakAurasTemplates/Locales/deDE.lua +++ b/WeakAurasTemplates/Locales/deDE.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end if GetLocale() ~= "deDE" then return diff --git a/WeakAurasTemplates/Locales/enUS.lua b/WeakAurasTemplates/Locales/enUS.lua index b1c4d8bb57..2a57bc82b2 100644 --- a/WeakAurasTemplates/Locales/enUS.lua +++ b/WeakAurasTemplates/Locales/enUS.lua @@ -1,11 +1,15 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end local L = WeakAuras.L --@localization(locale="enUS", format="lua_additive_table", namespace="WeakAuras / Templates")@ -- Make missing translations available -setmetatable(WeakAuras.L, {__index = function(self, key) - self[key] = (key or "") - return key -end}) +setmetatable(WeakAuras.L, { + __index = function(self, key) + self[key] = (key or "") + return key + end, +}) diff --git a/WeakAurasTemplates/Locales/esES.lua b/WeakAurasTemplates/Locales/esES.lua index 708ebfb6bd..077df5b886 100644 --- a/WeakAurasTemplates/Locales/esES.lua +++ b/WeakAurasTemplates/Locales/esES.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end if GetLocale() ~= "esES" then return diff --git a/WeakAurasTemplates/Locales/esMX.lua b/WeakAurasTemplates/Locales/esMX.lua index 2889e7b45f..945d3f0ebd 100644 --- a/WeakAurasTemplates/Locales/esMX.lua +++ b/WeakAurasTemplates/Locales/esMX.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end if GetLocale() ~= "esMX" then return diff --git a/WeakAurasTemplates/Locales/frFR.lua b/WeakAurasTemplates/Locales/frFR.lua index 1d333b849b..ee4cdff361 100644 --- a/WeakAurasTemplates/Locales/frFR.lua +++ b/WeakAurasTemplates/Locales/frFR.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end if GetLocale() ~= "frFR" then return diff --git a/WeakAurasTemplates/Locales/itIT.lua b/WeakAurasTemplates/Locales/itIT.lua index 21b913d60f..1de3f8a34a 100644 --- a/WeakAurasTemplates/Locales/itIT.lua +++ b/WeakAurasTemplates/Locales/itIT.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end if GetLocale() ~= "itIT" then return diff --git a/WeakAurasTemplates/Locales/koKR.lua b/WeakAurasTemplates/Locales/koKR.lua index 94b5a56a64..a9d754fe9a 100644 --- a/WeakAurasTemplates/Locales/koKR.lua +++ b/WeakAurasTemplates/Locales/koKR.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end if GetLocale() ~= "koKR" then return diff --git a/WeakAurasTemplates/Locales/ptBR.lua b/WeakAurasTemplates/Locales/ptBR.lua index bae859baec..1fd5fff7f2 100644 --- a/WeakAurasTemplates/Locales/ptBR.lua +++ b/WeakAurasTemplates/Locales/ptBR.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end if GetLocale() ~= "ptBR" then return diff --git a/WeakAurasTemplates/Locales/ruRU.lua b/WeakAurasTemplates/Locales/ruRU.lua index 9ac8b9dd55..994e7d688d 100644 --- a/WeakAurasTemplates/Locales/ruRU.lua +++ b/WeakAurasTemplates/Locales/ruRU.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end if GetLocale() ~= "ruRU" then return diff --git a/WeakAurasTemplates/Locales/zhCN.lua b/WeakAurasTemplates/Locales/zhCN.lua index 39bfe436f6..39e3298cf8 100644 --- a/WeakAurasTemplates/Locales/zhCN.lua +++ b/WeakAurasTemplates/Locales/zhCN.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end if GetLocale() ~= "zhCN" then return diff --git a/WeakAurasTemplates/Locales/zhTW.lua b/WeakAurasTemplates/Locales/zhTW.lua index 2f8f16917e..0eeed7dc10 100644 --- a/WeakAurasTemplates/Locales/zhTW.lua +++ b/WeakAurasTemplates/Locales/zhTW.lua @@ -1,4 +1,6 @@ -if not WeakAuras.IsLibsOK() then return end +if not WeakAuras.IsLibsOK() then + return +end if GetLocale() ~= "zhTW" then return diff --git a/WeakAurasTemplates/TriggerTemplates.lua b/WeakAurasTemplates/TriggerTemplates.lua index 0043ea03af..ccd3268b58 100644 --- a/WeakAurasTemplates/TriggerTemplates.lua +++ b/WeakAurasTemplates/TriggerTemplates.lua @@ -2,28 +2,28 @@ local AddonName, TemplatePrivate = ... -local AceGUI = LibStub("AceGUI-3.0"); -local floor, ceil, tinsert = floor, ceil, tinsert; -local CreateFrame, UnitClass, UnitRace, GetSpecialization = CreateFrame, UnitClass, UnitRace, GetSpecialization; -local WeakAuras = WeakAuras; +local AceGUI = LibStub("AceGUI-3.0") +local floor, ceil, tinsert = floor, ceil, tinsert +local CreateFrame, UnitClass, UnitRace, GetSpecialization = CreateFrame, UnitClass, UnitRace, GetSpecialization +local WeakAuras = WeakAuras local L = WeakAuras.L AceGUI:RegisterLayout("WATemplateTriggerLayoutFlyout", function(content, children) local width = content.width or content:GetWidth() or 0 - local columns = floor(width / 250); + local columns = floor(width / 250) - local rows = columns > 0 and ceil(#children / columns) or 0; - columns = rows > 0 and ceil(#children / rows) or 1; - local relWidth = 1 / columns; + local rows = columns > 0 and ceil(#children / columns) or 0 + columns = rows > 0 and ceil(#children / rows) or 1 + local relWidth = 1 / columns for i = 1, #children do local child = children[i] - if (not child:IsFullWidth()) then - child:SetRelativeWidth(relWidth); + if not child:IsFullWidth() then + child:SetRelativeWidth(relWidth) end end - local flowLayout = AceGUI:GetLayout("Flow"); - flowLayout(content, children); -end); + local flowLayout = AceGUI:GetLayout("Flow") + flowLayout(content, children) +end) local colors = { grey = { 0.5, 0.5, 0.5, 1 }, @@ -31,46 +31,46 @@ local colors = { red = { 0.8, 0.1, 0.1, 1 }, white = { 1, 1, 1, 1 }, yellow = { 1, 1, 0, 1 }, - green = { 0, 1, 0, 1}, -}; + green = { 0, 1, 0, 1 }, +} local regionColorProperty = { icon = "color", - aurabar= "barColor", + aurabar = "barColor", progresstexture = "foregroundColor", text = "color", texture = "color", -}; +} local function changes(property, regionType) if colors[property] and regionColorProperty[regionType] then return { value = colors[property], property = regionColorProperty[regionType], - }; + } elseif property == "glow" and (regionType == "icon" or regionType == "aurabar") then local subregionPos = regionType == "aurabar" and 1 or 2 return { value = true, - property = "sub."..subregionPos..".glow" - }; + property = "sub." .. subregionPos .. ".glow", + } elseif WeakAuras.regionTypes[regionType].default[property] == nil then - return nil; + return nil elseif property == "cooldownSwipe" then return { value = true, property = "cooldownSwipe", - }; + } elseif property == "alpha" then return { value = 0.5, property = "alpha", - }; + } elseif property == "inverse" then return { value = false, property = "inverse", - }; + } end end @@ -88,7 +88,7 @@ local checks = { variable = "hastarget", value = 0, }, - insufficientResources = { + insufficientResources = { variable = "insufficientResources", value = 1, }, @@ -135,67 +135,67 @@ local checks = { }, enchantMissing = { variable = "enchanted", - value = 0 + value = 0, }, queued = { variable = "show", value = 1, - } + }, } local function buildCondition(trigger, check, properties) - local result = {}; - result.check = CopyTable(check); - if (not result.check.trigger) then - result.check.trigger = trigger; + local result = {} + result.check = CopyTable(check) + if not result.check.trigger then + result.check.trigger = trigger end - result.changes = {}; - local hasChanges = false; + result.changes = {} + local hasChanges = false for index, v in ipairs(properties) do - result.changes[index] = CopyTable(v); - hasChanges = true; + result.changes[index] = CopyTable(v) + hasChanges = true end - return hasChanges and result or nil; + return hasChanges and result or nil end local function missingBuffGreyed(conditions, trigger, regionType) - tinsert(conditions, buildCondition(trigger, checks.buffedFalseAuraAlways, {changes("grey", regionType)})); + tinsert(conditions, buildCondition(trigger, checks.buffedFalseAuraAlways, { changes("grey", regionType) })) end local function hasTargetAlpha(conditions, regionType) - tinsert(conditions, buildCondition(nil, checks.hasTarget, {changes("alpha", regionType)})); + tinsert(conditions, buildCondition(nil, checks.hasTarget, { changes("alpha", regionType) })) end local function isNotUsableBlue(conditions, trigger, regionType) - tinsert(conditions, buildCondition(trigger, checks.usable, {changes("blue", regionType)})); + tinsert(conditions, buildCondition(trigger, checks.usable, { changes("blue", regionType) })) end local function insufficientResourcesBlue(conditions, trigger, regionType) - tinsert(conditions, buildCondition(trigger, checks.insufficientResources, {changes("blue", regionType)})); + tinsert(conditions, buildCondition(trigger, checks.insufficientResources, { changes("blue", regionType) })) end local function hasChargesGrey(conditions, trigger, regionType) if regionType == "icon" then - tinsert(conditions, buildCondition(trigger, checks.charges, {changes("cooldownSwipe", regionType)})); + tinsert(conditions, buildCondition(trigger, checks.charges, { changes("cooldownSwipe", regionType) })) else - tinsert(conditions, buildCondition(trigger, checks.charges, {changes("grey", regionType)})); + tinsert(conditions, buildCondition(trigger, checks.charges, { changes("grey", regionType) })) end end local function isOnCdGrey(conditions, trigger, regionType) - tinsert(conditions, buildCondition(trigger, checks.onCooldown, {changes("grey", regionType)})); + tinsert(conditions, buildCondition(trigger, checks.onCooldown, { changes("grey", regionType) })) end local function GenericGlow(conditions, trigger, regionType, check) if regionType == "icon" then - tinsert(conditions, buildCondition(trigger, check, {changes("inverse", regionType), changes("glow", regionType), changes("white", regionType)})); + tinsert(conditions, buildCondition(trigger, check, { changes("inverse", regionType), changes("glow", regionType), changes("white", regionType) })) elseif regionType == "aurabar" then - tinsert(conditions, buildCondition(trigger, check, {changes("inverse", regionType), changes("glow", regionType), changes("yellow", regionType)})); + tinsert(conditions, buildCondition(trigger, check, { changes("inverse", regionType), changes("glow", regionType), changes("yellow", regionType) })) elseif regionType == "progresstexture" then - tinsert(conditions, buildCondition(trigger, check, {changes("inverse", regionType), changes("yellow", regionType)})); + tinsert(conditions, buildCondition(trigger, check, { changes("inverse", regionType), changes("yellow", regionType) })) else - tinsert(conditions, buildCondition(trigger, check, {changes("yellow", regionType)})); + tinsert(conditions, buildCondition(trigger, check, { changes("yellow", regionType) })) end end @@ -220,27 +220,27 @@ local function totemActiveGlow(conditions, trigger, regionType) end local function isMissingEnchantGlow(conditions, trigger, regionType) - tinsert(conditions, buildCondition(trigger, checks.enchantMissing, {changes("glow", regionType)})); + tinsert(conditions, buildCondition(trigger, checks.enchantMissing, { changes("glow", regionType) })) end local function overlayGlow(conditions, trigger, regionType) if regionType == "icon" or regionType == "aurabar" then - tinsert(conditions, buildCondition(trigger, checks.overlayGlow, {changes("glow", regionType)})); + tinsert(conditions, buildCondition(trigger, checks.overlayGlow, { changes("glow", regionType) })) else - tinsert(conditions, buildCondition(trigger, checks.overlayGlow, {changes("yellow", regionType)})); + tinsert(conditions, buildCondition(trigger, checks.overlayGlow, { changes("yellow", regionType) })) end end local function uninterruptibleRed(conditions, trigger, regionType) - tinsert(conditions, buildCondition(trigger, checks.uninterruptible, {changes("red", regionType)})); + tinsert(conditions, buildCondition(trigger, checks.uninterruptible, { changes("red", regionType) })) end local function isSpellNotInRangeRed(conditions, trigger, regionType) - tinsert(conditions, buildCondition(trigger, checks.spellInRange, {changes("red", regionType)})); + tinsert(conditions, buildCondition(trigger, checks.spellInRange, { changes("red", regionType) })) end local function itemInRangeRed(conditions, trigger, regionType) - tinsert(conditions, buildCondition(trigger, checks.itemInRange, {changes("red", regionType)})); + tinsert(conditions, buildCondition(trigger, checks.itemInRange, { changes("red", regionType) })) end local function createBuffTrigger(triggers, position, item, buffShowOn, isBuff) @@ -252,8 +252,8 @@ local function createBuffTrigger(triggers, position, item, buffShowOn, isBuff) debuffType = isBuff and "HELPFUL" or "HARMFUL", ownOnly = not item.forceOwnOnly and true or item.ownOnly, unitExists = false, - } - }; + }, + } if item.spellIds then if item.exactSpellId then @@ -279,18 +279,18 @@ local function createBuffTrigger(triggers, position, item, buffShowOn, isBuff) end end - if triggers[position].trigger.unit == "multi" and buffShowOn == "showOnActive" then + if triggers[position].trigger.unit == "multi" and buffShowOn == "showOnActive" then local trigger = triggers[position].trigger trigger.useGroup_count = true - trigger.group_countOperator = ">=" + trigger.group_countOperator = ">=" trigger.group_count = "1" end - if (item.unit == "group") then - triggers[position].trigger.name_info = "players"; + if item.unit == "group" then + triggers[position].trigger.name_info = "players" end - if (item.unit == "multi") then - triggers[position].trigger.spellId = item.buffId or item.spell; + if item.unit == "multi" then + triggers[position].trigger.spellId = item.buffId or item.spell end end @@ -305,8 +305,8 @@ local function createDurationTrigger(triggers, position, item) use_spellId = true, spellId = tostring(item.spell), duration = tostring(item.duration), - } - }; + }, + } end local function createTotemTrigger(triggers, position, item) @@ -316,11 +316,11 @@ local function createTotemTrigger(triggers, position, item) event = "Totem", use_totemName = item.totemNumber == nil, totemName = GetSpellInfo(item.spell), - } - }; - if (item.totemNumber) then - triggers[position].trigger.use_totemType = true; - triggers[position].trigger.totemType = item.totemNumber; + }, + } + if item.totemNumber then + triggers[position].trigger.use_totemType = true + triggers[position].trigger.totemType = item.totemNumber end end @@ -335,7 +335,7 @@ local function createPowerTrigger(triggers, position, item) use_showCost = true, powertype = item.powertype, }, - }; + } end local function createHealthTrigger(triggers, position, item) @@ -349,7 +349,7 @@ local function createHealthTrigger(triggers, position, item) use_showAbsorb = true, use_showIncomingHeal = true, }, - }; + } end local function createCastTrigger(triggers, position, item) @@ -360,7 +360,7 @@ local function createCastTrigger(triggers, position, item) use_unit = true, unit = item.unit or "player", }, - }; + } end local function createAbilityTrigger(triggers, position, item, genericShowOn) @@ -371,8 +371,8 @@ local function createAbilityTrigger(triggers, position, item, genericShowOn) spellName = item.spell, use_genericShowOn = true, genericShowOn = genericShowOn, - } - }; + }, + } if genericShowOn == "showOnReady" then triggers[position].trigger.use_track = true triggers[position].trigger.track = "cooldown" @@ -387,8 +387,8 @@ local function createItemTrigger(triggers, position, item, genericShowOn) use_genericShowOn = true, genericShowOn = genericShowOn, itemName = item.spell, - } - }; + }, + } end local function createOverlayGlowTrigger(triggers, position, item) @@ -397,8 +397,8 @@ local function createOverlayGlowTrigger(triggers, position, item) type = WeakAuras.GetTriggerCategoryFor("Spell Activation Overlay"), event = "Spell Activation Overlay", spellName = item.spell, - } - }; + }, + } end local function createWeaponEnchantTrigger(triggers, position, item, showOn) @@ -409,8 +409,8 @@ local function createWeaponEnchantTrigger(triggers, position, item, showOn) use_enchant = true, enchant = tostring(item.enchant), weapon = item.weapon, - showOn = showOn - } + showOn = showOn, + }, } end @@ -419,147 +419,147 @@ local function createQueuedActionTrigger(triggers, position, item) trigger = { type = WeakAuras.GetTriggerCategoryFor("Queued Action"), event = "Queued Action", - spellName = item.spell - } + spellName = item.spell, + }, } end local function createAbilityAndQueuedActionTrigger(triggers, item) - createAbilityTrigger(triggers, 1, item, "showAlways"); - createQueuedActionTrigger(triggers, 2, item); + createAbilityTrigger(triggers, 1, item, "showAlways") + createQueuedActionTrigger(triggers, 2, item) end local function createAbilityAndDurationTrigger(triggers, item) - createDurationTrigger(triggers, 1, item); - createAbilityTrigger(triggers, 2, item, "showAlways"); + createDurationTrigger(triggers, 1, item) + createAbilityTrigger(triggers, 2, item, "showAlways") end local function createAbilityAndBuffTrigger(triggers, item) - createBuffTrigger(triggers, 1, item, "showOnActive", true); - createAbilityTrigger(triggers, 2, item, "showAlways"); + createBuffTrigger(triggers, 1, item, "showOnActive", true) + createAbilityTrigger(triggers, 2, item, "showAlways") end local function createAbilityAndDebuffTrigger(triggers, item) - createBuffTrigger(triggers, 1, item, "showOnActive", false); - createAbilityTrigger(triggers, 2, item, "showAlways"); + createBuffTrigger(triggers, 1, item, "showOnActive", false) + createAbilityTrigger(triggers, 2, item, "showAlways") end local function createAbilityAndOverlayGlowTrigger(triggers, item) - createAbilityTrigger(triggers, 1, item, "showAlways"); - createOverlayGlowTrigger(triggers, 2, item); + createAbilityTrigger(triggers, 1, item, "showAlways") + createOverlayGlowTrigger(triggers, 2, item) end -- Create preview thumbnail local function createThumbnail(parent) -- Preview frame - local borderframe = CreateFrame("Frame", nil, parent); - borderframe:SetWidth(32); - borderframe:SetHeight(32); + local borderframe = CreateFrame("Frame", nil, parent) + borderframe:SetWidth(32) + borderframe:SetHeight(32) -- Preview border - local border = borderframe:CreateTexture(nil, "OVERLAY"); - border:SetAllPoints(borderframe); - border:SetTexture("Interface\\BUTTONS\\UI-Quickslot2.blp"); - border:SetTexCoord(0.2, 0.8, 0.2, 0.8); + local border = borderframe:CreateTexture(nil, "OVERLAY") + border:SetAllPoints(borderframe) + border:SetTexture("Interface\\BUTTONS\\UI-Quickslot2.blp") + border:SetTexCoord(0.2, 0.8, 0.2, 0.8) -- Main region - local region = CreateFrame("Frame", nil, borderframe); - borderframe.region = region; + local region = CreateFrame("Frame", nil, borderframe) + borderframe.region = region -- Preview children - region.children = {}; + region.children = {} -- Return preview - return borderframe; + return borderframe end local function subTypesFor(item, regionType) - local types = {}; + local types = {} local icon = { target = function() - local thumbnail = createThumbnail(); - local t1 = thumbnail:CreateTexture(nil, "ARTWORK"); - t1:SetTexture(134376); - t1:SetAllPoints(thumbnail); + local thumbnail = createThumbnail() + local t1 = thumbnail:CreateTexture(nil, "ARTWORK") + t1:SetTexture(134376) + t1:SetAllPoints(thumbnail) - thumbnail.elapsed = 0; + thumbnail.elapsed = 0 thumbnail:SetScript("OnUpdate", function(self, elapsed) - self.elapsed = self.elapsed + elapsed; - if(self.elapsed < 0.5) then - t1:SetVertexColor(1,0,0,1); - elseif(self.elapsed < 1.5) then - t1:SetVertexColor(1,1,1,1); - elseif(self.elapsed < 3) then + self.elapsed = self.elapsed + elapsed + if self.elapsed < 0.5 then + t1:SetVertexColor(1, 0, 0, 1) + elseif self.elapsed < 1.5 then + t1:SetVertexColor(1, 1, 1, 1) + elseif self.elapsed < 3 then -- Do nothing else - self.elapsed = self.elapsed - 3; + self.elapsed = self.elapsed - 3 end - end); - return thumbnail; + end) + return thumbnail end, -- 132212, glow = function() - local thumbnail = createThumbnail(); - local t1 = thumbnail:CreateTexture(nil, "ARTWORK"); - t1:SetTexture(134376); - t1:SetAllPoints(thumbnail); - WeakAuras.ShowOverlayGlow(thumbnail); -- where to call HideOverlayGlow() ? - return thumbnail; + local thumbnail = createThumbnail() + local t1 = thumbnail:CreateTexture(nil, "ARTWORK") + t1:SetTexture(134376) + t1:SetAllPoints(thumbnail) + WeakAuras.ShowOverlayGlow(thumbnail) -- where to call HideOverlayGlow() ? + return thumbnail end, -- 571554 charges = function() - local thumbnail = createThumbnail(); - local t1 = thumbnail:CreateTexture(nil, "ARTWORK"); - t1:SetTexture(134376); - t1:SetAllPoints(thumbnail); - local t2 = thumbnail:CreateFontString(nil, "ARTWORK"); - t2:SetFont(STANDARD_TEXT_FONT, 14, "OUTLINE"); - t2:SetTextColor(1,1,1,1); - t2:SetText("2"); - t2:SetPoint("BOTTOMRIGHT", -2, 2); - return thumbnail; + local thumbnail = createThumbnail() + local t1 = thumbnail:CreateTexture(nil, "ARTWORK") + t1:SetTexture(134376) + t1:SetAllPoints(thumbnail) + local t2 = thumbnail:CreateFontString(nil, "ARTWORK") + t2:SetFont(STANDARD_TEXT_FONT, 14, "OUTLINE") + t2:SetTextColor(1, 1, 1, 1) + t2:SetText("2") + t2:SetPoint("BOTTOMRIGHT", -2, 2) + return thumbnail end, cd = 134377, cd2 = 134376, - }; + } local data = {} local dataGlow = {} if regionType == "aurabar" then dataGlow.subRegions = { - [1] = WeakAuras.getDefaultGlow(regionType) + [1] = WeakAuras.getDefaultGlow(regionType), } end - if (item.type == "ability") then + if item.type == "ability" then tinsert(types, { fallback = true, icon = icon.cd, title = L["Basic Show On Cooldown"], description = L["Only shows the aura when the ability is on cooldown."], createTriggers = function(triggers, item) - createAbilityTrigger(triggers, 1, item, "showOnCooldown"); + createAbilityTrigger(triggers, 1, item, "showOnCooldown") end, - }); + }) tinsert(types, { icon = icon.cd, title = L["Basic Show On Cooldown"], description = L["Only shows the aura when the ability is on cooldown."], createTriggers = function(triggers, item) - createAbilityTrigger(triggers, 1, item, "showOnCooldown"); + createAbilityTrigger(triggers, 1, item, "showOnCooldown") end, createConditions = function(conditions, item, regionType) isNotUsableBlue(conditions, 1, regionType) end, - }); + }) tinsert(types, { icon = icon.cd, title = L["Basic Show On Ready"], description = L["Only shows the aura when the ability is ready to use."], createTriggers = function(triggers, item) - createAbilityTrigger(triggers, 1, item, "showOnReady"); + createAbilityTrigger(triggers, 1, item, "showOnReady") end, createConditions = function(conditions, item, regionType) isNotUsableBlue(conditions, 1, regionType) end, - }); - if (item.charges) then + }) + if item.charges then data.cooldownSwipe = false data.cooldownEdge = true dataGlow.cooldownSwipe = false @@ -569,143 +569,143 @@ local function subTypesFor(item, regionType) title = L["Charge Tracking"], description = L["Always shows the aura, turns blue on insufficient resources."], createTriggers = function(triggers, item) - createAbilityTrigger(triggers, 1, item, "showAlways"); + createAbilityTrigger(triggers, 1, item, "showAlways") end, createConditions = function(conditions, item, regionType) - insufficientResourcesBlue(conditions, 1, regionType); - hasChargesGrey(conditions, 1, regionType); + insufficientResourcesBlue(conditions, 1, regionType) + hasChargesGrey(conditions, 1, regionType) end, data = data, - }); - if (item.duration) then + }) + if item.duration then tinsert(types, { icon = icon.glow, title = L["Charge and Duration Tracking"], description = L["Tracks the charge and the duration of spell, highlight while the spell is active, blue on insufficient resources."], createTriggers = createAbilityAndDurationTrigger, createConditions = function(conditions, item, regionType) - insufficientResourcesBlue(conditions, 2, regionType); - hasChargesGrey(conditions, 2, regionType); - isDurationGlow(conditions, 1, regionType); + insufficientResourcesBlue(conditions, 2, regionType) + hasChargesGrey(conditions, 2, regionType) + isDurationGlow(conditions, 1, regionType) end, data = dataGlow, - }); - elseif (item.buff) then + }) + elseif item.buff then tinsert(types, { icon = icon.glow, title = L["Charge and Buff Tracking"], description = L["Tracks the charge and the buff, highlight while the buff is active, blue on insufficient resources."], createTriggers = createAbilityAndBuffTrigger, createConditions = function(conditions, item, regionType) - insufficientResourcesBlue(conditions, 2, regionType); - hasChargesGrey(conditions, 2, regionType); - isBuffedGlow(conditions, 1, regionType); + insufficientResourcesBlue(conditions, 2, regionType) + hasChargesGrey(conditions, 2, regionType) + isBuffedGlow(conditions, 1, regionType) end, data = dataGlow, - }); - elseif(item.debuff) then + }) + elseif item.debuff then tinsert(types, { icon = icon.glow, title = L["Charge and Debuff Tracking"], description = L["Tracks the charge and the debuff, highlight while the debuff is active, blue on insufficient resources."], createTriggers = createAbilityAndDebuffTrigger, createConditions = function(conditions, item, regionType) - insufficientResourcesBlue(conditions, 2, regionType); - hasChargesGrey(conditions, 2, regionType); - isBuffedGlow(conditions, 1, regionType); + insufficientResourcesBlue(conditions, 2, regionType) + hasChargesGrey(conditions, 2, regionType) + isBuffedGlow(conditions, 1, regionType) end, data = dataGlow, }) - elseif(item.requiresTarget) then - tinsert(types, { + elseif item.requiresTarget then + tinsert(types, { icon = icon.target, title = L["Show Charges with Range Tracking"], description = L["Always shows the aura, turns red when out of range, blue on insufficient resources."], genericShowOn = "showAlways", createTriggers = function(triggers, item) - createAbilityTrigger(triggers, 1, item, "showAlways"); + createAbilityTrigger(triggers, 1, item, "showAlways") end, createConditions = function(conditions, item, regionType) - insufficientResourcesBlue(conditions, 1, regionType); - hasChargesGrey(conditions, 1, regionType); - isSpellNotInRangeRed(conditions, 1, regionType); + insufficientResourcesBlue(conditions, 1, regionType) + hasChargesGrey(conditions, 1, regionType) + isSpellNotInRangeRed(conditions, 1, regionType) end, data = data, - }); - if (item.usable) then - tinsert(types, { + }) + if item.usable then + tinsert(types, { icon = icon.target, title = L["Show Charges with Usable Check"], description = L["Always shows the aura, turns red when out of range, blue on insufficient resources."], createTriggers = function(triggers, item) - createAbilityTrigger(triggers, 1, item, "showAlways"); + createAbilityTrigger(triggers, 1, item, "showAlways") end, createConditions = function(conditions, item, regionType) - isNotUsableBlue(conditions, 1, regionType); - hasChargesGrey(conditions, 1, regionType); - isSpellNotInRangeRed(conditions, 1, regionType); + isNotUsableBlue(conditions, 1, regionType) + hasChargesGrey(conditions, 1, regionType) + isSpellNotInRangeRed(conditions, 1, regionType) end, data = data, - }); + }) end - if (item.overlayGlow) then - tinsert(types, { + if item.overlayGlow then + tinsert(types, { icon = icon.glow, title = L["Show Charges with Proc Tracking"], description = L["Track the charge and proc, highlight while proc is active, turns red when out of range, blue on insufficient resources."], createTriggers = createAbilityAndOverlayGlowTrigger, createConditions = function(conditions, item, regionType) - isNotUsableBlue(conditions, 1, regionType); - hasChargesGrey(conditions, 1, regionType); - isSpellNotInRangeRed(conditions, 1, regionType); - overlayGlow(conditions, 2, regionType); + isNotUsableBlue(conditions, 1, regionType) + hasChargesGrey(conditions, 1, regionType) + isSpellNotInRangeRed(conditions, 1, regionType) + overlayGlow(conditions, 2, regionType) end, data = dataGlow, - }); + }) end - elseif(item.totem) then + elseif item.totem then tinsert(types, { icon = icon.charges, title = L["Show Totem and Charge Information"], description = L["Always shows the aura, highlight when active, turns blue on insufficient resources."], createTriggers = function(triggers, item) - createTotemTrigger(triggers, 1, item); - createAbilityTrigger(triggers, 2, item, "showAlways"); + createTotemTrigger(triggers, 1, item) + createAbilityTrigger(triggers, 2, item, "showAlways") end, createConditions = function(conditions, item, regionType) - insufficientResourcesBlue(conditions, 2, regionType); - hasChargesGrey(conditions, 2, regionType); - totemActiveGlow(conditions, 1, regionType); + insufficientResourcesBlue(conditions, 2, regionType) + hasChargesGrey(conditions, 2, regionType) + totemActiveGlow(conditions, 1, regionType) end, data = dataGlow, - }); - elseif(item.usable) then + }) + elseif item.usable then tinsert(types, { icon = icon.charges, title = L["Show Charges and Check Usable"], description = L["Always shows the aura, turns blue when not usable."], createTriggers = function(triggers, item) - createAbilityTrigger(triggers, 1, item, "showAlways"); + createAbilityTrigger(triggers, 1, item, "showAlways") end, createConditions = function(conditions, item, regionType) - isNotUsableBlue(conditions, 1, regionType); - hasChargesGrey(conditions, 1, regionType); + isNotUsableBlue(conditions, 1, regionType) + hasChargesGrey(conditions, 1, regionType) end, data = data, - }); - if (item.overlayGlow) then - tinsert(types, { + }) + if item.overlayGlow then + tinsert(types, { icon = icon.glow, title = L["Show Charges with Proc Tracking"], description = L["Always shows the aura, highlight while proc is active, blue when not usable."], createTriggers = createAbilityAndOverlayGlowTrigger, createConditions = function(conditions, item, regionType) - isNotUsableBlue(conditions, 1, regionType); - hasChargesGrey(conditions, 1, regionType); - overlayGlow(conditions, 2, regionType); + isNotUsableBlue(conditions, 1, regionType) + hasChargesGrey(conditions, 1, regionType) + overlayGlow(conditions, 2, regionType) end, data = dataGlow, - }); + }) end end else -- Ability without charges @@ -714,14 +714,14 @@ local function subTypesFor(item, regionType) title = L["Cooldown Tracking"], description = L["Always shows the aura, turns blue when not usable."], createTriggers = function(triggers, item) - createAbilityTrigger(triggers, 1, item, "showAlways"); + createAbilityTrigger(triggers, 1, item, "showAlways") end, createConditions = function(conditions, item, regionType) - insufficientResourcesBlue(conditions, 1, regionType); - isOnCdGrey(conditions, 1, regionType); + insufficientResourcesBlue(conditions, 1, regionType) + isOnCdGrey(conditions, 1, regionType) end, - }); - if (item.duration) then + }) + if item.duration then data.cooldownSwipe = false data.cooldownEdge = true dataGlow.cooldownSwipe = false @@ -732,82 +732,82 @@ local function subTypesFor(item, regionType) description = L["Highlight while spell is active."], createTriggers = createAbilityAndDurationTrigger, createConditions = function(conditions, item, regionType) - insufficientResourcesBlue(conditions, 2, regionType); - isOnCdGrey(conditions, 2, regionType); - isDurationGlow(conditions, 1, regionType); + insufficientResourcesBlue(conditions, 2, regionType) + isOnCdGrey(conditions, 2, regionType) + isDurationGlow(conditions, 1, regionType) end, - data = dataGlow - }); - if (item.usable) then + data = dataGlow, + }) + if item.usable then tinsert(types, { icon = icon.glow, title = L["Show Cooldown and Duration and Check Usable"], description = L["Highlight while active."], createTriggers = createAbilityAndDurationTrigger, createConditions = function(conditions, item, regionType) - isNotUsableBlue(conditions, 2, regionType); - isOnCdGrey(conditions, 2, regionType); - isDurationGlow(conditions, 1, regionType); + isNotUsableBlue(conditions, 2, regionType) + isOnCdGrey(conditions, 2, regionType) + isDurationGlow(conditions, 1, regionType) end, - data = dataGlow - }); + data = dataGlow, + }) end - if (item.requiresTarget) then + if item.requiresTarget then tinsert(types, { icon = icon.target, title = L["Show Cooldown and Duration and Check for Target"], description = L["Highlight while active, red when out of range."], createTriggers = createAbilityAndDurationTrigger, createConditions = function(conditions, item, regionType) - insufficientResourcesBlue(conditions, 2, regionType); - isOnCdGrey(conditions, 2, regionType); - isSpellNotInRangeRed(conditions, 2, regionType); - isDurationGlow(conditions, 1, regionType); + insufficientResourcesBlue(conditions, 2, regionType) + isOnCdGrey(conditions, 2, regionType) + isSpellNotInRangeRed(conditions, 2, regionType) + isDurationGlow(conditions, 1, regionType) end, - data = dataGlow - }); + data = dataGlow, + }) end - elseif (item.queued) then + elseif item.queued then tinsert(types, { icon = icon.glow, title = L["Show Cooldown and Action Queued"], description = L["Highlight while action is queued."], createTriggers = createAbilityAndQueuedActionTrigger, createConditions = function(conditions, item, regionType) - insufficientResourcesBlue(conditions, 1, regionType); - isOnCdGrey(conditions, 1, regionType); - isQueuedGlow(conditions, 2, regionType); + insufficientResourcesBlue(conditions, 1, regionType) + isOnCdGrey(conditions, 1, regionType) + isQueuedGlow(conditions, 2, regionType) end, - data = dataGlow - }); - elseif (item.buff) then + data = dataGlow, + }) + elseif item.buff then tinsert(types, { icon = icon.glow, title = L["Show Cooldown and Buff"], description = L["Highlight while buffed."], createTriggers = createAbilityAndBuffTrigger, createConditions = function(conditions, item, regionType) - insufficientResourcesBlue(conditions, 2, regionType); - isOnCdGrey(conditions, 2, regionType); - isBuffedGlow(conditions, 1, regionType); + insufficientResourcesBlue(conditions, 2, regionType) + isOnCdGrey(conditions, 2, regionType) + isBuffedGlow(conditions, 1, regionType) end, - data = dataGlow - }); - if (item.usable) then + data = dataGlow, + }) + if item.usable then tinsert(types, { icon = icon.glow, title = L["Show Cooldown and Buff and Check Usable"], description = L["Highlight while buffed."], createTriggers = createAbilityAndBuffTrigger, createConditions = function(conditions, item, regionType) - isNotUsableBlue(conditions, 2, regionType); - isOnCdGrey(conditions, 2, regionType); - isBuffedGlow(conditions, 1, regionType); + isNotUsableBlue(conditions, 2, regionType) + isOnCdGrey(conditions, 2, regionType) + isBuffedGlow(conditions, 1, regionType) end, - data = dataGlow - }); + data = dataGlow, + }) end - if (item.requiresTarget) then + if item.requiresTarget then tinsert(types, { icon = icon.target, title = L["Show Cooldown and Buff and Check for Target"], @@ -815,31 +815,31 @@ local function subTypesFor(item, regionType) createTriggers = createAbilityAndBuffTrigger, createConditions = function(conditions, item, regionType) if item.usable then - isNotUsableBlue(conditions, 2, regionType); + isNotUsableBlue(conditions, 2, regionType) else - insufficientResourcesBlue(conditions, 2, regionType); + insufficientResourcesBlue(conditions, 2, regionType) end - isOnCdGrey(conditions, 2, regionType); - isSpellNotInRangeRed(conditions, 2, regionType); - isBuffedGlow(conditions, 1, regionType); + isOnCdGrey(conditions, 2, regionType) + isSpellNotInRangeRed(conditions, 2, regionType) + isBuffedGlow(conditions, 1, regionType) end, - data = dataGlow - }); + data = dataGlow, + }) end - elseif(item.debuff) then + elseif item.debuff then tinsert(types, { icon = icon.glow, title = L["Show Cooldown and Debuff"], description = L["Highlight while debuffed."], createTriggers = createAbilityAndDebuffTrigger, createConditions = function(conditions, item, regionType) - insufficientResourcesBlue(conditions, 2, regionType); - isOnCdGrey(conditions, 2, regionType); - isBuffedGlow(conditions, 1, regionType); + insufficientResourcesBlue(conditions, 2, regionType) + isOnCdGrey(conditions, 2, regionType) + isBuffedGlow(conditions, 1, regionType) end, - data = dataGlow - }); - if (item.requiresTarget) then + data = dataGlow, + }) + if item.requiresTarget then tinsert(types, { icon = icon.target, title = L["Show Cooldown and Debuff and Check for Target"], @@ -847,139 +847,139 @@ local function subTypesFor(item, regionType) createTriggers = createAbilityAndDebuffTrigger, createConditions = function(conditions, item, regionType) if item.usable then - isNotUsableBlue(conditions, 2, regionType); + isNotUsableBlue(conditions, 2, regionType) else - insufficientResourcesBlue(conditions, 2, regionType); + insufficientResourcesBlue(conditions, 2, regionType) end - isOnCdGrey(conditions, 2, regionType); - isSpellNotInRangeRed(conditions, 2, regionType); - isBuffedGlow(conditions, 1, regionType); + isOnCdGrey(conditions, 2, regionType) + isSpellNotInRangeRed(conditions, 2, regionType) + isBuffedGlow(conditions, 1, regionType) end, - data = dataGlow - }); + data = dataGlow, + }) end - elseif(item.totem) then + elseif item.totem then tinsert(types, { icon = icon.cd2, title = L["Show Cooldown and Totem Information"], description = L["Always shows the aura, turns grey if the ability is not usable."], createTriggers = function(triggers, item) - createTotemTrigger(triggers, 1, item); - createAbilityTrigger(triggers, 2, item, "showAlways"); + createTotemTrigger(triggers, 1, item) + createAbilityTrigger(triggers, 2, item, "showAlways") end, createConditions = function(conditions, item, regionType) - insufficientResourcesBlue(conditions, 2, regionType); - isOnCdGrey(conditions, 2, regionType); - totemActiveGlow(conditions, 1, regionType); + insufficientResourcesBlue(conditions, 2, regionType) + isOnCdGrey(conditions, 2, regionType) + totemActiveGlow(conditions, 1, regionType) end, - data = dataGlow - }); + data = dataGlow, + }) else - if (item.requiresTarget) then + if item.requiresTarget then tinsert(types, { icon = icon.target, title = L["Show Cooldown and Check for Target"], description = L["Always shows the aura, turns red when out of range."], createTriggers = function(triggers, item) - createAbilityTrigger(triggers, 1, item, "showAlways"); + createAbilityTrigger(triggers, 1, item, "showAlways") end, createConditions = function(conditions, item, regionType) - insufficientResourcesBlue(conditions, 1, regionType); - isOnCdGrey(conditions, 1, regionType); - isSpellNotInRangeRed(conditions, 1, regionType); + insufficientResourcesBlue(conditions, 1, regionType) + isOnCdGrey(conditions, 1, regionType) + isSpellNotInRangeRed(conditions, 1, regionType) end, - }); - if (item.overlayGlow) then - tinsert(types, { + }) + if item.overlayGlow then + tinsert(types, { icon = icon.glow, title = L["Show Cooldown and Check for Target & Proc Tracking"], description = L["Always shows the aura, highlight while proc is active, turns red when out of range, blue on insufficient resources."], createTriggers = createAbilityAndOverlayGlowTrigger, createConditions = function(conditions, item, regionType) - insufficientResourcesBlue(conditions, 1, regionType); - isOnCdGrey(conditions, 1, regionType); - isSpellNotInRangeRed(conditions, 1, regionType); - overlayGlow(conditions, 2, regionType); + insufficientResourcesBlue(conditions, 1, regionType) + isOnCdGrey(conditions, 1, regionType) + isSpellNotInRangeRed(conditions, 1, regionType) + overlayGlow(conditions, 2, regionType) end, - data = dataGlow - }); + data = dataGlow, + }) end - elseif (item.overlayGlow) then - tinsert(types, { + elseif item.overlayGlow then + tinsert(types, { icon = icon.glow, title = L["Show Cooldown and Proc Tracking"], description = L["Always shows the aura, highlight while proc is active, blue on insufficient resources."], createTriggers = createAbilityAndOverlayGlowTrigger, createConditions = function(conditions, item, regionType) - insufficientResourcesBlue(conditions, 1, regionType); - isOnCdGrey(conditions, 1, regionType); - overlayGlow(conditions, 2, regionType); + insufficientResourcesBlue(conditions, 1, regionType) + isOnCdGrey(conditions, 1, regionType) + overlayGlow(conditions, 2, regionType) end, - data = dataGlow - }); + data = dataGlow, + }) end - if (item.usable) then + if item.usable then tinsert(types, { icon = icon.cd2, title = L["Show Cooldown and Check Usable"], description = L["Always shows the aura, turns grey if the ability is not usable."], createTriggers = function(triggers, item) - createAbilityTrigger(triggers, 1, item, "showAlways"); + createAbilityTrigger(triggers, 1, item, "showAlways") end, createConditions = function(conditions, item, regionType) - isNotUsableBlue(conditions, 1, regionType); - isOnCdGrey(conditions, 1, regionType); + isNotUsableBlue(conditions, 1, regionType) + isOnCdGrey(conditions, 1, regionType) end, - }); - if (item.requiresTarget) then + }) + if item.requiresTarget then tinsert(types, { icon = icon.target, title = L["Show Cooldown and Check Usable & Target"], description = L["Always shows the aura, turns grey if the ability is not usable and red when out of range."], createTriggers = function(triggers, item) - createAbilityTrigger(triggers, 1, item, "showAlways"); + createAbilityTrigger(triggers, 1, item, "showAlways") end, createConditions = function(conditions, item, regionType) - isNotUsableBlue(conditions, 1, regionType); - isOnCdGrey(conditions, 1, regionType); - isSpellNotInRangeRed(conditions, 1, regionType); + isNotUsableBlue(conditions, 1, regionType) + isOnCdGrey(conditions, 1, regionType) + isSpellNotInRangeRed(conditions, 1, regionType) end, - }); - if (item.overlayGlow) then - tinsert(types, { + }) + if item.overlayGlow then + tinsert(types, { icon = icon.glow, title = L["Show Cooldown and Check Usable, Target & Proc Tracking"], description = L["Always shows the aura, highlight while proc is active, turns red when out of range, blue on insufficient resources."], createTriggers = createAbilityAndOverlayGlowTrigger, createConditions = function(conditions, item, regionType) - isNotUsableBlue(conditions, 1, regionType); - isOnCdGrey(conditions, 1, regionType); - isSpellNotInRangeRed(conditions, 1, regionType); - overlayGlow(conditions, 2, regionType); + isNotUsableBlue(conditions, 1, regionType) + isOnCdGrey(conditions, 1, regionType) + isSpellNotInRangeRed(conditions, 1, regionType) + overlayGlow(conditions, 2, regionType) end, - data = dataGlow - }); + data = dataGlow, + }) end else - if (item.overlayGlow) then - tinsert(types, { + if item.overlayGlow then + tinsert(types, { icon = icon.glow, title = L["Show Cooldown and Check Usable, Proc Tracking"], description = L["Always shows the aura, highlight while proc is active, blue on insufficient resources."], createTriggers = createAbilityAndOverlayGlowTrigger, createConditions = function(conditions, item, regionType) - isNotUsableBlue(conditions, 1, regionType); - isOnCdGrey(conditions, 1, regionType); - overlayGlow(conditions, 2, regionType); + isNotUsableBlue(conditions, 1, regionType) + isOnCdGrey(conditions, 1, regionType) + overlayGlow(conditions, 2, regionType) end, - data = dataGlow - }); + data = dataGlow, + }) end end end end end - elseif(item.type == "buff") then + elseif item.type == "buff" then data.inverse = false dataGlow.inverse = false tinsert(types, { @@ -987,36 +987,36 @@ local function subTypesFor(item, regionType) title = L["Show Only if Buffed"], description = L["Only shows the aura if the target has the buff."], createTriggers = function(triggers, item) - createBuffTrigger(triggers, 1, item, "showOnActive", true); + createBuffTrigger(triggers, 1, item, "showOnActive", true) end, data = data, - }); + }) tinsert(types, { icon = icon.glow, title = L["Always Show"], description = L["Always shows the aura, highlight it if buffed."], buffShowOn = "showAlways", createTriggers = function(triggers, item) - createBuffTrigger(triggers, 1, item, "showAlways", true); + createBuffTrigger(triggers, 1, item, "showAlways", true) end, createConditions = function(conditions, item, regionType) - isBuffedGlowAuraAlways(conditions, 1, regionType); + isBuffedGlowAuraAlways(conditions, 1, regionType) end, data = dataGlow, - }); + }) tinsert(types, { icon = icon.cd2, title = L["Always Show"], description = L["Always shows the aura, grey if buff not active."], createTriggers = function(triggers, item) - createBuffTrigger(triggers, 1, item, "showAlways", true); + createBuffTrigger(triggers, 1, item, "showAlways", true) end, createConditions = function(conditions, item, regionType) - missingBuffGreyed(conditions, 1, regionType); + missingBuffGreyed(conditions, 1, regionType) end, data = data, - }); - elseif(item.type == "debuff") then + }) + elseif item.type == "debuff" then data.inverse = false dataGlow.inverse = false tinsert(types, { @@ -1024,85 +1024,85 @@ local function subTypesFor(item, regionType) title = L["Show Only if Debuffed"], description = L["Only show the aura if the target has the debuff."], createTriggers = function(triggers, item) - createBuffTrigger(triggers, 1, item, "showOnActive", false); + createBuffTrigger(triggers, 1, item, "showOnActive", false) end, data = data, - }); + }) tinsert(types, { icon = icon.glow, title = L["Always Show"], description = L["Always show the aura, highlight it if debuffed."], createTriggers = function(triggers, item) - createBuffTrigger(triggers, 1, item, "showAlways", false); + createBuffTrigger(triggers, 1, item, "showAlways", false) end, createConditions = function(conditions, item, regionType) - isBuffedGlowAuraAlways(conditions, 1, regionType); + isBuffedGlowAuraAlways(conditions, 1, regionType) end, data = dataGlow, - }); + }) tinsert(types, { icon = icon.cd2, title = L["Always Show"], description = L["Always show the aura, turns grey if the debuff not active."], createTriggers = function(triggers, item) - createBuffTrigger(triggers, 1, item, "showAlways", false); + createBuffTrigger(triggers, 1, item, "showAlways", false) end, createConditions = function(conditions, item, regionType) - missingBuffGreyed(conditions, 1, regionType); + missingBuffGreyed(conditions, 1, regionType) end, data = data, - }); - elseif(item.type == "item") then + }) + elseif item.type == "item" then tinsert(types, { icon = icon.cd, title = L["Show Only if on Cooldown"], description = L["Only show the aura when the item is on cooldown."], createTriggers = function(triggers, item) - createItemTrigger(triggers, 1, item, "showOnCooldown"); + createItemTrigger(triggers, 1, item, "showOnCooldown") end, - }); + }) tinsert(types, { icon = icon.cd, title = L["Show on Ready"], description = L["Only shows the aura when the ability is ready to use."], createTriggers = function(triggers, item) - createItemTrigger(triggers, 1, item, "showOnReady"); + createItemTrigger(triggers, 1, item, "showOnReady") end, - }); + }) tinsert(types, { icon = icon.cd2, title = L["Always Show"], description = L["Always show the aura, turns grey if on cooldown."], createTriggers = function(triggers, item) - createItemTrigger(triggers, 1, item, "showAlways"); + createItemTrigger(triggers, 1, item, "showAlways") end, createConditions = function(conditions, item, regionType) - isOnCdGrey(conditions, 1, regionType); + isOnCdGrey(conditions, 1, regionType) end, - }); - elseif(item.type == "totem") then + }) + elseif item.type == "totem" then tinsert(types, { fallback = true, icon = icon.cd2, title = L["Always Show"], description = L["Always shows the aura."], createTriggers = function(triggers, item) - createTotemTrigger(triggers, 1, item); + createTotemTrigger(triggers, 1, item) end, - }); + }) tinsert(types, { icon = icon.cd2, title = L["Always Show"], description = L["Always shows the aura, turns grey if on cooldown."], createTriggers = function(triggers, item) - createTotemTrigger(triggers, 1, item); + createTotemTrigger(triggers, 1, item) end, createConditions = function(conditions, item, regionType) - totemActiveGlow(conditions, 1, regionType); + totemActiveGlow(conditions, 1, regionType) end, - data = dataGlow - }); - elseif(item.type == "power") then + data = dataGlow, + }) + elseif item.type == "power" then data.inverse = false data.icon = false data.text = false @@ -1110,11 +1110,11 @@ local function subTypesFor(item, regionType) icon = item.icon, title = item.title, createTriggers = function(triggers, item) - createPowerTrigger(triggers, 1, item); + createPowerTrigger(triggers, 1, item) end, data = data, - }); - elseif(item.type == "health") then + }) + elseif item.type == "health" then data.inverse = false data.icon = false data.text = false @@ -1122,78 +1122,78 @@ local function subTypesFor(item, regionType) icon = item.icon, title = item.title, createTriggers = function(triggers, item) - createHealthTrigger(triggers, 1, item); + createHealthTrigger(triggers, 1, item) end, data = data, - }); - elseif(item.type == "cast") then + }) + elseif item.type == "cast" then data.inverse = false tinsert(types, { fallback = true, icon = item.icon, title = item.title, createTriggers = function(triggers, item) - createCastTrigger(triggers, 1, item); + createCastTrigger(triggers, 1, item) end, data = data, - }); + }) tinsert(types, { icon = item.icon, title = item.title, createTriggers = function(triggers, item) - createCastTrigger(triggers, 1, item); + createCastTrigger(triggers, 1, item) end, createConditions = function(conditions, item, regionType) - uninterruptibleRed(conditions, 1, regionType); + uninterruptibleRed(conditions, 1, regionType) end, data = data, - }); - elseif (item.type == "weaponenchant") then + }) + elseif item.type == "weaponenchant" then data.inverse = false tinsert(types, { icon = icon.cd, title = L["Show Only if Enchanted"], description = L["Only shows if the weapon is enchanted."], createTriggers = function(triggers, item) - createWeaponEnchantTrigger(triggers, 1, item, "showOnActive"); + createWeaponEnchantTrigger(triggers, 1, item, "showOnActive") end, data = data, - }); + }) tinsert(types, { icon = icon.cd, title = L["Show if Enchant Missing"], description = L["Only shows if the weapon is not enchanted."], createTriggers = function(triggers, item) - createWeaponEnchantTrigger(triggers, 1, item, "showOnMissing"); + createWeaponEnchantTrigger(triggers, 1, item, "showOnMissing") end, data = data, - }); + }) tinsert(types, { icon = icon.glow, title = L["Show Always, Glow on Missing"], description = L["Always shows highlights if enchant missing."], createTriggers = function(triggers, item) - createWeaponEnchantTrigger(triggers, 1, item, "showAlways"); + createWeaponEnchantTrigger(triggers, 1, item, "showAlways") end, createConditions = function(conditions, item, regionType) - isMissingEnchantGlow(conditions, 1, regionType); + isMissingEnchantGlow(conditions, 1, regionType) end, data = dataGlow, - }); + }) end -- filter when createConditions return nothing for this regionType local fallbacks = {} for index = #types, 1, -1 do - local type = types[index]; + local type = types[index] if type.createConditions then local conditions = {} type.createConditions(conditions, item, regionType) if #conditions == 0 then - tremove(types, index); + tremove(types, index) end elseif type.fallback then - tremove(types, index); + tremove(types, index) tinsert(fallbacks, type) end end @@ -1207,78 +1207,82 @@ end function WeakAuras.CreateTemplateView(Private, frame) TemplatePrivate.Private = Private - local newView = AceGUI:Create("InlineGroup"); - newView.frame:SetParent(frame); - newView.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 42); - newView.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 17, -10); - newView.frame:Hide(); - newView:SetLayout("fill"); + local newView = AceGUI:Create("InlineGroup") + newView.frame:SetParent(frame) + newView.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 42) + newView.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 17, -10) + newView.frame:Hide() + newView:SetLayout("fill") - local newViewScroll = AceGUI:Create("ScrollFrame"); - newViewScroll:SetLayout("flow"); - newViewScroll.frame:SetClipsChildren(true); - newView:AddChild(newViewScroll); + local newViewScroll = AceGUI:Create("ScrollFrame") + newViewScroll:SetLayout("flow") + newViewScroll.frame:SetClipsChildren(true) + newView:AddChild(newViewScroll) local function createNewId(prefix) - local new_id = prefix or "New"; - local num = 2; - while(WeakAuras.GetData(new_id)) do - new_id = prefix .. " " .. num; - num = num + 1; + local new_id = prefix or "New" + local num = 2 + while WeakAuras.GetData(new_id) do + new_id = prefix .. " " .. num + num = num + 1 end - return new_id; + return new_id end local function createConditionsFor(item, subType, regionType) - if (subType.createConditions) then - local conditions = {}; - subType.createConditions(conditions, item, regionType); - return conditions; + if subType.createConditions then + local conditions = {} + subType.createConditions(conditions, item, regionType) + return conditions end end local function replaceCondition(data, item, subType) - local conditions = createConditionsFor(item, subType, data.regionType); + local conditions = createConditionsFor(item, subType, data.regionType) if conditions then - data.conditions = CopyTable(conditions); + data.conditions = CopyTable(conditions) end end local function addCondition(data, item, subType, prevNumTriggers) - local conditions = createConditionsFor(item, subType, data.regionType); + local conditions = createConditionsFor(item, subType, data.regionType) if conditions then if data.conditions then - local position = #data.conditions + 1; - for i,v in pairs(conditions) do - data.conditions[position] = data.conditions[position] or {}; + local position = #data.conditions + 1 + for i, v in pairs(conditions) do + data.conditions[position] = data.conditions[position] or {} if v.check.trigger ~= -1 then - v.check.trigger = v.check.trigger + prevNumTriggers; + v.check.trigger = v.check.trigger + prevNumTriggers end - data.conditions[position] = CopyTable(v); - position = position + 1; + data.conditions[position] = CopyTable(v) + position = position + 1 end else - data.conditions = CopyTable(conditions); + data.conditions = CopyTable(conditions) end end end local function createTriggersFor(item, subType) - local triggers = {}; - subType.createTriggers(triggers, item); - return triggers; + local triggers = {} + subType.createTriggers(triggers, item) + return triggers end -- Trigger Template - local function sortedPairs (t, f) + local function sortedPairs(t, f) local a = {} - for n in pairs(t) do table.insert(a, n) end + for n in pairs(t) do + table.insert(a, n) + end table.sort(a, f) - local i = 0 -- iterator variable - local iter = function () -- iterator function + local i = 0 -- iterator variable + local iter = function() -- iterator function i = i + 1 - if a[i] == nil then return nil - else return a[i], t[a[i]] + if a[i] == nil then + return nil + else + return a[i], t[a[i]] end end return iter @@ -1286,606 +1290,608 @@ function WeakAuras.CreateTemplateView(Private, frame) local function createSortFunctionFor(table) return function(a, b) - return table[a].title < table[b].title; + return table[a].title < table[b].title end end local function replaceTrigger(data, item, subType) - local triggers; - if (item.triggers) then - triggers = item.triggers; + local triggers + if item.triggers then + triggers = item.triggers else - triggers = createTriggersFor(item, subType); + triggers = createTriggersFor(item, subType) end data.triggers = {} for i, v in pairs(triggers) do - data.triggers[i] = data.triggers[i] or {}; - data.triggers[i].trigger = CopyTable(v.trigger); - data.triggers[i].untrigger = {}; - if (v.untrigger) then - data.triggers[i].untrigger = CopyTable(v.untrigger); + data.triggers[i] = data.triggers[i] or {} + data.triggers[i].trigger = CopyTable(v.trigger) + data.triggers[i].untrigger = {} + if v.untrigger then + data.triggers[i].untrigger = CopyTable(v.untrigger) end end - if (#data.triggers > 1) then -- Multiple triggers - data.triggers.disjunctive = "any"; - data.triggers.activeTriggerMode = -10; + if #data.triggers > 1 then -- Multiple triggers + data.triggers.disjunctive = "any" + data.triggers.activeTriggerMode = -10 end end local function addTrigger(data, item, subType) - local triggers; - if (item.triggers) then - triggers = item.triggers; + local triggers + if item.triggers then + triggers = item.triggers else - triggers = createTriggersFor(item, subType); + triggers = createTriggersFor(item, subType) end for i, v in pairs(triggers) do local position = #data.triggers + 1 - data.triggers[position] = data.triggers[position] or {}; - data.triggers[position].trigger = CopyTable(v.trigger); - data.triggers[position].untrigger = {}; - if (v.untrigger) then - data.triggers[position].untrigger = CopyTable(v.untrigger); + data.triggers[position] = data.triggers[position] or {} + data.triggers[position].trigger = CopyTable(v.trigger) + data.triggers[position].untrigger = {} + if v.untrigger then + data.triggers[position].untrigger = CopyTable(v.untrigger) end end - -- Multiple Triggers, override disjunctive, even if the users set it previously - if (triggers[2]) then - data.triggers.disjunctive = "any"; - data.triggers.activeTriggerMode = -10; + -- Multiple Triggers, override disjunctive, even if the users set it previously + if triggers[2] then + data.triggers.disjunctive = "any" + data.triggers.activeTriggerMode = -10 end end - local createButtons; + local createButtons local function createRegionButton(regionType, regionData, selectedItem) - local button = AceGUI:Create("WeakAurasNewButton"); - button:SetTitle(regionData.displayName); - if(type(regionData.icon) == "string" or type(regionData.icon) == "table") then - button:SetIcon(regionData.templateIcon); + local button = AceGUI:Create("WeakAurasNewButton") + button:SetTitle(regionData.displayName) + if type(regionData.icon) == "string" or type(regionData.icon) == "table" then + button:SetIcon(regionData.templateIcon) end - button:SetDescription(regionData.description); - button:SetFullWidth(true); - if (regionType == selectedItem) then - button.frame:LockHighlight(true); + button:SetDescription(regionData.description) + button:SetFullWidth(true) + if regionType == selectedItem then + button.frame:LockHighlight(true) end button:SetClick(function() - createButtons((selectedItem ~= regionType) and regionType); - end); - return button; + createButtons((selectedItem ~= regionType) and regionType) + end) + return button end local function createRegionFlyout(regionType, regionData) - local group = AceGUI:Create("WeakAurasTemplateGroup"); - group:SetFullWidth(true); - group:SetLayout("WATemplateTriggerLayoutFlyout"); + local group = AceGUI:Create("WeakAurasTemplateGroup") + group:SetFullWidth(true) + group:SetLayout("WATemplateTriggerLayoutFlyout") for _, item in ipairs(regionData.templates) do - local templateButton = AceGUI:Create("WeakAurasNewButton"); - if (item.icon) then - templateButton:SetIcon(item.icon); + local templateButton = AceGUI:Create("WeakAurasNewButton") + if item.icon then + templateButton:SetIcon(item.icon) else templateButton:SetThumbnail(regionType, item.data) end - templateButton:SetTitle(item.title); - templateButton:SetDescription(item.description); + templateButton:SetTitle(item.title) + templateButton:SetDescription(item.description) templateButton:SetClick(function() - newView.data = CopyTable(item.data); - WeakAuras.validate(newView.data, WeakAuras.data_stub); - newView.data.internalVersion = WeakAuras.InternalVersion(); - newView.data.regionType = regionType; - createButtons(); - end); - group:AddChild(templateButton); + newView.data = CopyTable(item.data) + WeakAuras.validate(newView.data, WeakAuras.data_stub) + newView.data.internalVersion = WeakAuras.InternalVersion() + newView.data.regionType = regionType + createButtons() + end) + group:AddChild(templateButton) end - return group; + return group end local function createDropdown(member, values) - local selector = AceGUI:Create("Dropdown"); - selector:SetList(values); - selector:SetValue(newView[member]); + local selector = AceGUI:Create("Dropdown") + selector:SetList(values) + selector:SetValue(newView[member]) selector:SetCallback("OnValueChanged", function(self, callback, v) - newView[member] = v; - createButtons(); - end); - return selector; + newView[member] = v + createButtons() + end) + return selector end local function createSpacer() - local spacer = AceGUI:Create("Label"); - spacer:SetFullWidth(true); - spacer:SetText(" "); - return spacer; + local spacer = AceGUI:Create("Label") + spacer:SetFullWidth(true) + spacer:SetText(" ") + return spacer end local function relativeWidth(totalWidth) - local columns = floor(totalWidth / 300); - return 1 / columns; + local columns = floor(totalWidth / 300) + return 1 / columns end local function batchModeToggler(value) - if (not value) then + if not value then -- clean selection for k in pairs(newView.chosenItemBatch) do - newView.chosenItemBatch[k] = nil; + newView.chosenItemBatch[k] = nil end for k, f in pairs(newView.chosenItemButtonsBatch) do - f.frame:UnlockHighlight(); - newView.chosenItemButtonsBatch[k] = nil; + f.frame:UnlockHighlight() + newView.chosenItemButtonsBatch[k] = nil end - newView.batchButton:Hide(); + newView.batchButton:Hide() end end local function createTriggerFlyout(section, fullWidth) - local group = AceGUI:Create("WeakAurasTemplateGroup"); - group:SetFullWidth(true); - newView.chosenItemBatch = {}; - newView.chosenItemButtonsBatch = {}; - group:SetLayout("WATemplateTriggerLayoutFlyout"); - if (section) then + local group = AceGUI:Create("WeakAurasTemplateGroup") + group:SetFullWidth(true) + newView.chosenItemBatch = {} + newView.chosenItemButtonsBatch = {} + group:SetLayout("WATemplateTriggerLayoutFlyout") + if section then for j, item in sortedPairs(section, createSortFunctionFor(section)) do - local button = AceGUI:Create("WeakAurasNewButton"); - button:SetTitle(item.title); - button:SetDescription(item.description); - if (fullWidth) then - button:SetFullWidth(true); + local button = AceGUI:Create("WeakAurasNewButton") + button:SetTitle(item.title) + button:SetDescription(item.description) + if fullWidth then + button:SetFullWidth(true) end - if(item.icon) then - button:SetIcon(item.icon); + if item.icon then + button:SetIcon(item.icon) end button:SetClick(function() - if (IsControlKeyDown() and not newView.existingAura) then + if IsControlKeyDown() and not newView.existingAura then if newView.chosenItemBatch[item] then - button.frame:UnlockHighlight(); - newView.chosenItemBatch[item] = nil; - newView.chosenItemButtonsBatch[j] = nil; + button.frame:UnlockHighlight() + newView.chosenItemBatch[item] = nil + newView.chosenItemButtonsBatch[j] = nil else - button.frame:LockHighlight(); - newView.chosenItemBatch[item] = true; - newView.chosenItemButtonsBatch[j] = button; + button.frame:LockHighlight() + newView.chosenItemBatch[item] = true + newView.chosenItemButtonsBatch[j] = button end - local count = 0; + local count = 0 for _ in pairs(newView.chosenItemBatch) do - count = count + 1; + count = count + 1 end if count == 0 then - newView.batchButton:Hide(); + newView.batchButton:Hide() newView.backButton:ClearAllPoints() - newView.backButton:SetPoint("BOTTOMRIGHT", -147, -23); + newView.backButton:SetPoint("BOTTOMRIGHT", -147, -23) else - newView.batchButton:Show(); + newView.batchButton:Show() newView.backButton:ClearAllPoints() - newView.backButton:SetPoint("BOTTOMRIGHT", -267, -23); + newView.backButton:SetPoint("BOTTOMRIGHT", -267, -23) end else newView.backButton:ClearAllPoints() - newView.backButton:SetPoint("BOTTOMRIGHT", -147, -23); - local subTypes = subTypesFor(item, newView.data.regionType); + newView.backButton:SetPoint("BOTTOMRIGHT", -147, -23) + local subTypes = subTypesFor(item, newView.data.regionType) if #subTypes < 2 then local subType = subTypes[1] or {} - if (newView.existingAura) then - newView.chosenItem = item; - newView.chosenSubType = subType; - createButtons(); + if newView.existingAura then + newView.chosenItem = item + newView.chosenSubType = subType + createButtons() else - replaceTrigger(newView.data, item, subType); - replaceCondition(newView.data, item, subType); - newView.data.id = WeakAuras.FindUnusedId(item.title); - newView.data.load = {}; - if (item.load) then - newView.data.load = CopyTable(item.load); + replaceTrigger(newView.data, item, subType) + replaceCondition(newView.data, item, subType) + newView.data.id = WeakAuras.FindUnusedId(item.title) + newView.data.load = {} + if item.load then + newView.data.load = CopyTable(item.load) end - if (subType.data) then + if subType.data then WeakAuras.DeepMixin(newView.data, subType.data) end - newView:CancelClose(); - WeakAuras.NewAura(newView.data, newView.data.regionType, newView.targetId); + newView:CancelClose() + WeakAuras.NewAura(newView.data, newView.data.regionType, newView.targetId) end else -- create trigger type selection - newView.chosenItem = item; - createButtons(); + newView.chosenItem = item + createButtons() end end - end); - group:AddChild(button); + end) + group:AddChild(button) end end - return group; + return group end local function createTriggerTypeButtons() - local item = newView.chosenItem; - local group = AceGUI:Create("WeakAurasTemplateGroup"); - group:SetFullWidth(true); - local subTypes = subTypesFor(item, newView.data.regionType); + local item = newView.chosenItem + local group = AceGUI:Create("WeakAurasTemplateGroup") + group:SetFullWidth(true) + local subTypes = subTypesFor(item, newView.data.regionType) local subTypesButtons = {} local lastButton for k, subType in pairs(subTypes) do - local button = AceGUI:Create("WeakAurasNewButton"); - subTypesButtons[k] = button; - button:SetTitle(subType.title); - button:SetDescription(subType.description); + local button = AceGUI:Create("WeakAurasNewButton") + subTypesButtons[k] = button + button:SetTitle(subType.title) + button:SetDescription(subType.description) if subType.icon then if type(subType.icon) == "function" then - button:SetIcon(subType.icon()); + button:SetIcon(subType.icon()) else - button:SetIcon(subType.icon); + button:SetIcon(subType.icon) end end - button:SetFullWidth(true); + button:SetFullWidth(true) button:SetClick(function() - if (newView.batchStep) then + if newView.batchStep then for index, subTypesButton in pairs(subTypesButtons) do - if (index == k) then - subTypesButton.frame:LockHighlight(); + if index == k then + subTypesButton.frame:LockHighlight() else - subTypesButton.frame:UnlockHighlight(); + subTypesButton.frame:UnlockHighlight() end end - newView.chosenItemBatchSubType[item] = subType; - elseif (newView.existingAura) then - newView.chosenItem = item; - newView.chosenSubType = subType; - createButtons(); + newView.chosenItemBatchSubType[item] = subType + elseif newView.existingAura then + newView.chosenItem = item + newView.chosenSubType = subType + createButtons() else - replaceTrigger(newView.data, item, subType); - replaceCondition(newView.data, item, subType); - newView.data.id = WeakAuras.FindUnusedId(item.title); - newView.data.load = {}; - if (item.load) then - newView.data.load = CopyTable(item.load); + replaceTrigger(newView.data, item, subType) + replaceCondition(newView.data, item, subType) + newView.data.id = WeakAuras.FindUnusedId(item.title) + newView.data.load = {} + if item.load then + newView.data.load = CopyTable(item.load) end - if (subType.data) then + if subType.data then WeakAuras.DeepMixin(newView.data, subType.data) end - newView:CancelClose(); - WeakAuras.NewAura(newView.data, newView.data.regionType, newView.targetId); + newView:CancelClose() + WeakAuras.NewAura(newView.data, newView.data.regionType, newView.targetId) end - end); + end) if newView.batchStep then - button.frame:LockHighlight(); - newView.chosenItemBatchSubType[item] = subType; + button.frame:LockHighlight() + newView.chosenItemBatchSubType[item] = subType if lastButton then - lastButton.frame:UnlockHighlight(); + lastButton.frame:UnlockHighlight() end lastButton = button end - group:AddChild(button); + group:AddChild(button) end - return group; + return group end local function createTriggerButton(section, selectedItem, fullWidth) - local button = AceGUI:Create("WeakAurasNewButton"); - button:SetTitle(section.title); - button:SetDescription(section.description); - if (section.icon) then - button:SetIcon(section.icon); + local button = AceGUI:Create("WeakAurasNewButton") + button:SetTitle(section.title) + button:SetDescription(section.description) + if section.icon then + button:SetIcon(section.icon) end - button:SetFullWidth(true); + button:SetFullWidth(true) button:SetClick(function() - createButtons((selectedItem ~= section) and section); - end); - newViewScroll:AddChild(button); - if (section == selectedItem) then - button.frame:LockHighlight(true); - local group = createTriggerFlyout(section.args, fullWidth); - newViewScroll:AddChild(group); + createButtons((selectedItem ~= section) and section) + end) + newViewScroll:AddChild(button) + if section == selectedItem then + button.frame:LockHighlight(true) + local group = createTriggerFlyout(section.args, fullWidth) + newViewScroll:AddChild(group) end end -- Creates a button + flyout (if the button is selected) for one section local function createTriggerButtons(templates, selectedItem, fullWidth) for k, section in ipairs(templates) do if section.args and next(section.args) then - createTriggerButton(section, selectedItem, fullWidth); + createTriggerButton(section, selectedItem, fullWidth) end end end local function replaceTriggers(data, item, subType) local function handle(data, item, subType) - replaceTrigger(data, item, subType); - replaceCondition(data, item, subType); - newView:CancelClose(); - WeakAuras.Add(data); + replaceTrigger(data, item, subType) + replaceCondition(data, item, subType) + newView:CancelClose() + WeakAuras.Add(data) WeakAuras.ClearAndUpdateOptions(data.id) WeakAuras.FillOptions() - WeakAuras.NewDisplayButton(data); - WeakAuras.UpdateThumbnail(data); + WeakAuras.NewDisplayButton(data) + WeakAuras.UpdateThumbnail(data) end for child in TemplatePrivate.Private.TraverseLeafsOrAura(data) do - handle(child, item, subType); + handle(child, item, subType) end WeakAuras.ClearAndUpdateOptions(data.id) end local function addTriggers(data, item, subType) local function handle(data, item, subType) - local prevNumTriggers = #data.triggers; - addTrigger(data, item, subType); - addCondition(data, item, subType, prevNumTriggers); - newView:CancelClose(); - WeakAuras.Add(data); + local prevNumTriggers = #data.triggers + addTrigger(data, item, subType) + addCondition(data, item, subType, prevNumTriggers) + newView:CancelClose() + WeakAuras.Add(data) WeakAuras.ClearAndUpdateOptions(data.id) WeakAuras.FillOptions() - WeakAuras.NewDisplayButton(data); - WeakAuras.UpdateThumbnail(data); + WeakAuras.NewDisplayButton(data) + WeakAuras.UpdateThumbnail(data) end for child in TemplatePrivate.Private.TraverseLeafsOrAura(data) do - handle(child, item, subType); + handle(child, item, subType) end WeakAuras.ClearAndUpdateOptions(data.id) end local function createLastPage() - local replaceButton = AceGUI:Create("WeakAurasNewButton"); - replaceButton:SetTitle(L["Replace Triggers"]); - replaceButton:SetDescription(L["Replace all existing triggers"]); - replaceButton:SetIcon("Interface\\Icons\\Spell_ChargeNegative"); - replaceButton:SetFullWidth(true); + local replaceButton = AceGUI:Create("WeakAurasNewButton") + replaceButton:SetTitle(L["Replace Triggers"]) + replaceButton:SetDescription(L["Replace all existing triggers"]) + replaceButton:SetIcon("Interface\\Icons\\Spell_ChargeNegative") + replaceButton:SetFullWidth(true) replaceButton:SetClick(function() - replaceTriggers(newView.data, newView.chosenItem, newView.chosenSubType); - for _,v in pairs({"class", "spec", "talent", "pvptalent", "race", "covenant"}) do - newView.data.load[v] = nil; - newView.data.load["use_"..v] = nil; + replaceTriggers(newView.data, newView.chosenItem, newView.chosenSubType) + for _, v in pairs({ "class", "spec", "talent", "pvptalent", "race", "covenant" }) do + newView.data.load[v] = nil + newView.data.load["use_" .. v] = nil end - newView.data.load.class = CopyTable(WeakAuras.data_stub.load.class); - newView.data.load.spec = CopyTable(WeakAuras.data_stub.load.spec); - if (newView.chosenItem.load) then + newView.data.load.class = CopyTable(WeakAuras.data_stub.load.class) + newView.data.load.spec = CopyTable(WeakAuras.data_stub.load.spec) + if newView.chosenItem.load then WeakAuras.DeepMixin(newView.data.load, newView.chosenItem.load) end - end); - newViewScroll:AddChild(replaceButton); - - local addButton = AceGUI:Create("WeakAurasNewButton"); - addButton:SetTitle(L["Add Triggers"]); - addButton:SetDescription(L["Keeps existing triggers intact"]); - addButton:SetIcon("Interface\\Icons\\Spell_ChargePositive"); - addButton:SetFullWidth(true); + end) + newViewScroll:AddChild(replaceButton) + + local addButton = AceGUI:Create("WeakAurasNewButton") + addButton:SetTitle(L["Add Triggers"]) + addButton:SetDescription(L["Keeps existing triggers intact"]) + addButton:SetIcon("Interface\\Icons\\Spell_ChargePositive") + addButton:SetFullWidth(true) addButton:SetClick(function() - addTriggers(newView.data, newView.chosenItem, newView.chosenSubType); - end); - newViewScroll:AddChild(addButton); + addTriggers(newView.data, newView.chosenItem, newView.chosenSubType) + end) + newViewScroll:AddChild(addButton) end createButtons = function(selectedItem) -- selectedItem is either a regionType or a trigger section - newViewScroll:ReleaseChildren(); - newView.makeBatchButton:Hide(); - newView.batchButton:Hide(); - newView.batchModeLabel:Hide(); - if (not newView.data) then + newViewScroll:ReleaseChildren() + newView.makeBatchButton:Hide() + newView.batchButton:Hide() + newView.batchModeLabel:Hide() + if not newView.data then -- First step: Show region types for regionType, regionData in pairs(WeakAuras.regionOptions) do - if (regionData.templates) then - local button = createRegionButton(regionType, regionData, selectedItem); - newViewScroll:AddChild(button); - if (regionType == selectedItem) then - local group = createRegionFlyout(regionType, regionData); - newViewScroll:AddChild(group); + if regionData.templates then + local button = createRegionButton(regionType, regionData, selectedItem) + newViewScroll:AddChild(button) + if regionType == selectedItem then + local group = createRegionFlyout(regionType, regionData) + newViewScroll:AddChild(group) end end end - newView.backButton:Hide(); - elseif (newView.data and newView.batchStep) then + newView.backButton:Hide() + elseif newView.data and newView.batchStep then -- Batch - if (newView.batchStep) then - newView.chosenItemBatchSubType = {}; + if newView.batchStep then + newView.chosenItemBatchSubType = {} for item in pairs(newView.chosenItemBatch) do - local classHeader = AceGUI:Create("Heading"); - classHeader:SetFullWidth(true); - newViewScroll:AddChild(classHeader); - - local button = AceGUI:Create("WeakAurasNewButton"); - button:SetTitle(item.title); - button:SetDescription(item.description); - button:SetFullWidth(true); - if(item.icon) then - button:SetIcon(item.icon); + local classHeader = AceGUI:Create("Heading") + classHeader:SetFullWidth(true) + newViewScroll:AddChild(classHeader) + + local button = AceGUI:Create("WeakAurasNewButton") + button:SetTitle(item.title) + button:SetDescription(item.description) + button:SetFullWidth(true) + if item.icon then + button:SetIcon(item.icon) end - newViewScroll:AddChild(button); + newViewScroll:AddChild(button) - newView.chosenItem = item; - local typesButtons = createTriggerTypeButtons(); - newViewScroll:AddChild(typesButtons); + newView.chosenItem = item + local typesButtons = createTriggerTypeButtons() + newViewScroll:AddChild(typesButtons) end newView.makeBatchButton:Show() newView.backButton:ClearAllPoints() - newView.backButton:SetPoint("BOTTOMRIGHT", -267, -23); + newView.backButton:SetPoint("BOTTOMRIGHT", -267, -23) end - newView.batchModeLabel:Hide(); - elseif (newView.data and not newView.chosenItem) then + newView.batchModeLabel:Hide() + elseif newView.data and not newView.chosenItem then -- Second step: Trigger selection screen -- Class - local classSelector = createDropdown("class", WeakAuras.class_types); - newViewScroll:AddChild(classSelector); + local classSelector = createDropdown("class", WeakAuras.class_types) + newViewScroll:AddChild(classSelector) if WeakAuras.IsRetail() then - local specSelector = createDropdown("spec", WeakAuras.spec_types_specific[newView.class]); - newViewScroll:AddChild(specSelector); - newViewScroll:AddChild(createSpacer()); + local specSelector = createDropdown("spec", WeakAuras.spec_types_specific[newView.class]) + newViewScroll:AddChild(specSelector) + newViewScroll:AddChild(createSpacer()) end - if (WeakAuras.triggerTemplates.class[newView.class] and WeakAuras.triggerTemplates.class[newView.class][newView.spec]) then - createTriggerButtons(WeakAuras.triggerTemplates.class[newView.class][newView.spec], selectedItem); + if WeakAuras.triggerTemplates.class[newView.class] and WeakAuras.triggerTemplates.class[newView.class][newView.spec] then + createTriggerButtons(WeakAuras.triggerTemplates.class[newView.class][newView.spec], selectedItem) end - local classHeader = AceGUI:Create("Heading"); - classHeader:SetFullWidth(true); - newViewScroll:AddChild(classHeader); + local classHeader = AceGUI:Create("Heading") + classHeader:SetFullWidth(true) + newViewScroll:AddChild(classHeader) - createTriggerButton(WeakAuras.triggerTemplates.general, selectedItem); + createTriggerButton(WeakAuras.triggerTemplates.general, selectedItem) -- Race - local raceHeader = AceGUI:Create("Heading"); - raceHeader:SetFullWidth(true); - newViewScroll:AddChild(raceHeader); - local raceSelector = createDropdown("race", WeakAuras.race_types); - newViewScroll:AddChild(raceSelector); - newViewScroll:AddChild(createSpacer()); - if (WeakAuras.triggerTemplates.race[newView.race]) then - local group = createTriggerFlyout(WeakAuras.triggerTemplates.race[newView.race], true); - newViewScroll:AddChild(group); + local raceHeader = AceGUI:Create("Heading") + raceHeader:SetFullWidth(true) + newViewScroll:AddChild(raceHeader) + local raceSelector = createDropdown("race", WeakAuras.race_types) + newViewScroll:AddChild(raceSelector) + newViewScroll:AddChild(createSpacer()) + if WeakAuras.triggerTemplates.race[newView.race] then + local group = createTriggerFlyout(WeakAuras.triggerTemplates.race[newView.race], true) + newViewScroll:AddChild(group) end -- backButton - if (not newView.existingAura) then - newView.backButton:Show(); + if not newView.existingAura then + newView.backButton:Show() end -- batchButton - newView.chosenItemBatch = {}; + newView.chosenItemBatch = {} if not newView.existingAura then - newView.batchModeLabel:Show(); + newView.batchModeLabel:Show() end - elseif (newView.data and newView.chosenItem and not newView.chosenSubType) then + elseif newView.data and newView.chosenItem and not newView.chosenSubType then -- Multi-Type template - local typeHeader = AceGUI:Create("Heading"); - typeHeader:SetFullWidth(true); - newViewScroll:AddChild(typeHeader); - local group = createTriggerTypeButtons(); - newViewScroll:AddChild(group); - newView.backButton:Show(); + local typeHeader = AceGUI:Create("Heading") + typeHeader:SetFullWidth(true) + newViewScroll:AddChild(typeHeader) + local group = createTriggerTypeButtons() + newViewScroll:AddChild(group) + newView.backButton:Show() else --Third Step: (only for existing auras): replace or add triggers? - createLastPage(); - newView.backButton:Show(); + createLastPage() + newView.backButton:Show() end end - local batchModeLabel = CreateFrame("Frame", "batchModeLabel", newView.frame); - batchModeLabel:SetSize(300, 20); - local batchModeLabelString = batchModeLabel:CreateFontString(nil, "ARTWORK"); - batchModeLabelString:SetFont(STANDARD_TEXT_FONT, 10); -- "OUTLINE" - batchModeLabelString:SetTextColor(1,1,1,1); - batchModeLabelString:SetText(L["Hold CTRL to create multiple auras at once"]); + local batchModeLabel = CreateFrame("Frame", "batchModeLabel", newView.frame) + batchModeLabel:SetSize(300, 20) + local batchModeLabelString = batchModeLabel:CreateFontString(nil, "ARTWORK") + batchModeLabelString:SetFont(STANDARD_TEXT_FONT, 10) -- "OUTLINE" + batchModeLabelString:SetTextColor(1, 1, 1, 1) + batchModeLabelString:SetText(L["Hold CTRL to create multiple auras at once"]) batchModeLabelString:SetJustifyH("LEFT") - batchModeLabelString:SetAllPoints(batchModeLabel); - batchModeLabel:SetPoint("BOTTOMLEFT", 10, -23); - newView.batchModeLabel = batchModeLabel; + batchModeLabelString:SetAllPoints(batchModeLabel) + batchModeLabel:SetPoint("BOTTOMLEFT", 10, -23) + newView.batchModeLabel = batchModeLabel - local newViewMakeBatch = CreateFrame("Button", nil, newView.frame, "UIPanelButtonTemplate"); + local newViewMakeBatch = CreateFrame("Button", nil, newView.frame, "UIPanelButtonTemplate") newViewMakeBatch:SetScript("OnClick", function() - local saveData = CopyTable(newView.data); + local saveData = CopyTable(newView.data) for item in pairs(newView.chosenItemBatch) do -- clean data - newView.data = CopyTable(saveData); + newView.data = CopyTable(saveData) -- copy data local subType = newView.chosenItemBatchSubType[item] - replaceTrigger(newView.data, item, subType); - replaceCondition(newView.data, item, subType); - newView.data.id = WeakAuras.FindUnusedId(item.title); - newView.data.load = {}; - if (item.load) then - newView.data.load = CopyTable(item.load); + replaceTrigger(newView.data, item, subType) + replaceCondition(newView.data, item, subType) + newView.data.id = WeakAuras.FindUnusedId(item.title) + newView.data.load = {} + if item.load then + newView.data.load = CopyTable(item.load) end - if (subType.data) then + if subType.data then WeakAuras.DeepMixin(newView.data, subType.data) end -- create aura - WeakAuras.NewAura(newView.data, newView.data.regionType, newView.targetId); + WeakAuras.NewAura(newView.data, newView.data.regionType, newView.targetId) end - newView:CancelClose(); - end); - newViewMakeBatch:SetPoint("BOTTOMRIGHT", -147, -23); - newViewMakeBatch:SetHeight(20); - newViewMakeBatch:SetWidth(100); - newViewMakeBatch:SetText(L["Create Auras"]); - newView.makeBatchButton = newViewMakeBatch; - newView.makeBatchButton:Hide(); - - local newViewBatch = CreateFrame("Button", nil, newView.frame, "UIPanelButtonTemplate"); + newView:CancelClose() + end) + newViewMakeBatch:SetPoint("BOTTOMRIGHT", -147, -23) + newViewMakeBatch:SetHeight(20) + newViewMakeBatch:SetWidth(100) + newViewMakeBatch:SetText(L["Create Auras"]) + newView.makeBatchButton = newViewMakeBatch + newView.makeBatchButton:Hide() + + local newViewBatch = CreateFrame("Button", nil, newView.frame, "UIPanelButtonTemplate") newViewBatch:SetScript("OnClick", function() - newView.batchStep = true; - newView.batchButton:Hide(); - createButtons(); - end); - newViewBatch:SetPoint("BOTTOMRIGHT", -147, -23); - newViewBatch:SetHeight(20); - newViewBatch:SetWidth(100); - newViewBatch:SetText(L["Next"]); - newView.batchButton = newViewBatch; - newView.batchButton:Hide(); - - local newViewBack = CreateFrame("Button", nil, newView.frame, "UIPanelButtonTemplate"); + newView.batchStep = true + newView.batchButton:Hide() + createButtons() + end) + newViewBatch:SetPoint("BOTTOMRIGHT", -147, -23) + newViewBatch:SetHeight(20) + newViewBatch:SetWidth(100) + newViewBatch:SetText(L["Next"]) + newView.batchButton = newViewBatch + newView.batchButton:Hide() + + local newViewBack = CreateFrame("Button", nil, newView.frame, "UIPanelButtonTemplate") newViewBack:SetScript("OnClick", function() - if (newView.existingAura) then + if newView.existingAura then if newView.chosenSubType then - newView.chosenSubType = nil; - local subTypes = subTypesFor(newView.chosenItem, newView.data.regionType); + newView.chosenSubType = nil + local subTypes = subTypesFor(newView.chosenItem, newView.data.regionType) if #subTypes < 2 then -- No subtype selection, go back twice - newView.chosenItem = nil; + newView.chosenItem = nil end else - newView.chosenItem = nil; + newView.chosenItem = nil end else if newView.chosenSubType then - newView.chosenSubType = nil; + newView.chosenSubType = nil else if newView.chosenItem then - newView.chosenItem = nil; + newView.chosenItem = nil else - newView.data = nil; + newView.data = nil end end end - newView.batchButton:Hide(); - newView.chosenItemBatch = {}; - newView.batchStep = nil; + newView.batchButton:Hide() + newView.chosenItemBatch = {} + newView.batchStep = nil newView.backButton:ClearAllPoints() - newView.backButton:SetPoint("BOTTOMRIGHT", -147, -23); - createButtons(); - end); - newViewBack:SetPoint("BOTTOMRIGHT", -147, -23); - newViewBack:SetHeight(20); - newViewBack:SetWidth(100); - newViewBack:SetText(L["Back"]); - newView.backButton = newViewBack; - - local newViewCancel = CreateFrame("Button", nil, newView.frame, "UIPanelButtonTemplate"); - newViewCancel:SetScript("OnClick", function() newView:CancelClose() end); - newViewCancel:SetPoint("BOTTOMRIGHT", -27, -23); - newViewCancel:SetHeight(20); - newViewCancel:SetWidth(100); - newViewCancel:SetText(L["Cancel"]); + newView.backButton:SetPoint("BOTTOMRIGHT", -147, -23) + createButtons() + end) + newViewBack:SetPoint("BOTTOMRIGHT", -147, -23) + newViewBack:SetHeight(20) + newViewBack:SetWidth(100) + newViewBack:SetText(L["Back"]) + newView.backButton = newViewBack + + local newViewCancel = CreateFrame("Button", nil, newView.frame, "UIPanelButtonTemplate") + newViewCancel:SetScript("OnClick", function() + newView:CancelClose() + end) + newViewCancel:SetPoint("BOTTOMRIGHT", -27, -23) + newViewCancel:SetHeight(20) + newViewCancel:SetWidth(100) + newViewCancel:SetText(L["Cancel"]) function newView.Open(self, data, targetId) - frame.window = "newView"; + frame.window = "newView" frame:UpdateFrameVisible() self.targetId = targetId self.data = data -- Might be nil - if (data) then - newView.existingAura = true; - newView.chosenItem = nil; - newView.chosenSubType = nil; + if data then + newView.existingAura = true + newView.chosenItem = nil + newView.chosenSubType = nil else - newView.existingAura = false; - newView.chosenItem = nil; - newView.chosenSubType = nil; - newView.batchStep = nil; - newView.chosenItemBatch = {}; + newView.existingAura = false + newView.chosenItem = nil + newView.chosenSubType = nil + newView.batchStep = nil + newView.chosenItemBatch = {} end - newView.class = select(2, UnitClass("player")); + newView.class = select(2, UnitClass("player")) if WeakAuras.IsRetail() then - newView.spec = GetSpecialization() or 1; + newView.spec = GetSpecialization() or 1 else newView.spec = 1 end - newView.race = select(2, UnitRace('player')); + newView.race = select(2, UnitRace("player")) - createButtons(); + createButtons() end function newView.CancelClose(self) - frame.window = "default"; + frame.window = "default" frame:UpdateFrameVisible() - if (not self.data) then - frame:NewAura(); + if not self.data then + frame:NewAura() end end - return newView; + return newView end diff --git a/WeakAurasTemplates/TriggerTemplatesData.lua b/WeakAurasTemplates/TriggerTemplatesData.lua index 1faa2d63ba..c63e89cce6 100644 --- a/WeakAurasTemplates/TriggerTemplatesData.lua +++ b/WeakAurasTemplates/TriggerTemplatesData.lua @@ -1,68 +1,68 @@ local AddonName, TemplatePrivate = ... local WeakAuras = WeakAuras -if not WeakAuras.IsRetail() then return end +if not WeakAuras.IsRetail() then + return +end local L = WeakAuras.L local GetSpellInfo, tinsert, GetItemInfo, GetSpellDescription, C_Timer, Spell = GetSpellInfo, tinsert, GetItemInfo, GetSpellDescription, C_Timer, Spell -- The templates tables are created on demand -local templates = - { - class = { }, - race = { - Human = {}, - NightElf = {}, - Dwarf = {}, - Gnome = {}, - Draenei = {}, - Worgen = {}, - Pandaren = {}, - Orc = {}, - Scourge = {}, - Tauren = {}, - Troll = {}, - BloodElf = {}, - Goblin = {}, - Nightborne = {}, - LightforgedDraenei = {}, - HighmountainTauren = {}, - VoidElf = {}, - ZandalariTroll = {}, - KulTiran = {}, - DarkIronDwarf = {}, - Vulpera = {}, - MagharOrc = {}, - Mechagnome = {} - }, - general = { - title = L["General"], - icon = 136116, - args = {} - }, - } +local templates = { + class = {}, + race = { + Human = {}, + NightElf = {}, + Dwarf = {}, + Gnome = {}, + Draenei = {}, + Worgen = {}, + Pandaren = {}, + Orc = {}, + Scourge = {}, + Tauren = {}, + Troll = {}, + BloodElf = {}, + Goblin = {}, + Nightborne = {}, + LightforgedDraenei = {}, + HighmountainTauren = {}, + VoidElf = {}, + ZandalariTroll = {}, + KulTiran = {}, + DarkIronDwarf = {}, + Vulpera = {}, + MagharOrc = {}, + Mechagnome = {}, + }, + general = { + title = L["General"], + icon = 136116, + args = {}, + }, +} local manaIcon = "Interface\\Icons\\inv_elemental_mote_mana" local rageIcon = "Interface\\Icons\\spell_misc_emotionangry" local comboPointsIcon = "Interface\\Icons\\inv_mace_2h_pvp410_c_01" -local powerTypes = - { - [0] = { name = POWER_TYPE_MANA, icon = manaIcon }, - [1] = { name = POWER_TYPE_RED_POWER, icon = rageIcon}, - [2] = { name = POWER_TYPE_FOCUS, icon = "Interface\\Icons\\ability_hunter_focusfire"}, - [3] = { name = POWER_TYPE_ENERGY, icon = "Interface\\Icons\\spell_shadow_shadowworddominate"}, - [4] = { name = COMBO_POINTS, icon = comboPointsIcon}, - [6] = { name = RUNIC_POWER, icon = "Interface\\Icons\\inv_sword_62"}, - [7] = { name = SOUL_SHARDS_POWER, icon = "Interface\\Icons\\inv_misc_gem_amethyst_02"}, - [8] = { name = POWER_TYPE_LUNAR_POWER, icon = "Interface\\Icons\\ability_druid_eclipseorange"}, - [9] = { name = HOLY_POWER, icon = "Interface\\Icons\\achievement_bg_winsoa"}, - [11] = {name = POWER_TYPE_MAELSTROM, icon = 135990}, - [12] = {name = CHI_POWER, icon = "Interface\\Icons\\ability_monk_healthsphere"}, - [13] = {name = POWER_TYPE_INSANITY, icon = "Interface\\Icons\\spell_priest_shadoworbs"}, - [16] = {name = POWER_TYPE_ARCANE_CHARGES, icon = "Interface\\Icons\\spell_arcane_arcane01"}, - [17] = {name = POWER_TYPE_FURY_DEMONHUNTER, icon = 1344651}, - [18] = {name = POWER_TYPE_PAIN, icon = 1247265}, - [99] = {name = STAGGER, icon = "Interface\\Icons\\monk_stance_drunkenox"} - } +local powerTypes = { + [0] = { name = POWER_TYPE_MANA, icon = manaIcon }, + [1] = { name = POWER_TYPE_RED_POWER, icon = rageIcon }, + [2] = { name = POWER_TYPE_FOCUS, icon = "Interface\\Icons\\ability_hunter_focusfire" }, + [3] = { name = POWER_TYPE_ENERGY, icon = "Interface\\Icons\\spell_shadow_shadowworddominate" }, + [4] = { name = COMBO_POINTS, icon = comboPointsIcon }, + [6] = { name = RUNIC_POWER, icon = "Interface\\Icons\\inv_sword_62" }, + [7] = { name = SOUL_SHARDS_POWER, icon = "Interface\\Icons\\inv_misc_gem_amethyst_02" }, + [8] = { name = POWER_TYPE_LUNAR_POWER, icon = "Interface\\Icons\\ability_druid_eclipseorange" }, + [9] = { name = HOLY_POWER, icon = "Interface\\Icons\\achievement_bg_winsoa" }, + [11] = { name = POWER_TYPE_MAELSTROM, icon = 135990 }, + [12] = { name = CHI_POWER, icon = "Interface\\Icons\\ability_monk_healthsphere" }, + [13] = { name = POWER_TYPE_INSANITY, icon = "Interface\\Icons\\spell_priest_shadoworbs" }, + [16] = { name = POWER_TYPE_ARCANE_CHARGES, icon = "Interface\\Icons\\spell_arcane_arcane01" }, + [17] = { name = POWER_TYPE_FURY_DEMONHUNTER, icon = 1344651 }, + [18] = { name = POWER_TYPE_PAIN, icon = 1247265 }, + [99] = { name = STAGGER, icon = "Interface\\Icons\\monk_stance_drunkenox" }, +} -- Collected by WeakAurasTemplateCollector: -------------------------------------------------------------------------------- @@ -72,89 +72,89 @@ templates.class.WARRIOR = { title = L["Buffs"], args = { { spell = 6673, type = "buff", unit = "player", forceOwnOnly = true, ownOnly = nil }, -- Battle Shout - { spell = 7384, type = "buff", unit = "player"}, -- Overpower - { spell = 18499, type = "buff", unit = "player"}, -- Berserker Rage - { spell = 23920, type = "buff", unit = "player"}, -- Spell Reflection - { spell = 32216, type = "buff", unit = "player", talent = 5}, -- Victorious - { spell = 52437, type = "buff", unit = "player", talent = 2}, -- Sudden Death - { spell = 97463, type = "buff", unit = "player"}, -- Rallying Cry - { spell = 107574, type = "buff", unit = "player", talent = 17}, -- Avatar - { spell = 118038, type = "buff", unit = "player"}, -- Die by the Sword - { spell = 132404, type = "buff", unit = "player"}, -- Shield Block - { spell = 190456, type = "buff", unit = "player"}, -- Ignore Pain - { spell = 197690, type = "buff", unit = "player", talent = 12}, -- Defensive Stance - { spell = 202164, type = "buff", unit = "player", talent = 11}, -- Bounding Stride - { spell = 227847, type = "buff", unit = "player"}, -- Bladestorm - { spell = 248622, type = "buff", unit = "player", talent = 16}, -- In For The Kill - { spell = 260708, type = "buff", unit = "player"}, -- Sweeping Strikes - { spell = 262228, type = "buff", unit = "player", talent = 18}, -- Deadly Calm - { spell = 262232, type = "buff", unit = "player", talent = 1}, -- War Machine - { spell = 334783, type = "buff", unit = "player", talent = 13}, -- Collateral Damage - }, - icon = 132333 + { spell = 7384, type = "buff", unit = "player" }, -- Overpower + { spell = 18499, type = "buff", unit = "player" }, -- Berserker Rage + { spell = 23920, type = "buff", unit = "player" }, -- Spell Reflection + { spell = 32216, type = "buff", unit = "player", talent = 5 }, -- Victorious + { spell = 52437, type = "buff", unit = "player", talent = 2 }, -- Sudden Death + { spell = 97463, type = "buff", unit = "player" }, -- Rallying Cry + { spell = 107574, type = "buff", unit = "player", talent = 17 }, -- Avatar + { spell = 118038, type = "buff", unit = "player" }, -- Die by the Sword + { spell = 132404, type = "buff", unit = "player" }, -- Shield Block + { spell = 190456, type = "buff", unit = "player" }, -- Ignore Pain + { spell = 197690, type = "buff", unit = "player", talent = 12 }, -- Defensive Stance + { spell = 202164, type = "buff", unit = "player", talent = 11 }, -- Bounding Stride + { spell = 227847, type = "buff", unit = "player" }, -- Bladestorm + { spell = 248622, type = "buff", unit = "player", talent = 16 }, -- In For The Kill + { spell = 260708, type = "buff", unit = "player" }, -- Sweeping Strikes + { spell = 262228, type = "buff", unit = "player", talent = 18 }, -- Deadly Calm + { spell = 262232, type = "buff", unit = "player", talent = 1 }, -- War Machine + { spell = 334783, type = "buff", unit = "player", talent = 13 }, -- Collateral Damage + }, + icon = 132333, }, [2] = { title = L["Debuffs"], args = { - { spell = 355, type = "debuff", unit = "target"}, -- Taunt - { spell = 772, type = "debuff", unit = "target", talent = 9}, -- Rend - { spell = 1715, type = "debuff", unit = "target"}, -- Hamstring - { spell = 5246, type = "debuff", unit = "target"}, -- Intimidating Shout - { spell = 12323, type = "debuff", unit = "target"}, -- Piercing Howl - { spell = 105771, type = "debuff", unit = "target"}, -- Charge - { spell = 115804, type = "debuff", unit = "target"}, -- Mortal Wounds - { spell = 132169, type = "debuff", unit = "target", talent = 6}, -- Storm Bolt - { spell = 208086, type = "debuff", unit = "target"}, -- Colossus Smash - { spell = 262115, type = "debuff", unit = "target"}, -- Deep Wounds + { spell = 355, type = "debuff", unit = "target" }, -- Taunt + { spell = 772, type = "debuff", unit = "target", talent = 9 }, -- Rend + { spell = 1715, type = "debuff", unit = "target" }, -- Hamstring + { spell = 5246, type = "debuff", unit = "target" }, -- Intimidating Shout + { spell = 12323, type = "debuff", unit = "target" }, -- Piercing Howl + { spell = 105771, type = "debuff", unit = "target" }, -- Charge + { spell = 115804, type = "debuff", unit = "target" }, -- Mortal Wounds + { spell = 132169, type = "debuff", unit = "target", talent = 6 }, -- Storm Bolt + { spell = 208086, type = "debuff", unit = "target" }, -- Colossus Smash + { spell = 262115, type = "debuff", unit = "target" }, -- Deep Wounds }, - icon = 132366 + icon = 132366, }, [3] = { title = L["Abilities"], args = { - { spell = 100, type = "ability", requiresTarget = true, talent = {5,6}, titleSuffix =" (1 Charge)" }, -- Charge - { spell = 100, type = "ability", requiresTarget = true}, -- Charge - { spell = 100, type = "ability", charges = true, requiresTarget = true, talent = 4, titleSuffix =" (2 Charges)"}, -- Charge - { spell = 355, type = "ability", debuff = true, requiresTarget = true}, -- Taunt - { spell = 772, type = "ability", debuff = true, requiresTarget = true, talent = 9}, -- Rend - { spell = 845, type = "ability", talent = 15}, -- Cleave - { spell = 1161, type = "ability"}, -- Challenging Shout - { spell = 1464, type = "ability", requiresTarget = true}, -- Slam - { spell = 1680, type = "ability"}, -- Whirlwind - { spell = 1715, type = "ability", debuff = true, requiresTarget = true}, -- Hamstring - { spell = 2565, type = "ability", buff = true, charges = true}, -- Shield Block - { spell = 3411, type = "ability"}, -- Intervene - { spell = 5246, type = "ability", debuff = true, requiresTarget = true}, -- Intimidating Shout - { spell = 6544, type = "ability"}, -- Heroic Leap - { spell = 6552, type = "ability", requiresTarget = true}, -- Pummel - { spell = 6673, type = "ability"}, -- Battle Shout - { spell = 7384, type = "ability", requiresTarget = true, overlayGlow = true, talent = {19,21}, titleSuffix =" (1 Charge)"}, -- Overpower - { spell = 7384, type = "ability", charges = true, overlayGlow = true, requiresTarget = true, talent = 20, titleSuffix =" (2 Charges)"}, -- Overpower - { spell = 12294, type = "ability", requiresTarget = true}, -- Mortal Strike - { spell = 12323, type = "ability", debuff = true}, -- Piercing Howl - { spell = 18499, type = "ability", buff = true}, -- Berserker Rage - { spell = 23920, type = "ability", buff = true}, -- Spell Reflection - { spell = 23922, type = "ability", requiresTarget = true}, -- Shield Slam - { spell = 34428, type = "ability", usable = true, requiresTarget = true}, -- Victory Rush - { spell = 57755, type = "ability", requiresTarget = true}, -- Heroic Throw - { spell = 64382, type = "ability", requiresTarget = true}, -- Shattering Throw - { spell = 97462, type = "ability", buff = true}, -- Rallying Cry - { spell = 107570, type = "ability", debuff = true, requiresTarget = true, talent = 6}, -- Storm Bolt - { spell = 107574, type = "ability", buff = true, talent = 17}, -- Avatar - { spell = 118038, type = "ability", buff = true}, -- Die by the Sword - { spell = 152277, type = "a bility", talent = 21}, -- Ravager - { spell = 163201, type = "ability", requiresTarget = true}, -- Execute - { spell = 167105, type = "ability", debuff = true, requiresTarget = true}, -- Colossus Smash - { spell = 190456, type = "ability", buff = true}, -- Ignore Pain - { spell = 197690, type = "ability", buff = true, talenbt = 12}, -- Defensive Stance - { spell = 202168, type = "ability", requiresTarget = true, talent = 5}, -- Impending Victory - { spell = 227847, type = "ability"}, -- Bladestorm - { spell = 260643, type = "ability", requiresTarget = true, talent = 3}, -- Skullsplitter - { spell = 260708, type = "ability", buff = true}, -- Sweeping Strikes - { spell = 262161, type = "ability", debuff = true, requiresTarget = true, talent = 14}, -- Warbreaker - { spell = 262228, type = "ability", buff = true, talent = 18}, -- Deadly Calm - }, - icon = 132355 + { spell = 100, type = "ability", requiresTarget = true, talent = { 5, 6 }, titleSuffix = " (1 Charge)" }, -- Charge + { spell = 100, type = "ability", requiresTarget = true }, -- Charge + { spell = 100, type = "ability", charges = true, requiresTarget = true, talent = 4, titleSuffix = " (2 Charges)" }, -- Charge + { spell = 355, type = "ability", debuff = true, requiresTarget = true }, -- Taunt + { spell = 772, type = "ability", debuff = true, requiresTarget = true, talent = 9 }, -- Rend + { spell = 845, type = "ability", talent = 15 }, -- Cleave + { spell = 1161, type = "ability" }, -- Challenging Shout + { spell = 1464, type = "ability", requiresTarget = true }, -- Slam + { spell = 1680, type = "ability" }, -- Whirlwind + { spell = 1715, type = "ability", debuff = true, requiresTarget = true }, -- Hamstring + { spell = 2565, type = "ability", buff = true, charges = true }, -- Shield Block + { spell = 3411, type = "ability" }, -- Intervene + { spell = 5246, type = "ability", debuff = true, requiresTarget = true }, -- Intimidating Shout + { spell = 6544, type = "ability" }, -- Heroic Leap + { spell = 6552, type = "ability", requiresTarget = true }, -- Pummel + { spell = 6673, type = "ability" }, -- Battle Shout + { spell = 7384, type = "ability", requiresTarget = true, overlayGlow = true, talent = { 19, 21 }, titleSuffix = " (1 Charge)" }, -- Overpower + { spell = 7384, type = "ability", charges = true, overlayGlow = true, requiresTarget = true, talent = 20, titleSuffix = " (2 Charges)" }, -- Overpower + { spell = 12294, type = "ability", requiresTarget = true }, -- Mortal Strike + { spell = 12323, type = "ability", debuff = true }, -- Piercing Howl + { spell = 18499, type = "ability", buff = true }, -- Berserker Rage + { spell = 23920, type = "ability", buff = true }, -- Spell Reflection + { spell = 23922, type = "ability", requiresTarget = true }, -- Shield Slam + { spell = 34428, type = "ability", usable = true, requiresTarget = true }, -- Victory Rush + { spell = 57755, type = "ability", requiresTarget = true }, -- Heroic Throw + { spell = 64382, type = "ability", requiresTarget = true }, -- Shattering Throw + { spell = 97462, type = "ability", buff = true }, -- Rallying Cry + { spell = 107570, type = "ability", debuff = true, requiresTarget = true, talent = 6 }, -- Storm Bolt + { spell = 107574, type = "ability", buff = true, talent = 17 }, -- Avatar + { spell = 118038, type = "ability", buff = true }, -- Die by the Sword + { spell = 152277, type = "a bility", talent = 21 }, -- Ravager + { spell = 163201, type = "ability", requiresTarget = true }, -- Execute + { spell = 167105, type = "ability", debuff = true, requiresTarget = true }, -- Colossus Smash + { spell = 190456, type = "ability", buff = true }, -- Ignore Pain + { spell = 197690, type = "ability", buff = true, talenbt = 12 }, -- Defensive Stance + { spell = 202168, type = "ability", requiresTarget = true, talent = 5 }, -- Impending Victory + { spell = 227847, type = "ability" }, -- Bladestorm + { spell = 260643, type = "ability", requiresTarget = true, talent = 3 }, -- Skullsplitter + { spell = 260708, type = "ability", buff = true }, -- Sweeping Strikes + { spell = 262161, type = "ability", debuff = true, requiresTarget = true, talent = 14 }, -- Warbreaker + { spell = 262228, type = "ability", buff = true, talent = 18 }, -- Deadly Calm + }, + icon = 132355, }, [4] = {}, [5] = {}, @@ -165,22 +165,21 @@ templates.class.WARRIOR = { [10] = { title = L["PvP Talents"], args = { - { spell = 198817, type="ability", pvptalent = 4, titleSuffix = L["cooldown"]},-- Sharpen Blade - { spell = 198817, type="buff", unit = "player", pvptalent = 4, titleSuffix = L["buff"]},-- Sharpen Blade - { spell = 236077, type="ability", pvptalent = 2, titleSuffix = L["cooldown"]},-- Disarm - { spell = 236077, type="debuff", unit = "target", pvptalent = 2, titleSuffix = L["debuff"]},-- Disarm - { spell = 236273, type="ability", pvptalent = 3, titleSuffix = L["cooldown"]},-- Duel - { spell = 236273, type="debuff", unit = "target", pvptalent = 3, titleSuffix = L["debuff"]},-- Duel - { spell = 236320, type="ability", pvptalent = 9, titleSuffix = L["cooldown"]},-- War Banner - { spell = 236321, type="buff", unit = "player", pvptalent = 9, titleSuffix = L["buff"]},-- War Banner - { spell = 330279, type="buff", unit = "group", pvptalent = 5},-- Overwatch + { spell = 198817, type = "ability", pvptalent = 4, titleSuffix = L["cooldown"] }, -- Sharpen Blade + { spell = 198817, type = "buff", unit = "player", pvptalent = 4, titleSuffix = L["buff"] }, -- Sharpen Blade + { spell = 236077, type = "ability", pvptalent = 2, titleSuffix = L["cooldown"] }, -- Disarm + { spell = 236077, type = "debuff", unit = "target", pvptalent = 2, titleSuffix = L["debuff"] }, -- Disarm + { spell = 236273, type = "ability", pvptalent = 3, titleSuffix = L["cooldown"] }, -- Duel + { spell = 236273, type = "debuff", unit = "target", pvptalent = 3, titleSuffix = L["debuff"] }, -- Duel + { spell = 236320, type = "ability", pvptalent = 9, titleSuffix = L["cooldown"] }, -- War Banner + { spell = 236321, type = "buff", unit = "player", pvptalent = 9, titleSuffix = L["buff"] }, -- War Banner + { spell = 330279, type = "buff", unit = "group", pvptalent = 5 }, -- Overwatch }, icon = "Interface\\Icons\\Achievement_BG_winWSG", }, [11] = { title = L["Resources"], - args = { - }, + args = {}, icon = rageIcon, }, }, @@ -188,81 +187,81 @@ templates.class.WARRIOR = { [1] = { title = L["Buffs"], args = { - { spell = 1719, type = "buff", unit = "player"}, -- Recklessness + { spell = 1719, type = "buff", unit = "player" }, -- Recklessness { spell = 6673, type = "buff", unit = "player", forceOwnOnly = true, ownOnly = nil }, -- Battle Shout - { spell = 18499, type = "buff", unit = "player"}, -- Berserker Rage - { spell = 32216, type = "buff", unit = "player", talent = 5}, -- Victorious - { spell = 46924, type = "buff", unit = "player", talent = 18}, -- Bladestorm - { spell = 85739, type = "buff", unit = "player"}, -- Whirlwind - { spell = 97463, type = "buff", unit = "player"}, -- Rallying Cry - { spell = 132404, type = "buff", unit = "player"}, -- Shield Block - { spell = 184362, type = "buff", unit = "player"}, -- Enrage - { spell = 184364, type = "buff", unit = "player"}, -- Enraged Regeneration - { spell = 190456, type = "buff", unit = "player"}, -- Ignore Pain - { spell = 202164, type = "buff", unit = "player", talent = 11}, -- Bounding Stride - { spell = 202225, type = "buff", unit = "player", talent = 10}, -- Furious Charge - { spell = 262232, type = "buff", unit = "player", talent = 1}, -- War Machine - { spell = 280776, type = "buff", unit = "player", talent = 2}, -- Sudden Death - { spell = 335082, type = "buff", unit = "player", talent = 8}, -- Frenzy - }, - icon = 136224 + { spell = 18499, type = "buff", unit = "player" }, -- Berserker Rage + { spell = 32216, type = "buff", unit = "player", talent = 5 }, -- Victorious + { spell = 46924, type = "buff", unit = "player", talent = 18 }, -- Bladestorm + { spell = 85739, type = "buff", unit = "player" }, -- Whirlwind + { spell = 97463, type = "buff", unit = "player" }, -- Rallying Cry + { spell = 132404, type = "buff", unit = "player" }, -- Shield Block + { spell = 184362, type = "buff", unit = "player" }, -- Enrage + { spell = 184364, type = "buff", unit = "player" }, -- Enraged Regeneration + { spell = 190456, type = "buff", unit = "player" }, -- Ignore Pain + { spell = 202164, type = "buff", unit = "player", talent = 11 }, -- Bounding Stride + { spell = 202225, type = "buff", unit = "player", talent = 10 }, -- Furious Charge + { spell = 262232, type = "buff", unit = "player", talent = 1 }, -- War Machine + { spell = 280776, type = "buff", unit = "player", talent = 2 }, -- Sudden Death + { spell = 335082, type = "buff", unit = "player", talent = 8 }, -- Frenzy + }, + icon = 136224, }, [2] = { title = L["Debuffs"], args = { - { spell = 355, type = "debuff", unit = "target"}, -- Taunt - { spell = 1715, type = "debuff", unit = "target"}, -- Hamstring - { spell = 12323, type = "debuff", unit = "target"}, -- Piercing Howl - { spell = 105771, type = "debuff", unit = "target"}, -- Charge - { spell = 118000, type = "debuff", unit = "target", talent = 17}, -- Dragon Roar - { spell = 132169, type = "debuff", unit = "target", talent = 6}, -- Storm Bolt - { spell = 280773, type = "debuff", unit = "target", talent = 21}, -- Siegebreaker + { spell = 355, type = "debuff", unit = "target" }, -- Taunt + { spell = 1715, type = "debuff", unit = "target" }, -- Hamstring + { spell = 12323, type = "debuff", unit = "target" }, -- Piercing Howl + { spell = 105771, type = "debuff", unit = "target" }, -- Charge + { spell = 118000, type = "debuff", unit = "target", talent = 17 }, -- Dragon Roar + { spell = 132169, type = "debuff", unit = "target", talent = 6 }, -- Storm Bolt + { spell = 280773, type = "debuff", unit = "target", talent = 21 }, -- Siegebreaker }, - icon = 132154 + icon = 132154, }, [3] = { title = L["Abilities"], args = { - { spell = 100, type = "ability", requiresTarget = true, talent = {5,6}, titleSuffix =" (1 Charge)" }, -- Charge - { spell = 100, type = "ability", requiresTarget = true}, -- Charge - { spell = 100, type = "ability", charges = true, requiresTarget = true, talent = 4, titleSuffix =" (2 Charges)"}, -- Charge - { spell = 355, type = "ability", debuff = true, requiresTarget = true}, -- Taunt - { spell = 1161, type = "ability"}, -- Challenging Shout - { spell = 1464, type = "ability", requiresTarget = true}, -- Slam - { spell = 1680, type = "ability"}, -- Whirlwind - { spell = 1715, type = "ability", debuff = true, requiresTarget = true}, -- Hamstring - { spell = 1719, type = "ability", buff = true}, -- Recklessness - { spell = 2565, type = "ability", buff = true, charges = true}, -- Shield Block - { spell = 3411, type = "ability"}, -- Intervene - { spell = 5246, type = "ability", debuff = true, requiresTarget = true}, -- Intimidating Shout - { spell = 5308, type = "ability", requiresTarget = true, overlayGlow = true}, -- Execute - { spell = 6544, type = "ability"}, -- Heroic Leap - { spell = 6552, type = "ability", requiresTarget = true}, -- Pummel - { spell = 6673, type = "ability"}, -- Battle Shout - { spell = 12323, type = "ability", debuff = true}, -- Piercing Howl - { spell = 18499, type = "ability", buff = true}, -- Berserker Rage - { spell = 23881, type = "ability", requiresTarget = true}, -- Bloodthirst - { spell = 23920, type = "ability", buff = true}, -- Spell Reflection - { spell = 23922, type = "ability", requiresTarget = true}, -- Shield Slam - { spell = 34428, type = "ability", usable = true, requiresTarget = true}, -- Victory Rush - { spell = 46924, type = "ability", talent = 18}, -- Bladestorm - { spell = 57755, type = "ability", requiresTarget = true}, -- Heroic Throw - { spell = 64382, type = "ability", requiresTarget = true}, -- Shattering Throw - { spell = 85288, type = "ability", charges = true, requiresTarget = true, overlayGlow = true}, -- Raging Blow - { spell = 97462, type = "ability", buff = true}, -- Rallying Cry - { spell = 100130, type = "ability", requiresTarget = true}, -- Furious Slash - { spell = 107570, type = "ability", debuff = true, requiresTarget = true, talent = 6}, -- Storm Bolt - { spell = 118000, type = "ability", talent = 17}, -- Dragon Roar - { spell = 163201, type = "ability", requiresTarget = true}, -- Execute - { spell = 184364, type = "ability", buff = true}, -- Enraged Regeneration - { spell = 184367, type = "ability", requiresTarget = true, overlayGlow = true}, -- Rampage - { spell = 190411, type = "ability"}, -- Whirlwind - { spell = 190456, type = "ability", buff = true}, -- Ignore Pain - { spell = 202168, type = "ability", requiresTarget = true, talent = 5}, -- Impending Victory - { spell = 280772, type = "ability", debuff = true, requiresTarget = true, talent = 21}, -- Siegebreaker - { spell = 315720, type = "ability", requiresTarget = true, talent = 9}, -- Onslaught - }, - icon = 136012 + { spell = 100, type = "ability", requiresTarget = true, talent = { 5, 6 }, titleSuffix = " (1 Charge)" }, -- Charge + { spell = 100, type = "ability", requiresTarget = true }, -- Charge + { spell = 100, type = "ability", charges = true, requiresTarget = true, talent = 4, titleSuffix = " (2 Charges)" }, -- Charge + { spell = 355, type = "ability", debuff = true, requiresTarget = true }, -- Taunt + { spell = 1161, type = "ability" }, -- Challenging Shout + { spell = 1464, type = "ability", requiresTarget = true }, -- Slam + { spell = 1680, type = "ability" }, -- Whirlwind + { spell = 1715, type = "ability", debuff = true, requiresTarget = true }, -- Hamstring + { spell = 1719, type = "ability", buff = true }, -- Recklessness + { spell = 2565, type = "ability", buff = true, charges = true }, -- Shield Block + { spell = 3411, type = "ability" }, -- Intervene + { spell = 5246, type = "ability", debuff = true, requiresTarget = true }, -- Intimidating Shout + { spell = 5308, type = "ability", requiresTarget = true, overlayGlow = true }, -- Execute + { spell = 6544, type = "ability" }, -- Heroic Leap + { spell = 6552, type = "ability", requiresTarget = true }, -- Pummel + { spell = 6673, type = "ability" }, -- Battle Shout + { spell = 12323, type = "ability", debuff = true }, -- Piercing Howl + { spell = 18499, type = "ability", buff = true }, -- Berserker Rage + { spell = 23881, type = "ability", requiresTarget = true }, -- Bloodthirst + { spell = 23920, type = "ability", buff = true }, -- Spell Reflection + { spell = 23922, type = "ability", requiresTarget = true }, -- Shield Slam + { spell = 34428, type = "ability", usable = true, requiresTarget = true }, -- Victory Rush + { spell = 46924, type = "ability", talent = 18 }, -- Bladestorm + { spell = 57755, type = "ability", requiresTarget = true }, -- Heroic Throw + { spell = 64382, type = "ability", requiresTarget = true }, -- Shattering Throw + { spell = 85288, type = "ability", charges = true, requiresTarget = true, overlayGlow = true }, -- Raging Blow + { spell = 97462, type = "ability", buff = true }, -- Rallying Cry + { spell = 100130, type = "ability", requiresTarget = true }, -- Furious Slash + { spell = 107570, type = "ability", debuff = true, requiresTarget = true, talent = 6 }, -- Storm Bolt + { spell = 118000, type = "ability", talent = 17 }, -- Dragon Roar + { spell = 163201, type = "ability", requiresTarget = true }, -- Execute + { spell = 184364, type = "ability", buff = true }, -- Enraged Regeneration + { spell = 184367, type = "ability", requiresTarget = true, overlayGlow = true }, -- Rampage + { spell = 190411, type = "ability" }, -- Whirlwind + { spell = 190456, type = "ability", buff = true }, -- Ignore Pain + { spell = 202168, type = "ability", requiresTarget = true, talent = 5 }, -- Impending Victory + { spell = 280772, type = "ability", debuff = true, requiresTarget = true, talent = 21 }, -- Siegebreaker + { spell = 315720, type = "ability", requiresTarget = true, talent = 9 }, -- Onslaught + }, + icon = 136012, }, [4] = {}, [5] = {}, @@ -273,22 +272,21 @@ templates.class.WARRIOR = { [10] = { title = L["PvP Talents"], args = { - { spell = 199261, type="ability", pvptalent = 11, titleSuffix = L["cooldown"]},-- Death Wish - { spell = 199261, type="buff", unit = "player", pvptalent = 11, titleSuffix = L["buff"]},-- Death Wish - { spell = 213858, type="buff", unit = "player", pvptalent = 4},-- Battle Trance - { spell = 236077, type="ability", pvptalent = 7, titleSuffix = L["cooldown"]},-- Disarm - { spell = 236077, type="debuff", unit = "target", pvptalent = 7, titleSuffix = L["debuff"]},-- Disarm - { spell = 280746, type="buff", unit = "player", pvptalent = 1},-- Barbarian - { spell = 329038, type="ability", pvptalent = 5, titleSuffix = L["cooldown"]},-- Death Wish - { spell = 329038, type="buff", unit = "player", pvptalent = 5, titleSuffix = L["buff"]},-- Death Wish - { spell = 330279, type="buff", unit = "group", pvptalent = 10},-- Overwatch + { spell = 199261, type = "ability", pvptalent = 11, titleSuffix = L["cooldown"] }, -- Death Wish + { spell = 199261, type = "buff", unit = "player", pvptalent = 11, titleSuffix = L["buff"] }, -- Death Wish + { spell = 213858, type = "buff", unit = "player", pvptalent = 4 }, -- Battle Trance + { spell = 236077, type = "ability", pvptalent = 7, titleSuffix = L["cooldown"] }, -- Disarm + { spell = 236077, type = "debuff", unit = "target", pvptalent = 7, titleSuffix = L["debuff"] }, -- Disarm + { spell = 280746, type = "buff", unit = "player", pvptalent = 1 }, -- Barbarian + { spell = 329038, type = "ability", pvptalent = 5, titleSuffix = L["cooldown"] }, -- Death Wish + { spell = 329038, type = "buff", unit = "player", pvptalent = 5, titleSuffix = L["buff"] }, -- Death Wish + { spell = 330279, type = "buff", unit = "group", pvptalent = 10 }, -- Overwatch }, icon = "Interface\\Icons\\Achievement_BG_winWSG", }, [11] = { title = L["Resources"], - args = { - }, + args = {}, icon = rageIcon, }, }, @@ -296,80 +294,80 @@ templates.class.WARRIOR = { [1] = { title = L["Buffs"], args = { - { spell = 871, type = "buff", unit = "player"}, -- Shield Wall + { spell = 871, type = "buff", unit = "player" }, -- Shield Wall { spell = 6673, type = "buff", unit = "player", forceOwnOnly = true, ownOnly = nil }, -- Battle Shout - { spell = 12975, type = "buff", unit = "player"}, -- Last Stand - { spell = 18499, type = "buff", unit = "player"}, -- Berserker Rage - { spell = 23920, type = "buff", unit = "player"}, -- Spell Reflection - { spell = 97463, type = "buff", unit = "player"}, -- Rallying Cry - { spell = 107574, type = "buff", unit = "player"}, -- Avatar - { spell = 132404, type = "buff", unit = "player"}, -- Shield Block - { spell = 147833, type = "buff", unit = "target"}, -- Intervene - { spell = 190456, type = "buff", unit = "player"}, -- Ignore Pain - { spell = 202164, type = "buff", unit = "player", talent = 11}, -- Bounding Stride - { spell = 202602, type = "buff", unit = "player", talent = 16}, -- Into the Fray - { spell = 262232, type = "buff", unit = "player", talent = 1}, -- War Machine - { spell = 288653, type = "debuff", unit = "target"}, --Intimidating Presence - }, - icon = 1377132 + { spell = 12975, type = "buff", unit = "player" }, -- Last Stand + { spell = 18499, type = "buff", unit = "player" }, -- Berserker Rage + { spell = 23920, type = "buff", unit = "player" }, -- Spell Reflection + { spell = 97463, type = "buff", unit = "player" }, -- Rallying Cry + { spell = 107574, type = "buff", unit = "player" }, -- Avatar + { spell = 132404, type = "buff", unit = "player" }, -- Shield Block + { spell = 147833, type = "buff", unit = "target" }, -- Intervene + { spell = 190456, type = "buff", unit = "player" }, -- Ignore Pain + { spell = 202164, type = "buff", unit = "player", talent = 11 }, -- Bounding Stride + { spell = 202602, type = "buff", unit = "player", talent = 16 }, -- Into the Fray + { spell = 262232, type = "buff", unit = "player", talent = 1 }, -- War Machine + { spell = 288653, type = "debuff", unit = "target" }, --Intimidating Presence + }, + icon = 1377132, }, [2] = { title = L["Debuffs"], args = { - { spell = 355, type = "debuff", unit = "target"}, -- Taunt - { spell = 1160, type = "debuff", unit = "target"}, -- Demoralizing Shout - { spell = 1715, type = "debuff", unit = "target"}, -- Hamstring - { spell = 5246, type = "debuff", unit = "target"}, -- Intimidating Shout - { spell = 6343, type = "debuff", unit = "target"}, -- Thunder Clap - { spell = 105771, type = "debuff", unit = "target"}, -- Charge - { spell = 115767, type = "debuff", unit = "target"}, -- Deep Wounds - { spell = 132168, type = "debuff", unit = "target"}, -- Shockwave - { spell = 132169, type = "debuff", unit = "target", talent = 6}, -- Storm Bolt - { spell = 275335, type = "debuff", unit = "target", talent = 2}, -- Punish + { spell = 355, type = "debuff", unit = "target" }, -- Taunt + { spell = 1160, type = "debuff", unit = "target" }, -- Demoralizing Shout + { spell = 1715, type = "debuff", unit = "target" }, -- Hamstring + { spell = 5246, type = "debuff", unit = "target" }, -- Intimidating Shout + { spell = 6343, type = "debuff", unit = "target" }, -- Thunder Clap + { spell = 105771, type = "debuff", unit = "target" }, -- Charge + { spell = 115767, type = "debuff", unit = "target" }, -- Deep Wounds + { spell = 132168, type = "debuff", unit = "target" }, -- Shockwave + { spell = 132169, type = "debuff", unit = "target", talent = 6 }, -- Storm Bolt + { spell = 275335, type = "debuff", unit = "target", talent = 2 }, -- Punish }, - icon = 132090 + icon = 132090, }, [3] = { title = L["Abilities"], args = { - { spell = 100, type = "ability", requiresTarget = true, talent = {5,6}, titleSuffix =" (1 Charge)" }, -- Charge - { spell = 100, type = "ability", requiresTarget = true}, -- Charge - { spell = 100, type = "ability", charges = true, requiresTarget = true, talent = 4, titleSuffix =" (2 Charges)"}, -- Charge - { spell = 355, type = "ability", debuff = true, requiresTarget = true}, -- Taunt - { spell = 871, type = "ability", buff = true}, -- Shield Wall - { spell = 1160, type = "ability", debuff = true}, -- Demoralizing Shout - { spell = 1161, type = "ability"}, -- Challenging Shout - { spell = 1464, type = "ability", overlayGlow = true, requiresTarget = true}, -- Revenge - { spell = 1715, type = "ability", debuff = true, requiresTarget = true}, -- Hamstring - { spell = 1680, type = "ability"}, -- Whirlwind - { spell = 2565, type = "ability", charges = true, buff = true}, -- Shield Block - { spell = 3411, type = "ability"}, -- Intervene - { spell = 5246, type = "ability", debuff = true, requiresTarget = true}, -- Intimidating Shout - { spell = 6343, type = "ability"}, -- Thunder Clap - { spell = 6544, type = "ability"}, -- Heroic Leap - { spell = 6552, type = "ability", requiresTarget = true}, -- Pummel - { spell = 6572, type = "ability", overlayGlow = true}, -- Revenge - { spell = 6673, type = "ability"}, -- Battle Shout - { spell = 12975, type = "ability", buff = true}, -- Last Stand - { spell = 18499, type = "ability", buff = true}, -- Berserker Rage - { spell = 20243, type = "ability", requiresTarget = true, talent = {1, 2}}, -- Devastate - { spell = 23920, type = "ability", buff = true}, -- Spell Reflection - { spell = 23922, type = "ability", requiresTarget = true, overlayGlow = true}, -- Shield Slam - { spell = 23922, type = "ability", requiresTarget = true}, -- Shield Slam - { spell = 34428, type = "ability", usable = true, requiresTarget = true}, -- Victory Rush - { spell = 46968, type = "ability"}, -- Shockwave - { spell = 57755, type = "ability", requiresTarget = true}, -- Heroic Throw - { spell = 64382, type = "ability", requiresTarget = true}, -- Shattering Throw - { spell = 97462, type = "ability"}, -- Rallying Cry - { spell = 107570, type = "ability", debuff = true, requiresTarget = true, talent = 6}, -- Storm Bolt - { spell = 107574, type = "ability", buff = true}, -- Avatar - { spell = 118000, type = "ability", talent = 9}, -- Dragon Roar - { spell = 163201, type = "ability", requiresTarget = true}, -- Execute - { spell = 198304, type = "ability", charges = true, requiresTarget = true}, -- Intercept - { spell = 202168, type = "ability", requiresTarget = true, talent = 15}, -- Impending Victory - { spell = 228920, type = "ability", talent = 18}, -- Ravager - }, - icon = 134951 + { spell = 100, type = "ability", requiresTarget = true, talent = { 5, 6 }, titleSuffix = " (1 Charge)" }, -- Charge + { spell = 100, type = "ability", requiresTarget = true }, -- Charge + { spell = 100, type = "ability", charges = true, requiresTarget = true, talent = 4, titleSuffix = " (2 Charges)" }, -- Charge + { spell = 355, type = "ability", debuff = true, requiresTarget = true }, -- Taunt + { spell = 871, type = "ability", buff = true }, -- Shield Wall + { spell = 1160, type = "ability", debuff = true }, -- Demoralizing Shout + { spell = 1161, type = "ability" }, -- Challenging Shout + { spell = 1464, type = "ability", overlayGlow = true, requiresTarget = true }, -- Revenge + { spell = 1715, type = "ability", debuff = true, requiresTarget = true }, -- Hamstring + { spell = 1680, type = "ability" }, -- Whirlwind + { spell = 2565, type = "ability", charges = true, buff = true }, -- Shield Block + { spell = 3411, type = "ability" }, -- Intervene + { spell = 5246, type = "ability", debuff = true, requiresTarget = true }, -- Intimidating Shout + { spell = 6343, type = "ability" }, -- Thunder Clap + { spell = 6544, type = "ability" }, -- Heroic Leap + { spell = 6552, type = "ability", requiresTarget = true }, -- Pummel + { spell = 6572, type = "ability", overlayGlow = true }, -- Revenge + { spell = 6673, type = "ability" }, -- Battle Shout + { spell = 12975, type = "ability", buff = true }, -- Last Stand + { spell = 18499, type = "ability", buff = true }, -- Berserker Rage + { spell = 20243, type = "ability", requiresTarget = true, talent = { 1, 2 } }, -- Devastate + { spell = 23920, type = "ability", buff = true }, -- Spell Reflection + { spell = 23922, type = "ability", requiresTarget = true, overlayGlow = true }, -- Shield Slam + { spell = 23922, type = "ability", requiresTarget = true }, -- Shield Slam + { spell = 34428, type = "ability", usable = true, requiresTarget = true }, -- Victory Rush + { spell = 46968, type = "ability" }, -- Shockwave + { spell = 57755, type = "ability", requiresTarget = true }, -- Heroic Throw + { spell = 64382, type = "ability", requiresTarget = true }, -- Shattering Throw + { spell = 97462, type = "ability" }, -- Rallying Cry + { spell = 107570, type = "ability", debuff = true, requiresTarget = true, talent = 6 }, -- Storm Bolt + { spell = 107574, type = "ability", buff = true }, -- Avatar + { spell = 118000, type = "ability", talent = 9 }, -- Dragon Roar + { spell = 163201, type = "ability", requiresTarget = true }, -- Execute + { spell = 198304, type = "ability", charges = true, requiresTarget = true }, -- Intercept + { spell = 202168, type = "ability", requiresTarget = true, talent = 15 }, -- Impending Victory + { spell = 228920, type = "ability", talent = 18 }, -- Ravager + }, + icon = 134951, }, [4] = {}, [5] = {}, @@ -380,27 +378,26 @@ templates.class.WARRIOR = { [10] = { title = L["PvP Talents"], args = { - { spell = 198912, type="ability", pvptalent = 4, titleSuffix = L["cooldown"]},-- Shield Bash - { spell = 198912, type="debuff", unit = "target", pvptalent = 4, titleSuffix = L["debuff"]},-- Shield Bash - { spell = 199085, type="debuff", unit = "target", pvptalent = 6},-- Warpath - { spell = 205800, type="ability", pvptalent = 11, titleSuffix = L["cooldown"]},-- Oppressor - { spell = 206572, type="ability", pvptalent = 8},-- Dragon Charge - { spell = 206891, type="debuff", unit = "target", pvptalent = 11, titleSuffix = L["debuff"]},-- Oppressor - { spell = 213871, type="ability", pvptalent = 2, titleSuffix = L["cooldown"]},-- Bodyguard - { spell = 213871, type="buff", unit = "group", pvptalent = 2, titleSuffix = L["buff"]},-- Bodyguard - { spell = 236077, type="ability", pvptalent = 10, titleSuffix = L["cooldown"]},-- Disarm - { spell = 236077, type="debuff", unit = "target", pvptalent = 10, titleSuffix = L["debuff"]},-- Disarm - { spell = 330279, type="buff", unit = "group", pvptalent = 12},-- Overwatch + { spell = 198912, type = "ability", pvptalent = 4, titleSuffix = L["cooldown"] }, -- Shield Bash + { spell = 198912, type = "debuff", unit = "target", pvptalent = 4, titleSuffix = L["debuff"] }, -- Shield Bash + { spell = 199085, type = "debuff", unit = "target", pvptalent = 6 }, -- Warpath + { spell = 205800, type = "ability", pvptalent = 11, titleSuffix = L["cooldown"] }, -- Oppressor + { spell = 206572, type = "ability", pvptalent = 8 }, -- Dragon Charge + { spell = 206891, type = "debuff", unit = "target", pvptalent = 11, titleSuffix = L["debuff"] }, -- Oppressor + { spell = 213871, type = "ability", pvptalent = 2, titleSuffix = L["cooldown"] }, -- Bodyguard + { spell = 213871, type = "buff", unit = "group", pvptalent = 2, titleSuffix = L["buff"] }, -- Bodyguard + { spell = 236077, type = "ability", pvptalent = 10, titleSuffix = L["cooldown"] }, -- Disarm + { spell = 236077, type = "debuff", unit = "target", pvptalent = 10, titleSuffix = L["debuff"] }, -- Disarm + { spell = 330279, type = "buff", unit = "group", pvptalent = 12 }, -- Overwatch }, icon = "Interface\\Icons\\Achievement_BG_winWSG", }, [11] = { title = L["Resources"], - args = { - }, + args = {}, icon = rageIcon, - } - } + }, + }, } templates.class.PALADIN = { @@ -408,83 +405,83 @@ templates.class.PALADIN = { [1] = { title = L["Buffs"], args = { - { spell = 465, type = "buff", unit = "player"}, -- Devotion Aura - { spell = 498, type = "buff", unit = "player"}, -- Divine Protection - { spell = 642, type = "buff", unit = "player"}, -- Divine Shield - { spell = 1022, type = "buff", unit = "group"}, -- Blessing of Protection - { spell = 1044, type = "buff", unit = "group"}, -- Blessing of Freedom - { spell = 6940, type = "buff", unit = "group"}, -- Blessing of Sacrifice - { spell = 31821, type = "buff", unit = "player"}, -- Aura Mastery - { spell = 31884, type = "buff", unit = "player"}, -- Avenging Wrath - { spell = 32223, type = "buff", unit = "player"}, -- Crusader Aura - { spell = 53563, type = "buff", unit = "group"}, -- Beacon of Light - { spell = 54149, type = "buff", unit = "player"}, -- Infusion of Light - { spell = 105809, type = "buff", unit = "player"}, -- Holy Avenger - { spell = 156910, type = "buff", unit = "group", talent = 20}, -- Beacon of Faith - { spell = 183435, type = "buff", unit = "player"}, -- Retribution Aura - { spell = 200025, type = "buff", unit = "group", talent = 21}, -- Beacon of Virtue - { spell = 214202, type = "buff", unit = "player"}, -- Rule of Law - { spell = 216331, type = "buff", unit = "player", talent = 17}, -- Avenging Crusader - { spell = 221885, type = "buff", unit = "player"}, -- Divine Steed - { spell = 223306, type = "buff", unit = "target", talent = 2}, -- Bestow Faith - { spell = 287280, type = "buff", unit = "group", talent = 19}, -- Glimmer of Light - { spell = 317920, type = "buff", unit = "player"}, -- Concentration Aura - }, - icon = 135964 + { spell = 465, type = "buff", unit = "player" }, -- Devotion Aura + { spell = 498, type = "buff", unit = "player" }, -- Divine Protection + { spell = 642, type = "buff", unit = "player" }, -- Divine Shield + { spell = 1022, type = "buff", unit = "group" }, -- Blessing of Protection + { spell = 1044, type = "buff", unit = "group" }, -- Blessing of Freedom + { spell = 6940, type = "buff", unit = "group" }, -- Blessing of Sacrifice + { spell = 31821, type = "buff", unit = "player" }, -- Aura Mastery + { spell = 31884, type = "buff", unit = "player" }, -- Avenging Wrath + { spell = 32223, type = "buff", unit = "player" }, -- Crusader Aura + { spell = 53563, type = "buff", unit = "group" }, -- Beacon of Light + { spell = 54149, type = "buff", unit = "player" }, -- Infusion of Light + { spell = 105809, type = "buff", unit = "player" }, -- Holy Avenger + { spell = 156910, type = "buff", unit = "group", talent = 20 }, -- Beacon of Faith + { spell = 183435, type = "buff", unit = "player" }, -- Retribution Aura + { spell = 200025, type = "buff", unit = "group", talent = 21 }, -- Beacon of Virtue + { spell = 214202, type = "buff", unit = "player" }, -- Rule of Law + { spell = 216331, type = "buff", unit = "player", talent = 17 }, -- Avenging Crusader + { spell = 221885, type = "buff", unit = "player" }, -- Divine Steed + { spell = 223306, type = "buff", unit = "target", talent = 2 }, -- Bestow Faith + { spell = 287280, type = "buff", unit = "group", talent = 19 }, -- Glimmer of Light + { spell = 317920, type = "buff", unit = "player" }, -- Concentration Aura + }, + icon = 135964, }, [2] = { title = L["Debuffs"], args = { - { spell = 853, type = "debuff", unit = "target"}, -- Hammer of Justice - { spell = 10326, type = "debuff", unit = "target"}, -- Turn Evil - { spell = 62124, type = "debuff", unit = "target"}, -- Hammer of Justice - { spell = 20066, type = "debuff", unit = "multi", talent = 8}, -- Repentance - { spell = 105421, type = "debuff", unit = "target", talent = 9}, -- Blinding Light - { spell = 196941, type = "debuff", unit = "target", talent = 5}, -- Judgment of Light - { spell = 204242, type = "debuff", unit = "target"}, -- Consecration - { spell = 214222, type = "debuff", unit = "target"}, -- Judgment + { spell = 853, type = "debuff", unit = "target" }, -- Hammer of Justice + { spell = 10326, type = "debuff", unit = "target" }, -- Turn Evil + { spell = 62124, type = "debuff", unit = "target" }, -- Hammer of Justice + { spell = 20066, type = "debuff", unit = "multi", talent = 8 }, -- Repentance + { spell = 105421, type = "debuff", unit = "target", talent = 9 }, -- Blinding Light + { spell = 196941, type = "debuff", unit = "target", talent = 5 }, -- Judgment of Light + { spell = 204242, type = "debuff", unit = "target" }, -- Consecration + { spell = 214222, type = "debuff", unit = "target" }, -- Judgment }, - icon = 135952 + icon = 135952, }, [3] = { title = L["Abilities"], args = { - { spell = 498, type = "ability", buff = true}, -- Divine Protection - { spell = 633, type = "ability"}, -- Lay on Hands - { spell = 642, type = "ability", buff = true}, -- Divine Shield - { spell = 853, type = "ability", requiresTarget = true}, -- Hammer of Justice - { spell = 1022, type = "ability"}, -- Blessing of Protection - { spell = 1044, type = "ability"}, -- Blessing of Freedom - { spell = 4987, type = "ability"}, -- Cleanse - { spell = 6940, type = "ability"}, -- Blessing of Sacrifice - { spell = 10326, type = "ability"}, -- Turn Evil - { spell = 20066, type = "ability", requiresTarget = true, talent = 8}, -- Repentance - { spell = 20271, type = "ability", requiresTarget = true}, -- Hammer of Wrath - { spell = 20473, type = "ability", overlayGlow = true}, -- Holy Shock - { spell = 24275, type = "ability"}, -- Hammer of Wrath - { spell = 26573, type = "ability", totem = true}, -- Consecration - { spell = 31821, type = "ability", buff = true}, -- Aura Mastery - { spell = 31821, type = "ability"}, -- Aura Mastery - { spell = 31884, type = "ability", buff = true, talent = {16, 18}}, -- Avenging Wrath - { spell = 35395, type = "ability", charges = true, requiresTarget = true}, -- Crusader Strike - { spell = 53600, type = "ability"}, -- Shield of the Righteous - { spell = 62124, type = "ability"}, -- Hand of Reckoning - { spell = 85222, type = "ability", overlayGlow = true}, -- Light of Dawn - { spell = 85673, type = "ability"}, -- Word of Glory - { spell = 105809, type = "ability", buff = true, talent = 14}, -- Holy Avenger - { spell = 114158, type = "ability", talent = 3}, -- Light's Hammer - { spell = 114165, type = "ability", talent = 6}, -- Holy Prism - { spell = 115750, type = "ability", talent = 9}, -- Blinding Light - { spell = 152262, type = "ability", buff = true, talent = 15}, -- Seraphim - { spell = 183998, type = "ability"}, -- Light of the Martyr - { spell = 190784, type = "ability"}, -- Divine Steed - { spell = 200025, type = "ability", talent = 21}, -- Beacon of Virtue - { spell = 214202, type = "ability", charges = true, buff = true, talent = 12}, -- Rule of Law - { spell = 216331, type = "ability", buff = true, talent = 17}, -- Avenging Crusader - { spell = 223306, type = "ability", talent = 2}, -- Bestow Faith - { spell = 275773, type = "ability", debuff = true, requiresTarget = true}, -- Judgment - }, - icon = 135972 + { spell = 498, type = "ability", buff = true }, -- Divine Protection + { spell = 633, type = "ability" }, -- Lay on Hands + { spell = 642, type = "ability", buff = true }, -- Divine Shield + { spell = 853, type = "ability", requiresTarget = true }, -- Hammer of Justice + { spell = 1022, type = "ability" }, -- Blessing of Protection + { spell = 1044, type = "ability" }, -- Blessing of Freedom + { spell = 4987, type = "ability" }, -- Cleanse + { spell = 6940, type = "ability" }, -- Blessing of Sacrifice + { spell = 10326, type = "ability" }, -- Turn Evil + { spell = 20066, type = "ability", requiresTarget = true, talent = 8 }, -- Repentance + { spell = 20271, type = "ability", requiresTarget = true }, -- Hammer of Wrath + { spell = 20473, type = "ability", overlayGlow = true }, -- Holy Shock + { spell = 24275, type = "ability" }, -- Hammer of Wrath + { spell = 26573, type = "ability", totem = true }, -- Consecration + { spell = 31821, type = "ability", buff = true }, -- Aura Mastery + { spell = 31821, type = "ability" }, -- Aura Mastery + { spell = 31884, type = "ability", buff = true, talent = { 16, 18 } }, -- Avenging Wrath + { spell = 35395, type = "ability", charges = true, requiresTarget = true }, -- Crusader Strike + { spell = 53600, type = "ability" }, -- Shield of the Righteous + { spell = 62124, type = "ability" }, -- Hand of Reckoning + { spell = 85222, type = "ability", overlayGlow = true }, -- Light of Dawn + { spell = 85673, type = "ability" }, -- Word of Glory + { spell = 105809, type = "ability", buff = true, talent = 14 }, -- Holy Avenger + { spell = 114158, type = "ability", talent = 3 }, -- Light's Hammer + { spell = 114165, type = "ability", talent = 6 }, -- Holy Prism + { spell = 115750, type = "ability", talent = 9 }, -- Blinding Light + { spell = 152262, type = "ability", buff = true, talent = 15 }, -- Seraphim + { spell = 183998, type = "ability" }, -- Light of the Martyr + { spell = 190784, type = "ability" }, -- Divine Steed + { spell = 200025, type = "ability", talent = 21 }, -- Beacon of Virtue + { spell = 214202, type = "ability", charges = true, buff = true, talent = 12 }, -- Rule of Law + { spell = 216331, type = "ability", buff = true, talent = 17 }, -- Avenging Crusader + { spell = 223306, type = "ability", talent = 2 }, -- Bestow Faith + { spell = 275773, type = "ability", debuff = true, requiresTarget = true }, -- Judgment + }, + icon = 135972, }, [4] = {}, [5] = {}, @@ -495,18 +492,17 @@ templates.class.PALADIN = { [10] = { title = L["PvP Talents"], args = { - { spell = 199507, type="buff", unit = "group", pvptalent = 9},-- Spreading the Word - { spell = 210294, type="ability", pvptalent = 8, titleSuffix = L["cooldown"]},-- Divine Favor - { spell = 210294, type="buff", unit = "player", pvptalent = 8, titleSuffix = L["buff"]},-- Divine Favor - { spell = 210391, type="buff", unit = "player", pvptalent = 5},-- Darkest before the Dawn - { spell = 216328, type="buff", unit = "target", pvptalent = 10},-- Light's Grace + { spell = 199507, type = "buff", unit = "group", pvptalent = 9 }, -- Spreading the Word + { spell = 210294, type = "ability", pvptalent = 8, titleSuffix = L["cooldown"] }, -- Divine Favor + { spell = 210294, type = "buff", unit = "player", pvptalent = 8, titleSuffix = L["buff"] }, -- Divine Favor + { spell = 210391, type = "buff", unit = "player", pvptalent = 5 }, -- Darkest before the Dawn + { spell = 216328, type = "buff", unit = "target", pvptalent = 10 }, -- Light's Grace }, icon = "Interface\\Icons\\Achievement_BG_winWSG", }, [11] = { title = L["Resources"], - args = { - }, + args = {}, icon = manaIcon, }, }, @@ -514,79 +510,79 @@ templates.class.PALADIN = { [1] = { title = L["Buffs"], args = { - { spell = 465, type = "buff", unit = "player"}, -- Devotion Aura - { spell = 642, type = "buff", unit = "player"}, -- Divine Shield - { spell = 1022, type = "buff", unit = "group"}, -- Blessing of Protection - { spell = 1044, type = "buff", unit = "group"}, -- Blessing of Freedom - { spell = 6940, type = "buff", unit = "group"}, -- Blessing of Sacrifice - { spell = 31850, type = "buff", unit = "player"}, -- Ardent Defender - { spell = 31884, type = "buff", unit = "player"}, -- Avenging Wrath - { spell = 32223, type = "buff", unit = "player"}, -- Crusader Aura - { spell = 86659, type = "buff", unit = "player"}, -- Guardian of Ancient Kings - { spell = 132403, type = "buff", unit = "player"}, -- Shield of the Righteous - { spell = 152262, type = "buff", unit = "player", talent = 15}, -- Seraphim - { spell = 182104, type = "buff", unit = "player"}, -- Shining Light - { spell = 188370, type = "buff", unit = "player"}, -- Consecration - { spell = 183435, type = "buff", unit = "player"}, -- Retribution Aura - { spell = 197561, type = "buff", unit = "player"}, -- Avenger's Valor - { spell = 204018, type = "buff", unit = "player", talent = 12}, -- Blessing of Spellwarding - { spell = 221883, type = "buff", unit = "player"}, -- Divine Steed - { spell = 280375, type = "buff", unit = "player", talent = 2}, -- Redoubt - { spell = 317920, type = "buff", unit = "player"}, -- Concentration Aura - { spell = 327225, type = "buff", unit = "player", talent = 4}, -- First Avenger - }, - icon = 236265 + { spell = 465, type = "buff", unit = "player" }, -- Devotion Aura + { spell = 642, type = "buff", unit = "player" }, -- Divine Shield + { spell = 1022, type = "buff", unit = "group" }, -- Blessing of Protection + { spell = 1044, type = "buff", unit = "group" }, -- Blessing of Freedom + { spell = 6940, type = "buff", unit = "group" }, -- Blessing of Sacrifice + { spell = 31850, type = "buff", unit = "player" }, -- Ardent Defender + { spell = 31884, type = "buff", unit = "player" }, -- Avenging Wrath + { spell = 32223, type = "buff", unit = "player" }, -- Crusader Aura + { spell = 86659, type = "buff", unit = "player" }, -- Guardian of Ancient Kings + { spell = 132403, type = "buff", unit = "player" }, -- Shield of the Righteous + { spell = 152262, type = "buff", unit = "player", talent = 15 }, -- Seraphim + { spell = 182104, type = "buff", unit = "player" }, -- Shining Light + { spell = 188370, type = "buff", unit = "player" }, -- Consecration + { spell = 183435, type = "buff", unit = "player" }, -- Retribution Aura + { spell = 197561, type = "buff", unit = "player" }, -- Avenger's Valor + { spell = 204018, type = "buff", unit = "player", talent = 12 }, -- Blessing of Spellwarding + { spell = 221883, type = "buff", unit = "player" }, -- Divine Steed + { spell = 280375, type = "buff", unit = "player", talent = 2 }, -- Redoubt + { spell = 317920, type = "buff", unit = "player" }, -- Concentration Aura + { spell = 327225, type = "buff", unit = "player", talent = 4 }, -- First Avenger + }, + icon = 236265, }, [2] = { title = L["Debuffs"], args = { - { spell = 853, type = "debuff", unit = "target"}, -- Hammer of Justice - { spell = 20066, type = "debuff", unit = "multi", talent = 8}, -- Repentance - { spell = 31935, type = "debuff", unit = "target"}, -- Avenger's Shield - { spell = 62124, type = "debuff", unit = "target"}, -- Hand of Reckoning - { spell = 105421, type = "debuff", unit = "target", talent = 9}, -- Blinding Light - { spell = 196941, type = "debuff", unit = "target", talent = 18}, -- Judgment of Light - { spell = 204079, type = "debuff", unit = "target", talent = 21}, -- Final Stand - { spell = 204242, type = "debuff", unit = "target"}, -- Consecration - { spell = 204301, type = "debuff", unit = "target", talent = 3}, -- Blessed Hammer + { spell = 853, type = "debuff", unit = "target" }, -- Hammer of Justice + { spell = 20066, type = "debuff", unit = "multi", talent = 8 }, -- Repentance + { spell = 31935, type = "debuff", unit = "target" }, -- Avenger's Shield + { spell = 62124, type = "debuff", unit = "target" }, -- Hand of Reckoning + { spell = 105421, type = "debuff", unit = "target", talent = 9 }, -- Blinding Light + { spell = 196941, type = "debuff", unit = "target", talent = 18 }, -- Judgment of Light + { spell = 204079, type = "debuff", unit = "target", talent = 21 }, -- Final Stand + { spell = 204242, type = "debuff", unit = "target" }, -- Consecration + { spell = 204301, type = "debuff", unit = "target", talent = 3 }, -- Blessed Hammer }, - icon = 135952 + icon = 135952, }, [3] = { title = L["Abilities"], args = { - { spell = 498, type = "ability"}, -- Ardent Defender - { spell = 633, type = "ability"}, -- Lay on Hands - { spell = 642, type = "ability", buff = true}, -- Divine Shield - { spell = 853, type = "ability", requiresTarget = true}, -- Hammer of Justice - { spell = 1022, type = "ability", buff = true}, -- Blessing of Protection - { spell = 1044, type = "ability", buff = true}, -- Blessing of Freedom - { spell = 6940, type = "ability", debuff = true, requiresTarget = true, unit="player"}, -- Blessing of Sacrifice - { spell = 10326, type = "ability"}, -- Turn Evil - { spell = 20066, type = "ability", requiresTarget = true, talent = 8}, -- Repentance - { spell = 20271, type = "ability"}, -- Judgment - { spell = 24275, type = "ability"}, -- Hammer of Wrath - { spell = 26573, type = "ability", buff = true}, -- Consecration - { spell = 31850, type = "ability", buff = true}, -- Ardent Defender - { spell = 31884, type = "ability", buff = true}, -- Avenging Wrath - { spell = 31935, type = "ability", requiresTarget = true, overlayGlow = true}, -- Avenger's Shield - { spell = 35395, type = "ability"}, -- Hammer of the Righteous - { spell = 53600, type = "ability", charges = true, buff = true}, -- Shield of the Righteous - { spell = 62124, type = "ability", debuff = true, requiresTarget = true}, -- Hand of Reckoning - { spell = 85673, type = "ability"}, -- Word of Glory - { spell = 86659, type = "ability", buff = true}, -- Guardian of Ancient Kings - { spell = 96231, type = "ability", requiresTarget = true}, -- Rebuke - { spell = 105809, type = "ability", talent = 14}, -- Holy Avenger - { spell = 115750, type = "ability", talent = 9}, -- Blinding Light - { spell = 152262, type = "ability", buff = true, talent = 15}, -- Seraphim - { spell = 190784, type = "ability"}, -- Divine Steed - { spell = 204018, type = "ability", talent = 12}, -- Blessing of Spellwarding - { spell = 204019, type = "ability", charges = true, debuff = true, talent = 3}, -- Blessed Hammer - { spell = 213644, type = "ability"}, -- Cleanse Toxins - { spell = 275779, type = "ability", debuff = true, requiresTarget = true}, -- Judgment - { spell = 327193, type = "ability", buff = true, talent = 6}, -- Moment of Glory - }, - icon = 135874 + { spell = 498, type = "ability" }, -- Ardent Defender + { spell = 633, type = "ability" }, -- Lay on Hands + { spell = 642, type = "ability", buff = true }, -- Divine Shield + { spell = 853, type = "ability", requiresTarget = true }, -- Hammer of Justice + { spell = 1022, type = "ability", buff = true }, -- Blessing of Protection + { spell = 1044, type = "ability", buff = true }, -- Blessing of Freedom + { spell = 6940, type = "ability", debuff = true, requiresTarget = true, unit = "player" }, -- Blessing of Sacrifice + { spell = 10326, type = "ability" }, -- Turn Evil + { spell = 20066, type = "ability", requiresTarget = true, talent = 8 }, -- Repentance + { spell = 20271, type = "ability" }, -- Judgment + { spell = 24275, type = "ability" }, -- Hammer of Wrath + { spell = 26573, type = "ability", buff = true }, -- Consecration + { spell = 31850, type = "ability", buff = true }, -- Ardent Defender + { spell = 31884, type = "ability", buff = true }, -- Avenging Wrath + { spell = 31935, type = "ability", requiresTarget = true, overlayGlow = true }, -- Avenger's Shield + { spell = 35395, type = "ability" }, -- Hammer of the Righteous + { spell = 53600, type = "ability", charges = true, buff = true }, -- Shield of the Righteous + { spell = 62124, type = "ability", debuff = true, requiresTarget = true }, -- Hand of Reckoning + { spell = 85673, type = "ability" }, -- Word of Glory + { spell = 86659, type = "ability", buff = true }, -- Guardian of Ancient Kings + { spell = 96231, type = "ability", requiresTarget = true }, -- Rebuke + { spell = 105809, type = "ability", talent = 14 }, -- Holy Avenger + { spell = 115750, type = "ability", talent = 9 }, -- Blinding Light + { spell = 152262, type = "ability", buff = true, talent = 15 }, -- Seraphim + { spell = 190784, type = "ability" }, -- Divine Steed + { spell = 204018, type = "ability", talent = 12 }, -- Blessing of Spellwarding + { spell = 204019, type = "ability", charges = true, debuff = true, talent = 3 }, -- Blessed Hammer + { spell = 213644, type = "ability" }, -- Cleanse Toxins + { spell = 275779, type = "ability", debuff = true, requiresTarget = true }, -- Judgment + { spell = 327193, type = "ability", buff = true, talent = 6 }, -- Moment of Glory + }, + icon = 135874, }, [4] = {}, [5] = {}, @@ -597,21 +593,20 @@ templates.class.PALADIN = { [10] = { title = L["PvP Talents"], args = { - { spell = 206891, type="debuff", unit = "target", pvptalent = 6, titleSuffix = L["buff"]},-- Inquisition - { spell = 207028, type="ability", pvptalent = 6, titleSuffix = L["cooldown"]},-- Inquisition - { spell = 215652, type="ability", pvptalent = 4, titleSuffix = L["cooldown"]},-- Shield of Virtue - { spell = 216857, type="buff", unit = "target", pvptalent = 1},-- Guarded by the Light - { spell = 217824, type="debuff", unit = "target", pvptalent = 4, titleSuffix = L["debuff"]},-- Shield of Virtue - { spell = 228049, type="ability", pvptalent = 12, titleSuffix = L["cooldown"]},-- Guardian of the Forgotten Queen - { spell = 228050, type="buff", unit = "group", pvptalent = 12, titleSuffix = L["buff"]},-- Guardian of the Forgotten Queen - { spell = 236186, type="ability", pvptalent = 7},-- Cleansing Light + { spell = 206891, type = "debuff", unit = "target", pvptalent = 6, titleSuffix = L["buff"] }, -- Inquisition + { spell = 207028, type = "ability", pvptalent = 6, titleSuffix = L["cooldown"] }, -- Inquisition + { spell = 215652, type = "ability", pvptalent = 4, titleSuffix = L["cooldown"] }, -- Shield of Virtue + { spell = 216857, type = "buff", unit = "target", pvptalent = 1 }, -- Guarded by the Light + { spell = 217824, type = "debuff", unit = "target", pvptalent = 4, titleSuffix = L["debuff"] }, -- Shield of Virtue + { spell = 228049, type = "ability", pvptalent = 12, titleSuffix = L["cooldown"] }, -- Guardian of the Forgotten Queen + { spell = 228050, type = "buff", unit = "group", pvptalent = 12, titleSuffix = L["buff"] }, -- Guardian of the Forgotten Queen + { spell = 236186, type = "ability", pvptalent = 7 }, -- Cleansing Light }, icon = "Interface\\Icons\\Achievement_BG_winWSG", }, [11] = { title = L["Resources"], - args = { - }, + args = {}, icon = manaIcon, }, }, @@ -619,80 +614,80 @@ templates.class.PALADIN = { [1] = { title = L["Buffs"], args = { - { spell = 465, type = "buff", unit = "player"}, -- Devotion Aura - { spell = 642, type = "buff", unit = "player"}, -- Divine Shield - { spell = 1022, type = "buff", unit = "group"}, -- Blessing of Protection - { spell = 1044, type = "buff", unit = "group"}, -- Blessing of Freedom - { spell = 31884, type = "buff", unit = "player"}, -- Avenging Wrath - { spell = 32223, type = "buff", unit = "player"}, -- Crusader Aura - { spell = 114250, type = "buff", unit = "player", talent = 16}, -- Selfless Healer - { spell = 183435, type = "buff", unit = "player"}, -- Retribution Aura - { spell = 184662, type = "buff", unit = "player"}, -- Shield of Vengeance - { spell = 205191, type = "buff", unit = "player", talent = 12}, -- Eye for an Eye - { spell = 209785, type = "buff", unit = "player", talent = 4}, -- Fires of Justice - { spell = 221883, type = "buff", unit = "player"}, -- Divine Steed - { spell = 223819, type = "buff", unit = "player", talent = 13}, -- Divine Purpose - { spell = 267611, type = "buff", unit = "player", talent = 2}, -- Righteous Verdict - { spell = 269571, type = "buff", unit = "player", talent = 1}, -- Zeal - { spell = 281178, type = "buff", unit = "player", talent = 5}, -- Blade of Wrath - { spell = 317920, type = "buff", unit = "player"}, -- Concentration Aura - { spell = 326733, type = "buff", unit = "player", talent = 6}, -- Empyrean Power - }, - icon = 135993 + { spell = 465, type = "buff", unit = "player" }, -- Devotion Aura + { spell = 642, type = "buff", unit = "player" }, -- Divine Shield + { spell = 1022, type = "buff", unit = "group" }, -- Blessing of Protection + { spell = 1044, type = "buff", unit = "group" }, -- Blessing of Freedom + { spell = 31884, type = "buff", unit = "player" }, -- Avenging Wrath + { spell = 32223, type = "buff", unit = "player" }, -- Crusader Aura + { spell = 114250, type = "buff", unit = "player", talent = 16 }, -- Selfless Healer + { spell = 183435, type = "buff", unit = "player" }, -- Retribution Aura + { spell = 184662, type = "buff", unit = "player" }, -- Shield of Vengeance + { spell = 205191, type = "buff", unit = "player", talent = 12 }, -- Eye for an Eye + { spell = 209785, type = "buff", unit = "player", talent = 4 }, -- Fires of Justice + { spell = 221883, type = "buff", unit = "player" }, -- Divine Steed + { spell = 223819, type = "buff", unit = "player", talent = 13 }, -- Divine Purpose + { spell = 267611, type = "buff", unit = "player", talent = 2 }, -- Righteous Verdict + { spell = 269571, type = "buff", unit = "player", talent = 1 }, -- Zeal + { spell = 281178, type = "buff", unit = "player", talent = 5 }, -- Blade of Wrath + { spell = 317920, type = "buff", unit = "player" }, -- Concentration Aura + { spell = 326733, type = "buff", unit = "player", talent = 6 }, -- Empyrean Power + }, + icon = 135993, }, [2] = { title = L["Debuffs"], args = { - { spell = 853, type = "debuff", unit = "target"}, -- Hammer of Justice - { spell = 20066, type = "debuff", unit = "multi", talent = 8}, -- Repentance - { spell = 62124, type = "debuff", unit = "target"}, -- Hand of Reckoning - { spell = 105421, type = "debuff", unit = "target"}, -- Blinding Light - { spell = 183218, type = "debuff", unit = "target"}, -- Hand of Hindrance - { spell = 197277, type = "debuff", unit = "target"}, -- Judgment - { spell = 255937, type = "debuff", unit = "target"}, -- Wake of Ashes - { spell = 343527, type = "debuff", unit = "target", talent = 3}, -- Execution Sentence - { spell = 343724, type = "debuff", unit = "target", talent = 21}, -- Reckoning + { spell = 853, type = "debuff", unit = "target" }, -- Hammer of Justice + { spell = 20066, type = "debuff", unit = "multi", talent = 8 }, -- Repentance + { spell = 62124, type = "debuff", unit = "target" }, -- Hand of Reckoning + { spell = 105421, type = "debuff", unit = "target" }, -- Blinding Light + { spell = 183218, type = "debuff", unit = "target" }, -- Hand of Hindrance + { spell = 197277, type = "debuff", unit = "target" }, -- Judgment + { spell = 255937, type = "debuff", unit = "target" }, -- Wake of Ashes + { spell = 343527, type = "debuff", unit = "target", talent = 3 }, -- Execution Sentence + { spell = 343724, type = "debuff", unit = "target", talent = 21 }, -- Reckoning }, - icon = 135952 + icon = 135952, }, [3] = { title = L["Abilities"], args = { - { spell = 633, type = "ability"}, -- Lay on Hands - { spell = 642, type = "ability", buff = true}, -- Divine Shield - { spell = 853, type = "ability", requiresTarget = true}, -- Hammer of Justice - { spell = 1022, type = "ability", buff = true}, -- Blessing of Protection - { spell = 1044, type = "ability", buff = true}, -- Blessing of Freedom - { spell = 6940, type = "ability", buff = true}, -- Blessing of Sacrifice - { spell = 10326, type = "ability"}, -- Turn Evil - { spell = 20066, type = "ability", requiresTarget = true, talent = 8}, -- Repentance - { spell = 20271, type = "ability", debuff = true, requiresTarget = true}, -- Judgment - { spell = 24275, type = "ability"}, -- Hammer of Wrath - { spell = 26573, type = "ability"}, -- Consecration - { spell = 31884, type = "ability", buff = true}, -- Avenging Wrath - { spell = 35395, type = "ability", charges = true, requiresTarget = true}, -- Crusader Strike - { spell = 53600, type = "ability", buff = true, requiresTarget = true}, -- Shield of the Righteous - { spell = 53385, type = "ability"}, -- Divine Storm - { spell = 62124, type = "ability", debuff = true, requiresTarget = true}, -- Hand of Reckoning - { spell = 85256, type = "ability"}, -- Templar's Verdict - { spell = 85673, type = "ability"}, -- Word of Glory - { spell = 96231, type = "ability", requiresTarget = true}, -- Rebuke - { spell = 105809, type = "ability", talent = 14}, -- Holy Avenger - { spell = 115750, type = "ability", talent = 9}, -- Blinding Light - { spell = 152262, type = "ability", talent = 15, buff = true}, -- Seraphim - { spell = 183218, type = "ability", debuff = true, requiresTarget = true}, -- Hand of Hindrance - { spell = 184575, type = "ability", requiresTarget = true, overlayGlow = true}, -- Blade of Justice - { spell = 184662, type = "ability", buff = true}, -- Shield of Vengeance - { spell = 190784, type = "ability"}, -- Divine Steed - { spell = 205191, type = "ability", buff = true, talent = 12}, -- Eye for an Eye - { spell = 205228, type = "ability", totem = true}, -- Consecration - { spell = 213644, type = "ability"}, -- Cleanse Toxins - { spell = 215661, type = "ability", requiresTarget = true, talent = 17}, -- Justiciar's Vengeance - { spell = 231895, type = "ability", buff = true, talent = 20}, -- Crusade - { spell = 255937, type = "ability", debuff = true, requiresTarget = true}, -- Wake of Ashes - { spell = 343527, type = "ability", debuff = true, requiresTarget = true, talent = 3}, -- Execution Sentence - }, - icon = 135891 + { spell = 633, type = "ability" }, -- Lay on Hands + { spell = 642, type = "ability", buff = true }, -- Divine Shield + { spell = 853, type = "ability", requiresTarget = true }, -- Hammer of Justice + { spell = 1022, type = "ability", buff = true }, -- Blessing of Protection + { spell = 1044, type = "ability", buff = true }, -- Blessing of Freedom + { spell = 6940, type = "ability", buff = true }, -- Blessing of Sacrifice + { spell = 10326, type = "ability" }, -- Turn Evil + { spell = 20066, type = "ability", requiresTarget = true, talent = 8 }, -- Repentance + { spell = 20271, type = "ability", debuff = true, requiresTarget = true }, -- Judgment + { spell = 24275, type = "ability" }, -- Hammer of Wrath + { spell = 26573, type = "ability" }, -- Consecration + { spell = 31884, type = "ability", buff = true }, -- Avenging Wrath + { spell = 35395, type = "ability", charges = true, requiresTarget = true }, -- Crusader Strike + { spell = 53600, type = "ability", buff = true, requiresTarget = true }, -- Shield of the Righteous + { spell = 53385, type = "ability" }, -- Divine Storm + { spell = 62124, type = "ability", debuff = true, requiresTarget = true }, -- Hand of Reckoning + { spell = 85256, type = "ability" }, -- Templar's Verdict + { spell = 85673, type = "ability" }, -- Word of Glory + { spell = 96231, type = "ability", requiresTarget = true }, -- Rebuke + { spell = 105809, type = "ability", talent = 14 }, -- Holy Avenger + { spell = 115750, type = "ability", talent = 9 }, -- Blinding Light + { spell = 152262, type = "ability", talent = 15, buff = true }, -- Seraphim + { spell = 183218, type = "ability", debuff = true, requiresTarget = true }, -- Hand of Hindrance + { spell = 184575, type = "ability", requiresTarget = true, overlayGlow = true }, -- Blade of Justice + { spell = 184662, type = "ability", buff = true }, -- Shield of Vengeance + { spell = 190784, type = "ability" }, -- Divine Steed + { spell = 205191, type = "ability", buff = true, talent = 12 }, -- Eye for an Eye + { spell = 205228, type = "ability", totem = true }, -- Consecration + { spell = 213644, type = "ability" }, -- Cleanse Toxins + { spell = 215661, type = "ability", requiresTarget = true, talent = 17 }, -- Justiciar's Vengeance + { spell = 231895, type = "ability", buff = true, talent = 20 }, -- Crusade + { spell = 255937, type = "ability", debuff = true, requiresTarget = true }, -- Wake of Ashes + { spell = 343527, type = "ability", debuff = true, requiresTarget = true, talent = 3 }, -- Execution Sentence + }, + icon = 135891, }, [4] = {}, [5] = {}, @@ -703,19 +698,18 @@ templates.class.PALADIN = { [10] = { title = L["PvP Talents"], args = { - { spell = 210256, type="ability", pvptalent = 5, titleSuffix = L["cooldown"]},-- Blessing of Sanctuary - { spell = 210256, type="buff", unit = "target", pvptalent = 5, titleSuffix = L["buff"]},-- Blessing of Sanctuary - { spell = 210323, type="buff", unit = "target", pvptalent = 4},-- Vengeance Aura - { spell = 236186, type="ability", pvptalent = 2},-- Cleansing Light - { spell = 246807, type="buff", unit = "target", pvptalent = 10},-- Lawbringer - { spell = 287947, type="buff", unit = "player", pvptalent = 11},-- Ultimate Retribution + { spell = 210256, type = "ability", pvptalent = 5, titleSuffix = L["cooldown"] }, -- Blessing of Sanctuary + { spell = 210256, type = "buff", unit = "target", pvptalent = 5, titleSuffix = L["buff"] }, -- Blessing of Sanctuary + { spell = 210323, type = "buff", unit = "target", pvptalent = 4 }, -- Vengeance Aura + { spell = 236186, type = "ability", pvptalent = 2 }, -- Cleansing Light + { spell = 246807, type = "buff", unit = "target", pvptalent = 10 }, -- Lawbringer + { spell = 287947, type = "buff", unit = "player", pvptalent = 11 }, -- Ultimate Retribution }, icon = "Interface\\Icons\\Achievement_BG_winWSG", }, [11] = { title = L["Resources"], - args = { - }, + args = {}, icon = "Interface\\Icons\\achievement_bg_winsoa", }, }, @@ -726,90 +720,90 @@ templates.class.HUNTER = { [1] = { title = L["Buffs"], args = { - { spell = 136, type = "buff", unit = "pet"}, -- Mend Pet - { spell = 5384, type = "buff", unit = "player"}, -- Feign Death - { spell = 6197, type = "buff", unit = "player"}, -- Eagle Eye - { spell = 19574, type = "buff", unit = "player"}, -- Bestial Wrath - { spell = 24450, type = "buff", unit = "pet"}, -- Prowl - { spell = 35079, type = "buff", unit = "player"}, -- Misdirection - { spell = 118922, type = "buff", unit = "player", talent = 14}, -- Posthaste - { spell = 186258, type = "buff", unit = "player"}, -- Aspect of the Cheetah - { spell = 186265, type = "buff", unit = "player"}, -- Aspect of the Turtle - { spell = 193530, type = "buff", unit = "player"}, -- Aspect of the Wild - { spell = 199483, type = "buff", unit = "player"}, -- Camouflage - { spell = 231390, type = "buff", unit = "player", talent = 7}, -- Trailblazer - { spell = 217200, type = "buff", unit = "player"}, -- Barbed Shot - { spell = 257946, type = "buff", unit = "player", talent = 11}, -- Thrill of the Hunt - { spell = 264663, type = "buff", unit = "player"}, -- Predator's Thirst - { spell = 264667, type = "buff", unit = "player"}, -- Primal Rage - { spell = 268877, type = "buff", unit = "player"}, -- Beast Cleave - { spell = 272790, type = "buff", unit = "pet"}, -- Frenzy - { spell = 281036, type = "buff", unit = "player", talent = 3}, -- Dire Beast - }, - icon = 132242 + { spell = 136, type = "buff", unit = "pet" }, -- Mend Pet + { spell = 5384, type = "buff", unit = "player" }, -- Feign Death + { spell = 6197, type = "buff", unit = "player" }, -- Eagle Eye + { spell = 19574, type = "buff", unit = "player" }, -- Bestial Wrath + { spell = 24450, type = "buff", unit = "pet" }, -- Prowl + { spell = 35079, type = "buff", unit = "player" }, -- Misdirection + { spell = 118922, type = "buff", unit = "player", talent = 14 }, -- Posthaste + { spell = 186258, type = "buff", unit = "player" }, -- Aspect of the Cheetah + { spell = 186265, type = "buff", unit = "player" }, -- Aspect of the Turtle + { spell = 193530, type = "buff", unit = "player" }, -- Aspect of the Wild + { spell = 199483, type = "buff", unit = "player" }, -- Camouflage + { spell = 231390, type = "buff", unit = "player", talent = 7 }, -- Trailblazer + { spell = 217200, type = "buff", unit = "player" }, -- Barbed Shot + { spell = 257946, type = "buff", unit = "player", talent = 11 }, -- Thrill of the Hunt + { spell = 264663, type = "buff", unit = "player" }, -- Predator's Thirst + { spell = 264667, type = "buff", unit = "player" }, -- Primal Rage + { spell = 268877, type = "buff", unit = "player" }, -- Beast Cleave + { spell = 272790, type = "buff", unit = "pet" }, -- Frenzy + { spell = 281036, type = "buff", unit = "player", talent = 3 }, -- Dire Beast + }, + icon = 132242, }, [2] = { title = L["Debuffs"], args = { - { spell = 2649, type = "debuff", unit = "target"}, -- Growl - { spell = 3355, type = "debuff", unit = "multi"}, -- Freezing Trap - { spell = 5116, type = "debuff", unit = "target"}, -- Concussive Shot - { spell = 24394, type = "debuff", unit = "target"}, -- Intimidation - { spell = 117405, type = "debuff", unit = "target", talent = 15}, -- Binding Shot - { spell = 131894, type = "debuff", unit = "target"}, -- A Murder of Crows - { spell = 135299, type = "debuff", unit = "target"}, -- Tar Trap - { spell = 217200, type = "debuff", unit = "target"}, -- Barbed Shot - { spell = 257284, type = "debuff", unit = "target"}, -- Hunter's Mark + { spell = 2649, type = "debuff", unit = "target" }, -- Growl + { spell = 3355, type = "debuff", unit = "multi" }, -- Freezing Trap + { spell = 5116, type = "debuff", unit = "target" }, -- Concussive Shot + { spell = 24394, type = "debuff", unit = "target" }, -- Intimidation + { spell = 117405, type = "debuff", unit = "target", talent = 15 }, -- Binding Shot + { spell = 131894, type = "debuff", unit = "target" }, -- A Murder of Crows + { spell = 135299, type = "debuff", unit = "target" }, -- Tar Trap + { spell = 217200, type = "debuff", unit = "target" }, -- Barbed Shot + { spell = 257284, type = "debuff", unit = "target" }, -- Hunter's Mark }, - icon = 135860 + icon = 135860, }, [3] = { title = L["Abilities"], args = { - { spell = 781, type = "ability"}, -- Disengage - { spell = 1513, type = "ability"}, -- Scare Beast - { spell = 1543, type = "ability"}, -- Flare - { spell = 2643, type = "ability", requiresTarget = true}, -- Multi-Shot - { spell = 2649, type = "ability", requiresTarget = true, debuff = true}, -- Growl - { spell = 5116, type = "ability", requiresTarget = true}, -- Concussive Shot - { spell = 5384, type = "ability", buff = true}, -- Feign Death - { spell = 6197, type = "ability", buff = true}, -- Eagle Eye - { spell = 16827, type = "ability", requiresTarget = true}, -- Claw - { spell = 19574, type = "ability", buff = true}, -- Bestial Wrath - { spell = 19577, type = "ability", requiresTarget = true, debuff = true}, -- Intimidation - { spell = 19801, type = "ability", requiresTarget = true}, -- Tranquilizing Shot - { spell = 24450, type = "ability"}, -- Prowl - { spell = 34026, type = "ability", requiresTarget = true}, -- Kill Command - { spell = 34477, type = "ability", requiresTarget = true}, -- Misdirection - { spell = 53209, type = "ability", requiresTarget = true, talent = 6}, -- Chimaera Shot - { spell = 53351, type = "ability", requiresTarget = true}, -- Kill Shot - { spell = 56641, type = "ability", requiresTarget = true}, -- Cobra Shot - { spell = 58875, type = "ability", unit = "pet", buff = true}, -- Spirit Walk - { spell = 90361, type = "ability", unit = "pet", buff = true}, -- Spirit Mend - { spell = 109248, type = "ability", requiresTarget = true, talent = 15}, -- Binding Shot - { spell = 109304, type = "ability"}, -- Exhilaration - { spell = 120360, type = "ability", talent = 17}, -- Barrage - { spell = 120679, type = "ability", requiresTarget = true, buff = true, talent = 3}, -- Dire Beast - { spell = 131894, type = "ability", requiresTarget = true, talent = 12}, -- A Murder of Crows - { spell = 147362, type = "ability", requiresTarget = true}, -- Counter Shot - { spell = 185358, type = "ability"}, -- Arcane Shot - { spell = 186257, type = "ability", buff = true}, -- Aspect of the Cheetah - { spell = 186265, type = "ability", buff = true}, -- Aspect of the Turtle - { spell = 187650, type = "ability"}, -- Freezing Trap - { spell = 187698, type = "ability"}, -- Tar Trap - { spell = 193530, type = "ability", buff = true}, -- Aspect of the Wild - { spell = 195645, type = "ability", debuff = true}, -- Concussive Shot - { spell = 199483, type = "ability", talent = 9}, -- Camouflage - { spell = 201430, type = "ability", talent = 18}, -- Stampede - { spell = 217200, type = "ability", charges = true, requiresTarget = true, overlayGlow = true}, -- Barbed Shot - { spell = 272651, type = "ability"}, -- Command Pet Ability - { spell = 257284, type = "ability", debuff = true, requiresTarget = true}, -- Hunter's Mark - { spell = 264667, type = "ability", buff = true}, -- Primal Rage - { spell = 264735, type = "ability", unit = "pet", buff = true}, -- Survival of the Fittest - { spell = 321297, type = "ability", buff = true}, -- Eyes of the Beast - { spell = 321530, type = "ability", debuff = true}, -- Bloodshedew - }, - icon = 135130 + { spell = 781, type = "ability" }, -- Disengage + { spell = 1513, type = "ability" }, -- Scare Beast + { spell = 1543, type = "ability" }, -- Flare + { spell = 2643, type = "ability", requiresTarget = true }, -- Multi-Shot + { spell = 2649, type = "ability", requiresTarget = true, debuff = true }, -- Growl + { spell = 5116, type = "ability", requiresTarget = true }, -- Concussive Shot + { spell = 5384, type = "ability", buff = true }, -- Feign Death + { spell = 6197, type = "ability", buff = true }, -- Eagle Eye + { spell = 16827, type = "ability", requiresTarget = true }, -- Claw + { spell = 19574, type = "ability", buff = true }, -- Bestial Wrath + { spell = 19577, type = "ability", requiresTarget = true, debuff = true }, -- Intimidation + { spell = 19801, type = "ability", requiresTarget = true }, -- Tranquilizing Shot + { spell = 24450, type = "ability" }, -- Prowl + { spell = 34026, type = "ability", requiresTarget = true }, -- Kill Command + { spell = 34477, type = "ability", requiresTarget = true }, -- Misdirection + { spell = 53209, type = "ability", requiresTarget = true, talent = 6 }, -- Chimaera Shot + { spell = 53351, type = "ability", requiresTarget = true }, -- Kill Shot + { spell = 56641, type = "ability", requiresTarget = true }, -- Cobra Shot + { spell = 58875, type = "ability", unit = "pet", buff = true }, -- Spirit Walk + { spell = 90361, type = "ability", unit = "pet", buff = true }, -- Spirit Mend + { spell = 109248, type = "ability", requiresTarget = true, talent = 15 }, -- Binding Shot + { spell = 109304, type = "ability" }, -- Exhilaration + { spell = 120360, type = "ability", talent = 17 }, -- Barrage + { spell = 120679, type = "ability", requiresTarget = true, buff = true, talent = 3 }, -- Dire Beast + { spell = 131894, type = "ability", requiresTarget = true, talent = 12 }, -- A Murder of Crows + { spell = 147362, type = "ability", requiresTarget = true }, -- Counter Shot + { spell = 185358, type = "ability" }, -- Arcane Shot + { spell = 186257, type = "ability", buff = true }, -- Aspect of the Cheetah + { spell = 186265, type = "ability", buff = true }, -- Aspect of the Turtle + { spell = 187650, type = "ability" }, -- Freezing Trap + { spell = 187698, type = "ability" }, -- Tar Trap + { spell = 193530, type = "ability", buff = true }, -- Aspect of the Wild + { spell = 195645, type = "ability", debuff = true }, -- Concussive Shot + { spell = 199483, type = "ability", talent = 9 }, -- Camouflage + { spell = 201430, type = "ability", talent = 18 }, -- Stampede + { spell = 217200, type = "ability", charges = true, requiresTarget = true, overlayGlow = true }, -- Barbed Shot + { spell = 272651, type = "ability" }, -- Command Pet Ability + { spell = 257284, type = "ability", debuff = true, requiresTarget = true }, -- Hunter's Mark + { spell = 264667, type = "ability", buff = true }, -- Primal Rage + { spell = 264735, type = "ability", unit = "pet", buff = true }, -- Survival of the Fittest + { spell = 321297, type = "ability", buff = true }, -- Eyes of the Beast + { spell = 321530, type = "ability", debuff = true }, -- Bloodshedew + }, + icon = 135130, }, [4] = {}, [5] = {}, @@ -820,27 +814,26 @@ templates.class.HUNTER = { [10] = { title = L["PvP Talents"], args = { - { spell = 53480, type="ability", pvptalent = 7, titleSuffix = L["cooldown"]},-- Roar of Sacrifice - { spell = 53480, type="buff", unit = "group", pvptalent = 7, titleSuffix = L["buff"]},-- Roar of Sacrifice - { spell = 202797, type="ability", pvptalent = 4, titleSuffix = L["cooldown"]},-- Viper Sting - { spell = 202797, type="debuff", unit = "target", pvptalent = 4, titleSuffix = L["debuff"]},-- Viper Sting - { spell = 202900, type="ability", pvptalent = 6, titleSuffix = L["cooldown"]},-- Scorpid Sting - { spell = 202900, type="debuff", unit = "target", pvptalent = 6, titleSuffix = L["debuff"]},-- Scorpid Sting - { spell = 202914, type="ability", pvptalent = 5, titleSuffix = L["cooldown"]},-- Spider Sting - { spell = 202914, type="debuff", unit = "target", pvptalent = 5, titleSuffix = L["debuff"]},-- Spider Sting - { spell = 204205, type="buff", unit = "player", pvptalent = 10},-- Wild Protector - { spell = 205691, type="ability", pvptalent = 8},-- Dire Beast: Basilisk - { spell = 208652, type="ability", pvptalent = 1},-- Dire Beast: Hawk - { spell = 236776, type="ability", pvptalent = 11},-- Hi-Explosive Trap - { spell = 248518, type="ability", pvptalent = 13, titleSuffix = L["cooldown"]},-- Interlope - { spell = 248519, type="buff", unit = "group", pvptalent = 13, titleSuffix = L["buff"]},-- Interlope + { spell = 53480, type = "ability", pvptalent = 7, titleSuffix = L["cooldown"] }, -- Roar of Sacrifice + { spell = 53480, type = "buff", unit = "group", pvptalent = 7, titleSuffix = L["buff"] }, -- Roar of Sacrifice + { spell = 202797, type = "ability", pvptalent = 4, titleSuffix = L["cooldown"] }, -- Viper Sting + { spell = 202797, type = "debuff", unit = "target", pvptalent = 4, titleSuffix = L["debuff"] }, -- Viper Sting + { spell = 202900, type = "ability", pvptalent = 6, titleSuffix = L["cooldown"] }, -- Scorpid Sting + { spell = 202900, type = "debuff", unit = "target", pvptalent = 6, titleSuffix = L["debuff"] }, -- Scorpid Sting + { spell = 202914, type = "ability", pvptalent = 5, titleSuffix = L["cooldown"] }, -- Spider Sting + { spell = 202914, type = "debuff", unit = "target", pvptalent = 5, titleSuffix = L["debuff"] }, -- Spider Sting + { spell = 204205, type = "buff", unit = "player", pvptalent = 10 }, -- Wild Protector + { spell = 205691, type = "ability", pvptalent = 8 }, -- Dire Beast: Basilisk + { spell = 208652, type = "ability", pvptalent = 1 }, -- Dire Beast: Hawk + { spell = 236776, type = "ability", pvptalent = 11 }, -- Hi-Explosive Trap + { spell = 248518, type = "ability", pvptalent = 13, titleSuffix = L["cooldown"] }, -- Interlope + { spell = 248519, type = "buff", unit = "group", pvptalent = 13, titleSuffix = L["buff"] }, -- Interlope }, icon = "Interface\\Icons\\Achievement_BG_winWSG", }, [11] = { title = L["Resources"], - args = { - }, + args = {}, icon = "Interface\\Icons\\ability_hunter_focusfire", }, }, @@ -848,89 +841,89 @@ templates.class.HUNTER = { [1] = { title = L["Buffs"], args = { - { spell = 136, type = "buff", unit = "pet"}, -- Mend Pet - { spell = 5384, type = "buff", unit = "player"}, -- Feign Death - { spell = 6197, type = "buff", unit = "player"}, -- Eagle Eye - { spell = 24450, type = "buff", unit = "pet"}, -- Prowl - { spell = 35079, type = "buff", unit = "player"}, -- Misdirection - { spell = 118922, type = "buff", unit = "player", talent = 14}, -- Posthaste - { spell = 164273, type = "buff", unit = "player"}, -- Lone Wolf - { spell = 186258, type = "buff", unit = "player"}, -- Aspect of the Cheetah - { spell = 186265, type = "buff", unit = "player"}, -- Aspect of the Turtle - { spell = 193534, type = "buff", unit = "player", talent = 10}, -- Steady Focus - { spell = 194594, type = "buff", unit = "player", talent = 20}, -- Lock and Load - { spell = 199483, type = "buff", unit = "player", talent = 9}, -- Camouflage - { spell = 231390, type = "buff", unit = "player", talent = 7}, -- Trailblazer - { spell = 257044, type = "buff", unit = "player"}, -- Rapid Fire - { spell = 257622, type = "buff", unit = "player"}, -- Trick Shots - { spell = 260242, type = "buff", unit = "player"}, -- Precise Shots - { spell = 260395, type = "buff", unit = "player", talent = 16}, -- Lethal Shots - { spell = 260402, type = "buff", unit = "player", talent = 18}, -- Double Tap - { spell = 264663, type = "buff", unit = "player"}, -- Predator's Thirst - { spell = 264667, type = "buff", unit = "player"}, -- Primal Rage - { spell = 264735, type = "ability", unit = "pet", buff = true}, -- Survival of the Fittest - { spell = 288613, type = "buff", unit = "player"}, -- Trueshot - { spell = 321461, type = "buff", unit = "player", talent = 17}, -- Dead Eye - }, - icon = 461846 + { spell = 136, type = "buff", unit = "pet" }, -- Mend Pet + { spell = 5384, type = "buff", unit = "player" }, -- Feign Death + { spell = 6197, type = "buff", unit = "player" }, -- Eagle Eye + { spell = 24450, type = "buff", unit = "pet" }, -- Prowl + { spell = 35079, type = "buff", unit = "player" }, -- Misdirection + { spell = 118922, type = "buff", unit = "player", talent = 14 }, -- Posthaste + { spell = 164273, type = "buff", unit = "player" }, -- Lone Wolf + { spell = 186258, type = "buff", unit = "player" }, -- Aspect of the Cheetah + { spell = 186265, type = "buff", unit = "player" }, -- Aspect of the Turtle + { spell = 193534, type = "buff", unit = "player", talent = 10 }, -- Steady Focus + { spell = 194594, type = "buff", unit = "player", talent = 20 }, -- Lock and Load + { spell = 199483, type = "buff", unit = "player", talent = 9 }, -- Camouflage + { spell = 231390, type = "buff", unit = "player", talent = 7 }, -- Trailblazer + { spell = 257044, type = "buff", unit = "player" }, -- Rapid Fire + { spell = 257622, type = "buff", unit = "player" }, -- Trick Shots + { spell = 260242, type = "buff", unit = "player" }, -- Precise Shots + { spell = 260395, type = "buff", unit = "player", talent = 16 }, -- Lethal Shots + { spell = 260402, type = "buff", unit = "player", talent = 18 }, -- Double Tap + { spell = 264663, type = "buff", unit = "player" }, -- Predator's Thirst + { spell = 264667, type = "buff", unit = "player" }, -- Primal Rage + { spell = 264735, type = "ability", unit = "pet", buff = true }, -- Survival of the Fittest + { spell = 288613, type = "buff", unit = "player" }, -- Trueshot + { spell = 321461, type = "buff", unit = "player", talent = 17 }, -- Dead Eye + }, + icon = 461846, }, [2] = { title = L["Debuffs"], args = { - { spell = 3355, type = "debuff", unit = "multi"}, -- Freezing Trap - { spell = 5116, type = "debuff", unit = "target"}, -- Concussive Shot - { spell = 131894, type = "debuff", unit = "target", talent = 3}, -- A Murder of Crows - { spell = 135299, type = "debuff", unit = "target"}, -- Tar Trap - { spell = 186387, type = "debuff", unit = "target"}, -- Bursting Shot - { spell = 257284, type = "debuff", unit = "target", talent = 12}, -- Hunter's Mark - { spell = 269576, type = "debuff", unit = "target", talent = 1}, -- Master Marksman - { spell = 271788, type = "debuff", unit = "target", talent = 2}, -- Serpent Sting - { spell = 321469, type = "debuff", unit = "target", talent = 15}, -- Binding Shackles + { spell = 3355, type = "debuff", unit = "multi" }, -- Freezing Trap + { spell = 5116, type = "debuff", unit = "target" }, -- Concussive Shot + { spell = 131894, type = "debuff", unit = "target", talent = 3 }, -- A Murder of Crows + { spell = 135299, type = "debuff", unit = "target" }, -- Tar Trap + { spell = 186387, type = "debuff", unit = "target" }, -- Bursting Shot + { spell = 257284, type = "debuff", unit = "target", talent = 12 }, -- Hunter's Mark + { spell = 269576, type = "debuff", unit = "target", talent = 1 }, -- Master Marksman + { spell = 271788, type = "debuff", unit = "target", talent = 2 }, -- Serpent Sting + { spell = 321469, type = "debuff", unit = "target", talent = 15 }, -- Binding Shackles }, - icon = 236188 + icon = 236188, }, [3] = { title = L["Abilities"], args = { - { spell = 781, type = "ability"}, -- Disengage - { spell = 1513, type = "ability", debuff = true}, -- Scare Beast - { spell = 1543, type = "ability"}, -- Flare - { spell = 5116, type = "ability", requiresTarget = true}, -- Concussive Shot - { spell = 5384, type = "ability", buff = true}, -- Feign Death - { spell = 6197, type = "ability", buff = true}, -- Eagle Eye - { spell = 19434, type = "ability", requiresTarget = true, charges = true, overlayGlow = true}, -- Aimed Shot - { spell = 19801, type = "ability", requiresTarget = true}, -- Tranquilizing Shot - { spell = 34477, type = "ability", requiresTarget = true}, -- Misdirection - { spell = 53351, type = "ability", requiresTarget = true}, -- Kill Shot - { spell = 56641, type = "ability", requiresTarget = true}, -- Steady Shot - { spell = 109248, type = "ability", requiresTarget = true}, -- Binding Shot - { spell = 109304, type = "ability"}, -- Exhilaration - { spell = 120360, type = "ability", talent = 5}, -- Barrage - { spell = 131894, type = "ability", talent = 3}, -- A Murder of Crows - { spell = 147362, type = "ability", requiresTarget = true}, -- Counter Shot - { spell = 185358, type = "ability", requiresTarget = true, overlayGlow = true}, -- Arcane Shot - { spell = 186257, type = "ability", buff = true}, -- Aspect of the Cheetah - { spell = 186265, type = "ability", buff = true}, -- Aspect of the Turtle - { spell = 186387, type = "ability", debuff = true}, -- Bursting Shot - { spell = 187650, type = "ability"}, -- Freezing Trap - { spell = 187698, type = "ability"}, -- Tar Trap - { spell = 195645, type = "ability", debuff = true}, -- Concussive Shot - { spell = 199483, type = "ability", talent = 9}, -- Camouflage - { spell = 212431, type = "ability", talent = 6}, -- Explosive Shot - { spell = 257044, type = "ability", requiresTarget = true, overlayGlow = true}, -- Rapid Fire - { spell = 257284, type = "ability", requiresTarget = true}, -- Hunter's Mark - { spell = 257620, type = "ability", requiresTarget = true}, -- Multi-Shot - { spell = 260243, type = "ability", talent = 21}, -- Volley - { spell = 260402, type = "ability", buff = true, talent = 18}, -- Double Tap - { spell = 264667, type = "ability", buff = true}, -- Primal Rage - { spell = 264735, type = "ability", unit = "pet", buff = true}, -- Survival of the Fittest - { spell = 271788, type = "ability", debuff = true, talent = 2}, -- Serpent Sting - { spell = 272651, type = "ability"}, -- Command Pet Ability - { spell = 288613, type = "ability", buff = true}, -- Trueshot - { spell = 321297, type = "ability"}, -- Eyes of the Beast - { spell = 342049, type = "ability", talent = 12}, -- Chimaera Shot - }, - icon = 132329 + { spell = 781, type = "ability" }, -- Disengage + { spell = 1513, type = "ability", debuff = true }, -- Scare Beast + { spell = 1543, type = "ability" }, -- Flare + { spell = 5116, type = "ability", requiresTarget = true }, -- Concussive Shot + { spell = 5384, type = "ability", buff = true }, -- Feign Death + { spell = 6197, type = "ability", buff = true }, -- Eagle Eye + { spell = 19434, type = "ability", requiresTarget = true, charges = true, overlayGlow = true }, -- Aimed Shot + { spell = 19801, type = "ability", requiresTarget = true }, -- Tranquilizing Shot + { spell = 34477, type = "ability", requiresTarget = true }, -- Misdirection + { spell = 53351, type = "ability", requiresTarget = true }, -- Kill Shot + { spell = 56641, type = "ability", requiresTarget = true }, -- Steady Shot + { spell = 109248, type = "ability", requiresTarget = true }, -- Binding Shot + { spell = 109304, type = "ability" }, -- Exhilaration + { spell = 120360, type = "ability", talent = 5 }, -- Barrage + { spell = 131894, type = "ability", talent = 3 }, -- A Murder of Crows + { spell = 147362, type = "ability", requiresTarget = true }, -- Counter Shot + { spell = 185358, type = "ability", requiresTarget = true, overlayGlow = true }, -- Arcane Shot + { spell = 186257, type = "ability", buff = true }, -- Aspect of the Cheetah + { spell = 186265, type = "ability", buff = true }, -- Aspect of the Turtle + { spell = 186387, type = "ability", debuff = true }, -- Bursting Shot + { spell = 187650, type = "ability" }, -- Freezing Trap + { spell = 187698, type = "ability" }, -- Tar Trap + { spell = 195645, type = "ability", debuff = true }, -- Concussive Shot + { spell = 199483, type = "ability", talent = 9 }, -- Camouflage + { spell = 212431, type = "ability", talent = 6 }, -- Explosive Shot + { spell = 257044, type = "ability", requiresTarget = true, overlayGlow = true }, -- Rapid Fire + { spell = 257284, type = "ability", requiresTarget = true }, -- Hunter's Mark + { spell = 257620, type = "ability", requiresTarget = true }, -- Multi-Shot + { spell = 260243, type = "ability", talent = 21 }, -- Volley + { spell = 260402, type = "ability", buff = true, talent = 18 }, -- Double Tap + { spell = 264667, type = "ability", buff = true }, -- Primal Rage + { spell = 264735, type = "ability", unit = "pet", buff = true }, -- Survival of the Fittest + { spell = 271788, type = "ability", debuff = true, talent = 2 }, -- Serpent Sting + { spell = 272651, type = "ability" }, -- Command Pet Ability + { spell = 288613, type = "ability", buff = true }, -- Trueshot + { spell = 321297, type = "ability" }, -- Eyes of the Beast + { spell = 342049, type = "ability", talent = 12 }, -- Chimaera Shot + }, + icon = 132329, }, [4] = {}, [5] = {}, @@ -941,26 +934,25 @@ templates.class.HUNTER = { [10] = { title = L["PvP Talents"], args = { - { spell = 53480, type="ability", pvptalent = 7, titleSuffix = L["cooldown"]},-- Roar of Sacrifice - { spell = 53480, type="buff", unit = "group", pvptalent = 7, titleSuffix = L["buff"]},-- Roar of Sacrifice - { spell = 202797, type="ability", pvptalent = 3, titleSuffix = L["cooldown"]},-- Viper Sting - { spell = 202797, type="debuff", unit = "target", pvptalent = 3, titleSuffix = L["debuff"]},-- Viper Sting - { spell = 202900, type="ability", pvptalent = 4, titleSuffix = L["cooldown"]},-- Scorpid Sting - { spell = 202900, type="debuff", unit = "target", pvptalent = 4, titleSuffix = L["debuff"]},-- Scorpid Sting - { spell = 202914, type="ability", pvptalent = 5, titleSuffix = L["cooldown"]},-- Spider Sting - { spell = 202914, type="debuff", unit = "target", pvptalent = 5, titleSuffix = L["debuff"]},-- Spider Sting - { spell = 203155, type="ability", pvptalent = 12, titleSuffix = L["cooldown"]},-- Sniper Shot - { spell = 203155, type="buff", unit = "player", pvptalent = 12, titleSuffix = L["buff"]},-- Sniper Shot - { spell = 213691, type="ability", pvptalent = 6, titleSuffix = L["cooldown"]},-- Scatter Shot - { spell = 213691, type="debuff", unit = "target", pvptalent = 6, titleSuffix = L["debuff"]},-- Scatter Shot - { spell = 236776, type="ability", pvptalent = 8},-- Hi-Explosive Trap + { spell = 53480, type = "ability", pvptalent = 7, titleSuffix = L["cooldown"] }, -- Roar of Sacrifice + { spell = 53480, type = "buff", unit = "group", pvptalent = 7, titleSuffix = L["buff"] }, -- Roar of Sacrifice + { spell = 202797, type = "ability", pvptalent = 3, titleSuffix = L["cooldown"] }, -- Viper Sting + { spell = 202797, type = "debuff", unit = "target", pvptalent = 3, titleSuffix = L["debuff"] }, -- Viper Sting + { spell = 202900, type = "ability", pvptalent = 4, titleSuffix = L["cooldown"] }, -- Scorpid Sting + { spell = 202900, type = "debuff", unit = "target", pvptalent = 4, titleSuffix = L["debuff"] }, -- Scorpid Sting + { spell = 202914, type = "ability", pvptalent = 5, titleSuffix = L["cooldown"] }, -- Spider Sting + { spell = 202914, type = "debuff", unit = "target", pvptalent = 5, titleSuffix = L["debuff"] }, -- Spider Sting + { spell = 203155, type = "ability", pvptalent = 12, titleSuffix = L["cooldown"] }, -- Sniper Shot + { spell = 203155, type = "buff", unit = "player", pvptalent = 12, titleSuffix = L["buff"] }, -- Sniper Shot + { spell = 213691, type = "ability", pvptalent = 6, titleSuffix = L["cooldown"] }, -- Scatter Shot + { spell = 213691, type = "debuff", unit = "target", pvptalent = 6, titleSuffix = L["debuff"] }, -- Scatter Shot + { spell = 236776, type = "ability", pvptalent = 8 }, -- Hi-Explosive Trap }, icon = "Interface\\Icons\\Achievement_BG_winWSG", }, [11] = { title = L["Resources"], - args = { - }, + args = {}, icon = "Interface\\Icons\\ability_hunter_focusfire", }, }, @@ -968,110 +960,108 @@ templates.class.HUNTER = { [1] = { title = L["Buffs"], args = { - { spell = 136, type = "buff", unit = "pet"}, -- Mend Pet - { spell = 5384, type = "buff", unit = "player"}, -- Feign Death - { spell = 6197, type = "buff", unit = "player"}, -- Eagle Eye - { spell = 24450, type = "buff", unit = "pet"}, -- Prowl - { spell = 35079, type = "buff", unit = "player"}, -- Misdirection - { spell = 61684, type = "buff", unit = "pet"}, -- Dash + { spell = 136, type = "buff", unit = "pet" }, -- Mend Pet + { spell = 5384, type = "buff", unit = "player" }, -- Feign Death + { spell = 6197, type = "buff", unit = "player" }, -- Eagle Eye + { spell = 24450, type = "buff", unit = "pet" }, -- Prowl + { spell = 35079, type = "buff", unit = "player" }, -- Misdirection + { spell = 61684, type = "buff", unit = "pet" }, -- Dash { spell = 118922, type = "buff", unit = "player", talent = 14 }, -- Posthaste - { spell = 186258, type = "buff", unit = "player"}, -- Aspect of the Cheetah - { spell = 186265, type = "buff", unit = "player"}, -- Aspect of the Turtle - { spell = 186289, type = "buff", unit = "player"}, -- Aspect of the Eagle - { spell = 199483, type = "buff", unit = "player", talent = 9}, -- Camouflage - { spell = 225788, type = "buff", unit = "player"}, -- Sign of the Emissary + { spell = 186258, type = "buff", unit = "player" }, -- Aspect of the Cheetah + { spell = 186265, type = "buff", unit = "player" }, -- Aspect of the Turtle + { spell = 186289, type = "buff", unit = "player" }, -- Aspect of the Eagle + { spell = 199483, type = "buff", unit = "player", talent = 9 }, -- Camouflage + { spell = 225788, type = "buff", unit = "player" }, -- Sign of the Emissary { spell = 231390, type = "buff", unit = "player", talent = 7 }, -- Trailblazer { spell = 259388, type = "buff", unit = "player", talent = 17 }, -- Mongoose Fury - { spell = 260249, type = "buff", unit = "pet"}, -- Predator - { spell = 260249, type = "buff", unit = "player"}, -- Predator + { spell = 260249, type = "buff", unit = "pet" }, -- Predator + { spell = 260249, type = "buff", unit = "player" }, -- Predator { spell = 260286, type = "buff", unit = "player", talent = 16 }, -- Tip of the Spear - { spell = 263892, type = "buff", unit = "pet"}, -- Catlike Reflexes - { spell = 264663, type = "buff", unit = "pet"}, -- Predator's Thirst - { spell = 264663, type = "buff", unit = "player"}, -- Predator's Thirst - { spell = 264667, type = "buff", unit = "player"}, -- Primal Rage + { spell = 263892, type = "buff", unit = "pet" }, -- Catlike Reflexes + { spell = 264663, type = "buff", unit = "pet" }, -- Predator's Thirst + { spell = 264663, type = "buff", unit = "player" }, -- Predator's Thirst + { spell = 264667, type = "buff", unit = "player" }, -- Primal Rage { spell = 265898, type = "buff", unit = "player", talent = 2 }, -- Terms of Engagement - { spell = 266779, type = "buff", unit = "pet"}, -- Coordinated Assault - { spell = 266779, type = "buff", unit = "player"}, -- Coordinated Assault + { spell = 266779, type = "buff", unit = "pet" }, -- Coordinated Assault + { spell = 266779, type = "buff", unit = "player" }, -- Coordinated Assault { spell = 268552, type = "buff", unit = "player", talent = 1 }, -- Viper's Venom - }, - icon = 1376044 + icon = 1376044, }, [2] = { title = L["Debuffs"], args = { - { spell = 2649, type = "debuff", unit = "target"}, -- Growl - { spell = 3355, type = "debuff", unit = "multi"}, -- Freezing Trap - { spell = 24394, type = "debuff", unit = "target"}, -- Intimidation + { spell = 2649, type = "debuff", unit = "target" }, -- Growl + { spell = 3355, type = "debuff", unit = "multi" }, -- Freezing Trap + { spell = 24394, type = "debuff", unit = "target" }, -- Intimidation { spell = 117405, type = "debuff", unit = "target", talent = 15 }, -- Binding Shot { spell = 131894, type = "debuff", unit = "target", talent = 12 }, -- A Murder of Crows - { spell = 135299, type = "debuff", unit = "target"}, -- Tar Trap - { spell = 162480, type = "debuff", unit = "target"}, -- Steel Trap + { spell = 135299, type = "debuff", unit = "target" }, -- Tar Trap + { spell = 162480, type = "debuff", unit = "target" }, -- Steel Trap { spell = 162487, type = "debuff", unit = "target", talent = 11 }, -- Steel Trap - { spell = 190927, type = "debuff", unit = "target"}, -- Harpoon - { spell = 195645, type = "debuff", unit = "target"}, -- Wing Clip + { spell = 190927, type = "debuff", unit = "target" }, -- Harpoon + { spell = 195645, type = "debuff", unit = "target" }, -- Wing Clip { spell = 259277, type = "debuff", unit = "target", talent = 10 }, -- Kill Command - { spell = 259491, type = "debuff", unit = "target"}, -- Serpent Sting - { spell = 269747, type = "debuff", unit = "target"}, -- Wildfire Bomb + { spell = 259491, type = "debuff", unit = "target" }, -- Serpent Sting + { spell = 269747, type = "debuff", unit = "target" }, -- Wildfire Bomb { spell = 270332, type = "debuff", unit = "target", talent = 20 }, -- Pheromone Bomb { spell = 270339, type = "debuff", unit = "target", talent = 20 }, -- Shrapnel Bomb - { spell = 270343, type = "debuff", unit = "target"}, -- Internal Bleeding - { spell = 271049, type = "debuff", unit = "target"}, -- Volatile Bomb - + { spell = 270343, type = "debuff", unit = "target" }, -- Internal Bleeding + { spell = 271049, type = "debuff", unit = "target" }, -- Volatile Bomb }, - icon = 132309 + icon = 132309, }, [3] = { title = L["Abilities"], args = { - { spell = 781, type = "ability"}, -- Disengage - { spell = 1513, type = "ability", debuff = true}, -- Scare Beast - { spell = 1543, type = "ability"}, -- Flare - { spell = 2649, type = "ability", requiresTarget = true, debuff = true}, -- Growl - { spell = 5384, type = "ability", buff = true}, -- Feign Death - { spell = 6197, type = "ability", buff = true}, -- Eagle Eye - { spell = 16827, type = "ability", requiresTarget = true}, -- Claw - { spell = 19434, type = "ability", requiresTarget = true}, -- Aimed Shot - { spell = 19577, type = "ability", requiresTarget = true, debuff = true}, -- Intimidation - { spell = 19801, type = "ability", requiresTarget = true}, -- Tranquilizing Shot - { spell = 24450, type = "ability"}, -- Prowl - { spell = 34477, type = "ability", requiresTarget = true}, -- Misdirection - { spell = 56641, type = "ability", requiresTarget = true}, -- Steady Shot - { spell = 61684, type = "ability"}, -- Dash - { spell = 109248, type = "ability"}, -- Binding Shot - { spell = 109304, type = "ability"}, -- Exhilaration - { spell = 131894, type = "ability", talent = 12}, -- A Murder of Crows - { spell = 162488, type = "ability", talent = 11}, -- Steel Trap - { spell = 185358, type = "ability"}, -- Arcane Shot - { spell = 186257, type = "ability", buff = true}, -- Aspect of the Cheetah - { spell = 186265, type = "ability", buff = true}, -- Aspect of the Turtle - { spell = 186270, type = "ability"}, -- Raptor Strike - { spell = 186289, type = "ability", buff = true}, -- Aspect of the Eagle - { spell = 187650, type = "ability"}, -- Freezing Trap - { spell = 187698, type = "ability"}, -- Tar Trap - { spell = 187707, type = "ability", requiresTarget = true}, -- Muzzle - { spell = 187708, type = "ability"}, -- Carve - { spell = 190925, type = "ability", requiresTarget = true}, -- Harpoon - { spell = 195645, type = "ability", requiresTarget = true}, -- Wing Clip - { spell = 199483, type = "ability", talent = 9}, -- Camouflage + { spell = 781, type = "ability" }, -- Disengage + { spell = 1513, type = "ability", debuff = true }, -- Scare Beast + { spell = 1543, type = "ability" }, -- Flare + { spell = 2649, type = "ability", requiresTarget = true, debuff = true }, -- Growl + { spell = 5384, type = "ability", buff = true }, -- Feign Death + { spell = 6197, type = "ability", buff = true }, -- Eagle Eye + { spell = 16827, type = "ability", requiresTarget = true }, -- Claw + { spell = 19434, type = "ability", requiresTarget = true }, -- Aimed Shot + { spell = 19577, type = "ability", requiresTarget = true, debuff = true }, -- Intimidation + { spell = 19801, type = "ability", requiresTarget = true }, -- Tranquilizing Shot + { spell = 24450, type = "ability" }, -- Prowl + { spell = 34477, type = "ability", requiresTarget = true }, -- Misdirection + { spell = 56641, type = "ability", requiresTarget = true }, -- Steady Shot + { spell = 61684, type = "ability" }, -- Dash + { spell = 109248, type = "ability" }, -- Binding Shot + { spell = 109304, type = "ability" }, -- Exhilaration + { spell = 131894, type = "ability", talent = 12 }, -- A Murder of Crows + { spell = 162488, type = "ability", talent = 11 }, -- Steel Trap + { spell = 185358, type = "ability" }, -- Arcane Shot + { spell = 186257, type = "ability", buff = true }, -- Aspect of the Cheetah + { spell = 186265, type = "ability", buff = true }, -- Aspect of the Turtle + { spell = 186270, type = "ability" }, -- Raptor Strike + { spell = 186289, type = "ability", buff = true }, -- Aspect of the Eagle + { spell = 187650, type = "ability" }, -- Freezing Trap + { spell = 187698, type = "ability" }, -- Tar Trap + { spell = 187707, type = "ability", requiresTarget = true }, -- Muzzle + { spell = 187708, type = "ability" }, -- Carve + { spell = 190925, type = "ability", requiresTarget = true }, -- Harpoon + { spell = 195645, type = "ability", requiresTarget = true }, -- Wing Clip + { spell = 199483, type = "ability", talent = 9 }, -- Camouflage { spell = 212436, type = "ability", charges = true, talent = 6 }, -- Butchery - { spell = 257284, type = "ability", debuff = true}, -- Hunter's Mark + { spell = 257284, type = "ability", debuff = true }, -- Hunter's Mark { spell = 259391, type = "ability", requiresTarget = true, talent = 21 }, -- Chakrams - { spell = 259489, type = "ability", requiresTarget = true, overlayGlow = true}, -- Kill Command - { spell = 259491, type = "ability", requiresTarget = true, overlayGlow = true}, -- Serpent Sting - { spell = 259495, type = "ability", requiresTarget = true}, -- Wildfire Bomb - { spell = 263892, type = "ability"}, -- Catlike Reflexes - { spell = 264667, type = "ability", buff = true}, -- Primal Rage - { spell = 266779, type = "ability", buff = true}, -- Coordinated Assault + { spell = 259489, type = "ability", requiresTarget = true, overlayGlow = true }, -- Kill Command + { spell = 259491, type = "ability", requiresTarget = true, overlayGlow = true }, -- Serpent Sting + { spell = 259495, type = "ability", requiresTarget = true }, -- Wildfire Bomb + { spell = 263892, type = "ability" }, -- Catlike Reflexes + { spell = 264667, type = "ability", buff = true }, -- Primal Rage + { spell = 266779, type = "ability", buff = true }, -- Coordinated Assault { spell = 269751, type = "ability", requiresTarget = true, talent = 18 }, -- Flanking Strike { spell = 270323, type = "ability", talent = 20 }, -- Pheromone Bomb - { spell = 270335, type = "ability", talent = 20}, -- Shrapnel Bomb - { spell = 271045, type = "ability", talent = 20}, -- Volatile Bomb - { spell = 272651, type = "ability"}, -- Command Pet - { spell = 321297, type = "ability"}, -- Eyes of the Beast - { spell = 320976, type = "ability", requiresTarget = true}, -- Kill Shot + { spell = 270335, type = "ability", talent = 20 }, -- Shrapnel Bomb + { spell = 271045, type = "ability", talent = 20 }, -- Volatile Bomb + { spell = 272651, type = "ability" }, -- Command Pet + { spell = 321297, type = "ability" }, -- Eyes of the Beast + { spell = 320976, type = "ability", requiresTarget = true }, -- Kill Shot }, - icon = 236184 + icon = 236184, }, [4] = {}, [5] = {}, @@ -1082,26 +1072,25 @@ templates.class.HUNTER = { [10] = { title = L["PvP Talents"], args = { - { spell = 53480, type="ability", pvptalent = 11, titleSuffix = L["cooldown"]},-- Roar of Sacrifice - { spell = 53480, type="buff", unit = "group", pvptalent = 11, titleSuffix = L["buff"]},-- Roar of Sacrifice - { spell = 202797, type="ability", pvptalent = 9, titleSuffix = L["cooldown"]},-- Viper Sting - { spell = 202797, type="debuff", unit = "target", pvptalent = 9, titleSuffix = L["debuff"]},-- Viper Sting - { spell = 202900, type="ability", pvptalent = 7, titleSuffix = L["cooldown"]},-- Scorpid Sting - { spell = 202900, type="debuff", unit = "target", pvptalent = 7, titleSuffix = L["debuff"]},-- Scorpid Sting - { spell = 202914, type="ability", pvptalent = 6, titleSuffix = L["cooldown"]},-- Spider Sting - { spell = 202914, type="debuff", unit = "target", pvptalent = 6, titleSuffix = L["debuff"]},-- Spider Sting - { spell = 203268, type="debuff", unit = "target", pvptalent = 3},-- Sticky Tar - { spell = 212638, type="ability", pvptalent = 1, titleSuffix = L["cooldown"]},-- Tracker's Net - { spell = 212638, type="debuff", unit = "target", pvptalent = 1, titleSuffix = L["debuff"]},-- Tracker's Net - { spell = 212640, type="ability", pvptalent = 10},-- Mending Bandage - { spell = 236776, type="ability", pvptalent = 4},-- Hi-Explosive Trap + { spell = 53480, type = "ability", pvptalent = 11, titleSuffix = L["cooldown"] }, -- Roar of Sacrifice + { spell = 53480, type = "buff", unit = "group", pvptalent = 11, titleSuffix = L["buff"] }, -- Roar of Sacrifice + { spell = 202797, type = "ability", pvptalent = 9, titleSuffix = L["cooldown"] }, -- Viper Sting + { spell = 202797, type = "debuff", unit = "target", pvptalent = 9, titleSuffix = L["debuff"] }, -- Viper Sting + { spell = 202900, type = "ability", pvptalent = 7, titleSuffix = L["cooldown"] }, -- Scorpid Sting + { spell = 202900, type = "debuff", unit = "target", pvptalent = 7, titleSuffix = L["debuff"] }, -- Scorpid Sting + { spell = 202914, type = "ability", pvptalent = 6, titleSuffix = L["cooldown"] }, -- Spider Sting + { spell = 202914, type = "debuff", unit = "target", pvptalent = 6, titleSuffix = L["debuff"] }, -- Spider Sting + { spell = 203268, type = "debuff", unit = "target", pvptalent = 3 }, -- Sticky Tar + { spell = 212638, type = "ability", pvptalent = 1, titleSuffix = L["cooldown"] }, -- Tracker's Net + { spell = 212638, type = "debuff", unit = "target", pvptalent = 1, titleSuffix = L["debuff"] }, -- Tracker's Net + { spell = 212640, type = "ability", pvptalent = 10 }, -- Mending Bandage + { spell = 236776, type = "ability", pvptalent = 4 }, -- Hi-Explosive Trap }, icon = "Interface\\Icons\\Achievement_BG_winWSG", }, [11] = { title = L["Resources"], - args = { - }, + args = {}, icon = "Interface\\Icons\\ability_hunter_focusfire", }, }, @@ -1112,91 +1101,91 @@ templates.class.ROGUE = { [1] = { title = L["Buffs"], args = { - { spell = 1784, type = "buff", unit = "player"}, -- Stealth - { spell = 1966, type = "buff", unit = "player"}, -- Feint - { spell = 2823, type = "buff", unit = "player"}, -- Deadly Poison - { spell = 2983, type = "buff", unit = "player"}, -- Sprint - { spell = 3408, type = "buff", unit = "player"}, -- Crippling Poison - { spell = 5277, type = "buff", unit = "player"}, -- Evasion - { spell = 5761, type = "buff", unit = "player"}, -- Numbing Poison - { spell = 8679, type = "buff", unit = "player"}, -- Wound Poison - { spell = 11327, type = "buff", unit = "player"}, -- Vanish - { spell = 31224, type = "buff", unit = "player"}, -- Cloak of Shadows - { spell = 32645, type = "buff", unit = "player"}, -- Envenom - { spell = 36554, type = "buff", unit = "player"}, -- Shadowstep + { spell = 1784, type = "buff", unit = "player" }, -- Stealth + { spell = 1966, type = "buff", unit = "player" }, -- Feint + { spell = 2823, type = "buff", unit = "player" }, -- Deadly Poison + { spell = 2983, type = "buff", unit = "player" }, -- Sprint + { spell = 3408, type = "buff", unit = "player" }, -- Crippling Poison + { spell = 5277, type = "buff", unit = "player" }, -- Evasion + { spell = 5761, type = "buff", unit = "player" }, -- Numbing Poison + { spell = 8679, type = "buff", unit = "player" }, -- Wound Poison + { spell = 11327, type = "buff", unit = "player" }, -- Vanish + { spell = 31224, type = "buff", unit = "player" }, -- Cloak of Shadows + { spell = 32645, type = "buff", unit = "player" }, -- Envenom + { spell = 36554, type = "buff", unit = "player" }, -- Shadowstep { spell = 45182, type = "buff", unit = "player", talent = 11 }, -- Cheating Death - { spell = 57934, type = "buff", unit = "player"}, -- Tricks of the Trade - { spell = 108211, type = "buff", unit = "player", talent = 10}, -- Leeching Poison - { spell = 114018, type = "buff", unit = "player"}, -- Shroud of Concealment - { spell = 115192, type = "buff", unit = "player", talent = 5}, -- Subterfuge - { spell = 121153, type = "buff", unit = "player", talent = 3}, -- Blindside - { spell = 185311, type = "buff", unit = "player"}, -- Crimson Vial - { spell = 193538, type = "buff", unit = "player", talent = 17}, -- Alacrity - { spell = 193641, type = "buff", unit = "player", talent = 2}, -- Elaborate Planning - { spell = 256735, type = "buff", unit = "player", talent = 6}, -- Master Assassin - { spell = 270070, type = "buff", unit = "player", talent = 20}, -- Hidden Blades - { spell = 315496, type = "buff"}, -- Slice and Dice - }, - icon = 132290 + { spell = 57934, type = "buff", unit = "player" }, -- Tricks of the Trade + { spell = 108211, type = "buff", unit = "player", talent = 10 }, -- Leeching Poison + { spell = 114018, type = "buff", unit = "player" }, -- Shroud of Concealment + { spell = 115192, type = "buff", unit = "player", talent = 5 }, -- Subterfuge + { spell = 121153, type = "buff", unit = "player", talent = 3 }, -- Blindside + { spell = 185311, type = "buff", unit = "player" }, -- Crimson Vial + { spell = 193538, type = "buff", unit = "player", talent = 17 }, -- Alacrity + { spell = 193641, type = "buff", unit = "player", talent = 2 }, -- Elaborate Planning + { spell = 256735, type = "buff", unit = "player", talent = 6 }, -- Master Assassin + { spell = 270070, type = "buff", unit = "player", talent = 20 }, -- Hidden Blades + { spell = 315496, type = "buff" }, -- Slice and Dice + }, + icon = 132290, }, [2] = { title = L["Debuffs"], args = { - { spell = 408, type = "debuff", unit = "target"}, -- Kidney Shot - { spell = 703, type = "debuff", unit = "target"}, -- Garrote - { spell = 1330, type = "debuff", unit = "target"}, -- Garrote - Silence - { spell = 1833, type = "debuff", unit = "target"}, -- Cheap Shot - { spell = 1943, type = "debuff", unit = "target"}, -- Rupture - { spell = 2094, type = "debuff", unit = "multi"}, -- Blind - { spell = 2818, type = "debuff", unit = "target"}, -- Deadly Poison - { spell = 3409, type = "debuff", unit = "target"}, -- Crippling Poison - { spell = 6770, type = "debuff", unit = "multi"}, -- Sap - { spell = 8680, type = "debuff", unit = "target"}, -- Wound Poison + { spell = 408, type = "debuff", unit = "target" }, -- Kidney Shot + { spell = 703, type = "debuff", unit = "target" }, -- Garrote + { spell = 1330, type = "debuff", unit = "target" }, -- Garrote - Silence + { spell = 1833, type = "debuff", unit = "target" }, -- Cheap Shot + { spell = 1943, type = "debuff", unit = "target" }, -- Rupture + { spell = 2094, type = "debuff", unit = "multi" }, -- Blind + { spell = 2818, type = "debuff", unit = "target" }, -- Deadly Poison + { spell = 3409, type = "debuff", unit = "target" }, -- Crippling Poison + { spell = 6770, type = "debuff", unit = "multi" }, -- Sap + { spell = 8680, type = "debuff", unit = "target" }, -- Wound Poison { spell = 45181, type = "debuff", unit = "player", talent = 11 }, -- Cheated Death - { spell = 79140, type = "debuff", unit = "target"}, -- Vendetta - { spell = 121411, type = "debuff", unit = "target", talent = 21}, -- Crimson Tempest - { spell = 137619, type = "debuff", unit = "target", talent = 9}, -- Marked for Death - { spell = 154953, type = "debuff", unit = "target", talent = 13}, -- Internal Bleeding - { spell = 256148, type = "debuff", unit = "target", talent = 14}, -- Iron Wire - { spell = 255909, type = "debuff", unit = "target", talent = 15}, -- Prey on the Weak + { spell = 79140, type = "debuff", unit = "target" }, -- Vendetta + { spell = 121411, type = "debuff", unit = "target", talent = 21 }, -- Crimson Tempest + { spell = 137619, type = "debuff", unit = "target", talent = 9 }, -- Marked for Death + { spell = 154953, type = "debuff", unit = "target", talent = 13 }, -- Internal Bleeding + { spell = 256148, type = "debuff", unit = "target", talent = 14 }, -- Iron Wire + { spell = 255909, type = "debuff", unit = "target", talent = 15 }, -- Prey on the Weak }, - icon = 132302 + icon = 132302, }, [3] = { title = L["Abilities"], args = { - { spell = 408, type = "ability", requiresTarget = true, usable = true, debuff = true}, -- Kidney Shot - { spell = 703, type = "ability", requiresTarget = true, debuff = true}, -- Garrote - { spell = 1725, type = "ability"}, -- Distract - { spell = 1752, type = "ability", requiresTarget = true}, -- Sinister Strike / Mutilate - { spell = 1766, type = "ability", requiresTarget = true}, -- Kick - { spell = 1784, type = "ability", buff = true}, -- Stealth - { spell = 1833, type = "ability", usable = true, requiresTarget = true, debuff = true}, -- Cheap Shot - { spell = 1856, type = "ability", buff = true}, -- Vanish - { spell = 1943, type = "ability", requiresTarget = true, usable = true, debuff = true}, -- Rupture - { spell = 1966, type = "ability", buff = true}, -- Feint - { spell = 2094, type = "ability", requiresTarget = true}, -- Blind - { spell = 2983, type = "ability", buff = true}, -- Sprint - { spell = 5277, type = "ability", buff = true}, -- Evasion - { spell = 5938, type = "ability", requiresTarget = true}, -- Shiv - { spell = 6770, type = "ability", usable = true, requiresTarget = true, debuff = true}, -- Sap - { spell = 8676, type = "ability"}, -- Ambush - { spell = 31224, type = "ability", buff = true}, -- Cloak of Shadows - { spell = 36554, type = "ability", requiresTarget = true}, -- Shadowstep - { spell = 51723, type = "ability"}, -- Fan of Knives - { spell = 57934, type = "ability", requiresTarget = true}, -- Tricks of the Trade - { spell = 79140, type = "ability", requiresTarget = true, debuff = true}, -- Vendetta - { spell = 114018, type = "ability", usable = true, buff = true}, -- Shroud of Concealment - { spell = 115191, type = "ability", buff = true}, -- Stealth - { spell = 121411, type = "ability"}, -- Crimson Tempest - { spell = 137619, type = "ability", requiresTarget = true, debuff = true, talent = 9}, -- Marked for Death - { spell = 185311, type = "ability", buff = true}, -- Crimson Vial - { spell = 185565, type = "ability"}, -- Poisoned Knife - { spell = 196819, type = "ability", requiresTarget = true, usable = true, debuff = true}, -- Envenom - { spell = 200806, type = "ability", requiresTarget = true, usable = true, talent = 18}, -- Exsanguinate - { spell = 315496, type = "ability"}, -- Slice and Dice - }, - icon = 132350 + { spell = 408, type = "ability", requiresTarget = true, usable = true, debuff = true }, -- Kidney Shot + { spell = 703, type = "ability", requiresTarget = true, debuff = true }, -- Garrote + { spell = 1725, type = "ability" }, -- Distract + { spell = 1752, type = "ability", requiresTarget = true }, -- Sinister Strike / Mutilate + { spell = 1766, type = "ability", requiresTarget = true }, -- Kick + { spell = 1784, type = "ability", buff = true }, -- Stealth + { spell = 1833, type = "ability", usable = true, requiresTarget = true, debuff = true }, -- Cheap Shot + { spell = 1856, type = "ability", buff = true }, -- Vanish + { spell = 1943, type = "ability", requiresTarget = true, usable = true, debuff = true }, -- Rupture + { spell = 1966, type = "ability", buff = true }, -- Feint + { spell = 2094, type = "ability", requiresTarget = true }, -- Blind + { spell = 2983, type = "ability", buff = true }, -- Sprint + { spell = 5277, type = "ability", buff = true }, -- Evasion + { spell = 5938, type = "ability", requiresTarget = true }, -- Shiv + { spell = 6770, type = "ability", usable = true, requiresTarget = true, debuff = true }, -- Sap + { spell = 8676, type = "ability" }, -- Ambush + { spell = 31224, type = "ability", buff = true }, -- Cloak of Shadows + { spell = 36554, type = "ability", requiresTarget = true }, -- Shadowstep + { spell = 51723, type = "ability" }, -- Fan of Knives + { spell = 57934, type = "ability", requiresTarget = true }, -- Tricks of the Trade + { spell = 79140, type = "ability", requiresTarget = true, debuff = true }, -- Vendetta + { spell = 114018, type = "ability", usable = true, buff = true }, -- Shroud of Concealment + { spell = 115191, type = "ability", buff = true }, -- Stealth + { spell = 121411, type = "ability" }, -- Crimson Tempest + { spell = 137619, type = "ability", requiresTarget = true, debuff = true, talent = 9 }, -- Marked for Death + { spell = 185311, type = "ability", buff = true }, -- Crimson Vial + { spell = 185565, type = "ability" }, -- Poisoned Knife + { spell = 196819, type = "ability", requiresTarget = true, usable = true, debuff = true }, -- Envenom + { spell = 200806, type = "ability", requiresTarget = true, usable = true, talent = 18 }, -- Exsanguinate + { spell = 315496, type = "ability" }, -- Slice and Dice + }, + icon = 132350, }, [4] = {}, [5] = {}, @@ -1207,22 +1196,21 @@ templates.class.ROGUE = { [10] = { title = L["PvP Talents"], args = { - { spell = 197003, type="buff", unit = "target", pvptalent = 10},-- Maneuverability - { spell = 197051, type="debuff", unit = "target", pvptalent = 6},-- Mind-Numbing Poison - { spell = 197091, type="debuff", unit = "target", pvptalent = 7, titleSuffix = L["debuff"]},-- Neurotoxin - { spell = 198097, type="debuff", unit = "target", pvptalent = 3},-- Creeping Venom - { spell = 198222, type="debuff", unit = "target", pvptalent = 5},-- System Shock - { spell = 269513, type="ability", pvptalent = 8},-- Death from Above - { spell = 206328, type="ability", pvptalent = 7, titleSuffix = L["cooldown"]},-- Neurotoxin - { spell = 212182, type="ability", pvptalent = 9, titleSuffix = L["cooldown"]},-- Smoke Bomb - { spell = 212183, type="debuff", unit = "player", pvptalent = 9, titleSuffix = L["buff"]},-- Smoke Bomb + { spell = 197003, type = "buff", unit = "target", pvptalent = 10 }, -- Maneuverability + { spell = 197051, type = "debuff", unit = "target", pvptalent = 6 }, -- Mind-Numbing Poison + { spell = 197091, type = "debuff", unit = "target", pvptalent = 7, titleSuffix = L["debuff"] }, -- Neurotoxin + { spell = 198097, type = "debuff", unit = "target", pvptalent = 3 }, -- Creeping Venom + { spell = 198222, type = "debuff", unit = "target", pvptalent = 5 }, -- System Shock + { spell = 269513, type = "ability", pvptalent = 8 }, -- Death from Above + { spell = 206328, type = "ability", pvptalent = 7, titleSuffix = L["cooldown"] }, -- Neurotoxin + { spell = 212182, type = "ability", pvptalent = 9, titleSuffix = L["cooldown"] }, -- Smoke Bomb + { spell = 212183, type = "debuff", unit = "player", pvptalent = 9, titleSuffix = L["buff"] }, -- Smoke Bomb }, icon = "Interface\\Icons\\Achievement_BG_winWSG", }, [11] = { title = L["Resources"], - args = { - }, + args = {}, icon = comboPointsIcon, }, }, @@ -1230,97 +1218,97 @@ templates.class.ROGUE = { [1] = { title = L["Buffs"], args = { - { spell = 1784, type = "buff", unit = "player"}, -- Stealth - { spell = 1966, type = "buff", unit = "player"}, -- Feint - { spell = 2983, type = "buff", unit = "player"}, -- Sprint - { spell = 3408, type = "buff", unit = "player"}, -- Crippling Poison - { spell = 5277, type = "buff", unit = "player"}, -- Evasion - { spell = 5761, type = "buff", unit = "player"}, -- Numbing Poison - { spell = 8679, type = "buff", unit = "player"}, -- Wound Poison - { spell = 11327, type = "buff", unit = "player"}, -- Vanish - { spell = 13750, type = "buff", unit = "player"}, -- Adrenaline Rush - { spell = 13877, type = "buff", unit = "player"}, -- Blade Flurry - { spell = 31224, type = "buff", unit = "player"}, -- Cloak of Shadows + { spell = 1784, type = "buff", unit = "player" }, -- Stealth + { spell = 1966, type = "buff", unit = "player" }, -- Feint + { spell = 2983, type = "buff", unit = "player" }, -- Sprint + { spell = 3408, type = "buff", unit = "player" }, -- Crippling Poison + { spell = 5277, type = "buff", unit = "player" }, -- Evasion + { spell = 5761, type = "buff", unit = "player" }, -- Numbing Poison + { spell = 8679, type = "buff", unit = "player" }, -- Wound Poison + { spell = 11327, type = "buff", unit = "player" }, -- Vanish + { spell = 13750, type = "buff", unit = "player" }, -- Adrenaline Rush + { spell = 13877, type = "buff", unit = "player" }, -- Blade Flurry + { spell = 31224, type = "buff", unit = "player" }, -- Cloak of Shadows { spell = 45182, type = "buff", unit = "player", talent = 11 }, -- Cheating Death - { spell = 51690, type = "buff", unit = "player", talent = 21}, -- Killing Spree - { spell = 57934, type = "buff", unit = "player"}, -- Tricks of the Trade - { spell = 13750, type = "buff", unit = "player"}, -- Adrenaline Rush - { spell = 114018, type = "buff", unit = "player"}, -- Shroud of Concealment - { spell = 185311, type = "buff", unit = "player"}, -- Crimson Vial - { spell = 193357, type = "buff", unit = "player"}, -- Ruthless Precision - { spell = 193358, type = "buff", unit = "player"}, -- Grand Melee - { spell = 193538, type = "buff", unit = "player", talent = 17}, -- Alacrity - { spell = 193359, type = "buff", unit = "player"}, -- True Bearing - { spell = 199600, type = "buff", unit = "player"}, -- Buried Treasure - { spell = 199603, type = "buff", unit = "player"}, -- Skull and Crossbones - { spell = 199754, type = "buff", unit = "player"}, -- Riposte - { spell = 195627, type = "buff", unit = "player"}, -- Opportunity - { spell = 193356, type = "buff", unit = "player"}, -- Broadside - { spell = 271896, type = "buff", unit = "player", talent = 20}, -- Blade Rush - { spell = 315496, type = "buff"}, -- Slice and Dice - { spell = 315584, type = "buff", unit = "player"}, -- Instant Poison - }, - icon = 132350 + { spell = 51690, type = "buff", unit = "player", talent = 21 }, -- Killing Spree + { spell = 57934, type = "buff", unit = "player" }, -- Tricks of the Trade + { spell = 13750, type = "buff", unit = "player" }, -- Adrenaline Rush + { spell = 114018, type = "buff", unit = "player" }, -- Shroud of Concealment + { spell = 185311, type = "buff", unit = "player" }, -- Crimson Vial + { spell = 193357, type = "buff", unit = "player" }, -- Ruthless Precision + { spell = 193358, type = "buff", unit = "player" }, -- Grand Melee + { spell = 193538, type = "buff", unit = "player", talent = 17 }, -- Alacrity + { spell = 193359, type = "buff", unit = "player" }, -- True Bearing + { spell = 199600, type = "buff", unit = "player" }, -- Buried Treasure + { spell = 199603, type = "buff", unit = "player" }, -- Skull and Crossbones + { spell = 199754, type = "buff", unit = "player" }, -- Riposte + { spell = 195627, type = "buff", unit = "player" }, -- Opportunity + { spell = 193356, type = "buff", unit = "player" }, -- Broadside + { spell = 271896, type = "buff", unit = "player", talent = 20 }, -- Blade Rush + { spell = 315496, type = "buff" }, -- Slice and Dice + { spell = 315584, type = "buff", unit = "player" }, -- Instant Poison + }, + icon = 132350, }, [2] = { title = L["Debuffs"], args = { - { spell = 408, type = "debuff", unit = "target"}, -- Kindney Shot - { spell = 1776, type = "debuff", unit = "target"}, -- Gouge - { spell = 1833, type = "debuff", unit = "target"}, -- Cheap Shot - { spell = 2094, type = "debuff", unit = "multi"}, -- Blind - { spell = 6770, type = "debuff", unit = "multi"}, -- Sap + { spell = 408, type = "debuff", unit = "target" }, -- Kindney Shot + { spell = 1776, type = "debuff", unit = "target" }, -- Gouge + { spell = 1833, type = "debuff", unit = "target" }, -- Cheap Shot + { spell = 2094, type = "debuff", unit = "multi" }, -- Blind + { spell = 6770, type = "debuff", unit = "multi" }, -- Sap { spell = 45181, type = "debuff", unit = "player", talent = 11 }, -- Cheated Death - { spell = 137619, type = "debuff", unit = "target", talent = 9}, -- Marked for Death - { spell = 185763, type = "debuff", unit = "target"}, -- Pistol Shot - { spell = 199804, type = "debuff", unit = "target"}, -- Between the Eyes - { spell = 196937, type = "debuff", unit = "target", talent = 3}, -- Ghostly Strike - { spell = 255909, type = "debuff", unit = "target", talent = 15}, -- Prey on the Weak + { spell = 137619, type = "debuff", unit = "target", talent = 9 }, -- Marked for Death + { spell = 185763, type = "debuff", unit = "target" }, -- Pistol Shot + { spell = 199804, type = "debuff", unit = "target" }, -- Between the Eyes + { spell = 196937, type = "debuff", unit = "target", talent = 3 }, -- Ghostly Strike + { spell = 255909, type = "debuff", unit = "target", talent = 15 }, -- Prey on the Weak }, - icon = 1373908 + icon = 1373908, }, [3] = { title = L["Abilities"], args = { - { spell = 408, type = "ability"}, -- Kindney Shot - { spell = 1725, type = "ability"}, -- Distract - { spell = 1752, type = "ability", requiresTarget = true}, -- Sinister Strike - { spell = 1766, type = "ability", requiresTarget = true}, -- Kick - { spell = 1776, type = "ability", requiresTarget = true, debuff = true}, -- Gouge - { spell = 1784, type = "ability", buff = true}, -- Stealth - { spell = 1833, type = "ability", debuff = true}, -- Cheap Shot - { spell = 1856, type = "ability", buff = true}, -- Vanish - { spell = 1966, type = "ability", buff = true}, -- Feint - { spell = 2094, type = "ability", requiresTarget = true, debuff = true}, -- Blind - { spell = 2098, type = "ability", requiresTarget = true, usable = true}, -- Dispatch + { spell = 408, type = "ability" }, -- Kindney Shot + { spell = 1725, type = "ability" }, -- Distract + { spell = 1752, type = "ability", requiresTarget = true }, -- Sinister Strike + { spell = 1766, type = "ability", requiresTarget = true }, -- Kick + { spell = 1776, type = "ability", requiresTarget = true, debuff = true }, -- Gouge + { spell = 1784, type = "ability", buff = true }, -- Stealth + { spell = 1833, type = "ability", debuff = true }, -- Cheap Shot + { spell = 1856, type = "ability", buff = true }, -- Vanish + { spell = 1966, type = "ability", buff = true }, -- Feint + { spell = 2094, type = "ability", requiresTarget = true, debuff = true }, -- Blind + { spell = 2098, type = "ability", requiresTarget = true, usable = true }, -- Dispatch { spell = 2983, type = "ability", buff = true }, -- Sprint { spell = 5277, type = "ability", buff = true }, -- Evasion - { spell = 5938, type = "ability"}, -- Shiv + { spell = 5938, type = "ability" }, -- Shiv { spell = 6770, type = "ability", debuff = true }, -- Sap - { spell = 8676, type = "ability", requiresTarget = true, usable = true}, -- Ambush - { spell = 13750, type = "ability", buff = true}, -- Adrenaline Rush - { spell = 13877, type = "ability", buff = true, charges = true}, -- Blade Flurry - { spell = 31224, type = "ability", buff = true}, -- Cloak of Shadows - { spell = 51690, type = "ability", requiresTarget = true, talent = 21}, -- Killing Spree - { spell = 57934, type = "ability", requiresTarget = true, debuff = true}, -- Tricks of the Trade - { spell = 57934, type = "ability", requiresTarget = true}, -- Tricks of the Trade - { spell = 79096, type = "ability"}, -- Restless Blades - { spell = 114018, type = "ability", usable = true, buff = true}, -- Shroud of Concealment - { spell = 137619, type = "ability", requiresTarget = true, debuff = true, talent = 9}, -- Marked for Death - { spell = 185311, type = "ability", buff = true}, -- Crimson Vial - { spell = 185763, type = "ability", requiresTarget = true}, -- Pistol Shot - { spell = 195457, type = "ability", requiresTarget = true}, -- Grappling Hook - { spell = 196937, type = "ability", requiresTarget = true, debuff = true, talent = 3}, -- Ghostly Strike - { spell = 199754, type = "ability", buff = true}, -- Riposte - { spell = 196819, type = "ability"}, -- Dispatch - { spell = 199804, type = "ability", usable = true, requiresTarget = true}, -- Between the Eyes - { spell = 271877, type = "ability", buff = true, talent = 20}, -- Blade Rush - { spell = 315496, type = "ability", buff = true}, -- Slice and Dice - { spell = 315341, type = "ability", debuff = true}, -- Between the Eyes - { spell = 315508, type = "ability", requiresTarget = true, usable = true}, -- Roll the Bones - { spell = 343142, type = "ability", requiresTarget = true}, -- Dreadblades - }, - icon = 135610 + { spell = 8676, type = "ability", requiresTarget = true, usable = true }, -- Ambush + { spell = 13750, type = "ability", buff = true }, -- Adrenaline Rush + { spell = 13877, type = "ability", buff = true, charges = true }, -- Blade Flurry + { spell = 31224, type = "ability", buff = true }, -- Cloak of Shadows + { spell = 51690, type = "ability", requiresTarget = true, talent = 21 }, -- Killing Spree + { spell = 57934, type = "ability", requiresTarget = true, debuff = true }, -- Tricks of the Trade + { spell = 57934, type = "ability", requiresTarget = true }, -- Tricks of the Trade + { spell = 79096, type = "ability" }, -- Restless Blades + { spell = 114018, type = "ability", usable = true, buff = true }, -- Shroud of Concealment + { spell = 137619, type = "ability", requiresTarget = true, debuff = true, talent = 9 }, -- Marked for Death + { spell = 185311, type = "ability", buff = true }, -- Crimson Vial + { spell = 185763, type = "ability", requiresTarget = true }, -- Pistol Shot + { spell = 195457, type = "ability", requiresTarget = true }, -- Grappling Hook + { spell = 196937, type = "ability", requiresTarget = true, debuff = true, talent = 3 }, -- Ghostly Strike + { spell = 199754, type = "ability", buff = true }, -- Riposte + { spell = 196819, type = "ability" }, -- Dispatch + { spell = 199804, type = "ability", usable = true, requiresTarget = true }, -- Between the Eyes + { spell = 271877, type = "ability", buff = true, talent = 20 }, -- Blade Rush + { spell = 315496, type = "ability", buff = true }, -- Slice and Dice + { spell = 315341, type = "ability", debuff = true }, -- Between the Eyes + { spell = 315508, type = "ability", requiresTarget = true, usable = true }, -- Roll the Bones + { spell = 343142, type = "ability", requiresTarget = true }, -- Dreadblades + }, + icon = 135610, }, [4] = {}, [5] = {}, @@ -1331,27 +1319,26 @@ templates.class.ROGUE = { [10] = { title = L["PvP Talents"], args = { - { spell = 197003, type="buff", unit = "target", pvptalent = 5},-- Maneuverability - { spell = 198027, type="buff", unit = "player", pvptalent = 2},-- Turn the Tables - { spell = 198368, type="buff", unit = "player", pvptalent = 11},-- Take Your Cut - { spell = 198529, type="ability", pvptalent = 13, titleSuffix = L["cooldown"]},-- Plunder Armor - { spell = 198529, type="buff", unit = "player", pvptalent = 13, titleSuffix = L["debuff"]},-- Plunder Armor - { spell = 207777, type="ability", pvptalent = 10, titleSuffix = L["cooldown"]},-- Dismantle - { spell = 207777, type="debuff", unit = "target", pvptalent = 10, titleSuffix = L["debuff"]},-- Dismantle - { spell = 209754, type="buff", unit = "player", pvptalent = 12},-- Boarding Party - { spell = 212150, type="debuff", unit = "target", pvptalent = 1, titleSuffix = L["debuff"]},-- Cheap Tricks - { spell = 212210, type="ability", pvptalent = 7},-- Drink Up Me Hearties - { spell = 213995, type="buff", unit = "player", pvptalent = 1, titleSuffix = L["buff"]},-- Cheap Tricks - { spell = 212182, type="ability", pvptalent = 6, titleSuffix = L["cooldown"]},-- Smoke Bomb - { spell = 212183, type="debuff", unit = "player", pvptalent = 6, titleSuffix = L["buff"]},-- Smoke Bomb - { spell = 269513, type="ability", pvptalent = 3},-- Death from Above + { spell = 197003, type = "buff", unit = "target", pvptalent = 5 }, -- Maneuverability + { spell = 198027, type = "buff", unit = "player", pvptalent = 2 }, -- Turn the Tables + { spell = 198368, type = "buff", unit = "player", pvptalent = 11 }, -- Take Your Cut + { spell = 198529, type = "ability", pvptalent = 13, titleSuffix = L["cooldown"] }, -- Plunder Armor + { spell = 198529, type = "buff", unit = "player", pvptalent = 13, titleSuffix = L["debuff"] }, -- Plunder Armor + { spell = 207777, type = "ability", pvptalent = 10, titleSuffix = L["cooldown"] }, -- Dismantle + { spell = 207777, type = "debuff", unit = "target", pvptalent = 10, titleSuffix = L["debuff"] }, -- Dismantle + { spell = 209754, type = "buff", unit = "player", pvptalent = 12 }, -- Boarding Party + { spell = 212150, type = "debuff", unit = "target", pvptalent = 1, titleSuffix = L["debuff"] }, -- Cheap Tricks + { spell = 212210, type = "ability", pvptalent = 7 }, -- Drink Up Me Hearties + { spell = 213995, type = "buff", unit = "player", pvptalent = 1, titleSuffix = L["buff"] }, -- Cheap Tricks + { spell = 212182, type = "ability", pvptalent = 6, titleSuffix = L["cooldown"] }, -- Smoke Bomb + { spell = 212183, type = "debuff", unit = "player", pvptalent = 6, titleSuffix = L["buff"] }, -- Smoke Bomb + { spell = 269513, type = "ability", pvptalent = 3 }, -- Death from Above }, icon = "Interface\\Icons\\Achievement_BG_winWSG", }, [11] = { title = L["Resources"], - args = { - }, + args = {}, icon = comboPointsIcon, }, }, @@ -1359,93 +1346,93 @@ templates.class.ROGUE = { [1] = { title = L["Buffs"], args = { - { spell = 1784, type = "buff", unit = "player"}, -- Stealth - { spell = 1966, type = "buff", unit = "player"}, -- Feint - { spell = 2983, type = "buff", unit = "player"}, -- Sprint - { spell = 3408, type = "buff", unit = "player"}, -- Crippling Poison - { spell = 5277, type = "buff", unit = "player"}, -- Evasion - { spell = 5761, type = "buff", unit = "player"}, -- Numbing Poison - { spell = 8679, type = "buff", unit = "player"}, -- Wound Poison - { spell = 11327, type = "buff", unit = "player"}, -- Vanish - { spell = 31224, type = "buff", unit = "player"}, -- Cloak of Shadows + { spell = 1784, type = "buff", unit = "player" }, -- Stealth + { spell = 1966, type = "buff", unit = "player" }, -- Feint + { spell = 2983, type = "buff", unit = "player" }, -- Sprint + { spell = 3408, type = "buff", unit = "player" }, -- Crippling Poison + { spell = 5277, type = "buff", unit = "player" }, -- Evasion + { spell = 5761, type = "buff", unit = "player" }, -- Numbing Poison + { spell = 8679, type = "buff", unit = "player" }, -- Wound Poison + { spell = 11327, type = "buff", unit = "player" }, -- Vanish + { spell = 31224, type = "buff", unit = "player" }, -- Cloak of Shadows { spell = 45182, type = "buff", unit = "player", talent = 11 }, -- Cheating Death - { spell = 57934, type = "buff", unit = "player"}, -- Tricks of the Trade - { spell = 114018, type = "buff", unit = "player"}, -- Shroud of Concealment - { spell = 115191, type = "buff", unit = "player"}, -- Stealth - { spell = 115192, type = "buff", unit = "player", talent = 5}, -- Subterfuge - { spell = 121471, type = "buff", unit = "player"}, -- Shadow Blades - { spell = 185311, type = "buff", unit = "player"}, -- Crimson Vial - { spell = 185422, type = "buff", unit = "player"}, -- Shadow Dance - { spell = 196980, type = "buff", unit = "player", talent = 19}, -- Master of Shadows - { spell = 212283, type = "buff", unit = "player"}, -- Symbols of Death - { spell = 257506, type = "buff", unit = "player", talent = 13}, -- Shot in the Dark - { spell = 277925, type = "buff", unit = "player", talent = 21}, -- Shuriken Tornado - { spell = 193538, type = "buff", unit = "player", talent = 17}, -- Alacrity - { spell = 245640, type = "buff", unit = "player"}, -- Shuriken Combo - { spell = 315496, type = "buff", unit = "player"}, -- Slice and Dice - { spell = 315584, type = "buff", unit = "player"}, -- Instant Poison - { spell = 343173, type = "buff", unit = "player", talent = 2}, -- Premeditation - }, - icon = 376022 + { spell = 57934, type = "buff", unit = "player" }, -- Tricks of the Trade + { spell = 114018, type = "buff", unit = "player" }, -- Shroud of Concealment + { spell = 115191, type = "buff", unit = "player" }, -- Stealth + { spell = 115192, type = "buff", unit = "player", talent = 5 }, -- Subterfuge + { spell = 121471, type = "buff", unit = "player" }, -- Shadow Blades + { spell = 185311, type = "buff", unit = "player" }, -- Crimson Vial + { spell = 185422, type = "buff", unit = "player" }, -- Shadow Dance + { spell = 196980, type = "buff", unit = "player", talent = 19 }, -- Master of Shadows + { spell = 212283, type = "buff", unit = "player" }, -- Symbols of Death + { spell = 257506, type = "buff", unit = "player", talent = 13 }, -- Shot in the Dark + { spell = 277925, type = "buff", unit = "player", talent = 21 }, -- Shuriken Tornado + { spell = 193538, type = "buff", unit = "player", talent = 17 }, -- Alacrity + { spell = 245640, type = "buff", unit = "player" }, -- Shuriken Combo + { spell = 315496, type = "buff", unit = "player" }, -- Slice and Dice + { spell = 315584, type = "buff", unit = "player" }, -- Instant Poison + { spell = 343173, type = "buff", unit = "player", talent = 2 }, -- Premeditation + }, + icon = 376022, }, [2] = { title = L["Debuffs"], args = { - { spell = 408, type = "debuff", unit = "target"}, -- Kidney Shot - { spell = 1833, type = "debuff", unit = "target"}, -- Cheap Shot - { spell = 1943, type = "debuff", unit = "target"}, -- Rupture - { spell = 2094, type = "debuff", unit = "multi"}, -- Blind - { spell = 6770, type = "debuff", unit = "multi"}, -- Sap + { spell = 408, type = "debuff", unit = "target" }, -- Kidney Shot + { spell = 1833, type = "debuff", unit = "target" }, -- Cheap Shot + { spell = 1943, type = "debuff", unit = "target" }, -- Rupture + { spell = 2094, type = "debuff", unit = "multi" }, -- Blind + { spell = 6770, type = "debuff", unit = "multi" }, -- Sap { spell = 45181, type = "debuff", unit = "player", talent = 11 }, -- Cheated Death - { spell = 91021, type = "debuff", unit = "target"}, -- Find Weakness - { spell = 137619, type = "debuff", unit = "target", talent = 9}, -- Marked for Death - { spell = 195452, type = "debuff", unit = "target"}, -- Nightblade - { spell = 206760, type = "debuff", unit = "target", talent = 14}, -- Shadow's Grasp - { spell = 255909, type = "debuff", unit = "target", talent = 15}, -- Prey on the Weak + { spell = 91021, type = "debuff", unit = "target" }, -- Find Weakness + { spell = 137619, type = "debuff", unit = "target", talent = 9 }, -- Marked for Death + { spell = 195452, type = "debuff", unit = "target" }, -- Nightblade + { spell = 206760, type = "debuff", unit = "target", talent = 14 }, -- Shadow's Grasp + { spell = 255909, type = "debuff", unit = "target", talent = 15 }, -- Prey on the Weak }, - icon = 136175 + icon = 136175, }, [3] = { title = L["Abilities"], args = { - { spell = 408, type = "ability", requiresTarget = true, usable = true, debuff = true}, -- Kidney Shot - { spell = 1725, type = "ability"}, -- Distract - { spell = 1752, type = "ability", requiresTarget = true}, -- Backstab - { spell = 1766, type = "ability", requiresTarget = true}, -- Kick - { spell = 1784, type = "ability", buff = true}, -- Stealth - { spell = 1833, type = "ability", usable = true, requiresTarget = true, debuff = true}, -- Cheap Shot - { spell = 1856, type = "ability", buff = true}, -- Vanish - { spell = 1943, type = "ability", debuff = true}, -- Rupture - { spell = 1966, type = "ability", buff = true}, -- Feint - { spell = 2094, type = "ability", requiresTarget = true, debuff = true}, -- Blind - { spell = 2983, type = "ability", buff = true}, -- Sprint - { spell = 5277, type = "ability", buff = true}, -- Evasion - { spell = 5938, type = "ability"}, -- Shiv - { spell = 6770, type = "ability", requiresTarget = true, usable = true, debuff = true}, -- Sap - { spell = 8676, type = "ability", requiresTarget = true, usable = true}, -- Shadowstrike - { spell = 57934, type = "ability", requiresTarget = true}, -- Tricks of the Trade - { spell = 57934, type = "ability", requiresTarget = true, debuff = true}, -- Tricks of the Trade - { spell = 31224, type = "ability", buff = true}, -- Cloak of Shadows - { spell = 36554, type = "ability", charges = true, requiresTarget = true}, -- Shadowstep - { spell = 114014, type = "ability", requiresTarget = true}, -- Shuriken Toss - { spell = 114018, type = "ability", usable = true, buff = true}, -- Shroud of Concealment - { spell = 115191, type = "ability", buff = true}, -- Stealth - { spell = 121471, type = "ability", buff = true}, -- Shadow Blades - { spell = 137619, type = "ability", requiresTarget = true, debuff = true, talent = 9}, -- Marked for Death - { spell = 185311, type = "ability", buff = true}, -- Crimson Vial - { spell = 185313, type = "ability", charges = true, buff = true}, -- Shadow Dance - { spell = 185438, type = "ability", requiresTarget = true, usable = true}, -- Kidney Shot - { spell = 195452, type = "ability", usable = true, requiresTarget = true, debuff = true}, -- Nightblade - { spell = 196819, type = "ability", usable = true, requiresTarget = true}, -- Eviscerate - { spell = 197835, type = "ability"}, -- Shuriken Storm - { spell = 200758, type = "ability"}, -- Gloomblade - { spell = 212283, type = "ability", buff = true}, -- Symbols of Death - { spell = 277925, type = "ability", buff = true, talent = 21}, -- Shuriken Tornado - { spell = 280719, type = "ability", requiresTarget = true, usable = true, debuff = true, talent = 20}, -- Secret Technique - { spell = 315496, type = "ability", buff = true}, -- Slice and Dice - { spell = 319175, type = "ability", buff = true}, -- Shadow Vault - }, - icon = 236279 + { spell = 408, type = "ability", requiresTarget = true, usable = true, debuff = true }, -- Kidney Shot + { spell = 1725, type = "ability" }, -- Distract + { spell = 1752, type = "ability", requiresTarget = true }, -- Backstab + { spell = 1766, type = "ability", requiresTarget = true }, -- Kick + { spell = 1784, type = "ability", buff = true }, -- Stealth + { spell = 1833, type = "ability", usable = true, requiresTarget = true, debuff = true }, -- Cheap Shot + { spell = 1856, type = "ability", buff = true }, -- Vanish + { spell = 1943, type = "ability", debuff = true }, -- Rupture + { spell = 1966, type = "ability", buff = true }, -- Feint + { spell = 2094, type = "ability", requiresTarget = true, debuff = true }, -- Blind + { spell = 2983, type = "ability", buff = true }, -- Sprint + { spell = 5277, type = "ability", buff = true }, -- Evasion + { spell = 5938, type = "ability" }, -- Shiv + { spell = 6770, type = "ability", requiresTarget = true, usable = true, debuff = true }, -- Sap + { spell = 8676, type = "ability", requiresTarget = true, usable = true }, -- Shadowstrike + { spell = 57934, type = "ability", requiresTarget = true }, -- Tricks of the Trade + { spell = 57934, type = "ability", requiresTarget = true, debuff = true }, -- Tricks of the Trade + { spell = 31224, type = "ability", buff = true }, -- Cloak of Shadows + { spell = 36554, type = "ability", charges = true, requiresTarget = true }, -- Shadowstep + { spell = 114014, type = "ability", requiresTarget = true }, -- Shuriken Toss + { spell = 114018, type = "ability", usable = true, buff = true }, -- Shroud of Concealment + { spell = 115191, type = "ability", buff = true }, -- Stealth + { spell = 121471, type = "ability", buff = true }, -- Shadow Blades + { spell = 137619, type = "ability", requiresTarget = true, debuff = true, talent = 9 }, -- Marked for Death + { spell = 185311, type = "ability", buff = true }, -- Crimson Vial + { spell = 185313, type = "ability", charges = true, buff = true }, -- Shadow Dance + { spell = 185438, type = "ability", requiresTarget = true, usable = true }, -- Kidney Shot + { spell = 195452, type = "ability", usable = true, requiresTarget = true, debuff = true }, -- Nightblade + { spell = 196819, type = "ability", usable = true, requiresTarget = true }, -- Eviscerate + { spell = 197835, type = "ability" }, -- Shuriken Storm + { spell = 200758, type = "ability" }, -- Gloomblade + { spell = 212283, type = "ability", buff = true }, -- Symbols of Death + { spell = 277925, type = "ability", buff = true, talent = 21 }, -- Shuriken Tornado + { spell = 280719, type = "ability", requiresTarget = true, usable = true, debuff = true, talent = 20 }, -- Secret Technique + { spell = 315496, type = "ability", buff = true }, -- Slice and Dice + { spell = 319175, type = "ability", buff = true }, -- Shadow Vault + }, + icon = 236279, }, [4] = {}, [5] = {}, @@ -1456,23 +1443,22 @@ templates.class.ROGUE = { [10] = { title = L["PvP Talents"], args = { - { spell = 198688, type="debuff", unit = "target", pvptalent = 7},-- Dagger in the Dark - { spell = 199027, type="buff", unit = "player", pvptalent = 10},-- Veil of Midnight - { spell = 197003, type="buff", unit = "player", pvptalent = 3},-- Maneuverability - { spell = 207736, type="ability", pvptalent = 2, titleSuffix = L["cooldown"]},-- Shadowy Duel - { spell = 207736, type="buff", unit = "player", pvptalent = 2, titleSuffix = L["buff"]},-- Shadowy Duel - { spell = 212182, type="ability", pvptalent = 9, titleSuffix = L["cooldown"]},-- Smoke Bomb - { spell = 212183, type="debuff", unit = "player", pvptalent = 9, titleSuffix = L["buff"]},-- Smoke Bomb - { spell = 213981, type="ability", pvptalent = 1, titleSuffix = L["cooldown"]},-- Cold Blood - { spell = 213981, type="buff", unit = "player", pvptalent = 1, titleSuffix = L["buff"]},-- Cold Blood - { spell = 269513, type="ability", pvptalent = 5},-- Death from Above + { spell = 198688, type = "debuff", unit = "target", pvptalent = 7 }, -- Dagger in the Dark + { spell = 199027, type = "buff", unit = "player", pvptalent = 10 }, -- Veil of Midnight + { spell = 197003, type = "buff", unit = "player", pvptalent = 3 }, -- Maneuverability + { spell = 207736, type = "ability", pvptalent = 2, titleSuffix = L["cooldown"] }, -- Shadowy Duel + { spell = 207736, type = "buff", unit = "player", pvptalent = 2, titleSuffix = L["buff"] }, -- Shadowy Duel + { spell = 212182, type = "ability", pvptalent = 9, titleSuffix = L["cooldown"] }, -- Smoke Bomb + { spell = 212183, type = "debuff", unit = "player", pvptalent = 9, titleSuffix = L["buff"] }, -- Smoke Bomb + { spell = 213981, type = "ability", pvptalent = 1, titleSuffix = L["cooldown"] }, -- Cold Blood + { spell = 213981, type = "buff", unit = "player", pvptalent = 1, titleSuffix = L["buff"] }, -- Cold Blood + { spell = 269513, type = "ability", pvptalent = 5 }, -- Death from Above }, icon = "Interface\\Icons\\Achievement_BG_winWSG", }, [11] = { title = L["Resources"], - args = { - }, + args = {}, icon = comboPointsIcon, }, }, @@ -1483,86 +1469,86 @@ templates.class.PRIEST = { [1] = { title = L["Buffs"], args = { - { spell = 17, type = "buff", unit = "target"}, -- Power Word: Shield - { spell = 586, type = "buff", unit = "player"}, -- Fade - { spell = 2096, type = "buff", unit = "player"}, -- Mind Vision - { spell = 10060, type = "buff", unit = "player"}, -- Power Infusion - { spell = 19236, type = "buff", unit = "player"}, -- Desperate Prayer + { spell = 17, type = "buff", unit = "target" }, -- Power Word: Shield + { spell = 586, type = "buff", unit = "player" }, -- Fade + { spell = 2096, type = "buff", unit = "player" }, -- Mind Vision + { spell = 10060, type = "buff", unit = "player" }, -- Power Infusion + { spell = 19236, type = "buff", unit = "player" }, -- Desperate Prayer { spell = 21562, type = "buff", unit = "player", forceOwnOnly = true, ownOnly = nil }, -- Power Word: Fortitude - { spell = 33206, type = "buff", unit = "group"}, -- Pain Suppression - { spell = 47536, type = "buff", unit = "player"}, -- Rapture + { spell = 33206, type = "buff", unit = "group" }, -- Pain Suppression + { spell = 47536, type = "buff", unit = "player" }, -- Rapture { spell = 45243, type = "buff", unit = "player" }, -- Focused Will - { spell = 65081, type = "buff", unit = "player", talent = 4}, -- Body and Soul - { spell = 81782, type = "buff", unit = "target"}, -- Power Word: Barrier - { spell = 109964, type = "buff", unit = "player"}, -- Spirit Shell - { spell = 111759, type = "buff", unit = "player"}, -- Levitate - { spell = 121557, type = "buff", unit = "player", talent = 6}, -- Angelic Feather - { spell = 193065, type = "buff", unit = "player", talent = 5}, -- Masochism - { spell = 194384, type = "buff", unit = "group"}, -- Atonement - { spell = 198069, type = "buff", unit = "player"}, -- Power of the Dark Side - { spell = 265258, type = "buff", unit = "player", talent = 2}, -- Twist of Fate - { spell = 280398, type = "buff", unit = "player", talent = 13}, -- Sins of the Many - }, - icon = 135940 + { spell = 65081, type = "buff", unit = "player", talent = 4 }, -- Body and Soul + { spell = 81782, type = "buff", unit = "target" }, -- Power Word: Barrier + { spell = 109964, type = "buff", unit = "player" }, -- Spirit Shell + { spell = 111759, type = "buff", unit = "player" }, -- Levitate + { spell = 121557, type = "buff", unit = "player", talent = 6 }, -- Angelic Feather + { spell = 193065, type = "buff", unit = "player", talent = 5 }, -- Masochism + { spell = 194384, type = "buff", unit = "group" }, -- Atonement + { spell = 198069, type = "buff", unit = "player" }, -- Power of the Dark Side + { spell = 265258, type = "buff", unit = "player", talent = 2 }, -- Twist of Fate + { spell = 280398, type = "buff", unit = "player", talent = 13 }, -- Sins of the Many + }, + icon = 135940, }, [2] = { title = L["Debuffs"], args = { - { spell = 589, type = "debuff", unit = "target"}, -- Shadow Word: Pain - { spell = 2096, type = "debuff", unit = "target"}, -- Mind Vision - { spell = 8122, type = "debuff", unit = "target"}, -- Psychic Scream + { spell = 589, type = "debuff", unit = "target" }, -- Shadow Word: Pain + { spell = 2096, type = "debuff", unit = "target" }, -- Mind Vision + { spell = 8122, type = "debuff", unit = "target" }, -- Psychic Scream { spell = 9484, type = "debuff", unit = "multi" }, -- Shackle Undead - { spell = 204263, type = "debuff", unit = "target", talent = 12}, -- Shining Force - { spell = 208772, type = "debuff", unit = "target"}, -- Smite - { spell = 204213, type = "debuff", unit = "target", talent = 16}, -- Purge the Wicked - { spell = 214621, type = "debuff", unit = "target", talent = 3}, -- Schism + { spell = 204263, type = "debuff", unit = "target", talent = 12 }, -- Shining Force + { spell = 208772, type = "debuff", unit = "target" }, -- Smite + { spell = 204213, type = "debuff", unit = "target", talent = 16 }, -- Purge the Wicked + { spell = 214621, type = "debuff", unit = "target", talent = 3 }, -- Schism }, - icon = 136207 + icon = 136207, }, [3] = { title = L["Abilities"], args = { - { spell = 17, type = "ability"}, -- Power Word: Shield - { spell = 453, type = "ability"}, -- Mind Soothe - { spell = 527, type = "ability"}, -- Purify - { spell = 528, type = "ability"}, -- Dispel Magic - { spell = 585, type = "ability"}, -- Smite - { spell = 586, type = "ability", buff = true}, -- Fade - { spell = 605, type = "ability"}, -- Mind Control - { spell = 1706, type = "ability", buff = true}, -- Levitate - { spell = 2061, type = "ability", overlayGlow = true}, -- Shadow Mend - { spell = 2096, type = "ability"}, -- Mind Vision - { spell = 2006, type = "ability"}, -- Resurrection - { spell = 8092, type = "ability", requiresTarget = true}, -- Mind Blast - { spell = 8122, type = "ability"}, -- Psychic Scream - { spell = 9484, type = "ability", debuff = true}, -- Shackle Undead - { spell = 10060, type = "ability"}, -- Power Infusion - { spell = 19236, type = "ability", buff = true}, -- Desperate Prayer - { spell = 32375, type = "ability"}, -- Mass Dispel - { spell = 32379, type = "ability", charges = true, usable = true, requiresTarget = true}, -- Shadow Word: Death - { spell = 33206, type = "ability"}, -- Pain Suppression - { spell = 34433, type = "ability", totem = true, requiresTarget = true}, -- Shadowfiend - { spell = 47536, type = "ability", buff = true}, -- Rapture - { spell = 47540, type = "ability", requiresTarget = true}, -- Penance - { spell = 48045, type = "ability", requiresTarget = true}, -- Mind Sear - { spell = 62618, type = "ability"}, -- Power Word: Barrier - { spell = 73325, type = "ability"}, -- Leap of Faith - { spell = 109964, type = "ability", buff = true, talent = 20}, -- Divine Star - { spell = 110744, type = "ability", talent = 17}, -- Divine Star - { spell = 120517, type = "ability", talent = 18}, -- Halo - { spell = 121536, type = "ability", charges = true, buff = true, talent = 6}, -- Angelic Feather - { spell = 123040, type = "ability", totem = true, requiresTarget = true, talent = 8}, -- Mindbender - { spell = 129250, type = "ability", requiresTarget = true, talent = 9}, -- Power Word: Solace - { spell = 132157, type = "ability"}, -- Holy Nova - { spell = 194509, type = "ability", charges = true}, -- Power Word: Radiance - { spell = 204197, type = "ability", talent = 16}, -- Purge the Wicked - { spell = 204263, type = "ability", talent = 12}, -- Shining Force - { spell = 212036, type = "ability"}, -- Mass Resurrection - { spell = 214621, type = "ability", requiresTarget = true, debuff = true, talent = 3}, -- Schism - { spell = 246287, type = "ability", talent = 21}, -- Evangelism - { spell = 314867, type = "ability", talent = 15}, -- Shadow Covenant - }, - icon = 136224 + { spell = 17, type = "ability" }, -- Power Word: Shield + { spell = 453, type = "ability" }, -- Mind Soothe + { spell = 527, type = "ability" }, -- Purify + { spell = 528, type = "ability" }, -- Dispel Magic + { spell = 585, type = "ability" }, -- Smite + { spell = 586, type = "ability", buff = true }, -- Fade + { spell = 605, type = "ability" }, -- Mind Control + { spell = 1706, type = "ability", buff = true }, -- Levitate + { spell = 2061, type = "ability", overlayGlow = true }, -- Shadow Mend + { spell = 2096, type = "ability" }, -- Mind Vision + { spell = 2006, type = "ability" }, -- Resurrection + { spell = 8092, type = "ability", requiresTarget = true }, -- Mind Blast + { spell = 8122, type = "ability" }, -- Psychic Scream + { spell = 9484, type = "ability", debuff = true }, -- Shackle Undead + { spell = 10060, type = "ability" }, -- Power Infusion + { spell = 19236, type = "ability", buff = true }, -- Desperate Prayer + { spell = 32375, type = "ability" }, -- Mass Dispel + { spell = 32379, type = "ability", charges = true, usable = true, requiresTarget = true }, -- Shadow Word: Death + { spell = 33206, type = "ability" }, -- Pain Suppression + { spell = 34433, type = "ability", totem = true, requiresTarget = true }, -- Shadowfiend + { spell = 47536, type = "ability", buff = true }, -- Rapture + { spell = 47540, type = "ability", requiresTarget = true }, -- Penance + { spell = 48045, type = "ability", requiresTarget = true }, -- Mind Sear + { spell = 62618, type = "ability" }, -- Power Word: Barrier + { spell = 73325, type = "ability" }, -- Leap of Faith + { spell = 109964, type = "ability", buff = true, talent = 20 }, -- Divine Star + { spell = 110744, type = "ability", talent = 17 }, -- Divine Star + { spell = 120517, type = "ability", talent = 18 }, -- Halo + { spell = 121536, type = "ability", charges = true, buff = true, talent = 6 }, -- Angelic Feather + { spell = 123040, type = "ability", totem = true, requiresTarget = true, talent = 8 }, -- Mindbender + { spell = 129250, type = "ability", requiresTarget = true, talent = 9 }, -- Power Word: Solace + { spell = 132157, type = "ability" }, -- Holy Nova + { spell = 194509, type = "ability", charges = true }, -- Power Word: Radiance + { spell = 204197, type = "ability", talent = 16 }, -- Purge the Wicked + { spell = 204263, type = "ability", talent = 12 }, -- Shining Force + { spell = 212036, type = "ability" }, -- Mass Resurrection + { spell = 214621, type = "ability", requiresTarget = true, debuff = true, talent = 3 }, -- Schism + { spell = 246287, type = "ability", talent = 21 }, -- Evangelism + { spell = 314867, type = "ability", talent = 15 }, -- Shadow Covenant + }, + icon = 136224, }, [4] = {}, [5] = {}, @@ -1573,18 +1559,17 @@ templates.class.PRIEST = { [10] = { title = L["PvP Talents"], args = { - { spell = 197862, type="ability", pvptalent = 5, titleSuffix = L["cooldown"]},-- Archangel - { spell = 197862, type="buff", unit = "player", pvptalent = 5, titleSuffix = L["buff"]},-- Archangel - { spell = 197871, type="ability", pvptalent = 6, titleSuffix = L["cooldown"]},-- Dark Archangel - { spell = 197871, type="buff", unit = "player", pvptalent = 6, titleSuffix = L["buff"]},-- Dark Archangel - { spell = 316262, type="ability", pvptalent = 6, titleSuffix = L["cooldown"]},-- Thoughtsteal + { spell = 197862, type = "ability", pvptalent = 5, titleSuffix = L["cooldown"] }, -- Archangel + { spell = 197862, type = "buff", unit = "player", pvptalent = 5, titleSuffix = L["buff"] }, -- Archangel + { spell = 197871, type = "ability", pvptalent = 6, titleSuffix = L["cooldown"] }, -- Dark Archangel + { spell = 197871, type = "buff", unit = "player", pvptalent = 6, titleSuffix = L["buff"] }, -- Dark Archangel + { spell = 316262, type = "ability", pvptalent = 6, titleSuffix = L["cooldown"] }, -- Thoughtsteal }, icon = "Interface\\Icons\\Achievement_BG_winWSG", }, [11] = { title = L["Resources"], - args = { - }, + args = {}, icon = manaIcon, }, }, @@ -1592,91 +1577,90 @@ templates.class.PRIEST = { [1] = { title = L["Buffs"], args = { - { spell = 17, type = "buff", unit = "player"}, -- Power Word: Shield - { spell = 139, type = "buff", unit = "target"}, -- Renew - { spell = 586, type = "buff", unit = "player"}, -- Fade - { spell = 2096, type = "buff", unit = "player"}, -- Mind Vision - { spell = 10060, type = "buff", unit = "player"}, -- Power Infusion - { spell = 19236, type = "buff", unit = "player"}, -- Desperate Prayer + { spell = 17, type = "buff", unit = "player" }, -- Power Word: Shield + { spell = 139, type = "buff", unit = "target" }, -- Renew + { spell = 586, type = "buff", unit = "player" }, -- Fade + { spell = 2096, type = "buff", unit = "player" }, -- Mind Vision + { spell = 10060, type = "buff", unit = "player" }, -- Power Infusion + { spell = 19236, type = "buff", unit = "player" }, -- Desperate Prayer { spell = 21562, type = "buff", unit = "player", forceOwnOnly = true, ownOnly = nil }, -- Power Word: Fortitude - { spell = 27827, type = "buff", unit = "player"}, -- Spirit of Redemption - { spell = 41635, type = "buff", unit = "group"}, -- Prayer of Mending + { spell = 27827, type = "buff", unit = "player" }, -- Spirit of Redemption + { spell = 41635, type = "buff", unit = "group" }, -- Prayer of Mending { spell = 45243, type = "buff", unit = "player" }, -- Focused Will - { spell = 47788, type = "buff", unit = "target"}, -- Guardian Spirit - { spell = 64843, type = "buff", unit = "player"}, -- Divine Hymn - { spell = 64901, type = "buff", unit = "player"}, -- Symbol of Hope - { spell = 65081, type = "buff", unit = "player"}, -- Body and Soul - { spell = 77489, type = "buff", unit = "target"}, -- Echo of Light - { spell = 111759, type = "buff", unit = "player"}, -- Levitate - { spell = 114255, type = "buff", unit = "player", talent = 13}, -- Surge of Light - { spell = 121557, type = "buff", unit = "player", talent = 6}, -- Angelic Feather - { spell = 200183, type = "buff", unit = "player", talent = 20}, -- Apotheosis - { spell = 321379, type = "buff", unit = "player", talent = 15}, -- Prayer Circle - }, - icon = 135953 + { spell = 47788, type = "buff", unit = "target" }, -- Guardian Spirit + { spell = 64843, type = "buff", unit = "player" }, -- Divine Hymn + { spell = 64901, type = "buff", unit = "player" }, -- Symbol of Hope + { spell = 65081, type = "buff", unit = "player" }, -- Body and Soul + { spell = 77489, type = "buff", unit = "target" }, -- Echo of Light + { spell = 111759, type = "buff", unit = "player" }, -- Levitate + { spell = 114255, type = "buff", unit = "player", talent = 13 }, -- Surge of Light + { spell = 121557, type = "buff", unit = "player", talent = 6 }, -- Angelic Feather + { spell = 200183, type = "buff", unit = "player", talent = 20 }, -- Apotheosis + { spell = 321379, type = "buff", unit = "player", talent = 15 }, -- Prayer Circle + }, + icon = 135953, }, [2] = { title = L["Debuffs"], args = { - { spell = 589, type = "debuff", unit = "target"}, -- Shadow Word: Pain - { spell = 2096, type = "debuff", unit = "target"}, -- Mind Vision - { spell = 8122, type = "debuff", unit = "target"}, -- Psychic Scream + { spell = 589, type = "debuff", unit = "target" }, -- Shadow Word: Pain + { spell = 2096, type = "debuff", unit = "target" }, -- Mind Vision + { spell = 8122, type = "debuff", unit = "target" }, -- Psychic Scream { spell = 9484, type = "debuff", unit = "multi" }, -- Shackle Undead - { spell = 14914, type = "debuff", unit = "target"}, -- Holy Fire - { spell = 200200, type = "debuff", unit = "target"}, -- Holy Word: Chastise - { spell = 200196, type = "debuff", unit = "target"}, -- Holy Word: Chastise - { spell = 204263, type = "debuff", unit = "target"}, -- Shining Force + { spell = 14914, type = "debuff", unit = "target" }, -- Holy Fire + { spell = 200200, type = "debuff", unit = "target" }, -- Holy Word: Chastise + { spell = 200196, type = "debuff", unit = "target" }, -- Holy Word: Chastise + { spell = 204263, type = "debuff", unit = "target" }, -- Shining Force }, - icon = 135972 + icon = 135972, }, [3] = { title = L["Abilities"], args = { - { spell = 17, type = "ability"}, -- Power Word: Shield - { spell = 139, type = "ability"}, -- Renew - { spell = 527, type = "ability"}, -- Purify - { spell = 453, type = "ability"}, -- Mind Soothe - { spell = 528, type = "ability"}, -- Dispel Magic - { spell = 585, type = "ability"}, -- Smite - { spell = 586, type = "ability", buff = true}, -- Fade - { spell = 589, type = "ability"}, -- Shadow Word: Pain - { spell = 596, type = "ability"}, -- Prayer of Healing - { spell = 605, type = "ability"}, -- Mind Control - { spell = 1706, type = "ability"}, -- Levitate - { spell = 2006, type = "ability"}, -- Resurrection - { spell = 2050, type = "ability"}, -- Holy Word: Serenity - { spell = 2060, type = "ability"}, -- Heal - { spell = 2061, type = "ability"}, -- Flash Heal - { spell = 2096, type = "ability"}, -- Mind Vision - { spell = 8092, type = "ability", requiresTarget = true}, -- Holy Fire - { spell = 8122, type = "ability"}, -- Psychic Scream - { spell = 9484, type = "ability"}, -- Shackle Undead - { spell = 10060, type = "ability", buff = true}, -- Power Infusion - { spell = 14914, type = "ability", requiresTarget = true}, -- Holy Fire - { spell = 19236, type = "ability", buff = true}, -- Desperate Prayer - { spell = 32375, type = "ability"}, -- Mass Dispel - { spell = 32379, type = "ability"}, -- Shadow Word: Death - { spell = 32379, type = "ability", charges = true, usable = true, requiresTarget = true}, -- Shadow Word: Death - { spell = 32546, type = "ability"}, -- Binding Heal - { spell = 33076, type = "ability"}, -- Prayer of Mending - { spell = 34861, type = "ability"}, -- Holy Word: Sanctify - { spell = 47788, type = "ability"}, -- Guardian Spirit - { spell = 64843, type = "ability", buff = true}, -- Divine Hymn - { spell = 64901, type = "ability", buff = true}, -- Symbol of Hope - { spell = 73325, type = "ability"}, -- Leap of Faith - { spell = 88625, type = "ability", requiresTarget = true, debuff = true}, -- Holy Word: Chastise - { spell = 110744, type = "ability", talent = 17}, -- Divine Star - { spell = 120517, type = "ability", talent = 18}, -- Halo - { spell = 121536, type = "ability", charges = true, buff = true, talent = 6}, -- Angelic Feather - { spell = 132157, type = "ability"}, -- Holy Nova - { spell = 200183, type = "ability", buff = true, talent = 20}, -- Apotheosis - { spell = 204263, type = "ability", talent = 12}, -- Shining Force - { spell = 204883, type = "ability"}, -- Circle of Healing - { spell = 212036, type = "ability"}, -- Mass Resurrection - { spell = 265202, type = "ability", talent = 21}, -- Holy Word: Salvation - - }, - icon = 135937 + { spell = 17, type = "ability" }, -- Power Word: Shield + { spell = 139, type = "ability" }, -- Renew + { spell = 527, type = "ability" }, -- Purify + { spell = 453, type = "ability" }, -- Mind Soothe + { spell = 528, type = "ability" }, -- Dispel Magic + { spell = 585, type = "ability" }, -- Smite + { spell = 586, type = "ability", buff = true }, -- Fade + { spell = 589, type = "ability" }, -- Shadow Word: Pain + { spell = 596, type = "ability" }, -- Prayer of Healing + { spell = 605, type = "ability" }, -- Mind Control + { spell = 1706, type = "ability" }, -- Levitate + { spell = 2006, type = "ability" }, -- Resurrection + { spell = 2050, type = "ability" }, -- Holy Word: Serenity + { spell = 2060, type = "ability" }, -- Heal + { spell = 2061, type = "ability" }, -- Flash Heal + { spell = 2096, type = "ability" }, -- Mind Vision + { spell = 8092, type = "ability", requiresTarget = true }, -- Holy Fire + { spell = 8122, type = "ability" }, -- Psychic Scream + { spell = 9484, type = "ability" }, -- Shackle Undead + { spell = 10060, type = "ability", buff = true }, -- Power Infusion + { spell = 14914, type = "ability", requiresTarget = true }, -- Holy Fire + { spell = 19236, type = "ability", buff = true }, -- Desperate Prayer + { spell = 32375, type = "ability" }, -- Mass Dispel + { spell = 32379, type = "ability" }, -- Shadow Word: Death + { spell = 32379, type = "ability", charges = true, usable = true, requiresTarget = true }, -- Shadow Word: Death + { spell = 32546, type = "ability" }, -- Binding Heal + { spell = 33076, type = "ability" }, -- Prayer of Mending + { spell = 34861, type = "ability" }, -- Holy Word: Sanctify + { spell = 47788, type = "ability" }, -- Guardian Spirit + { spell = 64843, type = "ability", buff = true }, -- Divine Hymn + { spell = 64901, type = "ability", buff = true }, -- Symbol of Hope + { spell = 73325, type = "ability" }, -- Leap of Faith + { spell = 88625, type = "ability", requiresTarget = true, debuff = true }, -- Holy Word: Chastise + { spell = 110744, type = "ability", talent = 17 }, -- Divine Star + { spell = 120517, type = "ability", talent = 18 }, -- Halo + { spell = 121536, type = "ability", charges = true, buff = true, talent = 6 }, -- Angelic Feather + { spell = 132157, type = "ability" }, -- Holy Nova + { spell = 200183, type = "ability", buff = true, talent = 20 }, -- Apotheosis + { spell = 204263, type = "ability", talent = 12 }, -- Shining Force + { spell = 204883, type = "ability" }, -- Circle of Healing + { spell = 212036, type = "ability" }, -- Mass Resurrection + { spell = 265202, type = "ability", talent = 21 }, -- Holy Word: Salvation + }, + icon = 135937, }, [4] = {}, [5] = {}, @@ -1687,25 +1671,24 @@ templates.class.PRIEST = { [10] = { title = L["PvP Talents"], args = { - { spell = 197268, type="ability", pvptalent = 5, titleSuffix = L["cooldown"]},-- Ray of Hope - { spell = 213602, type="ability", pvptalent = 4, titleSuffix = L["cooldown"]},-- Greater Fade - { spell = 213602, type="buff", unit = "player", pvptalent = 4, titleSuffix = L["buff"]},-- Greater Fade - { spell = 213610, type="ability", pvptalent = 3, titleSuffix = L["cooldown"]},-- Holy Ward - { spell = 213610, type="buff", unit = "target", pvptalent = 3, titleSuffix = L["buff"]},-- Holy Ward - { spell = 215982, type="ability", pvptalent = 6},-- Spirit of the Redeemer - { spell = 232707, type="buff", unit = "target", pvptalent = 5, titleSuffix = L["buff"]},-- Ray of Hope - { spell = 289657, type="ability", pvptalent = 9, titleSuffix = L["cooldown"]},-- Holy Word: Concentration - { spell = 289655, type="buff", unit = "player", pvptalent = 9, titleSuffix = L["buff"]},-- Holy Word: Concentration - { spell = 289666, type="ability", pvptalent = 11, titleSuffix = L["cooldown"]},-- Greater Heal - { spell = 316262, type="ability", pvptalent = 7, titleSuffix = L["cooldown"]},-- Thoughtsteal - { spell = 328530, type="ability", pvptalent = 8, titleSuffix = L["cooldown"]},-- Divine Ascension + { spell = 197268, type = "ability", pvptalent = 5, titleSuffix = L["cooldown"] }, -- Ray of Hope + { spell = 213602, type = "ability", pvptalent = 4, titleSuffix = L["cooldown"] }, -- Greater Fade + { spell = 213602, type = "buff", unit = "player", pvptalent = 4, titleSuffix = L["buff"] }, -- Greater Fade + { spell = 213610, type = "ability", pvptalent = 3, titleSuffix = L["cooldown"] }, -- Holy Ward + { spell = 213610, type = "buff", unit = "target", pvptalent = 3, titleSuffix = L["buff"] }, -- Holy Ward + { spell = 215982, type = "ability", pvptalent = 6 }, -- Spirit of the Redeemer + { spell = 232707, type = "buff", unit = "target", pvptalent = 5, titleSuffix = L["buff"] }, -- Ray of Hope + { spell = 289657, type = "ability", pvptalent = 9, titleSuffix = L["cooldown"] }, -- Holy Word: Concentration + { spell = 289655, type = "buff", unit = "player", pvptalent = 9, titleSuffix = L["buff"] }, -- Holy Word: Concentration + { spell = 289666, type = "ability", pvptalent = 11, titleSuffix = L["cooldown"] }, -- Greater Heal + { spell = 316262, type = "ability", pvptalent = 7, titleSuffix = L["cooldown"] }, -- Thoughtsteal + { spell = 328530, type = "ability", pvptalent = 8, titleSuffix = L["cooldown"] }, -- Divine Ascension }, icon = "Interface\\Icons\\Achievement_BG_winWSG", }, [11] = { title = L["Resources"], - args = { - }, + args = {}, icon = manaIcon, }, }, @@ -1713,96 +1696,96 @@ templates.class.PRIEST = { [1] = { title = L["Buffs"], args = { - { spell = 17, type = "buff", unit = "player"}, -- Power Word: Shield - { spell = 586, type = "buff", unit = "player"}, -- Fade - { spell = 2096, type = "buff", unit = "player"}, -- Mind Vision - { spell = 10060, type = "buff", unit = "player"}, -- Power Infusion - { spell = 15286, type = "buff", unit = "player"}, -- Vampiric Embrace - { spell = 19236, type = "buff", unit = "player"}, -- Desperate Prayer + { spell = 17, type = "buff", unit = "player" }, -- Power Word: Shield + { spell = 586, type = "buff", unit = "player" }, -- Fade + { spell = 2096, type = "buff", unit = "player" }, -- Mind Vision + { spell = 10060, type = "buff", unit = "player" }, -- Power Infusion + { spell = 15286, type = "buff", unit = "player" }, -- Vampiric Embrace + { spell = 19236, type = "buff", unit = "player" }, -- Desperate Prayer { spell = 21562, type = "buff", unit = "player", forceOwnOnly = true, ownOnly = nil }, -- Power Word: Fortitude { spell = 45243, type = "buff", unit = "player" }, -- Focused Will - { spell = 47585, type = "buff", unit = "player"}, -- Dispersion - { spell = 65081, type = "buff", unit = "player", talent = 4}, -- Body and Soul - { spell = 111759, type = "buff", unit = "player"}, -- Levitate - { spell = 124430, type = "buff", unit = "player", talent = 2}, -- Shadowy Insight - { spell = 123254, type = "buff", unit = "player", talent = 7}, -- Twist of Fate - { spell = 193223, type = "buff", unit = "player", talent = 21}, -- Surrender to Madness - { spell = 194249, type = "buff", unit = "player"}, -- Voidform - { spell = 197937, type = "buff", unit = "player", talent = 16}, -- Lingering Insanity - { spell = 232698, type = "buff", unit = "player"}, -- Shadowform - { spell = 263165, type = "buff", unit = "player", talent = 18}, -- Void Torrent - { spell = 319952, type = "buff", unit = "player", talent = 21}, -- Surrender to Madness - { spell = 321973, type = "buff", unit = "player", talent = 2}, -- Death and Madness - { spell = 341207, type = "buff", unit = "player"}, -- Dark Thoughts - { spell = 341282, type = "buff", unit = "player", talent = 3}, -- Unfurling Darkness - }, - icon = 237566 + { spell = 47585, type = "buff", unit = "player" }, -- Dispersion + { spell = 65081, type = "buff", unit = "player", talent = 4 }, -- Body and Soul + { spell = 111759, type = "buff", unit = "player" }, -- Levitate + { spell = 124430, type = "buff", unit = "player", talent = 2 }, -- Shadowy Insight + { spell = 123254, type = "buff", unit = "player", talent = 7 }, -- Twist of Fate + { spell = 193223, type = "buff", unit = "player", talent = 21 }, -- Surrender to Madness + { spell = 194249, type = "buff", unit = "player" }, -- Voidform + { spell = 197937, type = "buff", unit = "player", talent = 16 }, -- Lingering Insanity + { spell = 232698, type = "buff", unit = "player" }, -- Shadowform + { spell = 263165, type = "buff", unit = "player", talent = 18 }, -- Void Torrent + { spell = 319952, type = "buff", unit = "player", talent = 21 }, -- Surrender to Madness + { spell = 321973, type = "buff", unit = "player", talent = 2 }, -- Death and Madness + { spell = 341207, type = "buff", unit = "player" }, -- Dark Thoughts + { spell = 341282, type = "buff", unit = "player", talent = 3 }, -- Unfurling Darkness + }, + icon = 237566, }, [2] = { title = L["Debuffs"], args = { - { spell = 589, type = "debuff", unit = "target"}, -- Shadow Word: Pain - { spell = 2096, type = "debuff", unit = "target"}, -- Mind Vision - { spell = 8122, type = "debuff", unit = "target"}, -- Psychic Scream + { spell = 589, type = "debuff", unit = "target" }, -- Shadow Word: Pain + { spell = 2096, type = "debuff", unit = "target" }, -- Mind Vision + { spell = 8122, type = "debuff", unit = "target" }, -- Psychic Scream { spell = 9484, type = "debuff", unit = "multi" }, -- Shackle Undead - { spell = 15407, type = "debuff", unit = "target"}, -- Mind Flay - { spell = 15487, type = "debuff", unit = "target"}, -- Silence - { spell = 34914, type = "debuff", unit = "target"}, -- Vampiric Touch - { spell = 48045, type = "debuff", unit = "target"}, -- Mind Sear - { spell = 64044, type = "debuff", unit = "target"}, -- Psychic Horror - { spell = 205369, type = "debuff", unit = "target", talent = 11}, -- Mind Bomb - { spell = 226943, type = "debuff", unit = "target", talent = 11}, -- Mind Bomb - { spell = 263165, type = "debuff", unit = "target", talent = 18}, -- Void Torrent - { spell = 335467, type = "debuff", unit = "target"}, -- Devouring Plague - { spell = 341291, type = "debuff", unit = "player", talent = 3}, -- Unfurling Darkness - }, - icon = 136207 + { spell = 15407, type = "debuff", unit = "target" }, -- Mind Flay + { spell = 15487, type = "debuff", unit = "target" }, -- Silence + { spell = 34914, type = "debuff", unit = "target" }, -- Vampiric Touch + { spell = 48045, type = "debuff", unit = "target" }, -- Mind Sear + { spell = 64044, type = "debuff", unit = "target" }, -- Psychic Horror + { spell = 205369, type = "debuff", unit = "target", talent = 11 }, -- Mind Bomb + { spell = 226943, type = "debuff", unit = "target", talent = 11 }, -- Mind Bomb + { spell = 263165, type = "debuff", unit = "target", talent = 18 }, -- Void Torrent + { spell = 335467, type = "debuff", unit = "target" }, -- Devouring Plague + { spell = 341291, type = "debuff", unit = "player", talent = 3 }, -- Unfurling Darkness + }, + icon = 136207, }, [3] = { title = L["Abilities"], args = { - { spell = 17, type = "ability", buff = true}, -- Power Word: Shield - { spell = 453, type = "ability"}, -- Mind Soothe - { spell = 528, type = "ability"}, -- Dispel Magic - { spell = 585, type = "ability"}, -- Mind Flay - { spell = 586, type = "ability", buff = true}, -- Fade - { spell = 589, type = "ability", debuff = true}, -- Shadow Word: Pain - { spell = 605, type = "ability", buff = true}, -- Mind Control - { spell = 1706, type = "ability", buff = true}, -- Levitate - { spell = 2006, type = "ability"}, -- Resurrection - { spell = 2096, type = "ability"}, -- Mind Vision - { spell = 2061, type = "ability"}, -- Shadow Mend - { spell = 8092, type = "ability", requiresTarget = true}, -- Mind Blast - { spell = 8122, type = "ability"}, -- Psychic Scream - { spell = 9484, type = "ability"}, -- Shackle Undead - { spell = 10060, type = "ability", buff = true}, -- Power Infusion - { spell = 15286, type = "ability", buff = true}, -- Vampiric Embrace - { spell = 15487, type = "ability", requiresTarget = true}, -- Silence - { spell = 19236, type = "ability", buff = true}, -- Desperate Prayer - { spell = 32379, type = "ability"}, -- Shadow Word: Death - { spell = 32375, type = "ability"}, -- Mass Dispel - { spell = 34915, type = "ability", debuff = true}, -- Vampiric Touch - { spell = 32379, type = "ability", charges = true, usable = true, requiresTarget = true}, -- Shadow Word: Death - { spell = 34433, type = "ability", totem = true, requiresTarget = true}, -- Shadowfiend - { spell = 47585, type = "ability", buff = true}, -- Dispersion - { spell = 48045, type = "ability"}, -- Mind Sear - { spell = 64044, type = "ability", requiresTarget = true, talent = 12}, -- Psychic Horror - { spell = 73325, type = "ability"}, -- Leap of Faith - { spell = 200174, type = "ability", totem = true, requiresTarget = true, talent = 17}, -- Mindbender - { spell = 205351, type = "ability", charges = true, requiresTarget = true, talent = 3}, -- Shadow Word: Void - { spell = 205369, type = "ability", requiresTarget = true, talent = 11}, -- Mind Bomb - { spell = 205448, type = "ability", usable = true, requiresTarget = true}, -- Void Bolt - { spell = 213634, type = "ability"}, -- Purify Disease - { spell = 228260, type = "ability", requiresTarget = true}, -- Void Eruption - { spell = 263165, type = "ability", requiresTarget = true, talent = 18}, -- Void Torrent - { spell = 263346, type = "ability", requiresTarget = true, talent = 9}, -- Dark Void - { spell = 319952, type = "ability", talent = 21}, -- Surrender to Madness - { spell = 341374, type = "ability", talent = 16}, -- Damnation - { spell = 341385, type = "ability", requiresTarget = true, usable = true, talent = 9}, -- Searing Nightmares - { spell = 342834, type = "ability", talent = 15}, -- Shadow Crash - { spell = 335467, type = "ability", requiresTarget = true, usable = true, debuff = true}, -- Devouring Plague - }, - icon = 136230 + { spell = 17, type = "ability", buff = true }, -- Power Word: Shield + { spell = 453, type = "ability" }, -- Mind Soothe + { spell = 528, type = "ability" }, -- Dispel Magic + { spell = 585, type = "ability" }, -- Mind Flay + { spell = 586, type = "ability", buff = true }, -- Fade + { spell = 589, type = "ability", debuff = true }, -- Shadow Word: Pain + { spell = 605, type = "ability", buff = true }, -- Mind Control + { spell = 1706, type = "ability", buff = true }, -- Levitate + { spell = 2006, type = "ability" }, -- Resurrection + { spell = 2096, type = "ability" }, -- Mind Vision + { spell = 2061, type = "ability" }, -- Shadow Mend + { spell = 8092, type = "ability", requiresTarget = true }, -- Mind Blast + { spell = 8122, type = "ability" }, -- Psychic Scream + { spell = 9484, type = "ability" }, -- Shackle Undead + { spell = 10060, type = "ability", buff = true }, -- Power Infusion + { spell = 15286, type = "ability", buff = true }, -- Vampiric Embrace + { spell = 15487, type = "ability", requiresTarget = true }, -- Silence + { spell = 19236, type = "ability", buff = true }, -- Desperate Prayer + { spell = 32379, type = "ability" }, -- Shadow Word: Death + { spell = 32375, type = "ability" }, -- Mass Dispel + { spell = 34915, type = "ability", debuff = true }, -- Vampiric Touch + { spell = 32379, type = "ability", charges = true, usable = true, requiresTarget = true }, -- Shadow Word: Death + { spell = 34433, type = "ability", totem = true, requiresTarget = true }, -- Shadowfiend + { spell = 47585, type = "ability", buff = true }, -- Dispersion + { spell = 48045, type = "ability" }, -- Mind Sear + { spell = 64044, type = "ability", requiresTarget = true, talent = 12 }, -- Psychic Horror + { spell = 73325, type = "ability" }, -- Leap of Faith + { spell = 200174, type = "ability", totem = true, requiresTarget = true, talent = 17 }, -- Mindbender + { spell = 205351, type = "ability", charges = true, requiresTarget = true, talent = 3 }, -- Shadow Word: Void + { spell = 205369, type = "ability", requiresTarget = true, talent = 11 }, -- Mind Bomb + { spell = 205448, type = "ability", usable = true, requiresTarget = true }, -- Void Bolt + { spell = 213634, type = "ability" }, -- Purify Disease + { spell = 228260, type = "ability", requiresTarget = true }, -- Void Eruption + { spell = 263165, type = "ability", requiresTarget = true, talent = 18 }, -- Void Torrent + { spell = 263346, type = "ability", requiresTarget = true, talent = 9 }, -- Dark Void + { spell = 319952, type = "ability", talent = 21 }, -- Surrender to Madness + { spell = 341374, type = "ability", talent = 16 }, -- Damnation + { spell = 341385, type = "ability", requiresTarget = true, usable = true, talent = 9 }, -- Searing Nightmares + { spell = 342834, type = "ability", talent = 15 }, -- Shadow Crash + { spell = 335467, type = "ability", requiresTarget = true, usable = true, debuff = true }, -- Devouring Plague + }, + icon = 136230, }, [4] = {}, [5] = {}, @@ -1813,19 +1796,18 @@ templates.class.PRIEST = { [10] = { title = L["PvP Talents"], args = { - { spell = 108968, type="ability", pvptalent = 3},-- Void Shift - { spell = 213602, type="buff", unit = "target", pvptalent = 7},-- Greater Fade - { spell = 211522, type="ability", pvptalent = 4},-- Psyfiend - { spell = 247776, type="buff", unit = "player", pvptalent = 1, titleSuffix = L["buff"]},-- Mind Trauma - { spell = 247777, type="debuff", unit = "target", pvptalent = 1, titleSuffix = L["debuff"]},-- Mind Trauma - { spell = 316262, type="ability", pvptalent = 2, titleSuffix = L["cooldown"]},-- Thoughtsteal + { spell = 108968, type = "ability", pvptalent = 3 }, -- Void Shift + { spell = 213602, type = "buff", unit = "target", pvptalent = 7 }, -- Greater Fade + { spell = 211522, type = "ability", pvptalent = 4 }, -- Psyfiend + { spell = 247776, type = "buff", unit = "player", pvptalent = 1, titleSuffix = L["buff"] }, -- Mind Trauma + { spell = 247777, type = "debuff", unit = "target", pvptalent = 1, titleSuffix = L["debuff"] }, -- Mind Trauma + { spell = 316262, type = "ability", pvptalent = 2, titleSuffix = L["cooldown"] }, -- Thoughtsteal }, icon = "Interface\\Icons\\Achievement_BG_winWSG", }, [11] = { title = L["Resources"], - args = { - }, + args = {}, icon = "Interface\\Icons\\spell_priest_shadoworbs", }, }, @@ -1836,97 +1818,96 @@ templates.class.SHAMAN = { [1] = { title = L["Buffs"], args = { - { spell = 546, type = "buff", unit = "player"}, -- Water Walking - { spell = 974, type = "buff", unit = "player", talent = 8}, -- Earth Shield - { spell = 2645, type = "buff", unit = "player"}, -- Ghost Wolf - { spell = 6196, type = "buff", unit = "player"}, -- Far Sight - { spell = 77762, type = "buff", unit = "player"}, -- Lava Surge - { spell = 79206, type = "buff", unit = "player"}, -- Spiritwalker's Grace - { spell = 108271, type = "buff", unit = "player"}, -- Astral Shift - { spell = 108281, type = "buff", unit = "player", talent = 14}, -- Ancestral Guidance - { spell = 114050, type = "buff", unit = "player", talent = 21}, -- Ascendance - { spell = 118522, type = "buff", unit = "player", talent = 6}, -- Elemental Blast: Critical Strike - { spell = 157348, type = "buff", unit = "pet", talent = {11,17}}, -- Call Lightning - { spell = 173183, type = "buff", unit = "player", talent = 6}, -- Elemental Blast: Haste - { spell = 173184, type = "buff", unit = "player", talent = 6}, -- Elemental Blast: Mastery - { spell = 191634, type = "buff", unit = "player", talent = 20}, -- Stormkeeper - { spell = 192082, type = "buff", unit = "player", talent = 15}, -- Wind Rush - { spell = 202192, type = "buff", unit = "player", talent = 6}, -- Resonance Totem - { spell = 210652, type = "buff", unit = "player", talent = 6}, -- Storm Totem - { spell = 210658, type = "buff", unit = "player", talent = 6}, -- Ember Totem - { spell = 210659, type = "buff", unit = "player", talent = 6}, -- Tailwind Totem - { spell = 210714, type = "buff", unit = "player", talent = 18}, -- Icefury - { spell = 260734, type = "buff", unit = "player", talent = 10}, -- Master of the Elements - { spell = 260881, type = "buff", unit = "player", talent = 7}, -- Spirit Wolf - { spell = 272737, type = "buff", unit = "player", talent = 19}, -- Unlimited Power - { spell = 285514, type = "buff", unit = "player", talent = 16}, -- Surge of Power + { spell = 546, type = "buff", unit = "player" }, -- Water Walking + { spell = 974, type = "buff", unit = "player", talent = 8 }, -- Earth Shield + { spell = 2645, type = "buff", unit = "player" }, -- Ghost Wolf + { spell = 6196, type = "buff", unit = "player" }, -- Far Sight + { spell = 77762, type = "buff", unit = "player" }, -- Lava Surge + { spell = 79206, type = "buff", unit = "player" }, -- Spiritwalker's Grace + { spell = 108271, type = "buff", unit = "player" }, -- Astral Shift + { spell = 108281, type = "buff", unit = "player", talent = 14 }, -- Ancestral Guidance + { spell = 114050, type = "buff", unit = "player", talent = 21 }, -- Ascendance + { spell = 118522, type = "buff", unit = "player", talent = 6 }, -- Elemental Blast: Critical Strike + { spell = 157348, type = "buff", unit = "pet", talent = { 11, 17 } }, -- Call Lightning + { spell = 173183, type = "buff", unit = "player", talent = 6 }, -- Elemental Blast: Haste + { spell = 173184, type = "buff", unit = "player", talent = 6 }, -- Elemental Blast: Mastery + { spell = 191634, type = "buff", unit = "player", talent = 20 }, -- Stormkeeper + { spell = 192082, type = "buff", unit = "player", talent = 15 }, -- Wind Rush + { spell = 202192, type = "buff", unit = "player", talent = 6 }, -- Resonance Totem + { spell = 210652, type = "buff", unit = "player", talent = 6 }, -- Storm Totem + { spell = 210658, type = "buff", unit = "player", talent = 6 }, -- Ember Totem + { spell = 210659, type = "buff", unit = "player", talent = 6 }, -- Tailwind Totem + { spell = 210714, type = "buff", unit = "player", talent = 18 }, -- Icefury + { spell = 260734, type = "buff", unit = "player", talent = 10 }, -- Master of the Elements + { spell = 260881, type = "buff", unit = "player", talent = 7 }, -- Spirit Wolf + { spell = 272737, type = "buff", unit = "player", talent = 19 }, -- Unlimited Power + { spell = 285514, type = "buff", unit = "player", talent = 16 }, -- Surge of Power -- Enchant - { spell = 318038, type = "weaponenchant", enchant = 5400, weapon = "main"}, -- Flametongue Weapon + { spell = 318038, type = "weaponenchant", enchant = 5400, weapon = "main" }, -- Flametongue Weapon }, - icon = 135863 + icon = 135863, }, [2] = { title = L["Debuffs"], args = { - { spell = 3600, type = "debuff", unit = "target"}, -- Earthbind - { spell = 51490, type = "debuff", unit = "target"}, -- Thunderstorm - { spell = 118297, type = "debuff", unit = "target"}, -- Immolate - { spell = 118345, type = "debuff", unit = "target"}, -- Pulverize - { spell = 118905, type = "debuff", unit = "target"}, -- Static Charge - { spell = 188389, type = "debuff", unit = "target"}, -- Flame Shock - { spell = 157375, type = "debuff", unit = "target"}, -- Eye of the Storm - { spell = 196840, type = "debuff", unit = "target"}, -- Frost Shock - { spell = 269808, type = "debuff", unit = "target", talent = 1}, -- Exposed Elements - + { spell = 3600, type = "debuff", unit = "target" }, -- Earthbind + { spell = 51490, type = "debuff", unit = "target" }, -- Thunderstorm + { spell = 118297, type = "debuff", unit = "target" }, -- Immolate + { spell = 118345, type = "debuff", unit = "target" }, -- Pulverize + { spell = 118905, type = "debuff", unit = "target" }, -- Static Charge + { spell = 188389, type = "debuff", unit = "target" }, -- Flame Shock + { spell = 157375, type = "debuff", unit = "target" }, -- Eye of the Storm + { spell = 196840, type = "debuff", unit = "target" }, -- Frost Shock + { spell = 269808, type = "debuff", unit = "target", talent = 1 }, -- Exposed Elements }, - icon = 135813 + icon = 135813, }, [3] = { title = L["Abilities"], args = { - { spell = 370, type = "ability"}, -- Purge - { spell = 556, type = "ability"}, -- Astral Recall - { spell = 1064, type = "ability"}, -- Chain Heal - { spell = 2008, type = "ability"}, -- Ancestral Spirit - { spell = 2484, type = "ability", totem = true}, -- Earthbind Totem - { spell = 2825, type = "ability", buff = true}, -- Bloodlust - { spell = 5394, type = "ability", totem = true}, -- Healing Stream Totem - { spell = 6196, type = "ability"}, -- Far Sight - { spell = 8004, type = "ability"}, -- Healing Surge - { spell = 8042, type = "ability"}, -- Earth Shock - { spell = 8143, type = "ability", totem = true}, -- Tremor Totem - { spell = 32182, type = "ability", buff = true}, -- Heroism - { spell = 51490, type = "ability"}, -- Thunderstorm - { spell = 51505, type = "ability", requiresTarget = true, talent = {1,3}, overlayGlow = true}, -- Lava Burst - { spell = 51505, type = "ability", charges = true, requiresTarget = true, talent = 2, titleSuffix = " (2 Charges)", overlayGlow = true}, -- Lava Burst - { spell = 51514, type = "ability", requiresTarget = true}, -- Hex - { spell = 51886, type = "ability"}, -- Cleanse Spirit - { spell = 57994, type = "ability", requiresTarget = true}, -- Wind Shear - { spell = 61882, type = "ability"}, -- Earthquake - { spell = 73899, type = "ability", requiresTarget = true}, -- Primal Strike - { spell = 79206, type = "ability", buff = true}, -- Spiritwalker's Grace - { spell = 108271, type = "ability", buff = true}, -- Astral Shift - { spell = 108281, type = "ability", buff = true, talent = 14}, -- Ancestral Guidance - { spell = 114050, type = "ability", buff = true, talent = 21}, -- Ascendance - { spell = 117014, type = "ability", requiresTarget = true, talent = 6}, -- Elemental Blast - { spell = 188196, type = "ability", requiresTarget = true}, -- Lightning Bolt - { spell = 188389, type = "ability", debuff = true, requiresTarget = true}, -- Flame Shock - { spell = 188443, type = "ability", requiresTarget = true}, -- Chain Lightning - { spell = 191634, type = "ability", buff = true, talent = 20}, -- Stormkeeper - { spell = 192106, type = "ability", buff = true}, -- Lightning Shield - { spell = 192058, type = "ability", totem = true}, -- Capacitor Totem - { spell = 192077, type = "ability", totem = true, talent = 15}, -- Wind Rush Totem - { spell = 192222, type = "ability", totem = true, talent = 12}, -- Liquid Magma Totem - { spell = 192249, type = "ability", duration = 30, talent = 11}, -- Storm Elemental - { spell = 196840, type = "ability", debuff = true}, -- Frost Shock - { spell = 198067, type = "ability", duration = 30}, -- Fire Elemental - { spell = 198103, type = "ability", duration = 60}, -- Earth Elemental - { spell = 210714, type = "ability", debuff = true, requiresTarget = true, talent = 18}, -- Icefury - { spell = 320125, type = "ability", talent = 5}, -- Echoing Shock - { spell = 342243, type = "ability", talent = 3}, -- Static Discharge - }, - icon = 135963 + { spell = 370, type = "ability" }, -- Purge + { spell = 556, type = "ability" }, -- Astral Recall + { spell = 1064, type = "ability" }, -- Chain Heal + { spell = 2008, type = "ability" }, -- Ancestral Spirit + { spell = 2484, type = "ability", totem = true }, -- Earthbind Totem + { spell = 2825, type = "ability", buff = true }, -- Bloodlust + { spell = 5394, type = "ability", totem = true }, -- Healing Stream Totem + { spell = 6196, type = "ability" }, -- Far Sight + { spell = 8004, type = "ability" }, -- Healing Surge + { spell = 8042, type = "ability" }, -- Earth Shock + { spell = 8143, type = "ability", totem = true }, -- Tremor Totem + { spell = 32182, type = "ability", buff = true }, -- Heroism + { spell = 51490, type = "ability" }, -- Thunderstorm + { spell = 51505, type = "ability", requiresTarget = true, talent = { 1, 3 }, overlayGlow = true }, -- Lava Burst + { spell = 51505, type = "ability", charges = true, requiresTarget = true, talent = 2, titleSuffix = " (2 Charges)", overlayGlow = true }, -- Lava Burst + { spell = 51514, type = "ability", requiresTarget = true }, -- Hex + { spell = 51886, type = "ability" }, -- Cleanse Spirit + { spell = 57994, type = "ability", requiresTarget = true }, -- Wind Shear + { spell = 61882, type = "ability" }, -- Earthquake + { spell = 73899, type = "ability", requiresTarget = true }, -- Primal Strike + { spell = 79206, type = "ability", buff = true }, -- Spiritwalker's Grace + { spell = 108271, type = "ability", buff = true }, -- Astral Shift + { spell = 108281, type = "ability", buff = true, talent = 14 }, -- Ancestral Guidance + { spell = 114050, type = "ability", buff = true, talent = 21 }, -- Ascendance + { spell = 117014, type = "ability", requiresTarget = true, talent = 6 }, -- Elemental Blast + { spell = 188196, type = "ability", requiresTarget = true }, -- Lightning Bolt + { spell = 188389, type = "ability", debuff = true, requiresTarget = true }, -- Flame Shock + { spell = 188443, type = "ability", requiresTarget = true }, -- Chain Lightning + { spell = 191634, type = "ability", buff = true, talent = 20 }, -- Stormkeeper + { spell = 192106, type = "ability", buff = true }, -- Lightning Shield + { spell = 192058, type = "ability", totem = true }, -- Capacitor Totem + { spell = 192077, type = "ability", totem = true, talent = 15 }, -- Wind Rush Totem + { spell = 192222, type = "ability", totem = true, talent = 12 }, -- Liquid Magma Totem + { spell = 192249, type = "ability", duration = 30, talent = 11 }, -- Storm Elemental + { spell = 196840, type = "ability", debuff = true }, -- Frost Shock + { spell = 198067, type = "ability", duration = 30 }, -- Fire Elemental + { spell = 198103, type = "ability", duration = 60 }, -- Earth Elemental + { spell = 210714, type = "ability", debuff = true, requiresTarget = true, talent = 18 }, -- Icefury + { spell = 320125, type = "ability", talent = 5 }, -- Echoing Shock + { spell = 342243, type = "ability", talent = 3 }, -- Static Discharge + }, + icon = 135963, }, [4] = {}, [5] = {}, @@ -1937,22 +1918,21 @@ templates.class.SHAMAN = { [10] = { title = L["PvP Talents"], args = { - { spell = 8178, type="buff", unit = "target", pvptalent = 9, titleSuffix = L["buff"]},-- Grounding Totem - { spell = 204330, type="ability", totem = true, pvptalent = 3, titleSuffix = L["cooldown"]},-- Skyfury Totem - { spell = 204331, type="ability", totem = true, pvptalent = 8, titleSuffix = L["cooldown"]},-- Counterstrike Totem - { spell = 204336, type="ability", totem = true, pvptalent = 9, titleSuffix = L["cooldown"]},-- Grounding Totem - { spell = 208963, type="buff", unit = "player", pvptalent = 3, titleSuffix = L["buff"]},-- Skyfury Totem - { spell = 208997, type="debuff", unit = "target", pvptalent = 8, titleSuffix = L["debuff"]},-- Counterstrike Totem - { spell = 236746, type="buff", unit = "player", pvptalent = 5},-- Control of Lava - { spell = 305483, type="ability", pvptalent = 2, titleSuffix = L["cooldown"]},-- Lightning Lasso - { spell = 305485, type="debuff", unit = "target", pvptalent = 2, titleSuffix = L["debuff"]},-- Lightning Lasso + { spell = 8178, type = "buff", unit = "target", pvptalent = 9, titleSuffix = L["buff"] }, -- Grounding Totem + { spell = 204330, type = "ability", totem = true, pvptalent = 3, titleSuffix = L["cooldown"] }, -- Skyfury Totem + { spell = 204331, type = "ability", totem = true, pvptalent = 8, titleSuffix = L["cooldown"] }, -- Counterstrike Totem + { spell = 204336, type = "ability", totem = true, pvptalent = 9, titleSuffix = L["cooldown"] }, -- Grounding Totem + { spell = 208963, type = "buff", unit = "player", pvptalent = 3, titleSuffix = L["buff"] }, -- Skyfury Totem + { spell = 208997, type = "debuff", unit = "target", pvptalent = 8, titleSuffix = L["debuff"] }, -- Counterstrike Totem + { spell = 236746, type = "buff", unit = "player", pvptalent = 5 }, -- Control of Lava + { spell = 305483, type = "ability", pvptalent = 2, titleSuffix = L["cooldown"] }, -- Lightning Lasso + { spell = 305485, type = "debuff", unit = "target", pvptalent = 2, titleSuffix = L["debuff"] }, -- Lightning Lasso }, icon = "Interface\\Icons\\Achievement_BG_winWSG", }, [11] = { title = L["Resources"], - args = { - }, + args = {}, icon = 135990, }, }, @@ -1960,23 +1940,23 @@ templates.class.SHAMAN = { [1] = { title = L["Buffs"], args = { - { spell = 546, type = "buff", unit = "player"}, -- Water Walking + { spell = 546, type = "buff", unit = "player" }, -- Water Walking { spell = 974, type = "buff", unit = "player", talent = 8 }, -- Earth Shield - { spell = 2645, type = "buff", unit = "player"}, -- Ghost Wolf - { spell = 6196, type = "buff", unit = "player"}, -- Far Sight - { spell = 58875, type = "buff", unit = "player"}, -- Spirit Walk - { spell = 108271, type = "buff", unit = "player"}, -- Astral Shift + { spell = 2645, type = "buff", unit = "player" }, -- Ghost Wolf + { spell = 6196, type = "buff", unit = "player" }, -- Far Sight + { spell = 58875, type = "buff", unit = "player" }, -- Spirit Walk + { spell = 108271, type = "buff", unit = "player" }, -- Astral Shift { spell = 114051, type = "buff", unit = "player", talent = 21 }, -- Ascendance { spell = 118522, type = "buff", unit = "player", talent = 3 }, -- Elemental Blast: Crit { spell = 173183, type = "buff", unit = "player", talent = 3 }, -- Elemental Blast: Haste { spell = 173184, type = "buff", unit = "player", talent = 3 }, -- Elemental Blast: Mastery - { spell = 187878, type = "buff", unit = "player"}, -- Crash Lightning + { spell = 187878, type = "buff", unit = "player" }, -- Crash Lightning { spell = 192082, type = "buff", unit = "player", talent = 15 }, -- Wind Rush { spell = 192106, type = "buff", unit = "player", talent = 3 }, -- Lightning Shield - { spell = 196834, type = "buff", unit = "player"}, -- Frostbrand + { spell = 196834, type = "buff", unit = "player" }, -- Frostbrand { spell = 197211, type = "buff", unit = "player", talent = 17 }, -- Fury of Air - { spell = 198300, type = "buff", unit = "player"}, -- Gathering Storms - { spell = 201846, type = "buff", unit = "player"}, -- Stormbringer + { spell = 198300, type = "buff", unit = "player" }, -- Gathering Storms + { spell = 201846, type = "buff", unit = "player" }, -- Stormbringer { spell = 202004, type = "buff", unit = "player", talent = 4 }, -- Landslide { spell = 215785, type = "buff", unit = "player", talent = 5 }, -- Hot Hand { spell = 224125, type = "buff", unit = "player", talent = 19 }, -- Molten Weapon @@ -1994,68 +1974,66 @@ templates.class.SHAMAN = { { spell = 334196, type = "buff", unit = "player", talent = 11 }, -- Hailstorm -- Enchant - { spell = 33757, type = "weaponenchant", enchant = 5401, weapon = "main"}, -- Windfury Weapon - - - { spell = 318038, type = "weaponenchant", enchant = 5400, weapon = "off"}, -- Flametongue Weapon + { spell = 33757, type = "weaponenchant", enchant = 5401, weapon = "main" }, -- Windfury Weapon + { spell = 318038, type = "weaponenchant", enchant = 5400, weapon = "off" }, -- Flametongue Weapon }, - icon = 136099 + icon = 136099, }, [2] = { title = L["Debuffs"], args = { - { spell = 3600, type = "debuff", unit = "target"}, -- Earthbind - { spell = 118905, type = "debuff", unit = "target"}, -- Static Charge - { spell = 147732, type = "debuff", unit = "target"}, -- Frostbrand + { spell = 3600, type = "debuff", unit = "target" }, -- Earthbind + { spell = 118905, type = "debuff", unit = "target" }, -- Static Charge + { spell = 147732, type = "debuff", unit = "target" }, -- Frostbrand { spell = 188089, type = "debuff", unit = "target", talent = 20 }, -- Earthen Spike { spell = 197214, type = "debuff", unit = "target", talent = 18 }, -- Sundering { spell = 197385, type = "debuff", unit = "target", talent = 17 }, -- Fury of Air { spell = 268429, type = "debuff", unit = "target", talent = 10 }, -- Searing Assault { spell = 271924, type = "debuff", unit = "target", talent = 19 }, -- Molten Weapon - { spell = 334046, type = "debuff", unit = "target", talent = 1}, -- Lashing Flames + { spell = 334046, type = "debuff", unit = "target", talent = 1 }, -- Lashing Flames }, - icon = 462327 + icon = 462327, }, [3] = { title = L["Abilities"], args = { - { spell = 370, type = "ability"}, -- Purge - { spell = 556, type = "ability"}, -- Astral Recall - { spell = 974, type = "ability", talent = 8}, -- Earth Shield - { spell = 1064, type = "ability"}, -- Chain Heal - { spell = 2008, type = "ability"}, -- Ancestral Spirit - { spell = 2484, type = "ability", totem = true}, -- Earthbind Totem - { spell = 2645, type = "ability"}, -- Ghost Wolf - { spell = 2825, type = "ability", buff = true}, -- Bloodlust - { spell = 5394, type = "ability", totem = true}, -- Healing Stream Totem - { spell = 6196, type = "ability"}, -- Far Sight - { spell = 8004, type = "ability"}, -- Healing Surge - { spell = 8143, type = "ability", totem = true}, -- Tremor Totem - { spell = 8512, type = "ability", totem = true}, -- Windfury Totem - { spell = 17364, type = "ability", requiresTarget = true, overlayGlow = true}, -- Stormstrike - { spell = 32182, type = "ability"}, -- Heroism - { spell = 51514, type = "ability", requiresTarget = true}, -- Hex - { spell = 51533, type = "ability", duration = 15}, -- Feral Spirit - { spell = 51886, type = "ability"}, -- Cleanse Spirit - { spell = 57994, type = "ability", requiresTarget = true}, -- Wind Shear - { spell = 58875, type = "ability", buff = true}, -- Spirit Walk - { spell = 60103, type = "ability"}, -- Lava Lash - { spell = 73899, type = "ability"}, -- Stormstrike - { spell = 108271, type = "ability", buff = true}, -- Astral Shift + { spell = 370, type = "ability" }, -- Purge + { spell = 556, type = "ability" }, -- Astral Recall + { spell = 974, type = "ability", talent = 8 }, -- Earth Shield + { spell = 1064, type = "ability" }, -- Chain Heal + { spell = 2008, type = "ability" }, -- Ancestral Spirit + { spell = 2484, type = "ability", totem = true }, -- Earthbind Totem + { spell = 2645, type = "ability" }, -- Ghost Wolf + { spell = 2825, type = "ability", buff = true }, -- Bloodlust + { spell = 5394, type = "ability", totem = true }, -- Healing Stream Totem + { spell = 6196, type = "ability" }, -- Far Sight + { spell = 8004, type = "ability" }, -- Healing Surge + { spell = 8143, type = "ability", totem = true }, -- Tremor Totem + { spell = 8512, type = "ability", totem = true }, -- Windfury Totem + { spell = 17364, type = "ability", requiresTarget = true, overlayGlow = true }, -- Stormstrike + { spell = 32182, type = "ability" }, -- Heroism + { spell = 51514, type = "ability", requiresTarget = true }, -- Hex + { spell = 51533, type = "ability", duration = 15 }, -- Feral Spirit + { spell = 51886, type = "ability" }, -- Cleanse Spirit + { spell = 57994, type = "ability", requiresTarget = true }, -- Wind Shear + { spell = 58875, type = "ability", buff = true }, -- Spirit Walk + { spell = 60103, type = "ability" }, -- Lava Lash + { spell = 73899, type = "ability" }, -- Stormstrike + { spell = 108271, type = "ability", buff = true }, -- Astral Shift { spell = 114051, type = "ability", buff = true, talent = 21 }, -- Ascendance { spell = 115356, type = "ability", talent = 21 }, -- Windstrike { spell = 117014, type = "ability", talent = 3 }, -- Elemental Blast - { spell = 188196, type = "ability"}, -- Lightning Bolt - { spell = 187874, type = "ability"}, -- Crash Lightning + { spell = 188196, type = "ability" }, -- Lightning Bolt + { spell = 187874, type = "ability" }, -- Crash Lightning { spell = 188089, type = "ability", debuff = true, requiresTarget = true, talent = 20 }, -- Earthen Spike - { spell = 188389, type = "ability", debuff = true, requiresTarget = true}, -- Flame Shock - { spell = 188443, type = "ability", requiresTarget = true}, -- Chain Lightning - { spell = 192106, type = "ability", buff = true}, -- Lightning Shield - { spell = 192058, type = "ability", totem = true}, -- Capacitor Totem + { spell = 188389, type = "ability", debuff = true, requiresTarget = true }, -- Flame Shock + { spell = 188443, type = "ability", requiresTarget = true }, -- Chain Lightning + { spell = 192106, type = "ability", buff = true }, -- Lightning Shield + { spell = 192058, type = "ability", totem = true }, -- Capacitor Totem { spell = 192077, type = "ability", totem = true, talent = 15 }, -- Wind Rush Totem - { spell = 193786, type = "ability", charges = true, requiresTarget = true}, -- Rockbiter - { spell = 193796, type = "ability", buff = true, requiresTarget = true}, -- Flametongue + { spell = 193786, type = "ability", charges = true, requiresTarget = true }, -- Rockbiter + { spell = 193796, type = "ability", buff = true, requiresTarget = true }, -- Flametongue { spell = 196884, type = "ability", requiresTarget = true, talent = 14 }, -- Feral Lunge { spell = 197214, type = "ability", talent = 18 }, -- Sundering { spell = 198103, type = "ability", duration = 60 }, -- Earth Elemental @@ -2065,7 +2043,7 @@ templates.class.SHAMAN = { { spell = 333974, type = "ability", talent = 12 }, -- Fire Nova { spell = 342240, type = "ability", talent = 6 }, -- Ice Strike }, - icon = 1370984 + icon = 1370984, }, [4] = {}, [5] = {}, @@ -2076,23 +2054,22 @@ templates.class.SHAMAN = { [10] = { title = L["PvP Talents"], args = { - { spell = 8178, type="buff", unit = "player", pvptalent = 1, titleSuffix = L["debuff"]},-- Grounding Totem - { spell = 204330, type="ability", pvptalent = 2, titleSuffix = L["cooldown"]},-- Skyfury Totem - { spell = 204331, type="ability", pvptalent = 10, titleSuffix = L["cooldown"]},-- Counterstrike Totem - { spell = 204336, type="ability", pvptalent = 1, titleSuffix = L["cooldown"]},-- Grounding Totem - { spell = 204366, type="ability", pvptalent = 8, titleSuffix = L["cooldown"]},-- Thundercharge - { spell = 204366, type="buff", unit = "player", pvptalent = 8, titleSuffix = L["buff"]},-- Thundercharge - { spell = 208963, type="buff", unit = "player", pvptalent = 2, titleSuffix = L["buff"]},-- Skyfury Totem - { spell = 208997, type="debuff", unit = "target", pvptalent = 10, titleSuffix = L["debuff"]},-- Counterstrike Totem - { spell = 210918, type="ability", pvptalent = 9, titleSuffix = L["cooldown"]},-- Ethereal Form - { spell = 210918, type="buff", unit = "player", pvptalent = 9, titleSuffix = L["buff"]},-- Ethereal Form + { spell = 8178, type = "buff", unit = "player", pvptalent = 1, titleSuffix = L["debuff"] }, -- Grounding Totem + { spell = 204330, type = "ability", pvptalent = 2, titleSuffix = L["cooldown"] }, -- Skyfury Totem + { spell = 204331, type = "ability", pvptalent = 10, titleSuffix = L["cooldown"] }, -- Counterstrike Totem + { spell = 204336, type = "ability", pvptalent = 1, titleSuffix = L["cooldown"] }, -- Grounding Totem + { spell = 204366, type = "ability", pvptalent = 8, titleSuffix = L["cooldown"] }, -- Thundercharge + { spell = 204366, type = "buff", unit = "player", pvptalent = 8, titleSuffix = L["buff"] }, -- Thundercharge + { spell = 208963, type = "buff", unit = "player", pvptalent = 2, titleSuffix = L["buff"] }, -- Skyfury Totem + { spell = 208997, type = "debuff", unit = "target", pvptalent = 10, titleSuffix = L["debuff"] }, -- Counterstrike Totem + { spell = 210918, type = "ability", pvptalent = 9, titleSuffix = L["cooldown"] }, -- Ethereal Form + { spell = 210918, type = "buff", unit = "player", pvptalent = 9, titleSuffix = L["buff"] }, -- Ethereal Form }, icon = "Interface\\Icons\\Achievement_BG_winWSG", }, [11] = { title = L["Resources"], - args = { - }, + args = {}, icon = 135990, }, }, @@ -2100,18 +2077,18 @@ templates.class.SHAMAN = { [1] = { title = L["Buffs"], args = { - { spell = 546, type = "buff", unit = "player"}, -- Water Walking + { spell = 546, type = "buff", unit = "player" }, -- Water Walking { spell = 974, type = "buff", unit = "group", talent = 6 }, -- Earth Shield - { spell = 2645, type = "buff", unit = "player"}, -- Ghost Wolf - { spell = 6196, type = "buff", unit = "player"}, -- Far Sight - { spell = 53390, type = "buff", unit = "player"}, -- Tidal Waves - { spell = 61295, type = "buff", unit = "target"}, -- Riptide + { spell = 2645, type = "buff", unit = "player" }, -- Ghost Wolf + { spell = 6196, type = "buff", unit = "player" }, -- Far Sight + { spell = 53390, type = "buff", unit = "player" }, -- Tidal Waves + { spell = 61295, type = "buff", unit = "target" }, -- Riptide { spell = 73685, type = "buff", unit = "player", talent = 3 }, -- Unleash Life - { spell = 73920, type = "buff", unit = "player"}, -- Healing Rain - { spell = 77762, type = "buff", unit = "player"}, -- Lava Surge - { spell = 79206, type = "buff", unit = "player"}, -- Spiritwalker's Grace - { spell = 98007, type = "buff", unit = "player"}, -- Spirit Link Totem - { spell = 108271, type = "buff", unit = "player"}, -- Astral Shift + { spell = 73920, type = "buff", unit = "player" }, -- Healing Rain + { spell = 77762, type = "buff", unit = "player" }, -- Lava Surge + { spell = 79206, type = "buff", unit = "player" }, -- Spiritwalker's Grace + { spell = 98007, type = "buff", unit = "player" }, -- Spirit Link Totem + { spell = 108271, type = "buff", unit = "player" }, -- Astral Shift { spell = 114052, type = "buff", unit = "player", talent = 21 }, -- Ascendance { spell = 157504, type = "buff", unit = "player", talent = 18 }, -- Cloudburst Totem { spell = 201633, type = "buff", unit = "player", talent = 11 }, -- Earthen Wall @@ -2122,47 +2099,47 @@ templates.class.SHAMAN = { { spell = 280615, type = "buff", unit = "player", talent = 16 }, -- Flash Flood -- Enchant - { spell = 318038, type = "weaponenchant", enchant = 5400, weapon = "main"}, -- Flametongue Weapon + { spell = 318038, type = "weaponenchant", enchant = 5400, weapon = "main" }, -- Flametongue Weapon }, - icon = 252995 + icon = 252995, }, [2] = { title = L["Debuffs"], args = { - { spell = 3600, type = "debuff", unit = "target"}, -- Earthbind + { spell = 3600, type = "debuff", unit = "target" }, -- Earthbind { spell = 64695, type = "debuff", unit = "target", talent = 8 }, -- Earthgrab - { spell = 118905, type = "debuff", unit = "target"}, -- Static Charge - { spell = 188389, type = "debuff", unit = "target"}, -- Flame Shock + { spell = 118905, type = "debuff", unit = "target" }, -- Static Charge + { spell = 188389, type = "debuff", unit = "target" }, -- Flame Shock }, - icon = 135813 + icon = 135813, }, [3] = { title = L["Abilities"], args = { - { spell = 556, type = "ability"}, -- Astral Recall - { spell = 2484, type = "ability", totem = true}, -- Earthbind Totem - { spell = 2825, type = "ability", buff = true}, -- Bloodlust - { spell = 5394, type = "ability", totem = true, talent = {5,6}}, -- Healing Stream Totem - { spell = 5394, type = "ability", charges = true, totem = true, talent = 4, titleSuffix = " (2 Charges)"}, -- Healing Stream Totem - { spell = 8143, type = "ability", totem = true}, -- Tremor Totem - { spell = 32182, type = "ability", buff = true}, -- Heroism + { spell = 556, type = "ability" }, -- Astral Recall + { spell = 2484, type = "ability", totem = true }, -- Earthbind Totem + { spell = 2825, type = "ability", buff = true }, -- Bloodlust + { spell = 5394, type = "ability", totem = true, talent = { 5, 6 } }, -- Healing Stream Totem + { spell = 5394, type = "ability", charges = true, totem = true, talent = 4, titleSuffix = " (2 Charges)" }, -- Healing Stream Totem + { spell = 8143, type = "ability", totem = true }, -- Tremor Totem + { spell = 32182, type = "ability", buff = true }, -- Heroism { spell = 51485, type = "ability", totem = true, talent = 8 }, -- Earthgrab Totem - { spell = 51505, type = "ability", requiresTarget = true, talent = {5,6}}, -- Lava Burst - { spell = 51505, type = "ability", charges = true, requiresTarget = true, talent = 4, titleSuffix = " (2 Charges)"}, -- Lava Burst - { spell = 51514, type = "ability", requiresTarget = true}, -- Hex - { spell = 57994, type = "ability", requiresTarget = true}, -- Wind Shear - { spell = 61295, type = "ability", talent = {5,6}}, -- Riptide - { spell = 61295, type = "ability", charges = true, talent = 4, titleSuffix = " (2 Charges)"}, -- Riptide + { spell = 51505, type = "ability", requiresTarget = true, talent = { 5, 6 } }, -- Lava Burst + { spell = 51505, type = "ability", charges = true, requiresTarget = true, talent = 4, titleSuffix = " (2 Charges)" }, -- Lava Burst + { spell = 51514, type = "ability", requiresTarget = true }, -- Hex + { spell = 57994, type = "ability", requiresTarget = true }, -- Wind Shear + { spell = 61295, type = "ability", talent = { 5, 6 } }, -- Riptide + { spell = 61295, type = "ability", charges = true, talent = 4, titleSuffix = " (2 Charges)" }, -- Riptide { spell = 73685, type = "ability", buff = true, talent = 3 }, -- Unleash Life - { spell = 73920, type = "ability", duration = 10}, -- Healing Rain - { spell = 79206, type = "ability", buff = true}, -- Spiritwalker's Grace - { spell = 98008, type = "ability", totem = true}, -- Spirit Link Totem - { spell = 108271, type = "ability", buff = true}, -- Astral Shift - { spell = 108280, type = "ability", totem = true}, -- Healing Tide Totem + { spell = 73920, type = "ability", duration = 10 }, -- Healing Rain + { spell = 79206, type = "ability", buff = true }, -- Spiritwalker's Grace + { spell = 98008, type = "ability", totem = true }, -- Spirit Link Totem + { spell = 108271, type = "ability", buff = true }, -- Astral Shift + { spell = 108280, type = "ability", totem = true }, -- Healing Tide Totem { spell = 114052, type = "ability", buff = true, talent = 21 }, -- Ascendance { spell = 157153, type = "ability", charges = true, totem = true, talent = 18 }, -- Cloudburst Totem - { spell = 188389, type = "ability", debuff = true, requiresTarget = true}, -- Flame Shock - { spell = 192058, type = "ability", totem = true}, -- Capacitor Totem + { spell = 188389, type = "ability", debuff = true, requiresTarget = true }, -- Flame Shock + { spell = 192058, type = "ability", totem = true }, -- Capacitor Totem { spell = 192077, type = "ability", totem = true, talent = 15 }, -- Wind Rush Totem { spell = 197995, type = "ability", talent = 20 }, -- Wellspring { spell = 198103, type = "ability", duration = 60 }, -- Earth Elemental @@ -2170,7 +2147,7 @@ templates.class.SHAMAN = { { spell = 207399, type = "ability", totem = true, talent = 12 }, -- Ancestral Protection Totem { spell = 207778, type = "ability", talent = 17 }, -- Downpour }, - icon = 135127 + icon = 135127, }, [4] = {}, [5] = {}, @@ -2181,24 +2158,23 @@ templates.class.SHAMAN = { [10] = { title = L["PvP Talents"], args = { - { spell = 8178, type="buff", unit = "player", pvptalent = 8, titleSuffix = L["buff"]},-- Grounding Totem - { spell = 204293, type="buff", unit = "target", pvptalent = 6},-- Spirit Link - { spell = 204330, type="ability", pvptalent = 10, titleSuffix = L["cooldown"]},-- Skyfury Totem - { spell = 204331, type="ability", pvptalent = 11, titleSuffix = L["cooldown"]},-- Counterstrike Totem - { spell = 204336, type="ability", pvptalent = 8, titleSuffix = L["cooldown"]},-- Grounding Totem - { spell = 206647, type="debuff", unit = "target", pvptalent = 5},-- Electrocute - { spell = 208963, type="buff", unit = "player", pvptalent = 10, titleSuffix = L["buff"]},-- Skyfury Totem - { spell = 208997, type="debuff", unit = "target", pvptalent = 11, titleSuffix = L["debuff"]},-- Counterstrike Totem - { spell = 236502, type="buff", unit = "player", pvptalent = 7},-- Tidebringer - { spell = 290254, type="ability", pvptalent = 4, titleSuffix = L["cooldown"]},-- Ancestral Gift - { spell = 290641, type="buff", unit = "player", pvptalent = 4, titleSuffix = L["buff"]},-- Ancestral Gift + { spell = 8178, type = "buff", unit = "player", pvptalent = 8, titleSuffix = L["buff"] }, -- Grounding Totem + { spell = 204293, type = "buff", unit = "target", pvptalent = 6 }, -- Spirit Link + { spell = 204330, type = "ability", pvptalent = 10, titleSuffix = L["cooldown"] }, -- Skyfury Totem + { spell = 204331, type = "ability", pvptalent = 11, titleSuffix = L["cooldown"] }, -- Counterstrike Totem + { spell = 204336, type = "ability", pvptalent = 8, titleSuffix = L["cooldown"] }, -- Grounding Totem + { spell = 206647, type = "debuff", unit = "target", pvptalent = 5 }, -- Electrocute + { spell = 208963, type = "buff", unit = "player", pvptalent = 10, titleSuffix = L["buff"] }, -- Skyfury Totem + { spell = 208997, type = "debuff", unit = "target", pvptalent = 11, titleSuffix = L["debuff"] }, -- Counterstrike Totem + { spell = 236502, type = "buff", unit = "player", pvptalent = 7 }, -- Tidebringer + { spell = 290254, type = "ability", pvptalent = 4, titleSuffix = L["cooldown"] }, -- Ancestral Gift + { spell = 290641, type = "buff", unit = "player", pvptalent = 4, titleSuffix = L["buff"] }, -- Ancestral Gift }, icon = "Interface\\Icons\\Achievement_BG_winWSG", }, [11] = { title = L["Resources"], - args = { - }, + args = {}, icon = manaIcon, }, }, @@ -2209,83 +2185,83 @@ templates.class.MAGE = { [1] = { title = L["Buffs"], args = { - { spell = 130, type = "buff", unit = "player"}, -- Slow Fall - { spell = 1459, type = "buff", unit = "player", forceOwnOnly = true, ownOnly = nil}, -- Arcane Intellect - { spell = 12042, type = "buff", unit = "player"}, -- Arcane Power - { spell = 12051, type = "buff", unit = "player"}, -- Evocation - { spell = 45438, type = "buff", unit = "player"}, -- Ice Block - { spell = 110960, type = "buff", unit = "player"}, -- Greater Invisibility + { spell = 130, type = "buff", unit = "player" }, -- Slow Fall + { spell = 1459, type = "buff", unit = "player", forceOwnOnly = true, ownOnly = nil }, -- Arcane Intellect + { spell = 12042, type = "buff", unit = "player" }, -- Arcane Power + { spell = 12051, type = "buff", unit = "player" }, -- Evocation + { spell = 45438, type = "buff", unit = "player" }, -- Ice Block + { spell = 110960, type = "buff", unit = "player" }, -- Greater Invisibility { spell = 116014, type = "buff", unit = "player", talent = 9 }, -- Rune of Power { spell = 116267, type = "buff", unit = "player", talent = 7 }, -- Incanter's Flow - { spell = 205025, type = "buff", unit = "player"}, -- Presence of Mind + { spell = 205025, type = "buff", unit = "player" }, -- Presence of Mind { spell = 210126, type = "buff", unit = "player", talent = 3 }, -- Arcane Familiar - { spell = 212799, type = "buff", unit = "player"}, -- Displacement Beacon + { spell = 212799, type = "buff", unit = "player" }, -- Displacement Beacon { spell = 236298, type = "buff", unit = "player", talent = 13 }, -- Chrono Shift - { spell = 263725, type = "buff", unit = "player"}, -- Clearcasting - { spell = 235450, type = "buff", unit = "player"}, -- Prismatic Barrier + { spell = 263725, type = "buff", unit = "player" }, -- Clearcasting + { spell = 235450, type = "buff", unit = "player" }, -- Prismatic Barrier { spell = 264774, type = "buff", unit = "player", talent = 2 }, -- Rule of Threes - { spell = 342246, type = "buff", unit = "player"}, -- Alter Time - { spell = 321358, type = "buff", unit = "group", titleSuffix = L["Buff on Other"]}, -- Focus Magic - { spell = 321388, type = "buff", unit = "player", talent = 21, titleSuffix = L[">70% Mana"]}, -- Enlightened - { spell = 321390, type = "buff", unit = "player", talent = 21, titleSuffix = L["<70% Mana"]}, -- Enlightened + { spell = 342246, type = "buff", unit = "player" }, -- Alter Time + { spell = 321358, type = "buff", unit = "group", titleSuffix = L["Buff on Other"] }, -- Focus Magic + { spell = 321388, type = "buff", unit = "player", talent = 21, titleSuffix = L[">70% Mana"] }, -- Enlightened + { spell = 321390, type = "buff", unit = "player", talent = 21, titleSuffix = L["<70% Mana"] }, -- Enlightened }, - icon = 136096 + icon = 136096, }, [2] = { title = L["Debuffs"], args = { { spell = 118, type = "debuff", unit = "multi" }, -- Polymorph - { spell = 122, type = "debuff", unit = "target"}, -- Frost Nova - { spell = 31589, type = "debuff", unit = "target"}, -- Slow - { spell = 41425, type = "debuff", unit = "player"}, -- Hypothermia + { spell = 122, type = "debuff", unit = "target" }, -- Frost Nova + { spell = 31589, type = "debuff", unit = "target" }, -- Slow + { spell = 41425, type = "debuff", unit = "player" }, -- Hypothermia { spell = 82691, type = "debuff", unit = "target", talent = 15 }, -- Ring of Frost { spell = 114923, type = "debuff", unit = "target", talent = 12 }, -- Nether Tempest - { spell = 205708, type = "debuff", unit = "target"}, -- Chilled - { spell = 210824, type = "debuff", unit = "target"}, -- Touch of the Magi + { spell = 205708, type = "debuff", unit = "target" }, -- Chilled + { spell = 210824, type = "debuff", unit = "target" }, -- Touch of the Magi { spell = 236299, type = "debuff", unit = "target", talent = 13 }, -- Chrono Shift }, - icon = 135848 + icon = 135848, }, [3] = { title = L["Abilities"], args = { - { spell = 66, type = "ability"}, -- Greater Invisibility - { spell = 116, type = "ability"}, -- Frostbolt - { spell = 118, type = "ability"}, -- Polymorph - { spell = 122, type = "ability"}, -- Frost Nova - { spell = 475, type = "ability"}, -- Remove Curse - { spell = 1449, type = "ability", overlayGlow = true}, -- Arcane Explosion - { spell = 1459, type = "ability"}, -- Arcane Intellect - { spell = 1953, type = "ability"}, -- Blink - { spell = 2139, type = "ability", requiresTarget = true}, -- Counterspell - { spell = 5143, type = "ability", requiresTarget = true, overlayGlow = true}, -- Arcane Missiles - { spell = 12042, type = "ability", buff = true}, -- Arcane Power - { spell = 12051, type = "ability", buff = true}, -- Evocation - { spell = 30449, type = "ability"}, -- Spellsteal - { spell = 30451, type = "ability"}, -- Arcane Blast - { spell = 31589, type = "ability"}, -- Slow - { spell = 44425, type = "ability", requiresTarget = true}, -- Arcane Barrage - { spell = 45438, type = "ability", buff = true}, -- Ice Block - { spell = 55342, type = "ability"}, -- Mirror Image - { spell = 80353, type = "ability", buff = true}, -- Time Warp - { spell = 110959, type = "ability", buff = true}, -- Greater Invisibility + { spell = 66, type = "ability" }, -- Greater Invisibility + { spell = 116, type = "ability" }, -- Frostbolt + { spell = 118, type = "ability" }, -- Polymorph + { spell = 122, type = "ability" }, -- Frost Nova + { spell = 475, type = "ability" }, -- Remove Curse + { spell = 1449, type = "ability", overlayGlow = true }, -- Arcane Explosion + { spell = 1459, type = "ability" }, -- Arcane Intellect + { spell = 1953, type = "ability" }, -- Blink + { spell = 2139, type = "ability", requiresTarget = true }, -- Counterspell + { spell = 5143, type = "ability", requiresTarget = true, overlayGlow = true }, -- Arcane Missiles + { spell = 12042, type = "ability", buff = true }, -- Arcane Power + { spell = 12051, type = "ability", buff = true }, -- Evocation + { spell = 30449, type = "ability" }, -- Spellsteal + { spell = 30451, type = "ability" }, -- Arcane Blast + { spell = 31589, type = "ability" }, -- Slow + { spell = 44425, type = "ability", requiresTarget = true }, -- Arcane Barrage + { spell = 45438, type = "ability", buff = true }, -- Ice Block + { spell = 55342, type = "ability" }, -- Mirror Image + { spell = 80353, type = "ability", buff = true }, -- Time Warp + { spell = 110959, type = "ability", buff = true }, -- Greater Invisibility { spell = 113724, type = "ability", talent = 15 }, -- Ring of Frost { spell = 114923, type = "ability", talent = 12 }, -- Nether Tempest { spell = 116011, type = "ability", charges = true, buff = true, talent = 9 }, -- Rune of Power { spell = 153626, type = "ability", talent = 17 }, -- Arcane Orb { spell = 157980, type = "ability", requiresTarget = true, talent = 18 }, -- Supernova - { spell = 190336, type = "ability"}, -- Conjure Refreshment - { spell = 195676, type = "ability", usable = true}, -- Displacement + { spell = 190336, type = "ability" }, -- Conjure Refreshment + { spell = 195676, type = "ability", usable = true }, -- Displacement { spell = 205022, type = "ability", talent = 3 }, -- Arcane Familiar - { spell = 205025, type = "ability", buff = true}, -- Presence of Mind + { spell = 205025, type = "ability", buff = true }, -- Presence of Mind { spell = 205032, type = "ability", talent = 11 }, -- Charged Up { spell = 212653, type = "ability", charges = true, talent = 5 }, -- Shimmer - { spell = 235450, type = "ability", buff = true}, -- Prismatic Barrier - { spell = 319836, type = "ability"}, -- Fire Blast - { spell = 321507, type = "ability", debuff = true}, -- Touch of the Magi - { spell = 342245, type = "ability", buff = true}, -- Alter Time + { spell = 235450, type = "ability", buff = true }, -- Prismatic Barrier + { spell = 319836, type = "ability" }, -- Fire Blast + { spell = 321507, type = "ability", debuff = true }, -- Touch of the Magi + { spell = 342245, type = "ability", buff = true }, -- Alter Time }, - icon = 136075 + icon = 136075, }, [4] = {}, [5] = {}, @@ -2296,18 +2272,17 @@ templates.class.MAGE = { [10] = { title = L["PvP Talents"], args = { - { spell = 198111, type="ability", pvptalent = 1, titleSuffix = L["cooldown"]},-- Temporal Shield - { spell = 198111, type="buff", unit = "player", pvptalent = 1, titleSuffix = L["buff"]},-- Temporal Shield - { spell = 198065, type="buff", unit = "player", pvptalent = 9},-- Prismatic Cloak - { spell = 198158, type="ability", pvptalent = 6, titleSuffix = L["cooldown"]},-- Mass Invisibility - { spell = 198158, type="buff", unit = "player", pvptalent = 6, titleSuffix = L["buff"]},-- Mass Invisibility + { spell = 198111, type = "ability", pvptalent = 1, titleSuffix = L["cooldown"] }, -- Temporal Shield + { spell = 198111, type = "buff", unit = "player", pvptalent = 1, titleSuffix = L["buff"] }, -- Temporal Shield + { spell = 198065, type = "buff", unit = "player", pvptalent = 9 }, -- Prismatic Cloak + { spell = 198158, type = "ability", pvptalent = 6, titleSuffix = L["cooldown"] }, -- Mass Invisibility + { spell = 198158, type = "buff", unit = "player", pvptalent = 6, titleSuffix = L["buff"] }, -- Mass Invisibility }, icon = "Interface\\Icons\\Achievement_BG_winWSG", }, [11] = { title = L["Resources"], - args = { - }, + args = {}, icon = "Interface\\Icons\\spell_arcane_arcane01", }, }, @@ -2315,34 +2290,34 @@ templates.class.MAGE = { [1] = { title = L["Buffs"], args = { - { spell = 66, type = "buff", unit = "player"}, -- Invisibility - { spell = 130, type = "buff", unit = "player"}, -- Slow Fall + { spell = 66, type = "buff", unit = "player" }, -- Invisibility + { spell = 130, type = "buff", unit = "player" }, -- Slow Fall { spell = 1459, type = "buff", unit = "player", forceOwnOnly = true, ownOnly = nil }, -- Arcane Intellect - { spell = 45438, type = "buff", unit = "player"}, -- Ice Block - { spell = 45444, type = "buff", unit = "player"}, -- Bonfire's Blessing - { spell = 48107, type = "buff", unit = "player"}, -- Heating Up - { spell = 48108, type = "buff", unit = "player"}, -- Hot Streak! - { spell = 110909, type = "buff", unit = "player"}, -- Alter Time + { spell = 45438, type = "buff", unit = "player" }, -- Ice Block + { spell = 45444, type = "buff", unit = "player" }, -- Bonfire's Blessing + { spell = 48107, type = "buff", unit = "player" }, -- Heating Up + { spell = 48108, type = "buff", unit = "player" }, -- Hot Streak! + { spell = 110909, type = "buff", unit = "player" }, -- Alter Time { spell = 116014, type = "buff", unit = "player", talent = 9 }, -- Rune of Power { spell = 116267, type = "buff", unit = "player", talent = 7 }, -- Incanter's Flow - { spell = 157644, type = "buff", unit = "player"}, -- Enhanced Pyrotechnics - { spell = 190319, type = "buff", unit = "player"}, -- Combustion + { spell = 157644, type = "buff", unit = "player" }, -- Enhanced Pyrotechnics + { spell = 190319, type = "buff", unit = "player" }, -- Combustion { spell = 236060, type = "buff", unit = "player", talent = 13 }, -- Frenetic Speed { spell = 269651, type = "buff", unit = "player", talent = 20 }, -- Pyroclasm - { spell = 235313, type = "buff", unit = "player"}, -- Blazing Barrier - { spell = 321358, type = "buff", unit = "group", titleSuffix = L["Buff on Other"]}, -- Focus Magic + { spell = 235313, type = "buff", unit = "player" }, -- Blazing Barrier + { spell = 321358, type = "buff", unit = "group", titleSuffix = L["Buff on Other"] }, -- Focus Magic }, - icon = 1035045 + icon = 1035045, }, [2] = { title = L["Debuffs"], args = { { spell = 118, type = "debuff", unit = "multi" }, -- Polymorph { spell = 122, type = "debuff", unit = "multi" }, -- Frost Nova - { spell = 2120, type = "debuff", unit = "target"}, -- Flamestrike - { spell = 12654, type = "debuff", unit = "target"}, -- Ignite - { spell = 31661, type = "debuff", unit = "target"}, -- Dragon's Breath - { spell = 41425, type = "debuff", unit = "player"}, -- Hypothermia + { spell = 2120, type = "debuff", unit = "target" }, -- Flamestrike + { spell = 12654, type = "debuff", unit = "target" }, -- Ignite + { spell = 31661, type = "debuff", unit = "target" }, -- Dragon's Breath + { spell = 41425, type = "debuff", unit = "player" }, -- Hypothermia { spell = 82691, type = "debuff", unit = "target", talent = 15 }, -- Ring of Frost { spell = 87023, type = "debuff", unit = "player" }, -- Cauterize { spell = 87024, type = "debuff", unit = "player" }, -- Cauterized @@ -2352,44 +2327,44 @@ templates.class.MAGE = { { spell = 217694, type = "debuff", unit = "target", talent = 18 }, -- Living Bomb { spell = 226757, type = "debuff", unit = "target", talent = 17 }, -- Conflagration }, - icon = 135818 + icon = 135818, }, [3] = { title = L["Abilities"], args = { - { spell = 66, type = "ability", buff = true}, -- Invisibility - { spell = 116, type = "ability"}, -- Frostbolt - { spell = 118, type = "ability"}, -- Polymorph - { spell = 122, type = "ability", debuff = true}, -- Frost Nova - { spell = 133, type = "ability"}, -- Fireball - { spell = 475, type = "ability"}, -- Remove Curse - { spell = 1449, type = "ability"}, -- Arcane Explosion - { spell = 1459, type = "ability"}, -- Arcane Intellect - { spell = 1953, type = "ability"}, -- Blink - { spell = 2120, type = "ability", overlayGlow = true}, -- Flamestrike - { spell = 2139, type = "ability", requiresTarget = true}, -- Counterspell - { spell = 2948, type = "ability", requiresTarget = true}, -- Scorch - { spell = 11366, type = "ability", requiresTarget = true, overlayGlow = true}, -- Pyroblast - { spell = 30449, type = "ability"}, -- Spealsteal - { spell = 31661, type = "ability"}, -- Dragon's Breath + { spell = 66, type = "ability", buff = true }, -- Invisibility + { spell = 116, type = "ability" }, -- Frostbolt + { spell = 118, type = "ability" }, -- Polymorph + { spell = 122, type = "ability", debuff = true }, -- Frost Nova + { spell = 133, type = "ability" }, -- Fireball + { spell = 475, type = "ability" }, -- Remove Curse + { spell = 1449, type = "ability" }, -- Arcane Explosion + { spell = 1459, type = "ability" }, -- Arcane Intellect + { spell = 1953, type = "ability" }, -- Blink + { spell = 2120, type = "ability", overlayGlow = true }, -- Flamestrike + { spell = 2139, type = "ability", requiresTarget = true }, -- Counterspell + { spell = 2948, type = "ability", requiresTarget = true }, -- Scorch + { spell = 11366, type = "ability", requiresTarget = true, overlayGlow = true }, -- Pyroblast + { spell = 30449, type = "ability" }, -- Spealsteal + { spell = 31661, type = "ability" }, -- Dragon's Breath { spell = 44457, type = "ability", debuff = true, requiresTarget = true, talent = 18 }, -- Living Bomb - { spell = 45438, type = "ability", buff = true}, -- Ice Block + { spell = 45438, type = "ability", buff = true }, -- Ice Block { spell = 55342, type = "ability" }, -- Mirror Image - { spell = 80353, type = "ability", buff = true}, -- Time Warp - { spell = 108978, type = "ability", buff = true}, -- Alter Time - { spell = 108853, type = "ability", charges = true}, -- Fire Blast + { spell = 80353, type = "ability", buff = true }, -- Time Warp + { spell = 108978, type = "ability", buff = true }, -- Alter Time + { spell = 108853, type = "ability", charges = true }, -- Fire Blast { spell = 113724, type = "ability", talent = 15 }, -- Ring of Frost { spell = 116011, type = "ability", charges = true, buff = true, talent = 9 }, -- Rune of Power { spell = 153561, type = "ability", talent = 21 }, -- Meteor { spell = 157981, type = "ability", talent = 6 }, -- Blast Wave - { spell = 190319, type = "ability", buff = true}, -- Combustion - { spell = 190336, type = "ability"}, -- Conjure Refreshment + { spell = 190319, type = "ability", buff = true }, -- Combustion + { spell = 190336, type = "ability" }, -- Conjure Refreshment { spell = 212653, type = "ability", charges = true, talent = 5 }, -- Shimmer - { spell = 235313, type = "ability", buff = true}, -- Blazing Barrier + { spell = 235313, type = "ability", buff = true }, -- Blazing Barrier { spell = 257541, type = "ability", charges = true }, -- Phoenix Flames { spell = 319836, type = "ability", charges = true }, -- Fire Blast }, - icon = 610633 + icon = 610633, }, [4] = {}, [5] = {}, @@ -2400,16 +2375,15 @@ templates.class.MAGE = { [10] = { title = L["PvP Talents"], args = { - { spell = 198065, type="buff", unit = "player", pvptalent = 2},-- Prismatic Cloak - { spell = 203285, type="buff", unit = "target", pvptalent = 6},-- Flamecannon - { spell = 203277, type="buff", unit = "player", pvptalent = 10},-- Tinder + { spell = 198065, type = "buff", unit = "player", pvptalent = 2 }, -- Prismatic Cloak + { spell = 203285, type = "buff", unit = "target", pvptalent = 6 }, -- Flamecannon + { spell = 203277, type = "buff", unit = "player", pvptalent = 10 }, -- Tinder }, icon = "Interface\\Icons\\Achievement_BG_winWSG", }, [11] = { title = L["Resources"], - args = { - }, + args = {}, icon = manaIcon, }, }, @@ -2417,86 +2391,86 @@ templates.class.MAGE = { [1] = { title = L["Buffs"], args = { - { spell = 66, type = "buff", unit = "player"}, -- Invisibility - { spell = 130, type = "buff", unit = "player"}, -- Slow Fall + { spell = 66, type = "buff", unit = "player" }, -- Invisibility + { spell = 130, type = "buff", unit = "player" }, -- Slow Fall { spell = 1459, type = "buff", unit = "player", forceOwnOnly = true, ownOnly = nil }, -- Arcane Intellect - { spell = 11426, type = "buff", unit = "player"}, -- Ice Barrier - { spell = 12472, type = "buff", unit = "player"}, -- Icy Veins - { spell = 44544, type = "buff", unit = "player"}, -- Fingers of Frost - { spell = 45438, type = "buff", unit = "player"}, -- Ice Block + { spell = 11426, type = "buff", unit = "player" }, -- Ice Barrier + { spell = 12472, type = "buff", unit = "player" }, -- Icy Veins + { spell = 44544, type = "buff", unit = "player" }, -- Fingers of Frost + { spell = 45438, type = "buff", unit = "player" }, -- Ice Block { spell = 108839, type = "buff", unit = "player", talent = 6 }, -- Ice Floes { spell = 110909, type = "buff", unit = "player" }, -- Alter Time { spell = 116014, type = "buff", unit = "player", talent = 9 }, -- Rune of Power { spell = 116267, type = "buff", unit = "player", talent = 7 }, -- Incanter's Flow - { spell = 190446, type = "buff", unit = "player"}, -- Brain Freeze + { spell = 190446, type = "buff", unit = "player" }, -- Brain Freeze { spell = 199844, type = "buff", unit = "player", talent = 21 }, -- Glacial Spike! - { spell = 205473, type = "buff", unit = "player"}, -- Icicles + { spell = 205473, type = "buff", unit = "player" }, -- Icicles { spell = 205766, type = "buff", unit = "player", talent = 1 }, -- Bone Chilling { spell = 270232, type = "buff", unit = "player", talent = 16 }, -- Freezing Rain { spell = 278310, type = "buff", unit = "player", talent = 11 }, -- Chain Reaction - { spell = 321358, type = "buff", unit = "group", titleSuffix = L["Buff on Other"]}, -- Focus Magic + { spell = 321358, type = "buff", unit = "group", titleSuffix = L["Buff on Other"] }, -- Focus Magic }, - icon = 236227 + icon = 236227, }, [2] = { title = L["Debuffs"], args = { { spell = 118, type = "debuff", unit = "multi" }, -- Polymorph - { spell = 122, type = "debuff", unit = "target"}, -- Frost Nova - { spell = 12486, type = "debuff", unit = "target"}, -- Blizzard - { spell = 41425, type = "debuff", unit = "player"}, -- Hypothermia + { spell = 122, type = "debuff", unit = "target" }, -- Frost Nova + { spell = 12486, type = "debuff", unit = "target" }, -- Blizzard + { spell = 41425, type = "debuff", unit = "player" }, -- Hypothermia { spell = 82691, type = "debuff", unit = "target", talent = 15 }, -- Ring of Frost { spell = 157997, type = "debuff", unit = "target", talent = 3 }, -- Ice Nova { spell = 205021, type = "debuff", unit = "target", talent = 20 }, -- Ray of Frost - { spell = 205708, type = "debuff", unit = "target"}, -- Chilled - { spell = 212792, type = "debuff", unit = "target"}, -- Cone of Cold - { spell = 228354, type = "debuff", unit = "target"}, -- Flurry - { spell = 228358, type = "debuff", unit = "target"}, -- Winter's Chill + { spell = 205708, type = "debuff", unit = "target" }, -- Chilled + { spell = 212792, type = "debuff", unit = "target" }, -- Cone of Cold + { spell = 228354, type = "debuff", unit = "target" }, -- Flurry + { spell = 228358, type = "debuff", unit = "target" }, -- Winter's Chill { spell = 228600, type = "debuff", unit = "target", talent = 21 }, -- Glacial Spike }, - icon = 236208 + icon = 236208, }, [3] = { title = L["Abilities"], args = { - { spell = 66, type = "ability", buff = true}, -- Invisibility - { spell = 116, type = "ability"}, -- Frostbolt - { spell = 118, type = "ability"}, -- Polymorph - { spell = 120, type = "ability"}, -- Cone of Cold - { spell = 122, type = "ability"}, -- Frost Nova - { spell = 475, type = "ability"}, -- Remove Curse - { spell = 1449, type = "ability"}, -- Arcane Explosion - { spell = 1459, type = "ability"}, -- Arcane Intellect - { spell = 1953, type = "ability"}, -- Blink - { spell = 2139, type = "ability", requiresTarget = true}, -- Counterspell - { spell = 11426, type = "ability", buff = true}, -- Ice Barrier - { spell = 12472, type = "ability", buff = true}, -- Icy Veins - { spell = 30455, type = "ability", requiresTarget = true}, -- Ice Lance - { spell = 30449, type = "ability", requiresTarget = true}, -- Spellsteal - { spell = 31687, type = "ability"}, -- Summon Water Elemental - { spell = 31707, type = "ability"}, -- Waterbolt - { spell = 31687, type = "ability"}, -- Summon Water Elemental - { spell = 44614, type = "ability"}, -- Flurry - { spell = 45438, type = "ability", buff = true}, -- Ice Block - { spell = 55342, type = "ability"}, -- Mirror Image - { spell = 80353, type = "ability", buff = true}, -- Time Warp - { spell = 84714, type = "ability"}, -- Frozen Orb + { spell = 66, type = "ability", buff = true }, -- Invisibility + { spell = 116, type = "ability" }, -- Frostbolt + { spell = 118, type = "ability" }, -- Polymorph + { spell = 120, type = "ability" }, -- Cone of Cold + { spell = 122, type = "ability" }, -- Frost Nova + { spell = 475, type = "ability" }, -- Remove Curse + { spell = 1449, type = "ability" }, -- Arcane Explosion + { spell = 1459, type = "ability" }, -- Arcane Intellect + { spell = 1953, type = "ability" }, -- Blink + { spell = 2139, type = "ability", requiresTarget = true }, -- Counterspell + { spell = 11426, type = "ability", buff = true }, -- Ice Barrier + { spell = 12472, type = "ability", buff = true }, -- Icy Veins + { spell = 30455, type = "ability", requiresTarget = true }, -- Ice Lance + { spell = 30449, type = "ability", requiresTarget = true }, -- Spellsteal + { spell = 31687, type = "ability" }, -- Summon Water Elemental + { spell = 31707, type = "ability" }, -- Waterbolt + { spell = 31687, type = "ability" }, -- Summon Water Elemental + { spell = 44614, type = "ability" }, -- Flurry + { spell = 45438, type = "ability", buff = true }, -- Ice Block + { spell = 55342, type = "ability" }, -- Mirror Image + { spell = 80353, type = "ability", buff = true }, -- Time Warp + { spell = 84714, type = "ability" }, -- Frozen Orb { spell = 108839, type = "ability", charges = true, buff = true, talent = 6 }, -- Ice Floes { spell = 108978, type = "ability", buff = true }, -- Alter Time { spell = 113724, type = "ability", talent = 15 }, -- Ring of Frost { spell = 116011, type = "ability", charges = true, buff = true, talent = 9 }, -- Rune of Power { spell = 153595, type = "ability", requiresTarget = true, talent = 18 }, -- Comet Storm { spell = 157997, type = "ability", talent = 3 }, -- Ice Nova - { spell = 190336, type = "ability"}, -- Conjure Refreshment - { spell = 190356, type = "ability"}, -- Blizzard - { spell = 199786, type = "ability", usable = true, requiresTarget = true, overlayGlow = true, talent = 21}, -- Glacial SPike + { spell = 190336, type = "ability" }, -- Conjure Refreshment + { spell = 190356, type = "ability" }, -- Blizzard + { spell = 199786, type = "ability", usable = true, requiresTarget = true, overlayGlow = true, talent = 21 }, -- Glacial SPike { spell = 205021, type = "ability", requiresTarget = true, talent = 20 }, -- Ray of Frost { spell = 212653, type = "ability", charges = true, talent = 5 }, -- Shimmer - { spell = 235219, type = "ability"}, -- Cold Snap + { spell = 235219, type = "ability" }, -- Cold Snap { spell = 257537, type = "ability", requiresTarget = true, talent = 12 }, -- Ebonbolt { spell = 319836, type = "ability", requiresTarget = true }, -- Fire Blast }, - icon = 629077 + icon = 629077, }, [4] = {}, [5] = {}, @@ -2507,18 +2481,17 @@ templates.class.MAGE = { [10] = { title = L["PvP Talents"], args = { - { spell = 198065, type="buff", unit = "player", pvptalent = 7},-- Prismatic Cloak - { spell = 198144, type="ability", pvptalent = 9, titleSuffix = L["cooldown"]},-- Ice Form - { spell = 198144, type="buff", unit = "player", pvptalent = 9, titleSuffix = L["buff"]},-- Ice Form - { spell = 198121, type="debuff", unit = "target", pvptalent = 4},-- Frostbite - { spell = 206432, type="buff", unit = "player", pvptalent = 10},-- Burst of Cold + { spell = 198065, type = "buff", unit = "player", pvptalent = 7 }, -- Prismatic Cloak + { spell = 198144, type = "ability", pvptalent = 9, titleSuffix = L["cooldown"] }, -- Ice Form + { spell = 198144, type = "buff", unit = "player", pvptalent = 9, titleSuffix = L["buff"] }, -- Ice Form + { spell = 198121, type = "debuff", unit = "target", pvptalent = 4 }, -- Frostbite + { spell = 206432, type = "buff", unit = "player", pvptalent = 10 }, -- Burst of Cold }, icon = "Interface\\Icons\\Achievement_BG_winWSG", }, [11] = { title = L["Resources"], - args = { - }, + args = {}, icon = manaIcon, }, }, @@ -2529,103 +2502,103 @@ templates.class.WARLOCK = { [1] = { title = L["Buffs"], args = { - { spell = 126, type = "buff", unit = "player"}, -- Eye of Kilrogg - { spell = 755, type = "buff", unit = "pet"}, -- Health Funnel - { spell = 5697, type = "buff", unit = "player"}, -- Unending Breath - { spell = 7870, type = "buff", unit = "pet"}, -- Lesser Invisibility - { spell = 17767, type = "buff", unit = "pet"}, -- Shadow Bulwark - { spell = 20707, type = "buff", unit = "group"}, -- Soulstone - { spell = 48018, type = "buff", unit = "player"}, -- Demonic Circle - { spell = 104773, type = "buff", unit = "player"}, -- Unending Resolve - { spell = 108366, type = "buff", unit = "player"}, -- Soul Leech + { spell = 126, type = "buff", unit = "player" }, -- Eye of Kilrogg + { spell = 755, type = "buff", unit = "pet" }, -- Health Funnel + { spell = 5697, type = "buff", unit = "player" }, -- Unending Breath + { spell = 7870, type = "buff", unit = "pet" }, -- Lesser Invisibility + { spell = 17767, type = "buff", unit = "pet" }, -- Shadow Bulwark + { spell = 20707, type = "buff", unit = "group" }, -- Soulstone + { spell = 48018, type = "buff", unit = "player" }, -- Demonic Circle + { spell = 104773, type = "buff", unit = "player" }, -- Unending Resolve + { spell = 108366, type = "buff", unit = "player" }, -- Soul Leech { spell = 108416, type = "buff", unit = "player", talent = 9 }, -- Dark Pact - { spell = 112042, type = "buff", unit = "pet"}, -- Threatening Presence + { spell = 112042, type = "buff", unit = "pet" }, -- Threatening Presence { spell = 113860, type = "buff", unit = "player", talent = 21 }, -- Dark Soul: Misery { spell = 111400, type = "buff", unit = "player", talent = 8 }, -- Burning Rush { spell = 196099, type = "buff", unit = "player", talent = 18 }, -- Grimoire of Sacrifice { spell = 264571, type = "buff", unit = "player", talent = 1 }, -- Nightfall { spell = 334320, type = "buff", unit = "player", talent = 2 }, -- Inevitable Demise }, - icon = 136210 + icon = 136210, }, [2] = { title = L["Debuffs"], args = { - { spell = 702, type = "debuff", unit = "target"}, -- Curse of Weakness - { spell = 710, type = "debuff", unit = "multi"}, -- Banish - { spell = 980, type = "debuff", unit = "target"}, -- Agony - { spell = 1098, type = "debuff", unit = "multi"}, -- Enslave Demon - { spell = 1714, type = "debuff", unit = "target"}, -- Curse of Tongues - { spell = 6358, type = "debuff", unit = "target"}, -- Seduction - { spell = 6360, type = "debuff", unit = "target"}, -- Whiplash + { spell = 702, type = "debuff", unit = "target" }, -- Curse of Weakness + { spell = 710, type = "debuff", unit = "multi" }, -- Banish + { spell = 980, type = "debuff", unit = "target" }, -- Agony + { spell = 1098, type = "debuff", unit = "multi" }, -- Enslave Demon + { spell = 1714, type = "debuff", unit = "target" }, -- Curse of Tongues + { spell = 6358, type = "debuff", unit = "target" }, -- Seduction + { spell = 6360, type = "debuff", unit = "target" }, -- Whiplash { spell = 6789, type = "debuff", unit = "target", talent = 14 }, -- Mortal Coil - { spell = 17735, type = "debuff", unit = "target"}, -- Suffering - { spell = 27243, type = "debuff", unit = "target"}, -- Seed of Corruption - { spell = 30283, type = "debuff", unit = "target"}, -- Shadowfury + { spell = 17735, type = "debuff", unit = "target" }, -- Suffering + { spell = 27243, type = "debuff", unit = "target" }, -- Seed of Corruption + { spell = 30283, type = "debuff", unit = "target" }, -- Shadowfury { spell = 48181, type = "debuff", unit = "target", talent = 17 }, -- Haunt { spell = 63106, type = "debuff", unit = "target", talent = 6 }, -- Siphon Life - { spell = 118699, type = "debuff", unit = "target"}, -- Fear - { spell = 146739, type = "debuff", unit = "target"}, -- Corruption + { spell = 118699, type = "debuff", unit = "target" }, -- Fear + { spell = 146739, type = "debuff", unit = "target" }, -- Corruption { spell = 198590, type = "debuff", unit = "target", talent = 2 }, -- Drain Soul { spell = 205179, type = "debuff", unit = "target", talent = 11 }, -- Phantom Singularity - { spell = 234153, type = "debuff", unit = "target"}, -- Drain Life - { spell = 233490, type = "debuff", unit = "target"}, -- Unstable Affliction + { spell = 234153, type = "debuff", unit = "target" }, -- Drain Life + { spell = 233490, type = "debuff", unit = "target" }, -- Unstable Affliction { spell = 278350, type = "debuff", unit = "target", talent = 12 }, -- Vile Taint - { spell = 334275, type = "debuff", unit = "target"}, -- Curse of Exhaustion + { spell = 334275, type = "debuff", unit = "target" }, -- Curse of Exhaustion }, - icon = 136139 + icon = 136139, }, [3] = { title = L["Abilities"], args = { - { spell = 126, type = "ability"}, -- Eye of Kilrogg - { spell = 172, type = "ability", requiresTarget = true, debuff = true}, -- Corruption - { spell = 686, type = "ability", requiresTarget = true}, -- Shadow Bolt - { spell = 698, type = "ability"}, -- Ritual of Summoning - { spell = 702, type = "ability", requiresTarget = true, debuff = true}, -- Curse of Weakness - { spell = 710, type = "ability", requiresTarget = true, debuff = true}, -- Banish - { spell = 755, type = "ability"}, -- Health Funnel - { spell = 980, type = "ability", requiresTarget = true, debuff = true}, -- Agony - { spell = 1714, type = "ability", requiresTarget = true, debuff = true}, -- Curse of Tongues - { spell = 3110, type = "ability", requiresTarget = true}, -- Firebolt - { spell = 3716, type = "ability", requiresTarget = true}, -- Consuming Shadows - { spell = 5484, type = "ability"}, -- Howl of Terror - { spell = 5782, type = "ability", requiresTarget = true, debuff = true}, -- Fear - { spell = 6358, type = "ability", requiresTarget = true}, -- Seduction - { spell = 6360, type = "ability", requiresTarget = true}, -- Whiplash + { spell = 126, type = "ability" }, -- Eye of Kilrogg + { spell = 172, type = "ability", requiresTarget = true, debuff = true }, -- Corruption + { spell = 686, type = "ability", requiresTarget = true }, -- Shadow Bolt + { spell = 698, type = "ability" }, -- Ritual of Summoning + { spell = 702, type = "ability", requiresTarget = true, debuff = true }, -- Curse of Weakness + { spell = 710, type = "ability", requiresTarget = true, debuff = true }, -- Banish + { spell = 755, type = "ability" }, -- Health Funnel + { spell = 980, type = "ability", requiresTarget = true, debuff = true }, -- Agony + { spell = 1714, type = "ability", requiresTarget = true, debuff = true }, -- Curse of Tongues + { spell = 3110, type = "ability", requiresTarget = true }, -- Firebolt + { spell = 3716, type = "ability", requiresTarget = true }, -- Consuming Shadows + { spell = 5484, type = "ability" }, -- Howl of Terror + { spell = 5782, type = "ability", requiresTarget = true, debuff = true }, -- Fear + { spell = 6358, type = "ability", requiresTarget = true }, -- Seduction + { spell = 6360, type = "ability", requiresTarget = true }, -- Whiplash { spell = 6789, type = "ability", requiresTarget = true, talent = 14 }, -- Mortal Coil - { spell = 7814, type = "ability", requiresTarget = true}, -- Lash of Pain - { spell = 7870, type = "ability"}, -- Lesser Invisibility - { spell = 17735, type = "ability", requiresTarget = true, debuff = true}, -- Suffering - { spell = 17767, type = "ability"}, -- Shadow Bulwark - { spell = 19505, type = "ability", requiresTarget = true}, -- Devour Magic - { spell = 19647, type = "ability", requiresTarget = true}, -- Spell Lock - { spell = 20707, type = "ability"}, -- Soulstone - { spell = 27243, type = "ability", requiresTarget = true}, -- Seed of Corruption - { spell = 29893, type = "ability"}, -- Create Soulwell - { spell = 30108, type = "ability", requiresTarget = true}, -- Unstable Affliction - { spell = 30283, type = "ability"}, -- Shadowfury - { spell = 48018, type = "ability"}, -- Demonic Circle + { spell = 7814, type = "ability", requiresTarget = true }, -- Lash of Pain + { spell = 7870, type = "ability" }, -- Lesser Invisibility + { spell = 17735, type = "ability", requiresTarget = true, debuff = true }, -- Suffering + { spell = 17767, type = "ability" }, -- Shadow Bulwark + { spell = 19505, type = "ability", requiresTarget = true }, -- Devour Magic + { spell = 19647, type = "ability", requiresTarget = true }, -- Spell Lock + { spell = 20707, type = "ability" }, -- Soulstone + { spell = 27243, type = "ability", requiresTarget = true }, -- Seed of Corruption + { spell = 29893, type = "ability" }, -- Create Soulwell + { spell = 30108, type = "ability", requiresTarget = true }, -- Unstable Affliction + { spell = 30283, type = "ability" }, -- Shadowfury + { spell = 48018, type = "ability" }, -- Demonic Circle { spell = 48020, type = "ability", usable = true }, -- Demonic Circle: Teleport { spell = 48181, type = "ability", requiresTarget = true, debuff = true, talent = 17 }, -- Haunt - { spell = 54049, type = "ability", requiresTarget = true}, -- Shadow Bite - { spell = 63106, type = "ability", requiresTarget = true, debuff = true, talent = 6}, -- Siphon Life + { spell = 54049, type = "ability", requiresTarget = true }, -- Shadow Bite + { spell = 63106, type = "ability", requiresTarget = true, debuff = true, talent = 6 }, -- Siphon Life { spell = 89792, type = "ability" }, -- Flee - { spell = 89808, type = "ability"}, -- Singe Magic - { spell = 104773, type = "ability", buff = true}, -- Unending Resolve + { spell = 89808, type = "ability" }, -- Singe Magic + { spell = 104773, type = "ability", buff = true }, -- Unending Resolve { spell = 108416, type = "ability", buff = true, talent = 9 }, -- Dark Pact { spell = 108503, type = "ability", talent = 18 }, -- Grimoire of Sacrifice - { spell = 111771, type = "ability"}, -- Demonic Gateway - { spell = 112042, type = "ability"}, -- Threatening Presence + { spell = 111771, type = "ability" }, -- Demonic Gateway + { spell = 112042, type = "ability" }, -- Threatening Presence { spell = 113860, type = "ability", buff = true, talent = 21 }, -- Dark Soul: Misery - { spell = 119910, type = "ability", requiresTarget = true}, -- Command Demon - { spell = 198590, type = "ability", requiresTarget = true}, -- Drain Soul + { spell = 119910, type = "ability", requiresTarget = true }, -- Command Demon + { spell = 198590, type = "ability", requiresTarget = true }, -- Drain Soul { spell = 205179, type = "ability", requiresTarget = true, debuff = true, talent = 11 }, -- Phantom Singularity - { spell = 205180, type = "ability", totem = true}, -- Summon Darkglare - { spell = 232670, type = "ability", requiresTarget = true, overlayGlow = true}, -- Shadow Bolt - { spell = 234153, type = "ability", requiresTarget = true}, -- Drain Life + { spell = 205180, type = "ability", totem = true }, -- Summon Darkglare + { spell = 232670, type = "ability", requiresTarget = true, overlayGlow = true }, -- Shadow Bolt + { spell = 234153, type = "ability", requiresTarget = true }, -- Drain Life { spell = 264106, type = "ability", requiresTarget = true, talent = 3 }, -- Deathbolt - { spell = 264993, type = "ability"}, -- Shadow Shield + { spell = 264993, type = "ability" }, -- Shadow Shield { spell = 278350, type = "ability", requiresTarget = true, talent = 12 }, -- Vile Taint { spell = 316099, type = "ability", requiresTarget = true }, -- Unstable Affliction { spell = 333889, type = "ability" }, -- Fel Domination @@ -2633,7 +2606,7 @@ templates.class.WARLOCK = { { spell = 342601, type = "ability" }, -- Ritual of Doom { spell = 324536, type = "ability" }, -- Malefic Rapture }, - icon = 135808 + icon = 135808, }, [4] = {}, [5] = {}, @@ -2644,25 +2617,24 @@ templates.class.WARLOCK = { [10] = { title = L["PvP Talents"], args = { - { spell = 199954, type="ability", debuff = true, pvptalent = 9, titleSuffix = L["cooldown"]},-- Bane of Fragility - { spell = 199954, type="debuff", unit = "target", pvptalent = 9, titleSuffix = L["debuff"]},-- Bane of Fragility - { spell = 212295, type="ability", pvptalent = 5, titleSuffix = L["cooldown"]},-- Nether Ward - { spell = 212295, type="buff", unit = "player", pvptalent = 5, titleSuffix = L["buff"]},-- Nether Ward - { spell = 212356, type="ability", pvptalent = 12, titleSuffix = L["cooldown"]},-- Soulshatter - { spell = 221703, type="ability", pvptalent = 7, titleSuffix = L["cooldown"]},-- Casting Circle - { spell = 221705, type="buff", unit = "player", pvptalent = 7, titleSuffix = L["buff"]},-- Casting Circle - { spell = 221715, type="debuff", unit = "target", pvptalent = 6},-- Essence Drain - { spell = 264106, type="ability", pvptalent = 4},-- Deathbolt - { spell = 285933, type="buff", unit = "player", pvptalent = 13},-- Demon Armor - { spell = 234877, type="ability", pvptalent = 4},-- Bane of Shadows - { spell = 328774, type="ability", buff = true, pvptalent = 8},-- Amplify Curse + { spell = 199954, type = "ability", debuff = true, pvptalent = 9, titleSuffix = L["cooldown"] }, -- Bane of Fragility + { spell = 199954, type = "debuff", unit = "target", pvptalent = 9, titleSuffix = L["debuff"] }, -- Bane of Fragility + { spell = 212295, type = "ability", pvptalent = 5, titleSuffix = L["cooldown"] }, -- Nether Ward + { spell = 212295, type = "buff", unit = "player", pvptalent = 5, titleSuffix = L["buff"] }, -- Nether Ward + { spell = 212356, type = "ability", pvptalent = 12, titleSuffix = L["cooldown"] }, -- Soulshatter + { spell = 221703, type = "ability", pvptalent = 7, titleSuffix = L["cooldown"] }, -- Casting Circle + { spell = 221705, type = "buff", unit = "player", pvptalent = 7, titleSuffix = L["buff"] }, -- Casting Circle + { spell = 221715, type = "debuff", unit = "target", pvptalent = 6 }, -- Essence Drain + { spell = 264106, type = "ability", pvptalent = 4 }, -- Deathbolt + { spell = 285933, type = "buff", unit = "player", pvptalent = 13 }, -- Demon Armor + { spell = 234877, type = "ability", pvptalent = 4 }, -- Bane of Shadows + { spell = 328774, type = "ability", buff = true, pvptalent = 8 }, -- Amplify Curse }, icon = "Interface\\Icons\\Achievement_BG_winWSG", }, [11] = { title = L["Resources"], - args = { - }, + args = {}, icon = "Interface\\Icons\\inv_misc_gem_amethyst_02", }, }, @@ -2670,106 +2642,106 @@ templates.class.WARLOCK = { [1] = { title = L["Buffs"], args = { - { spell = 126, type = "buff", unit = "player"}, -- Eye of Kilrogg - { spell = 755, type = "buff", unit = "pet"}, -- Health Funnel - { spell = 5697, type = "buff", unit = "player"}, -- Unending Breath - { spell = 17767, type = "buff", unit = "pet"}, -- Shadow Bulwark - { spell = 20707, type = "buff", unit = "group"}, -- Soulstone - { spell = 30151, type = "buff", unit = "pet"}, -- Pursuit - { spell = 48018, type = "buff", unit = "player"}, -- Demonic Circle - { spell = 89751, type = "buff", unit = "pet"}, -- Felstorm - { spell = 104773, type = "buff", unit = "player"}, -- Unending Resolve - { spell = 108366, type = "buff", unit = "player"}, -- Soul Leech + { spell = 126, type = "buff", unit = "player" }, -- Eye of Kilrogg + { spell = 755, type = "buff", unit = "pet" }, -- Health Funnel + { spell = 5697, type = "buff", unit = "player" }, -- Unending Breath + { spell = 17767, type = "buff", unit = "pet" }, -- Shadow Bulwark + { spell = 20707, type = "buff", unit = "group" }, -- Soulstone + { spell = 30151, type = "buff", unit = "pet" }, -- Pursuit + { spell = 48018, type = "buff", unit = "player" }, -- Demonic Circle + { spell = 89751, type = "buff", unit = "pet" }, -- Felstorm + { spell = 104773, type = "buff", unit = "player" }, -- Unending Resolve + { spell = 108366, type = "buff", unit = "player" }, -- Soul Leech { spell = 108416, type = "buff", unit = "player", talent = 9 }, -- Dark Pact { spell = 111400, type = "buff", unit = "player", talent = 8 }, -- Burning Rush - { spell = 134477, type = "buff", unit = "pet"}, -- Threatening Presence + { spell = 134477, type = "buff", unit = "pet" }, -- Threatening Presence { spell = 205146, type = "buff", unit = "player", talent = 4 }, -- Demonic Calling - { spell = 265273, type = "buff", unit = "player"}, -- Demonic Power + { spell = 265273, type = "buff", unit = "player" }, -- Demonic Power { spell = 267218, type = "buff", unit = "player", talent = 21 }, -- Nether Portal - { spell = 264173, type = "buff", unit = "player"}, -- Demonic Core + { spell = 264173, type = "buff", unit = "player" }, -- Demonic Core { spell = 267171, type = "buff", unit = "pet", talent = 3 }, -- Demonic Strength }, - icon = 1378284 + icon = 1378284, }, [2] = { title = L["Debuffs"], args = { - { spell = 603, type = "debuff", unit = "target"}, -- Doom - { spell = 702, type = "debuff", unit = "target"}, -- Curse of Weakness - { spell = 710, type = "debuff", unit = "multi"}, -- Banish - { spell = 1098, type = "debuff", unit = "multi"}, -- Enslave Demon - { spell = 1714, type = "debuff", unit = "target"}, -- Curse of Tongues - { spell = 6358, type = "debuff", unit = "target"}, -- Seduction - { spell = 6360, type = "debuff", unit = "target"}, -- Whiplash + { spell = 603, type = "debuff", unit = "target" }, -- Doom + { spell = 702, type = "debuff", unit = "target" }, -- Curse of Weakness + { spell = 710, type = "debuff", unit = "multi" }, -- Banish + { spell = 1098, type = "debuff", unit = "multi" }, -- Enslave Demon + { spell = 1714, type = "debuff", unit = "target" }, -- Curse of Tongues + { spell = 6358, type = "debuff", unit = "target" }, -- Seduction + { spell = 6360, type = "debuff", unit = "target" }, -- Whiplash { spell = 6789, type = "debuff", unit = "target", talent = 14 }, -- Mortal Coil - { spell = 17735, type = "debuff", unit = "target"}, -- Suffering - { spell = 30213, type = "debuff", unit = "target"}, -- Legion Strike - { spell = 30283, type = "debuff", unit = "target"}, -- Shadowfury - { spell = 89766, type = "debuff", unit = "target"}, -- Axe Toss - { spell = 118699, type = "debuff", unit = "target"}, -- Fear - { spell = 146739, type = "debuff", unit = "target"}, -- Corruption + { spell = 17735, type = "debuff", unit = "target" }, -- Suffering + { spell = 30213, type = "debuff", unit = "target" }, -- Legion Strike + { spell = 30283, type = "debuff", unit = "target" }, -- Shadowfury + { spell = 89766, type = "debuff", unit = "target" }, -- Axe Toss + { spell = 118699, type = "debuff", unit = "target" }, -- Fear + { spell = 146739, type = "debuff", unit = "target" }, -- Corruption { spell = 267997, type = "debuff", unit = "target", talent = 2 }, -- Bile Spit { spell = 270569, type = "debuff", unit = "target", talent = 10 }, -- From the Shadows - { spell = 234153, type = "debuff", unit = "target"}, -- Drain Life + { spell = 234153, type = "debuff", unit = "target" }, -- Drain Life { spell = 265412, type = "debuff", unit = "target", talent = 6 }, -- Doom - { spell = 334275, type = "debuff", unit = "target"}, -- Curse of Exhaustion + { spell = 334275, type = "debuff", unit = "target" }, -- Curse of Exhaustion }, - icon = 136122 + icon = 136122, }, [3] = { title = L["Abilities"], args = { { spell = 126, type = "ability" }, -- Eyew of Kilrogg { spell = 172, type = "ability" }, -- Corruption - { spell = 603, type = "ability", requiresTarget = true, debuff = true, talent = 6}, -- Doom - { spell = 686, type = "ability", requiresTarget = true}, -- Shadow Bolt - { spell = 698, type = "ability"}, -- Ritual of Summoning - { spell = 702, type = "ability", requiresTarget = true, debuff = true}, -- Curse of Weakness - { spell = 710, type = "ability", requiresTarget = true, debuff = true}, -- Banish - { spell = 755, type = "ability"}, -- Health Funnel - { spell = 1098, type = "ability"}, -- Subjugate Demon - { spell = 1714, type = "ability", requiresTarget = true, debuff = true}, -- Curse of Tongues - { spell = 3716, type = "ability", requiresTarget = true}, -- Consuming Shadows - { spell = 5484, type = "ability", debuff = true, talent = 15}, -- Howl of Terror - { spell = 5782, type = "ability", requiresTarget = true, debuff = true}, -- Fear - { spell = 6358, type = "ability", requiresTarget = true}, -- Seduction - { spell = 6360, type = "ability", requiresTarget = true}, -- Whiplash + { spell = 603, type = "ability", requiresTarget = true, debuff = true, talent = 6 }, -- Doom + { spell = 686, type = "ability", requiresTarget = true }, -- Shadow Bolt + { spell = 698, type = "ability" }, -- Ritual of Summoning + { spell = 702, type = "ability", requiresTarget = true, debuff = true }, -- Curse of Weakness + { spell = 710, type = "ability", requiresTarget = true, debuff = true }, -- Banish + { spell = 755, type = "ability" }, -- Health Funnel + { spell = 1098, type = "ability" }, -- Subjugate Demon + { spell = 1714, type = "ability", requiresTarget = true, debuff = true }, -- Curse of Tongues + { spell = 3716, type = "ability", requiresTarget = true }, -- Consuming Shadows + { spell = 5484, type = "ability", debuff = true, talent = 15 }, -- Howl of Terror + { spell = 5782, type = "ability", requiresTarget = true, debuff = true }, -- Fear + { spell = 6358, type = "ability", requiresTarget = true }, -- Seduction + { spell = 6360, type = "ability", requiresTarget = true }, -- Whiplash { spell = 6789, type = "ability", requiresTarget = true, talent = 14 }, -- Mortal Coil - { spell = 7814, type = "ability", requiresTarget = true}, -- Lash of Pain - { spell = 7870, type = "ability"}, -- Lesser Invisibility - { spell = 17735, type = "ability", requiresTarget = true, debuff = true}, -- Suffering - { spell = 17767, type = "ability"}, -- Shadow Bulwark - { spell = 19505, type = "ability", requiresTarget = true}, -- Devour Magic - { spell = 19647, type = "ability", requiresTarget = true}, -- Spell Lock - { spell = 20707, type = "ability"}, -- Soulstone - { spell = 29893, type = "ability"}, -- Create Soulwell - { spell = 30151, type = "ability", requiresTarget = true}, -- Pursuit - { spell = 30213, type = "ability", requiresTarget = true}, -- Legion Strike - { spell = 30283, type = "ability"}, -- Shadowfury + { spell = 7814, type = "ability", requiresTarget = true }, -- Lash of Pain + { spell = 7870, type = "ability" }, -- Lesser Invisibility + { spell = 17735, type = "ability", requiresTarget = true, debuff = true }, -- Suffering + { spell = 17767, type = "ability" }, -- Shadow Bulwark + { spell = 19505, type = "ability", requiresTarget = true }, -- Devour Magic + { spell = 19647, type = "ability", requiresTarget = true }, -- Spell Lock + { spell = 20707, type = "ability" }, -- Soulstone + { spell = 29893, type = "ability" }, -- Create Soulwell + { spell = 30151, type = "ability", requiresTarget = true }, -- Pursuit + { spell = 30213, type = "ability", requiresTarget = true }, -- Legion Strike + { spell = 30283, type = "ability" }, -- Shadowfury { spell = 48018, type = "ability" }, -- Demonic Circle { spell = 48020, type = "ability" }, -- Demonic Circle: Teleport - { spell = 54049, type = "ability", requiresTarget = true}, -- Shadow Bite - { spell = 89751, type = "ability"}, -- Felstorm - { spell = 89766, type = "ability", requiresTarget = true, debuff = true}, -- Axe Toss - { spell = 89792, type = "ability"}, -- Flee - { spell = 89808, type = "ability"}, -- Singe Magic - { spell = 104316, type = "ability", requiresTarget = true, overlayGlow = true}, -- Call Dreadstalkers - { spell = 104773, type = "ability", buff = true}, -- Unending Resolve - { spell = 105174, type = "ability", requiresTarget = true}, -- Hand of Gul'dan + { spell = 54049, type = "ability", requiresTarget = true }, -- Shadow Bite + { spell = 89751, type = "ability" }, -- Felstorm + { spell = 89766, type = "ability", requiresTarget = true, debuff = true }, -- Axe Toss + { spell = 89792, type = "ability" }, -- Flee + { spell = 89808, type = "ability" }, -- Singe Magic + { spell = 104316, type = "ability", requiresTarget = true, overlayGlow = true }, -- Call Dreadstalkers + { spell = 104773, type = "ability", buff = true }, -- Unending Resolve + { spell = 105174, type = "ability", requiresTarget = true }, -- Hand of Gul'dan { spell = 108416, type = "ability", buff = true, talent = 9 }, -- Dark Pact - { spell = 111771, type = "ability"}, -- Demonic Gateway + { spell = 111771, type = "ability" }, -- Demonic Gateway { spell = 111898, type = "ability", requiresTarget = true, talent = 18 }, -- Grimoire: Felguard - { spell = 112042, type = "ability"}, -- Threatening Presence + { spell = 112042, type = "ability" }, -- Threatening Presence { spell = 119898, type = "ability" }, -- Command Demon { spell = 196277, type = "ability" }, -- Implosion { spell = 234153, type = "ability", requiresTarget = true }, -- Drain Life { spell = 264057, type = "ability", requiresTarget = true, talent = 11 }, -- Soul Strike { spell = 264119, type = "ability", talent = 12 }, -- Summon Vilefiend { spell = 264130, type = "ability", usable = true, talent = 5 }, -- Power Siphon - { spell = 264178, type = "ability", requiresTarget = true, overlayGlow = true}, -- Demonbolt - { spell = 264993, type = "ability"}, -- Shadow Shield - { spell = 265187, type = "ability"}, -- Summon Demonic Tyrant - { spell = 265412, type = "ability", requiresTarget = true, debuff = true, talent = 6}, -- Doom + { spell = 264178, type = "ability", requiresTarget = true, overlayGlow = true }, -- Demonbolt + { spell = 264993, type = "ability" }, -- Shadow Shield + { spell = 265187, type = "ability" }, -- Summon Demonic Tyrant + { spell = 265412, type = "ability", requiresTarget = true, debuff = true, talent = 6 }, -- Doom { spell = 267171, type = "ability", requiresTarget = true, talent = 3 }, -- Demonic Strength { spell = 267211, type = "ability", talent = 2 }, -- Bilescourge Bombers { spell = 267217, type = "ability", buff = true, talent = 21 }, -- Nether Portal @@ -2777,7 +2749,7 @@ templates.class.WARLOCK = { { spell = 334275, type = "ability", debuff = true }, -- Curse of Exhaustion { spell = 342601, type = "ability" }, -- Ritual of Doom }, - icon = 1378282 + icon = 1378282, }, [4] = {}, [5] = {}, @@ -2788,25 +2760,24 @@ templates.class.WARLOCK = { [10] = { title = L["PvP Talents"], args = { - { spell = 199954, type="ability", debuff = true, pvptalent = 3, titleSuffix = L["cooldown"]},-- Bane of Fragility - { spell = 199954, type="debuff", unit = "target", pvptalent = 3, titleSuffix = L["debuff"]},-- Bane of Fragility - { spell = 201996, type="ability", pvptalent = 9},-- Call Observer - { spell = 212295, type="ability", pvptalent = 12, titleSuffix = L["cooldown"]},-- Nether Ward - { spell = 212295, type="buff", unit = "player", pvptalent = 12, titleSuffix = L["buff"]},-- Nether Ward - { spell = 212459, type="ability", pvptalent = 2},-- Call Fel Lord - { spell = 212619, type="ability", pvptalent = 6},-- Call Felhunter - { spell = 212623, type="ability", pvptalent = 7},-- Singe Magic - { spell = 221703, type="ability", pvptalent = 10, titleSuffix = L["cooldown"]},-- Casting Circle - { spell = 221705, type="buff", unit = "target", pvptalent = 10, titleSuffix = L["buff"]},-- Casting Circle - { spell = 221715, type="debuff", unit = "target", pvptalent = 11},-- Essence Drain - { spell = 328774, type="ability", buff = true, pvptalent = 8},-- Amplify Curse + { spell = 199954, type = "ability", debuff = true, pvptalent = 3, titleSuffix = L["cooldown"] }, -- Bane of Fragility + { spell = 199954, type = "debuff", unit = "target", pvptalent = 3, titleSuffix = L["debuff"] }, -- Bane of Fragility + { spell = 201996, type = "ability", pvptalent = 9 }, -- Call Observer + { spell = 212295, type = "ability", pvptalent = 12, titleSuffix = L["cooldown"] }, -- Nether Ward + { spell = 212295, type = "buff", unit = "player", pvptalent = 12, titleSuffix = L["buff"] }, -- Nether Ward + { spell = 212459, type = "ability", pvptalent = 2 }, -- Call Fel Lord + { spell = 212619, type = "ability", pvptalent = 6 }, -- Call Felhunter + { spell = 212623, type = "ability", pvptalent = 7 }, -- Singe Magic + { spell = 221703, type = "ability", pvptalent = 10, titleSuffix = L["cooldown"] }, -- Casting Circle + { spell = 221705, type = "buff", unit = "target", pvptalent = 10, titleSuffix = L["buff"] }, -- Casting Circle + { spell = 221715, type = "debuff", unit = "target", pvptalent = 11 }, -- Essence Drain + { spell = 328774, type = "ability", buff = true, pvptalent = 8 }, -- Amplify Curse }, icon = "Interface\\Icons\\Achievement_BG_winWSG", }, [11] = { title = L["Resources"], - args = { - }, + args = {}, icon = "Interface\\Icons\\inv_misc_gem_amethyst_02", }, }, @@ -2814,108 +2785,108 @@ templates.class.WARLOCK = { [1] = { title = L["Buffs"], args = { - { spell = 126, type = "buff", unit = "player"}, -- Eye of Kilrogg - { spell = 755, type = "buff", unit = "pet"}, -- Health Funnel - { spell = 5697, type = "buff", unit = "player"}, -- Unending Breath - { spell = 7870, type = "buff", unit = "pet"}, -- Lesser Invisibility - { spell = 17767, type = "buff", unit = "pet"}, -- Shadow Bulwark - { spell = 20707, type = "buff", unit = "group"}, -- Soulstone - { spell = 48018, type = "buff", unit = "player"}, -- Demonic Circle - { spell = 104773, type = "buff", unit = "player"}, -- Unending Resolve - { spell = 108366, type = "buff", unit = "player"}, -- Soul Leech - { spell = 108366, type = "buff", unit = "pet"}, -- Soul Leech + { spell = 126, type = "buff", unit = "player" }, -- Eye of Kilrogg + { spell = 755, type = "buff", unit = "pet" }, -- Health Funnel + { spell = 5697, type = "buff", unit = "player" }, -- Unending Breath + { spell = 7870, type = "buff", unit = "pet" }, -- Lesser Invisibility + { spell = 17767, type = "buff", unit = "pet" }, -- Shadow Bulwark + { spell = 20707, type = "buff", unit = "group" }, -- Soulstone + { spell = 48018, type = "buff", unit = "player" }, -- Demonic Circle + { spell = 104773, type = "buff", unit = "player" }, -- Unending Resolve + { spell = 108366, type = "buff", unit = "player" }, -- Soul Leech + { spell = 108366, type = "buff", unit = "pet" }, -- Soul Leech { spell = 108416, type = "buff", unit = "player", talent = 9 }, -- Dark Pact { spell = 111400, type = "buff", unit = "player", talent = 8 }, -- Burning Rush - { spell = 112042, type = "buff", unit = "pet"}, -- Threatening Presence + { spell = 112042, type = "buff", unit = "pet" }, -- Threatening Presence { spell = 113858, type = "buff", unit = "player", talent = 21 }, -- Dark Soul: Instability - { spell = 117828, type = "buff", unit = "player"}, -- Backdraft + { spell = 117828, type = "buff", unit = "player" }, -- Backdraft { spell = 196099, type = "buff", unit = "player", talent = 18 }, -- Grimoire of Sacrifice { spell = 266030, type = "buff", unit = "player", talent = 4 }, -- Reverse Entropy }, - icon = 136150 + icon = 136150, }, [2] = { title = L["Debuffs"], args = { - { spell = 172, type = "debuff", unit = "target"}, -- Coruption - { spell = 348, type = "debuff", unit = "target"}, -- Immolate - { spell = 702, type = "debuff", unit = "target"}, -- Curse of Weakness - { spell = 710, type = "debuff", unit = "multi"}, -- Banish - { spell = 1714, type = "debuff", unit = "target"}, -- Curse of Tongues - { spell = 1098, type = "debuff", unit = "multi"}, -- Enslave Demon - { spell = 5782, type = "debuff", unit = "target"}, -- Fear - { spell = 6358, type = "debuff", unit = "target"}, -- Seduction - { spell = 6360, type = "debuff", unit = "target"}, -- Whiplash + { spell = 172, type = "debuff", unit = "target" }, -- Coruption + { spell = 348, type = "debuff", unit = "target" }, -- Immolate + { spell = 702, type = "debuff", unit = "target" }, -- Curse of Weakness + { spell = 710, type = "debuff", unit = "multi" }, -- Banish + { spell = 1714, type = "debuff", unit = "target" }, -- Curse of Tongues + { spell = 1098, type = "debuff", unit = "multi" }, -- Enslave Demon + { spell = 5782, type = "debuff", unit = "target" }, -- Fear + { spell = 6358, type = "debuff", unit = "target" }, -- Seduction + { spell = 6360, type = "debuff", unit = "target" }, -- Whiplash { spell = 6789, type = "debuff", unit = "target", talent = 14 }, -- Mortal Coil - { spell = 17735, type = "debuff", unit = "target"}, -- Suffering - { spell = 22703, type = "debuff", unit = "target"}, -- Infernal Awakening - { spell = 30283, type = "debuff", unit = "target"}, -- Shadowfury - { spell = 80240, type = "debuff", unit = "target"}, -- Havoc - { spell = 118699, type = "debuff", unit = "target"}, -- Fear - { spell = 157736, type = "debuff", unit = "target"}, -- Immolate + { spell = 17735, type = "debuff", unit = "target" }, -- Suffering + { spell = 22703, type = "debuff", unit = "target" }, -- Infernal Awakening + { spell = 30283, type = "debuff", unit = "target" }, -- Shadowfury + { spell = 80240, type = "debuff", unit = "target" }, -- Havoc + { spell = 118699, type = "debuff", unit = "target" }, -- Fear + { spell = 157736, type = "debuff", unit = "target" }, -- Immolate { spell = 196414, type = "debuff", unit = "target", talent = 2 }, -- Eradication - { spell = 234153, type = "debuff", unit = "target"}, -- Drain Life - { spell = 265931, type = "debuff", unit = "target"}, -- Conflagrate - { spell = 334275, type = "debuff", unit = "target"}, -- Curse of Exhaustion + { spell = 234153, type = "debuff", unit = "target" }, -- Drain Life + { spell = 265931, type = "debuff", unit = "target" }, -- Conflagrate + { spell = 334275, type = "debuff", unit = "target" }, -- Curse of Exhaustion }, - icon = 135817 + icon = 135817, }, [3] = { title = L["Abilities"], args = { - { spell = 126, type = "ability"}, -- Eye of Kilrogg - { spell = 172, type = "ability", requiresTarget = true, debuff = true}, -- Corruption - { spell = 348, type = "ability", requiresTarget = true, debuff = true}, -- Immolate - { spell = 686, type = "ability"}, -- Incinerate - { spell = 698, type = "ability"}, -- Ritual of Summoning - { spell = 702, type = "ability", requiresTarget = true, debuff = true}, -- Curse of Weakness - { spell = 710, type = "ability", requiresTarget = true, debuff = true}, -- Banish - { spell = 1098, type = "ability"}, -- Subjugate Demon - { spell = 1122, type = "ability", duration = 30}, -- Summon Infernal - { spell = 1714, type = "ability", requiresTarget = true, debuff = true}, -- Curse of Tongues - { spell = 3110, type = "ability", requiresTarget = true}, -- Firebolt - { spell = 3716, type = "ability", requiresTarget = true}, -- Consuming Shadows - { spell = 5484, type = "ability"}, -- Howl of Terror - { spell = 5740, type = "ability"}, -- Rain of Fire - { spell = 5782, type = "ability", requiresTarget = true, debuff = true}, -- Fear + { spell = 126, type = "ability" }, -- Eye of Kilrogg + { spell = 172, type = "ability", requiresTarget = true, debuff = true }, -- Corruption + { spell = 348, type = "ability", requiresTarget = true, debuff = true }, -- Immolate + { spell = 686, type = "ability" }, -- Incinerate + { spell = 698, type = "ability" }, -- Ritual of Summoning + { spell = 702, type = "ability", requiresTarget = true, debuff = true }, -- Curse of Weakness + { spell = 710, type = "ability", requiresTarget = true, debuff = true }, -- Banish + { spell = 1098, type = "ability" }, -- Subjugate Demon + { spell = 1122, type = "ability", duration = 30 }, -- Summon Infernal + { spell = 1714, type = "ability", requiresTarget = true, debuff = true }, -- Curse of Tongues + { spell = 3110, type = "ability", requiresTarget = true }, -- Firebolt + { spell = 3716, type = "ability", requiresTarget = true }, -- Consuming Shadows + { spell = 5484, type = "ability" }, -- Howl of Terror + { spell = 5740, type = "ability" }, -- Rain of Fire + { spell = 5782, type = "ability", requiresTarget = true, debuff = true }, -- Fear { spell = 6353, type = "ability", talent = 3 }, -- Soul Fire - { spell = 6358, type = "ability", requiresTarget = true}, -- Seduction - { spell = 6360, type = "ability", requiresTarget = true}, -- Whiplash + { spell = 6358, type = "ability", requiresTarget = true }, -- Seduction + { spell = 6360, type = "ability", requiresTarget = true }, -- Whiplash { spell = 6789, type = "ability", requiresTarget = true, talent = 14 }, -- Mortal Coil - { spell = 7814, type = "ability", requiresTarget = true}, -- Lash of Pain - { spell = 7870, type = "ability"}, -- Lesser Invisibility - { spell = 17735, type = "ability", requiresTarget = true, debuff = true}, -- Suffering - { spell = 17767, type = "ability"}, -- Shadow Bulwark + { spell = 7814, type = "ability", requiresTarget = true }, -- Lash of Pain + { spell = 7870, type = "ability" }, -- Lesser Invisibility + { spell = 17735, type = "ability", requiresTarget = true, debuff = true }, -- Suffering + { spell = 17767, type = "ability" }, -- Shadow Bulwark { spell = 17877, type = "ability", requiresTarget = true, charges = true, talent = 6 }, -- Shadowburn - { spell = 17962, type = "ability", requiresTarget = true, charges = true}, -- Conflagrate - { spell = 19647, type = "ability", requiresTarget = true}, -- Spell Lock - { spell = 20707, type = "ability"}, -- Soulstone - { spell = 29722, type = "ability", requiresTarget = true}, -- Incinerate - { spell = 29893, type = "ability"}, -- Create Soulwell - { spell = 30283, type = "ability"}, -- Shadowfury - { spell = 48018, type = "ability"}, -- Demonic Circle - { spell = 48020, type = "ability"}, -- Demonic Circle: Teleport - { spell = 54049, type = "ability", requiresTarget = true}, -- Shadow Bite - { spell = 80240, type = "ability", requiresTarget = true, debuff = true}, -- Havoc - { spell = 89792, type = "ability"}, -- Flee - { spell = 89808, type = "ability"}, -- Singe Magic - { spell = 104773, type = "ability", buff = true}, -- Unending Resolve + { spell = 17962, type = "ability", requiresTarget = true, charges = true }, -- Conflagrate + { spell = 19647, type = "ability", requiresTarget = true }, -- Spell Lock + { spell = 20707, type = "ability" }, -- Soulstone + { spell = 29722, type = "ability", requiresTarget = true }, -- Incinerate + { spell = 29893, type = "ability" }, -- Create Soulwell + { spell = 30283, type = "ability" }, -- Shadowfury + { spell = 48018, type = "ability" }, -- Demonic Circle + { spell = 48020, type = "ability" }, -- Demonic Circle: Teleport + { spell = 54049, type = "ability", requiresTarget = true }, -- Shadow Bite + { spell = 80240, type = "ability", requiresTarget = true, debuff = true }, -- Havoc + { spell = 89792, type = "ability" }, -- Flee + { spell = 89808, type = "ability" }, -- Singe Magic + { spell = 104773, type = "ability", buff = true }, -- Unending Resolve { spell = 108416, type = "ability", buff = true, talent = 9 }, -- Dark Pact { spell = 108503, type = "ability", talent = 18 }, -- Grimoire of Sacrifice - { spell = 111771, type = "ability"}, -- Demonic Gateway - { spell = 112042, type = "ability"}, -- Threatening Presence + { spell = 111771, type = "ability" }, -- Demonic Gateway + { spell = 112042, type = "ability" }, -- Threatening Presence { spell = 113858, type = "ability", buff = true, talent = 21 }, -- Dark Soul: Instability { spell = 116858, type = "ability" }, -- Chaos Bolt { spell = 119898, type = "ability" }, -- Dark Command Demon { spell = 152108, type = "ability", talent = 12 }, -- Cataclysm - { spell = 116858, type = "ability", requiresTarget = true}, -- Chaos Bolt + { spell = 116858, type = "ability", requiresTarget = true }, -- Chaos Bolt { spell = 196447, type = "ability", usable = true, talent = 20 }, -- Channel Demonfire - { spell = 234153, type = "ability", requiresTarget = true}, -- Drain Life - { spell = 264993, type = "ability"}, -- Shadow Shield + { spell = 234153, type = "ability", requiresTarget = true }, -- Drain Life + { spell = 264993, type = "ability" }, -- Shadow Shield { spell = 333889, type = "ability" }, -- Fel Domination { spell = 334275, type = "ability", debuff = true, requiresTarget = true }, -- Curse of Exhaustion }, - icon = 135807 + icon = 135807, }, [4] = {}, [5] = {}, @@ -2926,25 +2897,24 @@ templates.class.WARLOCK = { [10] = { title = L["PvP Talents"], args = { - { spell = 199954, type="ability", debuff = true, pvptalent = 4, titleSuffix = L["cooldown"]},-- Bane of Fragility - { spell = 199954, type="debuff", unit = "target", pvptalent = 4, titleSuffix = L["debuff"]},-- Bane of Fragility - { spell = 200546, type="ability", pvptalent = 5, titleSuffix = L["cooldown"]},-- Bane of Havoc - { spell = 200548, type="debuff", unit = "target", pvptalent = 5, titleSuffix = L["debuff"]},-- Bane of Havoc - { spell = 200587, type="debuff", unit = "target", pvptalent = 10},-- Fel Fissure - { spell = 212295, type="ability", pvptalent = 6, titleSuffix = L["cooldown"]},-- Nether Ward - { spell = 212295, type="buff", unit = "player", pvptalent = 6, titleSuffix = L["buff"]},-- Nether Ward - { spell = 221703, type="ability", pvptalent = 8, titleSuffix = L["cooldown"]},-- Casting Circle - { spell = 221705, type="buff", unit = "target", pvptalent = 8, titleSuffix = L["buff"]},-- Casting Circle - { spell = 221715, type="debuff", unit = "target", pvptalent = 7},-- Essence Drain - { spell = 285933, type="buff", unit = "target", pvptalent = 2},-- Demon Armor - { spell = 328774, type="ability", buff = true, pvptalent = 3},-- Amplify Curse + { spell = 199954, type = "ability", debuff = true, pvptalent = 4, titleSuffix = L["cooldown"] }, -- Bane of Fragility + { spell = 199954, type = "debuff", unit = "target", pvptalent = 4, titleSuffix = L["debuff"] }, -- Bane of Fragility + { spell = 200546, type = "ability", pvptalent = 5, titleSuffix = L["cooldown"] }, -- Bane of Havoc + { spell = 200548, type = "debuff", unit = "target", pvptalent = 5, titleSuffix = L["debuff"] }, -- Bane of Havoc + { spell = 200587, type = "debuff", unit = "target", pvptalent = 10 }, -- Fel Fissure + { spell = 212295, type = "ability", pvptalent = 6, titleSuffix = L["cooldown"] }, -- Nether Ward + { spell = 212295, type = "buff", unit = "player", pvptalent = 6, titleSuffix = L["buff"] }, -- Nether Ward + { spell = 221703, type = "ability", pvptalent = 8, titleSuffix = L["cooldown"] }, -- Casting Circle + { spell = 221705, type = "buff", unit = "target", pvptalent = 8, titleSuffix = L["buff"] }, -- Casting Circle + { spell = 221715, type = "debuff", unit = "target", pvptalent = 7 }, -- Essence Drain + { spell = 285933, type = "buff", unit = "target", pvptalent = 2 }, -- Demon Armor + { spell = 328774, type = "ability", buff = true, pvptalent = 3 }, -- Amplify Curse }, icon = "Interface\\Icons\\Achievement_BG_winWSG", }, [11] = { title = L["Resources"], - args = { - }, + args = {}, icon = "Interface\\Icons\\inv_misc_gem_amethyst_02", }, }, @@ -2955,82 +2925,81 @@ templates.class.MONK = { [1] = { title = L["Buffs"], args = { - { spell = 101643, type = "buff", unit = "player"}, -- Transcendence - { spell = 115176, type = "buff", unit = "player"}, -- Zen Meditation + { spell = 101643, type = "buff", unit = "player" }, -- Transcendence + { spell = 115176, type = "buff", unit = "player" }, -- Zen Meditation { spell = 116841, type = "buff", unit = "player", talent = 6 }, -- Tiger's Lust { spell = 116847, type = "buff", unit = "player", talent = 17 }, -- Rushing Jade Wind { spell = 119085, type = "buff", unit = "player", talent = 5 }, -- Chi Torpedo - { spell = 120954, type = "buff", unit = "player"}, -- Fortifying Brew + { spell = 120954, type = "buff", unit = "player" }, -- Fortifying Brew { spell = 122278, type = "buff", unit = "player", talent = 15 }, -- Dampen Harm { spell = 132578, type = "buff", unit = "player" }, -- Invoke Niuzao, the Black Ox - { spell = 195630, type = "buff", unit = "player"}, -- Elusive Brawler + { spell = 195630, type = "buff", unit = "player" }, -- Elusive Brawler { spell = 196608, type = "buff", unit = "player", talent = 1 }, -- Eye of the Tiger { spell = 215479, type = "buff", unit = "player" }, -- Shuffle { spell = 228563, type = "buff", unit = "player", talent = 21 }, -- Blackout Combo - { spell = 325190, type = "buff", unit = "player"}, -- Celestial Flames + { spell = 325190, type = "buff", unit = "player" }, -- Celestial Flames }, - icon = 613398 + icon = 613398, }, [2] = { title = L["Debuffs"], args = { - { spell = 113746, type = "debuff", unit = "target", forceOwnOnly = true, ownOnly = nil}, -- Mystic Touch - { spell = 115078, type = "debuff", unit = "multi"}, -- Paralysis - { spell = 116189, type = "debuff", unit = "target"}, -- Provoke - { spell = 117952, type = "debuff", unit = "target"}, -- Crackling Jade Lightning - { spell = 121253, type = "debuff", unit = "target"}, -- Keg Smash + { spell = 113746, type = "debuff", unit = "target", forceOwnOnly = true, ownOnly = nil }, -- Mystic Touch + { spell = 115078, type = "debuff", unit = "multi" }, -- Paralysis + { spell = 116189, type = "debuff", unit = "target" }, -- Provoke + { spell = 117952, type = "debuff", unit = "target" }, -- Crackling Jade Lightning + { spell = 121253, type = "debuff", unit = "target" }, -- Keg Smash { spell = 124273, type = "debuff", unit = "player" }, -- Heavy Stagger { spell = 124274, type = "debuff", unit = "player" }, -- Moderate Stagger { spell = 124275, type = "debuff", unit = "player" }, -- Light Stagger - { spell = 119381, type = "debuff", unit = "target"}, -- Leg Sweep + { spell = 119381, type = "debuff", unit = "target" }, -- Leg Sweep { spell = 196608, type = "debuff", unit = "target", talent = 1 }, -- Eye of the Tiger - { spell = 325153, type = "debuff", unit = "target"}, -- Exploding Keg + { spell = 325153, type = "debuff", unit = "target" }, -- Exploding Keg }, - icon = 611419 + icon = 611419, }, [3] = { title = L["Abilities"], args = { - { spell = 100780, type = "ability"}, -- Tiger Palm - { spell = 100784, type = "ability"}, -- Blackout Kick - { spell = 101546, type = "ability"}, -- Spinning Crane Kick - { spell = 101643, type = "ability"}, -- Transcendence - { spell = 107079, type = "ability"}, -- Quaking Palm - { spell = 109132, type = "ability", charges = true}, -- Roll + { spell = 100780, type = "ability" }, -- Tiger Palm + { spell = 100784, type = "ability" }, -- Blackout Kick + { spell = 101546, type = "ability" }, -- Spinning Crane Kick + { spell = 101643, type = "ability" }, -- Transcendence + { spell = 107079, type = "ability" }, -- Quaking Palm + { spell = 109132, type = "ability", charges = true }, -- Roll { spell = 115008, type = "ability", charges = true, talent = 5 }, -- Chi Torpedo - { spell = 115078, type = "ability", requiresTarget = true}, -- Paralysis + { spell = 115078, type = "ability", requiresTarget = true }, -- Paralysis { spell = 115098, type = "ability", talent = 2 }, -- Chi Wave - { spell = 115176, type = "ability", buff = true}, -- Zen Meditation - { spell = 115181, type = "ability", debuff = true, overlayGlow = true}, -- Breath of Fire - { spell = 115203, type = "ability", buff = true}, -- Fortifying Brew + { spell = 115176, type = "ability", buff = true }, -- Zen Meditation + { spell = 115181, type = "ability", debuff = true, overlayGlow = true }, -- Breath of Fire + { spell = 115203, type = "ability", buff = true }, -- Fortifying Brew { spell = 115315, type = "ability", totem = true, totemNumber = 1, talent = 11 }, -- Summon Black Ox Statue { spell = 115399, type = "ability", talent = 9 }, -- Blackw Ox Brew - { spell = 115546, type = "ability", debuff = true, requiresTarget = true}, -- Provoke - { spell = 116670, type = "ability"}, -- Vivify - { spell = 116705, type = "ability"}, -- Spear Hand Strike + { spell = 115546, type = "ability", debuff = true, requiresTarget = true }, -- Provoke + { spell = 116670, type = "ability" }, -- Vivify + { spell = 116705, type = "ability" }, -- Spear Hand Strike { spell = 116841, type = "ability", talent = 6 }, -- Tiger's Lust { spell = 116844, type = "ability", talent = 12 }, -- Ring of Peace { spell = 116847, type = "ability", buff = true, talent = 17 }, -- Rushing Jade Wind - { spell = 117952, type = "ability"}, -- Crackling Jade Lightning - { spell = 119381, type = "ability"}, -- Leg Sweep - { spell = 119582, type = "ability", charges = true}, -- Purifying Brew - { spell = 119996, type = "ability"}, -- Transcendence: Transfer - { spell = 121253, type = "ability", requiresTarget = true, debuff = true}, -- Keg Smash + { spell = 117952, type = "ability" }, -- Crackling Jade Lightning + { spell = 119381, type = "ability" }, -- Leg Sweep + { spell = 119582, type = "ability", charges = true }, -- Purifying Brew + { spell = 119996, type = "ability" }, -- Transcendence: Transfer + { spell = 121253, type = "ability", requiresTarget = true, debuff = true }, -- Keg Smash { spell = 122278, type = "ability", buff = true, talent = 15 }, -- Dampen Harm { spell = 122281, type = "ability", charges = true, buff = true, talent = 14 }, -- Healing Elixir { spell = 123986, tyqpe = "ability", talent = 3 }, -- Chi Burst - { spell = 126892, type = "ability"}, -- Zen Pilgrimage + { spell = 126892, type = "ability" }, -- Zen Pilgrimage { spell = 132578, type = "ability", buff = true, requiresTarget = true }, -- Invoke Niuzao, the Black Ox - { spell = 205523, type = "ability", requiresTarget = true}, -- Blackout Strike - { spell = 218164, type = "ability"}, -- Detox - { spell = 322101, type = "ability"}, -- Expel Harm - { spell = 322109, type = "ability"}, -- Touch of Death - { spell = 325153, type = "ability", debuff = true}, -- Exploding Keg - { spell = 322507, type = "ability", buff = true}, -- Celestial Brew - { spell = 324312, type = "ability"}, -- Clash - + { spell = 205523, type = "ability", requiresTarget = true }, -- Blackout Strike + { spell = 218164, type = "ability" }, -- Detox + { spell = 322101, type = "ability" }, -- Expel Harm + { spell = 322109, type = "ability" }, -- Touch of Death + { spell = 325153, type = "ability", debuff = true }, -- Exploding Keg + { spell = 322507, type = "ability", buff = true }, -- Celestial Brew + { spell = 324312, type = "ability" }, -- Clash }, - icon = 133701 + icon = 133701, }, [4] = {}, [5] = {}, @@ -3041,23 +3010,22 @@ templates.class.MONK = { [10] = { title = L["PvP Talents"], args = { - { spell = 202335, type="ability", pvptalent = 8, titleSuffix = L["cooldown"]},-- Double Barrel - { spell = 202335, type="buff", unit = "player", pvptalent = 8, titleSuffix = L["buff"]},-- Double Barrel - { spell = 202162, type="ability", pvptalent = 1, titleSuffix = L["cooldown"]},-- Avert Harm - { spell = 202162, type="buff", unit = "group", pvptalent = 1, titleSuffix = L["buff"]},-- Avert Harm - { spell = 202274, type="debuff", unit = "target", pvptalent = 7},-- Incendiary Breath - { spell = 202370, type="ability", pvptalent = 9},-- Mighty Ox Kick - { spell = 206891, type="debuff", unit = "target", pvptalent = 11, titleSuffix = L["debuff"]},-- Admonishment - { spell = 207025, type="ability", pvptalent = 11, titleSuffix = L["cooldown"]},-- Admonishment - { spell = 213658, type="ability", pvptalent = 6, titleSuffix = L["cooldown"]},-- Craft: Nimble Brew - { spell = 213664, type="buff", unit = "player", pvptalent = 6, titleSuffix = L["buff"]},-- Craft: Nimble Brew + { spell = 202335, type = "ability", pvptalent = 8, titleSuffix = L["cooldown"] }, -- Double Barrel + { spell = 202335, type = "buff", unit = "player", pvptalent = 8, titleSuffix = L["buff"] }, -- Double Barrel + { spell = 202162, type = "ability", pvptalent = 1, titleSuffix = L["cooldown"] }, -- Avert Harm + { spell = 202162, type = "buff", unit = "group", pvptalent = 1, titleSuffix = L["buff"] }, -- Avert Harm + { spell = 202274, type = "debuff", unit = "target", pvptalent = 7 }, -- Incendiary Breath + { spell = 202370, type = "ability", pvptalent = 9 }, -- Mighty Ox Kick + { spell = 206891, type = "debuff", unit = "target", pvptalent = 11, titleSuffix = L["debuff"] }, -- Admonishment + { spell = 207025, type = "ability", pvptalent = 11, titleSuffix = L["cooldown"] }, -- Admonishment + { spell = 213658, type = "ability", pvptalent = 6, titleSuffix = L["cooldown"] }, -- Craft: Nimble Brew + { spell = 213664, type = "buff", unit = "player", pvptalent = 6, titleSuffix = L["buff"] }, -- Craft: Nimble Brew }, icon = "Interface\\Icons\\Achievement_BG_winWSG", }, [11] = { title = L["Resources"], - args = { - }, + args = {}, icon = "Interface\\Icons\\monk_stance_drunkenox", }, }, @@ -3065,85 +3033,84 @@ templates.class.MONK = { [1] = { title = L["Buffs"], args = { - { spell = 101643, type = "buff", unit = "player"}, -- Transcendence - { spell = 116680, type = "buff", unit = "player"}, -- Thunder Focus Tea - { spell = 115175, type = "buff", unit = "target"}, -- Soothing Mist + { spell = 101643, type = "buff", unit = "player" }, -- Transcendence + { spell = 116680, type = "buff", unit = "player" }, -- Thunder Focus Tea + { spell = 115175, type = "buff", unit = "target" }, -- Soothing Mist { spell = 116841, type = "buff", unit = "player", talent = 6 }, -- Tiger's Lust - { spell = 116849, type = "buff", unit = "target"}, -- Life Cocoon + { spell = 116849, type = "buff", unit = "target" }, -- Life Cocoon { spell = 119085, type = "buff", unit = "player", talent = 5 }, -- Chi Torpedo - { spell = 119611, type = "buff", unit = "target"}, -- Renewing Mist + { spell = 119611, type = "buff", unit = "target" }, -- Renewing Mist { spell = 122278, type = "buff", unit = "player", talent = 15 }, -- Dampen Harm { spell = 122783, type = "buff", unit = "player", talent = 14 }, -- Diffuse Magic - { spell = 124682, type = "buff", unit = "target"}, -- Enveloping Mist - { spell = 191840, type = "buff", unit = "player"}, -- Essence Font + { spell = 124682, type = "buff", unit = "target" }, -- Enveloping Mist + { spell = 191840, type = "buff", unit = "player" }, -- Essence Font { spell = 196725, type = "buff", unit = "player", talent = 17 }, -- Refreshing Jade Wind { spell = 197908, type = "buff", unit = "player", talent = 9 }, -- Mana Tea { spell = 197916, type = "buff", unit = "player", talent = 7 }, -- Lifecycles (Vivify) { spell = 197919, type = "buff", unit = "player", talent = 7 }, -- Lifecycles (Enveloping Mist) - { spell = 243435, type = "buff", unit = "player"}, -- Fortifying Brew - { spell = 202090, type = "buff", unit = "player"}, -- Teachings of the Monastery - + { spell = 243435, type = "buff", unit = "player" }, -- Fortifying Brew + { spell = 202090, type = "buff", unit = "player" }, -- Teachings of the Monastery }, - icon = 627487 + icon = 627487, }, [2] = { title = L["Debuffs"], args = { - { spell = 113746, type = "debuff", unit = "target", forceOwnOnly = true, ownOnly = nil}, -- Mystic Touch - { spell = 115078, type = "debuff", unit = "multi"}, -- Paralysis - { spell = 116189, type = "debuff", unit = "target"}, -- Provoke - { spell = 117952, type = "debuff", unit = "target"}, -- Crackling Jade Lightning - { spell = 119381, type = "debuff", unit = "target"}, -- Leg Sweep - { spell = 198909, type = "debuff", unit = "target", talent = 11}, -- Song of Chi-Ji + { spell = 113746, type = "debuff", unit = "target", forceOwnOnly = true, ownOnly = nil }, -- Mystic Touch + { spell = 115078, type = "debuff", unit = "multi" }, -- Paralysis + { spell = 116189, type = "debuff", unit = "target" }, -- Provoke + { spell = 117952, type = "debuff", unit = "target" }, -- Crackling Jade Lightning + { spell = 119381, type = "debuff", unit = "target" }, -- Leg Sweep + { spell = 198909, type = "debuff", unit = "target", talent = 11 }, -- Song of Chi-Ji }, - icon = 629534 + icon = 629534, }, [3] = { title = L["Abilities"], args = { - { spell = 100780, type = "ability", requiresTarget = true}, -- Tiger Palm - { spell = 100784, type = "ability", requiresTarget = true}, -- Blackout Kick - { spell = 101546, type = "ability"}, -- Spinning Crane Kick - { spell = 101643, type = "ability"}, -- Transcendence - { spell = 107079, type = "ability"}, -- Quaking Palm - { spell = 107428, type = "ability", requiresTarget = true}, -- Rising Sun Kick - { spell = 109132, type = "ability", charges = true}, -- Roll + { spell = 100780, type = "ability", requiresTarget = true }, -- Tiger Palm + { spell = 100784, type = "ability", requiresTarget = true }, -- Blackout Kick + { spell = 101546, type = "ability" }, -- Spinning Crane Kick + { spell = 101643, type = "ability" }, -- Transcendence + { spell = 107079, type = "ability" }, -- Quaking Palm + { spell = 107428, type = "ability", requiresTarget = true }, -- Rising Sun Kick + { spell = 109132, type = "ability", charges = true }, -- Roll { spell = 115008, type = "ability", charges = true, talent = 5 }, -- Chi Torpedo - { spell = 115078, type = "ability", requiresTarget = true}, -- Paralysis + { spell = 115078, type = "ability", requiresTarget = true }, -- Paralysis { spell = 115098, type = "ability", talent = 2 }, -- Chi Wave - { spell = 115175, type = "ability"}, -- Soothing Mist - { spell = 115203, type = "ability", buff = true}, -- Fortifying Brew - { spell = 115151, type = "ability", charges = true, buff = true}, -- Renewing Mist - { spell = 115310, type = "ability"}, -- Revival + { spell = 115175, type = "ability" }, -- Soothing Mist + { spell = 115203, type = "ability", buff = true }, -- Fortifying Brew + { spell = 115151, type = "ability", charges = true, buff = true }, -- Renewing Mist + { spell = 115310, type = "ability" }, -- Revival { spell = 115313, type = "ability", totem = true, totemNumber = 1, talent = 16 }, -- Summon Jade Serpent Statue - { spell = 115540, type = "ability"}, -- Detox - { spell = 115546, type = "ability", debuff = true, requiresTarget = true}, -- Provoke - { spell = 116670, type = "ability"}, -- Vivify - { spell = 116680, type = "ability", buff = true, charges = true}, -- Thunder Focus Tea + { spell = 115540, type = "ability" }, -- Detox + { spell = 115546, type = "ability", debuff = true, requiresTarget = true }, -- Provoke + { spell = 116670, type = "ability" }, -- Vivify + { spell = 116680, type = "ability", buff = true, charges = true }, -- Thunder Focus Tea { spell = 116841, type = "ability", talent = 6 }, -- Tiger's Lust { spell = 116844, type = "ability", talent = 12 }, -- Ring of Peace - { spell = 116849, type = "ability", buff = true, requiresTarget = true}, -- Life Cocoon - { spell = 117952, type = "ability"}, -- Crackling Jade Lightning - { spell = 119381, type = "ability", debuff = true}, -- Leg Sweep - { spell = 119996, type = "ability"}, -- Transcendence: Transfer + { spell = 116849, type = "ability", buff = true, requiresTarget = true }, -- Life Cocoon + { spell = 117952, type = "ability" }, -- Crackling Jade Lightning + { spell = 119381, type = "ability", debuff = true }, -- Leg Sweep + { spell = 119996, type = "ability" }, -- Transcendence: Transfer { spell = 122278, type = "ability", buff = true, talent = 15 }, -- Dampen Harm { spell = 122281, type = "ability", charges = true, buff = true, talent = 13 }, -- Healing Elixir { spell = 122783, type = "ability", buff = true, talent = 14 }, -- Diffuse Magic { spell = 123986, type = "ability", talent = 3 }, -- Chi Burst { spell = 124682, type = "ability", buff = true, requiresTarget = true }, -- Enveloping Mist - { spell = 126892, type = "ability"}, -- Zen Pilgrimage - { spell = 191837, type = "ability"}, -- Essence Font + { spell = 126892, type = "ability" }, -- Zen Pilgrimage + { spell = 191837, type = "ability" }, -- Essence Font { spell = 196725, type = "ability", buff = true, talent = 17 }, -- Refreshing Jade Wind { spell = 197908, type = "ability", buff = true, talent = 9 }, -- Mana Tea { spell = 198898, type = "ability", talent = 11 }, -- Song of Chi-Ji - { spell = 218164, type = "ability"}, -- Detox - { spell = 243435, type = "ability", buff = true}, -- Fortifying Brew - { spell = 322101, type = "ability"}, -- Expel Harm - { spell = 322109, type = "ability", usable = true}, -- Touch of Death - { spell = 322118, type = "ability", duration = 25}, -- Invoke Yu'lon, the Jade Serpent + { spell = 218164, type = "ability" }, -- Detox + { spell = 243435, type = "ability", buff = true }, -- Fortifying Brew + { spell = 322101, type = "ability" }, -- Expel Harm + { spell = 322109, type = "ability", usable = true }, -- Touch of Death + { spell = 322118, type = "ability", duration = 25 }, -- Invoke Yu'lon, the Jade Serpent { spell = 325197, type = "ability", talent = 18 }, -- Invoke Chi-Ji, the Red Crane }, - icon = 627485 + icon = 627485, }, [4] = {}, [5] = {}, @@ -3154,20 +3121,19 @@ templates.class.MONK = { [10] = { title = L["PvP Talents"], args = { - { spell = 205234, type="ability", pvptalent = 6},-- Healing Sphere - { spell = 209584, type="ability", pvptalent = 2, titleSuffix = L["cooldown"]},-- Zen Focus Tea - { spell = 209584, type="buff", unit = "player", pvptalent = 2, titleSuffix = L["buff"]},-- Zen Focus Tea - { spell = 227344, type="buff", unit = "target", pvptalent = 7},-- Surging Mist - { spell = 205655, type="buff", unit = "target", pvptalent = 5},-- Dome of Mist - { spell = 233759, type="ability", pvptalent = 1, titleSuffix = L["cooldown"]},-- Grapple Weapon - { spell = 233759, type="debuff", unit = "target", pvptalent = 1, titleSuffix = L["debuff"]},-- Grapple Weapon + { spell = 205234, type = "ability", pvptalent = 6 }, -- Healing Sphere + { spell = 209584, type = "ability", pvptalent = 2, titleSuffix = L["cooldown"] }, -- Zen Focus Tea + { spell = 209584, type = "buff", unit = "player", pvptalent = 2, titleSuffix = L["buff"] }, -- Zen Focus Tea + { spell = 227344, type = "buff", unit = "target", pvptalent = 7 }, -- Surging Mist + { spell = 205655, type = "buff", unit = "target", pvptalent = 5 }, -- Dome of Mist + { spell = 233759, type = "ability", pvptalent = 1, titleSuffix = L["cooldown"] }, -- Grapple Weapon + { spell = 233759, type = "debuff", unit = "target", pvptalent = 1, titleSuffix = L["debuff"] }, -- Grapple Weapon }, icon = "Interface\\Icons\\Achievement_BG_winWSG", }, [11] = { title = L["Resources"], - args = { - }, + args = {}, icon = manaIcon, }, }, @@ -3175,15 +3141,15 @@ templates.class.MONK = { [1] = { title = L["Buffs"], args = { - { spell = 101643, type = "buff", unit = "player"}, -- Transcendence - { spell = 115288, type = "buff", unit = "player", talent = 9}, -- Energizing Brew - { spell = 116768, type = "buff", unit = "player"}, -- Blackout Kick! + { spell = 101643, type = "buff", unit = "player" }, -- Transcendence + { spell = 115288, type = "buff", unit = "player", talent = 9 }, -- Energizing Brew + { spell = 116768, type = "buff", unit = "player" }, -- Blackout Kick! { spell = 116841, type = "buff", unit = "player", talent = 6 }, -- Tiger's Lust { spell = 119085, type = "buff", unit = "player", talent = 5 }, -- Chi Torpedo { spell = 122783, type = "buff", unit = "player", talent = 14 }, -- Diffuse Magic { spell = 122278, type = "buff", unit = "player", talent = 15 }, -- Dampen Harm - { spell = 125174, type = "buff", unit = "player"}, -- Touch of Karma - { spell = 137639, type = "buff", unit = "player"}, -- Storm, Earth, and Fire + { spell = 125174, type = "buff", unit = "player" }, -- Touch of Karma + { spell = 137639, type = "buff", unit = "player" }, -- Storm, Earth, and Fire { spell = 152173, type = "buff", unit = "player", talent = 21 }, -- Serenity { spell = 166646, type = "buff", unit = "player" }, -- Windwalking { spell = 196608, type = "buff", unit = "player", talent = 1 }, -- Eye of the Tiger @@ -3193,69 +3159,68 @@ templates.class.MONK = { { spell = 261769, type = "buff", unit = "player", talent = 13 }, -- Inner Strength { spell = 325202, type = "buff", unit = "player", talent = 18 }, -- Dance of Chi-Ji }, - icon = 611420 + icon = 611420, }, [2] = { title = L["Debuffs"], args = { - { spell = 113746, type = "debuff", unit = "target", forceOwnOnly = true, ownOnly = nil}, -- Mystic Touch - { spell = 115078, type = "debuff", unit = "multi"}, -- Paralysis - { spell = 115080, type = "debuff", unit = "target"}, -- Touch of Death - { spell = 115804, type = "debuff", unit = "target"}, -- Mortal Wounds - { spell = 116189, type = "debuff", unit = "target"}, -- Provoke - { spell = 116706, type = "debuff", unit = "target"}, -- Disable - { spell = 117952, type = "debuff", unit = "target"}, -- Crackling Jade Lightning - { spell = 119381, type = "debuff", unit = "target"}, -- Leg Sweep - { spell = 122470, type = "debuff", unit = "target"}, -- Touch of Karma - { spell = 123586, type = "debuff", unit = "target"}, -- Flying Serpent Kick + { spell = 113746, type = "debuff", unit = "target", forceOwnOnly = true, ownOnly = nil }, -- Mystic Touch + { spell = 115078, type = "debuff", unit = "multi" }, -- Paralysis + { spell = 115080, type = "debuff", unit = "target" }, -- Touch of Death + { spell = 115804, type = "debuff", unit = "target" }, -- Mortal Wounds + { spell = 116189, type = "debuff", unit = "target" }, -- Provoke + { spell = 116706, type = "debuff", unit = "target" }, -- Disable + { spell = 117952, type = "debuff", unit = "target" }, -- Crackling Jade Lightning + { spell = 119381, type = "debuff", unit = "target" }, -- Leg Sweep + { spell = 122470, type = "debuff", unit = "target" }, -- Touch of Karma + { spell = 123586, type = "debuff", unit = "target" }, -- Flying Serpent Kick { spell = 196608, type = "debuff", unit = "target", talent = 1 }, -- Eye of the Tiger - { spell = 228287, type = "debuff", unit = "target"}, -- Mark of the Crane - + { spell = 228287, type = "debuff", unit = "target" }, -- Mark of the Crane }, - icon = 629534 + icon = 629534, }, [3] = { title = L["Abilities"], args = { - { spell = 100780, type = "ability", requiresTarget = true}, -- Tiger Palm - { spell = 100784, type = "ability", requiresTarget = true, overlayGlow = true}, -- Blackout Kick - { spell = 101545, type = "ability"}, -- Flying Serpent Kick - { spell = 101546, type = "ability", overlayGlow = true}, -- Spinning Crane Kick - { spell = 101643, type = "ability"}, -- Transcendence - { spell = 107428, type = "ability", requiresTarget = true}, -- Rising Sun Kick - { spell = 109132, type = "ability", charges = true}, -- Roll - { spell = 113656, type = "ability", requiresTarget = true}, -- Fists of Fury + { spell = 100780, type = "ability", requiresTarget = true }, -- Tiger Palm + { spell = 100784, type = "ability", requiresTarget = true, overlayGlow = true }, -- Blackout Kick + { spell = 101545, type = "ability" }, -- Flying Serpent Kick + { spell = 101546, type = "ability", overlayGlow = true }, -- Spinning Crane Kick + { spell = 101643, type = "ability" }, -- Transcendence + { spell = 107428, type = "ability", requiresTarget = true }, -- Rising Sun Kick + { spell = 109132, type = "ability", charges = true }, -- Roll + { spell = 113656, type = "ability", requiresTarget = true }, -- Fists of Fury { spell = 115008, type = "ability", charges = true, talent = 5 }, -- Chi Torpedo - { spell = 115078, type = "ability", requiresTarget = true}, -- Paralysis + { spell = 115078, type = "ability", requiresTarget = true }, -- Paralysis { spell = 115098, type = "ability", talent = 2 }, -- Chi Wave { spell = 115203, type = "ability", buff = true }, -- Fortifying Brew { spell = 115288, type = "ability", talent = 9 }, -- Energizing Elixir - { spell = 115546, type = "ability", debuff = true, requiresTarget = true}, -- Provoke - { spell = 116095, type = "ability", requiresTarget = true}, -- Disable - { spell = 116705, type = "ability", requiresTarget = true}, -- Spear Hand Strike - { spell = 116670, type = "ability"}, -- Vivify + { spell = 115546, type = "ability", debuff = true, requiresTarget = true }, -- Provoke + { spell = 116095, type = "ability", requiresTarget = true }, -- Disable + { spell = 116705, type = "ability", requiresTarget = true }, -- Spear Hand Strike + { spell = 116670, type = "ability" }, -- Vivify { spell = 116841, type = "ability", talent = 6 }, -- Tiger's Lust { spell = 116844, type = "ability", talent = 12 }, -- Ring of Peace { spell = 116847, type = "ability", talent = 17 }, -- Rushing Jade Wind - { spell = 117952, type = "ability"}, -- Crackling Jade Lightning - { spell = 119381, type = "ability"}, -- Leg Sweep - { spell = 119996, type = "ability"}, -- Transcendence: Transfer + { spell = 117952, type = "ability" }, -- Crackling Jade Lightning + { spell = 119381, type = "ability" }, -- Leg Sweep + { spell = 119996, type = "ability" }, -- Transcendence: Transfer { spell = 122278, type = "ability", buff = true, talent = 15 }, -- Dampen Harm - { spell = 122470, type = "ability", debuff = true, requiresTarget = true}, -- Touch of Karma + { spell = 122470, type = "ability", debuff = true, requiresTarget = true }, -- Touch of Karma { spell = 122783, type = "ability", buff = true, talent = 14 }, -- Diffuse Magic { spell = 123904, type = "ability", requiresTarget = true }, -- Invoke Xuen, the White Tiger { spell = 123986, type = "ability", talent = 3 }, -- Chi Burst - { spell = 126892, type = "ability"}, -- Zen Pilgrimage - { spell = 137639, type = "ability", charges = true, buff = true}, -- Storm, Earth, and Fire + { spell = 126892, type = "ability" }, -- Zen Pilgrimage + { spell = 137639, type = "ability", charges = true, buff = true }, -- Storm, Earth, and Fire { spell = 152173, type = "ability", buff = true, talent = 21 }, -- Serenity { spell = 152175, type = "ability", usable = true, talent = 20 }, -- Whirling Dragon Punch - { spell = 218164, type = "ability"}, -- Detox + { spell = 218164, type = "ability" }, -- Detox { spell = 261715, type = "ability", buff = true, talent = 17 }, -- Rushing Jade Wind { spell = 261947, type = "ability", talent = 8 }, -- Fist of the White Tiger - { spell = 322101, type = "ability"}, -- Expel Harm - { spell = 322109, type = "ability", usable = true, requiresTarget = true}, -- Touch of Death + { spell = 322101, type = "ability" }, -- Expel Harm + { spell = 322109, type = "ability", usable = true, requiresTarget = true }, -- Touch of Death }, - icon = 627606 + icon = 627606, }, [4] = {}, [5] = {}, @@ -3266,23 +3231,22 @@ templates.class.MONK = { [10] = { title = L["PvP Talents"], args = { - { spell = 201447, type="buff", unit = "player", pvptalent = 4},-- Ride the Wind - { spell = 201787, type="debuff", unit = "target", pvptalent = 1},-- Turbo Fists - { spell = 233759, type="ability", pvptalent = 7, titleSuffix = L["cooldown"]},-- Grapple Weapon - { spell = 233759, type="debuff", unit = "target", pvptalent = 7, titleSuffix = L["debuff"]},-- Grapple Weapon - { spell = 247483, type="ability", pvptalent = 2, titleSuffix = L["cooldown"]},-- Tigereye Brew - { spell = 247483, type="buff", unit = "player", pvptalent = 2, titleSuffix = L["buff"]},-- Tigereye Brew - { spell = 248646, type="buff", unit = "player", pvptalent = 2, titleSuffix = L["buff"]},-- Tigereye Brew - { spell = 287504, type="buff", unit = "player", pvptalent = 8, titleSuffix = L["buff"]},-- Alpha Tiger - { spell = 287771, type="ability", pvptalent = 3},-- Reverse Harm - { spell = 290512, type="debuff", unit = "target", pvptalent = 8, titleSuffix = L["debuff"]},-- Alpha Tiger + { spell = 201447, type = "buff", unit = "player", pvptalent = 4 }, -- Ride the Wind + { spell = 201787, type = "debuff", unit = "target", pvptalent = 1 }, -- Turbo Fists + { spell = 233759, type = "ability", pvptalent = 7, titleSuffix = L["cooldown"] }, -- Grapple Weapon + { spell = 233759, type = "debuff", unit = "target", pvptalent = 7, titleSuffix = L["debuff"] }, -- Grapple Weapon + { spell = 247483, type = "ability", pvptalent = 2, titleSuffix = L["cooldown"] }, -- Tigereye Brew + { spell = 247483, type = "buff", unit = "player", pvptalent = 2, titleSuffix = L["buff"] }, -- Tigereye Brew + { spell = 248646, type = "buff", unit = "player", pvptalent = 2, titleSuffix = L["buff"] }, -- Tigereye Brew + { spell = 287504, type = "buff", unit = "player", pvptalent = 8, titleSuffix = L["buff"] }, -- Alpha Tiger + { spell = 287771, type = "ability", pvptalent = 3 }, -- Reverse Harm + { spell = 290512, type = "debuff", unit = "target", pvptalent = 8, titleSuffix = L["debuff"] }, -- Alpha Tiger }, icon = "Interface\\Icons\\Achievement_BG_winWSG", }, [11] = { title = L["Resources"], - args = { - }, + args = {}, icon = "Interface\\Icons\\ability_monk_healthsphere", }, }, @@ -3293,91 +3257,91 @@ templates.class.DRUID = { [1] = { title = L["Buffs"], args = { - { spell = 768, type = "buff", unit = "player"}, -- Cat Form + { spell = 768, type = "buff", unit = "player" }, -- Cat Form { spell = 774, type = "buff", unit = "player", talent = 9 }, -- Rejuvenation - { spell = 783, type = "buff", unit = "player"}, -- Travel Form - { spell = 1850, type = "buff", unit = "player"}, -- Dash - { spell = 5215, type = "buff", unit = "player"}, -- Prowl - { spell = 5487, type = "buff", unit = "player"}, -- Bear Form - { spell = 8936, type = "buff", unit = "player"}, -- Regrowth - { spell = 22812, type = "buff", unit = "player"}, -- Barkskin + { spell = 783, type = "buff", unit = "player" }, -- Travel Form + { spell = 1850, type = "buff", unit = "player" }, -- Dash + { spell = 5215, type = "buff", unit = "player" }, -- Prowl + { spell = 5487, type = "buff", unit = "player" }, -- Bear Form + { spell = 8936, type = "buff", unit = "player" }, -- Regrowth + { spell = 22812, type = "buff", unit = "player" }, -- Barkskin { spell = 22842, type = "buff", unit = "player", talent = 8 }, -- Frenzied Regeneration - { spell = 24858, type = "buff", unit = "player"}, -- Moonkin Form - { spell = 29166, type = "buff", unit = "group"}, -- Innervate + { spell = 24858, type = "buff", unit = "player" }, -- Moonkin Form + { spell = 29166, type = "buff", unit = "group" }, -- Innervate { spell = 48517, type = "buff", unit = "player" }, -- Eclipse (Solar) { spell = 48438, type = "buff", unit = "player", talent = 9 }, -- Wild Growth { spell = 48518, type = "buff", unit = "player" }, -- Eclipse (Lunar) { spell = 102560, type = "buff", unit = "player", talent = 15 }, -- Incarnation: Chosen of Elune { spell = 106898, type = "buff", unit = "player" }, -- Stampeding Roar { spell = 108294, type = "buff", unit = "player", talent = 12 }, -- Heart of the Wild - { spell = 191034, type = "buff", unit = "player"}, -- Starfall + { spell = 191034, type = "buff", unit = "player" }, -- Starfall { spell = 192081, type = "buff", unit = "player" }, -- Ironfur - { spell = 194223, type = "buff", unit = "player"}, -- Celestial Alignment + { spell = 194223, type = "buff", unit = "player" }, -- Celestial Alignment { spell = 202425, type = "buff", unit = "player", talent = 2 }, -- Warrior of Elune { spell = 202461, type = "buff", unit = "player", talent = 16 }, -- Stellar Drift { spell = 252216, type = "buff", unit = "player", talent = 4 }, -- Tiger Dash { spell = 279709, type = "buff", unit = "player", talent = 14 }, -- Starlord }, - icon = 136097 + icon = 136097, }, [2] = { title = L["Debuffs"], args = { - { spell = 339, type = "debuff", unit = "multi"}, -- Entangling Roots + { spell = 339, type = "debuff", unit = "multi" }, -- Entangling Roots { spell = 1079, type = "debuff", unit = "target", talent = 7 }, -- Rip - { spell = 2637, type = "debuff", unit = "multi"}, -- Hibernate + { spell = 2637, type = "debuff", unit = "multi" }, -- Hibernate { spell = 5211, type = "debuff", unit = "target", talent = 10 }, -- Mighty Bash - { spell = 6795, type = "debuff", unit = "target"}, -- Growl - { spell = 33786, type = "debuff", unit = "target"}, -- Cyclone - { spell = 61391, type = "debuff", unit = "target"}, -- Typhoon - { spell = 81261, type = "debuff", unit = "target"}, -- Solar Beam + { spell = 6795, type = "debuff", unit = "target" }, -- Growl + { spell = 33786, type = "debuff", unit = "target" }, -- Cyclone + { spell = 61391, type = "debuff", unit = "target" }, -- Typhoon + { spell = 81261, type = "debuff", unit = "target" }, -- Solar Beam { spell = 102359, type = "debuff", unit = "target", talent = 11 }, -- Mass Entanglement { spell = 155722, type = "debuff", unit = "target", talent = 7 }, -- Rake - { spell = 164812, type = "debuff", unit = "target"}, -- Moonfire - { spell = 164815, type = "debuff", unit = "target"}, -- Sunfire + { spell = 164812, type = "debuff", unit = "target" }, -- Moonfire + { spell = 164815, type = "debuff", unit = "target" }, -- Sunfire { spell = 192090, type = "debuff", unit = "target", talent = 8 }, -- Thrash { spell = 202347, type = "debuff", unit = "target", talent = 18 }, -- Stellar Flare { spell = 205644, type = "debuff", unit = "target", talent = 3 }, -- Force of Nature }, - icon = 132114 + icon = 132114, }, [3] = { title = L["Abilities"], args = { - { spell = 99, type = "ability", talent = 8}, -- Incapacitating Roar - { spell = 339, type = "ability", debuff = true}, -- Entangling Roots - { spell = 768, type = "ability"}, -- Cat Form - { spell = 783, type = "ability"}, -- Travel Form - { spell = 1079, type = "ability", talent = 7}, -- Rip - { spell = 1822, type = "ability", debuff = true, talent = 7}, -- Rake - { spell = 1850, type = "ability", buff = true}, -- Dash - { spell = 2782, type = "ability"}, -- Remove Corruption - { spell = 2908, type = "ability", requiresTarget = true}, -- Soothe + { spell = 99, type = "ability", talent = 8 }, -- Incapacitating Roar + { spell = 339, type = "ability", debuff = true }, -- Entangling Roots + { spell = 768, type = "ability" }, -- Cat Form + { spell = 783, type = "ability" }, -- Travel Form + { spell = 1079, type = "ability", talent = 7 }, -- Rip + { spell = 1822, type = "ability", debuff = true, talent = 7 }, -- Rake + { spell = 1850, type = "ability", buff = true }, -- Dash + { spell = 2782, type = "ability" }, -- Remove Corruption + { spell = 2908, type = "ability", requiresTarget = true }, -- Soothe { spell = 5176, type = "ability", requiresTarget = true }, -- Wrath { spell = 5211, type = "ability", requiresTarget = true, talent = 10 }, -- Mighty Bash - { spell = 5215, type = "ability", buff = true}, -- Prowl - { spell = 5221, type = "ability"}, -- Shred - { spell = 5487, type = "ability"}, -- Bear Form - { spell = 6795, type = "ability", debuff = true, requiresTarget = true}, -- Growl - { spell = 8921, type = "ability", requiresTarget = true, debuff = true}, -- Moonfire - { spell = 8936, type = "ability"}, -- Regrowth + { spell = 5215, type = "ability", buff = true }, -- Prowl + { spell = 5221, type = "ability" }, -- Shred + { spell = 5487, type = "ability" }, -- Bear Form + { spell = 6795, type = "ability", debuff = true, requiresTarget = true }, -- Growl + { spell = 8921, type = "ability", requiresTarget = true, debuff = true }, -- Moonfire + { spell = 8936, type = "ability" }, -- Regrowth { spell = 16979, type = "ability", requiresTarget = true, talent = 6 }, -- Wild Charge { spell = 18562, type = "ability", talent = 9 }, -- Swiftmend - { spell = 20484, type = "ability"}, -- Rebirth - { spell = 22568, type = "ability", requiresTarget = true}, -- Ferocious Bite - { spell = 22570, type = "ability", requiresTarget = true, talent = 7}, -- Maim - { spell = 22812, type = "ability", buff = true}, -- Barkskin + { spell = 20484, type = "ability" }, -- Rebirth + { spell = 22568, type = "ability", requiresTarget = true }, -- Ferocious Bite + { spell = 22570, type = "ability", requiresTarget = true, talent = 7 }, -- Maim + { spell = 22812, type = "ability", buff = true }, -- Barkskin { spell = 22842, type = "ability", buff = true, talent = 8 }, -- Frenzied Regeneration - { spell = 24858, type = "ability"}, -- Moonkin Form - { spell = 29166, type = "ability"}, -- Innervate - { spell = 33917, type = "ability", requiresTarget = true}, -- Mangle - { spell = 33786, type = "ability", requiresTarget = true, debuff = true}, -- Cyclone + { spell = 24858, type = "ability" }, -- Moonkin Form + { spell = 29166, type = "ability" }, -- Innervate + { spell = 33917, type = "ability", requiresTarget = true }, -- Mangle + { spell = 33786, type = "ability", requiresTarget = true, debuff = true }, -- Cyclone { spell = 48438, type = "ability", talent = 9 }, -- Wild Growth { spell = 49376, type = "ability", requiresTarget = true, talent = 6 }, -- Wild Charge { spell = 77758, type = "ability", talent = 8 }, -- Thrash - { spell = 78674, type = "ability", requiresTarget = true}, -- Starsurge - { spell = 78675, type = "ability", requiresTarget = true}, -- Solar Beam - { spell = 93402, type = "ability", requiresTarget = true, debuff = true}, -- Sunfire + { spell = 78674, type = "ability", requiresTarget = true }, -- Starsurge + { spell = 78675, type = "ability", requiresTarget = true }, -- Solar Beam + { spell = 93402, type = "ability", requiresTarget = true, debuff = true }, -- Sunfire { spell = 102359, type = "ability", requiresTarget = true, talent = 11 }, -- Mass Entanglement { spell = 102383, type = "ability", talent = 6 }, -- Wild Charge { spell = 102401, type = "ability", talent = 6 }, -- Wild Charge @@ -3386,22 +3350,22 @@ templates.class.DRUID = { { spell = 106832, type = "ability", talent = 8 }, -- Thrash { spell = 106898, type = "ability" }, -- Stampeding Roar { spell = 108238, type = "ability", talent = 5 }, -- Renewal - { spell = 132469, type = "ability"}, -- Typhoon - { spell = 190984, type = "ability", requiresTarget = true, overlayGlow = true}, -- Solar Wrath - { spell = 191034, type = "ability", buff = true}, -- Starfall + { spell = 132469, type = "ability" }, -- Typhoon + { spell = 190984, type = "ability", requiresTarget = true, overlayGlow = true }, -- Solar Wrath + { spell = 191034, type = "ability", buff = true }, -- Starfall { spell = 192081, type = "ability", buff = true }, -- Ironfur - { spell = 194153, type = "ability", requiresTarget = true, overlayGlow = true}, -- Starfire - { spell = 194223, type = "ability", buff = true}, -- Celestial Alignment - { spell = 202347, type = "ability", requiresTarget = true, debuff = true, talent = 18}, -- Stellar Flare + { spell = 194153, type = "ability", requiresTarget = true, overlayGlow = true }, -- Starfire + { spell = 194223, type = "ability", buff = true }, -- Celestial Alignment + { spell = 202347, type = "ability", requiresTarget = true, debuff = true, talent = 18 }, -- Stellar Flare { spell = 202425, type = "ability", buff = true, talent = 2 }, -- Warrior of Elune { spell = 202770, type = "ability", talent = 20 }, -- Fury of Elune { spell = 205636, type = "ability", duration = 10, talent = 3 }, -- Force of Nature { spell = 213764, type = "ability", talent = 7 }, -- Swipe { spell = 252216, type = "ability", buff = true, talent = 4 }, -- Tiger Dash { spell = 274281, type = "ability", requiresTarget = true, charges = true, talent = 21 }, -- New Moon - { spell = 319454, type = "ability", buff = true, talent = 12}, -- Heart of the Wild + { spell = 319454, type = "ability", buff = true, talent = 12 }, -- Heart of the Wild }, - icon = 132134 + icon = 132134, }, [4] = {}, [5] = {}, @@ -3412,20 +3376,19 @@ templates.class.DRUID = { [10] = { title = L["PvP Talents"], args = { - { spell = 200947, type="debuff", unit = "target", pvptalent = 10},-- High Winds - { spell = 209731, type="buff", unit = "player", pvptalent = 6},-- Protector of the Grove - { spell = 209746, type="buff", unit = "player", pvptalent = 5},-- Moonkin Aura - { spell = 209749, type="ability", pvptalent = 3, titleSuffix = L["cooldown"]},-- Faerie Swarm - { spell = 209749, type="debuff", unit = "target", pvptalent = 3, titleSuffix = L["debuff"]},-- Faerie Swarm - { spell = 305497, type="ability", pvptalent = 7, titleSuffix = L["cooldown"]},-- Thorns - { spell = 305497, type="buff", unit = "target", pvptalent = 7, titleSuffix = L["buff"]},-- Thorns + { spell = 200947, type = "debuff", unit = "target", pvptalent = 10 }, -- High Winds + { spell = 209731, type = "buff", unit = "player", pvptalent = 6 }, -- Protector of the Grove + { spell = 209746, type = "buff", unit = "player", pvptalent = 5 }, -- Moonkin Aura + { spell = 209749, type = "ability", pvptalent = 3, titleSuffix = L["cooldown"] }, -- Faerie Swarm + { spell = 209749, type = "debuff", unit = "target", pvptalent = 3, titleSuffix = L["debuff"] }, -- Faerie Swarm + { spell = 305497, type = "ability", pvptalent = 7, titleSuffix = L["cooldown"] }, -- Thorns + { spell = 305497, type = "buff", unit = "target", pvptalent = 7, titleSuffix = L["buff"] }, -- Thorns }, icon = "Interface\\Icons\\Achievement_BG_winWSG", }, [11] = { title = L["Resources and Shapeshift Form"], - args = { - }, + args = {}, icon = "Interface\\Icons\\ability_druid_eclipseorange", }, }, @@ -3433,25 +3396,25 @@ templates.class.DRUID = { [1] = { title = L["Buffs"], args = { - { spell = 768, type = "buff", unit = "player"}, -- Cat Form + { spell = 768, type = "buff", unit = "player" }, -- Cat Form { spell = 774, type = "buff", unit = "player", talent = 9 }, -- Rejuvenation - { spell = 783, type = "buff", unit = "player"}, -- Travel Form - { spell = 1850, type = "buff", unit = "player"}, -- Dash - { spell = 5215, type = "buff", unit = "player"}, -- Prowl - { spell = 5217, type = "buff", unit = "player"}, -- Tiger's Fury - { spell = 5487, type = "buff", unit = "player"}, -- Bear Form - { spell = 8936, type = "buff", unit = "player"}, -- Regrowth + { spell = 783, type = "buff", unit = "player" }, -- Travel Form + { spell = 1850, type = "buff", unit = "player" }, -- Dash + { spell = 5215, type = "buff", unit = "player" }, -- Prowl + { spell = 5217, type = "buff", unit = "player" }, -- Tiger's Fury + { spell = 5487, type = "buff", unit = "player" }, -- Bear Form + { spell = 8936, type = "buff", unit = "player" }, -- Regrowth { spell = 22812, type = "buff", unit = "player" }, -- Barkskin { spell = 22842, type = "buff", unit = "player", talent = 8 }, -- Frenzied Regeneration { spell = 48438, type = "buff", unit = "player", talent = 9 }, -- Wild Growth { spell = 52610, type = "buff", unit = "player", talent = 14 }, -- Savage Roar - { spell = 61336, type = "buff", unit = "player"}, -- Survival Instincts - { spell = 69369, type = "buff", unit = "player"}, -- Predatory Swiftness + { spell = 61336, type = "buff", unit = "player" }, -- Survival Instincts + { spell = 69369, type = "buff", unit = "player" }, -- Predatory Swiftness { spell = 102543, type = "buff", unit = "player", talent = 15 }, -- Incarnation: King of the Jungle - { spell = 106898, type = "buff", unit = "player"}, -- Stampeding Roar - { spell = 106951, type = "buff", unit = "player"}, -- Berserk - { spell = 108294, type = "buff", unit = "player"}, -- Hearth of the Wild - { spell = 135700, type = "buff", unit = "player"}, -- Clearcastingp + { spell = 106898, type = "buff", unit = "player" }, -- Stampeding Roar + { spell = 106951, type = "buff", unit = "player" }, -- Berserk + { spell = 108294, type = "buff", unit = "player" }, -- Hearth of the Wild + { spell = 135700, type = "buff", unit = "player" }, -- Clearcastingp { spell = 145152, type = "buff", unit = "player", talent = 20 }, -- Bloodtalons { spell = 192081, type = "buff", unit = "player" }, -- Ironfur { spell = 197625, type = "buff", unit = "player", talent = 7 }, -- Moonkin Form @@ -3459,74 +3422,74 @@ templates.class.DRUID = { { spell = 252216, type = "buff", unit = "player", talent = 4 }, -- Tiger Dash { spell = 285646, type = "buff", unit = "player", talent = 16 }, -- Scent of Blood }, - icon = 136170 + icon = 136170, }, [2] = { title = L["Debuffs"], args = { - { spell = 339, type = "debuff", unit = "multi"}, -- Entangling Roots - { spell = 1079, type = "debuff", unit = "target"}, -- Rip - { spell = 2637, type = "debuff", unit = "multi"}, -- Hibernate + { spell = 339, type = "debuff", unit = "multi" }, -- Entangling Roots + { spell = 1079, type = "debuff", unit = "target" }, -- Rip + { spell = 2637, type = "debuff", unit = "multi" }, -- Hibernate { spell = 5211, type = "debuff", unit = "target", talent = 10 }, -- Mighty Bash - { spell = 6795, type = "debuff", unit = "target"}, -- Growl - { spell = 33786, type = "debuff", unit = "target"}, -- Cyclone - { spell = 58180, type = "debuff", unit = "target"}, -- Infected Wounds + { spell = 6795, type = "debuff", unit = "target" }, -- Growl + { spell = 33786, type = "debuff", unit = "target" }, -- Cyclone + { spell = 58180, type = "debuff", unit = "target" }, -- Infected Wounds { spell = 61391, type = "debuff", unit = "target", talent = 7 }, -- Typhoon { spell = 102359, type = "debuff", unit = "target", talent = 11 }, -- Mass Entanglement - { spell = 106830, type = "debuff", unit = "target"}, -- Thrash - { spell = 155625, type = "debuff", unit = "target"}, -- Moonfire - { spell = 155722, type = "debuff", unit = "target"}, -- Rake + { spell = 106830, type = "debuff", unit = "target" }, -- Thrash + { spell = 155625, type = "debuff", unit = "target" }, -- Moonfire + { spell = 155722, type = "debuff", unit = "target" }, -- Rake { spell = 164815, type = "debuff", unit = "target", talent = 7 }, -- Sunfire - { spell = 164812, type = "debuff", unit = "target"}, -- Moonfire - { spell = 203123, type = "debuff", unit = "target"}, -- Maim + { spell = 164812, type = "debuff", unit = "target" }, -- Moonfire + { spell = 203123, type = "debuff", unit = "target" }, -- Maim { spell = 274838, type = "debuff", unit = "target", talent = 21 }, -- Feral Frenzy }, - icon = 132152 + icon = 132152, }, [3] = { title = L["Abilities"], args = { - { spell = 99, type = "ability", talent = 8}, -- Incapacitating Roar - { spell = 339, type = "ability", requiresTarget = true, overlayGlow = true}, -- Entangling Roots - { spell = 768, type = "ability"}, -- Cat Form - { spell = 774, type = "ability", buff = true, talent = 9}, -- Rejuvenation - { spell = 783, type = "ability"}, -- Travel Form - { spell = 1079, type = "ability", debuff = true, requiresTarget = true}, -- Rip - { spell = 1822, type = "ability", debuff = true, requiresTarget = true}, -- Rake - { spell = 1850, type = "ability", buff = true}, -- Dash - { spell = 2637, type = "ability"}, -- Hibernate - { spell = 2782, type = "ability"}, -- Remove Corruption - { spell = 2908, type = "ability", requiresTarget = true}, -- Soothe + { spell = 99, type = "ability", talent = 8 }, -- Incapacitating Roar + { spell = 339, type = "ability", requiresTarget = true, overlayGlow = true }, -- Entangling Roots + { spell = 768, type = "ability" }, -- Cat Form + { spell = 774, type = "ability", buff = true, talent = 9 }, -- Rejuvenation + { spell = 783, type = "ability" }, -- Travel Form + { spell = 1079, type = "ability", debuff = true, requiresTarget = true }, -- Rip + { spell = 1822, type = "ability", debuff = true, requiresTarget = true }, -- Rake + { spell = 1850, type = "ability", buff = true }, -- Dash + { spell = 2637, type = "ability" }, -- Hibernate + { spell = 2782, type = "ability" }, -- Remove Corruption + { spell = 2908, type = "ability", requiresTarget = true }, -- Soothe { spell = 5176, type = "ability", requiresTarget = true }, -- Wrath { spell = 5211, type = "ability", requiresTarget = true, talent = 10 }, -- Mighty Bash - { spell = 5215, type = "ability", buff = true}, -- Prowl - { spell = 5217, type = "ability", buff = true}, -- Tiger's Fury - { spell = 5221, type = "ability", requiresTarget = true, overlayGlow = true}, -- Shred - { spell = 5487, type = "ability"}, -- Bear Form - { spell = 6795, type = "ability", debuff = true, requiresTarget = true}, -- Growl - { spell = 8921, type = "ability", debuff = true, requiresTarget = true}, -- Moonfire - { spell = 8936, type = "ability", overlayGlow = true}, -- Regrowth + { spell = 5215, type = "ability", buff = true }, -- Prowl + { spell = 5217, type = "ability", buff = true }, -- Tiger's Fury + { spell = 5221, type = "ability", requiresTarget = true, overlayGlow = true }, -- Shred + { spell = 5487, type = "ability" }, -- Bear Form + { spell = 6795, type = "ability", debuff = true, requiresTarget = true }, -- Growl + { spell = 8921, type = "ability", debuff = true, requiresTarget = true }, -- Moonfire + { spell = 8936, type = "ability", overlayGlow = true }, -- Regrowth { spell = 16979, type = "ability", requiresTarget = true, talent = 6 }, -- Wild Charge { spell = 18562, type = "ability", talent = 9, usable = true }, -- Swiftmend - { spell = 20484, type = "ability"}, -- Rebirth - { spell = 22568, type = "ability", requiresTarget = true}, -- Ferocious Bite - { spell = 22570, type = "ability", requiresTarget = true, debuff = true}, -- Maim + { spell = 20484, type = "ability" }, -- Rebirth + { spell = 22568, type = "ability", requiresTarget = true }, -- Ferocious Bite + { spell = 22570, type = "ability", requiresTarget = true, debuff = true }, -- Maim { spell = 22812, type = "ability", buff = true }, -- Barkskin { spell = 22842, type = "ability", buff = true, talent = 8 }, -- Frenzied Regeneration - { spell = 33786, type = "ability", requiresTarget = true, debuff = true}, -- Cyclone - { spell = 33917, type = "ability", requiresTarget = true}, -- Mangle + { spell = 33786, type = "ability", requiresTarget = true, debuff = true }, -- Cyclone + { spell = 33917, type = "ability", requiresTarget = true }, -- Mangle { spell = 48438, type = "ability", talent = 9 }, -- Wild Growth { spell = 49376, type = "ability", requiresTarget = true, talent = 6 }, -- Wild Charge - { spell = 52610, type = "ability", buff = true, talent = 14}, -- Savage Roar - { spell = 61336, type = "ability", charges = true, buff = true}, -- Survival Instincts + { spell = 52610, type = "ability", buff = true, talent = 14 }, -- Savage Roar + { spell = 61336, type = "ability", charges = true, buff = true }, -- Survival Instincts { spell = 102359, type = "ability", requiresTarget = true, talent = 11 }, -- Mass Entanglement { spell = 102401, type = "ability", talent = 6 }, -- Wild Charge { spell = 102543, type = "ability", buff = true, talent = 15 }, -- Incarnation: King of the Jungle { spell = 102793, type = "ability", talent = 9 }, -- Ursol's Vortex - { spell = 106832, type = "ability", overlayGlow = true}, -- Thrash - { spell = 106839, type = "ability", requiresTarget = true}, -- Skull Bash - { spell = 106898, type = "ability", buff = true}, -- Stampeding Roar - { spell = 106951, type = "ability"}, -- Berserk + { spell = 106832, type = "ability", overlayGlow = true }, -- Thrash + { spell = 106839, type = "ability", requiresTarget = true }, -- Skull Bash + { spell = 106898, type = "ability", buff = true }, -- Stampeding Roar + { spell = 106951, type = "ability" }, -- Berserk { spell = 108238, type = "ability", talent = 5 }, -- Renewal { spell = 132469, type = "ability", talent = 7 }, -- Typhoon { spell = 192081, type = "ability", buff = true }, -- Ironfur @@ -3535,13 +3498,13 @@ templates.class.DRUID = { { spell = 197628, type = "ability", requiresTarget = true, talent = 7 }, -- Starfire { spell = 197630, type = "ability", debuff = true, requiresTarget = true, talent = 7 }, -- Sunfire { spell = 202028, type = "ability", charges = true, overlayGlow = true, talent = 17 }, -- Brutal Slash - { spell = 213764, type = "ability", overlayGlow = true}, -- Swipe + { spell = 213764, type = "ability", overlayGlow = true }, -- Swipe { spell = 252216, type = "ability", buff = true, talent = 4 }, -- Tiger Dash { spell = 274837, type = "ability", requiresTarget = true, talent = 21 }, -- Feral Frenzy { spell = 285381, type = "ability", talent = 18 }, -- Primal Wrath { spell = 319454, type = "ability", talent = 12 }, -- Heart of the Wild }, - icon = 236149 + icon = 236149, }, [4] = {}, [5] = {}, @@ -3552,22 +3515,21 @@ templates.class.DRUID = { [10] = { title = L["PvP Talents"], args = { - { spell = 202636, type="buff", unit = "player", pvptalent = 10},-- Leader of the Pack - { spell = 203059, type="buff", unit = "player", pvptalent = 4},-- King of the Jungle - { spell = 203242, type="ability", pvptalent = 6},-- Rip and Tear - { spell = 200947, type="debuff", unit = "target", pvptalent = 9},-- High Winds - { spell = 236021, type="debuff", unit = "target", pvptalent = 8},-- Ferocious Wound - { spell = 209731, type="buff", unit = "player", pvptalent = 7}, -- Strenght of the Wild - { spell = 236716, type="ability", pvptalent = 7},-- Strenght of the Wild - { spell = 305497, type="ability", pvptalent = 1, titleSuffix = L["cooldown"]},-- Thorns - { spell = 305497, type="buff", unit = "group", pvptalent = 1, titleSuffix = L["buff"]},-- Thorns + { spell = 202636, type = "buff", unit = "player", pvptalent = 10 }, -- Leader of the Pack + { spell = 203059, type = "buff", unit = "player", pvptalent = 4 }, -- King of the Jungle + { spell = 203242, type = "ability", pvptalent = 6 }, -- Rip and Tear + { spell = 200947, type = "debuff", unit = "target", pvptalent = 9 }, -- High Winds + { spell = 236021, type = "debuff", unit = "target", pvptalent = 8 }, -- Ferocious Wound + { spell = 209731, type = "buff", unit = "player", pvptalent = 7 }, -- Strenght of the Wild + { spell = 236716, type = "ability", pvptalent = 7 }, -- Strenght of the Wild + { spell = 305497, type = "ability", pvptalent = 1, titleSuffix = L["cooldown"] }, -- Thorns + { spell = 305497, type = "buff", unit = "group", pvptalent = 1, titleSuffix = L["buff"] }, -- Thorns }, icon = "Interface\\Icons\\Achievement_BG_winWSG", }, [11] = { title = L["Resources and Shapeshift Form"], - args = { - }, + args = {}, icon = comboPointsIcon, }, }, @@ -3576,103 +3538,103 @@ templates.class.DRUID = { title = L["Buffs"], args = { { spell = 774, type = "buff", unit = "player", talent = 9 }, -- Rejuvenation - { spell = 768, type = "buff", unit = "player"}, -- Cat Form - { spell = 783, type = "buff", unit = "player"}, -- Travel Form - { spell = 1850, type = "buff", unit = "player"}, -- Dash - { spell = 5215, type = "buff", unit = "player"}, -- Prowl - { spell = 5487, type = "buff", unit = "player"}, -- Bear Form - { spell = 8936, type = "buff", unit = "player"}, -- Regrowth - { spell = 22812, type = "buff", unit = "player"}, -- Barkskin - { spell = 22842, type = "buff", unit = "player"}, -- Frenzied Regeneration + { spell = 768, type = "buff", unit = "player" }, -- Cat Form + { spell = 783, type = "buff", unit = "player" }, -- Travel Form + { spell = 1850, type = "buff", unit = "player" }, -- Dash + { spell = 5215, type = "buff", unit = "player" }, -- Prowl + { spell = 5487, type = "buff", unit = "player" }, -- Bear Form + { spell = 8936, type = "buff", unit = "player" }, -- Regrowth + { spell = 22812, type = "buff", unit = "player" }, -- Barkskin + { spell = 22842, type = "buff", unit = "player" }, -- Frenzied Regeneration { spell = 48438, type = "buff", unit = "player", talent = 9 }, -- Wild Growth { spell = 50334, type = "buff", unit = "player" }, -- Berserk - { spell = 61336, type = "buff", unit = "player"}, -- Survival Instincts - { spell = 93622, type = "buff", unit = "player"}, -- Gore + { spell = 61336, type = "buff", unit = "player" }, -- Survival Instincts + { spell = 93622, type = "buff", unit = "player" }, -- Gore { spell = 102558, type = "buff", unit = "player", talent = 15 }, -- Incarnation: Guardian of Ursoc - { spell = 106898, type = "buff", unit = "player"}, -- Stampeding Roarew + { spell = 106898, type = "buff", unit = "player" }, -- Stampeding Roarew { spell = 135286, type = "buff", unit = "player", talent = 20 }, -- Tooth and Claw { spell = 155835, type = "buff", unit = "player", talent = 3 }, -- Bristling Fur - { spell = 192081, type = "buff", unit = "player"}, -- Ironfur + { spell = 192081, type = "buff", unit = "player" }, -- Ironfur { spell = 197625, type = "buff", unit = "player", talent = 7 }, -- Moonkin Form { spell = 203975, type = "buff", unit = "player", talent = 16 }, -- Earthwarden { spell = 213680, type = "buff", unit = "player", talent = 18 }, -- Guardian of Elune { spell = 213708, type = "buff", unit = "player", talent = 14 }, -- Galactic Guardian { spell = 252216, type = "buff", unit = "player", talent = 4 }, -- Tiger Dash }, - icon = 1378702 + icon = 1378702, }, [2] = { title = L["Debuffs"], args = { - { spell = 99, type = "debuff", unit = "target"}, -- Incapacitating Roar - { spell = 339, type = "debuff", unit = "multi"}, -- Entangling Roots + { spell = 99, type = "debuff", unit = "target" }, -- Incapacitating Roar + { spell = 339, type = "debuff", unit = "multi" }, -- Entangling Roots { spell = 1079, type = "debuff", unit = "target", talent = 8 }, -- Rip - { spell = 2637, type = "debuff", unit = "multi"}, -- Hibernate + { spell = 2637, type = "debuff", unit = "multi" }, -- Hibernate { spell = 5211, type = "debuff", unit = "target", talent = 10 }, -- Mighty Bash - { spell = 6795, type = "debuff", unit = "target"}, -- Growl - { spell = 33786, type = "debuff", unit = "target"}, -- Cyclone + { spell = 6795, type = "debuff", unit = "target" }, -- Growl + { spell = 33786, type = "debuff", unit = "target" }, -- Cyclone { spell = 45334, type = "debuff", unit = "target", talent = 6 }, -- Immobilized { spell = 61391, type = "debuff", unit = "target", talent = 12 }, -- Typhoon { spell = 80313, type = "debuff", unit = "target", talent = 21 }, -- Pulverize { spell = 102359, type = "debuff", unit = "target", talent = 11 }, -- Mass Entanglement { spell = 155722, type = "debuff", unit = "target", talent = 8 }, -- Rake - { spell = 164812, type = "debuff", unit = "target"}, -- Moonfire + { spell = 164812, type = "debuff", unit = "target" }, -- Moonfire { spell = 164815, type = "debuff", unit = "target", talent = 7 }, -- Sunfire - { spell = 192090, type = "debuff", unit = "target"}, -- Thrash + { spell = 192090, type = "debuff", unit = "target" }, -- Thrash { spell = 236748, type = "debuff", unit = "target", talent = 5 }, -- Intimidating Roar { spell = 345208, type = "debuff", unit = "target" }, -- Infected Wounds }, - icon = 451161 + icon = 451161, }, [3] = { title = L["Abilities"], args = { - { spell = 99, type = "ability"}, -- Incapacitating Roar - { spell = 339, type = "ability"}, -- Entangling Roots - { spell = 768, type = "ability"}, -- Cat Form - { spell = 774, type = "ability", buff = true, talent = 9}, -- Rejuvenation - { spell = 783, type = "ability"}, -- Travel Form - { spell = 1079, type = "ability", debuff = true, talent = 8}, -- Rip - { spell = 1850, type = "ability", buff = true}, -- Dash - { spell = 2782, type = "ability"}, -- Remove Corruption - { spell = 2908, type = "ability", requiresTarget = true}, -- Soothe + { spell = 99, type = "ability" }, -- Incapacitating Roar + { spell = 339, type = "ability" }, -- Entangling Roots + { spell = 768, type = "ability" }, -- Cat Form + { spell = 774, type = "ability", buff = true, talent = 9 }, -- Rejuvenation + { spell = 783, type = "ability" }, -- Travel Form + { spell = 1079, type = "ability", debuff = true, talent = 8 }, -- Rip + { spell = 1850, type = "ability", buff = true }, -- Dash + { spell = 2782, type = "ability" }, -- Remove Corruption + { spell = 2908, type = "ability", requiresTarget = true }, -- Soothe { spell = 5211, type = "ability", requiresTarget = true, talent = 10 }, -- Mighty Bash - { spell = 5215, type = "ability", buff = true}, -- Prowl - { spell = 5221, type = "ability"}, -- Shred - { spell = 5487, type = "ability"}, -- Bear Form - { spell = 6795, type = "ability", debuff = true, requiresTarget = true}, -- Growl - { spell = 6807, type = "ability", requiresTarget = true}, -- Maul - { spell = 8921, type = "ability", debuff = true, requiresTarget = true, overlayGlow = true}, -- Moonfire - { spell = 8936, type = "ability"}, -- Regrowth + { spell = 5215, type = "ability", buff = true }, -- Prowl + { spell = 5221, type = "ability" }, -- Shred + { spell = 5487, type = "ability" }, -- Bear Form + { spell = 6795, type = "ability", debuff = true, requiresTarget = true }, -- Growl + { spell = 6807, type = "ability", requiresTarget = true }, -- Maul + { spell = 8921, type = "ability", debuff = true, requiresTarget = true, overlayGlow = true }, -- Moonfire + { spell = 8936, type = "ability" }, -- Regrowth { spell = 16979, type = "ability", requiresTarget = true, talent = 6 }, -- Wild Charge { spell = 18562, type = "ability", talent = 9, usable = true }, -- Swiftmend - { spell = 20484, type = "ability"}, -- Rebirth - { spell = 22812, type = "ability", buff = true}, -- Barkskin - { spell = 22842, type = "ability", charges = true, buff = true}, -- Frenzied Regeneration - { spell = 22568, type = "ability"}, -- Ferocious Bite - { spell = 22570, type = "ability", talent = 8}, -- Maim - { spell = 33786, type = "ability", requiresTarget = true, debuff = true}, -- Cyclone - { spell = 33917, type = "ability", requiresTarget = true, overlayGlow = true}, -- Mangle + { spell = 20484, type = "ability" }, -- Rebirth + { spell = 22812, type = "ability", buff = true }, -- Barkskin + { spell = 22842, type = "ability", charges = true, buff = true }, -- Frenzied Regeneration + { spell = 22568, type = "ability" }, -- Ferocious Bite + { spell = 22570, type = "ability", talent = 8 }, -- Maim + { spell = 33786, type = "ability", requiresTarget = true, debuff = true }, -- Cyclone + { spell = 33917, type = "ability", requiresTarget = true, overlayGlow = true }, -- Mangle { spell = 48438, type = "ability", talent = 9 }, -- Wild Growth { spell = 49376, type = "ability", requiresTarget = true, talent = 6 }, -- Wild Charge - { spell = 50334, type = "ability", buff = true}, -- Berserk - { spell = 61336, type = "ability", charges = true, buff = true}, -- Survival Instincts - { spell = 77758, type = "ability"}, -- Thrash - { spell = 77761, type = "ability", buff = true}, -- Stampeding Roar - { spell = 80313, type = "ability", buff = true, requiresTarget = true, usable = true, talent = 21}, -- Pulverize + { spell = 50334, type = "ability", buff = true }, -- Berserk + { spell = 61336, type = "ability", charges = true, buff = true }, -- Survival Instincts + { spell = 77758, type = "ability" }, -- Thrash + { spell = 77761, type = "ability", buff = true }, -- Stampeding Roar + { spell = 80313, type = "ability", buff = true, requiresTarget = true, usable = true, talent = 21 }, -- Pulverize { spell = 102359, type = "ability", requiresTarget = true, talent = 11 }, -- Mass Entanglement { spell = 102383, type = "ability", talent = 6 }, -- Wild Charge { spell = 102401, type = "ability", talent = 6 }, -- Wild Charge { spell = 102558, type = "ability", buff = true, talent = 15 }, -- Incarnation: Guardian of Ursoc - { spell = 102359, type = "ability", requiresTarget = true, talent = 11}, -- Mass Entanglement + { spell = 102359, type = "ability", requiresTarget = true, talent = 11 }, -- Mass Entanglement { spell = 102793, type = "ability", talent = 9 }, -- Ursol's Vortex - { spell = 106832, type = "ability", requiresTarget = true}, -- Thrash - { spell = 106839, type = "ability", requiresTarget = true}, -- Skull Bash - { spell = 106898, type = "ability"}, -- Stampeding Roar - { spell = 108238, type = "ability"}, -- Renewal + { spell = 106832, type = "ability", requiresTarget = true }, -- Thrash + { spell = 106839, type = "ability", requiresTarget = true }, -- Skull Bash + { spell = 106898, type = "ability" }, -- Stampeding Roar + { spell = 108238, type = "ability" }, -- Renewal { spell = 132469, type = "ability", talent = 7 }, -- Typhoon { spell = 155835, type = "ability", buff = true, talent = 3 }, -- Bristling Fur - { spell = 192081, type = "ability", buff = true}, -- Ironfur + { spell = 192081, type = "ability", buff = true }, -- Ironfur { spell = 197626, type = "ability", requiresTarget = true, talent = 7 }, -- Starsurge { spell = 197628, type = "ability", requiresTarget = true, talent = 7 }, -- Starfire { spell = 197630, type = "ability", requiresTarget = true, talent = 7 }, -- Sunfire @@ -3682,7 +3644,7 @@ templates.class.DRUID = { { spell = 252216, type = "ability", buff = true, talent = 4 }, -- Tiger Dash { spell = 319454, type = "ability", buff = true, talent = 12 }, -- Heart of the Wild }, - icon = 236169 + icon = 236169, }, [4] = {}, [5] = {}, @@ -3693,25 +3655,24 @@ templates.class.DRUID = { [10] = { title = L["PvP Talents"], args = { - { spell = 201664, type="ability", pvptalent = 11, titleSuffix = L["cooldown"]},-- Demoralizing Roar - { spell = 201664, type="debuff", unit = "target", pvptalent = 11, titleSuffix = L["debuff"]},-- Demoralizing Roar - { spell = 202244, type="debuff", unit = "target", pvptalent = 2, titleSuffix = L["debuff"]},-- Overrun - { spell = 202246, type="ability", pvptalent = 2, titleSuffix = L["cooldown"]},-- Overrun - { spell = 206891, type="debuff", unit = "target", pvptalent = 14, titleSuffix = L["debuff"]},-- Alpha Challenge - { spell = 207017, type="ability", pvptalent = 14, titleSuffix = L["cooldown"]},-- Alpha Challenge - { spell = 200947, type="debuff", unit = "target", pvptalent = 6},-- High Winds - { spell = 236187, type="buff", unit = "player", pvptalent = 8, titleSuffix = L["buff"]},-- Master Shapeshifter - { spell = 236185, type="buff", unit = "player", pvptalent = 8, titleSuffix = L["buff"]},-- Master Shapeshifter - { spell = 279943, type="buff", unit = "player", pvptalent = 1},-- Sharpened Claws - { spell = 329042, type="buff", unit = "player", pvptalent = 3, titleSuffix = L["buff"]},-- Roar of the Protector - { spell = 329042, type="ability", pvptalent = 3, titleSuffix = L["cooldown"]},-- Roar of the Protector + { spell = 201664, type = "ability", pvptalent = 11, titleSuffix = L["cooldown"] }, -- Demoralizing Roar + { spell = 201664, type = "debuff", unit = "target", pvptalent = 11, titleSuffix = L["debuff"] }, -- Demoralizing Roar + { spell = 202244, type = "debuff", unit = "target", pvptalent = 2, titleSuffix = L["debuff"] }, -- Overrun + { spell = 202246, type = "ability", pvptalent = 2, titleSuffix = L["cooldown"] }, -- Overrun + { spell = 206891, type = "debuff", unit = "target", pvptalent = 14, titleSuffix = L["debuff"] }, -- Alpha Challenge + { spell = 207017, type = "ability", pvptalent = 14, titleSuffix = L["cooldown"] }, -- Alpha Challenge + { spell = 200947, type = "debuff", unit = "target", pvptalent = 6 }, -- High Winds + { spell = 236187, type = "buff", unit = "player", pvptalent = 8, titleSuffix = L["buff"] }, -- Master Shapeshifter + { spell = 236185, type = "buff", unit = "player", pvptalent = 8, titleSuffix = L["buff"] }, -- Master Shapeshifter + { spell = 279943, type = "buff", unit = "player", pvptalent = 1 }, -- Sharpened Claws + { spell = 329042, type = "buff", unit = "player", pvptalent = 3, titleSuffix = L["buff"] }, -- Roar of the Protector + { spell = 329042, type = "ability", pvptalent = 3, titleSuffix = L["cooldown"] }, -- Roar of the Protector }, icon = "Interface\\Icons\\Achievement_BG_winWSG", }, [11] = { title = L["Resources and Shapeshift Form"], - args = { - }, + args = {}, icon = rageIcon, }, }, @@ -3719,28 +3680,28 @@ templates.class.DRUID = { [1] = { title = L["Buffs"], args = { - { spell = 768, type = "buff", unit = "player"}, -- Cat Form - { spell = 774, type = "buff", unit = "target"}, -- Rejuvenation - { spell = 783, type = "buff", unit = "player"}, -- Travel Form - { spell = 1850, type = "buff", unit = "player"}, -- Dash - { spell = 5215, type = "buff", unit = "player"}, -- Prowl - { spell = 5487, type = "buff", unit = "player"}, -- Bear Form - { spell = 8936, type = "buff", unit = "target"}, -- Regrowth - { spell = 16870, type = "buff", unit = "player"}, -- Clearcasting - { spell = 22812, type = "buff", unit = "target"}, -- Barkskin + { spell = 768, type = "buff", unit = "player" }, -- Cat Form + { spell = 774, type = "buff", unit = "target" }, -- Rejuvenation + { spell = 783, type = "buff", unit = "player" }, -- Travel Form + { spell = 1850, type = "buff", unit = "player" }, -- Dash + { spell = 5215, type = "buff", unit = "player" }, -- Prowl + { spell = 5487, type = "buff", unit = "player" }, -- Bear Form + { spell = 8936, type = "buff", unit = "target" }, -- Regrowth + { spell = 16870, type = "buff", unit = "player" }, -- Clearcasting + { spell = 22812, type = "buff", unit = "target" }, -- Barkskin { spell = 22842, type = "buff", unit = "player", talent = 9 }, -- Frenzied Regeneration { spell = 33891, type = "buff", unit = "player", talent = 15 }, -- Incarnation: Tree of Life - { spell = 29166, type = "buff", unit = "player"}, -- Innervate - { spell = 33763, type = "buff", unit = "target"}, -- Lifebloom - { spell = 48438, type = "buff", unit = "player"}, -- Wild Growth + { spell = 29166, type = "buff", unit = "player" }, -- Innervate + { spell = 33763, type = "buff", unit = "target" }, -- Lifebloom + { spell = 48438, type = "buff", unit = "player" }, -- Wild Growth { spell = 102351, type = "buff", unit = "player", talent = 3 }, -- Cenarion Ward - { spell = 102342, type = "buff", unit = "player"}, -- Ironbark + { spell = 102342, type = "buff", unit = "player" }, -- Ironbark { spell = 102401, type = "buff", unit = "player", talent = 6 }, -- Wild Charge { spell = 106898, type = "buff", unit = "player" }, -- Stampeding Roar { spell = 114108, type = "buff", unit = "player", talent = 13 }, -- Soul of the Forest { spell = 117679, type = "buff", unit = "player", talent = 15 }, -- Incarnation { spell = 155777, type = "buff", unit = "target", talent = 20 }, -- Rejuvenation (Germination) - { spell = 157982, type = "buff", unit = "player"}, -- Tranquility + { spell = 157982, type = "buff", unit = "player" }, -- Tranquility { spell = 192081, type = "buff", unit = "player" }, -- Ironfur { spell = 197625, type = "buff", unit = "player", talent = 7 }, -- Moonkin Form { spell = 197721, type = "buff", unit = "target", talent = 21 }, -- Flourish @@ -3748,72 +3709,71 @@ templates.class.DRUID = { { spell = 207640, type = "buff", unit = "player", talent = 1 }, -- Abundance { spell = 207386, type = "buff", unit = "target", talent = 17 }, -- Spring Blossoms { spell = 252216, type = "buff", unit = "player", talent = 4 }, -- Tiger Dash - }, - icon = 136081 + icon = 136081, }, [2] = { title = L["Debuffs"], args = { - { spell = 339, type = "debuff", unit = "multi"}, -- Entangling Roots + { spell = 339, type = "debuff", unit = "multi" }, -- Entangling Roots { spell = 1079, type = "debuff", unit = "target", talent = 8 }, -- Rip { spell = 1822, type = "debuff", unit = "target", talent = 8 }, -- Rake - { spell = 2637, type = "debuff", unit = "multi"}, -- Hibernate + { spell = 2637, type = "debuff", unit = "multi" }, -- Hibernate { spell = 5211, type = "debuff", unit = "target", talent = 10 }, -- Mighty Bash - { spell = 6795, type = "debuff", unit = "target"}, -- Growl + { spell = 6795, type = "debuff", unit = "target" }, -- Growl { spell = 61391, type = "debuff", unit = "target", talent = 12 }, -- Typhoon - { spell = 33786, type = "debuff", unit = "target"}, -- Cyclone + { spell = 33786, type = "debuff", unit = "target" }, -- Cyclone { spell = 102359, type = "debuff", unit = "target", talent = 11 }, -- Mass Entanglement - { spell = 127797, type = "debuff", unit = "target"}, -- Ursol's Vortex + { spell = 127797, type = "debuff", unit = "target" }, -- Ursol's Vortex { spell = 155722, type = "debuff", unit = "target", talent = 8 }, -- Rake - { spell = 164812, type = "debuff", unit = "target"}, -- Moonfire - { spell = 164815, type = "debuff", unit = "target", talent = 7}, -- Sunfire + { spell = 164812, type = "debuff", unit = "target" }, -- Moonfire + { spell = 164815, type = "debuff", unit = "target", talent = 7 }, -- Sunfire { spell = 192090, type = "debuff", unit = "target", talent = 9 }, -- Thrash }, - icon = 236216 + icon = 236216, }, [3] = { title = L["Abilities"], args = { - { spell = 99, type = "ability", debuff = true, talent = 9}, -- Incapacitating Roar - { spell = 339, type = "ability", debuff = true}, -- Entangling Roots - { spell = 740, type = "ability"}, -- Tranquility - { spell = 768, type = "ability"}, -- Cat Form - { spell = 774, type = "ability"}, -- Rejuvenation - { spell = 783, type = "ability"}, -- Travel Form - { spell = 1079, type = "ability", debuff = true, talent = 8}, -- Rip - { spell = 1822, type = "ability", debuff = true, talent = 8}, -- Rake - { spell = 1850, type = "ability", buff = true}, -- Dash - { spell = 2637, type = "ability", requiresTarget = true}, -- Hibernate - { spell = 2908, type = "ability", requiresTarget = true}, -- Soothe - { spell = 5176, type = "ability"}, -- Wrath + { spell = 99, type = "ability", debuff = true, talent = 9 }, -- Incapacitating Roar + { spell = 339, type = "ability", debuff = true }, -- Entangling Roots + { spell = 740, type = "ability" }, -- Tranquility + { spell = 768, type = "ability" }, -- Cat Form + { spell = 774, type = "ability" }, -- Rejuvenation + { spell = 783, type = "ability" }, -- Travel Form + { spell = 1079, type = "ability", debuff = true, talent = 8 }, -- Rip + { spell = 1822, type = "ability", debuff = true, talent = 8 }, -- Rake + { spell = 1850, type = "ability", buff = true }, -- Dash + { spell = 2637, type = "ability", requiresTarget = true }, -- Hibernate + { spell = 2908, type = "ability", requiresTarget = true }, -- Soothe + { spell = 5176, type = "ability" }, -- Wrath { spell = 5211, type = "ability", requiresTarget = true, talent = 10 }, -- Mighty Bash - { spell = 5215, type = "ability", buff = true}, -- Prowl - { spell = 5221, type = "ability"}, -- Shred - { spell = 5487, type = "ability"}, -- Bear Form - { spell = 6795, type = "ability", debuff = true, requiresTarget = true}, -- Growl - { spell = 8921, type = "ability", requiresTarget = true, debuff = true}, -- Moonfire - { spell = 8936, type = "ability"}, -- Regrowth - { spell = 18562, type = "ability", usable = true}, -- Swiftmend - { spell = 20484, type = "ability"}, -- Rebirth - { spell = 22568, type = "ability", requiresTarget = true}, -- Ferocious Bite - { spell = 22570, type = "ability", requiresTarget = true, talent = 8}, -- Maim - { spell = 22812, type = "ability", buff = true}, -- Barkskin + { spell = 5215, type = "ability", buff = true }, -- Prowl + { spell = 5221, type = "ability" }, -- Shred + { spell = 5487, type = "ability" }, -- Bear Form + { spell = 6795, type = "ability", debuff = true, requiresTarget = true }, -- Growl + { spell = 8921, type = "ability", requiresTarget = true, debuff = true }, -- Moonfire + { spell = 8936, type = "ability" }, -- Regrowth + { spell = 18562, type = "ability", usable = true }, -- Swiftmend + { spell = 20484, type = "ability" }, -- Rebirth + { spell = 22568, type = "ability", requiresTarget = true }, -- Ferocious Bite + { spell = 22570, type = "ability", requiresTarget = true, talent = 8 }, -- Maim + { spell = 22812, type = "ability", buff = true }, -- Barkskin { spell = 22842, type = "ability", buff = true, talent = 9 }, -- Frenzied Regeneration - { spell = 29166, type = "ability", buff = true}, -- Innervate - { spell = 33786, type = "ability", requiresTarget = true, debuff = true}, -- Cyclone + { spell = 29166, type = "ability", buff = true }, -- Innervate + { spell = 33786, type = "ability", requiresTarget = true, debuff = true }, -- Cyclone { spell = 33891, type = "ability", buff = true, talent = 15 }, -- Incarnation: Tree of Life - { spell = 33917, type = "ability", requiresTarget = true}, -- Mangle - { spell = 48438, type = "ability"}, -- Wild Growth - { spell = 50464, type = "ability", talent = 2}, -- Nourish + { spell = 33917, type = "ability", requiresTarget = true }, -- Mangle + { spell = 48438, type = "ability" }, -- Wild Growth + { spell = 50464, type = "ability", talent = 2 }, -- Nourish { spell = 77758, type = "ability", talent = 9 }, -- Thrash - { spell = 88423, type = "ability"}, -- Nature's Cure + { spell = 88423, type = "ability" }, -- Nature's Cure { spell = 93402, type = "ability", requiresTarget = true, talent = 7 }, -- Sunfire - { spell = 102342, type = "ability"}, -- Ironbark + { spell = 102342, type = "ability" }, -- Ironbark { spell = 102351, type = "ability", talent = 3 }, -- Cenarion Ward { spell = 102359, type = "ability", requiresTarget = true, talent = 11 }, -- Mass Entanglement { spell = 102401, type = "ability", talent = 6 }, -- Wild Charge - { spell = 102793, type = "ability"}, -- Ursol's Vortex + { spell = 102793, type = "ability" }, -- Ursol's Vortex { spell = 106832, type = "ability", debuff = true, talent = 9 }, -- Thrash { spell = 106898, type = "ability" }, -- Stampeding Roar { spell = 108238, type = "ability", talent = 5 }, -- Renewal @@ -3826,11 +3786,11 @@ templates.class.DRUID = { { spell = 197628, type = "ability", requiresTarget = true, talent = 7 }, -- Starfire { spell = 197721, type = "ability", talent = 21 }, -- Flourish { spell = 203651, type = "ability", talent = 18 }, -- Overgrowth - { spell = 213764, type = "ability", talent = 8}, -- Swipe + { spell = 213764, type = "ability", talent = 8 }, -- Swipe { spell = 252216, type = "ability", buff = true, talent = 4 }, -- Tiger Dash - { spell = 319454, type = "ability", buff = true, talent = 12}, -- Heart of the Wild + { spell = 319454, type = "ability", buff = true, talent = 12 }, -- Heart of the Wild }, - icon = 236153 + icon = 236153, }, [4] = {}, [5] = {}, @@ -3841,22 +3801,21 @@ templates.class.DRUID = { [10] = { title = L["PvP Talents"], args = { - { spell = 200947, type="debuff", unit = "target", pvptalent = 10},-- High Winds - { spell = 203407, type="buff", unit = "target", pvptalent = 6},-- Revitalize - { spell = 203554, type="buff", unit = "target", pvptalent = 1},-- Focused Growth - { spell = 236187, type="buff", unit = "player", pvptalent = 2},-- Master Shapeshifter - { spell = 247563, type="buff", unit = "group", pvptalent = 5},-- Entangling Bark - { spell = 289318, type="buff", unit = "group", pvptalent = 3},-- Mark of the Wild - { spell = 290213, type="buff", unit = "target", pvptalent = 9},-- Early Spring - { spell = 305497, type="ability", pvptalent = 4, titleSuffix = L["cooldown"]},-- Thorns - { spell = 305497, type="buff", unit = "group", pvptalent = 4, titleSuffix = L["buff"]},-- Thorns + { spell = 200947, type = "debuff", unit = "target", pvptalent = 10 }, -- High Winds + { spell = 203407, type = "buff", unit = "target", pvptalent = 6 }, -- Revitalize + { spell = 203554, type = "buff", unit = "target", pvptalent = 1 }, -- Focused Growth + { spell = 236187, type = "buff", unit = "player", pvptalent = 2 }, -- Master Shapeshifter + { spell = 247563, type = "buff", unit = "group", pvptalent = 5 }, -- Entangling Bark + { spell = 289318, type = "buff", unit = "group", pvptalent = 3 }, -- Mark of the Wild + { spell = 290213, type = "buff", unit = "target", pvptalent = 9 }, -- Early Spring + { spell = 305497, type = "ability", pvptalent = 4, titleSuffix = L["cooldown"] }, -- Thorns + { spell = 305497, type = "buff", unit = "group", pvptalent = 4, titleSuffix = L["buff"] }, -- Thorns }, icon = "Interface\\Icons\\Achievement_BG_winWSG", }, [11] = { title = L["Resources and Shapeshift Form"], - args = { - }, + args = {}, icon = manaIcon, }, }, @@ -3867,72 +3826,72 @@ templates.class.DEMONHUNTER = { [1] = { title = L["Buffs"], args = { - { spell = 131347, type = "buff", unit = "player"}, -- Glide - { spell = 162264, type = "buff", unit = "player"}, -- Metamorphosis - { spell = 188499, type = "buff", unit = "player"}, -- Blade Dance - { spell = 188501, type = "buff", unit = "player"}, -- Spectral Sight + { spell = 131347, type = "buff", unit = "player" }, -- Glide + { spell = 162264, type = "buff", unit = "player" }, -- Metamorphosis + { spell = 188499, type = "buff", unit = "player" }, -- Blade Dance + { spell = 188501, type = "buff", unit = "player" }, -- Spectral Sight { spell = 196555, type = "buff", unit = "player", talent = 12 }, -- Netherwalk { spell = 203650, type = "buff", unit = "player", talent = 20 }, -- Prepared { spell = 208628, type = "buff", unit = "player", talent = 20 }, -- Momentum - { spell = 209426, type = "buff", unit = "player"}, -- Darkness - { spell = 212800, type = "buff", unit = "player"}, -- Blur - { spell = 258920, type = "buff", unit = "player"}, -- Immolation Aura + { spell = 209426, type = "buff", unit = "player" }, -- Darkness + { spell = 212800, type = "buff", unit = "player" }, -- Blur + { spell = 258920, type = "buff", unit = "player" }, -- Immolation Aura { spell = 337313, type = "buff", unit = "player" }, -- Inner Demon { spell = 343312, type = "buff", unit = "player" }, -- Eye Beam { spell = 347462, type = "buff", unit = "player", talent = 8 }, -- Unbound Chaos }, - icon = 1247266 + icon = 1247266, }, [2] = { title = L["Debuffs"], args = { - { spell = 1490, type = "debuff", unit = "target", forceOwnOnly = true, ownOnly = true}, -- Chaos Brand - { spell = 179057, type = "debuff", unit = "target"}, -- Chaos Nova - { spell = 185245, type = "debuff", unit = "target"}, -- Torment - { spell = 198813, type = "debuff", unit = "target"}, -- Vengeful Retreat - { spell = 200166, type = "debuff", unit = "target"}, -- Metamorphosis + { spell = 1490, type = "debuff", unit = "target", forceOwnOnly = true, ownOnly = true }, -- Chaos Brand + { spell = 179057, type = "debuff", unit = "target" }, -- Chaos Nova + { spell = 185245, type = "debuff", unit = "target" }, -- Torment + { spell = 198813, type = "debuff", unit = "target" }, -- Vengeful Retreat + { spell = 200166, type = "debuff", unit = "target" }, -- Metamorphosis { spell = 206491, type = "debuff", unit = "target", talent = 21 }, -- Nemesis { spell = 211881, type = "debuff", unit = "target", talent = 18 }, -- Fel Eruption { spell = 213405, type = "debuff", unit = "target", talent = 17 }, -- Master of the Glaive { spell = 217832, type = "debuff", unit = "multi" }, -- Imprison - { spell = 258883, type = "debuff", unit = "target", talent = 7}, -- Trail of Ruin + { spell = 258883, type = "debuff", unit = "target", talent = 7 }, -- Trail of Ruin { spell = 320338, type = "debuff", unit = "target", talent = 15 }, -- Essence Break }, - icon = 1392554 + icon = 1392554, }, [3] = { title = L["Abilities"], args = { - { spell = 131347, type = "ability"}, -- Glide - { spell = 183752, type = "ability", requiresTarget = true}, -- Disrupt - { spell = 185123, type = "ability", requiresTarget = true}, -- Throw Glaive - { spell = 185245, type = "ability", requiresTarget = true, debuff = true}, -- Torment - { spell = 188499, type = "ability"}, -- Blade Dance - { spell = 188501, type = "ability"}, -- Spectral Sight - { spell = 191427, type = "ability", buff = true}, -- Metamorphosis - { spell = 195072, type = "ability", charges = true}, -- Fel Rush + { spell = 131347, type = "ability" }, -- Glide + { spell = 183752, type = "ability", requiresTarget = true }, -- Disrupt + { spell = 185123, type = "ability", requiresTarget = true }, -- Throw Glaive + { spell = 185245, type = "ability", requiresTarget = true, debuff = true }, -- Torment + { spell = 188499, type = "ability" }, -- Blade Dance + { spell = 188501, type = "ability" }, -- Spectral Sight + { spell = 191427, type = "ability", buff = true }, -- Metamorphosis + { spell = 195072, type = "ability", charges = true }, -- Fel Rush { spell = 196555, type = "ability", buff = true, talent = 12 }, -- Netherwalk - { spell = 196718, type = "ability"}, -- Darkness - { spell = 198013, type = "ability"}, -- Eye Beam - { spell = 198589, type = "ability", buff = true}, -- Blur - { spell = 198793, type = "ability"}, -- Vengeful Retreat + { spell = 196718, type = "ability" }, -- Darkness + { spell = 198013, type = "ability" }, -- Eye Beam + { spell = 198589, type = "ability", buff = true }, -- Blur + { spell = 198793, type = "ability" }, -- Vengeful Retreat { spell = 206491, type = "ability", buff = true, talent = 21 }, -- Nemesis - { spell = 210152, type = "ability"}, -- Death Sweep + { spell = 210152, type = "ability" }, -- Death Sweep { spell = 211881, type = "ability", talent = 18 }, -- Fel Eruption - { spell = 217832, type = "ability", requiresTarget = true}, -- Imprison + { spell = 217832, type = "ability", requiresTarget = true }, -- Imprison { spell = 232893, type = "ability", requiresTarget = true, overlayGlow = true, talent = 3 }, -- Felblade { spell = 258860, type = "ability", debuff = true, requiresTarget = true, talent = 15 }, -- Essence Break { spell = 258920, type = "ability", buff = true }, -- Immolation Aura { spell = 258925, type = "ability", talent = 21 }, -- Fel Barrage - { spell = 278326, type = "ability", requiresTarget = true}, -- Consume Magic - { spell = 342817, type = "ability", requiresTarget = true, talent = 9}, -- Glaive Tempest - { spell = 344859, type = "ability", requiresTarget = true}, -- Demon's Bite - { spell = 344862, type = "ability"}, -- Chaos Strike - { spell = 344865, type = "ability", overlayGlow = true}, -- Fel Rush - { spell = 344866, type = "ability"}, -- Vengeful Retreat - { spell = 344867, type = "ability", debuff = true}, -- Chaos Nova + { spell = 278326, type = "ability", requiresTarget = true }, -- Consume Magic + { spell = 342817, type = "ability", requiresTarget = true, talent = 9 }, -- Glaive Tempest + { spell = 344859, type = "ability", requiresTarget = true }, -- Demon's Bite + { spell = 344862, type = "ability" }, -- Chaos Strike + { spell = 344865, type = "ability", overlayGlow = true }, -- Fel Rush + { spell = 344866, type = "ability" }, -- Vengeful Retreat + { spell = 344867, type = "ability", debuff = true }, -- Chaos Nova }, - icon = 1305156 + icon = 1305156, }, [4] = {}, [5] = {}, @@ -3943,22 +3902,21 @@ templates.class.DEMONHUNTER = { [10] = { title = L["PvP Talents"], args = { - { spell = 115804, type="debuff", unit = "target", pvptalent = 8, titleSuffix = L["debuff"]},-- Mortal Rush - { spell = 203704, type="ability", pvptalent = 11, titleSuffix = L["cooldown"]},-- Mana Break - { spell = 203704, type="debuff", unit = "target", pvptalent = 11, titleSuffix = L["debuff"]},-- Mana Break - { spell = 205604, type="ability", pvptalent = 5},-- Reverse Magic - { spell = 206649, type="ability", pvptalent = 6, titleSuffix = L["cooldown"]},-- Eye of Leotheras - { spell = 206649, type="debuff", unit = "target", pvptalent = 6, titleSuffix = L["debuff"]},-- Eye of Leotheras - { spell = 206803, type="buff", unit = "player", pvptalent = 4, titleSuffix = L["buff"]},-- Rain from Above - { spell = 206803, type="ability", pvptalent = 4, titleSuffix = L["cooldown"]},-- Rain from Above - { spell = 235903, type="ability", pvptalent = 7},-- Mana Rift + { spell = 115804, type = "debuff", unit = "target", pvptalent = 8, titleSuffix = L["debuff"] }, -- Mortal Rush + { spell = 203704, type = "ability", pvptalent = 11, titleSuffix = L["cooldown"] }, -- Mana Break + { spell = 203704, type = "debuff", unit = "target", pvptalent = 11, titleSuffix = L["debuff"] }, -- Mana Break + { spell = 205604, type = "ability", pvptalent = 5 }, -- Reverse Magic + { spell = 206649, type = "ability", pvptalent = 6, titleSuffix = L["cooldown"] }, -- Eye of Leotheras + { spell = 206649, type = "debuff", unit = "target", pvptalent = 6, titleSuffix = L["debuff"] }, -- Eye of Leotheras + { spell = 206803, type = "buff", unit = "player", pvptalent = 4, titleSuffix = L["buff"] }, -- Rain from Above + { spell = 206803, type = "ability", pvptalent = 4, titleSuffix = L["cooldown"] }, -- Rain from Above + { spell = 235903, type = "ability", pvptalent = 7 }, -- Mana Rift }, icon = "Interface\\Icons\\Achievement_BG_winWSG", }, [11] = { title = L["Resources"], - args = { - }, + args = {}, icon = 1344651, }, }, @@ -3966,70 +3924,70 @@ templates.class.DEMONHUNTER = { [1] = { title = L["Buffs"], args = { - { spell = 131347, type = "buff", unit = "player"}, -- Glide - { spell = 178740, type = "buff", unit = "player"}, -- Immolation Aura - { spell = 188501, type = "buff", unit = "player"}, -- Spectral Sight - { spell = 203981, type = "buff", unit = "player"}, -- Soul Fragments - { spell = 203819, type = "buff", unit = "player"}, -- Demon Spikes - { spell = 207693, type = "buff", unit = "player", talent = 4}, -- Feast of Souls - { spell = 258920, type = "buff", unit = "player"}, -- Metamorphosis + { spell = 131347, type = "buff", unit = "player" }, -- Glide + { spell = 178740, type = "buff", unit = "player" }, -- Immolation Aura + { spell = 188501, type = "buff", unit = "player" }, -- Spectral Sight + { spell = 203981, type = "buff", unit = "player" }, -- Soul Fragments + { spell = 203819, type = "buff", unit = "player" }, -- Demon Spikes + { spell = 207693, type = "buff", unit = "player", talent = 4 }, -- Feast of Souls + { spell = 258920, type = "buff", unit = "player" }, -- Metamorphosis { spell = 263648, type = "buff", unit = "player", talent = 18 }, -- Soul Barrier { spell = 326863, type = "buff", unit = "player", talent = 20 }, -- Ruinous Bulwark { spell = 343013, type = "buff", unit = "player" }, -- Revel in Pain }, - icon = 1247263 + icon = 1247263, }, [2] = { title = L["Debuffs"], args = { - { spell = 1490, type = "debuff", unit = "target", forceOwnOnly = true, ownOnly = nil}, -- Chaos Brand - { spell = 185245, type = "debuff", unit = "target"}, -- Torment - { spell = 204490, type = "debuff", unit = "target"}, -- Sigil of Silence - { spell = 204598, type = "debuff", unit = "target"}, -- Sigil of Flame + { spell = 1490, type = "debuff", unit = "target", forceOwnOnly = true, ownOnly = nil }, -- Chaos Brand + { spell = 185245, type = "debuff", unit = "target" }, -- Torment + { spell = 204490, type = "debuff", unit = "target" }, -- Sigil of Silence + { spell = 204598, type = "debuff", unit = "target" }, -- Sigil of Flame { spell = 204843, type = "debuff", unit = "target", talent = 15 }, -- Sigil of Chains - { spell = 207685, type = "debuff", unit = "target"}, -- Sigil of Misery + { spell = 207685, type = "debuff", unit = "target" }, -- Sigil of Misery { spell = 207771, type = "debuff", unit = "target" }, -- Fiery Brand { spell = 209261, type = "debuff", unit = "player" }, -- Uncontained Fel { spell = 217832, type = "debuff", unit = "multi" }, -- Imprison { spell = 247456, type = "debuff", unit = "target", talent = 9 }, -- Frailty { spell = 268178, type = "debuff", unit = "target", talent = 16 }, -- Void Reaver }, - icon = 1344647 + icon = 1344647, }, [3] = { title = L["Abilities"], args = { - { spell = 131347, type = "ability"}, -- Glide - { spell = 183752, type = "ability", requiresTarget = true}, -- Disrupt - { spell = 185123, type = "ability"}, -- Throw Glaive - { spell = 185245, type = "ability", debuff = true, requiresTarget = true}, -- Torment - { spell = 188501, type = "ability", buff = true}, -- Spectral Sight - { spell = 187827, type = "ability", buff = true}, -- Metamorphosis - { spell = 189110, type = "ability", charges = true}, -- Infernal Strike - { spell = 191427, type = "ability", buff = true}, -- Metamorphosis - { spell = 202137, type = "ability", debuff = true}, -- Sigil of Silence + { spell = 131347, type = "ability" }, -- Glide + { spell = 183752, type = "ability", requiresTarget = true }, -- Disrupt + { spell = 185123, type = "ability" }, -- Throw Glaive + { spell = 185245, type = "ability", debuff = true, requiresTarget = true }, -- Torment + { spell = 188501, type = "ability", buff = true }, -- Spectral Sight + { spell = 187827, type = "ability", buff = true }, -- Metamorphosis + { spell = 189110, type = "ability", charges = true }, -- Infernal Strike + { spell = 191427, type = "ability", buff = true }, -- Metamorphosis + { spell = 202137, type = "ability", debuff = true }, -- Sigil of Silence { spell = 202138, type = "ability", talent = 15 }, -- Sigil of Chains - { spell = 202140, type = "ability"}, -- Sigil of Misery - { spell = 204157, type = "ability", requiresTarget = true}, -- Throw Glaive - { spell = 204596, type = "ability", debuff = true}, -- Sigil of Flame - { spell = 207684, type = "ability", debuff = true}, -- Sigil of Misery + { spell = 202140, type = "ability" }, -- Sigil of Misery + { spell = 204157, type = "ability", requiresTarget = true }, -- Throw Glaive + { spell = 204596, type = "ability", debuff = true }, -- Sigil of Flame + { spell = 207684, type = "ability", debuff = true }, -- Sigil of Misery { spell = 212084, type = "ability" }, -- Fel Devastation - { spell = 217832, type = "ability", requiresTarget = true}, -- Imprison - { spell = 228477, type = "ability", requiresTarget = true}, -- Soul Cleave + { spell = 217832, type = "ability", requiresTarget = true }, -- Imprison + { spell = 228477, type = "ability", requiresTarget = true }, -- Soul Cleave { spell = 232893, type = "ability", requiresTarget = true, overlayGlow = true, talent = 3 }, -- Felblade { spell = 247454, type = "ability", usable = true, talent = 9 }, -- Spirit Bomb - { spell = 258920, type = "ability", buff = true}, -- Immolation Aura + { spell = 258920, type = "ability", buff = true }, -- Immolation Aura { spell = 263642, type = "ability", charges = true, talent = 12 }, -- Fracture { spell = 263648, type = "ability", buff = true, talent = 18 }, -- Soul Barrier - { spell = 278326, type = "ability", requiresTarget = true}, -- Consume Magic - { spell = 320341, type = "ability"}, -- Bulk Extraction - { spell = 344859, type = "ability"}, -- Shear - { spell = 344862, type = "ability"}, -- Soul Cleave - { spell = 344865, type = "ability", charges = true}, -- Infernal Strike - { spell = 344866, type = "ability", charges = true, buff = true}, -- Demon Spikes - { spell = 344867, type = "ability", debuff = true, requiresTarget = true}, -- Fiery Brand + { spell = 278326, type = "ability", requiresTarget = true }, -- Consume Magic + { spell = 320341, type = "ability" }, -- Bulk Extraction + { spell = 344859, type = "ability" }, -- Shear + { spell = 344862, type = "ability" }, -- Soul Cleave + { spell = 344865, type = "ability", charges = true }, -- Infernal Strike + { spell = 344866, type = "ability", charges = true, buff = true }, -- Demon Spikes + { spell = 344867, type = "ability", debuff = true, requiresTarget = true }, -- Fiery Brand }, - icon = 1344650 + icon = 1344650, }, [4] = {}, [5] = {}, @@ -4040,21 +3998,20 @@ templates.class.DEMONHUNTER = { [10] = { title = L["PvP Talents"], args = { - { spell = 205629, type="ability", pvptalent = 2, titleSuffix = L["cooldown"]},-- Demonic Trample - { spell = 205604, type="ability", pvptalent = 4}, -- Reverse Magic - { spell = 205630, type="ability", pvptalent = 8, titleSuffix = L["cooldown"]},-- Illidan's Grasp - { spell = 205630, type="debuff", unit = "target", pvptalent = 8, titleSuffix = L["debuff"]},-- Illidan's Grasp - { spell = 206891, type="debuff", unit = "target", pvptalent = 3, titleSuffix = L["debuff"]},-- Tormentor - { spell = 207029, type="ability", pvptalent = 3, titleSuffix = L["cooldown"]},-- Tormentor - { spell = 208769, type="buff", unit = "player", pvptalent = 6},-- Everlasting Hunt - { spell = 213491, type="debuff", unit = "target", pvptalent = 2, titleSuffix = L["debuff"]},-- Demonic Trample + { spell = 205629, type = "ability", pvptalent = 2, titleSuffix = L["cooldown"] }, -- Demonic Trample + { spell = 205604, type = "ability", pvptalent = 4 }, -- Reverse Magic + { spell = 205630, type = "ability", pvptalent = 8, titleSuffix = L["cooldown"] }, -- Illidan's Grasp + { spell = 205630, type = "debuff", unit = "target", pvptalent = 8, titleSuffix = L["debuff"] }, -- Illidan's Grasp + { spell = 206891, type = "debuff", unit = "target", pvptalent = 3, titleSuffix = L["debuff"] }, -- Tormentor + { spell = 207029, type = "ability", pvptalent = 3, titleSuffix = L["cooldown"] }, -- Tormentor + { spell = 208769, type = "buff", unit = "player", pvptalent = 6 }, -- Everlasting Hunt + { spell = 213491, type = "debuff", unit = "target", pvptalent = 2, titleSuffix = L["debuff"] }, -- Demonic Trample }, icon = "Interface\\Icons\\Achievement_BG_winWSG", }, [11] = { title = L["Resources"], - args = { - }, + args = {}, icon = 1247265, }, }, @@ -4065,87 +4022,87 @@ templates.class.DEATHKNIGHT = { [1] = { title = L["Buffs"], args = { - { spell = 3714, type = "buff", unit = "player"}, -- Path of Frost - { spell = 48265, type = "buff", unit = "player"}, -- Death's Advance - { spell = 48707, type = "buff", unit = "player"}, -- Anti-Magic Shell - { spell = 48792, type = "buff", unit = "player"}, -- Icebound Fortitude - { spell = 49039, type = "buff", unit = "player"}, -- Lichborne - { spell = 55233, type = "buff", unit = "player"}, -- Vampiric Blood - { spell = 53365, type = "buff", unit = "player"}, -- Unholy Strength - { spell = 77535, type = "buff", unit = "player"}, -- Blood Shield - { spell = 81141, type = "buff", unit = "player"}, -- Crimson Scourge - { spell = 81256, type = "buff", unit = "player"}, -- Dancing Rune Weapon - { spell = 145629, type = "buff", unit = "player"}, -- Anti-Magic Zone - { spell = 188290, type = "buff", unit = "player"}, -- Death and Decay - { spell = 194679, type = "buff", unit = "player"}, -- Rune Tap - { spell = 195181, type = "buff", unit = "player"}, -- Bone Shield - { spell = 194844, type = "buff", unit = "player", talent = 21}, -- Bonestorm - { spell = 212552, type = "buff", unit = "player", talent = 15}, -- Wraith Walk - { spell = 219788, type = "buff", unit = "player"}, -- Ossuary - { spell = 219809, type = "buff", unit = "player", talent = 3}, -- Tombstone - { spell = 273947, type = "buff", unit = "player", talent = 5}, -- Hemostasis - { spell = 274009, type = "buff", unit = "player", talent = 16}, -- Voracious - }, - icon = 237517 + { spell = 3714, type = "buff", unit = "player" }, -- Path of Frost + { spell = 48265, type = "buff", unit = "player" }, -- Death's Advance + { spell = 48707, type = "buff", unit = "player" }, -- Anti-Magic Shell + { spell = 48792, type = "buff", unit = "player" }, -- Icebound Fortitude + { spell = 49039, type = "buff", unit = "player" }, -- Lichborne + { spell = 55233, type = "buff", unit = "player" }, -- Vampiric Blood + { spell = 53365, type = "buff", unit = "player" }, -- Unholy Strength + { spell = 77535, type = "buff", unit = "player" }, -- Blood Shield + { spell = 81141, type = "buff", unit = "player" }, -- Crimson Scourge + { spell = 81256, type = "buff", unit = "player" }, -- Dancing Rune Weapon + { spell = 145629, type = "buff", unit = "player" }, -- Anti-Magic Zone + { spell = 188290, type = "buff", unit = "player" }, -- Death and Decay + { spell = 194679, type = "buff", unit = "player" }, -- Rune Tap + { spell = 195181, type = "buff", unit = "player" }, -- Bone Shield + { spell = 194844, type = "buff", unit = "player", talent = 21 }, -- Bonestorm + { spell = 212552, type = "buff", unit = "player", talent = 15 }, -- Wraith Walk + { spell = 219788, type = "buff", unit = "player" }, -- Ossuary + { spell = 219809, type = "buff", unit = "player", talent = 3 }, -- Tombstone + { spell = 273947, type = "buff", unit = "player", talent = 5 }, -- Hemostasis + { spell = 274009, type = "buff", unit = "player", talent = 16 }, -- Voracious + }, + icon = 237517, }, [2] = { title = L["Debuffs"], args = { - { spell = 45524, type = "debuff", unit = "target"}, -- Chains of Ice - { spell = 48743, type = "debuff", unit = "player"}, -- Death Pact - { spell = 51399, type = "debuff", unit = "target"}, -- Death Grip - { spell = 56222, type = "debuff", unit = "target"}, -- Dark Command - { spell = 55078, type = "debuff", unit = "target"}, -- Blood Plague + { spell = 45524, type = "debuff", unit = "target" }, -- Chains of Ice + { spell = 48743, type = "debuff", unit = "player" }, -- Death Pact + { spell = 51399, type = "debuff", unit = "target" }, -- Death Grip + { spell = 56222, type = "debuff", unit = "target" }, -- Dark Command + { spell = 55078, type = "debuff", unit = "target" }, -- Blood Plague { spell = 114556, type = "debuff", unit = "player", talent = 19 }, -- Purgatory - { spell = 206930, type = "debuff", unit = "target"}, -- Heart Strike - { spell = 206931, type = "debuff", unit = "target", talent = 2}, -- Blooddrinker - { spell = 206940, type = "debuff", unit = "target", talent = 12}, -- Mark of Blood - { spell = 221562, type = "debuff", unit = "target"}, -- Asphyxiate - { spell = 273977, type = "debuff", unit = "target", talent = 13}, -- Grip of the Dead + { spell = 206930, type = "debuff", unit = "target" }, -- Heart Strike + { spell = 206931, type = "debuff", unit = "target", talent = 2 }, -- Blooddrinker + { spell = 206940, type = "debuff", unit = "target", talent = 12 }, -- Mark of Blood + { spell = 221562, type = "debuff", unit = "target" }, -- Asphyxiate + { spell = 273977, type = "debuff", unit = "target", talent = 13 }, -- Grip of the Dead }, - icon = 237514 + icon = 237514, }, [3] = { title = L["Abilities"], args = { - { spell = 3714, type = "ability", buff = true}, -- Path of Frost - { spell = 43265, type = "ability", buff = true, buffId = 188290, overlayGlow = true}, -- Death and Decay - { spell = 45524, type = "ability", requiresTarget = true}, -- Chains of Ice - { spell = 46585, type = "ability"}, -- Raise Dead - { spell = 47528, type = "ability", requiresTarget = true}, -- Mind Freeze - { spell = 47541, type = "ability"}, -- Death Coil - { spell = 48265, type = "ability", buff = true}, -- Death's Advance - { spell = 48707, type = "ability", buff = true}, -- Anti-Magic Shell - { spell = 48792, type = "ability", buff = true}, -- Icebound Fortitude - { spell = 48743, type = "ability"}, -- Death Pact - { spell = 49028, type = "ability", buff = true}, -- Dancing Rune Weapon - { spell = 49039, type = "ability", buff = true}, -- Lichborne - { spell = 49998, type = "ability"}, -- Death Strike - { spell = 49576, type = "ability", requiresTarget = true}, -- Death Grip - { spell = 50842, type = "ability", charges = true}, -- Blood Boil - { spell = 50977, type = "ability"}, -- Death Gate - { spell = 51052, type = "ability", buff = true}, -- Anti-Magic Zone - { spell = 55233, type = "ability", buff = true}, -- Vampiric Blood - { spell = 56222, type = "ability", requiresTarget = true, debuff = true}, -- Dark Command - { spell = 61999, type = "ability"}, -- Raise Ally - { spell = 108199, type = "ability", requiresTarget = true}, -- Gorefiend's Grasp - { spell = 111673, type = "ability", requiresTarget = true, debuff = true, unit = "pet"}, -- Control Undead - { spell = 194679, type = "ability", charges = true, buff = true}, -- Rune Tap - { spell = 194844, type = "ability", buff = true, talent = 21}, -- Bonestorm - { spell = 195182, type = "ability", buff = true, buffId = 195181, requiresTarget = true}, -- Marrowrend - { spell = 195292, type = "ability", requiresTarget = true}, -- Death's Caress - { spell = 206930, type = "ability", requiresTarget = true}, -- Heart Strike - { spell = 206931, type = "ability", requiresTarget = true, debuff = true, talent = 2}, -- Blooddrinker - { spell = 206940, type = "ability", requiresTarget = true, debuff = true, talent = 12}, -- Mark of Blood - { spell = 212552, type = "ability", buff = true, talent = 15}, -- Wraith Walk - { spell = 221699, type = "ability", talent = 9}, -- Blood Tap - { spell = 219809, type = "ability", usable = true, buff = true, talent = 3}, -- Tombstone - { spell = 221562, type = "ability", debuff = true, requiresTarget = true}, -- Asphyxiate - { spell = 274156, type = "ability", talent = 6}, -- Consumption - { spell = 316239, type = "ability", requiresTarget = true}, -- Heart Strike - { spell = 327574, type = "ability", usable = true}, -- Sacrificial Pact - }, - icon = 136120 + { spell = 3714, type = "ability", buff = true }, -- Path of Frost + { spell = 43265, type = "ability", buff = true, buffId = 188290, overlayGlow = true }, -- Death and Decay + { spell = 45524, type = "ability", requiresTarget = true }, -- Chains of Ice + { spell = 46585, type = "ability" }, -- Raise Dead + { spell = 47528, type = "ability", requiresTarget = true }, -- Mind Freeze + { spell = 47541, type = "ability" }, -- Death Coil + { spell = 48265, type = "ability", buff = true }, -- Death's Advance + { spell = 48707, type = "ability", buff = true }, -- Anti-Magic Shell + { spell = 48792, type = "ability", buff = true }, -- Icebound Fortitude + { spell = 48743, type = "ability" }, -- Death Pact + { spell = 49028, type = "ability", buff = true }, -- Dancing Rune Weapon + { spell = 49039, type = "ability", buff = true }, -- Lichborne + { spell = 49998, type = "ability" }, -- Death Strike + { spell = 49576, type = "ability", requiresTarget = true }, -- Death Grip + { spell = 50842, type = "ability", charges = true }, -- Blood Boil + { spell = 50977, type = "ability" }, -- Death Gate + { spell = 51052, type = "ability", buff = true }, -- Anti-Magic Zone + { spell = 55233, type = "ability", buff = true }, -- Vampiric Blood + { spell = 56222, type = "ability", requiresTarget = true, debuff = true }, -- Dark Command + { spell = 61999, type = "ability" }, -- Raise Ally + { spell = 108199, type = "ability", requiresTarget = true }, -- Gorefiend's Grasp + { spell = 111673, type = "ability", requiresTarget = true, debuff = true, unit = "pet" }, -- Control Undead + { spell = 194679, type = "ability", charges = true, buff = true }, -- Rune Tap + { spell = 194844, type = "ability", buff = true, talent = 21 }, -- Bonestorm + { spell = 195182, type = "ability", buff = true, buffId = 195181, requiresTarget = true }, -- Marrowrend + { spell = 195292, type = "ability", requiresTarget = true }, -- Death's Caress + { spell = 206930, type = "ability", requiresTarget = true }, -- Heart Strike + { spell = 206931, type = "ability", requiresTarget = true, debuff = true, talent = 2 }, -- Blooddrinker + { spell = 206940, type = "ability", requiresTarget = true, debuff = true, talent = 12 }, -- Mark of Blood + { spell = 212552, type = "ability", buff = true, talent = 15 }, -- Wraith Walk + { spell = 221699, type = "ability", talent = 9 }, -- Blood Tap + { spell = 219809, type = "ability", usable = true, buff = true, talent = 3 }, -- Tombstone + { spell = 221562, type = "ability", debuff = true, requiresTarget = true }, -- Asphyxiate + { spell = 274156, type = "ability", talent = 6 }, -- Consumption + { spell = 316239, type = "ability", requiresTarget = true }, -- Heart Strike + { spell = 327574, type = "ability", usable = true }, -- Sacrificial Pact + }, + icon = 136120, }, [4] = {}, [5] = {}, @@ -4156,27 +4113,26 @@ templates.class.DEATHKNIGHT = { [10] = { title = L["PvP Talents"], args = { - { spell = 47476, type="ability", pvptalent = 9, titleSuffix = L["cooldown"]},-- Strangulate - { spell = 47476, type="debuff", unit = "target", pvptalent = 9, titleSuffix = L["buff"]},-- Strangulate - { spell = 77606, type="ability", pvptalent = 2, titleSuffix = L["cooldown"]},-- Dark Simulacrum - { spell = 77606, type="debuff", unit = "target", pvptalent = 2, titleSuffix = L["debuff"]},-- Dark Simulacrum - { spell = 77616, type="buff", unit = "player", pvptalent = 2, titleSuffix = L["buff"]},-- Dark Simulacrum - { spell = 199721, type="debuff", unit = "target", pvptalent = 5},-- Decomposing Aura - { spell = 203173, type="ability", pvptalent = 6, titleSuffix = L["cooldown"]},-- Death Chain - { spell = 203173, type="debuff", unit = "target", pvptalent = 6, titleSuffix = L["buff"]},-- Death Chain - { spell = 206891, type="debuff", unit = "target", pvptalent = 1},-- Murderous Intent - { spell = 207018, type="ability", pvptalent = 1},-- Murderous Intent - { spell = 212610, type="debuff", unit = "target", pvptalent = 10},-- Walking Dead - { spell = 214968, type="debuff", unit = "target", pvptalent = 11},-- Necrotic Aura - { spell = 233411, type="ability", pvptalent = 8, titleSuffix = L["cooldown"]},-- Blood for Blood - { spell = 233411, type="buff", unit = "player", pvptalent = 8, titleSuffix = L["buff"]},-- Blood for Blood + { spell = 47476, type = "ability", pvptalent = 9, titleSuffix = L["cooldown"] }, -- Strangulate + { spell = 47476, type = "debuff", unit = "target", pvptalent = 9, titleSuffix = L["buff"] }, -- Strangulate + { spell = 77606, type = "ability", pvptalent = 2, titleSuffix = L["cooldown"] }, -- Dark Simulacrum + { spell = 77606, type = "debuff", unit = "target", pvptalent = 2, titleSuffix = L["debuff"] }, -- Dark Simulacrum + { spell = 77616, type = "buff", unit = "player", pvptalent = 2, titleSuffix = L["buff"] }, -- Dark Simulacrum + { spell = 199721, type = "debuff", unit = "target", pvptalent = 5 }, -- Decomposing Aura + { spell = 203173, type = "ability", pvptalent = 6, titleSuffix = L["cooldown"] }, -- Death Chain + { spell = 203173, type = "debuff", unit = "target", pvptalent = 6, titleSuffix = L["buff"] }, -- Death Chain + { spell = 206891, type = "debuff", unit = "target", pvptalent = 1 }, -- Murderous Intent + { spell = 207018, type = "ability", pvptalent = 1 }, -- Murderous Intent + { spell = 212610, type = "debuff", unit = "target", pvptalent = 10 }, -- Walking Dead + { spell = 214968, type = "debuff", unit = "target", pvptalent = 11 }, -- Necrotic Aura + { spell = 233411, type = "ability", pvptalent = 8, titleSuffix = L["cooldown"] }, -- Blood for Blood + { spell = 233411, type = "buff", unit = "player", pvptalent = 8, titleSuffix = L["buff"] }, -- Blood for Blood }, icon = "Interface\\Icons\\Achievement_BG_winWSG", }, [11] = { title = L["Resources"], - args = { - }, + args = {}, icon = "Interface\\PlayerFrame\\UI-PlayerFrame-Deathknight-SingleRune", }, }, @@ -4184,84 +4140,83 @@ templates.class.DEATHKNIGHT = { [1] = { title = L["Buffs"], args = { - { spell = 3714, type = "buff", unit = "player"}, -- Path of Frost - { spell = 47568, type = "buff", unit = "player"}, -- Empower Rune Weapon - { spell = 48265, type = "buff", unit = "player"}, -- Death's Advance - { spell = 48707, type = "buff", unit = "player"}, -- Anti-Magic Shell - { spell = 48792, type = "buff", unit = "player"}, -- Icebound Fortitude - { spell = 49039, type = "buff", unit = "player"}, -- Lichborne - { spell = 51124, type = "buff", unit = "player"}, -- Killing Machine - { spell = 51271, type = "buff", unit = "player"}, -- Pillar of Frost - { spell = 53365, type = "buff", unit = "player"}, -- Unholy Strength - { spell = 59052, type = "buff", unit = "player"}, -- Rime - { spell = 145629, type = "buff", unit = "player"}, -- Anti-Magic Zone - { spell = 152279, type = "buff", unit = "player", talent = 21}, -- Breath of Sindragosa + { spell = 3714, type = "buff", unit = "player" }, -- Path of Frost + { spell = 47568, type = "buff", unit = "player" }, -- Empower Rune Weapon + { spell = 48265, type = "buff", unit = "player" }, -- Death's Advance + { spell = 48707, type = "buff", unit = "player" }, -- Anti-Magic Shell + { spell = 48792, type = "buff", unit = "player" }, -- Icebound Fortitude + { spell = 49039, type = "buff", unit = "player" }, -- Lichborne + { spell = 51124, type = "buff", unit = "player" }, -- Killing Machine + { spell = 51271, type = "buff", unit = "player" }, -- Pillar of Frost + { spell = 53365, type = "buff", unit = "player" }, -- Unholy Strength + { spell = 59052, type = "buff", unit = "player" }, -- Rime + { spell = 145629, type = "buff", unit = "player" }, -- Anti-Magic Zone + { spell = 152279, type = "buff", unit = "player", talent = 21 }, -- Breath of Sindragosa { spell = 178819, type = "buff", unit = "player" }, -- Dark Succor - { spell = 194879, type = "buff", unit = "player", talent = 2}, -- Icy Talons - { spell = 196770, type = "buff", unit = "player"}, -- Remorseless Winter - { spell = 207203, type = "buff", unit = "player", talent = 13}, -- Frost Shield - { spell = 211805, type = "buff", unit = "player", talent = 16}, -- Gathering Storm - { spell = 212552, type = "buff", unit = "player", talent = 14}, -- Wraith Walk - { spell = 253595, type = "buff", unit = "player", talent = 1}, -- Inexorable Assault - { spell = 281209, type = "buff", unit = "player", talent = 3}, -- Cold Heart - { spell = 321995, type = "buff", unit = "player", talent = 17}, -- Hypothermic Presence + { spell = 194879, type = "buff", unit = "player", talent = 2 }, -- Icy Talons + { spell = 196770, type = "buff", unit = "player" }, -- Remorseless Winter + { spell = 207203, type = "buff", unit = "player", talent = 13 }, -- Frost Shield + { spell = 211805, type = "buff", unit = "player", talent = 16 }, -- Gathering Storm + { spell = 212552, type = "buff", unit = "player", talent = 14 }, -- Wraith Walk + { spell = 253595, type = "buff", unit = "player", talent = 1 }, -- Inexorable Assault + { spell = 281209, type = "buff", unit = "player", talent = 3 }, -- Cold Heart + { spell = 321995, type = "buff", unit = "player", talent = 17 }, -- Hypothermic Presence }, - icon = 135305 + icon = 135305, }, [2] = { title = L["Debuffs"], args = { - { spell = 45524, type = "debuff", unit = "target"}, -- Chains of Ice - { spell = 48743, type = "debuff", unit = "player"}, -- Death Pact - { spell = 51714, type = "debuff", unit = "target"}, -- Razorice - { spell = 55095, type = "debuff", unit = "target"}, -- Frost Fever - { spell = 56222, type = "debuff", unit = "target"}, -- Dark Command - { spell = 207167, type = "debuff", unit = "target", talent = 9}, -- Blinding Sleet - { spell = 211793, type = "debuff", unit = "target"}, -- Remorseless Winter - + { spell = 45524, type = "debuff", unit = "target" }, -- Chains of Ice + { spell = 48743, type = "debuff", unit = "player" }, -- Death Pact + { spell = 51714, type = "debuff", unit = "target" }, -- Razorice + { spell = 55095, type = "debuff", unit = "target" }, -- Frost Fever + { spell = 56222, type = "debuff", unit = "target" }, -- Dark Command + { spell = 207167, type = "debuff", unit = "target", talent = 9 }, -- Blinding Sleet + { spell = 211793, type = "debuff", unit = "target" }, -- Remorseless Winter }, - icon = 237522 + icon = 237522, }, [3] = { title = L["Abilities"], args = { - { spell = 3714, type = "ability", buff = true}, -- Path of Frost - { spell = 43265, type = "ability"}, -- Death and Decay - { spell = 45524, type = "ability", requiresTarget = true, debuff = true}, -- Chains of Ice - { spell = 46585, type = "ability"}, -- Raise Dead - { spell = 47528, type = "ability", requiresTarget = true}, -- Mind Freeze - { spell = 47541, type = "ability", requiresTarget = true}, -- Death Coil - { spell = 47568, type = "ability", buff = true}, -- Empower Rune Weapon - { spell = 48265, type = "ability", buff = true}, -- Death's Advance - { spell = 48707, type = "ability", buff = true}, -- Anti-Magic Shell - { spell = 48743, type = "ability", debuff = true, unit = "player", talent = 15}, -- Death Pact - { spell = 48792, type = "ability", buff = true}, -- Icebound Fortitude - { spell = 49020, type = "ability", requiresTarget = true, overlayGlow = true}, -- Obliterate - { spell = 49143, type = "ability", requiresTarget = true}, -- Frost Strike - { spell = 49576, type = "ability", requiresTarget = true}, -- Death Grip - { spell = 49039, type = "ability", buff = true}, -- Lichborne - { spell = 49184, type = "ability", requiresTarget = true, overlayGlow = true}, -- Howling Blast - { spell = 49998, type = "ability"}, -- Death Strike - { spell = 50977, type = "ability"}, -- Death Gate - { spell = 51052, type = "ability", buff = true}, -- Anti-Magic Zone - { spell = 51271, type = "ability", buff = true}, -- Pillar of Frost - { spell = 56222, type = "ability", requiresTarget = true, debuff = true}, -- Dark Command - { spell = 57330, type = "ability", talent = 6}, -- Horn of Winter - { spell = 61999, type = "ability"}, -- Raise Ally - { spell = 108194, type = "ability", debuff = true}, -- Asphyxiate - { spell = 111673, type = "ability", requiresTarget = true, debuff = true, unit = "pet"}, -- Control Undead - { spell = 152279, type = "ability", buff = true, talent = 21}, -- Breath of Sindragosa - { spell = 194913, type = "ability"}, -- Glacial Advance - { spell = 196770, type = "ability", buff = true}, -- Remorseless Winter - { spell = 207167, type = "ability", talent = 9}, -- Blinding Sleet - { spell = 207230, type = "ability", overlayGlow = true, talent = 12}, -- Frostscythe - { spell = 212552, type = "ability", buff = true, talent = 14}, -- Wraith Walk - { spell = 279302, type = "ability"}, -- Frostwyrm's Fury - { spell = 316239, type = "ability", usable = true}, -- Rune Strike - { spell = 321995, type = "ability", buff = true}, -- Hypothermic Presence - { spell = 327574, type = "ability", usable = true}, -- Sacrificial Pact - }, - icon = 135372 + { spell = 3714, type = "ability", buff = true }, -- Path of Frost + { spell = 43265, type = "ability" }, -- Death and Decay + { spell = 45524, type = "ability", requiresTarget = true, debuff = true }, -- Chains of Ice + { spell = 46585, type = "ability" }, -- Raise Dead + { spell = 47528, type = "ability", requiresTarget = true }, -- Mind Freeze + { spell = 47541, type = "ability", requiresTarget = true }, -- Death Coil + { spell = 47568, type = "ability", buff = true }, -- Empower Rune Weapon + { spell = 48265, type = "ability", buff = true }, -- Death's Advance + { spell = 48707, type = "ability", buff = true }, -- Anti-Magic Shell + { spell = 48743, type = "ability", debuff = true, unit = "player", talent = 15 }, -- Death Pact + { spell = 48792, type = "ability", buff = true }, -- Icebound Fortitude + { spell = 49020, type = "ability", requiresTarget = true, overlayGlow = true }, -- Obliterate + { spell = 49143, type = "ability", requiresTarget = true }, -- Frost Strike + { spell = 49576, type = "ability", requiresTarget = true }, -- Death Grip + { spell = 49039, type = "ability", buff = true }, -- Lichborne + { spell = 49184, type = "ability", requiresTarget = true, overlayGlow = true }, -- Howling Blast + { spell = 49998, type = "ability" }, -- Death Strike + { spell = 50977, type = "ability" }, -- Death Gate + { spell = 51052, type = "ability", buff = true }, -- Anti-Magic Zone + { spell = 51271, type = "ability", buff = true }, -- Pillar of Frost + { spell = 56222, type = "ability", requiresTarget = true, debuff = true }, -- Dark Command + { spell = 57330, type = "ability", talent = 6 }, -- Horn of Winter + { spell = 61999, type = "ability" }, -- Raise Ally + { spell = 108194, type = "ability", debuff = true }, -- Asphyxiate + { spell = 111673, type = "ability", requiresTarget = true, debuff = true, unit = "pet" }, -- Control Undead + { spell = 152279, type = "ability", buff = true, talent = 21 }, -- Breath of Sindragosa + { spell = 194913, type = "ability" }, -- Glacial Advance + { spell = 196770, type = "ability", buff = true }, -- Remorseless Winter + { spell = 207167, type = "ability", talent = 9 }, -- Blinding Sleet + { spell = 207230, type = "ability", overlayGlow = true, talent = 12 }, -- Frostscythe + { spell = 212552, type = "ability", buff = true, talent = 14 }, -- Wraith Walk + { spell = 279302, type = "ability" }, -- Frostwyrm's Fury + { spell = 316239, type = "ability", usable = true }, -- Rune Strike + { spell = 321995, type = "ability", buff = true }, -- Hypothermic Presence + { spell = 327574, type = "ability", usable = true }, -- Sacrificial Pact + }, + icon = 135372, }, [4] = {}, [5] = {}, @@ -4272,27 +4227,26 @@ templates.class.DEATHKNIGHT = { [10] = { title = L["PvP Talents"], args = { - { spell = 77606, type="ability", pvptalent = 10, titleSuffix = L["cooldown"]},-- Dark Simulacrum - { spell = 77606, type="debuff", unit = "target", pvptalent = 10, titleSuffix = L["debuff"]},-- Dark Simulacrum - { spell = 77616, type="buff", unit = "player", pvptalent = 10, titleSuffix = L["buff"]},-- Dark Simulacrum - { spell = 204206, type="debuff", unit = "target", pvptalent = 4, titleSuffix = L["debuff"]},-- Chill Streak - { spell = 213726, type="debuff", unit = "player", pvptalent = 9},-- Cadaverous Pallor - { spell = 214968, type="debuff", unit = "target", pvptalent = 5},-- Necrotic Aura - { spell = 228579, type="buff", unit = "target", pvptalent = 1},-- Heartstop Aura - { spell = 233395, type="debuff", unit = "target", pvptalent = 2},-- Deathchill - { spell = 233397, type="debuff", unit = "target", pvptalent = 3},-- Delirium - { spell = 287254, type="debuff", unit = "target", pvptalent = 7, titleSuffix = L["stun debuff"]},-- Dead of Winter - { spell = 289959, type="debuff", unit = "target", pvptalent = 7, titleSuffix = L["slow debuff"]},-- Dead of Winter - { spell = 288977, type="ability", pvptalent = 6, titleSuffix = L["cooldown"]},-- Transfusion - { spell = 288977, type="buff", unit = "player", pvptalent = 6, titleSuffix = L["buff"]},-- Transfusion - { spell = 305392, type="ability", pvptalent = 4, titleSuffix = L["cooldown"]},-- Chill Streak + { spell = 77606, type = "ability", pvptalent = 10, titleSuffix = L["cooldown"] }, -- Dark Simulacrum + { spell = 77606, type = "debuff", unit = "target", pvptalent = 10, titleSuffix = L["debuff"] }, -- Dark Simulacrum + { spell = 77616, type = "buff", unit = "player", pvptalent = 10, titleSuffix = L["buff"] }, -- Dark Simulacrum + { spell = 204206, type = "debuff", unit = "target", pvptalent = 4, titleSuffix = L["debuff"] }, -- Chill Streak + { spell = 213726, type = "debuff", unit = "player", pvptalent = 9 }, -- Cadaverous Pallor + { spell = 214968, type = "debuff", unit = "target", pvptalent = 5 }, -- Necrotic Aura + { spell = 228579, type = "buff", unit = "target", pvptalent = 1 }, -- Heartstop Aura + { spell = 233395, type = "debuff", unit = "target", pvptalent = 2 }, -- Deathchill + { spell = 233397, type = "debuff", unit = "target", pvptalent = 3 }, -- Delirium + { spell = 287254, type = "debuff", unit = "target", pvptalent = 7, titleSuffix = L["stun debuff"] }, -- Dead of Winter + { spell = 289959, type = "debuff", unit = "target", pvptalent = 7, titleSuffix = L["slow debuff"] }, -- Dead of Winter + { spell = 288977, type = "ability", pvptalent = 6, titleSuffix = L["cooldown"] }, -- Transfusion + { spell = 288977, type = "buff", unit = "player", pvptalent = 6, titleSuffix = L["buff"] }, -- Transfusion + { spell = 305392, type = "ability", pvptalent = 4, titleSuffix = L["cooldown"] }, -- Chill Streak }, icon = "Interface\\Icons\\Achievement_BG_winWSG", }, [11] = { title = L["Resources"], - args = { - }, + args = {}, icon = "Interface\\PlayerFrame\\UI-PlayerFrame-Deathknight-SingleRune", }, }, @@ -4300,82 +4254,82 @@ templates.class.DEATHKNIGHT = { [1] = { title = L["Buffs"], args = { - { spell = 3714, type = "buff", unit = "player"}, -- Path of Frost - { spell = 42650, type = "buff", unit = "player"}, -- Army of the Dead - { spell = 48265, type = "buff", unit = "player"}, -- Death's Advance - { spell = 48707, type = "buff", unit = "player"}, -- Anti-Magic Shell - { spell = 48792, type = "buff", unit = "player"}, -- Icebound Fortitude - { spell = 51460, type = "buff", unit = "player"}, -- Runic Corruption - { spell = 53365, type = "buff", unit = "player"}, -- Unholy Strength - { spell = 63560, type = "buff", unit = "pet"}, -- Dark Transformation - { spell = 81340, type = "buff", unit = "player"}, -- Sudden Doom - { spell = 115989, type = "buff", unit = "player", talent = 6}, -- Unholy Blight + { spell = 3714, type = "buff", unit = "player" }, -- Path of Frost + { spell = 42650, type = "buff", unit = "player" }, -- Army of the Dead + { spell = 48265, type = "buff", unit = "player" }, -- Death's Advance + { spell = 48707, type = "buff", unit = "player" }, -- Anti-Magic Shell + { spell = 48792, type = "buff", unit = "player" }, -- Icebound Fortitude + { spell = 51460, type = "buff", unit = "player" }, -- Runic Corruption + { spell = 53365, type = "buff", unit = "player" }, -- Unholy Strength + { spell = 63560, type = "buff", unit = "pet" }, -- Dark Transformation + { spell = 81340, type = "buff", unit = "player" }, -- Sudden Doom + { spell = 115989, type = "buff", unit = "player", talent = 6 }, -- Unholy Blight { spell = 178819, type = "buff", unit = "player" }, -- Dark Succor - { spell = 188290, type = "buff", unit = "player"}, -- Death and Decay - { spell = 207289, type = "buff", unit = "player", talent = 21}, -- Unholy Frenzy - { spell = 212552, type = "buff", unit = "player", talent = 14}, -- Wraith Walk - { spell = 319255, type = "buff", unit = "player", talent = 17}, -- Unholy Pact + { spell = 188290, type = "buff", unit = "player" }, -- Death and Decay + { spell = 207289, type = "buff", unit = "player", talent = 21 }, -- Unholy Frenzy + { spell = 212552, type = "buff", unit = "player", talent = 14 }, -- Wraith Walk + { spell = 319255, type = "buff", unit = "player", talent = 17 }, -- Unholy Pact }, - icon = 136181 + icon = 136181, }, [2] = { title = L["Debuffs"], args = { - { spell = 45524, type = "debuff", unit = "target"}, -- Chains of Ice - { spell = 56222, type = "debuff", unit = "target"}, -- Dark Command - { spell = 91800, type = "debuff", unit = "target"}, -- Gnaw - { spell = 108194, type = "debuff", unit = "target", talent = 9}, -- Asphyxiate - { spell = 115994, type = "debuff", unit = "target", talent = 6}, -- Unholy Blight - { spell = 191587, type = "debuff", unit = "target"}, -- Virulent Plague - { spell = 194310, type = "debuff", unit = "target"}, -- Festering Wound - { spell = 196782, type = "debuff", unit = "target"}, -- Outbreak - { spell = 273977, type = "debuff", unit = "target"}, -- Grip of the Dead - { spell = 343294, type = "debuff", unit = "target", talent = 12}, -- Soul Reaper + { spell = 45524, type = "debuff", unit = "target" }, -- Chains of Ice + { spell = 56222, type = "debuff", unit = "target" }, -- Dark Command + { spell = 91800, type = "debuff", unit = "target" }, -- Gnaw + { spell = 108194, type = "debuff", unit = "target", talent = 9 }, -- Asphyxiate + { spell = 115994, type = "debuff", unit = "target", talent = 6 }, -- Unholy Blight + { spell = 191587, type = "debuff", unit = "target" }, -- Virulent Plague + { spell = 194310, type = "debuff", unit = "target" }, -- Festering Wound + { spell = 196782, type = "debuff", unit = "target" }, -- Outbreak + { spell = 273977, type = "debuff", unit = "target" }, -- Grip of the Dead + { spell = 343294, type = "debuff", unit = "target", talent = 12 }, -- Soul Reaper }, - icon = 1129420 + icon = 1129420, }, [3] = { title = L["Abilities"], args = { - { spell = 3714, type = "ability", buff = true}, -- Path of Frost - { spell = 42650, type = "ability", buff = true}, -- Army of the Dead - { spell = 43265, type = "ability", buff = true, buffId = 188290}, -- Death and Decay - { spell = 45524, type = "ability", requiresTarget = true, debuff = true}, -- Chains of Ice - { spell = 46585, type = "ability"}, -- Raise Dead - { spell = 47468, type = "ability", requiresTarget = true}, -- Claw - { spell = 47481, type = "ability", requiresTarget = true, debuff = true}, -- Gnaw - { spell = 47484, type = "ability", requiresTarget = true}, -- Huddle - { spell = 47528, type = "ability", requiresTarget = true}, -- Mind Freeze - { spell = 47541, type = "ability", requiresTarget = true, usable = true, overlayGlow = true}, -- Death Coil - { spell = 48265, type = "ability", buff = true}, -- Death's Advance - { spell = 48707, type = "ability", buff = true}, -- Anti-Magic Shell - { spell = 48743, type = "ability", debuff = true, unit = "player", talent = 15}, -- Death Pact - { spell = 48792, type = "ability", buff = true}, -- Icebound Fortitude - { spell = 49039, type = "ability", buff = true}, -- Lichborne - { spell = 49206, type = "ability", requiresTarget = true, talent = 20}, -- Summon Gargoyle - { spell = 49576, type = "ability", requiresTarget = true}, -- Death Grip - { spell = 49998, type = "ability"}, -- Death Strike - { spell = 50977, type = "ability"}, -- Death Gate - { spell = 51052, type = "ability", buff = true}, -- Anti-Magic Zone - { spell = 55090, type = "ability", requiresTarget = true, talent = {1, 2}}, -- Scourge Strike - { spell = 56222, type = "ability", requiresTarget = true, debuff = true}, -- Dark Command - { spell = 61999, type = "ability"}, -- Raise Ally - { spell = 63560, type = "ability", buff = true, unit = "pet"}, -- Dark Transformation - { spell = 77575, type = "ability", requiresTarget = true, debuff = true, buffId = 191587}, -- Outbreak - { spell = 108194, type = "ability", requiresTarget = true, debuff = true, talent = 9}, -- Asphyxiate - { spell = 111673, type = "ability", requiresTarget = true, debuff = true, unit = "pet"}, -- Control Undead - { spell = 115989, type = "ability", buff = true, talent = 6}, -- Unholy Blight - { spell = 152280, type = "ability", buff = true, buffId = 188290, talent = 17}, -- Defile - { spell = 207289, type = "ability", buff = true, talent = 21}, -- Unholy Frenzy - { spell = 207311, type = "ability", requiresTarget = true, talent = 3}, -- Clawing Shadows - { spell = 207317, type = "ability", overlayGlow = true}, -- Epidemic - { spell = 212552, type = "ability", buff = true, talent = 14}, -- Wraith Walk - { spell = 275699, type = "ability", usable = true, requiresTarget = true}, -- Apocalypse - { spell = 316239, type = "ability", requiresTarget = true, debuff = true, buffId = 194310}, -- Festering Strike - { spell = 327574, type = "ability", usable = true}, -- Sacrificial Pact - { spell = 343294, type = "ability", debuff = true, talent = 12}, -- Sacrificial Pact - }, - icon = 136144 + { spell = 3714, type = "ability", buff = true }, -- Path of Frost + { spell = 42650, type = "ability", buff = true }, -- Army of the Dead + { spell = 43265, type = "ability", buff = true, buffId = 188290 }, -- Death and Decay + { spell = 45524, type = "ability", requiresTarget = true, debuff = true }, -- Chains of Ice + { spell = 46585, type = "ability" }, -- Raise Dead + { spell = 47468, type = "ability", requiresTarget = true }, -- Claw + { spell = 47481, type = "ability", requiresTarget = true, debuff = true }, -- Gnaw + { spell = 47484, type = "ability", requiresTarget = true }, -- Huddle + { spell = 47528, type = "ability", requiresTarget = true }, -- Mind Freeze + { spell = 47541, type = "ability", requiresTarget = true, usable = true, overlayGlow = true }, -- Death Coil + { spell = 48265, type = "ability", buff = true }, -- Death's Advance + { spell = 48707, type = "ability", buff = true }, -- Anti-Magic Shell + { spell = 48743, type = "ability", debuff = true, unit = "player", talent = 15 }, -- Death Pact + { spell = 48792, type = "ability", buff = true }, -- Icebound Fortitude + { spell = 49039, type = "ability", buff = true }, -- Lichborne + { spell = 49206, type = "ability", requiresTarget = true, talent = 20 }, -- Summon Gargoyle + { spell = 49576, type = "ability", requiresTarget = true }, -- Death Grip + { spell = 49998, type = "ability" }, -- Death Strike + { spell = 50977, type = "ability" }, -- Death Gate + { spell = 51052, type = "ability", buff = true }, -- Anti-Magic Zone + { spell = 55090, type = "ability", requiresTarget = true, talent = { 1, 2 } }, -- Scourge Strike + { spell = 56222, type = "ability", requiresTarget = true, debuff = true }, -- Dark Command + { spell = 61999, type = "ability" }, -- Raise Ally + { spell = 63560, type = "ability", buff = true, unit = "pet" }, -- Dark Transformation + { spell = 77575, type = "ability", requiresTarget = true, debuff = true, buffId = 191587 }, -- Outbreak + { spell = 108194, type = "ability", requiresTarget = true, debuff = true, talent = 9 }, -- Asphyxiate + { spell = 111673, type = "ability", requiresTarget = true, debuff = true, unit = "pet" }, -- Control Undead + { spell = 115989, type = "ability", buff = true, talent = 6 }, -- Unholy Blight + { spell = 152280, type = "ability", buff = true, buffId = 188290, talent = 17 }, -- Defile + { spell = 207289, type = "ability", buff = true, talent = 21 }, -- Unholy Frenzy + { spell = 207311, type = "ability", requiresTarget = true, talent = 3 }, -- Clawing Shadows + { spell = 207317, type = "ability", overlayGlow = true }, -- Epidemic + { spell = 212552, type = "ability", buff = true, talent = 14 }, -- Wraith Walk + { spell = 275699, type = "ability", usable = true, requiresTarget = true }, -- Apocalypse + { spell = 316239, type = "ability", requiresTarget = true, debuff = true, buffId = 194310 }, -- Festering Strike + { spell = 327574, type = "ability", usable = true }, -- Sacrificial Pact + { spell = 343294, type = "ability", debuff = true, talent = 12 }, -- Sacrificial Pact + }, + icon = 136144, }, [4] = {}, [5] = {}, @@ -4386,25 +4340,24 @@ templates.class.DEATHKNIGHT = { [10] = { title = L["PvP Talents"], args = { - { spell = 77606, type="ability", pvptalent = 7, titleSuffix = L["cooldown"]},-- Dark Simulacrum - { spell = 77606, type="debuff", unit = "target", pvptalent = 7, titleSuffix = L["debuff"]},-- Dark Simulacrum - { spell = 77616, type="buff", unit = "player", pvptalent = 7, titleSuffix = L["buff"]},-- Dark Simulacrum - { spell = 199721, type="debuff", unit = "target", pvptalent = 9},-- Decomposing Aura - { spell = 210128, type="ability", pvptalent = 1},-- Reanimation - { spell = 213726, type="debuff", unit = "player", pvptalent = 5},-- Cadaverous Pallor - { spell = 214968, type="buff", unit = "target", pvptalent = 10},-- Necrotic Aura - { spell = 223829, type="debuff", unit = "target", pvptalent = 6},-- Necrotic Strike - { spell = 288849, type="debuff", unit = "target", pvptalent = 4},-- Necromancer's Bargain - { spell = 288853, type="ability", pvptalent = 3},-- Raise Abomination - { spell = 288977, type="ability", pvptalent = 2, titleSuffix = L["cooldown"]},-- Transfusion - { spell = 288977, type="buff", unit = "player", pvptalent = 2, titleSuffix = L["buff"]},-- Transfusion + { spell = 77606, type = "ability", pvptalent = 7, titleSuffix = L["cooldown"] }, -- Dark Simulacrum + { spell = 77606, type = "debuff", unit = "target", pvptalent = 7, titleSuffix = L["debuff"] }, -- Dark Simulacrum + { spell = 77616, type = "buff", unit = "player", pvptalent = 7, titleSuffix = L["buff"] }, -- Dark Simulacrum + { spell = 199721, type = "debuff", unit = "target", pvptalent = 9 }, -- Decomposing Aura + { spell = 210128, type = "ability", pvptalent = 1 }, -- Reanimation + { spell = 213726, type = "debuff", unit = "player", pvptalent = 5 }, -- Cadaverous Pallor + { spell = 214968, type = "buff", unit = "target", pvptalent = 10 }, -- Necrotic Aura + { spell = 223829, type = "debuff", unit = "target", pvptalent = 6 }, -- Necrotic Strike + { spell = 288849, type = "debuff", unit = "target", pvptalent = 4 }, -- Necromancer's Bargain + { spell = 288853, type = "ability", pvptalent = 3 }, -- Raise Abomination + { spell = 288977, type = "ability", pvptalent = 2, titleSuffix = L["cooldown"] }, -- Transfusion + { spell = 288977, type = "buff", unit = "player", pvptalent = 2, titleSuffix = L["buff"] }, -- Transfusion }, icon = "Interface\\Icons\\Achievement_BG_winWSG", }, [11] = { title = L["Resources"], - args = { - }, + args = {}, icon = "Interface\\PlayerFrame\\UI-PlayerFrame-Deathknight-SingleRune", }, }, @@ -4414,48 +4367,53 @@ templates.class.DEATHKNIGHT = { tinsert(templates.general.args, { title = L["Health"], icon = "Interface\\Icons\\inv_alchemy_70_red", - type = "health" -}); + type = "health", +}) tinsert(templates.general.args, { title = L["Cast"], icon = 136209, - type = "cast" -}); + type = "cast", +}) tinsert(templates.general.args, { title = L["Always Active"], icon = "Interface\\Addons\\WeakAuras\\PowerAurasMedia\\Auras\\Aura78", - triggers = {[1] = { trigger = { + triggers = { [1] = { trigger = { type = WeakAuras.GetTriggerCategoryFor("Conditions"), event = "Conditions", - use_alwaystrue = true}}} -}); + use_alwaystrue = true, + } } }, +}) tinsert(templates.general.args, { title = L["Pet alive"], icon = "Interface\\Icons\\ability_hunter_pet_raptor", - triggers = {[1] = { trigger = { + triggers = { [1] = { trigger = { type = WeakAuras.GetTriggerCategoryFor("Conditions"), event = "Conditions", - use_HasPet = true}}} -}); + use_HasPet = true, + } } }, +}) tinsert(templates.general.args, { title = L["Pet Behavior"], icon = "Interface\\Icons\\Ability_hunter_pet_assist", - triggers = {[1] = { trigger = { + triggers = { [1] = { trigger = { type = WeakAuras.GetTriggerCategoryFor("Pet Behavior"), event = "Pet Behavior", use_behavior = true, - behavior = "assist"}}} -}); + behavior = "assist", + } } }, +}) tinsert(templates.general.args, { - spell = 2825, type = "buff", unit = "player", + spell = 2825, + type = "buff", + unit = "player", forceOwnOnly = true, ownOnly = nil, overideTitle = L["Bloodlust/Heroism"], - spellIds = {2825, 32182, 80353, 264667}} -); + spellIds = { 2825, 32182, 80353, 264667 }, +}) -- Meta template for Power triggers local function createSimplePowerTemplate(powertype) @@ -4465,7 +4423,7 @@ local function createSimplePowerTemplate(powertype) type = "power", powertype = powertype, } - return power; + return power end ------------------------------- @@ -4474,57 +4432,57 @@ end local resourceSection = 11 -- Warrior for i = 1, 3 do - tinsert(templates.class.WARRIOR[i][resourceSection].args, createSimplePowerTemplate(1)); + tinsert(templates.class.WARRIOR[i][resourceSection].args, createSimplePowerTemplate(1)) end -- Paladin for i = 1, 3 do - tinsert(templates.class.PALADIN[i][resourceSection].args, createSimplePowerTemplate(9)); - tinsert(templates.class.PALADIN[i][resourceSection].args, createSimplePowerTemplate(0)); + tinsert(templates.class.PALADIN[i][resourceSection].args, createSimplePowerTemplate(9)) + tinsert(templates.class.PALADIN[i][resourceSection].args, createSimplePowerTemplate(0)) end -- Hunter for i = 1, 3 do - tinsert(templates.class.HUNTER[i][resourceSection].args, createSimplePowerTemplate(2)); + tinsert(templates.class.HUNTER[i][resourceSection].args, createSimplePowerTemplate(2)) end -- Rogue for i = 1, 3 do - tinsert(templates.class.ROGUE[i][resourceSection].args, createSimplePowerTemplate(3)); - tinsert(templates.class.ROGUE[i][resourceSection].args, createSimplePowerTemplate(4)); + tinsert(templates.class.ROGUE[i][resourceSection].args, createSimplePowerTemplate(3)) + tinsert(templates.class.ROGUE[i][resourceSection].args, createSimplePowerTemplate(4)) end -- Priest for i = 1, 3 do - tinsert(templates.class.PRIEST[i][resourceSection].args, createSimplePowerTemplate(0)); + tinsert(templates.class.PRIEST[i][resourceSection].args, createSimplePowerTemplate(0)) end -tinsert(templates.class.PRIEST[3][resourceSection].args, createSimplePowerTemplate(13)); +tinsert(templates.class.PRIEST[3][resourceSection].args, createSimplePowerTemplate(13)) -- Shaman for i = 1, 3 do - tinsert(templates.class.SHAMAN[i][resourceSection].args, createSimplePowerTemplate(0)); + tinsert(templates.class.SHAMAN[i][resourceSection].args, createSimplePowerTemplate(0)) end for i = 1, 2 do - tinsert(templates.class.SHAMAN[i][resourceSection].args, createSimplePowerTemplate(11)); + tinsert(templates.class.SHAMAN[i][resourceSection].args, createSimplePowerTemplate(11)) end -- Mage -tinsert(templates.class.MAGE[1][resourceSection].args, createSimplePowerTemplate(16)); +tinsert(templates.class.MAGE[1][resourceSection].args, createSimplePowerTemplate(16)) for i = 1, 3 do - tinsert(templates.class.MAGE[i][resourceSection].args, createSimplePowerTemplate(0)); + tinsert(templates.class.MAGE[i][resourceSection].args, createSimplePowerTemplate(0)) end -- Warlock for i = 1, 3 do - tinsert(templates.class.WARLOCK[i][resourceSection].args, createSimplePowerTemplate(0)); - tinsert(templates.class.WARLOCK[i][resourceSection].args, createSimplePowerTemplate(7)); + tinsert(templates.class.WARLOCK[i][resourceSection].args, createSimplePowerTemplate(0)) + tinsert(templates.class.WARLOCK[i][resourceSection].args, createSimplePowerTemplate(7)) end -- Monk -tinsert(templates.class.MONK[1][resourceSection].args, createSimplePowerTemplate(3)); -tinsert(templates.class.MONK[2][resourceSection].args, createSimplePowerTemplate(0)); -tinsert(templates.class.MONK[3][resourceSection].args, createSimplePowerTemplate(3)); -tinsert(templates.class.MONK[3][resourceSection].args, createSimplePowerTemplate(12)); +tinsert(templates.class.MONK[1][resourceSection].args, createSimplePowerTemplate(3)) +tinsert(templates.class.MONK[2][resourceSection].args, createSimplePowerTemplate(0)) +tinsert(templates.class.MONK[3][resourceSection].args, createSimplePowerTemplate(3)) +tinsert(templates.class.MONK[3][resourceSection].args, createSimplePowerTemplate(12)) -- Druid for i = 1, 4 do @@ -4532,13 +4490,13 @@ for i = 1, 4 do tinsert(templates.class.DRUID[i][resourceSection].args, { title = L["Shapeshift Form"], icon = 132276, - triggers = {[1] = { trigger = { + triggers = { [1] = { trigger = { type = WeakAuras.GetTriggerCategoryFor("Stance/Form/Aura"), event = "Stance/Form/Aura", - }}} - }); + } } }, + }) end -for j, id in ipairs({5487, 768, 783, 114282, 1394966}) do +for j, id in ipairs({ 5487, 768, 783, 114282, 1394966 }) do local title, _, icon = GetSpellInfo(id) if title then for i = 1, 4 do @@ -4551,43 +4509,44 @@ for j, id in ipairs({5487, 768, 783, 114282, 1394966}) do type = WeakAuras.GetTriggerCategoryFor("Stance/Form/Aura"), event = "Stance/Form/Aura", use_form = true, - form = { single = j } - } - } - } - }); + form = { single = j }, + }, + }, + }, + }) end end end -- Astral Power -tinsert(templates.class.DRUID[1][resourceSection].args, createSimplePowerTemplate(8)); +tinsert(templates.class.DRUID[1][resourceSection].args, createSimplePowerTemplate(8)) for i = 1, 4 do - tinsert(templates.class.DRUID[i][resourceSection].args, createSimplePowerTemplate(0)); -- Mana - tinsert(templates.class.DRUID[i][resourceSection].args, createSimplePowerTemplate(1)); -- Rage - tinsert(templates.class.DRUID[i][resourceSection].args, createSimplePowerTemplate(3)); -- Energy - tinsert(templates.class.DRUID[i][resourceSection].args, createSimplePowerTemplate(4)); -- Combo Points + tinsert(templates.class.DRUID[i][resourceSection].args, createSimplePowerTemplate(0)) -- Mana + tinsert(templates.class.DRUID[i][resourceSection].args, createSimplePowerTemplate(1)) -- Rage + tinsert(templates.class.DRUID[i][resourceSection].args, createSimplePowerTemplate(3)) -- Energy + tinsert(templates.class.DRUID[i][resourceSection].args, createSimplePowerTemplate(4)) -- Combo Points end -- Efflorescence aka Mushroom -tinsert(templates.class.DRUID[4][3].args, {spell = 145205, type = "totem"}); +tinsert(templates.class.DRUID[4][3].args, { spell = 145205, type = "totem" }) -- Demon Hunter -tinsert(templates.class.DEMONHUNTER[1][resourceSection].args, createSimplePowerTemplate(17)); -tinsert(templates.class.DEMONHUNTER[2][resourceSection].args, createSimplePowerTemplate(17)); +tinsert(templates.class.DEMONHUNTER[1][resourceSection].args, createSimplePowerTemplate(17)) +tinsert(templates.class.DEMONHUNTER[2][resourceSection].args, createSimplePowerTemplate(17)) -- Death Knight for i = 1, 3 do - tinsert(templates.class.DEATHKNIGHT[i][resourceSection].args, createSimplePowerTemplate(6)); + tinsert(templates.class.DEATHKNIGHT[i][resourceSection].args, createSimplePowerTemplate(6)) tinsert(templates.class.DEATHKNIGHT[i][resourceSection].args, { title = L["Runes"], icon = "Interface\\Icons\\spell_deathknight_frozenruneweapon", - triggers = {[1] = { trigger = { + triggers = { [1] = { trigger = { type = WeakAuras.GetTriggerCategoryFor("Death Knight Rune"), - event = "Death Knight Rune"}}} - }); + event = "Death Knight Rune", + } } }, + }) end --------------------------- @@ -4599,322 +4558,321 @@ local covenants = { icon = 3257748, args = { -- General Ability - { spell = 324739, type = "ability"}, -- Summon Steward + { spell = 324739, type = "ability" }, -- Summon Steward -- Soul Binds -- Pelgagos - { spell = 328908, type = "buff", unit = "player"}, -- Combat Meditation - { spell = 330896, type = "buff", unit = "player"}, -- Road of Trials - { spell = 330749, type = "buff", unit = "player"}, -- Phial of Patience - { spell = 328900, type = "buff", unit = "player"}, -- Let Go of the Past - { spell = 352498, type = "buff", unit = "player"}, -- Better Together - { spell = 352875, type = "buff", unit = "player"}, -- Path of the Devoted - { spell = 352917, type = "buff", unit = "player"}, -- Newfound Resolve + { spell = 328908, type = "buff", unit = "player" }, -- Combat Meditation + { spell = 330896, type = "buff", unit = "player" }, -- Road of Trials + { spell = 330749, type = "buff", unit = "player" }, -- Phial of Patience + { spell = 328900, type = "buff", unit = "player" }, -- Let Go of the Past + { spell = 352498, type = "buff", unit = "player" }, -- Better Together + { spell = 352875, type = "buff", unit = "player" }, -- Path of the Devoted + { spell = 352917, type = "buff", unit = "player" }, -- Newfound Resolve -- Kleia - { spell = 331449, type = "buff", unit = "player"}, -- Valiant Strikes - { spell = 334067, type = "buff", unit = "player"}, -- Mentorship - { spell = 330752, type = "buff", unit = "player"}, -- Ascendant Phial - { spell = 330927, type = "buff", unit = "player"}, -- Cleansing Rites - { spell = 328925, type = "buff", unit = "player"}, -- Ever Forward - { spell = 321759, type = "debuff", unit = "target"}, -- Bearer's Pursuit - { spell = 330511, type = "buff", unit = "player"}, -- Pointed Courage - { spell = 330859, type = "buff", unit = "player"}, -- Resonant Accolades - { spell = 352720, type = "buff", unit = "player"}, -- Spear of the Archon - { spell = 353192, type = "buff", unit = "player"}, -- Hope Springs Eternal - { spell = 352981, type = "buff", unit = "player"}, -- Light the Path + { spell = 331449, type = "buff", unit = "player" }, -- Valiant Strikes + { spell = 334067, type = "buff", unit = "player" }, -- Mentorship + { spell = 330752, type = "buff", unit = "player" }, -- Ascendant Phial + { spell = 330927, type = "buff", unit = "player" }, -- Cleansing Rites + { spell = 328925, type = "buff", unit = "player" }, -- Ever Forward + { spell = 321759, type = "debuff", unit = "target" }, -- Bearer's Pursuit + { spell = 330511, type = "buff", unit = "player" }, -- Pointed Courage + { spell = 330859, type = "buff", unit = "player" }, -- Resonant Accolades + { spell = 352720, type = "buff", unit = "player" }, -- Spear of the Archon + { spell = 353192, type = "buff", unit = "player" }, -- Hope Springs Eternal + { spell = 352981, type = "buff", unit = "player" }, -- Light the Path -- Forgelite Prime Mikanikos - { spell = 332514, type = "buff", unit = "player"}, -- Bron's Call to Action - { spell = 337697, type = "buff", unit = "player"}, -- Resilient Plumage - { spell = 332505, type = "buff", unit = "player"}, -- Soulsteel Clamps - { spell = 333943, type = "buff", unit = "player"}, -- Hammer of Genesis - { spell = 332423, type = "debuff", unit = "target"}, -- Sparkling Driftglobe Core - { spell = 352938, type = "buff", unit = "player", titleSuffix = L["Buff"]}, -- Soulglow Spectrometer - { spell = 352939, type = "debuff", unit = "target", titleSuffix = L["Debuff"]}, -- Soulglow Spectrometer - { spell = 352789, type = "buff", unit = "player"}, -- Reactive Retrofitting + { spell = 332514, type = "buff", unit = "player" }, -- Bron's Call to Action + { spell = 337697, type = "buff", unit = "player" }, -- Resilient Plumage + { spell = 332505, type = "buff", unit = "player" }, -- Soulsteel Clamps + { spell = 333943, type = "buff", unit = "player" }, -- Hammer of Genesis + { spell = 332423, type = "debuff", unit = "target" }, -- Sparkling Driftglobe Core + { spell = 352938, type = "buff", unit = "player", titleSuffix = L["Buff"] }, -- Soulglow Spectrometer + { spell = 352939, type = "debuff", unit = "target", titleSuffix = L["Debuff"] }, -- Soulglow Spectrometer + { spell = 352789, type = "buff", unit = "player" }, -- Reactive Retrofitting -- WARRIOR - { spell = 307865, type = "ability", debuff = true, titleSuffix = L["Cooldown"], class = "WARRIOR"}, -- Spear of Bastion - { spell = 307871, type = "debuff", unit = "target", titleSuffix = L["Debuff"], class = "WARRIOR"}, -- Spear of Bastion + { spell = 307865, type = "ability", debuff = true, titleSuffix = L["Cooldown"], class = "WARRIOR" }, -- Spear of Bastion + { spell = 307871, type = "debuff", unit = "target", titleSuffix = L["Debuff"], class = "WARRIOR" }, -- Spear of Bastion -- PALADIN - { spell = 304971, type = "ability", class = "PALADIN"}, -- Divine Toll + { spell = 304971, type = "ability", class = "PALADIN" }, -- Divine Toll -- HUNTER - { spell = 308491, type = "ability", titleSuffix = L["Cooldown"], class = "HUNTER"}, -- Resonating Arrow - { spell = 308498, type = "debuff", unit = "target", titleSuffix = L["Debuff"], class = "HUNTER"}, -- Resonating Arrow + { spell = 308491, type = "ability", titleSuffix = L["Cooldown"], class = "HUNTER" }, -- Resonating Arrow + { spell = 308498, type = "debuff", unit = "target", titleSuffix = L["Debuff"], class = "HUNTER" }, -- Resonating Arrow -- ROGUE - { spell = 323547, type = "ability", buff = true, titleSuffix = L["Cooldown"], class = "ROGUE"}, -- Echoing Reprimand - { spell = 323560, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "ROGUE"}, -- Echoing Reprimand + { spell = 323547, type = "ability", buff = true, titleSuffix = L["Cooldown"], class = "ROGUE" }, -- Echoing Reprimand + { spell = 323560, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "ROGUE" }, -- Echoing Reprimand -- PRIEST - { spell = 325013, type = "ability", buff = true, titleSuffix = L["Cooldown"], class = "PRIEST"}, -- Boon of the Ascended - { spell = 325013, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "PRIEST"}, -- Boon of the Ascended + { spell = 325013, type = "ability", buff = true, titleSuffix = L["Cooldown"], class = "PRIEST" }, -- Boon of the Ascended + { spell = 325013, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "PRIEST" }, -- Boon of the Ascended -- SHAMAN - { spell = 324386, type = "ability", totem = true, titleSuffix = L["Cooldown"], class = "SHAMAN"}, -- Vesper Totem - { spell = 324386, type = "totem", titleSuffix = L["Totem"], class = "SHAMAN"}, -- Vesper Totem + { spell = 324386, type = "ability", totem = true, titleSuffix = L["Cooldown"], class = "SHAMAN" }, -- Vesper Totem + { spell = 324386, type = "totem", titleSuffix = L["Totem"], class = "SHAMAN" }, -- Vesper Totem -- MAGE - { spell = 307443, type = "ability", titleSuffix = L["Cooldown"], class = "MAGE"}, -- Radiant Spark - { spell = 307443, type = "debuff", unit = "target", titleSuffix = L["Debuff"], class = "MAGE"}, -- Radiant Spark + { spell = 307443, type = "ability", titleSuffix = L["Cooldown"], class = "MAGE" }, -- Radiant Spark + { spell = 307443, type = "debuff", unit = "target", titleSuffix = L["Debuff"], class = "MAGE" }, -- Radiant Spark -- WARLOCK - { spell = 312321, type = "ability", debuff = true, titleSuffix = L["Cooldown"], class = "WARLOCK"}, -- Scouring Tithe - { spell = 312321, type = "debuff", unit = "target", titleSuffix = L["Debuff"], class = "WARLOCK"}, -- Scouring Tithe + { spell = 312321, type = "ability", debuff = true, titleSuffix = L["Cooldown"], class = "WARLOCK" }, -- Scouring Tithe + { spell = 312321, type = "debuff", unit = "target", titleSuffix = L["Debuff"], class = "WARLOCK" }, -- Scouring Tithe -- MONK - { spell = 310454, type = "ability", buff = true, titleSuffix = L["Cooldown"], class = "MONK"}, -- Weapons of Order - { spell = 310454, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "MONK"}, -- Weapons of Order + { spell = 310454, type = "ability", buff = true, titleSuffix = L["Cooldown"], class = "MONK" }, -- Weapons of Order + { spell = 310454, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "MONK" }, -- Weapons of Order -- DRUID - { spell = 326434, type = "ability", buff = true, titleSuffix = L["Cooldown"], class = "DRUID"}, -- Kindred Spirits - { spell = 326967, type = "buff", unit = "player", titleSuffix = L["Bonded Buff"], class = "DRUID"}, -- Kindred Spirits - { spell = 327139, type = "buff", unit = "player", titleSuffix = L["Empowered Buff"], class = "DRUID"}, -- Kindred Spirits + { spell = 326434, type = "ability", buff = true, titleSuffix = L["Cooldown"], class = "DRUID" }, -- Kindred Spirits + { spell = 326967, type = "buff", unit = "player", titleSuffix = L["Bonded Buff"], class = "DRUID" }, -- Kindred Spirits + { spell = 327139, type = "buff", unit = "player", titleSuffix = L["Empowered Buff"], class = "DRUID" }, -- Kindred Spirits -- DEMONHUNTER - { spell = 306830, type = "ability", class = "DEMONHUNTER"}, -- Elysian Decree + { spell = 306830, type = "ability", class = "DEMONHUNTER" }, -- Elysian Decree -- DEATHKNIGHT - { spell = 312202, type = "ability", debuff = true, titleSuffix = L["Cooldown"], class = "DEATHKNIGHT"}, -- Shackle the Unworthy - { spell = 312202, type = "debuff", unit = "target", titleSuffix = L["Debuff"], class = "DEATHKNIGHT"}, -- Shackle the Unworthy - } + { spell = 312202, type = "ability", debuff = true, titleSuffix = L["Cooldown"], class = "DEATHKNIGHT" }, -- Shackle the Unworthy + { spell = 312202, type = "debuff", unit = "target", titleSuffix = L["Debuff"], class = "DEATHKNIGHT" }, -- Shackle the Unworthy + }, }, [5] = { -- Venthyr title = C_Covenants.GetCovenantData(2).name, icon = 3257751, args = { -- General Ability - { spell = 300728, type = "ability"}, -- Door of Shadows + { spell = 300728, type = "ability" }, -- Door of Shadows -- Soul Binds -- Nadjia the Mistblade - { spell = 331939, type = "buff", unit = "player"}, -- Thrillseeker - { spell = 331937, type = "buff", unit = "player"}, -- Euphoria - { spell = 338836, type = "debuff", unit = "target"}, -- Agent of Chaos - { spell = 331868, type = "buff", unit = "player"}, -- Fancy Footwork - { spell = 331934, type = "debuff", unit = "target"}, -- Adversary - { spell = 352882, type = "buff", unit = "player"}, -- Sinful Preservation - { spell = 354050, type = "debuff", unit = "target", titleSuffix = L["Slow"], exactSpellId = true}, -- Nimble Steps - { spell = 354051, type = "debuff", unit = "target", titleSuffix = L["Root"], exactSpellId = true}, -- Nimble Steps - { spell = 354054, type = "buff", unit = "player"}, -- Fatal Flaw + { spell = 331939, type = "buff", unit = "player" }, -- Thrillseeker + { spell = 331937, type = "buff", unit = "player" }, -- Euphoria + { spell = 338836, type = "debuff", unit = "target" }, -- Agent of Chaos + { spell = 331868, type = "buff", unit = "player" }, -- Fancy Footwork + { spell = 331934, type = "debuff", unit = "target" }, -- Adversary + { spell = 352882, type = "buff", unit = "player" }, -- Sinful Preservation + { spell = 354050, type = "debuff", unit = "target", titleSuffix = L["Slow"], exactSpellId = true }, -- Nimble Steps + { spell = 354051, type = "debuff", unit = "target", titleSuffix = L["Root"], exactSpellId = true }, -- Nimble Steps + { spell = 354054, type = "buff", unit = "player" }, -- Fatal Flaw -- Theotar the Mad Duke - { spell = 336885, type = "buff", unit = "player"}, -- Soothing Shade - { spell = 337470, type = "buff", unit = "target"}, -- Token of Appreciation - { spell = 333218, type = "buff", unit = "player"}, -- Wasteland Propriety - { spell = 353334, type = "buff", unit = "player"}, -- It's Always Tea Time - { spell = 353365, type = "buff", unit = "player"}, -- Life is but an Appetizer - { spell = 353266, type = "buff", unit = "player"}, -- The Mad Duke's Tea + { spell = 336885, type = "buff", unit = "player" }, -- Soothing Shade + { spell = 337470, type = "buff", unit = "target" }, -- Token of Appreciation + { spell = 333218, type = "buff", unit = "player" }, -- Wasteland Propriety + { spell = 353334, type = "buff", unit = "player" }, -- It's Always Tea Time + { spell = 353365, type = "buff", unit = "player" }, -- Life is but an Appetizer + { spell = 353266, type = "buff", unit = "player" }, -- The Mad Duke's Tea -- General Draven - { spell = 333104, type = "buff", unit = "player"}, -- Move As One - { spell = 321012, type = "buff", unit = "player"}, -- Enduring Gloom - { spell = 333089, type = "buff", unit = "player"}, -- Hold Your Ground - { spell = 332922, type = "buff", unit = "player"}, -- Superior Tactics - { spell = 332842, type = "buff", unit = "player"}, -- Built for War - { spell = 352802, type = "buff", unit = "player"}, -- Regenerative Stone Skin - { spell = 353211, type = "buff", unit = "player"}, -- Intimidation Tactics - { spell = 352858, type = "buff", unit = "player"}, -- Battlefield Presence + { spell = 333104, type = "buff", unit = "player" }, -- Move As One + { spell = 321012, type = "buff", unit = "player" }, -- Enduring Gloom + { spell = 333089, type = "buff", unit = "player" }, -- Hold Your Ground + { spell = 332922, type = "buff", unit = "player" }, -- Superior Tactics + { spell = 332842, type = "buff", unit = "player" }, -- Built for War + { spell = 352802, type = "buff", unit = "player" }, -- Regenerative Stone Skin + { spell = 353211, type = "buff", unit = "player" }, -- Intimidation Tactics + { spell = 352858, type = "buff", unit = "player" }, -- Battlefield Presence -- WARRIOR - { spell = 317320, type = "ability", titleSuffix = L["Ability"], class = "WARRIOR"}, -- Condemn - { spell = 317491, type = "debuff", unit = "target", titleSuffix = L["Debuff"], class = "WARRIOR"}, -- Condemned + { spell = 317320, type = "ability", titleSuffix = L["Ability"], class = "WARRIOR" }, -- Condemn + { spell = 317491, type = "debuff", unit = "target", titleSuffix = L["Debuff"], class = "WARRIOR" }, -- Condemned -- PALADIN - { spell = 316958, type = "ability", class = "PALADIN"}, -- Ashen Hallow + { spell = 316958, type = "ability", class = "PALADIN" }, -- Ashen Hallow -- HUNTER - { spell = 324149, type = "ability", titleSuffix = L["Cooldown"], class = "HUNTER"}, -- Flayed Shot - { spell = 324149, type = "debuff", unit = "target", titleSuffix = L["Debuff"], class = "HUNTER"}, -- Flayed Shot - { spell = 324156, type = "buff", unit = "player", class = "HUNTER"}, -- Flayed Shot + { spell = 324149, type = "ability", titleSuffix = L["Cooldown"], class = "HUNTER" }, -- Flayed Shot + { spell = 324149, type = "debuff", unit = "target", titleSuffix = L["Debuff"], class = "HUNTER" }, -- Flayed Shot + { spell = 324156, type = "buff", unit = "player", class = "HUNTER" }, -- Flayed Shot -- ROGUE - { spell = 323654, type = "ability", buff = true, titleSuffix = L["Cooldown"], class = "ROGUE"}, -- Flagellation - { spell = 323654, type = "debuff", unit = "target", titleSuffix = L["Debuff"], class = "ROGUE"}, -- Flagellation - { spell = 323654, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "ROGUE"}, -- Flagellation + { spell = 323654, type = "ability", buff = true, titleSuffix = L["Cooldown"], class = "ROGUE" }, -- Flagellation + { spell = 323654, type = "debuff", unit = "target", titleSuffix = L["Debuff"], class = "ROGUE" }, -- Flagellation + { spell = 323654, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "ROGUE" }, -- Flagellation -- PRIEST - { spell = 323673, type = "ability", buff = true, titleSuffix = L["Cooldown"], class = "PRIEST"}, -- Mindgames - { spell = 323673, type = "debuff", unit = "target", titleSuffix = L["Debuff"], class = "PRIEST"}, -- Mindgames + { spell = 323673, type = "ability", buff = true, titleSuffix = L["Cooldown"], class = "PRIEST" }, -- Mindgames + { spell = 323673, type = "debuff", unit = "target", titleSuffix = L["Debuff"], class = "PRIEST" }, -- Mindgames -- SHAMAN - { spell = 320674, type = "ability", class = "SHAMAN"}, -- Chain Harvest + { spell = 320674, type = "ability", class = "SHAMAN" }, -- Chain Harvest -- MAGE - { spell = 314793, type = "ability", titleSuffix = L["Cooldown"], class = "MAGE"}, -- Mirrors of Torment - { spell = 314793, type = "debuff", unit = "target", titleSuffix = L[" Debuff"], class = "MAGE"}, -- Mirrors of Torment - { spell = 320035, type = "debuff", unit = "target", titleSuffix = L["Slow"], class = "MAGE"}, -- Mirrors of Torment + { spell = 314793, type = "ability", titleSuffix = L["Cooldown"], class = "MAGE" }, -- Mirrors of Torment + { spell = 314793, type = "debuff", unit = "target", titleSuffix = L[" Debuff"], class = "MAGE" }, -- Mirrors of Torment + { spell = 320035, type = "debuff", unit = "target", titleSuffix = L["Slow"], class = "MAGE" }, -- Mirrors of Torment -- WARLOCK - { spell = 321792, type = "ability", debuff = true, titleSuffix = L["Cooldown"], class = "WARLOCK"}, -- Impending Catastrophe - { spell = 322170, type = "debuff", unit = "target", titleSuffix = L["Debuff"], class = "WARLOCK"}, -- Impending Catastrophe + { spell = 321792, type = "ability", debuff = true, titleSuffix = L["Cooldown"], class = "WARLOCK" }, -- Impending Catastrophe + { spell = 322170, type = "debuff", unit = "target", titleSuffix = L["Debuff"], class = "WARLOCK" }, -- Impending Catastrophe -- MONK - { spell = 326860, type = "ability", buff = true, titleSuffix = L["Cooldown"], class = "MONK"}, -- Fallen Order - { spell = 326860, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "MONK"}, -- Fallen Order + { spell = 326860, type = "ability", buff = true, titleSuffix = L["Cooldown"], class = "MONK" }, -- Fallen Order + { spell = 326860, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "MONK" }, -- Fallen Order -- DRUID - { spell = 323546, type = "ability", buff = true, titleSuffix = L["Cooldown"], class = "DRUID"}, -- Ravenous Frenzy - { spell = 323546, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "DRUID"}, -- Ravenous Frenzy - { spell = 323557, type = "debuff", unit = "player", titleSuffix = L["Stun Debuff"], class = "DRUID"}, -- Ravenous Frenzy + { spell = 323546, type = "ability", buff = true, titleSuffix = L["Cooldown"], class = "DRUID" }, -- Ravenous Frenzy + { spell = 323546, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "DRUID" }, -- Ravenous Frenzy + { spell = 323557, type = "debuff", unit = "player", titleSuffix = L["Stun Debuff"], class = "DRUID" }, -- Ravenous Frenzy -- DEMONHUNTER - { spell = 317009, type = "ability", debuff = true, titleSuffix = L["Cooldown"], class = "DEMONHUNTER"}, -- Sinful Brand - { spell = 317009, type = "debuff", unit = "target", titleSuffix = L["Debuff"], class = "DEMONHUNTER"}, -- Sinful Brand + { spell = 317009, type = "ability", debuff = true, titleSuffix = L["Cooldown"], class = "DEMONHUNTER" }, -- Sinful Brand + { spell = 317009, type = "debuff", unit = "target", titleSuffix = L["Debuff"], class = "DEMONHUNTER" }, -- Sinful Brand -- DEATHKNIGHT - { spell = 311648, type = "ability", buff = true, titleSuffix = L["Cooldown"], class = "DEATHKNIGHT"}, -- Swarming Mist - { spell = 311648, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "DEATHKNIGHT"}, -- Swarming Mist - } + { spell = 311648, type = "ability", buff = true, titleSuffix = L["Cooldown"], class = "DEATHKNIGHT" }, -- Swarming Mist + { spell = 311648, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "DEATHKNIGHT" }, -- Swarming Mist + }, }, [6] = { -- Night Fae title = C_Covenants.GetCovenantData(3).name, icon = 3257750, args = { -- General Ability - { spell = 310143, type = "ability", buff = true, titleSuffix = L["Cooldown"]}, -- Soulshape - { spell = 310143, type = "buff", unit = "player", titleSuffix = L["Buff"]}, -- Soulshape + { spell = 310143, type = "ability", buff = true, titleSuffix = L["Cooldown"] }, -- Soulshape + { spell = 310143, type = "buff", unit = "player", titleSuffix = L["Buff"] }, -- Soulshape -- Soul Binds -- Niya - { spell = 342814, type = "buff", unit = "player"}, -- Grove Invigoration - { spell = 321527, type = "buff", unit = "player"}, -- Swift Patrol - { spell = 333526, type = "debuff", unit = "target"}, -- Niya's Tools: Burrs - { spell = 321519, type = "debuff", unit = "target"}, -- Niya's Tools: Poison - { spell = 321510, type = "buff", unit = "player"}, -- Niya's Tools: Herbs - { spell = 352865, type = "buff", unit = "player"}, -- Called Shot - { spell = 352857, type = "buff", unit = "player"}, -- Survivor's Rally - { spell = 352881, type = "buff", unit = "player"}, -- Bonded Hearts + { spell = 342814, type = "buff", unit = "player" }, -- Grove Invigoration + { spell = 321527, type = "buff", unit = "player" }, -- Swift Patrol + { spell = 333526, type = "debuff", unit = "target" }, -- Niya's Tools: Burrs + { spell = 321519, type = "debuff", unit = "target" }, -- Niya's Tools: Poison + { spell = 321510, type = "buff", unit = "player" }, -- Niya's Tools: Herbs + { spell = 352865, type = "buff", unit = "player" }, -- Called Shot + { spell = 352857, type = "buff", unit = "player" }, -- Survivor's Rally + { spell = 352881, type = "buff", unit = "player" }, -- Bonded Hearts -- Dreamweaver - { spell = 320224, type = "buff", unit = "player"}, -- Podtender - { spell = 320267, type = "buff", unit = "player"}, -- Soothing Voice - { spell = 320212, type = "buff", unit = "player"}, -- Social Butterfly - { spell = 320009, type = "buff", unit = "player"}, -- Empowered Chrysalis - { spell = 319970, type = "buff", unit = "player"}, -- Faerie Dust - { spell = 320235, type = "buff", unit = "player"}, -- Somnambulist - { spell = 342774, type = "buff", unit = "player"}, -- Field of Blossoms + { spell = 320224, type = "buff", unit = "player" }, -- Podtender + { spell = 320267, type = "buff", unit = "player" }, -- Soothing Voice + { spell = 320212, type = "buff", unit = "player" }, -- Social Butterfly + { spell = 320009, type = "buff", unit = "player" }, -- Empowered Chrysalis + { spell = 319970, type = "buff", unit = "player" }, -- Faerie Dust + { spell = 320235, type = "buff", unit = "player" }, -- Somnambulist + { spell = 342774, type = "buff", unit = "player" }, -- Field of Blossoms - { spell = 353472, type = "debuff", unit = "target"}, -- Cunning Dreams - { spell = 353477, type = "buff", unit = "player"}, -- Waking Dreams - { spell = 353353, type = "buff", unit = "target", titleSuffix = L["Debuff"]}, -- Dream Delver - { spell = 353354, type = "debuff", unit = "target", titleSuffix = L["Buff"]}, -- Dream Delver + { spell = 353472, type = "debuff", unit = "target" }, -- Cunning Dreams + { spell = 353477, type = "buff", unit = "player" }, -- Waking Dreams + { spell = 353353, type = "buff", unit = "target", titleSuffix = L["Debuff"] }, -- Dream Delver + { spell = 353354, type = "debuff", unit = "target", titleSuffix = L["Buff"] }, -- Dream Delver -- Korayn - { spell = 343594, type = "buff", unit = "player"}, -- Wild Hunt Tactics - { spell = 325268, type = "buff", unit = "player"}, -- Horn of the Wild Hunt - { spell = 325321, type = "debuff", unit = "target"}, -- Wild Hunt's Charge - { spell = 325443, type = "buff", unit = "player"}, -- Get In Formation - { spell = 325437, type = "debuff", unit = "target"}, -- Face Your Foes - { spell = 325381, type = "buff", unit = "player"}, -- First Strike - { spell = 325612, type = "buff", unit = "player"}, -- Hold the Line - - { spell = 353077, type = "debuff", unit = "target"}, -- Vorkai Ambush - { spell = 353203, type = "buff", unit = "player"}, -- Hunt's Exhilaration + { spell = 343594, type = "buff", unit = "player" }, -- Wild Hunt Tactics + { spell = 325268, type = "buff", unit = "player" }, -- Horn of the Wild Hunt + { spell = 325321, type = "debuff", unit = "target" }, -- Wild Hunt's Charge + { spell = 325443, type = "buff", unit = "player" }, -- Get In Formation + { spell = 325437, type = "debuff", unit = "target" }, -- Face Your Foes + { spell = 325381, type = "buff", unit = "player" }, -- First Strike + { spell = 325612, type = "buff", unit = "player" }, -- Hold the Line - { spell = 353286, type = "buff", unit = "player", titleSuffix = L["Initial Buff"], exactSpellId = true}, -- Wild Hunt Strategem - { spell = 353793, type = "buff", unit = "target", titleSuffix = L["Buff"], exactSpellId = true}, -- Wild Hunt Strategem - { spell = 353254, type = "debuff", unit = "target", titleSuffix = L["Debuff"]}, -- Wild Hunt Strategem + { spell = 353077, type = "debuff", unit = "target" }, -- Vorkai Ambush + { spell = 353203, type = "buff", unit = "player" }, -- Hunt's Exhilaration + { spell = 353286, type = "buff", unit = "player", titleSuffix = L["Initial Buff"], exactSpellId = true }, -- Wild Hunt Strategem + { spell = 353793, type = "buff", unit = "target", titleSuffix = L["Buff"], exactSpellId = true }, -- Wild Hunt Strategem + { spell = 353254, type = "debuff", unit = "target", titleSuffix = L["Debuff"] }, -- Wild Hunt Strategem -- WARRIOR - { spell = 325886, type = "ability", class = "WARRIOR"}, -- Ancient Aftershock + { spell = 325886, type = "ability", class = "WARRIOR" }, -- Ancient Aftershock -- PALADIN - { spell = 328620, type = "ability", titleSuffix = "Cooldown", class = "PALADIN"}, -- Blessing of Seasons - { spell = 328620, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "PALADIN"}, -- Blessing of Summer - { spell = 328622, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "PALADIN"}, -- Blessing of Autumn - { spell = 328281, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "PALADIN"}, -- Blessing of Winter - { spell = 328282, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "PALADIN"}, -- Blessing of Spring + { spell = 328620, type = "ability", titleSuffix = "Cooldown", class = "PALADIN" }, -- Blessing of Seasons + { spell = 328620, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "PALADIN" }, -- Blessing of Summer + { spell = 328622, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "PALADIN" }, -- Blessing of Autumn + { spell = 328281, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "PALADIN" }, -- Blessing of Winter + { spell = 328282, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "PALADIN" }, -- Blessing of Spring -- HUNTER - { spell = 328231, type = "ability", titleSuffix = L["Cooldown"], class = "HUNTER"}, -- Wild Spirits - { spell = 328275, type = "debuff", unit = "target", class = "HUNTER"}, -- Wild Mark + { spell = 328231, type = "ability", titleSuffix = L["Cooldown"], class = "HUNTER" }, -- Wild Spirits + { spell = 328275, type = "debuff", unit = "target", class = "HUNTER" }, -- Wild Mark -- ROGUE - { spell = 328305, type = "ability", buff = true, titleSuffix = L["Cooldown"], class = "ROGUE"}, -- Sepsis - { spell = 328305, type = "debuff", unit = "target", titleSuffix = L["Debuff"], class = "ROGUE"}, -- Sepsis - { spell = 347037, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "ROGUE"}, -- Sepsis + { spell = 328305, type = "ability", buff = true, titleSuffix = L["Cooldown"], class = "ROGUE" }, -- Sepsis + { spell = 328305, type = "debuff", unit = "target", titleSuffix = L["Debuff"], class = "ROGUE" }, -- Sepsis + { spell = 347037, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "ROGUE" }, -- Sepsis -- PRIEST - { spell = 327661, type = "ability", class = "PRIEST"}, -- Fae Guardians - { spell = 327694, type = "buff", unit = "target", class = "PRIEST"}, -- Fae Guardians - { spell = 327710, type = "buff", unit = "target", class = "PRIEST"}, -- Fae Guardians - { spell = 342132, type = "debuff", unit = "target", class = "PRIEST"}, -- Fae Guardians + { spell = 327661, type = "ability", class = "PRIEST" }, -- Fae Guardians + { spell = 327694, type = "buff", unit = "target", class = "PRIEST" }, -- Fae Guardians + { spell = 327710, type = "buff", unit = "target", class = "PRIEST" }, -- Fae Guardians + { spell = 342132, type = "debuff", unit = "target", class = "PRIEST" }, -- Fae Guardians -- SHAMAN - { spell = 328923, type = "ability", buff = true, titleSuffix = L["Cooldown"], class = "SHAMAN"}, -- Fae Transfusion - { spell = 328933, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "SHAMAN"}, -- Fae Transfusion + { spell = 328923, type = "ability", buff = true, titleSuffix = L["Cooldown"], class = "SHAMAN" }, -- Fae Transfusion + { spell = 328933, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "SHAMAN" }, -- Fae Transfusion -- MAGE - { spell = 314791, type = "ability", buff = true, titleSuffix = L["Cooldown"], class = "MAGE"}, -- Shifting Power - { spell = 314791, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "MAGE"}, -- Shifting Power + { spell = 314791, type = "ability", buff = true, titleSuffix = L["Cooldown"], class = "MAGE" }, -- Shifting Power + { spell = 314791, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "MAGE" }, -- Shifting Power -- WARLOCK - { spell = 325640, type = "ability", debuff = true, titleSuffix = L["Cooldown"], class = "WARLOCK"}, -- Soul Rot - { spell = 325640, type = "debuff", unit = "target", titleSuffix = L["Debuff"], class = "WARLOCK"}, -- Soul Rot + { spell = 325640, type = "ability", debuff = true, titleSuffix = L["Cooldown"], class = "WARLOCK" }, -- Soul Rot + { spell = 325640, type = "debuff", unit = "target", titleSuffix = L["Debuff"], class = "WARLOCK" }, -- Soul Rot -- MONK - { spell = 327104, type = "ability", buff = true, titleSuffix = L["Cooldown"], class = "MONK"}, -- Faeline Stomp - { spell = 327104, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "MONK"}, -- Faeline Stomp + { spell = 327104, type = "ability", buff = true, titleSuffix = L["Cooldown"], class = "MONK" }, -- Faeline Stomp + { spell = 327104, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "MONK" }, -- Faeline Stomp -- DRUID - { spell = 323764, type = "ability", buff = true, titleSuffix = L["Cooldown"], class = "DRUID"}, -- Convoke the Spirits - { spell = 323764, type = "buff", titleSuffix = L["Buff"], class = "DRUID"}, -- Convoke the Spirits + { spell = 323764, type = "ability", buff = true, titleSuffix = L["Cooldown"], class = "DRUID" }, -- Convoke the Spirits + { spell = 323764, type = "buff", titleSuffix = L["Buff"], class = "DRUID" }, -- Convoke the Spirits -- DEMONHUNTER - { spell = 323639, type = "ability", debuff = true, titleSuffix = L["Cooldown"], class = "DEMONHUNTER"}, -- The Hunt - { spell = 323802, type = "debuff", unit = "target", titleSuffix = L["Debuff"], class = "DEMONHUNTER"}, -- The Hunt + { spell = 323639, type = "ability", debuff = true, titleSuffix = L["Cooldown"], class = "DEMONHUNTER" }, -- The Hunt + { spell = 323802, type = "debuff", unit = "target", titleSuffix = L["Debuff"], class = "DEMONHUNTER" }, -- The Hunt -- DEATHKNIGHT - { spell = 324128, type = "ability", class = "DEATHKNIGHT"}, -- Death's Due - } + { spell = 324128, type = "ability", class = "DEATHKNIGHT" }, -- Death's Due + }, }, [7] = { -- Necrolord title = C_Covenants.GetCovenantData(4).name, icon = 3257749, args = { -- General Ability - { spell = 324631, type = "ability", buff = true, titleSuffix = L["Cooldown"]}, -- Fleshcraft - { spell = 324867, type = "buff", unit = "player", titleSuffix = L["Buff"]}, -- Fleshcraft + { spell = 324631, type = "ability", buff = true, titleSuffix = L["Cooldown"] }, -- Fleshcraft + { spell = 324867, type = "buff", unit = "player", titleSuffix = L["Buff"] }, -- Fleshcraft -- Plague Deviser Marileth - { spell = 323510, type = "buff", unit = "player"}, -- Volatile Solvent: Undead - { spell = 323491, type = "buff", unit = "player"}, -- Volatile Solvent: Humanoid - { spell = 323500, type = "buff", unit = "player"}, -- Volatile Solvent: Demon - { spell = 323506, type = "buff", unit = "player"}, -- Volatile Solvent: Giant - { spell = 323497, type = "buff", unit = "player"}, -- Volatile Solvent: Aberration - { spell = 323502, type = "buff", unit = "player"}, -- Volatile Solvent: Dragonkin - { spell = 323504, type = "buff", unit = "player"}, -- Volatile Solvent: Elemental - { spell = 323507, type = "buff", unit = "player"}, -- Volatile Solvent: Mechanical - { spell = 323498, type = "buff", unit = "player"}, -- Volatile Solvent: Beast - { spell = 323385, type = "buff", unit = "player"}, -- Ooz's Frictionless Coating - { spell = 323396, type = "buff", unit = "player"}, -- Bloop's Wanderlust - { spell = 323416, type = "debuff", unit = "target"}, -- Plaguey's Preemptive Strike - { spell = 323524, type = "buff", unit = "player"}, -- Ultimate Form - { spell = 352561, type = "debuff", unit = "player"}, -- Undulating Maneuvers + { spell = 323510, type = "buff", unit = "player" }, -- Volatile Solvent: Undead + { spell = 323491, type = "buff", unit = "player" }, -- Volatile Solvent: Humanoid + { spell = 323500, type = "buff", unit = "player" }, -- Volatile Solvent: Demon + { spell = 323506, type = "buff", unit = "player" }, -- Volatile Solvent: Giant + { spell = 323497, type = "buff", unit = "player" }, -- Volatile Solvent: Aberration + { spell = 323502, type = "buff", unit = "player" }, -- Volatile Solvent: Dragonkin + { spell = 323504, type = "buff", unit = "player" }, -- Volatile Solvent: Elemental + { spell = 323507, type = "buff", unit = "player" }, -- Volatile Solvent: Mechanical + { spell = 323498, type = "buff", unit = "player" }, -- Volatile Solvent: Beast + { spell = 323385, type = "buff", unit = "player" }, -- Ooz's Frictionless Coating + { spell = 323396, type = "buff", unit = "player" }, -- Bloop's Wanderlust + { spell = 323416, type = "debuff", unit = "target" }, -- Plaguey's Preemptive Strike + { spell = 323524, type = "buff", unit = "player" }, -- Ultimate Form + { spell = 352561, type = "debuff", unit = "player" }, -- Undulating Maneuvers -- Emeni - { spell = 328210, type = "buff", unit = "player"}, -- Emeni's Magnificent Skin - { spell = 324523, type = "buff", unit = "player"}, -- Cartilaginous Legs - { spell = 324463, type = "buff", unit = "player"}, -- Gristled Toes - { spell = 324242, type = "buff", unit = "player"}, -- Gnashing Chompers - { spell = 324263, type = "debuff", unit = "target"}, -- Sulfuric Emission - { spell = 351913, type = "buff", unit = "player", exactSpellId = true, titleSuffix = L["Preparation"]}, -- Sole Slough - { spell = 351915, type = "buff", unit = "player", exactSpellId = true, titleSuffix = L["Sprint"]}, -- Sole Slough - { spell = 351921, type = "buff", unit = "player"}, -- Resilient Stitching + { spell = 328210, type = "buff", unit = "player" }, -- Emeni's Magnificent Skin + { spell = 324523, type = "buff", unit = "player" }, -- Cartilaginous Legs + { spell = 324463, type = "buff", unit = "player" }, -- Gristled Toes + { spell = 324242, type = "buff", unit = "player" }, -- Gnashing Chompers + { spell = 324263, type = "debuff", unit = "target" }, -- Sulfuric Emission + { spell = 351913, type = "buff", unit = "player", exactSpellId = true, titleSuffix = L["Preparation"] }, -- Sole Slough + { spell = 351915, type = "buff", unit = "player", exactSpellId = true, titleSuffix = L["Sprint"] }, -- Sole Slough + { spell = 351921, type = "buff", unit = "player" }, -- Resilient Stitching -- Bonesmith Heirmir - { spell = 327140, type = "buff", unit = "player"}, -- Forgeborne Reveries - { spell = 326939, type = "debuff", unit = "target"}, -- Serrated Spaulders - { spell = 327852, type = "buff", unit = "player"}, -- Runeforged Spurs - { spell = 327159, type = "buff", unit = "player"}, -- Heirmir's Arsenal: Gorestompers - { spell = 327066, type = "buff", unit = "player"}, -- Marrowed Gemstone Charging - { spell = 327069, type = "buff", unit = "player"}, -- Marrowed Gemstone Enhancement - { spell = 326946, type = "buff", unit = "player"}, -- Heirmir's Arsenal: Ravenous Pendant - { spell = 351414, type = "buff", unit = "player"}, -- Carver's Eye - { spell = 351433, type = "buff", unit = "player"}, -- Waking Bone Breastplate + { spell = 327140, type = "buff", unit = "player" }, -- Forgeborne Reveries + { spell = 326939, type = "debuff", unit = "target" }, -- Serrated Spaulders + { spell = 327852, type = "buff", unit = "player" }, -- Runeforged Spurs + { spell = 327159, type = "buff", unit = "player" }, -- Heirmir's Arsenal: Gorestompers + { spell = 327066, type = "buff", unit = "player" }, -- Marrowed Gemstone Charging + { spell = 327069, type = "buff", unit = "player" }, -- Marrowed Gemstone Enhancement + { spell = 326946, type = "buff", unit = "player" }, -- Heirmir's Arsenal: Ravenous Pendant + { spell = 351414, type = "buff", unit = "player" }, -- Carver's Eye + { spell = 351433, type = "buff", unit = "player" }, -- Waking Bone Breastplate -- WARRIOR - { spell = 324143, type = "ability", class = "WARRIOR"}, -- Conqueror's Banner - { spell = 343672, type = "buff", unit = "player", class = "WARRIOR"}, -- Conqueror's Frenzy - { spell = 325787, type = "buff", unit = "player", class = "WARRIOR"}, -- Glory + { spell = 324143, type = "ability", class = "WARRIOR" }, -- Conqueror's Banner + { spell = 343672, type = "buff", unit = "player", class = "WARRIOR" }, -- Conqueror's Frenzy + { spell = 325787, type = "buff", unit = "player", class = "WARRIOR" }, -- Glory -- PALADIN - { spell = 328204, type = "ability", titleSuffix = L["Cooldown"], class = "PALADIN"}, -- Conqueror's Banner - { spell = 328204, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "PALADIN"}, -- Glory + { spell = 328204, type = "ability", titleSuffix = L["Cooldown"], class = "PALADIN" }, -- Conqueror's Banner + { spell = 328204, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "PALADIN" }, -- Glory -- HUNTER - { spell = 325028, type = "ability", titleSuffix = L["Cooldown"], class = "HUNTER"}, -- Death Chakram + { spell = 325028, type = "ability", titleSuffix = L["Cooldown"], class = "HUNTER" }, -- Death Chakram -- ROGUE - { spell = 328547, type = "ability", debuff = true, titleSuffix = L["Cooldown"], class = "ROGUE"}, -- Serrated Bone Spike - { spell = 324073, type = "debuff", unit = "target", titleSuffix = L["Debuff"], class = "ROGUE"}, -- Serrated Bone Spike + { spell = 328547, type = "ability", debuff = true, titleSuffix = L["Cooldown"], class = "ROGUE" }, -- Serrated Bone Spike + { spell = 324073, type = "debuff", unit = "target", titleSuffix = L["Debuff"], class = "ROGUE" }, -- Serrated Bone Spike -- PRIEST - { spell = 324724, type = "ability", debuff = true, class = "PRIEST"}, -- Unholy Nova - { spell = 325203, type = "debuff", unit = "target", class = "PRIEST"}, -- Unholy Nova + { spell = 324724, type = "ability", debuff = true, class = "PRIEST" }, -- Unholy Nova + { spell = 325203, type = "debuff", unit = "target", class = "PRIEST" }, -- Unholy Nova -- SHAMAN - { spell = 326059, type = "ability", buff = true, titleSuffix = L["Cooldown"], class = "SHAMAN"}, -- Primordial Wave - { spell = 327164, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "SHAMAN"}, -- Primordial Wave + { spell = 326059, type = "ability", buff = true, titleSuffix = L["Cooldown"], class = "SHAMAN" }, -- Primordial Wave + { spell = 327164, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "SHAMAN" }, -- Primordial Wave -- MAGE - { spell = 324220, type = "ability", buff = true, titleSuffix = L["Cooldown"], class = "MAGE"}, -- Shifting Power - { spell = 324220, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "MAGE"}, -- Deathborne + { spell = 324220, type = "ability", buff = true, titleSuffix = L["Cooldown"], class = "MAGE" }, -- Shifting Power + { spell = 324220, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "MAGE" }, -- Deathborne -- WARLOCK - { spell = 325289, type = "ability", buff = true, titleSuffix = L["Cooldown"], class = "WARLOCK"}, -- Decimating Bolt - { spell = 325299, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "WARLOCK"}, -- Decimating Bolt + { spell = 325289, type = "ability", buff = true, titleSuffix = L["Cooldown"], class = "WARLOCK" }, -- Decimating Bolt + { spell = 325299, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "WARLOCK" }, -- Decimating Bolt -- MONK - { spell = 325216, type = "ability", debuff = true, titleSuffix = L["Cooldown"], class = "MONK"}, -- Bonedust Brew - { spell = 325216, type = "debuff", unit = "target", titleSuffix = L["Debuff"], class = "MONK"}, -- Bonedust Brew + { spell = 325216, type = "ability", debuff = true, titleSuffix = L["Cooldown"], class = "MONK" }, -- Bonedust Brew + { spell = 325216, type = "debuff", unit = "target", titleSuffix = L["Debuff"], class = "MONK" }, -- Bonedust Brew -- DRUID - { spell = 325727, type = "ability", titleSuffix = L["Cooldown"], class = "DRUID"}, -- Adaptive Swarm - { spell = 325748, type = "buff", unit = "player", titleSuffix = L["Bonded Buff"], class = "DRUID"}, -- Adaptive Swarm - { spell = 325733, type = "debuff", unit = "target", titleSuffix = L["Debuff"], class = "DRUID"}, -- Adaptive Swarm + { spell = 325727, type = "ability", titleSuffix = L["Cooldown"], class = "DRUID" }, -- Adaptive Swarm + { spell = 325748, type = "buff", unit = "player", titleSuffix = L["Bonded Buff"], class = "DRUID" }, -- Adaptive Swarm + { spell = 325733, type = "debuff", unit = "target", titleSuffix = L["Debuff"], class = "DRUID" }, -- Adaptive Swarm -- DEMONHUNTER - { spell = 329554, type = "ability", titleSuffix = L["Cooldown"], class = "DEMONHUNTER"}, -- Fodder to the Flame - { spell = 347765, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "DEMONHUNTER"}, -- Fodder to the Flame + { spell = 329554, type = "ability", titleSuffix = L["Cooldown"], class = "DEMONHUNTER" }, -- Fodder to the Flame + { spell = 347765, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "DEMONHUNTER" }, -- Fodder to the Flame -- DEATHKNIGHT - { spell = 315443, type = "ability", buff = true, titleSuffix = L["Cooldown"], class = "DEATHKNIGHT"}, -- Abomination Limb - { spell = 315443, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "DEATHKNIGHT"}, -- Abomination Limb - } - } + { spell = 315443, type = "ability", buff = true, titleSuffix = L["Cooldown"], class = "DEATHKNIGHT" }, -- Abomination Limb + { spell = 315443, type = "buff", unit = "player", titleSuffix = L["Buff"], class = "DEATHKNIGHT" }, -- Abomination Limb + }, + }, } -- Add covenant load option @@ -4946,97 +4904,96 @@ end local conduits = { WARRIOR = { - { spell = 335234, type = "buff", unit = "player"}, -- Ashen Juggernaut - { spell = 346574, type = "buff", unit = "player"}, -- Merciless Bonegrinder - { spell = 339825, type = "buff", unit = "player"}, -- Show of Force + { spell = 335234, type = "buff", unit = "player" }, -- Ashen Juggernaut + { spell = 346574, type = "buff", unit = "player" }, -- Merciless Bonegrinder + { spell = 339825, type = "buff", unit = "player" }, -- Show of Force }, PALADIN = { - { spell = 340147, type = "buff", unit = "player"}, -- Royal Decree - { spell = 338788, type = "buff", unit = "player"}, -- Shielding Words - { spell = 341741, type = "buff", unit = "player"}, -- Enkindled Spirit - { spell = 344067, type = "debuff", unit = "target"}, -- Expurgation - { spell = 339376, type = "debuff", unit = "target"}, -- Truth's Wake - { spell = 339990, type = "buff", unit = "player"}, -- Untempered Dedication - { spell = 340007, type = "debuff", unit = "target"}, -- Vengeful Shock - { spell = 339664, type = "buff", unit = "player"}, -- Virtuous Command + { spell = 340147, type = "buff", unit = "player" }, -- Royal Decree + { spell = 338788, type = "buff", unit = "player" }, -- Shielding Words + { spell = 341741, type = "buff", unit = "player" }, -- Enkindled Spirit + { spell = 344067, type = "debuff", unit = "target" }, -- Expurgation + { spell = 339376, type = "debuff", unit = "target" }, -- Truth's Wake + { spell = 339990, type = "buff", unit = "player" }, -- Untempered Dedication + { spell = 340007, type = "debuff", unit = "target" }, -- Vengeful Shock + { spell = 339664, type = "buff", unit = "player" }, -- Virtuous Command }, HUNTER = { - { spell = 339654, type = "debuff", unit = "target"}, -- Vengeful Shock - { spell = 339400, type = "buff", unit = "player"}, -- Rejuvenating Wind - { spell = 339461, type = "buff", unit = "player"}, -- Resilience of the Hunter - { spell = 339929, type = "buff", unit = "player"}, -- Brutal Projectiles - { spell = 341401, type = "buff", unit = "player"}, -- Flame Infusion - { spell = 341223, type = "buff", unit = "player"}, -- Strength of the Pack + { spell = 339654, type = "debuff", unit = "target" }, -- Vengeful Shock + { spell = 339400, type = "buff", unit = "player" }, -- Rejuvenating Wind + { spell = 339461, type = "buff", unit = "player" }, -- Resilience of the Hunter + { spell = 339929, type = "buff", unit = "player" }, -- Brutal Projectiles + { spell = 341401, type = "buff", unit = "player" }, -- Flame Infusion + { spell = 341223, type = "buff", unit = "player" }, -- Strength of the Pack }, ROGUE = { - { spell = 341533, type = "buff", unit = "player"}, -- Fade to Nothing - { spell = 341530, type = "buff", unit = "player"}, -- Cloaked in Shadows - { spell = 341550, type = "buff", unit = "player"}, -- Deeper Daggers - { spell = 341572, type = "buff", unit = "player"}, -- Perforated Veins + { spell = 341533, type = "buff", unit = "player" }, -- Fade to Nothing + { spell = 341530, type = "buff", unit = "player" }, -- Cloaked in Shadows + { spell = 341550, type = "buff", unit = "player" }, -- Deeper Daggers + { spell = 341572, type = "buff", unit = "player" }, -- Perforated Veins }, PRIEST = { - { spell = 337956, type = "debuff", unit = "target"}, -- Mental Recover - { spell = 337716, type = "buff", unit = "player"}, -- Charitable Soul - { spell = 337749, type = "buff", unit = "player"}, -- Light's Inspiration - { spell = 337661, type = "buff", unit = "player"}, -- Translucent Image - { spell = 343144, type = "buff", unit = "player"}, -- Dissonant Echoes - { spell = 338333, type = "buff", unit = "player"}, -- Mind Devourer - { spell = 337948, type = "buff", unit = "player"}, -- Resonant Words + { spell = 337956, type = "debuff", unit = "target" }, -- Mental Recover + { spell = 337716, type = "buff", unit = "player" }, -- Charitable Soul + { spell = 337749, type = "buff", unit = "player" }, -- Light's Inspiration + { spell = 337661, type = "buff", unit = "player" }, -- Translucent Image + { spell = 343144, type = "buff", unit = "player" }, -- Dissonant Echoes + { spell = 338333, type = "buff", unit = "player" }, -- Mind Devourer + { spell = 337948, type = "buff", unit = "player" }, -- Resonant Words - { spell = 345452, type = "debuff", unit = "target", covenant = 3}, -- Wrathful Faerie Fermata - { spell = 345451, type = "buff", unit = "player", covenant = 3}, -- Guardian Faerie Fermata - { spell = 345453, type = "buff", unit = "player", covenant = 3}, -- Benevolent Faerie Fermata + { spell = 345452, type = "debuff", unit = "target", covenant = 3 }, -- Wrathful Faerie Fermata + { spell = 345451, type = "buff", unit = "player", covenant = 3 }, -- Guardian Faerie Fermata + { spell = 345453, type = "buff", unit = "player", covenant = 3 }, -- Benevolent Faerie Fermata }, SHAMAN = { - { spell = 338055, type = "debuff", unit = "target"}, -- Crippling Hex - { spell = 338036, type = "buff", unit = "player"}, -- Thunderous Paws - { spell = 337984, type = "buff", unit = "player"}, -- Vital Accretion - { spell = 338344, type = "buff", unit = "player"}, -- Heavy Rainfall - { spell = 338340, type = "buff", unit = "player"}, -- Swirling Currents + { spell = 338055, type = "debuff", unit = "target" }, -- Crippling Hex + { spell = 338036, type = "buff", unit = "player" }, -- Thunderous Paws + { spell = 337984, type = "buff", unit = "player" }, -- Vital Accretion + { spell = 338344, type = "buff", unit = "player" }, -- Heavy Rainfall + { spell = 338340, type = "buff", unit = "player" }, -- Swirling Currents }, MAGE = { - { spell = 337278, type = "buff", unit = "player"}, -- Incantation of Swiftness - { spell = 337299, type = "buff", unit = "player"}, -- Tempest Barrier - { spell = 336832, type = "buff", unit = "player"}, -- Infernal Cascade - { spell = 337090, type = "buff", unit = "player", covenant = 4}, -- Siphoned Malice + { spell = 337278, type = "buff", unit = "player" }, -- Incantation of Swiftness + { spell = 337299, type = "buff", unit = "player" }, -- Tempest Barrier + { spell = 336832, type = "buff", unit = "player" }, -- Infernal Cascade + { spell = 337090, type = "buff", unit = "player", covenant = 4 }, -- Siphoned Malice }, WARLOCK = { - { spell = 339412, type = "buff", unit = "player"}, -- Demonic Momentum - { spell = 339298, type = "buff", unit = "player"}, -- Accrued Vitality - { spell = 339784, type = "buff", unit = "player"}, -- Tyrant's Soul + { spell = 339412, type = "buff", unit = "player" }, -- Demonic Momentum + { spell = 339298, type = "buff", unit = "player" }, -- Accrued Vitality + { spell = 339784, type = "buff", unit = "player" }, -- Tyrant's Soul }, MONK = { - { spell = 336891, type = "debuff", unit = "target"}, -- Dizzying Tumble - { spell = 336887, type = "debuff", unit = "target"}, -- Lingering Numbness - { spell = 337079, type = "buff", unit = "player"}, -- Swift Transference - { spell = 336874, type = "buff", unit = "player"}, -- Fortifying Ingredients + { spell = 336891, type = "debuff", unit = "target" }, -- Dizzying Tumble + { spell = 336887, type = "debuff", unit = "target" }, -- Lingering Numbness + { spell = 337079, type = "buff", unit = "player" }, -- Swift Transference + { spell = 336874, type = "buff", unit = "player" }, -- Fortifying Ingredients }, DRUID = { - { spell = 341448, type = "buff", unit = "target"}, -- Born Anew - { spell = 340546, type = "buff", unit = "player"}, -- Tireless Pursuit - { spell = 340541, type = "buff", unit = "player"}, -- Ursine Vigor - { spell = 340613, type = "buff", unit = "player"}, -- Savage Combatant - { spell = 340698, type = "buff", unit = "player"}, -- Sudden Ambush + { spell = 341448, type = "buff", unit = "target" }, -- Born Anew + { spell = 340546, type = "buff", unit = "player" }, -- Tireless Pursuit + { spell = 340541, type = "buff", unit = "player" }, -- Ursine Vigor + { spell = 340613, type = "buff", unit = "player" }, -- Savage Combatant + { spell = 340698, type = "buff", unit = "player" }, -- Sudden Ambush }, DEMONHUNTER = { - { spell = 339051, type = "debuff", unit = "target"}, -- Demonic Parole - { spell = 338804, type = "buff", unit = "player"}, -- Felfire Haste - { spell = 339589, type = "debuff", unit = "target"}, -- Demon Muzzle - { spell = 339424, type = "buff", unit = "player"}, -- Soul Furnace + { spell = 339051, type = "debuff", unit = "target" }, -- Demonic Parole + { spell = 338804, type = "buff", unit = "player" }, -- Felfire Haste + { spell = 339589, type = "debuff", unit = "target" }, -- Demon Muzzle + { spell = 339424, type = "buff", unit = "player" }, -- Soul Furnace }, DEATHKNIGHT = { - { spell = 338093, type = "buff", unit = "player"}, -- Fleeting Wind - { spell = 338312, type = "debuff", unit = "target"}, -- Unending Grip - { spell = 338523, type = "debuff", unit = "target"}, -- Debilitating Malady - { spell = 337936, type = "buff", unit = "player"}, -- Eradicating Blow - { spell = 338501, type = "buff", unit = "player"}, -- Unleashed Frenzy + { spell = 338093, type = "buff", unit = "player" }, -- Fleeting Wind + { spell = 338312, type = "debuff", unit = "target" }, -- Unending Grip + { spell = 338523, type = "debuff", unit = "target" }, -- Debilitating Malady + { spell = 337936, type = "buff", unit = "player" }, -- Eradicating Blow + { spell = 338501, type = "buff", unit = "player" }, -- Unleashed Frenzy }, ALL = { - { spell = 357972, type = "buff", unit = "player"}, -- Adaptive Armor Fragment - } + { spell = 357972, type = "buff", unit = "player" }, -- Adaptive Armor Fragment + }, } - for class, classData in pairs(templates.class) do for spec, specData in ipairs(classData) do specData[8].title = L["Conduits"] @@ -5055,147 +5012,147 @@ end --- Legendaries -------------------------------------------- local generalLegendaries = { - { spell = 347458, type = "buff", unit = "player", bonusItemId = 7100}, -- Echo of Eonar - { spell = 339445, type = "buff", unit = "player", bonusItemId = 7102}, -- Norgannon's Sagacity - { spell = 339463, type = "buff", unit = "player", bonusItemId = 7103}, -- Sephuz's Proclamation - { spell = 339507, type = "buff", unit = "player", bonusItemId = 7104}, -- Stable Phantasma Lure - { spell = 339970, type = "buff", unit = "player", bonusItemId = 7105}, -- Third Eye of the Jailer - { spell = 338746, type = "buff", unit = "player", bonusItemId = 7106}, -- Vitality Sacrifice + { spell = 347458, type = "buff", unit = "player", bonusItemId = 7100 }, -- Echo of Eonar + { spell = 339445, type = "buff", unit = "player", bonusItemId = 7102 }, -- Norgannon's Sagacity + { spell = 339463, type = "buff", unit = "player", bonusItemId = 7103 }, -- Sephuz's Proclamation + { spell = 339507, type = "buff", unit = "player", bonusItemId = 7104 }, -- Stable Phantasma Lure + { spell = 339970, type = "buff", unit = "player", bonusItemId = 7105 }, -- Third Eye of the Jailer + { spell = 338746, type = "buff", unit = "player", bonusItemId = 7106 }, -- Vitality Sacrifice } local classLegendaries = { WARRIOR = { - { spell = 346369, type = "buff", unit = "player", bonusItemId = 6960}, -- Battlelord - { spell = 346369, type = "debuff", unit = "target", bonusItemId = 6961}, -- Exploiter - { spell = 335558, type = "buff", unit = "player", bonusItemId = 6963}, -- Cadence of Fujieda - { spell = 335597, type = "buff", unit = "player", bonusItemId = 6966}, -- Will of the Berserker - { spell = 335734, type = "buff", unit = "player", bonusItemId = 6969}, -- Reprisal - { spell = 311193, type = "buff", unit = "player", bonusItemId = 7730}, -- Elysian Might + { spell = 346369, type = "buff", unit = "player", bonusItemId = 6960 }, -- Battlelord + { spell = 346369, type = "debuff", unit = "target", bonusItemId = 6961 }, -- Exploiter + { spell = 335558, type = "buff", unit = "player", bonusItemId = 6963 }, -- Cadence of Fujieda + { spell = 335597, type = "buff", unit = "player", bonusItemId = 6966 }, -- Will of the Berserker + { spell = 335734, type = "buff", unit = "player", bonusItemId = 6969 }, -- Reprisal + { spell = 311193, type = "buff", unit = "player", bonusItemId = 7730 }, -- Elysian Might }, PALADIN = { - { spell = 337682, type = "buff", unit = "player", bonusItemId = 7056}, -- The Magistrate's Judgment - { spell = 337747, type = "buff", unit = "player", bonusItemId = 7055}, -- Blessing of Dawn - { spell = 337757, type = "buff", unit = "player", bonusItemId = 7055}, -- Blessing of Dusk - { spell = 340459, type = "buff", unit = "player", bonusItemId = 7128}, -- Maraad's Dying Breath - { spell = 337824, type = "buff", unit = "target", bonusItemId = 7059}, -- Shock Barrier - { spell = 337848, type = "buff", unit = "player", bonusItemId = 7062}, -- Bulwark of Righteous Fury - { spell = 337315, type = "buff", unit = "player", bonusItemId = 7066}, -- Relentless Inquisitor - { spell = 345046, type = "buff", unit = "player", bonusItemId = 7065}, -- Vanguard's Momentum - { spell = 355455, type = "buff", unit = "player", bonusItemId = 7679}, -- Divine Resonance - { spell = 355567, type = "buff", unit = "player", bonusItemId = 7702}, -- Equinox + { spell = 337682, type = "buff", unit = "player", bonusItemId = 7056 }, -- The Magistrate's Judgment + { spell = 337747, type = "buff", unit = "player", bonusItemId = 7055 }, -- Blessing of Dawn + { spell = 337757, type = "buff", unit = "player", bonusItemId = 7055 }, -- Blessing of Dusk + { spell = 340459, type = "buff", unit = "player", bonusItemId = 7128 }, -- Maraad's Dying Breath + { spell = 337824, type = "buff", unit = "target", bonusItemId = 7059 }, -- Shock Barrier + { spell = 337848, type = "buff", unit = "player", bonusItemId = 7062 }, -- Bulwark of Righteous Fury + { spell = 337315, type = "buff", unit = "player", bonusItemId = 7066 }, -- Relentless Inquisitor + { spell = 345046, type = "buff", unit = "player", bonusItemId = 7065 }, -- Vanguard's Momentum + { spell = 355455, type = "buff", unit = "player", bonusItemId = 7679 }, -- Divine Resonance + { spell = 355567, type = "buff", unit = "player", bonusItemId = 7702 }, -- Equinox }, HUNTER = { - { spell = 336744, type = "buff", unit = "player", bonusItemId = 7004}, -- Nesingwary's Trapping Apparatus - { spell = 336746, type = "debuff", unit = "target", bonusItemId = 7005}, -- Soulforge Embers - { spell = 336826, type = "buff", unit = "player", bonusItemId = 7008}, -- Flamewaker's Cobra Sting - { spell = 336892, type = "buff", unit = "player", bonusItemId = 7013}, -- Secrets of the Unblinking Vigil - { spell = 336908, type = "buff", unit = "player", bonusItemId = 7018}, -- Butcher's Bone Fragments - { spell = 273286, type = "debuff", unit = "target", bonusItemId = 7017}, -- Latent Poison - { spell = 356263, type = "buff", unit = "player", bonusItemId = 7714}, -- Pact of the Soulstalkers - { spell = 356620, type = "debuff", unit = "target", bonusItemId = 7717}, -- Pouch of Razor Fragments + { spell = 336744, type = "buff", unit = "player", bonusItemId = 7004 }, -- Nesingwary's Trapping Apparatus + { spell = 336746, type = "debuff", unit = "target", bonusItemId = 7005 }, -- Soulforge Embers + { spell = 336826, type = "buff", unit = "player", bonusItemId = 7008 }, -- Flamewaker's Cobra Sting + { spell = 336892, type = "buff", unit = "player", bonusItemId = 7013 }, -- Secrets of the Unblinking Vigil + { spell = 336908, type = "buff", unit = "player", bonusItemId = 7018 }, -- Butcher's Bone Fragments + { spell = 273286, type = "debuff", unit = "target", bonusItemId = 7017 }, -- Latent Poison + { spell = 356263, type = "buff", unit = "player", bonusItemId = 7714 }, -- Pact of the Soulstalkers + { spell = 356620, type = "debuff", unit = "target", bonusItemId = 7717 }, -- Pouch of Razor Fragments }, ROGUE = { - { spell = 23580, type = "debuff", unit = "target", bonusItemId = 7113}, -- Bloodfang - { spell = 340094, type = "buff", unit = "player", bonusItemId = 7111}, -- Master Assassin's Mark - { spell = 340587, type = "buff", unit = "player", bonusItemId = 7122}, -- Concealed Blunderbuss - { spell = 340573, type = "buff", unit = "player", bonusItemId = 7119}, -- Greenskin's Wickers - { spell = 340580, type = "buff", unit = "player", bonusItemId = 7120}, -- Guile Charm - { spell = 341202, type = "buff", unit = "player", bonusItemId = 7126}, -- Deathly Shadows - { spell = 340600, type = "buff", unit = "player", bonusItemId = 7123}, -- Finality: Eviscerate - { spell = 340601, type = "buff", unit = "player", bonusItemId = 7123}, -- Finality: Rupture - { spell = 340603, type = "buff", unit = "player", bonusItemId = 7123}, -- Finality: Black Powder - { spell = 341134, type = "buff", unit = "player", bonusItemId = 7125}, -- The Rotten + { spell = 23580, type = "debuff", unit = "target", bonusItemId = 7113 }, -- Bloodfang + { spell = 340094, type = "buff", unit = "player", bonusItemId = 7111 }, -- Master Assassin's Mark + { spell = 340587, type = "buff", unit = "player", bonusItemId = 7122 }, -- Concealed Blunderbuss + { spell = 340573, type = "buff", unit = "player", bonusItemId = 7119 }, -- Greenskin's Wickers + { spell = 340580, type = "buff", unit = "player", bonusItemId = 7120 }, -- Guile Charm + { spell = 341202, type = "buff", unit = "player", bonusItemId = 7126 }, -- Deathly Shadows + { spell = 340600, type = "buff", unit = "player", bonusItemId = 7123 }, -- Finality: Eviscerate + { spell = 340601, type = "buff", unit = "player", bonusItemId = 7123 }, -- Finality: Rupture + { spell = 340603, type = "buff", unit = "player", bonusItemId = 7123 }, -- Finality: Black Powder + { spell = 341134, type = "buff", unit = "player", bonusItemId = 7125 }, -- The Rotten }, PRIEST = { - { spell = 341824, type = "buff", unit = "player", bonusItemId = 7161}, -- Measured Contemplation - { spell = 336267, type = "buff", unit = "player", bonusItemId = 6974}, -- Flash Concentration - { spell = 357028, type = "buff", unit = "player", bonusItemId = 0000}, -- Shadow Word: Manipulation + { spell = 341824, type = "buff", unit = "player", bonusItemId = 7161 }, -- Measured Contemplation + { spell = 336267, type = "buff", unit = "player", bonusItemId = 6974 }, -- Flash Concentration + { spell = 357028, type = "buff", unit = "player", bonusItemId = 0000 }, -- Shadow Word: Manipulation }, SHAMAN = { - { spell = 329771, type = "buff", unit = "player", bonusItemId = 6988}, -- Chains of Devastation - { spell = 336217, type = "buff", unit = "player", bonusItemId = 6991}, -- Echoes of Great Sundering - { spell = 347349, spellId = 347349, type = "debuff", unit = "player", titleSuffix = L["Debuff"], bonusItemId = 6990}, -- Elemental Equilibrium - { spell = 336731, spellId = 336731, type = "buff", unit = "player", titleSuffix = L["Frost"], bonusItemId = 6990}, -- Elemental Equilibrium - { spell = 336732, spellId = 336732, type = "buff", unit = "player", titleSuffix = L["Nature"], bonusItemId = 6990}, -- Elemental Equilibrium - { spell = 336733, spellId = 336733, type = "buff", unit = "player", titleSuffix = L["Fire"], bonusItemId = 6990}, -- Elemental Equilibrium - { spell = 336065, type = "buff", unit = "player", bonusItemId = 6992}, -- Windspeaker's Lava Resurgence - { spell = 335903, type = "buff", unit = "player", bonusItemId = 6993}, -- Doom Winds - { spell = 335901, type = "buff", unit = "player", bonusItemId = 6994}, -- Legacy of the Frost Witch - { spell = 335896, type = "buff", unit = "player", bonusItemId = 6996}, -- Primal Lava Actuators - { spell = 335894, type = "buff", unit = "player", bonusItemId = 6997}, -- Jonat's Natural Focus - { spell = 335892, type = "buff", unit = "player", bonusItemId = 6998}, -- Spiritwalker's Tidal Totem - { spell = 358945, type = "buff", unit = "player", bonusItemId = 7708}, -- Seeds of Rampant Growth - { spell = 354648, type = "buff", unit = "player", bonusItemId = 7570}, -- Splintered Elements + { spell = 329771, type = "buff", unit = "player", bonusItemId = 6988 }, -- Chains of Devastation + { spell = 336217, type = "buff", unit = "player", bonusItemId = 6991 }, -- Echoes of Great Sundering + { spell = 347349, spellId = 347349, type = "debuff", unit = "player", titleSuffix = L["Debuff"], bonusItemId = 6990 }, -- Elemental Equilibrium + { spell = 336731, spellId = 336731, type = "buff", unit = "player", titleSuffix = L["Frost"], bonusItemId = 6990 }, -- Elemental Equilibrium + { spell = 336732, spellId = 336732, type = "buff", unit = "player", titleSuffix = L["Nature"], bonusItemId = 6990 }, -- Elemental Equilibrium + { spell = 336733, spellId = 336733, type = "buff", unit = "player", titleSuffix = L["Fire"], bonusItemId = 6990 }, -- Elemental Equilibrium + { spell = 336065, type = "buff", unit = "player", bonusItemId = 6992 }, -- Windspeaker's Lava Resurgence + { spell = 335903, type = "buff", unit = "player", bonusItemId = 6993 }, -- Doom Winds + { spell = 335901, type = "buff", unit = "player", bonusItemId = 6994 }, -- Legacy of the Frost Witch + { spell = 335896, type = "buff", unit = "player", bonusItemId = 6996 }, -- Primal Lava Actuators + { spell = 335894, type = "buff", unit = "player", bonusItemId = 6997 }, -- Jonat's Natural Focus + { spell = 335892, type = "buff", unit = "player", bonusItemId = 6998 }, -- Spiritwalker's Tidal Totem + { spell = 358945, type = "buff", unit = "player", bonusItemId = 7708 }, -- Seeds of Rampant Growth + { spell = 354648, type = "buff", unit = "player", bonusItemId = 7570 }, -- Splintered Elements }, MAGE = { - { spell = 327371, type = "buff", unit = "player", bonusItemId = 6832}, -- Disciplinary Command - { spell = 327495, type = "buff", unit = "player", bonusItemId = 6831}, -- Expanded Potential - { spell = 332777, type = "buff", unit = "player", bonusItemId = 6926}, -- Arcane Harmony/Infinity - { spell = 332934, type = "buff", unit = "player", bonusItemId = 6928}, -- Siphon Storm - { spell = 333049, type = "buff", unit = "player", bonusItemId = 6931}, -- Fevered Incantation - { spell = 333100, type = "buff", unit = "player", bonusItemId = 6932}, -- Firestorm - { spell = 333170, spellId = 333170, type = "buff", unit = "player", titleSuffix = L["Build Up"], bonusItemId = 6933}, -- Molten Skyfall - { spell = 333182, spellId = 333182, type = "buff", unit = "player", titleSuffix = L["Meteor Ready"], bonusItemId = 6933}, -- Molten Skyfall - { spell = 333314, spellId = 333314, type = "buff", unit = "player", titleSuffix = L["Build Up"], bonusItemId = 6934}, -- Sun King's Blessing - { spell = 333315, spellId = 333315, type = "buff", unit = "player", titleSuffix = L["Combustion Ready"], bonusItemId = 6934}, -- Sun King's Blessing - { spell = 327327, spellId = 327327, type = "buff", unit = "player", titleSuffix = L["Build Up"], bonusItemId = 6828}, -- Cold Front - { spell = 327330, spellId = 327330, type = "buff", unit = "player", titleSuffix = L["Meteor Ready"], bonusItemId = 6828}, -- Cold Front - { spell = 327478, type = "buff", unit = "player", bonusItemId = 6829}, -- Freezing Winds - { spell = 327509, type = "buff", unit = "player", bonusItemId = 6823}, -- Slick Ice - { spell = 356881, type = "buff", unit = "player", bonusItemId = 7727}, -- Heart of the Fae + { spell = 327371, type = "buff", unit = "player", bonusItemId = 6832 }, -- Disciplinary Command + { spell = 327495, type = "buff", unit = "player", bonusItemId = 6831 }, -- Expanded Potential + { spell = 332777, type = "buff", unit = "player", bonusItemId = 6926 }, -- Arcane Harmony/Infinity + { spell = 332934, type = "buff", unit = "player", bonusItemId = 6928 }, -- Siphon Storm + { spell = 333049, type = "buff", unit = "player", bonusItemId = 6931 }, -- Fevered Incantation + { spell = 333100, type = "buff", unit = "player", bonusItemId = 6932 }, -- Firestorm + { spell = 333170, spellId = 333170, type = "buff", unit = "player", titleSuffix = L["Build Up"], bonusItemId = 6933 }, -- Molten Skyfall + { spell = 333182, spellId = 333182, type = "buff", unit = "player", titleSuffix = L["Meteor Ready"], bonusItemId = 6933 }, -- Molten Skyfall + { spell = 333314, spellId = 333314, type = "buff", unit = "player", titleSuffix = L["Build Up"], bonusItemId = 6934 }, -- Sun King's Blessing + { spell = 333315, spellId = 333315, type = "buff", unit = "player", titleSuffix = L["Combustion Ready"], bonusItemId = 6934 }, -- Sun King's Blessing + { spell = 327327, spellId = 327327, type = "buff", unit = "player", titleSuffix = L["Build Up"], bonusItemId = 6828 }, -- Cold Front + { spell = 327330, spellId = 327330, type = "buff", unit = "player", titleSuffix = L["Meteor Ready"], bonusItemId = 6828 }, -- Cold Front + { spell = 327478, type = "buff", unit = "player", bonusItemId = 6829 }, -- Freezing Winds + { spell = 327509, type = "buff", unit = "player", bonusItemId = 6823 }, -- Slick Ice + { spell = 356881, type = "buff", unit = "player", bonusItemId = 7727 }, -- Heart of the Fae }, WARLOCK = { - { spell = 337096, type = "buff", unit = "player", bonusItemId = 7028}, -- Pillars of the Dark Portal - { spell = 337060, type = "buff", unit = "player", bonusItemId = 7027}, -- Relic of Demonic Synergy - { spell = 337125, type = "buff", unit = "player", bonusItemId = 7031}, -- Malefic Wrath - { spell = 337096, type = "debuff", unit = "target", bonusItemId = 7030}, -- Sacrolash's Dark Strike - { spell = 337130, type = "buff", unit = "player", bonusItemId = 7032}, -- Wrath of Consumption - { spell = 337161, type = "buff", unit = "player", bonusItemId = 7036}, -- Balespider's Burning Core - { spell = 342997, type = "buff", unit = "player", bonusItemId = 7034}, -- Grim Inquisitor's Dread Calling - { spell = 337139, type = "buff", unit = "player", bonusItemId = 7033}, -- Implosive Potential - { spell = 337170, type = "buff", unit = "player", bonusItemId = 7029}, -- Madness of the Azj'Aqir - { spell = 337164, type = "debuff", unit = "target", bonusItemId = 7034}, -- Grim Inquisitor's Dread Calling - { spell = 356255, type = "buff", unit = "player", bonusItemId = 7710}, -- Languishing Soul Detritus - { spell = 356342, type = "buff", unit = "player", bonusItemId = 7711}, -- Shard of Annihilation - { spell = 356369, type = "buff", unit = "player", bonusItemId = 7712}, -- Decaying Soul Satchel + { spell = 337096, type = "buff", unit = "player", bonusItemId = 7028 }, -- Pillars of the Dark Portal + { spell = 337060, type = "buff", unit = "player", bonusItemId = 7027 }, -- Relic of Demonic Synergy + { spell = 337125, type = "buff", unit = "player", bonusItemId = 7031 }, -- Malefic Wrath + { spell = 337096, type = "debuff", unit = "target", bonusItemId = 7030 }, -- Sacrolash's Dark Strike + { spell = 337130, type = "buff", unit = "player", bonusItemId = 7032 }, -- Wrath of Consumption + { spell = 337161, type = "buff", unit = "player", bonusItemId = 7036 }, -- Balespider's Burning Core + { spell = 342997, type = "buff", unit = "player", bonusItemId = 7034 }, -- Grim Inquisitor's Dread Calling + { spell = 337139, type = "buff", unit = "player", bonusItemId = 7033 }, -- Implosive Potential + { spell = 337170, type = "buff", unit = "player", bonusItemId = 7029 }, -- Madness of the Azj'Aqir + { spell = 337164, type = "debuff", unit = "target", bonusItemId = 7034 }, -- Grim Inquisitor's Dread Calling + { spell = 356255, type = "buff", unit = "player", bonusItemId = 7710 }, -- Languishing Soul Detritus + { spell = 356342, type = "buff", unit = "player", bonusItemId = 7711 }, -- Shard of Annihilation + { spell = 356369, type = "buff", unit = "player", bonusItemId = 7712 }, -- Decaying Soul Satchel }, MONK = { - { spell = 343249, type = "buff", unit = "player", bonusItemId = 7184}, -- Escape from Reality - { spell = 338140, type = "buff", unit = "player", bonusItemId = 7076}, -- Charred Passions - { spell = 337994, type = "buff", unit = "player", bonusItemId = 7078}, -- Mighty Pour/Celestial Infusion - { spell = 347553, type = "buff", unit = "player", bonusItemId = 7075}, -- Ancient Teachings of the Monastery - { spell = 337476, type = "buff", unit = "player", bonusItemId = 7074}, -- Clouded Focus - { spell = 337476, type = "buff", unit = "player", bonusItemId = 7072}, -- Tear of Morning - { spell = 337571, type = "buff", unit = "player", bonusItemId = 7068}, -- Jade Ignition/Chi Energy - { spell = 337291, type = "buff", unit = "player", bonusItemId = 7069}, -- The Emperor's Capacitor - { spell = 356773, type = "debuff", unit = "target", bonusItemId = 7721}, -- Faeline Harmony + { spell = 343249, type = "buff", unit = "player", bonusItemId = 7184 }, -- Escape from Reality + { spell = 338140, type = "buff", unit = "player", bonusItemId = 7076 }, -- Charred Passions + { spell = 337994, type = "buff", unit = "player", bonusItemId = 7078 }, -- Mighty Pour/Celestial Infusion + { spell = 347553, type = "buff", unit = "player", bonusItemId = 7075 }, -- Ancient Teachings of the Monastery + { spell = 337476, type = "buff", unit = "player", bonusItemId = 7074 }, -- Clouded Focus + { spell = 337476, type = "buff", unit = "player", bonusItemId = 7072 }, -- Tear of Morning + { spell = 337571, type = "buff", unit = "player", bonusItemId = 7068 }, -- Jade Ignition/Chi Energy + { spell = 337291, type = "buff", unit = "player", bonusItemId = 7069 }, -- The Emperor's Capacitor + { spell = 356773, type = "debuff", unit = "target", bonusItemId = 7721 }, -- Faeline Harmony }, DRUID = { - { spell = 340060, type = "buff", unit = "player", bonusItemId = 7110}, -- Lycara's Fleeting Glimpse - { spell = 340060, type = "buff", unit = "player", bonusItemId = 7107}, -- Balance of All Things - { spell = 339797, type = "buff", unit = "player", bonusItemId = 7087}, -- Oneth's Clear Vision - { spell = 338825, type = "buff", unit = "player", bonusItemId = 7088}, -- Primordial Arcanic Pulsar - { spell = 340049, type = "buff", unit = "player", bonusItemId = 7108}, -- Timeworn Dreambinder - { spell = 339140, type = "buff", unit = "player", bonusItemId = 7091}, -- Apex Predator's Craving - { spell = 339142, type = "buff", unit = "player", bonusItemId = 7090}, -- Eye of Fearful Symmetry - { spell = 189877, type = "buff", unit = "player", bonusItemId = 7096}, -- Memory of the Mother Tree - { spell = 355779, type = "buff", unit = "player", bonusItemId = 7477}, -- Kindred Affinity + { spell = 340060, type = "buff", unit = "player", bonusItemId = 7110 }, -- Lycara's Fleeting Glimpse + { spell = 340060, type = "buff", unit = "player", bonusItemId = 7107 }, -- Balance of All Things + { spell = 339797, type = "buff", unit = "player", bonusItemId = 7087 }, -- Oneth's Clear Vision + { spell = 338825, type = "buff", unit = "player", bonusItemId = 7088 }, -- Primordial Arcanic Pulsar + { spell = 340049, type = "buff", unit = "player", bonusItemId = 7108 }, -- Timeworn Dreambinder + { spell = 339140, type = "buff", unit = "player", bonusItemId = 7091 }, -- Apex Predator's Craving + { spell = 339142, type = "buff", unit = "player", bonusItemId = 7090 }, -- Eye of Fearful Symmetry + { spell = 189877, type = "buff", unit = "player", bonusItemId = 7096 }, -- Memory of the Mother Tree + { spell = 355779, type = "buff", unit = "player", bonusItemId = 7477 }, -- Kindred Affinity }, DEMONHUNTER = { - { spell = 337567, type = "buff", unit = "player", bonusItemId = 7050}, -- Chaos Theory/Chaotic Blades - { spell = 346264, type = "buff", unit = "player", bonusItemId = 7218}, -- Darker Nature - { spell = 337542, type = "buff", unit = "player", bonusItemId = 7045}, -- Spirit of the Darkness Flame - { spell = 337849, type = "buff", unit = "player", bonusItemId = 7052}, -- Fel Bombardment - { spell = 355894, type = "buff", unit = "player", bonusItemId = 7699}, -- Blind Faith - { spell = 355892, type = "buff", unit = "player", bonusItemId = 7698}, -- Blazing Slaughter + { spell = 337567, type = "buff", unit = "player", bonusItemId = 7050 }, -- Chaos Theory/Chaotic Blades + { spell = 346264, type = "buff", unit = "player", bonusItemId = 7218 }, -- Darker Nature + { spell = 337542, type = "buff", unit = "player", bonusItemId = 7045 }, -- Spirit of the Darkness Flame + { spell = 337849, type = "buff", unit = "player", bonusItemId = 7052 }, -- Fel Bombardment + { spell = 355894, type = "buff", unit = "player", bonusItemId = 7699 }, -- Blind Faith + { spell = 355892, type = "buff", unit = "player", bonusItemId = 7698 }, -- Blazing Slaughter }, DEATHKNIGHT = { - { spell = 332199, type = "buff", unit = "player", bonusItemId = 6954}, -- Phearomones - { spell = 334526, type = "buff", unit = "player", bonusItemId = 6941}, -- Crimson Rune Weapon - { spell = 334693, type = "debuff", unit = "target", bonusItemId = 6946}, -- Absolute Zero - { spell = 334722, type = "buff", unit = "player", bonusItemId = 6948}, -- Grip of the Everlasting - { spell = 353823, type = "debuff", unit = "target", bonusItemId = 7467}, -- Final Sentence - { spell = 353546, type = "debuff", unit = "target", bonusItemId = 7458}, -- Abomination's Frenzy - } + { spell = 332199, type = "buff", unit = "player", bonusItemId = 6954 }, -- Phearomones + { spell = 334526, type = "buff", unit = "player", bonusItemId = 6941 }, -- Crimson Rune Weapon + { spell = 334693, type = "debuff", unit = "target", bonusItemId = 6946 }, -- Absolute Zero + { spell = 334722, type = "buff", unit = "player", bonusItemId = 6948 }, -- Grip of the Everlasting + { spell = 353823, type = "debuff", unit = "target", bonusItemId = 7467 }, -- Final Sentence + { spell = 353546, type = "debuff", unit = "target", bonusItemId = 7458 }, -- Abomination's Frenzy + }, } for class, classData in pairs(templates.class) do @@ -5218,15 +5175,15 @@ local shardsOfDomination = { icon = 1392550, args = { -- General Ability - { spell = 356321, type = "buff", unit = "player"}, -- Unholy Aura - { spell = 356329, type = "debuff", unit = "target"}, -- Scouring Touch - { spell = 356043, type = "buff", unit = "player"}, -- Chaos Bane - { spell = 356305, type = "buff", unit = "player"}, -- Accretion - { spell = 356257, type = "buff", unit = "player"}, -- Frostrime - { spell = 356364, type = "buff", unit = "player"}, -- Coldhearted - { spell = 355735, type = "buff", unit = "player"}, -- Winds of Winter - { spell = 355804, type = "debuff", unit = "target"}, -- Blood Link - } + { spell = 356321, type = "buff", unit = "player" }, -- Unholy Aura + { spell = 356329, type = "debuff", unit = "target" }, -- Scouring Touch + { spell = 356043, type = "buff", unit = "player" }, -- Chaos Bane + { spell = 356305, type = "buff", unit = "player" }, -- Accretion + { spell = 356257, type = "buff", unit = "player" }, -- Frostrime + { spell = 356364, type = "buff", unit = "player" }, -- Coldhearted + { spell = 355735, type = "buff", unit = "player" }, -- Winds of Winter + { spell = 355804, type = "debuff", unit = "target" }, -- Blood Link + }, } -- Copy to main templates table @@ -5246,84 +5203,83 @@ end ------------------------------- -- Every Man for Himself -tinsert(templates.race.Human, { spell = 59752, type = "ability" }); +tinsert(templates.race.Human, { spell = 59752, type = "ability" }) -- Stoneform -tinsert(templates.race.Dwarf, { spell = 20594, type = "ability", titleSuffix = L["cooldown"]}); -tinsert(templates.race.Dwarf, { spell = 65116, type = "buff", unit = "player", titleSuffix = L["buff"]}); +tinsert(templates.race.Dwarf, { spell = 20594, type = "ability", titleSuffix = L["cooldown"] }) +tinsert(templates.race.Dwarf, { spell = 65116, type = "buff", unit = "player", titleSuffix = L["buff"] }) -- Shadow Meld -tinsert(templates.race.NightElf, { spell = 58984, type = "ability", titleSuffix = L["cooldown"]}); -tinsert(templates.race.NightElf, { spell = 58984, type = "buff", titleSuffix = L["buff"]}); +tinsert(templates.race.NightElf, { spell = 58984, type = "ability", titleSuffix = L["cooldown"] }) +tinsert(templates.race.NightElf, { spell = 58984, type = "buff", titleSuffix = L["buff"] }) -- Escape Artist -tinsert(templates.race.Gnome, { spell = 20589, type = "ability" }); +tinsert(templates.race.Gnome, { spell = 20589, type = "ability" }) -- Gift of the Naaru -tinsert(templates.race.Draenei, { spell = 28880, type = "ability", titleSuffix = L["cooldown"]}); -tinsert(templates.race.Draenei, { spell = 28880, type = "buff", unit = "player", titleSuffix = L["buff"]}); +tinsert(templates.race.Draenei, { spell = 28880, type = "ability", titleSuffix = L["cooldown"] }) +tinsert(templates.race.Draenei, { spell = 28880, type = "buff", unit = "player", titleSuffix = L["buff"] }) -- Dark Flight -tinsert(templates.race.Worgen, { spell = 68992, type = "ability", titleSuffix = L["cooldown"]}); -tinsert(templates.race.Worgen, { spell = 68992, type = "buff", unit = "player", titleSuffix = L["buff"]}); +tinsert(templates.race.Worgen, { spell = 68992, type = "ability", titleSuffix = L["cooldown"] }) +tinsert(templates.race.Worgen, { spell = 68992, type = "buff", unit = "player", titleSuffix = L["buff"] }) -- Quaking Palm -tinsert(templates.race.Pandaren, { spell = 107079, type = "ability", titleSuffix = L["cooldown"]}); -tinsert(templates.race.Pandaren, { spell = 107079, type = "buff", titleSuffix = L["buff"]}); +tinsert(templates.race.Pandaren, { spell = 107079, type = "ability", titleSuffix = L["cooldown"] }) +tinsert(templates.race.Pandaren, { spell = 107079, type = "buff", titleSuffix = L["buff"] }) -- Blood Fury -tinsert(templates.race.Orc, { spell = 20572, type = "ability", titleSuffix = L["cooldown"]}); -tinsert(templates.race.Orc, { spell = 20572, type = "buff", unit = "player", titleSuffix = L["buff"]}); +tinsert(templates.race.Orc, { spell = 20572, type = "ability", titleSuffix = L["cooldown"] }) +tinsert(templates.race.Orc, { spell = 20572, type = "buff", unit = "player", titleSuffix = L["buff"] }) --Cannibalize -tinsert(templates.race.Scourge, { spell = 20577, type = "ability", titleSuffix = L["cooldown"]}); -tinsert(templates.race.Scourge, { spell = 20578, type = "buff", unit = "player", titleSuffix = L["buff"]}); +tinsert(templates.race.Scourge, { spell = 20577, type = "ability", titleSuffix = L["cooldown"] }) +tinsert(templates.race.Scourge, { spell = 20578, type = "buff", unit = "player", titleSuffix = L["buff"] }) -- War Stomp -tinsert(templates.race.Tauren, { spell = 20549, type = "ability", titleSuffix = L["cooldown"]}); -tinsert(templates.race.Tauren, { spell = 20549, type = "debuff", titleSuffix = L["debuff"]}); +tinsert(templates.race.Tauren, { spell = 20549, type = "ability", titleSuffix = L["cooldown"] }) +tinsert(templates.race.Tauren, { spell = 20549, type = "debuff", titleSuffix = L["debuff"] }) --Beserking -tinsert(templates.race.Troll, { spell = 26297, type = "ability", titleSuffix = L["cooldown"]}); -tinsert(templates.race.Troll, { spell = 26297, type = "buff", unit = "player", titleSuffix = L["buff"]}); +tinsert(templates.race.Troll, { spell = 26297, type = "ability", titleSuffix = L["cooldown"] }) +tinsert(templates.race.Troll, { spell = 26297, type = "buff", unit = "player", titleSuffix = L["buff"] }) -- Arcane Torrent -tinsert(templates.race.BloodElf, { spell = 69179, type = "ability", titleSuffix = L["cooldown"]}); +tinsert(templates.race.BloodElf, { spell = 69179, type = "ability", titleSuffix = L["cooldown"] }) -- Pack Hobgoblin -tinsert(templates.race.Goblin, { spell = 69046, type = "ability" }); +tinsert(templates.race.Goblin, { spell = 69046, type = "ability" }) -- Rocket Barrage -tinsert(templates.race.Goblin, { spell = 69041, type = "ability" }); +tinsert(templates.race.Goblin, { spell = 69041, type = "ability" }) -- Arcane Pulse -tinsert(templates.race.Nightborne, { spell = 260364, type = "ability" }); +tinsert(templates.race.Nightborne, { spell = 260364, type = "ability" }) -- Cantrips -tinsert(templates.race.Nightborne, { spell = 255661, type = "ability" }); +tinsert(templates.race.Nightborne, { spell = 255661, type = "ability" }) -- Light's Judgment -tinsert(templates.race.LightforgedDraenei, { spell = 255647, type = "ability" }); +tinsert(templates.race.LightforgedDraenei, { spell = 255647, type = "ability" }) -- Forge of Light -tinsert(templates.race.LightforgedDraenei, { spell = 259930, type = "ability" }); +tinsert(templates.race.LightforgedDraenei, { spell = 259930, type = "ability" }) -- Bull Rush -tinsert(templates.race.HighmountainTauren, { spell = 255654, type = "ability" }); +tinsert(templates.race.HighmountainTauren, { spell = 255654, type = "ability" }) --Spatial Rift -tinsert(templates.race.VoidElf, { spell = 256948, type = "ability" }); +tinsert(templates.race.VoidElf, { spell = 256948, type = "ability" }) -- Fireblood -tinsert(templates.race.DarkIronDwarf, { spell = 265221, type = "ability" }); +tinsert(templates.race.DarkIronDwarf, { spell = 265221, type = "ability" }) -- Mole Machine -tinsert(templates.race.DarkIronDwarf, { spell = 265225, type = "ability" }); +tinsert(templates.race.DarkIronDwarf, { spell = 265225, type = "ability" }) --Haymaker -tinsert(templates.race.KulTiran, { spell = 287712, type = "ability", requiresTarget = true }); +tinsert(templates.race.KulTiran, { spell = 287712, type = "ability", requiresTarget = true }) -- Brush it Off -tinsert(templates.race.KulTiran, { spell = 291843, type = "buff"}); +tinsert(templates.race.KulTiran, { spell = 291843, type = "buff" }) -- Hyper Organic Light Originator -tinsert(templates.race.Mechagnome, { spell = 312924, type = "ability" }); +tinsert(templates.race.Mechagnome, { spell = 312924, type = "ability" }) -- Combat Anlysis -tinsert(templates.race.Mechagnome, { spell = 313424, type = "buff" }); +tinsert(templates.race.Mechagnome, { spell = 313424, type = "buff" }) -- Recently Failed -tinsert(templates.race.Mechagnome, { spell = 313015, type = "debuff" }); +tinsert(templates.race.Mechagnome, { spell = 313015, type = "debuff" }) -- Ancestral Call -tinsert(templates.race.MagharOrc, { spell = 274738, type = "ability" }); +tinsert(templates.race.MagharOrc, { spell = 274738, type = "ability" }) -- ZandalariTroll = {} -- Pterrordax Swoop -tinsert(templates.race.ZandalariTroll, { spell = 281954, type = "ability" }); +tinsert(templates.race.ZandalariTroll, { spell = 281954, type = "ability" }) -- Regenratin' -tinsert(templates.race.ZandalariTroll, { spell = 291944, type = "ability" }); +tinsert(templates.race.ZandalariTroll, { spell = 291944, type = "ability" }) -- Embrace of the Loa -tinsert(templates.race.ZandalariTroll, { spell = 292752, type = "ability" }); +tinsert(templates.race.ZandalariTroll, { spell = 292752, type = "ability" }) -- Vulpera = {} -- Bag of Tricks -tinsert(templates.race.Vulpera, { spell = 312411, type = "ability" }); +tinsert(templates.race.Vulpera, { spell = 312411, type = "ability" }) -- Make Camp -tinsert(templates.race.Vulpera, { spell = 312370, type = "ability" }); - +tinsert(templates.race.Vulpera, { spell = 312370, type = "ability" }) ------------------------------ -- Helper code for options @@ -5331,83 +5287,83 @@ tinsert(templates.race.Vulpera, { spell = 312370, type = "ability" }); -- Enrich items from spell, set title local function handleItem(item) - local waitingForItemInfo = false; - if (item.spell) then - local name, icon, _; - if (item.type == "item") then - name, _, _, _, _, _, _, _, _, icon = GetItemInfo(item.spell); - if (name == nil) then - name = L["Unknown Item"] .. " " .. tostring(item.spell); - waitingForItemInfo = true; + local waitingForItemInfo = false + if item.spell then + local name, icon, _ + if item.type == "item" then + name, _, _, _, _, _, _, _, _, icon = GetItemInfo(item.spell) + if name == nil then + name = L["Unknown Item"] .. " " .. tostring(item.spell) + waitingForItemInfo = true end else - name, _, icon = GetSpellInfo(item.spell); - if (name == nil) then - name = L["Unknown Spell"] .. " " .. tostring(item.spell); + name, _, icon = GetSpellInfo(item.spell) + if name == nil then + name = L["Unknown Spell"] .. " " .. tostring(item.spell) end end - if (icon and not item.icon) then - item.icon = icon; + if icon and not item.icon then + item.icon = icon end - item.title = item.overideTitle or name or ""; - if (item.titleSuffix) then - item.title = item.title .. " " .. item.titleSuffix; + item.title = item.overideTitle or name or "" + if item.titleSuffix then + item.title = item.title .. " " .. item.titleSuffix end - if (item.titlePrefix) then - item.title = item.titlePrefix .. item.title; + if item.titlePrefix then + item.title = item.titlePrefix .. item.title end - if (item.titleItemPrefix) then - local prefix = GetItemInfo(item.titleItemPrefix); - if (prefix) then - item.title = prefix .. "-" .. item.title; + if item.titleItemPrefix then + local prefix = GetItemInfo(item.titleItemPrefix) + if prefix then + item.title = prefix .. "-" .. item.title else - waitingForItemInfo = true; + waitingForItemInfo = true end end - if (item.type ~= "item") then - local spell = Spell:CreateFromSpellID(item.spell); - if (not spell:IsSpellEmpty()) then + if item.type ~= "item" then + local spell = Spell:CreateFromSpellID(item.spell) + if not spell:IsSpellEmpty() then spell:ContinueOnSpellLoad(function() - item.description = GetSpellDescription(spell:GetSpellID()); - end); + item.description = GetSpellDescription(spell:GetSpellID()) + end) end - item.description = GetSpellDescription(item.spell); + item.description = GetSpellDescription(item.spell) end end - if (item.talent) then - item.load = item.load or {}; + if item.talent then + item.load = item.load or {} if type(item.talent) == "table" then - item.load.talent = { multi = {} }; - for _,v in pairs(item.talent) do - item.load.talent.multi[v] = true; + item.load.talent = { multi = {} } + for _, v in pairs(item.talent) do + item.load.talent.multi[v] = true end - item.load.use_talent = false; + item.load.use_talent = false else item.load.talent = { single = item.talent, - multi = {}; - }; - item.load.use_talent = true; + multi = {}, + } + item.load.use_talent = true end end - if (item.pvptalent) then - item.load = item.load or {}; - item.load.use_pvptalent = true; + if item.pvptalent then + item.load = item.load or {} + item.load.use_pvptalent = true item.load.pvptalent = { single = item.pvptalent, - multi = {}; + multi = {}, } end - if (item.covenant) then + if item.covenant then item.load = item.load or {} item.load.use_covenant = true item.load.covenant = { single = item.covenant, - multi = {} + multi = {}, } end - if (item.bonusItemId) then + if item.bonusItemId then item.load = item.load or {} item.load.use_item_bonusid_equipped = true item.load.item_bonusid_equipped = tostring(item.bonusItemId) @@ -5416,41 +5372,43 @@ local function handleItem(item) if item.form then item.usable = true end - return waitingForItemInfo; + return waitingForItemInfo end local function addLoadCondition(item, loadCondition) -- No need to deep copy here, templates are read-only - item.load = item.load or {}; + item.load = item.load or {} for k, v in pairs(loadCondition) do - item.load[k] = v; + item.load[k] = v end end -local delayedEnrichDatabase = false; +local delayedEnrichDatabase = false local itemInfoReceived = CreateFrame("Frame") -local enrichTries = 0; +local enrichTries = 0 local function enrichDatabase() - if (enrichTries > 3) then - return; + if enrichTries > 3 then + return end - enrichTries = enrichTries + 1; + enrichTries = enrichTries + 1 - local waitingForItemInfo = false; + local waitingForItemInfo = false for className, class in pairs(templates.class) do for specIndex, spec in pairs(class) do for _, section in pairs(spec) do local loadCondition = { - use_class = true, class = { single = className, multi = {} }, - use_spec = true, spec = { single = specIndex, multi = {}} - }; + use_class = true, + class = { single = className, multi = {} }, + use_spec = true, + spec = { single = specIndex, multi = {} }, + } for itemIndex, item in pairs(section.args or {}) do local handle = handleItem(item) - if(handle) then - waitingForItemInfo = true; + if handle then + waitingForItemInfo = true end - addLoadCondition(item, loadCondition); + addLoadCondition(item, loadCondition) end end end @@ -5458,29 +5416,30 @@ local function enrichDatabase() for raceName, race in pairs(templates.race) do local loadCondition = { - use_race = true, race = { single = raceName, multi = {} } - }; + use_race = true, + race = { single = raceName, multi = {} }, + } for _, item in pairs(race) do local handle = handleItem(item) if handle then - waitingForItemInfo = true; + waitingForItemInfo = true end if handle ~= nil then - addLoadCondition(item, loadCondition); + addLoadCondition(item, loadCondition) end end end for _, item in pairs(templates.general.args) do - if (handleItem(item)) then - waitingForItemInfo = true; + if handleItem(item) then + waitingForItemInfo = true end end - if (waitingForItemInfo) then - itemInfoReceived:RegisterEvent("GET_ITEM_INFO_RECEIVED"); + if waitingForItemInfo then + itemInfoReceived:RegisterEvent("GET_ITEM_INFO_RECEIVED") else - itemInfoReceived:UnregisterEvent("GET_ITEM_INFO_RECEIVED"); + itemInfoReceived:UnregisterEvent("GET_ITEM_INFO_RECEIVED") end end @@ -5490,10 +5449,10 @@ local function fixupIcons() for _, section in pairs(spec) do if section.args then for _, item in pairs(section.args) do - if (item.spell and (not item.type ~= "item")) then - local icon = select(3, GetSpellInfo(item.spell)); - if (icon) then - item.icon = icon; + if item.spell and (not item.type ~= "item") then + local icon = select(3, GetSpellInfo(item.spell)) + if icon then + item.icon = icon end end end @@ -5503,34 +5462,33 @@ local function fixupIcons() end end -local fixupIconsFrame = CreateFrame("Frame"); +local fixupIconsFrame = CreateFrame("Frame") fixupIconsFrame:RegisterEvent("PLAYER_TALENT_UPDATE") -fixupIconsFrame:SetScript("OnEvent", fixupIcons); +fixupIconsFrame:SetScript("OnEvent", fixupIcons) -enrichDatabase(); +enrichDatabase() itemInfoReceived:SetScript("OnEvent", function() - if (not delayedEnrichDatabase) then - delayedEnrichDatabase = true; + if not delayedEnrichDatabase then + delayedEnrichDatabase = true C_Timer.After(2, function() - enrichDatabase(); - delayedEnrichDatabase = false; + enrichDatabase() + delayedEnrichDatabase = false end) end -end); - +end) -- Enrich Display templates with default values for regionType, regionData in pairs(WeakAuras.regionOptions) do - if (regionData.templates) then + if regionData.templates then for _, item in ipairs(regionData.templates) do for k, v in pairs(WeakAuras.regionTypes[regionType].default) do - if (item.data[k] == nil) then - item.data[k] = v; + if item.data[k] == nil then + item.data[k] = v end end end end end -WeakAuras.triggerTemplates = templates; +WeakAuras.triggerTemplates = templates diff --git a/WeakAurasTemplates/TriggerTemplatesDataBCC.lua b/WeakAurasTemplates/TriggerTemplatesDataBCC.lua index deda962ab0..517ec48942 100644 --- a/WeakAurasTemplates/TriggerTemplatesDataBCC.lua +++ b/WeakAurasTemplates/TriggerTemplatesDataBCC.lua @@ -1,43 +1,43 @@ local WeakAuras = WeakAuras -if not WeakAuras.IsBCC() then return end +if not WeakAuras.IsBCC() then + return +end local L = WeakAuras.L local GetSpellInfo, tinsert, GetItemInfo, GetSpellDescription, C_Timer, Spell = GetSpellInfo, tinsert, GetItemInfo, GetSpellDescription, C_Timer, Spell -- The templates tables are created on demand -local templates = - { - class = { }, - race = { - Human = {}, - NightElf = {}, - Dwarf = {}, - Gnome = {}, - Draenei = {}, - Orc = {}, - Scourge = {}, - Tauren = {}, - Troll = {}, - BloodElf = {}, - }, - general = { - title = L["General"], - icon = 136116, - args = {} - }, - } +local templates = { + class = {}, + race = { + Human = {}, + NightElf = {}, + Dwarf = {}, + Gnome = {}, + Draenei = {}, + Orc = {}, + Scourge = {}, + Tauren = {}, + Troll = {}, + BloodElf = {}, + }, + general = { + title = L["General"], + icon = 136116, + args = {}, + }, +} local manaIcon = "Interface\\Icons\\spell_frost_manarecharge.blp" local rageIcon = "Interface\\Icons\\ability_racial_bloodrage.blp" local comboPointsIcon = "Interface\\Icons\\ability_backstab" -local powerTypes = - { - [0] = { name = POWER_TYPE_MANA, icon = manaIcon }, - [1] = { name = POWER_TYPE_RED_POWER, icon = rageIcon}, - [2] = { name = POWER_TYPE_FOCUS, icon = "Interface\\Icons\\ability_hunter_focusfire"}, - [3] = { name = POWER_TYPE_ENERGY, icon = "Interface\\Icons\\spell_shadow_shadowworddominate"}, - [4] = { name = COMBO_POINTS, icon = comboPointsIcon}, - } +local powerTypes = { + [0] = { name = POWER_TYPE_MANA, icon = manaIcon }, + [1] = { name = POWER_TYPE_RED_POWER, icon = rageIcon }, + [2] = { name = POWER_TYPE_FOCUS, icon = "Interface\\Icons\\ability_hunter_focusfire" }, + [3] = { name = POWER_TYPE_ENERGY, icon = "Interface\\Icons\\spell_shadow_shadowworddominate" }, + [4] = { name = COMBO_POINTS, icon = comboPointsIcon }, +} -- Collected by WeakAurasTemplateCollector: -------------------------------------------------------------------------------- @@ -47,85 +47,85 @@ templates.class.WARRIOR = { [1] = { title = L["Buffs"], args = { - { spell = 469, type = "buff", unit = "player"}, -- Commanding Shout - { spell = 2565, type = "buff", unit = "player"}, -- Shield Block - { spell = 6673, type = "buff", unit = "player"}, -- Battle Shout - { spell = 18499, type = "buff", unit = "player"}, -- Berserker Rage - { spell = 12292, type = "buff", unit = "player"}, -- Sweeping Strikes - { spell = 12328, type = "buff", unit = "player"}, -- Death Wish - { spell = 12317, type = "buff", unit = "player"}, -- Enrage - { spell = 12319, type = "buff", unit = "player"}, -- Flurry - { spell = 12975, type = "buff", unit = "player"}, -- Last Stand - { spell = 23920, type = "buff", unit = "player"}, -- Spell Reflection + { spell = 469, type = "buff", unit = "player" }, -- Commanding Shout + { spell = 2565, type = "buff", unit = "player" }, -- Shield Block + { spell = 6673, type = "buff", unit = "player" }, -- Battle Shout + { spell = 18499, type = "buff", unit = "player" }, -- Berserker Rage + { spell = 12292, type = "buff", unit = "player" }, -- Sweeping Strikes + { spell = 12328, type = "buff", unit = "player" }, -- Death Wish + { spell = 12317, type = "buff", unit = "player" }, -- Enrage + { spell = 12319, type = "buff", unit = "player" }, -- Flurry + { spell = 12975, type = "buff", unit = "player" }, -- Last Stand + { spell = 23920, type = "buff", unit = "player" }, -- Spell Reflection }, - icon = 132333 + icon = 132333, }, [2] = { title = L["Debuffs"], args = { - { spell = 355, type = "debuff", unit = "target"}, -- Taunt - { spell = 676, type = "debuff", unit = "target"}, -- Disarm - { spell = 694, type = "debuff", unit = "target"}, -- Mocking Blow - { spell = 772, type = "debuff", unit = "target"}, -- Rend - { spell = 1160, type = "debuff", unit = "target"}, -- Demoralizing Shout - { spell = 1715, type = "debuff", unit = "target"}, -- Hamstring - { spell = 5246, type = "debuff", unit = "target"}, -- Intimidating Shout - { spell = 6343, type = "debuff", unit = "target"}, -- Thunder Clap - { spell = 7384, type = "debuff", unit = "target"}, -- Sunder Armor - { spell = 12289, type = "debuff", unit = "target"}, -- Improved Hamstring - { spell = 12294, type = "debuff", unit = "target"}, -- Mortal Strike - { spell = 12797, type = "debuff", unit = "target"}, -- Improved Revenge - { spell = 12809, type = "debuff", unit = "target"}, -- Concussion Blow + { spell = 355, type = "debuff", unit = "target" }, -- Taunt + { spell = 676, type = "debuff", unit = "target" }, -- Disarm + { spell = 694, type = "debuff", unit = "target" }, -- Mocking Blow + { spell = 772, type = "debuff", unit = "target" }, -- Rend + { spell = 1160, type = "debuff", unit = "target" }, -- Demoralizing Shout + { spell = 1715, type = "debuff", unit = "target" }, -- Hamstring + { spell = 5246, type = "debuff", unit = "target" }, -- Intimidating Shout + { spell = 6343, type = "debuff", unit = "target" }, -- Thunder Clap + { spell = 7384, type = "debuff", unit = "target" }, -- Sunder Armor + { spell = 12289, type = "debuff", unit = "target" }, -- Improved Hamstring + { spell = 12294, type = "debuff", unit = "target" }, -- Mortal Strike + { spell = 12797, type = "debuff", unit = "target" }, -- Improved Revenge + { spell = 12809, type = "debuff", unit = "target" }, -- Concussion Blow }, - icon = 132366 + icon = 132366, }, [3] = { title = L["Abilities"], args = { - { spell = 72, type = "ability", debuff = true, requiresTarget = true, form = 2}, -- Shield Bash - { spell = 78, type = "ability", queued = true}, -- Heroic Strike - { spell = 100, type = "ability", requiresTarget = true, form = 1}, -- Charge - { spell = 355, type = "ability", debuff = true, requiresTarget = true, form = 2}, -- Taunt - { spell = 469, type = "ability", buff = true}, -- Commanding Shout - { spell = 676, type = "ability", debuff = true, requiresTarget = true, form = 2}, -- Disarm - { spell = 694, type = "ability", debuff = true, requiresTarget = true, form = 1}, -- Mocking Blow - { spell = 772, type = "ability", debuff = true, requiresTarget = true}, -- Rend - { spell = 845, type = "ability", queued = true}, -- Cleave - { spell = 871, type = "ability", buff = true, form = 2}, -- Shield Wall - { spell = 1160, type = "ability", debuff = true}, -- Demoralizing Shout - { spell = 1161, type = "ability", debuff = true}, -- Challenging Shout - { spell = 1464, type = "ability", requiresTarget = true}, -- Slam - { spell = 1680, type = "ability", form = 3}, -- Whirlwind - { spell = 1715, type = "ability", requiresTarget = true, form = {1, 2}}, -- Hamstring - { spell = 1719, type = "ability", buff = true, form = 3}, -- Recklessness - { spell = 2565, type = "ability", buff = true, form = 2}, -- Shield Block - { spell = 2687, type = "ability", buff = true}, -- Bloodrage - { spell = 3411, type = "ability", requiresTarget = true, form = 2}, -- Intervene - { spell = 5246, type = "ability", debuff = true, requiresTarget = true}, -- Intimidating Shout - { spell = 5308, type = "ability", requiresTarget = true, form = {1, 3}}, -- Execute - { spell = 6343, type = "ability", debuff = true, form = 1}, -- Thunder Clap - { spell = 6552, type = "ability", requiresTarget = true, form = 3}, -- Pummel - { spell = 6572, type = "ability", requiresTarget = true, usable = true, form = 2}, -- Revenge - { spell = 6673, type = "ability", buff = true}, -- Battle Shout - { spell = 7384, type = "ability", requiresTarget = true, form = 1}, -- Overpower - { spell = 7386, type = "ability", requiresTarget = true, debuff = true}, -- Sunder Armor - { spell = 12323, type = "ability", debuff = true, talent = 46}, -- Piercing Howl - { spell = 12328, type = "ability", buff = true, talent = 53}, -- Sweeping Strikes - { spell = 12294, type = "ability", requiresTarget = true, talent = 20}, -- Mortal Strike - { spell = 12809, type = "ability", requiresTarget = true, debuff = true, talent = 94}, -- Concussion Blow - { spell = 12975, type = "ability", buff = true, talent = 86}, -- Last Stand - { spell = 12292, type = "ability", buff = true, talent = 13}, -- Death Wish - { spell = 18499, type = "ability", buff = true, form = 3}, -- Berserker Rage - { spell = 20230, type = "ability", buff = true, form = 1}, -- Retaliation - { spell = 20252, type = "ability", requiresTarget = true, form = 3}, -- Intercept - { spell = 20243, type = "ability", requiresTarget = true, talent = 102}, -- Devastate - { spell = 23881, type = "ability", requiresTarget = true, talent = 58}, -- Bloodthirst - { spell = 23920, type = "ability", buff = true, form = {1, 2}}, -- Spell Reflection - { spell = 23922, type = "ability", requiresTarget = true, talent = 99}, -- Shield Slam - { spell = 29801, type = "ability", requiresTarget = true, talent = 61}, -- Rampage - { spell = 34428, type = "ability", requiresTarget = true, usable = true}, -- Victory Rush + { spell = 72, type = "ability", debuff = true, requiresTarget = true, form = 2 }, -- Shield Bash + { spell = 78, type = "ability", queued = true }, -- Heroic Strike + { spell = 100, type = "ability", requiresTarget = true, form = 1 }, -- Charge + { spell = 355, type = "ability", debuff = true, requiresTarget = true, form = 2 }, -- Taunt + { spell = 469, type = "ability", buff = true }, -- Commanding Shout + { spell = 676, type = "ability", debuff = true, requiresTarget = true, form = 2 }, -- Disarm + { spell = 694, type = "ability", debuff = true, requiresTarget = true, form = 1 }, -- Mocking Blow + { spell = 772, type = "ability", debuff = true, requiresTarget = true }, -- Rend + { spell = 845, type = "ability", queued = true }, -- Cleave + { spell = 871, type = "ability", buff = true, form = 2 }, -- Shield Wall + { spell = 1160, type = "ability", debuff = true }, -- Demoralizing Shout + { spell = 1161, type = "ability", debuff = true }, -- Challenging Shout + { spell = 1464, type = "ability", requiresTarget = true }, -- Slam + { spell = 1680, type = "ability", form = 3 }, -- Whirlwind + { spell = 1715, type = "ability", requiresTarget = true, form = { 1, 2 } }, -- Hamstring + { spell = 1719, type = "ability", buff = true, form = 3 }, -- Recklessness + { spell = 2565, type = "ability", buff = true, form = 2 }, -- Shield Block + { spell = 2687, type = "ability", buff = true }, -- Bloodrage + { spell = 3411, type = "ability", requiresTarget = true, form = 2 }, -- Intervene + { spell = 5246, type = "ability", debuff = true, requiresTarget = true }, -- Intimidating Shout + { spell = 5308, type = "ability", requiresTarget = true, form = { 1, 3 } }, -- Execute + { spell = 6343, type = "ability", debuff = true, form = 1 }, -- Thunder Clap + { spell = 6552, type = "ability", requiresTarget = true, form = 3 }, -- Pummel + { spell = 6572, type = "ability", requiresTarget = true, usable = true, form = 2 }, -- Revenge + { spell = 6673, type = "ability", buff = true }, -- Battle Shout + { spell = 7384, type = "ability", requiresTarget = true, form = 1 }, -- Overpower + { spell = 7386, type = "ability", requiresTarget = true, debuff = true }, -- Sunder Armor + { spell = 12323, type = "ability", debuff = true, talent = 46 }, -- Piercing Howl + { spell = 12328, type = "ability", buff = true, talent = 53 }, -- Sweeping Strikes + { spell = 12294, type = "ability", requiresTarget = true, talent = 20 }, -- Mortal Strike + { spell = 12809, type = "ability", requiresTarget = true, debuff = true, talent = 94 }, -- Concussion Blow + { spell = 12975, type = "ability", buff = true, talent = 86 }, -- Last Stand + { spell = 12292, type = "ability", buff = true, talent = 13 }, -- Death Wish + { spell = 18499, type = "ability", buff = true, form = 3 }, -- Berserker Rage + { spell = 20230, type = "ability", buff = true, form = 1 }, -- Retaliation + { spell = 20252, type = "ability", requiresTarget = true, form = 3 }, -- Intercept + { spell = 20243, type = "ability", requiresTarget = true, talent = 102 }, -- Devastate + { spell = 23881, type = "ability", requiresTarget = true, talent = 58 }, -- Bloodthirst + { spell = 23920, type = "ability", buff = true, form = { 1, 2 } }, -- Spell Reflection + { spell = 23922, type = "ability", requiresTarget = true, talent = 99 }, -- Shield Slam + { spell = 29801, type = "ability", requiresTarget = true, talent = 61 }, -- Rampage + { spell = 34428, type = "ability", requiresTarget = true, usable = true }, -- Victory Rush }, - icon = 132355 + icon = 132355, }, [4] = {}, [5] = {}, @@ -133,11 +133,10 @@ templates.class.WARRIOR = { [7] = {}, [8] = { title = L["Resources"], - args = { - }, + args = {}, icon = rageIcon, - } - } + }, + }, } templates.class.PALADIN = { @@ -145,61 +144,61 @@ templates.class.PALADIN = { [1] = { title = L["Buffs"], args = { - { spell = 498, type = "buff", unit = "player"}, -- Divine Protection - { spell = 642, type = "buff", unit = "player"}, -- Divine Shield - { spell = 1022, type = "buff", unit = "group"}, -- Blessing of Protection - { spell = 1044, type = "buff", unit = "group"}, -- Blessing of Freedom - { spell = 6940, type = "buff", unit = "group"}, -- Blessing of Sacrifice + { spell = 498, type = "buff", unit = "player" }, -- Divine Protection + { spell = 642, type = "buff", unit = "player" }, -- Divine Shield + { spell = 1022, type = "buff", unit = "group" }, -- Blessing of Protection + { spell = 1044, type = "buff", unit = "group" }, -- Blessing of Freedom + { spell = 6940, type = "buff", unit = "group" }, -- Blessing of Sacrifice }, - icon = 135964 + icon = 135964, }, [2] = { title = L["Debuffs"], args = { - { spell = 853, type = "debuff", unit = "target"}, -- Hammer of Justice + { spell = 853, type = "debuff", unit = "target" }, -- Hammer of Justice }, - icon = 135952 + icon = 135952, }, [3] = { title = L["Abilities"], args = { - { spell = 498, type = "ability", buff = true}, -- Divine Protection - { spell = 633, type = "ability"}, -- Lay on Hands - { spell = 642, type = "ability", buff = true}, -- Divine Shield - { spell = 709, type = "ability", buff = true}, -- Righteous Fury - { spell = 853, type = "ability", requiresTarget = true, debuff = true}, -- Hammer of Justice - { spell = 879, type = "ability", requiresTarget = true, usable = true}, -- Exorcism - { spell = 1022, type = "ability", buff = true}, -- Blessing of Protection - { spell = 1044, type = "ability", buff = true}, -- Blessing of Freedom - { spell = 1152, type = "ability"}, -- Purify - { spell = 2812, type = "ability"}, -- Holy Wrath - { spell = 4987, type = "ability"}, -- Cleanse - { spell = 6940, type = "ability"}, -- Blessing of Sacrifice - { spell = 10326, type = "ability", debuff = true, requiresTarget = true, usable = true}, -- Turn Evil - { spell = 19876, type = "ability", buff = true}, -- Shadow Resistance Aura - { spell = 19888, type = "ability", buff = true}, -- Frost Resistance Aura - { spell = 19891, type = "ability", buff = true}, -- Fire Resistance Aura - { spell = 20066, type = "ability", requiresTarget = true, debuff = true, talent = 99}, -- Repentance - { spell = 20164, type = "ability", buff = true}, -- Seal of Justice - { spell = 20165, type = "ability", buff = true}, -- Seal of Light - { spell = 20166, type = "ability", buff = true}, -- Seal of Wisdom - { spell = 20271, type = "ability", buff = true, requiresTarget = true}, -- Judgement - { spell = 20375, type = "ability", buff = true, talent = 88}, -- Seal of Command - { spell = 20473, type = "ability", talent = 17}, -- Holy Shock - { spell = 20925, type = "ability", charges = true, buff = true, talent = 59}, -- Holy Shield - { spell = 21082, type = "ability", buff = true}, -- Seal of the Crusader - { spell = 21084, type = "ability", buff = true}, -- Seal of Righteousness - { spell = 24275, type = "ability", requiresTarget = true, usable = true}, -- Hammer of Wrath - { spell = 26573, type = "ability"}, -- Consecration - { spell = 31789, type = "ability"}, -- Righteous Defense - { spell = 31842, type = "ability", buff = true, talent = 20}, -- Divine Illumination - { spell = 31884, type = "ability", buff = true}, -- Avenging Wrath - { spell = 31892, type = "ability", buff = true}, -- Seal of Blood - { spell = 31935, type = "ability", talent = 62}, -- Avenger's Shield - { spell = 35395, type = "ability", requiresTarget = true, talent = 102}, -- Crusader Strike - { spell = 348704, type = "ability", buff = true}, -- Seal of Vengeance + { spell = 498, type = "ability", buff = true }, -- Divine Protection + { spell = 633, type = "ability" }, -- Lay on Hands + { spell = 642, type = "ability", buff = true }, -- Divine Shield + { spell = 709, type = "ability", buff = true }, -- Righteous Fury + { spell = 853, type = "ability", requiresTarget = true, debuff = true }, -- Hammer of Justice + { spell = 879, type = "ability", requiresTarget = true, usable = true }, -- Exorcism + { spell = 1022, type = "ability", buff = true }, -- Blessing of Protection + { spell = 1044, type = "ability", buff = true }, -- Blessing of Freedom + { spell = 1152, type = "ability" }, -- Purify + { spell = 2812, type = "ability" }, -- Holy Wrath + { spell = 4987, type = "ability" }, -- Cleanse + { spell = 6940, type = "ability" }, -- Blessing of Sacrifice + { spell = 10326, type = "ability", debuff = true, requiresTarget = true, usable = true }, -- Turn Evil + { spell = 19876, type = "ability", buff = true }, -- Shadow Resistance Aura + { spell = 19888, type = "ability", buff = true }, -- Frost Resistance Aura + { spell = 19891, type = "ability", buff = true }, -- Fire Resistance Aura + { spell = 20066, type = "ability", requiresTarget = true, debuff = true, talent = 99 }, -- Repentance + { spell = 20164, type = "ability", buff = true }, -- Seal of Justice + { spell = 20165, type = "ability", buff = true }, -- Seal of Light + { spell = 20166, type = "ability", buff = true }, -- Seal of Wisdom + { spell = 20271, type = "ability", buff = true, requiresTarget = true }, -- Judgement + { spell = 20375, type = "ability", buff = true, talent = 88 }, -- Seal of Command + { spell = 20473, type = "ability", talent = 17 }, -- Holy Shock + { spell = 20925, type = "ability", charges = true, buff = true, talent = 59 }, -- Holy Shield + { spell = 21082, type = "ability", buff = true }, -- Seal of the Crusader + { spell = 21084, type = "ability", buff = true }, -- Seal of Righteousness + { spell = 24275, type = "ability", requiresTarget = true, usable = true }, -- Hammer of Wrath + { spell = 26573, type = "ability" }, -- Consecration + { spell = 31789, type = "ability" }, -- Righteous Defense + { spell = 31842, type = "ability", buff = true, talent = 20 }, -- Divine Illumination + { spell = 31884, type = "ability", buff = true }, -- Avenging Wrath + { spell = 31892, type = "ability", buff = true }, -- Seal of Blood + { spell = 31935, type = "ability", talent = 62 }, -- Avenger's Shield + { spell = 35395, type = "ability", requiresTarget = true, talent = 102 }, -- Crusader Strike + { spell = 348704, type = "ability", buff = true }, -- Seal of Vengeance }, - icon = 135972 + icon = 135972, }, [4] = {}, [5] = {}, @@ -207,11 +206,10 @@ templates.class.PALADIN = { [7] = {}, [8] = { title = L["Resources"], - args = { - }, + args = {}, icon = manaIcon, }, - } + }, } templates.class.HUNTER = { @@ -219,72 +217,72 @@ templates.class.HUNTER = { [1] = { title = L["Buffs"], args = { - { spell = 136, type = "buff", unit = "pet"}, -- Mend Pet - { spell = 3045, type = "buff", unit = "player"}, -- Rapid Fire - { spell = 5384, type = "buff", unit = "player"}, -- Feign Death - { spell = 6197, type = "buff", unit = "player"}, -- Eagle Eye - { spell = 19621, type = "buff", unit = "pet"}, -- Frenzy - { spell = 24450, type = "buff", unit = "pet"}, -- Prowl + { spell = 136, type = "buff", unit = "pet" }, -- Mend Pet + { spell = 3045, type = "buff", unit = "player" }, -- Rapid Fire + { spell = 5384, type = "buff", unit = "player" }, -- Feign Death + { spell = 6197, type = "buff", unit = "player" }, -- Eagle Eye + { spell = 19621, type = "buff", unit = "pet" }, -- Frenzy + { spell = 24450, type = "buff", unit = "pet" }, -- Prowl }, - icon = 132242 + icon = 132242, }, [2] = { title = L["Debuffs"], args = { - { spell = 1130, type = "debuff", unit = "target"}, -- Hunter's Mark - { spell = 1513, type = "debuff", unit = "target"}, -- Scare Beast - { spell = 1978, type = "debuff", unit = "target"}, -- Serpent Sting - { spell = 2649, type = "debuff", unit = "target"}, -- Growl - { spell = 2974, type = "debuff", unit = "target"}, -- Wing Clip - { spell = 3034, type = "debuff", unit = "target"}, -- Viper Sting - { spell = 3043, type = "debuff", unit = "target"}, -- Scorpid Sting - { spell = 3355, type = "debuff", unit = "multi"}, -- Freezing Trap - { spell = 5116, type = "debuff", unit = "target"}, -- Concussive Shot - { spell = 24394, type = "debuff", unit = "target"}, -- Intimidation + { spell = 1130, type = "debuff", unit = "target" }, -- Hunter's Mark + { spell = 1513, type = "debuff", unit = "target" }, -- Scare Beast + { spell = 1978, type = "debuff", unit = "target" }, -- Serpent Sting + { spell = 2649, type = "debuff", unit = "target" }, -- Growl + { spell = 2974, type = "debuff", unit = "target" }, -- Wing Clip + { spell = 3034, type = "debuff", unit = "target" }, -- Viper Sting + { spell = 3043, type = "debuff", unit = "target" }, -- Scorpid Sting + { spell = 3355, type = "debuff", unit = "multi" }, -- Freezing Trap + { spell = 5116, type = "debuff", unit = "target" }, -- Concussive Shot + { spell = 24394, type = "debuff", unit = "target" }, -- Intimidation }, - icon = 135860 + icon = 135860, }, [3] = { title = L["Abilities"], args = { - { spell = 781, type = "ability"}, -- Disengage - { spell = 1130, type = "ability", requiresTarget = true, debuff = true}, -- Hunter's Mark - { spell = 1495, type = "ability", requiresTarget = true, usable = true}, -- Mongoose Bite - { spell = 1499, type = "ability"}, -- Freezing Trap - { spell = 1510, type = "ability"}, -- Volley - { spell = 1513, type = "ability", requiresTarget = true, debuff = true}, -- Scare Beast - { spell = 1543, type = "ability", duration = 30}, -- Flare - { spell = 1978, type = "ability", requiresTarget = true, debuff = true}, -- Serpent Sting - { spell = 2643, type = "ability"}, -- Multi-Shot - { spell = 2649, type = "ability", requiresTarget = true, debuff = true}, -- Growl - { spell = 2973, type = "ability", queued = true}, -- Raptor Strike - { spell = 2974, type = "ability", requiresTarget = true, debuff = true}, -- Wing Clip - { spell = 3034, type = "ability", requiresTarget = true, debuff = true}, -- Viper Sting - { spell = 3043, type = "ability", requiresTarget = true, debuff = true}, -- Scorpid Sting - { spell = 3044, type = "ability", requiresTarget = true}, -- Arcane Shot - { spell = 3045, type = "ability", buff = true}, -- Rapid Fire - { spell = 5116, type = "ability", requiresTarget = true, debuff = true}, -- Concussive Shot - { spell = 5384, type = "ability", buff = true, unit = "player"}, -- Feign Death - { spell = 13795, type = "ability"}, -- Immolation Trap - { spell = 13809, type = "ability"}, -- Frost Trap - { spell = 13813, type = "ability"}, -- Explosive Trap - { spell = 16827, type = "ability", requiresTarget = true}, -- Claw - { spell = 19263, type = "ability", buff = true}, -- Deterrence -TODO - { spell = 19306, type = "ability", requiresTarget = true, usable = true, talent = 96}, -- Counterattack - { spell = 19434, type = "ability", requiresTarget = true, talent = 47}, -- Aimed Shot - { spell = 19386, type = "ability", requiresTarget = true, debuff = true, talent = 100}, -- Wyvern Sting - { spell = 19503, type = "ability", requiresTarget = true, debuff = true, talent = 52}, -- Scatter Shot - { spell = 19574, type = "ability", buff = true, talent = 18}, -- Bestial Wrath - { spell = 19577, type = "ability", requiresTarget = true, debuff = true, talent = 13}, -- Intimidation - { spell = 19801, type = "ability", requiresTarget = true}, -- Tranquilizing Shot - { spell = 20736, type = "ability", requiresTarget = true}, -- Distracting Shot - { spell = 23989, type = "ability", talent = 103}, -- Readiness - { spell = 34120, type = "ability", requiresTarget = true}, -- Steady Shot - { spell = 34477, type = "ability", requiresTarget = true, debuff = true}, -- Misdirection - { spell = 34490, type = "ability", requiresTarget = true, debuff = true, talent = 60}, -- Silencing Shot - { spell = 34600, type = "ability"}, -- Snake Trap + { spell = 781, type = "ability" }, -- Disengage + { spell = 1130, type = "ability", requiresTarget = true, debuff = true }, -- Hunter's Mark + { spell = 1495, type = "ability", requiresTarget = true, usable = true }, -- Mongoose Bite + { spell = 1499, type = "ability" }, -- Freezing Trap + { spell = 1510, type = "ability" }, -- Volley + { spell = 1513, type = "ability", requiresTarget = true, debuff = true }, -- Scare Beast + { spell = 1543, type = "ability", duration = 30 }, -- Flare + { spell = 1978, type = "ability", requiresTarget = true, debuff = true }, -- Serpent Sting + { spell = 2643, type = "ability" }, -- Multi-Shot + { spell = 2649, type = "ability", requiresTarget = true, debuff = true }, -- Growl + { spell = 2973, type = "ability", queued = true }, -- Raptor Strike + { spell = 2974, type = "ability", requiresTarget = true, debuff = true }, -- Wing Clip + { spell = 3034, type = "ability", requiresTarget = true, debuff = true }, -- Viper Sting + { spell = 3043, type = "ability", requiresTarget = true, debuff = true }, -- Scorpid Sting + { spell = 3044, type = "ability", requiresTarget = true }, -- Arcane Shot + { spell = 3045, type = "ability", buff = true }, -- Rapid Fire + { spell = 5116, type = "ability", requiresTarget = true, debuff = true }, -- Concussive Shot + { spell = 5384, type = "ability", buff = true, unit = "player" }, -- Feign Death + { spell = 13795, type = "ability" }, -- Immolation Trap + { spell = 13809, type = "ability" }, -- Frost Trap + { spell = 13813, type = "ability" }, -- Explosive Trap + { spell = 16827, type = "ability", requiresTarget = true }, -- Claw + { spell = 19263, type = "ability", buff = true }, -- Deterrence -TODO + { spell = 19306, type = "ability", requiresTarget = true, usable = true, talent = 96 }, -- Counterattack + { spell = 19434, type = "ability", requiresTarget = true, talent = 47 }, -- Aimed Shot + { spell = 19386, type = "ability", requiresTarget = true, debuff = true, talent = 100 }, -- Wyvern Sting + { spell = 19503, type = "ability", requiresTarget = true, debuff = true, talent = 52 }, -- Scatter Shot + { spell = 19574, type = "ability", buff = true, talent = 18 }, -- Bestial Wrath + { spell = 19577, type = "ability", requiresTarget = true, debuff = true, talent = 13 }, -- Intimidation + { spell = 19801, type = "ability", requiresTarget = true }, -- Tranquilizing Shot + { spell = 20736, type = "ability", requiresTarget = true }, -- Distracting Shot + { spell = 23989, type = "ability", talent = 103 }, -- Readiness + { spell = 34120, type = "ability", requiresTarget = true }, -- Steady Shot + { spell = 34477, type = "ability", requiresTarget = true, debuff = true }, -- Misdirection + { spell = 34490, type = "ability", requiresTarget = true, debuff = true, talent = 60 }, -- Silencing Shot + { spell = 34600, type = "ability" }, -- Snake Trap }, - icon = 135130 + icon = 135130, }, [4] = {}, [5] = {}, @@ -292,11 +290,10 @@ templates.class.HUNTER = { [7] = {}, [8] = { title = L["Resources"], - args = { - }, + args = {}, icon = manaIcon, }, - } + }, } templates.class.ROGUE = { @@ -304,63 +301,63 @@ templates.class.ROGUE = { [1] = { title = L["Buffs"], args = { - { spell = 2983, type = "buff", unit = "player"}, -- Sprint - { spell = 5171, type = "buff", unit = "player"}, -- Slice and Dice - { spell = 5277, type = "buff", unit = "player"}, -- Evasion - { spell = 13750, type = "buff", unit = "player"}, -- Adrenaline Rush - { spell = 13877, type = "buff", unit = "player"}, -- Blade Fury - { spell = 14177, type = "buff", unit = "player"}, -- Cold Blood - { spell = 14149, type = "buff", unit = "player"}, -- Remorseless - { spell = 14278, type = "buff", unit = "player"}, -- Ghostly Strike + { spell = 2983, type = "buff", unit = "player" }, -- Sprint + { spell = 5171, type = "buff", unit = "player" }, -- Slice and Dice + { spell = 5277, type = "buff", unit = "player" }, -- Evasion + { spell = 13750, type = "buff", unit = "player" }, -- Adrenaline Rush + { spell = 13877, type = "buff", unit = "player" }, -- Blade Fury + { spell = 14177, type = "buff", unit = "player" }, -- Cold Blood + { spell = 14149, type = "buff", unit = "player" }, -- Remorseless + { spell = 14278, type = "buff", unit = "player" }, -- Ghostly Strike }, - icon = 132290 + icon = 132290, }, [2] = { title = L["Debuffs"], args = { - { spell = 703, type = "debuff", unit = "target"}, -- Garrote - { spell = 8643, type = "debuff", unit = "target"}, -- Kidney SHot - { spell = 14251, type = "debuff", unit = "target"}, -- Riposte - { spell = 11198, type = "debuff", unit = "target"}, -- Expose Armor - { spell = 18425, type = "debuff", unit = "target"}, -- Kick - Silenced - { spell = 17348, type = "debuff", unit = "target"}, -- Hemorrhage - { spell = 14183, type = "debuff", unit = "target"}, -- Premeditation + { spell = 703, type = "debuff", unit = "target" }, -- Garrote + { spell = 8643, type = "debuff", unit = "target" }, -- Kidney SHot + { spell = 14251, type = "debuff", unit = "target" }, -- Riposte + { spell = 11198, type = "debuff", unit = "target" }, -- Expose Armor + { spell = 18425, type = "debuff", unit = "target" }, -- Kick - Silenced + { spell = 17348, type = "debuff", unit = "target" }, -- Hemorrhage + { spell = 14183, type = "debuff", unit = "target" }, -- Premeditation }, - icon = 132302 + icon = 132302, }, [3] = { title = L["Abilities"], args = { - { spell = 53, type = "ability", requiresTarget = true, usable = true}, -- Backstab - { spell = 703, type = "ability", requiresTarget = true, debuff = true}, -- Garrote - { spell = 921, type = "ability", requiresTarget = true, usable = true}, -- Pick Pocket - { spell = 1329, type = "ability", requiresTarget = true, usable = true, talent = 21}, -- Mutilate - { spell = 1725, type = "ability"}, -- Distract - { spell = 1752, type = "ability", requiresTarget = true}, -- Sinister Strike - { spell = 1766, type = "ability", requiresTarget = true}, -- Kick - { spell = 1776, type = "ability", requiresTarget = true, usable = true, debuff = true}, -- Gouge - { spell = 1784, type = "ability", buff = true}, -- Stealth - { spell = 1856, type = "ability", buff = true}, -- Vanish - { spell = 2094, type = "ability", requiresTarget = true, debuff = true}, -- Blind - { spell = 2098, type = "ability", requiresTarget = true}, -- Eviscerate - { spell = 2983, type = "ability", buff = true}, -- Sprint - { spell = 5171, type = "ability", requiresTarget = true, buff = true}, -- Slice and Dice - { spell = 5277, type = "ability", buff = true}, -- Evasion - { spell = 6770, type = "ability", requiresTarget = true, usable = true, debuff = true}, -- Sap - { spell = 8643, type = "ability", requiresTarget = true, usable = true, debuff = true}, -- Kidney Shot - { spell = 8647, type = "ability", requiresTarget = true, debuff = true}, -- Expose Armor - { spell = 13750, type = "ability", buff = true, talent = 61}, -- Adrenaline Rush - { spell = 13877, type = "ability", buff = true, talent = 54}, -- Blade Fury - { spell = 14177, type = "ability", buff = true, talent = 13}, -- Cold Blood - { spell = 14183, type = "ability", requiresTarget = true, debuff = true, talent = 99}, -- Premeditation - { spell = 14185, type = "ability"}, -- Preparation - { spell = 14251, type = "ability", requiresTarget = true, usable = true, debuff = true, talent = 48}, -- Riposte - { spell = 14271, type = "ability", requiresTarget = true, buff = true, talent = 87}, -- Ghostly Strike - { spell = 16511, type = "ability", requiresTarget = true, debuff = true, talent = 95}, -- Hemorrhage - { spell = 31224, type = "ability", buff = true}, -- Cloak of Shadows - { spell = 36554, type = "ability", requiresTarget = true, talent = 102}, -- Shadowstep + { spell = 53, type = "ability", requiresTarget = true, usable = true }, -- Backstab + { spell = 703, type = "ability", requiresTarget = true, debuff = true }, -- Garrote + { spell = 921, type = "ability", requiresTarget = true, usable = true }, -- Pick Pocket + { spell = 1329, type = "ability", requiresTarget = true, usable = true, talent = 21 }, -- Mutilate + { spell = 1725, type = "ability" }, -- Distract + { spell = 1752, type = "ability", requiresTarget = true }, -- Sinister Strike + { spell = 1766, type = "ability", requiresTarget = true }, -- Kick + { spell = 1776, type = "ability", requiresTarget = true, usable = true, debuff = true }, -- Gouge + { spell = 1784, type = "ability", buff = true }, -- Stealth + { spell = 1856, type = "ability", buff = true }, -- Vanish + { spell = 2094, type = "ability", requiresTarget = true, debuff = true }, -- Blind + { spell = 2098, type = "ability", requiresTarget = true }, -- Eviscerate + { spell = 2983, type = "ability", buff = true }, -- Sprint + { spell = 5171, type = "ability", requiresTarget = true, buff = true }, -- Slice and Dice + { spell = 5277, type = "ability", buff = true }, -- Evasion + { spell = 6770, type = "ability", requiresTarget = true, usable = true, debuff = true }, -- Sap + { spell = 8643, type = "ability", requiresTarget = true, usable = true, debuff = true }, -- Kidney Shot + { spell = 8647, type = "ability", requiresTarget = true, debuff = true }, -- Expose Armor + { spell = 13750, type = "ability", buff = true, talent = 61 }, -- Adrenaline Rush + { spell = 13877, type = "ability", buff = true, talent = 54 }, -- Blade Fury + { spell = 14177, type = "ability", buff = true, talent = 13 }, -- Cold Blood + { spell = 14183, type = "ability", requiresTarget = true, debuff = true, talent = 99 }, -- Premeditation + { spell = 14185, type = "ability" }, -- Preparation + { spell = 14251, type = "ability", requiresTarget = true, usable = true, debuff = true, talent = 48 }, -- Riposte + { spell = 14271, type = "ability", requiresTarget = true, buff = true, talent = 87 }, -- Ghostly Strike + { spell = 16511, type = "ability", requiresTarget = true, debuff = true, talent = 95 }, -- Hemorrhage + { spell = 31224, type = "ability", buff = true }, -- Cloak of Shadows + { spell = 36554, type = "ability", requiresTarget = true, talent = 102 }, -- Shadowstep }, - icon = 132350 + icon = 132350, }, [4] = {}, [5] = {}, @@ -368,11 +365,10 @@ templates.class.ROGUE = { [7] = {}, [8] = { title = L["Resources"], - args = { - }, + args = {}, icon = comboPointsIcon, }, - } + }, } templates.class.PRIEST = { @@ -380,58 +376,58 @@ templates.class.PRIEST = { [1] = { title = L["Buffs"], args = { - { spell = 586, type = "buff", unit = "player"}, -- Fade - { spell = 17, type = "buff", unit = "target"}, -- Power Word: Shield - { spell = 21562, type = "buff", unit = "player"}, -- Power Word: Fortitude - { spell = 2096, type = "buff", unit = "player"}, -- Mind Vision - { spell = 1706, type = "buff", unit = "player"}, -- Levitate + { spell = 586, type = "buff", unit = "player" }, -- Fade + { spell = 17, type = "buff", unit = "target" }, -- Power Word: Shield + { spell = 21562, type = "buff", unit = "player" }, -- Power Word: Fortitude + { spell = 2096, type = "buff", unit = "player" }, -- Mind Vision + { spell = 1706, type = "buff", unit = "player" }, -- Levitate }, - icon = 135940 + icon = 135940, }, [2] = { title = L["Debuffs"], args = { - { spell = 8122, type = "debuff", unit = "target"}, -- Psychic Scream - { spell = 2096, type = "debuff", unit = "target"}, -- Mind Vision - { spell = 589, type = "debuff", unit = "target"}, -- Shadow Word: Pain + { spell = 8122, type = "debuff", unit = "target" }, -- Psychic Scream + { spell = 2096, type = "debuff", unit = "target" }, -- Mind Vision + { spell = 589, type = "debuff", unit = "target" }, -- Shadow Word: Pain { spell = 9484, type = "debuff", unit = "multi" }, -- Shackle Undead - { spell = 34914, type = "debuff", unit = "target", talent = 101}, -- Vampiric Touch + { spell = 34914, type = "debuff", unit = "target", talent = 101 }, -- Vampiric Touch }, - icon = 136207 + icon = 136207, }, [3] = { title = L["Abilities"], args = { - { spell = 17, type = "ability"}, -- Power Word: Shield - { spell = 527, type = "ability"}, -- Purify - { spell = 552, type = "ability"}, -- Abolish Disease - { spell = 585, type = "ability", requireTarget = true}, -- Smite - { spell = 586, type = "ability", buff = true}, -- Fade - { spell = 589, type = "ability", requireTarget = true, debuff = true}, -- Shadow Word: Pain - { spell = 2060, type = "ability"}, -- Greater Heal - { spell = 2061, type = "ability"}, -- Flash Heal - { spell = 6064, type = "ability"}, -- Heal - { spell = 6346, type = "ability", buff = true}, -- Fear Ward - { spell = 8092, type = "ability", requireTarget = true}, -- Mind Blast - { spell = 8122, type = "ability"}, -- Psychic Scream - { spell = 8129, type = "ability", requireTarget = true}, -- Mana Burn - { spell = 10060, type = "ability", buff = true, talent = 19}, -- Power Infusion - { spell = 10876, type = "ability", requireTarget = true}, -- Mana Burn - { spell = 10947, type = "ability", requireTarget = true}, -- Mind Flay - { spell = 10951, type = "ability", buff = true}, -- Inner Fire - { spell = 14751, type = "ability", buff = true, talent = 8}, -- Inner Focus - { spell = 14914, type = "ability", debuff = true, requireTarget = true}, -- Holy Fire - { spell = 15487, type = "ability", debuff = true, requireTarget = true, talent = 92}, -- Silence - { spell = 33206, type = "ability", buff = true, talent = 22}, -- Pain Suppression - { spell = 32375, type = "ability"}, -- Mass Dispel - { spell = 32379, type = "ability", requireTarget = true}, -- Shadow Word: Death - { spell = 32546, type = "ability"}, -- Binding Heal - { spell = 33076, type = "ability"}, -- Prayer of Mending - { spell = 34433, type = "ability", totem = true}, -- Shadowfiend - { spell = 34861, type = "ability", talent = 61}, -- Circle of Healing - { spell = 34914, type = "ability", debuff = true, requireTarget = true, talent = 101}, -- Vampiric Touch + { spell = 17, type = "ability" }, -- Power Word: Shield + { spell = 527, type = "ability" }, -- Purify + { spell = 552, type = "ability" }, -- Abolish Disease + { spell = 585, type = "ability", requireTarget = true }, -- Smite + { spell = 586, type = "ability", buff = true }, -- Fade + { spell = 589, type = "ability", requireTarget = true, debuff = true }, -- Shadow Word: Pain + { spell = 2060, type = "ability" }, -- Greater Heal + { spell = 2061, type = "ability" }, -- Flash Heal + { spell = 6064, type = "ability" }, -- Heal + { spell = 6346, type = "ability", buff = true }, -- Fear Ward + { spell = 8092, type = "ability", requireTarget = true }, -- Mind Blast + { spell = 8122, type = "ability" }, -- Psychic Scream + { spell = 8129, type = "ability", requireTarget = true }, -- Mana Burn + { spell = 10060, type = "ability", buff = true, talent = 19 }, -- Power Infusion + { spell = 10876, type = "ability", requireTarget = true }, -- Mana Burn + { spell = 10947, type = "ability", requireTarget = true }, -- Mind Flay + { spell = 10951, type = "ability", buff = true }, -- Inner Fire + { spell = 14751, type = "ability", buff = true, talent = 8 }, -- Inner Focus + { spell = 14914, type = "ability", debuff = true, requireTarget = true }, -- Holy Fire + { spell = 15487, type = "ability", debuff = true, requireTarget = true, talent = 92 }, -- Silence + { spell = 33206, type = "ability", buff = true, talent = 22 }, -- Pain Suppression + { spell = 32375, type = "ability" }, -- Mass Dispel + { spell = 32379, type = "ability", requireTarget = true }, -- Shadow Word: Death + { spell = 32546, type = "ability" }, -- Binding Heal + { spell = 33076, type = "ability" }, -- Prayer of Mending + { spell = 34433, type = "ability", totem = true }, -- Shadowfiend + { spell = 34861, type = "ability", talent = 61 }, -- Circle of Healing + { spell = 34914, type = "ability", debuff = true, requireTarget = true, talent = 101 }, -- Vampiric Touch }, - icon = 136224 + icon = 136224, }, [4] = {}, [5] = {}, @@ -439,11 +435,10 @@ templates.class.PRIEST = { [7] = {}, [8] = { title = L["Resources"], - args = { - }, + args = {}, icon = manaIcon, }, - } + }, } templates.class.SHAMAN = { @@ -451,76 +446,76 @@ templates.class.SHAMAN = { [1] = { title = L["Buffs"], args = { - { spell = 546, type = "buff", unit = "player"}, -- Water Walking - { spell = 16256, type = "buff", unit = "player", talent = 50}, -- Flurry + { spell = 546, type = "buff", unit = "player" }, -- Water Walking + { spell = 16256, type = "buff", unit = "player", talent = 50 }, -- Flurry }, - icon = 135863 + icon = 135863, }, [2] = { title = L["Debuffs"], args = { - { spell = 3600, type = "debuff", unit = "target"}, -- Earthbind + { spell = 3600, type = "debuff", unit = "target" }, -- Earthbind }, - icon = 135813 + icon = 135813, }, [3] = { title = L["Abilities"], args = { - { spell = 131, type = "ability", buff = true, usable = true}, -- Water Breathing - { spell = 324, type = "ability", buff = true}, -- Lightning Shield - { spell = 331, type = "ability"}, -- Healing Wave - { spell = 403, type = "ability", requireTarget = true}, -- Lightning Bolt - { spell = 421, type = "ability", requireTarget = true}, -- Chain Lightning - { spell = 546, type = "ability", buff = true, usable = true}, -- Water Walking - { spell = 556, type = "ability"}, -- Astral Recall - { spell = 974, type = "ability", buff = true, talent = 100}, -- Earth Shield - { spell = 1064, type = "ability"}, -- Chain Heal - { spell = 1535, type = "ability", totem = true}, -- Fire Nova Totem - { spell = 2008, type = "ability"}, -- Ancestral Spirit - { spell = 2062, type = "ability", totem = true}, -- Earth Elemental Totem - { spell = 2484, type = "ability", totem = true}, -- Earthbind Totem - { spell = 2645, type = "ability", buff = true}, -- Ghost Wolf - { spell = 2825, type = "ability", buff = true}, -- Bloodlust - { spell = 2894, type = "ability", totem = true}, -- Fire Elemental Totem - { spell = 3599, type = "ability", totem = true}, -- Searing Totem - { spell = 3738, type = "ability", totem = true}, -- Wrath of Air Totem - { spell = 5394, type = "ability", totem = true}, -- Healing Stream Totem - { spell = 5675, type = "ability", totem = true}, -- Mana Spring Totem - { spell = 5730, type = "ability", totem = true}, -- Stoneclaw Totem - { spell = 6495, type = "ability", totem = true}, -- Sentry Totem - { spell = 8142, type = "ability", requireTarget = true}, -- Earth Shock - { spell = 8143, type = "ability", requireTarget = true, debuff = true}, -- Frost Shock - { spell = 8017, type = "ability", weaponBuff = true}, -- Rockbiter Weapon -- !! weaponBuff is not supported yet - { spell = 8024, type = "ability", weaponBuff = true}, -- Flametongue Weapon - { spell = 8033, type = "ability", weaponBuff = true}, -- Frostbrand Weapon - { spell = 8050, type = "ability", requireTarget = true, debuff = true}, -- Flame Shock - { spell = 8071, type = "ability", totem = true}, -- Stoneskin Totem - { spell = 8075, type = "ability", totem = true}, -- Strength of Earth Totem - { spell = 8143, type = "ability", totem = true}, -- Tremor Totem - { spell = 8166, type = "ability", totem = true}, -- Poison Cleansing Totem - { spell = 8170, type = "ability", totem = true}, -- Disease Cleansing Totem - { spell = 8177, type = "ability", totem = true}, -- Grounding Totem - { spell = 8181, type = "ability", totem = true}, -- Frost Resistance Totem - { spell = 8184, type = "ability", totem = true}, -- Fire Resistance Totem - { spell = 8190, type = "ability", totem = true}, -- Magma Totem - { spell = 8227, type = "ability", totem = true}, -- Flametongue Totem - { spell = 8514, type = "ability", totem = true}, -- Windfury Totem - { spell = 8835, type = "ability", totem = true}, -- Grace of Air Totem - { spell = 10595, type = "ability", totem = true}, -- Nature Resistance Totem - { spell = 15107, type = "ability", totem = true}, -- Windwall Totem - { spell = 16246, type = "ability", buff = true, talent = 6}, -- Clearcasting - { spell = 16166, type = "ability", buff = true, talent = 17}, -- Elemental Mastery - { spell = 16188, type = "ability", buff = true, talent = 93}, -- Nature Swiftness - { spell = 16190, type = "ability", totem = true, talent = 96}, -- Mana Tide Totem - { spell = 17364, type = "ability", debuff = true, talent = 59}, -- Stormstrike - { spell = 20608, type = "ability"}, -- Reincarnation - { spell = 24398, type = "ability", buff = true}, -- Water Shield - { spell = 25908, type = "ability", totem = true}, -- Tranquil Air Totem - { spell = 30706, type = "ability", totem = true, talent = 20}, -- Totem of Wrath - { spell = 30823, type = "buff", talent = 61}, -- Shamanistic Rage - { spell = 32182, type = "ability", buff = true}, -- Heroism + { spell = 131, type = "ability", buff = true, usable = true }, -- Water Breathing + { spell = 324, type = "ability", buff = true }, -- Lightning Shield + { spell = 331, type = "ability" }, -- Healing Wave + { spell = 403, type = "ability", requireTarget = true }, -- Lightning Bolt + { spell = 421, type = "ability", requireTarget = true }, -- Chain Lightning + { spell = 546, type = "ability", buff = true, usable = true }, -- Water Walking + { spell = 556, type = "ability" }, -- Astral Recall + { spell = 974, type = "ability", buff = true, talent = 100 }, -- Earth Shield + { spell = 1064, type = "ability" }, -- Chain Heal + { spell = 1535, type = "ability", totem = true }, -- Fire Nova Totem + { spell = 2008, type = "ability" }, -- Ancestral Spirit + { spell = 2062, type = "ability", totem = true }, -- Earth Elemental Totem + { spell = 2484, type = "ability", totem = true }, -- Earthbind Totem + { spell = 2645, type = "ability", buff = true }, -- Ghost Wolf + { spell = 2825, type = "ability", buff = true }, -- Bloodlust + { spell = 2894, type = "ability", totem = true }, -- Fire Elemental Totem + { spell = 3599, type = "ability", totem = true }, -- Searing Totem + { spell = 3738, type = "ability", totem = true }, -- Wrath of Air Totem + { spell = 5394, type = "ability", totem = true }, -- Healing Stream Totem + { spell = 5675, type = "ability", totem = true }, -- Mana Spring Totem + { spell = 5730, type = "ability", totem = true }, -- Stoneclaw Totem + { spell = 6495, type = "ability", totem = true }, -- Sentry Totem + { spell = 8142, type = "ability", requireTarget = true }, -- Earth Shock + { spell = 8143, type = "ability", requireTarget = true, debuff = true }, -- Frost Shock + { spell = 8017, type = "ability", weaponBuff = true }, -- Rockbiter Weapon -- !! weaponBuff is not supported yet + { spell = 8024, type = "ability", weaponBuff = true }, -- Flametongue Weapon + { spell = 8033, type = "ability", weaponBuff = true }, -- Frostbrand Weapon + { spell = 8050, type = "ability", requireTarget = true, debuff = true }, -- Flame Shock + { spell = 8071, type = "ability", totem = true }, -- Stoneskin Totem + { spell = 8075, type = "ability", totem = true }, -- Strength of Earth Totem + { spell = 8143, type = "ability", totem = true }, -- Tremor Totem + { spell = 8166, type = "ability", totem = true }, -- Poison Cleansing Totem + { spell = 8170, type = "ability", totem = true }, -- Disease Cleansing Totem + { spell = 8177, type = "ability", totem = true }, -- Grounding Totem + { spell = 8181, type = "ability", totem = true }, -- Frost Resistance Totem + { spell = 8184, type = "ability", totem = true }, -- Fire Resistance Totem + { spell = 8190, type = "ability", totem = true }, -- Magma Totem + { spell = 8227, type = "ability", totem = true }, -- Flametongue Totem + { spell = 8514, type = "ability", totem = true }, -- Windfury Totem + { spell = 8835, type = "ability", totem = true }, -- Grace of Air Totem + { spell = 10595, type = "ability", totem = true }, -- Nature Resistance Totem + { spell = 15107, type = "ability", totem = true }, -- Windwall Totem + { spell = 16246, type = "ability", buff = true, talent = 6 }, -- Clearcasting + { spell = 16166, type = "ability", buff = true, talent = 17 }, -- Elemental Mastery + { spell = 16188, type = "ability", buff = true, talent = 93 }, -- Nature Swiftness + { spell = 16190, type = "ability", totem = true, talent = 96 }, -- Mana Tide Totem + { spell = 17364, type = "ability", debuff = true, talent = 59 }, -- Stormstrike + { spell = 20608, type = "ability" }, -- Reincarnation + { spell = 24398, type = "ability", buff = true }, -- Water Shield + { spell = 25908, type = "ability", totem = true }, -- Tranquil Air Totem + { spell = 30706, type = "ability", totem = true, talent = 20 }, -- Totem of Wrath + { spell = 30823, type = "buff", talent = 61 }, -- Shamanistic Rage + { spell = 32182, type = "ability", buff = true }, -- Heroism }, - icon = 135963 + icon = 135963, }, [4] = {}, [5] = {}, @@ -528,11 +523,10 @@ templates.class.SHAMAN = { [7] = {}, [8] = { title = L["Resources"], - args = { - }, + args = {}, icon = 135990, }, - } + }, } templates.class.MAGE = { @@ -540,73 +534,73 @@ templates.class.MAGE = { [1] = { title = L["Buffs"], args = { - { spell = 130, type = "buff", unit = "player"}, -- Slow Fall - { spell = 543, type = "buff", unit = "player"}, -- Fire Ward - { spell = 604, type = "buff", unit = "player"}, -- Dampen Magic - { spell = 1008, type = "buff", unit = "player"}, -- Amplify Magic - { spell = 1459, type = "buff", unit = "player"}, -- Arcane Intellect - { spell = 1463, type = "buff", unit = "player"}, -- Mana Shield - { spell = 6143, type = "buff", unit = "player"}, -- Frost Ward - { spell = 12042, type = "buff", unit = "player"}, -- Arcane Power - { spell = 12536, type = "buff", unit = "player"}, -- Clearcasting - { spell = 45438, type = "buff", unit = "player"}, -- Ice Block + { spell = 130, type = "buff", unit = "player" }, -- Slow Fall + { spell = 543, type = "buff", unit = "player" }, -- Fire Ward + { spell = 604, type = "buff", unit = "player" }, -- Dampen Magic + { spell = 1008, type = "buff", unit = "player" }, -- Amplify Magic + { spell = 1459, type = "buff", unit = "player" }, -- Arcane Intellect + { spell = 1463, type = "buff", unit = "player" }, -- Mana Shield + { spell = 6143, type = "buff", unit = "player" }, -- Frost Ward + { spell = 12042, type = "buff", unit = "player" }, -- Arcane Power + { spell = 12536, type = "buff", unit = "player" }, -- Clearcasting + { spell = 45438, type = "buff", unit = "player" }, -- Ice Block }, - icon = 136096 + icon = 136096, }, [2] = { title = L["Debuffs"], args = { - { spell = 122, type = "debuff", unit = "target"}, -- Frost Nova + { spell = 122, type = "debuff", unit = "target" }, -- Frost Nova { spell = 118, type = "debuff", unit = "multi" }, -- Polymorph - { spell = 11071, type = "debuff", unit = "target"}, -- Frostbite - { spell = 11103, type = "debuff", unit = "target"}, -- Impact - { spell = 11180, type = "debuff", unit = "target"}, -- Winter's Chill + { spell = 11071, type = "debuff", unit = "target" }, -- Frostbite + { spell = 11103, type = "debuff", unit = "target" }, -- Impact + { spell = 11180, type = "debuff", unit = "target" }, -- Winter's Chill }, - icon = 135848 + icon = 135848, }, [3] = { title = L["Abilities"], args = { - { spell = 66, type = "ability", buff = true, buffId = 32612}, -- Invisibility - { spell = 116, type = "ability", requiresTarget = true}, -- Frostbolt - { spell = 118, type = "ability", debuff = true, requireTarget = true}, -- Polymorph - { spell = 120, type = "ability"}, -- Cone of Cold - { spell = 122, type = "ability"}, -- Frost Nova - { spell = 130, type = "ability", buff = true}, -- Slow Fall - { spell = 168, type = "ability", buff = true}, -- Frost Armor - { spell = 475, type = "ability"}, -- Remove Curse - { spell = 543, type = "ability", buff = true}, -- Fire Ward - { spell = 1449, type = "ability"}, -- Arcane Explosion - { spell = 1463, type = "ability", buff = true}, -- Mana Shield - { spell = 1953, type = "ability"}, -- Blink - { spell = 2120, type = "ability"}, -- Flamestrike - { spell = 2136, type = "ability", requiresTarget = true}, -- Fire Blast - { spell = 2139, type = "ability", requiresTarget = true}, -- Counterspell - { spell = 2855, type = "ability", debuff = true, requireTarget = true}, -- Detect Magic - { spell = 2948, type = "ability", requiresTarget = true}, -- Scorch - { spell = 5143, type = "ability", requiresTarget = true}, -- Arcane Missiles - { spell = 6117, type = "ability", buff = true}, -- Mage Armor - { spell = 6143, type = "ability", buff = true}, -- Frost Ward - { spell = 10187, type = "ability"}, -- Blizzard - { spell = 11113, type = "ability", debuff = true, talent = 55}, -- Blast Wave - { spell = 11129, type = "ability", buff = true, talent = 59}, -- Combustion - { spell = 11426, type = "ability", buff = true, talent = 99}, -- ice Barrier - { spell = 11958, type = "ability", talent = 95}, -- Cold Snap - { spell = 12042, type = "ability", buff = true, talent = 16}, -- Arcane Power - { spell = 12043, type = "ability", buff = true, talent = 13}, -- Presence of Mind - { spell = 12051, type = "ability"}, -- Evocation - { spell = 14272, type = "ability", buff = true, talent = 89}, -- Icy Veins - { spell = 18809, type = "ability", requiresTarget = true}, -- Pyroblast - { spell = 25304, type = "ability", requiresTarget = true}, -- Frostbolt - { spell = 30449, type = "ability", requiresTarget = true}, -- Spellsteal - { spell = 30451, type = "ability", requiresTarget = true}, -- Arcane Blast - { spell = 30482, type = "ability", buff = true}, -- Molten Armor - { spell = 31661, type = "ability", buff = true}, -- Dragon's Breath - { spell = 31687, type = "ability", totem = true, talent = 102}, -- Summon Water Elemental - { spell = 34589, type = "ability", requireTarget = true, debuff = true, talent = 23}, -- Slow - { spell = 45438, type = "ability", buff = true}, -- Ice Block + { spell = 66, type = "ability", buff = true, buffId = 32612 }, -- Invisibility + { spell = 116, type = "ability", requiresTarget = true }, -- Frostbolt + { spell = 118, type = "ability", debuff = true, requireTarget = true }, -- Polymorph + { spell = 120, type = "ability" }, -- Cone of Cold + { spell = 122, type = "ability" }, -- Frost Nova + { spell = 130, type = "ability", buff = true }, -- Slow Fall + { spell = 168, type = "ability", buff = true }, -- Frost Armor + { spell = 475, type = "ability" }, -- Remove Curse + { spell = 543, type = "ability", buff = true }, -- Fire Ward + { spell = 1449, type = "ability" }, -- Arcane Explosion + { spell = 1463, type = "ability", buff = true }, -- Mana Shield + { spell = 1953, type = "ability" }, -- Blink + { spell = 2120, type = "ability" }, -- Flamestrike + { spell = 2136, type = "ability", requiresTarget = true }, -- Fire Blast + { spell = 2139, type = "ability", requiresTarget = true }, -- Counterspell + { spell = 2855, type = "ability", debuff = true, requireTarget = true }, -- Detect Magic + { spell = 2948, type = "ability", requiresTarget = true }, -- Scorch + { spell = 5143, type = "ability", requiresTarget = true }, -- Arcane Missiles + { spell = 6117, type = "ability", buff = true }, -- Mage Armor + { spell = 6143, type = "ability", buff = true }, -- Frost Ward + { spell = 10187, type = "ability" }, -- Blizzard + { spell = 11113, type = "ability", debuff = true, talent = 55 }, -- Blast Wave + { spell = 11129, type = "ability", buff = true, talent = 59 }, -- Combustion + { spell = 11426, type = "ability", buff = true, talent = 99 }, -- ice Barrier + { spell = 11958, type = "ability", talent = 95 }, -- Cold Snap + { spell = 12042, type = "ability", buff = true, talent = 16 }, -- Arcane Power + { spell = 12043, type = "ability", buff = true, talent = 13 }, -- Presence of Mind + { spell = 12051, type = "ability" }, -- Evocation + { spell = 14272, type = "ability", buff = true, talent = 89 }, -- Icy Veins + { spell = 18809, type = "ability", requiresTarget = true }, -- Pyroblast + { spell = 25304, type = "ability", requiresTarget = true }, -- Frostbolt + { spell = 30449, type = "ability", requiresTarget = true }, -- Spellsteal + { spell = 30451, type = "ability", requiresTarget = true }, -- Arcane Blast + { spell = 30482, type = "ability", buff = true }, -- Molten Armor + { spell = 31661, type = "ability", buff = true }, -- Dragon's Breath + { spell = 31687, type = "ability", totem = true, talent = 102 }, -- Summon Water Elemental + { spell = 34589, type = "ability", requireTarget = true, debuff = true, talent = 23 }, -- Slow + { spell = 45438, type = "ability", buff = true }, -- Ice Block }, - icon = 136075 + icon = 136075, }, [4] = {}, [5] = {}, @@ -614,11 +608,10 @@ templates.class.MAGE = { [7] = {}, [8] = { title = L["Resources"], - args = { - }, + args = {}, icon = manaIcon, }, - } + }, } templates.class.WARLOCK = { @@ -626,73 +619,73 @@ templates.class.WARLOCK = { [1] = { title = L["Buffs"], args = { - { spell = 126, type = "buff", unit = "player"}, -- Eye of Kilrogg - { spell = 687, type = "buff", unit = "player"}, -- Demon Skin - { spell = 755, type = "buff", unit = "pet"}, -- Health Funnel - { spell = 5697, type = "buff", unit = "player"}, -- Unending Breath - { spell = 6229, type = "buff", unit = "player"}, -- Shadow Ward - { spell = 7870, type = "buff", unit = "pet"}, -- Lesser Invisibility - { spell = 18094, type = "buff", unit = "player"}, -- Nightfall - { spell = 19028, type = "buff", unit = "player", talent = 59}, -- Soul Link - { spell = 20707, type = "buff", unit = "group"}, -- Soulstone + { spell = 126, type = "buff", unit = "player" }, -- Eye of Kilrogg + { spell = 687, type = "buff", unit = "player" }, -- Demon Skin + { spell = 755, type = "buff", unit = "pet" }, -- Health Funnel + { spell = 5697, type = "buff", unit = "player" }, -- Unending Breath + { spell = 6229, type = "buff", unit = "player" }, -- Shadow Ward + { spell = 7870, type = "buff", unit = "pet" }, -- Lesser Invisibility + { spell = 18094, type = "buff", unit = "player" }, -- Nightfall + { spell = 19028, type = "buff", unit = "player", talent = 59 }, -- Soul Link + { spell = 20707, type = "buff", unit = "group" }, -- Soulstone }, - icon = 136210 + icon = 136210, }, [2] = { title = L["Debuffs"], args = { - { spell = 172, type = "debuff", unit = "target"}, -- Corruption - { spell = 348, type = "debuff", unit = "target"}, -- Immolate - { spell = 603, type = "debuff", unit = "target"}, -- Curse of Doom - { spell = 702, type = "debuff", unit = "target"}, -- Curse of Weakness - { spell = 704, type = "debuff", unit = "target"}, -- Curse of Recklessness - { spell = 710, type = "debuff", unit = "multi"}, -- Banish - { spell = 980, type = "debuff", unit = "target"}, -- Curse of Agony - { spell = 1098, type = "debuff", unit = "multi"}, -- Enslave Demon - { spell = 1490, type = "debuff", unit = "target"}, -- Curse of the Elements - { spell = 1714, type = "debuff", unit = "target"}, -- Curse of Tongues - { spell = 6358, type = "debuff", unit = "target"}, -- Seduction + { spell = 172, type = "debuff", unit = "target" }, -- Corruption + { spell = 348, type = "debuff", unit = "target" }, -- Immolate + { spell = 603, type = "debuff", unit = "target" }, -- Curse of Doom + { spell = 702, type = "debuff", unit = "target" }, -- Curse of Weakness + { spell = 704, type = "debuff", unit = "target" }, -- Curse of Recklessness + { spell = 710, type = "debuff", unit = "multi" }, -- Banish + { spell = 980, type = "debuff", unit = "target" }, -- Curse of Agony + { spell = 1098, type = "debuff", unit = "multi" }, -- Enslave Demon + { spell = 1490, type = "debuff", unit = "target" }, -- Curse of the Elements + { spell = 1714, type = "debuff", unit = "target" }, -- Curse of Tongues + { spell = 6358, type = "debuff", unit = "target" }, -- Seduction { spell = 6789, type = "debuff", unit = "target" }, -- Death Coil - { spell = 6360, type = "debuff", unit = "target"}, -- Whiplash - { spell = 17862, type = "debuff", unit = "target"}, -- Curse of Shadow - { spell = 18223, type = "debuff", unit = "target", talent = 15}, -- Curse of Exhaustion - { spell = 18265, type = "debuff", unit = "target", talent = 14}, -- Siphon Life - { spell = 30108, type = "debuff", unit = "target", talent = 21}, -- Unstable Affliction + { spell = 6360, type = "debuff", unit = "target" }, -- Whiplash + { spell = 17862, type = "debuff", unit = "target" }, -- Curse of Shadow + { spell = 18223, type = "debuff", unit = "target", talent = 15 }, -- Curse of Exhaustion + { spell = 18265, type = "debuff", unit = "target", talent = 14 }, -- Siphon Life + { spell = 30108, type = "debuff", unit = "target", talent = 21 }, -- Unstable Affliction }, - icon = 136139 + icon = 136139, }, [3] = { title = L["Abilities"], args = { - { spell = 172, type = "ability", requiresTarget = true, debuff = true}, -- Corruption - { spell = 348, type = "ability", requiresTarget = true, debuff = true}, -- Immolate - { spell = 686, type = "ability", requiresTarget = true}, -- Shadow Bolt - { spell = 698, type = "ability"}, -- Ritual of Summoning - { spell = 710, type = "ability", requiresTarget = true, debuff = true}, -- Banish - { spell = 980, type = "ability", requiresTarget = true, debuff = true}, -- Agony - { spell = 1120, type = "ability", requiresTarget = true}, -- Drain Soul - { spell = 3110, type = "ability", requiresTarget = true}, -- Firebolt - { spell = 3716, type = "ability", requiresTarget = true}, -- Consuming Shadows - { spell = 5138, type = "ability", requiresTarget = true}, -- Drain Mana - { spell = 5484, type = "ability"}, -- Howl of Terror - { spell = 5676, type = "ability", requiresTarget = true}, -- Searing Pain - { spell = 5740, type = "ability"}, -- Rain of Fire - { spell = 5782, type = "ability", requiresTarget = true, debuff = true}, -- Fear - { spell = 6353, type = "ability", requiresTarget = true}, -- Soul Fire - { spell = 6358, type = "ability", requiresTarget = true}, -- Seduction - { spell = 6360, type = "ability", requiresTarget = true}, -- Whiplash - { spell = 6789, type = "ability", requiresTarget = true}, -- Death Coil - { spell = 7814, type = "ability", requiresTarget = true}, -- Lash of Pain - { spell = 7870, type = "ability"}, -- Lesser Invisibility - { spell = 17962, type = "ability", requiresTarget = true, usable = true, talent = 98}, -- Conflagrate - { spell = 17926, type = "ability", requiresTarget = true}, -- Death Coil - { spell = 18288, type = "ability", buff = true, talent = 9}, -- Amplify Curse - { spell = 18708, type = "ability", talent = 28}, -- Fel Domination - { spell = 18877, type = "ability", requiresTarget = true, debuff = true, talent = 88}, -- Shadowburn - { spell = 30108, ability = "ability", debuff = true, requiresTarget = true, talent = 21}, -- Unstable Affliction - { spell = 30283, type = "ability", debuff = true, talent = 101}, -- Fel Domination + { spell = 172, type = "ability", requiresTarget = true, debuff = true }, -- Corruption + { spell = 348, type = "ability", requiresTarget = true, debuff = true }, -- Immolate + { spell = 686, type = "ability", requiresTarget = true }, -- Shadow Bolt + { spell = 698, type = "ability" }, -- Ritual of Summoning + { spell = 710, type = "ability", requiresTarget = true, debuff = true }, -- Banish + { spell = 980, type = "ability", requiresTarget = true, debuff = true }, -- Agony + { spell = 1120, type = "ability", requiresTarget = true }, -- Drain Soul + { spell = 3110, type = "ability", requiresTarget = true }, -- Firebolt + { spell = 3716, type = "ability", requiresTarget = true }, -- Consuming Shadows + { spell = 5138, type = "ability", requiresTarget = true }, -- Drain Mana + { spell = 5484, type = "ability" }, -- Howl of Terror + { spell = 5676, type = "ability", requiresTarget = true }, -- Searing Pain + { spell = 5740, type = "ability" }, -- Rain of Fire + { spell = 5782, type = "ability", requiresTarget = true, debuff = true }, -- Fear + { spell = 6353, type = "ability", requiresTarget = true }, -- Soul Fire + { spell = 6358, type = "ability", requiresTarget = true }, -- Seduction + { spell = 6360, type = "ability", requiresTarget = true }, -- Whiplash + { spell = 6789, type = "ability", requiresTarget = true }, -- Death Coil + { spell = 7814, type = "ability", requiresTarget = true }, -- Lash of Pain + { spell = 7870, type = "ability" }, -- Lesser Invisibility + { spell = 17962, type = "ability", requiresTarget = true, usable = true, talent = 98 }, -- Conflagrate + { spell = 17926, type = "ability", requiresTarget = true }, -- Death Coil + { spell = 18288, type = "ability", buff = true, talent = 9 }, -- Amplify Curse + { spell = 18708, type = "ability", talent = 28 }, -- Fel Domination + { spell = 18877, type = "ability", requiresTarget = true, debuff = true, talent = 88 }, -- Shadowburn + { spell = 30108, ability = "ability", debuff = true, requiresTarget = true, talent = 21 }, -- Unstable Affliction + { spell = 30283, type = "ability", debuff = true, talent = 101 }, -- Fel Domination }, - icon = 135808 + icon = 135808, }, [4] = {}, [5] = {}, @@ -700,11 +693,10 @@ templates.class.WARLOCK = { [7] = {}, [8] = { title = L["Resources"], - args = { - }, + args = {}, icon = "Interface\\Icons\\inv_misc_gem_amethyst_02", }, - } + }, } templates.class.DRUID = { @@ -713,85 +705,84 @@ templates.class.DRUID = { title = L["Buffs"], args = { { spell = 774, type = "buff", unit = "player", talent = 9 }, -- Rejuvenation - { spell = 5487, type = "buff", unit = "player"}, -- Bear Form - { spell = 8936, type = "buff", unit = "player"}, -- Regrowth - { spell = 783, type = "buff", unit = "player"}, -- Travel Form - { spell = 768, type = "buff", unit = "player"}, -- Cat Form - { spell = 22812, type = "buff", unit = "player"}, -- Barkskin - { spell = 1850, type = "buff", unit = "player"}, -- Dash - { spell = 5215, type = "buff", unit = "player"}, -- Prowl - { spell = 29166, type = "buff", unit = "group"}, -- Innervate - { spell = 33763, type = "buff", unit = "player"}, -- Lifebloom + { spell = 5487, type = "buff", unit = "player" }, -- Bear Form + { spell = 8936, type = "buff", unit = "player" }, -- Regrowth + { spell = 783, type = "buff", unit = "player" }, -- Travel Form + { spell = 768, type = "buff", unit = "player" }, -- Cat Form + { spell = 22812, type = "buff", unit = "player" }, -- Barkskin + { spell = 1850, type = "buff", unit = "player" }, -- Dash + { spell = 5215, type = "buff", unit = "player" }, -- Prowl + { spell = 29166, type = "buff", unit = "group" }, -- Innervate + { spell = 33763, type = "buff", unit = "player" }, -- Lifebloom }, - icon = 136097 + icon = 136097, }, [2] = { title = L["Debuffs"], args = { - { spell = 339, type = "debuff", unit = "multi"}, -- Entangling Roots - { spell = 770, type = "debuff", unit = "target"}, -- Faerie Fire + { spell = 339, type = "debuff", unit = "multi" }, -- Entangling Roots + { spell = 770, type = "debuff", unit = "target" }, -- Faerie Fire { spell = 5211, type = "debuff", unit = "target", talent = 10 }, -- Mighty Bash { spell = 1079, type = "debuff", unit = "target", talent = 7 }, -- Rip - { spell = 6795, type = "debuff", unit = "target"}, -- Growl - { spell = 2637, type = "debuff", unit = "multi"}, -- Hibernate - { spell = 5570, type = "debuff", unit = "target", talent = 8}, -- Insect Swarm - { spell = 8921, type = "debuff", unit = "target"}, -- Moonfire + { spell = 6795, type = "debuff", unit = "target" }, -- Growl + { spell = 2637, type = "debuff", unit = "multi" }, -- Hibernate + { spell = 5570, type = "debuff", unit = "target", talent = 8 }, -- Insect Swarm + { spell = 8921, type = "debuff", unit = "target" }, -- Moonfire }, - icon = 132114 + icon = 132114, }, [3] = { title = L["Abilities"], args = { - { spell = 99, type = "ability", debuff = true}, -- Demoralizing Roar - { spell = 339, type = "ability", requiresTarget = true, debuff = true}, -- Entangling Roots - { spell = 740, type = "ability", duration = 10}, -- Tranquility - { spell = 768, type = "ability"}, -- Cat Form - { spell = 770, type = "ability", requiresTarget = true, debuff = true}, -- Faerie Fire - { spell = 783, type = "ability"}, -- Travel Form - { spell = 1066, type = "ability"}, -- Aquatic Form - { spell = 1079, type = "ability", requiresTarget = true, form = 3}, -- Rip - { spell = 1082, type = "ability", requiresTarget = true, form = 3}, -- Claw - { spell = 1822, type = "ability", requiresTarget = true, debuff = true, form = 3}, -- Rake - { spell = 1850, type = "ability", buff = true}, -- Dash - { spell = 2637, type = "ability", requiresTarget = true, debuff = true}, -- Hibernate - { spell = 2782, type = "ability"}, -- Remove Curse - { spell = 2893, type = "ability"}, -- Abolish Poison - { spell = 2908, type = "ability", requiresTarget = true}, -- Soothe - { spell = 2912, type = "ability", requiresTarget = true}, -- Starfire - { spell = 5176, type = "ability", requiresTarget = true}, -- Wrath - { spell = 5209, type = "ability", form = 1}, -- Challenging Roar - { spell = 5211, type = "ability", requiresTarget = true, talent = 6, form = 1}, -- Mighty Bash - { spell = 5215, type = "ability", buff = true}, -- Prowl - { spell = 5221, type = "ability", requiresTarget = true, form = 3}, -- Shred - { spell = 5229, type = "ability", buff = true, form = 1}, -- Enrage - { spell = 5487, type = "ability"}, -- Bear Form - { spell = 5570, type = "ability", requiresTarget = true, debuff = true, talent = 8}, -- Insect Swarm - { spell = 6785, type = "ability", requiresTarget = true, form = 3}, -- Ravage - { spell = 6795, type = "ability", debuff = true, requiresTarget = true, form = 1}, -- Growl - { spell = 6807, type = "ability", queued = true, form = 1}, -- Maul - { spell = 8921, type = "ability", requiresTarget = true, debuff = true}, -- Moonfire - { spell = 8946, type = "ability"}, -- Cure Poison - { spell = 8983, type = "ability", requiresTarget = true, debuff = true, form = 1}, -- Buff - { spell = 9634, type = "ability"}, -- Dire Bear Form - { spell = 9846, type = "ability", buff = true, form = 3}, -- Tiger's Fury - { spell = 16689, type = "ability", buff = true, talent = 2}, -- Nature's Grasp - { spell = 16914, type = "ability"}, -- Hurricane - { spell = 16979, type = "ability", form = 1, talent = 47}, -- Feral Charge - { spell = 17116, type = "ability", buff = true, talent = 91}, -- Nature's Swiftness - { spell = 18562, type = "ability", talent = 97}, -- Swiftmend - { spell = 20484, type = "ability"}, -- Rebirth - { spell = 22568, type = "ability", form = 3}, -- Ferocious Bite - { spell = 22570, type = "ability", debuff = true, form = 3}, -- Maim - { spell = 22812, type = "ability", buff = true}, -- Barkskin - { spell = 22842, type = "ability", buff = true, form = 1}, -- Frenzied Regeneration - { spell = 24858, type = "ability", talent = 18}, -- Moonkin Form - { spell = 26997, type = "ability", form = 1}, -- Swipe - { spell = 27006, type = "ability", requiresTarget = true, debuff = true, form = 3}, -- Pounce - { spell = 33831, type = "ability", talent = 21}, -- Force of Nature - { spell = 42389, type = "ability", talent = 61, form = {1, 3}}, -- Mangle - + { spell = 99, type = "ability", debuff = true }, -- Demoralizing Roar + { spell = 339, type = "ability", requiresTarget = true, debuff = true }, -- Entangling Roots + { spell = 740, type = "ability", duration = 10 }, -- Tranquility + { spell = 768, type = "ability" }, -- Cat Form + { spell = 770, type = "ability", requiresTarget = true, debuff = true }, -- Faerie Fire + { spell = 783, type = "ability" }, -- Travel Form + { spell = 1066, type = "ability" }, -- Aquatic Form + { spell = 1079, type = "ability", requiresTarget = true, form = 3 }, -- Rip + { spell = 1082, type = "ability", requiresTarget = true, form = 3 }, -- Claw + { spell = 1822, type = "ability", requiresTarget = true, debuff = true, form = 3 }, -- Rake + { spell = 1850, type = "ability", buff = true }, -- Dash + { spell = 2637, type = "ability", requiresTarget = true, debuff = true }, -- Hibernate + { spell = 2782, type = "ability" }, -- Remove Curse + { spell = 2893, type = "ability" }, -- Abolish Poison + { spell = 2908, type = "ability", requiresTarget = true }, -- Soothe + { spell = 2912, type = "ability", requiresTarget = true }, -- Starfire + { spell = 5176, type = "ability", requiresTarget = true }, -- Wrath + { spell = 5209, type = "ability", form = 1 }, -- Challenging Roar + { spell = 5211, type = "ability", requiresTarget = true, talent = 6, form = 1 }, -- Mighty Bash + { spell = 5215, type = "ability", buff = true }, -- Prowl + { spell = 5221, type = "ability", requiresTarget = true, form = 3 }, -- Shred + { spell = 5229, type = "ability", buff = true, form = 1 }, -- Enrage + { spell = 5487, type = "ability" }, -- Bear Form + { spell = 5570, type = "ability", requiresTarget = true, debuff = true, talent = 8 }, -- Insect Swarm + { spell = 6785, type = "ability", requiresTarget = true, form = 3 }, -- Ravage + { spell = 6795, type = "ability", debuff = true, requiresTarget = true, form = 1 }, -- Growl + { spell = 6807, type = "ability", queued = true, form = 1 }, -- Maul + { spell = 8921, type = "ability", requiresTarget = true, debuff = true }, -- Moonfire + { spell = 8946, type = "ability" }, -- Cure Poison + { spell = 8983, type = "ability", requiresTarget = true, debuff = true, form = 1 }, -- Buff + { spell = 9634, type = "ability" }, -- Dire Bear Form + { spell = 9846, type = "ability", buff = true, form = 3 }, -- Tiger's Fury + { spell = 16689, type = "ability", buff = true, talent = 2 }, -- Nature's Grasp + { spell = 16914, type = "ability" }, -- Hurricane + { spell = 16979, type = "ability", form = 1, talent = 47 }, -- Feral Charge + { spell = 17116, type = "ability", buff = true, talent = 91 }, -- Nature's Swiftness + { spell = 18562, type = "ability", talent = 97 }, -- Swiftmend + { spell = 20484, type = "ability" }, -- Rebirth + { spell = 22568, type = "ability", form = 3 }, -- Ferocious Bite + { spell = 22570, type = "ability", debuff = true, form = 3 }, -- Maim + { spell = 22812, type = "ability", buff = true }, -- Barkskin + { spell = 22842, type = "ability", buff = true, form = 1 }, -- Frenzied Regeneration + { spell = 24858, type = "ability", talent = 18 }, -- Moonkin Form + { spell = 26997, type = "ability", form = 1 }, -- Swipe + { spell = 27006, type = "ability", requiresTarget = true, debuff = true, form = 3 }, -- Pounce + { spell = 33831, type = "ability", talent = 21 }, -- Force of Nature + { spell = 42389, type = "ability", talent = 61, form = { 1, 3 } }, -- Mangle }, - icon = 132134 + icon = 132134, }, [4] = {}, [5] = {}, @@ -799,59 +790,63 @@ templates.class.DRUID = { [7] = {}, [8] = { title = L["Resources and Shapeshift Form"], - args = { - }, + args = {}, icon = manaIcon, }, - } + }, } -- General Section tinsert(templates.general.args, { title = L["Health"], icon = "Interface\\Icons\\inv_potion_54", - type = "health" -}); + type = "health", +}) tinsert(templates.general.args, { title = L["Cast"], icon = 136209, - type = "cast" -}); + type = "cast", +}) tinsert(templates.general.args, { title = L["Always Active"], icon = "Interface\\Addons\\WeakAuras\\PowerAurasMedia\\Auras\\Aura78", - triggers = {[1] = { trigger = { + triggers = { [1] = { trigger = { type = WeakAuras.GetTriggerCategoryFor("Conditions"), event = "Conditions", - use_alwaystrue = true}}} -}); + use_alwaystrue = true, + } } }, +}) tinsert(templates.general.args, { title = L["Pet alive"], icon = "Interface\\Icons\\ability_hunter_pet_raptor", - triggers = {[1] = { trigger = { + triggers = { [1] = { trigger = { type = WeakAuras.GetTriggerCategoryFor("Conditions"), event = "Conditions", - use_HasPet = true}}} -}); + use_HasPet = true, + } } }, +}) tinsert(templates.general.args, { title = L["Pet Behavior"], icon = "Interface\\Icons\\ability_defend.blp", - triggers = {[1] = { trigger = { + triggers = { [1] = { trigger = { type = WeakAuras.GetTriggerCategoryFor("Pet Behavior"), event = "Pet Behavior", use_behavior = true, - behavior = "assist"}}} -}); + behavior = "assist", + } } }, +}) tinsert(templates.general.args, { - spell = 2825, type = "buff", unit = "player", + spell = 2825, + type = "buff", + unit = "player", forceOwnOnly = true, ownOnly = nil, overideTitle = L["Bloodlust/Heroism"], - spellIds = {2825, 32182}} -); + spellIds = { 2825, 32182 }, +}) -- Meta template for Power triggers local function createSimplePowerTemplate(powertype) @@ -861,7 +856,7 @@ local function createSimplePowerTemplate(powertype) type = "power", powertype = powertype, } - return power; + return power end ------------------------------- @@ -872,11 +867,12 @@ end tinsert(templates.class.WARRIOR[1][8].args, { title = L["Stance"], icon = 132349, - triggers = {[1] = { trigger = { + triggers = { [1] = { trigger = { type = WeakAuras.GetTriggerCategoryFor("Stance/Form/Aura"), - event = "Stance/Form/Aura"}}} + event = "Stance/Form/Aura", + } } }, }) -for j, id in ipairs({2457, 71, 2458}) do +for j, id in ipairs({ 2457, 71, 2458 }) do local title, _, icon = GetSpellInfo(id) if title then tinsert(templates.class.WARRIOR[1][8].args, { @@ -888,37 +884,38 @@ for j, id in ipairs({2457, 71, 2458}) do type = WeakAuras.GetTriggerCategoryFor("Stance/Form/Aura"), event = "Stance/Form/Aura", use_form = true, - form = { single = j } - } - } - } - }); + form = { single = j }, + }, + }, + }, + }) end end -tinsert(templates.class.WARRIOR[1][8].args, createSimplePowerTemplate(1)); -tinsert(templates.class.PALADIN[1][8].args, createSimplePowerTemplate(0)); -tinsert(templates.class.HUNTER[1][8].args, createSimplePowerTemplate(0)); -tinsert(templates.class.ROGUE[1][8].args, createSimplePowerTemplate(3)); -tinsert(templates.class.ROGUE[1][8].args, createSimplePowerTemplate(4)); -tinsert(templates.class.PRIEST[1][8].args, createSimplePowerTemplate(0)); -tinsert(templates.class.SHAMAN[1][8].args, createSimplePowerTemplate(0)); -tinsert(templates.class.MAGE[1][8].args, createSimplePowerTemplate(0)); -tinsert(templates.class.WARLOCK[1][8].args, createSimplePowerTemplate(0)); -tinsert(templates.class.DRUID[1][8].args, createSimplePowerTemplate(0)); -tinsert(templates.class.DRUID[1][8].args, createSimplePowerTemplate(1)); -tinsert(templates.class.DRUID[1][8].args, createSimplePowerTemplate(3)); -tinsert(templates.class.DRUID[1][8].args, createSimplePowerTemplate(4)); +tinsert(templates.class.WARRIOR[1][8].args, createSimplePowerTemplate(1)) +tinsert(templates.class.PALADIN[1][8].args, createSimplePowerTemplate(0)) +tinsert(templates.class.HUNTER[1][8].args, createSimplePowerTemplate(0)) +tinsert(templates.class.ROGUE[1][8].args, createSimplePowerTemplate(3)) +tinsert(templates.class.ROGUE[1][8].args, createSimplePowerTemplate(4)) +tinsert(templates.class.PRIEST[1][8].args, createSimplePowerTemplate(0)) +tinsert(templates.class.SHAMAN[1][8].args, createSimplePowerTemplate(0)) +tinsert(templates.class.MAGE[1][8].args, createSimplePowerTemplate(0)) +tinsert(templates.class.WARLOCK[1][8].args, createSimplePowerTemplate(0)) +tinsert(templates.class.DRUID[1][8].args, createSimplePowerTemplate(0)) +tinsert(templates.class.DRUID[1][8].args, createSimplePowerTemplate(1)) +tinsert(templates.class.DRUID[1][8].args, createSimplePowerTemplate(3)) +tinsert(templates.class.DRUID[1][8].args, createSimplePowerTemplate(4)) -- Shapeshift Form tinsert(templates.class.DRUID[1][8].args, { title = L["Shapeshift Form"], icon = 132276, - triggers = {[1] = { trigger = { + triggers = { [1] = { trigger = { type = WeakAuras.GetTriggerCategoryFor("Stance/Form/Aura"), - event = "Stance/Form/Aura"}}} -}); -for j, id in ipairs({5487, 768, 783, 114282, 1394966}) do + event = "Stance/Form/Aura", + } } }, +}) +for j, id in ipairs({ 5487, 768, 783, 114282, 1394966 }) do local title, _, icon = GetSpellInfo(id) if title then tinsert(templates.class.DRUID[1][8].args, { @@ -930,52 +927,51 @@ for j, id in ipairs({5487, 768, 783, 114282, 1394966}) do type = WeakAuras.GetTriggerCategoryFor("Stance/Form/Aura"), event = "Stance/Form/Aura", use_form = true, - form = { single = j } - } - } - } - }); + form = { single = j }, + }, + }, + }, + }) end end - ------------------------------ -- Hardcoded race templates ------------------------------- -- Every Man for Himself -tinsert(templates.race.Human, { spell = 20600, type = "ability" }); +tinsert(templates.race.Human, { spell = 20600, type = "ability" }) -- Stoneform -tinsert(templates.race.Dwarf, { spell = 20594, type = "ability", titleSuffix = L["cooldown"]}); -tinsert(templates.race.Dwarf, { spell = 20594, type = "buff", unit = "player", titleSuffix = L["buff"]}); +tinsert(templates.race.Dwarf, { spell = 20594, type = "ability", titleSuffix = L["cooldown"] }) +tinsert(templates.race.Dwarf, { spell = 20594, type = "buff", unit = "player", titleSuffix = L["buff"] }) -- Shadow Meld -tinsert(templates.race.NightElf, { spell = 20580, type = "ability", titleSuffix = L["cooldown"]}); -tinsert(templates.race.NightElf, { spell = 20580, type = "buff", titleSuffix = L["buff"]}); +tinsert(templates.race.NightElf, { spell = 20580, type = "ability", titleSuffix = L["cooldown"] }) +tinsert(templates.race.NightElf, { spell = 20580, type = "buff", titleSuffix = L["buff"] }) -- Escape Artist -tinsert(templates.race.Gnome, { spell = 20589, type = "ability" }); +tinsert(templates.race.Gnome, { spell = 20589, type = "ability" }) -- Blood Fury -tinsert(templates.race.Orc, { spell = 20572, type = "ability", titleSuffix = L["cooldown"]}); -tinsert(templates.race.Orc, { spell = 20572, type = "buff", unit = "player", titleSuffix = L["buff"]}); +tinsert(templates.race.Orc, { spell = 20572, type = "ability", titleSuffix = L["cooldown"] }) +tinsert(templates.race.Orc, { spell = 20572, type = "buff", unit = "player", titleSuffix = L["buff"] }) --Cannibalize -tinsert(templates.race.Scourge, { spell = 20577, type = "ability", titleSuffix = L["cooldown"]}); -tinsert(templates.race.Scourge, { spell = 20578, type = "buff", unit = "player", titleSuffix = L["buff"]}); +tinsert(templates.race.Scourge, { spell = 20577, type = "ability", titleSuffix = L["cooldown"] }) +tinsert(templates.race.Scourge, { spell = 20578, type = "buff", unit = "player", titleSuffix = L["buff"] }) -- Will of the Forsaken -tinsert(templates.race.Scourge, { spell = 7744, type = "ability", titleSuffix = L["cooldown"]}); -tinsert(templates.race.Scourge, { spell = 7744, type = "buff", unit = "player", titleSuffix = L["buff"]}); +tinsert(templates.race.Scourge, { spell = 7744, type = "ability", titleSuffix = L["cooldown"] }) +tinsert(templates.race.Scourge, { spell = 7744, type = "buff", unit = "player", titleSuffix = L["buff"] }) -- War Stomp -tinsert(templates.race.Tauren, { spell = 20549, type = "ability", titleSuffix = L["cooldown"]}); -tinsert(templates.race.Tauren, { spell = 20549, type = "debuff", titleSuffix = L["debuff"]}); +tinsert(templates.race.Tauren, { spell = 20549, type = "ability", titleSuffix = L["cooldown"] }) +tinsert(templates.race.Tauren, { spell = 20549, type = "debuff", titleSuffix = L["debuff"] }) --Beserking -tinsert(templates.race.Troll, { spell = 26297, type = "ability", titleSuffix = L["Rogue cooldown"]}); -tinsert(templates.race.Troll, { spell = 26296, type = "ability", titleSuffix = L["Warrior cooldown"]}); -tinsert(templates.race.Troll, { spell = 20554, type = "ability", titleSuffix = L["Other cooldown"]}); -tinsert(templates.race.Troll, { spell = 26635, type = "buff", unit = "player", titleSuffix = L["buff"]}); +tinsert(templates.race.Troll, { spell = 26297, type = "ability", titleSuffix = L["Rogue cooldown"] }) +tinsert(templates.race.Troll, { spell = 26296, type = "ability", titleSuffix = L["Warrior cooldown"] }) +tinsert(templates.race.Troll, { spell = 20554, type = "ability", titleSuffix = L["Other cooldown"] }) +tinsert(templates.race.Troll, { spell = 26635, type = "buff", unit = "player", titleSuffix = L["buff"] }) -- Arcane Torrent -tinsert(templates.race.BloodElf, { spell = 69179, type = "ability", titleSuffix = L["cooldown"]}); -- TODO check this for BCC +tinsert(templates.race.BloodElf, { spell = 69179, type = "ability", titleSuffix = L["cooldown"] }) -- TODO check this for BCC -- Gift of the Naaru -tinsert(templates.race.Draenei, { spell = 28880, type = "ability", titleSuffix = L["cooldown"]}); -- TODO check this for BCC -tinsert(templates.race.Draenei, { spell = 28880, type = "buff", unit = "player", titleSuffix = L["buff"]}); -- TODO check this for BCC +tinsert(templates.race.Draenei, { spell = 28880, type = "ability", titleSuffix = L["cooldown"] }) -- TODO check this for BCC +tinsert(templates.race.Draenei, { spell = 28880, type = "buff", unit = "player", titleSuffix = L["buff"] }) -- TODO check this for BCC ------------------------------ -- Helper code for options @@ -983,83 +979,83 @@ tinsert(templates.race.Draenei, { spell = 28880, type = "buff", unit = "player", -- Enrich items from spell, set title local function handleItem(item) - local waitingForItemInfo = false; - if (item.spell) then - local name, icon, _; - if (item.type == "item") then - name, _, _, _, _, _, _, _, _, icon = GetItemInfo(item.spell); - if (name == nil) then - name = L["Unknown Item"] .. " " .. tostring(item.spell); - waitingForItemInfo = true; + local waitingForItemInfo = false + if item.spell then + local name, icon, _ + if item.type == "item" then + name, _, _, _, _, _, _, _, _, icon = GetItemInfo(item.spell) + if name == nil then + name = L["Unknown Item"] .. " " .. tostring(item.spell) + waitingForItemInfo = true end else - name, _, icon = GetSpellInfo(item.spell); - if (name == nil) then - name = L["Unknown Spell"] .. " " .. tostring(item.spell); + name, _, icon = GetSpellInfo(item.spell) + if name == nil then + name = L["Unknown Spell"] .. " " .. tostring(item.spell) end end - if (icon and not item.icon) then - item.icon = icon; + if icon and not item.icon then + item.icon = icon end - item.title = item.overideTitle or name or ""; - if (item.titleSuffix) then - item.title = item.title .. " " .. item.titleSuffix; + item.title = item.overideTitle or name or "" + if item.titleSuffix then + item.title = item.title .. " " .. item.titleSuffix end - if (item.titlePrefix) then - item.title = item.titlePrefix .. item.title; + if item.titlePrefix then + item.title = item.titlePrefix .. item.title end - if (item.titleItemPrefix) then - local prefix = GetItemInfo(item.titleItemPrefix); - if (prefix) then - item.title = prefix .. "-" .. item.title; + if item.titleItemPrefix then + local prefix = GetItemInfo(item.titleItemPrefix) + if prefix then + item.title = prefix .. "-" .. item.title else - waitingForItemInfo = true; + waitingForItemInfo = true end end - if (item.type ~= "item") then - local spell = Spell:CreateFromSpellID(item.spell); - if (not spell:IsSpellEmpty()) then + if item.type ~= "item" then + local spell = Spell:CreateFromSpellID(item.spell) + if not spell:IsSpellEmpty() then spell:ContinueOnSpellLoad(function() - item.description = GetSpellDescription(spell:GetSpellID()); - end); + item.description = GetSpellDescription(spell:GetSpellID()) + end) end - item.description = GetSpellDescription(item.spell); + item.description = GetSpellDescription(item.spell) end end - if (item.talent) then - item.load = item.load or {}; + if item.talent then + item.load = item.load or {} if type(item.talent) == "table" then - item.load.talent = { multi = {} }; - for _,v in pairs(item.talent) do - item.load.talent.multi[v] = true; + item.load.talent = { multi = {} } + for _, v in pairs(item.talent) do + item.load.talent.multi[v] = true end - item.load.use_talent = false; + item.load.use_talent = false else item.load.talent = { single = item.talent, - multi = {}; - }; - item.load.use_talent = true; + multi = {}, + } + item.load.use_talent = true end end - if (item.pvptalent) then - item.load = item.load or {}; - item.load.use_pvptalent = true; + if item.pvptalent then + item.load = item.load or {} + item.load.use_pvptalent = true item.load.pvptalent = { single = item.pvptalent, - multi = {}; + multi = {}, } end - if (item.covenant) then + if item.covenant then item.load = item.load or {} item.load.use_covenant = true item.load.covenant = { single = item.covenant, - multi = {} + multi = {}, } end - if (item.bonusItemId) then + if item.bonusItemId then item.load = item.load or {} item.load.use_item_bonusid_equipped = true item.load.item_bonusid_equipped = tostring(item.bonusItemId) @@ -1068,40 +1064,41 @@ local function handleItem(item) if item.form then item.usable = true end - return waitingForItemInfo; + return waitingForItemInfo end local function addLoadCondition(item, loadCondition) -- No need to deep copy here, templates are read-only - item.load = item.load or {}; + item.load = item.load or {} for k, v in pairs(loadCondition) do - item.load[k] = v; + item.load[k] = v end end -local delayedEnrichDatabase = false; +local delayedEnrichDatabase = false local itemInfoReceived = CreateFrame("Frame") -local enrichTries = 0; +local enrichTries = 0 local function enrichDatabase() - if (enrichTries > 3) then - return; + if enrichTries > 3 then + return end - enrichTries = enrichTries + 1; + enrichTries = enrichTries + 1 - local waitingForItemInfo = false; + local waitingForItemInfo = false for className, class in pairs(templates.class) do for specIndex, spec in pairs(class) do for _, section in pairs(spec) do local loadCondition = { - use_class = true, class = { single = className, multi = {} }, - }; + use_class = true, + class = { single = className, multi = {} }, + } for itemIndex, item in pairs(section.args or {}) do local handle = handleItem(item) - if(handle) then - waitingForItemInfo = true; + if handle then + waitingForItemInfo = true end - addLoadCondition(item, loadCondition); + addLoadCondition(item, loadCondition) end end end @@ -1109,58 +1106,56 @@ local function enrichDatabase() for raceName, race in pairs(templates.race) do local loadCondition = { - use_race = true, race = { single = raceName, multi = {} } - }; + use_race = true, + race = { single = raceName, multi = {} }, + } for _, item in pairs(race) do local handle = handleItem(item) if handle then - waitingForItemInfo = true; + waitingForItemInfo = true end if handle ~= nil then - addLoadCondition(item, loadCondition); + addLoadCondition(item, loadCondition) end end end for _, item in pairs(templates.general.args) do - if (handleItem(item)) then - waitingForItemInfo = true; + if handleItem(item) then + waitingForItemInfo = true end end - if (waitingForItemInfo) then - itemInfoReceived:RegisterEvent("GET_ITEM_INFO_RECEIVED"); + if waitingForItemInfo then + itemInfoReceived:RegisterEvent("GET_ITEM_INFO_RECEIVED") else - itemInfoReceived:UnregisterEvent("GET_ITEM_INFO_RECEIVED"); + itemInfoReceived:UnregisterEvent("GET_ITEM_INFO_RECEIVED") end end - -enrichDatabase(); +enrichDatabase() itemInfoReceived:SetScript("OnEvent", function() - if (not delayedEnrichDatabase) then - delayedEnrichDatabase = true; + if not delayedEnrichDatabase then + delayedEnrichDatabase = true C_Timer.After(2, function() - enrichDatabase(); - delayedEnrichDatabase = false; + enrichDatabase() + delayedEnrichDatabase = false end) end -end); - +end) -- Enrich Display templates with default values for regionType, regionData in pairs(WeakAuras.regionOptions) do - if (regionData.templates) then + if regionData.templates then for _, item in ipairs(regionData.templates) do for k, v in pairs(WeakAuras.regionTypes[regionType].default) do - if (item.data[k] == nil) then - item.data[k] = v; + if item.data[k] == nil then + item.data[k] = v end end end end end - -WeakAuras.triggerTemplates = templates; +WeakAuras.triggerTemplates = templates diff --git a/WeakAurasTemplates/TriggerTemplatesDataClassic.lua b/WeakAurasTemplates/TriggerTemplatesDataClassic.lua index eefaf39bc1..8f55faa3c8 100644 --- a/WeakAurasTemplates/TriggerTemplatesDataClassic.lua +++ b/WeakAurasTemplates/TriggerTemplatesDataClassic.lua @@ -1,41 +1,41 @@ local WeakAuras = WeakAuras -if not WeakAuras.IsClassic() then return end +if not WeakAuras.IsClassic() then + return +end local L = WeakAuras.L local GetSpellInfo, tinsert, GetItemInfo, GetSpellDescription, C_Timer, Spell = GetSpellInfo, tinsert, GetItemInfo, GetSpellDescription, C_Timer, Spell -- The templates tables are created on demand -local templates = - { - class = { }, - race = { - Human = {}, - NightElf = {}, - Dwarf = {}, - Gnome = {}, - Orc = {}, - Scourge = {}, - Tauren = {}, - Troll = {}, - }, - general = { - title = L["General"], - icon = 136116, - args = {} - }, - } +local templates = { + class = {}, + race = { + Human = {}, + NightElf = {}, + Dwarf = {}, + Gnome = {}, + Orc = {}, + Scourge = {}, + Tauren = {}, + Troll = {}, + }, + general = { + title = L["General"], + icon = 136116, + args = {}, + }, +} local manaIcon = "Interface\\Icons\\spell_frost_manarecharge.blp" local rageIcon = "Interface\\Icons\\ability_racial_bloodrage.blp" local comboPointsIcon = "Interface\\Icons\\ability_backstab" -local powerTypes = - { - [0] = { name = POWER_TYPE_MANA, icon = manaIcon }, - [1] = { name = POWER_TYPE_RED_POWER, icon = rageIcon}, - [2] = { name = POWER_TYPE_FOCUS, icon = "Interface\\Icons\\ability_hunter_focusfire"}, - [3] = { name = POWER_TYPE_ENERGY, icon = "Interface\\Icons\\spell_shadow_shadowworddominate"}, - [4] = { name = COMBO_POINTS, icon = comboPointsIcon}, - } +local powerTypes = { + [0] = { name = POWER_TYPE_MANA, icon = manaIcon }, + [1] = { name = POWER_TYPE_RED_POWER, icon = rageIcon }, + [2] = { name = POWER_TYPE_FOCUS, icon = "Interface\\Icons\\ability_hunter_focusfire" }, + [3] = { name = POWER_TYPE_ENERGY, icon = "Interface\\Icons\\spell_shadow_shadowworddominate" }, + [4] = { name = COMBO_POINTS, icon = comboPointsIcon }, +} -- Collected by WeakAurasTemplateCollector: -------------------------------------------------------------------------------- @@ -45,77 +45,77 @@ templates.class.WARRIOR = { [1] = { title = L["Buffs"], args = { - { spell = 2565, type = "buff", unit = "player"}, -- Shield Block - { spell = 6673, type = "buff", unit = "player"}, -- Battle Shout - { spell = 18499, type = "buff", unit = "player"}, -- Berserker Rage - { spell = 12292, type = "buff", unit = "player"}, -- Sweeping Strikes - { spell = 12328, type = "buff", unit = "player"}, -- Death Wish - { spell = 12317, type = "buff", unit = "player"}, -- Enrage - { spell = 12319, type = "buff", unit = "player"}, -- Flurry - { spell = 12975, type = "buff", unit = "player"}, -- Last Stand + { spell = 2565, type = "buff", unit = "player" }, -- Shield Block + { spell = 6673, type = "buff", unit = "player" }, -- Battle Shout + { spell = 18499, type = "buff", unit = "player" }, -- Berserker Rage + { spell = 12292, type = "buff", unit = "player" }, -- Sweeping Strikes + { spell = 12328, type = "buff", unit = "player" }, -- Death Wish + { spell = 12317, type = "buff", unit = "player" }, -- Enrage + { spell = 12319, type = "buff", unit = "player" }, -- Flurry + { spell = 12975, type = "buff", unit = "player" }, -- Last Stand }, - icon = 132333 + icon = 132333, }, [2] = { title = L["Debuffs"], args = { - { spell = 355, type = "debuff", unit = "target"}, -- Taunt - { spell = 676, type = "debuff", unit = "target"}, -- Disarm - { spell = 694, type = "debuff", unit = "target"}, -- Mocking Blow - { spell = 772, type = "debuff", unit = "target"}, -- Rend - { spell = 1160, type = "debuff", unit = "target"}, -- Demoralizing Shout - { spell = 1715, type = "debuff", unit = "target"}, -- Hamstring - { spell = 5246, type = "debuff", unit = "target"}, -- Intimidating Shout - { spell = 6343, type = "debuff", unit = "target"}, -- Thunder Clap - { spell = 7384, type = "debuff", unit = "target"}, -- Sunder Armor - { spell = 12289, type = "debuff", unit = "target"}, -- Improved Hamstring - { spell = 12294, type = "debuff", unit = "target"}, -- Mortal Strike - { spell = 12797, type = "debuff", unit = "target"}, -- Improved Revenge - { spell = 12809, type = "debuff", unit = "target"}, -- Concussion Blow + { spell = 355, type = "debuff", unit = "target" }, -- Taunt + { spell = 676, type = "debuff", unit = "target" }, -- Disarm + { spell = 694, type = "debuff", unit = "target" }, -- Mocking Blow + { spell = 772, type = "debuff", unit = "target" }, -- Rend + { spell = 1160, type = "debuff", unit = "target" }, -- Demoralizing Shout + { spell = 1715, type = "debuff", unit = "target" }, -- Hamstring + { spell = 5246, type = "debuff", unit = "target" }, -- Intimidating Shout + { spell = 6343, type = "debuff", unit = "target" }, -- Thunder Clap + { spell = 7384, type = "debuff", unit = "target" }, -- Sunder Armor + { spell = 12289, type = "debuff", unit = "target" }, -- Improved Hamstring + { spell = 12294, type = "debuff", unit = "target" }, -- Mortal Strike + { spell = 12797, type = "debuff", unit = "target" }, -- Improved Revenge + { spell = 12809, type = "debuff", unit = "target" }, -- Concussion Blow }, - icon = 132366 + icon = 132366, }, [3] = { title = L["Abilities"], args = { - { spell = 72, type = "ability", debuff = true, requiresTarget = true, form = 2}, -- Shield Bash - { spell = 78, type = "ability", queued = true}, -- Heroic Strike - { spell = 100, type = "ability", requiresTarget = true, form = 1}, -- Charge - { spell = 355, type = "ability", debuff = true, requiresTarget = true, form = 2}, -- Taunt - { spell = 676, type = "ability", debuff = true, requiresTarget = true, form = 2}, -- Disarm - { spell = 694, type = "ability", debuff = true, requiresTarget = true, form = 1}, -- Mocking Blow - { spell = 772, type = "ability", debuff = true, requiresTarget = true}, -- Rend - { spell = 845, type = "ability", queued = true}, -- Cleave - { spell = 871, type = "ability", buff = true, form = 2}, -- Shield Wall - { spell = 1160, type = "ability", debuff = true}, -- Demoralizing Shout - { spell = 1161, type = "ability", debuff = true}, -- Challenging Shout - { spell = 1464, type = "ability", requiresTarget = true}, -- Slam - { spell = 1680, type = "ability", form = 3}, -- Whirlwind - { spell = 1715, type = "ability", requiresTarget = true, form = {1, 2}}, -- Hamstring - { spell = 1719, type = "ability", buff = true, form = 3}, -- Recklessness - { spell = 2565, type = "ability", buff = true, form = 2}, -- Shield Block - { spell = 2687, type = "ability", buff = true}, -- Bloodrage - { spell = 5246, type = "ability", debuff = true, requiresTarget = true}, -- Intimidating Shout - { spell = 5308, type = "ability", requiresTarget = true, form = {1, 3}}, -- Execute - { spell = 6343, type = "ability", debuff = true, form = 1}, -- Thunder Clap - { spell = 6552, type = "ability", requiresTarget = true, form = 3}, -- Pummel - { spell = 6572, type = "ability", requiresTarget = true, usable = true, form = 2}, -- Revenge - { spell = 6673, type = "ability", buff = true}, -- Battle Shout - { spell = 7384, type = "ability", requiresTarget = true, form = 1}, -- Overpower - { spell = 7386, type = "ability", requiresTarget = true, debuff = true}, -- Sunder Armor - { spell = 12323, type = "ability", debuff = true, talent = 26}, -- Piercing Howl - { spell = 12292, type = "ability", buff = true, talent = 13}, -- Sweeping Strikes - { spell = 12294, type = "ability", requiresTarget = true, talent = 18}, -- Mortal Strike - { spell = 12809, type = "ability", requiresTarget = true, debuff = true, talent = 54}, -- Concussion Blow - { spell = 12975, type = "ability", buff = true, talent = 46}, -- Last Stand - { spell = 12328, type = "ability", buff = true, talent = 33}, -- Death Wish - { spell = 18499, type = "ability", buff = true, form = 3}, -- Berserker Rage - { spell = 20230, type = "ability", buff = true, form = 1}, -- Retaliation - { spell = 20252, type = "ability", requiresTarget = true, form = 3}, -- Intercept - { spell = 23881, type = "ability", requiresTarget = true, talent = 37}, -- Bloodthirst - { spell = 23922, type = "ability", requiresTarget = true, talent = 57}, -- Shield Slam + { spell = 72, type = "ability", debuff = true, requiresTarget = true, form = 2 }, -- Shield Bash + { spell = 78, type = "ability", queued = true }, -- Heroic Strike + { spell = 100, type = "ability", requiresTarget = true, form = 1 }, -- Charge + { spell = 355, type = "ability", debuff = true, requiresTarget = true, form = 2 }, -- Taunt + { spell = 676, type = "ability", debuff = true, requiresTarget = true, form = 2 }, -- Disarm + { spell = 694, type = "ability", debuff = true, requiresTarget = true, form = 1 }, -- Mocking Blow + { spell = 772, type = "ability", debuff = true, requiresTarget = true }, -- Rend + { spell = 845, type = "ability", queued = true }, -- Cleave + { spell = 871, type = "ability", buff = true, form = 2 }, -- Shield Wall + { spell = 1160, type = "ability", debuff = true }, -- Demoralizing Shout + { spell = 1161, type = "ability", debuff = true }, -- Challenging Shout + { spell = 1464, type = "ability", requiresTarget = true }, -- Slam + { spell = 1680, type = "ability", form = 3 }, -- Whirlwind + { spell = 1715, type = "ability", requiresTarget = true, form = { 1, 2 } }, -- Hamstring + { spell = 1719, type = "ability", buff = true, form = 3 }, -- Recklessness + { spell = 2565, type = "ability", buff = true, form = 2 }, -- Shield Block + { spell = 2687, type = "ability", buff = true }, -- Bloodrage + { spell = 5246, type = "ability", debuff = true, requiresTarget = true }, -- Intimidating Shout + { spell = 5308, type = "ability", requiresTarget = true, form = { 1, 3 } }, -- Execute + { spell = 6343, type = "ability", debuff = true, form = 1 }, -- Thunder Clap + { spell = 6552, type = "ability", requiresTarget = true, form = 3 }, -- Pummel + { spell = 6572, type = "ability", requiresTarget = true, usable = true, form = 2 }, -- Revenge + { spell = 6673, type = "ability", buff = true }, -- Battle Shout + { spell = 7384, type = "ability", requiresTarget = true, form = 1 }, -- Overpower + { spell = 7386, type = "ability", requiresTarget = true, debuff = true }, -- Sunder Armor + { spell = 12323, type = "ability", debuff = true, talent = 26 }, -- Piercing Howl + { spell = 12292, type = "ability", buff = true, talent = 13 }, -- Sweeping Strikes + { spell = 12294, type = "ability", requiresTarget = true, talent = 18 }, -- Mortal Strike + { spell = 12809, type = "ability", requiresTarget = true, debuff = true, talent = 54 }, -- Concussion Blow + { spell = 12975, type = "ability", buff = true, talent = 46 }, -- Last Stand + { spell = 12328, type = "ability", buff = true, talent = 33 }, -- Death Wish + { spell = 18499, type = "ability", buff = true, form = 3 }, -- Berserker Rage + { spell = 20230, type = "ability", buff = true, form = 1 }, -- Retaliation + { spell = 20252, type = "ability", requiresTarget = true, form = 3 }, -- Intercept + { spell = 23881, type = "ability", requiresTarget = true, talent = 37 }, -- Bloodthirst + { spell = 23922, type = "ability", requiresTarget = true, talent = 57 }, -- Shield Slam }, - icon = 132355 + icon = 132355, }, [4] = {}, [5] = {}, @@ -123,11 +123,10 @@ templates.class.WARRIOR = { [7] = {}, [8] = { title = L["Resources"], - args = { - }, + args = {}, icon = rageIcon, - } - } + }, + }, } templates.class.PALADIN = { @@ -135,51 +134,51 @@ templates.class.PALADIN = { [1] = { title = L["Buffs"], args = { - { spell = 498, type = "buff", unit = "player"}, -- Divine Protection - { spell = 642, type = "buff", unit = "player"}, -- Divine Shield - { spell = 1022, type = "buff", unit = "group"}, -- Blessing of Protection - { spell = 1044, type = "buff", unit = "group"}, -- Blessing of Freedom - { spell = 6940, type = "buff", unit = "group"}, -- Blessing of Sacrifice + { spell = 498, type = "buff", unit = "player" }, -- Divine Protection + { spell = 642, type = "buff", unit = "player" }, -- Divine Shield + { spell = 1022, type = "buff", unit = "group" }, -- Blessing of Protection + { spell = 1044, type = "buff", unit = "group" }, -- Blessing of Freedom + { spell = 6940, type = "buff", unit = "group" }, -- Blessing of Sacrifice }, - icon = 135964 + icon = 135964, }, [2] = { title = L["Debuffs"], args = { - { spell = 853, type = "debuff", unit = "target"}, -- Hammer of Justice + { spell = 853, type = "debuff", unit = "target" }, -- Hammer of Justice }, - icon = 135952 + icon = 135952, }, [3] = { title = L["Abilities"], args = { - { spell = 498, type = "ability", buff = true}, -- Divine Protection - { spell = 633, type = "ability"}, -- Lay on Hands - { spell = 642, type = "ability", buff = true}, -- Divine Shield - { spell = 853, type = "ability", requiresTarget = true, debuff = true}, -- Hammer of Justice - { spell = 879, type = "ability", requiresTarget = true, usable = true}, -- Exorcism - { spell = 1022, type = "ability", buff = true}, -- Blessing of Protection - { spell = 1044, type = "ability", buff = true}, -- Blessing of Freedom - { spell = 1152, type = "ability"}, -- Purify - { spell = 2812, type = "ability"}, -- Holy Wrath - { spell = 4987, type = "ability"}, -- Cleanse - { spell = 6940, type = "ability"}, -- Blessing of Sacrifice - { spell = 19876, type = "ability", buff = true}, -- Shadow Resistance Aura - { spell = 19888, type = "ability", buff = true}, -- Frost Resistance Aura - { spell = 19891, type = "ability", buff = true}, -- Fire Resistance Aura - { spell = 20066, type = "ability", requiresTarget = true, debuff = true, talent = 55}, -- Repentance - { spell = 20165, type = "ability", buff = true}, -- Seal of Justice - { spell = 20165, type = "ability", buff = true}, -- Seal of Light - { spell = 20166, type = "ability", buff = true}, -- Seal of Wisdom - { spell = 20182, type = "ability", buff = true}, -- Seal of the Crusader - { spell = 20271, type = "ability", buff = true, requiresTarget = true}, -- Judgement - { spell = 20375, type = "ability", buff = true, talent = 48}, -- Seal of Command - { spell = 20925, type = "ability", charges = true, buff = true, talent = 35}, -- Holy Shield - { spell = 21084, type = "ability", buff = true}, -- Seal of Righteousness - { spell = 24275, type = "ability", requiresTarget = true, usable = true}, -- Hammer of Wrath - { spell = 26573, type = "ability", talent = 6}, -- Consecration + { spell = 498, type = "ability", buff = true }, -- Divine Protection + { spell = 633, type = "ability" }, -- Lay on Hands + { spell = 642, type = "ability", buff = true }, -- Divine Shield + { spell = 853, type = "ability", requiresTarget = true, debuff = true }, -- Hammer of Justice + { spell = 879, type = "ability", requiresTarget = true, usable = true }, -- Exorcism + { spell = 1022, type = "ability", buff = true }, -- Blessing of Protection + { spell = 1044, type = "ability", buff = true }, -- Blessing of Freedom + { spell = 1152, type = "ability" }, -- Purify + { spell = 2812, type = "ability" }, -- Holy Wrath + { spell = 4987, type = "ability" }, -- Cleanse + { spell = 6940, type = "ability" }, -- Blessing of Sacrifice + { spell = 19876, type = "ability", buff = true }, -- Shadow Resistance Aura + { spell = 19888, type = "ability", buff = true }, -- Frost Resistance Aura + { spell = 19891, type = "ability", buff = true }, -- Fire Resistance Aura + { spell = 20066, type = "ability", requiresTarget = true, debuff = true, talent = 55 }, -- Repentance + { spell = 20165, type = "ability", buff = true }, -- Seal of Justice + { spell = 20165, type = "ability", buff = true }, -- Seal of Light + { spell = 20166, type = "ability", buff = true }, -- Seal of Wisdom + { spell = 20182, type = "ability", buff = true }, -- Seal of the Crusader + { spell = 20271, type = "ability", buff = true, requiresTarget = true }, -- Judgement + { spell = 20375, type = "ability", buff = true, talent = 48 }, -- Seal of Command + { spell = 20925, type = "ability", charges = true, buff = true, talent = 35 }, -- Holy Shield + { spell = 21084, type = "ability", buff = true }, -- Seal of Righteousness + { spell = 24275, type = "ability", requiresTarget = true, usable = true }, -- Hammer of Wrath + { spell = 26573, type = "ability", talent = 6 }, -- Consecration }, - icon = 135972 + icon = 135972, }, [4] = {}, [5] = {}, @@ -187,11 +186,10 @@ templates.class.PALADIN = { [7] = {}, [8] = { title = L["Resources"], - args = { - }, + args = {}, icon = manaIcon, }, - } + }, } templates.class.HUNTER = { @@ -199,67 +197,67 @@ templates.class.HUNTER = { [1] = { title = L["Buffs"], args = { - { spell = 136, type = "buff", unit = "pet"}, -- Mend Pet - { spell = 3045, type = "buff", unit = "player"}, -- Rapid Fire - { spell = 5384, type = "buff", unit = "player"}, -- Feign Death - { spell = 6197, type = "buff", unit = "player"}, -- Eagle Eye - { spell = 19621, type = "buff", unit = "pet"}, -- Frenzy - { spell = 24450, type = "buff", unit = "pet"}, -- Prowl + { spell = 136, type = "buff", unit = "pet" }, -- Mend Pet + { spell = 3045, type = "buff", unit = "player" }, -- Rapid Fire + { spell = 5384, type = "buff", unit = "player" }, -- Feign Death + { spell = 6197, type = "buff", unit = "player" }, -- Eagle Eye + { spell = 19621, type = "buff", unit = "pet" }, -- Frenzy + { spell = 24450, type = "buff", unit = "pet" }, -- Prowl }, - icon = 132242 + icon = 132242, }, [2] = { title = L["Debuffs"], args = { - { spell = 1130, type = "debuff", unit = "target"}, -- Hunter's Mark - { spell = 1513, type = "debuff", unit = "target"}, -- Scare Beast - { spell = 1978, type = "debuff", unit = "target"}, -- Serpent Sting - { spell = 2649, type = "debuff", unit = "target"}, -- Growl - { spell = 2974, type = "debuff", unit = "target"}, -- Wing Clip - { spell = 3034, type = "debuff", unit = "target"}, -- Viper Sting - { spell = 3043, type = "debuff", unit = "target"}, -- Scorpid Sting - { spell = 3355, type = "debuff", unit = "multi"}, -- Freezing Trap - { spell = 5116, type = "debuff", unit = "target"}, -- Concussive Shot - { spell = 24394, type = "debuff", unit = "target"}, -- Intimidation + { spell = 1130, type = "debuff", unit = "target" }, -- Hunter's Mark + { spell = 1513, type = "debuff", unit = "target" }, -- Scare Beast + { spell = 1978, type = "debuff", unit = "target" }, -- Serpent Sting + { spell = 2649, type = "debuff", unit = "target" }, -- Growl + { spell = 2974, type = "debuff", unit = "target" }, -- Wing Clip + { spell = 3034, type = "debuff", unit = "target" }, -- Viper Sting + { spell = 3043, type = "debuff", unit = "target" }, -- Scorpid Sting + { spell = 3355, type = "debuff", unit = "multi" }, -- Freezing Trap + { spell = 5116, type = "debuff", unit = "target" }, -- Concussive Shot + { spell = 24394, type = "debuff", unit = "target" }, -- Intimidation }, - icon = 135860 + icon = 135860, }, [3] = { title = L["Abilities"], args = { - { spell = 781, type = "ability"}, -- Disengage - { spell = 1130, type = "ability", requiresTarget = true, debuff = true}, -- Hunter's Mark - { spell = 1495, type = "ability", requiresTarget = true, usable = true}, -- Mongoose Bite - { spell = 1499, type = "ability"}, -- Freezing Trap - { spell = 1510, type = "ability"}, -- Volley - { spell = 1513, type = "ability", requiresTarget = true, debuff = true}, -- Scare Beast - { spell = 1543, type = "ability", duration = 30}, -- Flare - { spell = 1978, type = "ability", requiresTarget = true, debuff = true}, -- Serpent Sting - { spell = 2643, type = "ability"}, -- Multi-Shot - { spell = 2649, type = "ability", requiresTarget = true, debuff = true}, -- Growl - { spell = 2973, type = "ability", queued = true}, -- Raptor Strike - { spell = 2974, type = "ability", requiresTarget = true, debuff = true}, -- Wing Clip - { spell = 3034, type = "ability", requiresTarget = true, debuff = true}, -- Viper Sting - { spell = 3043, type = "ability", requiresTarget = true, debuff = true}, -- Scorpid Sting - { spell = 3044, type = "ability", requiresTarget = true}, -- Arcane Shot - { spell = 3045, type = "ability", buff = true}, -- Rapid Fire - { spell = 5116, type = "ability", requiresTarget = true, debuff = true}, -- Concussive Shot - { spell = 5384, type = "ability", buff = true, unit = "player"}, -- Feign Death - { spell = 13795, type = "ability"}, -- Immolation Trap - { spell = 13809, type = "ability"}, -- Frost Trap - { spell = 13813, type = "ability"}, -- Explosive Trap - { spell = 16827, type = "ability", requiresTarget = true}, -- Claw - { spell = 19263, type = "ability", buff = true}, -- Deterrence - { spell = 19306, type = "ability", requiresTarget = true, usable = true}, -- Counterattack - { spell = 19434, type = "ability", requiresTarget = true}, -- Aimed Shot - { spell = 19386, type = "ability", requiresTarget = true, debuff = true}, -- Wyvern Sting - { spell = 19503, type = "ability", requiresTarget = true, debuff = true}, -- Scatter Shot - { spell = 19574, type = "ability", buff = true}, -- Bestial Wrath - { spell = 19577, type = "ability", requiresTarget = true, debuff = true}, -- Intimidation - { spell = 19801, type = "ability", requiresTarget = true}, -- Tranquilizing Shot - { spell = 20736, type = "ability", requiresTarget = true}, -- Distracting Shot + { spell = 781, type = "ability" }, -- Disengage + { spell = 1130, type = "ability", requiresTarget = true, debuff = true }, -- Hunter's Mark + { spell = 1495, type = "ability", requiresTarget = true, usable = true }, -- Mongoose Bite + { spell = 1499, type = "ability" }, -- Freezing Trap + { spell = 1510, type = "ability" }, -- Volley + { spell = 1513, type = "ability", requiresTarget = true, debuff = true }, -- Scare Beast + { spell = 1543, type = "ability", duration = 30 }, -- Flare + { spell = 1978, type = "ability", requiresTarget = true, debuff = true }, -- Serpent Sting + { spell = 2643, type = "ability" }, -- Multi-Shot + { spell = 2649, type = "ability", requiresTarget = true, debuff = true }, -- Growl + { spell = 2973, type = "ability", queued = true }, -- Raptor Strike + { spell = 2974, type = "ability", requiresTarget = true, debuff = true }, -- Wing Clip + { spell = 3034, type = "ability", requiresTarget = true, debuff = true }, -- Viper Sting + { spell = 3043, type = "ability", requiresTarget = true, debuff = true }, -- Scorpid Sting + { spell = 3044, type = "ability", requiresTarget = true }, -- Arcane Shot + { spell = 3045, type = "ability", buff = true }, -- Rapid Fire + { spell = 5116, type = "ability", requiresTarget = true, debuff = true }, -- Concussive Shot + { spell = 5384, type = "ability", buff = true, unit = "player" }, -- Feign Death + { spell = 13795, type = "ability" }, -- Immolation Trap + { spell = 13809, type = "ability" }, -- Frost Trap + { spell = 13813, type = "ability" }, -- Explosive Trap + { spell = 16827, type = "ability", requiresTarget = true }, -- Claw + { spell = 19263, type = "ability", buff = true }, -- Deterrence + { spell = 19306, type = "ability", requiresTarget = true, usable = true }, -- Counterattack + { spell = 19434, type = "ability", requiresTarget = true }, -- Aimed Shot + { spell = 19386, type = "ability", requiresTarget = true, debuff = true }, -- Wyvern Sting + { spell = 19503, type = "ability", requiresTarget = true, debuff = true }, -- Scatter Shot + { spell = 19574, type = "ability", buff = true }, -- Bestial Wrath + { spell = 19577, type = "ability", requiresTarget = true, debuff = true }, -- Intimidation + { spell = 19801, type = "ability", requiresTarget = true }, -- Tranquilizing Shot + { spell = 20736, type = "ability", requiresTarget = true }, -- Distracting Shot }, - icon = 135130 + icon = 135130, }, [4] = {}, [5] = {}, @@ -267,11 +265,10 @@ templates.class.HUNTER = { [7] = {}, [8] = { title = L["Resources"], - args = { - }, + args = {}, icon = manaIcon, }, - } + }, } templates.class.ROGUE = { @@ -279,58 +276,58 @@ templates.class.ROGUE = { [1] = { title = L["Buffs"], args = { - { spell = 2983, type = "buff", unit = "player"}, -- Sprint - { spell = 5171, type = "buff", unit = "player"}, -- Slice and Dice - { spell = 5277, type = "buff", unit = "player"}, -- Evasion - { spell = 13750, type = "buff", unit = "player"}, -- Adrenaline Rush - { spell = 13877, type = "buff", unit = "player"}, -- Blade Fury - { spell = 14177, type = "buff", unit = "player"}, -- Cold Blood - { spell = 14149, type = "buff", unit = "player"}, -- Remorseless - { spell = 14278, type = "buff", unit = "player"}, -- Ghostly Strike + { spell = 2983, type = "buff", unit = "player" }, -- Sprint + { spell = 5171, type = "buff", unit = "player" }, -- Slice and Dice + { spell = 5277, type = "buff", unit = "player" }, -- Evasion + { spell = 13750, type = "buff", unit = "player" }, -- Adrenaline Rush + { spell = 13877, type = "buff", unit = "player" }, -- Blade Fury + { spell = 14177, type = "buff", unit = "player" }, -- Cold Blood + { spell = 14149, type = "buff", unit = "player" }, -- Remorseless + { spell = 14278, type = "buff", unit = "player" }, -- Ghostly Strike }, - icon = 132290 + icon = 132290, }, [2] = { title = L["Debuffs"], args = { - { spell = 703, type = "debuff", unit = "target"}, -- Garrote - { spell = 14251, type = "debuff", unit = "target"}, -- Riposte - { spell = 11198, type = "debuff", unit = "target"}, -- Expose Armor - { spell = 18425, type = "debuff", unit = "target"}, -- Kick - Silenced - { spell = 17348, type = "debuff", unit = "target"}, -- Hemorrhage - { spell = 14183, type = "debuff", unit = "target"}, -- Premeditation + { spell = 703, type = "debuff", unit = "target" }, -- Garrote + { spell = 14251, type = "debuff", unit = "target" }, -- Riposte + { spell = 11198, type = "debuff", unit = "target" }, -- Expose Armor + { spell = 18425, type = "debuff", unit = "target" }, -- Kick - Silenced + { spell = 17348, type = "debuff", unit = "target" }, -- Hemorrhage + { spell = 14183, type = "debuff", unit = "target" }, -- Premeditation }, - icon = 132302 + icon = 132302, }, [3] = { title = L["Abilities"], args = { - { spell = 53, type = "ability", requiresTarget = true, usable = true}, -- Backstab - { spell = 703, type = "ability", requiresTarget = true, debuff = true}, -- Garrote - { spell = 921, type = "ability", requiresTarget = true, usable = true}, -- Pick Pocket - { spell = 1725, type = "ability", usable = true}, -- Distract - { spell = 1752, type = "ability", requiresTarget = true}, -- Sinister Strike - { spell = 1766, type = "ability", requiresTarget = true}, -- Kick - { spell = 1776, type = "ability", requiresTarget = true, usable = true, debuff = true}, -- Gouge - { spell = 1784, type = "ability", buff = true}, -- Stealth - { spell = 1856, type = "ability", buff = true}, -- Vanish - { spell = 2094, type = "ability", requiresTarget = true}, -- Blind - { spell = 2098, type = "ability", requiresTarget = true}, -- Eviscerate - { spell = 2983, type = "ability", buff = true}, -- Sprint - { spell = 5171, type = "ability", requiresTarget = true, buff = true}, -- Slice and Dice - { spell = 5277, type = "ability", buff = true}, -- Evasion - { spell = 6770, type = "ability", requiresTarget = true, usable = true, debuff = true}, -- Sap - { spell = 8647, type = "ability", requiresTarget = true, debuff = true}, -- Expose Armor - { spell = 13750, type = "ability", buff = true, talent = 39}, -- Adrenaline Rush - { spell = 13877, type = "ability", buff = true, talent = 34}, -- Blade Fury - { spell = 14177, type = "ability", buff = true, talent = 12}, -- Cold Blood - { spell = 14183, type = "ability", requiresTarget = true, debuff = true, talent = 57}, -- Premeditation - { spell = 14185, type = "ability"}, -- Preparation - { spell = 14251, type = "ability", requiresTarget = true, usable = true, debuff = true, talent = 28}, -- Riposte - { spell = 14271, type = "ability", requiresTarget = true, buff = true, talent = 47}, -- Ghostly Strike - { spell = 16511, type = "ability", requiresTarget = true, debuff = true, talent = 55}, -- Hemorrhage + { spell = 53, type = "ability", requiresTarget = true, usable = true }, -- Backstab + { spell = 703, type = "ability", requiresTarget = true, debuff = true }, -- Garrote + { spell = 921, type = "ability", requiresTarget = true, usable = true }, -- Pick Pocket + { spell = 1725, type = "ability", usable = true }, -- Distract + { spell = 1752, type = "ability", requiresTarget = true }, -- Sinister Strike + { spell = 1766, type = "ability", requiresTarget = true }, -- Kick + { spell = 1776, type = "ability", requiresTarget = true, usable = true, debuff = true }, -- Gouge + { spell = 1784, type = "ability", buff = true }, -- Stealth + { spell = 1856, type = "ability", buff = true }, -- Vanish + { spell = 2094, type = "ability", requiresTarget = true }, -- Blind + { spell = 2098, type = "ability", requiresTarget = true }, -- Eviscerate + { spell = 2983, type = "ability", buff = true }, -- Sprint + { spell = 5171, type = "ability", requiresTarget = true, buff = true }, -- Slice and Dice + { spell = 5277, type = "ability", buff = true }, -- Evasion + { spell = 6770, type = "ability", requiresTarget = true, usable = true, debuff = true }, -- Sap + { spell = 8647, type = "ability", requiresTarget = true, debuff = true }, -- Expose Armor + { spell = 13750, type = "ability", buff = true, talent = 39 }, -- Adrenaline Rush + { spell = 13877, type = "ability", buff = true, talent = 34 }, -- Blade Fury + { spell = 14177, type = "ability", buff = true, talent = 12 }, -- Cold Blood + { spell = 14183, type = "ability", requiresTarget = true, debuff = true, talent = 57 }, -- Premeditation + { spell = 14185, type = "ability" }, -- Preparation + { spell = 14251, type = "ability", requiresTarget = true, usable = true, debuff = true, talent = 28 }, -- Riposte + { spell = 14271, type = "ability", requiresTarget = true, buff = true, talent = 47 }, -- Ghostly Strike + { spell = 16511, type = "ability", requiresTarget = true, debuff = true, talent = 55 }, -- Hemorrhage }, - icon = 132350 + icon = 132350, }, [4] = {}, [5] = {}, @@ -338,11 +335,10 @@ templates.class.ROGUE = { [7] = {}, [8] = { title = L["Resources"], - args = { - }, + args = {}, icon = comboPointsIcon, }, - } + }, } templates.class.PRIEST = { @@ -350,48 +346,47 @@ templates.class.PRIEST = { [1] = { title = L["Buffs"], args = { - { spell = 586, type = "buff", unit = "player"}, -- Fade - { spell = 17, type = "buff", unit = "target"}, -- Power Word: Shield - { spell = 21562, type = "buff", unit = "player"}, -- Power Word: Fortitude - { spell = 2096, type = "buff", unit = "player"}, -- Mind Vision - { spell = 1706, type = "buff", unit = "player"}, -- Levitate + { spell = 586, type = "buff", unit = "player" }, -- Fade + { spell = 17, type = "buff", unit = "target" }, -- Power Word: Shield + { spell = 21562, type = "buff", unit = "player" }, -- Power Word: Fortitude + { spell = 2096, type = "buff", unit = "player" }, -- Mind Vision + { spell = 1706, type = "buff", unit = "player" }, -- Levitate }, - icon = 135940 + icon = 135940, }, [2] = { title = L["Debuffs"], args = { - { spell = 8122, type = "debuff", unit = "target"}, -- Psychic Scream - { spell = 2096, type = "debuff", unit = "target"}, -- Mind Vision - { spell = 589, type = "debuff", unit = "target"}, -- Shadow Word: Pain + { spell = 8122, type = "debuff", unit = "target" }, -- Psychic Scream + { spell = 2096, type = "debuff", unit = "target" }, -- Mind Vision + { spell = 589, type = "debuff", unit = "target" }, -- Shadow Word: Pain { spell = 9484, type = "debuff", unit = "multi" }, -- Shackle Undead }, - icon = 136207 + icon = 136207, }, [3] = { title = L["Abilities"], args = { - { spell = 17, type = "ability"}, -- Power Word: Shield - { spell = 527, type = "ability"}, -- Purify - { spell = 552, type = "ability"}, -- Abolish Disease - { spell = 585, type = "ability", requireTarget = true}, -- Smite - { spell = 586, type = "ability", buff = true}, -- Fade - { spell = 589, type = "ability", debuff = true}, -- Shadow Word: Pain - { spell = 2060, type = "ability"}, -- Greater Heal - { spell = 2061, type = "ability"}, -- Flash Heal - { spell = 6064, type = "ability"}, -- Heal - { spell = 8092, type = "ability", requireTarget = true}, -- Mind Blast - { spell = 8122, type = "ability"}, -- Psychic Scream - { spell = 10060, type = "ability", buff = true, talent = 15}, -- Power Infusion - { spell = 10876, type = "ability", requireTarget = true}, -- Mana Burn - { spell = 10947, type = "ability", requireTarget = true}, -- Mind Flay - { spell = 10951, type = "ability", buff = true}, -- Inner Fire - { spell = 14751, type = "ability", buff = true, talent = 7}, -- Inner Focus - { spell = 14914, type = "ability", debuff = true, requireTarget = true}, -- Holy Fire - { spell = 15487, type = "ability", debuff = true, requireTarget = true, talent = 52}, -- Silence - + { spell = 17, type = "ability" }, -- Power Word: Shield + { spell = 527, type = "ability" }, -- Purify + { spell = 552, type = "ability" }, -- Abolish Disease + { spell = 585, type = "ability", requireTarget = true }, -- Smite + { spell = 586, type = "ability", buff = true }, -- Fade + { spell = 589, type = "ability", debuff = true }, -- Shadow Word: Pain + { spell = 2060, type = "ability" }, -- Greater Heal + { spell = 2061, type = "ability" }, -- Flash Heal + { spell = 6064, type = "ability" }, -- Heal + { spell = 8092, type = "ability", requireTarget = true }, -- Mind Blast + { spell = 8122, type = "ability" }, -- Psychic Scream + { spell = 10060, type = "ability", buff = true, talent = 15 }, -- Power Infusion + { spell = 10876, type = "ability", requireTarget = true }, -- Mana Burn + { spell = 10947, type = "ability", requireTarget = true }, -- Mind Flay + { spell = 10951, type = "ability", buff = true }, -- Inner Fire + { spell = 14751, type = "ability", buff = true, talent = 7 }, -- Inner Focus + { spell = 14914, type = "ability", debuff = true, requireTarget = true }, -- Holy Fire + { spell = 15487, type = "ability", debuff = true, requireTarget = true, talent = 52 }, -- Silence }, - icon = 136224 + icon = 136224, }, [4] = {}, [5] = {}, @@ -399,11 +394,10 @@ templates.class.PRIEST = { [7] = {}, [8] = { title = L["Resources"], - args = { - }, + args = {}, icon = manaIcon, }, - } + }, } templates.class.SHAMAN = { @@ -411,65 +405,65 @@ templates.class.SHAMAN = { [1] = { title = L["Buffs"], args = { - { spell = 546, type = "buff", unit = "player"}, -- Water Walking - { spell = 16256, type = "buff", unit = "player", talent = 30}, -- Flurry + { spell = 546, type = "buff", unit = "player" }, -- Water Walking + { spell = 16256, type = "buff", unit = "player", talent = 30 }, -- Flurry }, - icon = 135863 + icon = 135863, }, [2] = { title = L["Debuffs"], args = { - { spell = 3600, type = "debuff", unit = "target"}, -- Earthbind + { spell = 3600, type = "debuff", unit = "target" }, -- Earthbind }, - icon = 135813 + icon = 135813, }, [3] = { title = L["Abilities"], args = { - { spell = 131, type = "ability", buff = true, usable = true}, -- Water Breathing - { spell = 324, type = "ability", buff = true}, -- Lightning Shield - { spell = 331, type = "ability"}, -- Healing Wave - { spell = 403, type = "ability", requireTarget = true}, -- Lightning Bolt - { spell = 421, type = "ability", requireTarget = true}, -- Chain Lightning - { spell = 546, type = "ability", buff = true, usable = true}, -- Water Walking - { spell = 556, type = "ability"}, -- Astral Recall - { spell = 1064, type = "ability"}, -- Chain Heal - { spell = 1535, type = "ability", totem = true}, -- Fire Nova Totem - { spell = 2008, type = "ability"}, -- Ancestral Spirit - { spell = 2484, type = "ability", totem = true}, -- Earthbind Totem - { spell = 2645, type = "ability", buff = true}, -- Ghost Wolf - { spell = 3599, type = "ability", totem = true}, -- Searing Totem - { spell = 5394, type = "ability", totem = true}, -- Healing Stream Totem - { spell = 5675, type = "ability", totem = true}, -- Mana Spring Totem - { spell = 5730, type = "ability", totem = true}, -- Stoneclaw Totem - { spell = 6495, type = "ability", totem = true}, -- Sentry Totem - { spell = 8142, type = "ability", requireTarget = true}, -- Earth Shock - { spell = 8143, type = "ability", requireTarget = true, debuff = true}, -- Frost Shock - { spell = 8017, type = "ability", weaponBuff = true}, -- Rockbiter Weapon -- !! weaponBuff is not supported yet - { spell = 8024, type = "ability", weaponBuff = true}, -- Flametongue Weapon - { spell = 8033, type = "ability", weaponBuff = true}, -- Frostbrand Weapon - { spell = 8050, type = "ability", requireTarget = true, debuff = true}, -- Flame Shock - { spell = 8071, type = "ability", totem = true}, -- Stoneskin Totem - { spell = 8075, type = "ability", totem = true}, -- Strength of Earth Totem - { spell = 8143, type = "ability", totem = true}, -- Tremor Totem - { spell = 8166, type = "ability", totem = true}, -- Poison Cleansing Totem - { spell = 8170, type = "ability", totem = true}, -- Disease Cleansing Totem - { spell = 8177, type = "ability", totem = true}, -- Grounding Totem - { spell = 8181, type = "ability", totem = true}, -- Frost Resistance Totem - { spell = 8184, type = "ability", totem = true}, -- Fire Resistance Totem - { spell = 8190, type = "ability", totem = true}, -- Magma Totem - { spell = 8227, type = "ability", totem = true}, -- Flametongue Totem - { spell = 8514, type = "ability", totem = true}, -- Windfury Totem - { spell = 8835, type = "ability", totem = true}, -- Grace of Air Totem - { spell = 10595, type = "ability", totem = true}, -- Nature Resistance Totem - { spell = 15107, type = "ability", totem = true}, -- Windwall Totem - { spell = 16188, type = "ability", buff = true, talent = 53}, -- Nature Swiftness - { spell = 16190, type = "ability", totem = true, talent = 55}, -- Mana Tide Totem - { spell = 17364, type = "ability", debuff = true, talent = 36}, -- Stormstrike - { spell = 20608, type = "ability"}, -- Reincarnation - { spell = 25908, type = "ability", totem = true}, -- Tranquil Air Totem + { spell = 131, type = "ability", buff = true, usable = true }, -- Water Breathing + { spell = 324, type = "ability", buff = true }, -- Lightning Shield + { spell = 331, type = "ability" }, -- Healing Wave + { spell = 403, type = "ability", requireTarget = true }, -- Lightning Bolt + { spell = 421, type = "ability", requireTarget = true }, -- Chain Lightning + { spell = 546, type = "ability", buff = true, usable = true }, -- Water Walking + { spell = 556, type = "ability" }, -- Astral Recall + { spell = 1064, type = "ability" }, -- Chain Heal + { spell = 1535, type = "ability", totem = true }, -- Fire Nova Totem + { spell = 2008, type = "ability" }, -- Ancestral Spirit + { spell = 2484, type = "ability", totem = true }, -- Earthbind Totem + { spell = 2645, type = "ability", buff = true }, -- Ghost Wolf + { spell = 3599, type = "ability", totem = true }, -- Searing Totem + { spell = 5394, type = "ability", totem = true }, -- Healing Stream Totem + { spell = 5675, type = "ability", totem = true }, -- Mana Spring Totem + { spell = 5730, type = "ability", totem = true }, -- Stoneclaw Totem + { spell = 6495, type = "ability", totem = true }, -- Sentry Totem + { spell = 8142, type = "ability", requireTarget = true }, -- Earth Shock + { spell = 8143, type = "ability", requireTarget = true, debuff = true }, -- Frost Shock + { spell = 8017, type = "ability", weaponBuff = true }, -- Rockbiter Weapon -- !! weaponBuff is not supported yet + { spell = 8024, type = "ability", weaponBuff = true }, -- Flametongue Weapon + { spell = 8033, type = "ability", weaponBuff = true }, -- Frostbrand Weapon + { spell = 8050, type = "ability", requireTarget = true, debuff = true }, -- Flame Shock + { spell = 8071, type = "ability", totem = true }, -- Stoneskin Totem + { spell = 8075, type = "ability", totem = true }, -- Strength of Earth Totem + { spell = 8143, type = "ability", totem = true }, -- Tremor Totem + { spell = 8166, type = "ability", totem = true }, -- Poison Cleansing Totem + { spell = 8170, type = "ability", totem = true }, -- Disease Cleansing Totem + { spell = 8177, type = "ability", totem = true }, -- Grounding Totem + { spell = 8181, type = "ability", totem = true }, -- Frost Resistance Totem + { spell = 8184, type = "ability", totem = true }, -- Fire Resistance Totem + { spell = 8190, type = "ability", totem = true }, -- Magma Totem + { spell = 8227, type = "ability", totem = true }, -- Flametongue Totem + { spell = 8514, type = "ability", totem = true }, -- Windfury Totem + { spell = 8835, type = "ability", totem = true }, -- Grace of Air Totem + { spell = 10595, type = "ability", totem = true }, -- Nature Resistance Totem + { spell = 15107, type = "ability", totem = true }, -- Windwall Totem + { spell = 16188, type = "ability", buff = true, talent = 53 }, -- Nature Swiftness + { spell = 16190, type = "ability", totem = true, talent = 55 }, -- Mana Tide Totem + { spell = 17364, type = "ability", debuff = true, talent = 36 }, -- Stormstrike + { spell = 20608, type = "ability" }, -- Reincarnation + { spell = 25908, type = "ability", totem = true }, -- Tranquil Air Totem }, - icon = 135963 + icon = 135963, }, [4] = {}, [5] = {}, @@ -477,11 +471,10 @@ templates.class.SHAMAN = { [7] = {}, [8] = { title = L["Resources"], - args = { - }, + args = {}, icon = 135990, }, - } + }, } templates.class.MAGE = { @@ -489,62 +482,62 @@ templates.class.MAGE = { [1] = { title = L["Buffs"], args = { - { spell = 130, type = "buff", unit = "player"}, -- Slow Fall - { spell = 543, type = "buff", unit = "player"}, -- Fire Ward - { spell = 604, type = "buff", unit = "player"}, -- Dampen Magic - { spell = 1008, type = "buff", unit = "player"}, -- Amplify Magic - { spell = 1459, type = "buff", unit = "player"}, -- Arcane Intellect - { spell = 1463, type = "buff", unit = "player"}, -- Mana Shield - { spell = 6143, type = "buff", unit = "player"}, -- Frost Ward - { spell = 11958, type = "buff", unit = "player"}, -- Ice Block - { spell = 12042, type = "buff", unit = "player"}, -- Arcane Power - { spell = 12536, type = "buff", unit = "player"}, -- Clearcasting + { spell = 130, type = "buff", unit = "player" }, -- Slow Fall + { spell = 543, type = "buff", unit = "player" }, -- Fire Ward + { spell = 604, type = "buff", unit = "player" }, -- Dampen Magic + { spell = 1008, type = "buff", unit = "player" }, -- Amplify Magic + { spell = 1459, type = "buff", unit = "player" }, -- Arcane Intellect + { spell = 1463, type = "buff", unit = "player" }, -- Mana Shield + { spell = 6143, type = "buff", unit = "player" }, -- Frost Ward + { spell = 11958, type = "buff", unit = "player" }, -- Ice Block + { spell = 12042, type = "buff", unit = "player" }, -- Arcane Power + { spell = 12536, type = "buff", unit = "player" }, -- Clearcasting }, - icon = 136096 + icon = 136096, }, [2] = { title = L["Debuffs"], args = { - { spell = 122, type = "debuff", unit = "target"}, -- Frost Nova + { spell = 122, type = "debuff", unit = "target" }, -- Frost Nova { spell = 118, type = "debuff", unit = "multi" }, -- Polymorph - { spell = 11071, type = "debuff", unit = "target"}, -- Frostbite - { spell = 11103, type = "debuff", unit = "target"}, -- Impact - { spell = 11180, type = "debuff", unit = "target"}, -- Winter's Chill + { spell = 11071, type = "debuff", unit = "target" }, -- Frostbite + { spell = 11103, type = "debuff", unit = "target" }, -- Impact + { spell = 11180, type = "debuff", unit = "target" }, -- Winter's Chill }, - icon = 135848 + icon = 135848, }, [3] = { title = L["Abilities"], args = { - { spell = 118, type = "ability", debuff = true, requireTarget = true}, -- Polymorph - { spell = 120, type = "ability"}, -- Cone of Cold - { spell = 122, type = "ability"}, -- Frost Nova - { spell = 130, type = "ability", buff = true}, -- Slow Fall - { spell = 475, type = "ability"}, -- Remove Curse - { spell = 543, type = "ability", buff = true}, -- Fire Ward - { spell = 1449, type = "ability"}, -- Arcane Explosion - { spell = 1463, type = "ability", buff = true}, -- Mana Shield - { spell = 1953, type = "ability"}, -- Blink - { spell = 2120, type = "ability"}, -- Flamestrike - { spell = 2136, type = "ability", requiresTarget = true}, -- Fire Blast - { spell = 2139, type = "ability", requiresTarget = true}, -- Counterspell - { spell = 2855, type = "ability", debuff = true, requireTarget = true}, -- Detect Magic - { spell = 2948, type = "ability", requiresTarget = true}, -- Scorch - { spell = 5143, type = "ability", requiresTarget = true}, -- Arcane Missiles - { spell = 6143, type = "ability", buff = true}, -- Frost Ward - { spell = 10187, type = "ability"}, -- Blizzard - { spell = 11113, type = "ability", debuff = true, talent = 34}, -- Blast Wave - { spell = 11129, type = "ability", buff = true, talent = 36}, -- Combustion - { spell = 11426, type = "ability", buff = true, talent = 57}, --ice Barrier - { spell = 11958, type = "ability", buff = true, talent = 54}, -- Ice Block - { spell = 12042, type = "ability", buff = true, talent = 16}, -- Arcane Power - { spell = 12043, type = "ability", buff = true, talent = 13}, -- Presence of Mind - { spell = 12051, type = "ability"}, -- Evocation - { spell = 12472, type = "ability", buff = true, talent = 49}, -- Cold Snap - { spell = 18809, type = "ability", requiresTarget = true}, -- Pyroblast - { spell = 25304, type = "ability", requiresTarget = true}, -- Frostbolt + { spell = 118, type = "ability", debuff = true, requireTarget = true }, -- Polymorph + { spell = 120, type = "ability" }, -- Cone of Cold + { spell = 122, type = "ability" }, -- Frost Nova + { spell = 130, type = "ability", buff = true }, -- Slow Fall + { spell = 475, type = "ability" }, -- Remove Curse + { spell = 543, type = "ability", buff = true }, -- Fire Ward + { spell = 1449, type = "ability" }, -- Arcane Explosion + { spell = 1463, type = "ability", buff = true }, -- Mana Shield + { spell = 1953, type = "ability" }, -- Blink + { spell = 2120, type = "ability" }, -- Flamestrike + { spell = 2136, type = "ability", requiresTarget = true }, -- Fire Blast + { spell = 2139, type = "ability", requiresTarget = true }, -- Counterspell + { spell = 2855, type = "ability", debuff = true, requireTarget = true }, -- Detect Magic + { spell = 2948, type = "ability", requiresTarget = true }, -- Scorch + { spell = 5143, type = "ability", requiresTarget = true }, -- Arcane Missiles + { spell = 6143, type = "ability", buff = true }, -- Frost Ward + { spell = 10187, type = "ability" }, -- Blizzard + { spell = 11113, type = "ability", debuff = true, talent = 34 }, -- Blast Wave + { spell = 11129, type = "ability", buff = true, talent = 36 }, -- Combustion + { spell = 11426, type = "ability", buff = true, talent = 57 }, --ice Barrier + { spell = 11958, type = "ability", buff = true, talent = 54 }, -- Ice Block + { spell = 12042, type = "ability", buff = true, talent = 16 }, -- Arcane Power + { spell = 12043, type = "ability", buff = true, talent = 13 }, -- Presence of Mind + { spell = 12051, type = "ability" }, -- Evocation + { spell = 12472, type = "ability", buff = true, talent = 49 }, -- Cold Snap + { spell = 18809, type = "ability", requiresTarget = true }, -- Pyroblast + { spell = 25304, type = "ability", requiresTarget = true }, -- Frostbolt }, - icon = 136075 + icon = 136075, }, [4] = {}, [5] = {}, @@ -552,11 +545,10 @@ templates.class.MAGE = { [7] = {}, [8] = { title = L["Resources"], - args = { - }, + args = {}, icon = manaIcon, }, - } + }, } templates.class.WARLOCK = { @@ -564,70 +556,70 @@ templates.class.WARLOCK = { [1] = { title = L["Buffs"], args = { - { spell = 126, type = "buff", unit = "player"}, -- Eye of Kilrogg - { spell = 687, type = "buff", unit = "player"}, -- Demon Skin - { spell = 755, type = "buff", unit = "pet"}, -- Health Funnel - { spell = 5697, type = "buff", unit = "player"}, -- Unending Breath - { spell = 6229, type = "buff", unit = "player"}, -- Shadow Ward - { spell = 7870, type = "buff", unit = "pet"}, -- Lesser Invisibility - { spell = 18094, type = "buff", unit = "player"}, -- Nightfall - { spell = 19028, type = "buff", unit = "player"}, -- Soul Link - { spell = 20707, type = "buff", unit = "group"}, -- Soulstone + { spell = 126, type = "buff", unit = "player" }, -- Eye of Kilrogg + { spell = 687, type = "buff", unit = "player" }, -- Demon Skin + { spell = 755, type = "buff", unit = "pet" }, -- Health Funnel + { spell = 5697, type = "buff", unit = "player" }, -- Unending Breath + { spell = 6229, type = "buff", unit = "player" }, -- Shadow Ward + { spell = 7870, type = "buff", unit = "pet" }, -- Lesser Invisibility + { spell = 18094, type = "buff", unit = "player" }, -- Nightfall + { spell = 19028, type = "buff", unit = "player" }, -- Soul Link + { spell = 20707, type = "buff", unit = "group" }, -- Soulstone }, - icon = 136210 + icon = 136210, }, [2] = { title = L["Debuffs"], args = { - { spell = 172, type = "debuff", unit = "target"}, -- Corruption - { spell = 348, type = "debuff", unit = "target"}, -- Immolate - { spell = 603, type = "debuff", unit = "target"}, -- Curse of Doom - { spell = 702, type = "debuff", unit = "target"}, -- Curse of Weakness - { spell = 704, type = "debuff", unit = "target"}, -- Curse of Recklessness - { spell = 710, type = "debuff", unit = "multi"}, -- Banish - { spell = 980, type = "debuff", unit = "target"}, -- Curse of Agony - { spell = 1098, type = "debuff", unit = "multi"}, -- Enslave Demon - { spell = 1490, type = "debuff", unit = "target"}, -- Curse of the Elements - { spell = 1714, type = "debuff", unit = "target"}, -- Curse of Tongues - { spell = 6358, type = "debuff", unit = "target"}, -- Seduction + { spell = 172, type = "debuff", unit = "target" }, -- Corruption + { spell = 348, type = "debuff", unit = "target" }, -- Immolate + { spell = 603, type = "debuff", unit = "target" }, -- Curse of Doom + { spell = 702, type = "debuff", unit = "target" }, -- Curse of Weakness + { spell = 704, type = "debuff", unit = "target" }, -- Curse of Recklessness + { spell = 710, type = "debuff", unit = "multi" }, -- Banish + { spell = 980, type = "debuff", unit = "target" }, -- Curse of Agony + { spell = 1098, type = "debuff", unit = "multi" }, -- Enslave Demon + { spell = 1490, type = "debuff", unit = "target" }, -- Curse of the Elements + { spell = 1714, type = "debuff", unit = "target" }, -- Curse of Tongues + { spell = 6358, type = "debuff", unit = "target" }, -- Seduction { spell = 6789, type = "debuff", unit = "target", talent = 14 }, -- Mortal Coil - { spell = 6360, type = "debuff", unit = "target"}, -- Whiplash - { spell = 17862, type = "debuff", unit = "target"}, -- Curse of Shadow - { spell = 18223, type = "debuff", unit = "target"}, -- Curse of Exhaustion + { spell = 6360, type = "debuff", unit = "target" }, -- Whiplash + { spell = 17862, type = "debuff", unit = "target" }, -- Curse of Shadow + { spell = 18223, type = "debuff", unit = "target" }, -- Curse of Exhaustion { spell = 18265, type = "debuff", unit = "target", talent = 6 }, -- Siphon Life }, - icon = 136139 + icon = 136139, }, [3] = { title = L["Abilities"], args = { - { spell = 172, type = "ability", requiresTarget = true, debuff = true}, -- Corruption - { spell = 348, type = "ability", requiresTarget = true, debuff = true}, -- Immolate - { spell = 686, type = "ability", requiresTarget = true}, -- Shadow Bolt - { spell = 698, type = "ability"}, -- Ritual of Summoning - { spell = 710, type = "ability", requiresTarget = true, debuff = true}, -- Banish - { spell = 980, type = "ability", requiresTarget = true, debuff = true}, -- Agony - { spell = 1120, type = "ability", requiresTarget = true}, -- Drain Soul - { spell = 3110, type = "ability", requiresTarget = true}, -- Firebolt - { spell = 3716, type = "ability", requiresTarget = true}, -- Consuming Shadows - { spell = 5138, type = "ability", requiresTarget = true}, -- Drain Mana - { spell = 5484, type = "ability"}, -- Howl of Terror - { spell = 5676, type = "ability", requiresTarget = true}, -- Searing Pain - { spell = 5740, type = "ability"}, -- Rain of Fire - { spell = 5782, type = "ability", requiresTarget = true, debuff = true}, -- Fear - { spell = 6353, type = "ability", requiresTarget = true}, -- Soul Fire - { spell = 6358, type = "ability", requiresTarget = true}, -- Seduction - { spell = 6360, type = "ability", requiresTarget = true}, -- Whiplash + { spell = 172, type = "ability", requiresTarget = true, debuff = true }, -- Corruption + { spell = 348, type = "ability", requiresTarget = true, debuff = true }, -- Immolate + { spell = 686, type = "ability", requiresTarget = true }, -- Shadow Bolt + { spell = 698, type = "ability" }, -- Ritual of Summoning + { spell = 710, type = "ability", requiresTarget = true, debuff = true }, -- Banish + { spell = 980, type = "ability", requiresTarget = true, debuff = true }, -- Agony + { spell = 1120, type = "ability", requiresTarget = true }, -- Drain Soul + { spell = 3110, type = "ability", requiresTarget = true }, -- Firebolt + { spell = 3716, type = "ability", requiresTarget = true }, -- Consuming Shadows + { spell = 5138, type = "ability", requiresTarget = true }, -- Drain Mana + { spell = 5484, type = "ability" }, -- Howl of Terror + { spell = 5676, type = "ability", requiresTarget = true }, -- Searing Pain + { spell = 5740, type = "ability" }, -- Rain of Fire + { spell = 5782, type = "ability", requiresTarget = true, debuff = true }, -- Fear + { spell = 6353, type = "ability", requiresTarget = true }, -- Soul Fire + { spell = 6358, type = "ability", requiresTarget = true }, -- Seduction + { spell = 6360, type = "ability", requiresTarget = true }, -- Whiplash { spell = 6789, type = "ability", requiresTarget = true, talent = 15 }, -- Mortal Coil - { spell = 7814, type = "ability", requiresTarget = true}, -- Lash of Pain - { spell = 7870, type = "ability"}, -- Lesser Invisibility - { spell = 17962, type = "ability", requiresTarget = true, usable = true, talent = 56}, -- Conflagrate - { spell = 17926, type = "ability", requiresTarget = true}, -- Death Coil - { spell = 18288, type = "ability", buff = true, talent = 9}, -- Amplify Curse - { spell = 18708, type = "ability", talent = 28}, -- Fel Domination - { spell = 18877, type = "ability", requiresTarget = true, debuff = true, talent = 48}, -- Shadowburn + { spell = 7814, type = "ability", requiresTarget = true }, -- Lash of Pain + { spell = 7870, type = "ability" }, -- Lesser Invisibility + { spell = 17962, type = "ability", requiresTarget = true, usable = true, talent = 56 }, -- Conflagrate + { spell = 17926, type = "ability", requiresTarget = true }, -- Death Coil + { spell = 18288, type = "ability", buff = true, talent = 9 }, -- Amplify Curse + { spell = 18708, type = "ability", talent = 28 }, -- Fel Domination + { spell = 18877, type = "ability", requiresTarget = true, debuff = true, talent = 48 }, -- Shadowburn }, - icon = 135808 + icon = 135808, }, [4] = {}, [5] = {}, @@ -635,11 +627,10 @@ templates.class.WARLOCK = { [7] = {}, [8] = { title = L["Resources"], - args = { - }, + args = {}, icon = "Interface\\Icons\\inv_misc_gem_amethyst_02", }, - } + }, } templates.class.DRUID = { @@ -648,75 +639,75 @@ templates.class.DRUID = { title = L["Buffs"], args = { { spell = 774, type = "buff", unit = "player", talent = 9 }, -- Rejuvenation - { spell = 5487, type = "buff", unit = "player"}, -- Bear Form - { spell = 8936, type = "buff", unit = "player"}, -- Regrowth - { spell = 783, type = "buff", unit = "player"}, -- Travel Form - { spell = 768, type = "buff", unit = "player"}, -- Cat Form - { spell = 22812, type = "buff", unit = "player"}, -- Barkskin - { spell = 1850, type = "buff", unit = "player"}, -- Dash - { spell = 5215, type = "buff", unit = "player"}, -- Prowl - { spell = 29166, type = "buff", unit = "group"}, -- Innervate + { spell = 5487, type = "buff", unit = "player" }, -- Bear Form + { spell = 8936, type = "buff", unit = "player" }, -- Regrowth + { spell = 783, type = "buff", unit = "player" }, -- Travel Form + { spell = 768, type = "buff", unit = "player" }, -- Cat Form + { spell = 22812, type = "buff", unit = "player" }, -- Barkskin + { spell = 1850, type = "buff", unit = "player" }, -- Dash + { spell = 5215, type = "buff", unit = "player" }, -- Prowl + { spell = 29166, type = "buff", unit = "group" }, -- Innervate }, - icon = 136097 + icon = 136097, }, [2] = { title = L["Debuffs"], args = { - { spell = 339, type = "debuff", unit = "multi"}, -- Entangling Roots + { spell = 339, type = "debuff", unit = "multi" }, -- Entangling Roots { spell = 5211, type = "debuff", unit = "target", talent = 10 }, -- Mighty Bash { spell = 1079, type = "debuff", unit = "target", talent = 7 }, -- Rip - { spell = 6795, type = "debuff", unit = "target"}, -- Growl - { spell = 2637, type = "debuff", unit = "multi"}, -- Hibernate + { spell = 6795, type = "debuff", unit = "target" }, -- Growl + { spell = 2637, type = "debuff", unit = "multi" }, -- Hibernate }, - icon = 132114 + icon = 132114, }, [3] = { title = L["Abilities"], args = { - { spell = 99, type = "ability", debuff = true}, -- Demoralizing Roar - { spell = 339, type = "ability", requiresTarget = true, debuff = true}, -- Entangling Roots - { spell = 740, type = "ability", duration = 10}, -- Tranquility - { spell = 768, type = "ability"}, -- Cat Form - { spell = 770, type = "ability", requiresTarget = true, debuff = true}, -- Faerie Fire - { spell = 779, type = "ability", form = 3}, -- Swipe - { spell = 783, type = "ability"}, -- Travel Form - { spell = 1066, type = "ability"}, -- Aquatic Form - { spell = 1079, type = "ability", requiresTarget = true, form = 3}, -- Rip - { spell = 1082, type = "ability", requiresTarget = true, form = 3}, -- Claw - { spell = 1822, type = "ability", requiresTarget = true, debuff = true, form = 3}, -- Rake - { spell = 1850, type = "ability", buff = true}, -- Dash - { spell = 2637, type = "ability", requiresTarget = true, debuff = true}, -- Hibernate - { spell = 2782, type = "ability"}, -- Remove Curse - { spell = 2893, type = "ability"}, -- Abolish Poison - { spell = 2908, type = "ability", requiresTarget = true}, -- Soothe - { spell = 2912, type = "ability", requiresTarget = true}, -- Starfire - { spell = 5176, type = "ability", requiresTarget = true}, -- Wrath - { spell = 5209, type = "ability", form = 1}, -- Challenging Roar - { spell = 5211, type = "ability", requiresTarget = true, talent = 6, form = 1}, -- Mighty Bash - { spell = 5215, type = "ability", buff = true}, -- Prowl - { spell = 5217, type = "ability", buff = true, form = 3}, -- Tiger's Fury - { spell = 5221, type = "ability", requiresTarget = true, form = 3}, -- Shred - { spell = 5229, type = "ability", buff = true, form = 1}, -- Enrage - { spell = 5487, type = "ability"}, -- Bear Form - { spell = 5570, type = "ability", requiresTarget = true, debuff = true, talent = 47}, -- Insect Swarm - { spell = 6785, type = "ability", requiresTarget = true, form = 1}, -- Ravage - { spell = 6795, type = "ability", debuff = true, requiresTarget = true, form = 1}, -- Growl - { spell = 6807, type = "ability", queued = true, form = 1}, -- Maul - { spell = 8921, type = "ability", requiresTarget = true, debuff = true}, -- Moonfire - { spell = 8946, type = "ability"}, -- Cure Poison - { spell = 9005, type = "ability", requiresTarget = true, debuff = true, form = 3}, -- Pounce - { spell = 9634, type = "ability"}, -- Dire Bear Form - { spell = 16689, type = "ability", buff = true, talent = 2}, -- Nature's Grasp - { spell = 16914, type = "ability"}, -- Hurricane - { spell = 16979, type = "ability", form = 1, talent = 27}, -- Feral Charge - { spell = 17116, type = "ability", buff = true, talent = 51}, -- Nature's Swiftness - { spell = 18562, type = "ability", talent = 55}, -- Swiftmend - { spell = 22568, type = "ability", form = 3}, -- Ferocious Bite - { spell = 22812, type = "ability", buff = true}, -- Barkskin - { spell = 22842, type = "ability", buff = true}, -- Frenzied Regeneration - { spell = 24858, type = "ability", talent = 16}, -- Moonkin Form + { spell = 99, type = "ability", debuff = true }, -- Demoralizing Roar + { spell = 339, type = "ability", requiresTarget = true, debuff = true }, -- Entangling Roots + { spell = 740, type = "ability", duration = 10 }, -- Tranquility + { spell = 768, type = "ability" }, -- Cat Form + { spell = 770, type = "ability", requiresTarget = true, debuff = true }, -- Faerie Fire + { spell = 779, type = "ability", form = 3 }, -- Swipe + { spell = 783, type = "ability" }, -- Travel Form + { spell = 1066, type = "ability" }, -- Aquatic Form + { spell = 1079, type = "ability", requiresTarget = true, form = 3 }, -- Rip + { spell = 1082, type = "ability", requiresTarget = true, form = 3 }, -- Claw + { spell = 1822, type = "ability", requiresTarget = true, debuff = true, form = 3 }, -- Rake + { spell = 1850, type = "ability", buff = true }, -- Dash + { spell = 2637, type = "ability", requiresTarget = true, debuff = true }, -- Hibernate + { spell = 2782, type = "ability" }, -- Remove Curse + { spell = 2893, type = "ability" }, -- Abolish Poison + { spell = 2908, type = "ability", requiresTarget = true }, -- Soothe + { spell = 2912, type = "ability", requiresTarget = true }, -- Starfire + { spell = 5176, type = "ability", requiresTarget = true }, -- Wrath + { spell = 5209, type = "ability", form = 1 }, -- Challenging Roar + { spell = 5211, type = "ability", requiresTarget = true, talent = 6, form = 1 }, -- Mighty Bash + { spell = 5215, type = "ability", buff = true }, -- Prowl + { spell = 5217, type = "ability", buff = true, form = 3 }, -- Tiger's Fury + { spell = 5221, type = "ability", requiresTarget = true, form = 3 }, -- Shred + { spell = 5229, type = "ability", buff = true, form = 1 }, -- Enrage + { spell = 5487, type = "ability" }, -- Bear Form + { spell = 5570, type = "ability", requiresTarget = true, debuff = true, talent = 47 }, -- Insect Swarm + { spell = 6785, type = "ability", requiresTarget = true, form = 1 }, -- Ravage + { spell = 6795, type = "ability", debuff = true, requiresTarget = true, form = 1 }, -- Growl + { spell = 6807, type = "ability", queued = true, form = 1 }, -- Maul + { spell = 8921, type = "ability", requiresTarget = true, debuff = true }, -- Moonfire + { spell = 8946, type = "ability" }, -- Cure Poison + { spell = 9005, type = "ability", requiresTarget = true, debuff = true, form = 3 }, -- Pounce + { spell = 9634, type = "ability" }, -- Dire Bear Form + { spell = 16689, type = "ability", buff = true, talent = 2 }, -- Nature's Grasp + { spell = 16914, type = "ability" }, -- Hurricane + { spell = 16979, type = "ability", form = 1, talent = 27 }, -- Feral Charge + { spell = 17116, type = "ability", buff = true, talent = 51 }, -- Nature's Swiftness + { spell = 18562, type = "ability", talent = 55 }, -- Swiftmend + { spell = 22568, type = "ability", form = 3 }, -- Ferocious Bite + { spell = 22812, type = "ability", buff = true }, -- Barkskin + { spell = 22842, type = "ability", buff = true }, -- Frenzied Regeneration + { spell = 24858, type = "ability", talent = 16 }, -- Moonkin Form }, - icon = 132134 + icon = 132134, }, [4] = {}, [5] = {}, @@ -724,52 +715,53 @@ templates.class.DRUID = { [7] = {}, [8] = { title = L["Resources and Shapeshift Form"], - args = { - }, + args = {}, icon = manaIcon, }, - } + }, } - -- General Section tinsert(templates.general.args, { title = L["Health"], icon = "Interface\\Icons\\inv_potion_54", - type = "health" -}); + type = "health", +}) tinsert(templates.general.args, { title = L["Cast"], icon = 136209, - type = "cast" -}); + type = "cast", +}) tinsert(templates.general.args, { title = L["Always Active"], icon = "Interface\\Addons\\WeakAuras\\PowerAurasMedia\\Auras\\Aura78", - triggers = {[1] = { trigger = { + triggers = { [1] = { trigger = { type = WeakAuras.GetTriggerCategoryFor("Conditions"), event = "Conditions", - use_alwaystrue = true}}} -}); + use_alwaystrue = true, + } } }, +}) tinsert(templates.general.args, { title = L["Pet alive"], icon = "Interface\\Icons\\ability_hunter_pet_raptor", - triggers = {[1] = { trigger = { + triggers = { [1] = { trigger = { type = WeakAuras.GetTriggerCategoryFor("Conditions"), event = "Conditions", - use_HasPet = true}}} -}); + use_HasPet = true, + } } }, +}) tinsert(templates.general.args, { title = L["Pet Behavior"], icon = "Interface\\Icons\\ability_defend.blp", - triggers = {[1] = { trigger = { + triggers = { [1] = { trigger = { type = WeakAuras.GetTriggerCategoryFor("Pet Behavior"), event = "Pet Behavior", use_behavior = true, - behavior = "assist"}}} -}); + behavior = "assist", + } } }, +}) -- Meta template for Power triggers local function createSimplePowerTemplate(powertype) @@ -779,7 +771,7 @@ local function createSimplePowerTemplate(powertype) type = "power", powertype = powertype, } - return power; + return power end ------------------------------- @@ -790,11 +782,12 @@ end tinsert(templates.class.WARRIOR[1][8].args, { title = L["Stance"], icon = 132349, - triggers = {[1] = { trigger = { + triggers = { [1] = { trigger = { type = WeakAuras.GetTriggerCategoryFor("Stance/Form/Aura"), - event = "Stance/Form/Aura"}}} + event = "Stance/Form/Aura", + } } }, }) -for j, id in ipairs({2457, 71, 2458}) do +for j, id in ipairs({ 2457, 71, 2458 }) do local title, _, icon = GetSpellInfo(id) if title then tinsert(templates.class.WARRIOR[1][8].args, { @@ -806,37 +799,38 @@ for j, id in ipairs({2457, 71, 2458}) do type = WeakAuras.GetTriggerCategoryFor("Stance/Form/Aura"), event = "Stance/Form/Aura", use_form = true, - form = { single = j } - } - } - } - }); + form = { single = j }, + }, + }, + }, + }) end end -tinsert(templates.class.WARRIOR[1][8].args, createSimplePowerTemplate(1)); -tinsert(templates.class.PALADIN[1][8].args, createSimplePowerTemplate(0)); -tinsert(templates.class.HUNTER[1][8].args, createSimplePowerTemplate(0)); -tinsert(templates.class.ROGUE[1][8].args, createSimplePowerTemplate(3)); -tinsert(templates.class.ROGUE[1][8].args, createSimplePowerTemplate(4)); -tinsert(templates.class.PRIEST[1][8].args, createSimplePowerTemplate(0)); -tinsert(templates.class.SHAMAN[1][8].args, createSimplePowerTemplate(0)); -tinsert(templates.class.MAGE[1][8].args, createSimplePowerTemplate(0)); -tinsert(templates.class.WARLOCK[1][8].args, createSimplePowerTemplate(0)); -tinsert(templates.class.DRUID[1][8].args, createSimplePowerTemplate(0)); -tinsert(templates.class.DRUID[1][8].args, createSimplePowerTemplate(1)); -tinsert(templates.class.DRUID[1][8].args, createSimplePowerTemplate(3)); -tinsert(templates.class.DRUID[1][8].args, createSimplePowerTemplate(4)); +tinsert(templates.class.WARRIOR[1][8].args, createSimplePowerTemplate(1)) +tinsert(templates.class.PALADIN[1][8].args, createSimplePowerTemplate(0)) +tinsert(templates.class.HUNTER[1][8].args, createSimplePowerTemplate(0)) +tinsert(templates.class.ROGUE[1][8].args, createSimplePowerTemplate(3)) +tinsert(templates.class.ROGUE[1][8].args, createSimplePowerTemplate(4)) +tinsert(templates.class.PRIEST[1][8].args, createSimplePowerTemplate(0)) +tinsert(templates.class.SHAMAN[1][8].args, createSimplePowerTemplate(0)) +tinsert(templates.class.MAGE[1][8].args, createSimplePowerTemplate(0)) +tinsert(templates.class.WARLOCK[1][8].args, createSimplePowerTemplate(0)) +tinsert(templates.class.DRUID[1][8].args, createSimplePowerTemplate(0)) +tinsert(templates.class.DRUID[1][8].args, createSimplePowerTemplate(1)) +tinsert(templates.class.DRUID[1][8].args, createSimplePowerTemplate(3)) +tinsert(templates.class.DRUID[1][8].args, createSimplePowerTemplate(4)) -- Shapeshift Form tinsert(templates.class.DRUID[1][8].args, { title = L["Shapeshift Form"], icon = 132276, - triggers = {[1] = { trigger = { + triggers = { [1] = { trigger = { type = WeakAuras.GetTriggerCategoryFor("Stance/Form/Aura"), - event = "Stance/Form/Aura"}}} -}); -for j, id in ipairs({5487, 768, 783, 114282, 1394966}) do + event = "Stance/Form/Aura", + } } }, +}) +for j, id in ipairs({ 5487, 768, 783, 114282, 1394966 }) do local title, _, icon = GetSpellInfo(id) if title then tinsert(templates.class.DRUID[1][8].args, { @@ -848,11 +842,11 @@ for j, id in ipairs({5487, 768, 783, 114282, 1394966}) do type = WeakAuras.GetTriggerCategoryFor("Stance/Form/Aura"), event = "Stance/Form/Aura", use_form = true, - form = { single = j } - } - } - } - }); + form = { single = j }, + }, + }, + }, + }) end end @@ -861,33 +855,33 @@ end ------------------------------- -- Every Man for Himself -tinsert(templates.race.Human, { spell = 20600, type = "ability" }); +tinsert(templates.race.Human, { spell = 20600, type = "ability" }) -- Stoneform -tinsert(templates.race.Dwarf, { spell = 20594, type = "ability", titleSuffix = L["cooldown"]}); -tinsert(templates.race.Dwarf, { spell = 20594, type = "buff", unit = "player", titleSuffix = L["buff"]}); +tinsert(templates.race.Dwarf, { spell = 20594, type = "ability", titleSuffix = L["cooldown"] }) +tinsert(templates.race.Dwarf, { spell = 20594, type = "buff", unit = "player", titleSuffix = L["buff"] }) -- Shadow Meld -tinsert(templates.race.NightElf, { spell = 20580, type = "ability", titleSuffix = L["cooldown"]}); -tinsert(templates.race.NightElf, { spell = 20580, type = "buff", titleSuffix = L["buff"]}); +tinsert(templates.race.NightElf, { spell = 20580, type = "ability", titleSuffix = L["cooldown"] }) +tinsert(templates.race.NightElf, { spell = 20580, type = "buff", titleSuffix = L["buff"] }) -- Escape Artist -tinsert(templates.race.Gnome, { spell = 20589, type = "ability" }); +tinsert(templates.race.Gnome, { spell = 20589, type = "ability" }) -- Blood Fury -tinsert(templates.race.Orc, { spell = 20572, type = "ability", titleSuffix = L["cooldown"]}); -tinsert(templates.race.Orc, { spell = 20572, type = "buff", unit = "player", titleSuffix = L["buff"]}); +tinsert(templates.race.Orc, { spell = 20572, type = "ability", titleSuffix = L["cooldown"] }) +tinsert(templates.race.Orc, { spell = 20572, type = "buff", unit = "player", titleSuffix = L["buff"] }) --Cannibalize -tinsert(templates.race.Scourge, { spell = 20577, type = "ability", titleSuffix = L["cooldown"]}); -tinsert(templates.race.Scourge, { spell = 20578, type = "buff", unit = "player", titleSuffix = L["buff"]}); +tinsert(templates.race.Scourge, { spell = 20577, type = "ability", titleSuffix = L["cooldown"] }) +tinsert(templates.race.Scourge, { spell = 20578, type = "buff", unit = "player", titleSuffix = L["buff"] }) -- Will of the Forsaken -tinsert(templates.race.Scourge, { spell = 7744, type = "ability", titleSuffix = L["cooldown"]}); -tinsert(templates.race.Scourge, { spell = 7744, type = "buff", unit = "player", titleSuffix = L["buff"]}); +tinsert(templates.race.Scourge, { spell = 7744, type = "ability", titleSuffix = L["cooldown"] }) +tinsert(templates.race.Scourge, { spell = 7744, type = "buff", unit = "player", titleSuffix = L["buff"] }) -- War Stomp -tinsert(templates.race.Tauren, { spell = 20549, type = "ability", titleSuffix = L["cooldown"]}); -tinsert(templates.race.Tauren, { spell = 20549, type = "debuff", titleSuffix = L["debuff"]}); +tinsert(templates.race.Tauren, { spell = 20549, type = "ability", titleSuffix = L["cooldown"] }) +tinsert(templates.race.Tauren, { spell = 20549, type = "debuff", titleSuffix = L["debuff"] }) --Beserking -tinsert(templates.race.Troll, { spell = 26297, type = "ability", titleSuffix = L["Rogue cooldown"]}); -tinsert(templates.race.Troll, { spell = 26296, type = "ability", titleSuffix = L["Warrior cooldown"]}); -tinsert(templates.race.Troll, { spell = 20554, type = "ability", titleSuffix = L["Other cooldown"]}); -tinsert(templates.race.Troll, { spell = 26635, type = "buff", unit = "player", titleSuffix = L["buff"]}); +tinsert(templates.race.Troll, { spell = 26297, type = "ability", titleSuffix = L["Rogue cooldown"] }) +tinsert(templates.race.Troll, { spell = 26296, type = "ability", titleSuffix = L["Warrior cooldown"] }) +tinsert(templates.race.Troll, { spell = 20554, type = "ability", titleSuffix = L["Other cooldown"] }) +tinsert(templates.race.Troll, { spell = 26635, type = "buff", unit = "player", titleSuffix = L["buff"] }) ------------------------------ -- Helper code for options @@ -895,83 +889,83 @@ tinsert(templates.race.Troll, { spell = 26635, type = "buff", unit = "player", t -- Enrich items from spell, set title local function handleItem(item) - local waitingForItemInfo = false; - if (item.spell) then - local name, icon, _; - if (item.type == "item") then - name, _, _, _, _, _, _, _, _, icon = GetItemInfo(item.spell); - if (name == nil) then - name = L["Unknown Item"] .. " " .. tostring(item.spell); - waitingForItemInfo = true; + local waitingForItemInfo = false + if item.spell then + local name, icon, _ + if item.type == "item" then + name, _, _, _, _, _, _, _, _, icon = GetItemInfo(item.spell) + if name == nil then + name = L["Unknown Item"] .. " " .. tostring(item.spell) + waitingForItemInfo = true end else - name, _, icon = GetSpellInfo(item.spell); - if (name == nil) then - name = L["Unknown Spell"] .. " " .. tostring(item.spell); + name, _, icon = GetSpellInfo(item.spell) + if name == nil then + name = L["Unknown Spell"] .. " " .. tostring(item.spell) end end - if (icon and not item.icon) then - item.icon = icon; + if icon and not item.icon then + item.icon = icon end - item.title = item.overideTitle or name or ""; - if (item.titleSuffix) then - item.title = item.title .. " " .. item.titleSuffix; + item.title = item.overideTitle or name or "" + if item.titleSuffix then + item.title = item.title .. " " .. item.titleSuffix end - if (item.titlePrefix) then - item.title = item.titlePrefix .. item.title; + if item.titlePrefix then + item.title = item.titlePrefix .. item.title end - if (item.titleItemPrefix) then - local prefix = GetItemInfo(item.titleItemPrefix); - if (prefix) then - item.title = prefix .. "-" .. item.title; + if item.titleItemPrefix then + local prefix = GetItemInfo(item.titleItemPrefix) + if prefix then + item.title = prefix .. "-" .. item.title else - waitingForItemInfo = true; + waitingForItemInfo = true end end - if (item.type ~= "item") then - local spell = Spell:CreateFromSpellID(item.spell); - if (not spell:IsSpellEmpty()) then + if item.type ~= "item" then + local spell = Spell:CreateFromSpellID(item.spell) + if not spell:IsSpellEmpty() then spell:ContinueOnSpellLoad(function() - item.description = GetSpellDescription(spell:GetSpellID()); - end); + item.description = GetSpellDescription(spell:GetSpellID()) + end) end - item.description = GetSpellDescription(item.spell); + item.description = GetSpellDescription(item.spell) end end - if (item.talent) then - item.load = item.load or {}; + if item.talent then + item.load = item.load or {} if type(item.talent) == "table" then - item.load.talent = { multi = {} }; - for _,v in pairs(item.talent) do - item.load.talent.multi[v] = true; + item.load.talent = { multi = {} } + for _, v in pairs(item.talent) do + item.load.talent.multi[v] = true end - item.load.use_talent = false; + item.load.use_talent = false else item.load.talent = { single = item.talent, - multi = {}; - }; - item.load.use_talent = true; + multi = {}, + } + item.load.use_talent = true end end - if (item.pvptalent) then - item.load = item.load or {}; - item.load.use_pvptalent = true; + if item.pvptalent then + item.load = item.load or {} + item.load.use_pvptalent = true item.load.pvptalent = { single = item.pvptalent, - multi = {}; + multi = {}, } end - if (item.covenant) then + if item.covenant then item.load = item.load or {} item.load.use_covenant = true item.load.covenant = { single = item.covenant, - multi = {} + multi = {}, } end - if (item.bonusItemId) then + if item.bonusItemId then item.load = item.load or {} item.load.use_item_bonusid_equipped = true item.load.item_bonusid_equipped = tostring(item.bonusItemId) @@ -980,40 +974,41 @@ local function handleItem(item) if item.form then item.usable = true end - return waitingForItemInfo; + return waitingForItemInfo end local function addLoadCondition(item, loadCondition) -- No need to deep copy here, templates are read-only - item.load = item.load or {}; + item.load = item.load or {} for k, v in pairs(loadCondition) do - item.load[k] = v; + item.load[k] = v end end -local delayedEnrichDatabase = false; +local delayedEnrichDatabase = false local itemInfoReceived = CreateFrame("Frame") -local enrichTries = 0; +local enrichTries = 0 local function enrichDatabase() - if (enrichTries > 3) then - return; + if enrichTries > 3 then + return end - enrichTries = enrichTries + 1; + enrichTries = enrichTries + 1 - local waitingForItemInfo = false; + local waitingForItemInfo = false for className, class in pairs(templates.class) do for specIndex, spec in pairs(class) do for _, section in pairs(spec) do local loadCondition = { - use_class = true, class = { single = className, multi = {} }, - }; + use_class = true, + class = { single = className, multi = {} }, + } for itemIndex, item in pairs(section.args or {}) do local handle = handleItem(item) - if(handle) then - waitingForItemInfo = true; + if handle then + waitingForItemInfo = true end - addLoadCondition(item, loadCondition); + addLoadCondition(item, loadCondition) end end end @@ -1021,56 +1016,56 @@ local function enrichDatabase() for raceName, race in pairs(templates.race) do local loadCondition = { - use_race = true, race = { single = raceName, multi = {} } - }; + use_race = true, + race = { single = raceName, multi = {} }, + } for _, item in pairs(race) do local handle = handleItem(item) if handle then - waitingForItemInfo = true; + waitingForItemInfo = true end if handle ~= nil then - addLoadCondition(item, loadCondition); + addLoadCondition(item, loadCondition) end end end for _, item in pairs(templates.general.args) do - if (handleItem(item)) then - waitingForItemInfo = true; + if handleItem(item) then + waitingForItemInfo = true end end - if (waitingForItemInfo) then - itemInfoReceived:RegisterEvent("GET_ITEM_INFO_RECEIVED"); + if waitingForItemInfo then + itemInfoReceived:RegisterEvent("GET_ITEM_INFO_RECEIVED") else - itemInfoReceived:UnregisterEvent("GET_ITEM_INFO_RECEIVED"); + itemInfoReceived:UnregisterEvent("GET_ITEM_INFO_RECEIVED") end end -enrichDatabase(); +enrichDatabase() itemInfoReceived:SetScript("OnEvent", function() - if (not delayedEnrichDatabase) then - delayedEnrichDatabase = true; + if not delayedEnrichDatabase then + delayedEnrichDatabase = true C_Timer.After(2, function() - enrichDatabase(); - delayedEnrichDatabase = false; + enrichDatabase() + delayedEnrichDatabase = false end) end -end); - +end) -- Enrich Display templates with default values for regionType, regionData in pairs(WeakAuras.regionOptions) do - if (regionData.templates) then + if regionData.templates then for _, item in ipairs(regionData.templates) do for k, v in pairs(WeakAuras.regionTypes[regionType].default) do - if (item.data[k] == nil) then - item.data[k] = v; + if item.data[k] == nil then + item.data[k] = v end end end end end -WeakAuras.triggerTemplates = templates; +WeakAuras.triggerTemplates = templates diff --git a/WeakAurasTemplates/TriggerTemplatesDataWrath.lua b/WeakAurasTemplates/TriggerTemplatesDataWrath.lua index d1dbf5bd65..6ac7db7bef 100644 --- a/WeakAurasTemplates/TriggerTemplatesDataWrath.lua +++ b/WeakAurasTemplates/TriggerTemplatesDataWrath.lua @@ -1,43 +1,43 @@ local WeakAuras = WeakAuras -if not WeakAuras.IsWrathClassic() then return end +if not WeakAuras.IsWrathClassic() then + return +end local L = WeakAuras.L local GetSpellInfo, tinsert, GetItemInfo, GetSpellDescription, C_Timer, Spell = GetSpellInfo, tinsert, GetItemInfo, GetSpellDescription, C_Timer, Spell -- The templates tables are created on demand -local templates = - { - class = { }, - race = { - Human = {}, - NightElf = {}, - Dwarf = {}, - Gnome = {}, - Draenei = {}, - Orc = {}, - Scourge = {}, - Tauren = {}, - Troll = {}, - BloodElf = {}, - }, - general = { - title = L["General"], - icon = 136116, - args = {} - }, - } +local templates = { + class = {}, + race = { + Human = {}, + NightElf = {}, + Dwarf = {}, + Gnome = {}, + Draenei = {}, + Orc = {}, + Scourge = {}, + Tauren = {}, + Troll = {}, + BloodElf = {}, + }, + general = { + title = L["General"], + icon = 136116, + args = {}, + }, +} local manaIcon = "Interface\\Icons\\spell_frost_manarecharge.blp" local rageIcon = "Interface\\Icons\\ability_racial_bloodrage.blp" local comboPointsIcon = "Interface\\Icons\\ability_backstab" -local powerTypes = - { - [0] = { name = POWER_TYPE_MANA, icon = manaIcon }, - [1] = { name = POWER_TYPE_RED_POWER, icon = rageIcon}, - [2] = { name = POWER_TYPE_FOCUS, icon = "Interface\\Icons\\ability_hunter_focusfire"}, - [3] = { name = POWER_TYPE_ENERGY, icon = "Interface\\Icons\\spell_shadow_shadowworddominate"}, - [4] = { name = COMBO_POINTS, icon = comboPointsIcon}, - } +local powerTypes = { + [0] = { name = POWER_TYPE_MANA, icon = manaIcon }, + [1] = { name = POWER_TYPE_RED_POWER, icon = rageIcon }, + [2] = { name = POWER_TYPE_FOCUS, icon = "Interface\\Icons\\ability_hunter_focusfire" }, + [3] = { name = POWER_TYPE_ENERGY, icon = "Interface\\Icons\\spell_shadow_shadowworddominate" }, + [4] = { name = COMBO_POINTS, icon = comboPointsIcon }, +} -- Collected by WeakAurasTemplateCollector: -------------------------------------------------------------------------------- @@ -47,91 +47,91 @@ templates.class.WARRIOR = { [1] = { title = L["Buffs"], args = { - { spell = 469, type = "buff", unit = "player"}, -- Commanding Shout - { spell = 2565, type = "buff", unit = "player"}, -- Shield Block - { spell = 6673, type = "buff", unit = "player"}, -- Battle Shout - { spell = 18499, type = "buff", unit = "player"}, -- Berserker Rage - { spell = 12292, type = "buff", unit = "player"}, -- Sweeping Strikes - { spell = 12328, type = "buff", unit = "player"}, -- Death Wish - { spell = 12317, type = "buff", unit = "player"}, -- Enrage - { spell = 12319, type = "buff", unit = "player"}, -- Flurry - { spell = 12975, type = "buff", unit = "player"}, -- Last Stand - { spell = 23920, type = "buff", unit = "player"}, -- Spell Reflection - { spell = 46913, type = "buff", unit = "player"}, -- Bloodsurge + { spell = 469, type = "buff", unit = "player" }, -- Commanding Shout + { spell = 2565, type = "buff", unit = "player" }, -- Shield Block + { spell = 6673, type = "buff", unit = "player" }, -- Battle Shout + { spell = 18499, type = "buff", unit = "player" }, -- Berserker Rage + { spell = 12292, type = "buff", unit = "player" }, -- Sweeping Strikes + { spell = 12328, type = "buff", unit = "player" }, -- Death Wish + { spell = 12317, type = "buff", unit = "player" }, -- Enrage + { spell = 12319, type = "buff", unit = "player" }, -- Flurry + { spell = 12975, type = "buff", unit = "player" }, -- Last Stand + { spell = 23920, type = "buff", unit = "player" }, -- Spell Reflection + { spell = 46913, type = "buff", unit = "player" }, -- Bloodsurge }, - icon = 132333 + icon = 132333, }, [2] = { title = L["Debuffs"], args = { - { spell = 355, type = "debuff", unit = "target"}, -- Taunt - { spell = 676, type = "debuff", unit = "target"}, -- Disarm - { spell = 694, type = "debuff", unit = "target"}, -- Mocking Blow - { spell = 772, type = "debuff", unit = "target"}, -- Rend - { spell = 1160, type = "debuff", unit = "target"}, -- Demoralizing Shout - { spell = 1715, type = "debuff", unit = "target"}, -- Hamstring - { spell = 5246, type = "debuff", unit = "target"}, -- Intimidating Shout - { spell = 6343, type = "debuff", unit = "target"}, -- Thunder Clap - { spell = 7384, type = "debuff", unit = "target"}, -- Sunder Armor - { spell = 12289, type = "debuff", unit = "target"}, -- Improved Hamstring - { spell = 12294, type = "debuff", unit = "target"}, -- Mortal Strike - { spell = 12797, type = "debuff", unit = "target"}, -- Improved Revenge - { spell = 12809, type = "debuff", unit = "target"}, -- Concussion Blow + { spell = 355, type = "debuff", unit = "target" }, -- Taunt + { spell = 676, type = "debuff", unit = "target" }, -- Disarm + { spell = 694, type = "debuff", unit = "target" }, -- Mocking Blow + { spell = 772, type = "debuff", unit = "target" }, -- Rend + { spell = 1160, type = "debuff", unit = "target" }, -- Demoralizing Shout + { spell = 1715, type = "debuff", unit = "target" }, -- Hamstring + { spell = 5246, type = "debuff", unit = "target" }, -- Intimidating Shout + { spell = 6343, type = "debuff", unit = "target" }, -- Thunder Clap + { spell = 7384, type = "debuff", unit = "target" }, -- Sunder Armor + { spell = 12289, type = "debuff", unit = "target" }, -- Improved Hamstring + { spell = 12294, type = "debuff", unit = "target" }, -- Mortal Strike + { spell = 12797, type = "debuff", unit = "target" }, -- Improved Revenge + { spell = 12809, type = "debuff", unit = "target" }, -- Concussion Blow }, - icon = 132366 + icon = 132366, }, [3] = { title = L["Abilities"], args = { - { spell = 72, type = "ability", debuff = true, requiresTarget = true, form = {1, 2}}, -- Shield Bash - { spell = 78, type = "ability", queued = true}, -- Heroic Strike - { spell = 100, type = "ability", requiresTarget = true, form = 1}, -- Charge - { spell = 355, type = "ability", debuff = true, requiresTarget = true, form = 2}, -- Taunt - { spell = 469, type = "ability", buff = true}, -- Commanding Shout - { spell = 676, type = "ability", debuff = true, requiresTarget = true, form = 2}, -- Disarm - { spell = 694, type = "ability", debuff = true, requiresTarget = true, form = {1, 2}}, -- Mocking Blow - { spell = 772, type = "ability", debuff = true, requiresTarget = true}, -- Rend - { spell = 845, type = "ability", queued = true}, -- Cleave - { spell = 871, type = "ability", buff = true, form = 2}, -- Shield Wall - { spell = 1160, type = "ability", debuff = true}, -- Demoralizing Shout - { spell = 1161, type = "ability", debuff = true}, -- Challenging Shout - { spell = 1464, type = "ability", requiresTarget = true, buff = true, buffId = 46913}, -- Slam - { spell = 1680, type = "ability", buff = true, buffId = 46913, form = 3}, -- Whirlwind - { spell = 1715, type = "ability", requiresTarget = true, form = {1, 2}}, -- Hamstring - { spell = 1719, type = "ability", buff = true, form = 3}, -- Recklessness - { spell = 2565, type = "ability", buff = true, form = 2}, -- Shield Block - { spell = 2687, type = "ability", buff = true}, -- Bloodrage - { spell = 3411, type = "ability", requiresTarget = true, form = 2}, -- Intervene - { spell = 5246, type = "ability", debuff = true, requiresTarget = true}, -- Intimidating Shout - { spell = 5308, type = "ability", requiresTarget = true, form = {1, 3}}, -- Execute - { spell = 6343, type = "ability", debuff = true, form = {1, 2}}, -- Thunder Clap - { spell = 6552, type = "ability", requiresTarget = true, form = 3}, -- Pummel - { spell = 6572, type = "ability", requiresTarget = true, usable = true, form = 2}, -- Revenge - { spell = 6673, type = "ability", buff = true}, -- Battle Shout - { spell = 7384, type = "ability", requiresTarget = true, buff = true, buffId = 60503, form = 1}, -- Overpower - { spell = 7386, type = "ability", requiresTarget = true, debuff = true}, -- Sunder Armor - { spell = 12323, type = "ability", debuff = true, talent = 46}, -- Piercing Howl - { spell = 12328, type = "ability", buff = true, talent = 53}, -- Sweeping Strikes - { spell = 12294, type = "ability", requiresTarget = true, talent = 20}, -- Mortal Strike - { spell = 12809, type = "ability", requiresTarget = true, debuff = true, talent = 94}, -- Concussion Blow - { spell = 12975, type = "ability", buff = true, talent = 86}, -- Last Stand - { spell = 12292, type = "ability", buff = true, talent = 13}, -- Death Wish - { spell = 18499, type = "ability", buff = true}, -- Berserker Rage - { spell = 20230, type = "ability", buff = true, form = 1}, -- Retaliation - { spell = 20252, type = "ability", requiresTarget = true, form = 3}, -- Intercept - { spell = 20243, type = "ability", requiresTarget = true, talent = 102}, -- Devastate - { spell = 23881, type = "ability", requiresTarget = true, talent = 58}, -- Bloodthirst - { spell = 23920, type = "ability", buff = true, form = {1, 2}}, -- Spell Reflection - { spell = 23922, type = "ability", requiresTarget = true, talent = 99}, -- Shield Slam - { spell = 29801, type = "ability", requiresTarget = true, talent = 61}, -- Rampage - { spell = 34428, type = "ability", requiresTarget = true, usable = true}, -- Victory Rush - { spell = 46924, type = "ability", buff = true}, -- Bladestorm - { spell = 55694, type = "ability", buff = true}, -- Enraged Regeneration - { spell = 57755, type = "ability", requiresTarget = true}, -- Heroic Throw - { spell = 60970, type = "ability", talent = 65}, -- Heroic Fury - { spell = 64382, type = "ability", requiresTarget = true, debuff = true, form = 1}, -- Shattering Throw + { spell = 72, type = "ability", debuff = true, requiresTarget = true, form = { 1, 2 } }, -- Shield Bash + { spell = 78, type = "ability", queued = true }, -- Heroic Strike + { spell = 100, type = "ability", requiresTarget = true, form = 1 }, -- Charge + { spell = 355, type = "ability", debuff = true, requiresTarget = true, form = 2 }, -- Taunt + { spell = 469, type = "ability", buff = true }, -- Commanding Shout + { spell = 676, type = "ability", debuff = true, requiresTarget = true, form = 2 }, -- Disarm + { spell = 694, type = "ability", debuff = true, requiresTarget = true, form = { 1, 2 } }, -- Mocking Blow + { spell = 772, type = "ability", debuff = true, requiresTarget = true }, -- Rend + { spell = 845, type = "ability", queued = true }, -- Cleave + { spell = 871, type = "ability", buff = true, form = 2 }, -- Shield Wall + { spell = 1160, type = "ability", debuff = true }, -- Demoralizing Shout + { spell = 1161, type = "ability", debuff = true }, -- Challenging Shout + { spell = 1464, type = "ability", requiresTarget = true, buff = true, buffId = 46913 }, -- Slam + { spell = 1680, type = "ability", buff = true, buffId = 46913, form = 3 }, -- Whirlwind + { spell = 1715, type = "ability", requiresTarget = true, form = { 1, 2 } }, -- Hamstring + { spell = 1719, type = "ability", buff = true, form = 3 }, -- Recklessness + { spell = 2565, type = "ability", buff = true, form = 2 }, -- Shield Block + { spell = 2687, type = "ability", buff = true }, -- Bloodrage + { spell = 3411, type = "ability", requiresTarget = true, form = 2 }, -- Intervene + { spell = 5246, type = "ability", debuff = true, requiresTarget = true }, -- Intimidating Shout + { spell = 5308, type = "ability", requiresTarget = true, form = { 1, 3 } }, -- Execute + { spell = 6343, type = "ability", debuff = true, form = { 1, 2 } }, -- Thunder Clap + { spell = 6552, type = "ability", requiresTarget = true, form = 3 }, -- Pummel + { spell = 6572, type = "ability", requiresTarget = true, usable = true, form = 2 }, -- Revenge + { spell = 6673, type = "ability", buff = true }, -- Battle Shout + { spell = 7384, type = "ability", requiresTarget = true, buff = true, buffId = 60503, form = 1 }, -- Overpower + { spell = 7386, type = "ability", requiresTarget = true, debuff = true }, -- Sunder Armor + { spell = 12323, type = "ability", debuff = true, talent = 46 }, -- Piercing Howl + { spell = 12328, type = "ability", buff = true, talent = 53 }, -- Sweeping Strikes + { spell = 12294, type = "ability", requiresTarget = true, talent = 20 }, -- Mortal Strike + { spell = 12809, type = "ability", requiresTarget = true, debuff = true, talent = 94 }, -- Concussion Blow + { spell = 12975, type = "ability", buff = true, talent = 86 }, -- Last Stand + { spell = 12292, type = "ability", buff = true, talent = 13 }, -- Death Wish + { spell = 18499, type = "ability", buff = true }, -- Berserker Rage + { spell = 20230, type = "ability", buff = true, form = 1 }, -- Retaliation + { spell = 20252, type = "ability", requiresTarget = true, form = 3 }, -- Intercept + { spell = 20243, type = "ability", requiresTarget = true, talent = 102 }, -- Devastate + { spell = 23881, type = "ability", requiresTarget = true, talent = 58 }, -- Bloodthirst + { spell = 23920, type = "ability", buff = true, form = { 1, 2 } }, -- Spell Reflection + { spell = 23922, type = "ability", requiresTarget = true, talent = 99 }, -- Shield Slam + { spell = 29801, type = "ability", requiresTarget = true, talent = 61 }, -- Rampage + { spell = 34428, type = "ability", requiresTarget = true, usable = true }, -- Victory Rush + { spell = 46924, type = "ability", buff = true }, -- Bladestorm + { spell = 55694, type = "ability", buff = true }, -- Enraged Regeneration + { spell = 57755, type = "ability", requiresTarget = true }, -- Heroic Throw + { spell = 60970, type = "ability", talent = 65 }, -- Heroic Fury + { spell = 64382, type = "ability", requiresTarget = true, debuff = true, form = 1 }, -- Shattering Throw }, - icon = 132355 + icon = 132355, }, [4] = {}, [5] = {}, @@ -139,11 +139,10 @@ templates.class.WARRIOR = { [7] = {}, [8] = { title = L["Resources"], - args = { - }, + args = {}, icon = rageIcon, - } - } + }, + }, } templates.class.PALADIN = { @@ -151,63 +150,63 @@ templates.class.PALADIN = { [1] = { title = L["Buffs"], args = { - { spell = 498, type = "buff", unit = "player"}, -- Divine Protection - { spell = 642, type = "buff", unit = "player"}, -- Divine Shield - { spell = 1022, type = "buff", unit = "group"}, -- Blessing of Protection - { spell = 1044, type = "buff", unit = "group"}, -- Blessing of Freedom - { spell = 6940, type = "buff", unit = "group"}, -- Blessing of Sacrifice + { spell = 498, type = "buff", unit = "player" }, -- Divine Protection + { spell = 642, type = "buff", unit = "player" }, -- Divine Shield + { spell = 1022, type = "buff", unit = "group" }, -- Blessing of Protection + { spell = 1044, type = "buff", unit = "group" }, -- Blessing of Freedom + { spell = 6940, type = "buff", unit = "group" }, -- Blessing of Sacrifice }, - icon = 135964 + icon = 135964, }, [2] = { title = L["Debuffs"], args = { - { spell = 853, type = "debuff", unit = "target"}, -- Hammer of Justice + { spell = 853, type = "debuff", unit = "target" }, -- Hammer of Justice }, - icon = 135952 + icon = 135952, }, [3] = { title = L["Abilities"], args = { - { spell = 498, type = "ability", buff = true}, -- Divine Protection - { spell = 633, type = "ability"}, -- Lay on Hands - { spell = 642, type = "ability", buff = true}, -- Divine Shield - { spell = 709, type = "ability", buff = true}, -- Righteous Fury - { spell = 853, type = "ability", requiresTarget = true, debuff = true}, -- Hammer of Justice - { spell = 879, type = "ability", requiresTarget = true, usable = true}, -- Exorcism - { spell = 1022, type = "ability", buff = true}, -- Blessing of Protection - { spell = 1044, type = "ability", buff = true}, -- Blessing of Freedom - { spell = 1152, type = "ability"}, -- Purify - { spell = 2812, type = "ability"}, -- Holy Wrath - { spell = 4987, type = "ability"}, -- Cleanse - { spell = 6940, type = "ability"}, -- Blessing of Sacrifice - { spell = 10326, type = "ability", debuff = true, requiresTarget = true, usable = true}, -- Turn Evil - { spell = 19876, type = "ability", buff = true}, -- Shadow Resistance Aura - { spell = 19888, type = "ability", buff = true}, -- Frost Resistance Aura - { spell = 19891, type = "ability", buff = true}, -- Fire Resistance Aura - { spell = 20066, type = "ability", requiresTarget = true, debuff = true, talent = 99}, -- Repentance - { spell = 20164, type = "ability", buff = true}, -- Seal of Justice - { spell = 20165, type = "ability", buff = true}, -- Seal of Light - { spell = 20166, type = "ability", buff = true}, -- Seal of Wisdom - { spell = 20271, type = "ability", buff = true, requiresTarget = true}, -- Judgement - { spell = 20375, type = "ability", buff = true, talent = 88}, -- Seal of Command - { spell = 20473, type = "ability", talent = 17}, -- Holy Shock - { spell = 20925, type = "ability", charges = true, buff = true, talent = 59}, -- Holy Shield - { spell = 21082, type = "ability", buff = true}, -- Seal of the Crusader - { spell = 21084, type = "ability", buff = true}, -- Seal of Righteousness - { spell = 24275, type = "ability", requiresTarget = true, usable = true}, -- Hammer of Wrath - { spell = 26573, type = "ability"}, -- Consecration - { spell = 31789, type = "ability"}, -- Righteous Defense - { spell = 31842, type = "ability", buff = true, talent = 20}, -- Divine Illumination - { spell = 31884, type = "ability", buff = true}, -- Avenging Wrath - { spell = 31892, type = "ability", buff = true}, -- Seal of Blood - { spell = 31935, type = "ability", talent = 62}, -- Avenger's Shield - { spell = 35395, type = "ability", requiresTarget = true, talent = 102}, -- Crusader Strike - { spell = 53585, type = "ability", talent = 104}, -- Divine Storm - { spell = 53595, type = "ability", talent = 61}, -- Hammer of the Righteous - { spell = 348704, type = "ability", buff = true}, -- Seal of Vengeance + { spell = 498, type = "ability", buff = true }, -- Divine Protection + { spell = 633, type = "ability" }, -- Lay on Hands + { spell = 642, type = "ability", buff = true }, -- Divine Shield + { spell = 709, type = "ability", buff = true }, -- Righteous Fury + { spell = 853, type = "ability", requiresTarget = true, debuff = true }, -- Hammer of Justice + { spell = 879, type = "ability", requiresTarget = true, usable = true }, -- Exorcism + { spell = 1022, type = "ability", buff = true }, -- Blessing of Protection + { spell = 1044, type = "ability", buff = true }, -- Blessing of Freedom + { spell = 1152, type = "ability" }, -- Purify + { spell = 2812, type = "ability" }, -- Holy Wrath + { spell = 4987, type = "ability" }, -- Cleanse + { spell = 6940, type = "ability" }, -- Blessing of Sacrifice + { spell = 10326, type = "ability", debuff = true, requiresTarget = true, usable = true }, -- Turn Evil + { spell = 19876, type = "ability", buff = true }, -- Shadow Resistance Aura + { spell = 19888, type = "ability", buff = true }, -- Frost Resistance Aura + { spell = 19891, type = "ability", buff = true }, -- Fire Resistance Aura + { spell = 20066, type = "ability", requiresTarget = true, debuff = true, talent = 99 }, -- Repentance + { spell = 20164, type = "ability", buff = true }, -- Seal of Justice + { spell = 20165, type = "ability", buff = true }, -- Seal of Light + { spell = 20166, type = "ability", buff = true }, -- Seal of Wisdom + { spell = 20271, type = "ability", buff = true, requiresTarget = true }, -- Judgement + { spell = 20375, type = "ability", buff = true, talent = 88 }, -- Seal of Command + { spell = 20473, type = "ability", talent = 17 }, -- Holy Shock + { spell = 20925, type = "ability", charges = true, buff = true, talent = 59 }, -- Holy Shield + { spell = 21082, type = "ability", buff = true }, -- Seal of the Crusader + { spell = 21084, type = "ability", buff = true }, -- Seal of Righteousness + { spell = 24275, type = "ability", requiresTarget = true, usable = true }, -- Hammer of Wrath + { spell = 26573, type = "ability" }, -- Consecration + { spell = 31789, type = "ability" }, -- Righteous Defense + { spell = 31842, type = "ability", buff = true, talent = 20 }, -- Divine Illumination + { spell = 31884, type = "ability", buff = true }, -- Avenging Wrath + { spell = 31892, type = "ability", buff = true }, -- Seal of Blood + { spell = 31935, type = "ability", talent = 62 }, -- Avenger's Shield + { spell = 35395, type = "ability", requiresTarget = true, talent = 102 }, -- Crusader Strike + { spell = 53585, type = "ability", talent = 104 }, -- Divine Storm + { spell = 53595, type = "ability", talent = 61 }, -- Hammer of the Righteous + { spell = 348704, type = "ability", buff = true }, -- Seal of Vengeance }, - icon = 135972 + icon = 135972, }, [4] = {}, [5] = {}, @@ -215,11 +214,10 @@ templates.class.PALADIN = { [7] = {}, [8] = { title = L["Resources"], - args = { - }, + args = {}, icon = manaIcon, }, - } + }, } templates.class.HUNTER = { @@ -227,75 +225,75 @@ templates.class.HUNTER = { [1] = { title = L["Buffs"], args = { - { spell = 136, type = "buff", unit = "pet"}, -- Mend Pet - { spell = 3045, type = "buff", unit = "player"}, -- Rapid Fire - { spell = 5384, type = "buff", unit = "player"}, -- Feign Death - { spell = 6197, type = "buff", unit = "player"}, -- Eagle Eye - { spell = 19621, type = "buff", unit = "pet"}, -- Frenzy - { spell = 24450, type = "buff", unit = "pet"}, -- Prowl + { spell = 136, type = "buff", unit = "pet" }, -- Mend Pet + { spell = 3045, type = "buff", unit = "player" }, -- Rapid Fire + { spell = 5384, type = "buff", unit = "player" }, -- Feign Death + { spell = 6197, type = "buff", unit = "player" }, -- Eagle Eye + { spell = 19621, type = "buff", unit = "pet" }, -- Frenzy + { spell = 24450, type = "buff", unit = "pet" }, -- Prowl }, - icon = 132242 + icon = 132242, }, [2] = { title = L["Debuffs"], args = { - { spell = 1130, type = "debuff", unit = "target"}, -- Hunter's Mark - { spell = 1513, type = "debuff", unit = "target"}, -- Scare Beast - { spell = 1978, type = "debuff", unit = "target"}, -- Serpent Sting - { spell = 2649, type = "debuff", unit = "target"}, -- Growl - { spell = 2974, type = "debuff", unit = "target"}, -- Wing Clip - { spell = 3034, type = "debuff", unit = "target"}, -- Viper Sting - { spell = 3043, type = "debuff", unit = "target"}, -- Scorpid Sting - { spell = 3355, type = "debuff", unit = "multi"}, -- Freezing Trap - { spell = 5116, type = "debuff", unit = "target"}, -- Concussive Shot - { spell = 24394, type = "debuff", unit = "target"}, -- Intimidation + { spell = 1130, type = "debuff", unit = "target" }, -- Hunter's Mark + { spell = 1513, type = "debuff", unit = "target" }, -- Scare Beast + { spell = 1978, type = "debuff", unit = "target" }, -- Serpent Sting + { spell = 2649, type = "debuff", unit = "target" }, -- Growl + { spell = 2974, type = "debuff", unit = "target" }, -- Wing Clip + { spell = 3034, type = "debuff", unit = "target" }, -- Viper Sting + { spell = 3043, type = "debuff", unit = "target" }, -- Scorpid Sting + { spell = 3355, type = "debuff", unit = "multi" }, -- Freezing Trap + { spell = 5116, type = "debuff", unit = "target" }, -- Concussive Shot + { spell = 24394, type = "debuff", unit = "target" }, -- Intimidation }, - icon = 135860 + icon = 135860, }, [3] = { title = L["Abilities"], args = { - { spell = 781, type = "ability"}, -- Disengage - { spell = 1130, type = "ability", requiresTarget = true, debuff = true}, -- Hunter's Mark - { spell = 1495, type = "ability", requiresTarget = true, usable = true}, -- Mongoose Bite - { spell = 1499, type = "ability"}, -- Freezing Trap - { spell = 1510, type = "ability"}, -- Volley - { spell = 1513, type = "ability", requiresTarget = true, debuff = true}, -- Scare Beast - { spell = 1543, type = "ability", duration = 30}, -- Flare - { spell = 1978, type = "ability", requiresTarget = true, debuff = true}, -- Serpent Sting - { spell = 2643, type = "ability"}, -- Multi-Shot - { spell = 2649, type = "ability", requiresTarget = true, debuff = true}, -- Growl - { spell = 2973, type = "ability", queued = true}, -- Raptor Strike - { spell = 2974, type = "ability", requiresTarget = true, debuff = true}, -- Wing Clip - { spell = 3034, type = "ability", requiresTarget = true, debuff = true}, -- Viper Sting - { spell = 3043, type = "ability", requiresTarget = true, debuff = true}, -- Scorpid Sting - { spell = 3044, type = "ability", requiresTarget = true}, -- Arcane Shot - { spell = 3045, type = "ability", buff = true}, -- Rapid Fire - { spell = 5116, type = "ability", requiresTarget = true, debuff = true}, -- Concussive Shot - { spell = 5384, type = "ability", buff = true, unit = "player"}, -- Feign Death - { spell = 13795, type = "ability"}, -- Immolation Trap - { spell = 13809, type = "ability"}, -- Frost Trap - { spell = 13813, type = "ability"}, -- Explosive Trap - { spell = 16827, type = "ability", requiresTarget = true}, -- Claw - { spell = 19263, type = "ability", buff = true}, -- Deterrence -TODO - { spell = 19306, type = "ability", requiresTarget = true, usable = true, talent = 96}, -- Counterattack - { spell = 19434, type = "ability", requiresTarget = true, talent = 47}, -- Aimed Shot - { spell = 19386, type = "ability", requiresTarget = true, debuff = true, talent = 100}, -- Wyvern Sting - { spell = 19503, type = "ability", requiresTarget = true, debuff = true, talent = 52}, -- Scatter Shot - { spell = 19574, type = "ability", buff = true, talent = 18}, -- Bestial Wrath - { spell = 19577, type = "ability", requiresTarget = true, debuff = true, talent = 13}, -- Intimidation - { spell = 19801, type = "ability", requiresTarget = true}, -- Tranquilizing Shot - { spell = 20736, type = "ability", requiresTarget = true}, -- Distracting Shot - { spell = 23989, type = "ability", talent = 103}, -- Readiness - { spell = 34120, type = "ability", requiresTarget = true}, -- Steady Shot - { spell = 34477, type = "ability", requiresTarget = true, debuff = true}, -- Misdirection - { spell = 34490, type = "ability", requiresTarget = true, debuff = true, talent = 60}, -- Silencing Shot - { spell = 34600, type = "ability"}, -- Snake Trap - { spell = 53209, type = "ability", requiresTarget = true, talent = 66}, -- Chimera Shot - { spell = 53301, type = "ability", requiresTarget = true, talent = 106}, -- Explosive Shot - { spell = 53351, type = "ability", requiresTarget = true, usable = true}, -- Kill Shot + { spell = 781, type = "ability" }, -- Disengage + { spell = 1130, type = "ability", requiresTarget = true, debuff = true }, -- Hunter's Mark + { spell = 1495, type = "ability", requiresTarget = true, usable = true }, -- Mongoose Bite + { spell = 1499, type = "ability" }, -- Freezing Trap + { spell = 1510, type = "ability" }, -- Volley + { spell = 1513, type = "ability", requiresTarget = true, debuff = true }, -- Scare Beast + { spell = 1543, type = "ability", duration = 30 }, -- Flare + { spell = 1978, type = "ability", requiresTarget = true, debuff = true }, -- Serpent Sting + { spell = 2643, type = "ability" }, -- Multi-Shot + { spell = 2649, type = "ability", requiresTarget = true, debuff = true }, -- Growl + { spell = 2973, type = "ability", queued = true }, -- Raptor Strike + { spell = 2974, type = "ability", requiresTarget = true, debuff = true }, -- Wing Clip + { spell = 3034, type = "ability", requiresTarget = true, debuff = true }, -- Viper Sting + { spell = 3043, type = "ability", requiresTarget = true, debuff = true }, -- Scorpid Sting + { spell = 3044, type = "ability", requiresTarget = true }, -- Arcane Shot + { spell = 3045, type = "ability", buff = true }, -- Rapid Fire + { spell = 5116, type = "ability", requiresTarget = true, debuff = true }, -- Concussive Shot + { spell = 5384, type = "ability", buff = true, unit = "player" }, -- Feign Death + { spell = 13795, type = "ability" }, -- Immolation Trap + { spell = 13809, type = "ability" }, -- Frost Trap + { spell = 13813, type = "ability" }, -- Explosive Trap + { spell = 16827, type = "ability", requiresTarget = true }, -- Claw + { spell = 19263, type = "ability", buff = true }, -- Deterrence -TODO + { spell = 19306, type = "ability", requiresTarget = true, usable = true, talent = 96 }, -- Counterattack + { spell = 19434, type = "ability", requiresTarget = true, talent = 47 }, -- Aimed Shot + { spell = 19386, type = "ability", requiresTarget = true, debuff = true, talent = 100 }, -- Wyvern Sting + { spell = 19503, type = "ability", requiresTarget = true, debuff = true, talent = 52 }, -- Scatter Shot + { spell = 19574, type = "ability", buff = true, talent = 18 }, -- Bestial Wrath + { spell = 19577, type = "ability", requiresTarget = true, debuff = true, talent = 13 }, -- Intimidation + { spell = 19801, type = "ability", requiresTarget = true }, -- Tranquilizing Shot + { spell = 20736, type = "ability", requiresTarget = true }, -- Distracting Shot + { spell = 23989, type = "ability", talent = 103 }, -- Readiness + { spell = 34120, type = "ability", requiresTarget = true }, -- Steady Shot + { spell = 34477, type = "ability", requiresTarget = true, debuff = true }, -- Misdirection + { spell = 34490, type = "ability", requiresTarget = true, debuff = true, talent = 60 }, -- Silencing Shot + { spell = 34600, type = "ability" }, -- Snake Trap + { spell = 53209, type = "ability", requiresTarget = true, talent = 66 }, -- Chimera Shot + { spell = 53301, type = "ability", requiresTarget = true, talent = 106 }, -- Explosive Shot + { spell = 53351, type = "ability", requiresTarget = true, usable = true }, -- Kill Shot }, - icon = 135130 + icon = 135130, }, [4] = {}, [5] = {}, @@ -303,11 +301,10 @@ templates.class.HUNTER = { [7] = {}, [8] = { title = L["Resources"], - args = { - }, + args = {}, icon = manaIcon, }, - } + }, } templates.class.ROGUE = { @@ -315,68 +312,68 @@ templates.class.ROGUE = { [1] = { title = L["Buffs"], args = { - { spell = 2983, type = "buff", unit = "player"}, -- Sprint - { spell = 5171, type = "buff", unit = "player"}, -- Slice and Dice - { spell = 5277, type = "buff", unit = "player"}, -- Evasion - { spell = 13750, type = "buff", unit = "player"}, -- Adrenaline Rush - { spell = 13877, type = "buff", unit = "player"}, -- Blade Fury - { spell = 14177, type = "buff", unit = "player"}, -- Cold Blood - { spell = 14149, type = "buff", unit = "player"}, -- Remorseless - { spell = 14278, type = "buff", unit = "player"}, -- Ghostly Strike + { spell = 2983, type = "buff", unit = "player" }, -- Sprint + { spell = 5171, type = "buff", unit = "player" }, -- Slice and Dice + { spell = 5277, type = "buff", unit = "player" }, -- Evasion + { spell = 13750, type = "buff", unit = "player" }, -- Adrenaline Rush + { spell = 13877, type = "buff", unit = "player" }, -- Blade Fury + { spell = 14177, type = "buff", unit = "player" }, -- Cold Blood + { spell = 14149, type = "buff", unit = "player" }, -- Remorseless + { spell = 14278, type = "buff", unit = "player" }, -- Ghostly Strike }, - icon = 132290 + icon = 132290, }, [2] = { title = L["Debuffs"], args = { - { spell = 703, type = "debuff", unit = "target"}, -- Garrote - { spell = 8643, type = "debuff", unit = "target"}, -- Kidney SHot - { spell = 14251, type = "debuff", unit = "target"}, -- Riposte - { spell = 11198, type = "debuff", unit = "target"}, -- Expose Armor - { spell = 18425, type = "debuff", unit = "target"}, -- Kick - Silenced - { spell = 17348, type = "debuff", unit = "target"}, -- Hemorrhage - { spell = 14183, type = "debuff", unit = "target"}, -- Premeditation + { spell = 703, type = "debuff", unit = "target" }, -- Garrote + { spell = 8643, type = "debuff", unit = "target" }, -- Kidney SHot + { spell = 14251, type = "debuff", unit = "target" }, -- Riposte + { spell = 11198, type = "debuff", unit = "target" }, -- Expose Armor + { spell = 18425, type = "debuff", unit = "target" }, -- Kick - Silenced + { spell = 17348, type = "debuff", unit = "target" }, -- Hemorrhage + { spell = 14183, type = "debuff", unit = "target" }, -- Premeditation }, - icon = 132302 + icon = 132302, }, [3] = { title = L["Abilities"], args = { - { spell = 53, type = "ability", requiresTarget = true, usable = true}, -- Backstab - { spell = 703, type = "ability", requiresTarget = true, debuff = true}, -- Garrote - { spell = 921, type = "ability", requiresTarget = true, usable = true}, -- Pick Pocket - { spell = 1329, type = "ability", requiresTarget = true, usable = true, talent = 21}, -- Mutilate - { spell = 1725, type = "ability"}, -- Distract - { spell = 1752, type = "ability", requiresTarget = true}, -- Sinister Strike - { spell = 1766, type = "ability", requiresTarget = true}, -- Kick - { spell = 1776, type = "ability", requiresTarget = true, usable = true, debuff = true}, -- Gouge - { spell = 1784, type = "ability", buff = true}, -- Stealth - { spell = 1856, type = "ability", buff = true}, -- Vanish - { spell = 2094, type = "ability", requiresTarget = true, debuff = true}, -- Blind - { spell = 2098, type = "ability", requiresTarget = true}, -- Eviscerate - { spell = 2983, type = "ability", buff = true}, -- Sprint - { spell = 5171, type = "ability", requiresTarget = true, buff = true}, -- Slice and Dice - { spell = 5277, type = "ability", buff = true}, -- Evasion - { spell = 6770, type = "ability", requiresTarget = true, usable = true, debuff = true}, -- Sap - { spell = 8643, type = "ability", requiresTarget = true, usable = true, debuff = true}, -- Kidney Shot - { spell = 8647, type = "ability", requiresTarget = true, debuff = true}, -- Expose Armor - { spell = 13750, type = "ability", buff = true, talent = 61}, -- Adrenaline Rush - { spell = 13877, type = "ability", buff = true, talent = 54}, -- Blade Fury - { spell = 14177, type = "ability", buff = true, talent = 13}, -- Cold Blood - { spell = 14183, type = "ability", requiresTarget = true, debuff = true, talent = 99}, -- Premeditation - { spell = 14185, type = "ability"}, -- Preparation - { spell = 14251, type = "ability", requiresTarget = true, usable = true, debuff = true, talent = 48}, -- Riposte - { spell = 14271, type = "ability", requiresTarget = true, buff = true, talent = 87}, -- Ghostly Strike - { spell = 16511, type = "ability", requiresTarget = true, debuff = true, talent = 95}, -- Hemorrhage - { spell = 31224, type = "ability", buff = true}, -- Cloak of Shadows - { spell = 36554, type = "ability", requiresTarget = true, talent = 102}, -- Shadowstep - { spell = 51662, type = "ability", buff = true, talent = 27}, -- Hunger For Blood - { spell = 51690, type = "ability", buff = true, talent = 68}, -- Killing Spree - { spell = 51713, type = "ability", buff = true, talent = 107}, -- Shadow Dance - { spell = 51723, type = "ability"}, -- Fan of Knives - { spell = 57934, type = "ability", buff = true}, -- Tricks of the Trade + { spell = 53, type = "ability", requiresTarget = true, usable = true }, -- Backstab + { spell = 703, type = "ability", requiresTarget = true, debuff = true }, -- Garrote + { spell = 921, type = "ability", requiresTarget = true, usable = true }, -- Pick Pocket + { spell = 1329, type = "ability", requiresTarget = true, usable = true, talent = 21 }, -- Mutilate + { spell = 1725, type = "ability" }, -- Distract + { spell = 1752, type = "ability", requiresTarget = true }, -- Sinister Strike + { spell = 1766, type = "ability", requiresTarget = true }, -- Kick + { spell = 1776, type = "ability", requiresTarget = true, usable = true, debuff = true }, -- Gouge + { spell = 1784, type = "ability", buff = true }, -- Stealth + { spell = 1856, type = "ability", buff = true }, -- Vanish + { spell = 2094, type = "ability", requiresTarget = true, debuff = true }, -- Blind + { spell = 2098, type = "ability", requiresTarget = true }, -- Eviscerate + { spell = 2983, type = "ability", buff = true }, -- Sprint + { spell = 5171, type = "ability", requiresTarget = true, buff = true }, -- Slice and Dice + { spell = 5277, type = "ability", buff = true }, -- Evasion + { spell = 6770, type = "ability", requiresTarget = true, usable = true, debuff = true }, -- Sap + { spell = 8643, type = "ability", requiresTarget = true, usable = true, debuff = true }, -- Kidney Shot + { spell = 8647, type = "ability", requiresTarget = true, debuff = true }, -- Expose Armor + { spell = 13750, type = "ability", buff = true, talent = 61 }, -- Adrenaline Rush + { spell = 13877, type = "ability", buff = true, talent = 54 }, -- Blade Fury + { spell = 14177, type = "ability", buff = true, talent = 13 }, -- Cold Blood + { spell = 14183, type = "ability", requiresTarget = true, debuff = true, talent = 99 }, -- Premeditation + { spell = 14185, type = "ability" }, -- Preparation + { spell = 14251, type = "ability", requiresTarget = true, usable = true, debuff = true, talent = 48 }, -- Riposte + { spell = 14271, type = "ability", requiresTarget = true, buff = true, talent = 87 }, -- Ghostly Strike + { spell = 16511, type = "ability", requiresTarget = true, debuff = true, talent = 95 }, -- Hemorrhage + { spell = 31224, type = "ability", buff = true }, -- Cloak of Shadows + { spell = 36554, type = "ability", requiresTarget = true, talent = 102 }, -- Shadowstep + { spell = 51662, type = "ability", buff = true, talent = 27 }, -- Hunger For Blood + { spell = 51690, type = "ability", buff = true, talent = 68 }, -- Killing Spree + { spell = 51713, type = "ability", buff = true, talent = 107 }, -- Shadow Dance + { spell = 51723, type = "ability" }, -- Fan of Knives + { spell = 57934, type = "ability", buff = true }, -- Tricks of the Trade }, - icon = 132350 + icon = 132350, }, [4] = {}, [5] = {}, @@ -384,11 +381,10 @@ templates.class.ROGUE = { [7] = {}, [8] = { title = L["Resources"], - args = { - }, + args = {}, icon = comboPointsIcon, }, - } + }, } templates.class.PRIEST = { @@ -396,63 +392,63 @@ templates.class.PRIEST = { [1] = { title = L["Buffs"], args = { - { spell = 586, type = "buff", unit = "player"}, -- Fade - { spell = 17, type = "buff", unit = "target"}, -- Power Word: Shield - { spell = 21562, type = "buff", unit = "player"}, -- Power Word: Fortitude - { spell = 2096, type = "buff", unit = "player"}, -- Mind Vision - { spell = 1706, type = "buff", unit = "player"}, -- Levitate + { spell = 586, type = "buff", unit = "player" }, -- Fade + { spell = 17, type = "buff", unit = "target" }, -- Power Word: Shield + { spell = 21562, type = "buff", unit = "player" }, -- Power Word: Fortitude + { spell = 2096, type = "buff", unit = "player" }, -- Mind Vision + { spell = 1706, type = "buff", unit = "player" }, -- Levitate }, - icon = 135940 + icon = 135940, }, [2] = { title = L["Debuffs"], args = { - { spell = 8122, type = "debuff", unit = "target"}, -- Psychic Scream - { spell = 2096, type = "debuff", unit = "target"}, -- Mind Vision - { spell = 589, type = "debuff", unit = "target"}, -- Shadow Word: Pain + { spell = 8122, type = "debuff", unit = "target" }, -- Psychic Scream + { spell = 2096, type = "debuff", unit = "target" }, -- Mind Vision + { spell = 589, type = "debuff", unit = "target" }, -- Shadow Word: Pain { spell = 9484, type = "debuff", unit = "multi" }, -- Shackle Undead - { spell = 34914, type = "debuff", unit = "target", talent = 101}, -- Vampiric Touch + { spell = 34914, type = "debuff", unit = "target", talent = 101 }, -- Vampiric Touch }, - icon = 136207 + icon = 136207, }, [3] = { title = L["Abilities"], args = { - { spell = 17, type = "ability"}, -- Power Word: Shield - { spell = 527, type = "ability"}, -- Purify - { spell = 552, type = "ability"}, -- Abolish Disease - { spell = 585, type = "ability", requireTarget = true}, -- Smite - { spell = 586, type = "ability", buff = true}, -- Fade - { spell = 589, type = "ability", requireTarget = true, debuff = true}, -- Shadow Word: Pain - { spell = 2060, type = "ability"}, -- Greater Heal - { spell = 2061, type = "ability"}, -- Flash Heal - { spell = 6064, type = "ability"}, -- Heal - { spell = 6346, type = "ability", buff = true}, -- Fear Ward - { spell = 8092, type = "ability", requireTarget = true}, -- Mind Blast - { spell = 8122, type = "ability"}, -- Psychic Scream - { spell = 8129, type = "ability", requireTarget = true}, -- Mana Burn - { spell = 10060, type = "ability", buff = true, talent = 19}, -- Power Infusion - { spell = 10876, type = "ability", requireTarget = true}, -- Mana Burn - { spell = 10947, type = "ability", requireTarget = true}, -- Mind Flay - { spell = 10951, type = "ability", buff = true}, -- Inner Fire - { spell = 14751, type = "ability", buff = true, talent = 8}, -- Inner Focus - { spell = 14914, type = "ability", debuff = true, requireTarget = true}, -- Holy Fire - { spell = 15487, type = "ability", debuff = true, requireTarget = true, talent = 92}, -- Silence - { spell = 33206, type = "ability", buff = true, talent = 22}, -- Pain Suppression - { spell = 32375, type = "ability"}, -- Mass Dispel - { spell = 32379, type = "ability", requireTarget = true}, -- Shadow Word: Death - { spell = 32546, type = "ability"}, -- Binding Heal - { spell = 33076, type = "ability"}, -- Prayer of Mending - { spell = 34433, type = "ability", totem = true}, -- Shadowfiend - { spell = 34861, type = "ability", talent = 61}, -- Circle of Healing - { spell = 34914, type = "ability", debuff = true, requireTarget = true, talent = 101}, -- Vampiric Touch - { spell = 47540, type = "ability", requireTarget = true, talent = 24}, -- Penance - { spell = 47585, type = "ability", buff = true, talent = 105}, -- Dispersion - { spell = 47788, type = "ability", buff = true, talent = 66}, -- Guardian Spirit - { spell = 64843, type = "ability"}, -- Divine Hymn - { spell = 64901, type = "ability"}, -- Hymn of Hope + { spell = 17, type = "ability" }, -- Power Word: Shield + { spell = 527, type = "ability" }, -- Purify + { spell = 552, type = "ability" }, -- Abolish Disease + { spell = 585, type = "ability", requireTarget = true }, -- Smite + { spell = 586, type = "ability", buff = true }, -- Fade + { spell = 589, type = "ability", requireTarget = true, debuff = true }, -- Shadow Word: Pain + { spell = 2060, type = "ability" }, -- Greater Heal + { spell = 2061, type = "ability" }, -- Flash Heal + { spell = 6064, type = "ability" }, -- Heal + { spell = 6346, type = "ability", buff = true }, -- Fear Ward + { spell = 8092, type = "ability", requireTarget = true }, -- Mind Blast + { spell = 8122, type = "ability" }, -- Psychic Scream + { spell = 8129, type = "ability", requireTarget = true }, -- Mana Burn + { spell = 10060, type = "ability", buff = true, talent = 19 }, -- Power Infusion + { spell = 10876, type = "ability", requireTarget = true }, -- Mana Burn + { spell = 10947, type = "ability", requireTarget = true }, -- Mind Flay + { spell = 10951, type = "ability", buff = true }, -- Inner Fire + { spell = 14751, type = "ability", buff = true, talent = 8 }, -- Inner Focus + { spell = 14914, type = "ability", debuff = true, requireTarget = true }, -- Holy Fire + { spell = 15487, type = "ability", debuff = true, requireTarget = true, talent = 92 }, -- Silence + { spell = 33206, type = "ability", buff = true, talent = 22 }, -- Pain Suppression + { spell = 32375, type = "ability" }, -- Mass Dispel + { spell = 32379, type = "ability", requireTarget = true }, -- Shadow Word: Death + { spell = 32546, type = "ability" }, -- Binding Heal + { spell = 33076, type = "ability" }, -- Prayer of Mending + { spell = 34433, type = "ability", totem = true }, -- Shadowfiend + { spell = 34861, type = "ability", talent = 61 }, -- Circle of Healing + { spell = 34914, type = "ability", debuff = true, requireTarget = true, talent = 101 }, -- Vampiric Touch + { spell = 47540, type = "ability", requireTarget = true, talent = 24 }, -- Penance + { spell = 47585, type = "ability", buff = true, talent = 105 }, -- Dispersion + { spell = 47788, type = "ability", buff = true, talent = 66 }, -- Guardian Spirit + { spell = 64843, type = "ability" }, -- Divine Hymn + { spell = 64901, type = "ability" }, -- Hymn of Hope }, - icon = 136224 + icon = 136224, }, [4] = {}, [5] = {}, @@ -460,11 +456,10 @@ templates.class.PRIEST = { [7] = {}, [8] = { title = L["Resources"], - args = { - }, + args = {}, icon = manaIcon, }, - } + }, } templates.class.SHAMAN = { @@ -472,81 +467,81 @@ templates.class.SHAMAN = { [1] = { title = L["Buffs"], args = { - { spell = 546, type = "buff", unit = "player"}, -- Water Walking - { spell = 16256, type = "buff", unit = "player", talent = 50}, -- Flurry + { spell = 546, type = "buff", unit = "player" }, -- Water Walking + { spell = 16256, type = "buff", unit = "player", talent = 50 }, -- Flurry }, - icon = 135863 + icon = 135863, }, [2] = { title = L["Debuffs"], args = { - { spell = 3600, type = "debuff", unit = "target"}, -- Earthbind + { spell = 3600, type = "debuff", unit = "target" }, -- Earthbind }, - icon = 135813 + icon = 135813, }, [3] = { title = L["Abilities"], args = { - { spell = 131, type = "ability", buff = true, usable = true}, -- Water Breathing - { spell = 324, type = "ability", buff = true}, -- Lightning Shield - { spell = 331, type = "ability"}, -- Healing Wave - { spell = 403, type = "ability", requireTarget = true}, -- Lightning Bolt - { spell = 421, type = "ability", requireTarget = true}, -- Chain Lightning - { spell = 546, type = "ability", buff = true, usable = true}, -- Water Walking - { spell = 556, type = "ability"}, -- Astral Recall - { spell = 974, type = "ability", buff = true, talent = 100}, -- Earth Shield - { spell = 1064, type = "ability"}, -- Chain Heal - { spell = 1535, type = "ability", totem = true}, -- Fire Nova Totem - { spell = 2008, type = "ability"}, -- Ancestral Spirit - { spell = 2062, type = "ability", totem = true}, -- Earth Elemental Totem - { spell = 2484, type = "ability", totem = true}, -- Earthbind Totem - { spell = 2645, type = "ability", buff = true}, -- Ghost Wolf - { spell = 2825, type = "ability", buff = true}, -- Bloodlust - { spell = 2894, type = "ability", totem = true}, -- Fire Elemental Totem - { spell = 3599, type = "ability", totem = true}, -- Searing Totem - { spell = 3738, type = "ability", totem = true}, -- Wrath of Air Totem - { spell = 5394, type = "ability", totem = true}, -- Healing Stream Totem - { spell = 5675, type = "ability", totem = true}, -- Mana Spring Totem - { spell = 5730, type = "ability", totem = true}, -- Stoneclaw Totem - { spell = 6495, type = "ability", totem = true}, -- Sentry Totem - { spell = 8142, type = "ability", requireTarget = true}, -- Earth Shock - { spell = 8143, type = "ability", requireTarget = true, debuff = true}, -- Frost Shock - { spell = 8017, type = "ability", weaponBuff = true}, -- Rockbiter Weapon -- !! weaponBuff is not supported yet - { spell = 8024, type = "ability", weaponBuff = true}, -- Flametongue Weapon - { spell = 8033, type = "ability", weaponBuff = true}, -- Frostbrand Weapon - { spell = 8050, type = "ability", requireTarget = true, debuff = true}, -- Flame Shock - { spell = 8071, type = "ability", totem = true}, -- Stoneskin Totem - { spell = 8075, type = "ability", totem = true}, -- Strength of Earth Totem - { spell = 8143, type = "ability", totem = true}, -- Tremor Totem - { spell = 8166, type = "ability", totem = true}, -- Poison Cleansing Totem - { spell = 8170, type = "ability", totem = true}, -- Disease Cleansing Totem - { spell = 8177, type = "ability", totem = true}, -- Grounding Totem - { spell = 8181, type = "ability", totem = true}, -- Frost Resistance Totem - { spell = 8184, type = "ability", totem = true}, -- Fire Resistance Totem - { spell = 8190, type = "ability", totem = true}, -- Magma Totem - { spell = 8227, type = "ability", totem = true}, -- Flametongue Totem - { spell = 8514, type = "ability", totem = true}, -- Windfury Totem - { spell = 8835, type = "ability", totem = true}, -- Grace of Air Totem - { spell = 10595, type = "ability", totem = true}, -- Nature Resistance Totem - { spell = 15107, type = "ability", totem = true}, -- Windwall Totem - { spell = 16246, type = "ability", buff = true, talent = 6}, -- Clearcasting - { spell = 16166, type = "ability", buff = true, talent = 17}, -- Elemental Mastery - { spell = 16188, type = "ability", buff = true, talent = 93}, -- Nature Swiftness - { spell = 16190, type = "ability", totem = true, talent = 96}, -- Mana Tide Totem - { spell = 17364, type = "ability", debuff = true, talent = 59}, -- Stormstrike - { spell = 20608, type = "ability"}, -- Reincarnation - { spell = 24398, type = "ability", buff = true}, -- Water Shield - { spell = 25908, type = "ability", totem = true}, -- Tranquil Air Totem - { spell = 30706, type = "ability", totem = true, talent = 20}, -- Totem of Wrath - { spell = 30823, type = "buff", talent = 61}, -- Shamanistic Rage - { spell = 32182, type = "ability", buff = true}, -- Heroism - { spell = 51514, type = "ability", requireTarget = true}, -- Hex - { spell = 51505, type = "ability", requireTarget = true}, -- Lava Burst - { spell = 51490, type = "ability", talent = 23}, -- Thunderstorm - { spell = 51533, type = "ability", buff = true, talent = 65}, -- Feral Spirit - { spell = 61295, type = "ability", talent = 105}, -- Riptide + { spell = 131, type = "ability", buff = true, usable = true }, -- Water Breathing + { spell = 324, type = "ability", buff = true }, -- Lightning Shield + { spell = 331, type = "ability" }, -- Healing Wave + { spell = 403, type = "ability", requireTarget = true }, -- Lightning Bolt + { spell = 421, type = "ability", requireTarget = true }, -- Chain Lightning + { spell = 546, type = "ability", buff = true, usable = true }, -- Water Walking + { spell = 556, type = "ability" }, -- Astral Recall + { spell = 974, type = "ability", buff = true, talent = 100 }, -- Earth Shield + { spell = 1064, type = "ability" }, -- Chain Heal + { spell = 1535, type = "ability", totem = true }, -- Fire Nova Totem + { spell = 2008, type = "ability" }, -- Ancestral Spirit + { spell = 2062, type = "ability", totem = true }, -- Earth Elemental Totem + { spell = 2484, type = "ability", totem = true }, -- Earthbind Totem + { spell = 2645, type = "ability", buff = true }, -- Ghost Wolf + { spell = 2825, type = "ability", buff = true }, -- Bloodlust + { spell = 2894, type = "ability", totem = true }, -- Fire Elemental Totem + { spell = 3599, type = "ability", totem = true }, -- Searing Totem + { spell = 3738, type = "ability", totem = true }, -- Wrath of Air Totem + { spell = 5394, type = "ability", totem = true }, -- Healing Stream Totem + { spell = 5675, type = "ability", totem = true }, -- Mana Spring Totem + { spell = 5730, type = "ability", totem = true }, -- Stoneclaw Totem + { spell = 6495, type = "ability", totem = true }, -- Sentry Totem + { spell = 8142, type = "ability", requireTarget = true }, -- Earth Shock + { spell = 8143, type = "ability", requireTarget = true, debuff = true }, -- Frost Shock + { spell = 8017, type = "ability", weaponBuff = true }, -- Rockbiter Weapon -- !! weaponBuff is not supported yet + { spell = 8024, type = "ability", weaponBuff = true }, -- Flametongue Weapon + { spell = 8033, type = "ability", weaponBuff = true }, -- Frostbrand Weapon + { spell = 8050, type = "ability", requireTarget = true, debuff = true }, -- Flame Shock + { spell = 8071, type = "ability", totem = true }, -- Stoneskin Totem + { spell = 8075, type = "ability", totem = true }, -- Strength of Earth Totem + { spell = 8143, type = "ability", totem = true }, -- Tremor Totem + { spell = 8166, type = "ability", totem = true }, -- Poison Cleansing Totem + { spell = 8170, type = "ability", totem = true }, -- Disease Cleansing Totem + { spell = 8177, type = "ability", totem = true }, -- Grounding Totem + { spell = 8181, type = "ability", totem = true }, -- Frost Resistance Totem + { spell = 8184, type = "ability", totem = true }, -- Fire Resistance Totem + { spell = 8190, type = "ability", totem = true }, -- Magma Totem + { spell = 8227, type = "ability", totem = true }, -- Flametongue Totem + { spell = 8514, type = "ability", totem = true }, -- Windfury Totem + { spell = 8835, type = "ability", totem = true }, -- Grace of Air Totem + { spell = 10595, type = "ability", totem = true }, -- Nature Resistance Totem + { spell = 15107, type = "ability", totem = true }, -- Windwall Totem + { spell = 16246, type = "ability", buff = true, talent = 6 }, -- Clearcasting + { spell = 16166, type = "ability", buff = true, talent = 17 }, -- Elemental Mastery + { spell = 16188, type = "ability", buff = true, talent = 93 }, -- Nature Swiftness + { spell = 16190, type = "ability", totem = true, talent = 96 }, -- Mana Tide Totem + { spell = 17364, type = "ability", debuff = true, talent = 59 }, -- Stormstrike + { spell = 20608, type = "ability" }, -- Reincarnation + { spell = 24398, type = "ability", buff = true }, -- Water Shield + { spell = 25908, type = "ability", totem = true }, -- Tranquil Air Totem + { spell = 30706, type = "ability", totem = true, talent = 20 }, -- Totem of Wrath + { spell = 30823, type = "buff", talent = 61 }, -- Shamanistic Rage + { spell = 32182, type = "ability", buff = true }, -- Heroism + { spell = 51514, type = "ability", requireTarget = true }, -- Hex + { spell = 51505, type = "ability", requireTarget = true }, -- Lava Burst + { spell = 51490, type = "ability", talent = 23 }, -- Thunderstorm + { spell = 51533, type = "ability", buff = true, talent = 65 }, -- Feral Spirit + { spell = 61295, type = "ability", talent = 105 }, -- Riptide }, - icon = 135963 + icon = 135963, }, [4] = {}, [5] = {}, @@ -554,11 +549,10 @@ templates.class.SHAMAN = { [7] = {}, [8] = { title = L["Resources"], - args = { - }, + args = {}, icon = 135990, }, - } + }, } templates.class.MAGE = { @@ -566,77 +560,77 @@ templates.class.MAGE = { [1] = { title = L["Buffs"], args = { - { spell = 130, type = "buff", unit = "player"}, -- Slow Fall - { spell = 543, type = "buff", unit = "player"}, -- Fire Ward - { spell = 604, type = "buff", unit = "player"}, -- Dampen Magic - { spell = 1008, type = "buff", unit = "player"}, -- Amplify Magic - { spell = 1459, type = "buff", unit = "player"}, -- Arcane Intellect - { spell = 1463, type = "buff", unit = "player"}, -- Mana Shield - { spell = 6143, type = "buff", unit = "player"}, -- Frost Ward - { spell = 12042, type = "buff", unit = "player"}, -- Arcane Power - { spell = 12536, type = "buff", unit = "player"}, -- Clearcasting - { spell = 45438, type = "buff", unit = "player"}, -- Ice Block + { spell = 130, type = "buff", unit = "player" }, -- Slow Fall + { spell = 543, type = "buff", unit = "player" }, -- Fire Ward + { spell = 604, type = "buff", unit = "player" }, -- Dampen Magic + { spell = 1008, type = "buff", unit = "player" }, -- Amplify Magic + { spell = 1459, type = "buff", unit = "player" }, -- Arcane Intellect + { spell = 1463, type = "buff", unit = "player" }, -- Mana Shield + { spell = 6143, type = "buff", unit = "player" }, -- Frost Ward + { spell = 12042, type = "buff", unit = "player" }, -- Arcane Power + { spell = 12536, type = "buff", unit = "player" }, -- Clearcasting + { spell = 45438, type = "buff", unit = "player" }, -- Ice Block }, - icon = 136096 + icon = 136096, }, [2] = { title = L["Debuffs"], args = { - { spell = 122, type = "debuff", unit = "target"}, -- Frost Nova + { spell = 122, type = "debuff", unit = "target" }, -- Frost Nova { spell = 118, type = "debuff", unit = "multi" }, -- Polymorph - { spell = 11071, type = "debuff", unit = "target"}, -- Frostbite - { spell = 11103, type = "debuff", unit = "target"}, -- Impact - { spell = 11180, type = "debuff", unit = "target"}, -- Winter's Chill + { spell = 11071, type = "debuff", unit = "target" }, -- Frostbite + { spell = 11103, type = "debuff", unit = "target" }, -- Impact + { spell = 11180, type = "debuff", unit = "target" }, -- Winter's Chill }, - icon = 135848 + icon = 135848, }, [3] = { title = L["Abilities"], args = { - { spell = 66, type = "ability", buff = true, buffId = 32612}, -- Invisibility - { spell = 116, type = "ability", requiresTarget = true}, -- Frostbolt - { spell = 118, type = "ability", debuff = true, requireTarget = true}, -- Polymorph - { spell = 120, type = "ability"}, -- Cone of Cold - { spell = 122, type = "ability"}, -- Frost Nova - { spell = 130, type = "ability", buff = true}, -- Slow Fall - { spell = 168, type = "ability", buff = true}, -- Frost Armor - { spell = 475, type = "ability"}, -- Remove Curse - { spell = 543, type = "ability", buff = true}, -- Fire Ward - { spell = 1449, type = "ability"}, -- Arcane Explosion - { spell = 1463, type = "ability", buff = true}, -- Mana Shield - { spell = 1953, type = "ability"}, -- Blink - { spell = 2120, type = "ability"}, -- Flamestrike - { spell = 2136, type = "ability", requiresTarget = true}, -- Fire Blast - { spell = 2139, type = "ability", requiresTarget = true}, -- Counterspell - { spell = 2855, type = "ability", debuff = true, requireTarget = true}, -- Detect Magic - { spell = 2948, type = "ability", requiresTarget = true}, -- Scorch - { spell = 5143, type = "ability", requiresTarget = true}, -- Arcane Missiles - { spell = 6117, type = "ability", buff = true}, -- Mage Armor - { spell = 6143, type = "ability", buff = true}, -- Frost Ward - { spell = 10187, type = "ability"}, -- Blizzard - { spell = 11113, type = "ability", debuff = true, talent = 55}, -- Blast Wave - { spell = 11129, type = "ability", buff = true, talent = 59}, -- Combustion - { spell = 11426, type = "ability", buff = true, talent = 99}, -- ice Barrier - { spell = 11958, type = "ability", talent = 95}, -- Cold Snap - { spell = 12042, type = "ability", buff = true, talent = 16}, -- Arcane Power - { spell = 12043, type = "ability", buff = true, talent = 13}, -- Presence of Mind - { spell = 12051, type = "ability"}, -- Evocation - { spell = 14272, type = "ability", buff = true, talent = 89}, -- Icy Veins - { spell = 18809, type = "ability", requiresTarget = true}, -- Pyroblast - { spell = 25304, type = "ability", requiresTarget = true}, -- Frostbolt - { spell = 30449, type = "ability", requiresTarget = true}, -- Spellsteal - { spell = 30451, type = "ability", requiresTarget = true}, -- Arcane Blast - { spell = 30482, type = "ability", buff = true}, -- Molten Armor - { spell = 31661, type = "ability", buff = true}, -- Dragon's Breath - { spell = 31687, type = "ability", totem = true, talent = 102}, -- Summon Water Elemental - { spell = 34589, type = "ability", requireTarget = true, debuff = true, talent = 23}, -- Slow - { spell = 45438, type = "ability", buff = true}, -- Ice Block - { spell = 44614, type = "ability", requiresTarget = true, debuff = true}, -- Frostfire Bolt - { spell = 44457, type = "ability", buff = true, talent = 67}, -- Living Bomb - { spell = 44425, type = "ability", requiresTarget = true, talent = 27}, -- Arcane Barrage - { spell = 44572, type = "ability", requiresTarget = true, debuff = true, usable = true, talent = 107}, -- Deep Freeze + { spell = 66, type = "ability", buff = true, buffId = 32612 }, -- Invisibility + { spell = 116, type = "ability", requiresTarget = true }, -- Frostbolt + { spell = 118, type = "ability", debuff = true, requireTarget = true }, -- Polymorph + { spell = 120, type = "ability" }, -- Cone of Cold + { spell = 122, type = "ability" }, -- Frost Nova + { spell = 130, type = "ability", buff = true }, -- Slow Fall + { spell = 168, type = "ability", buff = true }, -- Frost Armor + { spell = 475, type = "ability" }, -- Remove Curse + { spell = 543, type = "ability", buff = true }, -- Fire Ward + { spell = 1449, type = "ability" }, -- Arcane Explosion + { spell = 1463, type = "ability", buff = true }, -- Mana Shield + { spell = 1953, type = "ability" }, -- Blink + { spell = 2120, type = "ability" }, -- Flamestrike + { spell = 2136, type = "ability", requiresTarget = true }, -- Fire Blast + { spell = 2139, type = "ability", requiresTarget = true }, -- Counterspell + { spell = 2855, type = "ability", debuff = true, requireTarget = true }, -- Detect Magic + { spell = 2948, type = "ability", requiresTarget = true }, -- Scorch + { spell = 5143, type = "ability", requiresTarget = true }, -- Arcane Missiles + { spell = 6117, type = "ability", buff = true }, -- Mage Armor + { spell = 6143, type = "ability", buff = true }, -- Frost Ward + { spell = 10187, type = "ability" }, -- Blizzard + { spell = 11113, type = "ability", debuff = true, talent = 55 }, -- Blast Wave + { spell = 11129, type = "ability", buff = true, talent = 59 }, -- Combustion + { spell = 11426, type = "ability", buff = true, talent = 99 }, -- ice Barrier + { spell = 11958, type = "ability", talent = 95 }, -- Cold Snap + { spell = 12042, type = "ability", buff = true, talent = 16 }, -- Arcane Power + { spell = 12043, type = "ability", buff = true, talent = 13 }, -- Presence of Mind + { spell = 12051, type = "ability" }, -- Evocation + { spell = 14272, type = "ability", buff = true, talent = 89 }, -- Icy Veins + { spell = 18809, type = "ability", requiresTarget = true }, -- Pyroblast + { spell = 25304, type = "ability", requiresTarget = true }, -- Frostbolt + { spell = 30449, type = "ability", requiresTarget = true }, -- Spellsteal + { spell = 30451, type = "ability", requiresTarget = true }, -- Arcane Blast + { spell = 30482, type = "ability", buff = true }, -- Molten Armor + { spell = 31661, type = "ability", buff = true }, -- Dragon's Breath + { spell = 31687, type = "ability", totem = true, talent = 102 }, -- Summon Water Elemental + { spell = 34589, type = "ability", requireTarget = true, debuff = true, talent = 23 }, -- Slow + { spell = 45438, type = "ability", buff = true }, -- Ice Block + { spell = 44614, type = "ability", requiresTarget = true, debuff = true }, -- Frostfire Bolt + { spell = 44457, type = "ability", buff = true, talent = 67 }, -- Living Bomb + { spell = 44425, type = "ability", requiresTarget = true, talent = 27 }, -- Arcane Barrage + { spell = 44572, type = "ability", requiresTarget = true, debuff = true, usable = true, talent = 107 }, -- Deep Freeze }, - icon = 136075 + icon = 136075, }, [4] = {}, [5] = {}, @@ -644,11 +638,10 @@ templates.class.MAGE = { [7] = {}, [8] = { title = L["Resources"], - args = { - }, + args = {}, icon = manaIcon, }, - } + }, } templates.class.WARLOCK = { @@ -656,79 +649,79 @@ templates.class.WARLOCK = { [1] = { title = L["Buffs"], args = { - { spell = 126, type = "buff", unit = "player"}, -- Eye of Kilrogg - { spell = 687, type = "buff", unit = "player"}, -- Demon Skin - { spell = 755, type = "buff", unit = "pet"}, -- Health Funnel - { spell = 5697, type = "buff", unit = "player"}, -- Unending Breath - { spell = 6229, type = "buff", unit = "player"}, -- Shadow Ward - { spell = 7870, type = "buff", unit = "pet"}, -- Lesser Invisibility - { spell = 18094, type = "buff", unit = "player"}, -- Nightfall - { spell = 19028, type = "buff", unit = "player", talent = 59}, -- Soul Link - { spell = 20707, type = "buff", unit = "group"}, -- Soulstone + { spell = 126, type = "buff", unit = "player" }, -- Eye of Kilrogg + { spell = 687, type = "buff", unit = "player" }, -- Demon Skin + { spell = 755, type = "buff", unit = "pet" }, -- Health Funnel + { spell = 5697, type = "buff", unit = "player" }, -- Unending Breath + { spell = 6229, type = "buff", unit = "player" }, -- Shadow Ward + { spell = 7870, type = "buff", unit = "pet" }, -- Lesser Invisibility + { spell = 18094, type = "buff", unit = "player" }, -- Nightfall + { spell = 19028, type = "buff", unit = "player", talent = 59 }, -- Soul Link + { spell = 20707, type = "buff", unit = "group" }, -- Soulstone }, - icon = 136210 + icon = 136210, }, [2] = { title = L["Debuffs"], args = { - { spell = 172, type = "debuff", unit = "target"}, -- Corruption - { spell = 348, type = "debuff", unit = "target"}, -- Immolate - { spell = 603, type = "debuff", unit = "target"}, -- Curse of Doom - { spell = 702, type = "debuff", unit = "target"}, -- Curse of Weakness - { spell = 704, type = "debuff", unit = "target"}, -- Curse of Recklessness - { spell = 710, type = "debuff", unit = "multi"}, -- Banish - { spell = 980, type = "debuff", unit = "target"}, -- Curse of Agony - { spell = 1098, type = "debuff", unit = "multi"}, -- Enslave Demon - { spell = 1490, type = "debuff", unit = "target"}, -- Curse of the Elements - { spell = 1714, type = "debuff", unit = "target"}, -- Curse of Tongues - { spell = 6358, type = "debuff", unit = "target"}, -- Seduction + { spell = 172, type = "debuff", unit = "target" }, -- Corruption + { spell = 348, type = "debuff", unit = "target" }, -- Immolate + { spell = 603, type = "debuff", unit = "target" }, -- Curse of Doom + { spell = 702, type = "debuff", unit = "target" }, -- Curse of Weakness + { spell = 704, type = "debuff", unit = "target" }, -- Curse of Recklessness + { spell = 710, type = "debuff", unit = "multi" }, -- Banish + { spell = 980, type = "debuff", unit = "target" }, -- Curse of Agony + { spell = 1098, type = "debuff", unit = "multi" }, -- Enslave Demon + { spell = 1490, type = "debuff", unit = "target" }, -- Curse of the Elements + { spell = 1714, type = "debuff", unit = "target" }, -- Curse of Tongues + { spell = 6358, type = "debuff", unit = "target" }, -- Seduction { spell = 6789, type = "debuff", unit = "target" }, -- Death Coil - { spell = 6360, type = "debuff", unit = "target"}, -- Whiplash - { spell = 17862, type = "debuff", unit = "target"}, -- Curse of Shadow - { spell = 18223, type = "debuff", unit = "target", talent = 15}, -- Curse of Exhaustion - { spell = 18265, type = "debuff", unit = "target", talent = 14}, -- Siphon Life - { spell = 30108, type = "debuff", unit = "target", talent = 21}, -- Unstable Affliction - { spell = 48181, type = "debuff", unit = "target", talent = 26}, -- Haunt + { spell = 6360, type = "debuff", unit = "target" }, -- Whiplash + { spell = 17862, type = "debuff", unit = "target" }, -- Curse of Shadow + { spell = 18223, type = "debuff", unit = "target", talent = 15 }, -- Curse of Exhaustion + { spell = 18265, type = "debuff", unit = "target", talent = 14 }, -- Siphon Life + { spell = 30108, type = "debuff", unit = "target", talent = 21 }, -- Unstable Affliction + { spell = 48181, type = "debuff", unit = "target", talent = 26 }, -- Haunt }, - icon = 136139 + icon = 136139, }, [3] = { title = L["Abilities"], args = { - { spell = 172, type = "ability", requiresTarget = true, debuff = true}, -- Corruption - { spell = 348, type = "ability", requiresTarget = true, debuff = true}, -- Immolate - { spell = 686, type = "ability", requiresTarget = true}, -- Shadow Bolt - { spell = 698, type = "ability"}, -- Ritual of Summoning - { spell = 710, type = "ability", requiresTarget = true, debuff = true}, -- Banish - { spell = 980, type = "ability", requiresTarget = true, debuff = true}, -- Agony - { spell = 1120, type = "ability", requiresTarget = true}, -- Drain Soul - { spell = 3110, type = "ability", requiresTarget = true}, -- Firebolt - { spell = 3716, type = "ability", requiresTarget = true}, -- Consuming Shadows - { spell = 5138, type = "ability", requiresTarget = true}, -- Drain Mana - { spell = 5484, type = "ability"}, -- Howl of Terror - { spell = 5676, type = "ability", requiresTarget = true}, -- Searing Pain - { spell = 5740, type = "ability"}, -- Rain of Fire - { spell = 5782, type = "ability", requiresTarget = true, debuff = true}, -- Fear - { spell = 6353, type = "ability", requiresTarget = true}, -- Soul Fire - { spell = 6358, type = "ability", requiresTarget = true}, -- Seduction - { spell = 6360, type = "ability", requiresTarget = true}, -- Whiplash - { spell = 6789, type = "ability", requiresTarget = true}, -- Death Coil - { spell = 7814, type = "ability", requiresTarget = true}, -- Lash of Pain - { spell = 7870, type = "ability"}, -- Lesser Invisibility - { spell = 17962, type = "ability", requiresTarget = true, usable = true, talent = 98}, -- Conflagrate - { spell = 17926, type = "ability", requiresTarget = true}, -- Death Coil - { spell = 18288, type = "ability", buff = true, talent = 9}, -- Amplify Curse - { spell = 18708, type = "ability", talent = 28}, -- Fel Domination - { spell = 18877, type = "ability", requiresTarget = true, debuff = true, talent = 88}, -- Shadowburn - { spell = 30108, ability = "ability", debuff = true, requiresTarget = true, talent = 21}, -- Unstable Affliction - { spell = 30283, type = "ability", debuff = true, talent = 101}, -- Fel Domination - { spell = 48181, type = "ability", requiresTarget = true, debuff = true, talent = 26}, -- Haunt - { spell = 59672, type = "ability", buff = true, talent = 66}, -- Metamorphosis - { spell = 50796, type = "ability", requiresTarget = true, talent = 105}, -- Chaos Bolt - { spell = 47897, type = "ability"}, -- Shadowflame - { spell = 48020, type = "ability"}, -- Demonic Circle: Teleport + { spell = 172, type = "ability", requiresTarget = true, debuff = true }, -- Corruption + { spell = 348, type = "ability", requiresTarget = true, debuff = true }, -- Immolate + { spell = 686, type = "ability", requiresTarget = true }, -- Shadow Bolt + { spell = 698, type = "ability" }, -- Ritual of Summoning + { spell = 710, type = "ability", requiresTarget = true, debuff = true }, -- Banish + { spell = 980, type = "ability", requiresTarget = true, debuff = true }, -- Agony + { spell = 1120, type = "ability", requiresTarget = true }, -- Drain Soul + { spell = 3110, type = "ability", requiresTarget = true }, -- Firebolt + { spell = 3716, type = "ability", requiresTarget = true }, -- Consuming Shadows + { spell = 5138, type = "ability", requiresTarget = true }, -- Drain Mana + { spell = 5484, type = "ability" }, -- Howl of Terror + { spell = 5676, type = "ability", requiresTarget = true }, -- Searing Pain + { spell = 5740, type = "ability" }, -- Rain of Fire + { spell = 5782, type = "ability", requiresTarget = true, debuff = true }, -- Fear + { spell = 6353, type = "ability", requiresTarget = true }, -- Soul Fire + { spell = 6358, type = "ability", requiresTarget = true }, -- Seduction + { spell = 6360, type = "ability", requiresTarget = true }, -- Whiplash + { spell = 6789, type = "ability", requiresTarget = true }, -- Death Coil + { spell = 7814, type = "ability", requiresTarget = true }, -- Lash of Pain + { spell = 7870, type = "ability" }, -- Lesser Invisibility + { spell = 17962, type = "ability", requiresTarget = true, usable = true, talent = 98 }, -- Conflagrate + { spell = 17926, type = "ability", requiresTarget = true }, -- Death Coil + { spell = 18288, type = "ability", buff = true, talent = 9 }, -- Amplify Curse + { spell = 18708, type = "ability", talent = 28 }, -- Fel Domination + { spell = 18877, type = "ability", requiresTarget = true, debuff = true, talent = 88 }, -- Shadowburn + { spell = 30108, ability = "ability", debuff = true, requiresTarget = true, talent = 21 }, -- Unstable Affliction + { spell = 30283, type = "ability", debuff = true, talent = 101 }, -- Fel Domination + { spell = 48181, type = "ability", requiresTarget = true, debuff = true, talent = 26 }, -- Haunt + { spell = 59672, type = "ability", buff = true, talent = 66 }, -- Metamorphosis + { spell = 50796, type = "ability", requiresTarget = true, talent = 105 }, -- Chaos Bolt + { spell = 47897, type = "ability" }, -- Shadowflame + { spell = 48020, type = "ability" }, -- Demonic Circle: Teleport }, - icon = 135808 + icon = 135808, }, [4] = {}, [5] = {}, @@ -736,11 +729,10 @@ templates.class.WARLOCK = { [7] = {}, [8] = { title = L["Resources"], - args = { - }, + args = {}, icon = "Interface\\Icons\\inv_misc_gem_amethyst_02", }, - } + }, } templates.class.DRUID = { @@ -749,88 +741,88 @@ templates.class.DRUID = { title = L["Buffs"], args = { { spell = 774, type = "buff", unit = "player", talent = 9 }, -- Rejuvenation - { spell = 5487, type = "buff", unit = "player"}, -- Bear Form - { spell = 8936, type = "buff", unit = "player"}, -- Regrowth - { spell = 783, type = "buff", unit = "player"}, -- Travel Form - { spell = 768, type = "buff", unit = "player"}, -- Cat Form - { spell = 22812, type = "buff", unit = "player"}, -- Barkskin - { spell = 1850, type = "buff", unit = "player"}, -- Dash - { spell = 5215, type = "buff", unit = "player"}, -- Prowl - { spell = 29166, type = "buff", unit = "group"}, -- Innervate - { spell = 33763, type = "buff", unit = "player"}, -- Lifebloom + { spell = 5487, type = "buff", unit = "player" }, -- Bear Form + { spell = 8936, type = "buff", unit = "player" }, -- Regrowth + { spell = 783, type = "buff", unit = "player" }, -- Travel Form + { spell = 768, type = "buff", unit = "player" }, -- Cat Form + { spell = 22812, type = "buff", unit = "player" }, -- Barkskin + { spell = 1850, type = "buff", unit = "player" }, -- Dash + { spell = 5215, type = "buff", unit = "player" }, -- Prowl + { spell = 29166, type = "buff", unit = "group" }, -- Innervate + { spell = 33763, type = "buff", unit = "player" }, -- Lifebloom }, - icon = 136097 + icon = 136097, }, [2] = { title = L["Debuffs"], args = { - { spell = 339, type = "debuff", unit = "multi"}, -- Entangling Roots - { spell = 770, type = "debuff", unit = "target"}, -- Faerie Fire + { spell = 339, type = "debuff", unit = "multi" }, -- Entangling Roots + { spell = 770, type = "debuff", unit = "target" }, -- Faerie Fire { spell = 5211, type = "debuff", unit = "target", talent = 10 }, -- Mighty Bash { spell = 1079, type = "debuff", unit = "target", talent = 7 }, -- Rip - { spell = 6795, type = "debuff", unit = "target"}, -- Growl - { spell = 2637, type = "debuff", unit = "multi"}, -- Hibernate - { spell = 5570, type = "debuff", unit = "target", talent = 8}, -- Insect Swarm - { spell = 8921, type = "debuff", unit = "target"}, -- Moonfire + { spell = 6795, type = "debuff", unit = "target" }, -- Growl + { spell = 2637, type = "debuff", unit = "multi" }, -- Hibernate + { spell = 5570, type = "debuff", unit = "target", talent = 8 }, -- Insect Swarm + { spell = 8921, type = "debuff", unit = "target" }, -- Moonfire }, - icon = 132114 + icon = 132114, }, [3] = { title = L["Abilities"], args = { - { spell = 99, type = "ability", debuff = true}, -- Demoralizing Roar - { spell = 339, type = "ability", requiresTarget = true, debuff = true}, -- Entangling Roots - { spell = 740, type = "ability", duration = 10}, -- Tranquility - { spell = 768, type = "ability"}, -- Cat Form - { spell = 770, type = "ability", requiresTarget = true, debuff = true}, -- Faerie Fire - { spell = 783, type = "ability"}, -- Travel Form - { spell = 1066, type = "ability"}, -- Aquatic Form - { spell = 1079, type = "ability", requiresTarget = true, form = 3}, -- Rip - { spell = 1082, type = "ability", requiresTarget = true, form = 3}, -- Claw - { spell = 1822, type = "ability", requiresTarget = true, debuff = true, form = 3}, -- Rake - { spell = 1850, type = "ability", buff = true}, -- Dash - { spell = 2637, type = "ability", requiresTarget = true, debuff = true}, -- Hibernate - { spell = 2782, type = "ability"}, -- Remove Curse - { spell = 2893, type = "ability"}, -- Abolish Poison - { spell = 2908, type = "ability", requiresTarget = true}, -- Soothe - { spell = 2912, type = "ability", requiresTarget = true}, -- Starfire - { spell = 5176, type = "ability", requiresTarget = true}, -- Wrath - { spell = 5209, type = "ability", form = 1}, -- Challenging Roar - { spell = 5211, type = "ability", requiresTarget = true, talent = 6, form = 1}, -- Mighty Bash - { spell = 5215, type = "ability", buff = true}, -- Prowl - { spell = 5221, type = "ability", requiresTarget = true, form = 3}, -- Shred - { spell = 5229, type = "ability", buff = true, form = 1}, -- Enrage - { spell = 5487, type = "ability"}, -- Bear Form - { spell = 5570, type = "ability", requiresTarget = true, debuff = true, talent = 8}, -- Insect Swarm - { spell = 6785, type = "ability", requiresTarget = true, form = 3}, -- Ravage - { spell = 6795, type = "ability", debuff = true, requiresTarget = true, form = 1}, -- Growl - { spell = 6807, type = "ability", queued = true, form = 1}, -- Maul - { spell = 8921, type = "ability", requiresTarget = true, debuff = true}, -- Moonfire - { spell = 8946, type = "ability"}, -- Cure Poison - { spell = 8983, type = "ability", requiresTarget = true, debuff = true, form = 1}, -- Buff - { spell = 9634, type = "ability"}, -- Dire Bear Form - { spell = 9846, type = "ability", buff = true, form = 3}, -- Tiger's Fury - { spell = 16689, type = "ability", buff = true, talent = 2}, -- Nature's Grasp - { spell = 16914, type = "ability"}, -- Hurricane - { spell = 16979, type = "ability", form = 1, talent = 47}, -- Feral Charge - { spell = 17116, type = "ability", buff = true, talent = 91}, -- Nature's Swiftness - { spell = 18562, type = "ability", talent = 97}, -- Swiftmend - { spell = 20484, type = "ability"}, -- Rebirth - { spell = 22568, type = "ability", form = 3}, -- Ferocious Bite - { spell = 22570, type = "ability", debuff = true, form = 3}, -- Maim - { spell = 22812, type = "ability", buff = true}, -- Barkskin - { spell = 22842, type = "ability", buff = true, form = 1}, -- Frenzied Regeneration - { spell = 24858, type = "ability", talent = 18}, -- Moonkin Form - { spell = 26997, type = "ability", form = 1}, -- Swipe - { spell = 27006, type = "ability", requiresTarget = true, debuff = true, form = 3}, -- Pounce - { spell = 33831, type = "ability", talent = 21}, -- Force of Nature - { spell = 42389, type = "ability", talent = 61, form = {1, 3}}, -- Mangle - { spell = 48438, type = "ability", talent = 103}, -- Wild Growth - { spell = 50464, type = "ability"}, -- Nourish - { spell = 48505, type = "ability", talent = 24}, -- Starfall - { spell = 50334, type = "ability", buff = true, talent = 67}, -- Berserk + { spell = 99, type = "ability", debuff = true }, -- Demoralizing Roar + { spell = 339, type = "ability", requiresTarget = true, debuff = true }, -- Entangling Roots + { spell = 740, type = "ability", duration = 10 }, -- Tranquility + { spell = 768, type = "ability" }, -- Cat Form + { spell = 770, type = "ability", requiresTarget = true, debuff = true }, -- Faerie Fire + { spell = 783, type = "ability" }, -- Travel Form + { spell = 1066, type = "ability" }, -- Aquatic Form + { spell = 1079, type = "ability", requiresTarget = true, form = 3 }, -- Rip + { spell = 1082, type = "ability", requiresTarget = true, form = 3 }, -- Claw + { spell = 1822, type = "ability", requiresTarget = true, debuff = true, form = 3 }, -- Rake + { spell = 1850, type = "ability", buff = true }, -- Dash + { spell = 2637, type = "ability", requiresTarget = true, debuff = true }, -- Hibernate + { spell = 2782, type = "ability" }, -- Remove Curse + { spell = 2893, type = "ability" }, -- Abolish Poison + { spell = 2908, type = "ability", requiresTarget = true }, -- Soothe + { spell = 2912, type = "ability", requiresTarget = true }, -- Starfire + { spell = 5176, type = "ability", requiresTarget = true }, -- Wrath + { spell = 5209, type = "ability", form = 1 }, -- Challenging Roar + { spell = 5211, type = "ability", requiresTarget = true, talent = 6, form = 1 }, -- Mighty Bash + { spell = 5215, type = "ability", buff = true }, -- Prowl + { spell = 5221, type = "ability", requiresTarget = true, form = 3 }, -- Shred + { spell = 5229, type = "ability", buff = true, form = 1 }, -- Enrage + { spell = 5487, type = "ability" }, -- Bear Form + { spell = 5570, type = "ability", requiresTarget = true, debuff = true, talent = 8 }, -- Insect Swarm + { spell = 6785, type = "ability", requiresTarget = true, form = 3 }, -- Ravage + { spell = 6795, type = "ability", debuff = true, requiresTarget = true, form = 1 }, -- Growl + { spell = 6807, type = "ability", queued = true, form = 1 }, -- Maul + { spell = 8921, type = "ability", requiresTarget = true, debuff = true }, -- Moonfire + { spell = 8946, type = "ability" }, -- Cure Poison + { spell = 8983, type = "ability", requiresTarget = true, debuff = true, form = 1 }, -- Buff + { spell = 9634, type = "ability" }, -- Dire Bear Form + { spell = 9846, type = "ability", buff = true, form = 3 }, -- Tiger's Fury + { spell = 16689, type = "ability", buff = true, talent = 2 }, -- Nature's Grasp + { spell = 16914, type = "ability" }, -- Hurricane + { spell = 16979, type = "ability", form = 1, talent = 47 }, -- Feral Charge + { spell = 17116, type = "ability", buff = true, talent = 91 }, -- Nature's Swiftness + { spell = 18562, type = "ability", talent = 97 }, -- Swiftmend + { spell = 20484, type = "ability" }, -- Rebirth + { spell = 22568, type = "ability", form = 3 }, -- Ferocious Bite + { spell = 22570, type = "ability", debuff = true, form = 3 }, -- Maim + { spell = 22812, type = "ability", buff = true }, -- Barkskin + { spell = 22842, type = "ability", buff = true, form = 1 }, -- Frenzied Regeneration + { spell = 24858, type = "ability", talent = 18 }, -- Moonkin Form + { spell = 26997, type = "ability", form = 1 }, -- Swipe + { spell = 27006, type = "ability", requiresTarget = true, debuff = true, form = 3 }, -- Pounce + { spell = 33831, type = "ability", talent = 21 }, -- Force of Nature + { spell = 42389, type = "ability", talent = 61, form = { 1, 3 } }, -- Mangle + { spell = 48438, type = "ability", talent = 103 }, -- Wild Growth + { spell = 50464, type = "ability" }, -- Nourish + { spell = 48505, type = "ability", talent = 24 }, -- Starfall + { spell = 50334, type = "ability", buff = true, talent = 67 }, -- Berserk }, - icon = 132134 + icon = 132134, }, [4] = {}, [5] = {}, @@ -838,8 +830,7 @@ templates.class.DRUID = { [7] = {}, [8] = { title = L["Resources and Shapeshift Form"], - args = { - }, + args = {}, icon = manaIcon, }, }, @@ -849,74 +840,74 @@ templates.class.DEATHKNIGHT = { [1] = { title = L["Buffs"], args = { - { spell = 3714, type = "buff", unit = "player"}, -- Path of Frost - { spell = 48707, type = "buff", unit = "player"}, -- Anti-Magic Shell - { spell = 48792, type = "buff", unit = "player"}, -- Icebound Fortitude - { spell = 49039, type = "buff", unit = "player"}, -- Lichborne - { spell = 49182, type = "buff", unit = "player", talent = 21}, -- Blade Barrier - { spell = 49188, type = "buff", unit = "player", talent = 50}, -- Rime - { spell = 49200, type = "buff", unit = "player", talent = 52}, -- Acclimation - { spell = 50421, type = "buff", unit = "player", talent = 9}, -- Scent of Blood - { spell = 50447, type = "buff", unit = "player", talent = 7}, -- Bloody Vengeance - { spell = 50880, type = "buff", unit = "player", talent = 62}, -- Icy Talons - { spell = 51123, type = "buff", unit = "player", talent = 63}, -- Killing Machine - { spell = 51124, type = "buff", unit = "player"}, -- Killing Machine - { spell = 53365, type = "buff", unit = "player"}, -- Unholy Strength - { spell = 55233, type = "buff", unit = "player"}, -- Vampiric Blood - { spell = 57330, type = "buff", unit = "player"}, -- Horn of Winter - { spell = 59052, type = "buff", unit = "player"}, -- Rime - { spell = 66799, type = "buff", unit = "player", talent = 111}, -- Desolation + { spell = 3714, type = "buff", unit = "player" }, -- Path of Frost + { spell = 48707, type = "buff", unit = "player" }, -- Anti-Magic Shell + { spell = 48792, type = "buff", unit = "player" }, -- Icebound Fortitude + { spell = 49039, type = "buff", unit = "player" }, -- Lichborne + { spell = 49182, type = "buff", unit = "player", talent = 21 }, -- Blade Barrier + { spell = 49188, type = "buff", unit = "player", talent = 50 }, -- Rime + { spell = 49200, type = "buff", unit = "player", talent = 52 }, -- Acclimation + { spell = 50421, type = "buff", unit = "player", talent = 9 }, -- Scent of Blood + { spell = 50447, type = "buff", unit = "player", talent = 7 }, -- Bloody Vengeance + { spell = 50880, type = "buff", unit = "player", talent = 62 }, -- Icy Talons + { spell = 51123, type = "buff", unit = "player", talent = 63 }, -- Killing Machine + { spell = 51124, type = "buff", unit = "player" }, -- Killing Machine + { spell = 53365, type = "buff", unit = "player" }, -- Unholy Strength + { spell = 55233, type = "buff", unit = "player" }, -- Vampiric Blood + { spell = 57330, type = "buff", unit = "player" }, -- Horn of Winter + { spell = 59052, type = "buff", unit = "player" }, -- Rime + { spell = 66799, type = "buff", unit = "player", talent = 111 }, -- Desolation }, - icon = 237517 + icon = 237517, }, [2] = { title = L["Debuffs"], args = { - { spell = 45524, type = "debuff", unit = "target"}, -- Chains of Ice - { spell = 48743, type = "debuff", unit = "player"}, -- Death Pact - { spell = 49194, type = "debuff", unit = "target", talent = 88}, -- Unholy Blight - { spell = 50040, type = "debuff", unit = "target", buffId = 50436, talent = 68}, -- Chilblains - { spell = 51099, type = "debuff", unit = "target", buffId = 51726, talent = 102}, -- Ebon Plaguebringer - { spell = 51399, type = "debuff", unit = "target"}, -- Death Grip - { spell = 55095, type = "debuff", unit = "target"}, -- Frost Fever - { spell = 55666 , type = "debuff", unit = "target", talent = 110}, -- Desecration - { spell = 56222, type = "debuff", unit = "target"}, -- Dark Command - { spell = 59879, type = "debuff", unit = "target"}, -- Blood Plague + { spell = 45524, type = "debuff", unit = "target" }, -- Chains of Ice + { spell = 48743, type = "debuff", unit = "player" }, -- Death Pact + { spell = 49194, type = "debuff", unit = "target", talent = 88 }, -- Unholy Blight + { spell = 50040, type = "debuff", unit = "target", buffId = 50436, talent = 68 }, -- Chilblains + { spell = 51099, type = "debuff", unit = "target", buffId = 51726, talent = 102 }, -- Ebon Plaguebringer + { spell = 51399, type = "debuff", unit = "target" }, -- Death Grip + { spell = 55095, type = "debuff", unit = "target" }, -- Frost Fever + { spell = 55666, type = "debuff", unit = "target", talent = 110 }, -- Desecration + { spell = 56222, type = "debuff", unit = "target" }, -- Dark Command + { spell = 59879, type = "debuff", unit = "target" }, -- Blood Plague }, - icon = 237514 + icon = 237514, }, [3] = { title = L["Abilities"], args = { - { spell = 3714, type = "ability", buff = true}, -- Path of Frost - { spell = 42650, type = "ability"}, -- Army of the Dead - { spell = 43265, type = "ability", debuff = true}, -- Death and Decay - { spell = 45462, type = "ability", requiresTarget = true, debuff = true, buffId = 59879}, -- Plague Strike - { spell = 45524, type = "ability", debuff = true, requiresTarget = true}, -- Chains of Ice - { spell = 45529, type = "ability", buff = true}, -- Blood Tap - { spell = 45902, type = "ability", requiresTarget = true}, -- Blood Strike - { spell = 46585, type = "ability"}, -- Raise Dead - { spell = 47476, type = "ability", debuff = true,requiresTarget = true}, -- Strangulate - { spell = 47528, type = "ability", requiresTarget = true}, -- Mind Freeze - { spell = 47541, type = "ability", requiresTarget = true}, -- Death Coil - { spell = 48707, type = "ability", buff = true}, -- Anti-Magic Shell - { spell = 48743, type = "ability"}, -- Death Pact - { spell = 48792, type = "ability", buff = true}, -- Icebound Fortitude - { spell = 48982, type = "ability", talent = 4}, -- Rune Tap - { spell = 49005, type = "ability", debuff = true, requiresTarget = true, talent = 10}, -- Mark of Blood - { spell = 49016, type = "ability", buff = true, requiresTarget = true, talent = 13}, -- Unholy Frenzy - { spell = 49028, type = "ability", buff = true, requiresTarget = true, talent = 19}, -- Dancing Rune Weapon - { spell = 49039, type = "ability", buff = true, talent = 66}, -- Lichborne - { spell = 49143, type = "ability", requiresTarget = true, talent = 44}, -- Frost Strike - { spell = 49158, type = "ability", talent = 87}, -- Corpse Explosion - { spell = 49184, type = "ability", requiresTarget = true, talent = 48}, -- Howling Blast - { spell = 49203, type = "ability", debuff = true, talent = 54}, -- Hungering Cold - { spell = 57330, type = "ability", buff = true}, -- Horn of Winter - { spell = 61999, type = "ability"}, -- Raise Ally - { spell = 63560, type = "ability", unit = "pet", buff = true, talent = 105}, -- Ghoul Frenzy - { spell = 66198, type = "ability", requiresTarget = true}, -- Obliterate + { spell = 3714, type = "ability", buff = true }, -- Path of Frost + { spell = 42650, type = "ability" }, -- Army of the Dead + { spell = 43265, type = "ability", debuff = true }, -- Death and Decay + { spell = 45462, type = "ability", requiresTarget = true, debuff = true, buffId = 59879 }, -- Plague Strike + { spell = 45524, type = "ability", debuff = true, requiresTarget = true }, -- Chains of Ice + { spell = 45529, type = "ability", buff = true }, -- Blood Tap + { spell = 45902, type = "ability", requiresTarget = true }, -- Blood Strike + { spell = 46585, type = "ability" }, -- Raise Dead + { spell = 47476, type = "ability", debuff = true, requiresTarget = true }, -- Strangulate + { spell = 47528, type = "ability", requiresTarget = true }, -- Mind Freeze + { spell = 47541, type = "ability", requiresTarget = true }, -- Death Coil + { spell = 48707, type = "ability", buff = true }, -- Anti-Magic Shell + { spell = 48743, type = "ability" }, -- Death Pact + { spell = 48792, type = "ability", buff = true }, -- Icebound Fortitude + { spell = 48982, type = "ability", talent = 4 }, -- Rune Tap + { spell = 49005, type = "ability", debuff = true, requiresTarget = true, talent = 10 }, -- Mark of Blood + { spell = 49016, type = "ability", buff = true, requiresTarget = true, talent = 13 }, -- Unholy Frenzy + { spell = 49028, type = "ability", buff = true, requiresTarget = true, talent = 19 }, -- Dancing Rune Weapon + { spell = 49039, type = "ability", buff = true, talent = 66 }, -- Lichborne + { spell = 49143, type = "ability", requiresTarget = true, talent = 44 }, -- Frost Strike + { spell = 49158, type = "ability", talent = 87 }, -- Corpse Explosion + { spell = 49184, type = "ability", requiresTarget = true, talent = 48 }, -- Howling Blast + { spell = 49203, type = "ability", debuff = true, talent = 54 }, -- Hungering Cold + { spell = 57330, type = "ability", buff = true }, -- Horn of Winter + { spell = 61999, type = "ability" }, -- Raise Ally + { spell = 63560, type = "ability", unit = "pet", buff = true, talent = 105 }, -- Ghoul Frenzy + { spell = 66198, type = "ability", requiresTarget = true }, -- Obliterate }, - icon = 136120 + icon = 136120, }, [4] = {}, [5] = {}, @@ -924,59 +915,63 @@ templates.class.DEATHKNIGHT = { [7] = {}, [8] = { title = L["Resources"], - args = { - }, + args = {}, icon = "Interface\\PlayerFrame\\UI-PlayerFrame-Deathknight-SingleRune", }, - } + }, } -- General Section tinsert(templates.general.args, { title = L["Health"], icon = "Interface\\Icons\\inv_potion_54", - type = "health" -}); + type = "health", +}) tinsert(templates.general.args, { title = L["Cast"], icon = 136209, - type = "cast" -}); + type = "cast", +}) tinsert(templates.general.args, { title = L["Always Active"], icon = "Interface\\Addons\\WeakAuras\\PowerAurasMedia\\Auras\\Aura78", - triggers = {[1] = { trigger = { + triggers = { [1] = { trigger = { type = WeakAuras.GetTriggerCategoryFor("Conditions"), event = "Conditions", - use_alwaystrue = true}}} -}); + use_alwaystrue = true, + } } }, +}) tinsert(templates.general.args, { title = L["Pet alive"], icon = "Interface\\Icons\\ability_hunter_pet_raptor", - triggers = {[1] = { trigger = { + triggers = { [1] = { trigger = { type = WeakAuras.GetTriggerCategoryFor("Conditions"), event = "Conditions", - use_HasPet = true}}} -}); + use_HasPet = true, + } } }, +}) tinsert(templates.general.args, { title = L["Pet Behavior"], icon = "Interface\\Icons\\ability_defend.blp", - triggers = {[1] = { trigger = { + triggers = { [1] = { trigger = { type = WeakAuras.GetTriggerCategoryFor("Pet Behavior"), event = "Pet Behavior", use_behavior = true, - behavior = "assist"}}} -}); + behavior = "assist", + } } }, +}) tinsert(templates.general.args, { - spell = 2825, type = "buff", unit = "player", + spell = 2825, + type = "buff", + unit = "player", forceOwnOnly = true, ownOnly = nil, overideTitle = L["Bloodlust/Heroism"], - spellIds = {2825, 32182}} -); + spellIds = { 2825, 32182 }, +}) -- Meta template for Power triggers local function createSimplePowerTemplate(powertype) @@ -986,7 +981,7 @@ local function createSimplePowerTemplate(powertype) type = "power", powertype = powertype, } - return power; + return power end ------------------------------- @@ -997,11 +992,12 @@ end tinsert(templates.class.WARRIOR[1][8].args, { title = L["Stance"], icon = 132349, - triggers = {[1] = { trigger = { + triggers = { [1] = { trigger = { type = WeakAuras.GetTriggerCategoryFor("Stance/Form/Aura"), - event = "Stance/Form/Aura"}}} + event = "Stance/Form/Aura", + } } }, }) -for j, id in ipairs({2457, 71, 2458}) do +for j, id in ipairs({ 2457, 71, 2458 }) do local title, _, icon = GetSpellInfo(id) if title then tinsert(templates.class.WARRIOR[1][8].args, { @@ -1013,37 +1009,38 @@ for j, id in ipairs({2457, 71, 2458}) do type = WeakAuras.GetTriggerCategoryFor("Stance/Form/Aura"), event = "Stance/Form/Aura", use_form = true, - form = { single = j } - } - } - } - }); + form = { single = j }, + }, + }, + }, + }) end end -tinsert(templates.class.WARRIOR[1][8].args, createSimplePowerTemplate(1)); -tinsert(templates.class.PALADIN[1][8].args, createSimplePowerTemplate(0)); -tinsert(templates.class.HUNTER[1][8].args, createSimplePowerTemplate(0)); -tinsert(templates.class.ROGUE[1][8].args, createSimplePowerTemplate(3)); -tinsert(templates.class.ROGUE[1][8].args, createSimplePowerTemplate(4)); -tinsert(templates.class.PRIEST[1][8].args, createSimplePowerTemplate(0)); -tinsert(templates.class.SHAMAN[1][8].args, createSimplePowerTemplate(0)); -tinsert(templates.class.MAGE[1][8].args, createSimplePowerTemplate(0)); -tinsert(templates.class.WARLOCK[1][8].args, createSimplePowerTemplate(0)); -tinsert(templates.class.DRUID[1][8].args, createSimplePowerTemplate(0)); -tinsert(templates.class.DRUID[1][8].args, createSimplePowerTemplate(1)); -tinsert(templates.class.DRUID[1][8].args, createSimplePowerTemplate(3)); -tinsert(templates.class.DRUID[1][8].args, createSimplePowerTemplate(4)); +tinsert(templates.class.WARRIOR[1][8].args, createSimplePowerTemplate(1)) +tinsert(templates.class.PALADIN[1][8].args, createSimplePowerTemplate(0)) +tinsert(templates.class.HUNTER[1][8].args, createSimplePowerTemplate(0)) +tinsert(templates.class.ROGUE[1][8].args, createSimplePowerTemplate(3)) +tinsert(templates.class.ROGUE[1][8].args, createSimplePowerTemplate(4)) +tinsert(templates.class.PRIEST[1][8].args, createSimplePowerTemplate(0)) +tinsert(templates.class.SHAMAN[1][8].args, createSimplePowerTemplate(0)) +tinsert(templates.class.MAGE[1][8].args, createSimplePowerTemplate(0)) +tinsert(templates.class.WARLOCK[1][8].args, createSimplePowerTemplate(0)) +tinsert(templates.class.DRUID[1][8].args, createSimplePowerTemplate(0)) +tinsert(templates.class.DRUID[1][8].args, createSimplePowerTemplate(1)) +tinsert(templates.class.DRUID[1][8].args, createSimplePowerTemplate(3)) +tinsert(templates.class.DRUID[1][8].args, createSimplePowerTemplate(4)) -- Shapeshift Form tinsert(templates.class.DRUID[1][8].args, { title = L["Shapeshift Form"], icon = 132276, - triggers = {[1] = { trigger = { + triggers = { [1] = { trigger = { type = WeakAuras.GetTriggerCategoryFor("Stance/Form/Aura"), - event = "Stance/Form/Aura"}}} -}); -for j, id in ipairs({5487, 768, 783, 114282, 1394966}) do + event = "Stance/Form/Aura", + } } }, +}) +for j, id in ipairs({ 5487, 768, 783, 114282, 1394966 }) do local title, _, icon = GetSpellInfo(id) if title then tinsert(templates.class.DRUID[1][8].args, { @@ -1055,50 +1052,49 @@ for j, id in ipairs({5487, 768, 783, 114282, 1394966}) do type = WeakAuras.GetTriggerCategoryFor("Stance/Form/Aura"), event = "Stance/Form/Aura", use_form = true, - form = { single = j } - } - } - } - }); + form = { single = j }, + }, + }, + }, + }) end end - ------------------------------ -- Hardcoded race templates ------------------------------- -- Will of Survive -tinsert(templates.race.Human, { spell = 59752, type = "ability" }); +tinsert(templates.race.Human, { spell = 59752, type = "ability" }) -- Stoneform -tinsert(templates.race.Dwarf, { spell = 20594, type = "ability", buff = true, titleSuffix = L["cooldown"]}); -tinsert(templates.race.Dwarf, { spell = 20594, type = "buff", unit = "player", titleSuffix = L["buff"]}); +tinsert(templates.race.Dwarf, { spell = 20594, type = "ability", buff = true, titleSuffix = L["cooldown"] }) +tinsert(templates.race.Dwarf, { spell = 20594, type = "buff", unit = "player", titleSuffix = L["buff"] }) -- Shadow Meld -tinsert(templates.race.NightElf, { spell = 58984, type = "ability", buff = true, titleSuffix = L["cooldown"]}); -tinsert(templates.race.NightElf, { spell = 58984, type = "buff", titleSuffix = L["buff"]}); +tinsert(templates.race.NightElf, { spell = 58984, type = "ability", buff = true, titleSuffix = L["cooldown"] }) +tinsert(templates.race.NightElf, { spell = 58984, type = "buff", titleSuffix = L["buff"] }) -- Escape Artist -tinsert(templates.race.Gnome, { spell = 20589, type = "ability" }); +tinsert(templates.race.Gnome, { spell = 20589, type = "ability" }) -- Blood Fury -tinsert(templates.race.Orc, { spell = 20572, type = "ability", titleSuffix = L["cooldown"]}); -tinsert(templates.race.Orc, { spell = 20572, type = "buff", unit = "player", titleSuffix = L["buff"]}); +tinsert(templates.race.Orc, { spell = 20572, type = "ability", titleSuffix = L["cooldown"] }) +tinsert(templates.race.Orc, { spell = 20572, type = "buff", unit = "player", titleSuffix = L["buff"] }) --Cannibalize -tinsert(templates.race.Scourge, { spell = 20577, type = "ability", titleSuffix = L["cooldown"]}); -tinsert(templates.race.Scourge, { spell = 20578, type = "buff", unit = "player", titleSuffix = L["buff"]}); +tinsert(templates.race.Scourge, { spell = 20577, type = "ability", titleSuffix = L["cooldown"] }) +tinsert(templates.race.Scourge, { spell = 20578, type = "buff", unit = "player", titleSuffix = L["buff"] }) -- Will of the Forsaken -tinsert(templates.race.Scourge, { spell = 7744, type = "ability", buff = true, titleSuffix = L["cooldown"]}); -tinsert(templates.race.Scourge, { spell = 7744, type = "buff", unit = "player", titleSuffix = L["buff"]}); +tinsert(templates.race.Scourge, { spell = 7744, type = "ability", buff = true, titleSuffix = L["cooldown"] }) +tinsert(templates.race.Scourge, { spell = 7744, type = "buff", unit = "player", titleSuffix = L["buff"] }) -- War Stomp -tinsert(templates.race.Tauren, { spell = 20549, type = "ability", debuff = true, titleSuffix = L["cooldown"]}); -tinsert(templates.race.Tauren, { spell = 20549, type = "debuff", titleSuffix = L["debuff"]}); +tinsert(templates.race.Tauren, { spell = 20549, type = "ability", debuff = true, titleSuffix = L["cooldown"] }) +tinsert(templates.race.Tauren, { spell = 20549, type = "debuff", titleSuffix = L["debuff"] }) --Beserking -tinsert(templates.race.Troll, { spell = 26297, type = "ability", buff = true, titleSuffix = L["cooldown"]}); -tinsert(templates.race.Troll, { spell = 26297, type = "buff", unit = "player", titleSuffix = L["buff"]}); +tinsert(templates.race.Troll, { spell = 26297, type = "ability", buff = true, titleSuffix = L["cooldown"] }) +tinsert(templates.race.Troll, { spell = 26297, type = "buff", unit = "player", titleSuffix = L["buff"] }) -- Arcane Torrent -tinsert(templates.race.BloodElf, { spell = 28730, type = "ability", debuff = true, titleSuffix = L["cooldown"]}); +tinsert(templates.race.BloodElf, { spell = 28730, type = "ability", debuff = true, titleSuffix = L["cooldown"] }) -- Gift of the Naaru -tinsert(templates.race.Draenei, { spell = 28880, type = "ability", buff = true, titleSuffix = L["cooldown"]}); -tinsert(templates.race.Draenei, { spell = 28880, type = "buff", unit = "player", titleSuffix = L["buff"]}); +tinsert(templates.race.Draenei, { spell = 28880, type = "ability", buff = true, titleSuffix = L["cooldown"] }) +tinsert(templates.race.Draenei, { spell = 28880, type = "buff", unit = "player", titleSuffix = L["buff"] }) ------------------------------ -- Helper code for options @@ -1106,83 +1102,83 @@ tinsert(templates.race.Draenei, { spell = 28880, type = "buff", unit = "player", -- Enrich items from spell, set title local function handleItem(item) - local waitingForItemInfo = false; - if (item.spell) then - local name, icon, _; - if (item.type == "item") then - name, _, _, _, _, _, _, _, _, icon = GetItemInfo(item.spell); - if (name == nil) then - name = L["Unknown Item"] .. " " .. tostring(item.spell); - waitingForItemInfo = true; + local waitingForItemInfo = false + if item.spell then + local name, icon, _ + if item.type == "item" then + name, _, _, _, _, _, _, _, _, icon = GetItemInfo(item.spell) + if name == nil then + name = L["Unknown Item"] .. " " .. tostring(item.spell) + waitingForItemInfo = true end else - name, _, icon = GetSpellInfo(item.spell); - if (name == nil) then - name = L["Unknown Spell"] .. " " .. tostring(item.spell); + name, _, icon = GetSpellInfo(item.spell) + if name == nil then + name = L["Unknown Spell"] .. " " .. tostring(item.spell) end end - if (icon and not item.icon) then - item.icon = icon; + if icon and not item.icon then + item.icon = icon end - item.title = item.overideTitle or name or ""; - if (item.titleSuffix) then - item.title = item.title .. " " .. item.titleSuffix; + item.title = item.overideTitle or name or "" + if item.titleSuffix then + item.title = item.title .. " " .. item.titleSuffix end - if (item.titlePrefix) then - item.title = item.titlePrefix .. item.title; + if item.titlePrefix then + item.title = item.titlePrefix .. item.title end - if (item.titleItemPrefix) then - local prefix = GetItemInfo(item.titleItemPrefix); - if (prefix) then - item.title = prefix .. "-" .. item.title; + if item.titleItemPrefix then + local prefix = GetItemInfo(item.titleItemPrefix) + if prefix then + item.title = prefix .. "-" .. item.title else - waitingForItemInfo = true; + waitingForItemInfo = true end end - if (item.type ~= "item") then - local spell = Spell:CreateFromSpellID(item.spell); - if (not spell:IsSpellEmpty()) then + if item.type ~= "item" then + local spell = Spell:CreateFromSpellID(item.spell) + if not spell:IsSpellEmpty() then spell:ContinueOnSpellLoad(function() - item.description = GetSpellDescription(spell:GetSpellID()); - end); + item.description = GetSpellDescription(spell:GetSpellID()) + end) end - item.description = GetSpellDescription(item.spell); + item.description = GetSpellDescription(item.spell) end end - if (item.talent) then - item.load = item.load or {}; + if item.talent then + item.load = item.load or {} if type(item.talent) == "table" then - item.load.talent = { multi = {} }; - for _,v in pairs(item.talent) do - item.load.talent.multi[v] = true; + item.load.talent = { multi = {} } + for _, v in pairs(item.talent) do + item.load.talent.multi[v] = true end - item.load.use_talent = false; + item.load.use_talent = false else item.load.talent = { single = item.talent, - multi = {}; - }; - item.load.use_talent = true; + multi = {}, + } + item.load.use_talent = true end end - if (item.pvptalent) then - item.load = item.load or {}; - item.load.use_pvptalent = true; + if item.pvptalent then + item.load = item.load or {} + item.load.use_pvptalent = true item.load.pvptalent = { single = item.pvptalent, - multi = {}; + multi = {}, } end - if (item.covenant) then + if item.covenant then item.load = item.load or {} item.load.use_covenant = true item.load.covenant = { single = item.covenant, - multi = {} + multi = {}, } end - if (item.bonusItemId) then + if item.bonusItemId then item.load = item.load or {} item.load.use_item_bonusid_equipped = true item.load.item_bonusid_equipped = tostring(item.bonusItemId) @@ -1191,40 +1187,41 @@ local function handleItem(item) if item.form then item.usable = true end - return waitingForItemInfo; + return waitingForItemInfo end local function addLoadCondition(item, loadCondition) -- No need to deep copy here, templates are read-only - item.load = item.load or {}; + item.load = item.load or {} for k, v in pairs(loadCondition) do - item.load[k] = v; + item.load[k] = v end end -local delayedEnrichDatabase = false; +local delayedEnrichDatabase = false local itemInfoReceived = CreateFrame("Frame") -local enrichTries = 0; +local enrichTries = 0 local function enrichDatabase() - if (enrichTries > 3) then - return; + if enrichTries > 3 then + return end - enrichTries = enrichTries + 1; + enrichTries = enrichTries + 1 - local waitingForItemInfo = false; + local waitingForItemInfo = false for className, class in pairs(templates.class) do for specIndex, spec in pairs(class) do for _, section in pairs(spec) do local loadCondition = { - use_class = true, class = { single = className, multi = {} }, - }; + use_class = true, + class = { single = className, multi = {} }, + } for itemIndex, item in pairs(section.args or {}) do local handle = handleItem(item) - if(handle) then - waitingForItemInfo = true; + if handle then + waitingForItemInfo = true end - addLoadCondition(item, loadCondition); + addLoadCondition(item, loadCondition) end end end @@ -1232,58 +1229,56 @@ local function enrichDatabase() for raceName, race in pairs(templates.race) do local loadCondition = { - use_race = true, race = { single = raceName, multi = {} } - }; + use_race = true, + race = { single = raceName, multi = {} }, + } for _, item in pairs(race) do local handle = handleItem(item) if handle then - waitingForItemInfo = true; + waitingForItemInfo = true end if handle ~= nil then - addLoadCondition(item, loadCondition); + addLoadCondition(item, loadCondition) end end end for _, item in pairs(templates.general.args) do - if (handleItem(item)) then - waitingForItemInfo = true; + if handleItem(item) then + waitingForItemInfo = true end end - if (waitingForItemInfo) then - itemInfoReceived:RegisterEvent("GET_ITEM_INFO_RECEIVED"); + if waitingForItemInfo then + itemInfoReceived:RegisterEvent("GET_ITEM_INFO_RECEIVED") else - itemInfoReceived:UnregisterEvent("GET_ITEM_INFO_RECEIVED"); + itemInfoReceived:UnregisterEvent("GET_ITEM_INFO_RECEIVED") end end - -enrichDatabase(); +enrichDatabase() itemInfoReceived:SetScript("OnEvent", function() - if (not delayedEnrichDatabase) then - delayedEnrichDatabase = true; + if not delayedEnrichDatabase then + delayedEnrichDatabase = true C_Timer.After(2, function() - enrichDatabase(); - delayedEnrichDatabase = false; + enrichDatabase() + delayedEnrichDatabase = false end) end -end); - +end) -- Enrich Display templates with default values for regionType, regionData in pairs(WeakAuras.regionOptions) do - if (regionData.templates) then + if regionData.templates then for _, item in ipairs(regionData.templates) do for k, v in pairs(WeakAuras.regionTypes[regionType].default) do - if (item.data[k] == nil) then - item.data[k] = v; + if item.data[k] == nil then + item.data[k] = v end end end end end - -WeakAuras.triggerTemplates = templates; +WeakAuras.triggerTemplates = templates diff --git a/cspell.json b/cspell.json index be189307c2..aa5679081d 100644 --- a/cspell.json +++ b/cspell.json @@ -224,6 +224,7 @@ "Skeram", "SOUNDFX", "spellid", + "stylua", "Sulfuron", "Taijitu", "Tauren", diff --git a/stylua.toml b/stylua.toml index 64c73e971a..d6e4816fb3 100644 --- a/stylua.toml +++ b/stylua.toml @@ -2,3 +2,4 @@ indent_type = "Spaces" indent_width = 2 column_width = 180 line_endings = "Unix" +quote_style = "ForceDouble"