'Login server:
'
'@ Clients Server Open
'G:00 Kron1x (0x00000003) 85.146.48.175, Ver:1753 ALLOW_ALL H:23/17
'Conneted Agent : 1 / Total User : 40
'Auth server
'@ Limit Players : 0
'@ Client Open
'
'Client Version : 1602, CheckSum : 0x414CA637
'PatchAddress : 127.0.0.1
' Human: 0, Akhan: 0, Total: 0
' DBAgent:
'Ver:1602 / Checksum:0x3a7170cd / PattchAddress:127.0.0.1
'Connected LoginServer ( 127.0.0.1: 12002)
'Connected UIDServer ( 127.0.0.1: 12001)
'Connected AuthServer ( 127.0.0.1: 2880) : Connected User(0)
'Connected ChatServer ( 127.0.0.1: 2887)
'(Z:08 C:00) GameServer(0x08000002: 127.0.0.1) CharNum:0
'(Z:12 C:00) GameServer(0x0c000002: 127.0.0.1) CharNum:0
'(Z:14 C:00) GameServer(0x0e000502: 127.0.0.1) CharNum:0
'Session(USER:0/CHAR:0)
'StoreData(0/0) / CharacterData(0/0)
'Human:0/Akhan:0
'Current Total User Count : 0
Private Sub gotEHook_mess(ByVal sender As clsHook, ByVal mystring As String)
Dim rE As Boolean = False
Select Case sender.sItem.codeToOpenLog
Case &H87 'login
'Debug.WriteLine("E: " & " - " & mystring)
Dim ls As String() = arrayRemoveEmpty(mystring.Split(vbNewLine))
If ls.Length > 1 AndAlso ls(0).IndexOf("@ Clients Server") = 0 Then 'login server ryl2
If ls(0).IndexOf("Open") > 0 AndAlso Not serverInfo.LoginOpen Then
serverInfo.LoginOpen = True
rE = True
ElseIf ls(0).IndexOf("Closed") > 0 AndAlso serverInfo.LoginOpen Then
serverInfo.LoginOpen = False
rE = True
End If
'If ls(1).IndexOf(" H:") > 6 Then '6 becose then we dont catch the server name if it starts with H:
' Dim t As String() = Trim(ls(1).Substring(ls(1).IndexOf(" H:", 6) + " H:".Length)).Split("/")
' If t.Length = 2 Then
' If serverInfo.LoginHuman <> Val(t(0)) Then rE = True
' If serverInfo.LoginAkkan <> Val(t(1).Substring(1)) Then rE = True
' serverInfo.LoginHuman = Val(t(0))
' serverInfo.LoginAkkan = Val(t(1).Substring(1))
' End If
'End If
ElseIf ls.Length > 1 AndAlso ls(0).IndexOf("@ Clients Allow") = 0 Then 'login server ryl1
If ls(0).IndexOf("all") > 0 AndAlso Not serverInfo.LoginOpen Then
serverInfo.LoginOpen = True
rE = True
ElseIf (ls(0).IndexOf("Closed") > 0 OrElse ls(0).IndexOf("some") > 0) AndAlso serverInfo.LoginOpen Then
serverInfo.LoginOpen = False
rE = True
End If
End If
Dim la As String() = ls(UBound(ls)).Split("/")
If la.Length > 1 Then
For Each l As String In la
Dim lw As String() = l.Split(":")
If lw.Length = 2 Then
lw(0) = Trim(lw(0))
lw(1) = Val(Trim(lw(1)))
Select Case lw(0)
Case "Conneted Agent"
If serverInfo.LoginAgent <> lw(1) Then rE = True
serverInfo.LoginAgent = lw(1)
'Case "Total User"
' If serverInfo.LoginTotal <> lw(1) Then rE = True
' serverInfo.LoginTotal = lw(1)
End Select
End If
Next
End If
Case &H83 'UID
Case &H6F 'DBAgent ryl1
Dim ls As String() = arrayRemoveEmpty(mystring.Split(vbNewLine))
Dim mapZones As Integer() = serverInfo.LoginMapZones
Dim mapCount As Integer() = serverInfo.LoginMap
Dim foundMaps As Integer() = {}
For Each l As String In ls
'(Z:14 C:00) GameServer(0x0e000502: 127.0.0.1) CharNum:0
If l.IndexOf("GameServer") > 0 Then
Dim zone As Integer = Val(Trim(l.Substring(l.IndexOf("Z:") + 2, 2)))
Dim count As Integer = Val(Trim(l.Substring(l.IndexOf("Connected User :") + "Connected User :".Length)))
Dim index As Integer = Array.IndexOf(mapZones, zone)
ReDim Preserve foundMaps(UBound(foundMaps) + 1)
foundMaps(UBound(foundMaps)) = zone
If index < 0 Then
ReDim Preserve mapZones(UBound(mapZones) + 1)
ReDim Preserve mapCount(UBound(mapCount) + 1)
index = UBound(mapZones)
mapZones(index) = zone
serverInfo.LoginMapZones = mapZones
serverInfo.LoginMap = mapCount
End If
If serverInfo.LoginMap(index) <> count Then rE = True
serverInfo.LoginMap(index) = count
End If
Next
If foundMaps.Length < mapZones.Length Then
For i As Integer = 0 To mapZones.Length - 1
If Array.IndexOf(foundMaps, mapZones(i)) >= 0 Then
Else
mapCount(i) = 0
End If
Next
rE = True
End If
Case &H9C4B 'DBAgent ryl2
Dim ls As String() = arrayRemoveEmpty(mystring.Split(vbNewLine))
Dim mapZones As Integer() = serverInfo.LoginMapZones
Dim mapCount As Integer() = serverInfo.LoginMap
Dim foundMaps As Integer() = {}
For Each l As String In ls
'(Z:14 C:00) GameServer(0x0e000502: 127.0.0.1) CharNum:0
If l.IndexOf("GameServer") > 0 Then
Dim zone As Integer = Val(Trim(l.Substring(l.IndexOf("Z:") + 2, 2)))
Dim count As Integer = Val(Trim(l.Substring(l.IndexOf("CharNum:") + "CharNum:".Length)))
Dim index As Integer = Array.IndexOf(mapZones, zone)
ReDim Preserve foundMaps(UBound(foundMaps) + 1)
foundMaps(UBound(foundMaps)) = zone
If index < 0 Then
ReDim Preserve mapZones(UBound(mapZones) + 1)
ReDim Preserve mapCount(UBound(mapCount) + 1)
index = UBound(mapZones)
mapZones(index) = zone
serverInfo.LoginMapZones = mapZones
serverInfo.LoginMap = mapCount
End If
If serverInfo.LoginMap(index) <> count Then rE = True
serverInfo.LoginMap(index) = count
End If
Next
If foundMaps.Length < mapZones.Length Then
'Dim nZ As Integer() = {}
'Dim nC As Integer() = {}
For i As Integer = 0 To mapZones.Length - 1
If Array.IndexOf(foundMaps, mapZones(i)) >= 0 Then
'ReDim Preserve nZ(UBound(nZ) + 1)
'ReDim Preserve nC(UBound(nC) + 1)
'nZ(UBound(nZ)) = mapZones(i)
'nC(UBound(nC)) = mapCount(i)
Else
mapCount(i) = 0
End If
Next
rE = True
'serverInfo.LoginMapZones = nZ
'serverInfo.LoginMap = nC
End If
Case &H6D 'auth
Dim ls As String() = arrayRemoveEmpty(mystring.Split(vbNewLine))
If ls.Length > 0 Then
Dim l As String = ls(UBound(ls))
If l.Length > 0 AndAlso l.IndexOf(",") > 0 Then
Dim la As String() = l.Split(",")
If la.Length = 3 Then
For Each s As String In la
If s.IndexOf(":") > 0 Then
Dim sa As String() = s.Split(":")
Dim k As String = Trim(sa(0))
Dim v As Integer = Val(Trim(sa(1)))
Select Case k
Case "Human"
If serverInfo.LoginHuman <> v Then rE = True
serverInfo.LoginHuman = v
Case "Akhan"
If serverInfo.LoginAkkan <> v Then rE = True
serverInfo.LoginAkkan = v
Case "Total"
If serverInfo.LoginTotal <> v Then rE = True
serverInfo.LoginTotal = v
End Select
End If
Next
End If
End If
End If
Case &H6C 'chat
Case &H77 'game
End Select
If rE Then
RaiseEvent ServInfoChanged(serverInfo)
End If
End Sub