<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="1Dialog" script:language="StarBasic">&apos; Copyright (c) 2016-2017 imacat.
&apos; 
&apos; Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
&apos; you may not use this file except in compliance with the License.
&apos; You may obtain a copy of the License at
&apos; 
&apos;     http://www.apache.org/licenses/LICENSE-2.0
&apos; 
&apos; Unless required by applicable law or agreed to in writing, software
&apos; distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
&apos; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
&apos; See the License for the specific language governing permissions and
&apos; limitations under the License.

&apos; 1Dialog: The Dialog UI processor
&apos;   by imacat &lt;imacat@mail.imacat.idv.tw&gt;, 2017-02-24

Option Explicit

&apos; The parameters to find the individual values.
Type aFindIVParam
	sPokemonId As String
	sPokemonName As String
	nCP As Integer
	nHP As Integer
	nStardust As Integer
	nPlayerLevel As Integer
	bIsNew As Boolean
	nTotal As Integer
	sBest As String
	nMax As Integer
	bIsCancelled As Boolean
End Type

&apos; fnAskParam: Asks the users for the parameters for the Pokémon.
Function fnAskParam As aFindIVParam
	Dim oDialog As Object
	Dim oList As Object, mPokemons () As String, nI As Integer
	Dim bIsBestAttack As Boolean, bIsBestDefense As Boolean
	Dim bIsBestHP As Boolean
	Dim aQuery As New aFindIVParam, nSelected As Integer
	
	DialogLibraries.loadLibrary &quot;PokemonGoIV&quot;
	oDialog = CreateUnoDialog (DialogLibraries.PokemonGoIV.DlgMain)
	oDialog.getControl (&quot;lstTotal&quot;).setVisible (False)
	oDialog.getControl (&quot;txtBestHead&quot;).setVisible (False)
	oDialog.getControl (&quot;lstBest&quot;).setVisible (False)
	oDialog.getControl (&quot;txtBestTail&quot;).setVisible (False)
	oDialog.getControl (&quot;cbxBest2&quot;).setVisible (False)
	oDialog.getControl (&quot;cbxBest3&quot;).setVisible (False)
	oDialog.getControl (&quot;lstMax&quot;).setVisible (False)
	
	&apos; Adds the Pokémons by their localized names.
	subReadBaseStats
	ReDim mPokemons (UBound (maBaseStats)) As String
	For nI = 0 To UBound (maBaseStats)
		mPokemons (nI) = fnGetResString ( _
			&quot;Pokemon&quot; &amp; maBaseStats (nI).sPokemonId)
	Next nI
	oList = oDialog.getControl (&quot;lstPokemon&quot;)
	If oList.getItemCount &gt; 0 Then
		getItemCount.removeItems (0, oList.getItemCount)
	End If
	oList.addItems (mPokemons, 0)
	
	oDialog.getControl (&quot;imgPokemon&quot;).getModel.setPropertyValue ( _
		&quot;ImageURL&quot;, fnGetImageUrl (&quot;Unknown&quot;))
	oDialog.getControl (&quot;imgTeamLogo&quot;).getModel.setPropertyValue ( _
		&quot;ImageURL&quot;, fnGetImageUrl (&quot;Unknown&quot;))
	
	If oDialog.execute = 0 Then
		aQuery.bIsCancelled = True
		fnAskParam = aQuery
		Exit Function
	End If
	
	subReadBaseStats
	nSelected = oDialog.getControl (&quot;lstPokemon&quot;).getSelectedItemPos
	With aQuery
		.sPokemonId = maBaseStats (nSelected).sPokemonId
		.sPokemonName = oDialog.getControl (&quot;lstPokemon&quot;).getSelectedItem
		.nCP = oDialog.getControl (&quot;numCP&quot;).getValue
		.nHP = oDialog.getControl (&quot;numHP&quot;).getValue
		.nStardust = CInt (oDialog.getControl (&quot;lstStardust&quot;).getSelectedItem)
		.nPlayerLevel = CInt (oDialog.getControl (&quot;lstPlayerLevel&quot;).getSelectedItem)
		.nTotal = oDialog.getControl (&quot;lstTotal&quot;).getSelectedItemPos + 1
		.nMax = oDialog.getControl (&quot;lstMax&quot;).getSelectedItemPos + 1
		.bIsCancelled = False
	End With
	If oDialog.getControl (&quot;cbxIsNew&quot;).getState = 1 Then
		aQuery.bIsNew = True
	Else
		aQuery.bIsNew = False
	End If
	
	&apos; The best stats
	bIsBestAttack = False
	bIsBestDefense = False
	bIsBestHP = False
	If oDialog.getControl (&quot;lstBest&quot;).getSelectedItemPos = 0 Then
		bIsBestAttack = True
		If oDialog.getControl (&quot;cbxBest2&quot;).getState = 1 Then
			bIsBestDefense = True
		End If
		If oDialog.getControl (&quot;cbxBest3&quot;).getState = 1 Then
			bIsBestHP = True
		End If
	End If
	If oDialog.getControl (&quot;lstBest&quot;).getSelectedItemPos = 1 Then
		bIsBestDefense = True
		If oDialog.getControl (&quot;cbxBest2&quot;).getState = 1 Then
			bIsBestAttack = True
		End If
		If oDialog.getControl (&quot;cbxBest3&quot;).getState = 1 Then
			bIsBestHP = True
		End If
	End If
	If oDialog.getControl (&quot;lstBest&quot;).getSelectedItemPos = 2 Then
		bIsBestHP = True
		If oDialog.getControl (&quot;cbxBest2&quot;).getState = 1 Then
			bIsBestAttack = True
		End If
		If oDialog.getControl (&quot;cbxBest3&quot;).getState = 1 Then
			bIsBestDefense = True
		End If
	End If
	aQuery.sBest = &quot;&quot;
	If bIsBestAttack Then
		aQuery.sBest = aQuery.sBest &amp; &quot;Atk &quot;
	End If
	If bIsBestDefense Then
		aQuery.sBest = aQuery.sBest &amp; &quot;Def &quot;
	End If
	If bIsBestHP Then
		aQuery.sBest = aQuery.sBest &amp; &quot;Sta &quot;
	End If
	
	fnAskParam = aQuery
End Function

&apos; subBtnOKCheck: Checks whether the required columns are filled.
Sub subBtnOKCheck (oEvent As object)
	Dim oDialog As Object
	Dim oPokemon As Object, oCP As Object
	Dim oHP As Object, oStardust As Object, oOK As Object
	
	oDialog = oEvent.Source.getContext
	oPokemon = oDialog.getControl (&quot;lstPokemon&quot;)
	oCP = oDialog.getControl (&quot;numCP&quot;)
	oHP = oDialog.getControl (&quot;numHP&quot;)
	oStardust = oDialog.getControl (&quot;lstStardust&quot;)
	oOK = oDialog.getControl (&quot;btnOK&quot;)
	
	If oPokemon.getSelectedItemPos &lt;&gt; -1 _
			And oCP.getText &lt;&gt; &quot;&quot; _
			And oHP.getText &lt;&gt; &quot;&quot; _
			And oStardust.getSelectedItemPos &lt;&gt; -1 Then
		oOK.setEnable (True)
	Else
		oOK.setEnable (False)
	End If
End Sub

&apos; subLstPokemonSelected: When the Pokémon is selected.
Sub subLstPokemonSelected (oEvent As object)
	Dim oDialog As Object, nSelected As Integer
	Dim oImageModel As Object, sImageId As String
	
	oDialog = oEvent.Source.getContext
	
	&apos; Updates the Pokémon image.
	nSelected = oDialog.getControl (&quot;lstPokemon&quot;).getSelectedItemPos
	subReadBaseStats
	sImageId = &quot;Pokemon&quot; &amp; maBaseStats (nSelected).sPokemonId
	oImageModel = oDialog.getControl (&quot;imgPokemon&quot;).getModel
	oImageModel.setPropertyValue (&quot;ImageURL&quot;, _
		fnGetImageUrl (sImageId))
	
	&apos; Updates the text of the stats total appraisal.
	subUpdateTotalAppraisal (oDialog, True)
	&apos; Checks if the required columns are filled.
	subBtnOKCheck (oEvent)
End Sub

&apos; subRdoTeamValorItemChanged: When Team Valor is selected.
Sub subRdoTeamValorItemChanged (oEvent As object)
	Dim oDialog As Object, oList As Object, oText As Object
	Dim oImageModel As Object
	Dim mItems () As String
	
	oDialog = oEvent.Source.getContext
	
	oImageModel = oDialog.getControl (&quot;imgTeamLogo&quot;).getModel
	oImageModel.setPropertyValue (&quot;ImageURL&quot;, _
		fnGetImageUrl (&quot;TeamLogoValor&quot;))
	oImageModel = oDialog.getControl (&quot;imgTeamLeader&quot;).getModel
	oImageModel.setPropertyValue (&quot;ImageURL&quot;, _
		fnGetImageUrl (&quot;TeamLeaderCandela&quot;))
	
	oText = oDialog.getControl (&quot;txtLeaderAppraise&quot;)
	oText.setVisible (True)
	oText.setText (fnGetResString (&quot;AppraiseFromCandela&quot;))
	
	&apos; Updates the text of the stats total appraisal.
	subUpdateTotalAppraisal (oDialog, False)
	
	&apos; Updates the text of the best stat appraisal.
	subUpdateBestStatAppraisal (oDialog, _
		fnGetResString (&quot;AppraisalValorBest&quot;), _
		CInt (fnGetResString (&quot;AppraisalValorBestHeadWidth&quot;)))
	
	mItems = Array ( _
		fnGetResString (&quot;AppraisalValorMax15&quot;), _
		fnGetResString (&quot;AppraisalValorMax13Or14&quot;), _
		fnGetResString (&quot;AppraisalValorMax8To12&quot;), _
		fnGetResString (&quot;AppraisalValorMaxUpTo7&quot;))
	oList = oDialog.getControl (&quot;lstMax&quot;)
	oList.removeItems (0, oList.getItemCount())
	oList.addItems (mItems, 0)
	oList.setVisible (True)
End Sub

&apos; subRdoTeamMysticItemChanged: When Team Mystic is selected.
Sub subRdoTeamMysticItemChanged (oEvent As object)
	Dim oDialog As Object, oList As Object, oText As Object
	Dim oImageModel As Object
	Dim mItems () As String
	
	oDialog = oEvent.Source.getContext
	
	oImageModel = oDialog.getControl (&quot;imgTeamLogo&quot;).getModel
	oImageModel.setPropertyValue (&quot;ImageURL&quot;, _
		fnGetImageUrl (&quot;TeamLogoMystic&quot;))
	oImageModel = oDialog.getControl (&quot;imgTeamLeader&quot;).getModel
	oImageModel.setPropertyValue (&quot;ImageURL&quot;, _
		fnGetImageUrl (&quot;TeamLeaderBlanche&quot;))
	
	oText = oDialog.getControl (&quot;txtLeaderAppraise&quot;)
	oText.setVisible (True)
	oText.setText (fnGetResString (&quot;AppraiseFromBlanche&quot;))
	
	&apos; Updates the text of the stats total appraisal.
	subUpdateTotalAppraisal (oDialog, False)
	
	&apos; Updates the text of the best stat appraisal.
	subUpdateBestStatAppraisal (oDialog, _
		fnGetResString (&quot;AppraisalMysticBest&quot;), _
		CInt (fnGetResString (&quot;AppraisalMysticBestHeadWidth&quot;)))
	
	mItems = Array ( _
		fnGetResString (&quot;AppraisalMysticMax15&quot;), _
		fnGetResString (&quot;AppraisalMysticMax13Or14&quot;), _
		fnGetResString (&quot;AppraisalMysticMax8To12&quot;), _
		fnGetResString (&quot;AppraisalMysticMaxUpTo7&quot;))
	oList = oDialog.getControl (&quot;lstMax&quot;)
	oList.removeItems (0, oList.getItemCount())
	oList.addItems (mItems, 0)
	oList.setVisible (True)
End Sub

&apos; subRdoTeamInstinctItemChanged: When Team Instinct is selected.
Sub subRdoTeamInstinctItemChanged (oEvent As object)
	Dim oDialog As Object, oList As Object, oText As Object
	Dim oImageModel As Object
	Dim mItems () As String
	
	oDialog = oEvent.Source.getContext
	
	oImageModel = oDialog.getControl (&quot;imgTeamLogo&quot;).getModel
	oImageModel.setPropertyValue (&quot;ImageURL&quot;, _
		fnGetImageUrl (&quot;TeamLogoInstinct&quot;))
	oImageModel = oDialog.getControl (&quot;imgTeamLeader&quot;).getModel
	oImageModel.setPropertyValue (&quot;ImageURL&quot;, _
		fnGetImageUrl (&quot;TeamLeaderSpark&quot;))
	
	oText = oDialog.getControl (&quot;txtLeaderAppraise&quot;)
	oText.setVisible (True)
	oText.setText (fnGetResString (&quot;AppraiseFromSpark&quot;))
	
	&apos; Updates the text of the stats total appraisal.
	subUpdateTotalAppraisal (oDialog, False)
	
	&apos; Updates the text of the best stat appraisal.
	subUpdateBestStatAppraisal (oDialog, _
		fnGetResString (&quot;AppraisalInstinctBest&quot;), _
		CInt (fnGetResString (&quot;AppraisalInstinctBestHeadWidth&quot;)))
	
	mItems = Array ( _
		fnGetResString (&quot;AppraisalInstinctMax15&quot;), _
		fnGetResString (&quot;AppraisalInstinctMax13Or14&quot;), _
		fnGetResString (&quot;AppraisalInstinctMax8To12&quot;), _
		fnGetResString (&quot;AppraisalInstinctMaxUpTo7&quot;))
	oList = oDialog.getControl (&quot;lstMax&quot;)
	oList.removeItems (0, oList.getItemCount())
	oList.addItems (mItems, 0)
	oList.setVisible (True)
End Sub

&apos; subUpdateBestStatAppraisal: Updates the text of the best stat appraisal.
Sub subUpdateBestStatAppraisal (oDialog As Object, _
		sAppraisal As String, nHeadWidth As Integer)
	Dim oText As Object, oList As Object, nX As Integer
	Dim sHead As String, sTail As String, nTailWidth As Integer
	Dim nDialogWidth As Integer
	Dim nPos As Integer
	Dim mItems () As String
	
	nPos = InStr (sAppraisal, &quot;[Stat]&quot;)
	sHead = Left (sAppraisal, nPos - 1)
	sTail = Right (sAppraisal, _
		Len (sAppraisal) - nPos - Len (&quot;[Stat]&quot;) + 1)
	nDialogWidth = oDialog.getModel.getPropertyValue (&quot;Width&quot;)
	
	oText = oDialog.getControl (&quot;txtBestHead&quot;)
	oText.getModel.setPropertyValue (&quot;Width&quot;, nHeadWidth)
	oText.setVisible (True)
	oText.setText (sHead)
	nX = oText.getModel.getPropertyValue (&quot;PositionX&quot;) + nHeadWidth
	
	mItems = Array ( _
		fnGetResString (&quot;StatAttack&quot;), _
		fnGetResString (&quot;StatDefense&quot;), _
		fnGetResString (&quot;StatHP&quot;))
	oList = oDialog.getControl (&quot;lstBest&quot;)
	oList.removeItems (0, oList.getItemCount())
	oList.addItems (mItems, 0)
	oList.getModel.setPropertyValue (&quot;PositionX&quot;, nX)
	oList.getModel.setPropertyValue (&quot;Width&quot;, _
		CInt (fnGetResString (&quot;BestStatWidth&quot;)))
	oList.setVisible (True)
	nX = nX + oList.getModel.getPropertyValue (&quot;Width&quot;)
	
	nTailWidth = nDialogWidth - nX - 10
	oText = oDialog.getControl (&quot;txtBestTail&quot;)
	oText.getModel.setPropertyValue (&quot;PositionX&quot;, nX)
	oText.getModel.setPropertyValue (&quot;Width&quot;, nTailWidth)
	oText.setVisible (True)
	oText.setText (sTail)
	
	oList = oDialog.getControl (&quot;cbxBest2&quot;)
	oList.setVisible (False)
	
	oList = oDialog.getControl (&quot;cbxBest3&quot;)
	oList.setVisible (False)
End Sub

&apos; subLstBestItemChanged: When the best stat is selected.
Sub subLstBestItemChanged (oEvent As object)
	Dim oDialog As Object, oCheckBox As Object, sBestToo As String
	
	oDialog = oEvent.Source.getContext
	If oDialog.getControl (&quot;rdoTeamValor&quot;).getState Then
		sBestToo = fnGetResString (&quot;AppraisalValorBestToo&quot;)
		If oDialog.getControl (&quot;lstBest&quot;).getSelectedItemPos = 0 Then
			oCheckBox = oDialog.getControl (&quot;cbxBest2&quot;)
			oCheckBox.setLabel (fnReplace ( _
				sBestToo, &quot;[Stat]&quot;, fnGetResString (&quot;StatDefense&quot;)))
			oCheckBox.setVisible (True)
			oCheckBox.setState (0)
			oCheckBox = oDialog.getControl (&quot;cbxBest3&quot;)
			oCheckBox.setLabel (fnReplace ( _
				sBestToo, &quot;[Stat]&quot;, fnGetResString (&quot;StatHP&quot;)))
			oCheckBox.setVisible (True)
			oCheckBox.setState (0)
		End If
		If oDialog.getControl (&quot;lstBest&quot;).getSelectedItemPos = 1 Then
			oCheckBox = oDialog.getControl (&quot;cbxBest2&quot;)
			oCheckBox.setLabel (fnReplace ( _
				sBestToo, &quot;[Stat]&quot;, fnGetResString (&quot;StatAttack&quot;)))
			oCheckBox.setVisible (True)
			oCheckBox.setState (0)
			oCheckBox = oDialog.getControl (&quot;cbxBest3&quot;)
			oCheckBox.setLabel (fnReplace ( _
				sBestToo, &quot;[Stat]&quot;, fnGetResString (&quot;StatHP&quot;)))
			oCheckBox.setVisible (True)
			oCheckBox.setState (0)
		End If
		If oDialog.getControl (&quot;lstBest&quot;).getSelectedItemPos = 2 Then
			oCheckBox = oDialog.getControl (&quot;cbxBest2&quot;)
			oCheckBox.setLabel (fnReplace ( _
				sBestToo, &quot;[Stat]&quot;, fnGetResString (&quot;StatAttack&quot;)))
			oCheckBox.setVisible (True)
			oCheckBox.setState (0)
			oCheckBox = oDialog.getControl (&quot;cbxBest3&quot;)
			oCheckBox.setLabel (fnReplace ( _
				sBestToo, &quot;[Stat]&quot;, fnGetResString (&quot;StatDefense&quot;)))
			oCheckBox.setVisible (True)
			oCheckBox.setState (0)
		End If
	End If
	If oDialog.getControl (&quot;rdoTeamMystic&quot;).getState Then
		sBestToo = fnGetResString (&quot;AppraisalMysticBestToo&quot;)
		If oDialog.getControl (&quot;lstBest&quot;).getSelectedItemPos = 0 Then
			oCheckBox = oDialog.getControl (&quot;cbxBest2&quot;)
			oCheckBox.setLabel (fnReplace ( _
				sBestToo, &quot;[Stat]&quot;, fnGetResString (&quot;StatDefense&quot;)))
			oCheckBox.setVisible (True)
			oCheckBox.setState (0)
			oCheckBox = oDialog.getControl (&quot;cbxBest3&quot;)
			oCheckBox.setLabel (fnReplace ( _
				sBestToo, &quot;[Stat]&quot;, fnGetResString (&quot;StatHP&quot;)))
			oCheckBox.setVisible (True)
			oCheckBox.setState (0)
		End If
		If oDialog.getControl (&quot;lstBest&quot;).getSelectedItemPos = 1 Then
			oCheckBox = oDialog.getControl (&quot;cbxBest2&quot;)
			oCheckBox.setLabel (fnReplace ( _
				sBestToo, &quot;[Stat]&quot;, fnGetResString (&quot;StatAttack&quot;)))
			oCheckBox.setVisible (True)
			oCheckBox.setState (0)
			oCheckBox = oDialog.getControl (&quot;cbxBest3&quot;)
			oCheckBox.setLabel (fnReplace ( _
				sBestToo, &quot;[Stat]&quot;, fnGetResString (&quot;StatHP&quot;)))
			oCheckBox.setVisible (True)
			oCheckBox.setState (0)
		End If
		If oDialog.getControl (&quot;lstBest&quot;).getSelectedItemPos = 2 Then
			oCheckBox = oDialog.getControl (&quot;cbxBest2&quot;)
			oCheckBox.setLabel (fnReplace ( _
				sBestToo, &quot;[Stat]&quot;, fnGetResString (&quot;StatAttack&quot;)))
			oCheckBox.setVisible (True)
			oCheckBox.setState (0)
			oCheckBox = oDialog.getControl (&quot;cbxBest3&quot;)
			oCheckBox.setLabel (fnReplace ( _
				sBestToo, &quot;[Stat]&quot;, fnGetResString (&quot;StatDefense&quot;)))
			oCheckBox.setVisible (True)
			oCheckBox.setState (0)
		End If
	End If
	If oDialog.getControl (&quot;rdoTeamInstinct&quot;).getState Then
		sBestToo = fnGetResString (&quot;AppraisalInstinctBestToo&quot;)
		If oDialog.getControl (&quot;lstBest&quot;).getSelectedItemPos = 0 Then
			oCheckBox = oDialog.getControl (&quot;cbxBest2&quot;)
			oCheckBox.setLabel (fnReplace ( _
				sBestToo, &quot;[Stat]&quot;, fnGetResString (&quot;StatDefense&quot;)))
			oCheckBox.setVisible (True)
			oCheckBox = oDialog.getControl (&quot;cbxBest3&quot;)
			oCheckBox.setLabel (fnReplace ( _
				sBestToo, &quot;[Stat]&quot;, fnGetResString (&quot;StatHP&quot;)))
			oCheckBox.setVisible (True)
		End If
		If oDialog.getControl (&quot;lstBest&quot;).getSelectedItemPos = 1 Then
			oCheckBox = oDialog.getControl (&quot;cbxBest2&quot;)
			oCheckBox.setLabel (fnReplace ( _
				sBestToo, &quot;[Stat]&quot;, fnGetResString (&quot;StatAttack&quot;)))
			oCheckBox.setVisible (True)
			oCheckBox.setState (0)
			oCheckBox = oDialog.getControl (&quot;cbxBest3&quot;)
			oCheckBox.setLabel (fnReplace ( _
				sBestToo, &quot;[Stat]&quot;, fnGetResString (&quot;StatHP&quot;)))
			oCheckBox.setVisible (True)
			oCheckBox.setState (0)
		End If
		If oDialog.getControl (&quot;lstBest&quot;).getSelectedItemPos = 2 Then
			oCheckBox = oDialog.getControl (&quot;cbxBest2&quot;)
			oCheckBox.setLabel (fnReplace ( _
				sBestToo, &quot;[Stat]&quot;, fnGetResString (&quot;StatAttack&quot;)))
			oCheckBox.setVisible (True)
			oCheckBox.setState (0)
			oCheckBox = oDialog.getControl (&quot;cbxBest3&quot;)
			oCheckBox.setLabel (fnReplace ( _
				sBestToo, &quot;[Stat]&quot;, fnGetResString (&quot;StatDefense&quot;)))
			oCheckBox.setVisible (True)
			oCheckBox.setState (0)
		End If
	End If
End Sub

&apos; subUpdateTotalAppraisal: Updates the text of the stats total
&apos;						   appraisal.
Sub subUpdateTotalAppraisal ( _
		oDialog As Object, bIsKeepSelected As Boolean)
	Dim sPokemon As String, oList As Object, nSelected As Integer
	Dim mItems () As String, nI As Integer
	
	If oDialog.getControl (&quot;rdoTeamValor&quot;).getState Then
		mItems = Array ( _
			fnGetResString (&quot;AppraisalValorTotal37OrHigher&quot;), _
			fnGetResString (&quot;AppraisalValorTotal30To36&quot;), _
			fnGetResString (&quot;AppraisalValorTotal23To29&quot;), _
			fnGetResString (&quot;AppraisalValorTotalUpTo22&quot;))
	End If
	If oDialog.getControl (&quot;rdoTeamMystic&quot;).getState Then
		mItems = Array ( _
			fnGetResString (&quot;AppraisalMysticTotal37OrHigher&quot;), _
			fnGetResString (&quot;AppraisalMysticTotal30To36&quot;), _
			fnGetResString (&quot;AppraisalMysticTotal23To29&quot;), _
			fnGetResString (&quot;AppraisalMysticTotalUpTo22&quot;))
	End If
	If oDialog.getControl (&quot;rdoTeamInstinct&quot;).getState Then
		mItems = Array ( _
			fnGetResString (&quot;AppraisalInstinctTotal37OrHigher&quot;), _
			fnGetResString (&quot;AppraisalInstinctTotal30To36&quot;), _
			fnGetResString (&quot;AppraisalInstinctTotal23To29&quot;), _
			fnGetResString (&quot;AppraisalInstinctTotalUpTo22&quot;))
	End If
	&apos; The team was not selected yet.
	If UBound (mItems) = -1 Then
		Exit sub
	End If
	
	sPokemon = oDialog.getControl (&quot;lstPokemon&quot;).getSelectedItem
	If sPokemon &lt;&gt; &quot;&quot; Then
		For nI = 0 To UBound (mItems)
			mItems (nI) = fnReplace (mItems (nI), _
				&quot;[Pokémon]&quot;, sPokemon)
		Next nI
	End If
	
	oList = oDialog.getControl (&quot;lstTotal&quot;)
	If bIsKeepSelected Then
		nSelected = oList.getSelectedItemPos
	End If
	oList.removeItems (0, oList.getItemCount())
	oList.addItems (mItems, 0)
	If bIsKeepSelected Then
		oList.selectItemPos (nSelected, True)
	End If
	oList.setVisible (True)
End Sub
</script:module>