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;
}
}
}
}
}