diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index ed06877..ca436ca 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -21,4 +21,7 @@ assignees: '' **Does the issue still occur when all addons except ClassicCastbars are disabled?** +**Is this for Classic or TBC client?** + + **Any additional info? If you play on a non-english client, please include your locale type:** diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d91114e..91036d0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,7 +28,18 @@ jobs: uses: BigWigsMods/packager@master if: ${{ success() && github.event_name != 'pull_request' && contains(github.ref, 'tags/v') }} with: - args: -g classic + args: -g classic -w 24925 + env: + CF_API_KEY: ${{ secrets.CF_API_KEY }} + GITHUB_OAUTH: ${{ secrets.GITHUB_TOKEN }} + WOWI_API_TOKEN: ${{ secrets.WOWI_API_TOKEN }} + WAGO_API_TOKEN: ${{ secrets.WAGO_API_TOKEN }} + + - name: Create TBC Package + uses: BigWigsMods/packager@master + if: ${{ success() && github.event_name != 'pull_request' && contains(github.ref, 'tags/v') }} + with: + args: -g bcc env: CF_API_KEY: ${{ secrets.CF_API_KEY }} GITHUB_OAUTH: ${{ secrets.GITHUB_TOKEN }} diff --git a/.luacheckrc b/.luacheckrc index 02b77e3..103ffc7 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -19,10 +19,14 @@ globals = { "ClassicCastbars", "SlashCmdList", "CastingBarFrame", + "TargetFrameSpellBar", + "FocusFrameSpellBar", } read_globals = { "PlayerFrame_AdjustAttachments", + "ArenaEnemyFrames", + "LoadAddOn", "IsModifierKeyDown", "IsMetaKeyDown", "LibStub", diff --git a/.pkgmeta b/.pkgmeta index 93236ca..d8fb33c 100644 --- a/.pkgmeta +++ b/.pkgmeta @@ -20,4 +20,3 @@ ignore: - release.sh - ClassicCastbars_Options/Libs/LibStub/LibStub.toc - ClassicCastbars_Options/Libs/LibStub/tests - - ClassicCastbars/ClassicCastbars_TBC.lua diff --git a/ClassicCastbars/ClassicCastbars.lua b/ClassicCastbars/ClassicCastbars.lua index 96bc23e..46123bb 100644 --- a/ClassicCastbars/ClassicCastbars.lua +++ b/ClassicCastbars/ClassicCastbars.lua @@ -1,3 +1,7 @@ +if _G.WOW_PROJECT_ID ~= _G.WOW_PROJECT_CLASSIC then + return print("|cFFFF0000[ERROR] You're using the Vanilla version of ClassicCastbars on a non-vanilla client. Please download the correct version.|r") -- luacheck: ignore +end + local _, namespace = ... local PoolManager = namespace.PoolManager @@ -409,8 +413,11 @@ function addon:PLAYER_LOGIN() -- Reset certain stuff on game locale switched if self.db.locale ~= GetLocale() then self.db.locale = GetLocale() - self.db.target.castFont = _G.STANDARD_TEXT_FONT -- Font here only works for certain locales + self.db.target.castFont = _G.STANDARD_TEXT_FONT self.db.nameplate.castFont = _G.STANDARD_TEXT_FONT + self.db.focus.castFont = _G.STANDARD_TEXT_FONT + self.db.arena.castFont = _G.STANDARD_TEXT_FONT + self.db.party.castFont = _G.STANDARD_TEXT_FONT self.db.npcCastUninterruptibleCache = CopyTable(namespace.defaultConfig.npcCastUninterruptibleCache) end @@ -420,16 +427,6 @@ function addon:PLAYER_LOGIN() namespace.defaultConfig = nil end - if _G.WOW_PROJECT_ID == (_G.WOW_PROJECT_BURNING_CRUSADE_CLASSIC or 5) then - self.db.player.enabled = true - self.db.party.enabled = false - self.db.focus.enabled = false - self.db.target.enabled = false - self.db.nameplate.enabled = false - self.db.npcCastUninterruptibleCache = {} - print("Warning: ClassicCastbars is not yet supported for TBC, only the player's own castbar is modifiable for now.") -- luacheck: ignore - end - if self.db.player.enabled then self:SkinPlayerCastbar() end diff --git a/ClassicCastbars/ClassicCastbars.toc b/ClassicCastbars/ClassicCastbars.toc index 65b1a53..69ea476 100644 --- a/ClassicCastbars/ClassicCastbars.toc +++ b/ClassicCastbars/ClassicCastbars.toc @@ -8,7 +8,6 @@ ## Author: Wardz ## Version: @project-version@ ## X-Curse-Project-ID: 322865 -## X-WoWI-ID: 24925 ## X-Wago-ID: vEGPdkG1 core/PoolManager.lua @@ -17,7 +16,7 @@ core/Data.lua #@version-classic@ ClassicCastbars.lua #@end-version-classic@ -#@version-bc@ -#ClassicCastbars_TBC.lua -#@end-version-bc@ +#@version-bcc@ +ClassicCastbars_TBC.lua +#@end-version-bcc@ core/Frames.lua diff --git a/ClassicCastbars/ClassicCastbars_TBC.lua b/ClassicCastbars/ClassicCastbars_TBC.lua index 8d02064..2c99c86 100644 --- a/ClassicCastbars/ClassicCastbars_TBC.lua +++ b/ClassicCastbars/ClassicCastbars_TBC.lua @@ -1,13 +1,7 @@ -if not _G.WOW_PROJECT_ID or (_G.WOW_PROJECT_ID ~= _G.WOW_PROJECT_BURNING_CRUSADE_CLASSIC) then - --return print("|cFFFF0000[ERROR] This version of ClassicCastbars only supports The Burning Crusade. Download the classic version instead for vanilla.|r") -- luacheck: ignore - return +if _G.WOW_PROJECT_ID ~= (_G.WOW_PROJECT_BURNING_CRUSADE_CLASSIC or 5) then + return print("|cFFFF0000[ERROR] You're using the TBC version of ClassicCastbars on a non-TBC client. Please download the correct version.|r") -- luacheck: ignore end ------------------------------- --- EARLY PROTOTYPE STUFF, NOTHING HERE WORKS YET !!! - --- luacheck: ignore - local _, namespace = ... local PoolManager = namespace.PoolManager local activeFrames = {} @@ -22,10 +16,25 @@ addon.defaultConfig = namespace.defaultConfig addon.activeFrames = activeFrames namespace.addon = addon +local GetNamePlateForUnit = _G.C_NamePlate.GetNamePlateForUnit +local UnitIsFriend = _G.UnitIsFriend local UnitCastingInfo = _G.UnitCastingInfo local UnitChannelInfo = _G.UnitChannelInfo local gsub = _G.string.gsub +local castEvents = { + "UNIT_SPELLCAST_START", + "UNIT_SPELLCAST_STOP", + "UNIT_SPELLCAST_INTERRUPTED", + "UNIT_SPELLCAST_SUCCEEDED", + "UNIT_SPELLCAST_DELAYED", + "UNIT_SPELLCAST_FAILED", + "UNIT_SPELLCAST_FAILED_QUIET", + "UNIT_SPELLCAST_CHANNEL_START", + "UNIT_SPELLCAST_CHANNEL_UPDATE", + "UNIT_SPELLCAST_CHANNEL_STOP", +} + function addon:GetUnitType(unitID) local unit = gsub(unitID or "", "%d", "") -- remove numbers if unit == "nameplate-testmode" then @@ -39,11 +48,71 @@ function addon:GetUnitType(unitID) return unit end -local origGetCastbarFrame = addon.GetCastbarFrame -function addon:GetCastbarFrame(unitID) - -- TODO: will this work? - if self.db[self:GetUnitType(unitID)].enabled then - return origGetCastbarFrame(unitID) +function addon:GetCastbarFrameIfEnabled(unitID) + local cfg = self.db[self:GetUnitType(unitID)] + if cfg and cfg.enabled then + if self:GetUnitType(unitID) == "nameplate" then + local isFriendly = UnitIsFriend("player", unitID) + if not self.db.nameplate.showForFriendly and isFriendly then return end + if not self.db.nameplate.showForEnemy and not isFriendly then return end + end + + return addon:GetCastbarFrame(unitID) + end +end + +-- TODO: cleanup +function addon:DisableBlizzardCastbar(unitID, disable) + if not disable then + if unitID == "target" then + for i = 1, #castEvents do + TargetFrameSpellBar:RegisterEvent(castEvents[i]) + end + TargetFrameSpellBar.showCastbar = true + elseif unitID == "focus" then + for i = 1, #castEvents do + FocusFrameSpellBar:RegisterEvent(castEvents[i]) + end + FocusFrameSpellBar.showCastbar = true + elseif self:GetUnitType(unitID) == "arena" then + for i = 1, 5 do + local frame = _G["ArenaEnemyFrame"..i.."CastingBar"] + if frame then + frame.showCastbar = true + for j = 1, #castEvents do + frame:RegisterEvent(castEvents[j]) + end + end + end + end + else + if unitID == "target" then + TargetFrameSpellBar.showCastbar = false + TargetFrameSpellBar:SetAlpha(0) + TargetFrameSpellBar:SetValue(0) + TargetFrameSpellBar:Hide() + for i = 1, #castEvents do + TargetFrameSpellBar:UnregisterEvent(castEvents[i]) + end + elseif unitID == "focus" then + FocusFrameSpellBar.showCastbar = false + FocusFrameSpellBar:SetAlpha(0) + FocusFrameSpellBar:SetValue(0) + FocusFrameSpellBar:Hide() + for i = 1, #castEvents do + FocusFrameSpellBar:UnregisterEvent(castEvents[i]) + end + elseif self:GetUnitType(unitID) == "arena" then + for i = 1, 5 do + local frame = _G["ArenaEnemyFrame"..i.."CastingBar"] + if frame then + frame.showCastbar = false + for j = 1, #castEvents do + frame:UnregisterEvent(castEvents[j]) + end + end + end + end end end @@ -53,21 +122,74 @@ function addon:BindCurrentCastData(castbar, unitID, isChanneled) local GetCastingInfo = isChanneled and UnitChannelInfo or UnitCastingInfo local spellName, _, iconTexturePath, startTimeMS, endTimeMS, _, _, _, spellID = GetCastingInfo(unitID) - cast.maxValue = endTimeMS - startTimeMS - cast.endTime = endTimeMS + cast.maxValue = (endTimeMS - startTimeMS) / 1000 + cast.endTime = endTimeMS / 1000 cast.spellName = spellName cast.spellID = spellID cast.icon = iconTexturePath cast.isChanneled = isChanneled - cast.timeStart = startTimeMS + cast.timeStart = startTimeMS / 1000 cast.isUninterruptible = nil cast.isFailed = nil cast.isInterrupted = nil cast.isCastComplete = nil end +function addon:PLAYER_TARGET_CHANGED() + if UnitCastingInfo("target") then + self:UNIT_SPELLCAST_START("target") + elseif UnitChannelInfo("target") then + self:UNIT_SPELLCAST_CHANNEL_START("target") + else + local castbar = activeFrames["target"] + if castbar then -- this seems to be needed for race conditions + self:HideCastbar(castbar, "target", true) + end + end +end + +function addon:PLAYER_FOCUS_CHANGED() + if UnitCastingInfo("focus") then + self:UNIT_SPELLCAST_START("focus") + elseif UnitChannelInfo("focus") then + self:UNIT_SPELLCAST_CHANNEL_START("focus") + else + local castbar = activeFrames["focus"] + if castbar then + self:HideCastbar(castbar, "focus", true) + end + end +end + +function addon:NAME_PLATE_UNIT_ADDED(namePlateUnitToken) + local plate = GetNamePlateForUnit(namePlateUnitToken) + plate.UnitFrame.CastBar.showCastbar = not self.db.nameplate.enabled + if self.db.nameplate.enabled then + plate.UnitFrame.CastBar:Hide() + end + + if UnitCastingInfo(namePlateUnitToken) then + self:UNIT_SPELLCAST_START(namePlateUnitToken) + elseif UnitChannelInfo(namePlateUnitToken) then + self:UNIT_SPELLCAST_CHANNEL_START(namePlateUnitToken) + else + local castbar = activeFrames[namePlateUnitToken] + if castbar then -- this seems to be needed for race conditions + self:HideCastbar(castbar, namePlateUnitToken, true) + end + end +end + +function addon:NAME_PLATE_UNIT_REMOVED(namePlateUnitToken) + local castbar = activeFrames[namePlateUnitToken] + if castbar then + PoolManager:ReleaseFrame(castbar) + activeFrames[namePlateUnitToken] = nil + end +end + function addon:UNIT_SPELLCAST_START(unitID) - local castbar = self:GetCastbarFrame(unitID) + local castbar = self:GetCastbarFrameIfEnabled(unitID) if not castbar then return end self:BindCurrentCastData(castbar, unitID, false) @@ -75,69 +197,83 @@ function addon:UNIT_SPELLCAST_START(unitID) end function addon:UNIT_SPELLCAST_CHANNEL_START(unitID) - local castbar = self:GetCastbarFrame(unitID) + local castbar = self:GetCastbarFrameIfEnabled(unitID) if not castbar then return end self:BindCurrentCastData(castbar, unitID, true) self:DisplayCastbar(castbar, unitID) end -function addon:UNIT_SPELLCAST_STOP(unitID, castGUID, spellID) +function addon:UNIT_SPELLCAST_STOP(unitID) local castbar = activeFrames[unitID] if not castbar then return end if not castbar.isTesting then + if castbar._data then + if not castbar._data.isInterrupted then + castbar._data.isFailed = true + end + end self:HideCastbar(castbar, unitID) end castbar._data = nil end -function addon:UNIT_SPELLCAST_INTERRUPTED(unitID, castGUID, spellID) +function addon:UNIT_SPELLCAST_INTERRUPTED(unitID) local castbar = activeFrames[unitID] if not castbar then return end if not castbar.isTesting then - castbar._data.isInterrupted = true + if castbar._data then + castbar._data.isInterrupted = true + castbar._data.isFailed = false + end self:HideCastbar(castbar, unitID) end castbar._data = nil end -function addon:UNIT_SPELLCAST_SUCCEEDED(unitID, castGUID, spellID) +function addon:UNIT_SPELLCAST_SUCCEEDED(unitID) local castbar = activeFrames[unitID] if not castbar then return end if not castbar.isTesting then - castbar._data.isCastComplete = true + if castbar._data then + castbar._data.isCastComplete = true + if castbar._data.isChanneled then return end -- _SUCCEEDED triggered every tick for channeled + end self:HideCastbar(castbar, unitID) end castbar._data = nil end -function addon:UNIT_SPELLCAST_DELAYED(unitID, castGUID, spellID) - local castbar = self:GetCastbarFrame(unitID) +function addon:UNIT_SPELLCAST_DELAYED(unitID) + local castbar = self:GetCastbarFrameIfEnabled(unitID) if not castbar then return end self:BindCurrentCastData(castbar, unitID, false) - --self:DisplayCastbar(castbar, unitID) end -function addon:UNIT_SPELLCAST_CHANNEL_UPDATE(unitID, castGUID, spellID) - local castbar = self:GetCastbarFrame(unitID) +function addon:UNIT_SPELLCAST_CHANNEL_UPDATE(unitID) + local castbar = self:GetCastbarFrameIfEnabled(unitID) if not castbar then return end self:BindCurrentCastData(castbar, unitID, true) end -function addon:UNIT_SPELLCAST_FAILED(unitID, castGUID, spellID) +function addon:UNIT_SPELLCAST_FAILED(unitID) local castbar = activeFrames[unitID] if not castbar then return end if not castbar.isTesting then - castbar._data.isFailed = true + if castbar._data then + if not castbar._data.isInterrupted then + castbar._data.isFailed = true + end + end self:HideCastbar(castbar, unitID) end @@ -145,43 +281,42 @@ function addon:UNIT_SPELLCAST_FAILED(unitID, castGUID, spellID) end addon.UNIT_SPELLCAST_FAILED_QUIET = addon.UNIT_SPELLCAST_FAILED -function addon:UNIT_SPELLCAST_CHANNEL_STOP(unitID, castGUID, spellID) +function addon:UNIT_SPELLCAST_CHANNEL_STOP(unitID) local castbar = activeFrames[unitID] if not castbar then return end if not castbar.isTesting then - --castbar._data.isFailed = true self:HideCastbar(castbar, unitID) end castbar._data = nil end -local auraRows = 0 -function addon:UNIT_AURA() - if not self.db.target.autoPosition then return end - if auraRows == TargetFrame.auraRows then return end - auraRows = TargetFrame.auraRows +function addon:UNIT_AURA(unitID) + if not self.db[unitID].autoPosition then return end + -- TODO: aurarows -- Update target castbar position based on amount of auras currently shown - if activeFrames.target and UnitExists("target") then - local parentFrame = self.AnchorManager:GetAnchor("target") + if activeFrames[unitID] and UnitExists(unitID) then + local parentFrame = self.AnchorManager:GetAnchor(unitID) if parentFrame then - self:SetTargetCastbarPosition(activeFrames.target, parentFrame) + self:SetTargetCastbarPosition(activeFrames[unitID], parentFrame) end end end function addon:ToggleUnitEvents(shouldReset) - if self.db.target.enabled then - if self.db.target.autoPosition then - -- TODO: focus - self:RegisterUnitEvent("UNIT_AURA", "target") + if self.db.target.enabled or self.db.focus.enabled then + if self.db.target.autoPosition or self.db.focus.autoPosition then + self:RegisterUnitEvent("UNIT_AURA", "target", "focus") end else self:UnregisterEvent("UNIT_AURA") end + self:RegisterEvent("PLAYER_TARGET_CHANGED") + self:RegisterEvent("PLAYER_FOCUS_CHANGED") + if self.db.party.enabled then self:RegisterEvent("GROUP_ROSTER_UPDATE") self:RegisterEvent("GROUP_JOINED") @@ -190,16 +325,17 @@ function addon:ToggleUnitEvents(shouldReset) self:UnregisterEvent("GROUP_JOINED") end - self:RegisterEvent("UNIT_SPELLCAST_START") - self:RegisterEvent("UNIT_SPELLCAST_STOP") - self:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED") - self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED") - self:RegisterEvent("UNIT_SPELLCAST_DELAYED") - self:RegisterEvent("UNIT_SPELLCAST_FAILED") - self:RegisterEvent("UNIT_SPELLCAST_FAILED_QUIET") - self:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START") - self:RegisterEvent("UNIT_SPELLCAST_CHANNEL_UPDATE") - self:RegisterEvent("UNIT_SPELLCAST_CHANNEL_STOP") + --if self.db.nameplate.enabled then + self:RegisterEvent("NAME_PLATE_UNIT_ADDED") + self:RegisterEvent("NAME_PLATE_UNIT_REMOVED") + --[[else + self:UnregisterEvent("NAME_PLATE_UNIT_ADDED") + self:UnregisterEvent("NAME_PLATE_UNIT_REMOVED") + end]] + + for i = 1, #castEvents do + self:RegisterEvent(castEvents[i]) + end if shouldReset then self:PLAYER_ENTERING_WORLD() -- wipe all data @@ -265,19 +401,23 @@ function addon:PLAYER_LOGIN() self:SkinPlayerCastbar() end + self:DisableBlizzardCastbar("target", self.db.target.enabled) + self:DisableBlizzardCastbar("focus", self.db.focus.enabled) + self.PLAYER_GUID = UnitGUID("player") self:ToggleUnitEvents() - self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") + --self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") self:RegisterEvent("PLAYER_ENTERING_WORLD") self:UnregisterEvent("PLAYER_LOGIN") self.PLAYER_LOGIN = nil end ---[[function addon:GROUP_ROSTER_UPDATE() +function addon:GROUP_ROSTER_UPDATE() for i = 1, 5 do if UnitExists("party"..i) then - -- hide castbar incase party frames were shifted around - self:StopCast("party"..i, true) -- TODO: add me + if activeFrames["party"..i] then + activeFrames["party"..i]:Hide() + end else -- party member no longer exists, release castbar local castbar = activeFrames["party"..i] @@ -288,10 +428,11 @@ end end end end -addon.GROUP_JOINED = addon.GROUP_ROSTER_UPDATE]] +addon.GROUP_JOINED = addon.GROUP_ROSTER_UPDATE --- TODO: cleu auto learn uninterruptible casts --- TODO: self.db.nameplate.showForFriendly +function addon:COMBAT_LOG_EVENT_UNFILTERED() + -- TODO: CLEU auto learn uninterruptible casts +end addon:SetScript("OnUpdate", function(self) local currTime = GetTime() diff --git a/ClassicCastbars/core/AnchorManager.lua b/ClassicCastbars/core/AnchorManager.lua index d9b3cf9..337d944 100644 --- a/ClassicCastbars/core/AnchorManager.lua +++ b/ClassicCastbars/core/AnchorManager.lua @@ -41,7 +41,7 @@ local anchors = { "CompactRaidGroup1Member%d", }, - --@version-bc@ + --@version-bcc@ focus = { "SUFUnitfocus", "XPerl_FocusportraitFrame", @@ -73,7 +73,7 @@ local anchors = { "oUF_LumenArena%d", "ArenaEnemyFrame%d", }, - --@end-version-bc@ + --@end-version-bcc@ } local _G = _G @@ -96,11 +96,11 @@ local function GetUnitFrameForUnit(unitType, unitID, hasNumberIndex) local unitFrame = _G[name] if unitFrame then - if unitType == "party" then + if unitType == "party" or unitType == "arena" then return unitFrame, name end - if unitFrame:IsVisible() then -- unit frame exists and also is in use (for party we need to ignore this check) + if unitFrame:IsVisible() then -- unit frame exists and also is in use (for party/arena we need to ignore this check) return unitFrame, name end end @@ -157,7 +157,9 @@ function AnchorManager:GetAnchor(unitID) frame = GetNamePlateForUnit("target") elseif unitType == "party" or unitType == "party-testmode" then frame = GetPartyFrameForUnit(unitID) - else -- target + elseif unitType == "arena-testmode" then + frame = GetUnitFrameForUnit("arena", "arena1", true) + else -- target/focus frame = GetUnitFrameForUnit(unitType, unitID, count > 0) end @@ -166,5 +168,12 @@ function AnchorManager:GetAnchor(unitID) anchorCache[unitID] = frame end + if _G.WOW_PROJECT_ID ~= _G.WOW_PROJECT_CLASSIC then + if frame and unitType == "focus" then + anchors[unitID] = nil + anchorCache[unitID] = frame + end + end + return frame end diff --git a/ClassicCastbars/core/Data.lua b/ClassicCastbars/core/Data.lua index 9631737..23d8095 100644 --- a/ClassicCastbars/core/Data.lua +++ b/ClassicCastbars/core/Data.lua @@ -1832,12 +1832,14 @@ namespace.uninterruptibleList = { [GetSpellInfo(1510)] = 1, -- Volley [GetSpellInfo(20904)] = 1, -- Aimed Shot [GetSpellInfo(11605)] = 1, -- Slam - [GetSpellInfo(6461)] = 1, -- Pick Lock + [GetSpellInfo(1804)] = 1, -- Pick Lock [GetSpellInfo(1842)] = 1, -- Disarm Trap [GetSpellInfo(2641)] = 1, -- Dismiss Pet + --@version-classic@ [GetSpellInfo(2480)] = 1, -- Shoot Bow [GetSpellInfo(7918)] = 1, -- Shoot Gun [GetSpellInfo(7919)] = 1, -- Shoot Crossbow + --@end-version-classic@ [GetSpellInfo(11202)] = 1, -- Crippling Poison [GetSpellInfo(3421)] = 1, -- Crippling Poison II [GetSpellInfo(2835)] = 1, -- Deadly Poison @@ -1949,13 +1951,19 @@ namespace.defaultConfig = { showTimer = false, showIcon = true, showSpark = true, - autoPosition = false, castFont = _G.STANDARD_TEXT_FONT, castFontSize = 10, castStatusBar = "Interface\\TargetingFrame\\UI-StatusBar", castBorder = "Interface\\CastingBar\\UI-CastingBar-Border-Small", hideIconBorder = false, - position = { "TOPLEFT", 275, -260 }, + --@version-classic@ + autoPosition = false, -- luacheck: ignore + position = { "TOPLEFT", 275, -260 }, -- luacheck: ignore + --@end-version-classic@ + --@version-bcc@ + autoPosition = true, + position = { "CENTER", -19, -112 }, + --@end-version-bcc@ iconPositionX = -5, iconPositionY = 0, borderColor = { 1, 1, 1, 1 }, @@ -2006,7 +2014,8 @@ namespace.defaultConfig = { ignoreParentAlpha = false, }, - --[[arena = { + --@version-bcc@ + arena = { enabled = false, width = 150, height = 15, @@ -2021,7 +2030,7 @@ namespace.defaultConfig = { castStatusBar = "Interface\\TargetingFrame\\UI-StatusBar", castBorder = "Interface\\CastingBar\\UI-CastingBar-Border-Small", hideIconBorder = false, - position = { "TOPLEFT", 275, -260 }, + position = { "CENTER", -149, -5 }, iconPositionX = -5, iconPositionY = 0, borderColor = { 1, 1, 1, 1 }, @@ -2037,7 +2046,8 @@ namespace.defaultConfig = { frameLevel = 10, statusBackgroundColor = { 0, 0, 0, 0.535 }, ignoreParentAlpha = false, - },]] + }, + --@end-version-bcc@ player = { enabled = false, diff --git a/ClassicCastbars/core/Frames.lua b/ClassicCastbars/core/Frames.lua index b786604..161e14a 100644 --- a/ClassicCastbars/core/Frames.lua +++ b/ClassicCastbars/core/Frames.lua @@ -20,9 +20,17 @@ local function GetStatusBarBackgroundTexture(statusbar) if statusbar.Background then return statusbar.Background end for _, v in pairs({ statusbar:GetRegions() }) do + --@version-classic@ if v.GetTexture and strfind(v:GetTexture() or "", "Color-") then return v end + --@end-version-classic@ + + --@version-bcc@ + if v.GetTexture and strfind("UI-StatusBar", v:GetTexture() or "") then -- TODO: test on classic + return v + end + --@end-version-bcc@ end end @@ -343,15 +351,22 @@ function addon:HideCastbar(castbar, unitID, skipFadeOut) end if castbar:GetAlpha() > 0 and castbar.fade then - castbar.fade:SetStartDelay(0) -- reset - if cast then - if cast.isInterrupted or cast.isFailed then - castbar.fade:SetStartDelay(0.5) + if not castbar.fade:IsPlaying() then + castbar.fade:SetStartDelay(0) -- reset + if cast then + if cast.isInterrupted or cast.isFailed then + castbar.fade:SetStartDelay(0.5) + end end - end - castbar.fade:SetDuration(cast and cast.isInterrupted and 1.2 or 0.3) - castbar.animationGroup:Play() + --@version-classic@ + castbar.fade:SetDuration(cast and cast.isInterrupted and 1.2 or 0.3) + --@end-version-classic@ + --@version-bcc@ + castbar.fade:SetDuration(0.6) + --@end-version-bcc@ + castbar.animationGroup:Play() + end end end diff --git a/ClassicCastbars_Options/ClassicCastbars_Options.lua b/ClassicCastbars_Options/ClassicCastbars_Options.lua index 5f12c1a..659b242 100644 --- a/ClassicCastbars_Options/ClassicCastbars_Options.lua +++ b/ClassicCastbars_Options/ClassicCastbars_Options.lua @@ -87,6 +87,7 @@ local function CreateUnitTabGroup(unitID, localizedUnit, order) set = function(_, value) ClassicCastbars.db[unitID].enabled = value ClassicCastbars:ToggleUnitEvents(true) + ClassicCastbars:DisableBlizzardCastbar(unitID, value) if unitID == "player" then if value == false then return ReloadUI() @@ -117,7 +118,7 @@ local function CreateUnitTabGroup(unitID, localizedUnit, order) name = L.AUTO_POS_BAR, desc = unitID ~= "player" and L.AUTO_POS_BAR_TOOLTIP or "", type = "toggle", - hidden = unitID == "nameplate" or unitID == "party" or unitID == "focus", + hidden = unitID == "nameplate" or unitID == "party" or unitID == "arena", disabled = ModuleIsDisabled, }, showTimer = { @@ -151,13 +152,7 @@ local function CreateUnitTabGroup(unitID, localizedUnit, order) desc = L.IGNORE_PARENT_ALPHA_TOOLTIP, type = "toggle", disabled = ModuleIsDisabled, - hidden = unitID == "player" or unitID == "focus", - }, - notes = { - order = 9, - hidden = unitID ~= "focus", - name = "\n\nSlash Commands:\n\n|cffffff00 - /focus\n\n - /clearfocus\n\n - /click FocusCastbar|r", - type = "description", + hidden = unitID == "player", }, }, }, @@ -519,12 +514,12 @@ local function GetOptionsTable() name = "ClassicCastbars " .. GetAddOnMetadata("ClassicCastbars", "version"), args = { - target = isClassic and CreateUnitTabGroup("target", L.TARGET, 1) or nil, -- temp disable these for TBC until we add support - nameplate = isClassic and CreateUnitTabGroup("nameplate", L.NAMEPLATE, 2) or nil, - party = isClassic and CreateUnitTabGroup("party", L.PARTY, 3) or nil, + target = CreateUnitTabGroup("target", L.TARGET, 1), + nameplate = CreateUnitTabGroup("nameplate", L.NAMEPLATE, 2), + party = CreateUnitTabGroup("party", L.PARTY, 3), player = CreateUnitTabGroup("player", L.PLAYER, 4), - focus = isClassic and CreateUnitTabGroup("focus", _G.FOCUS or "Focus", 5) or nil, - --arena = not isClassic and CreateUnitTabGroup("arena", _G.ARENA or "Arena", 6) or nil, + focus = CreateUnitTabGroup("focus", _G.FOCUS or "Focus", 5), + arena = not isClassic and CreateUnitTabGroup("arena", _G.ARENA or "Arena", 6) or nil, resetAllSettings = { order = 6, diff --git a/ClassicCastbars_Options/TestMode.lua b/ClassicCastbars_Options/TestMode.lua index 0a6e492..481b578 100644 --- a/ClassicCastbars_Options/TestMode.lua +++ b/ClassicCastbars_Options/TestMode.lua @@ -82,6 +82,10 @@ function TestMode:ToggleCastbarMovable(unitID) unitID = "party-testmode" end + if unitID == "arena-testmode" and not IsAddOnLoaded("Blizzard_ArenaUI") then + LoadAddOn("Blizzard_ArenaUI") + end + if self.isTesting[unitID] then self:SetCastbarImmovable(unitID) self.isTesting[unitID] = false @@ -102,7 +106,7 @@ end function TestMode:SetCastbarMovable(unitID, parent) local parentFrame = parent or ClassicCastbars.AnchorManager:GetAnchor(unitID) if not parentFrame then - if unitID == "target" or unitID == "nameplate-testmode" then + if unitID == "target" or unitID == "nameplate-testmode" or unitID == "focus" then print(format("|cFFFF0000[ClassicCastbars] %s|r", _G.ERR_GENERIC_NO_TARGET)) -- luacheck: ignore end return false @@ -140,6 +144,7 @@ function TestMode:SetCastbarMovable(unitID, parent) end if unitID == "party-testmode" or unitID == "arena-testmode" then + if unitID == "arena-testmode" and ArenaEnemyFrames then ArenaEnemyFrames:Show() end parentFrame:SetAlpha(1) parentFrame:Show() end @@ -190,6 +195,7 @@ function TestMode:SetCastbarImmovable(unitID) elseif unitID == "arena-testmode" then local parentFrame = castbar.parent or ClassicCastbars.AnchorManager:GetAnchor(unitID) if parentFrame and not UnitExists("arena1") then + if ArenaEnemyFrames then ArenaEnemyFrames:Hide() end parentFrame:Hide() end end diff --git a/README.md b/README.md index 5d55d27..3ae82b9 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,8 @@ Type `/castbar` or go to `Escape -> Interface Options -> AddOns -> ClassicCastba When forking the addon you should save the folder somewhere outside your WoW AddOns directory and instead have two symlinks inside the AddOns folder pointing to `ClassicCastbars/ClassicCastbars/` and `ClassicCastbars/ClassicCastbars_Options/`. - You will also need to manually install the libs for ClassicCastbars_Options. See "Externals" in `.pkgmeta` file. + As of TBC release, you now need to run the [BigWigs packager](https://github.com/BigWigsMods/packager) script after making changes to the code. + `./release.sh -d -l -z -g bcc` for TBC and `./release.sh -d -l -z -g classic` for Classic era. ## License diff --git a/changelog.txt b/changelog.txt index 8caeb96..d9b2fd6 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,10 @@ +v1.4.0: +- Add support for TBC (Make sure you download the correct file, classic and BC have seperate zips). + Note: This is the very first release for TBC pre-patch so expect minor bugs. Uninterruptible border shield is not yet supported but will be in the future. + Arena and party castbars are mostly untested and default off. + There's currently no way to distinguish between failed and successfully interrupted casts. (Will fix later) + + v1.3.23: - Fix incorrect anchoring for player castbar when the pet frame or autoPosition option is toggled.