responsechannellist packet
ive started up on team zebras emulator for the lulz, got some things done, fixed a few things etc etc. however im kinda stumped on the channellist packet.
it kinda goes like this.
Code:
p.setIndex(11);
MUID uidplayer = new MUID();
int type = 0;
uint index = 0;
uidplayer.first = (uint)p.ReadInt();
uidPlayer.second = (uint)p.ReadInt();
type = p.ReadInt();
List<Lobby> findall = Globals.channels.FindAll(lol => lol.type == (ChannelType)type);
if(findall.Count == 0 || findall == null)
System.Console.WriteLine("findall is NULL");
GunzPacket response = new GunzPacket(0x64, 0x4BD); //channel_list
response.StartHeader();
response.writeByte((byte)findall.Count);
foreach(Lobby chan in findall)
{
index++;
response.writeInt(chan.uid.first);
response.writeInt(chan.uid.second);
response.writeInt(index);
response.writeInt((byte)chan.players.Count);
response.writeInt(chan.maxPlayers);
response.writeInt(chan.minLevel);
response.writeInt(chan.maxLevel);
response.writeByte((byte)chan.type);
response.writeString(chan.name);
response.writeInt(0x00); //boolean
response.writeInt(0x00); //?
}
response.FinishHeader();
c.Send(response);
and of course in the responseheader class i have channel_list_start. is there something im missing?
oh yes it is getting all of the info about the channels correctly i logged n monitored it for a good half hour.
Re: responsechannellist packet
I forgot how bad his code was rofl.
MatchServer at master from Theoretical's Infamous - GitHub
use that as a base, I guess.
Code:
[PacketHandler(Operation.ChannelListStart, PacketFlags.Character)]
public static void ResponseChannelList (Client pClient, PacketReader pPacket)
{
var uid = pPacket.ReadUInt64();
var type = pPacket.ReadInt32();
if (!Enum.IsDefined(typeof(MMatchChannelType), (byte)type))
{
pClient.Disconnect();
return;
}
List<MMatchChannel> channels = Program.mChannels.FindAll (c => c.nChannelType == (MMatchChannelType)type);
if (channels == null || channels.Count == 0)
return;
PacketWriter pChannelList = new PacketWriter(Operation.ChannelList, CryptFlags.Encrypt);
pChannelList.Write(channels.Count, 88);
Int16 index = 0;
foreach (MMatchChannel c in channels)
{
pChannelList.Write(c.uidChannel);
pChannelList.Write(++index);
pChannelList.Write((Int16)c.lClients.Count);
pChannelList.Write((Int16)c.nMaxUsers);
pChannelList.Write((Int16)c.nMinLevel);
pChannelList.Write((Int16)c.nMaxLevel);
pChannelList.Write((byte)c.nChannelType);
pChannelList.Write(c.szName, 64);
pChannelList.Write(false);
pChannelList.Write((Int32)0);
}
pClient.Send(pChannelList);
}
Re: responsechannellist packet
thank you thephailure772. i think ill use that as a base but i was planning on using one quite early in development, but i guess i can still see how its all done and everything lol.
is this written by you? is there any license? im not planning any public releases or anything unless i write my own.
oh last question if you dont mind. what year was this emulator designed for?
Re: responsechannellist packet
Quote:
Originally Posted by
R3apingSaint
thank you thephailure772. i think ill use that as a base but i was planning on using one quite early in development, but i guess i can still see how its all done and everything lol.
is this written by you? is there any license? im not planning any public releases or anything unless i write my own.
oh last question if you dont mind. what year was this emulator designed for?
Yes by me, no license and I think it was for an 09 client.