Skip to content

Commit

Permalink
General Fixes for Retail and PTR 10.2
Browse files Browse the repository at this point in the history
- Fixed an issue with the healing merge amount on death tooltips.
- Added custom icons for damaging spells that are triggered by the amount of tier sets the player is wearing.
- Framework upgrade.
  • Loading branch information
Tercioo committed Sep 27, 2023
1 parent 387ed90 commit ce8dc1b
Show file tree
Hide file tree
Showing 10 changed files with 690 additions and 242 deletions.
15 changes: 15 additions & 0 deletions Libs/DF/definitions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,18 @@
---@field removeduplicate fun(tbl1:table, tbl2:table) remove the keys from table1 which also exists in table2 with the same value
---@field dump fun(tbl:table) : string dump a table to a string

---@alias templatetype
---| "font"
---| "dropdown"
---| "button"
---| "switch"
---| "slider"

---@class detailsframework
---@field OptionsFunctions df_optionsmixin
---@field RoundedCornerPanelMixin df_roundedcornermixin
---@field Schedules df_schedule
---@field HeaderFunctions df_headerfunctions
---@field Math df_math
---@field table df_table_functions
---@field Dispatch fun(self:table, callback:function, ...) : any dispatch a function call using xpcall
Expand Down Expand Up @@ -52,4 +60,11 @@
---@field CreateDropDown fun(self:table, parent:frame, func:function, default:any, width:number?, height:number?, member:string?, name:string?, template:table?) : df_dropdown
---@field CreateTextEntry fun(self:table, parent:frame, textChangedCallback:function, width:number, height:number, member:string?, name:string?, labelText:string?, textentryTemplate:table?, labelTemplate:table?) : df_textentry
---@field ReskinSlider fun(self:table, slider:frame)
---@field GetAvailableSpells fun(self:table) : table<spellid, boolean>
---@field NewColor fun(self:table, colorName:string, red:number, green:number, blue:number, alpha:number)
---@field CreateKeybindFrame fun(self:table, parent:frame, name:string?, options:table?, setKeybindCallback:function?, keybindData:table?) : df_keybindframe
---@field CreateStatusBar fun(self:table, parent:frame, options:table?) : frame
---@field CreateScrollBox fun(self:table, parent:frame, name:string, refreshFunc:function, data:table, width:number, height:number, lineAmount:number, lineHeight:number, createLineFunc:function?, autoAmount:boolean?, noScroll:boolean?) : df_scrollbox
---@field GetTemplate fun(self:table, templateType:templatetype, templateName:string) : table
---@field

116 changes: 114 additions & 2 deletions Libs/DF/fw.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


local dversion = 468
local dversion = 470
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary(major, minor)

Expand Down Expand Up @@ -1434,6 +1434,118 @@ function DF:GetSpellBookSpells()
return spellNamesInSpellBook, spellIdsInSpellBook
end

---return a table where keys are spellIds (number) and the value is true
---@return table<number, boolean>
function DF:GetAvailableSpells()
local completeListOfSpells = {}

--this line might not be compatible with classic
--local specId, specName, _, specIconTexture = GetSpecializationInfo(GetSpecialization())
--local classNameLoc, className, classId = UnitClass("player") --not in use
local locPlayerRace, playerRace, playerRaceId = UnitRace("player")

--get racials from the general tab
local generalTabIndex = 1
local tabName, tabTexture, offset, numSpells, isGuild, offspecId = GetSpellTabInfo(generalTabIndex)
offset = offset + 1
local tabEnd = offset + numSpells
for entryOffset = offset, tabEnd - 1 do
local spellType, spellId = GetSpellBookItemInfo(entryOffset, "player")
local spellData = LIB_OPEN_RAID_COOLDOWNS_INFO[spellId]
if (spellData) then
local raceId = spellData.raceid
if (raceId) then
if (type(raceId) == "table") then
if (raceId[playerRaceId]) then
spellId = C_SpellBook.GetOverrideSpell(spellId)
local spellName = GetSpellInfo(spellId)
local bIsPassive = IsPassiveSpell(spellId, "player")
if (spellName and not bIsPassive) then
completeListOfSpells[spellId] = true
end
end

elseif (type(raceId) == "number") then
if (raceId == playerRaceId) then
spellId = C_SpellBook.GetOverrideSpell(spellId)
local spellName = GetSpellInfo(spellId)
local bIsPassive = IsPassiveSpell(spellId, "player")
if (spellName and not bIsPassive) then
completeListOfSpells[spellId] = true
end
end
end
end
end
end

--get spells from the Spec spellbook
local amountOfTabs = GetNumSpellTabs()
for i = 2, amountOfTabs-1 do --starting at index 2 to ignore the general tab
local tabName, tabTexture, offset, numSpells, isGuild, offSpecId, shouldHide, specID = GetSpellTabInfo(i)
local bIsOffSpec = offSpecId ~= 0
offset = offset + 1
local tabEnd = offset + numSpells
for entryOffset = offset, tabEnd - 1 do
local spellType, spellId = GetSpellBookItemInfo(entryOffset, "player")
if (spellId) then
if (spellType == "SPELL") then
spellId = C_SpellBook.GetOverrideSpell(spellId)
local spellName = GetSpellInfo(spellId)
local bIsPassive = IsPassiveSpell(spellId, "player")
if (spellName and not bIsPassive) then
completeListOfSpells[spellId] = bIsOffSpec == false
end
end
end
end
end

--get class shared spells from the spell book
--[=[
local tabName, tabTexture, offset, numSpells, isGuild, offSpecId = GetSpellTabInfo(2)
local bIsOffSpec = offSpecId ~= 0
offset = offset + 1
local tabEnd = offset + numSpells
for entryOffset = offset, tabEnd - 1 do
local spellType, spellId = GetSpellBookItemInfo(entryOffset, "player")
if (spellId) then
if (spellType == "SPELL") then
spellId = C_SpellBook.GetOverrideSpell(spellId)
local spellName = GetSpellInfo(spellId)
local bIsPassive = IsPassiveSpell(spellId, "player")
if (spellName and not bIsPassive) then
completeListOfSpells[spellId] = bIsOffSpec == false
end
end
end
end
--]=]

local getNumPetSpells = function()
--'HasPetSpells' contradicts the name and return the amount of pet spells available instead of a boolean
return HasPetSpells()
end

--get pet spells from the pet spellbook
local numPetSpells = getNumPetSpells()
if (numPetSpells) then
for i = 1, numPetSpells do
local spellName, _, unmaskedSpellId = GetSpellBookItemName(i, "pet")
if (unmaskedSpellId) then
unmaskedSpellId = C_SpellBook.GetOverrideSpell(unmaskedSpellId)
local bIsPassive = IsPassiveSpell(unmaskedSpellId, "pet")
if (spellName and not bIsPassive) then
completeListOfSpells[unmaskedSpellId] = true
end
end
end
end

return completeListOfSpells
end


------------------------------------------------------------------------------------------------------------------------
--flash animation
Expand Down Expand Up @@ -4730,7 +4842,7 @@ end

--[=[
DF:CoreDispatch(func, context, ...)
safe call a function making a error window with what caused, the context and traceback of the error
safe call a function making an error window with what caused, context and traceback of the error
this func is only used inside the framework for sensitive calls where the func must run without errors
@func = the function which will be called
@context = what made the function be called
Expand Down
Loading

0 comments on commit ce8dc1b

Please sign in to comment.