Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- This is the actual (obfuscated) code that calculates the level requirements in runescape:
- //int i1 = 0;
- //for (int i2 = 0; (i2 ^ 0xFFFFFFFF) > -121; ++i2)
- //{
- // int i3 = 1 + i2;
- // int i4 = (int)(i3 + Math.pow(2.0D, i3 / 7.0D) * 300.0D);
- // i1 += i4;
- // a[i2] = (i1 / 4);
- //}
- a[] is an array of integers with the size 99 so that contains the field containing the requirements.
- If you know how bitwise operators and doubles/integers work you can change it to this method without affecting the result:
- //int totalXPIndicator = 0;
- //for (int level = 0; level < 120; level++) {
- // totalXPIndicator += (int)(1 + level + Math.pow(2D, (1 + level) / 7D) * 300D);
- // levelXPArray[i2] = (totalXPIndicator / 4);
- //}
- Now to change it in an working method:
- public int xpTable(final int level) {
- int totalXPIndicator = 0;
- for (int level2 = 1; level2 < level; level2++) {
- totalXPIndicator += (int) (level2 + Math.pow(2D, level2 / 7D) * 300D);
- }
- return totalXPIndicator / 4;
- }
Advertisement
Add Comment
Please, Sign In to add comment