示例#1
0
        public override void OnCommand(OrbClientInfo client, OrbCommandArgs cmdArgs)
        {
            if (cmdArgs == null || !(cmdArgs is MoveItemsArgs))
            {
                return;
            }

            MoveItemsArgs args = (MoveItemsArgs)cmdArgs;

            if (args.Count > 0)
            {
                int xoffset = args.Xoffset;
                int yoffset = args.Yoffset;
                int zoffset = args.Zoffset;

                int[] serials = args.ItemSerials;

                for (int i = 0; i < serials.Length; ++i)
                {
                    Item item = World.FindItem(serials[i]);

                    if (item == null)
                    {
                        continue;
                    }

                    int newX = item.X + xoffset;
                    int newY = item.Y + yoffset;
                    int newZ = item.Z + zoffset;

                    item.Location = new Point3D(newX, newY, newZ);
                }
            }
        }
示例#2
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);
        }
        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;
            }
        }
示例#4
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);
        }
		public override void OnCommand(OrbClientInfo client, OrbCommandArgs cmdArgs)
		{
			if(cmdArgs == null || !(cmdArgs is MoveItemsArgs) )
				return;

			MoveItemsArgs args = (MoveItemsArgs)cmdArgs;

			if(args.Count > 0)
			{
				int xoffset = args.Xoffset;
				int yoffset = args.Yoffset;
				int zoffset = args.Zoffset;

				int[] serials = args.ItemSerials;

				for(int i=0; i < serials.Length; ++i)
				{
					Item item = World.FindItem(serials[i]);

					if(item == null)
						continue;

					int newX = item.X + xoffset;
					int newY = item.Y + yoffset;
					int newZ = item.Z + zoffset;

					item.Location = new Point3D(newX, newY, newZ);
				}
			}
		}
示例#6
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;
		}
        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);
            }
        }
        public override void OnCommand(OrbClientInfo clientInfo, OrbCommandArgs cmdArgs)
        {
            if (cmdArgs == null || !(cmdArgs is DeleteCommandArgs))
            {
                return;
            }

            DeleteCommandArgs args = (DeleteCommandArgs)cmdArgs;

            if (args.Count > 0)
            {
                int[] serials = args.ItemSerials;

                for (int i = 0; i < serials.Length; ++i)
                {
                    Item item = World.FindItem(serials[i]);

                    if (item == null || item.Deleted)
                    {
                        continue;
                    }

                    item.Delete();
                }
            }
        }
示例#9
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;
            }
        }
示例#10
0
        // override the abstract OnCommand method. This method is called by the scripted OrbServer class
        public override void OnCommand(OrbClientInfo clientInfo, OrbCommandArgs 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;

            // cast the args to the appropriate subclass
            SendMessageArgs msgArgs = (SendMessageArgs)args;

            if (client.OnlineMobile != null)
            {
                // send the message to the logged in character
                client.OnlineMobile.SendMessage(msgArgs.Message);
            }
        }
		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);
		}
示例#12
0
        private static void OnExecuteCommand(string alias, OrbClientInfo clientInfo, OrbCommandArgs args)
        {
            OrbClientState client = GetClientState(clientInfo);

            if (client == null)
            {
                return;
            }

            OrbCommand command = GetCommand(alias, client);

            if (command != null)
            {
                new CommandSyncTimer(client, command, args).Start();
            }
        }
示例#13
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;
		}
示例#14
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;
        }
示例#15
0
		private static void OnExecuteCommand(string alias, OrbClientInfo clientInfo, OrbCommandArgs args)
		{
			OrbClientState client = GetClientState(clientInfo);

			if(client == null)
				return;

			try
			{
				OrbCommand command = GetCommand(alias, client);

				if(command != null)
				{
					new CommandSyncTimer(client, command, args).Start();
				}
			}
			catch(Exception e)
			{
				Console.WriteLine("Exception occurred for OrbServer command {0}\nMessage: {1}", alias, e.Message);
			}
		}
示例#16
0
        // This function callback validates an account and returns true if it has access
        // rights to use this tool.
        private static LoginCodes OnLogin(OrbClientInfo clientInfo, string password)
        {
            LoginCodes code = LoginCodes.Success;

            //Console.WriteLine("OnValidateAccount");
            Account account = Accounts.GetAccount(clientInfo.UserName);

            if (account == null || account.CheckPassword(password) == false)
            {
                code = LoginCodes.InvalidAccount;
            }
            else
            {
                if (!IsAccessAllowed(account, REQUIRED_ACCESS_LEVEL))
                {
                    Mobile player = GetOnlineMobile(account);

                    if (player == null || !IsAccessAllowed(player, REQUIRED_ACCESS_LEVEL))
                    {
                        // Neither the account or the char the account is logged in with has
                        // the required accesslevel to make this connection.
                        code = LoginCodes.NotAuthorized;
                    }
                }

                Console.WriteLine("{0} connected to the Orb Script Server", account.Username);
            }

            if (code == LoginCodes.Success)
            {
                if (m_Clients.ContainsKey(clientInfo.ClientID))
                {
                    m_Clients.Remove(clientInfo.ClientID);
                }

                m_Clients.Add(clientInfo.ClientID, new OrbClientState(clientInfo, account, DateTime.Now));
            }

            return(code);
        }
示例#17
0
		public override void OnCommand(OrbClientInfo clientInfo, OrbCommandArgs cmdArgs)
		{
			if(cmdArgs == null || !(cmdArgs is DeleteCommandArgs) )
				return;

			DeleteCommandArgs args = (DeleteCommandArgs)cmdArgs;

			if(args.Count > 0)
			{
				int[] serials = args.ItemSerials;

				for(int i=0; i < serials.Length; ++i)
				{
					Item item = World.FindItem(serials[i]);

					if(item == null || item.Deleted)
						continue;

					item.Delete();
				}
			}
		}
示例#18
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);
        }
示例#19
0
        private static void OnExecuteCommand(string alias, OrbClientInfo clientInfo, OrbCommandArgs args)
        {
            OrbClientState client = GetClientState(clientInfo);

            if (client == null)
            {
                return;
            }

            try
            {
                OrbCommand command = GetCommand(alias, client);

                if (command != null)
                {
                    new CommandSyncTimer(client, command, args).Start();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception occurred for OrbServer command {0}\nMessage: {1}", alias, e.Message);
            }
        }
示例#20
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);
			}
		}
示例#22
0
 internal OrbClientState(OrbClientInfo clientInfo, Account account, DateTime loginTime) : base(clientInfo.ClientID, clientInfo.UserName)
 {
     m_Account   = account;
     m_LoginTime = loginTime;
 }
		public void FindOnlineMobile(OrbClientInfo client)
		{
			m_OnlineMobile = ((OrbClientState)client).OnlineMobile;
		}
示例#24
0
		private static OrbClientState GetClientState(OrbClientInfo clientInfo)
		{
			return (OrbClientState)m_Clients[clientInfo.ClientID];
		}
示例#25
0
 private static OrbClientState GetClientState(OrbClientInfo clientInfo)
 {
     return((OrbClientState)m_Clients[clientInfo.ClientID]);
 }
示例#26
0
        internal OrbClientState(OrbClientInfo clientInfo, IAccount account, DateTime loginTime)
            : base(clientInfo.ClientID, clientInfo.UserName)
		{
			m_Account = account;
			m_LoginTime = loginTime;
		}
示例#27
0
		// This function callback validates an account and returns true if it has access
		// rights to use this tool.
		private static LoginCodes OnLogin(OrbClientInfo clientInfo, string password)
		{
			LoginCodes code = LoginCodes.Success;

			//Console.WriteLine("OnValidateAccount");
			IAccount account = Accounts.GetAccount(clientInfo.UserName);

			if(account == null || account.CheckPassword(password) == false)
			{
				code = LoginCodes.InvalidAccount;
			}
			else
			{
				if(!IsAccessAllowed(account, REQUIRED_ACCESS_LEVEL))
				{
					Mobile player = GetOnlineMobile(account);

					if(player == null || !IsAccessAllowed(player, REQUIRED_ACCESS_LEVEL))
					{
						// Neither the account or the char the account is logged in with has
						// the required accesslevel to make this connection.
						code = LoginCodes.NotAuthorized;
					}
				}
				
				Console.WriteLine("{0} connected to the Orb Script Server", account.Username);
			}

			if(code == LoginCodes.Success)
			{
				if(m_Clients.ContainsKey(clientInfo.ClientID))
					m_Clients.Remove(clientInfo.ClientID);

				m_Clients.Add(clientInfo.ClientID, new OrbClientState(clientInfo, account, DateTime.Now));
			}

			return code;
		}
示例#28
0
 public void FindOnlineMobile(OrbClientInfo client)
 {
     m_OnlineMobile = ((OrbClientState)client).OnlineMobile;
 }