Advertisement
Luciano_fuentes

Canjes Sistemón.

Apr 19th, 2017
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Option Explicit
  2.  
  3. '####################################################
  4. 'Autor: Luciano (G Toyz)
  5. 'Creación: 17/04/2017
  6. 'Aclaración: -
  7. 'Ultima modificación:  -
  8. '
  9. '####################################################
  10.  
  11. Private Type tObjetos
  12.     ID As Integer
  13.     Precio As Integer
  14. End Type
  15.  
  16. Public Objetos() As tObjetos
  17. ''
  18. '
  19. Public Sub CargarObjetos()
  20.  
  21. '*********************************************************************************
  22. 'Autor: Luciano (G Toyz)
  23. 'Creación: 17/04/2017
  24. 'Aclaración: -
  25. 'Ultima modificación:  -
  26. '
  27. '*********************************************************************************
  28.  
  29.     Dim Leer As New clsIniReader, cantidadObjetos As Byte, LoopC As Long
  30.     Call Leer.Initialize(App.Path & "\Dat\Canjes.dat")
  31.    
  32.     cantidadObjetos = CByte(Leer.GetValue("INIT", "Objetos"))
  33.     ReDim Objetos(1 To cantidadObjetos) As tObjetos
  34.    
  35.     For LoopC = 1 To cantidadObjetos
  36.         With Objetos(LoopC)
  37.             .ID = CInt(Leer.GetValue("OBJETO" & LoopC, "ID"))
  38.             .Precio = CInt(Leer.GetValue("OBJETO" & LoopC, "PRECIO"))
  39.         End With
  40.     Next LoopC
  41.    
  42. End Sub
  43. ''
  44. '
  45. Public Sub ComprarObjeto(ByVal ID As Integer, ByVal ID_Objeto As Byte)
  46.  
  47. '*********************************************************************************
  48. 'Autor: Luciano (G Toyz)
  49. 'Creación: 17/04/2017
  50. 'Aclaración: -
  51. 'Ultima modificación:  -
  52. '
  53. '*********************************************************************************
  54.  
  55.     Dim Objeto As Obj
  56.  
  57.     With UserList(ID)
  58.         If .flags.Muerto = 1 Then
  59.             Call WriteConsoleMsg(ID, "¡Estás muerto!", FontTypeNames.FONTTYPE_INFOBOLD)
  60.             Exit Sub
  61.         End If
  62.        
  63.         If .Stats.Canjes < Objetos(ID_Objeto).Precio Then
  64.             Call WriteConsoleMsg(ID, "No tienes suficientes puntos de canjeo", FontTypeNames.FONTTYPE_INFOBOLD)
  65.             Exit Sub
  66.         End If
  67.        
  68.         Objeto.Amount = 1
  69.         Objeto.ObjIndex = Objetos(ID_Objeto).ID
  70.        
  71.         If MeterItemEnInventario(ID, Objeto) = False Then
  72.             Call WriteConsoleMsg(ID, "Tienes el inventario lleno", FontTypeNames.FONTTYPE_INFOBOLD)
  73.             Exit Sub
  74.         End If
  75.        
  76.         .Stats.Canjes = .Stats.Canjes - Objetos(ID_Objeto).Precio
  77.         Call WriteUpdateCanjes(ID)
  78.     End With
  79.    
  80. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement