Skip to content

Commit

Permalink
fix bank transfer and ship equip/unequip after relog (#350)
Browse files Browse the repository at this point in the history
  • Loading branch information
matiascalegaris authored Aug 7, 2023
1 parent 18c3b87 commit 100e1d1
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ Logs/numusers.log
feature_toggle.ini
Logs/numusers.log
Database.db
AoServerTools.dll
2 changes: 1 addition & 1 deletion Codigo/Hogar.bas
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Public Sub HomeArrival(ByVal UserIndex As Integer)

114 .flags.Navegando = 0

116 Call WriteNavigateToggle(UserIndex)
116 Call WriteNavigateToggle(UserIndex, .flags.Navegando)

'Le sacamos el navegando, pero no le mostramos a los demas porque va a ser sumoneado hasta ulla.
End If
Expand Down
1 change: 1 addition & 0 deletions Codigo/InvUsuario.bas
Original file line number Diff line number Diff line change
Expand Up @@ -3635,6 +3635,7 @@ Public Sub UpdateCharWithEquipedItems(ByVal UserIndex As Integer)
.Char.CartAnim = 0
.Char.ShieldAnim = 0
.Char.WeaponAnim = 0
.Char.head = 0
'TODO place ship body
Call ChangeUserChar(UserIndex, .Char.body, .Char.head, .Char.Heading, .Char.WeaponAnim, .Char.ShieldAnim, .Char.CascoAnim, UserList(UserIndex).Char.CartAnim)
Exit Sub
Expand Down
16 changes: 13 additions & 3 deletions Codigo/Modulo_UsUaRiOs.bas
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,17 @@ On Error GoTo Complete_ConnectUser_Err
760 If .Invent.BarcoObjIndex > 0 And (MapData(.Pos.Map, .Pos.X, .Pos.Y).Blocked And FLAG_AGUA) <> 0 Then
765 .flags.Navegando = 1
770 Call EquiparBarco(UserIndex)

ElseIf .flags.Navegando = 1 And (MapData(.pos.Map, .pos.x, .pos.y).Blocked And FLAG_AGUA) <> 0 Then
Dim iSlot As Integer
For iSlot = 1 To UBound(.invent.Object)
If .invent.Object(iSlot).ObjIndex > 0 Then
If ObjData(.invent.Object(iSlot).ObjIndex).OBJType = otBarcos And ObjData(.invent.Object(iSlot).ObjIndex).Subtipo > 0 Then
.invent.BarcoObjIndex = .invent.Object(iSlot).ObjIndex
.invent.BarcoSlot = iSlot
Exit For
End If
End If
Next
End If

775 If .Invent.MagicoObjIndex <> 0 Then
Expand All @@ -554,7 +564,7 @@ On Error GoTo Complete_ConnectUser_Err

795 Call WriteHora(UserIndex)
800 Call WriteChangeMap(UserIndex, .Pos.Map) 'Carga el mapa

Call UpdateCharWithEquipedItems(UserIndex)
805 Select Case .flags.Privilegios

Case e_PlayerType.Admin
Expand Down Expand Up @@ -662,7 +672,7 @@ On Error GoTo Complete_ConnectUser_Err
End If

1050 If .flags.Navegando = 1 Then
1055 Call WriteNavigateToggle(UserIndex)
1055 Call WriteNavigateToggle(UserIndex, .flags.Navegando)
1060 Call EquiparBarco(UserIndex)

End If
Expand Down
2 changes: 1 addition & 1 deletion Codigo/Protocol.bas
Original file line number Diff line number Diff line change
Expand Up @@ -8207,7 +8207,7 @@ Public Sub HandleNavigateToggle(ByVal UserIndex As Integer)
End If

'Tell the client that we are navigating.
112 Call WriteNavigateToggle(UserIndex)
112 Call WriteNavigateToggle(UserIndex, .flags.Navegando)

End With

Expand Down
3 changes: 2 additions & 1 deletion Codigo/Protocol_Writes.bas
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,12 @@ End Sub
'
' @param UserIndex User to which the message is intended.
' @remarks The data is not actually sent until the buffer is properly flushed.
Public Sub WriteNavigateToggle(ByVal UserIndex As Integer)
Public Sub WriteNavigateToggle(ByVal UserIndex As Integer, ByVal NewState As Boolean)
'<EhHeader>
On Error GoTo WriteNavigateToggle_Err
'</EhHeader>
100 Call Writer.WriteInt16(ServerPacketID.NavigateToggle)
Call Writer.WriteBool(NewState)
102 Call modSendData.SendData(ToIndex, UserIndex)
'<EhFooter>
Exit Sub
Expand Down
8 changes: 4 additions & 4 deletions Codigo/Trabajo.bas
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ Public Sub DoNavega(ByVal UserIndex As Integer, _
End If

124 If .Invent.BarcoObjIndex = 0 Then
126 Call WriteNavigateToggle(UserIndex)
126 Call WriteNavigateToggle(UserIndex, True)
128 .flags.Navegando = 1
Call TargetUpdateTerrain(.EffectOverTime)
End If
Expand All @@ -570,10 +570,10 @@ Public Sub DoNavega(ByVal UserIndex As Integer, _

Else
148 Call WriteNadarToggle(UserIndex, False)

150 Call WriteNavigateToggle(UserIndex)
.flags.Navegando = 0
150 Call WriteNavigateToggle(UserIndex, False)

152 .flags.Navegando = 0
152
Call TargetUpdateTerrain(.EffectOverTime)
154 .Invent.BarcoObjIndex = 0
156 .Invent.BarcoSlot = 0
Expand Down
4 changes: 2 additions & 2 deletions Codigo/modDatabase.bas
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,7 @@ Public Function AddOroBancoDatabase(username As String, ByVal OroGanado As Long)

If EnableTelemetry Then
Dim RS As ADODB.Recordset
Set RS = Query("SELECT id, level, exp, gold, bankgold, user_key FROM user WHERE UPPER(name) = ?", UCase$(username))
Set RS = Query("SELECT id, level, exp, gold, bank_gold, user_key FROM user WHERE UPPER(name) = ?", UCase$(username))
If RS Is Nothing Then
AddOroBancoDatabase = False
Exit Function
Expand All @@ -1033,7 +1033,7 @@ Public Function AddOroBancoDatabase(username As String, ByVal OroGanado As Long)
Dim TelemetryLen As Long
Dim TelemetryInfo As String
TelemetryInfo = RS!user_key
TelemetryLen = AOT_SetUserKey(RS!id, RS!level, RS!Exp, RS!gold, RS!BankGold + OroGanado, TelemetryInfo, Len(TelemetryInfo), TelemetryOut(0), 128)
TelemetryLen = AOT_SetUserKey(RS!id, RS!level, RS!Exp, RS!gold, RS!bank_gold + OroGanado, TelemetryInfo, Len(TelemetryInfo), TelemetryOut(0), 128)
TelemetryInfo = StrConv(TelemetryOut, vbUnicode)
TelemetryInfo = Left(TelemetryInfo, TelemetryLen)
AddOroBancoDatabase = Execute("UPDATE user SET bank_gold = bank_gold + ?, user_key = ? WHERE UPPER(name) = ?;", OroGanado, TelemetryInfo, UCase$(username))
Expand Down

0 comments on commit 100e1d1

Please sign in to comment.