- Joined
- Feb 27, 2011
- Messages
- 5,354
Version 283
Normally creating another thread or using a task is a big no-no, but since we are not interacting with the game but rather simulating the interaction of a user, it is ok.
Attempting to use TreeRoot.StopGently from within the bot thread will result in an invalidoperationexception.
====
INavigationProvider now has a new function CanFullyNavigateToAsync which replaces CanFullyNavigateTo.
Currently CanFullyNavigateTo is marked as obsolete and is now only a wrapper for CanFullyNavigateToAsync
I expect to make similar changes to moveto in the future as the use of asynchronous operators will greatly simply the way we work with the navigation server.
[/code]
Code:
This is a big release which has a lot of internal code refactored. In a rush to get this bot into production shortcuts were taken and as such there is a lot of UI code in places it doesn't belong. This version has stripped out much of this code and shifted it to where it belongs.
Changes:
Orderbot, fatebot and combat assist now better support changing routines while the bot is still running.
Fatebot will no longer lockup the game client while waiting for a response from the navigation server.
Better handling of the close window event, we now cancel the event then make sure that the bot thread has exited, the user has been logged out and that the log has been flushed to disk.
Bug Fixes:
Orderbot will no longer have issues starting as a disciple of the land/hand and switching to a combat class
Don't trigger the post combat delay if the the delay hasn't been set.
Stop movement when post combat delay begins.
In some cases routinemanager.routinechanged wasn't firing, this has been corrected.
SelectStringOverride now works properly.
-<SelectStringOverride Index="0,3,2"/> will cause orderbot to select those items instead of the default behavior selecting the first(0) item. Each time a selectstring/selecticonstring window pops up an element is dequeued and that value is used to determine what index to pick.
Api Changes:
FreeItemSlots has been added to the ConditionParser for use within orderbot profiles.
BrainBehavior.Handleloading has been removed, as it duplicated functionality present within CommonBehaviors.HandleLoading
BotManager.SetCurrent will now throw an invalidoperationexecption if it is called while treeroot.IsRunning returns true.
Treeroot.Stop has had its parameters changed.
async Task Treeroot.StopGently has been added. Attempting to use StopGently from within the main bot thread will result in an invalidoperationexception
Proper use of treeroot.stop:
There are only two valid reasons to use TRS.
1)I wish to stop the botbase from continuing execution due to an unrecoverable/unhandled issue.
-This is the primary usage of TRS.
-Nothing has changed in this regard except now that under no circumstances will TRS abort the bot thread. This ensures that cleanup code always gets run, and its run on the thread that called the initialization code.
2)I wish to stop the bot so that I may switch the current botbase
-This is a bit trickier, since the code for plugins runs inside of the main bot thread and stopping the main thread forcefully is no longer possible we need to start a new thread which will handle this for us.
[code]
System.Threading.Tasks.Task.Factory.StartNew(async () =>
{
await TreeRoot.StopGently("Preparing to switch botbase.");
BotManager.SetCurrent(BotManager.Bots.FirstOrDefault(r => r.Name == "Fate Bot"));
TreeRoot.Start();
});
Attempting to use TreeRoot.StopGently from within the bot thread will result in an invalidoperationexception.
====
INavigationProvider now has a new function CanFullyNavigateToAsync which replaces CanFullyNavigateTo.
Currently CanFullyNavigateTo is marked as obsolete and is now only a wrapper for CanFullyNavigateToAsync
I expect to make similar changes to moveto in the future as the use of asynchronous operators will greatly simply the way we work with the navigation server.
[/code]