Download
(174 Kb)
Download
Updated: 01/21/24 03:48 PM
Pictures
File Info
Compatibility:
Endless Archive (9.2.5)
Updated:01/21/24 03:48 PM
Created:11/29/18 02:56 PM
Monthly downloads:25,453
Total downloads:971,098
Favorites:534
MD5:
LibPrice  Popular! (More than 5000 hits)
Version: 7.43
by: ziggr, Sharlikran
A library for gathering an item's cost from various add-ons:

As well as some hard-coded data from other sources:
  • The Crown Store
  • Rolis Hlaalu, the Mastercraft Mediator
  • Faustina Curio, the Achievement Mediator

GitHub Repo

https://github.com/ziggr/ESO-LibPrice

Example Code


Lua Code:
  1. function LibPrice_Example.SlashCommand()
  2.     local self = LibPrice_Example
  3.  
  4.     for _,item_link in ipairs(EXAMPLE_ITEMS) do
  5.                         -- Just tell me how much this thing costs.
  6.         local gold   = LibPrice.ItemLinkToPriceGold(item_link)
  7.  
  8.                         -- Okay, I changed my mind. Tell me a little more:
  9.                         -- where'd you get  this price from?
  10.                         -- (additional return values from same API)
  11.         gold, source_key, field_name
  12.                      = LibPrice.ItemLinkToPriceGold(item_link)
  13.         local header = self.FormatHeader(item_link, gold, source_key, field_name)
  14.         d(header)
  15.  
  16.                         -- Give me all the data you can find, I'll figure out
  17.                         -- what to do with it later.
  18.         local result = LibPrice.ItemLinkToPriceData(item_link)
  19.         LibPrice_Example.DumpTable(result)
  20.     end
  21. end

7.43 2024-01-21
  • Included sales source from TTC

7.41 2022-01-03
  • Allow listing all price types (GoddessArtemis)
  • Included sources for bid-ask spread data (GoddessArtemis)

7.40 2022-12-23
  • Added CurrencyList (otac0n)
  • Added ItemLinkToBidAskData (otac0n)
  • Added ItemLinkToBidAskSpread (otac0n)

7.3.0 2022-12-17
  • Added Nirn Auction House support (otac0n)

7.2.0 2022-11-10
  • Removed Master Merchant cache from LibPrice. All prices are cached within MM itself and any third party library or mod will receive the price directly from the MM cache.

7.1.2 2022-11-07
  • Removed Master Merchant as optional dependency from manifest file
  • Update 36/ESO 8.2.x/API 101036/Firesong

7.1.1 2021-09-14
  • Master Merchant integration updated to MM 3.0. Thank you, Sharlikran!
  • Update 31/ESO 7.1.0/API 101031/Walking Flame

6.2.1 2021-01-19
  • Attempt to avoid nil error during FurnitureCatalogue lookup.
  • API Bump to Update 28/6.2.1/API 100032/Markarth

5.0.2 2019-05-05
  • ## IsLibrary: true so that Elsweyr can identify this as a library.

5.0.1 2019-05-05
  • Version and API bump. No code change.

4.2.2 2018-12-01
  • add crafting cost for craftable furnishings
  • bugfix achievement furnishings
  • bugfix Rolis Hlaalu furnishings
  • add Music Box, Blood and Glory = 800 crowns

4.2.1 2018-11-29
  • Initial release to support WritWorthy
Archived Files (11)
File Name
Version
Size
Uploader
Date
7.41
177kB
Sharlikran
01/03/23 10:52 PM
7.40
174kB
Sharlikran
12/23/22 05:49 AM
7.3.0
172kB
Sharlikran
12/17/22 10:28 PM
7.2.0
172kB
Sharlikran
11/10/22 08:50 PM
7.1.2
172kB
Sharlikran
11/07/22 03:38 AM
7.1.1
172kB
ziggr
09/14/21 12:43 PM
6.2.1
172kB
ziggr
01/19/21 03:47 PM
5.0.2
172kB
ziggr
05/05/19 03:26 PM
5.0.1
172kB
ziggr
05/05/19 03:15 PM
4.2.2
172kB
ziggr
12/01/18 04:41 PM
4.2.1
172kB
ziggr
11/29/18 02:56 PM


Post A Reply Comment Options
Unread 08/31/23, 01:52 AM  
Saint-Ange
AddOn Author - Click to view AddOns

Forum posts: 10
File comments: 26
Uploads: 4
Originally Posted by Sharlikran
Warning: Spoiler
Thank you very much, it worked! I just had to change (ctx.itemLink, "ttc") to (ctx.itemLink)['ttc']:
Lua Code:
  1. ruleEnv.Register("price", function(default, withValueFallback)
  2.     local libPrice = LibPrice
  3.     if(libPrice == nil) then
  4.         if(withValueFallback == true) then
  5.             return GetItemLinkValue(ctx.itemLink)
  6.         else
  7.             ruleEnv.errorAddonRequired('LibPrice')
  8.         end
  9.     end
  10.     local goldData = libPrice.ItemLinkToPriceData(ctx.itemLink)['ttc']
  11.     return (goldData and goldData.SuggestedPrice) or default or RbI.NaN
  12. end, ruleEnv.NEED_LINKONLY)
Report comment to moderator  
Reply With Quote
Unread 08/30/23, 02:53 PM  
Sharlikran
 
Sharlikran's Avatar
AddOn Author - Click to view AddOns

Forum posts: 613
File comments: 1971
Uploads: 15
Originally Posted by Saint-Ange
Hello,

Sorry to bother you with that but I'm stuck since two days trying to do something but it's way over my understanding:

I'd like to use only TTC SuggestedPrice and not ATT, MM in a function from RulebasedInventory. On their Discord they told me that I had to look at that with you. So I understand that I have to specify the source key somewhere? .. anything I tried at best the returned result was the average sale I think.

Could you show me what I need to change?

edit: I guess I won't need the function to normalize too.
I can't do any programming for you so you will need to learn Lua and the code from Rulebased Inventory if you want to make changes.

Lua Code:
  1. local goldValue, source, fieldname = LibPrice.ItemLinkToPriceGold(itemLink, "ttc")
  2.  
  3. local priceData = LibPrice.ItemLinkToPriceData(itemLink, "ttc")
ItemLinkToPriceData will return a table and then you access it with something like priceData.SuggestedPrice

ItemLinkToPriceGold will return three values the first one goldValue is just the value. Like 9.58 for the average price.

With either method if you had a stack of 100 and the price is 9.58 then that's 958g for that stack. LibPrice does not look at your inventory and figure out the quantity. So you have to do the math.

P.S. There is only one mention of LibPrice in that entire mod.

Functions_Item.lua

Lua Code:
  1. ruleEnv.Register("price", function(default, withValueFallback)
  2.     local libPrice = LibPrice
  3.     if(libPrice == nil) then
  4.         if(withValueFallback == true) then
  5.             return GetItemLinkValue(ctx.itemLink)
  6.         else
  7.             ruleEnv.errorAddonRequired('LibPrice')
  8.         end
  9.     end
  10.     local goldData = libPrice.ItemLinkToPriceData(ctx.itemLink, "ttc")
  11.     return (goldData and goldData.SuggestedPrice) or default or RbI.NaN
  12. end, ruleEnv.NEED_LINKONLY)

There is a chance that will work just like that but no guarantees.
Last edited by Sharlikran : 08/30/23 at 06:14 PM.
Report comment to moderator  
Reply With Quote
Unread 08/30/23, 10:54 AM  
Saint-Ange
AddOn Author - Click to view AddOns

Forum posts: 10
File comments: 26
Uploads: 4
Hello,

Sorry to bother you with that but I'm stuck since two days trying to do something but it's way over my understanding:

I'd like to use only TTC SuggestedPrice and not ATT, MM in a function from RulebasedInventory. On their Discord they told me that I had to look at that with you. So I understand that I have to specify the source key somewhere? .. anything I tried at best the returned result was the average sale I think.

Could you show me what I need to change?

edit: I guess I won't need the function to normalize too.
Last edited by Saint-Ange : 08/30/23 at 10:58 AM.
Report comment to moderator  
Reply With Quote
Unread 09/24/21, 08:08 AM  
Onigar
 
Onigar's Avatar
AddOn Author - Click to view AddOns

Forum posts: 3
File comments: 361
Uploads: 4
Removed comment.

After some thought I realised LibPrice does just what it needs to do.

Adjustments to pricing used needs to be done in the Addon using the Lib.

Thanks
Last edited by Onigar : 10/08/21 at 08:30 AM.
Report comment to moderator  
Reply With Quote
Unread 09/14/21, 09:16 AM  
Sharlikran
 
Sharlikran's Avatar
AddOn Author - Click to view AddOns

Forum posts: 613
File comments: 1971
Uploads: 15
Originally Posted by sirinsidiator
The ItemDatabase is an internal component which shouldn't be used by other addons as it can change behavior at any time and will break whatever you build on top of it.

The way I handle it is to create a table "internal" which I use for myself to make clear that other addons have no business accessing it. if anyone still does it, it's on them.
so instead of MasterMerchant:BonanzaPriceTip I'd have MasterMerchant.internal:BonanzaPriceTip
I don't want to put words in Sirinsidiator's mouth as it were but I do not believe he would alter AGS or any of his mods if someone overrode his mods functionality. He would leave it up to the author to take care of.

For now LWC calls LibPrice and tries to obtain MM information too early and caused an issue. I will discuss this with the author of LWC.

For you though do not override the time check routine please. For now you are overriding a dummy function so just remove that code entirely. It is not needed.

In your notes you stated
-- MasterMerchant lacks an API to control time range,
-- it does this internally by polling the state of
-- control/shift-key modifiers (!).
--
-- So instead of using a non-existent API, we
-- monkey-patch MM with our own code that ignores
-- modifier keys and always returns a LOOONG time
-- range.
This is incorrect. It always uses the long time as you put it unless someone changes the focus values. However, the timestamp of the oldest sale is used for the tooltip and the graph which is why the function may return a value of 8 days. When a player presses CTRL or SHIFT then it will return the amount of time set by the players focus. This is intentional, so please do not change it.

As you know MM only stores the sales from the guilds you are in. Meaning, if the oldest sale is 8 days ago, but the users sales history size is 180 days that doesn't mean MM is not allowing the user to access all 180 days of sales. It means the oldest sale was 8 days ago.

You do not need to change the code for getting the average price.

local mm = MasterMerchant:itemStats(item_link, false) from LibPrice.MMPrice() is already correct.

Before calling any functions such as getting the average price, please be sure to check for the following

MasterMerchant.isInitialized
LibGuildStore.guildStoreReady

If both are not true do not request information from MM.

Thank you
Last edited by Sharlikran : 09/14/21 at 10:46 AM.
Report comment to moderator  
Reply With Quote
Unread 05/18/21, 11:52 PM  
BerZerK_Bayern
 
BerZerK_Bayern's Avatar

Forum posts: 0
File comments: 2
Uploads: 0
What figures are used as the basis for calculation

I came here because I wanted to know how the costs/gold for masterwrits is calculated when MM does not yet show any data (short after i logged in it always takes some minutes as i am in 4 major trading guilds), then i saw Anons comment and this is my opinion to this:

I produce and buy and sell lots of platings of any kind.
I can assure you there is no such thing as putting platings in and delete the listing shortly afterwards - that would be totally stupid anyways, because you have to pay 1% of the price each time you put it in as an offering fee. If I put something in for the lower TTC price at a very busy marketplace, it is immediately gone. There doesn't even have to stand a player directly at the trader, because the internal guild trading in large tradeguilds also goes back and forth particularly quickly, because a lot of wholesalers are active there and stand in the banks and constantly search through their 4-5 trade guilds.

Personally, I always evaluate prices as an average and I use TTC prices "mostly" as an average of (min+max)/2, but that also depends on the current demand situation, if something is bought very strongly, it can go quickly even (far) over TTCmax, if I want to get rid of junk quickly, I knock it out for TTCmin to get a sales slot free again as quickly as possible.

Anon, you also have to keep in mind what the ages of the prices on the TTT-site mean. Its not counted from when a seller lists something, but when some TTC user reports the price to the site. It can tell you the price is 1 minute old, but that only means that a TTC client uploaded the prices a minute ago. In between, a quarter of an hour may have passed, in which time a lot is bought and sold in large guilds and a particularly a cheap offer is gone in an instant, except perhaps in remote guilds or hideouts.

Btw: As of this writing (PC/EU 2021-05-19), Iridium Plating is 10.066 - 12.583

Originally Posted by anon379
As of this writing, Iridium Plating is 6,681 - 8,352. Using TTC lowest value leads to understating cost of things because it's difficult to find traders selling at that point. I think this is because of all the price manipulation that happens with TTC (players posting minimal sales, update TTC, and then cancel the sale before anyone buys it). I can't use MMC or ATT because my guilds don't trade lots.

I think it would be more helpful to use TTC highest suggested value for costs.
Last edited by BerZerK_Bayern : 05/19/21 at 12:07 AM.
Report comment to moderator  
Reply With Quote
Unread 05/31/20, 03:22 PM  
anon379

Forum posts: 0
File comments: 5
Uploads: 0
option to use TTC highests sugested price

As of this writing, Iridium Plating is 6,681 - 8,352. Using TTC lowest value leads to understating cost of things because it's difficult to find traders selling at that point. I think this is because of all the price manipulation that happens with TTC (players posting minimal sales, update TTC, and then cancel the sale before anyone buys it). I can't use MMC or ATT because my guilds don't trade lots.

I think it would be more helpful to use TTC highest suggested value for costs.
Report comment to moderator  
Reply With Quote
Unread 03/07/20, 08:28 PM  
Aldanga
AddOn Author - Click to view AddOns

Forum posts: 1
File comments: 301
Uploads: 5
Would it be possible to add the ability to get full pricing data from ATT instead of limiting it to 3 days when a sale within that range exists?
Report comment to moderator  
Reply With Quote
Unread 02/29/20, 03:08 AM  
Akopian Atrebates

Forum posts: 9
File comments: 230
Uploads: 0
Re: Re: Custom LibPrice sources, spreadsheets

Oh, and I wanted to add that the integration of all the pricing sources in a library was a great idea and made made the integration of all those addons working together a lot more coherent. So thanks, and I hope that more authors take advantage of your work.

Originally Posted by Akopian Atrebates
So no you won't do it, but the answer is that maybe it is possible. Neat. Maybe somebody one day. I have a feeling it is way above my ability level to do, but maybe one day it will not be.

Originally Posted by ziggr
Sorry, no.

Interesting idea, and certainly possible with some limitations and much coding. But not something I'm interested in adding right now.
  1. Add new data source "custom" to go along with existing sources "mm" "att" "ttc" and more
  2. Add new Lua file with placeholder table where folks can type in their hardcoded prices?
  3. ... or read prices from SavedVariables/LibPrice.lua and have folks type price data into there
  4. Modify WritWorthy.Util.MatPrice() to include prices from "custom".

Originally Posted by Akopian Atrebates
I am wondering if there is a way for me to draw from my own personal spreadsheets as a source for LibPrice's data?
Report comment to moderator  
Reply With Quote
Unread 02/29/20, 03:02 AM  
Akopian Atrebates

Forum posts: 9
File comments: 230
Uploads: 0
Re: Custom LibPrice sources, spreadsheets

So no you won't do it, but the answer is that maybe it is possible. Neat. Maybe somebody one day. I have a feeling it is way above my ability level to do, but maybe one day it will not be.

Originally Posted by ziggr
Sorry, no.

Interesting idea, and certainly possible with some limitations and much coding. But not something I'm interested in adding right now.
  1. Add new data source "custom" to go along with existing sources "mm" "att" "ttc" and more
  2. Add new Lua file with placeholder table where folks can type in their hardcoded prices?
  3. ... or read prices from SavedVariables/LibPrice.lua and have folks type price data into there
  4. Modify WritWorthy.Util.MatPrice() to include prices from "custom".

Originally Posted by Akopian Atrebates
I am wondering if there is a way for me to draw from my own personal spreadsheets as a source for LibPrice's data?
Report comment to moderator  
Reply With Quote
Unread 02/28/20, 09:46 PM  
ziggr
 
ziggr's Avatar
AddOn Author - Click to view AddOns

Forum posts: 27
File comments: 275
Uploads: 10
Custom LibPrice sources, spreadsheets

Sorry, no.

Interesting idea, and certainly possible with some limitations and much coding. But not something I'm interested in adding right now.
  1. Add new data source "custom" to go along with existing sources "mm" "att" "ttc" and more
  2. Add new Lua file with placeholder table where folks can type in their hardcoded prices?
  3. ... or read prices from SavedVariables/LibPrice.lua and have folks type price data into there
  4. Modify WritWorthy.Util.MatPrice() to include prices from "custom".

Originally Posted by Akopian Atrebates
I am wondering if there is a way for me to draw from my own personal spreadsheets as a source for LibPrice's data?
Report comment to moderator  
Reply With Quote
Unread 02/28/20, 07:58 PM  
Akopian Atrebates

Forum posts: 9
File comments: 230
Uploads: 0
I am wondering if there is a way for me to draw from my own personal spreadsheets as a source for LibPrice's data?
Report comment to moderator  
Reply With Quote
Unread 12/05/18, 05:39 PM  
Architecture
 
Architecture's Avatar
AddOn Author - Click to view AddOns

Forum posts: 7
File comments: 79
Uploads: 8
Nice job. Been wanting this sort of an integration for a while and I think you went above and beyond by covering more than just MM and TTC.
Report comment to moderator  
Reply With Quote
Unread 11/30/18, 06:12 AM  
Marazota
AddOn Author - Click to view AddOns

Forum posts: 257
File comments: 1517
Uploads: 2
excelent work!
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: