diff --git a/core/control.lua b/core/control.lua index 9beb2fa7..51915a00 100644 --- a/core/control.lua +++ b/core/control.lua @@ -1469,15 +1469,23 @@ if (not Details.GameCooltipFrame1Shadow) then Details.GameCooltipFrame1Shadow = GameCooltipFrame1:CreateTexture(nil, "background") Details.GameCooltipFrame1Shadow:SetTexture([[Interface\AddOns\Details\images\shadow_square]], 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() diff --git a/core/gears.lua b/core/gears.lua index b54b89eb..eb56da7c 100644 --- a/core/gears.lua +++ b/core/gears.lua @@ -795,6 +795,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 @@ -846,11 +851,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 diff --git a/core/parser.lua b/core/parser.lua index e089631a..140e718b 100755 --- a/core/parser.lua +++ b/core/parser.lua @@ -117,6 +117,10 @@ --pets local petCache = petContainer.Pets + --store the unit names from all group members + ---@type table + local group_roster_name_cache = {} + --ignore deaths local ignore_death_cache = {} --cache @@ -5580,9 +5584,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 @@ -5602,7 +5636,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 @@ -5737,6 +5771,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 @@ -5979,9 +6015,38 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 function Details222.Parser.OnParserEvent(self, event, ...) 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(self, event, ...) + 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 @@ -6006,6 +6071,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