using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Threading; using LavishVMAPI; using LavishScriptAPI; using ISXWoW; namespace AutoRogue { public partial class Form1 : Form { enum RogueSpells { Shiv, SinisterStrike, SliceAndDice, Garrote, Rupture, Stealth, Evasion, Vanish, AdrenalineRush, BladeFlurry, None }; Dictionary spellBook = new Dictionary(); RogueSpells nextSpell = RogueSpells.None; ISXWoW.ISXWoW isxwow = new ISXWoW.ISXWoW(); FrameLockManager flm = new FrameLockManager(); public Form1() { InitializeComponent(); flm.Lock(); spellBook.Add(RogueSpells.Shiv, WoWSpell.Get("Shiv")); spellBook.Add(RogueSpells.SinisterStrike, WoWSpell.Get("Sinister Strike")); spellBook.Add(RogueSpells.SliceAndDice, WoWSpell.Get("Slice and Dice")); spellBook.Add(RogueSpells.Garrote, WoWSpell.Get("Garrote")); spellBook.Add(RogueSpells.Rupture, WoWSpell.Get("Rupture")); spellBook.Add(RogueSpells.Stealth, WoWSpell.Get("Stealth")); spellBook.Add(RogueSpells.Evasion, WoWSpell.Get("Evasion")); spellBook.Add(RogueSpells.Vanish, WoWSpell.Get("Vanish")); spellBook.Add(RogueSpells.AdrenalineRush, WoWSpell.Get("Adrenaline Rush")); spellBook.Add(RogueSpells.BladeFlurry, WoWSpell.Get("Blade Flurry")); flm.Unlock(); } private void button1_Click(object sender, EventArgs e) { Thread AutoRogue = new Thread(Rogue); AutoRogue.Start(); } private bool HasBuff(string name) { flm.Lock(); bool isValid = isxwow.Me.Buff(name).IsValid; flm.Unlock(); return isValid; } private bool CanCast(RogueSpells spell) { flm.Lock(); if (spellBook[spell].IsValid && spellBook[spell].Cooldown == 0 && !isxwow.Me.IsCasting && isxwow.Me.GlobalCooldown == 0) { if (isxwow.Me.Power >= spellBook[spell].PowerCost && isxwow.Me.CurrentTarget.Distance <= 5) { flm.Unlock(); return true; } } flm.Unlock(); return false; } private bool CastSpell(RogueSpells spell) { if (CanCast(spell)) { return spellBook[spell].Cast(); } return false; } private void UpdateText(string text) { richTextBox1.AppendText("[" + DateTime.Now.ToShortTimeString() + "] " + text + System.Environment.NewLine); } public delegate void UpdateTextCallback(string text); private RogueSpells ChooseNextAttack() { flm.Lock(); WoWBuff poison = isxwow.Me.CurrentTarget.Buff("Deadly Poison"); WoWBuff rupture = isxwow.Me.CurrentTarget.Buff("Rupture"); flm.Unlock(); flm.Lock(); // stealth if possible if (!HasBuff("Stealth") && !isxwow.Me.IsInCombat) { return RogueSpells.Stealth; } // opener if (HasBuff("Stealth")) { return RogueSpells.Garrote; } // normal combat rotation - 4s/5r snd cut, cause not enough hit for 3s/5r snd cut if (!HasBuff("Stealth") && isxwow.Me.IsInCombat) { if (isxwow.Me.HealthPercent < 35) { return RogueSpells.Evasion; } if (isxwow.Me.Power <= 30 && CanCast(RogueSpells.AdrenalineRush)) { return RogueSpells.AdrenalineRush; } if (!HasBuff("Slice and Dice") && isxwow.Me.ComboPoints >= 1) // keep snd up at all costs { return RogueSpells.SliceAndDice; } if (CanCast(RogueSpells.BladeFlurry)) { return RogueSpells.BladeFlurry; } if (isxwow.Me.ComboPoints == 5 && isxwow.Me.Power > 70 && !rupture.IsValid) // rupture as 5cp finisher { return RogueSpells.Rupture; } if (!poison.IsValid) // shiv if no DP debuff { return RogueSpells.Shiv; } if (poison.Duration < 4) // DP is about to run out { return RogueSpells.Shiv; } if (isxwow.Me.ComboPoints < 5) // main spell to build up cp's with { return RogueSpells.SinisterStrike; } } return RogueSpells.None; } private void Rogue() { flm.Lock(); GuidList theBoss = GuidList.New("-units", "-worldboss"); flm.Unlock(); // buff weapons // to be done later // combat loop while (true) { nextSpell = ChooseNextAttack(); if (isxwow.Me.CurrentTarget.Dead && !isxwow.Me.IsInCombat) { break; } if (nextSpell != RogueSpells.None) if (CastSpell(nextSpell)) richTextBox1.BeginInvoke(new UpdateTextCallback(this.UpdateText), new object[] { "Casting: " + spellBook[nextSpell].Name }); flm.Unlock(); Thread.Sleep(100); } flm.Unlock(); } } }