Jump to content

exp until level up


Joseph

Recommended Posts

Some old code

package com.overlord.api;
 
/**
 * Created with IntelliJ IDEA.
 * User: Rawr/dog_
 * Date: 13/11/13
 * Time: 21:06
 * To change this template use File | Settings | File Templates.
 */
 
public final class Experience {
 
    /**
     * @param from
     * @param to
     * @return experience between from and to
     */
    public static final int getExpBetween(final int from, final int to) {
        int dog = 0;
        for (int i = 0; i < to - from; i++) {
            dog += (Math.floor(i + from + 300.0 * Math.pow(2.0, (i + from) / 7.0)) / 4.0);
        }
        return dog;
    }
 
    /**
     * @param lvl
     * @return the experience at lvl
     */
    public static final int getExpAt(final int lvl) {
        return getExpBetween(1, lvl);
    }
}
then just do getExpAt(currentLevel + 1) - currentExp

ea952e09956553f6b777c4fdde8165c2.png

Or you could just use an exp table

Edited by Rawr
Link to comment
Share on other sites

Some old code

package com.overlord.api;
 
/**
 * Created with IntelliJ IDEA.
 * User: Rawr/dog_
 * Date: 13/11/13
 * Time: 21:06
 * To change this template use File | Settings | File Templates.
 */
 
public final class Experience {
 
    /**
     * @param from
     * @param to
     * @return experience between from and to
     */
    public static final int getExpBetween(final int from, final int to) {
        int dog = 0;
        for (int i = 0; i < to - from; i++) {
            dog += (Math.floor(i + from + 300.0 * Math.pow(2.0, (i + from) / 7.0)) / 4.0);
        }
        return dog;
    }
 
    /**
     * @param lvl
     * @return the experience at lvl
     */
    public static final int getExpAt(final int lvl) {
        return getExpBetween(1, lvl);
    }
}
then just do getExpAt(currentLevel + 1) - currentExp

ea952e09956553f6b777c4fdde8165c2.png

Or you could just use an exp table

 

 

dog? lel :troll:

Also, thanks for the snippet will integrate when i get round to it.

Appreciate it! c:

Link to comment
Share on other sites

I don't have a snippet but i'd assume you create an array with the level ups and subtract the current exp from those?

Would also love to see this snippet as Its something I'd like to incorporate into my scripts if that is possible

All help would be appreciated guys!

Can you give me the array

Link to comment
Share on other sites

Can you give me the array

    public static final int[] EXP_TABLE = {
            0, 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};
  • Like 3
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...