Ejemplo n.º 1
0
 private void reloadAddonToolStripMenuItem_Click(object sender, EventArgs e)
 {
     WoW.SendMacro("/reload");
 }
Ejemplo n.º 2
0
        public override void Pulse()
        {
            if (combatRoutine.Type == RotationType.SingleTarget)
            {
                //Heal if not in combat
                if (!WoW.IsInCombat && WoW.HealthPercent <= 95 & WoW.Energy >= 30 && !WoW.PlayerIsCasting && !WoW.PlayerIsChanneling)
                {
                    WoW.SendMacro("/cast [@player] Effuse");
                    return;
                }

                //Sanity Checks
                if (WoW.PlayerIsChanneling)
                {
                    return;
                }
                if (!WoW.HasTarget)
                {
                    return;
                }
                if (!WoW.TargetIsEnemy)
                {
                    return;
                }
                if (WoW.PlayerIsCasting)
                {
                    return;
                }
                if (!WoW.IsInCombat)
                {
                    return;
                }
            }


            //Cooldown saves
            if (WoW.HealthPercent <= 85 && WoW.PlayerSpellCharges("Healing Elixir") > 0 && !WoW.IsSpellOnCooldown("Healing Elixir"))
            {
                WoW.CastSpell("Healing Elixir");
                return;
            }

            //Interrupts or Damage negation
            if (WoW.TargetIsCasting && WoW.CanCast("Spear Hand Strike") && !WoW.IsSpellOnCooldown("Spear Hand Strike") && WoW.IsSpellInRange("Spear Hand Strike"))
            {
                WoW.CastSpell("Spear Hand Strike");
                return;
            }

            //Leg Sweep to open, or mitigate damage
            if (WoW.CanCast("Leg Sweep") && !WoW.IsSpellOnCooldown("Leg Sweep") && WoW.IsSpellInRange("Tiger Palm"))
            {
                WoW.CastSpell("Leg Sweep");
                return;
            }

            //Look for Expel Harm Charges.. if 3 and health low then hit
            if (WoW.PlayerSpellCharges("Expel Harm") >= 3 && WoW.HealthPercent <= 75 && WoW.Energy >= 15)
            {
                WoW.CastSpell("Expel Harm");
                return;
            }

            //If Target is almost dead, and we have Expel Harm charges use up -- we don't want to leave it
            if (WoW.TargetHealthPercent <= 10 && WoW.PlayerSpellCharges("Expel Harm") != 100 && WoW.CanCast("Expel Harm") && !WoW.IsSpellOnCooldown("Expel Harm") && WoW.Energy >= 15)
            {
                Log.Write(string.Format("Expel Harm Count {0}", WoW.PlayerSpellCharges("Expel Harm")));
                WoW.CastSpell("Expel Harm");
                return;
            }


            //Maintain Eye of the Tiger
            if (!WoW.PlayerHasBuff("Eye of the Tiger") && !WoW.IsSpellOnCooldown("Tiger Palm") && WoW.IsSpellInRange("Tiger Palm"))
            {
                WoW.CastSpell("Tiger Palm");
                return;
            }


            //Breath of fire if Vulnerable
            if (WoW.TargetHasDebuff("Keg Smash") && !WoW.TargetHasDebuff("Breath of Fire") && WoW.CanCast("Breath of Fire") && !WoW.IsSpellOnCooldown("Breath of Fire"))
            {
                WoW.CastSpell("Breath of Fire");
                return;
            }

            if (!WoW.TargetHasDebuff("Keg Smash") && WoW.CanCast("Keg Smash") && !WoW.IsSpellOnCooldown("Keg Smash") && WoW.Energy >= 40)
            {
                WoW.CastSpell("Keg Smash");
                return;
            }

            //Energy dump if High
            if (WoW.Energy >= 65 && WoW.CanCast("Tiger Palm") && !WoW.IsSpellOnCooldown("Tiger Palm") && WoW.IsSpellInRange("Tiger Palm"))
            {
                WoW.CastSpell("Tiger Palm");
                return;
            }

            //if Ironskin count = 3 and in Melee range (or we cast too early as we approach)

            if (WoW.PlayerSpellCharges("Ironskin Brew") >= 2 && !WoW.PlayerHasBuff("Ironskin Brew") && WoW.IsSpellInRange("Tiger Palm"))
            {
                _ironSkinFired = true;
                WoW.CastSpell("Ironskin Brew");
                return;
            }
            if (_ironSkinFired && !WoW.PlayerHasBuff("Ironskin Brew"))
            {
                _ironSkinFired = false;
                if (WoW.PlayerSpellCharges("Purifying Brew") >= 1)
                {
                    WoW.CastSpell("Purifying Brew");
                    return;
                }
            }

            //if We Can Cast Exploding Keg and in Melee range then do so
            if (WoW.CanCast("Exploding Keg") && !WoW.IsSpellOnCooldown("Exploding Keg") && WoW.IsSpellInRange("Tiger Palm"))
            {
                WoW.SendMacro("/cast [@player] Exploding Keg");
                return;
            }

            //TODO NEED F*****g ability to detect staggers so we can use our spare Purifying Brew here.. We are not
            //Optimized until this behavior exists.  We need to use it, then pop Fortifying Brew


            if (WoW.CanCast("Blackout Strike") && !WoW.IsSpellOnCooldown("Blackout Strike") && WoW.IsSpellInRange("Tiger Palm"))
            {
                WoW.CastSpell("Blackout Strike");
            }

            if (WoW.CanCast("Tiger Palm") && !WoW.IsSpellOnCooldown("Tiger Palm") && WoW.IsSpellInRange("Tiger Palm") && WoW.TargetHasDebuff("Keg Smash"))
            {
                WoW.CastSpell("Tiger Palm");
            }
        }
Ejemplo n.º 3
0
        public static bool GenerateLUAFile(bool reloadUI = true)
        {
            try
            {
                if (!Directory.Exists(AddonPath))
                {
                    Directory.CreateDirectory(AddonPath);
                }

                if (!Directory.Exists(LibBossPath))
                {
                    Directory.CreateDirectory(LibBossPath);
                }

                if (!Directory.Exists(LibStubPath))
                {
                    Directory.CreateDirectory(LibStubPath);
                }

                if (!Directory.Exists(LibRangePath))
                {
                    Directory.CreateDirectory(LibRangePath);
                }

                if (!Directory.Exists(LibRangeStubPath))
                {
                    Directory.CreateDirectory(LibRangeStubPath);
                }

                Log.Write($"Creating Addon from SpellBook, AddonName will be [{AddonName}]...");

                Log.Write($"Creating file: [{AddonName}.toc]", Color.Gray);

                using (var sr = new StreamWriter($"{AddonPath}\\{AddonName}.toc"))
                {
                    //  ## Author: WiNiFiX
                    //  ## Interface: 60200
                    //  ## Title: DoIt
                    //  ## Version: 1.0.0
                    //  ## SavedVariablesPerCharacter: DoItOptions
                    //  DoItBase.lua

                    sr.WriteLine($"## Author: {AddonAuthor.Replace("\r", "").Replace("\n", "")}");

                    sr.WriteLine($"## Interface: {NumericInterfaceVersion}");
                    sr.WriteLine($"## Title: {AddonName.Replace("\r", "").Replace("\n", "")}");
                    sr.WriteLine($"## Version: {Application.ProductVersion}");
                    sr.WriteLine($"## SavedVariablesPerCharacter: {AddonName.Replace("\r", "").Replace("\n", "")}_settings");
                    sr.WriteLine($"{AddonName.Replace("\r", "").Replace("\n", "")}.lua");
                    sr.WriteLine(@"#@no-lib-strip@");
                    sr.WriteLine("BossLib.xml");
                    sr.WriteLine("RangeLib.xml");
                    sr.WriteLine(@"#@end-no-lib-strip@");
                    sr.Close();
                }

                ///////////////////////////////////////////////////////////////////////////////////////////////// BOSS LIB /////////////////////////////////////////

                Log.Write("Creating file: [BossLib.xml]", Color.Gray);

                using (var sr = new StreamWriter($"{AddonPath}\\BossLib.xml"))
                {
                    sr.WriteLine(@"<Ui xmlns=""http://www.blizzard.com/wow/ui/"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xsi:schemaLocation=""http://www.blizzard.com/wow/ui/ ..\FrameXML\UI.xsd"">");
                    sr.WriteLine(@"<Script file=""Boss\LibStub\LibStub.lua""/>");
                    sr.WriteLine(@"<Include file=""Boss\lib.xml""/>");
                    sr.WriteLine(@"</Ui>");
                    sr.Close();
                }

                Log.Write("Creating file: [Boss\\LibBossIDs-1.0.toc]", Color.Gray);

                using (var sr = new StreamWriter($"{LibBossPath}\\LibBossIDs-1.0.toc"))
                {
                    sr.WriteLine(InterfaceVersion.Contains("-")? $"## Interface: {InterfaceVersion.Split('-')[1].Trim()}" : $"## Interface: {InterfaceVersion}");
                    sr.WriteLine("## LoadOnDemand: 1");
                    sr.WriteLine("## Title: Lib: BossIDs-1.0");
                    sr.WriteLine("## A library to provide mobIDs for bosses.");
                    sr.WriteLine("## Author: Elsia");
                    sr.WriteLine("## X-Category: Library");
                    sr.WriteLine("## X-License: Public Domain");
                    sr.WriteLine("## X-Curse-Packaged-Version: r97-release");
                    sr.WriteLine("## X-Curse-Project-Name: LibBossIDs-1.0");
                    sr.WriteLine("## X-Curse-Project-ID: libbossids-1-0");
                    sr.WriteLine("## X-Curse-Repository-ID: wow/libbossids-1-0/mainline");
                    sr.WriteLine("LibStub\\LibStub.lua");
                    sr.WriteLine("lib.xml");
                    sr.Close();
                }

                Log.Write("Creating file: [Boss\\lib.xml]", Color.Gray);

                using (var sr = new StreamWriter($"{AddonPath}\\Boss\\lib.xml"))
                {
                    sr.WriteLine(@"<Ui xmlns=""http://www.blizzard.com/wow/ui/"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xsi:schemaLocation=""http://www.blizzard.com/wow/ui/ ..\FrameXML\UI.xsd"">");
                    sr.WriteLine(@"<Script file=""LibBossIDs-1.0.lua"" />");
                    sr.WriteLine("</Ui>");
                    sr.Close();
                }

                Log.Write("Creating file: [Boss\\LibBossIDs-1.0.lua]", Color.Gray);

                using (var sr = new StreamWriter($"{AddonPath}\\Boss\\LibBossIDs-1.0.lua"))
                {
                    var luaContents1 = AddonLibBoss.LuaContents;
                    sr.WriteLine(luaContents1);
                    sr.Close();
                }

                Log.Write("Creating file: [Boss\\LibStub\\LibStub.lua]", Color.Gray);

                using (var sr = new StreamWriter($"{AddonPath}\\Boss\\LibStub\\LibStub.lua"))
                {
                    var luaContents2 = AddonLibStub.LuaContents;
                    sr.WriteLine(luaContents2);
                    sr.Close();
                }

                ///////////////////////////////////////////////////////////////////////////////////////////////// RANGE LIB /////////////////////////////////////////

                Log.Write("Creating file: [RangeLib.xml]", Color.Gray);

                using (var sr = new StreamWriter($"{AddonPath}\\RangeLib.xml"))
                {
                    sr.WriteLine(@"<Ui xmlns=""http://www.blizzard.com/wow/ui/"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xsi:schemaLocation=""http://www.blizzard.com/wow/ui/ ..\FrameXML\UI.xsd"">");
                    sr.WriteLine(@"<Script file=""Range\LibStub\LibStub.lua""/>");
                    sr.WriteLine(@"<Include file=""Range\lib.xml""/>");
                    sr.WriteLine(@"</Ui>");
                    sr.Close();
                }

                Log.Write("Creating file: [Range\\LibSpellRange - 1.0.toc]", Color.Gray);

                using (var sr = new StreamWriter($"{LibRangePath}\\LibSpellRange-1.0.toc"))
                {
                    sr.WriteLine(InterfaceVersion.Contains("-") ? $"## Interface: {InterfaceVersion.Split('-')[1].Trim()}" : $"## Interface: {InterfaceVersion}");
                    sr.WriteLine("## LoadOnDemand: 1");
                    sr.WriteLine("## Title: Lib: SpellRange-1.0");
                    sr.WriteLine("## Notes: Provides enhanced spell range checking functionality");
                    sr.WriteLine("## Author: Cybeloras of Aerie Peak");
                    sr.WriteLine("## X-Category: Library");
                    sr.WriteLine("## X-License: Public Domain");
                    sr.WriteLine("## X-Curse-Packaged-Version: 1.0.011");
                    sr.WriteLine("## X-Curse-Project-Name: LibSpellRange-1.0");
                    sr.WriteLine("## X-Curse-Project-ID: libspellrange-1-0");
                    sr.WriteLine("## X-Curse-Repository-ID: wow/libspellrange-1-0/mainline");
                    sr.WriteLine("LibStub\\LibStub.lua");
                    sr.WriteLine("lib.xml");
                    sr.Close();
                }

                Log.Write("Creating file: [Range\\lib.xml]", Color.Gray);

                using (var sr = new StreamWriter($"{AddonPath}\\Range\\lib.xml"))
                {
                    sr.WriteLine(@"<Ui xmlns=""http://www.blizzard.com/wow/ui/"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xsi:schemaLocation=""http://www.blizzard.com/wow/ui/ ..\FrameXML\UI.xsd"">");
                    sr.WriteLine(@"<Script file=""LibSpellRange-1.0.lua"" />");
                    sr.WriteLine("</Ui>");
                    sr.Close();
                }

                Log.Write("Creating file: [Range\\LibSpellRange-1.0.lua]", Color.Gray);

                using (var sr = new StreamWriter($"{AddonPath}\\Range\\LibSpellRange-1.0.lua"))
                {
                    var luaContents = AddonLibRange.LuaContents;
                    sr.WriteLine(luaContents);
                    sr.Close();
                }

                Log.Write("Creating file: [Range\\LibStub\\LibStub.lua]", Color.Gray);

                using (var sr = new StreamWriter($"{AddonPath}\\Range\\LibStub\\LibStub.lua"))
                {
                    var luaContents = AddonLibStubRange.LuaContents;
                    sr.WriteLine(luaContents);
                    sr.Close();
                }

                Log.Write($"Creating file: [{AddonName}.lua]", Color.Gray);

                using (var sr = new StreamWriter($"{AddonPath}\\{AddonName}.lua"))
                {
                    //local cooldowns = { --These should be spellIDs for the spell you want to track for cooldowns
                    //    56641,    -- Steadyshot
                    //    3044,     -- Arcane Shot
                    //    34026     -- Kill Command
                    //}

                    var cooldowns = "local cooldowns = { --These should be spellIDs for the spell you want to track for cooldowns" + Environment.NewLine;

                    foreach (var spell in Spells)
                    {
                        if (spell.InternalSpellNo == Spells.Count)  // We are adding the last spell, dont include the comma
                        {
                            cooldowns += $"    {spell.SpellId} \t -- {spell.SpellName}" + Environment.NewLine;
                        }
                        else
                        {
                            cooldowns += $"    {spell.SpellId},\t -- {spell.SpellName}" + Environment.NewLine;
                        }
                    }

                    cooldowns += "}" + Environment.NewLine;

                    sr.Write(cooldowns);

                    var auras = "local buffs = { --These should be auraIDs for the spell you want to track " + Environment.NewLine;

                    foreach (var aura in Auras)
                    {
                        if (aura.InternalAuraNo == Auras.Count)  // We are adding the last aura, dont include the comma
                        {
                            auras += $"    {aura.AuraId} \t -- {aura.AuraName}" + Environment.NewLine;
                        }
                        else
                        {
                            auras += $"    {aura.AuraId},\t -- {aura.AuraName}" + Environment.NewLine;
                        }
                    }

                    auras += "}" + Environment.NewLine;

                    sr.Write(auras);

                    var debuffs = "local debuffs = { --These should be auraIDs for the spell you want to track " + Environment.NewLine;

                    foreach (var aura in Auras)
                    {
                        if (aura.InternalAuraNo == Auras.Count)  // We are adding the last aura, dont include the comma
                        {
                            debuffs += $"    {aura.AuraId} \t -- {aura.AuraName}" + Environment.NewLine;
                        }
                        else
                        {
                            debuffs += $"    {aura.AuraId},\t -- {aura.AuraName}" + Environment.NewLine;
                        }
                    }

                    debuffs += "}" + Environment.NewLine;

                    sr.Write(debuffs);

                    var items = "local items = { --These should be itemIDs for the items you want to track " + Environment.NewLine;

                    foreach (var item in Items)
                    {
                        if (item.ItemId == Items.Count)  // We are adding the last item, dont include the comma
                        {
                            items += $"    {item.ItemId} \t -- {item.ItemName}" + Environment.NewLine;
                        }
                        else
                        {
                            items += $"    {item.ItemId},\t -- {item.ItemName}" + Environment.NewLine;
                        }
                    }

                    items += "}" + Environment.NewLine;

                    sr.Write(items);
                    var directory   = Directory.GetCurrentDirectory() + "\\LUA\\Addon.lua";
                    var luaContents = File.ReadAllText(directory);
                    luaContents = luaContents.Replace("[CloudMagic]", AddonName);

                    sr.WriteLine(luaContents);
                    sr.Close();
                }

                Log.Write("Addon file generated.", Color.Green);

                CustomLua();

                Log.Write($"Make sure that the addon: [{AddonName}] is enabled in your list of WoW Addons or the rotation bot will fail to work", Color.Black);

                if (reloadUI)
                {
                    WoW.SendMacro("/reload");
                }

                return(true);
            }
            catch (Exception ex)
            {
                Log.Write("Failed to generate addon file:", Color.Red);
                Log.Write(ex.Message, Color.Red);

                return(false);
            }
        }
Ejemplo n.º 4
0
 private void reloadAddonToolStripMenuItem_Click(object sender, EventArgs e)
 {
     WoW.SendMacro("/console scriptErrors 1");   // Show wow Lua errors
     WoW.SendMacro("/reload");
 }