feat(xp): functions
This commit is contained in:
parent
55b25ef62d
commit
1f68e69899
2 changed files with 36 additions and 3 deletions
|
@ -11,12 +11,12 @@ Bot for the private server Discord "Les Copaings"
|
|||
### XP
|
||||
|
||||
Functions:
|
||||
- $xp-message(x;y) = 0.025 x^{1.25}y^{0.5}+1$ where $x$ is the length of the message and $y$ is the diversity of the
|
||||
- $xp-message(x;y) = 0.025 x^{1.25}\sqrt{y}+1$ where $x$ is the length of the message and $y$ is the diversity of the
|
||||
message (number of different rune)
|
||||
- $xp-vocal(x)=0.01 x^{1.3}+1$ where $x$ is the time spent in vocal (in second)
|
||||
- $level(x)=0.2 x^{0.5}$ where $x$ is the xp
|
||||
- $level(x)=0.2 \sqrt{x}$ where $x$ is the xp
|
||||
- $level^{-1}(x)=(5x)^2$ where $x$ is the level
|
||||
- $lose(x,y)= x^2\cdot 10^{-2+\ln(x/85)}\cdot\lfloor y/100 \rfloor$ where $x$ is the inactivity time (hour) and $y$ is the xp
|
||||
- $lose(x,y)= x^2\cdot 10^{-2+\ln(x/85)}\cdot\lfloor y/500 \rfloor$ where $x$ is the inactivity time (hour) and $y$ is the xp
|
||||
|
||||
## Technologies
|
||||
|
||||
|
|
33
xp/functions.go
Normal file
33
xp/functions.go
Normal file
|
@ -0,0 +1,33 @@
|
|||
package xp
|
||||
|
||||
import "math"
|
||||
|
||||
func XPMessage(length uint, diversity uint) uint {
|
||||
return uint(math.Floor(
|
||||
0.025*math.Pow(float64(length), 1.25)*math.Sqrt(float64(diversity)) + 1,
|
||||
))
|
||||
}
|
||||
|
||||
func XPVocal(time uint) uint {
|
||||
return uint(math.Floor(
|
||||
0.01*math.Pow(float64(time), 1.3) + 1,
|
||||
))
|
||||
}
|
||||
|
||||
func Level(xp uint) uint {
|
||||
return uint(math.Floor(
|
||||
0.2 * math.Sqrt(float64(xp)),
|
||||
))
|
||||
}
|
||||
|
||||
func XPForLevel(level uint) uint {
|
||||
return uint(math.Floor(
|
||||
math.Pow(float64(5*level), 2),
|
||||
))
|
||||
}
|
||||
|
||||
func Lose(time uint, xp uint) uint {
|
||||
return uint(math.Floor(
|
||||
math.Pow(float64(time), 2) * math.Pow(10, -2+math.Log(float64(time/85))) * math.Floor(float64(time/500)),
|
||||
))
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue