Page 1 of 1

Highlight learnable pets in bag/bank (addon?)

Posted: June 18th, 2020, 12:10 pm
by Caliban
Hi. Is there an addon which highlights any learnable pets in your bags/bank/guild vault? As in, for example, if i have a bunch of 'Adventurous Hoplings' in my bag, and in my pet journal I only have 1 out of 3 learned, that the ones in my bags would for example be highlighted?

I'm asking because I deal in pets on different realms and it's quite the chore having to hover a bank full of pets in search of ones that I can put in my pet journal, to be sold on other realms.

Let me know, I'd really appreciate it :)

Kris

Re: Highlight learnable pets in bad/bank (addon?)

Posted: June 18th, 2020, 7:57 pm
by Gello
Paste this into https://addon.bool.no/ to create an addon:
  • This adds the /learnable slash command that enables the search term "learnable" (without quotes, all lower case) in a bag or bank searchbox to find all CAGED pets that you have less than the maximum.
  • *** THIS WILL NOT WORK FOR PETS THAT ARE NOT CAGED ***
  • Also, this hooks GetContainerItemInfo which should not remain hooked this way all the time. When done managing pets, /reload to release the hooks.

Code: Select all

-- This adds the /learnable slash command that enables the search term "learnable" (without quotes, all lower case) in a bag or bank searchbox to find all CAGED pets that you have less than the maximum.
-- *** THIS WILL NOT WORK FOR PETS THAT ARE NOT CAGED ***
-- Also, this hooks GetContainerItemInfo which should not remain hooked this way all the time. When done managing pets, /reload to release the hooks.

local search = "learnable" -- change to whatever text to find them

SLASH_LEARNABLE1 = "/learnable"
SlashCmdList["LEARNABLE"] = function(msg)
    local o,c,x=GetContainerItemInfo
    function GetContainerItemInfo(b,s)
        if BagItemSearchBox:GetText():match("^"..search.."$") or BankItemSearchBox:GetText():match("^"..search.."$") then
            local d = (select(7,o(b,s)) or ""):match("battlepet:(%d+)")
            if d then
                r,c,x = {o(b,s)},C_PetJournal.GetNumCollectedInfo(d)
                r[8] = c>=x
                return unpack(r)
            end
        end
        return o(b,s)
    end
    print("Enter \124cffffff00"..search.."\124r in a bag or bank search box to find pets that are learnable. Remember to /reload when done.")
end

Re: Highlight learnable pets in bad/bank (addon?)

Posted: June 19th, 2020, 1:30 am
by Caliban
Hi Gello,

Thanks so much! This actually works, and is a HUGE time saver for me, so thank you. One question though; is it possible for you to write the code so that this also works on guild bank tabs? That would be absolutely perfect. Regardless, I'm already very happy with this :)

Kris

PS: I also noticed that the code doesn't work within another bag addon that I use called Derpy (it's a 'show-all-bags-as-one' addon, but most importantly the sort button on it sorts the pets in my bags and bank while grouping the same ones together; a feature that is also essential for me and which more popular addons like 'Bagnon' don't have). Is there any way of making your written addon work within the search field of this addon?

PPS: Another work-around I thought of; is there a code you could and would be willing to write which would sort the pets in my bags/bank/guild vault according to their name? That way I wouldn't need to use the Derpy addon at all.

Re: Highlight learnable pets in bad/bank (addon?)

Posted: June 19th, 2020, 9:37 pm
by Gello
It seems like the guild bank does a different method than bank or bags which is weird. If I get time I'll tinker with it more later.

Re: Highlight learnable pets in bad/bank (addon?)

Posted: June 20th, 2020, 2:55 am
by Caliban
Gello wrote:
June 19th, 2020, 9:37 pm
It seems like the guild bank does a different method than bank or bags which is weird. If I get time I'll tinker with it more later.
Hi Gello,

Thanks so much. I just realized you're the author of Rematch :O Of course, like any self-respecting pet collector, I use that too, but I also use it 'out of the box' style for keeping track of my buying and selling of pets over multiple realms. If you're curious how I do that, let me know and I'll tell you (I came up with it myself).

Anyway, I'll keep an eye out on this page for any progress. No rush though, I know you're busy! Thanks again for your time; I really appreciate it :)

Kris

Re: Highlight learnable pets in bag/bank (addon?)

Posted: October 26th, 2020, 7:04 am
by Caliban
I've been looking all over for a solution, but so far no luck. I did think of something else though;

A macro that would cage any pets from either my bank or guild bank which I have less than three of in my pet collection. This would be amazing. (I might even post the same question in its own separate thread, in fact). Anyone?