Advertisement
Guest User

Untitled

a guest
Sep 5th, 2017
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ''
  2. ' Handles the "LoginNewChar" message.
  3. '
  4. ' @param    userIndex The index of the user sending the message.
  5.  
  6. Private Sub HandleLoginNewChar(ByVal UserIndex As Integer)
  7.  
  8. '***************************************************
  9. 'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10. 'Last Modification: 05/17/06
  11. '
  12. '***************************************************
  13. 10  On Error GoTo HandleLoginNewChar_Error
  14.  
  15. 20  If UserList(UserIndex).incomingData.length < 18 Then
  16. 30      Err.Raise UserList(UserIndex).incomingData.NotEnoughDataErrCode
  17. 40      Exit Sub
  18. 50  End If
  19.  
  20.     'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  21.    Dim buffer As New clsByteQueue
  22. 60  Call buffer.CopyBuffer(UserList(UserIndex).incomingData)
  23.  
  24.     'Remove packet ID
  25. 70  Call buffer.ReadByte
  26.  
  27.     Dim UserName As String
  28.     Dim Password As String
  29.     Dim version As String
  30.     Dim race As eRaza
  31.     Dim gender As eGenero
  32.     Dim homeland As eCiudad
  33.     Dim Class As eClass
  34.     Dim Head As Integer
  35.     Dim mail As String
  36.     Dim Pin As String
  37.     Dim HD As String                '//Disco.
  38.    Dim MD5 As String
  39.  
  40. 80  If PuedeCrearPersonajes = 0 Then
  41. 90      Call WriteErrorMsg(UserIndex, "La creación de personajes en este servidor se ha deshabilitado.")
  42. 100     Call FlushBuffer(UserIndex)
  43. 110     Call CloseSocket(UserIndex)
  44. 120     Exit Sub
  45. 130 End If
  46.  
  47. 140 If ServerSoloGMs <> 0 Then
  48. 150     Call WriteErrorMsg(UserIndex, "Servidor restringido a administradores. Consulte la página oficial o el foro oficial para más información.")
  49. 160     Call FlushBuffer(UserIndex)
  50. 170     Call CloseSocket(UserIndex)
  51. 180     Exit Sub
  52. 190 End If
  53.  
  54. 200 If aClon.MaxPersonajes(UserList(UserIndex).HD) Then
  55. 210     Call WriteErrorMsg(UserIndex, "Has creado demasiados personajes.")
  56. 220     Call FlushBuffer(UserIndex)
  57. 230     Call CloseSocket(UserIndex)
  58. 240     Exit Sub
  59. 250 End If
  60.  
  61. 260 UserName = buffer.ReadASCIIString()
  62. 270 Password = buffer.ReadASCIIString()
  63.  
  64. 280 Pin = buffer.ReadASCIIString
  65.  
  66.     'Convert version number to string
  67. 290 version = CStr(buffer.ReadByte()) & "." & CStr(buffer.ReadByte()) & "." & CStr(buffer.ReadByte())
  68.  
  69. 300 race = buffer.ReadByte()
  70. 310 gender = buffer.ReadByte()
  71. 320 Class = buffer.ReadByte()
  72. 330 Head = buffer.ReadInteger
  73. 340 mail = buffer.ReadASCIIString()
  74. 350 homeland = buffer.ReadByte()
  75. 360 HD = buffer.ReadASCIIString()            '//Disco.
  76.  
  77. 370 MD5 = buffer.ReadASCIIStringFixed(16)
  78.  
  79. 380 If BuscarRegistroHD(HD) > 0 Then
  80. 390     Call WriteErrorMsg(UserIndex, MSG_BANTOTAL)
  81. 400     Call FlushBuffer(UserIndex)
  82. 410     Call CloseSocket(UserIndex)
  83. 420     Exit Sub
  84. 430 End If
  85.  
  86.     'If Not MD5ok(MD5) Then    '//Disco.
  87.    'Call WriteErrorMsg(UserIndex, "Cliente dañado.")
  88.    'Call FlushBuffer(UserIndex)
  89.    'Call CloseSocket(UserIndex)
  90.    'Exit Sub
  91.    'End If
  92.  
  93. 440 If Not VersionOK(version) Then
  94. 450     Call WriteErrorMsg(UserIndex, MSG_VERSION_OBSOLETA)
  95. 460 Else
  96. 470     Call ConnectNewUser(UserIndex, UserName, Password, race, gender, Class, mail, homeland, Head, Pin, HD)
  97. 480 End If
  98.  
  99.     'If we got here then packet is complete, copy data back to original queue
  100. 490 Call UserList(UserIndex).incomingData.CopyBuffer(buffer)
  101.  
  102.     Dim FullSKILLS As Integer
  103.  
  104. 500 For FullSKILLS = 1 To NUMSKILLS
  105. 510     UserList(UserIndex).Stats.UserSkills(FullSKILLS) = 100
  106. 520 Next
  107.  
  108. 530 Call WriteConsoleMsg(UserIndex, "Los skills de tu personaje fueron modificados a 100.", FontTypeNames.FONTTYPE_GUILD)
  109.  
  110. 540 On Error GoTo 0
  111. 550 Exit Sub
  112.  
  113. HandleLoginNewChar_Error:
  114.  
  115. 560 Call LogError("Error " & Err.Number & " (" & Err.description & ") in procedure HandleLoginNewChar, line " & Erl & ".")
  116.  
  117. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement