Added @Pokedex.ChangeEntry(str,int,bool)

@Pokedex.ChangeEntry(PokeID,EntryType,ForceChange)

PokeID [str] = the Pokémon ID: number (e.g. 19) + optionally Data File Suffix (e.g. 19_alola) or AdditionalValue (201;0)
EntryType [int] = the type that the entry needs to be set to: 0 (undiscovered), 1 (seen), 2 (seen + caught) or 3 (seen + caught + shiny)
ForceChange [bool] = if this is set to true, the game doesn't check whether the Pokédex entry is lower than EntryType before setting it
This commit is contained in:
JappaWakka 2023-07-22 20:47:07 +02:00
parent 5e4f5d830c
commit 22cedcd6c7
2 changed files with 9 additions and 3 deletions

View File

@ -85,8 +85,8 @@
Return 0 Return 0
End Function End Function
Public Shared Function ChangeEntry(ByVal Data As String, ByVal ID As String, ByVal Type As Integer) As String Public Shared Function ChangeEntry(ByVal Data As String, ByVal ID As String, ByVal Type As Integer, Optional ForceChange As Boolean = False) As String
If Type = 0 Or AutoDetect = True Then If ForceChange = True OrElse Type = 0 Or AutoDetect = True Then
If Data.Contains("{" & ID & "|") = True Then If Data.Contains("{" & ID & "|") = True Then
Dim cOriginalEntry As String = "" Dim cOriginalEntry As String = ""
If ID.Contains(";") Then If ID.Contains(";") Then
@ -109,7 +109,7 @@
End If End If
End If End If
If cEntry < Type Then If ForceChange = True OrElse cEntry < Type Then
Return cData.Replace("{" & ID & "|" & cEntry & "}", "{" & ID & "|" & Type & "}") Return cData.Replace("{" & ID & "|" & cEntry & "}", "{" & ID & "|" & Type & "}")
Else Else
Return cData Return cData

View File

@ -13,6 +13,12 @@
Select Case command.ToLower() Select Case command.ToLower()
Case "setautodetect" Case "setautodetect"
Pokedex.AutoDetect = ScriptConversion.ToBoolean(argument) Pokedex.AutoDetect = ScriptConversion.ToBoolean(argument)
Case "changeentry"
Dim ForceChange As Boolean = False
If argument.Split(",").Count > 2 Then
ForceChange = CBool(argument.GetSplit(2, ","))
End If
Pokedex.ChangeEntry(Core.Player.PokedexData, argument.GetSplit(0, ","), CInt(argument.GetSplit(1, ",")), ForceChange)
Case Else Case Else
Logger.Log(Logger.LogTypes.Warning, "ScriptCommander.vb: (@pokedex." & command & ") Command not found.") Logger.Log(Logger.LogTypes.Warning, "ScriptCommander.vb: (@pokedex." & command & ") Command not found.")
End Select End Select