How to create an Fight Class (developer only)
Fight class using bot API. He is recommanded to use visual studio 12 with framework 4.5 for create an Fight class (add in reference robotManager.dll and wManager.dll).
WRobot supporting C#, Vb.net code, and dll. Sample C# Fight Class for Hunter: (Finite State Machine (Engine)) ( http://pastebin.com/ywQ2VPGr )
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Threading;
using robotManager;
using robotManager.FiniteStateMachine;
using robotManager.Helpful;
using wManager.Wow.Class;
using wManager.Wow.Helpers;
using wManager.Wow.ObjectManager;
using Timer = robotManager.Helpful.Timer;
public class Main : ICustomClass
{
public float Range { get { return 36; } }
private Engine _engine;
public void Initialize()
{
HunterSettings.Load();
_engine = new Engine(false)
{
States = new List<State>
{
// Pet
new PetManager { Priority = 20 },
// Defensive
new SpellState("Freezing Trap", 13,
context => (ObjectManager.GetUnitAttackPlayer().Count(u => u.GetDistance <= 8) >= 1 && ObjectManager.GetUnitAttackPlayer().Count > 1)),
new SpellState("Disengage", 21,
context => (ObjectManager.GetUnitAttackPlayer().Count(u => u.GetDistance <= 8) >= 1)),
// Attac multi
new SpellState("Multi-Shot", 14,
context => (ObjectManager.GetUnitAttackPlayer().Count() > 1)),
new SpellState("Explosive Trap", 14,
context => (ObjectManager.GetUnitAttackPlayer().Count(u => u.GetDistance <= 8) > 1)),
// Attac
new SpellState("Hunter's Mark", 15,
context => (!ObjectManager.Target.HaveBuff("Hunter's Mark"))),
new SpellState("Stampede", 13, context => HunterSettings.CurrentSetting.Stampede),
new SpellState("Rapid Fire", 12, context => HunterSettings.CurrentSetting.RapidFire),
new SpellState("Kill Shot", 11, context => true),
new SpellState("Blink Strike", 10, context => HunterSettings.CurrentSetting.BlinkStrike),
new SpellState("Serpent Sting", 9, context => ObjectManager.Me.Focus > 30 && !ObjectManager.Target.HaveBuff("Serpent Sting")),
new SpellState("Kill Command", 8, context => ObjectManager.Pet.IsValid && ObjectManager.Pet.IsAlive && ObjectManager.Pet.Position.DistanceTo2D(ObjectManager.Target.Position) < 25),
new SpellState("Bestial Wrath", 7, context => true),
new SpellState("Dire Beast", 6, context => HunterSettings.CurrentSetting.DireBeast),
new SpellState("Arcane Shot", 5, context => ObjectManager.Me.Focus > 30),
new SpellState("Cobra Shot", 4, context => ObjectManager.Me.Focus < 25),
new SpellState("Readiness", 3, context => HunterSettings.CurrentSetting.Readiness),
}
};
_engine.StartEngine(5);
}
public void Dispose()
{
if (_engine != null)
{
_engine.StopEngine();
_engine.States.Clear();
}
}
public void ShowConfiguration()
{
HunterSettings.Load();
HunterSettings.CurrentSetting.ToForm();
HunterSettings.CurrentSetting.Save();
}
class PetManager : State
{
public override int Priority { get; set; }
public override string DisplayName
{
get { return "Pet Manager"; }
}
Timer _petTimer = new Timer(-1);
public override bool NeedToRun
{
get
{
if (!_petTimer.IsReady)
return false;
if (ObjectManager.Me.IsDeadMe || ObjectManager.Me.IsMounted)
{
_petTimer = new Timer(1000 * 2);
return false;
}
if (!ObjectManager.Pet.IsValid || ObjectManager.Pet.IsDead)
return true;
return false;
}
}
public override List<State> NextStates
{
get { return new List<State>(); }
}
public override List<State> BeforeStates
{
get { return new List<State>(); }
}
private readonly Spell _revivePet = new Spell("Revive Pet");
private readonly Spell _callPet = new Spell("Call Pet 1");
public override void Run()
{
if (!ObjectManager.Pet.IsValid)
{
_callPet.Launch(true);
Thread.Sleep(Usefuls.Latency + 1000);
}
if (!ObjectManager.Pet.IsValid || ObjectManager.Pet.IsDead)
_revivePet.Launch(true);
_petTimer = new Timer(1000 * 2);
}
}
}
[Serializable]
public class HunterSettings : Settings
{
[Setting]
[DefaultValue(false)]
[Category("Beast Mastery")]
[DisplayName("Rapid Fire")]
[Description("Use Rapid Fire")]
public bool RapidFire { get; set; }
[Setting]
[DefaultValue(false)]
[Category("Beast Mastery")]
[DisplayName("Stampede")]
[Description("Use Stampede")]
public bool Stampede { get; set; }
[Setting]
[DefaultValue(false)]
[Category("Beast Mastery")]
[DisplayName("Dire Beast")]
[Description("Use Dire Beast")]
public bool DireBeast { get; set; }
[Setting]
[DefaultValue(false)]
[Category("Beast Mastery")]
[DisplayName("Readiness")]
[Description("Use Readiness")]
public bool Readiness { get; set; }
[Setting]
[DefaultValue(false)]
[Category("Beast Mastery")]
[DisplayName("Blink Strike")]
[Description("Use Blink Strike")]
public bool BlinkStrike { get; set; }
private HunterSettings()
{
ConfigWinForm(new System.Drawing.Point(400, 400), "Hunter " + Translate.Get("Settings"));
}
public static HunterSettings CurrentSetting { get; set; }
public bool Save()
{
try
{
return Save(AdviserFilePathAndName("CustomClass-Hunter", ObjectManager.Me.Name + "." + Usefuls.RealmName));
}
catch (Exception e)
{
Logging.WriteError("HunterSettings > Save(): " + e);
return false;
}
}
public static bool Load()
{
try
{
if (File.Exists(AdviserFilePathAndName("CustomClass-Hunter", ObjectManager.Me.Name + "." + Usefuls.RealmName)))
{
CurrentSetting =
Load<HunterSettings>(AdviserFilePathAndName("CustomClass-Hunter",
ObjectManager.Me.Name + "." + Usefuls.RealmName));
return true;
}
CurrentSetting = new HunterSettings();
}
catch (Exception e)
{
Logging.WriteError("HunterSettings > Load(): " + e);
}
return false;
}
}
Another C# Fight Class structure: ( http://pastebin.com/krBv3QCD )
using System;
using System.Threading;
using System.Windows.Forms;
using robotManager.Helpful;
using robotManager.Products;
using wManager.Wow.Class;
using wManager.Wow.Enums;
using wManager.Wow.Helpers;
using wManager.Wow.ObjectManager;
using Timer = robotManager.Helpful.Timer;
public class Main : ICustomClass
{
public float Range { get { return 4.5f; } }
private bool _isLaunched;
private ulong _lastTarget;
public void Initialize() // When product started, initialize and launch Fightclass
{
_isLaunched = true;
Logging.Write("[My fightclass] Is initialized.");
Rotation();
}
public void Dispose() // When product stopped
{
_isLaunched = false;
Logging.Write("[My fightclass] Stop in progress.");
}
public void ShowConfiguration() // When use click on Fight class settings
{
MessageBox.Show("[My fightclass] No setting for this Fight Class.");
}
// SPELLS:
// Buff:
public Spell DeadlyPoison = new Spell("Deadly Poison");
public Spell Sprint = new Spell("Sprint");
// Pull:
public Spell Stealth = new Spell("Stealth");
// Combat:
public Spell Garrote = new Spell("Garrote");
public Spell SliceandDice = new Spell("Slice and Dice");
public Spell Eviscerate = new Spell("Eviscerate");
public Timer SliceandDiceTimer = new Timer(); // Timer
internal void Rotation()
{
Logging.Write("[My fightclass] Is started.");
while (_isLaunched)
{
try
{
if (!Products.InPause)
{
if (!ObjectManager.Me.IsDeadMe)
{
BuffRotation();
if (Fight.InFight && ObjectManager.Me.Target > 0)
{
Pull();
CombatRotation();
}
}
}
}
catch (Exception e)
{
Logging.WriteError("[My fightclass] ERROR: " + e);
}
Thread.Sleep(10); // Pause 10 ms to reduce the CPU usage.
}
Logging.Write("[My fightclass] Is now stopped.");
}
internal void BuffRotation()
{
if (ObjectManager.Me.IsMounted)
return;
// Deadly Poison:
if (DeadlyPoison.KnownSpell && !DeadlyPoison.HaveBuff && DeadlyPoison.IsSpellUsable && !ObjectManager.Me.GetMove)
{
DeadlyPoison.Launch();
return;
}
// Sprint
if (Sprint.KnownSpell && !ObjectManager.Me.InCombat && ObjectManager.Me.GetMove && Sprint.IsSpellUsable)
{
Sprint.Launch();
return;
}
}
internal void Pull()
{
if (ObjectManager.Me.Target == _lastTarget)
return;
// Stealth:
if (Stealth.KnownSpell && Stealth.IsSpellUsable && !Stealth.HaveBuff && ObjectManager.Target.Target != ObjectManager.Me.Guid)
{
Stealth.Launch();
_lastTarget = ObjectManager.Me.Target;
}
}
internal void CombatRotation()
{
// Garrote:
if (Garrote.IsSpellUsable && Garrote.IsDistanceGood && Garrote.KnownSpell && ObjectManager.Me.HaveBuff(115192))
{
Garrote.Launch();
return;
}
// Eviscerate:
if (Eviscerate.KnownSpell && Eviscerate.IsSpellUsable && Eviscerate.IsDistanceGood && (ObjectManager.Me.ComboPoint > 4 || (SliceandDice.HaveBuff && SliceandDiceTimer.IsReady)))
{
Eviscerate.Launch();
if (SliceandDice.HaveBuff)
SliceandDiceTimer = new Timer(1000 * 36);
return;
}
}
}
Sample Vb.net Fight Class base: ( http://pastebin.com/EETxYYi3 )
Imports System.Collections.Generic
Imports System.Linq
Imports System.Threading
Imports robotManager.FiniteStateMachine
Imports robotManager.Helpful
Imports wManager.Wow.Class
Imports wManager.Wow.Helpers
Imports wManager.Wow.ObjectManager
Public Class Main
Implements ICustomClass
Public ReadOnly Property Range As Single Implements ICustomClass.Range
Get
Return 5
End Get
End Property
Public Sub Initialize() Implements ICustomClass.Initialize
End Sub
Public Sub Dispose() Implements ICustomClass.Dispose
End Sub
Public Sub ShowConfiguration() Implements ICustomClass.ShowConfiguration
End Sub
End Class
Sample DLL:
Only create class Main (implement ICustomClass) without namespace in your dll.