Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Public Sub HandleRecuperarPersonaje(ByVal UserIndex As Integer)
  2.  
  3. On Error GoTo ErrHandler
  4.  
  5.     With UserList(UserIndex)
  6.    
  7.         Dim email, NewPassword, Nick, Pin As String
  8.    
  9.         Dim buffer As clsByteQueue: Set buffer = New clsByteQueue
  10.         Call buffer.CopyBuffer(UserList(UserIndex).incomingData)
  11.    
  12.         buffer.ReadByte
  13.    
  14.         Nick = buffer.ReadASCIIString
  15.         email = buffer.ReadASCIIString
  16.         Pin = buffer.ReadASCIIString
  17.         NewPassword = buffer.ReadASCIIString
  18.        
  19.         If Not AsciiValidos(Nick) Then
  20.             Call WriteErrorMsg(UserIndex, "Nombre inválido.")
  21.             Call FlushBuffer(UserIndex)
  22.             Call CloseSocket(UserIndex)
  23.            
  24.             Exit Sub
  25.         End If
  26.        
  27.         If Not PersonajeExiste(Nick) Then
  28.             Call WriteErrorMsg(UserIndex, "El personaje no existe.")
  29.             Call FlushBuffer(UserIndex)
  30.             Call CloseSocket(UserIndex)
  31.            
  32.             Exit Sub
  33.         End If
  34.    
  35.         If BANCheck(Nick) Then
  36.             Call WriteErrorMsg(UserIndex, "Se te ha prohibido la entrada al juego debido a tu mal comportamiento. Puedes consultar el reglamento y el sistema de soporte.")
  37.             Call UserList(UserIndex).incomingData.CopyBuffer(buffer)
  38.             Call FlushBuffer(UserIndex)
  39.             Call CloseSocket(UserIndex)
  40.            
  41.             Exit Sub
  42.         End If
  43.        
  44.         Dim EmailTrue, PinTrue As String
  45.         Dim ReadDat As clsIniManager
  46.        
  47.         Set ReadDat = New clsIniManager
  48.        
  49.         ReadDat.Initialize CharPath & UCase$(Nick) & ".chr"
  50.        
  51.         EmailTrue = ReadDat.GetValue("CONTACTO", "EMAIL") 'GetVar(UCase$(Nick) & ".chr", "CONTACTO", "EMAIL")
  52.        PinTrue = ReadDat.GetValue("INIT", "PIN")
  53.        
  54.         If Pin = PinTrue And email = EmailTrue Then
  55.             'Call ReadDat.ChangeValue("INIT", "PASSWORD", str$(NewPassword))
  56.            Call ReadDat.ChangeValue(CharPath & UCase$(Nick) & ".chr", "INIT", "PASSWORD", NewPassword)
  57.             Call ReadDat.DumpFile(CharPath & UCase$(Nick) & ".chr")
  58.             Call WriteErrorMsg(UserIndex, "El personaje ha sido recuperado con exito.")
  59.             Else
  60.                
  61.                 If Not Pin = PinTrue Then
  62.                     WriteErrorMsg UserIndex, "El pin es incorrecto."
  63.                 End If
  64.            
  65.                 If Not email = EmailTrue Then
  66.                     WriteErrorMsg UserIndex, "El email es incorrecto."
  67.                 End If
  68.         End If
  69.        
  70.         'Call CloseSocket(UserIndex)
  71.        
  72.         Call UserList(UserIndex).incomingData.CopyBuffer(buffer)
  73.        
  74. ErrHandler:
  75.     Dim error As Long
  76.     error = Err.Number
  77. On Error GoTo 0
  78.    
  79.     'Destroy auxiliar buffer
  80.    Set buffer = Nothing
  81.    
  82.     If error <> 0 Then _
  83.         Err.Raise error
  84.        
  85.     End With
  86. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement