Hey guys and girls, requesting some help.
I've re-written !beautyLoot to fit my own visual style and needs, but I can't for the love of god move it. Here's the LUA for those willing to give a hand
Ps. As you'll see in the code I've tried positioning the lootframe with ClearAllPoints() and then SetPoint(), but it isn't working. Below is a screenshot of where it spawns aswell.
Also, the lootframe is draggable when spawned, I can't remember if this is default by Blizzard because it's been years since I used the default UI. If it isn't, could that be what is interfering with me changing spawnpoint?
Code:
local _G = _G
-- LerbLoot, by Lerb @ WoWInterface.com
-- Original code taken from "AftermathhUI" by Game92 @ WoWInterface.com
----------------------
-- Move closebutton --
----------------------
_G["LootCloseButton"]:ClearAllPoints()
_G["LootCloseButton"]:SetPoint('TOPRIGHT', _G['LootFrame'], 'TOPRIGHT', -69, -10)
--------------------
-- Move lootitems --
--------------------
_G["LootButton1"]:ClearAllPoints()
_G['LootButton1']:SetPoint('TOPLEFT', _G['LootFrame'], 'TOPLEFT', 9, -34)
----------------------------
-- Hide fugly 2D portrait --
----------------------------
_G["LootFramePortraitOverlay"]:SetAlpha(0)
------------------------
-- Move the lootframe --
------------------------
_G["LootFrame"]:ClearAllPoints()
_G["LootFrame"]:SetPoint('TOPLEFT', UIparent, 50, -230)
--------------------------------------
-- Create our own stylish lootframe --
--------------------------------------
local LootBG = CreateFrame('Frame', nil, _G["LootFrame"])
LootBG:SetPoint('TOPLEFT', 1, -1)
LootBG:SetPoint('RIGHT', -1, 1)
LootBG:SetFrameStrata("LOW")
LootBG:SetBackdrop({
bgFile = LeUI.media.blank,
insets = {top = 12, left = 2, bottom = 4, right = 70},
})
LootBG:SetBackdropColor(unpack(LeUI.media.backdropcolor))
CreateBorderLight(LootBG, LeUI.media.bordersize, LeUI.bordercolor, LeUI.bordercolor, LeUI.bordercolor, -1, -11, -70, -11, -1, -2, -70, -2)
--------------------------------------------
-- Change font for lootname and lootcount --
--------------------------------------------
for i = 1, 4 do
for _, lootfont in pairs({
_G['LootButton'..i..'Text'],
}) do
lootfont:SetFont(LeUI.media.font, 12, LeUI.media.fontflag)
end
for _, lootcount in pairs({
_G['LootButton'..i..'Count'],
}) do
lootcount:SetFont(LeUI.media.font, 12, LeUI.media.fontflag)
lootcount:SetPoint('BOTTOMRIGHT', -2, 3)
end
end
---------------------------------------------------------------------
-- Change borders for lootitems and set bordercolor for questitems --
---------------------------------------------------------------------
hooksecurefunc("LootFrame_UpdateButton", function(index)
local texture, item, quantity, quality, locked, isQuestItem, questId, isActive = GetLootSlotInfo(index)
CreateBorderLight(_G["LootButton"..index], LeUI.media.bordersize, LeUI.bordercolor, LeUI.bordercolor, LeUI.bordercolor, 1)
_G["LootButton"..index.."IconQuestTexture"]:SetAlpha(0) -- Hides quest item texture
_G["LootButton"..index.."NameFrame"]:SetAlpha(0) -- Hides frame behind lootname
if isQuestItem then
ColorBorder(_G["LootButton"..index], 1.0, 0.82, 0)
else
ColorBorder(_G["LootButton"..index], LeUI.bordercolor, LeUI.bordercolor, LeUI.bordercolor)
end
end)
------------------------------------------------------------------------------------------------------------
-- Improved Loot Frame - http://www.curse.com/addons/wow/improved-loot-frame -- by Cybeloras of Mal'Ganis --
------------------------------------------------------------------------------------------------------------
-- Woah, nice coding, blizz. Anchor something positioned at the top of the frame to the center of the frame instead, and make it an anonymous font string so I have to work to find it
local i, t = 1, "Interface\\LootFrame\\UI-LootPanel"
while true do
local r = select(i, _G["LootFrame"]:GetRegions())
if not r then break end
if r.GetText and r:GetText() == ITEMS then
r:ClearAllPoints()
r:SetPoint("TOP", -32, -18)
elseif r.GetTexture and r:GetTexture() == t then
r:Hide()
end
i = i + 1
end
local p, r, x, y = "TOP", "BOTTOM", 0, -4
local buttonHeight = _G["LootButton1"]:GetHeight() + abs(y)
local baseHeight = _G["LootFrame"]:GetHeight() - (buttonHeight * LOOTFRAME_NUMBUTTONS) - 50
local old_LootFrame_Show = LootFrame_Show
function LootFrame_Show(self, ...)
_G["LootFrame"]:SetHeight(baseHeight + (GetNumLootItems() * buttonHeight))
local num = GetNumLootItems()
for i = 1, GetNumLootItems() do
if i > LOOTFRAME_NUMBUTTONS then
if not _G["LootButton"..i] then
_G["LootButton"..i] = CreateFrame("Button", "LootButton"..i, LootFrame, "LootButtonTemplate", i)
end
LOOTFRAME_NUMBUTTONS = i
end
if i > 1 then
_G["LootButton"..i]:ClearAllPoints()
_G["LootButton"..i]:SetPoint(p, "LootButton"..(i-1), r, x, y)
end
end
return old_LootFrame_Show(self, ...)
end
-------------------------------------------------------------------------------------------------------
-- The following is inspired by http://us.battle.net/wow/en/forum/topic/2353268564 and is hacktastic --
-------------------------------------------------------------------------------------------------------
local framesRegistered = {}
local function populateframesRegistered(...)
wipe(framesRegistered)
for i = 1, select("#", ...) do
framesRegistered[i] = select(i, ...)
end
end
local old_LootButton_OnClick = LootButton_OnClick
function LootButton_OnClick(self, ...)
populateframesRegistered(GetFramesRegisteredForEvent("ADDON_ACTION_BLOCKED"))
for i, frame in pairs(framesRegistered) do
frame:UnregisterEvent("ADDON_ACTION_BLOCKED") -- F*ck the rice-a-roni! (Blizzard throws a false taint error when attemping to loot the coins from a mob when the coins are the only loot on the mob)
end
old_LootButton_OnClick(self, ...)
for i, frame in pairs(framesRegistered) do
frame:RegisterEvent("ADDON_ACTION_BLOCKED")
end
end