I guess you all must have been annoyed that you weren't able to modify some of the 'inner'-core stuff in the bot, eh? Well, that changes now.
The SequenceManager allows you to override specific functions of the bot. That includes (but is not limited to):
You will also find a more thorough explanation of the sequence in the XML summary of the enum member.
All you do is use the SequenceManager.AddSequenceExecutorOverride function. Here's a little snippet:
As you can see, you can call the default sequence executor if your own method doesn't work. In this case, I use SequenceManager.CallDefaultSequenceExecutor(Sequence.ReleaseSpirit) if I haven't returned from the function before that.
That's pretty much it. This class will be available in the next version of HB.
I have one question for you though; which functions would you like to see overridable?
The SequenceManager allows you to override specific functions of the bot. That includes (but is not limited to):
Retrieving the corpse
Releasing the spirit
Mailing items
Vendoring/repairing at the vendor
You will also find a more thorough explanation of the sequence in the XML summary of the enum member.
All you do is use the SequenceManager.AddSequenceExecutorOverride function. Here's a little snippet:
Code:
public CustomClass()
{
SequenceManager.AddSequenceExecutorOverride(Sequence.ReleaseSpirit, MyReleaseSpirit);
}
private static void MyReleaseSpirit()
{
List<string> hasSoulstone = Lua.LuaGetReturnValue("return HasSoulstone()", "hax.lua");
if (hasSoulstone != null && hasSoulstone.Count > 0 && hasSoulstone[0].ToLower() != "nil")
{
Lua.DoString("UseSoulstone()");
int tickCount = Environment.TickCount;
while (!ObjectManager.Me.IsAlive && Environment.TickCount - tickCount < 7500)
Thread.Sleep(100);
if (ObjectManager.Me.IsAlive)
return;
}
SequenceManager.CallDefaultSequenceExecutor(Sequence.ReleaseSpirit);
}
That's pretty much it. This class will be available in the next version of HB.
I have one question for you though; which functions would you like to see overridable?