Exemple #1
0
        //---------------------------------------------------------------------------------------------

        public static List <IUOPosition> ParseList(string str)
        {
            List <IUOPosition> list = new List <IUOPosition>();

            string[] split = str.Split(new char[] { '|' });

            foreach (string strPos in split)
            {
                UOPositionBase pos = Parse(strPos);
                if (pos != null)
                {
                    list.Add(pos);
                }
            }

            return(list);
        }
Exemple #2
0
        //---------------------------------------------------------------------------------------------

        //       1371   2712.0  Flags: 0x0000  Color: 0x038A  Model: 0x0190  Renamable: False  Notoriety: Neutral  HP: -1/-1

        //Tile X=1371 Y=2713 Z=0 Graphic=0x053E Name=cave floor
        //Tile X=1372 Y=2713 Z=0 Graphic=0x053F Name=cave floor
        //Tile X=1372 Y=2712 Z=0 Graphic=0x053E Name=cave floor
        //Tile X=1372 Y=2711 Z=0 Graphic=0x053E Name=cave floor
        //Tile X=1371 Y=2711 Z=0 Graphic=0x053D Name=cave floor
        //Tile X=1370 Y=2711 Z=0 Graphic=0x053D Name=cave floor
        //Tile X=1370 Y=2712 Z=0 Graphic=0x053F Name=cave floor
        //Tile X=1370 Y=2713 Z=0 Graphic=0x053F Name=cave floor

        /*
         * x0,y+1,a0
         * x+1,y+1,a45
         * x+1,y0,a90
         * x+1,y-1,a135
         * x0,y-1,a180
         * x-1,y-1,a225
         * x-1,y0,a270
         * x-1,y+1,a315
         */

        //---------------------------------------------------------------------------------------------

        public static double GetNextCoordinates(double angle, IUOPosition fromPosition, out IUOPosition nextPosition)
        {
            ushort nextX;
            ushort nextY;

            double nextAngle = GetNextCoordinates(angle, fromPosition.X.Value, fromPosition.Y.Value, out nextX, out nextY);

            if (nextAngle > -1)
            {
                nextPosition = new UOPositionBase(nextX, nextY, 0);
            }
            else
            {
                nextPosition = null;
            }

            return(nextAngle);
        }
Exemple #3
0
        //---------------------------------------------------------------------------------------------



        public static UOPositionBase Parse(string str)
        {
            string[] split = str.Split(new char[] { '.' });

            ushort x;
            ushort y;
            ushort z;

            UOPositionBase position = new UOPositionBase();

            if (split.Length > 3)
            {
                position.CommandName = split[3];
            }

            if (split.Length > 2 && ushort.TryParse(split[2], out z))
            {
                position.Z = z;
            }
            else
            {
                position.Z = 0;
            }

            if (split.Length > 1 && ushort.TryParse(split[1], out y))
            {
                position.Y = y;
            }
            if (split.Length > 0 && ushort.TryParse(split[0], out x))
            {
                position.X = x;
            }

            if (position.X.HasValue && position.Y.HasValue)
            {
                return(position);
            }

            return(null);
        }
Exemple #4
0
        public static void PrintAngle(ushort x, ushort y)
        {
            IUOPosition pos = new UOPositionBase(x, y, 0);

            Game.PrintMessage("Angle To destination:" + new Robot().GetAngle(pos));
        }
Exemple #5
0
        public static bool GoByPath(string path, bool reverse, bool noKop)
        {
            string[] options  = path.Split('|');
            int      button   = -1;
            string   bookType = "r";

            int index = 0;

            if (!noKop)
            {
                if (!String.IsNullOrEmpty(options[0]) && Regex.IsMatch(options[0], "(?<booktype>[a-z])(?<button>\\d{1,2})"))
                {
                    Match m = Regex.Match(options[0], "(?<booktype>[a-z])(?<button>\\d{1,2})");
                    bookType = m.Groups["booktype"].Value.ToLower();
                    button   = Int32.Parse(m.Groups["button"].Value);
                    index    = 1;
                }

                if (button > -1)
                {
                    string book = "RuneBookUse";
                    if (bookType == "t")
                    {
                        Phoenix.Runtime.RuntimeCore.Executions.Execute(Phoenix.Runtime.RuntimeCore.ExecutableList["TravelBookUse"], 1);
                        UO.Wait(1000);
                        book = "TravelBookUse";
                    }
                    else if (bookType == "c")
                    {
                        Phoenix.Runtime.RuntimeCore.Executions.Execute(Phoenix.Runtime.RuntimeCore.ExecutableList["CestovniKnihaUse"], 1);
                        UO.Wait(1000);
                        book = "CestovniKnihaUse";
                    }



                    bool teleported = false;
                    while (!teleported)
                    {
                        UO.DeleteJournal();

                        Phoenix.Runtime.RuntimeCore.Executions.Execute(RuntimeCore.ExecutableList[book], button);
                        Game.Wait(500);
                        if (!World.Player.Hidden)
                        {
                            UO.UseSkill("Hiding");
                        }

                        UO.Print("Cekam na kop.. nehybat");

                        if (Journal.WaitForText(true, 2000, "Nesmis vykonavat zadnou akci"))
                        {
                            Game.CurrentGame.CurrentPlayer.SwitchWarmode();
                            Game.Wait(1000);
                        }
                        else if (Journal.WaitForText(true, 120000, "You have been teleported"))
                        {
                            teleported = true;
                        }

                        if (Game.CurrentGame.WorldSave())
                        {
                            UO.Print("WS opakovani kopu za 45s");
                            Game.Wait(45000);
                            if (bookType == "t")
                            {
                                Phoenix.Runtime.RuntimeCore.Executions.Execute(Phoenix.Runtime.RuntimeCore.ExecutableList["TravelBookUse"], 1);
                                UO.Wait(1000);
                            }
                            Game.Wait(500);
                        }
                    }
                }
            }

            List <string> pathList = new List <string>();

            for (int i = index; i < options.Length; i++)
            {
                pathList.Add(options[i]);
            }

            if (reverse)
            {
                pathList.Reverse();
            }

            foreach (string opt in pathList)
            {
                if (UO.Dead)
                {
                    return(false);
                }

                string[] parm = opt.Split('.');

                UOPositionBase pos = new UOPositionBase(ushort.Parse(parm[0]), ushort.Parse(parm[1]), (ushort)0);

                int distance = parm.Length > 2 ? UOExtensions.Utils.ToNullInt(parm[2]).GetValueOrDefault(1) : 1;
                int gotries  = parm.Length > 3 ? UOExtensions.Utils.ToNullInt(parm[3]).GetValueOrDefault(1000) : 1000;

                Robot r = new Robot();
                r.UseTryGoOnly     = true;
                r.UseMinWait       = true;
                r.UseRun           = true;
                r.SearchSuqareSize = 450;

                if (r.GoTo(pos, distance, gotries))
                {
                    if (parm[parm.Length - 1].ToLower() == "opendoor")
                    {
                        ItemHelper.OpenDoorAll();
                        Game.Wait();
                    }
                    else if (parm[parm.Length - 1].ToLower() == "useopendoor")
                    {
                        ItemHelper.OpenDoor();
                        Game.Wait();
                    }
                }
                else if (gotries < 5)
                {
                    return(false);
                }
            }
            return(true);
        }