3 things. This method needs some sort of comment explaining what it does, and the forms of the arguments it takes.
This method needs tests.
I would recommend breaking this up into a second method that gets the xp curve. It will be easier to test that way too.