danielwerg / r6api.js

🍫 Node.js wrapper around Rainbow Six Siege APIs
https://npm.im/r6api.js
MIT License
111 stars 19 forks source link

Support crossplay progression #102

Open BadCoder1337 opened 1 year ago

BadCoder1337 commented 1 year ago

After crossplay release r6api.getProgression no longer receive updates. My current xp and level: image My xp and level from legacy progression endpoint:

GET /v1/spaces/5172a557-50b5-4665-b7db-e3f2e8c5041d/sandboxes/OSBOR_PC_LNCH_A/r6playerprofile/playerprofile/progressions?profile_ids=c09fc7c9-5d45-4c6c-94e5-2dee159abff3 HTTP/1.1
Host: public-ubiservices.ubi.com
Authorization: Ubi_v1 t=<token>
Ubi-AppId: e3d5ea9e-50bd-43b7-88bf-39794f4e3d40
{
    "player_profiles": [
        {
            "xp": 25362,
            "profile_id": "c09fc7c9-5d45-4c6c-94e5-2dee159abff3",
            "lootbox_probability": 650,
            "level": 281
        }
    ]
}

While we have been researching for Ranked 2.0 @floxay provided new sandbox name and space id for crossplay. My xp and level from new crossplay progression endpoint:

GET /v1/spaces/0d2ae42d-4c27-4cb7-af6c-2099062302bb/sandboxes/OSBOR_XPLAY_LNCH_A/r6playerprofile/playerprofile/progressions?profile_ids=c09fc7c9-5d45-4c6c-94e5-2dee159abff3 HTTP/1.1
Host: public-ubiservices.ubi.com
Authorization: Ubi_v1 t=<token>
Ubi-AppId: e3d5ea9e-50bd-43b7-88bf-39794f4e3d40
{
    "player_profiles": [
        {
            "xp": 4472,
            "profile_id": "c09fc7c9-5d45-4c6c-94e5-2dee159abff3",
            "lootbox_probability": 600,
            "level": 89
        }
    ]
}

As you can see, both results are incorrect. It would be reasonable for Ubisoft (lol) to use the sum of legacy and crossplay xp. But there's no total xp in API response, only level and xp remainder. Using some redditor research I wrote few functions in Google Sheets to calculate xp per level, total xp, level and remainder by total xp. NOTE: there's a constant 500xp difference with the calculated and actual result. Looks like Ubisoft added 500xp to legacy profiles after freezing it. So now I can import these functions from utils, call r6api.getProgression('uplay', id) and r6api.getProgression('xplay', id), merge total xp and calculate the actual level and xp remainder. If @danielwerg decide he could add a unified method to collect and merge progression from all sandboxes, but such method is not ratelimit friendly.

floxay commented 1 year ago

Why not just use the public profile endpoint to retrieve level and XP instead of relying on a somewhat weird math and legacy endpoints that could be shut down by Ubisoft at any minute? c09fc7c9-5d45-4c6c-94e5-2dee159abff3=image

BadCoder1337 commented 1 year ago

Why not just use the public profile endpoint.

danielwerg commented 1 year ago

Oh, wow, /r6playerprofile/playerprofile/progressions is fully unsupported, doesn't even update alpha pack drop chance. I will probably replace /r6playerprofile/playerprofile/progressions with /title/r6s/rewards/public_profile for getUserProgresssion method my only concern is lack of bulk profile ids request.

BadCoder1337 commented 1 year ago

fully unsupported

Only XPLAY sandbox gets updated. Yesterday I played few matches and this is current progression. image

Bulk requests are crucial to update large datasets.

BadCoder1337 commented 1 year ago

a somewhat weird math and legacy endpoints that could be shut down by Ubisoft at any minute

This is certified Ubisoft API Moment™️. I would love to use official tracker endpoints, but there's very tight ratelimites and no bulk queries. It's designed to use under user auth, so it's impossible to use it under "bot" auth for production-scale data retrieval.

danielwerg commented 1 year ago

Only XPLAY sandbox gets updated

Could you give me full url that you are hitting? For uplay I'm getting 3000 and for crossplay I'm getting 3100 which both are wrong, in game it shows 11.00%

BadCoder1337 commented 1 year ago

PR branch:

import R6API from './index.mjs';

const { UBI_EMAIL: email = '', UBI_PASSWORD: password = '' } = process.env;
const r6api = new R6API({ email, password });

const res = await r6api.getProgression('xplay', ['c09fc7c9-5d45-4c6c-94e5-2dee159abff3']);

console.log(res)
GET /v1/spaces/0d2ae42d-4c27-4cb7-af6c-2099062302bb/sandboxes/OSBOR_XPLAY_LNCH_A/r6playerprofile/playerprofile/progressions?profile_ids=c09fc7c9-5d45-4c6c-94e5-2dee159abff3 HTTP/1.1
Host: public-ubiservices.ubi.com
Authorization: Ubi_v1 t=<token>
Ubi-AppId: e3d5ea9e-50bd-43b7-88bf-39794f4e3d40
{
    "player_profiles": [
        {
            "xp": 22970,
            "profile_id": "c09fc7c9-5d45-4c6c-94e5-2dee159abff3",
            "lootbox_probability": 1750,
            "level": 89
        }
    ]
}

image

danielwerg commented 1 year ago

@BadCoder1337 Nope, I'm still getting 3100. Maybe I'm making some silly mistake, could you look up 0b95544b-0228-49a7-b338-6d15cfbc3d6a?

2023-06-07_11-52-14

floxay commented 1 year ago
Off-topic > This is certified Ubisoft API Moment™️. Game client API, so there's hardly anything wrong with it ¯\\\_(ツ)_/¯. However, not providing a dedicated & official API of any kind or scale for developers is weird ...to say the least.
BadCoder1337 commented 1 year ago

@danielwerg still 31%. Looks like it doesn't work for you, because I got correct result also for my friend.