Advertisement
Guest User

Untitled

a guest
Apr 28th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 2.86 KB | None | 0 0
  1. Public Class Form1
  2.     Dim currentXp As Integer
  3.     Dim newXp As Integer
  4.     Function convertXp(ByVal level As Int16)
  5.         Dim xP As Integer
  6.         If (level = 1) Then
  7.             Return 0
  8.         ElseIf (level = 2) Then
  9.             Return 83
  10.         Else
  11.             For value As Integer = 2 To level
  12.                 If (value = 2) Then
  13.                     xP = 83
  14.                 Else
  15.                     xP += ((value - 1 + 300 * 2 ^ ((value - 1) / 7)) / 4)
  16.                 End If
  17.             Next
  18.             Return xP
  19.         End If
  20.     End Function
  21.     Function convertLevel(ByVal xP As Integer)
  22.         Dim xP2 As Integer
  23.         If (xP < 83) Then
  24.             Return 1
  25.         ElseIf (xP < 174) Then
  26.             Return 2
  27.         Else
  28.             For value As Integer = 2 To 100
  29.                 If (value = 2) Then
  30.                     xP2 = 83
  31.                 Else
  32.                     xP2 += ((value - 1 + 300 * 2 ^ ((value - 1) / 7)) / 4)
  33.                     If (xP2 > xP Or value = 100) Then
  34.                         Return value - 1
  35.                     End If
  36.                 End If
  37.             Next
  38.             Return 0
  39.         End If
  40.     End Function
  41.     Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  42.         Try
  43.             If Int(TextBox1.Text) < 1 Or Int(TextBox1.Text) > 75 Or Int(TextBox2.Text) < 1 Or Int(TextBox2.Text) > 75 Then
  44.                 MsgBox("Invalid XP Rate")
  45.             ElseIf Int(TextBox3.Text) < 0 Or Int(TextBox3.Text) > 200000000 Then
  46.                 MsgBox("Invalid XP")
  47.             Else
  48.                 ''Label2.Text = (Int(TextBox1.Text) - 1 + 300 * 2 ^ ((Int(TextBox1.Text) - 1) / 7)) / 4
  49.                 currentXp = Int(TextBox3.Text)
  50.                 newXp = currentXp / Int(TextBox1.Text) * Int(TextBox2.Text)
  51.                 If (newXp > 200000000) Then
  52.                     newXp = 200000000
  53.                 End If
  54.                 ''Label2.Text = newXp
  55.                 Label2.Text = "New Level - " + Str(convertLevel(newXp))
  56.                 Label5.Text = "New XP - " + Str(newXp)
  57.             End If
  58.         Catch ex As System.InvalidCastException
  59.             MsgBox("Error: Textbox is blank!")
  60.         End Try
  61.     End Sub
  62.  
  63.     Private Sub LinkLabel1_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
  64.         Process.Start("https://indovaps.com/")
  65.     End Sub
  66.  
  67.     Private Sub LinkLabel2_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel2.LinkClicked
  68.         Process.Start("https://forum.indovaps.com/index.php?/profile/950-kevinf100/")
  69.     End Sub
  70.  
  71.     Private Sub LinkLabel3_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel3.LinkClicked
  72.         Process.Start("https://forum.indovaps.com/index.php?/topic/485-rate-change-calculator/")
  73.     End Sub
  74. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement