Skip to content

Commit

Permalink
Merge pull request #349 from ao-org/bug-fixing
Browse files Browse the repository at this point in the history
Bug fixing
  • Loading branch information
RecoX authored Aug 6, 2023
2 parents 2eac9ee + 49d7fa4 commit 18c3b87
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Codigo/Declares.bas
Original file line number Diff line number Diff line change
Expand Up @@ -2996,7 +2996,7 @@ Public Sub SetUserTelemetryKey(ByVal UserIndex As Integer)
End With
End Sub

Public Sub SetBaseDot(ByRef DotInfo As t_BaseDotInfo, ByVal TargetIndex As Integer, ByVal RefType As e_ReferenceType, ByVal UniqueId As Integer, ByVal EotId As Integer)
Public Sub SetBaseDot(ByRef DotInfo As t_BaseDotInfo, ByVal TargetIndex As Integer, ByVal RefType As e_ReferenceType, ByVal UniqueId As Long, ByVal EotId As Integer)
Call SetRef(DotInfo.TargetRef, TargetIndex, RefType)
DotInfo.RemoveEffect = False
DotInfo.Removed = False
Expand Down
4 changes: 3 additions & 1 deletion Codigo/Logging.bas
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ End Function
Public Sub LogThis(nErrNo As Long, sLogMsg As String, EventType As LogEventTypeConstants)
Dim hEvent As Long
hEvent = RegisterEventSource("", "Argentum20")
Call AddLogToCircularBuffer(sLogMsg)
If eventType = vbLogEventTypeWarning Or eventType = vbLogEventTypeError Then
Call AddLogToCircularBuffer(sLogMsg)
End If
Call ReportEvent(hEvent, EventType, 0, nErrNo, 0, 1, Len(sLogMsg), sLogMsg, 0)
End Sub

Expand Down
82 changes: 71 additions & 11 deletions Codigo/ScenarioDeathMatch.cls
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,23 @@ Private Type t_SpawnItems
timer As t_Timer
End Type

Private Type t_RemoveItem
ItemId As Integer
ItemCount As Integer
End Type

Private Type t_UserItemInfo
RemovedItems(10) As t_RemoveItem
RemovedItemCount As Integer
UserId As Long
End Type

Private Type t_UserList
UserList(100) As t_UserItemInfo
RegisteredUserCount As Integer
End Type

Dim SpawnedUserList As t_UserList
Dim MapNumber As Integer
Dim TargetScore As Integer
Dim MaxTime As Long
Expand Down Expand Up @@ -119,8 +136,22 @@ Private Sub UpdateFightAreaForPlayerCount()
FightAreaBottomRight.y = 50 + size
End Sub

Private Sub AddItemToUser(ByVal UserIndex As Integer, ByVal ItemId As Integer, ByVal ItemCount As Integer)
With UserList(UserIndex)
Dim Slot As Integer
For Slot = 1 To UBound(.invent.Object)
If .invent.Object(Slot).ObjIndex = 0 Then
.invent.Object(Slot).ObjIndex = ItemId
.invent.Object(Slot).amount = ItemCount
Exit Sub
End If
Next Slot
End With
End Sub

Private Sub RemoveForbiddenItems(ByVal UserIndex As Integer)
Dim i As Integer
Dim j As Integer
With UserList(UserIndex)
For i = 1 To UBound(.invent.Object)
If IsForbidden(.invent.Object(i).objIndex) Then
Expand All @@ -130,6 +161,24 @@ Private Sub RemoveForbiddenItems(ByVal UserIndex As Integer)
If .flags.ModificoInventario Then
Call UpdateUserInv(True, UserIndex, 0)
End If

For i = 0 To SpawnedUserList.RegisteredUserCount - 1
If SpawnedUserList.UserList(i).UserId = .id Then
Exit For
End If
Next i
If i < SpawnedUserList.RegisteredUserCount Then
For j = 0 To SpawnedUserList.UserList(i).RemovedItemCount - 1
If SpawnedUserList.UserList(i).RemovedItems(j).ItemId > 0 Then
Call AddItemToUser(UserIndex, _
SpawnedUserList.UserList(i).RemovedItems(j).ItemId, _
SpawnedUserList.UserList(i).RemovedItems(j).ItemCount)
End If
Next j
SpawnedUserList.UserList(i) = SpawnedUserList.UserList(SpawnedUserList.RegisteredUserCount - 1)
SpawnedUserList.RegisteredUserCount = SpawnedUserList.RegisteredUserCount - 1
Call UpdateUserInv(True, UserIndex, 0)
End If
End With
End Sub

Expand Down Expand Up @@ -235,7 +284,6 @@ Public Function IBaseScenario_GetScenarioName() As String
End Function

Public Sub IBaseScenario_BroadcastOpenScenario(ByVal CreatorIndex As Integer)
Call SendData(SendTarget.ToAll, 0, PrepareMessageLocaleMsg(MsgDeathMatchInstructions, "", e_FontTypeNames.FONTTYPE_GUILD))
End Sub

Public Sub IBaseScenario_SendRules(ByVal UserIndex As Integer)
Expand All @@ -254,16 +302,6 @@ Public Function IBaseScenario_RequiresSpawn() As Boolean
End Function

Public Function IBaseScenario_ValidateUser(ByVal UserIndex As Integer) As Integer
Dim i As Integer
With UserList(UserIndex)
For i = 1 To UBound(.Invent.Object)
If IsForbidden(.Invent.Object(i).objIndex) Then
IBaseScenario_ValidateUser = 404
Exit Function
End If
Next i
IBaseScenario_ValidateUser = 0
End With
End Function

Public Sub IBaseScenario_WillSummonPlayer(ByVal UserIndex As Integer)
Expand All @@ -272,6 +310,28 @@ Public Sub IBaseScenario_WillSummonPlayer(ByVal UserIndex As Integer)
spawnPos.X = RandomNumber(50 - MinArenaSize, 50 - MinArenaSize)
spawnPos.y = RandomNumber(50 - MinArenaSize, 50 - MinArenaSize)
GenericGlobalLobby.SummonCoordinates = spawnPos

Dim UserItemInfo As t_UserItemInfo
Dim i As Integer
With UserList(UserIndex)
For i = 1 To UBound(.invent.Object)
If IsForbidden(.invent.Object(i).ObjIndex) Then
UserItemInfo.RemovedItems(UserItemInfo.RemovedItemCount).ItemId = .invent.Object(i).ObjIndex
UserItemInfo.RemovedItems(UserItemInfo.RemovedItemCount).ItemCount = .invent.Object(i).amount
UserItemInfo.RemovedItemCount = UserItemInfo.RemovedItemCount + 1
.invent.Object(i).ObjIndex = 0
.invent.Object(i).amount = 0
.invent.Object(i).Equipped = 0
End If
Next i
If UserItemInfo.RemovedItemCount > 0 Then
SpawnedUserList.UserList(SpawnedUserList.RegisteredUserCount) = UserItemInfo
SpawnedUserList.UserList(SpawnedUserList.RegisteredUserCount).UserId = .id
SpawnedUserList.RegisteredUserCount = SpawnedUserList.RegisteredUserCount + 1
Call UpdateUserInv(True, UserIndex, 0)
End If
End With

End Sub

Public Sub IBaseScenario_UpdateLobbyState(ByVal oldState As e_LobbyState, ByRef newState As e_LobbyState)
Expand Down
23 changes: 14 additions & 9 deletions Codigo/clsTrap.cls
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,22 @@ End Enum

Const ACTIVATE_TRAOP_WAW_FILE = 210


Public Sub Setup(ByVal SourceIndex As Integer, ByVal SourceType As e_ReferenceType, ByVal EffectId As Integer, ByVal ID As Long, _
ByVal map As Integer, ByVal TileX As Integer, ByVal TileY As Integer)
mElapsedTime = 0
Call SetBaseDot(mDotInfo, SourceIndex, SourceType, ID, EffectId)
Call SetPosition(map, TileX, TileY)
With EffectOverTime(EffectId)
mTimeLimit = .TickTime
If mDotInfo.TargetRef.RefType = eUser And EffectOverTime(mDotInfo.EotId).ClientEffectTypeId > 0 Then
Call WriteSendSkillCdUpdate(SourceIndex, .ClientEffectTypeId, ID, .TickTime, .TickTime, .buffType)
End If
End With
On Error GoTo Setup_Err
100 mElapsedTime = 0
102 Call SetBaseDot(mDotInfo, SourceIndex, SourceType, id, EffectId)
104 Call SetPosition(Map, TileX, TileY)
106 With EffectOverTime(EffectId)
108 mTimeLimit = .TickTime
110 If mDotInfo.TargetRef.RefType = eUser And EffectOverTime(mDotInfo.EotId).ClientEffectTypeId > 0 Then
112 Call WriteSendSkillCdUpdate(SourceIndex, .ClientEffectTypeId, id, .TickTime, .TickTime, .buffType)
End If
End With
Exit Sub
Setup_Err:
Call TraceError(Err.Number, Err.Description, "clsTrap.Setup", Erl)
End Sub

Public Property Get IBaseEffectOverTime_TypeId() As Integer
Expand Down

0 comments on commit 18c3b87

Please sign in to comment.