(troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_thrown, 5),
(troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_arrows, 2),
(troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_bolts, 2),
(troop_ensure_inventory_space, ":cur_merchant", merchant_inventory_space),
(troop_sort_inventory, ":cur_merchant"),
(store_troop_gold, reg6, ":cur_merchant"),
(lt, reg6, 1000),
(store_random_in_range, ":new_gold", 250, 500),
(call_script, "script_troop_add_gold", ":cur_merchant", ":new_gold"),
(try_end),
]),
# script_dplmc_time_sorted_heroes_for_center_aux
# For internal use only
# param 1: center no
# param 2: party_no_to_collect_heroes
# param 3: minimum time since last met (inclusive), or negative for no restriction
# param 4: maximum time since last met (exclusive), or negative for no restriction
("dplmc_time_sorted_heroes_for_center_aux",
[
(store_script_param_1, ":center_no"),
(store_script_param_2, ":party_no_to_collect_heroes"),
(store_script_param, ":min_time", 3),
(store_script_param, ":max_time", 4),
(store_current_hours, ":current_hours"),
(party_get_num_companion_stacks, ":num_stacks",":center_no"),
(try_for_range, ":i_stack", 0, ":num_stacks"),
(party_stack_get_troop_id, ":stack_troop",":center_no",":i_stack"),
(troop_is_hero, ":stack_troop"),
#get time since last talk
(troop_get_slot, ":troop_last_talk_time", ":stack_troop", slot_troop_last_talk_time),
(store_sub, ":time_since_last_talk", ":current_hours", ":troop_last_talk_time"),
#add if time meets constraints
(this_or_next|ge, ":time_since_last_talk", ":min_time"),
(lt, ":min_time", 0),
(this_or_next|lt, ":time_since_last_talk", ":max_time"),
(lt, ":max_time", 0),
(party_add_members, ":party_no_to_collect_heroes", ":stack_troop", 1),
(try_end),
(party_get_num_attached_parties, ":num_attached_parties", ":center_no"),
(try_for_range, ":attached_party_rank", 0, ":num_attached_parties"),
(party_get_attached_party_with_rank, ":attached_party", ":center_no", ":attached_party_rank"),
(gt, ":attached_party", 0), #Floris - bugfix
(call_script, "script_dplmc_time_sorted_heroes_for_center_aux", ":attached_party", ":party_no_to_collect_heroes",":min_time",":max_time"),
(try_end),
]),
# script_dplmc_time_sorted_heroes_for_center
# Input: arg1 = center_no, arg2 = party_no_to_collect_heroes
# Output: none, adds heroes to the party_no_to_collect_heroes party
# The catch is that it returns heroes who haven't been met in a day
# or more before others, for greater use in feasts.
("dplmc_time_sorted_heroes_for_center",
[
(store_script_param_1, ":center_no"),
(store_script_param_2, ":party_no_to_collect_heroes"),
(party_clear, ":party_no_to_collect_heroes"),
#Heroes you haven't spoken to in 24+ hours
(call_script, "script_dplmc_time_sorted_heroes_for_center_aux",
":center_no", ":party_no_to_collect_heroes", 24, -1),
#Heroes you haven't spoken to in 12 to 24 hours
(call_script, "script_dplmc_time_sorted_heroes_for_center_aux",
":center_no", ":party_no_to_collect_heroes", 12, 24),
#Everyone else
(call_script, "script_dplmc_time_sorted_heroes_for_center_aux",
":center_no", ":party_no_to_collect_heroes", -1, 12),
#Non-attached pretenders
(try_for_range, ":pretender", pretenders_begin, pretenders_end),
(neq, ":pretender", "$supported_pretender"),
(troop_slot_eq, ":pretender", slot_troop_cur_center, ":center_no"),
(party_add_members, ":party_no_to_collect_heroes", ":pretender", 1),
(try_end),
]),
# script_refresh_center_stables
("refresh_center_stables",
[
(reset_item_probabilities, 100),
(set_merchandise_modifier_quality, 150),
(try_for_range, ":cur_merchant", horse_merchants_begin, horse_merchants_end),
(troop_clear_inventory, ":cur_merchant"),
(store_sub, ":cur_town", ":cur_merchant", horse_merchants_begin),
**********************************************************
(troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_thrown, 5),
(troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_arrows, 2),
(troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_bolts, 2),
(troop_ensure_inventory_space, ":cur_merchant", merchant_inventory_space),
(troop_sort_inventory, ":cur_merchant"),
(store_troop_gold, reg6, ":cur_merchant"),
(lt, reg6, 1000),
(store_random_in_range, ":new_gold", 250, 500),
(call_script, "script_troop_add_gold", ":cur_merchant", ":new_gold"),
(try_end),
]),
# script_dplmc_time_sorted_heroes_for_center_aux
# For internal use only
# param 1: center no
# param 2: party_no_to_collect_heroes
# param 3: minimum time since last met (inclusive), or negative for no restriction
# param 4: maximum time since last met (exclusive), or negative for no restriction
("dplmc_time_sorted_heroes_for_center_aux",
[
(store_script_param_1, ":center_no"),
(store_script_param_2, ":party_no_to_collect_heroes"),
(store_script_param, ":min_time", 3),
(store_script_param, ":max_time", 4),
(store_current_hours, ":current_hours"),
(party_get_num_companion_stacks, ":num_stacks",":center_no"),
(try_for_range, ":i_stack", 0, ":num_stacks"),
(party_stack_get_troop_id, ":stack_troop",":center_no",":i_stack"),
(troop_is_hero, ":stack_troop"),
#get time since last talk
(troop_get_slot, ":troop_last_talk_time", ":stack_troop", slot_troop_last_talk_time),
(store_sub, ":time_since_last_talk", ":current_hours", ":troop_last_talk_time"),
#add if time meets constraints
(this_or_next|ge, ":time_since_last_talk", ":min_time"),
(lt, ":min_time", 0),
(this_or_next|lt, ":time_since_last_talk", ":max_time"),
(lt, ":max_time", 0),
(party_add_members, ":party_no_to_collect_heroes", ":stack_troop", 1),
(try_end),
(party_get_num_attached_parties, ":num_attached_parties", ":center_no"),
(try_for_range, ":attached_party_rank", 0, ":num_attached_parties"),
(party_get_attached_party_with_rank, ":attached_party", ":center_no", ":attached_party_rank"),
(gt, ":attached_party", 0), #Floris - bugfix
(call_script, "script_dplmc_time_sorted_heroes_for_center_aux", ":attached_party", ":party_no_to_collect_heroes",":min_time",":max_time"),
(try_end),
]),
# script_dplmc_time_sorted_heroes_for_center
# Input: arg1 = center_no, arg2 = party_no_to_collect_heroes
# Output: none, adds heroes to the party_no_to_collect_heroes party
# The catch is that it returns heroes who haven't been met in a day
# or more before others, for greater use in feasts.
("dplmc_time_sorted_heroes_for_center",
[
(store_script_param_1, ":center_no"),
(store_script_param_2, ":party_no_to_collect_heroes"),
(party_clear, ":party_no_to_collect_heroes"),
#Heroes you haven't spoken to in 24+ hours
(call_script, "script_dplmc_time_sorted_heroes_for_center_aux",
":center_no", ":party_no_to_collect_heroes", 24, -1),
#Heroes you haven't spoken to in 12 to 24 hours
(call_script, "script_dplmc_time_sorted_heroes_for_center_aux",
":center_no", ":party_no_to_collect_heroes", 12, 24),
#Everyone else
(call_script, "script_dplmc_time_sorted_heroes_for_center_aux",
":center_no", ":party_no_to_collect_heroes", -1, 12),
#Non-attached pretenders
(try_for_range, ":pretender", pretenders_begin, pretenders_end),
(neq, ":pretender", "$supported_pretender"),
(troop_slot_eq, ":pretender", slot_troop_cur_center, ":center_no"),
(party_add_members, ":party_no_to_collect_heroes", ":pretender", 1),
(try_end),
]),
# script_refresh_center_stables
("refresh_center_stables",
[
(reset_item_probabilities, 100),
(set_merchandise_modifier_quality, 150),
(try_for_range, ":cur_merchant", horse_merchants_begin, horse_merchants_end),
(troop_clear_inventory, ":cur_merchant"),
(store_sub, ":cur_town", ":cur_merchant", horse_merchants_begin),