Skip to content
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
280 changes: 48 additions & 232 deletions Codigo/Acciones.bas

Large diffs are not rendered by default.

7 changes: 2 additions & 5 deletions Codigo/Declares.bas
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@ End Enum

Public Enum e_AccionBarra
Runa = 1
Resucitar = 2
Intermundia = 3
GoToPareja = 5
Hogar = 6
CancelarAccion = 99
End Enum
Expand Down Expand Up @@ -1561,8 +1558,8 @@ End Enum

Public Enum e_RuneType
ReturnHome = 1
Escape = 2
MesonSafePassage = 3
MesonSafePassage = 2
FastTravel = 3
End Enum

Public Enum e_UseOnceSubType
Expand Down
9 changes: 5 additions & 4 deletions Codigo/FileIO.bas
Original file line number Diff line number Diff line change
Expand Up @@ -1199,11 +1199,12 @@ Sub LoadOBJData()
.MaxItems = val(Leer.GetValue(ObjKey, "Peces"))
End If
Case e_OBJType.otRecallStones
.TipoRuna = val(Leer.GetValue(ObjKey, "TipoRuna"))
.TipoRuna = val(Leer.GetValue(ObjKey, "Runetype"))
.DesdeMap = val(Leer.GetValue(ObjKey, "DesdeMap"))
.HastaMap = val(Leer.GetValue(ObjKey, "Map"))
.HastaX = val(Leer.GetValue(ObjKey, "X"))
.HastaY = val(Leer.GetValue(ObjKey, "Y"))
.HastaMap = val(Leer.GetValue(ObjKey, "HastaMap"))
.HastaX = val(Leer.GetValue(ObjKey, "HastaX"))
.HastaY = val(Leer.GetValue(ObjKey, "HastaY"))
.Cooldown = val(Leer.GetValue(ObjKey, "Cooldown"))
Case e_OBJType.otTeleport
.Radio = val(Leer.GetValue(ObjKey, "Radio"))
Case e_OBJType.otChest
Expand Down
13 changes: 1 addition & 12 deletions Codigo/General.bas
Original file line number Diff line number Diff line change
Expand Up @@ -1446,18 +1446,7 @@ Sub PasarSegundo()
If .Counters.TimerBarra > 0 Then
.Counters.TimerBarra = .Counters.TimerBarra - 1
If .Counters.TimerBarra = 0 Then
Select Case .Accion.TipoAccion
Case e_AccionBarra.Hogar
Call HomeArrival(i)
Case e_AccionBarra.Runa
Call CompletarAccionFin(i)
End Select
.Accion.Particula = 0
.Accion.TipoAccion = e_AccionBarra.CancelarAccion
.Accion.HechizoPendiente = 0
.Accion.RunaObj = 0
.Accion.ObjSlot = 0
.Accion.AccionPendiente = False
Call EndProgrammedAction(i)
End If
End If
If .flags.UltimoMensaje > 0 Then
Expand Down
13 changes: 5 additions & 8 deletions Codigo/InvUsuario.bas
Original file line number Diff line number Diff line change
Expand Up @@ -2722,14 +2722,11 @@ Sub UseInvItem(ByVal UserIndex As Integer, ByVal Slot As Byte, ByVal ByClick As
If .Accion.AccionPendiente Then
Exit Sub
End If
Select Case ObjData(ObjIndex).TipoRuna
Case e_RuneType.ReturnHome
.Counters.TimerBarra = HomeTimer
Case e_RuneType.Escape
.Counters.TimerBarra = HomeTimer
Case e_RuneType.MesonSafePassage
.Counters.TimerBarra = 5
End Select
If obj.Cooldown > 32766 Then
.Counters.TimerBarra = 32766
Else
.Counters.TimerBarra = CInt(obj.Cooldown)
End If
If Not EsGM(UserIndex) Then
Call SendData(SendTarget.ToPCAliveArea, UserIndex, PrepareMessageParticleFX(.Char.charindex, e_GraphicEffects.Runa, 400, False))
Call SendData(SendTarget.ToPCAliveArea, UserIndex, PrepareMessageBarFx(.Char.charindex, 350, e_AccionBarra.Runa))
Expand Down
21 changes: 21 additions & 0 deletions Codigo/ModMap.bas
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,24 @@ Public Sub ActivateTrap(ByVal TargetIndex, ByVal TargetType As e_ReferenceType,
End If
Call MapData(Map, PosX, PosY).Trap.trigger(TargetIndex, TargetType)
End Sub

Public Function IsValidMapIndex(ByVal mapIndex As Integer) As Boolean
On Error GoTo InvalidIndex
Dim LowerBound As Long
Dim UpperBound As Long
LowerBound = LBound(MapInfo)
UpperBound = UBound(MapInfo)
If mapIndex < LowerBound Or mapIndex > UpperBound Then Exit Function
IsValidMapIndex = True
Exit Function
InvalidIndex:
Err.Clear
IsValidMapIndex = False
End Function

Public Function IsValidMapPosition(ByVal mapIndex As Integer, ByVal x As Integer, ByVal y As Integer) As Boolean
If Not IsValidMapIndex(mapIndex) Then Exit Function
If x < XMinMapSize Or x > XMaxMapSize Then Exit Function
If y < YMinMapSize Or y > YMaxMapSize Then Exit Function
IsValidMapPosition = True
End Function
2 changes: 1 addition & 1 deletion Codigo/Protocol.bas
Original file line number Diff line number Diff line change
Expand Up @@ -6509,7 +6509,7 @@ Private Sub HandleCompletarAccion(ByVal UserIndex As Integer)
Accion = reader.ReadInt8()
If .Accion.AccionPendiente = True Then
If .Accion.TipoAccion = Accion Then
Call CompletarAccionFin(UserIndex)
Call EndProgrammedAction(UserIndex)
Else
' Msg749=Servidor » La acción que solicitas no se corresponde.
Call WriteLocaleMsg(UserIndex, 749, e_FontTypeNames.FONTTYPE_SERVER)
Expand Down
95 changes: 24 additions & 71 deletions Codigo/modFishing.bas
Original file line number Diff line number Diff line change
@@ -1,32 +1,26 @@
Attribute VB_Name = "modFishing"
Option Explicit

Private FishingLevelBonus() As Double
Private FishingBonusesInitialized As Boolean

Public Const OBJ_FISHING_ROD_BASIC As Integer = 881
Public Const OBJ_FISHING_ROD_COMMON As Integer = 2121
Public Const OBJ_FISHING_ROD_FINE As Integer = 2132
Public Const OBJ_FISHING_ROD_ELITE As Integer = 2133
Public Const OBJ_BROKEN_FISHING_ROD_BASIC As Integer = 3457
Public Const OBJ_BROKEN_FISHING_ROD_COMMON As Integer = 3456
Public Const OBJ_BROKEN_FISHING_ROD_FINE As Integer = 3459
Public Const OBJ_BROKEN_FISHING_ROD_ELITE As Integer = 3458
Public Const OBJ_FISHING_NET_BASIC As Integer = 138
Public Const OBJ_FISHING_NET_ELITE As Integer = 139
Public Const OBJ_FISHING_LINE As Integer = 2183
Public Const OBJ_FISH_BANK As Integer = 1992
Public Const OBJ_SQUID_BANK As Integer = 1990
Public Const OBJ_SHRIMP_BANK As Integer = 1991
Public Const OBJ_FISH_AREA As Integer = 3740


Private FishingLevelBonus() As Double
Private FishingBonusesInitialized As Boolean
Public Const OBJ_FISHING_ROD_BASIC As Integer = 881
Public Const OBJ_FISHING_ROD_COMMON As Integer = 2121
Public Const OBJ_FISHING_ROD_FINE As Integer = 2132
Public Const OBJ_FISHING_ROD_ELITE As Integer = 2133
Public Const OBJ_BROKEN_FISHING_ROD_BASIC As Integer = 3457
Public Const OBJ_BROKEN_FISHING_ROD_COMMON As Integer = 3456
Public Const OBJ_BROKEN_FISHING_ROD_FINE As Integer = 3459
Public Const OBJ_BROKEN_FISHING_ROD_ELITE As Integer = 3458
Public Const OBJ_FISHING_NET_BASIC As Integer = 138
Public Const OBJ_FISHING_NET_ELITE As Integer = 139
Public Const OBJ_FISHING_LINE As Integer = 2183
Public Const OBJ_FISH_BANK As Integer = 1992
Public Const OBJ_SQUID_BANK As Integer = 1990
Public Const OBJ_SHRIMP_BANK As Integer = 1991
Public Const OBJ_FISH_AREA As Integer = 3740

Public Sub InitializeFishingBonuses()
If FishingBonusesInitialized Then Exit Sub

ReDim FishingLevelBonus(1 To 47) As Double

FishingLevelBonus(1) = 0#
FishingLevelBonus(2) = 0.009
FishingLevelBonus(3) = 0.015
Expand Down Expand Up @@ -74,7 +68,6 @@ Public Sub InitializeFishingBonuses()
FishingLevelBonus(45) = 1.8
FishingLevelBonus(46) = 2#
FishingLevelBonus(47) = 2.5

FishingBonusesInitialized = True
End Sub

Expand Down Expand Up @@ -252,67 +245,35 @@ Private Function IsValidUserIndex(ByVal UserIndex As Integer) As Boolean
On Error GoTo InvalidIndex
Dim LowerBound As Long
Dim UpperBound As Long

LowerBound = LBound(UserList)
UpperBound = UBound(UserList)

If UserIndex < LowerBound Or UserIndex > UpperBound Then Exit Function

IsValidUserIndex = True
Exit Function
InvalidIndex:
Err.Clear
IsValidUserIndex = False
End Function

Private Function IsValidObjectIndex(ByVal objectIndex As Integer) As Boolean
Private Function IsValidObjectIndex(ByVal ObjectIndex As Integer) As Boolean
On Error GoTo InvalidIndex
Dim LowerBound As Long
Dim UpperBound As Long

LowerBound = LBound(ObjData)
UpperBound = UBound(ObjData)

If objectIndex < LowerBound Or objectIndex > UpperBound Then Exit Function

If ObjectIndex < LowerBound Or ObjectIndex > UpperBound Then Exit Function
IsValidObjectIndex = True
Exit Function
InvalidIndex:
Err.Clear
IsValidObjectIndex = False
End Function

Private Function IsValidMapIndex(ByVal mapIndex As Integer) As Boolean
On Error GoTo InvalidIndex
Dim LowerBound As Long
Dim UpperBound As Long

LowerBound = LBound(MapInfo)
UpperBound = UBound(MapInfo)

If mapIndex < LowerBound Or mapIndex > UpperBound Then Exit Function

IsValidMapIndex = True
Exit Function
InvalidIndex:
Err.Clear
IsValidMapIndex = False
End Function

Private Function IsValidMapPosition(ByVal mapIndex As Integer, ByVal x As Integer, ByVal y As Integer) As Boolean
If Not IsValidMapIndex(mapIndex) Then Exit Function
If x < XMinMapSize Or x > XMaxMapSize Then Exit Function
If y < YMinMapSize Or y > YMaxMapSize Then Exit Function
IsValidMapPosition = True
End Function

Private Function ClampFishingLevel(ByVal level As Long) As Long
Dim LowerBound As Long
Dim UpperBound As Long

LowerBound = LBound(FishingLevelBonus)
UpperBound = UBound(FishingLevelBonus)

If level < LowerBound Then
ClampFishingLevel = LowerBound
ElseIf level > UpperBound Then
Expand Down Expand Up @@ -357,43 +318,36 @@ End Function

Public Function ObtenerPezRandom(ByVal PoderCania As Integer) As Long
On Error GoTo ObtenerPezRandom_Err

Dim PesoMinimo As Long
Dim PesoMaximo As Long
Dim PesoMinimo As Long
Dim PesoMaximo As Long
Dim ValorGenerado As Long
Dim PezIndex As Long

Dim PezIndex As Long
' Aseguramos que PoderCania esté dentro del rango válido del array.
PoderCania = Clamp(PoderCania, LBound(PesoPeces), UBound(PesoPeces))

' PesoMaximo: suma de pesos acumulados de todos los peces que puede pescar esta caña
PesoMaximo = PesoPeces(PoderCania)

' Esto asegura que el aleatorio solo considere los peces que pertenecen al Power actual
If PoderCania > LBound(PesoPeces) Then
PesoMinimo = PesoPeces(PoderCania - 1)
Else
PesoMinimo = 0
End If

' Generamos un valor aleatorio solo dentro del rango correspondiente
If PesoMaximo <= PesoMinimo Then
ValorGenerado = RandomNumber(0, PesoMaximo - 1)
Else
ValorGenerado = RandomNumber(PesoMinimo, PesoMaximo - 1)
End If

' Obtenemos el pez correspondiente
PezIndex = BinarySearchPeces(ValorGenerado) ' BinarySearchPeces() espera un valor en el mismo espacio acumulado que PesoPeces().
ObtenerPezRandom = Peces(PezIndex).ObjIndex

Exit Function

ObtenerPezRandom_Err:
Call TraceError(Err.Number, Err.Description, "modFishing.ObtenerPezRandom", Erl)
End Function

Public Function IsUniqueMapFish(ByVal ObjIndex As Long) As Boolean
On Error GoTo IsUniqueMapFish_Err
On Error GoTo IsUniqueMapFish_Err
Dim i As Long
For i = 1 To UniqueMapFishCount
If UniqueMapFishIDs(i) = ObjIndex Then
Expand Down Expand Up @@ -498,4 +452,3 @@ Private Function IsAdjacentToWater(ByRef pos As t_WorldPos) As Boolean
(MapData(pos.Map, pos.x, pos.y + 1).Blocked And FLAG_AGUA) <> 0 Or _
(MapData(pos.Map, pos.x, pos.y - 1).Blocked And FLAG_AGUA) <> 0
End Function

49 changes: 0 additions & 49 deletions Codigo/modHechizos.bas
Original file line number Diff line number Diff line change
Expand Up @@ -951,53 +951,6 @@ HechizoSobreArea_Err:
Call TraceError(Err.Number, Err.Description, "modHechizos.HechizoSobreArea", Erl)
End Sub

Sub HechizoPortal(ByVal UserIndex As Integer, ByRef b As Boolean)
On Error GoTo HechizoPortal_Err
Dim PosCasteadaX As Byte
Dim PosCasteadaY As Byte
Dim PosCasteadaM As Integer
Dim uh As Integer
Dim TempX As Integer
Dim TempY As Integer
PosCasteadaX = UserList(UserIndex).flags.TargetX
PosCasteadaY = UserList(UserIndex).flags.TargetY
PosCasteadaM = UserList(UserIndex).flags.TargetMap
uh = UserList(UserIndex).Stats.UserHechizos(UserList(UserIndex).flags.Hechizo)
'Envio Palabras magicas, wavs y fxs.
If MapData(UserList(UserIndex).pos.Map, UserList(UserIndex).flags.TargetX, UserList(UserIndex).flags.TargetY).ObjInfo.amount > 0 Or (MapData(UserList(UserIndex).pos.Map, _
UserList(UserIndex).flags.TargetX, UserList(UserIndex).flags.TargetY).Blocked And e_Block.ALL_SIDES) <> e_Block.ALL_SIDES Or MapData(UserList(UserIndex).pos.Map, _
UserList(UserIndex).flags.TargetX, UserList(UserIndex).flags.TargetY).TileExit.Map > 0 Or UserList(UserIndex).flags.TargetUser.ArrayIndex <> 0 Then
b = False
'Call WriteConsoleMsg(UserIndex, "Area invalida para lanzar este Hechizo!", e_FontTypeNames.FONTTYPE_INFO)
Call WriteLocaleMsg(UserIndex, 262, e_FontTypeNames.FONTTYPE_INFO)
Else
If Hechizos(uh).TeleportX = 1 Then
If UserList(UserIndex).flags.Portal = 0 Then
Call SendData(SendTarget.ToPCArea, UserIndex, PrepareMessageParticleFX(UserList(UserIndex).Char.charindex, e_GraphicEffects.Runa, -1, False))
UserList(UserIndex).flags.PortalM = UserList(UserIndex).pos.Map
UserList(UserIndex).flags.PortalX = UserList(UserIndex).flags.TargetX
UserList(UserIndex).flags.PortalY = UserList(UserIndex).flags.TargetY
Call SendData(SendTarget.ToPCArea, UserIndex, PrepareMessageBarFx(UserList(UserIndex).Char.charindex, 600, e_AccionBarra.Intermundia))
UserList(UserIndex).Accion.AccionPendiente = True
UserList(UserIndex).Accion.Particula = e_GraphicEffects.Runa
UserList(UserIndex).Accion.TipoAccion = e_AccionBarra.Intermundia
UserList(UserIndex).Accion.HechizoPendiente = uh
If UserList(UserIndex).flags.NoPalabrasMagicas = 0 Then
Call DecirPalabrasMagicas(uh, UserIndex)
End If
b = True
Else
'Msg788= No podés lanzar mas de un portal a la vez.
Call WriteLocaleMsg(UserIndex, 788, e_FontTypeNames.FONTTYPE_INFO)
b = False
End If
End If
End If
Exit Sub
HechizoPortal_Err:
Call TraceError(Err.Number, Err.Description, "modHechizos.HechizoPortal", Erl)
End Sub

Sub HechizoMaterializacion(ByVal UserIndex As Integer, ByRef b As Boolean)
On Error GoTo HechizoMaterializacion_Err
Dim h As Integer
Expand Down Expand Up @@ -1034,8 +987,6 @@ Sub HandleHechizoTerreno(ByVal UserIndex As Integer, ByVal uh As Integer)
Call HechizoMaterializacion(UserIndex, b)
Case e_TipoHechizo.uArea 'Tipo 5
Call HechizoSobreArea(UserIndex, b)
Case e_TipoHechizo.uPortal 'Tipo 6
Call HechizoPortal(UserIndex, b)
Case e_TipoHechizo.uMultiShoot
Dim TargetPos As t_WorldPos
TargetPos.Map = .pos.Map
Expand Down
6 changes: 6 additions & 0 deletions Codigo/modMessageIDs.bas
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,9 @@ Public Const MSG_CONNECTION_DARK_LEGION_8 As Integer = 2156
Public Const MSG_CONNECTION_DARK_LEGION_9 As Integer = 2157
Public Const MSG_CONNECTION_DARK_LEGION_10 As Integer = 2158
Public Const MSG_PERFORATED_ARMOR As Integer = 2161

Public Const MSG_SUCCESFULLY_RETURN_TO_HOME_CITY = 1065
Public Const MSG_SUCCESFULLY_TELEPORTED = 1066
Public Const MSG_INVALID_RUNE = 2080
Public Const MSG_NOT_USABLE_INSIDE_MESON = 2081
Public Const MSG_INVALID_FAST_TRAVEL_MAP_ORIGIN = 2162