Spaces:
Running
Running
ChenyuRabbitLove
commited on
Commit
•
a5a667b
1
Parent(s):
aaa02c0
feat: add achivement module to show achivement info for non-logged in player
Browse files- app.py +2 -1
- utils/mes_achievements.py +42 -0
app.py
CHANGED
@@ -5,6 +5,7 @@ import gradio as gr
|
|
5 |
|
6 |
from theme import Seafoam
|
7 |
from utils.mes_player_model import Player
|
|
|
8 |
from utils.utils import (
|
9 |
get_content,
|
10 |
render_player_data,
|
@@ -22,7 +23,7 @@ def get_player_info(player_backend_user_id):
|
|
22 |
else:
|
23 |
logging.info(f"No data found for player ID {player_backend_user_id}. Initializing new player data.")
|
24 |
|
25 |
-
new_player = Player(player_backend_user_id=player_backend_user_id, init=True)
|
26 |
return new_player.to_dict()
|
27 |
|
28 |
|
|
|
5 |
|
6 |
from theme import Seafoam
|
7 |
from utils.mes_player_model import Player
|
8 |
+
from utils.mes_achievements import Achievement
|
9 |
from utils.utils import (
|
10 |
get_content,
|
11 |
render_player_data,
|
|
|
23 |
else:
|
24 |
logging.info(f"No data found for player ID {player_backend_user_id}. Initializing new player data.")
|
25 |
|
26 |
+
new_player = Player(player_backend_user_id=player_backend_user_id, init=True, available_achievements=Achievement.get_available_achievements())
|
27 |
return new_player.to_dict()
|
28 |
|
29 |
|
utils/mes_achievements.py
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from typing import List
|
2 |
+
|
3 |
+
class Achievement:
|
4 |
+
achievements_list = [
|
5 |
+
"participation_star",
|
6 |
+
"star_score_settler",
|
7 |
+
"interstellar_traveler_I",
|
8 |
+
"interstellar_traveler_II",
|
9 |
+
"interstellar_traveler_III",
|
10 |
+
"interstellar_traveler_IV",
|
11 |
+
"consistent_climbers_club_I",
|
12 |
+
"consistent_climbers_club_II",
|
13 |
+
"consistent_climbers_club_III",
|
14 |
+
"star_cluster_detector",
|
15 |
+
"starry_vigilante",
|
16 |
+
"planetary_decoder",
|
17 |
+
"galactic_librarian",
|
18 |
+
"energy_enthusiast_I",
|
19 |
+
"energy_enthusiast_II",
|
20 |
+
"energy_enthusiast_III",
|
21 |
+
"energy_enthusiast_IV",
|
22 |
+
"knowledge_planet_explorer_I",
|
23 |
+
"knowledge_planet_explorer_II",
|
24 |
+
"scientific_expedition_explorer_I",
|
25 |
+
"scientific_expedition_explorer_II",
|
26 |
+
"cultural_celebration_explorer_I",
|
27 |
+
"cultural_celebration_explorer_II",
|
28 |
+
"youth_literature_explorer_I",
|
29 |
+
"youth_literature_explorer_II",
|
30 |
+
"path_to_wealth_explorer_I",
|
31 |
+
"path_to_wealth_explorer_II",
|
32 |
+
"cultivation_universe_explorer_I",
|
33 |
+
"cultivation_universe_explorer_II",
|
34 |
+
"electronic_and_information_college_explorer_I",
|
35 |
+
"electronic_and_information_college_explorer_II",
|
36 |
+
"star_warrior",
|
37 |
+
"routine_checker",
|
38 |
+
]
|
39 |
+
|
40 |
+
@classmethod
|
41 |
+
def get_available_achievements(cls) -> List[str]:
|
42 |
+
return cls.achievements_list
|