PetTracker

250 - Add captured pet information to the blip tooltip.

What is the enhancement in mind? How should it look and feel?
When mousing over a pet blip on the world map it would be helpful to see a list of pets of that type that I have already captured. The pet names should be color coded based on quality and should also contain the levels of each pet captured.

Please provide any additional information below.
Below is the code I created locally to do just that. I added this to the Map:UpdateTip function in WorldMap.lua I attached a screenshot of what the finished product looks like. Feel free use this if you would like.

==================================================================

function Map:UpdateTip()
    Tooltip:Anchor(BlipParent, 'ANCHOR_CURSOR')

    for i, blip in ipairs(self.blips do
        if blip:IsMouseOver() then
            local title, text = blip:GetTooltip()

            Tooltip:AddHeader(title)
            Tooltip:AddLine(text, 1,1,1)

            -- ***** My Changes **********
            if not (title == "Stable Master") then
                local TooltipOwnedPets = "\n|cff82c5ff" .. _G.BATTLE_PET_CAPTURED .. _G.HEADER_COLON .. "|r\n"

                local petList = Journal:GetOwned(blip.specie.specie
                if (#petList > 0) then
                    -- Loop thru all the pets of this type and add info to tooltip.
                    for j, petID in pairs(petList) do
                        local Rarity, PetLevel = Journal:GetQuality(petID), Journal:GetLevel(petID)
                        TooltipOwnedPets = TooltipOwnedPets .. _G.ITEM_QUALITY_COLORS[Rarity-1].hex ..  _G["BATTLE_PET_BREED_QUALITY"..Rarity] .. "|r |cffffffff"
                        TooltipOwnedPets = TooltipOwnedPets .. _G.PARENS_TEMPLATE:format(string.format("%s %d", _G.LEVEL_ABBR, PetLevel)) .. "|r, "
                    end

                    -- Remove last comma from tooltip.
                    TooltipOwnedPets = string.sub(TooltipOwnedPets, 1, -3)
                else
                    -- No pets of this type owned.
                    TooltipOwnedPets = TooltipOwnedPets .. "|cffff2020" .. _G.NONE .. "|r"
                end

                Tooltip:AddLine(TooltipOwnedPets)
            end
            -- ***************************
        end
    end

    for i = 1, GetNumMapLandmarks() do
        local frame = _G['WorldMapFramePOI' .. i]

        if frame and frame:IsMouseOver() then
            local tamer = Tamer:Get(frame.name)

            if tamer then
                Tooltip:AddHeader(tamer.name)
                Tooltip:AddLine(NORMAL_FONT_COLOR_CODE .. frame.description .. FONT_COLOR_CODE_CLOSE)

                for i, pet in ipairs(tamer) do
                    local r,g,b = Addon:GetQualityColor(pet:GetQuality())
                    local icon = format('|T%s:16:16:-3:0:128:256:60:100:130:170:255:255:255|t', Journal:GetTypeIcon(pet:GetSpecie()))

                    Tooltip:AddLine(icon .. pet:GetName() .. ' (' .. pet:GetLevel() .. ')', r,g,b)
                end
            end
        end
    end

    Tooltip:Display()
end

  • Tooltip_Sample.png
User When Change
Jaliborc Aug 16, 2013 at 02:24 UTC
esiemiat Aug 14, 2013 at 14:56 UTC

Added attachment Tooltip_Sample.png

esiemiat Aug 14, 2013 at 14:55 UTC Create

You must login to post a comment. Don't have an account? Register to get one!

Facts

Last updated
Aug 16, 2013
Reported
Aug 14, 2013
Status
Accepted - Problem reproduced / Need acknowledged.
Type
Enhancement - A change which is intended to better the project in some way
Priority
Medium - Normal priority.
Votes
0

Reported by

Possible assignees