public void HandleActionJump(JumpPack jump) { StartJump = new ACE.Entity.Position(Location); //Console.WriteLine($"JumpPack: Velocity: {jump.Velocity}, Extent: {jump.Extent}"); var strength = Strength.Current; var capacity = EncumbranceSystem.EncumbranceCapacity((int)strength, AugmentationIncreasedCarryingCapacity); var burden = EncumbranceSystem.GetBurden(capacity, EncumbranceVal ?? 0); // calculate stamina cost for this jump var extent = Math.Clamp(jump.Extent, 0.0f, 1.0f); var staminaCost = MovementSystem.JumpStaminaCost(extent, burden, PKTimerActive); //Console.WriteLine($"Strength: {strength}, Capacity: {capacity}, Encumbrance: {EncumbranceVal ?? 0}, Burden: {burden}, StaminaCost: {staminaCost}"); // ensure player has enough stamina to jump /*if (staminaCost > Stamina.Current) * { * // get adjusted power * extent = MovementSystem.GetJumpPower(Stamina.Current, burden, false); * * staminaCost = (int)Stamina.Current; * * // adjust jump velocity * var velocityZ = MovementSystem.GetJumpHeight(burden, GetCreatureSkill(Skill.Jump).Current, extent, 1.0f); * * jump.Velocity.Z = velocityZ; * }*/ IsJumping = true; LastJumpTime = DateTime.UtcNow; UpdateVitalDelta(Stamina, -staminaCost); IsJumping = false; //Console.WriteLine($"Jump velocity: {jump.Velocity}"); // TODO: have server verify / scale magnitude if (FastTick) { if (!PhysicsObj.IsMovingOrAnimating) { //PhysicsObj.UpdateTime = PhysicsTimer.CurrentTime - Physics.PhysicsGlobals.MinQuantum; PhysicsObj.UpdateTime = PhysicsTimer.CurrentTime; } // perform jump in physics engine PhysicsObj.TransientState &= ~(Physics.TransientStateFlags.Contact | Physics.TransientStateFlags.WaterContact); PhysicsObj.calc_acceleration(); PhysicsObj.set_on_walkable(false); PhysicsObj.set_local_velocity(jump.Velocity, false); if (CombatMode == CombatMode.Magic && MagicState.IsCasting) { FailCast(); } } else { PhysicsObj.UpdateTime = PhysicsTimer.CurrentTime; // set jump velocity //var glob_velocity = Vector3.Transform(jump.Velocity, Location.Rotation); //PhysicsObj.set_velocity(glob_velocity, true); // perform jump in physics engine PhysicsObj.TransientState &= ~(Physics.TransientStateFlags.Contact | Physics.TransientStateFlags.WaterContact); PhysicsObj.calc_acceleration(); PhysicsObj.set_on_walkable(false); PhysicsObj.set_local_velocity(jump.Velocity, false); } // this shouldn't be needed, but without sending this update motion / simulated movement event beforehand, // running forward and then performing a charged jump does an uncharged shallow arc jump instead // this hack fixes that... var movementData = new MovementData(this); movementData.IsAutonomous = true; movementData.MovementType = MovementType.Invalid; movementData.Invalid = new MovementInvalid(movementData); EnqueueBroadcast(new GameMessageUpdateMotion(this, movementData)); // broadcast jump EnqueueBroadcast(new GameMessageVectorUpdate(this)); if (MagicState.IsCasting && RecordCast.Enabled) { RecordCast.OnJump(jump); } }