public void OnPacket(byte[] data, int bytes) { PacketStream packet = new PacketStream(data, 0, bytes); UInt32 packetBytes = packet.ReadUInt32(); UInt32 id = packet.ReadUInt32(); if (FHandlers.ContainsKey(id) == false) { OnUnhandledPacket(id, packetBytes); return; } PacketHandler handler = FHandlers[id]; if (handler != null) { handler(packet); } }
void OnRookieCard(PacketStream packet) { UInt32 playerId = packet.ReadUInt32(); string code = packet.ReadString(); string charName = packet.ReadString(); RookieCard.RookieCardSoapClient client = new RookieCard.RookieCardSoapClient(); client.UseCardCompleted += new EventHandler<WIS.RookieCard.UseCardCompletedEventArgs>(client_UseCardCompleted); RookieCardContext context = new RookieCardContext(); context.playerId = playerId; context.charName = charName; client.UseCardAsync(code, -1, -1, context); }