Staartvin / Autorank-2

Autorank is a Spigot/Bukkit plugin for automatically ranking players based on requirements
Other
56 stars 61 forks source link

JS Requirements #642

Closed CaszGamerMD closed 4 years ago

CaszGamerMD commented 6 years ago

one of the things i wanted to do was make it so cave/spiders counted as one. i just learned enough .JS so i can make a js script to do just that, would be nice if AR could allow JS to be a req:

var spiderCount = Number("%statz_mobs_killed_SPIDER%");
var spiderCaveCount = Number("%statz_mobs_killed_CAVE_SPIDER%");
var spiderTotalCount =  (spiderCount + spiderCaveCount);

function getSpiderProgress() {

return spiderTotalCount

};

getSpiderProgress();

then in AR it would be like:

  requirements:
    javascript: spider.js
      expression: ==
      value: 1000

then if between the 2 spider types if it totals 1000 req is met.

:D im proud i learned a thing . :D

CaszGamerMD commented 6 years ago

NOTE this was made for a stat in Deluxe Menu using papi, so i guess if something like this would work you would have to allow AR to pull from papi, idk if it already does. further note, i guess its already listening for statz placeholders right?

Ironic8b498 commented 6 years ago

function spiderTotalCount() {

var spiderCount = parseInt("%statz_mobs_killed_SPIDER%"); var spiderCaveCount = parseInt("%statz_mobs_killed_CAVE_SPIDER%"); spiderTotalCount = Math.abs(spiderCount + spiderCaveCount); return spiderTotalCount; };

spiderTotalCount();