﻿namespace = gdp_trade_good_flavor

####
## Trade-good flavor events, fired only from gdp_merchant_yearly_events
## 1000-1999 - Generic events (any good)
# gdp_trade_good_flavor.1001 - Counting Stock
# gdp_trade_good_flavor.1002 - Word Travels (buyer praise)
# gdp_trade_good_flavor.1003 - From the Source (origin report)
# gdp_trade_good_flavor.1004 - An Open Road (route boost)
# gdp_trade_good_flavor.1005 - Dreams of Profit
# gdp_trade_good_flavor.1006 - Fools Who Check (low-quality goods)
# gdp_trade_good_flavor.1007 - Ask for It by Name (your name on the crate)
# gdp_trade_good_flavor.1008 - The Appraiser (called to judge)
# gdp_trade_good_flavor.1009 - Learn to Count (teach the heir)
# gdp_trade_good_flavor.1010 - The Imitator
# gdp_trade_good_flavor.1011 - The Price of Names (they want your suppliers)
# gdp_trade_good_flavor.1012 - A Truce of Traders (the trade ally)
# gdp_trade_good_flavor.1013 - A Private Price
# gdp_trade_good_flavor.1014 - Ask the Old Hands
# gdp_trade_good_flavor.1015 - A Beginner's Mistake
# gdp_trade_good_flavor.1016 - The Merchant's Handbook
# gdp_trade_good_flavor.1017 - The Feel of It (buy the sample)
# gdp_trade_good_flavor.1018 - Wrong Measure
# gdp_trade_good_flavor.1019 - Two Goods, One Buyer
# gdp_trade_good_flavor.1020 - The Builder's Rate
# gdp_trade_good_flavor.1021 - Know the Goods (study the good)
# gdp_trade_good_flavor.1022 - A Name for the Trade
# gdp_trade_good_flavor.1023 - A Choke on Supply
# gdp_trade_good_flavor.1024 - Under the Hammer
# gdp_trade_good_flavor.1025 - First at the Quay
# gdp_trade_good_flavor.1026 - By the Handful
# gdp_trade_good_flavor.1027 - Market Day
# gdp_trade_good_flavor.1028 - Foreign Coin
# gdp_trade_good_flavor.1029 - Years on the Road
# gdp_trade_good_flavor.1030 - Watching It Sell (renowned)
# gdp_trade_good_flavor.1031 - Outside Money
# gdp_trade_good_flavor.1032 - The Display Room
# gdp_trade_good_flavor.1033 - Keeping Your Hand In
# gdp_trade_good_flavor.1034 - The Itinerary (fledgling)
# gdp_trade_good_flavor.1035 - Talking Shop
# gdp_trade_good_flavor.1036 - The Packing Floor
# gdp_trade_good_flavor.1037 - The Market Seal
# gdp_trade_good_flavor.1038 - The Broker
# gdp_trade_good_flavor.1039 - The Trader's Apprentice (player-only)
# gdp_trade_good_flavor.1040 - Swimming in It (wealthy)
# gdp_trade_good_flavor.1041 - The First Sale (wealthy, once)
# gdp_trade_good_flavor.1042 - Coin Under the Pillow (wealthy)
# gdp_trade_good_flavor.1043 - Portrait With Coins (wealthy, once)
# gdp_trade_good_flavor.1044 - A Purse Too Heavy (wealthy)
# gdp_trade_good_flavor.1045 - Profit and Piety (zealous, or forbidden alcohol)
# gdp_trade_good_flavor.1046 - One of Their Own (trader shares the market's faith or culture)
# gdp_trade_good_flavor.1047 - Flooded Market (rival dumping)
# gdp_trade_good_flavor.1048 - Manuscript in a Bale
# gdp_trade_good_flavor.1049 - Merchants From Home (diaspora)
# gdp_trade_good_flavor.1050 - The Salt Road (smuggler)
## 2000-2999 - Category events
# gdp_trade_good_flavor.2001 - A Heavy Harvest (farmed goods)
# gdp_trade_good_flavor.2002 - The Hunter's Haul (forest goods)
# gdp_trade_good_flavor.2003 - A Rich Vein (minerals)
# gdp_trade_good_flavor.2004 - Worth Its Secret (artisanal goods)
# gdp_trade_good_flavor.2005 - A Matter of Taste (comforts)
# gdp_trade_good_flavor.2006 - Dress the Part (clothes)
# gdp_trade_good_flavor.2007 - Face Value (precious metals)
# gdp_trade_good_flavor.2008 - Intact (fragile goods)
# gdp_trade_good_flavor.2009 - Other Men See Armies (selling into a war)
# gdp_trade_good_flavor.2010 - The Guild Knocks (guild goods)
# gdp_trade_good_flavor.2011 - Rulers Set Fashions (wearable luxuries)
# gdp_trade_good_flavor.2012 - Sample the Goods (alcohol, stressed)
# gdp_trade_good_flavor.2013 - A Masterwork Order
# gdp_trade_good_flavor.2014 - Their Dish, Our Goods (food)
# gdp_trade_good_flavor.2015 - Paid in Goods (forest goods)
# gdp_trade_good_flavor.2016 - Money Doesn't Stink (smelly goods)
# gdp_trade_good_flavor.2017 - Seven Fat Years (food goods)
# gdp_trade_good_flavor.2018 - Somebody's Cattle (livestock raiders)
# gdp_trade_good_flavor.2019 - A Dry Court's Thirst (alcohol, dry faith)
## 3000-3999 - Good-specific events
# gdp_trade_good_flavor.3001 - A Perfect Wheel (cheese)
# gdp_trade_good_flavor.3002 - A Famous Complaint (copper, Ea-nasir)
# gdp_trade_good_flavor.3003 - Rent in Pepper (spices)
# gdp_trade_good_flavor.3004 - A Letter Full of Complaints (flax)
# gdp_trade_good_flavor.3005 - A Subtlety (sugar)
# gdp_trade_good_flavor.3006 - The Swarm (honey)
# gdp_trade_good_flavor.3007 - Another Pot of Tea (tea)
# gdp_trade_good_flavor.3008 - Before It Turns (fruit)
# gdp_trade_good_flavor.3009 - The Midnight Oil (oil)
# gdp_trade_good_flavor.3010 - In the Blade (grain)
# gdp_trade_good_flavor.3011 - Ten-Year Millet (millet)
# gdp_trade_good_flavor.3012 - Polished or Not (rice)
# gdp_trade_good_flavor.3013 - Before the Fast (meat)
# gdp_trade_good_flavor.3014 - Look It in the Mouth (horses)
# gdp_trade_good_flavor.3015 - Fatten for Market (cattle)
# gdp_trade_good_flavor.3016 - Calfskin for the Scribes (leather)
# gdp_trade_good_flavor.3017 - Buying the Clip (wool)
# gdp_trade_good_flavor.3018 - The Vegetable Lamb (cotton)
# gdp_trade_good_flavor.3019 - Spolia (stone)
# gdp_trade_good_flavor.3020 - The Mast Trunk (wood)
# gdp_trade_good_flavor.3021 - The Tent of Smoke (hemp)
# gdp_trade_good_flavor.3022 - A Blade From My Best (iron)
# gdp_trade_good_flavor.3023 - The Lapidary's Claim (gems)
# gdp_trade_good_flavor.3024 - The Gentleman's Stone (jade)
# gdp_trade_good_flavor.3025 - Porcelain Ballast (ceramics)
# gdp_trade_good_flavor.3026 - The Sap Bites (lacquerware)
# gdp_trade_good_flavor.3027 - Reading Stones (glass)
# gdp_trade_good_flavor.3028 - Feast-Day Prices (incense)
# gdp_trade_good_flavor.3029 - Theriac (medicaments)
# gdp_trade_good_flavor.3030 - No Paper for Charters (books and paper)
# gdp_trade_good_flavor.3031 - Gruit or Hops (beer)
# gdp_trade_good_flavor.3032 - A Basket of Fruit (any merchant, regional fruit)

# Counting Stock
gdp_trade_good_flavor.1001 = {
	type = character_event
	title = gdp_trade_good_flavor.1001.t
	desc = gdp_trade_good_flavor.1001.desc
	theme = merchant
	override_background = bp1_wine_cellar

	left_portrait = {
		character = root
		animation = holding_tally_stick
		camera = camera_event_right_away
	}

	widgets = {
		widget = { gui = event_window_widget_vfx_background_flickering_candlelight_dark container = foreground_shader_vfx_container }
		widget = { gui = event_window_widget_vfx_left_character_flickering_candlelight_dark container = foreground_shader_vfx_container }
		widget = {
			gui = "event_window_widget_trade_good"
			container = "custom_widgets_container"
		}
	}

	cooldown = { years = 15 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
	}

	immediate = {
		add_character_flag = {
			flag = use_sickness_clothes
			days = 7
		}
		gdp_tgf_setup_good_effect = yes
	}

	option = {
		name = gdp_trade_good_flavor.1001.a
		add_stress = medium_stress_loss
		ai_chance = {
			base = 100
			modifier = { has_trait = generous factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1001.b
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_medium_value
		}
		if = {
			limit = { has_trait = lifestyle_merchant }
			add_trait_xp = {
				trait = lifestyle_merchant
				track = creditor
				value = lifestyle_merchant_xp_gain_minor_value
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = lazy factor = 0 }
		}
	}

	after = {
		remove_character_flag = use_sickness_clothes
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = market someone else owns, where $ROUTE$ sells a needed good. Expects root = the merchant
scripted_trigger gdp_tgf_praise_market_trigger = {
	save_temporary_scope_as = tgf_praise_market_temp
	gdp_tgf_stranger_holder_market_trigger = yes
	any_trade_good_with_need = {
		save_temporary_scope_as = tgf_praise_good_temp
		$ROUTE$ = {
			is_selling_trade_good_in_market = {
				trade_market = scope:tgf_praise_market_temp
				trade_good_type = scope:tgf_praise_good_temp
			}
		}
	}
}

# this = trade route. Expects root = the merchant
scripted_trigger gdp_tgf_praise_route_trigger = {
	is_commission_route = no
	save_temporary_scope_as = tgf_praise_route_temp
	any_trade_market_on_route = {
		gdp_tgf_praise_market_trigger = { ROUTE = scope:tgf_praise_route_temp }
	}
}

# Word Travels
gdp_trade_good_flavor.1002 = {
	type = character_event
	title = gdp_trade_good_flavor.1002.t
	desc = gdp_trade_good_flavor.1002.desc
	theme = merchant

	left_portrait = {
		character = root
		animation = trade_deal
		camera = camera_event_very_left
	}
	right_portrait = {
		character = scope:tgf_market_holder
		animation = royal_wave
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			highest_traded_good_category_xp_level >= gdp_tgf_renowned_expertise_level_value
		}
	}

	cooldown = { years = 15 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_praise_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_praise_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = { gdp_tgf_praise_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
		}
		scope:tgf_market = {
			random_trade_good_with_need = {
				limit = {
					save_temporary_scope_as = tgf_praise_good_temp
					scope:tgf_route = {
						is_selling_trade_good_in_market = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_praise_good_temp
						}
					}
				}
				save_scope_as = tgf_good
			}
			trade_market_owner = {
				holder = { save_scope_as = tgf_market_holder }
			}
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.1002.a
		pay_short_term_gold = {
			target = scope:tgf_market_holder
			gold = minor_gold_value
		}
		add_prestige = medium_prestige_gain
		scope:tgf_market_holder = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 20
			}
		}
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = 0.01 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1002.b
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = 0.02 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		scope:tgf_market_holder = {
			add_opinion = {
				target = root
				modifier = annoyed_opinion
				opinion = -20
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = generous factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1002.c
		add_prestige = minor_prestige_gain
		ai_chance = {
			base = 100
			modifier = { has_trait = humble factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# From the Source
gdp_trade_good_flavor.1003 = {
	type = character_event
	title = gdp_trade_good_flavor.1003.t
	desc = gdp_trade_good_flavor.1003.desc
	theme = trade
	override_background = {
		trigger = {
			OR = {
				scope:tgf_category = trade_good_category:trade_category_base_metals
				scope:tgf_category = trade_good_category:trade_category_precious_metals
				scope:tgf_good = trade_good_type:trade_good_jewelry
			}
		}
		reference = gdp_smithy_workshop
	}
	override_background = {
		trigger = {
			OR = {
				scope:tgf_good = trade_good_type:trade_good_wood
				scope:tgf_good = trade_good_type:trade_good_hemp
				scope:tgf_good = trade_good_type:trade_good_lacquerware
			}
		}
		reference = gdp_carpentry_workshop
	}
	override_background = {
		trigger = {
			OR = {
				scope:tgf_good = trade_good_type:trade_good_leather
				scope:tgf_good = trade_good_type:trade_good_furs
				scope:tgf_good = trade_good_type:trade_good_dyes
			}
		}
		reference = gdp_tannery
	}
	override_background = {
		trigger = {
			OR = {
				scope:tgf_good = trade_good_type:trade_good_glass
				scope:tgf_good = trade_good_type:trade_good_ceramics
				scope:tgf_good = trade_good_type:trade_good_textiles
			}
		}
		reference = gdp_artisan_street
	}
	override_background = {
		trigger = { scope:tgf_good = trade_good_type:trade_good_oil }
		reference = bp1_wine_cellar
	}
	override_background = { reference = sitting_room }

	left_portrait = {
		character = root
		animation = pondering
		camera = camera_event_left
	}

	right_portrait = {
		character = scope:tgf_trader
		animation = writing
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 15 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_report_route_trigger = yes }
	}

	immediate = {
		gdp_tgf_setup_buy_report_effect = yes
	}

	option = {
		name = gdp_trade_good_flavor.1003.a
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_medium_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = lazy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1003.b
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = buy_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = -0.01 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = generous factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1003.c
		trigger = {
			NOT = { culture = scope:tgf_source_culture }
		}
		scope:tgf_source_culture = {
			change_cultural_acceptance = {
				target = root.culture
				value = minor_cultural_acceptance_gain
				desc = cultural_acceptance_gain_event
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = arrogant factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# An Open Road
gdp_trade_good_flavor.1004 = {
	type = character_event
	title = gdp_trade_good_flavor.1004.t
	desc = gdp_trade_good_flavor.1004.desc
	theme = trade
	override_background = { reference = market }

	left_portrait = {
		character = root
		animation = holding_scales
		camera = camera_event_very_left
	}
	right_portrait = {
		character = scope:tgf_trader
		animation = merchant_gesturing
		camera = camera_event_right_away
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 15 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = {
			is_commission_route = no
			has_trader = yes
			any_traded_good = { always = yes }
		}
	}

	immediate = {
		random_trade_route = {
			limit = {
				is_commission_route = no
				has_trader = yes
				any_traded_good = { always = yes }
			}
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			trader = { save_scope_as = tgf_trader }
			random_traded_good = { save_scope_as = tgf_good }
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.1004.a
		add_gold = minor_gold_value
		add_trade_good_price_modifier = {
			type = sell_mult
			trade_good_type = scope:tgf_good
			value = { value = 0.01 multiply = gdp_tgf_renown_tier_value }
			years = 10
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = content factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1004.b
		add_gold = minor_gold_value
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_medium_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = lazy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1004.c
		scope:tgf_route = {
			gdp_tgf_add_tiered_route_modifier_effect = {
				MODIFIER = gdp_tgf_heavier_loads
				YEARS = 10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = craven factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# Dreams of Profit
gdp_trade_good_flavor.1005 = {
	type = character_event
	title = gdp_trade_good_flavor.1005.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:tgf_category = trade_good_category:trade_category_beasts_of_burden }
				desc = gdp_trade_good_flavor.1005.desc.livestock
			}
			desc = gdp_trade_good_flavor.1005.desc
		}
		desc = gdp_trade_good_flavor.1005.desc.outro
	}
	theme = merchant
	override_background = { reference = bedchamber }

	left_portrait = {
		character = root
		animation = laugh
		camera = camera_event_right_forward
	}

	widgets = {
		widget = { gui = event_window_widget_vfx_background_night_scene container = foreground_shader_vfx_container }
		widget = { gui = event_window_widget_vfx_left_character_night_scene container = foreground_shader_vfx_container }
		widget = {
			gui = "event_window_widget_trade_good"
			container = "custom_widgets_container"
		}
	}

	cooldown = { years = 15 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
	}

	immediate = {
		add_character_flag = {
			flag = use_sickness_clothes
			days = 7
		}
		gdp_tgf_setup_good_effect = yes
	}

	option = {
		name = gdp_trade_good_flavor.1005.a
		trigger = {
			can_create_task_contract = { type_name = promote_goods }
		}
		custom_tooltip = gdp_trade_good_flavor.1005.a.tt
		trigger_event = { on_action = gdp_promote_goods }
		ai_chance = {
			base = 100
			modifier = { has_trait = lazy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1005.b
		add_stress = minor_stress_gain
		add_trade_good_price_modifier = {
			type = sell_mult
			trade_good_type = scope:tgf_good
			value = { value = 0.01 multiply = gdp_tgf_renown_tier_value }
			years = 10
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = content factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1005.c
		add_stress = minor_stress_loss
		ai_chance = {
			base = 100
			modifier = { has_trait = diligent factor = 0 }
		}
	}

	after = {
		remove_character_flag = use_sickness_clothes
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# Fools Who Check
gdp_trade_good_flavor.1006 = {
	type = character_event
	title = gdp_trade_good_flavor.1006.t
	desc = gdp_trade_good_flavor.1006.desc
	theme = merchant
	override_background = { reference = bp1_wine_cellar }

	left_portrait = {
		character = root
		animation = trade_deal
		camera = camera_event_left_crowning_observation
	}
	right_portrait = {
		character = scope:tgf_trader
		animation = arguing
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 15 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_report_route_trigger = yes }
	}

	immediate = {
		gdp_tgf_setup_buy_report_effect = yes
	}

	option = {
		name = gdp_trade_good_flavor.1006.a
		add_prestige = minor_prestige_loss
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = buy_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = -0.02 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		stress_impact = {
			honest = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = honest factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1006.b
		add_prestige = minor_prestige_gain
		stress_impact = {
			greedy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = trade route with a trader that sells a good in a market with an origin county
scripted_trigger gdp_tgf_crate_route_trigger = {
	is_commission_route = no
	has_trader = yes
	save_temporary_scope_as = tgf_crate_route_temp
	any_trade_market_on_route = {
		gdp_tgf_route_sells_here_trigger = { ROUTE = scope:tgf_crate_route_temp }
	}
}

# Ask for It by Name
gdp_trade_good_flavor.1007 = {
	type = character_event
	title = gdp_trade_good_flavor.1007.t
	desc = gdp_trade_good_flavor.1007.desc
	theme = trade
	override_background = { reference = market }

	left_portrait = {
		character = root
		animation = merchant_gesturing
		camera = camera_event_center
	}
	right_portrait = {
		character = scope:tgf_trader
		triggered_animation = {
			trigger = { exists = scope:tgf_good }
			scripted_animation = gdp_tgf_good_animation
		}
		animation = merchant_box
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			highest_traded_good_category_xp_level >= gdp_tgf_renowned_expertise_level_value
		}
	}

	cooldown = { years = 15 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		exists = house
		any_trade_route = { gdp_tgf_crate_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_crate_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			trader = { save_scope_as = tgf_trader }
			random_trade_market_on_route = {
				limit = { gdp_tgf_route_sells_here_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					save_temporary_scope_as = tgf_crate_good_temp
					scope:tgf_route = {
						is_selling_trade_good_in_market = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_crate_good_temp
						}
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					county = {
						save_scope_as = tgf_source_county
						culture = { save_scope_as = tgf_source_culture }
					}
				}
			}
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		gdp_tgf_set_background_location_effect = {
			CHAR = scope:tgf_trader
			PROVINCE = scope:tgf_market.trade_market_owner.title_province
		}
	}

	option = {
		name = gdp_trade_good_flavor.1007.a
		add_prestige = medium_prestige_gain
		scope:tgf_route = {
			gdp_tgf_add_tiered_route_modifier_effect = {
				MODIFIER = gdp_tgf_known_mark
				YEARS = 10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = humble factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1007.b
		add_prestige = minor_prestige_gain
		add_gold = minor_gold_value
		add_trade_good_price_modifier = {
			type = sell_mult
			trade_good_type = scope:tgf_good
			value = { value = 0.01 multiply = gdp_tgf_renown_tier_value }
			years = 10
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = generous factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = market with a stranger holder, where $ROUTE$ buys or sells. Expects root = the merchant
scripted_trigger gdp_tgf_judge_market_trigger = {
	gdp_tgf_stranger_holder_market_trigger = yes
	OR = {
		gdp_tgf_route_buys_here_trigger = { ROUTE = $ROUTE$ }
		gdp_tgf_route_sells_here_trigger = { ROUTE = $ROUTE$ }
	}
}

# this = route where a market has a foreign holder and trades one of the route's goods. Expects root = the merchant
scripted_trigger gdp_tgf_judge_route_trigger = {
	is_commission_route = no
	save_temporary_scope_as = tgf_judge_route_temp
	any_trade_market_on_route = {
		gdp_tgf_judge_market_trigger = { ROUTE = scope:tgf_judge_route_temp }
	}
}

# The Appraiser
gdp_trade_good_flavor.1008 = {
	type = character_event
	title = gdp_trade_good_flavor.1008.t
	desc = gdp_trade_good_flavor.1008.desc
	theme = trade
	override_background = { reference = study }

	left_portrait = {
		character = root
		animation = holding_scales
		camera = camera_event_left
	}
	right_portrait = {
		character = scope:tgf_market_holder
		animation = worry
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			highest_traded_good_category_xp_level >= gdp_tgf_renowned_expertise_level_value
		}
	}

	cooldown = { years = 15 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_judge_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_judge_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = { gdp_tgf_judge_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					save_temporary_scope_as = tgf_judge_good_temp
					scope:tgf_route = {
						OR = {
							is_buying_trade_good_in_market = {
								trade_market = scope:tgf_market
								trade_good_type = scope:tgf_judge_good_temp
							}
							is_selling_trade_good_in_market = {
								trade_market = scope:tgf_market
								trade_good_type = scope:tgf_judge_good_temp
							}
						}
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				holder = { save_scope_as = tgf_market_holder }
			}
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.1008.a
		scope:tgf_market_holder = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 35
			}
		}
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_medium_value
		}
		add_prestige = medium_prestige_gain
		ai_chance = {
			base = 100
			modifier = { has_trait = deceitful factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1008.b
		trigger = {
			is_ai = no
		}
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_minor_value
		}
		scope:tgf_market_holder = {
			pay_short_term_gold = {
				target = root
				gold = minor_gold_value
			}
			add_opinion = {
				target = root
				modifier = pleased_opinion
				opinion = 15
			}
		}
		stress_impact = {
			honest = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = honest factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1008.c
		trigger = {
			is_ai = no
			scope:tgf_market_holder = { short_term_gold >= medium_gold_value }
		}
		show_as_unavailable = { always = yes }
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_miniscule_value
		}
		scope:tgf_market_holder = {
			pay_short_term_gold = {
				target = root
				gold = medium_gold_value
			}
			add_opinion = {
				target = root
				modifier = annoyed_opinion
				opinion = -10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = generous factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# Learn to Count
gdp_trade_good_flavor.1009 = {
	type = character_event
	title = gdp_trade_good_flavor.1009.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:tgf_category = trade_good_category:trade_category_beasts_of_burden }
				desc = gdp_trade_good_flavor.1009.desc.livestock
			}
			desc = gdp_trade_good_flavor.1009.desc
		}
		desc = gdp_trade_good_flavor.1009.desc.outro
	}
	theme = merchant
	override_background = { reference = bp1_wine_cellar }

	left_portrait = {
		character = root
		animation = holding_tally_stick
		camera = camera_event_left
	}
	right_portrait = {
		character = scope:tgf_heir
		triggered_animation = {
			trigger = { exists = scope:tgf_good }
			scripted_animation = gdp_tgf_good_animation
		}
		animation = merchant_box
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 15 }

	trigger = {
		is_available = yes
		gdp_tgf_eligible_trigger = yes
		exists = player_heir
		player_heir = {
			is_ai = yes
			age >= 8
			is_physically_able = yes
		}
	}

	immediate = {
		gdp_tgf_setup_good_effect = yes
		player_heir = { save_scope_as = tgf_heir }
	}

	option = {
		name = gdp_trade_good_flavor.1009.a
		scope:tgf_heir = {
			add_stewardship_skill = 1
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 15
			}
		}
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_miniscule_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = lazy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1009.b
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_minor_value
		}
		scope:tgf_heir = {
			add_opinion = {
				target = root
				modifier = annoyed_opinion
				opinion = -10
			}
			if = {
				limit = { has_trait = lifestyle_merchant }
				add_trait_xp = {
					trait = lifestyle_merchant
					track = artisan
					value = lifestyle_merchant_xp_gain_minor_value
				}
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = compassionate factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = trade market where $ROUTE$ sells a good and an AI rival with an AI-headed house trades too
scripted_trigger gdp_tgf_imitator_market_trigger = {
	gdp_tgf_route_sells_here_trigger = { ROUTE = $ROUTE$ }
	any_potential_trade_rival_in_market = {
		target = root
		gdp_tgf_valid_rival_trigger = yes
		exists = house
		house.house_head ?= { is_ai = yes }
		NOT = { house = root.house }
	}
}

# this = trade route where a market has an AI rival from an AI-led house. Expects root = the merchant
scripted_trigger gdp_tgf_imitator_route_trigger = {
	is_commission_route = no
	has_trader = yes
	save_temporary_scope_as = tgf_imitator_route_temp
	any_trade_market_on_route = {
		gdp_tgf_imitator_market_trigger = { ROUTE = scope:tgf_imitator_route_temp }
	}
}

# The Imitator
gdp_trade_good_flavor.1010 = {
	type = character_event
	title = gdp_trade_good_flavor.1010.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:tgf_category = trade_good_category:trade_category_beasts_of_burden }
				desc = gdp_trade_good_flavor.1010.desc.livestock
			}
			desc = gdp_trade_good_flavor.1010.desc
		}
		desc = gdp_trade_good_flavor.1010.desc.outro
	}
	theme = merchant
	override_background = { reference = market }

	left_portrait = {
		character = root
		animation = anger
		camera = camera_event_left
	}
	right_portrait = {
		character = scope:tgf_trader
		animation = arguing
		camera = camera_event_right
	}
	lower_center_portrait = {
		character = scope:tgf_rival
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			highest_traded_good_category_xp_level >= gdp_tgf_renowned_expertise_level_value
		}
	}

	cooldown = { years = 15 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		house.house_head ?= {
			OR = {
				this = root
				is_ai = yes
			}
		}
		any_trade_route = { gdp_tgf_imitator_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_imitator_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			trader = { save_scope_as = tgf_trader }
			random_trade_market_on_route = {
				limit = { gdp_tgf_imitator_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					save_temporary_scope_as = tgf_imitator_good_temp
					scope:tgf_route = {
						is_selling_trade_good_in_market = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_imitator_good_temp
						}
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			random_potential_trade_rival_in_market = {
				target = root
				limit = {
					gdp_tgf_valid_rival_trigger = yes
					exists = house
					house.house_head ?= { is_ai = yes }
					NOT = { house = root.house }
				}
				save_scope_as = tgf_rival
			}
			trade_market_owner = {
				title_province = {
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		scope:tgf_rival = {
			random_held_title = {
				limit = { gdp_merchant_company_title_trigger = yes }
				save_scope_as = tgf_rival_company
			}
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		gdp_tgf_set_background_location_effect = {
			CHAR = scope:tgf_trader
			PROVINCE = scope:tgf_market.trade_market_owner.title_province
		}
	}

	option = {
		name = gdp_trade_good_flavor.1010.a
		remove_short_term_gold = minor_gold_value
		add_prestige = medium_prestige_gain
		scope:tgf_rival = {
			add_opinion = {
				target = root
				modifier = annoyed_opinion
				opinion = -20
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = forgiving factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1010.b
		add_prestige = minor_prestige_gain
		scope:tgf_rival = {
			add_opinion = {
				target = root
				modifier = annoyed_opinion
				opinion = -20
			}
		}
		house = {
			if = {
				limit = {
					NOT = { has_house_relation_with = scope:tgf_rival.house }
				}
				set_house_relation = {
					target = scope:tgf_rival.house
					level = quarrel
					description = house_relation_tgf_imitation_desc
				}
			}
			else = {
				change_house_relation_effect = {
					HOUSE = scope:tgf_rival.house
					VALUE = house_relation_damage_minor_value
					REASON = tgf_imitation
					CHAR = root
					TARGET_CHAR = scope:tgf_rival
					TITLE = scope:tgf_rival_company
				}
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = humble factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1010.c
		add_prestige = medium_prestige_loss
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = 0.02 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = vengeful factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = a rival with money on hand and an adult to send, since we create no one for the errand
scripted_trigger gdp_tgf_supplier_rival_trigger = {
	gdp_tgf_valid_rival_trigger = yes
	short_term_gold >= medium_gold_value
	OR = {
		any_trade_route = {
			has_trader = yes
			trader ?= { is_physically_able_adult = yes }
		}
		any_courtier = { is_physically_able_adult = yes }
	}
}

# this = trade market where $ROUTE$ buys a good and a rival with means trades too. Expects root = the merchant
scripted_trigger gdp_tgf_supplier_market_trigger = {
	gdp_tgf_route_buys_here_trigger = { ROUTE = $ROUTE$ }
	any_potential_trade_rival_in_market = {
		target = root
		gdp_tgf_supplier_rival_trigger = yes
	}
}

# this = trade route with a supplier market on it. Expects root = the merchant
scripted_trigger gdp_tgf_supplier_route_trigger = {
	is_commission_route = no
	save_temporary_scope_as = tgf_supplier_route_temp
	any_trade_market_on_route = {
		gdp_tgf_supplier_market_trigger = { ROUTE = scope:tgf_supplier_route_temp }
	}
}

# The Price of Names
gdp_trade_good_flavor.1011 = {
	type = character_event
	title = gdp_trade_good_flavor.1011.t
	desc = gdp_trade_good_flavor.1011.desc
	theme = merchant
	override_background = { reference = bp1_wine_cellar }

	left_portrait = {
		character = root
		animation = biting_coin
		camera = camera_event_very_left
	}
	right_portrait = {
		character = scope:tgf_envoy
		animation = bribing
		camera = camera_event_right
	}
	lower_center_portrait = {
		character = scope:tgf_rival
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			highest_traded_good_category_xp_level >= gdp_tgf_renowned_expertise_level_value
		}
	}

	cooldown = { years = 15 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_supplier_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_supplier_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = { gdp_tgf_supplier_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					save_temporary_scope_as = tgf_supplier_good_temp
					scope:tgf_route = {
						is_buying_trade_good_in_market = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_supplier_good_temp
						}
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			random_potential_trade_rival_in_market = {
				target = root
				limit = { gdp_tgf_supplier_rival_trigger = yes }
				save_scope_as = tgf_rival
			}
		}
		scope:tgf_rival = {
			random_held_title = {
				limit = { gdp_merchant_company_title_trigger = yes }
				save_scope_as = tgf_rival_company
			}
			if = {
				limit = {
					any_trade_route = {
						has_trader = yes
						trader ?= { is_physically_able_adult = yes }
					}
				}
				random_trade_route = {
					limit = {
						has_trader = yes
						trader ?= { is_physically_able_adult = yes }
					}
					trader = { save_scope_as = tgf_envoy }
				}
			}
			else = {
				random_courtier = {
					limit = { is_physically_able_adult = yes }
					save_scope_as = tgf_envoy
				}
			}
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.1011.a
		trigger = { is_ai = no }
		scope:tgf_rival = {
			pay_short_term_gold = {
				target = root
				gold = medium_gold_value
			}
			gdp_increase_trade_expertise_xp_effect = {
				CATEGORY = scope:tgf_category
				VALUE = trade_expertise_xp_massive_value
			}
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = paranoid factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1011.b
		add_trade_good_price_modifier = {
			type = buy_mult
			trade_good_type = scope:tgf_good
			value = { value = -0.01 multiply = gdp_tgf_renown_tier_value }
			years = 10
		}
		gdp_tgf_add_tiered_character_modifier_effect = {
			MODIFIER = gdp_tgf_kept_edge
			YEARS = 10
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = an ally merchant candidate who does not resent root. Expects root = the merchant
scripted_trigger gdp_tgf_valid_ally_trigger = {
	gdp_tgf_valid_rival_trigger = yes
	exists = house
	house.house_head ?= { is_ai = yes }
	NOT = { house = root.house }
	opinion = {
		target = root
		value >= 0
	}
}

# this = trade market where $ROUTE$ sells a good that a friendly AI merchant also sells
scripted_trigger gdp_tgf_ally_market_trigger = {
	save_temporary_scope_as = tgf_ally_market_temp
	exists = trade_market_owner.title_province.county
	$ROUTE$ = {
		any_traded_good = {
			save_temporary_scope_as = tgf_ally_good_temp
			$ROUTE$ = {
				is_selling_trade_good_in_market = {
					trade_market = scope:tgf_ally_market_temp
					trade_good_type = scope:tgf_ally_good_temp
				}
			}
			root = {
				any_potential_trade_ally_on_routes = {
					trade_market = scope:tgf_ally_market_temp
					trade_good_type = scope:tgf_ally_good_temp
					gdp_tgf_valid_ally_trigger = yes
				}
			}
		}
	}
}

# this = trade route. Expects root = the merchant
scripted_trigger gdp_tgf_ally_route_trigger = {
	is_commission_route = no
	save_temporary_scope_as = tgf_ally_route_temp
	any_trade_market_on_route = {
		gdp_tgf_ally_market_trigger = { ROUTE = scope:tgf_ally_route_temp }
	}
}

# A Truce of Traders
gdp_trade_good_flavor.1012 = {
	type = character_event
	title = gdp_trade_good_flavor.1012.t
	desc = gdp_trade_good_flavor.1012.desc
	theme = merchant

	left_portrait = {
		character = root
		animation = trade_deal
		camera = camera_event_very_left
	}
	right_portrait = {
		character = scope:tgf_ally
		animation = merchant_gesturing
		camera = camera_event_very_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 15 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		house.house_head ?= {
			OR = {
				this = root
				is_ai = yes
			}
		}
		any_trade_route = { gdp_tgf_ally_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_ally_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = { gdp_tgf_ally_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					save_temporary_scope_as = tgf_ally_good_temp
					scope:tgf_route = {
						is_selling_trade_good_in_market = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_ally_good_temp
						}
					}
					root = {
						any_potential_trade_ally_on_routes = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_ally_good_temp
							gdp_tgf_valid_ally_trigger = yes
						}
					}
				}
				save_scope_as = tgf_good
			}
		}
		random_potential_trade_ally_on_routes = {
			trade_market = scope:tgf_market
			trade_good_type = scope:tgf_good
			limit = { gdp_tgf_valid_ally_trigger = yes }
			save_scope_as = tgf_ally
		}
		scope:tgf_ally = {
			random_held_title = {
				limit = { gdp_merchant_company_title_trigger = yes }
				save_scope_as = tgf_ally_company
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.1012.a
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = 0.01 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
			add_price_modifier_for_character = {
				type = sell_mult
				character = scope:tgf_ally
				trade_good_type = scope:tgf_good
				value = { value = 0.01 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		scope:tgf_ally = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 15
			}
		}
		house = {
			if = {
				limit = {
					NOT = { has_house_relation_with = scope:tgf_ally.house }
				}
				set_house_relation = {
					target = scope:tgf_ally.house
					level = cordial
					description = house_relation_tgf_truce_desc
				}
			}
			else = {
				change_house_relation_effect = {
					HOUSE = scope:tgf_ally.house
					VALUE = house_relation_improve_minor_value
					REASON = tgf_truce
					CHAR = root
					TARGET_CHAR = scope:tgf_ally
					TITLE = scope:tgf_ally_company
				}
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = ambitious factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1012.b
		add_prestige = medium_prestige_gain
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = buy_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = -0.01 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good
				value = -0.02
				years = 10
			}
		}
		gdp_tgf_add_tiered_character_modifier_effect = {
			MODIFIER = gdp_tgf_price_war
			YEARS = 10
		}
		scope:tgf_ally = {
			add_opinion = {
				target = root
				modifier = annoyed_opinion
				opinion = -15
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = content factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = market with a stranger holder, where $ROUTE$ buys. Expects root = the merchant
scripted_trigger gdp_tgf_private_market_trigger = {
	gdp_tgf_stranger_holder_market_trigger = yes
	gdp_tgf_route_buys_here_trigger = { ROUTE = $ROUTE$ }
}

# this = trade route where a foreign holder's market sells a good the route buys. Expects root = the merchant
scripted_trigger gdp_tgf_private_route_trigger = {
	is_commission_route = no
	save_temporary_scope_as = tgf_private_route_temp
	any_trade_market_on_route = {
		gdp_tgf_private_market_trigger = { ROUTE = scope:tgf_private_route_temp }
	}
}

# A Private Price
gdp_trade_good_flavor.1013 = {
	type = character_event
	title = gdp_trade_good_flavor.1013.t
	desc = gdp_trade_good_flavor.1013.desc
	theme = trade
	override_background = { reference = study }

	left_portrait = {
		character = root
		animation = trade_deal
		camera = camera_event_very_left
	}
	right_portrait = {
		character = scope:tgf_market_holder
		animation = debating
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			highest_traded_good_category_xp_level >= gdp_tgf_renowned_expertise_level_value
		}
	}

	cooldown = { years = 15 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_private_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_private_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = { gdp_tgf_private_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					save_temporary_scope_as = tgf_private_good_temp
					scope:tgf_route = {
						is_buying_trade_good_in_market = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_private_good_temp
						}
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				holder = { save_scope_as = tgf_market_holder }
			}
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.1013.a
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_minor_value
		}
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = buy_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = -0.05 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		add_trade_good_price_modifier = {
			type = buy_mult
			trade_good_type = scope:tgf_good
			value = 0.025
			years = 10
		}
		scope:tgf_market_holder = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = arrogant factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1013.b
		add_prestige = minor_prestige_gain
		ai_chance = {
			base = 100
			modifier = { has_trait = humble factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = fledgling buy market with a graying commoner in the local pool
scripted_trigger gdp_tgf_oldhands_market_trigger = {
	gdp_tgf_fledgling_buy_market_trigger = { ROUTE = $ROUTE$ }
	trade_market_owner.title_province = {
		save_temporary_scope_as = tgf_oldhands_province_temp
		any_pool_character = {
			province = scope:tgf_oldhands_province_temp
			is_healthy = yes
			has_no_particular_noble_roots_trigger = yes
			age >= 40
			is_physically_able_adult = yes
		}
	}
}

# this = trade route where an old porter waits at a fledgling buy market
scripted_trigger gdp_tgf_oldhands_route_trigger = {
	is_commission_route = no
	save_temporary_scope_as = tgf_oldhands_route_temp
	any_trade_market_on_route = {
		gdp_tgf_oldhands_market_trigger = { ROUTE = scope:tgf_oldhands_route_temp }
	}
}

# Ask the Old Hands
gdp_trade_good_flavor.1014 = {
	type = character_event
	title = gdp_trade_good_flavor.1014.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:tgf_category = trade_good_category:trade_category_beasts_of_burden }
				desc = gdp_trade_good_flavor.1014.desc.livestock
			}
			desc = gdp_trade_good_flavor.1014.desc
		}
	}
	theme = trade
	override_background = { reference = bp1_wine_cellar }

	left_portrait = {
		character = root
		animation = pondering
		camera = camera_event_left_to_the_left
	}
	right_portrait = {
		character = scope:tgf_porter
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_horses }
			animation = standing_horse
		}
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_cattle }
			animation = holding_yoke
		}
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_wool }
			animation = shepherd_with_sheep
		}
		triggered_animation = {
			trigger = { OR = { scope:tgf_good = trade_good_type:trade_good_wine scope:tgf_good = trade_good_type:trade_good_beer } }
			animation = drink_goblet
		}
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_meat }
			animation = holding_salami
		}
		triggered_animation = {
			trigger = { OR = { scope:tgf_good = trade_good_type:trade_good_cheese scope:tgf_good = trade_good_type:trade_good_tea scope:tgf_good = trade_good_type:trade_good_sugar scope:tgf_good = trade_good_type:trade_good_rice scope:tgf_good = trade_good_type:trade_good_fruit scope:tgf_good = trade_good_type:trade_good_honey } }
			animation = serving_tray
		}
		triggered_animation = {
			trigger = { OR = { scope:tgf_good = trade_good_type:trade_good_salt scope:tgf_good = trade_good_type:trade_good_spices scope:tgf_good = trade_good_type:trade_good_grain scope:tgf_good = trade_good_type:trade_good_millet } }
			animation = holding_scales
		}
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_incense }
			animation = thurible
		}
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_medicaments }
			animation = physician
		}
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_oil }
			animation = lantern
		}
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_books_paper }
			animation = holding_scrolls
		}
		triggered_animation = {
			trigger = { OR = { scope:tgf_good = trade_good_type:trade_good_gold scope:tgf_good = trade_good_type:trade_good_silver scope:tgf_good = trade_good_type:trade_good_copper scope:tgf_good = trade_good_type:trade_good_fish } }
			animation = merchant_box
		}
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_furs }
			animation = hunting_carcass_start
		}
		animation = holding_yoke
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			lowest_traded_good_category_xp_level < gdp_tgf_renowned_expertise_level_value
		}
	}

	cooldown = { years = 15 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_oldhands_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_oldhands_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = { gdp_tgf_oldhands_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					save_temporary_scope_as = tgf_fledgling_good_temp
					scope:tgf_route = {
						is_buying_trade_good_in_market = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_fledgling_good_temp
						}
					}
					trade_good_need_category = {
						save_temporary_scope_as = tgf_fledgling_cat_temp
					}
					root = {
						gdp_tgf_fledgling_in_category_trigger = { CATEGORY = scope:tgf_fledgling_cat_temp }
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					save_scope_as = tgf_source_province
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		random_pool_character = {
			province = scope:tgf_source_province
			limit = {
				is_healthy = yes
				has_no_particular_noble_roots_trigger = yes
				age >= 40
				is_physically_able_adult = yes
			}
			save_scope_as = tgf_porter
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.1014.a
		pay_short_term_gold = {
			target = scope:tgf_porter
			gold = miniscule_gold_value
		}
		scope:tgf_porter = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 10
			}
		}
		add_courtier = scope:tgf_porter
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_major_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1014.b
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_minor_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = arrogant factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = trade route that buys a good whose category root is still fledgling in. Expects root = the merchant
scripted_trigger gdp_tgf_fledgling_buy_route_trigger = {
	is_commission_route = no
	save_temporary_scope_as = tgf_fledgling_route_temp
	any_trade_market_on_route = {
		gdp_tgf_fledgling_buy_market_trigger = { ROUTE = scope:tgf_fledgling_route_temp }
	}
}

# A Beginner's Mistake
gdp_trade_good_flavor.1015 = {
	type = character_event
	title = gdp_trade_good_flavor.1015.t
	desc = gdp_trade_good_flavor.1015.desc
	theme = merchant

	left_portrait = {
		character = root
		animation = mental_anguish
		camera = camera_event_table_left
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			lowest_traded_good_category_xp_level < gdp_tgf_renowned_expertise_level_value
		}
	}

	cooldown = { years = 15 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		short_term_gold >= minor_gold_value
		any_trade_route = { gdp_tgf_fledgling_buy_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_fledgling_buy_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = { gdp_tgf_fledgling_buy_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					save_temporary_scope_as = tgf_fledgling_good_temp
					scope:tgf_route = {
						is_buying_trade_good_in_market = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_fledgling_good_temp
						}
					}
					trade_good_need_category = {
						save_temporary_scope_as = tgf_fledgling_cat_temp
					}
					root = {
						gdp_tgf_fledgling_in_category_trigger = { CATEGORY = scope:tgf_fledgling_cat_temp }
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		remove_short_term_gold = minor_gold_value
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.1015.a
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_major_value
		}
		if = {
			limit = { has_trait = lifestyle_merchant }
			add_trait_xp = {
				trait = lifestyle_merchant
				track = artisan
				value = lifestyle_merchant_xp_gain_minor_value
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = lazy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1015.b
		add_stress = minor_stress_loss
		ai_chance = {
			base = 100
			modifier = { has_trait = diligent factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = character who owns the handbook artifact of $HANDBOOK$ (practice, roads or mirror)
scripted_trigger gdp_tgf_owns_handbook_trigger = {
	any_character_artifact = { var:tgf_handbook ?= flag:$HANDBOOK$ }
}

# Creates the masterwork handbook named by scope:tgf_handbook, tagged so the same title is never found twice
scripted_effect gdp_tgf_create_handbook_effect = {
	gdp_tgf_roll_artifact_rarity_effect = { RARITY = masterwork }
	if = {
		limit = { scope:tgf_handbook = flag:practice }
		create_artifact = {
			name = gdp_tgf_handbook_practice_artifact
			description = gdp_tgf_handbook_practice_artifact_desc
			type = journal
			visuals = book
			modifier = artifact_trade_category_all_xp_gain_mult_1_modifier
			modifier = artifact_stewardship_1_modifier
			quality = scope:quality
			wealth = scope:wealth
			save_scope_as = newly_created_artifact
		}
	}
	else_if = {
		limit = { scope:tgf_handbook = flag:roads }
		create_artifact = {
			name = gdp_tgf_handbook_roads_artifact
			description = gdp_tgf_handbook_roads_artifact_desc
			type = journal
			visuals = book
			modifier = artifact_trade_category_all_xp_gain_mult_1_modifier
			modifier = artifact_stewardship_1_modifier
			quality = scope:quality
			wealth = scope:wealth
			save_scope_as = newly_created_artifact
		}
	}
	else_if = {
		limit = { scope:tgf_handbook = flag:mirror }
		create_artifact = {
			name = gdp_tgf_handbook_mirror_artifact
			description = gdp_tgf_handbook_mirror_artifact_desc
			type = journal
			visuals = book
			modifier = artifact_trade_category_all_xp_gain_mult_1_modifier
			modifier = artifact_stewardship_1_modifier
			quality = scope:quality
			wealth = scope:wealth
			save_scope_as = newly_created_artifact
		}
	}
	scope:newly_created_artifact ?= {
		set_variable = {
			name = tgf_handbook
			value = scope:tgf_handbook
		}
	}
	gdp_tgf_add_artifact_trade_modifiers_effect = yes
}

# The Merchant's Handbook
gdp_trade_good_flavor.1016 = {
	type = character_event
	title = gdp_trade_good_flavor.1016.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:tgf_category = trade_good_category:trade_category_beasts_of_burden }
				desc = gdp_trade_good_flavor.1016.desc.intro_livestock
			}
			desc = gdp_trade_good_flavor.1016.desc.intro
		}
		first_valid = {
			triggered_desc = {
				trigger = { scope:tgf_handbook = flag:practice }
				desc = gdp_trade_good_flavor.1016.desc.book_1
			}
			triggered_desc = {
				trigger = { scope:tgf_handbook = flag:roads }
				desc = gdp_trade_good_flavor.1016.desc.book_2
			}
			desc = gdp_trade_good_flavor.1016.desc.book_3
		}
		desc = gdp_trade_good_flavor.1016.desc.outro
	}
	theme = merchant
	override_background = { reference = study }

	left_portrait = {
		character = root
		animation = reading
		camera = camera_event_left
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			lowest_traded_good_category_xp_level < gdp_tgf_renowned_expertise_level_value
		}
	}

	cooldown = { years = 15 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		NOR = {
			gdp_tgf_owns_handbook_trigger = { HANDBOOK = practice }
			gdp_tgf_owns_handbook_trigger = { HANDBOOK = roads }
			gdp_tgf_owns_handbook_trigger = { HANDBOOK = mirror }
		}
	}

	immediate = {
		gdp_tgf_setup_good_effect = yes
		random_list = {
			1 = {
				trigger = { NOT = { gdp_tgf_owns_handbook_trigger = { HANDBOOK = practice } } }
				save_scope_value_as = { name = tgf_handbook value = flag:practice }
			}
			1 = {
				trigger = { NOT = { gdp_tgf_owns_handbook_trigger = { HANDBOOK = roads } } }
				save_scope_value_as = { name = tgf_handbook value = flag:roads }
			}
			1 = {
				trigger = { NOT = { gdp_tgf_owns_handbook_trigger = { HANDBOOK = mirror } } }
				save_scope_value_as = { name = tgf_handbook value = flag:mirror }
			}
		}
	}

	option = {
		name = gdp_trade_good_flavor.1016.a
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_major_value
		}
		gdp_tgf_create_handbook_effect = yes
		ai_chance = {
			base = 100
			modifier = { has_trait = lazy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1016.b
		add_gold = minor_gold_value
		add_prestige = medium_prestige_gain
		ai_chance = {
			base = 100
			modifier = { has_trait = curious factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = fledgling buy market with a commoner seller in the local pool
scripted_trigger gdp_tgf_sample_market_trigger = {
	gdp_tgf_fledgling_buy_market_trigger = { ROUTE = $ROUTE$ }
	trade_market_owner.title_province = {
		save_temporary_scope_as = tgf_sample_province_temp
		any_pool_character = {
			province = scope:tgf_sample_province_temp
			is_healthy = yes
			has_no_particular_noble_roots_trigger = yes
			is_physically_able_adult = yes
		}
	}
}

# this = trade route where a local seller waits at a fledgling buy market
scripted_trigger gdp_tgf_sample_route_trigger = {
	is_commission_route = no
	save_temporary_scope_as = tgf_sample_route_temp
	any_trade_market_on_route = {
		gdp_tgf_sample_market_trigger = { ROUTE = scope:tgf_sample_route_temp }
	}
}

# The Feel of It
gdp_trade_good_flavor.1017 = {
	type = character_event
	title = gdp_trade_good_flavor.1017.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:tgf_category = trade_good_category:trade_category_beasts_of_burden }
				desc = gdp_trade_good_flavor.1017.desc.livestock
			}
			desc = gdp_trade_good_flavor.1017.desc
		}
		desc = gdp_trade_good_flavor.1017.desc.outro
	}
	theme = trade
	override_background = { reference = market }

	left_portrait = {
		character = root
		animation = pondering
		camera = camera_event_very_left
	}
	right_portrait = {
		character = scope:tgf_seller
		triggered_animation = {
			trigger = { exists = scope:tgf_good }
			scripted_animation = gdp_tgf_good_animation
		}
		animation = merchant_box
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			lowest_traded_good_category_xp_level < gdp_tgf_renowned_expertise_level_value
		}
	}

	cooldown = { years = 15 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_sample_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_sample_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = { gdp_tgf_sample_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					save_temporary_scope_as = tgf_fledgling_good_temp
					scope:tgf_route = {
						is_buying_trade_good_in_market = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_fledgling_good_temp
						}
					}
					trade_good_need_category = {
						save_temporary_scope_as = tgf_fledgling_cat_temp
					}
					root = {
						gdp_tgf_fledgling_in_category_trigger = { CATEGORY = scope:tgf_fledgling_cat_temp }
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					save_scope_as = tgf_source_province
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		random_pool_character = {
			province = scope:tgf_source_province
			limit = {
				is_healthy = yes
				has_no_particular_noble_roots_trigger = yes
				is_physically_able_adult = yes
			}
			save_scope_as = tgf_seller
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		gdp_tgf_set_background_location_effect = {
			CHAR = scope:tgf_seller
			PROVINCE = scope:tgf_market.trade_market_owner.title_province
		}
	}

	option = {
		name = gdp_trade_good_flavor.1017.a
		pay_short_term_gold = {
			target = scope:tgf_seller
			gold = minor_gold_value
		}
		if = {
			limit = { has_trait = lifestyle_merchant }
			add_trait_xp = {
				trait = lifestyle_merchant
				track = artisan
				value = lifestyle_merchant_xp_gain_minor_value
			}
		}
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_massive_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = arrogant factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1017.b
		add_prestige = miniscule_prestige_gain
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_miniscule_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = shy factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = sell market whose county culture differs from root's
# We leave out livestock, since it is sold by the head and not by measure
scripted_trigger gdp_tgf_measure_market_trigger = {
	save_temporary_scope_as = tgf_measure_market_temp
	exists = trade_market_owner.title_province.county
	trade_market_owner.title_province.county.culture = {
		NOT = { this = root.culture }
	}
	$ROUTE$ = {
		any_traded_good = {
			trade_good_need_category = { save_temporary_scope_as = tgf_measure_cat_temp }
			NOT = { scope:tgf_measure_cat_temp = trade_good_category:trade_category_beasts_of_burden }
			save_temporary_scope_as = tgf_measure_good_temp
			$ROUTE$ = {
				is_selling_trade_good_in_market = {
					trade_market = scope:tgf_measure_market_temp
					trade_good_type = scope:tgf_measure_good_temp
				}
			}
		}
	}
}

# this = trade route where a sell market uses another culture's measures. Expects root = the merchant
scripted_trigger gdp_tgf_measure_route_trigger = {
	is_commission_route = no
	has_trader = yes
	save_temporary_scope_as = tgf_measure_route_temp
	any_trade_market_on_route = {
		gdp_tgf_measure_market_trigger = { ROUTE = scope:tgf_measure_route_temp }
	}
}

# Wrong Measure
gdp_trade_good_flavor.1018 = {
	type = character_event
	title = gdp_trade_good_flavor.1018.t
	desc = gdp_trade_good_flavor.1018.desc
	theme = merchant

	left_portrait = {
		character = root
		animation = pondering
		camera = camera_event_left
	}
	right_portrait = {
		character = scope:tgf_trader
		animation = holding_scales
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			lowest_traded_good_category_xp_level < gdp_tgf_renowned_expertise_level_value
		}
	}

	cooldown = { years = 15 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_measure_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_measure_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			trader = { save_scope_as = tgf_trader }
			random_trade_market_on_route = {
				limit = { gdp_tgf_measure_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					trade_good_need_category = { save_temporary_scope_as = tgf_measure_cat_temp }
					NOT = { scope:tgf_measure_cat_temp = trade_good_category:trade_category_beasts_of_burden }
					save_temporary_scope_as = tgf_measure_good_temp
					scope:tgf_route = {
						is_selling_trade_good_in_market = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_measure_good_temp
						}
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					county = {
						save_scope_as = tgf_source_county
						culture = { save_scope_as = tgf_source_culture }
					}
				}
			}
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.1018.a
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_major_value
		}
		stress_impact = {
			greedy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1018.b
		add_prestige = minor_prestige_loss
		add_gold = miniscule_gold_value
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = 0.01 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		if = {
			limit = { has_trait = lifestyle_merchant }
			add_trait_xp = {
				trait = lifestyle_merchant
				track = creditor
				value = lifestyle_merchant_xp_gain_minor_value
			}
		}
		stress_impact = {
			honest = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = honest factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1018.c
		add_prestige = miniscule_prestige_gain
		scope:tgf_source_culture = {
			change_cultural_acceptance = {
				target = root.culture
				value = minor_cultural_acceptance_gain
				desc = cultural_acceptance_gain_event
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = shy factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = trade good that $ROUTE$ sells in some market on it
scripted_trigger gdp_tgf_bundle_sold_on_route_trigger = {
	save_temporary_scope_as = tgf_bundle_sold_good_temp
	$ROUTE$ = {
		any_trade_market_on_route = {
			save_temporary_scope_as = tgf_bundle_sold_market_temp
			$ROUTE$ = {
				is_selling_trade_good_in_market = {
					trade_market = scope:tgf_bundle_sold_market_temp
					trade_good_type = scope:tgf_bundle_sold_good_temp
				}
			}
		}
	}
}

# Either order of $X$ and $Y$. Expects scope:tgf_pair_a_temp and scope:tgf_pair_b_temp
scripted_trigger gdp_tgf_bundle_pair_match_trigger = {
	OR = {
		AND = {
			scope:tgf_pair_a_temp = trade_good_type:trade_good_$X$
			scope:tgf_pair_b_temp = trade_good_type:trade_good_$Y$
		}
		AND = {
			scope:tgf_pair_a_temp = trade_good_type:trade_good_$Y$
			scope:tgf_pair_b_temp = trade_good_type:trade_good_$X$
		}
	}
}

# this = trade good that makes a natural pair with $OTHER$, so the buyer wants both together
scripted_trigger gdp_tgf_bundle_pair_trigger = {
	save_temporary_scope_as = tgf_pair_a_temp
	$OTHER$ = { save_temporary_scope_as = tgf_pair_b_temp }
	OR = {
		gdp_tgf_bundle_pair_match_trigger = { X = salt Y = fish }
		gdp_tgf_bundle_pair_match_trigger = { X = salt Y = meat }
		gdp_tgf_bundle_pair_match_trigger = { X = salt Y = cheese }
		gdp_tgf_bundle_pair_match_trigger = { X = alum Y = dyes }
		gdp_tgf_bundle_pair_match_trigger = { X = dyes Y = wool }
		gdp_tgf_bundle_pair_match_trigger = { X = dyes Y = cotton }
		gdp_tgf_bundle_pair_match_trigger = { X = dyes Y = silk }
		gdp_tgf_bundle_pair_match_trigger = { X = dyes Y = textiles }
		gdp_tgf_bundle_pair_match_trigger = { X = beer Y = grain }
		gdp_tgf_bundle_pair_match_trigger = { X = wine Y = cheese }
		gdp_tgf_bundle_pair_match_trigger = { X = wood Y = hemp }
		gdp_tgf_bundle_pair_match_trigger = { X = iron Y = wood }
		gdp_tgf_bundle_pair_match_trigger = { X = spices Y = meat }
		gdp_tgf_bundle_pair_match_trigger = { X = gems Y = gold }
		gdp_tgf_bundle_pair_match_trigger = { X = gems Y = silver }
		gdp_tgf_bundle_pair_match_trigger = { X = leather Y = books_paper }
	}
}

# this = good $ROUTE$ sells in $MARKET$, while root also trades another. Expects root = the merchant
scripted_trigger gdp_tgf_bundle_first_good_trigger = {
	save_temporary_scope_as = tgf_bundle_good_temp
	$ROUTE$ = {
		is_selling_trade_good_in_market = {
			trade_market = $MARKET$
			trade_good_type = scope:tgf_bundle_good_temp
		}
	}
	root = {
		any_trade_route = {
			is_commission_route = no
			save_temporary_scope_as = tgf_bundle_other_route_temp
			any_traded_good = {
				NOT = { this = scope:tgf_bundle_good_temp }
				gdp_tgf_bundle_sold_on_route_trigger = { ROUTE = scope:tgf_bundle_other_route_temp }
			}
		}
	}
}

# this = market a stranger holds, where $ROUTE$ sells and root trades a second good on any route
scripted_trigger gdp_tgf_bundle_market_trigger = {
	save_temporary_scope_as = tgf_bundle_market_temp
	exists = trade_market_owner.title_province.county
	gdp_tgf_stranger_holder_market_trigger = yes
	$ROUTE$ = {
		any_traded_good = {
			gdp_tgf_bundle_first_good_trigger = {
				ROUTE = $ROUTE$
				MARKET = scope:tgf_bundle_market_temp
			}
		}
	}
}

# this = trade route. Expects root = the merchant
scripted_trigger gdp_tgf_bundle_route_trigger = {
	is_commission_route = no
	save_temporary_scope_as = tgf_bundle_route_temp
	any_trade_market_on_route = {
		gdp_tgf_bundle_market_trigger = { ROUTE = scope:tgf_bundle_route_temp }
	}
}

# Two Goods, One Buyer
gdp_trade_good_flavor.1019 = {
	type = character_event
	title = gdp_trade_good_flavor.1019.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:tgf_bundle_paired }
				desc = gdp_trade_good_flavor.1019.desc
			}
			desc = gdp_trade_good_flavor.1019.desc.generic
		}
		desc = gdp_trade_good_flavor.1019.desc.outro
	}
	theme = trade

	left_portrait = {
		character = root
		animation = donkey_standing_baggage
		camera = camera_event_very_left
	}
	right_portrait = {
		character = scope:tgf_market_holder
		animation = merchant_box
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 15 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_good_traded_in = { count >= 2 }
		any_trade_route = { gdp_tgf_bundle_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_bundle_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = { gdp_tgf_bundle_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					gdp_tgf_bundle_first_good_trigger = {
						ROUTE = scope:tgf_route
						MARKET = scope:tgf_market
					}
				}
				save_scope_as = tgf_good
			}
		}
		every_trade_route = {
			limit = { is_commission_route = no }
			save_temporary_scope_as = tgf_bundle_other_route_temp
			every_traded_good = {
				limit = {
					NOT = { this = scope:tgf_good }
					gdp_tgf_bundle_sold_on_route_trigger = { ROUTE = scope:tgf_bundle_other_route_temp }
				}
				add_to_list = tgf_bundle_candidates
			}
		}
		if = {
			limit = {
				any_in_list = {
					list = tgf_bundle_candidates
					gdp_tgf_bundle_pair_trigger = { OTHER = scope:tgf_good }
				}
			}
			random_in_list = {
				list = tgf_bundle_candidates
				limit = {
					gdp_tgf_bundle_pair_trigger = { OTHER = scope:tgf_good }
				}
				save_scope_as = tgf_good_b
			}
			save_scope_value_as = {
				name = tgf_bundle_paired
				value = yes
			}
		}
		else = {
			random_in_list = {
				list = tgf_bundle_candidates
				save_scope_as = tgf_good_b
			}
		}
		random_trade_route = {
			limit = {
				is_commission_route = no
				save_temporary_scope_as = tgf_bundle_b_route_temp
				scope:tgf_good_b = {
					gdp_tgf_bundle_sold_on_route_trigger = { ROUTE = scope:tgf_bundle_b_route_temp }
				}
			}
			save_scope_as = tgf_route_b
		}
		scope:tgf_route_b = {
			random_trade_market_on_route = {
				limit = {
					save_temporary_scope_as = tgf_bundle_b_market_temp
					scope:tgf_route_b = {
						is_selling_trade_good_in_market = {
							trade_market = scope:tgf_bundle_b_market_temp
							trade_good_type = scope:tgf_good_b
						}
					}
				}
				save_scope_as = tgf_market_b
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				holder = { save_scope_as = tgf_market_holder }
				title_province = {
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.1019.a
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = 0.01 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		scope:tgf_market_b = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good_b
				value = { value = 0.01 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = impatient factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1019.b
		add_gold = minor_gold_value
		ai_chance = {
			base = 100
			modifier = { has_trait = patient factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = trade good used in construction
scripted_trigger gdp_tgf_construction_good_trigger = {
	OR = {
		this = trade_good_type:trade_good_stone
		this = trade_good_type:trade_good_wood
		this = trade_good_type:trade_good_hemp
		this = trade_good_type:trade_good_iron
		this = trade_good_type:trade_good_copper
	}
}

# this = trade market with a foreign holder building a holding, where $ROUTE$ sells a construction good
scripted_trigger gdp_tgf_builders_market_trigger = {
	save_temporary_scope_as = tgf_builders_market_temp
	trade_market_owner ?= {
		exists = title_province.county
		title_province = {
			has_ongoing_holding_construction = yes
		}
	}
	gdp_tgf_stranger_holder_market_trigger = yes
	$ROUTE$ = {
		any_traded_good = {
			gdp_tgf_construction_good_trigger = yes
			save_temporary_scope_as = tgf_builders_good_temp
			$ROUTE$ = {
				is_selling_trade_good_in_market = {
					trade_market = scope:tgf_builders_market_temp
					trade_good_type = scope:tgf_builders_good_temp
				}
			}
		}
	}
}

# this = trade route where a building holder's market buys its construction goods
scripted_trigger gdp_tgf_builders_route_trigger = {
	is_commission_route = no
	save_temporary_scope_as = tgf_builders_route_temp
	any_trade_market_on_route = {
		gdp_tgf_builders_market_trigger = { ROUTE = scope:tgf_builders_route_temp }
	}
}

scripted_effect gdp_tgf_builders_rate_apply_effect = {
	scope:tgf_build_county = {
		if = {
			limit = { gdp_tgf_county_held_by_root_or_ai_trigger = yes }
			if = {
				limit = { scope:tgf_build_province = { has_holding_type = castle_holding } }
				add_county_modifier = {
					modifier = gdp_tgf_builders_rate_castle_$SIZE$_modifier
					years = $YEARS$
				}
			}
			else_if = {
				limit = { scope:tgf_build_province = { has_holding_type = church_holding } }
				add_county_modifier = {
					modifier = gdp_tgf_builders_rate_church_$SIZE$_modifier
					years = $YEARS$
				}
			}
			else_if = {
				limit = { scope:tgf_build_province = { has_holding_type = city_holding } }
				add_county_modifier = {
					modifier = gdp_tgf_builders_rate_city_$SIZE$_modifier
					years = $YEARS$
				}
			}
			else = {
				add_county_modifier = {
					modifier = gdp_tgf_builders_rate_generic_$SIZE$_modifier
					years = $YEARS$
				}
			}
		}
	}
}

# Applies the builder's-rate county modifier for the market holding type, doubled when root is renowned in scope:tgf_category
# $SIZE$ is full or small. Expects scope:tgf_build_county and scope:tgf_build_province
scripted_effect gdp_tgf_builders_rate_modifier_effect = {
	if = {
		limit = { gdp_tgf_root_renowned_in_event_category_trigger = yes }
		gdp_tgf_builders_rate_apply_effect = {
			SIZE = $SIZE$_renowned
			YEARS = 10
		}
	}
	else = {
		gdp_tgf_builders_rate_apply_effect = {
			SIZE = $SIZE$
			YEARS = 5
		}
	}
}

# The Builder's Rate
gdp_trade_good_flavor.1020 = {
	type = character_event
	title = gdp_trade_good_flavor.1020.t
	desc = gdp_trade_good_flavor.1020.desc
	theme = trade
	override_background = pam_cathedral_construction

	left_portrait = {
		character = root
		animation = trade_deal
		camera = camera_event_very_left
	}
	right_portrait = {
		character = scope:tgf_market_holder
		animation = merchant_gesturing
		camera = camera_event_very_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 15 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_builders_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_builders_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = { gdp_tgf_builders_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					gdp_tgf_construction_good_trigger = yes
					save_temporary_scope_as = tgf_builders_good_temp
					scope:tgf_route = {
						is_selling_trade_good_in_market = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_builders_good_temp
						}
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				holder = { save_scope_as = tgf_market_holder }
				title_province = {
					save_scope_as = tgf_build_province
					county = { save_scope_as = tgf_build_county }
				}
			}
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		gdp_tgf_set_background_location_effect = {
			CHAR = scope:tgf_market_holder
			PROVINCE = scope:tgf_build_province
		}
	}

	option = {
		name = gdp_trade_good_flavor.1020.a
		gdp_tgf_builders_rate_modifier_effect = { SIZE = full }
		scope:tgf_market_holder = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 15
			}
		}
		add_prestige = minor_prestige_gain
		if = {
			limit = {
				scope:tgf_build_province = { has_holding_type = church_holding }
			}
			add_piety = miniscule_piety_gain
		}
		if = {
			limit = {
				gdp_tgf_fledgling_in_category_trigger = { CATEGORY = scope:tgf_category }
			}
			gdp_increase_trade_expertise_xp_effect = {
				CATEGORY = scope:tgf_category
				VALUE = trade_expertise_xp_medium_value
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1020.b
		gdp_tgf_builders_rate_modifier_effect = { SIZE = small }
		add_gold = minor_gold_value
		ai_chance = {
			base = 100
			modifier = { has_trait = generous factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1020.c
		gdp_tgf_builders_rate_modifier_effect = { SIZE = full }
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = 0.02 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		if = {
			limit = {
				scope:tgf_build_province = { has_holding_type = church_holding }
			}
			add_piety = miniscule_piety_gain
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = content factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1020.d
		gdp_tgf_add_tiered_character_modifier_effect = {
			MODIFIER = gdp_tgf_keep_the_best
			YEARS = 10
		}
		scope:tgf_market_holder = {
			add_opinion = {
				target = root
				modifier = annoyed_opinion
				opinion = -10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = compassionate factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = character whose company knows $CATEGORY$ well enough to study its goods
scripted_trigger gdp_tgf_studied_in_category_trigger = {
	any_held_title = {
		gdp_merchant_company_title_trigger = yes
		trade_good_category_level = {
			target = $CATEGORY$
			value >= gdp_tgf_study_expertise_level_value
		}
	}
}

# this = trade route that carries a good root has studied. Expects root = the merchant
scripted_trigger gdp_tgf_study_route_trigger = {
	is_commission_route = no
	any_traded_good = {
		trade_good_need_category = { save_temporary_scope_as = tgf_study_cat_temp }
		root = {
			gdp_tgf_studied_in_category_trigger = { CATEGORY = scope:tgf_study_cat_temp }
		}
	}
}

# Know the Goods
gdp_trade_good_flavor.1021 = {
	type = character_event
	title = gdp_trade_good_flavor.1021.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:tgf_category = trade_good_category:trade_category_beasts_of_burden }
				desc = gdp_trade_good_flavor.1021.desc.livestock
			}
			triggered_desc = {
				trigger = { scope:tgf_good = trade_good_type:trade_good_books_paper }
				desc = gdp_trade_good_flavor.1021.desc.books
			}
			desc = gdp_trade_good_flavor.1021.desc
		}
	}
	theme = merchant
	override_background = { reference = bp1_wine_cellar }

	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_horses }
			animation = standing_horse
		}
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_cattle }
			animation = holding_yoke
		}
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_wool }
			animation = shepherd_with_sheep
		}
		triggered_animation = {
			trigger = { OR = { scope:tgf_good = trade_good_type:trade_good_wine scope:tgf_good = trade_good_type:trade_good_beer } }
			animation = drink_goblet
		}
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_meat }
			animation = holding_salami
		}
		triggered_animation = {
			trigger = { OR = { scope:tgf_good = trade_good_type:trade_good_cheese scope:tgf_good = trade_good_type:trade_good_tea scope:tgf_good = trade_good_type:trade_good_sugar scope:tgf_good = trade_good_type:trade_good_rice scope:tgf_good = trade_good_type:trade_good_fruit scope:tgf_good = trade_good_type:trade_good_honey } }
			animation = serving_tray
		}
		triggered_animation = {
			trigger = { OR = { scope:tgf_good = trade_good_type:trade_good_salt scope:tgf_good = trade_good_type:trade_good_spices scope:tgf_good = trade_good_type:trade_good_grain scope:tgf_good = trade_good_type:trade_good_millet } }
			animation = holding_scales
		}
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_incense }
			animation = thurible
		}
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_medicaments }
			animation = physician
		}
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_oil }
			animation = lantern
		}
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_books_paper }
			animation = holding_scrolls
		}
		triggered_animation = {
			trigger = { OR = { scope:tgf_good = trade_good_type:trade_good_gold scope:tgf_good = trade_good_type:trade_good_silver scope:tgf_good = trade_good_type:trade_good_copper scope:tgf_good = trade_good_type:trade_good_fish } }
			animation = merchant_box
		}
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_furs }
			animation = hunting_carcass_start
		}
		animation = holding_scales
		camera = camera_event_left
	}

	widgets = {
		widget = { gui = event_window_widget_vfx_background_flickering_candlelight_dark container = foreground_shader_vfx_container }
		widget = { gui = event_window_widget_vfx_left_character_flickering_candlelight_dark container = foreground_shader_vfx_container }
		widget = {
			gui = "event_window_widget_trade_good"
			container = "custom_widgets_container"
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			highest_traded_good_category_xp_level >= gdp_tgf_renowned_expertise_level_value
		}
	}

	trigger = {
		NOT = { has_character_flag = gdp_tgf_had_event_1021 }
		is_available = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_study_route_trigger = yes }
	}

	immediate = {
		add_character_flag = gdp_tgf_had_event_1021
		random_trade_route = {
			limit = { gdp_tgf_study_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_traded_good = {
				limit = {
					trade_good_need_category = { save_temporary_scope_as = tgf_study_cat_temp }
					root = {
						gdp_tgf_studied_in_category_trigger = { CATEGORY = scope:tgf_study_cat_temp }
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.1021.a
		gdp_tgf_create_study_curio_effect = yes
		ai_chance = {
			base = 100
			modifier = { has_trait = generous factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1021.b
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_medium_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = lazy factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = trade route that carries a good whose category root is renowned in. Expects root = the merchant
scripted_trigger gdp_tgf_nickname_route_trigger = {
	is_commission_route = no
	any_trade_market_on_route = { exists = trade_market_owner.title_province.county }
	any_traded_good = {
		trade_good_need_category = { save_temporary_scope_as = tgf_nickname_cat_temp }
		root = {
			gdp_tgf_renowned_in_category_trigger = { CATEGORY = scope:tgf_nickname_cat_temp }
		}
	}
}

# Grants the per-good trade nickname. Expects scope:tgf_good
scripted_effect gdp_tgf_trade_nickname_effect = {
	if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_grain }
		set_nickname_effect = { NICKNAME = nick_tgf_grain }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_millet }
		set_nickname_effect = { NICKNAME = nick_tgf_millet }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_rice }
		set_nickname_effect = { NICKNAME = nick_tgf_rice }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_meat }
		set_nickname_effect = { NICKNAME = nick_tgf_meat }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_fish }
		set_nickname_effect = { NICKNAME = nick_tgf_fish }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_cheese }
		set_nickname_effect = { NICKNAME = nick_tgf_cheese }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_fruit }
		set_nickname_effect = { NICKNAME = nick_tgf_fruit }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_oil }
		set_nickname_effect = { NICKNAME = nick_tgf_oil }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_honey }
		set_nickname_effect = { NICKNAME = nick_tgf_honey }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_tea }
		set_nickname_effect = { NICKNAME = nick_tgf_tea }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_horses }
		set_nickname_effect = { NICKNAME = nick_tgf_horses }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_cattle }
		set_nickname_effect = { NICKNAME = nick_tgf_cattle }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_silver }
		set_nickname_effect = { NICKNAME = nick_tgf_silver }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_gold }
		set_nickname_effect = { NICKNAME = nick_tgf_gold }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_iron }
		set_nickname_effect = { NICKNAME = nick_tgf_iron }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_copper }
		set_nickname_effect = { NICKNAME = nick_tgf_copper }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_beer }
		set_nickname_effect = { NICKNAME = nick_tgf_beer }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_wine }
		set_nickname_effect = { NICKNAME = nick_tgf_wine }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_gems }
		set_nickname_effect = { NICKNAME = nick_tgf_gems }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_amber }
		set_nickname_effect = { NICKNAME = nick_tgf_amber }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_ivory }
		set_nickname_effect = { NICKNAME = nick_tgf_ivory }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_jade }
		set_nickname_effect = { NICKNAME = nick_tgf_jade }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_wood }
		set_nickname_effect = { NICKNAME = nick_tgf_wood }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_hemp }
		set_nickname_effect = { NICKNAME = nick_tgf_hemp }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_wool }
		set_nickname_effect = { NICKNAME = nick_tgf_wool }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_cotton }
		set_nickname_effect = { NICKNAME = nick_tgf_cotton }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_flax }
		set_nickname_effect = { NICKNAME = nick_tgf_flax }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_textiles }
		set_nickname_effect = { NICKNAME = nick_tgf_textiles }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_furs }
		set_nickname_effect = { NICKNAME = nick_tgf_furs }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_leather }
		set_nickname_effect = { NICKNAME = nick_tgf_leather }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_sugar }
		set_nickname_effect = { NICKNAME = nick_tgf_sugar }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_spices }
		set_nickname_effect = { NICKNAME = nick_tgf_spices }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_ceramics }
		set_nickname_effect = { NICKNAME = nick_tgf_ceramics }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_glass }
		set_nickname_effect = { NICKNAME = nick_tgf_glass }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_jewelry }
		set_nickname_effect = { NICKNAME = nick_tgf_jewelry }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_lacquerware }
		set_nickname_effect = { NICKNAME = nick_tgf_lacquerware }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_silk }
		set_nickname_effect = { NICKNAME = nick_tgf_silk }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_incense }
		set_nickname_effect = { NICKNAME = nick_tgf_incense }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_medicaments }
		set_nickname_effect = { NICKNAME = nick_tgf_medicaments }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_stone }
		set_nickname_effect = { NICKNAME = nick_tgf_stone }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_salt }
		set_nickname_effect = { NICKNAME = nick_tgf_salt }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_alum }
		set_nickname_effect = { NICKNAME = nick_tgf_alum }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_dyes }
		set_nickname_effect = { NICKNAME = nick_tgf_dyes }
	}
	else_if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_books_paper }
		set_nickname_effect = { NICKNAME = nick_tgf_books_paper }
	}
}

# A Name for the Trade
gdp_trade_good_flavor.1022 = {
	type = character_event
	title = gdp_trade_good_flavor.1022.t
	desc = gdp_trade_good_flavor.1022.desc
	theme = merchant
	override_background = { reference = market }

	left_portrait = {
		character = root
		animation = biting_coin
		camera = camera_event_left
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			highest_traded_good_category_xp_level >= 75
		}
	}

	trigger = {
		NOT = { has_character_flag = gdp_tgf_had_event_1022 }
		OR = {
			has_any_nickname = no
			has_bad_nickname = yes
		}
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		highest_traded_good_category_xp_level >= 50
		any_trade_route = { gdp_tgf_nickname_route_trigger = yes }
	}

	immediate = {
		add_character_flag = gdp_tgf_had_event_1022
		random_trade_route = {
			limit = { gdp_tgf_nickname_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_traded_good = {
				limit = {
					trade_good_need_category = { save_temporary_scope_as = tgf_nickname_cat_temp }
					root = {
						gdp_tgf_renowned_in_category_trigger = { CATEGORY = scope:tgf_nickname_cat_temp }
					}
				}
				save_scope_as = tgf_good
			}
			random_trade_market_on_route = {
				limit = { exists = trade_market_owner.title_province.county }
				save_scope_as = tgf_market
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		gdp_tgf_set_background_location_effect = {
			CHAR = root
			PROVINCE = scope:tgf_market.trade_market_owner.title_province
		}
	}

	option = {
		name = gdp_trade_good_flavor.1022.a
		gdp_tgf_trade_nickname_effect = yes
		add_prestige = major_prestige_gain
		ai_chance = {
			base = 100
			modifier = { has_trait = humble factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1022.b
		gdp_tgf_trade_nickname_effect = yes
		add_trade_good_price_modifier = {
			type = sell_mult
			trade_good_type = scope:tgf_good
			value = { value = 0.01 multiply = gdp_tgf_renown_tier_value }
			years = 10
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = arrogant factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = trade market where $ROUTE$ buys a good from a stranger's county and the local pool holds a foreman
scripted_trigger gdp_tgf_supply_market_trigger = {
	gdp_tgf_stranger_holder_market_trigger = yes
	gdp_tgf_route_buys_here_trigger = { ROUTE = $ROUTE$ }
	trade_market_owner.title_province = {
		save_temporary_scope_as = tgf_supply_province_temp
		any_pool_character = {
			province = scope:tgf_supply_province_temp
			is_healthy = yes
			is_physically_able_adult = yes
		}
	}
}

# this = trade route
scripted_trigger gdp_tgf_supply_route_trigger = {
	is_commission_route = no
	save_temporary_scope_as = tgf_supply_route_temp
	any_trade_market_on_route = {
		gdp_tgf_supply_market_trigger = { ROUTE = scope:tgf_supply_route_temp }
	}
}

# A Choke on Supply
gdp_trade_good_flavor.1023 = {
	type = character_event
	title = gdp_trade_good_flavor.1023.t
	desc = gdp_trade_good_flavor.1023.desc
	theme = trade
	override_background = {
		trigger = {
			OR = {
				scope:tgf_category = trade_good_category:trade_category_base_metals
				scope:tgf_category = trade_good_category:trade_category_precious_metals
				scope:tgf_good = trade_good_type:trade_good_jewelry
			}
		}
		reference = gdp_smithy_workshop
	}
	override_background = {
		trigger = {
			OR = {
				scope:tgf_good = trade_good_type:trade_good_wood
				scope:tgf_good = trade_good_type:trade_good_hemp
				scope:tgf_good = trade_good_type:trade_good_lacquerware
			}
		}
		reference = gdp_carpentry_workshop
	}
	override_background = {
		trigger = {
			OR = {
				scope:tgf_good = trade_good_type:trade_good_leather
				scope:tgf_good = trade_good_type:trade_good_furs
				scope:tgf_good = trade_good_type:trade_good_dyes
			}
		}
		reference = gdp_tannery
	}
	override_background = {
		trigger = {
			OR = {
				scope:tgf_good = trade_good_type:trade_good_glass
				scope:tgf_good = trade_good_type:trade_good_ceramics
				scope:tgf_good = trade_good_type:trade_good_textiles
			}
		}
		reference = gdp_artisan_street
	}
	override_background = {
		trigger = { scope:tgf_good = trade_good_type:trade_good_oil }
		reference = bp1_wine_cellar
	}
	override_background = { reference = farmland }

	left_portrait = {
		character = root
		animation = pondering
		camera = camera_event_left_away_3_4
	}
	right_portrait = {
		character = scope:tgf_foreman
		animation = merchant_gesturing
		camera = camera_event_very_left
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 15 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_supply_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_supply_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = { gdp_tgf_supply_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					save_temporary_scope_as = tgf_supply_good_temp
					scope:tgf_route = {
						is_buying_trade_good_in_market = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_supply_good_temp
						}
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				holder = { save_scope_as = tgf_market_holder }
				title_province = {
					save_scope_as = tgf_source_province
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		random_pool_character = {
			province = scope:tgf_source_province
			limit = {
				is_physically_able_adult = yes
				is_healthy = yes
			}
			save_scope_as = tgf_foreman
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		gdp_tgf_set_background_location_effect = {
			CHAR = scope:tgf_foreman
			PROVINCE = scope:tgf_market.trade_market_owner.title_province
		}
	}

	option = {
		name = gdp_trade_good_flavor.1023.a
		remove_short_term_gold = minor_gold_value
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_medium_value
		}
		scope:tgf_source_county = {
			if = {
				limit = { gdp_tgf_county_held_by_root_or_ai_trigger = yes }
				gdp_tgf_add_tiered_county_modifier_effect = {
					MODIFIER = gdp_tgf_extra_hands
					YEARS = 10
				}
			}
		}
		scope:tgf_market_holder = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 10
			}
		}
		ai_chance = {
			base = 10 # Dont stack too many goods modifiers
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1023.b
		add_courtier = scope:tgf_foreman
		scope:tgf_market_holder = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 30
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = honest factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1023.c
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_minor_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = lazy factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = trade market where $ROUTE$ trades a good and an AI rival trades too
scripted_trigger gdp_tgf_auction_market_trigger = {
	OR = {
		gdp_tgf_route_buys_here_trigger = { ROUTE = $ROUTE$ }
		gdp_tgf_route_sells_here_trigger = { ROUTE = $ROUTE$ }
	}
	any_potential_trade_rival_in_market = {
		target = root
		gdp_tgf_auction_rival_trigger = yes
	}
}

# this = trade route
scripted_trigger gdp_tgf_auction_route_trigger = {
	is_commission_route = no
	save_temporary_scope_as = tgf_auction_route_temp
	any_trade_market_on_route = {
		gdp_tgf_auction_market_trigger = { ROUTE = scope:tgf_auction_route_temp }
	}
}

# Under the Hammer
gdp_trade_good_flavor.1024 = {
	type = character_event
	title = gdp_trade_good_flavor.1024.t
	desc = gdp_trade_good_flavor.1024.desc
	theme = trade
	override_background = {
		trigger = {
			scope:tgf_source_province = { geographical_region = mediteranean_coast }
		}
		reference = gdp_italian_market
	}
	override_background = { reference = market_crowd }

	left_portrait = {
		character = root
		animation = betting
		camera = camera_event_left
	}
	right_portrait = {
		character = scope:tgf_rival
		animation = wedding_objection_start
		camera = camera_event_very_left_fov35
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 15 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_auction_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_auction_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = { gdp_tgf_auction_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					save_temporary_scope_as = tgf_auction_good_temp
					scope:tgf_route = {
						OR = {
							is_buying_trade_good_in_market = {
								trade_market = scope:tgf_market
								trade_good_type = scope:tgf_auction_good_temp
							}
							is_selling_trade_good_in_market = {
								trade_market = scope:tgf_market
								trade_good_type = scope:tgf_auction_good_temp
							}
						}
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			random_potential_trade_rival_in_market = {
				target = root
				limit = { gdp_tgf_auction_rival_trigger = yes }
				save_scope_as = tgf_rival
			}
			trade_market_owner = {
				title_province = {
					save_scope_as = tgf_source_province
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		scope:tgf_rival = {
			random_held_title = {
				limit = { gdp_merchant_company_title_trigger = yes }
				save_scope_as = tgf_rival_company
			}
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		gdp_tgf_set_background_location_effect = {
			CHAR = scope:tgf_rival
			PROVINCE = scope:tgf_market.trade_market_owner.title_province
		}
	}

	option = {
		name = gdp_trade_good_flavor.1024.a
		add_prestige = medium_prestige_gain
		gdp_tgf_add_tiered_character_modifier_effect = {
			MODIFIER = gdp_tgf_outbid
			YEARS = 10
		}
		remove_short_term_gold = minor_gold_value
		scope:tgf_rival = {
			add_opinion = {
				target = root
				modifier = annoyed_opinion
				opinion = -15
			}
		}
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = buy_mult
				character = root
				trade_good_type = scope:tgf_good
				value = -0.01
				years = 10
			}
			add_price_modifier_for_character = {
				type = buy_mult
				character = scope:tgf_rival
				trade_good_type = scope:tgf_good
				value = 0.01
				years = 10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1024.b
		scope:tgf_rival = {
			remove_short_term_gold = medium_gold_value
			add_opinion = {
				target = root
				modifier = annoyed_opinion
				opinion = -30
			}
		}
		add_intrigue_lifestyle_xp = minor_lifestyle_xp
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = buy_mult
				character = scope:tgf_rival
				trade_good_type = scope:tgf_good
				value = -0.01
				years = 10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = honest factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1024.c
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_miniscule_value
		}
		gdp_tgf_add_tiered_character_modifier_effect = {
			MODIFIER = gdp_tgf_watched_bidding
			YEARS = 10
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = impatient factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = coastal trade market where $ROUTE$ sells a good and the local pool holds someone to run the docks
scripted_trigger gdp_tgf_quay_market_trigger = {
	gdp_tgf_route_sells_here_trigger = { ROUTE = $ROUTE$ }
	trade_market_owner.title_province = {
		is_coastal = yes
		save_temporary_scope_as = tgf_quay_province_temp
		any_pool_character = {
			province = scope:tgf_quay_province_temp
			is_healthy = yes
			is_physically_able_adult = yes
		}
	}
}

# this = trade route
scripted_trigger gdp_tgf_quay_route_trigger = {
	is_commission_route = no
	save_temporary_scope_as = tgf_quay_route_temp
	any_trade_market_on_route = {
		gdp_tgf_quay_market_trigger = { ROUTE = scope:tgf_quay_route_temp }
	}
}

# First at the Quay
gdp_trade_good_flavor.1025 = {
	type = character_event
	title = gdp_trade_good_flavor.1025.t
	desc = gdp_trade_good_flavor.1025.desc
	theme = trade
	override_background = { reference = docks }

	left_portrait = {
		character = root
		animation = bribing
		camera = camera_event_very_left
	}
	right_portrait = {
		character = scope:tgf_docks_boss
		animation = personality_greedy
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 15 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_quay_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_quay_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = { gdp_tgf_quay_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					save_temporary_scope_as = tgf_quay_good_temp
					scope:tgf_route = {
						is_selling_trade_good_in_market = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_quay_good_temp
						}
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					save_scope_as = tgf_source_province
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		random_pool_character = {
			province = scope:tgf_source_province
			limit = {
				is_physically_able_adult = yes
				is_healthy = yes
			}
			save_scope_as = tgf_docks_boss
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		gdp_tgf_set_background_location_effect = {
			CHAR = scope:tgf_docks_boss
			PROVINCE = scope:tgf_market.trade_market_owner.title_province
		}
	}

	option = {
		name = gdp_trade_good_flavor.1025.a
		trigger = { short_term_gold >= medium_gold_value }
		show_as_unavailable = { always = yes }
		pay_short_term_gold = {
			target = scope:tgf_docks_boss
			gold = medium_gold_value
		}
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = 0.02 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1025.b
		add_gold = medium_gold_value
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good
				value = -0.01
				years = 10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = patient factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1025.c
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_minor_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = impatient factor = 0 }
		}
	}
	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = trade market where $ROUTE$ sells a non-livestock good and the local pool holds a stallholder
scripted_trigger gdp_tgf_handful_market_trigger = {
	save_temporary_scope_as = tgf_handful_market_temp
	exists = trade_market_owner.title_province.county
	$ROUTE$ = {
		any_traded_good = {
			gdp_tgf_not_livestock_good_trigger = yes
			save_temporary_scope_as = tgf_handful_good_temp
			$ROUTE$ = {
				is_selling_trade_good_in_market = {
					trade_market = scope:tgf_handful_market_temp
					trade_good_type = scope:tgf_handful_good_temp
				}
			}
		}
	}
	trade_market_owner.title_province = {
		save_temporary_scope_as = tgf_handful_province_temp
		any_pool_character = {
			province = scope:tgf_handful_province_temp
			is_healthy = yes
			is_physically_able_adult = yes
		}
	}
}

# this = trade route
scripted_trigger gdp_tgf_handful_route_trigger = {
	is_commission_route = no
	save_temporary_scope_as = tgf_handful_route_temp
	any_trade_market_on_route = {
		gdp_tgf_handful_market_trigger = { ROUTE = scope:tgf_handful_route_temp }
	}
}

# By the Handful
gdp_trade_good_flavor.1026 = {
	type = character_event
	title = gdp_trade_good_flavor.1026.t
	desc = gdp_trade_good_flavor.1026.desc
	theme = trade
	override_background = { reference = gdp_artisan_street_crowd }

	left_portrait = {
		character = root
		animation = holding_scales
		camera = camera_event_very_left
	}
	right_portrait = {
		character = scope:tgf_stallholder
		triggered_animation = {
			trigger = { exists = scope:tgf_good }
			scripted_animation = gdp_tgf_good_animation
		}
		animation = merchant_box
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 15 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_handful_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_handful_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = { gdp_tgf_handful_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					gdp_tgf_not_livestock_good_trigger = yes
					save_temporary_scope_as = tgf_handful_good_temp
					scope:tgf_route = {
						is_selling_trade_good_in_market = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_handful_good_temp
						}
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					save_scope_as = tgf_source_province
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		random_pool_character = {
			province = scope:tgf_source_province
			limit = {
				is_physically_able_adult = yes
				is_healthy = yes
			}
			save_scope_as = tgf_stallholder
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		gdp_tgf_set_background_location_effect = {
			CHAR = scope:tgf_stallholder
			PROVINCE = scope:tgf_market.trade_market_owner.title_province
		}
	}

	option = {
		name = gdp_trade_good_flavor.1026.a
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = 0.03 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		scope:tgf_source_county = {
			if = {
				limit = { gdp_tgf_county_held_by_root_or_ai_trigger = yes }
				add_county_modifier = {
					modifier = gdp_tgf_bled_by_the_handful_modifier
					years = 10
				}
			}
		}
		scope:tgf_stallholder = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 15
			}
		}
		stress_impact = {
			compassionate = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = compassionate factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1026.b
		add_prestige = medium_prestige_gain
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good
				value = -0.01
				years = 10
			}
		}
		scope:tgf_source_county = {
			if = {
				limit = { gdp_tgf_county_held_by_root_or_ai_trigger = yes }
				change_prosperity_progress = minor_prosperity_progress_gain
			}
		}
		stress_impact = {
			greedy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1026.c
		add_gold = minor_gold_value
		ai_chance = {
			base = 100
			modifier = { has_trait = patient factor = 0 }
		}
	}
	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# Market Day
gdp_trade_good_flavor.1027 = {
	type = character_event
	title = gdp_trade_good_flavor.1027.t
	desc = gdp_trade_good_flavor.1027.desc
	theme = trade
	override_background = { reference = market_crowd }

	left_portrait = {
		character = root
		animation = merchant_gesturing
		camera = camera_event_very_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 15 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_market_day_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_market_day_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = { gdp_tgf_market_day_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					save_temporary_scope_as = tgf_market_day_good_temp
					scope:tgf_route = {
						is_selling_trade_good_in_market = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_market_day_good_temp
						}
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				holder = { save_scope_as = tgf_market_holder }
				title_province = {
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		gdp_tgf_set_background_location_effect = {
			CHAR = scope:tgf_market_holder
			PROVINCE = scope:tgf_market.trade_market_owner.title_province
		}
	}

	option = {
		name = gdp_trade_good_flavor.1027.a
		remove_short_term_gold = minor_gold_value
		add_stress = medium_stress_gain
		scope:tgf_market = {
			add_trade_market_modifier = {
				modifier = gdp_tgf_market_day_crowds_modifier
				years = 10
			}
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = 0.01 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		scope:tgf_market_holder = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1027.b
		add_diplomacy_lifestyle_xp = minor_lifestyle_xp
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_minor_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = shy factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = market where $ROUTE$ sells and the pool holds a buyer of another heritage than root's
scripted_trigger gdp_tgf_coin_market_trigger = {
	gdp_tgf_route_sells_here_trigger = { ROUTE = $ROUTE$ }
	trade_market_owner.title_province = {
		save_temporary_scope_as = tgf_coin_province_temp
		any_pool_character = {
			province = scope:tgf_coin_province_temp
			is_healthy = yes
			is_physically_able_adult = yes
			NOT = { culture ?= { has_same_culture_heritage = root.culture } }
		}
	}
}

# this = trade route
scripted_trigger gdp_tgf_coin_route_trigger = {
	is_commission_route = no
	save_temporary_scope_as = tgf_coin_route_temp
	any_trade_market_on_route = {
		gdp_tgf_coin_market_trigger = { ROUTE = scope:tgf_coin_route_temp }
	}
}

# Foreign Coin
gdp_trade_good_flavor.1028 = {
	type = character_event
	title = gdp_trade_good_flavor.1028.t
	desc = gdp_trade_good_flavor.1028.desc
	theme = trade
	override_background = { reference = market }

	left_portrait = {
		character = root
		animation = biting_coin
		camera = camera_event_left
	}
	right_portrait = {
		character = scope:tgf_buyer
		animation = betting
		camera = camera_event_right_pointing_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 15 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_coin_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_coin_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = { gdp_tgf_coin_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					save_temporary_scope_as = tgf_coin_good_temp
					scope:tgf_route = {
						is_selling_trade_good_in_market = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_coin_good_temp
						}
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					save_scope_as = tgf_source_province
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		random_pool_character = {
			province = scope:tgf_source_province
			limit = {
				is_healthy = yes
				is_physically_able_adult = yes
				NOT = { culture ?= { has_same_culture_heritage = root.culture } }
			}
			save_scope_as = tgf_buyer
		}
		random_trade_good_traded_in = {
			limit = {
				NOT = { this = scope:tgf_good }
				exists = trade_good_need_category
			}
			save_scope_as = tgf_good_b
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		gdp_tgf_set_background_location_effect = {
			CHAR = scope:tgf_buyer
			PROVINCE = scope:tgf_market.trade_market_owner.title_province
		}
	}

	option = {
		name = gdp_trade_good_flavor.1028.a
		add_gold = minor_gold_value
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_minor_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = stubborn factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1028.b
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = 0.005 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		scope:tgf_buyer = {
			add_opinion = {
				target = root
				modifier = annoyed_opinion
				opinion = -10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = generous factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1028.c
		trigger = { exists = scope:tgf_good_b }
		scope:tgf_good_b = {
			trade_good_need_category = { save_scope_as = tgf_category_b }
		}
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category_b
			VALUE = trade_expertise_xp_medium_value
		}
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = buy_mult
				character = root
				trade_good_type = scope:tgf_good_b
				value = { value = -0.02 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}
	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = trade route with a trader that has run for three years
scripted_trigger gdp_tgf_old_road_route_trigger = {
	is_commission_route = no
	has_trader = yes
	trader ?= {
		NOT = { this = root }
	}
	age_in_months >= 36
	any_traded_good = { always = yes }
}

# Years on the Road
gdp_trade_good_flavor.1029 = {
	type = character_event
	title = gdp_trade_good_flavor.1029.t
	desc = gdp_trade_good_flavor.1029.desc
	theme = merchant
	override_background = { reference = sitting_room }

	left_portrait = {
		character = root
		animation = happiness
		camera = camera_event_left
	}
	right_portrait = {
		character = scope:tgf_trader
		animation = toast_goblet
		camera = camera_event_right
	}

	widgets = {
		widget = { gui = event_window_widget_vfx_background_flickering_candlelight container = foreground_shader_vfx_container }
		widget = { gui = event_window_widget_vfx_left_character_flickering_candlelight container = foreground_shader_vfx_container }
		widget = { gui = event_window_widget_vfx_right_character_flickering_candlelight container = foreground_shader_vfx_container }
		widget = {
			gui = "event_window_widget_trade_good"
			container = "custom_widgets_container"
		}
	}

	cooldown = { years = 15 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_old_road_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_old_road_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			trader = { save_scope_as = tgf_trader }
			random_traded_good = { save_scope_as = tgf_good }
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.1029.a
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_medium_value
		}
		scope:tgf_trader = {
			add_stewardship_skill = 2
			add_opinion = {
				target = root
				modifier = pleased_opinion
				opinion = 20
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1029.b
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_medium_value
		}
		scope:tgf_trader = {
			add_stewardship_skill = 2
			add_stress = massive_stress_loss
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = temperate factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1029.c
		scope:tgf_trader = {
			add_stewardship_skill = 2
		}
		if = {
			limit = { NOT = { has_character_modifier = gdp_tgf_further_roads_renowned_modifier } }
			if = {
				limit = { gdp_tgf_root_renowned_in_event_category_trigger = yes }
				remove_character_modifier = gdp_tgf_further_roads_modifier
				add_character_modifier = gdp_tgf_further_roads_renowned_modifier
			}
			else_if = {
				limit = { NOT = { has_character_modifier = gdp_tgf_further_roads_modifier } }
				add_character_modifier = gdp_tgf_further_roads_modifier
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = content factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = trade good in a category root is renowned in, which $ROUTE$ sells in a market with a county
scripted_trigger gdp_tgf_renowned_sold_good_trigger = {
	save_temporary_scope_as = tgf_renowned_good_temp
	trade_good_need_category = { save_temporary_scope_as = tgf_renowned_cat_temp }
	root = {
		gdp_tgf_renowned_in_category_trigger = { CATEGORY = scope:tgf_renowned_cat_temp }
	}
	$ROUTE$ = {
		any_trade_market_on_route = {
			save_temporary_scope_as = tgf_renowned_market_temp
			exists = trade_market_owner.title_province.county
			trade_market_owner.title_province = {
				save_temporary_scope_as = tgf_watching_province_temp
				any_pool_character = {
					province = scope:tgf_watching_province_temp
					is_healthy = yes
					is_physically_able_adult = yes
				}
			}
			$ROUTE$ = {
				is_selling_trade_good_in_market = {
					trade_market = scope:tgf_renowned_market_temp
					trade_good_type = scope:tgf_renowned_good_temp
				}
			}
		}
	}
}

# this = trade route that sells a good root is renowned in
scripted_trigger gdp_tgf_watching_route_trigger = {
	is_commission_route = no
	save_temporary_scope_as = tgf_watching_route_temp
	any_traded_good = {
		gdp_tgf_renowned_sold_good_trigger = { ROUTE = scope:tgf_watching_route_temp }
	}
}

# this = character who already has Ear to the Market in some category
scripted_trigger gdp_tgf_has_ear_to_the_market_trigger = {
	OR = {
		has_character_modifier = gdp_tgf_ear_alcohol_modifier
		has_character_modifier = gdp_tgf_ear_comforts_modifier
		has_character_modifier = gdp_tgf_ear_cereals_modifier
		has_character_modifier = gdp_tgf_ear_meat_modifier
		has_character_modifier = gdp_tgf_ear_beasts_of_burden_modifier
		has_character_modifier = gdp_tgf_ear_salt_modifier
		has_character_modifier = gdp_tgf_ear_clothes_modifier
		has_character_modifier = gdp_tgf_ear_fabrics_modifier
		has_character_modifier = gdp_tgf_ear_dyes_modifier
		has_character_modifier = gdp_tgf_ear_alum_modifier
		has_character_modifier = gdp_tgf_ear_stone_modifier
		has_character_modifier = gdp_tgf_ear_carpentry_supplies_modifier
		has_character_modifier = gdp_tgf_ear_base_metals_modifier
		has_character_modifier = gdp_tgf_ear_luxury_items_modifier
		has_character_modifier = gdp_tgf_ear_jewelry_materials_modifier
		has_character_modifier = gdp_tgf_ear_precious_metals_modifier
		has_character_modifier = gdp_tgf_ear_medicaments_modifier
		has_character_modifier = gdp_tgf_ear_incense_modifier
		has_character_modifier = gdp_tgf_ear_luxury_consumption_modifier
		has_character_modifier = gdp_tgf_ear_books_modifier
	}
}

# Ear to the Market for scope:tgf_category, the category of the event's good
scripted_effect gdp_tgf_add_ear_to_the_market_effect = {
	if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_alcohol }
		add_character_modifier = gdp_tgf_ear_alcohol_modifier
	}
	else_if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_comforts }
		add_character_modifier = gdp_tgf_ear_comforts_modifier
	}
	else_if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_cereals }
		add_character_modifier = gdp_tgf_ear_cereals_modifier
	}
	else_if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_meat }
		add_character_modifier = gdp_tgf_ear_meat_modifier
	}
	else_if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_beasts_of_burden }
		add_character_modifier = gdp_tgf_ear_beasts_of_burden_modifier
	}
	else_if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_salt }
		add_character_modifier = gdp_tgf_ear_salt_modifier
	}
	else_if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_clothes }
		add_character_modifier = gdp_tgf_ear_clothes_modifier
	}
	else_if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_fabrics }
		add_character_modifier = gdp_tgf_ear_fabrics_modifier
	}
	else_if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_dyes }
		add_character_modifier = gdp_tgf_ear_dyes_modifier
	}
	else_if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_alum }
		add_character_modifier = gdp_tgf_ear_alum_modifier
	}
	else_if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_stone }
		add_character_modifier = gdp_tgf_ear_stone_modifier
	}
	else_if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_carpentry_supplies }
		add_character_modifier = gdp_tgf_ear_carpentry_supplies_modifier
	}
	else_if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_base_metals }
		add_character_modifier = gdp_tgf_ear_base_metals_modifier
	}
	else_if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_luxury_items }
		add_character_modifier = gdp_tgf_ear_luxury_items_modifier
	}
	else_if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_jewelry_materials }
		add_character_modifier = gdp_tgf_ear_jewelry_materials_modifier
	}
	else_if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_precious_metals }
		add_character_modifier = gdp_tgf_ear_precious_metals_modifier
	}
	else_if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_medicaments }
		add_character_modifier = gdp_tgf_ear_medicaments_modifier
	}
	else_if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_incense }
		add_character_modifier = gdp_tgf_ear_incense_modifier
	}
	else_if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_luxury_consumption }
		add_character_modifier = gdp_tgf_ear_luxury_consumption_modifier
	}
	else_if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_books }
		add_character_modifier = gdp_tgf_ear_books_modifier
	}
}

# Watching It Sell
gdp_trade_good_flavor.1030 = {
	type = character_event
	title = gdp_trade_good_flavor.1030.t
	desc = gdp_trade_good_flavor.1030.desc
	theme = trade
	override_background = { reference = market }

	left_portrait = {
		character = root
		animation = trade_deal
		camera = camera_event_very_left
	}
	right_portrait = {
		character = scope:tgf_buyer
		animation = pointing
		camera = camera_event_left_away_3_4
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			highest_traded_good_category_xp_level >= gdp_tgf_renowned_expertise_level_value
		}
	}

	cooldown = { years = 15 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		exists = house
		gdp_tgf_has_ear_to_the_market_trigger = no
		any_trade_route = { gdp_tgf_watching_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_watching_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_traded_good = {
				limit = { gdp_tgf_renowned_sold_good_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_good
			}
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = {
					save_temporary_scope_as = tgf_watching_market_temp
					exists = trade_market_owner.title_province.county
					trade_market_owner.title_province = {
						save_temporary_scope_as = tgf_watching_province_temp
						any_pool_character = {
							province = scope:tgf_watching_province_temp
							is_healthy = yes
							is_physically_able_adult = yes
						}
					}
					scope:tgf_route = {
						is_selling_trade_good_in_market = {
							trade_market = scope:tgf_watching_market_temp
							trade_good_type = scope:tgf_good
						}
					}
				}
				save_scope_as = tgf_market
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					save_scope_as = tgf_source_province
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		random_pool_character = {
			province = scope:tgf_source_province
			limit = {
				is_physically_able_adult = yes
				is_healthy = yes
			}
			save_scope_as = tgf_buyer
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		gdp_tgf_set_background_location_effect = {
			CHAR = scope:tgf_buyer
			PROVINCE = scope:tgf_market.trade_market_owner.title_province
		}
	}

	option = {
		name = gdp_trade_good_flavor.1030.a
		gdp_tgf_add_ear_to_the_market_effect = yes
		ai_chance = {
			base = 100
			modifier = { has_trait = arrogant factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1030.b
		add_prestige = medium_prestige_gain
		ai_chance = {
			base = 100
			modifier = { has_trait = humble factor = 0 }
		}
	}
	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = trade market where $ROUTE$ sells a good and the local pool holds two adults to invest
scripted_trigger gdp_tgf_investors_market_trigger = {
	gdp_tgf_route_sells_here_trigger = { ROUTE = $ROUTE$ }
	trade_market_owner.title_province = {
		save_temporary_scope_as = tgf_investors_province_temp
		any_pool_character = {
			province = scope:tgf_investors_province_temp
			is_healthy = yes
			is_physically_able_adult = yes
			count >= 2
		}
	}
}

# this = trade route with a trader that has run for at least two years
scripted_trigger gdp_tgf_investors_route_trigger = {
	is_commission_route = no
	has_trader = yes
	age_in_months >= 24
	save_temporary_scope_as = tgf_investors_route_temp
	any_trade_market_on_route = {
		gdp_tgf_investors_market_trigger = { ROUTE = scope:tgf_investors_route_temp }
	}
}

# Outside Money
gdp_trade_good_flavor.1031 = {
	type = character_event
	title = gdp_trade_good_flavor.1031.t
	desc = gdp_trade_good_flavor.1031.desc
	theme = trade
	override_background = { reference = market }

	left_portrait = {
		character = scope:tgf_investor_a
		animation = holding_yoke
		camera = camera_event_left
	}
	right_portrait = {
		character = scope:tgf_investor_b
		animation = holding_scales
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 15 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		exists = house
		any_trade_route = {
			count >= 2
			is_commission_route = no
		}
		any_trade_route = { gdp_tgf_investors_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_investors_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = { gdp_tgf_investors_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					save_temporary_scope_as = tgf_outside_good_temp
					scope:tgf_route = {
						is_selling_trade_good_in_market = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_outside_good_temp
						}
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				holder ?= { save_scope_as = tgf_market_holder }
				title_province = {
					save_scope_as = tgf_source_province
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		random_pool_character = {
			province = scope:tgf_source_province
			limit = {
				is_physically_able_adult = yes
				is_healthy = yes
			}
			save_scope_as = tgf_investor_a
		}
		random_pool_character = {
			province = scope:tgf_source_province
			limit = {
				is_healthy = yes
				is_physically_able_adult = yes
				NOT = { this = scope:tgf_investor_a }
			}
			save_scope_as = tgf_investor_b
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		gdp_tgf_set_background_location_effect = {
			CHAR = scope:tgf_investor_a
			PROVINCE = scope:tgf_source_province
		}
	}

	option = {
		name = gdp_trade_good_flavor.1031.a
		add_gold = medium_gold_value
		scope:tgf_route = {
			gdp_tgf_add_tiered_route_modifier_effect = {
				MODIFIER = gdp_tgf_outside_capital
				YEARS = 10
			}
		}
		gdp_tgf_add_category_modifier_effect = { MODIFIER = outside_partners }
		ai_chance = {
			base = 100
			modifier = { has_trait = paranoid factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1031.b
		house = {
			add_unity_value = {
				value = minor_unity_gain
				character = root
				desc = gdp_tgf_kept_in_family_unity_desc
			}
		}
		gdp_tgf_add_category_modifier_effect = { MODIFIER = kept_in_family }
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# The Display Room
gdp_trade_good_flavor.1032 = {
	type = character_event
	title = gdp_trade_good_flavor.1032.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:tgf_category = trade_good_category:trade_category_beasts_of_burden }
				desc = gdp_trade_good_flavor.1032.desc.livestock
			}
			desc = gdp_trade_good_flavor.1032.desc
		}
	}
	theme = merchant

	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { exists = scope:tgf_good }
			scripted_animation = gdp_tgf_good_animation
		}
		animation = merchant_box
		camera = camera_event_left
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 15 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		exists = domicile
	}

	immediate = {
		gdp_tgf_setup_good_effect = yes
	}

	option = {
		name = gdp_trade_good_flavor.1032.a
		add_trade_good_price_modifier = {
			type = sell_mult
			trade_good_type = scope:tgf_good
			value = { value = 0.02 multiply = gdp_tgf_renown_tier_value }
			years = 10
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = generous factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1032.b
		add_prestige = medium_prestige_gain
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}
	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = trade good category root's company is renowned in but no longer trades
scripted_trigger gdp_tgf_lapsed_category_trigger = {
	has_trade_good_category_xp_track = yes
	save_temporary_scope_as = tgf_lapsed_cat_temp
	root = {
		gdp_tgf_renowned_in_category_trigger = { CATEGORY = scope:tgf_lapsed_cat_temp }
		NOT = {
			any_trade_category_traded_in = { this = scope:tgf_lapsed_cat_temp }
		}
	}
}

# Keeping Your Hand In
gdp_trade_good_flavor.1033 = {
	type = character_event
	title = gdp_trade_good_flavor.1033.t
	desc = gdp_trade_good_flavor.1033.desc
	theme = merchant
	override_background = { reference = study }

	left_portrait = {
		character = root
		animation = holding_scales
		camera = camera_event_left
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 15 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_good_category = { gdp_tgf_lapsed_category_trigger = yes }
	}

	immediate = {
		random_trade_good_category = {
			limit = { gdp_tgf_lapsed_category_trigger = yes }
			save_scope_as = tgf_category
		}
		scope:tgf_category = {
			random_trade_good_in_category = { save_scope_as = tgf_good }
		}
		random_trade_route = {
			limit = {
				is_commission_route = no
				any_traded_good = { always = yes }
			}
			random_traded_good = {
				trade_good_need_category = { save_scope_as = tgf_current_category }
			}
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.1033.a
		remove_short_term_gold = minor_gold_value
		gdp_tgf_add_category_modifier_effect = { MODIFIER = old_habits }
		add_trade_good_price_modifier = {
			type = sell_mult
			trade_good_type = scope:tgf_good
			value = { value = 0.02 multiply = gdp_tgf_renown_tier_value }
			years = 10
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = lazy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1033.b
		add_gold = miniscule_gold_value
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = gdp_tgf_sold_expertise_xp_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = paranoid factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1033.c
		add_stress = minor_stress_loss
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_current_category
			VALUE = trade_expertise_xp_minor_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = diligent factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = trade route with a pilgrim in a market's local pool, carrying a good root is still fledgling in
scripted_trigger gdp_tgf_itinerary_route_trigger = {
	is_commission_route = no
	save_temporary_scope_as = tgf_itinerary_route_temp
	any_trade_market_on_route = {
		gdp_tgf_broker_market_trigger = { ROUTE = scope:tgf_itinerary_route_temp }
	}
	any_traded_good = {
		trade_good_need_category = { save_temporary_scope_as = tgf_itinerary_cat_temp }
		root = {
			gdp_tgf_fledgling_in_category_trigger = { CATEGORY = scope:tgf_itinerary_cat_temp }
		}
	}
}

scripted_effect gdp_tgf_create_itinerary_effect = {
	gdp_tgf_roll_artifact_rarity_effect = { RARITY = random }
	create_artifact = {
		name = gdp_tgf_itinerary_artifact
		description = gdp_tgf_itinerary_artifact_desc
		type = library_item
		visuals = book
		modifier = gdp_tgf_itinerary_artifact_modifier
		quality = scope:quality
		wealth = scope:wealth
		save_scope_as = newly_created_artifact
	}
	gdp_tgf_add_artifact_trade_modifiers_effect = yes
}

# The Itinerary
gdp_trade_good_flavor.1034 = {
	type = character_event
	title = gdp_trade_good_flavor.1034.t
	desc = gdp_trade_good_flavor.1034.desc
	theme = trade
	override_background = { reference = market }

	left_portrait = {
		character = root
		animation = reading
		camera = camera_event_left
	}
	right_portrait = {
		character = scope:tgf_pilgrim
		animation = holding_staff
		camera = camera_event_very_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			lowest_traded_good_category_xp_level < gdp_tgf_renowned_expertise_level_value
		}
	}

	trigger = {
		NOT = { has_character_flag = gdp_tgf_had_event_1034 }
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_itinerary_route_trigger = yes }
	}

	immediate = {
		add_character_flag = gdp_tgf_had_event_1034
		random_trade_route = {
			limit = { gdp_tgf_itinerary_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = { gdp_tgf_broker_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					trade_good_need_category = { save_temporary_scope_as = tgf_itinerary_cat_temp }
					root = { gdp_tgf_fledgling_in_category_trigger = { CATEGORY = scope:tgf_itinerary_cat_temp } }
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					save_scope_as = tgf_source_province
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		random_pool_character = {
			province = scope:tgf_source_province
			limit = {
				is_physically_able_adult = yes
				is_healthy = yes
			}
			save_scope_as = tgf_pilgrim
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		gdp_tgf_set_background_location_effect = {
			CHAR = scope:tgf_pilgrim
			PROVINCE = scope:tgf_market.trade_market_owner.title_province
		}
	}

	option = {
		name = gdp_trade_good_flavor.1034.a
		pay_short_term_gold = {
			target = scope:tgf_pilgrim
			gold = minor_gold_value
		}
		gdp_tgf_create_itinerary_effect = yes
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_major_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1034.b
		gdp_tgf_create_itinerary_effect = yes
		stress_impact = {
			honest = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = honest factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1034.c
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_miniscule_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = curious factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = character, a guest or local commoner fit to dine with root
scripted_trigger gdp_tgf_dinner_guest_trigger = {
	NOT = { this = root }
	is_ai = yes
	is_physically_able_adult = yes
}

# Talking Shop
gdp_trade_good_flavor.1035 = {
	type = character_event
	title = gdp_trade_good_flavor.1035.t
	desc = gdp_trade_good_flavor.1035.desc
	theme = merchant

	left_portrait = {
		character = root
		animation = merchant_gesturing
		camera = camera_event_left
	}
	right_portrait = {
		character = scope:tgf_guest
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_horses }
			animation = standing_horse
		}
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_cattle }
			animation = holding_yoke
		}
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_wool }
			animation = shepherd_with_sheep
		}
		triggered_animation = {
			trigger = { OR = { scope:tgf_good = trade_good_type:trade_good_wine scope:tgf_good = trade_good_type:trade_good_beer } }
			animation = drink_goblet
		}
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_meat }
			animation = holding_salami
		}
		triggered_animation = {
			trigger = { OR = { scope:tgf_good = trade_good_type:trade_good_cheese scope:tgf_good = trade_good_type:trade_good_tea scope:tgf_good = trade_good_type:trade_good_sugar scope:tgf_good = trade_good_type:trade_good_rice scope:tgf_good = trade_good_type:trade_good_fruit scope:tgf_good = trade_good_type:trade_good_honey } }
			animation = serving_tray
		}
		triggered_animation = {
			trigger = { OR = { scope:tgf_good = trade_good_type:trade_good_salt scope:tgf_good = trade_good_type:trade_good_spices scope:tgf_good = trade_good_type:trade_good_grain scope:tgf_good = trade_good_type:trade_good_millet } }
			animation = holding_scales
		}
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_incense }
			animation = thurible
		}
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_medicaments }
			animation = physician
		}
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_oil }
			animation = lantern
		}
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_books_paper }
			animation = holding_scrolls
		}
		triggered_animation = {
			trigger = { OR = { scope:tgf_good = trade_good_type:trade_good_gold scope:tgf_good = trade_good_type:trade_good_silver scope:tgf_good = trade_good_type:trade_good_copper scope:tgf_good = trade_good_type:trade_good_fish } }
			animation = merchant_box
		}
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_furs }
			animation = hunting_carcass_start
		}
		animation = pondering
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 15 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		OR = {
			any_pool_guest = { gdp_tgf_dinner_guest_trigger = yes }
			any_foreign_court_guest = { gdp_tgf_dinner_guest_trigger = yes }
			location = {
				save_temporary_scope_as = tgf_guest_province_temp
				any_pool_character = {
					province = scope:tgf_guest_province_temp
					is_healthy = yes
					gdp_tgf_dinner_guest_trigger = yes
				}
			}
		}
	}

	immediate = {
		gdp_tgf_setup_good_effect = yes
		if = {
			limit = { any_pool_guest = { gdp_tgf_dinner_guest_trigger = yes } }
			random_pool_guest = {
				limit = { gdp_tgf_dinner_guest_trigger = yes }
				save_scope_as = tgf_guest
			}
		}
		else_if = {
			limit = { any_foreign_court_guest = { gdp_tgf_dinner_guest_trigger = yes } }
			random_foreign_court_guest = {
				limit = { gdp_tgf_dinner_guest_trigger = yes }
				save_scope_as = tgf_guest
			}
		}
		else = {
			location = {
				save_scope_as = tgf_guest_province
				random_pool_character = {
					province = scope:tgf_guest_province
					limit = {
						gdp_tgf_dinner_guest_trigger = yes
						is_healthy = yes
					}
					save_scope_as = tgf_guest
				}
			}
		}
	}

	option = {
		name = gdp_trade_good_flavor.1035.a
		trigger = {
			is_ai = no
			scope:tgf_guest = { short_term_gold >= miniscule_gold_value }
		}
		show_as_unavailable = { always = yes }
		scope:tgf_guest = {
			pay_short_term_gold = {
				target = root
				gold = miniscule_gold_value
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = generous factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1035.b
		add_trade_good_price_modifier = {
			type = buy_mult
			trade_good_type = scope:tgf_good
			value = { value = -0.003 multiply = gdp_tgf_renown_tier_value }
			years = 10
		}
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_minor_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = arrogant factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1035.c
		add_prestige = minor_prestige_gain
		ai_chance = {
			base = 100
			modifier = { has_trait = humble factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = trade route with a trader that carries a packable good
scripted_trigger gdp_tgf_packing_route_trigger = {
	is_commission_route = no
	has_trader = yes
	any_traded_good = { gdp_tgf_not_livestock_good_trigger = yes }
}

# The Packing Floor
gdp_trade_good_flavor.1036 = {
	type = character_event
	title = gdp_trade_good_flavor.1036.t
	desc = gdp_trade_good_flavor.1036.desc
	theme = trade
	override_background = { reference = gdp_carpentry_workshop }

	left_portrait = {
		character = root
		animation = pondering
		camera = camera_event_left
	}
	right_portrait = {
		character = scope:tgf_trader
		animation = holding_yoke
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 15 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_packing_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_packing_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			trader = { save_scope_as = tgf_trader }
			random_traded_good = {
				limit = { gdp_tgf_not_livestock_good_trigger = yes }
				save_scope_as = tgf_good
			}
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.1036.a
		add_prestige = minor_prestige_loss
		scope:tgf_route = {
			gdp_tgf_add_tiered_route_modifier_effect = {
				MODIFIER = gdp_tgf_packed_tight
				YEARS = 10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = honest factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1036.b
		add_prestige = minor_prestige_gain
		add_trade_good_price_modifier = {
			type = sell_mult
			trade_good_type = scope:tgf_good
			value = { value = 0.01 multiply = gdp_tgf_renown_tier_value }
			years = 10
		}
		scope:tgf_route = {
			add_trade_route_modifier = {
				modifier = gdp_tgf_packed_well_modifier
				years = 10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1036.c
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_minor_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = diligent factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = trade market where $ROUTE$ buys a packable good and the local pool holds an adult to seal it
scripted_trigger gdp_tgf_seal_market_trigger = {
	save_temporary_scope_as = tgf_seal_market_temp
	exists = trade_market_owner.title_province.county
	$ROUTE$ = {
		any_traded_good = {
			gdp_tgf_not_livestock_good_trigger = yes
			save_temporary_scope_as = tgf_seal_good_temp
			$ROUTE$ = {
				is_buying_trade_good_in_market = {
					trade_market = scope:tgf_seal_market_temp
					trade_good_type = scope:tgf_seal_good_temp
				}
			}
		}
	}
	trade_market_owner.title_province = {
		save_temporary_scope_as = tgf_seal_province_temp
		any_pool_character = {
			province = scope:tgf_seal_province_temp
			is_healthy = yes
			is_physically_able_adult = yes
		}
	}
}

# this = trade route
scripted_trigger gdp_tgf_seal_route_trigger = {
	is_commission_route = no
	save_temporary_scope_as = tgf_seal_route_temp
	any_trade_market_on_route = {
		gdp_tgf_seal_market_trigger = { ROUTE = scope:tgf_seal_route_temp }
	}
}

# The Market Seal
gdp_trade_good_flavor.1037 = {
	type = character_event
	title = gdp_trade_good_flavor.1037.t
	desc = gdp_trade_good_flavor.1037.desc
	theme = trade
	override_background = { reference = gdp_artisan_street }

	left_portrait = {
		character = root
		animation = arguing
		camera = camera_event_left_to_the_left
	}
	right_portrait = {
		character = scope:tgf_sealer
		animation = holding_scales
		camera = camera_event_right
	}

	widgets = {
		widget = {
			is_shown = {
				scope:tgf_source_province = {
					OR = {
						terrain = desert
						terrain = desert_mountains
						terrain = drylands
						terrain = oasis
						arid_region_trigger = yes
						AND = {
							tropical_seasons_region_trigger = yes
							has_winter_trigger = no
						}
					}
				}
			}
			gui = event_window_widget_vfx_heat_wave
			container = background_shader_vfx_container
		}
		widget = {
			gui = "event_window_widget_trade_good"
			container = "custom_widgets_container"
		}
	}

	cooldown = { years = 15 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_seal_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_seal_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = { gdp_tgf_seal_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					gdp_tgf_not_livestock_good_trigger = yes
					save_temporary_scope_as = tgf_seal_good_temp
					scope:tgf_route = {
						is_buying_trade_good_in_market = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_seal_good_temp
						}
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					save_scope_as = tgf_source_province
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		random_pool_character = {
			province = scope:tgf_source_province
			limit = {
				is_physically_able_adult = yes
				is_healthy = yes
			}
			save_scope_as = tgf_sealer
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		gdp_tgf_set_background_location_effect = {
			CHAR = scope:tgf_sealer
			PROVINCE = scope:tgf_market.trade_market_owner.title_province
		}
	}

	option = {
		name = gdp_trade_good_flavor.1037.a
		add_trade_good_price_modifier = {
			type = sell_mult
			trade_good_type = scope:tgf_good
			value = { value = 0.02 multiply = gdp_tgf_renown_tier_value }
			years = 10
		}
		scope:tgf_route = {
			add_trade_route_modifier = {
				modifier = gdp_tgf_sealed_stock_wait_modifier
				years = 1
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = impatient factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1037.b
		pay_short_term_gold = {
			target = scope:tgf_sealer
			gold = miniscule_gold_value
		}
		add_trade_good_price_modifier = {
			type = sell_mult
			trade_good_type = scope:tgf_good
			value = { value = 0.01 multiply = gdp_tgf_renown_tier_value }
			years = 10
		}
		scope:tgf_route = {
			gdp_tgf_add_tiered_route_modifier_effect = {
				MODIFIER = gdp_tgf_quick_seal
				YEARS = 10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = honest factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1037.c
		if = {
			limit = { gdp_tgf_root_renowned_in_event_category_trigger = yes }
			add_prestige = minor_prestige_gain
		}
		else = {
			gdp_increase_trade_expertise_xp_effect = {
				CATEGORY = scope:tgf_category
				VALUE = trade_expertise_xp_minor_value
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = humble factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = trade route
scripted_trigger gdp_tgf_broker_route_trigger = {
	is_commission_route = no
	save_temporary_scope_as = tgf_broker_route_temp
	any_trade_market_on_route = {
		gdp_tgf_broker_market_trigger = { ROUTE = scope:tgf_broker_route_temp }
	}
}

# The Broker
gdp_trade_good_flavor.1038 = {
	type = character_event
	title = gdp_trade_good_flavor.1038.t
	desc = gdp_trade_good_flavor.1038.desc
	theme = trade
	override_background = { reference = market }

	left_portrait = {
		character = root
		animation = drink
		camera = camera_event_very_left
	}
	right_portrait = {
		character = scope:tgf_broker
		animation = merchant_gesturing
		camera = camera_event_right_away
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 15 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_broker_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_broker_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = { gdp_tgf_broker_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					save_temporary_scope_as = tgf_broker_good_temp
					scope:tgf_route = {
						is_selling_trade_good_in_market = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_broker_good_temp
						}
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					save_scope_as = tgf_source_province
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		random_pool_character = {
			province = scope:tgf_source_province
			limit = {
				is_physically_able_adult = yes
				is_healthy = yes
			}
			save_scope_as = tgf_broker
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		gdp_tgf_set_background_location_effect = {
			CHAR = scope:tgf_broker
			PROVINCE = scope:tgf_market.trade_market_owner.title_province
		}
	}

	option = {
		name = gdp_trade_good_flavor.1038.a
		add_courtier = scope:tgf_broker
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good
				value = -0.01
				years = 10
			}
		}
		if = {
			limit = { NOT = { has_character_modifier = gdp_tgf_broker_reach_renowned_modifier } }
			if = {
				limit = { gdp_tgf_root_renowned_in_event_category_trigger = yes }
				remove_character_modifier = gdp_tgf_broker_reach_modifier
				add_character_modifier = gdp_tgf_broker_reach_renowned_modifier
			}
			else_if = {
				limit = { NOT = { has_character_modifier = gdp_tgf_broker_reach_modifier } }
				add_character_modifier = gdp_tgf_broker_reach_modifier
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = paranoid factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1038.b
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_minor_value
		}
		if = {
			limit = { has_trait = lifestyle_merchant }
			add_trait_xp = {
				trait = lifestyle_merchant
				track = caravaneer
				value = lifestyle_merchant_xp_gain_minor_value
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = lazy factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# The Trader's Apprentice
gdp_trade_good_flavor.1039 = {
	type = character_event
	title = gdp_trade_good_flavor.1039.t
	desc = gdp_trade_good_flavor.1039.desc
	theme = merchant
	override_background = {
		trigger = {
			OR = { scope:tgf_category = trade_good_category:trade_category_base_metals scope:tgf_category = trade_good_category:trade_category_precious_metals scope:tgf_category = trade_good_category:trade_category_jewelry_materials scope:tgf_good = trade_good_type:trade_good_jewelry }
		}
		reference = gdp_smithy_workshop
	}
	override_background = {
		trigger = {
			OR = { scope:tgf_good = trade_good_type:trade_good_leather scope:tgf_good = trade_good_type:trade_good_furs scope:tgf_good = trade_good_type:trade_good_dyes }
		}
		reference = gdp_tannery
	}
	override_background = {
		trigger = {
			OR = { scope:tgf_good = trade_good_type:trade_good_wood scope:tgf_good = trade_good_type:trade_good_hemp scope:tgf_good = trade_good_type:trade_good_lacquerware }
		}
		reference = gdp_carpentry_workshop
	}
	override_background = {
		trigger = {
			OR = { scope:tgf_good = trade_good_type:trade_good_horses scope:tgf_good = trade_good_type:trade_good_cattle scope:tgf_good = trade_good_type:trade_good_wool scope:tgf_good = trade_good_type:trade_good_grain scope:tgf_good = trade_good_type:trade_good_millet scope:tgf_good = trade_good_type:trade_good_rice scope:tgf_good = trade_good_type:trade_good_cotton scope:tgf_good = trade_good_type:trade_good_flax scope:tgf_good = trade_good_type:trade_good_fruit }
		}
		reference = farmland
	}
	override_background = {
		trigger = {
			OR = { scope:tgf_category = trade_good_category:trade_category_alcohol scope:tgf_category = trade_good_category:trade_category_salt scope:tgf_category = trade_good_category:trade_category_meat scope:tgf_good = trade_good_type:trade_good_oil scope:tgf_good = trade_good_type:trade_good_cheese scope:tgf_good = trade_good_type:trade_good_honey scope:tgf_good = trade_good_type:trade_good_sugar scope:tgf_good = trade_good_type:trade_good_spices scope:tgf_good = trade_good_type:trade_good_tea }
		}
		reference = bp1_wine_cellar
	}
	override_background = { reference = gdp_artisan_street }

	left_portrait = {
		character = scope:tgf_trader
		animation = merchant_gesturing
		camera = camera_event_left_forward
	}
	right_portrait = {
		character = scope:tgf_youth
		animation = holding_tally_stick
		camera = camera_event_right_forward
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	weight_multiplier = {
		base = 0.25
		modifier = {
			factor = 4
			NOT = { exists = player_heir }
		}
	}

	cooldown = { years = 15 }

	trigger = {
		is_ai = no
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = {
			is_commission_route = no
			has_trader = yes
			trader ?= {
				NOT = { this = root }
			}
			any_traded_good = { always = yes }
		}
	}

	immediate = {
		random_trade_route = {
			limit = {
				is_commission_route = no
				has_trader = yes
				trader ?= {
					NOT = { this = root }
				}
				any_traded_good = { always = yes }
			}
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			trader = { save_scope_as = tgf_trader }
			random_traded_good = { save_scope_as = tgf_good }
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		create_character = {
			age = 16
			gender_female_chance = 50
			dynasty = none
			culture = scope:tgf_trader.culture
			faith = scope:tgf_trader.faith
			location = root.location
			stewardship = 14
			trait = education_stewardship_3
			trait = diligent
			save_scope_as = tgf_youth
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		gdp_tgf_set_background_location_effect = {
			CHAR = scope:tgf_trader
			PROVINCE = root.location
		}
	}

	option = {
		name = gdp_trade_good_flavor.1039.a
		add_courtier = scope:tgf_youth
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_medium_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1039.b
		add_courtier = scope:tgf_youth
		scope:tgf_route = {
			gdp_tgf_add_tiered_route_modifier_effect = {
				MODIFIER = gdp_tgf_trained_hand
				YEARS = 10
			}
		}
		scope:tgf_trader = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 15
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = ambitious factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1039.c
		house = {
			add_unity_value = {
				value = minor_unity_gain
				character = root
				desc = gdp_tgf_family_only_unity_desc
			}
		}
		scope:tgf_trader = {
			add_opinion = {
				target = root
				modifier = annoyed_opinion
				opinion = -10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = compassionate factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# Swimming in It
gdp_trade_good_flavor.1040 = {
	type = character_event
	title = gdp_trade_good_flavor.1040.t
	desc = gdp_trade_good_flavor.1040.desc
	theme = merchant
	override_background = { reference = bp1_wine_cellar }

	left_portrait = {
		character = root
		animation = trade_deal
		camera = camera_torso_center_fov30
	}

	widgets = {
		widget = { gui = event_window_widget_vfx_background_flickering_candlelight_dark container = foreground_shader_vfx_container }
		widget = { gui = event_window_widget_vfx_left_character_flickering_candlelight_dark container = foreground_shader_vfx_container }
		widget = {
			gui = "event_window_widget_trade_good"
			container = "custom_widgets_container"
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			has_trait = greedy
		}
	}

	cooldown = { years = 15 }

	trigger = {
		stress > 0
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		gdp_tgf_flush_with_money_trigger = yes
		any_trade_route = {
			is_commission_route = no
			any_traded_good = { gdp_tgf_not_livestock_good_trigger = yes }
		}
	}

	immediate = {
		gdp_tgf_setup_packable_good_effect = yes
	}

	option = {
		name = gdp_trade_good_flavor.1040.a
		add_stress = major_stress_loss
		random = {
			chance = 30
			send_interface_toast = {
				type = event_toast_effect_bad
				title = gdp_trade_good_flavor.1040.a.toast
				left_icon = root
				add_character_modifier = {
					modifier = gdp_tgf_bruised_modifier
					years = 1
				}
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = temperate factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1040.b
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_miniscule_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = lazy factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# The First Sale
gdp_trade_good_flavor.1041 = {
	type = character_event
	title = gdp_trade_good_flavor.1041.t
	desc = gdp_trade_good_flavor.1041.desc
	theme = merchant
	override_background = { reference = bp1_wine_cellar }

	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_horses }
			animation = standing_horse
		}
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_cattle }
			animation = holding_yoke
		}
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_wool }
			animation = shepherd_with_sheep
		}
		triggered_animation = {
			trigger = { OR = { scope:tgf_good = trade_good_type:trade_good_wine scope:tgf_good = trade_good_type:trade_good_beer } }
			animation = drink_goblet
		}
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_meat }
			animation = holding_salami
		}
		triggered_animation = {
			trigger = { OR = { scope:tgf_good = trade_good_type:trade_good_cheese scope:tgf_good = trade_good_type:trade_good_tea scope:tgf_good = trade_good_type:trade_good_sugar scope:tgf_good = trade_good_type:trade_good_rice scope:tgf_good = trade_good_type:trade_good_fruit scope:tgf_good = trade_good_type:trade_good_honey } }
			animation = serving_tray
		}
		triggered_animation = {
			trigger = { OR = { scope:tgf_good = trade_good_type:trade_good_salt scope:tgf_good = trade_good_type:trade_good_spices scope:tgf_good = trade_good_type:trade_good_grain scope:tgf_good = trade_good_type:trade_good_millet } }
			animation = holding_scales
		}
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_incense }
			animation = thurible
		}
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_medicaments }
			animation = physician
		}
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_oil }
			animation = lantern
		}
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_books_paper }
			animation = holding_scrolls
		}
		triggered_animation = {
			trigger = { OR = { scope:tgf_good = trade_good_type:trade_good_gold scope:tgf_good = trade_good_type:trade_good_silver scope:tgf_good = trade_good_type:trade_good_copper scope:tgf_good = trade_good_type:trade_good_fish } }
			animation = merchant_box
		}
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_furs }
			animation = hunting_carcass_start
		}
		animation = happiness
		camera = camera_event_left
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			has_trait = greedy
		}
	}

	trigger = {
		NOT = { has_character_flag = gdp_tgf_had_event_1041 }
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		gdp_tgf_flush_with_money_trigger = yes
		any_trade_route = {
			is_commission_route = no
			any_traded_good = { gdp_tgf_not_livestock_good_trigger = yes }
		}
	}

	immediate = {
		add_character_flag = gdp_tgf_had_event_1041
		gdp_tgf_setup_packable_good_effect = yes
	}

	option = {
		name = gdp_trade_good_flavor.1041.a
		gdp_tgf_roll_artifact_rarity_effect = { RARITY = illustrious }
		save_scope_as = tgf_first_seller
		create_artifact = {
			name = gdp_tgf_first_sale_artifact
			description = gdp_tgf_first_sale_artifact_desc
			type = curio
			visuals = pocket_pouch
			modifier = artifact_monthly_minor_prestige_1_modifier
			quality = scope:quality
			wealth = scope:wealth
			save_scope_as = newly_created_artifact
		}
		gdp_tgf_add_artifact_trade_modifiers_effect = yes
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1041.b
		add_gold = minor_gold_value
		if = {
			limit = { has_trait = lifestyle_merchant }
			add_trait_xp = {
				trait = lifestyle_merchant
				track = creditor
				value = lifestyle_merchant_xp_gain_minor_value
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = humble factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# Coin Under the Pillow
gdp_trade_good_flavor.1042 = {
	type = character_event
	title = gdp_trade_good_flavor.1042.t
	desc = gdp_trade_good_flavor.1042.desc
	theme = merchant
	override_background = { reference = bedchamber }

	left_portrait = {
		character = root
		animation = merchant_box
		camera = camera_torso_center_fov30
	}

	widgets = {
		widget = { gui = event_window_widget_vfx_background_night_scene container = foreground_shader_vfx_container }
		widget = { gui = event_window_widget_vfx_left_character_night_scene container = foreground_shader_vfx_container }
		widget = {
			gui = "event_window_widget_trade_good"
			container = "custom_widgets_container"
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			has_trait = greedy
		}
	}

	cooldown = { years = 15 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		gdp_tgf_flush_with_money_trigger = yes
	}

	immediate = {
		add_character_flag = {
			flag = use_sickness_clothes
			days = 7
		}
		gdp_tgf_setup_good_effect = yes
	}

	option = {
		name = gdp_trade_good_flavor.1042.a
		add_stress = medium_stress_loss
		add_character_modifier = {
			modifier = gdp_tgf_stiff_neck_modifier
			years = 1
		}
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_minor_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = paranoid factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1042.b
		remove_short_term_gold = miniscule_gold_value
		add_trade_good_price_modifier = {
			type = buy_mult
			trade_good_type = scope:tgf_good
			value = { value = -0.01 multiply = gdp_tgf_renown_tier_value }
			years = 10
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	after = {
		remove_character_flag = use_sickness_clothes
		gdp_tgf_clear_widget_good_effect = yes
	}
}

scripted_effect gdp_tgf_create_merchant_portrait_effect = {
	gdp_tgf_roll_artifact_rarity_effect = { RARITY = random }
	create_artifact = {
		name = gdp_tgf_merchant_portrait_artifact
		description = gdp_tgf_merchant_portrait_artifact_desc
		type = wall_small
		visuals = icon_court_small
		modifier = artifact_monthly_prestige_1_modifier
		quality = scope:quality
		wealth = scope:wealth
		save_scope_as = newly_created_artifact
	}
	gdp_tgf_add_artifact_trade_modifiers_effect = yes
}

# Portrait With Coins
gdp_trade_good_flavor.1043 = {
	type = character_event
	title = gdp_trade_good_flavor.1043.t
	desc = gdp_trade_good_flavor.1043.desc
	theme = merchant
	override_background = council_chamber

	left_portrait = {
		character = root
		animation = steward
		camera = camera_event_crowd
	}
	right_portrait = {
		character = scope:tgf_painter
		animation = pondering
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			has_trait = greedy
		}
	}

	trigger = {
		NOT = { has_character_flag = gdp_tgf_had_event_1043 }
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		gdp_tgf_flush_with_money_trigger = yes
		exists = location.county
		location = {
			save_temporary_scope_as = tgf_painter_province_temp
			any_pool_character = {
				province = scope:tgf_painter_province_temp
				is_healthy = yes
				is_physically_able_adult = yes
			}
		}
	}

	immediate = {
		add_character_flag = gdp_tgf_had_event_1043
		gdp_tgf_setup_good_effect = yes
		location = {
			save_scope_as = tgf_painter_province
			county = { save_scope_as = tgf_source_county }
			random_pool_character = {
				province = scope:tgf_painter_province
				limit = {
					is_physically_able_adult = yes
					is_healthy = yes
				}
				save_scope_as = tgf_painter
			}
		}
	}

	option = {
		name = gdp_trade_good_flavor.1043.a
		pay_short_term_gold = {
			target = scope:tgf_painter
			gold = minor_gold_value
		}
		gdp_tgf_create_merchant_portrait_effect = yes
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1043.b
		trigger = { short_term_gold >= medium_gold_value }
		show_as_unavailable = { always = yes }
		pay_short_term_gold = {
			target = scope:tgf_painter
			gold = medium_gold_value
		}
		gdp_tgf_create_merchant_portrait_effect = yes
		add_prestige = minor_prestige_gain
		ai_chance = {
			base = 100
			modifier = { has_trait = humble factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1043.c
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = buy_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = -0.005 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = arrogant factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = courtier who fits the servant's line to root
scripted_trigger gdp_tgf_purse_servant_trigger = {
	is_physically_able_adult = yes
	NOR = {
		is_close_or_extended_family_of = root
		is_spouse_of = root
		is_concubine_of = root
	}
}

# A Purse Too Heavy
gdp_trade_good_flavor.1044 = {
	type = character_event
	title = gdp_trade_good_flavor.1044.t
	desc = gdp_trade_good_flavor.1044.desc
	theme = merchant

	left_portrait = {
		character = scope:tgf_servant
		animation = merchant_box
		camera = camera_event_very_left
	}
	right_portrait = {
		character = root
		animation = biting_coin
		camera = camera_event_very_left
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			has_trait = greedy
		}
	}

	cooldown = { years = 15 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		gdp_tgf_flush_with_money_trigger = yes
		any_courtier = { gdp_tgf_purse_servant_trigger = yes }
	}

	immediate = {
		gdp_tgf_setup_good_effect = yes
		random_courtier = {
			limit = { gdp_tgf_purse_servant_trigger = yes }
			weight = {
				base = 1
				modifier = {
					add = 4
					has_no_particular_noble_roots_trigger = yes
				}
			}
			save_scope_as = tgf_servant
		}
	}

	option = {
		name = gdp_trade_good_flavor.1044.a
		remove_short_term_gold = miniscule_gold_value
		add_prestige = medium_prestige_gain
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1044.b
		trigger = { short_term_gold >= medium_gold_value }
		show_as_unavailable = { always = yes }
		remove_short_term_gold = medium_gold_value
		add_prestige = major_prestige_gain
		ai_chance = {
			base = 100
			modifier = { has_trait = humble factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1044.c
		add_prestige = minor_prestige_gain
		add_trade_good_price_modifier = {
			type = sell_mult
			trade_good_type = scope:tgf_good
			value = { value = 0.01 multiply = gdp_tgf_renown_tier_value }
			years = 10
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = shy factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = character who trades alcohol under a faith that forbids it
scripted_trigger gdp_tgf_forbidden_alcohol_trigger = {
	faith = { has_doctrine_parameter = alcohol_forbidden }
	any_trade_route = {
		is_commission_route = no
		any_traded_good = {
			any_trade_category = { this = trade_good_category:trade_category_alcohol }
		}
	}
}

# Profit and Piety
gdp_trade_good_flavor.1045 = {
	type = character_event
	title = gdp_trade_good_flavor.1045.t
	desc = gdp_trade_good_flavor.1045.desc
	theme = trade
	override_background = { reference = study }

	left_portrait = {
		character = root
		animation = page_flipping
		camera = camera_event_left
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 25 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		NOT = { has_trait = cynical }
		ai_zeal >= 1
		OR = {
			has_trait = zealous
			has_trait = humble
			ai_zeal >= 50
			gdp_tgf_forbidden_alcohol_trigger = yes
		}
	}

	immediate = {
		if = {
			limit = { gdp_tgf_forbidden_alcohol_trigger = yes }
			random_trade_route = {
				limit = {
					is_commission_route = no
					any_traded_good = {
						any_trade_category = { this = trade_good_category:trade_category_alcohol }
					}
				}
				save_scope_as = tgf_route
			}
			scope:tgf_route = {
				random_traded_good = {
					limit = {
						any_trade_category = { this = trade_good_category:trade_category_alcohol }
					}
					save_scope_as = tgf_good
				}
			}
			scope:tgf_good = {
				trade_good_need_category = { save_scope_as = tgf_category }
			}
			gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		}
		else = {
			gdp_tgf_setup_good_effect = yes
		}
	}

	option = {
		name = gdp_trade_good_flavor.1045.a
		remove_short_term_gold = minor_gold_value
		add_piety = major_piety_gain
		stress_impact = {
			greedy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1045.b
		add_stress = minor_stress_loss
		add_piety = miniscule_piety_gain
		ai_chance = {
			base = 100
			modifier = { has_trait = cynical factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1045.c
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_minor_value
		}
		stress_impact = {
			zealous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = zealous factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = trade market where $ROUTE$ buys, in a county of the route trader's culture but not root's
scripted_trigger gdp_tgf_kin_trader_market_trigger = {
	gdp_tgf_route_buys_here_trigger = { ROUTE = $ROUTE$ }
	trade_market_owner.title_province.county = {
		culture = $ROUTE$.trader.culture
		NOT = { culture = root.culture }
	}
}

# this = trade route whose trader is at home in a market on it where root is not
scripted_trigger gdp_tgf_kin_trader_route_trigger = {
	is_commission_route = no
	has_trader = yes
	trader ?= {
		NOT = { this = root }
		is_physically_able_adult = yes
	}
	save_temporary_scope_as = tgf_kin_route_temp
	any_trade_market_on_route = {
		gdp_tgf_kin_trader_market_trigger = { ROUTE = scope:tgf_kin_route_temp }
	}
}

# One of Their Own
gdp_trade_good_flavor.1046 = {
	type = character_event
	title = gdp_trade_good_flavor.1046.t
	desc = gdp_trade_good_flavor.1046.desc
	theme = trade
	override_background = { reference = market }

	left_portrait = {
		character = root
		animation = donkey_standing_baggage
		camera = camera_event_very_left
	}
	right_portrait = {
		character = scope:tgf_trader
		animation = holding_scales
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 25 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_kin_trader_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_kin_trader_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			trader = { save_scope_as = tgf_trader }
			random_trade_market_on_route = {
				limit = { gdp_tgf_kin_trader_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					save_temporary_scope_as = tgf_kin_good_temp
					scope:tgf_route = {
						is_buying_trade_good_in_market = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_kin_good_temp
						}
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					county = {
						save_scope_as = tgf_source_county
						culture = { save_scope_as = tgf_source_culture }
					}
				}
			}
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		gdp_tgf_set_background_location_effect = {
			CHAR = scope:tgf_trader
			PROVINCE = scope:tgf_market.trade_market_owner.title_province
		}
	}

	option = {
		name = gdp_trade_good_flavor.1046.a
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = buy_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = -0.02 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		scope:tgf_trader = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 20
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = arrogant factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1046.b
		pay_short_term_gold = {
			target = scope:tgf_trader
			gold = miniscule_gold_value
		}
		scope:tgf_trader = {
			add_stewardship_skill = 1
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1046.c
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_minor_value
		}
		scope:tgf_source_culture = {
			change_cultural_acceptance = {
				target = root.culture
				value = minor_cultural_acceptance_gain
				desc = cultural_acceptance_gain_event
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = lazy factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = trade market where $ROUTE$ sells a good and an AI rival trades too
scripted_trigger gdp_tgf_flood_market_trigger = {
	gdp_tgf_route_sells_here_trigger = { ROUTE = $ROUTE$ }
	any_potential_trade_rival_in_market = {
		target = root
		gdp_tgf_auction_rival_trigger = yes
	}
}

# this = trade route with a trader. Expects root = the merchant
scripted_trigger gdp_tgf_flood_route_trigger = {
	is_commission_route = no
	has_trader = yes
	save_temporary_scope_as = tgf_flood_route_temp
	any_trade_market_on_route = {
		gdp_tgf_flood_market_trigger = { ROUTE = scope:tgf_flood_route_temp }
	}
}

# Flooded Market
gdp_trade_good_flavor.1047 = {
	type = character_event
	title = gdp_trade_good_flavor.1047.t
	desc = gdp_trade_good_flavor.1047.desc
	theme = trade
	override_background = { reference = market_crowd }

	left_portrait = {
		character = scope:tgf_trader
		animation = arguing
		camera = camera_event_very_left
	}
	right_portrait = {
		character = scope:tgf_rival
		triggered_animation = {
			trigger = { exists = scope:tgf_good }
			scripted_animation = gdp_tgf_good_animation
		}
		animation = merchant_box
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 15 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_flood_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_flood_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			trader = { save_scope_as = tgf_trader }
			random_trade_market_on_route = {
				limit = { gdp_tgf_flood_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					save_temporary_scope_as = tgf_flood_good_temp
					scope:tgf_route = {
						is_selling_trade_good_in_market = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_flood_good_temp
						}
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			random_potential_trade_rival_in_market = {
				target = root
				limit = { gdp_tgf_auction_rival_trigger = yes }
				save_scope_as = tgf_rival
			}
			trade_market_owner = {
				title_province = {
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		scope:tgf_rival = {
			random_held_title = {
				limit = { gdp_merchant_company_title_trigger = yes }
				save_scope_as = tgf_rival_company
			}
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		gdp_tgf_set_background_location_effect = {
			CHAR = scope:tgf_trader
			PROVINCE = scope:tgf_market.trade_market_owner.title_province
		}
	}

	option = {
		name = gdp_trade_good_flavor.1047.a
		trigger = { short_term_gold >= medium_gold_value }
		show_as_unavailable = { always = yes }
		remove_short_term_gold = medium_gold_value
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = 0.03 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		gdp_tgf_add_tiered_character_modifier_effect = {
			MODIFIER = gdp_tgf_price_war
			YEARS = 10
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1047.b
		add_prestige = minor_prestige_gain
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good
				value = -0.005
				years = 10
			}
		}
		stress_impact = {
			impatient = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = impatient factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = trade good a book could be packed in
scripted_trigger gdp_tgf_manuscript_good_trigger = {
	gdp_tgf_not_livestock_good_trigger = yes
	NOT = { any_trade_category = { this = trade_good_category:trade_category_alcohol } }
	NOR = {
		this = trade_good_type:trade_good_oil
		this = trade_good_type:trade_good_honey
		this = trade_good_type:trade_good_books_paper
		this = trade_good_type:trade_good_stone
		this = trade_good_type:trade_good_wood
	}
}

# this = trade market far from root's domicile with a stranger holder, where $ROUTE$ buys a packable good
scripted_trigger gdp_tgf_manuscript_market_trigger = {
	save_temporary_scope_as = tgf_manuscript_market_temp
	exists = trade_market_owner.title_province.county
	exists = root.domicile.domicile_location
	gdp_tgf_stranger_holder_market_trigger = yes
	trade_market_owner.title_province = {
		squared_distance = {
			target = root.domicile.domicile_location
			value > squared_distance_medium
		}
	}
	$ROUTE$ = {
		any_traded_good = {
			gdp_tgf_manuscript_good_trigger = yes
			save_temporary_scope_as = tgf_manuscript_good_temp
			$ROUTE$ = {
				is_buying_trade_good_in_market = {
					trade_market = scope:tgf_manuscript_market_temp
					trade_good_type = scope:tgf_manuscript_good_temp
				}
			}
		}
	}
}

# this = trade route with a trader. Expects root = the merchant
scripted_trigger gdp_tgf_manuscript_route_trigger = {
	is_commission_route = no
	has_trader = yes
	save_temporary_scope_as = tgf_manuscript_route_temp
	any_trade_market_on_route = {
		gdp_tgf_manuscript_market_trigger = { ROUTE = scope:tgf_manuscript_route_temp }
	}
}

# Manuscript in a Bale
gdp_trade_good_flavor.1048 = {
	type = character_event
	title = gdp_trade_good_flavor.1048.t
	desc = gdp_trade_good_flavor.1048.desc
	theme = trade
	override_background = { reference = bp1_wine_cellar }

	left_portrait = {
		character = root
		animation = reading
		camera = camera_event_left
	}
	right_portrait = {
		character = scope:tgf_trader
		animation = merchant_box
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 50 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_manuscript_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_manuscript_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			trader = { save_scope_as = tgf_trader }
			random_trade_market_on_route = {
				limit = { gdp_tgf_manuscript_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					gdp_tgf_manuscript_good_trigger = yes
					save_temporary_scope_as = tgf_manuscript_good_temp
					scope:tgf_route = {
						is_buying_trade_good_in_market = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_manuscript_good_temp
						}
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				holder = { save_scope_as = tgf_market_holder }
				title_province = {
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.1048.a
		gdp_tgf_roll_artifact_rarity_effect = { RARITY = random }
		create_artifact = {
			name = gdp_tgf_bale_book_artifact
			description = gdp_tgf_bale_book_artifact_desc
			modifier = artifact_monthly_learning_lifestyle_xp_1_modifier
			type = miscellaneous
			visuals = book
			quality = scope:quality
			wealth = scope:wealth
			save_scope_as = newly_created_artifact
		}
		gdp_tgf_add_artifact_trade_modifiers_effect = yes
		ai_chance = {
			base = 100
			modifier = { has_trait = generous factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1048.b
		add_gold = minor_gold_value
		stress_impact = {
			honest = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = honest factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1048.c
		add_prestige = minor_prestige_gain
		scope:tgf_market_holder = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 15
			}
		}
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = buy_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = -0.005 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = pool character, an elder of root's culture
scripted_trigger gdp_tgf_diaspora_elder_trigger = {
	culture = root.culture
	is_physically_able_adult = yes
	age >= 35
}

# this = market where $ROUTE$ sells, in another culture's county whose pool holds an elder of root's culture
scripted_trigger gdp_tgf_diaspora_market_trigger = {
	gdp_tgf_route_sells_here_trigger = { ROUTE = $ROUTE$ }
	trade_market_owner.title_province = {
		county = {
			NOT = { culture = root.culture }
		}
		save_temporary_scope_as = tgf_diaspora_province_temp
		any_pool_character = {
			province = scope:tgf_diaspora_province_temp
			is_healthy = yes
			gdp_tgf_diaspora_elder_trigger = yes
		}
	}
}

# this = trade route with a trader. Expects root = the merchant
scripted_trigger gdp_tgf_diaspora_route_trigger = {
	is_commission_route = no
	has_trader = yes
	save_temporary_scope_as = tgf_diaspora_route_temp
	any_trade_market_on_route = {
		gdp_tgf_diaspora_market_trigger = { ROUTE = scope:tgf_diaspora_route_temp }
	}
}

# Merchants From Home
gdp_trade_good_flavor.1049 = {
	type = character_event
	title = gdp_trade_good_flavor.1049.t
	desc = gdp_trade_good_flavor.1049.desc
	theme = trade
	override_background = { reference = market_crowd }

	left_portrait = {
		character = scope:tgf_trader
		animation = trade_deal
		camera = camera_event_very_left
	}
	right_portrait = {
		character = scope:tgf_elder
		animation = donkey_standing_baggage
		camera = camera_event_right_forward
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 25 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		exists = house
		any_trade_route = { gdp_tgf_diaspora_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_diaspora_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			trader = { save_scope_as = tgf_trader }
			random_trade_market_on_route = {
				limit = { gdp_tgf_diaspora_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					save_temporary_scope_as = tgf_diaspora_good_temp
					scope:tgf_route = {
						is_selling_trade_good_in_market = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_diaspora_good_temp
						}
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					save_scope_as = tgf_source_province
					county = {
						save_scope_as = tgf_source_county
						culture = { save_scope_as = tgf_source_culture }
					}
				}
			}
		}
		ordered_pool_character = {
			province = scope:tgf_source_province
			limit = {
				gdp_tgf_diaspora_elder_trigger = yes
				is_healthy = yes
			}
			order_by = age
			save_scope_as = tgf_elder
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		gdp_tgf_set_background_location_effect = {
			CHAR = scope:tgf_elder
			PROVINCE = scope:tgf_market.trade_market_owner.title_province
		}
	}

	option = {
		name = gdp_trade_good_flavor.1049.a
		add_prestige = medium_prestige_gain
		scope:tgf_source_culture = {
			change_cultural_acceptance = {
				target = root.culture
				value = minor_cultural_acceptance_gain
				desc = cultural_acceptance_gain_event
			}
		}
		scope:tgf_elder = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 20
			}
		}
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good
				value = -0.01
				years = 10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1049.b
		add_courtier = scope:tgf_elder
		scope:tgf_elder = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 20
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = shy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1049.c
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = 0.01 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		stress_impact = {
			compassionate = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = compassionate factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = pool character, a smuggler worth hiring
scripted_trigger gdp_tgf_smuggler_candidate_trigger = {
	has_no_particular_noble_roots_trigger = yes
	is_physically_able_adult = yes
	intrigue >= 10
}

# this = stranger's market where $ROUTE$ buys a non-livestock good and the pool holds a sly commoner
scripted_trigger gdp_tgf_smuggler_market_trigger = {
	save_temporary_scope_as = tgf_smuggler_market_temp
	exists = trade_market_owner.title_province.county
	gdp_tgf_stranger_holder_market_trigger = yes
	$ROUTE$ = {
		any_traded_good = {
			gdp_tgf_not_livestock_good_trigger = yes
			save_temporary_scope_as = tgf_smuggler_good_temp
			$ROUTE$ = {
				is_buying_trade_good_in_market = {
					trade_market = scope:tgf_smuggler_market_temp
					trade_good_type = scope:tgf_smuggler_good_temp
				}
			}
		}
	}
	trade_market_owner.title_province = {
		save_temporary_scope_as = tgf_smuggler_province_temp
		any_pool_character = {
			province = scope:tgf_smuggler_province_temp
			is_healthy = yes
			gdp_tgf_smuggler_candidate_trigger = yes
		}
	}
}

# this = trade route with a trader. Expects root = the merchant
scripted_trigger gdp_tgf_smuggler_route_trigger = {
	is_commission_route = no
	has_trader = yes
	save_temporary_scope_as = tgf_smuggler_route_temp
	any_trade_market_on_route = {
		gdp_tgf_smuggler_market_trigger = { ROUTE = scope:tgf_smuggler_route_temp }
	}
}

# The Salt Road
gdp_trade_good_flavor.1050 = {
	type = character_event
	title = gdp_trade_good_flavor.1050.t
	desc = gdp_trade_good_flavor.1050.desc
	theme = trade
	override_background = { reference = market }

	left_portrait = {
		character = root
		animation = trade_deal
		camera = camera_event_very_left
	}
	right_portrait = {
		character = scope:tgf_smuggler
		animation = holding_scales
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 25 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_smuggler_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_smuggler_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			trader = { save_scope_as = tgf_trader }
			random_trade_market_on_route = {
				limit = { gdp_tgf_smuggler_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					gdp_tgf_not_livestock_good_trigger = yes
					save_temporary_scope_as = tgf_smuggler_good_temp
					scope:tgf_route = {
						is_buying_trade_good_in_market = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_smuggler_good_temp
						}
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				holder = { save_scope_as = tgf_market_holder }
				title_province = {
					save_scope_as = tgf_source_province
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		ordered_pool_character = {
			province = scope:tgf_source_province
			limit = {
				gdp_tgf_smuggler_candidate_trigger = yes
				is_healthy = yes
			}
			order_by = intrigue
			save_scope_as = tgf_smuggler
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		gdp_tgf_set_background_location_effect = {
			CHAR = scope:tgf_smuggler
			PROVINCE = scope:tgf_market.trade_market_owner.title_province
		}
	}

	option = {
		name = gdp_trade_good_flavor.1050.a
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = buy_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = -0.02 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		random = {
			chance = 25
			send_interface_toast = {
				type = event_toast_effect_bad
				title = gdp_trade_good_flavor.1050.a.toast
				right_icon = scope:tgf_market_holder
				add_prestige = medium_prestige_loss
				scope:tgf_market_holder = {
					add_opinion = {
						target = root
						modifier = annoyed_opinion
						opinion = -15
					}
				}
			}
		}
		stress_impact = {
			honest = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = honest factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1050.b
		scope:tgf_smuggler = {
			death = {
				death_reason = death_chopped_to_pieces
				killer = scope:tgf_market_holder
			}
		}
		scope:tgf_market_holder = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 15
			}
		}
		if = {
			limit = {
				NOT = { has_hook = scope:tgf_market_holder }
			}
			add_hook = {
				type = favor_hook
				target = scope:tgf_market_holder
			}
		}
		stress_impact = {
			compassionate = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.1050.c
		add_courtier = scope:tgf_smuggler
		ai_chance = {
			base = 100
			modifier = { has_trait = paranoid factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# A Heavy Harvest
gdp_trade_good_flavor.2001 = {
	type = character_event
	title = gdp_trade_good_flavor.2001.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:tgf_category = trade_good_category:trade_category_beasts_of_burden }
				desc = gdp_trade_good_flavor.2001.desc.livestock
			}
			desc = gdp_trade_good_flavor.2001.desc
		}
		desc = gdp_trade_good_flavor.2001.desc.outro
	}
	theme = trade
	override_background = { reference = farmland }

	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_horses }
			animation = standing_horse
		}
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_cattle }
			animation = holding_yoke
		}
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_wool }
			animation = shepherd_with_sheep
		}
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_wine }
			animation = drink_goblet
		}
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_oil }
			animation = lantern
		}
		triggered_animation = {
			trigger = { OR = { scope:tgf_good = trade_good_type:trade_good_rice scope:tgf_good = trade_good_type:trade_good_fruit scope:tgf_good = trade_good_type:trade_good_sugar } }
			animation = serving_tray
		}
		triggered_animation = {
			trigger = { OR = { scope:tgf_good = trade_good_type:trade_good_grain scope:tgf_good = trade_good_type:trade_good_millet } }
			animation = holding_scales
		}
		animation = happiness
		camera = camera_event_left
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 25 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = {
			gdp_tgf_category_buy_route_trigger = { CATEGORY = trade_category_farmed_goods }
		}
	}

	immediate = {
		random_trade_route = {
			limit = {
				gdp_tgf_category_buy_route_trigger = { CATEGORY = trade_category_farmed_goods }
			}
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = {
					gdp_tgf_category_buy_market_trigger = {
						ROUTE = scope:tgf_route
						CATEGORY = trade_category_farmed_goods
					}
				}
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					any_trade_category = { this = trade_good_category:trade_category_farmed_goods }
					save_temporary_scope_as = tgf_catbuy_good_temp
					scope:tgf_route = {
						is_buying_trade_good_in_market = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_catbuy_good_temp
						}
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					county = {
						save_scope_as = tgf_source_county
						culture = { save_scope_as = tgf_source_culture }
					}
				}
			}
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.2001.a
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = buy_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = -0.03 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = generous factor = 0 }
		}
	}

	option = {
		name = {
			trigger = { NOT = { scope:tgf_category = trade_good_category:trade_category_beasts_of_burden } }
			text = gdp_trade_good_flavor.2001.b
		}
		name = {
			trigger = { scope:tgf_category = trade_good_category:trade_category_beasts_of_burden }
			text = gdp_trade_good_flavor.2001.b.livestock
		}
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_massive_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = impatient factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# The Hunter's Haul
gdp_trade_good_flavor.2002 = {
	type = character_event
	title = gdp_trade_good_flavor.2002.t
	desc = gdp_trade_good_flavor.2002.desc
	theme = trade
	override_background = { reference = wilderness }

	left_portrait = {
		character = root
		animation = betting
		camera = camera_event_center
	}
	right_portrait = {
		character = scope:tgf_trader
		triggered_animation = {
			trigger = { exists = scope:tgf_good }
			scripted_animation = gdp_tgf_good_animation
		}
		animation = merchant_box
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 25 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = {
			has_trader = yes
			gdp_tgf_category_buy_route_trigger = { CATEGORY = trade_category_forest_goods }
		}
	}

	immediate = {
		random_trade_route = {
			limit = {
				has_trader = yes
				gdp_tgf_category_buy_route_trigger = { CATEGORY = trade_category_forest_goods }
			}
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			trader = { save_scope_as = tgf_trader }
			random_trade_market_on_route = {
				limit = {
					gdp_tgf_category_buy_market_trigger = {
						ROUTE = scope:tgf_route
						CATEGORY = trade_category_forest_goods
					}
				}
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					any_trade_category = { this = trade_good_category:trade_category_forest_goods }
					save_temporary_scope_as = tgf_catbuy_good_temp
					scope:tgf_route = {
						is_buying_trade_good_in_market = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_catbuy_good_temp
						}
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		gdp_tgf_set_background_location_effect = {
			CHAR = scope:tgf_trader
			PROVINCE = scope:tgf_market.trade_market_owner.title_province
		}
	}

	option = {
		name = gdp_trade_good_flavor.2002.a
		add_gold = minor_gold_value
		add_trade_good_price_modifier = {
			type = sell_mult
			trade_good_type = scope:tgf_good
			value = { value = 0.02 multiply = gdp_tgf_renown_tier_value }
			years = 10
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = generous factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.2002.b
		trigger = {
			NOT = { has_character_flag = gdp_tgf_kept_haul_curio }
		}
		add_character_flag = gdp_tgf_kept_haul_curio
		gdp_tgf_create_study_curio_effect = yes
		ai_chance = {
			base = 100
			modifier = { has_trait = humble factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.2002.c
		scope:tgf_source_county = {
			if = {
				limit = { gdp_tgf_county_held_by_root_or_ai_trigger = yes }
				gdp_tgf_add_tiered_county_modifier_effect = {
					MODIFIER = gdp_tgf_plentiful_stalls
					YEARS = 10
				}
			}
		}
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = buy_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = -0.03 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# A Rich Vein
gdp_trade_good_flavor.2003 = {
	type = character_event
	title = gdp_trade_good_flavor.2003.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:tgf_good = trade_good_type:trade_good_amber }
				desc = gdp_trade_good_flavor.2003.desc.amber
			}
			desc = gdp_trade_good_flavor.2003.desc
		}
	}
	theme = trade

	left_portrait = {
		character = root
		animation = interested
		camera = camera_event_very_left
	}
	right_portrait = {
		character = scope:tgf_trader
		animation = merchant_box
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 25 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = {
			has_trader = yes
			gdp_tgf_category_buy_route_trigger = { CATEGORY = trade_category_minerals }
		}
	}

	immediate = {
		random_trade_route = {
			limit = {
				has_trader = yes
				gdp_tgf_category_buy_route_trigger = { CATEGORY = trade_category_minerals }
			}
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			trader = { save_scope_as = tgf_trader }
			random_trade_market_on_route = {
				limit = {
					gdp_tgf_category_buy_market_trigger = {
						ROUTE = scope:tgf_route
						CATEGORY = trade_category_minerals
					}
				}
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					any_trade_category = { this = trade_good_category:trade_category_minerals }
					save_temporary_scope_as = tgf_catbuy_good_temp
					scope:tgf_route = {
						is_buying_trade_good_in_market = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_catbuy_good_temp
						}
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = {
			trigger = { NOT = { scope:tgf_good = trade_good_type:trade_good_amber } }
			text = gdp_trade_good_flavor.2003.a
		}
		name = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_amber }
			text = gdp_trade_good_flavor.2003.a.amber
		}
		remove_short_term_gold = minor_gold_value
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = buy_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = -0.02 multiply = gdp_tgf_renown_tier_value }
				years = 12
			}
		}
		scope:tgf_source_county = {
			if = {
				limit = { gdp_tgf_county_held_by_root_or_ai_trigger = yes }
				gdp_tgf_add_tiered_county_modifier_effect = {
					MODIFIER = gdp_tgf_vein_share
					YEARS = 12
				}
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = content factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.2003.b
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = buy_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = -0.01 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = ambitious factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# Worth Its Secret
gdp_trade_good_flavor.2004 = {
	type = character_event
	title = gdp_trade_good_flavor.2004.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:tgf_good = trade_good_type:trade_good_ceramics }
				desc = gdp_trade_good_flavor.2004.desc.ceramics
			}
			desc = gdp_trade_good_flavor.2004.desc
		}
		desc = gdp_trade_good_flavor.2004.desc.outro
	}
	theme = trade
	override_background = {
		trigger = {
			OR = {
				scope:tgf_category = trade_good_category:trade_category_base_metals
				scope:tgf_category = trade_good_category:trade_category_precious_metals
				scope:tgf_good = trade_good_type:trade_good_jewelry
				scope:tgf_good = trade_good_type:trade_good_glass
			}
		}
		reference = gdp_smithy_workshop
	}
	override_background = {
		trigger = {
			OR = {
				scope:tgf_good = trade_good_type:trade_good_leather
				scope:tgf_good = trade_good_type:trade_good_furs
				scope:tgf_good = trade_good_type:trade_good_dyes
			}
		}
		reference = gdp_tannery
	}
	override_background = {
		trigger = {
			OR = {
				scope:tgf_good = trade_good_type:trade_good_wood
				scope:tgf_good = trade_good_type:trade_good_lacquerware
			}
		}
		reference = gdp_carpentry_workshop
	}
	override_background = { reference = gdp_artisan_street }

	left_portrait = {
		character = root
		animation = trade_deal
		camera = camera_event_very_left
	}
	right_portrait = {
		character = scope:tgf_trader
		triggered_animation = {
			trigger = { exists = scope:tgf_good }
			scripted_animation = gdp_tgf_good_animation
		}
		animation = merchant_box
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 25 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = {
			has_trader = yes
			gdp_tgf_category_buy_route_trigger = { CATEGORY = trade_category_artisanal_goods }
		}
	}

	immediate = {
		random_trade_route = {
			limit = {
				has_trader = yes
				gdp_tgf_category_buy_route_trigger = { CATEGORY = trade_category_artisanal_goods }
			}
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			trader = { save_scope_as = tgf_trader }
			random_trade_market_on_route = {
				limit = {
					gdp_tgf_category_buy_market_trigger = {
						ROUTE = scope:tgf_route
						CATEGORY = trade_category_artisanal_goods
					}
				}
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					any_trade_category = { this = trade_good_category:trade_category_artisanal_goods }
					save_temporary_scope_as = tgf_catbuy_good_temp
					scope:tgf_route = {
						is_buying_trade_good_in_market = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_catbuy_good_temp
						}
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		gdp_tgf_set_background_location_effect = {
			CHAR = scope:tgf_trader
			PROVINCE = scope:tgf_market.trade_market_owner.title_province
		}
	}

	option = {
		name = gdp_trade_good_flavor.2004.a
		remove_short_term_gold = minor_gold_value
		add_prestige = medium_prestige_gain
		add_trade_good_price_modifier = {
			type = sell_mult
			trade_good_type = scope:tgf_good
			value = { value = 0.02 multiply = gdp_tgf_renown_tier_value }
			years = 10
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = content factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.2004.b
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_minor_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = ambitious factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# A Matter of Taste
gdp_trade_good_flavor.2005 = {
	type = character_event
	title = gdp_trade_good_flavor.2005.t
	desc = gdp_trade_good_flavor.2005.desc
	theme = merchant
	override_background = { reference = bp1_kitchen_western }

	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { scope:tgf_good = trade_good_type:trade_good_tea }
			animation = drink
		}
		animation = eating
		camera = camera_event_left
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 25 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = {
			gdp_tgf_category_sell_route_trigger = { CATEGORY = trade_category_comforts }
		}
		NOR = {
			has_trait = temperate
			has_trait = inappetetic
		}
	}

	immediate = {
		random_trade_route = {
			limit = {
				gdp_tgf_category_sell_route_trigger = { CATEGORY = trade_category_comforts }
			}
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = {
					gdp_tgf_category_sell_market_trigger = {
						ROUTE = scope:tgf_route
						CATEGORY = trade_category_comforts
					}
				}
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					any_trade_category = { this = trade_good_category:trade_category_comforts }
					save_temporary_scope_as = tgf_catsell_good_temp
					scope:tgf_route = {
						is_selling_trade_good_in_market = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_catsell_good_temp
						}
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					county = {
						save_scope_as = tgf_source_county
						culture = { save_scope_as = tgf_source_culture }
					}
				}
			}
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.2005.a
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = 0.03 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = content factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.2005.b
		add_stress = medium_stress_loss
		hidden_effect = {
			change_current_weight = 25
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = temperate factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = trade good worn as a cloak in Dress the Part
scripted_trigger gdp_tgf_dress_good_trigger = {
	OR = {
		any_trade_category = { this = trade_good_category:trade_category_clothes }
		this = trade_good_type:trade_good_silk
	}
}

# this = trade market where $ROUTE$ sells a cloak good
scripted_trigger gdp_tgf_dress_market_trigger = {
	save_temporary_scope_as = tgf_dress_market_temp
	exists = trade_market_owner.title_province.county
	$ROUTE$ = {
		any_traded_good = {
			gdp_tgf_dress_good_trigger = yes
			save_temporary_scope_as = tgf_dress_good_temp
			$ROUTE$ = {
				is_selling_trade_good_in_market = {
					trade_market = scope:tgf_dress_market_temp
					trade_good_type = scope:tgf_dress_good_temp
				}
			}
		}
	}
}

# this = trade route that sells a cloak good in one of its markets
scripted_trigger gdp_tgf_dress_route_trigger = {
	is_commission_route = no
	save_temporary_scope_as = tgf_dress_route_temp
	any_trade_market_on_route = {
		gdp_tgf_dress_market_trigger = { ROUTE = scope:tgf_dress_route_temp }
	}
}

scripted_effect gdp_tgf_dress_off_effect = {
	remove_character_flag = tgf_dress_furs
	remove_character_flag = tgf_dress_leather
	remove_character_flag = tgf_dress_textiles
	remove_character_flag = tgf_dress_silk
}

# Dress the Part
gdp_trade_good_flavor.2006 = {
	type = character_event
	title = gdp_trade_good_flavor.2006.t
	desc = gdp_trade_good_flavor.2006.desc
	theme = trade
	override_background = { reference = market }

	left_portrait = {
		character = root
		animation = royal_wave
		camera = camera_event_left
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 25 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_dress_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_dress_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = { gdp_tgf_dress_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					gdp_tgf_dress_good_trigger = yes
					save_temporary_scope_as = tgf_catsell_good_temp
					scope:tgf_route = {
						is_selling_trade_good_in_market = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_catsell_good_temp
						}
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		gdp_tgf_dress_off_effect = yes
		if = {
			limit = { scope:tgf_good = trade_good_type:trade_good_furs }
			add_character_flag = tgf_dress_furs
		}
		else_if = {
			limit = { scope:tgf_good = trade_good_type:trade_good_leather }
			add_character_flag = tgf_dress_leather
		}
		else_if = {
			limit = { scope:tgf_good = trade_good_type:trade_good_silk }
			add_character_flag = tgf_dress_silk
		}
		else = {
			add_character_flag = tgf_dress_textiles
		}
		gdp_tgf_set_background_location_effect = {
			CHAR = root
			PROVINCE = scope:tgf_market.trade_market_owner.title_province
		}
	}

	option = {
		name = gdp_trade_good_flavor.2006.a
		add_prestige = medium_prestige_gain
		if = {
			limit = { scope:tgf_good = trade_good_type:trade_good_furs }
			custom_tooltip = gdp_trade_good_flavor.2006.a.tt_furs
		}
		else_if = {
			limit = { scope:tgf_good = trade_good_type:trade_good_leather }
			custom_tooltip = gdp_trade_good_flavor.2006.a.tt_leather
		}
		else_if = {
			limit = { scope:tgf_good = trade_good_type:trade_good_silk }
			custom_tooltip = gdp_trade_good_flavor.2006.a.tt_silk
		}
		else = {
			custom_tooltip = gdp_trade_good_flavor.2006.a.tt_textiles
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = humble factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.2006.b
		hidden_effect = { gdp_tgf_dress_off_effect = yes }
		add_trade_good_price_modifier = {
			type = sell_mult
			trade_good_type = scope:tgf_good
			value = { value = 0.015 multiply = gdp_tgf_renown_tier_value }
			years = 10
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = arrogant factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = trade route where a stranger's market buys $CATEGORY$ goods from it
scripted_trigger gdp_tgf_category_sell_holder_route_trigger = {
	is_commission_route = no
	save_temporary_scope_as = tgf_catsell_route_temp
	any_trade_market_on_route = {
		gdp_tgf_category_sell_holder_market_trigger = {
			ROUTE = scope:tgf_catsell_route_temp
			CATEGORY = $CATEGORY$
		}
	}
}

# Face Value
gdp_trade_good_flavor.2007 = {
	type = character_event
	title = gdp_trade_good_flavor.2007.t
	desc = gdp_trade_good_flavor.2007.desc
	theme = trade
	override_background = { reference = gdp_smithy_workshop }

	left_portrait = {
		character = root
		animation = merchant_box
		camera = camera_event_left
	}
	right_portrait = {
		character = scope:tgf_market_holder
		animation = biting_coin
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	trigger = {
		NOT = { has_character_flag = gdp_tgf_had_event_2007 }
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = {
			gdp_tgf_category_sell_holder_route_trigger = { CATEGORY = trade_category_precious_metals }
		}
	}

	immediate = {
		save_scope_as = tgf_coin_merchant
		add_character_flag = gdp_tgf_had_event_2007
		random_trade_route = {
			limit = {
				gdp_tgf_category_sell_holder_route_trigger = { CATEGORY = trade_category_precious_metals }
			}
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = {
					gdp_tgf_category_sell_holder_market_trigger = {
						ROUTE = scope:tgf_route
						CATEGORY = trade_category_precious_metals
					}
				}
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					any_trade_category = { this = trade_good_category:trade_category_precious_metals }
					save_temporary_scope_as = tgf_catsell_good_temp
					scope:tgf_route = {
						is_selling_trade_good_in_market = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_catsell_good_temp
						}
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				holder = { save_scope_as = tgf_market_holder }
				title_province = {
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.2007.a
		add_prestige = medium_prestige_gain
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good
				value = -0.01
				years = 10
			}
		}
		scope:tgf_market_holder = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 20
			}
		}
		gdp_tgf_roll_artifact_rarity_effect = { RARITY = random }
		create_artifact = {
			name = gdp_tgf_coin_artifact
			description = gdp_tgf_coin_artifact_desc
			type = curio
			modifier = artifact_monthly_prestige_1_modifier
			visuals = medallion
			quality = scope:quality
			wealth = scope:wealth
			save_scope_as = newly_created_artifact
		}
		gdp_tgf_add_artifact_trade_modifiers_effect = yes
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.2007.b
		scope:tgf_market_holder = {
			add_opinion = {
				target = root
				modifier = annoyed_opinion
				opinion = -20
			}
		}
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = 0.02 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = generous factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.2007.c
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_medium_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = humble factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# Adds Careful Handling for scope:tgf_category
scripted_effect gdp_tgf_add_careful_handling_effect = {
	if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_alcohol }
		add_character_modifier = {
			modifier = gdp_tgf_careful_handling_alcohol_modifier
			years = 25
		}
	}
	else_if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_comforts }
		add_character_modifier = {
			modifier = gdp_tgf_careful_handling_comforts_modifier
			years = 25
		}
	}
	else_if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_cereals }
		add_character_modifier = {
			modifier = gdp_tgf_careful_handling_cereals_modifier
			years = 25
		}
	}
	else_if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_meat }
		add_character_modifier = {
			modifier = gdp_tgf_careful_handling_meat_modifier
			years = 25
		}
	}
	else_if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_beasts_of_burden }
		add_character_modifier = {
			modifier = gdp_tgf_careful_handling_beasts_of_burden_modifier
			years = 25
		}
	}
	else_if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_salt }
		add_character_modifier = {
			modifier = gdp_tgf_careful_handling_salt_modifier
			years = 25
		}
	}
	else_if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_clothes }
		add_character_modifier = {
			modifier = gdp_tgf_careful_handling_clothes_modifier
			years = 25
		}
	}
	else_if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_fabrics }
		add_character_modifier = {
			modifier = gdp_tgf_careful_handling_fabrics_modifier
			years = 25
		}
	}
	else_if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_dyes }
		add_character_modifier = {
			modifier = gdp_tgf_careful_handling_dyes_modifier
			years = 25
		}
	}
	else_if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_alum }
		add_character_modifier = {
			modifier = gdp_tgf_careful_handling_alum_modifier
			years = 25
		}
	}
	else_if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_stone }
		add_character_modifier = {
			modifier = gdp_tgf_careful_handling_stone_modifier
			years = 25
		}
	}
	else_if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_carpentry_supplies }
		add_character_modifier = {
			modifier = gdp_tgf_careful_handling_carpentry_supplies_modifier
			years = 25
		}
	}
	else_if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_base_metals }
		add_character_modifier = {
			modifier = gdp_tgf_careful_handling_base_metals_modifier
			years = 25
		}
	}
	else_if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_luxury_items }
		add_character_modifier = {
			modifier = gdp_tgf_careful_handling_luxury_items_modifier
			years = 25
		}
	}
	else_if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_jewelry_materials }
		add_character_modifier = {
			modifier = gdp_tgf_careful_handling_jewelry_materials_modifier
			years = 25
		}
	}
	else_if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_precious_metals }
		add_character_modifier = {
			modifier = gdp_tgf_careful_handling_precious_metals_modifier
			years = 25
		}
	}
	else_if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_medicaments }
		add_character_modifier = {
			modifier = gdp_tgf_careful_handling_medicaments_modifier
			years = 25
		}
	}
	else_if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_incense }
		add_character_modifier = {
			modifier = gdp_tgf_careful_handling_incense_modifier
			years = 25
		}
	}
	else_if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_luxury_consumption }
		add_character_modifier = {
			modifier = gdp_tgf_careful_handling_luxury_consumption_modifier
			years = 25
		}
	}
	else_if = {
		limit = { scope:tgf_category = trade_good_category:trade_category_books }
		add_character_modifier = {
			modifier = gdp_tgf_careful_handling_books_modifier
			years = 25
		}
	}
}

# Intact
gdp_trade_good_flavor.2008 = {
	type = character_event
	title = gdp_trade_good_flavor.2008.t
	desc = gdp_trade_good_flavor.2008.desc
	theme = merchant
	override_background = { reference = bp1_wine_cellar }

	left_portrait = {
		character = root
		animation = happiness
		camera = camera_event_left
	}
	right_portrait = {
		character = scope:tgf_trader
		triggered_animation = {
			trigger = { exists = scope:tgf_good }
			scripted_animation = gdp_tgf_good_animation
		}
		animation = merchant_box
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 25 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = {
			is_commission_route = no
			has_trader = yes
			any_traded_good = { is_breakable_trade_good_trigger = { TRADE_GOOD = this } }
		}
	}

	immediate = {
		random_trade_route = {
			limit = {
				is_commission_route = no
				has_trader = yes
				any_traded_good = { is_breakable_trade_good_trigger = { TRADE_GOOD = this } }
			}
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			trader = { save_scope_as = tgf_trader }
			random_traded_good = {
				limit = { is_breakable_trade_good_trigger = { TRADE_GOOD = this } }
				save_scope_as = tgf_good
			}
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.2008.a
		gdp_tgf_add_careful_handling_effect = yes
		ai_chance = {
			base = 100
			modifier = { has_trait = lazy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.2008.b
		scope:tgf_trader = {
			add_stewardship_skill = 2
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 20
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.2008.c
		add_trade_good_price_modifier = {
			type = sell_mult
			trade_good_type = scope:tgf_good
			value = { value = 0.01 multiply = gdp_tgf_renown_tier_value }
			years = 10
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = generous factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = trade good used to supply a war
scripted_trigger gdp_tgf_war_good_trigger = {
	OR = {
		trade_good_need_category = { this = trade_good_category:trade_category_base_metals }
		trade_good_need_category = { this = trade_good_category:trade_category_beasts_of_burden }
		trade_good_need_category = { this = trade_good_category:trade_category_carpentry_supplies }
	}
}

# this = trade market with a valid stranger holder at war, where $ROUTE$ sells a war-supply good
scripted_trigger gdp_tgf_war_market_trigger = {
	save_temporary_scope_as = tgf_war_market_temp
	exists = trade_market_owner.title_province.county
	gdp_tgf_stranger_holder_market_trigger = yes
	trade_market_owner.holder = { is_at_war = yes }
	$ROUTE$ = {
		any_traded_good = {
			gdp_tgf_war_good_trigger = yes
			save_temporary_scope_as = tgf_war_good_temp
			$ROUTE$ = {
				is_selling_trade_good_in_market = {
					trade_market = scope:tgf_war_market_temp
					trade_good_type = scope:tgf_war_good_temp
				}
			}
		}
	}
}

# this = trade route where a warring stranger's market buys its war-supply goods
scripted_trigger gdp_tgf_war_route_trigger = {
	is_commission_route = no
	save_temporary_scope_as = tgf_war_route_temp
	any_trade_market_on_route = {
		gdp_tgf_war_market_trigger = { ROUTE = scope:tgf_war_route_temp }
	}
}

# Other Men See Armies
gdp_trade_good_flavor.2009 = {
	type = character_event
	title = gdp_trade_good_flavor.2009.t
	desc = gdp_trade_good_flavor.2009.desc
	theme = trade
	override_background = { reference = army_camp }

	left_portrait = {
		character = root
		animation = biting_coin
		camera = camera_event_left_to_the_left
	}
	right_portrait = {
		character = scope:tgf_market_holder
		animation = inspect_weapon
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 25 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_war_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_war_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = { gdp_tgf_war_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					gdp_tgf_war_good_trigger = yes
					save_temporary_scope_as = tgf_war_good_temp
					scope:tgf_route = {
						is_selling_trade_good_in_market = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_war_good_temp
						}
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				holder = { save_scope_as = tgf_market_holder }
				title_province = {
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.2009.a
		trigger = {
			is_ai = no
			scope:tgf_market_holder = { short_term_gold >= minor_gold_value }
		}
		show_as_unavailable = { always = yes }
		scope:tgf_market_holder = {
			pay_short_term_gold = {
				target = root
				gold = minor_gold_value
			}
			gdp_tgf_add_tiered_character_modifier_effect = {
				MODIFIER = gdp_tgf_well_supplied_host
				YEARS = 10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = compassionate factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.2009.b
		add_prestige = minor_prestige_gain
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = 0.02 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		scope:tgf_market_holder = {
			gdp_tgf_add_tiered_character_modifier_effect = {
				MODIFIER = gdp_tgf_well_supplied_host
				YEARS = 10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = humble factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.2009.c
		trigger = {
			NOT = { has_hook = scope:tgf_market_holder }
		}
		add_hook = {
			type = favor_hook
			target = scope:tgf_market_holder
		}
		scope:tgf_market_holder = {
			gdp_tgf_add_tiered_character_modifier_effect = {
				MODIFIER = gdp_tgf_well_supplied_host
				YEARS = 10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = honest factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# The Guild Knocks
gdp_trade_good_flavor.2010 = {
	type = character_event
	title = gdp_trade_good_flavor.2010.t
	desc = gdp_trade_good_flavor.2010.desc
	theme = merchant
	override_background = { reference = gdp_artisan_street }

	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				scope:tgf_market.trade_market_owner.title_province ?= {
					OR = { arid_region_trigger = yes terrain = desert terrain = desert_mountains terrain = drylands terrain = oasis }
				}
			}
			animation = dromedary_holding
		}
		triggered_animation = {
			trigger = { scope:tgf_market.trade_market_owner.title_province ?= { terrain = steppe } }
			animation = standing_horse
		}
		animation = donkey_standing_baggage
		camera = camera_event_left
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 25 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = {
			gdp_tgf_category_sell_route_trigger = { CATEGORY = trade_category_guild_goods }
		}
	}

	immediate = {
		random_trade_route = {
			limit = {
				gdp_tgf_category_sell_route_trigger = { CATEGORY = trade_category_guild_goods }
			}
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = {
					gdp_tgf_category_sell_market_trigger = {
						ROUTE = scope:tgf_route
						CATEGORY = trade_category_guild_goods
					}
				}
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					any_trade_category = { this = trade_good_category:trade_category_guild_goods }
					save_temporary_scope_as = tgf_catsell_good_temp
					scope:tgf_route = {
						is_selling_trade_good_in_market = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_catsell_good_temp
						}
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					county = {
						save_scope_as = tgf_source_county
						culture = { save_scope_as = tgf_source_culture }
					}
				}
			}
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		gdp_tgf_set_background_location_effect = {
			CHAR = root
			PROVINCE = scope:tgf_market.trade_market_owner.title_province
		}
	}

	option = {
		name = gdp_trade_good_flavor.2010.a
		remove_short_term_gold = miniscule_gold_value
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = 0.02 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = stubborn factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.2010.b
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = buy_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = 0.005 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		add_prestige = minor_prestige_gain
		ai_chance = {
			base = 100
			modifier = { has_trait = content factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = trade good worn as a luxury
scripted_trigger gdp_tgf_wearable_good_trigger = {
	OR = {
		this = trade_good_type:trade_good_silk
		this = trade_good_type:trade_good_jewelry
		this = trade_good_type:trade_good_gems
		this = trade_good_type:trade_good_amber
		this = trade_good_type:trade_good_jade
		this = trade_good_type:trade_good_ivory
	}
}

# this = trade market with a valid stranger holder, where $ROUTE$ sells a wearable luxury
scripted_trigger gdp_tgf_worn_market_trigger = {
	save_temporary_scope_as = tgf_worn_market_temp
	exists = trade_market_owner.title_province.county
	gdp_tgf_stranger_holder_market_trigger = yes
	trade_market_owner.holder = {
		has_any_illness = no
	}
	$ROUTE$ = {
		any_traded_good = {
			gdp_tgf_wearable_good_trigger = yes
			save_temporary_scope_as = tgf_worn_good_temp
			$ROUTE$ = {
				is_selling_trade_good_in_market = {
					trade_market = scope:tgf_worn_market_temp
					trade_good_type = scope:tgf_worn_good_temp
				}
			}
		}
	}
}

# this = trade route where a stranger's market buys its wearable luxuries
scripted_trigger gdp_tgf_worn_route_trigger = {
	is_commission_route = no
	save_temporary_scope_as = tgf_worn_route_temp
	any_trade_market_on_route = {
		gdp_tgf_worn_market_trigger = { ROUTE = scope:tgf_worn_route_temp }
	}
}

# this = the ruler now seen wearing scope:tgf_good
scripted_effect gdp_tgf_wear_finery_effect = {
	if = {
		limit = { scope:tgf_good = trade_good_type:trade_good_silk }
		add_character_modifier = {
			modifier = gdp_tgf_silk_clad_modifier
			years = 5
		}
	}
	else = {
		add_character_modifier = {
			modifier = gdp_tgf_bejeweled_modifier
			years = 5
		}
	}
}

# Rulers Set Fashions
gdp_trade_good_flavor.2011 = {
	type = character_event
	title = gdp_trade_good_flavor.2011.t
	desc = gdp_trade_good_flavor.2011.desc
	theme = trade
	override_background = { reference = throne_room_scope }

	left_portrait = {
		character = scope:tgf_market_holder
		animation = royal_wave
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			highest_traded_good_category_xp_level >= gdp_tgf_renowned_expertise_level_value
		}
	}

	cooldown = { years = 25 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_worn_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_worn_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = { gdp_tgf_worn_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					gdp_tgf_wearable_good_trigger = yes
					save_temporary_scope_as = tgf_worn_good_temp
					scope:tgf_route = {
						is_selling_trade_good_in_market = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_worn_good_temp
						}
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				holder = {
					save_scope_as = tgf_market_holder
					save_scope_as = background_throne_room_scope
				}
				title_province = {
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.2011.a
		add_prestige = minor_prestige_gain
		add_character_modifier = {
			modifier = gdp_tgf_renowned_dealer_modifier
			years = 10
		}
		scope:tgf_market_holder = { gdp_tgf_wear_finery_effect = yes }
		ai_chance = {
			base = 100
			modifier = { has_trait = humble factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.2011.b
		scope:tgf_market_holder = { gdp_tgf_wear_finery_effect = yes }
		add_trade_good_price_modifier = {
			type = sell_mult
			trade_good_type = scope:tgf_good
			value = { value = 0.02 multiply = gdp_tgf_renown_tier_value }
			years = 10
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = generous factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# Sample the Goods
gdp_trade_good_flavor.2012 = {
	type = character_event
	title = gdp_trade_good_flavor.2012.t
	desc = gdp_trade_good_flavor.2012.desc
	theme = merchant
	override_background = { reference = bp1_wine_cellar }

	left_portrait = {
		character = root
		animation = wedding_drunk
		camera = camera_torso
	}

	widgets = {
		widget = { gui = event_window_widget_vfx_background_double_vision_milder container = foreground_shader_vfx_container }
		widget = { gui = event_window_widget_vfx_left_character_double_vision_milder container = foreground_shader_vfx_container }
		widget = {
			gui = "event_window_widget_trade_good"
			container = "custom_widgets_container"
		}
	}

	cooldown = { years = 25 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		is_adult = yes
		stress >= 1
		NOT = { has_trait = drunkard }
		any_trade_route = {
			is_commission_route = no
			any_traded_good = {
				any_trade_category = { this = trade_good_category:trade_category_alcohol }
			}
		}
	}

	immediate = {
		random_trade_route = {
			limit = {
				is_commission_route = no
				any_traded_good = {
					any_trade_category = { this = trade_good_category:trade_category_alcohol }
				}
			}
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_traded_good = {
				limit = {
					any_trade_category = { this = trade_good_category:trade_category_alcohol }
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.2012.a
		add_stress = massive_stress_loss
		random = {
			chance = 5
			send_interface_toast = {
				type = event_toast_effect_bad
				title = gdp_trade_good_flavor.2012.a.toast
				left_icon = root
				add_trait = drunkard
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = temperate factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.2012.b
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_miniscule_value
		}
		stress_impact = {
			temperate = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = trade good worth a master's showpiece
scripted_trigger gdp_tgf_masterwork_good_trigger = {
	OR = {
		trade_good_need_category = { this = trade_good_category:trade_category_luxury_items }
		trade_good_need_category = { this = trade_good_category:trade_category_jewelry_materials }
		trade_good_need_category = { this = trade_good_category:trade_category_precious_metals }
	}
}

# this = trade market where $ROUTE$ trades a masterwork-worthy good and the local pool holds an adult craftsman
scripted_trigger gdp_tgf_masterwork_market_trigger = {
	save_temporary_scope_as = tgf_masterwork_market_temp
	exists = trade_market_owner.title_province.county
	trade_market_owner.title_province = {
		save_temporary_scope_as = tgf_masterwork_province_temp
		any_pool_character = {
			province = scope:tgf_masterwork_province_temp
			is_healthy = yes
			has_no_particular_noble_roots_trigger = yes
			is_physically_able_adult = yes
		}
	}
	$ROUTE$ = {
		any_traded_good = {
			gdp_tgf_masterwork_good_trigger = yes
			save_temporary_scope_as = tgf_masterwork_good_temp
			$ROUTE$ = {
				OR = {
					is_buying_trade_good_in_market = {
						trade_market = scope:tgf_masterwork_market_temp
						trade_good_type = scope:tgf_masterwork_good_temp
					}
					is_selling_trade_good_in_market = {
						trade_market = scope:tgf_masterwork_market_temp
						trade_good_type = scope:tgf_masterwork_good_temp
					}
				}
			}
		}
	}
}

# this = trade route where a market trades its masterwork-worthy goods and has a craftsman in the local pool
scripted_trigger gdp_tgf_masterwork_route_trigger = {
	is_commission_route = no
	save_temporary_scope_as = tgf_masterwork_route_temp
	any_trade_market_on_route = {
		gdp_tgf_masterwork_market_trigger = { ROUTE = scope:tgf_masterwork_route_temp }
	}
}

# A Masterwork Order
gdp_trade_good_flavor.2013 = {
	type = character_event
	title = gdp_trade_good_flavor.2013.t
	desc = gdp_trade_good_flavor.2013.desc
	theme = trade
	override_background = {
		trigger = {
			OR = {
				scope:tgf_category = trade_good_category:trade_category_jewelry_materials
				scope:tgf_category = trade_good_category:trade_category_precious_metals
				scope:tgf_good = trade_good_type:trade_good_jewelry
			}
		}
		reference = gdp_smithy_workshop
	}
	override_background = {
		trigger = {
			OR = {
				scope:tgf_good = trade_good_type:trade_good_leather
				scope:tgf_good = trade_good_type:trade_good_furs
				scope:tgf_good = trade_good_type:trade_good_dyes
			}
		}
		reference = gdp_tannery
	}
	override_background = {
		trigger = {
			OR = {
				scope:tgf_good = trade_good_type:trade_good_wood
				scope:tgf_good = trade_good_type:trade_good_lacquerware
			}
		}
		reference = gdp_carpentry_workshop
	}
	override_background = { reference = gdp_artisan_street }

	left_portrait = {
		character = root
		animation = pondering
		camera = camera_event_very_left
	}
	right_portrait = {
		character = scope:tgf_crafter
		triggered_animation = {
			trigger = { exists = scope:tgf_good }
			scripted_animation = gdp_tgf_good_animation
		}
		animation = merchant_box
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			highest_traded_good_category_xp_level >= gdp_tgf_renowned_expertise_level_value
		}
	}

	trigger = {
		NOT = { has_character_flag = gdp_tgf_had_event_2013 }
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_masterwork_route_trigger = yes }
	}

	immediate = {
		add_character_flag = gdp_tgf_had_event_2013
		random_trade_route = {
			limit = { gdp_tgf_masterwork_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = { gdp_tgf_masterwork_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					gdp_tgf_masterwork_good_trigger = yes
					save_temporary_scope_as = tgf_masterwork_good_temp
					scope:tgf_route = {
						OR = {
							is_buying_trade_good_in_market = {
								trade_market = scope:tgf_market
								trade_good_type = scope:tgf_masterwork_good_temp
							}
							is_selling_trade_good_in_market = {
								trade_market = scope:tgf_market
								trade_good_type = scope:tgf_masterwork_good_temp
							}
						}
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					save_scope_as = tgf_source_province
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		random_pool_character = {
			province = scope:tgf_source_province
			limit = {
				is_healthy = yes
				has_no_particular_noble_roots_trigger = yes
				is_physically_able_adult = yes
			}
			save_scope_as = tgf_crafter
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		gdp_tgf_set_background_location_effect = {
			CHAR = scope:tgf_crafter
			PROVINCE = scope:tgf_market.trade_market_owner.title_province
		}
	}

	option = {
		name = gdp_trade_good_flavor.2013.a
		trigger = { short_term_gold >= medium_gold_value }
		show_as_unavailable = { always = yes }
		add_prestige = medium_prestige_gain
		pay_short_term_gold = {
			target = scope:tgf_crafter
			gold = medium_gold_value
		}
		save_scope_as = tgf_showpiece_merchant
		gdp_tgf_roll_artifact_rarity_effect = { RARITY = random }
		create_artifact = {
			name = gdp_tgf_showpiece_artifact
			description = gdp_tgf_showpiece_artifact_desc
			type = curio
			modifier = artifact_monthly_prestige_2_modifier
			visuals = cabinet_trinket
			quality = scope:quality
			wealth = scope:wealth
			save_scope_as = newly_created_artifact
		}
		gdp_tgf_add_artifact_trade_modifiers_effect = yes
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.2013.b
		add_prestige = minor_prestige_gain
		ai_chance = {
			base = 100
			modifier = { has_trait = arrogant factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = trade route with a trader that sells a food good in a market with a county
scripted_trigger gdp_tgf_dish_route_trigger = {
	is_commission_route = no
	has_trader = yes
	gdp_tgf_category_sell_route_trigger = { CATEGORY = trade_category_food }
}

# Their Dish, Our Goods
gdp_trade_good_flavor.2014 = {
	type = character_event
	title = gdp_trade_good_flavor.2014.t
	desc = gdp_trade_good_flavor.2014.desc
	theme = trade
	override_background = { reference = gdp_artisan_street_crowd }

	left_portrait = {
		character = root
		animation = holding_salami
		camera = camera_event_right
	}
	right_portrait = {
		character = scope:tgf_trader
		animation = eating
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 25 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_dish_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_dish_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			trader = { save_scope_as = tgf_trader }
			random_trade_market_on_route = {
				limit = {
					gdp_tgf_category_sell_market_trigger = {
						ROUTE = scope:tgf_route
						CATEGORY = trade_category_food
					}
				}
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					has_category = trade_good_category:trade_category_food
					save_temporary_scope_as = tgf_dish_good_temp
					scope:tgf_route = {
						is_selling_trade_good_in_market = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_dish_good_temp
						}
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					save_scope_as = tgf_source_province
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		gdp_tgf_set_background_location_effect = {
			CHAR = scope:tgf_trader
			PROVINCE = scope:tgf_market.trade_market_owner.title_province
		}
	}

	option = {
		name = gdp_trade_good_flavor.2014.a
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = 0.02 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_minor_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = generous factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.2014.b
		scope:tgf_route = {
			gdp_tgf_add_tiered_route_modifier_effect = {
				MODIFIER = gdp_tgf_kitchen_demand
				YEARS = 10
			}
		}
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_minor_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = lazy factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = market where $ROUTE$ buys a forest good and the pool holds someone to speak for the gatherers
scripted_trigger gdp_tgf_gatherers_market_trigger = {
	gdp_tgf_category_buy_market_trigger = {
		ROUTE = $ROUTE$
		CATEGORY = trade_category_forest_goods
	}
	trade_market_owner.title_province = {
		save_temporary_scope_as = tgf_gatherers_province_temp
		any_pool_character = {
			province = scope:tgf_gatherers_province_temp
			is_healthy = yes
			is_physically_able_adult = yes
		}
	}
}

# this = trade route
scripted_trigger gdp_tgf_gatherers_route_trigger = {
	is_commission_route = no
	save_temporary_scope_as = tgf_gatherers_route_temp
	any_trade_market_on_route = {
		gdp_tgf_gatherers_market_trigger = { ROUTE = scope:tgf_gatherers_route_temp }
	}
}

# Paid in Goods
gdp_trade_good_flavor.2015 = {
	type = character_event
	title = gdp_trade_good_flavor.2015.t
	desc = gdp_trade_good_flavor.2015.desc
	theme = trade
	override_background = { reference = wilderness }

	left_portrait = {
		character = root
		animation = debating
		camera = camera_event_left
	}
	right_portrait = {
		character = scope:tgf_spokesperson
		animation = arguing
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 25 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_gatherers_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_gatherers_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = { gdp_tgf_gatherers_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					any_trade_category = { this = trade_good_category:trade_category_forest_goods }
					save_temporary_scope_as = tgf_gatherers_good_temp
					scope:tgf_route = {
						is_buying_trade_good_in_market = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_gatherers_good_temp
						}
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					save_scope_as = tgf_source_province
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		random_pool_character = {
			province = scope:tgf_source_province
			limit = {
				is_physically_able_adult = yes
				is_healthy = yes
			}
			save_scope_as = tgf_spokesperson
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		gdp_tgf_set_background_location_effect = {
			CHAR = scope:tgf_spokesperson
			PROVINCE = scope:tgf_market.trade_market_owner.title_province
		}
	}

	option = {
		name = gdp_trade_good_flavor.2015.a
		remove_short_term_gold = minor_gold_value
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_medium_value
		}
		scope:tgf_source_county = {
			if = {
				limit = { gdp_tgf_county_held_by_root_or_ai_trigger = yes }
				gdp_tgf_add_tiered_county_modifier_effect = {
					MODIFIER = gdp_tgf_fair_wages
					YEARS = 10
				}
			}
		}
		scope:tgf_spokesperson = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 15
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.2015.b
		add_prestige = minor_prestige_loss
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = buy_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = -0.01 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		scope:tgf_spokesperson = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = paranoid factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.2015.c
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = buy_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = -0.02 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		scope:tgf_source_county = {
			if = {
				limit = { gdp_tgf_county_held_by_root_or_ai_trigger = yes }
				add_county_modifier = {
					modifier = gdp_tgf_underpaid_gatherers_modifier
					years = 10
				}
			}
		}
		scope:tgf_spokesperson = {
			add_opinion = {
				target = root
				modifier = annoyed_opinion
				opinion = -20
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = generous factor = 0 }
			modifier = { has_trait = compassionate factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = trade good that smells
scripted_trigger gdp_tgf_smelly_good_trigger = {
	OR = {
		this = trade_good_type:trade_good_fish
		this = trade_good_type:trade_good_leather
		this = trade_good_type:trade_good_dyes
		this = trade_good_type:trade_good_cheese
		this = trade_good_type:trade_good_hemp
	}
}

# this = trade market where $ROUTE$ sells a smelly good and the local pool holds a buyer to complain
scripted_trigger gdp_tgf_stink_market_trigger = {
	save_temporary_scope_as = tgf_stink_market_temp
	exists = trade_market_owner.title_province.county
	$ROUTE$ = {
		any_traded_good = {
			gdp_tgf_smelly_good_trigger = yes
			save_temporary_scope_as = tgf_stink_good_temp
			$ROUTE$ = {
				is_selling_trade_good_in_market = {
					trade_market = scope:tgf_stink_market_temp
					trade_good_type = scope:tgf_stink_good_temp
				}
			}
		}
	}
	trade_market_owner.title_province = {
		save_temporary_scope_as = tgf_stink_province_temp
		any_pool_character = {
			province = scope:tgf_stink_province_temp
			is_healthy = yes
			is_physically_able_adult = yes
		}
	}
}

# this = trade route
scripted_trigger gdp_tgf_stink_route_trigger = {
	is_commission_route = no
	save_temporary_scope_as = tgf_stink_route_temp
	any_trade_market_on_route = {
		gdp_tgf_stink_market_trigger = { ROUTE = scope:tgf_stink_route_temp }
	}
}

# Money Doesn't Stink
gdp_trade_good_flavor.2016 = {
	type = character_event
	title = gdp_trade_good_flavor.2016.t
	desc = gdp_trade_good_flavor.2016.desc
	theme = trade
	override_background = { reference = market }
	override_effect_2d = { reference = flies }

	left_portrait = {
		character = root
		animation = biting_coin
		camera = camera_event_left
	}
	right_portrait = {
		character = scope:tgf_buyer
		animation = disgust
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 25 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_stink_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_stink_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = { gdp_tgf_stink_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					gdp_tgf_smelly_good_trigger = yes
					save_temporary_scope_as = tgf_stink_good_temp
					scope:tgf_route = {
						is_selling_trade_good_in_market = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_stink_good_temp
						}
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					save_scope_as = tgf_source_province
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		random_pool_character = {
			province = scope:tgf_source_province
			limit = {
				is_physically_able_adult = yes
				is_healthy = yes
			}
			save_scope_as = tgf_buyer
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		gdp_tgf_set_background_location_effect = {
			CHAR = scope:tgf_buyer
			PROVINCE = scope:tgf_market.trade_market_owner.title_province
		}
	}

	option = {
		name = gdp_trade_good_flavor.2016.a
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_minor_value
		}
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = 0.015 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		if = {
			limit = { can_contract_disease_trigger = { DISEASE = ill } }
			random = {
				chance = 10
				contract_disease_effect = {
					DISEASE = ill
					TREATMENT_EVENT = yes
				}
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = honest factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.2016.b
		remove_short_term_gold = miniscule_gold_value
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_minor_value
		}
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = trade_good_category:trade_category_salt
			VALUE = trade_expertise_xp_massive_value
		}
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = trade_good_category:trade_category_medicaments
			VALUE = trade_expertise_xp_massive_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.2016.c
		add_prestige = minor_prestige_gain
		ai_chance = {
			base = 100
			modifier = { has_trait = arrogant factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# Seven Fat Years
gdp_trade_good_flavor.2017 = {
	type = character_event
	title = gdp_trade_good_flavor.2017.t
	desc = gdp_trade_good_flavor.2017.desc
	theme = merchant
	override_background = { reference = bedchamber }

	left_portrait = {
		character = root
		animation = delirium
		camera = camera_event_left
	}

	widgets = {
		widget = { gui = event_window_widget_vfx_background_night_scene container = foreground_shader_vfx_container }
		widget = { gui = event_window_widget_vfx_left_character_night_scene container = foreground_shader_vfx_container }
		widget = {
			gui = "event_window_widget_trade_good"
			container = "custom_widgets_container"
		}
	}

	cooldown = { years = 25 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_category_buy_route_trigger = { CATEGORY = trade_category_food } }
		NOT = {
			has_character_modifier = gdp_tgf_seven_storehouses_modifier
		}
	}

	immediate = {
		add_character_flag = {
			flag = use_sickness_clothes
			days = 7
		}
		random_trade_route = {
			limit = { gdp_tgf_category_buy_route_trigger = { CATEGORY = trade_category_food } }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = {
					gdp_tgf_category_buy_market_trigger = {
						ROUTE = scope:tgf_route
						CATEGORY = trade_category_food
					}
				}
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					any_trade_category = { this = trade_good_category:trade_category_food }
					save_temporary_scope_as = tgf_storehouse_good_temp
					scope:tgf_route = {
						is_buying_trade_good_in_market = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_storehouse_good_temp
						}
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.2017.a
		remove_short_term_gold = minor_gold_value
		add_character_modifier = gdp_tgf_seven_storehouses_modifier
		ai_chance = {
			base = 100
			modifier = { has_trait = impatient factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.2017.b
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = buy_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = -0.007 multiply = gdp_tgf_renown_tier_value }
				years = 7
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = patient factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.2017.c
		add_stress = medium_stress_loss
		ai_chance = {
			base = 100
			modifier = { has_trait = ambitious factor = 0 }
		}
	}

	after = {
		remove_character_flag = use_sickness_clothes
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = pool character, a cattle raider
scripted_trigger gdp_tgf_raider_candidate_trigger = {
	has_no_particular_noble_roots_trigger = yes
	is_physically_able_adult = yes
	prowess >= medium_skill_rating
}

# this = trade market with a stranger holder, where $ROUTE$ trades livestock and the local pool holds a raider
scripted_trigger gdp_tgf_raider_market_trigger = {
	save_temporary_scope_as = tgf_raider_market_temp
	exists = trade_market_owner.title_province.county
	gdp_tgf_stranger_holder_market_trigger = yes
	$ROUTE$ = {
		any_traded_good = {
			gdp_tgf_not_livestock_good_trigger = no
			save_temporary_scope_as = tgf_raider_good_temp
			$ROUTE$ = {
				OR = {
					is_buying_trade_good_in_market = {
						trade_market = scope:tgf_raider_market_temp
						trade_good_type = scope:tgf_raider_good_temp
					}
					is_selling_trade_good_in_market = {
						trade_market = scope:tgf_raider_market_temp
						trade_good_type = scope:tgf_raider_good_temp
					}
				}
			}
		}
	}
	trade_market_owner.title_province = {
		save_temporary_scope_as = tgf_raider_province_temp
		any_pool_character = {
			province = scope:tgf_raider_province_temp
			is_healthy = yes
			gdp_tgf_raider_candidate_trigger = yes
		}
	}
}

# this = trade route with a trader. Expects root = the merchant
scripted_trigger gdp_tgf_raider_route_trigger = {
	is_commission_route = no
	has_trader = yes
	save_temporary_scope_as = tgf_raider_route_temp
	any_trade_market_on_route = {
		gdp_tgf_raider_market_trigger = { ROUTE = scope:tgf_raider_route_temp }
	}
}

# Somebody's Cattle
gdp_trade_good_flavor.2018 = {
	type = character_event
	title = gdp_trade_good_flavor.2018.t
	desc = gdp_trade_good_flavor.2018.desc
	theme = trade
	override_background = { reference = farmland }

	left_portrait = {
		character = scope:tgf_trader
		animation = merchant_gesturing
		camera = camera_event_very_left_fov35
	}
	right_portrait = {
		character = scope:tgf_raider
		animation = donkey_standing_baggage
		camera = camera_event_right_forward
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 25 }

	trigger = {
		is_available = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_raider_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_raider_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			trader = { save_scope_as = tgf_trader }
			random_trade_market_on_route = {
				limit = { gdp_tgf_raider_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					gdp_tgf_not_livestock_good_trigger = no
					save_temporary_scope_as = tgf_raider_good_temp
					scope:tgf_route = {
						OR = {
							is_buying_trade_good_in_market = {
								trade_market = scope:tgf_market
								trade_good_type = scope:tgf_raider_good_temp
							}
							is_selling_trade_good_in_market = {
								trade_market = scope:tgf_market
								trade_good_type = scope:tgf_raider_good_temp
							}
						}
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				holder = { save_scope_as = tgf_market_holder }
				title_province = {
					save_scope_as = tgf_source_province
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		ordered_pool_character = {
			province = scope:tgf_source_province
			limit = {
				gdp_tgf_raider_candidate_trigger = yes
				is_healthy = yes
			}
			order_by = prowess
			save_scope_as = tgf_raider
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.2018.a
		add_trade_good_price_modifier = {
			type = buy_mult
			trade_good_type = scope:tgf_good
			value = { value = -0.03 multiply = gdp_tgf_renown_tier_value }
			years = 10
		}
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_major_value
		}
		random = {
			chance = 25
			send_interface_toast = {
				type = event_toast_effect_bad
				title = gdp_trade_good_flavor.2018.a.toast
				right_icon = scope:tgf_market_holder
				add_prestige = minor_prestige_loss
				scope:tgf_market_holder = {
					progress_towards_rival_effect = {
						REASON = rival_tgf_bought_stolen_herd
						CHARACTER = root
						OPINION = default_rival_opinion
					}
				}
			}
		}
		stress_impact = {
			just = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = just factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.2018.b
		scope:tgf_raider = {
			death = {
				death_reason = death_chopped_to_pieces
				killer = scope:tgf_market_holder
			}
		}
		scope:tgf_market_holder = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 15
			}
		}
		if = {
			limit = {
				NOT = { has_hook = scope:tgf_market_holder }
			}
			add_hook = {
				type = favor_hook
				target = scope:tgf_market_holder
			}
		}
		stress_impact = {
			compassionate = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.2018.c
		add_gold = minor_gold_value
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_minor_value
		}
		stress_impact = {
			honest = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = honest factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = trade market where $ROUTE$ sells alcohol to a stranger holder whose faith forbids it
scripted_trigger gdp_tgf_dry_court_market_trigger = {
	gdp_tgf_category_sell_holder_market_trigger = {
		ROUTE = $ROUTE$
		CATEGORY = trade_category_alcohol
	}
	trade_market_owner.holder.faith = { has_doctrine_parameter = alcohol_forbidden }
}

# this = trade route with a trader. Expects root = the merchant
scripted_trigger gdp_tgf_dry_court_route_trigger = {
	is_commission_route = no
	has_trader = yes
	save_temporary_scope_as = tgf_dry_court_route_temp
	any_trade_market_on_route = {
		gdp_tgf_dry_court_market_trigger = { ROUTE = scope:tgf_dry_court_route_temp }
	}
}

# A Dry Court's Thirst
gdp_trade_good_flavor.2019 = {
	type = character_event
	title = gdp_trade_good_flavor.2019.t
	desc = gdp_trade_good_flavor.2019.desc
	theme = trade
	override_background = { reference = feast }

	left_portrait = {
		character = scope:tgf_trader
		animation = merchant_gesturing
		camera = camera_event_left
	}
	right_portrait = {
		character = scope:tgf_market_holder
		animation = drink_goblet
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 25 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_dry_court_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_dry_court_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			trader = { save_scope_as = tgf_trader }
			random_trade_market_on_route = {
				limit = { gdp_tgf_dry_court_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
			random_traded_good = {
				limit = {
					any_trade_category = { this = trade_good_category:trade_category_alcohol }
					save_temporary_scope_as = tgf_catsell_good_temp
					scope:tgf_route = {
						is_selling_trade_good_in_market = {
							trade_market = scope:tgf_market
							trade_good_type = scope:tgf_catsell_good_temp
						}
					}
				}
				save_scope_as = tgf_good
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				holder = {
					save_scope_as = tgf_market_holder
					save_scope_as = bg_override_char
				}
				title_province = {
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.2019.a
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_medium_value
		}
		scope:tgf_market_holder = {
			add_opinion = {
				target = root
				modifier = pleased_opinion
				opinion = 20
			}
		}
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = 0.01 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = honest factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.2019.b
		random_list = {
			70 = {
				send_interface_toast = {
					type = event_toast_effect_good
					title = gdp_trade_good_flavor.2019.b.toast_good
					right_icon = scope:tgf_market_holder
					scope:tgf_market = {
						add_price_modifier_for_character = {
							type = sell_mult
							character = root
							trade_good_type = scope:tgf_good
							value = { value = 0.03 multiply = gdp_tgf_renown_tier_value }
							years = 10
						}
					}
				}
			}
			30 = {
				send_interface_toast = {
					type = event_toast_effect_bad
					title = gdp_trade_good_flavor.2019.b.toast
					right_icon = scope:tgf_market_holder
					scope:tgf_market = {
						add_price_modifier_for_character = {
							type = sell_mult
							character = root
							trade_good_type = scope:tgf_good
							value = -0.01
							years = 10
						}
					}
					scope:tgf_market_holder = {
						add_opinion = {
							target = root
							modifier = annoyed_opinion
							opinion = -20
						}
					}
				}
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = generous factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.2019.c
		add_stress = minor_stress_loss
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_miniscule_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# A Perfect Wheel
gdp_trade_good_flavor.3001 = {
	type = character_event
	title = gdp_trade_good_flavor.3001.t
	desc = gdp_trade_good_flavor.3001.desc
	theme = merchant
	override_background = { reference = bp1_wine_cellar }

	left_portrait = {
		character = root
		animation = clutching_ball
		camera = camera_event_left_to_the_left
	}
	right_portrait = {
		trigger = { exists = scope:tgf_guard }
		character = scope:tgf_guard
		animation = throne_room_two_handed_passive_shield
		camera = camera_event_left
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}
	
	override_effect_2d = { reference = flies }

	trigger = {
		NOT = { has_character_flag = gdp_tgf_had_event_3001 }
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = {
			gdp_tgf_good_route_trigger = { GOOD = trade_good_cheese }
		}
	}

	immediate = {
		add_character_flag = gdp_tgf_had_event_3001
		random_courtier = {
			limit = { is_physically_able_adult = yes }
			weight = {
				base = 1
				modifier = {
					add = 4
					is_knight = yes
				}
			}
			save_scope_as = tgf_guard
		}
		trade_good_type:trade_good_cheese = {
			save_scope_as = tgf_good
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.3001.a
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_massive_value
		}
		gdp_tgf_roll_artifact_rarity_effect = { RARITY = random }
		create_artifact = {
			name = fp2_cheese_artifact
			description = fp2_cheese_artifact_desc
			modifier = artifact_health_gain_1_modifier
			modifier = artifact_attraction_opinion_negative_1_modifier
			type = miscellaneous
			visuals = pouch
			quality = scope:quality
			wealth = scope:wealth
			save_scope_as = newly_created_artifact
		}
		gdp_tgf_add_artifact_trade_modifiers_effect = yes
		hidden_effect = {
			scope:newly_created_artifact = {
				flag_as_trash_artifact = yes
				set_variable = has_cheese_artifact
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = temperate factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3001.b
		add_gold = minor_gold_value
		ai_chance = {
			base = 100
			modifier = { has_trait = gluttonous factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# A Famous Complaint
gdp_trade_good_flavor.3002 = {
	type = character_event
	title = gdp_trade_good_flavor.3002.t
	desc = gdp_trade_good_flavor.3002.desc
	theme = merchant

	left_portrait = {
		character = root
		animation = holding_scales
		camera = camera_event_very_left
	}
	right_portrait = {
		character = scope:tgf_market_holder
		animation = arguing
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 50 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = {
			gdp_tgf_good_sell_holder_route_trigger = { GOOD = trade_good_copper }
		}
	}

	immediate = {
		random_trade_route = {
			limit = {
				gdp_tgf_good_sell_holder_route_trigger = { GOOD = trade_good_copper }
			}
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = {
					gdp_tgf_good_sell_holder_market_trigger = {
						ROUTE = scope:tgf_route
						GOOD = trade_good_copper
					}
				}
				save_scope_as = tgf_market
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				holder = { save_scope_as = tgf_market_holder }
				title_province = {
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		trade_good_type:trade_good_copper = {
			save_scope_as = tgf_good
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.3002.a
		random_list = {
			70 = {
				send_interface_toast = {
					type = event_toast_effect_good
					title = gdp_trade_good_flavor.3002.a.toast_good
					right_icon = scope:tgf_market_holder
					scope:tgf_market = {
						add_price_modifier_for_character = {
							type = sell_mult
							character = root
							trade_good_type = scope:tgf_good
							value = { value = 0.01 multiply = gdp_tgf_renown_tier_value }
							years = 10
						}
					}
				}
			}
			30 = {
				send_interface_toast = {
					type = event_toast_effect_bad
					title = gdp_trade_good_flavor.3002.a.toast
					right_icon = scope:tgf_market_holder
					scope:tgf_market = {
						add_price_modifier_for_character = {
							type = sell_mult
							character = root
							trade_good_type = scope:tgf_good
							value = -0.02
							years = 10
						}
					}
					scope:tgf_market_holder = {
						add_opinion = {
							target = root
							modifier = annoyed_opinion
							opinion = -20
						}
					}
				}
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = honest factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3002.b
		duel = {
			skill = diplomacy
			target = scope:tgf_market_holder
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 10
				desc = gdp_trade_good_flavor.3002.b.toast_good
				send_interface_toast = {
					type = event_toast_effect_good
					title = gdp_trade_good_flavor.3002.b.toast_good
					right_icon = scope:tgf_market_holder
					add_prestige = medium_prestige_gain
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 10
				desc = gdp_trade_good_flavor.3002.b.toast_bad
				send_interface_toast = {
					type = event_toast_effect_bad
					title = gdp_trade_good_flavor.3002.b.toast_bad
					right_icon = scope:tgf_market_holder
					scope:tgf_market_holder = {
						progress_towards_rival_effect = {
							REASON = rival_tgf_light_ingots
							CHARACTER = root
							OPINION = default_rival_opinion
						}
					}
				}
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = honest factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3002.c
		add_prestige = miniscule_prestige_loss
		scope:tgf_market_holder = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 15
			}
		}
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_minor_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = arrogant factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = trade market whose local pool holds a poor adult commoner
scripted_trigger gdp_tgf_debtor_market_trigger = {
	exists = trade_market_owner.title_province.county
	trade_market_owner.title_province = {
		save_temporary_scope_as = tgf_debtor_province_temp
		any_pool_character = {
			province = scope:tgf_debtor_province_temp
			is_healthy = yes
			has_no_particular_noble_roots_trigger = yes
			is_physically_able_adult = yes
			short_term_gold < 5
		}
	}
}

# this = trade route where a market has a destitute commoner in the local pool
scripted_trigger gdp_tgf_debtor_route_trigger = {
	is_commission_route = no
	gdp_tgf_good_route_trigger = { GOOD = trade_good_spices }
	any_trade_market_on_route = {
		gdp_tgf_debtor_market_trigger = yes
	}
}

# Rent in Pepper
gdp_trade_good_flavor.3003 = {
	type = character_event
	title = gdp_trade_good_flavor.3003.t
	desc = gdp_trade_good_flavor.3003.desc
	theme = merchant

	left_portrait = {
		character = root
		animation = holding_scales
		camera = camera_event_left
	}
	right_portrait = {
		character = scope:tgf_debtor
		animation = beg
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 50 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_debtor_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_debtor_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = { gdp_tgf_debtor_market_trigger = yes }
				save_scope_as = tgf_market
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					save_scope_as = tgf_source_province
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		random_pool_character = {
			province = scope:tgf_source_province
			limit = {
				is_healthy = yes
				has_no_particular_noble_roots_trigger = yes
				is_physically_able_adult = yes
				short_term_gold < 5
			}
			save_scope_as = tgf_debtor
		}
		trade_good_type:trade_good_spices = {
			save_scope_as = tgf_good
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.3003.a
		add_trade_good_price_modifier = {
			type = sell_mult
			trade_good_type = scope:tgf_good
			value = { value = 0.01 multiply = gdp_tgf_renown_tier_value }
			years = 20
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = stubborn factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3003.b
		trigger = {
			is_ai = no
		}
		show_as_unavailable = { always = yes }
		scope:tgf_debtor = {
			pay_short_term_gold = {
				target = root
				gold = miniscule_gold_value
			}
			add_opinion = {
				target = root
				modifier = annoyed_opinion
				opinion = -20
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = compassionate factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3003.c
		add_courtier = scope:tgf_debtor
		scope:tgf_debtor = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 30
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# A Letter Full of Complaints
gdp_trade_good_flavor.3004 = {
	type = character_event
	title = gdp_trade_good_flavor.3004.t
	desc = gdp_trade_good_flavor.3004.desc
	theme = merchant
	override_background = { reference = terrain_scope }

	left_portrait = {
		character = scope:tgf_trader
		animation = mental_anguish
	}

	widgets = {
		widget = {
			is_shown = { scope:tgf_weather = flag:rain }
			gui = event_window_widget_vfx_rain_storm
			container = foreground_shader_vfx_container
		}
		widget = {
			is_shown = { scope:tgf_weather = flag:snow }
			gui = event_window_widget_vfx_snowstorm
			container = foreground_shader_vfx_container
		}
		widget = {
			gui = "event_window_widget_trade_good"
			container = "custom_widgets_container"
		}
	}

	cooldown = { years = 50 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = {
			has_trader = yes
			gdp_tgf_good_sell_route_trigger = { GOOD = trade_good_flax }
		}
	}

	immediate = {
		random_trade_route = {
			limit = {
				has_trader = yes
				gdp_tgf_good_sell_route_trigger = { GOOD = trade_good_flax }
			}
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			trader = { save_scope_as = tgf_trader }
			random_trade_market_on_route = {
				limit = {
					gdp_tgf_good_sell_market_trigger = {
						ROUTE = scope:tgf_route
						GOOD = trade_good_flax
					}
				}
				save_scope_as = tgf_market
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		trade_good_type:trade_good_flax = {
			save_scope_as = tgf_good
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		scope:tgf_trader.location ?= { save_scope_as = background_terrain_scope }
		if = {
			limit = { NOT = { exists = scope:background_terrain_scope } }
			scope:tgf_market.trade_market_owner.title_province = { save_scope_as = background_terrain_scope }
		}
		if = {
			limit = { scope:background_terrain_scope = { has_winter_trigger = yes } }
			save_scope_value_as = { name = tgf_weather value = flag:snow }
		}
		else = {
			save_scope_value_as = { name = tgf_weather value = flag:rain }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3004.a
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = 0.01 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_minor_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = diligent factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3004.b
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_major_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = lazy factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# A Subtlety
gdp_trade_good_flavor.3005 = {
	type = character_event
	title = gdp_trade_good_flavor.3005.t
	desc = gdp_trade_good_flavor.3005.desc
	theme = trade
	override_background = { reference = feast }

	left_portrait = {
		character = scope:tgf_trader
		animation = merchant_gesturing
		camera = camera_event_left
	}
	right_portrait = {
		character = scope:tgf_market_holder
		animation = eating
		camera = camera_event_right
	}
	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 50 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = {
			has_trader = yes
			gdp_tgf_good_sell_holder_route_trigger = { GOOD = trade_good_sugar }
		}
	}

	immediate = {
		random_trade_route = {
			limit = {
				has_trader = yes
				gdp_tgf_good_sell_holder_route_trigger = { GOOD = trade_good_sugar }
			}
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			trader = { save_scope_as = tgf_trader }
			random_trade_market_on_route = {
				limit = {
					gdp_tgf_good_sell_holder_market_trigger = {
						ROUTE = scope:tgf_route
						GOOD = trade_good_sugar
					}
				}
				save_scope_as = tgf_market
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				holder = {
					save_scope_as = tgf_market_holder
					save_scope_as = bg_override_char
				}
				title_province = {
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		trade_good_type:trade_good_sugar = {
			save_scope_as = tgf_good
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.3005.a
		duel = {
			skill = stewardship
			value = decent_skill_rating
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = gdp_trade_good_flavor.3005.a.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = gdp_trade_good_flavor.3005.a.success
					right_icon = scope:tgf_market_holder
					add_prestige = medium_prestige_gain
					add_character_modifier = gdp_tgf_sweet_reputation_modifier
					scope:tgf_market_holder = {
						add_opinion = {
							target = root
							modifier = grateful_opinion
							opinion = 20
						}
					}
					scope:tgf_market = {
						add_price_modifier_for_character = {
							type = sell_mult
							character = root
							trade_good_type = scope:tgf_good
							value = { value = 0.02 multiply = gdp_tgf_renown_tier_value }
							years = 10
						}
					}
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = gdp_trade_good_flavor.3005.a.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = gdp_trade_good_flavor.3005.a.failure
					right_icon = scope:tgf_market_holder
					add_prestige = minor_prestige_loss
					gdp_increase_trade_expertise_xp_effect = {
						CATEGORY = scope:tgf_category
						VALUE = trade_expertise_xp_medium_value
					}
					scope:tgf_market_holder = {
						add_opinion = {
							target = root
							modifier = annoyed_opinion
							opinion = -20
						}
					}
				}
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = craven factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3005.b
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = 0.01 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = generous factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3005.c
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_minor_value
		}
		scope:tgf_market_holder = {
			add_opinion = {
				target = root
				modifier = annoyed_opinion
				opinion = -10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = ambitious factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# The Swarm
gdp_trade_good_flavor.3006 = {
	type = character_event
	title = gdp_trade_good_flavor.3006.t
	desc = gdp_trade_good_flavor.3006.desc
	theme = merchant
	override_background = { reference = bp1_wine_cellar }
	override_effect_2d = { reference = flies }

	left_portrait = {
		character = root
		animation = shock
		camera = camera_event_left
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 50 }

	trigger = {
		is_available = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = {
			gdp_tgf_good_route_trigger = { GOOD = trade_good_honey }
		}
		NOT = {
			has_character_modifier = gdp_tgf_beekeeper_modifier
		}
	}

	immediate = {
		trade_good_type:trade_good_honey = {
			save_scope_as = tgf_good
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.3006.a
		add_character_modifier = gdp_tgf_beekeeper_modifier
		random = {
			chance = 25
			send_interface_toast = {
				type = event_toast_effect_bad
				title = gdp_trade_good_flavor.3006.a.toast
				left_icon = root
				add_character_modifier = {
					modifier = gdp_tgf_bee_stung_modifier
					years = 1
				}
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = craven factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3006.b
		add_stress = minor_stress_loss
		add_gold = miniscule_gold_value
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# Another Pot of Tea
gdp_trade_good_flavor.3007 = {
	type = character_event
	title = gdp_trade_good_flavor.3007.t
	desc = gdp_trade_good_flavor.3007.desc
	theme = merchant
	override_background = { reference = sitting_room }

	left_portrait = {
		character = root
		animation = drink
		camera = camera_event_left
	}

	widgets = {
		widget = { gui = event_window_widget_vfx_background_flickering_candlelight_dark container = foreground_shader_vfx_container }
		widget = { gui = event_window_widget_vfx_left_character_flickering_candlelight_dark container = foreground_shader_vfx_container }
		widget = {
			gui = "event_window_widget_trade_good"
			container = "custom_widgets_container"
		}
	}

	trigger = {
		NOR = {
			has_character_flag = gdp_tgf_had_event_3007
			has_character_modifier = gdp_tgf_awake_and_alert_modifier
		}
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = {
			gdp_tgf_good_route_trigger = { GOOD = trade_good_tea }
		}
	}

	immediate = {
		add_character_flag = gdp_tgf_had_event_3007
		trade_good_type:trade_good_tea = {
			save_scope_as = tgf_good
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.3007.a
		add_character_modifier = gdp_tgf_awake_and_alert_modifier
		add_stress = minor_stress_gain
		ai_chance = {
			base = 100
			modifier = { has_trait = temperate factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3007.b
		every_courtier = {
			limit = {
				is_adult = yes
				NOT = { has_character_modifier = gdp_tgf_tea_drinker_modifier }
			}
			add_character_modifier = gdp_tgf_tea_drinker_modifier
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = shy factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# Before It Turns
gdp_trade_good_flavor.3008 = {
	type = character_event
	title = gdp_trade_good_flavor.3008.t
	desc = gdp_trade_good_flavor.3008.desc
	theme = merchant
	override_background = { reference = docks }

	left_portrait = {
		character = root
		animation = worry
		camera = camera_event_left
	}
	right_portrait = {
		character = scope:tgf_trader
		animation = poison
		camera = camera_event_right
	}
	override_effect_2d = { reference = flies }

	widgets = {
		widget = { gui = event_window_widget_vfx_fog container = foreground_shader_vfx_container }
		widget = {
			gui = "event_window_widget_trade_good"
			container = "custom_widgets_container"
		}
	}

	cooldown = { years = 50 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = {
			has_trader = yes
			gdp_tgf_good_route_trigger = { GOOD = trade_good_fruit }
		}
	}

	immediate = {
		random_trade_route = {
			limit = {
				has_trader = yes
				gdp_tgf_good_route_trigger = { GOOD = trade_good_fruit }
			}
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			trader = { save_scope_as = tgf_trader }
		}
		trade_good_type:trade_good_fruit = {
			save_scope_as = tgf_good
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.3008.a
		remove_short_term_gold = miniscule_gold_value
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_medium_value
		}
		add_trade_good_price_modifier = {
			type = sell_mult
			trade_good_type = scope:tgf_good
			value = { value = 0.005 multiply = gdp_tgf_renown_tier_value }
			years = 10
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = impatient factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3008.b
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = trade_good_category:trade_category_alcohol
			VALUE = trade_expertise_xp_massive_value
		}
		add_character_modifier = {
			modifier = gdp_tgf_alcohol_opportunist_modifier
			years = 15
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = temperate factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# The Midnight Oil
gdp_trade_good_flavor.3009 = {
	type = character_event
	title = gdp_trade_good_flavor.3009.t
	desc = gdp_trade_good_flavor.3009.desc
	theme = merchant
	override_background = { reference = study }

	left_portrait = {
		character = root
		animation = writing
		camera = camera_event_left
	}

	widgets = {
		widget = { gui = event_window_widget_vfx_background_flickering_candlelight_dark container = foreground_shader_vfx_container }
		widget = { gui = event_window_widget_vfx_left_character_flickering_candlelight_dark container = foreground_shader_vfx_container }
		widget = {
			gui = "event_window_widget_trade_good"
			container = "custom_widgets_container"
		}
	}

	cooldown = { years = 50 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = {
			gdp_tgf_good_route_trigger = { GOOD = trade_good_oil }
		}
		NOT = {
			has_character_modifier = gdp_tgf_two_grades_modifier
		}
	}

	immediate = {
		trade_good_type:trade_good_oil = {
			save_scope_as = tgf_good
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.3009.a
		add_character_modifier = gdp_tgf_two_grades_modifier
		ai_chance = {
			base = 100
			modifier = { has_trait = arrogant factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3009.b
		add_stewardship_lifestyle_xp = major_lifestyle_xp
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_medium_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = lazy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3009.c
		add_stress = medium_stress_loss
		ai_chance = {
			base = 100
			modifier = { has_trait = diligent factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# In the Blade
gdp_trade_good_flavor.3010 = {
	type = character_event
	title = gdp_trade_good_flavor.3010.t
	desc = {
		desc = gdp_trade_good_flavor.3010.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = {
					gdp_usury_condemns_loan_trigger = { BORROWER = scope:tgf_peasant }
				}
				desc = gdp_trade_good_flavor.3010.desc.condemned
			}
			desc = gdp_trade_good_flavor.3010.desc.permitted
		}
	}
	theme = trade
	override_background = { reference = farmland }

	left_portrait = {
		character = root
		animation = holding_scales
		camera = camera_event_very_left
	}
	right_portrait = {
		character = scope:tgf_peasant
		animation = beg
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 50 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = {
			gdp_tgf_good_buy_pool_route_trigger = { GOOD = trade_good_grain }
		}
	}

	immediate = {
		random_trade_route = {
			limit = {
				gdp_tgf_good_buy_pool_route_trigger = { GOOD = trade_good_grain }
			}
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = {
					gdp_tgf_good_buy_pool_market_trigger = {
						ROUTE = scope:tgf_route
						GOOD = trade_good_grain
					}
				}
				save_scope_as = tgf_market
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					save_scope_as = tgf_source_province
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		random_pool_character = {
			province = scope:tgf_source_province
			limit = {
				is_healthy = yes
				has_no_particular_noble_roots_trigger = yes
				is_physically_able_adult = yes
			}
			save_scope_as = tgf_peasant
		}
		trade_good_type:trade_good_grain = {
			save_scope_as = tgf_good
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.3010.a
		remove_short_term_gold = minor_gold_value
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = buy_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = -0.02 multiply = gdp_tgf_renown_tier_value }
				years = 25
			}
		}
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_major_value
		}
		scope:tgf_peasant = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 20
			}
		}
		if = {
			limit = {
				gdp_usury_condemns_loan_trigger = { BORROWER = scope:tgf_peasant }
			}
			add_piety = minor_piety_loss
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = zealous factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3010.b
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_medium_value
		}
		if = {
			limit = {
				gdp_usury_condemns_loan_trigger = { BORROWER = scope:tgf_peasant }
			}
			add_piety = miniscule_piety_gain
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# Ten-Year Millet
gdp_trade_good_flavor.3011 = {
	type = character_event
	title = gdp_trade_good_flavor.3011.t
	desc = gdp_trade_good_flavor.3011.desc
	theme = merchant
	override_background = { reference = bp1_wine_cellar }

	left_portrait = {
		character = root
		animation = holding_tally_stick
		camera = camera_event_left
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 50 }

	trigger = {
		is_available = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = {
			gdp_tgf_good_route_trigger = { GOOD = trade_good_millet }
		}
	}

	immediate = {
		trade_good_type:trade_good_millet = {
			save_scope_as = tgf_good
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.3011.a
		add_gold = minor_gold_value
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_minor_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = patient factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3011.b
		add_character_modifier = gdp_tgf_road_millet_modifier
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_medium_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3011.c
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_medium_value
		}
		add_trade_good_price_modifier = {
			type = buy_mult
			trade_good_type = scope:tgf_good
			value = { value = -0.01 multiply = gdp_tgf_renown_tier_value }
			years = 10
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = lazy factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# Polished or Not
gdp_trade_good_flavor.3012 = {
	type = character_event
	title = gdp_trade_good_flavor.3012.t
	desc = gdp_trade_good_flavor.3012.desc
	theme = merchant
	override_background = { reference = farmland }

	left_portrait = {
		character = root
		animation = donkey_standing_baggage
		camera = camera_event_table_left_2
	}
	right_portrait = {
		character = scope:tgf_trader
		animation = holding_scales
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 50 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = {
			has_trader = yes
			gdp_tgf_good_route_trigger = { GOOD = trade_good_rice }
		}
	}

	immediate = {
		random_trade_route = {
			limit = {
				has_trader = yes
				gdp_tgf_good_route_trigger = { GOOD = trade_good_rice }
			}
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			trader = { save_scope_as = tgf_trader }
			random_trade_market_on_route = {
				limit = {
					save_temporary_scope_as = tgf_rice_market_temp
					exists = trade_market_owner.title_province.county
					scope:tgf_route = {
						OR = {
							is_selling_trade_good_in_market = {
								trade_market = scope:tgf_rice_market_temp
								trade_good_type = trade_good_type:trade_good_rice
							}
							is_buying_trade_good_in_market = {
								trade_market = scope:tgf_rice_market_temp
								trade_good_type = trade_good_type:trade_good_rice
							}
						}
					}
				}
				trade_market_owner.title_province.county = { save_scope_as = tgf_source_county }
			}
		}
		trade_good_type:trade_good_rice = {
			save_scope_as = tgf_good
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.3012.a
		remove_short_term_gold = minor_gold_value
		add_prestige = medium_prestige_gain
		add_trade_good_price_modifier = {
			type = sell_mult
			trade_good_type = scope:tgf_good
			value = { value = 0.01 multiply = gdp_tgf_renown_tier_value }
			years = 10
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = humble factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3012.b
		scope:tgf_source_county ?= {
			if = {
				limit = { gdp_tgf_county_held_by_root_or_ai_trigger = yes }
				add_county_modifier = {
					modifier = gdp_tgf_cheap_rice_modifier
					years = 10
				}
			}
		}
		add_piety = minor_piety_gain
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_medium_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3012.c
		add_prestige = miniscule_prestige_gain
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_miniscule_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = lazy factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = trade market where $ROUTE$ sells meat, in a county that keeps Lent or Ramadan
scripted_trigger gdp_tgf_fast_market_trigger = {
	gdp_tgf_good_sell_market_trigger = {
		ROUTE = $ROUTE$
		GOOD = trade_good_meat
	}
	trade_market_owner.title_province.county.faith = {
		OR = {
			OR = { religion = religion:catholic_religion religion = religion:protestant_religion religion = religion:eastern_orthodox_religion religion = religion:oriental_orthodox_religion }
			religion = religion:islam_religion
		}
	}
}

# this = trade route with a trader and a market that keeps a meat fast
scripted_trigger gdp_tgf_fast_route_trigger = {
	is_commission_route = no
	has_trader = yes
	save_temporary_scope_as = tgf_fast_route_temp
	any_trade_market_on_route = {
		gdp_tgf_fast_market_trigger = { ROUTE = scope:tgf_fast_route_temp }
	}
}

# Before the Fast
gdp_trade_good_flavor.3013 = {
	type = character_event
	title = gdp_trade_good_flavor.3013.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:tgf_source_faith = { religion = religion:islam_religion }
				}
				desc = gdp_trade_good_flavor.3013.desc_ramadan
			}
			desc = gdp_trade_good_flavor.3013.desc
		}
	}
	theme = trade
	override_background = { reference = market }

	left_portrait = {
		character = root
		animation = holding_salami
		camera = camera_event_very_left
	}
	right_portrait = {
		character = scope:tgf_trader
		animation = eating_salami
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 50 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_fast_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_fast_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			trader = { save_scope_as = tgf_trader }
			random_trade_market_on_route = {
				limit = { gdp_tgf_fast_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					county = {
						save_scope_as = tgf_source_county
						faith = { save_scope_as = tgf_source_faith }
					}
				}
			}
		}
		trade_good_type:trade_good_meat = {
			save_scope_as = tgf_good
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		gdp_tgf_set_background_location_effect = {
			CHAR = scope:tgf_trader
			PROVINCE = scope:tgf_market.trade_market_owner.title_province
		}
	}

	option = {
		name = gdp_trade_good_flavor.3013.a
		trigger = { faith.religion = scope:tgf_source_faith.religion }
		reason = faith
		add_piety = minor_piety_gain
		add_character_modifier = gdp_tgf_keeps_the_fast_modifier
		ai_chance = {
			base = 100
			modifier = { has_trait = cynical factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3013.b
		if = {
			limit = {
				NOT = {
					any_trade_route = {
						is_commission_route = no
						any_traded_good = { this = trade_good_type:trade_good_salt }
					}
				}
			}
			remove_short_term_gold = minor_gold_value
		}
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = 0.02 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = trade_good_category:trade_category_salt
			VALUE = trade_expertise_xp_massive_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = impatient factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3013.c
		add_gold = minor_gold_value
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_minor_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = patient factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = trade route that buys horses where a dealer waits, while root is still fledgling with beasts of burden
scripted_trigger gdp_tgf_horse_dealer_route_trigger = {
	is_commission_route = no
	gdp_tgf_good_buy_pool_route_trigger = { GOOD = trade_good_horses }
	root = {
		gdp_tgf_fledgling_in_category_trigger = { CATEGORY = trade_good_category:trade_category_beasts_of_burden }
	}
}

# Look It in the Mouth
gdp_trade_good_flavor.3014 = {
	type = character_event
	title = gdp_trade_good_flavor.3014.t
	desc = gdp_trade_good_flavor.3014.desc
	theme = trade
	override_background = { reference = market }

	left_portrait = {
		character = root
		animation = pondering
		camera = camera_event_left_away
	}
	right_portrait = {
		character = scope:tgf_dealer
		animation = standing_horse
		camera = camera_event_right_away_3_4
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 50 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_horse_dealer_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_horse_dealer_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = {
					gdp_tgf_good_buy_pool_market_trigger = {
						ROUTE = scope:tgf_route
						GOOD = trade_good_horses
					}
				}
				save_scope_as = tgf_market
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = { save_scope_as = tgf_source_province }
			}
		}
		random_pool_character = {
			province = scope:tgf_source_province
			limit = {
				is_healthy = yes
				has_no_particular_noble_roots_trigger = yes
				is_physically_able_adult = yes
			}
			save_scope_as = tgf_dealer
		}
		trade_good_type:trade_good_horses = {
			save_scope_as = tgf_good
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		gdp_tgf_set_background_location_effect = {
			CHAR = scope:tgf_dealer
			PROVINCE = scope:tgf_market.trade_market_owner.title_province
		}
	}

	option = {
		name = gdp_trade_good_flavor.3014.a
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_medium_value
		}
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = buy_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = -0.01 multiply = gdp_tgf_renown_tier_value }
				years = 20
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = trusting factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3014.b
		trigger = {
			NOR = {
				has_character_flag = had_warhorse_story
				any_owned_story = { type = story_cycle_martial_lifestyle_warhorse }
			}
		}
		pay_short_term_gold = {
			target = scope:tgf_dealer
			gold = miniscule_gold_value
		}
		start_warhorse_story_cycle_effect = yes
		ai_chance = {
			base = 100
			modifier = { has_trait = craven factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3014.c
		add_courtier = scope:tgf_dealer
		scope:tgf_dealer = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 30
			}
		}
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_minor_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = paranoid factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# Fatten for Market
gdp_trade_good_flavor.3015 = {
	type = character_event
	title = gdp_trade_good_flavor.3015.t
	desc = gdp_trade_good_flavor.3015.desc
	theme = trade
	override_background = { reference = farmland }

	left_portrait = {
		character = scope:tgf_trader
		animation = merchant_gesturing
		camera = camera_event_left
	}
	right_portrait = {
		character = scope:tgf_market_holder
		animation = biting_coin
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 50 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = {
			has_trader = yes
			gdp_tgf_good_sell_holder_route_trigger = { GOOD = trade_good_cattle }
		}
	}

	immediate = {
		random_trade_route = {
			limit = {
				has_trader = yes
				gdp_tgf_good_sell_holder_route_trigger = { GOOD = trade_good_cattle }
			}
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			trader = { save_scope_as = tgf_trader }
			random_trade_market_on_route = {
				limit = {
					gdp_tgf_good_sell_holder_market_trigger = {
						ROUTE = scope:tgf_route
						GOOD = trade_good_cattle
					}
				}
				save_scope_as = tgf_market
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				holder = { save_scope_as = tgf_market_holder }
				title_province = {
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		trade_good_type:trade_good_cattle = {
			save_scope_as = tgf_good
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.3015.a
		pay_short_term_gold = {
			target = scope:tgf_market_holder
			gold = miniscule_gold_value
		}
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = 0.02 multiply = gdp_tgf_renown_tier_value }
				years = 20
			}
		}
		scope:tgf_source_county = {
			if = {
				limit = { gdp_tgf_county_held_by_root_or_ai_trigger = yes }
				gdp_tgf_add_tiered_county_modifier_effect = {
					MODIFIER = gdp_tgf_well_grazed_meadows
					YEARS = 20
				}
			}
		}
		scope:tgf_route = {
			gdp_tgf_add_tiered_route_modifier_effect = {
				MODIFIER = gdp_tgf_heavier_loads
				YEARS = 10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = impatient factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3015.b
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_medium_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = patient factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = market where $ROUTE$ sells leather to a holder whose available chaplain follows a parchment-scripture faith
scripted_trigger gdp_tgf_chaplain_market_trigger = {
	gdp_tgf_good_sell_holder_market_trigger = {
		ROUTE = $ROUTE$
		GOOD = trade_good_leather
	}
	trade_market_owner.holder = {
		cp:councillor_court_chaplain ?= {
			is_available_ai_adult = yes
			OR = {
				religion = { is_in_family = rf_abrahamic }
				religion = religion:zoroastrianism_religion
			}
		}
	}
}

# this = trade route that sells leather to a holder whose court chaplain can write
scripted_trigger gdp_tgf_chaplain_route_trigger = {
	is_commission_route = no
	save_temporary_scope_as = tgf_chaplain_route_temp
	any_trade_market_on_route = {
		gdp_tgf_chaplain_market_trigger = { ROUTE = scope:tgf_chaplain_route_temp }
	}
}

# Calfskin for the Scribes
gdp_trade_good_flavor.3016 = {
	type = character_event
	title = gdp_trade_good_flavor.3016.t
	desc = gdp_trade_good_flavor.3016.desc
	theme = trade
	override_background = { reference = gdp_tannery }

	left_portrait = {
		character = root
		animation = merchant_gesturing
		camera = camera_event_left
	}
	right_portrait = {
		character = scope:tgf_chaplain
		animation = reading
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 50 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		NOR = {
			religion = religion:hinduism_religion
			religion = religion:jainism_religion
		}
		any_trade_route = { gdp_tgf_chaplain_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_chaplain_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = { gdp_tgf_chaplain_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				holder = {
					save_scope_as = tgf_market_holder
					cp:councillor_court_chaplain = { save_scope_as = tgf_chaplain }
				}
			}
		}
		trade_good_type:trade_good_leather = {
			save_scope_as = tgf_good
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.3016.a
		if = {
			limit = { faith = scope:tgf_chaplain.faith }
			add_piety = medium_piety_gain
		}
		else = {
			add_prestige = medium_prestige_gain
		}
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = trade_good_category:trade_category_books
			VALUE = trade_expertise_xp_minor_value
		}
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_minor_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3016.b
		add_character_modifier = gdp_tgf_parchment_supplier_modifier
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = trade_good_category:trade_category_books
			VALUE = trade_expertise_xp_medium_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = cynical factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3016.c
		add_trade_good_price_modifier = {
			type = sell_mult
			trade_good_type = scope:tgf_good
			value = { value = 0.01 multiply = gdp_tgf_renown_tier_value }
			years = 10
		}
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_minor_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = zealous factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = province with a church holding held by an AI Christian other than root
scripted_trigger gdp_tgf_abbey_province_trigger = {
	has_holding_type = church_holding
	barony.holder ?= {
		NOT = { this = root }
		is_ai = yes
		is_physically_able_adult = yes
		OR = { religion = religion:catholic_religion religion = religion:protestant_religion religion = religion:eastern_orthodox_religion religion = religion:oriental_orthodox_religion }
	}
}

# this = trade market where $ROUTE$ buys wool in a county with a Christian church holding
scripted_trigger gdp_tgf_abbey_market_trigger = {
	gdp_tgf_good_buy_market_trigger = {
		ROUTE = $ROUTE$
		GOOD = trade_good_wool
	}
	trade_market_owner.title_province.county = {
		any_county_province = { gdp_tgf_abbey_province_trigger = yes }
	}
}

# this = trade route that buys wool in a county with a Christian church holding
scripted_trigger gdp_tgf_abbey_route_trigger = {
	is_commission_route = no
	save_temporary_scope_as = tgf_goodbuy_route_temp
	any_trade_market_on_route = {
		gdp_tgf_abbey_market_trigger = { ROUTE = scope:tgf_goodbuy_route_temp }
	}
}

# Buying the Clip
gdp_trade_good_flavor.3017 = {
	type = character_event
	title = gdp_trade_good_flavor.3017.t
	desc = gdp_trade_good_flavor.3017.desc
	theme = trade
	override_background = { reference = hills }

	left_portrait = {
		character = scope:tgf_trader
		animation = merchant_gesturing
		camera = camera_event_left_away_3_4_small
	}
	right_portrait = {
		character = scope:tgf_abbot
		animation = shepherd_with_sheep
		camera = camera_event_very_right_fov50
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 50 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = {
			has_trader = yes
			gdp_tgf_abbey_route_trigger = yes
		}
	}

	immediate = {
		random_trade_route = {
			limit = {
				has_trader = yes
				gdp_tgf_abbey_route_trigger = yes
			}
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			trader = { save_scope_as = tgf_trader }
			random_trade_market_on_route = {
				limit = { gdp_tgf_abbey_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					county = {
						random_county_province = {
							limit = { gdp_tgf_abbey_province_trigger = yes }
							save_scope_as = tgf_abbey_province
							barony = { save_scope_as = tgf_abbey }
							barony.holder = { save_scope_as = tgf_abbot }
						}
					}
				}
			}
		}
		trade_good_type:trade_good_wool = {
			save_scope_as = tgf_good
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.3017.a
		pay_short_term_gold = {
			target = scope:tgf_abbot
			gold = minor_gold_value
		}
		add_prestige = minor_prestige_gain
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = buy_mult
				character = root
				trade_good_type = scope:tgf_good
				value = 0.05
				years = 3
			}
		}
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = buy_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = -0.03 multiply = gdp_tgf_renown_tier_value }
				years = 15
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = impatient factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3017.b
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_minor_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = patient factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# The Vegetable Lamb
gdp_trade_good_flavor.3018 = {
	type = character_event
	title = gdp_trade_good_flavor.3018.t
	desc = gdp_trade_good_flavor.3018.desc
	theme = trade
	override_background = { reference = market }

	left_portrait = {
		character = root
		animation = holding_scales
		camera = camera_event_very_left
	}
	right_portrait = {
		character = scope:tgf_buyer
		animation = admiration
		camera = camera_event_very_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 50 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = {
			gdp_tgf_good_sell_pool_route_trigger = { GOOD = trade_good_cotton }
		}
	}

	immediate = {
		random_trade_route = {
			limit = {
				gdp_tgf_good_sell_pool_route_trigger = { GOOD = trade_good_cotton }
			}
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = {
					gdp_tgf_good_sell_pool_market_trigger = {
						ROUTE = scope:tgf_route
						GOOD = trade_good_cotton
					}
				}
				save_scope_as = tgf_market
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					save_scope_as = tgf_source_province
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		random_pool_character = {
			province = scope:tgf_source_province
			limit = {
				is_healthy = yes
				has_no_particular_noble_roots_trigger = yes
				is_physically_able_adult = yes
			}
			save_scope_as = tgf_buyer
		}
		trade_good_type:trade_good_cotton = {
			save_scope_as = tgf_good
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		gdp_tgf_set_background_location_effect = {
			CHAR = scope:tgf_buyer
			PROVINCE = scope:tgf_market.trade_market_owner.title_province
		}
	}

	option = {
		name = gdp_trade_good_flavor.3018.a
		add_prestige = miniscule_prestige_gain
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = 0.02 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		stress_impact = {
			honest = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = honest factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3018.b
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_major_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = deceitful factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = trade route that buys $GOOD$ in a market with an origin county
scripted_trigger gdp_tgf_good_buy_route_trigger = {
	is_commission_route = no
	save_temporary_scope_as = tgf_goodbuy_route_temp
	any_trade_market_on_route = {
		gdp_tgf_good_buy_market_trigger = {
			ROUTE = scope:tgf_goodbuy_route_temp
			GOOD = $GOOD$
		}
	}
}

# Spolia
gdp_trade_good_flavor.3019 = {
	type = character_event
	title = gdp_trade_good_flavor.3019.t
	desc = gdp_trade_good_flavor.3019.desc
	theme = trade

	left_portrait = {
		character = scope:tgf_trader
		animation = holding_scales_horse
		camera = camera_activity_horse
	}
	override_background = pam_cathedral_construction

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	trigger = {
		NOT = { has_character_flag = gdp_tgf_had_event_3019 }
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = {
			has_trader = yes
			gdp_tgf_good_buy_route_trigger = { GOOD = trade_good_stone }
		}
	}

	immediate = {
		add_character_flag = gdp_tgf_had_event_3019
		random_trade_route = {
			limit = {
				has_trader = yes
				gdp_tgf_good_buy_route_trigger = { GOOD = trade_good_stone }
			}
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			trader = { save_scope_as = tgf_trader }
			random_trade_market_on_route = {
				limit = {
					gdp_tgf_good_buy_market_trigger = {
						ROUTE = scope:tgf_route
						GOOD = trade_good_stone
					}
				}
				save_scope_as = tgf_market
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		trade_good_type:trade_good_stone = {
			save_scope_as = tgf_good
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.3019.a
		add_trade_good_price_modifier = {
			type = sell_mult
			trade_good_type = scope:tgf_good
			value = { value = 0.02 multiply = gdp_tgf_renown_tier_value }
			years = 20
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = honest factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3019.b
		gdp_tgf_create_study_curio_effect = yes
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = coastal trade market whose stranger holder buys $ROUTE$'s wood
scripted_trigger gdp_tgf_mast_market_trigger = {
	gdp_tgf_good_sell_holder_market_trigger = {
		ROUTE = $ROUTE$
		GOOD = trade_good_wood
	}
	trade_market_owner.title_province = { is_coastal = yes }
}

# this = trade route that sells wood to the holder of a coastal market
scripted_trigger gdp_tgf_mast_route_trigger = {
	is_commission_route = no
	save_temporary_scope_as = tgf_goodsell_route_temp
	any_trade_market_on_route = {
		gdp_tgf_mast_market_trigger = { ROUTE = scope:tgf_goodsell_route_temp }
	}
}

# The Mast Trunk
gdp_trade_good_flavor.3020 = {
	type = character_event
	title = gdp_trade_good_flavor.3020.t
	desc = gdp_trade_good_flavor.3020.desc
	theme = trade
	override_background = { reference = docks }

	left_portrait = {
		character = scope:tgf_trader
		animation = merchant_gesturing
		camera = camera_event_left
	}
	right_portrait = {
		character = scope:tgf_market_holder
		animation = survey
		camera = camera_event_right_away
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 50 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = {
			has_trader = yes
			gdp_tgf_mast_route_trigger = yes
		}
	}

	immediate = {
		random_trade_route = {
			limit = {
				has_trader = yes
				gdp_tgf_mast_route_trigger = yes
			}
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			trader = { save_scope_as = tgf_trader }
			random_trade_market_on_route = {
				limit = { gdp_tgf_mast_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				holder = { save_scope_as = tgf_market_holder }
				title_province = {
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		trade_good_type:trade_good_wood = {
			save_scope_as = tgf_good
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		gdp_tgf_set_background_location_effect = {
			CHAR = scope:tgf_market_holder
			PROVINCE = scope:tgf_market.trade_market_owner.title_province
		}
	}

	option = {
		name = gdp_trade_good_flavor.3020.a
		remove_short_term_gold = minor_gold_value
		add_character_modifier = gdp_tgf_tall_mast_modifier
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3020.b
		scope:tgf_route = {
			gdp_tgf_add_tiered_route_modifier_effect = {
				MODIFIER = gdp_tgf_our_timber
				YEARS = 15
			}
		}
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_minor_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = patient factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3020.c
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = 0.05 multiply = gdp_tgf_renown_tier_value }
				years = 15
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = impatient factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = hashish eater other than root
scripted_trigger gdp_tgf_hashish_eater_trigger = {
	has_trait = hashishiyah
	this != root
	is_ai = yes
	is_healthy = yes
}

# this = trade market where $ROUTE$ sells hemp or medicaments to a hemp-using culture or a hashish eater
scripted_trigger gdp_tgf_hemp_custom_market_trigger = {
	OR = {
		gdp_tgf_good_sell_market_trigger = {
			ROUTE = $ROUTE$
			GOOD = trade_good_hemp
		}
		gdp_tgf_good_sell_market_trigger = {
			ROUTE = $ROUTE$
			GOOD = trade_good_medicaments
		}
	}
	OR = {
		trade_market_owner.title_province.county.culture = {
			OR = {
				has_building_gfx = steppe_building_gfx
				has_building_gfx = indian_building_gfx
				AND = {
					current_year >= 1100
					OR = {
						has_building_gfx = mena_building_gfx
						has_building_gfx = iranian_building_gfx
					}
				}
			}
		}
		any_character_in_market = { gdp_tgf_hashish_eater_trigger = yes }
	}
}

# this = trade route that sells hemp or medicaments in such a market
scripted_trigger gdp_tgf_hemp_custom_route_trigger = {
	is_commission_route = no
	save_temporary_scope_as = tgf_goodsell_route_temp
	any_trade_market_on_route = {
		gdp_tgf_hemp_custom_market_trigger = { ROUTE = scope:tgf_goodsell_route_temp }
	}
}

# The Tent of Smoke
gdp_trade_good_flavor.3021 = {
	type = character_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:tgf_hemp_custom = flag:bhang }
				desc = gdp_trade_good_flavor.3021.t_bhang
			}
			triggered_desc = {
				trigger = { scope:tgf_hemp_custom = flag:hashish }
				desc = gdp_trade_good_flavor.3021.t_hashish
			}
			desc = gdp_trade_good_flavor.3021.t
		}
	}
	desc = {
		desc = gdp_trade_good_flavor.3021.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = { scope:tgf_hemp_custom = flag:bhang }
				desc = gdp_trade_good_flavor.3021.desc_bhang
			}
			triggered_desc = {
				trigger = { scope:tgf_hemp_custom = flag:hashish }
				desc = gdp_trade_good_flavor.3021.desc_hashish
			}
			desc = gdp_trade_good_flavor.3021.desc
		}
	}
	theme = trade
	override_background = {
		trigger = { scope:tgf_hemp_custom = flag:smoke }
		reference = mpo_tent_interior_mongol
	}
	override_background = {
		trigger = { scope:tgf_hemp_custom = flag:bhang }
		reference = bp2_indian_garden
	}
	override_background = {
		trigger = { scope:tgf_hemp_custom = flag:hashish }
		reference = bp2_tavern_mena
	}

	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { scope:tgf_hemp_custom = flag:bhang }
			animation = drink_goblet
		}
		animation = delirium
		camera = camera_event_very_left
	}

	right_portrait = {
		character = scope:tgf_hemp_host
		animation = laugh
	}

	widgets = {
		widget = {
			is_shown = { scope:tgf_hemp_custom = flag:smoke }
			gui = event_window_widget_vfx_heavy_smoke
			container = foreground_shader_vfx_container
		}
		widget = {
			gui = "event_window_widget_trade_good"
			container = "custom_widgets_container"
		}
	}

	cooldown = { years = 50 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_hemp_custom_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_hemp_custom_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = { gdp_tgf_hemp_custom_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					county = {
						save_scope_as = tgf_source_county
						culture = { save_scope_as = tgf_source_culture }
					}
				}
			}
		}
		if = {
			limit = {
				scope:tgf_source_culture = { has_building_gfx = steppe_building_gfx }
			}
			save_scope_value_as = {
				name = tgf_hemp_custom
				value = flag:smoke
			}
		}
		else_if = {
			limit = {
				scope:tgf_source_culture = { has_building_gfx = indian_building_gfx }
			}
			save_scope_value_as = {
				name = tgf_hemp_custom
				value = flag:bhang
			}
		}
		else = {
			save_scope_value_as = {
				name = tgf_hemp_custom
				value = flag:hashish
			}
			scope:tgf_market = {
				random_character_in_market = {
					limit = { gdp_tgf_hashish_eater_trigger = yes }
					save_scope_as = tgf_hashish_eater
				}
			}
		}
		if = {
			limit = {
				scope:tgf_market = {
					gdp_tgf_good_sell_market_trigger = {
						ROUTE = scope:tgf_route
						GOOD = trade_good_hemp
					}
				}
			}
			trade_good_type:trade_good_hemp = { save_scope_as = tgf_good }
		}
		else = {
			trade_good_type:trade_good_medicaments = { save_scope_as = tgf_good }
		}
		scope:tgf_good = {
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		if = {
			limit = { scope:tgf_good = trade_good_type:trade_good_hemp }
			trade_good_type:trade_good_medicaments = { save_scope_as = tgf_cross_good }
		}
		else = {
			trade_good_type:trade_good_hemp = { save_scope_as = tgf_cross_good }
		}
		scope:tgf_cross_good = {
			trade_good_need_category = { save_scope_as = tgf_cross_category }
		}
		if = {
			limit = { exists = scope:tgf_hashish_eater }
			scope:tgf_hashish_eater = { save_scope_as = tgf_hemp_host }
		}
		else = {
			random_pool_character = {
				province = scope:tgf_source_county.title_province
				limit = {
					is_healthy = yes
					is_physically_able_adult = yes
				}
				save_scope_as = tgf_hemp_host
			}
		}
		if = {
			limit = {
				NOT = { exists = scope:tgf_hemp_host }
			}
			create_character = {
				age = { 25 55 }
				gender_female_chance = 50
				dynasty = none
				culture = scope:tgf_source_culture
				faith = scope:tgf_source_county.faith
				location = scope:tgf_source_county.title_province
				after_creation = {
					add_character_flag = created
				}
				save_scope_as = tgf_hemp_host
			}
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = {
			trigger = { scope:tgf_hemp_custom = flag:smoke }
			text = gdp_trade_good_flavor.3021.a
		}
		name = {
			trigger = { scope:tgf_hemp_custom = flag:bhang }
			text = gdp_trade_good_flavor.3021.a_bhang
		}
		name = {
			trigger = { scope:tgf_hemp_custom = flag:hashish }
			text = gdp_trade_good_flavor.3021.a_hashish
		}
		add_stress = medium_stress_loss
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = 0.05 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_cross_good
				value = { value = 0.05 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		if = {
			limit = {
				NOT = { has_trait = hashishiyah }
			}
			random = {
				chance = 5
				send_interface_toast = {
					type = event_toast_effect_bad
					title = gdp_trade_good_flavor.3021.a.toast_habit
					left_icon = root
					add_trait = hashishiyah
				}
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = temperate factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3021.b
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_medium_value
		}
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_cross_category
			VALUE = trade_expertise_xp_major_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = gregarious factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
		scope:tgf_hemp_host = { silent_disappearance_ai_if_created_effect = yes }
	}
}

# Creates the weapon scope:tgf_smith forges for scope:tgf_smith_patron
# $TYPE$ is both the artifact type and the visuals
scripted_effect gdp_tgf_create_smith_weapon_effect = {
	create_artifact = {
		name = gdp_tgf_smith_weapon_$TYPE$
		description = gdp_tgf_smith_weapon_desc
		creator = scope:tgf_smith
		type = $TYPE$
		visuals = $TYPE$
		modifier = artifact_prowess_1_modifier
		quality = scope:quality
		wealth = scope:wealth
		save_scope_as = newly_created_artifact
	}
}

# A Blade From My Best
gdp_trade_good_flavor.3022 = {
	type = character_event
	title = gdp_trade_good_flavor.3022.t
	desc = gdp_trade_good_flavor.3022.desc
	theme = trade
	override_background = { reference = gdp_smithy_workshop }

	left_portrait = {
		character = root
		animation = interested
		camera = camera_event_left
	}
	right_portrait = {
		character = scope:tgf_smith
		animation = merchant_box
		camera = camera_event_right
	}

	widgets = {
		widget = { gui = event_window_widget_vfx_heat_wave container = background_shader_vfx_container }
		widget = {
			gui = "event_window_widget_trade_good"
			container = "custom_widgets_container"
		}
	}

	trigger = {
		NOT = { has_character_flag = gdp_tgf_had_event_3022 }
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = {
			gdp_tgf_good_buy_pool_route_trigger = { GOOD = trade_good_iron }
		}
	}

	immediate = {
		save_scope_as = tgf_smith_patron
		add_character_flag = gdp_tgf_had_event_3022
		random_trade_route = {
			limit = {
				gdp_tgf_good_buy_pool_route_trigger = { GOOD = trade_good_iron }
			}
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = {
					gdp_tgf_good_buy_pool_market_trigger = {
						ROUTE = scope:tgf_route
						GOOD = trade_good_iron
					}
				}
				save_scope_as = tgf_market
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					save_scope_as = tgf_source_province
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		random_pool_character = {
			province = scope:tgf_source_province
			limit = {
				is_healthy = yes
				has_no_particular_noble_roots_trigger = yes
				is_physically_able_adult = yes
			}
			weight = {
				base = 1
				modifier = {
					add = martial
				}
			}
			save_scope_as = tgf_smith
		}
		trade_good_type:trade_good_iron = {
			save_scope_as = tgf_good
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		random_list = {
			1 = {
				save_scope_value_as = {
					name = tgf_weapon_type
					value = flag:axe
				}
			}
			1 = {
				save_scope_value_as = {
					name = tgf_weapon_type
					value = flag:dagger
				}
			}
			1 = {
				save_scope_value_as = {
					name = tgf_weapon_type
					value = flag:hammer
				}
			}
			1 = {
				save_scope_value_as = {
					name = tgf_weapon_type
					value = flag:mace
				}
			}
			1 = {
				save_scope_value_as = {
					name = tgf_weapon_type
					value = flag:spear
				}
			}
			1 = {
				save_scope_value_as = {
					name = tgf_weapon_type
					value = flag:sword
				}
			}
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.3022.a
		trigger = { short_term_gold >= medium_gold_value }
		show_as_unavailable = { always = yes }
		pay_short_term_gold = {
			target = scope:tgf_smith
			gold = medium_gold_value
		}
		gdp_tgf_roll_artifact_rarity_effect = { RARITY = random }
		if = {
			limit = { scope:tgf_weapon_type = flag:axe }
			gdp_tgf_create_smith_weapon_effect = { TYPE = axe }
		}
		else_if = {
			limit = { scope:tgf_weapon_type = flag:dagger }
			gdp_tgf_create_smith_weapon_effect = { TYPE = dagger }
		}
		else_if = {
			limit = { scope:tgf_weapon_type = flag:hammer }
			gdp_tgf_create_smith_weapon_effect = { TYPE = hammer }
		}
		else_if = {
			limit = { scope:tgf_weapon_type = flag:mace }
			gdp_tgf_create_smith_weapon_effect = { TYPE = mace }
		}
		else_if = {
			limit = { scope:tgf_weapon_type = flag:spear }
			gdp_tgf_create_smith_weapon_effect = { TYPE = spear }
		}
		else = {
			gdp_tgf_create_smith_weapon_effect = { TYPE = sword }
		}
		gdp_tgf_add_artifact_trade_modifiers_effect = yes
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_minor_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3022.b
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_medium_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = impatient factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# The Lapidary's Claim
gdp_trade_good_flavor.3023 = {
	type = character_event
	title = gdp_trade_good_flavor.3023.t
	desc = gdp_trade_good_flavor.3023.desc
	theme = trade
	override_background = { reference = gdp_artisan_street }

	left_portrait = {
		character = root
		animation = holding_yoke
		camera = camera_event_very_left
	}
	right_portrait = {
		character = scope:tgf_lapidary
		animation = merchant_box
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 50 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = {
			gdp_tgf_good_sell_pool_route_trigger = { GOOD = trade_good_gems }
		}
	}

	immediate = {
		random_trade_route = {
			limit = {
				gdp_tgf_good_sell_pool_route_trigger = { GOOD = trade_good_gems }
			}
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = {
					gdp_tgf_good_sell_pool_market_trigger = {
						ROUTE = scope:tgf_route
						GOOD = trade_good_gems
					}
				}
				save_scope_as = tgf_market
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					save_scope_as = tgf_source_province
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		random_pool_character = {
			province = scope:tgf_source_province
			limit = {
				is_healthy = yes
				has_no_particular_noble_roots_trigger = yes
				is_physically_able_adult = yes
			}
			weight = {
				base = 1
				modifier = {
					add = learning
				}
			}
			save_scope_as = tgf_lapidary
		}
		random_list = {
			1 = {
				set_variable = {
					name = tgf_ailment
					value = flag:fever
				}
			}
			1 = {
				set_variable = {
					name = tgf_ailment
					value = flag:poison
				}
			}
			1 = {
				set_variable = {
					name = tgf_ailment
					value = flag:nightmares
				}
			}
		}
		trade_good_type:trade_good_gems = {
			save_scope_as = tgf_good
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		gdp_tgf_set_background_location_effect = {
			CHAR = scope:tgf_lapidary
			PROVINCE = scope:tgf_market.trade_market_owner.title_province
		}
	}

	option = {
		name = gdp_trade_good_flavor.3023.a
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = 0.02 multiply = gdp_tgf_renown_tier_value }
				years = 20
			}
		}
		add_prestige = minor_prestige_loss
		ai_chance = {
			base = 100
			modifier = { has_trait = honest factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3023.b
		add_courtier = scope:tgf_lapidary
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_medium_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = arrogant factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3023.c
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = 0.01 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = ambitious factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
		remove_variable = tgf_ailment
	}
}

# this = pool character skilled enough to be worth hiring as a jade connoisseur
scripted_trigger gdp_tgf_connoisseur_candidate_trigger = {
	has_no_particular_noble_roots_trigger = yes
	is_physically_able_adult = yes
	OR = {
		stewardship >= decent_skill_rating
		learning >= decent_skill_rating
	}
}

# this = trade market; $ROUTE$ buys or sells jade here and the local pool holds a skilled connoisseur
scripted_trigger gdp_tgf_connoisseur_market_trigger = {
	save_temporary_scope_as = tgf_connoisseur_market_temp
	exists = trade_market_owner.title_province.county
	$ROUTE$ = {
		OR = {
			is_buying_trade_good_in_market = {
				trade_market = scope:tgf_connoisseur_market_temp
				trade_good_type = trade_good_type:trade_good_jade
			}
			is_selling_trade_good_in_market = {
				trade_market = scope:tgf_connoisseur_market_temp
				trade_good_type = trade_good_type:trade_good_jade
			}
		}
	}
	trade_market_owner.title_province = {
		save_temporary_scope_as = tgf_connoisseur_province_temp
		any_pool_character = {
			province = scope:tgf_connoisseur_province_temp
			is_healthy = yes
			gdp_tgf_connoisseur_candidate_trigger = yes
		}
	}
}

# this = trade route that trades jade in a market whose pool holds a skilled connoisseur
scripted_trigger gdp_tgf_connoisseur_route_trigger = {
	is_commission_route = no
	save_temporary_scope_as = tgf_connoisseur_route_temp
	any_trade_market_on_route = {
		gdp_tgf_connoisseur_market_trigger = { ROUTE = scope:tgf_connoisseur_route_temp }
	}
}

# The Gentleman's Stone
gdp_trade_good_flavor.3024 = {
	type = character_event
	title = gdp_trade_good_flavor.3024.t
	desc = gdp_trade_good_flavor.3024.desc
	theme = trade
	override_background = { reference = gdp_artisan_street }

	left_portrait = {
		character = root
		animation = pondering
		camera = camera_event_left
	}
	right_portrait = {
		character = scope:tgf_connoisseur
		animation = holding_scales
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 50 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_connoisseur_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_connoisseur_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = { gdp_tgf_connoisseur_market_trigger = { ROUTE = scope:tgf_route } }
				save_scope_as = tgf_market
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					save_scope_as = tgf_source_province
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		ordered_pool_character = {
			province = scope:tgf_source_province
			limit = {
				gdp_tgf_connoisseur_candidate_trigger = yes
				is_healthy = yes
			}
			order_by = {
				value = stewardship
				add = learning
			}
			save_scope_as = tgf_connoisseur
		}
		trade_good_type:trade_good_jade = {
			save_scope_as = tgf_good
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		gdp_tgf_set_background_location_effect = {
			CHAR = scope:tgf_connoisseur
			PROVINCE = scope:tgf_market.trade_market_owner.title_province
		}
	}

	option = {
		name = gdp_trade_good_flavor.3024.a
		remove_short_term_gold = minor_gold_value
		if = {
			limit = {
				scope:tgf_route = {
					is_selling_trade_good_in_market = {
						trade_market = scope:tgf_market
						trade_good_type = scope:tgf_good
					}
				}
			}
			scope:tgf_market = {
				add_price_modifier_for_character = {
					type = sell_mult
					character = root
					trade_good_type = scope:tgf_good
					value = { value = 0.03 multiply = gdp_tgf_renown_tier_value }
					years = 15
				}
			}
		}
		else = {
			scope:tgf_market = {
				add_price_modifier_for_character = {
					type = buy_mult
					character = root
					trade_good_type = scope:tgf_good
					value = { value = -0.03 multiply = gdp_tgf_renown_tier_value }
					years = 15
				}
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3024.b
		add_courtier = scope:tgf_connoisseur
		scope:tgf_connoisseur = {
			add_stewardship_skill = 2
		}
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_minor_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = arrogant factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3024.c
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_medium_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = impatient factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = trade route with a trader that carries ceramics across the sea
scripted_trigger gdp_tgf_sea_ceramics_route_trigger = {
	is_commission_route = no
	has_trader = yes
	gdp_tgf_good_route_trigger = { GOOD = trade_good_ceramics }
	any_road_on_route = {
		any_road_province = { is_sea_province = yes }
	}
}

# Porcelain Ballast
gdp_trade_good_flavor.3025 = {
	type = character_event
	title = gdp_trade_good_flavor.3025.t
	desc = gdp_trade_good_flavor.3025.desc
	theme = trade
	override_background = { reference = docks }

	left_portrait = {
		character = root
		animation = holding_tally_stick
		camera = camera_event_very_left
	}
	right_portrait = {
		character = scope:tgf_trader
		animation = holding_yoke
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 50 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = { gdp_tgf_sea_ceramics_route_trigger = yes }
	}

	immediate = {
		random_trade_route = {
			limit = { gdp_tgf_sea_ceramics_route_trigger = yes }
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			trader = { save_scope_as = tgf_trader }
		}
		trade_good_type:trade_good_ceramics = {
			save_scope_as = tgf_good
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.3025.a
		add_trade_good_price_modifier = {
			type = sell_mult
			trade_good_type = scope:tgf_good
			value = { value = 0.02 multiply = gdp_tgf_renown_tier_value }
			years = 20
		}
		scope:tgf_route = {
			gdp_tgf_add_tiered_route_modifier_effect = {
				MODIFIER = gdp_tgf_ballast_trick
				YEARS = 20
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = impatient factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3025.b
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_medium_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = ambitious factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# The Sap Bites
gdp_trade_good_flavor.3026 = {
	type = character_event
	title = gdp_trade_good_flavor.3026.t
	desc = gdp_trade_good_flavor.3026.desc
	theme = merchant
	override_background = { reference = gdp_carpentry_workshop }

	left_portrait = {
		character = root
		animation = trade_deal
		camera = camera_body_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 50 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = {
			gdp_tgf_good_route_trigger = { GOOD = trade_good_lacquerware }
		}
	}

	immediate = {
		trade_good_type:trade_good_lacquerware = {
			save_scope_as = tgf_good
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.3026.a
		remove_short_term_gold = minor_gold_value
		add_character_modifier = gdp_tgf_curing_room_modifier
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3026.b
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_major_value
		}
		random = {
			chance = 30
			send_interface_toast = {
				type = event_toast_effect_bad
				title = gdp_trade_good_flavor.3026.b.toast_rash
				left_icon = root
				add_character_modifier = {
					modifier = gdp_tgf_lacquer_rash_modifier
					years = 1
				}
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = patient factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3026.c
		stress_impact = {
			base = minor_stress_loss
			impatient = major_stress_impact_gain
			patient = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = impatient factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# Creates the Reading Stones scope:tgf_glassmaker grinds for this character
# $OWNER$ is merchant or lord and picks the name key
scripted_effect gdp_tgf_create_reading_stones_effect = {
	gdp_tgf_roll_artifact_rarity_effect = { RARITY = random }
	create_artifact = {
		name = gdp_tgf_reading_stones_artifact_$OWNER$
		description = gdp_tgf_reading_stones_artifact_desc
		creator = scope:tgf_glassmaker
		modifier = artifact_stewardship_1_modifier
		type = miscellaneous
		visuals = pocket_fancy_case
		quality = scope:quality
		wealth = scope:wealth
		save_scope_as = newly_created_artifact
	}
	scope:newly_created_artifact = { set_variable = tgf_reading_stones }
}

# Reading Stones
gdp_trade_good_flavor.3027 = {
	type = character_event
	title = gdp_trade_good_flavor.3027.t
	desc = {
		desc = gdp_trade_good_flavor.3027.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						age >= 50
						has_trait = clouded_eyes
					}
				}
				desc = gdp_trade_good_flavor.3027.desc.old_eyes
			}
			desc = gdp_trade_good_flavor.3027.desc.young_eyes
		}
	}
	theme = trade
	override_background = { reference = study }

	left_portrait = {
		character = root
		animation = reading
		camera = camera_event_left
	}
	right_portrait = {
		character = scope:tgf_glassmaker
		animation = merchant_box
		camera = camera_event_right
	}
	lower_center_portrait = {
		trigger = {
			scope:tgf_market = { gdp_tgf_stranger_holder_market_trigger = yes }
		}
		character = scope:tgf_market_holder
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	trigger = {
		NOR = {
			has_character_flag = gdp_tgf_had_event_3027
			has_trait = blind
		}
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = {
			gdp_tgf_good_buy_pool_route_trigger = { GOOD = trade_good_glass }
		}
	}

	immediate = {
		add_character_flag = gdp_tgf_had_event_3027
		save_scope_as = tgf_lens_merchant
		random_trade_route = {
			limit = {
				gdp_tgf_good_buy_pool_route_trigger = { GOOD = trade_good_glass }
			}
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = {
					gdp_tgf_good_buy_pool_market_trigger = {
						ROUTE = scope:tgf_route
						GOOD = trade_good_glass
					}
				}
				save_scope_as = tgf_market
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				holder ?= { save_scope_as = tgf_market_holder }
				title_province = {
					save_scope_as = tgf_source_province
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		random_pool_character = {
			province = scope:tgf_source_province
			limit = {
				is_healthy = yes
				has_no_particular_noble_roots_trigger = yes
				is_physically_able_adult = yes
			}
			save_scope_as = tgf_glassmaker
		}
		trade_good_type:trade_good_glass = {
			save_scope_as = tgf_good
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.3027.a
		pay_short_term_gold = {
			target = scope:tgf_glassmaker
			gold = minor_gold_value
		}
		gdp_tgf_create_reading_stones_effect = { OWNER = merchant }
		gdp_tgf_add_artifact_trade_modifiers_effect = yes
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3027.b
		trigger = {
			scope:tgf_market = { gdp_tgf_stranger_holder_market_trigger = yes }
		}
		pay_short_term_gold = {
			target = scope:tgf_glassmaker
			gold = minor_gold_value
		}
		scope:tgf_market_holder = {
			gdp_tgf_create_reading_stones_effect = { OWNER = lord }
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 20
			}
		}
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = buy_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = -0.03 multiply = gdp_tgf_renown_tier_value }
				years = 15
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = arrogant factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3027.c
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_medium_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = content factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# Feast-Day Prices
gdp_trade_good_flavor.3028 = {
	type = character_event
	title = gdp_trade_good_flavor.3028.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:tgf_source_faith = { OR = { religion = religion:catholic_religion religion = religion:protestant_religion religion = religion:eastern_orthodox_religion religion = religion:oriental_orthodox_religion } }
				}
				desc = gdp_trade_good_flavor.3028.desc.christian
			}
			desc = gdp_trade_good_flavor.3028.desc
		}
		desc = gdp_trade_good_flavor.3028.desc.outro
	}
	theme = trade
	override_background = { reference = temple }
	override_effect_2d = { reference = smoke }

	left_portrait = {
		character = scope:tgf_trader
		animation = thurible
		camera = camera_event_left
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 50 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = {
			has_trader = yes
			gdp_tgf_good_sell_route_trigger = { GOOD = trade_good_incense }
		}
	}

	immediate = {
		random_trade_route = {
			limit = {
				has_trader = yes
				gdp_tgf_good_sell_route_trigger = { GOOD = trade_good_incense }
			}
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			trader = { save_scope_as = tgf_trader }
			random_trade_market_on_route = {
				limit = {
					gdp_tgf_good_sell_market_trigger = {
						ROUTE = scope:tgf_route
						GOOD = trade_good_incense
					}
				}
				save_scope_as = tgf_market
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					county = {
						save_scope_as = tgf_source_county
						faith = { save_scope_as = tgf_source_faith }
					}
				}
			}
		}
		trade_good_type:trade_good_incense = {
			save_scope_as = tgf_good
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		gdp_tgf_set_background_location_effect = {
			CHAR = scope:tgf_trader
			PROVINCE = scope:tgf_market.trade_market_owner.title_province
		}
	}

	option = {
		name = gdp_trade_good_flavor.3028.a
		trigger = { faith = scope:tgf_source_faith }
		reason = faith
		add_stress = medium_stress_loss
		add_piety = minor_piety_gain
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_minor_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = cynical factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3028.b
		add_prestige = minor_prestige_loss
		add_character_modifier = gdp_tgf_temple_supplier_modifier
		ai_chance = {
			base = 100
			modifier = { has_trait = greedy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3028.c
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = 0.01 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = zealous factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# Theriac
gdp_trade_good_flavor.3029 = {
	type = character_event
	title = gdp_trade_good_flavor.3029.t
	desc = gdp_trade_good_flavor.3029.desc
	theme = trade
	override_background = { reference = physicians_study }

	left_portrait = {
		character = root
		animation = holding_scales
		camera = camera_event_left
	}
	right_portrait = {
		character = scope:tgf_apothecary
		animation = physician
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 50 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = {
			gdp_tgf_good_sell_pool_route_trigger = { GOOD = trade_good_medicaments }
		}
	}

	immediate = {
		random_trade_route = {
			limit = {
				gdp_tgf_good_sell_pool_route_trigger = { GOOD = trade_good_medicaments }
			}
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = {
					gdp_tgf_good_sell_pool_market_trigger = {
						ROUTE = scope:tgf_route
						GOOD = trade_good_medicaments
					}
				}
				save_scope_as = tgf_market
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				title_province = {
					save_scope_as = tgf_source_province
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		random_pool_character = {
			province = scope:tgf_source_province
			limit = {
				is_healthy = yes
				has_no_particular_noble_roots_trigger = yes
				is_physically_able_adult = yes
			}
			weight = {
				base = 1
				modifier = {
					add = learning
				}
			}
			save_scope_as = tgf_apothecary
		}
		trade_good_type:trade_good_medicaments = {
			save_scope_as = tgf_good
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.3029.a
		scope:tgf_route = {
			gdp_tgf_add_tiered_route_modifier_effect = {
				MODIFIER = gdp_tgf_theriac_peddlers
				YEARS = 20
			}
			every_trade_market_on_route = {
				limit = { exists = trade_market_owner.title_province.county }
				trade_market_owner.title_province.county = {
					if = {
						limit = { gdp_tgf_county_held_by_root_or_ai_trigger = yes }
						gdp_tgf_add_tiered_county_modifier_effect = {
							MODIFIER = gdp_tgf_theriac_supply
							YEARS = 20
						}
					}
				}
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = lazy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3029.b
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = 0.03 multiply = gdp_tgf_renown_tier_value }
				years = 15
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = content factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3029.c
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_medium_value
		}
		add_character_modifier = {
			modifier = gdp_tgf_theriac_dose_modifier
			years = 20
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = impatient factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# No Paper for Charters
gdp_trade_good_flavor.3030 = {
	type = character_event
	title = gdp_trade_good_flavor.3030.t
	desc = gdp_trade_good_flavor.3030.desc
	theme = trade
	override_background = { reference = study }

	left_portrait = {
		character = scope:tgf_trader
		animation = holding_scrolls
		camera = camera_event_very_right_pointing_very_left
	}
	right_portrait = {
		character = scope:tgf_market_holder
		animation = dismissal
		camera = camera_event_right
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 50 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = {
			has_trader = yes
			gdp_tgf_good_sell_holder_route_trigger = { GOOD = trade_good_books_paper }
		}
	}

	immediate = {
		random_trade_route = {
			limit = {
				has_trader = yes
				gdp_tgf_good_sell_holder_route_trigger = { GOOD = trade_good_books_paper }
			}
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			trader = { save_scope_as = tgf_trader }
			random_trade_market_on_route = {
				limit = {
					gdp_tgf_good_sell_holder_market_trigger = {
						ROUTE = scope:tgf_route
						GOOD = trade_good_books_paper
					}
				}
				save_scope_as = tgf_market
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				holder = { save_scope_as = tgf_market_holder }
				title_province = {
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		trade_good_type:trade_good_books_paper = {
			save_scope_as = tgf_good
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		trade_good_type:trade_good_leather = {
			trade_good_need_category = { save_scope_as = tgf_leather_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
	}

	option = {
		name = gdp_trade_good_flavor.3030.a
		duel = {
			skill = diplomacy
			target = scope:tgf_market_holder
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = gdp_trade_good_flavor.3030.a.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = gdp_trade_good_flavor.3030.a.success
					right_icon = scope:tgf_market_holder
					add_character_modifier = gdp_tgf_chancery_stationer_modifier
					add_prestige = minor_prestige_gain
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = gdp_trade_good_flavor.3030.a.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = gdp_trade_good_flavor.3030.a.failure
					right_icon = scope:tgf_market_holder
					add_prestige = minor_prestige_loss
					scope:tgf_market_holder = {
						add_opinion = {
							target = root
							modifier = annoyed_opinion
							opinion = -10
						}
					}
				}
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = shy factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3030.b
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = trade_good_type:trade_good_leather
				value = { value = 0.03 multiply = gdp_tgf_renown_tier_value }
				years = 15
			}
		}
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_leather_category
			VALUE = trade_expertise_xp_major_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = ambitious factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3030.c
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_medium_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = impatient factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = trade market in a county of Frankish or Germanic culture, where brewers paid for gruit
scripted_trigger gdp_tgf_gruit_market_trigger = {
	trade_market_owner.title_province.county.culture = {
		OR = {
			has_cultural_pillar = heritage_frankish
			has_cultural_pillar = heritage_west_germanic
			has_cultural_pillar = heritage_central_germanic
			has_cultural_pillar = heritage_north_germanic
		}
	}
}

# this = trade route that sells $GOOD$ to a stranger holder whose local pool holds an adult commoner
scripted_trigger gdp_tgf_good_sell_holder_pool_route_trigger = {
	is_commission_route = no
	save_temporary_scope_as = tgf_goodsell_route_temp
	any_trade_market_on_route = {
		gdp_tgf_good_sell_holder_market_trigger = {
			ROUTE = scope:tgf_goodsell_route_temp
			GOOD = $GOOD$
		}
		gdp_tgf_good_sell_pool_market_trigger = {
			ROUTE = scope:tgf_goodsell_route_temp
			GOOD = $GOOD$
		}
		gdp_tgf_gruit_market_trigger = yes
	}
}

# Gives root Hop Trader, or its renowned version when renowned in scope:tgf_category, upgrading an existing plain one
scripted_effect gdp_tgf_add_hop_trader_effect = {
	if = {
		limit = { NOT = { has_character_modifier = gdp_tgf_hop_trader_renowned_modifier } }
		if = {
			limit = { gdp_tgf_root_renowned_in_event_category_trigger = yes }
			remove_character_modifier = gdp_tgf_hop_trader_modifier
			add_character_modifier = gdp_tgf_hop_trader_renowned_modifier
		}
		else_if = {
			limit = { NOT = { has_character_modifier = gdp_tgf_hop_trader_modifier } }
			add_character_modifier = gdp_tgf_hop_trader_modifier
		}
	}
}

# Gruit or Hops
gdp_trade_good_flavor.3031 = {
	type = character_event
	title = gdp_trade_good_flavor.3031.t
	desc = gdp_trade_good_flavor.3031.desc
	theme = trade
	override_background = { reference = tavern }

	left_portrait = {
		character = root
		animation = toast_goblet
		camera = camera_event_left
	}
	right_portrait = {
		character = scope:tgf_brewer
		animation = drink_goblet
		camera = camera_event_right
	}
	lower_right_portrait = {
		character = scope:tgf_market_holder
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 50 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		any_trade_route = {
			gdp_tgf_good_sell_holder_pool_route_trigger = { GOOD = trade_good_beer }
		}
	}

	immediate = {
		random_trade_route = {
			limit = {
				gdp_tgf_good_sell_holder_pool_route_trigger = { GOOD = trade_good_beer }
			}
			save_scope_as = tgf_route
		}
		scope:tgf_route = {
			random_trade_market_on_route = {
				limit = {
					gdp_tgf_good_sell_holder_market_trigger = {
						ROUTE = scope:tgf_route
						GOOD = trade_good_beer
					}
					gdp_tgf_good_sell_pool_market_trigger = {
						ROUTE = scope:tgf_route
						GOOD = trade_good_beer
					}
					gdp_tgf_gruit_market_trigger = yes
				}
				save_scope_as = tgf_market
			}
		}
		scope:tgf_market = {
			trade_market_owner = {
				holder = { save_scope_as = tgf_market_holder }
				title_province = {
					save_scope_as = tgf_source_province
					county = { save_scope_as = tgf_source_county }
				}
			}
		}
		random_pool_character = {
			province = scope:tgf_source_province
			limit = {
				is_healthy = yes
				has_no_particular_noble_roots_trigger = yes
				is_physically_able_adult = yes
			}
			save_scope_as = tgf_brewer
		}
		trade_good_type:trade_good_beer = {
			save_scope_as = tgf_good
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		gdp_tgf_set_background_location_effect = {
			CHAR = scope:tgf_brewer
			PROVINCE = scope:tgf_market.trade_market_owner.title_province
		}
	}

	option = {
		name = gdp_trade_good_flavor.3031.a
		add_prestige = minor_prestige_loss
		gdp_tgf_add_hop_trader_effect = yes
		scope:tgf_market_holder = {
			add_opinion = {
				target = root
				modifier = annoyed_opinion
				opinion = -20
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = content factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3031.b
		scope:tgf_market = {
			add_price_modifier_for_character = {
				type = sell_mult
				character = root
				trade_good_type = scope:tgf_good
				value = { value = 0.01 multiply = gdp_tgf_renown_tier_value }
				years = 10
			}
		}
		scope:tgf_market_holder = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 20
			}
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = ambitious factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3031.c
		gdp_increase_trade_expertise_xp_effect = {
			CATEGORY = scope:tgf_category
			VALUE = trade_expertise_xp_major_value
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = stubborn factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}

# this = province where get_region_fruit_plural knows a regional fruit
scripted_trigger gdp_tgf_has_region_fruit_trigger = {
	OR = {
		geographical_region = world_africa
		geographical_region = world_africa_north
		geographical_region = world_africa_sahara
		geographical_region = world_asia_china
		geographical_region = world_asia_japan
		geographical_region = world_asia_korea
		geographical_region = world_asia_minor
		geographical_region = world_asia_sakhalin_hokkaido
		geographical_region = world_asia_southeast
		geographical_region = world_europe
		geographical_region = world_europe_south
		geographical_region = world_himalaya
		geographical_region = world_india
		geographical_region = world_middle_east
		geographical_region = world_steppe
		geographical_region = world_steppe_west
		geographical_region = world_tibet
	}
}

# A Basket of Fruit
gdp_trade_good_flavor.3032 = {
	type = character_event
	title = gdp_trade_good_flavor.3032.t
	desc = gdp_trade_good_flavor.3032.desc
	theme = trade
	override_background = { reference = market }

	left_portrait = {
		character = root
		animation = eating
		camera = camera_event_left
	}

	widget = {
		gui = "event_window_widget_trade_good"
		container = "custom_widgets_container"
	}

	cooldown = { years = 50 }

	trigger = {
		is_available_allow_travelling = yes
		gdp_tgf_eligible_trigger = yes
		exists = location.county
		location = { gdp_tgf_has_region_fruit_trigger = yes }
	}

	immediate = {
		location = {
			save_scope_as = tgf_fruit_province
			county = { save_scope_as = tgf_source_county }
		}
		trade_good_type:trade_good_fruit = {
			save_scope_as = tgf_good
			trade_good_need_category = { save_scope_as = tgf_category }
		}
		gdp_tgf_set_widget_good_effect = { GOOD = scope:tgf_good }
		gdp_tgf_set_background_location_effect = {
			CHAR = root
			PROVINCE = scope:tgf_fruit_province
		}
	}

	option = {
		name = gdp_trade_good_flavor.3032.a
		add_character_modifier = {
			modifier = gdp_tgf_eye_for_fruit_modifier
			years = 20
		}
		ai_chance = {
			base = 100
			modifier = { has_trait = content factor = 0 }
		}
	}

	option = {
		name = gdp_trade_good_flavor.3032.b
		add_stress = minor_stress_loss
		ai_chance = {
			base = 100
			modifier = { has_trait = temperate factor = 0 }
		}
	}

	after = {
		gdp_tgf_clear_widget_good_effect = yes
	}
}
