1.0.1 • Published 5 years ago

rx-akatsuki-pp v1.0.1

Weekly downloads
6
License
Unlicense
Repository
github
Last release
5 years ago

Before we get started, this is a modified ojsama version to calculate Akatsuki's Relax PP Otherwise, everything is working like ojsama :)


this is free and unencumbered software released into the public

domain. refer to the attached UNLICENSE or http://unlicense.org/

pure javascript implementation of

https://github.com/Francesco149/oppai-ng intended to be easier

to use and set up for js developers as well as more portable

than straight up bindings at the cost of some performance

installation:


since this is a single-file library, you can just drop the file

into your project:

cd my/project

curl https://waa.ai/ojsama > rx-akatsuki-pp.js

it's also available as a npm package:

npm install rx-akatsuki-pp

you can find full documentation of the code at

http://hnng.moe/stuff/ojsama.html or simply read rx-akatsuki-pp.js

usage (nodejs):


(change ./rx-akatsuki-pp to rx-akatsuki-pp if you installed through npm)

var readline =  require("readline");

var osu =  require("./rx-akatsuki-pp");

  

var parser =  new  osu.parser();

readline.createInterface({

input: process.stdin, terminal: falsei

})

.on("line", parser.feed_line.bind(parser))

.on("close", function() {

console.log(osu.ppv2({map: parser.map}).toString());

});
$ curl https://osu.ppy.sh/osu/67079 | node minexample.js

133.24 pp (36.23 aim, 40.61 speed, 54.42 acc)

advanced usage (nodejs with acc, mods, combo...):


var readline =  require("readline");

var osu =  require("./rx-akatsuki-pp");

  

var mods = osu.modbits.none;

var acc_percent;

var combo;

var nmiss;

  

// get mods, acc, combo, misses from command line arguments

// format: +HDDT 95% 300x 1m

var argv = process.argv;

  

for (var i =  2; i < argv.length; ++i)

{

if (argv[i].startsWith("+")) {

mods = osu.modbits.from_string(argv[i].slice(1) ||  "");

}

  

else  if (argv[i].endsWith("%")) {

acc_percent =  parseFloat(argv[i]);

}

  

else  if (argv[i].endsWith("x")) {

combo =  parseInt(argv[i]);

}

  

else  if (argv[i].endsWith("m")) {

nmiss =  parseInt(argv[i]);

}

}

  

var parser =  new  osu.parser();

readline.createInterface({

input: process.stdin, terminal: false

})

.on("line", parser.feed_line.bind(parser))

.on("close", function() {

var map = parser.map;

console.log(map.toString());

  

if (mods) {

console.log("+"  + osu.modbits.string(mods));

}

  

var stars =  new  osu.diff().calc({map: map, mods: mods});

console.log(stars.toString());

  

var pp = osu.ppv2({

stars: stars,

combo: combo,

nmiss: nmiss,

acc_percent: acc_percent,

});

  

var max_combo = map.max_combo();

combo = combo || max_combo;

  

console.log(pp.computed_accuracy.toString());

console.log(combo +  "/"  + max_combo +  "x");

  

console.log(pp.toString());

});
$ curl https://osu.ppy.sh/osu/67079 | node example.js

TERRA - Tenjou no Hoshi ~Reimeiki~ [BMax] mapped by ouranhshc

  

AR5 OD8 CS4 HP8

262 circles, 69 sliders, 5 spinners

469 max combo

  

4.33 stars (2.09 aim, 2.19 speed)

100.00% 0x100 0x50 0xmiss

469/469x

133.24 pp (36.23 aim, 40.61 speed, 54.42 acc)

  

$ curl https://osu.ppy.sh/osu/67079 \

| node example.js +HDDT 98% 400x 1m

...

+HDDT

6.13 stars (2.92 aim, 3.11 speed)

97.92% 9x100 0x50 1xmiss

400/469x

266.01 pp (99.70 aim, 101.68 speed, 60.41 acc)
1.0.1

5 years ago

1.0.0

5 years ago