Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nueva restriccion de mapa solo para grupos #503

Merged
merged 4 commits into from
Feb 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Codigo/Declares.bas
Original file line number Diff line number Diff line change
Expand Up @@ -2827,6 +2827,7 @@ Type t_MapInfo
MaxLevel As Integer
Salida As t_WorldPos
NoMascotas As Boolean
OnlyGroups As Boolean
DropItems As Boolean
SafeFightMap As Boolean
FriendlyFire As Boolean
Expand Down
1 change: 1 addition & 0 deletions Codigo/FileIO.bas
Original file line number Diff line number Diff line change
Expand Up @@ -2139,6 +2139,7 @@ Public Sub CargarMapaFormatoCSM(ByVal map As Long, ByVal MAPFl As String)
356 MapInfo(map).SinInviOcul = (val(MapDat.restrict_mode) And 16) <> 0
358 MapInfo(map).SoloClanes = (val(MapDat.restrict_mode) And 32) <> 0
359 MapInfo(map).NoMascotas = (val(MapDat.restrict_mode) And 64) <> 0
MapInfo(Map).OnlyGroups = (val(MapDat.restrict_mode) And 128) <> 0
360 MapInfo(map).ResuCiudad = val(GetVar(DatPath & "Map.dat", "RESUCIUDAD", map)) <> 0
362 MapInfo(map).letter_grh = MapDat.letter_grh
364 MapInfo(map).lluvia = MapDat.lluvia
Expand Down
11 changes: 9 additions & 2 deletions Codigo/GameLogic.bas
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,16 @@ Private Function CheckMapRestrictions(ByVal UserIndex As Integer, ByVal Map As I
End If
Exit Function
End If

153 If MapInfo(Map).OnlyGroups And Not .Grupo.EnGrupo Then
154 If .flags.UltimoMensaje <> 107 Then
155 Call WriteConsoleMsg(UserIndex, "Necesitas pertenecer a un grupo para entrar a este mapa.", e_FontTypeNames.FONTTYPE_INFO)
156 .flags.UltimoMensaje = 107
End If
Exit Function
End If

154 CheckMapRestrictions = True
157 CheckMapRestrictions = True

End With

Expand Down Expand Up @@ -434,7 +442,6 @@ Public Sub DoTileEvents(ByVal UserIndex As Integer, ByVal Map As Integer, ByVal
156 Call ClosestLegalPos(destPos, nPos)
End If


158 If nPos.X <> 0 And nPos.y <> 0 Then
160 Call WarpUserChar(UserIndex, nPos.map, nPos.X, nPos.y, EsTeleport)
End If
Expand Down
22 changes: 22 additions & 0 deletions Codigo/ModGrupos.bas
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ Public Sub EcharMiembro(ByVal UserIndex As Integer, ByVal Indice As Byte)
154 Call SetUserRef(.Grupo.Miembros(1), 0)
156 Call RefreshCharStatus(UserIndexEchar)
.Grupo.ID = -1

If MapInfo(.pos.Map).Salida.Map <> 0 Then
Call WriteConsoleMsg(UserIndex, "Debes estar en un grupo para permanecer en este mapa.", e_FontTypeNames.FONTTYPE_INFO)
Call WarpUserChar(UserIndex, MapInfo(.pos.Map).Salida.Map, MapInfo(.pos.Map).Salida.x, MapInfo(.pos.Map).Salida.y, True)
End If

End With


Expand Down Expand Up @@ -280,6 +286,12 @@ Public Sub SalirDeGrupo(ByVal UserIndex As Integer)
156 Call SetUserRef(.Grupo.Lider, 0)

Call modSendData.SendData(ToIndex, UserIndex, PrepareUpdateGroupInfo(UserIndex))

If MapInfo(.pos.Map).Salida.Map <> 0 Then
Call WriteConsoleMsg(UserIndex, "Debes estar en un grupo para permanecer en este mapa.", e_FontTypeNames.FONTTYPE_INFO)
Call WarpUserChar(UserIndex, MapInfo(.pos.Map).Salida.Map, MapInfo(.pos.Map).Salida.x, MapInfo(.pos.Map).Salida.y, True)
End If

End With

158 Call RefreshCharStatus(UserIndex)
Expand Down Expand Up @@ -336,6 +348,12 @@ Public Sub SalirDeGrupoForzado(ByVal UserIndex As Integer)
UserList(.Grupo.Lider.ArrayIndex).Grupo.ID = -1
146 Call RefreshCharStatus(.Grupo.Lider.ArrayIndex)
End If

If MapInfo(.pos.Map).Salida.Map <> 0 Then
Call WriteConsoleMsg(UserIndex, "Debes estar en un grupo para permanecer en este mapa.", e_FontTypeNames.FONTTYPE_INFO)
Call WarpUserChar(UserIndex, MapInfo(.pos.Map).Salida.Map, MapInfo(.pos.Map).Salida.x, MapInfo(.pos.Map).Salida.y, True)
End If

End With
Exit Sub
SalirDeGrupoForzado_Err:
Expand All @@ -359,6 +377,10 @@ On Error GoTo FinalizarGrupo_Err
118 .Grupo.EnGrupo = False
.Grupo.ID = -1
Call modSendData.SendData(ToIndex, .Grupo.Miembros(i).ArrayIndex, PrepareUpdateGroupInfo(.Grupo.Miembros(i).ArrayIndex))
If MapInfo(.pos.Map).Salida.Map <> 0 Then
Call WriteConsoleMsg(UserIndex, "Debes estar en un grupo para permanecer en este mapa.", e_FontTypeNames.FONTTYPE_INFO)
Call WarpUserChar(UserIndex, MapInfo(.pos.Map).Salida.Map, MapInfo(.pos.Map).Salida.x, MapInfo(.pos.Map).Salida.y, True)
End If
120 Next i
End With
Exit Sub
Expand Down