mirror of
https://github.com/Lost-MSth/Arcaea-server.git
synced 2026-02-09 09:17:26 +08:00
Change something about aggregate
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import json
|
||||
from server.sql import Connect
|
||||
from .config import Constant
|
||||
from setting import Config
|
||||
import server.item
|
||||
import server.character
|
||||
@@ -26,14 +27,14 @@ def int2b(x):
|
||||
def calc_stamina(max_stamina_ts, curr_stamina):
|
||||
# 计算体力,返回剩余体力数值
|
||||
|
||||
stamina = int(Config.MAX_STAMINA - (max_stamina_ts -
|
||||
int(time.time()*1000)) / Config.STAMINA_RECOVER_TICK)
|
||||
stamina = int(Constant.MAX_STAMINA - (max_stamina_ts -
|
||||
int(time.time()*1000)) / Constant.STAMINA_RECOVER_TICK)
|
||||
|
||||
if stamina >= Config.MAX_STAMINA:
|
||||
if curr_stamina >= Config.MAX_STAMINA:
|
||||
if stamina >= Constant.MAX_STAMINA:
|
||||
if curr_stamina >= Constant.MAX_STAMINA:
|
||||
stamina = curr_stamina
|
||||
else:
|
||||
stamina = Config.MAX_STAMINA
|
||||
stamina = Constant.MAX_STAMINA
|
||||
if stamina < 0:
|
||||
stamina = 0
|
||||
|
||||
@@ -245,8 +246,8 @@ def play_world_song(user_id, args):
|
||||
return {}
|
||||
stamina = calc_stamina(max_stamina_ts, stamina) - \
|
||||
info['stamina_cost'] * stamina_multiply
|
||||
max_stamina_ts = now + Config.STAMINA_RECOVER_TICK * \
|
||||
(Config.MAX_STAMINA - stamina)
|
||||
max_stamina_ts = now + Constant.STAMINA_RECOVER_TICK * \
|
||||
(Constant.MAX_STAMINA - stamina)
|
||||
c.execute('''update user set max_stamina_ts=?, stamina=? where user_id=?''',
|
||||
(max_stamina_ts, stamina, user_id))
|
||||
r = {
|
||||
@@ -600,11 +601,11 @@ def add_stamina(c, user_id, add_stamina):
|
||||
if x and x[0] is not None and x[1] is not None:
|
||||
stamina = calc_stamina(x[0], x[1]) + add_stamina
|
||||
max_stamina_ts = now - \
|
||||
(stamina-Config.MAX_STAMINA) * \
|
||||
Config.STAMINA_RECOVER_TICK
|
||||
(stamina-Constant.MAX_STAMINA) * \
|
||||
Constant.STAMINA_RECOVER_TICK
|
||||
else:
|
||||
max_stamina_ts = now
|
||||
stamina = Config.MAX_STAMINA
|
||||
stamina = Constant.MAX_STAMINA
|
||||
|
||||
c.execute('''update user set max_stamina_ts=?, stamina=? where user_id=?''',
|
||||
(max_stamina_ts, stamina, user_id))
|
||||
|
||||
Reference in New Issue
Block a user