public static Jump read(BinaryReader binaryReader) { Jump newObj = new Jump(); newObj.i_jp = JumpPack.read(binaryReader); return(newObj); }
public void HandleActionJump(JumpPack jump) { var strength = Strength.Current; var capacity = EncumbranceSystem.EncumbranceCapacity((int)strength, 0); // TODO: augs var burden = EncumbranceSystem.GetBurden(capacity, EncumbranceVal ?? 0); // calculate stamina cost for this jump var staminaCost = MovementSystem.JumpStaminaCost(jump.Extent, burden, false); //Console.WriteLine($"Strength: {strength}, Capacity: {capacity}, Encumbrance: {EncumbranceVal ?? 0}, Burden: {burden}, StaminaCost: {staminaCost}"); // TODO: ensure player has enough stamina to jump UpdateVitalDelta(Stamina, -staminaCost); //Console.WriteLine($"Jump velocity: {jump.Velocity}"); // set jump velocity PhysicsObj.set_velocity(jump.Velocity, true); // 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)); }
public static void Handle(ClientMessage message, Session session) { var jumpPack = new JumpPack(message.Payload); var objectGuid = message.Payload.ReadUInt32(); var spellId = message.Payload.ReadUInt32(); session.Player.HandleActionJump(jumpPack); }
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}"); // set jump velocity // TODO: have server verify / scale magnitude PhysicsObj.set_velocity(jump.Velocity, true); // 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)); }
public static JumpPack read(BinaryReader binaryReader) { JumpPack newObj = new JumpPack(); newObj.velocity = Vector3.read(binaryReader); newObj.instance_timestamp = binaryReader.ReadUInt16(); newObj.server_control_timestamp = binaryReader.ReadUInt16(); newObj.teleport_timestamp = binaryReader.ReadUInt16(); newObj.force_position_ts = binaryReader.ReadUInt16(); Util.readToAlign(binaryReader); return(newObj); }
public void HandleActionJump(JumpPack jump) { var strength = GetCreatureAttribute(PropertyAttribute.Strength).Current; var capacity = EncumbranceSystem.EncumbranceCapacity((int)strength, 0); // TODO: augs var burden = EncumbranceSystem.GetBurden(capacity, EncumbranceVal ?? 0); // calculate stamina cost for this jump var staminaCost = MovementSystem.JumpStaminaCost(jump.Extent, burden, false); //Console.WriteLine($"Strength: {strength}, Capacity: {capacity}, Encumbrance: {EncumbranceVal ?? 0}, Burden: {burden}, StaminaCost: {staminaCost}"); // TODO: ensure player has enough stamina to jump UpdateVitalDelta(Stamina, -staminaCost); }
public static void Handle(ClientMessage message, Session session) { var jumpPack = new JumpPack(message.Payload); var objectGuid = message.Payload.ReadUInt32(); var spellId = message.Payload.ReadUInt32(); session.Player.HandleActionJump(jumpPack); if (session.Player.IsPlayerMovingTo) { session.Player.StopExistingMoveToChains(); } }
public static JumpPack read(BinaryReader binaryReader) { JumpPack newObj = new JumpPack(); newObj.extent = binaryReader.ReadSingle(); binaryReader.ReadSingle(); binaryReader.ReadSingle(); binaryReader.ReadSingle(); newObj.position = Position.read(binaryReader); newObj.instance_timestamp = binaryReader.ReadUInt16(); newObj.server_control_timestamp = binaryReader.ReadUInt16(); newObj.teleport_timestamp = binaryReader.ReadUInt16(); newObj.force_position_ts = binaryReader.ReadUInt16(); Util.readToAlign(binaryReader); return(newObj); }
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); } }
public void OnJump(JumpPack jump) { var line = $"HandleActionJump: Velocity={jump.Velocity}, Extent={jump.Extent}"; Output(line); }
public void HandleActionJump(JumpPack jump) { //Console.WriteLine(jump); UseJumpStamina(jump); }