GS-Zone

Sistema de Duelos (1 vs 1) Ir al Indice

Moderadores: Moderadores de Argentum, Especialistas de Argentum, Especialistas de Programación

3

Nota » 21 Sep 2011 15:31

Bueno lo hice para un servidor, que no creo que use asique lo libero.

Cliente:

Buscamos:
  1. Online                  '/ONLINE


Abajo ponemos:
  1. SendDuelo               '/DUELO
  2.     BackDuelo               '/SALIRDUELO


Buscamos:
  1. ''
  2. ' Writes the "GuildRequestDetails" message to the outgoing data buffer.
  3. '
  4. ' @param    guild The guild whose details are requested.
  5. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6.  
  7. Public Sub WriteGuildRequestDetails(ByVal guild As String)
  8. '***************************************************
  9. 'Autor: Juan Martín Sotuyo Dodero (Maraxus)
  10. 'Last Modification: 05/17/06
  11. 'Writes the "GuildRequestDetails" message to the outgoing data buffer
  12. '***************************************************
  13.     With outgoingData
  14.         Call .WriteByte(ClientPacketID.GuildRequestDetails)
  15.        
  16.         Call .WriteASCIIString(guild)
  17.     End With
  18. End Sub


Abajo ponemos:
  1. ''
  2. ' Writes the "BackDuelo" message to the outgoing data buffer.
  3. '
  4. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  5.  
  6. Public Sub WriteBackDuelo()
  7. '***************************************************
  8. 'Autor: Martín Gomez (Samke)
  9. 'Last Modification: 23/08/2011
  10. 'Writes the "BackDuelo" message to the outgoing data buffer
  11. '***************************************************
  12.     Call outgoingData.WriteByte(ClientPacketID.BackDuelo)
  13. End Sub
  14.  
  15. ''
  16. ' Writes the "SendDuelo" message to the outgoing data buffer.
  17. '
  18. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  19.  
  20. Public Sub WriteSendDuelo()
  21. '***************************************************
  22. 'Autor: Martín Gomez (Samke)
  23. 'Last Modification: 23/08/2011
  24. 'Writes the "SendDuelo" message to the outgoing data buffer
  25. '***************************************************
  26.     Call outgoingData.WriteByte(ClientPacketID.SendDuelo)
  27. End Sub


Buscamos:
  1. Case "/SEGUIR"
  2.                 Call WriteNPCFollow


Abajo ponemos:
  1. Case "/DUELO"
  2.                 Call WriteSendDuelo
  3.                
  4.             Case "/SALIRDUELO"
  5.                 Call WriteBackDuelo


Servidor:

Buscamos:


Abajo ponemos:
  1. Public Duelo As tDuelo
  2.  
  3. Public Type tDuelo
  4.     UsUaRiOs As Byte
  5.     EnDuelo As Byte
  6. End Type


Buscamos:
  1. '<< Actualizamos clientes >>
  2.     Call ChangeUserChar(UserIndex, UserList(UserIndex).Char.body, UserList(UserIndex).Char.Head, UserList(UserIndex).Char.heading, NingunArma, NingunEscudo, NingunCasco)
  3.     Call WriteUpdateUserStats(UserIndex)


Abajo ponemos:
  1. ' Sacamos usuario del Duelo cuando muere
  2.     If Duelo.EnDuelo = 1 Then
  3.         Duelo.EnDuelo = 0
  4.         Duelo.UsUaRiOs = Duelo.UsUaRiOs - 1
  5.         Call WarpUserChar(UserIndex, 1, 51, 46, True)
  6.         Call SendData(SendTarget.ToAll, 0, PrepareMessageConsoleMsg("Servidor> " & UserList(UserIndex).name & " a muerto en duelo. Quien quiera ingresar /Duelo.", FontTypeNames.FONTTYPE_INFOBOLD))
  7.     End If


Buscamos:
  1. ' Si el usuario habia dejado un msg en la gm's queue lo borramos
  2. If Ayuda.Existe(UserList(UserIndex).name) Then Call Ayuda.Quitar(UserList(UserIndex).name)


Abajo ponemos:
  1. ' Sacamos usuario del Duelo si se desonecta
  2. If Duelo.EnDuelo = 1 Then
  3.     Duelo.EnDuelo = 0
  4.     Duelo.UsUaRiOs = Duelo.UsUaRiOs - 1
  5.     Call WarpUserChar(UserIndex, 1, 51, 46, True)
  6.     Call SendData(SendTarget.ToAll, 0, PrepareMessageConsoleMsg("Servidor> " & UserList(UserIndex).name & " se desconecto en duelo. Quien quiera ingresar /Duelo.", FontTypeNames.FONTTYPE_INFOBOLD))
  7. End If


Buscamos:
  1. Online                  '/ONLINE


Abajo ponemos:
  1. SendDuelo               '/DUELO
  2.     BackDuelo               '/SALIRDUELO


Buscamos:
  1. Case ClientPacketID.NPCFollow               '/SEGUIR
  2.             Call HandleNPCFollow(UserIndex)


Abajo ponemos:
  1. Case ClientPacketID.SendDuelo               '/DUELO
  2.             Call HandleSendDuelo(UserIndex)
  3.            
  4.         Case ClientPacketID.BackDuelo               '/SALIRDUELO
  5.             Call HandleBackDuelo(UserIndex)


Buscamos:
  1. ''
  2. ' Handles the "Online" message.
  3. '
  4. ' @param    userIndex The index of the user sending the message.
  5.  
  6. Private Sub HandleOnline(ByVal UserIndex As Integer)
  7. '***************************************************
  8. 'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9. 'Last Modification: 05/17/06
  10. '
  11. '***************************************************
  12.     Dim i As Long
  13.     Dim Count As Long
  14.    
  15.     With UserList(UserIndex)
  16.         'Remove packet ID
  17.         Call .incomingData.ReadByte
  18.        
  19.         For i = 1 To LastUser
  20.             If LenB(UserList(i).name) <> 0 Then
  21.                 If UserList(i).flags.Privilegios And (PlayerType.User Or PlayerType.Consejero) Then _
  22.                     Count = Count + 1
  23.             End If
  24.         Next i
  25.        
  26.         Call WriteConsoleMsg(UserIndex, "Número de usuarios: " & CStr(Count), FontTypeNames.FONTTYPE_INFO)
  27.     End With
  28. End Sub


Abajo ponemos:
  1. ''
  2. ' Handles the "BackDuelo" message.
  3. '
  4. ' @param    userIndex The index of the user sending the message.
  5.  
  6. Private Sub HandleBackDuelo(ByVal UserIndex As Integer)
  7. '***************************************************
  8. 'Author: Martín Gomez (Samke)
  9. 'Last Modification: 23/08/2011
  10. '***************************************************
  11.  
  12.     With UserList(UserIndex)
  13.         'Remove packet ID
  14.         Call .incomingData.ReadByte
  15.        
  16.         If Duelo.EnDuelo = 1 Then
  17.             Duelo.UsUaRiOs = Duelo.UsUaRiOs - 1
  18.             Duelo.EnDuelo = 0
  19.             Call WarpUserChar(UserIndex, 1, 51, 46, True)
  20.             Call SendData(SendTarget.ToAll, 0, PrepareMessageConsoleMsg("Servidor> " & UserList(UserIndex).name & " a abandonado la sala de duelos. Quien quiera ingresar /Duelo.", FontTypeNames.FONTTYPE_INFOBOLD))
  21.         End If
  22.    
  23.     End With
  24. End Sub
  25.  
  26. ''
  27. ' Handles the "SendDuelo" message.
  28. '
  29. ' @param    userIndex The index of the user sending the message.
  30.  
  31. Private Sub HandleSendDuelo(ByVal UserIndex As Integer)
  32. '***************************************************
  33. 'Author: Martín Gomez (Samke)
  34. 'Last Modification: 23/08/2011
  35. '***************************************************
  36.  
  37.     With UserList(UserIndex)
  38.         'Remove packet ID
  39.         Call .incomingData.ReadByte
  40.            
  41.             If UserList(UserIndex).flags.Muerto Then
  42.                 Call WriteConsoleMsg(UserIndex, "Servidor> No puedes ingresar al torneo si estas muerto.", FontTypeNames.FONTTYPE_INFOBOLD)
  43.                 Exit Sub
  44.             End If
  45.            
  46.             If UserList(UserIndex).Counters.Pena >= 1 Then
  47.                 Call WriteConsoleMsg(UserIndex, "Servidor> No puedes ingresar al torneo si estas en la carcel.", FontTypeNames.FONTTYPE_INFOBOLD)
  48.                 Exit Sub
  49.             End If
  50.            
  51.             If Duelo.UsUaRiOs < 2 Then ' Cupos
  52.                 Duelo.UsUaRiOs = Duelo.UsUaRiOs + 1
  53.                 Duelo.EnDuelo = 1
  54.                 Call WarpUserChar(UserIndex, 1, 74, 30, True)
  55.                 Call WriteConsoleMsg(UserIndex, "Servidor> Has ingresado al duelo.", FontTypeNames.FONTTYPE_INFOBOLD)
  56.                 Call SendData(SendTarget.ToAll, 0, PrepareMessageConsoleMsg("Servidor> " & UserList(UserIndex).name & " a entrado a la sala de duelos. ¡Buena suerte!", FontTypeNames.FONTTYPE_INFOBOLD))
  57.             Else
  58.                 Call WriteConsoleMsg(UserIndex, "Servidor> La sala de duelo esta ocupada.", FontTypeNames.FONTTYPE_INFOBOLD)
  59.             End If
  60.                
  61.     End With
  62. End Sub


Comandos:


Saludos ^^

Imagen
Imagen
Staff Zeiked-Games
646
Dragon Ancestral [3]
Registrado: Años de membresíaAños de membresía
Ubicación: Castelar
Mensajes: 3416
Aportes: 66
Premios: 3
Usuario omnipresente (1) Embajador (2)

Nota » 21 Sep 2011 15:38

Excelente aporte , está más completo que el de 13.0 :P

Llegué aquí con un solo propósito.


Imagen
- Shak -
Aprendiz [1]
Registrado: Septiembre 2011
Mensajes: 207
Aportes: 4

Nota » 22 Sep 2011 01:37

Mmmmmm....
No me gusta...
Estaria bueno que cuando haya 2 usuarios, los 2 users que estan en el duelo vayan a esquinas...
Porque con este codigo entra un usuario, y lo espera al otro ni bien entra lo lanea y gana xD.

Usuario Registrado
132
Aprendiz [7]
Registrado: Años de membresíaAños de membresíaAños de membresíaAños de membresía
Mensajes: 492
Aportes: 11


Volver a AO 0.12.x

¿Quién está conectado?

Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 0 invitados