feat: add cards templete

This commit is contained in:
2026-06-24 10:47:54 +03:30
parent 60494946d6
commit b1c7bfdd06
124 changed files with 422 additions and 30 deletions
+20
View File
@@ -41,6 +41,17 @@ func (g gameSettler) AwardWinner(userID int64, tier string) {
}
}
// AwardRank امتیازِ رتبه را در میزِ رتبه‌بندی به‌روزرسانی می‌کند.
func (g gameSettler) AwardRank(userID int64, tier string, won bool) {
t := g.eco.FindTier(tier)
if t == nil || t.RankReward <= 0 {
return
}
if err := g.eco.AwardRank(context.Background(), userID, t.RankReward, won); err != nil {
slog.Error("award rank", "user", userID, "err", err)
}
}
func (g gameSettler) RecordGame(room, playersJSON string, winnerTeam int, kot bool) {
if err := g.eco.RecordGame(context.Background(), room, playersJSON, winnerTeam, kot); err != nil {
slog.Error("record game", "room", room, "err", err)
@@ -62,6 +73,15 @@ func (g gameSettler) RecordGameResult(userID int64, won bool) {
g.eco.RecordGameResult(context.Background(), userID, won)
}
// PlayerProfile سکه و نشانِ رتبه‌ی بازیکن را برای نمایش سرِ میز برمی‌گرداند.
func (g gameSettler) PlayerProfile(userID int64) (int64, string) {
p, err := g.eco.GetProfile(context.Background(), userID)
if err != nil || p == nil {
return 0, ""
}
return p.Coins, p.RankTier
}
// ChargePrivateTable یک میز خصوصیِ رایگان را برای کاربر مصرف می‌کند.
func (g gameSettler) ChargePrivateTable(userID int64) error {
return g.eco.ConsumePrivateTable(context.Background(), userID)