Skip to content

Commit

Permalink
minor optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
wardz committed Oct 7, 2024
1 parent 49729ac commit 865b6d0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ClassicCastbars/ClassicCastbars.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ local castEvents = {

local GetBuffDataByIndex = _G.C_UnitAuras and _G.C_UnitAuras.GetBuffDataByIndex
local next = _G.next
local gsub = _G.string.gsub
local strmatch = _G.string.match
local strfind = _G.string.find

function ClassicCastbars:GetUnitType(unitID)
return gsub(gsub(unitID or "", "%d", ""), "-testmode", "") -- remove numbers and suffix
return unitID and strmatch(unitID, "^%a+") -- remove numbers and testmode suffix
end

function ClassicCastbars:GetCastbarFrame(unitID)
Expand Down Expand Up @@ -141,7 +141,7 @@ function ClassicCastbars:BindCurrentCastData(castbar, unitID, isChanneled, chann
end

-- HACK: UnitChannelInfo is bugged for classic era, tmp fallback method
if channelSpellID and not spellName then
if WOW_PROJECT_ID == WOW_PROJECT_CLASSIC and channelSpellID and not spellName then
if C_Spell and C_Spell.GetSpellInfo then
local info = C_Spell.GetSpellInfo(channelSpellID)
spellName = info and info.name
Expand Down

0 comments on commit 865b6d0

Please sign in to comment.