Пример #1
0
        public void TrainOtherSkills()
        {
            Game.CurrentGame.CurrentPlayer.SwitchWarmode();
            while (!UO.Dead)
            {
                if (UO.Backpack.AllItems.FindType(0x0E9D, 0x0000).Exist)
                {
                    Game.PrintMessage("Startuji Musican Train");

                    Journal.Clear();
                    UO.UseType(0x0E9D, 0x0000);
                    if (Journal.WaitForText(true, 2500, "You play poorly"))
                    {
                    }
                    //Game.Wait(1000);

                    if (Journal.Contains(true, " You are preoccupied with thoughts of battle"))
                    {
                        Game.CurrentGame.CurrentPlayer.SwitchWarmode();
                        Game.Wait();
                    }
                    //Game.Wait(1500);
                }
                else if (SkillsHelper.GetSkillValue("ArmsLore").RealValue < 900 && World.Player.Backpack.AllItems.FindType(0x1400).Exist)
                {
                    UO.WaitTargetObject(World.Player.Backpack.AllItems.FindType(0x1400));
                    UO.UseSkill(StandardSkill.ArmsLore);
                    Game.Wait(1350);
                }
            }
        }
Пример #2
0
        public static void PrintCurrenSkillStatus()
        {
            SkillValue mf = SkillsHelper.GetSkillValue("MaceFighting");
            SkillValue fe = SkillsHelper.GetSkillValue("Fencing");
            SkillValue sw = SkillsHelper.GetSkillValue("Swordsmanship");
            SkillValue wr = SkillsHelper.GetSkillValue("Wrestling");

            Game.PrintMessage(String.Format("{0} - {1} / {2}", "MaceFighting", mf.RealValue, mf.MaxValue));
            Game.PrintMessage(String.Format("{0} - {1} / {2}", "Wrestling", wr.RealValue, wr.MaxValue));
            Game.PrintMessage(String.Format("{0} - {1} / {2}", "Fencing", fe.RealValue, fe.MaxValue));
            Game.PrintMessage(String.Format("{0} - {1} / {2}", "Swordsmanship", sw.RealValue, sw.MaxValue));
        }
Пример #3
0
        public void HideDruid(int wait)
        {
            Journal.Clear();
            Game.CurrentGame.CurrentPlayer.SwitchWarmode();

            StandardSkill usedSkill = StandardSkill.Hiding;

            SkillValue hidingSV  = SkillsHelper.GetSkillValue("Hiding");
            SkillValue stealthSV = SkillsHelper.GetSkillValue("Stealth");

            if (stealthSV.RealValue > hidingSV.RealValue)
            {
                usedSkill = StandardSkill.Stealth;
            }


            Game.RunScript(3000);


            UO.UseSkill(usedSkill);


            AsyncCounter counter = new AsyncCounter();

            counter.PrefixText    = "Vracecka: ";
            counter.HighlightTime = 1500;
            counter.Step          = 400;
            counter.StopMessage   = "You can't seem to hide here,You have hidden yourself well,You can't do much in your";
            counter.StopMethod    = IsHidden;
            counter.Run();

            if (World.Player.Backpack.AllItems.FindType(0x1B17, 0x0493).Exist)
            {
                Game.Wait(wait);
                UO.UseType(0x1B17, 0x0493);
            }
            else
            {
                World.Player.PrintMessage("Nemas artefakt!");
            }
        }
Пример #4
0
        //---------------------------------------------------------------------------------------------

        protected double GetScroolTimeout()
        {
            SkillValue skv = SkillsHelper.GetSkillValue("Magery");

            if (skv.RealValue > 960)
            {
                return(2.000);
            }
            else if (skv.Value > 910)
            {
                return(4.000);
            }
            else if (skv.RealValue > 860)
            {
                return(7.000);
            }
            else if (skv.RealValue > 810)
            {
                return(10.000);
            }
            else if (skv.RealValue > 750)
            {
                return(13.000);
            }
            else if (skv.RealValue > 710)
            {
                return(16.000);
            }
            else if (skv.RealValue > 660)
            {
                return(19.000);
            }
            else if (skv.RealValue > 610)
            {
                return(22.000);
            }
            else
            {
                return(25.000);
            }
        }
Пример #5
0
        public void Hide(int highlightTime, ushort highlightColor, int counterStep, Graphic dropItemGraphic, UOColor dropItemColor)
        {
            Journal.Clear();
            Game.CurrentGame.CurrentPlayer.SwitchWarmode();

            StandardSkill usedSkill = StandardSkill.Hiding;

            SkillValue hidingSV  = SkillsHelper.GetSkillValue("Hiding");
            SkillValue stealthSV = SkillsHelper.GetSkillValue("Stealth");

            if (stealthSV.RealValue > hidingSV.RealValue)
            {
                usedSkill = StandardSkill.Stealth;
            }

            if (World.Player.Layers[Layer.LeftHand].Graphic == 0x0A15)//lantern
            {
                UOItem shield = new UOItem(Serial.Invalid);

                List <UOItem> items = new List <UOItem>();
                items.AddRange(World.Player.Backpack.Items);

                foreach (UOItem item in items)
                {
                    foreach (Graphic g in ItemLibrary.Shields.GraphicArray)
                    {
                        if (item.Graphic == g && (!shield.Exist || shield.Graphic != 0x1B76))
                        {
                            shield = item;
                        }
                    }
                }

                if (shield.Exist)
                {
                    shield.Use();
                }
                else
                {
                    World.Player.Layers[Layer.LeftHand].Move(1, World.Player.Backpack, 100, 30);
                }

                Game.Wait(150);
            }


            Game.RunScript(3000);

            AsyncCounter counter = new AsyncCounter();

            counter.PrefixText = "";
            if (highlightTime > 0)
            {
                counter.HighlightTime = highlightTime;
            }

            if (highlightColor > 0)
            {
                counter.HighlightColor = highlightColor;
            }


            if (!dropItemGraphic.IsInvariant)
            {
                int origDistance = World.FindDistance;
                World.FindDistance = 3;
                UOItem item = World.Ground.FindType(dropItemGraphic, dropItemColor);
                if (item.Exist && item.Distance <= 3)
                {
                    item.Move(item.Amount, World.Player.Backpack);
                }
                World.FindDistance = origDistance;
            }

            Hiding.HideRunning = true;
            UO.UseSkill(usedSkill);
            Game.Wait(50);

            if (!dropItemGraphic.IsInvariant && World.Player.Backpack.AllItems.FindType(dropItemGraphic, dropItemColor).Exist)
            {
                DropItemGraphic = dropItemGraphic;
                DropItemColor   = dropItemColor;

                counter.RunComplete += Counter_RunComplete;
            }


            counter.Step        = counterStep;
            counter.StopMessage = "You can't seem to hide here,You have hidden yourself well";
            counter.StopMethod  = IsHidden;
            counter.Run();
        }
Пример #6
0
        public void HideInBattle(int highlightTime, ushort highlightColor, int counterStep)
        {
            if (World.Player.Layers[Layer.LeftHand].Graphic == 0x0A15)//lantern
            {
                UOItem shield = new UOItem(Serial.Invalid);

                List <UOItem> items = new List <UOItem>();
                items.AddRange(World.Player.Backpack.Items);

                foreach (UOItem item in items)
                {
                    foreach (Graphic g in ItemLibrary.Shields.GraphicArray)
                    {
                        if (item.Graphic == g && (!shield.Exist || shield.Graphic != 0x1B76))
                        {
                            shield = item;
                        }
                    }
                }

                if (shield.Exist)
                {
                    shield.Use();
                }
                else
                {
                    World.Player.Layers[Layer.LeftHand].Move(1, World.Player.Backpack, 100, 30);
                }

                Game.Wait(250);
            }


            Journal.Clear();
            SkillValue    hidingSV  = SkillsHelper.GetSkillValue("Hiding");
            SkillValue    stealthSV = SkillsHelper.GetSkillValue("Stealth");
            StandardSkill usedSkill = StandardSkill.Hiding;

            if (stealthSV.RealValue > hidingSV.RealValue)
            {
                usedSkill = StandardSkill.Stealth;
            }

            AsyncCounter counter = new AsyncCounter();

            counter.PrefixText = "";
            if (highlightTime > 0)
            {
                counter.HighlightTime = highlightTime;
            }

            if (highlightColor > 0)
            {
                counter.HighlightColor = highlightColor;
            }

            Game.RunScript(3000);
            UO.UseSkill(usedSkill);

            if (Journal.WaitForText(true, 200, "You are preoccupied with thoughts of battle"))
            {
                Game.CurrentGame.CurrentPlayer.SwitchWarmode();
                World.Player.PrintMessage("[ Preoccupied ]", MessageType.Warning);
                Game.Wait(250);

                if (World.Player.Hits < World.Player.Strenght)
                {
                    UO.BandageSelf();
                }
                else
                {
                    UO.UseSkill(StandardSkill.Meditation);
                }

                //else if (World.Player.Mana > 4)
                //  UO.Cast(StandardSpell.MagicArrow, World.Player.Serial);
            }
            else
            {
                counter.Step        = counterStep;
                counter.StopMessage = "You can't seem to hide here,You have hidden yourself well";
                counter.StopMethod  = IsHidden;
                counter.Run();
            }


            //You are preoccupied with thoughts of battle

            //Game.RunScript(3500);



            //Hiding.HideRunning = true;

            //if (needAction)
            //{
            //  World.Player.PrintMessage("[ HID Action ]", MessageType.Warning);

            //  if (World.Player.Hits < World.Player.Strenght)
            //    UO.BandageSelf();
            //  else if (World.Player.Mana > 4)
            //    UO.Cast(StandardSpell.MagicArrow, World.Player.Serial);
            //}

            //Game.Wait(250);
            //UO.UseSkill(usedSkill);
            //Game.Wait(50);
        }
Пример #7
0
        public void TameCharacter(UOCharacter character, int maxTries, bool keepDisttance)//, Robot r)
        {
            Game.CurrentGame.CurrentPlayer.SwitchWarmode();

            Robot r = new Robot();

            r.UseTryGoOnly     = true;
            r.SearchSuqareSize = 20;

            UOItem currentStaff = EnsuredTamingStaff;
            int    tries        = 0;

            Game.PrintMessage(String.Format("{0}, {1}, {2}, {3}, {4}", character.Exist, character.RequestStatus(500), character.Hits, character.Distance, UO.Dead));

            while (character.Exist && character.RequestStatus(500) && character.Hits > 0 && character.Distance < 6 && !UO.Dead)
            {
                UO.DeleteJournal();

                bool end  = false;
                bool kill = false;

                if (character.Distance > 2 && keepDisttance)
                {
                    r.GoTo(new UOPositionBase(character.X, character.Y, 0), 2, 2);
                    Game.Wait(500);
                }
                UO.Say("Baf");
                Game.Wait();

                UO.UseSkill("Hiding");
                Game.Wait();
                IRequestResult result = UO.WaitTargetObject(character.Serial);
                currentStaff.Use();
                //Game.Wait(500);
                SkillValue tamingValue = SkillsHelper.GetSkillValue("AnimalTaming");
                UOItem     robe        = World.Player.Layers[Layer.OuterTorso];
                Game.PrintMessage("RV: " + tamingValue.RealValue + " / " + robe.Exist);

                using (JournalEventWaiter jew = new JournalEventWaiter(true,
                                                                       "You can't see the target",
                                                                       "Ochoceni se nezdarilo",
                                                                       "Your taming failed",
                                                                       "byl tamnut",
                                                                       "not tamable",
                                                                       "You are not able to tame",
                                                                       "Jsi moc daleko",
                                                                       "Jeste nemuzes pouzit hulku",
                                                                       "toto zvire nelze ochocit",
                                                                       "Toto zvire nedokazes ochocit",
                                                                       "You are not able to tame this animal"

                                                                       ))
                {
                    if (jew.Wait(15000))
                    {
                        if (Journal.Contains(true, "Ochoceni se nezdarilo"))
                        {
                            Game.PrintMessage("Try - Ochoceni se nezdarilo");
                        }
                        else if (Journal.Contains(true, "Your taming failed"))
                        {
                            Game.PrintMessage("Try - Your taming failed");
                        }
                        else if (Journal.Contains(true, "Jeste nemuzes pouzit hulku"))
                        {
                            Game.PrintMessage("Try - Jeste nemuzes pouzit hulku");
                            Game.Wait(6000);
                        }
                        else if (Journal.Contains(true, "Jsi moc daleko"))
                        {
                            if (keepDisttance)
                            {
                                bool go = r.GoTo(new UOPositionBase(character.X, character.Y, 0), 1, 10);
                                if (!go)
                                {
                                    end = true;
                                }
                                Game.Wait();
                                Game.PrintMessage("Try - Jsi moc daleko: " + go);
                            }
                        }
                        else if (Journal.Contains(true, "You can't see the target"))
                        {
                            UO.WaitTargetCancel();
                            Game.Wait();
                            UO.Press(System.Windows.Forms.Keys.Escape);
                            Game.Wait();
                            Game.CurrentGame.CurrentPlayer.SwitchWarmode();
                            Game.Wait();
                            bool go = r.GoTo(new UOPositionBase(character.X, character.Y, 0), 1, 10);
                            if (!go)
                            {
                                end = true;
                            }
                            Game.Wait();

                            Game.PrintMessage("Try - You can't see the target go: " + go);
                        }
                        else if (Journal.Contains(true, "byl tamnut"))// && currentStaff.Color == TamingStaff.Color)
                        {
                            Game.PrintMessage("End - byl tamnut");
                            end = true;
                        }
                        else if (Journal.Contains(true, "not tamable") || Journal.Contains(true, "toto zvire nelze ochocit"))
                        {
                            character.Click();
                            Game.Wait(500);
                            character.RequestStatus(500);

                            bool isTrofejAnimal = false;// TrofejKlamaci.Contains(character.Model);

                            foreach (Graphic g in TrofejKlamaci)
                            {
                                if (g == character.Model)
                                {
                                    isTrofejAnimal = true;
                                }
                            }


                            if (isTrofejAnimal && character.Notoriety != Notoriety.Innocent && character.Notoriety != Notoriety.Invulnerable && character.Notoriety != Notoriety.Guild)//krysa/hind/bear/goat/snake atd)TODO
                            {
                                kill = true;
                                //zabit / riznout / vylotit
                                Game.PrintMessage("Kill - not tamable " + character.Model);
                            }
                            else
                            {
                                Game.PrintMessage("End - not tamable");
                                end = true;
                            }
                        }
                        else if (Journal.Contains(true, "Toto zvire nedokazes ochocit") || Journal.Contains(true, "You are not able to tame this animal"))
                        {
                            if (World.Player.Backpack.AllItems.FindType(0x1F03).Exist)
                            {
                                World.Player.Backpack.AllItems.FindType(0x1F03).Use();
                                Game.Wait(500);
                            }
                            else if (World.Player.Backpack.AllItems.FindType(0x1F01).Exist)
                            {
                                World.Player.Backpack.AllItems.FindType(0x1F01).Use();
                                Game.Wait(500);
                            }

                            if (tries > 1)
                            {
                                Game.PrintMessage("End - Nelze ochocit " + character.Serial);
                                end = true;
                            }

                            Game.Wait(3500);
                        }
                        else
                        {
                            Game.Wait(1000);
                        }
                    }
                    else
                    {
                        if (Game.CurrentGame.WorldSave())
                        {
                            Game.Wait(60000);
                            Game.PrintMessage("Try - WordSave" + character.Serial);
                        }
                        else
                        {
                            if (tries > 1)
                            {
                                Game.PrintMessage("End - JEW timeout " + character.Serial);
                                end = true;
                            }
                        }
                    }

                    if (tries > maxTries)// && currentStaff.Color == TrainTamingStaff.Color)
                    {
                        end = true;
                    }

                    if (tamingValue.RealValue < 1000 && maxTries < 100)
                    {
                        bool switchToTrain  = false;
                        bool switchToTaming = false;
                        if (tries == 0)
                        {
                            if ((Journal.Contains(true, "nenauc") || Journal.Contains(true, "You Cannot learn anything more")) && robe.Exist)
                            {
                                robe.Move(1, World.Player.Backpack);
                                Game.Wait();
                                switchToTrain = true;
                            }

                            if (!Journal.Contains(true, "nenauc"))
                            {
                                switchToTrain = true;
                            }
                        }
                        else if (tries == 1)
                        {
                            if (Journal.Contains(true, "nenauc") || Journal.Contains(true, "You Cannot learn anything more"))
                            {
                                switchToTaming = true;

                                Game.PrintMessage("robe.Exist:" + robe.Exist);

                                if (robe.Exist)
                                {
                                    robe.Use();
                                    Game.Wait();
                                }
                            }
                        }

                        if (switchToTrain)
                        {
                            if (World.Player.Backpack.AllItems.FindType(TrainTamingStaff.Graphic, TrainTamingStaff.Color).Exist)
                            {
                                currentStaff = World.Player.Backpack.AllItems.FindType(TrainTamingStaff.Graphic, TrainTamingStaff.Color);
                            }
                            else if (World.Player.Layers.FindType(TrainTamingStaff.Graphic, TrainTamingStaff.Color).Exist)
                            {
                                currentStaff = World.Player.Backpack.AllItems.FindType(TrainTamingStaff.Graphic, TrainTamingStaff.Color);
                            }

                            Game.Wait();
                        }


                        if (switchToTaming)
                        {
                            currentStaff = EnsuredTamingStaff;
                            Game.Wait();
                        }
                    }
                    if (tries > 2)
                    {
                        if (Journal.Contains(true, "nenauc") || currentStaff.Color == TamingStaffCharged.Color && !World.Player.Layers[Layer.OuterTorso].Exist)
                        {
                            if (World.Player.Backpack.AllItems.FindType(0x1F03).Exist)
                            {
                                World.Player.Backpack.AllItems.FindType(0x1F03).Use();
                                Game.Wait();
                            }
                            else if (World.Player.Backpack.AllItems.FindType(0x1F01).Exist)
                            {
                                World.Player.Backpack.AllItems.FindType(0x1F01).Use();
                                Game.Wait(500);
                            }
                        }
                    }

                    if (kill)
                    {
                        this.KillCharacter(character);
                    }

                    if (end)
                    {
                        Game.PrintMessage("While - end: " + tries);
                        //   doneList.Remove(character.Serial);
                        break;
                    }
                }
                tries++;
                Game.PrintMessage("While - cyklus pokus: " + tries);
            }

            foreach (UOItem item in World.Ground)
            {
                if (item.Distance < 5)
                {
                    bool isKlamak = false;
                    foreach (Graphic g in Taming2.ShrinkKlamaci)
                    {
                        if (item.Graphic == g)
                        {
                            isKlamak = true;
                        }
                    }

                    if (Array.IndexOf(ItemLibrary.ShrinkKlamaci.GraphicArray, item.Graphic) > -1 || Array.IndexOf(ShrinkKlamaci, item.Graphic) > -1 || isKlamak)
                    {
                        item.Move(1, (ushort)(World.Player.X + 1), (ushort)(World.Player.Y + 1), item.Z);
                        Game.Wait(150);
                        item.Move(1, World.Player.Backpack, 30, 30);
                        Game.Wait(150);
                    }
                }
            }

            Game.PrintMessage("While - END");
            if (World.Player.Backpack.AllItems.FindType(0x1F03).Exist)
            {
                World.Player.Backpack.AllItems.FindType(0x1F03).Use();
                Game.Wait(250);
            }
            else if (World.Player.Backpack.AllItems.FindType(0x1F01).Exist)
            {
                World.Player.Backpack.AllItems.FindType(0x1F01).Use();
                Game.Wait(250);
            }
        }
Пример #8
0
        //---------------------------------------------------------------------------------------------

        public void TrainTamingRecusive(int maxTries, params string[] positionsDefinition)
        {
            Robot r = new Robot();

            r.UseTryGoOnly     = true;
            r.UseMinWait       = true;
            r.UseRun           = true;
            r.SearchSuqareSize = 450;
            this.doneList      = new List <Serial>();


            string[] locations = positionsDefinition;

            foreach (string loc in locations)
            {
                string[] options = loc.Split('|');

                int    button   = -1;
                string bookType = "r";

                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);
                }

                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);
                        }
                    }
                }

                for (int i = 1; i < options.Length; i++)
                {
                    if (UO.Dead)
                    {
                        return;
                    }

                    string[] parm = options[i].Split('.');

                    string   x         = parm[0];
                    string[] y         = parm[1].Split(new string[] { "//" }, StringSplitOptions.RemoveEmptyEntries);
                    string   placeName = "";
                    if (y.Length > 1)
                    {
                        placeName = y[1];
                    }


                    UOPositionBase pos = new UOPositionBase(ushort.Parse(x), ushort.Parse(y[0]), (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;

                    Game.PrintMessage("GoTo: " + pos);
                    if (r.GoTo(pos, distance, gotries))
                    {
                        Game.PrintMessage("In position: " + pos);

                        if (parm[parm.Length - 1].ToLower() == "opendoor")
                        {
                            ItemHelper.OpenDoorAll();
                            Game.Wait();


                            if (World.Player.Layers[Layer.OuterTorso].Exist)
                            {
                                World.Player.Layers[Layer.OuterTorso].Move(1, World.Player.Backpack);
                                Game.Wait();
                            }
                        }

                        List <UOCharacter> characters = new List <UOCharacter>();
                        characters.AddRange(World.Characters);
                        characters.Sort(delegate(UOCharacter char1, UOCharacter char2)
                        {
                            return(char1.Distance.CompareTo(char2.Distance));
                        });

                        foreach (UOCharacter character in characters)
                        {
                            if (UO.Dead)
                            {
                                return;
                            }

                            Game.Wait(50);

                            if (character.Distance < 6 && character.Serial != World.Player.Serial && !doneList.Contains(character.Serial) && character.Model != 0x0190 && character.Model != 0x0191 && character.Model != 0x0192)
                            {
                                SkillValue atSkill = SkillsHelper.GetSkillValue("Animal Taming");
                                bool       isBird  = character.Model == 0x0006;

                                World.Player.PrintMessage(isBird + " / " + atSkill.Value);

                                if (isBird && atSkill.RealValue > 450)
                                {
                                    World.Player.PrintMessage("Try Kill.");
                                    UO.Cast(StandardSpell.Harm, character.Serial);
                                    Game.Wait(3000);

                                    if (character.Exist)
                                    {
                                        UO.Cast(StandardSpell.Harm, character.Serial);
                                        Game.Wait(2500);
                                    }
                                    //World.Player.PrintMessage("Try Kill result: " + KillCharacter(character));
                                }
                                else
                                {
                                    this.TameCharacter(character, maxTries);
                                    doneList.Add(character);
                                }

                                //if (!isBird || atSkill.RealValue < 450)
                                //{

                                //}
                                //else
                                //{

                                //}
                            }
                        }
                    }
                    //else
                    //  Phoenix.Runtime.RuntimeCore.Executions.Terminate(musicRun.ManagedThreadId);
                }
            }

            if (UO.Dead)
            {
                return;
            }

            TrainTamingRecusive(maxTries, positionsDefinition);
        }
Пример #9
0
        public void Hide(int highlightTime, ushort highlightColor, int counterStep)
        {
            Journal.Clear();
            Game.CurrentGame.CurrentPlayer.SwitchWarmode();

            StandardSkill usedSkill = StandardSkill.Hiding;

            SkillValue hidingSV  = SkillsHelper.GetSkillValue("Hiding");
            SkillValue stealthSV = SkillsHelper.GetSkillValue("Stealth");

            if (stealthSV.RealValue > hidingSV.RealValue)
            {
                usedSkill = StandardSkill.Stealth;
            }

            if (World.Player.Layers[Layer.LeftHand].Graphic == 0x0A15)//lantern
            {
                UOItem shield = new UOItem(Serial.Invalid);

                List <UOItem> items = new List <UOItem>();
                items.AddRange(World.Player.Backpack.Items);

                foreach (UOItem item in items)
                {
                    foreach (Graphic g in ItemLibrary.Shields.GraphicArray)
                    {
                        if (item.Graphic == g && (!shield.Exist || shield.Graphic != 0x1B76))
                        {
                            shield = item;
                        }
                    }
                }

                if (shield.Exist)
                {
                    shield.Use();
                }
                else
                {
                    World.Player.Layers[Layer.LeftHand].Move(1, World.Player.Backpack, 100, 30);
                }

                Game.Wait(150);
            }
            //UOItem whWepna = World.Player.FindColor(0x0B60, new Graphic[] { 0x143A, 0x1404, 0x0F62, 0x13B9, 0x0F5C, 0x1438, 0x0F60, 0x0F5E, 0x0E87 });        //Nightstone zbran u WJ
            //if (whWepna.Exist && whWepna.Layer != Layer.LeftHand && whWepna.Layer != Layer.RightHand)
            //{
            //  whWepna.Use();
            //  Game.Wait(150);
            //  Targeting.ResetTarget();

            //}

            Game.RunScript(3000);

            AsyncCounter counter = new AsyncCounter();

            counter.PrefixText = "";
            if (highlightTime > 0)
            {
                counter.HighlightTime = highlightTime;
            }

            if (highlightColor > 0)
            {
                counter.HighlightColor = highlightColor;
            }

            Hiding.HideRunning = true;
            UO.UseSkill(usedSkill);
            Game.Wait(50);
            counter.Step        = counterStep;
            counter.StopMessage = "You can't seem to hide here,You have hidden yourself well";
            counter.StopMethod  = IsHidden;
            counter.Run();
        }
Пример #10
0
        public void HideRay(int highlightTime, ushort highlightColor, int counterStep)
        {
            Journal.Clear();


            StandardSkill usedSkill = StandardSkill.Hiding;

            SkillValue hidingSV  = SkillsHelper.GetSkillValue("Hiding");
            SkillValue stealthSV = SkillsHelper.GetSkillValue("Stealth");

            if (stealthSV.RealValue > hidingSV.RealValue)
            {
                usedSkill = StandardSkill.Stealth;
            }

            if (World.Player.Layers[Layer.LeftHand].Graphic == 0x0A15)//lantern
            {
                UOItem shield = new UOItem(Serial.Invalid);

                List <UOItem> items = new List <UOItem>();
                items.AddRange(World.Player.Backpack.Items);

                foreach (UOItem item in items)
                {
                    foreach (Graphic g in ItemLibrary.Shields.GraphicArray)
                    {
                        if (item.Graphic == g && (!shield.Exist || shield.Graphic != 0x1B76))
                        {
                            shield = item;
                        }
                    }
                }

                if (shield.Exist)
                {
                    shield.Use();
                }
                else
                {
                    World.Player.Layers[Layer.LeftHand].Move(1, World.Player.Backpack, 100, 30);
                }

                Game.Wait(250);
            }


            Game.RunScript(3000);

            AsyncCounter counter = new AsyncCounter();

            counter.PrefixText = "";
            if (highlightTime > 0)
            {
                counter.HighlightTime = highlightTime;
            }

            if (highlightColor > 0)
            {
                counter.HighlightColor = highlightColor;
            }

            Hiding.HideRunning = true;

            UO.BandageSelf();
            Game.Wait(100);
            UO.UseSkill(usedSkill);
            Game.Wait(50);
            counter.Step        = counterStep;
            counter.StopMessage = "You can't seem to hide here,You have hidden yourself well";
            counter.StopMethod  = IsHidden;
            counter.Run();
        }
Пример #11
0
        public void Train(string name, string quality, string drinkPotion, bool drink, int manaLimit, params string[] menus)
        {
            Game.PrintMessage("Zvol kontejner s materialem > (esc) = ground");
            UOItem containerFrom = new UOItem(UIManager.TargetObject());

            Game.CurrentGame.Mode = GameMode.Working;

            decimal okCountAlch = 0;
            decimal countAlch   = 0;

            decimal okCount = 0;
            decimal count   = 0;

            bool restart = true;

            while (!UO.Dead)
            {
                Journal.Clear();
                if (!World.Player.Backpack.AllItems.FindType(BlankScroll.Graphic, BlankScroll.Color).Exist)
                {
                    foreach (UOItem item in World.Player.Backpack.AllItems)
                    {
                        if (item.Graphic > 0x1F20 && item.Graphic < 0x1F99)
                        {
                            item.Move(10000, containerFrom);
                            Game.Wait(500);
                        }
                    }

                    UOItem sourceItem = containerFrom.Items.FindType(BlankScroll.Graphic, BlankScroll.Color);
                    if (sourceItem.Exist)
                    {
                        sourceItem.Move(100, World.Player.Backpack);
                        Game.Wait(500);
                    }
                    else
                    {
                        break;
                    }
                }

                if (World.Player.Mana > manaLimit)
                {
                    Game.PrintMessage("Write - " + String.Join(",", menus));
                    UO.UseType(BlankScroll.Graphic, BlankScroll.Color);
                    UO.WaitMenu(menus);
                    Journal.WaitForText(true, 7500, "You fail to inscribe", "You dont't know any", "You put");

                    count++;

                    if (Journal.Contains("You put"))
                    {
                        okCount++;
                    }


                    if (Journal.Contains("You dont't know any"))
                    {
                        Game.PrintMessage("Nemas suroviny");
                        break;
                    }


                    decimal okDivide = (okCount / count);
                    decimal okPerc   = okDivide * 100;
                    Game.PrintMessage("Ks: " + okCount + " / " + count + " - " + String.Format("{0:n} %", okPerc));
                }

                Potion p = PotionCollection.Potions.GetItemByName(drinkPotion);

                UOItem mrKad = null;

                if (p != null)
                {
                    mrKad = new UOItem(World.Player.Backpack.Items.FindType(Potion.KadGraphic, p.TopKadColor));
                    if (mrKad == null || !mrKad.Exist)
                    {
                        mrKad = World.Ground.FindType(Potion.KadGraphic, p.TopKadColor);
                    }
                }

//        Game.PrintMessage("" + (p != null) + " / " + (mrKad != null && mrKad.Exist));

                //new UOItem(World.Player.Backpack.Items.FindType(Potion.KadGraphic, Potion.ManaRefresh.TopKadColor));
                int manaOffset = 60;
                if (p != null && p.Name == "ManaRefresh")
                {
                    manaOffset = 25;
                }

                if (World.Player.Mana < manaLimit || (restart && World.Player.Mana < (World.Player.Intelligence - manaOffset)))
                {
                    restart = false;


                    if (drink && mrKad != null && mrKad.Exist)
                    {
                        Game.CurrentGame.CurrentPlayer.GetSkillInstance <Alchemy>().DrinkPotion(p);
                        Game.Wait(1500);
                        if (Journal.Contains("You can't drink", "You can't "))
                        {
                            Game.Wait(8000);
                            Journal.Clear();
                        }
                    }
                }

                if (World.Player.Mana < manaLimit)
                {
                    World.Player.ChangeWarmode(WarmodeChange.Peace);
                    Game.Wait(250);
                    int    counter     = 0;
                    bool   alchemyOK   = true;
                    double timeCounter = 0;
                    restart = true;
                    long   lastDrink = 0;
                    UOItem atlas     = World.Player.Backpack.AllItems.FindType(AtlasType.Graphic, AtlasType.Color);

                    //while (World.Player.Mana < World.Player.Intelligence)
                    //{
                    Journal.Clear();

                    DateTime start = DateTime.Now;
                    if (!String.IsNullOrEmpty(name) && !String.IsNullOrEmpty(quality) && alchemyOK)
                    {
                        Potion        potion = null;
                        PotionQuality pq     = Potion.ParsePQOrDefault(quality, PotionQuality.Lesser);
                        if ((potion = PotionCollection.Potions.GetItemByName(name)) != null)
                        {
                            Alchemy a = new Alchemy();

                            if (a.GetMixureReagent(containerFrom, potion, pq))
                            {
                                a.FillKadRecursive(potion, pq);
                                if (!a.MixurePotion(potion, pq, false))
                                {
                                    break;
                                }
                                else
                                {
                                    countAlch++;
                                    if (Journal.Contains(true, "You pour"))
                                    {
                                        okCountAlch++;
                                    }

                                    decimal okDivide    = (okCountAlch / countAlch);
                                    decimal okPerc      = okDivide * 100;
                                    int     regAmount   = potion.GetAmountOrDefault(pq);
                                    decimal pricePerPcs = (1 / (okDivide > 0 ? (okCountAlch / countAlch) : 1)) * (decimal)regAmount * 5.0m;//

                                    Game.PrintMessage("Ks: " + okCountAlch + " / " + String.Format("{0:n} %", okPerc) + " Prc: " + String.Format("{0:n} gp", pricePerPcs));
                                }
                            }
                            Game.PrintMessage("Trenovani dokonceno.");
                        }
                        else
                        {
                            alchemyOK = false;
                            Game.PrintMessage("Potion s nazvem " + name + " neexistuje", MessageType.Error);
                        }
                        //WatchDogHelper.Watch();
                    }
                    else if (atlas.Exist && atlas.Amount > 0)
                    {
                        //map 0x14EF

                        foreach (UOItem map in World.Player.Backpack.AllItems)
                        {
                            if (map.Graphic == 0x14EB && map.Color == 0x0000)
                            {
                                UO.WaitTargetObject(map);
                                atlas.Use();
                                Game.Wait();
                            }
                        }

                        if (!World.Player.Backpack.AllItems.FindType(0x14EB, 0x0000).Exist)
                        {
                            UO.WaitTargetSelf();
                            atlas.Use();
                            Game.Wait();
                        }

                        if (World.Player.Backpack.AllItems.FindType(0x14EB, 0x0000).Exist)
                        {
                            UO.WaitMenu("What sort of map do you want to draw ?", "Detail Map");
                            UO.UseType(0x14EB, 0x0000);
                            JournalEventWaiter jew = new JournalEventWaiter(true, "You put the map", "Thy trembling hand results in an unusable map");
                            jew.Wait(5000);
                        }
                    }
                    else if (World.Player.Backpack.AllItems.FindType(0x0E9D).Exist&& SkillsHelper.GetSkillValue("Musicianship").RealValue < 500)
                    {
                        UO.UseType(0x0E9D, 0x0000);
                        if (Journal.WaitForText(true, 2500, "You play poorly"))
                        {
                        }
                        //Game.Wait(1000);

                        if (Journal.Contains(true, " You are preoccupied with thoughts of battle"))
                        {
                            Game.CurrentGame.CurrentPlayer.SwitchWarmode();
                            Game.Wait();
                        }
                    }
                    else if (World.Player.Backpack.AllItems.FindType(0x1438).Exist&& SkillsHelper.GetSkillValue("ItemIdentification").RealValue < 1000)//war hamer
                    {
                        UO.WaitTargetType(0x1438);
                        UO.UseSkill(StandardSkill.ItemIdentification);
                        Game.Wait(1500);
                    }
                    //else if (SkillsHelper.GetSkillValue("DetectingHidden").RealValue < 150)
                    //{
                    //  UO.UseSkill(StandardSkill.DetectingHidden);
                    //  Game.Wait(1000);
                    //}

                    else
                    {
                        UO.UseSkill(StandardSkill.Meditation);
                        Game.Wait(2500);
                    }

                    Game.Wait(100);
                    counter++;



                    double elapsedTime = (DateTime.Now - start).TotalMilliseconds;
                    timeCounter += elapsedTime;

                    int longpartCount = (int)Math.Truncate(timeCounter) / 5000;
                    Game.PrintMessage("Cas:" + (longpartCount * 5000) + " / " + ((longpartCount * 5000) - lastDrink));

                    if ((longpartCount * 5000) - lastDrink > 10000)
                    {
                        lastDrink = (longpartCount * 5000);
                        if (drink && mrKad != null && mrKad.Exist && World.Player.Mana < (World.Player.Intelligence - manaOffset))//        if (World.Player.Mana < 50 || (restart && World.Player.Mana < (World.Player.Intelligence - manaLimit)))
                        {
                            Journal.Clear();
                            Game.CurrentGame.CurrentPlayer.GetSkillInstance <Alchemy>().DrinkPotion(p);
                            Game.Wait(1500);
                        }
                    }
                    //}
                }
            }
        }