diff --git a/PokemonGoIV/0Main.vb b/PokemonGoIV/0Main.vb index c9d897e..0e2ff55 100644 --- a/PokemonGoIV/0Main.vb +++ b/PokemonGoIV/0Main.vb @@ -85,13 +85,13 @@ Function fnAskParam As aFindIVParam DialogLibraries.loadLibrary "PokemonGoIV" oDialog = CreateUnoDialog (DialogLibraries.PokemonGoIV.DlgMain) - oDialog.getControl ("lstApprasal1").setVisible (False) + oDialog.getControl ("lstAppraisal1").setVisible (False) oDialog.getControl ("txtBestBefore").setVisible (False) oDialog.getControl ("lstBest").setVisible (False) oDialog.getControl ("txtBestAfter").setVisible (False) oDialog.getControl ("cbxBest2").setVisible (False) oDialog.getControl ("cbxBest3").setVisible (False) - oDialog.getControl ("lstApprasal2").setVisible (False) + oDialog.getControl ("lstAppraisal2").setVisible (False) oDialog.getControl ("imgPokemon").getModel.setPropertyValue ( _ "ImageURL", fnGetImageUrl ("Unknown")) @@ -110,8 +110,8 @@ Function fnAskParam As aFindIVParam .nHP = oDialog.getControl ("numHP").getValue .nStarDust = CInt (oDialog.getControl ("lstStarDust").getSelectedItem) .nPlayerLevel = CInt (oDialog.getControl ("lstPlayerLevel").getSelectedItem) - .nAppraisal1 = oDialog.getControl ("lstApprasal1").getSelectedItemPos + 1 - .nAppraisal2 = oDialog.getControl ("lstApprasal2").getSelectedItemPos + 1 + .nAppraisal1 = oDialog.getControl ("lstAppraisal1").getSelectedItemPos + 1 + .nAppraisal2 = oDialog.getControl ("lstAppraisal2").getSelectedItemPos + 1 .bIsCancelled = False End With If oDialog.getControl ("cbxIsNew").getState = 1 Then @@ -165,7 +165,7 @@ Function fnAskParam As aFindIVParam fnAskParam = aQuery End Function -' subBtnOKCheck: Checks whether Pokémon, CP, HP and star dust are all filled. +' subBtnOKCheck: Checks whether the required columns are filled. Sub subBtnOKCheck (oEvent As object) Dim oDialog As Object Dim oPokemon As Object, oCP As Object @@ -195,6 +195,7 @@ Sub subLstPokemonSelected (oEvent As object) oDialog = oEvent.Source.getContext + ' Updates the Pokémon image. sPokemon = oDialog.getControl ("lstPokemon").getSelectedItem sImageId = "" If sPokemon = "Farfetch'd" Then @@ -212,25 +213,18 @@ Sub subLstPokemonSelected (oEvent As object) If sImageId = "" Then sImageId = "Pokemon" & sPokemon End If - oImageModel = oDialog.getControl ("imgPokemon").getModel oImageModel.setPropertyValue ("ImageURL", _ fnGetImageUrl (sImageId)) + ' Updates the text of the first appraisal. + subUpdateAppraisal1 (oEvent, True) + ' Checks if the required columns are filled. subBtnOKCheck (oEvent) End Sub -' subBtnOKCheck_textChanged: When the CP or HP is filled -Sub subBtnOKCheck_textChanged (oEvent As object) - subBtnOKCheck_itemStateChanged (oEvent) -End Sub - -' subRdoTeamRedItemChanged_disposing: Dummy for the listener. -Sub subRdoTeamRedItemChanged_disposing (oEvent As object) -End Sub - -' subRdoTeamRedItemChanged_itemStateChanged: When the team is selected. -Sub subRdoTeamRedItemChanged_itemStateChanged (oEvent As object) +' subRdoTeamRedItemChanged: When the red team is selected. +Sub subRdoTeamRedItemChanged (oEvent As object) Dim oDialog As Object, oList As Object, oText As Object Dim oImageModel As Object Dim mItems () As String @@ -240,7 +234,6 @@ Sub subRdoTeamRedItemChanged_itemStateChanged (oEvent As object) oImageModel = oDialog.getControl ("imgTeamLogo").getModel oImageModel.setPropertyValue ("ImageURL", _ fnGetImageUrl ("TeamLogoValor")) - oDialog.getControl ("imgTeamLeader").setVisible (True) oImageModel = oDialog.getControl ("imgTeamLeader").getModel oImageModel.setPropertyValue ("ImageURL", _ fnGetImageUrl ("TeamLeaderCandela")) @@ -249,15 +242,8 @@ Sub subRdoTeamRedItemChanged_itemStateChanged (oEvent As object) oText.setVisible (True) oText.setText (fnGetResString ("AppraiseFromCandela")) - mItems = Array ( _ - "Overall, your [Pokémon] simply amazes me. It can accomplish anything!", _ - "Overall, your [Pokémon] is a strong Pokémon. You should be proud!", _ - "Overall, your [Pokémon] is a decent Pokémon.", _ - "Overall, your [Pokémon] may not be great in battle, but I still like it!") - oList = oDialog.getControl ("lstApprasal1") - oList.removeItems (0, oList.getItemCount()) - oList.addItems (mItems, 0) - oList.setVisible (True) + ' Updates the text of the first appraisal. + subUpdateAppraisal1 (oEvent, False) oText = oDialog.getControl ("txtBestBefore") oText.setPosSize (-1, -1, 20, -1, _ @@ -290,18 +276,14 @@ Sub subRdoTeamRedItemChanged_itemStateChanged (oEvent As object) "It's got excellent stats! How exciting!", _ "Its stats indicate that in battle, it'll get the job done.", _ "Its stats don't point to greatness in battle.") - oList = oDialog.getControl ("lstApprasal2") + oList = oDialog.getControl ("lstAppraisal2") oList.removeItems (0, oList.getItemCount()) oList.addItems (mItems, 0) oList.setVisible (True) End Sub -' subRdoTeamBlueItemChanged_disposing: Dummy for the listener. -Sub subRdoTeamBlueItemChanged_disposing (oEvent As object) -End Sub - -' subRdoTeamBlueItemChanged_itemStateChanged: When the blue team is selected. -Sub subRdoTeamBlueItemChanged_itemStateChanged (oEvent As object) +' subRdoTeamBlueItemChanged: When the blue team is selected. +Sub subRdoTeamBlueItemChanged (oEvent As object) Dim oDialog As Object, oList As Object, oText As Object Dim oImageModel As Object Dim mItems () As String @@ -311,7 +293,6 @@ Sub subRdoTeamBlueItemChanged_itemStateChanged (oEvent As object) oImageModel = oDialog.getControl ("imgTeamLogo").getModel oImageModel.setPropertyValue ("ImageURL", _ fnGetImageUrl ("TeamLogoMystic")) - oDialog.getControl ("imgTeamLeader").setVisible (True) oImageModel = oDialog.getControl ("imgTeamLeader").getModel oImageModel.setPropertyValue ("ImageURL", _ fnGetImageUrl ("TeamLeaderBlanche")) @@ -320,15 +301,8 @@ Sub subRdoTeamBlueItemChanged_itemStateChanged (oEvent As object) oText.setVisible (True) oText.setText (fnGetResString ("AppraiseFromBlanche")) - mItems = Array ( _ - "Overall, your [Pokémon] is a wonder! What a breathtaking Pokémon!", _ - "Overall, your [Pokémon] has certainly caught my attention.", _ - "Overall, your [Pokémon] is above average.", _ - "Overall, your [Pokémon] is not likely to make much headway in battle.") - oList = oDialog.getControl ("lstApprasal1") - oList.removeItems (0, oList.getItemCount()) - oList.addItems (mItems, 0) - oList.setVisible (True) + ' Updates the text of the first appraisal. + subUpdateAppraisal1 (oEvent, False) oText = oDialog.getControl ("txtBestBefore") oText.setPosSize (-1, -1, 200, -1, _ @@ -361,18 +335,14 @@ Sub subRdoTeamBlueItemChanged_itemStateChanged (oEvent As object) "I am certainly impressed by its stats, I must say.", _ "Its stats are noticeably trending to the positive.", _ "Its stats are not out of the norm, in my opinion.") - oList = oDialog.getControl ("lstApprasal2") + oList = oDialog.getControl ("lstAppraisal2") oList.removeItems (0, oList.getItemCount()) oList.addItems (mItems, 0) oList.setVisible (True) End Sub -' subRdoTeamYellowItemChanged_disposing: Dummy for the listener. -Sub subRdoTeamYellowItemChanged_disposing (oEvent As object) -End Sub - -' subRdoTeamYellowItemChanged_itemStateChanged: When the yellow team is selected. -Sub subRdoTeamYellowItemChanged_itemStateChanged (oEvent As object) +' subRdoTeamYellowItemChanged: When the yellow team is selected. +Sub subRdoTeamYellowItemChanged (oEvent As object) Dim oDialog As Object, oList As Object, oText As Object Dim oImageModel As Object Dim mItems () As String @@ -382,7 +352,6 @@ Sub subRdoTeamYellowItemChanged_itemStateChanged (oEvent As object) oImageModel = oDialog.getControl ("imgTeamLogo").getModel oImageModel.setPropertyValue ("ImageURL", _ fnGetImageUrl ("TeamLogoInstinct")) - oDialog.getControl ("imgTeamLeader").setVisible (True) oImageModel = oDialog.getControl ("imgTeamLeader").getModel oImageModel.setPropertyValue ("ImageURL", _ fnGetImageUrl ("TeamLeaderSpark")) @@ -391,15 +360,8 @@ Sub subRdoTeamYellowItemChanged_itemStateChanged (oEvent As object) oText.setVisible (True) oText.setText (fnGetResString ("AppraiseFromSpark")) - mItems = Array ( _ - "Overall, your [Pokémon] looks like it can really battle with the best of them!", _ - "Overall, your [Pokémon] is really strong!", _ - "Overall, your [Pokémon] is pretty decent!", _ - "Overall, your [Pokémon] has room for improvement as far as battling goes.") - oList = oDialog.getControl ("lstApprasal1") - oList.removeItems (0, oList.getItemCount()) - oList.addItems (mItems, 0) - oList.setVisible (True) + ' Updates the text of the first appraisal. + subUpdateAppraisal1 (oEvent, False) oText = oDialog.getControl ("txtBestBefore") oText.setPosSize (-1, -1, 115, -1, _ @@ -432,18 +394,14 @@ Sub subRdoTeamYellowItemChanged_itemStateChanged (oEvent As object) "Its stats are really strong! Impressive.", _ "It's definitely got some good stats. Definitely!", _ "Its stats are all right, but kinda basic, as far as I can see.") - oList = oDialog.getControl ("lstApprasal2") + oList = oDialog.getControl ("lstAppraisal2") oList.removeItems (0, oList.getItemCount()) oList.addItems (mItems, 0) oList.setVisible (True) End Sub -' subLstBestItemChanged_disposing: Dummy for the listener. -Sub subLstBestItemChanged_disposing (oEvent As object) -End Sub - -' subLstBestItemChanged_itemStateChanged: When the best stat is selected. -Sub subLstBestItemChanged_itemStateChanged (oEvent As object) +' subLstBestItemChanged: When the best stat is selected. +Sub subLstBestItemChanged (oEvent As object) Dim oDialog As Object, oCheckBox As Object oDialog = oEvent.Source.getContext @@ -543,6 +501,60 @@ Sub subLstBestItemChanged_itemStateChanged (oEvent As object) End If End Sub +' subUpdateAppraisal1: Updates the text of the first appraisal. +Sub subUpdateAppraisal1 (oEvent As Object, bIsKeepSelected As Boolean) + Dim oDialog As Object, sPokemon As String + Dim oList As Object, nSelected As Integer + Dim mItems () As String, nI As Integer + + oDialog = oEvent.Source.getContext + + If oDialog.getControl ("rdoTeamRed").getState Then + mItems = Array ( _ + "Overall, your [Pokémon] simply amazes me. It can accomplish anything!", _ + "Overall, your [Pokémon] is a strong Pokémon. You should be proud!", _ + "Overall, your [Pokémon] is a decent Pokémon.", _ + "Overall, your [Pokémon] may not be great in battle, but I still like it!") + End If + If oDialog.getControl ("rdoTeamBlue").getState Then + mItems = Array ( _ + "Overall, your [Pokémon] is a wonder! What a breathtaking Pokémon!", _ + "Overall, your [Pokémon] has certainly caught my attention.", _ + "Overall, your [Pokémon] is above average.", _ + "Overall, your [Pokémon] is not likely to make much headway in battle.") + End If + If oDialog.getControl ("rdoTeamYellow").getState Then + mItems = Array ( _ + "Overall, your [Pokémon] looks like it can really battle with the best of them!", _ + "Overall, your [Pokémon] is really strong!", _ + "Overall, your [Pokémon] is pretty decent!", _ + "Overall, your [Pokémon] has room for improvement as far as battling goes.") + 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 ("lstAppraisal1") + 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 (aQuery As aFindIVParam) As Variant Dim aBaseStats As New aStats, maIV () As New aStats @@ -1049,6 +1061,19 @@ Function fnGetEmptyEvolvedFormArray () As Variant fnGetEmptyEvolvedFormArray = mData End Function +' fnReplace: Replaces all occurrances of a term to another. +Function fnReplace (sText As String, sFrom As String, sTo As String) As String + Dim nPos As Integer + + nPos = InStr (sText, sFrom) + Do While nPos <> 0 + sText = Left (sText, nPos - 1) & sTo _ + & Right (sText, Len (sText) - nPos - Len (sFrom) + 1) + nPos = InStr (nPos + Len (sTo), sText, sFrom) + Loop + fnReplace = sText +End Function + ' subReadCPM: Reads the CPM table. Sub subReadCPM If UBound (mCPM) = -1 Then diff --git a/TODO b/TODO index d424c04..eae11c7 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,4 @@ PokemonGoIV TODO -* Clean-up event handlers. * LibreOffice compability. * Center the dialog. diff --git a/oxt/PokemonGoIV/0Main.xba b/oxt/PokemonGoIV/0Main.xba index 83dd58c..73aef5a 100644 --- a/oxt/PokemonGoIV/0Main.xba +++ b/oxt/PokemonGoIV/0Main.xba @@ -87,13 +87,13 @@ Function fnAskParam As aFindIVParam DialogLibraries.loadLibrary "PokemonGoIV" oDialog = CreateUnoDialog (DialogLibraries.PokemonGoIV.DlgMain) - oDialog.getControl ("lstApprasal1").setVisible (False) + oDialog.getControl ("lstAppraisal1").setVisible (False) oDialog.getControl ("txtBestBefore").setVisible (False) oDialog.getControl ("lstBest").setVisible (False) oDialog.getControl ("txtBestAfter").setVisible (False) oDialog.getControl ("cbxBest2").setVisible (False) oDialog.getControl ("cbxBest3").setVisible (False) - oDialog.getControl ("lstApprasal2").setVisible (False) + oDialog.getControl ("lstAppraisal2").setVisible (False) oDialog.getControl ("imgPokemon").getModel.setPropertyValue ( _ "ImageURL", fnGetImageUrl ("Unknown")) @@ -112,8 +112,8 @@ Function fnAskParam As aFindIVParam .nHP = oDialog.getControl ("numHP").getValue .nStarDust = CInt (oDialog.getControl ("lstStarDust").getSelectedItem) .nPlayerLevel = CInt (oDialog.getControl ("lstPlayerLevel").getSelectedItem) - .nAppraisal1 = oDialog.getControl ("lstApprasal1").getSelectedItemPos + 1 - .nAppraisal2 = oDialog.getControl ("lstApprasal2").getSelectedItemPos + 1 + .nAppraisal1 = oDialog.getControl ("lstAppraisal1").getSelectedItemPos + 1 + .nAppraisal2 = oDialog.getControl ("lstAppraisal2").getSelectedItemPos + 1 .bIsCancelled = False End With If oDialog.getControl ("cbxIsNew").getState = 1 Then @@ -167,7 +167,7 @@ Function fnAskParam As aFindIVParam fnAskParam = aQuery End Function -' subBtnOKCheck: Checks whether Pokémon, CP, HP and star dust are all filled. +' subBtnOKCheck: Checks whether the required columns are filled. Sub subBtnOKCheck (oEvent As object) Dim oDialog As Object Dim oPokemon As Object, oCP As Object @@ -197,6 +197,7 @@ Sub subLstPokemonSelected (oEvent As object) oDialog = oEvent.Source.getContext + ' Updates the Pokémon image. sPokemon = oDialog.getControl ("lstPokemon").getSelectedItem sImageId = "" If sPokemon = "Farfetch'd" Then @@ -214,25 +215,18 @@ Sub subLstPokemonSelected (oEvent As object) If sImageId = "" Then sImageId = "Pokemon" & sPokemon End If - oImageModel = oDialog.getControl ("imgPokemon").getModel oImageModel.setPropertyValue ("ImageURL", _ fnGetImageUrl (sImageId)) + ' Updates the text of the first appraisal. + subUpdateAppraisal1 (oEvent, True) + ' Checks if the required columns are filled. subBtnOKCheck (oEvent) End Sub -' subBtnOKCheck_textChanged: When the CP or HP is filled -Sub subBtnOKCheck_textChanged (oEvent As object) - subBtnOKCheck_itemStateChanged (oEvent) -End Sub - -' subRdoTeamRedItemChanged_disposing: Dummy for the listener. -Sub subRdoTeamRedItemChanged_disposing (oEvent As object) -End Sub - -' subRdoTeamRedItemChanged_itemStateChanged: When the team is selected. -Sub subRdoTeamRedItemChanged_itemStateChanged (oEvent As object) +' subRdoTeamRedItemChanged: When the red team is selected. +Sub subRdoTeamRedItemChanged (oEvent As object) Dim oDialog As Object, oList As Object, oText As Object Dim oImageModel As Object Dim mItems () As String @@ -242,7 +236,6 @@ Sub subRdoTeamRedItemChanged_itemStateChanged (oEvent As object) oImageModel = oDialog.getControl ("imgTeamLogo").getModel oImageModel.setPropertyValue ("ImageURL", _ fnGetImageUrl ("TeamLogoValor")) - oDialog.getControl ("imgTeamLeader").setVisible (True) oImageModel = oDialog.getControl ("imgTeamLeader").getModel oImageModel.setPropertyValue ("ImageURL", _ fnGetImageUrl ("TeamLeaderCandela")) @@ -251,15 +244,8 @@ Sub subRdoTeamRedItemChanged_itemStateChanged (oEvent As object) oText.setVisible (True) oText.setText (fnGetResString ("AppraiseFromCandela")) - mItems = Array ( _ - "Overall, your [Pokémon] simply amazes me. It can accomplish anything!", _ - "Overall, your [Pokémon] is a strong Pokémon. You should be proud!", _ - "Overall, your [Pokémon] is a decent Pokémon.", _ - "Overall, your [Pokémon] may not be great in battle, but I still like it!") - oList = oDialog.getControl ("lstApprasal1") - oList.removeItems (0, oList.getItemCount()) - oList.addItems (mItems, 0) - oList.setVisible (True) + ' Updates the text of the first appraisal. + subUpdateAppraisal1 (oEvent, False) oText = oDialog.getControl ("txtBestBefore") oText.setPosSize (-1, -1, 20, -1, _ @@ -292,18 +278,14 @@ Sub subRdoTeamRedItemChanged_itemStateChanged (oEvent As object) "It's got excellent stats! How exciting!", _ "Its stats indicate that in battle, it'll get the job done.", _ "Its stats don't point to greatness in battle.") - oList = oDialog.getControl ("lstApprasal2") + oList = oDialog.getControl ("lstAppraisal2") oList.removeItems (0, oList.getItemCount()) oList.addItems (mItems, 0) oList.setVisible (True) End Sub -' subRdoTeamBlueItemChanged_disposing: Dummy for the listener. -Sub subRdoTeamBlueItemChanged_disposing (oEvent As object) -End Sub - -' subRdoTeamBlueItemChanged_itemStateChanged: When the blue team is selected. -Sub subRdoTeamBlueItemChanged_itemStateChanged (oEvent As object) +' subRdoTeamBlueItemChanged: When the blue team is selected. +Sub subRdoTeamBlueItemChanged (oEvent As object) Dim oDialog As Object, oList As Object, oText As Object Dim oImageModel As Object Dim mItems () As String @@ -313,7 +295,6 @@ Sub subRdoTeamBlueItemChanged_itemStateChanged (oEvent As object) oImageModel = oDialog.getControl ("imgTeamLogo").getModel oImageModel.setPropertyValue ("ImageURL", _ fnGetImageUrl ("TeamLogoMystic")) - oDialog.getControl ("imgTeamLeader").setVisible (True) oImageModel = oDialog.getControl ("imgTeamLeader").getModel oImageModel.setPropertyValue ("ImageURL", _ fnGetImageUrl ("TeamLeaderBlanche")) @@ -322,15 +303,8 @@ Sub subRdoTeamBlueItemChanged_itemStateChanged (oEvent As object) oText.setVisible (True) oText.setText (fnGetResString ("AppraiseFromBlanche")) - mItems = Array ( _ - "Overall, your [Pokémon] is a wonder! What a breathtaking Pokémon!", _ - "Overall, your [Pokémon] has certainly caught my attention.", _ - "Overall, your [Pokémon] is above average.", _ - "Overall, your [Pokémon] is not likely to make much headway in battle.") - oList = oDialog.getControl ("lstApprasal1") - oList.removeItems (0, oList.getItemCount()) - oList.addItems (mItems, 0) - oList.setVisible (True) + ' Updates the text of the first appraisal. + subUpdateAppraisal1 (oEvent, False) oText = oDialog.getControl ("txtBestBefore") oText.setPosSize (-1, -1, 200, -1, _ @@ -363,18 +337,14 @@ Sub subRdoTeamBlueItemChanged_itemStateChanged (oEvent As object) "I am certainly impressed by its stats, I must say.", _ "Its stats are noticeably trending to the positive.", _ "Its stats are not out of the norm, in my opinion.") - oList = oDialog.getControl ("lstApprasal2") + oList = oDialog.getControl ("lstAppraisal2") oList.removeItems (0, oList.getItemCount()) oList.addItems (mItems, 0) oList.setVisible (True) End Sub -' subRdoTeamYellowItemChanged_disposing: Dummy for the listener. -Sub subRdoTeamYellowItemChanged_disposing (oEvent As object) -End Sub - -' subRdoTeamYellowItemChanged_itemStateChanged: When the yellow team is selected. -Sub subRdoTeamYellowItemChanged_itemStateChanged (oEvent As object) +' subRdoTeamYellowItemChanged: When the yellow team is selected. +Sub subRdoTeamYellowItemChanged (oEvent As object) Dim oDialog As Object, oList As Object, oText As Object Dim oImageModel As Object Dim mItems () As String @@ -384,7 +354,6 @@ Sub subRdoTeamYellowItemChanged_itemStateChanged (oEvent As object) oImageModel = oDialog.getControl ("imgTeamLogo").getModel oImageModel.setPropertyValue ("ImageURL", _ fnGetImageUrl ("TeamLogoInstinct")) - oDialog.getControl ("imgTeamLeader").setVisible (True) oImageModel = oDialog.getControl ("imgTeamLeader").getModel oImageModel.setPropertyValue ("ImageURL", _ fnGetImageUrl ("TeamLeaderSpark")) @@ -393,15 +362,8 @@ Sub subRdoTeamYellowItemChanged_itemStateChanged (oEvent As object) oText.setVisible (True) oText.setText (fnGetResString ("AppraiseFromSpark")) - mItems = Array ( _ - "Overall, your [Pokémon] looks like it can really battle with the best of them!", _ - "Overall, your [Pokémon] is really strong!", _ - "Overall, your [Pokémon] is pretty decent!", _ - "Overall, your [Pokémon] has room for improvement as far as battling goes.") - oList = oDialog.getControl ("lstApprasal1") - oList.removeItems (0, oList.getItemCount()) - oList.addItems (mItems, 0) - oList.setVisible (True) + ' Updates the text of the first appraisal. + subUpdateAppraisal1 (oEvent, False) oText = oDialog.getControl ("txtBestBefore") oText.setPosSize (-1, -1, 115, -1, _ @@ -434,18 +396,14 @@ Sub subRdoTeamYellowItemChanged_itemStateChanged (oEvent As object) "Its stats are really strong! Impressive.", _ "It's definitely got some good stats. Definitely!", _ "Its stats are all right, but kinda basic, as far as I can see.") - oList = oDialog.getControl ("lstApprasal2") + oList = oDialog.getControl ("lstAppraisal2") oList.removeItems (0, oList.getItemCount()) oList.addItems (mItems, 0) oList.setVisible (True) End Sub -' subLstBestItemChanged_disposing: Dummy for the listener. -Sub subLstBestItemChanged_disposing (oEvent As object) -End Sub - -' subLstBestItemChanged_itemStateChanged: When the best stat is selected. -Sub subLstBestItemChanged_itemStateChanged (oEvent As object) +' subLstBestItemChanged: When the best stat is selected. +Sub subLstBestItemChanged (oEvent As object) Dim oDialog As Object, oCheckBox As Object oDialog = oEvent.Source.getContext @@ -545,6 +503,60 @@ Sub subLstBestItemChanged_itemStateChanged (oEvent As object) End If End Sub +' subUpdateAppraisal1: Updates the text of the first appraisal. +Sub subUpdateAppraisal1 (oEvent As Object, bIsKeepSelected As Boolean) + Dim oDialog As Object, sPokemon As String + Dim oList As Object, nSelected As Integer + Dim mItems () As String, nI As Integer + + oDialog = oEvent.Source.getContext + + If oDialog.getControl ("rdoTeamRed").getState Then + mItems = Array ( _ + "Overall, your [Pokémon] simply amazes me. It can accomplish anything!", _ + "Overall, your [Pokémon] is a strong Pokémon. You should be proud!", _ + "Overall, your [Pokémon] is a decent Pokémon.", _ + "Overall, your [Pokémon] may not be great in battle, but I still like it!") + End If + If oDialog.getControl ("rdoTeamBlue").getState Then + mItems = Array ( _ + "Overall, your [Pokémon] is a wonder! What a breathtaking Pokémon!", _ + "Overall, your [Pokémon] has certainly caught my attention.", _ + "Overall, your [Pokémon] is above average.", _ + "Overall, your [Pokémon] is not likely to make much headway in battle.") + End If + If oDialog.getControl ("rdoTeamYellow").getState Then + mItems = Array ( _ + "Overall, your [Pokémon] looks like it can really battle with the best of them!", _ + "Overall, your [Pokémon] is really strong!", _ + "Overall, your [Pokémon] is pretty decent!", _ + "Overall, your [Pokémon] has room for improvement as far as battling goes.") + 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 ("lstAppraisal1") + 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 (aQuery As aFindIVParam) As Variant Dim aBaseStats As New aStats, maIV () As New aStats @@ -1051,6 +1063,19 @@ Function fnGetEmptyEvolvedFormArray () As Variant fnGetEmptyEvolvedFormArray = mData End Function +' fnReplace: Replaces all occurrances of a term to another. +Function fnReplace (sText As String, sFrom As String, sTo As String) As String + Dim nPos As Integer + + nPos = InStr (sText, sFrom) + Do While nPos <> 0 + sText = Left (sText, nPos - 1) & sTo _ + & Right (sText, Len (sText) - nPos - Len (sFrom) + 1) + nPos = InStr (nPos + Len (sTo), sText, sFrom) + Loop + fnReplace = sText +End Function + ' subReadCPM: Reads the CPM table. Sub subReadCPM If UBound (mCPM) = -1 Then diff --git a/oxt/PokemonGoIV/DialogStrings_en_US.properties b/oxt/PokemonGoIV/DialogStrings_en_US.properties index ccc37df..32c6d4b 100644 --- a/oxt/PokemonGoIV/DialogStrings_en_US.properties +++ b/oxt/PokemonGoIV/DialogStrings_en_US.properties @@ -1,43 +1,15 @@ # Strings for Dialog Library PokemonGoIV -2.DlgMain.HelpText= -3.DlgMain.Title=Pok\u00c3\u00a9mon GO IV Calculator -22.DlgMain.txtPokemon.HelpText= -23.DlgMain.txtPokemon.Label=~Pok\u00c3\u00a9mon: -26.DlgMain.txtCP.HelpText= +3.DlgMain.Title=Pok\u00e9mon GO IV Calculator +23.DlgMain.txtPokemon.Label=~Pok\u00e9mon: 27.DlgMain.txtCP.Label=~CP: -28.DlgMain.numCP.HelpText= -29.DlgMain.txtHP.HelpText= 30.DlgMain.txtHP.Label=~HP: -31.DlgMain.numHP.HelpText= -32.DlgMain.txtStarDust.HelpText= 33.DlgMain.txtStarDust.Label=S~tar dust: -40.DlgMain.txtPlayerLevel.HelpText= 41.DlgMain.txtPlayerLevel.Label=Player ~level: -46.DlgMain.cbxIsNew.HelpText= -47.DlgMain.cbxIsNew.Label=This Pok\u00c3\u00a9mon is ~newly-caught and was not powered-up yet. -50.DlgMain.grpApprasals.HelpText= -51.DlgMain.grpApprasals.Label=Team Leader Apprasal -85.DlgMain.btnOK.HelpText= +47.DlgMain.cbxIsNew.Label=This Pok\u00e9mon is ~newly-caught and was not powered-up yet. +51.DlgMain.grpAppraisals.Label=Team Leader Appraisal 86.DlgMain.btnOK.Label=OK -87.DlgMain.btnCancel.HelpText= 88.DlgMain.btnCancel.Label=Cancel -162.DlgMain.lstStarDust.HelpText= -163.DlgMain.lstPlayerLevel.HelpText= -164.DlgMain.lstApprasal1.HelpText= -165.DlgMain.lstApprasal2.HelpText= -171.DlgMain.lstPokemon.HelpText= -180.DlgMain.txtTeam.HelpText= 181.DlgMain.txtTeam.Label=Team: -182.DlgMain.rdoTeamRed.HelpText= 183.DlgMain.rdoTeamRed.Label=~Valor -184.DlgMain.rdoTeamBlue.HelpText= 185.DlgMain.rdoTeamBlue.Label=~Mystic -186.DlgMain.rdoTeamYellow.HelpText= 187.DlgMain.rdoTeamYellow.Label=~Instinct -193.DlgMain.lstBest.HelpText= -194.DlgMain.txtBestBefore.HelpText= -195.DlgMain.txtBestAfter.HelpText= -201.DlgMain.cbxBest2.HelpText= -203.DlgMain.cbxBest3.HelpText= -208.DlgMain.txtLeaderAppraise.HelpText= -210.DlgMain.imgTeamLeader.HelpText= diff --git a/oxt/PokemonGoIV/DialogStrings_zh_TW.properties b/oxt/PokemonGoIV/DialogStrings_zh_TW.properties index cf04c63..1a1edce 100644 --- a/oxt/PokemonGoIV/DialogStrings_zh_TW.properties +++ b/oxt/PokemonGoIV/DialogStrings_zh_TW.properties @@ -1,43 +1,15 @@ # Strings for Dialog Library PokemonGoIV -2.DlgMain.HelpText= 3.DlgMain.Title=\u5bf6\u53ef\u5922 GO IV \u8a08\u7b97\u6a5f -22.DlgMain.txtPokemon.HelpText= 23.DlgMain.txtPokemon.Label=\u5bf6\u53ef\u5922(~P)\uff1a -26.DlgMain.txtCP.HelpText= 27.DlgMain.txtCP.Label=~CP: -28.DlgMain.numCP.HelpText= -29.DlgMain.txtHP.HelpText= 30.DlgMain.txtHP.Label=~HP: -31.DlgMain.numHP.HelpText= -32.DlgMain.txtStarDust.HelpText= 33.DlgMain.txtStarDust.Label=S~tar dust: -40.DlgMain.txtPlayerLevel.HelpText= 41.DlgMain.txtPlayerLevel.Label=\u73a9\u5bb6\u7b49\u7d1a(~L)\uff1a -46.DlgMain.cbxIsNew.HelpText= 47.DlgMain.cbxIsNew.Label=\u6211\u525b\u6293\u5230\u9019\u96bb\u5bf6\u53ef\u5922\uff0c\u9084\u6c92\u5f37\u5316\u904e(~N)\u3002 -50.DlgMain.grpApprasals.HelpText= -51.DlgMain.grpApprasals.Label=\u968a\u9577\u8a55\u50f9 -85.DlgMain.btnOK.HelpText= +51.DlgMain.grpAppraisals.Label=\u968a\u9577\u8a55\u50f9 86.DlgMain.btnOK.Label=\u78ba\u5b9a -87.DlgMain.btnCancel.HelpText= 88.DlgMain.btnCancel.Label=\u53d6\u6d88 -162.DlgMain.lstStarDust.HelpText= -163.DlgMain.lstPlayerLevel.HelpText= -164.DlgMain.lstApprasal1.HelpText= -165.DlgMain.lstApprasal2.HelpText= -171.DlgMain.lstPokemon.HelpText= -180.DlgMain.txtTeam.HelpText= 181.DlgMain.txtTeam.Label=\u968a\u4f0d\uff1a -182.DlgMain.rdoTeamRed.HelpText= 183.DlgMain.rdoTeamRed.Label=~Valor -184.DlgMain.rdoTeamBlue.HelpText= 185.DlgMain.rdoTeamBlue.Label=~Mystic -186.DlgMain.rdoTeamYellow.HelpText= 187.DlgMain.rdoTeamYellow.Label=~Instinct -193.DlgMain.lstBest.HelpText= -194.DlgMain.txtBestBefore.HelpText= -195.DlgMain.txtBestAfter.HelpText= -201.DlgMain.cbxBest2.HelpText= -203.DlgMain.cbxBest3.HelpText= -208.DlgMain.txtLeaderAppraise.HelpText= -210.DlgMain.imgTeamLeader.HelpText= diff --git a/oxt/PokemonGoIV/DlgMain.xdl b/oxt/PokemonGoIV/DlgMain.xdl index fd862e4..2da972c 100644 --- a/oxt/PokemonGoIV/DlgMain.xdl +++ b/oxt/PokemonGoIV/DlgMain.xdl @@ -1,6 +1,6 @@ - + @@ -8,8 +8,8 @@ - - + + @@ -165,17 +165,17 @@ - - - + + + - - + + - - + + @@ -200,8 +200,8 @@ - - + + @@ -245,35 +245,35 @@ - - - + + + - - + + - - + + - - + + - - + + - - - - - - + + + + + + - - - - - - + + + + + + \ No newline at end of file