mirror of
https://github.com/ckaczor/TillerTracker.git
synced 2026-02-01 17:25:28 -05:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b14c4a358a | |||
| a80d3ded01 | |||
| 5b441d1dee | |||
| 6afc62a355 | |||
| 3fd9daf009 |
2
.pkgmeta
2
.pkgmeta
@@ -11,7 +11,7 @@ externals:
|
|||||||
url: https://repos.wowace.com/wow/libqtip-1-0
|
url: https://repos.wowace.com/wow/libqtip-1-0
|
||||||
tag: latest
|
tag: latest
|
||||||
Libs/LibDataBroker-1.1:
|
Libs/LibDataBroker-1.1:
|
||||||
url: git://github.com/tekkub/libdatabroker-1-1.git
|
url: https://github.com/tekkub/libdatabroker-1-1
|
||||||
tag: latest
|
tag: latest
|
||||||
Libs/AceLocale-3.0:
|
Libs/AceLocale-3.0:
|
||||||
url: https://repos.wowace.com/wow/ace3/trunk/AceLocale-3.0
|
url: https://repos.wowace.com/wow/ace3/trunk/AceLocale-3.0
|
||||||
|
|||||||
@@ -197,9 +197,8 @@ function TillerTracker:OnInitialize()
|
|||||||
private.pinned = false
|
private.pinned = false
|
||||||
private.need_index = 1
|
private.need_index = 1
|
||||||
private.loaded = false
|
private.loaded = false
|
||||||
private.item_wait_table = {}
|
private.item_name_table = {}
|
||||||
private.item_wait_count = 0
|
|
||||||
|
|
||||||
-- Get rid of settings from before AceDB
|
-- Get rid of settings from before AceDB
|
||||||
if TillerTrackerDB then
|
if TillerTrackerDB then
|
||||||
TillerTrackerDB["SORT_FIELD"] = nil
|
TillerTrackerDB["SORT_FIELD"] = nil
|
||||||
@@ -258,66 +257,56 @@ function TillerTracker:OnEnableCore()
|
|||||||
TillerTracker:Print(L["Loading..."])
|
TillerTracker:Print(L["Loading..."])
|
||||||
LDB.text = L["Loading..."]
|
LDB.text = L["Loading..."]
|
||||||
|
|
||||||
-- Register to get item info events for now
|
-- Load item info from cache
|
||||||
self:RegisterEvent("GET_ITEM_INFO_RECEIVED")
|
|
||||||
|
|
||||||
-- Attempt to load the cache
|
|
||||||
TillerTracker:LoadCache()
|
TillerTracker:LoadCache()
|
||||||
|
|
||||||
-- If everything is cached we're good to go
|
|
||||||
if (private.item_wait_count == 0) then
|
|
||||||
TillerTracker:OnLoaded(self)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function TillerTracker:LoadCache()
|
function TillerTracker:LoadCache()
|
||||||
|
local item_count = 0
|
||||||
|
local item_loaded_count = 0
|
||||||
|
local item_table = {}
|
||||||
|
|
||||||
|
private.item_name_table = {}
|
||||||
|
|
||||||
-- Loop over each quest in the data
|
-- Loop over each quest in the data
|
||||||
for _, quest_info in pairs(private.QUESTS) do
|
for _, quest_info in pairs(private.QUESTS) do
|
||||||
|
|
||||||
-- Get the item ID of the food
|
-- Get the item ID of the food
|
||||||
local food_id = quest_info["FOOD_ID"]
|
local food_id = quest_info["FOOD_ID"]
|
||||||
|
|
||||||
|
-- Add the food to the list of items
|
||||||
|
item_table[food_id] = Item:CreateFromItemID(food_id)
|
||||||
|
item_count = item_count + 1
|
||||||
|
|
||||||
-- Try to get the info for the food
|
|
||||||
local food_name = GetItemInfo(food_id)
|
|
||||||
|
|
||||||
-- If the information wasn't available add it to the list of waiting items
|
|
||||||
if (food_name == nil) then
|
|
||||||
private.item_wait_table[food_id] = true
|
|
||||||
private.item_wait_count = private.item_wait_count + 1
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Loop over the mats required to cook the food for the quest
|
-- Loop over the mats required to cook the food for the quest
|
||||||
for _, mat_data in pairs(quest_info["MATS"]) do
|
for _, mat_data in pairs(quest_info["MATS"]) do
|
||||||
|
|
||||||
-- Get the item ID of the mat
|
-- Get the item ID of the mat
|
||||||
local mat_id = mat_data["ITEM_ID"]
|
local mat_id = mat_data["ITEM_ID"]
|
||||||
|
|
||||||
-- Try to get the info for the mat
|
-- Add the mat to the list of items
|
||||||
local mat_name = GetItemInfo(mat_id)
|
if (item_table[mat_id] == nil) then
|
||||||
|
item_table[mat_id] = Item:CreateFromItemID(mat_id)
|
||||||
-- If the information wasn't available add it to the list of waiting items
|
item_count = item_count + 1
|
||||||
if (mat_name == nil) then
|
|
||||||
if (private.item_wait_table[mat_id] == nil) then
|
|
||||||
private.item_wait_table[mat_id] = true
|
|
||||||
private.item_wait_count = private.item_wait_count + 1
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
function TillerTracker:GET_ITEM_INFO_RECEIVED()
|
-- Loop over all items we need to cache
|
||||||
for id, _ in pairs(private.item_wait_table) do
|
for _, item in pairs(item_table) do
|
||||||
if GetItemInfo(id) then
|
|
||||||
private.item_wait_table[id] = nil
|
-- Wait for the item to load
|
||||||
|
item:ContinueOnItemLoad(function()
|
||||||
|
|
||||||
private.item_wait_count = private.item_wait_count - 1
|
-- Save the name
|
||||||
end
|
private.item_name_table[item:GetItemID()] = item:GetItemName()
|
||||||
end
|
item_loaded_count = item_loaded_count + 1
|
||||||
|
|
||||||
-- If everything is cached we're good to go
|
-- If everything is cached we're good to go
|
||||||
if (private.item_wait_count == 0) then
|
if (item_count == item_loaded_count) then
|
||||||
TillerTracker:OnLoaded(self)
|
TillerTracker:OnLoaded(self)
|
||||||
|
end
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -326,9 +315,6 @@ function TillerTracker:OnLoaded(self)
|
|||||||
TillerTracker:Print(L["Loaded"])
|
TillerTracker:Print(L["Loaded"])
|
||||||
LDB.text = L["Loaded"]
|
LDB.text = L["Loaded"]
|
||||||
|
|
||||||
-- Done with item info events
|
|
||||||
self:UnregisterEvent("GET_ITEM_INFO_RECEIVED")
|
|
||||||
|
|
||||||
self:RegisterEvent("QUEST_LOG_UPDATE")
|
self:RegisterEvent("QUEST_LOG_UPDATE")
|
||||||
self:RegisterEvent("BAG_UPDATE")
|
self:RegisterEvent("BAG_UPDATE")
|
||||||
|
|
||||||
@@ -363,13 +349,17 @@ local function SetSort(cell, sort)
|
|||||||
private.db.global.sort_dir = "ASC"
|
private.db.global.sort_dir = "ASC"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not private.loaded then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
TillerTracker:UpdateData()
|
TillerTracker:UpdateData()
|
||||||
TillerTracker:UpdateTooltip()
|
TillerTracker:UpdateTooltip()
|
||||||
end
|
end
|
||||||
|
|
||||||
function TillerTracker:ReputationDone(reputationId)
|
function TillerTracker:ReputationDone(reputationId)
|
||||||
-- Get the reputation information
|
-- Get the reputation information
|
||||||
local _, friendRep = GetFriendshipReputation(reputationId)
|
local friendRep = C_GossipInfo.GetFriendshipReputation(reputationId).standing
|
||||||
|
|
||||||
-- Done if over exalted
|
-- Done if over exalted
|
||||||
return (friendRep > 42000)
|
return (friendRep > 42000)
|
||||||
@@ -427,7 +417,7 @@ function TillerTracker:UpdateData()
|
|||||||
local food_id = quest_info["FOOD_ID"]
|
local food_id = quest_info["FOOD_ID"]
|
||||||
|
|
||||||
-- Get the name of the food for display
|
-- Get the name of the food for display
|
||||||
local food_name = GetItemInfo(food_id)
|
local food_name = private.item_name_table[food_id]
|
||||||
|
|
||||||
-- Get how many of the food we have in our bags
|
-- Get how many of the food we have in our bags
|
||||||
local food_count = GetItemCount(food_id, true, false)
|
local food_count = GetItemCount(food_id, true, false)
|
||||||
@@ -488,7 +478,7 @@ function TillerTracker:UpdateData()
|
|||||||
if (mat_count > 0) then
|
if (mat_count > 0) then
|
||||||
|
|
||||||
-- Get the name of the mat
|
-- Get the name of the mat
|
||||||
local mat_name = GetItemInfo(mat_id)
|
local mat_name = private.item_name_table[mat_id]
|
||||||
|
|
||||||
-- Set the mat need string to the count needed and the name
|
-- Set the mat need string to the count needed and the name
|
||||||
local mat_need = mat_count .. " " .. mat_name
|
local mat_need = mat_count .. " " .. mat_name
|
||||||
@@ -627,7 +617,7 @@ function TillerTracker:UpdateText()
|
|||||||
-- Loop over the need table
|
-- Loop over the need table
|
||||||
for need_id, need_count in pairs(private.need_table) do
|
for need_id, need_count in pairs(private.need_table) do
|
||||||
if need_index == private.need_index then
|
if need_index == private.need_index then
|
||||||
LDB.text = L["Gather:"] .. " " .. need_count .. " " .. GetItemInfo(need_id)
|
LDB.text = L["Gather:"] .. " " .. need_count .. " " .. private.item_name_table[need_id]
|
||||||
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -648,6 +638,10 @@ function LDB.OnEnter(self)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function TillerTracker:QUEST_LOG_UPDATE()
|
function TillerTracker:QUEST_LOG_UPDATE()
|
||||||
|
if not private.loaded then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
TillerTracker:UpdateData()
|
TillerTracker:UpdateData()
|
||||||
TillerTracker:UpdateText()
|
TillerTracker:UpdateText()
|
||||||
|
|
||||||
@@ -659,6 +653,10 @@ function TillerTracker:QUEST_LOG_UPDATE()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function TillerTracker:BAG_UPDATE()
|
function TillerTracker:BAG_UPDATE()
|
||||||
|
if not private.loaded then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
TillerTracker:UpdateData()
|
TillerTracker:UpdateData()
|
||||||
TillerTracker:UpdateText()
|
TillerTracker:UpdateText()
|
||||||
|
|
||||||
@@ -718,6 +716,10 @@ end
|
|||||||
function TillerTracker:SetPlanAhead(value)
|
function TillerTracker:SetPlanAhead(value)
|
||||||
private.db.global.plan_ahead = value
|
private.db.global.plan_ahead = value
|
||||||
|
|
||||||
|
if not private.loaded then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
TillerTracker:UpdateData()
|
TillerTracker:UpdateData()
|
||||||
TillerTracker:UpdateText()
|
TillerTracker:UpdateText()
|
||||||
|
|
||||||
@@ -726,4 +728,4 @@ function TillerTracker:SetPlanAhead(value)
|
|||||||
end
|
end
|
||||||
|
|
||||||
TillerTracker:UpdateTooltip()
|
TillerTracker:UpdateTooltip()
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
## Interface: 90002
|
## Interface: 100000
|
||||||
## Title: Tiller Tracker
|
## Title: Tiller Tracker
|
||||||
## Version: 9.0.4
|
## Version: 10.0.2
|
||||||
## Notes: Helps with the daily Tiller food quests ("A Dish for...") by keeping track of what quests have been completed that day, how many dishes need to be cooked, and what materials are required.
|
## Notes: Helps with the daily Tiller food quests ("A Dish for...") by keeping track of what quests have been completed that day, how many dishes need to be cooked, and what materials are required.
|
||||||
## Author: Amanoa
|
## Author: Amanoa
|
||||||
## SavedVariables: TillerTrackerDB
|
## SavedVariables: TillerTrackerDB
|
||||||
|
|||||||
Reference in New Issue
Block a user