示例#1
0
        private static void GumpTextEntrySetterSendsEmptyStringTest()
        {
            _stealth.IncomingGump += (sender, e) => {
                Gump g = Gump.GetGump(e.GumpId);

                Console.WriteLine($"{g?.TextEdits.Count}");
            };
        }
示例#2
0
 public bool Open()
 {
     Close();
     if (DoubleClick() && Gump.WaitForGump(GumpType, 1000))
     {
         var gump = Gump.GetGump(GumpType);
         _lastparsedgump = gump;
         return(gump.Serial.Value > 0);
     }
     return(false);
 }
示例#3
0
        /// <summary> Recall using Runebook.cs Class </summary>
        /// <param name="bookspot"></param>
        /// <param name="recalltype"></param>
        /// <param name="runebookserial"></param>
        /// <returns>True if no longer in same location</returns>
        public static bool Travel(Item runebookserial, int bookspot, string recalltype)
        {
            var OSIconfig = new RuneBookConfig()
            {
                ScrollOffset  = 10,
                DropOffset    = 200,
                DefaultOffset = 300,
                RecallOffset  = 50,
                GateOffset    = 100,
                SacredOffset  = 75,
                Jumper        = 1
            };
            Runebook MyRunebook = new Runebook(runebookserial.Serial, OSIconfig);

            MyRunebook.Recall();
            runebookserial.DoubleClick();
            var loc1 = PlayerMobile.GetPlayer().Location; // LOC before recall

            runebookserial.DoubleClick();                 // Open Runebook
            StealthAPI.Stealth.Client.Wait(1000);
            Gump g;

            g = Gump.GetGump((uint)OSIGumpIDs.Runebook); //OSI
            if (g == null)
            {
                StealthAPI.Stealth.Client.AddToSystemJournal("Gump is Null");
                return(false);
            }
            else
            {
                foreach (var e in g.Buttons)
                {
                    if (!e.PacketValue.Equals(OSIconfig.RecallOffset + bookspot - 1) && !e.Graphic.Released.Equals(2103) &&
                        !e.Graphic.Pressed.Equals(2104))
                    {
                        continue;
                    }
                    if (recalltype == "Recall")
                    {
                        GumpButton recallButton = g.Buttons.First(i => i.PacketValue.Equals(OSIconfig.RecallOffset + (bookspot - 1)));
                        recallButton.Click();
                        break;
                    }
                }
            }
            StealthAPI.Stealth.Client.Wait(false ? 2000 : 3500);
            var loc2 = PlayerMobile.GetPlayer().Location; // LOC after recall

            return(loc1 != loc2);                         // Compare Locs to see if you moved.
        }
示例#4
0
        public bool Close()
        {
            Gump g = Gump.GetGump(GumpType);

            if (g != null)
            {
                if (!g.Serial.Equals(0))
                {
                    g.Close();
                }
            }
            Stealth.Client.Wait(1000);
            if (!Gump.WaitForGumpClose(GumpType, GumpDelay))
            {
                return(false);
            }
            return(true);
        }
示例#5
0
        public bool Parse()
        {
            if (!Close() || !Open())
            {
                return(false);
            }

            var g = Gump.GetGump(GumpType);

            UpdateLocalizedProperties();

            int scrolloffset  = Configuration.ScrollOffset;
            int dropoffset    = Configuration.DropOffset;
            int defaultoffset = Configuration.DefaultOffset;
            int recalloffset  = Configuration.RecallOffset;
            int gateoffset    = Configuration.GateOffset;
            int sacredoffset  = Configuration.SacredOffset;
            int jumper        = Configuration.Jumper;

            dynamic min = string.Empty;
            dynamic max = string.Empty;

            if (g.HTMLTexts.Count > 0)
            {
                min = g.HTMLTexts[0].Text;
            }
            if (g.HTMLTexts.Count > 1)
            {
                max = g.HTMLTexts[1].Text;
            }

            int imin;

            if (!int.TryParse(min, out imin))
            {
                imin = -1;
            }
            int imax;

            if (!int.TryParse(max, out imax))
            {
                imax = -1;
            }

            Uses = new Range(imin, imax);
            if (Shard == "OSI")
            {
                int eamt = 0;
                for (var i = 0; i < 15; i++)
                {
                    if (g.Buttons.Any(
                            e =>
                            e.PacketValue.Equals(defaultoffset + (i)) && e.Graphic.Released.Equals(2361) &&
                            e.Graphic.Pressed.Equals(2361)))
                    {
                        eamt++;
                    }
                }

                var namepos = (eamt);

                var defaultbtn = g.Buttons.First(e => e.Graphic.Released.Equals(2361) && e.Graphic.Pressed.Equals(2361));
                if (defaultbtn != null)
                {
                    var value = ((defaultbtn.PacketValue - defaultoffset) / jumper) + 1;
                    DefaultRune = value;
                }

                var rButton = g.Buttons.First(e => e.Graphic.Released.Equals(2472) || e.Graphic.Pressed.Equals(2473));
                RenameButton = rButton;

                for (var i = 0; i < 15; i++)
                {
                    var valid =
                        g.Buttons.Any(
                            e =>
                            e.PacketValue.Equals(defaultoffset + (i)) && e.Graphic.Released.Equals(2361) &&
                            e.Graphic.Pressed.Equals(2361));

                    if (!valid)
                    {
                        continue;
                    }
                    var recallButton  = g.Buttons.First(e => e.PacketValue.Equals(recalloffset + (i)));
                    var gateButton    = g.Buttons.First(e => e.PacketValue.Equals(gateoffset + (i)));
                    var sacredButton  = g.Buttons.First(e => e.PacketValue.Equals(sacredoffset + (i)));
                    var dropButton    = g.Buttons.First(e => e.PacketValue.Equals(dropoffset + (i)));
                    var scrollButton  = g.Buttons.First(e => e.PacketValue.Equals(scrolloffset + (i)));
                    var defaultButton = g.Buttons.First(e => e.PacketValue.Equals(defaultoffset + (i)));
                    var name          = g.Labels[namepos].Text;

                    Entries.Add(new RunebookEntry(this, recallButton, gateButton, sacredButton, scrollButton,
                                                  defaultButton, dropButton, name));
                }
            }
            else
            {
                int eamt = 0;
                for (var i = 0; i < 15; i++)
                {
                    if (g.Buttons.Any(e => e.PacketValue.Equals(recalloffset + (i * jumper)) &&
                                      e.Graphic.Released.Equals(2103) &&
                                      e.Graphic.Pressed.Equals(2104)))
                    {
                        eamt++;
                    }
                }

                var namepos = (eamt * 2);

                var defaultbtn = g.Buttons.First(e => e.Graphic.Released.Equals(2361) && e.Graphic.Pressed.Equals(2361));
                if (defaultbtn != null)
                {
                    var value = ((defaultbtn.PacketValue - defaultoffset) / jumper) + 1;
                    DefaultRune = value;
                }

                var rButton = g.Buttons.First(e => e.Graphic.Released.Equals(2472) || e.Graphic.Pressed.Equals(2473));
                RenameButton = rButton;

                for (var i = 0; i < 15; i++)
                {
                    var valid =
                        g.Buttons.Any(
                            e =>
                            e.PacketValue.Equals(recalloffset + (i * jumper)) && e.Graphic.Released.Equals(2103) &&
                            e.Graphic.Pressed.Equals(2104));

                    if (!valid)
                    {
                        continue;
                    }
                    var recallButton  = g.Buttons.First(e => e.PacketValue.Equals(recalloffset + (i * jumper)));
                    var gateButton    = g.Buttons.First(e => e.PacketValue.Equals(gateoffset + (i * jumper)));
                    var sacredButton  = g.Buttons.First(e => e.PacketValue.Equals(sacredoffset + (i * jumper)));
                    var dropButton    = g.Buttons.First(e => e.PacketValue.Equals(dropoffset + (i * jumper)));
                    var scrollButton  = g.Buttons.First(e => e.PacketValue.Equals(scrolloffset + (i * jumper)));
                    var defaultButton = g.Buttons.First(e => e.PacketValue.Equals(defaultoffset + (i * jumper)));

                    var a     = g.Labels[i + (i * 1)].Text;
                    var b     = g.Labels[i + (i * 1) + 1].Text;
                    var full  = a + " " + b;
                    var name  = g.Labels[namepos + i].Text;
                    var color = g.Labels[namepos + i].Color;

                    Entries.Add(new RunebookEntry(this, recallButton, gateButton, sacredButton, scrollButton,
                                                  defaultButton, dropButton, full, name, color));
                }
            }

            return(true);
        }