@@ -15,39 +15,63 @@ def page_character_config():
1515 equip_set4_options ,
1616 weapon_options ,
1717 weapon_profession_map ,
18+ weapon_rarity_map ,
19+ weapon_char_map ,
1820 char_profession_map ,
21+ profession_chars_map ,
1922 )
2023
21- col1 , col2 , col3 = st .columns (3 )
24+ col0 , col1 , col2 , col3 , col4 , col5 , col6 , col7 = st .columns ([1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ])
25+ with col0 :
26+ profession_0 = st .selectbox (
27+ "角色1特性" ,
28+ list (profession_chars_map .keys ()),
29+ index = list (profession_chars_map .keys ()).index ("不限特性" ),
30+ key = "profession_select_0" ,
31+ )
2232 with col1 :
2333 name_box_0 = [
2434 st .selectbox (
2535 "角色1" ,
26- char_options ,
27- index = char_options .index (default_chars [0 ])
28- if len (default_chars ) > 0
36+ profession_chars_map [ profession_0 ] ,
37+ index = profession_chars_map [ profession_0 ] .index (default_chars [0 ])
38+ if len (default_chars ) > 0 and default_chars [ 0 ] in profession_chars_map [ profession_0 ]
2939 else 0 ,
3040 key = "char_select_0" ,
3141 )
3242 ]
33- with col2 :
43+ with col3 :
44+ profession_1 = st .selectbox (
45+ "角色2特性" ,
46+ list (profession_chars_map .keys ()),
47+ index = list (profession_chars_map .keys ()).index ("不限特性" ),
48+ key = "profession_select_1" ,
49+ )
50+ with col4 :
3451 name_box_1 = [
3552 st .selectbox (
3653 "角色2" ,
37- char_options ,
38- index = char_options .index (default_chars [1 ])
39- if len (default_chars ) > 1
54+ profession_chars_map [ profession_1 ] ,
55+ index = profession_chars_map [ profession_1 ] .index (default_chars [1 ])
56+ if len (default_chars ) > 1 and default_chars [ 1 ] in profession_chars_map [ profession_1 ]
4057 else 0 ,
4158 key = "char_select_1" ,
4259 )
4360 ]
44- with col3 :
61+ with col6 :
62+ profession_2 = st .selectbox (
63+ "角色3特性" ,
64+ list (profession_chars_map .keys ()),
65+ index = list (profession_chars_map .keys ()).index ("不限特性" ),
66+ key = "profession_select_2" ,
67+ )
68+ with col7 :
4569 name_box_2 = [
4670 st .selectbox (
4771 "角色3" ,
48- char_options ,
49- index = char_options .index (default_chars [2 ])
50- if len (default_chars ) > 2
72+ profession_chars_map [ profession_2 ] ,
73+ index = profession_chars_map [ profession_2 ] .index (default_chars [2 ])
74+ if len (default_chars ) > 2 and default_chars [ 2 ] in profession_chars_map [ profession_2 ]
5175 else 0 ,
5276 key = "char_select_2" ,
5377 )
@@ -62,9 +86,11 @@ def page_character_config():
6286 with st .expander (f"{ name } 的配置" ):
6387 col_weapon , col_level , col_cinema = st .columns (3 )
6488 with col_weapon :
65- show_adapted_weapon = st .session_state .get (
66- f"{ name } _show_adapted_weapon" , True
67- )
89+ show_adapted_weapon = st .session_state .get (f"{ name } _show_adapted_weapon" , True )
90+ show_rarity_s = st .session_state .get (f"{ name } _show_rarity_s" , True )
91+ show_rarity_a = st .session_state .get (f"{ name } _show_rarity_a" , True )
92+ show_rarity_b = st .session_state .get (f"{ name } _show_rarity_b" , False )
93+
6894 char_profession = char_profession_map .get (name )
6995 if show_adapted_weapon and char_profession :
7096 filtered_weapon_options = [
@@ -74,6 +100,20 @@ def page_character_config():
74100 ]
75101 else :
76102 filtered_weapon_options = list (weapon_options )
103+
104+ # 根据稀有度筛选
105+ filtered_weapon_options = [
106+ w for w in filtered_weapon_options
107+ if (show_rarity_s and weapon_rarity_map .get (w ) == "S" ) or
108+ (show_rarity_a and weapon_rarity_map .get (w ) == "A" ) or
109+ (show_rarity_b and weapon_rarity_map .get (w ) == "B" )
110+ ]
111+ rarity_order = {"S" : 0 , "A" : 1 , "B" : 2 }
112+ filtered_weapon_options = sorted (
113+ filtered_weapon_options ,
114+ key = lambda w : (rarity_order .get (weapon_rarity_map .get (w ), 3 ), w )
115+ )
116+
77117 if name in saved_char_config :
78118 current_weapon = saved_char_config [name ].get ("weapon" )
79119 else :
@@ -93,12 +133,37 @@ def page_character_config():
93133 filtered_weapon_options ,
94134 index = filtered_weapon_options .index (current_weapon ),
95135 key = f"{ name } _weapon" ,
136+ format_func = lambda x : (
137+ f"({ weapon_rarity_map .get (x , '未知' )} "
138+ f"{ ' ' + weapon_char_map .get (x ) if weapon_char_map .get (x ) else '' } ) { x } "
139+ ),
140+ )
141+
142+ col_rarity = st .columns (4 )
143+ with col_rarity [0 ]:
144+ show_adapted_weapon = st .checkbox (
145+ "只显示适配音擎" ,
146+ value = show_adapted_weapon ,
147+ key = f"{ name } _show_adapted_weapon" ,
148+ )
149+ with col_rarity [1 ]:
150+ show_rarity_s = st .checkbox (
151+ "S" ,
152+ value = show_rarity_s ,
153+ key = f"{ name } _show_rarity_s" ,
154+ )
155+ with col_rarity [2 ]:
156+ show_rarity_a = st .checkbox (
157+ "A" ,
158+ value = show_rarity_a ,
159+ key = f"{ name } _show_rarity_a" ,
160+ )
161+ with col_rarity [3 ]:
162+ show_rarity_b = st .checkbox (
163+ "B" ,
164+ value = show_rarity_b ,
165+ key = f"{ name } _show_rarity_b" ,
96166 )
97- show_adapted_weapon = st .checkbox (
98- "只显示适配音擎" ,
99- value = show_adapted_weapon ,
100- key = f"{ name } _show_adapted_weapon" ,
101- )
102167 with col_level :
103168 st .number_input (
104169 "音擎精炼等级" ,
0 commit comments