tips48 Posted December 31, 2012 Share Posted December 31, 2012 Couple of questions:- Is there a forumla to get the xp needed for a level or do I have to hardcode it in a List?- Is there any easy way of getting all the ways to gain xp or is that something I have to do myself? I'm using Java but if you post in PHP I *should* be able to figure it out. Thanks!- Tips Link to comment Share on other sites More sharing options...
Stev Posted December 31, 2012 Share Posted December 31, 2012 Edit: When I'm on my desktop I'll write it in Java if you need. I have functions writting for them in C++ and AHK_L. >.<<?php function experience($L) { $a=0; for($x=1; $x<$L; $x++) { $a += floor($x+300*pow(2, ($x/7))); } return floor($a/4); } for($L=1;$L<100;$L++) { echo 'Level '.$L.': '.experience($L).'<br />'; } ?> Link to comment Share on other sites More sharing options...
RSBDavid Posted December 31, 2012 Share Posted December 31, 2012 I found an experience formula here. <?php function experience($L) { $a=0; for($x=1; $x<$L; $x++) { $a += floor($x+300*pow(2, ($x/7))); } return floor($a/4); } for($L=1;$L<100;$L++) { echo 'Level '.$L.': '.experience($L).'<br />'; } ?> After translating it to Java myself, I found it is not 100% accurate, but close. I did some Googling around and found out pretty much every site uses the same formula. I think around level 101 is where it needs to be decreased by 1. Of course, unless the XP table on tip.it is wrong. It says "104,273,166" for 120 where the formula ends up being "104,273,167". As far as your second question, it would be difficult to get all possible training ways. You could just find the popular ones by navigating forums and double checking the methods they post and then leaving a form field in your calculator for a user to input custom rates. [software Engineer] - [Ability Bar Suggestion] - [Gaming Enthusiast] Link to comment Share on other sites More sharing options...
Hedgehog Posted December 31, 2012 Share Posted December 31, 2012 I'm not sure if doing that many loops every time you need the xp of a level is efficient. I'd rather just store it in an array then reference that as necessary. <?php $level = array("",0,83,174,276,388,512,650,801,969,1154,1358,1584,1833,2107,2411,2746,3115,3523,3973,4470,5018,5624,6291,7028,7842,8740,9730,10824,12031,13363,14833,16456,18247,20224,22406,24815,27473,30408,33648,37224,41171,45529,50339,55649,61512,67983,75127,83014,91721,101333,111945,123660,136594,150872,166636,184040,203254,224466,247886,273742,302288,333804,368599,407015,449428,496254,547953,605032,668051,737627,814445,899257,992895,1096278,1210421,1336443,1475581,1629200,1798808,1986068,2192818,2421087,2673114,2951373,3258594,3597792,3972294,4385776,4842295,5346332,5902831,6517253,7195629,7944614,8771558,9684577,10692629,11805606,13034431,14391160,15889109,17542976,19368992,21385073,23611006,26068632,28782069,31777943,35085654,38737661,42769801,47221641,52136869,57563718,63555443,70170840,77474828,85539082,94442737,104273167); echo $level[120]; ?> Link to comment Share on other sites More sharing options...
Stev Posted December 31, 2012 Share Posted December 31, 2012 Well it would depend on his program. Looping 120 times shouldn't even be noticable. :P. Link to comment Share on other sites More sharing options...
Hedgehog Posted December 31, 2012 Share Posted December 31, 2012 An array would be faster, though, right? Link to comment Share on other sites More sharing options...
Stev Posted December 31, 2012 Share Posted December 31, 2012 If you're talking hundreds of thousands of searches, then it'll make a difference of a couple milliseconds. :P. Link to comment Share on other sites More sharing options...
tips48 Posted December 31, 2012 Author Share Posted December 31, 2012 I'm not sure if doing that many loops every time you need the xp of a level is efficient. I'd rather just store it in an array then reference that as necessary. <?php $level = array("",0,83,174,276,388,512,650,801,969,1154,1358,1584,1833,2107,2411,2746,3115,3523,3973,4470,5018,5624,6291,7028,7842,8740,9730,10824,12031,13363,14833,16456,18247,20224,22406,24815,27473,30408,33648,37224,41171,45529,50339,55649,61512,67983,75127,83014,91721,101333,111945,123660,136594,150872,166636,184040,203254,224466,247886,273742,302288,333804,368599,407015,449428,496254,547953,605032,668051,737627,814445,899257,992895,1096278,1210421,1336443,1475581,1629200,1798808,1986068,2192818,2421087,2673114,2951373,3258594,3597792,3972294,4385776,4842295,5346332,5902831,6517253,7195629,7944614,8771558,9684577,10692629,11805606,13034431,14391160,15889109,17542976,19368992,21385073,23611006,26068632,28782069,31777943,35085654,38737661,42769801,47221641,52136869,57563718,63555443,70170840,77474828,85539082,94442737,104273167); echo $level[120]; ?> Thanks, I'll probably just use this just because it's so easy.It's good to know the forumla though in case I ever need it, so thanks guys Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now