Please note that even though it requires you to feed it with the item name, it will Imbue/Enchant everything it can untill the spell runs out of components. It only uses the Component Name to check how many is left, and if it should use Mass or Single Imbue/Enchant.
It will stop up and med up every time it runs out of mana, and continue when it has medded to full mana.
It will also sit between each cast to conserve mana. I know some will say that it's minimal what you will gain from that, but you will never the less gain some from it. It will offcourse not sit between each cast if you are on a mount.
Only one thing should perhaps be added, but that I myself don't need, and that is a limit of how many it should enchant.
I tend to only put whatever in my inventory that I wish to enchant, some might want it to only enchant the number they want it to.
This should be easy to calculate by taking a dump of the number of items in the inventory before actually starting the casting loop, and store that number. Then on each loop check if @Original-@Current==@Limit.
Or you could merely do an incrementing variable on each loop (however then you need to take into account recasts).
Code: Select all
#turbo
#event NOCOMPONENT "You are missing some required spell components."
#event NOSPELL "You do not seem to have that spell memorized."
#event NOMANA "Insufficient Mana to cast this spell!"
#event INTERRUPTED "Your spell is interrupted."
#event FIZZLED "Your spell fizzles!"
Sub Main
|+ Declaring all variables.
|--------------------------------------------------
/declare mount global
/declare recast global
/declare mass global
/declare spellname global
/declare itemname global
/declare tmpspellname global
|----------
|+ (Re-)Setting default values
|--------------------------------------------------
/varset mount 0
/varset recast 0
/varset mass 0
/varset spellname 0
/varset tmpspellname 0
/varset itemname 0
|----------
|+ Do some simple checking before starting.
|--------------------------------------------------
/if "$defined(Param1)"=="FALSE" /call Syntax
/if "$defined(Param1)"=="TRUE" /varset itemname "@Param1"
/if n $char(gem,"@Param0")>0 /varset spellname "@Param0"
/if n $char(gem,"Mass @spellname")>0 /varset mass 1
/if n $char(buff,"Summon Horse")>0 /varset mount 1
/if n @mount==0 /if n $char(buff,"Summon Drogmor")>0 /varset mount 1
|----------
|+ Run the imbue/enchant loop.
|--------------------------------------------------
:Loop
/if "$char(state)"!="STAND" /stand
/if n @mass==1 /if n $count("@itemname")>=5 {
/varset tmpspellname "Mass @spellname"
} else {
/varset tmpspellname "@spellname"
}
/cast "@tmpspellname"
/doevents
/if n @recast==1 {
/varset recast 0
/goto :Loop
}
/delay $calc($spell("@tmpspellname",casttime)+1)s
/doevents
/if n @recast==1 {
/varset recast 1
/goto :Loop
}
/if n @mount==0 /if $char(state)!="SIT" /sit
/click left auto
/delay $calc($spell("@tmpspellName",recoverytime)+5)s
/goto :Loop
|----------
/return
Sub Syntax
/echo Syntax: /macro imbue "Single Imbue/Enchant Component Spellname" "Component Name"
/echo Example: /macro imbue "Enchant Clay" "Large Block of Clay"
/echo You are recommended to memorize both the "Mass Imbue/Enchant" and the "Single Imbue/Enchant" spell, if you have it.
/echo The macro will automatically use the right one, according to the number of components left to imbue/enchant.
/endmacro
/return
Sub Event_NOMANA
/varset recast 1
/if "$char(state)"!="SIT" /if n @mount==0 /sit
:Loop
/delay 6s
/if n $char(mana,cur)<$char(mana,max) /goto :Loop
/return
Sub Event_FIZZLED
/varset recast 1
/return
Sub Event_INTERRUPTED
/varset recast 1
/return
Sub Event_NOSPELL
/endmacro
/return
Sub Event_NOCOMPONENT
/endmacro
/return
