Skip to content

Commit

Permalink
Merge pull request #348 from ao-org/fix-transfer
Browse files Browse the repository at this point in the history
fix a bug with ofline transfers
  • Loading branch information
RecoX authored Aug 5, 2023
2 parents 26cd726 + 04852db commit 2eac9ee
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 11 deletions.
4 changes: 1 addition & 3 deletions Codigo/Modulo_UsUaRiOs.bas
Original file line number Diff line number Diff line change
Expand Up @@ -2267,7 +2267,7 @@ Sub HandleFactionScoreForKill(ByVal UserIndex As Integer, ByVal TargetIndex As I
End If

End If
If GlobalFrameTime - UserList(TargetIndex).flags.LastAttackedByUserTime < AssistHelpValidTime Then
If GlobalFrameTime - UserList(TargetIndex).flags.LastAttackedByUserTime < AssistDamageValidTime Then
If IsValidUserRef(UserList(TargetIndex).flags.LastAttacker) And UserList(TargetIndex).flags.LastAttacker.ArrayIndex <> UserIndex Then
Score = Score - 1
Call HandleFactionScoreForAssist(UserList(TargetIndex).flags.LastAttacker.ArrayIndex, TargetIndex)
Expand All @@ -2276,8 +2276,6 @@ Sub HandleFactionScoreForKill(ByVal UserIndex As Integer, ByVal TargetIndex As I
End If
.Faccion.FactionScore = .Faccion.FactionScore + Score
End With


End Sub

Sub HandleFactionScoreForAssist(ByVal UserIndex As Integer, ByVal TargetIndex As Integer)
Expand Down
8 changes: 8 additions & 0 deletions Codigo/ScenarioDeathMatch.cls
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,14 @@ Public Sub IBaseScenario_PlayerKillPlayer(ByVal killerIndex As Integer, ByVal de
Call SendData(SendTarget.toMap, MapNumber, PrepareMessageConsoleMsg("Tenemos un ganador!", e_FontTypeNames.FONTTYPE_GUILD))
Call MatchCompleted
End If
If GlobalFrameTime - UserList(deadIndex).flags.LastAttackedByUserTime < AssistDamageValidTime Then
If IsValidUserRef(UserList(deadIndex).flags.LastAttacker) And UserList(deadIndex).flags.LastAttacker.ArrayIndex <> killerIndex Then
If Board.UpdatePlayerScore(UserList(deadIndex).flags.LastAttacker.ArrayIndex, 1) >= TargetScore Then
Call SendData(SendTarget.toMap, MapNumber, PrepareMessageConsoleMsg("Tenemos un ganador!", e_FontTypeNames.FONTTYPE_GUILD))
Call MatchCompleted
End If
End If
End If
End If
End Sub

Expand Down
1 change: 1 addition & 0 deletions Codigo/ScoreBoard.cls
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Public Sub AddPlayer(ByVal PlayerIndex As Long)
End Sub

Public Function UpdatePlayerScore(ByVal PlayerIndex As Integer, ByVal modifyValue As Integer) As Integer
If Not PlayersScore.Exists(PlayerIndex) Then Exit Function
UpdatePlayerScore = max(PlayersScore.Item(PlayerIndex) + modifyValue, 0)
PlayersScore.Item(PlayerIndex) = UpdatePlayerScore
End Function
Expand Down
26 changes: 20 additions & 6 deletions Codigo/modDatabase.bas
Original file line number Diff line number Diff line change
Expand Up @@ -1021,14 +1021,28 @@ End Function

Public Function AddOroBancoDatabase(username As String, ByVal OroGanado As Long) As Boolean
On Error GoTo ErrorHandler

102 AddOroBancoDatabase = Execute("UPDATE user SET bank_gold = bank_gold + ? WHERE UPPER(name) = ?;", OroGanado, UCase$(username))


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))
If RS Is Nothing Then
AddOroBancoDatabase = False
Exit Function
End If
Dim TelemetryOut(128) As Byte
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)
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))
Else
102 AddOroBancoDatabase = Execute("UPDATE user SET bank_gold = bank_gold + ? WHERE UPPER(name) = ?;", OroGanado, UCase$(username))
End If
Exit Function

ErrorHandler:
104 Call LogDatabaseError("Error in AddOroBancoDatabase. UserName: " & username & ". " & Err.Number & " - " & Err.Description)

Call LogDatabaseError("Error in AddOroBancoDatabase. UserName: " & username & ". " & Err.Number & " - " & Err.Description)
End Function


Expand Down
4 changes: 2 additions & 2 deletions Codigo/modGuilds.bas
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ Private Function m_EsGuildFounder(ByRef PJ As String, ByVal GuildIndex As Intege

On Error GoTo m_EsGuildFounder_Err

100 m_EsGuildFounder = (UCase$(PJ) = UCase$(Trim$(guilds(GuildIndex).Fundador)))
100 m_EsGuildFounder = (UCase$(PJ) = UCase$(Trim$(GetUserName(guilds(GuildIndex).Fundador))))


Exit Function
Expand Down Expand Up @@ -885,7 +885,7 @@ Public Sub SendGuildDetails(ByVal UserIndex As Integer, ByRef GuildName As Strin
102 If GI = 0 Then Exit Sub

104 With guilds(GI)
106 Call WriteGuildDetails(UserIndex, GuildName, .Fundador, .GetFechaFundacion, .GetLeader, .CantidadDeMiembros, Alineacion2String(.Alineacion), .GetDesc, .GetNivelDeClan)
106 Call WriteGuildDetails(UserIndex, GuildName, GetUserName(.Fundador), .GetFechaFundacion, .GetLeader, .CantidadDeMiembros, Alineacion2String(.Alineacion), .GetDesc, .GetNivelDeClan)

End With

Expand Down

0 comments on commit 2eac9ee

Please sign in to comment.