From 6f5d34f0b57e242eab97561a4b5b597570d24883 Mon Sep 17 00:00:00 2001 From: darkfire006 Date: Thu, 30 Sep 2021 10:16:26 -0500 Subject: [PATCH] Allow for script determined roamer shinyness --- P3D/Player/Player.vb | 12 ++++++++++-- P3D/Pokemon/Monster/RoamingPokemon.vb | 8 ++++---- P3D/Pokemon/Wild/Spawner.vb | 2 +- P3D/Screens/MapScreen.vb | 2 +- .../ActionScript/V2/ScriptCommands/DoPokemon.vb | 8 ++++++-- 5 files changed, 22 insertions(+), 10 deletions(-) diff --git a/P3D/Player/Player.vb b/P3D/Player/Player.vb index 6b2d6e0fa..c21a5aa24 100644 --- a/P3D/Player/Player.vb +++ b/P3D/Player/Player.vb @@ -1055,9 +1055,17 @@ Dim newP As Pokemon = Pokemon.GetPokemonByID(CInt(data(0))) newP.Generate(CInt(data(1)), True) - RoamingPokemonData &= newP.Number.ToString() & "|" & newP.Level.ToString() & "|" & data(2) & "|" & data(3) & "||" & newP.GetSaveData() + RoamingPokemonData &= newP.Number.ToString() & "|" & newP.Level.ToString() & "|" & data(2) & "|" & data(3) & "||" & newP.IsShiny.ToNumberString() & "|" & newP.GetSaveData() Else - RoamingPokemonData &= line + If line.CountSeperators("|") < 6 Then + 'Update to include shiny + Dim data() As String = line.Split(CChar("|")) + Dim newP As Pokemon = Pokemon.GetPokemonByData(data(5)) + + RoamingPokemonData &= data(0) & "|" & data(1) & "|" & data(2) & "|" & data(3) & "|" & data(4) & "|" & newP.IsShiny.ToNumberString() & "|" & data(5) + Else + RoamingPokemonData &= line + End If End If Next End If diff --git a/P3D/Pokemon/Monster/RoamingPokemon.vb b/P3D/Pokemon/Monster/RoamingPokemon.vb index c1c7e0d00..78b75221b 100644 --- a/P3D/Pokemon/Monster/RoamingPokemon.vb +++ b/P3D/Pokemon/Monster/RoamingPokemon.vb @@ -28,7 +28,7 @@ Public Class RoamingPokemon Dim newData As String = "" For Each line As String In Core.Player.RoamingPokemonData.SplitAtNewline() - If line <> "" And line.CountSeperators("|") >= 5 Then + If line <> "" And line.CountSeperators("|") >= 6 Then Dim data() As String = line.Split(CChar("|")) If newData <> "" Then @@ -54,8 +54,8 @@ Public Class RoamingPokemon nextIndex = 0 End If - 'PokémonID,Level,regionID,startLevelFile,MusicLoop,PokemonData - newData &= data(0) & "|" & data(1) & "|" & CInt(data(2)).ToString() & "|" & levelList(nextIndex) & "|" & data(4) & "|" & data(5) + 'PokémonID,Level,regionID,startLevelFile,MusicLoop,Shiny,PokemonData + newData &= data(0) & "|" & data(1) & "|" & CInt(data(2)).ToString() & "|" & levelList(nextIndex) & "|" & data(4) & "|" & data(5) & "|" & data(6) Else newData &= line End If @@ -98,7 +98,7 @@ Public Class RoamingPokemon If line.StartsWith(compareData) = False Then newData &= line Else - newData &= p.PokemonReference.Number & "|" & p.PokemonReference.Level & "|" & p.WorldID.ToString() & "|" & p.LevelFile & "|" & p.MusicLoop & "|" & p.PokemonReference.GetSaveData() + newData &= p.PokemonReference.Number & "|" & p.PokemonReference.Level & "|" & p.WorldID.ToString() & "|" & p.LevelFile & "|" & p.MusicLoop & "|" & p.PokemonReference.IsShiny & "|" & p.PokemonReference.GetSaveData() End If Next diff --git a/P3D/Pokemon/Wild/Spawner.vb b/P3D/Pokemon/Wild/Spawner.vb index 58258d1b6..8022fa274 100644 --- a/P3D/Pokemon/Wild/Spawner.vb +++ b/P3D/Pokemon/Wild/Spawner.vb @@ -108,7 +108,7 @@ Public Class Spawner Dim possibleEncounters As New List(Of String) For Each cLine As String In roamingData - If cLine <> "" And cLine.CountSeperators("|") = 5 Then + If cLine <> "" And cLine.CountSeperators("|") = 6 Then possibleEncounters.Add(cLine) End If Next diff --git a/P3D/Screens/MapScreen.vb b/P3D/Screens/MapScreen.vb index 4b6ed621e..3ff8ae010 100644 --- a/P3D/Screens/MapScreen.vb +++ b/P3D/Screens/MapScreen.vb @@ -233,7 +233,7 @@ If Not String.IsNullOrWhiteSpace(Core.Player.RoamingPokemonData) Then If Core.Player.RoamingPokemonData.Length > 0 AndAlso Core.Player.RoamingPokemonData.Contains("|") Then For Each Pokes As String In Core.Player.RoamingPokemonData.SplitAtNewline - ' PokémonID,Level,regionID,startLevelFile,MusicLoop,PokemonData + ' PokémonID,Level,regionID,startLevelFile,MusicLoop,Shiny,PokemonData Dim TempData() As String = Pokes.Split("|") Dim MapFiles() As String = Tags("mapfiles").Split(",") Dim PokeCurrentLocation As String = TempData(3) diff --git a/P3D/World/ActionScript/V2/ScriptCommands/DoPokemon.vb b/P3D/World/ActionScript/V2/ScriptCommands/DoPokemon.vb index 5522dad26..3a648fc7f 100644 --- a/P3D/World/ActionScript/V2/ScriptCommands/DoPokemon.vb +++ b/P3D/World/ActionScript/V2/ScriptCommands/DoPokemon.vb @@ -599,16 +599,20 @@ Core.Player.Pokemons(Index).CatchLocation = place End If Case "newroaming" - ' PokémonID,Level,regionID,startLevelFile,MusicLoop + ' PokémonID,Level,regionID,startLevelFile,MusicLoop,[Shiny] Dim data() As String = argument.Split(CChar(",")) Dim p As Pokemon = Pokemon.GetPokemonByID(CInt(data(0))) p.Generate(CInt(data(1)), True) + If data.Length > 5 AndAlso data(5) <> "" AndAlso data(5) <> "-1" Then + p.IsShiny = CBool(data(5)) + 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.GetSaveData() + Core.Player.RoamingPokemonData &= data(0) & "|" & data(1) & "|" & data(2) & "|" & data(3) & "|" & data(4) & "|" & data(5) & "|" & p.GetSaveData() Case "evolve" Dim args() As String = argument.Split(CChar(",")) Dim triggerStr As String = "level"