Skip to content

Commit

Permalink
Merge pull request #354 from ao-org/increase-exp-rates
Browse files Browse the repository at this point in the history
increase exp rates
  • Loading branch information
RecoX authored Aug 9, 2023
2 parents 74f3483 + c0b58b1 commit 626cce6
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 88 deletions.
4 changes: 2 additions & 2 deletions Codigo/Declares.bas
Original file line number Diff line number Diff line change
Expand Up @@ -3129,8 +3129,8 @@ End Sub
' log if there time betwen calls exced the limit
Public Sub PerformTimeLimitCheck(ByRef timer As Long, ByRef TestText As String, Optional ByVal TimeLimit As Long = 1000)
Dim CurrTime As Long
CurrTime = GetTickCount()
If CurrTime - timer > TimeLimit Then
CurrTime = GetTickCount() - timer
If CurrTime > TimeLimit Then
Call LogPerformance("Performance warning at: " & TestText & " elapsed time: " & CurrTime - Timer)
End If
timer = GetTickCount()
Expand Down
31 changes: 12 additions & 19 deletions Codigo/Modulo_UsUaRiOs.bas
Original file line number Diff line number Diff line change
Expand Up @@ -1387,7 +1387,7 @@ Function MoveUserChar(ByVal UserIndex As Integer, ByVal nHeading As e_Heading) A
Dim Opposite_Heading As e_Heading

100 With UserList(UserIndex)

102 nPos = .Pos
104 Call HeadtoPos(nHeading, nPos)

Expand All @@ -1414,10 +1414,9 @@ Function MoveUserChar(ByVal UserIndex As Integer, ByVal nHeading As e_Heading) A
Call SwapNpcPos(UserIndex, nPos, nHeading)
'Si no estoy solo en el mapa...
130 If MapInfo(.pos.map).NumUsers > 1 Or IsValidUserRef(.flags.GMMeSigue) Then

' Intercambia posición si hay un casper o gm invisible
132 IndexMover = MapData(nPos.Map, nPos.X, nPos.Y).UserIndex

134 If IndexMover <> 0 Then
' Sólo puedo patear caspers/gms invisibles si no es él un gm invisible
136 ' If UserList(UserIndex).flags.AdminInvisible = 1 Then Exit Function
Expand Down Expand Up @@ -1446,30 +1445,28 @@ Function MoveUserChar(ByVal UserIndex As Integer, ByVal nHeading As e_Heading) A
'Actualizamos las areas de ser necesario
156 Call ModAreas.CheckUpdateNeededUser(IndexMover, Opposite_Heading, 0)
End If

158 If .flags.AdminInvisible = 0 Then
If IsValidUserRef(.flags.GMMeSigue) Then
Call SendData(SendTarget.ToPCAreaButFollowerAndIndex, UserIndex, PrepareMessageCharacterMove(.Char.charindex, nPos.X, nPos.Y))
Call WriteForceCharMoveSiguiendo(.flags.GMMeSigue.ArrayIndex, nHeading)
Else
'Mando a todos menos a mi donde estoy
160 Call SendData(SendTarget.ToPCAliveAreaButIndex, userindex, PrepareMessageCharacterMove(.Char.charindex, nPos.X, nPos.y), True)

Dim LoopC As Integer
Dim tempIndex As Integer

'Togle para alternar el paso para los invis
.flags.stepToggle = Not .flags.stepToggle

If Not EsGM(UserIndex) Then
For LoopC = 1 To ConnGroups(UserList(UserIndex).Pos.map).CountEntrys
tempIndex = ConnGroups(UserList(UserIndex).Pos.map).UserEntrys(LoopC)
If tempIndex <> UserIndex Then
If UserList(tempIndex).AreasInfo.AreaReciveX And UserList(UserIndex).AreasInfo.AreaPerteneceX Then 'Esta en el area?
If UserList(tempIndex).AreasInfo.AreaReciveY And UserList(UserIndex).AreasInfo.AreaPerteneceY Then
If UserList(tempIndex).ConnIDValida Then
If UserList(tempIndex).flags.Muerto = 0 Or MapInfo(UserList(tempIndex).Pos.map).Seguro = 1 Then
If .flags.invisible + .flags.Oculto > 0 Then
If .flags.invisible + .flags.Oculto > 0 Then
For LoopC = 1 To ConnGroups(UserList(UserIndex).pos.Map).CountEntrys
tempIndex = ConnGroups(UserList(UserIndex).pos.Map).UserEntrys(LoopC)
If tempIndex <> UserIndex Then
If UserList(tempIndex).AreasInfo.AreaReciveX And UserList(UserIndex).AreasInfo.AreaPerteneceX Then 'Esta en el area?
If UserList(tempIndex).AreasInfo.AreaReciveY And UserList(UserIndex).AreasInfo.AreaPerteneceY Then
If UserList(tempIndex).ConnIDValida Then
If UserList(tempIndex).flags.Muerto = 0 Or MapInfo(UserList(tempIndex).pos.Map).Seguro = 1 Then
If Distancia(.Pos, UserList(tempIndex).Pos) > DISTANCIA_ENVIO_DATOS And .Counters.timeFx + .Counters.timeChat = 0 Then
If Abs(.Pos.X - UserList(tempIndex).Pos.X) <= RANGO_VISION_X And Abs(.Pos.y - UserList(tempIndex).Pos.y) <= RANGO_VISION_Y Then
'Mandamos los pasos para los pjs q estan lejos para que simule que caminen.
Expand All @@ -1482,8 +1479,8 @@ Function MoveUserChar(ByVal UserIndex As Integer, ByVal nHeading As e_Heading) A
End If
End If
End If
End If
123 Next LoopC
123 Next LoopC
End If

Dim X As Byte, y As Byte
'Esto es para q si me acerco a un usuario que esta invisible y no se mueve me notifique su posicion
Expand All @@ -1496,10 +1493,7 @@ Function MoveUserChar(ByVal UserIndex As Integer, ByVal nHeading As e_Heading) A
End If
Next y
Next X

End If


End If
Else
162 Call SendData(SendTarget.ToAdminAreaButIndex, UserIndex, PrepareMessageCharacterMove(.Char.CharIndex, nPos.X, nPos.Y))
Expand All @@ -1525,7 +1519,6 @@ Function MoveUserChar(ByVal UserIndex As Integer, ByVal nHeading As e_Heading) A
180 If .Counters.Ocultando Then .Counters.Ocultando = .Counters.Ocultando - 1

End With

182 MoveUserChar = True

Exit Function
Expand Down
38 changes: 28 additions & 10 deletions Codigo/clsClan.cls
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ Private p_IteradorPropuesta As Integer
Private p_IteradorOnlineGMs As Integer
Private p_GuildNumber As Integer 'Numero de guild en el mundo
Private p_GuildId As Long
Private p_GuildLevel As Integer
Private p_CurrentExp As Integer
Private p_RequiredExp As Integer
Private p_GuildNews As String
Private Const NEWSLENGTH As Integer = 1024
Private Const DESCLENGTH As Integer = 256
Private Const CODEXLENGTH As Integer = 256
Expand Down Expand Up @@ -448,12 +452,19 @@ SetNivelDeClan_Err:
102 Call TraceError(Err.Number, Err.Description, "clsClan.SetNivelDeClan", Erl)
End Sub

Public Function GetNivelDeClan() As Byte
Public Function GetNivelDeClan() As Integer
If p_GuildLevel = 0 Then
p_GuildLevel = GetStoredClanLevel
End If
GetNivelDeClan = p_GuildLevel
End Function

Public Function GetStoredClanLevel() As Byte
On Error GoTo GetNivelDeClan_Err
Dim RS As ADODB.Recordset
100 Set RS = Query("SELECT level FROM guilds where id = ?", p_GuildId)
102 If RS Is Nothing Then Exit Function
104 GetNivelDeClan = RS.Fields(0).Value
104 GetStoredClanLevel = RS.Fields(0).Value
Exit Function
GetNivelDeClan_Err:
Call TraceError(Err.Number, Err.Description, "clsClan.GetNivelDeClan", Erl)
Expand All @@ -462,17 +473,21 @@ End Function
Public Sub SetExpActual(ByRef Exp As Integer)
On Error GoTo SetExpActual_Err
Call UpdateGuildValue("current_exp", Exp)
p_CurrentExp = Exp
Exit Sub
SetExpActual_Err:
102 Call TraceError(Err.Number, Err.Description, "clsClan.SetExpActual", Erl)
End Sub

Public Function GetExpActual() As Integer
On Error GoTo GetExpActual_Err
Dim RS As ADODB.Recordset
100 Set RS = Query("SELECT current_exp FROM guilds where id = ?", p_GuildId)
102 If RS Is Nothing Then Exit Function
104 GetExpActual = RS.Fields(0).Value
If p_CurrentExp = 0 Then
Dim RS As ADODB.Recordset
100 Set RS = Query("SELECT current_exp FROM guilds where id = ?", p_GuildId)
102 If RS Is Nothing Then Exit Function
104 p_CurrentExp = RS.Fields(0).Value
End If
GetExpActual = p_CurrentExp
Exit Function
GetExpActual_Err:
Call TraceError(Err.Number, Err.Description, "clsClan.GetExpActual", Erl)
Expand All @@ -491,10 +506,13 @@ End Sub

Public Function GetGuildNews() As String
On Error GoTo GetGuildNews_Err
Dim RS As ADODB.Recordset
100 Set RS = Query("SELECT news FROM guilds where id = ?", p_GuildId)
102 If RS Is Nothing Then Exit Function
104 GetGuildNews = RS.Fields(0).Value
If p_GuildNews = "" Then
Dim RS As ADODB.Recordset
100 Set RS = Query("SELECT news FROM guilds where id = ?", p_GuildId)
102 If RS Is Nothing Then Exit Function
104 p_GuildNews = RS.Fields(0).Value
End If
GetGuildNews = p_GuildNews
Exit Function
GetGuildNews_Err:
Call TraceError(Err.Number, Err.Description, "clsClan.GetGuildNews", Erl)
Expand Down
2 changes: 1 addition & 1 deletion Codigo/modNetwork.bas
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Public Sub Poll()
Call Server.Flush
End Sub

Public Sub Send(ByVal UserIndex As Long, ByVal Buffer As Network.Writer)
Public Sub Send(ByVal UserIndex As Long, ByRef Buffer As Network.Writer)
Call Server.Send(UserList(UserIndex).ConnID, False, Buffer)
End Sub

Expand Down
82 changes: 29 additions & 53 deletions Codigo/modSendData.bas
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,25 @@ SendToUserAreaButindex_Err:

End Sub

Private Sub SendToUserAliveAreaButindex(ByVal UserIndex As Integer, ByVal Buffer As Network.Writer, Optional ByVal validateInvi As Boolean = False)
Private Function CanSendToUser(ByRef SourceUser As t_User, ByRef TargetUser As t_User, ByVal TargetIndex As Integer, ByRef Buffer As Network.Writer, ByVal ValidateInvi As Boolean) As Boolean
If (TargetUser.AreasInfo.AreaReciveX And SourceUser.AreasInfo.AreaPerteneceX) = 0 Then Exit Function
If (TargetUser.AreasInfo.AreaReciveY And SourceUser.AreasInfo.AreaPerteneceY) = 0 Then Exit Function
If Not TargetUser.ConnIDValida Then Exit Function
If Not (TargetUser.flags.Muerto = 0 Or MapInfo(TargetUser.pos.Map).Seguro = 1 Or (SourceUser.GuildIndex > 0 And SourceUser.GuildIndex = TargetUser.GuildIndex)) Then Exit Function
If IsValidUserRef(TargetUser.flags.GMMeSigue) Then
Call modNetwork.Send(TargetUser.flags.GMMeSigue.ArrayIndex, Buffer)
End If
If Not EsGM(TargetIndex) Then
If SourceUser.flags.invisible + SourceUser.flags.Oculto > 0 And ValidateInvi And Not (TargetUser.GuildIndex > 0 And TargetUser.GuildIndex = SourceUser.GuildIndex And modGuilds.NivelDeClan(TargetUser.GuildIndex) >= 6) And SourceUser.flags.Navegando = 0 Then
If Distancia(SourceUser.pos, TargetUser.pos) > DISTANCIA_ENVIO_DATOS And SourceUser.Counters.timeFx + SourceUser.Counters.timeChat = 0 Then
Exit Function
End If
End If
End If
CanSendToUser = True
End Function

Private Sub SendToUserAliveAreaButindex(ByVal UserIndex As Integer, ByRef Buffer As Network.Writer, Optional ByVal ValidateInvi As Boolean = False)

On Error GoTo SendToUserAliveAreaButindex_Err

Expand All @@ -675,69 +693,27 @@ Private Sub SendToUserAliveAreaButindex(ByVal UserIndex As Integer, ByVal Buffer
'
'**************************************************************
Dim LoopC As Long
Dim TempInt As Integer
Dim tempIndex As Integer
Dim Map As Integer
Dim AreaX As Integer
Dim AreaY As Integer
Dim enviaDatos As Boolean

100 If UserIndex = 0 Then Exit Sub

102 Map = UserList(UserIndex).Pos.Map
104 AreaX = UserList(UserIndex).AreasInfo.AreaPerteneceX
106 AreaY = UserList(UserIndex).AreasInfo.AreaPerteneceY


108 If Not MapaValido(Map) Then Exit Sub

110 For LoopC = 1 To ConnGroups(Map).CountEntrys
112 tempIndex = ConnGroups(Map).UserEntrys(LoopC)

114 TempInt = UserList(tempIndex).AreasInfo.AreaReciveX And AreaX

116 If TempInt Then 'Esta en el area?
118 TempInt = UserList(tempIndex).AreasInfo.AreaReciveY And AreaY

120 If TempInt Then
122 If tempIndex <> UserIndex Then
124 If UserList(tempIndex).ConnIDValida Then
If UserList(tempIndex).flags.Muerto = 0 Or MapInfo(UserList(tempIndex).Pos.map).Seguro = 1 Or (UserList(UserIndex).GuildIndex > 0 And UserList(UserIndex).GuildIndex = UserList(tempIndex).GuildIndex) Then
enviaDatos = True

If Not EsGM(tempIndex) Then
If UserList(UserIndex).flags.invisible + UserList(UserIndex).flags.Oculto > 0 And validateInvi And Not (UserList(tempIndex).GuildIndex > 0 And UserList(tempIndex).GuildIndex = UserList(UserIndex).GuildIndex And modGuilds.NivelDeClan(UserList(tempIndex).GuildIndex) >= 6) And UserList(UserIndex).flags.Navegando = 0 Then
If Distancia(UserList(UserIndex).Pos, UserList(tempIndex).Pos) > DISTANCIA_ENVIO_DATOS And UserList(UserIndex).Counters.timeFx + UserList(UserIndex).Counters.timeChat = 0 Then
enviaDatos = False
End If
End If
End If

If IsValidUserRef(UserList(tempIndex).flags.GMMeSigue) Then
Call modNetwork.Send(UserList(tempIndex).flags.GMMeSigue.ArrayIndex, Buffer)
End If

If enviaDatos Then
Call modNetwork.Send(tempIndex, Buffer)
End If
End If
End If

106 If Not MapaValido(Map) Then Exit Sub
108 With UserList(UserIndex)
110 For LoopC = 1 To ConnGroups(Map).CountEntrys
112 tempIndex = ConnGroups(Map).UserEntrys(LoopC)
114 If tempIndex <> UserIndex Then
116 If CanSendToUser(UserList(UserIndex), UserList(tempIndex), tempIndex, Buffer, ValidateInvi) Then
118 Call modNetwork.Send(tempIndex, Buffer)
End If

End If

End If

128 Next LoopC


120 Next LoopC
End With
Exit Sub

SendToUserAliveAreaButindex_Err:
130 Call TraceError(Err.Number, Err.Description, "modSendData.SendToUserAliveAreaButindex", Erl)


124 Call TraceError(Err.Number, Err.Description, "modSendData.SendToUserAliveAreaButindex", Erl)
End Sub
Private Sub SendToAdminAreaButIndex(ByVal UserIndex As Integer, ByVal Buffer As Network.Writer)

Expand Down
6 changes: 3 additions & 3 deletions Configuracion.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[CONFIGURACIONES]
ExpMult=5
OroMult=5
RecoleccionMult=5
ExpMult=10
OroMult=10
RecoleccionMult=10
OroPorNivelBilletera=7500
TimerLimpiarObjetos=30
OroPorNivel=0
Expand Down

0 comments on commit 626cce6

Please sign in to comment.