using System.Windows.Controls;
using log4net;
using Loki.Bot;
using System;
using Loki.Bot.Logic.Bots.BasicGrindBot;
using Loki.Utilities;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Markup;
using Loki.Bot.v3;
using Loki.Game;
using Loki.Game.Objects;
namespace GrindZoneChanger
{
internal class GrindZoneChanger : IPlugin
{
private static readonly ILog Log = Logger.GetLoggerInstanceForType();
private bool _enabled;
#region Implementation of IPlugin
/// <summary> The name of the plugin. </summary>
public string Name
{
get { return "GrindZoneChanger"; }
}
/// <summary> The description of the plugin. </summary>
public string Description
{
get { return "A plugin example showing how to change the grind zone when exploration has been completed. Users need to implement custom logic and change the code for this to work as they want."; }
}
/// <summary>The author of the plugin.</summary>
public string Author
{
get { return "Bossland GmbH"; }
}
/// <summary>The version of the plugin.</summary>
public Version Version
{
get { return new Version(0, 0, 1, 1); }
}
/// <summary>Initializes this plugin.</summary>
public void Initialize()
{
Log.DebugFormat("[GrindZoneChanger] Initialize");
}
/// <summary> The plugin start callback. Do any initialization here. </summary>
public void Start()
{
Log.DebugFormat("[GrindZoneChanger] Start");
ExplorationCompleteTask.Completed += ExplorationCompleteTaskOnCompleted;
}
/// <summary> The plugin tick callback. Do any update logic here. </summary>
public void Tick()
{
}
/// <summary> The plugin stop callback. Do any pre-dispose cleanup here. </summary>
public void Stop()
{
Log.DebugFormat("[GrindZoneChanger] Stop");
ExplorationCompleteTask.Completed -= ExplorationCompleteTaskOnCompleted;
}
public JsonSettings Settings
{
get { return null; }
}
/// <summary> The plugin's settings control. This will be added to the Exilebuddy Settings tab.</summary>
public UserControl Control
{
get { return null; }
}
/// <summary>Is this plugin currently enabled?</summary>
public bool IsEnabled
{
get { return _enabled; }
}
/// <summary> The plugin is being enabled.</summary>
public void Enable()
{
Log.DebugFormat("[GrindZoneChanger] Enable");
_enabled = true;
}
/// <summary> The plugin is being disabled.</summary>
public void Disable()
{
Log.DebugFormat("[GrindZoneChanger] Disable");
_enabled = false;
}
#endregion
#region Implementation of IDisposable
/// <summary> </summary>
public void Dispose()
{
}
#endregion
#region Override of Object
/// <summary>
///
/// </summary>
/// <returns></returns>
public override string ToString()
{
return Name + ": " + Description;
}
#endregion
private void ExplorationCompleteTaskOnCompleted(object sender, ExplorationCompleteTask.ExplorationCompleteEventArgs explorationCompleteEventArgs)
{
var Piety = LokiPoe.ObjectManager.GetObjectByName<Monster>("Piety");
if (Piety == null || Piety != null && Piety.IsDead)
{
var roll = Utility.Random.Next(0, 3);
string name = "";
switch (roll)
{
case 0:
name = "The Lunaris Temple Level 3";
break;
case 1:
name = "The Library";
break;
case 2:
name = "The Catacombs";
break;
}
Log.InfoFormat("[GrindZoneChanger] New grind zone being set to {0}.", name);
BasicGrindBotSettings.Instance.GrindZoneName = name;
}
}
}
}