Quantcast

turn in only

Alex Shubert [12-16-13 - 17:41]
turn in only
Filename
AutoTurnIn.lua
loc/localization_DE.lua
loc/localization_EN.lua
loc/localization_FR.lua
loc/localization_RU.lua
ui/main_options.lua
diff --git a/AutoTurnIn.lua b/AutoTurnIn.lua
index be54d4c..81dd124 100644
--- a/AutoTurnIn.lua
+++ b/AutoTurnIn.lua
@@ -13,7 +13,8 @@ local Q_ALL, Q_DAILY, Q_EXCEPTDAILY = 1, 2, 3


 AutoTurnIn = LibStub("AceAddon-3.0"):NewAddon("AutoTurnIn", "AceEvent-3.0", "AceConsole-3.0")
-AutoTurnIn.defaults = {enabled = true, all = 2, trivial = false, lootreward = 1, tournament = 2,
+AutoTurnIn.defaults = {enabled = true, all = 2, trivial = false, completeonly = false,
+                       lootreward = 1, tournament = 2,
 					   darkmoonteleport=true, todarkmoon=true, togglekey=4, darkmoonautostart=true, showrewardtext=true,
 					   version=TOCVersion, autoequip = false, debug=false,
 					   questlevel=true, watchlevel=true, questshare=false,
@@ -199,7 +200,6 @@ end

 -- Old 'Quest NPC' interaction system. See http://wowprogramming.com/docs/events/QUEST_GREETING
 function AutoTurnIn:QUEST_GREETING()
-    print("OLD")
 	if (not self:AllowedToHandle(true)) then
 		return
 	end
@@ -211,27 +211,29 @@ function AutoTurnIn:QUEST_GREETING()
 		end
 	end

-	for index=1, GetNumAvailableQuests() do
-		local isTrivial, isDaily, isRepeatable = GetAvailableQuestInfo(index)
-		local triviaAndAllowedOrNotTrivia = (not isTrivial) or AutoTurnInCharacterDB.trivial
-		local title = GetAvailableTitle(index)
-		local quest = L.quests[title]
-		local notBlackListed = not (quest and (quest.donotaccept or AutoTurnIn:IsIgnoredQuest(title)))
+    if not AutoTurnInCharacterDB.completeonly then
+        for index=1, GetNumAvailableQuests() do
+            local isTrivial, isDaily, isRepeatable = GetAvailableQuestInfo(index)
+            local triviaAndAllowedOrNotTrivia = (not isTrivial) or AutoTurnInCharacterDB.trivial
+            local title = GetAvailableTitle(index)
+            local quest = L.quests[title]
+            local notBlackListed = not (quest and (quest.donotaccept or AutoTurnIn:IsIgnoredQuest(title)))

-		if isDaily then
-			self:CacheAsDaily(GetAvailableTitle(index))
-		end
+            if isDaily then
+                self:CacheAsDaily(GetAvailableTitle(index))
+            end

-		if (triviaAndAllowedOrNotTrivia and notBlackListed and self:_isAppropriate(isDaily)) then
-			if quest and quest.amount then
-				if self:GetItemAmount(quest.currency, quest.item) >= quest.amount then
-					SelectAvailableQuest(index)
-				end
-			else
-				SelectAvailableQuest(index)
-			end
-		end
-	end
+            if (triviaAndAllowedOrNotTrivia and notBlackListed and self:_isAppropriate(isDaily)) then
+                if quest and quest.amount then
+                    if self:GetItemAmount(quest.currency, quest.item) >= quest.amount then
+                        SelectAvailableQuest(index)
+                    end
+                else
+                    SelectAvailableQuest(index)
+                end
+            end
+        end
+    end
 end

 -- (gaq[i+3]) equals "1" if quest is complete, "nil" otherwise
@@ -317,7 +319,9 @@ function AutoTurnIn:GOSSIP_SHOW()
 	local questCount = GetNumGossipActiveQuests() > 0

 	self:VarArgForActiveQuests(GetGossipActiveQuests())
-	self:VarArgForAvailableQuests(GetGossipAvailableQuests())
+    if not AutoTurnInCharacterDB.completeonly then
+	    self:VarArgForAvailableQuests(GetGossipAvailableQuests())
+    end

 	if self:isDarkmoonAndAllowed(questCount) then
 		local options = {GetGossipOptions()}
@@ -343,8 +347,8 @@ function AutoTurnIn:QUEST_DETAIL()
 	if (QuestIsDaily() or QuestIsWeekly()) then
 		self:CacheAsDaily(GetTitleText())
 	end
-
-	if self:AllowedToHandle() and self:isAppropriate() then
+
+	if self:AllowedToHandle() and self:isAppropriate() and (not AutoTurnInCharacterDB.completeonly)then
 		QuestInfoDescriptionText:SetAlphaGradient(0, -1)
 		QuestInfoDescriptionText:SetAlpha(1)
 		AcceptQuest()
@@ -360,7 +364,7 @@ end

 function AutoTurnIn:QUEST_PROGRESS()
     if  self:AllowedToHandle() and IsQuestCompletable() and self:isAppropriate() then
-		CompleteQuest()
+        CompleteQuest()
     end
 end

@@ -469,7 +473,7 @@ function AutoTurnIn:TurnInQuest(rewardIndex)
 		elseif (GetNumQuestChoices() == 0) then
 			self:Print("Debug: turning quest in, no choice required")
 		end
-	else
+    else
 		GetQuestReward(rewardIndex)
 	end
 end
diff --git a/loc/localization_DE.lua b/loc/localization_DE.lua
index 06d0bfa..ffbe384 100644
--- a/loc/localization_DE.lua
+++ b/loc/localization_DE.lua
@@ -19,13 +19,14 @@ privateTable.L = setmetatable({
     ["questTypeExceptDaily"] = "außer Tägliche",
     ["TrivialQuests"]="'graue' Quests annehmen",
 	["ShareQuestsLabel"] = "teilen die Quest",
+    ["CompleteOnly"] = "zurückliefern bloß",

 	["lootTypeLabel"]="Jobs mit Belohnungen",
 	["lootTypeFalse"]="nicht abgeben",
 	["lootTypeGreed"]="Teuerste Belohnung wählen",
 	["lootTypeNeed"]="Wähle Belohnung nach Parametern",

-	["tournamentLabel"]="Turnier",
+	["tournamentLabel"]="Das Argentumturnier",
 	["tournamentWrit"]="Verfügung des Champions", -- 46114
 	["tournamentPurse"]="Geldbeutel des Champions",  -- 45724

diff --git a/loc/localization_EN.lua b/loc/localization_EN.lua
index 8f15cfd..8ce112e 100644
--- a/loc/localization_EN.lua
+++ b/loc/localization_EN.lua
@@ -19,19 +19,20 @@ privateTable.L = setmetatable({
 	["dontloottrue"]="do not complete quests with rewards",
 	["resetbutton"]="reset",

-	["questTypeLabel"] = "Quests to handle",
+	["questTypeLabel"] = "quests to handle",
 	["questTypeAll"] = "all",
     ["questTypeList"] = "daily",
     ["questTypeExceptDaily"] = "except daily",
     ["TrivialQuests"]="Accept 'grey' quests",
-	["ShareQuestsLabel"] = "Quest auto sharing",
+	["ShareQuestsLabel"] = "quest auto sharing",
+    ["CompleteOnly"] = "turn in only",

-	["lootTypeLabel"]="Quests with rewards",
+	["lootTypeLabel"]="quests with rewards",
 	["lootTypeFalse"]="don't turn in",
 	["lootTypeGreed"]="loot most expensive reward",
 	["lootTypeNeed"]="loot by parameters",

-	["tournamentLabel"]="Tournament",
+	["tournamentLabel"]="Argent Tournament",
 	["tournamentWrit"]="Champion's Writ", -- 46114
 	["tournamentPurse"]="Champion's Purse",  -- 45724

@@ -40,11 +41,11 @@ privateTable.L = setmetatable({
 	["DarkmoonFaireTeleport"]="Teleportologist Fozlebub",
 	["DarkmoonAutoLabel"]="Darkmoon: start the game!",

-	["rewardtext"]="Print quest competition text",
-	["questlevel"]="Show quest level",
-	["watchlevel"]="Show watched quest level",
-	["autoequip"]="Equip received reward",
-	["togglekey"]="Enable/disable key",
+	["rewardtext"]="print quest competition text",
+	["questlevel"]="show quest level",
+	["watchlevel"]="show watched quest level",
+	["autoequip"]="equip received reward",
+	["togglekey"]="enable/disable key",

 	['Jewelry']="Jewelry",
 	["rewardlootoptions"]="Reward loot rules",
diff --git a/loc/localization_FR.lua b/loc/localization_FR.lua
index ef98994..a3858b8 100644
--- a/loc/localization_FR.lua
+++ b/loc/localization_FR.lua
@@ -17,13 +17,14 @@ privateTable.L = setmetatable({
     ["questTypeExceptDaily"] = "excepté journalières",
     ["TrivialQuests"]= "Accepter les quêtes 'grise'",
 	["ShareQuestsLabel"] = "partager la quête",
+    ["CompleteOnly"] = "turn in only",

     ["lootTypeLabel"]="Quêtes à récompense d'objet",
     ["lootTypeFalse"]="Ne pas rendre",
     ["lootTypeGreed"]="Vhoisir la récompense la plus chère",
     ["lootTypeNeed"]="choisir la récompense selon les paramètres",

-    ["tournamentLabel"]="Tournoi d'argent",
+    ["tournamentLabel"]="Le tournoi d'Argent",
     ["tournamentWrit"]="Commission de champion", -- 46114
     ["tournamentPurse"]="Bourse de champion",  -- 45724

diff --git a/loc/localization_RU.lua b/loc/localization_RU.lua
index 8990801..ea838e0 100644
--- a/loc/localization_RU.lua
+++ b/loc/localization_RU.lua
@@ -19,6 +19,7 @@ privateTable.L = setmetatable({
     ["questTypeExceptDaily"] = "кроме ежедневных",
     ["TrivialQuests"]="брать 'серые' квесты",
 	["ShareQuestsLabel"] = "Предлагать задание группе",
+    ["CompleteOnly"] = "только завершать",

 	["lootTypeLabel"]="задания с наградами",
 	["lootTypeFalse"]="не сдавать",
diff --git a/ui/main_options.lua b/ui/main_options.lua
index fd43471..d46347a 100644
--- a/ui/main_options.lua
+++ b/ui/main_options.lua
@@ -61,7 +61,8 @@ end
 local Enable = newCheckbox("enabled", L["enabled"], "enabled")
 -- trivial, so called grayed quests
 local TrivialQuests = newCheckbox("TrivialQuests", L["TrivialQuests"], "trivial")
-
+-- Only hand in the quest
+local CompleteOnly = newCheckbox("CompleteOnly", L["CompleteOnly"], "completeonly")
 -- DarkmoonTeleport
 local ToDarkMoon = newCheckbox("ToDarkMoon", L["ToDarkmoonLabel"], "todarkmoon")
 -- Darkmoon Teleport to cannon
@@ -102,8 +103,9 @@ ResetButton:SetPoint("TOPRIGHT", OptionsPanel, "TOPRIGHT", -10, -10)
 Enable:SetPoint("TOPLEFT", subText, "BOTTOMLEFT", 0, -14)
 QuestDropDown:SetPoint("TOPLEFT", Enable, "BOTTOMLEFT", -15, -22)
 TrivialQuests:SetPoint("TOPLEFT", QuestDropDown, "TOPRIGHT", 30, 0)
+CompleteOnly:SetPoint("TOPLEFT", TrivialQuests, "BOTTOMLEFT", 0, -10)
 LootDropDown:SetPoint("TOPLEFT", QuestDropDown, "BOTTOMLEFT", 0, -22)
-TournamentDropDown:SetPoint("TOPLEFT", LootDropDown, "TOPRIGHT", 17, 0)
+TournamentDropDown:SetPoint("TOPLEFT", ToggleKeyDropDown, "TOPRIGHT", 17, 0)
 EquipReward:SetPoint("TOPLEFT", LootDropDown, "BOTTOMLEFT", 16, -10)
 ShowRewardText:SetPoint("TOPLEFT", EquipReward, "BOTTOMLEFT", 0, -10)
 ToDarkMoon:SetPoint("TOPLEFT", ShowRewardText, "BOTTOMLEFT", 0, -10)
@@ -137,6 +139,7 @@ OptionsPanel.refresh = function()
 	EquipReward:SetChecked(ptable.TempConfig.autoequip)
 	Debug:SetChecked(ptable.TempConfig.debug)
 	TrivialQuests:SetChecked(ptable.TempConfig.trivial)
+    CompleteOnly:SetChecked(ptable.TempConfig.completeonly)
 	ShowQuestLevel:SetChecked(ptable.TempConfig.questlevel)
 	ShowWatchLevel:SetChecked(ptable.TempConfig.watchlevel)
 	ShareQuests:SetChecked(ptable.TempConfig.questshare)