# HG changeset patch # User Asa Ayers # Date 1280278341 25200 # Node ID 70dc84df13b348784c5407c3116e82eb1cb9b8e7 # Parent b24dbfbe2aefd8e5065db098439a4f5d3d82b38b Updated the QuickAuctions API to use the new API calls. This commit also includes a compatibility layer to maintain backward compatibility so that none of my users have to upgrade QuickAuctions twice before getting any new features. diff -r b24dbfbe2aef -r 70dc84df13b3 Modules/QuickAuctions.lua --- a/Modules/QuickAuctions.lua Tue Jul 27 11:56:00 2010 -0700 +++ b/Modules/QuickAuctions.lua Tue Jul 27 17:52:21 2010 -0700 @@ -1,8 +1,28 @@ local addonName, addonTable = ...; local addon = _G[addonName] +--[[ + This is simply for compatibility while I change the QA API. Once + my changes get merged into the main project, this can go away. +]] +if QAAPI ~= nil and QAAPI.GetGroupThreshold ~= nil and QAAPI.GetGroupConfig == nil then + function QAAPI:GetGroupConfig(groupName) + return QAAPI:GetGroupThreshold(groupName), + QAAPI:GetGroupPostCap(groupName), + QAAPI:GetGroupPerAuction(groupName) + end + + function QAAPI:SetGroupConfig(groupName, key, value) + if key == 'threshold' then + return QAAPI:SetGroupThreshold(groupName, value) + end + end +end + + + function addon:IsQACompatible() - return (QAAPI ~= nil and QAAPI.GetGroups ~= nil) + return (QAAPI ~= nil and QAAPI.GetGroupConfig ~= nil) end function addon:IsQAEnabled() @@ -66,7 +86,7 @@ threshold = calculateQAThreshold(threshold) - QAAPI:SetGroupThreshold(groupName, ceil(threshold)) + QAAPI:SetGroupConfig(groupName, 'threshold', ceil(threshold)) end end @@ -75,8 +95,9 @@ local QAGroup = QAAPI:GetItemGroup(data.link) if QAGroup ~= nil then local currentInvested, _, currentCount = addon:GetItemCost(data.link) + local threshold, postCap, perAuction = QAAPI:GetGroupConfig(QAGroup) + local stackSize = postCap * perAuction - local stackSize = QAAPI:GetGroupPostCap(QAGroup) * QAAPI:GetGroupPerAuction(QAGroup) stackSize = stackSize / GetTradeSkillNumMade(data.tradeSkillIndex) -- bonus @@ -147,7 +168,8 @@ if addon.IsQAEnabled() then QAGroup = QAAPI:GetItemGroup(itemLink) if QAGroup ~= nil then - stackSize = QAAPI:GetGroupPostCap(QAGroup) * QAAPI:GetGroupPerAuction(QAGroup) + local threshold, postCap, perAuction = QAAPI:GetGroupConfig(QAGroup) + stackSize = postCap * perAuction stackSize = stackSize / GetTradeSkillNumMade(i) -- bonus diff -r b24dbfbe2aef -r 70dc84df13b3 Modules/Tooltip.lua --- a/Modules/Tooltip.lua Tue Jul 27 11:56:00 2010 -0700 +++ b/Modules/Tooltip.lua Tue Jul 27 17:52:21 2010 -0700 @@ -36,7 +36,7 @@ if addon:IsQAEnabled() then local groupName = QAAPI:GetItemGroup(link) if groupName then - local threshold = QAAPI:GetGroupThreshold(groupName) + local threshold = QAAPI:GetGroupConfig(groupName) tip:AddDoubleLine("\124cffffffffIA: QA Threshold: ", addon:FormatMoney(threshold)) show = true end