コード例 #1
0
ファイル: Alchemy.cs プロジェクト: caleb-dp/Phoenix
        //---------------------------------------------------------------------------------------------

        public UOItem GetPotionFromKad(Potion potion)
        {
            UOItem potionItem = FindPotion(potion, World.Player.Backpack.AllItems);
            UOItem kad        = GetKadAny(potion);

            Game.RunScriptCheck(400);

            if (kad.Exist)
            {
                UOItem emptyPotion = Potion.GetEmptyPotion();
                if (emptyPotion.Exist)
                {
                    Journal.Clear();
                    Targeting.ResetTarget();


                    potionItem = FindPotion(potion, World.Player.Backpack.AllItems);
                    if (!potionItem.Exist)
                    {
                        Game.CurrentGame.CurrentPlayer.SwitchWarmode();
                        Game.Wait(25);
                    }

                    UO.WaitTargetObject(emptyPotion);
                    kad.Use();
                    if (Journal.WaitForText(true, 150, "Pri praci s nadobou nemuzes delat neco jineho", "You put the"))
                    {
                        if (Journal.Contains(true, "Pri praci s nadobou nemuzes delat neco jineho"))
                        {
                            if (!potionItem.Exist)
                            {
                                Game.CurrentGame.CurrentPlayer.SwitchWarmode();
                                Game.Wait(25);

                                UO.WaitTargetObject(Potion.GetEmptyPotion());
                                kad.Use();
                                Game.Wait(75);
                            }
                        }
                    }
                    Game.Wait(75);

                    //Game.Wait(200);

                    potionItem = FindPotion(potion, World.Player.Backpack.AllItems);
                }
            }
            else
            {
                World.Player.PrintMessage(String.Format("[Neni kad {0}]", potion.Shortcut), MessageType.Warning);
            }

            return(potionItem);
        }
コード例 #2
0
ファイル: Alchemy.cs プロジェクト: nktobias/ScriptsTester
        //---------------------------------------------------------------------------------------------

        public UOItem GetPotionFromKad(Potion potion)
        {
            UOItem potionItem = FindPotion(potion, World.Player.Backpack);
            UOItem kad        = new UOItem(Serial.Invalid);

            kad = GetKadAny(potion);

            Game.RunScriptCheck(250);
            if (kad.Exist)
            {
                if (Potion.GetEmptyPotion().Exist)
                {
                    Journal.Clear();
                    Targeting.ResetTarget();

                    if (!potionItem.Exist)
                    {
                        Game.CurrentGame.CurrentPlayer.SwitchWarmode();
                        Game.Wait(100);
                    }
                    UO.WaitTargetObject(Potion.GetEmptyPotion());
                    kad.Use();

                    if (Journal.WaitForText(true, Game.SmallestWait, "Pri praci s nadobou nemuzes delat neco jineho"))
                    {
                        Targeting.ResetTarget();
                        Game.CurrentGame.CurrentPlayer.SwitchWarmode();
                        UO.WaitTargetObject(Potion.GetEmptyPotion());
                        kad.Use();

                        Game.Wait(Game.SmallestWait);
                    }

                    potionItem = FindPotion(potion, World.Player.Backpack);
                }
            }
            else
            {
                World.Player.PrintMessage(String.Format("[Neni kad {0}]", potion.Shortcut), MessageType.Warning);
            }

            return(potionItem);
        }
コード例 #3
0
ファイル: Alchemy.cs プロジェクト: caleb-dp/Phoenix
        //---------------------------------------------------------------------------------------------

        public bool DrinkPotion(Potion potion)
        {
            UOItem potionItem = FindPotion(potion, World.Player.Backpack.AllItems);

            if (!potionItem.Exist)
            {
                //ItemHelper.OpenContainerRecursive(World.Player.Backpack);
                potionItem = GetPotionFromKad(potion);
            }

            if (potionItem.Exist)
            {
                Journal.Clear();
                potionItem.Use();

                if (Journal.WaitForText(true, 250, "You can't drink another potion yet"))
                {
                    if (Game.CurrentGame.LastDrinkTime != null && (17.0 - (DateTime.Now - Game.CurrentGame.LastDrinkTime.Value).TotalSeconds) >= 0)
                    {
                        World.Player.PrintMessage(String.Format("[Lahev za {0:N1}s]", 17.0 - (DateTime.Now - Game.CurrentGame.LastDrinkTime.Value).TotalSeconds));
                    }

                    if (Potion.GetEmptyPotion().Amount > 2)
                    {
                        GetPotionFromKad(potion);
                    }
                }
                else
                {
                    Game.CurrentGame.LastDrinkTime = DateTime.Now;
                }

                return(true);
            }
            else
            {
                World.Player.PrintMessage("[Neni " + potion.Shortcut + "]", MessageType.Error);
                return(false);
            }
        }
コード例 #4
0
ファイル: Alchemy.cs プロジェクト: nktobias/ScriptsTester
        //---------------------------------------------------------------------------------------------

        public void DrinkPotion(Potion potion)
        {
            UOItem potionItem = FindPotion(potion, World.Player.Backpack);

            if (potionItem.Exist || (potionItem = GetPotionFromKad(potion)).Exist)
            {
                bool getNew = Potion.GetEmptyPotion().Amount > 2;

                Journal.Clear();


                potionItem.Use();
                if (Journal.WaitForText(true, 250, "You can't drink another potion yet"))
                {
                    if (Game.CurrentGame.LastDrinkTime != null && (17.0 - (DateTime.Now - Game.CurrentGame.LastDrinkTime.Value).TotalSeconds) >= 0)
                    {
                        World.Player.PrintMessage(String.Format("[Lahev za {0:N1}s]", 17.0 - (DateTime.Now - Game.CurrentGame.LastDrinkTime.Value).TotalSeconds));
                    }
                    Game.Wait(150);
                }
                else
                {
                    Game.CurrentGame.LastDrinkTime = DateTime.Now;
                }


                if (getNew && Journal.Contains(true, "You can't drink another potion yet"))
                {
                    Journal.Clear();
                    GetPotionFromKad(potion);
                }

                Game.PrintMessage(potion.Name + " " + (World.Player.Backpack.AllItems.Count(potion.DefaultGraphic, potion.DefaultColor)) + "ks");
            }
            else
            {
                World.Player.PrintMessage("[Neni " + potion.Shortcut + "]", MessageType.Error);
            }
        }