Advertisement
deD33

Untitled

Sep 17th, 2019
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 64.93 KB | None | 0 0
  1. Option Explicit
  2.  
  3. Public Const MAX_EVENT_SIMULTANEO As Byte = 5
  4. Public Const MAX_USERS_EVENT As Byte = 64
  5. Public Const MAX_MAP_FIGHT As Byte = 4
  6. Public Const MAP_TILE_VS As Byte = 17
  7.  
  8. Public Enum eModalityEvent
  9. CastleMode = 1
  10. DagaRusa = 2
  11. DeathMatch = 3
  12. Enfrentamientos = 4
  13. End Enum
  14.  
  15. Private Type tUserEvent
  16. Id As Integer
  17. Team As Byte
  18. value As Integer
  19. Selected As Byte
  20. MapFight As Integer
  21. End Type
  22.  
  23.  
  24. Private Type tEvents
  25. Enabled As Boolean
  26. Run As Boolean
  27. Modality As eModalityEvent
  28. TeamCant As Byte
  29.  
  30. Quotas As Byte
  31. Inscribed As Byte
  32.  
  33. LvlMax As Byte
  34. LvlMin As Byte
  35.  
  36. GldInscription As Long
  37. DspInscription As Long
  38. CanjeInscription As Long
  39.  
  40. AllowedClasses() As Byte
  41. TimeInit As Long
  42. TimeCancel As Long
  43. TimeCount As Long
  44. TimeFinish As Long
  45.  
  46. Users() As tUserEvent
  47.  
  48. ' Por si alguno es con NPC
  49. NpcIndex As Integer
  50.  
  51. ' Por si cambia el body del personaje y saca todo lo otro.
  52. CharBody As Integer
  53. CharHp As Integer
  54.  
  55. npcUserIndex As Integer
  56. End Type
  57.  
  58. Public Events(1 To MAX_EVENT_SIMULTANEO) As tEvents
  59.  
  60. Private Type tMap
  61. Run As Boolean
  62. map As Integer
  63. X As Byte
  64. Y As Byte
  65. End Type
  66.  
  67. Private Type tMapEvent
  68. Fight(1 To MAX_MAP_FIGHT) As tMap
  69. End Type
  70.  
  71. Private MapEvent As tMapEvent
  72. Public Sub LoadMapEvent()
  73. 10 With MapEvent
  74. 20 .Fight(1).Run = False
  75. 30 .Fight(1).map = 217
  76. 40 .Fight(1).X = 16 '+17
  77. 50 .Fight(1).Y = 12 '+17
  78.  
  79. 60 .Fight(2).Run = False
  80. 70 .Fight(2).map = 217
  81. 80 .Fight(2).X = 16 '+17
  82. 90 .Fight(2).Y = 41 '+17
  83. 100 .Fight(3).Run = False
  84. 110 .Fight(3).map = 217
  85. 120 .Fight(3).X = 16 '+17
  86. 130 .Fight(3).Y = 68 '+17
  87.  
  88. 140 .Fight(4).Run = False
  89. 150 .Fight(4).map = 217
  90. 160 .Fight(4).X = 46 '+17
  91. 170 .Fight(4).Y = 12 '+17
  92.  
  93.  
  94.  
  95. 180 End With
  96. End Sub
  97. '/MANEJO DE LOS TIEMPOS '/
  98. Public Sub LoopEvent()
  99. Dim LoopC As Long
  100. Dim LoopY As Integer
  101.  
  102. For LoopC = 1 To MAX_EVENT_SIMULTANEO
  103. With Events(LoopC)
  104. If .Enabled Then
  105. If .TimeInit > 0 Then
  106. .TimeInit = .TimeInit - 1
  107.  
  108. Select Case .TimeInit
  109. Case 0
  110.  
  111. Case 60
  112. SendData SendTarget.ToAll, 0, PrepareMessageConsoleMsg(strModality(LoopC, .Modality) & "» Las inscripciones abren en " & Int(.TimeInit / 60) & " minutos.", FontTypeNames.FONTTYPE_GUILD)
  113. Case 120
  114. SendData SendTarget.ToAll, 0, PrepareMessageConsoleMsg(strModality(LoopC, .Modality) & "» Las inscripciones abren en " & Int(.TimeInit / 60) & " minutos.", FontTypeNames.FONTTYPE_GUILD)
  115. Case 180
  116. SendData SendTarget.ToAll, 0, PrepareMessageConsoleMsg(strModality(LoopC, .Modality) & "» Las inscripciones abren en " & Int(.TimeInit / 60) & " minutos.", FontTypeNames.FONTTYPE_GUILD)
  117.  
  118. End Select
  119.  
  120. If .TimeInit <= 0 Then
  121. SendData SendTarget.ToAll, 0, PrepareMessageConsoleMsg(strModality(LoopC, .Modality) & "» Inscripciones abiertas. /PARTICIPAR " & strModality(LoopC, .Modality) & " para ingresar al evento.", FontTypeNames.FONTTYPE_GUILD)
  122. .TimeCancel = 0
  123. End If
  124.  
  125.  
  126. End If
  127.  
  128. If .TimeCancel > 0 Then
  129. .TimeCancel = .TimeCancel - 1
  130.  
  131. If .TimeCancel <= 0 Then
  132. 'SendData SendTarget.ToAll, 0, PrepareMessageConsoleMsg(strModality(.Modality) & "» Ha sido cancelado ya que no se completaron los cupos.", FontTypeNames.FONTTYPE_WARNING)
  133. EventosDS.CloseEvent LoopC, "Evento " & strModality(LoopC, .Modality) & " cancelado."
  134. End If
  135. End If
  136.  
  137. If .TimeCount > 0 Then
  138. .TimeCount = .TimeCount - 1
  139.  
  140. For LoopY = LBound(.Users()) To UBound(.Users())
  141. If .Users(LoopY).Id > 0 Then
  142. If .TimeCount = 0 Then
  143. WriteConsoleMsg .Users(LoopY).Id, "Mmmm que comience el juego!", FontTypeNames.FONTTYPE_GUILD
  144. Else
  145. WriteConsoleMsg .Users(LoopY).Id, "Cuenta» " & .TimeCount, FontTypeNames.FONTTYPE_GUILD
  146. End If
  147. End If
  148. Next LoopY
  149. End If
  150.  
  151. If .NpcIndex > 0 Then
  152. If Events(Npclist(.NpcIndex).flags.SlotEvent).TimeCount > 0 Then Exit Sub
  153. Call DagaRusa_MoveNpc(.NpcIndex)
  154. End If
  155.  
  156. If .TimeFinish > 0 Then
  157. .TimeFinish = .TimeFinish - 1
  158.  
  159. If .TimeFinish = 0 Then
  160. Call FinishEvent(LoopC)
  161. End If
  162. End If
  163. End If
  164.  
  165.  
  166. End With
  167. Next LoopC
  168. End Sub
  169.  
  170. '/ FIN MANEJO DE LOS TIEMPOS
  171.  
  172.  
  173. '// Funciones generales '//
  174. Private Function FreeSlotEvent() As Byte
  175. Dim LoopC As Integer
  176.  
  177. For LoopC = 1 To MAX_EVENT_SIMULTANEO
  178. If Not Events(LoopC).Enabled Then
  179. FreeSlotEvent = LoopC
  180. Exit For
  181. End If
  182. Next LoopC
  183. End Function
  184.  
  185. Private Function FreeSlotUser(ByVal SlotEvent As Byte) As Byte
  186. Dim LoopC As Integer
  187.  
  188. With Events(SlotEvent)
  189. For LoopC = 1 To MAX_USERS_EVENT
  190. If .Users(LoopC).Id = 0 Then
  191. FreeSlotUser = LoopC
  192. Exit For
  193. End If
  194. Next LoopC
  195. End With
  196.  
  197. End Function
  198. Public Function strUsersEvent(ByVal SlotEvent As Byte) As String
  199.  
  200. ' Texto que marca los personajes que están en el evento.
  201. Dim LoopC As Integer
  202.  
  203. With Events(SlotEvent)
  204. For LoopC = LBound(.Users()) To UBound(.Users())
  205. If .Users(LoopC).Id > 0 Then
  206. strUsersEvent = strUsersEvent & UserList(.Users(LoopC).Id).Name & "-"
  207. End If
  208. Next LoopC
  209. End With
  210. End Function
  211. Private Function CheckAllowedClasses(ByRef AllowedClasses() As Byte) As String
  212. Dim LoopC As Integer
  213.  
  214. For LoopC = 1 To NUMCLASES
  215. If AllowedClasses(LoopC) = 1 Then
  216. If CheckAllowedClasses = vbNullString Then
  217. CheckAllowedClasses = ListaClases(LoopC)
  218. Else
  219. CheckAllowedClasses = CheckAllowedClasses & ", " & ListaClases(LoopC)
  220. End If
  221. End If
  222. Next LoopC
  223.  
  224. End Function
  225.  
  226. Private Function SearchLastUserEvent(ByVal SlotEvent As Byte) As Integer
  227.  
  228. ' Busca el último usuario que está en el torneo. En todos los eventos será el ganador.
  229.  
  230. Dim LoopC As Integer
  231.  
  232. With Events(SlotEvent)
  233. For LoopC = LBound(.Users()) To UBound(.Users())
  234. If .Users(LoopC).Id > 0 Then
  235. SearchLastUserEvent = .Users(LoopC).Id
  236. Exit For
  237. End If
  238. Next LoopC
  239. End With
  240. End Function
  241.  
  242. Private Function SearchSlotEvent(ByVal Modality As String) As Byte
  243. Dim LoopC As Integer
  244.  
  245. SearchSlotEvent = 0
  246.  
  247. For LoopC = 1 To MAX_EVENT_SIMULTANEO
  248. With Events(LoopC)
  249. If StrComp(UCase$(strModality(LoopC, .Modality)), UCase$(Modality)) = 0 Then
  250. SearchSlotEvent = LoopC
  251. Exit For
  252. End If
  253. End With
  254. Next LoopC
  255.  
  256. End Function
  257. Private Sub ResetEvent(ByVal Slot As Byte)
  258. Dim LoopC As Integer
  259. Dim UserIndex As Integer
  260.  
  261. With Events(Slot)
  262. For LoopC = LBound(.Users()) To UBound(.Users())
  263. If .Users(LoopC).Id > 0 Then
  264. AbandonateEvent .Users(LoopC).Id, False
  265.  
  266. End If
  267. Next LoopC
  268.  
  269. If .NpcIndex > 0 Then Call QuitarNPC(.NpcIndex)
  270.  
  271. .Enabled = False
  272. .Quotas = 0
  273. .Inscribed = 0
  274. .DspInscription = 0
  275. .GldInscription = 0
  276. .CanjeInscription = 0
  277. .LvlMax = 0
  278. .LvlMin = 0
  279. .TimeCancel = 0
  280. .NpcIndex = 0
  281. .TimeInit = 0
  282. .TimeCount = 0
  283. .CharBody = 0
  284. .CharHp = 0
  285. .Modality = 0
  286. .Run = False
  287.  
  288. For LoopC = LBound(.AllowedClasses()) To UBound(.AllowedClasses())
  289. .AllowedClasses(LoopC) = 0
  290. Next LoopC
  291.  
  292. End With
  293. End Sub
  294.  
  295. Private Function CheckUserEvent(ByVal UserIndex As Integer, ByVal SlotEvent As Byte, ByRef ErrorMsg As String) As Boolean
  296. CheckUserEvent = False
  297.  
  298. With UserList(UserIndex)
  299. If .flags.Muerto Then
  300. ErrorMsg = "No puedes participar en eventos estando muerto."
  301. Exit Function
  302. End If
  303.  
  304. If .flags.Oculto Then
  305. ErrorMsg = "No puedes participar en eventos estando oculto."
  306. Exit Function
  307. End If
  308.  
  309. If .flags.Angel Then
  310. ErrorMsg = "No puedes participar en eventos estando en modo ANGEL."
  311. Exit Function
  312. End If
  313.  
  314. If .flags.Demonio Then
  315. ErrorMsg = "No puedes participar en eventos estando en modo DEMON."
  316. Exit Function
  317. End If
  318.  
  319. If .flags.Navegando Then
  320. ErrorMsg = "No puedes participar en eventos navegando."
  321. Exit Function
  322. End If
  323.  
  324. If .flags.EnConsulta Then
  325. ErrorMsg = "No puedes participar si estas en consulta."
  326. Exit Function
  327. End If
  328.  
  329. If .flags.Mimetizado Then
  330. ErrorMsg = "No puedes entrar mimetizado."
  331. Exit Function
  332. End If
  333.  
  334. If .flags.Montando Then
  335. ErrorMsg = "No puedes entrar montando."
  336. Exit Function
  337. End If
  338.  
  339. If .flags.invisible Then
  340. ErrorMsg = "No puedes entrar invisible."
  341. Exit Function
  342. End If
  343.  
  344. If .flags.SlotEvent > 0 Then
  345. ErrorMsg = "Ya te encuentras en un evento. Tipea /SALIREVENTO para salir del mismo."
  346. Exit Function
  347. End If
  348.  
  349. If .Counters.Pena > 0 Then
  350. ErrorMsg = "No puedes participar de los eventos en la cárcel. Maldito prisionero!"
  351. Exit Function
  352. End If
  353.  
  354. If MapInfo(.Pos.map).Pk Then
  355. ErrorMsg = "No puedes participar de los eventos estando en zona insegura. Vé a la ciudad mas cercana"
  356. Exit Function
  357. End If
  358.  
  359. If .flags.Comerciando Then
  360. ErrorMsg = "No puedes participar de los eventos si estás comerciando."
  361. Exit Function
  362. End If
  363.  
  364. If Not Events(SlotEvent).Enabled Or Events(SlotEvent).TimeInit > 0 Then
  365. ErrorMsg = "No hay ningun torneo disponible con ese nombre o bien las inscripciones no están disponibles aún."
  366. Exit Function
  367. End If
  368.  
  369. If Events(SlotEvent).Run Then
  370. ErrorMsg = "El torneo ya ha comenzado. Mejor suerte para la próxima."
  371. Exit Function
  372. End If
  373.  
  374.  
  375. If Events(SlotEvent).LvlMin <> 0 Then
  376. If Events(SlotEvent).LvlMin > .Stats.ELV Then
  377. ErrorMsg = "Tu nivel no te permite ingresar a este evento."
  378. Exit Function
  379. End If
  380. End If
  381.  
  382. If Events(SlotEvent).LvlMin <> 0 Then
  383. If Events(SlotEvent).LvlMax < .Stats.ELV Then
  384. ErrorMsg = "Tu nivel no te permite ingresar al evento."
  385. Exit Function
  386. End If
  387. End If
  388.  
  389. If Events(SlotEvent).AllowedClasses(.clase) = 0 Then
  390. ErrorMsg = "Tu clase no está permitida en el evento."
  391. Exit Function
  392. End If
  393.  
  394. If Events(SlotEvent).CanjeInscription > .Stats.puntos Then
  395. ErrorMsg = "No tienes suficiente canjes para pagar el torneo."
  396. Exit Function
  397. End If
  398.  
  399. If Events(SlotEvent).GldInscription > .Stats.Gld Then
  400. ErrorMsg = "No tienes suficiente oro para pagar el torneo. Pide prestado a un compañero."
  401. Exit Function
  402. End If
  403.  
  404. If Events(SlotEvent).DspInscription > 0 Then
  405. If Not TieneObjetos(880, Events(SlotEvent).DspInscription, UserIndex) Then
  406. ErrorMsg = "No tienes suficientes monedas DSP para participar del evento."
  407. Exit Function
  408. End If
  409. End If
  410.  
  411. If Events(SlotEvent).Inscribed = Events(SlotEvent).Quotas Then
  412. ErrorMsg = "Los cupos del evento al que deseas participar ya fueron alcanzados."
  413. Exit Function
  414. End If
  415.  
  416.  
  417. End With
  418. CheckUserEvent = True
  419. End Function
  420.  
  421. ' EDICIÓN GENERAL
  422. Public Function strModality(ByVal SlotEvent As Byte, ByVal Modality As eModalityEvent) As String
  423.  
  424. ' Modalidad de cada evento
  425.  
  426. 10 Select Case Modality
  427. Case eModalityEvent.CastleMode
  428. 20 strModality = "REYvsREY"
  429.  
  430. 30 Case eModalityEvent.DagaRusa
  431. 40 strModality = "DAGARUSA"
  432.  
  433. 50 Case eModalityEvent.DeathMatch
  434. 60 strModality = "DEATHMATCH"
  435.  
  436. 190 Case eModalityEvent.Enfrentamientos
  437. 200 strModality = Events(SlotEvent).TeamCant & "vs" & Events(SlotEvent).TeamCant
  438. 210 End Select
  439. End Function
  440. Private Function strDescEvent(ByVal Modality As eModalityEvent) As String
  441.  
  442. ' Descripción del evento en curso.
  443. Select Case Modality
  444. Case eModalityEvent.CastleMode
  445. strDescEvent = "> Los usuarios entrarán de forma aleatorea para formar dos equipos. Ambos equipos deberán defender a su rey y a su vez atacar al del equipo contrario."
  446. Case eModalityEvent.DagaRusa
  447. strDescEvent = "> Los usuarios se teletransportarán a una posición donde estará un asesino dispuesto a apuñalarlos y acabar con su vida. El último que quede en pie es el ganador del evento."
  448. Case eModalityEvent.DeathMatch
  449. strDescEvent = "> Los usuarios ingresan y luchan en una arena donde se toparan con todos los demás concursantes. El que logre quedar en pie, será el ganador."
  450. Case eModalityEvent.Enfrentamientos
  451. strDescEvent = "> Los usuarios se enfretan en una sala de Duelos para mostrar sus habilidades."
  452. End Select
  453. End Function
  454. Private Sub InitEvent(ByVal SlotEvent As Byte)
  455.  
  456. Select Case Events(SlotEvent).Modality
  457. Case eModalityEvent.CastleMode
  458. Call InitCastleMode(SlotEvent)
  459.  
  460. Case eModalityEvent.DagaRusa
  461. Call InitDagaRusa(SlotEvent)
  462.  
  463. Case eModalityEvent.DeathMatch
  464. Call InitDeathMatch(SlotEvent)
  465.  
  466. Case eModalityEvent.Enfrentamientos
  467. Call InitFights(SlotEvent)
  468. Case Else
  469. Exit Sub
  470.  
  471. End Select
  472. End Sub
  473. Public Function CanAttackUserEvent(ByVal UserIndex As Integer, ByVal Victima As Integer) As Boolean
  474.  
  475. ' Si el personaje es del mismo team, no se puede atacar al usuario.
  476. Dim VictimaSlotUserEvent As Byte
  477.  
  478. VictimaSlotUserEvent = UserList(Victima).flags.SlotUserEvent
  479.  
  480. With UserList(UserIndex)
  481. If .flags.SlotEvent > 0 Then
  482. If Events(.flags.SlotEvent).Users(VictimaSlotUserEvent).Team = Events(.flags.SlotEvent).Users(.flags.SlotUserEvent).Team Then
  483. CanAttackUserEvent = False
  484. Exit Function
  485. End If
  486. End If
  487. CanAttackUserEvent = True
  488. End With
  489. End Function
  490.  
  491. Private Function ChangeBodyEvent(ByVal SlotEvent As Byte, ByVal UserIndex As Integer, ByVal ChangeHead As Boolean)
  492.  
  493. ' En caso de que el evento cambie el body, de lo cambiamos.
  494. With UserList(UserIndex)
  495. .CharMimetizado.body = .Char.body
  496. .CharMimetizado.Head = .Char.Head
  497. .CharMimetizado.CascoAnim = .Char.CascoAnim
  498. .CharMimetizado.ShieldAnim = .Char.ShieldAnim
  499. .CharMimetizado.WeaponAnim = .Char.WeaponAnim
  500.  
  501. .Char.body = Events(SlotEvent).CharBody
  502. .Char.Head = IIf(ChangeHead = False, .Char.Head, 0)
  503. .Char.CascoAnim = 0
  504. .Char.ShieldAnim = 0
  505. .Char.WeaponAnim = 0
  506.  
  507. ChangeUserChar UserIndex, .Char.body, .Char.Head, .Char.Heading, .Char.WeaponAnim, .Char.ShieldAnim, .Char.CascoAnim, True
  508. RefreshCharStatus UserIndex
  509.  
  510. End With
  511. End Function
  512.  
  513. Private Function ResetBodyEvent(ByVal SlotEvent As Byte, ByVal UserIndex As Integer)
  514.  
  515. ' En caso de que el evento cambie el body del personaje, se lo restauramos.
  516.  
  517. With UserList(UserIndex)
  518. If .flags.Muerto Then Exit Function
  519. 'If Events(SlotEvent).Users(.flags.SlotUserEvent).Selected = 0 Then Exit Function
  520.  
  521. If .CharMimetizado.body > 0 Then
  522. .Char.body = .CharMimetizado.body
  523. .Char.Head = .CharMimetizado.Head
  524. .Char.CascoAnim = .CharMimetizado.CascoAnim
  525. .Char.ShieldAnim = .CharMimetizado.ShieldAnim
  526. .Char.WeaponAnim = .CharMimetizado.WeaponAnim
  527.  
  528.  
  529. .CharMimetizado.body = 0
  530. .CharMimetizado.Head = 0
  531. .CharMimetizado.CascoAnim = 0
  532. .CharMimetizado.ShieldAnim = 0
  533. .CharMimetizado.WeaponAnim = 0
  534.  
  535. .showName = True
  536.  
  537. ChangeUserChar UserIndex, .Char.body, .Char.Head, .Char.Heading, .Char.WeaponAnim, .Char.ShieldAnim, .Char.CascoAnim, True
  538. RefreshCharStatus UserIndex
  539. End If
  540.  
  541. End With
  542. End Function
  543.  
  544. Private Sub ChangeHpEvent(ByVal UserIndex As Integer)
  545.  
  546. ' En caso de que el evento edite la vida del personaje, se la editamos.
  547.  
  548. Dim SlotEvent As Byte
  549.  
  550. With UserList(UserIndex)
  551. SlotEvent = .flags.SlotEvent
  552.  
  553. .Stats.OldHp = .Stats.MaxHp
  554.  
  555. .Stats.MaxHp = Events(SlotEvent).CharHp
  556. .Stats.MinHp = .Stats.MaxHp
  557.  
  558. WriteUpdateUserStats UserIndex
  559.  
  560. End With
  561. End Sub
  562.  
  563. Private Sub ResetHpEvent(ByVal UserIndex As Integer)
  564.  
  565. ' En caso de que el evento haya editado la vida de un personaje, se la volvemos a restaurar.
  566.  
  567. With UserList(UserIndex)
  568.  
  569. .Stats.MaxHp = .Stats.OldHp
  570. .Stats.MinHp = .Stats.MaxHp
  571. .Stats.OldHp = 0
  572. WriteUpdateUserStats UserIndex
  573.  
  574. End With
  575. End Sub
  576.  
  577. '// Fin Funciones generales '//
  578.  
  579. Public Sub NewEvent(ByVal UserIndex As Integer, _
  580. ByVal Modality As eModalityEvent, _
  581. ByVal Quotas As Byte, _
  582. ByVal LvlMin As Byte, _
  583. ByVal LvlMax As Byte, _
  584. ByVal GldInscription As Long, _
  585. ByVal DspInscription As Long, _
  586. ByVal CanjeInscription As Long, _
  587. ByVal TimeInit As Long, _
  588. ByVal TimeCancel As Long, _
  589. ByVal TeamCant As Byte, _
  590. ByRef AllowedClasses() As Byte)
  591.  
  592. Dim Slot As Integer
  593. Dim strTemp As String
  594.  
  595. Slot = FreeSlotEvent()
  596.  
  597. If Slot = 0 Then
  598. WriteConsoleMsg UserIndex, "No hay más lugar disponible para crear un evento simultaneo. Espera a que termine alguno o bien cancela alguno.", FontTypeNames.FONTTYPE_INFO
  599. Exit Sub
  600. Else
  601. With Events(Slot)
  602. .Enabled = True
  603. .Modality = Modality
  604. .Quotas = Quotas
  605. .LvlMin = LvlMin
  606. .LvlMax = LvlMax
  607. .GldInscription = GldInscription
  608. .DspInscription = DspInscription
  609. .CanjeInscription = CanjeInscription
  610. .AllowedClasses = AllowedClasses
  611. .TimeInit = TimeInit
  612. .TimeCancel = TimeCancel
  613. .TeamCant = TeamCant
  614.  
  615. ReDim .Users(1 To .Quotas) As tUserEvent
  616.  
  617. ' strModality devuelve: "Evento '1vs1' : Descripción"
  618. strTemp = strModality(Slot, .Modality) & strDescEvent(.Modality) & vbCrLf
  619. strTemp = strTemp & "Cupos máximos: " & .Quotas & vbCrLf
  620.  
  621. strTemp = strTemp & IIf((.LvlMin > 0), "Nivel mínimo: " & .LvlMin & vbCrLf, vbNullString)
  622. strTemp = strTemp & IIf((.LvlMax > 0), "Nivel máximo: " & .LvlMax & vbCrLf, vbNullString)
  623.  
  624. If .GldInscription > 0 And .DspInscription > 0 And .CanjeInscription > 0 Then
  625. strTemp = strTemp & "Inscripción requerida: " & .GldInscription & " monedas de oro, " & .DspInscription & " monedas DSP y " & .CanjeInscription & " Canjes."
  626. ElseIf .GldInscription > 0 Then
  627. strTemp = strTemp & "Inscripción requerida: " & .GldInscription & " monedas de oro."
  628. ElseIf .DspInscription > 0 Then
  629. strTemp = strTemp & "Inscripción requerida: " & .DspInscription & " monedas DSP."
  630. ElseIf .CanjeInscription > 0 Then
  631. strTemp = strTemp & "Inscripción requerida: " & .CanjeInscription & " Canjes."
  632. Else
  633. strTemp = strTemp & "Inscripción GRATIS"
  634. End If
  635.  
  636. strTemp = strTemp & vbCrLf
  637.  
  638. strTemp = strTemp & "Clases permitidas: " & CheckAllowedClasses(AllowedClasses) & ". Comando para ingresar /PARTICIPAR " & strModality(Slot, .Modality) & vbCrLf
  639. strTemp = strTemp & "Las inscripciones abren en " & Int(.TimeInit / 60) & " minutos."
  640. End With
  641.  
  642. SendData SendTarget.ToAll, 0, PrepareMessageConsoleMsg(strTemp, FontTypeNames.FONTTYPE_INFOBOLD)
  643. End If
  644.  
  645. End Sub
  646.  
  647. Public Sub CloseEvent(ByVal Slot As Byte, Optional ByVal MsgConsole As String = vbNullString)
  648.  
  649. With Events(Slot)
  650. If MsgConsole <> vbNullString Then SendData SendTarget.ToAll, 0, PrepareMessageConsoleMsg(MsgConsole, FontTypeNames.FONTTYPE_ORO)
  651.  
  652.  
  653.  
  654. Call ResetEvent(Slot)
  655. End With
  656. End Sub
  657.  
  658.  
  659.  
  660.  
  661. Public Sub ParticipeEvent(ByVal UserIndex As Integer, ByVal Modality As String)
  662.  
  663. Dim ErrorMsg As String
  664. Dim SlotUser As Byte
  665. Dim Pos As WorldPos
  666. Dim SlotEvent As Integer
  667.  
  668. SlotEvent = SearchSlotEvent(Modality)
  669.  
  670. If SlotEvent = 0 Then
  671. 'SendData SendTarget.ToAll, 0, PrepareMessageConsoleMsg("Error Fatal TESTEO", FontTypeNames.FONTTYPE_ADMIN)
  672. Exit Sub
  673. End If
  674.  
  675. With UserList(UserIndex)
  676. If CheckUserEvent(UserIndex, SlotEvent, ErrorMsg) Then
  677. SlotUser = FreeSlotUser(SlotEvent)
  678.  
  679. .flags.SlotEvent = SlotEvent
  680. .flags.SlotUserEvent = SlotUser
  681.  
  682. .PosAnt.map = .Pos.map
  683. .PosAnt.X = .Pos.X
  684. .PosAnt.Y = .Pos.Y
  685.  
  686. .Stats.Gld = .Stats.Gld - Events(SlotEvent).GldInscription
  687. Call WriteUpdateGold(UserIndex)
  688.  
  689. .Stats.puntos = .Stats.puntos - Events(SlotEvent).CanjeInscription
  690. Call WriteUpdateUserStats(UserIndex)
  691.  
  692. Call QuitarObjetos(880, Events(SlotEvent).DspInscription, UserIndex)
  693.  
  694. With Events(SlotEvent)
  695. Pos.map = 211
  696. Pos.X = 30
  697. Pos.Y = 21
  698.  
  699. Call FindLegalPos(UserIndex, Pos.map, Pos.X, Pos.Y)
  700. Call WarpUserChar(UserIndex, Pos.map, Pos.X, Pos.Y, False)
  701.  
  702. .Users(SlotUser).Id = UserIndex
  703. .Inscribed = .Inscribed + 1
  704.  
  705.  
  706. WriteConsoleMsg UserIndex, "Has ingresado al evento " & strModality(SlotEvent, .Modality) & ". Espera a que se completen los cupos para que comience.", FontTypeNames.FONTTYPE_INFO
  707.  
  708. If .Inscribed = .Quotas Then
  709. SendData SendTarget.ToAll, 0, PrepareMessageConsoleMsg(strModality(SlotEvent, .Modality) & "Los cupos han sido alcanzados. Les deseamos mucha suerte a cada uno de los participantes y que gane el mejor!", FontTypeNames.FONTTYPE_GUILD)
  710. .Run = True
  711. InitEvent SlotEvent
  712. Exit Sub
  713. End If
  714. End With
  715.  
  716. Else
  717. WriteConsoleMsg UserIndex, ErrorMsg, FontTypeNames.FONTTYPE_WARNING
  718.  
  719. End If
  720. End With
  721. End Sub
  722.  
  723.  
  724.  
  725. Public Sub AbandonateEvent(ByVal UserIndex As Integer, _
  726. Optional ByVal MsgAbandonate As Boolean = False, _
  727. Optional ByVal Forzado As Boolean = False)
  728.  
  729. 10 On Error GoTo error
  730.  
  731. Dim Pos As WorldPos
  732. Dim SlotEvent As Byte
  733. Dim SlotUserEvent As Byte
  734. Dim UserTeam As Byte
  735. Dim UserMapFight As Byte
  736.  
  737. 20 With UserList(UserIndex)
  738. 30 SlotEvent = .flags.SlotEvent
  739. 40 SlotUserEvent = .flags.SlotUserEvent
  740.  
  741. 50 If SlotEvent > 0 And SlotUserEvent > 0 Then
  742. 60 With Events(SlotEvent)
  743. 'LogEventos "El personaje " & UserList(UserIndex).Name & " abandonó el evento de modalidad " & strModality(SlotEvent, .Modality)
  744. 70
  745. If .Inscribed > 0 Then .Inscribed = .Inscribed - 1
  746.  
  747. 80 UserTeam = .Users(SlotUserEvent).Team
  748. 90 UserMapFight = .Users(SlotUserEvent).MapFight
  749.  
  750. 100 .Users(SlotUserEvent).Id = 0
  751. 110 .Users(SlotUserEvent).Team = 0
  752. .Users(SlotUserEvent).value = 0
  753. 130 .Users(SlotUserEvent).Selected = 0
  754. 140 .Users(SlotUserEvent).MapFight = 0
  755.  
  756. 150 UserList(UserIndex).flags.SlotEvent = 0
  757. 160 UserList(UserIndex).flags.SlotUserEvent = 0
  758.  
  759. 180 Select Case .Modality
  760.  
  761. Case eModalityEvent.DagaRusa
  762. If Forzado And .Run Then
  763. Call WriteUserInEvent(UserIndex)
  764.  
  765. If .Users(SlotUserEvent).value = 0 Then
  766. Npclist(.NpcIndex).flags.InscribedPrevio = Npclist(.NpcIndex).flags.InscribedPrevio - 1
  767. End If
  768. End If
  769.  
  770. 310 Case eModalityEvent.Enfrentamientos
  771. 320 If Forzado Then
  772. 330 If UserMapFight > 0 Then
  773. 340 If Not Fight_CheckContinue(UserIndex, SlotEvent, UserTeam) Then
  774. 350 Fight_WinForzado UserIndex, SlotEvent, UserMapFight
  775. 360 End If
  776. 370 End If
  777. 380 End If
  778.  
  779. 390 If UserList(UserIndex).Counters.TimeFight > 0 Then
  780. 400 UserList(UserIndex).Counters.TimeFight = 0
  781. 410 Call WriteUserInEvent(UserIndex)
  782. 420 End If
  783.  
  784. 430 End Select
  785.  
  786. 440 Pos.map = UserList(UserIndex).PosAnt.map
  787. 450 Pos.X = UserList(UserIndex).PosAnt.X
  788. 460 Pos.Y = UserList(UserIndex).PosAnt.Y
  789.  
  790. 470 Call FindLegalPos(UserIndex, Pos.map, Pos.X, Pos.Y)
  791. 480 Call WarpUserChar(UserIndex, Pos.map, Pos.X, Pos.Y, False)
  792.  
  793. 490 If Events(SlotEvent).CharBody <> 0 Then
  794. 500 Call ResetBodyEvent(SlotEvent, UserIndex)
  795. 510 End If
  796.  
  797. 520 If UserList(UserIndex).Stats.OldHp <> 0 Then
  798. 530 ResetHpEvent UserIndex
  799. 540 End If
  800.  
  801. 550 UserList(UserIndex).showName = True
  802. 560 RefreshCharStatus UserIndex
  803.  
  804. If MsgAbandonate Then WriteConsoleMsg UserIndex, "Has abandonado el evento. Podrás recibir una pena por hacer esto.", FontTypeNames.FONTTYPE_WARNING
  805.  
  806. ' Abandono general del evento
  807. 580 If .Inscribed = 1 And Forzado Then
  808. 590 Call FinishEvent(SlotEvent)
  809.  
  810. 600 CloseEvent SlotEvent
  811. 610 Exit Sub
  812. 620 End If
  813.  
  814.  
  815. 630 End With
  816. 640 End If
  817.  
  818.  
  819. 650 End With
  820.  
  821. 660 Exit Sub
  822.  
  823. error:
  824. 670 ' LogEventos "[" & Err.Number & "] " & Err.Description & ") PROCEDIMIENTO : AbandonateEvent()"
  825. End Sub
  826.  
  827. Private Sub FinishEvent(ByVal SlotEvent As Byte)
  828.  
  829. Dim UserIndex As Integer
  830. Dim IsSelected As Boolean
  831.  
  832. With Events(SlotEvent)
  833. Select Case .Modality
  834. Case eModalityEvent.CastleMode
  835. UserIndex = SearchLastUserEvent(SlotEvent)
  836. CastleMode_Premio UserIndex, False
  837.  
  838. Case eModalityEvent.DagaRusa
  839. UserIndex = SearchLastUserEvent(SlotEvent)
  840. DagaRusa_Premio UserIndex
  841.  
  842. Case eModalityEvent.DeathMatch
  843. UserIndex = SearchLastUserEvent(SlotEvent)
  844. DeathMatch_Premio UserIndex
  845. End Select
  846. End With
  847.  
  848.  
  849.  
  850. End Sub
  851.  
  852.  
  853. '#################EVENTO CASTLE MODE##########################
  854. Public Function CanAttackReyCastle(ByVal UserIndex As Integer, ByVal NpcIndex As Integer) As Boolean
  855. With UserList(UserIndex)
  856. If .flags.SlotEvent > 0 Then
  857. If Npclist(NpcIndex).flags.TeamEvent = Events(.flags.SlotEvent).Users(.flags.SlotUserEvent).Team Then
  858. CanAttackReyCastle = False
  859. Exit Function
  860. End If
  861. End If
  862.  
  863.  
  864. CanAttackReyCastle = True
  865. End With
  866. End Function
  867. Private Sub CastleMode_InitRey()
  868. Dim NpcIndex As Integer
  869. Const NumRey As Integer = 697
  870. Dim Pos As WorldPos
  871. Dim LoopX As Integer, LoopY As Integer
  872. Const Rango As Byte = 5
  873.  
  874. For LoopX = 74 - Rango To 74 + Rango
  875. For LoopY = 24 - Rango To 24 + Rango
  876. If MapData(212, LoopX, LoopY).NpcIndex > 0 Then
  877. Call QuitarNPC(MapData(212, LoopX, LoopY).NpcIndex)
  878. End If
  879. Next LoopY
  880. Next LoopX
  881.  
  882. Pos.map = 212
  883.  
  884. Pos.X = 74
  885. Pos.Y = 24
  886. NpcIndex = SpawnNpc(NumRey, Pos, False, False)
  887. Npclist(NpcIndex).flags.TeamEvent = 1
  888.  
  889.  
  890. For LoopX = 19 - Rango To 19 + Rango
  891. For LoopY = 34 - Rango To 34 + Rango
  892. If MapData(212, LoopX, LoopY).NpcIndex > 0 Then
  893. Call QuitarNPC(MapData(212, LoopX, LoopY).NpcIndex)
  894. End If
  895. Next LoopY
  896. Next LoopX
  897.  
  898. Pos.X = 19
  899. Pos.Y = 34
  900. NpcIndex = SpawnNpc(NumRey, Pos, False, False)
  901. Npclist(NpcIndex).flags.TeamEvent = 2
  902.  
  903. End Sub
  904.  
  905. Public Sub InitCastleMode(ByVal SlotEvent As Byte)
  906. Dim LoopC As Integer
  907.  
  908. Const NumRey As Integer = 697
  909. Dim NpcIndex As Integer
  910. Dim Pos As WorldPos
  911.  
  912. ' Spawn the npc castle mode
  913. CastleMode_InitRey
  914.  
  915. With Events(SlotEvent)
  916. For LoopC = LBound(.Users()) To UBound(.Users())
  917. If .Users(LoopC).Id > 0 Then
  918. If LoopC > (UBound(.Users()) / 2) Then
  919. .Users(LoopC).Team = 2
  920. Pos.map = 212
  921. Pos.X = 19
  922. Pos.Y = 34
  923.  
  924. Call FindLegalPos(.Users(LoopC).Id, Pos.map, Pos.X, Pos.Y)
  925. Call WarpUserChar(.Users(LoopC).Id, Pos.map, Pos.X, Pos.Y, False)
  926. Else
  927. .Users(LoopC).Team = 1
  928. Pos.map = 212
  929. Pos.X = 74
  930. Pos.Y = 24
  931.  
  932. Call FindLegalPos(.Users(LoopC).Id, Pos.map, Pos.X, Pos.Y)
  933. Call WarpUserChar(.Users(LoopC).Id, Pos.map, Pos.X, Pos.Y, False)
  934.  
  935. End If
  936. End If
  937. Next LoopC
  938. End With
  939.  
  940. End Sub
  941. Public Sub CastleMode_UserRevive(ByVal UserIndex As Integer)
  942.  
  943. Dim LoopC As Integer
  944. Dim Pos As WorldPos
  945.  
  946. With UserList(UserIndex)
  947. If .flags.SlotEvent > 0 Then
  948. Call RevivirUsuario(UserIndex)
  949.  
  950.  
  951. Pos.map = 212
  952. Pos.X = RandomNumber(20, 80)
  953. Pos.Y = RandomNumber(20, 80)
  954.  
  955. Call ClosestLegalPos(Pos, Pos)
  956. StatsEvent UserIndex
  957. 'benjakpoCall FindLegalPos(Userindex, Pos.Map, Pos.X, Pos.Y)
  958. Call WarpUserChar(UserIndex, Pos.map, Pos.X, Pos.Y, True)
  959.  
  960. End If
  961. End With
  962. End Sub
  963.  
  964. Public Sub FinishCastleMode(ByVal SlotEvent As Byte, ByVal UserEventSlot As Integer)
  965. Dim LoopC As Integer
  966. Dim strTemp As String
  967. Dim NpcIndex As Integer
  968. Dim MiObj As Obj
  969.  
  970. With Events(SlotEvent)
  971. For LoopC = LBound(.Users()) To UBound(.Users())
  972. If .Users(LoopC).Id > 0 Then
  973. If .Users(LoopC).Team = .Users(UserEventSlot).Team Then
  974. If LoopC = UserEventSlot Then
  975. CastleMode_Premio .Users(LoopC).Id, True
  976. Else
  977. CastleMode_Premio .Users(LoopC).Id, False
  978. End If
  979.  
  980. If strTemp = vbNullString Then
  981. strTemp = UserList(.Users(LoopC).Id).Name
  982. Else
  983. strTemp = strTemp & ", " & UserList(.Users(LoopC).Id).Name
  984. End If
  985. End If
  986. End If
  987. Next LoopC
  988.  
  989.  
  990. CloseEvent SlotEvent, "CastleMode» Ha finalizado. Ha ganado el equipo de " & UCase$(strTemp)
  991. End With
  992.  
  993. End Sub
  994.  
  995. Private Sub CastleMode_Premio(ByVal UserIndex As Integer, ByVal KillRey As Boolean)
  996.  
  997. ' Entregamos el premio del CastleMode
  998. Dim MiObj As Obj
  999.  
  1000. With UserList(UserIndex)
  1001. .Stats.puntos = .Stats.puntos + 10
  1002. WriteConsoleMsg UserIndex, "Felicitaciones, has recibido 5 Canjes por haber ganado el evento!", FontTypeNames.FONTTYPE_INFO
  1003.  
  1004. If KillRey Then
  1005. WriteConsoleMsg UserIndex, "Hemos notado que has aniquilado con la vida del rey oponente. ¡FELICITACIONES! Aquí tienes tu recompensa! 5 Canjes EXTRAS!!!", FontTypeNames.FONTTYPE_INFO
  1006. .Stats.puntos = .Stats.puntos + 5
  1007. End If
  1008.  
  1009. MiObj.objindex = 899
  1010. MiObj.Amount = 1
  1011.  
  1012. If Not MeterItemEnInventario(UserIndex, MiObj) Then
  1013. Call TirarItemAlPiso(.Pos, MiObj)
  1014. End If
  1015.  
  1016. MiObj.objindex = 900
  1017. MiObj.Amount = 1
  1018.  
  1019. If Not MeterItemEnInventario(UserIndex, MiObj) Then
  1020. Call TirarItemAlPiso(.Pos, MiObj)
  1021. End If
  1022.  
  1023. .Stats.TorneosGanados = .Stats.TorneosGanados + 1
  1024.  
  1025. WriteUpdateUserStats UserIndex
  1026. End With
  1027. End Sub
  1028. ' FIN EVENTO CASTLE MODE #####################################
  1029.  
  1030. ' ###################### EVENTO DAGA RUSA ###########################
  1031. Public Sub InitDagaRusa(ByVal SlotEvent As Byte)
  1032.  
  1033. Dim LoopC As Integer
  1034. Dim NpcIndex As Integer
  1035. Dim Pos As WorldPos
  1036.  
  1037. Dim Num As Integer
  1038.  
  1039. With Events(SlotEvent)
  1040. For LoopC = LBound(.Users()) To UBound(.Users())
  1041. If .Users(LoopC).Id > 0 Then
  1042. Call WarpUserChar(.Users(LoopC).Id, 211, 21 + Num, 60, False)
  1043. Num = Num + 1
  1044. Call WriteUserInEvent(.Users(LoopC).Id)
  1045. End If
  1046. Next LoopC
  1047.  
  1048. Pos.map = 211
  1049. Pos.X = 21
  1050. Pos.Y = 59
  1051. NpcIndex = SpawnNpc(704, Pos, False, False)
  1052.  
  1053. If NpcIndex <> 0 Then
  1054. Npclist(NpcIndex).Movement = NpcDagaRusa
  1055. Npclist(NpcIndex).flags.SlotEvent = SlotEvent
  1056. Npclist(NpcIndex).flags.InscribedPrevio = .Inscribed
  1057. .NpcIndex = NpcIndex
  1058.  
  1059. DagaRusa_MoveNpc NpcIndex, True
  1060. End If
  1061.  
  1062.  
  1063. .TimeCount = 10
  1064. End With
  1065.  
  1066.  
  1067. End Sub
  1068. Public Function DagaRusa_NextUser(ByVal SlotEvent As Byte) As Byte
  1069. Dim LoopC As Integer
  1070.  
  1071. DagaRusa_NextUser = 0
  1072.  
  1073. With Events(SlotEvent)
  1074. For LoopC = LBound(.Users()) To UBound(.Users())
  1075. If (.Users(LoopC).Id > 0) And (.Users(LoopC).value = 0) Then
  1076. DagaRusa_NextUser = .Users(LoopC).Id
  1077. '.Users(LoopC).Value = 1
  1078. Exit For
  1079. End If
  1080. Next LoopC
  1081. End With
  1082.  
  1083. End Function
  1084. Public Sub DagaRusa_ResetRonda(ByVal SlotEvent As Byte)
  1085.  
  1086. Dim LoopC As Integer
  1087.  
  1088. With Events(SlotEvent)
  1089. For LoopC = LBound(.Users()) To UBound(.Users())
  1090.  
  1091. .Users(LoopC).value = 0
  1092. Next LoopC
  1093.  
  1094. End With
  1095. End Sub
  1096. Private Sub DagaRusa_CheckWin(ByVal SlotEvent As Byte)
  1097.  
  1098. Dim UserIndex As Integer
  1099. Dim MiObj As Obj
  1100.  
  1101. With Events(SlotEvent)
  1102. If .Inscribed = 1 Then
  1103. UserIndex = SearchLastUserEvent(SlotEvent)
  1104. DagaRusa_Premio UserIndex
  1105.  
  1106.  
  1107. Call QuitarNPC(.NpcIndex)
  1108. CloseEvent SlotEvent
  1109.  
  1110. End If
  1111. End With
  1112. End Sub
  1113.  
  1114. Private Sub DagaRusa_Premio(ByVal UserIndex As Integer)
  1115.  
  1116. Dim MiObj As Obj
  1117.  
  1118. With UserList(UserIndex)
  1119. MiObj.Amount = 1
  1120. MiObj.objindex = 1037
  1121.  
  1122. SendData SendTarget.ToAll, 0, PrepareMessageConsoleMsg("Daga Rusa> El ganador es " & UserList(UserIndex).Name & ". Felicitaciones para el personaje, quien se ha ganado 5 Canjes y una MD! (Espada mata dragones)", FontTypeNames.FONTTYPE_GUILD)
  1123.  
  1124. If Not MeterItemEnInventario(UserIndex, MiObj) Then
  1125. Call TirarItemAlPiso(UserList(UserIndex).Pos, MiObj)
  1126. End If
  1127.  
  1128. .Stats.puntos = .Stats.puntos + 5
  1129.  
  1130. .Stats.TorneosGanados = .Stats.TorneosGanados + 1
  1131.  
  1132. WriteUpdateUserStats UserIndex
  1133.  
  1134. End With
  1135. End Sub
  1136. Public Sub DagaRusa_AttackUser(ByVal UserIndex As Integer, ByVal NpcIndex As Integer)
  1137.  
  1138. Dim N As Integer
  1139. Dim Slot As Byte
  1140.  
  1141. With UserList(UserIndex)
  1142.  
  1143. N = 10
  1144.  
  1145. If RandomNumber(1, 100) <= N Then
  1146.  
  1147. ' Sound
  1148. SendData SendTarget.ToPCArea, UserIndex, PrepareMessagePlayWave(SND_IMPACTO, .Pos.X, .Pos.Y)
  1149. ' Fx
  1150. SendData SendTarget.ToPCArea, UserIndex, PrepareMessageCreateFX(.Char.CharIndex, FXSANGRE, 0)
  1151. ' Cambio de Heading
  1152. ChangeNPCChar NpcIndex, Npclist(NpcIndex).Char.body, Npclist(NpcIndex).Char.Head, SOUTH
  1153. 'Apuñalada en el piso
  1154. SendData SendTarget.ToPCArea, UserIndex, PrepareMessageCreateDamage(UserList(UserIndex).Pos.X, UserList(UserIndex).Pos.Y, 1000, DAMAGE_PUÑAL)
  1155.  
  1156. WriteConsoleMsg UserIndex, "¡Has sido apuñalado por 1.000!", FontTypeNames.FONTTYPE_FIGHT
  1157.  
  1158. Slot = .flags.SlotEvent
  1159.  
  1160.  
  1161. Call UserDie(UserIndex)
  1162. EventosDS.AbandonateEvent (UserIndex)
  1163. Call DagaRusa_CheckWin(Slot)
  1164.  
  1165.  
  1166. Else
  1167. ' Sound
  1168. SendData SendTarget.ToPCArea, UserIndex, PrepareMessagePlayWave(SND_IMPACTO, .Pos.X, .Pos.Y)
  1169. ' Fx
  1170. SendData SendTarget.ToPCArea, UserIndex, PrepareMessageCreateFX(.Char.CharIndex, FXSANGRE, 0)
  1171. ' Cambio de Heading
  1172. ChangeNPCChar NpcIndex, Npclist(NpcIndex).Char.body, Npclist(NpcIndex).Char.Head, SOUTH
  1173.  
  1174. WriteConsoleMsg UserIndex, "¡Parece que no te he apuñalado, ya verás!", FontTypeNames.FONTTYPE_FIGHT
  1175. ' SendData SendTarget.ToPCArea, Userindex, PrepareMessageCreateDamage(UserList(Userindex).Pos.X, UserList(Userindex).Pos.Y, 1000, DAMAGE_PUÑAL)
  1176. End If
  1177.  
  1178.  
  1179.  
  1180. End With
  1181. End Sub
  1182.  
  1183. ' FIN EVENTO DAGA RUSA ###########################################
  1184. Private Function SelectModalityDeathMatch(ByVal SlotEvent As Byte) As Integer
  1185. Dim Random As Integer
  1186.  
  1187. Randomize
  1188. Random = RandomNumber(1, 8)
  1189.  
  1190. With Events(SlotEvent)
  1191. Select Case Random
  1192. Case 1 ' Zombie
  1193. .CharBody = 11
  1194. Case 2 ' Golem
  1195. .CharBody = 11
  1196. Case 3 ' Araña
  1197. .CharBody = 42
  1198. Case 4 ' Asesino
  1199. .CharBody = 11 '48
  1200. Case 5 'Medusa suprema
  1201. .CharBody = 151
  1202. Case 6 'Dragón azul
  1203. .CharBody = 42 '247
  1204. Case 7 'Viuda negra 185
  1205. .CharBody = 185
  1206. Case 8 'Tigre salvaje
  1207. .CharBody = 147
  1208. End Select
  1209. End With
  1210. End Function
  1211.  
  1212. ' DEATHMATCH ####################################################
  1213. Private Sub InitDeathMatch(ByVal SlotEvent As Byte)
  1214.  
  1215. Dim LoopC As Integer
  1216. Dim Pos As WorldPos
  1217.  
  1218. Call SelectModalityDeathMatch(SlotEvent)
  1219.  
  1220. With Events(SlotEvent)
  1221. For LoopC = LBound(.Users()) To UBound(.Users())
  1222. If .Users(LoopC).Id > 0 Then
  1223. .Users(LoopC).Team = LoopC
  1224. .Users(LoopC).Selected = 1
  1225.  
  1226. ChangeBodyEvent SlotEvent, .Users(LoopC).Id, True
  1227. UserList(.Users(LoopC).Id).showName = False
  1228. RefreshCharStatus .Users(LoopC).Id
  1229.  
  1230.  
  1231. Pos.map = 211
  1232. Pos.X = RandomNumber(58, 84)
  1233. Pos.Y = RandomNumber(28, 44)
  1234.  
  1235. Call ClosestLegalPos(Pos, Pos)
  1236. Call WarpUserChar(.Users(LoopC).Id, Pos.map, Pos.X, Pos.Y, True)
  1237. End If
  1238.  
  1239. Next LoopC
  1240.  
  1241. .TimeCount = 20
  1242. End With
  1243.  
  1244. End Sub
  1245.  
  1246. Public Sub DeathMatch_UserDie(ByVal SlotEvent As Byte, ByVal UserIndex As Integer)
  1247. AbandonateEvent (UserIndex)
  1248.  
  1249. If Events(SlotEvent).Inscribed = 1 Then
  1250. UserIndex = SearchLastUserEvent(SlotEvent)
  1251. DeathMatch_Premio UserIndex
  1252. CloseEvent SlotEvent
  1253. End If
  1254. End Sub
  1255. Private Sub DeathMatch_Premio(ByVal UserIndex As Integer)
  1256. With UserList(UserIndex)
  1257. SendData SendTarget.ToAll, 0, PrepareMessageConsoleMsg("DeathMatch> El ganador es " & .Name & " quien se lleva 1 punto de torneo y 10 Canjes!!!.", FontTypeNames.FONTTYPE_GUILD)
  1258.  
  1259. .Stats.puntos = .Stats.puntos + 10
  1260.  
  1261. .Stats.TorneosGanados = .Stats.TorneosGanados + 1
  1262.  
  1263. WriteUpdateUserStats UserIndex
  1264.  
  1265. End With
  1266. End Sub
  1267.  
  1268. ' ENFRENTAMIENTOS ###############################################
  1269.  
  1270. Private Sub InitFights(ByVal SlotEvent As Byte)
  1271. 10 On Error GoTo error
  1272.  
  1273. 20 With Events(SlotEvent)
  1274. 30 Fight_SelectedTeam SlotEvent
  1275. 40 Fight_Combate SlotEvent
  1276. 50 End With
  1277. 60 Exit Sub
  1278.  
  1279. error:
  1280. 70 'LogEventos "[" & Err.Number & "] " & Err.Description & ") PROCEDIMIENTO : InitFights()"
  1281. End Sub
  1282. Private Sub Fight_SelectedTeam(ByVal SlotEvent As Byte)
  1283.  
  1284. 10 On Error GoTo error
  1285.  
  1286. ' En los enfrentamientos utilizamos este procedimiento para seleccionar los grupos o bien el usuario queda solo por 1vs1.
  1287. Dim LoopX As Integer
  1288. Dim LoopY As Integer
  1289. Dim Team As Byte
  1290.  
  1291. 20 Team = 1
  1292.  
  1293. 30 With Events(SlotEvent)
  1294. 40 For LoopX = LBound(.Users()) To UBound(.Users()) Step .TeamCant
  1295. 50 For LoopY = 0 To (.TeamCant - 1)
  1296. 60 .Users(LoopX + LoopY).Team = Team
  1297. 70 Next LoopY
  1298.  
  1299. 80 Team = Team + 1
  1300. 90 Next LoopX
  1301.  
  1302. 100 End With
  1303.  
  1304. 110 Exit Sub
  1305.  
  1306. error:
  1307. 120 'LogEventos "[" & Err.Number & "] " & Err.Description & ") PROCEDIMIENTO : Fight_SelectedTeam()"
  1308. End Sub
  1309.  
  1310. Private Sub Fight_WarpTeam(ByVal SlotEvent As Byte, _
  1311. ByVal ArenaSlot As Byte, _
  1312. ByVal TeamEvent As Byte, _
  1313. ByVal IsContrincante As Boolean, _
  1314. ByRef StrTeam As String)
  1315.  
  1316. 10 On Error GoTo error
  1317.  
  1318. Dim LoopC As Integer
  1319. Dim strTemp As String, strTemp1 As String, strTemp2 As String
  1320.  
  1321. 20 With Events(SlotEvent)
  1322. 30 For LoopC = LBound(.Users()) To UBound(.Users())
  1323. 40 If .Users(LoopC).Id > 0 And .Users(LoopC).Team = TeamEvent Then
  1324. 50 If IsContrincante Then
  1325. 60 Call EventWarpUser(.Users(LoopC).Id, MapEvent.Fight(ArenaSlot).map, MapEvent.Fight(ArenaSlot).X + MAP_TILE_VS, MapEvent.Fight(ArenaSlot).Y + MAP_TILE_VS)
  1326.  
  1327. 90 Else
  1328. 100 Call EventWarpUser(.Users(LoopC).Id, MapEvent.Fight(ArenaSlot).map, MapEvent.Fight(ArenaSlot).X, MapEvent.Fight(ArenaSlot).Y)
  1329.  
  1330. 130 End If
  1331.  
  1332. 140 If StrTeam = vbNullString Then
  1333. 150 StrTeam = UserList(.Users(LoopC).Id).Name
  1334. 160 Else
  1335. 170 StrTeam = StrTeam & "-" & UserList(.Users(LoopC).Id).Name
  1336. 180 End If
  1337.  
  1338. 190 .Users(LoopC).value = 1
  1339. 200 .Users(LoopC).MapFight = ArenaSlot
  1340.  
  1341. 210 UserList(.Users(LoopC).Id).Counters.TimeFight = 10
  1342. 220 Call WriteUserInEvent(.Users(LoopC).Id)
  1343. 230 End If
  1344. 240 Next LoopC
  1345. 250 End With
  1346.  
  1347. 260 Exit Sub
  1348.  
  1349. error:
  1350. 270 'LogEventos "[" & Err.Number & "] " & Err.Description & ") PROCEDIMIENTO : Fight_WarpTeam()"
  1351. End Sub
  1352.  
  1353. Private Function Fight_Search_Enfrentamiento(ByVal UserIndex As Integer, ByVal UserTeam As Byte, ByVal SlotEvent As Byte) As Byte
  1354. 10 On Error GoTo error
  1355.  
  1356. ' Chequeamos que tengamos contrincante para luchar.
  1357. Dim LoopC As Integer
  1358.  
  1359. 20 Fight_Search_Enfrentamiento = 0
  1360.  
  1361. 30 With Events(SlotEvent)
  1362. 40 For LoopC = LBound(.Users()) To UBound(.Users())
  1363. 50 If .Users(LoopC).Id > 0 And .Users(LoopC).value = 0 Then
  1364. 60 If .Users(LoopC).Id <> UserIndex And .Users(LoopC).Team <> UserTeam Then
  1365. 70 Fight_Search_Enfrentamiento = .Users(LoopC).Team
  1366. 80 Exit For
  1367. 90 End If
  1368. 100 End If
  1369. 110 Next LoopC
  1370.  
  1371. 120 End With
  1372.  
  1373. 130 Exit Function
  1374.  
  1375. error:
  1376. 140 'LogEventos "[" & Err.Number & "] " & Err.Description & ") PROCEDIMIENTO : Fight_Search_Enfrentamiento()"
  1377. End Function
  1378.  
  1379. Private Sub NewRound(ByVal SlotEvent As Byte)
  1380. Dim LoopC As Long
  1381. Dim Count As Long
  1382.  
  1383. 10 With Events(SlotEvent)
  1384. 20 Count = 0
  1385.  
  1386. 30 For LoopC = LBound(.Users()) To UBound(.Users())
  1387. 40 If .Users(LoopC).Id > 0 Then
  1388. ' Hay esperando
  1389. 50 If .Users(LoopC).value = 0 Then
  1390. 60 Exit Sub
  1391. 70 End If
  1392.  
  1393. ' Hay luchando
  1394. 80 If .Users(LoopC).MapFight > 0 Then
  1395. 90 Exit Sub
  1396. 100 End If
  1397. 110 End If
  1398. 120 Next LoopC
  1399.  
  1400. 130 For LoopC = LBound(.Users()) To UBound(.Users())
  1401. 140 .Users(LoopC).value = 0
  1402. 150 Next LoopC
  1403.  
  1404. 'LogEventos "Se reinicio la informacion de los fights()"
  1405.  
  1406. 160 End With
  1407. End Sub
  1408. Private Function FreeSlotArena() As Byte
  1409. Dim LoopC As Integer
  1410.  
  1411. 10 FreeSlotArena = 0
  1412.  
  1413. 20 For LoopC = 1 To MAX_MAP_FIGHT
  1414. 30 If MapEvent.Fight(LoopC).Run = False Then
  1415. 40 FreeSlotArena = LoopC
  1416. 50 Exit For
  1417. 60 End If
  1418. 70 Next LoopC
  1419. End Function
  1420. Private Sub Fight_Combate(ByVal SlotEvent As Byte)
  1421. 10 On Error GoTo error
  1422.  
  1423. ' Buscamos una arena disponible y mandamos la mayor cantidad de usuarios disponibles.
  1424. Dim LoopC As Integer
  1425. Dim FreeArena As Byte
  1426. Dim OponentTeam As Byte
  1427. Dim strTemp As String
  1428. Dim strTeam1 As String
  1429. Dim strTeam2 As String
  1430.  
  1431. 20 With Events(SlotEvent)
  1432. cheking:
  1433. 30 For LoopC = LBound(.Users()) To UBound(.Users())
  1434. 40 If .Users(LoopC).Id > 0 And .Users(LoopC).value = 0 Then
  1435. 50 FreeArena = FreeSlotArena()
  1436.  
  1437. 60 If FreeArena > 0 Then
  1438. 70 OponentTeam = Fight_Search_Enfrentamiento(.Users(LoopC).Id, .Users(LoopC).Team, SlotEvent)
  1439.  
  1440. 80 If OponentTeam > 0 Then
  1441. 90 StatsEvent .Users(LoopC).Id
  1442. 100 Fight_WarpTeam SlotEvent, FreeArena, .Users(LoopC).Team, False, strTeam1
  1443. 110 Fight_WarpTeam SlotEvent, FreeArena, OponentTeam, True, strTeam2
  1444. 120 MapEvent.Fight(FreeArena).Run = True
  1445.  
  1446. 130 strTemp = "Duelos " & Events(SlotEvent).TeamCant & "vs" & Events(SlotEvent).TeamCant & "» "
  1447. 140 strTemp = strTemp & strTeam1 & " vs " & strTeam2
  1448. 150 SendData SendTarget.ToAll, 0, PrepareMessageConsoleMsg(strTemp, FontTypeNames.FONTTYPE_GUILD)
  1449.  
  1450. 160 strTemp = vbNullString
  1451. 170 strTeam1 = vbNullString
  1452. 180 strTeam2 = vbNullString
  1453.  
  1454. 190 Else
  1455. ' Pasa de ronda automaticamente
  1456. 200 .Users(LoopC).value = 1
  1457. 210 WriteConsoleMsg .Users(LoopC).Id, "Hemos notado que no tienes un adversario. Pasaste a la siguiente ronda.", FontTypeNames.FONTTYPE_INFO
  1458. 220 NewRound SlotEvent
  1459. GoTo cheking:
  1460. 230 End If
  1461. 240 End If
  1462. 250 End If
  1463. 260 Next LoopC
  1464.  
  1465. 270 End With
  1466.  
  1467. 280 Exit Sub
  1468.  
  1469. error:
  1470. 290 'LogEventos "[" & Err.Number & "] " & Err.Description & ") PROCEDIMIENTO : Fight_Combate()"
  1471. End Sub
  1472. Private Sub ResetValue(ByVal SlotEvent As Byte)
  1473. Dim LoopC As Integer
  1474.  
  1475. 10 With Events(SlotEvent)
  1476. 20 For LoopC = LBound(.Users()) To UBound(.Users())
  1477. 30 .Users(LoopC).value = 0
  1478. 40 Next LoopC
  1479. 50 End With
  1480. End Sub
  1481. Private Function CheckTeam_UserDie(ByVal SlotEvent As Integer, ByVal TeamUser As Byte) As Boolean
  1482.  
  1483. 10 On Error GoTo error
  1484.  
  1485. Dim LoopC As Integer
  1486. ' Encontramos a uno del Team vivo, significa que no hay terminación del duelo.
  1487.  
  1488.  
  1489. 20 With Events(SlotEvent)
  1490. 30 For LoopC = LBound(.Users()) To UBound(.Users())
  1491. 40 If .Users(LoopC).Id > 0 Then
  1492. 50 If .Users(LoopC).Team = TeamUser Then
  1493. 60 If UserList(.Users(LoopC).Id).flags.Muerto = 0 Then
  1494. 70 CheckTeam_UserDie = False
  1495. 80 Exit Function
  1496. 90 End If
  1497. 100 End If
  1498. 110 End If
  1499. 120 Next LoopC
  1500.  
  1501. 130 CheckTeam_UserDie = True
  1502.  
  1503. 140 End With
  1504.  
  1505. 150 Exit Function
  1506.  
  1507. error:
  1508. 160 'LogEventos "[" & Err.Number & "] " & Err.Description & ") PROCEDIMIENTO : CheckTeam_UserDie()"
  1509. End Function
  1510. Private Sub Team_UserDie(ByVal SlotEvent As Byte, ByVal TeamSlot As Byte)
  1511. 10 On Error GoTo error
  1512.  
  1513. Dim LoopC As Integer
  1514. 20 With Events(SlotEvent)
  1515.  
  1516.  
  1517. 30 For LoopC = LBound(.Users()) To UBound(.Users())
  1518. 40 If .Users(LoopC).Id > 0 Then
  1519. 50 If .Users(LoopC).Team = TeamSlot Then
  1520. 60 AbandonateEvent .Users(LoopC).Id
  1521. 70 End If
  1522. 80 End If
  1523. 90 Next LoopC
  1524.  
  1525. 100 End With
  1526.  
  1527. 110 Exit Sub
  1528.  
  1529. error:
  1530. 120 'LogEventos "[" & Err.Number & "] " & Err.Description & ") PROCEDIMIENTO : Team_UserDie()"
  1531. End Sub
  1532. Public Function Fight_CheckContinue(ByVal UserIndex As Integer, ByVal SlotEvent As Byte, ByVal TeamSlot As Byte) As Boolean
  1533. ' Esta función devuelve un TRUE cuando el enfrentamiento puede seguir.
  1534.  
  1535. Dim LoopC As Integer, cant As Integer
  1536.  
  1537. 10 With Events(SlotEvent)
  1538.  
  1539. 20 Fight_CheckContinue = False
  1540.  
  1541. 30 For LoopC = LBound(.Users()) To UBound(.Users())
  1542. ' User válido
  1543. 40 If .Users(LoopC).Id > 0 And .Users(LoopC).Id <> UserIndex Then
  1544. 50 If .Users(LoopC).Team = TeamSlot Then
  1545. 60 If UserList(.Users(LoopC).Id).flags.Muerto = 0 Then
  1546. 70 Fight_CheckContinue = True
  1547. 80 Exit For
  1548. 90 End If
  1549. 100 End If
  1550. 110 End If
  1551. 120 Next LoopC
  1552.  
  1553. 130 End With
  1554.  
  1555. 140 Exit Function
  1556.  
  1557. error:
  1558. 150 'LogEventos "[" & Err.Number & "] " & Err.Description & ") PROCEDIMIENTO : Team_CheckContinue()"
  1559. End Function
  1560. Public Sub Fight_WinForzado(ByVal UserIndex As Integer, ByVal SlotEvent As Byte, ByVal MapFight As Byte)
  1561. 10 On Error GoTo error
  1562.  
  1563. Dim LoopC As Integer
  1564. Dim strTempWin As String
  1565. Dim TeamWin As Byte
  1566.  
  1567. 20 With Events(SlotEvent)
  1568.  
  1569. 'LogEventos "El personaje " & UserList(UserIndex).Name & " deslogeó en lucha."
  1570.  
  1571. 30 For LoopC = LBound(.Users()) To UBound(.Users())
  1572. 40 With .Users(LoopC)
  1573. 50 If .Id > 0 And UserIndex <> .Id Then
  1574. 60 If .MapFight = MapFight Then
  1575. 70 If strTempWin = vbNullString Then
  1576. 80 strTempWin = UserList(.Id).Name
  1577. 90 Else
  1578. 100 strTempWin = strTempWin & "-" & UserList(.Id).Name
  1579. 110 End If
  1580.  
  1581. '.value = 0
  1582. 130 .MapFight = 0
  1583.  
  1584. 140 EventWarpUser .Id, 211, 30, 21
  1585. WriteConsoleMsg .Id, "Felicitaciones. Has ganado el enfrentamiento", FontTypeNames.FONTTYPE_INFO
  1586.  
  1587. 180 TeamWin = .Team
  1588. 190 End If
  1589. 200 End If
  1590. 210 End With
  1591. 220 Next LoopC
  1592.  
  1593. MapEvent.Fight(MapFight).Run = False
  1594.  
  1595.  
  1596. 230 If strTempWin <> vbNullString Then SendData SendTarget.ToAll, 0, PrepareMessageConsoleMsg("Duelos " & Events(SlotEvent).TeamCant & "vs" & Events(SlotEvent).TeamCant & "» Duelo ganado por " & strTempWin & ".", FontTypeNames.FONTTYPE_GUILD)
  1597.  
  1598. ' Nos fijamos si resetea el Value
  1599. 240 Call NewRound(SlotEvent)
  1600.  
  1601. ' Nos fijamos si eran los últimos o si podemos mandar otro combate..
  1602. 250 If TeamCant(SlotEvent, TeamWin) = .Inscribed Then
  1603. 260 Fight_SearchTeamWin SlotEvent, TeamWin
  1604. 270 CloseEvent SlotEvent
  1605. 280 Else
  1606. 290 Fight_Combate SlotEvent
  1607. 300 End If
  1608.  
  1609. 310 End With
  1610.  
  1611. 320 Exit Sub
  1612.  
  1613. error:
  1614. 330 'LogEventos "[" & Err.Number & "] " & Err.Description & ") PROCEDIMIENTO : Fight_WinForzado()"
  1615. End Sub
  1616. Private Sub StatsEvent(ByVal UserIndex As Integer)
  1617. 10 On Error GoTo error
  1618.  
  1619. 20 With UserList(UserIndex)
  1620. 30 If .flags.Muerto Then
  1621. 40 Call RevivirUsuario(UserIndex)
  1622. 50 Exit Sub
  1623. 60 End If
  1624.  
  1625. 70 .Stats.MinHp = .Stats.MaxHp
  1626. 80 .Stats.MinMAN = .Stats.MaxMAN
  1627. 90 .Stats.MinAGU = 100
  1628. 100 .Stats.MinHam = 100
  1629. .Stats.MinSta = .Stats.MaxSta
  1630.  
  1631. 110 WriteUpdateUserStats UserIndex
  1632.  
  1633. 120 End With
  1634.  
  1635. 130 Exit Sub
  1636.  
  1637. error:
  1638. 140 'LogEventos "[" & Err.Number & "] " & Err.Description & ") PROCEDIMIENTO : StatsEvent()"
  1639. End Sub
  1640.  
  1641. Private Function SearchTeamAttacker(ByVal TeamUser As Byte)
  1642.  
  1643. End Function
  1644. Public Sub Fight_UserDie(ByVal SlotEvent As Byte, ByVal SlotUserEvent As Byte, ByVal AttackerIndex As Integer)
  1645. 10 On Error GoTo error
  1646. Dim TeamSlot As Byte
  1647. Dim LoopC As Integer
  1648. Dim strTempWin As String
  1649. Dim TeamWin As Byte
  1650. Dim MapFight As Byte
  1651.  
  1652. ' Aca se hace que el que gané no siga luchando sino que espere.
  1653.  
  1654. 20 With Events(SlotEvent)
  1655. 30 TeamSlot = .Users(SlotUserEvent).Team
  1656. 40 TeamWin = .Users(UserList(AttackerIndex).flags.SlotUserEvent).Team
  1657.  
  1658. 50 If CheckTeam_UserDie(SlotEvent, TeamSlot) = False Then Exit Sub
  1659.  
  1660. 60 For LoopC = LBound(.Users()) To UBound(.Users())
  1661. 70 If .Users(LoopC).Id > 0 Then
  1662. 80 With .Users(LoopC)
  1663. 90 If .Team = TeamWin Then
  1664. 100 StatsEvent .Id
  1665. 110
  1666. 120 If strTempWin = vbNullString Then
  1667. 130 strTempWin = UserList(.Id).Name
  1668. 140 Else
  1669. 150 strTempWin = strTempWin & "-" & UserList(.Id).Name
  1670. 160 End If
  1671.  
  1672.  
  1673. MapFight = .MapFight
  1674. 170
  1675.  
  1676. '.value = 0
  1677. 180 .MapFight = 0
  1678. 190 EventWarpUser .Id, 211, 30, 21
  1679. WriteConsoleMsg .Id, "Felicitaciones. Has ganado el enfrentamiento", FontTypeNames.FONTTYPE_INFO
  1680.  
  1681. ' / Update color char team
  1682. 220 RefreshCharStatus (.Id)
  1683. 230 End If
  1684. 240 End With
  1685. 250 End If
  1686. 260 Next LoopC
  1687.  
  1688. MapEvent.Fight(MapFight).Run = False
  1689.  
  1690. ' Abandono del user/team
  1691. 270 Team_UserDie SlotEvent, TeamSlot
  1692.  
  1693. 280 If strTempWin <> vbNullString Then SendData SendTarget.ToAll, 0, PrepareMessageConsoleMsg("Duelos " & Events(SlotEvent).TeamCant & "vs" & Events(SlotEvent).TeamCant & "» Enfrentamiento ganado por " & strTempWin & ".", FontTypeNames.FONTTYPE_GUILD)
  1694.  
  1695. ' // Se fija de poder pasar a la siguiente ronda o esperar a los combates que faltan.
  1696. 290 Call NewRound(SlotEvent)
  1697.  
  1698. ' Si la cantidad es igual al inscripto quedó final.
  1699. 300 If TeamCant(SlotEvent, TeamWin) = .Inscribed Then
  1700. 310 Fight_SearchTeamWin SlotEvent, TeamWin
  1701. 320 CloseEvent SlotEvent
  1702. 330 Else
  1703. 340 Fight_Combate SlotEvent
  1704. 350 End If
  1705.  
  1706. 360 End With
  1707.  
  1708. 370 Exit Sub
  1709.  
  1710. error:
  1711. 380 'LogEventos "[" & Err.Number & "] " & Err.Description & ") PROCEDIMIENTO : Fight_UserDie()" & " AT LINE: " & Erl
  1712. End Sub
  1713. Private Function TeamCant(ByVal SlotEvent As Byte, ByVal TeamSlot As Byte) As Byte
  1714.  
  1715. 10 On Error GoTo error
  1716. ' Devuelve la cantidad de miembros que tiene un clan
  1717. Dim LoopC As Integer
  1718.  
  1719. 20 TeamCant = 0
  1720.  
  1721. 30 With Events(SlotEvent)
  1722. 40 For LoopC = LBound(.Users()) To UBound(.Users())
  1723. 50 If .Users(LoopC).Team = TeamSlot Then
  1724. 60 TeamCant = TeamCant + 1
  1725. 70 End If
  1726. 80 Next LoopC
  1727. 90 End With
  1728.  
  1729. 100 Exit Function
  1730.  
  1731. error:
  1732. 110 'LogEventos "[" & Err.Number & "] " & Err.Description & ") PROCEDIMIENTO : TeamCant()"
  1733. End Function
  1734. Private Sub Fight_SearchTeamWin(ByVal SlotEvent As Byte, ByVal TeamWin As Byte)
  1735.  
  1736. 10 On Error GoTo error
  1737.  
  1738. Dim LoopC As Integer
  1739. Dim strTemp As String
  1740. Dim strReWard As String
  1741.  
  1742.  
  1743. 20 With Events(SlotEvent)
  1744. 30 For LoopC = LBound(.Users()) To UBound(.Users())
  1745. 40 If .Users(LoopC).Id > 0 And .Users(LoopC).Team = TeamWin Then
  1746. WriteConsoleMsg .Users(LoopC).Id, "Has ganado el evento. ¡Felicitaciones!", FontTypeNames.FONTTYPE_INFO
  1747. UserList(.Users(LoopC).Id).Stats.puntos = UserList(.Users(LoopC).Id).Stats.puntos + 10
  1748. 60 'PrizeUser .Users(LoopC).Id, False
  1749.  
  1750. 70 If strTemp = vbNullString Then
  1751. 80 strTemp = UserList(.Users(LoopC).Id).Name
  1752. 90 Else
  1753. 100 strTemp = strTemp & ", " & UserList(.Users(LoopC).Id).Name
  1754. 110 End If
  1755. 120 End If
  1756. 130 Next LoopC
  1757.  
  1758.  
  1759. 140 If .TeamCant > 1 Then
  1760. 150 If .GldInscription > 0 Or .DspInscription > 0 Then strReWard = "Los participantes han recibido 10 CANJES y "
  1761. 160 If .GldInscription > 0 Then strReWard = strReWard & .GldInscription * .Quotas & " Monedas de oro. "
  1762. 170 If .DspInscription > 0 Then strReWard = strReWard & .DspInscription * .Quotas & " Monedas DSP. "
  1763. If .CanjeInscription > 0 Then strReWard = strReWard & .CanjeInscription * .Quotas & " Canjes."
  1764.  
  1765. 180 SendData SendTarget.ToAll, 0, PrepareMessageConsoleMsg("Duelos " & .TeamCant & "vs" & .TeamCant & _
  1766. " Evento terminado. Felicitamos a " & strTemp & " por haber ganado el torneo." & vbCrLf & strReWard, FontTypeNames.FONTTYPE_PREMIUM)
  1767. 190 Else
  1768. 200 If .GldInscription > 0 Or .DspInscription > 0 Then strReWard = "El participante recibió 10 CANJES y "
  1769. 210 If .GldInscription > 0 Then strReWard = strReWard & .GldInscription * .Quotas & " Monedas de oro"
  1770. 220 If .DspInscription > 0 Then strReWard = strReWard & " y " & .DspInscription * .Quotas & " Monedas DSP."
  1771. If .CanjeInscription > 0 Then strReWard = strReWard & .CanjeInscription * .Quotas & " Canjes."
  1772.  
  1773. 230 SendData SendTarget.ToAll, 0, PrepareMessageConsoleMsg("Duelos " & .TeamCant & "vs" & .TeamCant & " Evento terminado. Felicitamos a " & strTemp & _
  1774. " por haber ganado el evento." & vbCrLf & strReWard, FontTypeNames.FONTTYPE_PREMIUM)
  1775. 240 End If
  1776. CloseEvent SlotEvent
  1777.  
  1778. 250 End With
  1779.  
  1780. 'aqui
  1781. 260 Exit Sub
  1782.  
  1783. error:
  1784. 270 'LogEventos "[" & Err.Number & "] " & Err.Description & ") PROCEDIMIENTO : Fight_SearchTeamWin()"
  1785. End Sub
  1786.  
  1787.  
  1788. Private Sub EventWarpUser(ByVal UserIndex As Integer, ByVal map As Integer, ByVal X As Byte, ByVal Y As Byte)
  1789. 10 On Error GoTo error
  1790.  
  1791. ' Teletransportamos a cualquier usuario que cumpla con la regla de estar en un evento.
  1792.  
  1793. Dim Pos As WorldPos
  1794.  
  1795. 20 With UserList(UserIndex)
  1796. 30 Pos.map = map
  1797. 40 Pos.X = X
  1798. 50 Pos.Y = Y
  1799.  
  1800. 60 ClosestStablePos Pos, Pos
  1801. 70 WarpUserChar UserIndex, Pos.map, Pos.X, Pos.Y, False
  1802.  
  1803. 80 End With
  1804.  
  1805. 90 Exit Sub
  1806.  
  1807. error:
  1808. 100 'LogEventos "[" & Err.Number & "] " & Err.Description & ") PROCEDIMIENTO : EventWarpUser()"
  1809. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement