Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

Commit

Permalink
2.2.3 Release
Browse files Browse the repository at this point in the history
see changelog for details
  • Loading branch information
Metric committed Jan 8, 2021
1 parent 363f066 commit 2a22c0f
Show file tree
Hide file tree
Showing 18 changed files with 368 additions and 269 deletions.
55 changes: 36 additions & 19 deletions AnS/AnS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,15 @@ StaticPopupDialogs["ANS_NO_PRICING"] = {

local TUJOnlyPercentFn = "tujmarket";
local TSMOnlyPercentFn = "dbmarket";
local AtrOnlyPercentFn = "atrvalue";
local TUJAndTSMPercentFn = "avg(dbmarket,tujmarket)";
local AnsOnlyPercentFn = "avg(ansrecent,ansmarket)";
local TSMMaterialCost = "min(dbmarket, first(vendorbuy, dbminbuyout))";
local TSMCraftingValue = "first(dbminbuyout, dbmarket)";
local AnsMaterialCost = "min(ansmarket, first(vendorbuy, ansrecent))";
local AnsCraftingValue = "first(ansmin, ansmarket)";
local TujMatCraftValue = "min(tujmarket, vendorbuy)";
local AnsCraftingValue = "first(vendorbuy, avg(ansrecent, ansmarket))";
local TujMatCraftValue = "first(vendorbuy, tujmarket)";
local AtrMatCraftValue = "first(vendorbuy, atrvalue)";

local function AuctionTab_OnClick(self, button, down, index)
AH_TAB_CLICK(self, button, down, index);
Expand Down Expand Up @@ -276,11 +278,11 @@ function Ans:RegisterPriceSources()
local tujEnabled = false;
local ansEnabled = false;

--local auctionatorEnabled = false;
local auctionatorEnabled = false;

-- if (Utils.IsAddonEnabled("Auctionator") and Atr_GetAuctionBuyout) then
-- auctionatorEnabled = true;
-- end
if (Utils.IsAddonEnabled("Auctionator")) then
auctionatorEnabled = true;
end

if (TSM_API or TSMAPI) then
tsmEnabled = true;
Expand All @@ -304,6 +306,9 @@ function Ans:RegisterPriceSources()
elseif (tsmEnabled and not tujEnabled and (not Config.Sniper().source or Config.Sniper().source:len() == 0)) then
print("AnS: setting default tsm source");
Config.Sniper().source = TSMOnlyPercentFn;
elseif (auctionatorEnabled and (not Config.Sniper().source or Config.Sniper().source:len() == 0)) then
print("AnS: setting default auctionator source");
Config.Snipe().source = AtrOnlyPercentFn;
elseif (ansEnabled and (not Config.Sniper().source or Config.Sniper().source:len() == 0)) then
print("AnS: setting default AnsAuctionData source");
Config.Sniper().source = AnsOnlyPercentFn;
Expand All @@ -319,12 +324,15 @@ function Ans:RegisterPriceSources()
elseif (tsmEnabled and not tujEnabled and (not Config.Crafting().materialCost or Config.Crafting().materialCost:len() == 0)) then
Config.Crafting().materialCost = TSMMaterialCost;
Config.Crafting().craftValue = TSMCraftingValue;
elseif (auctionatorEnabled and (not Config.Crafting().materialCost or Config.Crafting().materialCost:len() == 0)) then
Config.Crafting().materialCost = AtrMatCraftValue;
Config.Crafting().craftValue = AtrMatCraftValue;
elseif (ansEnabled and (not Config.Crafting().materialCost or Config.Crafting().materialCost:len() == 0)) then
Config.Crafting().materialCost = AnsMaterialCost;
Config.Crafting().craftValue = AnsCraftingValue;
end

if (not tsmEnabled and not tujEnabled and not ansEnabled) then
if (not tsmEnabled and not tujEnabled and not ansEnabled and not auctionatorEnabled) then
StaticPopup_Show("ANS_NO_PRICING");
end

Expand Down Expand Up @@ -365,22 +373,31 @@ function Ans:RegisterPriceSources()
Sources:Register("ANSMarket", AnsAuctionData.GetRealmValue, "market");
Sources:Register("ANSMin", AnsAuctionData.GetRealmValue, "min");
Sources:Register("ANS3Day", AnsAuctionData.GetRealmValue, "3day");
Sources:Register("ANSRegionRecent", AnsAuctionData.GetRegionValue, "recent");
Sources:Register("ANSRegionMarket", AnsAuctionData.GetRegionValue, "market");
Sources:Register("ANSRegionMin", AnsAuctionData.GetRegionValue, "min");
Sources:Register("ANSRegion3Day", AnsAuctionData.GetRegionValue, "3day");
end

-- if (auctionatorEnabled) then
-- print("AnS: found Auctionator pricing source");
-- Sources:Register("AtrValue", function(link, key)
-- if (strfind(link, "[ip]:%d+%(%d+%)")) then
-- return 0;
-- end

-- return Atr_GetAuctionBuyout(link);
-- end, nil);
-- end
if (auctionatorEnabled) then
print("AnS: found Auctionator pricing source");

if (Atr_GetAuctionBuyout) then
Sources:Register("AtrValue", function(link, key)
if (strfind(link, "[ip]:")) then
link = Utils.GetLink(link, true);
end

return Atr_GetAuctionBuyout(link) or 0;
end, nil);
elseif (Auctionator and Auctionator.API and Auctionator.API.v1 and Auctionator.API.v1.GetAuctionPriceByItemLink) then
Sources:Register("AtrValue", function(link, key)
if (strfind(link, "[ip]:")) then
link = Utils.GetLink(link, true);
end

return Auctionator.API.v1.GetAuctionPriceByItemLink("AnS", link) or 0;
end, nil);
end
end
end

function Ans:Migrate()
Expand Down
2 changes: 1 addition & 1 deletion AnS/AnS.toc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Interface: 90002
## Title: AnS
## Version: 2.2.2
## Version: 2.2.3
## Notes: Core library for Auction Snipe etc.
## License: MIT
## SavedVariables: ANS_FILTERS, ANS_CONFIG, ANS_CUSTOM_VARS, ANS_GLOBAL_SETTINGS, ANS_ANALYTICS_DATA
Expand Down
19 changes: 19 additions & 0 deletions AnS/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
## AnS Changes 2.2.3

- Fixed issue with Modifiers not being correct for item ids
- Fixed issue where vendorbuy was no longer working due to item ids with modifiers
- Fixed issue where runecarving replaced finger slot under misc on sniper filter view
- Fixed an issue where AnsAuctionData pricing statistics was miscalculated on classic.
- Added in Option to Auction Operations to scan pricing by iLevel or iLevel+Mods
- Added back in tooltip toggles for Region Min / Region Market
- Added back in support for new version of Auctionator
- Optimized AnsAuctionData for new AnS auction pricing for retail via the new AnS app.
- Ledger now features an Inventory view that includes inventory + bank at the momemnt
- Will add in Owned Auctions later.
- It also shows the total gold worth of the inventory + bank
- You can also filter by individual characters
- Shows how many of each item you have as well
- Works with legendary / crafted items and knows the difference between the item levels / mods
- Total gold may be incorrect for TSM pricing for legendary / crafted item with mods until they solve their issue with ilvl / mods
- Total gold pricing is correct with new AnsAuctionData from AnS app

## AnS Changes 2.2.2

- Added in missing Runecarver filter on retail
Expand Down
26 changes: 15 additions & 11 deletions AnS/Core/Analytics/Modules/MerchantTracker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -121,17 +121,21 @@ end

function MerchantTracker.Scan()
for i = 1, GetMerchantNumItems() do
local id = Utils.GetID(GetMerchantItemLink(i));
if (id) then
local currentValue = Config.Vendor()[id] or VendorData[id];
local newValue = nil;
local _, _, price, quantity, _, _, _, extendedCost = GetMerchantItemInfo(i);
if (price > 0 and (not extendedCost or GetMerchantItemCostInfo(i) == 0)) then
newValue = Sources.round(price / quantity);
end
if (newValue ~= currentValue) then
Config.Vendor()[id] = newValue;
end
local link = GetMerchantItemLink(i);
if (link) then
local id = Utils.GetID(link);
if (id) then
local bonusOnly = Utils.BonusID(id);
local currentValue = Config.Vendor()[bonusOnly] or VendorData[bonusOnly];
local newValue = nil;
local _, _, price, quantity, _, _, _, extendedCost = GetMerchantItemInfo(i);
if (price > 0 and (not extendedCost or GetMerchantItemCostInfo(i) == 0)) then
newValue = Sources.round(price / quantity);
end
if (newValue ~= currentValue) then
Config.Vendor()[bonusOnly] = newValue;
end
end
end
end
end
Expand Down
32 changes: 25 additions & 7 deletions AnS/Core/Operations/Auctioning.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,14 @@ ACTIONS.MAX_PRICE = 2;
ACTIONS.NORMAL_PRICE = 3;
ACTIONS.NONE = 4;

local ITEM_REF_ILEVEL = 1;
local ITEM_REF_ILEVELMODS = 2;

Auctioning.ACTIONS = ACTIONS;
Auctioning.REFERENCES = {
ILevel = ITEM_REF_ILEVEL,
ILevelMods = ITEM_REF_ILEVELMODS,
};

local tempTbl = {};

Expand Down Expand Up @@ -57,6 +64,7 @@ function Auctioning.Config(name)
applyAll = false,
minPriceAction = 4,
maxPriceAction = 3,
itemReference = 1,
groups = {},
nonActiveGroups = {}
};
Expand All @@ -80,6 +88,7 @@ function Auctioning.PrepareExport(config)
a.applyAll = config.applyAll;
a.minPriceAction = config.minPriceAction or 4;
a.maxPriceAction = config.maxPriceAction or 3;
a.itemReference = config.itemReference or 1;
a.groups = {};

for i,v in ipairs(config.groups) do
Expand Down Expand Up @@ -110,6 +119,7 @@ function Auctioning.From(config)
a.minPriceAction = config.minPriceAction or 4;
a.maxPriceAction = config.maxPriceAction or 3;
a.nonActiveGroups = config.nonActiveGroups or {};
a.itemReference = config.itemReference or 1;
a.groups = {};
a.ids = {};

Expand All @@ -128,6 +138,14 @@ function Auctioning.From(config)
return a;
end

function Auctioning:GetReferenceID(item)
if (self.itemReference == ITEM_REF_ILEVEL) then
return Utils.BonusID(item.tsmId or Utils.GetID(item), false);
else
return item.tsmId or item;
end
end

function Auctioning:Track(item)
if (item.isOwnerItem or item.owner == UnitName("player")) then
self.totalListed = self.totalListed + item.count;
Expand All @@ -138,10 +156,10 @@ function Auctioning:MaxPosted()
return self.totalListed >= self.maxToPost and self.maxToPost > 0;
end

function Auctioning:IsValid(ppu, link, ignore, defaultValue)
local minValue = Sources:QueryID(self.minPrice, link);
local maxValue = Sources:QueryID(self.maxPrice, link);
local normalValue = Sources:QueryID(self.normalPrice, link);
function Auctioning:IsValid(ppu, id, ignore, defaultValue)
local minValue = Sources:QueryID(self.minPrice, id);
local maxValue = Sources:QueryID(self.maxPrice, id);
local normalValue = Sources:QueryID(self.normalPrice, id);

if (ignore or (minValue == 0 and maxValue == 0 and normalValue == 0)) then
return ppu;
Expand Down Expand Up @@ -200,9 +218,9 @@ function Auctioning:GetAvailableItems()
local auctionable = BagScanner.GetAuctionable();

for i,v in ipairs(auctionable) do
local tsmId = Utils.GetID(v.link);
local _, id = strsplit(":", tsmId);
if (self.ids[tsmId] or self.ids[_..":"..id] or (self.applyAll and v.quality > 0)) then
local vid = self:GetReferenceID(v);
local _, id = strsplit(":", vid);
if (self.ids[vid] or self.ids[_..":"..id] or (self.applyAll and v.quality > 0)) then
-- assign op to the items
v.op = self;
for k,o in ipairs(v.stacks) do
Expand Down
15 changes: 12 additions & 3 deletions AnS/Core/Sources.lua
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,10 @@ function Sources:QueryID(q, itemId)
codes.ilevel = 0;
codes.vendorsell = 0;
codes.tsmId = Utils.GetID(itemId);
codes.vendorbuy = Config.Vendor()[codes.tsmId] or VendorData[codes.tsmId] or 0;

local idBonusOnly = Utils.BonusID(codes.tsmId);

codes.vendorbuy = Config.Vendor()[idBonusOnly] or VendorData[idBonusOnly] or 0;

local _, id = strsplit(":", codes.tsmId);

Expand Down Expand Up @@ -546,7 +549,7 @@ function Sources:Validate(q)
codes.ilevel = 0;
codes.vendorsell = 0;
codes.tsmId = itemId;
codes.vendorbuy = Config.Vendor()[codes.tsmId] or VendorData[codes.tsmId] or 0;
codes.vendorbuy = 0;
codes.id = 2589;

local _, fn, err = false, nil, nil;
Expand Down Expand Up @@ -628,6 +631,12 @@ function Sources:Query(q, item)
self:GetValues(itemId, codes);
end

if (not item.tsmId and item.link) then
item.tsmId = Utils.GetID(item.link);
end

local idBonusOnly = Utils.BonusID(item.tsmId or item.link or item.id);

codes.buyout = buyout;
codes.stacksize = stackSize;
codes.quality = quality;
Expand All @@ -637,7 +646,7 @@ function Sources:Query(q, item)
codes.vendorsell = item.vendorsell;
codes.tsmId = item.tsmId;
codes.id = item.id;
codes.vendorbuy = Config.Vendor()[item.tsmId] or VendorData[item.tsmId] or 0;
codes.vendorbuy = Config.Vendor()[idBonusOnly] or VendorData[idBonusOnly] or 0;

local _, fn, err = false, nil, nil;
local oq = q;
Expand Down
Loading

0 comments on commit 2a22c0f

Please sign in to comment.