Exemple #1
0
response = aauth.auth_digital(SMM2.TITLE_ID, SMM2.TITLE_VERSION, device_token,
                              ticket)
app_token = response["application_auth_token"]

# Log in on baas server
baas = BAASClient()
baas.set_system_version(SYSTEM_VERSION)
baas.authenticate(device_token)
response = baas.login(BAAS_USER_ID, BAAS_PASSWORD, app_token)

user_id = int(response["user"]["id"], 16)
id_token = response["idToken"]

# Connect to game server
backend = backend.BackEndClient("switch.cfg")
backend.configure(SMM2.ACCESS_KEY, SMM2.NEX_VERSION, SMM2.CLIENT_VERSION)
backend.connect(HOST, PORT)

# Log in on game server
auth_info = authentication.AuthenticationInfo()
auth_info.token = id_token
auth_info.ngs_version = 4  #Switch
auth_info.token_type = 2
backend.login(str(user_id), auth_info=auth_info)

# Search for ninji courses
store = datastore.DataStoreClientSMM2(backend.secure_client)

param = datastore.SearchCoursesEventParam()
courses = store.search_courses_event(param)
print("Found %i ninji courses.\n" % len(courses))
Exemple #2
0
                           small_image="nn",
                           small_text=MAINID,
                           large_image=title_id.lower())

        else:
            print("Unknown notification type %i (from %s)" %
                  (event.type, name))

    def process_presence_change_event(self, context, event):
        self.process_nintendo_notification_event(context, event)


nnas = nnas.NNASClient()
nnas.set_device(DEVICE_ID, SERIAL_NUMBER, SYSTEM_VERSION)
nnas.set_locale(REGION, COUNTRY, LANGUAGE)
nnas.set_title(Friends.TITLE_ID_EUR, Friends.LATEST_VERSION)
nnas.login(USERNAME, PASSWORD)

nex_token = nnas.get_nex_token(Friends.GAME_SERVER_ID)
backend = backend.BackEndClient("friends.cfg")
backend.configure(Friends.ACCESS_KEY, Friends.NEX_VERSION)
backend.connect(nex_token.host, nex_token.port)

login_data = authentication.NintendoLoginData()
login_data.token = nex_token.token
backend.login(nex_token.username, nex_token.password, None, login_data)
backend.secure_client.register_server(NotificationServer())

input("Press enter to disconnect and exit\n")
backend.close()
Exemple #3
0
USERNAME = "******"  #Nintendo network id
PASSWORD = "******"  #Nintendo network password

api = account.AccountAPI()
api.set_device(DEVICE_ID, SERIAL_NUMBER, SYSTEM_VERSION, REGION,
               COUNTRY)  #Can't login without this
api.set_title(DKCTF.TITLE_ID_EUR, DKCTF.LATEST_VERSION
              )  #This is necessary to request a token for the game server
api.login(USERNAME, PASSWORD)

#Each game server has its own game server id and access token
nex_token = api.get_nex_token(DKCTF.GAME_SERVER_ID)

backend = backend.BackEndClient()
backend.configure(DKCTF.ACCESS_KEY, DKCTF.NEX_VERSION)
backend.connect(nex_token.host, nex_token.port)
backend.login(nex_token.username, nex_token.password)

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

ranking_client = ranking.RankingClient(backend.secure_client)
rankings = ranking_client.get_ranking(
    ranking.RankingMode.GLOBAL,  #Get the global leaderboard
    0x893EB726,  #Category, this is 3-A (Magrove Cove)
    order_param,
    0,
    0)
USERNAME = "******"  #Nintendo network id
PASSWORD = "******"  #Nintendo network password

TRACK_ID = 27  #Mario Kart Stadium

nnas = nnas.NNASClient()
nnas.set_device(DEVICE_ID, SERIAL_NUMBER, SYSTEM_VERSION, REGION_ID,
                COUNTRY_NAME)
nnas.set_title(MK8.TITLE_ID_EUR, MK8.LATEST_VERSION)
nnas.login(USERNAME, PASSWORD)

nex_token = nnas.get_nex_token(MK8.GAME_SERVER_ID)

backend = backend.BackEndClient()
backend.configure(MK8.ACCESS_KEY, MK8.NEX_VERSION)
backend.connect(nex_token.host, nex_token.port)
backend.login(nex_token.username, nex_token.password)

ranking_client = ranking.RankingClient(backend.secure_client)

order_param = ranking.RankingOrderParam()
order_param.order_calc = ranking.RankingOrderCalc.ORDINAL
order_param.offset = 499  #Start at 500th place
order_param.count = 20  #Download 20 highscores

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
Exemple #5
0
from nintendo.nex import backend, 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("switch.cfg")
backend.configure(MK8Deluxe.ACCESS_KEY, MK8Deluxe.NEX_VERSION)
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)
	device_token, ticket
)
app_token = response["application_auth_token"]

# Log in on baas server
baas = BAASClient()
baas.set_system_version(SYSTEM_VERSION)
baas.authenticate(device_token)
response = baas.login(BAAS_USER_ID, BAAS_PASSWORD, app_token)

user_id = int(response["user"]["id"], 16)
id_token = response["idToken"]

# Connect to game server
backend = backend.BackEndClient("switch.cfg")
backend.configure(ACNH.ACCESS_KEY, ACNH.NEX_VERSION, ACNH.CLIENT_VERSION)
backend.connect(HOST, PORT)

# Log in on game server
auth_info = authentication.AuthenticationInfo()
auth_info.token = id_token
auth_info.ngs_version = 4 #Switch
auth_info.token_type = 2
backend.login(str(user_id), auth_info=auth_info)

mm = matchmaking.MatchmakeExtensionClient(backend.secure_client)

param = matchmaking.MatchmakeSessionSearchCriteria()
param.attribs = ["", "", "", "", "", ""]
param.game_mode = "2"
param.min_players = "1"