コード例 #1
0
        public void Write(WorldPacket data)
        {
            data.WritePackedGuid(Guid);
            data.WriteUInt32(Species);
            data.WriteUInt32(CreatureID);
            data.WriteUInt32(CollarID);
            data.WriteUInt16(Breed);
            data.WriteUInt16(Level);
            data.WriteUInt16(Exp);
            data.WriteUInt16(Flags);
            data.WriteUInt32(Power);
            data.WriteUInt32(Health);
            data.WriteUInt32(MaxHealth);
            data.WriteUInt32(Speed);
            data.WriteUInt8(Quality);
            data.WriteBits(Name.GetByteCount(), 7);
            data.WriteBit(OwnerInfo.HasValue); // HasOwnerInfo
            data.WriteBit(Name.IsEmpty());     // NoRename
            data.FlushBits();

            data.WriteString(Name);

            if (OwnerInfo.HasValue)
            {
                data.WritePackedGuid(OwnerInfo.Value.Guid);
                data.WriteUInt32(OwnerInfo.Value.PlayerVirtualRealm); // Virtual
                data.WriteUInt32(OwnerInfo.Value.PlayerNativeRealm);  // Native
            }
        }
コード例 #2
0
        public bool BuildPacket(out UpdateObject packet)
        {
            packet = new UpdateObject();

            packet.NumObjUpdates = BlockCount;
            packet.MapID         = (ushort)MapId;

            WorldPacket buffer = new WorldPacket();

            if (buffer.WriteBit(!outOfRangeGUIDs.Empty()))
            {
                buffer.WriteUInt16(0); // object limit to instantly destroy - objects before this index on m_outOfRangeGUIDs list get "smoothly phased out"
                buffer.WriteUInt32(outOfRangeGUIDs.Count);

                foreach (var guid in outOfRangeGUIDs)
                {
                    buffer.WritePackedGuid(guid);
                }
            }
            var bytes = data.GetData();

            buffer.WriteUInt32(bytes.Length);
            buffer.WriteBytes(bytes);

            packet.Data = buffer.GetData();
            return(true);
        }
コード例 #3
0
ファイル: UpdateData.cs プロジェクト: zgbjmy2009/CypherCore
        public bool BuildPacket(out UpdateObject packet)
        {
            packet = new UpdateObject();

            packet.NumObjUpdates = BlockCount;
            packet.MapID         = (ushort)MapId;

            WorldPacket buffer = new WorldPacket();

            if (buffer.WriteBit(!outOfRangeGUIDs.Empty() || !destroyGUIDs.Empty()))
            {
                buffer.WriteUInt16((ushort)destroyGUIDs.Count);
                buffer.WriteInt32(destroyGUIDs.Count + outOfRangeGUIDs.Count);

                foreach (var destroyGuid in destroyGUIDs)
                {
                    buffer.WritePackedGuid(destroyGuid);
                }

                foreach (var outOfRangeGuid in outOfRangeGUIDs)
                {
                    buffer.WritePackedGuid(outOfRangeGuid);
                }
            }

            var bytes = data.GetData();

            buffer.WriteInt32(bytes.Length);
            buffer.WriteBytes(bytes);

            packet.Data = buffer.GetData();
            return(true);
        }
コード例 #4
0
        public void Write(WorldPacket data)
        {
            data.WriteBits(ItemID, 20);
            data.WriteBit(BattlePetSpeciesID.HasValue);
            data.WriteBits(ItemLevel, 11);
            data.WriteBit(SuffixItemNameDescriptionID.HasValue);
            data.FlushBits();

            if (BattlePetSpeciesID.HasValue)
            {
                data.WriteUInt16(BattlePetSpeciesID.Value);
            }

            if (SuffixItemNameDescriptionID.HasValue)
            {
                data.WriteUInt16(SuffixItemNameDescriptionID.Value);
            }
        }
コード例 #5
0
 public void Write(WorldPacket data)
 {
     data.WriteInt32(SpellID);
     data.WriteUInt16(Flags);
     data.WriteUInt32(ActiveFlags);
     data.WriteInt32(Points.Count);
     foreach (float points in Points)
     {
         data.WriteFloat(points);
     }
 }
コード例 #6
0
            public void Write(WorldPacket data)
            {
                data.WritePackedGuid(Guid);
                data.WriteUInt64(GuildClubMemberID);
                data.WriteUInt8(ListPosition);
                data.WriteUInt8(RaceId);
                data.WriteUInt8((byte)ClassId);
                data.WriteUInt8(SexId);
                data.WriteUInt8(SkinId);
                data.WriteUInt8(FaceId);
                data.WriteUInt8(HairStyle);
                data.WriteUInt8(HairColor);
                data.WriteUInt8(FacialHair);

                foreach (var display in CustomDisplay)
                {
                    data.WriteUInt8(display);
                }

                data.WriteUInt8(ExperienceLevel);
                data.WriteUInt32(ZoneId);
                data.WriteUInt32(MapId);
                data.WriteVector3(PreloadPos);
                data.WritePackedGuid(GuildGuid);
                data.WriteUInt32((uint)Flags);
                data.WriteUInt32((uint)Flags2);
                data.WriteUInt32(Flags3);
                data.WriteUInt32(PetCreatureDisplayId);
                data.WriteUInt32(PetExperienceLevel);
                data.WriteUInt32(PetCreatureFamilyId);

                data.WriteUInt32(ProfessionIds[0]);
                data.WriteUInt32(ProfessionIds[1]);

                foreach (var visualItem in VisualItems)
                {
                    visualItem.Write(data);
                }

                data.WriteUInt32(LastPlayedTime);
                data.WriteUInt16(SpecID);
                data.WriteUInt32(Unknown703);
                data.WriteUInt32(LastLoginVersion);
                data.WriteUInt32(Flags4);
                data.WriteBits(Name.GetByteCount(), 6);
                data.WriteBit(FirstLogin);
                data.WriteBit(BoostInProgress);
                data.WriteBits(unkWod61x, 5);
                data.FlushBits();

                data.WriteString(Name);
            }
コード例 #7
0
            public void Write(WorldPacket data)
            {
                data.WriteUInt16((ushort)MessageID);
                data.WriteUInt32(SequenceIndex);
                data.WriteBit(Speed.HasValue);
                data.WriteBit(KnockBack.HasValue);
                data.WriteBit(VehicleRecID.HasValue);
                data.WriteBit(CollisionHeight.HasValue);
                data.WriteBit(MovementForce_.HasValue);
                data.WriteBit(MovementForceGUID.HasValue);
                data.FlushBits();

                if (CollisionHeight.HasValue)
                {
                    data.WriteFloat(CollisionHeight.Value.Height);
                    data.WriteFloat(CollisionHeight.Value.Scale);
                    data.WriteBits(CollisionHeight.Value.Reason, 2);
                    data.FlushBits();
                }

                if (Speed.HasValue)
                {
                    data.WriteFloat(Speed.Value);
                }

                if (KnockBack.HasValue)
                {
                    data.WriteFloat(KnockBack.Value.HorzSpeed);
                    data.WriteVector2(KnockBack.Value.Direction);
                    data.WriteFloat(KnockBack.Value.InitVertSpeed);
                }

                if (VehicleRecID.HasValue)
                {
                    data.WriteInt32(VehicleRecID.Value);
                }

                if (MovementForceGUID.HasValue)
                {
                    data.WritePackedGuid(MovementForceGUID.Value);
                }

                if (MovementForce_.HasValue)
                {
                    MovementForce_.Value.Write(data);
                }
            }
コード例 #8
0
        public void Write(WorldPacket data)
        {
            data.WriteInt32(ResponseID);
            data.WriteUInt16(ResponseIdentifier);
            data.WriteInt32(ChoiceArtFileID);
            data.WriteInt32(Flags);
            data.WriteUInt32(WidgetSetID);
            data.WriteUInt32(UiTextureAtlasElementID);
            data.WriteUInt32(SoundKitID);
            data.WriteUInt8(GroupID);
            data.WriteInt32(UiTextureKitID);

            data.WriteBits(Answer.GetByteCount(), 9);
            data.WriteBits(Header.GetByteCount(), 9);
            data.WriteBits(SubHeader.GetByteCount(), 7);
            data.WriteBits(ButtonTooltip.GetByteCount(), 9);
            data.WriteBits(Description.GetByteCount(), 11);
            data.WriteBits(Confirmation.GetByteCount(), 7);

            data.WriteBit(RewardQuestID.HasValue);
            data.WriteBit(Reward.HasValue);
            data.WriteBit(MawPower.HasValue);
            data.FlushBits();

            if (Reward.HasValue)
            {
                Reward.Value.Write(data);
            }

            data.WriteString(Answer);
            data.WriteString(Header);
            data.WriteString(SubHeader);
            data.WriteString(ButtonTooltip);
            data.WriteString(Description);
            data.WriteString(Confirmation);

            if (RewardQuestID.HasValue)
            {
                data.WriteUInt32(RewardQuestID.Value);
            }

            if (MawPower.HasValue)
            {
                MawPower.Value.Write(data);
            }
        }
コード例 #9
0
ファイル: PartyPackets.cs プロジェクト: aufbau1/CypherCore
        public void Write(WorldPacket data)
        {
            for (byte i = 0; i < 2; i++)
            {
                data.WriteInt8(PartyType[i]);
            }

            data.WriteInt16((short)Status);
            data.WriteUInt8(PowerType);
            data.WriteInt16((short)PowerDisplayID);
            data.WriteInt32(CurrentHealth);
            data.WriteInt32(MaxHealth);
            data.WriteUInt16(CurrentPower);
            data.WriteUInt16(MaxPower);
            data.WriteUInt16(Level);
            data.WriteUInt16(SpecID);
            data.WriteUInt16(ZoneID);
            data.WriteUInt16(WmoGroupID);
            data.WriteUInt32(WmoDoodadPlacementID);
            data.WriteInt16(PositionX);
            data.WriteInt16(PositionY);
            data.WriteInt16(PositionZ);
            data.WriteInt32(VehicleSeat);
            data.WriteInt32(Auras.Count);

            Phases.Write(data);
            ChromieTime.Write(data);

            foreach (PartyMemberAuraStates aura in Auras)
            {
                aura.Write(data);
            }

            data.WriteBit(PetStats.HasValue);
            data.FlushBits();

            DungeonScore.Write(data);

            if (PetStats.HasValue)
            {
                PetStats.Value.Write(data);
            }
        }
コード例 #10
0
        public override void Write()
        {
            WorldPacket attackRoundInfo = new WorldPacket();

            attackRoundInfo.WriteUInt32((uint)hitInfo);
            attackRoundInfo.WritePackedGuid(AttackerGUID);
            attackRoundInfo.WritePackedGuid(VictimGUID);
            attackRoundInfo.WriteInt32(Damage);
            attackRoundInfo.WriteInt32(OriginalDamage);
            attackRoundInfo.WriteInt32(OverDamage);
            attackRoundInfo.WriteUInt8((byte)(SubDmg.HasValue ? 1 : 0));

            if (SubDmg.HasValue)
            {
                attackRoundInfo.WriteInt32(SubDmg.Value.SchoolMask);
                attackRoundInfo.WriteFloat(SubDmg.Value.FDamage);
                attackRoundInfo.WriteInt32(SubDmg.Value.Damage);
                if (hitInfo.HasAnyFlag(HitInfo.FullAbsorb | HitInfo.PartialAbsorb))
                {
                    attackRoundInfo.WriteInt32(SubDmg.Value.Absorbed);
                }
                if (hitInfo.HasAnyFlag(HitInfo.FullResist | HitInfo.PartialResist))
                {
                    attackRoundInfo.WriteInt32(SubDmg.Value.Resisted);
                }
            }

            attackRoundInfo.WriteUInt8(VictimState);
            attackRoundInfo.WriteUInt32(AttackerState);
            attackRoundInfo.WriteUInt32(MeleeSpellID);

            if (hitInfo.HasAnyFlag(HitInfo.Block))
            {
                attackRoundInfo.WriteInt32(BlockAmount);
            }

            if (hitInfo.HasAnyFlag(HitInfo.RageGain))
            {
                attackRoundInfo.WriteInt32(RageGained);
            }

            if (hitInfo.HasAnyFlag(HitInfo.Unk1))
            {
                attackRoundInfo.WriteUInt32(UnkState.State1);
                attackRoundInfo.WriteFloat(UnkState.State2);
                attackRoundInfo.WriteFloat(UnkState.State3);
                attackRoundInfo.WriteFloat(UnkState.State4);
                attackRoundInfo.WriteFloat(UnkState.State5);
                attackRoundInfo.WriteFloat(UnkState.State6);
                attackRoundInfo.WriteFloat(UnkState.State7);
                attackRoundInfo.WriteFloat(UnkState.State8);
                attackRoundInfo.WriteFloat(UnkState.State9);
                attackRoundInfo.WriteFloat(UnkState.State10);
                attackRoundInfo.WriteFloat(UnkState.State11);
                attackRoundInfo.WriteUInt32(UnkState.State12);
            }

            if (hitInfo.HasAnyFlag(HitInfo.Block | HitInfo.Unk12))
            {
                attackRoundInfo.WriteFloat(Unk);
            }

            attackRoundInfo.WriteUInt8((byte)ContentTuning.TuningType);
            attackRoundInfo.WriteUInt8(ContentTuning.TargetLevel);
            attackRoundInfo.WriteUInt8(ContentTuning.Expansion);
            attackRoundInfo.WriteUInt8(ContentTuning.TargetMinScalingLevel);
            attackRoundInfo.WriteUInt8(ContentTuning.TargetMaxScalingLevel);
            attackRoundInfo.WriteInt16(ContentTuning.PlayerLevelDelta);
            attackRoundInfo.WriteInt8(ContentTuning.TargetScalingLevelDelta);
            attackRoundInfo.WriteUInt16(ContentTuning.PlayerItemLevel);
            attackRoundInfo.WriteUInt16(ContentTuning.ScalingHealthItemLevelCurveID);
            attackRoundInfo.WriteUInt8((byte)(ContentTuning.ScalesWithItemLevel ? 1 : 0));

            WriteLogDataBit();
            FlushBits();
            WriteLogData();

            _worldPacket.WriteUInt32(attackRoundInfo.GetSize());
            _worldPacket.WriteBytes(attackRoundInfo);
        }
コード例 #11
0
ファイル: MiscPackets.cs プロジェクト: hassiumsoft/CypherCore
 public void Write(WorldPacket data)
 {
     data.WriteUInt16(PhaseFlags);
     data.WriteUInt16(Id);
 }
コード例 #12
0
 public void Write(WorldPacket data)
 {
     data.WriteInt16(Idx);
     data.WriteUInt16(Speed);
 }
コード例 #13
0
            public void Write(WorldPacket data)
            {
                data.WritePackedGuid(Guid);
                data.WriteUInt64(GuildClubMemberID);
                data.WriteUInt8(ListPosition);
                data.WriteUInt8(RaceId);
                data.WriteUInt8((byte)ClassId);
                data.WriteUInt8(SexId);
                data.WriteInt32(Customizations.Count);

                data.WriteUInt8(ExperienceLevel);
                data.WriteUInt32(ZoneId);
                data.WriteUInt32(MapId);
                data.WriteVector3(PreloadPos);
                data.WritePackedGuid(GuildGuid);
                data.WriteUInt32((uint)Flags);
                data.WriteUInt32((uint)Flags2);
                data.WriteUInt32(Flags3);
                data.WriteUInt32(PetCreatureDisplayId);
                data.WriteUInt32(PetExperienceLevel);
                data.WriteUInt32(PetCreatureFamilyId);

                data.WriteUInt32(ProfessionIds[0]);
                data.WriteUInt32(ProfessionIds[1]);

                foreach (var visualItem in VisualItems)
                {
                    visualItem.Write(data);
                }

                data.WriteInt64(LastPlayedTime);
                data.WriteUInt16(SpecID);
                data.WriteUInt32(Unknown703);
                data.WriteUInt32(LastLoginVersion);
                data.WriteUInt32(Flags4);
                data.WriteInt32(MailSenders.Count);
                data.WriteInt32(MailSenderTypes.Count);
                data.WriteUInt32(OverrideSelectScreenFileDataID);

                foreach (ChrCustomizationChoice customization in Customizations)
                {
                    data.WriteUInt32(customization.ChrCustomizationOptionID);
                    data.WriteUInt32(customization.ChrCustomizationChoiceID);
                }

                foreach (var mailSenderType in MailSenderTypes)
                {
                    data.WriteUInt32(mailSenderType);
                }

                data.WriteBits(Name.GetByteCount(), 6);
                data.WriteBit(FirstLogin);
                data.WriteBit(BoostInProgress);
                data.WriteBits(unkWod61x, 5);

                foreach (string str in MailSenders)
                {
                    data.WriteBits(str.GetByteCount() + 1, 6);
                }

                data.FlushBits();

                foreach (string str in MailSenders)
                {
                    if (!str.IsEmpty())
                    {
                        data.WriteCString(str);
                    }
                }

                data.WriteString(Name);
            }
コード例 #14
0
 public void Write(WorldPacket data)
 {
     data.WriteUInt32(SpellID);
     data.WriteUInt16(GlyphID);
 }
コード例 #15
0
ファイル: TalentPackets.cs プロジェクト: CriDos/CypherCore
 public void Write(WorldPacket data)
 {
     data.WriteUInt16(PvPTalentID);
     data.WriteUInt8(Slot);
 }