EvilSquid
Recruit

Forgot to put this up the other week, namely a bug relating to how feasts are rated, which affects the max rep you can get.
People may have noticed that no matter how much (or variety) of food, drink, jewelry or furs you have - even if you max everything out as "magnificent" - the actual rating of your feast is currently capped at "satisfactory"?
The rating has a direct affect on the amount of rep each attending lord gains - currently this is capped at 2, when it should be 4. Which might not sound like much, but it'll surely add up over time.
Checking out internal_politics_rate_feast_to_s9 (from module_scripts.py) revealed that when this was modified for VC (when furs and jewelry replaced the native equivalents), some of the calculations were not adjusted appropriately.
While the problem and potential solution will probably be obvious to most anyone examining that script in detail, in case anyone wants to mod their game prior to a fix coming out, here's my code for that function, with my modifications:
People may have noticed that no matter how much (or variety) of food, drink, jewelry or furs you have - even if you max everything out as "magnificent" - the actual rating of your feast is currently capped at "satisfactory"?
The rating has a direct affect on the amount of rep each attending lord gains - currently this is capped at 2, when it should be 4. Which might not sound like much, but it'll surely add up over time.
Checking out internal_politics_rate_feast_to_s9 (from module_scripts.py) revealed that when this was modified for VC (when furs and jewelry replaced the native equivalents), some of the calculations were not adjusted appropriately.
While the problem and potential solution will probably be obvious to most anyone examining that script in detail, in case anyone wants to mod their game prior to a fix coming out, here's my code for that function, with my modifications:
插入代码块:
#SQUID: Note: this should now give correct values for furs and jewelry, as well as the feast as a whole.
# - meaning we should be able to get better rep values out of this..
("internal_politics_rate_feast_to_s9",
[
(store_script_param, ":householder", 1),
(store_script_param, ":num_servings", 2),
# (store_script_param, ":faction", 3),
(store_script_param, ":consume_items", 4),
(val_max, ":num_servings", 1),
(try_for_range, ":item", trade_goods_begin, trade_goods_end),
(item_set_slot, ":item", slot_item_amount_available, 0), #had no "item"
(try_end),
(troop_get_inventory_capacity, ":capacity", ":householder"),
(try_for_range, ":inventory_slot", 0, ":capacity"),
(troop_get_inventory_slot, ":item", ":householder", ":inventory_slot"),
(is_between, ":item", trade_goods_begin, trade_goods_end),
(troop_inventory_slot_get_item_amount, ":slot_amount", ":householder", ":inventory_slot"),
(item_get_slot, ":item_amount", ":item", slot_item_amount_available),
(val_add, ":item_amount", ":slot_amount"),
(item_set_slot, ":item", slot_item_amount_available, ":item_amount"),
(try_end),
#food
(assign, ":food_amount", 0),
(assign, ":food_variety", 0),
(store_div, ":servings_div_by_12", ":num_servings", 12),
(try_for_range, ":food_item", food_begin, food_end),
(item_get_slot, ":food_in_slot", ":food_item", slot_item_amount_available),
(val_add, ":food_amount", ":food_in_slot"),
## (str_store_item_name, s4, ":food_item"),
## (assign, reg3, ":food_in_slot"),
## (assign, reg5, ":servings_div_by_12"),
## (display_message, "str_reg3_units_of_s4_for_reg5_guests_and_retinue"),
(ge, ":food_in_slot", ":servings_div_by_12"),
(val_add, ":food_variety", 1),
(try_end),
(val_mul, ":food_amount", 100),
(val_div, ":food_amount", ":num_servings"), #1 to 100 for each
(val_min, ":food_amount", 100),
(val_mul, ":food_variety", 100), #1 to 100 for each #Was 85 before
(val_div, ":food_variety", 10),
(val_min, ":food_variety", 100),
#drink
(assign, ":drink_amount", 0),
(assign, ":drink_variety", 0),
#(store_div, ":servings_div_by_4", ":num_servings", 4),
(try_for_range, ":drink_iterator", "itm_wine", "itm_smoked_fish"),
(assign, ":drink_item", ":drink_iterator"),
(item_get_slot, ":drink_in_slot", ":drink_item", slot_item_amount_available),
(val_add, ":drink_amount", ":drink_in_slot"),
#(ge, ":drink_in_slot", ":servings_div_by_4"),
(ge, ":drink_in_slot", ":servings_div_by_12"),
(val_add, ":drink_variety", 1),
(try_end),
#VC-2424
(try_begin),
(assign, ":drink_item", "itm_mead"),
(item_get_slot, ":drink_in_slot", ":drink_item", slot_item_amount_available),
(val_add, ":drink_amount", ":drink_in_slot"),
#(ge, ":drink_in_slot", ":servings_div_by_4"),
(ge, ":drink_in_slot", ":servings_div_by_12"),
(val_add, ":drink_variety", 1),
(try_end),
#VC-2424 end
(val_mul, ":drink_amount", 200), #amount needed is 50% of the number of guests
(val_max, ":num_servings", 1),
(val_div, ":drink_amount", ":num_servings"), #1 to 100 for each
(val_min, ":drink_amount", 100),
(val_mul, ":drink_variety", 34), #1 to 100 for each #was 50 in native but we have 3 drinks in VC
#(store_div, ":servings_div_by_4", ":num_servings", 4),
#jewellery (was Spices in native)
(item_get_slot, ":jewelry_amount", "itm_jewelry", slot_item_amount_available), #eco note
(store_mul, ":jewelry_percentage", ":jewelry_amount", 100),
(val_max, ":servings_div_by_12", 1),
(val_div, ":jewelry_percentage", ":servings_div_by_12"), #SQUID: Changed to jewelry_percentage so that it shows correct values
(val_min, ":jewelry_percentage", 100),
(assign, reg3, ":jewelry_amount"),
## (assign, reg5, ":servings_div_by_12"),
## (assign, reg6, ":jewelry_percentage"),
## (display_message, "str_reg3_units_of_spice_of_reg5_to_be_consumed"),
#Fur (Was oil)
(item_get_slot, ":furs_amount", "itm_vc_furs", slot_item_amount_available), #eco note
(store_mul, ":furs_percentage", ":furs_amount", 100),
(val_max, ":servings_div_by_12", 1),
(val_div, ":furs_percentage", ":servings_div_by_12"), #SQUID: Changed to furs_percentage so that it shows correct values
(val_min, ":furs_percentage", 100),
(assign, reg3, ":furs_amount"),
## (assign, reg5, ":servings_div_by_12"),
## (assign, reg6, ":furs_percentage"),
## (display_message, "str_reg3_units_of_oil_of_reg5_to_be_consumed"),
(store_div, ":food_amount_string", ":food_amount", 20),
(val_add, ":food_amount_string", "str_feast_description"),
(str_store_string, s8, ":food_amount_string"),
(str_store_string, s9, "str_of_food_which_must_come_before_everything_else_the_amount_is_s8"),
(store_div, ":food_variety_string", ":food_variety", 20),
(val_add, ":food_variety_string", "str_feast_description"),
(str_store_string, s8, ":food_variety_string"),
(str_store_string, s9, "str_s9_and_the_variety_is_s8_"),
(store_div, ":drink_amount_string", ":drink_amount", 20),
(val_add, ":drink_amount_string", "str_feast_description"),
(str_store_string, s8, ":drink_amount_string"),
(str_store_string, s9, "str_s9_of_drink_which_guests_will_expect_in_great_abundance_the_amount_is_s8"),
(store_div, ":drink_variety_string", ":drink_variety", 20),
(val_add, ":drink_variety_string", "str_feast_description"),
(str_store_string, s8, ":drink_variety_string"),
(str_store_string, s9, "str_s9_and_the_variety_is_s8_"),
(store_div, ":jewelry_string", ":jewelry_percentage", 20),
(val_add, ":jewelry_string", "str_feast_description"),
(str_store_string, s8, ":jewelry_string"),
(str_store_string, s9, "str_s9_of_jewellery_which_is_essential_to_demonstrate_x_the_amount_is_s8_"),
(store_div, ":furs_string", ":furs_percentage", 20),
(val_add, ":furs_string", "str_feast_description"),
(str_store_string, s8, ":furs_string"),
(str_store_string, s9, "str_s9_of_fur_which_we_shall_x_the_amount_is_s8"),
(store_mul, ":food_amount_cap", ":food_amount", 8),
(store_add, ":total", ":food_amount", ":food_variety"),
(val_mul, ":total", 2), #x4
(val_add, ":total", ":drink_variety"),
(val_add, ":total", ":drink_amount"), #x6
(val_add, ":total", ":jewelry_percentage"), #x7 #SQUID: Changed to jewelry_percentage so it uses correct values
(val_add, ":total", ":furs_percentage"), #x8 #SQUID: Changed to furs_percentage so it uses correct values
(val_min, ":total", ":food_amount_cap"),
(val_div, ":total", 8),
(val_clamp, ":total", 1, 101),
(store_div, ":total_string", ":total", 20),
(val_add, ":total_string", "str_feast_description"),
(str_store_string, s8, ":total_string"),
(str_store_string, s9, "str_s9_overall_our_table_will_be_considered_s8"),
(assign, reg0, ":total"), #zero to 100
(try_begin),
(eq, ":consume_items", 1),
(assign, ":num_of_servings_to_serve", ":num_servings"),
(try_for_range, ":unused", 0, 1999),
(gt, ":num_of_servings_to_serve", 0),
(try_for_range, ":item", trade_goods_begin, trade_goods_end),
(item_set_slot, ":item", slot_item_is_checked, 0),
(try_end),
(troop_get_inventory_capacity, ":inv_size", ":householder"),
(try_for_range, ":i_slot", 0, ":inv_size"),
(troop_get_inventory_slot, ":item", ":householder", ":i_slot"),
(this_or_next|eq, ":item", "itm_jewelry"), #eco note
(this_or_next|eq, ":item", "itm_vc_furs"),
(this_or_next|eq, ":item", "itm_wine"),
(this_or_next|eq, ":item", "itm_ale"),
(this_or_next|eq, ":item", "itm_mead"), #chief
(is_between, ":item", food_begin, food_end),
(item_slot_eq, ":item", slot_item_is_checked, 0),
(troop_inventory_slot_get_item_amount, ":cur_amount", ":householder", ":i_slot"),
(gt, ":cur_amount", 0),
(val_sub, ":cur_amount", 1),
(troop_inventory_slot_set_item_amount, ":householder", ":i_slot", ":cur_amount"),
(val_sub, ":num_of_servings_to_serve", 1),
(item_set_slot, ":item", slot_item_is_checked, 1),
(try_end),
(try_end),
(try_end),
]),