Quantcast

new darkmoon NPC added. Darkmoon teleport added

Alex Shubert [05-11-13 - 20:48]
new darkmoon NPC added. Darkmoon teleport added
Filename
AutoTurnIn.lua
loc/localization_DE.lua
loc/localization_EN.lua
loc/localization_FR.lua
loc/localization_RU.lua
readme.txt
ui/main_options.lua
diff --git a/AutoTurnIn.lua b/AutoTurnIn.lua
index 185fc85..3d897d9 100644
--- a/AutoTurnIn.lua
+++ b/AutoTurnIn.lua
@@ -12,7 +12,7 @@ local TOCVersion = GetAddOnMetadata(addonName, "Version")

 AutoTurnIn = LibStub("AceAddon-3.0"):NewAddon("AutoTurnIn", "AceEvent-3.0", "AceConsole-3.0")
 AutoTurnIn.defaults = {enabled = true, all = false, trivial = false, lootreward = 1, tournament = 2,
-					   darkmoonteleport=true, togglekey=4, darkmoonautostart=true, showrewardtext=true,
+					   darkmoonteleport=true, todarkmoon=true, togglekey=4, darkmoonautostart=true, showrewardtext=true,
 					   version=TOCVersion, autoequip = false, debug=false,
 					   questlevel=true, watchlevel=true,
 					   armor = {}, weapon = {}, stat = {}, secondary = {}}
@@ -240,7 +240,7 @@ function AutoTurnIn:VarArgForAvailableQuests(...)

 		local quest = L.quests[questname] -- this quest exists in addons quest DB. There are mostly daily quests
 		local notBlackListed = not (quest and 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 (triviaAndAllowedOrNotTrivia and notBlackListed and (AutoTurnInCharacterDB.all or isDaily )) then
 			if quest and quest.amount then
@@ -262,19 +262,23 @@ end

 function AutoTurnIn:isYoungPandaren()
 	return (UnitName("npc")== L["Scared Pandaren Cub"]) and
-			(GetRealZoneText() == L["The Jade Forest"])
+		(GetRealZoneText() == L["The Jade Forest"])
+end
+
+function AutoTurnIn:isDarkmoonFaireMysticMage()
+	return AutoTurnInCharacterDB.todarkmoon and
+		(UnitName("npc")== L["Darkmoon Faire Mystic Mage"]) and
+		(GetRealZoneText() ~= L["Darkmoon Island"])
 end

+function AutoTurnIn:isDarkmoonFaireTeleportologist()
+	return AutoTurnInCharacterDB.darkmoonteleport and (L["DarkmoonFaireTeleport"]==UnitName("target"))
+end

 function AutoTurnIn:GOSSIP_SHOW()
 	if (not self:AllowedToHandle(true)) then
 		return
 	end
-
-	if (AutoTurnInCharacterDB.darkmoonteleport and (L["DarkmoonFaireTeleport"]==UnitName("target"))) then
-		SelectGossipOption(1)
-		StaticPopup1Button1:Click()
-	end

 	-- darkmoon fairy gossip sometime turns in quest too fast so I can't relay only on quest number count. It often lie.
 	-- this flag is set in VarArgForActiveQuests if any quest may be turned in
@@ -288,7 +292,8 @@ function AutoTurnIn:GOSSIP_SHOW()
 		local options = {GetGossipOptions()}
 		for k, v in pairs(options) do
 			if ((v ~= "gossip") and strfind(v, "|cFF0008E8%(")) then
-				SelectGossipOption(math.floor(k / GetNumGossipOptions())+1)
+				local opcount = GetNumGossipOptions()
+				SelectGossipOption((opcount == 1) and 1 or  math.floor(k / GetNumGossipOptions()) + 1)
 			end
 		end
 	end
@@ -296,6 +301,11 @@ function AutoTurnIn:GOSSIP_SHOW()
 	if self:isYoungPandaren() then
 		SelectGossipOption(1)
 	end
+
+	if self:isDarkmoonFaireMysticMage() or self:isDarkmoonFaireTeleportologist() then
+		SelectGossipOption(1)
+		StaticPopup1Button1:Click()
+	end
 end

 function AutoTurnIn:QUEST_DETAIL()
diff --git a/loc/localization_DE.lua b/loc/localization_DE.lua
index 2ff372f..19e86bb 100644
--- a/loc/localization_DE.lua
+++ b/loc/localization_DE.lua
@@ -27,10 +27,12 @@ privateTable.L = setmetatable({
 	["tournamentWrit"]="Verfügung des Champions", -- 46114
 	["tournamentPurse"]="Geldbeutel des Champions",  -- 45724

-	["DarkmoonTeleLabel"]="Dunkelmond-Jahrmarkt: Zurück zur Kanone!",
+	["DarkmoonTeleLabel"]="Dunkelmond-Jahrmarkt: Zurück zur Kanone!",
+	["ToDarkmoonLabel"]="Dunkelmond-Jahrmarkt: Zurück zur Insel", -- darkmoon
 	["Teleportologe Fosselbab"]="Teleportologist Fozlebub",
 	["DarkmoonAutoLabel"]="Dunkelmond-Jahrmarkt: Spiel starten!",
 	["Darkmoon Island"]="Dunkelmondinsel",
+	["Darkmoon Faire Mystic Mage"]="Mystischer Magier des Dunkelmond-Jahrmarkts",

 	["The Jade Forest"]="Der Jadewald",
 	["Scared Pandaren Cub"]="verängstigte Pandarenkinder",
diff --git a/loc/localization_EN.lua b/loc/localization_EN.lua
index 37573d7..a83d7fd 100644
--- a/loc/localization_EN.lua
+++ b/loc/localization_EN.lua
@@ -35,7 +35,7 @@ privateTable.L = setmetatable({

 	["DarkmoonTeleLabel"]="Darkmoon: teleport to the cannon",
 	["DarkmoonFaireTeleport"]="Teleportologist Fozlebub",
-	["DarkmoonAutoLabel"]="Darkmoon: start the game!",
+	["DarkmoonAutoLabel"]="Darkmoon: start the game!",

 	["rewardtext"]="Print quest reward text",
 	["questlevel"]="Show quest level",
diff --git a/loc/localization_FR.lua b/loc/localization_FR.lua
index b70434e..4b662e8 100644
--- a/loc/localization_FR.lua
+++ b/loc/localization_FR.lua
@@ -26,8 +26,10 @@ privateTable.L = setmetatable({
     ["tournamentPurse"]="Bourse de champion",  -- 45724

     ["DarkmoonTeleLabel"]="Sombrelune : téléporter au canon",
+	["ToDarkmoonLabel"]="Sombrelune : téléporter au île", -- darkmoon
     ["DarkmoonFaireTeleport"]="Téléportologue Mélébou",
     ["DarkmoonAutoLabel"]="Sombrelune : Lancer le jeu!",
+	["Darkmoon Faire Mystic Mage"]="Mage mystique de la foire de Sombrelune",

     ["The Jade Forest"]="La forêt de Jade",
     ["Scared Pandaren Cub"]="Bébé pandaren apeuré",
diff --git a/loc/localization_RU.lua b/loc/localization_RU.lua
index c9cbd9c..71cf0c2 100644
--- a/loc/localization_RU.lua
+++ b/loc/localization_RU.lua
@@ -28,9 +28,11 @@ privateTable.L = setmetatable({
 	["tournamentPurse"]="Кошелек чемпиона",  -- 45724

 	["DarkmoonTeleLabel"]="Ярмарка Новолуния: телепортация к пушке", -- darkmoon
+	["ToDarkmoonLabel"]="Ярмарка Новолуния: телепортация на остров", -- darkmoon
 	["DarkmoonFaireTeleport"]="Телепортолог Фоцлебульб",
 	["DarkmoonAutoLabel"]="Ярмарка Новолуния: начинать игру",
 	["Darkmoon Island"]="Остров Новолуния",
+	["Darkmoon Faire Mystic Mage"]="Гадалка ярмарки Новолуния",

 	["The Jade Forest"]="Нефритовый лес",
 	["Scared Pandaren Cub"]="Испуганный юный пандарен",
diff --git a/readme.txt b/readme.txt
index e9d6d3a..cf8d9ec 100644
--- a/readme.txt
+++ b/readme.txt
@@ -1,5 +1,5 @@
 == AutoTurnIn ==
-author: lurkerrr
+author: alex.shubert@gmail.com
 http://wow.curseforge.com/addons/autoturnin/
 Accepts and turn in quest to NPC. May handle any quests or specified list.
 May turn in quests with rewards and choose most expensive one for future selling.
diff --git a/ui/main_options.lua b/ui/main_options.lua
index 2ce5ee2..c1a6dc2 100644
--- a/ui/main_options.lua
+++ b/ui/main_options.lua
@@ -98,6 +98,13 @@ end)
 UIDropDownMenu_SetWidth(LootDropDown, 200);
 UIDropDownMenu_JustifyText(LootDropDown, "LEFT")

+-- Teleport to Darkmoon Faire
+local ToDarkMoon= CreateFrame("CheckButton", O.."ToDarkMoon", OptionsPanel, "OptionsCheckButtonTemplate")
+_G[O.."ToDarkMoonText"]:SetText(L["ToDarkmoonLabel"])
+ToDarkMoon:SetScript("OnClick", function(self)
+	ptable.TempConfig.todarkmoon = self:GetChecked() == 1
+end)
+
 -- DarkmoonTeleport
 local DarkMoonCannon = CreateFrame("CheckButton", O.."DarkMoonCannon", OptionsPanel, "OptionsCheckButtonTemplate")
 _G[O.."DarkMoonCannonText"]:SetText(L["DarkmoonTeleLabel"])
@@ -178,15 +185,16 @@ LootLabel:SetPoint("BOTTOMLEFT", LootDropDown, "TOPLEFT", 18, 0)
 LootDropDown:SetPoint("TOPLEFT", QuestDropDown, "BOTTOMLEFT", 0, -30)
 TournamentDropDownLabel:SetPoint("BOTTOMLEFT", TournamentDropDown, "TOPLEFT", 18, 0)
 TournamentDropDown:SetPoint("TOPLEFT", LootDropDown, "TOPRIGHT", 17, 0)
-EquipReward:SetPoint("TOPLEFT", LootDropDown, "BOTTOMLEFT", 16, -16)
-ShowRewardText:SetPoint("TOPLEFT", EquipReward, "BOTTOMLEFT", 0, -16)
-DarkMoonCannon:SetPoint("TOPLEFT", ShowRewardText, "BOTTOMLEFT", 0, -16)
-DarkMoonAutoStart:SetPoint("TOPLEFT", DarkMoonCannon, "BOTTOMLEFT", 0, -16)
-Debug:SetPoint("TOPLEFT", ResetButton, "BOTTOMLEFT", 0, -16)
+EquipReward:SetPoint("TOPLEFT", LootDropDown, "BOTTOMLEFT", 16, -14)
+ShowRewardText:SetPoint("TOPLEFT", EquipReward, "BOTTOMLEFT", 0, -14)
+ToDarkMoon:SetPoint("TOPLEFT", ShowRewardText, "BOTTOMLEFT", 0, -14)
+DarkMoonCannon:SetPoint("TOPLEFT", ToDarkMoon, "BOTTOMLEFT", 0, -14)
+DarkMoonAutoStart:SetPoint("TOPLEFT", DarkMoonCannon, "BOTTOMLEFT", 0, -14)
+Debug:SetPoint("TOPLEFT", ResetButton, "BOTTOMLEFT", 0, -14)
 ToggleKeyLabel:SetPoint("BOTTOMLEFT", ToggleKeyDropDown, "TOPLEFT", 18, 0)
 ToggleKeyDropDown:SetPoint("TOPLEFT", DarkMoonAutoStart, "BOTTOMLEFT", -15, -30)
-ShowQuestLevel:SetPoint("TOPLEFT", ToggleKeyDropDown, "BOTTOMLEFT", 16, -16)
-ShowWatchLevel:SetPoint("TOPLEFT", ShowQuestLevel, "BOTTOMLEFT", 0, -16)
+ShowQuestLevel:SetPoint("TOPLEFT", ToggleKeyDropDown, "BOTTOMLEFT", 16, -14)
+ShowWatchLevel:SetPoint("TOPLEFT", ShowQuestLevel, "BOTTOMLEFT", 0, -14)

 OptionsPanel.refresh = function()
 	if ( MakeACopy ) then
@@ -203,6 +211,7 @@ OptionsPanel.refresh = function()

 	UIDropDownMenu_SetSelectedID(TournamentDropDown, ptable.TempConfig.tournament)
 	UIDropDownMenu_SetText(TournamentDropDown,TournamentConst[ptable.TempConfig.tournament])
+	ToDarkMoon:SetChecked(ptable.TempConfig.todarkmoon)
 	DarkMoonCannon:SetChecked(ptable.TempConfig.darkmoonteleport)
 	DarkMoonAutoStart:SetChecked(ptable.TempConfig.darkmoonautostart)
 	ShowRewardText:SetChecked(ptable.TempConfig.showrewardtext)