Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Option Explicit
- '@@@ AUTOR: LUCIANO
- '@@@ EVENTO: DELEGADO
- Private Type tTeams
- UsersInTeam() As Integer
- WinPoints As Byte
- DeathTeam As Byte
- WinRounds As Byte
- Delegate_X As Byte
- Delegate_Y As Byte
- X As Byte
- Y As Byte
- End Type
- Private Type tUserEvent
- ID As Integer
- LastPosition As WorldPos
- End Type
- Private Type tEventDelegate
- Teams(1 To 2) As tTeams
- UsersEvent As Byte
- UserIndex() As tUserEvent
- EventDelegate As Boolean
- Points As Byte
- Rounds As Byte
- Requirement As Long
- Prize As Long
- Quotas As Byte
- Delegates(1 To 2) As Integer
- Level As Byte
- Countdown As Byte
- End Type
- Private Const MAP_EVENT As Integer = 1
- Private Const POS_DEATH_X As Byte = 60
- Private Const POS_DEATH_Y As Byte = 60
- Private EventDelegate As tEventDelegate
- Public Sub Load_Coordinates()
- '@@ Cargamos las coordenas de los equipos y la del delegado.
- With EventDelegate
- '@@ EQUIPOS:
- .Teams(1).X = 57
- .Teams(1).Y = 46
- .Teams(2).X = 59
- .Teams(2).Y = 46
- '@@ DELEGADOS:
- .Teams(1).Delegate_X = 61
- .Teams(1).Delegate_Y = 46
- .Teams(2).Delegate_X = 55
- .Teams(2).Delegate_Y = 46
- End With
- End Sub
- Public Sub Start_Event(ByVal UserIndex As Integer, _
- ByVal Quotas As Byte, _
- ByVal Prize As Long, _
- ByVal Requirement_Gold As Long, _
- ByVal Rounds As Byte, _
- ByVal Points As Byte, _
- ByVal Level As Byte)
- '@@ Inicio el evento.
- '@@ Paso requerimientos
- '@@ Compruebo si se puede armar torneo.
- '@@ Aviso por consola
- With EventDelegate
- If Can_Event(UserIndex) = False Then Exit Sub
- If Quotas < 2 Then Quotas = 2
- ReDim .Teams(1).UsersInTeam(1 To Quotas) As Integer
- ReDim .Teams(2).UsersInTeam(1 To Quotas) As Integer
- .Quotas = Quotas * 2
- .Prize = Prize
- .Points = Points
- .Requirement = Requirement_Gold
- .Rounds = Rounds
- .EventDelegate = True
- .Level = Level
- .UsersEvent = 0
- ReDim .UserIndex(1 To .Quotas) As tUserEvent
- Call SendData(SendTarget.ToAll, 0, PrepareMessageConsoleMsg("Evento Delegado> Iniciado", FontTypeNames.FONTTYPE_GUILD))
- End With
- End Sub
- Public Sub Enter_Event(ByVal UserIndex As Integer)
- '@@ Participan al evento
- '@@ Los llevo a la sala de espera
- '@@ Sumo la cantidad de usuarios en evento.
- '@@ Guardo la ID del usuario.
- '@@ Guardo la posición del usuario.
- '@@ Le saco el oro.
- If Can_EnterEvent(UserIndex) = False Then Exit Sub
- With EventDelegate
- .UsersEvent = .UsersEvent + 1
- .UserIndex(.UsersEvent).ID = UserIndex
- .UserIndex(.UsersEvent).LastPosition = UserList(UserIndex).Pos
- UserList(UserIndex).Stats.GLD = UserList(UserIndex).Stats.GLD - .Requirement
- Call Enter_Wait(UserIndex)
- Call WriteUpdateGold(UserIndex)
- If .UsersEvent = .Quotas Then _
- Call Enter_Fight
- End With
- End Sub
- Private Sub Enter_Fight()
- '@@ Aviso que se completa el cupo.
- '@@ Divido los participantes y pongo a cada uno en los equipos.
- '@@ Elijo los delegados al azar.
- '@@ Llevo a todos a la arena.
- '@@ Pongo los delegados en donde deben ir.
- '@@ Inicio la cuenta regresiva.
- '@@ Les aviso a que equipo pertenecen.
- Dim Blue As Long
- Dim Red As Long
- With EventDelegate
- Call SendData(SendTarget.ToAll, 0, PrepareMessageConsoleMsg("El cupo ha sido completado.", FontTypeNames.FONTTYPE_INFOBOLD))
- For Blue = 1 To .Quotas Step 2
- '@@ Mete los in pares al equipo azul
- .Teams(1).UsersInTeam(Blue) = .UserIndex(Blue).ID
- Call WriteConsoleMsg(.UserIndex(Blue).ID, "Ahora perteneces al equipo azul.", FontTypeNames.FONTTYPE_INFOBOLD)
- Call WarpUserChar(.UserIndex(Blue).ID, MAP_EVENT, .Teams(1).X, .Teams(1).Y, True)
- Next Blue
- For Red = 2 To .Quotas Step 2
- '@@ Los pares al rojo.
- .Teams(2).UsersInTeam(Red) = .UserIndex(Red).ID
- Call WriteConsoleMsg(.UserIndex(Red).ID, "Ahora perteneces al equipo rojo.", FontTypeNames.FONTTYPE_INFOBOLD)
- Call WarpUserChar(.UserIndex(Red).ID, MAP_EVENT, .Teams(2).X, .Teams(2).Y, True)
- Next Red
- '@@ Elige los delegados al azar.
- .Delegates(1) = .Teams(1).UsersInTeam(RandomNumber(1, UBound(.Teams(1).UsersInTeam)))
- .Delegates(2) = .Teams(2).UsersInTeam(RandomNumber(1, UBound(.Teams(2).UsersInTeam)))
- '@@ Le marco que es delegado.
- UserList(.Delegates(1)).flags.EventDelegate = 1
- UserList(.Delegates(2)).flags.EventDelegate = 1
- '@@ Llevamos a los delegados.
- Call WarpUserChar(.Delegates(1), MAP_EVENT, .Teams(1).Delegate_X, .Teams(1).Delegate_X, False)
- Call WarpUserChar(.Delegates(2), MAP_EVENT, .Teams(2).Delegate_X, .Teams(2).Delegate_X, False)
- '@@ Mensaje para los delegados.
- Call WriteConsoleMsg(.Delegates(1), "Eres delegado del equipo rojo.", FontTypeNames.FONTTYPE_INFOBOLD)
- Call WriteConsoleMsg(.Delegates(2), "Eres delegado del equipo azul.", FontTypeNames.FONTTYPE_INFOBOLD)
- '@@ Para iniciar la cuenta regresiva.
- .Countdown = 15
- End With
- End Sub
- Private Sub Enter_Wait(ByVal ID As Integer)
- '@@ Los mando a la sala de espera.
- '@@ Les marco que están en evento.
- Call WarpUserChar(ID, 1, 50, 50, True)
- UserList(ID).flags.EventDelegate = 1
- Call WriteConsoleMsg(ID, "Has ingresado al evento, eres el participante Nº" & EventDelegate.UsersEvent, FontTypeNames.FONTTYPE_INFOBOLD)
- End Sub
- Private Function Can_Event(ByVal ID As Integer) As Boolean
- '@@ Compruebo si se puede armar evento.
- Can_Event = False
- If Not EsGM(ID) Then
- Call WriteConsoleMsg(ID, "Tienes que ser GM para realizar el evento.", FontTypeNames.FONTTYPE_INFOBOLD)
- Exit Function
- End If
- With EventDelegate
- If .EventDelegate = True Then
- Call WriteConsoleMsg(ID, "Ya hay un torneo en curso. Espera a que ese termine.", FontTypeNames.FONTTYPE_INFOBOLD)
- Exit Function
- End If
- ' If .Quotas < 3 * 2 Then Exit Function
- End With
- Can_Event = True
- End Function
- Private Function Can_EnterEvent(ByVal ID As Integer) As Boolean
- '@@ Compruebo si puede entrar al evento
- Can_EnterEvent = False
- With UserList(ID)
- If .Stats.ELV < EventDelegate.Level Then Exit Function
- If EventDelegate.EventDelegate = False Then Exit Function
- If .flags.Delegate = 1 Then Exit Function
- If .Stats.GLD < EventDelegate.Requirement Then Exit Function
- If EventDelegate.UsersEvent = EventDelegate.Quotas Then Exit Function
- If .flags.Muerto = 1 Then Exit Function
- End With
- Can_EnterEvent = True
- End Function
- Public Sub Countdown_Event()
- '@@ Cuenta regresiva.
- With EventDelegate
- If .Countdown > 0 Then
- .Countdown = .Countdown - 1
- Select Case EventDelegate.Countdown
- Case 15
- Call SendData(SendTarget.toMap, 0, PrepareMessageConsoleMsg("Delegado» CONTEO» " & .Countdown, FontTypeNames.FONTTYPE_INFOBOLD))
- Case 10
- Call SendData(SendTarget.toMap, 0, PrepareMessageConsoleMsg("Delegado» CONTEO» " & .Countdown, FontTypeNames.FONTTYPE_INFOBOLD))
- Case 5
- Call SendData(SendTarget.toMap, 0, PrepareMessageConsoleMsg("Delegado» CONTEO» " & .Countdown, FontTypeNames.FONTTYPE_INFOBOLD))
- Case 4
- Call SendData(SendTarget.toMap, 0, PrepareMessageConsoleMsg("Delegado» CONTEO» " & .Countdown, FontTypeNames.FONTTYPE_INFOBOLD))
- Case 3
- Call SendData(SendTarget.toMap, 0, PrepareMessageConsoleMsg("Delegado» CONTEO» " & .Countdown, FontTypeNames.FONTTYPE_INFOBOLD))
- Case 2
- Call SendData(SendTarget.toMap, 0, PrepareMessageConsoleMsg("Delegado» CONTEO» " & .Countdown, FontTypeNames.FONTTYPE_INFOBOLD))
- Case 1
- Call SendData(SendTarget.toMap, 0, PrepareMessageConsoleMsg("Delegado» CONTEO» " & .Countdown, FontTypeNames.FONTTYPE_INFOBOLD))
- Case 0
- Call SendData(SendTarget.toMap, 0, PrepareMessageConsoleMsg("Delegado» PELEEN!", FontTypeNames.FONTTYPE_FIGHT))
- End Select
- End If
- End With
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement