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); } } }
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; } }
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); } } }
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(); } } }
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; } }
// 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); }
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(); } }
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; }
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; }
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); } }
// 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); }
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(); } } }
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); }
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); } }
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); } }
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; }
private static OrbClientState GetClientState(OrbClientInfo clientInfo) { return (OrbClientState)m_Clients[clientInfo.ClientID]; }
private static OrbClientState GetClientState(OrbClientInfo clientInfo) { return((OrbClientState)m_Clients[clientInfo.ClientID]); }
internal OrbClientState(OrbClientInfo clientInfo, IAccount account, DateTime loginTime) : base(clientInfo.ClientID, clientInfo.UserName) { m_Account = account; m_LoginTime = loginTime; }
// 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; }