Skip to content

Commit

Permalink
Improve Char and Inspect code. Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Kkthnx committed Nov 23, 2024
1 parent bf2d6b8 commit 8c05ac3
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 45 deletions.
8 changes: 0 additions & 8 deletions KkthnxUI/Modules/Loot/Elements/AutoConfirm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,20 @@ local STATICPOPUP_NUMDIALOGS = STATICPOPUP_NUMDIALOGS

-- Function to handle auto confirming of loot dialogs
local function SetupAutoConfirm()
-- Loop through all the static popup dialogs
for i = 1, STATICPOPUP_NUMDIALOGS do
-- Get the current popup frame
local frame = _G["StaticPopup" .. i]

-- Check if the popup frame is visible and its type is either "CONFIRM_LOOT_ROLL" or "LOOT_BIND"
if (frame.which == "CONFIRM_LOOT_ROLL" or frame.which == "LOOT_BIND") and frame:IsVisible() then
-- Call the StaticPopup_OnClick function with the first option (index 1) selected
StaticPopup_OnClick(frame, 1)
end
end
end

-- Function to create the auto confirm feature
function Module:CreateAutoConfirm()
-- Check if the auto confirm loot feature is enabled in the config
if not C["Loot"].AutoConfirmLoot then
return
end

-- Register the CONFIRM_DISENCHANT_ROLL, CONFIRM_LOOT_ROLL, and LOOT_BIND_CONFIRM events
-- and call the SetupAutoConfirm function when any of them triggers
K:RegisterEvent("CONFIRM_DISENCHANT_ROLL", SetupAutoConfirm)
K:RegisterEvent("CONFIRM_LOOT_ROLL", SetupAutoConfirm)
K:RegisterEvent("LOOT_BIND_CONFIRM", SetupAutoConfirm)
Expand Down
23 changes: 5 additions & 18 deletions KkthnxUI/Modules/Loot/Elements/AutoGreed.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,30 @@ local Module = K:GetModule("Loot")

-- Sourced: ShestakUI (Wetxius, Shestak)

local GetItemInfo = GetItemInfo
local C_Item_GetItemInfo = C_Item.GetItemInfo
local GetLootRollItemInfo = GetLootRollItemInfo
local GetLootRollItemLink = GetLootRollItemLink
local MAX_PLAYER_LEVEL = MAX_PLAYER_LEVEL
local RollOnLoot = RollOnLoot

local function SetupAutoGreed(_, _, id)
-- Get the loot roll item information
print("SetupAutoGreed", id) -- Remove this later
local _, _, _, quality, BoP, _, _, canDisenchant = GetLootRollItemInfo(id)

-- Check if the id is present and the quality is equal to 2
if id and quality == 2 and not BoP then
-- Get the loot roll item link
local link = GetLootRollItemLink(id)
-- Get the item name
local itemName = GetItemInfo(link)
-- Get the item information
local _, _, _, ilevel = GetItemInfo(link)
-- Check if the item can be disenchanted and its item level is greater than 270
local _, _, _, ilevel = C_Item_GetItemInfo(link)
if canDisenchant and ilevel > 270 then
-- Roll on the loot as greed
RollOnLoot(id, 3)
K.Print(format("Auto Greed: %s", itemName))
else
-- Roll on the loot as need
RollOnLoot(id, 2)
K.Print(format("Auto Greed: %s", itemName))
end
end
end

function Module:CreateAutoGreed()
-- Check if auto greed is enabled and the player is at max level
if not C["Loot"].AutoGreed or K.Level ~= MAX_PLAYER_LEVEL then
local maxLevel = GetMaxLevelForExpansionLevel(GetExpansionLevel())
if not C["Loot"].AutoGreed or K.Level ~= maxLevel then
return
end

-- Register the event to listen for the start of a loot roll
K:RegisterEvent("START_LOOT_ROLL", SetupAutoGreed)
end
1 change: 0 additions & 1 deletion KkthnxUI/Modules/Loot/Elements/FasterLoot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ local GetNumLootItems = GetNumLootItems
local GetTime = GetTime
local IsModifiedClick = IsModifiedClick
local LootSlot = LootSlot
local SlashCmdList = SlashCmdList

local lootDelay = 0

Expand Down
2 changes: 1 addition & 1 deletion KkthnxUI/Modules/Miscellaneous/Elements/ExpRep.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ local select, pairs = select, pairs

-- Caching frequently used functions and variables
local GetXPExhaustion = GetXPExhaustion
local IsInGroup, IsShiftKeyDown, IsWatchingHonorAsXP = IsInGroup, IsShiftKeyDown, IsWatchingHonorAsXP
local IsInGroup, IsWatchingHonorAsXP = IsInGroup, IsWatchingHonorAsXP
local UnitHonor, UnitHonorLevel, UnitHonorMax = UnitHonor, UnitHonorLevel, UnitHonorMax
local UnitXP, UnitXPMax = UnitXP, UnitXPMax
local C_AzeriteItem_FindActiveAzeriteItem = C_AzeriteItem.FindActiveAzeriteItem
Expand Down
8 changes: 4 additions & 4 deletions KkthnxUI/Modules/Miscellaneous/Elements/QuestTool.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ local K, C, L = KkthnxUI[1], KkthnxUI[2], KkthnxUI[3]
local Module = K:GetModule("Miscellaneous")

local pairs, strfind = pairs, strfind
local UnitGUID, GetItemCount = UnitGUID, GetItemCount
local GetActionInfo, GetSpellInfo, GetOverrideBarSkin = GetActionInfo, GetSpellInfo, GetOverrideBarSkin
local UnitGUID, C_Item_GetItemCount = UnitGUID, C_Item.GetItemCount
local GetActionInfo, C_Spell_GetSpellInfo, GetOverrideBarSkin = GetActionInfo, C_Spell.GetSpellInfo, GetOverrideBarSkin
local C_QuestLog_GetLogIndexForQuestID = C_QuestLog.GetLogIndexForQuestID
local C_GossipInfo_SelectOption, C_GossipInfo_GetNumOptions = C_GossipInfo.SelectOption, C_GossipInfo.GetNumOptions

Expand Down Expand Up @@ -55,7 +55,7 @@ function Module:QuestTool_SetGlow(msg)
for i = 1, 3 do
local button = _G["ActionButton" .. i]
local _, spellID = GetActionInfo(button.action)
local name = spellID and GetSpellInfo(spellID)
local name = spellID and C_Spell_GetSpellInfo(spellID)
if fixedStrings[name] and isActionMatch(msg, fixedStrings[name]) or isActionMatch(msg, name) then
K.ShowOverlayGlow(button)
else
Expand Down Expand Up @@ -128,7 +128,7 @@ function Module:QuestTool()
if npcID == 174498 then
C_GossipInfo_SelectOption(3)
elseif npcID == 174371 then
if GetItemCount(183961) > 0 and C_GossipInfo_GetNumOptions() == 5 then
if C_Item_GetItemCount(183961) > 0 and C_GossipInfo_GetNumOptions() == 5 then
C_GossipInfo_SelectOption(firstStep and 2 or 5)
firstStep = not firstStep
end
Expand Down
12 changes: 6 additions & 6 deletions KkthnxUI/Modules/Miscellaneous/Elements/QueueTimer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@ function Module:SetupPvPQueueTimer()
end

function Module:CreateQueueTimers()
if not C["Misc"].QueueTimers then
return
end
-- if not C["Misc"].QueueTimers then
-- return
-- end

Module:SetupPvEQueueTimer() -- PvE
Module:SetupPvPQueueTimer() -- PvP
-- Module:SetupPvEQueueTimer() -- PvE
-- Module:SetupPvPQueueTimer() -- PvP
end

Module:RegisterMisc("QueueTimer", Module.CreateQueueTimers)
-- Module:RegisterMisc("QueueTimer", Module.CreateQueueTimers)
26 changes: 24 additions & 2 deletions KkthnxUI/Modules/Skins/Blizzard/FrameXML/CharacterFrame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,32 @@ tinsert(C.defaultThemes, function()
CharacterHeadSlot:SetPoint("TOPLEFT", CharacterFrame.Inset, "TOPLEFT", 6, -6)
CharacterHandsSlot:SetPoint("TOPRIGHT", CharacterFrame.Inset, "TOPRIGHT", -6, -6)
CharacterMainHandSlot:SetPoint("BOTTOMLEFT", CharacterFrame.Inset, "BOTTOMLEFT", 176, 5)
CharacterSecondaryHandSlot:ClearAllPoints()
CharacterSecondaryHandSlot:SetPoint("BOTTOMRIGHT", CharacterFrame.Inset, "BOTTOMRIGHT", -176, 5)

CharacterModelScene:SetPoint("TOPLEFT", CharacterFrame.Inset, 4, -4)
CharacterModelScene:SetPoint("BOTTOMRIGHT", CharacterFrame.Inset, -4, 4)
CharacterModelScene:SetSize(300, 360)
CharacterModelScene:ClearAllPoints()
CharacterModelScene:SetPoint("TOPLEFT", CharacterFrame.Inset, 64, -3)

CharacterModelScene.GearEnchantAnimation.FrameFX.PurpleGlow:ClearAllPoints()
CharacterModelScene.GearEnchantAnimation.FrameFX.PurpleGlow:SetPoint("TOPLEFT", CharacterFrame.Inset, "TOPLEFT", -244, 102)
CharacterModelScene.GearEnchantAnimation.FrameFX.PurpleGlow:SetPoint("BOTTOMRIGHT", CharacterFrame.Inset, "BOTTOMRIGHT", 247, -103)

CharacterModelScene.GearEnchantAnimation.FrameFX.BlueGlow:ClearAllPoints()
CharacterModelScene.GearEnchantAnimation.FrameFX.BlueGlow:SetPoint("TOPLEFT", CharacterFrame.Inset, "TOPLEFT", -244, 102)
CharacterModelScene.GearEnchantAnimation.FrameFX.BlueGlow:SetPoint("BOTTOMRIGHT", CharacterFrame.Inset, "BOTTOMRIGHT", 247, -103)

CharacterModelScene.GearEnchantAnimation.FrameFX.Sparkles:ClearAllPoints()
CharacterModelScene.GearEnchantAnimation.FrameFX.Sparkles:SetPoint("TOPLEFT", CharacterFrame.Inset, "TOPLEFT", -244, 102)
CharacterModelScene.GearEnchantAnimation.FrameFX.Sparkles:SetPoint("BOTTOMRIGHT", CharacterFrame.Inset, "BOTTOMRIGHT", 247, -103)

CharacterModelScene.GearEnchantAnimation.FrameFX.Mask:ClearAllPoints()
CharacterModelScene.GearEnchantAnimation.FrameFX.Mask:SetPoint("TOPLEFT", CharacterFrame.Inset, "TOPLEFT", -244, 102)
CharacterModelScene.GearEnchantAnimation.FrameFX.Mask:SetPoint("BOTTOMRIGHT", CharacterFrame.Inset, "BOTTOMRIGHT", 247, -103)

CharacterModelScene.GearEnchantAnimation.TopFrame.Frame:ClearAllPoints()
CharacterModelScene.GearEnchantAnimation.TopFrame.Frame:SetPoint("TOPLEFT", CharacterFrame.Inset, "TOPLEFT", 2, -2)
CharacterModelScene.GearEnchantAnimation.TopFrame.Frame:SetPoint("BOTTOMRIGHT", CharacterFrame.Inset, "BOTTOMRIGHT", -2, 2)

hooksecurefunc(CharacterFrame, "UpdateSize", function()
if CharacterFrame.activeSubframe == "PaperDollFrame" then
Expand Down
13 changes: 8 additions & 5 deletions KkthnxUI/Modules/Skins/Blizzard/InspectUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ C.themes["Blizzard_InspectUI"] = function()
end

local GetInventoryItemLink = GetInventoryItemLink
local HideUIPanel = HideUIPanel
local IsCosmeticItem = IsCosmeticItem
local C_Item_IsCosmeticItem = C_Item.IsCosmeticItem
local PanelTemplates_GetSelectedTab = PanelTemplates_GetSelectedTab
local UnitClass = UnitClass
local hooksecurefunc = hooksecurefunc
Expand All @@ -20,6 +19,9 @@ C.themes["Blizzard_InspectUI"] = function()
InspectPaperDollItemsFrame.InspectTalents:SetPoint("TOPRIGHT", InspectFrame, "BOTTOMRIGHT", 0, -1)
end

InspectModelFrame:DisableDrawLayer("BACKGROUND")
InspectModelFrame:DisableDrawLayer("BORDER")
InspectModelFrame:DisableDrawLayer("OVERLAY")
InspectModelFrame:StripTextures(true)

local equipmentSlots = {
Expand Down Expand Up @@ -68,7 +70,7 @@ C.themes["Blizzard_InspectUI"] = function()
local function UpdateCosmetic(self)
local unit = InspectFrame.unit
local itemLink = unit and GetInventoryItemLink(unit, self:GetID())
self.IconOverlay:SetShown(itemLink and IsCosmeticItem(itemLink))
self.IconOverlay:SetShown(itemLink and C_Item_IsCosmeticItem(itemLink))
end

hooksecurefunc("InspectPaperDollItemSlotButton_Update", function(button)
Expand All @@ -91,8 +93,9 @@ C.themes["Blizzard_InspectUI"] = function()
InspectMainHandSlot:SetPoint("BOTTOMLEFT", InspectFrameInset, "BOTTOMLEFT", 176, 5)
InspectSecondaryHandSlot:SetPoint("BOTTOMRIGHT", InspectFrameInset, "BOTTOMRIGHT", -176, 5)

InspectModelFrame:SetPoint("TOPLEFT", InspectFrameInset, 4, -4)
InspectModelFrame:SetPoint("BOTTOMRIGHT", InspectFrameInset, -4, 4)
InspectModelFrame:SetSize(300, 360)
InspectModelFrame:ClearAllPoints()
InspectModelFrame:SetPoint("TOPLEFT", InspectFrameInset, 64, -3)

local function ApplyInspectFrameLayout()
local InspectFrame = InspectFrame
Expand Down

0 comments on commit 8c05ac3

Please sign in to comment.