Skip to content

Commit

Permalink
Fix target frame and tooltip inspection errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Nils89 committed Apr 12, 2024
1 parent 9178031 commit 1704aec
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 80 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
3.3.2-Era
Fix target frame and tooltip inspection errors

3.3.1-Era
Fix lua error on load

Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG_NEW_VERSION.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
3.3.2-Era
Fix target frame and tooltip inspection errors

3.3.1-Era
Fix lua error on load

Expand Down
2 changes: 1 addition & 1 deletion GW2_ui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ local animations = GW.animations

local l = CreateFrame("Frame") -- Main event frame

GW.VERSION_STRING = "GW2_UI @project-version@-Era"
GW.VERSION_STRING = "GW2_UI @project-version@"

-- setup Binding Header color
BINDING_HEADER_GW2UI = C_AddOns.GetAddOnMetadata(..., "Title")
Expand Down
5 changes: 5 additions & 0 deletions changelog.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ local ct = {
}
GW.CHANGELOGS_TYPES = ct


addChange("3.3.2",{
{ct.bug,[=[Fix target frame and tooltip inspection errors]=]},
})

addChange("3.3.1",{
{ct.bug,[=[Fix lua error on load]=]},
})
Expand Down
1 change: 1 addition & 0 deletions character/windowManager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,7 @@ local function LoadCharacter()
addAddonButton("Outfitter", GetSetting("USE_CHARACTER_WINDOW"), function() hideCharframe = false Outfitter:OpenUI() end, true)
addAddonButton("Clique", GetSetting("USE_SPELLBOOK_WINDOW"), function() ShowUIPanel(CliqueConfig) end, true)
addAddonButton("Pawn", GetSetting("USE_CHARACTER_WINDOW"), PawnUIShow, false)
addAddonButton("Ranker", GetSetting("USE_CHARACTER_WINDOW"), function() RankerMainFrame:SetParent(GwCharacterWindow); RankerMainFrame:ClearAllPoints(); RankerMainFrame:SetPoint("LEFT", GwCharacterWindow, "RIGHT", 0, 0) Ranker:ToggleWindow() end, false)

GwCharacterMenu.skillsMenu:SetAttribute("_onclick", [=[
local f = self:GetFrameRef("GwCharacterWindow")
Expand Down
1 change: 0 additions & 1 deletion core/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ GW.ClassicHC = C_GameRules and C_GameRules.IsHardcoreActive()
GW.ClassicSOD = C_Engraving and C_Engraving.IsEngravingEnabled()

--Tables
GW.unitIlvlsCache = {}
GW.skins = {}
GW.TexCoords = {0, 1, 0, 1}
GW.locationData = {}
Expand Down
31 changes: 16 additions & 15 deletions immersive/tooltips.lua
Original file line number Diff line number Diff line change
Expand Up @@ -236,23 +236,23 @@ local function AddTargetInfo(self, unit)
end

local function AddInspectInfo(self, unit, numTries, r, g, b)
if not unit or numTries > 3 or not CanInspect(unit) then return end
--if not unit or numTries > 3 or not CanInspect(unit) then return end

local unitGUID = UnitGUID(unit)
if not unitGUID then return end
local specIndex = CI:GetSpecialization(unitGUID) or 1
local x1, x2, x3 = 0, 0, 0
--local unitGUID = UnitGUID(unit)
--if not unitGUID then return end
--local specIndex = CI:GetSpecialization(unitGUID) or 1
--local x1, x2, x3 = 0, 0, 0

x1, x2, x3 = CI:GetTalentPoints(unitGUID)
--x1, x2, x3 = CI:GetTalentPoints(unitGUID)
--GW.Libs.LibGearScore:NotifyInspect(unitGUID)
--local _, gearScore = GW.Libs.LibGearScore:GetScore(unitGUID)

if unitGUID == UnitGUID("player") then
self:AddDoubleLine(TALENTS .. ":", string.format("%s [%d/%d/%d]", CI:GetSpecializationName(GW.myclass, specIndex, true), x1, x2, x3), nil, nil, nil, r, g, b)
else
local _, className = UnitClass(unit)
self:AddDoubleLine(TALENTS .. ":", string.format("%s [%d/%d/%d]", CI:GetSpecializationName(className, specIndex, true), x1, x2, x3), nil, nil, nil, r, g, b)
end
--if unitGUID == UnitGUID("player") then
-- self:AddDoubleLine(TALENTS .. ":", string.format("%s [%d/%d/%d]", CI:GetSpecializationName(GW.myclass, specIndex, true), x1, x2, x3), nil, nil, nil, r, g, b)
--else
-- local _, className = UnitClass(unit)
-- self:AddDoubleLine(TALENTS .. ":", string.format("%s [%d/%d/%d]", CI:GetSpecializationName(className, specIndex, true), x1, x2, x3), nil, nil, nil, r, g, b)
--end

--if gearScore then
-- self:AddDoubleLine(STAT_AVERAGE_ITEM_LEVEL .. ":" , gearScore.AvgItemLevel, nil, nil, nil, 1, 1, 1)
Expand Down Expand Up @@ -285,9 +285,10 @@ local function GameTooltip_OnTooltipSetUnit(self)
AddTargetInfo(self, unit)
end

if isShiftKeyDown and color then
AddInspectInfo(self, unit, 0, color.r, color.g, color.b)
end
--NOT FOR ERA
--if isShiftKeyDown and color then
-- AddInspectInfo(self, unit, 0, color.r, color.g, color.b)
--end

if unit and not isPlayerUnit and IsModKeyDown() then
local guid = UnitGUID(unit) or ""
Expand Down
65 changes: 2 additions & 63 deletions units/unitframes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ local IsIn = GW.IsIn
local RoundDec = GW.RoundDec
local LoadAuras = GW.LoadAuras
local UpdateBuffLayout = GW.UpdateBuffLayout
local PopulateUnitIlvlsCache = GW.PopulateUnitIlvlsCache

local fctf

Expand Down Expand Up @@ -294,8 +293,7 @@ local function setUnitPortraitFrame(self)

local txt
local border = "normal"
local showItemLevel = (GW.GetSetting(self.unit .. "_SHOW_ILVL") and CanInspect(self.unit))
local honorLevel = showItemLevel and 0 or UnitHonorLevel and UnitHonorLevel(self.unit) or 0
local honorLevel = UnitHonorLevel and UnitHonorLevel(self.unit) or 0

local unitClassIfication = UnitClassification(self.unit)
if TARGET_FRAME_ART[unitClassIfication] ~= nil then
Expand All @@ -305,12 +303,7 @@ local function setUnitPortraitFrame(self)
end
end

if showItemLevel then
local guid = UnitGUID(self.unit)
if guid and GW.unitIlvlsCache[guid] and GW.unitIlvlsCache[guid].itemLevel then
txt = RoundDec(GW.unitIlvlsCache[guid].itemLevel, 0)
end
elseif honorLevel > 9 then
if honorLevel > 9 then
local plvl
txt = honorLevel

Expand Down Expand Up @@ -373,39 +366,6 @@ local function setUnitPortraitFrame(self)
end
GW.AddForProfiling("unitframes", "setUnitPortraitFrame", setUnitPortraitFrame)

local function updateAvgItemLevel(self, guid)
if guid == UnitGUID(self.unit) and CanInspect(self.unit) then
local itemLevel, retryUnit, retryTable, iLevelDB = GW.GetUnitItemLevel(self.unit)
if itemLevel == "tooSoon" then
C_Timer.After(0.05, function()
local canUpdate = true
for _, x in ipairs(retryTable) do
local slotInfo = GW.GetGearSlotInfo(retryUnit, x)
if slotInfo == "tooSoon" then
canUpdate = false
else
iLevelDB[x] = slotInfo.iLvl
slotInfo = nil -- clear cache
end
end

if canUpdate then
local calculateItemLevel = GW.CalculateAverageItemLevel(iLevelDB, retryUnit)
PopulateUnitIlvlsCache(guid, calculateItemLevel)
ClearInspectPlayer()
self:UnregisterEvent("INSPECT_READY")
setUnitPortraitFrame(self)
end
end)
else
PopulateUnitIlvlsCache(guid, itemLevel)
self:UnregisterEvent("INSPECT_READY")
end
setUnitPortraitFrame(self)
end
end
GW.AddForProfiling("unitframes", "updateAvgItemLevel", updateAvgItemLevel)

local function updateRaidMarkers(self)
local i = GetRaidTargetIndex(self.unit)
if i == nil then
Expand Down Expand Up @@ -761,18 +721,6 @@ local function target_OnEvent(self, event, unit)
local ttf = GwTargetTargetUnitFrame

if IsIn(event, "PLAYER_TARGET_CHANGED", "ZONE_CHANGED", "FORCE_UPDATE") then
if event == "PLAYER_TARGET_CHANGED" and CanInspect(self.unit) and GW.GetSetting("target_SHOW_ILVL") then
local guid = UnitGUID(self.unit)
if guid then
if not GW.unitIlvlsCache[guid] then
local _, englishClass = UnitClass(self.unit)
local color = GWGetClassColor(englishClass, true, true)
GW.unitIlvlsCache[guid] = {unitColor = {color.r, color.g, color.b}}
self:RegisterEvent("INSPECT_READY")
NotifyInspect(self.unit)
end
end
end
if self.showThreat then
updateThreatValues(self)
elseif self.threattabbg:IsShown() then
Expand Down Expand Up @@ -814,17 +762,9 @@ local function target_OnEvent(self, event, unit)
updateRaidMarkers(ttf)
end
end
elseif event == "PLAYER_ENTERING_WORLD" then
wipe(GW.unitIlvlsCache)
elseif event == "RAID_TARGET_UPDATE" then
updateRaidMarkers(self)
if (ttf) then updateRaidMarkers(ttf) end
elseif event == "INSPECT_READY" then
if not GW.GetSetting("target_SHOW_ILVL") then
self:UnregisterEvent("INSPECT_READY")
else
updateAvgItemLevel(self, unit)
end
elseif event == "UNIT_THREAT_LIST_UPDATE" and self.showThreat then
updateThreatValues(self)
elseif UnitIsUnit(unit, self.unit) then
Expand Down Expand Up @@ -1047,7 +987,6 @@ local function LoadTarget()
NewUnitFrame:RegisterEvent("PLAYER_TARGET_CHANGED")
NewUnitFrame:RegisterEvent("ZONE_CHANGED")
NewUnitFrame:RegisterEvent("RAID_TARGET_UPDATE")
NewUnitFrame:RegisterEvent("PLAYER_ENTERING_WORLD")

NewUnitFrame:RegisterUnitEvent("UNIT_HEALTH_FREQUENT", "target")
NewUnitFrame:RegisterUnitEvent("UNIT_MAXHEALTH", "target")
Expand Down

0 comments on commit 1704aec

Please sign in to comment.