Public Function Experience(ByVal Lvl As Integer) As Double
Dim a As Long
Dim x As Long
For x = 1 To Lvl - 1
a = a + Int(x + 300 * (2 ^ (x / 7)))
Next
Experience = Int(a / 4)
End Function
Public Function ExperienceToGoalLvl(ByVal YourXP As Double, GoalLvl As Integer) As Double
ExperienceToGoalLvl = Experience(GoalLvl) - YourXP
End Function
Public Function Level(ByVal XP As Double) As Integer
Dim A As Integer, i As Long
If XP >= Experience(99) Then
Level = 99
Exit Function
End If
For i = 1 To 98
If XP < Experience(i) Then
Level = i - 1
Exit Function
End If
Next
End Function
Public Function CombatLvl(atk As Double, def As Double, str As Double, hits As Double, rng As Double, mag As Double, pry As Double) As Double 'Not 100% accurate
Dim atkstr As Double, defhitspry As Double
atkstr = atk + str
defhitspry = ((def + hits) / 4) + (pry / 8)
If atkstr < mag * 1.5 And rng <= mag Then
CombatLvl = (mag * 0.4875) + defhitspry
ElseIf atkstr < rng * 1.5 And rng > mag Then
CombatLvl = (rng * 0.4875) + defhitspry
Else
CombatLvl = (atkstr * 0.325) + defhitspry
End If
End Function
Private Function CalcGames(XP As Double, GoalLvl As Integer) As Long 'For Pest Control Minigame
Dim X As Long, Y As Long
X = XP
Y = 0
Do Until X >= Experience(GoalLvl)
X = X + Int((ExperienceToGoalLvl(X) ^ 2) / 6)
Y = Y + 1
Loop
CalcGames = Y
End Function