marcopixel / r6operators

r6operators is a collection of high-quality vectorized Rainbow Six: Siege Operator icons & metadata for Node.js
https://r6operators.marcopixel.eu
MIT License
100 stars 10 forks source link

Update operators prices and glaz's ratings #34

Closed danielwerg closed 2 years ago

danielwerg commented 2 years ago

https://www.ubisoft.com/en-us/game/rainbow-six/siege/game-info/seasons/vectorglare

Sidenote: It would be probably worth it having a function which gets prices for operators instead of manually updating it every season

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; }; ```
marcopixel commented 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 :)

danielwerg commented 2 years ago

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