1. #1

    Mining and herbalism Addon possible?

    Hello and sorry for my bad english i hope you will understand what i want to explain you.

    I am looking for and Addon or a Macro to change my gloves when i use mining or herbalism.

    My professions are mining and herbalism and i use the enchant for faster collecting but i must change my gloves manuel to
    get the advantage. So my question is if its possible that a addon change my gloves automaticlly when i click on the spot?
    With mouseover or something else? Or can i use a makro to change them?

    Thx

  2. #2
    You can create 2 different armorsets and then create a macro that switches between this armorsets.

  3. #3
    yeah i can also drag the cloves in the bar and change it manuel but the question is if it works automaticly

  4. #4

  5. #5
    Yeah i know now i use a macro like

    /equip Machterfüllte Jüngerhandschuhe (enchant for herbalism)
    /equip Handschuhe der Tirisgarde (enchant for mining)

    But i must click on it to change the gloves. So my question is now it is possible that a addon can do that for me when i click on a herbspot or miningspot.

  6. #6
    Deleted
    It's really hard to do this in a clean way, because to my knowledge there is no event or script handler for when you mouseover a gathering node or when the GameTooltip is set to a world object. I could be wrong about this, so there could be a simpler solution.

    In any case, here's what I came up with:

    Code:
    local MINING_GLOVES = "Biornskin Belt"
    local HERBALISM_GLOVES = "Dreadhide Girdle"
    
    local LOCALIZED_HERBALISM = "Herbalism"
    local LOCALIZED_MINING = "Mining"
    
    local GameTooltip = GameTooltip
    local GameTooltipTextLeft2 = GameTooltipTextLeft2
    local EquipItemByName = EquipItemByName
    
    local function ScanTooltip()
    	if GameTooltip:NumLines() ~= 2 then return end
    	local text = GameTooltipTextLeft2:GetText()
    	if text:find(LOCALIZED_MINING) then
    		EquipItemByName(MINING_GLOVES)
    	elseif text:find(LOCALIZED_HERBALISM) then
    		EquipItemByName(HERBALISM_GLOVES)
    	end
    end
    
    GameTooltip:HookScript("OnTooltipSetDefaultAnchor", function(self)
    	self:SetWidth(1)
    end)
    
    GameTooltip:HookScript("OnSizeChanged", function()
    	ScanTooltip()
    end)
    It scans tooltip text, so it requires localized version of "Mining" and "Herbalism". This is the text you see in the second line in your tooltip when you mouseover a gathering node, so keep that in mind, just in case it's different from the profession names in some localizations.

    OnTooltipSetDefaultAnchor runs every time you mouse over a world object, so it's a reliable script handler to check. However, it runs before the contents of the tooltip are updated. Momentarily I tried running the ScanTooltip function after a delay using C_Timer.After, but it felt like such a dirty solution, that I decided to instead enforce OnSizeChanged by manually changing the tooltip size, so that when the tooltip updates, it must change size.

    OnSizeChanged runs after the contents of the tooltip have been updated, but only if the size of the tooltip actually changed. As it turns out, even during my short testing I managed to find some mobs in Suramar, whose tooltip was exactly the same size as the tooltip for Leyline Deposits, so this handler didn't run, if I moved my mouse from one of the mobs to the mining node. This is why it cannot reliably be used alone, but combined with OnTooltipSetDefaultAnchor it should run every time you mouse over an object in the game world.

    I'm not 100% satisfied with how it turned out, since it's not a totally clean solution, but it should work, which is what matters.

    It won't swap your gloves, if you were in combat as you put your mouse over the gathering node, and then left combat without ever moving your mouse, but that's such a rare issue that I don't care to fix it. If that happens, just quickly move your mouse away from the gathering node and then back.

    To use it code, either run it with an AddOn that can run custom Lua code snippets, I use Hack for that, or turn it into an AddOn yourself. Here's a guide on how to make your own AddOn from a code snippet:
    http://www.mmo-champion.com/threads/...lve-easy-steps
    BTW, the current game version is of course 70000, but it hasn't been updated in the guide.

  7. #7
    Thx i will test it later or tomorrow

  8. #8
    Deleted
    Hope it works.

    Also, a small correction:
    You can replace the last 3 lines with simply
    Code:
    GameTooltip:HookScript("OnSizeChanged", ScanTooltip)
    I originally had some extra stuff there for testing purposes, and forgot to simplify it afterwards. Now it has to make an extra function call just to do nothing else but to call another function.

  9. #9
    Field Marshal Terrorbladez's Avatar
    10+ Year Old Account
    Join Date
    Apr 2010
    Location
    Amesbury - UK
    Posts
    84
    Works beautifully! As stated just don't mouse over a node while in combat, it doesn't affect much just brings up the icon in of the item where your pointer is and if you left click it brings up the delete box but thats such a minor thing for the amount of time it saves (Just right click instead ).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •