示例#1
0
      public static void MassMove(Graphic graphic, UOColor color, Serial sourceContainer, Serial destination)
      {
          UOItem source = World.GetItem(sourceContainer);

          if (!source.Exist)
          {
              ScriptErrorException.Throw("Invalid source container.");
              return;
          }

          if (!destination.IsValid)
          {
              ScriptErrorException.Throw("Invalid destination.");
              return;
          }

          UO.PrintInformation("Moving items of type {0} {1} from {2} to {3}", graphic, color, sourceContainer, destination);

          foreach (UOItem item in source.Items)
          {
              if (item.Graphic == graphic && item.Color == color)
              {
                  using (ItemUpdateEventWaiter ew = new ItemUpdateEventWaiter(item)) {
                      item.Move(0, destination);
                      ew.Wait(2000);
                      UO.Wait(200);
                  }
              }
          }

          UO.PrintInformation("MassMove finished.");
      }
示例#2
0
        public void Vyloz(UOItem container)
        {
            UOItem Vyrobek;
            string chyby = "";

            ushort[] VyrobekType = new ushort[5];
            VyrobekType[0] = 0x1876;  // Wire
            VyrobekType[1] = 0x14FB;  // Lock
            VyrobekType[2] = 0x0E34;  // scroll
            VyrobekType[3] = 0x0DF9;  // bavlna
            VyrobekType[4] = 0x0FA0;  // threads


            if (!container.Opened)
            {
                using (ItemOpenedEventWaiter ew = new ItemOpenedEventWaiter(container.Serial))
                {
                    container.Use();
                    if (!ew.Wait(60000))
                    {
                        UO.PrintWarning("Item open timeout");
                        return;
                    }
                }
            }

            for (int i = 0; i < 5; i++)
            {
                while ((World.Player.Backpack.AllItems.Count(VyrobekType[i], 0x0000)) > 0)
                {
                    Vyrobek = World.Player.Backpack.AllItems.FindType(VyrobekType[i], 0x0000);
                    using (ItemUpdateEventWaiter ew = new ItemUpdateEventWaiter(Vyrobek))
                    {
                        Vyrobek.Move(Vyrobek.Amount, container.Serial);
                        if (!ew.Wait(5000))
                        {
                            ScriptErrorException.Throw("1");
                            return;
                        }
                    }
                }
            }

            UO.PrintWarning(chyby);
            UO.Print("Prebytky vylozeny!!");
        }
示例#3
0
        public void lahve(int pause)
        {
            ushort potionGraphic1 = 0x0F09;
            ushort potionColor1   = 0x0003;
            ushort potionGraphic2 = 0x0F09;
            ushort potionColor2   = 0x0000;
            ushort potionGraphic3 = 0x0F0C;
            ushort potionColor3   = 0x0000;
            ushort potionGraphic4 = 0x0F0B;
            ushort potionColor4   = 0x0000;
            ushort potionGraphic5 = 0x0F07;
            ushort potionColor5   = 0x0000;
            ushort X = 16;
            ushort Y = 81;

            foreach (UOItem item in World.Player.Backpack.Items)
            {
                if (item.Graphic == potionGraphic1 && item.Color == potionColor1)
                {
                    using (ItemUpdateEventWaiter ew = new ItemUpdateEventWaiter(item)) {
                        UO.MoveItem(item.Serial, 1, truhla.Serial, X, Y);
                        if (!ew.Wait(5000))
                        {
                            ScriptErrorException.Throw("Nemuzu pohnout s itemem, konec.");
                            return;
                        }
                    }
                }
            }
            X += 10;
            foreach (UOItem item in World.Player.Backpack.Items)
            {
                if (item.Graphic == potionGraphic2 && item.Color == potionColor2)
                {
                    using (ItemUpdateEventWaiter ew = new ItemUpdateEventWaiter(item)) {
                        UO.MoveItem(item.Serial, 1, truhla.Serial, X, Y);
                        if (!ew.Wait(5000))
                        {
                            ScriptErrorException.Throw("Nemuzu pohnout s itemem, konec.");
                            return;
                        }
                    }
                }
            }
            X += 10;
            foreach (UOItem item in World.Player.Backpack.Items)
            {
                if (item.Graphic == potionGraphic3 && item.Color == potionColor3)
                {
                    using (ItemUpdateEventWaiter ew = new ItemUpdateEventWaiter(item)) {
                        UO.MoveItem(item.Serial, 1, truhla.Serial, X, Y);
                        if (!ew.Wait(5000))
                        {
                            ScriptErrorException.Throw("Nemuzu pohnout s itemem, konec.");
                            return;
                        }
                    }
                }
            }
            X += 10;
            foreach (UOItem item in World.Player.Backpack.Items)
            {
                if (item.Graphic == potionGraphic4 && item.Color == potionColor4)
                {
                    using (ItemUpdateEventWaiter ew = new ItemUpdateEventWaiter(item)) {
                        UO.MoveItem(item.Serial, 1, truhla.Serial, X, Y);
                        if (!ew.Wait(5000))
                        {
                            ScriptErrorException.Throw("Nemuzu pohnout s itemem, konec.");
                            return;
                        }
                    }
                }
            }
            X += 10;
            foreach (UOItem item in World.Player.Backpack.Items)
            {
                if (item.Graphic == potionGraphic5 && item.Color == potionColor5)
                {
                    using (ItemUpdateEventWaiter ew = new ItemUpdateEventWaiter(item)) {
                        UO.MoveItem(item.Serial, 1, truhla.Serial, X, Y);
                        if (!ew.Wait(5000))
                        {
                            ScriptErrorException.Throw("Nemuzu pohnout s itemem, konec.");
                            return;
                        }
                    }
                }
            }
            UO.Print("Konec rovnani");
        }
示例#4
0
        public void arranging(int pause)
        {
            ushort potionGraphic1 = 0x0F09;
            ushort potionColor1   = 0x0003;
            ushort potionGraphic2 = 0x0F09;
            ushort potionColor2   = 0x0000;
            ushort potionGraphic3 = 0x0F0C;
            ushort potionColor3   = 0x0000;
            ushort potionGraphic4 = 0x0F0B;
            ushort potionColor4   = 0x0000;
            ushort potionGraphic5 = 0x0F07;
            ushort potionColor5   = 0x0000;
            ushort vychoziX       = 20;
            ushort maxX           = 160;
            ushort X = 20;
            ushort Y = 20;

            foreach (UOItem item in World.Player.Backpack.AllItems)
            {
                if (item.Graphic == potionGraphic1 && item.Color == potionColor1)
                {
                    using (ItemUpdateEventWaiter ew = new ItemUpdateEventWaiter(item)) {
                        UO.MoveItem(item.Serial, 1, Aliases.Backpack, X, Y);
                        if (!ew.Wait(5000))
                        {
                            ScriptErrorException.Throw("Nemuzu pohnout s itemem, konec.");
                            return;
                        }
                    }
                    X += 5;
                    if (X >= maxX)
                    {
                        Y += 15;
                        X  = vychoziX;
                    }
                }
            }
            X += 5;
            foreach (UOItem item in World.Player.Backpack.AllItems)
            {
                if (item.Graphic == potionGraphic2 && item.Color == potionColor2)
                {
                    using (ItemUpdateEventWaiter ew = new ItemUpdateEventWaiter(item)) {
                        UO.MoveItem(item.Serial, 1, Aliases.Backpack, X, Y);
                        if (!ew.Wait(5000))
                        {
                            ScriptErrorException.Throw("Nemuzu pohnout s itemem, konec.");
                            return;
                        }
                    }
                    X += 5;
                    if (X >= maxX)
                    {
                        Y += 15;
                        X  = vychoziX;
                    }
                }
            }
            foreach (UOItem item in World.Player.Backpack.AllItems)
            {
                if (item.Graphic == potionGraphic3 && item.Color == potionColor3)
                {
                    using (ItemUpdateEventWaiter ew = new ItemUpdateEventWaiter(item)) {
                        UO.MoveItem(item.Serial, 1, Aliases.Backpack, X, Y);
                        if (!ew.Wait(5000))
                        {
                            ScriptErrorException.Throw("Nemuzu pohnout s itemem, konec.");
                            return;
                        }
                    }
                    X += 5;
                    if (X >= maxX)
                    {
                        Y += 15;
                        X  = vychoziX;
                    }
                }
            }
            foreach (UOItem item in World.Player.Backpack.AllItems)
            {
                if (item.Graphic == potionGraphic4 && item.Color == potionColor4)
                {
                    using (ItemUpdateEventWaiter ew = new ItemUpdateEventWaiter(item)) {
                        UO.MoveItem(item.Serial, 1, Aliases.Backpack, X, Y);
                        if (!ew.Wait(5000))
                        {
                            ScriptErrorException.Throw("Nemuzu pohnout s itemem, konec.");
                            return;
                        }
                    }
                    X += 5;
                    if (X >= maxX)
                    {
                        Y += 15;
                        X  = vychoziX;
                    }
                }
            }
            X += 10;
            foreach (UOItem item in World.Player.Backpack.AllItems)
            {
                if (item.Graphic == potionGraphic5 && item.Color == potionColor5)
                {
                    using (ItemUpdateEventWaiter ew = new ItemUpdateEventWaiter(item)) {
                        UO.MoveItem(item.Serial, 1, Aliases.Backpack, X, Y);
                        if (!ew.Wait(5000))
                        {
                            ScriptErrorException.Throw("Nemuzu pohnout s itemem, konec.");
                            return;
                        }
                    }
                    X += 5;
                    if (X >= maxX)
                    {
                        Y += 15;
                        X  = vychoziX;
                    }
                }
            }
            UO.Print("Konec rovnani");
        }