|
|
@ -17,6 +17,12 @@ var (
|
|
|
|
lastKnownLevel = make(map[string]int)
|
|
|
|
lastKnownLevel = make(map[string]int)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func ClearCache(discordID string) {
|
|
|
|
|
|
|
|
levelMutex.Lock()
|
|
|
|
|
|
|
|
defer levelMutex.Unlock()
|
|
|
|
|
|
|
|
delete(lastKnownLevel, discordID)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func QueueCheck(discordID string) {
|
|
|
|
func QueueCheck(discordID string) {
|
|
|
|
levelMutex.Lock()
|
|
|
|
levelMutex.Lock()
|
|
|
|
defer levelMutex.Unlock()
|
|
|
|
defer levelMutex.Unlock()
|
|
|
@ -46,7 +52,11 @@ func ScheduleUpdates(s *discordgo.Session) {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if newLevel > oldLevel {
|
|
|
|
if newLevel > oldLevel {
|
|
|
|
err = gacha.RollReward(s, checkID, newLevel-oldLevel)
|
|
|
|
timeToRoll := newLevel - oldLevel
|
|
|
|
|
|
|
|
if oldLevel == 0 {
|
|
|
|
|
|
|
|
timeToRoll--
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
err = gacha.RollReward(s, checkID, timeToRoll)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
log.Error(s, err)
|
|
|
|
log.Error(s, err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|