Add files via upload
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
local _G = ShaguTweaks.GetGlobalEnv()
|
||||
local T = ShaguTweaks.T
|
||||
|
||||
local module = ShaguTweaks:register({
|
||||
title = T["Loot Cursor"],
|
||||
description = T["Positions the loot window directly under your cursor so you can loot without moving your mouse."],
|
||||
expansions = { ["vanilla"] = true, ["tbc"] = nil },
|
||||
category = T["General"],
|
||||
enabled = true,
|
||||
order = 44,
|
||||
})
|
||||
|
||||
module.enable = function(self)
|
||||
local loot = CreateFrame("Frame", "ShaguTweaksLoot", LootFrame)
|
||||
|
||||
loot:SetScript("OnUpdate", function()
|
||||
if GetNumLootItems() == 0 then HideUIPanel(LootFrame) return end
|
||||
local x, y = GetCursorPosition()
|
||||
local s = LootFrame:GetEffectiveScale()
|
||||
x, y = x / s, y / s
|
||||
for i = 1, LOOTFRAME_NUMBUTTONS do
|
||||
local button = getglobal("LootButton"..i)
|
||||
if button:IsVisible() then
|
||||
if loot.last_button ~= button then
|
||||
local button_offset = (i-1) * button:GetHeight()
|
||||
LootFrame:ClearAllPoints()
|
||||
LootFrame:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", x - 40, y + 100 + button_offset)
|
||||
loot.last_button = button
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
loot:SetScript("OnShow", function()
|
||||
loot.last_button = nil
|
||||
end)
|
||||
end
|
||||
Reference in New Issue
Block a user