Browse Source

Merge branch 'main' into new-saved-variable-names

pull/2/head
Andrew 3 years ago committed by GitHub
parent
commit
35bc4f4fd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      TradeSkillMaster/Auction/AuctionQueryUtil.lua
  2. 6
      TradeSkillMaster/Auction/AuctionScanning.lua
  3. 20
      TradeSkillMaster/Core/Groups.lua
  4. 10
      TradeSkillMaster/Core/Modules.lua
  5. 6
      TradeSkillMaster/Core/Options.lua
  6. 14
      TradeSkillMaster/Core/Sync.lua
  7. 4
      TradeSkillMaster/Data/Vendor.lua
  8. 16
      TradeSkillMaster/GUI/BankUI.lua
  9. 6
      TradeSkillMaster/TradeSkillMaster.lua
  10. 2
      TradeSkillMaster/Util/Util.lua
  11. 44
      TradeSkillMaster_Accounting/Modules/data.lua
  12. 50
      TradeSkillMaster_Accounting/Modules/gui.lua
  13. 54
      TradeSkillMaster_Accounting/TradeSkillMaster_Accounting.lua
  14. 10
      TradeSkillMaster_AuctionDB/Modules/Scanning.lua
  15. 8
      TradeSkillMaster_AuctionDB/Modules/config.lua
  16. 2
      TradeSkillMaster_AuctionDB/Modules/data.lua
  17. 43
      TradeSkillMaster_AuctionDB/TradeSkillMaster_AuctionDB.lua
  18. 6
      TradeSkillMaster_Auctioning/TradeSkillMaster_Auctioning.lua
  19. 14
      TradeSkillMaster_Auctioning/modules/Options.lua
  20. 2
      TradeSkillMaster_Auctioning/modules/ResetScan.lua
  21. 8
      TradeSkillMaster_Auctioning/modules/ScanUtil.lua
  22. 32
      TradeSkillMaster_Crafting/Modules/Cost.lua
  23. 265
      TradeSkillMaster_Crafting/Modules/CraftingGUI.lua
  24. 624
      TradeSkillMaster_Crafting/Modules/EnchantingInfo.lua
  25. 18
      TradeSkillMaster_Crafting/Modules/Gather.lua
  26. 22
      TradeSkillMaster_Crafting/Modules/Inventory.lua
  27. 26
      TradeSkillMaster_Crafting/Modules/Options.lua
  28. 36
      TradeSkillMaster_Crafting/Modules/Queue.lua
  29. 3583
      TradeSkillMaster_Crafting/Modules/SpellNames2IDs.lua
  30. 4
      TradeSkillMaster_Crafting/Modules/Sync.lua
  31. 105
      TradeSkillMaster_Crafting/Modules/Util.lua
  32. 567
      TradeSkillMaster_Crafting/Modules/VellumInfo.lua
  33. 135
      TradeSkillMaster_Crafting/TradeSkillMaster_Crafting.lua
  34. 6
      TradeSkillMaster_ItemTracker/Modules/config.lua
  35. 24
      TradeSkillMaster_ItemTracker/TradeSkillMaster_ItemTracker.lua
  36. 10
      TradeSkillMaster_Mailing/Modules/Other.lua
  37. 4
      TradeSkillMaster_Mailing/TradeSkillMaster_Mailing.lua
  38. 2
      TradeSkillMaster_Shopping/TradeSkillMaster_Shopping.lua
  39. 2
      TradeSkillMaster_Warehousing/Modules/data.lua
  40. 4
      TradeSkillMaster_Warehousing/Modules/move.lua
  41. 14
      TradeSkillMaster_Warehousing/TradeSkillMaster_Warehousing.lua

4
TradeSkillMaster/Auction/AuctionQueryUtil.lua

@ -48,7 +48,7 @@ local function GetCommonQueryInfo(name, items)
if existingQuery then if existingQuery then
existingQuery.minLevel = min(existingQuery.minLevel, itemQuery.minLevel) existingQuery.minLevel = min(existingQuery.minLevel, itemQuery.minLevel)
existingQuery.maxLevel = max(existingQuery.maxLevel, itemQuery.maxLevel) existingQuery.maxLevel = max(existingQuery.maxLevel, itemQuery.maxLevel)
existingQuery.quality = min(existingQuery.quality, itemQuery.quality) existingQuery.quality = (existingQuery.quality == itemQuery.quality) and existingQuery.quality or nil
if existingQuery.subClass ~= itemQuery.subClass then if existingQuery.subClass ~= itemQuery.subClass then
existingQuery.subClass = nil existingQuery.subClass = nil
end end
@ -70,7 +70,7 @@ local function GetCommonQueryInfoClass(class, items)
local itemQuery = TSMAPI:GetAuctionQueryInfo(items[i]) local itemQuery = TSMAPI:GetAuctionQueryInfo(items[i])
resultQuery.minLevel = min(resultQuery.minLevel, itemQuery.minLevel) resultQuery.minLevel = min(resultQuery.minLevel, itemQuery.minLevel)
resultQuery.maxLevel = max(resultQuery.maxLevel, itemQuery.maxLevel) resultQuery.maxLevel = max(resultQuery.maxLevel, itemQuery.maxLevel)
resultQuery.quality = min(resultQuery.quality, itemQuery.quality) resultQuery.quality = (resultQuery.quality == itemQuery.quality) and resultQuery.quality or nil
if resultQuery.subClass ~= itemQuery.subClass then resultQuery.subClass = nil end if resultQuery.subClass ~= itemQuery.subClass then resultQuery.subClass = nil end
end end
resultQuery.items = items resultQuery.items = items

6
TradeSkillMaster/Auction/AuctionScanning.lua

@ -213,7 +213,7 @@ function private:ScanAuctions()
local totalPages = ceil(total / NUM_AUCTION_ITEMS_PER_PAGE) local totalPages = ceil(total / NUM_AUCTION_ITEMS_PER_PAGE)
if private.scanType == "numPages" then if private.scanType == "numPages" then
local cacheData = TSM.db.factionrealm.numPagesCache[private.query.cacheKey] local cacheData = TSM.db.realm.numPagesCache[private.query.cacheKey]
cacheData.lastScan = time() cacheData.lastScan = time()
local confidence = (120 - cacheData.confidence) / (CACHE_DECAY_PER_DAY * 2) local confidence = (120 - cacheData.confidence) / (CACHE_DECAY_PER_DAY * 2)
local diff = abs(cacheData.avg - totalPages) local diff = abs(cacheData.avg - totalPages)
@ -393,7 +393,7 @@ function TSMAPI.AuctionScan:GetNumPages(query, callbackHandler)
temp[i] = tostring(query[field]) temp[i] = tostring(query[field])
end end
local cacheKey = table.concat(temp, "~") local cacheKey = table.concat(temp, "~")
local cacheData = TSM.db.factionrealm.numPagesCache[cacheKey] local cacheData = TSM.db.realm.numPagesCache[cacheKey]
if cacheData then if cacheData then
local cacheHit local cacheHit
if time() - cacheData.lastScan < CACHE_AUTO_HIT_TIME then if time() - cacheData.lastScan < CACHE_AUTO_HIT_TIME then
@ -412,7 +412,7 @@ function TSMAPI.AuctionScan:GetNumPages(query, callbackHandler)
return 2 return 2
end end
else else
TSM.db.factionrealm.numPagesCache[cacheKey] = { avg = 0, confidence = 0, numScans = 0, lastScan = 0 } TSM.db.realm.numPagesCache[cacheKey] = { avg = 0, confidence = 0, numScans = 0, lastScan = 0 }
end end
-- setup the query -- setup the query

20
TradeSkillMaster/Core/Groups.lua

@ -363,14 +363,14 @@ function TSMAPI:DrawOperationManagement(TSMObj, container, operationName)
local operation = TSMObj.operations[operationName] local operation = TSMObj.operations[operationName]
local playerList = {} local playerList = {}
local factionrealmKey = TSM.db.keys.factionrealm local realmKey = TSM.db.keys.realm
for playerName in pairs(TSM.db.factionrealm.characters) do for playerName in pairs(TSM.db.realm.characters) do
playerList[playerName.." - "..factionrealmKey] = playerName playerList[playerName.." - "..realmKey] = playerName
end end
local factionrealmList = {} local realmList = {}
for factionrealm in pairs(TSM.db.sv.factionrealm) do for realm in pairs(TSM.db.sv.realm) do
factionrealmList[factionrealm] = factionrealm realmList[realm] = realm
end end
local groupList = {} local groupList = {}
@ -436,9 +436,9 @@ function TSMAPI:DrawOperationManagement(TSMObj, container, operationName)
{ {
type = "Dropdown", type = "Dropdown",
label = L["Ignore Operation on Faction-Realms:"], label = L["Ignore Operation on Faction-Realms:"],
list = factionrealmList, list = realmList,
relativeWidth = 0.5, relativeWidth = 0.5,
settingInfo = {operation, "ignoreFactionrealm"}, settingInfo = {operation, "ignorerealm"},
multiselect = true, multiselect = true,
tooltip = L["This operation will be ignored when you're on any character which is checked in this dropdown."], tooltip = L["This operation will be ignored when you're on any character which is checked in this dropdown."],
}, },
@ -612,7 +612,7 @@ function TSMAPI:DrawOperationManagement(TSMObj, container, operationName)
end end
data.module = nil data.module = nil
data.ignorePlayer = {} data.ignorePlayer = {}
data.ignoreFactionrealm = {} data.ignorerealm = {}
data.relationships = {} data.relationships = {}
TSMObj.operations[operationName] = data TSMObj.operations[operationName] = data
self:SetText("") self:SetText("")
@ -629,7 +629,7 @@ function TSMAPI:DrawOperationManagement(TSMObj, container, operationName)
local data = CopyTable(operation) local data = CopyTable(operation)
data.module = moduleName data.module = moduleName
data.ignorePlayer = nil data.ignorePlayer = nil
data.ignoreFactionrealm = nil data.ignorerealm = nil
data.relationships = nil data.relationships = nil
ShowExportFrame(LibStub("AceSerializer-3.0"):Serialize(data)) ShowExportFrame(LibStub("AceSerializer-3.0"):Serialize(data))
end, end,

10
TradeSkillMaster/Core/Modules.lua

@ -220,7 +220,7 @@ function TSMAPI:NewModule(obj)
obj.operations = TSM.operations[moduleName] obj.operations = TSM.operations[moduleName]
for _, operation in pairs(obj.operations) do for _, operation in pairs(obj.operations) do
operation.ignorePlayer = operation.ignorePlayer or {} operation.ignorePlayer = operation.ignorePlayer or {}
operation.ignoreFactionrealm = operation.ignoreFactionrealm or {} operation.ignorerealm = operation.ignorerealm or {}
operation.relationships = operation.relationships or {} operation.relationships = operation.relationships or {}
end end
TSM:CheckOperationRelationships(moduleName) TSM:CheckOperationRelationships(moduleName)
@ -266,7 +266,7 @@ function TSM:UpdateModuleProfiles()
for module, operations in pairs(TSM.operations) do for module, operations in pairs(TSM.operations) do
for _, operation in pairs(operations) do for _, operation in pairs(operations) do
operation.ignorePlayer = operation.ignorePlayer or {} operation.ignorePlayer = operation.ignorePlayer or {}
operation.ignoreFactionrealm = operation.ignoreFactionrealm or {} operation.ignorerealm = operation.ignorerealm or {}
operation.relationships = operation.relationships or {} operation.relationships = operation.relationships or {}
end end
TSM:CheckOperationRelationships(module) TSM:CheckOperationRelationships(module)
@ -296,9 +296,9 @@ function TSM:IsOperationIgnored(module, operationName)
local obj = moduleObjects[module] local obj = moduleObjects[module]
local operation = obj.operations[operationName] local operation = obj.operations[operationName]
if not operation then return end if not operation then return end
local factionrealm = TSM.db.keys.factionrealm local realm = TSM.db.keys.realm
local playerKey = UnitName("player").." - "..factionrealm local playerKey = UnitName("player").." - "..realm
return operation.ignorePlayer[playerKey] or operation.ignoreFactionrealm[factionrealm] return operation.ignorePlayer[playerKey] or operation.ignorerealm[realm]
end end
function TSM:CheckOperationRelationships(moduleName) function TSM:CheckOperationRelationships(moduleName)

6
TradeSkillMaster/Core/Options.lua

@ -455,7 +455,7 @@ function private:LoadOptionsPage(parent)
relativeWidth = 0.49, relativeWidth = 0.49,
callback = function(_, _, value) callback = function(_, _, value)
local name = characterList[value] local name = characterList[value]
TSM.db.factionrealm.characters[name] = nil TSM.db.realm.characters[name] = nil
TSM:Printf("%s removed.", name) TSM:Printf("%s removed.", name)
parent:ReloadTab() parent:ReloadTab()
end, end,
@ -663,7 +663,7 @@ function private:LoadOptionsPage(parent)
} }
-- extra multi-account syncing widgets -- extra multi-account syncing widgets
for account, players in pairs(TSM.db.factionrealm.syncAccounts) do for account, players in pairs(TSM.db.realm.syncAccounts) do
local playerList = {} local playerList = {}
for player in pairs(players) do for player in pairs(players) do
tinsert(playerList, player) tinsert(playerList, player)
@ -674,7 +674,7 @@ function private:LoadOptionsPage(parent)
text = DELETE, text = DELETE,
relativeWidth = 0.2, relativeWidth = 0.2,
callback = function() callback = function()
TSM.db.factionrealm.syncAccounts[account] = nil TSM.db.realm.syncAccounts[account] = nil
parent:ReloadTab() parent:ReloadTab()
end, end,
}, },

14
TradeSkillMaster/Core/Sync.lua

@ -25,7 +25,7 @@ function Sync:OnEnable()
Sync:RegisterEvent("CHAT_MSG_SYSTEM") Sync:RegisterEvent("CHAT_MSG_SYSTEM")
local data = {characters={}, accountKey=TSMAPI.Sync:GetAccountKey()} local data = {characters={}, accountKey=TSMAPI.Sync:GetAccountKey()}
for name in pairs(TSM.db.factionrealm.characters) do for name in pairs(TSM.db.realm.characters) do
data.characters[name] = TSMAPI.Sync:GetAccountKey() data.characters[name] = TSMAPI.Sync:GetAccountKey()
end end
TSMAPI:CreateTimeDelay("syncSetupDelay", 3, function() TSMAPI.Sync:BroadcastData("TradeSkillMaster", "SETUP", data) end) TSMAPI:CreateTimeDelay("syncSetupDelay", 3, function() TSMAPI.Sync:BroadcastData("TradeSkillMaster", "SETUP", data) end)
@ -63,7 +63,7 @@ function Sync:OnCommReceived(_, data, _, source)
data.__account = nil data.__account = nil
-- make sure we are getting this from a known source -- make sure we are getting this from a known source
if not TSM.db.factionrealm.syncAccounts[account] and (module ~= "TradeSkillMaster" and not data.isSetup) then return end if not TSM.db.realm.syncAccounts[account] and (module ~= "TradeSkillMaster" and not data.isSetup) then return end
private.callbacks[module](key, data, source) private.callbacks[module](key, data, source)
end end
@ -83,7 +83,7 @@ end
function TSMAPI.Sync:GetAccountKey() function TSMAPI.Sync:GetAccountKey()
return TSM.db.factionrealm.accountKey return TSM.db.realm.accountKey
end end
function TSM:RegisterSyncCallback(module, callback) function TSM:RegisterSyncCallback(module, callback)
@ -147,7 +147,7 @@ end
function TSMAPI.Sync:BroadcastData(module, key, data) function TSMAPI.Sync:BroadcastData(module, key, data)
for account, players in pairs(TSM.db.factionrealm.syncAccounts) do for account, players in pairs(TSM.db.realm.syncAccounts) do
if account ~= TSMAPI.Sync:GetAccountKey() then if account ~= TSMAPI.Sync:GetAccountKey() then
local sent local sent
for player in pairs(players) do for player in pairs(players) do
@ -173,7 +173,7 @@ end
function private:SendSetupData(target, isResponse, isSetup) function private:SendSetupData(target, isResponse, isSetup)
local data = {isResponse=isResponse, isSetup=isSetup, characters={}, accountKey=TSMAPI.Sync:GetAccountKey()} local data = {isResponse=isResponse, isSetup=isSetup, characters={}, accountKey=TSMAPI.Sync:GetAccountKey()}
for name in pairs(TSM.db.factionrealm.characters) do for name in pairs(TSM.db.realm.characters) do
data.characters[name] = true data.characters[name] = true
end end
TSMAPI.Sync:SendData("TradeSkillMaster", "SETUP", data, target) TSMAPI.Sync:SendData("TradeSkillMaster", "SETUP", data, target)
@ -190,11 +190,11 @@ end
function TSM:SyncCallback(key, data, source) function TSM:SyncCallback(key, data, source)
if key == "SETUP" then if key == "SETUP" then
if (data.isSetup and strlower(source) ~= strlower(private.syncSetupTarget or "")) or (not data.isSetup and not TSM.db.factionrealm.syncAccounts[data.accountKey]) then if (data.isSetup and strlower(source) ~= strlower(private.syncSetupTarget or "")) or (not data.isSetup and not TSM.db.realm.syncAccounts[data.accountKey]) then
return return
end end
TSMAPI:Verify(data.accountKey ~= TSMAPI.Sync:GetAccountKey(), "It appears that you've manually copied your saved variables between accounts which will cause TSM's automatic sync'ing to not work. You'll need to undo this, and/or delete the TradeSkillMaster, TSM_Crafting, and TSM_ItemTracker saved variables files on both accounts (with WoW closed) in order to fix this.") TSMAPI:Verify(data.accountKey ~= TSMAPI.Sync:GetAccountKey(), "It appears that you've manually copied your saved variables between accounts which will cause TSM's automatic sync'ing to not work. You'll need to undo this, and/or delete the TradeSkillMaster, TSM_Crafting, and TSM_ItemTracker saved variables files on both accounts (with WoW closed) in order to fix this.")
TSM.db.factionrealm.syncAccounts[data.accountKey] = data.characters TSM.db.realm.syncAccounts[data.accountKey] = data.characters
if data.isSetup then if data.isSetup then
TSMAPI:CloseFrame() TSMAPI:CloseFrame()
TSM:Printf(L["Setup account sync'ing with the account which '%s' is on."], source) TSM:Printf(L["Setup account sync'ing with the account which '%s' is on."], source)

4
TradeSkillMaster/Data/Vendor.lua

@ -55,7 +55,9 @@ local vendorItems = {
["item:39684:0:0:0:0:0:0"] = 9000, ["item:39684:0:0:0:0:0:0"] = 9000,
["item:40533:0:0:0:0:0:0"] = 50000, ["item:40533:0:0:0:0:0:0"] = 50000,
["item:44835:0:0:0:0:0:0"] = 10, ["item:44835:0:0:0:0:0:0"] = 10,
["item:44853:0:0:0:0:0:0"] = 25, ["item:52510:0:0:0:0:0:0"] = 30000,
["item:52511:0:0:0:0:0:0"] = 30000,
["item:8925:0:0:0:0:0:0"] = 500,
-- ["item:52188:0:0:0:0:0:0"] = 15000, -- ["item:52188:0:0:0:0:0:0"] = 15000,
-- ["item:58274:0:0:0:0:0:0"] = 11000, -- ["item:58274:0:0:0:0:0:0"] = 11000,
-- ["item:58278:0:0:0:0:0:0"] = 16000, -- ["item:58278:0:0:0:0:0:0"] = 16000,

16
TradeSkillMaster/GUI/BankUI.lua

@ -169,9 +169,9 @@ function BankUI:getFrame(frameType)
bFrame:SetScript("OnMouseDown", bFrame.StartMoving) bFrame:SetScript("OnMouseDown", bFrame.StartMoving)
bFrame:SetScript("OnMouseUp", function(...) bFrame.StopMovingOrSizing(...) bFrame:SetScript("OnMouseUp", function(...) bFrame.StopMovingOrSizing(...)
if bankType == "guild" then if bankType == "guild" then
TSM.db.factionrealm.bankUIGBankFramePosition = { bFrame:GetLeft(), bFrame:GetBottom() } TSM.db.realm.bankUIGBankFramePosition = { bFrame:GetLeft(), bFrame:GetBottom() }
else else
TSM.db.factionrealm.bankUIBankFramePosition = { bFrame:GetLeft(), bFrame:GetBottom() } TSM.db.realm.bankUIBankFramePosition = { bFrame:GetLeft(), bFrame:GetBottom() }
end end
end) end)
bFrame:SetMovable(true) bFrame:SetMovable(true)
@ -183,9 +183,9 @@ function BankUI:getFrame(frameType)
self:SetFrameLevel(0) self:SetFrameLevel(0)
self:ClearAllPoints() self:ClearAllPoints()
if bankType == "guild" then if bankType == "guild" then
self:SetPoint("BOTTOMLEFT", UIParent, unpack(TSM.db.factionrealm.bankUIGBankFramePosition)) self:SetPoint("BOTTOMLEFT", UIParent, unpack(TSM.db.realm.bankUIGBankFramePosition))
else else
self:SetPoint("BOTTOMLEFT", UIParent, unpack(TSM.db.factionrealm.bankUIBankFramePosition)) self:SetPoint("BOTTOMLEFT", UIParent, unpack(TSM.db.realm.bankUIBankFramePosition))
end end
end end
@ -270,9 +270,9 @@ end
function BankUI:resetPoints(container) function BankUI:resetPoints(container)
if bankType == "guild" then if bankType == "guild" then
container:SetPoint("BOTTOMLEFT", UIParent, unpack(TSM.db.factionrealm.bankUIGBankFramePosition)) container:SetPoint("BOTTOMLEFT", UIParent, unpack(TSM.db.realm.bankUIGBankFramePosition))
else else
container:SetPoint("BOTTOMLEFT", UIParent, unpack(TSM.db.factionrealm.bankUIBankFramePosition)) container:SetPoint("BOTTOMLEFT", UIParent, unpack(TSM.db.realm.bankUIBankFramePosition))
end end
end end
@ -337,8 +337,8 @@ function TSM:getBankTabs()
end end
function TSM:ResetBankUIFramePosition() function TSM:ResetBankUIFramePosition()
TSM.db.factionrealm.bankUIGBankFramePosition = { 100, 300 } TSM.db.realm.bankUIGBankFramePosition = { 100, 300 }
TSM.db.factionrealm.bankUIBankFramePosition = { 100, 300 } TSM.db.realm.bankUIBankFramePosition = { 100, 300 }
if ui then if ui then
ui:Hide() ui:Hide()
ui:Show() ui:Show()

6
TradeSkillMaster/TradeSkillMaster.lua

@ -121,7 +121,7 @@ local savedDBDefaults = {
colorGroupName = true, colorGroupName = true,
embeddedTooltip = true, embeddedTooltip = true,
}, },
factionrealm = { realm = {
accountKey = nil, accountKey = nil,
characters = {}, characters = {},
syncAccounts = {}, syncAccounts = {},
@ -161,9 +161,9 @@ function TSM:OnInitialize()
TSM:RegisterModule() TSM:RegisterModule()
-- create account key for multi-account syncing if necessary -- create account key for multi-account syncing if necessary
TSM.db.factionrealm.accountKey = TSM.db.factionrealm.accountKey or (GetRealmName() .. random(time())) TSM.db.realm.accountKey = TSM.db.realm.accountKey or (GetRealmName() .. random(time()))
-- add this character to the list of characters on this realm -- add this character to the list of characters on this realm
TSM.db.factionrealm.characters[UnitName("player")] = true TSM.db.realm.characters[UnitName("player")] = true
-- Initialize default design, and apply defaults for any missing DB values. -- Initialize default design, and apply defaults for any missing DB values.
-- NOTE: We allow missing fonts (such as uninstalled SharedMedia fonts), and -- NOTE: We allow missing fonts (such as uninstalled SharedMedia fonts), and

2
TradeSkillMaster/Util/Util.lua

@ -46,7 +46,7 @@ function TSMAPI:ShowStaticPopupDialog(name)
end end
function TSMAPI:GetCharacters() function TSMAPI:GetCharacters()
return CopyTable(TSM.db.factionrealm.characters) return CopyTable(TSM.db.realm.characters)
end end

44
TradeSkillMaster_Accounting/Modules/data.lua

@ -74,9 +74,9 @@ function private:LoadItemRecords(csvData, recordType, key)
local saveTimeIndex = 1 local saveTimeIndex = 1
local saveTimes local saveTimes
if recordType == "sales" then if recordType == "sales" then
saveTimes = TSMAPI:SafeStrSplit(TSM.db.factionrealm.saveTimeSales, ",") saveTimes = TSMAPI:SafeStrSplit(TSM.db.realm.saveTimeSales, ",")
elseif recordType == "buys" then elseif recordType == "buys" then
saveTimes = TSMAPI:SafeStrSplit(TSM.db.factionrealm.saveTimeBuys, ",") saveTimes = TSMAPI:SafeStrSplit(TSM.db.realm.saveTimeBuys, ",")
end end
for _, record in ipairs(select(2, LibParse:CSVDecode(csvData)) or {}) do for _, record in ipairs(select(2, LibParse:CSVDecode(csvData)) or {}) do
local itemString = record.itemString local itemString = record.itemString
@ -119,20 +119,20 @@ function Data:Load()
-- Decode item records -- Decode item records
TSM.items = {} TSM.items = {}
TSM.cache = {} TSM.cache = {}
private:LoadItemRecords(TSM.db.factionrealm.csvSales, "sales") private:LoadItemRecords(TSM.db.realm.csvSales, "sales")
private:LoadItemRecords(TSM.db.factionrealm.csvBuys, "buys") private:LoadItemRecords(TSM.db.realm.csvBuys, "buys")
private:LoadItemRecords(TSM.db.factionrealm.csvCancelled, "auctions", "Cancel") private:LoadItemRecords(TSM.db.realm.csvCancelled, "auctions", "Cancel")
private:LoadItemRecords(TSM.db.factionrealm.csvExpired, "auctions", "Expire") private:LoadItemRecords(TSM.db.realm.csvExpired, "auctions", "Expire")
-- Decode money records -- Decode money records
TSM.money = {} TSM.money = {}
private:LoadMoneyRecords(TSM.db.factionrealm.csvIncome, "income") private:LoadMoneyRecords(TSM.db.realm.csvIncome, "income")
private:LoadMoneyRecords(TSM.db.factionrealm.csvExpense, "expense") private:LoadMoneyRecords(TSM.db.realm.csvExpense, "expense")
-- Decode the gold log -- Decode the gold log
for player, data in pairs(TSM.db.factionrealm.goldLog) do for player, data in pairs(TSM.db.realm.goldLog) do
if type(data) == "string" then if type(data) == "string" then
TSM.db.factionrealm.goldLog[player] = select(2, LibParse:CSVDecode(data)) TSM.db.realm.goldLog[player] = select(2, LibParse:CSVDecode(data))
end end
end end
Data:SetupDataTracking() Data:SetupDataTracking()
@ -534,13 +534,13 @@ end
-- returns a formatted time in the format that the user has selected -- returns a formatted time in the format that the user has selected
function private:GetFormattedTime(rTime) function private:GetFormattedTime(rTime)
if TSM.db.factionrealm.timeFormat == "ago" then if TSM.db.realm.timeFormat == "ago" then
return format(L["%s ago"], SecondsToTime(time() - rTime) or "?") return format(L["%s ago"], SecondsToTime(time() - rTime) or "?")
elseif TSM.db.factionrealm.timeFormat == "usdate" then elseif TSM.db.realm.timeFormat == "usdate" then
return date("%m/%d/%y %H:%M", rTime) return date("%m/%d/%y %H:%M", rTime)
elseif TSM.db.factionrealm.timeFormat == "eudate" then elseif TSM.db.realm.timeFormat == "eudate" then
return date("%d/%m/%y %H:%M", rTime) return date("%d/%m/%y %H:%M", rTime)
elseif TSM.db.factionrealm.timeFormat == "aidate" then elseif TSM.db.realm.timeFormat == "aidate" then
return date("%y/%m/%d %H:%M", rTime) return date("%y/%m/%d %H:%M", rTime)
end end
end end
@ -559,7 +559,7 @@ function private:IsItemFiltered(itemString, filters)
return true return true
end end
if not TSM.db.factionrealm.displayGreys and rarity == 0 then if not TSM.db.realm.displayGreys and rarity == 0 then
return true return true
end end
@ -578,7 +578,7 @@ function private:IsRecordFiltered(record, filters)
if filters.otherPlayer and record.otherPlayer ~= filters.otherPlayer then if filters.otherPlayer and record.otherPlayer ~= filters.otherPlayer then
return true return true
end end
if not TSM.db.factionrealm.displayTransfers and record.key == "Transfer" then if not TSM.db.realm.displayTransfers and record.key == "Transfer" then
return true return true
end end
if filters.time and floor(record.time/SECONDS_PER_DAY) < (floor(time()/SECONDS_PER_DAY) - filters.time) then if filters.time and floor(record.time/SECONDS_PER_DAY) < (floor(time()/SECONDS_PER_DAY) - filters.time) then
@ -684,7 +684,7 @@ function private:GetItemSummaryData(filters, includeProfit)
if isValidItem then if isValidItem then
itemData[itemString] = {buyNum=buyNum, sellNum=sellNum, profit=profit, profitText=profitText} itemData[itemString] = {buyNum=buyNum, sellNum=sellNum, profit=profit, profitText=profitText}
if TSM.db.factionrealm.priceFormat == "total" then if TSM.db.realm.priceFormat == "total" then
itemData[itemString].avgSell = sellNum > 0 and sellTotal or 0 itemData[itemString].avgSell = sellNum > 0 and sellTotal or 0
itemData[itemString].avgBuy = buyNum > 0 and buyTotal or 0 itemData[itemString].avgBuy = buyNum > 0 and buyTotal or 0
else else
@ -741,7 +741,7 @@ function Data.GetItemSummarySTData(filters)
local stData = {} local stData = {}
for itemString, data in pairs(itemData) do for itemString, data in pairs(itemData) do
local name = TSM.items[itemString].name local name = TSM.items[itemString].name
local marketValue = TSMAPI:GetItemValue(itemString, TSM.db.factionrealm.mvSource) local marketValue = TSMAPI:GetItemValue(itemString, TSM.db.realm.mvSource)
local row = { local row = {
cols = { cols = {
{ {
@ -1169,7 +1169,7 @@ do
end end
local function onChatMsg(_, msg) local function onChatMsg(_, msg)
if not TSM.db.factionrealm.trackTrades then return if not TSM.db.realm.trackTrades then return
end end
if msg == ERR_TRADE_COMPLETE and tradeInfo then if msg == ERR_TRADE_COMPLETE and tradeInfo then
-- trade went through -- trade went through
@ -1223,7 +1223,7 @@ do
Data:InsertItemBuyRecord(info.itemString, "Trade", info.count, info.price, tradeInfo.target.name) Data:InsertItemBuyRecord(info.itemString, "Trade", info.count, info.price, tradeInfo.target.name)
end end
end end
if TSM.db.factionrealm.autoTrackTrades then if TSM.db.realm.autoTrackTrades then
InsertTradeRecord() InsertTradeRecord()
else else
StaticPopupDialogs["TSMAccountingOnTrade"] = { StaticPopupDialogs["TSMAccountingOnTrade"] = {
@ -1254,8 +1254,8 @@ function Data:LogGold()
if not player then return end if not player then return end
lastTrackMinute = currentMinute lastTrackMinute = currentMinute
TSM.db.factionrealm.goldLog[player] = TSM.db.factionrealm.goldLog[player] or {} TSM.db.realm.goldLog[player] = TSM.db.realm.goldLog[player] or {}
local goldLog = TSM.db.factionrealm.goldLog[player] local goldLog = TSM.db.realm.goldLog[player]
local currentGold = TSM:Round(GetMoney(), COPPER_PER_GOLD * 1000) local currentGold = TSM:Round(GetMoney(), COPPER_PER_GOLD * 1000)
if #goldLog > 0 and currentGold == goldLog[#goldLog].copper then if #goldLog > 0 and currentGold == goldLog[#goldLog].copper then
goldLog[#goldLog].endMinute = currentMinute goldLog[#goldLog].endMinute = currentMinute

50
TradeSkillMaster_Accounting/Modules/gui.lua

@ -224,7 +224,7 @@ function GUI:DrawRevenueTab(container)
private:CreateScrollingTable(self, "income", TSM.Data.GetIncomeSTData, ITEM_MONEY_ST_COLS) private:CreateScrollingTable(self, "income", TSM.Data.GetIncomeSTData, ITEM_MONEY_ST_COLS)
elseif value == 3 then elseif value == 3 then
GUI:CreateFiltersWidgetsItem(self, "resale", {"Auction", "COD", "Trade", "Vendor"}) GUI:CreateFiltersWidgetsItem(self, "resale", {"Auction", "COD", "Trade", "Vendor"})
local stCols = TSM.db.factionrealm.priceFormat == "avg" and ITEM_RESALE_ST_COLS_AVG or ITEM_RESALE_ST_COLS_TOTAL local stCols = TSM.db.realm.priceFormat == "avg" and ITEM_RESALE_ST_COLS_AVG or ITEM_RESALE_ST_COLS_TOTAL
private:CreateScrollingTable(self, "resale", TSM.Data.GetResaleSTData, stCols, tabNum, value) private:CreateScrollingTable(self, "resale", TSM.Data.GetResaleSTData, stCols, tabNum, value)
end end
tabGroup.children[1]:DoLayout() tabGroup.children[1]:DoLayout()
@ -287,7 +287,7 @@ end
function GUI:DrawItemSummary(container) function GUI:DrawItemSummary(container)
GUI:CreateFiltersWidgetsItem(container, "itemSummary", {"Auction", "COD", "Trade", "Vendor"}) GUI:CreateFiltersWidgetsItem(container, "itemSummary", {"Auction", "COD", "Trade", "Vendor"})
local stCols = TSM.db.factionrealm.priceFormat == "avg" and ITEM_SUMMARY_ST_COLS_AVG or ITEM_SUMMARY_ST_COLS_TOTAL local stCols = TSM.db.realm.priceFormat == "avg" and ITEM_SUMMARY_ST_COLS_AVG or ITEM_SUMMARY_ST_COLS_TOTAL
private:CreateScrollingTable(container, "itemSummary", TSM.Data.GetItemSummarySTData, stCols, 4) private:CreateScrollingTable(container, "itemSummary", TSM.Data.GetItemSummarySTData, stCols, 4)
end end
@ -824,7 +824,7 @@ function private:GetGoldGraphSumData()
local currentMinute = floor(time() / 60) local currentMinute = floor(time() / 60)
local players = {} local players = {}
local starts = {} local starts = {}
for _, playerData in pairs(TSM.db.factionrealm.goldLog) do for _, playerData in pairs(TSM.db.realm.goldLog) do
if #playerData > 2 then if #playerData > 2 then
local data = CopyTable(playerData) local data = CopyTable(playerData)
for i=1, #data do for i=1, #data do
@ -885,17 +885,17 @@ function private:GetGoldGraphSumData()
end end
function GUI:DrawGoldGraph(container) function GUI:DrawGoldGraph(container)
TSM.db.factionrealm.goldGraphCharacter = TSM.db.factionrealm.goldGraphCharacter or UnitName("player") TSM.db.realm.goldGraphCharacter = TSM.db.realm.goldGraphCharacter or UnitName("player")
local player = TSM.db.factionrealm.goldGraphCharacter local player = TSM.db.realm.goldGraphCharacter
local data, minX, maxX, minY, maxY local data, minX, maxX, minY, maxY
if player == "<ALL>" then if player == "<ALL>" then
data, minX, maxX, minY, maxY = private:GetGoldGraphSumData() data, minX, maxX, minY, maxY = private:GetGoldGraphSumData()
else else
data, minX, maxX, minY, maxY = private:GetGoldGraphPoints(TSM.db.factionrealm.goldLog[player]) data, minX, maxX, minY, maxY = private:GetGoldGraphPoints(TSM.db.realm.goldLog[player])
end end
local dropdownList = {["<ALL>"]="Sum of All Characters"} local dropdownList = {["<ALL>"]="Sum of All Characters"}
for player in pairs(TSM.db.factionrealm.goldLog) do for player in pairs(TSM.db.realm.goldLog) do
dropdownList[player] = player dropdownList[player] = player
end end
@ -916,7 +916,7 @@ function GUI:DrawGoldGraph(container)
{ {
type = "Dropdown", type = "Dropdown",
label = "Character to Graph", label = "Character to Graph",
settingInfo = {TSM.db.factionrealm, "goldGraphCharacter"}, settingInfo = {TSM.db.realm, "goldGraphCharacter"},
relativeWidth = 0.5, relativeWidth = 0.5,
list = dropdownList, list = dropdownList,
callback = function() container:ReloadTab() end, callback = function() container:ReloadTab() end,
@ -930,10 +930,10 @@ function GUI:DrawGoldGraph(container)
end end
local startDate, endDate local startDate, endDate
if TSM.db.factionrealm.timeFormat == "eudate" then if TSM.db.realm.timeFormat == "eudate" then
startDate = date("%d/%m/%y %H:%M", minX * 60) startDate = date("%d/%m/%y %H:%M", minX * 60)
endDate = date("%d/%m/%y %H:%M", maxX * 60) endDate = date("%d/%m/%y %H:%M", maxX * 60)
elseif TSM.db.factionrealm.timeFormat == "aidate" then elseif TSM.db.realm.timeFormat == "aidate" then
startDate = date("%y/%m/%d %H:%M", minX * 60) startDate = date("%y/%m/%d %H:%M", minX * 60)
endDate = date("%y/%m/%d %H:%M", maxX * 60) endDate = date("%y/%m/%d %H:%M", maxX * 60)
else else
@ -958,7 +958,7 @@ function GUI:DrawGoldGraph(container)
{ {
type = "Dropdown", type = "Dropdown",
label = L["Character to Graph"], label = L["Character to Graph"],
settingInfo = {TSM.db.factionrealm, "goldGraphCharacter"}, settingInfo = {TSM.db.realm, "goldGraphCharacter"},
relativeWidth = 0.5, relativeWidth = 0.5,
list = dropdownList, list = dropdownList,
callback = function() container:ReloadTab() end, callback = function() container:ReloadTab() end,
@ -1024,7 +1024,7 @@ function GUI:DrawOptions(container)
{ {
type = "Dropdown", type = "Dropdown",
label = L["Time Format"], label = L["Time Format"],
settingInfo = {TSM.db.factionrealm, "timeFormat"}, settingInfo = {TSM.db.realm, "timeFormat"},
relativeWidth = 0.5, relativeWidth = 0.5,
list = { ["ago"] = L["_ Hr _ Min ago"], ["usdate"] = L["MM/DD/YY HH:MM"], ["aidate"] = L["YY/MM/DD HH:MM"], ["eudate"] = L["DD/MM/YY HH:MM"] }, list = { ["ago"] = L["_ Hr _ Min ago"], ["usdate"] = L["MM/DD/YY HH:MM"], ["aidate"] = L["YY/MM/DD HH:MM"], ["eudate"] = L["DD/MM/YY HH:MM"] },
tooltip = L["Select what format Accounting should use to display times in applicable screens."], tooltip = L["Select what format Accounting should use to display times in applicable screens."],
@ -1032,7 +1032,7 @@ function GUI:DrawOptions(container)
{ {
type = "Dropdown", type = "Dropdown",
label = L["Market Value Source"], label = L["Market Value Source"],
settingInfo = {TSM.db.factionrealm, "mvSource"}, settingInfo = {TSM.db.realm, "mvSource"},
relativeWidth = 0.49, relativeWidth = 0.49,
list = mvSources, list = mvSources,
tooltip = L["Select where you want Accounting to get market value info from to show in applicable screens."], tooltip = L["Select where you want Accounting to get market value info from to show in applicable screens."],
@ -1040,7 +1040,7 @@ function GUI:DrawOptions(container)
{ {
type = "Dropdown", type = "Dropdown",
label = "Items/Resale Price Format", label = "Items/Resale Price Format",
settingInfo = {TSM.db.factionrealm, "priceFormat"}, settingInfo = {TSM.db.realm, "priceFormat"},
relativeWidth = 0.49, relativeWidth = 0.49,
list = { ["avg"] = L["Per Item"], ["total"] = L["Total Value"] }, list = { ["avg"] = L["Per Item"], ["total"] = L["Total Value"] },
tooltip = L["Select how you would like prices to be shown in the \"Items\" and \"Resale\" tabs; either average price per item or total value."], tooltip = L["Select how you would like prices to be shown in the \"Items\" and \"Resale\" tabs; either average price per item or total value."],
@ -1052,33 +1052,33 @@ function GUI:DrawOptions(container)
{ {
type = "CheckBox", type = "CheckBox",
label = L["Track sales/purchases via trade"], label = L["Track sales/purchases via trade"],
settingInfo = { TSM.db.factionrealm, "trackTrades" }, settingInfo = { TSM.db.realm, "trackTrades" },
callback = function() container:ReloadTab() end, callback = function() container:ReloadTab() end,
tooltip = L["If checked, whenever you buy or sell any quantity of a single item via trade, Accounting will display a popup asking if you want it to record that transaction."], tooltip = L["If checked, whenever you buy or sell any quantity of a single item via trade, Accounting will display a popup asking if you want it to record that transaction."],
}, },
{ {
type = "CheckBox", type = "CheckBox",
label = L["Don't prompt to record trades"], label = L["Don't prompt to record trades"],
settingInfo = { TSM.db.factionrealm, "autoTrackTrades" }, settingInfo = { TSM.db.realm, "autoTrackTrades" },
disabled = not TSM.db.factionrealm.trackTrades, disabled = not TSM.db.realm.trackTrades,
tooltip = L["If checked, you won't get a popup confirmation about whether or not to track trades."], tooltip = L["If checked, you won't get a popup confirmation about whether or not to track trades."],
}, },
{ {
type = "CheckBox", type = "CheckBox",
label = L["Display Grey Items in Sales"], label = L["Display Grey Items in Sales"],
settingInfo = { TSM.db.factionrealm, "displayGreys" }, settingInfo = { TSM.db.realm, "displayGreys" },
tooltip = L["If checked, poor quality items will be shown in sales data. They will still be included in gold earned totals on the summary tab regardless of this setting"], tooltip = L["If checked, poor quality items will be shown in sales data. They will still be included in gold earned totals on the summary tab regardless of this setting"],
}, },
{ {
type = "CheckBox", type = "CheckBox",
label = L["Display Money Transfers in Income/Expense/Summary"], label = L["Display Money Transfers in Income/Expense/Summary"],
settingInfo = { TSM.db.factionrealm, "displayTransfers" }, settingInfo = { TSM.db.realm, "displayTransfers" },
tooltip = L["If checked, Money Transfers will be included in income / expense and summary. Accounting will still track these if disabled but will not show them."], tooltip = L["If checked, Money Transfers will be included in income / expense and summary. Accounting will still track these if disabled but will not show them."],
}, },
{ {
type = "CheckBox", type = "CheckBox",
label = L["Use smart average for purchase price"], label = L["Use smart average for purchase price"],
settingInfo = { TSM.db.factionrealm, "smartBuyPrice" }, settingInfo = { TSM.db.realm, "smartBuyPrice" },
tooltip = L["If checked, the average purchase price that shows in the tooltip will be the average price for the most recent X you have purchased, where X is the number you have in your bags / bank / gbank using data from the ItemTracker module. Otherwise, a simple average of all purchases will be used."], tooltip = L["If checked, the average purchase price that shows in the tooltip will be the average price for the most recent X you have purchased, where X is the number you have in your bags / bank / gbank using data from the ItemTracker module. Otherwise, a simple average of all purchases will be used."],
}, },
}, },
@ -1131,34 +1131,34 @@ function GUI:LoadTooltipOptions(container)
{ {
type = "CheckBox", type = "CheckBox",
label = L["Show sale info in item tooltips"], label = L["Show sale info in item tooltips"],
settingInfo = { TSM.db.factionrealm.tooltip, "sale" }, settingInfo = { TSM.db.realm.tooltip, "sale" },
tooltip = L["If checked, the number you have sold and the average sale price will show up in an item's tooltip."], tooltip = L["If checked, the number you have sold and the average sale price will show up in an item's tooltip."],
}, },
{ {
type = "CheckBox", type = "CheckBox",
label = L["Show Expired Auctions as Failed Auctions since Last Sale in item tooltips"], label = L["Show Expired Auctions as Failed Auctions since Last Sale in item tooltips"],
settingInfo = { TSM.db.factionrealm, "expiredAuctions" }, settingInfo = { TSM.db.realm, "expiredAuctions" },
relativeWidth = 1, relativeWidth = 1,
tooltip = L["If checked, the number of expired auctions since the last sale will show as up as failed auctions in an item's tooltip. if no sales then the total number of expired auctions will be shown."], tooltip = L["If checked, the number of expired auctions since the last sale will show as up as failed auctions in an item's tooltip. if no sales then the total number of expired auctions will be shown."],
}, },
{ {
type = "CheckBox", type = "CheckBox",
label = L["Show Cancelled Auctions as Failed Auctions since Last Sale in item tooltips"], label = L["Show Cancelled Auctions as Failed Auctions since Last Sale in item tooltips"],
settingInfo = { TSM.db.factionrealm, "cancelledAuctions" }, settingInfo = { TSM.db.realm, "cancelledAuctions" },
relativeWidth = 1, relativeWidth = 1,
tooltip = L["If checked, the number of cancelled auctions since the last sale will show as up as failed auctions in an item's tooltip. if no sales then the total number of cancelled auctions will be shown."], tooltip = L["If checked, the number of cancelled auctions since the last sale will show as up as failed auctions in an item's tooltip. if no sales then the total number of cancelled auctions will be shown."],
}, },
{ {
type = "CheckBox", type = "CheckBox",
label = L["Show Sale Rate in item tooltips"], label = L["Show Sale Rate in item tooltips"],
settingInfo = { TSM.db.factionrealm, "saleRate" }, settingInfo = { TSM.db.realm, "saleRate" },
relativeWidth = 1, relativeWidth = 1,
tooltip = L["If checked, the sale rate will be shown in item tooltips. sale rate is calculated as total sold / (total sold + total expired + total cancelled)."], tooltip = L["If checked, the sale rate will be shown in item tooltips. sale rate is calculated as total sold / (total sold + total expired + total cancelled)."],
}, },
{ {
type = "CheckBox", type = "CheckBox",
label = L["Show purchase info in item tooltips"], label = L["Show purchase info in item tooltips"],
settingInfo = { TSM.db.factionrealm.tooltip, "purchase" }, settingInfo = { TSM.db.realm.tooltip, "purchase" },
tooltip = L["If checked, the number you have purchased and the average purchase price will show up in an item's tooltip."], tooltip = L["If checked, the number you have purchased and the average purchase price will show up in an item's tooltip."],
}, },
}, },

54
TradeSkillMaster_Accounting/TradeSkillMaster_Accounting.lua

@ -25,7 +25,7 @@ local savedDBDefaults = {
itemStrings = {}, itemStrings = {},
infoID = 0, infoID = 0,
}, },
factionrealm = { realm = {
csvSales = "", csvSales = "",
csvBuys = "", csvBuys = "",
csvIncome = "", csvIncome = "",
@ -64,25 +64,25 @@ function TSM:OnInitialize()
TSM:RegisterModule() TSM:RegisterModule()
-- clear out 1.x data -- clear out 1.x data
if TSM.db.factionrealm.itemData then if TSM.db.realm.itemData then
TSM.db.factionrealm.itemData = nil TSM.db.realm.itemData = nil
end end
if TSM.db.factionrealm.data then if TSM.db.realm.data then
TSM.db.factionrealm.csvSales = TSM.db.factionrealm.data.sales TSM.db.realm.csvSales = TSM.db.realm.data.sales
TSM.db.factionrealm.csvBuys = TSM.db.factionrealm.data.buys TSM.db.realm.csvBuys = TSM.db.realm.data.buys
TSM.db.factionrealm.data = nil TSM.db.realm.data = nil
end end
for key, timestamp in pairs(TSM.db.factionrealm.trimmed) do for key, timestamp in pairs(TSM.db.realm.trimmed) do
TSM:Printf(L["|cffff0000IMPORTANT:|r When TSM_Accounting last saved data for this realm, it was too big for WoW to handle, so old data was automatically trimmed in order to avoid corruption of the saved variables. The last %s of %s data has been preserved."], SecondsToTime(time()-timestamp), key) TSM:Printf(L["|cffff0000IMPORTANT:|r When TSM_Accounting last saved data for this realm, it was too big for WoW to handle, so old data was automatically trimmed in order to avoid corruption of the saved variables. The last %s of %s data has been preserved."], SecondsToTime(time()-timestamp), key)
end end
TSM.db.factionrealm.trimmed = {} TSM.db.realm.trimmed = {}
TSM.Data:Load() TSM.Data:Load()
-- fix issues in gold log -- fix issues in gold log
for player, playerData in pairs(TSM.db.factionrealm.goldLog) do for player, playerData in pairs(TSM.db.realm.goldLog) do
for i=#playerData, 1, -1 do for i=#playerData, 1, -1 do
local data = playerData[i] local data = playerData[i]
data.startMinute = floor(data.startMinute) data.startMinute = floor(data.startMinute)
@ -135,7 +135,7 @@ end
local tooltipCache = {buys={}, sales={}} local tooltipCache = {buys={}, sales={}}
function TSM:GetTooltip(itemString) function TSM:GetTooltip(itemString)
if not (TSM.db.factionrealm.tooltip.sale or TSM.db.factionrealm.tooltip.purchase) then return end if not (TSM.db.realm.tooltip.sale or TSM.db.realm.tooltip.purchase) then return end
if not TSM.items[itemString] then return end if not TSM.items[itemString] then return end
TSM.cache[itemString] = TSM.cache[itemString] or {} TSM.cache[itemString] = TSM.cache[itemString] or {}
local text = {} local text = {}
@ -145,7 +145,7 @@ function TSM:GetTooltip(itemString)
local numSaleRecords = #TSM.items[itemString].sales local numSaleRecords = #TSM.items[itemString].sales
local lastSold = numSaleRecords > 0 and TSM.items[itemString].sales[numSaleRecords].time or 0 local lastSold = numSaleRecords > 0 and TSM.items[itemString].sales[numSaleRecords].time or 0
local moneyCoinsTooltip = TSMAPI:GetMoneyCoinsTooltip() local moneyCoinsTooltip = TSMAPI:GetMoneyCoinsTooltip()
if TSM.db.factionrealm.tooltip.sale and numSaleRecords > 0 then if TSM.db.realm.tooltip.sale and numSaleRecords > 0 then
local totalSalePrice = avgSalePrice * totalSaleNum local totalSalePrice = avgSalePrice * totalSaleNum
if IsShiftKeyDown() then if IsShiftKeyDown() then
@ -183,7 +183,7 @@ function TSM:GetTooltip(itemString)
tinsert(text, { left = " " .. L["Sale Rate:"], right = "|cffffffff" .. saleRate }) tinsert(text, { left = " " .. L["Sale Rate:"], right = "|cffffffff" .. saleRate })
end end
if TSM.db.factionrealm.tooltip.purchase and TSM.items[itemString] and #TSM.items[itemString].buys > 0 then if TSM.db.realm.tooltip.purchase and TSM.items[itemString] and #TSM.items[itemString].buys > 0 then
local lastPurchased = TSM.items[itemString].buys[#TSM.items[itemString].buys].time local lastPurchased = TSM.items[itemString].buys[#TSM.items[itemString].buys].time
local totalPrice, totalNum = 0, 0 local totalPrice, totalNum = 0, 0
for _, record in ipairs(TSM.items[itemString].buys) do for _, record in ipairs(TSM.items[itemString].buys) do
@ -288,16 +288,16 @@ function TSM:OnTSMDBShutdown()
while (#data > floor(MAX_CSV_RECORDS*0.9)) do while (#data > floor(MAX_CSV_RECORDS*0.9)) do
tremove(data) tremove(data)
end end
TSM.db.factionrealm.trimmed[key] = data[#data].time TSM.db.realm.trimmed[key] = data[#data].time
end end
end end
TSM.db.factionrealm.saveTimeSales = table.concat(saveTimeSales, ",") TSM.db.realm.saveTimeSales = table.concat(saveTimeSales, ",")
TSM.db.factionrealm.saveTimeBuys = table.concat(saveTimeBuys, ",") TSM.db.realm.saveTimeBuys = table.concat(saveTimeBuys, ",")
TSM.db.factionrealm.csvSales = LibParse:CSVEncode(TSM.SELL_KEYS, sales) TSM.db.realm.csvSales = LibParse:CSVEncode(TSM.SELL_KEYS, sales)
TSM.db.factionrealm.csvBuys = LibParse:CSVEncode(TSM.BUY_KEYS, buys) TSM.db.realm.csvBuys = LibParse:CSVEncode(TSM.BUY_KEYS, buys)
TSM.db.factionrealm.csvCancelled = LibParse:CSVEncode(TSM.CANCELLED_KEYS, cancels) TSM.db.realm.csvCancelled = LibParse:CSVEncode(TSM.CANCELLED_KEYS, cancels)
TSM.db.factionrealm.csvExpired = LibParse:CSVEncode(TSM.EXPIRED_KEYS, expires) TSM.db.realm.csvExpired = LibParse:CSVEncode(TSM.EXPIRED_KEYS, expires)
-- process income -- process income
local income = {} local income = {}
@ -309,7 +309,7 @@ function TSM:OnTSMDBShutdown()
tinsert(income, record) tinsert(income, record)
end end
end end
TSM.db.factionrealm.csvIncome = LibParse:CSVEncode(TSM.INCOME_KEYS, income) TSM.db.realm.csvIncome = LibParse:CSVEncode(TSM.INCOME_KEYS, income)
-- process expense -- process expense
local expense = {} local expense = {}
@ -327,13 +327,13 @@ function TSM:OnTSMDBShutdown()
tinsert(expense, record) tinsert(expense, record)
end end
end end
TSM.db.factionrealm.csvExpense = LibParse:CSVEncode(TSM.EXPENSE_KEYS, expense) TSM.db.realm.csvExpense = LibParse:CSVEncode(TSM.EXPENSE_KEYS, expense)
-- process gold log -- process gold log
TSM.Data:LogGold() TSM.Data:LogGold()
for player, data in pairs(TSM.db.factionrealm.goldLog) do for player, data in pairs(TSM.db.realm.goldLog) do
if type(data) == "table" then if type(data) == "table" then
TSM.db.factionrealm.goldLog[player] = LibParse:CSVEncode(TSM.GOLD_LOG_KEYS, data) TSM.db.realm.goldLog[player] = LibParse:CSVEncode(TSM.GOLD_LOG_KEYS, data)
end end
end end
end end
@ -362,9 +362,9 @@ end
local function GetAuctionStats(itemString, minTime) local function GetAuctionStats(itemString, minTime)
local cancel, expire, total = 0, 0, 0 local cancel, expire, total = 0, 0, 0
for _, record in ipairs(TSM.items[itemString].auctions) do for _, record in ipairs(TSM.items[itemString].auctions) do
if record.key == "Cancel" and TSM.db.factionrealm.cancelledAuctions and record.time > minTime then if record.key == "Cancel" and TSM.db.realm.cancelledAuctions and record.time > minTime then
cancel = cancel + record.quantity cancel = cancel + record.quantity
elseif record.key == "Expire" and TSM.db.factionrealm.expiredAuctions and record.time > minTime then elseif record.key == "Expire" and TSM.db.realm.expiredAuctions and record.time > minTime then
expire = expire + record.quantity expire = expire + record.quantity
end end
total = total + record.quantity total = total + record.quantity
@ -441,7 +441,7 @@ local function GetAvgerageBuyPrice(itemString, noBaseItem)
if not (TSM.items[itemString] and #TSM.items[itemString].buys > 0) then return end if not (TSM.items[itemString] and #TSM.items[itemString].buys > 0) then return end
local itemCount = 0 local itemCount = 0
if TSM.db.factionrealm.smartBuyPrice then if TSM.db.realm.smartBuyPrice then
local player, alts = TSMAPI:ModuleAPI("ItemTracker", "playertotal", itemString) local player, alts = TSMAPI:ModuleAPI("ItemTracker", "playertotal", itemString)
if not player then if not player then
alts = nil alts = nil

10
TradeSkillMaster_AuctionDB/Modules/Scanning.lua

@ -96,7 +96,7 @@ local function FullScanCallback(event, ...)
-- It would be like trying to predict "the total download-time of a -- It would be like trying to predict "the total download-time of a
-- file that keeps fluctuating between fast and slow speeds". The -- file that keeps fluctuating between fast and slow speeds". The
-- best we can do is estimate based on current and previous speeds. -- best we can do is estimate based on current and previous speeds.
local last_scan_seconds_per_page = TSM.db.factionrealm.lastScanSecondsPerPage local last_scan_seconds_per_page = TSM.db.realm.lastScanSecondsPerPage
if last_scan_seconds_per_page and last_scan_seconds_per_page > 0 then if last_scan_seconds_per_page and last_scan_seconds_per_page > 0 then
-- TSM:Print(format("Read from DB: %f (Our unweighted estimate: %f)", last_scan_seconds_per_page, seconds_per_page)) -- DEBUG -- TSM:Print(format("Read from DB: %f (Our unweighted estimate: %f)", last_scan_seconds_per_page, seconds_per_page)) -- DEBUG
seconds_per_page = (seconds_per_page * progress_float) + (last_scan_seconds_per_page * remaining_float) seconds_per_page = (seconds_per_page * progress_float) + (last_scan_seconds_per_page * remaining_float)
@ -143,7 +143,7 @@ local function FullScanCallback(event, ...)
-- with incorrect, partial-scan estimates, since most servers heavily -- with incorrect, partial-scan estimates, since most servers heavily
-- slow down their page requests over time. The completed scan is the truth. -- slow down their page requests over time. The completed scan is the truth.
if Scan.fullScanSecondsPerPage > 0 then if Scan.fullScanSecondsPerPage > 0 then
TSM.db.factionrealm.lastScanSecondsPerPage = Scan.fullScanSecondsPerPage TSM.db.realm.lastScanSecondsPerPage = Scan.fullScanSecondsPerPage
end end
-- Calculate how many seconds the completed "Full Scan" took. -- Calculate how many seconds the completed "Full Scan" took.
@ -333,7 +333,7 @@ function Scan.ProcessGetAllScan(self)
end end
-- Process the collected "GetAll" auction data as a new "complete scan" with today's date. -- Process the collected "GetAll" auction data as a new "complete scan" with today's date.
TSM.db.factionrealm.lastCompleteScan = time() TSM.db.realm.lastCompleteScan = time()
TSM.Data:ProcessData(data, nil, verifyNewAlgorithm) TSM.Data:ProcessData(data, nil, verifyNewAlgorithm)
-- Show GUI progress while we're waiting for the processing. -- Show GUI progress while we're waiting for the processing.
@ -569,7 +569,7 @@ function Scan:ProcessScanData(scanData)
-- Mark the collected auction data as a new "complete scan" with today's date, -- Mark the collected auction data as a new "complete scan" with today's date,
-- but only if this was a normal "Full Scan" (not just a "TSM item group" scan). -- but only if this was a normal "Full Scan" (not just a "TSM item group" scan).
if Scan.isScanning ~= "group" then if Scan.isScanning ~= "group" then
TSM.db.factionrealm.lastCompleteScan = time() TSM.db.realm.lastCompleteScan = time()
end end
-- Process the collected auction data. -- Process the collected auction data.
@ -618,6 +618,6 @@ function Scan:ProcessImportedData(auctionData)
end end
-- Process the imported auction data as a new "complete scan" with today's date. -- Process the imported auction data as a new "complete scan" with today's date.
TSM.db.factionrealm.lastCompleteScan = time() TSM.db.realm.lastCompleteScan = time()
TSM.Data:ProcessData(data, nil, verifyNewAlgorithm) TSM.Data:ProcessData(data, nil, verifyNewAlgorithm)
end end

8
TradeSkillMaster_AuctionDB/Modules/config.lua

@ -130,11 +130,11 @@ function Config:LoadSearch(container)
tinsert(classes, "") tinsert(classes, "")
local lastScanInfo local lastScanInfo
if TSM.db.factionrealm.lastCompleteScan > 0 then if TSM.db.realm.lastCompleteScan > 0 then
if TSM.db.factionrealm.lastCompleteScan == TSM.db.factionrealm.appDataUpdate then if TSM.db.realm.lastCompleteScan == TSM.db.realm.appDataUpdate then
lastScanInfo = format(L["Last updated from the TSM Application %s ago."], SecondsToTime(time() - TSM.db.factionrealm.appDataUpdate)) lastScanInfo = format(L["Last updated from the TSM Application %s ago."], SecondsToTime(time() - TSM.db.realm.appDataUpdate))
else else
lastScanInfo = format(L["Last updated from in-game scan %s ago."], SecondsToTime(time() - TSM.db.factionrealm.lastCompleteScan)) lastScanInfo = format(L["Last updated from in-game scan %s ago."], SecondsToTime(time() - TSM.db.realm.lastCompleteScan))
end end
else else
lastScanInfo = L["No scans found."] lastScanInfo = L["No scans found."]

2
TradeSkillMaster_AuctionDB/Modules/data.lua

@ -316,7 +316,7 @@ function Data:ProcessData(scanData, groupItems, verifyNewAlgorithm)
-- item contains a "greater than 0" buyout value. That was mostly -- item contains a "greater than 0" buyout value. That was mostly
-- necessary in the past, when TSM sloppily included bid-only items -- necessary in the past, when TSM sloppily included bid-only items
-- in the data, but should no longer be able to happen with our new code! -- in the data, but should no longer be able to happen with our new code!
TSM.data[itemID].lastScan = TSM.db.factionrealm.lastCompleteScan TSM.data[itemID].lastScan = TSM.db.realm.lastCompleteScan
TSM.data[itemID].minBuyout = data.minBuyout > 0 and data.minBuyout or nil TSM.data[itemID].minBuyout = data.minBuyout > 0 and data.minBuyout or nil
TSM.data[itemID].quantity = data.quantity -- Counts all items of all stacks. TSM.data[itemID].quantity = data.quantity -- Counts all items of all stacks.
Data:UpdateMarketValue(TSM.data[itemID]) Data:UpdateMarketValue(TSM.data[itemID])

43
TradeSkillMaster_AuctionDB/TradeSkillMaster_AuctionDB.lua

@ -17,7 +17,7 @@ TSM.MAX_AVG_DAY = 1
local SECONDS_PER_DAY = 60 * 60 * 24 local SECONDS_PER_DAY = 60 * 60 * 24
local savedDBDefaults = { local savedDBDefaults = {
factionrealm = { realm = {
appData = {}, appData = {},
scanData = "", scanData = "",
time = 0, time = 0,
@ -50,10 +50,10 @@ function TSM:OnInitialize()
-- register this module with TSM -- register this module with TSM
TSM:RegisterModule() TSM:RegisterModule()
TSM.db.factionrealm.time = 10 -- because AceDB won't save if we don't do this... TSM.db.realm.time = 10 -- because AceDB won't save if we don't do this...
TSM.data = {} TSM.data = {}
TSM:Deserialize(TSM.db.factionrealm.scanData, TSM.data) TSM:Deserialize(TSM.db.realm.scanData, TSM.data)
end end
-- registers this module with TSM by first setting all fields and then calling TSMAPI:NewModule(). -- registers this module with TSM by first setting all fields and then calling TSMAPI:NewModule().
@ -75,7 +75,7 @@ function TSM:RegisterModule()
{ key = "lastCompleteScan", callback = TSM.GetLastCompleteScan }, { key = "lastCompleteScan", callback = TSM.GetLastCompleteScan },
{ key = "lastCompleteScanTime", callback = TSM.GetLastCompleteScanTime }, { key = "lastCompleteScanTime", callback = TSM.GetLastCompleteScanTime },
{ key = "adbScans", callback = TSM.GetScans }, { key = "adbScans", callback = TSM.GetScans },
{ key = "adbOppositeFaction", callback = TSM.GetOppositeFactionData }, --{ key = "adbOppositeFaction", callback = TSM.GetOppositeFactionData },
} }
TSM.tooltipOptions = {callback = "Config:LoadTooltipOptions"} TSM.tooltipOptions = {callback = "Config:LoadTooltipOptions"}
TSMAPI:NewModule(TSM) TSMAPI:NewModule(TSM)
@ -84,7 +84,7 @@ end
function TSM:LoadAuctionData() function TSM:LoadAuctionData()
local function LoadDataThread(self, itemIDs) local function LoadDataThread(self, itemIDs)
-- process new items first -- process new items first
for itemID in pairs(TSM.db.factionrealm.appData) do for itemID in pairs(TSM.db.realm.appData) do
if not TSM.data[itemID] then if not TSM.data[itemID] then
TSM:DecodeItemData(itemID) TSM:DecodeItemData(itemID)
TSM:ProcessAppData(itemID) TSM:ProcessAppData(itemID)
@ -131,12 +131,12 @@ function TSM:LoadAuctionData()
end end
function TSM:ProcessAppData(itemID) function TSM:ProcessAppData(itemID)
if not TSM.db.factionrealm.appData[itemID] then return end if not TSM.db.realm.appData[itemID] then return end
TSM.data[itemID] = TSM.data[itemID] or {scans = {}, lastScan = 0} TSM.data[itemID] = TSM.data[itemID] or {scans = {}, lastScan = 0}
local dbData = TSM.data[itemID] local dbData = TSM.data[itemID]
local day = TSM.Data:GetDay() local day = TSM.Data:GetDay()
for _, appData in ipairs(TSM.db.factionrealm.appData[itemID]) do for _, appData in ipairs(TSM.db.realm.appData[itemID]) do
local marketValue, minBuyout, scanTime = appData.m, appData.b, appData.t local marketValue, minBuyout, scanTime = appData.m, appData.b, appData.t
if abs(day - TSM.Data:GetDay(scanTime)) <= TSM.MAX_AVG_DAY then if abs(day - TSM.Data:GetDay(scanTime)) <= TSM.MAX_AVG_DAY then
local dayScans = dbData.scans local dayScans = dbData.scans
@ -159,11 +159,12 @@ function TSM:ProcessAppData(itemID)
end end
end end
TSM.Data:UpdateMarketValue(dbData) TSM.Data:UpdateMarketValue(dbData)
TSM.db.factionrealm.appData[itemID] = nil TSM.db.realm.appData[itemID] = nil
end end
function TSM:OnEnable() function TSM:OnEnable()
local function DecodeJSON(data) local function DecodeJSON(data)
print(data)
data = gsub(data, ":", "=") data = gsub(data, ":", "=")
data = gsub(data, "\"horde\"", "horde") data = gsub(data, "\"horde\"", "horde")
data = gsub(data, "\"alliance\"", "alliance") data = gsub(data, "\"alliance\"", "alliance")
@ -193,7 +194,7 @@ function TSM:OnEnable()
r = strlower(r) r = strlower(r)
f = strlower(f) f = strlower(f)
local scanTime = tonumber(t) local scanTime = tonumber(t)
if realm == r and (faction == f or f == "both") and scanTime > TSM.db.factionrealm.appDataUpdate and abs(TSM.Data:GetDay() - TSM.Data:GetDay(scanTime)) <= TSM.MAX_AVG_DAY then if realm == r and (faction == f or f == "both") and scanTime > TSM.db.realm.appDataUpdate and abs(TSM.Data:GetDay() - TSM.Data:GetDay(scanTime)) <= TSM.MAX_AVG_DAY then
local importData = DecodeJSON(appScanData)[faction] local importData = DecodeJSON(appScanData)[faction]
if importData then if importData then
for itemID, data in pairs(importData) do for itemID, data in pairs(importData) do
@ -202,8 +203,8 @@ function TSM:OnEnable()
data.b = tonumber(data.b) data.b = tonumber(data.b)
data.t = scanTime data.t = scanTime
if itemID and data.m and data.b then if itemID and data.m and data.b then
TSM.db.factionrealm.appData[itemID] = TSM.db.factionrealm.appData[itemID] or {} TSM.db.realm.appData[itemID] = TSM.db.realm.appData[itemID] or {}
tinsert(TSM.db.factionrealm.appData[itemID], data) tinsert(TSM.db.realm.appData[itemID], data)
end end
end end
maxScanTime = max(maxScanTime, scanTime) maxScanTime = max(maxScanTime, scanTime)
@ -213,8 +214,8 @@ function TSM:OnEnable()
end end
if numNewScans > 0 then if numNewScans > 0 then
TSM.db.factionrealm.appDataUpdate = maxScanTime TSM.db.realm.appDataUpdate = maxScanTime
TSM.db.factionrealm.lastCompleteScan = TSM.db.factionrealm.appDataUpdate TSM.db.realm.lastCompleteScan = TSM.db.realm.appDataUpdate
TSM:Printf(L["Imported %s scans worth of new auction data!"], numNewScans) TSM:Printf(L["Imported %s scans worth of new auction data!"], numNewScans)
end end
@ -225,7 +226,7 @@ function TSM:OnEnable()
end end
function TSM:OnTSMDBShutdown() function TSM:OnTSMDBShutdown()
TSM.db.factionrealm.time = 0 TSM.db.realm.time = 0
TSM:Serialize(TSM.data) TSM:Serialize(TSM.data)
end end
@ -310,8 +311,8 @@ function TSM:Reset()
whileDead = true, whileDead = true,
hideOnEscape = true, hideOnEscape = true,
OnAccept = function() OnAccept = function()
TSM.db.factionrealm.lastCompleteScan = 0 TSM.db.realm.lastCompleteScan = 0
TSM.db.factionrealm.appDataUpdate = 0 TSM.db.realm.appDataUpdate = 0
for i in pairs(TSM.data) do for i in pairs(TSM.data) do
TSM.data[i] = nil TSM.data[i] = nil
end end
@ -456,7 +457,7 @@ function TSM:Serialize()
tinsert(results, "?" .. encode(itemID) .. "," .. data.encoded) tinsert(results, "?" .. encode(itemID) .. "," .. data.encoded)
end end
end end
TSM.db.factionrealm.scanData = table.concat(results) TSM.db.realm.scanData = table.concat(results)
end end
function TSM:Deserialize(data, resultTbl, fullyDecode) function TSM:Deserialize(data, resultTbl, fullyDecode)
@ -496,7 +497,7 @@ function TSM:GetLastCompleteScan()
local lastScan = {} local lastScan = {}
for itemID, data in pairs(TSM.data) do for itemID, data in pairs(TSM.data) do
TSM:DecodeItemData(itemID) TSM:DecodeItemData(itemID)
if data.lastScan == TSM.db.factionrealm.lastCompleteScan then if data.lastScan == TSM.db.realm.lastCompleteScan then
lastScan[itemID] = { marketValue = data.marketValue, minBuyout = data.minBuyout } lastScan[itemID] = { marketValue = data.marketValue, minBuyout = data.minBuyout }
end end
end end
@ -505,7 +506,7 @@ function TSM:GetLastCompleteScan()
end end
function TSM:GetLastCompleteScanTime() function TSM:GetLastCompleteScanTime()
return TSM.db.factionrealm.lastCompleteScan return TSM.db.realm.lastCompleteScan
end end
function TSM:GetScans(link) function TSM:GetScans(link)
@ -521,7 +522,7 @@ end
function TSM:GetOppositeFactionData() function TSM:GetOppositeFactionData()
local realm = GetRealmName() local realm = GetRealmName()
local faction = UnitFactionGroup("player") local faction = "Ascension" -- UnitFactionGroup("player")
if faction == "Horde" then if faction == "Horde" then
faction = "Alliance" faction = "Alliance"
elseif faction == "Alliance" then elseif faction == "Alliance" then
@ -530,7 +531,7 @@ function TSM:GetOppositeFactionData()
return return
end end
local data = TSM.db.sv.factionrealm[faction .. " - " .. realm] local data = TSM.db.sv.realm[faction .. " - " .. realm]
if not data or type(data.scanData) ~= "string" then return end if not data or type(data.scanData) ~= "string" then return end
local result = {} local result = {}

6
TradeSkillMaster_Auctioning/TradeSkillMaster_Auctioning.lua

@ -30,7 +30,7 @@ local savedDBDefaults = {
priceColumn = 1, priceColumn = 1,
tooltip = true, tooltip = true,
}, },
factionrealm = { realm = {
player = {}, player = {},
whitelist = {}, whitelist = {},
lastSoldFilter = 0, lastSoldFilter = 0,
@ -47,7 +47,7 @@ function TSM:OnInitialize()
end end
-- Add this character to the alt list so it's not undercut by the player -- Add this character to the alt list so it's not undercut by the player
TSM.db.factionrealm.player[UnitName("player")] = true TSM.db.realm.player[UnitName("player")] = true
-- register this module with TSM -- register this module with TSM
TSM:RegisterModule() TSM:RegisterModule()
@ -117,7 +117,7 @@ TSM.operationDefaults = {
matchStackSize = nil, matchStackSize = nil,
ignoreLowDuration = 0, ignoreLowDuration = 0,
ignorePlayer = {}, ignorePlayer = {},
ignoreFactionrealm = {}, ignorerealm = {},
relationships = {}, relationships = {},
-- post -- post
stackSize = 1, stackSize = 1,

14
TradeSkillMaster_Auctioning/modules/Options.lua

@ -226,19 +226,19 @@ function Options:DrawWhitelistSettings(container)
value = string.trim(strlower(value or "")) value = string.trim(strlower(value or ""))
if value == "" then return TSM:Print(L["No name entered."]) end if value == "" then return TSM:Print(L["No name entered."]) end
if TSM.db.factionrealm.whitelist[value] then if TSM.db.realm.whitelist[value] then
TSM:Printf(L["The player \"%s\" is already on your whitelist."], TSM.db.factionrealm.whitelist[value]) TSM:Printf(L["The player \"%s\" is already on your whitelist."], TSM.db.realm.whitelist[value])
return return
end end
for player in pairs(TSM.db.factionrealm.player) do for player in pairs(TSM.db.realm.player) do
if strlower(player) == value then if strlower(player) == value then
TSM:Printf(L["You do not need to add \"%s\", alts are whitelisted automatically."], player) TSM:Printf(L["You do not need to add \"%s\", alts are whitelisted automatically."], player)
return return
end end
end end
TSM.db.factionrealm.whitelist[strlower(value)] = value TSM.db.realm.whitelist[strlower(value)] = value
container:SelectByPath(2) container:SelectByPath(2)
end end
@ -292,11 +292,11 @@ function Options:DrawWhitelistSettings(container)
}, },
} }
for name in pairs(TSM.db.factionrealm.whitelist) do for name in pairs(TSM.db.realm.whitelist) do
tinsert(page[1].children[3].children, tinsert(page[1].children[3].children,
{ {
type = "Label", type = "Label",
text = TSM.db.factionrealm.whitelist[name], text = TSM.db.realm.whitelist[name],
fontObject = GameFontNormal, fontObject = GameFontNormal,
}) })
tinsert(page[1].children[3].children, tinsert(page[1].children[3].children,
@ -305,7 +305,7 @@ function Options:DrawWhitelistSettings(container)
text = L["Delete"], text = L["Delete"],
relativeWidth = 0.3, relativeWidth = 0.3,
callback = function(self) callback = function(self)
TSM.db.factionrealm.whitelist[name] = nil TSM.db.realm.whitelist[name] = nil
container:SelectByPath(2) container:SelectByPath(2)
end, end,
}) })

2
TradeSkillMaster_Auctioning/modules/ResetScan.lua

@ -524,7 +524,7 @@ function Reset:GetAuctionSTRow(record, index)
local function GetSellerText(name) local function GetSellerText(name)
if TSMAPI:IsPlayer(name) then if TSMAPI:IsPlayer(name) then
return "|cff99ffff" .. name .. "|r" return "|cff99ffff" .. name .. "|r"
elseif TSM.db.factionrealm.whitelist[strlower(name)] then elseif TSM.db.realm.whitelist[strlower(name)] then
return name .. " |cffff2222(" .. L["Whitelist"] .. ")|r" return name .. " |cffff2222(" .. L["Whitelist"] .. ")|r"
end end

8
TradeSkillMaster_Auctioning/modules/ScanUtil.lua

@ -89,7 +89,7 @@ function Scan:ProcessItem(itemString, auctionItem)
if not itemString or not auctionItem then return end if not itemString or not auctionItem then return end
auctionItem:SetRecordParams({"GetItemBuyout", "GetItemDisplayedBid", "seller", "count"}) auctionItem:SetRecordParams({"GetItemBuyout", "GetItemDisplayedBid", "seller", "count"})
auctionItem:PopulateCompactRecords() auctionItem:PopulateCompactRecords()
auctionItem:SetAlts(TSM.db.factionrealm.player) auctionItem:SetAlts(TSM.db.realm.player)
if #auctionItem.records > 0 then if #auctionItem.records > 0 then
auctionItem:SetMarketValue(TSMAPI:GetItemValue(itemString, "DBMarket")) auctionItem:SetMarketValue(TSMAPI:GetItemValue(itemString, "DBMarket"))
Scan.auctionData[itemString] = auctionItem Scan.auctionData[itemString] = auctionItem
@ -169,7 +169,7 @@ function Scan:GetLowestAuction(auctionItem, operation)
end end
end end
end end
if owner == "?" and next(TSM.db.factionrealm.whitelist) then if owner == "?" and next(TSM.db.realm.whitelist) then
invalidSellerEntry = true invalidSellerEntry = true
end end
@ -182,7 +182,7 @@ function Scan:GetLowestAuction(auctionItem, operation)
local recordBuyout = record:GetItemBuyout() local recordBuyout = record:GetItemBuyout()
if not record:IsPlayer() and recordBuyout and recordBuyout == buyout then if not record:IsPlayer() and recordBuyout and recordBuyout == buyout then
isPlayer = nil isPlayer = nil
if not TSM.db.factionrealm.whitelist[strlower(record.seller)] then if not TSM.db.realm.whitelist[strlower(record.seller)] then
isWhitelist = nil isWhitelist = nil
end end
@ -192,7 +192,7 @@ function Scan:GetLowestAuction(auctionItem, operation)
end end
end end
end end
if owner == "?" and next(TSM.db.factionrealm.whitelist) then if owner == "?" and next(TSM.db.realm.whitelist) then
invalidSellerEntry = true invalidSellerEntry = true
end end

32
TradeSkillMaster_Crafting/Modules/Cost.lua

@ -15,7 +15,7 @@ local L = LibStub("AceLocale-3.0"):GetLocale("TradeSkillMaster_Crafting") -- loa
local currentVisited = {} local currentVisited = {}
local cache = { time = 0 } local cache = { time = 0 }
function Cost:GetMatCost(itemString) function Cost:GetMatCost(itemString)
local mat = TSM.db.factionrealm.mats[itemString] local mat = TSM.db.realm.mats[itemString]
if not mat then return end if not mat then return end
if cache.time < (time() - 1) then if cache.time < (time() - 1) then
@ -37,8 +37,8 @@ end
function Cost:GetCraftValue(itemString) function Cost:GetCraftValue(itemString)
if type(itemString) == "number" then if type(itemString) == "number" then
-- we got passed a spell -- we got passed a spell
if not TSM.db.factionrealm.crafts[itemString] then return end if not TSM.db.realm.crafts[itemString] then return end
itemString = TSM.db.factionrealm.crafts[itemString].itemID itemString = TSM.db.realm.crafts[itemString].itemID
end end
if type(itemString) ~= "string" then return end if type(itemString) ~= "string" then return end
local operation = TSMAPI:GetItemOperation(itemString, "Crafting") local operation = TSMAPI:GetItemOperation(itemString, "Crafting")
@ -56,7 +56,7 @@ function Cost:GetCraftCost(itemID)
spellIDs = TSM.craftReverseLookup[TSMAPI:GetBaseItemstring(itemID)] spellIDs = TSM.craftReverseLookup[TSMAPI:GetBaseItemstring(itemID)]
elseif type(itemID) == "number" then elseif type(itemID) == "number" then
-- we got passed a spell -- we got passed a spell
if TSM.db.factionrealm.crafts[itemID] then if TSM.db.realm.crafts[itemID] then
spellIDs = { itemID } spellIDs = { itemID }
end end
end end
@ -64,20 +64,20 @@ function Cost:GetCraftCost(itemID)
local lowestCost local lowestCost
for _, spellID in ipairs(spellIDs) do for _, spellID in ipairs(spellIDs) do
local craft = TSM.db.factionrealm.crafts[spellID] local craft = TSM.db.realm.crafts[spellID]
local cost, costIsValid = 0, true local cost, costIsValid = 0, true
if #spellIDs >= 2 and TSM.db.global.ignoreCDCraftCost and TSM.db.factionrealm.crafts[spellID].hasCD then if #spellIDs >= 2 and TSM.db.global.ignoreCDCraftCost and TSM.db.realm.crafts[spellID].hasCD then
costIsValid = false costIsValid = false
end end
for matID, matQuantity in pairs(craft.mats) do for matID, matQuantity in pairs(craft.mats) do
local MatName = GetItemInfo(matID) local MatName = GetItemInfo(matID)
if MatName ~= nil and strfind(MatName, "Vellum") then -- if MatName ~= nil and strfind(MatName, "Vellum") then
local NewItemString = CheapestVellum(matID) -- local NewItemString = CheapestVellum(matID)
if matID ~= NewItemString then -- if matID ~= NewItemString then
matID = NewItemString -- matID = NewItemString
end -- end
end -- end
local matCost = Cost:GetMatCost(matID) local matCost = Cost:GetMatCost(matID)
if not matCost or matCost == 0 then if not matCost or matCost == 0 then
costIsValid = false costIsValid = false
@ -119,15 +119,15 @@ function Cost:GetLowestCraftPrices(itemString, intermediate)
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
for _, spellID in ipairs(spellIDs) do for _, spellID in ipairs(spellIDs) do
if TSM.db.factionrealm.crafts[spellID] then if TSM.db.realm.crafts[spellID] then
if intermediate and (TSM.db.factionrealm.crafts[spellID].mats[soh] or TSM.db.factionrealm.crafts[spellID].hasCD) then if intermediate and (TSM.db.realm.crafts[spellID].mats[soh] 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 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
if not TSM.db.global.ignoreCDCraftCost then if not TSM.db.global.ignoreCDCraftCost then
if TSM.db.factionrealm.crafts[spellID].hasCD then if TSM.db.realm.crafts[spellID].hasCD then
if TSMAPI.SOULBOUND_MATS[itemString] or #spellIDs == 1 then if TSMAPI.SOULBOUND_MATS[itemString] or #spellIDs == 1 then
lowestCost = cost lowestCost = cost
cheapestSpellID = spellID cheapestSpellID = spellID
@ -136,7 +136,7 @@ function Cost:GetLowestCraftPrices(itemString, intermediate)
lowestCost = cost lowestCost = cost
cheapestSpellID = spellID cheapestSpellID = spellID
end end
elseif not TSM.db.factionrealm.crafts[spellID].hasCD then elseif not TSM.db.realm.crafts[spellID].hasCD then
lowestCost = cost lowestCost = cost
cheapestSpellID = spellID cheapestSpellID = spellID
end end

265
TradeSkillMaster_Crafting/Modules/CraftingGUI.lua

@ -85,6 +85,7 @@ function GUI:OnEnable()
GUI:RegisterEvent("TRADE_SKILL_FILTER_UPDATE", "EventHandler") GUI:RegisterEvent("TRADE_SKILL_FILTER_UPDATE", "EventHandler")
GUI:RegisterEvent("UPDATE_TRADESKILL_RECAST", "EventHandler") GUI:RegisterEvent("UPDATE_TRADESKILL_RECAST", "EventHandler")
GUI:RegisterEvent("CHAT_MSG_SKILL", "EventHandler") GUI:RegisterEvent("CHAT_MSG_SKILL", "EventHandler")
GUI:RegisterEvent("UNIT_SPELLCAST_START", "EventHandler")
GUI:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED", "EventHandler") GUI:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED", "EventHandler")
GUI:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED", "EventHandler") GUI:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED", "EventHandler")
GUI:RegisterEvent("UNIT_SPELLCAST_FAILED", "EventHandler") GUI:RegisterEvent("UNIT_SPELLCAST_FAILED", "EventHandler")
@ -116,7 +117,7 @@ function GUI:OnEnable()
GUI:UpdateTradeSkills() GUI:UpdateTradeSkills()
GUI.gatheringFrame = GUI:CreateGatheringFrame() GUI.gatheringFrame = GUI:CreateGatheringFrame()
if next(TSM.db.factionrealm.gathering.neededMats) then if next(TSM.db.realm.gathering.neededMats) then
TSMAPI:CreateTimeDelay("gatheringShowThrottle", 0.3, GUI:ShowGatheringFrame()) TSMAPI:CreateTimeDelay("gatheringShowThrottle", 0.3, GUI:ShowGatheringFrame())
end end
end end
@ -203,7 +204,7 @@ end
function GUI:OpenFirstProfession() function GUI:OpenFirstProfession()
TSM.db.global.showingDefaultFrame = nil TSM.db.global.showingDefaultFrame = nil
local link local link
for playerName, professions in pairs(TSM.db.factionrealm.tradeSkills) do for playerName, professions in pairs(TSM.db.realm.tradeSkills) do
for _, data in pairs(professions) do for _, data in pairs(professions) do
link = data.link link = data.link
if link then break end if link then break end
@ -244,22 +245,25 @@ function GUI:EventHandler(event, ...)
GUI.frame.content.professionsTab.craftInfoFrame.buttonsFrame.inputBox:SetNumber(GetTradeskillRepeatCount()) GUI.frame.content.professionsTab.craftInfoFrame.buttonsFrame.inputBox:SetNumber(GetTradeskillRepeatCount())
elseif event == "CHAT_MSG_SKILL" and not IsTradeSkillLinked() then elseif event == "CHAT_MSG_SKILL" and not IsTradeSkillLinked() then
local skillName, level, maxLevel = GetTradeSkillLine() local skillName, level, maxLevel = GetTradeSkillLine()
if skillName and skillName ~= "UNKNOWN" and TSM.db.factionrealm.tradeSkills[UnitName("player")] and TSM.db.factionrealm.tradeSkills[UnitName("player")][skillName] then if skillName and skillName ~= "UNKNOWN" and TSM.db.realm.tradeSkills[UnitName("player")] and TSM.db.realm.tradeSkills[UnitName("player")][skillName] then
TSM.db.factionrealm.tradeSkills[UnitName("player")][skillName].level = level TSM.db.realm.tradeSkills[UnitName("player")][skillName].level = level
TSM.db.factionrealm.tradeSkills[UnitName("player")][skillName].maxLevel = maxLevel TSM.db.realm.tradeSkills[UnitName("player")][skillName].maxLevel = maxLevel
end end
elseif event == "UNIT_SPELLCAST_START" then
local unit = ...
if unit ~= "player" then return end
TSM.currentspell = UnitCastingSpellID("player")
elseif event == "UNIT_SPELLCAST_SUCCEEDED" then elseif event == "UNIT_SPELLCAST_SUCCEEDED" then
-- local unit, _, _, _, spellID = ... -- parameter ... doesn't provide spellID in 3.3.5a -- we only care about our spells
local unit, spellName = ... local unit = ...
local spellID = TSM.SpellName2ID[spellName] if unit ~= "player" then return end
-- if spell is not related to crafting, ignore
local craft = TSM.currentspell and TSM.db.realm.crafts[TSM.currentspell]
if not craft then return end
-- if spellID == nil then -- if spellID == nil then
-- TSM:Printf("Could not find spellID for %s", spellName) -- TSM:Printf("Could not find spellID for %s", spellName)
-- end -- end
local craft = spellID and TSM.db.factionrealm.crafts[spellID]
if unit ~= "player" or not craft then return end
-- decrements the number of this craft that are queued to be crafted -- decrements the number of this craft that are queued to be crafted
craft.queued = craft.queued - 1 craft.queued = craft.queued - 1
if GUI.isCrafting and GUI.isCrafting.quantity > 0 then if GUI.isCrafting and GUI.isCrafting.quantity > 0 then
@ -268,19 +272,17 @@ function GUI:EventHandler(event, ...)
--GUI:UpdateQueue() --GUI:UpdateQueue()
end end
end end
TSM.currentspell = nil
-- TSMAPI:CreateTimeDelay("craftingQueueUpdateThrottle", 0.2, GUI.UpdateQueue) -- TSMAPI:CreateTimeDelay("craftingQueueUpdateThrottle", 0.2, GUI.UpdateQueue)
elseif event == "UNIT_SPELLCAST_INTERRUPTED" or event == "UNIT_SPELLCAST_FAILED" or event == "UNIT_SPELLCAST_FAILED_QUIET" then elseif event == "UNIT_SPELLCAST_INTERRUPTED" or event == "UNIT_SPELLCAST_FAILED" or event == "UNIT_SPELLCAST_FAILED_QUIET" then
-- local unit, _, _, _, spellID = ... -- parameter ... doesn't provide spellID in 3.3.5a local unit = ...
local unit, spellName = ... if unit ~= "player" then return end
local spellID = TSM.SpellName2ID[spellName]
-- if spellID == nil then -- if spellID == nil then
-- TSM:Printf("Could not find spellID for %s", spellName) -- TSM:Printf("Could not find spellID for %s", spellName)
-- end -- end
if unit ~= "player" then return end if GUI.isCrafting and TSM.currentspell == GUI.isCrafting.spellID then
if GUI.isCrafting and spellID == GUI.isCrafting.spellID then
GUI.isCrafting.quantity = 0 GUI.isCrafting.quantity = 0
TSMAPI:CreateTimeDelay("craftingQueueUpdateThrottle", 0.2, GUI.UpdateQueue) TSMAPI:CreateTimeDelay("craftingQueueUpdateThrottle", 0.2, GUI.UpdateQueue)
end end
@ -308,7 +310,7 @@ function GUI:UpdateTradeSkills()
local skillName, header local skillName, header
local tradeSkill1, tradeSkill2, cook, firstAid local tradeSkill1, tradeSkill2, cook, firstAid
for i = 5, 8 do for i = 1, GetNumSkillLines() do
skillName = GetSkillLineInfo(i) skillName = GetSkillLineInfo(i)
if skillName == "Professions" then --TRADE_SKILLS ) then if skillName == "Professions" then --TRADE_SKILLS ) then
tradeSkill1, header = GetSkillLineInfo(i + 1); tradeSkill1, header = GetSkillLineInfo(i + 1);
@ -324,14 +326,7 @@ function GUI:UpdateTradeSkills()
else else
tradeSkill2=i+2 tradeSkill2=i+2
end end
break elseif skillName == "Cooking" then
end
end
for i = 5, 10 do
skillName = GetSkillLineInfo(i)
if skillName == "Cooking" then
cook = i cook = i
elseif skillName == "First Aid" then elseif skillName == "First Aid" then
firstAid = i firstAid = i
@ -342,31 +337,31 @@ function GUI:UpdateTradeSkills()
local playerName = UnitName("player") local playerName = UnitName("player")
if not playerName then return end if not playerName then return end
TSM.db.factionrealm.tradeSkills[playerName] = TSM.db.factionrealm.tradeSkills[playerName] or {} TSM.db.realm.tradeSkills[playerName] = TSM.db.realm.tradeSkills[playerName] or {}
-- SpellBook_UpdateProfTab() -- SpellBook_UpdateProfTab()
-- local tradeSkill1, tradeSkill2, _, _, cook, firstAid = GetProfessions() -- GetProfessions API added in Cata -- local tradeSkill1, tradeSkill2, _, _, cook, firstAid = GetProfessions() -- GetProfessions API added in Cata
-- local btns = { PrimaryProfession1SpellButtonBottom, PrimaryProfession2SpellButtonBottom, SecondaryProfession3SpellButtonRight, SecondaryProfession4SpellButtonRight } -- local btns = { PrimaryProfession1SpellButtonBottom, PrimaryProfession2SpellButtonBottom, SecondaryProfession3SpellButtonRight, SecondaryProfession4SpellButtonRight }
local old = TSM.db.factionrealm.tradeSkills[playerName] local old = TSM.db.realm.tradeSkills[playerName]
--TSM.db.factionrealm.tradeSkills[playerName] = {} --TSM.db.realm.tradeSkills[playerName] = {}
-- for i, id in pairs({ "tradeSkill1", "tradeSkill2", "cook", "firstAid" }) do -- for i, id in pairs({ "tradeSkill1", "tradeSkill2", "cook", "firstAid" }) do
for i, id in pairs({ tradeSkill1, tradeSkill2, cook, firstAid }) do -- needs to be pairs since may not be continuous indices for i, id in pairs({ tradeSkill1, tradeSkill2, cook, firstAid }) do -- needs to be pairs since may not be continuous indices
-- if not btns[i]:GetParent().missingHeader:IsVisible() then -- if not btns[i]:GetParent().missingHeader:IsVisible() then
-- local skillName, _, level, maxLevel = GetProfessionInfo(id) -- Also added in Cata -- local skillName, _, level, maxLevel = GetProfessionInfo(id) -- Also added in Cata
local skillName, _, _, skillRank, _, _, skillMaxRank = GetSkillLineInfo(id) local skillName, _, _, skillRank, _, _, skillMaxRank = GetSkillLineInfo(id)
if skillName ~= nil then if skillName ~= nil then
TSM.db.factionrealm.tradeSkills[playerName][skillName] = old[skillName] or {} TSM.db.realm.tradeSkills[playerName][skillName] = old[skillName] or {}
TSM.db.factionrealm.tradeSkills[playerName][skillName].level = skillRank TSM.db.realm.tradeSkills[playerName][skillName].level = skillRank
TSM.db.factionrealm.tradeSkills[playerName][skillName].maxLevel = skillMaxRank TSM.db.realm.tradeSkills[playerName][skillName].maxLevel = skillMaxRank
TSM.db.factionrealm.tradeSkills[playerName][skillName].isSecondary = (i > 2) and true TSM.db.realm.tradeSkills[playerName][skillName].isSecondary = (i > 2) and true
-- local spellBookSlot = btns[i]:GetID() + btns[i]:GetParent().spellOffset -- local spellBookSlot = btns[i]:GetID() + btns[i]:GetParent().spellOffset
local _, link = GetSpellLink(skillName) local _, link = GetSpellLink(skillName)
if link then if link then
TSM.db.factionrealm.tradeSkills[playerName][skillName].link = link TSM.db.realm.tradeSkills[playerName][skillName].link = link
if skillName == GetTradeSkillLine() and i <= 2 and not TSM.isSyncing then if skillName == GetTradeSkillLine() and i <= 2 and not TSM.isSyncing then
TSM.db.factionrealm.tradeSkills[playerName][skillName].account = nil TSM.db.realm.tradeSkills[playerName][skillName].account = nil
TSM.db.factionrealm.tradeSkills[playerName][skillName].accountKey = TSMAPI.Sync:GetAccountKey() TSM.db.realm.tradeSkills[playerName][skillName].accountKey = TSMAPI.Sync:GetAccountKey()
TSM.Sync:BroadcastTradeSkillData() TSM.Sync:BroadcastTradeSkillData()
end end
end end
@ -375,18 +370,18 @@ function GUI:UpdateTradeSkills()
end end
--tidy up crafts if player unlearned a profession --tidy up crafts if player unlearned a profession
for spellid, data in pairs(TSM.db.factionrealm.crafts) do for spellid, data in pairs(TSM.db.realm.crafts) do
for player in pairs(data.players) do for player in pairs(data.players) do
if not TSM.db.factionrealm.tradeSkills[player] or not TSM.db.factionrealm.tradeSkills[player][data.profession] then if not TSM.db.realm.tradeSkills[player] or not TSM.db.realm.tradeSkills[player][data.profession] then
TSM.db.factionrealm.crafts[spellid].players[player] = nil TSM.db.realm.crafts[spellid].players[player] = nil
end end
end end
end end
--remove craft if no players --remove craft if no players
for spellid, data in pairs(TSM.db.factionrealm.crafts) do for spellid, data in pairs(TSM.db.realm.crafts) do
if not next(data.players) then if not next(data.players) then
TSM.db.factionrealm.crafts[spellid] = nil TSM.db.realm.crafts[spellid] = nil
end end
end end
end end
@ -613,7 +608,7 @@ function GUI:CreateQueueFrame(parent)
GameTooltip:SetOwner(self, "ANCHOR_NONE") GameTooltip:SetOwner(self, "ANCHOR_NONE")
-- GameTooltip:SetPoint("LEFT", self, "RIGHT") -- GameTooltip:SetPoint("LEFT", self, "RIGHT")
GameTooltip:SetPoint("LEFT", self, "LEFT") GameTooltip:SetPoint("LEFT", self, "LEFT")
GameTooltip:AddLine(TSM.db.factionrealm.crafts[data.spellID].name .. " (x" .. data.numQueued .. ")") GameTooltip:AddLine(TSM.db.realm.crafts[data.spellID].name .. " (x" .. data.numQueued .. ")")
local cost = TSM.Cost:GetCraftPrices(data.spellID) local cost = TSM.Cost:GetCraftPrices(data.spellID)
if data.profit then if data.profit then
@ -665,8 +660,8 @@ function GUI:CreateQueueFrame(parent)
end end
end end
for itemID, matQuantity in pairs(TSM.db.factionrealm.crafts[data.spellID].mats) do for itemID, matQuantity in pairs(TSM.db.realm.crafts[data.spellID].mats) do
local name = TSMAPI:GetSafeItemInfo(itemID) or (TSM.db.factionrealm.mats[itemID] and TSM.db.factionrealm.mats[itemID].name) or "?" local name = TSMAPI:GetSafeItemInfo(itemID) or (TSM.db.realm.mats[itemID] and TSM.db.realm.mats[itemID].name) or "?"
local itemIDx = itemID local itemIDx = itemID
@ -675,19 +670,13 @@ function GUI:CreateQueueFrame(parent)
if strfind(name, "Vellum") then if strfind(name, "Vellum") then
velName = name velName = name
end end
if (velName ~= nil) and (not strfind(velName, "III")) then if (velName ~= nil) then
local VellumReplacePrice = TSM.Cost:GetMatCost(itemIDx) if strfind(velName, "Weapon") then
itemIDx = "item:52511:0:0:0:0:0:0"
if strfind(velName, "Weapon Vellum") then name = TSMAPI:GetSafeItemInfo(itemIDx)
if VellumReplacePrice > TSM.Cost:GetMatCost("item:43146:0:0:0:0:0:0") then
itemIDx = "item:43146:0:0:0:0:0:0"
name = TSMAPI:GetSafeItemInfo(itemIDx)
end
else else
if VellumReplacePrice > TSM.Cost:GetMatCost("item:43145:0:0:0:0:0:0") then itemIDx = "item:52510:0:0:0:0:0:0"
itemIDx = "item:43145:0:0:0:0:0:0" name = TSMAPI:GetSafeItemInfo(itemIDx)
name = TSMAPI:GetSafeItemInfo(itemIDx)
end
end end
end end
@ -716,9 +705,9 @@ function GUI:CreateQueueFrame(parent)
else else
if data.isTitle then if data.isTitle then
if data.stage then if data.stage then
TSM.db.factionrealm.queueStatus.collapsed[data.profession .. data.stage] = not TSM.db.factionrealm.queueStatus.collapsed[data.profession .. data.stage] TSM.db.realm.queueStatus.collapsed[data.profession .. data.stage] = not TSM.db.realm.queueStatus.collapsed[data.profession .. data.stage]
else else
TSM.db.factionrealm.queueStatus.collapsed[data.profession] = not TSM.db.factionrealm.queueStatus.collapsed[data.profession] TSM.db.realm.queueStatus.collapsed[data.profession] = not TSM.db.realm.queueStatus.collapsed[data.profession]
end end
GUI:UpdateQueue() GUI:UpdateQueue()
elseif data.index then elseif data.index then
@ -825,10 +814,10 @@ function GUI:CreateQueueFrame(parent)
GUI:UpdateGatherSelectionWindow() GUI:UpdateGatherSelectionWindow()
if GUI.gatheringFrame:IsShown() then if GUI.gatheringFrame:IsShown() then
GUI.gatheringFrame:Hide() GUI.gatheringFrame:Hide()
TSM.db.factionrealm.gathering.crafter = nil TSM.db.realm.gathering.crafter = nil
TSM.db.factionrealm.gathering.neededMats = {} TSM.db.realm.gathering.neededMats = {}
TSM.db.factionrealm.gathering.gatheredMats = false TSM.db.realm.gathering.gatheredMats = false
TSM.db.factionrealm.sourceStatus.collapsed = {} TSM.db.realm.sourceStatus.collapsed = {}
end end
end) end)
frame.clearBtn = btn frame.clearBtn = btn
@ -962,7 +951,7 @@ function GUI:CreateProfessionsTab(parent)
local player = UnitName("player") local player = UnitName("player")
local function UpdateProfession(self) local function UpdateProfession(self)
local list = {} local list = {}
for playerName, professionData in pairs(TSM.db.factionrealm.tradeSkills) do for playerName, professionData in pairs(TSM.db.realm.tradeSkills) do
for name, data in pairs(professionData) do for name, data in pairs(professionData) do
if not data.isSecondary and playerName == player then -- only display current player profs until blizz fix it if not data.isSecondary and playerName == player then -- only display current player profs until blizz fix it
list[playerName .. "~" .. name] = format("%s %d/%d - %s", name, data.level or "?", data.maxLevel or "?", playerName) list[playerName .. "~" .. name] = format("%s %d/%d - %s", name, data.level or "?", data.maxLevel or "?", playerName)
@ -993,7 +982,7 @@ function GUI:CreateProfessionsTab(parent)
CastSpellByName(profession) CastSpellByName(profession)
end end
else else
local link = TSM.db.factionrealm.tradeSkills[playerName][profession].link local link = TSM.db.realm.tradeSkills[playerName][profession].link
if not link then if not link then
TSM:Printf(L["Profession data not found for %s on %s. Logging into this player and opening the profession may solve this issue."], profession, playerName) TSM:Printf(L["Profession data not found for %s on %s. Logging into this player and opening the profession may solve this issue."], profession, playerName)
return OnValueChanged(_, _, currentSelection) return OnValueChanged(_, _, currentSelection)
@ -1199,7 +1188,7 @@ function GUI:CreateCraftInfoFrame(parent)
local function OnEnter(self) local function OnEnter(self)
if not frame.index then return end if not frame.index then return end
local spellID = TSM.Util:GetSpellID(frame.index) local spellID = TSM.Util:GetSpellID(frame.index)
local itemID = spellID and TSM.db.factionrealm.crafts[spellID] and TSM.db.factionrealm.crafts[spellID].itemID local itemID = spellID and TSM.db.realm.crafts[spellID] and TSM.db.realm.crafts[spellID].itemID
if itemID then if itemID then
GameTooltip:SetOwner(self, "ANCHOR_RIGHT") GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
TSMAPI:SafeTooltipLink(itemID) TSMAPI:SafeTooltipLink(itemID)
@ -1402,20 +1391,20 @@ function GUI:CreateCraftInfoFrame(parent)
queueBtn:RegisterForClicks("AnyUp") queueBtn:RegisterForClicks("AnyUp")
queueBtn:SetScript("OnClick", function(_, button) queueBtn:SetScript("OnClick", function(_, button)
local spellID = TSM.Util:GetSpellID(frame.index) local spellID = TSM.Util:GetSpellID(frame.index)
if not spellID or not TSM.db.factionrealm.crafts[spellID] then return end if not spellID or not TSM.db.realm.crafts[spellID] then return end
TSM.db.factionrealm.crafts[spellID].queued = max(TSM.db.factionrealm.crafts[spellID].queued, 0) TSM.db.realm.crafts[spellID].queued = max(TSM.db.realm.crafts[spellID].queued, 0)
if button == "LeftButton" then if button == "LeftButton" then
if IsModifiedClick() then if IsModifiedClick() then
TSM.db.factionrealm.crafts[spellID].queued = select(3, GetTradeSkillInfo(frame.index)) or 0 TSM.db.realm.crafts[spellID].queued = select(3, GetTradeSkillInfo(frame.index)) or 0
else else
TSM.db.factionrealm.crafts[spellID].queued = (TSM.db.factionrealm.crafts[spellID].queued or 0) + buttonsFrame.inputBox:GetNumber() TSM.db.realm.crafts[spellID].queued = (TSM.db.realm.crafts[spellID].queued or 0) + buttonsFrame.inputBox:GetNumber()
end end
elseif button == "RightButton" then elseif button == "RightButton" then
if IsModifiedClick() then if IsModifiedClick() then
TSM.db.factionrealm.crafts[spellID].queued = 0 TSM.db.realm.crafts[spellID].queued = 0
else else
TSM.db.factionrealm.crafts[spellID].queued = max((TSM.db.factionrealm.crafts[spellID].queued or 0) - buttonsFrame.inputBox:GetNumber(), 0) TSM.db.realm.crafts[spellID].queued = max((TSM.db.realm.crafts[spellID].queued or 0) - buttonsFrame.inputBox:GetNumber(), 0)
end end
end end
GUI:UpdateQueue() GUI:UpdateQueue()
@ -1455,7 +1444,7 @@ function GUI:CreateCraftInfoFrame(parent)
-- Enable display of items created -- Enable display of items created
local lNum, hNum = GetTradeSkillNumMade(skillIndex) local lNum, hNum = GetTradeSkillNumMade(skillIndex)
local numMade = floor(((lNum or 1) + (hNum or 1)) / 2) local numMade = floor(((lNum or 1) + (hNum or 1)) / 2)
if altVerb == ENSCRIBE then if altVerb ~= nil and strfind(name,"Enchant ") then
numMade = 1 numMade = 1
end end
if numMade > 1 then if numMade > 1 then
@ -1469,7 +1458,7 @@ function GUI:CreateCraftInfoFrame(parent)
-- The code below is heavily based on the code in Blizzard_TradeSkillUI.lua. -- The code below is heavily based on the code in Blizzard_TradeSkillUI.lua.
local toolsInfo = BuildColoredListString(GetTradeSkillTools(skillIndex)) local toolsInfo = BuildColoredListString(GetTradeSkillTools(skillIndex))
self.infoFrame.toolsText:SetText(toolsInfo and REQUIRES_LABEL .. " " .. toolsInfo or "") self.infoFrame.toolsText:SetText(toolsInfo and REQUIRES_LABEL .. " " .. toolsInfo or "")
local cooldown, isDayCooldown = GetTradeSkillCooldown(skillIndex) local cooldown = GetTradeSkillCooldown(skillIndex)
if not cooldown then if not cooldown then
self.infoFrame.cooldownText:SetText(""); self.infoFrame.cooldownText:SetText("");
elseif cooldown > 60 * 60 * 24 then --Cooldown is greater than 1 day. elseif cooldown > 60 * 60 * 24 then --Cooldown is greater than 1 day.
@ -1492,15 +1481,14 @@ function GUI:CreateCraftInfoFrame(parent)
end end
end end
if altVerb == ENSCRIBE then -- if altVerb == ENSCRIBE then
if altVerb ~= nil and strfind(name,"Enchant ") then
createAllBtn:SetText(L["Enchant Vellum"]) createAllBtn:SetText(L["Enchant Vellum"])
-- createAllBtn.vellum = TSMAPI:GetSafeItemInfo("item:38682:0:0:0:0:0:0")
if strfind(name, "Weapon") or strfind(name, "Staff") then if strfind(name, "Weapon") or strfind(name, "Staff") then
createAllBtn.vellum = TSMAPI:GetSafeItemInfo("item:43146:0:0:0:0:0:0") -- Weapon Vellum III createAllBtn.vellum = TSMAPI:GetSafeItemInfo("item:52511:0:0:0:0:0:0") -- Weapon Vellum
else else
createAllBtn.vellum = TSMAPI:GetSafeItemInfo("item:43145:0:0:0:0:0:0") -- Armor Vellum III createAllBtn.vellum = TSMAPI:GetSafeItemInfo("item:52510:0:0:0:0:0:0") -- Armor Vellum
end end
else else
createAllBtn:SetText(CREATE_ALL) createAllBtn:SetText(CREATE_ALL)
createAllBtn.vellum = nil createAllBtn.vellum = nil
@ -1535,8 +1523,8 @@ function GUI:CreateGroupsTab(parent)
RestockGroups = groupTree RestockGroups = groupTree
local function OnCreateBtnClick() local function OnCreateBtnClick()
if TSM.db.factionrealm.tradeSkills[UnitName("player")][GetTradeSkillLine()] then if TSM.db.realm.tradeSkills[UnitName("player")][GetTradeSkillLine()] then
TSM.db.factionrealm.tradeSkills[UnitName("player")][GetTradeSkillLine()].prompted = nil TSM.db.realm.tradeSkills[UnitName("player")][GetTradeSkillLine()].prompted = nil
end end
private.forceCreateGroups = true private.forceCreateGroups = true
TSM.Util:ScanCurrentProfession() TSM.Util:ScanCurrentProfession()
@ -1631,8 +1619,8 @@ function GUI:UpdateProfessionsTabST()
if not numAvailableAllCache[spellID] then if not numAvailableAllCache[spellID] then
local numAvailableAll = math.huge local numAvailableAll = math.huge
if spellID and TSM.db.factionrealm.crafts[spellID] then if spellID and TSM.db.realm.crafts[spellID] then
for itemString, quantity in pairs(TSM.db.factionrealm.crafts[spellID].mats) do for itemString, quantity in pairs(TSM.db.realm.crafts[spellID].mats) do
numAvailableAll = min(numAvailableAll, floor((inventoryTotals[itemString] or 0) / quantity)) numAvailableAll = min(numAvailableAll, floor((inventoryTotals[itemString] or 0) / quantity))
end end
end end
@ -1755,12 +1743,12 @@ function GUI:UpdateQueue()
for profession, crafts in pairs(queuedCrafts) do for profession, crafts in pairs(queuedCrafts) do
local professionColor, playerColor local professionColor, playerColor
local players = {} local players = {}
for player, data in pairs(TSM.db.factionrealm.tradeSkills) do for player, data in pairs(TSM.db.realm.tradeSkills) do
if data[profession] then if data[profession] then
tinsert(players, player) tinsert(players, player)
end end
end end
if TSM.db.factionrealm.tradeSkills[UnitName("player")][profession] then if TSM.db.realm.tradeSkills[UnitName("player")][profession] then
playerColor = "|cffffffff" playerColor = "|cffffffff"
if profession == currentProfession then if profession == currentProfession then
professionColor = "|cffffffff" professionColor = "|cffffffff"
@ -1772,7 +1760,7 @@ function GUI:UpdateQueue()
professionColor = "|cffff0000" professionColor = "|cffff0000"
end end
local professionCollapsed = TSM.db.factionrealm.queueStatus.collapsed[profession] local professionCollapsed = TSM.db.realm.queueStatus.collapsed[profession]
local row = { local row = {
cols = { cols = {
{ {
@ -1786,7 +1774,7 @@ function GUI:UpdateQueue()
if not professionCollapsed then if not professionCollapsed then
for _, stage in ipairs(crafts) do for _, stage in ipairs(crafts) do
local stageCollapsed = TSM.db.factionrealm.queueStatus.collapsed[profession .. stage.name] local stageCollapsed = TSM.db.realm.queueStatus.collapsed[profession .. stage.name]
local row = { local row = {
cols = { cols = {
{ {
@ -1809,7 +1797,7 @@ function GUI:UpdateQueue()
velName = GetItemInfo(TSM.VellumInfo[spellID]) velName = GetItemInfo(TSM.VellumInfo[spellID])
end end
for itemID, quantity in pairs(TSM.db.factionrealm.crafts[spellID].mats) do for itemID, quantity in pairs(TSM.db.realm.crafts[spellID].mats) do
local MatName = GetItemInfo(itemID) local MatName = GetItemInfo(itemID)
if MatName ~= nil and velName ~= nil and strfind(MatName, "Vellum") then if MatName ~= nil and velName ~= nil and strfind(MatName, "Vellum") then
@ -1824,12 +1812,6 @@ function GUI:UpdateQueue()
canCraft = min(canCraft, floor(numHave / quantity)) canCraft = min(canCraft, floor(numHave / quantity))
end end
-- local velName
-- local VELLUM_ID = "item:38682:0:0:0:0:0:0"
-- if TSM.db.factionrealm.crafts[spellID].mats[VELLUM_ID] then
-- velName = GetItemInfo(VELLUM_ID) or TSM.db.factionrealm.mats[VELLUM_ID].name
-- end
local color local color
local craftIndex = skillIndexLookup[spellID] local craftIndex = skillIndexLookup[spellID]
if canCraft >= numQueued then if canCraft >= numQueued then
@ -1857,7 +1839,7 @@ function GUI:UpdateQueue()
local extra = "" local extra = ""
if not craftIndex then if not craftIndex then
if TSM.db.factionrealm.crafts[spellID].players[UnitName("player")] and TSM.db.factionrealm.crafts[spellID].profession == currentProfession then if TSM.db.realm.crafts[spellID].players[UnitName("player")] and TSM.db.realm.crafts[spellID].profession == currentProfession then
extra = "|cffff0000[Filtered]|r " extra = "|cffff0000[Filtered]|r "
end end
end end
@ -1865,7 +1847,7 @@ function GUI:UpdateQueue()
local row = { local row = {
cols = { cols = {
{ {
value = " " .. extra .. color .. TSM.db.factionrealm.crafts[spellID].name .. " (x" .. numQueued .. ")" .. "|r", value = " " .. extra .. color .. TSM.db.realm.crafts[spellID].name .. " (x" .. numQueued .. ")" .. "|r",
}, },
}, },
spellID = spellID, spellID = spellID,
@ -1946,8 +1928,8 @@ function GUI:UpdateQueue()
local row = { local row = {
cols = { cols = {
{ {
value = color .. TSM.db.factionrealm.mats[itemString].name .. "|r", value = color .. TSM.db.realm.mats[itemString].name .. "|r",
args = { TSM.db.factionrealm.mats[itemString].name }, args = { TSM.db.realm.mats[itemString].name },
}, },
{ {
value = color .. need .. "|r", value = color .. need .. "|r",
@ -2035,7 +2017,7 @@ function GUI:CreatePromptFrame(parent)
yesBtn:SetScript("OnClick", function() yesBtn:SetScript("OnClick", function()
TSM:Printf(L["Created profession group for %s."], frame.profession) TSM:Printf(L["Created profession group for %s."], frame.profession)
TSMAPI:CreatePresetGroups(frame.presetGroupInfo) TSMAPI:CreatePresetGroups(frame.presetGroupInfo)
TSM.db.factionrealm.tradeSkills[UnitName("player")][frame.profession].prompted = true TSM.db.realm.tradeSkills[UnitName("player")][frame.profession].prompted = true
frame:Hide() frame:Hide()
GUI:UpdateProfessionsTabST() GUI:UpdateProfessionsTabST()
end) end)
@ -2055,7 +2037,7 @@ function GUI:CreatePromptFrame(parent)
noBtn:SetHeight(20) noBtn:SetHeight(20)
noBtn:SetText(L["No Thanks"]) noBtn:SetText(L["No Thanks"])
noBtn:SetScript("OnClick", function() noBtn:SetScript("OnClick", function()
TSM.db.factionrealm.tradeSkills[UnitName("player")][frame.profession].prompted = true TSM.db.realm.tradeSkills[UnitName("player")][frame.profession].prompted = true
frame:Hide() frame:Hide()
end) end)
frame.noBtn = noBtn frame.noBtn = noBtn
@ -2066,7 +2048,7 @@ end
function GUI:PromptPresetGroups(currentTradeSkill, presetGroupInfo) function GUI:PromptPresetGroups(currentTradeSkill, presetGroupInfo)
GUI:RestoreFilters() GUI:RestoreFilters()
if TSM.db.factionrealm.tradeSkills[UnitName("player")][currentTradeSkill] and not TSM.db.factionrealm.tradeSkills[UnitName("player")][currentTradeSkill].prompted then if TSM.db.realm.tradeSkills[UnitName("player")][currentTradeSkill] and not TSM.db.realm.tradeSkills[UnitName("player")][currentTradeSkill].prompted then
GUI.frame.prompt.profession = currentTradeSkill GUI.frame.prompt.profession = currentTradeSkill
GUI.frame.prompt.presetGroupInfo = presetGroupInfo GUI.frame.prompt.presetGroupInfo = presetGroupInfo
GUI.frame.prompt:Show() GUI.frame.prompt:Show()
@ -2148,7 +2130,7 @@ function GUI:UpdateGatherSelectionWindow()
local crafters = {} local crafters = {}
local numCrafters = 0 local numCrafters = 0
for profession, _ in pairs(queuedCrafts) do for profession, _ in pairs(queuedCrafts) do
for player, data in pairs(TSM.db.factionrealm.tradeSkills) do for player, data in pairs(TSM.db.realm.tradeSkills) do
if data[profession] then if data[profession] then
crafters[player] = player crafters[player] = player
numCrafters = numCrafters + 1 numCrafters = numCrafters + 1
@ -2174,7 +2156,7 @@ function GUI:UpdateGatherSelectionWindow()
local professions = {} local professions = {}
local numProfessions = 0 local numProfessions = 0
for profession, _ in pairs(queuedCrafts) do for profession, _ in pairs(queuedCrafts) do
if TSM.db.factionrealm.tradeSkills[private.gather.player][profession] then if TSM.db.realm.tradeSkills[private.gather.player][profession] then
professions[profession] = profession professions[profession] = profession
numProfessions = numProfessions + 1 numProfessions = numProfessions + 1
end end
@ -2289,9 +2271,9 @@ function GUI:CreateGatheringFrame()
local function OnCraftRowClicked(_, data) local function OnCraftRowClicked(_, data)
if data.isTitle then if data.isTitle then
if data.task then if data.task then
TSM.db.factionrealm.sourceStatus.collapsed[data.source .. data.task] = not TSM.db.factionrealm.sourceStatus.collapsed[data.source .. data.task] TSM.db.realm.sourceStatus.collapsed[data.source .. data.task] = not TSM.db.realm.sourceStatus.collapsed[data.source .. data.task]
else else
TSM.db.factionrealm.sourceStatus.collapsed[data.source] = not TSM.db.factionrealm.sourceStatus.collapsed[data.source] TSM.db.realm.sourceStatus.collapsed[data.source] = not TSM.db.realm.sourceStatus.collapsed[data.source]
end end
GUI:UpdateGathering() GUI:UpdateGathering()
end end
@ -2356,10 +2338,10 @@ function GUI:CreateGatheringFrame()
--checkbox:SetPoint("BOTTOMRIGHT", checkboxFrame, "BOTTOMRIGHT") --checkbox:SetPoint("BOTTOMRIGHT", checkboxFrame, "BOTTOMRIGHT")
checkbox1:SetHeight(18) checkbox1:SetHeight(18)
checkbox1:SetWidth(185) checkbox1:SetWidth(185)
checkbox1:SetValue(TSM.db.factionrealm.gathering.destroyDisable) checkbox1:SetValue(TSM.db.realm.gathering.destroyDisable)
checkbox1:SetLabel(L[" Disable Destroying Search"]) checkbox1:SetLabel(L[" Disable Destroying Search"])
checkbox1:SetCallback("OnValueChanged", function(_, _, value) checkbox1:SetCallback("OnValueChanged", function(_, _, value)
TSM.db.factionrealm.gathering.destroyDisable = value TSM.db.realm.gathering.destroyDisable = value
end) end)
local checkbox2 = TSMAPI.GUI:CreateCheckBox(checkboxFrame, L["If checked, the AH destroying search will only look for even stacks"]) local checkbox2 = TSMAPI.GUI:CreateCheckBox(checkboxFrame, L["If checked, the AH destroying search will only look for even stacks"])
@ -2368,10 +2350,10 @@ function GUI:CreateGatheringFrame()
--checkbox:SetPoint("BOTTOMRIGHT", checkboxFrame, "BOTTOMRIGHT") --checkbox:SetPoint("BOTTOMRIGHT", checkboxFrame, "BOTTOMRIGHT")
checkbox2:SetHeight(18) checkbox2:SetHeight(18)
checkbox2:SetWidth(100) checkbox2:SetWidth(100)
checkbox2:SetValue(TSM.db.factionrealm.gathering.evenStacks) checkbox2:SetValue(TSM.db.realm.gathering.evenStacks)
checkbox2:SetLabel(L["Even Stacks"]) checkbox2:SetLabel(L["Even Stacks"])
checkbox2:SetCallback("OnValueChanged", function(_, _, value) checkbox2:SetCallback("OnValueChanged", function(_, _, value)
TSM.db.factionrealm.gathering.evenStacks = value TSM.db.realm.gathering.evenStacks = value
end) end)
TSMAPI.Design:SetFrameColor(checkboxFrame) TSMAPI.Design:SetFrameColor(checkboxFrame)
@ -2384,11 +2366,11 @@ function GUI:CreateGatheringFrame()
btn:SetScript("OnClick", function() btn:SetScript("OnClick", function()
private.gather = {} private.gather = {}
GUI.gatheringFrame:Hide() GUI.gatheringFrame:Hide()
TSM.db.factionrealm.gathering.availableMats = {} TSM.db.realm.gathering.availableMats = {}
TSM.db.factionrealm.gathering.crafter = nil TSM.db.realm.gathering.crafter = nil
TSM.db.factionrealm.gathering.neededMats = {} TSM.db.realm.gathering.neededMats = {}
TSM.db.factionrealm.gathering.gatheredMats = false TSM.db.realm.gathering.gatheredMats = false
TSM.db.factionrealm.gathering.destroyingMats = {} TSM.db.realm.gathering.destroyingMats = {}
private.currentSource = nil private.currentSource = nil
end) end)
@ -2408,7 +2390,7 @@ end
function GUI:StartGathering() function GUI:StartGathering()
GUI.frame.gather:Hide() GUI.frame.gather:Hide()
TSM.db.factionrealm.gathering.gatheredMats = false TSM.db.realm.gathering.gatheredMats = false
local _, queuedMats = TSM.Queue:GetQueue() local _, queuedMats = TSM.Queue:GetQueue()
local neededMats = {} local neededMats = {}
@ -2423,9 +2405,9 @@ function GUI:StartGathering()
if not next(neededMats) then if not next(neededMats) then
TSM:Print(L["Nothing To Gather"]) TSM:Print(L["Nothing To Gather"])
else else
TSM.db.factionrealm.gathering.crafter = private.gather.player TSM.db.realm.gathering.crafter = private.gather.player
TSM.db.factionrealm.gathering.professions = private.gather.professions TSM.db.realm.gathering.professions = private.gather.professions
TSM.db.factionrealm.gathering.neededMats = neededMats TSM.db.realm.gathering.neededMats = neededMats
GUI.gatheringFrame:Show() GUI.gatheringFrame:Show()
GUI:UpdateGathering() GUI:UpdateGathering()
end end
@ -2434,13 +2416,13 @@ end
function GUI:UpdateGathering() function GUI:UpdateGathering()
if not GUI.gatheringFrame or not GUI.gatheringFrame:IsVisible() then return end if not GUI.gatheringFrame or not GUI.gatheringFrame:IsVisible() then return end
if not TSM.db.factionrealm.gathering.crafter or not next(TSM.db.factionrealm.gathering.neededMats) then return end if not TSM.db.realm.gathering.crafter or not next(TSM.db.realm.gathering.neededMats) then return end
-- recheck the craft queue and update neededMats -- recheck the craft queue and update neededMats
local _, queuedMats = TSM.Queue:GetQueue() local _, queuedMats = TSM.Queue:GetQueue()
local neededMats = {} local neededMats = {}
for profession, data in pairs(queuedMats) do for profession, data in pairs(queuedMats) do
if TSM.db.factionrealm.gathering.professions[profession] then if TSM.db.realm.gathering.professions[profession] then
for itemString, quantity in pairs(data) do for itemString, quantity in pairs(data) do
neededMats[itemString] = (neededMats[itemString] or 0) + quantity neededMats[itemString] = (neededMats[itemString] or 0) + quantity
end end
@ -2449,9 +2431,9 @@ function GUI:UpdateGathering()
local stData = {} local stData = {}
local sources = {} local sources = {}
local crafter = TSM.db.factionrealm.gathering.crafter local crafter = TSM.db.realm.gathering.crafter
local professionList = {} local professionList = {}
for profession in pairs(TSM.db.factionrealm.gathering.professions) do for profession in pairs(TSM.db.realm.gathering.professions) do
tinsert(professionList, profession) tinsert(professionList, profession)
end end
@ -2466,18 +2448,18 @@ function GUI:UpdateGathering()
end end
if not next(shortItems) then if not next(shortItems) then
GUI.gatheringFrame:Hide() GUI.gatheringFrame:Hide()
if TSM.db.factionrealm.gathering.gatheredMats == true then if TSM.db.realm.gathering.gatheredMats == true then
TSM:Print("Finished Gathering") TSM:Print("Finished Gathering")
TSM.db.factionrealm.gathering.gatheredMats = false TSM.db.realm.gathering.gatheredMats = false
TSM.db.factionrealm.gathering.crafter = nil TSM.db.realm.gathering.crafter = nil
TSM.db.factionrealm.gathering.neededMats = {} TSM.db.realm.gathering.neededMats = {}
TSM.db.factionrealm.gathering.gatheredMats = false TSM.db.realm.gathering.gatheredMats = false
TSM.db.factionrealm.sourceStatus.collapsed = {} TSM.db.realm.sourceStatus.collapsed = {}
TSM.db.factionrealm.gathering.destroyingMats = {} TSM.db.realm.gathering.destroyingMats = {}
end end
return return
else else
TSM.db.factionrealm.gathering.neededMats = CopyTable(neededMats) TSM.db.realm.gathering.neededMats = CopyTable(neededMats)
end end
sort(professionList) sort(professionList)
@ -2505,8 +2487,8 @@ function GUI:UpdateGathering()
local row = { local row = {
cols = { cols = {
{ {
value = color .. TSM.db.factionrealm.mats[itemString].name .. "|r", value = color .. TSM.db.realm.mats[itemString].name .. "|r",
args = { TSM.db.factionrealm.mats[itemString].name }, args = { TSM.db.realm.mats[itemString].name },
}, },
{ {
value = color .. need .. "|r", value = color .. need .. "|r",
@ -2519,7 +2501,7 @@ function GUI:UpdateGathering()
}, },
itemString = itemString, itemString = itemString,
order = order, order = order,
name = TSM.db.factionrealm.mats[itemString].name, name = TSM.db.realm.mats[itemString].name,
} }
tinsert(stData, row) tinsert(stData, row)
end end
@ -2548,7 +2530,7 @@ function GUI:UpdateGathering()
else else
color = "|cffffff00" color = "|cffffff00"
end end
local sourceCollapsed = TSM.db.factionrealm.sourceStatus.collapsed[source.sourceName] local sourceCollapsed = TSM.db.realm.sourceStatus.collapsed[source.sourceName]
local row = { local row = {
cols = { cols = {
{ {
@ -2562,7 +2544,7 @@ function GUI:UpdateGathering()
if not sourceCollapsed then if not sourceCollapsed then
for _, task in ipairs(source.tasks) do for _, task in ipairs(source.tasks) do
local tasksCollapsed = TSM.db.factionrealm.sourceStatus.collapsed[source.sourceName .. task.taskType] local tasksCollapsed = TSM.db.realm.sourceStatus.collapsed[source.sourceName .. task.taskType]
local row = { local row = {
cols = { cols = {
{ {
@ -2681,7 +2663,7 @@ function GUI:UpdateGathering()
end end
end end
-- store the available mats from source -- store the available mats from source
TSM.db.factionrealm.gathering.availableMats = CopyTable(availableMats) TSM.db.realm.gathering.availableMats = CopyTable(availableMats)
GUI.gatheringFrame.gatherButton:SetText(L["Gather Items"]) GUI.gatheringFrame.gatherButton:SetText(L["Gather Items"])
if next(stData) then if next(stData) then
@ -2753,7 +2735,7 @@ end
function CheapestVellum(itemPassed) function CheapestVellum(itemPassed)
-- Get Cheapest vellum, lower vellum types can be replaced by III -- Return one of the two vellum available
local MatName = GetItemInfo(itemPassed) local MatName = GetItemInfo(itemPassed)
-- MatName is sometimes nil ??? -- MatName is sometimes nil ???
if MatName ~= nil then if MatName ~= nil then
@ -2761,12 +2743,11 @@ function CheapestVellum(itemPassed)
if strfind(MatName, "Vellum") then if strfind(MatName, "Vellum") then
velName = MatName velName = MatName
end end
if (velName ~= nil) and (not strfind(velName, "III")) then if (velName ~= nil) then
local VellumReplacePrice = TSM.Cost:GetMatCost(itemPassed) or 0 if strfind(velName, "Weapon") then
if strfind(velName, "Weapon Vellum") then itemPassed = "item:52511:0:0:0:0:0:0"
if VellumReplacePrice > (TSM.Cost:GetMatCost("item:43146:0:0:0:0:0:0") or 0) then itemPassed = "item:43146:0:0:0:0:0:0" end
else else
if VellumReplacePrice > (TSM.Cost:GetMatCost("item:43145:0:0:0:0:0:0") or 0) then itemPassed = "item:43145:0:0:0:0:0:0" end itemPassed = "item:52510:0:0:0:0:0:0"
end end
end end
end end

624
TradeSkillMaster_Crafting/Modules/EnchantingInfo.lua

@ -14,7 +14,7 @@ TSM.enchantingName = GetSpellInfo(7411)
-- looks up the itemID of the scroll that the enchant makes -- looks up the itemID of the scroll that the enchant makes
-- index = spellID of the enchant -- index = spellID of the enchant
-- value = itemID of scroll -- value = itemID of scroll
TSM.enchantingItemIDs = { --TSM.enchantingItemIDs = {
-- -- MOP -- -- MOP
-- [110764] = 79061, -- Enchant Weapon - Pandamonium -- [110764] = 79061, -- Enchant Weapon - Pandamonium
-- [104338] = 74700, -- Enchant Bracer - Mastery -- [104338] = 74700, -- Enchant Bracer - Mastery
@ -341,263 +341,365 @@ TSM.enchantingItemIDs = {
-- [28003] = 38926, -- Enchant Weapon - Spellsurge -- [28003] = 38926, -- Enchant Weapon - Spellsurge
-- [28004] = 38927, -- Enchant Weapon - Battlemaster -- [28004] = 38927, -- Enchant Weapon - Battlemaster
[7418] = 38679, -- Scroll of Enchant Bracer - Minor Health -- High Risk Ascension Content
[7420] = 38766, -- Scroll of Enchant Chest - Minor Health -- [968676] = 967760, -- Enchant Weapon - Unstoppable Assault I
[7426] = 38767, -- Scroll of Enchant Chest - Minor Absorption -- [968677] = 967761, -- Enchant Weapon - Unstoppable Assault II
[7428] = 38768, -- Scroll of Enchant Bracer - Minor Deflection -- [968678] = 967762, -- Enchant Weapon - Unstoppable Assault III
[7443] = 38769, -- Scroll of Enchant Chest - Minor Mana -- [968679] = 967763, -- Enchant Weapon - Lucid Assault I
[7454] = 38770, -- Scroll of Enchant Cloak - Minor Resistance -- [968680] = 967764, -- Enchant Weapon - Lucid Assault II
[7457] = 38771, -- Scroll of Enchant Bracer - Minor Stamina -- [968681] = 967765, -- Enchant Weapon - Lucid Assault III
[7745] = 38772, -- Scroll of Enchant 2H Weapon - Minor Impact -- [968682] = 967766, -- Enchant Weapon - Spellbinder's Rage I
[7748] = 38773, -- Scroll of Enchant Chest - Lesser Health -- [968683] = 967767, -- Enchant Weapon - Spellbinder's Rage II
[7766] = 38774, -- Scroll of Enchant Bracer - Minor Spirit -- [968684] = 967768, -- Enchant Weapon - Spellbinder's Rage III
[7771] = 38775, -- Scroll of Enchant Cloak - Minor Protection -- [968685] = 967769, -- Enchant Weapon - Ninja's Focus I
[7776] = 38776, -- Scroll of Enchant Chest - Lesser Mana -- [968686] = 967770, -- Enchant Weapon - Ninja's Focus II
[7779] = 38777, -- Scroll of Enchant Bracer - Minor Agility -- [968687] = 967771, -- Enchant Weapon - Ninja's Focus III
[7782] = 38778, -- Scroll of Enchant Bracer - Minor Strength -- [968688] = 967772, -- Enchant Weapon - Grovewarden's Blessing I
[7786] = 38779, -- Scroll of Enchant Weapon - Minor Beastslayer -- [968689] = 967773, -- Enchant Weapon - Grovewarden's Blessing II
[7788] = 38780, -- Scroll of Enchant Weapon - Minor Striking -- [968690] = 967774, -- Enchant Weapon - Grovewarden's Blessing III
[7793] = 38781, -- Scroll of Enchant 2H Weapon - Lesser Intellect -- [968691] = 967775, -- Enchant Weapon - Viscious Assault I
[7857] = 38782, -- Scroll of Enchant Chest - Health -- [968692] = 967776, -- Enchant Weapon - Viscious Assault II
[7859] = 38783, -- Scroll of Enchant Bracer - Lesser Spirit -- [968693] = 967777, -- Enchant Weapon - Viscious Assault III
[7861] = 38784, -- Scroll of Enchant Cloak - Lesser Fire Resistance -- [968694] = 967778, -- Enchant Weapon - Arcane Dexterity I
[7863] = 38785, -- Scroll of Enchant Boots - Minor Stamina -- [968695] = 967779, -- Enchant Weapon - Arcane Dexterity II
[7867] = 38786, -- Scroll of Enchant Boots - Minor Agility -- [968696] = 967780, -- Enchant Weapon - Arcane Dexterity III
[13378] = 38787, -- Scroll of Enchant Shield - Minor Stamina -- [968697] = 967781, -- Enchant Weapon - Arcane Artillery I
[13380] = 38788, -- Scroll of Enchant 2H Weapon - Lesser Spirit -- [968698] = 967782, -- Enchant Weapon - Arcane Artillery II
[13419] = 38789, -- Scroll of Enchant Cloak - Minor Agility -- [968699] = 967783, -- Enchant Weapon - Arcane Artillery III
[13421] = 38790, -- Scroll of Enchant Cloak - Lesser Protection -- [968700] = 967784, -- Enchant Weapon - Arcane Precision I
[13464] = 38791, -- Scroll of Enchant Shield - Lesser Protection -- [968701] = 967785, -- Enchant Weapon - Arcane Precision II
[13485] = 38792, -- Scroll of Enchant Shield - Lesser Spirit -- [968702] = 967786, -- Enchant Weapon - Arcane Precision III
[13501] = 38793, -- Scroll of Enchant Bracer - Lesser Stamina -- [968770] = 967787, -- Enchant Weapon - Crusader II
[13503] = 38794, -- Scroll of Enchant Weapon - Lesser Striking -- [968771] = 967788, -- Enchant Weapon - Crusader III
[13522] = 38795, -- Scroll of Enchant Cloak - Lesser Shadow Resistance -- [1968677] = 1204125, -- Enchant Weapon - Void Assault
[13529] = 38796, -- Scroll of Enchant 2H Weapon - Lesser Impact -- [1968678] = 1204126, -- Enchant Weapon - Overpowering Void Assault
[13536] = 38797, -- Scroll of Enchant Bracer - Lesser Strength -- [1968680] = 1204127, -- Enchant Weapon - Dread Assault
[13538] = 38798, -- Scroll of Enchant Chest - Lesser Absorption -- [1968681] = 1204128, -- Enchant Weapon - Overpowering Dread Assault
[13607] = 38799, -- Scroll of Enchant Chest - Mana -- [1968683] = 1204129, -- Enchant Weapon - Twisted Evoker
[13612] = 38800, -- Scroll of Enchant Gloves - Mining -- [1968684] = 1204130, -- Enchant Weapon - Overpowering Twisted Evoker
[13617] = 38801, -- Scroll of Enchant Gloves - Herbalism -- [1968686] = 1204131, -- Enchant Weapon - Twisted Assault
[13620] = 38802, -- Scroll of Enchant Gloves - Fishing -- [1968687] = 1204132, -- Enchant Weapon - Overpowering Twisted Assault
[13622] = 38803, -- Scroll of Enchant Bracer - Lesser Intellect -- [1968689] = 1204133, -- Enchant Weapon - Twisted Channeler
[13626] = 38804, -- Scroll of Enchant Chest - Minor Stats -- [1968690] = 1204134, -- Enchant Weapon - Overpowering Twisted Channeler
[13631] = 38805, -- Scroll of Enchant Shield - Lesser Stamina -- [1968692] = 1204135, -- Enchant Weapon - Dread Omen Strikes
[13635] = 38806, -- Scroll of Enchant Cloak - Defense -- [1968693] = 1204136, -- Enchant Weapon - Overpowering Dread Omen Strikes
[13637] = 38807, -- Scroll of Enchant Boots - Lesser Agility -- [1968695] = 1204137, -- Enchant Weapon - Void Flows
[13640] = 38808, -- Scroll of Enchant Chest - Greater Health -- [1968696] = 1204138, -- Enchant Weapon - Overpowering Void Flows
[13642] = 38809, -- Scroll of Enchant Bracer - Spirit -- [1968698] = 1204139, -- Enchant Weapon - Void Blasting
[13644] = 38810, -- Scroll of Enchant Boots - Lesser Stamina -- [1968699] = 1204140, -- Enchant Weapon - Overpowering Void Blasting
[13646] = 38811, -- Scroll of Enchant Bracer - Lesser Deflection -- [1968701] = 1204141, -- Enchant Weapon - Dread Precision
[13648] = 38812, -- Scroll of Enchant Bracer - Stamina -- [1968702] = 1204142, -- Enchant Weapon - Overpowering Dread Precision
[13653] = 38813, -- Scroll of Enchant Weapon - Lesser Beastslayer -- [1968770] = 1204143, -- Enchant Weapon - Twisted Crusader
[13655] = 38814, -- Scroll of Enchant Weapon - Lesser Elemental Slayer -- [1968771] = 1204144, -- Enchant Weapon - Overpowering Twisted Crusader
[13657] = 38815, -- Scroll of Enchant Cloak - Fire Resistance
[13659] = 38816, -- Scroll of Enchant Shield - Spirit TSM.enchantingItemIDs = {
[13661] = 38817, -- Scroll of Enchant Bracer - Strength [7418] = 38679, -- Scroll of Enchant Bracer - Minor Health
[13663] = 38818, -- Scroll of Enchant Chest - Greater Mana [7420] = 38766, -- Scroll of Enchant Chest - Minor Health
[13687] = 38819, -- Scroll of Enchant Boots - Lesser Spirit [7426] = 38767, -- Scroll of Enchant Chest - Minor Absorption
[13689] = 38820, -- Scroll of Enchant Shield - Lesser Block [7428] = 38768, -- Scroll of Enchant Bracer - Minor Deflection
[13693] = 38821, -- Scroll of Enchant Weapon - Striking [7443] = 38769, -- Scroll of Enchant Chest - Minor Mana
[13695] = 38822, -- Scroll of Enchant 2H Weapon - Impact [7454] = 38770, -- Scroll of Enchant Cloak - Minor Resistance
[13698] = 38823, -- Scroll of Enchant Gloves - Skinning [7457] = 38771, -- Scroll of Enchant Bracer - Minor Stamina
[13700] = 38824, -- Scroll of Enchant Chest - Lesser Stats [7745] = 38772, -- Scroll of Enchant 2H Weapon - Minor Impact
[13746] = 38825, -- Scroll of Enchant Cloak - Greater Defense [7748] = 38773, -- Scroll of Enchant Chest - Lesser Health
[13794] = 38826, -- Scroll of Enchant Cloak - Resistance [7766] = 38774, -- Scroll of Enchant Bracer - Minor Spirit
[13815] = 38827, -- Scroll of Enchant Gloves - Agility [7771] = 38775, -- Scroll of Enchant Cloak - Minor Protection
[13817] = 38828, -- Scroll of Enchant Shield - Stamina [7776] = 38776, -- Scroll of Enchant Chest - Lesser Mana
[13822] = 38829, -- Scroll of Enchant Bracer - Intellect [7779] = 38777, -- Scroll of Enchant Bracer - Minor Agility
[13836] = 38830, -- Scroll of Enchant Boots - Stamina [7782] = 38778, -- Scroll of Enchant Bracer - Minor Strength
[13841] = 38831, -- Scroll of Enchant Gloves - Advanced Mining [7786] = 38779, -- Scroll of Enchant Weapon - Minor Beastslayer
[13846] = 38832, -- Scroll of Enchant Bracer - Greater Spirit [7788] = 38780, -- Scroll of Enchant Weapon - Minor Striking
[13858] = 38833, -- Scroll of Enchant Chest - Superior Health [7793] = 38781, -- Scroll of Enchant 2H Weapon - Lesser Intellect
[13868] = 38834, -- Scroll of Enchant Gloves - Advanced Herbalism [7857] = 38782, -- Scroll of Enchant Chest - Health
[13882] = 38835, -- Scroll of Enchant Cloak - Lesser Agility [7859] = 38783, -- Scroll of Enchant Bracer - Lesser Spirit
[13887] = 38836, -- Scroll of Enchant Gloves - Strength [7861] = 38784, -- Scroll of Enchant Cloak - Lesser Fire Resistance
[13890] = 38837, -- Scroll of Enchant Boots - Minor Speed [7863] = 38785, -- Scroll of Enchant Boots - Minor Stamina
[13898] = 38838, -- Scroll of Enchant Weapon - Fiery Weapon [7867] = 38786, -- Scroll of Enchant Boots - Minor Agility
[13905] = 38839, -- Scroll of Enchant Shield - Greater Spirit [13378] = 38787, -- Scroll of Enchant Shield - Minor Stamina
[13915] = 38840, -- Scroll of Enchant Weapon - Demonslaying [13380] = 38788, -- Scroll of Enchant 2H Weapon - Lesser Spirit
[13917] = 38841, -- Scroll of Enchant Chest - Superior Mana [13419] = 38789, -- Scroll of Enchant Cloak - Minor Agility
[13931] = 38842, -- Scroll of Enchant Bracer - Deflection [13421] = 38790, -- Scroll of Enchant Cloak - Lesser Protection
[13933] = 38843, -- Scroll of Enchant Shield - Frost Resistance [13464] = 38791, -- Scroll of Enchant Shield - Lesser Protection
[13935] = 38844, -- Scroll of Enchant Boots - Agility [13485] = 38792, -- Scroll of Enchant Shield - Lesser Spirit
[13937] = 38845, -- Scroll of Enchant 2H Weapon - Greater Impact [13501] = 38793, -- Scroll of Enchant Bracer - Lesser Stamina
[13939] = 38846, -- Scroll of Enchant Bracer - Greater Strength [13503] = 38794, -- Scroll of Enchant Weapon - Lesser Striking
[13941] = 38847, -- Scroll of Enchant Chest - Stats [13522] = 38795, -- Scroll of Enchant Cloak - Lesser Shadow Resistance
[13943] = 38848, -- Scroll of Enchant Weapon - Greater Striking [13529] = 38796, -- Scroll of Enchant 2H Weapon - Lesser Impact
[13945] = 38849, -- Scroll of Enchant Bracer - Greater Stamina [13536] = 38797, -- Scroll of Enchant Bracer - Lesser Strength
[13947] = 38850, -- Scroll of Enchant Gloves - Riding Skill [13538] = 38798, -- Scroll of Enchant Chest - Lesser Absorption
[13948] = 38851, -- Scroll of Enchant Gloves - Minor Haste [13607] = 38799, -- Scroll of Enchant Chest - Mana
[20008] = 38852, -- Scroll of Enchant Bracer - Greater Intellect [13612] = 38800, -- Scroll of Enchant Gloves - Mining
[20009] = 38853, -- Scroll of Enchant Bracer - Superior Spirit [13617] = 38801, -- Scroll of Enchant Gloves - Herbalism
[20010] = 38854, -- Scroll of Enchant Bracer - Superior Strength [13620] = 38802, -- Scroll of Enchant Gloves - Fishing
[20011] = 38855, -- Scroll of Enchant Bracer - Superior Stamina [13622] = 38803, -- Scroll of Enchant Bracer - Lesser Intellect
[20012] = 38856, -- Scroll of Enchant Gloves - Greater Agility [13626] = 38804, -- Scroll of Enchant Chest - Minor Stats
[20013] = 38857, -- Scroll of Enchant Gloves - Greater Strength [13631] = 38805, -- Scroll of Enchant Shield - Lesser Stamina
[20014] = 38858, -- Scroll of Enchant Cloak - Greater Resistance [13635] = 38806, -- Scroll of Enchant Cloak - Defense
[20015] = 38859, -- Scroll of Enchant Cloak - Superior Defense [13637] = 38807, -- Scroll of Enchant Boots - Lesser Agility
[20016] = 38860, -- Scroll of Enchant Shield - Vitality [13640] = 38808, -- Scroll of Enchant Chest - Greater Health
[20017] = 38861, -- Scroll of Enchant Shield - Greater Stamina [13642] = 38809, -- Scroll of Enchant Bracer - Spirit
[20020] = 38862, -- Scroll of Enchant Boots - Greater Stamina [13644] = 38810, -- Scroll of Enchant Boots - Lesser Stamina
[20023] = 38863, -- Scroll of Enchant Boots - Greater Agility [13646] = 38811, -- Scroll of Enchant Bracer - Lesser Deflection
[20024] = 38864, -- Scroll of Enchant Boots - Spirit [13648] = 38812, -- Scroll of Enchant Bracer - Stamina
[20025] = 38865, -- Scroll of Enchant Chest - Greater Stats [13653] = 38813, -- Scroll of Enchant Weapon - Lesser Beastslayer
[20026] = 38866, -- Scroll of Enchant Chest - Major Health [13655] = 38814, -- Scroll of Enchant Weapon - Lesser Elemental Slayer
[20028] = 38867, -- Scroll of Enchant Chest - Major Mana [13657] = 38815, -- Scroll of Enchant Cloak - Fire Resistance
[20029] = 38868, -- Scroll of Enchant Weapon - Icy Chill [13659] = 38816, -- Scroll of Enchant Shield - Spirit
[20030] = 38869, -- Scroll of Enchant 2H Weapon - Superior Impact [13661] = 38817, -- Scroll of Enchant Bracer - Strength
[20031] = 38870, -- Scroll of Enchant Weapon - Superior Striking [13663] = 38818, -- Scroll of Enchant Chest - Greater Mana
[20032] = 38871, -- Scroll of Enchant Weapon - Lifestealing [13687] = 38819, -- Scroll of Enchant Boots - Lesser Spirit
[20033] = 38872, -- Scroll of Enchant Weapon - Unholy Weapon [13689] = 38820, -- Scroll of Enchant Shield - Lesser Block
[20034] = 38873, -- Scroll of Enchant Weapon - Crusader [13693] = 38821, -- Scroll of Enchant Weapon - Striking
[20035] = 38874, -- Scroll of Enchant 2H Weapon - Major Spirit [13695] = 38822, -- Scroll of Enchant 2H Weapon - Impact
[20036] = 38875, -- Scroll of Enchant 2H Weapon - Major Intellect [13698] = 38823, -- Scroll of Enchant Gloves - Skinning
[21931] = 38876, -- Scroll of Enchant Weapon - Winter's Might [13700] = 38824, -- Scroll of Enchant Chest - Lesser Stats
[22749] = 38877, -- Scroll of Enchant Weapon - Spellpower [13746] = 38825, -- Scroll of Enchant Cloak - Greater Defense
[22750] = 38878, -- Scroll of Enchant Weapon - Healing Power [13794] = 38826, -- Scroll of Enchant Cloak - Resistance
[23799] = 38879, -- Scroll of Enchant Weapon - Strength [13815] = 38827, -- Scroll of Enchant Gloves - Agility
[23800] = 38880, -- Scroll of Enchant Weapon - Agility [13817] = 38828, -- Scroll of Enchant Shield - Stamina
[23801] = 38881, -- Scroll of Enchant Bracer - Mana Regeneration [13822] = 38829, -- Scroll of Enchant Bracer - Intellect
[23802] = 38882, -- Scroll of Enchant Bracer - Healing Power [13836] = 38830, -- Scroll of Enchant Boots - Stamina
[23803] = 38883, -- Scroll of Enchant Weapon - Mighty Spirit [13841] = 38831, -- Scroll of Enchant Gloves - Advanced Mining
[23804] = 38884, -- Scroll of Enchant Weapon - Mighty Intellect [13846] = 38832, -- Scroll of Enchant Bracer - Greater Spirit
[25072] = 38885, -- Scroll of Enchant Gloves - Threat [13858] = 38833, -- Scroll of Enchant Chest - Superior Health
[25073] = 38886, -- Scroll of Enchant Gloves - Shadow Power [13868] = 38834, -- Scroll of Enchant Gloves - Advanced Herbalism
[25074] = 38887, -- Scroll of Enchant Gloves - Frost Power [13882] = 38835, -- Scroll of Enchant Cloak - Lesser Agility
[25078] = 38888, -- Scroll of Enchant Gloves - Fire Power [13887] = 38836, -- Scroll of Enchant Gloves - Strength
[25079] = 38889, -- Scroll of Enchant Gloves - Healing Power [13890] = 38837, -- Scroll of Enchant Boots - Minor Speed
[25080] = 38890, -- Scroll of Enchant Gloves - Superior Agility [13898] = 38838, -- Scroll of Enchant Weapon - Fiery Weapon
[25081] = 38891, -- Scroll of Enchant Cloak - Greater Fire Resistance [13905] = 38839, -- Scroll of Enchant Shield - Greater Spirit
[25082] = 38892, -- Scroll of Enchant Cloak - Greater Nature Resistance [13915] = 38840, -- Scroll of Enchant Weapon - Demonslaying
[25083] = 38893, -- Scroll of Enchant Cloak - Stealth [13917] = 38841, -- Scroll of Enchant Chest - Superior Mana
[25084] = 38894, -- Scroll of Enchant Cloak - Subtlety [13931] = 38842, -- Scroll of Enchant Bracer - Deflection
[25086] = 38895, -- Scroll of Enchant Cloak - Dodge [13933] = 38843, -- Scroll of Enchant Shield - Frost Resistance
[27837] = 38896, -- Scroll of Enchant 2H Weapon - Agility [13935] = 38844, -- Scroll of Enchant Boots - Agility
[27899] = 38897, -- Scroll of Enchant Bracer - Brawn [13937] = 38845, -- Scroll of Enchant 2H Weapon - Greater Impact
[27905] = 38898, -- Scroll of Enchant Bracer - Stats [13939] = 38846, -- Scroll of Enchant Bracer - Greater Strength
[27906] = 38899, -- Scroll of Enchant Bracer - Major Defense [13941] = 38847, -- Scroll of Enchant Chest - Stats
[27911] = 38900, -- Scroll of Enchant Bracer - Superior Healing [13943] = 38848, -- Scroll of Enchant Weapon - Greater Striking
[27913] = 38901, -- Scroll of Enchant Bracer - Restore Mana Prime [13945] = 38849, -- Scroll of Enchant Bracer - Greater Stamina
[27914] = 38902, -- Scroll of Enchant Bracer - Fortitude [13947] = 38850, -- Scroll of Enchant Gloves - Riding Skill
[27917] = 38903, -- Scroll of Enchant Bracer - Spellpower [13948] = 38851, -- Scroll of Enchant Gloves - Minor Haste
[27944] = 38904, -- Scroll of Enchant Shield - Tough Shield [20008] = 38852, -- Scroll of Enchant Bracer - Greater Intellect
[27945] = 38905, -- Scroll of Enchant Shield - Intellect [20009] = 38853, -- Scroll of Enchant Bracer - Superior Spirit
[27946] = 38906, -- Scroll of Enchant Shield - Shield Block [20010] = 38854, -- Scroll of Enchant Bracer - Superior Strength
[27947] = 38907, -- Scroll of Enchant Shield - Resistance [20011] = 38855, -- Scroll of Enchant Bracer - Superior Stamina
[27948] = 38908, -- Scroll of Enchant Boots - Vitality [20012] = 38856, -- Scroll of Enchant Gloves - Greater Agility
[27950] = 38909, -- Scroll of Enchant Boots - Fortitude [20013] = 38857, -- Scroll of Enchant Gloves - Greater Strength
[27951] = 37603, -- Scroll of Enchant Boots - Dexterity [20014] = 38858, -- Scroll of Enchant Cloak - Greater Resistance
[27954] = 38910, -- Scroll of Enchant Boots - Surefooted [20015] = 38859, -- Scroll of Enchant Cloak - Superior Defense
[27957] = 38911, -- Scroll of Enchant Chest - Exceptional Health [20016] = 38860, -- Scroll of Enchant Shield - Vitality
[27958] = 38912, -- Scroll of Enchant Chest - Exceptional Mana [20017] = 38861, -- Scroll of Enchant Shield - Greater Stamina
[27960] = 38913, -- Scroll of Enchant Chest - Exceptional Stats [20020] = 38862, -- Scroll of Enchant Boots - Greater Stamina
[27961] = 38914, -- Scroll of Enchant Cloak - Major Armor [20023] = 38863, -- Scroll of Enchant Boots - Greater Agility
[27962] = 38915, -- Scroll of Enchant Cloak - Major Resistance [20024] = 38864, -- Scroll of Enchant Boots - Spirit
[27967] = 38917, -- Scroll of Enchant Weapon - Major Striking [20025] = 38865, -- Scroll of Enchant Chest - Greater Stats
[27968] = 38918, -- Scroll of Enchant Weapon - Major Intellect [20026] = 38866, -- Scroll of Enchant Chest - Major Health
[27971] = 38919, -- Scroll of Enchant 2H Weapon - Savagery [20028] = 38867, -- Scroll of Enchant Chest - Major Mana
[27972] = 38920, -- Scroll of Enchant Weapon - Potency [20029] = 38868, -- Scroll of Enchant Weapon - Icy Chill
[27975] = 38921, -- Scroll of Enchant Weapon - Major Spellpower [20030] = 38869, -- Scroll of Enchant 2H Weapon - Superior Impact
[27977] = 38922, -- Scroll of Enchant 2H Weapon - Major Agility [20031] = 38870, -- Scroll of Enchant Weapon - Superior Striking
[27981] = 38923, -- Scroll of Enchant Weapon - Sunfire [20032] = 38871, -- Scroll of Enchant Weapon - Lifestealing
[27982] = 38924, -- Scroll of Enchant Weapon - Soulfrost [20033] = 38872, -- Scroll of Enchant Weapon - Unholy Weapon
[27984] = 38925, -- Scroll of Enchant Weapon - Mongoose [20034] = 38873, -- Scroll of Enchant Weapon - Crusader
[28003] = 38926, -- Scroll of Enchant Weapon - Spellsurge [20035] = 38874, -- Scroll of Enchant 2H Weapon - Major Spirit
[28004] = 38927, -- Scroll of Enchant Weapon - Battlemaster [20036] = 38875, -- Scroll of Enchant 2H Weapon - Major Intellect
[33990] = 38928, -- Scroll of Enchant Chest - Major Spirit [21931] = 38876, -- Scroll of Enchant Weapon - Winter's Might
[33991] = 38929, -- Scroll of Enchant Chest - Restore Mana Prime [22749] = 38877, -- Scroll of Enchant Weapon - Spellpower
[33992] = 38930, -- Scroll of Enchant Chest - Major Resilience [22750] = 38878, -- Scroll of Enchant Weapon - Healing Power
[33993] = 38931, -- Scroll of Enchant Gloves - Blasting [23799] = 38879, -- Scroll of Enchant Weapon - Strength
[33994] = 38932, -- Scroll of Enchant Gloves - Precise Strikes [23800] = 38880, -- Scroll of Enchant Weapon - Agility
[33995] = 38933, -- Scroll of Enchant Gloves - Major Strength [23801] = 38881, -- Scroll of Enchant Bracer - Mana Regeneration
[33996] = 38934, -- Scroll of Enchant Gloves - Assault [23802] = 38882, -- Scroll of Enchant Bracer - Healing Power
[33997] = 38935, -- Scroll of Enchant Gloves - Major Spellpower [23803] = 38883, -- Scroll of Enchant Weapon - Mighty Spirit
[33999] = 38936, -- Scroll of Enchant Gloves - Major Healing [23804] = 38884, -- Scroll of Enchant Weapon - Mighty Intellect
[34001] = 38937, -- Scroll of Enchant Bracer - Major Intellect [25072] = 38885, -- Scroll of Enchant Gloves - Threat
[34002] = 38938, -- Scroll of Enchant Bracer - Assault [25073] = 38886, -- Scroll of Enchant Gloves - Shadow Power
[34003] = 38939, -- Scroll of Enchant Cloak - Spell Penetration [25074] = 38887, -- Scroll of Enchant Gloves - Frost Power
[34004] = 38940, -- Scroll of Enchant Cloak - Greater Agility [25078] = 38888, -- Scroll of Enchant Gloves - Fire Power
[34005] = 38941, -- Scroll of Enchant Cloak - Greater Arcane Resistance [25079] = 38889, -- Scroll of Enchant Gloves - Healing Power
[34006] = 38942, -- Scroll of Enchant Cloak - Greater Shadow Resistance [25080] = 38890, -- Scroll of Enchant Gloves - Superior Agility
[34007] = 38943, -- Scroll of Enchant Boots - Cat's Swiftness [25081] = 38891, -- Scroll of Enchant Cloak - Greater Fire Resistance
[34008] = 38944, -- Scroll of Enchant Boots - Boar's Speed [25082] = 38892, -- Scroll of Enchant Cloak - Greater Nature Resistance
[34009] = 38945, -- Scroll of Enchant Shield - Major Stamina [25083] = 38893, -- Scroll of Enchant Cloak - Stealth
[34010] = 38946, -- Scroll of Enchant Weapon - Major Healing [25084] = 38894, -- Scroll of Enchant Cloak - Subtlety
[42620] = 38947, -- Scroll of Enchant Weapon - Greater Agility [25086] = 38895, -- Scroll of Enchant Cloak - Dodge
[42974] = 38948, -- Scroll of Enchant Weapon - Executioner [27837] = 38896, -- Scroll of Enchant 2H Weapon - Agility
[44383] = 38949, -- Scroll of Enchant Shield - Resilience [27899] = 38897, -- Scroll of Enchant Bracer - Brawn
[44483] = 38950, -- Scroll of Enchant Cloak - Superior Frost Resistance [27905] = 38898, -- Scroll of Enchant Bracer - Stats
[44484] = 38951, -- Scroll of Enchant Gloves - Expertise [27906] = 38899, -- Scroll of Enchant Bracer - Major Defense
[44488] = 38953, -- Scroll of Enchant Gloves - Precision [27911] = 38900, -- Scroll of Enchant Bracer - Superior Healing
[44489] = 38954, -- Scroll of Enchant Shield - Defense [27913] = 38901, -- Scroll of Enchant Bracer - Restore Mana Prime
[44492] = 38955, -- Scroll of Enchant Chest - Mighty Health [27914] = 38902, -- Scroll of Enchant Bracer - Fortitude
[44494] = 38956, -- Scroll of Enchant Cloak - Superior Nature Resistance [27917] = 38903, -- Scroll of Enchant Bracer - Spellpower
[44500] = 38959, -- Scroll of Enchant Cloak - Superior Agility [27944] = 38904, -- Scroll of Enchant Shield - Tough Shield
[44506] = 38960, -- Scroll of Enchant Gloves - Gatherer [27945] = 38905, -- Scroll of Enchant Shield - Intellect
[44508] = 38961, -- Scroll of Enchant Boots - Greater Spirit [27946] = 38906, -- Scroll of Enchant Shield - Shield Block
[44509] = 38962, -- Scroll of Enchant Chest - Greater Mana Restoration [27947] = 38907, -- Scroll of Enchant Shield - Resistance
[44510] = 38963, -- Scroll of Enchant Weapon - Exceptional Spirit [27948] = 38908, -- Scroll of Enchant Boots - Vitality
[44513] = 38964, -- Scroll of Enchant Gloves - Greater Assault [27950] = 38909, -- Scroll of Enchant Boots - Fortitude
[44524] = 38965, -- Scroll of Enchant Weapon - Icebreaker [27951] = 37603, -- Scroll of Enchant Boots - Dexterity
[44528] = 38966, -- Scroll of Enchant Boots - Greater Fortitude [27954] = 38910, -- Scroll of Enchant Boots - Surefooted
[44529] = 38967, -- Scroll of Enchant Gloves - Major Agility [27957] = 38911, -- Scroll of Enchant Chest - Exceptional Health
[44555] = 38968, -- Scroll of Enchant Bracers - Exceptional Intellect [27958] = 38912, -- Scroll of Enchant Chest - Exceptional Mana
[44556] = 38969, -- Scroll of Enchant Cloak - Superior Fire Resistance [27960] = 38913, -- Scroll of Enchant Chest - Exceptional Stats
[44575] = 44815, -- Scroll of Enchant Bracers - Greater Assault [27961] = 38914, -- Scroll of Enchant Cloak - Major Armor
[44576] = 38972, -- Scroll of Enchant Weapon - Lifeward [27962] = 38915, -- Scroll of Enchant Cloak - Major Resistance
[44582] = 38973, -- Scroll of Enchant Cloak - Spell Piercing [27967] = 38917, -- Scroll of Enchant Weapon - Major Striking
[44584] = 38974, -- Scroll of Enchant Boots - Greater Vitality [27968] = 38918, -- Scroll of Enchant Weapon - Major Intellect
[44588] = 38975, -- Scroll of Enchant Chest - Exceptional Resilience [27971] = 38919, -- Scroll of Enchant 2H Weapon - Savagery
[44589] = 38976, -- Scroll of Enchant Boots - Superior Agility [27972] = 38920, -- Scroll of Enchant Weapon - Potency
[44590] = 38977, -- Scroll of Enchant Cloak - Superior Shadow Resistance [27975] = 38921, -- Scroll of Enchant Weapon - Major Spellpower
[44591] = 38978, -- Scroll of Enchant Cloak - Titanweave [27977] = 38922, -- Scroll of Enchant 2H Weapon - Major Agility
[44592] = 38979, -- Scroll of Enchant Gloves - Exceptional Spellpower [27981] = 38923, -- Scroll of Enchant Weapon - Sunfire
[44593] = 38980, -- Scroll of Enchant Bracers - Major Spirit [27982] = 38924, -- Scroll of Enchant Weapon - Soulfrost
[44595] = 38981, -- Scroll of Enchant 2H Weapon - Scourgebane [27984] = 38925, -- Scroll of Enchant Weapon - Mongoose
[44596] = 38982, -- Scroll of Enchant Cloak - Superior Arcane Resistance [28003] = 38926, -- Scroll of Enchant Weapon - Spellsurge
[44598] = 38984, -- Scroll of Enchant Bracer - Expertise [28004] = 38927, -- Scroll of Enchant Weapon - Battlemaster
[44612] = 38985, -- Scroll of Enchant Gloves - Greater Blasting [33990] = 38928, -- Scroll of Enchant Chest - Major Spirit
[44616] = 38987, -- Scroll of Enchant Bracers - Greater Stats [33991] = 38929, -- Scroll of Enchant Chest - Restore Mana Prime
[44621] = 38988, -- Scroll of Enchant Weapon - Giant Slayer [33992] = 38930, -- Scroll of Enchant Chest - Major Resilience
[44623] = 38989, -- Scroll of Enchant Chest - Super Stats [33993] = 38931, -- Scroll of Enchant Gloves - Blasting
[44625] = 38990, -- Scroll of Enchant Gloves - Armsman [33994] = 38932, -- Scroll of Enchant Gloves - Precise Strikes
[44629] = 38991, -- Scroll of Enchant Weapon - Exceptional Spellpower [33995] = 38933, -- Scroll of Enchant Gloves - Major Strength
[44630] = 38992, -- Scroll of Enchant 2H Weapon - Greater Savagery [33996] = 38934, -- Scroll of Enchant Gloves - Assault
[44631] = 38993, -- Scroll of Enchant Cloak - Shadow Armor [33997] = 38935, -- Scroll of Enchant Gloves - Major Spellpower
[44633] = 38995, -- Scroll of Enchant Weapon - Exceptional Agility [33999] = 38936, -- Scroll of Enchant Gloves - Major Healing
[44635] = 38997, -- Scroll of Enchant Bracers - Greater Spellpower [34001] = 38937, -- Scroll of Enchant Bracer - Major Intellect
[46578] = 38998, -- Scroll of Enchant Weapon - Deathfrost [34002] = 38938, -- Scroll of Enchant Bracer - Assault
[46594] = 38999, -- Scroll of Enchant Chest - Defense [34003] = 38939, -- Scroll of Enchant Cloak - Spell Penetration
[47051] = 39000, -- Scroll of Enchant Cloak - Steelweave [34004] = 38940, -- Scroll of Enchant Cloak - Greater Agility
[47672] = 39001, -- Scroll of Enchant Cloak - Mighty Armor [34005] = 38941, -- Scroll of Enchant Cloak - Greater Arcane Resistance
[47766] = 39002, -- Scroll of Enchant Chest - Greater Defense [34006] = 38942, -- Scroll of Enchant Cloak - Greater Shadow Resistance
[47898] = 39003, -- Scroll of Enchant Cloak - Greater Speed [34007] = 38943, -- Scroll of Enchant Boots - Cat's Swiftness
[47899] = 39004, -- Scroll of Enchant Cloak - Wisdom [34008] = 38944, -- Scroll of Enchant Boots - Boar's Speed
[47900] = 39005, -- Scroll of Enchant Chest - Super Health [34009] = 38945, -- Scroll of Enchant Shield - Major Stamina
[47901] = 39006, -- Scroll of Enchant Boots - Tuskarr's Vitality [34010] = 38946, -- Scroll of Enchant Weapon - Major Healing
[59619] = 44497, -- Scroll of Enchant Weapon - Accuracy [42620] = 38947, -- Scroll of Enchant Weapon - Greater Agility
[59621] = 44493, -- Scroll of Enchant Weapon - Berserking [42974] = 38948, -- Scroll of Enchant Weapon - Executioner
[59625] = 43987, -- Scroll of Enchant Weapon - Black Magic [44383] = 38949, -- Scroll of Enchant Shield - Resilience
[60606] = 44449, -- Scroll of Enchant Boots - Assault [44483] = 38950, -- Scroll of Enchant Cloak - Superior Frost Resistance
[60609] = 44456, -- Scroll of Enchant Cloak - Speed [44484] = 38951, -- Scroll of Enchant Gloves - Expertise
[60616] = 38971, -- Scroll of Enchant Bracers - Striking [44488] = 38953, -- Scroll of Enchant Gloves - Precision
[60621] = 44453, -- Scroll of Enchant Weapon - Greater Potency [44489] = 38954, -- Scroll of Enchant Shield - Defense
[60623] = 38986, -- Scroll of Enchant Boots - Icewalker [44492] = 38955, -- Scroll of Enchant Chest - Mighty Health
[60653] = 44455, -- Scroll of Enchant Shield - Greater Intellect [44494] = 38956, -- Scroll of Enchant Cloak - Superior Nature Resistance
[60663] = 44457, -- Scroll of Enchant Cloak - Major Agility [44500] = 38959, -- Scroll of Enchant Cloak - Superior Agility
[60668] = 44458, -- Scroll of Enchant Gloves - Crusher [44506] = 38960, -- Scroll of Enchant Gloves - Gatherer
[60691] = 44463, -- Scroll of Enchant 2H Weapon - Massacre [44508] = 38961, -- Scroll of Enchant Boots - Greater Spirit
[60692] = 44465, -- Scroll of Enchant Chest - Powerful Stats [44509] = 38962, -- Scroll of Enchant Chest - Greater Mana Restoration
[60707] = 44466, -- Scroll of Enchant Weapon - Superior Potency [44510] = 38963, -- Scroll of Enchant Weapon - Exceptional Spirit
[60714] = 44467, -- Scroll of Enchant Weapon - Mighty Spellpower [44513] = 38964, -- Scroll of Enchant Gloves - Greater Assault
[60763] = 44469, -- Scroll of Enchant Boots - Greater Assault [44524] = 38965, -- Scroll of Enchant Weapon - Icebreaker
[60767] = 44470, -- Scroll of Enchant Bracer - Superior Spellpower [44528] = 38966, -- Scroll of Enchant Boots - Greater Fortitude
[62256] = 44947, -- Scroll of Enchant Bracer - Major Stamina [44529] = 38967, -- Scroll of Enchant Gloves - Major Agility
[62257] = 44946, -- Scroll of Enchant Weapon - Titanguard [44555] = 38968, -- Scroll of Enchant Bracers - Exceptional Intellect
[62948] = 45056, -- Scroll of Enchant Staff - Greater Spellpower [44556] = 38969, -- Scroll of Enchant Cloak - Superior Fire Resistance
[62959] = 45060, -- Scroll of Enchant Staff - Spellpower [44575] = 44815, -- Scroll of Enchant Bracers - Greater Assault
[63746] = 45628, -- Scroll of Enchant Boots - Lesser Accuracy [44576] = 38972, -- Scroll of Enchant Weapon - Lifeward
[64441] = 46026, -- Scroll of Enchant Weapon - Blade Ward [44582] = 38973, -- Scroll of Enchant Cloak - Spell Piercing
[64579] = 46098, -- Scroll of Enchant Weapon - Blood Draining [44584] = 38974, -- Scroll of Enchant Boots - Greater Vitality
[71692] = 50816, -- Scroll of Enchant Gloves - Angler [44588] = 38975, -- Scroll of Enchant Chest - Exceptional Resilience
} [44589] = 38976, -- Scroll of Enchant Boots - Superior Agility
[44590] = 38977, -- Scroll of Enchant Cloak - Superior Shadow Resistance
[44591] = 38978, -- Scroll of Enchant Cloak - Titanweave
[44592] = 38979, -- Scroll of Enchant Gloves - Exceptional Spellpower
[44593] = 38980, -- Scroll of Enchant Bracers - Major Spirit
[44595] = 38981, -- Scroll of Enchant 2H Weapon - Scourgebane
[44596] = 38982, -- Scroll of Enchant Cloak - Superior Arcane Resistance
[44598] = 38984, -- Scroll of Enchant Bracer - Expertise
[44612] = 38985, -- Scroll of Enchant Gloves - Greater Blasting
[44616] = 38987, -- Scroll of Enchant Bracers - Greater Stats
[44621] = 38988, -- Scroll of Enchant Weapon - Giant Slayer
[44623] = 38989, -- Scroll of Enchant Chest - Super Stats
[44625] = 38990, -- Scroll of Enchant Gloves - Armsman
[44629] = 38991, -- Scroll of Enchant Weapon - Exceptional Spellpower
[44630] = 38992, -- Scroll of Enchant 2H Weapon - Greater Savagery
[44631] = 38993, -- Scroll of Enchant Cloak - Shadow Armor
[44633] = 38995, -- Scroll of Enchant Weapon - Exceptional Agility
[44635] = 38997, -- Scroll of Enchant Bracers - Greater Spellpower
[46578] = 38998, -- Scroll of Enchant Weapon - Deathfrost
[46594] = 38999, -- Scroll of Enchant Chest - Defense
[47051] = 39000, -- Scroll of Enchant Cloak - Steelweave
[47672] = 39001, -- Scroll of Enchant Cloak - Mighty Armor
[47766] = 39002, -- Scroll of Enchant Chest - Greater Defense
[47898] = 39003, -- Scroll of Enchant Cloak - Greater Speed
[47899] = 39004, -- Scroll of Enchant Cloak - Wisdom
[47900] = 39005, -- Scroll of Enchant Chest - Super Health
[47901] = 39006, -- Scroll of Enchant Boots - Tuskarr's Vitality
[59619] = 44497, -- Scroll of Enchant Weapon - Accuracy
[59621] = 44493, -- Scroll of Enchant Weapon - Berserking
[59625] = 43987, -- Scroll of Enchant Weapon - Black Magic
[60606] = 44449, -- Scroll of Enchant Boots - Assault
[60609] = 44456, -- Scroll of Enchant Cloak - Speed
[60616] = 38971, -- Scroll of Enchant Bracers - Striking
[60621] = 44453, -- Scroll of Enchant Weapon - Greater Potency
[60623] = 38986, -- Scroll of Enchant Boots - Icewalker
[60653] = 44455, -- Scroll of Enchant Shield - Greater Intellect
[60663] = 44457, -- Scroll of Enchant Cloak - Major Agility
[60668] = 44458, -- Scroll of Enchant Gloves - Crusher
[60691] = 44463, -- Scroll of Enchant 2H Weapon - Massacre
[60692] = 44465, -- Scroll of Enchant Chest - Powerful Stats
[60707] = 44466, -- Scroll of Enchant Weapon - Superior Potency
[60714] = 44467, -- Scroll of Enchant Weapon - Mighty Spellpower
[60763] = 44469, -- Scroll of Enchant Boots - Greater Assault
[60767] = 44470, -- Scroll of Enchant Bracer - Superior Spellpower
[62256] = 44947, -- Scroll of Enchant Bracer - Major Stamina
[62257] = 44946, -- Scroll of Enchant Weapon - Titanguard
[62948] = 45056, -- Scroll of Enchant Staff - Greater Spellpower
[62959] = 45060, -- Scroll of Enchant Staff - Spellpower
[63746] = 45628, -- Scroll of Enchant Boots - Lesser Accuracy
[64441] = 46026, -- Scroll of Enchant Weapon - Blade Ward
[64579] = 46098, -- Scroll of Enchant Weapon - Blood Draining
[71692] = 50816, -- Scroll of Enchant Gloves - Angler
[968676] = 967760, -- Scroll of Enchant Weapon - Unstoppable Assault I
[968677] = 967761, -- Scroll of Enchant Weapon - Unstoppable Assault II
[968678] = 967762, -- Scroll of Enchant Weapon - Unstoppable Assault III
[968679] = 967763, -- Scroll of Enchant Weapon - Lucid Assault I
[968680] = 967764, -- Scroll of Enchant Weapon - Lucid Assault II
[968681] = 967765, -- Scroll of Enchant Weapon - Lucid Assault III
[968682] = 967766, -- Scroll of Enchant Weapon - Spellbinder's Rage I
[968683] = 967767, -- Scroll of Enchant Weapon - Spellbinder's Rage II
[968684] = 967768, -- Scroll of Enchant Weapon - Spellbinder's Rage III
[968685] = 967769, -- Scroll of Enchant Weapon - Ninja's Focus I
[968686] = 967770, -- Scroll of Enchant Weapon - Ninja's Focus II
[968687] = 967771, -- Scroll of Enchant Weapon - Ninja's Focus III
[968688] = 967772, -- Scroll of Enchant Weapon - Grovewarden's Blessing I
[968689] = 967773, -- Scroll of Enchant Weapon - Grovewarden's Blessing II
[968690] = 967774, -- Scroll of Enchant Weapon - Grovewarden's Blessing III
[968691] = 967775, -- Scroll of Enchant Weapon - Viscious Assault I
[968692] = 967776, -- Scroll of Enchant Weapon - Viscious Assault II
[968693] = 967777, -- Scroll of Enchant Weapon - Viscious Assault III
[968694] = 967778, -- Scroll of Enchant Weapon - Arcane Dexterity I
[968695] = 967779, -- Scroll of Enchant Weapon - Arcane Dexterity II
[968696] = 967780, -- Scroll of Enchant Weapon - Arcane Dexterity III
[968697] = 967781, -- Scroll of Enchant Weapon - Arcane Artillery I
[968698] = 967782, -- Scroll of Enchant Weapon - Arcane Artillery II
[968699] = 967783, -- Scroll of Enchant Weapon - Arcane Artillery III
[968700] = 967784, -- Scroll of Enchant Weapon - Arcane Precision I
[968701] = 967785, -- Scroll of Enchant Weapon - Arcane Precision II
[968702] = 967786, -- Scroll of Enchant Weapon - Arcane Precision III
[968770] = 967787, -- Scroll of Enchant Weapon - Crusader II
[968771] = 967788, -- Scroll of Enchant Weapon - Crusader III
[1968677] = 1204125, -- Scroll of Enchant Weapon - Void Assault
[1968678] = 1204126, -- Scroll of Enchant Weapon - Overpowering Void Assault
[1968680] = 1204127, -- Scroll of Enchant Weapon - Dread Assault
[1968681] = 1204128, -- Scroll of Enchant Weapon - Overpowering Dread Assault
[1968683] = 1204129, -- Scroll of Enchant Weapon - Twisted Evoker
[1968684] = 1204130, -- Scroll of Enchant Weapon - Overpowering Twisted Evoker
[1968686] = 1204131, -- Scroll of Enchant Weapon - Twisted Assault
[1968687] = 1204132, -- Scroll of Enchant Weapon - Overpowering Twisted Assault
[1968689] = 1204133, -- Scroll of Enchant Weapon - Twisted Channeler
[1968690] = 1204134, -- Scroll of Enchant Weapon - Overpowering Twisted Channeler
[1968692] = 1204135, -- Scroll of Enchant Weapon - Dread Omen Strikes
[1968693] = 1204136, -- Scroll of Enchant Weapon - Overpowering Dread Omen Strikes
[1968695] = 1204137, -- Scroll of Enchant Weapon - Void Flows
[1968696] = 1204138, -- Scroll of Enchant Weapon - Overpowering Void Flows
[1968698] = 1204139, -- Scroll of Enchant Weapon - Void Blasting
[1968699] = 1204140, -- Scroll of Enchant Weapon - Overpowering Void Blasting
[1968701] = 1204141, -- Scroll of Enchant Weapon - Dread Precision
[1968702] = 1204142, -- Scroll of Enchant Weapon - Overpowering Dread Precision
[1968770] = 1204143, -- Scroll of Enchant Weapon - Twisted Crusader
[1968771] = 1204144, -- Scroll of Enchant Weapon - Overpowering Twisted Crusader
}

18
TradeSkillMaster_Crafting/Modules/Gather.lua

@ -23,14 +23,14 @@ function Gather:BuyFromMerchant(neededMats)
while toBuy > 0 do while toBuy > 0 do
BuyMerchantItem(i, math.min(toBuy, maxStack)) BuyMerchantItem(i, math.min(toBuy, maxStack))
toBuy = toBuy - maxStack toBuy = toBuy - maxStack
TSM.db.factionrealm.gathering.gatheredMats = true TSM.db.realm.gathering.gatheredMats = true
end end
end end
end end
end end
function Gather:gatherItems(source, task) function Gather:gatherItems(source, task)
local items = TSM.db.factionrealm.gathering.availableMats local items = TSM.db.realm.gathering.availableMats
if source == L["Vendor"] then if source == L["Vendor"] then
Gather:BuyFromMerchant(items) Gather:BuyFromMerchant(items)
@ -58,7 +58,7 @@ function Gather:GatherBank(moveItems)
else else
TSM:Print(L["Gathering Crafting Mats"]) TSM:Print(L["Gathering Crafting Mats"])
TSMAPI:MoveItems(moveItems, Gather.PrintMsg) TSMAPI:MoveItems(moveItems, Gather.PrintMsg)
TSM.db.factionrealm.gathering.gatheredMats = true TSM.db.realm.gathering.gatheredMats = true
end end
end end
@ -83,11 +83,11 @@ function Gather:MailItems(neededItems)
if next(neededItems) == nil then if next(neededItems) == nil then
TSM:Print(L["Nothing to Mail"]) TSM:Print(L["Nothing to Mail"])
else else
local crafter = TSM.db.factionrealm.gathering.crafter local crafter = TSM.db.realm.gathering.crafter
if crafter then if crafter then
TSM:Print(format(L["Mailing Craft Mats to %s"], crafter)) TSM:Print(format(L["Mailing Craft Mats to %s"], crafter))
TSMAPI:ModuleAPI("Mailing", "mailItems", neededItems, crafter, Gather.PrintMsg) TSMAPI:ModuleAPI("Mailing", "mailItems", neededItems, crafter, Gather.PrintMsg)
TSM.db.factionrealm.gathering.gatheredMats = true TSM.db.realm.gathering.gatheredMats = true
end end
end end
end end
@ -111,7 +111,7 @@ local function ShoppingCallback(remainingQty, boughtItem, stackSize)
if TSM.Inventory.gatherItem and boughtItem ~= TSM.Inventory.gatherItem then if TSM.Inventory.gatherItem and boughtItem ~= TSM.Inventory.gatherItem then
for itemString, data in pairs(TSMAPI.Conversions[TSM.Inventory.gatherItem] or {}) do for itemString, data in pairs(TSMAPI.Conversions[TSM.Inventory.gatherItem] or {}) do
if itemString == boughtItem then if itemString == boughtItem then
TSM.db.factionrealm.gathering.destroyingMats[boughtItem] = (TSM.db.factionrealm.gathering.destroyingMats[boughtItem] or 0) + stackSize TSM.db.realm.gathering.destroyingMats[boughtItem] = (TSM.db.realm.gathering.destroyingMats[boughtItem] or 0) + stackSize
end end
end end
end end
@ -125,10 +125,10 @@ end
function Gather:ShoppingSearch(itemString, need, ignoreMaxQty) function Gather:ShoppingSearch(itemString, need, ignoreMaxQty)
TSM.Inventory.gatherQuantity = nil TSM.Inventory.gatherQuantity = nil
local matPrice = TSMAPI:FormatTextMoney(TSM.Cost:GetMatCost(itemString)) local matPrice = TSMAPI:FormatTextMoney(TSM.Cost:GetMatCost(itemString))
if not TSM.db.factionrealm.gathering.destroyDisable then if not TSM.db.realm.gathering.destroyDisable then
if TSMAPI.InkConversions[itemString] then if TSMAPI.InkConversions[itemString] then
TSM.Inventory.gatherItem = itemString TSM.Inventory.gatherItem = itemString
if TSM.db.factionrealm.gathering.evenStacks then if TSM.db.realm.gathering.evenStacks then
if ignoreMaxQty then if ignoreMaxQty then
TSMAPI:ModuleAPI("Shopping", "runDestroySearch", TSMAPI:GetSafeItemInfo(itemString) .. "/even", ShoppingCallback) TSMAPI:ModuleAPI("Shopping", "runDestroySearch", TSMAPI:GetSafeItemInfo(itemString) .. "/even", ShoppingCallback)
else else
@ -154,7 +154,7 @@ function Gather:ShoppingSearch(itemString, need, ignoreMaxQty)
break break
end end
if convertSource == "mill" or convertSource == "prospect" then if convertSource == "mill" or convertSource == "prospect" then
if TSM.db.factionrealm.gathering.evenStacks then if TSM.db.realm.gathering.evenStacks then
if ignoreMaxQty then if ignoreMaxQty then
TSMAPI:ModuleAPI("Shopping", "runDestroySearch", TSMAPI:GetSafeItemInfo(itemString) .. "/even", ShoppingCallback) TSMAPI:ModuleAPI("Shopping", "runDestroySearch", TSMAPI:GetSafeItemInfo(itemString) .. "/even", ShoppingCallback)
else else

22
TradeSkillMaster_Crafting/Modules/Inventory.lua

@ -204,7 +204,7 @@
end end
end end
-- add mail tasks for destroyable items bought through shopping search (exclude items already added to mail tasks) -- add mail tasks for destroyable items bought through shopping search (exclude items already added to mail tasks)
for itemString, quantity in pairs(TSM.db.factionrealm.gathering.destroyingMats) do for itemString, quantity in pairs(TSM.db.realm.gathering.destroyingMats) do
if mail[itemString] and not shortItems[itemString] then if mail[itemString] and not shortItems[itemString] then
mailItems[itemString] = quantity mailItems[itemString] = quantity
end end
@ -256,44 +256,44 @@
local need = max(quantity - (TSM.Inventory:GetTotalQuantity(itemString) or 0), 0) local need = max(quantity - (TSM.Inventory:GetTotalQuantity(itemString) or 0), 0)
-- conversion items -- conversion items
for destroyItem, data in pairs(TSMAPI.Conversions[itemString] or {}) do for destroyItem, data in pairs(TSMAPI.Conversions[itemString] or {}) do
if TSM.db.factionrealm.gathering.destroyingMats[destroyItem] then if TSM.db.realm.gathering.destroyingMats[destroyItem] then
if need > 0 then if need > 0 then
local destroyNeed local destroyNeed
if data.source == "mill" then if data.source == "mill" then
destroyNeed = floor(TSM.db.factionrealm.gathering.destroyingMats[destroyItem] / 5) destroyNeed = floor(TSM.db.realm.gathering.destroyingMats[destroyItem] / 5)
if destroyNeed > 0 then if destroyNeed > 0 then
millItems[destroyItem] = (millItems[destroyItem] or 0) + destroyNeed millItems[destroyItem] = (millItems[destroyItem] or 0) + destroyNeed
end end
elseif data.source == "prospect" then elseif data.source == "prospect" then
destroyNeed = floor(TSM.db.factionrealm.gathering.destroyingMats[destroyItem] / 5) destroyNeed = floor(TSM.db.realm.gathering.destroyingMats[destroyItem] / 5)
if destroyNeed > 0 then if destroyNeed > 0 then
prospectItems[destroyItem] = (prospectItems[destroyItem] or 0) + destroyNeed prospectItems[destroyItem] = (prospectItems[destroyItem] or 0) + destroyNeed
end end
elseif data.source == "transform" then elseif data.source == "transform" then
if data.rate == 1 / 3 then if data.rate == 1 / 3 then
destroyNeed = floor(TSM.db.factionrealm.gathering.destroyingMats[destroyItem] / 3) destroyNeed = floor(TSM.db.realm.gathering.destroyingMats[destroyItem] / 3)
elseif data.rate == 1 / 10 then elseif data.rate == 1 / 10 then
destroyNeed = floor(TSM.db.factionrealm.gathering.destroyingMats[destroyItem] / 10) destroyNeed = floor(TSM.db.realm.gathering.destroyingMats[destroyItem] / 10)
else else
destroyNeed = TSM.db.factionrealm.gathering.destroyingMats[destroyItem] destroyNeed = TSM.db.realm.gathering.destroyingMats[destroyItem]
end end
if destroyNeed > 0 then if destroyNeed > 0 then
transformItems[destroyItem] = (transformItems[destroyItem] or 0) + destroyNeed transformItems[destroyItem] = (transformItems[destroyItem] or 0) + destroyNeed
end end
end end
else else
TSM.db.factionrealm.gathering.destroyingMats[destroyItem] = nil TSM.db.realm.gathering.destroyingMats[destroyItem] = nil
end end
end end
end end
-- disenchantable items -- disenchantable items
if next(TSM.db.factionrealm.gathering.destroyingMats) then if next(TSM.db.realm.gathering.destroyingMats) then
for deItemString, quantity in pairs(TSM.db.factionrealm.gathering.destroyingMats) do for deItemString, quantity in pairs(TSM.db.realm.gathering.destroyingMats) do
if Inventory:IsDisenchantable(deItemString) then if Inventory:IsDisenchantable(deItemString) then
if need > 0 then if need > 0 then
deItems[deItemString] = quantity deItems[deItemString] = quantity
else else
TSM.db.factionrealm.gathering.destroyingMats[deItemString] = nil TSM.db.realm.gathering.destroyingMats[deItemString] = nil
end end
end end
end end

26
TradeSkillMaster_Crafting/Modules/Options.lua

@ -342,7 +342,7 @@ function Options:LoadGeneralSettings(container)
{ {
type = "CheckBox", type = "CheckBox",
label = L["Gather All Professions by Default if Only One Crafter"], label = L["Gather All Professions by Default if Only One Crafter"],
settingInfo = { TSM.db.factionrealm.gathering, "gatherAll" }, settingInfo = { TSM.db.realm.gathering, "gatherAll" },
relativeWidth = 1, relativeWidth = 1,
tooltip = L["If checked, if there is only one crafter for the craft queue clicking gather will gather for all professions for that crafter"], tooltip = L["If checked, if there is only one crafter for the craft queue clicking gather will gather for all professions for that crafter"],
}, },
@ -491,7 +491,7 @@ function Options:UpdateCraftST()
if not craftST then return end if not craftST then return end
local stData = {} local stData = {}
local bagTotal, auctionTotal, otherTotal = TSM.Inventory:GetTotals() local bagTotal, auctionTotal, otherTotal = TSM.Inventory:GetTotals()
for spellID, data in pairs(TSM.db.factionrealm.crafts) do for spellID, data in pairs(TSM.db.realm.crafts) do
local isFiltered local isFiltered
local name, link = TSMAPI:GetSafeItemInfo(data.itemID) local name, link = TSMAPI:GetSafeItemInfo(data.itemID)
@ -572,7 +572,7 @@ function Options:LoadCraftsPage(container)
filters = {filter="", profession="", dpSelection="all", haveMats=nil, queueIncr=1} filters = {filter="", profession="", dpSelection="all", haveMats=nil, queueIncr=1}
local professionList = { [""] = L["<None>"] } local professionList = { [""] = L["<None>"] }
for _, data in pairs(TSM.db.factionrealm.crafts) do for _, data in pairs(TSM.db.realm.crafts) do
professionList[data.profession] = data.profession professionList[data.profession] = data.profession
end end
@ -704,7 +704,7 @@ function Options:LoadCraftsPage(container)
local handlers = { local handlers = {
OnClick = function(st, data, self, button) OnClick = function(st, data, self, button)
if not data then return end if not data then return end
local craft = TSM.db.factionrealm.crafts[data.spellID] local craft = TSM.db.realm.crafts[data.spellID]
if button == "LeftButton" then if button == "LeftButton" then
craft.queued = craft.queued + filters.queueIncr craft.queued = craft.queued + filters.queueIncr
elseif button == "RightButton" then elseif button == "RightButton" then
@ -747,7 +747,7 @@ function Options:LoadCraftsPage(container)
end end
function Options:ResetDefaultPrice() function Options:ResetDefaultPrice()
for itemString, data in pairs(TSM.db.factionrealm.mats) do for itemString, data in pairs(TSM.db.realm.mats) do
if data.customValue then if data.customValue then
data.customValue = nil data.customValue = nil
end end
@ -757,12 +757,12 @@ end
function Options:UpdateMatST() function Options:UpdateMatST()
local items = {} local items = {}
for _, data in pairs(TSM.db.factionrealm.crafts) do for _, data in pairs(TSM.db.realm.crafts) do
if filters.ddSelection == "none" or data.profession == filters.ddSelection then if filters.ddSelection == "none" or data.profession == filters.ddSelection then
for itemString in pairs(data.mats) do for itemString in pairs(data.mats) do
if filters.dpSelection == "all" or (filters.dpSelection == "default" and not TSM.db.factionrealm.mats[itemString].customValue) or (filters.dpSelection == "custom" and TSM.db.factionrealm.mats[itemString].customValue) then if filters.dpSelection == "all" or (filters.dpSelection == "default" and not TSM.db.realm.mats[itemString].customValue) or (filters.dpSelection == "custom" and TSM.db.realm.mats[itemString].customValue) then
if TSM.db.factionrealm.mats[itemString] and TSM.db.factionrealm.mats[itemString].name then -- sanity check if TSM.db.realm.mats[itemString] and TSM.db.realm.mats[itemString].name then -- sanity check
items[itemString] = TSM.db.factionrealm.mats[itemString].name items[itemString] = TSM.db.realm.mats[itemString].name
end end
end end
end end
@ -776,7 +776,7 @@ function Options:UpdateMatST()
if strfind(strlower(name), filters.filter) then if strfind(strlower(name), filters.filter) then
local professions = {} local professions = {}
local professionList = {} local professionList = {}
for _, data in pairs(TSM.db.factionrealm.crafts) do for _, data in pairs(TSM.db.realm.crafts) do
if data.mats[itemString] then if data.mats[itemString] then
if not professions[data.profession] then if not professions[data.profession] then
professions[data.profession] = true professions[data.profession] = true
@ -787,7 +787,7 @@ function Options:UpdateMatST()
sort(professionList) sort(professionList)
local professionsUsed = table.concat(professionList, ",") local professionsUsed = table.concat(professionList, ",")
local mat = TSM.db.factionrealm.mats[itemString] local mat = TSM.db.realm.mats[itemString]
local cost = TSM:GetCustomPrice(mat.customValue or TSM.db.global.defaultMatCostMethod, itemString) or 0 local cost = TSM:GetCustomPrice(mat.customValue or TSM.db.global.defaultMatCostMethod, itemString) or 0
local quantity = inventoryTotals[itemString] or 0 local quantity = inventoryTotals[itemString] or 0
tinsert(stData, { tinsert(stData, {
@ -824,7 +824,7 @@ function Options:LoadMaterialsPage(container)
filters = {filter="", ddSelection="none", dpSelection="all"} filters = {filter="", ddSelection="none", dpSelection="all"}
local ddList = { ["none"] = L["<None>"] } local ddList = { ["none"] = L["<None>"] }
for _, data in pairs(TSM.db.factionrealm.crafts) do for _, data in pairs(TSM.db.realm.crafts) do
ddList[data.profession] = data.profession ddList[data.profession] = data.profession
end end
@ -962,7 +962,7 @@ end
-- Material Options Window -- Material Options Window
function Options:ShowMatOptionsWindow(parent, itemString) function Options:ShowMatOptionsWindow(parent, itemString)
if Options.OpenWindow then Options.OpenWindow:Hide() end if Options.OpenWindow then Options.OpenWindow:Hide() end
local mat = TSM.db.factionrealm.mats[itemString] local mat = TSM.db.realm.mats[itemString]
if not mat then return end if not mat then return end
local link = select(2, TSMAPI:GetSafeItemInfo(itemString)) or mat.name local link = select(2, TSMAPI:GetSafeItemInfo(itemString)) or mat.name
local cost = TSM:GetCustomPrice(mat.customValue or TSM.db.global.defaultMatCostMethod, itemString) or 0 local cost = TSM:GetCustomPrice(mat.customValue or TSM.db.global.defaultMatCostMethod, itemString) or 0

36
TradeSkillMaster_Crafting/Modules/Queue.lua

@ -43,7 +43,7 @@ function Queue:CreateRestockQueue(groupInfo)
for itemString in pairs(data.items) do for itemString in pairs(data.items) do
itemString = TSMAPI:GetItemString(itemString) itemString = TSMAPI:GetItemString(itemString)
local spellID = TSM.craftReverseLookup[itemString] and TSM.craftReverseLookup[itemString][1] local spellID = TSM.craftReverseLookup[itemString] and TSM.craftReverseLookup[itemString][1]
if spellID and TSM.db.factionrealm.crafts[spellID] then if spellID and TSM.db.realm.crafts[spellID] then
local maxQueueCount = max(opSettings.maxRestock - TSM.Inventory:GetTotalQuantity(itemString), 0) local maxQueueCount = max(opSettings.maxRestock - TSM.Inventory:GetTotalQuantity(itemString), 0)
local numToQueue = 0 local numToQueue = 0
@ -60,7 +60,7 @@ function Queue:CreateRestockQueue(groupInfo)
end end
end end
local craft = TSM.db.factionrealm.crafts[spellID] local craft = TSM.db.realm.crafts[spellID]
craft.queued = floor(numToQueue / craft.numResult) craft.queued = floor(numToQueue / craft.numResult)
craft.queued = craft.queued >= opSettings.minRestock and craft.queued or 0 craft.queued = craft.queued >= opSettings.minRestock and craft.queued or 0
if craft.queued > 0 then if craft.queued > 0 then
@ -84,12 +84,12 @@ function Queue:HasLoop(itemString, steps, visited)
if visited[itemString] then return true end if visited[itemString] then return true end
visited[itemString] = true visited[itemString] = true
local craftCost = TSM:GetCustomPrice("Crafting", itemString) local craftCost = TSM:GetCustomPrice("Crafting", itemString)
local mat = TSM.db.factionrealm.mats[itemString] local mat = TSM.db.realm.mats[itemString]
local lowestCost = TSM:GetCustomPrice(mat.customValue or TSM.db.global.defaultMatCostMethod, itemString) local lowestCost = TSM:GetCustomPrice(mat.customValue or TSM.db.global.defaultMatCostMethod, itemString)
if craftCost and lowestCost and craftCost <= lowestCost and (not TSM.db.global.neverCraftInks or not TSMAPI.InkConversions[itemString]) then if craftCost and lowestCost and craftCost <= lowestCost and (not TSM.db.global.neverCraftInks or not TSMAPI.InkConversions[itemString]) then
local spellID = TSM.Cost:GetLowestCraftPrices(itemString, true) local spellID = TSM.Cost:GetLowestCraftPrices(itemString, true)
if spellID and TSM.db.factionrealm.crafts[spellID] then if spellID and TSM.db.realm.crafts[spellID] then
for matItemString in pairs(TSM.db.factionrealm.crafts[spellID].mats) do for matItemString in pairs(TSM.db.realm.crafts[spellID].mats) do
if Queue:HasLoop(matItemString, steps, CopyTable(visited)) then if Queue:HasLoop(matItemString, steps, CopyTable(visited)) then
return true return true
end end
@ -123,18 +123,18 @@ function Queue:GetIntermediateCrafts(mats, usedItems, usedMats, tempMats)
end end
if quantity > 0 and not Queue:HasLoop(itemString, 0, {}) then if quantity > 0 and not Queue:HasLoop(itemString, 0, {}) then
local mat = TSM.db.factionrealm.mats[itemString] local mat = TSM.db.realm.mats[itemString]
local craftCost = TSM:GetCustomPrice("Crafting", itemString) local craftCost = TSM:GetCustomPrice("Crafting", itemString)
local lowestCost = TSM:GetCustomPrice(mat.customValue or TSM.db.global.defaultMatCostMethod, itemString) local lowestCost = TSM:GetCustomPrice(mat.customValue or TSM.db.global.defaultMatCostMethod, itemString)
if craftCost and lowestCost and craftCost <= lowestCost and (not TSM.db.global.neverCraftInks or not TSMAPI.InkConversions[itemString]) then if craftCost and lowestCost and craftCost <= lowestCost and (not TSM.db.global.neverCraftInks or not TSMAPI.InkConversions[itemString]) then
local spellID = TSM.Cost:GetLowestCraftPrices(itemString, true) local spellID = TSM.Cost:GetLowestCraftPrices(itemString, true)
if spellID and TSM.db.factionrealm.crafts[spellID] then if spellID and TSM.db.realm.crafts[spellID] then
local numResult = TSM.db.factionrealm.crafts[spellID].numResult local numResult = TSM.db.realm.crafts[spellID].numResult
quantity = ceil(quantity / numResult) quantity = ceil(quantity / numResult)
subCrafts[TSM.db.factionrealm.crafts[spellID].profession] = subCrafts[TSM.db.factionrealm.crafts[spellID].profession] or {} subCrafts[TSM.db.realm.crafts[spellID].profession] = subCrafts[TSM.db.realm.crafts[spellID].profession] or {}
subCrafts[TSM.db.factionrealm.crafts[spellID].profession][spellID] = (subCrafts[TSM.db.factionrealm.crafts[spellID].profession][spellID] or 0) + quantity subCrafts[TSM.db.realm.crafts[spellID].profession][spellID] = (subCrafts[TSM.db.realm.crafts[spellID].profession][spellID] or 0) + quantity
TSM.db.factionrealm.crafts[spellID].queued = TSM.db.factionrealm.crafts[spellID].queued + quantity TSM.db.realm.crafts[spellID].queued = TSM.db.realm.crafts[spellID].queued + quantity
TSM.db.factionrealm.crafts[spellID].intermediateQueued = (TSM.db.factionrealm.crafts[spellID].intermediateQueued or 0) + quantity TSM.db.realm.crafts[spellID].intermediateQueued = (TSM.db.realm.crafts[spellID].intermediateQueued or 0) + quantity
mats[profession][itemString] = nil mats[profession][itemString] = nil
usedMats[profession] = usedMats[profession] or {} usedMats[profession] = usedMats[profession] or {}
usedMats[profession][itemString] = numHave usedMats[profession][itemString] = numHave
@ -148,7 +148,7 @@ function Queue:GetIntermediateCrafts(mats, usedItems, usedMats, tempMats)
for profession, data in pairs(subCrafts) do for profession, data in pairs(subCrafts) do
for spellID, quantity in pairs(data) do for spellID, quantity in pairs(data) do
newSubCrafts = true newSubCrafts = true
for itemString, matQuantity in pairs(TSM.db.factionrealm.crafts[spellID].mats) do for itemString, matQuantity in pairs(TSM.db.realm.crafts[spellID].mats) do
mats[profession] = mats[profession] or {} mats[profession] = mats[profession] or {}
mats[profession][itemString] = (mats[profession][itemString] or 0) + matQuantity * quantity mats[profession][itemString] = (mats[profession][itemString] or 0) + matQuantity * quantity
end end
@ -162,7 +162,7 @@ function Queue:GetQueue()
local totalCost, totalProfit local totalCost, totalProfit
-- first queue up all the normally queued stuff -- first queue up all the normally queued stuff
for spellID, data in pairs(TSM.db.factionrealm.crafts) do for spellID, data in pairs(TSM.db.realm.crafts) do
if data.intermediateQueued then if data.intermediateQueued then
data.queued = max(data.queued - data.intermediateQueued, 0) data.queued = max(data.queued - data.intermediateQueued, 0)
data.intermediateQueued = nil data.intermediateQueued = nil
@ -229,14 +229,14 @@ function Queue:GetQueue()
end end
function Queue:ClearQueue() function Queue:ClearQueue()
for spellID, data in pairs(TSM.db.factionrealm.crafts) do for spellID, data in pairs(TSM.db.realm.crafts) do
data.queued = 0 data.queued = 0
data.intermediateQueued = nil data.intermediateQueued = nil
end end
end end
function Queue:addQueue(spellID, quantity) function Queue:addQueue(spellID, quantity)
local craft = TSM.db.factionrealm.crafts[spellID] local craft = TSM.db.realm.crafts[spellID]
if not craft then return end if not craft then return end
quantity = quantity or 1 quantity = quantity or 1
craft.queued = craft.queued + quantity craft.queued = craft.queued + quantity
@ -244,7 +244,7 @@ function Queue:addQueue(spellID, quantity)
end end
function Queue:removeQueue(spellID, quantity) function Queue:removeQueue(spellID, quantity)
local craft = TSM.db.factionrealm.crafts[spellID] local craft = TSM.db.realm.crafts[spellID]
if not craft then return end if not craft then return end
quantity = quantity or 1 quantity = quantity or 1
craft.queued = max(craft.queued - quantity, 0) craft.queued = max(craft.queued - quantity, 0)
@ -252,6 +252,6 @@ function Queue:removeQueue(spellID, quantity)
end end
function Queue:getQueue(spellID) function Queue:getQueue(spellID)
local craft = TSM.db.factionrealm.crafts[spellID] local craft = TSM.db.realm.crafts[spellID]
return craft.queued return craft.queued
end end

3583
TradeSkillMaster_Crafting/Modules/SpellNames2IDs.lua

File diff suppressed because it is too large Load Diff

4
TradeSkillMaster_Crafting/Modules/Sync.lua

@ -27,7 +27,7 @@ function Sync:BroadcastTradeSkillData(timerUp)
return return
end end
local player = UnitName("player") local player = UnitName("player")
local playerTradeSkills = TSM.db.factionrealm.tradeSkills[player] local playerTradeSkills = TSM.db.realm.tradeSkills[player]
if not playerTradeSkills then return end if not playerTradeSkills then return end
local packet = {tradeSkills={}, accountKey=TSMAPI.Sync:GetAccountKey()} local packet = {tradeSkills={}, accountKey=TSMAPI.Sync:GetAccountKey()}
@ -42,7 +42,7 @@ end
function Sync:ProcessTradeSkills(data) function Sync:ProcessTradeSkills(data)
for key, link in pairs(data.tradeSkills) do for key, link in pairs(data.tradeSkills) do
local player, tradeSkill = ("~"):split(key) local player, tradeSkill = ("~"):split(key)
if not (TSM.db.factionrealm.tradeSkills[player] and TSM.db.factionrealm.tradeSkills[player][tradeSkill] and TSM.db.factionrealm.tradeSkills[player][tradeSkill].link == link) then if not (TSM.db.realm.tradeSkills[player] and TSM.db.realm.tradeSkills[player][tradeSkill] and TSM.db.realm.tradeSkills[player][tradeSkill].link == link) then
tinsert(syncQueue, {link=link, accountKey=data.accountKey, player=player}) tinsert(syncQueue, {link=link, accountKey=data.accountKey, player=player})
end end
end end

105
TradeSkillMaster_Crafting/Modules/Util.lua

@ -102,38 +102,14 @@ function Util:ScanCurrentProfession()
if itemID and spellID then if itemID and spellID then
local lNum, hNum = GetTradeSkillNumMade(index) local lNum, hNum = GetTradeSkillNumMade(index)
local numMade = floor(((lNum or 1) + (hNum or 1))/2) local numMade = floor(((lNum or 1) + (hNum or 1))/2)
local hasCD = select(2, GetTradeSkillCooldown(index)) and true or nil local hasCD = GetSpellBaseCooldown(spellID) > 0 and 1 or nil
local mats = {} local mats = {}
if currentTradeSkill == TSM.enchantingName and strfind(itemLink, "enchant:") then if currentTradeSkill == TSM.enchantingName and strfind(itemLink, "enchant:") then
-- mats[VELLUM_ID] = 1
-- local name = TSMAPI:GetSafeItemInfo(VELLUM_ID) or (GetLocale() == "enUS" and "Enchanting Vellum") or nil
-- TSM.db.factionrealm.mats[VELLUM_ID] = TSM.db.factionrealm.mats[VELLUM_ID] or {}
-- TSM.db.factionrealm.mats[VELLUM_ID].name = TSM.db.factionrealm.mats[VELLUM_ID].name or name
local VellumString = "item:"..TSM.VellumInfo[spellID]..":0:0:0:0:0:0" local VellumString = "item:"..TSM.VellumInfo[spellID]..":0:0:0:0:0:0"
-- -- Get Cheapest vellum, lower vellum types can be replaced by III
-- local velName
-- if TSM.VellumInfo[spellID] then
-- velName = GetItemInfo(TSM.VellumInfo[spellID])
-- end
-- if (velName ~= nil) and (not strfind(velName, "III")) then
-- local VellumReplacePrice = TSM.Cost:GetMatCost(VellumString)
-- if strfind(GetSpellInfo(spellID), "Weapon") or strfind(GetSpellInfo(spellID), "Staff")then
-- if VellumReplacePrice > TSM.Cost:GetMatCost("item:43146:0:0:0:0:0:0") then VellumString = "item:43146:0:0:0:0:0:0" end
-- else
-- if VellumReplacePrice > TSM.Cost:GetMatCost("item:43145:0:0:0:0:0:0") then VellumString = "item:4314:0:0:0:0:0:0" end
-- end
-- end
mats[VellumString] = 1 mats[VellumString] = 1
local name = TSMAPI:GetSafeItemInfo(VellumString) or nil local name = TSMAPI:GetSafeItemInfo(VellumString) or nil
TSM.db.factionrealm.mats[VellumString] = TSM.db.factionrealm.mats[VellumString] or {} TSM.db.realm.mats[VellumString] = TSM.db.realm.mats[VellumString] or {}
TSM.db.factionrealm.mats[VellumString].name = TSM.db.factionrealm.mats[VellumString].name or name TSM.db.realm.mats[VellumString].name = TSM.db.realm.mats[VellumString].name or name
numMade = 1 numMade = 1
end end
@ -154,15 +130,15 @@ function Util:ScanCurrentProfession()
end end
mats[matID] = quantity mats[matID] = quantity
TSM.db.factionrealm.mats[matID] = TSM.db.factionrealm.mats[matID] or {} TSM.db.realm.mats[matID] = TSM.db.realm.mats[matID] or {}
TSM.db.factionrealm.mats[matID].name = TSM.db.factionrealm.mats[matID].name or name TSM.db.realm.mats[matID].name = TSM.db.realm.mats[matID].name or name
end end
if isValid then if isValid then
local players = TSM.db.factionrealm.crafts[spellID] and TSM.db.factionrealm.crafts[spellID].players or {} local players = TSM.db.realm.crafts[spellID] and TSM.db.realm.crafts[spellID].players or {}
players[playerName] = true players[playerName] = true
local queued = TSM.db.factionrealm.crafts[spellID] and TSM.db.factionrealm.crafts[spellID].queued or 0 local queued = TSM.db.realm.crafts[spellID] and TSM.db.realm.crafts[spellID].queued or 0
local intermediateQueued = TSM.db.factionrealm.crafts[spellID] and TSM.db.factionrealm.crafts[spellID].intermediateQueued or nil local intermediateQueued = TSM.db.realm.crafts[spellID] and TSM.db.realm.crafts[spellID].intermediateQueued or nil
newCrafts[spellID] = {name=craftName, itemID=itemID, mats=mats, hasCD=hasCD, numResult=numMade, queued=queued, intermediateQueued=intermediateQueued, players=players, profession=currentTradeSkill} newCrafts[spellID] = {name=craftName, itemID=itemID, mats=mats, hasCD=hasCD, numResult=numMade, queued=queued, intermediateQueued=intermediateQueued, players=players, profession=currentTradeSkill}
if not usedItems[itemID] then if not usedItems[itemID] then
usedItems[itemID] = true usedItems[itemID] = true
@ -182,7 +158,7 @@ function Util:ScanCurrentProfession()
end end
-- search for and remove any spells that we can't craft anymore -- search for and remove any spells that we can't craft anymore
for spellID, data in pairs(TSM.db.factionrealm.crafts) do for spellID, data in pairs(TSM.db.realm.crafts) do
if data.profession == currentTradeSkill then if data.profession == currentTradeSkill then
local hasCrafters = false local hasCrafters = false
for player in pairs(data.players) do for player in pairs(data.players) do
@ -193,14 +169,14 @@ function Util:ScanCurrentProfession()
end end
if not hasCrafters then if not hasCrafters then
TSM.db.factionrealm.crafts[spellID] = nil TSM.db.realm.crafts[spellID] = nil
end end
end end
end end
-- save the new craft info -- save the new craft info
for spellID, data in pairs(newCrafts) do for spellID, data in pairs(newCrafts) do
TSM.db.factionrealm.crafts[spellID] = data TSM.db.realm.crafts[spellID] = data
end end
TSM.CraftingGUI:PromptPresetGroups(currentTradeSkill, presetGroupInfo) --Bugged, asks after every login. Not saving prompt result between sessions. Either saving or loading bug (works fine on /reload though). TSM.CraftingGUI:PromptPresetGroups(currentTradeSkill, presetGroupInfo) --Bugged, asks after every login. Not saving prompt result between sessions. Either saving or loading bug (works fine on /reload though).
end end
@ -251,40 +227,15 @@ function Util.ScanSyncedProfessionThread(self)
if itemID and spellID then if itemID and spellID then
local lNum, hNum = GetTradeSkillNumMade(index) local lNum, hNum = GetTradeSkillNumMade(index)
local numMade = floor(((lNum or 1) + (hNum or 1))/2) local numMade = floor(((lNum or 1) + (hNum or 1))/2)
local hasCD = select(2, GetTradeSkillCooldown(index)) and true or nil local hasCD = GetSpellBaseCooldown(spellID) > 0 and 1 or nil
local mats = {} local mats = {}
if currentTradeSkill == TSM.enchantingName and strfind(itemLink, "enchant:") then if currentTradeSkill == TSM.enchantingName and strfind(itemLink, "enchant:") then
-- mats[VELLUM_ID] = 1
-- local name = TSMAPI:GetSafeItemInfo(VELLUM_ID) or (GetLocale() == "enUS" and "Enchanting Vellum") or nil
-- TSM.db.factionrealm.mats[VELLUM_ID] = TSM.db.factionrealm.mats[VELLUM_ID] or {}
-- TSM.db.factionrealm.mats[VELLUM_ID].name = TSM.db.factionrealm.mats[VELLUM_ID].name or name
local VellumString = "item:"..TSM.VellumInfo[spellID]..":0:0:0:0:0:0" local VellumString = "item:"..TSM.VellumInfo[spellID]..":0:0:0:0:0:0"
-- -- Get Cheapest vellum, lower vellum types can be replaced by III
-- local velName
-- if TSM.VellumInfo[spellID] then
-- velName = GetItemInfo(TSM.VellumInfo[spellID])
-- end
-- if (velName ~= nil) and (not strfind(velName, "III")) then
-- local VellumReplacePrice = TSM.Cost:GetMatCost(VellumString)
-- if strfind(GetSpellInfo(spellID), "Weapon") or strfind(GetSpellInfo(spellID), "Staff")then
-- if VellumReplacePrice > TSM.Cost:GetMatCost("item:43146:0:0:0:0:0:0") then VellumString = "item:43146:0:0:0:0:0:0" end
-- else
-- if VellumReplacePrice > TSM.Cost:GetMatCost("item:43145:0:0:0:0:0:0") then VellumString = "item:4314:0:0:0:0:0:0" end
-- end
-- end
mats[VellumString] = 1 mats[VellumString] = 1
local name = TSMAPI:GetSafeItemInfo(VellumString) or nil local name = TSMAPI:GetSafeItemInfo(VellumString) or nil
TSM.db.factionrealm.mats[VellumString] = TSM.db.factionrealm.mats[VellumString] or {} TSM.db.realm.mats[VellumString] = TSM.db.realm.mats[VellumString] or {}
TSM.db.factionrealm.mats[VellumString].name = TSM.db.factionrealm.mats[VellumString].name or name TSM.db.realm.mats[VellumString].name = TSM.db.realm.mats[VellumString].name or name
numMade = 1 numMade = 1
end end
@ -305,15 +256,15 @@ function Util.ScanSyncedProfessionThread(self)
end end
mats[matID] = quantity mats[matID] = quantity
TSM.db.factionrealm.mats[matID] = TSM.db.factionrealm.mats[matID] or {} TSM.db.realm.mats[matID] = TSM.db.realm.mats[matID] or {}
TSM.db.factionrealm.mats[matID].name = TSM.db.factionrealm.mats[matID].name or name TSM.db.realm.mats[matID].name = TSM.db.realm.mats[matID].name or name
end end
if isValid then if isValid then
local players = TSM.db.factionrealm.crafts[spellID] and TSM.db.factionrealm.crafts[spellID].players or {} local players = TSM.db.realm.crafts[spellID] and TSM.db.realm.crafts[spellID].players or {}
players[playerName] = true players[playerName] = true
local queued = TSM.db.factionrealm.crafts[spellID] and TSM.db.factionrealm.crafts[spellID].queued or 0 local queued = TSM.db.realm.crafts[spellID] and TSM.db.realm.crafts[spellID].queued or 0
local intermediateQueued = TSM.db.factionrealm.crafts[spellID] and TSM.db.factionrealm.crafts[spellID].intermediateQueued or nil local intermediateQueued = TSM.db.realm.crafts[spellID] and TSM.db.realm.crafts[spellID].intermediateQueued or nil
newCrafts[spellID] = {name=craftName, itemID=itemID, mats=mats, hasCD=hasCD, numResult=numMade, queued=queued, intermediateQueued=intermediateQueued, players=players, profession=currentTradeSkill} newCrafts[spellID] = {name=craftName, itemID=itemID, mats=mats, hasCD=hasCD, numResult=numMade, queued=queued, intermediateQueued=intermediateQueued, players=players, profession=currentTradeSkill}
end end
end end
@ -323,7 +274,7 @@ function Util.ScanSyncedProfessionThread(self)
end end
-- search for and remove any spells that we can't craft anymore -- search for and remove any spells that we can't craft anymore
for spellID, data in pairs(TSM.db.factionrealm.crafts) do for spellID, data in pairs(TSM.db.realm.crafts) do
if data.profession == currentTradeSkill then if data.profession == currentTradeSkill then
local hasCrafters = false local hasCrafters = false
for player in pairs(data.players) do for player in pairs(data.players) do
@ -334,23 +285,23 @@ function Util.ScanSyncedProfessionThread(self)
end end
if not hasCrafters then if not hasCrafters then
TSM.db.factionrealm.crafts[spellID] = nil TSM.db.realm.crafts[spellID] = nil
end end
end end
end end
-- save the new craft info -- save the new craft info
for spellID, data in pairs(newCrafts) do for spellID, data in pairs(newCrafts) do
TSM.db.factionrealm.crafts[spellID] = data TSM.db.realm.crafts[spellID] = data
end end
local playerName = select(2, IsTradeSkillLinked()) local playerName = select(2, IsTradeSkillLinked())
local skillName, level, maxLevel = GetTradeSkillLine() local skillName, level, maxLevel = GetTradeSkillLine()
TSM.db.factionrealm.tradeSkills[playerName] = TSM.db.factionrealm.tradeSkills[playerName] or {} TSM.db.realm.tradeSkills[playerName] = TSM.db.realm.tradeSkills[playerName] or {}
TSM.db.factionrealm.tradeSkills[playerName][skillName] = TSM.db.factionrealm.tradeSkills[playerName][skillName] or {} TSM.db.realm.tradeSkills[playerName][skillName] = TSM.db.realm.tradeSkills[playerName][skillName] or {}
TSM.db.factionrealm.tradeSkills[playerName][skillName].link = TSM.isSyncing.link TSM.db.realm.tradeSkills[playerName][skillName].link = TSM.isSyncing.link
TSM.db.factionrealm.tradeSkills[playerName][skillName].accountKey = TSM.isSyncing.accountKey TSM.db.realm.tradeSkills[playerName][skillName].accountKey = TSM.isSyncing.accountKey
TSM.db.factionrealm.tradeSkills[playerName][skillName].level = level TSM.db.realm.tradeSkills[playerName][skillName].level = level
TSM.db.factionrealm.tradeSkills[playerName][skillName].maxLevel = maxLevel TSM.db.realm.tradeSkills[playerName][skillName].maxLevel = maxLevel
end end
function Util:GetSpellID(index) function Util:GetSpellID(index)

567
TradeSkillMaster_Crafting/Modules/VellumInfo.lua

@ -2,262 +2,311 @@
local TSM = select(2, ...) local TSM = select(2, ...)
TSM.VellumInfo = { TSM.VellumInfo = {
[7418] = 38682, [7418] = 52510,
[7420] = 38682, [7420] = 52510,
[7426] = 38682, [7426] = 52510,
[7428] = 38682, [7428] = 52510,
[7443] = 38682, [7443] = 52510,
[7454] = 38682, [7454] = 52510,
[7457] = 38682, [7457] = 52510,
[7745] = 39349, [7745] = 52511,
[7748] = 38682, [7748] = 52510,
[7766] = 38682, [7766] = 52510,
[7771] = 38682, [7771] = 52510,
[7776] = 38682, [7776] = 52510,
[7779] = 38682, [7779] = 52510,
[7782] = 38682, [7782] = 52510,
[7786] = 39349, [7786] = 52511,
[7788] = 39349, [7788] = 52511,
[7793] = 39349, [7793] = 52511,
[7857] = 38682, [7857] = 52510,
[7859] = 38682, [7859] = 52510,
[7861] = 38682, [7861] = 52510,
[7863] = 38682, [7863] = 52510,
[7867] = 38682, [7867] = 52510,
[13378] = 38682, [13378] = 52510,
[13380] = 39349, [13380] = 52511,
[13419] = 38682, [13419] = 52510,
[13421] = 38682, [13421] = 52510,
[13464] = 38682, [13464] = 52510,
[13485] = 38682, [13485] = 52510,
[13501] = 38682, [13501] = 52510,
[13503] = 39349, [13503] = 52511,
[13522] = 38682, [13522] = 52510,
[13529] = 39349, [13529] = 52511,
[13536] = 38682, [13536] = 52510,
[13538] = 38682, [13538] = 52510,
[13607] = 38682, [13607] = 52510,
[13612] = 38682, [13612] = 52510,
[13617] = 38682, [13617] = 52510,
[13620] = 38682, [13620] = 52510,
[13622] = 38682, [13622] = 52510,
[13626] = 38682, [13626] = 52510,
[13631] = 38682, [13631] = 52510,
[13635] = 38682, [13635] = 52510,
[13637] = 38682, [13637] = 52510,
[13640] = 38682, [13640] = 52510,
[13642] = 38682, [13642] = 52510,
[13644] = 38682, [13644] = 52510,
[13646] = 38682, [13646] = 52510,
[13648] = 38682, [13648] = 52510,
[13653] = 39349, [13653] = 52511,
[13655] = 39349, [13655] = 52511,
[13657] = 38682, [13657] = 52510,
[13659] = 38682, [13659] = 52510,
[13661] = 38682, [13661] = 52510,
[13663] = 38682, [13663] = 52510,
[13687] = 38682, [13687] = 52510,
[13689] = 38682, [13689] = 52510,
[13693] = 39349, [13693] = 52511,
[13695] = 39349, [13695] = 52511,
[13698] = 38682, [13698] = 52510,
[13700] = 38682, [13700] = 52510,
[13746] = 38682, [13746] = 52510,
[13794] = 38682, [13794] = 52510,
[13815] = 38682, [13815] = 52510,
[13817] = 38682, [13817] = 52510,
[13822] = 38682, [13822] = 52510,
[13836] = 38682, [13836] = 52510,
[13841] = 38682, [13841] = 52510,
[13846] = 38682, [13846] = 52510,
[13858] = 38682, [13858] = 52510,
[13868] = 38682, [13868] = 52510,
[13882] = 38682, [13882] = 52510,
[13887] = 38682, [13887] = 52510,
[13890] = 38682, [13890] = 52510,
[13898] = 39349, [13898] = 52511,
[13905] = 38682, [13905] = 52510,
[13915] = 39349, [13915] = 52511,
[13917] = 38682, [13917] = 52510,
[13931] = 38682, [13931] = 52510,
[13933] = 38682, [13933] = 52510,
[13935] = 38682, [13935] = 52510,
[13937] = 39349, [13937] = 52511,
[13939] = 38682, [13939] = 52510,
[13941] = 38682, [13941] = 52510,
[13943] = 39349, [13943] = 52511,
[13945] = 38682, [13945] = 52510,
[13947] = 38682, [13947] = 52510,
[13948] = 38682, [13948] = 52510,
[20008] = 38682, [20008] = 52510,
[20009] = 38682, [20009] = 52510,
[20010] = 38682, [20010] = 52510,
[20011] = 38682, [20011] = 52510,
[20012] = 38682, [20012] = 52510,
[20013] = 38682, [20013] = 52510,
[20014] = 38682, [20014] = 52510,
[20015] = 38682, [20015] = 52510,
[20016] = 38682, [20016] = 52510,
[20017] = 38682, [20017] = 52510,
[20020] = 38682, [20020] = 52510,
[20023] = 38682, [20023] = 52510,
[20024] = 38682, [20024] = 52510,
[20025] = 38682, [20025] = 52510,
[20026] = 38682, [20026] = 52510,
[20028] = 38682, [20028] = 52510,
[20029] = 39349, [20029] = 52511,
[20030] = 39349, [20030] = 52511,
[20031] = 39349, [20031] = 52511,
[20032] = 39349, [20032] = 52511,
[20033] = 39349, [20033] = 52511,
[20034] = 39349, [20034] = 52511,
[20035] = 39349, [20035] = 52511,
[20036] = 39349, [20036] = 52511,
[21931] = 39349, [21931] = 52511,
[22749] = 39349, [22749] = 52511,
[22750] = 39349, [22750] = 52511,
[23799] = 39349, [23799] = 52511,
[23800] = 39349, [23800] = 52511,
[23801] = 38682, [23801] = 52510,
[23802] = 38682, [23802] = 52510,
[23803] = 39349, [23803] = 52511,
[23804] = 39349, [23804] = 52511,
[25072] = 38682, [25072] = 52510,
[25073] = 38682, [25073] = 52510,
[25074] = 38682, [25074] = 52510,
[25078] = 38682, [25078] = 52510,
[25079] = 38682, [25079] = 52510,
[25080] = 38682, [25080] = 52510,
[25081] = 38682, [25081] = 52510,
[25082] = 38682, [25082] = 52510,
[25083] = 38682, [25083] = 52510,
[25084] = 38682, [25084] = 52510,
[25086] = 37602, [25086] = 52510,
[27837] = 39349, [27837] = 52511,
[27899] = 37602, [27899] = 52510,
[27905] = 37602, [27905] = 52510,
[27906] = 37602, [27906] = 52510,
[27911] = 37602, [27911] = 52510,
[27913] = 37602, [27913] = 52510,
[27914] = 37602, [27914] = 52510,
[27917] = 37602, [27917] = 52510,
[27944] = 37602, [27944] = 52510,
[27945] = 37602, [27945] = 52510,
[27946] = 37602, [27946] = 52510,
[27947] = 37602, [27947] = 52510,
[27948] = 37602, [27948] = 52510,
[27950] = 37602, [27950] = 52510,
[27951] = 37602, [27951] = 52510,
[27954] = 37602, [27954] = 52510,
[27957] = 37602, [27957] = 52510,
[27958] = 43145, [27958] = 52510,
[27960] = 37602, [27960] = 52510,
[27961] = 37602, [27961] = 52510,
[27962] = 37602, [27962] = 52510,
[27967] = 39350, [27967] = 52511,
[27968] = 39350, [27968] = 52511,
[27971] = 39350, [27971] = 52511,
[27972] = 39350, [27972] = 52511,
[27975] = 39350, [27975] = 52511,
[27977] = 39350, [27977] = 52511,
[27981] = 39350, [27981] = 52511,
[27982] = 39350, [27982] = 52511,
[27984] = 39350, [27984] = 52511,
[28003] = 39350, [28003] = 52511,
[28004] = 39350, [28004] = 52511,
[33990] = 37602, [33990] = 52510,
[33991] = 37602, [33991] = 52510,
[33992] = 37602, [33992] = 52510,
[33993] = 37602, [33993] = 52510,
[33994] = 37602, [33994] = 52510,
[33995] = 37602, [33995] = 52510,
[33996] = 37602, [33996] = 52510,
[33997] = 37602, [33997] = 52510,
[33999] = 37602, [33999] = 52510,
[34001] = 37602, [34001] = 52510,
[34002] = 37602, [34002] = 52510,
[34003] = 37602, [34003] = 52510,
[34004] = 37602, [34004] = 52510,
[34005] = 37602, [34005] = 52510,
[34006] = 37602, [34006] = 52510,
[34007] = 37602, [34007] = 52510,
[34008] = 37602, [34008] = 52510,
[34009] = 37602, [34009] = 52510,
[34010] = 39350, [34010] = 52511,
[42620] = 39350, [42620] = 52511,
[42974] = 43146, [42974] = 52511,
[44383] = 37602, [44383] = 52510,
[44483] = 43145, [44483] = 52510,
[44484] = 43145, [44484] = 52510,
[44488] = 43145, [44488] = 52510,
[44489] = 43145, [44489] = 52510,
[44492] = 43145, [44492] = 52510,
[44494] = 43145, [44494] = 52510,
[44500] = 43145, [44500] = 52510,
[44506] = 43145, [44506] = 52510,
[44508] = 43145, [44508] = 52510,
[44509] = 43145, [44509] = 52510,
[44510] = 43146, [44510] = 52511,
[44513] = 43145, [44513] = 52510,
[44524] = 43146, [44524] = 52511,
[44528] = 43145, [44528] = 52510,
[44529] = 43145, [44529] = 52510,
[44555] = 43145, [44555] = 52510,
[44556] = 43145, [44556] = 52510,
[44575] = 43145, [44575] = 52510,
[44576] = 43146, [44576] = 52511,
[44582] = 43145, [44582] = 52510,
[44584] = 43145, [44584] = 52510,
[44588] = 43145, [44588] = 52510,
[44589] = 43145, [44589] = 52510,
[44590] = 43145, [44590] = 52510,
[44591] = 43145, [44591] = 52510,
[44592] = 43145, [44592] = 52510,
[44593] = 43145, [44593] = 52510,
[44595] = 43146, [44595] = 52511,
[44596] = 43145, [44596] = 52510,
[44598] = 43145, [44598] = 52510,
[44612] = 43145, [44612] = 52510,
[44616] = 43145, [44616] = 52510,
[44621] = 43146, [44621] = 52511,
[44623] = 43145, [44623] = 52510,
[44625] = 43145, [44625] = 52510,
[44629] = 43146, [44629] = 52511,
[44630] = 43146, [44630] = 52511,
[44631] = 43145, [44631] = 52510,
[44633] = 43146, [44633] = 52511,
[44635] = 43145, [44635] = 52510,
[46578] = 43146, [46578] = 52511,
[46594] = 37602, [46594] = 52510,
[47051] = 37602, [47051] = 52510,
[47672] = 43145, [47672] = 52510,
[47766] = 43145, [47766] = 52510,
[47898] = 43145, [47898] = 52510,
[47899] = 43145, [47899] = 52510,
[47900] = 43145, [47900] = 52510,
[47901] = 43145, [47901] = 52510,
[59619] = 43146, [59619] = 52511,
[59621] = 43146, [59621] = 52511,
[59625] = 43146, [59625] = 52511,
[60606] = 43145, [60606] = 52510,
[60609] = 43145, [60609] = 52510,
[60616] = 43145, [60616] = 52510,
[60621] = 43146, [60621] = 52511,
[60623] = 43145, [60623] = 52510,
[60653] = 43145, [60653] = 52510,
[60663] = 43145, [60663] = 52510,
[60668] = 43145, [60668] = 52510,
[60691] = 43146, [60691] = 52511,
[60692] = 43145, [60692] = 52510,
[60707] = 43146, [60707] = 52511,
[60714] = 43146, [60714] = 52511,
[60763] = 43145, [60763] = 52510,
[60767] = 43145, [60767] = 52510,
[62256] = 43145, [62256] = 52510,
[62257] = 43146, [62257] = 52511,
[62948] = 43146, [62948] = 52511,
[62959] = 43146, [62959] = 52511,
[63746] = 38682, [63746] = 52510,
[64441] = 39349, [64441] = 52511,
[64579] = 39349, [64579] = 52511,
[71692] = 38682} [71692] = 52510,
[968676] = 52511,
[968677] = 52511,
[968678] = 52511,
[968679] = 52511,
[968680] = 52511,
[968681] = 52511,
[968682] = 52511,
[968683] = 52511,
[968684] = 52511,
[968685] = 52511,
[968686] = 52511,
[968687] = 52511,
[968688] = 52511,
[968689] = 52511,
[968690] = 52511,
[968691] = 52511,
[968692] = 52511,
[968693] = 52511,
[968694] = 52511,
[968695] = 52511,
[968696] = 52511,
[968697] = 52511,
[968698] = 52511,
[968699] = 52511,
[968700] = 52511,
[968701] = 52511,
[968702] = 52511,
[968770] = 52511,
[968771] = 52511,
[1968677] = 52511,
[1968678] = 52511,
[1968680] = 52511,
[1968681] = 52511,
[1968683] = 52511,
[1968684] = 52511,
[1968686] = 52511,
[1968687] = 52511,
[1968689] = 52511,
[1968690] = 52511,
[1968692] = 52511,
[1968693] = 52511,
[1968695] = 52511,
[1968696] = 52511,
[1968698] = 52511,
[1968699] = 52511,
[1968701] = 52511,
[1968702] = 52511,
[1968770] = 52511,
[1968771] = 52511}

135
TradeSkillMaster_Crafting/TradeSkillMaster_Crafting.lua

@ -30,7 +30,7 @@ local savedDBDefaults = {
showingDefaultFrame = nil, showingDefaultFrame = nil,
matsInTooltip = true, matsInTooltip = true,
}, },
factionrealm = { realm = {
tradeSkills = {}, tradeSkills = {},
crafts = {}, crafts = {},
mats = {}, mats = {},
@ -56,78 +56,30 @@ function TSM:OnEnable()
TSM:RegisterModule() TSM:RegisterModule()
-- fix vellum issue -- fix vellum issue
for spellid, data in pairs(TSM.db.factionrealm.crafts) do for spellid, data in pairs(TSM.db.realm.crafts) do
for itemString in pairs(data.mats) do for itemString in pairs(data.mats) do
-- if itemString == "item:38682" then if itemString == "item:52510" then
-- TSM.db.factionrealm.crafts[spellid].mats["item:38682:0:0:0:0:0:0"] = 1 TSM.db.realm.crafts[spellid].mats["item:52510:0:0:0:0:0:0"] = 1
if itemString == "item:43146" then TSM.db.realm.crafts[spellid].mats[itemString] = nil
TSM.db.factionrealm.crafts[spellid].mats["item:43146:0:0:0:0:0:0"] = 1 elseif itemString == "item:52511" then
TSM.db.factionrealm.crafts[spellid].mats[itemString] = nil TSM.db.realm.crafts[spellid].mats["item:52511:0:0:0:0:0:0"] = 1
elseif itemString == "item:43145" then TSM.db.realm.crafts[spellid].mats[itemString] = nil
TSM.db.factionrealm.crafts[spellid].mats["item:43145:0:0:0:0:0:0"] = 1
TSM.db.factionrealm.crafts[spellid].mats[itemString] = nil
elseif itemString == "item:39350" then
TSM.db.factionrealm.crafts[spellid].mats["item:39350:0:0:0:0:0:0"] = 1
TSM.db.factionrealm.crafts[spellid].mats[itemString] = nil
elseif itemString == "item:37602" then
TSM.db.factionrealm.crafts[spellid].mats["item:37602:0:0:0:0:0:0"] = 1
TSM.db.factionrealm.crafts[spellid].mats[itemString] = nil
elseif itemString == "item:39349" then
TSM.db.factionrealm.crafts[spellid].mats["item:39349:0:0:0:0:0:0"] = 1
TSM.db.factionrealm.crafts[spellid].mats[itemString] = nil
elseif itemString == "item:38682" then
TSM.db.factionrealm.crafts[spellid].mats["item:38682:0:0:0:0:0:0"] = 1
TSM.db.factionrealm.crafts[spellid].mats[itemString] = nil
end end
end end
end end
-- if TSM.db.factionrealm.mats["item:38682"] then -- if currently casting a spell, keep track of the id
-- local name = TSMAPI:GetSafeItemInfo("item:38682:0:0:0:0:0:0") or (GetLocale() == "enUS" and "Enchanting Vellum") or nil TSM.currentspell = nil
-- TSM.db.factionrealm.mats["item:38682:0:0:0:0:0:0"] = {} if TSM.db.realm.mats["item:52510"] then
-- TSM.db.factionrealm.mats["item:38682:0:0:0:0:0:0"].name = name local name = TSMAPI:GetSafeItemInfo("item:52510:0:0:0:0:0:0") or nil
-- TSM.db.factionrealm.mats["item:38682"] = nil TSM.db.realm.mats["item:52510:0:0:0:0:0:0"] = {}
-- end TSM.db.realm.mats["item:52510:0:0:0:0:0:0"].name = name
if TSM.db.factionrealm.mats["item:43146"] then TSM.db.realm.mats["item:52510"] = nil
local name = TSMAPI:GetSafeItemInfo("item:43146:0:0:0:0:0:0") or nil
TSM.db.factionrealm.mats["item:43146:0:0:0:0:0:0"] = {}
TSM.db.factionrealm.mats["item:43146:0:0:0:0:0:0"].name = name
TSM.db.factionrealm.mats["item:43146"] = nil
end end
if TSM.db.factionrealm.mats["item:43145"] then if TSM.db.realm.mats["item:52511"] then
local name = TSMAPI:GetSafeItemInfo("item:43145:0:0:0:0:0:0") or nil local name = TSMAPI:GetSafeItemInfo("item:52511:0:0:0:0:0:0") or nil
TSM.db.factionrealm.mats["item:43145:0:0:0:0:0:0"] = {} TSM.db.realm.mats["item:52511:0:0:0:0:0:0"] = {}
TSM.db.factionrealm.mats["item:43145:0:0:0:0:0:0"].name = name TSM.db.realm.mats["item:52511:0:0:0:0:0:0"].name = name
TSM.db.factionrealm.mats["item:43145"] = nil TSM.db.realm.mats["item:52511"] = nil
end
if TSM.db.factionrealm.mats["item:39350"] then
local name = TSMAPI:GetSafeItemInfo("item:39350:0:0:0:0:0:0") or nil
TSM.db.factionrealm.mats["item:39350:0:0:0:0:0:0"] = {}
TSM.db.factionrealm.mats["item:39350:0:0:0:0:0:0"].name = name
TSM.db.factionrealm.mats["item:39350"] = nil
end
if TSM.db.factionrealm.mats["item:39350"] then
local name = TSMAPI:GetSafeItemInfo("item:39350:0:0:0:0:0:0") or nil
TSM.db.factionrealm.mats["item:39350:0:0:0:0:0:0"] = {}
TSM.db.factionrealm.mats["item:39350:0:0:0:0:0:0"].name = name
TSM.db.factionrealm.mats["item:39350"] = nil
end
if TSM.db.factionrealm.mats["item:37602"] then
local name = TSMAPI:GetSafeItemInfo("item:37602:0:0:0:0:0:0") or nil
TSM.db.factionrealm.mats["item:37602:0:0:0:0:0:0"] = {}
TSM.db.factionrealm.mats["item:37602:0:0:0:0:0:0"].name = name
TSM.db.factionrealm.mats["item:37602"] = nil
end
if TSM.db.factionrealm.mats["item:39349"] then
local name = TSMAPI:GetSafeItemInfo("item:39349:0:0:0:0:0:0") or nil
TSM.db.factionrealm.mats["item:39349:0:0:0:0:0:0"] = {}
TSM.db.factionrealm.mats["item:39349:0:0:0:0:0:0"].name = name
TSM.db.factionrealm.mats["item:39349"] = nil
end
if TSM.db.factionrealm.mats["item:38682"] then
local name = TSMAPI:GetSafeItemInfo("item:38682:0:0:0:0:0:0") or nil
TSM.db.factionrealm.mats["item:38682:0:0:0:0:0:0"] = {}
TSM.db.factionrealm.mats["item:38682:0:0:0:0:0:0"].name = name
TSM.db.factionrealm.mats["item:38682"] = nil
end end
local func, err = TSMAPI:ParseCustomPrice(TSM.db.global.defaultCraftPriceMethod, "crafting") local func, err = TSMAPI:ParseCustomPrice(TSM.db.global.defaultCraftPriceMethod, "crafting")
@ -176,7 +128,7 @@ TSM.operationDefaults = {
minProfit = 1000000, minProfit = 1000000,
craftPriceMethod = nil, craftPriceMethod = nil,
ignorePlayer = {}, ignorePlayer = {},
ignoreFactionrealm = {}, ignorerealm = {},
relationships = {}, relationships = {},
} }
@ -233,38 +185,11 @@ function TSM:GetTooltip(itemString)
tinsert(text, { left = " " .. L["Crafting Cost"], right = format("%s", costText) }) tinsert(text, { left = " " .. L["Crafting Cost"], right = format("%s", costText) })
end end
if TSM.db.global.matsInTooltip and TSM.db.factionrealm.crafts[spellID] then if TSM.db.global.matsInTooltip and TSM.db.realm.crafts[spellID] then
for matItemString, matQuantity in pairs(TSM.db.factionrealm.crafts[spellID].mats) do for matItemString, matQuantity in pairs(TSM.db.realm.crafts[spellID].mats) do
local name, _, quality = TSMAPI:GetSafeItemInfo(matItemString) local name, _, quality = TSMAPI:GetSafeItemInfo(matItemString)
if name then if name then
local mat = TSM.db.factionrealm.mats[matItemString] local mat = TSM.db.realm.mats[matItemString]
-- Get Cheapest vellum, lower vellum types can be replaced by III
local velName
if strfind(name, "Vellum") then
velName = name
end
if (velName ~= nil) and (not strfind(velName, "III")) then
local VellumReplacePrice = TSM.Cost:GetMatCost(matItemString)
if strfind(velName, "Weapon Vellum") then
if VellumReplacePrice > TSM.Cost:GetMatCost("item:43146:0:0:0:0:0:0") then
matItemString = "item:43146:0:0:0:0:0:0"
name = TSMAPI:GetSafeItemInfo(matItemString)
end
else
if VellumReplacePrice > TSM.Cost:GetMatCost("item:43145:0:0:0:0:0:0") then
matItemString = "item:43145:0:0:0:0:0:0"
name = TSMAPI:GetSafeItemInfo(matItemString)
end
end
end
if mat then if mat then
local cost = TSM:GetCustomPrice(mat.customValue or TSM.db.global.defaultMatCostMethod, matItemString) local cost = TSM:GetCustomPrice(mat.customValue or TSM.db.global.defaultMatCostMethod, matItemString)
if cost then if cost then
@ -292,7 +217,7 @@ function TSM:GetTooltip(itemString)
end end
end end
if TSM.db.global.materialTooltip then if TSM.db.global.materialTooltip then
local mat = TSM.db.factionrealm.mats[itemString] local mat = TSM.db.realm.mats[itemString]
if mat then if mat then
local cost = TSM:GetCustomPrice(mat.customValue or TSM.db.global.defaultMatCostMethod, itemString) local cost = TSM:GetCustomPrice(mat.customValue or TSM.db.global.defaultMatCostMethod, itemString)
if cost then if cost then
@ -322,9 +247,9 @@ function TSM:GetCraftingCost(link)
TSM:UpdateCraftReverseLookup() TSM:UpdateCraftReverseLookup()
local _, cost = TSM.Cost:GetLowestCraftPrices(itemString) local _, cost = TSM.Cost:GetLowestCraftPrices(itemString)
if cost then if cost then
TSM.db.factionrealm.craftingCostCache[itemString] = cost TSM.db.realm.craftingCostCache[itemString] = cost
end end
return TSM.db.factionrealm.craftingCostCache[itemString] return TSM.db.realm.craftingCostCache[itemString]
end end
function TSM:GetCraftingMatCost(link) function TSM:GetCraftingMatCost(link)
@ -342,7 +267,7 @@ function TSM:UpdateCraftReverseLookup()
reverseLookupUpdate = time() reverseLookupUpdate = time()
TSM.craftReverseLookup = {} TSM.craftReverseLookup = {}
for spellID, data in pairs(TSM.db.factionrealm.crafts) do for spellID, data in pairs(TSM.db.realm.crafts) do
TSM.craftReverseLookup[data.itemID] = TSM.craftReverseLookup[data.itemID] or {} TSM.craftReverseLookup[data.itemID] = TSM.craftReverseLookup[data.itemID] or {}
tinsert(TSM.craftReverseLookup[data.itemID], spellID) tinsert(TSM.craftReverseLookup[data.itemID], spellID)
end end
@ -355,7 +280,7 @@ end
function TSM:getCDCrafts() function TSM:getCDCrafts()
local crafts = {} local crafts = {}
for spellID, data in pairs(TSM.db.factionrealm.crafts) do for spellID, data in pairs(TSM.db.realm.crafts) do
if data.hasCD then if data.hasCD then
crafts[spellID] = data.name crafts[spellID] = data.name
end end
@ -392,7 +317,7 @@ function TSM:RestockHelp(link)
-- check that this item is craftable -- check that this item is craftable
TSM:UpdateCraftReverseLookup() TSM:UpdateCraftReverseLookup()
local spellID = TSM.craftReverseLookup[itemString] and TSM.craftReverseLookup[itemString][1] local spellID = TSM.craftReverseLookup[itemString] and TSM.craftReverseLookup[itemString][1]
if not spellID or not TSM.db.factionrealm.crafts[spellID] then if not spellID or not TSM.db.realm.crafts[spellID] then
return print("You don't know how to craft this item.") return print("You don't know how to craft this item.")
end end

6
TradeSkillMaster_ItemTracker/Modules/config.lua

@ -130,7 +130,7 @@ function Config:LoadInventoryViewer(container)
filters.characters[name] = true filters.characters[name] = true
end end
for name in pairs(TSM.guilds) do for name in pairs(TSM.guilds) do
if not TSM.db.factionrealm.ignoreGuilds[name] then if not TSM.db.realm.ignoreGuilds[name] then
guildList[name] = name guildList[name] = name
filters.guilds[name] = true filters.guilds[name] = true
end end
@ -315,12 +315,12 @@ function Config:LoadOptions(container)
{ {
type = "Dropdown", type = "Dropdown",
label = L["Guilds (Guild Banks) to Ignore:"], label = L["Guilds (Guild Banks) to Ignore:"],
value = TSM.db.factionrealm.ignoreGuilds, value = TSM.db.realm.ignoreGuilds,
list = guildList, list = guildList,
relativeWidth = 0.49, relativeWidth = 0.49,
multiselect = true, multiselect = true,
callback = function(_, _, key, value) callback = function(_, _, key, value)
TSM.db.factionrealm.ignoreGuilds[key] = value TSM.db.realm.ignoreGuilds[key] = value
end, end,
tooltip = L["Select guilds to ingore in ItemTracker. Inventory will still be tracked but not displayed or taken into consideration by Itemtracker."], tooltip = L["Select guilds to ingore in ItemTracker. Inventory will still be tracked but not displayed or taken into consideration by Itemtracker."],
}, },

24
TradeSkillMaster_ItemTracker/TradeSkillMaster_ItemTracker.lua

@ -19,7 +19,7 @@ local savedDBDefaults = {
}, },
-- data that is stored per realm/faction combination -- data that is stored per realm/faction combination
factionrealm = { realm = {
characters = {}, characters = {},
guilds = {}, guilds = {},
ignoreGuilds = {}, ignoreGuilds = {},
@ -64,7 +64,7 @@ function TSM:OnInitialize()
-- handle connected realms for characters -- handle connected realms for characters
local connectedRealms = TSMAPI.GetConnectedRealms and TSMAPI:GetConnectedRealms() or {} local connectedRealms = TSMAPI.GetConnectedRealms and TSMAPI:GetConnectedRealms() or {}
for _, realm in ipairs(connectedRealms) do for _, realm in ipairs(connectedRealms) do
local connectedRealmData = TSM.db.sv.factionrealm[TSM.db.keys.faction.." - "..realm] local connectedRealmData = TSM.db.sv.realm[TSM.db.keys.faction.." - "..realm]
if connectedRealmData and connectedRealmData.characters then if connectedRealmData and connectedRealmData.characters then
for player, data in pairs(connectedRealmData.characters) do for player, data in pairs(connectedRealmData.characters) do
TSM.characters[player.."-"..realm] = data TSM.characters[player.."-"..realm] = data
@ -193,7 +193,7 @@ function TSM:GetTooltip(itemString)
end end
for name, data in pairs(TSM.guilds) do for name, data in pairs(TSM.guilds) do
if not TSM.db.factionrealm.ignoreGuilds[name] then if not TSM.db.realm.ignoreGuilds[name] then
local gbank = data.items[itemString] or 0 local gbank = data.items[itemString] or 0
grandTotal = grandTotal + gbank grandTotal = grandTotal + gbank
@ -214,25 +214,25 @@ function TSM:GetTooltip(itemString)
end end
function TSM:OnTSMDBShutdown() function TSM:OnTSMDBShutdown()
TSM.db.factionrealm.characters = {} TSM.db.realm.characters = {}
local faction = TSM.db.keys.faction local faction = TSM.db.keys.faction
for name, playerData in pairs(TSM.characters) do for name, playerData in pairs(TSM.characters) do
local player, realm = ("-"):split(name) local player, realm = ("-"):split(name)
if realm and realm ~= "" then if realm and realm ~= "" then
local factionrealm = faction.." - "..realm local realm = faction.." - "..realm
for key, data in pairs(TSM.db.sv.factionrealm) do for key, data in pairs(TSM.db.sv.realm) do
if key == factionrealm then if key == realm then
data[player] = playerData data[player] = playerData
break break
end end
end end
else else
TSM.db.factionrealm.characters[player] = playerData TSM.db.realm.characters[player] = playerData
end end
end end
-- not yet handling guilds for connected realms -- not yet handling guilds for connected realms
TSM.db.factionrealm.guilds = TSM.guilds TSM.db.realm.guilds = TSM.guilds
end end
function TSM:UpdatePlayerLookup() function TSM:UpdatePlayerLookup()
@ -281,7 +281,7 @@ end
function TSM:GetGuildBank(guild) function TSM:GetGuildBank(guild)
guild = guild or TSM.CURRENT_GUILD guild = guild or TSM.CURRENT_GUILD
if not guild or not TSM.guilds[guild] or TSM.db.factionrealm.ignoreGuilds[guild] then return end if not guild or not TSM.guilds[guild] or TSM.db.realm.ignoreGuilds[guild] then return end
return TSM.guilds[guild].items return TSM.guilds[guild].items
end end
@ -313,7 +313,7 @@ end
function TSM:GetGuildTotal(itemString) function TSM:GetGuildTotal(itemString)
local guildTotal = 0 local guildTotal = 0
for guild, data in pairs(TSM.guilds) do for guild, data in pairs(TSM.guilds) do
if not TSM.db.factionrealm.ignoreGuilds[guild] then if not TSM.db.realm.ignoreGuilds[guild] then
guildTotal = guildTotal + (data.items[itemString] or 0) guildTotal = guildTotal + (data.items[itemString] or 0)
end end
end end
@ -333,7 +333,7 @@ function TSM:GetPlayerGuildTotal(itemString, player)
player = TSM.playerLookup[player] or player player = TSM.playerLookup[player] or player
if not player or not TSM.characters[player] then return end if not player or not TSM.characters[player] then return end
local guild = TSM.characters[player].guild local guild = TSM.characters[player].guild
if not guild or not TSM.guilds[guild] or TSM.db.factionrealm.ignoreGuilds[guild] then return end if not guild or not TSM.guilds[guild] or TSM.db.realm.ignoreGuilds[guild] then return end
return TSM.guilds[guild].items[itemString] return TSM.guilds[guild].items[itemString]
end end

10
TradeSkillMaster_Mailing/Modules/Other.lua

@ -57,16 +57,16 @@ function private:CreateDisenchantBox(frame)
targetBox:SetPoint("TOPLEFT", targetBoxLabel, "TOPRIGHT", 5, 0) targetBox:SetPoint("TOPLEFT", targetBoxLabel, "TOPRIGHT", 5, 0)
targetBox:SetPoint("TOPRIGHT", -5, -30) targetBox:SetPoint("TOPRIGHT", -5, -30)
targetBox:SetHeight(20) targetBox:SetHeight(20)
targetBox:SetText(TSM.db.factionrealm.deMailTarget) targetBox:SetText(TSM.db.realm.deMailTarget)
targetBox:SetScript("OnEnterPressed", function(self) targetBox:SetScript("OnEnterPressed", function(self)
TSM.db.factionrealm.deMailTarget = self:GetText():trim() TSM.db.realm.deMailTarget = self:GetText():trim()
self:ClearFocus() self:ClearFocus()
frame.btn:Update() frame.btn:Update()
end) end)
targetBox.tooltip = L["Enter name of the character disenchantable greens should be sent to."].."\n\n"..TSM.SPELLING_WARNING targetBox.tooltip = L["Enter name of the character disenchantable greens should be sent to."].."\n\n"..TSM.SPELLING_WARNING
local function OnClick() local function OnClick()
local target = TSM.db.factionrealm.deMailTarget local target = TSM.db.realm.deMailTarget
if target == "" then return end if target == "" then return end
local items = {} local items = {}
local hasItems local hasItems
@ -94,9 +94,9 @@ function private:CreateDisenchantBox(frame)
btn:SetScript("OnClick", OnClick) btn:SetScript("OnClick", OnClick)
btn.tooltip = L["Click this button to send all disenchantable greens in your bags to the specified character."] btn.tooltip = L["Click this button to send all disenchantable greens in your bags to the specified character."]
btn.Update = function(self) btn.Update = function(self)
if TSM.db.factionrealm.deMailTarget ~= "" then if TSM.db.realm.deMailTarget ~= "" then
self:Enable() self:Enable()
self:SetText(format(L["Send Disenchantable Greens to %s"], TSM.db.factionrealm.deMailTarget)) self:SetText(format(L["Send Disenchantable Greens to %s"], TSM.db.realm.deMailTarget))
else else
self:Disable() self:Disable()
self:SetText(L["No Target Player"]) self:SetText(L["No Target Player"])

4
TradeSkillMaster_Mailing/TradeSkillMaster_Mailing.lua

@ -31,7 +31,7 @@ local savedDBDefaults = {
showReloadBtn = true, showReloadBtn = true,
keepMailSpace = 0, keepMailSpace = 0,
}, },
factionrealm = { realm = {
deMailTarget = "", deMailTarget = "",
mailTargets = {}, mailTargets = {},
mailItems = {}, mailItems = {},
@ -75,7 +75,7 @@ TSM.operationDefaults = {
restockGBank = nil, restockGBank = nil,
keepQty = 0, keepQty = 0,
ignorePlayer = {}, ignorePlayer = {},
ignoreFactionrealm = {}, ignorerealm = {},
relationships = {}, relationships = {},
} }

2
TradeSkillMaster_Shopping/TradeSkillMaster_Shopping.lua

@ -71,7 +71,7 @@ TSM.operationDefaults = {
evenStacks = nil, evenStacks = nil,
showAboveMaxPrice = nil, showAboveMaxPrice = nil,
ignorePlayer = {}, ignorePlayer = {},
ignoreFactionrealm = {}, ignorerealm = {},
relationships = {}, relationships = {},
} }

2
TradeSkillMaster_Warehousing/Modules/data.lua

@ -39,7 +39,7 @@ function data:getEmptyRestoreGroup(container, isGuildBank)
grp[i] = q * -1 -- convert to negative number for TSMAPI:MoveItems grp[i] = q * -1 -- convert to negative number for TSMAPI:MoveItems
restore[i] = q -- for the restore bagstate restore[i] = q -- for the restore bagstate
end end
TSM.db.factionrealm.BagState = restore TSM.db.realm.BagState = restore
return grp return grp
end end

4
TradeSkillMaster_Warehousing/Modules/move.lua

@ -46,7 +46,7 @@ function move:EmptyRestore(dest, restore)
end end
if restore then if restore then
moveItems = TSM.db.factionrealm.BagState moveItems = TSM.db.realm.BagState
else else
local srcTable = move:getContainerTable("bags") local srcTable = move:getContainerTable("bags")
moveItems = TSM.data:getEmptyRestoreGroup(srcTable, isGuildBank) moveItems = TSM.data:getEmptyRestoreGroup(srcTable, isGuildBank)
@ -58,7 +58,7 @@ function move:EmptyRestore(dest, restore)
TSM:Print(L["Preparing to Move"]) TSM:Print(L["Preparing to Move"])
TSMAPI:MoveItems(moveItems, TSM.PrintMsg, true) TSMAPI:MoveItems(moveItems, TSM.PrintMsg, true)
if restore then if restore then
TSM.db.factionrealm.BagState = {} TSM.db.realm.BagState = {}
end end
end end
end end

14
TradeSkillMaster_Warehousing/TradeSkillMaster_Warehousing.lua

@ -26,7 +26,7 @@ local savedDBDefaults = {
}, },
-- data that is stored per realm/faction combination -- data that is stored per realm/faction combination
factionrealm = { realm = {
BagState = {}, BagState = {},
}, },
@ -51,9 +51,9 @@ function TSM:OnEnable()
-- register the module with TSM -- register the module with TSM
TSM:RegisterModule() TSM:RegisterModule()
if TSM.db.factionrealm.WarehousingGroups then -- remove old 1.x data on first load of 2.0 if TSM.db.realm.WarehousingGroups then -- remove old 1.x data on first load of 2.0
for key in pairs(TSM.db.factionrealm) do for key in pairs(TSM.db.realm) do
TSM.db.factionrealm[key] = nil TSM.db.realm[key] = nil
end end
end end
@ -107,7 +107,7 @@ TSM.operationDefaults = {
stackSize = 5, stackSize = 5,
stackSizeEnabled = nil, stackSizeEnabled = nil,
ignorePlayer = {}, ignorePlayer = {},
ignoreFactionrealm = {}, ignorerealm = {},
relationships = {}, relationships = {},
} }
@ -178,8 +178,8 @@ function TSM:IsOperationIgnored(operationName)
TSMAPI:UpdateOperation("Warehousing", operationName) TSMAPI:UpdateOperation("Warehousing", operationName)
local operation = TSM.operations[operationName] local operation = TSM.operations[operationName]
if not operation then return end if not operation then return end
local playerKey = UnitName("player").." - "..TSM.db.keys.factionrealm local playerKey = UnitName("player").." - "..TSM.db.keys.realm
return operation.ignorePlayer[playerKey] or operation.ignoreFactionrealm[TSM.db.keys.factionrealm] return operation.ignorePlayer[playerKey] or operation.ignorerealm[TSM.db.keys.realm]
end end
function TSM:toggleBankUI() function TSM:toggleBankUI()

Loading…
Cancel
Save