Skip to content

Commit

Permalink
Changed the health on death logs to be live percent (health % at hit …
Browse files Browse the repository at this point in the history
…moment), was before health amount divided by default character life amount
  • Loading branch information
Tercioo committed Jul 29, 2024
1 parent 1c94c0e commit 6a4935d
Show file tree
Hide file tree
Showing 17 changed files with 620 additions and 123 deletions.
2 changes: 1 addition & 1 deletion Libs/DF/button.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1332,7 +1332,7 @@ detailsFramework.TabButtonMixin = {
---@return df_tabbutton
function detailsFramework:CreateTabButton(parent, frameName)
---@type df_tabbutton
local tabButton = CreateFrame("button", frameName, parent)
local tabButton = CreateFrame("button", frameName, parent, "BackdropTemplate")
tabButton:SetSize(50, 20)
tabButton.bIsSelected = false

Expand Down
1 change: 1 addition & 0 deletions Libs/DF/definitions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@
---@field UnitGroupRolesAssigned fun(unitId: unit, bUseSupport:boolean?, specId: specializationid?) : string there's no self here
---@field IsDragonflight fun():boolean
---@field IsDragonflightAndBeyond fun():boolean
---@field IsDragonflightOrBelow fun():boolean
---@field IsTimewalkWoW fun():boolean
---@field IsClassicWow fun():boolean
---@field IsTBCWow fun():boolean
Expand Down
21 changes: 15 additions & 6 deletions Libs/DF/fw.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


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

Expand Down Expand Up @@ -113,7 +113,13 @@ end
---return if the wow version the player is playing is dragonflight or an expansion after it
---@return boolean
function DF.IsDragonflightAndBeyond()
return select(4, GetBuildInfo()) >= 100000
return 110000 >= 100000
end

---return true if the wow version is Dragonflight or below
---@return boolean
function DF.IsDragonflightOrBelow()
return 110000 < 110000
end

---return if the wow version the player is playing is a classic version of wow
Expand Down Expand Up @@ -2795,6 +2801,9 @@ local templateOnLeave = function(frame)
end
end

DF.TemplateOnEnter = templateOnEnter
DF.TemplateOnLeave = templateOnLeave

---set a details framework template into a regular frame
---@param self table
---@param frame uiobject
Expand Down Expand Up @@ -2920,10 +2929,10 @@ DF.dropdown_templates["OPTIONS_DROPDOWN_TEMPLATE"] = {
tile = true
},

backdropcolor = {1, 1, 1, .7},
backdropbordercolor = {0, 0, 0, 1},
onentercolor = {1, 1, 1, .9},
onenterbordercolor = {1, 1, 1, 1},
backdropcolor = {0.1, 0.1, 0.1, .7},
onentercolor = {0.3, 0.3, 0.3, .7},
backdropbordercolor = {0, 0, 0, .7},
onenterbordercolor = {0.3, 0.3, 0.3, 0.8},

dropicon = "Interface\\BUTTONS\\arrow-Down-Down",
dropiconsize = {16, 16},
Expand Down
22 changes: 22 additions & 0 deletions Libs/DF/schedules.lua
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,28 @@ function detailsFramework.Schedules.AfterById(time, callback, id, ...)
return newTimer
end

--Schedules a callback function to be executed after a specified time delay.
--It uniquely identifies each scheduled task by an ID, if another schedule with the same id is made, it will be ignore until the previous one is finished.
function detailsFramework.Schedules.AfterByIdNoCancel(time, callback, id, ...)
if (not detailsFramework.Schedules.ExecuteTimerTableNoCancel) then
detailsFramework.Schedules.ExecuteTimerTableNoCancel = {}
end

local alreadyHaveTimer = detailsFramework.Schedules.ExecuteTimerTableNoCancel[id]
if (alreadyHaveTimer) then
return
end

local newTimer = detailsFramework.Schedules.NewTimer(time, callback, ...)
detailsFramework.Schedules.ExecuteTimerTableNoCancel[id] = newTimer

C_Timer.After(time, function()
detailsFramework.Schedules.ExecuteTimerTableNoCancel[id] = nil
end)

return newTimer
end

--schedule a function to be called after 'time'
--prompt example: create a schedule that runs the function 'variable name' after 'time' amount of seconds
function detailsFramework.Schedules.After(time, callback)
Expand Down
41 changes: 40 additions & 1 deletion Libs/DF/textentry.lua
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,12 @@ detailsFramework.TextEntryCounter = detailsFramework.TextEntryCounter or 1

if (textentry:IsEnabled()) then
textentry.current_bordercolor = textentry.current_bordercolor or {textentry:GetBackdropBorderColor()}
textentry:SetBackdropBorderColor(1, 1, 1, 1)
local onEnterBorderColor = object.onenter_backdrop_border_color
if (onEnterBorderColor) then
textentry:SetBackdropBorderColor(detailsFramework:ParseColors(onEnterBorderColor))
else
textentry:SetBackdropBorderColor(1, 1, 1, 0.6)
end
end
end

Expand Down Expand Up @@ -522,11 +527,13 @@ function TextEntryMetaFunctions:SetTemplate(template)
if (template.backdrop) then
self.editbox:SetBackdrop(template.backdrop)
end

if (template.backdropcolor) then
local r, g, b, a = detailsFramework:ParseColors(template.backdropcolor)
self.editbox:SetBackdropColor(r, g, b, a)
self.onleave_backdrop = {r, g, b, a}
end

if (template.backdropbordercolor) then
local r, g, b, a = detailsFramework:ParseColors(template.backdropbordercolor)
self.editbox:SetBackdropBorderColor(r, g, b, a)
Expand All @@ -536,8 +543,40 @@ function TextEntryMetaFunctions:SetTemplate(template)
self.editbox.current_bordercolor[4] = a
self.onleave_backdrop_border_color = {r, g, b, a}
end

if (template.onentercolor) then
local r, g, b, a = detailsFramework:ParseColors(template.onentercolor)
self.onenter_backdrop = {r, g, b, a}
self:HookScript("OnEnter", detailsFramework.TemplateOnEnter)
self.__has_onentercolor_script = true
end

if (template.onleavecolor) then
local r, g, b, a = detailsFramework:ParseColors(template.onleavecolor)
self.onleave_backdrop = {r, g, b, a}
self:HookScript("OnLeave", detailsFramework.TemplateOnLeave)
self.__has_onleavecolor_script = true
end

if (template.onenterbordercolor) then
local r, g, b, a = detailsFramework:ParseColors(template.onenterbordercolor)
self.onenter_backdrop_border_color = {r, g, b, a}
if (not self.__has_onentercolor_script) then
self:HookScript("OnEnter", detailsFramework.TemplateOnEnter)
end
end

if (template.onleavebordercolor) then
local r, g, b, a = detailsFramework:ParseColors(template.onleavebordercolor)
self.onleave_backdrop_border_color = {r, g, b, a}
if (not self.__has_onleavecolor_script) then
self:HookScript("OnLeave", detailsFramework.TemplateOnLeave)
end
end
end

--TextEntryMetaFunctions.SetTemplate = DetailsFramework.SetTemplate

------------------------------------------------------------------------------------------------------------
--object constructor

Expand Down
83 changes: 82 additions & 1 deletion Libs/LibOpenRaid/GetPlayerInformation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1055,4 +1055,85 @@ openRaidLib.specAttribute = {
[1468] = 1, --Preservation
[1473] = 1, --Augmentation
},
}
}


function openRaidLib.Util.GetPlayerSpellList()
local completeListOfSpells = {}
local specId, specName, _, specIconTexture = GetSpecializationInfo(GetSpecialization())
local locPlayerRace, playerRace, playerRaceId = UnitRace("player")
local generalIndex = Enum.SpellBookSkillLineIndex and Enum.SpellBookSkillLineIndex.General or CONST_SPELLBOOK_GENERAL_TABID
local tabName, tabTexture, offset, numSpells, isGuild, offspecId = GetSpellTabInfo(generalIndex) --CONST_SPELLBOOK_GENERAL_TABID

if (not offset) then
return completeListOfSpells
end

offset = offset + 1

--get spells from the Spec spellbook
for i = 1, GetNumSpellTabs() do --called "lines" in new v11 api
local tabName, tabTexture, offset, numSpells, isGuild, offspecId = GetSpellTabInfo(i)
if (tabTexture == specIconTexture) then
print("running?")
offset = offset + 1
local tabEnd = offset + numSpells
for entryOffset = offset, tabEnd - 1 do
local spellType, spellId = GetSpellBookItemInfo(entryOffset, spellBookPlayerEnum)
if (spellId) then
if (spellType == "SPELL" or spellType == 1) then
--print(tabName, tabTexture == specIconTexture, offset, tabEnd,spellType, spellId)
spellId = GetOverrideSpell(spellId)
local spellName = GetSpellInfo(spellId)
local bIsPassive = IsPassiveSpell(entryOffset, spellBookPlayerEnum)
if (spellName and not bIsPassive) then
completeListOfSpells[spellId] = true
end
end
end
end
end
end

--get class shared spells from the spell book
local tabName, tabTexture, offset, numSpells, isGuild, offspecId = GetSpellTabInfo(CONST_SPELLBOOK_CLASSSPELLS_TABID)
offset = offset + 1
local tabEnd = offset + numSpells
for entryOffset = offset, tabEnd - 1 do
local spellType, spellId = GetSpellBookItemInfo(entryOffset, spellBookPlayerEnum)
if (spellId) then
if (spellType == "SPELL" or spellType == 1) then
spellId = GetOverrideSpell(spellId)
local spellName = GetSpellInfo(spellId)
local bIsPassive = IsPassiveSpell(entryOffset, spellBookPlayerEnum)

if (spellName and not bIsPassive) then
completeListOfSpells[spellId] = true
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, spellBookPetEnum)
if (unmaskedSpellId) then
unmaskedSpellId = GetOverrideSpell(unmaskedSpellId)
local bIsPassive = IsPassiveSpell(i, spellBookPetEnum)
if (spellName and not bIsPassive) then
completeListOfSpells[unmaskedSpellId] = true
end
end
end
end

--dumpt(completeListOfSpells)
return completeListOfSpells
end
2 changes: 2 additions & 0 deletions Libs/LibOpenRaid/LibOpenRaid.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ end
openRaidLib.inGroup = false
openRaidLib.UnitIDCache = {}

openRaidLib.Util = openRaidLib.Util or {}

local CONST_CVAR_TEMPCACHE = "LibOpenRaidTempCache"
local CONST_CVAR_TEMPCACHE_DEBUG = "LibOpenRaidTempCacheDebug"

Expand Down
6 changes: 3 additions & 3 deletions boot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
local addonName, Details222 = ...
local version, build, date, tvs = GetBuildInfo()

Details.build_counter = 12819
Details.alpha_build_counter = 12819 --if this is higher than the regular counter, use it instead
Details.build_counter = 12820
Details.alpha_build_counter = 12820 --if this is higher than the regular counter, use it instead
Details.dont_open_news = true
Details.game_version = version
Details.userversion = version .. " " .. Details.build_counter
Details.realversion = 158 --core version, this is used to check API version for scripts and plugins (see alias below)
Details.realversion = 159 --core version, this is used to check API version for scripts and plugins (see alias below)
Details.gametoc = tvs
Details.APIVersion = Details.realversion --core version
Details.version = Details.userversion .. " (core " .. Details.realversion .. ")" --simple stirng to show to players
Expand Down
19 changes: 19 additions & 0 deletions classes/class_combat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,25 @@ local segmentTypeToString = {
end
end

function classCombat:CutDeathByTime(time)
local deathsTable = self:GetDeaths()
for i = #deathsTable, 1, -1 do
local deathTable = deathsTable[i]
local playerName, playerClass, deathTime, deathCombatTime, deathTimeString, playerMaxHealth, deathEvents, lastCooldown, spec = Details:UnpackDeathTable(deathTable)
for evIndex = 1, #deathEvents do
local event = deathEvents[evIndex]
local evType = event[1]
if (type(evType) == "boolean") then
local eventTime = event[4]
print(eventTime, deathTime)
if (eventTime+10 < deathTime) then
print("this event is ignored, and should be removed", event[1])
end
end
end
end
end

--return the total of a specific attribute
local power_table = {0, 1, 3, 6, 0, "alternatepower"}

Expand Down
7 changes: 4 additions & 3 deletions classes/class_utility.lua
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,9 @@ function Details.ShowDeathTooltip(instance, lineFrame, combatObject, deathTable)

--death parser
for i, event in ipairs(events) do
local currentHP = event[5]
local healthPercent = floor(currentHP / maxHP * 100)
--local currentHP = event[5] * 100
--local healthPercent = floor(currentHP / maxHP * 100)
local healthPercent = floor(event[5] * 100)
if (healthPercent > 100) then
healthPercent = 100
end
Expand All @@ -226,7 +227,7 @@ function Details.ShowDeathTooltip(instance, lineFrame, combatObject, deathTable)
local eventTime = event[4]
local source = Details:GetOnlyName(event[6] or "")

if (eventTime + 12 > timeOfDeath) then
if (eventTime + 10 > timeOfDeath) then
if (type(evType) == "boolean") then
--is damage or heal?
if (evType) then --bool true
Expand Down
2 changes: 1 addition & 1 deletion core/control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@
currentCombat:SetDateToNow(bSetStartTime, bSetEndTime)
currentCombat:SetEndTime(GetTime())

--drop last events table to garbage collector
--drop player last events table to garbage collector
currentCombat.player_last_events = {}

--flag instance type
Expand Down
Loading

0 comments on commit 6a4935d

Please sign in to comment.