Quantcast

tillers gift solution through the quest name first word

Alex Shubert [10-13-13 - 18:01]
tillers gift solution through the quest name first word
Filename
AutoTurnIn.lua
loc/localization_DE.lua
loc/localization_EN.lua
loc/localization_FR.lua
loc/localization_RU.lua
diff --git a/AutoTurnIn.lua b/AutoTurnIn.lua
index 4779c01..5e7a0b3 100644
--- a/AutoTurnIn.lua
+++ b/AutoTurnIn.lua
@@ -23,8 +23,6 @@ AutoTurnIn.funcList = {[1] = function() return false end, [2]=IsAltKeyDown, [3]=
 AutoTurnIn.OptionsPanel, AutoTurnIn.RewardPanel = nil, nil
 AutoTurnIn.autoEquipList={}
 AutoTurnIn.questCache={}	-- daily quest cache. Initially is built from player's quest log
---ignoring Marsh Lily,Lovely Apple,Jade Cat,Blue Feather,Ruby Shard DOESNT WORK && NOT USED maybe I should use 'required' in  http://wowprogramming.com/docs/api/GetQuestItemLink
-AutoTurnIn.TillerGifts={["79264"]=1, ["79265"]=1, ["79266"]=1, ["79267"]=1, ["79268"]=1}

 AutoTurnIn.ldbstruct = {
 		type = "data source",
@@ -136,6 +134,20 @@ function AutoTurnIn:CacheAsDaily(gossipQuest)
 	self.questCache[gossipQuest] = true
 end

+function AutoTurnIn:IsIgnoredQuest(quest)
+	local function startsWith(str,template)
+		return (string.len(str) >= string.len(template)) and (string.sub(str,1,string.len(template))==template)
+	end
+
+	for q in pairs(L.ignoreList) do
+		if (startsWith(quest, q)) then
+			return true
+		end
+	end
+
+	return false
+end
+
 local p1 = {[true]=L["enabled"], [false]=L["disabled"]}
 local p2 = {[true]=L["all"], [false]=L["list"]}
 function AutoTurnIn:ConsoleComand(arg)
@@ -172,7 +184,7 @@ function AutoTurnIn:AllowedToHandle(forcecheck)
 	return self.allowed
 end

--- OldGossip interaction system. Burn in hell. See http://wowprogramming.com/docs/events/QUEST_GREETING
+-- Old 'Quest NPC' interaction system. See http://wowprogramming.com/docs/events/QUEST_GREETING
 function AutoTurnIn:QUEST_GREETING()
 	if (not self:AllowedToHandle(true)) then
 		return
@@ -188,8 +200,9 @@ function AutoTurnIn:QUEST_GREETING()
 	for index=1, GetNumAvailableQuests() do
 		local isTrivial, isDaily, isRepeatable = GetAvailableQuestInfo(index)
 		local triviaAndAllowedOrNotTrivia = (not isTrivial) or AutoTurnInCharacterDB.trivial
-		local quest = L.quests[GetAvailableTitle(index)]
-		local notBlackListed = not (quest and quest.donotaccept)
+		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))
@@ -237,13 +250,13 @@ end
 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 title = select(i, ...)
 		local isTrivial = select(i+2, ...)
 		local isDaily  = select(i+3, ...)
-		local triviaAndAllowedOrNotTrivia = (not isTrivial) or AutoTurnInCharacterDB.trivial
+		local triviaAndAllowedOrNotTrivia = (not isTrivial) or AutoTurnInCharacterDB.trivial

-		local quest = L.quests[questname] -- this quest exists in addons quest DB. There are mostly daily quests
-		local notBlackListed = not (quest and quest.donotaccept)
+		local quest = L.quests[title] -- this quest exists in addons quest DB. There are mostly daily quests
+		local notBlackListed = not (quest and (quest.donotaccept or AutoTurnIn:IsIgnoredQuest(title)))

 		-- 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 (triviaAndAllowedOrNotTrivia and notBlackListed and (AutoTurnInCharacterDB.all or isDaily )) then
diff --git a/loc/localization_DE.lua b/loc/localization_DE.lua
index 29c12b5..2593465 100644
--- a/loc/localization_DE.lua
+++ b/loc/localization_DE.lua
@@ -178,4 +178,13 @@ privateTable.L.quests = {
 ['Schwere Yakrippe']={item="Schwere Yakrippe", amount=1, currency=false},

 }
+
+privateTable.L.ignoreList = {
+--MOP Tillers
+["Eine Sumpflilie für"]="",
+["Ein hübscher Apfel für"]="",
+["Eine Jadekatze für"]="",
+["Eine blaue Feder für"]="",
+["Ein Rubinsplitter für"]="",
+}
 end
\ No newline at end of file
diff --git a/loc/localization_EN.lua b/loc/localization_EN.lua
index 7a548b4..15cefe3 100644
--- a/loc/localization_EN.lua
+++ b/loc/localization_EN.lua
@@ -108,7 +108,6 @@ privateTable.L.quests = {
 ["Tarenar's Talisman"]={donotaccept=true},
 ["Vex'tul's Armbands"]={donotaccept=true},

-
 --[[Burning Crusade]]--
 --Lower City
 ["More Feathers"]={item="Arakkoa Feather", amount=30, currency=false},
@@ -167,6 +166,15 @@ privateTable.L.quests = {
 ['Pristine Firestorm Egg']={item="Pristine Firestorm Egg", amount=1, currency=false},
 ['Thick Tiger Haunch']={item="Thick Tiger Haunch", amount=1, currency=false},

+}

+privateTable.L.ignoreList = {
+--MOP Tillers
+["A Marsh Lily for"]="",
+["A Lovely Apple for"]="",
+["A Jade Cat for"]="",
+["A Blue Feather for"]="",
+["A Ruby Shard for"]="",
 }
+
 end
\ No newline at end of file
diff --git a/loc/localization_FR.lua b/loc/localization_FR.lua
index c80ac31..edd6c26 100644
--- a/loc/localization_FR.lua
+++ b/loc/localization_FR.lua
@@ -173,4 +173,13 @@ privateTable.L.quests = {
 ['Viande de grande tortue']={item="Viande de grande tortue", amount=1, currency=false},

 }
+
+privateTable.L.ignoreList = {
+--MOP Tillers
+["Un lys des marais pour"]="",
+["Une pomme délicieuse pour"]="",
+["Un chat de jade pour"]="",
+["Une plume bleue pour"]="",
+["Un éclat de rubis pour"]="",
+}
 end
\ No newline at end of file
diff --git a/loc/localization_RU.lua b/loc/localization_RU.lua
index d2a7e1f..818e748 100644
--- a/loc/localization_RU.lua
+++ b/loc/localization_RU.lua
@@ -172,7 +172,14 @@ privateTable.L.quests = {
 ['Мясо большой черепахи']={item="Мясо большой черепахи", amount=1, currency=false},
 ['Нетронутое яйцо огненной бури']={item="Нетронутое яйцо огненной бури", amount=1, currency=false},
 ['Толстый тигриный окорок']={item="Толстый тигриный окорок", amount=1, currency=false},
+}

-
+privateTable.L.ignoreList = {
+--MOP Tillers
+["Болотная лилия для"]="",
+["Милое яблочко для"]="",
+["Нефритовый кот для"]="",
+["Синее перо для"]="",
+["Рубиновый осколок для"]="",
 }
 end
\ No newline at end of file