aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/PreLoginPacket.h
blob: b0935d0a55cde05b1f0874d33e4b579142b7a777 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#pragma once
using namespace std;

#include "Packet.h"

class PreLoginPacket : public Packet, public enable_shared_from_this<PreLoginPacket>
{
    // the login key is username client->server and sessionid server->client
public:
	static const int m_iSaveNameLen=14;
	//4J Added more info to this packet so that we can check if anyone has a UGC privilege that won't let us
	// join, and so that we can inform the server if we have that privilege set. Anyone with UGC turned off completely
	// can't play the game online at all, so we only need to specify players with friends only set
	PlayerUID *m_playerXuids;
	DWORD m_dwPlayerCount;
	BYTE m_friendsOnlyBits;
	DWORD m_ugcPlayersVersion;
	BYTE m_szUniqueSaveName[m_iSaveNameLen]; // added for checking if the level is in the ban list
	DWORD m_serverSettings; // A bitfield of server settings constructed with the MAKE_SERVER_SETTINGS macro
	BYTE m_hostIndex; // Rather than sending the xuid of the host again, send an index into the m_playerXuids array
	DWORD m_texturePackId;
	SHORT m_netcodeVersion;

	wstring loginKey;

	PreLoginPacket();
	PreLoginPacket(wstring userName);
	PreLoginPacket(wstring userName, PlayerUID *playerXuids, DWORD playerCount, BYTE friendsOnlyBits, DWORD ugcPlayersVersion,char *pszUniqueSaveName, DWORD serverSettings, BYTE hostIndex, DWORD texturePackId);
	~PreLoginPacket();

	virtual void read(DataInputStream *dis);
	virtual void write(DataOutputStream *dos);
	virtual void handle(PacketListener *listener);
	virtual int getEstimatedSize();

public:
	static shared_ptr<Packet> create() { return std::make_shared<PreLoginPacket>(); }
	virtual int getId() { return 2; }
};