Skip to content

Commit

Permalink
show "one hour buffs" if they aren't 100% uptime.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Jul 22, 2024
1 parent 4832029 commit 237d54b
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 7 deletions.
25 changes: 24 additions & 1 deletion Libs/DF/cooltip.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ end

--api locals
local PixelUtil = PixelUtil or DFPixelUtil
local version = 25
local version = 26

local CONST_MENU_TYPE_MAINMENU = "main"
local CONST_MENU_TYPE_SUBMENU = "sub"
Expand Down Expand Up @@ -345,6 +345,13 @@ function DF:CreateCoolTip()
DF:SetFontSize(self.titleText, 10)
self.titleText:SetPoint("CENTER", self.titleIcon, "CENTER", 0, 6)
end

if (not self.modelFrame) then
self.modelFrame = CreateFrame("PlayerModel", "$parent_ModelFrame", self)
self.modelFrame:SetPoint("topleft", self, "topleft", 5, -5)
self.modelFrame:SetPoint("bottomright", self, "bottomright", -5, 5)
self.modelFrame:Hide()
end
end

--main frame
Expand Down Expand Up @@ -2766,6 +2773,9 @@ function DF:CreateCoolTip()
gameCooltip.Banner[2] = false
gameCooltip.Banner[3] = false

frame1.modelFrame:Hide()
frame2.modelFrame:Hide()

frame1.upperImage:Hide()
frame1.upperImage2:Hide()
frame1.upperImageText:Hide()
Expand Down Expand Up @@ -3051,6 +3061,19 @@ function DF:CreateCoolTip()
frame1.frameWallpaper:Hide()
frame2.frameWallpaper:Hide()

function gameCooltip:SetNpcModel(menuType, npcId)
menuType = gameCooltip:ParseMenuType(menuType)

if (menuType == CONST_MENU_TYPE_MAINMENU) then
frame1.modelFrame:Show()
frame1.modelFrame:SetCreature(npcId)

elseif (menuType == CONST_MENU_TYPE_SUBMENU) then
frame2.modelFrame:Show()
frame2.modelFrame:SetCreature(npcId)
end
end

---set an image as wallpaper for the cooltip frame
---@param menuType any
---@param texture any
Expand Down
2 changes: 1 addition & 1 deletion Libs/DF/fw.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


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

Expand Down
1 change: 1 addition & 0 deletions boot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@
}

Details222.IgnoredWorldAuras = {}
Details222.OneHourAuras = {}

Details222.Parser = {}

Expand Down
24 changes: 20 additions & 4 deletions classes/class_utility.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1555,7 +1555,10 @@ function Details:CatchRaidBuffUptime(sOperationType) -- ~scan
local auraInfo = C_UnitAuras.GetAuraDataByIndex(unitId, buffIndex, "HELPFUL")
if (auraInfo) then
local auraName, unitCaster, spellId = auraInfo.name, auraInfo.sourceUnit, auraInfo.spellId
if (unitCaster and UnitExists(unitCaster) and UnitExists(unitId) and UnitIsUnit(unitCaster, unitId) and auraInfo.duration ~= 3600) then
if (unitCaster and UnitExists(unitCaster) and UnitExists(unitId) and UnitIsUnit(unitCaster, unitId)) then
if (auraInfo.duration == 3600) then
Details222.OneHourAuras[spellId] = true
end
Details.parser:add_buff_uptime(nil, cacheGetTime, playerGUID, playerName, 0x00000514, playerGUID, playerName, 0x00000514, 0x0, spellId, auraName, sOperationType)
if (sOperationType == "BUFF_UPTIME_IN") then
if (Details.PotionList[spellId]) then
Expand Down Expand Up @@ -1622,7 +1625,11 @@ function Details:CatchRaidBuffUptime(sOperationType) -- ~scan

elseif (bUnitIsTheCaster) then
local playerGUID = UnitGUID(unitId)
if (playerGUID and auraInfo.duration ~= 3600) then
if (playerGUID) then
if (auraInfo.duration == 3600) then
Details222.OneHourAuras[spellId] = true
end

local playerName = Details:GetFullName(unitId)
if (sOperationType == "BUFF_UPTIME_IN") then
if (Details.PotionList[spellId]) then
Expand Down Expand Up @@ -1669,7 +1676,11 @@ function Details:CatchRaidBuffUptime(sOperationType) -- ~scan
else
local playerName = Details:GetFullName(unitId)
local playerGUID = UnitGUID(unitId)
if (playerGUID and auraInfo.duration ~= 3600) then
if (playerGUID) then
if (auraInfo.duration == 3600) then
Details222.OneHourAuras[spellId] = true
end

if (sOperationType == "BUFF_UPTIME_IN") then
if (Details.PotionList[spellId]) then
potUsage [playerName] = spellId
Expand Down Expand Up @@ -1718,7 +1729,12 @@ function Details:CatchRaidBuffUptime(sOperationType) -- ~scan
if (auraName and unitCaster and UnitExists(unitCaster) and UnitIsUnit(unitCaster, "player")) then
local playerName = Details.playername
local playerGUID = UnitGUID("player")
if (playerGUID and auraInfo.duration ~= 3600) then --1hr buffs
if (playerGUID) then
if (auraInfo.duration == 3600) then --1hr buffs, record auras which has 1 hr of duration, hence they can be checked for 100% at the end of the combat
Details222.OneHourAuras[spellId] = true
print("1 hour buff:", spellId)
end

if (sOperationType == "BUFF_UPTIME_IN") then
if (Details.PotionList[spellId]) then
pot_usage[playerName] = spellId
Expand Down
30 changes: 29 additions & 1 deletion core/aura_scan.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,35 @@ function AuraScan.FindAndIgnoreWorldAuras()
end
end


function AuraScan.CheckForOneHourBuffs()
---@type combat
local currentCombat = Details:GetCurrentCombat()
---@type actorcontainer
local utilityContainer = currentCombat:GetContainer(DETAILS_ATTRIBUTE_MISC)
---@type combattime
local combatTime = floor(currentCombat:GetCombatTime())

for _, utilityActor in utilityContainer:ListActors() do
---@cast utilityActor actorutility
if (utilityActor:IsPlayer()) then
--get the buff container
---@type spellcontainer
local buffUptimeContainer = utilityActor.buff_uptime_spells
if (buffUptimeContainer) then
for spellId, spellTable in buffUptimeContainer:ListSpells() do
---@cast spellTable spelltable
if (Details222.OneHourAuras[spellId]) then
--is this buff have 100% uptime?
if (spellTable.uptime == combatTime) then
utilityActor.buff_uptime = utilityActor.buff_uptime - spellTable.uptime
utilityActor.buff_uptime_spells._ActorTable[spellId] = nil
end
end
end
end
end
end
end

function AuraScan.RegisterCallback(callback)
AuraScan.Callbacks[callback] = true
Expand Down
1 change: 1 addition & 0 deletions core/control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,7 @@
Details:CatchRaidBuffUptime("BUFF_UPTIME_OUT")
Details:CatchRaidDebuffUptime("DEBUFF_UPTIME_OUT")
Details:CloseEnemyDebuffsUptime()
Details222.AuraScan.CheckForOneHourBuffs()

Details222.GuessSpecSchedules.ClearSchedules()

Expand Down

0 comments on commit 237d54b

Please sign in to comment.