Exemplo n.º 1
0
        public static void OnInit()
        {
            MacroEx    macro = new MacroEx();
            WaitForMsg wait  = new WaitForMsg(1042635, 1008124, 1008125, 1043297, 1055086, 1055087, 503172, 503171);

            macro.Insert(-1, new UseFishingPole(wait));
            macro.Insert(-1, new WaitForTargetAction(new[] { "", "2" }));
            macro.Insert(-1, new TargetRelLocAction(0, 0));
            macro.Insert(-1, new AttackClosestAction());
            macro.Insert(-1, new Clean());
            Track track = new Track();

            macro.Insert(-1, track);
            macro.Insert(-1, new WaitForTrack(track));
            macro.Insert(-1, new TrackResponse(track));
            macro.Insert(-1, wait);
            macro.Insert(-1, new SailAction(wait));
            Command.Register("fish", args => MacroManager.HotKeyPlay(macro));
            Core.AddHotkey("Fishing", () => MacroManager.HotKeyPlay(macro));

            MacroEx    sos     = new MacroEx();
            WaitForMsg waitSos = new WaitForMsg(1042635, 1008124, 1008125, 1043297, 1055086, 1055087, 503172, 503171, 501747);

            sos.Insert(-1, new UseFishingPole(waitSos));
            sos.Insert(-1, new WaitForTargetAction(new[] { "", "2" }));
            sos.Insert(-1, new TargetRelLocAction(0, 0));
            sos.Insert(-1, waitSos);
            sos.Insert(-1, new FoundSOSAction(waitSos));
            Command.Register("sos", args => MacroManager.HotKeyPlay(sos));
            Core.AddHotkey("SOS", () => MacroManager.HotKeyPlay(sos));
            Command.Register("sit", OnCommand);
        }
Exemplo n.º 2
0
        public override IEnumerable <ICommand> GetSubmenuCommands(object parameter)
        {
            Assert.ArgumentNotNull(parameter, nameof(parameter));

            var result = new List <ICommand>();

            var macros = MacroManager.GetMacros(parameter);

            var sortingValue = 1000;

            foreach (var macro in macros)
            {
                var q = new MacroCommand
                {
                    Macro        = macro,
                    Text         = macro.Text,
                    Group        = "Macros",
                    SortingValue = sortingValue
                };

                result.Add(q);
                sortingValue++;
            }

            result.AddRange(CommandManager.GetCommands(parameter, "Macros"));

            return(result);
        }
Exemplo n.º 3
0
        public void MacroManagerCollectsIncludedHeaders()
        {
            CreateCppFile("included", "");

            var includeRule = GetTestFileIncludeRule();

            var config = new ConfigFile
            {
                Id          = nameof(MacroManagerCollectsIncludedHeaders),
                Namespace   = nameof(MacroManagerCollectsIncludedHeaders),
                IncludeDirs = { includeRule },
                Includes    =
                {
                    CreateCppFile("includer", "#include \"included.h\"")
                }
            };

            var castXml = GetCastXml(ConfigFile.Load(config, Array.Empty <string>(), Logger));

            var macroManager = new MacroManager(castXml);

            macroManager.Parse(Path.Combine(includeRule.Path, "includer.h"), new CppModel.CppModule());

            Assert.Contains(includeRule.Path + "/included.h",
                            macroManager.IncludedFiles);
        }
Exemplo n.º 4
0
        public static void ResendGump(bool force = false)
        {
            try
            {
                MacroManager _macroManager = MacroManager.GetInstance();

                IEnumerable <MacroEntry> macros = _macroManager.Items.Where(e => e.IsRunning)
                                                  .OrderByDescending(e => e.StartedOn).ToArray();

                if (_lastMacros != null && macros.SequenceEqual(_lastMacros) && !force)
                {
                    return;
                }

                if (Engine.Gumps.GetGumps(out Gump[] gumps))
                {
                    foreach (Gump macrosGump in gumps.Where(g => g is MacrosGump))
                    {
                        Commands.CloseClientGump(macrosGump.ID);
                    }
                }

                MacrosGump gump = new MacrosGump(macros);
                gump.SendGump();

                _lastMacros = macros.ToArray();
            }
            catch (InvalidOperationException e)
            {
                Console.WriteLine(e.ToString());
            }
        }
Exemplo n.º 5
0
        protected CppModule ParseCpp(ConfigFile config)
        {
            var loaded = ConfigFile.Load(config, new string[0], Logger);

            loaded.GetFilesWithIncludesAndExtensionHeaders(out var configsWithIncludes,
                                                           out var configsWithExtensionHeaders);

            var cppHeaderGenerator = new CppHeaderGenerator(Logger, TestDirectory.FullName);

            var updated = cppHeaderGenerator
                          .GenerateCppHeaders(loaded, configsWithIncludes, configsWithExtensionHeaders)
                          .UpdatedConfigs;

            var castXml = GetCastXml(loaded);

            var macro = new MacroManager(castXml);
            var extensionGenerator = new CppExtensionHeaderGenerator();

            var skeleton = loaded.CreateSkeletonModule();

            macro.Parse(Path.Combine(TestDirectory.FullName, loaded.HeaderFileName), skeleton);

            extensionGenerator.GenerateExtensionHeaders(
                loaded, TestDirectory.FullName, skeleton, configsWithExtensionHeaders, updated
                );

            var parser = new CppParser(Logger, loaded)
            {
                OutputPath = TestDirectory.FullName
            };

            using var xmlReader = castXml.Process(parser.RootConfigHeaderFileName);

            return(parser.Run(skeleton, xmlReader));
        }
Exemplo n.º 6
0
        public void SavedTagsTest()
        {
            Tag t1 = new Tag()
            {
                TagValue     = "TestTag1",
                ContentValue = "TestContent1",
                ControlType  = "TextBoxControl"
            };

            Tag t2 = new Tag()
            {
                TagValue     = "TestTag2",
                ContentValue = "TestContent2",
                ControlType  = "TextBoxControl"
            };

            DefaultControlFactory dcf      = new DefaultControlFactory();
            MacroManager          input    = new MacroManager();
            MacroControlBase2     control1 = dcf.CreateMacroControl(t1);
            MacroControlBase2     control2 = dcf.CreateMacroControl(t2);

            input.SavedTags.Add(control1.TagSettings);
            input.SavedTags.Add(control2.TagSettings);
            MacroManager.Save("test.xml", input);
            MacroManager output = MacroManager.Load("test.xml");

            for (int i = 0; i < input.SavedTags.Count; i++)
            {
                Tag expected = input.SavedTags[i];
                Tag actual   = output.SavedTags[i];
                TagHelper.CompareTag(expected, actual);
            }
        }
Exemplo n.º 7
0
        private static void OneTimeResponse(object state)
        {
            TargetInfo info = state as TargetInfo;

            if (info != null)
            {
                if ((info.X == 0xFFFF && info.X == 0xFFFF) && (info.Serial == 0 || info.Serial >= 0x80000000))
                {
                    if (m_OnCancel != null)
                    {
                        m_OnCancel();
                    }
                }
                else
                {
                    if (Macros.MacroManager.AcceptActions)
                    {
                        MacroManager.Action(new AbsoluteTargetAction(info));
                    }

                    ScriptManager.AddToScript($"target {info.Serial}");

                    if (m_OnTarget != null)
                    {
                        m_OnTarget(info.Type == 1 ? true : false, info.Serial, new Point3D(info.X, info.Y, info.Z),
                                   info.Gfx);
                    }
                }
            }

            EndIntercept();
        }
Exemplo n.º 8
0
        public static void LoadEnvironment(InitialAction act)
        {
            ThemeUtil.Init();

            OptionPreservePlace place = GetOptionPreservePlace();

            _options              = new ContainerOptions();
            _history              = new ConnectionHistory();
            _macroManager         = new MacroManager();
            _container            = new PoderosaContainer();
            _globalCommandTarget  = new ContainerGlobalCommandTarget();
            _interThreadUIService = new ContainerInterThreadUIService();
            _sshKnownHosts        = new SSHKnownHosts();


            //この時点ではOSの言語設定に合ったリソースをロードする。起動直前で必要に応じてリロード
            ReloadStringResource();

            GEnv.Init(_container);
            GEnv.Options              = _options;
            GEnv.GlobalCommandTarget  = _globalCommandTarget;
            GEnv.InterThreadUIService = _interThreadUIService;
            GEnv.SSHKnownHosts        = _sshKnownHosts;
            string dir = GetOptionDirectory(place);

            LoadConfigFiles(dir, act);
            _options.OptionPreservePlace = place;

            //ここまできたら言語設定をチェックし、必要なら読み直し
            if (GUtil.CurrentLanguage != _options.Language)
            {
                System.Threading.Thread.CurrentThread.CurrentUICulture = _options.Language == Language.Japanese? new CultureInfo("ja") : CultureInfo.InvariantCulture;
                ReloadStringResource();
            }
        }
Exemplo n.º 9
0
        public void TestMethod1()
        {
            List <string> contentL = new List <string>();

            contentL.Add("04:26:12: [Verföhnt] hat sich eingeloggt.");
            contentL.Add("08:13:15: [Filysha] hat sich eingeloggt.");
            contentL.Add("04:26:12: [16. Level 65][Shaslol@Zaviel]: tentakelrapeforlife");
            contentL.Add("04:26:12: [Gilde][Shaslol@Zaviel]: tentakelrapeforlife");
            contentL.Add("07:20:34: [10. Level 50-59@Typhiria][@Typhiria]: Das Zonenereignis [Instabil: Glutinsel] in [Glutinsel] hat auf Typhiria begonnen!");
            contentL.Add("04:26:12: [16. Level 65][Sheide@Zaviel]: we all have our secrets :D");
            contentL.Add("04:26:16: [16. Level 65][Wedancegj@Gelidra]: w8t one sec zaviel are u he or she :D");
            contentL.Add("04:26:19: [Artoine@Typhiria] flüstert: ich hab programmieren als haupt- und nebenfach in" +
                         "der schule aber da macht man nicht so schnell progress :D auf ner uni gehts schon tausendmal schneller vorwärts");
            contentL.Add("04:26:20: [4. Stufe 1-29][Raphaely]: Also ein paar k platin ansammeln und auktionshaus preiskontrolle veranstalten...");
            contentL.Add("15:39:07: [Bobito] hat beim Bedarfs-Wurf 44 gewürfelt für: [Dicker Goldgürtel]");
            contentL.Add("15:39:07: [Bobito] hat mit einem Bedarfs-Wurf von 44 Folgendes gewonnen: [Dicker Goldgürtel]");
            contentL.Add("15:39:07: [Bobito] hat Folgendes erbeutet: [Dicker Goldgürtel]");
            contentL.Add("15:39:15: [Bobito] hat beim Bedarfs-Wurf 3 gewürfelt für: [Güldener Zermalmer]");
            contentL.Add("15:39:15: [Bobito] hat mit einem Bedarfs-Wurf von 3 Folgendes gewonnen: [Güldener Zermalmer]");

            MacroManager.Initialize();
            LineEvaluator   lEval = new LineEvaluator();
            ContentControls dw    = new ContentControls("chattest");

            dw.add("global", new DataGrid());

            lEval.registerCustomMask("lfm", Brushes.Orange);

            foreach (var item in contentL)
            {
                Line line = lEval.createLine(item);
                dw.write(line);
            }
        }
Exemplo n.º 10
0
    // Use this for initialization
    void Start()
    {
        macroManager = GameObject.Find("GameManager").GetComponent <MacroManager> ();

        switch (gameObject.transform.parent.name)
        {
        case "ButtonBait":
            gameObject.GetComponent <Text> ().text = macroManager.BaitToolMacroKey;
            break;

        case "ButtonCut":
            gameObject.GetComponent <Text> ().text = macroManager.CutToolMacroKey;
            break;

        case "ButtonSell":
            gameObject.GetComponent <Text> ().text = macroManager.SellMacroKey;
            break;

        case "ButtonPipeStraight":
            gameObject.GetComponent <Text> ().text = macroManager.StraightPipeMacroKey;
            break;

        case "ButtonPipeCurve":
            gameObject.GetComponent <Text> ().text = macroManager.CurvePipeMacroKey;
            break;

        case "ButtonPipeUp":
            gameObject.GetComponent <Text> ().text = macroManager.UpPipeMacroKey;
            break;
        }
    }
Exemplo n.º 11
0
 public Context()
 {
     SpreadsheetManager = new SpreadsheetManager(CardDataDirectory);
     TemplateManager    = new TemplateManager(TemplatesDirectory);
     CardImageManager   = new ImageManager(ImagesDirectory);
     FormattingManager  = new FormattingManager(this);
     MacroManager       = new MacroManager(this);
 }
Exemplo n.º 12
0
    // Use this for initialization
    void Awake()
    {
        toggleManager = GameObject.Find("Toggles").GetComponent <ToggleManager> ();
        sounds        = GameObject.Find("AudioManager").GetComponent <Sounds> ();

        macroManager = GetComponent <MacroManager> ();
        roundManager = GetComponent <RoundSystem> ();
    }
Exemplo n.º 13
0
        public void WillExecute()
        {
            MacroEntry me = new MacroEntry();

            MacroManager mi = MacroManager.GetInstance();

            mi.Execute(me);
        }
Exemplo n.º 14
0
        public static void OnInit()
        {
            MacroEx macro = new MacroEx();

            macro.Insert(-1, new GumpWait());
            macro.Insert(-1, new Clean());
            Command.Register("sud", args => MacroManager.HotKeyPlay(macro));
        }
Exemplo n.º 15
0
        public static void Replay()
        {
            MacroManager manager = MacroManager.GetInstance();

            MacroEntry current = manager.GetCurrentMacro();

            Task.Run(() => current.Action(current));
        }
Exemplo n.º 16
0
        public UseSpellButtonGump() : base(0, 0)
        {
            CanMove                = true;
            AcceptMouseInput       = true;
            CanCloseWithRightClick = true;

            _mm = Client.Game.GetScene <GameScene>().Macros;
        }
Exemplo n.º 17
0
        public static bool Playing(string macroName)
        {
            MacroManager manager = MacroManager.GetInstance();

            MacroEntry macro = manager.Items.FirstOrDefault(m => m.Name.Equals(macroName));

            return(macro != null && macro.IsRunning);
        }
Exemplo n.º 18
0
        public override bool CanExecute(object parameter)
        {
            if (parameter == null)
            {
                return(false);
            }

            return(CommandManager.HasCommands(parameter, "Macros") || MacroManager.HasMacros(parameter));
        }
Exemplo n.º 19
0
        public override bool CanExecute(object parameter)
        {
            if (parameter == null)
            {
                return(false);
            }

            return(MacroManager.HasMacros(parameter));
        }
Exemplo n.º 20
0
        public MacrosTabViewModel() : base(Strings.Macros)
        {
            Engine.DisconnectedEvent += OnDisconnectedEvent;

            _manager = MacroManager.GetInstance();

            _manager.IsRecording    = () => _isRecording;
            _manager.InsertDocument = str => { _dispatcher.Invoke(() => { SelectedItem.Macro += str; }); };
            _manager.Items          = Items;
        }
Exemplo n.º 21
0
        private void LoadMacros()
        {
            MacroList.Items.Clear();

            foreach (var macro in MacroManager.GetAllMacros().OrderBy(m => m.Text))
            {
                LoadMacro(macro);
            }

            EnableButtons();
        }
Exemplo n.º 22
0
 public TestBot(string name, int team, int playerIndex) : base(name, team, playerIndex)
 {
     Macros = new MacroManager(playerIndex, new IMacroAction[]
     {
         new ChaseBall
         {
         },
         new BoostPickup
         {
         }
     });
 }
Exemplo n.º 23
0
        public static bool IsRunning(string name)
        {
            MacroManager manager = MacroManager.GetInstance();

            MacroEntry macro = manager.Items.FirstOrDefault(m => m.Name == name);

            if (macro != null)
            {
                return(macro.IsRunning);
            }

            UOC.SystemMessage(Strings.Unknown_macro___, (int)UOC.SystemMessageHues.Normal, true);
            return(false);
        }
Exemplo n.º 24
0
        public static void PlayMacro(string name)
        {
            MacroManager manager = MacroManager.GetInstance();

            MacroEntry macro = manager.Items.FirstOrDefault(m => m.Name == name);

            if (macro == null)
            {
                UOC.SystemMessage(Strings.Unknown_macro___);
                return;
            }

            Task.Run(() => macro.Action(macro));
        }
Exemplo n.º 25
0
        public override void Start()
        {
            base.Start();
            DifficultyLvl = info.Difficulty;
            _selfRace = info.GetPlayerRace() == Races.MEN ? Races.ELVES : Races.MEN;

            //Init lists
            EnemyUnits = new List<Unit>();
            EnemyBuildings = new List<IGameEntity>();
            OwnResources = new List<Resource>();
            OwnBarracks = new List<Barrack>();
            modules = new List<AIModule>();
            Army = new List<Unit>();
            Workers = new List<Unit>();

            Battle.PlayerInformation me = info.GetBattle().GetPlayerInformationList()[playerId - 1];
            SetInitialResources(me.GetResources().Wood, me.GetResources().Food, me.GetResources().Metal, me.GetResources().Gold);
            Battle.PlayableEntity.EntityPosition pos = me.GetBuildings()[0].position;
            rootBasePosition = new Vector3(pos.X, 80, pos.Y);
            buildPosition = rootBasePosition;
            Macro = new MacroManager(this);
            StoryMode = Macro.architect.constructionGrid.mode != AIMode.BATTLE;
            Micro = new MicroManager(this);
            modules.Add(new AIModule(Macro.MacroHigh, !StoryMode ? (39 - DifficultyLvl*3) : 1));
            modules.Add(new AIModule(Macro.MacroLow, 8 - DifficultyLvl));
            modules.Add(new AIModule(Micro.Micro,  4 - DifficultyLvl));
            timers = new float[modules.Count];
            hasStronghold = true;
            for (int i = 0; i < modules.Count; i++)
                timers[i] = 0;

            InstantiateBuildings(me.GetBuildings());
            InstantiateUnits(me.GetUnits());

            ActorSelector selector = new ActorSelector()
            {
                registerCondition = gameObject => gameObject.GetComponent<FOWEntity>().IsOwnedByPlayer,
                fireCondition = gameObject => true
            };
            Subscriber<FOWEntity.Actions, FOWEntity>.get.registerForAll(FOWEntity.Actions.DISCOVERED, OnEntityFound, selector);
            Subscriber<FOWEntity.Actions, FOWEntity>.get.registerForAll(FOWEntity.Actions.HIDDEN, OnEntityLost, selector);

            if (AI_DEBUG_ENABLED)
            {
                aiDebug = AIDebugSystem.CreateComponent(gameObject, this);
            }

            missionStatus = new MissionStatus(playerId);
        }
Exemplo n.º 26
0
        public static void Replay()
        {
            MacroManager manager = MacroManager.GetInstance();

            MacroEntry current = manager?.GetCurrentMacro();

            if (current?.Action == null)
            {
                return;
            }

            manager.Replay = true;

            Task.Run(() => current.Action(current));
        }
Exemplo n.º 27
0
        private void DeleteClick([NotNull] object sender, [NotNull] RoutedEventArgs e)
        {
            Debug.ArgumentNotNull(sender, nameof(sender));
            Debug.ArgumentNotNull(e, nameof(e));

            var selectedIndex = MacroList.SelectedIndex;
            var selectedItem = MacroList.SelectedItem as ListBoxItem;
            if (selectedItem == null)
            {
                return;
            }

            var macro = selectedItem.Tag as Macro;
            if (macro == null)
            {
                Trace.Expected(typeof(Macro));
                return;
            }

            if (AppHost.MessageBox(string.Format(Rocks.Resources.MacroOrganizer_DeleteClick_Are_you_sure_you_want_to_delete__0__, macro.Text), Rocks.Resources.Confirmation, MessageBoxButton.OKCancel, MessageBoxImage.Question) != MessageBoxResult.OK)
            {
                return;
            }

            MacroManager.Delete(macro);

            MacroList.Items.Remove(selectedItem);
            selectedIndex--;

            if (selectedIndex < 0)
            {
                selectedIndex = 0;
            }

            if (selectedIndex < MacroList.Items.Count)
            {
                MacroList.SelectedIndex = selectedIndex;
            }

            var postSaveMacro = GetPostSaveMacroName();
            if (MacroManager.Macros.FirstOrDefault(m => m.Text == postSaveMacro) == null)
            {
                SetPostSaveMacroName(string.Empty);
                PostSaveMacros.Items.Clear();
            }

            EnableButtons();
        }
Exemplo n.º 28
0
        public static void UnsetAlias(string aliasName)
        {
            MacroEntry macro = MacroManager.GetInstance().GetCurrentMacro();

            if (macro != null)
            {
                if (macro.Aliases.ContainsKey(aliasName))
                {
                    macro.Aliases.Remove(aliasName);
                }
            }

            if (_aliases.ContainsKey(aliasName))
            {
                _aliases.Remove(aliasName);
            }
        }
Exemplo n.º 29
0
        private static void MacroCmd(string[] param)
        {
            if (param.Length <= 0)
            {
                World.Player.SendMessage("You must enter a macro name.");
                return;
            }

            foreach (Macro m in MacroManager.List)
            {
                if (m.ToString() == param[0])
                {
                    MacroManager.HotKeyPlay(m);
                    break;
                }
            }
        }
Exemplo n.º 30
0
        public static void ResendGump(bool force = false)
        {
            try
            {
                MacroManager _macroManager = MacroManager.GetInstance();

                IEnumerable <MacroEntry> macro = _macroManager.Items.Where(e => e.IsRunning);

                string html = string.Empty;

                foreach (MacroEntry entry in macro)
                {
                    if (entry.IsBackground)
                    {
                        html += $"<BASEFONT COLOR=#000000><I>{entry.Name}</I></BASEFONT>\n";
                    }
                    else
                    {
                        html += $"<BASEFONT COLOR=#000000>{entry.Name}</BASEFONT>\n";
                    }
                }

                if (html.Equals(_lastList) && !force)
                {
                    return;
                }

                if (Engine.Gumps.GetGumps(out Gump[] gumps))
                {
                    foreach (Gump macrosGump in gumps.Where(g => g is MacrosGump))
                    {
                        Commands.CloseClientGump(macrosGump.ID);
                    }
                }

                MacrosGump gump = new MacrosGump(html);
                gump.SendGump();

                _lastList = html;
            }
            catch (InvalidOperationException e)
            {
                Console.WriteLine(e.ToString());
            }
        }
Exemplo n.º 31
0
        protected override bool Execute(ConfigFile config)
        {
            var configsWithExtensions = new HashSet <string>();

            foreach (var file in ExtensionHeaders)
            {
                configsWithExtensions.Add(file.GetMetadata("ConfigId"));
            }

            var updatedConfigs = new HashSet <ConfigFile>();

            foreach (var cfg in config.ConfigFilesLoaded)
            {
                if (UpdatedConfigs.Any(updated => updated.GetMetadata("Id") == cfg.Id))
                {
                    updatedConfigs.Add(cfg);
                }
            }

            var resolver = new IncludeDirectoryResolver(SharpGenLogger);

            resolver.Configure(config);

            var castXml = new CastXml(SharpGenLogger, resolver, CastXmlExecutablePath, CastXmlArguments)
            {
                OutputPath = OutputPath
            };

            var macroManager = new MacroManager(castXml);

            var cppExtensionGenerator = new CppExtensionHeaderGenerator(macroManager);

            var module = cppExtensionGenerator.GenerateExtensionHeaders(config, OutputPath, configsWithExtensions, updatedConfigs);

            ReferencedHeaders = macroManager.IncludedFiles.Select(file => new TaskItem(file)).ToArray();

            if (SharpGenLogger.HasErrors)
            {
                return(false);
            }

            module.Write(PartialCppModuleCache.ItemSpec);

            return(!SharpGenLogger.HasErrors);
        }