Thread Tools Display Modes
01-29-15, 03:10 PM   #1
Fusie
A Defias Bandit
Join Date: Jan 2007
Posts: 2
Looking for help with a new addon

Disclaimer - I do not consider myself a coder or programmer, i am trying to learn as i go. hence i really do not know what i am doing.

That being said. I am attempting to make a plugin for Aurora and AtlasLoot. Mostly by following examples of other authors plugins.

I am under the impression that every part of these type of addons are "Hooking?" the origional addon to change the appearance.

Anywho, at this point i am 75% done with this addon, how ever i cannot for the life of me figure out how to hook? AtlasLoots drop downs at the top of the frame. They are "Local" functions, so my over used hooksecurefunction's throw errors, or do nothing at all in my quest to change the appearance.

The frame name is AtlasLoot-DropDown-CatFrame1 or 2

Currently i have tried
Lua Code:
  1. local ft = _G["AtlasLoot".."-".."DropDown".."-".."CatFrame1"]
  2.  local bg = CreateFrame("Frame", nil, ft)
  3.              bg:SetPoint("TOPLEFT")
  4.              bg:SetPoint("BOTTOMRIGHT")
  5.              bg:SetFrameLevel(ft:GetFrameLevel()-1)
  6.              F.CreateBD(bg, .25)

This results in the following error
Lua Code:
  1. 1x Aurora_AtlasLoot\core.lua:213: attempt to index local 'ft' (a nil value)
  2. Aurora_AtlasLoot\core.lua:213: in function <Aurora_AtlasLoot\core.lua:7>
  3.  
  4. Locals:

I have also tried countless variations of
Lua Code:
  1. hooksecurefunc(AtlasLoot.GUI, "loadModule", function()
  2. local ft = _G["AtlasLoot".."-".."DropDown".."-".."CatFrame1"]
  3.  local bg = CreateFrame("Frame", nil, ft)
  4.              bg:SetPoint("TOPLEFT")
  5.              bg:SetPoint("BOTTOMRIGHT")
  6.              bg:SetFrameLevel(ft:GetFrameLevel()-1)
  7.              F.CreateBD(bg, .25)
  8.              
  9.              ft:DisableDrawLayer("BACKGROUND")
  10.              ft:DisableDrawLayer("BORDER")
  11. end)         
  12.  
  13. end)

So here is where i am at with my current code ( i know its fugly)
Lua Code:
  1. if not IsAddOnLoaded("FreeUI") and not IsAddOnLoaded("Aurora") then return end
  2.  
  3. local F, C = unpack(Aurora)
  4.  
  5. local f = CreateFrame('Frame')
  6. f:RegisterEvent('ADDON_LOADED')
  7. f:SetScript('OnEvent', function(self, event, addon)
  8.     if addon == 'AtlasLoot' then return end
  9.     self:UnregisterEvent('ADDON_LOADED')   
  10.  
  11.      local r, g, b = C.r, C.g, C.b
  12.  
  13.      local af = _G["AtlasLoot_GUI".."-".."Frame"]
  14.      local bg = CreateFrame("Frame", nil, af)
  15.          bg:SetPoint("TOPLEFT")
  16.          bg:SetPoint("BOTTOMRIGHT")
  17.          bg:SetFrameLevel(af:GetFrameLevel()-1)
  18.          F.CreateBD(bg)
  19.    
  20.          af:DisableDrawLayer("BACKGROUND")
  21.          af:DisableDrawLayer("BORDER")
  22.          
  23.          F.CreateBD(af.titleFrame, .25)
  24.          
  25.      local aif =  _G["AtlasLoot_GUI".."-".."ItemFrame"]  
  26.      local bg = CreateFrame("Frame", nil, aif)
  27.          bg:SetPoint("TOPLEFT")
  28.          bg:SetPoint("BOTTOMRIGHT")
  29.          bg:SetFrameLevel(aif:GetFrameLevel()-1)
  30.    
  31.          aif:DisableDrawLayer("BACKGROUND")
  32.          aif:DisableDrawLayer("BORDER")  
  33.          
  34.          F.ReskinArrow(aif.nextPageButton, "right")
  35.          aif.nextPageButton:SetSize(20, 20)
  36.          F.ReskinArrow(aif.prevPageButton, "left")
  37.          aif.prevPageButton:SetSize(20, 20)
  38.          
  39.          F.Reskin(aif.modelButton)
  40.          F.Reskin(aif.soundsButton)
  41.          F.Reskin(aif.itemsButton)
  42.          F.ReskinClose(af.CloseButton)
  43.  
  44.          aif.mapButton.highlight:SetVertexColor(r, g, b, .25)
  45.          aif.mapButton.texture:SetTexture("Interface\\Addons\\Aurora_AtlasLoot\\Icons\\UI-QuestMap_Button")
  46.        
  47.      local alsb = _G["AtlasLoot".."-".."Select".."-".."1".."-".."scrollbar"]     
  48.          F.ReskinScroll(alsb)
  49.          
  50.      for i = 1, 3, 1 do  
  51.          local as = _G["AtlasLoot".."-".."Select".."-"..i] 
  52.          if as then
  53.      
  54.          local bg = CreateFrame("ScrollFrame", nil, as)
  55.              bg:SetPoint("TOPLEFT")
  56.              bg:SetPoint("BOTTOMRIGHT")
  57.              bg:SetFrameLevel(as:GetFrameLevel()-1)
  58.              F.CreateBD(bg, .25)   
  59.  
  60.              as:DisableDrawLayer("BACKGROUND")
  61.              as:DisableDrawLayer("BORDER")
  62.          end
  63.      end
  64.      
  65.      for i = 1, 2, 1 do  
  66.          local ad = _G["AtlasLoot".."-".."DropDown".."-"..i]
  67.          if ad then
  68.          local bg = CreateFrame("Frame", nil, ad)
  69.              bg:SetPoint("TOPLEFT")
  70.              bg:SetPoint("BOTTOMRIGHT")
  71.              bg:SetFrameLevel(ad:GetFrameLevel()-1)
  72.              F.CreateBD(bg, .25)
  73.              ad:SetHeight(18)
  74.              ad:DisableDrawLayer("BACKGROUND")
  75.              ad:DisableDrawLayer("BORDER")
  76.              
  77.              F.ReskinArrow(ad.button, "down")
  78.              ad.button:SetPoint("RIGHT", ad, "RIGHT", 0, 0)
  79.          end
  80.      end
  81.      
  82.      for i = 1, 30, 1 do
  83.         local button = _G["AtlasLoot_Button_"..i]
  84.         if button then
  85.              F.ReskinIcon(button.icon)
  86.              button:DisableDrawLayer("OVERLAY")
  87.          end
  88.      end  
  89.      
  90.      for i = 1, 30, 1 do
  91.         local button = _G["AtlasLoot_Button_"..i.."_secButton"]
  92.         if button then
  93.              F.ReskinIcon(button.icon)
  94.              button:DisableDrawLayer("OVERLAY")
  95.          end
  96.      end  
  97.      
  98. hooksecurefunc(AtlasLoot.GUI.SoundFrame, "Create", function()
  99.      
  100.          local asf = _G["AtlasLoot_GUI".."-".."SoundFrame"]
  101.        
  102.          local bg = CreateFrame("Frame", nil, asf)
  103.              bg:SetPoint("TOPLEFT")
  104.              bg:SetPoint("BOTTOMRIGHT")
  105.              bg:SetFrameLevel(asf:GetFrameLevel()-1)
  106.              
  107.              asf:DisableDrawLayer("BACKGROUND")
  108.              asf:DisableDrawLayer("BORDER")
  109.              
  110.              F.ReskinScroll(asf.scrollbar)
  111.              
  112.      for i=1, 15, 1 do       
  113.          local asfb = _G["AtlasLoot".."-".."SoundButton"..i]
  114.          if asf then
  115.          local bg = CreateFrame("Frame", nil, asfb)
  116.              bg:SetPoint("TOPLEFT")
  117.              bg:SetPoint("BOTTOMRIGHT")
  118.              bg:SetFrameLevel(asfb:GetFrameLevel()-1)
  119.              F.CreateBD(bg, .25)
  120.              
  121.              asfb:DisableDrawLayer("BACKGROUND")
  122.              asfb:DisableDrawLayer("BORDER")
  123.              
  124.              F.ReskinExpandOrCollapse(asfb.collapse)
  125.              asfb.collapse:SetPushedTexture(nil)
  126.              asfb.collapse:SetHighlightTexture(nil)
  127.              F.ReskinArrow(asfb.play, "right")
  128.              
  129.              F.Reskin(asfb.stop)
  130.              asfb.stop:SetSize(18, 18)
  131.              local tex = asfb.stop:CreateTexture(nil, "ARTWORK")
  132.              tex:SetTexture("Interface\\Addons\\Aurora_AtlasLoot\\Icons\\stop.tga")
  133.              tex:SetSize(8, 8)
  134.              tex:SetPoint("CENTER")
  135.              f.tex = tex
  136.              
  137.              
  138.              
  139.          end
  140.      end
  141.  end)
  142.  
  143. local Item = AtlasLoot.Button:AddType("Item", "i")     
  144. hooksecurefunc(Item, "ShowQuickDressUp", function(self)
  145.  
  146.          local iframe = _G["AtlasLoot-SetToolTip-ModelFrame"]
  147.          iframe:SetBackdrop({bgFile = "Interface/Tooltips/UI-Tooltip-Background",
  148.                         edgeFile = "Interface/Tooltips/UI-Tooltip-Background",
  149.                         edgeSize = 1})
  150.          iframe:SetBackdropColor(0,0,0)
  151.          iframe:SetBackdropBorderColor(0,0,0)
  152.  
  153.          iframe = Item.previewTooltipFrame
  154.                
  155. end)
  156.  
  157. local Set = AtlasLoot.Button:AddType("Set", "set")
  158. hooksecurefunc(Set, "ShowToolTipFrame", function(self)
  159.  
  160.          local frame = _G["AtlasLoot-SetToolTip-ModelFrame"]
  161.          frame:SetBackdrop({bgFile = "Interface/Tooltips/UI-Tooltip-Background",
  162.                         edgeFile = "Interface/Tooltips/UI-Tooltip-Background",
  163.                         edgeSize = 1})
  164.          frame:SetBackdropColor(0,0,0)
  165.          frame:SetBackdropBorderColor(0,0,0)
  166.        
  167.          frame = Set.tooltipFrame
  168.        
  169. end)     
  170.  
  171. local Mount = AtlasLoot.Button:AddType("Mount", "mount")
  172. hooksecurefunc(Mount, "ShowToolTipFrame", function(button)
  173.          local amt = _G["AtlasLoot".."-".."MountToolTip"]
  174.          amt:SetBackdrop({bgFile = "Interface/Tooltips/UI-Tooltip-Background",
  175.                         edgeFile = "Interface/Tooltips/UI-Tooltip-Background",
  176.                         edgeSize = 1})
  177.          amt:SetBackdropColor(0,0,0)
  178.          amt:SetBackdropBorderColor(0,0,0)
  179. end)
  180.  
  181. local Pet = AtlasLoot.Button:AddType("Pet", "pet")       
  182. hooksecurefunc(Pet, "ShowToolTipFrame", function(button)
  183.          local apt = _G["AtlasLoot".."-".."PetToolTip"]
  184.          apt:SetBackdrop({bgFile = "Interface/Tooltips/UI-Tooltip-Background",
  185.                         edgeFile = "Interface/Tooltips/UI-Tooltip-Background",
  186.                         edgeSize = 1})
  187.          apt:SetBackdropColor(0,0,0)
  188.          apt:SetBackdropBorderColor(0,0,0)
  189. end)
  190.  
  191. local Faction = AtlasLoot.Button:AddType("Faction", "f")
  192. hooksecurefunc(Faction, "ShowToolTipFrame", function(button)
  193.          local aft = _G["AtlasLoot".."-".."FactionToolTip"]
  194.          aft:SetBackdrop({bgFile = "Interface/Tooltips/UI-Tooltip-Background",
  195.                         edgeFile = "Interface/Tooltips/UI-Tooltip-Background",
  196.                         edgeSize = 1})
  197.          aft:SetBackdropColor(0,0,0,.50)
  198.          aft:SetBackdropBorderColor(0,0,0)
  199.          
  200.          aft.standing:SetBackdrop({bgFile = "Interface/Tooltips/UI-Tooltip-Background",
  201.                         edgeFile = "Interface/Tooltips/UI-Tooltip-Background",
  202.                         edgeSize = 1})
  203.          aft.standing:SetBackdropColor(0,0,0,.25)
  204.          aft.standing:SetBackdropBorderColor(0,0,0)
  205.          aft.standing.bar:SetStatusBarTexture(C.media.backdrop)
  206.          
  207. end)
  208. -hooksecurefunc(AtlasLoot.GUI, "loadModule", function()
  209. local ft = _G["AtlasLoot".."-".."DropDown".."-".."CatFrame1"]
  210.  local bg = CreateFrame("Frame", nil, ft)
  211.              bg:SetPoint("TOPLEFT")
  212.              bg:SetPoint("BOTTOMRIGHT")
  213.              bg:SetFrameLevel(ft:GetFrameLevel()-1)
  214.              F.CreateBD(bg, .25)
  215.              
  216.              ft:DisableDrawLayer("BACKGROUND")
  217.              ft:DisableDrawLayer("BORDER")
  218. end)         
  219.  
  220. end)

Here is the code from AtlasLoot Template_Dropdown.lua that has the frame i am after.
Lua Code:
  1. local function CreateCategory(dropdown, catTab, parent)
  2.         local frame = GetFromCache("frames")
  3.         if not frame then
  4.             CAT_FRAME_COUNT = CAT_FRAME_COUNT + 1
  5.             local frameName = "AtlasLoot-DropDown-CatFrame"..CAT_FRAME_COUNT
  6.            
  7.             frame = CreateFrame("Frame", frameName)
  8.             frame:EnableMouse(true)
  9.             frame:SetBackdrop(ALPrivate.BOX_BORDER_BACKDROP)
  10.                            
  11.             frame.label = frame:CreateFontString(frameName.."-label", "ARTWORK", "GameFontNormalSmall")
  12.             frame.label:SetPoint("TOP", frame, "TOP", 0, -5)
  13.             --frame.label:SetHeight(15)
  14.             frame.label:SetText(frameName.."-label")
  15.            
  16.             frame.buttons = {}
  17.             frame.info = nil
  18.             frame.type = "frame"
  19.         end
  20.         count_cats_created = count_cats_created + 1
  21.         catTab.index = count_cats_created
  22.         cat_height[catTab.index] = 10
  23.         cat_width[catTab.index] = dropdown.frame:GetWidth()
  24.         frame.info = catTab.info
  25.        
  26.         frame:ClearAllPoints()
  27.         frame:SetParent(dropdown.frame)
  28.         frame:SetFrameStrata("TOOLTIP")
  29.         if parent and type(parent) == "number" and parent ~= 1 then
  30.             frame:SetPoint("TOPLEFT", frameContainer[#frameContainer], "BOTTOMLEFT")
  31.         elseif parent and type(parent) == "table" and parent.type then
  32.             if parent.type == "frame" then
  33.                 frame:SetPoint("TOPLEFT", parent, "BOTTOMLEFT")
  34.             elseif parent.type == "button" then
  35.                 frame:SetPoint("TOPLEFT", parent, "TOPRIGHT", 15, 0)
  36.             end
  37.         else
  38.             frame:SetPoint("TOPLEFT", dropdown.frame, "BOTTOMLEFT")
  39.         end
  40.  
  41.         if catTab.info and catTab.info.name then
  42.             frame.label:SetText(catTab.info.name)
  43.             frame.label:Show()
  44.             cat_height[catTab.index] = cat_height[catTab.index] + frame.label:GetHeight() + 5 -- with spacing
  45.             RefreshCatWidth(catTab.index, frame.label:GetWidth() + 20)
  46.         else
  47.             frame.label:Hide()
  48.         end
  49.  
  50.         if catTab.info.textColor then
  51.             frame.label:SetTextColor(catTab.info.textColor[1] or 0, catTab.info.textColor[2] or 0, catTab.info.textColor[3] or 0)
  52.         else
  53.             frame.label:SetTextColor(1, 0.82, 0)
  54.         end
  55.        
  56.         if catTab.info.bgColor then
  57.             frame:SetBackdropColor(catTab.info.bgColor[1] or 0, catTab.info.bgColor[2] or 0, catTab.info.bgColor[3] or 0, catTab.info.bgColor[4] or 1)
  58.         else
  59.             frame:SetBackdropColor(0, 0, 0, 1)
  60.         end
  61.        
  62.         for i = 1, #catTab do
  63.             frame.buttons[i] = CreateButton(dropdown, frame, catTab[i], catTab.index)
  64.         end
  65.        
  66.         if cat_width[catTab.index] > frame:GetWidth() then
  67.             for i = 1, #frame.buttons do
  68.                 frame.buttons[i]:SetWidth(cat_width[catTab.index]-10)
  69.             end
  70.         end
  71.         frame:SetWidth(cat_width[catTab.index])
  72.         frame:SetHeight(cat_height[catTab.index])
  73.         frame:Show()
  74.        
  75.         frameContainer[#frameContainer+1] = frame
  76.     end
  77.  
  78.     function GenerateButtonFrame(dropdown, clear)
  79.         if not clear and (not dropdown or not dropdown.data) then return end
  80.         wipe(Button_Id_List)
  81.         if LIST_IS_OPEN or clear then
  82.             ClearFrameContainer()
  83.             if LIST_IS_OPEN == dropdown or clear then
  84.                 LIST_IS_OPEN = nil
  85.                 return
  86.             end
  87.         end
  88.  
  89.         LIST_IS_OPEN = dropdown
  90.         for i = 1, #dropdown.data do
  91.             CreateCategory(dropdown, dropdown.data[i], i)
  92.         end
  93.     end
  94. end

so yeah .. im stuck. Any help here would be greatly appreciated.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Looking for help with a new addon


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off