diff --git a/server/src/Hokm.Server/Profiles/Gamification.cs b/server/src/Hokm.Server/Profiles/Gamification.cs index 20a105e..323e9d3 100644 --- a/server/src/Hokm.Server/Profiles/Gamification.cs +++ b/server/src/Hokm.Server/Profiles/Gamification.cs @@ -56,12 +56,13 @@ public static class Gamification // metric: wins|kotsFor|bestWinStreak|shutoutWins|games|tricks|level ; ratingFloor>0 = rank ach. private record AchDef(string Id, string? Metric, int RatingFloor, int Goal, int Coin, string NameFa, string NameEn, string Icon); // Mirrors src/lib/online/gamification.ts (same ids/goals/coins/metrics). - private static int Coin(int g) => Math.Min(1500, Math.Max(50, (int)Math.Floor((40.0 + g * 6) / 50.0 + 0.5) * 50)); + // Reward escalates strictly per milestone tier (50, 150, 250 … capped 1500). + private static int CoinAt(int i) => Math.Min(1500, 50 + i * 100); private static string Fa(int n) => new string(n.ToString().Select(c => c is >= '0' and <= '9' ? "۰۱۲۳۴۵۶۷۸۹"[c - '0'] : c).ToArray()); private static AchDef[] Tier(string metric, string prefix, string icon, int[] goals, Func faName, Func enName) - => goals.Select(g => new AchDef($"{prefix}_{g}", metric, 0, g, Coin(g), faName(g), enName(g), icon)).ToArray(); + => goals.Select((g, i) => new AchDef($"{prefix}_{g}", metric, 0, g, CoinAt(i), faName(g), enName(g), icon)).ToArray(); private static readonly AchDef[] Achs = BuildAchs(); private static AchDef[] BuildAchs() diff --git a/src/lib/online/gamification.ts b/src/lib/online/gamification.ts index fb237c4..539c411 100644 --- a/src/lib/online/gamification.ts +++ b/src/lib/online/gamification.ts @@ -253,12 +253,13 @@ function tier( faDesc: (g: string) => string, enDesc: (g: number) => string ): AchievementDef[] { - return goals.map((g) => ({ + return goals.map((g, i) => ({ id: `${prefix}_${g}`, category, metric, goal: g, - coinReward: Math.min(1500, Math.max(50, Math.round((40 + g * 6) / 50) * 50)), + // Reward escalates strictly per milestone tier (50, 150, 250 … capped 1500). + coinReward: Math.min(1500, 50 + i * 100), icon, nameFa: faName(faNum(g)), nameEn: enName(g),