-
Posted by docseuss on Thu, 03 Dec 2009 09:23:59
James or anyone else, I am wanting to create basically the auction house item frame. I would like to be able to search for an item filter using the tree to the left and dropdowns up top. Pretty much every functionality of the Auction House except with out all the others tabs and using my datasource.
I looked at the Blizzard Addons for Auction House and I can't really figure out how to inherit from their template. Is inheritance the correct path I should be using to accomplish this or is there another magic frame template I just don't know about. I've found a few other addons that seem to accomplish this, but even looking at their code I can't quite figure out what they are doing. They may just be hooking into already existing functionality.
Would this maybe just be easier starting from scratch with my own frame?
Thanks!
-
Posted by jnwhiteh on Thu, 03 Dec 2009 09:40:42
You'll be able to inherit for portions of it, but you can actually just copy and paste the file into yours for the most part. Since your'e going to replace their auction house, you'll want to stop their addon from ever loading. You would accomplish this by replacing teh global AuctionFrame_LoadUI function:
function AuctionFrame_LoadUI() UIParentLoadAddOn("Blizzard_AuctionUI"); end
With a version that loads your addon instead. Then when you get to the auction house, your addon loads instead of theirs.
-
Posted by docseuss on Sat, 05 Dec 2009 23:28:47
OK to clarify one thing first is that I am actually not replacing their auction house UI. I just wanted to use the same layout to display a personal loot table that my addon creates and manages.
I am experiencing some weirdness however. I have at this point removed all the scripts and have basically just copied their XML into a new XML frame and template. Also I removed the tabs and just kept the Browse Frame as that is the only one I care about. However now when I open the auction house the Browse tab is blank. I have checked and have renamed anything and everything I can find that may relate to the Blizzard Auction House. I have even stripped all the code out of it and my Frame now only contains XML only.
I am really perplexed as to what is going on. If you have any knowledge about this I would SO appreciate it as I have now spent 2 days trying to figure it out. All I want is the layout they use for the Browse tab.
Thanks!
-
Posted by jnwhiteh on Sun, 06 Dec 2009 10:57:46
You have to have something that's conflicting with their name.. or a script that's running. That's the only reason you'd see something like this.
-
Posted by docseuss on Mon, 07 Dec 2009 18:22:32
Thanks for the reply and after knowing for sure that there is no hidden mechanisim for the windows being linked I have the clear thought of literally changing anything in the XML that had a name set. Apparently every piece of a frame is global?
Anyhow once I went back and changed everythign not just those that refered to the auction frame it works as expected. I was under the impression that everythign contained with in the main frame was local to that frame. Apparently not.
Thanks as always!
-
Posted by jnwhiteh on Mon, 07 Dec 2009 23:28:11
Nope, anything with a name like $parentFoo will be named the name of it's parent followed by "Foo", in the global scope.
-
Posted by docseuss on Fri, 11 Dec 2009 21:03:35
Yeah it wasn't the $parent name fields that were getting me it was the actual name fields predefined in the Blizzard_AuctionUI.xml.
OK onto my next plead for help from Jason or anyone else :) I apologize for posting such a long function, but basically its just the AuctionFrameBrowse_Update() from the AuctionHouse code. I have stripped it down to the bare minimums and have tried putting as much debugging code as I can into it. Everything seems to be calculating/setting correctly based on my debug results and I get no errors what so ever, but for the life of my I can not get the scrollframe to display any results.
I have read/reread the chapters on scollframes and even about a dozen posts on the subject most saying that the FauxScrollFrame_Update() function is actually responsible for painting things onto the screen, however I just can't get it to work and was hoping beyond all hope that you or someone else can shed some light on what I am missing. It is absolutley driving me bonkers!
Anyhow thanks in advance and if you need to see my XML stuff please let me know. Have a good weekend!
P.S. Alos if it helps here is the link to my CurseForge project. http://wow.curseforge.com/addons/gambitraidsystem
function PersonalLootFrameBrowse_Update() --use my own db count to get total items local numBatchItems if #PL.db.char.personalloot.items > 50 then numBatchItems = 50 else numBatchItems = #PL.db.char.personalloot.items end PL:Print("Items in DB: " .. numBatchItems ) local totalItems = #PL.db.char.personalloot.items --GetNumAuctionItems("list"); local button, buttonName, buttonHighlight, iconTexture, itemName, color, itemCount, moneyFrame, yourBidText, buyoutFrame, buyoutMoney; local offset = FauxScrollFrame_GetOffset(PersonalLootBrowseScrollFrame); local index; local isLastSlotEmpty; --local name, texture, count, quality, canUse, level, minBid, minIncrement, buyoutPrice, duration, bidAmount, highBidder, owner; local name,link,texture,itemID,quality,iLevel,reqLevel,class,subclass,maxStack,equipSlot,texture,vendorPrice,marketPrice,marketPriceFound,quantity,dateReceived; local displayedPrice, requiredBid; -- BrowseBidButton:Disable(); -- BrowseBuyoutButton:Disable(); -- Update sort arrows PersonalLootFrameBrowse_UpdateArrows(); -- Show the no results text if no items found if ( numBatchItems == 0 ) then PersonalLootBrowseNoResultsText:Show(); else PersonalLootBrowseNoResultsText:Hide(); end for i=1, NUM_BROWSE_TO_DISPLAY do index = offset + i + (NUM_AUCTION_ITEMS_PER_PAGE * PersonalLootFrameBrowse.page); PL:Print("Offset: " .. index) button = _G["PersonalLootBrowseButton"..i]; if button then PL:Print("Button Found: " .. i) else PL:Print("Button Not Found") end -- Show or hide auction buttons if ( index > (numBatchItems + (NUM_AUCTION_ITEMS_PER_PAGE * PersonalLootFrameBrowse.page)) ) then button:Hide(); -- If the last button is empty then set isLastSlotEmpty var if ( i == NUM_BROWSE_TO_DISPLAY ) then isLastSlotEmpty = 1; end else button:Show(); buttonName = "PersonalLootBrowseButton"..i; PL:Print("Button Name: " .. buttonName) -- name,link,texture,itemID,quality,iLevel,reqLevel,class,subclass,maxStack,equipSlot,vendorPrice,marketPrice,marketPriceFound,quantity,dateReceived --retrieve item by index from the personal loot db PL:Print("Index: " .. offset + i) local item = {name = PL.db.char.personalloot.items[offset + i].Name, link = PL.db.char.personalloot.items[offset + i].Link, itemID = PL.db.char.personalloot.items[offset + i].ItemID, quality = PL.db.char.personalloot.items[offset + i].Quality, iLevel = PL.db.char.personalloot.items[offset + i].ItemLevel, reqLevel = PL.db.char.personalloot.items[offset + i].ReqLevel, class = PL.db.char.personalloot.items[offset + i].Class, subclass = PL.db.char.personalloot.items[offset + i]. Subclass, maxStack = PL.db.char.personalloot.items[offset + i].MaxStack, equipSlot = PL.db.char.personalloot.items[offset + i].EquipSlot, texture = PL.db.char.personalloot.items[offset + i].Texture, vendorPrice = PL.db.char.personalloot.items[offset + i].VendorPrice, marketPrice = PL.db.char.personalloot.items[offset + i].MarketPrice, marketPriceFound = PL.db.char.personalloot.items[offset + i].MarketPriceFound, quantity = PL.db.char.personalloot.items[offset + i].TotalLooted, dateReceived = PL.db.char.personalloot.items[offset + i].DateReceived,} --name,link,texture,itemID,quality,iLevel,reqLevel,class,subclass,maxStack,equipSlot,texture,vendorPrice,marketPrice,marketPriceFound,quantity,dateReceived = PL.db.char.personalloot.items[offset + i]; PL:Print ("Found Item: " .. item.name); PL:Print ("Quantity: " .. item.quantity); --name, texture, count, quality, canUse, level, minBid, minIncrement, buyoutPrice, bidAmount, highBidder, owner = GetAuctionItemInfo("list", offset + i); if ( not name ) then --Bug 145328 button:Hide(); -- If the last button is empty then set isLastSlotEmpty var isLastSlotEmpty = (i == NUM_BROWSE_TO_DISPLAY); end --duration = GetAuctionItemTimeLeft("list", offset + i); -- Resize button if there isn't a scrollbar buttonHighlight = _G["PersonalLootBrowseButton"..i.."Highlight"]; if buttonHighlight then PL:Print("Button Highlight Found") else PL:Print("Button Highlight Not Found") end if ( numBatchItems < NUM_BROWSE_TO_DISPLAY ) then button:SetWidth(625); buttonHighlight:SetWidth(589); --PersonalLootBrowseCurrentBidSort:SetWidth(207); PersonalLootBrowseLevelSort:SetWidth(430); elseif ( numBatchItems == NUM_BROWSE_TO_DISPLAY and totalItems <= NUM_BROWSE_TO_DISPLAY ) then button:SetWidth(625); buttonHighlight:SetWidth(589); --PersonalLootBrowseCurrentBidSort:SetWidth(207); PersonalLootBrowseLevelSort:SetWidth(430); else button:SetWidth(600); buttonHighlight:SetWidth(562); --PersonalLootBrowseCurrentBidSort:SetWidth(184); PersonalLootBrowseLevelSort:SetWidth(430); end -- Set name and quality color color = ITEM_QUALITY_COLORS[item.quality]; itemName = _G[buttonName.."Name"]; PL:Print(itemName) itemName:SetText(item.name); itemName:SetVertexColor(color.r, color.g, color.b); PL:Print(itemName) -- Set level if ( item.iLevel > UnitLevel("player") ) then _G[buttonName.."Level"]:SetText(RED_FONT_COLOR_CODE..level..FONT_COLOR_CODE_CLOSE); else _G[buttonName.."Level"]:SetText(item.iLevel); end -- Set closing time --_G[buttonName.."ClosingTimeText"]:SetText(PersonalLootFrame_GetTimeLeftText(duration)); --_G[buttonName.."ClosingTime"].tooltip = PersonalLootFrame_GetTimeLeftTooltipText(duration); --Set item texture, count, and usability iconTexture = _G[buttonName.."ItemIconTexture"]; iconTexture:SetTexture(item.texture); if ( not canUse ) then iconTexture:SetVertexColor(1.0, 0.1, 0.1); else iconTexture:SetVertexColor(1.0, 1.0, 1.0); end itemCount = _G[buttonName.."ItemCount"]; if ( tonumber(item.quantity) > 1 ) then itemCount:SetText(item.quantity); itemCount:Show(); else itemCount:Hide(); end -- Set high bid --moneyFrame = _G[buttonName.."MoneyFrame"]; -- If not bidAmount set the bid amount to the min bid -- if ( bidAmount == 0 ) then -- displayedPrice = minBid; -- requiredBid = minBid; -- else -- displayedPrice = bidAmount; -- requiredBid = bidAmount + minIncrement ; -- end -- MoneyFrame_Update(moneyFrame:GetName(), displayedPrice); -- yourBidText = _G[buttonName.."YourBidText"]; -- if ( highBidder ) then -- yourBidText:Show(); -- else -- yourBidText:Hide(); -- end -- if ( requiredBid >= MAXIMUM_BID_PRICE ) then --Lie about our buyout price -- buyoutPrice = requiredBid; -- end -- buyoutFrame = _G[buttonName.."BuyoutFrame"]; -- if ( buyoutPrice > 0 ) then -- moneyFrame:SetPoint("RIGHT", button, "RIGHT", 10, 10); -- buyoutMoney = _G[buyoutFrame:GetName().."Money"]; -- MoneyFrame_Update(buyoutMoney, buyoutPrice); -- buyoutFrame:Show(); -- else -- moneyFrame:SetPoint("RIGHT", button, "RIGHT", 10, 3); -- buyoutFrame:Hide(); -- end --Set high bidder -- if ( not highBidder ) then -- highBidder = RED_FONT_COLOR_CODE..NO_BIDS..FONT_COLOR_CODE_CLOSE; -- end --_G[buttonName.."HighBidder"]:SetText(owner); -- button.bidAmount = displayedPrice; -- button.buyoutPrice = buyoutPrice; button.itemCount = tonumber(item.quantity); -- Set highlight -- if ( GetSelectedItem("list") and (offset + i) == GetSelectedItem("list") ) then -- button:LockHighlight(); -- if ( buyoutPrice > 0 and buyoutPrice >= minBid ) then -- local canBuyout = 1; -- if ( GetMoney() < buyoutPrice ) then -- if ( not highBidder or GetMoney()+bidAmount < buyoutPrice ) then -- canBuyout = nil; -- end -- end -- if ( canBuyout and (owner ~= UnitName("player")) ) then -- BrowseBuyoutButton:Enable(); -- AuctionFrame.buyoutPrice = buyoutPrice; -- end -- else -- AuctionFrame.buyoutPrice = nil; -- end --Set bid -- MoneyInputFrame_SetCopper(BrowseBidPrice, requiredBid); -- if ( not highBidder and owner ~= UnitName("player") and GetMoney() >= MoneyInputFrame_GetCopper(BrowseBidPrice) and MoneyInputFrame_GetCopper(BrowseBidPrice) <= MAXIMUM_BID_PRICE ) then -- BrowseBidButton:Enable(); -- end -- else -- button:UnlockHighlight(); -- end end end -- Update scrollFrame -- If more than one page of auctions show the next and prev arrows when the scrollframe is scrolled all the way down if ( totalItems > NUM_AUCTION_ITEMS_PER_PAGE ) then PersonalLootBrowsePrevPageButton.isEnabled = (PersonalLootFrameBrowse.page ~= 0); PersonalLootBrowseNextPageButton.isEnabled = (PersonalLootFrameBrowse.page ~= (ceil(totalItems/NUM_AUCTION_ITEMS_PER_PAGE) - 1)); if ( isLastSlotEmpty ) then PersonalLootBrowseSearchCountText:Show(); local itemsMin = PersonalLootFrameBrowse.page * NUM_AUCTION_ITEMS_PER_PAGE + 1; local itemsMax = itemsMin + numBatchItems - 1; PersonalLootBrowseSearchCountText:SetFormattedText(NUMBER_OF_RESULTS_TEMPLATE, itemsMin, itemsMax, totalItems); else PersonalLootBrowseSearchCountText:Hide(); end -- Artifically inflate the number of results so the scrollbar scrolls one extra row numBatchItems = numBatchItems + 1; else PersonalLootBrowsePrevPageButton.isEnabled = false; PersonalLootBrowseNextPageButton.isEnabled = false; PersonalLootBrowseSearchCountText:Hide(); end PL:Print("numBatchItems: " .. numBatchItems .. " Num to Display " .. NUM_BROWSE_TO_DISPLAY .. " Button Height: " .. AUCTIONS_BUTTON_HEIGHT) FauxScrollFrame_Update(PersonalLootBrowseScrollFrame, numBatchItems, NUM_BROWSE_TO_DISPLAY, AUCTIONS_BUTTON_HEIGHT); end
-
Posted by jnwhiteh on Fri, 11 Dec 2009 21:50:13
The FauxScrollFrame_Update() function doesn't actually do the painting, that's part of your issue. You can see that code in UIPanelTemplates.lua. All that function does is update the buttons, set the scroll frame offset, and shrink or widen the frame as necessary because of the scroll frame.
Look at the MacroIconTest example in the book.. it doesn't use the FSF templates, but the same concept applies.