|
|
|
@ -39,7 +39,20 @@ func GetTrust(s *discordgo.Session, discordID string) (float64, error) {
|
|
|
|
|
for _, v := range votes {
|
|
|
|
|
total += float64(v)
|
|
|
|
|
}
|
|
|
|
|
return total / float64(len(votes)), nil
|
|
|
|
|
voteResult := total / float64(len(votes))
|
|
|
|
|
|
|
|
|
|
activeLevel, err := db.GetActiveLevel(discordID)
|
|
|
|
|
if err != nil && err != db.ErrNotFound {
|
|
|
|
|
//ErrNotFound is allowed. It just means the player hasn't played yet.
|
|
|
|
|
return 0.0, err
|
|
|
|
|
}
|
|
|
|
|
totalLevel, err := db.GetTotalActiveLevel()
|
|
|
|
|
if err != nil {
|
|
|
|
|
return 0.0, err
|
|
|
|
|
}
|
|
|
|
|
activeBuff := float64(activeLevel) / float64(totalLevel)
|
|
|
|
|
|
|
|
|
|
return voteResult * (1 + activeBuff), nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func GetTotalTrust(s *discordgo.Session) (float64, error) {
|
|
|
|
|