Thread Tools Display Modes
07-20-16, 12:03 PM   #1
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
Bag Issue

Hi, so with the new patch out my bag addon there's some small issues it's lagging/almos freezing when i'm opening them can anyone help me out what's wrong?

Lua Code:
  1. local _G = _G -- import globals for faster usage
  2.  
  3. for i = 1, 12 do
  4.     _G["ContainerFrame"..i.."CloseButton"]:SetAlpha(0)
  5.     for p = 1, 7 do
  6.         select(p, _G["ContainerFrame"..i]:GetRegions()):SetAlpha(0)
  7.     end
  8. end
  9. _G["BackpackTokenFrame"]:GetRegions():SetAlpha(0)
  10.  
  11. local ContainerFrame1bg = CreateFrame('Frame', nil, _G['ContainerFrame1'])     
  12. ContainerFrame1bg:SetPoint('TOPLEFT', 8, -9)
  13. ContainerFrame1bg:SetPoint('BOTTOMRIGHT', -4, 3)
  14. ContainerFrame1bg:SetFrameStrata("HIGH")
  15. ContainerFrame1bg:SetFrameLevel(4)
  16. ContainerFrame1bg:SetBackdrop({
  17.     bgFile = AftermathhUI.media.blank,
  18.     insets = {top = 5, left = 1, bottom = 1, right = 1},
  19. })
  20. ContainerFrame1bg:SetBackdropColor(0,0,0,0.50)
  21.  
  22. local BagFramez = {'ContainerFrame2', 'ContainerFrame3', 'ContainerFrame4', 'ContainerFrame5', 'ContainerFrame6', 'ContainerFrame7', 'ContainerFrame8',  'ContainerFrame9', 'ContainerFrame10', 'ContainerFrame11', 'ContainerFrame12'}
  23. for i = 1, getn(BagFramez) do
  24.     local ContainerFramebg = CreateFrame('Frame', nil, _G[BagFramez[i]])
  25.     ContainerFramebg:SetPoint('TOPLEFT', 8, -4)
  26.     ContainerFramebg:SetPoint('BOTTOMRIGHT', -4, 3)
  27.     ContainerFramebg:SetFrameStrata("HIGH")
  28.     ContainerFramebg:SetFrameLevel(4)
  29.     ContainerFramebg:SetBackdrop({
  30.         bgFile = AftermathhUI.media.blank,
  31.         insets = {top = 17, left = 1, bottom = 1, right = 1},
  32.     })
  33.     ContainerFramebg:SetBackdropColor(0,0,0,0.50)
  34.  
  35.  
  36. hooksecurefunc("ContainerFrame_GenerateFrame", function(frame)
  37.     local name = frame:GetName();
  38.     for i = 1, MAX_CONTAINER_ITEMS do
  39.      
  40.         _G[name.."Item"..i]:SetFrameStrata("HIGH")
  41.         _G[name.."Item"..i]:SetFrameLevel(5)
  42.         _G[name.."Item"..i]:SetBackdrop({
  43.             bgFile = AftermathhUI.media.backdrop,
  44.             insets = {top = -1, left = -1, bottom = -1, right = -1},
  45.         })
  46.         _G[name.."Item"..i]:SetNormalTexture("")
  47.         _G[name.."Item"..i.."IconQuestTexture"]:SetAlpha(0)
  48.         _G[name.."Item"..i.."Count"]:SetPoint('BOTTOMRIGHT', -3, 3)
  49.     end
  50. end)
  51.  
  52. for _, frame in pairs({
  53.     _G["ContainerFrame1MoneyFrameGoldButton"],_G["ContainerFrame1MoneyFrameSilverButton"],_G["ContainerFrame1MoneyFrameCopperButton"],_G["BankFrameMoneyFrameGoldButton"],_G["BankFrameMoneyFrameSilverButton"],_G["BankFrameMoneyFrameCopperButton"],
  54. }) do
  55.     frame:SetFrameStrata("HIGH")
  56.     frame:SetFrameLevel(10)
  57. end
  58.  
  59. for i = 1, 3 do
  60.     _G["BackpackTokenFrameToken"..i]:SetFrameStrata("HIGH")
  61.     _G["BackpackTokenFrameToken"..i]:SetFrameLevel(5)
  62.     _G["BackpackTokenFrameToken"..i.."Icon"]:SetTexCoord(.08, .92, .08, .92)
  63. end
  64.  
  65. for _, frame in pairs({
  66.     _G["BagItemSearchBox"],
  67. }) do
  68.     frame:SetFrameLevel(5)
  69.     frame:SetFrameStrata("HIGH")
  70.     frame:SetBackdrop({
  71.         bgFile = AftermathhUI.media.blank,
  72.         insets = {top = -1, left = -6, bottom = -1, right = -1},
  73.     })
  74.     frame:SetBackdropColor(.21, .21, .21)
  75.  
  76. end
  77.  
  78. _G["BagItemAutoSortButton"]:SetFrameStrata("HIGH")
  79. _G["BagItemAutoSortButton"]:SetFrameLevel(5)
  80.  
  81. hooksecurefunc("ContainerFrame_Update", function(frame)
  82.     _G["BagItemSearchBox"]:ClearAllPoints()
  83.     _G["BagItemSearchBox"]:SetWidth(165)
  84.     _G["BagItemSearchBox"]:SetPoint('TOPLEFT', _G["ContainerFrame1"], 'BOTTOMLEFT', 18, 240)
  85. end)
  86.  
  87. local function UpdateGlow(button, id)
  88.     local quality, texture, _
  89.     if(id) then
  90.         quality, _, _, _, _, _, _, texture = select(3, GetItemInfo(id))
  91.     end
  92.    
  93.     local glow = button.glow
  94.     if(not glow) then
  95.         glow = CreateFrame("Frame", nil, button)
  96.         SetTexture(glow, AftermathhUI.media.bordernormal)
  97.         glow:SetPoint("TOPLEFT", button, "TOPLEFT")
  98.         glow:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT")
  99.         button.glow = glow
  100.     end
  101.    
  102.     if(texture) then
  103.         local r, g, b = GetItemQualityColor(quality)
  104.         if _G[button:GetName().."IconQuestTexture"] and _G[button:GetName().."IconQuestTexture"]:IsShown() then
  105.             r, g, b = unpack(AftermathhUI.loot.questitemcolor)
  106.         end
  107.         ColorBorder(glow, r, g, b)
  108.         glow:Show()
  109.     else
  110.         glow:Hide()
  111.     end
  112. end
  113.  
  114. hooksecurefunc("ContainerFrame_Update", function(self)
  115.     for i = 1, self.size do
  116.         UpdateGlow(_G[self:GetName().."Item"..i], GetContainerItemID(self:GetID(), _G[self:GetName().."Item"..i]:GetID()))
  117.     end
  118. end)

Last edited by Aftermathhqt : 07-20-16 at 01:38 PM.
  Reply With Quote
07-20-16, 01:47 PM   #2
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Originally Posted by Game92 View Post
Hi, so with the new patch out my bag addon there's some small issues it's lagging/almos freezing when i'm opening them can anyone help me out what's wrong?
If it's your addon you should know how it works and how to update it, right?
  Reply With Quote
07-20-16, 01:54 PM   #3
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
Originally Posted by p3lim View Post
If it's your addon you should know how it works and how to update it, right?
It works, but it gives fps drops/freeze when you open them.. And i haven't really been active for the last 3 years in the coding universe..
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Bag Issue


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