Example #1
0
        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);
        }
Example #2
0
        public static void WriteWeaponReferenceToPacket(MissionWeapon weapon)
        {
            GameNetworkMessage.WriteBoolToPacket(weapon.IsEmpty);
            if (weapon.IsEmpty)
            {
                return;
            }
            GameNetworkMessage.WriteObjectReferenceToPacket((MBObjectBase)weapon.Item, CompressionBasic.GUIDCompressionInfo);
            GameNetworkMessage.WriteIntToPacket((int)weapon.RawDataForNetwork, CompressionGeneric.ItemDataValueCompressionInfo);
            GameNetworkMessage.WriteIntToPacket((int)weapon.ReloadPhase, CompressionMission.WeaponReloadPhaseCompressionInfo);
            GameNetworkMessage.WriteIntToPacket(weapon.CurrentUsageIndex, CompressionMission.WeaponUsageIndexCompressionInfo);
            int num1 = weapon.Banner != null ? 1 : 0;

            GameNetworkMessage.WriteBoolToPacket(num1 != 0);
            if (num1 != 0)
            {
                GameNetworkMessage.WriteStringToPacket(weapon.Banner.Serialize());
            }
            MissionWeapon ammoWeapon = weapon.AmmoWeapon;
            int           num2       = !ammoWeapon.IsEmpty ? 1 : 0;

            GameNetworkMessage.WriteBoolToPacket(num2 != 0);
            if (num2 == 0)
            {
                return;
            }
            GameNetworkMessage.WriteObjectReferenceToPacket((MBObjectBase)ammoWeapon.Item, CompressionBasic.GUIDCompressionInfo);
            GameNetworkMessage.WriteIntToPacket((int)ammoWeapon.RawDataForNetwork, CompressionGeneric.ItemDataValueCompressionInfo);
        }
        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);
        }
Example #4
0
 public static void WriteItemReferenceToPacket(EquipmentElement equipElement) => GameNetworkMessage.WriteObjectReferenceToPacket((MBObjectBase)equipElement.Item, CompressionBasic.GUIDCompressionInfo);
Example #5
0
 public static void WriteMissileWeaponReferenceToPacket(MissionWeapon weapon)
 {
     GameNetworkMessage.WriteObjectReferenceToPacket((MBObjectBase)weapon.Item, CompressionBasic.GUIDCompressionInfo);
     GameNetworkMessage.WriteIntToPacket(weapon.CurrentUsageIndex, CompressionMission.WeaponUsageIndexCompressionInfo);
 }