Quantcast Clear Button Texture and Text LUA Help - Page 2 - WoWInterface
Thread Tools Display Modes
04-25-17, 02:27 AM   #21
Dejablue
A Wyrmkin Dreamwalker
 
Dejablue's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 51
Originally Posted by syncrow View Post
you could use "ContainerFrameItemButtonTemplate" instead of "SecureActionButtonTemplate".

pros:
  • clickability to use items
  • non secure (prevents taint)
  • can handle show / hide / positioning even while in combat

cons:
  • you have to create a header for each button (but thats fairly easy to achieve)

Edit: I'm going to prepare some code and explanation for you later... currently at work!^^
Thank you so much I look forward to it. Gonna play with ContainerFrameItemButtonTemplate for a while see what i can see. Maybe combine that with table.insert as buttons are created as per Fizzlemizz's suggestion, so we make tables like you suggested, and we may have something.

Cheers!
  Reply With Quote
04-25-17, 01:35 PM   #22
syncrow
A Flamescale Wyrmkin
 
syncrow's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 149
ok here is the code: (everything is tested, and should be properly debugged)

Lua Code:
  1. local buttonSize = 36;
  2. local padding = 2;
  3. local perRow = 6;
  4.  
  5. local function CreateButton(parent)
  6.     local button = CreateFrame("Frame", nil, parent)
  7.     local index = #parent.beacons + 1 or 1
  8.    
  9.     button:SetSize(buttonSize, buttonSize);
  10.     button.access = {}
  11.    
  12.     button.slot = CreateFrame("Button", nil, button, "ContainerFrameItemButtonTemplate")
  13.     button.slot:SetSize(buttonSize, buttonSize)
  14.     button.slot:SetPoint("CENTER")
  15.     button.slot:SetScript("OnEnter", function()
  16.         local bag = button:GetID()
  17.         local slot = button.slot:GetID()
  18.        
  19.         GameTooltip:SetOwner(button, "ANCHOR_CURSOR")
  20.         GameTooltip:SetBagItem(bag, slot);
  21.         GameTooltip:Show()
  22.     end)
  23.     button.slot:SetScript("OnLeave", GameTooltip_Hide)
  24.     button.slot:Show()
  25.    
  26.     button.slot.icon:SetTexCoord(0.075, 0.925, 0.075, 0.925);
  27.     button.slot.BattlepayItemTexture:Hide()
  28.    
  29.     return button
  30. end
  31.  
  32. local function UpdateButton(button)
  33.  
  34.     -- no access found: reset button
  35.     if #button.access == 0 then
  36.         button:Hide()
  37.         button.slot.Count:SetText("")
  38.         button.slot:SetNormalTexture("")
  39.         return
  40.     end
  41.  
  42.     local totalCount = 0;
  43.     local texture, bagID, slotID;
  44.    
  45.     for info, values in pairs(button.access) do
  46.         local bag, slot = unpack(values)
  47.         local icon, count = GetContainerItemInfo(bag, slot)
  48.        
  49.         if count then
  50.             totalCount = totalCount + count
  51.         end
  52.        
  53.         -- get the first possible identification for access later
  54.         if not bagID or not slotID or not tex then
  55.             texture = icon
  56.             bagID = bag
  57.             slotID = slot
  58.         end
  59.     end
  60.    
  61.     -- we do not need to show a count there is only 1 item existing
  62.     if totalCount == 1 then
  63.         totalCount = ""
  64.     end
  65.  
  66.     -- update count & texture
  67.     button.slot.Count:SetText(totalCount)
  68.     button.slot.icon:SetTexture(texture)
  69.        
  70.     -- update access
  71.     button:SetID(bagID)
  72.     button.slot:SetID(slotID)
  73.     button:Show()
  74. end
  75.  
  76. local function ResetButtons(self)
  77.     local table = self.beacons
  78.    
  79.     for _, button in pairs(table) do
  80.         button:Hide();
  81.         button.access = {}
  82.     end
  83. end
  84.  
  85. local function CacheAccess(self)
  86.     local table = self.beacons
  87.    
  88.     for bag = 0, 4 do
  89.         for slot = 1, GetContainerNumSlots(bag) do
  90.             local itemID = GetContainerItemID(bag, slot)
  91.            
  92.             if itemID then
  93.                 local name = GetItemInfo(itemID)
  94.                
  95.                 -- beacon found!!!
  96.                 if name and name:find("Sentinax Beacon") then
  97.                     local button = table[name]
  98.                    
  99.                     -- no button found: create it
  100.                     if not button then
  101.                         button = CreateButton(self)
  102.                         table[name] = button
  103.                     end
  104.                    
  105.                     -- store access
  106.                     if button then
  107.                         tinsert(button.access, {bag, slot})
  108.                     end
  109.                 end
  110.             end
  111.         end
  112.     end
  113. end
  114.  
  115. local function UpdateAllButtons(self)
  116.     local table = self.beacons
  117.     local index = 1;
  118.    
  119.     for _, button in pairs(table) do
  120.         if button then
  121.             UpdateButton(button)
  122.            
  123.             if button:IsShown() then
  124.                 local row = math.ceil( index / perRow)
  125.                 local col = (index-1) % perRow + 1
  126.                 local x = (buttonSize * (col-1) ) + ( padding * (col-1) )
  127.                 local y = (buttonSize * (row-1) ) + ( padding * (row-1) )
  128.                
  129.                 button:SetPoint("TOPLEFT", self, 0 + x, 0 - y)
  130.                
  131.                 index = index + 1
  132.             end
  133.         end
  134.     end
  135. end
  136.  
  137. local function UpdateFrameSize(self)
  138.     local table = self.beacons
  139.     local width, height, numRows, numCols
  140.     local shownBtns = 0
  141.    
  142.     for _, button in pairs(table) do
  143.         if button:IsShown() then
  144.             shownBtns = shownBtns + 1
  145.         end
  146.     end
  147.    
  148.     numRows = math.ceil( shownBtns / perRow )
  149.     numCols = (shownBtns < perRow) and shownBtns or perRow
  150.     width = (buttonSize * numCols) + (padding * (numCols - 1) )
  151.     height = numRows * buttonSize + (padding * (numRows - 1) )
  152.    
  153.     self:SetSize(width, height)
  154. end
  155.  
  156. local frame = CreateFrame("Frame", "BeamMeUpDejaInitFrame", UIParent)
  157.  
  158. frame.beacons = {}
  159. frame:SetPoint("CENTER");
  160. frame:RegisterEvent("PLAYER_LOGIN")
  161. frame:SetScript("OnEvent", function(self, event, ...)
  162.     if event == "PLAYER_LOGIN" then
  163.         self:RegisterEvent("BAG_UPDATE")
  164.        
  165.         -- pre call the event for initialization
  166.         ResetButtons(self)
  167.         CacheAccess(self)
  168.         UpdateAllButtons(self)
  169.         UpdateFrameSize(self)
  170.        
  171.         return
  172.     end
  173.  
  174.     ResetButtons(self)
  175.     CacheAccess(self)
  176.     UpdateAllButtons(self)
  177.     UpdateFrameSize(self)
  178. end)

Note:
- Buttons are ordered from left to right, and from top to bottom
(can be changed on line 129 - switch math operators for x / y)
__________________

Last edited by syncrow : 04-25-17 at 01:40 PM.
  Reply With Quote
04-26-17, 09:04 AM   #23
Dejablue
A Wyrmkin Dreamwalker
 
Dejablue's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 51
Originally Posted by syncrow View Post
ok here is the code: (everything is tested, and should be properly debugged)

Lua Code:
  1. local buttonSize = 36;
  2. local padding = 2;
  3. local perRow = 6;
  4.  
  5. local function CreateButton(parent)
  6.     local button = CreateFrame("Frame", nil, parent)
  7.     local index = #parent.beacons + 1 or 1
  8.    
  9.     button:SetSize(buttonSize, buttonSize);
  10.     button.access = {}
  11.    
  12.     button.slot = CreateFrame("Button", nil, button, "ContainerFrameItemButtonTemplate")
  13.     button.slot:SetSize(buttonSize, buttonSize)
  14.     button.slot:SetPoint("CENTER")
  15.     button.slot:SetScript("OnEnter", function()
  16.         local bag = button:GetID()
  17.         local slot = button.slot:GetID()
  18.        
  19.         GameTooltip:SetOwner(button, "ANCHOR_CURSOR")
  20.         GameTooltip:SetBagItem(bag, slot);
  21.         GameTooltip:Show()
  22.     end)
  23.     button.slot:SetScript("OnLeave", GameTooltip_Hide)
  24.     button.slot:Show()
  25.    
  26.     button.slot.icon:SetTexCoord(0.075, 0.925, 0.075, 0.925);
  27.     button.slot.BattlepayItemTexture:Hide()
  28.    
  29.     return button
  30. end
  31.  
  32. local function UpdateButton(button)
  33.  
  34.     -- no access found: reset button
  35.     if #button.access == 0 then
  36.         button:Hide()
  37.         button.slot.Count:SetText("")
  38.         button.slot:SetNormalTexture("")
  39.         return
  40.     end
  41.  
  42.     local totalCount = 0;
  43.     local texture, bagID, slotID;
  44.    
  45.     for info, values in pairs(button.access) do
  46.         local bag, slot = unpack(values)
  47.         local icon, count = GetContainerItemInfo(bag, slot)
  48.        
  49.         if count then
  50.             totalCount = totalCount + count
  51.         end
  52.        
  53.         -- get the first possible identification for access later
  54.         if not bagID or not slotID or not tex then
  55.             texture = icon
  56.             bagID = bag
  57.             slotID = slot
  58.         end
  59.     end
  60.    
  61.     -- we do not need to show a count there is only 1 item existing
  62.     if totalCount == 1 then
  63.         totalCount = ""
  64.     end
  65.  
  66.     -- update count & texture
  67.     button.slot.Count:SetText(totalCount)
  68.     button.slot.icon:SetTexture(texture)
  69.        
  70.     -- update access
  71.     button:SetID(bagID)
  72.     button.slot:SetID(slotID)
  73.     button:Show()
  74. end
  75.  
  76. local function ResetButtons(self)
  77.     local table = self.beacons
  78.    
  79.     for _, button in pairs(table) do
  80.         button:Hide();
  81.         button.access = {}
  82.     end
  83. end
  84.  
  85. local function CacheAccess(self)
  86.     local table = self.beacons
  87.    
  88.     for bag = 0, 4 do
  89.         for slot = 1, GetContainerNumSlots(bag) do
  90.             local itemID = GetContainerItemID(bag, slot)
  91.            
  92.             if itemID then
  93.                 local name = GetItemInfo(itemID)
  94.                
  95.                 -- beacon found!!!
  96.                 if name and name:find("Sentinax Beacon") then
  97.                     local button = table[name]
  98.                    
  99.                     -- no button found: create it
  100.                     if not button then
  101.                         button = CreateButton(self)
  102.                         table[name] = button
  103.                     end
  104.                    
  105.                     -- store access
  106.                     if button then
  107.                         tinsert(button.access, {bag, slot})
  108.                     end
  109.                 end
  110.             end
  111.         end
  112.     end
  113. end
  114.  
  115. local function UpdateAllButtons(self)
  116.     local table = self.beacons
  117.     local index = 1;
  118.    
  119.     for _, button in pairs(table) do
  120.         if button then
  121.             UpdateButton(button)
  122.            
  123.             if button:IsShown() then
  124.                 local row = math.ceil( index / perRow)
  125.                 local col = (index-1) % perRow + 1
  126.                 local x = (buttonSize * (col-1) ) + ( padding * (col-1) )
  127.                 local y = (buttonSize * (row-1) ) + ( padding * (row-1) )
  128.                
  129.                 button:SetPoint("TOPLEFT", self, 0 + x, 0 - y)
  130.                
  131.                 index = index + 1
  132.             end
  133.         end
  134.     end
  135. end
  136.  
  137. local function UpdateFrameSize(self)
  138.     local table = self.beacons
  139.     local width, height, numRows, numCols
  140.     local shownBtns = 0
  141.    
  142.     for _, button in pairs(table) do
  143.         if button:IsShown() then
  144.             shownBtns = shownBtns + 1
  145.         end
  146.     end
  147.    
  148.     numRows = math.ceil( shownBtns / perRow )
  149.     numCols = (shownBtns < perRow) and shownBtns or perRow
  150.     width = (buttonSize * numCols) + (padding * (numCols - 1) )
  151.     height = numRows * buttonSize + (padding * (numRows - 1) )
  152.    
  153.     self:SetSize(width, height)
  154. end
  155.  
  156. local frame = CreateFrame("Frame", "BeamMeUpDejaInitFrame", UIParent)
  157.  
  158. frame.beacons = {}
  159. frame:SetPoint("CENTER");
  160. frame:RegisterEvent("PLAYER_LOGIN")
  161. frame:SetScript("OnEvent", function(self, event, ...)
  162.     if event == "PLAYER_LOGIN" then
  163.         self:RegisterEvent("BAG_UPDATE")
  164.        
  165.         -- pre call the event for initialization
  166.         ResetButtons(self)
  167.         CacheAccess(self)
  168.         UpdateAllButtons(self)
  169.         UpdateFrameSize(self)
  170.        
  171.         return
  172.     end
  173.  
  174.     ResetButtons(self)
  175.     CacheAccess(self)
  176.     UpdateAllButtons(self)
  177.     UpdateFrameSize(self)
  178. end)

Note:
- Buttons are ordered from left to right, and from top to bottom
(can be changed on line 129 - switch math operators for x / y)
Thanks Syn. I added you and Fizz as contributors and pushed it out to release. Found a couple bugs since. Text still doesn't update, but much headway has been made. Thank you for all of your help. Feel free to reply here or on Curse or PM me here or on Curse if you have suggestions, fixes, questions, etc. This is far from over, only just beginning.

https://mods.curse.com/addons/wow/265345-beammeupdeja

Cheers!
  Reply With Quote
04-26-17, 03:39 PM   #24
jeruku
A Chromatic Dragonspawn
 
jeruku's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 194
For this particular use, since you are scanning the bag anyway, I would recommend using the event BAG_UPDATE_DELAYED instead of BAG_UPDATE.
__________________
"I have not failed, I simply found 10,000 ways that did not work." - Thomas Edison
  Reply With Quote
04-27-17, 12:12 AM   #25
Dejablue
A Wyrmkin Dreamwalker
 
Dejablue's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 51
Originally Posted by jeruku View Post
For this particular use, since you are scanning the bag anyway, I would recommend using the event BAG_UPDATE_DELAYED instead of BAG_UPDATE.
Yeah, good call. I'll have to play with the events when I get a chance. Thanks
  Reply With Quote
04-27-17, 02:21 AM   #26
Kakjens
A Cliff Giant
Join Date: Apr 2017
Posts: 75
Originally Posted by syncrow View Post
ok here is the code: (everything is tested, and should be properly debugged)

Lua Code:
  1. local buttonSize = 36;
  2. local padding = 2;
  3. local perRow = 6;
  4.  
  5. local function CreateButton(parent)
  6.     local button = CreateFrame("Frame", nil, parent)
  7.     local index = #parent.beacons + 1 or 1
  8.    
  9.     button:SetSize(buttonSize, buttonSize);
  10.     button.access = {}
  11.    
  12.     button.slot = CreateFrame("Button", nil, button, "ContainerFrameItemButtonTemplate")
  13.     button.slot:SetSize(buttonSize, buttonSize)
  14.     button.slot:SetPoint("CENTER")
  15.     button.slot:SetScript("OnEnter", function()
  16.         local bag = button:GetID()
  17.         local slot = button.slot:GetID()
  18.        
  19.         GameTooltip:SetOwner(button, "ANCHOR_CURSOR")
  20.         GameTooltip:SetBagItem(bag, slot);
  21.         GameTooltip:Show()
  22.     end)
  23.     button.slot:SetScript("OnLeave", GameTooltip_Hide)
  24.     button.slot:Show()
  25.    
  26.     button.slot.icon:SetTexCoord(0.075, 0.925, 0.075, 0.925);
  27.     button.slot.BattlepayItemTexture:Hide()
  28.    
  29.     return button
  30. end
  31.  
  32. local function UpdateButton(button)
  33.  
  34.     -- no access found: reset button
  35.     if #button.access == 0 then
  36.         button:Hide()
  37.         button.slot.Count:SetText("")
  38.         button.slot:SetNormalTexture("")
  39.         return
  40.     end
  41.  
  42.     local totalCount = 0;
  43.     local texture, bagID, slotID;
  44.    
  45.     for info, values in pairs(button.access) do
  46.         local bag, slot = unpack(values)
  47.         local icon, count = GetContainerItemInfo(bag, slot)
  48.        
  49.         if count then
  50.             totalCount = totalCount + count
  51.         end
  52.        
  53.         -- get the first possible identification for access later
  54.         if not bagID or not slotID or not tex then
  55.             texture = icon
  56.             bagID = bag
  57.             slotID = slot
  58.         end
  59.     end
  60.    
  61.     -- we do not need to show a count there is only 1 item existing
  62.     if totalCount == 1 then
  63.         totalCount = ""
  64.     end
  65.  
  66.     -- update count & texture
  67.     button.slot.Count:SetText(totalCount)
  68.     button.slot.icon:SetTexture(texture)
  69.        
  70.     -- update access
  71.     button:SetID(bagID)
  72.     button.slot:SetID(slotID)
  73.     button:Show()
  74. end
  75.  
  76. local function ResetButtons(self)
  77.     local table = self.beacons
  78.    
  79.     for _, button in pairs(table) do
  80.         button:Hide();
  81.         button.access = {}
  82.     end
  83. end
  84.  
  85. local function CacheAccess(self)
  86.     local table = self.beacons
  87.    
  88.     for bag = 0, 4 do
  89.         for slot = 1, GetContainerNumSlots(bag) do
  90.             local itemID = GetContainerItemID(bag, slot)
  91.            
  92.             if itemID then
  93.                 local name = GetItemInfo(itemID)
  94.                
  95.                 -- beacon found!!!
  96.                 if name and name:find("Sentinax Beacon") then
  97.                     local button = table[name]
  98.                    
  99.                     -- no button found: create it
  100.                     if not button then
  101.                         button = CreateButton(self)
  102.                         table[name] = button
  103.                     end
  104.                    
  105.                     -- store access
  106.                     if button then
  107.                         tinsert(button.access, {bag, slot})
  108.                     end
  109.                 end
  110.             end
  111.         end
  112.     end
  113. end
  114.  
  115. local function UpdateAllButtons(self)
  116.     local table = self.beacons
  117.     local index = 1;
  118.    
  119.     for _, button in pairs(table) do
  120.         if button then
  121.             UpdateButton(button)
  122.            
  123.             if button:IsShown() then
  124.                 local row = math.ceil( index / perRow)
  125.                 local col = (index-1) % perRow + 1
  126.                 local x = (buttonSize * (col-1) ) + ( padding * (col-1) )
  127.                 local y = (buttonSize * (row-1) ) + ( padding * (row-1) )
  128.                
  129.                 button:SetPoint("TOPLEFT", self, 0 + x, 0 - y)
  130.                
  131.                 index = index + 1
  132.             end
  133.         end
  134.     end
  135. end
  136.  
  137. local function UpdateFrameSize(self)
  138.     local table = self.beacons
  139.     local width, height, numRows, numCols
  140.     local shownBtns = 0
  141.    
  142.     for _, button in pairs(table) do
  143.         if button:IsShown() then
  144.             shownBtns = shownBtns + 1
  145.         end
  146.     end
  147.    
  148.     numRows = math.ceil( shownBtns / perRow )
  149.     numCols = (shownBtns < perRow) and shownBtns or perRow
  150.     width = (buttonSize * numCols) + (padding * (numCols - 1) )
  151.     height = numRows * buttonSize + (padding * (numRows - 1) )
  152.    
  153.     self:SetSize(width, height)
  154. end
  155.  
  156. local frame = CreateFrame("Frame", "BeamMeUpDejaInitFrame", UIParent)
  157.  
  158. frame.beacons = {}
  159. frame:SetPoint("CENTER");
  160. frame:RegisterEvent("PLAYER_LOGIN")
  161. frame:SetScript("OnEvent", function(self, event, ...)
  162.     if event == "PLAYER_LOGIN" then
  163.         self:RegisterEvent("BAG_UPDATE")
  164.        
  165.         -- pre call the event for initialization
  166.         ResetButtons(self)
  167.         CacheAccess(self)
  168.         UpdateAllButtons(self)
  169.         UpdateFrameSize(self)
  170.        
  171.         return
  172.     end
  173.  
  174.     ResetButtons(self)
  175.     CacheAccess(self)
  176.     UpdateAllButtons(self)
  177.     UpdateFrameSize(self)
  178. end)

Note:
- Buttons are ordered from left to right, and from top to bottom
(can be changed on line 129 - switch math operators for x / y)
Didn't test in-game but seems like creation of button.slot.Count after line 27 is missing.
  Reply With Quote
04-27-17, 02:27 AM   #27
syncrow
A Flamescale Wyrmkin
 
syncrow's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 149
Originally Posted by Kakjens View Post
Didn't test in-game but seems like creation of button.slot.Count after line 27 is missing.
button.slot inherits from "ContainerFrameItemButtonTemplate" which inherits from "ItemButtonTemplate" that has the childkey .Count as a font string


Edit:
@Deja, i would also recomment, using my code seperately instead of calling it inside a OnEvent function, the created frame was simply renamed by me but should be used as your initFrame...
__________________

Last edited by syncrow : 04-27-17 at 02:35 AM.
  Reply With Quote
04-27-17, 02:34 AM   #28
Kakjens
A Cliff Giant
Join Date: Apr 2017
Posts: 75
Thanks, after posting thought something similar, and found in ItemButtonTemplate.xml that it's indeed defined.
  Reply With Quote
04-27-17, 02:50 AM   #29
syncrow
A Flamescale Wyrmkin
 
syncrow's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 149
I'm going to hard test the complete addon on Friday.

Should I upload a new beta version on curse once debugged and changes made?
__________________
  Reply With Quote
04-27-17, 03:10 AM   #30
Dejablue
A Wyrmkin Dreamwalker
 
Dejablue's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 51
Originally Posted by syncrow View Post
I'm going to hard test the complete addon on Friday.

Should I upload a new beta version on curse once debugged and changes made?
Sure I will give you access.
  Reply With Quote
04-27-17, 11:24 AM   #31
Kakjens
A Cliff Giant
Join Date: Apr 2017
Posts: 75
In line 54 probably a typo: instead of variable "texture" non-existant "tex" was used.
Removed external BeamMeUpDejaInitFrame. Don't know why but for item count updates to work, had to use CreateFontString in CreateButton.
Modified version sent to Deja.
Probably there's still much to fix/improve.
  Reply With Quote
04-27-17, 01:12 PM   #32
syncrow
A Flamescale Wyrmkin
 
syncrow's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 149
Begun fixing the beacon bar part:
  • Count display (fixed)
  • Disabled "LeftClick" to prevent some annoying ContainerFrameItemButtonTemplate stuff working (we only want the click to use part here)
  • Beacons are now sorted based on Quality > Count > Name
  • Merged some functions together to make the code cleaner

By the way, searching for names rather than using predefined itemIDs like mentions in my first solution, will be an issue for non english clients
Except we want to handle each localization manually...
__________________

Last edited by syncrow : 04-27-17 at 01:36 PM.
  Reply With Quote
04-27-17, 11:01 PM   #33
Dejablue
A Wyrmkin Dreamwalker
 
Dejablue's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 51
Originally Posted by syncrow View Post
Begun fixing the beacon bar part:
  • Count display (fixed)
  • Disabled "LeftClick" to prevent some annoying ContainerFrameItemButtonTemplate stuff working (we only want the click to use part here)
  • Beacons are now sorted based on Quality > Count > Name
  • Merged some functions together to make the code cleaner

By the way, searching for names rather than using predefined itemIDs like mentions in my first solution, will be an issue for non english clients
Except we want to handle each localization manually...
For localization we will ahve to do something like:

Code:
if name and name:find("Sentinax Beacon" or "Netherchunck") then

We also need to query other items, like nether shards and boss summon stones. This is going to require tables... bleh.

As for localization, we could simply search for local names, making our list, ostensibly, smaller, adding them to the table for Chinese, Russian, Portuguese, etc.

But you are correct that we wont have to worry about localization if we use item IDs.
  Reply With Quote
04-27-17, 11:47 PM   #34
syncrow
A Flamescale Wyrmkin
 
syncrow's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 149
Originally Posted by Dejablue View Post
For localization we will ahve to do something like:

Code:
if name and name:find("Sentinax Beacon" or "Netherchunck") then

We also need to query other items, like nether shards and boss summon stones. This is going to require tables... bleh.

As for localization, we could simply search for local names, making our list, ostensibly, smaller, adding them to the table for Chinese, Russian, Portuguese, etc.

But you are correct that we wont have to worry about localization if we use item IDs.
tracking nethershards and legion fall resources is quite easy:
simply loop through the currency list and get your information

I don't know what really speaks against a table that we want to use for tracking
- localization friendly
- can be maintained updated super easily by just adding / removing itemIDs
- we can throw updates without touching anything besides the itemID table for new items to track...
__________________
  Reply With Quote
04-28-17, 01:15 AM   #35
Dejablue
A Wyrmkin Dreamwalker
 
Dejablue's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 51
Originally Posted by syncrow View Post
tracking nethershards and legion fall resources is quite easy:
simply loop through the currency list and get your information

I don't know what really speaks against a table that we want to use for tracking
- localization friendly
- can be maintained updated super easily by just adding / removing itemIDs
- we can throw updates without touching anything besides the itemID table for new items to track...
Correct. I had not considered localizations. We should change to a table with the items we wish to track as you originally suggested. As for what speaks against a table; reduced/no maintenance in the future should Blizzard change things (like create Sentinax Beacon of the Murloc) we won't have to add it specifically, name search will add it which is particularly beneficial if none of us are playing the game and keeping up with it. My original goal was to execute this with string search functions, for the sake of it. It is doable, but with localization concerns I don't think it is worth it, especially if we simply make a list of localized strings to look for.

So the project went from looking for three names to looking for 33 names across 11 locales.

May as well just look for IDs instead.
  Reply With Quote
04-28-17, 03:22 AM   #36
syncrow
A Flamescale Wyrmkin
 
syncrow's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 149
Deja,

how do you want the beacon bar to be displayed exactly?
  • each quality in a seperate row?
  • dynamic with a specific sorting?
  • something else maybe


[Rare Beacons]
[Uncommen Beacons]
[Other Items]


Static layout:
[X][X][X][X][X][X][X][X][X]
[X][X][X][X][X][X]
[X][X][X]


dynamic: (#15 - live)
[X][X][X][X][X][X]
[X][X][X][X][X][X]
[X][X][X][X][X][X]


mixed 1:
[X][X][X][X][X][X]
[X][X][X][X][X][X]
[X][X][X][X][X][X]


mixed 2:
[X][X][X][X][X]
[X][X][X][X][X]
[X][X][X][X][X]
[X][X][X]
__________________

Last edited by syncrow : 04-28-17 at 04:05 AM.
  Reply With Quote
04-28-17, 09:33 AM   #37
Kakjens
A Cliff Giant
Join Date: Apr 2017
Posts: 75
I think ability to detect new Sentinax Beacons is interesting. Requirement to localize the search string - not so much. Therefore maybe some fuzzy detector whether or not this item is Sentinax Beacon can be written. Using currently known Sentinax Beacons a common string with maximal length could be calculated and used for searching.
Previously thought of more exotic ways of creation of the search string but currently think this is more or less plausible compared to others.
  Reply With Quote
04-28-17, 09:45 AM   #38
syncrow
A Flamescale Wyrmkin
 
syncrow's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 149
broken shore stuff would be a thing till 7.3 then everything will to argus, so could bet that no new beacon or any new broken shore grind related item will be added after 7.2.5 launch

and even when...add 2 spellIDs throw update, fix and everything is happy.
You simply cant prevent addons to be updated from time to time, but that is just my standpoint
__________________
  Reply With Quote
04-28-17, 11:16 AM   #39
Kakjens
A Cliff Giant
Join Date: Apr 2017
Posts: 75
Indeed, in this specific example creation of search string through combinatorics is overkill. I was just surprised by possibility of automation of creation of feature extractor, as an input using few items.
But really, adding of few itemIDs after discovery of the new elusive Sentinax Beacons would be much easier.
  Reply With Quote
04-28-17, 12:31 PM   #40
Dejablue
A Wyrmkin Dreamwalker
 
Dejablue's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 51
I want the layout to be static rarity rows that are dynamically created, i.e. collapse as created for each rarity per row.

[X][X][X] -- Netherchunk and Zone portals(see below)
[X][X] -- Epic
[X][X] -- Crafting Rare
[X][X][X][X] -- Rare
[X][X][X][X][X][X] -- Uncommon



__________________________________________

Netherchunk and Zone portals(see below)

Epic:
[146921] = "", -- Illisthyndria
[146920] = "", -- Fel Obliterator
[146919] = "", -- An'thyna:An'thyna
[146918] = "", -- Force-Commander Xillious
[146917] = "", -- Skulguloth
[146916] = "", -- Than'otalion

Crafting Rare:
[147355] = "", -- bloodstrike
[146923] = "", -- petrification
[146922] = "", -- fel growth

Rare:
[146915] = "", -- greater torment
[146914] = "", -- greater engineering
[146913] = "", -- greater warbeasts
[146912] = "", -- greater carnage
[146911] = "", -- greater firestorm
[146910] = "", -- greater dominance

Uncommon:
[146909] = "", -- torment
[146908] = "", -- engineering
[146907] = "", -- warbeasts
[146906] = "", -- carnage
[146905] = "", -- firestorm
[146903] = "", -- dominance
_____________________

Zone portals are rare(IIRC they are Epic). They open a portal in a zone, like Skyhorn in Highmountain. You go there, click it and a portal opens with aq miniboss. You kill it and loot exactly 300 Nethershards. I have had 2 drop, went and did them, but have not seen any since. Others can help you kill the boss but they do not get loot AFAIK. That being said, I forget what their name is and my google/WoWHead - fu has failed me to bring up their names.

At any rate, the very top row should be consumable you want to use right away, like Netherchunk and these zone portals.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Clear Button Texture and Text LUA Help

Thread Tools
Display Modes

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