Jung commited on
Commit
d7e6f22
·
1 Parent(s): 6300742

handle cb3

Browse files
Files changed (1) hide show
  1. app.py +18 -27
app.py CHANGED
@@ -92,18 +92,30 @@ def display_heroes_from_df(df,display_cols=display_cols, show_df=True):
92
  def return_costume_list(df0, hero_name):
93
  assert hero_name in df0.name.values
94
 
 
 
95
  if hero_name[-2:] == "C2":
96
- return ['None', 'CB1', 'CB2']
 
 
 
 
97
  elif hero_name[-2:] == " C":
98
  hero_name2 = hero_name + "2"
99
- if hero_name2 in df0.name.values: # if this hero has C2
 
 
 
100
  return ['None', 'CB1', 'CB2']
101
  else:
102
  return ['None', 'CB1']
103
  else:
104
  hero_name1 = hero_name + " C"
105
  hero_name2 = hero_name + " C2"
106
- if hero_name2 in df0.name.values: # if this hero has C2
 
 
 
107
  return ['None', 'CB1', 'CB2']
108
  elif hero_name1 in df0.name.values: # if this hero has C2
109
  return ['None', 'CB1']
@@ -158,7 +170,7 @@ st.header(f'HeroPlan Explorer')
158
  st.write('Powered by Heroplan.io : Thanks E&P community for continually update hero data.')
159
 
160
  df = pd.read_csv('heroes_ep.csv')
161
- st.write(f'### Updated: Oct 23, 2023 -- Total heroes in HeroPlan database = {len(df)}')
162
 
163
  df_extra = pd.read_csv("heroes_ep_extra.csv")
164
  all_name_extra = sorted(list(df_extra['name'].values))
@@ -187,7 +199,7 @@ if genre == ':rainbow[Heroes Explorer]':
187
  col1, col2, col3 = st.columns(3)
188
  with col1:
189
  st.header("Standard Filters:")
190
- st.write("Tips: filter costume by typing ' C' or 'C2' in the Name box.")
191
  with st.expander("Filter Options"):
192
  name_option = st.text_input(label="Name:", value="")
193
  star_option = st.selectbox(label='Star:', options=star_values, index=0)
@@ -311,27 +323,6 @@ elif genre == "Team Simulation":
311
 
312
  df_hero_all5 = pd.concat(df_hero_list)
313
 
314
- # col1, col2, col3, col4, col5, col6 = st.columns(6)
315
- # with col1:
316
- # df_hero1 = choose_hero(key="Hero1") # 'key' in st.selectbox to differentiate widgets
317
- # write_short_description(df_hero1)
318
- # with col2:
319
- # df_hero2 = choose_hero(key="Hero2")
320
- # write_short_description(df_hero2)
321
- # with col3:
322
- # df_hero3 = choose_hero(key="Hero3")
323
- # write_short_description(df_hero3)
324
- # with col4:
325
- # df_hero4 = choose_hero(key="Hero4")
326
- # write_short_description(df_hero4)
327
- # with col5:
328
- # df_hero5 = choose_hero(key="Hero5")
329
- # write_short_description(df_hero5)
330
- # with col6:
331
- # txt = st.text_area("Write your note about team synergy", max_chars=1000)
332
-
333
- # df_hero_all5 = pd.concat([df_hero1, df_hero2, df_hero3, df_hero4, df_hero5])
334
- # total_power = df_hero1['power'].values[0]+ df_hero2['power'].values[0]+ df_hero3['power'].values[0]+ df_hero4['power'].values[0]+ df_hero5['power'].values[0]
335
  st.write(f'======================')
336
  st.write(f'### Total power = {total_power}')
337
  st.write(f'======================')
@@ -361,4 +352,4 @@ else:
361
  lb_choice = st.selectbox(label='Limit Break:', options=lb_list, index=0)
362
 
363
  df_ret = return_hero_stat(df_extra, name_choice, lb_choice=lb_choice, costume_choice=costume_choice)
364
- display_heroes_from_df(df_ret,display_cols=df_ret.columns[:-2]) # display all except special-skill text
 
92
  def return_costume_list(df0, hero_name):
93
  assert hero_name in df0.name.values
94
 
95
+ if hero_name[-2:] == "C3":
96
+ return ['None', 'CB1', 'CB2', 'CB3']
97
  if hero_name[-2:] == "C2":
98
+ hero_name2 = hero_name[:-1] + "3"
99
+ if hero_name2 in df0.name.values: # if this hero has C3
100
+ return ['None', 'CB1', 'CB2', 'CB3']
101
+ else:
102
+ return ['None', 'CB1', 'CB2']
103
  elif hero_name[-2:] == " C":
104
  hero_name2 = hero_name + "2"
105
+ hero_name3 = hero_name + "3"
106
+ if hero_name3 in df0.name.values: # if this hero has C2
107
+ return ['None', 'CB1', 'CB2', 'CB3']
108
+ elif hero_name2 in df0.name.values: # if this hero has C2
109
  return ['None', 'CB1', 'CB2']
110
  else:
111
  return ['None', 'CB1']
112
  else:
113
  hero_name1 = hero_name + " C"
114
  hero_name2 = hero_name + " C2"
115
+ hero_name3 = hero_name + " C3"
116
+ if hero_name3 in df0.name.values: # if this hero has C2
117
+ return ['None', 'CB1', 'CB2', 'CB3']
118
+ elif hero_name2 in df0.name.values: # if this hero has C2
119
  return ['None', 'CB1', 'CB2']
120
  elif hero_name1 in df0.name.values: # if this hero has C2
121
  return ['None', 'CB1']
 
170
  st.write('Powered by Heroplan.io : Thanks E&P community for continually update hero data.')
171
 
172
  df = pd.read_csv('heroes_ep.csv')
173
+ st.write(f'### Updated: Nov 10, 2023 -- Total heroes in HeroPlan database = {len(df)} (including Toon Costume3)')
174
 
175
  df_extra = pd.read_csv("heroes_ep_extra.csv")
176
  all_name_extra = sorted(list(df_extra['name'].values))
 
199
  col1, col2, col3 = st.columns(3)
200
  with col1:
201
  st.header("Standard Filters:")
202
+ st.write("Tips: filter costume by typing ' C' 'C2' or 'C3' in the Name box.")
203
  with st.expander("Filter Options"):
204
  name_option = st.text_input(label="Name:", value="")
205
  star_option = st.selectbox(label='Star:', options=star_values, index=0)
 
323
 
324
  df_hero_all5 = pd.concat(df_hero_list)
325
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
326
  st.write(f'======================')
327
  st.write(f'### Total power = {total_power}')
328
  st.write(f'======================')
 
352
  lb_choice = st.selectbox(label='Limit Break:', options=lb_list, index=0)
353
 
354
  df_ret = return_hero_stat(df_extra, name_choice, lb_choice=lb_choice, costume_choice=costume_choice)
355
+ display_heroes_from_df(df_ret,display_cols=df_ret.columns[:-2]) # display all except special-skill text