Thread Tools Display Modes
01/11/17, 09:12 AM   #1
dominoid
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 34
Help Getting Crown Furniture Information

I was able to successfully write a personal add-on to retrieve all the furniture recipes and furniture piece information in the game to create this spreadsheet:

https://docs.google.com/spreadsheets...it?usp=sharing

The next stage of the project is to list if a furniture item is purchasable in the crown store and for what amount. I wish code to loop through the items in this interface:



I don't even known where to start. Some help please?

TIA - Dominoid
  Reply With Quote
01/11/17, 01:06 PM   #2
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,578
It looks like many crownstore methods are private, so I'd say your best chance is to use
Lua Code:
  1. SHARED_FURNITURE:GetMarketProductCategoryTreeData():GetNumEntriesRecursive(function(entry)
  2.     -- do something with the entry
  3. end)
I have only tried GetPlaceableFurnitureCategoryTreeData so far, but if it works similar it should give you all entries in the crown store. Just make sure that the "filter by" box is empty, otherwise it won't show everything.
  Reply With Quote
01/11/17, 03:15 PM   #3
dominoid
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 34
Originally Posted by sirinsidiator View Post
It looks like many crownstore methods are private, so I'd say your best chance is to use
Lua Code:
  1. SHARED_FURNITURE:GetMarketProductCategoryTreeData():GetNumEntriesRecursive(function(entry)
  2.     -- do something with the entry
  3. end)
I have only tried GetPlaceableFurnitureCategoryTreeData so far, but if it works similar it should give you all entries in the crown store. Just make sure that the "filter by" box is empty, otherwise it won't show everything.
I appreciate the help, but I have no idea how to use what you gave. I'm sure it's blatantly obvious. Would you mind leading me along a little bit more?
  Reply With Quote
01/11/17, 04:25 PM   #4
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,578
You could create a slash command in your addon like this for example:

Lua Code:
  1. SLASH_COMMANDS["/exportcsf"]=function()
  2.     MyAddonsSaveData = {}
  3.     SHARED_FURNITURE:GetMarketProductCategoryTreeData():GetNumEntriesRecursive(function(entry)
  4.         local line = {}
  5.         line[#line + 1] = tostring(entry.marketProductId)
  6.         line[#line + 1] = entry.formattedName
  7.         line[#line + 1] = entry.icon
  8.         line[#line + 1] = tostring(entry.quality)
  9.         line[#line + 1] = tostring(entry.cost)
  10.         line[#line + 1] = tostring(entry.costAfterDiscount)
  11.         line[#line + 1] = tostring(entry.discountPercent)
  12.         line[#line + 1] = tostring(entry.categoryId)
  13.         line[#line + 1] = tostring(entry.subcategoryId)
  14.         line[#line + 1] = tostring(entry.isFree)
  15.         line[#line + 1] = tostring(entry.isNew)
  16.         line[#line + 1] = tostring(entry.onSale)
  17.         MyAddonsSaveData[#MyAddonsSaveData + 1] = table.concat(line, ";")
  18.     end)
  19. end

It will save each entry in a new line in your saved variables file and you can then just use notepad++ to clean it up and save it as a csv.
You need to open the market tab in the housing editor once before it will produce any data.
  Reply With Quote
01/11/17, 06:13 PM   #5
dominoid
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 34
Works amazing. Thank you. Now I gotta figure out how you did it so I don't ask stupid questions.
  Reply With Quote
01/16/17, 07:56 PM   #6
dominoid
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 34
So after update 2.7.2 on the PTS this is the error I get with the code which worked before. What changed?




Line 45 is

Code:
SHARED_FURNITURE:GetMarketProductCategoryTreeData():GetNumEntriesRecursive(function(entry)

TIA - Dominoid
  Reply With Quote
01/17/17, 02:26 AM   #7
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,578
It looks like the function has been renamed to GetNumEntryItemsRecursive. No idea if there are other changes that may prevent it from working. I'll take a closer look in the evening.
  Reply With Quote
01/17/17, 09:18 AM   #8
dominoid
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 34
That was the only change needed thank you. Again.
  Reply With Quote

ESOUI » AddOns » AddOn Help/Support » Help Getting Crown Furniture Information


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