public void UseMount(int timeout)
        {
            if (World.Player.Layers[Layer.Mount].ExistCust())
            {
                youSeeMountText = null;

                Journal.EntryAdded += Journal_EntryAdded;
                underMount          = World.Player.Layers[Layer.Mount].Serial;
                World.Player.Layers[Layer.Mount].Click();
                World.Player.Use();
                Game.Wait(250);
                Journal.EntryAdded -= Journal_EntryAdded;
            }
            else if (Mount.IsValidCust() && new UOObject(Mount).ExistCust())
            {
                youSeeMountText = null;
                underMount      = Serial.Invalid;
                UO.PrintObject(Mount, Game.Val_LightGreen, "[Mount]");
                UO.UseObject(Mount);
            }
            else
            {
                List <UOCharacter> chars = new List <UOCharacter>();
                chars.AddRange(World.Characters.Where(ch => ch.Distance < 8 && ch.Serial != World.Player.Serial && (ch.Renamable || Game.IsMob(ch.Serial))).OrderBy(ch => ch.Distance).ToArray());

                bool mountFound = false;
                foreach (UOCharacter ch in chars)
                {
                    if (ItemLibrary.IsGraphicFromList(ch.Model, ItemLibrary.MountTypes.GraphicArray))
                    {
                        Mount = ch;
                        UO.PrintObject(Mount, Game.Val_LightGreen, "[Mount]");
                        ch.Use();
                        mountFound = true;
                        break;
                    }
                }

                if (!mountFound)
                {
                    UOItem sh = null;
                    if (World.Player.Backpack.AllItems.FindType(0x211F).Exist)
                    {
                        sh = World.Player.Backpack.AllItems.FindType(0x211F);
                    }
                    else if (World.Player.Backpack.AllItems.FindType(0x2121).Exist)
                    {
                        sh = World.Player.Backpack.AllItems.FindType(0x2121);
                    }
                    else if (World.Player.Backpack.AllItems.FindType(0x20F6).Exist)
                    {
                        sh = World.Player.Backpack.AllItems.FindType(0x20F6);
                    }
                    else if (World.Player.Backpack.AllItems.FindType(0x2136).Exist)
                    {
                        sh = World.Player.Backpack.AllItems.FindType(0x2136);
                    }
                    else if (World.Player.Backpack.AllItems.FindType(0x2124).Exist)
                    {
                        sh = World.Player.Backpack.AllItems.FindType(0x2124);
                    }
                    else if (World.Player.Backpack.AllItems.FindType(0x2135).Exist)
                    {
                        sh = World.Player.Backpack.AllItems.FindType(0x2135);
                    }
                    else if (World.Player.Backpack.AllItems.FindType(0x2137).Exist)
                    {
                        sh = World.Player.Backpack.AllItems.FindType(0x2137);
                    }


                    //  0x20F6

                    if (sh != null)
                    {
                        sh.Use();
                        UO.Warmode(false);
                        Game.Wait(250 + Core.Latency);
                    }

                    chars.Clear();
                    chars.AddRange(World.Characters.Where(ch => ch.Distance < 8 && ch.Serial != World.Player.Serial).OrderBy(ch => ch.Distance).ToArray());

                    foreach (UOCharacter ch in chars)
                    {
                        if (ItemLibrary.IsGraphicFromList(ch.Model, ItemLibrary.MountTypes.GraphicArray))
                        {
                            Mount = ch;
                            UO.PrintObject(Mount, Game.Val_LightGreen, "[Mount]");
                            ch.Use();
                            mountFound = true;
                            break;
                        }
                    }
                }

                if (!mountFound)
                {
                    World.Player.PrintMessage("Neni Mount", Game.Val_LightGreen);
                }
            }
        }
Beispiel #2
0
        //---------------------------------------------------------------------------------------------

        public static PlayerSubClass GetCurrentPlayerSubClass()
        {
            //TODO detekce podle spellbooku, zatim jedina moznost
            if (!World.Player.Backpack.Opened)
            {
                World.Player.Backpack.Use();
                Game.Wait(300);
            }

            UOItem         book = World.Player.Backpack.AllItems.FindType(0x0EFA);//SpellBook
            PlayerSubClass spec = PlayerSubClass.None;

            if (book.Color == 0x0021)
            {
                spec = PlayerSubClass.None;//mage
            }
            else if (book.Color == 0x0455 || book.Color == 0x0413)
            {
                spec = PlayerSubClass.None;                                                //nekro
            }
            else if (book.Color == 0x0B88 || book.Color == 0x0B89 || book.Color == 0x0B85) //??, gangrel, brujah, tremere
            {
                spec = PlayerSubClass.Gangrel;
            }
            else if (book.Color == 0x0B89)
            {
                spec = PlayerSubClass.Brujah;
            }
            else if (book.Color == 0x0B85)
            {
                spec = PlayerSubClass.Tremere;
            }
            else if (book.Color == 0x0B2F)
            {
                spec = PlayerSubClass.Monk;
            }
            else if (book.Color == 0x07D0)
            {
                spec = PlayerSubClass.Medic;
            }
            else if (book.Color == 0x0493)
            {
                spec = PlayerSubClass.Bishop;
            }
            else if (book.Color == 0x00BD)
            {
                spec = PlayerSubClass.Teuton;
            }

            //else if (book.Color == 0x016F)//0x016F
            //  spec = PlayerSubClass.Craftsman;
            else if (book.Color == 0x0B78)//0x0B78  Druid, ostro
            {
                spec = PlayerSubClass.Druid;
            }
            else if (book.Color == 0x0856)//0x0B78  Druid, ostro
            {
                spec = PlayerSubClass.Sharpshooter;
            }
            //

            return(spec);
        }
Beispiel #3
0
        public void arrangingregy(int pause)
        {
            ushort X = 17;
            ushort Y = 160;

            ushort[] regy = new ushort[23];
            regy[0]  = 0x0F7A; //blackpearls
            regy[1]  = 0x0F85; //Ginseng
            regy[2]  = 0x0F86; //mandrake root
            regy[3]  = 0x0F8D; //spider silk
            regy[4]  = 0x0F7B; //Blood Moss
            regy[5]  = 0x0F88; //Nightshade
            regy[6]  = 0x0F84; //garlic
            regy[7]  = 0x0F8C; //sulforous ash
            regy[8]  = 0x0F78; //Batwing
            regy[9]  = 0x0F91; //Wyrms heart
            regy[10] = 0x0F87; // eon
            regy[11] = 0x0F8F; //Volcanic Ash
            regy[12] = 0x0F83; //Execution's Cap
            regy[13] = 0x0F79; //Blackmoor
            regy[14] = 0x0F89; //Obsidian
            regy[15] = 0x0F7E; //Bone
            regy[16] = 0x0F7D; //Blood Vial
            regy[17] = 0x0F80; //Daemon Bone
            regy[18] = 0x0F8B; //Pumice
            regy[19] = 0x0F81; //Fertile Dirt
            regy[20] = 0x0F8E; //Serpent Scales
            regy[21] = 0x0F7C; //BloodSpawn
            regy[22] = 0x0F7F; //Brimstone
            for (int i = 0; i < 2; i++)
            {
                if (UO.Count(regy[i]) > 0)
                {
                    UOItem reg = World.Player.Backpack.Items.FindType(regy[i]);
                    UO.MoveItem(reg, 30000, World.Player.Backpack, X, Y);
                    X += 12;
                    UO.Wait(pause);
                }
            }
            X += 5;
            for (int i = 2; i < 4; i++)
            {
                if (UO.Count(regy[i]) > 0)
                {
                    UOItem reg = World.Player.Backpack.Items.FindType(regy[i]);
                    UO.MoveItem(reg, 30000, World.Player.Backpack, X, Y);
                    X += 28;
                    UO.Wait(pause);
                }
            }
            X  = 25;
            Y += 16;
            for (int i = 4; i < 6; i++)
            {
                if (UO.Count(regy[i]) > 0)
                {
                    UOItem reg = World.Player.Backpack.Items.FindType(regy[i]);
                    UO.MoveItem(reg, 30000, World.Player.Backpack, X, Y);
                    X += 25;
                    UO.Wait(pause);
                }
            }
            X = 120;
            Y = 160;
            for (int i = 6; i < 8; i++)
            {
                if (UO.Count(regy[i]) > 0)
                {
                    UOItem reg = World.Player.Backpack.Items.FindType(regy[i]);
                    UO.MoveItem(reg, 30000, World.Player.Backpack, X, Y);
                    X += 18;
                    UO.Wait(pause);
                }
            }
            X  = 110;
            Y += 16;
            for (int i = 8; i < 12; i++)
            {
                if (UO.Count(regy[i]) > 0)
                {
                    UOItem reg = World.Player.Backpack.Items.FindType(regy[i]);
                    UO.MoveItem(reg, 30000, World.Player.Backpack, X, Y);
                    X += 9;
                    UO.Wait(pause);
                }
            }
            X = 164;
            Y = 177;
            for (int i = 12; i < 23; i++)
            {
                if (UO.Count(regy[i]) > 0)
                {
                    UOItem reg = World.Player.Backpack.Items.FindType(regy[i]);
                    UO.MoveItem(reg, 30000, World.Player.Backpack, X, Y);
                    UO.Wait(pause);
                }
            }
            UO.Print("Dokonceno rovnani regu.");
        }
Beispiel #4
0
        public bool UseMount()
        {
            var currChars = World.Characters.Where(ch => ch.Serial != World.Player.Serial && ch.Distance <= 6).ToArray();
            var newChars  = World.Characters.Where(ch => ch.Serial != World.Player.Serial && ch.Distance <= 6).ToArray();
            var diff      = newChars.Where(ch => currChars.Count(cch => cch.Serial == ch.Serial) == 0).ToArray();

            UOItem currentMount  = World.Player.Layers[Layer.Mount];
            Serial originalMount = _Mount;

            bool dismount = currentMount.ExistCust();

            _Mount = Serial.Invalid;

            if (dismount)
            {
                UOColor currentColor = currentMount.Color;
                World.Player.Use();
                Game.Wait(100);

                newChars = World.Characters.Where(ch => ch.Serial != World.Player.Serial && ch.Distance <= 6).ToArray();
                diff     = newChars.Where(ch => currChars.Count(cch => cch.Serial == ch.Serial) == 0).ToArray();
                diff     = diff.OrderBy(ch => ch.Distance).ThenBy(ch => (ch.Color == currentColor ? 0 : 1)).ToArray();

                if (diff.Count() > 0)
                {
                    _Mount = diff.ToArray()[0].Serial;
                }
            }
            else
            {
                UOCharacter curr = new UOCharacter(originalMount);

                if (!curr.ExistCust())
                {
                    UOItem shrink = new UOItem(Serial.Invalid);
                    foreach (UOItem itm in World.Player.Backpack.AllItems)
                    {
                        if (ItemLibrary.ShrinkMountTypes.Count(uot => uot.Graphic == itm.Graphic) > 0)
                        {
                            shrink = itm;
                            break;
                        }
                    }

                    List <UOCharacter> m = new List <UOCharacter>();

                    if (HasHumanBody)//nemam haluze
                    {
                        m.AddRange(currChars.
                                   Where(ch => !denyMounts.Contains(ch.GetUniqueKey()) && !skipMounts.Contains(ch.GetUniqueKey()) && ItemLibrary.MountTypes.Count(mt => mt.Graphic == ch.Model) > 0).
                                   OrderBy(ch => (ch.Renamable ? 0 : 1)).
                                   ThenBy(ch => ch.Distance).ToArray());
                    }
                    else
                    {
                        m.AddRange(currChars.
                                   Where(ch => !denyMounts.Contains(ch.GetUniqueKey()) && !skipMounts.Contains(ch.GetUniqueKey())).
                                   OrderBy(ch => (ch.Renamable ? 0 : 1)).
                                   ThenBy(ch => ItemLibrary.MountTypes.Count(mt => mt.Graphic == ch.Model) > 0 ? 0 : 1).
                                   ThenBy(ch => ch.Distance).ToArray());
                    }

                    if (m.Count > 0)
                    {
                        _Mount = m[0].Serial;
                    }
                    else
                    {
                        if (shrink.Exist)
                        {
                            Game.CurrentGame.CurrentPlayer.SwitchWarmode();
                            shrink.Use();
                            Game.Wait(150);

                            newChars = World.Characters.Where(ch => ch.Serial != World.Player.Serial && ch.Distance <= 6).ToArray();
                            diff     = newChars.Where(ch => currChars.Count(cch => cch.Serial == ch.Serial) == 0).ToArray();
                            diff     = diff.OrderBy(ch => ch.Distance).ToArray();

                            if (diff.Count() > 0)
                            {
                                _Mount = diff.ToArray()[0].Serial;
                            }
                        }
                        skipMounts.Clear();
                    }
                }
                else
                {
                    _Mount = originalMount;
                }

                curr = new UOCharacter(_Mount);
                Journal.Clear();

                if (curr.ExistCust())
                {
                    curr.Use();

                    if (Journal.WaitForText(true, 150, "You dont own that horse"))
                    {
                        curr.PrintMessage("[ deny add ]");
                        denyMounts.Add(curr.GetUniqueKey());
                        _Mount = Serial.Invalid;
                    }
                    else if (!World.Player.Layers[Layer.Mount].ExistCust())
                    {
                        if (curr.Serial == originalMount && new UOCharacter(originalMount).Exist)
                        {
                            curr.PrintMessage("[ mount ]");
                        }
                        else
                        {
                            curr.PrintMessage("[ skip add ]");
                            skipMounts.Add(curr.GetUniqueKey());
                            _Mount = Serial.Invalid;
                        }
                    }
                }
                else
                {
                    World.Player.PrintMessage("[ neni mount ]");
                }
            }

            return(_Mount.IsValidCust());
        }
Beispiel #5
0
        public void TrainPoisEngage()
        {
            if (IsRunning)
            {
                return;
            }
            IsRunning = true;

            UOItem trainKit = World.Player.Backpack.AllItems.FindType(TrainKit.Graphic, TrainKit.Color);

            if (trainKit.Exist)
            {
                IsRunning = true;
                List <UOCharacter> characters = new List <UOCharacter>();
                characters.AddRange(World.Characters.ToArray());
                var fiter = characters.Where(ch => (ch.Notoriety != Notoriety.Guild && (ch.Notoriety == Notoriety.Enemy || ch.Notoriety == Notoriety.Murderer || ch.Notoriety == Notoriety.Criminal || ch.Notoriety == Notoriety.Neutral)) &&
                                             ch.Serial != World.Player.Serial &&
                                             ch.Distance <= 1 &&
                                             !Game.IsMob(ch.Serial) &&
                                             !Rename.IsMobRenamed(ch.Serial) &&
                                             !ch.Renamable &&
                                             !(ItemLibrary.IsMostCommonPlayerSummon(ch)));

                int  done    = 0;
                bool success = false;

                foreach (UOCharacter ch in fiter)
                {
                    if (!this.doneList.Contains(ch.Serial))
                    {
                        Game.RunScriptCheck(1000);
                        Game.CurrentGame.CurrentPlayer.SwitchWarmode();
                        Game.Wait(250);
                        UO.WaitTargetObject(ch.Serial);
                        trainKit.Use();

                        JournalEventWaiter jew = new JournalEventWaiter(true, "Uspesne jsi otravil svuj cil", "Kdyz se snazis pracovat s jedem, nemel bys delat nic jineho", "Na tomhle nemuzes trenovat", "Z teto nestvury se nic noveho nenaucis", "Na cili j*z nekdo trenoval");//todo
                        jew.Wait(500);

                        if (Journal.Contains(true, "Uspesne jsi otravil svuj cil", "Na tomhle nemuzes trenovat", "Z teto nestvury se nic noveho nenaucis", "Na cili j*z nekdo trenoval"))
                        {
                            this.doneList.Add(ch.Serial);
                            success = true;
                        }

                        Journal.Clear();
                        break;
                    }
                    else
                    {
                        done++;
                    }
                }

                if (!success && done > 0)
                {
                    World.Player.PrintMessage("Vse okolo poisnuto!");
                }
                else if (fiter.Count() == 0)
                {
                    World.Player.PrintMessage("Nic k poisnuti!");
                }
            }
            else
            {
                World.Player.PrintMessage("Nemas pois KIT");
            }

            IsRunning = false;
        }
Beispiel #6
0
 public void addtruhla()
 {
     truhla = World.GetItem(UIManager.TargetObject());
 }
Beispiel #7
0
        //---------------------------------------------------------------------------------------------

        public bool ContainsTopKad(UOItem container)
        {
            return(container.Items.FindType(KadGraphic, this.TopKadColor).Exist);
        }
Beispiel #8
0
        public static void PoisonWeapons()
        {
            UOItem kit = World.Player.Backpack.Items.FindType(0x185B, 0x0B8B);

            if (!kit.Exist)
            {
                Game.PrintMessage("Nemas kit!", MessageType.Error);
                return;
            }

            UOItemExtInfo extInfo = ItemHelper.GetItemExtInfo(kit);

            if (extInfo.Charges < 10)
            {
                Game.PrintMessage("Kit ma malo nabiti - " + extInfo.Charges, MessageType.Error);
                return;
            }

            UO.Print("Kontainer se zbranemi >");
            UOItem sourceCont = new UOItem(UIManager.Target().Serial);

            UO.Print("Cilovy kontainer >");
            UOItem targetCont = new UOItem(UIManager.Target().Serial);

            if (!sourceCont.Exist)
            {
                Game.PrintMessage("Kontainer se zbranemi INVALID!", MessageType.Error);
                return;
            }

            if (!targetCont.Exist)
            {
                Game.PrintMessage("Cilovy kontainer INVALID!", MessageType.Error);
                return;
            }

            sourceCont.Use();
            Game.Wait(250);
            targetCont.Use();
            Game.Wait(250);

            List <UOItem> toPoisnList = sourceCont.AllItems.Where(p => p.Color == 0x08A1).ToList();
            int           maxCharges  = extInfo.Charges.GetValueOrDefault() / 10;
            decimal       doneCount   = 0;
            int           failCount   = 0;
            decimal       fizzCount   = 0;

            Game.PrintMessage(String.Format("Poisn Start - Zbrani: {0}, Maxnabiti: {1}.", toPoisnList.Count, maxCharges));

            for (int i = 0; i < toPoisnList.Count; i++)
            {
                bool end = false;

                do
                {
                    Journal.Clear();

                    UOItem toPois = toPoisnList[i];

                    UO.WaitTargetObject(toPois);
                    kit.Use();

                    if (Journal.WaitForText(true, 1000, "Uspesne jsi otravil zbran.", "Bohuzel, nepodarilo se ti otravit zbran.", "Tohle neni ani kad, ani zbran!"))
                    {
                        if (Journal.Contains(true, "Uspesne jsi otravil zbran."))
                        {
                            doneCount++;
                            end = true;
                            toPois.Move(1, targetCont);
                        }
                        else if (Journal.Contains(true, "Bohuzel, nepodarilo se ti otravit zbran."))
                        {
                            fizzCount++;
                        }
                        else
                        {
                            failCount++;
                            end = true;
                        }
                    }
                    else
                    {
                        failCount++;
                        end = true;
                    }

                    Game.Wait();
                } while (!end);

                Game.Wait(1000);
                Game.PrintMessage(String.Format("Otraveno: {0}, Fail: {1}, Uspesnost: {2:N2}%", doneCount, failCount, (doneCount / (doneCount + fizzCount)) * 100));
            }

            Game.PrintMessage(String.Format("Poisn End - Otraveno: {0}, Fail: {1}, Uspesnost: {2:N2}%", doneCount, failCount, (doneCount / (doneCount + fizzCount)) * 100));
        }
Beispiel #9
0
        //---------------------------------------------------------------------------------------------

        public static bool IsNecroSpellScroll(UOItem item)
        {
            return(IsNecroSpellScroll(item.Graphic, item.Color));
        }
Beispiel #10
0
        //---------------------------------------------------------------------------------------------

        public static NecromancySpell GetNecromancySpellFromScroll(UOItem item)
        {
            return(GetNecromancySpellFromScroll(item.Graphic, item.Color));
        }
Beispiel #11
0
        public void boost(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));
            List <UOItem> Heads = new List <UOItem>();
            UOItem        head  = new UOItem(0x01);

            while (head.Serial != 0xFFFFFFFF)
            {
                UO.Wait(200);
                head = new UOItem(UIManager.TargetObject());

                if (head.Serial != 0xFFFFFFFF)
                {
                    Heads.Add(head);
                }
            }



            try
            {
                Core.RegisterServerMessageCallback(0x1C, onVoodoo);
                Serial cont;
                ushort X, Y;
                foreach (var it in Heads.Where(x => HeadGraphics.Any(y => x.Graphic == y)).ToList())
                {
                    cont = it.Container;
                    X    = it.X;
                    Y    = it.Y;
                    it.Move(1, World.Player.Backpack);
                    UO.Wait(100);

                    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)
                    {
                        UO.Wait(200);
                        if (done == VoodooState.NoTarget)
                        {
                            UO.Wait(4000);
                            break;
                        }
                        boostBottles[type].WaitTarget();
                        it.Use();
                        UO.Wait(200);
                    }
                    while (done != VoodooState.Success)
                    {
                        UO.Wait(500);
                        if (done == VoodooState.NoTarget)
                        {
                            break;
                        }
                    }
                    it.Move(1, cont, X, Y);
                    UO.Wait(100);
                }
            }
            catch (Exception ex) { UO.PrintError(ex.InnerException.Message); }
            finally
            {
                Core.UnregisterServerMessageCallback(0x1C, onVoodoo);
            }
        }
Beispiel #12
0
        public void Train(string name, string quality, string drinkPotion, bool drink, int manaLimit, params string[] menus)
        {
            Game.PrintMessage("Zvol kontejner s materialem > (esc) = ground");
            UOItem containerFrom = new UOItem(UIManager.TargetObject());

            Game.CurrentGame.Mode = GameMode.Working;

            decimal okCountAlch = 0;
            decimal countAlch   = 0;

            decimal okCount = 0;
            decimal count   = 0;

            bool restart = true;

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

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

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

                    count++;

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


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


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

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

                UOItem mrKad = null;

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

                    Game.Wait(100);
                    counter++;



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

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

                    if ((longpartCount * 5000) - lastDrink > 10000)
                    {
                        lastDrink = (longpartCount * 5000);
                        if (drink && mrKad != null && mrKad.Exist && World.Player.Mana < (World.Player.Intelligence - manaOffset))//        if (World.Player.Mana < 50 || (restart && World.Player.Mana < (World.Player.Intelligence - manaLimit)))
                        {
                            Journal.Clear();
                            Game.CurrentGame.CurrentPlayer.GetSkillInstance <Alchemy>().DrinkPotion(p);
                            Game.Wait(1500);
                        }
                    }
                    //}
                }
            }
        }
Beispiel #13
0
        public static void SortMap(int maxDistance)
        {
            openedMapsLoc = null;

            Game.PrintMessage("Bagl s mapkami >");
            UOItem containerFrom = new UOItem(UIManager.TargetObject());

            if (containerFrom.Serial.IsValid && containerFrom.Exist)
            {
                foreach (UOItem item in containerFrom.Items)
                {
                    if (item.Graphic == mapka.Graphic)
                    {
                        item.Move(1, World.Player.Backpack);
                        Game.Wait();
                    }
                }
            }

            foreach (UOItem item in World.Player.Backpack.Items)
            {
                if (item.Graphic == mapka.Graphic)
                {
                    item.Use();
                    Game.Wait();
                }
            }

            Game.PrintMessage("OpenedMapsLoc: " + OpenedMapsLoc.Count);

            Dictionary <string, List <uint> > groups = new Dictionary <string, List <uint> >();

            foreach (KeyValuePair <string, List <uint> > kvp in OpenedMapsLoc)
            {
                string[]       pos    = kvp.Key.Split(',');
                UOPositionBase mapPos = new UOPositionBase(ushort.Parse(pos[0]), ushort.Parse(pos[1]), 0);

                bool found = false;
                foreach (KeyValuePair <string, List <uint> > groupkvp in groups)
                {
                    string[]       gruppos     = groupkvp.Key.Split(',');
                    UOPositionBase groupmapPos = new UOPositionBase(ushort.Parse(gruppos[0]), ushort.Parse(gruppos[1]), 0);

                    if (Robot.GetRelativeVectorLength(groupmapPos, mapPos) < maxDistance)
                    {
                        groups[groupkvp.Key].AddRange(kvp.Value);
                        found = true;
                        break;
                    }
                }

                if (!found)
                {
                    if (groups.ContainsKey(mapPos.ToString()))
                    {
                        groups[mapPos.ToString()].AddRange(kvp.Value);
                    }
                    else
                    {
                        groups.Add(mapPos.ToString(), kvp.Value);
                    }
                }
            }

            //pytlik obyc 5 rad 20;
            //4 sloupce po 20

            ushort currentCol = 10;
            ushort currentRow = 1;


            foreach (KeyValuePair <string, List <uint> > kvp in groups)
            {
                ushort colItemPos = currentCol;
                foreach (uint serial in kvp.Value)
                {
                    UOItem item = new UOItem(serial);
                    item.Move(1, containerFrom, colItemPos, currentRow);

                    colItemPos++;
                    Game.Wait();
                }

                currentCol = (ushort)(currentCol + 20);

                if (currentCol > 120)
                {
                    currentCol = 10;
                    currentRow = (ushort)(currentRow + 16);
                }
            }
        }