protected override void OnRun(MessageContent content, ClientCommandArgs args) { if (content.Room == null) { throw new ArgumentNullException("room"); } using (var client = ClientModel.Get()) { Room prevRoom; if (!client.Rooms.TryGetValue(content.Room.Name, out prevRoom)) { throw new ModelException(ErrorCode.RoomNotFound); } client.Rooms[content.Room.Name] = content.Room; content.Room.Enabled = prevRoom.Enabled; UpdateUsers(client, content.Users); UpdateRoomUsers(client, content.Room, prevRoom); UpdateRoomFiles(client, content.Room, prevRoom); } var eventArgs = new RoomEventArgs { RoomName = content.Room.Name, Users = content.Users .Select(u => u.Nick) .ToList() }; ClientModel.Notifier.RoomRefreshed(eventArgs); }
protected override void OnRun(MessageContent content, ClientCommandArgs args) { if (content.Message == null) { throw new ArgumentException("message"); } if (string.IsNullOrEmpty(content.RoomName)) { throw new ArgumentException("roomName"); } using (var client = ClientModel.Get()) { var room = client.Rooms[content.RoomName]; room.AddMessage(content.Message); var receiveMessageArgs = new ReceiveMessageEventArgs { Type = MessageType.Common, RoomName = content.RoomName, MessageId = content.Message.Id, Time = content.Message.Time, Message = content.Message.Text, Sender = content.Message.Owner, }; ClientModel.Notifier.ReceiveMessage(receiveMessageArgs); } }
protected override void OnDataReceived(DataReceivedEventArgs e) { try { if (e.Error != null) { throw e.Error; } if (TrySetAPI(e)) { return; } var command = ClientModel.API.GetCommand(e.ReceivedData); var args = new ClientCommandArgs { Message = e.ReceivedData }; requestQueue.Add(ClientId, command, args); } catch (Exception exc) { ClientModel.Notifier.AsyncError(new AsyncErrorEventArgs { Error = exc }); ClientModel.Logger.Write(exc); } }
public override bool OnClientCommand(Game game, ClientCommandArgs args) { if (args.command == "fps") { IntRef argumentsLength = new IntRef(); string[] arguments = m.GetPlatform().StringSplit(args.arguments, " ", argumentsLength); if (m.GetPlatform().StringTrim(args.arguments) == "") { drawfpstext = true; } else if (arguments[0] == "1") { drawfpstext = true; drawfpsgraph = false; } else if (arguments[0] == "2") { drawfpstext = true; drawfpsgraph = true; } else { drawfpstext = false; drawfpsgraph = false; } return true; } return false; }
protected override void OnRun(MessageContent content, ClientCommandArgs args) { var address = ClientModel.Client.RemotePoint.Address; var endPoint = new IPEndPoint(address, content.Port); ClientModel.Peer.ConnectToService(endPoint); }
protected override void OnRun(MessageContent content, ClientCommandArgs args) { if (content.RemoteInfo == null) { throw new ArgumentNullException("info"); } if (content.RequestPoint == null) { throw new ArgumentNullException("request point"); } if (content.SenderPoint == null) { throw new ArgumentNullException("sender point"); } ClientModel.Peer.WaitConnection(content.SenderPoint); var sendingContent = new ServerP2PReadyAcceptCommand.MessageContent { PeerPoint = content.RequestPoint, ReceiverNick = content.RemoteInfo.Nick }; using (var client = ClientModel.Get()) sendingContent.RemoteInfo = client.User; ClientModel.Client.SendMessage(ServerP2PReadyAcceptCommand.CommandId, sendingContent); }
private void OnPackageReceived(NetIncomingMessage message) { try { var peerId = (string)message.SenderConnection.Tag; IPackage package; using (var crypter = new Crypter()) { crypter.SetKey(GetKey(peerId)); package = crypter.Decrypt <IPackage>(message.Data); } var command = ClientModel.Api.GetCommand(package.Id); var args = new ClientCommandArgs(peerId, package); requestQueue.Add(peerId, command, args); } catch (Exception exc) { ClientModel.Notifier.AsyncError(new AsyncErrorEventArgs { Error = exc }); ClientModel.Logger.Write(exc); } }
protected override void OnRun(MessageContent content, ClientCommandArgs args) { if (content.File == null) { throw new ArgumentNullException("file"); } if (string.IsNullOrEmpty(content.RoomName)) { throw new ArgumentException("roomName"); } using (var client = ClientModel.Get()) { var downloadFiles = client.DownloadingFiles.Where((dFile) => dFile.File.Equals(content.File)); foreach (var file in downloadFiles) { file.Dispose(); } } var downloadEventArgs = new FileDownloadEventArgs { File = content.File, Progress = 0, RoomName = content.RoomName, }; ClientModel.Notifier.PostedFileDeleted(downloadEventArgs); }
public override bool OnClientCommand(Game game, ClientCommandArgs args) { if (args.command == "fps") { IntRef argumentsLength = new IntRef(); string[] arguments = m.GetPlatform().StringSplit(args.arguments, " ", argumentsLength); if (m.GetPlatform().StringTrim(args.arguments) == "") { drawfpstext = true; } else if (arguments[0] == "1") { drawfpstext = true; drawfpsgraph = false; } else if (arguments[0] == "2") { drawfpstext = true; drawfpsgraph = true; } else { drawfpstext = false; drawfpsgraph = false; } return(true); } return(false); }
public override bool OnClientCommand(Game game, ClientCommandArgs args) { if (args.command == "fps") { IntRef argumentsLength = new IntRef(); string[] arguments = m.GetPlatform().StringSplit(args.arguments, " ", argumentsLength); if (m.GetPlatform().StringTrim(args.arguments) == "") { DRAW_FPS_TEXT = true; } else if (arguments[0] == "1") { DRAW_FPS_TEXT = true; DRAW_FPS_GRAPH = false; } else if (arguments[0] == "2") { DRAW_FPS_TEXT = true; DRAW_FPS_GRAPH = true; } else { DRAW_FPS_TEXT = false; DRAW_FPS_GRAPH = false; } return(true); } else if (args.command == "pos") { DRAW_POSITION = game.BoolCommandArgument(args.arguments); return(true); } return(false); }
protected override void OnRun(MessageContent content, ClientCommandArgs args) { if (content.Room == null) { throw new ArgumentNullException("room"); } if (content.Type == RoomType.Voice) { var room = content.Room as VoiceRoom; if (room == null) { throw new ArgumentException("type"); } List <string> mapForUser; using (var client = ClientModel.Get()) mapForUser = room.ConnectionMap[client.User.Nick]; foreach (string nick in mapForUser) { ClientModel.Api.ConnectToPeer(nick); } } using (var client = ClientModel.Get()) client.Rooms.Add(content.Room.Name, content.Room); ClientModel.Notifier.RoomOpened(new RoomEventArgs { Room = content.Room, Users = content.Users }); }
protected override void OnRun(MessageContent content, ClientCommandArgs args) { if (ClientModel.Api.IsActiveInterlocutor(args.PeerConnectionId)) { ClientModel.Player.Enqueue(args.PeerConnectionId, content.Number, content.Pack); } }
protected override void OnRun(MessageContent content, ClientCommandArgs args) { if (content.File == null) { throw new ArgumentNullException("File"); } if (content.Length <= 0) { throw new ArgumentException("Length <= 0"); } if (content.StartPartPosition < 0) { throw new ArgumentException("StartPartPosition < 0"); } if (string.IsNullOrEmpty(content.RoomName)) { throw new ArgumentException("roomName"); } using (var client = ClientModel.Get()) { if (!client.PostedFiles.Exists(c => c.File.Equals(content.File))) { var fileNotPostContent = new ServerRemoveFileFromRoomCommand.MessageContent { FileId = content.File.Id, RoomName = content.RoomName, }; ClientModel.Client.SendMessage(ServerRemoveFileFromRoomCommand.CommandId, fileNotPostContent); return; } } var sendingContent = new ClientWriteFilePartCommand.MessageContent { File = content.File, StartPartPosition = content.StartPartPosition, RoomName = content.RoomName, }; var partSize = content.File.Size < content.StartPartPosition + content.Length ? content.File.Size - content.StartPartPosition : content.Length; var part = new byte[partSize]; using (var client = ClientModel.Get()) { var sendingFileStream = client.PostedFiles.First(c => c.File.Equals(content.File)).ReadStream; sendingFileStream.Position = content.StartPartPosition; sendingFileStream.Read(part, 0, part.Length); } ClientModel.Peer.SendMessage(args.PeerConnectionId, ClientWriteFilePartCommand.CommandId, sendingContent, part); }
public override bool OnClientCommand(Game game, ClientCommandArgs args) { if (args.command == "testmodel") { game.ENABLE_DRAW_TEST_CHARACTER = game.BoolCommandArgument(args.arguments); return true; } return false; }
public override bool OnClientCommand(Game game, ClientCommandArgs args) { if (args.command == "chunk") { draw = !draw; return(true); } return(false); }
public override bool OnClientCommand(Game game, ClientCommandArgs args) { if (args.command == "chunk") { draw = !draw; return true; } return false; }
public override bool OnClientCommand(Game game, ClientCommandArgs args) { if (args.command == "testmodel") { game.ENABLE_DRAW_TEST_CHARACTER = game.BoolCommandArgument(args.arguments); return(true); } return(false); }
protected override void OnRun(MessageContent content, ClientCommandArgs args) { var eventArgs = new RegistrationEventArgs { Registered = content.Registered, Message = content.Message }; ClientModel.Notifier.ReceiveRegistrationResponse(eventArgs); }
protected override void OnRun(MessageContent content, ClientCommandArgs args) { if (string.IsNullOrEmpty(content.RoomName)) { throw new ArgumentException("roomName"); } using (var client = ClientModel.Get()) ClientModel.Api.ClosePostedFile(client, content.RoomName, content.FileId); }
protected override void OnRun(MessageContent content, ClientCommandArgs args) { if (content.Message == MessageId.None) throw new ArgumentException("message"); ClientModel.Notifier.ReceiveMessage(new ReceiveMessageEventArgs { SystemMessage = content.Message, SystemMessageFormat = content.FormatParams, Type = MessageType.System }); }
protected override void OnRun(MessageContent content, ClientCommandArgs args) { if (string.IsNullOrEmpty(content.Message)) { throw new ArgumentException("message"); } ClientModel.Notifier.ReceiveMessage(new ReceiveMessageEventArgs { Message = content.Message, Type = MessageType.System }); }
protected override void OnRun(MessageContent content, ClientCommandArgs args) { if (content.Room == null) { throw new ArgumentNullException("room"); } using (var client = ClientModel.Get()) client.Rooms[content.Room.Name] = content.Room; ClientModel.Notifier.RoomRefreshed(new RoomEventArgs { Room = content.Room, Users = content.Users }); }
protected override void OnRun(MessageContent content, ClientCommandArgs args) { if (content.RemoteInfo == null) { throw new ArgumentNullException("info"); } if (content.PeerPoint == null) { throw new ArgumentNullException("PeerPoint"); } ClientModel.Peer.ConnectToPeer(content.RemoteInfo.Nick, content.PeerPoint); }
protected override void OnRun(MessageContent content, ClientCommandArgs args) { if (content.Room == null) { throw new ArgumentNullException("room"); } ClientModel.Notifier.RoomClosed(new RoomEventArgs { Room = content.Room }); using (var client = ClientModel.Get()) client.Rooms.Remove(content.Room.Name); }
protected override void OnRun(MessageContent content, ClientCommandArgs args) { if (content.Room == null) { throw new ArgumentNullException("room"); } using (var client = ClientModel.Get()) { content.Room.Enabled = true; client.Rooms.Add(content.Room.Name, content.Room); UpdateUsers(client, content.Users); if (content.Type == RoomType.Voice) { var room = content.Room as VoiceRoom; if (room == null) { throw new ArgumentException("type"); } foreach (var nick in room.Users) { if (nick == client.User.Nick) { continue; } ClientModel.Api.AddInterlocutor(nick); } var mapForUser = room.ConnectionMap[client.User.Nick]; foreach (var nick in mapForUser) { ClientModel.Api.ConnectToPeer(nick); } } } var eventArgs = new RoomEventArgs { RoomName = content.Room.Name, Users = content.Users .Select(u => u.Nick) .ToList() }; ClientModel.Notifier.RoomOpened(eventArgs); }
protected override void OnRun(MessageContent content, ClientCommandArgs args) { if (content.Message == null) { throw new ArgumentNullException("message"); } var receiveMessageArgs = new ReceiveMessageEventArgs { Type = MessageType.Private, Message = content.Message, Sender = args.PeerConnectionId, }; ClientModel.Notifier.ReceiveMessage(receiveMessageArgs); }
protected override void OnPackageReceived(PackageReceivedEventArgs e) { try { if (e.Exception != null) { OnError(e.Exception); return; } var command = ClientModel.Api.GetCommand(e.Unpacked.Package.Id); var args = new ClientCommandArgs(null, e.Unpacked); requestQueue.Add(ClientId, command, args); } catch (Exception exc) { OnError(exc); } }
private void OnPackageReceived(NetIncomingMessage message) { try { var peerId = (string)message.SenderConnection.Tag; var packer = GetPacker(peerId); var unpacked = packer.Unpack <IPackage>(message.Data); var command = ClientModel.Api.GetCommand(unpacked.Package.Id); var args = new ClientCommandArgs(peerId, unpacked); requestQueue.Add(peerId, command, args); } catch (Exception exc) { ClientModel.Notifier.AsyncError(new AsyncErrorEventArgs { Error = exc }); ClientModel.Logger.Write(exc); } }
private void DataReceived(NetIncomingMessage message) { try { var peerConnectionId = (string)message.SenderConnection.Tag; var command = ClientModel.API.GetCommand(message.Data); var args = new ClientCommandArgs { Message = message.Data, PeerConnectionId = peerConnectionId }; requestQueue.Add(peerConnectionId, command, args); } catch (Exception exc) { ClientModel.Notifier.AsyncError(new AsyncErrorEventArgs { Error = exc }); ClientModel.Logger.Write(exc); } }
protected override void OnRun(MessageContent content, ClientCommandArgs args) { if (content.File == null) { throw new ArgumentNullException("file"); } if (string.IsNullOrEmpty(content.RoomName)) { throw new ArgumentException("roomName"); } using (var client = ClientModel.Get()) { Room room; if (!client.Rooms.TryGetValue(content.RoomName, out room)) { return; } room.Files.RemoveAll(f => f.Id == content.File.Id); room.Files.Add(content.File); } var receiveMessageArgs = new ReceiveMessageEventArgs { Type = MessageType.File, MessageId = Room.SpecificMessageId, Time = DateTime.UtcNow, Message = content.File.Name, Sender = content.File.Id.Owner, RoomName = content.RoomName, FileId = content.File.Id, }; ClientModel.Notifier.ReceiveMessage(receiveMessageArgs); }
protected override void OnRun(MessageContent content, ClientCommandArgs args) { if (content.Room == null) { throw new ArgumentNullException("room"); } ClientModel.Notifier.RoomClosed(new RoomEventArgs { RoomName = content.Room.Name }); using (var client = ClientModel.Get()) { Room room; if (!client.Rooms.TryGetValue(content.Room.Name, out room)) { throw new ArgumentException("Room "); } client.Rooms.Remove(content.Room.Name); client.PostedFiles.RemoveAll(f => room.Files.Exists(rf => rf.Id == f.File.Id)); if (room.Enabled && room.Type == RoomType.Voice) { foreach (var nick in room.Users) { if (nick == client.User.Nick) { continue; } ClientModel.Api.RemoveInterlocutor(nick); } } } }
protected override void OnRun(MessageContent content, ClientCommandArgs args) { if (content.File == null) { throw new ArgumentNullException("file"); } if (string.IsNullOrEmpty(content.RoomName)) { throw new ArgumentException("roomName"); } var receiveMessageArgs = new ReceiveMessageEventArgs { Type = MessageType.File, MessageId = Room.SpecificMessageId, Message = content.File.Name, Sender = content.File.Owner.Nick, RoomName = content.RoomName, State = content.File, }; ClientModel.Notifier.ReceiveMessage(receiveMessageArgs); }
public virtual bool OnClientCommand(Game game, ClientCommandArgs args) { return false; }
protected override void OnRun(MessageContent content, ClientCommandArgs args) { if (content.File == null) { throw new ArgumentNullException("File"); } if (content.Part == null) { throw new ArgumentNullException("Part"); } if (content.StartPartPosition < 0) { throw new ArgumentException("StartPartPosition < 0"); } if (string.IsNullOrEmpty(content.RoomName)) { throw new ArgumentException("roomName"); } var downloadEventArgs = new FileDownloadEventArgs { RoomName = content.RoomName, File = content.File, }; using (var client = ClientModel.Get()) { var downloadingFile = client.DownloadingFiles.FirstOrDefault((current) => current.File.Equals(content.File)); if (downloadingFile == null) { return; } if (downloadingFile.WriteStream == null) { downloadingFile.WriteStream = File.Create(downloadingFile.FullName); } if (downloadingFile.WriteStream.Position == content.StartPartPosition) { downloadingFile.WriteStream.Write(content.Part, 0, content.Part.Length); } downloadingFile.File = content.File; if (downloadingFile.WriteStream.Position >= content.File.Size) { client.DownloadingFiles.Remove(downloadingFile); downloadingFile.WriteStream.Dispose(); downloadEventArgs.Progress = 100; } else { var sendingContent = new ClientReadFilePartCommand.MessageContent { File = content.File, Length = AsyncClient.DefaultFilePartSize, RoomName = content.RoomName, StartPartPosition = downloadingFile.WriteStream.Position, }; ClientModel.Peer.SendMessage(args.PeerConnectionId, ClientReadFilePartCommand.CommandId, sendingContent); downloadEventArgs.Progress = (int)((downloadingFile.WriteStream.Position * 100) / content.File.Size); } } ClientModel.Notifier.DownloadProgress(downloadEventArgs); }
protected override void OnRun(ClientCommandArgs args) { }
public override bool OnClientCommand(Game game, ClientCommandArgs args) { if (args.command == "cam") { IntRef argumentsLength = new IntRef(); string[] arguments = p.StringSplit(args.arguments, " ", argumentsLength); if (p.StringTrim(args.arguments) == "") { m.DisplayNotification("&6AutoCamera help."); m.DisplayNotification("&6.cam p&f - add a point to path"); m.DisplayNotification("&6.cam start [real seconds]&f - play the path"); m.DisplayNotification("&6.cam rec [real seconds] [video seconds]&f - play and record to .avi file"); m.DisplayNotification("&6.cam stop&f - stop playing and recording"); m.DisplayNotification("&6.cam clear&f - remove all points from path"); m.DisplayNotification("&6.cam save&f - copy path points to clipboard"); m.DisplayNotification("&6.cam load [points]&f - load path points"); return true; } if (arguments[0] == "p") { m.DisplayNotification("Point defined."); CameraPoint point = new CameraPoint(); point.positionGlX = m.GetLocalPositionX(); point.positionGlY = m.GetLocalPositionY(); point.positionGlZ = m.GetLocalPositionZ(); point.orientationGlX = m.GetLocalOrientationX(); point.orientationGlY = m.GetLocalOrientationY(); point.orientationGlZ = m.GetLocalOrientationZ(); cameraPoints[cameraPointsCount++] = point; } if (arguments[0] == "start" || arguments[0] == "play" || arguments[0] == "rec") { if (!m.IsFreemoveAllowed()) { m.DisplayNotification("Free move not allowed."); return true; } if (cameraPointsCount == 0) { m.DisplayNotification("No points defined. Enter points with \".cam p\" command."); return true; } playingSpeed = 1; float totalRecTime = -1; if (arguments[0] == "rec") { if (argumentsLength.value >= 3) { // video time totalRecTime = p.FloatParse(arguments[2]); } avi = m.AviWriterCreate(); avi.Open(p.StringFormat("{0}.avi", p.Timestamp()), framerate, m.GetWindowWidth(), m.GetWindowHeight()); } if (argumentsLength.value >= 2) { // play time float totalTime = p.FloatParse(arguments[1]); playingSpeed = TotalDistance() / totalTime; if (totalRecTime == -1) { recspeed = 10; } else { recspeed = totalTime / totalRecTime; } } playingTime = 0; firstFrameDone = false; previousPositionX = m.GetLocalPositionX(); previousPositionY = m.GetLocalPositionY(); previousPositionZ = m.GetLocalPositionZ(); previousOrientationX = m.GetLocalOrientationX(); previousOrientationY = m.GetLocalOrientationY(); previousOrientationZ = m.GetLocalOrientationZ(); m.ShowGui(0); previousFreemove = m.GetFreemove(); m.SetFreemove(FreemoveLevelEnum.Noclip); m.EnableCameraControl(false); } if (arguments[0] == "stop") { m.DisplayNotification("Camera stopped."); Stop(); } if (arguments[0] == "clear") { m.DisplayNotification("Camera points cleared."); cameraPointsCount = 0; Stop(); } if (arguments[0] == "save") { string s = "1,"; for (int i = 0; i < cameraPointsCount; i++) { CameraPoint point = cameraPoints[i]; s = p.StringFormat2("{0}{1},", s, p.IntToString(p.FloatToInt(point.positionGlX * 100))); s = p.StringFormat2("{0}{1},", s, p.IntToString(p.FloatToInt(point.positionGlY * 100))); s = p.StringFormat2("{0}{1},", s, p.IntToString(p.FloatToInt(point.positionGlZ * 100))); s = p.StringFormat2("{0}{1},", s, p.IntToString(p.FloatToInt(point.orientationGlX * 1000))); s = p.StringFormat2("{0}{1},", s, p.IntToString(p.FloatToInt(point.orientationGlY * 1000))); s = p.StringFormat2("{0}{1}", s, p.IntToString(p.FloatToInt(point.orientationGlZ * 1000))); if (i != cameraPointsCount - 1) { s = p.StringFormat("{0},", s); } } p.ClipboardSetText(s); m.DisplayNotification("Camera points copied to clipboard."); } if (arguments[0] == "load") { IntRef pointsLength = new IntRef(); string[] points = p.StringSplit(arguments[1], ",", pointsLength); int n = (pointsLength.value - 1) / 6; cameraPointsCount = 0; for (int i = 0; i < n; i++) { CameraPoint point = new CameraPoint(); point.positionGlX = one * p.IntParse(points[1 + i * 6 + 0]) / 100; point.positionGlY = one * p.IntParse(points[1 + i * 6 + 1]) / 100; point.positionGlZ = one * p.IntParse(points[1 + i * 6 + 2]) / 100; point.orientationGlX = one * p.IntParse(points[1 + i * 6 + 3]) / 1000; point.orientationGlY = one * p.IntParse(points[1 + i * 6 + 4]) / 1000; point.orientationGlZ = one * p.IntParse(points[1 + i * 6 + 5]) / 1000; cameraPoints[cameraPointsCount++] = point; } m.DisplayNotification(p.StringFormat("Camera points loaded: {0}", p.IntToString(n))); } return true; } return false; }
internal void ClientCommand(string s_) { if (s_ == "") { return; } IntRef ssCount = new IntRef(); string[] ss = platform.StringSplit(s_, " ", ssCount); if (StringTools.StringStartsWith(platform, s_, ".")) { string strFreemoveNotAllowed = language.FreemoveNotAllowed(); //try { string cmd = StringTools.StringSubstringToEnd(platform, ss[0], 1); string arguments; if (platform.StringIndexOf(s_, " ") == -1) { arguments = ""; } else { arguments = StringTools.StringSubstringToEnd(platform, s_, platform.StringIndexOf(s_, " ")); } arguments = platform.StringTrim(arguments); if (cmd == "pos") { ENABLE_DRAWPOSITION = BoolCommandArgument(arguments); } else if (cmd == "fog") { int foglevel; foglevel = platform.IntParse(arguments); //if (foglevel <= 16) //{ // terrain.DrawDistance = (int)Math.Pow(2, foglevel); //} //else { int foglevel2 = foglevel; if (foglevel2 > 1024) { foglevel2 = 1024; } if (foglevel2 % 2 == 0) { foglevel2--; } d_Config3d.viewdistance = foglevel2; //terrain.UpdateAllTiles(); } OnResize(); } else if (cmd == "noclip") { controls.noclip = BoolCommandArgument(arguments); } else if (cmd == "freemove") { if (this.AllowFreemove) { controls.freemove = BoolCommandArgument(arguments); } else { Log(strFreemoveNotAllowed); return; } } else if (cmd == "fov") { int arg = platform.IntParse(arguments); int minfov = 1; int maxfov = 179; if (!issingleplayer) { minfov = 60; } if (arg < minfov || arg > maxfov) { platform.ThrowException(platform.StringFormat2("Valid field of view: {0}-{1}", platform.IntToString(minfov), platform.IntToString(maxfov))); } float fov_ = (2 * Game.GetPi() * (one * arg / 360)); this.fov = fov_; OnResize(); } else if (cmd == "clients") { Log("Clients:"); for (int i = 0; i < entitiesCount; i++) { Entity entity = entities[i]; if (entity == null) { continue; } if (entity.drawName == null) { continue; } if (!entity.drawName.ClientAutoComplete) { continue; } Log(platform.StringFormat2("{0} {1}", platform.IntToString(i), entities[i].drawName.Name)); } } else if (cmd == "movespeed") { //try //{ if (this.AllowFreemove) { if (platform.FloatParse(arguments) <= 500) { movespeed = basemovespeed * platform.FloatParse(arguments); AddChatline(platform.StringFormat("Movespeed: {0}x", arguments)); } else { AddChatline("Entered movespeed to high! max. 500x"); } } else { Log(strFreemoveNotAllowed); return; } //} //catch //{ // AddChatline("Invalid value!"); // AddChatline("USE: .movespeed [movespeed]"); //} } else if (cmd == "gui") { ENABLE_DRAW2D = BoolCommandArgument(arguments); } else if (cmd == "reconnect") { Reconnect(); } else if (cmd == "m") { mouseSmoothing = !mouseSmoothing; if (mouseSmoothing) { Log("Mouse smoothing enabled."); } else { Log("Mouse smoothing disabled."); } } else if (cmd == "serverinfo") { //Fetches server info from given adress IntRef splitCount = new IntRef(); string[] split = platform.StringSplit(arguments, ":", splitCount); if (splitCount.value == 2) { QueryClient qClient = new QueryClient(); qClient.SetPlatform(platform); qClient.PerformQuery(split[0], platform.IntParse(split[1])); if (qClient.querySuccess) { //Received result QueryResult r = qClient.GetResult(); AddChatline(r.GameMode); AddChatline(platform.IntToString(r.MapSizeX)); AddChatline(platform.IntToString(r.MapSizeY)); AddChatline(platform.IntToString(r.MapSizeZ)); AddChatline(platform.IntToString(r.MaxPlayers)); AddChatline(r.MOTD); AddChatline(r.Name); AddChatline(platform.IntToString(r.PlayerCount)); AddChatline(r.PlayerList); AddChatline(platform.IntToString(r.Port)); AddChatline(r.PublicHash); AddChatline(r.ServerVersion); } AddChatline(qClient.GetServerMessage()); } } else { for (int i = 0; i < clientmodsCount; i++) { ClientCommandArgs args = new ClientCommandArgs(); args.arguments = arguments; args.command = cmd; clientmods[i].OnClientCommand(this, args); } string chatline = StringTools.StringSubstring(platform, GuiTypingBuffer, 0, MathCi.MinInt(GuiTypingBuffer.Length, 256)); SendChat(chatline); } } //catch (Exception e) { AddChatline(new StringReader(e.Message).ReadLine()); } } else { string chatline = StringTools.StringSubstring(platform, GuiTypingBuffer, 0, MathCi.MinInt(StringTools.StringLength(platform, GuiTypingBuffer), 4096)); SendChat(chatline); } }