MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / ParseRarity

Function ParseRarity

Telegram/SourceFiles/api/api_premium.cpp:1049–1061  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1047}
1048
1049int ParseRarity(const MTPStarGiftAttributeRarity &rarity) {
1050 return rarity.match([&](const MTPDstarGiftAttributeRarity &data) {
1051 return std::max(data.vpermille().v, 0);
1052 }, [&](const MTPDstarGiftAttributeRarityUncommon &) {
1053 return int(Data::UniqueGiftRarity::Uncommon);
1054 }, [&](const MTPDstarGiftAttributeRarityRare &) {
1055 return int(Data::UniqueGiftRarity::Rare);
1056 }, [&](const MTPDstarGiftAttributeRarityEpic &) {
1057 return int(Data::UniqueGiftRarity::Epic);
1058 }, [&](const MTPDstarGiftAttributeRarityLegendary &) {
1059 return int(Data::UniqueGiftRarity::Legendary);
1060 });
1061}
1062
1063Data::UniqueGiftModel FromTL(
1064 not_null<Main::Session*> session,

Callers 1

FromTLFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected