Exemplo n.º 1
0
nnas = NNASClient()
nnas.set_device(DEVICE_ID, SERIAL_NUMBER, SYSTEM_VERSION, REGION, COUNTRY)
nnas.login(USERNAME, PASSWORD)

#Connect to both the Mario Kart 8 server and the Wii U friends server
friends_backend = backend_login(Friends, False, True, "friends.cfg")
game_backend = backend_login(MK8, True, False)

pid = game_backend.get_pid()

friends_client = friends.FriendsClient(friends_backend.secure_client)
matchmaker = matchmaking.MatchmakeExtensionClient(game_backend.secure_client)

#Create a matchmake session
matchmake_session = matchmaking.MatchmakeSession()
matchmake_session.player_min = 2
matchmake_session.player_max = 12
matchmake_session.participation_policy = 98
matchmake_session.game_mode = 3
matchmake_session.attribs[4] = 0x403  #DLCs enabled
matchmake_session.matchmake_system = matchmaking.MatchmakeSystem.FRIENDS

session_id = matchmaker.create_matchmake_session(matchmake_session, "", 1).gid

#Tell friends we're playing MK8 and have created a room
application_data = b"\0\0\x20\x03\0\0\0\0\0\0\0\0\x18" + struct.pack(
    "<I", pid) + b"\0\0\0"

presence = friends.NintendoPresenceV2()
presence.flags = 0x1EE
friends_backend = backend_login(
	friends.FriendsTitle, False, True, backend.Settings("friends.cfg")
)
game_backend = backend_login(MK8, True, False)

pid = game_backend.auth_client.pid

friends_client = friends.FriendsClient(friends_backend)
matchmaker = matchmaking.MatchmakeExtensionClient(game_backend)

#Create a matchmake session
matchmake_session = matchmaking.MatchmakeSession(
	#Create a gathering with between 2 and 12 players
	#and the participation policy set to 98
	0, 0, 0, 2, 12, 98, 0, 0, 0, "",
	3, [0, 0, 0, 0, 0x403, 0], #game mode = 3, flags = 0x403 (DLCs enabled)
	True, #Open participation
	matchmaking.MatchmakeSystem.FRIENDS, #Only friends will join
	b"", 0, b"", 100, 0
)
session_id, session_key = matchmaker.create_matchmake_session(
	matchmake_session, "", 1
)

#Tell friends we're playing MK8 and have created a room
application_data = b"\0\0\x20\x03\0\0\0\0\0\0\0\0\x18" + struct.pack("<I", pid) + b"\0\0\0"
presence = friends.NintendoPresenceV2(
	0x1EE, True, friends.GameKey(MK8.TITLE_ID_EUR, MK8.LATEST_VERSION), 0,
	"I'm a Python client", 2, 2, MK8.GAME_SERVER_ID, 3,
	pid, session_id, application_data, 3, 3, 3
)