2016-09-07 18:50:38 +02:00
Namespace ScriptVersion2
Partial Class ScriptCommander
2017-01-18 21:07:45 +01:00
' --------------------------------------------------------------------------------------------------------------------------
' Contains the @pokemon commands.
' --------------------------------------------------------------------------------------------------------------------------
2016-09-07 18:50:38 +02:00
Private Shared Sub DoPokemon ( ByVal subClass As String )
Dim command As String = ScriptComparer . GetSubClassArgumentPair ( subClass ) . Command
Dim argument As String = ScriptComparer . GetSubClassArgumentPair ( subClass ) . Argument
Select Case command . ToLower ( )
Case " cry "
Dim PokemonID As Integer = int ( argument )
Dim p As Pokemon = Pokemon . GetPokemonByID ( PokemonID )
p . PlayCry ( )
Case " remove "
Dim index As Integer = int ( argument )
If Core . Player . Pokemons . Count - 1 >= index Then
Logger . Debug ( " Remove Pokémon ( " & Core . Player . Pokemons ( index ) . GetDisplayName ( ) & " ) at index " & index )
Core . Player . Pokemons . RemoveAt ( index )
End If
Case " add "
2021-09-30 01:07:04 +02:00
' @Pokemon.Add([PartyIndex], PokemonData)
' @Pokemon.Add(PokemonID, Level, [Method], [BallID], [Location], [isEgg], [trainerName], [heldItem], [isShiny])
2016-09-07 18:50:38 +02:00
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 ( " { " ) )
2019-10-07 05:24:08 +02:00
Dim p As Pokemon = Pokemon . GetPokemonByData ( argument . Replace ( " § " , " , " ) . Replace ( " « " , " [ " ) . Replace ( " » " , " ] " ) )
2016-09-07 18:50:38 +02:00
Core . Player . Pokemons . Insert ( insertIndex , p )
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 ) <> " <playername> " Then
catchTrainer = argument . GetSplit ( 6 )
End If
2018-01-06 08:50:23 +01:00
Dim heldItem As Integer = 0
If commas > 6 Then
heldItem = CInt ( argument . GetSplit ( 7 ) )
End If
2020-07-24 04:02:59 +02:00
Dim isShiny As Boolean = False
2021-09-30 01:07:04 +02:00
If Core . Random . Next ( 0 , P3D . Pokemon . MasterShinyRate ) = 0 Then
isShiny = True
End If
2020-07-24 04:02:59 +02:00
If commas > 7 Then
isShiny = CBool ( argument . GetSplit ( 8 ) )
End If
2016-09-07 18:50:38 +02:00
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
2018-01-06 08:50:23 +01:00
If heldItem <> 0 Then
Pokemon . Item = Item . GetItemByID ( heldItem )
End If
2020-07-24 04:02:59 +02:00
Pokemon . IsShiny = isShiny
2016-09-07 18:50:38 +02:00
Core . Player . Pokemons . Add ( 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
Case " setadditionalvalue " , " setadditionaldata "
Dim Index As Integer = int ( argument . GetSplit ( 0 , " , " ) )
Dim AdditionalValue As String = argument . GetSplit ( 1 , " , " )
If Core . Player . Pokemons . Count - 1 >= Index Then
Core . Player . Pokemons ( Index ) . AdditionalData = AdditionalValue
End If
Case " setnickname "
Dim Index As Integer = int ( argument . GetSplit ( 0 , " , " ) )
Dim NickName As String = argument . GetSplit ( 1 , " , " )
If Core . Player . Pokemons . Count - 1 >= Index Then
Core . Player . Pokemons ( Index ) . NickName = NickName
End If
Case " setstat "
Dim Index As Integer = int ( argument . GetSplit ( 0 , " , " ) )
Dim stat As String = argument . GetSplit ( 1 , " , " )
Dim statValue As Integer = int ( argument . GetSplit ( 2 , " , " ) )
If Core . Player . Pokemons . Count - 1 >= Index Then
With Core . Player . Pokemons ( Index )
Select Case stat . ToLower ( )
Case " maxhp " , " hp "
. MaxHP = statValue
Case " chp "
. HP = statValue
Case " atk " , " attack "
. Attack = statValue
Case " def " , " defense "
. Defense = statValue
Case " spatk " , " specialattack " , " spattack "
. SpAttack = statValue
Case " spdef " , " specialdefense " , " spdefense "
. SpDefense = statValue
Case " speed "
. Speed = statValue
End Select
End With
End If
Case " clear "
Core . Player . Pokemons . Clear ( )
Case " removeattack "
Dim Index As Integer = int ( argument . GetSplit ( 0 , " , " ) )
Dim attackIndex As Integer = int ( argument . GetSplit ( 1 , " , " ) )
If Core . Player . Pokemons . Count - 1 >= Index Then
Dim p As Pokemon = Core . Player . Pokemons ( Index )
If p . Attacks . Count - 1 >= attackIndex Then
p . Attacks . RemoveAt ( attackIndex )
End If
End If
2019-10-07 05:49:06 +02:00
Case " removeattackid "
Dim Index As Integer = int ( argument . GetSplit ( 0 , " , " ) )
Dim attackId As Integer = int ( argument . GetSplit ( 1 , " , " ) )
If Core . Player . Pokemons . Count - 1 >= Index Then
Dim p As Pokemon = Core . Player . Pokemons ( Index )
For a = 0 To ( p . Attacks . Count - 1 )
If p . Attacks ( a ) . ID = attackId Then
p . Attacks . RemoveAt ( a )
Exit For
End If
Next
End If
2016-09-07 18:50:38 +02:00
Case " clearattacks "
Dim Index As Integer = int ( argument )
If Core . Player . Pokemons . Count - 1 >= Index Then
Core . Player . Pokemons ( Index ) . Attacks . Clear ( )
End If
Case " addattack "
Dim Index As Integer = int ( argument . GetSplit ( 0 , " , " ) )
Dim attackID As Integer = int ( argument . GetSplit ( 1 , " , " ) )
If Core . Player . Pokemons . Count - 1 >= Index Then
Dim p As Pokemon = Core . Player . Pokemons ( Index )
If p . Attacks . Count < 4 Then
Dim newAttack As BattleSystem . Attack = BattleSystem . Attack . GetAttackByID ( attackID )
p . Attacks . Add ( newAttack )
End If
End If
Case " setshiny "
Dim Index As Integer = int ( argument . GetSplit ( 0 , " , " ) )
Dim isShiny As Boolean = CBool ( argument . GetSplit ( 1 , " , " ) )
If Core . Player . Pokemons . Count - 1 >= Index Then
Core . Player . Pokemons ( Index ) . IsShiny = isShiny
End If
2018-03-07 23:09:15 +01:00
Case " setshinyall "
Dim isShiny As Boolean = CBool ( argument . GetSplit ( 0 , " , " ) )
For i = 0 To Core . Player . Pokemons . Count - 1
Core . Player . Pokemons ( i ) . IsShiny = isShiny
Next
2016-09-07 18:50:38 +02:00
Case " changelevel "
Dim Index As Integer = int ( argument . GetSplit ( 0 , " , " ) )
Dim newLevel As Integer = int ( argument . GetSplit ( 1 , " , " ) )
If Core . Player . Pokemons . Count - 1 >= Index Then
Core . Player . Pokemons ( Index ) . Level = newLevel
End If
Case " gainexp "
Dim Index As Integer = int ( argument . GetSplit ( 0 , " , " ) )
Dim exp As Integer = int ( argument . GetSplit ( 1 , " , " ) )
If Core . Player . Pokemons . Count - 1 >= Index Then
Core . Player . Pokemons ( Index ) . Experience += exp
End If
Case " setnature "
Dim Index As Integer = int ( argument . GetSplit ( 0 , " , " ) )
Dim Nature As Pokemon . Natures = Pokemon . ConvertIDToNature ( int ( argument . GetSplit ( 1 , " , " ) ) )
If Core . Player . Pokemons . Count - 1 >= Index Then
Core . Player . Pokemons ( Index ) . Nature = Nature
End If
Case " npctrade "
Dim splits ( ) As String = argument . Split ( CChar ( " | " ) )
Script . SaveNPCTrade = splits
2017-08-11 09:01:17 +02:00
Dim selScreen = New PartyScreen ( Core . CurrentScreen , Item . GetItemByID ( 5 ) , AddressOf Script . DoNPCTrade , " Choose Pokémon for trade " , True ) With { . Mode = Screens . UI . ISelectionScreen . ScreenMode . Selection , . CanExit = True }
AddHandler selScreen . SelectedObject , AddressOf Script . DoNPCTradeHandler
Core . SetScreen ( selScreen )
2017-08-11 07:02:26 +02:00
CType ( Core . CurrentScreen , PartyScreen ) . ExitedSub = AddressOf Script . ExitedNPCTrade
2016-09-07 18:50:38 +02:00
CanContinue = False
Case " hide "
Screen . Level . OverworldPokemon . Visible = False
Case " rename "
Dim index As String = argument
Dim renameOTcheck As Boolean = False
Dim canRename As Boolean = True
If argument . Contains ( " , " ) = True Then
index = argument . GetSplit ( 0 )
renameOTcheck = CBool ( argument . GetSplit ( 1 ) )
End If
Dim PokemonIndex As Integer = 0
Select Case index . ToLower ( )
Case " last "
PokemonIndex = Core . Player . Pokemons . Count - 1
Case Else
PokemonIndex = int ( index )
End Select
If renameOTcheck = True Then
If Core . Player . Pokemons ( PokemonIndex ) . OT = Core . Player . OT Then
canRename = False
End If
End If
If Core . Player . Pokemons ( PokemonIndex ) . IsEgg ( ) = False Then
If canRename = True Then
Core . SetScreen ( New NameObjectScreen ( Core . CurrentScreen , Core . Player . Pokemons ( PokemonIndex ) ) )
Else
Screen . TextBox . Show ( " I cannot rename this~Pokémon because the~OT is different!*Did you receive it in~a trade or something? " )
End If
Else
Screen . TextBox . Show ( " I cannot rename~this egg... " )
End If
CanContinue = False
Case " read "
Dim p As Pokemon = Core . Player . Pokemons ( int ( argument ) )
Dim message As String = " Hm... I see your~ " & p . GetDisplayName ( )
Dim addmessage As String = " ~is very stable with~ "
If p . EVAttack > p . EVDefense And p . EVAttack > p . EVHP And p . EVAttack > p . EVSpAttack And p . EVAttack > p . EVSpDefense And p . EVAttack > p . EVSpeed Then
addmessage &= " performing physical moves. "
End If
If p . EVDefense > p . EVAttack And p . EVDefense > p . EVHP And p . EVDefense > p . EVSpAttack And p . EVDefense > p . EVSpDefense And p . EVDefense > p . EVSpeed Then
addmessage &= " taking hits. "
End If
If p . EVHP > p . EVAttack And p . EVHP > p . EVDefense And p . EVHP > p . EVSpAttack And p . EVHP > p . EVSpDefense And p . EVHP > p . EVSpeed Then
addmessage &= " taking damage. "
End If
If p . EVSpAttack > p . EVAttack And p . EVSpAttack > p . EVDefense And p . EVSpAttack > p . EVHP And p . EVSpAttack > p . EVSpDefense And p . EVSpAttack > p . EVSpeed Then
addmessage &= " performing complex strategies. "
End If
If p . EVSpDefense > p . EVAttack And p . EVSpDefense > p . EVDefense And p . EVSpDefense > p . EVHP And p . EVSpDefense > p . EVSpAttack And p . EVSpDefense > p . EVSpeed Then
addmessage &= " breaking strategies. "
End If
If p . EVSpeed > p . EVAttack And p . EVSpeed > p . EVDefense And p . EVSpeed > p . EVHP And p . EVSpeed > p . EVSpAttack And p . EVSpeed > p . EVSpDefense Then
addmessage &= " speeding the others out. "
End If
If addmessage = " ~is very stable with~ " Then
addmessage = " ~is very well balanced. "
End If
message &= addmessage
message &= " *...~...*What that means?~I am not sure... "
Screen . TextBox . Show ( message , { } , False , False )
CanContinue = False
Case " heal "
If argument = " " Then
Core . Player . HealParty ( )
Else
If argument . Contains ( " , " ) = True Then
Dim data ( ) As String = argument . Split ( CChar ( " , " ) )
Dim Members As New List ( Of Integer )
For Each member As String In data
Members . Add ( int ( member ) )
Next
Core . Player . HealParty ( Members . ToArray ( ) )
Else
Core . Player . HealParty ( { int ( argument ) } )
End If
End If
Case " setfriendship "
Dim index As Integer = int ( argument . GetSplit ( 0 ) )
Dim amount As Integer = int ( argument . GetSplit ( 1 ) )
Core . Player . Pokemons ( index ) . Friendship = amount
Case " addfriendship "
Dim index As Integer = int ( argument . GetSplit ( 0 ) )
Dim amount As Integer = int ( argument . GetSplit ( 1 ) )
Core . Player . Pokemons ( index ) . Friendship += amount
Case " select "
Dim canExit As Boolean = False
Dim canChooseEgg As Boolean = True
Dim canChooseFainted As Boolean = True
If argument <> " " Then
Dim data ( ) As String = argument . Split ( CChar ( " , " ) )
If data . Length > 0 Then
canExit = CBool ( data ( 0 ) )
End If
If data . Length > 1 Then
canChooseFainted = CBool ( data ( 1 ) )
End If
If data . Length > 2 Then
canChooseEgg = CBool ( data ( 2 ) )
End If
End If
2019-11-13 02:58:19 +01:00
Dim selScreen = New PartyScreen ( Core . CurrentScreen , Item . GetItemByID ( 5 ) , Nothing , " Choose Pokémon " , canExit , canChooseFainted , canChooseEgg ) With { . Mode = Screens . UI . ISelectionScreen . ScreenMode . Selection , . CanExit = canExit }
2017-08-11 09:01:17 +02:00
AddHandler selScreen . SelectedObject , Nothing
Core . SetScreen ( selScreen )
2016-09-07 18:50:38 +02:00
CanContinue = False
Case " selectmove "
Dim index As Integer = 0
Dim canHMMOve As Boolean = True
Dim canExit As Boolean = False
If argument . Contains ( " , " ) = True Then
Dim args As List ( Of String ) = argument . Split ( CChar ( " , " ) ) . ToList ( )
For i = 0 To args . Count - 1
Dim arg As String = args ( i )
Select Case i
Case 0
index = int ( arg )
Case 1
canHMMOve = CBool ( arg )
Case 2
canExit = CBool ( arg )
End Select
Next
Else
index = int ( argument )
End If
Core . SetScreen ( New ChooseAttackScreen ( Core . CurrentScreen , Core . Player . Pokemons ( index ) , canHMMOve , canExit , Nothing ) )
CanContinue = False
Case " calcstats "
Dim index As Integer = int ( argument )
Core . Player . Pokemons ( index ) . CalculateStats ( )
Case " learnattack "
Dim index As Integer = int ( argument . GetSplit ( 0 ) )
Dim attackID As Integer = int ( argument . GetSplit ( 1 ) )
Core . SetScreen ( New LearnAttackScreen ( Core . CurrentScreen , Core . Player . Pokemons ( index ) , BattleSystem . Attack . GetAttackByID ( attackID ) ) )
CanContinue = False
Case " setgender "
Dim Index As Integer = int ( argument . GetSplit ( 0 , " , " ) )
Dim Gender As Integer = int ( argument . GetSplit ( 1 , " , " ) )
If Core . Player . Pokemons . Count - 1 >= Index And Gender >= 0 And Gender <= 2 Then
Core . Player . Pokemons ( Index ) . Gender = CType ( Gender , Pokemon . Genders )
End If
Case " setability "
Dim Index As Integer = int ( argument . GetSplit ( 0 , " , " ) )
Dim abilityID As Integer = int ( argument . GetSplit ( 1 , " , " ) )
If Core . Player . Pokemons . Count - 1 >= Index Then
Core . Player . Pokemons ( Index ) . Ability = Ability . GetAbilityByID ( abilityID )
End If
Case " setev "
Dim Index As Integer = int ( argument . GetSplit ( 0 , " , " ) )
Dim ev As String = argument . GetSplit ( 1 , " , " )
Dim evValue As Integer = int ( argument . GetSplit ( 2 , " , " ) )
If Core . Player . Pokemons . Count - 1 >= Index Then
With Core . Player . Pokemons ( Index )
Select Case ev . ToLower ( )
Case " hp "
. EVHP = evValue
Case " atk " , " attack "
. EVAttack = evValue
Case " def " , " defense "
. EVDefense = evValue
Case " spatk " , " specialattack " , " spattack "
. EVSpAttack = evValue
Case " spdef " , " specialdefense " , " spdefense "
. EVSpDefense = evValue
Case " speed "
. EVSpeed = evValue
End Select
End With
End If
2017-08-31 03:01:15 +02:00
Case " setallevs "
Dim Index As Integer = int ( argument . GetSplit ( 0 , " , " ) )
If Core . Player . Pokemons . Count - 1 >= Index Then
With Core . Player . Pokemons ( Index )
. EVHP = Clamp ( int ( argument . GetSplit ( 1 , " , " ) ) , 0 , 252 )
. EVAttack = Clamp ( int ( argument . GetSplit ( 2 , " , " ) ) , 0 , 252 )
. EVDefense = Clamp ( int ( argument . GetSplit ( 3 , " , " ) ) , 0 , 252 )
. EVSpAttack = Clamp ( int ( argument . GetSplit ( 4 , " , " ) ) , 0 , 252 )
. EVSpDefense = Clamp ( int ( argument . GetSplit ( 5 , " , " ) ) , 0 , 252 )
. EVSpeed = Clamp ( int ( argument . GetSplit ( 6 , " , " ) ) , 0 , 252 )
End With
End If
2016-09-07 18:50:38 +02:00
Case " setiv "
Dim Index As Integer = int ( argument . GetSplit ( 0 , " , " ) )
Dim dv As String = argument . GetSplit ( 1 , " , " )
Dim dvValue As Integer = int ( argument . GetSplit ( 2 , " , " ) )
If Core . Player . Pokemons . Count - 1 >= Index Then
With Core . Player . Pokemons ( Index )
Select Case dv . ToLower ( )
Case " hp "
. IVHP = dvValue
Case " atk " , " attack "
. IVAttack = dvValue
Case " def " , " defense "
. IVDefense = dvValue
Case " spatk " , " specialattack " , " spattack "
. IVSpAttack = dvValue
Case " spdef " , " specialdefense " , " spdefense "
. IVSpDefense = dvValue
Case " speed "
. IVSpeed = dvValue
End Select
End With
End If
2017-08-31 03:01:15 +02:00
Case " setallivs "
Dim Index As Integer = int ( argument . GetSplit ( 0 , " , " ) )
If Core . Player . Pokemons . Count - 1 >= Index Then
With Core . Player . Pokemons ( Index )
. IVHP = Clamp ( int ( argument . GetSplit ( 1 , " , " ) ) , 0 , 31 )
. IVAttack = Clamp ( int ( argument . GetSplit ( 2 , " , " ) ) , 0 , 31 )
. IVDefense = Clamp ( int ( argument . GetSplit ( 3 , " , " ) ) , 0 , 31 )
. IVSpAttack = Clamp ( int ( argument . GetSplit ( 4 , " , " ) ) , 0 , 31 )
. IVSpDefense = Clamp ( int ( argument . GetSplit ( 5 , " , " ) ) , 0 , 31 )
. IVSpeed = Clamp ( int ( argument . GetSplit ( 6 , " , " ) ) , 0 , 31 )
End With
End If
2016-09-07 18:50:38 +02:00
Case " registerhalloffame "
Dim count As Integer = - 1
2017-01-21 02:56:15 +01:00
Dim NewHallOfFameData As String = " "
2016-09-07 18:50:38 +02:00
If Core . Player . HallOfFameData <> " " Then
Dim data ( ) As String = Core . Player . HallOfFameData . SplitAtNewline ( )
For Each l As String In data
Dim id As Integer = CInt ( l . Remove ( l . IndexOf ( " , " ) ) )
If id > count Then
count = id
End If
Next
2017-01-21 02:56:15 +01:00
For Each l As String In data
Dim id As Integer = CInt ( l . Remove ( l . IndexOf ( " , " ) ) )
If id > ( count - 19 ) OrElse id = 0 Then 'last 20 entries saved, plus the first entry
2018-01-07 18:01:32 +01:00
NewHallOfFameData &= l & Environment . NewLine
2017-01-21 02:56:15 +01:00
End If
Next
2016-09-07 18:50:38 +02:00
End If
count += 1
Dim time As String = TimeHelpers . GetDisplayTime ( TimeHelpers . GetCurrentPlayTime ( ) , True )
Dim newData As String
If Core . Player . IsGameJoltSave Then
newData = count & " ,( " & Core . Player . Name & " | " & time & " | " & GameJoltSave . Points & " | " & Core . Player . OT & " | " & Core . Player . Skin & " ) "
Else
newData = count & " ,( " & Core . Player . Name & " | " & time & " | " & Core . Player . Points & " | " & Core . Player . OT & " | " & Core . Player . Skin & " ) "
End If
For Each p As Pokemon In Core . Player . Pokemons
If p . IsEgg ( ) = False Then
2017-01-20 08:22:05 +01:00
Dim pData As String = p . GetHallOfFameData ( )
2018-01-07 18:01:32 +01:00
newData &= Environment . NewLine & count & " , " & pData
2016-09-07 18:50:38 +02:00
End If
Next
2017-01-21 02:56:15 +01:00
NewHallOfFameData &= newData
Core . Player . HallOfFameData = NewHallOfFameData
2016-09-07 18:50:38 +02:00
Case " setot "
Dim Index As Integer = int ( argument . GetSplit ( 0 , " , " ) )
Dim OT As String = argument . GetSplit ( 1 , " , " )
If Core . Player . Pokemons . Count - 1 >= Index Then
Core . Player . Pokemons ( Index ) . OT = OT
End If
Case " setitem "
Dim Index As Integer = int ( argument . GetSplit ( 0 , " , " ) )
Dim newItem As Item = Item . GetItemByID ( int ( argument . GetSplit ( 1 , " , " ) ) )
If Core . Player . Pokemons . Count - 1 >= Index Then
Core . Player . Pokemons ( Index ) . Item = newItem
End If
Case " removeitem "
Dim Index As Integer = int ( argument . GetSplit ( 0 , " , " ) )
Core . Player . Pokemons ( Index ) . Item = Nothing
Case " setitemdata "
Dim Index As Integer = int ( argument . GetSplit ( 0 , " , " ) )
Dim itemData As String = argument . GetSplit ( 1 , " , " )
If Core . Player . Pokemons . Count - 1 >= Index Then
If Not Core . Player . Pokemons ( Index ) . Item Is Nothing Then
Core . Player . Pokemons ( Index ) . Item . AdditionalData = itemData
End If
End If
Case " setcatchtrainer "
Dim Index As Integer = int ( argument . GetSplit ( 0 , " , " ) )
Dim Trainer As String = argument . GetSplit ( 1 , " , " )
If Core . Player . Pokemons . Count - 1 >= Index Then
Core . Player . Pokemons ( Index ) . CatchTrainerName = Trainer
End If
Case " setcatchball "
Dim Index As Integer = int ( argument . GetSplit ( 0 , " , " ) )
Dim catchBall As Integer = int ( argument . GetSplit ( 1 , " , " ) )
If Core . Player . Pokemons . Count - 1 >= Index Then
Core . Player . Pokemons ( Index ) . CatchBall = Item . GetItemByID ( catchBall )
End If
Case " setcatchmethod "
Dim Index As Integer = int ( argument . GetSplit ( 0 , " , " ) )
Dim method As String = argument . GetSplit ( 1 , " , " )
If Core . Player . Pokemons . Count - 1 >= Index Then
Core . Player . Pokemons ( Index ) . CatchMethod = method
End If
Case " setcatchplace " , " setcatchlocation "
Dim Index As Integer = int ( argument . GetSplit ( 0 , " , " ) )
Dim place As String = argument . GetSplit ( 1 , " , " )
If Core . Player . Pokemons . Count - 1 >= Index Then
Core . Player . Pokemons ( Index ) . CatchLocation = place
End If
Case " newroaming "
2021-09-30 17:16:26 +02:00
' PokémonID,Level,regionID,startLevelFile,MusicLoop,[Shiny]
2016-09-07 18:50:38 +02:00
Dim data ( ) As String = argument . Split ( CChar ( " , " ) )
Dim p As Pokemon = Pokemon . GetPokemonByID ( CInt ( data ( 0 ) ) )
p . Generate ( CInt ( data ( 1 ) ) , True )
2021-09-30 17:16:26 +02:00
If data . Length > 5 AndAlso data ( 5 ) <> " " AndAlso data ( 5 ) <> " -1 " Then
p . IsShiny = CBool ( data ( 5 ) )
End If
2016-09-07 18:50:38 +02:00
If Core . Player . RoamingPokemonData <> " " Then
2018-01-07 18:01:32 +01:00
Core . Player . RoamingPokemonData &= Environment . NewLine
2016-09-07 18:50:38 +02:00
End If
2021-09-30 17:16:26 +02:00
Core . Player . RoamingPokemonData &= data ( 0 ) & " | " & data ( 1 ) & " | " & data ( 2 ) & " | " & data ( 3 ) & " | " & data ( 4 ) & " | " & data ( 5 ) & " | " & p . GetSaveData ( )
2016-09-07 18:50:38 +02:00
Case " evolve "
Dim args ( ) As String = argument . Split ( CChar ( " , " ) )
Dim triggerStr As String = " level "
If args . Count > 1 Then
triggerStr = args ( 1 )
End If
Dim trigger As EvolutionCondition . EvolutionTrigger = EvolutionCondition . EvolutionTrigger . LevelUp
Dim evolutionArg As String = " "
If args . Count > 2 Then
evolutionArg = args ( 2 )
End If
Dim p As Pokemon = Core . Player . Pokemons ( int ( args ( 0 ) ) )
Select Case triggerStr
Case " level " , " levelup " , " level up " , " level-up "
trigger = EvolutionCondition . EvolutionTrigger . LevelUp
Case " none "
trigger = EvolutionCondition . EvolutionTrigger . None
Case " itemuse " , " item use " , " item " , " item-use "
trigger = EvolutionCondition . EvolutionTrigger . ItemUse
Case " trade " , " trading "
trigger = EvolutionCondition . EvolutionTrigger . Trading
End Select
If p . CanEvolve ( trigger , evolutionArg ) = True Then
Core . SetScreen ( New TransitionScreen ( Core . CurrentScreen ,
New EvolutionScreen ( Core . CurrentScreen , { int ( args ( 0 ) ) } . ToList ( ) ,
evolutionArg ,
trigger ,
False ) , Color . Black , False ) )
CanContinue = False
Else
Logger . Log ( Logger . LogTypes . Message , " ScriptCommander.vb: The Pokémon is not able to evolve with the given conditions. " )
End If
Case " reload "
Dim PokemonIndex As Integer = int ( argument )
If Core . Player . Pokemons . Count - 1 >= PokemonIndex Then
Core . Player . Pokemons ( PokemonIndex ) . ReloadDefinitions ( )
2018-03-07 23:09:15 +01:00
Core . Player . Pokemons ( PokemonIndex ) . CalculateStats ( )
2016-09-07 18:50:38 +02:00
End If
2018-03-07 23:09:15 +01:00
Case " reloadall "
For i = 0 To Core . Player . Pokemons . Count - 1
Core . Player . Pokemons ( i ) . ReloadDefinitions ( )
Core . Player . Pokemons ( i ) . CalculateStats ( )
Next
''Just debug testing tools.
''Make sure X and Y megas hold the correct stone. Other megas may have no stone.
Case " megaevolve "
Dim p As Pokemon = Core . Player . Pokemons ( int ( argument ) )
If p . Item IsNot Nothing Then
Select Case p . Item . ID
Case 516 , 529
p . AdditionalData = " mega_x "
Case 517 , 530
p . AdditionalData = " mega_y "
Case Else
p . AdditionalData = " mega "
End Select
Else
p . AdditionalData = " mega "
End If
p . ReloadDefinitions ( )
p . CalculateStats ( )
p . LoadAltAbility ( )
Case " megaevolveall "
For i = 0 To Core . Player . Pokemons . Count - 1
Dim p As Pokemon = Core . Player . Pokemons ( i )
If p . Item IsNot Nothing Then
Select Case p . Item . ID
Case 516 , 529
p . AdditionalData = " mega_x "
Case 517 , 530
p . AdditionalData = " mega_y "
Case Else
p . AdditionalData = " mega "
End Select
Else
p . AdditionalData = " mega "
End If
p . ReloadDefinitions ( )
p . CalculateStats ( )
p . LoadAltAbility ( )
Next
2016-09-07 18:50:38 +02:00
Case " clone "
Dim PokemonIndex As Integer = int ( argument )
If Core . Player . Pokemons . Count - 1 >= PokemonIndex And Core . Player . Pokemons . Count < 6 Then
Core . Player . Pokemons . Add ( Core . Player . Pokemons ( PokemonIndex ) )
End If
2016-11-11 20:04:58 +01:00
Case " sendtostorage "
' @Pokemon.SendToStorage(PokeIndex, [BoxIndex])
2017-01-08 17:40:10 +01:00
2016-11-11 20:04:58 +01:00
Dim Data ( ) As String = argument . Split ( CChar ( " , " ) )
If Data . Length = 1 Then
Dim PokemonIndex As Integer = int ( Data ( 0 ) )
If Core . Player . Pokemons . Count - 1 >= PokemonIndex Then
StorageSystemScreen . DepositPokemon ( Core . Player . Pokemons ( PokemonIndex ) )
Core . Player . Pokemons . RemoveAt ( PokemonIndex )
End If
ElseIf Data . Length = 2 Then
Dim PokemonIndex As Integer = int ( Data ( 0 ) )
If Core . Player . Pokemons . Count - 1 >= PokemonIndex Then
StorageSystemScreen . DepositPokemon ( Core . Player . Pokemons ( PokemonIndex ) , int ( Data ( 1 ) ) )
Core . Player . Pokemons . RemoveAt ( PokemonIndex )
End If
End If
2016-11-11 21:05:07 +01:00
Case " addtostorage "
' @Pokemon.AddToStorage([BoxIndex], PokemonData)
2020-07-24 04:02:59 +02:00
' @Pokemon.AddToStorage(PokemonID, Level, [Method], [BallID], [Location], [isEgg], [trainerName], [heldItem], [isShiny])
2016-11-11 21:05:07 +01:00
2019-01-05 08:47:05 +01:00
If argument . StartsWith ( " { " ) = True Or argument . Remove ( 0 , argument . IndexOf ( " , " ) ) . StartsWith ( " ,{ " ) = True Then
2019-01-05 08:53:34 +01:00
Dim insertIndex As Integer = - 1
2019-01-05 08:47:05 +01:00
If argument . Remove ( 0 , argument . IndexOf ( " , " ) ) . StartsWith ( " ,{ " ) = True Then
2016-11-11 21:05:07 +01:00
insertIndex = int ( argument . GetSplit ( 0 ) )
End If
argument = argument . Remove ( 0 , argument . IndexOf ( " { " ) )
2019-10-07 05:24:08 +02:00
Dim p As Pokemon = Pokemon . GetPokemonByData ( argument . Replace ( " § " , " , " ) . Replace ( " « " , " [ " ) . Replace ( " » " , " ] " ) )
2016-11-11 21:05:07 +01:00
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 ) <> " <playername> " Then
catchTrainer = argument . GetSplit ( 6 )
End If
2020-07-24 04:02:59 +02:00
Dim heldItem As Integer = 0
If commas > 6 Then
heldItem = CInt ( argument . GetSplit ( 7 ) )
End If
Dim isShiny As Boolean = False
2021-09-30 01:07:04 +02:00
If Core . Random . Next ( 0 , P3D . Pokemon . MasterShinyRate ) = 0 Then
isShiny = True
End If
2020-07-24 04:02:59 +02:00
If commas > 7 Then
isShiny = CBool ( argument . GetSplit ( 8 ) )
End If
2016-11-11 21:05:07 +01:00
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
2020-07-24 04:02:59 +02:00
If heldItem <> 0 Then
Pokemon . Item = Item . GetItemByID ( heldItem )
End If
Pokemon . IsShiny = isShiny
2016-11-11 21:05:07 +01:00
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
2017-01-08 17:40:10 +01:00
Case " addsteps "
' @Pokemon.AddSteps(PokemonIndex, StepsToAdd)
Dim Index As Integer = int ( argument . GetSplit ( 0 , " , " ) )
Dim StepsToAdd As Integer = int ( argument . GetSplit ( 1 , " , " ) )
If Core . Player . Pokemons . Count - 1 >= Index Then
Core . Player . Pokemons ( Index ) . EggSteps += StepsToAdd
End If
Case " setsteps "
' @Pokemon.SetSteps(PokemonIndex, StepsToSet)
Dim Index As Integer = int ( argument . GetSplit ( 0 , " , " ) )
Dim StepsToSet As Integer = int ( argument . GetSplit ( 1 , " , " ) )
If Core . Player . Pokemons . Count - 1 >= Index Then
Core . Player . Pokemons ( Index ) . EggSteps = StepsToSet
End If
2016-09-07 18:50:38 +02:00
End Select
IsReady = True
End Sub
End Class
End Namespace