Advertisement
Guest User

Untitled

a guest
Mar 15th, 2014
677
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.83 KB | None | 0 0
  1. using System;
  2. using System.Threading;
  3. using System.Windows.Forms;
  4. using robotManager.Helpful;
  5. using robotManager.Products;
  6. using wManager.Wow.Class;
  7. using wManager.Wow.Enums;
  8. using wManager.Wow.Helpers;
  9. using wManager.Wow.ObjectManager;
  10. using Timer = robotManager.Helpful.Timer;
  11.  
  12. public class Main : ICustomClass
  13. {
  14.     public float Range { get { return 4.5f; } }
  15.  
  16.     private bool _isLaunched;
  17.     private ulong _lastTarget;
  18.  
  19.     public void Initialize() // When product started, initialize and launch Fightclass
  20.     {
  21.         _isLaunched = true;
  22.         Logging.Write("[My fightclass] Is initialized.");
  23.         Rotation();
  24.     }
  25.  
  26.     public void Dispose() // When product stopped
  27.     {
  28.         _isLaunched = false;
  29.         Logging.Write("[My fightclass] Stop in progress.");
  30.     }
  31.  
  32.     public void ShowConfiguration() // When use click on Fight class settings
  33.     {
  34.         MessageBox.Show("[My fightclass] No setting for this Fight Class.");
  35.     }
  36.  
  37.  
  38.     // SPELLS:
  39.     // Buff:
  40.     public Spell DeadlyPoison = new Spell("Deadly Poison");
  41.     public Spell Sprint = new Spell("Sprint");
  42.     // Pull:
  43.     public Spell Stealth = new Spell("Stealth");
  44.     // Combat:
  45.     public Spell Garrote = new Spell("Garrote");
  46.     public Spell SliceandDice = new Spell("Slice and Dice");
  47.     public Spell Eviscerate = new Spell("Eviscerate");
  48.     public Timer SliceandDiceTimer = new Timer(); // Timer
  49.  
  50.     internal void Rotation()
  51.     {
  52.         Logging.Write("[My fightclass] Is started.");
  53.         while (_isLaunched)
  54.         {
  55.             try
  56.             {
  57.                 if (!Products.InPause)
  58.                 {
  59.                     if (!ObjectManager.Me.IsDeadMe)
  60.                     {
  61.                         BuffRotation();
  62.  
  63.                         if (Fight.InFight && ObjectManager.Me.Target > 0)
  64.                         {
  65.                             Pull();
  66.                             CombatRotation();
  67.                         }
  68.                     }
  69.                 }
  70.             }
  71.             catch (Exception e)
  72.             {
  73.                 Logging.WriteError("[My fightclass] ERROR: " + e);
  74.             }
  75.  
  76.             Thread.Sleep(10); // Pause 10 ms to reduce the CPU usage.
  77.         }
  78.         Logging.Write("[My fightclass] Is now stopped.");
  79.     }
  80.  
  81.     internal void BuffRotation()
  82.     {
  83.         if (ObjectManager.Me.IsMounted)
  84.             return;
  85.  
  86.         // Deadly Poison:
  87.         if (DeadlyPoison.KnownSpell && !DeadlyPoison.HaveBuff && DeadlyPoison.IsSpellUsable && !ObjectManager.Me.GetMove)
  88.         {
  89.             DeadlyPoison.Launch();
  90.             return;
  91.         }
  92.         // Sprint
  93.         if (Sprint.KnownSpell && !ObjectManager.Me.InCombat && ObjectManager.Me.GetMove && Sprint.IsSpellUsable)
  94.         {
  95.             Sprint.Launch();
  96.             return;
  97.         }
  98.     }
  99.     internal void Pull()
  100.     {
  101.         if (ObjectManager.Me.Target == _lastTarget)
  102.             return;
  103.  
  104.         // Stealth:
  105.         if (Stealth.KnownSpell && Stealth.IsSpellUsable && !Stealth.HaveBuff && ObjectManager.Target.Target != ObjectManager.Me.Guid)
  106.         {
  107.             Stealth.Launch();
  108.             _lastTarget = ObjectManager.Me.Target;
  109.         }
  110.     }
  111.  
  112.     internal void CombatRotation()
  113.     {
  114.         // Garrote:
  115.         if (Garrote.IsSpellUsable && Garrote.IsDistanceGood && Garrote.KnownSpell && ObjectManager.Me.HaveBuff(115192))
  116.         {
  117.             Garrote.Launch();
  118.             return;
  119.         }
  120.         // Eviscerate:
  121.         if (Eviscerate.KnownSpell && Eviscerate.IsSpellUsable && Eviscerate.IsDistanceGood && (ObjectManager.Me.ComboPoint > 4 || (SliceandDice.HaveBuff && SliceandDiceTimer.IsReady)))
  122.         {
  123.             Eviscerate.Launch();
  124.             if (SliceandDice.HaveBuff)
  125.                 SliceandDiceTimer = new Timer(1000 * 36);
  126.             return;
  127.         }
  128.     }
  129. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement