Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
d87 committed Jan 11, 2021
0 parents commit 7e51d5e
Show file tree
Hide file tree
Showing 6 changed files with 263 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Release

on:
push:
tags:
- '[0-9]*'
- 'v[0-9]*'

jobs:
build:

runs-on: ubuntu-latest
env:
CF_API_KEY: ${{ secrets.CF_API_KEY }}
GITHUB_OAUTH: ${{ secrets.GH_OAUTH }}
WOWI_API_TOKEN: ${{ secrets.WOWI_API_TOKEN }}
steps:
- uses: actions/checkout@v1
- name: Install and run Luacheck
run: |
sudo apt-get install luarocks
luarocks install --local luacheck
/home/runner/.luarocks/bin/luacheck . --no-color -q
- name: Create Package
run: curl -s https://raw.githubusercontent.com/BigWigsMods/packager/master/release.sh | bash;
if: '!contains( github.ref, ''beta'')'

- name: Create Pre-Release Package
run: curl -s https://raw.githubusercontent.com/BigWigsMods/packager/master/release.sh | bash -s -- -p 0 -w 0;
if: 'contains( github.ref, ''beta'')'
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.orig
Libs/
134 changes: 134 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
std = "lua51"
max_line_length = false
exclude_files = {
"**/Libs",
}
only = {
"011", -- syntax
"1", -- globals
}
ignore = {
"11/SLASH_.*", -- slash handlers
"1/[A-Z][A-Z][A-Z0-9_]+", -- three letter+ constants
}
globals = {
-- wow std api
"abs",
"acos",
"asin",
"atan",
"atan2",
"bit",
"ceil",
"cos",
"date",
"debuglocals",
"debugprofilestart",
"debugprofilestop",
"debugstack",
"deg",
"difftime",
"exp",
"fastrandom",
"floor",
"forceinsecure",
"foreach",
"foreachi",
"format",
"frexp",
"geterrorhandler",
"getn",
"gmatch",
"gsub",
"hooksecurefunc",
"issecure",
"issecurevariable",
"ldexp",
"log",
"log10",
"max",
"min",
"mod",
"rad",
"random",
"scrub",
"securecall",
"seterrorhandler",
"sin",
"sort",
"sqrt",
"strbyte",
"strchar",
"strcmputf8i",
"strconcat",
"strfind",
"string.join",
"strjoin",
"strlen",
"strlenutf8",
"strlower",
"strmatch",
"strrep",
"strrev",
"strsplit",
"strsub",
"strtrim",
"strupper",
"table.wipe",
"tan",
"time",
"tinsert",
"tremove",
"wipe",

-- everything else
"NugHealth",
"NugHealthDB",

"C_Timer",
"UIParent",
"SlashCmdList",
"LibStub",
"GetLocale",
"GameTooltip",
"Mixin",
"PixelUtil",
"ColorPickerFrame",


"Enum",
"UnitPower",
"GetTime",

"InterfaceOptionsFrame",
"InterfaceOptionsFrame_OpenToCategory",
"InterfaceOptions_AddCategory",
"LoadAddOn",
"ActionButton_GetOverlayGlow",
"Mixin",

"GetBuildnfo",
"CreateFrame",
"IsPlayerSpell",
"GetSpellInfo",
"UnitHealth",
"UnitHealthMax",
"UnitAura",
"UnitGUID",
"CopyTable",
"UnitGetTotalAbsorbs",
"UnitGetIncomingHeals",
"UnitClass",
"GetBuildInfo",
"InCombatLockdown",
"UnitClass",
"UnitStagger",
"UnitGetTotalHealAbsorbs",
"InCombatLockdown",
"CombatLogGetCurrentEventInfo",
"GetCVar",
"UnitClass",
"CreateTexturePool",
"C_NamePlate",
"GetSpellTexture",
}
3 changes: 3 additions & 0 deletions .pkgmeta
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package-as: NugTotemIcons

enable-nolib-creation: no
3 changes: 3 additions & 0 deletions NugTotemIcon.toc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Interface: 90000
## Title: NugTotemIcon
core.lua
90 changes: 90 additions & 0 deletions core.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
local f = CreateFrame("Frame", nil, UIParent)
f:RegisterEvent("NAME_PLATE_UNIT_ADDED")
f:RegisterEvent("NAME_PLATE_UNIT_REMOVED")

f:SetScript("OnEvent", function(self, event, ...)
return self[event](self, event, ...)
end)

-- nameplateShowEnemyGuardians = "0",
-- nameplateShowEnemyMinions = "0",
-- nameplateShowEnemyMinus = "0",
-- nameplateShowEnemyPets = "1",
-- nameplateShowEnemyTotems = "1",

local function GetUnitNPCID(unit)
local guid = UnitGUID(unit)
local _, _, _, _, _, npcID = strsplit("-", guid);
return tonumber(npcID)
end

local totemNpcIDs = {
-- [npcID] = { spellID, duration }
[2630] = { 2484, 20 }, -- Earthbind
[3527] = { 5394, 15 }, -- Healing Stream
[6112] = { 8512, 120 }, -- Windfury
[97369] = { 192222, 15 }, -- Liquid Magma
[5913] = { 8143, 10 }, -- Tremor
[5925] = { 204336, 3 }, -- Grounding
[78001] = { 157153, 15 }, -- Cloudburst
[53006] = { 98008, 6 }, -- Spirit Link
[59764] = { 108280, 12 }, -- Healing Tide
[61245] = { 192058, 2 }, -- Static Charge
[100943] = { 198838, 15 }, -- Earthen Wall
[97285] = { 192077, 15 }, -- Wind Rush
[105451] = { 204331, 15 }, -- Counterstrike
[104818] = { 207399, 30 }, -- Ancestral
[105427] = { 204330, 15 }, -- Skyfury

-- Warrior
[119052] = { 236320, 15 }, -- War Banner
}

local function CreateIcon(nameplate)
local frame = CreateFrame("Frame", nil, nameplate)
frame:SetSize(63, 63)
frame:SetPoint("BOTTOM", nameplate, "TOP", 0, 5)

local icon = frame:CreateTexture(nil, "ARTWORK")
icon:SetTexCoord(0.1, 0.9, 0.1, 0.9)
icon:SetAllPoints()

local bg = frame:CreateTexture(nil, "BACKGROUND")
bg:SetTexture("Interface\\BUTTONS\\WHITE8X8")
bg:SetVertexColor(0, 0, 0, 0.5)
bg:SetPoint("TOPLEFT", frame, "TOPLEFT", -2, 2)
bg:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", 2, -2)

frame.icon = icon
frame.bg = bg

return frame
end

function f.NAME_PLATE_UNIT_ADDED(self, event, unit)
local np = C_NamePlate.GetNamePlateForUnit(unit)
local npcID = GetUnitNPCID(unit)

if npcID and totemNpcIDs[npcID] then
if not np.NugTotemIcon then
np.NugTotemIcon = CreateIcon(np)
end

local iconFrame = np.NugTotemIcon
iconFrame:Show()

local totemData = totemNpcIDs[npcID]
local spellID, duration = unpack(totemData)

local tex = GetSpellTexture(spellID)

iconFrame.icon:SetTexture(tex)
end
end

function f.NAME_PLATE_UNIT_REMOVED(self, event, unit)
local np = C_NamePlate.GetNamePlateForUnit(unit)
if np.NugTotemIcon then
np.NugTotemIcon:Hide()
end
end

0 comments on commit 7e51d5e

Please sign in to comment.