mirror of
https://github.com/Walter-Sparrow/lunar-tear.git
synced 2026-07-02 13:53:41 +03:00
Implement Memoirs Protect/Unprotect and ConsumableItemService.UseEffectItem
Build and Push Docker images to Docker Hub / build-and-push (push) Has been cancelled
Build and Push Docker images to Docker Hub / build-and-push (push) Has been cancelled
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
package store
|
||||
|
||||
import "log"
|
||||
import (
|
||||
"log"
|
||||
|
||||
"lunar-tear/server/internal/model"
|
||||
)
|
||||
|
||||
const StaminaRecoveryDivisor int64 = 180
|
||||
|
||||
@@ -39,3 +43,14 @@ func ReplenishStamina(user *UserState, maxStaminaMillis int32, nowMillis int64)
|
||||
user.Status.StaminaUpdateDatetime = nowMillis
|
||||
log.Printf("[ReplenishStamina] set to %d", maxStaminaMillis)
|
||||
}
|
||||
|
||||
func ResolveStaminaEffectMillis(effectValueType, effectValue, maxStaminaMillis int32) int32 {
|
||||
switch effectValueType {
|
||||
case model.EffectValueFixed:
|
||||
return effectValue * 1000
|
||||
case model.EffectValuePermil:
|
||||
return effectValue * maxStaminaMillis / 1000
|
||||
default:
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user