Example #1
0
        public static int EmptyContainer(int pause, Serial source, Serial target)
        {
            pause = Math.Max(pause, 100);

            if (!source.IsValid)
            {
                ScriptErrorException.Throw("Source container serial is invalid.");
                return(-1);
            }

            if (!target.IsValid)
            {
                ScriptErrorException.Throw("Target container serial is invalid.");
                return(-1);
            }

            int movedCount = 0;

            foreach (UOItem item in World.GetItem(source).Items)
            {
                if (item.Move(0, target))
                {
                    movedCount++;
                }

                UO.Wait(pause);
            }

            return(movedCount);
        }
Example #2
0
File: UO.cs Project: byterj/phoenix
        public static void Loop(int executions, string script, params object[] args)
        {
            while (executions != 0)
            {
                RuntimeCore.Executions.Run(RuntimeCore.ExecutableList[script], args);

                if (executions > 0)
                {
                    executions--;
                }

                UO.Wait(1000);
            }
        }
Example #3
0
File: UO.cs Project: byterj/phoenix
        public static void LoopCmd(int executions, string command, params object[] args)
        {
            while (executions != 0)
            {
                RuntimeCore.Executions.Run(RuntimeCore.CommandList[command], args);

                if (executions > 0)
                {
                    executions--;
                }

                UO.Wait(1000);
            }
        }
Example #4
0
File: UO.cs Project: byterj/phoenix
        /// <summary>
        /// Simuluje stisk klavesy v klientovy.
        /// </summary>
        /// <param name="key">Klavesa pro zmacknuti. Nesmi obsahovat ctrl/shift/alt.</param>
        /// <remarks>Pro kompatibilitu s yokem.</remarks>
        public static void Press(Keys key)
        {
            if ((key & Keys.Modifiers) != Keys.None)
            {
                throw new ScriptErrorException("Modifiers are not supported.");
            }
            if (key == System.Windows.Forms.Keys.None)
            {
                return;
            }

            Client.PostMessage(Client.WM_KEYDOWN, (int)key, 0);
            Client.PostMessage(Client.WM_KEYUP, (int)key, 3);
            UO.Wait(100);
        }