cb27a16dc1
Game table & play - UNO-style restyle: suit-aware bolder cards (+xl size), pulsing playable glow, big "YOUR TURN" pill, active-seat ring, trick-win particle burst, round confetti, match coin-rain. - Per-league turn time via turnMsForStake: 15s starter/AI, 10s pro, 7s expert; mirrored server-side in GameRoom.TurnMs. - Speed (Blitz) mode for vs-AI/private: 5s turns, race to 5, ~halved pacing. - Matchmaking waits ~15s (randomized 12-18s) then fills bots; elapsed timer + hint. Rewards / gifts - Richer post-match modal (floating coins, XP bar), celebration overlay reveals the unlocked sticker pack, boosted daily rewards (client+server synced), themed 7-day daily with special day-7. Social - Public profile modal (identity, stats, achievement board) from leaderboard / friends / discover / end-of-game roster; rate-limited add-friend (10/hour). - Social hub: Friends / Discover (player search + suggestions) / Messages inbox. - Profile gender (shown in finder/profile) + social links with public/friends/ hidden visibility, enforced server-side. Cosmetics - Distinct card backs: per-design pattern families (stripes/argyle/grid/dots/ rays/scales/crosshatch/royal/filigree/gem) + luxury motifs (lib/cardBack.ts), consistent on table/shop/profile; +Peacock/Rose-Gold backs. - Purchasable titles (shop Titles section); title shown under the seat on the table and in discover/public profile. - 10 new sticker packs (banter/kol-kol, Persian trends, court cards, moods). - Persistent level+XP bar on Home and every inner screen. Payments - Buy-coins gateway opens in a new tab (no SPA dead-end) + focus refresh. - Store IAB scaffolding: Cafe Bazaar deep-link purchase + redirect-token capture, Myket native-bridge contract, server-side IabService.Verify for both stores, config-driven via Iab__* env. POST /api/coins/iab/verify (JWT). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
162 lines
5.6 KiB
C#
162 lines
5.6 KiB
C#
using System.Text.Json;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace Hokm.Server.Profiles;
|
|
|
|
public class StatsDto
|
|
{
|
|
public int Games { get; set; }
|
|
public int Wins { get; set; }
|
|
public int Losses { get; set; }
|
|
public int KotsFor { get; set; }
|
|
public int KotsAgainst { get; set; }
|
|
public int Tricks { get; set; }
|
|
public int BestWinStreak { get; set; }
|
|
public int CurrentWinStreak { get; set; }
|
|
public int ShutoutWins { get; set; }
|
|
public int HakemRounds { get; set; }
|
|
public int RoundsWon { get; set; }
|
|
}
|
|
|
|
/// <summary>Optional social-media handles a player chooses to share.</summary>
|
|
public class SocialLinksDto
|
|
{
|
|
public string? Instagram { get; set; }
|
|
public string? Telegram { get; set; }
|
|
public string? X { get; set; }
|
|
public string? Youtube { get; set; }
|
|
}
|
|
|
|
/// <summary>Mirrors the client UserProfile (camelCase JSON).</summary>
|
|
public class ProfileDto
|
|
{
|
|
public string Id { get; set; } = "";
|
|
public string Username { get; set; } = "";
|
|
public string DisplayName { get; set; } = "بازیکن";
|
|
public string Avatar { get; set; } = "a-fox";
|
|
public string? AvatarImage { get; set; }
|
|
public string? Phone { get; set; }
|
|
public string? Email { get; set; }
|
|
public string Plan { get; set; } = "free";
|
|
public long? PlanUntil { get; set; }
|
|
public int Level { get; set; } = 1;
|
|
public int Xp { get; set; }
|
|
public int Coins { get; set; } = 1000;
|
|
public int Rating { get; set; } = 1000;
|
|
public StatsDto Stats { get; set; } = new();
|
|
public List<string> OwnedAvatars { get; set; } = new() { "a-fox", "a-lion" };
|
|
public List<string> OwnedCardFronts { get; set; } = new() { "classic" };
|
|
public List<string> OwnedCardBacks { get; set; } = new() { "classic" };
|
|
public List<string> OwnedTitles { get; set; } = new() { "novice" };
|
|
public List<string> OwnedReactionPacks { get; set; } = new();
|
|
public List<string> OwnedStickerPacks { get; set; } = new();
|
|
public string? Title { get; set; } = "novice";
|
|
public string CardFront { get; set; } = "classic";
|
|
public string CardBack { get; set; } = "classic";
|
|
public Dictionary<string, int> Achievements { get; set; } = new();
|
|
public List<string> Unlocked { get; set; } = new();
|
|
public long CreatedAt { get; set; }
|
|
|
|
// social
|
|
public string Gender { get; set; } = ""; // "" | male | female | other
|
|
public SocialLinksDto Socials { get; set; } = new();
|
|
public string SocialsVisibility { get; set; } = "public"; // public | friends | hidden
|
|
|
|
// daily reward streak
|
|
public int DailyDay { get; set; } = 1;
|
|
public string? DailyLastClaimed { get; set; } // yyyy-MM-dd
|
|
}
|
|
|
|
/// <summary>
|
|
/// Public-facing view of another player (no coins/phone/email). Mirrors the
|
|
/// client <c>PublicProfile</c>. Returned by <c>GET /api/profile/{id}/public</c>.
|
|
/// </summary>
|
|
public class PublicProfileDto
|
|
{
|
|
public string Id { get; set; } = "";
|
|
public string DisplayName { get; set; } = "";
|
|
public string Avatar { get; set; } = "a-fox";
|
|
public string? AvatarImage { get; set; }
|
|
public string Plan { get; set; } = "free";
|
|
public string? Title { get; set; }
|
|
public int Level { get; set; } = 1;
|
|
public int Rating { get; set; } = 1000;
|
|
public StatsDto Stats { get; set; } = new();
|
|
public Dictionary<string, int> Achievements { get; set; } = new();
|
|
public List<string> Unlocked { get; set; } = new();
|
|
public long CreatedAt { get; set; }
|
|
public string Gender { get; set; } = "";
|
|
/// <summary>Only populated when the viewer is allowed to see them (public / friend / self).</summary>
|
|
public SocialLinksDto? Socials { get; set; }
|
|
public bool IsFriend { get; set; }
|
|
public bool IsYou { get; set; }
|
|
public bool RequestSent { get; set; }
|
|
}
|
|
|
|
public class MatchSummaryDto
|
|
{
|
|
public bool Ranked { get; set; }
|
|
public int Stake { get; set; }
|
|
public bool Won { get; set; }
|
|
public bool KotFor { get; set; }
|
|
public bool KotAgainst { get; set; }
|
|
public int TricksWon { get; set; }
|
|
public int Rounds { get; set; }
|
|
public bool Shutout { get; set; }
|
|
public int HakemRounds { get; set; }
|
|
public int RoundsWon { get; set; }
|
|
public bool Forfeit { get; set; }
|
|
}
|
|
|
|
public class AchievementUnlockDto
|
|
{
|
|
public string Id { get; set; } = "";
|
|
public string NameFa { get; set; } = "";
|
|
public string NameEn { get; set; } = "";
|
|
public string Icon { get; set; } = "";
|
|
public int CoinReward { get; set; }
|
|
}
|
|
|
|
public class TitleUnlockDto
|
|
{
|
|
public string Id { get; set; } = "";
|
|
public string NameFa { get; set; } = "";
|
|
public string NameEn { get; set; } = "";
|
|
}
|
|
|
|
public class RewardResultDto
|
|
{
|
|
public int RatingBefore { get; set; }
|
|
public int RatingAfter { get; set; }
|
|
public int RatingDelta { get; set; }
|
|
public int CoinsBefore { get; set; }
|
|
public int CoinsAfter { get; set; }
|
|
public int CoinsDelta { get; set; }
|
|
public int XpGained { get; set; }
|
|
public int LevelBefore { get; set; }
|
|
public int LevelAfter { get; set; }
|
|
public bool LeveledUp { get; set; }
|
|
public List<AchievementUnlockDto> NewAchievements { get; set; } = new();
|
|
public List<TitleUnlockDto> NewTitles { get; set; } = new();
|
|
public bool Promoted { get; set; }
|
|
public bool Demoted { get; set; }
|
|
}
|
|
|
|
public class CoinPackDto
|
|
{
|
|
public string Id { get; set; } = "";
|
|
public int Coins { get; set; }
|
|
public int Bonus { get; set; }
|
|
public int PriceToman { get; set; }
|
|
public string? Tag { get; set; }
|
|
}
|
|
|
|
public static class JsonOpts
|
|
{
|
|
public static readonly JsonSerializerOptions Default = new()
|
|
{
|
|
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
|
|
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
|
};
|
|
}
|