Thread Tools Display Modes
02/26/15, 02:28 AM   #1
JordyMoos
AddOn Author - Click to view addons
Join Date: Jan 2015
Posts: 12
How to set the guild store filters.

Hi guys

Is there a way to set the guild store filters via an addon?

If i set this:
Code:
SetTradingHouseFilterRange(TRADING_HOUSE_FILTER_TYPE_PRICE, 100, 150)
And i run a search:
Code:
ExecuteTradingHouseSearch(1, TRADING_HOUSE_SORT_SALE_PRICE, ZO_SORT_ORDER_UP)
Then i will get something like no results found.
Which is odd, because if i manually set the price range then i do get results.

For me it would also be fine to set the existing gui input filters (which might be even nicer) but i do not know the names/ids of those gui elements so i have no idea how to control them.

Cheers

Last edited by JordyMoos : 02/26/15 at 02:56 AM.
  Reply With Quote
02/26/15, 10:00 AM   #2
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Originally Posted by JordyMoos View Post

Is there a way to set the guild store filters via an addon?

If i set this:
Lua Code:
  1. SetTradingHouseFilterRange(TRADING_HOUSE_FILTER_TYPE_PRICE, 100, 150)
  2. ExecuteTradingHouseSearch(1, TRADING_HOUSE_SORT_SALE_PRICE, ZO_SORT_ORDER_UP)
It looks like it starts at page 0, not page 1. There probably were not enough results for you to see anything on page 1.

Try this:
Lua Code:
  1. SetTradingHouseFilterRange(TRADING_HOUSE_FILTER_TYPE_PRICE, 100, 150)
  2. ExecuteTradingHouseSearch(0, TRADING_HOUSE_SORT_SALE_PRICE, ZO_SORT_ORDER_UP)
  Reply With Quote
02/26/15, 12:21 PM   #3
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,578
Circonian is right, the page offset is 0 based. Requesting offset 1 will return page 2.

You can access the ui elements via
Lua Code:
  1. TRADING_HOUSE.m_browseItems

Item categories are a bit tricky as they change depending on the selected categories, as do the enchantment and trait filter.
I haven't done much with them, except for hiding them.
You get their parent control like this:
Lua Code:
  1. TRADING_HOUSE.m_browseItems:GetNamedChild("ItemCategory")
Your best bet is to look at it with zgoo and check what its children are named. I'll explain how to change the value of a combobox a bit further down.

The price and level are more straight forward.
First get a reference to the common control
Lua Code:
  1. local common = TRADING_HOUSE.m_browseItems:GetNamedChild("Common")
and then access them like this:
Lua Code:
  1. local minPriceBox = common:GetNamedChild("MinPriceBox")
  2. local maxPriceBox = common:GetNamedChild("MaxPriceBox")
  3. local minLevelBox = common:GetNamedChild("MinLevelBox")
  4. local maxLevelBox = common:GetNamedChild("MaxLevelBox")

You can then set their values with :SetText().

The quality selector is a simple combobox and you can control it like this*:
Lua Code:
  1. local qualityControl = common:GetNamedChild("Quality")
  2. local qualityComboBox = ZO_ComboBox_ObjectFromContainer(qualityControl)
  3. qualityComboBox:SetSelectedItem(name) -- name is the label of the entry
*untested. don't kill me if this does not work

Finally you can start the search by calling TRADING_HOUSE.m_search:InternalExecuteSearch() which will apply the set filters.

I could also tell you a few things about setting the sort order and page, but I'll stop here for now
Btw. if you want to be compatible with AwesomeGuildStore it's a whole different story

Last edited by sirinsidiator : 02/26/15 at 12:27 PM.
  Reply With Quote
02/26/15, 01:04 PM   #4
JordyMoos
AddOn Author - Click to view addons
Join Date: Jan 2015
Posts: 12
Originally Posted by circonian View Post
It looks like it starts at page 0, not page 1. There probably were not enough results for you to see anything on page 1.

Try this:
Lua Code:
  1. SetTradingHouseFilterRange(TRADING_HOUSE_FILTER_TYPE_PRICE, 100, 150)
  2. ExecuteTradingHouseSearch(0, TRADING_HOUSE_SORT_SALE_PRICE, ZO_SORT_ORDER_UP)
Wooow i feel so stupid now. I tried stuf for over an hour expecting that something went wrong with the filters not thinking about that pages might start from 0.

Thanks a lot ciconian it works!
  Reply With Quote
02/26/15, 01:12 PM   #5
JordyMoos
AddOn Author - Click to view addons
Join Date: Jan 2015
Posts: 12
Originally Posted by sirinsidiator View Post
Circonian is right, the page offset is 0 based. Requesting offset 1 will return page 2.

You can access the ui elements via
Lua Code:
  1. TRADING_HOUSE.m_browseItems

Item categories are a bit tricky as they change depending on the selected categories, as do the enchantment and trait filter.
I haven't done much with them, except for hiding them.
You get their parent control like this:
Lua Code:
  1. TRADING_HOUSE.m_browseItems:GetNamedChild("ItemCategory")
Your best bet is to look at it with zgoo and check what its children are named. I'll explain how to change the value of a combobox a bit further down.

The price and level are more straight forward.
First get a reference to the common control
Lua Code:
  1. local common = TRADING_HOUSE.m_browseItems:GetNamedChild("Common")
and then access them like this:
Lua Code:
  1. local minPriceBox = common:GetNamedChild("MinPriceBox")
  2. local maxPriceBox = common:GetNamedChild("MaxPriceBox")
  3. local minLevelBox = common:GetNamedChild("MinLevelBox")
  4. local maxLevelBox = common:GetNamedChild("MaxLevelBox")

You can then set their values with :SetText().

The quality selector is a simple combobox and you can control it like this*:
Lua Code:
  1. local qualityControl = common:GetNamedChild("Quality")
  2. local qualityComboBox = ZO_ComboBox_ObjectFromContainer(qualityControl)
  3. qualityComboBox:SetSelectedItem(name) -- name is the label of the entry
*untested. don't kill me if this does not work

Finally you can start the search by calling TRADING_HOUSE.m_search:InternalExecuteSearch() which will apply the set filters.

I could also tell you a few things about setting the sort order and page, but I'll stop here for now
Btw. if you want to be compatible with AwesomeGuildStore it's a whole different story
Hey sirinsidiator !

Thanks a lot for your super clear information about the gui.
This makes it way more understandable what is happening.
Also the zgoo addon you are talking about looks handy, a hard part of their gui is always finding out how they named the controls. Hopefully zgoo makes that a lot easier.

When i am finished with the addon i will check if it works fine with your addon

Cheers guys
  Reply With Quote

ESOUI » AddOns » AddOn Help/Support » How to set the guild store filters.


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