Raised This Month: $62 Target: $400
 15% 

How can I get the level by given experience?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Richzer
New Member
Join Date: Jun 2019
Old 06-05-2019 , 10:47   How can I get the level by given experience?
Reply With Quote #1

PHP Code:
const levels 40;
const 
xp_for_first_level 1000;
const 
xp_for_last_level 1000000;

const 
getExperience level => {
  const 
Math.log(xp_for_last_level xp_for_first_level) / (levels 1);
  const 
xp_for_first_level / (Math.exp(B) - 1.0);

  const 
old_xp Math.round(Math.exp(* (level 1)));
  const 
new_xp Math.round(Math.exp(level));

  return 
new_xp old_xp;
};

const 
getLevel experience => {
  const 
Math.log(xp_for_last_level xp_for_first_level) / (levels 1);
  const 
xp_for_first_level / (Math.exp(B) - 1.0);

  return 
Math.ceil(Math.log(experience A) / B);
};

console.log(getLevel(xp_for_first_level)); // -9
console.log(getLevel(xp_for_last_level)); // 30 
Expected result 1 and 40, but returns -9 and 30.

Can anyone help?

Last edited by DarkDeviL; 06-08-2019 at 08:59. Reason: Restore to previous version.
Richzer is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:02.


Powered by vBulletin®
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Theme made by Freecode