ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   AddOn Help/Support (https://www.esoui.com/forums/forumdisplay.php?f=164)
-   -   Help Getting Crown Furniture Information (https://www.esoui.com/forums/showthread.php?t=6733)

dominoid 01/11/17 09:12 AM

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

sirinsidiator 01/11/17 01:06 PM

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.

dominoid 01/11/17 03:15 PM

Quote:

Originally Posted by sirinsidiator (Post 29366)
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?

sirinsidiator 01/11/17 04:25 PM

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.

dominoid 01/11/17 06:13 PM

Works amazing. Thank you. Now I gotta figure out how you did it so I don't ask stupid questions.

dominoid 01/16/17 07:56 PM

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

sirinsidiator 01/17/17 02:26 AM

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.

dominoid 01/17/17 09:18 AM

That was the only change needed thank you. Again.


All times are GMT -6. The time now is 10:40 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI