|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"crypto/rand"
|
|
|
|
|
"fmt"
|
|
|
|
|
"math"
|
|
|
|
|
"time"
|
|
|
|
@ -32,7 +33,10 @@ func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func handleXPRequest(s *discordgo.Session, m *discordgo.MessageCreate) {
|
|
|
|
|
level, xp := getLevelAndXP(s, m.Author.ID)
|
|
|
|
|
level, rawXP := getLevelAndXP(s, m.Author.ID)
|
|
|
|
|
randomSource := make([]byte, 1)
|
|
|
|
|
rand.Read(randomSource)
|
|
|
|
|
xp := rawXP - (rawXP % 100) + ((int(randomSource[0]) + 128) % 100)
|
|
|
|
|
levelUpRequirement := levelUpRequirementCache[level-1]
|
|
|
|
|
if level > 1 {
|
|
|
|
|
levelUpRequirement -= levelUpRequirementCache[level-2]
|
|
|
|
|