예제 #1
0
파일: UO.World.cs 프로젝트: byterj/phoenix
        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);
        }
예제 #2
0
파일: UO.cs 프로젝트: 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);
            }
        }
예제 #3
0
파일: UO.cs 프로젝트: 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);
            }
        }
예제 #4
0
파일: UO.cs 프로젝트: 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);
        }