("camp_action_sort_party", 0,
"Choose what to sort by:^^(can be mixed sorting, for example, sorting stack level and then sorting party infantry to the top will make the infantry stacks to sort by level, same goes to stack amount)",
"none",
[
],
[
("sort_party_1",
[], "Sort party members by stack level.",
[
(call_script, "script_sort_party_members_stack_level"),
(display_message, "@Your party members is now sorted by stack level."),
],
),
("sort_party_2",
[], "Sort party members by stack amount.",
[
(call_script, "script_sort_party_members_stack_level"),
(try_for_parties, ":party_no"),
(assign, ":continue", 0),
(try_begin),
(eq, ":party_no", "p_main_party"),
(party_is_active, ":party_no"),
(assign, ":continue", 1),
(try_begin),
(party_stack_get_troop_id, ":cur_troop", ":party_no", 0),
(this_or_next | troop_is_hero, ":cur_troop"),
(eq, ":cur_troop", "trp_caravan_master"),
(assign, ":first_stack", 1),
(else_try),
(assign, ":first_stack", 0),
(try_end),
(try_end),
(eq, ":continue", 1),
(party_get_num_companion_stacks, ":num_stacks", ":party_no"),
(gt, ":num_stacks", ":first_stack"),
(assign, ":last_stack", ":num_stacks"),
# start to sort
(store_sub, ":num_times", ":num_stacks", ":first_stack"),
(try_for_range, ":unused", 0, ":num_times"),
# find highest-level troop
(assign, ":best_stack", -1),
(assign, ":best_level", -1),
(try_for_range, ":cur_stack", ":first_stack", ":last_stack"),
#(party_stack_get_troop_id, ":cur_troop", ":party_no", ":cur_stack"),
(party_stack_get_size, ":troop_level", "p_main_party", ":cur_stack"),
(gt, ":troop_level", ":best_level"),
(assign, ":best_level", ":troop_level"),
(assign, ":best_stack", ":cur_stack"),
(try_end),
# move to the end
(try_begin),
(gt, ":best_level", -1),
(party_stack_get_troop_id, ":stack_troop", ":party_no", ":best_stack"),
(party_stack_get_size, ":stack_size", ":party_no", ":best_stack"),
(party_stack_get_num_wounded, ":num_wounded", ":party_no", ":best_stack"),
(party_remove_members, ":party_no", ":stack_troop", ":stack_size"),
(party_add_members, ":party_no", ":stack_troop", ":stack_size"),
(party_wound_members, ":party_no", ":stack_troop", ":num_wounded"),
(val_sub, ":last_stack", 1),
(try_end),
(try_end),
(try_end),
(display_message, "@Your party members is now sorted by stack amount."),
]
),
("blank", [
],
"------------------------------",
[]),
("sort_party_3",
[], "Sort party infantry to the top.",
[
(try_for_parties, ":party_no"),
(assign, ":continue", 0),
(try_begin),
(eq, ":party_no", "p_main_party"),
(party_is_active, ":party_no"),
(assign, ":continue", 1),
(try_begin),
(party_stack_get_troop_id, ":cur_troop", ":party_no", 0),
(this_or_next | troop_is_hero, ":cur_troop"),
(eq, ":cur_troop", "trp_caravan_master"),
(assign, ":first_stack", 1),
(else_try),
(assign, ":first_stack", 0),
(try_end),
(try_end),
(eq, ":continue", 1),
(party_get_num_companion_stacks, ":num_stacks", ":party_no"),
(gt, ":num_stacks", ":first_stack"),
(assign, ":last_stack", ":num_stacks"),
# start to sort
(store_sub, ":num_times", ":num_stacks", ":first_stack"),
(try_for_range, ":unused", 0, ":num_times"),
# find highest-level troop
(assign, ":best_stack", -1),
(assign, ":best_level", -1),
(try_for_range, ":cur_stack", ":first_stack", ":last_stack"),
(party_stack_get_troop_id, ":cur_troop", ":party_no", ":cur_stack"),
(troop_get_class, ":troop_class", ":cur_troop"),
(neq, ":troop_class", 0),
#(store_character_level, ":troop_level", ":cur_troop"),
#(gt, ":troop_level", ":best_level"),
#(assign, ":best_level", ":troop_level"),
(assign, ":best_stack", ":cur_stack"),
(try_end),
# move to the end
(try_begin),
#(gt, ":best_level", -1),
(party_stack_get_troop_id, ":stack_troop", ":party_no", ":best_stack"),
(troop_get_class, ":troop_class", ":stack_troop"),
(neq, ":troop_class", 0),
(party_stack_get_size, ":stack_size", ":party_no", ":best_stack"),
(party_stack_get_num_wounded, ":num_wounded", ":party_no", ":best_stack"),
(party_remove_members, ":party_no", ":stack_troop", ":stack_size"),
(party_add_members, ":party_no", ":stack_troop", ":stack_size"),
(party_wound_members, ":party_no", ":stack_troop", ":num_wounded"),
(val_sub, ":last_stack", 1),
(try_end),
(try_end),
(try_end),
(display_message, "@Your party infantry is now sorted to the top."),
],
),
("sort_party_4",
[], "Sort party infantry to the buttom.",
[
(try_for_parties, ":party_no"),
(assign, ":continue", 0),
(try_begin),
(eq, ":party_no", "p_main_party"),
(party_is_active, ":party_no"),
(assign, ":continue", 1),
(try_begin),
(party_stack_get_troop_id, ":cur_troop", ":party_no", 0),
(this_or_next | troop_is_hero, ":cur_troop"),
(eq, ":cur_troop", "trp_caravan_master"),
(assign, ":first_stack", 1),
(else_try),
(assign, ":first_stack", 0),
(try_end),
(try_end),
(eq, ":continue", 1),
(party_get_num_companion_stacks, ":num_stacks", ":party_no"),
(gt, ":num_stacks", ":first_stack"),
(assign, ":last_stack", ":num_stacks"),
# start to sort
(store_sub, ":num_times", ":num_stacks", ":first_stack"),
(try_for_range, ":unused", 0, ":num_times"),
# find highest-level troop
(assign, ":best_stack", -1),
(assign, ":best_level", -1),
(try_for_range, ":cur_stack", ":first_stack", ":last_stack"),
(party_stack_get_troop_id, ":cur_troop", ":party_no", ":cur_stack"),
(troop_get_class, ":troop_class", ":cur_troop"),
(eq, ":troop_class", 0),
#(store_character_level, ":troop_level", ":cur_troop"),
#(gt, ":troop_level", ":best_level"),
#(assign, ":best_level", ":troop_level"),
(assign, ":best_stack", ":cur_stack"),
(try_end),
# move to the end
(try_begin),
#(gt, ":best_level", -1),
(party_stack_get_troop_id, ":stack_troop", ":party_no", ":best_stack"),
(troop_get_class, ":troop_class", ":stack_troop"),
(eq, ":troop_class", 0),
(party_stack_get_size, ":stack_size", ":party_no", ":best_stack"),
(party_stack_get_num_wounded, ":num_wounded", ":party_no", ":best_stack"),
(party_remove_members, ":party_no", ":stack_troop", ":stack_size"),
(party_add_members, ":party_no", ":stack_troop", ":stack_size"),
(party_wound_members, ":party_no", ":stack_troop", ":num_wounded"),
(val_sub, ":last_stack", 1),
(try_end),
(try_end),
(try_end),
(display_message, "@Your party infantry is now sorted to the buttom."),
],
),
("blank_1", [
],
"------------------------------",
[]),
("sort_party_5",
[], "Sort party archers to the top.",
[
(try_for_parties, ":party_no"),
(assign, ":continue", 0),
(try_begin),
(eq, ":party_no", "p_main_party"),
(party_is_active, ":party_no"),
(assign, ":continue", 1),
(try_begin),
(party_stack_get_troop_id, ":cur_troop", ":party_no", 0),
(this_or_next | troop_is_hero, ":cur_troop"),
(eq, ":cur_troop", "trp_caravan_master"),
(assign, ":first_stack", 1),
(else_try),
(assign, ":first_stack", 0),
(try_end),
(try_end),
(eq, ":continue", 1),
(party_get_num_companion_stacks, ":num_stacks", ":party_no"),
(gt, ":num_stacks", ":first_stack"),
(assign, ":last_stack", ":num_stacks"),
# start to sort
(store_sub, ":num_times", ":num_stacks", ":first_stack"),
(try_for_range, ":unused", 0, ":num_times"),
# find highest-level troop
(assign, ":best_stack", -1),
(assign, ":best_level", -1),
(try_for_range, ":cur_stack", ":first_stack", ":last_stack"),
(party_stack_get_troop_id, ":cur_troop", ":party_no", ":cur_stack"),
(troop_get_class, ":troop_class", ":cur_troop"),
(neq, ":troop_class", 1),
#(store_character_level, ":troop_level", ":cur_troop"),
#(gt, ":troop_level", ":best_level"),
#(assign, ":best_level", ":troop_level"),
(assign, ":best_stack", ":cur_stack"),
(try_end),
# move to the end
(try_begin),
#(gt, ":best_level", -1),
(party_stack_get_troop_id, ":stack_troop", ":party_no", ":best_stack"),
(troop_get_class, ":troop_class", ":stack_troop"),
(neq, ":troop_class", 1),
(party_stack_get_size, ":stack_size", ":party_no", ":best_stack"),
(party_stack_get_num_wounded, ":num_wounded", ":party_no", ":best_stack"),
(party_remove_members, ":party_no", ":stack_troop", ":stack_size"),
(party_add_members, ":party_no", ":stack_troop", ":stack_size"),
(party_wound_members, ":party_no", ":stack_troop", ":num_wounded"),
(val_sub, ":last_stack", 1),
(try_end),
(try_end),
(try_end),
(display_message, "@Your party archers is now sorted to the top."),
],
),
("sort_party_6",
[], "Sort party archers to the buttom.",
[
(try_for_parties, ":party_no"),
(assign, ":continue", 0),
(try_begin),
(eq, ":party_no", "p_main_party"),
(party_is_active, ":party_no"),
(assign, ":continue", 1),
(try_begin),
(party_stack_get_troop_id, ":cur_troop", ":party_no", 0),
(this_or_next | troop_is_hero, ":cur_troop"),
(eq, ":cur_troop", "trp_caravan_master"),
(assign, ":first_stack", 1),
(else_try),
(assign, ":first_stack", 0),
(try_end),
(try_end),
(eq, ":continue", 1),
(party_get_num_companion_stacks, ":num_stacks", ":party_no"),
(gt, ":num_stacks", ":first_stack"),
(assign, ":last_stack", ":num_stacks"),
# start to sort
(store_sub, ":num_times", ":num_stacks", ":first_stack"),
(try_for_range, ":unused", 0, ":num_times"),
# find highest-level troop
(assign, ":best_stack", -1),
(assign, ":best_level", -1),
(try_for_range, ":cur_stack", ":first_stack", ":last_stack"),
(party_stack_get_troop_id, ":cur_troop", ":party_no", ":cur_stack"),
(troop_get_class, ":troop_class", ":cur_troop"),
(eq, ":troop_class", 1),
#(store_character_level, ":troop_level", ":cur_troop"),
#(gt, ":troop_level", ":best_level"),
#(assign, ":best_level", ":troop_level"),
(assign, ":best_stack", ":cur_stack"),
(try_end),
# move to the end
(try_begin),
#(gt, ":best_level", -1),
(party_stack_get_troop_id, ":stack_troop", ":party_no", ":best_stack"),
(troop_get_class, ":troop_class", ":stack_troop"),
(eq, ":troop_class", 1),
(party_stack_get_size, ":stack_size", ":party_no", ":best_stack"),
(party_stack_get_num_wounded, ":num_wounded", ":party_no", ":best_stack"),
(party_remove_members, ":party_no", ":stack_troop", ":stack_size"),
(party_add_members, ":party_no", ":stack_troop", ":stack_size"),
(party_wound_members, ":party_no", ":stack_troop", ":num_wounded"),
(val_sub, ":last_stack", 1),
(try_end),
(try_end),
(try_end),
(display_message, "@Your party archers is now sorted to the buttom."),
],
),
("blank_2", [
],
"------------------------------",
[]),
("sort_party_7",
[], "Sort party cavalry to the top.",
[
(try_for_parties, ":party_no"),
(assign, ":continue", 0),
(try_begin),
(eq, ":party_no", "p_main_party"),
(party_is_active, ":party_no"),
(assign, ":continue", 1),
(try_begin),
(party_stack_get_troop_id, ":cur_troop", ":party_no", 0),
(this_or_next | troop_is_hero, ":cur_troop"),
(eq, ":cur_troop", "trp_caravan_master"),
(assign, ":first_stack", 1),
(else_try),
(assign, ":first_stack", 0),
(try_end),
(try_end),
(eq, ":continue", 1),
(party_get_num_companion_stacks, ":num_stacks", ":party_no"),
(gt, ":num_stacks", ":first_stack"),
(assign, ":last_stack", ":num_stacks"),
# start to sort
(store_sub, ":num_times", ":num_stacks", ":first_stack"),
(try_for_range, ":unused", 0, ":num_times"),
# find highest-level troop
(assign, ":best_stack", -1),
(assign, ":best_level", -1),
(try_for_range, ":cur_stack", ":first_stack", ":last_stack"),
(party_stack_get_troop_id, ":cur_troop", ":party_no", ":cur_stack"),
(troop_get_class, ":troop_class", ":cur_troop"),
(neq, ":troop_class", 2),
#(store_character_level, ":troop_level", ":cur_troop"),
#(gt, ":troop_level", ":best_level"),
#(assign, ":best_level", ":troop_level"),
(assign, ":best_stack", ":cur_stack"),
(try_end),
# move to the end
(try_begin),
#(gt, ":best_level", -1),
(party_stack_get_troop_id, ":stack_troop", ":party_no", ":best_stack"),
(troop_get_class, ":troop_class", ":stack_troop"),
(neq, ":troop_class", 2),
(party_stack_get_size, ":stack_size", ":party_no", ":best_stack"),
(party_stack_get_num_wounded, ":num_wounded", ":party_no", ":best_stack"),
(party_remove_members, ":party_no", ":stack_troop", ":stack_size"),
(party_add_members, ":party_no", ":stack_troop", ":stack_size"),
(party_wound_members, ":party_no", ":stack_troop", ":num_wounded"),
(val_sub, ":last_stack", 1),
(try_end),
(try_end),
(try_end),
(display_message, "@Your party cavalry is now sorted to the top."),
],
),
("sort_party_8",
[], "Sort party cavalry to the buttom.",
[
(try_for_parties, ":party_no"),
(assign, ":continue", 0),
(try_begin),
(eq, ":party_no", "p_main_party"),
(party_is_active, ":party_no"),
(assign, ":continue", 1),
(try_begin),
(party_stack_get_troop_id, ":cur_troop", ":party_no", 0),
(this_or_next | troop_is_hero, ":cur_troop"),
(eq, ":cur_troop", "trp_caravan_master"),
(assign, ":first_stack", 1),
(else_try),
(assign, ":first_stack", 0),
(try_end),
(try_end),
(eq, ":continue", 1),
(party_get_num_companion_stacks, ":num_stacks", ":party_no"),
(gt, ":num_stacks", ":first_stack"),
(assign, ":last_stack", ":num_stacks"),
# start to sort
(store_sub, ":num_times", ":num_stacks", ":first_stack"),
(try_for_range, ":unused", 0, ":num_times"),
# find highest-level troop
(assign, ":best_stack", -1),
(assign, ":best_level", -1),
(try_for_range, ":cur_stack", ":first_stack", ":last_stack"),
(party_stack_get_troop_id, ":cur_troop", ":party_no", ":cur_stack"),
(troop_get_class, ":troop_class", ":cur_troop"),
(eq, ":troop_class", 2),
#(store_character_level, ":troop_level", ":cur_troop"),
#(gt, ":troop_level", ":best_level"),
#(assign, ":best_level", ":troop_level"),
(assign, ":best_stack", ":cur_stack"),
(try_end),
# move to the end
(try_begin),
#(gt, ":best_level", -1),
(party_stack_get_troop_id, ":stack_troop", ":party_no", ":best_stack"),
(troop_get_class, ":troop_class", ":stack_troop"),
(eq, ":troop_class", 2),
(party_stack_get_size, ":stack_size", ":party_no", ":best_stack"),
(party_stack_get_num_wounded, ":num_wounded", ":party_no", ":best_stack"),
(party_remove_members, ":party_no", ":stack_troop", ":stack_size"),
(party_add_members, ":party_no", ":stack_troop", ":stack_size"),
(party_wound_members, ":party_no", ":stack_troop", ":num_wounded"),
(val_sub, ":last_stack", 1),
(try_end),
(try_end),
(try_end),
(display_message, "@Your party cavalry is now sorted to the buttom."),
],
),
("blank_3", [
],
"------------------------------",
[]),
("sort_party_9",
[], "Sort party companions to the top.",
[
(try_for_parties, ":party_no"),
(assign, ":continue", 0),
(try_begin),
(eq, ":party_no", "p_main_party"),
(party_is_active, ":party_no"),
(assign, ":continue", 1),
(try_begin),
(party_stack_get_troop_id, ":cur_troop", ":party_no", 0),
(this_or_next | troop_is_hero, ":cur_troop"),
(eq, ":cur_troop", "trp_caravan_master"),
(assign, ":first_stack", 1),
(else_try),
(assign, ":first_stack", 0),
(try_end),
(try_end),
(eq, ":continue", 1),
(party_get_num_companion_stacks, ":num_stacks", ":party_no"),
(gt, ":num_stacks", ":first_stack"),
(assign, ":last_stack", ":num_stacks"),
# start to sort
(store_sub, ":num_times", ":num_stacks", ":first_stack"),
(try_for_range, ":unused", 0, ":num_times"),
# find highest-level troop
(assign, ":best_stack", -1),
(assign, ":best_level", -1),
(try_for_range, ":cur_stack", ":first_stack", ":last_stack"),
(party_stack_get_troop_id, ":cur_troop", ":party_no", ":cur_stack"),
(neg | troop_is_hero, ":cur_troop"),
#(store_character_level, ":troop_level", ":cur_troop"),
#(gt, ":troop_level", ":best_level"),
#(assign, ":best_level", ":troop_level"),
(assign, ":best_stack", ":cur_stack"),
(try_end),
# move to the end
(try_begin),
#(gt, ":best_level", -1),
(party_stack_get_troop_id, ":stack_troop", ":party_no", ":best_stack"),
(neg | troop_is_hero, ":stack_troop"),
(party_stack_get_size, ":stack_size", ":party_no", ":best_stack"),
(party_stack_get_num_wounded, ":num_wounded", ":party_no", ":best_stack"),
(party_remove_members, ":party_no", ":stack_troop", ":stack_size"),
(party_add_members, ":party_no", ":stack_troop", ":stack_size"),
(party_wound_members, ":party_no", ":stack_troop", ":num_wounded"),
(val_sub, ":last_stack", 1),
(try_end),
(try_end),
(try_end),
(display_message, "@Your party companions is now sorted to the top."),
],
),
("sort_party_10",
[], "Sort party companions to the buttom.",
[
(try_for_parties, ":party_no"),
(assign, ":continue", 0),
(try_begin),
(eq, ":party_no", "p_main_party"),
(party_is_active, ":party_no"),
(assign, ":continue", 1),
(try_begin),
(party_stack_get_troop_id, ":cur_troop", ":party_no", 0),
(this_or_next | troop_is_hero, ":cur_troop"),
(eq, ":cur_troop", "trp_caravan_master"),
(assign, ":first_stack", 1),
(else_try),
(assign, ":first_stack", 0),
(try_end),
(try_end),
(eq, ":continue", 1),
(party_get_num_companion_stacks, ":num_stacks", ":party_no"),
(gt, ":num_stacks", ":first_stack"),
(assign, ":last_stack", ":num_stacks"),
# start to sort
(store_sub, ":num_times", ":num_stacks", ":first_stack"),
(try_for_range, ":unused", 0, ":num_times"),
# find highest-level troop
(assign, ":best_stack", -1),
(assign, ":best_level", -1),
(try_for_range, ":cur_stack", ":first_stack", ":last_stack"),
(party_stack_get_troop_id, ":cur_troop", ":party_no", ":cur_stack"),
(troop_is_hero, ":cur_troop"),
#(store_character_level, ":troop_level", ":cur_troop"),
#(gt, ":troop_level", ":best_level"),
#(assign, ":best_level", ":troop_level"),
(assign, ":best_stack", ":cur_stack"),
(try_end),
# move to the end
(try_begin),
#(gt, ":best_level", -1),
(party_stack_get_troop_id, ":stack_troop", ":party_no", ":best_stack"),
(troop_is_hero, ":stack_troop"),
(party_stack_get_size, ":stack_size", ":party_no", ":best_stack"),
(party_stack_get_num_wounded, ":num_wounded", ":party_no", ":best_stack"),
(party_remove_members, ":party_no", ":stack_troop", ":stack_size"),
(party_add_members, ":party_no", ":stack_troop", ":stack_size"),
(party_wound_members, ":party_no", ":stack_troop", ":num_wounded"),
(val_sub, ":last_stack", 1),
(try_end),
(try_end),
(try_end),
(display_message, "@Your party companions is now sorted to the buttom."),
],
),
("camp_sort_leave_to_menu", [], "Back to camp menu.",
[(jump_to_menu, "mnu_camp_action"),
]
),
]
),