Esempio n. 1
0
 public void nhcast(string Spell, Serial Target)
 {
     try
     {
         var mana = World.Player.Mana;
         int tmp  = 0;
         Autoheal.AutoHeal.CastPause = true;
         if (Spell == "frostbolt" || Spell == "necrobolt")
         {
             new UOCharacter(Target).WaitTarget();
             UO.Say(".{0}", Spell);
         }
         else
         {
             UO.Cast(Spell, Target);
         }
         tmp = Math.Abs(mana - World.Player.Mana);
         while (tmp < 5)
         {
             UO.Wait(200);
             tmp = Math.Abs(mana - World.Player.Mana);
         }
     }
     finally
     {
         Autoheal.AutoHeal.CastPause = false;
     }
 }
Esempio n. 2
0
        public void Teleport(Serial target)
        {
            if (new UOCharacter(target).Distance > 12)
            {
                UO.PrintError("Moc daleko");
                return;
            }
            DateTime start;

            UO.Warmode(false);
            if (World.Player.Backpack.AllItems.FindType(0x1F42).Amount > 0)
            {
                new UOObject(target).WaitTarget();
                World.Player.Backpack.AllItems.FindType(0x1F42).Use();
            }
            else
            {
                UO.Cast(StandardSpell.Teleport, target);
            }
            if (!Journal.WaitForText(true, 3300, "Kouzlo se nezdarilo."))
            {
                start = DateTime.Now;
            }
            else
            {
                return;
            }
            UO.Attack(target);
        }
Esempio n. 3
0
        public void ReactiveArmor(Serial target)
        {
            DateTime start;

            UO.Warmode(false);
            if (World.Player.Backpack.AllItems.FindType(0x1F2D).Amount > 0)
            {
                new UOObject(target).WaitTarget();
                World.Player.Backpack.AllItems.FindType(0x1F2D).Use();
            }
            else
            {
                UO.Cast(StandardSpell.ReactiveArmor, target);
            }
            if (!Journal.WaitForText(true, 2000, "Kouzlo se nezdarilo."))
            {
                start = DateTime.Now;
            }
            else
            {
                return;
            }
            while (DateTime.Now - start < TimeSpan.FromSeconds(9))
            {
                UO.Wait(100);
            }
            UO.PrintError("Reactiv vyprsel");
        }
Esempio n. 4
0
        public void selfboost(string type)
        {
            boostBottles["str"] = new UOItem(World.Player.Backpack.AllItems.FindType(0x0F0E, 0x0835));
            boostBottles["dex"] = new UOItem(World.Player.Backpack.AllItems.FindType(0x0F0E, 0x0006));
            boostBottles["int"] = new UOItem(World.Player.Backpack.AllItems.FindType(0x0F0E, 0x06C2));
            boostBottles["def"] = new UOItem(World.Player.Backpack.AllItems.FindType(0x0F0E, 0x0999));

            UOItem head = null;

            foreach (var it in World.Player.Backpack.AllItems.Where(x => HeadGraphics.Any(y => x.Graphic == y)).ToList())
            {
                it.Click();
                UO.Wait(100);
                if (it.Name == World.Player.Name)
                {
                    head = new UOItem(it);
                }
            }
            if (head == null)
            {
                UO.Print("Nemas svou hlavu");
                if (type == "int")
                {
                    UO.Cast(StandardSpell.Cunning, World.Player);
                    UO.Wait(2200);
                    UO.Cast(StandardSpell.Protection, World.Player);
                }
                return;
            }
            try
            {
                Core.RegisterServerMessageCallback(0x1C, onVoodoo);
                done = VoodooState.Fail;
                if (boostBottles[type] == null || boostBottles[type].Serial == 0xFFFFFFFF || boostBottles[type].Serial == Serial.Invalid)
                {
                    UO.PrintError("Nemas {0} lahev.", type);
                    return;
                }
                while (done != VoodooState.Wait)
                {
                    boostBottles[type].WaitTarget();
                    head.Use();
                    UO.Wait(200);
                }
                while (done != VoodooState.Success)
                {
                    UO.Wait(400);
                }
                UO.Wait(100);
            }
            catch (Exception ex) { UO.PrintError(ex.InnerException.Message); }
            finally
            {
                Core.UnregisterServerMessageCallback(0x1C, onVoodoo);
            }
        }
Esempio n. 5
0
        public static void CastWallTest()
        {
            TargetInfo targetInfo = Targeting.GetTarget(null);

            if (targetInfo.Success)
            {
                Game.PrintMessage(String.Format("[" + targetInfo.StaticTarget.X + ":" + targetInfo.StaticTarget.Y + "] {0:N4}", Robot.GetAngle(World.Player.GetPosition(), targetInfo.Position)) + "");

                UO.WaitTargetTile(targetInfo.StaticTarget.X, targetInfo.StaticTarget.Y, targetInfo.StaticTarget.Z, targetInfo.StaticTarget.Graphic);
                UO.Cast(StandardSpell.WallofStone);
            }
        }
Esempio n. 6
0
 public void SipkaKokonNew()
 {
     if (!mamcil)
     {
         int vzdalenost = 0;
         foreach (UOItem k in World.Ground)
         {
             if (k.Graphic == 0x10DC && k.Color == 0x0B77 && k.Distance < 4)
             {
                 if (!mamcil)
                 {
                     cil    = new UOItem(k);
                     mamcil = true;
                 }
                 if (vzdalenost > k.Distance)
                 {
                     vzdalenost = k.Distance;
                     cil        = new UOItem(k);
                 }
             }
         }
     }
     if (mamcil)
     {
         if (!cil.Exist)
         {
             UO.Print("Kokon Znicen");
             mamcil = false;
             return;
         }
         if (cil.Distance < 4)
         {
             UO.PrintObject(cil.Serial, "-CIL-");
             UO.WaitTargetObject(cil);
             UO.Cast("Magic Arrow");
         }
         else
         {
             UO.Print("Si moc daleko");
         }
     }
     else
     {
         UO.Print("Nemam CIL.");
     }
 }
Esempio n. 7
0
 private void HarmSelf(bool attacklast, bool war = false)
 {
     UO.Warmode(false);
     if (war)
     {
         UO.Cast(StandardSpell.MagicArrow, World.Player.Serial);
         UO.Wait(2200);
     }
     else
     {
         UO.Cast(StandardSpell.Harm, World.Player.Serial);
         UO.Wait(1600);
     }
     if (attacklast)
     {
         UO.Warmode(true);
         UO.Attack(Aliases.GetObject("laststatus").IsValid ? Aliases.GetObject("laststatus") : 0x00);
     }
 }
Esempio n. 8
0
        public void Invis()
        {
            UO.Warmode(false);
            UO.Cast("Invis", Aliases.Self);

            if (Journal.WaitForText(true, SpellsDelays["Invis"] / 3, "Kouzlo se nezdarilo."))
            {
                return;
            }
            World.Player.Print(3);
            if (Journal.WaitForText(true, SpellsDelays["Invis"] / 3, "Kouzlo se nezdarilo."))
            {
                return;
            }
            World.Player.Print(2);
            if (!Journal.WaitForText(true, SpellsDelays["Invis"] / 3, "Kouzlo se nezdarilo."))
            {
                World.Player.Print(1);
            }
        }
Esempio n. 9
0
        public void CastSummonCreature(string summonName, TargetAliasResult target)
        {
            Game.RunScript(5000);
            Targeting.ResetTarget();

            CurrentCastingSummon = summonName;
            //World.Player.PrintMessage(summonName);
            Journal.Clear();

            if (!target.IsValid || !new UOObject(target).Exist)
            {
                target = Game.CurrentGame.CurrentHoverStatus;
            }

            if (!target.IsStatic && (!target.IsValid || !new UOObject(target).Exist || new UOObject(target).Distance > 25))
            {
                Magery.TrySetCastingSpell(new CastSpellInfo(StandardSpell.SummonCreature, false, false));
                UO.SummonCreature(summonName);
            }
            else
            {
                Magery.TrySetCastingSpell(new CastSpellInfo(StandardSpell.SummonCreature, false, true));
                UIManager.WaitForMenu(new MenuSelection("What do you want to summon ?", summonName));
                target.WaitTarget();
                UO.Cast("Summ. Creature");

                if (Journal.WaitForText(true, 150, "You can't see the target", "Target is not in line of sight"))
                {
                    if (Journal.Contains(true, "You can't see the target"))
                    {
                        Game.PrintMessage("Cant SEE: " + target + " / " + new UOCharacter(target).Exist + " / " + new UOCharacter(target).Name);
                    }
                    else if (Journal.Contains(true, "Target is not in line of sight"))
                    {
                        UO.PrintObject(target, Game.Val_LightPurple, "[Not in sight]");
                    }
                }
            }
        }
Esempio n. 10
0
        public void TrainAlchemyMag(string name, string quality)
        {
            Game.PrintMessage("TrainAlchemyMag");
            Potion        potion = PotionCollection.Potions.GetItemByName(name);
            PotionQuality pq     = Potion.ParsePQOrDefault(quality, PotionQuality.Lesser);

            Game.PrintMessage("Vyber zdrojovy konterjner s regy:");
            UOItem container = new UOItem(UIManager.TargetObject());

            ItemHelper.EnsureContainer(container);


            decimal okCount = 0;
            decimal count   = 0;

            while (!UO.Dead &&
                   World.Player.Backpack.AllItems.FindType(Reagent.Nightshade.Graphic, Reagent.Nightshade.Color).Exist&&
                   World.Player.Backpack.AllItems.FindType(Reagent.BlackPearl.Graphic, Reagent.BlackPearl.Color).Exist
                   )
            {
                while (World.Player.Mana > 10)
                {
                    if (World.Player.Hits < 40)
                    {
                        while (World.Player.Hits < World.Player.Strenght)
                        {
                            UOItem banda = World.Ground.FindType(0x0E21);//bandy
                            if (!banda.Exist)
                            {
                                return;
                            }

                            UO.WaitTargetSelf();
                            banda.Use();
                            Game.Wait(2500);
                        }
                    }

                    UO.Cast(StandardSpell.MagicArrow, Aliases.Self);
                    Game.Wait(1500);
                }

                while (World.Player.Hits < World.Player.Strenght)
                {
                    UOItem banda = World.Ground.FindType(0x0E21);//bandy
                    if (!banda.Exist)
                    {
                        break;
                    }

                    UO.WaitTargetSelf();
                    banda.Use();
                    Game.Wait(2500);
                }

                //UOItem mrKad = new UOItem(World.Player.Backpack.Items.FindType(Potion.KadGraphic, Potion.ManaRefresh.TopKadColor));
                //UOItem tmrKad = new UOItem(World.Player.Backpack.Items.FindType(Potion.KadGraphic, Potion.TotalManaRefresh.TopKadColor));
                //if (mrKad.Exist || tmrKad.Exist)
                //{
                //  Game.CurrentGame.CurrentPlayer.GetSkillInstance<Alchemy>().DrinkPotion("Total Mana Refresh");
                //  Game.Wait();
                //}
                //else
                {
                    while (GetMixureReagent(container, potion, pq) && World.Player.Mana < World.Player.Intelligence)
                    {
                        FillKadRecursive(potion, pq);
                        if (!MixurePotion(potion, pq))
                        {
                            break;
                        }
                        else
                        {
                            count++;
                            if (Journal.Contains(true, "You pour"))
                            {
                                okCount++;
                            }

                            decimal okDivide  = (okCount / count);
                            decimal okPerc    = okDivide * 100;
                            int     regAmount = potion.GetAmountOrDefault(pq);


                            decimal pricePerPcs = (1 / (okDivide > 0 ? (okCount / count) : 1)) * (decimal)regAmount * 5.0m;//

                            Game.PrintMessage("Ks: " + okCount + " / " + String.Format("{0:n} %", okPerc) + " Prc: " + String.Format("{0:n} gp", pricePerPcs));
                        }
                    }
                }
            }
            Game.PrintMessage("TrainAlchemyMag END");
        }
Esempio n. 11
0
        public void HideRay(int highlightTime, ushort highlightColor, int counterStep)
        {
            Journal.Clear();

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

            UO.UseSkill(usedSkill);

            bool needAction = false;

            if (Journal.WaitForText(true, 200, "You are preoccupied with thoughts of battle"))
            {
                Game.CurrentGame.CurrentPlayer.SwitchWarmode();
                needAction = true;
            }
            // if (stealthSV.RealValue > hidingSV.RealValue)
            // usedSkill = StandardSkill.Stealth;


            //You are preoccupied with thoughts of battle



            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;

            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);
            counter.Step        = counterStep;
            counter.StopMessage = "You can't seem to hide here,You have hidden yourself well";
            counter.StopMethod  = IsHidden;
            counter.Run();
        }
Esempio n. 12
0
 public void Dispel()
 {
     UO.Cast(StandardSpell.Dispel, Target);
 }
Esempio n. 13
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);
        }
Esempio n. 14
0
        public static void StayAndFight(int distance, int hpMin, bool boost, bool reversePath, string path, string summonName, int summonCount)
        {
            ManualLastTarget.SwitchShowStatusBar();
            int initGold = World.Player.Gold;
            int initFD   = World.Player.Backpack.AllItems.FindType(0x103D, 0x0B52).Amount;
            //Serial: 0x4023CD57  Name: "Fairy Dust"  Position: 136.144.0  Flags: 0x0020  Color: 0x0B52  Graphic: 0x103D  Amount: 4  Layer: None  Container: 0x4019287E

            PlayerClass pclass = Game.CurrentGame.CurrentPlayer.PlayerClass;

            UOPosition zero = new UOPosition(World.Player.X, World.Player.Y, (ushort)World.Player.Z);

            CalebConfig.AutoHeal = true;
            World.Player.ChangeWarmode(WarmodeChange.War);
            Game.Wait();

            short         maxHitsBase   = World.Player.MaxHits;
            DateTime?     lastBoostTime = null;
            List <Serial> deny          = new List <Serial>();
            UOCharacter   current       = null;
            Robot         r             = new Robot();
            Robot         r2            = new Robot();
            Robot         r3            = new Robot();
            Loot          l             = new Loot();
            DateTime      startTime     = DateTime.Now;

            Hashtable htKilled = new Hashtable();

            int walkCounter = 0;

            GotoEventHandler beforeMoveHandler = (sender, e) =>
            {
                ushort x = e.Destination.X.GetValueOrDefault();
                ushort y = e.Destination.Y.GetValueOrDefault();
                walkCounter++;

                if (Game.CurrentGame.Mobs.Count > 0 && (walkCounter % 15) == 0)
                {
                    new Thread(new ThreadStart(MobMaster.Current.MobCome)).Start();
                }

                foreach (UOItem item in World.Ground)
                {
                    if (item.Graphic == 0x0DDA && item.X == x && item.Y == y)
                    {
                        e.IvalidDestination = true;
                    }
                }
            };

            GotoEventHandler beforeMoveHandler2 = (sender, e) =>
            {
                walkCounter++;
                if (current != null && e.Tries > 5)
                {
                    List <UOCharacter> chars = new List <UOCharacter>();
                    chars.AddRange(World.Characters.Where(ch => (ch.Notoriety == Notoriety.Enemy || ch.Notoriety == Notoriety.Murderer) && ch.Distance <= distance && !deny.Contains(ch.Serial) && !Characters.IsSummon(ch) && ch.Serial != World.Player.Serial).OrderBy(ch => ch.Distance).ThenBy(ch => ch.MaxHits).ToArray());


                    if (Game.CurrentGame.Mobs.Count > 0 && (walkCounter % 15) == 0)
                    {
                        new Thread(new ThreadStart(MobMaster.Current.MobCome)).Start();
                    }

                    foreach (UOCharacter ch in chars)
                    {
                        if (ch.Distance < current.Distance)
                        {
                            e.Abort = true;
                            break;
                        }
                    }
                }
            };

            GotoEventHandler beforeMoveHandler3 = (sender, e) =>
            {
                walkCounter++;
                List <UOCharacter> chars = new List <UOCharacter>();
                chars.AddRange(World.Characters.Where(ch => (ch.Notoriety == Notoriety.Enemy || ch.Notoriety == Notoriety.Murderer) && ch.Distance <= distance && !deny.Contains(ch.Serial) && !Characters.IsSummon(ch) && ch.Serial != World.Player.Serial).OrderBy(ch => ch.Distance).ThenBy(ch => ch.MaxHits).ToArray());

                if (Game.CurrentGame.Mobs.Count > 0 && (walkCounter % 15) == 0)
                {
                    new Thread(new ThreadStart(MobMaster.Current.MobCome)).Start();
                }


                foreach (UOCharacter ch in chars)
                {
                    if (current == null || ch.Distance < current.Distance)
                    {
                        e.Abort = true;
                        break;
                    }
                }
            };

            List <IUOPosition> posPath = new List <IUOPosition>();

            posPath.Add(new UOPositionBase(World.Player.X, World.Player.Y, (ushort)World.Player.Z));

            if (!String.IsNullOrEmpty(path))
            {
                posPath.AddRange(UOPositionBase.ParseList(path));
            }

            r2.BeforeMove += beforeMoveHandler;
            r2.BeforeMove += beforeMoveHandler2;
            r.BeforeMove  += beforeMoveHandler;

            r3.BeforeMove += beforeMoveHandler;
            r3.BeforeMove += beforeMoveHandler3;

            int pathIndex = 0;

            Poisoning p = new Poisoning();

            while (!UO.Dead)
            {
                if (boost)
                {
                    if (lastBoostTime == null || (DateTime.Now - lastBoostTime).Value.TotalMilliseconds > 180000)
                    {
                        Game.RunScript(8000);
                        lastBoostTime = DateTime.Now;
                        Game.PrintMessage("Try booost...");
                        UO.Cast(StandardSpell.ReactiveArmor, Aliases.Self);
                        Game.Wait(2500);
                        Game.RunScript(4000);
                        UO.Cast(StandardSpell.Strength, Aliases.Self);
                        Game.Wait(3500);
                        Game.RunScript(4000);
                        UO.Cast(StandardSpell.Protection, Aliases.Self);
                        Game.Wait(3500);
                    }
                }

                List <UOCharacter> chars = new List <UOCharacter>();
                chars.AddRange(World.Characters.Where(ch => (ch.Notoriety == Notoriety.Enemy || ch.Notoriety == Notoriety.Murderer) && ch.Distance <= distance && !Characters.IsSummon(ch) && ch.Serial != World.Player.Serial).OrderBy(ch => ch.Distance).ThenBy(ch => ch.MaxHits).ToArray());

                foreach (UOCharacter ch in chars)
                {
                    bool isVladimirSkorp = ch.Model == 0x0030 && ch.Color == 0x0B78;

                    if (deny.Contains(ch.Serial) && ch.Distance > 2)
                    {
                        continue;
                    }

                    ch.RequestStatus(500);
                    ch.Click();
                    Game.Wait();

                    if (World.Player.Hits <= hpMin)
                    {
                        while (World.Player.Hits < hpMin)
                        {
                            Game.Wait(500);
                        }
                    }

                    ch.Print(Game.Val_GreenBlue, "[killing...]");

                    current = ch;

                    if (!String.IsNullOrEmpty(summonName) && World.Player.Layers[Layer.Hat].Graphic == 0x1451 && Game.CurrentGame.Mobs.Count < summonCount && World.Player.Mana > 20)
                    {
                        Magery.ExecCastSummonCreature(summonName, "Self");
                        Game.Wait(4000);
                        MobMaster.Current.MobStop();
                    }

                    for (int i = 0; i < Game.CurrentGame.Mobs.Count; i++)
                    {
                        MobMaster.Current.MobKill();
                        Game.Wait(250);
                    }

                    if (ch.Exist && ch.Hits > 0 && ch.Distance < 50 && r2.GoTo(ch.X, ch.Y, 1, 25))
                    {
                        UOItem trainKit = World.Player.Backpack.AllItems.FindType(Poisoning.TrainKit.Graphic, Poisoning.TrainKit.Color);

                        if (trainKit.Exist)
                        {
                            p.TrainPoisEngage();
                        }



                        while (ch.Exist && ch.Hits > 0)
                        {
                            if (!Game.CurrentGame.WorldSave())
                            {
                                //Serial: 0x401E33B3  Position: 0.0.0  Flags: 0x0000  Color: 0x0000  Graphic: 0x1451  Amount: 0  Layer: Hat Container: 0x0037EAF7

                                if (!String.IsNullOrEmpty(summonName) && World.Player.Layers[Layer.Hat].Graphic == 0x1451 && Game.CurrentGame.Mobs.Count < summonCount && World.Player.Mana > 20)
                                {
                                    Magery.ExecCastSummonCreature(summonName, "Self");
                                    Game.Wait(4000);
                                    MobMaster.Current.MobStop();
                                }



                                if (ch.Exist && ch.Hits > 0 && ch.Distance > 1 && ch.Distance < 30)
                                {
                                    Game.PrintMessage("HUNT... " + new UOPositionBase(ch.X, ch.Y, 0));
                                    Game.RunScript(500);
                                    Game.Wait(500);
                                    UO.Attack(ch.Serial);



                                    if (!r.GoTo(ch.X, ch.Y, 1, 5))
                                    {
                                        break;
                                    }
                                }

                                htKilled[ch.Serial] = ch;

                                UO.Attack(ch.Serial);
                                Game.RunScript(1500);
                                Game.Wait(1000);


                                for (int i = 0; i < Game.CurrentGame.Mobs.Count; i++)
                                {
                                    MobMaster.Current.MobKill();
                                    Game.Wait(250);
                                }

                                if (World.Player.Hits <= hpMin)
                                {
                                    while (World.Player.Hits < hpMin)
                                    {
                                        if (pclass == PlayerClass.Vampire)
                                        {
                                            if (Game.CurrentGame.CanDrink)
                                            {
                                                Alchemy.ExecDrinkPotion("Blood");
                                                Game.Wait(500);
                                            }

                                            if (World.Player.Hits < 45)
                                            {
                                                Vampire.SnezBandu();
                                                Game.Wait(500);
                                            }
                                        }
                                        else
                                        {
                                            if (Game.CurrentGame.CanDrink && Potion.Heal.ContainsTopKad(World.Player.Backpack))
                                            {
                                                Alchemy.ExecDrinkPotion("Heal");
                                                Game.Wait(150);
                                            }
                                        }

                                        if (World.Player.Hits < hpMin)
                                        {
                                            Game.RunScript(5);
                                            //  Game.CurrentGame.SwitchWarRunOff();

                                            Game.Wait(2500);
                                        }


                                        if (Game.CurrentGame.Mobs.Count > 0)
                                        {
                                            if (!ch.Exist)
                                            {
                                                MobMaster.Current.MobStop();
                                                Game.Wait(150);
                                            }
                                            else
                                            {
                                                MobMaster.Current.MobKill();
                                                Game.Wait(150);
                                            }
                                        }
                                    }
                                }

                                if (ch.Exist && ch.Hits > 0 && ch.Distance > 1 && ch.Distance < 30)
                                {
                                    Game.PrintMessage("HUNT... " + new UOPositionBase(ch.X, ch.Y, 0));

                                    if (!r.GoTo(ch.X, ch.Y, 1, 5))
                                    {
                                        break;
                                    }
                                }
                            }
                            else
                            {
                                Game.Wait(2500);
                            }
                        }

                        if (!ch.Exist)
                        {
                            if (isVladimirSkorp && World.Player.Backpack.Items.FindType(0x227B, 0x0697).Exist)
                            {
                                Game.UseTypeCust(0x227B, 0x0697, "nearestcorpse", "[Target]", "[Ladislav]");
                            }

                            if (Game.CurrentGame.Mobs.Count > 0)
                            {
                                MobMaster.Current.MobCome();
                            }

                            Game.PrintMessage("KILLED...");
                            Game.Wait(1500);
                            current = null;
                            break;
                        }
                    }
                    else
                    {
                        Game.PrintMessage("Deny ADD " + ch.Name);
                        deny.Add(ch.Serial);
                        break;
                    }
                }

                l.LootGround(Loot.LootType.QuickCut);

                if (chars.Count == 0 || chars.Count - deny.Count <= 0)
                {
                    pathIndex++;
                    if (pathIndex > posPath.Count - 1)
                    {
                        if (reversePath)
                        {
                            posPath.Reverse();
                        }
                        pathIndex = 0;
                    }

                    Game.PrintMessage("Goto Next " + posPath[pathIndex]);
                    deny.Clear();
                    Game.Wait(500);

                    if (!r3.GoTo(posPath[pathIndex], 0, 500))
                    {
                        Game.PrintMessage("Cant go to NEXT " + posPath[pathIndex]);
                        continue;
                    }
                    else
                    {
                        Game.PrintMessage(posPath[pathIndex].ToString() + " - Com:" + posPath[pathIndex].CommandName);


                        if (!String.IsNullOrEmpty(posPath[pathIndex].CommandName))
                        {
                            if (posPath[pathIndex].CommandName.ToLower() == "opendoor")
                            {
                                ItemHelper.OpenDoorAll();
                                Game.Wait();
                            }
                        }

                        //,exec stayandfight 5 110 false true "5125.1152|5122.1163|5124.1178|5124.1185|5124.1185.0.OpenDoor|5124.1187.0.OpenDoor|5125.1188|5125.1198|5125.1209|5137.1208|5143.1207|5156.1208|5167.1209|5181.1209|5182.1212|5188.1211|5188.1201|5188.1193|5180.1193"

                        Game.PrintMessage(String.Format("Zabito {0} za {1:N0} min. Gold: {2}, FD: {3}", htKilled.Values.Count, (DateTime.Now - startTime).TotalMinutes, World.Player.Gold - initGold, World.Player.Backpack.AllItems.FindType(0x103D, 0x0B52).Amount - initFD));
                    }
                }
            }
        }
Esempio n. 15
0
        //---------------------------------------------------------------------------------------------

        public void TrainMagery()
        {
            Game.PrintMessage("TrainMagery");
            Game.CurrentGame.Mode = GameMode.Working;
            while (!UO.Dead &&
                   World.Player.Backpack.AllItems.FindType(Reagent.Nightshade.Graphic, Reagent.Nightshade.Color).Exist&&
                   World.Player.Backpack.AllItems.FindType(Reagent.BlackPearl.Graphic, Reagent.BlackPearl.Color).Exist
                   )
            {
                while (World.Player.Mana > 10)
                {
                    if (World.Player.Hits < 40)
                    {
                        while (World.Player.Hits < World.Player.Strenght)
                        {
                            UOItem banda = World.Ground.FindType(0x0E21);//bandy
                            if (!banda.Exist)
                            {
                                return;
                            }

                            UO.WaitTargetSelf();
                            banda.Use();
                            Game.Wait(2500);
                        }
                    }

                    UO.Cast(StandardSpell.MagicArrow, Aliases.Self);
                    Game.Wait(1500);
                }

                while (World.Player.Hits < World.Player.Strenght)
                {
                    UOItem banda = World.Ground.FindType(0x0E21);//bandy
                    if (!banda.Exist)
                    {
                        break;
                    }

                    UO.WaitTargetSelf();
                    banda.Use();
                    Game.Wait(2500);
                }


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

                if (!mrKad.Exist)
                {
                    mrKad = World.Ground.FindType(Potion.KadGraphic, Potion.TotalManaRefresh.TopKadColor);
                }
                //       UOItem tmrKad = new UOItem(World.Player.Backpack.Items.FindType(Potion.KadGraphic, Potion.TotalManaRefresh.TopKadColor));
                if (mrKad.Exist)
                {
                    Game.CurrentGame.CurrentPlayer.GetSkillInstance <Alchemy>().DrinkPotion(Potion.ManaRefresh);
                    Game.Wait();
                }
                else
                {
                    while (World.Player.Mana < World.Player.Intelligence)
                    {
                        UO.UseSkill(StandardSkill.Meditation);
                        Game.Wait(2500);
                    }
                }
            }
            Game.PrintMessage("TrainMagery END");
        }
Esempio n. 16
0
        //---------------------------------------------------------------------------------------------

        /// <summary>
        /// Obecne kouzleni hlava + svitky, svitky omezena podpora na to co je SpellScrool, co chybi napsat dodela. Nefunguje na nekro kouzla. Pokud je kouzlo vypsano nad hlavou zelene = SVITEK
        /// </summary>
        /// <param name="spell">Kouzlo</param>
        /// <param name="target">Cil = pokud Serial.Invalid resp. null tak vyhodi tercik</param>
        /// <param name="useScrool">Pouzij svitek, pokud je, jinak hlava</param>
        /// <param name="useSwitchHeadScrool">Stridej svitek a hlavu, tj. uchovava si ke kazdemu kouzlo co bylo kouzleno naposled</param>
        /// <param name="silence">Nevypise nad hlavu jmeno kouzla + lvl, pouziva se v kodu kde chcete si vypadt neco extra</param>
        /// <param name="forceScrool">Vynutit svite, pokud neni svitek tak nekouzli a v CastResiltInfu vrat FALSe</param>
        /// <returns></returns>
        public CastResultInfo CastSpell(StandardSpell spell, Serial target, bool useScrool, bool useSwitchHeadScrool, bool silence, bool forceScrool)
        {
            Game.CheckStopBanding();
            Targeting.ResetTarget();
            Journal.Clear();

            CastResultInfo info = new CastResultInfo();

            info.Usage = useScrool ? CastUsage.Scrool : CastUsage.Head;

            if (htSwitch == null)
            {
                htSwitch = new Hashtable();
            }

            int circle = GetSpellCircle(spell);

            UOCharacter ch = new UOCharacter(target);

            if (ch.Exist && String.IsNullOrEmpty(ch.Name))
            {
                ch.Click();
                Game.Wait(50, true);
            }

            if (spell == StandardSpell.SummonCreature && !String.IsNullOrEmpty(this.selectedSummon))
            {
                Game.RunScript(5000);
                this.CastSummonCreature(this.selectedSummon, target);
            }
            else
            {
                if (htSwitch[spell] == null)
                {
                    htSwitch[spell] = info.Usage;
                }
                else if (useSwitchHeadScrool && !forceScrool)
                {
                    CastUsage currentUsage = (CastUsage)htSwitch[spell];
                    if (currentUsage == CastUsage.Head)
                    {
                        info.Usage = CastUsage.Scrool;
                    }
                    else
                    {
                        info.Usage = CastUsage.Head;
                    }
                }

                bool waitForScrool = false;
                if (info.Usage == CastUsage.Scrool && lastScrool.HasValue)
                {
                    double currentTimeout = GetScroolTimeout();
                    double currentTime    = (DateTime.Now - lastScrool.Value).TotalSeconds;

                    if (currentTime < currentTimeout)
                    {
                        waitForScrool = true;
                        if (!forceScrool)
                        {
                            info.Usage = CastUsage.Head;
                        }
                        Game.PrintMessage(String.Format("Scroll za! {0:N1}s", currentTimeout - currentTime));
                    }
                }

                //TODO zjistit Flag na jsem parnutej
                if (info.Usage == CastUsage.Scrool && !waitForScrool)
                {
                    if (SpellScrool.ContainsKey(spell) && World.Player.Backpack.AllItems.FindType(SpellScrool[spell]).Exist)
                    {
                        if (!target.IsValid || !new UOObject(target).Exist)
                        {
                            Magery.TrySetCastingSpell(new CastSpellInfo(spell, true, silence));
                            World.Player.Backpack.AllItems.FindType(SpellScrool[spell]).Use();

                            if (!Journal.WaitForText(true, 250, "You can't reach that", "You can't cast", "You can't read that"))
                            {
                                lastScrool   = DateTime.Now.AddMilliseconds(-250);
                                info.Usage   = CastUsage.Scrool;
                                info.Success = true;
                            }
                            else if (!forceScrool)
                            {
                                info.Usage = CastUsage.Head;
                            }
                        }
                        else
                        {
                            Magery.TrySetCastingSpell(new CastSpellInfo(spell, true, silence));

                            UO.WaitTargetObject(target);
                            World.Player.Backpack.AllItems.FindType(SpellScrool[spell]).Use();

                            if (!Journal.WaitForText(true, 250, "You can't reach that", "You can't cast", "You can't read that"))
                            {
                                lastScrool   = DateTime.Now.AddMilliseconds(-250);
                                info.Usage   = CastUsage.Scrool;
                                info.Success = true;
                            }
                            else if (!forceScrool)
                            {
                                info.Usage = CastUsage.Head;
                            }
                        }
                    }
                    else if (!forceScrool)
                    {
                        info.Usage = CastUsage.Head;
                    }
                }

                ushort color = CalStatusMessage.Val_InfoColor;
                //if (info.Usage == CastUsage.Scrool)
                //{
                //  color = Game.Val_Green;
                //  if (!silence)
                //    World.Player.PrintMessage(spell + " [" + World.Player.Backpack.AllItems.FindType(SpellScrool[spell]).Amount + "ks]", color);
                //}

                htSwitch[spell] = info.Usage;

                if (info.Usage == CastUsage.Head)
                {
                    //Game.RunScript(Magery.GetCircleRunscriptTime(Magery.GetSpellCircle(spell)));

                    if (!target.IsValid || !new UOObject(target).Exist || new UOObject(target).Distance > 30)
                    {
                        Magery.TrySetCastingSpell(new CastSpellInfo(spell, false, silence));
                        UO.Cast(spell);
                    }
                    else
                    {
                        Magery.TrySetCastingSpell(new CastSpellInfo(spell, false, silence));
                        UO.Cast(spell, target);

                        if (Journal.WaitForText(true, 150, "You can't see the target", "Target is not in line of sight"))
                        {
                            if (Journal.Contains(true, "You can't see the target"))
                            {
                                info.CantSee = true;

                                Game.PrintMessage("Cant SEE: " + target + " / " + new UOCharacter(target).Exist + " / " + new UOCharacter(target).Name);

                                info.Success = CastSpell(spell, Serial.Invalid, useScrool, useSwitchHeadScrool, silence, forceScrool).Success;
                            }
                            else if (Journal.Contains(true, "Target is not in line of sight"))
                            {
                                info.NoInLineOfSight = true;

                                new UOObject(target).PrintMessage("[Not in sight]", Game.Val_LightPurple);
                            }
                        }
                        else
                        {
                            if (ch.Exist && !silence &&
                                (spell == StandardSpell.Harm ||
                                 spell == StandardSpell.FlameStrike ||
                                 spell == StandardSpell.MagicArrow ||
                                 spell == StandardSpell.Lightning ||
                                 spell == StandardSpell.Clumsy ||
                                 spell == StandardSpell.Curse ||
                                 spell == StandardSpell.EnergyBolt ||
                                 spell == StandardSpell.Feeblemind ||
                                 spell == StandardSpell.MindBlast ||
                                 spell == StandardSpell.Paralyze)
                                )
                            {
                                if (target != World.Player.Serial)
                                {
                                    new UOObject(target).PrintMessage(String.Format("[{0}/{1}]", ch.Hits, ch.MaxHits), ch.Notoriety == Notoriety.Murderer || ch.Notoriety == Notoriety.Enemy ? Game.GetEnemyColorByHits(target) : Game.GetAlieColorByHits(target));
                                }
                            }
                        }
                    }

                    if (Journal.WaitForText(true, 100, "The spell is not in your spellbook"))
                    {
                        info.Success        = false;
                        info.NotInSpellBook = true;
                        Targeting.ResetTarget();
                    }
                    else if (!info.CantReach)
                    {
                        info.Success = true;
                    }
                }
                else
                {
                    Game.PrintMessage(spell + ": " + World.Player.Backpack.AllItems.FindType(SpellScrool[spell]).Amount + "");
                }
            }


            return(info);
        }
Esempio n. 17
0
 public void Gate()
 {
     new UOItem(Id).WaitTarget();
     UO.Cast(StandardSpell.GateTravel);
 }
Esempio n. 18
0
 public void Recall()
 {
     new UOItem(Id).WaitTarget();
     UO.Cast(StandardSpell.Recall);
 }
Esempio n. 19
0
        public void Autocast(string Spell, bool charged, Serial target)
        {
            int  spellsNum   = 5;
            int  chargeNum   = 3;
            bool firstCharge = true;

            if (acast)
            {
                acast = false;
                UO.PrintError("Autocast OFF");
            }
            else
            {
                acast = true;
                UO.PrintError("Autocast ON");
                UOCharacter targ  = new UOCharacter(target);
                DateTime    start = DateTime.Now;
                while (acast)
                {
                    if (targ.Hits < 1 || targ.Hits > 200 || targ.Dead || !targ.Exist)
                    {
                        acast = false;
                        UO.PrintError("Autocast OFF");
                        return;
                    }

                    switch (Spell)
                    {
                    case "Harm":
                        UO.Cast(StandardSpell.Harm, target);
                        UO.Wait(SpellsDelays[Spell]);
                        break;

                    case "Fireball":
                        UO.Cast(StandardSpell.Fireball, target);
                        UO.Wait(SpellsDelays[Spell]);
                        break;

                    case "Flame":
                        if (charged)
                        {
                            for (int i = 0; i < chargeNum; i++)
                            {
                                if (!acast)
                                {
                                    return;
                                }
                                if (targ.Hits < 1 || targ.Hits > 200 || targ.Dead || !targ.Exist)
                                {
                                    acast = false;
                                    UO.PrintError("Autocast OFF");
                                    return;
                                }
                                UO.Cast(StandardSpell.Fireball, target);
                                UO.Wait(SpellsDelays["Fireball"]);
                                if (!firstCharge)
                                {
                                    break;
                                }
                            }

                            if (!acast)
                            {
                                return;
                            }
                            UO.Cast(StandardSpell.FlameStrike, target);
                            UO.Wait(SpellsDelays[Spell]);
                        }
                        else
                        {
                            UO.Cast(StandardSpell.FlameStrike, target);
                            UO.Wait(SpellsDelays[Spell]);
                        }
                        break;

                    case "Meteor":
                        UO.Cast(StandardSpell.MeteorShower, target);
                        UO.Wait(SpellsDelays[Spell]);
                        break;

                    case "Bolt":
                        if (charged)
                        {
                            for (int i = 0; i < chargeNum; i++)
                            {
                                if (!acast)
                                {
                                    return;
                                }
                                if (targ.Hits < 1 || targ.Hits > 200 || targ.Dead || !targ.Exist)
                                {
                                    acast = false;
                                    UO.PrintError("Autocast OFF");
                                    return;
                                }
                                UO.Cast(StandardSpell.Lightning, target);
                                UO.Wait(SpellsDelays["Lightning"]);
                                if (!firstCharge)
                                {
                                    break;
                                }
                            }
                            if (firstCharge)
                            {
                                firstCharge = false;
                            }
                            for (int i = 0; i < spellsNum; i++)
                            {
                                if (!acast)
                                {
                                    return;
                                }
                                if (targ.Hits < 1 || targ.Hits > 200 || targ.Dead || !targ.Exist)
                                {
                                    acast = false;
                                    UO.PrintError("Autocast OFF");
                                    return;
                                }
                                UO.Cast(StandardSpell.EnergyBolt, target);
                                UO.Wait(SpellsDelays[Spell]);
                            }
                        }
                        else
                        {
                            UO.Cast(StandardSpell.EnergyBolt, target);
                            UO.Wait(SpellsDelays[Spell]);
                        }
                        break;

                    case "Mind":
                        if (charged)
                        {
                            for (int i = 0; i < chargeNum; i++)
                            {
                                if (!acast)
                                {
                                    return;
                                }
                                if (targ.Hits < 1 || targ.Hits > 200 || targ.Dead || !targ.Exist)
                                {
                                    acast = false;
                                    UO.PrintError("Autocast OFF");
                                    return;
                                }
                                UO.Cast(StandardSpell.Harm, target);
                                UO.Wait(SpellsDelays["Harm"]);
                                if (!firstCharge)
                                {
                                    break;
                                }
                            }
                            if (firstCharge)
                            {
                                firstCharge = false;
                            }
                            for (int i = 0; i < spellsNum; i++)
                            {
                                if (!acast)
                                {
                                    return;
                                }
                                if (targ.Hits < 1 || targ.Hits > 200 || targ.Dead || !targ.Exist)
                                {
                                    acast = false;
                                    UO.PrintError("Autocast OFF");
                                    return;
                                }
                                UO.Cast(StandardSpell.MindBlast, target);
                                UO.Wait(SpellsDelays[Spell]);
                            }
                        }
                        else
                        {
                            UO.Cast(StandardSpell.MindBlast, target);
                            UO.Wait(SpellsDelays[Spell]);
                        }
                        break;
                    }
                }
            }
        }