Skip to content

Commit

Permalink
Fix per-spec settings
Browse files Browse the repository at this point in the history
GetActiveSpecGroup() now just always returns 1. Instead we want to use
the index of the active specialization. This does mean that
previously-saved per-spec settings will now potentially apply to the
wrong spec, but there's not much we can do about that.
  • Loading branch information
lilyball committed Aug 5, 2016
1 parent 9bcc62a commit 3712a58
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions Cork.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ ae.RegisterEvent("Cork", "ADDON_LOADED", function(event, addon)
if addon:lower() ~= "cork" then return end

CorkDB = setmetatable(CorkDB or {}, {__index = defaults})
CorkDBPC = CorkDBPC or {{},{}}
if not CorkDBPC[1] then CorkDBPC = {CorkDBPC, {}} end
CorkDBPC = CorkDBPC or {{},{},{},{}}
if not CorkDBPC[1] then CorkDBPC = {CorkDBPC, {}, {}, {}} end
for _, i in ipairs({2,3,4}) do
if not CorkDBPC[i] then CorkDBPC[i] = {} end
end
Cork.db = CorkDB

anchor:SetPoint(Cork.db.point, Cork.db.x, Cork.db.y)
Expand All @@ -35,19 +38,19 @@ end)

local meta = {__index = Cork.defaultspc}
ae.RegisterEvent("Cork", "PLAYER_LOGIN", function()
local lastgroup = GetActiveSpecGroup()
Cork.dbpc = setmetatable(CorkDBPC[lastgroup], meta)
local lastspec = GetSpecialization()
Cork.dbpc = setmetatable(CorkDBPC[lastspec], meta)

for _,dataobj in pairs(Cork.sortedcorks) do if dataobj.Init then dataobj:Init() end end
for _,dataobj in pairs(Cork.sortedcorks) do dataobj:Scan() end

ae.RegisterEvent("Cork", "ZONE_CHANGED_NEW_AREA", Cork.Update)
ae.RegisterEvent("Cork", "PLAYER_TALENT_UPDATE", function()
if lastgroup == GetActiveSpecGroup() then return end
if lastspec == GetSpecialization() then return end

lastgroup = GetActiveSpecGroup()
lastspec = GetSpecialization()
for i,v in pairs(Cork.defaultspc) do if Cork.dbpc[i] == v then Cork.dbpc[i] = nil end end
Cork.dbpc = setmetatable(CorkDBPC[lastgroup], meta)
Cork.dbpc = setmetatable(CorkDBPC[lastspec], meta)

if Cork.config.Update then Cork.config:Update() end
for name,dataobj in pairs(Cork.corks) do if dataobj.Init then dataobj:Init() end end
Expand Down

3 comments on commit 3712a58

@tekkub
Copy link
Member

@tekkub tekkub commented on 3712a58 Aug 7, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's so few per-spec things now, I want to eventually default to per-char settings, and make per-spec something a module has to choose to use.

But effort... feeeeh

@lilyball
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greater Blessings are definitely per-spec. Holy doesn't even have them. I have no idea if prot does. Ideally Cork would recognize that Holy doesn't have them and only offer it as a per-char setting that only takes effect if the current spec offers it, but I'm not aware offhand if precedent for that sort of behavior so I jury copied the existing behavior for self and raid buffers.

@tekkub
Copy link
Member

@tekkub tekkub commented on 3712a58 Aug 8, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah but there's the fun bit, it's Ret-only now. So other specs won't have a different config, they'll just disable since the spells aren't available to them.

Honestly, even in the old specs, the majority of buffs available to multiple specs of the same class would have the same config (I always want Mark and Fort and ArcInt (except warriors and rogues lolol))... Paladin's "I'm a pretty and unique butterfly!" buffs were the exception (before normalizing raid buffs). These days? Fuck it all ^^

Anyway, true per-char settings is a dream really, I sorta doubt I'll get the bug up my ass to completely rewrite that stuff anytime soon, if ever.

Please sign in to comment.