Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Option Explicit
- '####################################################
- 'Autor: Luciano (G Toyz)
- 'Creación: 17/04/2017
- 'Aclaración: -
- 'Ultima modificación: -
- '
- '####################################################
- Private Type tObjetos
- ID As Integer
- Precio As Integer
- End Type
- Public Objetos() As tObjetos
- ''
- '
- Public Sub CargarObjetos()
- '*********************************************************************************
- 'Autor: Luciano (G Toyz)
- 'Creación: 17/04/2017
- 'Aclaración: -
- 'Ultima modificación: -
- '
- '*********************************************************************************
- Dim Leer As New clsIniReader, cantidadObjetos As Byte, LoopC As Long
- Call Leer.Initialize(App.Path & "\Dat\Canjes.dat")
- cantidadObjetos = CByte(Leer.GetValue("INIT", "Objetos"))
- ReDim Objetos(1 To cantidadObjetos) As tObjetos
- For LoopC = 1 To cantidadObjetos
- With Objetos(LoopC)
- .ID = CInt(Leer.GetValue("OBJETO" & LoopC, "ID"))
- .Precio = CInt(Leer.GetValue("OBJETO" & LoopC, "PRECIO"))
- End With
- Next LoopC
- End Sub
- ''
- '
- Public Sub ComprarObjeto(ByVal ID As Integer, ByVal ID_Objeto As Byte)
- '*********************************************************************************
- 'Autor: Luciano (G Toyz)
- 'Creación: 17/04/2017
- 'Aclaración: -
- 'Ultima modificación: -
- '
- '*********************************************************************************
- Dim Objeto As Obj
- With UserList(ID)
- If .flags.Muerto = 1 Then
- Call WriteConsoleMsg(ID, "¡Estás muerto!", FontTypeNames.FONTTYPE_INFOBOLD)
- Exit Sub
- End If
- If .Stats.Canjes < Objetos(ID_Objeto).Precio Then
- Call WriteConsoleMsg(ID, "No tienes suficientes puntos de canjeo", FontTypeNames.FONTTYPE_INFOBOLD)
- Exit Sub
- End If
- Objeto.Amount = 1
- Objeto.ObjIndex = Objetos(ID_Objeto).ID
- If MeterItemEnInventario(ID, Objeto) = False Then
- Call WriteConsoleMsg(ID, "Tienes el inventario lleno", FontTypeNames.FONTTYPE_INFOBOLD)
- Exit Sub
- End If
- .Stats.Canjes = .Stats.Canjes - Objetos(ID_Objeto).Precio
- Call WriteUpdateCanjes(ID)
- End With
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement