Advertisement
Fabianegg

Untitled

May 31st, 2018
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. // ==UserScript==
  2. // @name exp
  3. // @namespace http://asylum.margonem.pl/
  4. // @version 0.1
  5. // @author You
  6. // @match http://asylum.margonem.pl
  7. // @grant none
  8. // ==/UserScript==
  9.  
  10. (function() {
  11. ((_) => {
  12. _.required = _.calc(Engine.hero.d.lvl);
  13. _.proccessUpdate = function(e) {
  14. var diffExp = e.d.exp - _.lastExp, diffLvl = e.d.lvl - _.lastLvl;
  15. if (diffExp > 0) {
  16. let percentExp = e.d.ttl < 0 ? 0 : Math.round(diffExp * 10000 / _.required) / 100;
  17. message('+' + diffExp + ' (' + percentExp + '%)');
  18. _.lastExp = e.d.exp;
  19. }
  20. if (diffLvl > 0) {
  21. _.lastLvl = e.d.lvl;
  22. _.required = _.calc(e.d.lvl);
  23. }
  24. };
  25. API.addCallbackToEvent('heroUpdate', _.proccessUpdate);
  26. })({
  27. lastExp: Engine.hero.d.exp,
  28. lastLvl: Engine.hero.d.lvl,
  29. required: null,
  30. calc: (a) => Math.pow(a, 4) - Math.pow(a - 1, 4)
  31. });
  32. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement