This commit is contained in:
2022-12-29 21:56:09 -05:00
parent 3b8178e33c
commit 700b31d52b
5 changed files with 50 additions and 50 deletions

View File

@@ -1,4 +1,4 @@
package-as: TuskarrCatchAndRelease package-as: TuskarrRestockTracker
externals: externals:
Libs/LibStub: Libs/LibStub:

View File

@@ -5,7 +5,7 @@ if not L then
return return
end end
L["Tuskarr Catch and Release"] = true L["Tuskarr Restock Tracker"] = true
L["Catch and Release: Scalebelly Mackerel"] = true L["Catch and Release: Scalebelly Mackerel"] = true
L["Catch and Release: Thousandbite Piranha"] = true L["Catch and Release: Thousandbite Piranha"] = true
L["Catch and Release: Aileron Seamoth"] = true L["Catch and Release: Aileron Seamoth"] = true

View File

@@ -1 +1 @@
# TuskarrCatchAndRelease # TuskarrRestockTracker

View File

@@ -1,6 +1,6 @@
local ADDON_NAME, private = ... local ADDON_NAME, private = ...
TuskarrCatchAndRelease = LibStub("AceAddon-3.0"):NewAddon(ADDON_NAME, "AceConsole-3.0", "AceEvent-3.0", "AceTimer-3.0") TuskarrRestockTracker = LibStub("AceAddon-3.0"):NewAddon(ADDON_NAME, "AceConsole-3.0", "AceEvent-3.0", "AceTimer-3.0")
local L = LibStub("AceLocale-3.0"):GetLocale(ADDON_NAME) local L = LibStub("AceLocale-3.0"):GetLocale(ADDON_NAME)
local LibQTip = LibStub("LibQTip-1.0") local LibQTip = LibStub("LibQTip-1.0")
local LibDBIcon = LibStub("LibDBIcon-1.0") local LibDBIcon = LibStub("LibDBIcon-1.0")
@@ -19,7 +19,7 @@ local defaults = {
} }
local options = { local options = {
name = L["Tuskarr Catch and Release"], name = L["Tuskarr Restock Tracker"],
type = "group", type = "group",
args = { args = {
minimap_icon = { minimap_icon = {
@@ -32,7 +32,7 @@ local options = {
end, end,
set = function(info, value) set = function(info, value)
private.db.global.minimap_icon.hide = not value private.db.global.minimap_icon.hide = not value
TuskarrCatchAndRelease:UpdateMinimapConfig() TuskarrRestockTracker:UpdateMinimapConfig()
end end
} }
} }
@@ -41,8 +41,8 @@ local options = {
local LDB = LibStub("LibDataBroker-1.1"):NewDataObject(ADDON_NAME, { local LDB = LibStub("LibDataBroker-1.1"):NewDataObject(ADDON_NAME, {
type = "data source", type = "data source",
icon = "Interface\\Icons\\Inv_fishing_netlinen01", icon = "Interface\\Icons\\Inv_fishing_netlinen01",
label = L["Tuskarr Catch and Release"], label = L["Tuskarr Restock Tracker"],
text = L["Tuskarr Catch and Release"], text = L["Tuskarr Restock Tracker"],
OnClick = function(clickedframe, button) OnClick = function(clickedframe, button)
if not private.loaded then if not private.loaded then
return return
@@ -61,34 +61,34 @@ local LDB = LibStub("LibDataBroker-1.1"):NewDataObject(ADDON_NAME, {
elseif button == "RightButton" then elseif button == "RightButton" then
private.need_index = private.need_index + 1 private.need_index = private.need_index + 1
TuskarrCatchAndRelease:UpdateText() TuskarrRestockTracker:UpdateText()
end end
end end
}) })
function TuskarrCatchAndRelease:OnInitialize() function TuskarrRestockTracker:OnInitialize()
private.pinned = false private.pinned = false
private.need_index = 1 private.need_index = 1
private.loaded = false private.loaded = false
private.item_name_table = {} private.item_name_table = {}
-- Create the database with defaults -- Create the database with defaults
private.db = LibStub("AceDB-3.0"):New("TuskarrCatchAndReleaseDB", defaults) private.db = LibStub("AceDB-3.0"):New("TuskarrRestockTrackerDB", defaults)
-- Register options -- Register options
AceConfig:RegisterOptionsTable(ADDON_NAME, options, {"/tcr"}) AceConfig:RegisterOptionsTable(ADDON_NAME, options, {"/trt"})
-- Add to the options frame -- Add to the options frame
private.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions(ADDON_NAME, L["Tuskarr Catch and Release"]) private.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions(ADDON_NAME, L["Tuskarr Restock Tracker"])
-- Register a chat command -- Register a chat command
self:RegisterChatCommand("tcr", "ChatCommand") self:RegisterChatCommand("trt", "ChatCommand")
-- Register the minimap icon -- Register the minimap icon
LibDBIcon:Register(ADDON_NAME, LDB, private.db.global.minimap_icon) LibDBIcon:Register(ADDON_NAME, LDB, private.db.global.minimap_icon)
end end
function TuskarrCatchAndRelease:OnEnable() function TuskarrRestockTracker:OnEnable()
-- Disable if the player is less than 10 -- Disable if the player is less than 10
if (UnitLevel("player") < 10) then if (UnitLevel("player") < 10) then
LDB.text = L["Disabled until level 10"] LDB.text = L["Disabled until level 10"]
@@ -100,29 +100,29 @@ function TuskarrCatchAndRelease:OnEnable()
end end
-- Do the real enable -- Do the real enable
TuskarrCatchAndRelease:OnEnableCore() TuskarrRestockTracker:OnEnableCore()
end end
function TuskarrCatchAndRelease:PLAYER_LEVEL_UP(event, newLevel) function TuskarrRestockTracker:PLAYER_LEVEL_UP(event, newLevel)
if (tonumber(newLevel) >= 10) then if (tonumber(newLevel) >= 10) then
-- Do the real enable -- Do the real enable
TuskarrCatchAndRelease:OnEnableCore() TuskarrRestockTracker:OnEnableCore()
-- Done with player level events -- Done with player level events
self:UnregisterEvent("PLAYER_LEVEL_UP") self:UnregisterEvent("PLAYER_LEVEL_UP")
end end
end end
function TuskarrCatchAndRelease:OnEnableCore() function TuskarrRestockTracker:OnEnableCore()
-- Show loading text -- Show loading text
TuskarrCatchAndRelease:Print(L["Loading..."]) TuskarrRestockTracker:Print(L["Loading..."])
LDB.text = L["Loading..."] LDB.text = L["Loading..."]
-- Load item info from cache -- Load item info from cache
TuskarrCatchAndRelease:LoadCache() TuskarrRestockTracker:LoadCache()
end end
function TuskarrCatchAndRelease:LoadCache() function TuskarrRestockTracker:LoadCache()
local item_count = 0 local item_count = 0
local item_loaded_count = 0 local item_loaded_count = 0
local item_table = {} local item_table = {}
@@ -152,22 +152,22 @@ function TuskarrCatchAndRelease:LoadCache()
-- If everything is cached we're good to go -- If everything is cached we're good to go
if (item_count == item_loaded_count) then if (item_count == item_loaded_count) then
TuskarrCatchAndRelease:OnLoaded(self) TuskarrRestockTracker:OnLoaded(self)
end end
end) end)
end end
end end
function TuskarrCatchAndRelease:OnLoaded(self) function TuskarrRestockTracker:OnLoaded(self)
-- Show loaded text -- Show loaded text
TuskarrCatchAndRelease:Print(L["Loaded"]) TuskarrRestockTracker:Print(L["Loaded"])
LDB.text = L["Loaded"] LDB.text = L["Loaded"]
self:RegisterEvent("QUEST_LOG_UPDATE") self:RegisterEvent("QUEST_LOG_UPDATE")
self:RegisterEvent("BAG_UPDATE") self:RegisterEvent("BAG_UPDATE")
TuskarrCatchAndRelease:UpdateData() TuskarrRestockTracker:UpdateData()
TuskarrCatchAndRelease:UpdateText() TuskarrRestockTracker:UpdateText()
private.loaded = true private.loaded = true
end end
@@ -188,11 +188,11 @@ local function SetSort(cell, sort)
return return
end end
TuskarrCatchAndRelease:UpdateData() TuskarrRestockTracker:UpdateData()
TuskarrCatchAndRelease:UpdateTooltip() TuskarrRestockTracker:UpdateTooltip()
end end
function TuskarrCatchAndRelease:UpdateData() function TuskarrRestockTracker:UpdateData()
-- Create a table to store all needs -- Create a table to store all needs
private.need_table = {} private.need_table = {}
@@ -263,7 +263,7 @@ function TuskarrCatchAndRelease:UpdateData()
private.SORT_FUNCTIONS[private.db.global.sort_field .. "_" .. private.db.global.sort_dir]) private.SORT_FUNCTIONS[private.db.global.sort_field .. "_" .. private.db.global.sort_dir])
end end
function TuskarrCatchAndRelease:UpdateTooltip() function TuskarrRestockTracker:UpdateTooltip()
if LibQTip:IsAcquired(ADDON_NAME) then if LibQTip:IsAcquired(ADDON_NAME) then
private.tooltip:Clear() private.tooltip:Clear()
else else
@@ -315,7 +315,7 @@ function TuskarrCatchAndRelease:UpdateTooltip()
"LEFT", private.tooltip:GetColumnCount()) "LEFT", private.tooltip:GetColumnCount())
end end
function TuskarrCatchAndRelease:UpdateText() function TuskarrRestockTracker:UpdateText()
local need_index = 1 local need_index = 1
if (private.need_index > private.need_count) then if (private.need_index > private.need_count) then
@@ -351,42 +351,42 @@ function LDB.OnEnter(self)
end end
private.LDB_ANCHOR = self private.LDB_ANCHOR = self
TuskarrCatchAndRelease:UpdateTooltip() TuskarrRestockTracker:UpdateTooltip()
private.tooltip:Show() private.tooltip:Show()
end end
function TuskarrCatchAndRelease:QUEST_LOG_UPDATE() function TuskarrRestockTracker:QUEST_LOG_UPDATE()
if not private.loaded then if not private.loaded then
return return
end end
TuskarrCatchAndRelease:UpdateData() TuskarrRestockTracker:UpdateData()
TuskarrCatchAndRelease:UpdateText() TuskarrRestockTracker:UpdateText()
if not private.LDB_ANCHOR then if not private.LDB_ANCHOR then
return return
end end
TuskarrCatchAndRelease:UpdateTooltip() TuskarrRestockTracker:UpdateTooltip()
end end
function TuskarrCatchAndRelease:BAG_UPDATE() function TuskarrRestockTracker:BAG_UPDATE()
if not private.loaded then if not private.loaded then
return return
end end
TuskarrCatchAndRelease:UpdateData() TuskarrRestockTracker:UpdateData()
TuskarrCatchAndRelease:UpdateText() TuskarrRestockTracker:UpdateText()
if not private.LDB_ANCHOR then if not private.LDB_ANCHOR then
return return
end end
TuskarrCatchAndRelease:UpdateTooltip() TuskarrRestockTracker:UpdateTooltip()
end end
function TuskarrCatchAndRelease:UpdateMinimapConfig() function TuskarrRestockTracker:UpdateMinimapConfig()
if private.db.global.minimap_icon.hide then if private.db.global.minimap_icon.hide then
LibDBIcon:Hide(ADDON_NAME) LibDBIcon:Hide(ADDON_NAME)
else else
@@ -394,7 +394,7 @@ function TuskarrCatchAndRelease:UpdateMinimapConfig()
end end
end end
function TuskarrCatchAndRelease:ChatCommand(input) function TuskarrRestockTracker:ChatCommand(input)
local command, arg1 = self:GetArgs(input, 2) local command, arg1 = self:GetArgs(input, 2)
@@ -408,10 +408,10 @@ function TuskarrCatchAndRelease:ChatCommand(input)
InterfaceOptionsFrame_OpenToCategory(private.optionsFrame) InterfaceOptionsFrame_OpenToCategory(private.optionsFrame)
elseif command == L["minimap"]:lower() then elseif command == L["minimap"]:lower() then
private.db.global.minimap_icon.hide = not private.db.global.minimap_icon.hide private.db.global.minimap_icon.hide = not private.db.global.minimap_icon.hide
TuskarrCatchAndRelease:UpdateMinimapConfig() TuskarrRestockTracker:UpdateMinimapConfig()
else else
TuskarrCatchAndRelease:Print(L["Available commands:"]) TuskarrRestockTracker:Print(L["Available commands:"])
TuskarrCatchAndRelease:Print("|cFF00C0FF" .. L["config"] .. "|r - " .. L["Show configuration"]) TuskarrRestockTracker:Print("|cFF00C0FF" .. L["config"] .. "|r - " .. L["Show configuration"])
TuskarrCatchAndRelease:Print("|cFF00C0FF" .. L["minimap"] .. "|r - " .. L["Toggles the minimap icon"]) TuskarrRestockTracker:Print("|cFF00C0FF" .. L["minimap"] .. "|r - " .. L["Toggles the minimap icon"])
end end
end end

View File

@@ -1,9 +1,9 @@
## Interface: 100000 ## Interface: 100000
## Title: Tuskarr Catch and Release ## Title: Tuskarr Restock Tracker
## Version: 10.0.0 ## Version: 10.0.0
## Notes: Helps with the weekly Iskaara Tuskarr fishing quests ("Catch and Release") by keeping track of what quests have been completed and what fish are required. ## Notes: Helps with the weekly Iskaara Tuskarr fishing quests ("Catch and Release") by keeping track of what quests have been completed and what fish are required.
## Author: Amanoa ## Author: Amanoa
## SavedVariables: TuskarrCatchAndReleaseDB ## SavedVariables: TuskarrRestockTrackerDB
## OptionalDeps: Ace3, AceEvent-3.0, LibQTip-1.0, LibStub, AceTimer-3.0, AceConsole-3.0 ## OptionalDeps: Ace3, AceEvent-3.0, LibQTip-1.0, LibStub, AceTimer-3.0, AceConsole-3.0
#@no-lib-strip@ #@no-lib-strip@
@@ -28,4 +28,4 @@ Locale\deDE.lua
Data.lua Data.lua
Sort.lua Sort.lua
TuskarrCatchAndRelease.lua TuskarrRestockTracker.lua