﻿# MAPS Most likely to cause Infinite Loading

trade_mapping_food_map = {

	every_county = {
		if = {
			limit = {
				title_province = { 
					NOT = { has_holding_type = tribal_holding }
				}
			}
			save_scope_value_as = {
				name = food_value
				value = county_industry_food_value_gui
			}
			if = {
				limit = { scope:food_value < -3 }
				set_color_county_provinces = { COLOR = neg_8 }
			}
			else_if = {
				limit = { scope:food_value < -2 }
				set_color_county_provinces = { COLOR = neg_7 }
			}
			else_if = {
				limit = { scope:food_value < -1.5 }
				set_color_county_provinces = { COLOR = neg_6 }
			}
			else_if = {
				limit = { scope:food_value < -1 }
				set_color_county_provinces = { COLOR = neg_5 }
			}
			else_if = {
				limit = { scope:food_value < -0.75 }
				set_color_county_provinces = { COLOR = neg_4 }
			}
			else_if = {
				limit = { scope:food_value < -0.5 }
				set_color_county_provinces = { COLOR = neg_3 }
			}
			else_if = {
				limit = { scope:food_value < -0.25 }
				set_color_county_provinces = { COLOR = neg_2 }
			}
			else_if = {
				limit = { scope:food_value < 0 }
				set_color_county_provinces = { COLOR = neg_1 }
			}
			else_if = {
				limit = { scope:food_value < 0.25 }
				set_color_county_provinces = { COLOR = 0 }
			}
			else_if = {
				limit = { scope:food_value < 0.5 }
				set_color_county_provinces = { COLOR = 1 }
			}
			else_if = {
				limit = { scope:food_value < 0.75 }
				set_color_county_provinces = { COLOR = 2 }
			}
			else_if = {
				limit = { scope:food_value < 1 }
				set_color_county_provinces = { COLOR = 3 }
			}
			else_if = {
				limit = { scope:food_value < 1.5 }
				set_color_county_provinces = { COLOR = 4 }
			}
			else_if = {
				limit = { scope:food_value < 2 }
				set_color_county_provinces = { COLOR = 5 }
			}
			else_if = {
				limit = { scope:food_value < 2.5 }
				set_color_county_provinces = { COLOR = 6 }
			}
			else_if = {
				limit = { scope:food_value < 3 }
				set_color_county_provinces = { COLOR = 7 }
			}
			else_if = {
				limit = { scope:food_value < 3.5 }
				set_color_county_provinces = { COLOR = 8 }
			}
			else_if = {
				limit = { scope:food_value < 4 }
				set_color_county_provinces = { COLOR = 9 }
			}
			else_if = {
				limit = { scope:food_value < 4.5 }
				set_color_county_provinces = { COLOR = 10 }
			}
			else_if = {
				limit = { scope:food_value < 5 }
				set_color_county_provinces = { COLOR = 11 }
			}
			else_if = {
				limit = { scope:food_value < 6 }
				set_color_county_provinces = { COLOR = 12 }
			}
			else_if = {
				limit = { scope:food_value < 7 }
				set_color_county_provinces = { COLOR = 13 }
			}
			else_if = {
				limit = { scope:food_value < 8 }
				set_color_county_provinces = { COLOR = 14 }
			}
			else_if = {
				limit = { scope:food_value < 9 }
				set_color_county_provinces = { COLOR = 15 }
			}
			else_if = {
				limit = { scope:food_value < 10 }
				set_color_county_provinces = { COLOR = 16 }
			}
			else_if = {
				limit = { scope:food_value < 12 }
				set_color_county_provinces = { COLOR = 17 }
			}
			else_if = {
				limit = { scope:food_value < 14 }
				set_color_county_provinces = { COLOR = 18 }
			}
			else_if = {
				limit = { scope:food_value < 16 }
				set_color_county_provinces = { COLOR = 19 }
			}
			else_if = {
				limit = { scope:food_value < 18 }
				set_color_county_provinces = { COLOR = 20 }
			}
			else_if = {
				limit = { scope:food_value < 20 }
				set_color_county_provinces = { COLOR = 21 }
			}
			else_if = {
				limit = { scope:food_value >= 20 }
				set_color_county_provinces = { COLOR = 22 }
			}
			else = {
				set_color_county_base = yes
			}
		}
		else = {
			set_color_county_base = yes
		}
	}
}

trade_mapping_resource_balance_map = {
	every_county = {
		if = {
			limit = {
				title_province = {
					NOT = { has_holding_type = tribal_holding }
				}
			}
			every_county_province = {
				if = {
					limit = {
						has_holding = yes
					}
					save_scope_value_as = {
						name = precious_metal
						value = province_spent_precious_metal_from_activity
					}
					if = {
						limit = { scope:precious_metal < -5 }
						barony = { set_color_from_title = title:d_line_map_trade_neg_8 }
					}
					else_if = {
						limit = { scope:precious_metal < -4 }
						barony = { set_color_from_title = title:d_line_map_trade_neg_7 }
					}
					else_if = {
						limit = { scope:precious_metal < -3 }
						barony = { set_color_from_title = title:d_line_map_trade_neg_6 }
					}
					else_if = {
						limit = { scope:precious_metal < -2 }
						barony = { set_color_from_title = title:d_line_map_trade_neg_5 }
					}
					else_if = {
						limit = { scope:precious_metal < -1.5 }
						barony = { set_color_from_title = title:d_line_map_trade_neg_4 }
					}
					else_if = {
						limit = { scope:precious_metal < -1 }
						barony = { set_color_from_title = title:d_line_map_trade_neg_3 }
					}
					else_if = {
						limit = { scope:precious_metal < -0.5 }
						barony = { set_color_from_title = title:d_line_map_trade_neg_2 }
					}
					else_if = {
						limit = { scope:precious_metal < -0.25 }
						barony = { set_color_from_title = title:d_line_map_trade_neg_1 }
					}
					else_if = {
						limit = { scope:precious_metal < -0.1 }
						barony = { set_color_from_title = title:d_line_map_trade_0 }
					}
					else_if = {
						limit = { scope:precious_metal < 0.05 }
						barony = { set_color_from_title = title:d_line_map_trade_1 }
					}
					else_if = {
						limit = { scope:precious_metal < 0.15 }
						barony = { set_color_from_title = title:d_line_map_trade_2 }
					}
					else_if = {
						limit = { scope:precious_metal < 0.25 }
						barony = { set_color_from_title = title:d_line_map_trade_3 }
					}
					else_if = {
						limit = { scope:precious_metal < 0.35 }
						barony = { set_color_from_title = title:d_line_map_trade_4 }
					}
					else_if = {
						limit = { scope:precious_metal < 0.45 }
						barony = { set_color_from_title = title:d_line_map_trade_5 }
					}
					else_if = {
						limit = { scope:precious_metal < 0.55 }
						barony = { set_color_from_title = title:d_line_map_trade_6 }
					}
					else_if = {
						limit = { scope:precious_metal < 0.7 }
						barony = { set_color_from_title = title:d_line_map_trade_7 }
					}
					else_if = {
						limit = { scope:precious_metal < 0.85 }
						barony = { set_color_from_title = title:d_line_map_trade_8 }
					}
					else_if = {
						limit = { scope:precious_metal < 1 }
						barony = { set_color_from_title = title:d_line_map_trade_9 }
					}
					else_if = {
						limit = { scope:precious_metal < 1.25 }
						barony = { set_color_from_title = title:d_line_map_trade_10 }
					}
					else_if = {
						limit = { scope:precious_metal < 1.5 }
						barony = { set_color_from_title = title:d_line_map_trade_11 }
					}
					else_if = {
						limit = { scope:precious_metal < 1.75 }
						barony = { set_color_from_title = title:d_line_map_trade_12 }
					}
					else_if = {
						limit = { scope:precious_metal < 2 }
						barony = { set_color_from_title = title:d_line_map_trade_13 }
					}
					else_if = {
						limit = { scope:precious_metal < 2.5 }
						barony = { set_color_from_title = title:d_line_map_trade_14 }
					}
					else_if = {
						limit = { scope:precious_metal < 3 }
						barony = { set_color_from_title = title:d_line_map_trade_15 }
					}
					else_if = {
						limit = { scope:precious_metal < 3.5 }
						barony = { set_color_from_title = title:d_line_map_trade_16 }
					}
					else_if = {
						limit = { scope:precious_metal < 4 }
						barony = { set_color_from_title = title:d_line_map_trade_18 }
					}
					else_if = {
						limit = { scope:precious_metal < 5 }
						barony = { set_color_from_title = title:d_line_map_trade_19 }
					}
					else_if = {
						limit = { scope:precious_metal < 6 }
						barony = { set_color_from_title = title:d_line_map_trade_20 }
					}
					else_if = {
						limit = { scope:precious_metal < 7 }
						barony = { set_color_from_title = title:d_line_map_trade_21 }
					}
					else = {
						barony = { set_color_from_title = title:d_line_map_trade_22 }
					}
				}
				else = {
					set_color_province_base = yes
				}
			}
		}
		else = {
			set_color_county_base = yes
		}
	}
}

trade_mapping_regions_map = {
	every_county = {
		if = {
			limit = { title_province.geographical_region_index = 1 }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_trade_7 }
			}
		}
		else_if = {
			limit = { title_province.geographical_region_index = 2 }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_trade_5 }
			}
		}
		else_if = {
			limit = { title_province.geographical_region_index = 3 }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_trade_19 }
			}
		}
		else_if = {
			limit = { title_province.geographical_region_index = 4 }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_trade_17 }
			}
		}
		else_if = {
			limit = { title_province.geographical_region_index = 5 }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_trade_13 }
			}
		}
		else_if = {
			limit = { title_province.geographical_region_index = 6 }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_trade_11 }
			}
		}
		else_if = {
			limit = { title_province.geographical_region_index = 7 }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_trade_9 }
			}
		}
		else_if = {
			limit = { title_province.geographical_region_index = 8 }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_trade_15 }
			}
		}
		else_if = {
			limit = { title_province.geographical_region_index = 9 }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_dynasty_independent_02}
			}
		}
		else_if = {
			limit = { title_province.geographical_region_index = 10 }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_trade_0 }
			}
		}
		else_if = {
			limit = { title_province.geographical_region_index = 11 }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_trade_3 }
			}
		}
		else_if = {
			limit = { title_province.geographical_region_index = 12 }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_trade_neg_1 }
			}
		}
		else_if = {
			limit = { title_province.geographical_region_index = 13 }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_trade_neg_3 }
			}
		}
		else_if = {
			limit = { title_province.geographical_region_index = 14 }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_trade_neg_5 }
			}
		}
		else_if = {
			limit = { title_province.geographical_region_index = 15 }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_trade_neg_7 }
			}
		}
		else_if = {
			limit = { title_province.geographical_region_index = 16 }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_dynasty_realm_03 }
			}
		}
		else_if = {
			limit = { title_province.geographical_region_index = 17 }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_dynasty_special_03 }
			}
		}
		else_if = {
			limit = { title_province.geographical_region_index = 18 }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_dynasty_independent_03 }
			}
		}
		else_if = {
			limit = { title_province.geographical_region_index = 19 }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_dynasty_03 }
			}
		}

		else_if = {
			limit = { title_province.geographical_region_index = 20 }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_dynasty_special_01}
			}
		}
		else_if = {
			limit = { title_province.geographical_region_index = 21 }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_trade_20 }
			}
		}
		else_if = {
			limit = { title_province.geographical_region_index = 22 }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_trade_22 }
			}
		}
		else_if = {
			limit = { title_province.geographical_region_index = 23 }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_trade_16 }
			}
		}

		else_if = {
			limit = { title_province.geographical_region_index = 24 }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_dynasty_05 }
			}
		}
		else_if = {
			limit = { title_province.geographical_region_index = 25 }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_dynasty_special_05 }
			}
		}
		else_if = {
			limit = { title_province.geographical_region_index = 26 }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_dynasty_independent_05 }
			}
		}
		else_if = {
			limit = { title_province.geographical_region_index = 27 }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_dynasty_independent_01 }
			}
		}
		else_if = {
			limit = { title_province.geographical_region_index = 28 }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_dynasty_special_02 }
			}
		}
		else_if = {
			limit = { title_province.geographical_region_index = 29 }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_dynasty_barony_01 }
			}
		}
		else_if = {
			limit = { title_province.geographical_region_index = 30 }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_dynasty_barony_02 }
			}
		}
		else_if = {
			limit = { title_province.geographical_region_index = 31 }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_dynasty_01 }
			}
		}
		else_if = {
			limit = { title_province.geographical_region_index = 32 }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_trade_8 }
			}
		}
		else_if = {
			limit = { title_province.geographical_region_index = 33 }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_trade_5 }
			}
		}
		else_if = {
			limit = { title_province.geographical_region_index = 34 }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_trade_1 }
			}
		}
		else_if = {
			limit = { title_province.geographical_region_index = 35 }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_dynasty_barony_05 }
			}
		}
		else_if = {
			limit = { title_province.geographical_region_index = 36 }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_dynasty_barony_06 }
			}
		}
	}
}

vegetation_mapping_regions_map = {
	every_county = {
		if = {
			limit = { title_province = { geographical_region = vegetation_polar } }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_trade_0 }
			}
		}
		else_if = {
			limit = { title_province = { geographical_region = vegetation_forest_steppes } }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_trade_8 }
			}
		}
		else_if = {
			limit = { title_province = { geographical_region = vegetation_boreal } }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_trade_4 }
			}
		}
		else_if = {
			limit = { title_province = { geographical_region = vegetation_oak_mixed } }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_dynasty_realm_03 }
			}
		}
		else_if = {
			limit = { title_province = { geographical_region = vegetation_oak_ash } }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_dynasty_special_03 }
			}
		}
		else_if = {
			limit = { title_province = { geographical_region = vegetation_oak_hornbeam } }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_dynasty_08 }
			}
		}
		else_if = {
			limit = { title_province = { geographical_region = vegetation_lime_oak } }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_trade_6 }
			}
		}
		else_if = {
			limit = { title_province = { geographical_region = vegetation_beech_lowland } }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_dynasty_independent_08 }
			}
		}
		else_if = {
			limit = { title_province = { geographical_region = vegetation_beech_montane } }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_dynasty_independent_07 }
			}
		}
		else_if = {
			limit = { title_province = { geographical_region = vegetation_caucasus } }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_trade_15 }
			}
		}
		else_if = {
			limit = { title_province = { geographical_region = vegetation_submeridional } }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_trade_17 }
			}
		}
		else_if = {
			limit = { title_province = { geographical_region = vegetation_meridional } }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_trade_19 }
			}
		}
		else_if = {
			limit = { title_province = { geographical_region = vegetation_semiarid } }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_trade_22 }
			}
		}
		else_if = {
			limit = { title_province = { geographical_region = vegetation_arid } }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_dynasty_independent_02 }
			}
		}
		else_if = {
			limit = { title_province = { geographical_region = vegetation_dry_forests } }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_trade_neg_7 }
			}
		}
		else_if = {
			limit = { title_province = { geographical_region = vegetation_hyperarid } }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_dynasty_barony_01 }
			}
		}
		else_if = {
			limit = { title_province = { geographical_region = vegetation_drysteppe } }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_trade_11 }
			}
		}
		else_if = {
			limit = { title_province = { geographical_region = vegetation_thorny } }
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_trade_20 }
			}
		}
		else = {
			every_county_province = {
				barony = { set_color_from_title = title:d_line_map_trade_neg_1 } ## general map
			}
		}
		# else_if = {
		# 	limit = { title_province = { geographical_region = 19 } }
		# 	every_county_province = {
		# 		barony = { set_color_from_title = title:d_line_map_dynasty_03 }
		# 	}
		# }

		# else_if = {
		# 	limit = { title_province = { geographical_region = 20 } }
		# 	every_county_province = {
		# 		barony = { set_color_from_title = title:d_line_map_dynasty_special_01}
		# 	}
		# }
		# else_if = {
		# 	limit = { title_province = { geographical_region = 21 } }
		# 	every_county_province = {
		# 		barony = { set_color_from_title = title:d_line_map_trade_20 }
		# 	}
		# }
		# else_if = {
		# 	limit = { title_province = { geographical_region = 22 } }
		# 	every_county_province = {
		# 		barony = { set_color_from_title = title:d_line_map_trade_22 }
		# 	}
		# }
		# else_if = {
		# 	limit = { title_province = { geographical_region = 23 } }
		# 	every_county_province = {
		# 		barony = { set_color_from_title = title:d_line_map_trade_16 }
		# 	}
		# }

		# else_if = {
		# 	limit = { title_province = { geographical_region = 24 } }
		# 	every_county_province = {
		# 		barony = { set_color_from_title = title:d_line_map_dynasty_05 }
		# 	}
		# }
		# else_if = {
		# 	limit = { title_province = { geographical_region = 25 } }
		# 	every_county_province = {
		# 		barony = { set_color_from_title = title:d_line_map_dynasty_special_05 }
		# 	}
		# }
		# else_if = {
		# 	limit = { title_province = { geographical_region = 26 } }
		# 	every_county_province = {
		# 		barony = { set_color_from_title = title:d_line_map_dynasty_independent_05 }
		# 	}
		# }
		# else_if = {
		# 	limit = { title_province = { geographical_region = 27 } }
		# 	every_county_province = {
		# 		barony = { set_color_from_title = title:d_line_map_dynasty_independent_01 }
		# 	}
		# }
		# else_if = {
		# 	limit = { title_province = { geographical_region = 28 } }
		# 	every_county_province = {
		# 		barony = { set_color_from_title = title:d_line_map_dynasty_special_02 }
		# 	}
		# }
		# else_if = {
		# 	limit = { title_province = { geographical_region = 29 } }
		# 	every_county_province = {
		# 		barony = { set_color_from_title = title:d_line_map_dynasty_barony_01 }
		# 	}
		# }
		# else_if = {
		# 	limit = { title_province = { geographical_region = 30 } }
		# 	every_county_province = {
		# 		barony = { set_color_from_title = title:d_line_map_dynasty_barony_02 }
		# 	}
		# }
		# else_if = {
		# 	limit = { title_province = { geographical_region = 31 } }
		# 	every_county_province = {
		# 		barony = { set_color_from_title = title:d_line_map_dynasty_01 }
		# 	}
		# }
		# else_if = {
		# 	limit = { title_province = { geographical_region = 32 } }
		# 	every_county_province = {
		# 		barony = { set_color_from_title = title:d_line_map_trade_8 }
		# 	}
		# }
		# else_if = {
		# 	limit = { title_province = { geographical_region = 33 } }
		# 	every_county_province = {
		# 		barony = { set_color_from_title = title:d_line_map_trade_5 }
		# 	}
		# }
		# else_if = {
		# 	limit = { title_province = { geographical_region = 34 } }
		# 	every_county_province = {
		# 		barony = { set_color_from_title = title:d_line_map_trade_1 }
		# 	}
		# }
		# else_if = {
		# 	limit = { title_province = { geographical_region = 35 } }
		# 	every_county_province = {
		# 		barony = { set_color_from_title = title:d_line_map_dynasty_barony_05 }
		# 	}
		# }
		# else_if = {
		# 	limit = { title_province = { geographical_region = 36 } }
		# 	every_county_province = {
		# 		barony = { set_color_from_title = title:d_line_map_dynasty_barony_06 }
		# 	}
		# }
	}
}

trade_mapping_product_taxes_map = {
	every_county = {
		if = {
			limit = {
				exists = var:production_county
			}
			if = {
				limit = {
					var:production_county > 0
				}
				set_local_variable = {
					name = product_taxes
					value = 0
				}
				map_product_taxes_all = yes
				if = {
					limit = { local_var:product_taxes < 0.1 }
					set_color_county_provinces = { COLOR = neg_1 }
				}
				else_if = {
					limit = { local_var:product_taxes < 1 }
					set_color_county_provinces = { COLOR = 0 }
				}
				else_if = {
					limit = { local_var:product_taxes < 2 }
					set_color_county_provinces = { COLOR = 1 }
				}
				else_if = {
					limit = { local_var:product_taxes < 3 }
					set_color_county_provinces = { COLOR = 2 }
				}
				else_if = {
					limit = { local_var:product_taxes < 4 }
					set_color_county_provinces = { COLOR = 3 }
				}
				else_if = {
					limit = { local_var:product_taxes < 5 }
					set_color_county_provinces = { COLOR = 4 }
				}
				else_if = {
					limit = { local_var:product_taxes < 6 }
					set_color_county_provinces = { COLOR = 5 }
				}
				else_if = {
					limit = { local_var:product_taxes < 7 }
					set_color_county_provinces = { COLOR = 6 }
				}
				else_if = {
					limit = { local_var:product_taxes < 8 }
					set_color_county_provinces = { COLOR = 7 }
				}
				else_if = {
					limit = { local_var:product_taxes < 9 }
					set_color_county_provinces = { COLOR = 8 }
				}
				else_if = {
					limit = { local_var:product_taxes < 10 }
					set_color_county_provinces = { COLOR = 9 }
				}
				else_if = {
					limit = { local_var:product_taxes < 11 }
					set_color_county_provinces = { COLOR = 10 }
				}
				else_if = {
					limit = { local_var:product_taxes < 12 }
					set_color_county_provinces = { COLOR = 11 }
				}
				else_if = {
					limit = { local_var:product_taxes < 14 }
					set_color_county_provinces = { COLOR = 12 }
				}
				else_if = {
					limit = { local_var:product_taxes < 16 }
					set_color_county_provinces = { COLOR = 13 }
				}
				else_if = {
					limit = { local_var:product_taxes < 18 }
					set_color_county_provinces = { COLOR = 14 }
				}
				else_if = {
					limit = { local_var:product_taxes < 20 }
					set_color_county_provinces = { COLOR = 15 }
				}
				else_if = {
					limit = { local_var:product_taxes < 22 }
					set_color_county_provinces = { COLOR = 16 }
				}
				else_if = {
					limit = { local_var:product_taxes < 24 }
					set_color_county_provinces = { COLOR = 17 }
				}
				else_if = {
					limit = { local_var:product_taxes < 26 }
					set_color_county_provinces = { COLOR = 18 }
				}
				else_if = {
					limit = { local_var:product_taxes < 28 }
					set_color_county_provinces = { COLOR = 19 }
				}
				else_if = {
					limit = { local_var:product_taxes < 30 }
					set_color_county_provinces = { COLOR = 20 }
				}
				else_if = {
					limit = { local_var:product_taxes < 35 }
					set_color_county_provinces = { COLOR = 21 }
				}
				else = {
					# limit = { local_var:product_taxes >= 350 }
					set_color_county_provinces = { COLOR = 22 }
				}
			}
			else = {
				set_color_county_base = yes
			}
		}
		else = {
			set_color_county_base = yes
		}
	}
}

map_product_taxes_all = {
	map_product_taxes = { PRODUCT = metal_gold }
	map_product_taxes = { PRODUCT = metal_silver }
	map_product_taxes = { PRODUCT = metal_copper }

	map_product_taxes = { PRODUCT = metal_iron }
	map_product_taxes = { PRODUCT = metal_tin }

	map_product_taxes = { PRODUCT = metal_mercury }
	map_product_taxes = { PRODUCT = metal_alum }
	map_product_taxes = { PRODUCT = mine_marble }

	map_product_taxes = { PRODUCT = industry_salt }
	map_product_taxes = { PRODUCT = industry_grain }
	map_product_taxes = { PRODUCT = industry_linen }
	map_product_taxes = { PRODUCT = industry_olive }
	map_product_taxes = { PRODUCT = industry_cotton}

	map_product_taxes = { PRODUCT = industry_wine }
	map_product_taxes = { PRODUCT = industry_dates }
	map_product_taxes = { PRODUCT = industry_sugar }
	map_product_taxes = { PRODUCT = industry_cheese }
	map_product_taxes = { PRODUCT = industry_wool }
	map_product_taxes = { PRODUCT = industry_fur }
	map_product_taxes = { PRODUCT = industry_ivory }
	map_product_taxes = { PRODUCT = industry_aromatics }
	map_product_taxes = { PRODUCT = industry_dyestuff }
	map_product_taxes = { PRODUCT = industry_timber }
	map_product_taxes = { PRODUCT = industry_honey }
	map_product_taxes = { PRODUCT = industry_gemstones }
	map_product_taxes = { PRODUCT = industry_spices }
	map_product_taxes = { PRODUCT = industry_fish }

	map_product_taxes = { PRODUCT = industry_ceramic }
	map_product_taxes = { PRODUCT = industry_glass }
	map_product_taxes = { PRODUCT = industry_silk }
	map_product_taxes = { PRODUCT = industry_paper }
	map_product_taxes = { PRODUCT = industry_cloth }
	map_product_taxes = { PRODUCT = industry_leather }
}

map_product_taxes = { # needs PRODUCT
	if = {
		limit = {
			exists = var:$PRODUCT$_product
			var:$PRODUCT$_product > 0
		}
		change_local_variable = {
			name = product_taxes
			add = county_precious_metal_from_$PRODUCT$
		}
	}
}

trade_mapping_building_map = {
	every_county = {
		if = {
			limit = {
				title_province = { 
					NOT = { has_holding_type = tribal_holding }
				}
			}
			if = {
				limit = {
					exists = county_industry_building_value
				}
				save_scope_value_as = {
					name = building_value
					value = county_industry_building_value
				}
				if = {
					limit = { scope:building_value < -0.9 }
					set_color_county_provinces = { COLOR = neg_8 }
				}
				else_if = {
					limit = { scope:building_value < -0.7 }
					set_color_county_provinces = { COLOR = neg_7 }
				}
				else_if = {
					limit = { scope:building_value < -0.5 }
					set_color_county_provinces = { COLOR = neg_6 }
				}
				else_if = {
					limit = { scope:building_value < -0.4 }
					set_color_county_provinces = { COLOR = neg_5 }
				}
				else_if = {
					limit = { scope:building_value < -0.3 }
					set_color_county_provinces = { COLOR = neg_4 }
				}
				else_if = {
					limit = { scope:building_value < -0.2 }
					set_color_county_provinces = { COLOR = neg_3 }
				}
				else_if = {
					limit = { scope:building_value < -0.1 }
					set_color_county_provinces = { COLOR = neg_2 }
				}
				else_if = {
					limit = { scope:building_value < 0 }
					set_color_county_provinces = { COLOR = neg_1 }
				}
				else_if = {
					limit = { scope:building_value < 0.1 }
					set_color_county_provinces = { COLOR = 0 }
				}
				else_if = {
					limit = { scope:building_value < 0.2 }
					set_color_county_provinces = { COLOR = 1 }
				}
				else_if = {
					limit = { scope:building_value < 0.3 }
					set_color_county_provinces = { COLOR = 2 }
				}
				else_if = {
					limit = { scope:building_value < 0.4 }
					set_color_county_provinces = { COLOR = 3 }
				}
				else_if = {
					limit = { scope:building_value < 0.5 }
					set_color_county_provinces = { COLOR = 4 }
				}
				else_if = {
					limit = { scope:building_value < 0.6 }
					set_color_county_provinces = { COLOR = 5 }
				}
				else_if = {
					limit = { scope:building_value < 0.7 }
					set_color_county_provinces = { COLOR = 6 }
				}
				else_if = {
					limit = { scope:building_value < 0.8 }
					set_color_county_provinces = { COLOR = 7 }
				}
				else_if = {
					limit = { scope:building_value < 0.9 }
					set_color_county_provinces = { COLOR = 8 }
				}
				else_if = {
					limit = { scope:building_value < 1.0 }
					set_color_county_provinces = { COLOR = 9 }
				}
				else_if = {
					limit = { scope:building_value < 1.1 }
					set_color_county_provinces = { COLOR = 10 }
				}
				else_if = {
					limit = { scope:building_value < 1.2 }
					set_color_county_provinces = { COLOR = 11 }
				}
				else_if = {
					limit = { scope:building_value < 1.4 }
					set_color_county_provinces = { COLOR = 12 }
				}
				else_if = {
					limit = { scope:building_value < 1.6 }
					set_color_county_provinces = { COLOR = 13 }
				}
				else_if = {
					limit = { scope:building_value < 1.8 }
					set_color_county_provinces = { COLOR = 14 }
				}
				else_if = {
					limit = { scope:building_value < 2.0 }
					set_color_county_provinces = { COLOR = 15 }
				}
				else_if = {
					limit = { scope:building_value < 2.2 }
					set_color_county_provinces = { COLOR = 16 }
				}
				else_if = {
					limit = { scope:building_value < 2.4 }
					set_color_county_provinces = { COLOR = 17 }
				}
				else_if = {
					limit = { scope:building_value < 2.6 }
					set_color_county_provinces = { COLOR = 18 }
				}
				else_if = {
					limit = { scope:building_value < 2.8 }
					set_color_county_provinces = { COLOR = 19 }
				}
				else_if = {
					limit = { scope:building_value < 3.0 }
					set_color_county_provinces = { COLOR = 20 }
				}
				else_if = {
					limit = { scope:building_value < 3.5 }
					set_color_county_provinces = { COLOR = 21 }
				}
				else = {
					# limit = { scope:building_value >= 3.5 }
					set_color_county_provinces = { COLOR = 22 }
				}
			}
			else = {
				set_color_county_base = yes
			}
		}
		else = {
			set_color_county_base = yes
		}
	}
}