Jump to content

How does the bot decide to train new spells?


Matenia

Recommended Posts

I looked into the Trainers state, but it's highly obfuscated.
I know the TrainLevel plugin that just keeps overwriting the wRobot setting, but sometimes it misses out and then you have to wait for 6 levels, so I'm not happy with that.

So I have tried this code, but it doesn't exactly work either. Can you maybe give some more info @Droidz?

public static void Start()
    {
        FiniteStateMachineEvents.OnBeforeCheckIfNeedToRunState += TrainingEventHandler;
    }

    public static void Stop()
    {
        FiniteStateMachineEvents.OnBeforeCheckIfNeedToRunState -= TrainingEventHandler;
    }

    private static void TrainingEventHandler(robotManager.FiniteStateMachine.Engine engine, robotManager.FiniteStateMachine.State state, System.ComponentModel.CancelEventArgs cancelable)
    {
        if (state.GetType() == typeof(Trainers))
        {
            bool hasToTrain = LevelsToTrain.Contains(ObjectManager.Me.Level);
            Logging.WriteDebug("Checking if we have to go to trainer: " + (hasToTrain ? "yes" : "no"));
            if (!hasToTrain)
            {
                cancelable.Cancel = true;
            }
        }
    }

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...