Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jul 14th, 2013  |  syntax: Lua  |  size: 21.22 KB  |  views: 45  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. --[[
  2.                                 Battle Pet Daily Tamer
  3.  
  4. 05/21/2013 1.2.3 tooltips display which book a beast of fable is for
  5. 05/21/2013 1.2.2 release version for 5.3
  6. 05/03/2013 1.2.1 added coordinates for book 2/book 3 paws on world map
  7. 05/01/2013 1.2.0 toggle window removed and default's "Show Pet Tamers" option commandeered. beasts of fable split into three different quests
  8. 03/14/2013 1.1.8 fix for fabled paws in all localizations (numbered quest objectives instead of by name)
  9. 03/08/2013 1.1.7 added paws for the 10 fabled beasts (while quest is active) and option to display them
  10. 03/06/2013 1.1.6 added Sara Finkleswitch and Gentle San (Beasts of Fable daily)
  11. 02/16/2013 1.1.5 added limited TomTom support (ctrl+right click paw to /way there)
  12. 01/06/2013 1.1.4 added Jeremy Feasel (Darkmoon Faire) daily
  13. 01/01/2013 1.1.3 changed Merda Stronghoof's quest id from 31817 to 31872
  14. 12/29/2012 1.1.2 removed pre-requisite system, added expansion to tooltip
  15. 12/29/2012 1.1.1 removed NR paws from EK map, MP paws from KL map, manually added Bordin Steadyfist to Maelstrom maps
  16. 12/28/2012 1.1.0 astrolabe replaced with static data, paws created on demand
  17. 12/22/2012 1.0.5 added toggle window onto worldmap for turning paws on/off, removed panel option
  18. 12/21/2012 1.0.4 code cleanup
  19. 12/20/2012 1.0.3 overhauled pre-req system to work with both factions
  20. 12/18/2012 1.0.2 added non-satchel dailies (default off), fix for tooltip on full-screen map, temporary option to ignore pre-req dailies until horde dailies confirmed, right-clicking paw will zoom map out
  21. 12/16/2012 1.0.1 temporary fix for alliance/horde pre-req wierdness for taming EK/kalimdor, pet type icons on tamer tooltips
  22. 12/15/2012 1.0.0 initial release
  23.  
  24. ]]
  25.  
  26. BattlePetDailyTamerSettings = {} -- savedvariable
  27. local settings
  28.  
  29. local dailytamer = CreateFrame("Frame","BattlePetDailyTamer")
  30.  
  31. --[[    DailyInfo is indexed by the questID of each tamer's daily quest
  32.  
  33.         [questID] = {
  34.                 [1] = prereq group,                     -- group daily belongs to (ie "Eastern Kingdom" "Kalimdor" "Outland" etc)
  35.                 [2] = "Npc Name",       -- name of the tamer
  36.                 [3] = mapID,                                            -- mapID
  37.                 [4] = floor,                                            -- floor (for astrolabe when used)
  38.                 [5] = xpos,                                                     -- xpos (for astrolabe when used)
  39.                 [6] = ypos,                                                     -- ypos (for astrolabe when used)
  40.                 [7] = hasSatchel,                               -- whether this tamer rewards a satchel, or "fable" for fabled beasts
  41.                 [8] = petlevel,                                 -- level of pets for this tamer
  42.                 [9] = pettype1,                                 -- pet type of tamer's first pet (1-10)
  43.          [10] = pettype2,                                       -- pet type of tamer's second pet (1-10)
  44.          [11] = pettype3                                        -- pet type of tamer's third pet (1-10)
  45.         }
  46.  
  47.         When a questID is Alliance:Number or Horde:Number, it's the same quest but faction specific.
  48.         Once the user's faction is known we remove these and add a true questID entry.
  49.         When a questID is Number1:Number2, Number1 is the questID and Number2 is the objective number.
  50. ]]
  51. dailytamer.DailyInfo = {
  52.  
  53.         -- green paws (satchel dailies)
  54.         [31916]={"Eastern Kingdom","Lydia Accoste",32,0,0.401,0.765,true,19,4,7,4},
  55.         [31909]={"Kalimdor","Stone Cold Trixxy",281,0,0.656,0.645,true,19,3,8,2},
  56.         [31926]={"Outland","Bloodknight Antari",473,0,0.305,0.418,true,24,6,7,2},
  57.         [31935]={"Northrend","Major Payne",492,0,0.774,0.196,true,25,8,10,7},
  58.         [31971]={"Cataclysm","Obalis",720,0,0.566,0.420,true,25,5,3,8},
  59.         [31955]={"Pandaria","Farmer Nishi",807,0,0.461,0.437,true,25,8,7,7},
  60.         [31991]={"Pandaria","Seeker Zusshi",810,0,0.363,0.522,true,25,7,5,9},
  61.         [31957]={"Pandaria","Wastewalker Shu",858,0,0.551,0.376,true,25,9,8,7},
  62.         [31953]={"Pandaria","Hyuna of the Shrines",806,0,0.480,0.541,true,25,9,8,3},
  63.         [31954]={"Pandaria","Mo'ruk",857,0,0.622,0.459,true,25,3,9,8},
  64.         [31958]={"Pandaria","Aki the Chosen",811,0,0.675,0.406,true,25,5,2,9},
  65.         [31956]={"Pandaria","Courageous Yon",809,0,0.358,0.732,true,25,8,5,3},
  66.         [32434]={"Pandarian Spirits","Burning Pandaren Spirit",810,0,0.571,0.421,true,25,7,2,3},
  67.         [32441]={"Pandarian Spirits","Thundering Pandaren Spirit",811,0,0.673,0.144,true,25,7,5,8},
  68.         [32439]={"Pandarian Spirits","Flowing Pandaren Spirit",858,0,0.611,0.875,true,25,7,9,5},
  69.         [32440]={"Pandarian Spirits","Whispering Pandaren Spirit",806,0,0.289,0.360,true,25,7,2,5},
  70.         [32175]={"Darkmoon Faire","Jeremy Feasel",823,0,0.478,0.626,true,25,6,8,10},
  71.         ["Alliance:32604"]={"Beasts of Fable Book I","Sara Finkleswitch",811,0,0.866,0.600,true,nil,nil,nil,nil},
  72.         ["Horde:32604"]={"Beasts of Fable Book I","Gentle San",811,0,0.607,0.238,true,nil,nil,nil,nil},
  73.         ["Alliance:32868"]={"Beasts of Fable Book II","Sara Finkleswitch",811,0,0.866,0.600,true,nil,nil,nil,nil},
  74.         ["Horde:32868"]={"Beasts of Fable Book II","Gentle San",811,0,0.607,0.238,true,nil,nil,nil,nil},
  75.         ["Alliance:32869"]={"Beasts of Fable Book III","Sara Finkleswitch",811,0,0.866,0.600,true,nil,nil,nil,nil},
  76.         ["Horde:32869"]={"Beasts of Fable Book III","Gentle San",811,0,0.607,0.238,true,nil,nil,nil,nil},
  77.  
  78.         -- non-satchel dailies
  79.         [31693]={"Eastern Kingdom","Julia Stevens",30,0,0.417,0.837,false,2,8,8,nil},
  80.         [31780]={"Eastern Kingdom","Old MacDonald",39,0,0.609,0.185,false,3,3,10,5},
  81.         [31781]={"Eastern Kingdom","Lindsay",36,0,0.333,0.526,false,5,5,5,5},
  82.         [31850]={"Eastern Kingdom","Eric Davidson",34,0,0.199,0.446,false,7,8,8,8},
  83.         [31852]={"Eastern Kingdom","Steven Lisbane",37,0,0.460,0.404,false,9,8,8,6},
  84.         [31851]={"Eastern Kingdom","Bill Buckler",673,0,0.515,0.734,false,11,1,3,3},
  85.         [31910]={"Eastern Kingdom","David Kosse",26,0,0.630,0.546,false,13,8,5,6},
  86.         [31911]={"Eastern Kingdom","Deiza Plaguehorn",23,0,0.670,0.524,false,14,8,8,4},
  87.         [31912]={"Eastern Kingdom","Kortas Darkhammer",28,0,0.353,0.277,false,15,2,2,2},
  88.         [31913]={"Eastern Kingdom","Everessa",38,0,0.768,0.415,false,16,9,3,8},
  89.         [31914]={"Eastern Kingdom","Durin Darkhammer",29,0,0.255,0.475,false,17,3,5,7},
  90.         [31818]={"Kalimdor","Zunta",4,0,0.439,0.289,false,2,5,8,nil},
  91.         [31854]={"Kalimdor","Analynn",43,0,0.202,0.295,false,5,3,9,5},
  92.         [31872]={"Kalimdor","Merda Stronghoof",101,0,0.571,0.457,false,9,7,9,5},
  93.         [31862]={"Kalimdor","Zonya the Sadist",81,0,0.597,0.716,false,7,8,8,5},
  94.         [31819]={"Kalimdor","Dagra the Fierce",11,0,0.586,0.531,false,3,8,8,5},
  95.         [31871]={"Kalimdor","Traitor Gluk",121,0,0.597,0.496,false,13,2,5,8},
  96.         [31904]={"Kalimdor","Cassandra Kaboom",607,0,0.396,0.791,false,11,10,10,10},
  97.         [31908]={"Kalimdor","Elena Flutterfly",241,0,0.461,0.603,false,17,6,3,2},
  98.         [31906]={"Kalimdor","Kela Grimtotem",61,0,0.319,0.329,false,15,8,5,5},
  99.         [31907]={"Kalimdor","Zoltan",182,0,0.400,0.566,false,16,6,10,6},
  100.         [31905]={"Kalimdor","Grazzle the Great",141,0,0.539,0.749,false,14,2,2,2},
  101.         [31922]={"Outland","Nicki Tinytech",465,0,0.643,0.493,false,20,10,10,10},
  102.         [31923]={"Outland","Ras'an",467,0,0.172,0.505,false,21,3,6,1},
  103.         [31924]={"Outland","Narrok",477,0,0.610,0.494,false,22,5,9,8},
  104.         [31925]={"Outland","Morulu The Elder",481,0,0.588,0.701,false,23,9,9,9},
  105.         [31934]={"Northrend","Gutretch",496,0,0.132,0.668,false,25,8,8,5},
  106.         [31931]={"Northrend","Beegle Blastfuse",491,0,0.286,0.339,false,25,3,3,9},
  107.         [31932]={"Northrend","Nearly Headless Jacob",510,0,0.501,0.590,false,25,4,4,4},
  108.         [31933]={"Northrend","Okrut Dragonwaste",488,0,0.590,0.771,false,25,2,4,4},
  109.         [31972]={"Cataclysm","Brok",606,0,0.614,0.327,false,25,8,6,5},
  110.         [31974]={"Cataclysm","Goz Banefury",700,0,0.566,0.568,false,25,7,6,8},
  111.         [31973]={"Cataclysm","Bordin Steadyfist",640,0,0.499,0.570,false,25,7,5,7},
  112.  
  113.         -- Beasts of Fable Book I
  114.         ["32604:1"]={"Beasts of Fable Book I","Ka'wi the Gorger",806,0,0.484,0.709,"fable",25,5,nil,nil},
  115.         ["32604:2"]={"Beasts of Fable Book I","Kafi",809,0,0.351,0.561,"fable",25,8,nil,nil},
  116.         ["32604:3"]={"Beasts of Fable Book I","Dos-Ryga",809,0,0.678,0.846,"fable",25,9,nil,nil},
  117.         ["32604:4"]={"Beasts of Fable Book I","Nitun",806,0,0.570,0.291,"fable",25,5,nil,nil},
  118.         -- Beasts of Fable Book Book II
  119.         ["32868:1"]={"Beasts of Fable Book II","Greyhoof",807,0,0.252,0.785,"fable",25,8,nil,nil},
  120.         ["32868:2"]={"Beasts of Fable Book II","Lucky Yi",807,0,0.405,0.436,"fable",25,5,nil,nil},
  121.         ["32868:3"]={"Beasts of Fable Book II","Skitterer Xi'a",857,0,0.362,0.373,"fable",25,9,nil,nil},
  122.         -- Beasts of Fable Book Book III
  123.         ["32869:1"]={"Beasts of Fable Book III","Gorespine",858,0,0.261,0.503,"fable",25,8,nil,nil},
  124.         ["32869:2"]={"Beasts of Fable Book III","No-No",811,0,0.110,0.709,"fable",25,9,nil,nil},
  125.         ["32869:3"]={"Beasts of Fable Book III","Ti'un the Wanderer",810,0,0.722,0.797,"fable",25,9,nil,nil},
  126.  
  127. }
  128. --[[ added by neonic to calc at/def pets
  129.          1 = Hum
  130.          2 = Dra
  131.          3 = Fly
  132.          4 = Und
  133.          5 = Cri
  134.          6 = Mag
  135.          7 = Ele
  136.          8 = Bea
  137.          9 = Aqa
  138.          10 = Mech
  139. ]]
  140. function PetR(Pet,mode)
  141.         if Pet == 1 then
  142.         PetAt = 4
  143.         PetDef = 8
  144.         end
  145.         if Pet == 2 then
  146.         PetAt = 1
  147.         PetDef = 4
  148.         end
  149.         if Pet == 3 then
  150.         PetAt = 6
  151.         PetDef = 2
  152.         end
  153.         if Pet == 4 then
  154.         PetAt = 5
  155.         PetDef = 9
  156.         end
  157.         if Pet == 5 then
  158.         PetAt = 8
  159.         PetDef = 1
  160.         end
  161.         if Pet == 6 then
  162.         PetAt = 2
  163.         PetDef = 10
  164.         end
  165.         if Pet == 7 then
  166.         PetAt = 9
  167.         PetDef = 5
  168.         end
  169.         if Pet == 8 then
  170.         PetAt = 10
  171.         PetDef = 3
  172.         end
  173.         if Pet == 9 then
  174.         PetAt = 3
  175.         PetDef = 6
  176.         end
  177.         if Pet == 10 then
  178.         PetAt = 7
  179.         PetDef = 7
  180.         end
  181.        
  182.         if mode == 1 then
  183.         return PetAt
  184.         end
  185.         if mode == 2 then
  186.         return PetDef
  187.         end
  188. end
  189.  
  190. -- these are quest IDs of dailies with objectives (so far just the Beasts of Fables)
  191. dailytamer.QuestsWithObjectives = {32604,32868,32869}
  192.  
  193. -- these are quest IDs to faction-specific dailies. in init we remove the opposing faction tamers.
  194. -- if an alliance tames kalimdor it grants horde only access to kalimdor dailies
  195. -- if a horde tames EK it grants alliance only access to EK dailies
  196. -- lydia accoste and stone cold trixxy are available to both factions
  197. dailytamer.FactionSpecificDailies = {
  198.         ["Alliance"] = {31693,31780,31781,31850,31852,31851,31910,31911,31912,31913,31914},
  199.         ["Horde"] = {31818,31854,31872,31862,31819,31871,31904,31908,31906,31907,31905},
  200. }
  201.  
  202. -- overlay over WorldMapButton, to be the parent for our buttons
  203. dailytamer.WorldMapOverlay = CreateFrame("Frame","BattlePetDailyTamerWorldMapOverlay",WorldMapButton)
  204. dailytamer.WorldMapOverlay:SetAllPoints(true)
  205.  
  206. -- tooltip used on WorldMapOverlay
  207. dailytamer.WorldMapTooltip = CreateFrame("GameTooltip","BattlePetDailyTamerTooltip",nil,"GameTooltipTemplate")
  208.  
  209. -- table of buttons that we'll place on world map, indexed by questID
  210. dailytamer.Paws = {}
  211.  
  212. dailytamer:SetScript("OnEvent",function(self,event)
  213.         if event=="WORLD_MAP_UPDATE" and WorldMapFrame:IsVisible() then
  214.                 self:Show() -- start one-frame OnUpdate defined below
  215.         elseif event=="PLAYER_LOGIN" then
  216.                 self:Initialize()
  217.                 self:RegisterEvent("WORLD_MAP_UPDATE")
  218.         end
  219. end)
  220. -- WORLD_MAP_UPDATE can fire up to a 100 times when crossing zone boundries.
  221. -- instead of reacting to every event, wait one frame after the events fire
  222. dailytamer:Hide()
  223. dailytamer:SetScript("OnUpdate",function(self,elasped)
  224.         self:Hide()
  225.         self:UpdatePaws()
  226. end)
  227. dailytamer:RegisterEvent("PLAYER_LOGIN")
  228.  
  229. -- takes numbers 1-10 representing pet types and returns a string of pet icons (or '?' if unknown)
  230. function dailytamer:GetPetTypeIconsInText(...)
  231.         local txt=""
  232.         for i=1,select("#",...) do
  233.                 if select(i,...) then
  234.                         if PET_TYPE_SUFFIX[select(i,...)] then
  235.                                 txt=txt.."\124TInterface\\PetBattles\\PetIcon-"..PET_TYPE_SUFFIX[select(i,...)]..":22:22:0:0:128:256:102:63:129:168\124t"
  236.                         else
  237.                                 txt=txt.."\124TInterface\\Icons\\INV_Misc_QuestionMark:20\124t"
  238.                         end
  239.                 end
  240.         end
  241.         return txt
  242. end
  243.  
  244. -- OnEnter script for paws
  245. function dailytamer.paw_onenter(self)
  246.         self.tooltip:SetScale(GameTooltip:GetEffectiveScale())
  247.   self.tooltip:SetOwner(self,"ANCHOR_LEFT")
  248.   self.tooltip:AddLine(self.tamerName)
  249.         self.tooltip:AddLine(self.dailySet)
  250.         if self.tamerPets then
  251.                 self.tooltip:AddLine("Enemy pets")
  252.                 self.tooltip:AddLine(self.tamerPets)
  253.                 self.tooltip:AddLine("Best Opposition")
  254.                 self.tooltip:AddLine(self.tamerPetsAt..": +50% Attack")
  255.                 self.tooltip:AddLine(self.tamerPetsDe..": +33% Defense")
  256.         end
  257.   self.tooltip:Show()
  258. end
  259.  
  260. -- OnLeave script for paws
  261. function dailytamer.paw_onleave(self)
  262.         self.tooltip:Hide()
  263. end
  264.  
  265. -- OnClick script for paws
  266. function dailytamer.paw_onclick(self,button)
  267.         PlaySound("igMainMenuOptionCheckBoxOn");
  268.         if button=="RightButton" then
  269.                 if IsControlKeyDown() and IsAddOnLoaded("TomTom") then
  270.                         local info = dailytamer.DailyInfo[self.questID]
  271.                         SlashCmdList["TOMTOM_WAY"](format("%s %.1f %.1f %s (Battle Pet Daily)",GetMapNameByID(info[3]),info[5]*100,info[6]*100,info[2]))
  272.                 elseif GetCurrentMapAreaID()==823 then -- if we're looking at the darkmoon faire
  273.                         SetMapZoom(0,0) -- zoom out to azeroth map
  274.                 else
  275.                         WorldMapZoomOutButton_OnClick() -- zoom out on paw right-click
  276.                 end
  277.         else
  278.                 SetMapByID(self.mapID) -- zoom in on paw left-click
  279.         end
  280. end
  281.  
  282. -- returns (and creates if needed) a paw associated with a questID
  283. function dailytamer:GetPaw(questID)
  284.         if self.Paws[questID] then
  285.                 return self.Paws[questID]
  286.         end
  287.         self.Paws[questID] = CreateFrame("Button",nil,self.WorldMapOverlay)
  288.         local button = self.Paws[questID]
  289.         button:SetSize(22,22)
  290.         button.texture = button:CreateTexture(nil,"ARTWORK")
  291.         button.texture:SetAllPoints(true)
  292.         button.texture:SetTexture("Interface\\AddOns\\Battle Pet Daily Tamer\\paw.tga")
  293.         button:SetHighlightTexture("Interface\\AddOns\\Battle Pet Daily Tamer\\paw.tga")
  294.         local tamer = self.DailyInfo[questID]
  295.         if tamer[7]=="fable" then
  296.                 button.texture:SetVertexColor(1,.5,0) -- fable daily (orange paw)
  297.         elseif tamer[7] then
  298.                 button.texture:SetVertexColor(.25,1,.25,1) -- satchel daily (green paw)
  299.         else
  300.                 button.texture:SetVertexColor(.5,.85,1,1) -- non-satchel daily (blue paw)
  301.         end
  302.         button.tamerName = tamer[2]
  303.         button.mapID = tamer[3]
  304.         button.questID = questID
  305.         button.dailySet = "|cffcccccc"..tamer[1]
  306.         button.tooltip = self.WorldMapTooltip
  307.         if tamer[8] and tamer[8]>0 then -- if tamer's pets are known
  308.                 button.tamerPets = self:GetPetTypeIconsInText(tamer[9],tamer[10],tamer[11]).." Level: "..tamer[8]..""
  309.                 button.tamerPetsAt = self:GetPetTypeIconsInText(PetR(tamer[9],1),PetR(tamer[10],1),PetR(tamer[11],1))
  310.                 button.tamerPetsDe = self:GetPetTypeIconsInText(PetR(tamer[9],2),PetR(tamer[10],2),PetR(tamer[11],2))
  311.         end
  312.   button:SetScript("OnEnter",dailytamer.paw_onenter)
  313.   button:SetScript("OnLeave",dailytamer.paw_onleave)
  314.   button:SetScript("OnClick",dailytamer.paw_onclick)
  315.   button:RegisterForClicks("AnyUp")
  316.  
  317.         return button
  318. end
  319.  
  320. -- remove a daily (dailyinfo entry and coordinates)
  321. function dailytamer:RemoveDaily(questID)
  322.         self.DailyInfo[questID] = nil
  323.         for map in pairs(self.Coordinates) do
  324.                 self.Coordinates[map][questID] = nil
  325.         end
  326. end
  327.  
  328. -- if a table has a key "Alliance:number" or "Horde:number", then it adds
  329. -- that table entry back with the raw quest id and deletes the string version
  330. function dailytamer:ScrubFactionKeys(parent,key,faction)
  331.         if type(key)=="string" then
  332.                 if dailytamer.DailyInfo[key] and dailytamer.DailyInfo[key][7]=="fable" then
  333.                         return -- leave fable quests alone
  334.                 elseif key:match(faction) then
  335.                         local questID = tonumber(key:match(faction..":(%d+)"))
  336.                         parent[questID] = {}
  337.                         for i=1,#parent[key] do
  338.                                 table.insert(parent[questID],parent[key][i])
  339.                         end
  340.                 end
  341.                 parent[key] = nil -- remove non-fable quests with a string key
  342.         end
  343. end
  344.  
  345.        
  346.  
  347. -- stuff to do on login
  348. function dailytamer:Initialize()
  349.  
  350.         dailytamer:InitializeSettings()
  351.  
  352.         -- remove faction-specific dailies (EK before Lydia and Kalimdor before Trixxy)
  353.         local faction = UnitFactionGroup("player")
  354.         local factionToRemove = faction=="Alliance" and "Horde" or faction=="Horde" and "Alliance"
  355.         if self.FactionSpecificDailies[factionToRemove] then
  356.                 for i=1,#self.FactionSpecificDailies[factionToRemove] do
  357.                         self:RemoveDaily(self.FactionSpecificDailies[factionToRemove][i])
  358.                 end
  359.         end
  360.  
  361.         -- the fabled quest npc gives the same quest id for both factions
  362.         for key in pairs(self.DailyInfo) do
  363.                 self:ScrubFactionKeys(self.DailyInfo,key,faction)
  364.         end
  365.         for map,info in pairs(self.Coordinates) do
  366.                 for key in pairs(info) do
  367.                         self:ScrubFactionKeys(info,key,faction)
  368.                 end
  369.         end
  370.  
  371.         -- if darkmoon faire is not in town, remove its daily
  372.         local week,weekday,_,day = 0,CalendarGetDate()
  373.         weekday = weekday-1 -- offset 0 for weekday
  374.         for i=day,1,-1 do -- start from today and go back to first of the month
  375.                 week=week+(weekday==0 and 1 or 0)
  376.           weekday=(weekday-1)%7
  377.         end
  378.         if week~=1 then -- if we're not in first full week
  379.                 self:RemoveDaily(32175) -- remove darkmoon daily
  380.         end
  381.  
  382. end
  383.  
  384. -- returns 1 if paw for questID should be shown, nil otherwise
  385. function dailytamer:PawNeedsShown(questID)
  386.         local isObjective = type(questID)=="string" -- is this a "quest:objective"
  387.         if isObjective and settings.TrackFables and self.incompleteObjectives[questID] then
  388.                 return 1 -- if this is an objective not completed (incompleteObjectives defined in UpdatePaws)
  389.         elseif not isObjective and not IsQuestFlaggedCompleted(questID) then
  390.                 local isSatchelDaily = self.DailyInfo[questID][7]
  391.                 if isSatchelDaily and settings.TrackSatchels then
  392.                         return 1 -- this is a satchel daily and TrackSatchels checked
  393.                 elseif not isSatchelDaily and settings.TrackNonSatchels then
  394.                         return 1 -- this is a non-satchel daily and TrackNonSatchels checked
  395.                 end
  396.         end
  397. end
  398.  
  399. -- draw paws on map
  400. function dailytamer:UpdatePaws()
  401.  
  402.         for _,button in pairs(self.Paws) do
  403.                 button:Hide()   -- clean any shown paws
  404.         end
  405.  
  406.         local currentMapID = max(0,GetCurrentMapAreaID())
  407.  
  408.         if settings.HideDailies or -- if "Show Pet Tamers" unchecked
  409.                         (GetCurrentMapContinent()==-1 and currentMapID~=823) or -- or if we're looking at the cosmic world map (besides DMF)
  410.                         GetNumDungeonMapLevels()~=0 then -- or we're looking at a dungeon
  411.                 return -- then leave
  412.         end
  413.  
  414.         -- populate dailytamer.incompleteObjectives with quest:objectives that are not done
  415.         self.incompleteObjectives = self.incompleteObjectives or {}
  416.         wipe(self.incompleteObjectives)
  417.         for _,questID in pairs(self.QuestsWithObjectives) do
  418.                 if settings.TrackFables then
  419.                         local quest,objective,completed = GetQuestLogIndexByID(questID)
  420.                         for i=1,GetNumQuestLeaderBoards(quest) do
  421.                                 completed = select(3,GetQuestLogLeaderBoard(i,quest))
  422.                                 if not completed then
  423.                                         self.incompleteObjectives[questID..":"..i] = 1
  424.                                 end
  425.                         end
  426.                 end
  427.         end
  428.  
  429.         if self.Coordinates[currentMapID] then
  430.                 local mapWidth = self.WorldMapOverlay:GetWidth()
  431.                 local mapHeight = self.WorldMapOverlay:GetHeight()
  432.                 for questID,coords in pairs(self.Coordinates[currentMapID]) do
  433.                         if self:PawNeedsShown(questID) then
  434.                                 local button = self:GetPaw(questID)
  435.                                 button:SetPoint("CENTER",self.WorldMapOverlay,"TOPLEFT",coords[1]*mapWidth,coords[2]*mapHeight*-1)
  436.                                 button:Show()
  437.                         end
  438.                 end
  439.         end
  440.  
  441. end
  442.  
  443. --[[ Settings ]]
  444.  
  445. -- Instead of a toggle frame to turn paws on/off, this version uses the
  446. -- new "Show Pet Tamer" option on the WorldMapShowDropDown added in 5.3
  447.  
  448. dailytamer.SettingDetails = {
  449.         -- {"descriptive label",r,g,b,"savedvar_name",default_value},
  450.         {"Satchel Dailies",.25,1,.25,"TrackSatchels",true},
  451.         {"Non-Satchel Dailies",.5,.85,1,"TrackNonSatchels",false},
  452.         {"Beasts of Fable",1,.5,0,"TrackFables",false}
  453. }
  454.  
  455. function dailytamer:InitializeSettings()
  456.         settings = BattlePetDailyTamerSettings
  457.         -- hook the default "Show Pet Tamers" dropdown
  458.         self.old_WorldMapShowDropDown_Initialize = WorldMapShowDropDown_Initialize
  459.         WorldMapShowDropDown_Initialize = self.new_WorldMapShowDropDown_Initialize
  460.         -- set default settings if none defined yet
  461.         for _,detail in pairs(self.SettingDetails) do
  462.                 if settings[detail[5]]==nil then
  463.                         settings[detail[5]] = detail[6] -- give it a default value
  464.                 end
  465.         end
  466.         SetCVar("showTamers","0") -- turn off default paws
  467. end
  468.  
  469. function dailytamer.new_WorldMapShowDropDown_Initialize(self,level,menuList)
  470.   if level~=2 and UIDROPDOWNMENU_MENU_VALUE~="tamers" then
  471.                 -- if this is not our tamer sub-menu
  472.     dailytamer.old_WorldMapShowDropDown_Initialize(self,level,menuList) -- run old one
  473.                 -- then look for tamer dropdown button and give it a sub-menu
  474.           local index, button, buttonName = 1
  475.           repeat
  476.             buttonName = "DropDownList1Button"..index
  477.             button = _G[buttonName]
  478.             if button and button.value=="tamers" then
  479.                                 button.hasArrow = true -- make the Show Pet Tamers have a sub-menu
  480.               button.func = dailytamer.MenuParentOnClick
  481.                                 button.checked = not settings.HideDailies
  482.                                 if settings.HideDailies then
  483.                                         _G[buttonName.."Check"]:Hide()
  484.                                         _G[buttonName.."UnCheck"]:Show()
  485.                                 else
  486.                                         _G[buttonName.."Check"]:Show()
  487.                                         _G[buttonName.."UnCheck"]:Hide()
  488.                                 end
  489.                                 return
  490.             end
  491.             index = index+1
  492.           until not button
  493.   else
  494.     local info = UIDropDownMenu_CreateInfo()
  495.     info.isNotRadio = true;
  496.     info.keepShownOnClick = 1
  497.     info.icon = "Interface\\AddOns\\Battle Pet Daily Tamer\\paw.tga"
  498.                 for i=1,#dailytamer.SettingDetails do
  499.                         info.text = dailytamer.SettingDetails[i][1]
  500.                         info.checked = settings[dailytamer.SettingDetails[i][5]]
  501.                         info.func = dailytamer.MenuButtonOnClick
  502.                         info.arg1 = dailytamer.SettingDetails[i][5]
  503.                         UIDropDownMenu_AddButton(info,2)
  504.                         _G["DropDownList2Button"..i.."Icon"]:SetVertexColor(dailytamer.SettingDetails[i][2],dailytamer.SettingDetails[i][3],dailytamer.SettingDetails[i][4])
  505.                 end
  506.   end
  507. end
  508.  
  509. -- when "Show Pet Tamers" clicked to turn them all on/off
  510. function dailytamer:MenuParentOnClick(_,_,checked)
  511.         settings.HideDailies = not checked
  512.         dailytamer:UpdatePaws()
  513. end
  514.  
  515. -- when one of the sub-menu buttons clicked
  516. function dailytamer:MenuButtonOnClick(var,_,checked)
  517.         settings[var] = checked
  518.         dailytamer:UpdatePaws()
  519. end