style(event): move calcdiversity in exp
This commit is contained in:
parent
6b6c775ab3
commit
5af6bd672c
2 changed files with 12 additions and 12 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue