using System;
using System.Windows.Forms;
using System.Threading;
using System.Collections.Generic;
using System.Linq;
using ArcheBuddy.Bot.Classes;
namespace sintal1ty
{
public class Fisher: Core
{
protected Dictionary <string, string> actions;
public static string GetPluginAuthor (){
return "sintal1ty";
}
public static string GetPluginVersion (){
return "1.0.0.0";
}
public static string GetPluginDescription (){
return "Sports Fishing";
}
public Fisher () : base (){
actions = new Dictionary <string, string> (){
{"Moving to the Left", "Stand Firm Left"},
{"Moving to the Right", "Stand Firm Right"},
{"Escape", "Give Slack"},
{"Move to the Bottom", "Reel In"},
{"Leap", "Big Reel In"}
};
}
protected void Wait (){
while (me.target == null || (me.target.target != null && me.target.target != me) || getBuff (me.target, "Strength Contest") == null){
// If I have no target or it isn't targeting me or my target does not have Strength Contest buff we wait. 100msec
Thread.Sleep (100);
}
// Check to see if my target is valid and is not attackable.
}
protected void Stopper (){
Buff check;
while (true){
Wait ();
check = getBuff (me.target, "Tension"); // Fetch buff "Tension" 1 time
if (check != null && isCasting ()){
Thread.Sleep (500); // Lets wait to see if Tension is still there. (Sometimes it takes a half a second to disappear even though we are casting the right spell.(due to proc delay in game))
check = getBuff (me.target, "Tension"); // // Fetch buff "Tension" 2nd Time
if (check != null && isCasting ()){
CancelSkill (); // Tension buff detected twice lets cancel
Log ("Cancel");
Thread.Sleep (250);
}
}
Thread.Sleep (100);
}
}
public void PluginRun (){
Thread stopper = new Thread (Stopper); // Stream check for Tension debuff
stopper.Start ();
String oldSkill = null;
while (true){
Wait ();
String skill = null;
// Select the corresponding response to the fish's buffs
foreach (Buff enBuff in me.target.getBuffs ()){
if (actions.ContainsKey (enBuff.name)){
skill = actions [enBuff.name];
break;
}
}
if (skill != oldSkill){ // Checks to see if the corresponding skill changed from the last one.
CancelSkill (); // Cancel 1 time
Thread.Sleep (50);
CancelSkill (); // Cancel 2 time ( Don't know why but this works everytime if called twice.)
Log ("Buff Action Changed - Cancel Casting");
Thread.Sleep(50);
}
// Lets cast if we have a corresponding skill matched
if (! isCasting () && skill != null){
if (! isGliding ()){
TurnDirectly (); // Face the fish
}
Log ("Used: " + skill);
UseSkill (skill, true);
oldSkill = skill;
}
Thread.Sleep (100);
}
}
}
}