aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnhgelus Morhtuuzh <anhgelus.morhtuuzh@proton.me>2024-04-15 19:15:37 +0200
committerAnhgelus Morhtuuzh <anhgelus.morhtuuzh@proton.me>2024-04-15 19:15:37 +0200
commit9f9c27f42298d51a356743724095a6dd79196dfe (patch)
tree0edf2e31538e1d9b310e8ea91a407ef3a1c51e18
parent84bf4caed210b442f75e9e55d4c69b6ca9c6a5c9 (diff)
feat(debug): adapt xp functions while debug is enabled
-rw-r--r--xp/functions.go10
-rw-r--r--xp/member.go4
2 files changed, 13 insertions, 1 deletions
diff --git a/xp/functions.go b/xp/functions.go
index 63c7fb7..7ab57f2 100644
--- a/xp/functions.go
+++ b/xp/functions.go
@@ -1,6 +1,9 @@
package xp
-import "math"
+import (
+ "github.com/anhgelus/gokord"
+ "math"
+)
func XPMessage(length uint, diversity uint) uint {
return uint(math.Floor(
@@ -27,6 +30,11 @@ func XPForLevel(level uint) uint {
}
func Lose(time uint, xp uint) uint {
+ if gokord.Debug {
+ return uint(math.Floor(
+ math.Pow(float64(time), 3) * math.Pow(10, -2+math.Log(float64(time))) * math.Floor(float64(xp/500)+1),
+ )) // a little bit faster to lose xp
+ }
return uint(math.Floor(
math.Pow(float64(time), 2) * math.Pow(10, -2+math.Log(float64(time/85))) * math.Floor(float64(xp/500)+1),
))
diff --git a/xp/member.go b/xp/member.go
index b9073f3..977f5a0 100644
--- a/xp/member.go
+++ b/xp/member.go
@@ -9,6 +9,7 @@ import (
"github.com/bwmarrin/discordgo"
"github.com/redis/go-redis/v9"
"gorm.io/gorm"
+ "math"
"strconv"
"time"
)
@@ -98,6 +99,9 @@ func (c *Copaing) HourSinceLastEvent() uint {
)
return 0
}
+ if gokord.Debug {
+ return uint(math.Floor(float64(t-int64(last)) / 60)) // not hours of unix, is minutes of unix
+ }
return utils.HoursOfUnix(t - int64(last))
}