예제 #1
0
        public static void WrongKlic()
        {
            List <UOCharacter> npcs = World.Characters.Where(i => i.Distance < 25 && i.Notoriety == Notoriety.Innocent && i.Serial != World.Player.Serial).OrderBy(i => (uint)i.Serial).ToList();

            List <UOCharacter> npcsNext = npcs.Where(i => (uint)i.Serial > lastWrongSerial).ToList();

            UOCharacter ch = new UOCharacter(Serial.Invalid);

            if (npcsNext.Count > 0)
            {
                ch = npcsNext[0];
            }
            else if (npcs.Count > 0)
            {
                ch = npcs[0];
            }

            if (ch.Serial.IsValidCust() && ch.Exist)
            {
                Journal.Clear();

                if (String.IsNullOrEmpty(ch.Name))
                {
                    ch.Click();
                    Game.Wait(150);
                }

                if (!String.IsNullOrEmpty(ch.Name))
                {
                    UO.Say(ch.Name + " klic ");
                    Game.Wait(250);

                    if (ch.Exist)
                    {
                        if (Journal.Contains(true, "modry"))
                        {
                            ch.PrintMessage("[Modry..]", Game.Val_Blue);
                        }
                        else if (Journal.Contains(true, "cerveny"))
                        {
                            ch.PrintMessage("[Cerveny..]", Game.Val_Red);
                        }
                        else if (Journal.Contains(true, "zeleny"))
                        {
                            ch.PrintMessage("[Zleny..]", Game.Val_Green);
                        }
                        else if (Journal.Contains(true, "zluty"))
                        {
                            ch.PrintMessage("[Zluty..]", Game.Val_LightYellow);
                        }
                        else
                        {
                            ch.PrintMessage("[Zadny..]", Game.Val_LightPurple);
                        }
                    }
                }

                lastWrongSerial = ch.Serial;
            }
        }
예제 #2
0
        public void TrainManual()
        {
            this.doneList = new List <Serial>();

            Game.PrintMessage("Vyber  >");
            UOCharacter character = new UOCharacter(UIManager.TargetObject());

            Game.Wait();
            character.Click();

            Game.PrintMessage("" + character.Name);

            if (character.Exist)
            {
                UOItem equipedKrk   = World.Player.Layers[Layer.Neck];
                UOItem tamingNeklak = World.Player.Backpack.AllItems.FindType(0x1088, 0x0B18);
                if (tamingNeklak.Exist)
                {
                    tamingNeklak.Use();
                    Game.Wait();
                }

                this.TameCharacter(character, 100, false);

                if (equipedKrk.Exist)
                {
                    equipedKrk.Use();
                }
            }
        }
예제 #3
0
        //---------------------------------------------------------------------------------------------

        protected void World_CharacterAppeared(object sender, CharacterAppearedEventArgs e)
        {
            World.CharacterAppeared -= World_CharacterAppeared;
            UOCharacter appeared = new UOCharacter(e.Serial);

            if (appeared.Model == 0x0053 && !appeared.Renamable)
            {
                if (CalExtension.Abilities.GolemMaster.AdaHammer.Exist)
                {
                    Targeting.ResetTarget();
                    UO.WaitTargetObject(appeared);
                    CalExtension.Abilities.GolemMaster.AdaHammer.Use();

                    if (!Game.IsMob(appeared) && !Game.IsMobRenamed(appeared))
                    {
                        appeared.Click();
                        Game.Wait(200);

                        if (appeared.RequestStatus(200))
                        {
                            Game.Rename(appeared);
                        }
                    }
                }
            }
        }
예제 #4
0
        public void TrackAdd()
        {
            UOCharacter ch = new UOCharacter(UIManager.TargetObject());

            ch.Click();
            UO.Wait(200);
            Ignored.Add(ch.Name);
        }
예제 #5
0
        //---------------------------------------------------------------------------------------------

        public static string GetPlayerAlias(UOCharacter ch)
        {
            Dictionary <string, List <string> > dict = new Dictionary <string, List <string> >();
            string result = null;

            string p      = PlayerAliases + String.Empty;
            string chName = ch.Name;

            if (String.IsNullOrEmpty(ch.Name))
            {
                ch.Click();
                Game.Wait(100);
            }

            chName = ch.Name;

            if (!String.IsNullOrEmpty(chName))
            {
                string[] lines = p.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);

                foreach (string line in lines)
                {
                    string[] lineSplit = line.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries);
                    if (lineSplit.Length > 1)
                    {
                        string playerName = lineSplit[0];
                        string chars      = lineSplit[1];

                        foreach (string c in chars.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
                        {
                            if (chName.ToLower() == c.ToLower().Trim())
                            {
                                return(playerName);
                            }
                        }
                    }
                }
            }
            return(result);
        }
예제 #6
0
        public UOCharacter IVMAutoB(int maxdistance, int hits)
        {
            UOCharacter             result   = null;
            List <CharHealPriority> chhpList = GetCharHealPriorityList(maxdistance, false, Game.MergeLists <UOCharacter>(Game.CurrentGame.Alies, Game.CurrentGame.HealAlies));
            var sortedList = chhpList.Where(c => !skip.Contains(c.Char.Serial)).ToList();

            if (sortedList.Count == 0)
            {
                skip.Clear();
                sortedList = chhpList;
            }

            if (sortedList.Count > 0)
            {
                foreach (CharHealPriority c in sortedList)
                {
                    UOCharacter ch = result = c.Char;
                    //if (ch.Serial != World.Player.Serial)
                    //  LastCharacter = ch;

                    if (String.IsNullOrEmpty(ch.Name))
                    {
                        ch.Click();
                        Game.Wait(150);
                    }

                    CastResultInfo info          = new CastResultInfo();
                    string         spellShortCut = "";

                    double dhits    = (double)hits;
                    double dmg      = ch.MaxHits - ch.Hits;
                    double dmgRel   = dmg / dhits;
                    double mHitsRel = (double)ch.MaxHits / dhits;

                    double dmgHitsRel = mHitsRel - dmgRel;

                    UOItem scrools = World.Player.Backpack.AllItems.FindType(Magery.SpellScrool[StandardSpell.GreaterHeal]);

                    if (dmgRel > 0.75 && dmgHitsRel <= 2.25 && scrools.Exist)
                    {
                        spellShortCut = "IVM";

                        info = Bishop.CastBishopGreaterHeal(true, ch.Serial, true);
                        if (info.Spell == StandardSpell.Heal)
                        {
                            spellShortCut = "IM";
                        }
                    }
                    else if (dmg > 30)
                    {
                        spellShortCut = "IVM";
                        info          = Magery.Current.CastSpell(StandardSpell.GreaterHeal, ch, true, false, true);
                    }
                    else
                    {
                        spellShortCut = "IM";
                        info          = Magery.Current.CastSpell(StandardSpell.Heal, ch, true, false, true);
                    }

                    if (info.NoInLineOfSight)
                    {
                        skip.Add(ch.Serial);
                    }
                    else
                    {
                        ushort color = CalStatusMessage.Val_InfoColor;
                        if (info.Usage == CastUsage.Scrool)
                        {
                            color = Game.Val_Green;
                        }

                        ch.PrintMessage("[" + spellShortCut + "...]", Game.GetAlieColorByHits(ch.Serial));

                        bool reset = sortedList.Count == 1;

                        if (!reset)
                        {
                            int skipCount = 0;
                            foreach (CharHealPriority chp in sortedList)
                            {
                                if (skip.Contains(chp.Char.Serial))
                                {
                                    skipCount++;
                                }
                            }

                            reset = skipCount == sortedList.Count;
                        }

                        if (reset)
                        {
                            skip = new List <Serial>();
                        }
                    }

                    break;
                }
            }
            else
            {
                Game.PrintMessage("IVMA: " + Game.MergeLists <UOCharacter>(Game.CurrentGame.Alies, Game.CurrentGame.HealAlies).Count + " OK");
            }

            return(result);
        }
예제 #7
0
        public UOCharacter IVMAuto(int maxdistance, bool useInMani, StandardSpell secondarySpell, bool useScroolByHits, StandardSpell primarySpell)
        {
            UOCharacter             result   = null;
            List <CharHealPriority> chhpList = GetCharHealPriorityList(maxdistance, false, Game.MergeLists <UOCharacter>(Game.CurrentGame.Alies, Game.CurrentGame.HealAlies));
            var sortedList = chhpList.Where(c => !skip.Contains(c.Char.Serial)).ToList();

            if (sortedList.Count == 0)
            {
                skip.Clear();
                sortedList = chhpList;
            }

            if (sortedList.Count > 0)
            {
                bool useScrool = false;

                foreach (CharHealPriority c in sortedList)
                {
                    UOCharacter ch = result = c.Char;
                    //if (ch.Serial != World.Player.Serial)
                    //  LastCharacter = ch;

                    if (String.IsNullOrEmpty(ch.Name))
                    {
                        ch.Click();
                        Game.Wait(150);
                    }

                    CastResultInfo info          = new CastResultInfo();
                    string         spellShortCut = "";
                    if (ch.MaxHits - ch.Hits <= 25 && useInMani)
                    {
                        spellShortCut = "IM";
                        info          = Magery.Current.CastSpell(StandardSpell.Heal, ch, true, false, true);
                    }
                    else
                    {
                        if (useScroolByHits && (c.DamagePerc >= 35 || c.Char.MaxHits <= 90 && c.Damage >= 30 || ch.Serial == World.Player.Serial))
                        {
                            useScrool = true;
                        }

                        //TODO predelat
                        info = Magery.Current.CastSpell(primarySpell, ch, useScrool, false, true, true);
                        if (!info.Success)
                        {
                            if (secondarySpell == StandardSpell.Heal)
                            {
                                spellShortCut = "IM";
                                info          = Magery.Current.CastSpell(StandardSpell.Heal, ch, useScrool, false, true, false);
                            }
                            else if (secondarySpell == StandardSpell.GreaterHeal)
                            {
                                spellShortCut = "IVM";
                                info          = Magery.Current.CastSpell(StandardSpell.GreaterHeal, ch, false, false, true, false);
                            }
                        }
                        else
                        {
                            spellShortCut = primarySpell == StandardSpell.GreaterHeal ? "IVM" : "IM";
                        }
                    }

                    if (info.NoInLineOfSight)
                    {
                        skip.Add(ch.Serial);
                    }
                    else
                    {
                        ushort color = CalStatusMessage.Val_InfoColor;
                        if (info.Usage == CastUsage.Scrool)
                        {
                            color = 0x0048;
                        }

                        ch.PrintMessage("[" + spellShortCut + "...]" + (useScrool ? " (S)" : ""), Game.GetAlieColorByHits(ch.Serial));

                        bool reset = sortedList.Count == 1;

                        if (!reset)
                        {
                            int skipCount = 0;
                            foreach (CharHealPriority chp in sortedList)
                            {
                                if (skip.Contains(chp.Char.Serial))
                                {
                                    skipCount++;
                                }
                            }

                            reset = skipCount == sortedList.Count;
                        }

                        if (reset)
                        {
                            skip = new List <Serial>();
                        }
                    }

                    break;
                }
            }
            else
            {
                Game.PrintMessage("IVMA: " + Game.MergeLists <UOCharacter>(Game.CurrentGame.Alies, Game.CurrentGame.HealAlies).Count + " OK");
            }

            return(result);
        }
예제 #8
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);
            }
        }
예제 #9
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);
        }
예제 #10
0
        //---------------------------------------------------------------------------------------------

        protected bool BezSeResnout()
        {
            bool ressSuccess = false;

            if (this.RessPositionPath != null)
            {
                UO.Print("BezSeResnout");
                int gotoDistance = this.RessPositionPath.Count == 1 ? 1 : 0;

                if (this.Robot.GoTo(this.RessPositionPath, gotoDistance))
                {
                    UOCharacter resser = null;

                    foreach (UOCharacter ch in World.Characters)
                    {
                        if (ch.Notoriety == Notoriety.Innocent || ch.Notoriety == Notoriety.Invulnerable || ch.Notoriety == Notoriety.Neutral || ch.Distance < 10)
                        {
                            resser = ch;
                            break;
                        }
                    }

                    if (World.Ground.FindType(0x1E5D).Exist)////0x1E5D ress kriz
                    {
                        UOItem ressKriz = World.Ground.FindType(0x1E5D);
                        if (ressKriz > 3)
                        {
                            this.Robot.GoTo(ressKriz.X, ressKriz.Y, 1, 100);
                        }

                        ressKriz.Click();
                        Game.Wait();
                        World.Player.ChangeWarmode(WarmodeChange.Switch);
                        Game.Wait();
                        World.Player.ChangeWarmode(WarmodeChange.War);
                        Game.Wait();
                        ressKriz.Use();
                        Game.Wait();
                        World.Player.RequestStatus(1000);

                        ressSuccess = !UO.Dead;
                    }
                    else if (resser != null && resser.Exist)
                    {
                        if (this.Robot.GoTo(resser.X, resser.Y, 2, 50))
                        {
                            resser.Click();
                            Game.Wait();
                            World.Player.ChangeWarmode(WarmodeChange.Switch);
                            Game.Wait();
                            World.Player.ChangeWarmode(WarmodeChange.War);
                            resser.Tell("ress");
                            Game.Wait();
                            World.Player.RequestStatus(1000);

                            ressSuccess = !UO.Dead;
                        }
                        else
                        {
                            UO.Print("BezSeResnout - !Goto resser");
                        }
                    }
                    else
                    {
                        UO.Print("BezSeResnout - !resser");
                    }
                }
                else
                {
                    UO.Print("BezSeResnout - !GoTo ForgePosition");
                }

                if (ressSuccess && this.RessPositionPath.Count > 1)
                {
                    List <IUOPosition> reverse = new List <IUOPosition>();
                    reverse.AddRange(this.RessPositionPath.ToArray());
                    reverse.Reverse();

                    this.Robot.GoTo(reverse, gotoDistance);
                }
            }
            else
            {
                UO.Print("BezSeResnout - RessPosition == null");
                Game.Wait(1500);
            }

            return(ressSuccess);
        }
예제 #11
0
        public static MobRenameInfo RenameCharacter(Serial serial, int maxTries)
        {
            UOCharacter   ch         = new UOCharacter(serial);
            MobRenameInfo renameInfo = EnsureRegisterRenameInfo(serial);//Game.renamedHt[serial] != null ? (MobRenameInfo)Game.renamedHt[serial] : new MobRenameInfo();

            if (renameInfo.Success || renameInfo.Tries >= maxTries)
            {
                return(renameInfo);
            }

            renameInfo.Tries++;

            bool check = false;

            check = !String.IsNullOrEmpty(ch.Name);

            if (!check)
            {
                if (Game.Debug)
                {
                    Game.PrintMessage("Rename Check - Name EMPTY");
                }
                check = ch.RequestStatus(250 + Core.CurrentLatency);
            }

            if (!check)
            {
                if (Game.Debug)
                {
                    Game.PrintMessage("Rename Check - !RequestStatus");
                }

                ch.Click();
                Game.Wait(150);
                check = !String.IsNullOrEmpty(ch.Name) && ch.RequestStatus(250);
            }

            renameInfo.OriginalName = ch.Name;

            if (check)
            {
                string playerCode = Rename.PlayerShortCode;

                if ((ch.Name + String.Empty).StartsWith(playerCode))
                {
                    renameInfo.NewName = ch.Name;
                    renameInfo.Success = true;
                }
                else if (ch.Renamable || Game.IsPossibleMob(ch) && ch.Distance <= 4)//Uvidime, ty klamaky nejak casti blbnou oproti summum
                {
                    var chars  = "abcdefghijklmnopqrstuvwxyz1234567890";
                    var random = new Random();
                    var result = new string(
                        Enumerable.Repeat(chars, 5)
                        .Select(s => s[random.Next(s.Length)])
                        .ToArray());

                    result = playerCode + result;
                    if (result.Length > 1)
                    {
                        result = result.Substring(0, result.Length - 2) + result[result.Length - 2].ToString().ToUpper() + result[result.Length - 1].ToString().ToUpper();
                    }
                    renameInfo.NewName = result;
                    renameInfo.Success = ch.Rename(result);


                    if (Game.Debug)
                    {
                        Game.PrintMessage("Rename : " + renameInfo.Success + " [" + result + "]/[" + renameInfo.OriginalName + "]");
                    }

                    Game.Wait(Core.CurrentLatency);

                    if (renameInfo.Success)
                    {
                        byte[] data = PacketBuilder.CharacterSpeechUnicode(ch.Serial, ch.Model, result, SpeechType.Regular,
                                                                           SpeechFont.Normal, Game.Val_PureWhite,
                                                                           "[ " + result + " ]");
                        Core.SendToClient(data, true);
                    }
                }
            }
            else if (Game.Debug)
            {
                Game.PrintMessage("!Rename Check");
            }

            if (renameInfo.Success)
            {
                new StatusBar().Show(ch.Serial);
            }

            return(renameInfo);
        }