public override IPacketWriter BuildUpdate() { MaskSize = ((int)Fields.MAX + 31) / 32; FieldData.Clear(); MaskArray = new byte[MaskSize * 4]; PacketWriter writer = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_UPDATE_OBJECT], "SMSG_UPDATE_OBJECT"); writer.WriteUInt32(1); // Number of transactions writer.WriteUInt8(0); writer.WriteUInt8(3); // UpdateType writer.WritePackedGUID(Guid); writer.WriteUInt8(4); // ObjectType, 4 = Player writer.WriteUInt8(0x71); // UpdateFlags writer.WriteUInt32(0); // MovementFlagMask writer.WriteUInt8(0); // MoveFlags2? writer.WriteUInt32((uint)Environment.TickCount); writer.WriteFloat(Location.X); // x writer.WriteFloat(Location.Y); // y writer.WriteFloat(Location.Z); // z writer.WriteFloat(Location.O); // w (o) writer.WriteInt32(0); // falltime writer.WriteFloat(2.5f); // WalkSpeed writer.WriteFloat(7.0f); // RunSpeed writer.WriteFloat(2.5f); // Backwards WalkSpeed writer.WriteFloat(4.7222f); // SwimSpeed writer.WriteFloat(4.7222f); // Backwards SwimSpeed writer.WriteFloat(7.0f); // FlySpeed writer.WriteFloat(4.7222f); // Backwards FlySpeed writer.WriteFloat(3.14f); // TurnSpeed writer.Write(1); SetField(Fields.OBJECT_FIELD_GUID, Guid); SetField(Fields.OBJECT_FIELD_TYPE, (uint)0x19); SetField(Fields.OBJECT_FIELD_ENTRY, 0); SetField(Fields.OBJECT_FIELD_SCALE_X, Scale); SetField(Fields.OBJECT_FIELD_PADDING, 0); SetField(Fields.UNIT_FIELD_TARGET, (ulong)0); SetField(Fields.UNIT_FIELD_HEALTH, Health); SetField(Fields.UNIT_FIELD_POWER2, 0); SetField(Fields.UNIT_FIELD_MAXHEALTH, Health); SetField(Fields.UNIT_FIELD_MAXPOWER2, Rage); SetField(Fields.UNIT_FIELD_LEVEL, Level); SetField(Fields.UNIT_FIELD_FACTIONTEMPLATE, this.GetFactionTemplate()); SetField(Fields.UNIT_FIELD_BYTES_0, ToUInt32(Race, Class, Gender, PowerType)); SetField(Fields.UNIT_FIELD_STAT0, Strength); SetField(Fields.UNIT_FIELD_STAT1, Agility); SetField(Fields.UNIT_FIELD_STAT2, Stamina); SetField(Fields.UNIT_FIELD_STAT3, Intellect); SetField(Fields.UNIT_FIELD_STAT4, Spirit); SetField(Fields.UNIT_FIELD_FLAGS, 8); SetField(Fields.UNIT_FIELD_BASE_MANA, Mana); SetField(Fields.UNIT_FIELD_DISPLAYID, DisplayId); SetField(Fields.UNIT_FIELD_MOUNTDISPLAYID, MountDisplayId); SetField(Fields.UNIT_FIELD_BYTES_1, ToUInt32((byte)StandState)); SetField(Fields.UNIT_FIELD_BYTES_2, 0); SetField(Fields.PLAYER_BYTES, ToUInt32(Skin, Face, HairStyle, HairColor)); SetField(Fields.PLAYER_BYTES_2, ToUInt32(FacialHair, b4: RestedState)); SetField(Fields.PLAYER_BYTES_3, ToUInt32(Gender)); SetField(Fields.PLAYER_XP, 47); SetField(Fields.PLAYER_NEXT_LEVEL_XP, 200); SetField(Fields.PLAYER_FLAGS, 0); SetField(Fields.UNIT_FIELD_ATTACK_POWER, 1); SetField(Fields.UNIT_FIELD_ATTACK_POWER_MODS, 0); SetField(Fields.UNIT_FIELD_RANGED_ATTACK_POWER, 1); SetField(Fields.UNIT_FIELD_RANGED_ATTACK_POWER_MODS, 0); for (int i = 0; i < 64; i++) { SetField(Fields.PLAYER_EXPLORED_ZONES_1 + i, 0xFFFFFFFF); } // send language skills so we can type commands SetField(Fields.PLAYER_SKILL_INFO_1_1, CharacterData.COMMON_SKILL_ID); SetField(Fields.PLAYER_SKILL_INFO_1_1 + 1, ToUInt32(300, 300)); SetField(Fields.PLAYER_SKILL_INFO_1_1 + 2, 0); SetField(Fields.PLAYER_SKILL_INFO_1_1 + 3, CharacterData.ORCISH_SKILL_ID); SetField(Fields.PLAYER_SKILL_INFO_1_1 + 4, ToUInt32(300, 300)); SetField(Fields.PLAYER_SKILL_INFO_1_1 + 5, 0); // FillInPartialObjectData writer.WriteUInt8(MaskSize); // UpdateMaskBlocks writer.Write(MaskArray); foreach (var kvp in FieldData) { writer.Write(kvp.Value); // Data } return(writer); }
public override IPacketWriter BuildMessage(string text) { PacketWriter message = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_MESSAGECHAT], "SMSG_MESSAGECHAT"); return(this.BuildMessage(message, text)); }