Make it possible to use pkmn data when spawning

This commit is contained in:
JappaWakka 2024-08-26 13:19:15 +02:00
parent a96c13f123
commit eaa0c8d2c3

View File

@ -182,21 +182,32 @@ Public Class Spawner
level = CInt(GameModeManager.GetGameRuleValue("MaxLevel", "100")) level = CInt(GameModeManager.GetGameRuleValue("MaxLevel", "100"))
End If End If
Dim PkID As Integer = CInt(Pokemons(i).Split(CChar("_"))(0)) Dim p As Pokemon
Dim PkAD As String = ""
Dim p As Pokemon = Pokemon.GetPokemonByID(PkID) If Pokemons(i).StartsWith("{") = True Then
For Each region As String In Screen.Level.RegionalForm.ToLower().Split(CChar(",")) Dim data As String = Pokemons(i).Remove(0, Pokemons(i).IndexOf("{"))
If p.RegionalForms <> Nothing AndAlso p.RegionalForms.ToLower().Contains(region) Then p = Pokemon.GetPokemonByData(data.Replace("§", ",").Replace("«", "[").Replace("»", "]"))
PkAD = region p.Level = level
p.CalculateStats()
p.FullRestore()
Else
Dim PkID As Integer = CInt(Pokemons(i).Split(CChar("_"))(0))
Dim PkAD As String = ""
p = Pokemon.GetPokemonByID(PkID)
For Each region As String In Screen.Level.RegionalForm.ToLower().Split(CChar(","))
If p.RegionalForms <> Nothing AndAlso p.RegionalForms.ToLower().Contains(region) Then
PkAD = region
End If
Next
If Pokemons(i).Contains("_") Then
PkAD = PokemonForms.GetAdditionalValueFromDataFile(Pokemons(i).Split(CChar("_"))(1))
ElseIf Pokemons(i).Contains(";") Then
PkAD = Pokemons(i).Split(CChar(";"))(1)
End If End If
Next p = Pokemon.GetPokemonByID(PkID, PkAD)
If Pokemons(i).Contains("_") Then p.Generate(level, True, PkAD)
PkAD = PokemonForms.GetAdditionalValueFromDataFile(Pokemons(i).Split(CChar("_"))(1))
ElseIf Pokemons(i).Contains(";") Then
PkAD = Pokemons(i).Split(CChar(";"))(1)
End If End If
p = Pokemon.GetPokemonByID(PkID, PkAD)
p.Generate(level, True, PkAD)
p.ReloadDefinitions() p.ReloadDefinitions()
p.CalculateStats() p.CalculateStats()