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; using System.Collections.Generic; using System.Linq; public class Main : ICustomClass { public float Range { get { return 4.5f; } } private bool _isLaunched; private ulong _lastTarget; Timer _weaponBuff = new Timer(-1); public void Initialize() // When product started, initialize and launch Fightclass { _isLaunched = true; Logging.Write("[Mars Shaman] has initialized."); Rotation(); } public void Dispose() // When product stopped { _isLaunched = false; Logging.Write("[Mars Shaman] has been disposed."); } public void ShowConfiguration() // When use click on Fight class settings { MessageBox.Show("[Mars Shaman] current has no settings."); } // SPELLS: // Buff: public Spell Rockbiter = new Spell("Rockbiter Weapon"); // Pull: public Spell LightningBolt = new Spell("Lightning Bolt"); // Totems: public Spell StoneClaw = new Spell("Stoneclaw Totem"); public Spell Searing = new Spell("Searing Totem"); public Spell FireNova = new Spell("Fire Nova Totem"); // Combat: public Spell Attack = new Spell("Attack"); public Spell Earthshock = new Spell("Earth Shock"); public Spell Berserking = new Spell("Berserking"); // Healing: public Spell HealingWave = new Spell("Healing Wave"); public Spell CureDisease = new Spell("Cure Disease"); public Spell CurePoison = new Spell("Cure Poison"); internal void Rotation() { Logging.Write("[Mars Shaman] has been 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("[Mars Shaman] ERROR: " + e); } Thread.Sleep(10); // Pause 10 ms to reduce the CPU usage. } Logging.Write("[Mars Shaman] has been stopped."); } internal void BuffRotation() { // Rockbiter Weapon: if (_weaponBuff.IsReady) { Rockbiter.Launch(); _weaponBuff = new Timer(300000); } } internal void Pull() { if (ObjectManager.Me.Target == _lastTarget) return; // Lightning Bolt: if (LightningBolt.KnownSpell && LightningBolt.IsSpellUsable && LightningBolt.IsDistanceGood && ObjectManager.Target.Target != ObjectManager.Me.Guid) { LightningBolt.Launch(); _lastTarget = ObjectManager.Me.Target; } } internal void CombatRotation() { // Stoneclaw Totem: When 2 or more units are attacking the player if (StoneClaw.IsSpellUsable && ObjectManager.GetUnitAttackPlayer().Count >= 2) { StoneClaw.Launch(); return; } // Healing Wave: When below a certain health percentage if (HealingWave.IsSpellUsable && HealingWave.KnownSpell && ObjectManager.Me.HealthPercent < 30) { HealingWave.Launch(); return; } // Berserking: if (Berserking.IsSpellUsable && ObjectManager.GetUnitAttackPlayer().Count >= 2) { Berserking.Launch(); return; } // Cure Disease: if (CureDisease.IsSpellUsable && Lua.LuaDoString(@" for i=1,25 do local _, _, _, _, d = UnitDebuff('player',i); if d == 'Disease' then return true end end")) { CureDisease.Launch(); } // cure poison: if (CurePoison.IsSpellUsable && Lua.LuaDoString(@" for i=1,25 do local _, _, _, _, d = UnitDebuff('player',i); if d == 'Poison' then return true end end")) { CurePoison.Launch(); } // Earth Shock: When the player has above a certain amount of mana if (Earthshock.IsSpellUsable && Earthshock.IsDistanceGood && Earthshock.KnownSpell && ObjectManager.Me.ManaPercentage > 50) { Earthshock.Launch(); return; } // Fire Nova Totem: if (FireNova.IsSpellUsable && ObjectManager.GetUnitAttackPlayer().Count >= 3 && ObjectManager.Me.ManaPercentage > 50) { FireNova.Launch(); return; } // Searing Totem: if (Searing.IsSpellUsable && !(ObjectManager.GetObjectWoWUnit().Where(o => o.IsMyPet && o.GetDistance < 20 && o.Name.Contains("Searing Totem")).FirstOrDefault() != null)) { Searing.Launch(); return; } // Lightning Bolt: When the player has above a certain amount of mana if (LightningBolt.IsSpellUsable && LightningBolt.IsDistanceGood && LightningBolt.KnownSpell && ObjectManager.Me.ManaPercentage > 30 && ObjectManager.Target.GetDistance > 5) { LightningBolt.Launch(); return; } // Attack: When there is nothing else to do if (!Lua.LuaDoString("return IsAutoRepeatAction(" + (SpellManager.GetSpellSlotId(SpellListManager.SpellIdByName("Attack"))) + ")")) { SpellManager.CastSpellByNameLUA("Attack"); return; } /////////////////////////////// TESTING - Code snippets can be copy pasted into the Tools->Develeopment Tools window and run by selecting c# button, output will be in the log. //foreach (var Aura in BuffManager.GetDebuff(ObjectManager.Me.GetBaseAddress)) //{ // Logging.Write(SpellManager.GetSpellInfo(Aura.SpellId).ToString()); // Logging.Write(Aura.SpellId.ToString()); //} //Logging.Write(MovementManager.InMovement.ToString()); //foreach (var step in MovementManager.CurrentPath) //{ // Logging.Write(step.x); //} //Logging.Write((ObjectManager.GetObjectWoWUnit().Where(o => o.IsMyPet && o.GetDistance < 30 && o.Name.Contains("totem")).FirstOrDefault() != null).ToString()); //Logging.Write((ObjectManager.GetObjectWoWUnit().Where(o => o.IsMyPet && o.GetDistance < 30 && o.Name.Contains("Totem")).FirstOrDefault() != null).ToString()); //Logging.Write(Lua.LuaDoString(@" // for i=1,25 do // local _, _, _, _, d = UnitDebuff('player',i); // if d == 'Poison' then // return true // end //end").ToString()); } }