Moved the dialog UI control from 0Main to 1Dialog, to keep the code clean. 0Main processes mostly the algorithm itself now.

This commit is contained in:
依瑪貓 2017-02-24 18:12:57 +08:00
parent 5c4cf83c12
commit 98069f942c
10 changed files with 862 additions and 806 deletions

View File

@ -87,21 +87,7 @@ Function fnAskParam As aFindIVParam
Dim bIsBestHP As Boolean
Dim aQuery As New aFindIVParam
DialogLibraries.loadLibrary "PokemonGoIV"
oDialog = CreateUnoDialog (DialogLibraries.PokemonGoIV.DlgMain)
oDialog.getControl ("lstTotal").setVisible (False)
oDialog.getControl ("txtBestHead").setVisible (False)
oDialog.getControl ("lstBest").setVisible (False)
oDialog.getControl ("txtBestTail").setVisible (False)
oDialog.getControl ("cbxBest2").setVisible (False)
oDialog.getControl ("cbxBest3").setVisible (False)
oDialog.getControl ("lstMax").setVisible (False)
oDialog.getControl ("imgPokemon").getModel.setPropertyValue ( _
"ImageURL", fnGetImageUrl ("Unknown"))
oDialog.getControl ("imgTeamLogo").getModel.setPropertyValue ( _
"ImageURL", fnGetImageUrl ("Unknown"))
oDialog = fnLoadParamDialog
If oDialog.execute = 0 Then
aQuery.bIsCancelled = True
fnAskParam = aQuery
@ -169,387 +155,6 @@ Function fnAskParam As aFindIVParam
fnAskParam = aQuery
End Function
' 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 ("lstPokemon")
oCP = oDialog.getControl ("numCP")
oHP = oDialog.getControl ("numHP")
oStardust = oDialog.getControl ("lstStardust")
oOK = oDialog.getControl ("btnOK")
If oPokemon.getSelectedItemPos <> -1 _
And oCP.getText <> "" _
And oHP.getText <> "" _
And oStardust.getSelectedItemPos <> -1 Then
oOK.setEnable (True)
Else
oOK.setEnable (False)
End If
End Sub
' 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
' Updates the Pokémon image.
nSelected = oDialog.getControl ("lstPokemon").getSelectedItemPos
subReadBaseStats
sImageId = "Pokemon" & maBaseStats (nSelected).sPokemon
oImageModel = oDialog.getControl ("imgPokemon").getModel
oImageModel.setPropertyValue ("ImageURL", _
fnGetImageUrl (sImageId))
' Updates the text of the stats total appraisal.
subUpdateTotalAppraisal (oDialog, True)
' Checks if the required columns are filled.
subBtnOKCheck (oEvent)
End Sub
' 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 ("imgTeamLogo").getModel
oImageModel.setPropertyValue ("ImageURL", _
fnGetImageUrl ("TeamLogoValor"))
oImageModel = oDialog.getControl ("imgTeamLeader").getModel
oImageModel.setPropertyValue ("ImageURL", _
fnGetImageUrl ("TeamLeaderCandela"))
oText = oDialog.getControl ("txtLeaderAppraise")
oText.setVisible (True)
oText.setText (fnGetResString ("AppraiseFromCandela"))
' Updates the text of the stats total appraisal.
subUpdateTotalAppraisal (oDialog, False)
' Updates the text of the best stat appraisal.
subUpdateBestStatAppraisal (oDialog, _
fnGetResString ("AppraisalValorBest"), _
CInt (fnGetResString ("AppraisalValorBestHeadWidth")))
mItems = Array ( _
fnGetResString ("AppraisalValorMax15"), _
fnGetResString ("AppraisalValorMax13Or14"), _
fnGetResString ("AppraisalValorMax8To12"), _
fnGetResString ("AppraisalValorMaxUpTo7"))
oList = oDialog.getControl ("lstMax")
oList.removeItems (0, oList.getItemCount())
oList.addItems (mItems, 0)
oList.setVisible (True)
End Sub
' 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 ("imgTeamLogo").getModel
oImageModel.setPropertyValue ("ImageURL", _
fnGetImageUrl ("TeamLogoMystic"))
oImageModel = oDialog.getControl ("imgTeamLeader").getModel
oImageModel.setPropertyValue ("ImageURL", _
fnGetImageUrl ("TeamLeaderBlanche"))
oText = oDialog.getControl ("txtLeaderAppraise")
oText.setVisible (True)
oText.setText (fnGetResString ("AppraiseFromBlanche"))
' Updates the text of the stats total appraisal.
subUpdateTotalAppraisal (oDialog, False)
' Updates the text of the best stat appraisal.
subUpdateBestStatAppraisal (oDialog, _
fnGetResString ("AppraisalMysticBest"), _
CInt (fnGetResString ("AppraisalMysticBestHeadWidth")))
mItems = Array ( _
fnGetResString ("AppraisalMysticMax15"), _
fnGetResString ("AppraisalMysticMax13Or14"), _
fnGetResString ("AppraisalMysticMax8To12"), _
fnGetResString ("AppraisalMysticMaxUpTo7"))
oList = oDialog.getControl ("lstMax")
oList.removeItems (0, oList.getItemCount())
oList.addItems (mItems, 0)
oList.setVisible (True)
End Sub
' 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 ("imgTeamLogo").getModel
oImageModel.setPropertyValue ("ImageURL", _
fnGetImageUrl ("TeamLogoInstinct"))
oImageModel = oDialog.getControl ("imgTeamLeader").getModel
oImageModel.setPropertyValue ("ImageURL", _
fnGetImageUrl ("TeamLeaderSpark"))
oText = oDialog.getControl ("txtLeaderAppraise")
oText.setVisible (True)
oText.setText (fnGetResString ("AppraiseFromSpark"))
' Updates the text of the stats total appraisal.
subUpdateTotalAppraisal (oDialog, False)
' Updates the text of the best stat appraisal.
subUpdateBestStatAppraisal (oDialog, _
fnGetResString ("AppraisalInstinctBest"), _
CInt (fnGetResString ("AppraisalInstinctBestHeadWidth")))
mItems = Array ( _
fnGetResString ("AppraisalInstinctMax15"), _
fnGetResString ("AppraisalInstinctMax13Or14"), _
fnGetResString ("AppraisalInstinctMax8To12"), _
fnGetResString ("AppraisalInstinctMaxUpTo7"))
oList = oDialog.getControl ("lstMax")
oList.removeItems (0, oList.getItemCount())
oList.addItems (mItems, 0)
oList.setVisible (True)
End Sub
' 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, "[Stat]")
sHead = Left (sAppraisal, nPos - 1)
sTail = Right (sAppraisal, _
Len (sAppraisal) - nPos - Len ("[Stat]") + 1)
nDialogWidth = oDialog.getModel.getPropertyValue ("Width")
oText = oDialog.getControl ("txtBestHead")
oText.getModel.setPropertyValue ("Width", nHeadWidth)
oText.setVisible (True)
oText.setText (sHead)
nX = oText.getModel.getPropertyValue ("PositionX") + nHeadWidth
mItems = Array ( _
fnGetResString ("StatAttack"), _
fnGetResString ("StatDefense"), _
fnGetResString ("StatHP"))
oList = oDialog.getControl ("lstBest")
oList.removeItems (0, oList.getItemCount())
oList.addItems (mItems, 0)
oList.getModel.setPropertyValue ("PositionX", nX)
oList.getModel.setPropertyValue ("Width", _
CInt (fnGetResString ("BestStatWidth")))
oList.setVisible (True)
nX = nX + oList.getModel.getPropertyValue ("Width")
nTailWidth = nDialogWidth - nX - 10
oText = oDialog.getControl ("txtBestTail")
oText.getModel.setPropertyValue ("PositionX", nX)
oText.getModel.setPropertyValue ("Width", nTailWidth)
oText.setVisible (True)
oText.setText (sTail)
oList = oDialog.getControl ("cbxBest2")
oList.setVisible (False)
oList = oDialog.getControl ("cbxBest3")
oList.setVisible (False)
End Sub
' 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 ("rdoTeamValor").getState Then
sBestToo = fnGetResString ("AppraisalValorBestToo")
If oDialog.getControl ("lstBest").getSelectedItemPos = 0 Then
oCheckBox = oDialog.getControl ("cbxBest2")
oCheckBox.setLabel (fnReplace ( _
sBestToo, "[Stat]", fnGetResString ("StatDefense")))
oCheckBox.setVisible (True)
oCheckBox.setState (0)
oCheckBox = oDialog.getControl ("cbxBest3")
oCheckBox.setLabel (fnReplace ( _
sBestToo, "[Stat]", fnGetResString ("StatHP")))
oCheckBox.setVisible (True)
oCheckBox.setState (0)
End If
If oDialog.getControl ("lstBest").getSelectedItemPos = 1 Then
oCheckBox = oDialog.getControl ("cbxBest2")
oCheckBox.setLabel (fnReplace ( _
sBestToo, "[Stat]", fnGetResString ("StatAttack")))
oCheckBox.setVisible (True)
oCheckBox.setState (0)
oCheckBox = oDialog.getControl ("cbxBest3")
oCheckBox.setLabel (fnReplace ( _
sBestToo, "[Stat]", fnGetResString ("StatHP")))
oCheckBox.setVisible (True)
oCheckBox.setState (0)
End If
If oDialog.getControl ("lstBest").getSelectedItemPos = 2 Then
oCheckBox = oDialog.getControl ("cbxBest2")
oCheckBox.setLabel (fnReplace ( _
sBestToo, "[Stat]", fnGetResString ("StatAttack")))
oCheckBox.setVisible (True)
oCheckBox.setState (0)
oCheckBox = oDialog.getControl ("cbxBest3")
oCheckBox.setLabel (fnReplace ( _
sBestToo, "[Stat]", fnGetResString ("StatDefense")))
oCheckBox.setVisible (True)
oCheckBox.setState (0)
End If
End If
If oDialog.getControl ("rdoTeamMystic").getState Then
sBestToo = fnGetResString ("AppraisalMysticBestToo")
If oDialog.getControl ("lstBest").getSelectedItemPos = 0 Then
oCheckBox = oDialog.getControl ("cbxBest2")
oCheckBox.setLabel (fnReplace ( _
sBestToo, "[Stat]", fnGetResString ("StatDefense")))
oCheckBox.setVisible (True)
oCheckBox.setState (0)
oCheckBox = oDialog.getControl ("cbxBest3")
oCheckBox.setLabel (fnReplace ( _
sBestToo, "[Stat]", fnGetResString ("StatHP")))
oCheckBox.setVisible (True)
oCheckBox.setState (0)
End If
If oDialog.getControl ("lstBest").getSelectedItemPos = 1 Then
oCheckBox = oDialog.getControl ("cbxBest2")
oCheckBox.setLabel (fnReplace ( _
sBestToo, "[Stat]", fnGetResString ("StatAttack")))
oCheckBox.setVisible (True)
oCheckBox.setState (0)
oCheckBox = oDialog.getControl ("cbxBest3")
oCheckBox.setLabel (fnReplace ( _
sBestToo, "[Stat]", fnGetResString ("StatHP")))
oCheckBox.setVisible (True)
oCheckBox.setState (0)
End If
If oDialog.getControl ("lstBest").getSelectedItemPos = 2 Then
oCheckBox = oDialog.getControl ("cbxBest2")
oCheckBox.setLabel (fnReplace ( _
sBestToo, "[Stat]", fnGetResString ("StatAttack")))
oCheckBox.setVisible (True)
oCheckBox.setState (0)
oCheckBox = oDialog.getControl ("cbxBest3")
oCheckBox.setLabel (fnReplace ( _
sBestToo, "[Stat]", fnGetResString ("StatDefense")))
oCheckBox.setVisible (True)
oCheckBox.setState (0)
End If
End If
If oDialog.getControl ("rdoTeamInstinct").getState Then
sBestToo = fnGetResString ("AppraisalInstinctBestToo")
If oDialog.getControl ("lstBest").getSelectedItemPos = 0 Then
oCheckBox = oDialog.getControl ("cbxBest2")
oCheckBox.setLabel (fnReplace ( _
sBestToo, "[Stat]", fnGetResString ("StatDefense")))
oCheckBox.setVisible (True)
oCheckBox = oDialog.getControl ("cbxBest3")
oCheckBox.setLabel (fnReplace ( _
sBestToo, "[Stat]", fnGetResString ("StatHP")))
oCheckBox.setVisible (True)
End If
If oDialog.getControl ("lstBest").getSelectedItemPos = 1 Then
oCheckBox = oDialog.getControl ("cbxBest2")
oCheckBox.setLabel (fnReplace ( _
sBestToo, "[Stat]", fnGetResString ("StatAttack")))
oCheckBox.setVisible (True)
oCheckBox.setState (0)
oCheckBox = oDialog.getControl ("cbxBest3")
oCheckBox.setLabel (fnReplace ( _
sBestToo, "[Stat]", fnGetResString ("StatHP")))
oCheckBox.setVisible (True)
oCheckBox.setState (0)
End If
If oDialog.getControl ("lstBest").getSelectedItemPos = 2 Then
oCheckBox = oDialog.getControl ("cbxBest2")
oCheckBox.setLabel (fnReplace ( _
sBestToo, "[Stat]", fnGetResString ("StatAttack")))
oCheckBox.setVisible (True)
oCheckBox.setState (0)
oCheckBox = oDialog.getControl ("cbxBest3")
oCheckBox.setLabel (fnReplace ( _
sBestToo, "[Stat]", fnGetResString ("StatDefense")))
oCheckBox.setVisible (True)
oCheckBox.setState (0)
End If
End If
End Sub
' subUpdateTotalAppraisal: Updates the text of the stats total
' 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 ("rdoTeamValor").getState Then
mItems = Array ( _
fnGetResString ("AppraisalValorTotal37OrHigher"), _
fnGetResString ("AppraisalValorTotal30To36"), _
fnGetResString ("AppraisalValorTotal23To29"), _
fnGetResString ("AppraisalValorTotalUpTo22"))
End If
If oDialog.getControl ("rdoTeamMystic").getState Then
mItems = Array ( _
fnGetResString ("AppraisalMysticTotal37OrHigher"), _
fnGetResString ("AppraisalMysticTotal30To36"), _
fnGetResString ("AppraisalMysticTotal23To29"), _
fnGetResString ("AppraisalMysticTotalUpTo22"))
End If
If oDialog.getControl ("rdoTeamInstinct").getState Then
mItems = Array ( _
fnGetResString ("AppraisalInstinctTotal37OrHigher"), _
fnGetResString ("AppraisalInstinctTotal30To36"), _
fnGetResString ("AppraisalInstinctTotal23To29"), _
fnGetResString ("AppraisalInstinctTotalUpTo22"))
End If
' The team was not selected yet.
If UBound (mItems) = -1 Then
Exit sub
End If
sPokemon = oDialog.getControl ("lstPokemon").getSelectedItem
If sPokemon <> "" Then
For nI = 0 To UBound (mItems)
mItems (nI) = fnReplace (mItems (nI), _
"[Pokémon]", sPokemon)
Next nI
End If
oList = oDialog.getControl ("lstTotal")
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
' fnFindIV: Finds the possible individual values of the Pokémon
Function fnFindIV ( _
aBaseStats As aStats, aQuery As aFindIVParam) As Variant

421
PokemonGoIV/1Dialog.vb Normal file
View File

@ -0,0 +1,421 @@
' Copyright (c) 2016-2017 imacat.
'
' Licensed under the Apache License, Version 2.0 (the "License");
' you may not use this file except in compliance with the License.
' You may obtain a copy of the License at
'
' http://www.apache.org/licenses/LICENSE-2.0
'
' Unless required by applicable law or agreed to in writing, software
' distributed under the License is distributed on an "AS IS" BASIS,
' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
' See the License for the specific language governing permissions and
' limitations under the License.
' 1Dialog: The Dialog UI processor
' by imacat <imacat@mail.imacat.idv.tw>, 2017-02-24
Option Explicit
' fnLoadParamDialog: Loads the parameter dialog.
Function fnLoadParamDialog As Object
Dim oDialog As Object
DialogLibraries.loadLibrary "PokemonGoIV"
oDialog = CreateUnoDialog (DialogLibraries.PokemonGoIV.DlgMain)
oDialog.getControl ("lstTotal").setVisible (False)
oDialog.getControl ("txtBestHead").setVisible (False)
oDialog.getControl ("lstBest").setVisible (False)
oDialog.getControl ("txtBestTail").setVisible (False)
oDialog.getControl ("cbxBest2").setVisible (False)
oDialog.getControl ("cbxBest3").setVisible (False)
oDialog.getControl ("lstMax").setVisible (False)
oDialog.getControl ("imgPokemon").getModel.setPropertyValue ( _
"ImageURL", fnGetImageUrl ("Unknown"))
oDialog.getControl ("imgTeamLogo").getModel.setPropertyValue ( _
"ImageURL", fnGetImageUrl ("Unknown"))
fnLoadParamDialog = oDialog
End Function
' 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 ("lstPokemon")
oCP = oDialog.getControl ("numCP")
oHP = oDialog.getControl ("numHP")
oStardust = oDialog.getControl ("lstStardust")
oOK = oDialog.getControl ("btnOK")
If oPokemon.getSelectedItemPos <> -1 _
And oCP.getText <> "" _
And oHP.getText <> "" _
And oStardust.getSelectedItemPos <> -1 Then
oOK.setEnable (True)
Else
oOK.setEnable (False)
End If
End Sub
' 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
' Updates the Pokémon image.
nSelected = oDialog.getControl ("lstPokemon").getSelectedItemPos
subReadBaseStats
sImageId = "Pokemon" & maBaseStats (nSelected).sPokemon
oImageModel = oDialog.getControl ("imgPokemon").getModel
oImageModel.setPropertyValue ("ImageURL", _
fnGetImageUrl (sImageId))
' Updates the text of the stats total appraisal.
subUpdateTotalAppraisal (oDialog, True)
' Checks if the required columns are filled.
subBtnOKCheck (oEvent)
End Sub
' 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 ("imgTeamLogo").getModel
oImageModel.setPropertyValue ("ImageURL", _
fnGetImageUrl ("TeamLogoValor"))
oImageModel = oDialog.getControl ("imgTeamLeader").getModel
oImageModel.setPropertyValue ("ImageURL", _
fnGetImageUrl ("TeamLeaderCandela"))
oText = oDialog.getControl ("txtLeaderAppraise")
oText.setVisible (True)
oText.setText (fnGetResString ("AppraiseFromCandela"))
' Updates the text of the stats total appraisal.
subUpdateTotalAppraisal (oDialog, False)
' Updates the text of the best stat appraisal.
subUpdateBestStatAppraisal (oDialog, _
fnGetResString ("AppraisalValorBest"), _
CInt (fnGetResString ("AppraisalValorBestHeadWidth")))
mItems = Array ( _
fnGetResString ("AppraisalValorMax15"), _
fnGetResString ("AppraisalValorMax13Or14"), _
fnGetResString ("AppraisalValorMax8To12"), _
fnGetResString ("AppraisalValorMaxUpTo7"))
oList = oDialog.getControl ("lstMax")
oList.removeItems (0, oList.getItemCount())
oList.addItems (mItems, 0)
oList.setVisible (True)
End Sub
' 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 ("imgTeamLogo").getModel
oImageModel.setPropertyValue ("ImageURL", _
fnGetImageUrl ("TeamLogoMystic"))
oImageModel = oDialog.getControl ("imgTeamLeader").getModel
oImageModel.setPropertyValue ("ImageURL", _
fnGetImageUrl ("TeamLeaderBlanche"))
oText = oDialog.getControl ("txtLeaderAppraise")
oText.setVisible (True)
oText.setText (fnGetResString ("AppraiseFromBlanche"))
' Updates the text of the stats total appraisal.
subUpdateTotalAppraisal (oDialog, False)
' Updates the text of the best stat appraisal.
subUpdateBestStatAppraisal (oDialog, _
fnGetResString ("AppraisalMysticBest"), _
CInt (fnGetResString ("AppraisalMysticBestHeadWidth")))
mItems = Array ( _
fnGetResString ("AppraisalMysticMax15"), _
fnGetResString ("AppraisalMysticMax13Or14"), _
fnGetResString ("AppraisalMysticMax8To12"), _
fnGetResString ("AppraisalMysticMaxUpTo7"))
oList = oDialog.getControl ("lstMax")
oList.removeItems (0, oList.getItemCount())
oList.addItems (mItems, 0)
oList.setVisible (True)
End Sub
' 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 ("imgTeamLogo").getModel
oImageModel.setPropertyValue ("ImageURL", _
fnGetImageUrl ("TeamLogoInstinct"))
oImageModel = oDialog.getControl ("imgTeamLeader").getModel
oImageModel.setPropertyValue ("ImageURL", _
fnGetImageUrl ("TeamLeaderSpark"))
oText = oDialog.getControl ("txtLeaderAppraise")
oText.setVisible (True)
oText.setText (fnGetResString ("AppraiseFromSpark"))
' Updates the text of the stats total appraisal.
subUpdateTotalAppraisal (oDialog, False)
' Updates the text of the best stat appraisal.
subUpdateBestStatAppraisal (oDialog, _
fnGetResString ("AppraisalInstinctBest"), _
CInt (fnGetResString ("AppraisalInstinctBestHeadWidth")))
mItems = Array ( _
fnGetResString ("AppraisalInstinctMax15"), _
fnGetResString ("AppraisalInstinctMax13Or14"), _
fnGetResString ("AppraisalInstinctMax8To12"), _
fnGetResString ("AppraisalInstinctMaxUpTo7"))
oList = oDialog.getControl ("lstMax")
oList.removeItems (0, oList.getItemCount())
oList.addItems (mItems, 0)
oList.setVisible (True)
End Sub
' 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, "[Stat]")
sHead = Left (sAppraisal, nPos - 1)
sTail = Right (sAppraisal, _
Len (sAppraisal) - nPos - Len ("[Stat]") + 1)
nDialogWidth = oDialog.getModel.getPropertyValue ("Width")
oText = oDialog.getControl ("txtBestHead")
oText.getModel.setPropertyValue ("Width", nHeadWidth)
oText.setVisible (True)
oText.setText (sHead)
nX = oText.getModel.getPropertyValue ("PositionX") + nHeadWidth
mItems = Array ( _
fnGetResString ("StatAttack"), _
fnGetResString ("StatDefense"), _
fnGetResString ("StatHP"))
oList = oDialog.getControl ("lstBest")
oList.removeItems (0, oList.getItemCount())
oList.addItems (mItems, 0)
oList.getModel.setPropertyValue ("PositionX", nX)
oList.getModel.setPropertyValue ("Width", _
CInt (fnGetResString ("BestStatWidth")))
oList.setVisible (True)
nX = nX + oList.getModel.getPropertyValue ("Width")
nTailWidth = nDialogWidth - nX - 10
oText = oDialog.getControl ("txtBestTail")
oText.getModel.setPropertyValue ("PositionX", nX)
oText.getModel.setPropertyValue ("Width", nTailWidth)
oText.setVisible (True)
oText.setText (sTail)
oList = oDialog.getControl ("cbxBest2")
oList.setVisible (False)
oList = oDialog.getControl ("cbxBest3")
oList.setVisible (False)
End Sub
' 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 ("rdoTeamValor").getState Then
sBestToo = fnGetResString ("AppraisalValorBestToo")
If oDialog.getControl ("lstBest").getSelectedItemPos = 0 Then
oCheckBox = oDialog.getControl ("cbxBest2")
oCheckBox.setLabel (fnReplace ( _
sBestToo, "[Stat]", fnGetResString ("StatDefense")))
oCheckBox.setVisible (True)
oCheckBox.setState (0)
oCheckBox = oDialog.getControl ("cbxBest3")
oCheckBox.setLabel (fnReplace ( _
sBestToo, "[Stat]", fnGetResString ("StatHP")))
oCheckBox.setVisible (True)
oCheckBox.setState (0)
End If
If oDialog.getControl ("lstBest").getSelectedItemPos = 1 Then
oCheckBox = oDialog.getControl ("cbxBest2")
oCheckBox.setLabel (fnReplace ( _
sBestToo, "[Stat]", fnGetResString ("StatAttack")))
oCheckBox.setVisible (True)
oCheckBox.setState (0)
oCheckBox = oDialog.getControl ("cbxBest3")
oCheckBox.setLabel (fnReplace ( _
sBestToo, "[Stat]", fnGetResString ("StatHP")))
oCheckBox.setVisible (True)
oCheckBox.setState (0)
End If
If oDialog.getControl ("lstBest").getSelectedItemPos = 2 Then
oCheckBox = oDialog.getControl ("cbxBest2")
oCheckBox.setLabel (fnReplace ( _
sBestToo, "[Stat]", fnGetResString ("StatAttack")))
oCheckBox.setVisible (True)
oCheckBox.setState (0)
oCheckBox = oDialog.getControl ("cbxBest3")
oCheckBox.setLabel (fnReplace ( _
sBestToo, "[Stat]", fnGetResString ("StatDefense")))
oCheckBox.setVisible (True)
oCheckBox.setState (0)
End If
End If
If oDialog.getControl ("rdoTeamMystic").getState Then
sBestToo = fnGetResString ("AppraisalMysticBestToo")
If oDialog.getControl ("lstBest").getSelectedItemPos = 0 Then
oCheckBox = oDialog.getControl ("cbxBest2")
oCheckBox.setLabel (fnReplace ( _
sBestToo, "[Stat]", fnGetResString ("StatDefense")))
oCheckBox.setVisible (True)
oCheckBox.setState (0)
oCheckBox = oDialog.getControl ("cbxBest3")
oCheckBox.setLabel (fnReplace ( _
sBestToo, "[Stat]", fnGetResString ("StatHP")))
oCheckBox.setVisible (True)
oCheckBox.setState (0)
End If
If oDialog.getControl ("lstBest").getSelectedItemPos = 1 Then
oCheckBox = oDialog.getControl ("cbxBest2")
oCheckBox.setLabel (fnReplace ( _
sBestToo, "[Stat]", fnGetResString ("StatAttack")))
oCheckBox.setVisible (True)
oCheckBox.setState (0)
oCheckBox = oDialog.getControl ("cbxBest3")
oCheckBox.setLabel (fnReplace ( _
sBestToo, "[Stat]", fnGetResString ("StatHP")))
oCheckBox.setVisible (True)
oCheckBox.setState (0)
End If
If oDialog.getControl ("lstBest").getSelectedItemPos = 2 Then
oCheckBox = oDialog.getControl ("cbxBest2")
oCheckBox.setLabel (fnReplace ( _
sBestToo, "[Stat]", fnGetResString ("StatAttack")))
oCheckBox.setVisible (True)
oCheckBox.setState (0)
oCheckBox = oDialog.getControl ("cbxBest3")
oCheckBox.setLabel (fnReplace ( _
sBestToo, "[Stat]", fnGetResString ("StatDefense")))
oCheckBox.setVisible (True)
oCheckBox.setState (0)
End If
End If
If oDialog.getControl ("rdoTeamInstinct").getState Then
sBestToo = fnGetResString ("AppraisalInstinctBestToo")
If oDialog.getControl ("lstBest").getSelectedItemPos = 0 Then
oCheckBox = oDialog.getControl ("cbxBest2")
oCheckBox.setLabel (fnReplace ( _
sBestToo, "[Stat]", fnGetResString ("StatDefense")))
oCheckBox.setVisible (True)
oCheckBox = oDialog.getControl ("cbxBest3")
oCheckBox.setLabel (fnReplace ( _
sBestToo, "[Stat]", fnGetResString ("StatHP")))
oCheckBox.setVisible (True)
End If
If oDialog.getControl ("lstBest").getSelectedItemPos = 1 Then
oCheckBox = oDialog.getControl ("cbxBest2")
oCheckBox.setLabel (fnReplace ( _
sBestToo, "[Stat]", fnGetResString ("StatAttack")))
oCheckBox.setVisible (True)
oCheckBox.setState (0)
oCheckBox = oDialog.getControl ("cbxBest3")
oCheckBox.setLabel (fnReplace ( _
sBestToo, "[Stat]", fnGetResString ("StatHP")))
oCheckBox.setVisible (True)
oCheckBox.setState (0)
End If
If oDialog.getControl ("lstBest").getSelectedItemPos = 2 Then
oCheckBox = oDialog.getControl ("cbxBest2")
oCheckBox.setLabel (fnReplace ( _
sBestToo, "[Stat]", fnGetResString ("StatAttack")))
oCheckBox.setVisible (True)
oCheckBox.setState (0)
oCheckBox = oDialog.getControl ("cbxBest3")
oCheckBox.setLabel (fnReplace ( _
sBestToo, "[Stat]", fnGetResString ("StatDefense")))
oCheckBox.setVisible (True)
oCheckBox.setState (0)
End If
End If
End Sub
' subUpdateTotalAppraisal: Updates the text of the stats total
' 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 ("rdoTeamValor").getState Then
mItems = Array ( _
fnGetResString ("AppraisalValorTotal37OrHigher"), _
fnGetResString ("AppraisalValorTotal30To36"), _
fnGetResString ("AppraisalValorTotal23To29"), _
fnGetResString ("AppraisalValorTotalUpTo22"))
End If
If oDialog.getControl ("rdoTeamMystic").getState Then
mItems = Array ( _
fnGetResString ("AppraisalMysticTotal37OrHigher"), _
fnGetResString ("AppraisalMysticTotal30To36"), _
fnGetResString ("AppraisalMysticTotal23To29"), _
fnGetResString ("AppraisalMysticTotalUpTo22"))
End If
If oDialog.getControl ("rdoTeamInstinct").getState Then
mItems = Array ( _
fnGetResString ("AppraisalInstinctTotal37OrHigher"), _
fnGetResString ("AppraisalInstinctTotal30To36"), _
fnGetResString ("AppraisalInstinctTotal23To29"), _
fnGetResString ("AppraisalInstinctTotalUpTo22"))
End If
' The team was not selected yet.
If UBound (mItems) = -1 Then
Exit sub
End If
sPokemon = oDialog.getControl ("lstPokemon").getSelectedItem
If sPokemon <> "" Then
For nI = 0 To UBound (mItems)
mItems (nI) = fnReplace (mItems (nI), _
"[Pokémon]", sPokemon)
Next nI
End If
oList = oDialog.getControl ("lstTotal")
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

View File

@ -12,7 +12,7 @@
' See the License for the specific language governing permissions and
' limitations under the License.
' 1Data: The Pokémon GO data for IV calculation
' 2Data: The Pokémon GO data for IV calculation
' by imacat <imacat@mail.imacat.idv.tw>, 2017-02-14
' Generated with 9Load.subReadDataSheets ()

View File

@ -37,7 +37,7 @@ Sub subReadDataSheets
& "' See the License for the specific language governing permissions and" & Chr (10) _
& "' limitations under the License." & Chr (10) _
& Chr (10) _
& "' 1Data: The Pokémon GO data for IV calculation" & Chr (10) _
& "' 2Data: The Pokémon GO data for IV calculation" & Chr (10) _
& "' by imacat <imacat@mail.imacat.idv.tw>, " & Format (Date (), "yyyy-mm-dd") & Chr (10) _
& "' Generated with 9Load.subReadDataSheets ()" & Chr (10) _
& Chr (10) _

View File

@ -89,21 +89,7 @@ Function fnAskParam As aFindIVParam
Dim bIsBestHP As Boolean
Dim aQuery As New aFindIVParam
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)
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;))
oDialog = fnLoadParamDialog
If oDialog.execute = 0 Then
aQuery.bIsCancelled = True
fnAskParam = aQuery
@ -171,387 +157,6 @@ Function fnAskParam As aFindIVParam
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).sPokemon
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
&apos; fnFindIV: Finds the possible individual values of the Pokémon
Function fnFindIV ( _
aBaseStats As aStats, aQuery As aFindIVParam) As Variant

424
oxt/PokemonGoIV/1Dialog.xba Normal file
View File

@ -0,0 +1,424 @@
<?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; fnLoadParamDialog: Loads the parameter dialog.
Function fnLoadParamDialog As Object
Dim oDialog As Object
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)
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;))
fnLoadParamDialog = oDialog
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).sPokemon
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>

View File

@ -1,6 +1,6 @@
<?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="1Data" script:language="StarBasic">&apos; Copyright (c) 2016-2017 imacat.
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="2Data" 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.
@ -14,7 +14,7 @@
&apos; See the License for the specific language governing permissions and
&apos; limitations under the License.
&apos; 1Data: The Pokémon GO data for IV calculation
&apos; 2Data: The Pokémon GO data for IV calculation
&apos; by imacat &lt;imacat@mail.imacat.idv.tw&gt;, 2017-02-14
&apos; Generated with 9Load.subReadDataSheets ()

View File

@ -39,7 +39,7 @@ Sub subReadDataSheets
&amp; &quot;&apos; See the License for the specific language governing permissions and&quot; &amp; Chr (10) _
&amp; &quot;&apos; limitations under the License.&quot; &amp; Chr (10) _
&amp; Chr (10) _
&amp; &quot;&apos; 1Data: The Pokémon GO data for IV calculation&quot; &amp; Chr (10) _
&amp; &quot;&apos; 2Data: The Pokémon GO data for IV calculation&quot; &amp; Chr (10) _
&amp; &quot;&apos; by imacat &lt;imacat@mail.imacat.idv.tw&gt;, &quot; &amp; Format (Date (), &quot;yyyy-mm-dd&quot;) &amp; Chr (10) _
&amp; &quot;&apos; Generated with 9Load.subReadDataSheets ()&quot; &amp; Chr (10) _
&amp; Chr (10) _

View File

@ -171,16 +171,16 @@
<dlg:menuitem dlg:value="&amp;1239.lstPokemon.StringItemList"/>
<dlg:menuitem dlg:value="&amp;1240.lstPokemon.StringItemList"/>
</dlg:menupopup>
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:PokemonGoIV.0Main.subLstPokemonSelected?language=Basic&amp;location=application" script:language="Script"/>
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:PokemonGoIV.1Dialog.subLstPokemonSelected?language=Basic&amp;location=application" script:language="Script"/>
</dlg:menulist>
<dlg:img dlg:style-id="0" dlg:id="imgPokemon" dlg:tab-index="26" dlg:left="95" dlg:top="5" dlg:width="30" dlg:height="30"/>
<dlg:text dlg:id="txtCP" dlg:tab-index="17" dlg:left="5" dlg:top="41" dlg:width="15" dlg:height="8" dlg:value="&amp;3.DlgMain.txtCP.Label"/>
<dlg:numericfield dlg:id="numCP" dlg:tab-index="1" dlg:left="20" dlg:top="39" dlg:width="20" dlg:height="12" dlg:decimal-accuracy="0" dlg:value-min="10" dlg:value-max="5000">
<script:event script:event-name="on-textchange" script:macro-name="vnd.sun.star.script:PokemonGoIV.0Main.subBtnOKCheck?language=Basic&amp;location=application" script:language="Script"/>
<script:event script:event-name="on-textchange" script:macro-name="vnd.sun.star.script:PokemonGoIV.1Dialog.subBtnOKCheck?language=Basic&amp;location=application" script:language="Script"/>
</dlg:numericfield>
<dlg:text dlg:id="txtHP" dlg:tab-index="18" dlg:left="50" dlg:top="41" dlg:width="15" dlg:height="8" dlg:value="&amp;4.DlgMain.txtHP.Label"/>
<dlg:numericfield dlg:id="numHP" dlg:tab-index="2" dlg:left="65" dlg:top="39" dlg:width="15" dlg:height="12" dlg:decimal-accuracy="0" dlg:value-min="10" dlg:value-max="500">
<script:event script:event-name="on-textchange" script:macro-name="vnd.sun.star.script:PokemonGoIV.0Main.subBtnOKCheck?language=Basic&amp;location=application" script:language="Script"/>
<script:event script:event-name="on-textchange" script:macro-name="vnd.sun.star.script:PokemonGoIV.1Dialog.subBtnOKCheck?language=Basic&amp;location=application" script:language="Script"/>
</dlg:numericfield>
<dlg:text dlg:id="txtStardust" dlg:tab-index="19" dlg:left="90" dlg:top="41" dlg:width="45" dlg:height="8" dlg:value="&amp;5.DlgMain.txtStardust.Label"/>
<dlg:menulist dlg:id="lstStardust" dlg:tab-index="3" dlg:left="135" dlg:top="39" dlg:width="40" dlg:height="12" dlg:spin="true" dlg:linecount="20">
@ -206,7 +206,7 @@
<dlg:menuitem dlg:value="9000"/>
<dlg:menuitem dlg:value="10000"/>
</dlg:menupopup>
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:PokemonGoIV.0Main.subBtnOKCheck?language=Basic&amp;location=application" script:language="Script"/>
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:PokemonGoIV.1Dialog.subBtnOKCheck?language=Basic&amp;location=application" script:language="Script"/>
</dlg:menulist>
<dlg:text dlg:id="txtPlayerLevel" dlg:tab-index="20" dlg:left="185" dlg:top="41" dlg:width="45" dlg:height="8" dlg:value="&amp;6.DlgMain.txtPlayerLevel.Label"/>
<dlg:menulist dlg:id="lstPlayerLevel" dlg:tab-index="4" dlg:left="230" dlg:top="39" dlg:width="30" dlg:height="12" dlg:spin="true" dlg:linecount="20">
@ -260,13 +260,13 @@
<dlg:img dlg:style-id="0" dlg:id="imgTeamLogo" dlg:tab-index="25" dlg:left="10" dlg:top="80" dlg:width="30" dlg:height="30"/>
<dlg:radiogroup>
<dlg:radio dlg:style-id="1" dlg:id="rdoTeamValor" dlg:tab-index="6" dlg:left="45" dlg:top="100" dlg:width="60" dlg:height="10" dlg:value="&amp;9.DlgMain.rdoTeamValor.Label" dlg:valign="center">
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:PokemonGoIV.0Main.subRdoTeamValorItemChanged?language=Basic&amp;location=application" script:language="Script"/>
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:PokemonGoIV.1Dialog.subRdoTeamValorItemChanged?language=Basic&amp;location=application" script:language="Script"/>
</dlg:radio>
<dlg:radio dlg:style-id="2" dlg:id="rdoTeamMystic" dlg:tab-index="7" dlg:left="120" dlg:top="100" dlg:width="60" dlg:height="10" dlg:value="&amp;10.DlgMain.rdoTeamMystic.Label" dlg:valign="center">
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:PokemonGoIV.0Main.subRdoTeamMysticItemChanged?language=Basic&amp;location=application" script:language="Script"/>
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:PokemonGoIV.1Dialog.subRdoTeamMysticItemChanged?language=Basic&amp;location=application" script:language="Script"/>
</dlg:radio>
<dlg:radio dlg:style-id="3" dlg:id="rdoTeamInstinct" dlg:tab-index="8" dlg:left="195" dlg:top="100" dlg:width="60" dlg:height="10" dlg:value="&amp;11.DlgMain.rdoTeamInstinct.Label" dlg:valign="center">
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:PokemonGoIV.0Main.subRdoTeamInstinctItemChanged?language=Basic&amp;location=application" script:language="Script"/>
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:PokemonGoIV.1Dialog.subRdoTeamInstinctItemChanged?language=Basic&amp;location=application" script:language="Script"/>
</dlg:radio>
</dlg:radiogroup>
<dlg:img dlg:style-id="0" dlg:id="imgTeamLeader" dlg:tab-index="28" dlg:left="10" dlg:top="110" dlg:width="30" dlg:height="35"/>
@ -274,7 +274,7 @@
<dlg:menulist dlg:id="lstTotal" dlg:tab-index="9" dlg:left="45" dlg:top="129" dlg:width="210" dlg:height="12" dlg:spin="true"/>
<dlg:text dlg:id="txtBestHead" dlg:tab-index="23" dlg:left="45" dlg:top="146" dlg:width="20" dlg:height="8"/>
<dlg:menulist dlg:id="lstBest" dlg:tab-index="10" dlg:left="65" dlg:top="144" dlg:width="58" dlg:height="12" dlg:spin="true">
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:PokemonGoIV.0Main.subLstBestItemChanged?language=Basic&amp;location=application" script:language="Script"/>
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:PokemonGoIV.1Dialog.subLstBestItemChanged?language=Basic&amp;location=application" script:language="Script"/>
</dlg:menulist>
<dlg:text dlg:id="txtBestTail" dlg:tab-index="24" dlg:left="110" dlg:top="146" dlg:width="100" dlg:height="8"/>
<dlg:checkbox dlg:id="cbxBest2" dlg:tab-index="11" dlg:left="45" dlg:top="161" dlg:width="210" dlg:height="8" dlg:checked="false"/>

View File

@ -2,7 +2,8 @@
<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
<library:library xmlns:library="http://openoffice.org/2000/library" library:name="PokemonGoIV" library:readonly="false" library:passwordprotected="false">
<library:element library:name="0Main"/>
<library:element library:name="1Data"/>
<library:element library:name="2Data"/>
<library:element library:name="9Load"/>
<library:element library:name="8Registry"/>
<library:element library:name="1Dialog"/>
</library:library>