示例#1
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());
            }
        }
示例#2
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());
            }
        }