Skip to content

Commit

Permalink
Added small Indication where the gem is located when hovering over Ge…
Browse files Browse the repository at this point in the history
…ms in the list
  • Loading branch information
Larsj02 committed May 17, 2024
1 parent bd2e810 commit 78cabd9
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 9 deletions.
15 changes: 15 additions & 0 deletions Constants.lua
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,21 @@ constants.SOCKET_EQUIPMENT_SLOTS = {
INVSLOT_TRINKET1,
INVSLOT_TRINKET2,
}
constants.SOCKET_EQUIPMENT_SLOTS_FRAMES = {
[INVSLOT_HEAD] = "CharacterHeadSlot",
[INVSLOT_NECK] = "CharacterNeckSlot",
[INVSLOT_SHOULDER] = "CharacterShoulderSlot",
[INVSLOT_CHEST] = "CharacterChestSlot",
[INVSLOT_WAIST] = "CharacterWaistSlot",
[INVSLOT_LEGS] = "CharacterLegsSlot",
[INVSLOT_FEET] = "CharacterFeetSlot",
[INVSLOT_WRIST] = "CharacterWristSlot",
[INVSLOT_HAND] = "CharacterHandsSlot",
[INVSLOT_FINGER1] = "CharacterFinger0Slot",
[INVSLOT_FINGER2] = "CharacterFinger1Slot",
[INVSLOT_TRINKET1] = "CharacterTrinket0Slot",
[INVSLOT_TRINKET2] = "CharacterTrinket1Slot",
}

-- https://github.com/Gethe/wow-ui-source/blob/55a42b7a1dc672ebb8e6f19eea3b1d377afe53b9/Interface/AddOns/Blizzard_ItemSocketingUI/Blizzard_ItemSocketingUI.lua#L7
constants.SOCKET_TYPE_INFO = {
Expand Down
33 changes: 25 additions & 8 deletions Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ eventFrame:SetScript("OnEvent", function()
gems:SetPoint("BOTTOMLEFT", CharacterFrame, "BOTTOMRIGHT")
gems:SetPoint("TOPLEFT", CharacterFrame, "TOPRIGHT")

local highlightSlot = CreateFrame("Frame", nil, UIParent)
highlightSlot:SetFrameStrata("TOOLTIP")
local hsTex = highlightSlot:CreateTexture(nil)
hsTex:SetAllPoints()
hsTex:SetAtlas("CosmeticIconFrame")

local frameToggle = CreateFrame("Frame", nil, CharacterFrame)
frameToggle:SetFrameStrata("HIGH")
frameToggle:SetSize(42, 42)
Expand All @@ -116,16 +122,16 @@ eventFrame:SetScript("OnEvent", function()
ftTex:SetPoint("TOPLEFT", 10, -15)
ftTex:SetPoint("BOTTOMRIGHT", -7.5, 7.5)
ftTex:SetAtlas("timerunning-glues-icon")
frameToggle:SetScript("OnEnter", function (self)
frameToggle:SetScript("OnEnter", function(self)
GameTooltip:ClearLines()
GameTooltip:SetOwner(self, "ANCHOR_TOPRIGHT")
GameTooltip:AddLine(string.format("Toggle the %s UI", const.ADDON_NAME), 1, 1, 1)
GameTooltip:Show()
end)
frameToggle:SetScript("OnLeave", function ()
frameToggle:SetScript("OnLeave", function()
GameTooltip:Hide()
end)
frameToggle:SetScript("OnMouseDown", function ()
frameToggle:SetScript("OnMouseDown", function()
settings:UpdateSetting("show_frame", not settings:GetSetting("show_frame"))
end)

Expand Down Expand Up @@ -167,19 +173,19 @@ eventFrame:SetScript("OnEvent", function()
---@field tooltip string

local showUnowned = createCheckButton(gems, {
point = {"BOTTOMRIGHT", -75, 7.5},
point = { "BOTTOMRIGHT", -75, 7.5 },
text = "Unowned",
tooltip = "Show Unowned Gems in the List.",
onClick = function (self)
onClick = function(self)
settings:UpdateSetting("show_unowned", self:GetChecked())
end
})

local showPrimordial = createCheckButton(gems, {
point = {"BOTTOMRIGHT", -175, 7.5},
point = { "BOTTOMRIGHT", -175, 7.5 },
text = "Primordial",
tooltip = "Show Primordial Gems in the List.",
onClick = function (self)
onClick = function(self)
settings:UpdateSetting("show_primordial", self:GetChecked())
end
})
Expand Down Expand Up @@ -259,10 +265,21 @@ eventFrame:SetScript("OnEvent", function()
GameTooltip:SetOwner(self, "ANCHOR_CURSOR_RIGHT")
GameTooltip:SetHyperlink("item:" .. self.id)
GameTooltip:Show()
if not self.Extract then return end
local info = self.Extract.info
if not info then return end
if not info.type == "SOCKET" then return end
local eqSlotName = const.SOCKET_EQUIPMENT_SLOTS_FRAMES[info.index]
local eqSlot = _G[eqSlotName]
if not eqSlot then return end
highlightSlot:Show()
highlightSlot:ClearAllPoints()
highlightSlot:SetAllPoints(eqSlot)
end
end)

frame:SetScript("OnLeave", function(self)
highlightSlot:Hide()
self.Highlight:Hide()
if self.id then
GameTooltip:Hide()
Expand Down Expand Up @@ -406,5 +423,5 @@ eventFrame:SetScript("OnEvent", function()
gems:Show()
frameToggle:Show()
end
end)
end)
end)
2 changes: 1 addition & 1 deletion Remix Gem Helper.toc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Interface: 100207
## Version: 1.1.2
## Version: 1.2.0
## Title: Remix Gem Helper
## Author: Rasu | Larsj_02
## DefaultState: enabled
Expand Down

0 comments on commit 78cabd9

Please sign in to comment.