/// <summary> /// Handles re-routing of a zonelist message to the appropriate player /// </summary> static public void Handle_SC_ZoneList(SC_Zones <Database> pkt, Database db) { Player recipient = db._server.getPlayer(pkt.requestee); if (recipient == null) { return; } //Give him his list of zones! SC_ZoneList zl = new SC_ZoneList(pkt.zoneList, recipient); recipient._client.sendReliable(zl, 1); }
/// <summary> /// Creates a new packet based on the typeID and the received content /// inside the buffer. The user has to create an own implementation /// of this interface. /// </summary> public PacketBase createPacket(NetworkClient client, ushort typeID, byte[] buffer, int offset, int size) { //Ready our packet base PacketBase packet = null; size--; //Was it a system packet? if (buffer[offset++] == 0) { //Yes, find the appropriate type return(createSystemPacket(typeID, buffer, offset, size)); } //So what was the typeid? switch (typeID) { case SC_Auth <T> .TypeID: packet = new SC_Auth <T>(typeID, buffer, offset, size); break; case SC_PlayerLogin <T> .TypeID: packet = new SC_PlayerLogin <T>(typeID, buffer, offset, size); break; case SC_PlayerStatsResponse <T> .TypeID: packet = new SC_PlayerStatsResponse <T>(typeID, buffer, offset, size); break; case SC_Whisper <T> .TypeID: packet = new SC_Whisper <T>(typeID, buffer, offset, size); break; case SC_JoinChat <T> .TypeID: packet = new SC_JoinChat <T>(typeID, buffer, offset, size); break; case SC_LeaveChat <T> .TypeID: packet = new SC_LeaveChat <T>(typeID, buffer, offset, size); break; case SC_PrivateChat <T> .TypeID: packet = new SC_PrivateChat <T>(typeID, buffer, offset, size); break; case SC_Chat <T> .TypeID: packet = new SC_Chat <T>(typeID, buffer, offset, size); break; case SC_Zones <T> .TypeID: packet = new SC_Zones <T>(typeID, buffer, offset, size); break; case Disconnect <T> .TypeID: packet = new Disconnect <T>(typeID, buffer, offset, size); break; default: //An undefined packet. packet = new PacketDummy(typeID, buffer, offset, size); break; } return(packet); }