commit 811b03fc74b88393d22d72170ca19373f9ab74ef Author: Robin Date: Wed Jan 13 15:41:39 2021 +0100 Revision 10 diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..34950ac --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "Common"] + path = Common + url = https://git.grml.de/rilgamon/Common.git diff --git a/Common b/Common new file mode 160000 index 0000000..762c59c --- /dev/null +++ b/Common @@ -0,0 +1 @@ +Subproject commit 762c59c6c6abc6ecaa71f3e36bb2c6dd16b8e0ed diff --git a/core.lua b/core.lua new file mode 100644 index 0000000..d0c31bf --- /dev/null +++ b/core.lua @@ -0,0 +1,96 @@ +local name, addon = ... +local parentName = addon['parentName'] or "BrokerPack" +local childName = "zz_Quest" -- Change childName to your addons foldername + +local defaults = { +} + +local options = { +} + +local db +local ldbicon = LibStub:GetLibrary("LibDBIcon-1.0") +local function OnClick(self, button) + if(IsShiftKeyDown() and button == "LeftButton") then + addon['db']['global']['ldbicons'][childName]['hide'] = not addon['db']['global']['ldbicons'][childName]['hide'] + if(ldbicon) then + if(addon['db']['global']['ldbicons'][childName]['hide']) then + ldbicon:Hide(childName) + else + ldbicon:Show(childName) + end + end + else + if(InterfaceOptionsFrame:IsVisible() and not InCombatLockdown()) then + InterfaceOptionsFrame:Hide() + else + InterfaceOptionsFrame_OpenToCategory(name) + InterfaceOptionsFrame_OpenToCategory(name) -- Twice because of a bug in InterfaceOptionsFrame_OpenToCategory + end + end +end +local function OnText(message) + addon:OnText(childName, message) +end +local function getPref(pref) + return db[pref[#pref]] +end +local function QuestUpdate(self, event, ...) + local maxNumQuests = C_QuestLog.GetMaxNumQuestsCanAccept() + local numEntries, numQuests + if(C_QuestLog.GetNumQuestLogEntries) then + numEntries, numQuests = C_QuestLog.GetNumQuestLogEntries() + else + numEntries, numQuests = GetNumQuestLogEntries() + end + if(db['slots']) then + numQuests = maxNumQuests - numQuests + end + local line = format("%i/%i",numQuests, maxNumQuests) + if(numQuests==maxNumQuests or numQuests==0) then + line = addon:colorize(line, 'ff0000') + end + OnText(line) +end +local function setPref(pref,value) + db[pref[#pref]] = value + if(pref[#pref]=='slots') then + QuestUpdate() + end +end +local function OnTooltip(tip) + tip:AddLine(childName) + local mapid = C_Map.GetBestMapForUnit("player") + local quests = C_QuestLog.GetQuestsOnMap(mapid) + local header = {} + for num, quest in ipairs(quests) do + local objectives = C_QuestLog.GetQuestObjectives(quest['questID']) + if(#objectives>0) then + for num, objective in ipairs(objectives) do + if(not objective['finished']) then + if(not header[quest['questID']]) then + header[quest['questID']] = true + if(C_QuestLog.GetTitleForQuestID) then + tip:AddLine(C_QuestLog.GetTitleForQuestID(quest['questID'])) + else + tip:AddLine(C_QuestLog.GetQuestInfo(quest['questID'])) + end + end + tip:AddLine(addon:colorize(format(" %s", objective['text']),'ffffff')) + end + end + end + end +end +local function init() + options = addon:InitConfig(childName, true, { + ['type'] = "data source", -- 'data source | launcher' + ['name'] = childName, + ['OnClick'] = OnClick, + ['OnTooltipShow'] = OnTooltip, + }, getPref, setPref) + db = addon['db']['profile'][childName] + addon:AddConfigEntry(childName, "toggle","slots","Show free slots",nil,1,nil,nil,nil,nil,options['args'][childName]) + addon:RegisterFunc({'QUEST_ACCEPTED','QUEST_AUTOCOMPLETE','QUEST_COMPLETE','QUEST_DATA_LOAD_RESULT','QUEST_DETAIL','QUEST_LOG_CRITERIA_UPDATE','QUEST_LOG_UPDATE','QUEST_POI_UPDATE','QUEST_REMOVED','QUEST_TURNED_IN','QUEST_WATCH_LIST_CHANGED','QUEST_WATCH_UPDATE','QUESTLINE_UPDATE','TASK_PROGRESS_UPDATE','TREASURE_PICKER_CACHE_FLUSH','WAYPOINT_UPDATE','WORLD_QUEST_COMPLETED_BY_SPELL'}, "OnEvent", QuestUpdate) +end +addon:startup(name, childName, init, true, defaults) \ No newline at end of file diff --git a/icon2.tga b/icon2.tga new file mode 100644 index 0000000..f675e12 Binary files /dev/null and b/icon2.tga differ diff --git a/license.txt b/license.txt new file mode 100644 index 0000000..b9e992f --- /dev/null +++ b/license.txt @@ -0,0 +1,6 @@ +The following license excludes the libraries (Libs) included. See the libraries directory or website. + +This AddOn is public domain. That means you can change it, rename it or paint it yellow. +My name (Rilgamon) is valid only for WoWInterface.com and curse.com. +If you use/offer this addon on another website please remove my name. +If you want to give me credit you can replace it with a link to my profile on WoWInterface.com. \ No newline at end of file diff --git a/pack.xml b/pack.xml new file mode 100644 index 0000000..0f7eacc --- /dev/null +++ b/pack.xml @@ -0,0 +1,3 @@ + +