Molinari

Molinari

1M Downloads

[New Feature] Support for feeding Pets via ALT+Click in Bag

lycano opened this issue ยท 1 comments

commented

Hi there,

first of all thank you for this addon. Im using this for my classic rogue to open locks in my backpack and it saves me so much time.

Recently i had an idea since i rolled a hunter. I would like to ask if you could add something like isFeedableFood to the modifier section (when pressing alt) like isOpenable already is for rogues.

Im really tired of clicking "feed pet" -> open my backpack -> click on food. I would like to shorten this down to "alt+click". I believe others would agree since afaik there is currently no such addon that allows hunters to feed pet easier.

For that I quickly implemented such feature without any checking via LibProcessable since i was just testing if this is doable.

Molinari.lua:~L139 (After isOpenable check)

local IsFeedableFood, spellID = LibProcessable:IsFeedableFood(itemID)
if (IsFeedableFood) then
    Molinari:Apply(itemLink, spellID, 1, 0, 0)
end

LibProcessable.lua

function lib:IsFeedableFood(itemID)
	if(type(itemID) == 'string') then
		assert(string.match(itemID, 'item:(%d+):') or tonumber(itemID), 'item must be an item ID or item Link')
		itemID = (tonumber(itemID)) or (GetItemInfoFromHyperlink(itemID))
	end

	local name, link, quality, level, minLevel, type, subType, stackCount, equipLoc, icon, sellPrice, classID, subclassID, bindType, expacID, setID, isCraftingReagent = GetItemInfo(itemID)
	print("level", level, "type:", type, "subType:", subType, "classID:subclassID", classID, subclassID, "isConsumable", IsConsumableItem(itemID))

	if(classID== 0) then
		return true, 6991
	end
end

Ignore the print and the ultra long GetItemInfo var assignment in the function since i was trying to find a way to detect feedable food via subclass but it always is consumable like classID ..

I think if LibProcessable would have some itemID list like lib.herbs but for food i.e. Meat like Tough Jerky and maybe detect other sources via Profession Cooking to filter out other consumables like Bandages would be good?

In any case there is probably a cleaner solution available for this but for now this is working just fine for me.

I chose the red color because it can be eaten ;)

Thoughts about further improvement
If this is done via LibProcessable .. some could also check for level of food and check if its in range of the pet level .. color of the border when pressing alt could be variance of chosen color (here it was red) to visualize the quality of the food you are about to feed without checking action log. This would be a cosmetic feature i guess but maybe can add later if you like the idea?

What do you think?

Best wishes,
Lycano

commented

Molinari was made as a fork of oApplication initially for processing herbs, and I made several other copies of it for dealing with other profession(-esque) spells like lockpicking and prospecting. Eventually I merged them together as they all fit one theme - processing materials for professions. Feeding your pets does not fall in that category, as poisons don't, but you're free to fork this addon (or oApplication) for that purpose yourself, as the MIT license permits that, just keep in mind that LibProcessable is ARR.