Update @Pokemon.NewRoaming(...) command...
@Pokemon.NewRoaming(RoamerID,PokémonID,Level,regionID,startLevelFile,MusicLoop,[Shiny],[ScriptPath]) RoamerID & ScriptPath are new. * RoamerID (int) = A required identifier for the roaming Pokémon, can be used in scripts. * ScriptPath (str) = Path to a script file to execute after every encounter with any roaming Pokémon
This commit is contained in:
parent
4c5bd0b7f6
commit
f280c5718c
|
@ -1276,13 +1276,13 @@ nextIndex:
|
|||
'Shift the Roaming Pokemon.
|
||||
If RoamingBattle = True Then
|
||||
If FieldEffects.RoamingFled = False AndAlso Battle.Fled = False AndAlso Battle.Caught = True Or OppPokemon.HP <= 0 Or OppPokemon.Status = Pokemon.StatusProblems.Fainted Then
|
||||
If RoamingPokemonStorage.ScriptPath <> "" Then
|
||||
CType(SavedOverworld.OverworldScreen, OverworldScreen).AfterRoamingBattleScript = RoamingPokemonStorage.ScriptPath
|
||||
End If
|
||||
Core.Player.RoamingPokemonData = RoamingPokemon.RemoveRoamingPokemon(RoamingPokemonStorage)
|
||||
Else
|
||||
Core.Player.RoamingPokemonData = RoamingPokemon.ReplaceRoamingPokemon(RoamingPokemonStorage)
|
||||
End If
|
||||
If RoamingPokemonStorage.ScriptPath <> "" Then
|
||||
CType(SavedOverworld.OverworldScreen, OverworldScreen).AfterRoamingBattleScript = RoamingPokemonStorage.ScriptPath
|
||||
End If
|
||||
RoamingPokemon.ShiftRoamingPokemon(RoamingPokemonStorage.WorldID)
|
||||
End If
|
||||
|
||||
|
|
|
@ -430,6 +430,7 @@ Public Class PokemonForms
|
|||
Return FileName
|
||||
End Function
|
||||
|
||||
'Return the identifier for the Pokémon including the suffix when available, including non-data forms if desired.
|
||||
Public Shared Function GetPokemonDataFileName(ByVal Number As Integer, ByVal AdditionalData As String, Optional ByVal AlsoCheckNonDataForms As Boolean = False) As String
|
||||
Dim FileName As String = Number.ToString()
|
||||
Dim FilePath As String = GameModeManager.GetPokemonDataFilePath(FileName & ".dat")
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
Public Class RoamingPokemon
|
||||
|
||||
Public RoamerID As Integer = -1
|
||||
Public WorldID As Integer = -1
|
||||
Public LevelFile As String = ""
|
||||
Public MusicLoop As String = ""
|
||||
|
@ -9,19 +10,20 @@ Public Class RoamingPokemon
|
|||
Public Sub New(ByVal DataLine As String)
|
||||
Dim data() As String = DataLine.Split(CChar("|"))
|
||||
|
||||
Me.RoamerID = CInt(data(0))
|
||||
Me.PokemonReference = Pokemon.GetPokemonByData(data(6))
|
||||
|
||||
Me.WorldID = CInt(data(2))
|
||||
Me.LevelFile = data(3)
|
||||
Me.MusicLoop = data(4)
|
||||
Me.WorldID = CInt(data(3))
|
||||
Me.LevelFile = data(4)
|
||||
Me.MusicLoop = data(5)
|
||||
|
||||
If data.Length = 8 Then
|
||||
ScriptPath = data(7)
|
||||
If data.Length = 9 Then
|
||||
ScriptPath = data(8)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Function CompareData() As String
|
||||
Return Me.PokemonReference.Number.ToString() & "|" & Me.PokemonReference.Level.ToString() & "|" & Me.WorldID.ToString() & "|"
|
||||
Return Me.RoamerID.ToString & "|" & PokemonForms.GetPokemonDataFileName(Me.PokemonReference.Number, Me.PokemonReference.AdditionalData, True) & "|" & Me.PokemonReference.Level.ToString() & "|" & Me.WorldID.ToString() & "|"
|
||||
End Function
|
||||
|
||||
Public Function GetPokemon() As Pokemon
|
||||
|
@ -33,14 +35,14 @@ Public Class RoamingPokemon
|
|||
|
||||
Dim newData As String = ""
|
||||
For Each line As String In Core.Player.RoamingPokemonData.SplitAtNewline()
|
||||
If line <> "" And line.CountSeperators("|") >= 6 Then
|
||||
If line <> "" And line.CountSeperators("|") >= 7 Then
|
||||
Dim data() As String = line.Split(CChar("|"))
|
||||
|
||||
If newData <> "" Then
|
||||
newData &= Environment.NewLine
|
||||
End If
|
||||
|
||||
If CInt(data(2)) = worldID Or worldID = -1 Then
|
||||
If CInt(data(3)) = worldID Or worldID = -1 Then
|
||||
Dim regionsFile As String = GameModeManager.GetScriptPath("worldmap\roaming_regions.dat")
|
||||
Security.FileValidation.CheckFileValid(regionsFile, False, "RoamingPokemon.vb")
|
||||
|
||||
|
@ -48,22 +50,23 @@ Public Class RoamingPokemon
|
|||
Dim levelList As New List(Of String)
|
||||
|
||||
For Each worldLine As String In worldList
|
||||
If worldLine.StartsWith(CInt(data(2)).ToString() & "|") = True Then
|
||||
If worldLine.StartsWith(CInt(data(3)).ToString() & "|") = True Then
|
||||
levelList = worldLine.Remove(0, worldLine.IndexOf("|") + 1).Split(CChar(",")).ToList()
|
||||
End If
|
||||
Next
|
||||
|
||||
Dim currentIndex As Integer = levelList.IndexOf(data(3))
|
||||
Dim currentIndex As Integer = levelList.IndexOf(data(4))
|
||||
Dim nextIndex As Integer = currentIndex + 1
|
||||
If nextIndex > levelList.Count - 1 Then
|
||||
nextIndex = 0
|
||||
End If
|
||||
If data.Length = 7 Then
|
||||
'PokémonID,Level,regionID,startLevelFile,MusicLoop,Shiny,PokemonData,ScriptPath
|
||||
newData &= data(0) & "|" & data(1) & "|" & CInt(data(2)).ToString() & "|" & levelList(nextIndex) & "|" & data(4) & "|" & data(5) & "|" & data(6) & "|"
|
||||
'RoamerID|PokémonID|Level|regionID|startLevelFile|MusicLoop|Shiny|PokemonData|ScriptPath
|
||||
If data.Length = 8 Then
|
||||
'No Script
|
||||
newData &= data(0) & "|" & data(1) & "|" & data(2) & "|" & CInt(data(3)).ToString() & "|" & levelList(nextIndex) & "|" & data(5) & "|" & data(6) & "|" & data(7) & "|"
|
||||
Else
|
||||
'PokémonID,Level,regionID,startLevelFile,MusicLoop,Shiny,PokemonData,ScriptPath
|
||||
newData &= data(0) & "|" & data(1) & "|" & CInt(data(2)).ToString() & "|" & levelList(nextIndex) & "|" & data(4) & "|" & data(5) & "|" & data(6) & "|" & data(7)
|
||||
'With Script
|
||||
newData &= data(0) & "|" & data(1) & "|" & data(2) & "|" & CInt(data(3)).ToString() & "|" & levelList(nextIndex) & "|" & data(5) & "|" & data(6) & "|" & data(7) & "|" & data(8)
|
||||
End If
|
||||
|
||||
Else
|
||||
|
@ -85,7 +88,12 @@ Public Class RoamingPokemon
|
|||
Dim newData As String = ""
|
||||
|
||||
For Each line As String In Core.Player.RoamingPokemonData.SplitAtNewline()
|
||||
If line.StartsWith(compareData) = False Then
|
||||
If line.CountSeperators("|") = 7 AndAlso line.StartsWith(compareData.Remove(0, compareData.IndexOf("|") + 1)) = False Then
|
||||
If newData <> "" Then
|
||||
newData &= Environment.NewLine
|
||||
End If
|
||||
newData &= line
|
||||
ElseIf line.StartsWith(compareData) = False Then
|
||||
If newData <> "" Then
|
||||
newData &= Environment.NewLine
|
||||
End If
|
||||
|
@ -105,10 +113,13 @@ Public Class RoamingPokemon
|
|||
If newData <> "" Then
|
||||
newData &= Environment.NewLine
|
||||
End If
|
||||
If line.StartsWith(compareData) = False Then
|
||||
|
||||
If line.CountSeperators("|") = 7 AndAlso line.StartsWith(compareData.Remove(0, compareData.IndexOf("|") + 1)) = False Then
|
||||
newData &= line
|
||||
ElseIf line.StartsWith(compareData) = False Then
|
||||
newData &= line
|
||||
Else
|
||||
newData &= p.PokemonReference.Number & "|" & p.PokemonReference.Level & "|" & p.WorldID.ToString() & "|" & p.LevelFile & "|" & p.MusicLoop & "|" & p.PokemonReference.IsShiny & "|" & p.PokemonReference.GetSaveData() & "|" & p.ScriptPath
|
||||
newData &= p.RoamerID & "|" & p.PokemonReference.Number & "|" & p.PokemonReference.Level & "|" & p.WorldID.ToString() & "|" & p.LevelFile & "|" & p.MusicLoop & "|" & p.PokemonReference.IsShiny & "|" & p.PokemonReference.GetSaveData() & "|" & p.ScriptPath
|
||||
End If
|
||||
Next
|
||||
|
||||
|
|
|
@ -108,8 +108,12 @@ Public Class Spawner
|
|||
Dim possibleEncounters As New List(Of String)
|
||||
|
||||
For Each cLine As String In roamingData
|
||||
If cLine <> "" And cLine.CountSeperators("|") >= 6 Then
|
||||
possibleEncounters.Add(cLine)
|
||||
If cLine <> "" Then
|
||||
If cLine.CountSeperators("|") >= 8 Then
|
||||
possibleEncounters.Add(cLine)
|
||||
ElseIf cLine.CountSeperators("|") = 7 Then
|
||||
possibleEncounters.Add(Random.Next(100, 1001).ToString & "|" & cLine)
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
|
@ -120,7 +124,7 @@ Public Class Spawner
|
|||
Dim line As String = possibleEncounters(i)
|
||||
Dim data() As String = line.Split(CChar("|"))
|
||||
|
||||
If data(3).ToLower() = LevelFile.ToLower() Then
|
||||
If data(4).ToLower() = LevelFile.ToLower() Then
|
||||
Return New RoamingPokemon(line)
|
||||
End If
|
||||
Next
|
||||
|
|
|
@ -673,37 +673,37 @@
|
|||
Core.Player.Pokemons(Index).CatchLocation = placeLocalization
|
||||
End If
|
||||
Case "newroaming"
|
||||
' PokémonID,Level,regionID,startLevelFile,MusicLoop,[Shiny],[ScriptPath]
|
||||
' RoamerID,PokémonID,Level,regionID,startLevelFile,MusicLoop,[Shiny],[ScriptPath]
|
||||
Dim data() As String = argument.Split(CChar(","))
|
||||
|
||||
Dim PokemonID As String = data(0)
|
||||
Dim PokemonID As String = data(1)
|
||||
Dim PokemonAddition As String = "xXx"
|
||||
If PokemonID.Contains("_") Then
|
||||
PokemonAddition = PokemonForms.GetAdditionalValueFromDataFile(data(0))
|
||||
PokemonID = data(0).GetSplit(0, "_")
|
||||
PokemonID = data(1).GetSplit(0, "_")
|
||||
End If
|
||||
If PokemonID.Contains(";") Then
|
||||
PokemonAddition = data(0).GetSplit(1, ";")
|
||||
PokemonID = data(0).GetSplit(0, ";")
|
||||
PokemonID = data(1).GetSplit(0, ";")
|
||||
End If
|
||||
|
||||
Dim p As Pokemon = Pokemon.GetPokemonByID(CInt(PokemonID), PokemonAddition)
|
||||
p.Generate(CInt(data(1)), True, PokemonAddition)
|
||||
p.Generate(CInt(data(2)), True, PokemonAddition)
|
||||
|
||||
If data.Length > 5 AndAlso data(5) <> "" AndAlso data(5) <> "-1" Then
|
||||
p.IsShiny = CBool(data(5))
|
||||
If data.Length > 6 AndAlso data(6) <> "" AndAlso data(6) <> "-1" Then
|
||||
p.IsShiny = CBool(data(6))
|
||||
End If
|
||||
|
||||
Dim ScriptPath As String = ""
|
||||
If data.Length > 6 AndAlso data(6) <> "" Then
|
||||
ScriptPath = data(6)
|
||||
If data.Length > 7 AndAlso data(7) <> "" Then
|
||||
ScriptPath = data(7)
|
||||
End If
|
||||
|
||||
If Core.Player.RoamingPokemonData <> "" Then
|
||||
Core.Player.RoamingPokemonData &= Environment.NewLine
|
||||
End If
|
||||
|
||||
Core.Player.RoamingPokemonData &= data(0) & "|" & data(1) & "|" & data(2) & "|" & data(3) & "|" & data(4) & "|" & p.IsShiny & "|" & p.GetSaveData() & "|" & ScriptPath
|
||||
Core.Player.RoamingPokemonData &= data(0) & "|" & data(1) & "|" & data(2) & "|" & data(3) & "|" & data(4) & "|" & data(5) & "|" & p.IsShiny & "|" & p.GetSaveData() & "|" & ScriptPath
|
||||
Case "evolve"
|
||||
Dim args() As String = argument.Split(CChar(","))
|
||||
Dim triggerStr As String = "level"
|
||||
|
|
|
@ -804,10 +804,13 @@ Namespace ScriptVersion2
|
|||
New ScriptArgument("location", ScriptArgument.ArgumentTypes.Str)}.ToList(), "Sets the Catch Location of a Pokémon in the player's party."))
|
||||
r(New ScriptCommand("pokemon", "setstatus", {New ScriptArgument("pokemonIndex", ScriptArgument.ArgumentTypes.Int),
|
||||
New ScriptArgument("status", ScriptArgument.ArgumentTypes.Str, {"brn", "frz", "prz", "psn", "bpsn", "slp", "fnt"})}.ToList(), "Sets the status of a Pokémon in the player's party. Setting that to ""fnt"" (Fainted) will also set the Pokémon's HP to 0."))
|
||||
r(New ScriptCommand("pokemon", "newroaming", {New ScriptArgument("pokemonID", ScriptArgument.ArgumentTypes.Int),
|
||||
r(New ScriptCommand("pokemon", "newroaming", {New ScriptArgument("roamerID", ScriptArgument.ArgumentTypes.Int),
|
||||
New ScriptArgument("pokemonID", ScriptArgument.ArgumentTypes.Str),
|
||||
New ScriptArgument("level", ScriptArgument.ArgumentTypes.Int),
|
||||
New ScriptArgument("regionID", ScriptArgument.ArgumentTypes.Int),
|
||||
New ScriptArgument("startMap", ScriptArgument.ArgumentTypes.Str)}.ToList(), "Adds a new Roaming Pokémon to the list of Roaming Pokémon.", "|", False))
|
||||
New ScriptArgument("startMap", ScriptArgument.ArgumentTypes.Str),
|
||||
New ScriptArgument("shiny", ScriptArgument.ArgumentTypes.Bool, True, "-1"),
|
||||
New ScriptArgument("scriptPath", ScriptArgument.ArgumentTypes.Str, True)}.ToList(), "Adds a new Roaming Pokémon to the list of Roaming Pokémon.", "|", False))
|
||||
r(New ScriptCommand("pokemon", "evolve", {New ScriptArgument("pokemonIndex", ScriptArgument.ArgumentTypes.Int),
|
||||
New ScriptArgument("evolutionTrigger", ScriptArgument.ArgumentTypes.Str, {"level", "none", "item", "trade"}, True, "level"),
|
||||
New ScriptArgument("evolutionArgument", ScriptArgument.ArgumentTypes.Str, True, "")}.ToList(), "Tries to evolve a Pokémon with the given conditions."))
|
||||
|
|
Loading…
Reference in New Issue