WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Legion Beta archived threads (https://www.wowinterface.com/forums/forumdisplay.php?f=177)
-   -   QueryAuctionItems causes error in Blizzard_AuctionUI.lua (https://www.wowinterface.com/forums/showthread.php?t=53939)

ceylina 07-19-16 08:18 PM

QueryAuctionItems causes error in Blizzard_AuctionUI.lua
 
QueryAuctionItems() full scan (equivalent of getAll) returns error

Running the following if you can run a full scan (as checked by CanSendAuctionQuery()) wil lthrow an error

To reporduce:

Have no addons loaded
Open Auciton house

In chat run

/run QueryAuctionItems( "", nil, nil, 0, 0, 0, true, false, nil )

wait...

Will return the following error example (this was taken from the live servers, results may be different)

Code:

aceBlizzard_AuctionUI\Blizzard_AuctionUI.lua:733: attempt to index local 'color' (a nil value)
...aceBlizzard_AuctionUI\Blizzard_AuctionUI.lua:733: in function `AuctionFrameBrowse_Update'
...aceBlizzard_AuctionUI\Blizzard_AuctionUI.lua:260: in function <...aceBlizzard_AuctionUI\Blizzard_AuctionUI.lua:258>

Locals:
numBatchAuctions = 59607
totalAuctions = 59607
button = BrowseButton1 {
 0 = <userdata>
}
buttonName = "BrowseButton1"
buttonHighlight = BrowseButton1Highlight {
 0 = <userdata>
}
iconTexture = nil
itemName = BrowseButton1Name {
 0 = <userdata>
}
color = nil
itemCount = nil
moneyFrame = nil
yourBidText = nil
buyoutFrame = nil
buyoutMoney = nil
offset = 0
index = 1
isLastSlotEmpty = false
name = ""
texture = nil
count = 1
quality = -1
canUse = false
level = -1805820848
levelColHeader = nil
minBid = 14048
minIncrement = 0
buyoutPrice = 17028
duration = 4
bidAmount = 0
highBidder = false
bidderFullName = nil
owner = nil
ownerFullName = nil
saleStatus = 0
itemId = 3575
hasAllInfo = false
displayedPrice = nil
requiredBid = nil
(for index) = 1
(for limit) = 8
(for step) = 1
i = 1
(*temporary) = <function> defined =[C]:-1
(*temporary) = BrowseButton1Name {
 0 = <userdata>
}
(*temporary) = ""
(*temporary) = <userdata>
(*temporary) = false
(*temporary) = -1805820848
(*temporary) = nil
(*temporary) = 14048
(*temporary) = 0
(*temporary) = 17028
(*temporary) = 0
(*temporary) = false
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = 0
(*temporary) = 3575
(*temporary) = false
(*temporary) = "attempt to index local 'color' (a nil value)"

This no longer occurs in Beta so something has changed between live and Beta

TOM_RUS 07-21-16 04:43 AM

Some items return -1 as quality, that's why this error happens.

ceylina 07-21-16 04:53 PM

Quote:

Originally Posted by TOM_RUS (Post 316689)
Some items return -1 as quality, that's why this error happens.

Noticed that. It explains then why line 730 in the blizzard addon

color = ITEM_QUALITY_COLORS[quality];

would error out.

I would still consider this a bad bug on their part. Why would quality ever return as -1 anyway?

It makes no sense because in UIParent.lua the table array for ITEM_QUALITY_COLORS is

ITEM_QUALITY_COLORS = { };
for i = 0, NUM_LE_ITEM_QUALITYS - 1 do
ITEM_QUALITY_COLORS[i] = { };
ITEM_QUALITY_COLORS[i].r,
ITEM_QUALITY_COLORS[i].g,
ITEM_QUALITY_COLORS[i].b,
ITEM_QUALITY_COLORS[i].hex = GetItemQualityColor(i);
ITEM_QUALITY_COLORS[i].hex = "|c"..ITEM_QUALITY_COLORS[i].hex;
end

So it should not even be possible to return quality as -1


LE_ITEM_QUALITY_POOR=0
LE_ITEM_QUALITY_COMMON=1
LE_ITEM_QUALITY_UNCOMMON=2
LE_ITEM_QUALITY_RARE=3
LE_ITEM_QUALITY_EPIC=4
LE_ITEM_QUALITY_LEGENDARY=5
LE_ITEM_QUALITY_ARTIFACT=6
LE_ITEM_QUALITY_HEIRLOOM=7
LE_ITEM_QUALITY_WOW_TOKEN=8
NUM_LE_ITEM_QUALITYS=9

So that array is saying from 0 to (9-1) so the indices range from 0 to 8 which is what is returned in the quality return...

Either way quality should never return -1 because it would cause color = ITEM_QUALITY_COLORS[quality]; to have an empty result which is what happens and why itemName:SetVertexColor(color.r, color.g, color.b); then dies

They need a check that says if quality is less than 0 set it to 0 or fix whatever allows it to return -1

ceylina 07-22-16 01:31 PM

More observations:

In Blizzard's AuctionUI.lua

The initial value of that drop down is set by


Code:

function BrowseDropDown_OnLoad(self)
        UIDropDownMenu_Initialize(self, BrowseDropDown_Initialize);
        UIDropDownMenu_SetSelectedValue(BrowseDropDown,-1);
end

so therefore if you use QueryAuctionItems() to initiate a fullscan, it will not change that value and I bet anything it get pushed all the way down the code and spits out quality as -1 thus causing the bug when this is hit later in the code

color = ITEM_QUALITY_COLORS[quality];

ceylina 07-22-16 02:25 PM

Even more fun

If I try and run

Code:

/dump AuctionCategories[AuctionFrameBrowse.selectedCategoryIndex].subCategories[AuctionFrameBrowse.selectedSubCategoryIndex].subCategories[AuctionFrameBrowse.selectedSubSubCategoryIndex].filters
with no auction categories open at all (meaning all those sections like weapons and armor not selected)

I get the error (this is with the auction house open to browse and no categories selected):


Code:

1x [string "return AuctionCategories[AuctionFrameBrowse..."]:1: attempt to index field '?' (a nil value)
[string "return AuctionCategories[AuctionFrameBrowse..."]:1: in function `func'
Blizzard_DebugTools\Dump.lua:389: in function `DevTools_DumpCommand'
FrameXML\ChatFrame.lua:2308: in function `?'
FrameXML\ChatFrame.lua:4332: in function <FrameXML\ChatFrame.lua:4279>
[C]: in function `ChatEdit_ParseText'
FrameXML\ChatFrame.lua:4000: in function `ChatEdit_SendText'
FrameXML\ChatFrame.lua:4036: in function `ChatEdit_OnEnterPressed'
[string "*:OnEnterPressed"]:1: in function <[string "*:OnEnterPressed"]:1>

Locals:
(*temporary) = nil
(*temporary) = nil
(*temporary) = "attempt to index field '?' (a nil value)"

If I open a category, sub category, and sub sub category of armor / mail / head, I get this as a result


Code:

Dump: value=AuctionCategories[AuctionFrameBrowse.selectedCategoryIndex].subCategories[AuctionFrameBrowse.selectedSubCategoryIndex].subCategories[AuctionFrameBrowse.selectedSubSubCategoryIndex].filters
 [1]={
  [1]={
    subClassID=3,
    inventoryType=1,
    classID=4
  }
 }

So there you go. Instead of returning nil and checking for that to make sure you don't error out, filter data setup around line 399 will throw an error that causes problems down the code chain.


Even just running /dump AuctionCategories[AuctionFrameBrowse.selectedCategoryIndex].filters does it without a category selected.


So therefore, is this code the bug?

Code:

        local filterData;
        if categoryIndex and subCategoryIndex and subSubCategoryIndex then
                filterData = AuctionCategories[categoryIndex].subCategories[subCategoryIndex].subCategories[subSubCategoryIndex].filters;
        elseif categoryIndex and subCategoryIndex then
                filterData = AuctionCategories[categoryIndex].subCategories[subCategoryIndex].filters;
        elseif categoryIndex then
                filterData = AuctionCategories[categoryIndex].filters;
        else
                -- not filtering by category, leave nil for all
end

/dump AuctionFrameBrowse.selectedCategoryIndex without anything open category wise returns "empty result"

ceylina 07-22-16 04:45 PM

Lastly, the changes to queryAuctionItems in 7.0 are this (3 items merged into one, removed, and placed at the end)


pre 7.0
QueryAuctionItems(text, minLevel, maxLevel, invType, class, subclass, page, usable, rarity, false, exactMatch);

now
QueryAuctionItems(text, minLevel, maxLevel, page, usable, rarity, false, exactMatch, filterData);


So invType, class, subclass were rolled into filterData and the new value is nil for not filtering categories.

That false you see above in both code is the GetALL argument that has not changed. it is a boolean value where true means scan all auction items and return a single page mass query (able to be done every 15 minutes or when CanSendAuctionQuery() returns true,true) and false is the normal 50 items per page query results.

So from a script stand point, the arguments themselves have not changed, only been slightly moved around.


To check the returns of some of these arguments, you can do these dumps in game to find the value. Open the AH and at browse, run any of these to see the default value or the selected value corresponding to the arguments that QueryAuctionItems() can accept


/dump BrowseName:GetText()
/dump BrowseMinLevel:GetNumber()
/dump BrowseMaxLevel:GetNumber()
/dump AuctionFrameBrowse.selectedCategoryIndex
/dump AuctionFrameBrowse.selectedSubCategoryIndex
/dump AuctionFrameBrowse.selectedSubSubCategoryIndex
/dump AuctionFrameBrowse.page
/dump IsUsableCheckButton:GetChecked()
/dump UIDropDownMenu_GetSelectedValue(BrowseDropDown)
/dump ExactMatchCheckButton:GetChecked()


This is the code that builds the filter value(s) for filterData

Code:

        local filterData;
        if categoryIndex and subCategoryIndex and subSubCategoryIndex then
                filterData = AuctionCategories[categoryIndex].subCategories[subCategoryIndex].subCategories[subSubCategoryIndex].filters;
        elseif categoryIndex and subCategoryIndex then
                filterData = AuctionCategories[categoryIndex].subCategories[subCategoryIndex].filters;
        elseif categoryIndex then
                filterData = AuctionCategories[categoryIndex].filters;
        else
                -- not filtering by category, leave nil for all
        end


Here are what those variables equate to:

categoryIndex = AuctionFrameBrowse.selectedCategoryIndex
subCategoryIndex = AuctionFrameBrowse.selectedSubCategoryIndex
subSubCategoryIndex = AuctionFrameBrowse.selectedSubSubCategoryIndex

ceylina 07-24-16 01:59 PM

If you want to do a full scan single page query using the default entries of objects on the browse tab, this is the long form code for QueryAuctionItems()

Code:

QueryAuctionItems(BrowseName:GetText(), BrowseMinLevel:GetNumber(), BrowseMaxLevel:GetNumber(), AuctionFrameBrowse.selectedCategoryIndex, AuctionFrameBrowse.selectedSubCategoryIndex, AuctionFrameBrowse.selectedSubSubCategoryIndex, AuctionFrameBrowse.page, IsUsableCheckButton:GetChecked(), UIDropDownMenu_GetSelectedValue(BrowseDropDown), ExactMatchCheckButton:GetChecked())

This pulls the code out of line 431 of the AuciotnUI.lua file from the function AuctionFrameBrowse_Search(), passing to the local function AuctionFrameBrowse_SearchHelper() - this is what contains QueryAuctionItems() and what passes arguments to it.

ceylina 07-24-16 10:46 PM

Small update. Ran a full scan test on the Beta servers and there was no error so either something is fixed back end or there is a flag/index/header/ etc not enabled on live that is throwing off this (like artifact color?)

Granted there were only 12,000 items on beta, I ran a test on a very low pop Brazilian server that only had 7,000 items on the AH and it threw the error as well.


All times are GMT -6. The time now is 01:55 PM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI