Advertisement
Luciano_fuentes

Death Clanes

Nov 3rd, 2016
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Option Explicit
  2.  
  3. '**********************************************************************
  4. ' Autor: G Toyz.                                                      *
  5. ' Fecha de creación: 03/11                                            *
  6. ' Hora: 23:00                                                         *
  7. ' Descripción: Deathmatch de clanes automático.                       *
  8. ' Agradecimientos: CuiCui (Gastón)                                    *
  9. '**********************************************************************
  10.  
  11. Private Const MAX_SlOTS As Byte = 5     '// Máxima cantidad de cupos.
  12. Private Const USER_CLAN As Byte = 20    '// Máxima cantidad de usuarios en un clan.
  13.  
  14. Private Type tUser
  15.     ID                  As Integer      '// ID del usuario.
  16.    Last_Pos            As WorldPos     '// Última posición del usuario.
  17. End Type
  18.  
  19. Private Type tTeams
  20.     Users()             As tUser        '// Usuarios en el equipo.
  21.    Name_Team           As Byte         '// Nombre del equipo.
  22.    Points              As Byte         '// Puntos ganados.
  23.    Deaths              As Byte         '// Cantidad de muertos que lleva en la arena. (Se resetea cuando termina un punto)
  24.    Amount_Users        As Byte         '// Cantidad de usuarios que tiene el equipo.
  25.    PosOccupied         As Byte         '// Posiciones que están ocupando.
  26. End Type
  27.  
  28. Private Type tItems
  29.     ID                  As Integer      '// ID del item.
  30.    Amount              As Integer      '// Cantidad del item.
  31. End Type
  32.  
  33. Private Type tBilling
  34.     Gold                As Long         '// Cantidad de oro.
  35.    Items()             As tItems       '// Cantidad de objetos.
  36. End Type
  37.  
  38. Private Type tMax_Potions
  39.     Red                 As Integer      '// Máximo de pociones rojas.
  40.    Blue                As Integer      '// Máximo de pociones azules.
  41. End Type
  42.  
  43. Private Type tPos
  44.     X_Arena             As Byte         '// Posición X de la arena.
  45.    Y_Arena             As Byte         '// Posición Y de la arena.
  46.    Occupied            As Boolean      '// ¿Posiciones ocupadas?
  47. End Type
  48.  
  49. Private Type tEvent
  50.     Max_Potions         As tMax_Potions '// Cantidad máxima de pociones.
  51.    Active              As Boolean      '// ¿Evento activo?
  52.    Inscription         As tBilling     '// Inscripción por items o oro.
  53.    Prize               As tBilling     '// Premio por items o oro.
  54.    No_Inscription      As Boolean      '// No hay inscripción.
  55.    InscriptionInPrize  As Boolean      '// ¿La inscripción se acumula en el premio?
  56.    CountDown           As Integer      '// Cuenta regresiva.
  57.    Time_Limit          As Integer      '// Tiempo límite para que se incie el evento.
  58.    Drop                As Boolean      '// ¿Caen objetos?
  59.    Teams()             As tTeams       '// Equipos en el evento.
  60.    Pos(1 To MAX_SlOTS) As tPos         '// Posiciones de las arenas.
  61.    Map_Event           As Integer      '// Mapa del evento.
  62.    Slots               As Byte         '// Cantidad de cupos.
  63.    Slots_Occupied      As Byte         '// Cantidad de cupos ocupados.
  64.    Points              As Byte         '// Cantidad que de puntos que se necesita para ganar.
  65.    X_Items             As Byte         '// Posiciones donde van a caer los items.
  66.    Y_Items             As Byte         '// Posiciones donde van a caer los items.
  67.    Initialize          As Boolean      '// ¿Inicializamos el evento aunque no se haya cumplido los cupos?
  68.    Full_Guild          As Boolean      '// Todo los usuarios online del clan, no importa si son más o menos que otros.
  69.    Slots_User          As Byte         '// Cantidad de usuarios por equipo.
  70.    X_Death             As Byte         '// Posición X en donde van a ir a parar los muertos.
  71.    Y_Death             As Byte         '// Posición Y en donde van a ir a parar los muertos.
  72. End Type
  73.  
  74. Private DeathMatch      As tEvent       '// Evento.
  75. '_
  76.  
  77. Public Sub Load()
  78.     '@@ Sub main.
  79.    '@@ Pongan sus coordenadas y mapa.
  80.    With DeathMatch
  81.         .Pos(1).X_Arena = 50
  82.         .Pos(1).Y_Arena = 50
  83.         .Pos(2).X_Arena = 50
  84.         .Pos(2).Y_Arena = 50
  85.         .Pos(3).X_Arena = 50
  86.         .Pos(3).Y_Arena = 50
  87.         .Pos(4).X_Arena = 50
  88.         .Pos(4).Y_Arena = 50
  89.         .Pos(5).X_Arena = 50
  90.         .Pos(5).Y_Arena = 50
  91.         .Map_Event = 1
  92.         .X_Items = 40
  93.         .Y_Items = 40
  94.         .X_Death = 60
  95.         .Y_Death = 60
  96.     End With
  97. End Sub
  98. ''
  99. Public Sub Do_Event(ByRef Max_Potions As tMax_Potions, _
  100.                     ByRef Inscription As tBilling, _
  101.                     ByRef Prize As tBilling, _
  102.                     ByVal InscriptionInPrize As Boolean, _
  103.                     ByVal Drop As Boolean, _
  104.                     ByVal Slots As Byte, _
  105.                     ByVal Points As Byte, _
  106.                     ByVal Initialize As Boolean, _
  107.                     ByVal Full_Guild As Boolean, _
  108.                     ByVal Slots_User As Byte, _
  109.                     ByVal No_Inscription As Boolean)
  110.      
  111.     Dim LoopC As Long
  112.      
  113.     With DeathMatch
  114.         .Active = True
  115.         .Time_Limit = 120
  116.         .Drop = Drop
  117.         .Full_Guild = Full_Guild
  118.         .Initialize = Initialize
  119.         .Inscription = Inscription
  120.         .InscriptionInPrize = InscriptionInPrize
  121.         .Max_Potions = Max_Potions
  122.         .Points = Points
  123.         .Prize = Prize
  124.         .Slots = Slots
  125.         .Slots_User = Slots_User
  126.         .No_Inscription = No_Inscription
  127.         If .Full_Guild = True Then .Slots_User = MAXASPIRANTES: .InscriptionInPrize = False
  128.         ReDim .Teams(1 To .Slots) As tTeams
  129.         For LoopC = 1 To .Slots
  130.             ReDim .Teams(LoopC).Users(1 To .Slots_User) As tUser
  131.         Next LoopC
  132.         '// MENSAJE VÍA FORMULARIO O CONSOLA.
  133.    End With
  134. End Sub
  135. ''
  136. Public Sub Send_Event(ByRef ID() As Integer)
  137.  
  138.     Dim LoopC As Long
  139.     '// Hacer que sólo el líder pueda mandar.
  140.    With UserList(ID(1)).DeathMatch
  141.         .Send = True
  142.         ReDim .Players(1 To DeathMatch.Slots_User)
  143.         For LoopC = 1 To DeathMatch.Slots_User
  144.             .Players(LoopC) = ID(LoopC)
  145.             '// Le avisamos a todos que los invitó X user (Vía formulario o consola).
  146.        Next LoopC
  147.         .Amount_Accept = 1
  148.         .Accept_Invite = True
  149.     End With
  150. End Sub
  151.  
  152. Public Sub Accept_Event(ByVal ID As Integer, ByVal ID_Send As Integer)
  153.  
  154.     UserList(ID).DeathMatch.Accept_Invite = True
  155.    
  156.     With UserList(ID_Send).DeathMatch
  157.         .Amount_Accept = .Amount_Accept + 1
  158.         If .Amount_Accept = DeathMatch.Slots_User Then
  159.             '// Llevarlos a sus posiciones.
  160.            Call Clean_Send(ID_Send)
  161.         End If
  162.     End With
  163. End Sub
  164.  
  165. Public Sub Enter_Event(ByRef ID() As Integer)
  166.    
  167.     Dim LoopC As Long
  168.     Dim LoopX As Long
  169.     Dim LoopZ As Long
  170.     Dim Pos As Byte
  171.     Pos = There_Pos()
  172.    
  173.     With DeathMatch
  174.         .Slots_Occupied = .Slots_Occupied + 1
  175.         For LoopC = 1 To UBound(ID())
  176.             .Teams(.Slots_Occupied).Users(LoopC).ID = ID(LoopC)
  177.             .Teams(.Slots_Occupied).Users(LoopC).Last_Pos = UserList(ID(LoopC)).Pos
  178.             .Teams(.Slots_Occupied).Amount_Users = UBound(ID())
  179.             .Teams(.Slots_Occupied).Name_Team = modGuilds.GuildName(UserList(ID(1)).GuildIndex)
  180.             .Teams(.Slots_Occupied).PosOccupied = Pos
  181.             .Pos(Pos).Occupied = True
  182.             Call WarpUserChar(ID(LoopC), .Map_Event, .Pos(Pos).X_Arena + LoopC, .Pos(Pos).Y_Arena, False)
  183.             UserList(ID(LoopC)).DeathMatch.Death = True
  184.             UserList(ID(LoopC)).DeathMatch.ID_Team = .Slots_Occupied
  185.             If .No_Inscription = False Then
  186.                 UserList(ID(LoopC)).Stats.GLD = UserList(ID(LoopC)).Stats.GLD - .Inscription.Gold
  187.                 Call WriteUpdateGold(ID(LoopC))
  188.                 For LoopX = 1 To UBound(.Inscription.Items())
  189.                     Call QuitarObjetos(.Inscription.Items(LoopX).ID, .Inscription.Items(LoopX).Amount, ID(LoopC))
  190.                     If .InscriptionInPrize Then
  191.                         .Prize.Items(LoopX).ID = .Inscription.Items(LoopX).ID
  192.                         .Prize.Items(LoopX).Amount = .Inscription.Items(LoopX).Amount
  193.                     End If
  194.                 Next LoopX
  195.                 .Prize.Gold = .Prize.Gold + .Inscription.Gold
  196.             End If
  197.         Next LoopC
  198.         If .Slots_Occupied = .Slots Then
  199.             .CountDown = 15
  200.             .Time_Limit = -1
  201.         End If
  202.     End With
  203. End Sub
  204.  
  205. Public Sub Count()
  206.     Dim LoopC As Long
  207.     Dim LoopX As Long
  208.     With DeathMatch
  209.         If .Time_Limit = 0 Then
  210.             .Time_Limit = -1
  211.             If .Active = True Then
  212.                 If .Initialize = True Then _
  213.                     .CountDown = 15
  214.             End If
  215.         End If
  216.         If .Time_Limit > 0 Then _
  217.             .Time_Limit = .Time_Limit - 1
  218.         If .CountDown = 0 Then
  219.             .CountDown = -1
  220.             If .Active = True Then
  221.                 For LoopC = 1 To .Slots
  222.                     For LoopX = 1 To .Slots_User
  223.                         Call WritePauseToggle(.Teams(LoopC).Users(LoopX).ID)
  224.                     Next LoopX
  225.                 Next LoopC
  226.                 Call SendData(SendTarget.ToAll, 0, PrepareMessageConsoleMsg("Deathmatch Clanes» Ya!", FontTypeNames.FONTTYPE_GUILD))
  227.             End If
  228.         End If
  229.         If .CountDown > 0 Then
  230.             Call SendData(SendTarget.ToAll, 0, PrepareMessageConsoleMsg("Deathmatch Clanes» " & .CountDown, FontTypeNames.FONTTYPE_GUILD))
  231.             .CountDown = .CountDown - 1
  232.         End If
  233.     End With
  234. End Sub
  235.  
  236. Private Function There_Pos() As Byte
  237.     There_Pos = 0
  238.     Dim LoopC As Long
  239.    
  240.     With DeathMatch
  241.         For LoopC = 1 To .Slots
  242.             If .Pos(LoopC).Occupied = False Then
  243.                 There_Pos = LoopC
  244.                 Exit For
  245.             End If
  246.         Next LoopC
  247.     End With
  248. End Function
  249.  
  250. Public Sub Clean_Send(ByVal ID As Integer)
  251.    
  252.     Dim LoopC As Long
  253.    
  254.     With UserList(ID).DeathMatch
  255.         .Accept_Invite = False
  256.         .Amount_Accept = 0
  257.         .Send = False
  258.         For LoopC = 1 To UBound(.Players())
  259.             UserList(.Players(LoopC)).DeathMatch.Accept_Invite = False
  260.             .Players(LoopC) = 0
  261.         Next LoopC
  262.     End With
  263. End Sub
  264.  
  265. Public Sub Death(ByVal ID As Integer)
  266.     With DeathMatch
  267.         .Teams(UserList(ID).DeathMatch.ID_Team).Deaths = .Teams(UserList(ID).DeathMatch.ID_Team).Deaths + 1
  268.     End With
  269. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement