积分系统
This commit is contained in:
@@ -7,6 +7,7 @@ from datetime import datetime
|
||||
from pathlib import Path
|
||||
from games.base import BaseGame
|
||||
from utils.parser import CommandParser
|
||||
from games.points import PointsGame
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -19,6 +20,7 @@ class FortuneGame(BaseGame):
|
||||
super().__init__()
|
||||
self._fortunes = None
|
||||
self._tarot = None
|
||||
self.points_game = PointsGame()
|
||||
|
||||
def _load_data(self):
|
||||
"""懒加载运势数据"""
|
||||
@@ -95,6 +97,11 @@ class FortuneGame(BaseGame):
|
||||
# 重置随机seed
|
||||
random.seed()
|
||||
|
||||
# 尝试获得积分奖励(30%概率)
|
||||
points_earned = 0
|
||||
if random.random() < 0.3: # 30%概率获得积分
|
||||
points_earned = self.points_game.add_fortune_points(user_id)
|
||||
|
||||
# 格式化输出
|
||||
text = f"## 🔮 今日运势\n\n"
|
||||
text += f"**日期**:{today}\n\n"
|
||||
@@ -103,8 +110,13 @@ class FortuneGame(BaseGame):
|
||||
text += f"**建议**:{fortune['advice']}\n\n"
|
||||
text += f"**幸运数字**:{lucky_number}\n\n"
|
||||
text += f"**幸运颜色**:{lucky_color}\n\n"
|
||||
|
||||
# 添加积分奖励信息
|
||||
if points_earned > 0:
|
||||
text += f"**🎁 积分奖励**:+{points_earned} 分\n\n"
|
||||
|
||||
text += "---\n\n"
|
||||
text += "💡 提示:运势仅供娱乐参考~"
|
||||
text += "💡 提示:运势仅供娱乐参考,查看运势有机会获得积分奖励~"
|
||||
|
||||
return text
|
||||
|
||||
|
||||
Reference in New Issue
Block a user