SGP: enable get_yourchange & fix order
This commit is contained in:
parent
4a86eccf60
commit
5e109800c0
14 changed files with 1704 additions and 1607 deletions
|
|
@ -315,6 +315,9 @@ if "multi_promotion" in param:
|
|||
#read config
|
||||
multi_pro_config_file = open(directory_to_process + "/event/"+ filename)
|
||||
multi_pro_config = json.load(multi_pro_config_file)
|
||||
|
||||
# if has any 'reorder'
|
||||
order_list: list = []
|
||||
|
||||
index = 0
|
||||
promotion_name = []
|
||||
|
|
@ -424,6 +427,33 @@ if "multi_promotion" in param:
|
|||
filter_sm = [ pd for pd in season_pass_menu[current_season] if pd.endswith("sm")]
|
||||
print("[SM] expect at least 4, ", len(filter_sm))
|
||||
|
||||
has_reorder = "reorder" in promotion_config.keys()
|
||||
# interact_idx = (-1, -1)
|
||||
# do load list
|
||||
if has_reorder:
|
||||
print("reorder mode")
|
||||
order_list = promotion_config["reorder"]
|
||||
print(json.dumps(order_list, indent=2), " while ", json.dumps(filter_sm, indent=2))
|
||||
buffer_key = ""
|
||||
# sort by has_order
|
||||
for filtered in filter_sm:
|
||||
print("try reorder", filtered, order_list)
|
||||
# get index from order
|
||||
expect_index = order_list.index(filtered)
|
||||
# interact_idx[0] = expect_index
|
||||
print("get expect = ", expect_index)
|
||||
current_index = filter_sm.index(filtered)
|
||||
# interact_idx[1] = current_index
|
||||
print("get current = ", current_index)
|
||||
is_matched_index = expect_index != -1 and expect_index == current_index
|
||||
print(f"check match {filtered}: ", not is_matched_index)
|
||||
if not is_matched_index:
|
||||
print(f"swap current={filtered}@{current_index} to position@{expect_index} was {filter_sm[expect_index]}")
|
||||
buffer_key = filter_sm[expect_index]
|
||||
filter_sm[expect_index] = filtered
|
||||
filter_sm[current_index] = buffer_key
|
||||
buffer_key = ""
|
||||
|
||||
# try get block
|
||||
generated_block_buffer = ""
|
||||
for sm_menu in filter_sm:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue