Exemplo n.º 1
0
        public override void OnRequest(OrbClientInfo clientInfo, OrbRequestArgs reqArgs)
        {
            FindOnlineMobile(clientInfo);

            if(reqArgs == null || !(reqArgs is SelectItemsRequestArgs) || !this.IsOnline)
                SendResponse(null);

            _args = (SelectItemsRequestArgs)reqArgs;

            if(_args.SelectType == SelectTypes.Area)
            {
                BoundingBoxPickerEx picker = new BoundingBoxPickerEx();
                picker.OnCancelled += new BoundingBoxExCancelled(OnTargetCancelled);
                picker.Begin( this.Mobile, new BoundingBoxCallback( BoundingBox_Callback ), null );
            }
            else
            {
                UOAR_ObjectTarget target = new UOAR_ObjectTarget();
                target.OnCancelled += new UOAR_ObjectTarget.TargetCancelEvent(OnTargetCancelled);
                target.OnTargetObject += new UOAR_ObjectTarget.TargetObjectEvent(OnTargetObject);

                this.Mobile.SendMessage("Target the first item you want to select.");
                // send the target to the char
                this.Mobile.Target = target;
            }
        }
Exemplo n.º 2
0
        public static OrbResponse SendRequest(string alias, OrbRequestArgs args)
        {
            bool        success  = true;
            string      reason   = null;
            OrbResponse response = null;

            if (!IsConnected)
            {
                reason  = "A connection is required before this request can be sent to the server.";
                success = false;
            }

            try
            {
                response = m_Connection.SendRequest(alias, new OrbClientInfo(m_ClientID, m_UserName), args);
                success  = true;
            }
            catch
            {
                reason  = "Connection to the server was lost.";
                success = false;
            }

            if (!success)
            {
                MessageBox.Show(reason, "Command Failed");
            }

            return(response);
        }
Exemplo n.º 3
0
		private static OrbResponse OnExecuteRequest(string alias, OrbClientInfo clientInfo, OrbRequestArgs args)
		{
			OrbClientState client = GetClientState(clientInfo);
			
			if(client == null)
				return null;

			OrbResponse response = null;

			try
			{
				OrbRequest request = GetRequest(alias, client);

				if(request != null)
				{
					ManualResetEvent reset = new ManualResetEvent(false);
					request.ResetEvent = reset;

					new RequestSyncTimer(client, request, args).Start();
					reset.WaitOne();

					response = request.Response;
				}
			}
			catch(Exception e)
			{
				Console.WriteLine("Exception occurred for OrbServer request {0}\nMessage: {1}", alias, e.Message);
			}

			return response;
		}
Exemplo n.º 4
0
        public override void OnRequest(OrbClientInfo clientInfo, OrbRequestArgs reqArgs)
        {
            FindOnlineMobile(clientInfo);

            if (reqArgs == null || !(reqArgs is SelectItemsRequestArgs) || !this.IsOnline)
            {
                SendResponse(null);
            }

            _args = (SelectItemsRequestArgs)reqArgs;

            if (_args.SelectType == SelectTypes.Area)
            {
                BoundingBoxPickerEx picker = new BoundingBoxPickerEx();
                picker.OnCancelled += new BoundingBoxExCancelled(OnTargetCancelled);
                picker.Begin(this.Mobile, new BoundingBoxCallback(BoundingBox_Callback), null);
            }
            else
            {
                UOAR_ObjectTarget target = new UOAR_ObjectTarget();
                target.OnCancelled    += new UOAR_ObjectTarget.TargetCancelEvent(OnTargetCancelled);
                target.OnTargetObject += new UOAR_ObjectTarget.TargetObjectEvent(OnTargetObject);

                this.Mobile.SendMessage("Target the first item you want to select.");
                // send the target to the char
                this.Mobile.Target = target;
            }
        }
        public override void OnRequest(OrbClientInfo client, OrbRequestArgs args)
        {
            FindOnlineMobile(client);

            if (args == null)
            {
                SendResponse(null);
            }
            else if (!(args is ExtractRequestArgs))
            {
                SendResponse(null);
            }
            else if (!this.IsOnline)
            {
                SendResponse(null);
            }

            _args = args as ExtractRequestArgs;

            if (_args.ItemSerials == null)
            {
                _picker              = new BoundingBoxPickerEx();
                _picker.OnCancelled += new BoundingBoxExCancelled(OnTargetCancelled);
                _picker.Begin(this.Mobile, new BoundingBoxCallback(BoundingBox_Callback), null);
            }
            else
            {
                ExtractItems(_args.ItemSerials);
            }
        }
Exemplo n.º 6
0
        private static OrbResponse ExecuteRequest(string alias, OrbRequestArgs args)
        {
            RaiseBusyEvent();
            OrbResponse resp = OrbClient.SendRequest(alias, args);

            RaiseReadyEvent();

            return(resp);
        }
Exemplo n.º 7
0
		public override void OnRequest(OrbClientInfo clientInfo, OrbRequestArgs args)
		{
			FindOnlineMobile(clientInfo);

			if(args == null)
				SendResponse(null);
			else if(!(args is BuildRequestArgs))
				SendResponse(null);
			else if(!this.IsOnline)
				SendResponse(null);

			m_Items = ((BuildRequestArgs)args).Items;

			Mobile.SendMessage("Target the ground where you want to place the building");
			this.Mobile.Target = new BuildDesignTarget(this);
		}
Exemplo n.º 8
0
        public OrbResponse SendRequest(string alias, OrbClientInfo client, OrbRequestArgs args)
        {
            OrbResponse response = null;

            try
            {
                if (OnExecuteRequest != null)
                {
                    response = OnExecuteRequest(alias, client, args);
                }
            }
            catch
            {
            }

            return(response);
        }
Exemplo n.º 9
0
		public override void OnRequest(OrbClientInfo clientInfo, OrbRequestArgs args)
		{
			FindOnlineMobile(clientInfo);

			if(!this.IsOnline)
			{
				SendResponse(null);
				return;
			}

			UOAR_ObjectTarget target = new UOAR_ObjectTarget();
			target.OnTargetObject += new UOAR_ObjectTarget.TargetObjectEvent(OnTarget);
			target.OnCancelled += new UOAR_ObjectTarget.TargetCancelEvent(OnCancelTarget);
			
			this.Mobile.SendMessage("Target an object");
			this.Mobile.Target = target;
		}
Exemplo n.º 10
0
        public override void OnRequest(OrbClientInfo clientInfo, OrbRequestArgs args)
        {
            FindOnlineMobile(clientInfo);

            if (!this.IsOnline)
            {
                SendResponse(null);
                return;
            }

            UOAR_ObjectTarget target = new UOAR_ObjectTarget();

            target.OnTargetObject += new UOAR_ObjectTarget.TargetObjectEvent(OnTarget);
            target.OnCancelled    += new UOAR_ObjectTarget.TargetCancelEvent(OnCancelTarget);

            this.Mobile.SendMessage("Target an object");
            this.Mobile.Target = target;
        }
Exemplo n.º 11
0
        public override void OnRequest(OrbClientInfo clientInfo, OrbRequestArgs args)
        {
            FindOnlineMobile(clientInfo);

            if (args == null)
            {
                SendResponse(null);
            }
            else if (!(args is BuildRequestArgs))
            {
                SendResponse(null);
            }
            else if (!this.IsOnline)
            {
                SendResponse(null);
            }

            m_Items = ((BuildRequestArgs)args).Items;

            Mobile.SendMessage("Target the ground where you want to place the building");
            this.Mobile.Target = new BuildDesignTarget(this);
        }
Exemplo n.º 12
0
        public override void OnRequest(OrbClientInfo clientInfo, OrbRequestArgs args)
        {
            // cast the clientInfo into the OrbClientState subclass that contains addition info
            // such as the OrbClientID, Account, and logged in char if online.
            OrbClientState client = (OrbClientState)clientInfo;

            if (client.OnlineMobile != null)
            {
                // char is logged in, return its location
                GetLocationResponse resp = new GetLocationResponse();
                resp.X = client.OnlineMobile.Location.X;
                resp.Y = client.OnlineMobile.Location.Y;
                resp.Z = client.OnlineMobile.Location.Z;

                // send the response back to the test utility
                SendResponse(resp);
            }
            else
            {
                // char is offline, return null
                SendResponse(null);
            }
        }
		public override void OnRequest(OrbClientInfo client, OrbRequestArgs args)
		{
			FindOnlineMobile(client);

			if(args == null)
				SendResponse(null);
			else if(!(args is ExtractRequestArgs))
				SendResponse(null);
			else if(!this.IsOnline)
				SendResponse(null);

			_args = args as ExtractRequestArgs;

			if(_args.ItemSerials == null)
			{
				_picker = new BoundingBoxPickerEx();
				_picker.OnCancelled += new BoundingBoxExCancelled(OnTargetCancelled);
				_picker.Begin( this.Mobile, new BoundingBoxCallback( BoundingBox_Callback ), null );
			}
			else
			{
				ExtractItems(_args.ItemSerials);
			}
		}
Exemplo n.º 14
0
        private static OrbResponse OnExecuteRequest(string alias, OrbClientInfo clientInfo, OrbRequestArgs args)
        {
            OrbClientState client = GetClientState(clientInfo);

            if (client == null)
            {
                return(null);
            }

            OrbRequest  request  = GetRequest(alias, client);
            OrbResponse response = null;

            if (request != null)
            {
                ManualResetEvent reset = new ManualResetEvent(false);
                request.ResetEvent = reset;

                new RequestSyncTimer(client, request, args).Start();
                reset.WaitOne();

                response = request.Response;
            }

            return(response);
        }
Exemplo n.º 15
0
			public RequestSyncTimer(OrbClientState client, OrbRequest request, OrbRequestArgs args) : base(TimeSpan.FromMilliseconds(20.0), TimeSpan.FromMilliseconds(20.0))
			{
				m_Client = client;
				m_Request = request;
				m_Args = args;
			}
Exemplo n.º 16
0
        private static OrbResponse OnExecuteRequest(string alias, OrbClientInfo clientInfo, OrbRequestArgs args)
        {
            OrbClientState client = GetClientState(clientInfo);

            if (client == null)
            {
                return(null);
            }

            OrbResponse response = null;

            try
            {
                OrbRequest request = GetRequest(alias, client);

                if (request != null)
                {
                    ManualResetEvent reset = new ManualResetEvent(false);
                    request.ResetEvent = reset;

                    new RequestSyncTimer(client, request, args).Start();
                    reset.WaitOne();

                    response = request.Response;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception occurred for OrbServer request {0}\nMessage: {1}", alias, e.Message);
            }

            return(response);
        }
Exemplo n.º 17
0
        public static GetLocationResp SendGetLocationRequest(OrbRequestArgs args)
        {
            Ultima.Client.BringToTop();

            return((GetLocationResp)OrbClient.SendRequest("UOAR_GetLocation", args));
        }
Exemplo n.º 18
0
 public RequestSyncTimer(OrbClientState client, OrbRequest request, OrbRequestArgs args) : base(TimeSpan.FromMilliseconds(20.0), TimeSpan.FromMilliseconds(20.0))
 {
     m_Client  = client;
     m_Request = request;
     m_Args    = args;
 }
Exemplo n.º 19
0
 public abstract void OnRequest(OrbClientInfo clientInfo, OrbRequestArgs args);