What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

Zone swapping

CHDA80

Member
Joined
Jun 13, 2012
Messages
92
Reaction score
0
Is there a way to have the bot automatically switch to the next area when the current on is complete?
 
There's no way through the gui yet, because the bot was initially created only to grind one area. We will be updating the bot to do this later though.

However, for now, you can use a plugin to change the area. Here's an example:

GrindZoneChanger
Code:
using System;
using log4net;
using Loki.Bot.Logic;
using Loki.Bot.Logic.Bots.Grind;
using Loki.Utilities;
using Loki.Utilities.Plugins;

namespace GrindZoneChanger
{
    /// <summary> </summary>
    public class GrindZoneChanger
 : IPlugin
    {
        #region Implementation of IEquatable<IPlugin>

        /// <summary>
        ///     Indicates whether the current object is equal to another object of the same type.
        /// </summary>
        /// <returns>
        ///     true if the current object is equal to the <paramref name="other" /> parameter; otherwise, false.
        /// </returns>
        /// <param name="other">An object to compare with this object.</param>
        public bool Equals(IPlugin other)
        {
            return Name.Equals(other.Name);
        }

        #endregion

        private static readonly ILog Log = Logger.GetLoggerInstanceForType();

        #region Implementation of IPlugin

        /// <summary> </summary>
        public string Author { get { return "pushedx"; } }

        /// <summary> </summary>
        public Version Version { get { return new Version(0, 1, 0, 0); } }

        /// <summary> </summary>
        public string Name { get { return "GrindZoneChanger"; } }

        /// <summary> </summary>
        public string Description { get { return "This plugin shows how to use the experimental grind zone changing logic."; } }

        /// <summary> Executes the start action. This is called when the bot starts. </summary>
        public void OnStart()
        {
        }

        /// <summary> Executes the stop action. This is called when the bot is stopped. </summary>
        public void OnStop()
        {
        }

        /// <summary> Executes the pulse action. This is called every "tick" of the bot. </summary>
        public void OnPulse()
        {
        }

        /// <summary>
        ///     Executes the initialize action. This is called at initial bot startup. (When the bot itself is started, not
        ///     when Start() is called)
        /// </summary>
        public void OnInitialize()
        {
        }

        /// <summary> Executes the shutdown action. This is called when the bot is shutting down. (Not when Stop() is called) </summary>
        public void OnShutdown()
        {
        }

        /// <summary> Executes the enabled action. This is called when the user has enabled this specific plugin via the GUI. </summary>
        public void OnEnabled()
        {
            // Use our specific runetime 
            Registry.UserGetGrindZoneId = new MyGetGrindZoneId();
            Registry.DontUseSmartLedgeFarming = true;
        }

        /// <summary> Executes the disabled action. This is called whent he user has disabled this specific plugin via the GUI. </summary>
        public void OnDisabled()
        {
            // Restore the default settings.
            Registry.UserGetGrindZoneId = null;
            Registry.DontUseSmartLedgeFarming = false;
        }

        /// <summary> Executes the config action. This is called when the user clicks on the config button.</summary>
        public void OnConfig()
        {
        }

        #endregion

        /// <summary>
        /// An example grind zone changing plugin implementation. 
        /// </summary>
        internal class MyGetGrindZoneId : IGetGrindZoneId
        {
            private string _grindZoneId;

            private int _index;

            public MyGetGrindZoneId()
            {
                _grindZoneId = GrindBotSettings.Instance.GrindZoneId;
            }

            public string GetGrindZoneId()
            {
                return _grindZoneId;
            }

            public void DetermineNextGrindZone()
            {
                // You can setup how you want to change things. Whether it's in a cycle like this,
                // # of runs per area (you'd need to track that yourself) etc...

                // The bot would grind from:
                // GrindBotSettings.Instance.GrindZoneId -> Mud Flats -> Coves -> Ledge in this example.
                // Use the grind area settings gui in the bot to get the id of areas.

                if (_index == 0)
                {
                    _grindZoneId = "1_1_3"; // Mud Flats normal
                    ++_index;
                }
                else if (_index == 1)
                {
                    _grindZoneId = "1_1_10"; // The Coves normal
                    ++_index;
                }
                else if (_index == 2)
                {
                    _grindZoneId = "1_1_5"; // The Ledge normal
                    _index = 0;
                }
            }
        }
    }
}

This was just a small work around added to allow the bot to do it in the mean time. You'd create a new folder in your Plugins directory, create a cs file with that code, then change it as needed. Enable the plugin through the bot gui itself, and it should be working.
 
Back
Top