diff --git a/2.5DHero/2.5DHero/World/ActionScript/V2/ScriptCommands/DoPokemon.vb b/2.5DHero/2.5DHero/World/ActionScript/V2/ScriptCommands/DoPokemon.vb index 63b17cd4b..da47c4afe 100644 --- a/2.5DHero/2.5DHero/World/ActionScript/V2/ScriptCommands/DoPokemon.vb +++ b/2.5DHero/2.5DHero/World/ActionScript/V2/ScriptCommands/DoPokemon.vb @@ -602,6 +602,93 @@ Core.Player.Pokemons.RemoveAt(PokemonIndex) End If End If + Case "addtostorage" + ' @Pokemon.AddToStorage([BoxIndex], PokemonData) + ' @Pokemon.AddToStorage(PokemonID, Level, [Method], [BallID], [Location], [isEgg], [trainerName]) + + If argument.StartsWith("{") = True Or argument.Remove(0, 1).StartsWith(",{") = True Then + Dim insertIndex As Integer = Core.Player.Pokemons.Count + If argument.Remove(0, 1).StartsWith(",{") = True Then + insertIndex = int(argument.GetSplit(0)) + End If + + argument = argument.Remove(0, argument.IndexOf("{")) + + Dim p As Pokemon = Pokemon.GetPokemonByData(argument.Replace("ยง", ",")) + StorageSystemScreen.DepositPokemon(p, insertIndex) + + Dim pokedexType As Integer = 2 + If p.IsShiny = True Then + pokedexType = 3 + End If + + If p.IsEgg() = False Then + Core.Player.PokedexData = Pokedex.ChangeEntry(Core.Player.PokedexData, p.Number, pokedexType) + End If + Else + Dim commas As Integer = 0 + For Each c As Char In argument + If c = "," Then + commas += 1 + End If + Next + + Dim PokemonID As Integer = int(argument.GetSplit(0)) + Dim Level As Integer = int(argument.GetSplit(1)) + + Dim catchMethod As String = "random reason" + If commas > 1 Then + catchMethod = argument.GetSplit(2) + End If + + Dim catchBall As Item = Item.GetItemByID(1) + If commas > 2 Then + catchBall = Item.GetItemByID(int(argument.GetSplit(3))) + End If + + Dim catchLocation As String = Screen.Level.MapName + If commas > 3 Then + catchLocation = argument.GetSplit(4) + End If + + Dim isEgg As Boolean = False + If commas > 4 Then + isEgg = CBool(argument.GetSplit(5)) + End If + + Dim catchTrainer As String = Core.Player.Name + If commas > 5 And argument.GetSplit(6) <> "" Then + catchTrainer = argument.GetSplit(6) + End If + + Dim Pokemon As Pokemon = Pokemon.GetPokemonByID(PokemonID) + Pokemon.Generate(Level, True) + + Pokemon.CatchTrainerName = catchTrainer + Pokemon.OT = Core.Player.OT + + Pokemon.CatchLocation = catchLocation + Pokemon.CatchBall = catchBall + Pokemon.CatchMethod = catchMethod + + If isEgg = True Then + Pokemon.EggSteps = 1 + Pokemon.SetCatchInfos(Item.GetItemByID(5), "obtained at") + Else + Pokemon.EggSteps = 0 + End If + + StorageSystemScreen.DepositPokemon(Pokemon) + + Dim pokedexType As Integer = 2 + If Pokemon.IsShiny = True Then + pokedexType = 3 + End If + + If Pokemon.IsEgg() = False Then + Core.Player.PokedexData = Pokedex.ChangeEntry(Core.Player.PokedexData, Pokemon.Number, pokedexType) + End If + End If End Select IsReady = True