protected override bool OnRead() { bool bufferReadValid = true; this.Character = (BasicCharacterObject)GameNetworkMessage.ReadObjectReferenceFromPacket(MBObjectManager.Instance, CompressionBasic.GUIDCompressionInfo, ref bufferReadValid); this.Monster = (Monster)GameNetworkMessage.ReadObjectReferenceFromPacket(MBObjectManager.Instance, CompressionBasic.GUIDCompressionInfo, ref bufferReadValid); this.AgentIndex = GameNetworkMessage.ReadAgentIndexFromPacket(CompressionMission.AgentCompressionInfo, ref bufferReadValid); this.MountAgentIndex = GameNetworkMessage.ReadAgentIndexFromPacket(CompressionMission.AgentCompressionInfo, ref bufferReadValid); this.Peer = GameNetworkMessage.ReadNetworkPeerReferenceFromPacket(ref bufferReadValid); this.SpawnEquipment = new Equipment(); this.SpawnMissionEquipment = new MissionEquipment(); for (EquipmentIndex index = EquipmentIndex.WeaponItemBeginSlot; index < EquipmentIndex.NumAllWeaponSlots; ++index) { this.SpawnMissionEquipment[index] = ModuleNetworkData.ReadWeaponReferenceFromPacket(MBObjectManager.Instance, ref bufferReadValid); } for (EquipmentIndex equipmentIndex = EquipmentIndex.NumAllWeaponSlots; equipmentIndex < EquipmentIndex.NumEquipmentSetSlots; ++equipmentIndex) { this.SpawnEquipment.AddEquipmentToSlotWithoutAgent(equipmentIndex, ModuleNetworkData.ReadItemReferenceFromPacket(MBObjectManager.Instance, ref bufferReadValid)); } this.IsPlayerAgent = GameNetworkMessage.ReadBoolFromPacket(ref bufferReadValid); this.BodyPropertiesSeed = !this.IsPlayerAgent ? GameNetworkMessage.ReadIntFromPacket(CompressionGeneric.RandomSeedCompressionInfo, ref bufferReadValid) : 0; this.BodyPropertiesValue = GameNetworkMessage.ReadBodyPropertiesFromPacket(ref bufferReadValid); this.IsFemale = GameNetworkMessage.ReadBoolFromPacket(ref bufferReadValid); this.Team = GameNetworkMessage.ReadTeamReferenceFromPacket(ref bufferReadValid); this.Position = GameNetworkMessage.ReadVec3FromPacket(CompressionBasic.PositionCompressionInfo, ref bufferReadValid); this.Direction = GameNetworkMessage.ReadVec2FromPacket(CompressionBasic.UnitVectorCompressionInfo, ref bufferReadValid).Normalized(); this.FormationIndex = GameNetworkMessage.ReadIntFromPacket(CompressionOrder.FormationClassCompressionInfo, ref bufferReadValid); this.ClothingColor1 = GameNetworkMessage.ReadUintFromPacket(CompressionGeneric.ColorCompressionInfo, ref bufferReadValid); this.ClothingColor2 = GameNetworkMessage.ReadUintFromPacket(CompressionGeneric.ColorCompressionInfo, ref bufferReadValid); return(bufferReadValid); }
protected override void OnWrite() { ModuleNetworkData.WriteWeaponReferenceToPacket(this.Weapon); GameNetworkMessage.WriteMissionObjectReferenceToPacket(this.MissionObject); GameNetworkMessage.WriteVec3ToPacket(this.AttachLocalFrame.origin, CompressionBasic.LocalPositionCompressionInfo); GameNetworkMessage.WriteRotationMatrixToPacket(this.AttachLocalFrame.rotation); }
protected override bool OnRead() { bool bufferReadValid = true; this.Peer = GameNetworkMessage.ReadNetworkPeerReferenceFromPacket(ref bufferReadValid); this.VisualsIndex = GameNetworkMessage.ReadIntFromPacket(CompressionMission.AgentOffsetCompressionInfo, ref bufferReadValid); this.Character = (BasicCharacterObject)GameNetworkMessage.ReadObjectReferenceFromPacket(MBObjectManager.Instance, CompressionBasic.GUIDCompressionInfo, ref bufferReadValid); this.Equipment = new Equipment(); bool flag = GameNetworkMessage.ReadBoolFromPacket(ref bufferReadValid); for (EquipmentIndex equipmentIndex = EquipmentIndex.WeaponItemBeginSlot; equipmentIndex < (flag ? EquipmentIndex.NumEquipmentSetSlots : EquipmentIndex.ArmorItemEndSlot); ++equipmentIndex) { EquipmentElement itemRosterElement = ModuleNetworkData.ReadItemReferenceFromPacket(MBObjectManager.Instance, ref bufferReadValid); if (bufferReadValid) { this.Equipment.AddEquipmentToSlotWithoutAgent(equipmentIndex, itemRosterElement); } else { break; } } this.BodyPropertiesSeed = GameNetworkMessage.ReadIntFromPacket(CompressionGeneric.RandomSeedCompressionInfo, ref bufferReadValid); this.IsFemale = GameNetworkMessage.ReadBoolFromPacket(ref bufferReadValid); this.SelectedEquipmentSetIndex = GameNetworkMessage.ReadIntFromPacket(CompressionBasic.MissionObjectIDCompressionInfo, ref bufferReadValid); this.TroopCountInFormation = GameNetworkMessage.ReadIntFromPacket(CompressionBasic.PlayerCompressionInfo, ref bufferReadValid); return(bufferReadValid); }
protected override bool OnRead() { bool bufferReadValid = true; this.MissileIndex = GameNetworkMessage.ReadIntFromPacket(CompressionMission.MissileCompressionInfo, ref bufferReadValid); this.Agent = GameNetworkMessage.ReadAgentReferenceFromPacket(ref bufferReadValid); this.WeaponIndex = (EquipmentIndex)GameNetworkMessage.ReadIntFromPacket(CompressionMission.WieldSlotCompressionInfo, ref bufferReadValid); if (this.WeaponIndex == EquipmentIndex.None) { this.Weapon = ModuleNetworkData.ReadMissileWeaponReferenceFromPacket(Game.Current.ObjectManager, ref bufferReadValid); } this.Position = GameNetworkMessage.ReadVec3FromPacket(CompressionBasic.PositionCompressionInfo, ref bufferReadValid); this.Direction = GameNetworkMessage.ReadVec3FromPacket(CompressionBasic.UnitVectorCompressionInfo, ref bufferReadValid); this.Speed = GameNetworkMessage.ReadFloatFromPacket(CompressionMission.MissileSpeedCompressionInfo, ref bufferReadValid); this.HasRigidBody = GameNetworkMessage.ReadBoolFromPacket(ref bufferReadValid); if (this.HasRigidBody) { this.Orientation = GameNetworkMessage.ReadRotationMatrixFromPacket(ref bufferReadValid); this.MissionObjectToIgnore = GameNetworkMessage.ReadMissionObjectReferenceFromPacket(ref bufferReadValid); } else { Vec3 f = GameNetworkMessage.ReadVec3FromPacket(CompressionBasic.UnitVectorCompressionInfo, ref bufferReadValid); this.Orientation = new Mat3(Vec3.Side, f, Vec3.Up); this.Orientation.Orthonormalize(); } this.IsPrimaryWeaponShot = GameNetworkMessage.ReadBoolFromPacket(ref bufferReadValid); return(bufferReadValid); }
protected override void OnWrite() { GameNetworkMessage.WriteObjectReferenceToPacket((MBObjectBase)this.Character, CompressionBasic.GUIDCompressionInfo); GameNetworkMessage.WriteObjectReferenceToPacket((MBObjectBase)this.Monster, CompressionBasic.GUIDCompressionInfo); GameNetworkMessage.WriteIntToPacket(this.AgentIndex, CompressionMission.AgentCompressionInfo); GameNetworkMessage.WriteIntToPacket(this.MountAgentIndex, CompressionMission.AgentCompressionInfo); GameNetworkMessage.WriteNetworkPeerReferenceToPacket(this.Peer); for (EquipmentIndex index = EquipmentIndex.WeaponItemBeginSlot; index < EquipmentIndex.NumAllWeaponSlots; ++index) { ModuleNetworkData.WriteWeaponReferenceToPacket(this.SpawnMissionEquipment[index]); } for (EquipmentIndex equipmentIndex = EquipmentIndex.NumAllWeaponSlots; equipmentIndex < EquipmentIndex.NumEquipmentSetSlots; ++equipmentIndex) { ModuleNetworkData.WriteItemReferenceToPacket(this.SpawnEquipment.GetEquipmentFromSlot(equipmentIndex)); } GameNetworkMessage.WriteBoolToPacket(this.IsPlayerAgent); if (!this.IsPlayerAgent) { GameNetworkMessage.WriteIntToPacket(this.BodyPropertiesSeed, CompressionGeneric.RandomSeedCompressionInfo); } BodyProperties bodyProperties = this.BodyPropertiesValue; GameNetworkMessage.WriteBodyPropertiesToPacket(in bodyProperties); GameNetworkMessage.WriteBoolToPacket(this.IsFemale); GameNetworkMessage.WriteTeamReferenceToPacket(this.Team); GameNetworkMessage.WriteVec3ToPacket(this.Position, CompressionBasic.PositionCompressionInfo); GameNetworkMessage.WriteVec2ToPacket(this.Direction, CompressionBasic.UnitVectorCompressionInfo); GameNetworkMessage.WriteIntToPacket(this.FormationIndex, CompressionOrder.FormationClassCompressionInfo); GameNetworkMessage.WriteUintToPacket(this.ClothingColor1, CompressionGeneric.ColorCompressionInfo); GameNetworkMessage.WriteUintToPacket(this.ClothingColor2, CompressionGeneric.ColorCompressionInfo); }
protected override void OnWrite() { GameNetworkMessage.WriteIntToPacket(this.AgentIndex, CompressionMission.AgentCompressionInfo); ModuleNetworkData.WriteItemReferenceToPacket(this.HorseItem); ModuleNetworkData.WriteItemReferenceToPacket(this.HorseHarnessItem); GameNetworkMessage.WriteVec3ToPacket(this.Position, CompressionBasic.PositionCompressionInfo); GameNetworkMessage.WriteVec2ToPacket(this.Direction, CompressionBasic.UnitVectorCompressionInfo); }
protected override void OnWrite() { ModuleNetworkData.WriteWeaponReferenceToPacket(this.Weapon); GameNetworkMessage.WriteAgentReferenceToPacket(this.Agent); GameNetworkMessage.WriteIntToPacket((int)this.SlotIndex, CompressionMission.ItemSlotCompressionInfo); GameNetworkMessage.WriteVec3ToPacket(this.AttachLocalFrame.origin, CompressionBasic.LocalPositionCompressionInfo); GameNetworkMessage.WriteRotationMatrixToPacket(this.AttachLocalFrame.rotation); }
protected override void OnWrite() { GameNetworkMessage.WriteNetworkPeerReferenceToPacket(this.Peer); for (EquipmentIndex equipmentIndex = EquipmentIndex.WeaponItemBeginSlot; equipmentIndex < EquipmentIndex.NumEquipmentSetSlots; ++equipmentIndex) { ModuleNetworkData.WriteItemReferenceToPacket(this.Equipment.GetEquipmentFromSlot(equipmentIndex)); } }
protected override bool OnRead() { bool bufferReadValid = true; this.Agent = GameNetworkMessage.ReadAgentReferenceFromPacket(ref bufferReadValid, true); this.Weapon = ModuleNetworkData.ReadWeaponReferenceFromPacket(MBObjectManager.Instance, ref bufferReadValid); this.SlotIndex = (EquipmentIndex)GameNetworkMessage.ReadIntFromPacket(CompressionMission.ItemSlotCompressionInfo, ref bufferReadValid); return(bufferReadValid); }
protected override void OnWrite() { ModuleNetworkData.WriteWeaponReferenceToPacket(this.Weapon); GameNetworkMessage.WriteMatrixFrameToPacket(this.Frame); GameNetworkMessage.WriteIntToPacket((int)this.WeaponSpawnFlags, CompressionMission.SpawnedItemWeaponSpawnFlagCompressionInfo); GameNetworkMessage.WriteIntToPacket(this.ForcedIndex, CompressionBasic.MissionObjectIDCompressionInfo); GameNetworkMessage.WriteMissionObjectReferenceToPacket(this.ParentMissionObject); GameNetworkMessage.WriteBoolToPacket(this.IsVisible); GameNetworkMessage.WriteBoolToPacket(this.HasLifeTime); }
protected override bool OnRead() { bool bufferReadValid = true; this.AgentIndex = GameNetworkMessage.ReadAgentIndexFromPacket(CompressionMission.AgentCompressionInfo, ref bufferReadValid); this.HorseItem = ModuleNetworkData.ReadItemReferenceFromPacket(Game.Current.ObjectManager, ref bufferReadValid); this.HorseHarnessItem = ModuleNetworkData.ReadItemReferenceFromPacket(Game.Current.ObjectManager, ref bufferReadValid); this.Position = GameNetworkMessage.ReadVec3FromPacket(CompressionBasic.PositionCompressionInfo, ref bufferReadValid); this.Direction = GameNetworkMessage.ReadVec2FromPacket(CompressionBasic.UnitVectorCompressionInfo, ref bufferReadValid); return(bufferReadValid); }
protected override bool OnRead() { bool bufferReadValid = true; this.Weapon = ModuleNetworkData.ReadWeaponReferenceFromPacket(MBObjectManager.Instance, ref bufferReadValid); this.Frame = GameNetworkMessage.ReadMatrixFrameFromPacket(ref bufferReadValid); this.WeaponSpawnFlags = (Mission.WeaponSpawnFlags)GameNetworkMessage.ReadIntFromPacket(CompressionMission.SpawnedItemWeaponSpawnFlagCompressionInfo, ref bufferReadValid); this.ForcedIndex = GameNetworkMessage.ReadIntFromPacket(CompressionBasic.MissionObjectIDCompressionInfo, ref bufferReadValid); this.ParentMissionObject = GameNetworkMessage.ReadMissionObjectReferenceFromPacket(ref bufferReadValid); this.IsVisible = GameNetworkMessage.ReadBoolFromPacket(ref bufferReadValid); this.HasLifeTime = GameNetworkMessage.ReadBoolFromPacket(ref bufferReadValid); return(bufferReadValid); }
protected override bool OnRead() { bool bufferReadValid = true; this.Weapon = ModuleNetworkData.ReadWeaponReferenceFromPacket(MBObjectManager.Instance, ref bufferReadValid); this.MissionObject = GameNetworkMessage.ReadMissionObjectReferenceFromPacket(ref bufferReadValid); Vec3 o = GameNetworkMessage.ReadVec3FromPacket(CompressionBasic.LocalPositionCompressionInfo, ref bufferReadValid); Mat3 rot = GameNetworkMessage.ReadRotationMatrixFromPacket(ref bufferReadValid); if (bufferReadValid) { this.AttachLocalFrame = new MatrixFrame(rot, o); } return(bufferReadValid); }
protected override void OnWrite() { GameNetworkMessage.WriteNetworkPeerReferenceToPacket(this.Peer); GameNetworkMessage.WriteIntToPacket(this.VisualsIndex, CompressionMission.AgentOffsetCompressionInfo); GameNetworkMessage.WriteObjectReferenceToPacket((MBObjectBase)this.Character, CompressionBasic.GUIDCompressionInfo); bool flag = this.Equipment[EquipmentIndex.ArmorItemEndSlot].Item != null; GameNetworkMessage.WriteBoolToPacket(flag); for (EquipmentIndex equipmentIndex = EquipmentIndex.WeaponItemBeginSlot; equipmentIndex < (flag ? EquipmentIndex.NumEquipmentSetSlots : EquipmentIndex.ArmorItemEndSlot); ++equipmentIndex) { ModuleNetworkData.WriteItemReferenceToPacket(this.Equipment.GetEquipmentFromSlot(equipmentIndex)); } GameNetworkMessage.WriteIntToPacket(this.BodyPropertiesSeed, CompressionGeneric.RandomSeedCompressionInfo); GameNetworkMessage.WriteBoolToPacket(this.IsFemale); GameNetworkMessage.WriteIntToPacket(this.SelectedEquipmentSetIndex, CompressionBasic.MissionObjectIDCompressionInfo); GameNetworkMessage.WriteIntToPacket(this.TroopCountInFormation, CompressionBasic.PlayerCompressionInfo); }
protected override void OnWrite() { GameNetworkMessage.WriteIntToPacket(this.MissileIndex, CompressionMission.MissileCompressionInfo); GameNetworkMessage.WriteAgentReferenceToPacket(this.Agent); GameNetworkMessage.WriteIntToPacket((int)this.WeaponIndex, CompressionMission.WieldSlotCompressionInfo); if (this.WeaponIndex == EquipmentIndex.None) { ModuleNetworkData.WriteMissileWeaponReferenceToPacket(this.Weapon); } GameNetworkMessage.WriteVec3ToPacket(this.Position, CompressionBasic.PositionCompressionInfo); GameNetworkMessage.WriteVec3ToPacket(this.Direction, CompressionBasic.UnitVectorCompressionInfo); GameNetworkMessage.WriteFloatToPacket(this.Speed, CompressionMission.MissileSpeedCompressionInfo); GameNetworkMessage.WriteBoolToPacket(this.HasRigidBody); if (this.HasRigidBody) { GameNetworkMessage.WriteRotationMatrixToPacket(this.Orientation); GameNetworkMessage.WriteMissionObjectReferenceToPacket(this.MissionObjectToIgnore); } else { GameNetworkMessage.WriteVec3ToPacket(this.Orientation.f, CompressionBasic.UnitVectorCompressionInfo); } GameNetworkMessage.WriteBoolToPacket(this.IsPrimaryWeaponShot); }
protected override bool OnRead() { bool bufferReadValid = true; this.Peer = GameNetworkMessage.ReadNetworkPeerReferenceFromPacket(ref bufferReadValid); if (bufferReadValid) { this.Equipment = new Equipment(); for (EquipmentIndex equipmentIndex = EquipmentIndex.WeaponItemBeginSlot; equipmentIndex < EquipmentIndex.NumEquipmentSetSlots; ++equipmentIndex) { if (bufferReadValid) { this.Equipment.AddEquipmentToSlotWithoutAgent(equipmentIndex, ModuleNetworkData.ReadItemReferenceFromPacket(MBObjectManager.Instance, ref bufferReadValid)); } } } return(bufferReadValid); }
protected override void OnWrite() { GameNetworkMessage.WriteAgentReferenceToPacket(this.Agent); ModuleNetworkData.WriteWeaponReferenceToPacket(this.Weapon); GameNetworkMessage.WriteIntToPacket((int)this.SlotIndex, CompressionMission.ItemSlotCompressionInfo); }