Guest User

oGlow support for BankItems 6.0.3.2

a guest
Nov 4th, 2014
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.13 KB | None | 0 0
  1. -- BankItems 6.0.3.2
  2. -- Add support for oGlow (github version - http://github.com/haste/oGlow, not the wowinterface one)
  3. if oGlow and oGlow.RegisterPipe then
  4.     do  -- bags
  5.         local hook
  6.  
  7.         local update = function(bagID)
  8.             if(oGlow:IsPipeEnabled'bankitemsbags') then
  9.                 theBag = bankPlayer[format("Bag%d", bagID)]
  10.                 if theBag and theBag.size then
  11.                     for bagItem = 1, theBag.size do
  12.                         idx = theBag.size - (bagItem - 1)
  13.                         if (bagID == 101) then  -- Adjust for page number
  14.                             idx = idx + (mailPage - 1) * 18
  15.                         elseif (bagID == 103) then  -- Adjust for page number
  16.                             idx = idx + (AHPage - 1) * 18
  17.                         elseif (bagID == 104) then  -- Adjust for page number
  18.                             idx = idx + (voidPage - 1) * voidPageSize
  19.                         elseif (bagID == 105) then  -- Adjust for page number
  20.                             idx = idx + (reagentBankPage - 1) * reagentBankPageSize
  21.                         end
  22.                         if theBag[idx] then
  23.                             oGlow:CallFilters('bags', BagContainerAr[bagID][bagItem], theBag[idx].link)
  24.                         else
  25.                             oGlow:CallFilters('bags', BagContainerAr[bagID][bagItem], nil)
  26.                         end
  27.                     end
  28.                 end
  29.             end
  30.         end
  31.  
  32.         local enable = function(self)
  33.             if(not hook) then
  34.                 hooksecurefunc("BankItems_PopulateBag", update)
  35.                 hook = true
  36.             end
  37.         end
  38.  
  39.         oGlow:RegisterPipe('bankitemsbags', enable, nil, update, "BankItems Bag Frames", nil)
  40.         oGlow:EnablePipe('bankitemsbags')
  41.     end
  42.     do  -- bank
  43.         local hook
  44.  
  45.         local update = function()
  46.             if(oGlow:IsPipeEnabled'bankitemsbank') then
  47.                 for i = 1, 28 do
  48.                     if bankPlayer[i] then
  49.                         oGlow:CallFilters('bank', ItemButtonAr[i], bankPlayer[i].link)
  50.                     else
  51.                         oGlow:CallFilters('bank', ItemButtonAr[i], nil)
  52.                     end
  53.                 end
  54.             end
  55.         end
  56.  
  57.         local enable = function(self)
  58.             if(not hook) then
  59.                 hooksecurefunc("BankItems_PopulateFrame", update)
  60.                 hook = true
  61.             end
  62.         end
  63.  
  64.         oGlow:RegisterPipe('bankitemsbank', enable, nil, update, "BankItems Bank Frame", nil)
  65.         oGlow:EnablePipe('bankitemsbank')
  66.     end
  67.     do  -- guild bank
  68.         local hook
  69.  
  70.         local update = function(guildName, tab)
  71.             if(oGlow:IsPipeEnabled'bankitemsgbank') then
  72.                 local selfGuild = BankItems_SaveGuild[guildName]
  73.                 tab = tab or 1
  74.                 if selfGuild[tab] and selfGuild[tab].seen then
  75.                     for i = 1, 98 do
  76.                         if selfGuild[tab][i] then
  77.                             oGlow:CallFilters('gbank', GBButtonAr[i], selfGuild[tab][i].link)
  78.                         else
  79.                             oGlow:CallFilters('gbank', GBButtonAr[i], nil)
  80.                         end
  81.                     end
  82.                 end
  83.             end
  84.         end
  85.  
  86.         local enable = function(self)
  87.             if(not hook) then
  88.                 hooksecurefunc("BankItems_PopulateGuildBank", update)
  89.                 hook = true
  90.             end
  91.         end
  92.  
  93.         oGlow:RegisterPipe('bankitemsgbank', enable, nil, update, "BankItems Guild Bank Frame", nil)
  94.         oGlow:EnablePipe('bankitemsgbank')
  95.     end
  96.     do  -- reagentbank
  97.         local hook
  98.  
  99.         local update = function()
  100.             if(oGlow:IsPipeEnabled'bankitemsreagentbank') then
  101.                 for i = 1, NUM_REAGENTBANKGENERIC_SLOTS do
  102.                     if bankPlayer.Bag105[i] then
  103.                         oGlow:CallFilters('bank', RBButtonAr[i], bankPlayer.Bag105[i].link)
  104.                     else
  105.                         oGlow:CallFilters('bank', RBButtonAr[i], nil)
  106.                     end
  107.                 end
  108.             end
  109.         end
  110.  
  111.         local enable = function(self)
  112.             if(not hook) then
  113.                 hooksecurefunc("BankItems_PopulateReagentBank", update)
  114.                 hook = true
  115.             end
  116.         end
  117.  
  118.         oGlow:RegisterPipe('bankitemsreagentbank', enable, nil, update, "BankItems Reagent Bank Frame", nil)
  119.         oGlow:EnablePipe('bankitemsreagentbank')
  120.     end
  121.     do  -- void storage
  122.         local hook
  123.  
  124.         local update = function(tab)
  125.             if(oGlow:IsPipeEnabled'bankitemsvoidstorage') then
  126.                 tab = tab or 1
  127.                 local slotOffset = (tab - 1) * 80
  128.                 for i = 1, 80 do
  129.                     if  bankPlayer.Bag104[i+slotOffset] then
  130.                         oGlow:CallFilters('voidstorage', VoidButtonAr[i], bankPlayer.Bag104[i+slotOffset].link)
  131.                     else
  132.                         oGlow:CallFilters('voidstorage', VoidButtonAr[i], nil)
  133.                     end
  134.                 end
  135.             end
  136.         end
  137.  
  138.         local enable = function(self)
  139.             if(not hook) then
  140.                 hooksecurefunc("BankItems_PopulateVoidStorage", update)
  141.                 hook = true
  142.             end
  143.         end
  144.  
  145.         oGlow:RegisterPipe('bankitemsvoidstorage', enable, nil, update, "BankItems Void Storage Frame", nil)
  146.         oGlow:EnablePipe('bankitemsvoidstorage')
  147.     end
  148. end
Add Comment
Please, Sign In to add comment