Ejemplo n.º 1
0
 def connect(self):
     self.ErrorCount = 0
     if not self.client is None:
         self.disconnect()
         time.sleep(3)
     self.getNASCBits()
     self.backend = backend.BackEndClient(friends.FriendsTitle.ACCESS_KEY,
                                          friends.FriendsTitle.NEX_VERSION,
                                          backend.Settings("friends.cfg"))
     self.backend.connect(self.host, self.port)
     self.backend.login(
         self.pid,
         self.password,
         auth_info=None,
         login_data=authentication.AccountExtraInfo(168823937, 2134704128,
                                                    0, self.token),
     )
     self.client = friends.Friends3DSClient(self.backend)
     self.connected = True
from nintendo.nex import backend, authentication, ranking
from nintendo.games import MK8Deluxe

TRACK_ID = 10  #Sunshine airport

HOST = "g%08x-lp1.s.n.srv.nintendo.net" % MK8Deluxe.GAME_SERVER_ID
PORT = 443

backend = backend.BackEndClient(MK8Deluxe.ACCESS_KEY, MK8Deluxe.NEX_VERSION,
                                backend.Settings("switch.cfg"))
backend.connect(HOST, PORT)
backend.login_guest()

order_param = ranking.RankingOrderParam()
order_param.order_calc = ranking.RankingOrderCalc.ORDINAL
order_param.offset = 0  #Start with world record
order_param.count = 20  #Download 20 highscores

ranking_client = ranking.RankingClient(backend.secure_client)
rankings = ranking_client.get_ranking(ranking.RankingMode.GLOBAL, TRACK_ID,
                                      order_param, 0, 0)

stats = ranking_client.get_stats(TRACK_ID, order_param,
                                 ranking.RankingStatFlags.ALL).stats


def format_time(score):
    millisec = score % 1000
    seconds = score // 1000 % 60
    minutes = score // 1000 // 60
    return "%i:%02i.%03i" % (minutes, seconds, millisec)
Ejemplo n.º 3
0
from nintendo.nex import backend, authentication, ranking
from nintendo.games import MK8Deluxe

TRACK_ID = 10 #Sunshine airport

HOST = "g%08x-lp1.s.n.srv.nintendo.net" %MK8Deluxe.GAME_SERVER_ID
PORT = 443

backend = backend.BackEndClient(
	MK8Deluxe.ACCESS_KEY, MK8Deluxe.NEX_VERSION, backend.Settings("switch.cfg")
)
backend.connect(HOST, PORT)
backend.login_guest()

ranking_client = ranking.RankingClient(backend)
rankings = ranking_client.get_ranking(
	ranking.RankingClient.MODE_GLOBAL,
	TRACK_ID,
	ranking.RankingOrderParam(
		ranking.RankingOrderParam.ORDINAL, #"1234" ranking
		0xFF, 0, 2,
		0, 20 #Download top 20
	),
	0, 0
)
stats = ranking_client.get_stats(
	TRACK_ID,
	ranking.RankingOrderParam(
		ranking.RankingOrderParam.ORDINAL, 0xFF, 0, 2, 0, 0
	)
Ejemplo n.º 4
0
from nintendo.nex import backend
from nintendo.games import Friends

import logging
logging.basicConfig(level=logging.INFO)

backend = backend.BackEndClient(Friends.ACCESS_KEY, Friends.NEX_VERSION,
                                backend.Settings("friends.cfg"))
backend.connect("127.0.0.1", 1223)
backend.login_guest()
backend.close()
	
	client = backend.BackEndClient(title.ACCESS_KEY, title.NEX_VERSION, settings)
	client.connect(nex_token.host, nex_token.port)
	client.login(
		nex_token.username, nex_token.password, auth_info
	)
	return client


api = AccountAPI()
api.set_device(DEVICE_ID, SERIAL_NUMBER, SYSTEM_VERSION, REGION, COUNTRY)
api.login(USERNAME, PASSWORD)

#Connect to both the Mario Kart 8 server and the Wii U friends server
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