jdhalfrack
Posts: 293
Joined: 10/22/2007 From: Springfield, IL Status: offline
|
The following is the current function I use for the DB Editor (which, believe it or not, I DO still work on when time permits).
Public Function Get_Overall_Rating(ByVal Index As Integer, _
Optional ByVal MinRating As Long = 0, _
Optional ByVal MaxRating As Long = 99) As Long
Dim PositionID As Integer = CInt(Players_Array(Index).PositionID)
Dim PRDH As Decimal = Overall_Ratings_Array(PositionID).PRDH
Dim PRDL As Decimal = Overall_Ratings_Array(PositionID).PRDL
Dim WTSP As Decimal = Overall_Ratings_Array(PositionID).WTSP
Dim WTST As Decimal = Overall_Ratings_Array(PositionID).WTST
Dim WTBL As Decimal = Overall_Ratings_Array(PositionID).WTBL
Dim HTCT As Decimal = Overall_Ratings_Array(PositionID).HTCT
Dim SPDW As Decimal = Overall_Ratings_Array(PositionID).SPDW
Dim STRW As Decimal = Overall_Ratings_Array(PositionID).STRW
Dim AGLW As Decimal = Overall_Ratings_Array(PositionID).AGLW
Dim INTW As Decimal = Overall_Ratings_Array(PositionID).INTW
Dim ENDW As Decimal = Overall_Ratings_Array(PositionID).ENDW
Dim DISW As Decimal = Overall_Ratings_Array(PositionID).DISW
Dim BLKW As Decimal = Overall_Ratings_Array(PositionID).BLKW
Dim BLAW As Decimal = Overall_Ratings_Array(PositionID).BLAW
Dim PSSW As Decimal = Overall_Ratings_Array(PositionID).PSSW
Dim PSAW As Decimal = Overall_Ratings_Array(PositionID).PSAW
Dim PPRW As Decimal = Overall_Ratings_Array(PositionID).PPRW
Dim CATW As Decimal = Overall_Ratings_Array(PositionID).CATW
Dim HNDW As Decimal = Overall_Ratings_Array(PositionID).HNDW
Dim COVW As Decimal = Overall_Ratings_Array(PositionID).COVW
Dim KSTW As Decimal = Overall_Ratings_Array(PositionID).KSTW
Dim KACW As Decimal = Overall_Ratings_Array(PositionID).KACW
Dim HEIGHT As Long = Players_Array(Index).Height
Dim WEIGHT As Long = Players_Array(Index).Weight
Dim SPED As Long = Players_Array(Index).R1
Dim STRN As Long = Players_Array(Index).R2
Dim AGIL As Long = Players_Array(Index).R3
Dim INTL As Long = Players_Array(Index).R4
Dim ENDR As Long = Players_Array(Index).R5
Dim DISC As Long = Players_Array(Index).R6
Dim BLKN As Long = Players_Array(Index).R7
Dim BLAV As Long = Players_Array(Index).R8
Dim PSST As Long = Players_Array(Index).R9
Dim PSAC As Long = Players_Array(Index).R10
Dim PPSR As Long = Players_Array(Index).R11
Dim CATH As Long = Players_Array(Index).R12
Dim HNDS As Long = Players_Array(Index).R13
Dim COVG As Long = Players_Array(Index).R14
Dim KSTR As Long = Players_Array(Index).R15
Dim KACC As Long = Players_Array(Index).R16
Dim R17 As Long = Players_Array(Index).R17
Dim R18 As Long = Players_Array(Index).R18
Dim R19 As Long = Players_Array(Index).R19
Dim R20 As Long = Players_Array(Index).R20
Get_Overall_Rating = 0
Dim Overall_Rating_Dec As Decimal
Dim Ratio As Decimal
Dim StartValue As Decimal
Dim TotalWeight As Decimal
If PRDH - PRDL <= 0 Then
Ratio = 99
Else
Ratio = 99 / (PRDH - PRDL)
End If
StartValue = -1 * (Ratio * PRDL)
TotalWeight = SPDW + STRW + AGLW + INTW + ENDW + DISW + BLKW + BLAW + PSSW + PSAW + PPRW + CATW + HNDW + COVW + KSTW + KACW
Overall_Rating_Dec = StartValue + _
(SPED + ((WTSP - WEIGHT) / 9)) * ((Ratio * SPDW) / TotalWeight) + _
(STRN - ((WTST - WEIGHT) / 9)) * ((Ratio * STRW) / TotalWeight) + _
(AGIL * ((Ratio * AGLW) / TotalWeight)) + _
(INTL * ((Ratio * INTW) / TotalWeight)) + _
(ENDR * ((Ratio * ENDW) / TotalWeight)) + _
(DISC * ((Ratio * DISW) / TotalWeight)) + _
(BLKN - ((WTBL - WEIGHT) / 9)) * ((Ratio * BLKW) / TotalWeight) + _
(BLAV * ((Ratio * BLAW) / TotalWeight)) + _
(PSST * ((Ratio * PSSW) / TotalWeight)) + _
(PSAC * ((Ratio * PSAW) / TotalWeight)) + _
(PPSR * ((Ratio * PPRW) / TotalWeight)) + _
(CATH - (HTCT - HEIGHT)) * ((Ratio * CATW) / TotalWeight) + _
(HNDS * ((Ratio * HNDW) / TotalWeight)) + _
(COVG * ((Ratio * COVW) / TotalWeight)) + _
(KSTR * ((Ratio * KSTW) / TotalWeight)) + _
(KACC * ((Ratio * KACW) / TotalWeight))
Get_Overall_Rating = CLng(Math.Round(Overall_Rating_Dec, 0, MidpointRounding.AwayFromZero))
If Get_Overall_Rating < MinRating Then Get_Overall_Rating = MinRating
If Get_Overall_Rating > MaxRating Then Get_Overall_Rating = MaxRating
End Function
It's a very weird formula based loosely on the way Madden formulates the overall player ratings. I think, but I am not certain, that users can change the weightings of each skill by editing the "OVERALL_Ratings" table in the MaxFBDatabaseEditorIniFile.mdb file that I release with the editors. Make a back up before you do, though, just in case you mess something up! If you need more help deciphering my code, let me know. JD
_____________________________
|