예제 #1
0
from nintendo.nex import backend, ranking
from nintendo.games import MK8Deluxe
from nintendo import settings

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,
                                settings.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
예제 #2
0
from nintendo.nex import backend
from nintendo.games import Friends
from nintendo import settings

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

backend = backend.BackEndClient(Friends.ACCESS_KEY, Friends.NEX_VERSION,
                                settings.Settings("friends.cfg"))
backend.connect("127.0.0.1", 1223)
backend.login_guest()
backend.close()
from nintendo.nex import backend, authentication, ranking
from nintendo.games import MK8Deluxe
from nintendo import settings

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, settings.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