protected override byte[] BuildCreatePacket() { foreach (var creationUpdateFieldEntry in entity.Info.CreationUpdateFieldEntries) { UpdateQueue.Enqueue(creationUpdateFieldEntry); } SetInfoFields(entity.Info); var writer = new BinaryWriter(new MemoryStream()); writer.Write((byte)ObjectUpdateType.UPDATETYPE_CREATE_OBJECT); writer.WritePackedUInt64(this.entity.ObjectGUID.RawGUID); writer.Write((byte)TypeID.TYPEID_GAMEOBJECT); ObjectUpdateFlag updateFlags = ObjectUpdateFlag.UPDATEFLAG_TRANSPORT | ObjectUpdateFlag.UPDATEFLAG_ALL | ObjectUpdateFlag.UPDATEFLAG_HAS_POSITION; writer.Write((byte)updateFlags); // Position writer.Write(entity.Location.X); writer.Write(entity.Location.Y); writer.Write(entity.Location.Z); writer.Write(entity.Location.Orientation); // R writer.Write((uint)0x1); // Unkown... time? writer.Write((uint)0); // Unkown... time? WriteUpdateFields(writer); return (writer.BaseStream as MemoryStream).ToArray(); }
protected override byte[] BuildUpdatePacket() { this.SetInfoFields(entity.Info); var writer = new BinaryWriter(new MemoryStream()); writer.Write((byte)ObjectUpdateType.UPDATETYPE_VALUES); writer.WritePackedUInt64(entity.ObjectGUID.RawGUID); this.WriteUpdateFields(writer); return (writer.BaseStream as MemoryStream).ToArray(); }
protected override byte[] BuildCreatePacket() { //Add all info field entries to the queue foreach (var creationUpdateFieldEntry in entity.Info.CreationUpdateFieldEntries) { UpdateQueue.Enqueue(creationUpdateFieldEntry); } SetInfoFields(entity.Info); var writer = new BinaryWriter(new MemoryStream()); //TODO Work out why "adder" unit crashes client. Maybe a pet or dynamic object? writer.Write((byte)ObjectUpdateType.UPDATETYPE_CREATE_OBJECT); writer.WritePackedUInt64(entity.ObjectGUID.RawGUID); writer.Write((byte)TypeID.TYPEID_UNIT); ObjectUpdateFlag updateFlags = ObjectUpdateFlag.UPDATEFLAG_ALL | ObjectUpdateFlag.UPDATEFLAG_LIVING | ObjectUpdateFlag.UPDATEFLAG_HAS_POSITION; writer.Write((byte)updateFlags); writer.Write((uint)MovementFlags.MOVEFLAG_NONE); // MovementFlags writer.Write((uint)Environment.TickCount); // Time // 3 bytes ahead? // Position writer.Write(entity.Location.X); writer.Write(entity.Location.Y); writer.Write(entity.Location.Z); writer.Write(entity.Location.Orientation); // R // Movement speeds writer.Write((float)0); // ???? writer.Write(entity.Info.WalkSpeed); // MOVE_WALK writer.Write((float)7); // MOVE_RUN writer.Write(4.5f); // MOVE_RUN_BACK writer.Write(4.72f); // MOVE_SWIM writer.Write(2.5f); // MOVE_SWIM_BACK writer.Write(3.14f); // MOVE_TURN_RATE writer.Write(0x1); // Unkown... // entity.GUID = 1141440694; this.WriteUpdateFields(writer); return (writer.BaseStream as MemoryStream).ToArray(); }
public PSUpdateObject BuildOwnCharacterPacket() { foreach (var creationUpdateFieldEntry in entity.Info.CreationUpdateFieldEntries) { UpdateQueue.Enqueue(creationUpdateFieldEntry); } SetInfoFields(entity.Info); BinaryWriter writer = new BinaryWriter(new MemoryStream()); writer.Write((byte)ObjectUpdateType.UPDATETYPE_CREATE_OBJECT2); writer.WritePackedUInt64(this.entity.ObjectGUID.RawGUID); writer.Write((byte)TypeID.TYPEID_PLAYER); ObjectUpdateFlag updateFlags = ObjectUpdateFlag.UPDATEFLAG_ALL | ObjectUpdateFlag.UPDATEFLAG_SELF | ObjectUpdateFlag.UPDATEFLAG_HAS_POSITION | ObjectUpdateFlag.UPDATEFLAG_LIVING; writer.Write((byte)updateFlags); writer.Write((UInt32)MovementFlags.MOVEFLAG_NONE); writer.Write((UInt32)Environment.TickCount); // Time? // Position writer.Write((float)entity.Location.X); writer.Write((float)entity.Location.Y); writer.Write((float)entity.Location.Z); writer.Write((float)entity.Location.Orientation); // R // Movement speeds writer.Write((float)0); // ???? writer.Write((float)entity.Info.WalkSpeed); // MOVE_WALK writer.Write((float)20f); // MOVE_RUN writer.Write((float)4.5f); // MOVE_RUN_BACK writer.Write((float)4.72f); // MOVE_SWIM writer.Write((float)2.5f); // MOVE_SWIM_BACK writer.Write((float)3.14f); // MOVE_TURN_RATE writer.Write(0x1); // Unkown... this.WriteUpdateFields(writer); return new PSUpdateObject(new List<byte[]>() { (writer.BaseStream as MemoryStream).ToArray() }); }
private byte[] RemoveEntitiesBlock() { var writer = new BinaryWriter(new MemoryStream()); writer.Write((byte)ObjectUpdateType.UPDATETYPE_OUT_OF_RANGE_OBJECTS); writer.Write((uint)this.removeEntities.Count); while(removeEntities.Count != 0) { var entity = removeEntities.Dequeue(); writer.WritePackedUInt64(entity.ObjectGUID.RawGUID); } return (writer.BaseStream as MemoryStream).ToArray(); }
protected override byte[] BuildUpdatePacket() { foreach (var creationUpdateFieldEntry in entity.Info.CreationUpdateFieldEntries) { UpdateQueue.Enqueue(creationUpdateFieldEntry); } this.SetInfoFields(entity.Info); var writer = new BinaryWriter(new MemoryStream()); writer.Write((byte)ObjectUpdateType.UPDATETYPE_VALUES); writer.WritePackedUInt64(entity.ObjectGUID.RawGUID); this.WriteUpdateFields(writer); return (writer.BaseStream as MemoryStream).ToArray(); }