Hopefully get rid of example.dat error messages
This commit is contained in:
parent
4b97c2ca24
commit
6764062c79
|
@ -45,12 +45,14 @@
|
||||||
Dim value As String = ""
|
Dim value As String = ""
|
||||||
|
|
||||||
Dim setID As Boolean = False 'Controls if the move sets its ID.
|
Dim setID As Boolean = False 'Controls if the move sets its ID.
|
||||||
|
Dim nonCommentLines As Integer = 0
|
||||||
|
|
||||||
Try
|
Try
|
||||||
'Go through lines of the file and set the properties depending on the content.
|
'Go through lines of the file and set the properties depending on the content.
|
||||||
'Lines starting with # are comments.
|
'Lines starting with # are comments.
|
||||||
For Each l As String In content
|
For Each l As String In content
|
||||||
If l.Contains("|") = True And l.StartsWith("#") = False Then
|
If l.Contains("|") = True And l.StartsWith("#") = False Then
|
||||||
|
nonCommentLines += 1
|
||||||
key = l.Remove(l.IndexOf("|"))
|
key = l.Remove(l.IndexOf("|"))
|
||||||
value = l.Remove(0, l.IndexOf("|") + 1)
|
value = l.Remove(0, l.IndexOf("|") + 1)
|
||||||
|
|
||||||
|
@ -188,19 +190,23 @@
|
||||||
Logger.Log(Logger.LogTypes.ErrorMessage, "GameModeAttackLoader.vb: Error loading GameMode move from file """ & file & """: " & ex.Message & "; Last Key/Value pair successfully loaded: " & key & "|" & value)
|
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
|
End Try
|
||||||
|
|
||||||
If setID = True Then
|
If nonCommentLines > 0 Then
|
||||||
If move.ID >= 1000 Then
|
If setID = True Then
|
||||||
Dim testMove As Attack = Attack.GetAttackByID(move.ID)
|
If move.ID >= 1000 Then
|
||||||
If testMove.IsDefaultMove = True Then
|
Dim testMove As Attack = Attack.GetAttackByID(move.ID)
|
||||||
LoadedMoves.Add(move) 'Add the move.
|
If testMove.IsDefaultMove = True Then
|
||||||
|
LoadedMoves.Add(move) 'Add the move.
|
||||||
|
Else
|
||||||
|
Logger.Log(Logger.LogTypes.ErrorMessage, "GameModeAttackLoader.vb: User defined moves are not allowed to have an ID of an already existing move or an ID below 1000. The ID for the move loaded from """ & file & """ has the ID " & move.ID.ToString() & ", which is the ID of an already existing move (" & testMove.Name & ").")
|
||||||
|
End If
|
||||||
Else
|
Else
|
||||||
Logger.Log(Logger.LogTypes.ErrorMessage, "GameModeAttackLoader.vb: User defined moves are not allowed to have an ID of an already existing move or an ID below 1000. The ID for the move loaded from """ & file & """ has the ID " & move.ID.ToString() & ", which is the ID of an already existing move (" & testMove.Name & ").")
|
Logger.Log(Logger.LogTypes.ErrorMessage, "GameModeAttackLoader.vb: User defined moves are not allowed to have an ID of an already existing move or an ID below 1000. The ID for the move loaded from """ & file & """ has the ID " & move.ID.ToString() & ", which is smaller than 1000.")
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
Logger.Log(Logger.LogTypes.ErrorMessage, "GameModeAttackLoader.vb: User defined moves are not allowed to have an ID of an already existing move or an ID below 1000. The ID for the move loaded from """ & file & """ has the ID " & move.ID.ToString() & ", which is smaller than 1000.")
|
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
|
End If
|
||||||
Else
|
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.")
|
Debug.Print("GameModeAttackLoader.vb: The move loaded from """ & file & """ has no valid lines so it will be ignored.")
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
|
@ -45,12 +45,14 @@ Public Class GameModeItemLoader
|
||||||
|
|
||||||
Dim setID As Boolean = False 'Controls if the item sets its ID.
|
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 setName As Boolean = False 'Controls if the item sets its ID.
|
||||||
|
Dim nonCommentLines As Integer = 0
|
||||||
|
|
||||||
Try
|
Try
|
||||||
'Go through lines of the file and set the properties depending on the content.
|
'Go through lines of the file and set the properties depending on the content.
|
||||||
'Lines starting with # are comments.
|
'Lines starting with # are comments.
|
||||||
For Each l As String In content
|
For Each l As String In content
|
||||||
If l.Contains("|") = True And l.StartsWith("#") = False Then
|
If l.Contains("|") = True And l.StartsWith("#") = False Then
|
||||||
|
nonCommentLines += 1
|
||||||
key = l.Remove(l.IndexOf("|"))
|
key = l.Remove(l.IndexOf("|"))
|
||||||
value = l.Remove(0, l.IndexOf("|") + 1)
|
value = l.Remove(0, l.IndexOf("|") + 1)
|
||||||
|
|
||||||
|
@ -163,52 +165,56 @@ 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)
|
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
|
End Try
|
||||||
|
|
||||||
If setID = True AndAlso setName = True Then
|
If nonCommentLines > 0 Then
|
||||||
If item.gmIsMegaStone = True AndAlso item.gmMegaPokemonNumber <> Nothing AndAlso item.gmDescription = "" Then
|
If setID = True AndAlso setName = True Then
|
||||||
Dim MegaPokemonName As String = Pokemon.GetPokemonByID(item.gmMegaPokemonNumber, item.AdditionalData).GetName
|
If item.gmIsMegaStone = True AndAlso item.gmMegaPokemonNumber <> Nothing AndAlso item.gmDescription = "" Then
|
||||||
item.gmDescription = "One variety of the mysterious Mega Stones. Have " & MegaPokemonName & " hold it, and this stone will enable it to Mega Evolve during battle."
|
Dim MegaPokemonName As String = Pokemon.GetPokemonByID(item.gmMegaPokemonNumber, item.AdditionalData).GetName
|
||||||
item.gmCanBeTossed = False
|
item.gmDescription = "One variety of the mysterious Mega Stones. Have " & MegaPokemonName & " hold it, and this stone will enable it to Mega Evolve during battle."
|
||||||
item.gmCanBeTraded = False
|
item.gmCanBeTossed = False
|
||||||
item.gmCanBeUsed = False
|
item.gmCanBeTraded = False
|
||||||
item.gmCanBeUsedInBattle = False
|
item.gmCanBeUsed = False
|
||||||
End If
|
item.gmCanBeUsedInBattle = False
|
||||||
If item.gmIsTM = True AndAlso item.gmTeachMove IsNot Nothing AndAlso item.gmDescription = "" Then
|
|
||||||
Dim AttackName As String = item.gmTeachMove.Name
|
|
||||||
item.gmDescription = "Teaches """ & AttackName & """ to a Pokémon."
|
|
||||||
item.gmItemType = ItemTypes.Machines
|
|
||||||
item.gmCanBeHeld = False
|
|
||||||
item.gmCanBeTossed = True
|
|
||||||
item.gmCanBeTraded = True
|
|
||||||
item.gmCanBeUsed = True
|
|
||||||
item.gmCanBeUsedInBattle = False
|
|
||||||
If item.gmName.StartsWith("TM ") Then
|
|
||||||
item.gmSortValue = CInt(item.gmName.Remove(0, 3)) + 190
|
|
||||||
ElseIf item.gmName.StartsWith("TM") Then
|
|
||||||
item.gmSortValue = CInt(item.gmName.Remove(0, 2)) + 190
|
|
||||||
End If
|
End If
|
||||||
If item.gmName.StartsWith("HM ") Then
|
If item.gmIsTM = True AndAlso item.gmTeachMove IsNot Nothing AndAlso item.gmDescription = "" Then
|
||||||
item.gmSortValue = -100000 + CInt(item.gmName.Remove(0, 3))
|
Dim AttackName As String = item.gmTeachMove.Name
|
||||||
ElseIf item.gmName.StartsWith("HM") Then
|
item.gmDescription = "Teaches """ & AttackName & """ to a Pokémon."
|
||||||
item.gmSortValue = -100000 + CInt(item.gmName.Remove(0, 2))
|
item.gmItemType = ItemTypes.Machines
|
||||||
|
item.gmCanBeHeld = False
|
||||||
|
item.gmCanBeTossed = True
|
||||||
|
item.gmCanBeTraded = True
|
||||||
|
item.gmCanBeUsed = True
|
||||||
|
item.gmCanBeUsedInBattle = False
|
||||||
|
If item.gmName.StartsWith("TM ") Then
|
||||||
|
item.gmSortValue = CInt(item.gmName.Remove(0, 3)) + 190
|
||||||
|
ElseIf item.gmName.StartsWith("TM") Then
|
||||||
|
item.gmSortValue = CInt(item.gmName.Remove(0, 2)) + 190
|
||||||
|
End If
|
||||||
|
If item.gmName.StartsWith("HM ") Then
|
||||||
|
item.gmSortValue = -100000 + CInt(item.gmName.Remove(0, 3))
|
||||||
|
ElseIf item.gmName.StartsWith("HM") Then
|
||||||
|
item.gmSortValue = -100000 + CInt(item.gmName.Remove(0, 2))
|
||||||
|
End If
|
||||||
|
item.gmTextureSource = "Items\ItemSheet"
|
||||||
|
item.SetTeachMoveTextureRectangle()
|
||||||
|
|
||||||
End If
|
End If
|
||||||
item.gmTextureSource = "Items\ItemSheet"
|
If item.gmTextureRectangle = Nothing Then
|
||||||
item.SetTeachMoveTextureRectangle()
|
Dim itemX As Integer = CInt(item.gmID.Remove(0, 2))
|
||||||
|
Dim itemY As Integer = 0
|
||||||
|
Dim sheetWidth As Integer = CInt(TextureManager.GetTexture(item.gmTextureSource).Width / 24)
|
||||||
|
|
||||||
|
While itemX > sheetWidth - 1
|
||||||
|
itemX -= sheetWidth
|
||||||
|
itemY += 1
|
||||||
|
End While
|
||||||
|
item.gmTextureRectangle = New Rectangle(CInt(itemX * 24), CInt(itemY * 24), 24, 24)
|
||||||
|
End If
|
||||||
|
LoadedItems.Add(item) 'Add the item.
|
||||||
|
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
|
End If
|
||||||
If item.gmTextureRectangle = Nothing Then
|
|
||||||
Dim itemX As Integer = CInt(item.gmID.Remove(0, 2))
|
|
||||||
Dim itemY As Integer = 0
|
|
||||||
Dim sheetWidth As Integer = CInt(TextureManager.GetTexture(item.gmTextureSource).Width / 24)
|
|
||||||
|
|
||||||
While itemX > sheetWidth - 1
|
|
||||||
itemX -= sheetWidth
|
|
||||||
itemY += 1
|
|
||||||
End While
|
|
||||||
item.gmTextureRectangle = New Rectangle(CInt(itemX * 24), CInt(itemY * 24), 24, 24)
|
|
||||||
End If
|
|
||||||
LoadedItems.Add(item) 'Add the item.
|
|
||||||
Else
|
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.")
|
Debug.Print("GameModeItemLoader.vb: The item loaded from """ & file & """ has no valid lines so it will be ignored.")
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue