Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Battle Pet Daily Tamer
- 12/22/2012 1.0.5 added toggle window onto worldmap for turning paws on/off, removed panel option
- 12/21/2012 1.0.4 code cleanup
- 12/20/2012 1.0.3 overhauled pre-req system to work with both factions
- 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
- 12/16/2012 1.0.1 temporary fix for alliance/horde pre-req wierdness for taming EK/kalimdor, pet type icons on tamer tooltips
- 12/15/2012 1.0.0 initial release
- todo:
- - fix deepholm icon placement
- - add darkmoon daily
- - resource pool for paws?
- - replace astrolabe with static data
- ]]
- BattlePetDailyTamerSettings = {} -- savedvariable
- local dailytamer = CreateFrame("Frame","BattlePetDailyTamer")
- local astrolabe = DongleStub("Astrolabe-1.0")
- --[[ DailyInfo is indexed by the questID of each tamer's daily quest
- [questID] = {
- [1] = prereq group, -- group daily belongs to (ie "EK" "KL" "OL" etc)
- [2] = "Npc Name", -- name of the tamer
- [3] = mapID, -- mapID (for astrolabe)
- [4] = zone, -- zone (for astrolabe)
- [5] = xpos, -- xpos (for astrolabe)
- [6] = ypos, -- ypos (for astrolabe)
- [7] = hasSatchel, -- whether this tamer rewards a satchel
- [8] = petlevel, -- level of pets for this tamer
- [9] = pettype1, -- pet type of tamer's first pet (1-10)
- [10] = pettype2, -- pet type of tamer's second pet (1-10)
- [11] = pettype3 -- pet type of tamer's third pet (1-10)
- 1 = Hum
- 2 = Dra
- 3 = Fly
- 4 = Und
- 5 = Cri
- 6 = Mag
- 7 = Ele
- 8 = Bea
- 9 = Aqa
- 10 = Mech
- }
- ]]
- dailytamer.DailyInfo = {
- -- pre-MoP satchel dailies
- [31916]={"EK","Lydia Accoste",32,0,0.401,0.765,true,19,4,7,4},
- [31909]={"KL","Stone Cold Trixxy",281,0,0.656,0.645,true,19,3,8,2},
- [31926]={"OL","Bloodknight Antari",473,0,0.305,0.418,true,24,6,7,2},
- [31935]={"NR","Major Payne",492,0,0.774,0.196,true,25,8,10,7},
- [31971]={"CA","Obalis",720,0,0.566,0.420,true,25,5,3,8},
- -- pandaren satchel dailies
- [31955]={"MP","Farmer Nishi",807,0,0.461,0.437,true,25,8,7,7},
- [31991]={"MP","Seeker Zusshi",810,0,0.363,0.522,true,25,7,5,9},
- [31957]={"MP","Wastewalker Shu",858,0,0.551,0.376,true,25,9,8,7},
- [31953]={"MP","Hyuna of the Shrines",806,0,0.480,0.541,true,25,9,8,3},
- [31954]={"MP","Mo'ruk",857,0,0.622,0.459,true,25,3,9,8},
- [31958]={"MP","Aki the Chosen",811,0,0.675,0.406,true,25,5,2,9},
- [31956]={"MP","Courageous Yon",809,0,0.358,0.732,true,25,8,5,3},
- -- spirit satchel dailies
- [32434]={"PS","Burning Pandaren Spirit",810,0,0.571,0.421,true,25,7,2,3},
- [32441]={"PS","Thundering Pandaren Spirit",811,0,0.673,0.144,true,25,7,5,8},
- [32439]={"PS","Flowing Pandaren Spirit",858,0,0.611,0.875,true,25,7,9,5},
- [32440]={"PS","Whispering Pandaren Spirit",806,0,0.289,0.360,true,25,7,2,5},
- -- eastern kingdom non-satchel dailies
- [31693]={"EK","Julia Stevens",30,0,0.417,0.837,false,2,8,8,nil},
- [31780]={"EK","Old MacDonald",39,0,0.609,0.185,false,3,3,10,5},
- [31781]={"EK","Lindsay",36,0,0.333,0.526,false,5,5,5,5},
- [31850]={"EK","Eric Davidson",34,0,0.199,0.446,false,7,8,8,8},
- [31852]={"EK","Steven Lisbane",37,0,0.460,0.404,false,9,8,8,6},
- [31851]={"EK","Bill Buckler",673,0,0.515,0.734,false,11,1,3,3},
- [31910]={"EK","David Kosse",26,0,0.630,0.546,false,13,8,5,6},
- [31911]={"EK","Deiza Plaguehorn",23,0,0.670,0.524,false,14,8,8,4},
- [31912]={"EK","Kortas Darkhammer",28,0,0.353,0.277,false,15,2,2,2},
- [31913]={"EK","Everessa",38,0,0.768,0.415,false,16,9,3,8},
- [31914]={"EK","Durin Darkhammer",29,0,0.255,0.475,false,17,3,5,7},
- -- kalimdor non-stachel dailies
- [31818]={"KL","Zunta",4,0,0.439,0.289,false,2,5,8,nil},
- [31854]={"KL","Analynn",43,0,0.202,0.295,false,5,3,9,5},
- [31817]={"KL","Merda Stronghoof",101,0,0.571,0.457,false,9,7,9,5},
- [31862]={"KL","Zonya the Sadist",81,0,0.597,0.716,false,7,8,8,5},
- [31819]={"KL","Dagra the Fierce",11,0,0.586,0.531,false,3,8,8,5},
- [31871]={"KL","Traitor Gluk",121,0,0.597,0.496,false,13,2,5,8},
- [31904]={"KL","Cassandra Kaboom",607,0,0.396,0.791,false,11,10,10,10},
- [31908]={"KL","Elena Flutterfly",241,0,0.461,0.603,false,17,6,3,2},
- [31906]={"KL","Kela Grimtotem",61,0,0.319,0.329,false,15,8,5,5},
- [31907]={"KL","Zoltan",182,0,0.400,0.566,false,16,6,10,6},
- [31905]={"KL","Grazzle the Great",141,0,0.539,0.749,false,14,2,2,2},
- -- outland non-satchel dailies
- [31922]={"OL","Nicki Tinytech",465,0,0.643,0.493,false,20,10,10,10},
- [31923]={"OL","Ras'an",467,0,0.172,0.505,false,21,3,6,1},
- [31924]={"OL","Narrok",477,0,0.610,0.494,false,22,5,9,8},
- [31925]={"OL","Morulu The Elder",481,0,0.588,0.701,false,23,9,9,9},
- -- northrend non-satchel dailies
- [31934]={"NR","Gutretch",496,0,0.132,0.668,false,25,8,8,5},
- [31931]={"NR","Beegle Blastfuse",491,0,0.286,0.339,false,25,3,3,9},
- [31932]={"NR","Nearly Headless Jacob",510,0,0.501,0.590,false,25,4,4,4},
- [31933]={"NR","Okrut Dragonwaste",488,0,0.590,0.771,false,25,2,4,4},
- -- cataclysm non-satchel dailies
- [31972]={"CA","Brok",606,0,0.614,0.327,false,25,8,6,5},
- [31974]={"CA","Goz Banefury",700,0,0.566,0.568,false,25,7,6,8},
- [31973]={"CA","Bordin Steadyfist",640,0,0.499,0.570,false,25,7,5,7},
- }
- -- taming a continent is sometimes a faction-specific quest
- -- when a continent is known to be cleared, completed=1 added to its table
- dailytamer.DailyPreReqs = {
- ["EK"] = {questIDs={31902,31903}}, -- Eastern Kingdom (both sides)
- ["KL"] = {questIDs={31889,31891}}, -- Kalimdor (both sides)
- ["OL"] = {questIDs={31919,31921}}, -- Outland
- ["NR"] = {questIDs={31927,31929}}, -- Northrend
- ["CA"] = {questIDs={31966,31967}}, -- Cataclysm
- ["MP"] = {questIDs={31951}}, -- Pandaria
- ["PS"] = {questIDs={32428}}, -- Pandaria Spirits
- }
- -- these are quest IDs to faction-specific dailies. in init we remove the opposing faction tamers.
- -- if an alliance tames kalimdor it grants horde only access to kalimdor dailies
- -- if a horde tames EK it grants alliance only access to EK dailies
- -- lydia accoste and stone cold trixxy are available to both factions
- dailytamer.FactionSpecificDailies = {
- ["Alliance"] = {31693,31780,31781,31850,31852,31851,31910,31911,31912,31913,31914},
- ["Horde"] = {31818,31854,31817,31862,31819,31871,31904,31908,31906,31907,31905},
- }
- -- overlay over WorldMapButton, to be the parent for our buttons
- dailytamer.WorldMapOverlay = CreateFrame("Frame","BattlePetDailyTamerWorldMapOverlay",WorldMapButton)
- dailytamer.WorldMapOverlay:SetAllPoints(true)
- -- tooltip used on WorldMapOverlay
- dailytamer.WorldMapTooltip = CreateFrame("GameTooltip","BattlePetDailyTamerTooltip",nil,"GameTooltipTemplate")
- dailytamer.Paws = {} -- table of buttons that we'll place on world map
- dailytamer:SetScript("OnEvent",function(self,event)
- if event=="PLAYER_LOGIN" then
- self:Initialize()
- elseif event=="WORLD_MAP_UPDATE" and WorldMapFrame:IsVisible() then
- self:Show()
- end
- end)
- -- WORLD_MAP_UPDATE can fire up to a 100 times when crossing zone boundries.
- -- instead of reacting to every event, wait one frame after the events fire
- dailytamer:Hide()
- dailytamer:SetScript("OnUpdate",function(self,elasped)
- self:Hide()
- self:UpdatePaws()
- end)
- dailytamer:RegisterEvent("WORLD_MAP_UPDATE")
- dailytamer:RegisterEvent("PLAYER_LOGIN")
- -- takes numbers 1-10 representing pet types and returns a string of pet icons (or '?' if unknown)
- function dailytamer:GetPetTypeIconsInText(...)
- local txt=""
- for i=1,select("#",...) do
- if select(i,...) then
- if PET_TYPE_SUFFIX[select(i,...)] then
- txt=txt.."\124TInterface\\PetBattles\\PetIcon-"..PET_TYPE_SUFFIX[select(i,...)]..":20:20:0:0:128:256:102:63:129:168\124t"
- else
- txt=txt.."\124TInterface\\Icons\\INV_Misc_QuestionMark:20\124t"
- end
- end
- end
- return txt
- end
- --[[ added by neonic to calc at/def pets
- 1 = Hum
- 2 = Dra
- 3 = Fly
- 4 = Und
- 5 = Cri
- 6 = Mag
- 7 = Ele
- 8 = Bea
- 9 = Aqa
- 10 = Mech
- ]]
- function PetR(Pet,mode)
- if Pet == 1 then
- PetAt = 4
- PetDef = 8
- end
- if Pet == 2 then
- PetAt = 1
- PetDef = 4
- end
- if Pet == 3 then
- PetAt = 6
- PetDef = 2
- end
- if Pet == 4 then
- PetAt = 5
- PetDef = 9
- end
- if Pet == 5 then
- PetAt = 8
- PetDef = 1
- end
- if Pet == 6 then
- PetAt = 2
- PetDef = 10
- end
- if Pet == 7 then
- PetAt = 9
- PetDef = 5
- end
- if Pet == 8 then
- PetAt = 10
- PetDef = 3
- end
- if Pet == 9 then
- PetAt = 3
- PetDef = 6
- end
- if Pet == 10 then
- PetAt = 7
- PetDef = 7
- end
- if mode == 1 then
- return PetAt
- end
- if mode == 2 then
- return PetDef
- end
- end
- -- stuff to do on login
- function dailytamer:Initialize()
- -- remove faction-specific dailies (EK before Lydia and Kalimdor before Trixxy)
- local faction = UnitFactionGroup("player")
- faction = faction=="Alliance" and "Horde" or faction=="Horde" and "Alliance" or "Neutral"
- if self.FactionSpecificDailies[faction] then
- for i=1,#self.FactionSpecificDailies[faction] do
- self.DailyInfo[self.FactionSpecificDailies[faction][i]] = nil
- end
- end
- -- create buttons for the paws we'll put on the map
- for questID,tamer in pairs(self.DailyInfo) do
- self.Paws[questID] = CreateFrame("Button",nil,self.WorldMapOverlay)
- local button = self.Paws[questID]
- button:SetSize(20,20)
- button.texture = button:CreateTexture(nil,"ARTWORK")
- button.texture:SetAllPoints(true)
- button.texture:SetTexture("Interface\\AddOns\\Battle Pet Daily Tamer\\paw.tga")
- button:SetHighlightTexture("Interface\\AddOns\\Battle Pet Daily Tamer\\paw.tga")
- button.tamerName = tamer[2]
- button.mapID = tamer[3]
- button.tooltip = self.WorldMapTooltip
- if tamer[8]>0 then
- button.tamerPets = self:GetPetTypeIconsInText(tamer[9],tamer[10],tamer[11])
- button.tamerPetsAt = self:GetPetTypeIconsInText(PetR(tamer[9],1),PetR(tamer[10],1),PetR(tamer[11],1))
- button.tamerPetsDe = self:GetPetTypeIconsInText(PetR(tamer[9],2),PetR(tamer[10],2),PetR(tamer[11],2))
- end
- button:SetScript("OnEnter",function(self)
- self.tooltip:SetScale(GameTooltip:GetEffectiveScale())
- self.tooltip:SetOwner(self,"ANCHOR_LEFT")
- self.tooltip:AddLine(self.tamerName .. "|cffbbbbbb (Lv"..tamer[8]..") ")
- if self.tamerPets then
- self.tooltip:AddLine(self.tamerPets..": Enemy Pets")
- self.tooltip:AddLine(self.tamerPetsAt..": +50% Attack")
- self.tooltip:AddLine(self.tamerPetsDe..": +33% Defense:")
- end
- self.tooltip:Show()
- end)
- button:SetScript("OnLeave",function(self) self.tooltip:Hide() end)
- button:SetScript("OnClick",function(self,button)
- if button=="RightButton" then
- WorldMapZoomOutButton_OnClick() -- zoom out on paw right-click
- else
- PlaySound("igMainMenuOptionCheckBoxOn")
- SetMapByID(self.mapID) -- zoom in on paw left-click
- end
- end)
- button:RegisterForClicks("AnyUp")
- end
- BattlePetDailyTamerToggle:UpdateToggleState()
- end
- -- draw paws on map
- function dailytamer:UpdatePaws()
- -- remove all paws if we unchecked green paw in toggle frame
- if BattlePetDailyTamerSettings.HideDailies then
- for _,button in pairs(self.Paws) do
- button:Hide()
- end
- return
- end
- -- check for prerequisite quests being done for any not known to be complete
- for k,v in pairs(self.DailyPreReqs) do
- if not v.completed then
- -- for i=1,#v.questIDs do
- -- if IsQuestFlaggedCompleted(v.questIDs[i]) then
- -- v.completed = 1
- -- break
- -- end
- -- end
- v.completed=1 --hacked by neonic as broken
- end
- end
- -- put the paws on the map
- for questID,tamer in pairs(self.DailyInfo) do
- if not tamer[7] and not BattlePetDailyTamerSettings.TrackNonSatchels then
- self.Paws[questID]:Hide()
- elseif not IsQuestFlaggedCompleted(questID) and self.DailyPreReqs[tamer[1]].completed then
- -- if daily quest is not completed (and account has completed pre-req quest)
- astrolabe:PlaceIconOnWorldMap(self.WorldMapOverlay,self.Paws[questID],tamer[3],tamer[4],tamer[5],tamer[6])
- if tamer[7] then
- self.Paws[questID].texture:SetVertexColor(.25,1,.25,1) -- satchel daily
- else
- self.Paws[questID].texture:SetVertexColor(.5,.85,1,1) -- non-satchel daily
- end
- else
- self.Paws[questID]:Hide()
- end
- end
- end
- --[[ Toggle frame in lowerleft corner of WorldMapFrame for tuning paws on/off ]]--
- local toggle=CreateFrame("Frame","BattlePetDailyTamerToggle",BattlePetDailyTamerWorldMapOverlay)
- toggle:SetSize(116,36)
- toggle:SetPoint("BOTTOMLEFT")
- toggle.back=toggle:CreateTexture(nil,"BACKGROUND")
- toggle.back:SetPoint("TOPLEFT",4,-4)
- toggle.back:SetPoint("BOTTOMRIGHT",-4,4)
- toggle.back:SetTexture("Interface\\WorldMap\\UI-WorldMap-Middle1")
- toggle:SetBackdrop( { insets={left=4,right=4,top=4,bottom=4}, edgeFile="Interface\\Tooltips\\UI-Tooltip-Border", edgeSize = 16 } )
- toggle:SetBackdropBorderColor(.82,.5,.1)
- toggle:SetFrameStrata("HIGH")
- function toggle:UpdateToggleState()
- local settings = BattlePetDailyTamerSettings
- self.check1:SetChecked(not settings.HideDailies)
- self.check2:SetChecked(settings.TrackNonSatchels)
- if settings.HideDailies then
- self:SetWidth(64)
- self.back:SetTexCoord(0.05,0.25, 0.859375,1)
- self.paw2:Hide()
- self.check2:Hide()
- else
- self:SetWidth(116)
- self.back:SetTexCoord(0.05,0.546875, 0.859375,1)
- self.paw2:Show()
- self.check2:Show()
- end
- end
- -- green paw (all dailies)
- toggle.paw1=toggle:CreateTexture(nil,"ARTWORK")
- toggle.paw1:SetSize(24,24)
- toggle.paw1:SetPoint("LEFT",toggle,"LEFT",6,0)
- toggle.paw1:SetTexture("Interface\\AddOns\\Battle Pet Daily Tamer\\paw.tga")
- toggle.paw1:SetVertexColor(.25,1,.25,1)
- toggle.check1=CreateFrame("CheckButton",nil,toggle,"UICheckButtonTemplate")
- toggle.check1:SetSize(32,32)
- toggle.check1:SetPoint("LEFT",toggle.paw1,"RIGHT",-2,-1)
- toggle.check1:SetScript("OnClick",function(self)
- BattlePetDailyTamerSettings.HideDailies = not self:GetChecked()
- self:GetParent():UpdateToggleState()
- BattlePetDailyTamer:UpdatePaws()
- end)
- toggle.check1:SetScript("OnEnter",function(self)
- local tooltip = BattlePetDailyTamer.WorldMapTooltip
- tooltip:SetScale(GameTooltip:GetEffectiveScale()*.85)
- tooltip:SetOwner(self,"ANCHOR_TOP")
- tooltip:AddLine("Battle Pet Dailies")
- tooltip:Show()
- end)
- toggle.check1:SetScript("OnLeave",function(self)
- BattlePetDailyTamer.WorldMapTooltip:Hide()
- end)
- -- blue paw (non-satchel dailies)
- toggle.paw2=toggle:CreateTexture(nil,"ARTWORK")
- toggle.paw2:SetSize(24,24)
- toggle.paw2:SetPoint("LEFT",toggle.check1,"RIGHT",-2,1)
- toggle.paw2:SetTexture("Interface\\AddOns\\Battle Pet Daily Tamer\\paw.tga")
- toggle.paw2:SetVertexColor(.5,.85,1,1)
- toggle.check2=CreateFrame("CheckButton",nil,toggle,"UICheckButtonTemplate")
- toggle.check2:SetSize(32,32)
- toggle.check2:SetPoint("LEFT",toggle.paw2,"RIGHT",-2,-1)
- toggle.check2:SetScript("OnClick",function(self)
- BattlePetDailyTamerSettings.TrackNonSatchels = self:GetChecked()
- BattlePetDailyTamer:UpdatePaws()
- end)
- toggle.check2:SetScript("OnEnter",function(self)
- local tooltip = BattlePetDailyTamer.WorldMapTooltip
- tooltip:SetScale(GameTooltip:GetEffectiveScale()*.85)
- tooltip:SetOwner(self,"ANCHOR_TOP")
- tooltip:AddLine("Non-Satchel Dailies")
- tooltip:Show()
- end)
- toggle.check2:SetScript("OnLeave",function(self)
- BattlePetDailyTamer.WorldMapTooltip:Hide()
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement