Browse Source

Couple of fixes and a new feature for bank/GB (#25)

* Exclude crafting spells using Fel Blood

Updated cost calculation to exclude spells using Fel Blood in crafting.

* Epoch lua error fix

* Slow mail loot when low FPS to avoid double looting

* Allowing withdrawing items from bank/GB using "AH shortfall" to withdraw based on post cap and now ALSO minPrice of those items has to be above current DBMinBuyout.

* Fixing an infinite loop bug with invalid custom price of Default Craft Value Method

---------

Co-authored-by: Szyler <Szyler@Szyler.com>
pull/26/head
Szyler 6 months ago committed by GitHub
parent
commit
c1d9d3f7c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 12
      TradeSkillMaster/Core/Groups.lua
  2. 8
      TradeSkillMaster/Core/Options.lua
  3. 1
      TradeSkillMaster/GUI/BuildPage.lua
  4. 8
      TradeSkillMaster/TradeSkillMaster.lua
  5. 23
      TradeSkillMaster_Auctioning/modules/Util.lua
  6. 7
      TradeSkillMaster_Crafting/Modules/Cost.lua
  7. 2
      TradeSkillMaster_Mailing/Modules/Inbox.lua

12
TradeSkillMaster/Core/Groups.lua

@ -1315,6 +1315,7 @@ function TSM:ImportGroup(importStr, groupPath)
local items = {} local items = {}
local currentSubPath = "" local currentSubPath = ""
local itemID, randomEnchant = nil, nil
for _, str in ipairs(TSMAPI:SafeStrSplit(importStr, ",")) do for _, str in ipairs(TSMAPI:SafeStrSplit(importStr, ",")) do
str = str:trim() str = str:trim()
local noSpaceStr = gsub(str, " ", "") -- forums like to add spaces local noSpaceStr = gsub(str, " ", "") -- forums like to add spaces
@ -1327,7 +1328,7 @@ function TSM:ImportGroup(importStr, groupPath)
elseif strfind(noSpaceStr, "p") then elseif strfind(noSpaceStr, "p") then
itemString = gsub(noSpaceStr, "p", "battlepet") itemString = gsub(noSpaceStr, "p", "battlepet")
elseif strfind(noSpaceStr, ":") then elseif strfind(noSpaceStr, ":") then
local itemID, randomEnchant = (":"):split(noSpaceStr) itemID, randomEnchant = (":"):split(noSpaceStr)
if not tonumber(itemID) or not tonumber(randomEnchant) then return end if not tonumber(itemID) or not tonumber(randomEnchant) then return end
itemString = "item:"..tonumber(itemID)..":0:0:0:0:0:"..tonumber(randomEnchant) itemString = "item:"..tonumber(itemID)..":0:0:0:0:0:"..tonumber(randomEnchant)
end end
@ -1336,8 +1337,13 @@ function TSM:ImportGroup(importStr, groupPath)
currentSubPath = subPath currentSubPath = subPath
elseif itemString then elseif itemString then
items[itemString] = currentSubPath items[itemString] = currentSubPath
local item = Item:CreateFromID(tonumber(noSpaceStr)) itemID = itemID or noSpaceStr
item:Query() if Item then
local item = Item:CreateFromID(tonumber(itemID))
item:Query()
else
TSMAPI:GetSafeItemInfo(tonumber(itemID))
end
else else
return return
end end

8
TradeSkillMaster/Core/Options.lua

@ -943,8 +943,12 @@ function private:LoadProfilesPage(container)
-- check if item is cached -- check if item is cached
local _,_,itemID = itemString:find("item:(%d+)") local _,_,itemID = itemString:find("item:(%d+)")
if itemID then if itemID then
local item = Item:CreateFromID(itemID) if Item then
item:Query() local item = Item:CreateFromID(itemID)
item:Query()
else
TSMAPI:GetSafeItemInfo(tonumber(itemID))
end
end end
end end

1
TradeSkillMaster/GUI/BuildPage.lua

@ -303,6 +303,7 @@ local Add = {
else else
TSM:Print(L["Invalid custom price."].." "..err) TSM:Print(L["Invalid custom price."].." "..err)
self:SetFocus() self:SetFocus()
return
end end
else else
args.callback(self, event, value) args.callback(self, event, value)

8
TradeSkillMaster/TradeSkillMaster.lua

@ -239,8 +239,12 @@ function TSM:OnInitialize()
-- check if item is cached -- check if item is cached
local _,_,itemID = itemString:find("item:(%d+)") local _,_,itemID = itemString:find("item:(%d+)")
if itemID then if itemID then
local item = Item:CreateFromID(itemID) if Item then
item:Query() local item = Item:CreateFromID(itemID)
item:Query()
else
TSMAPI:GetSafeItemInfo(tonumber(itemID))
end
end end
if strfind(itemString, " ") then if strfind(itemString, " ") then
local newItemString = gsub(itemString, " ", "") local newItemString = gsub(itemString, " ", "")

23
TradeSkillMaster_Auctioning/modules/Util.lua

@ -221,6 +221,29 @@ function Util:groupTree(grpInfo, src, all, ah)
end end
if newgrp[itemString] < 0 then if newgrp[itemString] < 0 then
newgrp[itemString] = nil newgrp[itemString] = nil
else
-- Get the group's auction operation
local operations = TSMAPI:GetItemOperation(itemString, "Auctioning")
if operations and operations[1] then
local operation = TSM.operations[operations[1]]
if operation then
-- Get the prices
local prices = TSM.Util:GetItemPrices(operation, itemString)
local marketValue = TSMAPI:GetItemValue(itemString, "DBMarket")
local currentMinPrice = TSMAPI:GetItemValue(itemString, "DBMinBuyout")
-- Compare the prices
if prices.minPrice and prices.maxPrice and prices.normalPrice then
if marketValue and currentMinPrice then
if prices.minPrice > currentMinPrice then
-- Handle the case where the prices do not meet the criteria
-- For example, you can remove the item from the group
newgrp[itemString] = nil
end
end
end
end
end
end end
end end
end end

7
TradeSkillMaster_Crafting/Modules/Cost.lua

@ -110,11 +110,12 @@ function Cost:GetLowestCraftPrices(itemString, intermediate)
if not spellIDs then return end if not spellIDs then return end
local lowestCost, cheapestSpellID local lowestCost, cheapestSpellID
local soh = "item:76061:0:0:0:0:0:0" -- Spirit of Harmony local soh = "item:76061:0:0:0:0:0:0" -- Spirit of Harmony
local fb = "item:800405:0:0:0:0:0:0" -- Fel Blood
for _, spellID in ipairs(spellIDs) do for _, spellID in ipairs(spellIDs) do
if TSM.db.realm.crafts[spellID] then if TSM.db.realm.crafts[spellID] then
if intermediate and (TSM.db.realm.crafts[spellID].mats[soh] or TSM.db.realm.crafts[spellID].hasCD) then if intermediate and (TSM.db.realm.crafts[spellID].mats[soh] or TSM.db.realm.crafts[spellID].mats[fb] or TSM.db.realm.crafts[spellID].hasCD) then
break break
end --exclude spells using SOH or have cooldown from intermediate crafts end --exclude spells using SOH and FB or have cooldown from intermediate crafts
local cost = Cost:GetCraftCost(spellID) local cost = Cost:GetCraftCost(spellID)
if cost and (not lowestCost or cost < lowestCost) then if cost and (not lowestCost or cost < lowestCost) then
-- exclude spells with cooldown if option to ignore is enabled or more than one way to craft and not soulbound e.g. BoE -- exclude spells with cooldown if option to ignore is enabled or more than one way to craft and not soulbound e.g. BoE
@ -144,4 +145,4 @@ function Cost:GetLowestCraftPrices(itemString, intermediate)
end end
return cheapestSpellID, lowestCost, buyout, profit return cheapestSpellID, lowestCost, buyout, profit
end end

2
TradeSkillMaster_Mailing/Modules/Inbox.lua

@ -711,7 +711,7 @@ function Inbox:UI_ERROR_MESSAGE(event, msg)
return return
end end
TSMAPI:CreateTimeDelay("mailWaitDelay", 0.3, private.AutoLoot) TSMAPI:CreateTimeDelay("mailWaitDelay", math.max(5/GetFramerate(), 0.3), private.AutoLoot)
end end
end end

Loading…
Cancel
Save