diff --git a/.editorconfig b/.editorconfig index 6d415f8..99e7ce1 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,10 +1,13 @@ - -root = true - -[*] -indent_style = space -indent_size = 4 -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true + +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.xml] +indent_size = 2 diff --git a/.vscode/settings.json b/.vscode/settings.json index 1a02f95..24798c9 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,8 @@ { + "[xml]": { + "editor.formatOnSave": false, + }, + "editor.formatOnSave": true, "Lua.diagnostics.disable": [ //"undefined-global" ], diff --git a/SheepMonitor.toc b/SheepMonitor.toc index 0008878..186c822 100755 --- a/SheepMonitor.toc +++ b/SheepMonitor.toc @@ -1,8 +1,8 @@ -## Interface: 90205 +## Interface: 100000 ## Title: Sheep Monitor ## Notes: Provides various methods of notification to help you keep track of your flock. ## Author: funkjedi -## Version: 1.25 +## Version: 1.26 ## SavedVariables: SheepMonitorDatabase ## OptionalDeps: Ace3, LibAuras, LibAuraInfo-1.0 ## X-Curse-Project-ID: 28218 @@ -17,6 +17,6 @@ localization\localization.ruRU.lua localization\localization.zhTW.lua main.lua auras.lua -timers.lua +timers.xml integrations.lua options.lua diff --git a/auras.lua b/auras.lua index bd9efae..f505188 100755 --- a/auras.lua +++ b/auras.lua @@ -23,6 +23,7 @@ SheepMonitor.trackableAuras = { [61025] = 'Interface\\Icons\\Spell_Nature_GuardianWard', -- Polymorph (Serpent) [61780] = 'Interface\\Icons\\Achievement_WorldEvent_Thanksgiving', -- Polymorph (Turkey) [28271] = 'Interface\\Icons\\Ability_Hunter_Pet_Turtle', -- Polymorph (Turtle) + [383121] = 'Interface\\Icons\\Spell_Nature_DoublePolymorph1', -- Mass Polymorph -- [219393] = 'Interface\\Icons\\Spell_Nature_Polymorph', -- [Crittermorph] Polymorph -- [219407] = 'Interface\\Icons\\Achievement_Halloween_Cat_01', -- [Crittermorph] Polymorph (Black Cat) -- [277793] = 'Interface\\Icons\\Inv_Bee_Default', -- [Crittermorph] Polymorph (Bumblebee) @@ -31,7 +32,6 @@ SheepMonitor.trackableAuras = { -- [219403] = 'Interface\\Icons\\Spell_Magic_PolymorphPig', -- [Crittermorph] Polymorph (Pig) -- [219401] = 'Interface\\Icons\\Inv_Pet_Porcupine', -- [Crittermorph] Polymorph (Porcupine) -- [219398] = 'Interface\\Icons\\Ability_Hunter_Pet_Turtle', -- [Crittermorph] Polymorph (Turtle) - [51514] = 'Interface\\Icons\\Spell_Shaman_Hex', -- Hex [76780] = 'Interface\\Icons\\Spell_Shaman_BindElemental', -- Bind Elemental [9484] = 'Interface\\Icons\\Spell_Nature_Slow', -- Shackle Undead diff --git a/changelog.txt b/changelog.txt index 94e74b7..5933777 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,8 @@ +1.26 +- updated for patch 10.0 +- moved frame definition into XML +- added support for Mass Polymorph + 1.25 - updated for patch 9.2 - fixed bug where names wouldn't always show diff --git a/main.lua b/main.lua index 382fd40..b719f96 100755 --- a/main.lua +++ b/main.lua @@ -20,6 +20,7 @@ LibAuraInfo.auraInfo[161353] = '60;1' -- updating polymorph value for BFA LibAuraInfo.auraInfo[161354] = '60;1' -- updating polymorph value for BFA LibAuraInfo.auraInfo[161355] = '60;1' -- updating polymorph value for BFA LibAuraInfo.auraInfo[161372] = '60;1' -- updating polymorph value for BFA +LibAuraInfo.auraInfo[383121] = '60;1' -- adding mass polymorph LibAuraInfo.auraInfo[3355] = '60;1' -- fixing incorrect value LibAuraInfo.auraInfo[115078] = '40;1' -- adding ability_monk_paralysis -- LuaFormatter on diff --git a/timers.lua b/timers.lua index c214758..2b105af 100755 --- a/timers.lua +++ b/timers.lua @@ -1,15 +1,23 @@ local addonName, SheepMonitor = ... -local TimerMixin = {} - local notifierFrame local timerInstances = {} -local fontFamily = [[Interface\AddOns\SheepMonitor\fonts\DroidSans.ttf]] +SheepMonitorTimerMixin = {} + +BACKDROP_SHEEPMONITOR_TIMER_32_1 = { + bgFile = 'Interface\\DialogFrame\\UI-DialogBox-Background', + edgeFile = 'Interface\\DialogFrame\\UI-DialogBox-Background', + tile = true, + tileSize = 32, + edgeSize = 1, + insets = { left = 0, right = 0, top = 0, bottom = 0 }, +} + +SHEEPMONITOR_TEXT_FONT = [[Interface\AddOns\SheepMonitor\fonts\DroidSans.ttf]] --- use default game font for non-English locales if not string.match(GetLocale(), '^en') then - fontFamily = [[Fonts\FRIZQT__.ttf]] + SHEEPMONITOR_TEXT_FONT = STANDARD_TEXT_FONT end local function createNotifierFrame() @@ -45,81 +53,24 @@ local function createAuraTimer() end local frameName = 'SheepMonitorTimer' .. (#timerInstances + 1) - local timer = CreateFrame('Frame', frameName, createNotifierFrame(), 'BackdropTemplate') - - Mixin(timer, TimerMixin) - - timer:Hide() - timer:SetWidth(140) - timer:SetHeight(28) - timer:SetPoint('CENTER') - timer:EnableMouse(true) - - ---@diagnostic disable - timer:SetScript('OnHide', timer.StopDragging) - timer:SetScript('OnMouseDown', timer.StartDragging) - timer:SetScript('OnMouseUp', timer.StopDragging) - ---@diagnostic enable - - timer:SetBackdrop({ - bgFile = 'Interface\\DialogFrame\\UI-DialogBox-Background', - edgeFile = 'Interface\\DialogFrame\\UI-DialogBox-Background', - tile = true, - tileSize = 32, - edgeSize = 1, - insets = { left = 0, right = 0, top = 0, bottom = 0 }, - }) - - -- create our icon texture; default to the polymorph spell - local texture = timer:CreateTexture(frameName .. 'Icon', 'ARTWORK') - texture:SetTexture('Interface\\Icons\\Spell_nature_polymorph') - texture:SetSize(23, 23) - texture:SetPoint('LEFT', 3, 0) - texture:SetTexCoord(0.08, 0.92, 0.08, 0.92) - - -- create our status bar - local statusBar = CreateFrame('StatusBar', frameName .. 'StatusBar', timer, 'TextStatusBar') - statusBar:SetWidth(110) - statusBar:SetHeight(26) - statusBar:SetPoint('BOTTOMLEFT', timer, 27, 1) - statusBar:SetStatusBarTexture('Interface\\TargetingFrame\\UI-StatusBar') - statusBar:SetStatusBarColor(1, 0, 0) - - -- create our unit name label - local label = statusBar:CreateFontString(frameName .. 'StatusBarLabel', 'ARTWORK', 'GameFontHighlightSmall') - label:SetPoint('TOP') - label:SetPoint('BOTTOM') - label:SetPoint('LEFT', 4, 0) - label:SetPoint('RIGHT', -26, 0) - label:SetJustifyH('LEFT') - label:SetWordWrap(true) ---@diagnostic disable-line - label:SetFont(fontFamily, 11) - - -- create our timer text - local countdown = statusBar:CreateFontString(frameName .. 'StatusBarCountdown', 'ARTWORK', 'GameFontNormal') - countdown:SetPoint('TOP') - countdown:SetPoint('BOTTOM') - countdown:SetPoint('RIGHT', -4, 0) - countdown:SetFont(fontFamily, 13) - - timer.countdown = countdown - timer.label = label - timer.statusBar = statusBar - timer.texture = texture + local timer = CreateFrame('Frame', frameName, createNotifierFrame(), 'SheepMonitorTimerTemplate') + + timer.StatusBar.Label:SetFont([[Interface\AddOns\SheepMonitor\fonts\DroidSans.ttf]], 11) + timer.StatusBar.Countdown:SetFont([[Interface\AddOns\SheepMonitor\fonts\DroidSans.ttf]], 13) table.insert(timerInstances, timer) return timer, #timerInstances end -function TimerMixin:StartDragging(button) +function SheepMonitorTimerMixin:StartDragging(button) if button == 'RightButton' and not self.isMoving then self.isMoving = true notifierFrame:StartMoving() end end -function TimerMixin:StopDragging(button) +function SheepMonitorTimerMixin:StopDragging(button) if self.isMoving then self.isMoving = false notifierFrame:StopMovingOrSizing() @@ -131,7 +82,7 @@ function TimerMixin:StopDragging(button) end end -function TimerMixin:Start(aura) +function SheepMonitorTimerMixin:Start(aura) if self.aura then self:Stop() end @@ -139,11 +90,11 @@ function TimerMixin:Start(aura) self.aura = aura if SheepMonitor.db.char.enableNotifier then - self.label:SetText(aura.destName) - self.texture:SetTexture(aura.texture) - self.statusBar:SetMinMaxValues(0, aura.duration) - self.statusBar:SetValue(aura.duration) - self.countdown:SetText(aura.duration) + self.Icon:SetTexture(aura.texture) + self.StatusBar:SetMinMaxValues(0, aura.duration) + self.StatusBar:SetValue(aura.duration) + self.StatusBar.Countdown:SetText(aura.duration) + self.StatusBar.Label:SetText(aura.destName) SheepMonitor:UpdateAuraTimers() end @@ -152,19 +103,19 @@ function TimerMixin:Start(aura) return self end -function TimerMixin:Stop() +function SheepMonitorTimerMixin:Stop() self:CancelRepeatingTimers() self:Hide() self.aura = nil SheepMonitor:UpdateAuraTimers() end -function TimerMixin:GetRemaining(raw) +function SheepMonitorTimerMixin:GetRemaining(raw) local remaining = self.aura.duration - (GetTime() - self.aura.timestamp) return raw and remaining or floor(remaining) end -function TimerMixin:ScheduleRepeatingTimers() +function SheepMonitorTimerMixin:ScheduleRepeatingTimers() local onFinished = function(timer) local remaining = timer:GetRemaining() @@ -191,21 +142,21 @@ function TimerMixin:ScheduleRepeatingTimers() end end -function TimerMixin:CancelRepeatingTimers() +function SheepMonitorTimerMixin:CancelRepeatingTimers() SheepMonitor:CancelTimer(self.onFinishedTimer, true) SheepMonitor:CancelTimer(self.onUpdateTimer, true) end -function TimerMixin:OnFinished(remaining) +function SheepMonitorTimerMixin:OnFinished(remaining) SheepMonitor:POLYMORPH_UPDATE(self.aura, remaining) if self:IsVisible() then - self.countdown:SetText(remaining) + self.StatusBar.Countdown:SetText(remaining) end end -function TimerMixin:OnUpdate(remaining) - self.statusBar:SetValue(remaining) +function SheepMonitorTimerMixin:OnUpdate(remaining) + self.StatusBar:SetValue(remaining) end function SheepMonitor:StartAuraTimer(aura) diff --git a/timers.xml b/timers.xml new file mode 100644 index 0000000..9532bca --- /dev/null +++ b/timers.xml @@ -0,0 +1,65 @@ + + +