E1ila / FarmLog

Logs loot, monster kills, honor and instances. Know exactly what your farm session has yielded.
8 stars 11 forks source link

Allow getting value of item from disenchant price #19

Open kenneth-wow opened 4 years ago

kenneth-wow commented 4 years ago

I disenchant almost all greens and blues. Wouldn't mind having to enter DE mat prices myself

E1ila commented 4 years ago

Any idea how to tell the odds of disenchanted mats?

tuftelien commented 4 years ago

Auctionator apparently solved that by hardcoding the values, so I doubt there's any API for it: https://github.com/Auctionator/Auctionator/blob/fd9ea7ac96a3d2856f19eec73845674fd945e36a/Source/Constants/DisenchantingProbabilities.lua

The classic quickfix version contains the same values, but I don't know whether they're actually correct.

phrojoe commented 4 years ago

For TSM, it would be TSM_API.GetCustomPriceValue("destroy", TSM_ItemString)

I made this change locally to prefer the disenchant value for greens:

diff --git a/FarmLog.lua b/FarmLog.lua
index febdb63..3ec7e97 100755
--- a/FarmLog.lua
+++ b/FarmLog.lua
@@ -2094,7 +2094,13 @@ function FarmLog:GetItemValue(itemLink)
        -- debug("GetItemValue   "..itemLink.."   quality "..quality)
        local GetTSMPrice = TSM_API and function(link) 
            local TSM_ItemString = TSM_API.ToItemString(normLink)
-           return TSM_API.GetCustomPriceValue("dbmarket", TSM_ItemString)
+           local disenchantValue = TSM_API.GetCustomPriceValue("destroy", TSM_ItemString)
+           local dbMarket = TSM_API.GetCustomPriceValue("dbmarket", TSM_ItemString)
+           if quality == 2 and disenchantValue then
+               return disenchantValue
+           else
+               return dbMarket
+           end
        end
        local PriceCheck = Atr_GetAuctionBuyout or GetTSMPrice or GetAHScanPrice
        ahValue = PriceCheck(normLink)

EDIT: Sorry, "destroy" returns vendor price if it's higher than the disenchant value.

Necromar commented 4 years ago

My friends and I have talked a lot about wanting this specific feature! Most green gear have super skewed AH market values on our realm for some reason, so if we could get the DE or vendor value, it would stop messing up the gold/hour counter so bad. We all use TSM... would phrojoe's suggestion work?