Advertisement
Guest User

Untitled

a guest
Apr 26th, 2013
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.32 KB | None | 0 0
  1. local _, cfg = ... --import config
  2. local addon, ns = ... --get addon namespace
  3.  
  4. local _G = _G -- import globals for faster usage
  5.  
  6. for i = 1, 2 do
  7.     select(i, _G["LootFrame"]:GetRegions()):SetAlpha(0)
  8. end
  9. --_G["LootCloseButton"]:Hide() -- cba lol
  10. _G["LootFramePortraitOverlay"]:SetAlpha(0)
  11.   
  12. local LootBG = CreateFrame('Frame', nil, _G["LootFrame"])
  13. LootBG:SetPoint('TOPLEFT', 1, -1)
  14. LootBG:SetPoint('RIGHT', -1, 1)
  15. LootBG:SetFrameStrata("LOW")  
  16. LootBG:SetBackdrop({      
  17.     bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
  18.   insets = {top = 12, left = 15, bottom = 6, right = 66},
  19. })
  20. LootBG:SetBackdropColor(unpack(cfg.bColor))
  21. CreateBorder(LootBG, 12, 1, 1, 1, -14, -11, -65, -11, -14, -6, -65, -6)
  22.  
  23. for i = 1, 4 do
  24.     for _, lootfont in pairs({
  25.        _G['LootButton'..i..'Text'],
  26.     }) do
  27.         lootfont:SetFont(cfg.font, 12, cfg.style)
  28.     end
  29.   for _, lootcount in pairs({
  30.       _G['LootButton'..i..'Count'],
  31.   }) do
  32.       lootcount:SetFont(cfg.font, 12, cfg.style)
  33.     lootcount:SetPoint('BOTTOMRIGHT', -2, 3) -- place the count text where its more seenable.
  34.   end
  35. end
  36.  
  37. hooksecurefunc("LootFrame_UpdateButton", function(index)
  38.   local texture, item, quantity, quality, locked, isQuestItem, questId, isActive = GetLootSlotInfo(index)
  39.   CreateBorder(_G["LootButton"..index],  12, 1, 1, 1, 1)
  40.   _G["LootButton"..index.."IconQuestTexture"]:SetAlpha(0) -- hide that pesky quest item texture
  41.   _G["LootButton"..index.."NameFrame"]:SetAlpha(0) -- hide sucky fagdrops :D
  42.   --if isQuestItem then
  43.   --    ColorBorder(_G["LootButton"..index], unpack(AftermathhUI.loot.questitemcolor))
  44.   --else
  45.         ColorBorder(_G["LootButton"..index], 1,1,1)  
  46.   --end  
  47. end)
  48.  
  49. ------------------------------------------------------------------------------------------------------------
  50. -- Improved Loot Frame - http://www.curse.com/addons/wow/improved-loot-frame -- by Cybeloras of Mal'Ganis --
  51. ------------------------------------------------------------------------------------------------------------
  52.  
  53. -- 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
  54. local i, t = 1, "Interface\\LootFrame\\UI-LootPanel"
  55. while true do
  56.   local r = select(i, _G["LootFrame"]:GetRegions())
  57.   if not r then break end
  58.   if r.GetText and r:GetText() == ITEMS then
  59.     r:ClearAllPoints()
  60.     r:SetPoint("TOP", -12, -19.5)
  61.   elseif r.GetTexture and r:GetTexture() == t then
  62.     r:Hide()
  63.   end
  64.   i = i + 1
  65. end
  66.  
  67. local p, r, x, y = "TOP", "BOTTOM", 0, -4
  68. local buttonHeight = _G["LootButton1"]:GetHeight() + abs(y)
  69. local baseHeight = _G["LootFrame"]:GetHeight() - (buttonHeight * LOOTFRAME_NUMBUTTONS)
  70.  
  71. local old_LootFrame_Show = LootFrame_Show
  72. function LootFrame_Show(self, ...)
  73.   _G["LootFrame"]:SetHeight(baseHeight + (GetNumLootItems() * buttonHeight))
  74.   local num = GetNumLootItems()
  75.   for i = 1, GetNumLootItems() do
  76.     if i > LOOTFRAME_NUMBUTTONS then
  77.       if not _G["LootButton"..i] then
  78.         _G["LootButton"..i] = CreateFrame("Button", "LootButton"..i, LootFrame, "LootButtonTemplate", i)
  79.       end
  80.       LOOTFRAME_NUMBUTTONS = i
  81.     end
  82.     if i > 1 then
  83.       _G["LootButton"..i]:ClearAllPoints()
  84.       _G["LootButton"..i]:SetPoint(p, "LootButton"..(i-1), r, x, y)
  85.     end
  86.   end
  87.   
  88.   return old_LootFrame_Show(self, ...)
  89. end
  90.  
  91. -- the following is inspired by http://us.battle.net/wow/en/forum/topic/2353268564 and is hacktastic
  92. local framesRegistered = {}
  93. local function populateframesRegistered(...)
  94.   wipe(framesRegistered)
  95.   for i = 1, select("#", ...) do
  96.     framesRegistered[i] = select(i, ...)
  97.   end
  98. end
  99.  
  100. local old_LootButton_OnClick = LootButton_OnClick
  101. function LootButton_OnClick(self, ...)
  102.   populateframesRegistered(GetFramesRegisteredForEvent("ADDON_ACTION_BLOCKED"))
  103.   
  104.   for i, frame in pairs(framesRegistered) do
  105.     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)
  106.   end
  107.   old_LootButton_OnClick(self, ...)
  108.   
  109.   for i, frame in pairs(framesRegistered) do
  110.     frame:RegisterEvent("ADDON_ACTION_BLOCKED")
  111.   end
  112. end
  113.  
  114. if cfg.AutoAcceptDERoll then --module control
  115.   --Thanks tekkub for tekKrush
  116.   local f = CreateFrame("Frame")
  117.   f:RegisterEvent("CONFIRM_LOOT_ROLL")
  118.   f:SetScript("OnEvent", function(self, event, id, rollType)
  119.     for i=1,STATICPOPUP_NUMDIALOGS do
  120.       local frame = _G["StaticPopup"..i]
  121.       if frame.which == "CONFIRM_LOOT_ROLL" and frame.data == id and frame.data2 == rollType and frame:IsVisible() then StaticPopup_OnClick(frame, 1) end
  122.     end
  123.   end)
  124. end
  125.  
  126. if cfg.debug then
  127. --load message
  128. local frame=CreateFrame("Frame")
  129. local elapsed=0
  130. local NUMBER_OF_SECONDS_TO_WAIT= 12
  131. frame:SetScript("OnUpdate", function (self, delta)
  132.   elapsed = elapsed+delta
  133.   if elapsed > NUMBER_OF_SECONDS_TO_WAIT then
  134.     self:SetScript("OnUpdate", nil)
  135.     print("BobUI: Loot Loaded")
  136.   end
  137. end)
  138. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement