style(event): move calcdiversity in exp

This commit is contained in:
Anhgelus Morhtuuzh 2025-05-13 13:19:59 +02:00
parent 6b6c775ab3
commit 5af6bd672c
Signed by: anhgelus
GPG key ID: CAD341EFA92DDDE5
2 changed files with 12 additions and 12 deletions

View file

@ -3,6 +3,7 @@ package exp
import (
"github.com/anhgelus/gokord"
"math"
"slices"
)
func MessageXP(length uint, diversity uint) uint {
@ -11,6 +12,16 @@ func MessageXP(length uint, diversity uint) uint {
))
}
func CalcDiversity(msg string) uint {
var chars []rune
for _, c := range []rune(msg) {
if !slices.Contains(chars, c) {
chars = append(chars, c)
}
}
return uint(len(chars))
}
func VocalXP(time uint) uint {
return uint(math.Floor(
0.01*math.Pow(float64(time), 1.3) + 1,