// Count // Update // UpdateType // UpdateType = Partial // PackedGUID // BlocksCount // UpdateMask // KeyValueDictionary public static void SendUpdateObject(WorldClient client) { using (var ms = new MemoryStream()) using (var bw = new BinaryWriter(ms)) { bw.Write((long)1); } }
public static bool HandlePlayerLogin(WorldClient client, BinaryReader br) { var pkt = PacketHelper.Parse<CMSG_PLAYER_LOGIN>(br); client.SendPacket(WorldOpcodes.SMSG_LOGIN_VERIFY_WORLD, PacketHelper.Build(new SMSG_LOGIN_VERIFY_WORLD { MapID = 0, X = -8954.42f, Y = -158.558f, Z = 81.8225f, Orientation = 0.0f })); client.SendPacket(WorldOpcodes.SMSG_ACCOUNT_DATA_TIMES, PacketHelper.Build(new SMSG_ACCOUNT_DATA_TIMES { Data = new uint[32] })); return true; }
protected override int ProcessInternal(byte[] data) { var packets = WorldPacket.FromBuffer(data, WorldPacketFlags.GUIDPrefix); var bytesRead = 0; foreach (var pkt in packets) { WorldClient client; if (!WorldManager.Instance.GUIDClientMap.TryGetValue(pkt.GUID, out client)) // Assume it's the first we see of this client WorldManager.Instance.GUIDClientMap.Add(pkt.GUID, (client = new WorldClient(pkt.GUID))); using (var ms = new MemoryStream(pkt.Payload.ToArray())) using (var br = new BinaryReader(ms)) { Log.WriteLine(WorldLogTypes.Packets, $"<- {pkt.Header.Opcode}({pkt.Header.Length}):\n\t{string.Join(" ", pkt.Payload.Select(b => b.ToString("X2")))}"); if (!WorldHandler.PacketHandlers.ContainsKey(pkt.Header.Opcode) || !WorldHandler.PacketHandlers[pkt.Header.Opcode](client, br)) Log.WriteLine(WorldLogTypes.Packets, $"Failed to handle command {pkt.Header.Opcode}"); } bytesRead += pkt.TotalLength; } return bytesRead; }