Renamed the Appraisal1 field to Total, and the Appraisal2 field to Max.

This commit is contained in:
依瑪貓 2016-12-12 17:13:09 +08:00
parent a3752fac44
commit 6965883232
4 changed files with 296 additions and 283 deletions

View File

@ -52,9 +52,9 @@ Type aFindIVParam
nStarDust As Integer nStarDust As Integer
nPlayerLevel As Integer nPlayerLevel As Integer
bIsNew As Boolean bIsNew As Boolean
nAppraisal1 As Integer nTotal As Integer
sBest As String sBest As String
nAppraisal2 As Integer nMax As Integer
bIsCancelled As Boolean bIsCancelled As Boolean
End Type End Type
@ -88,13 +88,13 @@ Function fnAskParam As aFindIVParam
DialogLibraries.loadLibrary "PokemonGoIV" DialogLibraries.loadLibrary "PokemonGoIV"
oDialog = CreateUnoDialog (DialogLibraries.PokemonGoIV.DlgMain) oDialog = CreateUnoDialog (DialogLibraries.PokemonGoIV.DlgMain)
oDialog.getControl ("lstAppraisal1").setVisible (False) oDialog.getControl ("lstTotal").setVisible (False)
oDialog.getControl ("txtBestBefore").setVisible (False) oDialog.getControl ("txtBestBefore").setVisible (False)
oDialog.getControl ("lstBest").setVisible (False) oDialog.getControl ("lstBest").setVisible (False)
oDialog.getControl ("txtBestAfter").setVisible (False) oDialog.getControl ("txtBestAfter").setVisible (False)
oDialog.getControl ("cbxBest2").setVisible (False) oDialog.getControl ("cbxBest2").setVisible (False)
oDialog.getControl ("cbxBest3").setVisible (False) oDialog.getControl ("cbxBest3").setVisible (False)
oDialog.getControl ("lstAppraisal2").setVisible (False) oDialog.getControl ("lstMax").setVisible (False)
oDialog.getControl ("imgPokemon").getModel.setPropertyValue ( _ oDialog.getControl ("imgPokemon").getModel.setPropertyValue ( _
"ImageURL", fnGetImageUrl ("Unknown")) "ImageURL", fnGetImageUrl ("Unknown"))
@ -113,8 +113,8 @@ Function fnAskParam As aFindIVParam
.nHP = oDialog.getControl ("numHP").getValue .nHP = oDialog.getControl ("numHP").getValue
.nStarDust = CInt (oDialog.getControl ("lstStarDust").getSelectedItem) .nStarDust = CInt (oDialog.getControl ("lstStarDust").getSelectedItem)
.nPlayerLevel = CInt (oDialog.getControl ("lstPlayerLevel").getSelectedItem) .nPlayerLevel = CInt (oDialog.getControl ("lstPlayerLevel").getSelectedItem)
.nAppraisal1 = oDialog.getControl ("lstAppraisal1").getSelectedItemPos + 1 .nTotal = oDialog.getControl ("lstTotal").getSelectedItemPos + 1
.nAppraisal2 = oDialog.getControl ("lstAppraisal2").getSelectedItemPos + 1 .nMax = oDialog.getControl ("lstMax").getSelectedItemPos + 1
.bIsCancelled = False .bIsCancelled = False
End With End With
If oDialog.getControl ("cbxIsNew").getState = 1 Then If oDialog.getControl ("cbxIsNew").getState = 1 Then
@ -220,8 +220,8 @@ Sub subLstPokemonSelected (oEvent As object)
oImageModel.setPropertyValue ("ImageURL", _ oImageModel.setPropertyValue ("ImageURL", _
fnGetImageUrl (sImageId)) fnGetImageUrl (sImageId))
' Updates the text of the first appraisal. ' Updates the text of the stats total appraisal.
subUpdateAppraisal1 (oDialog, True) subUpdateTotalAppraisal (oDialog, True)
' Checks if the required columns are filled. ' Checks if the required columns are filled.
subBtnOKCheck (oEvent) subBtnOKCheck (oEvent)
End Sub End Sub
@ -245,8 +245,8 @@ Sub subRdoTeamValorItemChanged (oEvent As object)
oText.setVisible (True) oText.setVisible (True)
oText.setText (fnGetResString ("AppraiseFromCandela")) oText.setText (fnGetResString ("AppraiseFromCandela"))
' Updates the text of the first appraisal. ' Updates the text of the stats total appraisal.
subUpdateAppraisal1 (oDialog, False) subUpdateTotalAppraisal (oDialog, False)
' Updates the text of the best stat appraisal. ' Updates the text of the best stat appraisal.
subUpdateBestStatAppraisal (oDialog, _ subUpdateBestStatAppraisal (oDialog, _
@ -257,7 +257,7 @@ Sub subRdoTeamValorItemChanged (oEvent As object)
"It's got excellent stats! How exciting!", _ "It's got excellent stats! How exciting!", _
"Its stats indicate that in battle, it'll get the job done.", _ "Its stats indicate that in battle, it'll get the job done.", _
"Its stats don't point to greatness in battle.") "Its stats don't point to greatness in battle.")
oList = oDialog.getControl ("lstAppraisal2") oList = oDialog.getControl ("lstMax")
oList.removeItems (0, oList.getItemCount()) oList.removeItems (0, oList.getItemCount())
oList.addItems (mItems, 0) oList.addItems (mItems, 0)
oList.setVisible (True) oList.setVisible (True)
@ -282,8 +282,8 @@ Sub subRdoTeamMysticItemChanged (oEvent As object)
oText.setVisible (True) oText.setVisible (True)
oText.setText (fnGetResString ("AppraiseFromBlanche")) oText.setText (fnGetResString ("AppraiseFromBlanche"))
' Updates the text of the first appraisal. ' Updates the text of the stats total appraisal.
subUpdateAppraisal1 (oDialog, False) subUpdateTotalAppraisal (oDialog, False)
' Updates the text of the best stat appraisal. ' Updates the text of the best stat appraisal.
subUpdateBestStatAppraisal (oDialog, _ subUpdateBestStatAppraisal (oDialog, _
@ -294,7 +294,7 @@ Sub subRdoTeamMysticItemChanged (oEvent As object)
"I am certainly impressed by its stats, I must say.", _ "I am certainly impressed by its stats, I must say.", _
"Its stats are noticeably trending to the positive.", _ "Its stats are noticeably trending to the positive.", _
"Its stats are not out of the norm, in my opinion.") "Its stats are not out of the norm, in my opinion.")
oList = oDialog.getControl ("lstAppraisal2") oList = oDialog.getControl ("lstMax")
oList.removeItems (0, oList.getItemCount()) oList.removeItems (0, oList.getItemCount())
oList.addItems (mItems, 0) oList.addItems (mItems, 0)
oList.setVisible (True) oList.setVisible (True)
@ -319,8 +319,8 @@ Sub subRdoTeamInstinctItemChanged (oEvent As object)
oText.setVisible (True) oText.setVisible (True)
oText.setText (fnGetResString ("AppraiseFromSpark")) oText.setText (fnGetResString ("AppraiseFromSpark"))
' Updates the text of the first appraisal. ' Updates the text of the stats total appraisal.
subUpdateAppraisal1 (oDialog, False) subUpdateTotalAppraisal (oDialog, False)
' Updates the text of the best stat appraisal. ' Updates the text of the best stat appraisal.
subUpdateBestStatAppraisal (oDialog, _ subUpdateBestStatAppraisal (oDialog, _
@ -331,7 +331,7 @@ Sub subRdoTeamInstinctItemChanged (oEvent As object)
"Its stats are really strong! Impressive.", _ "Its stats are really strong! Impressive.", _
"It's definitely got some good stats. Definitely!", _ "It's definitely got some good stats. Definitely!", _
"Its stats are all right, but kinda basic, as far as I can see.") "Its stats are all right, but kinda basic, as far as I can see.")
oList = oDialog.getControl ("lstAppraisal2") oList = oDialog.getControl ("lstMax")
oList.removeItems (0, oList.getItemCount()) oList.removeItems (0, oList.getItemCount())
oList.addItems (mItems, 0) oList.addItems (mItems, 0)
oList.setVisible (True) oList.setVisible (True)
@ -472,8 +472,10 @@ Sub subLstBestItemChanged (oEvent As object)
End If End If
End Sub End Sub
' subUpdateAppraisal1: Updates the text of the first appraisal. ' subUpdateTotalAppraisal: Updates the text of the stats total
Sub subUpdateAppraisal1 (oDialog As Object, bIsKeepSelected As Boolean) ' appraisal.
Sub subUpdateTotalAppraisal ( _
oDialog As Object, bIsKeepSelected As Boolean)
Dim sPokemon As String, oList As Object, nSelected As Integer Dim sPokemon As String, oList As Object, nSelected As Integer
Dim mItems () As String, nI As Integer Dim mItems () As String, nI As Integer
@ -511,7 +513,7 @@ Sub subUpdateAppraisal1 (oDialog As Object, bIsKeepSelected As Boolean)
Next nI Next nI
End If End If
oList = oDialog.getControl ("lstAppraisal1") oList = oDialog.getControl ("lstTotal")
If bIsKeepSelected Then If bIsKeepSelected Then
nSelected = oList.getSelectedItemPos nSelected = oList.getSelectedItemPos
End If End If
@ -545,7 +547,7 @@ Function fnFindIV ( _
End If End If
subReadStarDust subReadStarDust
nEvolved = UBound (aBaseStats.mEvolved) nEvolved = UBound (aBaseStats.mEvolved)
ReDim maEvBaseStats (nEvolved) As New aStats ReDim Preserve maEvBaseStats (nEvolved) As New aStats
For nI = 0 To nEvolved For nI = 0 To nEvolved
aTempStats = fnGetBaseStats (aBaseStats.mEvolved (nI)) aTempStats = fnGetBaseStats (aBaseStats.mEvolved (nI))
With maEvBaseStats (nI) With maEvBaseStats (nI)
@ -907,25 +909,21 @@ Function fnFilterAppraisals (aQuery As aFindIVParam, _
nStamina As Integer) As Boolean nStamina As Integer) As Boolean
Dim nTotal As Integer, nMax As Integer, sBest As String Dim nTotal As Integer, nMax As Integer, sBest As String
' The first appraisal. ' The stats total.
nTotal = nAttack + nDefense + nStamina nTotal = nAttack + nDefense + nStamina
If aQuery.nAppraisal1 = 1 _ If aQuery.nTotal = 1 And Not (nTotal >= 37) Then
And Not (nTotal >= 37) Then
fnFilterAppraisals = True fnFilterAppraisals = True
Exit Function Exit Function
End If End If
If aQuery.nAppraisal1 = 2 _ If aQuery.nTotal = 2 And Not (nTotal >= 30 And nTotal <= 36) Then
And Not (nTotal >= 30 And nTotal <= 36) Then
fnFilterAppraisals = True fnFilterAppraisals = True
Exit Function Exit Function
End If End If
If aQuery.nAppraisal1 = 3 _ If aQuery.nTotal = 3 And Not (nTotal >= 23 And nTotal <= 29) Then
And Not (nTotal >= 23 And nTotal <= 29) Then
fnFilterAppraisals = True fnFilterAppraisals = True
Exit Function Exit Function
End If End If
If aQuery.nAppraisal1 = 4 _ If aQuery.nTotal = 4 And Not (nTotal <= 22) Then
And Not (nTotal <= 22) Then
fnFilterAppraisals = True fnFilterAppraisals = True
Exit Function Exit Function
End If End If
@ -953,20 +951,20 @@ Function fnFilterAppraisals (aQuery As aFindIVParam, _
Exit Function Exit Function
End If End If
End If End If
' The second appraisal. ' The max stat value.
If aQuery.nAppraisal2 = 1 And Not (nMax = 15) Then If aQuery.nMax = 1 And Not (nMax = 15) Then
fnFilterAppraisals = True fnFilterAppraisals = True
Exit Function Exit Function
End If End If
If aQuery.nAppraisal2 = 2 And Not (nMax = 13 Or nMax = 14) Then If aQuery.nMax = 2 And Not (nMax = 13 Or nMax = 14) Then
fnFilterAppraisals = True fnFilterAppraisals = True
Exit Function Exit Function
End If End If
If aQuery.nAppraisal2 = 3 And Not (nMax >= 8 And nMax <= 12) Then If aQuery.nMax = 3 And Not (nMax >= 8 And nMax <= 12) Then
fnFilterAppraisals = True fnFilterAppraisals = True
Exit Function Exit Function
End If End If
If aQuery.nAppraisal2 = 4 And Not (nMax <= 7) Then If aQuery.nMax = 4 And Not (nMax <= 7) Then
fnFilterAppraisals = True fnFilterAppraisals = True
Exit Function Exit Function
End If End If

View File

@ -19,23 +19,31 @@
Option Explicit Option Explicit
&apos; The stats of a Pokémon. &apos; The base stats of a Pokémon.
Type aStats Type aStats
sNo As String sNo As String
sPokemon As String sPokemon As String
nStamina As Integer
nAttack As Integer
nDefense As Integer
mEvolved () As String
End Type
&apos; The individual values of a Pokémon.
Type aIV
fLevel As Double fLevel As Double
nStamina As Integer nStamina As Integer
nAttack As Integer nAttack As Integer
nDefense As Integer nDefense As Integer
nTotal As Integer nTotal As Integer
nMaxCP As Integer nMaxCP As Integer
maEvolvedForms () As aEvolveForm maEvolved () As aEvolvedStats
End Type End Type
&apos; The amount of star dust to power-up. &apos; The calculated evolved stats of a Pokémon.
Type aStarDust Type aEvolvedStats
fLevel As Double nCP As Integer
nStarDust As Integer nMaxCP As Integer
End Type End Type
&apos; The parameters to find the individual values. &apos; The parameters to find the individual values.
@ -46,35 +54,30 @@ Type aFindIVParam
nStarDust As Integer nStarDust As Integer
nPlayerLevel As Integer nPlayerLevel As Integer
bIsNew As Boolean bIsNew As Boolean
nAppraisal1 As Integer nTotal As Integer
sBest As String sBest As String
nAppraisal2 As Integer nMax As Integer
bIsCancelled As Boolean bIsCancelled As Boolean
End Type End Type
Type aEvolveForm
sPokemon As String
nCP As Integer
nMaxCP As Integer
End Type
Private maBaseStats () As New aStats Private maBaseStats () As New aStats
Private mCPM () As Double, mStarDust () As Integer Private mCPM () As Double, mStarDust () As Integer
&apos; subMain: The main program &apos; subMain: The main program
Sub subMain Sub subMain
Dim maIVs As Variant, nI As Integer Dim aBaseStats As New aStats, maIVs As Variant, nI As Integer
Dim aQuery As New aFindIVParam, aBaseStats As New aStats Dim aQuery As New aFindIVParam
aQuery = fnAskParam aQuery = fnAskParam
If aQuery.bIsCancelled Then If aQuery.bIsCancelled Then
Exit Sub Exit Sub
End If End If
maIVs = fnFindIV (aQuery) aBaseStats = fnGetBaseStats (aQuery.sPokemon)
maIVs = fnFindIV (aBaseStats, aQuery)
If UBound (maIVs) = -1 Then If UBound (maIVs) = -1 Then
MsgBox fnGetResString (&quot;ErrorNotFound&quot;) MsgBox fnGetResString (&quot;ErrorNotFound&quot;)
Else Else
subSaveIV (aQuery, maIVs) subSaveIV (aBaseStats, aQuery, maIVs)
End If End If
End Sub End Sub
@ -87,18 +90,18 @@ Function fnAskParam As aFindIVParam
DialogLibraries.loadLibrary &quot;PokemonGoIV&quot; DialogLibraries.loadLibrary &quot;PokemonGoIV&quot;
oDialog = CreateUnoDialog (DialogLibraries.PokemonGoIV.DlgMain) oDialog = CreateUnoDialog (DialogLibraries.PokemonGoIV.DlgMain)
oDialog.getControl (&quot;lstAppraisal1&quot;).setVisible (False) oDialog.getControl (&quot;lstTotal&quot;).setVisible (False)
oDialog.getControl (&quot;txtBestBefore&quot;).setVisible (False) oDialog.getControl (&quot;txtBestBefore&quot;).setVisible (False)
oDialog.getControl (&quot;lstBest&quot;).setVisible (False) oDialog.getControl (&quot;lstBest&quot;).setVisible (False)
oDialog.getControl (&quot;txtBestAfter&quot;).setVisible (False) oDialog.getControl (&quot;txtBestAfter&quot;).setVisible (False)
oDialog.getControl (&quot;cbxBest2&quot;).setVisible (False) oDialog.getControl (&quot;cbxBest2&quot;).setVisible (False)
oDialog.getControl (&quot;cbxBest3&quot;).setVisible (False) oDialog.getControl (&quot;cbxBest3&quot;).setVisible (False)
oDialog.getControl (&quot;lstAppraisal2&quot;).setVisible (False) oDialog.getControl (&quot;lstMax&quot;).setVisible (False)
oDialog.getControl (&quot;imgPokemon&quot;).getModel.setPropertyValue ( _ oDialog.getControl (&quot;imgPokemon&quot;).getModel.setPropertyValue ( _
&quot;ImageURL&quot;, fnGetImageUrl (&quot;Unknown&quot;)) &quot;ImageURL&quot;, fnGetImageUrl (&quot;Unknown&quot;))
oDialog.getControl (&quot;imgTeamLogo&quot;).getModel.setPropertyValue ( _ oDialog.getControl (&quot;imgTeamLogo&quot;).getModel.setPropertyValue ( _
&quot;ImageURL&quot;, fnGetImageUrl (&quot;Unknown&quot;)) &quot;ImageURL&quot;, fnGetImageUrl (&quot;Unknown&quot;))
If oDialog.execute = 0 Then If oDialog.execute = 0 Then
aQuery.bIsCancelled = True aQuery.bIsCancelled = True
@ -112,8 +115,8 @@ Function fnAskParam As aFindIVParam
.nHP = oDialog.getControl (&quot;numHP&quot;).getValue .nHP = oDialog.getControl (&quot;numHP&quot;).getValue
.nStarDust = CInt (oDialog.getControl (&quot;lstStarDust&quot;).getSelectedItem) .nStarDust = CInt (oDialog.getControl (&quot;lstStarDust&quot;).getSelectedItem)
.nPlayerLevel = CInt (oDialog.getControl (&quot;lstPlayerLevel&quot;).getSelectedItem) .nPlayerLevel = CInt (oDialog.getControl (&quot;lstPlayerLevel&quot;).getSelectedItem)
.nAppraisal1 = oDialog.getControl (&quot;lstAppraisal1&quot;).getSelectedItemPos + 1 .nTotal = oDialog.getControl (&quot;lstTotal&quot;).getSelectedItemPos + 1
.nAppraisal2 = oDialog.getControl (&quot;lstAppraisal2&quot;).getSelectedItemPos + 1 .nMax = oDialog.getControl (&quot;lstMax&quot;).getSelectedItemPos + 1
.bIsCancelled = False .bIsCancelled = False
End With End With
If oDialog.getControl (&quot;cbxIsNew&quot;).getState = 1 Then If oDialog.getControl (&quot;cbxIsNew&quot;).getState = 1 Then
@ -219,8 +222,8 @@ Sub subLstPokemonSelected (oEvent As object)
oImageModel.setPropertyValue (&quot;ImageURL&quot;, _ oImageModel.setPropertyValue (&quot;ImageURL&quot;, _
fnGetImageUrl (sImageId)) fnGetImageUrl (sImageId))
&apos; Updates the text of the first appraisal. &apos; Updates the text of the stats total appraisal.
subUpdateAppraisal1 (oDialog, True) subUpdateTotalAppraisal (oDialog, True)
&apos; Checks if the required columns are filled. &apos; Checks if the required columns are filled.
subBtnOKCheck (oEvent) subBtnOKCheck (oEvent)
End Sub End Sub
@ -244,8 +247,8 @@ Sub subRdoTeamValorItemChanged (oEvent As object)
oText.setVisible (True) oText.setVisible (True)
oText.setText (fnGetResString (&quot;AppraiseFromCandela&quot;)) oText.setText (fnGetResString (&quot;AppraiseFromCandela&quot;))
&apos; Updates the text of the first appraisal. &apos; Updates the text of the stats total appraisal.
subUpdateAppraisal1 (oDialog, False) subUpdateTotalAppraisal (oDialog, False)
&apos; Updates the text of the best stat appraisal. &apos; Updates the text of the best stat appraisal.
subUpdateBestStatAppraisal (oDialog, _ subUpdateBestStatAppraisal (oDialog, _
@ -256,7 +259,7 @@ Sub subRdoTeamValorItemChanged (oEvent As object)
&quot;It&apos;s got excellent stats! How exciting!&quot;, _ &quot;It&apos;s got excellent stats! How exciting!&quot;, _
&quot;Its stats indicate that in battle, it&apos;ll get the job done.&quot;, _ &quot;Its stats indicate that in battle, it&apos;ll get the job done.&quot;, _
&quot;Its stats don&apos;t point to greatness in battle.&quot;) &quot;Its stats don&apos;t point to greatness in battle.&quot;)
oList = oDialog.getControl (&quot;lstAppraisal2&quot;) oList = oDialog.getControl (&quot;lstMax&quot;)
oList.removeItems (0, oList.getItemCount()) oList.removeItems (0, oList.getItemCount())
oList.addItems (mItems, 0) oList.addItems (mItems, 0)
oList.setVisible (True) oList.setVisible (True)
@ -281,8 +284,8 @@ Sub subRdoTeamMysticItemChanged (oEvent As object)
oText.setVisible (True) oText.setVisible (True)
oText.setText (fnGetResString (&quot;AppraiseFromBlanche&quot;)) oText.setText (fnGetResString (&quot;AppraiseFromBlanche&quot;))
&apos; Updates the text of the first appraisal. &apos; Updates the text of the stats total appraisal.
subUpdateAppraisal1 (oDialog, False) subUpdateTotalAppraisal (oDialog, False)
&apos; Updates the text of the best stat appraisal. &apos; Updates the text of the best stat appraisal.
subUpdateBestStatAppraisal (oDialog, _ subUpdateBestStatAppraisal (oDialog, _
@ -293,7 +296,7 @@ Sub subRdoTeamMysticItemChanged (oEvent As object)
&quot;I am certainly impressed by its stats, I must say.&quot;, _ &quot;I am certainly impressed by its stats, I must say.&quot;, _
&quot;Its stats are noticeably trending to the positive.&quot;, _ &quot;Its stats are noticeably trending to the positive.&quot;, _
&quot;Its stats are not out of the norm, in my opinion.&quot;) &quot;Its stats are not out of the norm, in my opinion.&quot;)
oList = oDialog.getControl (&quot;lstAppraisal2&quot;) oList = oDialog.getControl (&quot;lstMax&quot;)
oList.removeItems (0, oList.getItemCount()) oList.removeItems (0, oList.getItemCount())
oList.addItems (mItems, 0) oList.addItems (mItems, 0)
oList.setVisible (True) oList.setVisible (True)
@ -318,8 +321,8 @@ Sub subRdoTeamInstinctItemChanged (oEvent As object)
oText.setVisible (True) oText.setVisible (True)
oText.setText (fnGetResString (&quot;AppraiseFromSpark&quot;)) oText.setText (fnGetResString (&quot;AppraiseFromSpark&quot;))
&apos; Updates the text of the first appraisal. &apos; Updates the text of the stats total appraisal.
subUpdateAppraisal1 (oDialog, False) subUpdateTotalAppraisal (oDialog, False)
&apos; Updates the text of the best stat appraisal. &apos; Updates the text of the best stat appraisal.
subUpdateBestStatAppraisal (oDialog, _ subUpdateBestStatAppraisal (oDialog, _
@ -330,7 +333,7 @@ Sub subRdoTeamInstinctItemChanged (oEvent As object)
&quot;Its stats are really strong! Impressive.&quot;, _ &quot;Its stats are really strong! Impressive.&quot;, _
&quot;It&apos;s definitely got some good stats. Definitely!&quot;, _ &quot;It&apos;s definitely got some good stats. Definitely!&quot;, _
&quot;Its stats are all right, but kinda basic, as far as I can see.&quot;) &quot;Its stats are all right, but kinda basic, as far as I can see.&quot;)
oList = oDialog.getControl (&quot;lstAppraisal2&quot;) oList = oDialog.getControl (&quot;lstMax&quot;)
oList.removeItems (0, oList.getItemCount()) oList.removeItems (0, oList.getItemCount())
oList.addItems (mItems, 0) oList.addItems (mItems, 0)
oList.setVisible (True) oList.setVisible (True)
@ -471,66 +474,69 @@ Sub subLstBestItemChanged (oEvent As object)
End If End If
End Sub End Sub
&apos; subUpdateAppraisal1: Updates the text of the first appraisal. &apos; subUpdateTotalAppraisal: Updates the text of the stats total
Sub subUpdateAppraisal1 (oDialog As Object, bIsKeepSelected As Boolean) &apos; appraisal.
Sub subUpdateTotalAppraisal ( _
oDialog As Object, bIsKeepSelected As Boolean)
Dim sPokemon As String, oList As Object, nSelected As Integer Dim sPokemon As String, oList As Object, nSelected As Integer
Dim mItems () As String, nI As Integer Dim mItems () As String, nI As Integer
If oDialog.getControl (&quot;rdoTeamValor&quot;).getState Then If oDialog.getControl (&quot;rdoTeamValor&quot;).getState Then
mItems = Array ( _ mItems = Array ( _
&quot;Overall, your [Pokémon] simply amazes me. It can accomplish anything!&quot;, _ &quot;Overall, your [Pokémon] simply amazes me. It can accomplish anything!&quot;, _
&quot;Overall, your [Pokémon] is a strong Pokémon. You should be proud!&quot;, _ &quot;Overall, your [Pokémon] is a strong Pokémon. You should be proud!&quot;, _
&quot;Overall, your [Pokémon] is a decent Pokémon.&quot;, _ &quot;Overall, your [Pokémon] is a decent Pokémon.&quot;, _
&quot;Overall, your [Pokémon] may not be great in battle, but I still like it!&quot;) &quot;Overall, your [Pokémon] may not be great in battle, but I still like it!&quot;)
End If End If
If oDialog.getControl (&quot;rdoTeamMystic&quot;).getState Then If oDialog.getControl (&quot;rdoTeamMystic&quot;).getState Then
mItems = Array ( _ mItems = Array ( _
&quot;Overall, your [Pokémon] is a wonder! What a breathtaking Pokémon!&quot;, _ &quot;Overall, your [Pokémon] is a wonder! What a breathtaking Pokémon!&quot;, _
&quot;Overall, your [Pokémon] has certainly caught my attention.&quot;, _ &quot;Overall, your [Pokémon] has certainly caught my attention.&quot;, _
&quot;Overall, your [Pokémon] is above average.&quot;, _ &quot;Overall, your [Pokémon] is above average.&quot;, _
&quot;Overall, your [Pokémon] is not likely to make much headway in battle.&quot;) &quot;Overall, your [Pokémon] is not likely to make much headway in battle.&quot;)
End If End If
If oDialog.getControl (&quot;rdoTeamInstinct&quot;).getState Then If oDialog.getControl (&quot;rdoTeamInstinct&quot;).getState Then
mItems = Array ( _ mItems = Array ( _
&quot;Overall, your [Pokémon] looks like it can really battle with the best of them!&quot;, _ &quot;Overall, your [Pokémon] looks like it can really battle with the best of them!&quot;, _
&quot;Overall, your [Pokémon] is really strong!&quot;, _ &quot;Overall, your [Pokémon] is really strong!&quot;, _
&quot;Overall, your [Pokémon] is pretty decent!&quot;, _ &quot;Overall, your [Pokémon] is pretty decent!&quot;, _
&quot;Overall, your [Pokémon] has room for improvement as far as battling goes.&quot;) &quot;Overall, your [Pokémon] has room for improvement as far as battling goes.&quot;)
End If End If
&apos; The team was not selected yet. &apos; The team was not selected yet.
If UBound (mItems) = -1 Then If UBound (mItems) = -1 Then
Exit sub Exit sub
End If End If
sPokemon = oDialog.getControl (&quot;lstPokemon&quot;).getSelectedItem sPokemon = oDialog.getControl (&quot;lstPokemon&quot;).getSelectedItem
If sPokemon &lt;&gt; &quot;&quot; Then If sPokemon &lt;&gt; &quot;&quot; Then
For nI = 0 To UBound (mItems) For nI = 0 To UBound (mItems)
mItems (nI) = fnReplace (mItems (nI), _ mItems (nI) = fnReplace (mItems (nI), _
&quot;[Pokémon]&quot;, sPokemon) &quot;[Pokémon]&quot;, sPokemon)
Next nI Next nI
End If End If
oList = oDialog.getControl (&quot;lstAppraisal1&quot;) oList = oDialog.getControl (&quot;lstTotal&quot;)
If bIsKeepSelected Then If bIsKeepSelected Then
nSelected = oList.getSelectedItemPos nSelected = oList.getSelectedItemPos
End If End If
oList.removeItems (0, oList.getItemCount()) oList.removeItems (0, oList.getItemCount())
oList.addItems (mItems, 0) oList.addItems (mItems, 0)
If bIsKeepSelected Then If bIsKeepSelected Then
oList.selectItemPos (nSelected, True) oList.selectItemPos (nSelected, True)
End If End If
oList.setVisible (True) oList.setVisible (True)
End Sub End Sub
&apos; fnFindIV: Finds the possible individual values of the Pokémon &apos; fnFindIV: Finds the possible individual values of the Pokémon
Function fnFindIV (aQuery As aFindIVParam) As Variant Function fnFindIV ( _
Dim aBaseStats As New aStats, maIV () As New aStats aBaseStats As aStats, aQuery As aFindIVParam) As Variant
Dim nEvolved As Integer
Dim maEvBaseStats () As New aStats, aTempStats As New aStats
Dim maIV () As New aIV, aTempIV As New aIV
Dim fLevel As Double, nStamina As Integer Dim fLevel As Double, nStamina As Integer
Dim nAttack As Integer, nDefense As integer Dim nAttack As Integer, nDefense As integer
Dim nI As Integer, nJ As Integer Dim nI As Integer, nJ As Integer
Dim fStep As Double, nCount As Integer Dim fStep As Double, nN As Integer
Dim aEvBaseStats As new aStats, aTempIV As New aStats
Dim maEvolvedForms () As New aEvolveForm
If aQuery.sPokemon = &quot;&quot; Then If aQuery.sPokemon = &quot;&quot; Then
fnFindIV = maIV fnFindIV = maIV
@ -541,9 +547,18 @@ Function fnFindIV (aQuery As aFindIVParam) As Variant
Else Else
fStep = 0.5 fStep = 0.5
End If End If
aBaseStats = fnGetBaseStats (aQuery.sPokemon)
subReadStarDust subReadStarDust
nCount = -1 nEvolved = UBound (aBaseStats.mEvolved)
ReDim Preserve maEvBaseStats (nEvolved) As New aStats
For nI = 0 To nEvolved
aTempStats = fnGetBaseStats (aBaseStats.mEvolved (nI))
With maEvBaseStats (nI)
.nAttack = aTempStats.nAttack
.nDefense = aTempStats.nDefense
.nStamina = aTempStats.nStamina
End With
Next nI
nN = -1
For fLevel = 1 To UBound (mStarDust) Step fStep For fLevel = 1 To UBound (mStarDust) Step fStep
If mStarDust (CInt (fLevel - 0.5)) = aQuery.nStarDust Then If mStarDust (CInt (fLevel - 0.5)) = aQuery.nStarDust Then
For nStamina = 0 To 15 For nStamina = 0 To 15
@ -551,32 +566,33 @@ Function fnFindIV (aQuery As aFindIVParam) As Variant
For nAttack = 0 To 15 For nAttack = 0 To 15
For nDefense = 0 To 15 For nDefense = 0 To 15
If fnCalcCP (aBaseStats, fLevel, nAttack, nDefense, nStamina) = aQuery.nCP _ If fnCalcCP (aBaseStats, fLevel, nAttack, nDefense, nStamina) = aQuery.nCP _
And Not (fnFilterAppraisals (aQuery, nAttack, nDefense, nStamina)) Then And Not fnFilterAppraisals (aQuery, nAttack, nDefense, nStamina) Then
nCount = nCount + 1 nN = nN + 1
ReDim Preserve maIV (nCount) As New aStats ReDim Preserve maIV (nN) As New aIV
With maIV (nCount) With maIV (nN)
.sNo = aBaseStats.sNo
.sPokemon = aQuery.sPokemon
.fLevel = fLevel .fLevel = fLevel
.nAttack = nAttack .nAttack = nAttack
.nDefense = nDefense .nDefense = nDefense
.nStamina = nStamina .nStamina = nStamina
.nTotal = nAttack + nDefense + nStamina .nTotal = nAttack _
+ nDefense + nStamina
End With End With
If aQuery.nPlayerLevel &lt;&gt; 0 Then If aQuery.nPlayerLevel &lt;&gt; 0 Then
maIV (nCount).nMaxCP = fnCalcCP (aBaseStats, aQuery.nPlayerLevel + 1.5, nAttack, nDefense, nStamina) maIV (nN).nMaxCP = fnCalcCP ( _
Else aBaseStats, _
maIV (nCount).nMaxCP = -1 aQuery.nPlayerLevel + 1.5, _
nAttack, nDefense, nStamina)
End If End If
maIV (nCount).maEvolvedForms = fnGetEvolvedFormArray (UBound (aBaseStats.maEvolvedForms)) maIV (nN).maEvolved _
For nI = 0 To UBound (aBaseStats.maEvolvedForms) = fnGetEvolvedArray (nEvolved)
maIV (nCount).maEvolvedForms (nI).sPokemon = aBaseStats.maEvolvedForms (nI).sPokemon For nI = 0 To nEvolved
aEvBaseStats = fnGetBaseStats (aBaseStats.maEvolvedForms (nI).sPokemon) maIV (nN).maEvolved (nI).nCP _
maIV (nCount).maEvolvedForms (nI).nCP = fnCalcCP (aEvBaseStats, fLevel, nAttack, nDefense, nStamina) = fnCalcCP ( _
maEvBaseStats (nI), _
fLevel, nAttack, _
nDefense, nStamina)
If aQuery.nPlayerLevel &lt;&gt; 0 Then If aQuery.nPlayerLevel &lt;&gt; 0 Then
maIV (nCount).maEvolvedForms (nI).nMaxCP = fnCalcCP (aEvBaseStats, aQuery.nPlayerLevel + 1.5, nAttack, nDefense, nStamina) maIV (nN).maEvolved (nI).nMaxCP = fnCalcCP (maEvBaseStats (nI), aQuery.nPlayerLevel + 1.5, nAttack, nDefense, nStamina)
Else
maIV (nCount).maEvolvedForms (nI).nMaxCP = -1
End If End If
Next nI Next nI
End If End If
@ -590,6 +606,9 @@ Function fnFindIV (aQuery As aFindIVParam) As Variant
For nI = 0 To UBound (maIV) - 1 For nI = 0 To UBound (maIV) - 1
For nJ = nI + 1 To UBound (maIV) For nJ = nI + 1 To UBound (maIV)
If fnCompareIV (maIV (nI), maIV (nJ)) &gt; 0 Then If fnCompareIV (maIV (nI), maIV (nJ)) &gt; 0 Then
&apos; This is an array of data. The data are actually
&apos; allocated in sequences. maIV (nI) is not a
&apos; reference. They cannot simply be assigned.
subCopyIV (maIV (nI), aTempIV) subCopyIV (maIV (nI), aTempIV)
subCopyIV (maIV (nJ), maIV (nI)) subCopyIV (maIV (nJ), maIV (nI))
subCopyIV (aTempIV, maIV (nJ)) subCopyIV (aTempIV, maIV (nJ))
@ -600,19 +619,19 @@ Function fnFindIV (aQuery As aFindIVParam) As Variant
End Function End Function
&apos; fnCompareIV: Compare two IVs for sorting &apos; fnCompareIV: Compare two IVs for sorting
Function fnCompareIV (aIVa As aStats, aIVb As aStats) As Double Function fnCompareIV (aIVa As aIV, aIVb As aIV) As Double
Dim nCPa As Integer, nCPb As Integer, nI As Integer Dim nCPa As Integer, nCPb As Integer, nI As Integer
nCPa = aIVa.nMaxCP nCPa = aIVa.nMaxCP
For nI = 0 To UBound (aIVa.maEvolvedForms) For nI = 0 To UBound (aIVa.maEvolved)
If nCPa &lt; aIVa.maEvolvedForms (nI).nMaxCP Then If nCPa &lt; aIVa.maEvolved (nI).nMaxCP Then
nCPa = aIVa.maEvolvedForms (nI).nMaxCP nCPa = aIVa.maEvolved (nI).nMaxCP
End If End If
Next nI Next nI
nCPb = aIVb.nMaxCP nCPb = aIVb.nMaxCP
For nI = 0 To UBound (aIVb.maEvolvedForms) For nI = 0 To UBound (aIVb.maEvolved)
If nCPb &lt; aIVb.maEvolvedForms (nI).nMaxCP Then If nCPb &lt; aIVb.maEvolved (nI).nMaxCP Then
nCPb = aIVb.maEvolvedForms (nI).nMaxCP nCPb = aIVb.maEvolved (nI).nMaxCP
End If End If
Next nI Next nI
fnCompareIV = nCPb - nCPa fnCompareIV = nCPb - nCPa
@ -621,15 +640,15 @@ Function fnCompareIV (aIVa As aStats, aIVb As aStats) As Double
End If End If
nCPa = 0 nCPa = 0
For nI = 0 To UBound (aIVa.maEvolvedForms) For nI = 0 To UBound (aIVa.maEvolved)
If nCPa &lt; aIVa.maEvolvedForms (nI).nCP Then If nCPa &lt; aIVa.maEvolved (nI).nCP Then
nCPa = aIVa.maEvolvedForms (nI).nCP nCPa = aIVa.maEvolved (nI).nCP
End If End If
Next nI Next nI
nCPb = 0 nCPb = 0
For nI = 0 To UBound (aIVb.maEvolvedForms) For nI = 0 To UBound (aIVb.maEvolved)
If nCPb &lt; aIVb.maEvolvedForms (nI).nCP Then If nCPb &lt; aIVb.maEvolved (nI).nCP Then
nCPb = aIVb.maEvolvedForms (nI).nCP nCPb = aIVb.maEvolved (nI).nCP
End If End If
Next nI Next nI
fnCompareIV = nCPb - nCPa fnCompareIV = nCPb - nCPa
@ -660,77 +679,88 @@ Function fnCompareIV (aIVa As aStats, aIVb As aStats) As Double
End Function End Function
&apos; subCopyIV: Copies one IV to another &apos; subCopyIV: Copies one IV to another
Function subCopyIV (aFrom As aStats, aTo As aStats) As Double Function subCopyIV (aFrom As aIV, aTo As aIV) As Double
Dim nI As Integer, maEvolvedForms () As New aEvolveForm Dim nI As Integer
With aTo With aTo
.sNo = aFrom.sNo
.sPokemon = aFrom.sPokemon
.fLevel = aFrom.fLevel
.nAttack = aFrom.nAttack .nAttack = aFrom.nAttack
.nDefense = aFrom.nDefense .nDefense = aFrom.nDefense
.nStamina = aFrom.nStamina .nStamina = aFrom.nStamina
.nTotal = aFrom.nTotal .nTotal = aFrom.nTotal
.nMaxCP = aFrom.nMaxCP .nMaxCP = aFrom.nMaxCP
End With End With
aTo.maEvolvedForms = fnGetEvolvedFormArray (UBound (aFrom.maEvolvedForms)) aTo.maEvolved = fnGetEvolvedArray (UBound (aFrom.maEvolved))
For nI = 0 To UBound (aFrom.maEvolvedForms) For nI = 0 To UBound (aFrom.maEvolved)
With aTo.maEvolvedForms (nI) With aTo.maEvolved (nI)
.sPokemon = aFrom.maEvolvedForms (nI).sPokemon .nCP = aFrom.maEvolved (nI).nCP
.nCP = aFrom.maEvolvedForms (nI).nCP .nMaxCP = aFrom.maEvolved (nI).nMaxCP
.nMaxCP = aFrom.maEvolvedForms (nI).nMaxCP
End With End With
Next nI Next nI
End Function End Function
&apos; subSaveIV: Saves the found IV &apos; subSaveIV: Saves the found IV
Sub subSaveIV (aQuery As aFindIVParam, maIVs () As aStats) Sub subSaveIV ( _
aBaseStats As aStats, aQuery As aFindIVParam, maIVs () As aIV)
Dim oDoc As Object, oSheet As Object Dim oDoc As Object, oSheet As Object
Dim oRange As Object, oColumns As Object, oRows As Object Dim oRange As Object, oColumns As Object, oRows As Object
Dim nI As Integer, nJ As Integer, nFrontCols As Integer Dim nI As Integer, nJ As Integer, nFront As Integer
Dim nEvolved As Integer
Dim mData (Ubound (maIVs) + 1) As Variant, mRow () As Variant Dim mData (Ubound (maIVs) + 1) As Variant, mRow () As Variant
Dim mProps () As New com.sun.star.beans.PropertyValue Dim mProps () As New com.sun.star.beans.PropertyValue
oDoc = StarDesktop.loadComponentFromURL ( _ oDoc = StarDesktop.loadComponentFromURL ( _
&quot;private:factory/scalc&quot;, &quot;_default&quot;, 0, mProps) &quot;private:factory/scalc&quot;, &quot;_default&quot;, 0, mProps)
oSheet = oDoc.getSheets.getByIndex (0) oSheet = oDoc.getSheets.getByIndex (0)
nEvolved = UBound (maIVs (0).maEvolved) + 1
mRow = Array ( _ mRow = Array ( _
&quot;No&quot;, &quot;Pokemon&quot;, &quot;CP&quot;, &quot;HP&quot;, &quot;Star dust&quot;, _ &quot;No&quot;, &quot;Pokemon&quot;, &quot;CP&quot;, &quot;HP&quot;, &quot;Star dust&quot;, _
&quot;Lv&quot;, &quot;Atk&quot;, &quot;Def&quot;, &quot;Sta&quot;, &quot;IV&quot;) &quot;Lv&quot;, &quot;Atk&quot;, &quot;Def&quot;, &quot;Sta&quot;, &quot;IV&quot;)
nFrontCols = UBound (mRow) nFront = UBound (mRow)
If aQuery.sPokemon = &quot;Eevee&quot; Then If aQuery.sPokemon = &quot;Eevee&quot; Then
If aQuery.nPlayerLevel &lt;&gt; 0 Then If aQuery.nPlayerLevel &lt;&gt; 0 Then
ReDim Preserve mRow (nFrontCols + 6) As Variant ReDim Preserve mRow (nFront + 6) As Variant
mRow (nFrontCols + 1) = &quot;CP as &quot; &amp; maIVs (0).maEvolvedForms (0).sPokemon mRow (nFront + 1) = &quot;CP as &quot; _
mRow (nFrontCols + 2) = &quot;Powered-up as &quot; &amp; maIVs (0).maEvolvedForms (0).sPokemon &amp; aBaseStats.mEvolved (0)
mRow (nFrontCols + 3) = &quot;CP as &quot; &amp; maIVs (0).maEvolvedForms (1).sPokemon mRow (nFront + 2) = &quot;Powered-up as &quot; _
mRow (nFrontCols + 4) = &quot;Powered-up as &quot; &amp; maIVs (0).maEvolvedForms (1).sPokemon &amp; aBaseStats.mEvolved (0)
mRow (nFrontCols + 5) = &quot;CP as &quot; &amp; maIVs (0).maEvolvedForms (2).sPokemon mRow (nFront + 3) = &quot;CP as &quot; _
mRow (nFrontCols + 6) = &quot;Powered-up as &quot; &amp; maIVs (0).maEvolvedForms (2).sPokemon &amp; aBaseStats.mEvolved (1)
mRow (nFront + 4) = &quot;Powered-up as &quot; _
&amp; aBaseStats.mEvolved (1)
mRow (nFront + 5) = &quot;CP as &quot; _
&amp; aBaseStats.mEvolved (2)
mRow (nFront + 6) = &quot;Powered-up as &quot; _
&amp; aBaseStats.mEvolved (2)
Else Else
ReDim Preserve mRow (nFrontCols + 3) As Variant ReDim Preserve mRow (nFront + 3) As Variant
mRow (nFrontCols + 1) = &quot;CP as &quot; &amp; maIVs (0).maEvolvedForms (0).sPokemon mRow (nFront + 1) = &quot;CP as &quot; _
mRow (nFrontCols + 2) = &quot;CP as &quot; &amp; maIVs (0).maEvolvedForms (1).sPokemon &amp; aBaseStats.mEvolved (0)
mRow (nFrontCols + 3) = &quot;CP as &quot; &amp; maIVs (0).maEvolvedForms (2).sPokemon mRow (nFront + 2) = &quot;CP as &quot; _
&amp; aBaseStats.mEvolved (1)
mRow (nFront + 3) = &quot;CP as &quot; _
&amp; aBaseStats.mEvolved (2)
End If End If
Else Else
If UBound (maIVs (0).maEvolvedForms) = -1 Then If nEvolved = 0 Then
If aQuery.nPlayerLevel &lt;&gt; 0 Then If aQuery.nPlayerLevel &lt;&gt; 0 Then
ReDim Preserve mRow (nFrontCols + 1) As Variant ReDim Preserve mRow (nFront + 1) As Variant
mRow (nFrontCols + 1) = &quot;Powered-up&quot; mRow (nFront + 1) = &quot;Powered-up&quot;
End If End If
Else Else
If aQuery.nPlayerLevel &lt;&gt; 0 Then If aQuery.nPlayerLevel &lt;&gt; 0 Then
ReDim Preserve mRow (nFrontCols + UBound (maIVs (0).maEvolvedForms) + 2) As Variant ReDim Preserve mRow (nFront + nEvolved + 1) As Variant
For nJ = 0 To UBound (maIVs (0).maEvolvedForms) For nJ = 0 To nEvolved - 1
mRow (nFrontCols + nJ + 1) = &quot;CP as &quot; &amp; maIVs (0).maEvolvedForms (nJ).sPokemon mRow (nFront + nJ + 1) = &quot;CP as &quot; _
&amp; aBaseStats.mEvolved (nJ)
Next nJ Next nJ
mRow (UBound (mRow)) = &quot;Powered-up as &quot; &amp; maIVs (0).maEvolvedForms (UBound (maIVs (0).maEvolvedForms)).sPokemon mRow (UBound (mRow)) = &quot;Powered-up as &quot; _
&amp; aBaseStats.mEvolved (nEvolved - 1)
Else Else
ReDim Preserve mRow (nFrontCols + UBound (maIVs (0).maEvolvedForms) + 1) As Variant ReDim Preserve mRow (nFront + nEvolved) As Variant
For nJ = 0 To UBound (maIVs (0).maEvolvedForms) For nJ = 0 To nEvolved - 1
mRow (nFrontCols + nJ + 1) = &quot;CP as &quot; &amp; maIVs (0).maEvolvedForms (nJ).sPokemon mRow (nFront + nJ + 1) = &quot;CP as &quot; _
&amp; aBaseStats.mEvolved (nJ)
Next nJ Next nJ
End If End If
End If End If
@ -740,40 +770,41 @@ Sub subSaveIV (aQuery As aFindIVParam, maIVs () As aStats)
For nI = 0 To UBound (maIVs) For nI = 0 To UBound (maIVs)
mRow = Array ( _ mRow = Array ( _
&quot;&quot;, &quot;&quot;, &quot;&quot;, &quot;&quot;, &quot;&quot;, _ &quot;&quot;, &quot;&quot;, &quot;&quot;, &quot;&quot;, &quot;&quot;, _
maIVs (nI).fLevel, maIVs (nI).nAttack, maIVs (nI).nDefense, _ maIVs (nI).fLevel, maIVs (nI).nAttack, _
maIVs (nI).nStamina, maIVs (nI).nTotal / 45) maIVs (nI).nDefense, maIVs (nI).nStamina, _
maIVs (nI).nTotal / 45)
If aQuery.sPokemon = &quot;Eevee&quot; Then If aQuery.sPokemon = &quot;Eevee&quot; Then
If aQuery.nPlayerLevel &lt;&gt; 0 Then If aQuery.nPlayerLevel &lt;&gt; 0 Then
ReDim Preserve mRow (nFrontCols + 6) As Variant ReDim Preserve mRow (nFront + 6) As Variant
mRow (nFrontCols + 1) = maIVs (nI).maEvolvedForms (0).nCP mRow (nFront + 1) = maIVs (nI).maEvolved (0).nCP
mRow (nFrontCols + 2) = maIVs (nI).maEvolvedForms (0).nMaxCP mRow (nFront + 2) = maIVs (nI).maEvolved (0).nMaxCP
mRow (nFrontCols + 3) = maIVs (nI).maEvolvedForms (1).nCP mRow (nFront + 3) = maIVs (nI).maEvolved (1).nCP
mRow (nFrontCols + 4) = maIVs (nI).maEvolvedForms (1).nMaxCP mRow (nFront + 4) = maIVs (nI).maEvolved (1).nMaxCP
mRow (nFrontCols + 5) = maIVs (nI).maEvolvedForms (2).nCP mRow (nFront + 5) = maIVs (nI).maEvolved (2).nCP
mRow (nFrontCols + 6) = maIVs (nI).maEvolvedForms (2).nMaxCP mRow (nFront + 6) = maIVs (nI).maEvolved (2).nMaxCP
Else Else
ReDim Preserve mRow (nFrontCols + 3) As Variant ReDim Preserve mRow (nFront + 3) As Variant
mRow (nFrontCols + 1) = maIVs (nI).maEvolvedForms (0).nCP mRow (nFront + 1) = maIVs (nI).maEvolved (0).nCP
mRow (nFrontCols + 2) = maIVs (nI).maEvolvedForms (1).nCP mRow (nFront + 2) = maIVs (nI).maEvolved (1).nCP
mRow (nFrontCols + 3) = maIVs (nI).maEvolvedForms (2).nCP mRow (nFront + 3) = maIVs (nI).maEvolved (2).nCP
End If End If
Else Else
If UBound (maIVs (nI).maEvolvedForms) = -1 Then If nEvolved = 0 Then
If aQuery.nPlayerLevel &lt;&gt; 0 Then If aQuery.nPlayerLevel &lt;&gt; 0 Then
ReDim Preserve mRow (nFrontCols + 1) As Variant ReDim Preserve mRow (nFront + 1) As Variant
mRow (nFrontCols + 1) = maIVs (nI).nMaxCP mRow (nFront + 1) = maIVs (nI).nMaxCP
End If End If
Else Else
If aQuery.nPlayerLevel &lt;&gt; 0 Then If aQuery.nPlayerLevel &lt;&gt; 0 Then
ReDim Preserve mRow (nFrontCols + UBound (maIVs (nI).maEvolvedForms) + 2) As Variant ReDim Preserve mRow (nFront + nEvolved + 1) As Variant
For nJ = 0 To UBound (maIVs (nI).maEvolvedForms) For nJ = 0 To nEvolved - 1
mRow (nFrontCols + nJ + 1) = maIVs (nI).maEvolvedForms (nJ).nCP mRow (nFront + nJ + 1) = maIVs (nI).maEvolved (nJ).nCP
Next nJ Next nJ
mRow (UBound (mRow)) = maIVs (nI).maEvolvedForms (UBound (maIVs (nI).maEvolvedForms)).nMaxCP mRow (UBound (mRow)) = maIVs (nI).maEvolved (nEvolved - 1).nMaxCP
Else Else
ReDim Preserve mRow (nFrontCols + UBound (maIVs (nI).maEvolvedForms) + 1) As Variant ReDim Preserve mRow (nFront + nEvolved) As Variant
For nJ = 0 To UBound (maIVs (nI).maEvolvedForms) For nJ = 0 To nEvolved - 1
mRow (nFrontCols + nJ + 1) = maIVs (nI).maEvolvedForms (nJ).nCP mRow (nFront + nJ + 1) = maIVs (nI).maEvolved (nJ).nCP
Next nJ Next nJ
End If End If
End If End If
@ -782,7 +813,7 @@ Sub subSaveIV (aQuery As aFindIVParam, maIVs () As aStats)
Next nI Next nI
&apos; Fills the query information at the first row &apos; Fills the query information at the first row
mData (1) (0) = maIVs (0).sNo mData (1) (0) = aBaseStats.sNo
mData (1) (1) = aQuery.sPokemon mData (1) (1) = aQuery.sPokemon
mData (1) (2) = aQuery.nCP mData (1) (2) = aQuery.nCP
mData (1) (3) = aQuery.nHP mData (1) (3) = aQuery.nHP
@ -817,12 +848,12 @@ Sub subSaveIV (aQuery As aFindIVParam, maIVs () As aStats)
oRange = oSheet.getCellRangeByPosition ( _ oRange = oSheet.getCellRangeByPosition ( _
10, 0, 15, 0) 10, 0, 15, 0)
Else Else
If UBound (maIVs (0).maEvolvedForms) = -1 Then If nEvolved = 0 Then
oRange = oSheet.getCellRangeByPosition ( _ oRange = oSheet.getCellRangeByPosition ( _
10, 0, 10, 0) 10, 0, 10, 0)
Else Else
oRange = oSheet.getCellRangeByPosition ( _ oRange = oSheet.getCellRangeByPosition ( _
10, 0, 10 + UBound (maIVs (0).maEvolvedForms) + 2, 0) 10, 0, 10 + nEvolved + 1, 0)
End If End If
End If End If
oRange.setPropertyValue (&quot;IsTextWrapped&quot;, True) oRange.setPropertyValue (&quot;IsTextWrapped&quot;, True)
@ -843,49 +874,58 @@ Sub subSaveIV (aQuery As aFindIVParam, maIVs () As aStats)
If aQuery.sPokemon = &quot;Eevee&quot; Then If aQuery.sPokemon = &quot;Eevee&quot; Then
If aQuery.nPlayerLevel &lt;&gt; 0 Then If aQuery.nPlayerLevel &lt;&gt; 0 Then
For nI = 0 To 5 Step 2 For nI = 0 To 5 Step 2
oColumns.getByIndex (10 + nI).setPropertyValue (&quot;Width&quot;, 2310) oColumns.getByIndex (10 + nI).setPropertyValue ( _
oColumns.getByIndex (10 + nI + 1).setPropertyValue (&quot;Width&quot;, 2810) &quot;Width&quot;, 2310)
oColumns.getByIndex (10 + nI + 1).setPropertyValue ( _
&quot;Width&quot;, 2810)
Next nI Next nI
Else Else
For nI = 0 To 2 For nI = 0 To 2
oColumns.getByIndex (10 + nI).setPropertyValue (&quot;Width&quot;, 2310) oColumns.getByIndex (10 + nI).setPropertyValue ( _
&quot;Width&quot;, 2310)
Next nI Next nI
End If End If
Else Else
If UBound (maIVs (0).maEvolvedForms) = -1 Then If nEvolved = 0 Then
If aQuery.nPlayerLevel &lt;&gt; 0 Then If aQuery.nPlayerLevel &lt;&gt; 0 Then
oColumns.getByIndex (10).setPropertyValue (&quot;Width&quot;, 2200) oColumns.getByIndex (10).setPropertyValue ( _
&quot;Width&quot;, 2200)
End If End If
Else Else
For nI = 0 To UBound (maIVs (0).maEvolvedForms) For nI = 0 To nEvolved - 1
oColumns.getByIndex (10 + nI).setPropertyValue (&quot;Width&quot;, 2310) oColumns.getByIndex (10 + nI).setPropertyValue ( _
&quot;Width&quot;, 2310)
Next nI Next nI
If aQuery.nPlayerLevel &lt;&gt; 0 Then If aQuery.nPlayerLevel &lt;&gt; 0 Then
oColumns.getByIndex (10 + UBound (maIVs (0).maEvolvedForms) + 1).setPropertyValue (&quot;Width&quot;, 2810) oColumns.getByIndex ( _
10 + nEvolved).setPropertyValue ( _
&quot;Width&quot;, 2810)
End If End If
End If End If
End If End If
End Sub End Sub
&apos; fnFilterAppraisals: Filters the IV by the appraisals. &apos; fnFilterAppraisals: Filters the IV by the appraisals.
Function fnFilterAppraisals (aQuery As aFindIVParam, nAttack As Integer, nDefense As Integer, nStamina As Integer) As Boolean Function fnFilterAppraisals (aQuery As aFindIVParam, _
nAttack As Integer, nDefense As Integer, _
nStamina As Integer) As Boolean
Dim nTotal As Integer, nMax As Integer, sBest As String Dim nTotal As Integer, nMax As Integer, sBest As String
&apos; The first appraisal. &apos; The stats total.
nTotal = nAttack + nDefense + nStamina nTotal = nAttack + nDefense + nStamina
If aQuery.nAppraisal1 = 1 And Not (nTotal &gt;= 37) Then If aQuery.nTotal = 1 And Not (nTotal &gt;= 37) Then
fnFilterAppraisals = True fnFilterAppraisals = True
Exit Function Exit Function
End If End If
If aQuery.nAppraisal1 = 2 And Not (nTotal &gt;= 30 And nTotal &lt;= 36) Then If aQuery.nTotal = 2 And Not (nTotal &gt;= 30 And nTotal &lt;= 36) Then
fnFilterAppraisals = True fnFilterAppraisals = True
Exit Function Exit Function
End If End If
If aQuery.nAppraisal1 = 3 And Not (nTotal &gt;= 23 And nTotal &lt;= 29) Then If aQuery.nTotal = 3 And Not (nTotal &gt;= 23 And nTotal &lt;= 29) Then
fnFilterAppraisals = True fnFilterAppraisals = True
Exit Function Exit Function
End If End If
If aQuery.nAppraisal1 = 4 And Not (nTotal &lt;= 22) Then If aQuery.nTotal = 4 And Not (nTotal &lt;= 22) Then
fnFilterAppraisals = True fnFilterAppraisals = True
Exit Function Exit Function
End If End If
@ -913,20 +953,20 @@ Function fnFilterAppraisals (aQuery As aFindIVParam, nAttack As Integer, nDefens
Exit Function Exit Function
End If End If
End If End If
&apos; The second appraisal. &apos; The max stat value.
If aQuery.nAppraisal2 = 1 And Not (nMax = 15) Then If aQuery.nMax = 1 And Not (nMax = 15) Then
fnFilterAppraisals = True fnFilterAppraisals = True
Exit Function Exit Function
End If End If
If aQuery.nAppraisal2 = 2 And Not (nMax = 13 Or nMax = 14) Then If aQuery.nMax = 2 And Not (nMax = 13 Or nMax = 14) Then
fnFilterAppraisals = True fnFilterAppraisals = True
Exit Function Exit Function
End If End If
If aQuery.nAppraisal2 = 3 And Not (nMax &gt;= 8 And nMax &lt;= 12) Then If aQuery.nMax = 3 And Not (nMax &gt;= 8 And nMax &lt;= 12) Then
fnFilterAppraisals = True fnFilterAppraisals = True
Exit Function Exit Function
End If End If
If aQuery.nAppraisal2 = 4 And Not (nMax &lt;= 7) Then If aQuery.nMax = 4 And Not (nMax &lt;= 7) Then
fnFilterAppraisals = True fnFilterAppraisals = True
Exit Function Exit Function
End If End If
@ -934,21 +974,24 @@ Function fnFilterAppraisals (aQuery As aFindIVParam, nAttack As Integer, nDefens
End Function End Function
&apos; fnCalcCP: Calculates the combat power of the Pokémon &apos; fnCalcCP: Calculates the combat power of the Pokémon
Function fnCalcCP (aBaseStats As aStats, fLevel As Double, nAttack As Integer, nDefense As Integer, nStamina As Integer) As Integer Function fnCalcCP (aBaseStats As aStats, fLevel As Double, _
Dim nCP As Integer nAttack As Integer, nDefense As Integer, _
nStamina As Integer) As Integer
Dim nCP As Integer
nCP = fnFloor ((aBaseStats.nAttack + nAttack) _ nCP = fnFloor ((aBaseStats.nAttack + nAttack) _
* ((aBaseStats.nDefense + nDefense) ^ 0.5) _ * ((aBaseStats.nDefense + nDefense) ^ 0.5) _
* ((aBaseStats.nStamina + nStamina) ^ 0.5) _ * ((aBaseStats.nStamina + nStamina) ^ 0.5) _
* (fnGetCPM (fLevel) ^ 2) / 10) * (fnGetCPM (fLevel) ^ 2) / 10)
If nCP &lt; 10 Then If nCP &lt; 10 Then
nCP = 10 nCP = 10
End If End If
fnCalcCP = nCP fnCalcCP = nCP
End Function End Function
&apos; fnCalcHP: Calculates the hit points of the Pokémon &apos; fnCalcHP: Calculates the hit points of the Pokémon
Function fnCalcHP (aBaseStats As aStats, fLevel As Double, nStamina As Integer) As Integer Function fnCalcHP (aBaseStats As aStats, _
fLevel As Double, nStamina As Integer) As Integer
Dim nHP As Integer Dim nHP As Integer
nHP = fnFloor ((aBaseStats.nStamina + nStamina) _ nHP = fnFloor ((aBaseStats.nStamina + nStamina) _
@ -993,6 +1036,7 @@ End Function
&apos; subReadBaseStats: Reads the base stats table. &apos; subReadBaseStats: Reads the base stats table.
Sub subReadBaseStats Sub subReadBaseStats
Dim mData As Variant, nI As Integer, nJ As Integer Dim mData As Variant, nI As Integer, nJ As Integer
DIm nEvolved As Integer
If UBound (maBaseStats) = -1 Then If UBound (maBaseStats) = -1 Then
mData = fnGetBaseStatsData mData = fnGetBaseStatsData
@ -1005,52 +1049,47 @@ Sub subReadBaseStats
.nAttack = mData (nI) (3) .nAttack = mData (nI) (3)
.nDefense = mData (nI) (4) .nDefense = mData (nI) (4)
End With End With
maBaseStats (nI).maEvolvedForms = fnGetEvolvedFormArray (UBound (mData (nI) (5))) nEvolved = UBound (mData (nI) (5))
For nJ = 0 To UBound (maBaseStats (nI).maEvolvedForms) maBaseStats (nI).mEvolved = fnGetStringArray (nEvolved)
With maBaseStats (nI).maEvolvedForms (nJ) For nJ = 0 To nEvolved
.sPokemon = mData (nI) (5) (nJ) maBaseStats (nI).mEvolved (nJ) = mData (nI) (5) (nJ)
.nCP = -1
.nMaxCP = -1
End With
Next nJ Next nJ
Next nI Next nI
End If End If
End Sub End Sub
&apos; fnGetEvolvedFormArray: Obtains a blank aEvolveForm array &apos; fnGetStringArray: Obtains a blank string array
Function fnGetEvolvedFormArray (nUBound As Integer) As Variant Function fnGetStringArray (nUBound As Integer) As Variant
If nUBound = -1 Then Dim mData () As String
fnGetEvolvedFormArray = fnGetEmptyEvolvedFormArray
Else If nUBound &gt;= 0 Then
fnGetEvolvedFormArray = fnGetNumberedEvolvedFormArray (nUBound) ReDim Preserve mData (nUBound) As String
End If End If
fnGetStringArray = mData
End Function End Function
&apos; fnGetNumberedEvolvedFormArray: Obtains a numbered aEvolveForm array &apos; fnGetEvolvedArray: Obtains a blank aEvolvedStats array
Function fnGetNumberedEvolvedFormArray (nUBound As Integer) As Variant Function fnGetEvolvedArray (nUBound As Integer) As Variant
Dim mData (nUBound) As New aEvolveForm Dim mData () As New aEvolvedStats
fnGetNumberedEvolvedFormArray = mData If nUBound &gt;= 0 Then
End Function ReDim Preserve mData (nUBound) As New aEvolvedStats
End If
&apos; fnGetEmptyEvolvedFormArray: Obtains an empty aEvolveForm array fnGetEvolvedArray = mData
Function fnGetEmptyEvolvedFormArray () As Variant
Dim mData () As New aEvolveForm
fnGetEmptyEvolvedFormArray = mData
End Function End Function
&apos; fnReplace: Replaces all occurrances of a term to another. &apos; fnReplace: Replaces all occurrances of a term to another.
Function fnReplace (sText As String, sFrom As String, sTo As String) As String Function fnReplace ( _
Dim nPos As Integer sText As String, sFrom As String, sTo As String) As String
Dim nPos As Integer
nPos = InStr (sText, sFrom)
Do While nPos &lt;&gt; 0 nPos = InStr (sText, sFrom)
sText = Left (sText, nPos - 1) &amp; sTo _ Do While nPos &lt;&gt; 0
&amp; Right (sText, Len (sText) - nPos - Len (sFrom) + 1) sText = Left (sText, nPos - 1) &amp; sTo _
nPos = InStr (nPos + Len (sTo), sText, sFrom) &amp; Right (sText, Len (sText) - nPos - Len (sFrom) + 1)
Loop nPos = InStr (nPos + Len (sTo), sText, sFrom)
fnReplace = sText Loop
fnReplace = sText
End Function End Function
&apos; subReadCPM: Reads the CPM table. &apos; subReadCPM: Reads the CPM table.

View File

@ -9,46 +9,22 @@ Const BASE_KEY As String = &quot;/org.openoffice.Office.Addons.PokemonGoIV.Addon
&apos; fnGetImageUrl: Returns the image URL for the UNO image controls. &apos; fnGetImageUrl: Returns the image URL for the UNO image controls.
Function fnGetImageUrl (sName As String) As String Function fnGetImageUrl (sName As String) As String
BasicLibraries.loadLibrary &quot;Tools&quot;
Dim oRegKey As Object Dim oRegKey As Object
oRegKey = fnGetRegistryKeyContent (BASE_KEY &amp; &quot;FileResources/&quot; &amp; sName) oRegKey = GetRegistryKeyContent (BASE_KEY &amp; &quot;FileResources/&quot; &amp; sName)
fnGetImageUrl = fnExpandMacroFieldExpression (oRegKey.Url) fnGetImageUrl = fnExpandMacroFieldExpression (oRegKey.Url)
End Function End Function
&apos; fnGetResString: Returns the localized text string. &apos; fnGetResString: Returns the localized text string.
Function fnGetResString (sID As String) As String Function fnGetResString (sID As String) As String
BasicLibraries.loadLibrary &quot;Tools&quot;
Dim oRegKey As Object Dim oRegKey As Object
oRegKey = fnGetRegistryKeyContent (BASE_KEY &amp; &quot;Messages/&quot; &amp; sID) oRegKey = GetRegistryKeyContent (BASE_KEY &amp; &quot;Messages/&quot; &amp; sID)
fnGetResString = oRegKey.Text fnGetResString = oRegKey.Text
End Function End Function
&apos; fnGetRegistryKeyContent: Returns the registry key content
Function fnGetRegistryKeyContent (sKeyName as string, Optional bforUpdate as Boolean)
Dim oConfigProvider As Object
Dim aNodePath (0) As New com.sun.star.beans.PropertyValue
oConfigProvider = createUnoService ( _
&quot;com.sun.star.configuration.ConfigurationProvider&quot;)
aNodePath(0).Name = &quot;nodepath&quot;
aNodePath(0).Value = sKeyName
If IsMissing (bForUpdate) Then
fnGetRegistryKeyContent = oConfigProvider.createInstanceWithArguments ( _
&quot;com.sun.star.configuration.ConfigurationAccess&quot;, _
aNodePath())
Else
If bForUpdate Then
fnGetRegistryKeyContent = oConfigProvider.createInstanceWithArguments ( _
&quot;com.sun.star.configuration.ConfigurationUpdateAccess&quot;, _
aNodePath())
Else
fnGetRegistryKeyContent = oConfigProvider.createInstanceWithArguments ( _
&quot;com.sun.star.configuration.ConfigurationAccess&quot;, _
aNodePath())
End If
End If
End Function
&apos; fnExpandMacroFieldExpression &apos; fnExpandMacroFieldExpression
Function fnExpandMacroFieldExpression (sURL As String) As String Function fnExpandMacroFieldExpression (sURL As String) As String
Dim sTemp As String Dim sTemp As String

View File

@ -264,7 +264,7 @@
</dlg:radiogroup> </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"/> <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"/>
<dlg:text dlg:id="txtLeaderAppraise" dlg:tab-index="27" dlg:left="45" dlg:top="116" dlg:width="180" dlg:height="8"/> <dlg:text dlg:id="txtLeaderAppraise" dlg:tab-index="27" dlg:left="45" dlg:top="116" dlg:width="180" dlg:height="8"/>
<dlg:menulist dlg:id="lstAppraisal1" dlg:tab-index="9" dlg:left="45" dlg:top="129" dlg:width="180" dlg:height="12" dlg:spin="true"/> <dlg:menulist dlg:id="lstTotal" dlg:tab-index="9" dlg:left="45" dlg:top="129" dlg:width="180" dlg:height="12" dlg:spin="true"/>
<dlg:text dlg:id="txtBestBefore" dlg:tab-index="23" dlg:left="45" dlg:top="146" dlg:width="20" dlg:height="8"/> <dlg:text dlg:id="txtBestBefore" 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="45" dlg:height="12" dlg:spin="true"> <dlg:menulist dlg:id="lstBest" dlg:tab-index="10" dlg:left="65" dlg:top="144" dlg:width="45" 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.0Main.subLstBestItemChanged?language=Basic&amp;location=application" script:language="Script"/>
@ -272,8 +272,8 @@
<dlg:text dlg:id="txtBestAfter" dlg:tab-index="24" dlg:left="110" dlg:top="146" dlg:width="100" dlg:height="8"/> <dlg:text dlg:id="txtBestAfter" 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="180" dlg:height="8" dlg:checked="false"/> <dlg:checkbox dlg:id="cbxBest2" dlg:tab-index="11" dlg:left="45" dlg:top="161" dlg:width="180" dlg:height="8" dlg:checked="false"/>
<dlg:checkbox dlg:id="cbxBest3" dlg:tab-index="12" dlg:left="45" dlg:top="176" dlg:width="180" dlg:height="8" dlg:checked="false"/> <dlg:checkbox dlg:id="cbxBest3" dlg:tab-index="12" dlg:left="45" dlg:top="176" dlg:width="180" dlg:height="8" dlg:checked="false"/>
<dlg:menulist dlg:id="lstAppraisal2" dlg:tab-index="13" dlg:left="45" dlg:top="189" dlg:width="180" dlg:height="12" dlg:spin="true"/> <dlg:menulist dlg:id="lstMax" dlg:tab-index="13" dlg:left="45" dlg:top="189" dlg:width="180" dlg:height="12" dlg:spin="true"/>
<dlg:button dlg:id="btnOK" dlg:tab-index="14" dlg:disabled="true" dlg:left="40" dlg:top="215" dlg:width="60" dlg:height="15" dlg:default="true" dlg:button-type="ok"/> <dlg:button dlg:id="btnOK" dlg:tab-index="14" dlg:disabled="true" dlg:left="40" dlg:top="215" dlg:width="60" dlg:height="15" dlg:default="true" dlg:button-type="ok"/>
<dlg:button dlg:id="btnCancel" dlg:tab-index="15" dlg:left="135" dlg:top="215" dlg:width="60" dlg:height="15" dlg:button-type="cancel"/> <dlg:button dlg:id="btnCancel" dlg:tab-index="15" dlg:left="135" dlg:top="215" dlg:width="60" dlg:height="15" dlg:button-type="cancel"/>
</dlg:bulletinboard> </dlg:bulletinboard>
</dlg:window> </dlg:window>