예제 #1
0
        public void ContextChange(object sender, LuaEventArgs args)
        {
            talent.Reset();
            glyph.Reset();
            spell.Reset();
            line_cds.Clear();
            PlayerAuras.Reset();
            PetAuras.Reset();

            _class = StyxWoW.Me.Class;
            //_spec = Me.Specialization;

            var oldctx = Context;

            Context = (StyxWoW.Me.CurrentMap.IsArena || StyxWoW.Me.CurrentMap.IsBattleground)
                ? WoWContext.PvP
                : WoWContext.PvE;
            if (Context != oldctx)
            {
                SimcraftImpl.Write("Switching to " + Context + " Mode");
            }

            ooc = DateTime.Now;
            RebuildBehaviors();
        }
예제 #2
0
        public override void Start()
        {
            try
            {
                Specialisation          = WoWSpec.None;
                NamedComposite.Sequence = "";
                TreeRoot.TicksPerSecond = 8;
                ProfileManager.LoadEmpty();
                //_oldRoutine = RoutineManager.Current; //Save it so we can restore it later
                RoutineManager.Current = new ProxyRoutine();

                Lua.Events.RemoveFilter("COMBATLOG_EVENT_UNFILTERED");

                Lua.Events.AttachEvent("UNIT_SPELLCAST_SUCCEEDED", UNIT_SPELLCAST_SUCCEEDED);
                Lua.Events.AttachEvent("COMBATLOG_EVENT_UNFILTERED", COMBATLOG_EVENT_UNFILTERED);

                Lua.Events.AttachEvent("CHARACTER_POINTS_CHANGED", ContextChange);
                Lua.Events.AttachEvent("PLAYER_LOGOUT", ContextChange);
                Lua.Events.AttachEvent("PLAYER_TALENT_UPDATE", ContextChange);
                Lua.Events.AttachEvent("UNIT_AURA", PlayerAuras.UNIT_AURA);
                Lua.Events.AttachEvent("UNIT_AURA", PetAuras.UNIT_AURA);
                ContextChange(null, null);

                RegisterHotkeys();
            }
            catch (Exception e)
            {
                SimcraftImpl.Write(e.ToString());
            }
        }
예제 #3
0
        public Composite CombatIteration()
        {
            return(new Action(delegate
            {
                //if (iterationCounter%7 == 0)

                /*if (console != null %% console.Va)console.BeginInvoke((System.Action)(() =>
                 * {
                 *
                 *      console.reset();
                 *
                 * }));*/

                //console.BeginInvoke(new Delegate(console,"reset"));
                //console.reset();
                //Write(Me.Pet.);

                combatIterationCount++;

                IterationTimer.Restart();

                if (SpellIsTargeting)
                {
                    SimcraftImpl.Write("Wanting to click: " + clickUnit);
                    //Write("Clicking: " + clickUnit.Location + " " + iterationCounter);
                    SpellManager.ClickRemoteLocation(clickUnit.Location);
                    clickUnit = null;
                }

                //Write("u:{0} b:{1} f:{2}", unholy.current, death.current, frost.current);

                //OverrideSpell.Pulse();
                return RunStatus.Failure;
            }));
        }
예제 #4
0
 public Composite IterationEnd()
 {
     return(new Action(delegate
     {
         IterationTimer.Stop();
         iterationTotal += IterationTimer.ElapsedMilliseconds;
         //if (IterationTimer.ElapsedMilliseconds > 1) Write(DateTime.Now.Millisecond+": "+IterationTimer.ElapsedMilliseconds+"");
         if (combatIterationCount % 150 == 0)
         {
             SimcraftImpl.Write("avgIte: " + (iterationTotal / combatIterationCount));
         }
         //Write(""+IterationTimer.ElapsedMilliseconds);
     }));
 }
예제 #5
0
        public static void GenerateApls(String folder)
        {
            apls.Clear();
            inst.actions.Reset();

            if (current_action_list != null)
            {
                current_action_list.Unload();
            }


            SimcraftImpl.Write("Compiling Action Lists");

            foreach (var filename in Directory.GetFiles(folder))
            {
                if (!filename.EndsWith(".simc"))
                {
                    continue;
                }
                String contents   = File.ReadAllText(filename);
                var    currentApl = ActionPrioriyList.FromString(contents);
                if (currentApl.Class != Me.Class)
                {
                    continue;
                }

                var code      = currentApl.ToCode();
                var classname = RandomString(10);
                code = code.Replace("public class SimcraftRota", "public class " + classname);

                //SimcraftImpl.Write(code);

                Assembly asm = RuntimeCodeCompiler.CompileCode(code);

                Behavior attributes =
                    (Behavior)asm.GetTypes()[0].GetMembers()[0].GetCustomAttributes(typeof(Behavior), true).First();

                currentApl.Assembly = asm;

                SimcraftImpl.Write("New Apl: " + currentApl.Name);

                apls[currentApl.ToString()] = currentApl;
            }
        }
예제 #6
0
 public static void Load()
 {
     try
     {
         SimcraftImpl.Write("Loading configuration");
         var reader =
             new XmlSerializer(typeof(SimCSettings));
         var file =
             new StreamReader(Path.Combine(Settings.CharacterSettingsDirectory, "SimCSettings.xml"));
         currentSettings = (SimCSettings)reader.Deserialize(file);
         SimcraftImpl.Write("Configuration successfully loaded.");
     }
     catch
     {
         SimcraftImpl.Write("Failed to load configuration, creating default configuration.");
         //Write("Exception: " + e);
         _currentSettings = DefaultConfig();
     }
 }
예제 #7
0
        private void UNIT_SPELLCAST_SUCCEEDED(object sender, LuaEventArgs args)
        {
            //Logging.Write(args.EventName);
            //Write("bc: "+pet.buff.beast_cleave.up);
            //Write("ff: " + buff.frenzy.stack);

            //(Write("rav"+talent.ravager.enabled);
            //Write("ava:"+talent.avatar.enabled);

            /* var sw = new Stopwatch();
             * sw.Restart();
             *
             *
             * string cc = "local can_cast = {};";
             *
             * int i = 0;
             *
             * foreach (var sp in current_action_list.spells)
             * {
             *  cc += "u, m = IsUsableSpell(\""+"Kill Command"+"\"); can_cast["+i+"] = u;";
             *  i++;
             * }
             * cc += "return unpack(can_cast);";
             *
             * Lua.GetReturnValues(cc);
             *
             * Logging.Write(""+sw.ElapsedTicks+" checked spells "+i);*/

            if (args.Args[0].ToString().Equals("player"))
            {
                uint spellid = uint.Parse(args.Args[4].ToString());

                if (!dbc.Spells.ContainsKey(spellid))
                {
                    return;
                }

                LastSpellCast = dbc.Spells[spellid];

                prev.spell = LastSpellCast;

                LogDebug("Cast: " + LastSpellCast.name);

                if (LastSpellCast.id == 78203)
                {
                    var s = new Stopwatch();
                    s.Start();
                    apparitions.Add(s);
                }

                if (LastSpellCast.id == 8092)
                {
                    if (conditionUnit != null)
                    {
                        conditionUnit.ApplyMindHarvest();
                    }
                }

                if (LastSpellCast.id == 20271)
                {
                    last_judgment_target = conditionUnit;
                }

                if (LastSpellCast.gcd > 0)
                {
                    prev_gcd.spell = LastSpellCast;
                }

                if (LastSpellCast.name.Contains("Seal of"))
                {
                    seal.active = LastSpellCast.token.Split('_')[2];
                }


                if (talent.steady_focus.enabled)
                {
                    if (LastSpellCast.id == 77767)
                    {
                        BuffProxy.cShots++;
                        if (BuffProxy.cShots == 2)
                        {
                            BuffProxy.cShots = 0;
                            SimcraftImpl.Write(DateTime.Now + ": Steady Shots!");
                        }
                    }
                    if (CobraReset.Contains(LastSpellCast.id) && BuffProxy.cShots > 0)
                    {
                        BuffProxy.cShots = 0;
                    }
                }
            }
        }