Nenue@0: --- ${PACKAGE_NAME} Nenue@0: -- @file-author@ Nenue@0: -- @project-revision@ @project-hash@ Nenue@0: -- @file-revision@ @file-hash@ Nenue@0: -- Created: 3/29/2016 7:07 PM Nenue@0: local B = select(2,...).frame Nenue@0: local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') Nenue@0: local print = B.print('Objectives') Nenue@0: local Tracker, AutoQuest, Quest, Cheevs = mod.Tracker, mod.AutoQuest, mod.Quest, mod.Cheevs Nenue@0: Nenue@0: -------------------------------------------------------------------- Nenue@0: --- Tracker-specific widget functions Nenue@0: -------------------------------------------------------------------- Nenue@0: Nenue@0: Tracker.Select = function(self) end Nenue@0: Tracker.Open = function(self) end Nenue@0: Tracker.Remove = function(self) end Nenue@0: Tracker.Report = function(self) Nenue@0: print('Stats:', self.numWatched,'items tracked,', self.numBlocks,'blocks assigned.') Nenue@0: end Nenue@0: Nenue@0: Tracker.OnMouseUp = function(self, button) Nenue@1: Nenue@1: if self.initialButton == 'LeftButton' then Nenue@0: self:Select() Nenue@0: mod.UpdateWrapper() Nenue@1: if self.modShift then Nenue@1: self:Remove() Nenue@1: end Nenue@0: elseif button == 'RightButton' then Nenue@0: self:Open() Nenue@0: end Nenue@1: self.initialButton = nil Nenue@1: self.modShift = nil Nenue@0: print('|cFFFF8800'..tostring(self:GetName())..':MouseUp()|r ->',self.info.trackingID) Nenue@0: end Nenue@0: Nenue@0: Tracker.OnMouseDown = function(self, button) Nenue@1: self.initialButton = button Nenue@1: self.modShift = IsShiftKeyDown() Nenue@0: if button == 'LeftButton' then Nenue@0: self:SetStyle('Active') Nenue@0: end Nenue@0: print(self.info.title) Nenue@0: end Nenue@0: Nenue@0: ----------------------------- Nenue@0: --- AUTO_QUEST Nenue@0: AutoQuest.name = "Remote Quests" Nenue@0: AutoQuest.GetNumWatched = GetNumAutoQuestPopUps Nenue@0: Nenue@0: ----------------------------- Nenue@0: --- QUEST Nenue@0: Quest.name = "Quests" Nenue@0: Quest.Select = function(self) Nenue@0: SetSuperTrackedQuestID(self.info.questID) Nenue@0: end Nenue@0: Quest.Open = function(self) Nenue@1: QuestMapFrame_OpenToQuestDetails(self.info.questID) Nenue@1: end Nenue@1: Nenue@1: Quest.Remove = function(self) Nenue@1: RemoveQuestWatch(self.info.questIndex) Nenue@1: QuestPOIUpdateIcons() Nenue@0: end Nenue@0: Nenue@0: Nenue@0: ----------------------------- Nenue@0: --- CHEEVS Nenue@0: Cheevs.Select = function(self) Nenue@0: end Nenue@0: Nenue@0: Cheevs.Open = function(self) Nenue@0: end Nenue@0: Nenue@1: ---------------------------------------------------------------------------------------- Nenue@1: --- frame template and scripts lifted from "QuestKing 2" by Barjack Nenue@1: --- url: http://mods.curse.com/addons/wow/questking Nenue@1: ---------------------------------------------------------------------------------------- Nenue@1: local usedButtons = mod.Quest.itemButtons Nenue@1: local freeButtons = mod.Quest.freeButtons Nenue@1: mod.SetItemButton = function(block, info) Nenue@1: local itemInfo = info.specialItem Nenue@1: if not itemInfo then Nenue@1: return Nenue@1: end Nenue@1: --- .specialItem :: {link = link, charges = charges, icon = icon, start = start, duration = duration, enable = enable} Nenue@1: Nenue@1: Nenue@1: local itemButton Nenue@1: if not info.itemButton then Nenue@1: if #freeButtons >= 1 then Nenue@1: print('|cFF00FFFFfound a free button') Nenue@1: itemButton = freeButtons[#freeButtons] Nenue@1: freeButtons[#freeButtons] = nil Nenue@1: else Nenue@1: print('|cFFFF4400starting new button') Nenue@1: local buttonIndex = mod.Quest.numButtons + #freeButtons + 1 Nenue@1: itemButton = CreateFrame('Button', 'VeneerQuestItemButton' .. buttonIndex, UIParent, 'VeneerItemButtonTemplate') Nenue@1: itemButton.buttonIndex = buttonIndex Nenue@1: itemButton:SetSize(48, 48) Nenue@1: itemButton:GetNormalTexture():SetSize(80,80) Nenue@1: end Nenue@1: mod.Quest.numButtons = mod.Quest.numButtons + 1 Nenue@1: else Nenue@1: print('|cFF00FF00found assigned button') Nenue@1: itemButton = info.itemButton Nenue@1: end Nenue@1: -- set values Nenue@1: info.itemButton = itemButton Nenue@1: block.itemButton = itemButton Nenue@1: usedButtons[info.questLogIndex] = itemButton Nenue@1: Nenue@1: itemButton:SetAttribute("type", "item") Nenue@1: itemButton:SetAttribute("item", itemInfo.link) Nenue@1: Nenue@1: itemButton.questLogIndex = info.questLogIndex Nenue@1: itemButton.charges = itemInfo.charges Nenue@1: itemButton.rangeTimer = -1 Nenue@1: itemButton.block = block Nenue@1: Nenue@1: SetItemButtonTexture(itemButton, itemInfo.icon) Nenue@1: SetItemButtonCount(itemButton, itemInfo.charges) Nenue@1: Veneer_QuestObjectiveItem_UpdateCooldown(itemButton); Nenue@1: Nenue@1: return itemButton Nenue@1: end Nenue@1: --- Clear an itemButton from the given block Nenue@1: mod.FreeItemButton = function(block, itemButton) Nenue@1: if block.itemButton ~= itemButton then Nenue@1: print('|cFFFF0088trying to release mismatched action button') Nenue@1: return Nenue@1: end Nenue@1: Nenue@1: block.itemButton = nil Nenue@1: block.icon:Hide() Nenue@1: Nenue@1: itemButton.block = nil Nenue@1: itemButton:Hide() Nenue@1: Nenue@1: usedButtons[itemButton.questLogIndex] = nil Nenue@1: freeButtons[#freeButtons + 1] = itemButton Nenue@1: mod.Quest.numButtons = mod.Quest.numButtons - 1 Nenue@1: print('|cFFFF0088released', itemButton:GetName(),'from', block:GetName()) Nenue@1: end Nenue@1: Nenue@1: function Veneer_QuestObjectiveItem_OnUpdate (self, elapsed) Nenue@1: -- Handle range indicator Nenue@1: local rangeTimer = self.rangeTimer Nenue@1: if (rangeTimer) then Nenue@1: rangeTimer = rangeTimer - elapsed Nenue@1: if (rangeTimer <= 0) then Nenue@1: local link, item, charges, showItemWhenComplete = GetQuestLogSpecialItemInfo(self.questLogIndex) Nenue@1: if ((not charges) or (charges ~= self.charges)) then Nenue@1: QuestKing:UpdateTracker() Nenue@1: return Nenue@1: end Nenue@1: Nenue@1: local count = self.HotKey Nenue@1: local valid = IsQuestLogSpecialItemInRange(self.questLogIndex) Nenue@1: if (valid == 0) then Nenue@1: count:Show() Nenue@1: count:SetVertexColor(1.0, 0.1, 0.1) Nenue@1: elseif (valid == 1) then Nenue@1: count:Show() Nenue@1: count:SetVertexColor(0.6, 0.6, 0.6) Nenue@1: else Nenue@1: count:Hide() Nenue@1: end Nenue@1: rangeTimer = TOOLTIP_UPDATE_TIME Nenue@1: end Nenue@1: Nenue@1: self.rangeTimer = rangeTimer Nenue@1: end Nenue@1: end Nenue@1: Nenue@1: function Veneer_QuestObjectiveItem_UpdateCooldown (itemButton) Nenue@1: local start, duration, enable = GetQuestLogSpecialItemCooldown(itemButton.questLogIndex) Nenue@1: if (start) then Nenue@1: CooldownFrame_SetTimer(itemButton.Cooldown, start, duration, enable) Nenue@1: if (duration > 0 and enable == 0) then Nenue@1: SetItemButtonTextureVertexColor(itemButton, 0.4, 0.4, 0.4) Nenue@1: else Nenue@1: SetItemButtonTextureVertexColor(itemButton, 1, 1, 1) Nenue@1: end Nenue@1: end Nenue@1: end