/// <summary> /// Sends ChannelInfoRequestR to client. /// </summary> /// <param name="client"></param> /// <param name="info">Negative response if null.</param> /// <param name="characterId"></param> public static void ChannelInfoRequestR(LoginClient client, ChannelInfo info, long characterId) { var packet = new Packet(Op.ChannelInfoRequestR, MabiId.Channel); packet.PutByte(info != null); if (info != null) { packet.PutString(info.ServerName); packet.PutString(info.Name); packet.PutShort(6); // Channel "Id"? (seems to be equal to channel nr) packet.PutString(info.Host); packet.PutString(info.Host); packet.PutShort((short)info.Port); packet.PutShort((short)(info.Port + 2)); packet.PutInt(1); packet.PutLong(characterId); } client.Send(packet); }
/// <summary> /// Sends SwitchChannelR to creature's client /// </summary> /// <param name="creature"></param> /// <param name="channel">Negative answer if null.</param> public static void SwitchChannelR(Creature creature, ChannelInfo channel) { var packet = new Packet(Op.SwitchChannelR, MabiId.Channel); packet.PutByte(channel != null); if (channel != null) { packet.PutString(channel.ServerName); packet.PutString(channel.Name); packet.PutShort(1); // Channel id packet.PutString(channel.Host); packet.PutString(channel.Host); packet.PutUShort((ushort)channel.Port); packet.PutUShort((ushort)(channel.Port + 4)); } creature.Client.Send(packet); }
/// <summary> /// Adds channel and server, if it doesn't exist yet. /// Replaces channel if it already exists. /// </summary> /// <param name="channel"></param> public void Add(ChannelInfo channel) { var server = this.Add(channel.ServerName); server.Channels[channel.Name] = channel; }