Skip to content

Commit

Permalink
Merge pull request #587 from ao-org/Elimino-llaves-de-mapa
Browse files Browse the repository at this point in the history
Elimino llaves de mapa
  • Loading branch information
RecoX authored May 12, 2024
2 parents e8499af + eb76da2 commit 73821f1
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
39 changes: 39 additions & 0 deletions Codigo/InvUsuario.bas
Original file line number Diff line number Diff line change
Expand Up @@ -2799,11 +2799,15 @@ Sub UseInvItem(ByVal UserIndex As Integer, ByVal Slot As Byte, ByVal ByClick As
If TargObj.Cerrada = 1 Then
'¿Cerrada con llave?
If TargObj.Llave > 0 Then
Dim clavellave As Integer

If TargObj.clave = obj.clave Then
MapData(UserList(UserIndex).flags.TargetObjMap, UserList(UserIndex).flags.TargetObjX, UserList(UserIndex).flags.TargetObjY).ObjInfo.ObjIndex _
= ObjData(MapData(UserList(UserIndex).flags.TargetObjMap, UserList(UserIndex).flags.TargetObjX, UserList(UserIndex).flags.TargetObjY).ObjInfo.ObjIndex).IndexCerrada
UserList(UserIndex).flags.TargetObj = MapData(UserList(UserIndex).flags.TargetObjMap, UserList(UserIndex).flags.TargetObjX, UserList(UserIndex).flags.TargetObjY).ObjInfo.ObjIndex
Call WriteConsoleMsg(UserIndex, "Has abierto la puerta.", e_FontTypeNames.FONTTYPE_INFO)
clavellave = obj.clave
Call EliminarLlaves(ClaveLlave, UserIndex)
Exit Sub
Else
Call WriteConsoleMsg(UserIndex, "La llave no sirve.", e_FontTypeNames.FONTTYPE_INFO)
Expand Down Expand Up @@ -3782,3 +3786,38 @@ Function ObtenerRopaje(ByVal UserIndex As Integer, ByRef Obj As t_ObjData) As In

ObtenerRopaje = Obj.Ropaje
End Function
Sub EliminarLlaves(ByVal ClaveLlave As Integer, ByVal UserIndex As Integer)
' Abrir el archivo "Eliminarllaves.dat" para lectura
Open "Eliminarllaves.dat" For Input As #1

' Variables para el almacenamiento temporal de datos
Dim Linea As String
Dim Clave As Integer
Dim Objeto As Integer
Dim LlaveEncontrada As Boolean
LlaveEncontrada = False

' Leer cada línea del archivo
Do Until EOF(1) Or LlaveEncontrada
Line Input #1, Linea
If InStr(Linea, "Clave=" & ClaveLlave) > 0 Then
' Se encontró la llave con la clave buscada
LlaveEncontrada = True
Do Until EOF(1)
Line Input #1, Linea
If InStr(Linea, "Objeto=") > 0 Then
Objeto = val(mid(Linea, InStr(Linea, "=") + 1))
' Llamar a QuitarObjeto con el objeto encontrado
Call QuitarObjetos(Objeto, 1000, UserIndex)
ElseIf InStr(Linea, "[Llave") > 0 Then
' Se ha alcanzado el final de la sección de la llave actual
Exit Do
End If
Loop
End If
Loop

' Cerrar el archivo
Close #1
End Sub

26 changes: 26 additions & 0 deletions Eliminarllaves.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[INIT]
Numllaves=6

[Llave1]
Clave=1300
Objeto=3554

[Llave2]
Clave=1301
Objeto=3558

[Llave3]
Clave=1302
Objeto=3562

[Llave4]
Clave=1303
Objeto=3566

[Llave5]
Clave=1304
Objeto=3570

[Llave6]
Clave=1305
Objeto=3574

0 comments on commit 73821f1

Please sign in to comment.