Skip to content

Commit

Permalink
Fixed Cloak Tooltip Error
Browse files Browse the repository at this point in the history
Added Help Button for new Users
  • Loading branch information
Larsj02 committed May 20, 2024
1 parent 942a550 commit 4a379f1
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 26 deletions.
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@
"PaperDollFrame",
"TooltipDataProcessor",
"ACHIEVEMENT",
"SecondsFormatterMixin"
"SecondsFormatterMixin",
"HelpPlateTooltip",
"HelpTip"
]
}
1 change: 1 addition & 0 deletions CloakTooltip.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ local function getCloakStats()
local cloakAura = C_UnitAuras.GetPlayerAuraBySpellID(const.CLOAK_BUFF.AURA_ID)
if not cloakAura then return end
local cloakTooltip = C_TooltipInfo.GetUnitBuffByAuraInstanceID("player", cloakAura.auraInstanceID)
if not cloakTooltip.lines or not cloakTooltip.lines[2] then return "" end
return cloakTooltip.lines[2].leftText
end

Expand Down
71 changes: 48 additions & 23 deletions Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ local function createFrame()

local openLootbox = uiElements:CreateIcon(gems, {
points = {
{"TOPLEFT", gems, "BOTTOMLEFT", 5, -5}
{ "TOPLEFT", gems, "BOTTOMLEFT", 5, -5 }
},
isClickable = true,
actionType = "ITEM",
Expand All @@ -241,7 +241,7 @@ local function createFrame()

local openRandomGemP = uiElements:CreateIcon(gems, {
points = {
{"LEFT", openLootbox, "RIGHT", 5, 0}
{ "LEFT", openLootbox, "RIGHT", 5, 0 }
},
isClickable = true,
actionType = "ITEM",
Expand All @@ -250,7 +250,7 @@ local function createFrame()

local openRandomGemT = uiElements:CreateIcon(gems, {
points = {
{"LEFT", openRandomGemP, "RIGHT", 5, 0}
{ "LEFT", openRandomGemP, "RIGHT", 5, 0 }
},
isClickable = true,
actionType = "ITEM",
Expand All @@ -259,7 +259,7 @@ local function createFrame()

local openRandomGemC = uiElements:CreateIcon(gems, {
points = {
{"LEFT", openRandomGemT, "RIGHT", 5, 0}
{ "LEFT", openRandomGemT, "RIGHT", 5, 0 }
},
isClickable = true,
actionType = "ITEM",
Expand All @@ -268,13 +268,38 @@ local function createFrame()

local openRandomGemM = uiElements:CreateIcon(gems, {
points = {
{"LEFT", openRandomGemC, "RIGHT", 5, 0}
{ "LEFT", openRandomGemC, "RIGHT", 5, 0 }
},
isClickable = true,
actionType = "ITEM",
actionID = 223905
})

local helpText =
"|A:newplayertutorial-icon-mouse-leftbutton:16:16|a Click a Gem in this list to Socket or Unsocket.\n" ..
"'In Bag Item' or 'Socketed' indicates that you unsocket it.\n" ..
"'In Bag' indicates that the Gem is in your bag and ready to be socketed.\n\n" ..
"When hovering over a Gem that is 'Socketed' you will see the item highlighted in your character panel.\n" ..
"You can use the dropdown or the search bar at the top to filter your list.\n" ..
"This Addon also adds the current Rank and stats of your cloak inside the cloak tooltip.\n" ..
"You should see an icon in the top right of your character frame which can be used to hide or show this frame.\n" ..
"Below the Gem list you should have some clickable buttons to quickly open Chests or combine Gems\n\n" ..
"And to get rid of this frame simply shift click it.\nHave fun!"

local helpButton = CreateFrame("Button", nil, gems, "MainHelpPlateButton")
helpButton:SetScript("OnEnter", function(self)
HelpTip:Show(self, { text = helpText })
end)
helpButton:SetScript("OnLeave", function (self)
HelpTip:Hide(self)
end)
helpButton:SetScript("OnClick", function (self)
if IsLeftShiftKeyDown() then
settings:UpdateSetting("show_helpframe", false)
end
end)
helpButton:SetPoint("TOPRIGHT", 25, 25)

---@class ScrollBox : Frame
---@field GetScrollPercentage fun(self:ScrollBox)
---@field SetScrollPercentage fun(self:ScrollBox, percentage:number)
Expand Down Expand Up @@ -350,11 +375,7 @@ local function createFrame()

selectionTreeUpdate()
settings:CreateSettingCallback("show_frame", function(_, newState)
if newState then
gems:Show()
else
gems:Hide()
end
gems:SetShown(newState)
end)
settings:CreateSettingCallback("show_unowned", function(_, newState)
selectionTreeUpdate()
Expand All @@ -364,6 +385,10 @@ local function createFrame()
selectionTreeUpdate()
showPrimordial:SetChecked(newState)
end)
settings:CreateSettingCallback("show_helpframe", function(_, newState)
helpButton:SetShown(newState)
end)


hooksecurefunc("CharacterFrameTab_OnClick", function()
if CharacterFrame.selectedTab ~= 1 then
Expand All @@ -379,13 +404,13 @@ local function createFrame()
end)
gems:SetScript("OnShow", function(self)
selectionTreeUpdate()
-- Chonky Character Sheets Frame
-- Chonky Character Sheets Frame
if _G["CCSf"] then
self:ClearAllPoints()
self:SetPoint("BOTTOMLEFT", CharacterFrameBg, "BOTTOMRIGHT")
self:SetPoint("TOPLEFT", CharacterFrameBg, "TOPRIGHT")
self.defaultPosition = false
-- TinyInspect
-- TinyInspect
elseif C_AddOns.IsAddOnLoaded("TinyInspect") and PaperDollFrame.inspectFrame and PaperDollFrame.inspectFrame:IsVisible() then
self:ClearAllPoints()
self:SetPoint("BOTTOMLEFT", PaperDollFrame.inspectFrame, "BOTTOMRIGHT")
Expand All @@ -406,17 +431,17 @@ eventFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
eventFrame:SetScript("OnEvent", function(_, event)
-- Apparently Gems go into your bags so this is not longer needed
--if event == "SCRAPPING_MACHINE_ITEM_ADDED" then
--RunNextFrame(function()
-- local mun = ScrappingMachineFrame
-- for f in pairs(mun.ItemSlots.scrapButtons.activeObjects) do
-- if f.itemLink then
-- local gemsList = gemUtil:GetItemGems(f.itemLink)
-- if #gemsList > 0 then
-- misc:PrintError("YOU ARE ABOUT TO DESTROY A SOCKETED ITEM!")
-- end
-- end
-- end
--end)
--RunNextFrame(function()
-- local mun = ScrappingMachineFrame
-- for f in pairs(mun.ItemSlots.scrapButtons.activeObjects) do
-- if f.itemLink then
-- local gemsList = gemUtil:GetItemGems(f.itemLink)
-- if #gemsList > 0 then
-- misc:PrintError("YOU ARE ABOUT TO DESTROY A SOCKETED ITEM!")
-- end
-- end
-- end
--end)
--end
if event ~= "PLAYER_ENTERING_WORLD" then return end

Expand Down
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.3.4
## Version: 1.3.5
## Title: Remix Gem Helper
## Author: Rasu | Larsj_02
## DefaultState: enabled
Expand Down
8 changes: 7 additions & 1 deletion Settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ local settings = {
show_unowned = false,
show_primordial = false,
show_frame = true,
show_helpframe = true
},
callbacks = {}
}
Expand Down Expand Up @@ -42,9 +43,14 @@ eventFrame:SetScript("OnEvent", function (self, event, addon)
self:SetScript("OnEvent", nil)

RemixGemHelperDB = RemixGemHelperDB or settings.db
local defaults = settings.db
settings.db = RemixGemHelperDB

for settingName, state in pairs(settings.db) do
for settingName, defaultState in pairs(defaults) do
if settings.db[settingName] == nil then
settings.db[settingName] = defaultState
end
local state = settings.db[settingName]
if settings.callbacks[settingName] then
for _, callback in ipairs(self.callbacks[settingName]) do
callback(settingName, state)
Expand Down

0 comments on commit 4a379f1

Please sign in to comment.