Routines
From LoopBot
|
Routines are simply Class specific behavior. In all cases, you would never want a Mage to act like a Priest or anything of the sort. Instead, you should define behaviors that are specific to the Class you are botting. LoopBot offers LoopBot.clsBaseRoutine as a means to expose necessary members to its sub-classes (Class specific routines). It does not contain any routine logic, so running LoopBot without a custom routine will yield fairly boring combat sequences (read: none).
Custom Routines
Your custom routines may contain logic of any degree, written in C# and fitting within this skeleton template. LoopBot compiles custom routines at runtime and will respond with compilation errors if your code is not well formed. LoopBot.clsBaseRoutine allows several of its methods to be overridden and exposes the ISXWoW object for your use.
Using the ISXWoW Object
The ISXWoW object is declared as _isxwow. As such, you may access it as follows (for example):
_isxwow.Me.Something
If you're unfamiliar with the ISXWoW object, you might consider checking out the ISXWoW.NET wiki.
Base Routine Overrideable Methods
- (Required) public override bool routineSequence(WoWUnit target)
- This method contains all of the logic performed in a single combat sequence: pre-combat, in-combat, post-combat. This logic is always executed from the beginning of the method when entering combat with a new target.
- Must return (bool) _isxwow.Me.IsInCombat
- public override void rest()
- This method contains the actions performed during a rest sequence (calls eat() and drink() and waitUntilRested()).
- public override void eat()
- This method contains the logic for determining what food to eat, if any.
- public override void drink()
- This method contains the logic for determining what drink to drink, if any.
- public override void sequenceSpell(WoWUnit target, string spellName)
- This method contains the actions performed immediately before an individual spell is cast, and casts the spell.
Accessible Base Routine Methods
To facilitate routine writing, the following methods are available (but not overrideable) for your use:
- bool neitherDead(WoWUnit target)
- Parameters:
- WoWUnit target - The target we'll check to see if they are dead or alive
- Returns:
- True if neither you or the target are dead (you are both alive); False if you either of you are dead
- Parameters:
- void sequenceSpell(WoWUnit target, string spellName)
- Parameters:
- WoWUnit target - The target we're going to cast our spell on
- string spellName - The name of the spell we're going to cast
- Parameters:
- void sleepThread(int milliseconds)
- Parameters:
- int milliseconds - The number of seconds to sleep the thread
- Parameters:
- bool isSpellInRange(WoWUnit target, string spellName)
- Parameters:
- WoWUnit target - The target we're trying to cast at
- string spellName - The name of the spell we're trying to cast
- Returns:
- True if the spell is in range; False if the spell is too far to cast
- Parameters:
Custom Routine Storage
LoopBot permits routines to be stored in here:
./LoopBot/routines
With the following naming convention:
Class.cs
Where "Class" is the World of Warcraft character class (eg. Mage). For organization purposes, this is an appropriate naming scheme, however you can call your routines whatever you want, so long as their filenames end with .cs and they are located in the routines directory.
Including Comments In Your Routine
When your custom routine is compiled its line breaks are removed. As such, single line comments will cause syntax errors at compile time. For example:
// This is a single line comment, I will break the routine!
Instead, you must use multi-line comments for any and all comments you wish to leave in your routine, like this:
/* This will work fine */
