From f5fd162b6a4b1b9e3713c6e31035e7e79fba822e Mon Sep 17 00:00:00 2001 From: Alex Shubert Date: Fri, 14 Sep 2012 19:29:33 +0400 Subject: [PATCH] added trivial quest ignorance functionality. See http://wow.curseforge.com/addons/autoturnin/tickets/3-feature-request-ignore-low-level-quests/ for details --- AutoTurnIn.lua | 18 +++++++++++++----- loc/localization_DE.lua | 3 ++- loc/localization_EN.lua | 3 ++- loc/localization_RU.lua | 3 ++- ui/main_options.lua | 9 +++++++++ 5 files changed, 28 insertions(+), 8 deletions(-) diff --git a/AutoTurnIn.lua b/AutoTurnIn.lua index 05fba3f..a98f694 100644 --- a/AutoTurnIn.lua +++ b/AutoTurnIn.lua @@ -10,8 +10,9 @@ local C = ptable.CONST local TOCVersion = GetAddOnMetadata(addonName, "Version") AutoTurnIn = LibStub("AceAddon-3.0"):NewAddon("AutoTurnIn", "AceEvent-3.0", "AceConsole-3.0") -AutoTurnIn.defaults = {enabled = true, all = false, lootreward = 1, tournament = 2, - darkmoonteleport=true, togglekey=4, darkmoonautostart=true, showrewardtext=true, version=TOCVersion, autoequip = false, debug=false, +AutoTurnIn.defaults = {enabled = true, all = false, trivial = false, lootreward = 1, tournament = 2, + darkmoonteleport=true, togglekey=4, darkmoonautostart=true, showrewardtext=true, + version=TOCVersion, autoequip = false, debug=false, armor = {}, weapon = {}, stat = {}, secondary = {}} AutoTurnIn.ldb, AutoTurnIn.allowed = nil, nil AutoTurnIn.caption = addonName ..' [%s]' @@ -150,8 +151,9 @@ function AutoTurnIn:QUEST_GREETING() end for index=1, GetNumAvailableQuests() do + local isTrivialAndTrivialIsAllowed = AutoTurnInCharacterDB.trivial and IsActiveQuestTrivial(index) local quest = L.quests[GetAvailableTitle(index)] - if (AutoTurnInCharacterDB.all or quest)then + if (isTrivialAndTrivialIsAllowed and (AutoTurnInCharacterDB.all or quest))then if quest and quest.amount then if self:GetItemAmount(quest.currency, quest.item) >= quest.amount then SelectAvailableQuest(index) @@ -192,10 +194,16 @@ end -- like previous function this one works around `nil` values in a list. function AutoTurnIn:VarArgForAvailableQuests(...) local MOP_INDEX_CONST = 6 -- was '5' in Cataclysm + for i=1, select("#", ...), MOP_INDEX_CONST do local questname = select(i, ...) - local quest = L.quests[questname] - if AutoTurnInCharacterDB.all or (quest and (not quest.donotaccept)) then + local isTrivial = select(i+2, ...) + local quest = L.quests[questname] -- this quest exists in questlist, stored in addons localization files. There are mostly daily quests + + local isTrivialAndTrivialIsAllowed = AutoTurnInCharacterDB.trivial and isTrivial + local inListAndAllowed = quest and (not quest.donotaccept) + -- Quest is appropriate if: (it is trivial and trivial are accepted) and (any quest accepted or (it is daily quest that is not in ignore list)) + if ( isTrivialAndTrivialIsAllowed and (AutoTurnInCharacterDB.all or inListAndAllowed) ) then if quest and quest.amount then if self:GetItemAmount(quest.currency, quest.item) >= quest.amount then SelectGossipAvailableQuest(math.floor(i/MOP_INDEX_CONST)+1) diff --git a/loc/localization_DE.lua b/loc/localization_DE.lua index e80b990..7a8b6ef 100644 --- a/loc/localization_DE.lua +++ b/loc/localization_DE.lua @@ -14,7 +14,8 @@ privateTable.L = setmetatable({ ["resetbutton"]="reset", ["questTypeLabel"] = "quests", - ["questTypeAll"] = "alle", + ["questTypeAll"] = "alle", + ["TrivialQuests"]="akzeptieren 'grauen' Quests", ["questTypeList"] = "Täglich", ["lootTypeLabel"]="Jobs mit Auszeichnungen", diff --git a/loc/localization_EN.lua b/loc/localization_EN.lua index 0ae48c0..73bb293 100644 --- a/loc/localization_EN.lua +++ b/loc/localization_EN.lua @@ -11,7 +11,8 @@ privateTable.L = setmetatable({ ["resetbutton"]="reset", ["questTypeLabel"] = "Quests to handle", - ["questTypeAll"] = "all", + ["questTypeAll"] = "all", + ["TrivialQuests"]="Accept 'grey' quests", ["questTypeList"] = "daily", ["lootTypeLabel"]="Quests with rewards", diff --git a/loc/localization_RU.lua b/loc/localization_RU.lua index 777efd7..129511d 100644 --- a/loc/localization_RU.lua +++ b/loc/localization_RU.lua @@ -14,7 +14,8 @@ privateTable.L = setmetatable({ ["resetbutton"]="сброс", ["questTypeLabel"] = "задания", - ["questTypeAll"] = "все", + ["questTypeAll"] = "все", + ["TrivialQuests"]="брать 'серые' квесты", ["questTypeList"] = "ежедневные", ["lootTypeLabel"]="задания с наградами", diff --git a/ui/main_options.lua b/ui/main_options.lua index 778b7a1..205a217 100644 --- a/ui/main_options.lua +++ b/ui/main_options.lua @@ -53,6 +53,13 @@ end) UIDropDownMenu_SetWidth(QuestDropDown, 200); UIDropDownMenu_JustifyText(QuestDropDown, "LEFT") +-- DarkmoonTeleport +local TrivialQuests = CreateFrame("CheckButton", O.."TrivialQuests", OptionsPanel, "OptionsCheckButtonTemplate") +_G[TrivialQuests:GetName().."Text"]:SetText(L["TrivialQuests"]) +TrivialQuests:SetScript("OnClick", function(self) + ptable.TempConfig.trivial = self:GetChecked() == 1 +end) + -- Tournament loot type local TournamentDropDownLabel = OptionsPanel:CreateFontString(nil, "ARTWORK", "GameFontNormal") TournamentDropDownLabel:SetText(L["tournamentLabel"]) @@ -158,6 +165,7 @@ ResetButton:SetPoint("TOPRIGHT", OptionsPanel, "TOPRIGHT", -10, -10) Enable:SetPoint("TOPLEFT", subText, "BOTTOMLEFT", 0, -16) QuestLabel:SetPoint("BOTTOMLEFT", QuestDropDown, "TOPLEFT", 18, 0) QuestDropDown:SetPoint("TOPLEFT", Enable, "BOTTOMLEFT", -15, -35) +TrivialQuests:SetPoint("TOPLEFT", QuestDropDown, "TOPRIGHT", 30, 0) LootLabel:SetPoint("BOTTOMLEFT", LootDropDown, "TOPLEFT", 18, 0) LootDropDown:SetPoint("TOPLEFT", QuestDropDown, "BOTTOMLEFT", 0, -30) TournamentDropDownLabel:SetPoint("BOTTOMLEFT", TournamentDropDown, "TOPLEFT", 18, 0) @@ -194,6 +202,7 @@ OptionsPanel.refresh = function() ShowRewardText:SetChecked(ptable.TempConfig.showrewardtext) EquipReward:SetChecked(ptable.TempConfig.autoequip) Debug:SetChecked(ptable.TempConfig.debug) + TrivialQuests:SetChecked(ptable.TempConfig.trivial) UIDropDownMenu_SetSelectedID(ToggleKeyDropDown, ptable.TempConfig.togglekey) UIDropDownMenu_SetText(ToggleKeyDropDown, ToggleKeyConst[ptable.TempConfig.togglekey]) -- 1.7.9.5