Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local _, cfg = ... --import config
- local addon, ns = ... --get addon namespace
- local _G = _G -- import globals for faster usage
- for i = 1, 2 do
- select(i, _G["LootFrame"]:GetRegions()):SetAlpha(0)
- end
- --_G["LootCloseButton"]:Hide() -- cba lol
- _G["LootFramePortraitOverlay"]:SetAlpha(0)
-
- local LootBG = CreateFrame('Frame', nil, _G["LootFrame"])
- LootBG:SetPoint('TOPLEFT', 1, -1)
- LootBG:SetPoint('RIGHT', -1, 1)
- LootBG:SetFrameStrata("LOW")
- LootBG:SetBackdrop({
- bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
- insets = {top = 12, left = 15, bottom = 6, right = 66},
- })
- LootBG:SetBackdropColor(unpack(cfg.bColor))
- CreateBorder(LootBG, 12, 1, 1, 1, -14, -11, -65, -11, -14, -6, -65, -6)
- for i = 1, 4 do
- for _, lootfont in pairs({
- _G['LootButton'..i..'Text'],
- }) do
- lootfont:SetFont(cfg.font, 12, cfg.style)
- end
- for _, lootcount in pairs({
- _G['LootButton'..i..'Count'],
- }) do
- lootcount:SetFont(cfg.font, 12, cfg.style)
- lootcount:SetPoint('BOTTOMRIGHT', -2, 3) -- place the count text where its more seenable.
- end
- end
- hooksecurefunc("LootFrame_UpdateButton", function(index)
- local texture, item, quantity, quality, locked, isQuestItem, questId, isActive = GetLootSlotInfo(index)
- CreateBorder(_G["LootButton"..index], 12, 1, 1, 1, 1)
- _G["LootButton"..index.."IconQuestTexture"]:SetAlpha(0) -- hide that pesky quest item texture
- _G["LootButton"..index.."NameFrame"]:SetAlpha(0) -- hide sucky fagdrops :D
- --if isQuestItem then
- -- ColorBorder(_G["LootButton"..index], unpack(AftermathhUI.loot.questitemcolor))
- --else
- ColorBorder(_G["LootButton"..index], 1,1,1)
- --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", -12, -19.5)
- 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)
- 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") -- fuck 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
- if cfg.AutoAcceptDERoll then --module control
- --Thanks tekkub for tekKrush
- local f = CreateFrame("Frame")
- f:RegisterEvent("CONFIRM_LOOT_ROLL")
- f:SetScript("OnEvent", function(self, event, id, rollType)
- for i=1,STATICPOPUP_NUMDIALOGS do
- local frame = _G["StaticPopup"..i]
- if frame.which == "CONFIRM_LOOT_ROLL" and frame.data == id and frame.data2 == rollType and frame:IsVisible() then StaticPopup_OnClick(frame, 1) end
- end
- end)
- end
- if cfg.debug then
- --load message
- local frame=CreateFrame("Frame")
- local elapsed=0
- local NUMBER_OF_SECONDS_TO_WAIT= 12
- frame:SetScript("OnUpdate", function (self, delta)
- elapsed = elapsed+delta
- if elapsed > NUMBER_OF_SECONDS_TO_WAIT then
- self:SetScript("OnUpdate", nil)
- print("BobUI: Loot Loaded")
- end
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement