Skip to content

Commit

Permalink
Fixing battleground naming bug, fixed tooltip border
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Aug 17, 2024
1 parent cd9a11d commit 5aac0bd
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 6 deletions.
14 changes: 11 additions & 3 deletions core/control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1467,15 +1467,23 @@
if (not Details.GameCooltipFrame1Shadow) then
Details.GameCooltipFrame1Shadow = GameCooltipFrame1:CreateTexture(nil, "background")
Details.GameCooltipFrame1Shadow:SetTexture([[Interface\AddOns\Details\images\shadow_square.png]], nil, nil, "TRILINEAR")
local offset = 4
Details.GameCooltipFrame1Shadow:SetPoint("topleft", GameCooltipFrame1, "topleft", -offset, offset)
Details.GameCooltipFrame1Shadow:SetPoint("bottomright", GameCooltipFrame1, "bottomright", offset, -offset)
GameCooltipFrame1:HookScript("OnHide", function(self)
Details.GameCooltipFrame1Shadow:Hide()
end)
end

if (Details.tooltip.show_border_shadow) then
local offset = 1
if (GameCooltipFrame1:GetHeight() > 200) then
offset = 4
elseif (GameCooltipFrame1:GetHeight() > 150) then
offset = 3
elseif (GameCooltipFrame1:GetHeight() > 80) then
offset = 2
end

Details.GameCooltipFrame1Shadow:SetPoint("topleft", GameCooltipFrame1, "topleft", -offset, offset)
Details.GameCooltipFrame1Shadow:SetPoint("bottomright", GameCooltipFrame1, "bottomright", offset, -offset)
Details.GameCooltipFrame1Shadow:Show()
else
Details.GameCooltipFrame1Shadow:Hide()
Expand Down
8 changes: 7 additions & 1 deletion core/gears.lua
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,11 @@ Details222.Parser.EventFrame:SetScript("OnEvent", function(self, event, ...)
return
end

if (isntanceType == "pvp" or isntanceType == "arena") then
Details222.parser_frame:SetScript("OnEvent", Details222.Parser.OnParserEventPVP)
return
end

if (event == "PLAYER_ENTERING_WORLD" or event == "ZONE_CHANGED_NEW_AREA") then
if (bConsiderGroupMembers) then
--check if any group member is in combat
Expand Down Expand Up @@ -848,11 +853,12 @@ function detailsEnterInCombatListener:OnEvent()
end
end


function Details222.Parser.GetState()
local parserEngine = Details222.parser_frame:GetScript("OnEvent")
if (parserEngine == Details222.Parser.OnParserEvent) then
return "STATE_REGULAR"
elseif (parserEngine == Details222.Parser.OnParserEventPVP) then
return "STATE_PVP"
elseif (parserEngine == Details222.Parser.OnParserEventOutOfCombat) then
return "STATE_RESTRICTED"
end
Expand Down
71 changes: 69 additions & 2 deletions core/parser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@
--pets
local petCache = petContainer.Pets

--store the unit names from all group members
---@type table<guid, unitname>
local group_roster_name_cache = {}

--ignore deaths
local ignore_death_cache = {}
--cache
Expand Down Expand Up @@ -6197,9 +6201,39 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
return Details.in_group
end

local update_persistant_unitname_cache = function()
local unitIdCache

if (IsInRaid()) then
unitIdCache = Details222.UnitIdCache.Raid
else
unitIdCache = Details222.UnitIdCache.Party
end

for i, unitId in ipairs(unitIdCache) do
if (UnitExists(unitId)) then
local unitGUID = UnitGUID(unitId)
if (unitGUID) then
if (not group_roster_name_cache[unitGUID]) then
local unitFullName = Details:GetFullName(unitId)
if (unitFullName) then
group_roster_name_cache[unitGUID] = unitFullName
end
end
end
else
break
end
end
end

function Details.parser_functions:GROUP_ROSTER_UPDATE(...)
local bIsInGroup = IsInGroup() or IsInRaid()

update_persistant_unitname_cache()

if (not Details.in_group) then
Details.in_group = IsInGroup() or IsInRaid()
Details.in_group = bIsInGroup

if (Details.in_group) then
--player entered in a group, cleanup and set the new enviromnent
Expand All @@ -6219,7 +6253,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
end

else
Details.in_group = IsInGroup() or IsInRaid()
Details.in_group = bIsInGroup

if (not Details.in_group) then
--player left the group, run routines to cleanup the environment
Expand Down Expand Up @@ -6361,6 +6395,8 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
--load auto run code
Details222.AutoRunCode.StartAutoRun()

update_persistant_unitname_cache()

Details.isLoaded = true
end

Expand Down Expand Up @@ -6602,9 +6638,38 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
-- ~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()
local func = token_list[token]

if (func) then
who_name = group_roster_name_cache[who_serial] or who_name
target_name = group_roster_name_cache[target_serial] or target_name
return func(nil, token, time, who_serial, who_name, who_flags, target_serial, target_name, target_flags, target_flags2, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12)
end
end

function Details222.Parser.OnParserEventPVP()
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 = token_list[token]

if (func) then
if (group_roster_name_cache[who_serial]) then
who_name = group_roster_name_cache[who_serial]
else
if (who_serial:match("^Pl")) then
who_name = who_name:gsub("-%a+$", "")
group_roster_name_cache[who_serial] = who_name
end
end

if (group_roster_name_cache[target_serial]) then
target_name = group_roster_name_cache[target_serial]
else
if (target_serial:match("^Pl")) then
target_name = target_name:gsub("-%a+$", "")
group_roster_name_cache[target_serial] = target_name
end
end

return func(nil, token, time, who_serial, who_name, who_flags, target_serial, target_name, target_flags, target_flags2, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12)
end
end
Expand All @@ -6630,6 +6695,8 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
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]
if (func) then
who_name = group_roster_name_cache[who_serial] or who_name
target_name = group_roster_name_cache[target_serial] or target_name
return func(nil, token, time, who_serial, who_name, who_flags, target_serial, target_name, target_flags, target_flags2, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12)
end
end
Expand Down

0 comments on commit 5aac0bd

Please sign in to comment.