Closed danielwerg closed 2 years ago
Merged with 6eaf958e24fcaba0b01ba5be7f351348606a867c, thanks again for your help :)
The helper function does look quite useful - if youre okay with it i would like to adapt it for this project, as it would save me a lot of time :)
The helper function does look quite useful - if youre okay with it i would like to adapt it for this project, as it would save me a lot of time :)
Sure thing
https://www.ubisoft.com/en-us/game/rainbow-six/siege/game-info/seasons/vectorglare
Snippets of code I use in my projects to get operator's price
With that code you would only need to update `lastSeasonId` every season ```ts // Ex: Y7S2 -> 26 const getSeasonId = (shorthand: string) => { const [year, season] = /Y([0-9]+)S([0-9])/ .exec(shorthand) ?.slice(1) .map(Number) as [number, number]; return year === 0 ? 0 : year * 4 - 4 + season; }; const getPrice = (seasonId: number, lastSeasonId: number) => { const ratio = (lastSeasonId - seasonId) / 4; let result = { renown: 0, r6Credits: 0 }; switch (Math.floor(ratio)) { case 0: result = { renown: 25000, r6Credits: 600 }; break; case 1: result = { renown: 20000, r6Credits: 480 }; break; case 2: result = { renown: 15000, r6Credits: 360 }; break; default: result = { renown: 10000, r6Credits: 240 }; } return seasonId === 0 ? { renown: 1000, r6Credits: 0 } : result; }; ```