Compare commits
1 Commits
1ffe0ffa9f
...
34bce2ce75
| Author | SHA1 | Date | |
|---|---|---|---|
| 34bce2ce75 |
+30
-187
@@ -1,189 +1,32 @@
|
|||||||
[
|
[
|
||||||
{
|
{ "id": "card_bronze_001", "name": "Lucas Santos", "overall": 62, "position": "ST", "nation": "Brazil", "league": "Serie B", "club": "Santos FC", "pace": 72, "shooting": 61, "passing": 52, "dribbling": 63, "defending": 30, "physical": 64, "rarity": "bronze", "image_path": null },
|
||||||
"id": "card_bronze_001",
|
{ "id": "card_bronze_002", "name": "Marco Ferri", "overall": 60, "position": "CM", "nation": "Italy", "league": "Serie C", "club": "Modena FC", "pace": 58, "shooting": 52, "passing": 63, "dribbling": 59, "defending": 55, "physical": 60, "rarity": "bronze", "image_path": null },
|
||||||
"name": "Lucas Santos",
|
{ "id": "card_bronze_003", "name": "Eko Jabari", "overall": 61, "position": "CB", "nation": "Nigeria", "league": "NPFL", "club": "Kano Pillars", "pace": 60, "shooting": 25, "passing": 48, "dribbling": 42, "defending": 64, "physical": 70, "rarity": "bronze", "image_path": null },
|
||||||
"overall": 62,
|
{ "id": "card_bronze_004", "name": "Pieter Van Dijk", "overall": 63, "position": "LB", "nation": "Netherlands", "league": "Eerste Divisie", "club": "FC Volendam", "pace": 65, "shooting": 38, "passing": 60, "dribbling": 61, "defending": 65, "physical": 62, "rarity": "bronze", "image_path": null },
|
||||||
"position": "ST",
|
{ "id": "card_bronze_005", "name": "Tomás Ruiz", "overall": 62, "position": "GK", "nation": "Spain", "league": "Segunda B", "club": "SD Compostela", "pace": 40, "shooting": 10, "passing": 35, "dribbling": 20, "defending": 62, "physical": 58, "rarity": "bronze", "image_path": null },
|
||||||
"nation": "Brazil",
|
{ "id": "card_bronze_006", "name": "James Okafor", "overall": 60, "position": "RM", "nation": "Ghana", "league": "Ghana Premier League", "club": "Asante Kotoko", "pace": 75, "shooting": 55, "passing": 58, "dribbling": 66, "defending": 32, "physical": 55, "rarity": "bronze", "image_path": null },
|
||||||
"league": "Serie B",
|
{ "id": "card_bronze_007", "name": "Stefan Kovac", "overall": 61, "position": "CDM", "nation": "Serbia", "league": "Super liga Srbije", "club": "FK Partizan", "pace": 55, "shooting": 50, "passing": 60, "dribbling": 56, "defending": 63, "physical": 68, "rarity": "bronze", "image_path": null },
|
||||||
"club": "Santos FC",
|
{ "id": "card_bronze_008", "name": "Hiroshi Tanaka", "overall": 63, "position": "CAM", "nation": "Japan", "league": "J2 League", "club": "Gamba Osaka", "pace": 68, "shooting": 60, "passing": 66, "dribbling": 70, "defending": 38, "physical": 52, "rarity": "bronze", "image_path": null },
|
||||||
"pace": 72,
|
{ "id": "card_bronze_009", "name": "Aleksei Morozov", "overall": 60, "position": "RB", "nation": "Russia", "league": "FNL", "club": "Torpedo Moscow", "pace": 62, "shooting": 40, "passing": 56, "dribbling": 58, "defending": 62, "physical": 60, "rarity": "bronze", "image_path": null },
|
||||||
"shooting": 61,
|
{ "id": "card_bronze_010", "name": "Kwame Asante", "overall": 62, "position": "LM", "nation": "Ghana", "league": "Ghana Premier League", "club": "Hearts of Oak", "pace": 73, "shooting": 58, "passing": 60, "dribbling": 65, "defending": 35, "physical": 58, "rarity": "bronze", "image_path": null },
|
||||||
"passing": 52,
|
{ "id": "card_bronze_011", "name": "Ivan Petrov", "overall": 61, "position": "CB", "nation": "Bulgaria", "league": "First League", "club": "CSKA Sofia", "pace": 58, "shooting": 22, "passing": 50, "dribbling": 44, "defending": 63, "physical": 67, "rarity": "bronze", "image_path": null },
|
||||||
"dribbling": 63,
|
{ "id": "card_bronze_012", "name": "Diego Herrera", "overall": 61, "position": "LW", "nation": "Mexico", "league": "Liga de Expansion", "club": "Atletico San Luis B", "pace": 74, "shooting": 57, "passing": 56, "dribbling": 67, "defending": 28, "physical": 52, "rarity": "bronze", "image_path": null },
|
||||||
"defending": 30,
|
{ "id": "card_bronze_013", "name": "Pawel Wisniewski", "overall": 62, "position": "CB", "nation": "Poland", "league": "I Liga", "club": "Wisla Plock", "pace": 57, "shooting": 24, "passing": 52, "dribbling": 46, "defending": 64, "physical": 69, "rarity": "bronze", "image_path": null },
|
||||||
"physical": 64,
|
{ "id": "card_bronze_014", "name": "Youssef Belkadi", "overall": 61, "position": "CM", "nation": "Morocco", "league": "Botola Pro 2", "club": "AS FAR", "pace": 63, "shooting": 54, "passing": 62, "dribbling": 61, "defending": 56, "physical": 58, "rarity": "bronze", "image_path": null },
|
||||||
"rarity": "bronze",
|
{ "id": "card_bronze_015", "name": "Emre Yilmaz", "overall": 63, "position": "ST", "nation": "Turkey", "league": "TFF First League", "club": "Erzurumspor", "pace": 70, "shooting": 63, "passing": 53, "dribbling": 61, "defending": 28, "physical": 66, "rarity": "bronze", "image_path": null },
|
||||||
"image_path": null
|
{ "id": "card_bronze_016", "name": "Mattias Holm", "overall": 60, "position": "GK", "nation": "Sweden", "league": "Superettan", "club": "Vasalunds IF", "pace": 38, "shooting": 9, "passing": 40, "dribbling": 22, "defending": 61, "physical": 62, "rarity": "bronze", "image_path": null },
|
||||||
},
|
{ "id": "card_bronze_017", "name": "Rui Teixeira", "overall": 62, "position": "RB", "nation": "Portugal", "league": "Liga Portugal 2", "club": "CD Mafra", "pace": 66, "shooting": 41, "passing": 59, "dribbling": 62, "defending": 64, "physical": 60, "rarity": "bronze", "image_path": null },
|
||||||
{
|
{ "id": "card_bronze_018", "name": "Sung-Jin Park", "overall": 63, "position": "CDM", "nation": "South Korea", "league": "K League 2", "club": "Busan IPark", "pace": 60, "shooting": 48, "passing": 62, "dribbling": 59, "defending": 65, "physical": 64, "rarity": "bronze", "image_path": null },
|
||||||
"id": "card_bronze_002",
|
{ "id": "card_bronze_019", "name": "Wei Zhao", "overall": 60, "position": "CAM", "nation": "China", "league": "China League One", "club": "Wuhan Three Towns B", "pace": 67, "shooting": 57, "passing": 61, "dribbling": 63, "defending": 36, "physical": 50, "rarity": "bronze", "image_path": null },
|
||||||
"name": "Marco Ferri",
|
{ "id": "card_bronze_020", "name": "Sebastián Mora", "overall": 61, "position": "LB", "nation": "Chile", "league": "Primera B", "club": "CD Magallanes", "pace": 64, "shooting": 36, "passing": 58, "dribbling": 58, "defending": 63, "physical": 59, "rarity": "bronze", "image_path": null },
|
||||||
"overall": 60,
|
{ "id": "card_bronze_021", "name": "Camilo Rios", "overall": 62, "position": "RW", "nation": "Colombia", "league": "Primera B Colombia", "club": "Deportes Quindio", "pace": 76, "shooting": 59, "passing": 55, "dribbling": 68, "defending": 25, "physical": 53, "rarity": "bronze", "image_path": null },
|
||||||
"position": "CM",
|
{ "id": "card_bronze_022", "name": "Ahmed Sayed", "overall": 61, "position": "CF", "nation": "Egypt", "league": "Egyptian Second Division", "club": "Ceramica Cleopatra", "pace": 68, "shooting": 62, "passing": 55, "dribbling": 64, "defending": 27, "physical": 60, "rarity": "bronze", "image_path": null },
|
||||||
"nation": "Italy",
|
{ "id": "card_bronze_023", "name": "Connor Walsh", "overall": 60, "position": "CM", "nation": "Australia", "league": "NPL Queensland", "club": "Gold Coast Knights", "pace": 62, "shooting": 53, "passing": 61, "dribbling": 58, "defending": 54, "physical": 59, "rarity": "bronze", "image_path": null },
|
||||||
"league": "Serie C",
|
{ "id": "card_bronze_024", "name": "Jordi Claes", "overall": 63, "position": "CDM", "nation": "Belgium", "league": "Eerste Nationale", "club": "Lommel SK", "pace": 58, "shooting": 47, "passing": 64, "dribbling": 58, "defending": 66, "physical": 65, "rarity": "bronze", "image_path": null },
|
||||||
"club": "Modena FC",
|
{ "id": "card_bronze_025", "name": "Matej Horvat", "overall": 62, "position": "CB", "nation": "Croatia", "league": "Prva NL", "club": "NK Istra 1961", "pace": 59, "shooting": 23, "passing": 51, "dribbling": 45, "defending": 64, "physical": 68, "rarity": "bronze", "image_path": null },
|
||||||
"pace": 58,
|
{ "id": "card_bronze_026", "name": "Arash Karimi", "overall": 60, "position": "ST", "nation": "Iran", "league": "Azadegan League", "club": "Shahin Bushehr", "pace": 66, "shooting": 61, "passing": 49, "dribbling": 60, "defending": 24, "physical": 63, "rarity": "bronze", "image_path": null },
|
||||||
"shooting": 52,
|
{ "id": "card_bronze_027", "name": "Nikos Papadopoulos", "overall": 61, "position": "LM", "nation": "Greece", "league": "Football League", "club": "PAS Giannina", "pace": 70, "shooting": 55, "passing": 59, "dribbling": 63, "defending": 33, "physical": 55, "rarity": "bronze", "image_path": null },
|
||||||
"passing": 63,
|
{ "id": "card_bronze_028", "name": "Andrei Ionescu", "overall": 62, "position": "RB", "nation": "Romania", "league": "Liga II", "club": "FC Arges", "pace": 65, "shooting": 39, "passing": 58, "dribbling": 60, "defending": 63, "physical": 61, "rarity": "bronze", "image_path": null },
|
||||||
"dribbling": 59,
|
{ "id": "card_bronze_029", "name": "Callum Fraser", "overall": 61, "position": "CM", "nation": "Scotland", "league": "Scottish Championship", "club": "Partick Thistle", "pace": 61, "shooting": 54, "passing": 63, "dribbling": 60, "defending": 57, "physical": 62, "rarity": "bronze", "image_path": null },
|
||||||
"defending": 55,
|
{ "id": "card_bronze_030", "name": "Seydou Coulibaly", "overall": 63, "position": "CDM", "nation": "Ivory Coast", "league": "MTN Ligue 1", "club": "ASEC Mimosas", "pace": 64, "shooting": 49, "passing": 62, "dribbling": 60, "defending": 67, "physical": 68, "rarity": "bronze", "image_path": null }
|
||||||
"physical": 60,
|
|
||||||
"rarity": "bronze",
|
|
||||||
"image_path": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "card_bronze_003",
|
|
||||||
"name": "Eko Jabari",
|
|
||||||
"overall": 61,
|
|
||||||
"position": "CB",
|
|
||||||
"nation": "Nigeria",
|
|
||||||
"league": "NPFL",
|
|
||||||
"club": "Kano Pillars",
|
|
||||||
"pace": 60,
|
|
||||||
"shooting": 25,
|
|
||||||
"passing": 48,
|
|
||||||
"dribbling": 42,
|
|
||||||
"defending": 64,
|
|
||||||
"physical": 70,
|
|
||||||
"rarity": "bronze",
|
|
||||||
"image_path": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "card_bronze_004",
|
|
||||||
"name": "Pieter Van Dijk",
|
|
||||||
"overall": 63,
|
|
||||||
"position": "LB",
|
|
||||||
"nation": "Netherlands",
|
|
||||||
"league": "Eerste Divisie",
|
|
||||||
"club": "FC Volendam",
|
|
||||||
"pace": 65,
|
|
||||||
"shooting": 38,
|
|
||||||
"passing": 60,
|
|
||||||
"dribbling": 61,
|
|
||||||
"defending": 65,
|
|
||||||
"physical": 62,
|
|
||||||
"rarity": "bronze",
|
|
||||||
"image_path": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "card_bronze_005",
|
|
||||||
"name": "Tomás Ruiz",
|
|
||||||
"overall": 62,
|
|
||||||
"position": "GK",
|
|
||||||
"nation": "Spain",
|
|
||||||
"league": "Segunda B",
|
|
||||||
"club": "SD Compostela",
|
|
||||||
"pace": 40,
|
|
||||||
"shooting": 10,
|
|
||||||
"passing": 35,
|
|
||||||
"dribbling": 20,
|
|
||||||
"defending": 62,
|
|
||||||
"physical": 58,
|
|
||||||
"rarity": "bronze",
|
|
||||||
"image_path": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "card_bronze_006",
|
|
||||||
"name": "James Okafor",
|
|
||||||
"overall": 60,
|
|
||||||
"position": "RM",
|
|
||||||
"nation": "Ghana",
|
|
||||||
"league": "Ghana Premier League",
|
|
||||||
"club": "Asante Kotoko",
|
|
||||||
"pace": 75,
|
|
||||||
"shooting": 55,
|
|
||||||
"passing": 58,
|
|
||||||
"dribbling": 66,
|
|
||||||
"defending": 32,
|
|
||||||
"physical": 55,
|
|
||||||
"rarity": "bronze",
|
|
||||||
"image_path": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "card_bronze_007",
|
|
||||||
"name": "Stefan Kovac",
|
|
||||||
"overall": 61,
|
|
||||||
"position": "CDM",
|
|
||||||
"nation": "Serbia",
|
|
||||||
"league": "Super liga Srbije",
|
|
||||||
"club": "FK Partizan",
|
|
||||||
"pace": 55,
|
|
||||||
"shooting": 50,
|
|
||||||
"passing": 60,
|
|
||||||
"dribbling": 56,
|
|
||||||
"defending": 63,
|
|
||||||
"physical": 68,
|
|
||||||
"rarity": "bronze",
|
|
||||||
"image_path": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "card_bronze_008",
|
|
||||||
"name": "Hiroshi Tanaka",
|
|
||||||
"overall": 63,
|
|
||||||
"position": "CAM",
|
|
||||||
"nation": "Japan",
|
|
||||||
"league": "J2 League",
|
|
||||||
"club": "Gamba Osaka",
|
|
||||||
"pace": 68,
|
|
||||||
"shooting": 60,
|
|
||||||
"passing": 66,
|
|
||||||
"dribbling": 70,
|
|
||||||
"defending": 38,
|
|
||||||
"physical": 52,
|
|
||||||
"rarity": "bronze",
|
|
||||||
"image_path": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "card_bronze_009",
|
|
||||||
"name": "Aleksei Morozov",
|
|
||||||
"overall": 60,
|
|
||||||
"position": "RB",
|
|
||||||
"nation": "Russia",
|
|
||||||
"league": "FNL",
|
|
||||||
"club": "Torpedo Moscow",
|
|
||||||
"pace": 62,
|
|
||||||
"shooting": 40,
|
|
||||||
"passing": 56,
|
|
||||||
"dribbling": 58,
|
|
||||||
"defending": 62,
|
|
||||||
"physical": 60,
|
|
||||||
"rarity": "bronze",
|
|
||||||
"image_path": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "card_bronze_010",
|
|
||||||
"name": "Kwame Asante",
|
|
||||||
"overall": 62,
|
|
||||||
"position": "LM",
|
|
||||||
"nation": "Ghana",
|
|
||||||
"league": "Ghana Premier League",
|
|
||||||
"club": "Hearts of Oak",
|
|
||||||
"pace": 73,
|
|
||||||
"shooting": 58,
|
|
||||||
"passing": 60,
|
|
||||||
"dribbling": 65,
|
|
||||||
"defending": 35,
|
|
||||||
"physical": 58,
|
|
||||||
"rarity": "bronze",
|
|
||||||
"image_path": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "card_bronze_011",
|
|
||||||
"name": "Ivan Petrov",
|
|
||||||
"overall": 61,
|
|
||||||
"position": "CB",
|
|
||||||
"nation": "Bulgaria",
|
|
||||||
"league": "First League",
|
|
||||||
"club": "CSKA Sofia",
|
|
||||||
"pace": 58,
|
|
||||||
"shooting": 22,
|
|
||||||
"passing": 50,
|
|
||||||
"dribbling": 44,
|
|
||||||
"defending": 63,
|
|
||||||
"physical": 67,
|
|
||||||
"rarity": "bronze",
|
|
||||||
"image_path": null
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
[
|
||||||
|
{ "id": "card_raregold_001", "name": "Gabriel Monteiro", "overall": 88, "position": "ST", "nation": "Brazil", "league": "Brasileirao", "club": "Flamengo", "pace": 92, "shooting": 89, "passing": 78, "dribbling": 87, "defending": 42, "physical": 82, "rarity": "raregold", "image_path": null },
|
||||||
|
{ "id": "card_raregold_002", "name": "Matteo Romano", "overall": 86, "position": "CAM", "nation": "Italy", "league": "Serie A", "club": "AS Roma", "pace": 79, "shooting": 84, "passing": 88, "dribbling": 87, "defending": 52, "physical": 70, "rarity": "raregold", "image_path": null },
|
||||||
|
{ "id": "card_raregold_003", "name": "Sven Bauer", "overall": 87, "position": "CB", "nation": "Germany", "league": "Bundesliga", "club": "Bayer Leverkusen", "pace": 82, "shooting": 44, "passing": 75, "dribbling": 72, "defending": 89, "physical": 88, "rarity": "raregold", "image_path": null },
|
||||||
|
{ "id": "card_raregold_004", "name": "Nicolás Paredes", "overall": 89, "position": "LW", "nation": "Argentina", "league": "Primera Division", "club": "Boca Juniors", "pace": 93, "shooting": 85, "passing": 82, "dribbling": 91, "defending": 45, "physical": 72, "rarity": "raregold", "image_path": null },
|
||||||
|
{ "id": "card_raregold_005", "name": "Antoine Mercier", "overall": 86, "position": "CM", "nation": "France", "league": "Ligue 1", "club": "Paris Saint-Germain", "pace": 80, "shooting": 78, "passing": 89, "dribbling": 84, "defending": 74, "physical": 76, "rarity": "raregold", "image_path": null },
|
||||||
|
{ "id": "card_raregold_006", "name": "Pedro Oliveira", "overall": 85, "position": "GK", "nation": "Portugal", "league": "Primeira Liga", "club": "Benfica", "pace": 52, "shooting": 15, "passing": 70, "dribbling": 48, "defending": 87, "physical": 82, "rarity": "raregold", "image_path": null },
|
||||||
|
{ "id": "card_raregold_007", "name": "Marcos Ibáñez", "overall": 87, "position": "RB", "nation": "Spain", "league": "La Liga", "club": "Atletico Madrid", "pace": 86, "shooting": 62, "passing": 80, "dribbling": 82, "defending": 87, "physical": 78, "rarity": "raregold", "image_path": null },
|
||||||
|
{ "id": "card_raregold_008", "name": "Samuel Osei", "overall": 86, "position": "CDM", "nation": "Ghana", "league": "Premier League", "club": "Chelsea", "pace": 78, "shooting": 65, "passing": 82, "dribbling": 78, "defending": 88, "physical": 86, "rarity": "raregold", "image_path": null },
|
||||||
|
{ "id": "card_raregold_009", "name": "Jin-Ho Lee", "overall": 85, "position": "RW", "nation": "South Korea", "league": "Bundesliga", "club": "RB Leipzig", "pace": 91, "shooting": 82, "passing": 78, "dribbling": 88, "defending": 43, "physical": 66, "rarity": "raregold", "image_path": null },
|
||||||
|
{ "id": "card_raregold_010", "name": "Dmitri Volkov", "overall": 87, "position": "LB", "nation": "Russia", "league": "Premier League", "club": "Arsenal", "pace": 84, "shooting": 58, "passing": 82, "dribbling": 80, "defending": 88, "physical": 80, "rarity": "raregold", "image_path": null }
|
||||||
|
]
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
[
|
||||||
|
{ "id": "card_silver_001", "name": "Rodrigo Alves", "overall": 72, "position": "ST", "nation": "Brazil", "league": "Brasileirao", "club": "Athletico Paranaense", "pace": 78, "shooting": 73, "passing": 63, "dribbling": 72, "defending": 34, "physical": 71, "rarity": "silver", "image_path": null },
|
||||||
|
{ "id": "card_silver_002", "name": "Luca Martini", "overall": 70, "position": "CM", "nation": "Italy", "league": "Serie B", "club": "Frosinone", "pace": 66, "shooting": 65, "passing": 73, "dribbling": 70, "defending": 62, "physical": 67, "rarity": "silver", "image_path": null },
|
||||||
|
{ "id": "card_silver_003", "name": "Marcus Webb", "overall": 71, "position": "CB", "nation": "England", "league": "EFL Championship", "club": "Middlesbrough", "pace": 68, "shooting": 30, "passing": 58, "dribbling": 56, "defending": 73, "physical": 76, "rarity": "silver", "image_path": null },
|
||||||
|
{ "id": "card_silver_004", "name": "Rafael Delgado", "overall": 73, "position": "LB", "nation": "Argentina", "league": "Primera Division", "club": "Independiente", "pace": 74, "shooting": 52, "passing": 70, "dribbling": 72, "defending": 74, "physical": 66, "rarity": "silver", "image_path": null },
|
||||||
|
{ "id": "card_silver_005", "name": "Jan Horak", "overall": 69, "position": "GK", "nation": "Czech Republic", "league": "Fortuna Liga", "club": "SK Sigma Olomouc", "pace": 44, "shooting": 13, "passing": 52, "dribbling": 36, "defending": 70, "physical": 68, "rarity": "silver", "image_path": null },
|
||||||
|
{ "id": "card_silver_006", "name": "Abdoulaye Diallo", "overall": 71, "position": "CDM", "nation": "Senegal", "league": "Ligue 1 Senegal", "club": "Casa Sports", "pace": 68, "shooting": 55, "passing": 68, "dribbling": 65, "defending": 72, "physical": 74, "rarity": "silver", "image_path": null },
|
||||||
|
{ "id": "card_silver_007", "name": "Pablo Moreno", "overall": 72, "position": "RW", "nation": "Spain", "league": "Segunda Division", "club": "Girona FC", "pace": 80, "shooting": 69, "passing": 66, "dribbling": 76, "defending": 38, "physical": 60, "rarity": "silver", "image_path": null },
|
||||||
|
{ "id": "card_silver_008", "name": "Tomas Novak", "overall": 70, "position": "CAM", "nation": "Slovakia", "league": "Fortuna liga SK", "club": "Slovan Bratislava", "pace": 70, "shooting": 67, "passing": 72, "dribbling": 73, "defending": 42, "physical": 58, "rarity": "silver", "image_path": null },
|
||||||
|
{ "id": "card_silver_009", "name": "Ousmane Balde", "overall": 73, "position": "LW", "nation": "Guinea", "league": "Ligue 1 France", "club": "Stade Brestois", "pace": 84, "shooting": 70, "passing": 65, "dribbling": 78, "defending": 35, "physical": 62, "rarity": "silver", "image_path": null },
|
||||||
|
{ "id": "card_silver_010", "name": "Henrik Larsen", "overall": 69, "position": "RB", "nation": "Denmark", "league": "Superliga", "club": "AGF Aarhus", "pace": 71, "shooting": 46, "passing": 65, "dribbling": 68, "defending": 70, "physical": 65, "rarity": "silver", "image_path": null },
|
||||||
|
{ "id": "card_silver_011", "name": "Kenji Watanabe", "overall": 70, "position": "CM", "nation": "Japan", "league": "J1 League", "club": "Urawa Red Diamonds", "pace": 69, "shooting": 63, "passing": 72, "dribbling": 71, "defending": 60, "physical": 61, "rarity": "silver", "image_path": null },
|
||||||
|
{ "id": "card_silver_012", "name": "Bogdan Vasylenko", "overall": 68, "position": "CB", "nation": "Ukraine", "league": "Premier League UA", "club": "Dynamo Kyiv B", "pace": 65, "shooting": 28, "passing": 57, "dribbling": 52, "defending": 70, "physical": 72, "rarity": "silver", "image_path": null },
|
||||||
|
{ "id": "card_silver_013", "name": "Rashid Al-Farsi", "overall": 67, "position": "ST", "nation": "Saudi Arabia", "league": "Saudi Pro League", "club": "Al-Fayha", "pace": 72, "shooting": 68, "passing": 56, "dribbling": 66, "defending": 27, "physical": 65, "rarity": "silver", "image_path": null },
|
||||||
|
{ "id": "card_silver_014", "name": "Esteban Varela", "overall": 71, "position": "CDM", "nation": "Uruguay", "league": "Primera Division UY", "club": "Defensor Sporting", "pace": 64, "shooting": 54, "passing": 68, "dribbling": 64, "defending": 73, "physical": 72, "rarity": "silver", "image_path": null },
|
||||||
|
{ "id": "card_silver_015", "name": "Kevin Mbaye", "overall": 72, "position": "RM", "nation": "Senegal", "league": "Belgian First Division B", "club": "Beerschot VA", "pace": 82, "shooting": 67, "passing": 64, "dribbling": 74, "defending": 36, "physical": 61, "rarity": "silver", "image_path": null },
|
||||||
|
{ "id": "card_silver_016", "name": "Mateusz Kowalczyk", "overall": 70, "position": "LB", "nation": "Poland", "league": "Ekstraklasa", "club": "Lechia Gdansk", "pace": 72, "shooting": 48, "passing": 67, "dribbling": 68, "defending": 71, "physical": 64, "rarity": "silver", "image_path": null },
|
||||||
|
{ "id": "card_silver_017", "name": "Ali Hassan", "overall": 68, "position": "GK", "nation": "Tunisia", "league": "Ligue Professionnelle 1", "club": "Espérance Sportive de Tunis", "pace": 43, "shooting": 11, "passing": 51, "dribbling": 35, "defending": 69, "physical": 66, "rarity": "silver", "image_path": null },
|
||||||
|
{ "id": "card_silver_018", "name": "Gregor Schmid", "overall": 71, "position": "CM", "nation": "Germany", "league": "3. Liga", "club": "SC Freiburg II", "pace": 67, "shooting": 64, "passing": 72, "dribbling": 69, "defending": 63, "physical": 66, "rarity": "silver", "image_path": null },
|
||||||
|
{ "id": "card_silver_019", "name": "Oscar Lindqvist", "overall": 69, "position": "CF", "nation": "Sweden", "league": "Allsvenskan", "club": "IF Elfsborg", "pace": 73, "shooting": 70, "passing": 60, "dribbling": 68, "defending": 30, "physical": 67, "rarity": "silver", "image_path": null },
|
||||||
|
{ "id": "card_silver_020", "name": "Gustavo Pinto", "overall": 73, "position": "CAM", "nation": "Brazil", "league": "Brasileirao", "club": "Fluminense", "pace": 74, "shooting": 69, "passing": 75, "dribbling": 77, "defending": 40, "physical": 58, "rarity": "silver", "image_path": null }
|
||||||
|
]
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"id": "sbc_tri_nations",
|
||||||
|
"name": "Tri-Nations",
|
||||||
|
"description": "Field 11 players featuring at least one Brazilian, one Argentinian, and one Nigerian.",
|
||||||
|
"requirements": {
|
||||||
|
"squad_size": 11,
|
||||||
|
"min_overall": 60,
|
||||||
|
"max_overall": null,
|
||||||
|
"min_chemistry": null,
|
||||||
|
"required_leagues": [],
|
||||||
|
"required_nations": ["Brazil", "Argentina", "Nigeria"],
|
||||||
|
"required_clubs": [],
|
||||||
|
"min_players_from_same_league": null,
|
||||||
|
"min_players_from_same_nation": null,
|
||||||
|
"min_players_from_same_club": null
|
||||||
|
},
|
||||||
|
"reward": { "coins": 2500, "xp": 300, "pack_id": "silver_pack" },
|
||||||
|
"expires_at": null,
|
||||||
|
"repeatable": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sbc_silver_to_gold",
|
||||||
|
"name": "Silver to Gold",
|
||||||
|
"description": "Submit 11 silver-quality players (average overall 68+) for a gold pack.",
|
||||||
|
"requirements": {
|
||||||
|
"squad_size": 11,
|
||||||
|
"min_overall": 68,
|
||||||
|
"max_overall": 74,
|
||||||
|
"min_chemistry": null,
|
||||||
|
"required_leagues": [],
|
||||||
|
"required_nations": [],
|
||||||
|
"required_clubs": [],
|
||||||
|
"min_players_from_same_league": null,
|
||||||
|
"min_players_from_same_nation": null,
|
||||||
|
"min_players_from_same_club": null
|
||||||
|
},
|
||||||
|
"reward": { "coins": 0, "xp": 350, "pack_id": "gold_pack" },
|
||||||
|
"expires_at": null,
|
||||||
|
"repeatable": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sbc_league_loyalty",
|
||||||
|
"name": "League Loyalty",
|
||||||
|
"description": "Build a squad where at least 8 players share the same league.",
|
||||||
|
"requirements": {
|
||||||
|
"squad_size": 11,
|
||||||
|
"min_overall": 62,
|
||||||
|
"max_overall": null,
|
||||||
|
"min_chemistry": null,
|
||||||
|
"required_leagues": [],
|
||||||
|
"required_nations": [],
|
||||||
|
"required_clubs": [],
|
||||||
|
"min_players_from_same_league": 8,
|
||||||
|
"min_players_from_same_nation": null,
|
||||||
|
"min_players_from_same_club": null
|
||||||
|
},
|
||||||
|
"reward": { "coins": 1500, "xp": 200, "pack_id": null },
|
||||||
|
"expires_at": null,
|
||||||
|
"repeatable": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sbc_african_stars",
|
||||||
|
"name": "African Stars",
|
||||||
|
"description": "Celebrate African football — need at least one player from Ghana and one from Senegal.",
|
||||||
|
"requirements": {
|
||||||
|
"squad_size": 11,
|
||||||
|
"min_overall": 60,
|
||||||
|
"max_overall": null,
|
||||||
|
"min_chemistry": null,
|
||||||
|
"required_leagues": [],
|
||||||
|
"required_nations": ["Ghana", "Senegal"],
|
||||||
|
"required_clubs": [],
|
||||||
|
"min_players_from_same_league": null,
|
||||||
|
"min_players_from_same_nation": null,
|
||||||
|
"min_players_from_same_club": null
|
||||||
|
},
|
||||||
|
"reward": { "coins": 1000, "xp": 150, "pack_id": "bronze_pack" },
|
||||||
|
"expires_at": null,
|
||||||
|
"repeatable": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sbc_gold_standard",
|
||||||
|
"name": "Gold Standard",
|
||||||
|
"description": "Submit 11 high-quality players with an average overall of 76+.",
|
||||||
|
"requirements": {
|
||||||
|
"squad_size": 11,
|
||||||
|
"min_overall": 76,
|
||||||
|
"max_overall": null,
|
||||||
|
"min_chemistry": null,
|
||||||
|
"required_leagues": [],
|
||||||
|
"required_nations": [],
|
||||||
|
"required_clubs": [],
|
||||||
|
"min_players_from_same_league": null,
|
||||||
|
"min_players_from_same_nation": null,
|
||||||
|
"min_players_from_same_club": null
|
||||||
|
},
|
||||||
|
"reward": { "coins": 3000, "xp": 500, "pack_id": "rare_gold_pack" },
|
||||||
|
"expires_at": null,
|
||||||
|
"repeatable": false
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -52,14 +52,22 @@ pub async fn build(pool: Pool, cfg: Config) -> Result<Router> {
|
|||||||
.route("/profile", get(routes::profile::get_profile))
|
.route("/profile", get(routes::profile::get_profile))
|
||||||
.route("/club", get(routes::club::get_club))
|
.route("/club", get(routes::club::get_club))
|
||||||
.route("/cards", get(routes::cards::get_cards))
|
.route("/cards", get(routes::cards::get_cards))
|
||||||
|
.route("/cards/:card_id", get(routes::cards::get_card))
|
||||||
.route("/collection", get(routes::cards::get_collection))
|
.route("/collection", get(routes::cards::get_collection))
|
||||||
.route("/packs", get(routes::packs::get_packs))
|
.route("/packs", get(routes::packs::get_packs))
|
||||||
|
.route("/packs/buy", post(routes::packs::post_buy_pack))
|
||||||
.route("/packs/open/:pack_id", post(routes::packs::post_open_pack))
|
.route("/packs/open/:pack_id", post(routes::packs::post_open_pack))
|
||||||
.route("/squad", get(routes::squad::get_squad))
|
.route("/squad", get(routes::squad::get_squad))
|
||||||
.route("/squad", post(routes::squad::post_squad))
|
.route("/squad", post(routes::squad::post_squad))
|
||||||
.route("/objectives", get(routes::objectives::get_objectives))
|
.route("/objectives", get(routes::objectives::get_objectives))
|
||||||
|
.route(
|
||||||
|
"/objectives/claim",
|
||||||
|
post(routes::objectives::post_claim_objective),
|
||||||
|
)
|
||||||
|
.route("/matches", get(routes::matches::get_matches))
|
||||||
.route("/matches/result", post(routes::matches::post_match_result))
|
.route("/matches/result", post(routes::matches::post_match_result))
|
||||||
.route("/sbc", get(routes::sbc::get_sbcs))
|
.route("/sbc", get(routes::sbc::get_sbcs))
|
||||||
|
.route("/sbc/:sbc_id", get(routes::sbc::get_sbc))
|
||||||
.route("/sbc/submit", post(routes::sbc::post_sbc_submit))
|
.route("/sbc/submit", post(routes::sbc::post_sbc_submit))
|
||||||
.route("/market", get(routes::market::get_market))
|
.route("/market", get(routes::market::get_market))
|
||||||
.route("/market/buy", post(routes::market::post_market_buy))
|
.route("/market/buy", post(routes::market::post_market_buy))
|
||||||
|
|||||||
@@ -10,6 +10,10 @@ pub async fn init_pool(database_url: &str) -> Result<Pool> {
|
|||||||
.max_connections(5)
|
.max_connections(5)
|
||||||
.connect(database_url)
|
.connect(database_url)
|
||||||
.await?;
|
.await?;
|
||||||
|
sqlx::query("PRAGMA journal_mode=WAL")
|
||||||
|
.execute(&pool)
|
||||||
|
.await?;
|
||||||
|
sqlx::query("PRAGMA foreign_keys=ON").execute(&pool).await?;
|
||||||
Ok(pool)
|
Ok(pool)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,3 +55,11 @@ pub struct ObjectiveWithProgress {
|
|||||||
pub completed: bool,
|
pub completed: bool,
|
||||||
pub claimed: bool,
|
pub claimed: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize)]
|
||||||
|
pub struct ClaimRewardResult {
|
||||||
|
pub objective_id: String,
|
||||||
|
pub coins_granted: i64,
|
||||||
|
pub xp_granted: i64,
|
||||||
|
pub pack_granted: Option<String>,
|
||||||
|
}
|
||||||
|
|||||||
+13
-2
@@ -1,5 +1,5 @@
|
|||||||
use axum::{
|
use axum::{
|
||||||
extract::{Query, State},
|
extract::{Path, Query, State},
|
||||||
Json,
|
Json,
|
||||||
};
|
};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
@@ -7,7 +7,7 @@ use serde_json::{json, Value};
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
app::AppState,
|
app::AppState,
|
||||||
error::AppResult,
|
error::{AppError, AppResult},
|
||||||
models::card::OwnedCard,
|
models::card::OwnedCard,
|
||||||
services::{club as club_svc, profile as profile_svc},
|
services::{club as club_svc, profile as profile_svc},
|
||||||
};
|
};
|
||||||
@@ -18,6 +18,17 @@ pub struct CardQuery {
|
|||||||
pub position: Option<String>,
|
pub position: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn get_card(
|
||||||
|
State(state): State<AppState>,
|
||||||
|
Path(card_id): Path<String>,
|
||||||
|
) -> AppResult<Json<Value>> {
|
||||||
|
let card = state
|
||||||
|
.card_db
|
||||||
|
.get(&card_id)
|
||||||
|
.ok_or_else(|| AppError::NotFound(format!("card '{card_id}' not found")))?;
|
||||||
|
Ok(Json(json!({ "card": card })))
|
||||||
|
}
|
||||||
|
|
||||||
pub async fn get_cards(
|
pub async fn get_cards(
|
||||||
State(state): State<AppState>,
|
State(state): State<AppState>,
|
||||||
Query(query): Query<CardQuery>,
|
Query(query): Query<CardQuery>,
|
||||||
|
|||||||
+42
-2
@@ -1,12 +1,52 @@
|
|||||||
use axum::{extract::State, Json};
|
use axum::{
|
||||||
|
extract::{Query, State},
|
||||||
|
Json,
|
||||||
|
};
|
||||||
|
use serde::Deserialize;
|
||||||
|
use serde_json::{json, Value};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
app::AppState,
|
app::AppState,
|
||||||
error::AppResult,
|
error::AppResult,
|
||||||
models::match_result::{MatchRewardResult, SubmitMatchRequest},
|
models::match_result::{Match, MatchRewardResult, SubmitMatchRequest},
|
||||||
services::{club as club_svc, match_service, profile as profile_svc},
|
services::{club as club_svc, match_service, profile as profile_svc},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
pub struct MatchHistoryQuery {
|
||||||
|
pub limit: Option<i64>,
|
||||||
|
pub mode: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn get_matches(
|
||||||
|
State(state): State<AppState>,
|
||||||
|
Query(query): Query<MatchHistoryQuery>,
|
||||||
|
) -> AppResult<Json<Value>> {
|
||||||
|
let profile = profile_svc::get_active_profile(&state.pool).await?;
|
||||||
|
let limit = query.limit.unwrap_or(20).clamp(1, 100);
|
||||||
|
|
||||||
|
let matches = if let Some(mode) = &query.mode {
|
||||||
|
sqlx::query_as::<_, Match>(
|
||||||
|
"SELECT id, profile_id, squad_id, opponent_name, goals_for, goals_against, outcome, coins_awarded, xp_awarded, mode, played_at FROM matches WHERE profile_id = ? AND mode = ? ORDER BY played_at DESC LIMIT ?"
|
||||||
|
)
|
||||||
|
.bind(&profile.id)
|
||||||
|
.bind(mode)
|
||||||
|
.bind(limit)
|
||||||
|
.fetch_all(&state.pool)
|
||||||
|
.await?
|
||||||
|
} else {
|
||||||
|
sqlx::query_as::<_, Match>(
|
||||||
|
"SELECT id, profile_id, squad_id, opponent_name, goals_for, goals_against, outcome, coins_awarded, xp_awarded, mode, played_at FROM matches WHERE profile_id = ? ORDER BY played_at DESC LIMIT ?"
|
||||||
|
)
|
||||||
|
.bind(&profile.id)
|
||||||
|
.bind(limit)
|
||||||
|
.fetch_all(&state.pool)
|
||||||
|
.await?
|
||||||
|
};
|
||||||
|
|
||||||
|
Ok(Json(json!({ "matches": matches, "total": matches.len() })))
|
||||||
|
}
|
||||||
|
|
||||||
pub async fn post_match_result(
|
pub async fn post_match_result(
|
||||||
State(state): State<AppState>,
|
State(state): State<AppState>,
|
||||||
Json(req): Json<SubmitMatchRequest>,
|
Json(req): Json<SubmitMatchRequest>,
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
use axum::{extract::State, Json};
|
use axum::{extract::State, Json};
|
||||||
|
use serde::Deserialize;
|
||||||
use serde_json::{json, Value};
|
use serde_json::{json, Value};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
app::AppState,
|
app::AppState,
|
||||||
error::AppResult,
|
error::AppResult,
|
||||||
services::{objective as obj_svc, profile as profile_svc},
|
services::{club as club_svc, objective as obj_svc, profile as profile_svc},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub async fn get_objectives(State(state): State<AppState>) -> AppResult<Json<Value>> {
|
pub async fn get_objectives(State(state): State<AppState>) -> AppResult<Json<Value>> {
|
||||||
@@ -13,3 +14,25 @@ pub async fn get_objectives(State(state): State<AppState>) -> AppResult<Json<Val
|
|||||||
obj_svc::get_objectives_with_progress(&state.pool, &profile.id, &state.obj_defs).await?;
|
obj_svc::get_objectives_with_progress(&state.pool, &profile.id, &state.obj_defs).await?;
|
||||||
Ok(Json(json!({ "objectives": objectives })))
|
Ok(Json(json!({ "objectives": objectives })))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
pub struct ClaimRequest {
|
||||||
|
pub objective_id: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn post_claim_objective(
|
||||||
|
State(state): State<AppState>,
|
||||||
|
Json(req): Json<ClaimRequest>,
|
||||||
|
) -> AppResult<Json<Value>> {
|
||||||
|
let profile = profile_svc::get_active_profile(&state.pool).await?;
|
||||||
|
let club = club_svc::get_club_by_profile(&state.pool, &profile.id).await?;
|
||||||
|
let reward = obj_svc::claim_objective(
|
||||||
|
&state.pool,
|
||||||
|
&profile.id,
|
||||||
|
&club.id,
|
||||||
|
&state.obj_defs,
|
||||||
|
&req.objective_id,
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
Ok(Json(json!({ "claimed": true, "reward": reward })))
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ use axum::{
|
|||||||
extract::{Path, State},
|
extract::{Path, State},
|
||||||
Json,
|
Json,
|
||||||
};
|
};
|
||||||
|
use serde::Deserialize;
|
||||||
use serde_json::{json, Value};
|
use serde_json::{json, Value};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
@@ -11,6 +12,29 @@ use crate::{
|
|||||||
services::{club as club_svc, objective, pack as pack_svc, profile as profile_svc, statistics},
|
services::{club as club_svc, objective, pack as pack_svc, profile as profile_svc, statistics},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
pub struct BuyPackRequest {
|
||||||
|
pub pack_definition_id: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn post_buy_pack(
|
||||||
|
State(state): State<AppState>,
|
||||||
|
Json(req): Json<BuyPackRequest>,
|
||||||
|
) -> AppResult<Json<Value>> {
|
||||||
|
let profile = profile_svc::get_active_profile(&state.pool).await?;
|
||||||
|
let club = club_svc::get_club_by_profile(&state.pool, &profile.id).await?;
|
||||||
|
let pack = pack_svc::buy_pack(
|
||||||
|
&state.pool,
|
||||||
|
&state.pack_defs,
|
||||||
|
&club.id,
|
||||||
|
&req.pack_definition_id,
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
Ok(Json(
|
||||||
|
json!({ "pack": pack, "message": "Pack purchased successfully" }),
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
pub async fn get_packs(State(state): State<AppState>) -> AppResult<Json<Value>> {
|
pub async fn get_packs(State(state): State<AppState>) -> AppResult<Json<Value>> {
|
||||||
let profile = profile_svc::get_active_profile(&state.pool).await?;
|
let profile = profile_svc::get_active_profile(&state.pool).await?;
|
||||||
let club = club_svc::get_club_by_profile(&state.pool, &profile.id).await?;
|
let club = club_svc::get_club_by_profile(&state.pool, &profile.id).await?;
|
||||||
|
|||||||
+17
-2
@@ -1,9 +1,12 @@
|
|||||||
use axum::{extract::State, Json};
|
use axum::{
|
||||||
|
extract::{Path, State},
|
||||||
|
Json,
|
||||||
|
};
|
||||||
use serde_json::{json, Value};
|
use serde_json::{json, Value};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
app::AppState,
|
app::AppState,
|
||||||
error::AppResult,
|
error::{AppError, AppResult},
|
||||||
models::sbc::{SbcResult, SubmitSbcRequest},
|
models::sbc::{SbcResult, SubmitSbcRequest},
|
||||||
services::{club as club_svc, profile as profile_svc, sbc as sbc_svc},
|
services::{club as club_svc, profile as profile_svc, sbc as sbc_svc},
|
||||||
};
|
};
|
||||||
@@ -12,6 +15,18 @@ pub async fn get_sbcs(State(state): State<AppState>) -> AppResult<Json<Value>> {
|
|||||||
Ok(Json(json!({ "sbcs": state.sbc_defs })))
|
Ok(Json(json!({ "sbcs": state.sbc_defs })))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn get_sbc(
|
||||||
|
State(state): State<AppState>,
|
||||||
|
Path(sbc_id): Path<String>,
|
||||||
|
) -> AppResult<Json<Value>> {
|
||||||
|
let sbc = state
|
||||||
|
.sbc_defs
|
||||||
|
.iter()
|
||||||
|
.find(|s| s.id == sbc_id)
|
||||||
|
.ok_or_else(|| AppError::NotFound(format!("SBC '{sbc_id}' not found")))?;
|
||||||
|
Ok(Json(json!({ "sbc": sbc })))
|
||||||
|
}
|
||||||
|
|
||||||
pub async fn post_sbc_submit(
|
pub async fn post_sbc_submit(
|
||||||
State(state): State<AppState>,
|
State(state): State<AppState>,
|
||||||
Json(req): Json<SubmitSbcRequest>,
|
Json(req): Json<SubmitSbcRequest>,
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
db::Pool,
|
db::Pool,
|
||||||
error::AppResult,
|
error::{AppError, AppResult},
|
||||||
models::objective::{ObjectiveDefinition, ObjectiveProgress, ObjectiveWithProgress},
|
models::objective::{
|
||||||
|
ClaimRewardResult, ObjectiveDefinition, ObjectiveProgress, ObjectiveWithProgress,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
@@ -120,3 +122,54 @@ pub async fn increment_metric(
|
|||||||
|
|
||||||
Ok(completed_ids)
|
Ok(completed_ids)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn claim_objective(
|
||||||
|
pool: &Pool,
|
||||||
|
profile_id: &str,
|
||||||
|
club_id: &str,
|
||||||
|
defs: &[ObjectiveDefinition],
|
||||||
|
objective_id: &str,
|
||||||
|
) -> AppResult<ClaimRewardResult> {
|
||||||
|
let prog = sqlx::query_as::<_, ObjectiveProgress>(
|
||||||
|
"SELECT id, profile_id, objective_id, current, completed, claimed, updated_at FROM objective_progress WHERE profile_id = ? AND objective_id = ?"
|
||||||
|
)
|
||||||
|
.bind(profile_id)
|
||||||
|
.bind(objective_id)
|
||||||
|
.fetch_optional(pool)
|
||||||
|
.await?
|
||||||
|
.ok_or_else(|| AppError::NotFound("objective not started yet".into()))?;
|
||||||
|
|
||||||
|
if !prog.completed {
|
||||||
|
return Err(AppError::BadRequest("objective not completed yet".into()));
|
||||||
|
}
|
||||||
|
if prog.claimed {
|
||||||
|
return Err(AppError::Conflict("reward already claimed".into()));
|
||||||
|
}
|
||||||
|
|
||||||
|
let def = defs
|
||||||
|
.iter()
|
||||||
|
.find(|d| d.id == objective_id)
|
||||||
|
.ok_or_else(|| AppError::NotFound(format!("objective '{objective_id}' not found")))?;
|
||||||
|
|
||||||
|
sqlx::query("UPDATE objective_progress SET claimed = 1 WHERE id = ?")
|
||||||
|
.bind(&prog.id)
|
||||||
|
.execute(pool)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
if def.reward_coins > 0 {
|
||||||
|
crate::services::club::add_coins(pool, club_id, def.reward_coins).await?;
|
||||||
|
}
|
||||||
|
if def.reward_xp > 0 {
|
||||||
|
crate::services::profile::add_xp(pool, profile_id, def.reward_xp).await?;
|
||||||
|
}
|
||||||
|
if let Some(pack_id) = &def.reward_pack_id {
|
||||||
|
crate::services::pack::grant_pack(pool, club_id, pack_id).await?;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(ClaimRewardResult {
|
||||||
|
objective_id: objective_id.to_string(),
|
||||||
|
coins_granted: def.reward_coins,
|
||||||
|
xp_granted: def.reward_xp,
|
||||||
|
pack_granted: def.reward_pack_id.clone(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -133,6 +133,23 @@ pub async fn open_pack(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn buy_pack(
|
||||||
|
pool: &Pool,
|
||||||
|
pack_defs: &[PackDefinition],
|
||||||
|
club_id: &str,
|
||||||
|
definition_id: &str,
|
||||||
|
) -> AppResult<Pack> {
|
||||||
|
let def = pack_defs
|
||||||
|
.iter()
|
||||||
|
.find(|d| d.id == definition_id)
|
||||||
|
.ok_or_else(|| {
|
||||||
|
AppError::NotFound(format!("pack definition '{definition_id}' not found"))
|
||||||
|
})?;
|
||||||
|
|
||||||
|
crate::services::club::spend_coins(pool, club_id, def.cost_coins).await?;
|
||||||
|
grant_pack(pool, club_id, definition_id).await
|
||||||
|
}
|
||||||
|
|
||||||
pub async fn get_unopened_packs(pool: &Pool, club_id: &str) -> AppResult<Vec<Pack>> {
|
pub async fn get_unopened_packs(pool: &Pool, club_id: &str) -> AppResult<Vec<Pack>> {
|
||||||
let packs = sqlx::query_as::<_, Pack>(
|
let packs = sqlx::query_as::<_, Pack>(
|
||||||
"SELECT id, club_id, definition_id, opened, created_at FROM packs WHERE club_id = ? AND opened = 0"
|
"SELECT id, club_id, definition_id, opened, created_at FROM packs WHERE club_id = ? AND opened = 0"
|
||||||
|
|||||||
Reference in New Issue
Block a user