Server Side
Add this at the bottom of modServerTCP:
Code:
Sub SendTNL(ByVal index As Long)
Dim Packet As String
Packet = "PLAYERTNL" & SEP_CHAR & GetPlayerNextLevel(index) & SEP_CHAR & GetPlayerExp(index) & SEP_CHAR & END_CHAR
Call SendDataTo(index, Packet)
End Sub
Now, on all places that you find:
Code:
Call SendHP(index)
Call SendMP(index)
Add below:
Code:
Call SendSP(index)
Now, in modDatabase, add:
Code:
Sub LoadExps()
Dim FileName As String
Dim i As Long
Call CheckExps
FileName = App.Path & "\experience.ini"
For i = 1 To MAX_EXP
Experience(i) = GetVar(FileName, "EXPERIENCE", "Exp" & i)
DoEvents
Next i
End Sub
Sub CheckExps()
If Not FileExist("experience.ini") Then
Dim i As Long
For i = 1 To MAX_EXP
Call PutVar(App.Path & "\experience.ini", "EXPERIENCE", "Exp" & i, i * 1500)
Next i
End If
End Sub
Sub ClearExps()
Dim i As Long
For i = 1 To MAX_EXP
Experience(i) = 0
Next i
End Sub
Now at the top of modTypes, add:
Code:
Public Experience(1 To MAX_EXP) As Long
Now, replace:
Code:
Function GetPlayerNextLevel(ByVal Index As Long) As Long
GetPlayerNextLevel = (GetPlayerLevel(Index) + 1) * (GetPlayerSTR(Index) + GetPlayerDEF(Index) + GetPlayerMAGI(Index) + GetPlayerSPEED(Index) + GetPlayerPOINTS(Index)) * 25
End Function
with:
Code:
Function GetPlayerNextLevel(ByVal index As Long) As Long
GetPlayerNextLevel = Experience(GetPlayerLevel(index))
End Function
Client SideNow in modHandleData: add this:
Code:
' Player tnl packet
If LCase(Parse(0)) = "playertnl" Then
Player(MyIndex).MaxExp = Val(Parse$(1))
Player(MyIndex).Exp = Val(Parse$(2))
If GetPlayerMaxExp(MyIndex) > 0 Then
If GetPlayerExp(MyIndex) > 0 Then
frmMirage.lblEXP.Caption = GetPlayerExp(MyIndex) & "/" & GetPlayerMaxExp(MyIndex)
frmMirage.shpTNL.Width = (((GetPlayerExp(MyIndex) / 2000) / (GetPlayerMaxExp(MyIndex) / 2000)) * 2000)
End If
End If
Exit Sub
Now add a picture box in frmMirage:
Code:
width = 2000
Height = 135
And make the picture box's BackColor the color you want the exp bar, or load a image to it.
Below:
Code:
Sub SetPlayerExp(ByVal Index As Long, ByVal Exp As Long)
Player(Index).Exp = Exp
End Sub
Add:
Code:
Sub SetPlayerMaxExp(ByVal Index As Long, ByVal MaxExp As Long)
Player(Index).MaxExp = MaxExp
End Sub
Function GetPlayerMaxExp(ByVal Index As Long) As Long
GetPlayerMaxExp = Player(Index).MaxExp
End Function
Now below:
Code:
MaxSP As Long
in Type PlayerRec, add:
Code:
MaxExp As Long
Now add a ini filed name: experience.ini in the server folder, and add the following:
Code:
[EXPERIENCE]
Exp1=1500
Exp2=3000
Exp3=4500
Exp4=6000
Exp5=7500
etc. to your max level.
Now below:
Code:
Public Const MAX_SPELLS = 50
add:
Code:
Public Const MAX_EXP = 200