Skip to content

Commit

Permalink
Fix for the Invisible Clickables
Browse files Browse the repository at this point in the history
  • Loading branch information
Larsj02 committed May 27, 2024
1 parent 020b189 commit bd19d2d
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 30 deletions.
11 changes: 10 additions & 1 deletion Constants.lua
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,16 @@ constants.ITEM_TYPE_INVSLOT = {
[22] = INVSLOT_MAINHAND,
[23] = INVSLOT_OFFHAND,
[25] = INVSLOT_MAINHAND,
[26] = INVSLOT_MAINHAND,
[26] = INVSLOT_MAINHAND,
}
constants.MERCHANT_RESTRICTIONS = {
[21] = "RACECLASS",
[22] = "FACTION",
[23] = "SKILL",
[24] = "PVPMEDAL",
[25] = "REPUTATION",
[26] = "OWNED",
[27] = "LEVEL"
}

constants.COLORS = {
Expand Down
25 changes: 18 additions & 7 deletions Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -485,43 +485,50 @@ local function createFrame()
frameToggle:Show()
end
end)
gems:SetScript("OnHide", function()
gems:SetScript("OnHide", function(self)
self:ClearAllPoints()
updateTree({})
end)
gems:SetScript("OnShow", function(self)
selectionTreeUpdate()
-- Chonky Character Sheets Frame
if _G["CCSf"] then
self:ClearAllPoints()
self:SetPoint("BOTTOMLEFT", CharacterFrameBg, "BOTTOMRIGHT")
self:SetPoint("TOPLEFT", CharacterFrameBg, "TOPRIGHT")
self.defaultPosition = false
-- TinyInspect
elseif C_AddOns.IsAddOnLoaded("TinyInspect") and PaperDollFrame.inspectFrame and PaperDollFrame.inspectFrame:IsVisible() then
self:ClearAllPoints()
self:SetPoint("BOTTOMLEFT", PaperDollFrame.inspectFrame, "BOTTOMRIGHT")
self:SetPoint("TOPLEFT", PaperDollFrame.inspectFrame, "TOPRIGHT")
self.defaultPosition = false
elseif not self.defaultPosition then
else
self:ClearAllPoints()
self:SetPoint("BOTTOMLEFT", CharacterFrame, "BOTTOMRIGHT")
self:SetPoint("TOPLEFT", CharacterFrame, "TOPRIGHT")
self.defaultPosition = true
end
selectionTreeUpdate()
end)
end

local function createMerchantFrame()
print("Create Merchant Frame")
end

local function fillMerchantFrame()
DevTools_Dump(Private.MerchantUtil:GetMerchantItems())
end

function addon:OnInitialize(...)
-- On Init
end

function addon:OnEnable(...) -- This gotta be moved as this login event doesn't occur on reload
function addon:OnEnable(...)
if 1 ~= PlayerGetTimerunningSeasonID() then return end

for itemID in pairs(const.GEM_SOCKET_TYPE) do
cache:CacheItemInfo(itemID)
end
createFrame()
createMerchantFrame()
end

addon:RegisterEvent("SCRAPPING_MACHINE_ITEM_ADDED", "Core.lua", function()
Expand All @@ -544,3 +551,7 @@ addon:RegisterEvent("ADDON_LOADED", "Core.lua", function(...)
createScrapFrame()
end
end)

addon:RegisterEvent("MERCHANT_SHOW", "Core.lua", function()
fillMerchantFrame()
end)
File renamed without changes.
36 changes: 14 additions & 22 deletions MerchantUtil.lua
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
local restrictions = {
[21] = "RACECLASS",
[22] = "FACTION",
[23] = "SKILL",
[24] = "PVPMEDAL",
[25] = "REPUTATION",
[26] = "OWNED",
[27] = "LEVEL"
}
---@class RemixGemHelperPrivate
local Private = select(2, ...)
local const = Private.constants
local addon = Private.Addon

local function getRestriction(lines)
local merchantUtil = {}
Private.MerchantUtil = merchantUtil

---@param lines table
---@return string
function merchantUtil:GetRestriction(lines)
for _, lineData in ipairs(lines) do
if restrictions[lineData.type] then
return restrictions[lineData.type]
if const.MERCHANT_RESTRICTIONS[lineData.type] then
return const.MERCHANT_RESTRICTIONS[lineData.type]
end
end
return "NONE"
end

function GetItemsFromMerchant()
function merchantUtil:GetMerchantItems()
local items = {}

for itemIndex = 1, GetMerchantNumItems() do
local _, itemIcon, itemCopperCost = GetMerchantItemInfo(itemIndex)
local itemInfo = C_TooltipInfo.GetMerchantItem(itemIndex)
if itemInfo then
local restriction = getRestriction(itemInfo.lines)
local restriction = self:GetRestriction(itemInfo.lines)
if not items[restriction] then items[restriction] = {} end
local itemCost = {}
if itemCopperCost > 0 then
Expand All @@ -36,7 +36,6 @@ function GetItemsFromMerchant()
if not items[restriction].cost["MONEY"] then items[restriction].cost["MONEY"] = 0 end
items[restriction].cost["MONEY"] = items[restriction].cost["MONEY"] + itemCopperCost
end
--print(itemInfo.hyperlink, itemIcon, restriction)
for costIndex = 1, GetMerchantItemCostInfo(itemIndex) do
local costIcon, costValue, costLink = GetMerchantItemCostItem(itemIndex, costIndex)
tinsert(itemCost, {
Expand All @@ -61,10 +60,3 @@ function GetItemsFromMerchant()

return items
end


local f = CreateFrame("Frame")
f:RegisterEvent("MERCHANT_SHOW")
f:SetScript("OnEvent", function (...)
rasuL = GetItemsFromMerchant()
end)

0 comments on commit bd19d2d

Please sign in to comment.