Hopefully get rid of example.dat error messages

This commit is contained in:
JappaWakka 2023-07-07 12:05:57 +02:00
parent 4b97c2ca24
commit 6764062c79
2 changed files with 61 additions and 49 deletions

View File

@ -45,12 +45,14 @@
Dim value As String = ""
Dim setID As Boolean = False 'Controls if the move sets its ID.
Dim nonCommentLines As Integer = 0
Try
'Go through lines of the file and set the properties depending on the content.
'Lines starting with # are comments.
For Each l As String In content
If l.Contains("|") = True And l.StartsWith("#") = False Then
nonCommentLines += 1
key = l.Remove(l.IndexOf("|"))
value = l.Remove(0, l.IndexOf("|") + 1)
@ -188,6 +190,7 @@
Logger.Log(Logger.LogTypes.ErrorMessage, "GameModeAttackLoader.vb: Error loading GameMode move from file """ & file & """: " & ex.Message & "; Last Key/Value pair successfully loaded: " & key & "|" & value)
End Try
If nonCommentLines > 0 Then
If setID = True Then
If move.ID >= 1000 Then
Dim testMove As Attack = Attack.GetAttackByID(move.ID)
@ -202,6 +205,9 @@
Else
Logger.Log(Logger.LogTypes.ErrorMessage, "GameModeAttackLoader.vb: User defined moves must set their ID through the ""ID"" property, however the move loaded from """ & file & """ has no ID set so it will be ignored.")
End If
Else
Debug.Print("GameModeAttackLoader.vb: The move loaded from """ & file & """ has no valid lines so it will be ignored.")
End If
End Sub
''' <summary>

View File

@ -45,12 +45,14 @@ Public Class GameModeItemLoader
Dim setID As Boolean = False 'Controls if the item sets its ID.
Dim setName As Boolean = False 'Controls if the item sets its ID.
Dim nonCommentLines As Integer = 0
Try
'Go through lines of the file and set the properties depending on the content.
'Lines starting with # are comments.
For Each l As String In content
If l.Contains("|") = True And l.StartsWith("#") = False Then
nonCommentLines += 1
key = l.Remove(l.IndexOf("|"))
value = l.Remove(0, l.IndexOf("|") + 1)
@ -163,6 +165,7 @@ Public Class GameModeItemLoader
Logger.Log(Logger.LogTypes.ErrorMessage, "GameModeItemLoader.vb: Error loading GameMode Item from file """ & file & """: " & ex.Message & "; Last Key/Value pair successfully loaded: " & key & "|" & value)
End Try
If nonCommentLines > 0 Then
If setID = True AndAlso setName = True Then
If item.gmIsMegaStone = True AndAlso item.gmMegaPokemonNumber <> Nothing AndAlso item.gmDescription = "" Then
Dim MegaPokemonName As String = Pokemon.GetPokemonByID(item.gmMegaPokemonNumber, item.AdditionalData).GetName
@ -210,6 +213,9 @@ Public Class GameModeItemLoader
Else
Logger.Log(Logger.LogTypes.ErrorMessage, "GameModeItemLoader.vb: User defined Items must set their ID through the ""ID"" property and their Name through the ""Name"" property, however the item loaded from """ & file & """ has no ID or Name set so it will be ignored.")
End If
Else
Debug.Print("GameModeItemLoader.vb: The item loaded from """ & file & """ has no valid lines so it will be ignored.")
End If
End Sub
''' <summary>