|
|
|
@ -8,6 +8,8 @@ import (
|
|
|
|
|
"github.com/bwmarrin/discordgo"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const notInGeneralNerf = 10
|
|
|
|
|
|
|
|
|
|
var lastMessage = make(map[string]time.Time)
|
|
|
|
|
var incrementMutex = sync.Mutex{}
|
|
|
|
|
var levelUpRequirementCache [30]int
|
|
|
|
@ -21,8 +23,11 @@ func init() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func incrementXP(dg *discordgo.Session, discordID string) {
|
|
|
|
|
func incrementXP(dg *discordgo.Session, discordID string, inGeneral bool) {
|
|
|
|
|
amountToIncrement := calculateIncrement(discordID)
|
|
|
|
|
if !inGeneral {
|
|
|
|
|
amountToIncrement /= notInGeneralNerf
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tx, err := db.Begin()
|
|
|
|
|
if err != nil {
|
|
|
|
@ -71,8 +76,8 @@ func calculateIncrement(discordID string) int {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Constructed on Desmos:
|
|
|
|
|
//y=\frac{100}{\left(1+e^{-\left(\frac{x-15}{3}\right)}\right)}
|
|
|
|
|
return int(100 / (1 + math.Pow(math.E, -((delta.Seconds()-15)/3))))
|
|
|
|
|
//y=\frac{100}{\left(1+e^{-\left(x-5\right)}\right)}
|
|
|
|
|
return int(100 / (1 + math.Pow(math.E, -(delta.Seconds()-5))))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func convertXPIntoLevel(xp int) (int, int) {
|
|
|
|
|