Skip to content

Commit 9f77c4b

Browse files
committed
- Update API methods.
1 parent fa65ad0 commit 9f77c4b

File tree

2 files changed

+36
-11
lines changed

2 files changed

+36
-11
lines changed

Core/Regions/SpellAlert.lua

+35-6
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,12 @@ local FlipBooks = {
113113
},
114114
}
115115

116+
local FlipBook_List = {
117+
[0] = "None",
118+
["Classic"] = "Classic",
119+
["Thin"] = "Thin",
120+
}
121+
116122
----------------------------------------
117123
-- Utility
118124
---
@@ -417,6 +423,7 @@ hooksecurefunc("ActionButton_ShowOverlayGlow", UpdateSpellAlert)
417423
-- Core
418424
---
419425

426+
Core.FlipBook_List = FlipBook_List
420427
Core.UpdateSpellAlert = UpdateSpellAlert
421428

422429
----------------------------------------
@@ -486,8 +493,13 @@ end
486493
---
487494

488495
-- Adds a custom FlipBook style.
489-
function API:AddSpellAlertFlipBook(Shape, Data)
490-
if type(Shape) ~= "string" or FlipBooks[Shape] then
496+
function API:AddSpellAlertFlipBook(Style, Shape, Data)
497+
if type(Style) ~= "string" then
498+
if Core.Debug then
499+
error("Bad argument to API method 'AddSpellAlertFlipBook'. 'Shape' must be a unique string.", 2)
500+
end
501+
return
502+
elseif type(Shape) ~= "string" then
491503
if Core.Debug then
492504
error("Bad argument to API method 'AddSpellAlertFlipBook'. 'Shape' must be a unique string.", 2)
493505
end
@@ -499,17 +511,34 @@ function API:AddSpellAlertFlipBook(Shape, Data)
499511
return
500512
end
501513

502-
FlipBooks[Shape] = Data
514+
local Style_Data = FlipBooks[Style] or {}
515+
516+
if Style_Data[Shape] then
517+
if Core.Debug then
518+
error("Bad argument to API method 'AddSpellAlertFlipBook'. A style for this shape already exists.", 2)
519+
end
520+
return
521+
end
522+
523+
FlipBooks[Style][Shape] = Data
524+
FlipBook_List[Style] = FlipBook_List[Style] or Style
503525
end
504526

505527
-- Returns a FlipBook style table.
506-
function API:GetSpellAlertFlipBook(Shape)
507-
if type(Shape) ~= "string" then
528+
function API:GetSpellAlertFlipBook(Style, Shape)
529+
if type(Style) ~= "string" then
530+
if Core.Debug then
531+
error("Bad argument to API method 'GetSpellAlertFlipBook'. 'Style' must be a string.", 2)
532+
end
533+
return
534+
elseif type(Shape) ~= "string" then
508535
if Core.Debug then
509536
error("Bad argument to API method 'GetSpellAlertFlipBook'. 'Shape' must be a string.", 2)
510537
end
511538
return
512539
end
513540

514-
return FlipBooks[Shape]
541+
local Style_Data = FlipBooks[Style]
542+
543+
return Style_Data and Style_Data[Shape]
515544
end

Options/General.lua

+1-5
Original file line numberDiff line numberDiff line change
@@ -275,11 +275,7 @@ function Setup.General(self)
275275
type = "select",
276276
name = L["Spell Alert Style"],
277277
desc = L["Select the spell alert style."]..Reload,
278-
values = {
279-
[0] = L["None"],
280-
["Classic"] = L["Classic"],
281-
["Thin"] = L["Thin"],
282-
},
278+
values = Core.FlipBook_List,
283279
order = 2,
284280
},
285281
},

0 commit comments

Comments
 (0)