Skip to content

Commit

Permalink
A round of general bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Aug 16, 2024
1 parent cf7a348 commit 7177232
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 29 deletions.
7 changes: 5 additions & 2 deletions core/control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -437,9 +437,11 @@
end

function Details:ScheduleSyncPlayerActorData()
--do not sync if in battleground or arena
if ((IsInGroup() or IsInRaid()) and (Details.zone_type == "party" or Details.zone_type == "raid")) then
--do not sync if in battleground or arena
Details:SendCharacterData()
--do a random delay
local delay = RandomFloatInRange(1, 4)
C_Timer.After(delay, Details.SendCharacterData)
end
end

Expand Down Expand Up @@ -1354,6 +1356,7 @@
GameCooltip:SetOption("TextColor", Details.tooltip.fontcolor)
GameCooltip:SetOption("TextColorRight", Details.tooltip.fontcolor_right)
GameCooltip:SetOption("TextShadow", Details.tooltip.fontshadow and "OUTLINE")
GameCooltip:SetOption("TextContour", Details.tooltip.fontcontour)

GameCooltip:SetOption("LeftBorderSize", -0) --offset between the left border and the left icon, default: 10 + offset
GameCooltip:SetOption("RightBorderSize", 0) --offset between the right border and the right icon, default: -10 + offset
Expand Down
34 changes: 21 additions & 13 deletions core/gears.lua
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,16 @@ Details222.Parser.EventFrame:SetScript("OnEvent", function(self, event, ...)
end
end)

--create a details listener which registers the combat enter event, create the function to receive the registerted event ad call the Details222.Parser.EventFrame:OnEvent with player_regen_disable
local detailsEnterInCombatListener = Details:CreateEventListener()
detailsEnterInCombatListener:RegisterEvent("COMBAT_PLAYER_ENTER") --COMBAT_PLAYER_ENTER from events.lua, this event is triggered when Details! enter in combat
function detailsEnterInCombatListener:OnEvent()
if (Details222.Parser.GetState() == "STATE_RESTRICTED") then
Details222.Parser.EventFrame:GetScript("OnEvent")(Details222.Parser.EventFrame, "PLAYER_REGEN_DISABLED")
end
end


function Details222.Parser.GetState()
local parserEngine = Details222.parser_frame:GetScript("OnEvent")
if (parserEngine == Details222.Parser.OnParserEvent) then
Expand Down Expand Up @@ -2175,7 +2185,7 @@ local MAX_INSPECT_AMOUNT = 1
local MIN_ILEVEL_TO_STORE = 50
local LOOP_TIME = 7

function Details:IlvlFromNetwork(player, realm, core, serialNumber, itemLevel, talentsSelected, currentSpec)
function Details:IlvlFromNetwork(unitName, realmName, coreVersion, unitGUID, itemLevel, talentsSelected, currentSpec)
if (Details.debug and false) then
local talents = "Invalid Talents"
if (type(talentsSelected) == "table") then
Expand All @@ -2184,44 +2194,44 @@ function Details:IlvlFromNetwork(player, realm, core, serialNumber, itemLevel, t
talents = talents .. talentsSelected [i] .. ","
end
end
Details222.DebugMsg("Received PlayerInfo Data: " ..(player or "Invalid Player Name") .. " | " ..(itemLevel or "Invalid Item Level") .. " | " ..(currentSpec or "Invalid Spec") .. " | " .. talents .. " | " ..(serialNumber or "Invalid Serial"))
Details222.DebugMsg("Received PlayerInfo Data: " ..(unitName or "Invalid Player Name") .. " | " ..(itemLevel or "Invalid Item Level") .. " | " ..(currentSpec or "Invalid Spec") .. " | " .. talents .. " | " ..(unitGUID or "Invalid Serial"))
end

if (not player) then
if (not unitName) then
return
end

--older versions of details wont send serial nor talents nor spec
if (not serialNumber or not itemLevel or not talentsSelected or not currentSpec) then
if (not unitGUID or not itemLevel or not talentsSelected or not currentSpec) then
--if any data is invalid, abort
return
end

--won't inspect this actor
Details.trusted_characters[serialNumber] = true
Details.trusted_characters[unitGUID] = true

if (type(serialNumber) ~= "string") then
if (type(unitGUID) ~= "string") then
return
end

--store the item level
if (type(itemLevel) == "number") then
Details.item_level_pool[serialNumber] = {name = player, ilvl = itemLevel, time = time()}
Details.item_level_pool[unitGUID] = {name = unitName, ilvl = itemLevel, time = time()}
end

--store talents
if (type(talentsSelected) == "table") then
if (talentsSelected[1]) then
Details.cached_talents[serialNumber] = talentsSelected
Details.cached_talents[unitGUID] = talentsSelected
end

elseif (type(talentsSelected) == "string" and talentsSelected ~= "") then
Details.cached_talents[serialNumber] = talentsSelected
Details.cached_talents[unitGUID] = talentsSelected
end

--store the spec the player is playing
if (type(currentSpec) == "number") then
Details.cached_specs[serialNumber] = currentSpec
Details.cached_specs[unitGUID] = currentSpec
end
end

Expand Down Expand Up @@ -2574,9 +2584,7 @@ function ilvl_core:ZoneChanged(zone_type)
end

function ilvl_core:OnEnter()
if (IsInRaid()) then
Details:SendCharacterData()
end
Details:SendCharacterData()

if (can_start_loop()) then
ilvl_core:Reset()
Expand Down
2 changes: 1 addition & 1 deletion core/network.lua
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
end

--vertical, horizonal tree
if (DetailsFramework.IsDragonflight()) then
if (DetailsFramework.IsDragonflightAndBeyond()) then
talentsAsString = detailsFramework:GetDragonlightTalentString()
end

Expand Down
29 changes: 18 additions & 11 deletions core/parser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -941,8 +941,7 @@
end
end

--local spellInfo = C_Spell.GetSpellInfo(spellId)
--print("1 spell:", spellId, spellInfo.name)
local spellInfo = C_Spell.GetSpellInfo(spellId)
Details222.StartCombat(sourceSerial, sourceName, sourceFlags, targetSerial, targetName, targetFlags)
else
--entrar em combate se for dot e for do jogador e o ultimo combate ter sido a mais de 10 segundos atr�s
Expand All @@ -953,7 +952,6 @@

--can't start a combat with a dot with the latest combat finished less than 10 seconds ago
if (Details.last_combat_time + 10 < _tempo) then
--print("2 spell:", spellId)
Details222.StartCombat(sourceSerial, sourceName, sourceFlags, targetSerial, targetName, targetFlags)
end
end
Expand Down Expand Up @@ -1186,22 +1184,25 @@
thisEvent[3] = amount --amount of damage or healing
thisEvent[4] = time --parser time

--current unit heal
--current unit healh
if (targetActor.arena_enemy) then
--this is an arena enemy, get the heal with the unit Id
local unitId = Details.arena_enemies[targetName]
if (not unitId) then
unitId = Details:GuessArenaEnemyUnitId(targetName)
end

if (unitId) then
thisEvent[5] = UnitHealth(unitId) / UnitHealthMax(unitId)
local health = UnitHealth(unitId)
local maxHealth = max(UnitHealthMax(unitId), SMALL_FLOAT)
thisEvent[5] = health / maxHealth
else
thisEvent[5] = cacheAnything.arenaHealth[targetName] or 100000
end

cacheAnything.arenaHealth[targetName] = thisEvent[5]
else
thisEvent[5] = UnitHealth(targetName) / UnitHealthMax(targetName)
thisEvent[5] = UnitHealth(targetName) / max(UnitHealthMax(targetName), SMALL_FLOAT)
end

thisEvent[6] = sourceName --source name
Expand Down Expand Up @@ -1302,7 +1303,7 @@
thisEvent[2] = spellId --spellid || false if this is a battle ress line
thisEvent[3] = amount --amount of damage or healing
thisEvent[4] = time --parser time
thisEvent[5] = UnitHealth(targetName) / UnitHealthMax(targetName) --current unit heal
thisEvent[5] = UnitHealth(targetName) / max(UnitHealthMax(targetName), SMALL_FLOAT) --current unit heal
thisEvent[6] = sourceName --source name
thisEvent[7] = absorbed
thisEvent[8] = spellType or school
Expand Down Expand Up @@ -2662,12 +2663,12 @@
unitId = Details:GuessArenaEnemyUnitId(targetName)
end
if (unitId) then
thisEvent[5] = UnitHealth(unitId) / UnitHealthMax(unitId)
thisEvent[5] = UnitHealth(unitId) / max(UnitHealthMax(unitId), SMALL_FLOAT)
else
thisEvent[5] = 0
end
else
thisEvent[5] = UnitHealth(targetName) / UnitHealthMax(targetName)
thisEvent[5] = UnitHealth(targetName) / max(UnitHealthMax(targetName), SMALL_FLOAT)
end

thisEvent[6] = sourceName
Expand Down Expand Up @@ -6599,7 +6600,6 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
local eraNamedSpellsToID = {}

-- ~parserstart ~startparser ~cleu ~parser

function Details222.Parser.OnParserEvent()
local time, token, hidding, who_serial, who_name, who_flags, who_flags2, target_serial, target_name, target_flags, target_flags2, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12 = CombatLogGetCurrentEventInfo()

Expand All @@ -6610,15 +6610,22 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
end

--open world out of combat spell damage
local outofcombat_spell_damage = function(unused, token, time, whoGUID, whoName, whoFlags, targetGUID, targetName, targetFlags)
local outofcombat_spell_damage = function(unused, token, time, whoGUID, whoName, whoFlags, targetGUID, targetName, targetFlags, targetFlags2, ...)
--identify if the attacker is a group member
local IS_GROUP_OBJECT = 0x00000007
local bIsValidGroupMember = bitBand(whoFlags, IS_GROUP_OBJECT) ~= 0
if (bIsValidGroupMember) then
token_list[token](nil, token, time, whoGUID, whoName, whoFlags, targetGUID, targetName, targetFlags, targetFlags2, ...)
end
end

local out_of_combat_interresting_events = {
["SPELL_SUMMON"] = parser.summon,
["SWING_DAMAGE"] = outofcombat_spell_damage,
["SPELL_DAMAGE"] = outofcombat_spell_damage,
}

--OutOfCombat parser is only used in open world to avoid getting information from people that are outside of the group
function Details222.Parser.OnParserEventOutOfCombat()
local time, token, hidding, who_serial, who_name, who_flags, who_flags2, target_serial, target_name, target_flags, target_flags2, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12 = CombatLogGetCurrentEventInfo()
local func = out_of_combat_interresting_events[token]
Expand Down
23 changes: 21 additions & 2 deletions frames/window_options2_sections.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3740,7 +3740,7 @@ do
end
end

if (pluginObject.OpenOptionsPanel) then
if (rawget(pluginObject, "OpenOptionsPanel")) then
DF:NewButton(bframe, nil, "$parentOptionsButton"..i, "OptionsButton"..i, 86, 18, pluginObject.OpenOptionsPanel, nil, nil, nil, Loc ["STRING_OPTIONS_PLUGINS_OPTIONS"], nil, options_button_template)
bframe ["OptionsButton"..i]:SetPoint("topleft", anchorFrame, "topleft", 510, y-0)
bframe ["OptionsButton"..i]:SetTextColor(button_color_rgb)
Expand Down Expand Up @@ -4310,10 +4310,29 @@ do
Details.tooltip.fontshadow = value
afterUpdate()
end,
name = Loc ["STRING_OPTIONS_TEXT_LOUTILINE"],
name = Loc ["STRING_OPTIONS_TEXT_OUTLINE"],
desc = Loc ["STRING_OPTIONS_TOOLTIPS_FONTSHADOW_DESC"],
},

{--shadow color
type = "color",
get = function()
local r, g, b, a = unpack(Details.tooltip.fontcontour)
return {r, g, b, a}
end,
set = function(self, r, g, b, a)
local color = Details.tooltip.fontcontour
color[1] = r
color[2] = g
color[3] = b
color[4] = a
afterUpdate()
end,
name = "Shadow Color",
desc = "Color of the text shadow",
hidden = true,
},

{--text size
type = "range",
get = function() return Details.tooltip.fontsize end,
Expand Down

0 comments on commit 7177232

Please sign in to comment.