1. Macro for conjuring food and drink

    So I've been looking for an add-on or macro that helps me conjuring food and drink with the matching spell rank, depending on the level of my current target. I couldn't find any and so I simply decided to write my own set of macros to do the job.

    I've been testing these macros for the last few days and I'd like to share them with the community because they're incredibly helpful IMO.
    To make it work, you'll need 4 different macros. The first one is to register a virtual button and the other three macros will use this button to actually cast the spell you want.

    First macro:
    Register a virtual button - there is NO visual confirmation in your UI after clicking this macro. If nothing changes, then it worked as intended.
    You HAVE TO use this macro once every time you log-in on your mage. Otherwise the conjuring macros below WILL NOT work!
    Code:
    /run local b=_G["conjure"]or CreateFrame("Button","conjure",UIParent,"SecureActionButtonTemplate");b:SetAttribute("type", "spell");function GSNBR(spell, rank) return string.format("%s(Rank %i)",spell,rank) end

    Macro for conjuring water:
    Code:
    /run local b,m,f,u=_G["conjure"],math.min,math.floor,UnitLevel;t=u("target");l=m(t>0 and t or u("player"),65);b:SetAttribute("spell",GSNBR("Conjure Water",m(9,f((l-5)*0.1+f(l*(1/60))+2+(IsShiftKeyDown() and 1 or 0)))));
    /click conjure
    Macro for conjuring food:
    Code:
    /run local b,m,u=_G["conjure"],math.min,UnitLevel;local t=u("target");local l=m((t>0 and t or u("player")),65);b:SetAttribute("spell",GSNBR("Conjure Food",m(8,math.floor((l-5)*0.1+2+(IsShiftKeyDown() and 1 or 0)))));
    /click conjure
    Macro for conjuring refreshment:
    Code:
    /run local b,l=_G["conjure"],UnitLevel("target");b:SetAttribute("spell",GSNBR("Conjure Refreshment",l>0 and l<80 and 1 or 2));
    /click conjure
    How to use them?
    Simple: After you created those 4 macros in your client, target someone or something (even NPCs) and click one of the conjuring macros above. After the macro did some math stuff and solved the Riemann-Hypothesis, you might get your desired item ;)

    Additional info:
    The conjuring macros even allow to increase the calculated spell rank by 1. Just use Shift+Click on the macro and it will conjure food/drink for level 25, if your target was in level range 15-24 for example.

    Disclaimer:
    Due to the character limit of 255 characters per macro, I removed most of the unnecessary white-space characters. This might make the code look ugly, but at least I got all the functionality in I wanted.



    Now I'll hope at least some of you guys find these macros as helpful as I do.

    Kind regards and see you in game :)
    Edited: July 23, 2023 Reason: Update macros: Keep as many variables local as possible, use player level as fallback value

  2. ...

    Delete

    ...
    Edited: November 8, 2023

  3. Thanks for your reply and your suggestions.

    I chose to implement the desired functionality with macros just to keep it as simple as possible. The macros solve exactly the use-case they're intended for. No other code required for that.

    If you want to implement this functionality in a full-fledged addon, feel free to do so.
    Edited: July 22, 2023

Posting Permissions

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