Quantcast

Rename the addon

Adrian L Lange [08-10-14 - 22:07]
Rename the addon
Filename
.pkgmeta
Config.lua
Monomyth.lua
Monomyth.toc
QuickQuest.lua
QuickQuest.toc
diff --git a/.pkgmeta b/.pkgmeta
index 5b8237e..2cc013c 100644
--- a/.pkgmeta
+++ b/.pkgmeta
@@ -1 +1 @@
-package-as: Monomyth
+package-as: QuickQuest
diff --git a/Config.lua b/Config.lua
index 3741f1f..714d1e4 100644
--- a/Config.lua
+++ b/Config.lua
@@ -47,18 +47,18 @@ Panel:Hide()

 Panel:RegisterEvent('PLAYER_LOGIN')
 Panel:SetScript('OnEvent', function()
-	MonomythDB = MonomythDB or defaults
+	QuickQuestDB = QuickQuestDB or defaults

 	for key, value in next, defaults do
-		if(MonomythDB[key] == nil) then
-			MonomythDB[key] = value
+		if(QuickQuestDB[key] == nil) then
+			QuickQuestDB[key] = value
 		end
 	end
 end)

 function Panel:okay()
 	for key, value in next, temporary do
-		MonomythDB[key] = value
+		QuickQuestDB[key] = value
 	end
 end

@@ -69,7 +69,7 @@ end
 function Panel:default()
 	for key, value in next, defaults do
 		if(key ~= 'ignoredQuests') then
-			MonomythDB[key] = value
+			QuickQuestDB[key] = value
 		end
 	end

@@ -79,12 +79,12 @@ end
 function Panel:refresh()
 	for key, button in next, buttons do
 		if(button:IsObjectType('CheckButton')) then
-			button:SetChecked(MonomythDB[key])
+			button:SetChecked(QuickQuestDB[key])
 		elseif(button:IsObjectType('Button')) then
-			UIDropDownMenu_SetSelectedValue(button, MonomythDB[key])
+			UIDropDownMenu_SetSelectedValue(button, QuickQuestDB[key])

 			-- This is for some reason needed, gotta take a look into it later
-			UIDropDownMenu_SetText(button, _G[MonomythDB[key] .. '_KEY'])
+			UIDropDownMenu_SetText(button, _G[QuickQuestDB[key] .. '_KEY'])
 		end
 	end
 end
@@ -150,12 +150,12 @@ do
 	end

 	function CreateDropdown(parent, key, func)
-		local Dropdown = CreateFrame('Button', 'MonomythDropDown_' .. GetTime(), parent, 'UIDropDownMenuTemplate')
+		local Dropdown = CreateFrame('Button', 'QuickQuestDropDown_' .. GetTime(), parent, 'UIDropDownMenuTemplate')
 		Dropdown.OnClick = OnClick
 		Dropdown.key = key

 		UIDropDownMenu_SetWidth(Dropdown, 90)
-		UIDropDownMenu_SetSelectedValue(Dropdown, MonomythDB[key])
+		UIDropDownMenu_SetSelectedValue(Dropdown, QuickQuestDB[key])
 		UIDropDownMenu_Initialize(Dropdown, func)

 		local Text = Dropdown:CreateFontString(nil, nil, 'GameFontHighlight')
@@ -211,7 +211,7 @@ Panel:SetScript('OnShow', function(self)
 		end
 	end)

-	if(MonomythDB.gossip) then
+	if(QuickQuestDB.gossip) then
 		GossipRaid:Enable()
 		GossipRaid.Text:SetTextColor(1, 1, 1)
 	else
@@ -250,7 +250,7 @@ Panel:SetScript('OnShow', function(self)
 	end)
 	Modifier:SetPoint('TOPLEFT', Reverse, 'BOTTOMLEFT', -13, -14)

-	if(MonomythDB.reverse) then
+	if(QuickQuestDB.reverse) then
 		Modifier.Text:SetText('Modifier to temporarly enable automation')
 	else
 		Modifier.Text:SetText('Modifier to temporarly disable automation')
@@ -278,10 +278,10 @@ FilterPanel.parent = addonName
 FilterPanel:Hide()

 function FilterPanel:default()
-	table.wipe(MonomythDB.ignoredQuests)
+	table.wipe(QuickQuestDB.ignoredQuests)

 	for quest, item in next, defaults.ignoredQuests do
-		MonomythDB.ignoredQuests[quest] = item
+		QuickQuestDB.ignoredQuests[quest] = item
 	end

 	UpdateFilterBox()
@@ -320,12 +320,12 @@ end

 local filterItems = {}

-StaticPopupDialogs.MONOMYTH_FILTER = {
+StaticPopupDialogs.QUICKQUEST_FILTER = {
 	text = 'Are you sure you want to delete |T%s:16|t%s from the filter?',
 	button1 = 'Yes',
 	button2 = 'No',
 	OnAccept = function(self, data)
-		MonomythDB.ignoredQuests[data.questID] = nil
+		QuickQuestDB.ignoredQuests[data.questID] = nil
 		filterItems[data.itemID] = nil
 		data.button:Hide()

@@ -362,7 +362,7 @@ FilterPanel:SetScript('OnShow', function(self)
 	local function FilterItemOnClick(self, button)
 		if(button == 'RightButton') then
 			local _, link, _, _, _, _, _, _, _, texture = GetItemInfo(self.itemID)
-			local dialog = StaticPopup_Show('MONOMYTH_FILTER', texture, link)
+			local dialog = StaticPopup_Show('QUICKQUEST_FILTER', texture, link)
 			dialog.data = {
 				itemID = self.itemID,
 				questID = self.questID,
@@ -372,7 +372,7 @@ FilterPanel:SetScript('OnShow', function(self)
 	end

 	function UpdateFilterBox()
-		for quest, item in next, MonomythDB.ignoredQuests do
+		for quest, item in next, QuickQuestDB.ignoredQuests do
 			if(not filterItems[item]) then
 				local Button = CreateFrame('Button', nil, FilterBox)
 				Button:SetSize(34, 34)
@@ -434,8 +434,8 @@ FilterPanel:SetScript('OnShow', function(self)
 							questID = string.format('progress_%s', itemID)
 						end

-						if(not MonomythDB.ignoredQuests[questID]) then
-							MonomythDB.ignoredQuests[questID] = itemID
+						if(not QuickQuestDB.ignoredQuests[questID]) then
+							QuickQuestDB.ignoredQuests[questID] = itemID
 							ClearCursor()

 							UpdateFilterBox()
@@ -459,7 +459,8 @@ end)
 InterfaceOptions_AddCategory(Panel)
 InterfaceOptions_AddCategory(FilterPanel)

-SLASH_Monomyth1 = '/monomyth'
+SLASH_QuickQuest1 = '/qq'
+SLASH_QuickQuest2 = '/quickquest'
 SlashCmdList[addonName] = function()
 	-- On first load IOF doesn't select the right category or panel, this is a dirty fix
 	InterfaceOptionsFrame_OpenToCategory(addonName)
diff --git a/Monomyth.lua b/Monomyth.lua
deleted file mode 100644
index 73f8901..0000000
--- a/Monomyth.lua
+++ /dev/null
@@ -1,344 +0,0 @@
-local Monomyth = CreateFrame('Frame')
-Monomyth:SetScript('OnEvent', function(self, event, ...) self[event](...) end)
-
-local DelayHandler
-do
-	local currentInfo = {}
-
-	local Delayer = Monomyth:CreateAnimationGroup()
-	Delayer:CreateAnimation():SetDuration(1)
-	Delayer:SetLooping('NONE')
-	Delayer:SetScript('OnFinished', function()
-		DelayHandler(unpack(currentInfo))
-	end)
-
-	local delayed = true
-	function DelayHandler(func, ...)
-		if(delayed) then
-			delayed = false
-
-			table.wipe(currentInfo)
-			table.insert(currentInfo, func)
-
-			for index = 1, select('#', ...) do
-				local argument = select(index, ...)
-				table.insert(currentInfo, argument)
-			end
-
-			Delayer:Play()
-		else
-			delayed = true
-			func(...)
-		end
-	end
-end
-
-local atBank, atMail, atMerchant
-local choiceQueue, autoCompleteIndex
-
-local delayEvent = {
-	GOSSIP_SHOW = true,
-	GOSSIP_CONFIRM = true,
-	QUEST_GREETING = true,
-	QUEST_DETAIL = true,
-	QUEST_ACCEPT_CONFIRM = true,
-	QUEST_PROGRESS = true,
-	QUEST_AUTOCOMPLETE = true,
-}
-
-local modifier = false
-function Monomyth:Register(event, func, override)
-	self:RegisterEvent(event)
-	self[event] = function(...)
-		if(override or MonomythDB.toggle and MonomythDB.reverse == modifier) then
-			if(MonomythDB.delay and delayEvent[event]) then
-				DelayHandler(func, ...)
-			else
-				func(...)
-			end
-		end
-	end
-end
-
-local function IsTrackingTrivial()
-	for index = 1, GetNumTrackingTypes() do
-		local name, _, active = GetTrackingInfo(index)
-		if(name == MINIMAP_TRACKING_TRIVIAL_QUESTS) then
-			return active
-		end
-	end
-end
-
-Monomyth:Register('QUEST_GREETING', function()
-	local active = GetNumActiveQuests()
-	if(active > 0) then
-		for index = 1, active do
-			local _, complete = GetActiveTitle(index)
-			if(complete) then
-				SelectActiveQuest(index)
-			end
-		end
-	end
-
-	local available = GetNumAvailableQuests()
-	if(available > 0) then
-		for index = 1, available do
-			if(not IsAvailableQuestTrivial(index) or IsTrackingTrivial()) then
-				SelectAvailableQuest(index)
-			end
-		end
-	end
-end)
-
--- This should be part of the API, really
-local function IsGossipQuestCompleted(index)
-	return not not select(((index * 5) - 5) + 4, GetGossipActiveQuests())
-end
-
-local function IsGossipQuestTrivial(index)
-	return not not select(((index * 6) - 6) + 3, GetGossipAvailableQuests())
-end
-
-local function GetCreatureID()
-	return tonumber(string.sub(UnitGUID('npc') or '', -12, -9), 16)
-end
-
-Monomyth:Register('GOSSIP_SHOW', function()
-	local active = GetNumGossipActiveQuests()
-	if(active > 0) then
-		for index = 1, active do
-			if(IsGossipQuestCompleted(index)) then
-				SelectGossipActiveQuest(index)
-			end
-		end
-	end
-
-	local available = GetNumGossipAvailableQuests()
-	if(available > 0) then
-		for index = 1, available do
-			if(not IsGossipQuestTrivial(index) or IsTrackingTrivial()) then
-				SelectGossipAvailableQuest(index)
-			end
-		end
-	end
-
-	if(MonomythDB.gossip) then
-		if(available == 0 and active == 0 and GetNumGossipOptions() == 1) then
-			local _, instance = GetInstanceInfo()
-			if(not (MonomythDB.gossipraid and instance == 'raid')) then
-				local _, type = GetGossipOptions()
-				if(type == 'gossip') then
-					SelectGossipOption(1)
-					return
-				end
-			end
-		end
-	end
-
-	if(MonomythDB.faireport) then
-		local creatureID = GetCreatureID()
-		if(creatureID and creatureID == 57850) then
-			-- See if 1 is the right option
-			SelectGossipOption(1)
-		end
-	end
-end)
-
-local darkmoonNPC = {
-	[57850] = true, -- Teleportologist Fozlebub
-	[55382] = true, -- Darkmoon Faire Mystic Mage (Horde)
-	[54334] = true, -- Darkmoon Faire Mystic Mage (Alliance)
-}
-
-Monomyth:Register('GOSSIP_CONFIRM', function(index)
-	if(not MonomythDB.faireport) then return end
-
-	local creatureID = GetCreatureID()
-	if(creatureID and darkmoonNPC[creatureID]) then
-		SelectGossipOption(index, '', true)
-		StaticPopup_Hide('GOSSIP_CONFIRM')
-	end
-end)
-
-Monomyth:Register('QUEST_DETAIL', function()
-	if(not QuestGetAutoAccept()) then
-		AcceptQuest()
-	end
-end)
-
-Monomyth:Register('QUEST_ACCEPT_CONFIRM', AcceptQuest)
-
-Monomyth:Register('QUEST_ACCEPTED', function(id)
-	if(QuestFrame:IsShown() and QuestGetAutoAccept()) then
-		CloseQuest()
-	end
-end)
-
-Monomyth:Register('QUEST_ITEM_UPDATE', function()
-	if(choiceQueue and Monomyth[choiceQueue]) then
-		Monomyth[choiceQueue]()
-	end
-end)
-
-Monomyth:Register('QUEST_PROGRESS', function()
-	if(IsQuestCompletable()) then
-		local requiredItems = GetNumQuestItems()
-		if(requiredItems > 0) then
-			for index = 1, requiredItems do
-				local link = GetQuestItemLink('required', index)
-				if(link) then
-					local id = tonumber(string.match(link, 'item:(%d+)'))
-					for _, itemID in next, MonomythDB.ignoredQuests do
-						if(itemID == id) then
-							return
-						end
-					end
-				else
-					choiceQueue = 'QUEST_PROGRESS'
-					return
-				end
-			end
-		end
-
-		CompleteQuest()
-	end
-end)
-
-Monomyth:Register('QUEST_COMPLETE', function()
-	local choices = GetNumQuestChoices()
-	if(choices <= 1) then
-		GetQuestReward(1)
-	elseif(choices > 1) then
-		local bestValue, bestIndex = 0
-
-		for index = 1, choices do
-			local link = GetQuestItemLink('choice', index)
-			if(link) then
-				local _, _, _, _, _, _, _, _, _, _, value = GetItemInfo(link)
-
-				if(string.match(link, 'item:45724:')) then
-					-- Champion's Purse, contains 10 gold
-					value = 1e5
-				end
-
-				if(value > bestValue) then
-					bestValue, bestIndex = value, index
-				end
-			else
-				choiceQueue = 'QUEST_COMPLETE'
-				return GetQuestItemInfo('choice', index)
-			end
-		end
-
-		if(bestIndex) then
-			_G['QuestInfoItem' .. bestIndex]:Click()
-		end
-	end
-end)
-
-Monomyth:Register('QUEST_FINISHED', function()
-	choiceQueue = nil
-	autoCompleteIndex = nil
-end)
-
-Monomyth:Register('QUEST_AUTOCOMPLETE', function(id)
-	local index = GetQuestLogIndexByID(id)
-	if(GetQuestLogIsAutoComplete(index)) then
-		ShowQuestComplete(index)
-
-		autoCompleteIndex = index
-	end
-end)
-
-Monomyth:Register('BAG_UPDATE_DELAYED', function()
-	if(autoCompleteIndex) then
-		ShowQuestComplete(autoCompleteIndex)
-
-		autoCompleteIndex = nil
-	end
-end)
-
-Monomyth:Register('BANKFRAME_OPENED', function()
-	atBank = true
-end)
-
-Monomyth:Register('BANKFRAME_CLOSED', function()
-	atBank = false
-end)
-
-Monomyth:Register('GUILDBANKFRAME_OPENED', function()
-	atBank = true
-end)
-
-Monomyth:Register('GUILDBANKFRAME_CLOSED', function()
-	atBank = false
-end)
-
-Monomyth:Register('MAIL_SHOW', function()
-	atMail = true
-end)
-
-Monomyth:Register('MAIL_CLOSED', function()
-	atMail = false
-end)
-
-Monomyth:Register('MERCHANT_SHOW', function()
-	atMerchant = true
-end)
-
-Monomyth:Register('MERCHANT_CLOSED', function()
-	atMerchant = false
-end)
-
-local sub = string.sub
-Monomyth:Register('MODIFIER_STATE_CHANGED', function(key, state)
-	if(sub(key, 2) == MonomythDB.modifier) then
-		modifier = state == 1
-	end
-end, true)
-
-local questTip = CreateFrame('GameTooltip', 'MonomythTip', UIParent)
-local questLevel = string.gsub(ITEM_MIN_LEVEL, '%%d', '(%%d+)')
-
-local function GetQuestItemLevel()
-	for index = 1, questTip:NumLines() do
-		local level = string.match(_G['MonomythTipTextLeft' .. index]:GetText(), questLevel)
-		if(level and tonumber(level)) then
-			return tonumber(level)
-		end
-	end
-end
-
-local function BagUpdate(bag)
-	if(not MonomythDB.items) then return end
-	if(atBank or atMail or atMerchant) then return end
-
-	for slot = 1, GetContainerNumSlots(bag) do
-		local _, id, active = GetContainerItemQuestInfo(bag, slot)
-		if(id and not active and not IsQuestFlaggedCompleted(id) and not MonomythDB.ignoredQuests[id]) then
-			questTip:SetBagItem(bag, slot)
-			questTip:Show()
-
-			local level = GetQuestItemLevel()
-			if(not level or level >= UnitLevel('player')) then
-				UseContainerItem(bag, slot)
-			end
-		end
-	end
-end
-
-Monomyth:Register('PLAYER_LOGIN', function()
-	Monomyth:Register('BAG_UPDATE', BagUpdate)
-end)
-
-local errors = {
-	[ERR_QUEST_ALREADY_DONE] = true,
-	[ERR_QUEST_FAILED_LOW_LEVEL] = true,
-	[ERR_QUEST_NEED_PREREQS] = true,
-}
-
-ChatFrame_AddMessageEventFilter('CHAT_MSG_SYSTEM', function(self, event, message)
-	return errors[message]
-end)
-
-QuestInfoDescriptionText.SetAlphaGradient = function() end
diff --git a/Monomyth.toc b/Monomyth.toc
deleted file mode 100644
index 3ef67ae..0000000
--- a/Monomyth.toc
+++ /dev/null
@@ -1,9 +0,0 @@
-## Interface: 50400
-## Author: p3lim
-## Version: @project-version@
-## Title: Monomyth
-## Notes: Questing enhancements
-## SavedVariables: MonomythDB
-
-Config.lua
-Monomyth.lua
diff --git a/QuickQuest.lua b/QuickQuest.lua
new file mode 100644
index 0000000..3d589bd
--- /dev/null
+++ b/QuickQuest.lua
@@ -0,0 +1,344 @@
+local QuickQuest = CreateFrame('Frame')
+QuickQuest:SetScript('OnEvent', function(self, event, ...) self[event](...) end)
+
+local DelayHandler
+do
+	local currentInfo = {}
+
+	local Delayer = QuickQuest:CreateAnimationGroup()
+	Delayer:CreateAnimation():SetDuration(1)
+	Delayer:SetLooping('NONE')
+	Delayer:SetScript('OnFinished', function()
+		DelayHandler(unpack(currentInfo))
+	end)
+
+	local delayed = true
+	function DelayHandler(func, ...)
+		if(delayed) then
+			delayed = false
+
+			table.wipe(currentInfo)
+			table.insert(currentInfo, func)
+
+			for index = 1, select('#', ...) do
+				local argument = select(index, ...)
+				table.insert(currentInfo, argument)
+			end
+
+			Delayer:Play()
+		else
+			delayed = true
+			func(...)
+		end
+	end
+end
+
+local atBank, atMail, atMerchant
+local choiceQueue, autoCompleteIndex
+
+local delayEvent = {
+	GOSSIP_SHOW = true,
+	GOSSIP_CONFIRM = true,
+	QUEST_GREETING = true,
+	QUEST_DETAIL = true,
+	QUEST_ACCEPT_CONFIRM = true,
+	QUEST_PROGRESS = true,
+	QUEST_AUTOCOMPLETE = true
+}
+
+local modifier = false
+function QuickQuest:Register(event, func, override)
+	self:RegisterEvent(event)
+	self[event] = function(...)
+		if(override or QuickQuestDB.toggle and QuickQuestDB.reverse == modifier) then
+			if(QuickQuestDB.delay and delayEvent[event]) then
+				DelayHandler(func, ...)
+			else
+				func(...)
+			end
+		end
+	end
+end
+
+local function IsTrackingTrivial()
+	for index = 1, GetNumTrackingTypes() do
+		local name, _, active = GetTrackingInfo(index)
+		if(name == MINIMAP_TRACKING_TRIVIAL_QUESTS) then
+			return active
+		end
+	end
+end
+
+QuickQuest:Register('QUEST_GREETING', function()
+	local active = GetNumActiveQuests()
+	if(active > 0) then
+		for index = 1, active do
+			local _, complete = GetActiveTitle(index)
+			if(complete) then
+				SelectActiveQuest(index)
+			end
+		end
+	end
+
+	local available = GetNumAvailableQuests()
+	if(available > 0) then
+		for index = 1, available do
+			if(not IsAvailableQuestTrivial(index) or IsTrackingTrivial()) then
+				SelectAvailableQuest(index)
+			end
+		end
+	end
+end)
+
+-- This should be part of the API, really
+local function IsGossipQuestCompleted(index)
+	return not not select(((index * 5) - 5) + 4, GetGossipActiveQuests())
+end
+
+local function IsGossipQuestTrivial(index)
+	return not not select(((index * 6) - 6) + 3, GetGossipAvailableQuests())
+end
+
+local function GetCreatureID()
+	return tonumber(string.sub(UnitGUID('npc') or '', -12, -9), 16)
+end
+
+QuickQuest:Register('GOSSIP_SHOW', function()
+	local active = GetNumGossipActiveQuests()
+	if(active > 0) then
+		for index = 1, active do
+			if(IsGossipQuestCompleted(index)) then
+				SelectGossipActiveQuest(index)
+			end
+		end
+	end
+
+	local available = GetNumGossipAvailableQuests()
+	if(available > 0) then
+		for index = 1, available do
+			if(not IsGossipQuestTrivial(index) or IsTrackingTrivial()) then
+				SelectGossipAvailableQuest(index)
+			end
+		end
+	end
+
+	if(QuickQuestDB.gossip) then
+		if(available == 0 and active == 0 and GetNumGossipOptions() == 1) then
+			local _, instance = GetInstanceInfo()
+			if(not (QuickQuestDB.gossipraid and instance == 'raid')) then
+				local _, type = GetGossipOptions()
+				if(type == 'gossip') then
+					SelectGossipOption(1)
+					return
+				end
+			end
+		end
+	end
+
+	if(MonomythDB.faireport) then
+		local creatureID = GetCreatureID()
+		if(creatureID and creatureID == 57850) then
+			-- See if 1 is the right option
+			SelectGossipOption(1)
+		end
+	end
+end)
+
+local darkmoonNPC = {
+	[57850] = true, -- Teleportologist Fozlebub
+	[55382] = true, -- Darkmoon Faire Mystic Mage (Horde)
+	[54334] = true, -- Darkmoon Faire Mystic Mage (Alliance)
+}
+
+QuickQuest:Register('GOSSIP_CONFIRM', function(index)
+	if(not QuickQuestDB.faireport) then return end
+
+	local creatureID = GetCreatureID()
+	if(creatureID and darkmoonNPC[creatureID]) then
+		SelectGossipOption(index, '', true)
+		StaticPopup_Hide('GOSSIP_CONFIRM')
+	end
+end)
+
+QuickQuest:Register('QUEST_DETAIL', function()
+	if(not QuestGetAutoAccept()) then
+		AcceptQuest()
+	end
+end)
+
+QuickQuest:Register('QUEST_ACCEPT_CONFIRM', AcceptQuest)
+
+QuickQuest:Register('QUEST_ACCEPTED', function(id)
+	if(QuestFrame:IsShown() and QuestGetAutoAccept()) then
+		CloseQuest()
+	end
+end)
+
+QuickQuest:Register('QUEST_ITEM_UPDATE', function()
+	if(choiceQueue and QuickQuest[choiceQueue]) then
+		QuickQuest[choiceQueue]()
+	end
+end)
+
+QuickQuest:Register('QUEST_PROGRESS', function()
+	if(IsQuestCompletable()) then
+		local requiredItems = GetNumQuestItems()
+		if(requiredItems > 0) then
+			for index = 1, requiredItems do
+				local link = GetQuestItemLink('required', index)
+				if(link) then
+					local id = tonumber(string.match(link, 'item:(%d+)'))
+					for _, itemID in next, QuickQuestDB.ignoredQuests do
+						if(itemID == id) then
+							return
+						end
+					end
+				else
+					choiceQueue = 'QUEST_PROGRESS'
+					return
+				end
+			end
+		end
+
+		CompleteQuest()
+	end
+end)
+
+QuickQuest:Register('QUEST_COMPLETE', function()
+	local choices = GetNumQuestChoices()
+	if(choices <= 1) then
+		GetQuestReward(1)
+	elseif(choices > 1) then
+		local bestValue, bestIndex = 0
+
+		for index = 1, choices do
+			local link = GetQuestItemLink('choice', index)
+			if(link) then
+				local _, _, _, _, _, _, _, _, _, _, value = GetItemInfo(link)
+
+				if(string.match(link, 'item:45724:')) then
+					-- Champion's Purse, contains 10 gold
+					value = 1e5
+				end
+
+				if(value > bestValue) then
+					bestValue, bestIndex = value, index
+				end
+			else
+				choiceQueue = 'QUEST_COMPLETE'
+				return GetQuestItemInfo('choice', index)
+			end
+		end
+
+		if(bestIndex) then
+			_G['QuestInfoItem' .. bestIndex]:Click()
+		end
+	end
+end)
+
+QuickQuest:Register('QUEST_FINISHED', function()
+	choiceQueue = nil
+	autoCompleteIndex = nil
+end)
+
+QuickQuest:Register('QUEST_AUTOCOMPLETE', function(id)
+	local index = GetQuestLogIndexByID(id)
+	if(GetQuestLogIsAutoComplete(index)) then
+		ShowQuestComplete(index)
+
+		autoCompleteIndex = index
+	end
+end)
+
+QuickQuest:Register('BAG_UPDATE_DELAYED', function()
+	if(autoCompleteIndex) then
+		ShowQuestComplete(autoCompleteIndex)
+
+		autoCompleteIndex = nil
+	end
+end)
+
+QuickQuest:Register('BANKFRAME_OPENED', function()
+	atBank = true
+end)
+
+QuickQuest:Register('BANKFRAME_CLOSED', function()
+	atBank = false
+end)
+
+QuickQuest:Register('GUILDBANKFRAME_OPENED', function()
+	atBank = true
+end)
+
+QuickQuest:Register('GUILDBANKFRAME_CLOSED', function()
+	atBank = false
+end)
+
+QuickQuest:Register('MAIL_SHOW', function()
+	atMail = true
+end)
+
+QuickQuest:Register('MAIL_CLOSED', function()
+	atMail = false
+end)
+
+QuickQuest:Register('MERCHANT_SHOW', function()
+	atMerchant = true
+end)
+
+QuickQuest:Register('MERCHANT_CLOSED', function()
+	atMerchant = false
+end)
+
+local sub = string.sub
+QuickQuest:Register('MODIFIER_STATE_CHANGED', function(key, state)
+	if(sub(key, 2) == QuickQuestDB.modifier) then
+		modifier = state == 1
+	end
+end, true)
+
+local questTip = CreateFrame('GameTooltip', 'QuickQuestTip', UIParent)
+local questLevel = string.gsub(ITEM_MIN_LEVEL, '%%d', '(%%d+)')
+
+local function GetQuestItemLevel()
+	for index = 1, questTip:NumLines() do
+		local level = string.match(_G['QuickQuestTipTextLeft' .. index]:GetText(), questLevel)
+		if(level and tonumber(level)) then
+			return tonumber(level)
+		end
+	end
+end
+
+local function BagUpdate(bag)
+	if(not QuickQuestDB.items) then return end
+	if(atBank or atMail or atMerchant) then return end
+
+	for slot = 1, GetContainerNumSlots(bag) do
+		local _, id, active = GetContainerItemQuestInfo(bag, slot)
+		if(id and not active and not IsQuestFlaggedCompleted(id) and not QuickQuestDB.ignoredQuests[id]) then
+			questTip:SetBagItem(bag, slot)
+			questTip:Show()
+
+			local level = GetQuestItemLevel()
+			if(not level or level >= UnitLevel('player')) then
+				UseContainerItem(bag, slot)
+			end
+		end
+	end
+end
+
+QuickQuest:Register('PLAYER_LOGIN', function()
+	QuickQuest:Register('BAG_UPDATE', BagUpdate)
+end)
+
+local errors = {
+	[ERR_QUEST_ALREADY_DONE] = true,
+	[ERR_QUEST_FAILED_LOW_LEVEL] = true,
+	[ERR_QUEST_NEED_PREREQS] = true,
+}
+
+ChatFrame_AddMessageEventFilter('CHAT_MSG_SYSTEM', function(self, event, message)
+	return errors[message]
+end)
+
+QuestInfoDescriptionText.SetAlphaGradient = function() end
diff --git a/QuickQuest.toc b/QuickQuest.toc
new file mode 100644
index 0000000..e2db8d8
--- /dev/null
+++ b/QuickQuest.toc
@@ -0,0 +1,9 @@
+## Interface: 50400
+## Author: p3lim
+## Version: @project-version@
+## Title: QuickQuest
+## Notes: Quest automization wizardry
+## SavedVariables: QuickQuestDB
+
+Config.lua
+QuickQuest.lua