Error with latest ElvUI BC Version
smoothys opened this issue ยท 6 comments
Game Built version (TBC)
2.5.2.40892
Getting this error after updating to ElvUI 2.24
ELvUI version : 2.24
Wow build version:
Spellranks not working anymore :(
Time: Sat Nov 13 12:52:33 2021
Count: 1
Stack: ...terface\AddOns\ElvUI_SpellRanks\ElvUI_SpellRanks.lua:161: attempt to index local 'player_unit_frame' (a nil value)
[string "=(tail call)"]: ?
[string "@Interface\AddOns\ElvUI_SpellRanks\ElvUI_SpellRanks.lua"]:161: in function <...terface\AddOns\ElvUI_SpellRanks\ElvUI_SpellRanks.lua:145>
[string "=[C]"]: ?
[string "@Interface\AddOns\ElvUI\Core\General\Core.lua"]:1763: in function `CallLoadFunc'
[string "@Interface\AddOns\ElvUI\Core\General\Core.lua"]:1778: in function `CallLoadedModule'
[string "@Interface\AddOns\ElvUI\Core\General\Core.lua"]:1804: in function `InitializeModules'
[string "@Interface\AddOns\ElvUI\Core\General\Core.lua"]:1907: in function `Initialize'
[string "@Interface\AddOns\ElvUI\Core\init.lua"]:168: in function <Interface\AddOns\ElvUI\Core\init.lua:167>
[string "=[C]"]: ?```
Hi,
I am not playing at the moment.
Can you please edit your issue with the wow build version you are using ?
I'll take a look.
Thanks.
This is probably due to ELvUI changing index strategy or its unit frames add on.
I should have a look to ElvUI's patch notes.
local player_unit_frame = UF["player"]
ok
I think I found the issue.
With ElvUI/BCC, it seems that the unit frames somewhat do not exist yet when spellranks tries to patch the cast bar.
try this (code commit coming):
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local ElvUI_Classic_CastBarSpellRanks = E:NewModule('ElvUI_Classic_CastBarSpellRanks', 'AceConsole-3.0', 'AceEvent-3.0', 'AceTimer-3.0');
local EP = LibStub("LibElvUIPlugin-1.0")
local addonName, addonTable = ... --See http://www.wowinterface.com/forums/showthread.php?t=51502&p=304704&postcount=2
local UF = E:GetModule('UnitFrames');
--[==[@debug@
local addon_version = "DEV_VERSION"
--@end-debug@]==]
--@non-debug@
local addon_version = "v0.0.005-1-g6ab215e"
--@end-non-debug@
local ORANGEY, LIGHTRED = '|cffFF4500', '|cffff6060'
--
local version, build, date, build_toc_version = GetBuildInfo()
local major_version = floor(build_toc_version / 10000)
--[====[@version-classic@
local MAX_SUPPORTED_VERSION = 19999
--@end-version-classic@]====]
--@version-bcc@
local MAX_SUPPORTED_VERSION = 20502
--@end-version-bcc@
local MAX_MAJOR_VERSION = floor(MAX_SUPPORTED_VERSION / 10000)
P["ElvUI_Classic_CastBarSpellRanks"] = {
["showRank"] = true,
}
E:RegisterModule(ElvUI_Classic_CastBarSpellRanks:GetName())
function ElvUI_Classic_CastBarSpellRanks:logger(message)
local s = format("|cff1784d1%s|r |cff00b3ff%s|cffff7d0a%s|r %s", "ElvUI", "Spell", "Rank", message)
if DLAPI then
DLAPI.DebugLog(addonName, s)
else
self:Print(s)
end
end
function ElvUI_Classic_CastBarSpellRanks:Update()
self:logger('Update')
if self.player_cast_bar then
self.player_cast_bar.showRank = E.db.ElvUI_Classic_CastBarSpellRanks.showRank
end
end
function ElvUI_Classic_CastBarSpellRanks:InsertOptions()
ElvUI_Classic_CastBarSpellRanks:logger("InsertOptions") -- using self triggers an error
E.Options.args.ElvUI_Classic_CastBarSpellRanks = {
order = 1000,
type = "group",
name = "|cff00b3ffSpell|r |cff00ffdaRank",
childGroups = "tab",
args = {
name = {
order = 1,
type = "header",
name = "Spell Rank in cast bar options",
},
desc = {
order = 2,
type = "description",
name = "",
},
credits = {
order = 3,
type = "group",
name = "Credits",
guiInline = true,
args = {
tukui = {
order = 1,
type = "description",
fontSize = "medium",
name = format("|cff9482c9LoneWanderer-GH|r"),
},
},
},
ShowRanks = {
order = 4,
type = "toggle",
name = "Show spell ranks",
get = function(info)
return E.db.ElvUI_Classic_CastBarSpellRanks.showRank
end,
set = function(info, value)
E.db.ElvUI_Classic_CastBarSpellRanks.showRank = value
ElvUI_Classic_CastBarSpellRanks:Update()
end,
}
},
}
end
local function CustomPostCastStart(self, unit)
--[==[@debug@
local plugin = self.ElvUI_Classic_CastBarSpellRanks
plugin:logger('custom UF:PostCastStart')
local spellRank = GetSpellSubtext(self.spellID)
plugin:logger(format('custom UF:PostCastStart - spell rank is %s', tostring(spellRank)))
--@end-debug@]==]
if self.showRank then
--@non-debug@
local spellRank = GetSpellSubtext(self.spellID)
--@end-non-debug@
if spellRank and spellRank ~= "" then
--[==[@debug@
plugin:logger("Changing spellname")
--@end-debug@]==]
self.Text:SetText(format("%s [%s]", self.Text:GetText(), spellRank))
-- changing also spellName since it is weirdly used by base ElvUI in conjunction with the showtarget option
self.spellName = format("%s [%s]", self.spellName, spellRank)
end
end
self:prev_post_cast_start(unit)
end
function ElvUI_Classic_CastBarSpellRanks:VersionCheck()
if build_toc_version > MAX_SUPPORTED_VERSION or (major_version < MAX_MAJOR_VERSION) then
print(format("!!! %sBEWARE %s!!!!", LIGHTRED, "|r"))
local addon_name_and_version_str = format("%s%s v%s", ORANGEY, addonName, addon_version)
local build_str = format("%sbuild|r %s", ORANGEY, build)
local date_str = format("%sdate|r %s", ORANGEY, date)
local version_nb_str = format("%sversion number|r %s", ORANGEY, build_toc_version)
print(format("%s hasn't been updated to support WoW v |r%s - %s - %s - %s",
addon_name_and_version_str, version, build_str, date_str, version_nb_str
))
print(format("%sPlease file any bugs you find @ |rhttps://github.com/LoneWanderer-GH/%s/issues", ORANGEY, addonName))
print(format("%sPlease be precise and provide as much intel as needed (PTR realm, release, beta etc.)", ORANGEY))
print(format("%sMax supported version is |r%s", ORANGEY, MAX_SUPPORTED_VERSION))
return false
end
return true
end
function ElvUI_Classic_CastBarSpellRanks:do_patch()
self:logger('do_patch')
if not self.patch_done then
self:logger('Finding player frame and castbar')
local player_unit_frame = UF.player
self.player_cast_bar = player_unit_frame.Castbar --castBar
self:logger('Saving previous UF:PostCastStart')
self.player_cast_bar.prev_post_cast_start = self.player_cast_bar.PostCastStart
self:logger('Patching UF:PostCastStart')
self.player_cast_bar.ElvUI_Classic_CastBarSpellRanks = self
self:logger('Do the patch')
self.player_cast_bar.PostCastStart = CustomPostCastStart
self:logger('Patching UF:PostCastStart --> DONE')
self.patch_done = true
self:logger('initialize rank display to false by default')
self.player_cast_bar.showRank = false
end
end
function ElvUI_Classic_CastBarSpellRanks:Initialize()
self:logger('Initialize')
local check = self:VersionCheck()
if check then
if not E.db.ElvUI_Classic_CastBarSpellRanks then
E.db.ElvUI_Classic_CastBarSpellRanks = {}
end
self.patch_done = false
EP:RegisterPlugin(addonName, self.InsertOptions)
self:Update()
self:ScheduleTimer(self.do_patch, 8, self)
else
end
end
Hello Sir!
I tested your solution and now everything works fine again. Really nice, thanks a lot for the fix!!
Good.
I have a beta version on rails for curseforge, I'll wait for some Beta users feedback before pushing it as release.
closed with release v0.0.008