public override void Apply() { if (IsChunkConnection) { ClientNetworkBase.SendPacketToSecondary(new PingPacketOut(marker)); } else { ClientNetworkBase.SendPacket(new PingPacketOut(marker)); //SysConsole.Output(OutputType.INFO, (ClientMain.GlobalTickTime - Time).ToString()); if (Math.Abs(ClientMain.GlobalTickTime - Time) > 1) { ClientMain.GlobalTickTime = Time; } else if (ClientMain.GlobalTickTime - Time > 0.1) { ClientMain.GlobalTickTime -= 0.05; } else if (ClientMain.GlobalTickTime - Time < -0.1) { ClientMain.GlobalTickTime += 0.05; } else if (ClientMain.GlobalTickTime - Time > 0.01) { ClientMain.GlobalTickTime -= 0.005; } else if (ClientMain.GlobalTickTime - Time < -0.01) { ClientMain.GlobalTickTime += 0.005; } } }
public override void Execute(CommandEntry entry) { ClientMain.QuickBarPos--; if (ClientMain.QuickBarPos < 0) { ClientMain.QuickBarPos += ClientMain.QuickBar.Count + 1; } if (ClientNetworkBase.Connected) { ClientNetworkBase.SendPacket(new SelectionPacketOut(ClientMain.QuickBarPos)); } }
public override void Tick() { Direction.X += MouseHandler.MouseDelta.X; Direction.Y += MouseHandler.MouseDelta.Y; TickMovement(ClientMain.Delta); ClientMain.CameraEye = Position + new Location(0, 0, Maxes.Z); Location forward = Utilities.ForwardVector_Deg(Direction.X, Direction.Y); ClientMain.CameraTarget = ClientMain.CameraEye + forward; ltime += ClientMain.Delta; Location seltarg = ClientMain.CameraEye + forward * 10; SelectedBlock = Collision.BoxRayTrace(new Location(-0.001), new Location(0.001), ClientMain.CameraEye, seltarg, -1); if (SelectedBlock == seltarg) { SelectedBlock = Location.NaN; } if ((Forward != pForward || Backward != pBackward || Leftward != pLeftward || Rightward != pRightward || Upward != pUpward || Downward != pDownward || Slow != pSlow || Use != pUse || Attack != pAttack || Secondary != pSecondary || Direction.X != pDirection.X || Direction.Y != pDirection.Y) || ltime >= 0.1) { pForward = Forward; pBackward = Backward; pLeftward = Leftward; pRightward = Rightward; pUpward = Upward; pDownward = Downward; pDirection = Direction; pSlow = Slow; pUse = Use; pAttack = Attack; pSecondary = Secondary; ltime = 0; AddMS(); if (ClientNetworkBase.Connected) { ClientNetworkBase.SendPacket(new MoveKeysPacketOut(MoveStates[MoveStates.Count - 1])); } if (MoveStates.Count > 250) { MoveStates.RemoveRange(0, 50); } } }
public override void Execute(CommandEntry entry) { if (entry.Arguments.Count < 1) { ShowUsage(entry); return; } string host = entry.GetArgument(0); string port = "28010"; if (entry.Arguments.Count >= 2) { port = entry.GetArgument(1); } ClientNetworkBase.Connect(host, port); }
public override void UnknownCommand(string basecommand, string[] arguments) // TODO: Base DebugMode? { if (ClientNetworkBase.Connected) { StringBuilder sb = new StringBuilder(); sb.Append(basecommand); for (int i = 0; i < arguments.Length; i++) { sb.Append("\n").Append(ClientCommands.CommandSystem.TagSystem.ParseTags(arguments[i], TextStyle.Color_Simple, null, DebugMode.MINIMAL)); } CommandPacketOut packet = new CommandPacketOut(sb.ToString()); ClientNetworkBase.SendPacket(packet); } else { WriteLine(TextStyle.Color_Error + "Unknown command '" + TextStyle.Color_Standout + basecommand + TextStyle.Color_Error + "'."); } }
/// <summary> /// The primary tick entry point from the OpenGL window. /// </summary> /// <param name="sender">The sending object</param> /// <param name="e">The frame event details, including delta timing</param> static void Window_UpdateFrame(object sender, FrameEventArgs e) { Delta = ((double)Ticker.ElapsedTicks) / ((double)Stopwatch.Frequency); Ticker.Reset(); Ticker.Start(); try { GlobalTickTime += Delta; MouseHandler.Tick(); KeyHandler.Tick(); UIConsole.Tick(); ClientCommands.Tick(); ClientNetworkBase.Tick(); TickWorld(); } catch (Exception ex) { SysConsole.Output(OutputType.ERROR, "Error / updateframe: " + ex.ToString()); } }
public override void Apply() { UIConsole.WriteLine("Disconnected from server: " + message); ClientNetworkBase.Disconnect(); }