Guest User

Untitled

a guest
Jan 9th, 2020
610
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function XPH(running,stat) {
  2.   XPH.Stats = [ "Woodcutting","Fishing","Firemaking","Cooking","Mining","Smithing","Attack","Strength","Defence","Hitpoints","Thieving","Farming","Ranged","Fletching","Crafting","Runecrafting","Magic","Unknown" ]
  3.   if ((running == null) || (stat > 17) || (isNaN(running)) || (isNaN(stat))) {
  4.      for (var i=0; i<XPH.Stats.length; i++) {
  5.        console.log(i + ': ' + XPH.Stats[i]);
  6.      }
  7.      console.log('SYNTAX: XPH([1|0],[0-17])');
  8.      console.log('Example to Start/Check Strength XPH(1,7)');
  9.      console.log('Example to Stop Strength XPH(0,7)');
  10.  
  11.      return
  12.   }
  13.   else {
  14.     if (XPH.running) {
  15.  
  16.       XPH.rate = Math.floor((skillXP[stat] - XPH.exp) / ((Date.now() - XPH.time) / 1000) * 3600);
  17.  
  18.       XPH.rate = XPH.rate.toString();
  19.       var pattern = /(-?\d+)(\d{3})/;
  20.       while (pattern.test(XPH.rate))
  21.         XPH.rate = XPH.rate.replace(pattern, "$1,$2");
  22.  
  23.       console.log('Current xp/hr rate for ' + XPH.Stats[stat] + ': ' + XPH.rate + '/hr -- Test running for ' + ((Date.now() - XPH.time) / 1000) + ' seconds.');
  24.       if (!running) {
  25.         console.log('Stopping');
  26.         XPH.running = '';
  27.       }
  28.     }
  29.     else {
  30.       XPH.exp = skillXP[stat];
  31.       XPH.time = Date.now();
  32.       XPH.running = 1;
  33.  
  34.       console.log('Starting xp/hr monitoring for: ' + XPH.Stats[stat]);
  35.       console.log('Use XPH(1,' + stat + ') to view current exp/hr.');
  36.       console.log('Use XPH(0,' + stat + ') to stop.');
  37.     }
  38.   }
  39. }
RAW Paste Data