namespace = SNW

# 10 join
# 11 AI join
# 12 Rank UP
# 13 shopping 
# 14 Invest
# 15 Loan
# 16 Impulse
# 17 Sheep scam
# 18 Stalls
# 19 Caravan
# 20 Sell ingredients/goods when not in society
# 21 Loot goods
# 22 Bad stewardship modifier events 
# 23 warehouse thief
# 24 AI sabotage
# 25 Trader trait
# 26 Master Trader Title
# 27 Contact artisans
# 28 Intro events
# 29 Holo
# 30 Tombola
# 31 MISSION: Apprentice
# 32 MISSION: Warehouse
# 33 MISSION: Delivery
# 34 Center of Trade
# 35 AI-Request Asset for Gold and sell rank 1 goods
# 36 MISSION: Build a City
# 37 mapmode
# 38 market crash
# 39 resource
# 40 apprentice flavor
# 41 MISSION: Focus business
# 42 MISSION: Send Caravan
# 43 Liege mad at new republic
# 44 Offer to buy
# 45 Remove traitor flag
# 99 Debug

########################JOINING############################

#From on_character_ask_to_join_society
character_event = {
    id = SNW.100
	hide_window = yes
    is_triggered_only = yes
    trigger = {
    	FROM = { leader = { society_member_of = the_guilds } }
    }
    immediate = {
    	FROM = { leader = { character_event = { id = SNW.101 } } }
    }
}

#Ping event
character_event = {
    id = SNW.101
	hide_window = yes
    is_triggered_only = yes
    immediate = {
    	FROM = { letter_event = { id = SNW.102 } }
    }
}

#Welcome letter
letter_event = {
    id = SNW.102
    desc = EVTDESC_SNW_102 #Shamefully borrowing from the Pomandres
    border = GFX_event_letter_frame_economy_guilds
	
    is_triggered_only = yes

    option = {
        name = EVTOPTA_SNW_102
		wealth = 1
		wealth = -1
		join_society = the_guilds
    }
    option = {
        name = EVTOPTB_SNW_102
    }
}

########################AI JOIN###########################

character_event = {
	id = SNW.110
	hide_window = yes
	
	only_rulers = yes
	is_triggered_only = yes
	
	
	immediate = {
		if = {
			limit = {
				ai = yes
				prisoner = no
				NOT = { trait = incapable }
				is_in_society = yes
				society_rank <= 3
				society_can_rank_up = yes
			}
			random_list = {
				75 = {}
				25 = {
					modifier = {
						factor = 3
						society_rank = 1
					}
					society_rank_up = 1					
				}
			}
		}
		if = {
			limit = {
				ai = yes
				prisoner = no
				NOT = { trait = incapable }
				is_adult = yes
				is_in_society = no
				controls_religion = no
				block_general_event_trigger = no
			}
			character_event = { id = SNW.111 }
		}
	}
}

character_event = {
	id = SNW.111
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		random_list = {
			90 = { # do nothing
				modifier = {
					factor = 1.5
					OR = {
						is_tribal = yes
						is_nomadic = yes
					}
				}
				modifier = {
					factor = 2
					society_influence = {
						society = the_guilds
						value <= 20
					}
				}
				modifier = {
					factor = 1.5
					society_influence = {
						society = the_guilds
						value >= 21
						value <= 40
					}
				}
				modifier = {
					factor = 0.75
					society_influence = {
						society = the_guilds
						value >= 61
						value >= 80
					}
				}
				modifier = {
					factor = 0.5
					society_influence = {
						society = the_guilds
						value >= 81
					}
				}
			}
			10 = { # try to join a society
				modifier = {
					factor = 2
					higher_tier_than = BARON
				}
				modifier = {
					factor = 0.5
					tier  = KING
				}
				modifier = {
					factor = 0.5
					tier = EMPEROR
				}
				trigger = {
					can_join_society = the_guilds
				}
				modifier = {
					factor = 5
					is_dumb_trigger = no
					OR = { 
					stewardship = 15
					has_focus = focus_business
					trait = indulgent_wastrel
					trait = thrifty_clerk
					trait = fortune_builder
					trait = midas_touched
					is_republic = yes
					is_patrician = yes
					}
				}
				modifier = {
					factor = 0
					is_landed = no
				}
				join_society = the_guilds
				if = {
					limit = {
						NOT = {
							society = {
								any_society_member = {
									is_society_grandmaster = yes
								}
							}
						}
					}
					set_society_grandmaster = yes
				}
			}
		}
	}
}

#######################Rank UP#############################

#Hidden start: Send the rank-up request to the current Grandmaster (delayed event on self, from decision to rank up)
character_event = {
	id = SNW.120

	hide_window = yes

	trigger = {
		has_character_flag = has_sent_request_to_rank_up
	}
	
	is_triggered_only = yes

	immediate = {
		if = {
			limit = { is_in_society = yes }
			random_society_member = {
				limit = {
					is_society_grandmaster = yes
					same_society_as = ROOT
				}
				character_event = { id = SNW.121 } # send request to Grand Master.
			}
		}
		if = {
			limit = { is_in_society = no }
			clr_character_flag = has_sent_request_to_rank_up
		}
	}
}

#Grandmaster gets the rank-up request
character_event = {
	id = SNW.121
	
	hide_window = yes

	is_triggered_only = yes

	immediate = {
		event_target:rank_up_target = { letter_event = { id = SNW.122 } }
	}
}

#Grand master approves my request
letter_event = {
	id = SNW.122
	desc = EVTDESC_SNW_122
	border = GFX_event_letter_frame_economy_guilds

	trigger = {
		society_rank < 4
		has_character_flag = has_sent_request_to_rank_up
	}
	
	is_triggered_only = yes

	#Yes
	option = {
		name = {
			text = EVTOPTA_SNW_122
		}
		if = { limit = { society_rank < 4 } 
			society_rank_up = 1
		}
		clr_character_flag = has_sent_request_to_rank_up
	}
}

#########################EVENTS##############################

#Start of market events
character_event = {
	id = SNW.130
	desc = EVTDESC_SNW_130
	picture = GFX_evt_carriage
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = {
		name = EVTOPTA_SNW_130
		hidden_tooltip = {
			
			random_list = {
				40 = { #Buy / Sell
					character_event = { id = SNW.1300 }
				}
				20 = { #Impulse buy/ Sell
					character_event = { id = SNW.160 }
				}
				10 = { #Too good of a deal
					character_event = { id = SNW.170 }
				}
				20 = { #Invest
					modifier = {
						factor = 0
						has_character_flag = guilds_invested
					}
					random_list = {
					25 = { character_event = { id = SNW.140 } }
					25 = { character_event = { id = SNW.141 } } 
					25 = { character_event = { id = SNW.142 } }
					25 = { character_event = { id = SNW.143 } }
					}
					set_character_flag = guilds_invested
				}
				
				1 = { #thief guild
					modifier = {
						factor = 0
						has_character_modifier = guilds_thieves_guild_cooldown
					}
					character_event = { id = SNW.2200 }
				}
				1 = { #highway robber
					modifier = {
						factor = 0
						has_character_modifier = guilds_highway_robber_band_cooldown
					}
					character_event = { id = SNW.2210 }
				}
				1 = { #highway robber
					modifier = {
						factor = 0
						has_character_modifier = guilds_smugglers_ring_cooldown
					}
					character_event = { id = SNW.2220  }
				}
				5 = { #Holo
					modifier = {
						factor = 0
						OR = {
							ai = yes
							has_global_flag = guilds_holo_spawned
							has_character_flag = guilds_met_holo
							has_game_rule = {
								name = supernatural_events
								value = off
							}
						}
					}
					set_global_flag = guilds_holo_spawned
					character_event = { id = SNW.290 }
				}
				#gamble
				#you steal
				#
				#
			}
			if = {
				limit = {
					ai = no
					has_character_flag = guilds_met_holo
				}
				random_list = {
					50 = { #get random holo event 100% of the time unless
						any_courtier = {
							limit = { has_character_flag = guilds_is_holo }
							hidden_tooltip = { character_event = { id = SNW.291 } }
						}
					}
					50 = { #you completed the chain, then it's 50/50
						trigger = { 
							any_courtier = {
								has_character_flag = guilds_is_holo
								OR = { 
									has_character_flag = guilds_holo_alone
									has_character_flag = guilds_holo_lover
								}
							}
						}
					}
				}
			}
		}
	}
}

#Shopping Buy Sell split
character_event = {
	id = SNW.1300
	desc = EVTDESC_SNW_1300
	picture = GFX_evt_market
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes


	option = { #Buy
		name = EVTOPTA_SNW_1300
		character_event = { id = SNW.131 }
	}
	option = { #Sell
		name = EVTOPTB_SNW_1300
		character_event = { id = SNW.1315 }
		ai_chance = {
			factor = 0
		}
	}
}

#Shopping Buy
character_event = {
	id = SNW.131
	desc = EVTDESC_SNW_131
	picture = GFX_evt_market
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #Metal
		name = EVTOPTA_SNW_131
		character_event = { id = SNW.1310 }
	}
	option = { #Vegetal
		name = EVTOPTB_SNW_131
		character_event = { id = SNW.1311  }
	}
	option = { #Animal
		name = EVTOPTC_SNW_131
		character_event = { id = SNW.1312 }
	}
	option = { #Goods
		name = EVTOPTD_SNW_131
		character_event = { id = SNW.1313 }
	}
}

#Shopping buy metal
character_event = {
	id = SNW.1310
	desc = EVTDESC_SNW_1310
	picture = GFX_evt_market
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

		immediate = {
		random_list = { #A
			20 = {
				set_character_flag = guilds_shopping_item_a_1
			}
			20 = {
				set_character_flag = guilds_shopping_item_b_1
			}
			20 = {
				set_character_flag = guilds_shopping_item_c_1
			}
			20 = {
				set_character_flag = guilds_shopping_item_d_1
			}
			20 = {
				set_character_flag = guilds_shopping_item_e_1
			}
		}
		random_list = { #B
			20 = {
				set_character_flag = guilds_shopping_item_a_2
			}
			20 = {
				set_character_flag = guilds_shopping_item_b_2
			}
			20 = {
				set_character_flag = guilds_shopping_item_c_2
			}
			20 = {
				set_character_flag = guilds_shopping_item_d_2
			}
			20 = {
				set_character_flag = guilds_shopping_item_e_2
			}
		}
		random_list = { #C
			20 = {
				set_character_flag = guilds_shopping_item_a_3
			}
			20 = {
				set_character_flag = guilds_shopping_item_b_3
			}
			20 = {
				set_character_flag = guilds_shopping_item_c_3
			}
			20 = {
				set_character_flag = guilds_shopping_item_d_3
			}
			20 = {
				set_character_flag = guilds_shopping_item_e_3
			}
		}
		random_list = { #prices
			20 = {
				set_character_flag = guilds_shopping_price_1
			}
			20 = {
				set_character_flag = guilds_shopping_price_2
			}
			20 = {
				set_character_flag = guilds_shopping_price_3
			}
			20 = {
				set_character_flag = guilds_shopping_price_4
			}
			20 = {
				set_character_flag = guilds_shopping_price_5
			}
		}
	}
	
	option = { 
		name = {
			text = EVTOPTA_SNW_1310
				trigger = { has_character_flag = guilds_shopping_item_a_1 }
		}
		name = {
			text = EVTOPTB_SNW_1310
				trigger = { has_character_flag = guilds_shopping_item_b_1 }
		}
		name = {
			text = EVTOPTC_SNW_1310
				trigger = { has_character_flag = guilds_shopping_item_c_1 }
		}
		name = {
			text = EVTOPTD_SNW_1310
				trigger = { has_character_flag = guilds_shopping_item_d_1 }
		}
		name = {
			text = EVTOPTE_SNW_1310
				trigger = { has_character_flag = guilds_shopping_item_e_1 }
		}
		ai_chance = {
		factor = 1
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 0.25
					wealth = 25
				}
			has_character_flag = guilds_shopping_item_a_1
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 0.50
					wealth = 50
				}
			has_character_flag = guilds_shopping_item_b_1
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 0.75
					wealth = 75
				}
			has_character_flag = guilds_shopping_item_c_1
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 1
					wealth = 100
				}
			has_character_flag = guilds_shopping_item_d_1
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 1.25
					wealth = 125
				}
			has_character_flag = guilds_shopping_item_e_1
			}
		}
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_shopping_item_a_1 = {
				add_artifact = guilds_item_stone
				custom_tooltip = { text = guilds_item_stone_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.05 min = -5 max = -50 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.10 min = -10 max = -100 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.15 min = -15 max = -150 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.20 min = -20 max = -200 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.25 min = -25 max = -250 } }
				}					
				if = {
					limit = { location = { has_settlement_construction = yes } }
					custom_tooltip = { text = guilds_goods_bonus_construction_tooltip }
					scaled_wealth = { value = -0.05 min = -5 max = -50 } #construction bonus
				}
				if = {
					limit = {
						location = {
							OR = {
								terrain = hills
								terrain = mountain
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
					scaled_wealth = { value = 0.02 min = 2 max = 20 } #terrain malus
				}
				if = {
					limit = {
						location = {
							OR = {
								terrain = jungle
								terrain = steppe
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
					scaled_wealth = { value = -0.02 min = -2 max = -20 } #terrain bonus
				}
			}
			guilds_shopping_item_b_1 = {
				add_artifact = guilds_item_steel
				custom_tooltip = { text = guilds_item_steel_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.30 min = -30 max = -300 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.35 min = -35 max = -350 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.40 min = -40 max = -400 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.45 min = -45 max = -450 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.50 min = -50 max = -500 } }
				}					
				if = {
					limit = { 
						has_dlc = "Reapers"
						location = {
							NOR = {
								has_province_modifier = prosperity_modifier_1
								has_province_modifier = prosperity_modifier_2
								has_province_modifier = prosperity_modifier_3
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = 0.05 min = 5 max = 50 } #prosperity malus
				}
				if = {
					limit = {
						location = {
							OR = {
								terrain = farmlands
								terrain = plains
								terrain = forest
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
					scaled_wealth = { value = -0.05 min = -5 max = -50 } #terrain bonus
				}
				if = {
					limit = { location = { owner = { war = yes } } }
					custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
					scaled_wealth = { value = -0.1 min = -10 max = -100 } #war bonus
				}
			}
			guilds_shopping_item_c_1 = {
				add_artifact = guilds_item_gem
				custom_tooltip = { text = guilds_item_gem_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.55 min = -55 max = -550 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.60 min = -60 max = -600 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.65 min = -65 max = -650 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.70 min = -70 max = -700 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.75 min = -75 max = -750 } }
				}					
				if = { 
					limit = { 
						has_dlc = "Reapers"
						location = { 
							has_province_modifier = prosperity_modifier_2 
						} 
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity bonus
				}
				if = { 
					limit = { 
						has_dlc = "Reapers"
						location = { 
							OR = {
								has_province_modifier = prosperity_modifier_3
								has_province_modifier = prosperity_modifier_1
							}
						} 
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = -0.05 min = -5 max = -50 } #prosperity bonus
				}
				if = {
					limit = { 
						has_dlc = "Reapers"
						location = {
							OR = {
								has_province_modifier = depopulated_1
								has_province_modifier = depopulated_2
								has_province_modifier = depopulated_3
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity malus
				}
				if = {
					limit = {
						location = {
							OR = {
								terrain = hills
								terrain = mountain
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
					scaled_wealth = { value = 0.125 min = 12 max = 125 } #terrain malus
				}
				if = {
					limit = { location = { has_epidemic = yes } }
					custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
					scaled_wealth = { value = -0.05 min = -5 max = -50 } #epidemic bonus
				}
			}
			guilds_shopping_item_d_1 = {
				add_artifact = guilds_item_silver
				custom_tooltip = { text = guilds_item_silver_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.80 min = -80 max = -800 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.85 min = -85 max = -850 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.90 min = -90 max = -900 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.95 min = -95 max = -950 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -1 min = -100 max = -1000 } }
				}					
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.2 min = 20 max = 200 } #prosperity malus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								NOR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
									has_province_modifier = prosperity_modifier_1
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = hills
									terrain = mountain
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.15 min = 15 max = 150 } #terrain malus
					}
					if = {
						limit = { location = { has_epidemic = yes } }
						custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
						scaled_wealth = { value = -0.20 min = -20 max = -200 } #epidemic bonus
					}
			}
			guilds_shopping_item_e_1 = {
				add_artifact = guilds_item_gold
				custom_tooltip = { text = guilds_item_gold_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = -1.05 min = -105 max = -1050 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -1.1 min = -110 max = -1100 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -1.15 min = -115 max = -1150 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -1.2 min = -120 max = -1200 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -1.25 min = -125 max = -1250 } }
				}					
				if = {
					limit = { 
						has_dlc = "Reapers"
						location = {
							OR = {
								has_province_modifier = depopulated_1
								has_province_modifier = depopulated_2
								has_province_modifier = depopulated_3
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = 0.35 min = 350 max = 350 } #prosperity malus
				}
				if = {
					limit = { 
						has_dlc = "Reapers"
						location = {
							OR = {
								has_province_modifier = prosperity_modifier_2
								has_province_modifier = prosperity_modifier_3
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity bonus
				}
				if = {
					limit = { location = { has_epidemic = yes } }
					custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
					scaled_wealth = { value = 0.1 min = 10 max = 100 } #epidemic malus
				}
				if = {
					limit = { location = { owner = { war = yes } } }
					custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
					scaled_wealth = { value = 0.2 min = 20 max = 200 } #war malus
				}
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		name = {
			text = EVTOPTA_SNW_1310
				trigger = { has_character_flag = guilds_shopping_item_a_2 }
		}
		name = {
			text = EVTOPTB_SNW_1310
				trigger = { has_character_flag = guilds_shopping_item_b_2 }
		}
		name = {
			text = EVTOPTC_SNW_1310
				trigger = { has_character_flag = guilds_shopping_item_c_2 }
		}
		name = {
			text = EVTOPTD_SNW_1310
				trigger = { has_character_flag = guilds_shopping_item_d_2 }
		}
		name = {
			text = EVTOPTE_SNW_1310
				trigger = { has_character_flag = guilds_shopping_item_e_2 }
		}
		ai_chance = {
		factor = 1
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 0.25
					wealth = 25
				}
			has_character_flag = guilds_shopping_item_a_2
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 0.50
					wealth = 50
				}
			has_character_flag = guilds_shopping_item_b_2
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 0.75
					wealth = 75
				}
			has_character_flag = guilds_shopping_item_c_2
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 1
					wealth = 100
				}
			has_character_flag = guilds_shopping_item_d_2
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 1.25
					wealth = 125
				}
			has_character_flag = guilds_shopping_item_e_2
			}
		}
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_shopping_item_a_2 = {
				add_artifact = guilds_item_stone
				custom_tooltip = { text = guilds_item_stone_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.05 min = -5 max = -50 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.10 min = -10 max = -100 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.15 min = -15 max = -150 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.20 min = -20 max = -200 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.25 min = -25 max = -250 } }
				}					
				if = {
					limit = { location = { has_settlement_construction = yes } }
					custom_tooltip = { text = guilds_goods_bonus_construction_tooltip }
					scaled_wealth = { value = -0.05 min = -5 max = -50 } #construction bonus
				}
				if = {
					limit = {
						location = {
							OR = {
								terrain = hills
								terrain = mountain
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
					scaled_wealth = { value = 0.02 min = 2 max = 20 } #terrain malus
				}
				if = {
					limit = {
						location = {
							OR = {
								terrain = jungle
								terrain = steppe
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
					scaled_wealth = { value = -0.02 min = -2 max = -20 } #terrain bonus
				}
			}
			guilds_shopping_item_b_2 = {
				add_artifact = guilds_item_steel
				custom_tooltip = { text = guilds_item_steel_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.30 min = -30 max = -300 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.35 min = -35 max = -350 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.40 min = -40 max = -400 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.45 min = -45 max = -450 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.50 min = -50 max = -500 } }
				}		
				if = {
					limit = { 
						has_dlc = "Reapers"
						location = {
							NOR = {
								has_province_modifier = prosperity_modifier_1
								has_province_modifier = prosperity_modifier_2
								has_province_modifier = prosperity_modifier_3
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = 0.05 min = 5 max = 50 } #prosperity malus
				}
				if = {
					limit = {
						location = {
							OR = {
								terrain = farmlands
								terrain = plains
								terrain = forest
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
					scaled_wealth = { value = -0.05 min = -5 max = -50 } #terrain bonus
				}
				if = {
					limit = { location = { owner = { war = yes } } }
					custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
					scaled_wealth = { value = -0.1 min = -10 max = -100 } #war bonus
				}
			}
			guilds_shopping_item_c_2 = {
				add_artifact = guilds_item_gem
				custom_tooltip = { text = guilds_item_gem_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.55 min = -55 max = -550 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.60 min = -60 max = -600 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.65 min = -65 max = -650 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.70 min = -70 max = -700 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.75 min = -75 max = -750 } }
				}					
				if = { 
					limit = { 
						has_dlc = "Reapers"
						location = { 
							has_province_modifier = prosperity_modifier_2 
						} 
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity bonus
				}
				if = { 
					limit = { 
						has_dlc = "Reapers"
						location = { 
							OR = {
								has_province_modifier = prosperity_modifier_3
								has_province_modifier = prosperity_modifier_1
							}
						} 
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = -0.05 min = -5 max = -50 } #prosperity bonus
				}
				if = {
					limit = { 
						has_dlc = "Reapers"
						location = {
							OR = {
								has_province_modifier = depopulated_1
								has_province_modifier = depopulated_2
								has_province_modifier = depopulated_3
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity malus
				}
				if = {
					limit = {
						location = {
							OR = {
								terrain = hills
								terrain = mountain
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
					scaled_wealth = { value = 0.125 min = 12 max = 125 } #terrain malus
				}
				if = {
					limit = { location = { has_epidemic = yes } }
					custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
					scaled_wealth = { value = -0.05 min = -5 max = -50 } #epidemic bonus
				}
			}
			guilds_shopping_item_d_2 = {
				add_artifact = guilds_item_silver
				custom_tooltip = { text = guilds_item_silver_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.80 min = -80 max = -800 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.85 min = -85 max = -850 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.90 min = -90 max = -900 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.95 min = -95 max = -950 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -1 min = -100 max = -1000 } }
				}					
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.2 min = 20 max = 200 } #prosperity malus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								NOR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
									has_province_modifier = prosperity_modifier_1
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = hills
									terrain = mountain
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.15 min = 15 max = 150 } #terrain malus
					}
					if = {
						limit = { location = { has_epidemic = yes } }
						custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
						scaled_wealth = { value = -0.20 min = -20 max = -200 } #epidemic bonus
					}
			}
			guilds_shopping_item_e_2 = {
				add_artifact = guilds_item_gold
				custom_tooltip = { text = guilds_item_gold_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_3 = { scaled_wealth = { value = -1.05 min = -105 max = -1050 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -1.1 min = -110 max = -1100 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -1.15 min = -115 max = -1150 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -1.2 min = -120 max = -1200 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -1.25 min = -125 max = -1250 } }
				}					
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.35 min = 350 max = 350 } #prosperity malus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity bonus
					}
					if = {
						limit = { location = { has_epidemic = yes } }
						custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #epidemic malus
					}
					if = {
						limit = { location = { owner = { war = yes } } }
						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = 0.2 min = 20 max = 200 } #war malus
					}
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		name = {
			text = EVTOPTA_SNW_1310
				trigger = { has_character_flag = guilds_shopping_item_a_3 }
		}
		name = {
			text = EVTOPTB_SNW_1310
				trigger = { has_character_flag = guilds_shopping_item_b_3 }
		}
		name = {
			text = EVTOPTC_SNW_1310
				trigger = { has_character_flag = guilds_shopping_item_c_3 }
		}
		name = {
			text = EVTOPTD_SNW_1310
				trigger = { has_character_flag = guilds_shopping_item_d_3 }
		}
		name = {
			text = EVTOPTE_SNW_1310
				trigger = { has_character_flag = guilds_shopping_item_e_3 }
		}
		ai_chance = {
		factor = 1
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 0.25
					wealth = 25
				}
			has_character_flag = guilds_shopping_item_a_3
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 0.50
					wealth = 50
				}
			has_character_flag = guilds_shopping_item_b_3
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 0.75
					wealth = 75
				}
			has_character_flag = guilds_shopping_item_c_3
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 1
					wealth = 100
				}
			has_character_flag = guilds_shopping_item_d_3
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 1.25
					wealth = 125
				}
			has_character_flag = guilds_shopping_item_e_3
			}
		}
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_shopping_item_a_3 = {
				add_artifact = guilds_item_stone
				custom_tooltip = { text = guilds_item_stone_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.05 min = -5 max = -50 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.10 min = -10 max = -100 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.15 min = -15 max = -150 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.20 min = -20 max = -200 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.25 min = -25 max = -250 } }
				}					
				if = {
					limit = { location = { has_settlement_construction = yes } }
					custom_tooltip = { text = guilds_goods_bonus_construction_tooltip }
					scaled_wealth = { value = -0.05 min = -5 max = -50 } #construction bonus
				}
				if = {
					limit = {
						location = {
							OR = {
								terrain = hills
								terrain = mountain
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
					scaled_wealth = { value = 0.02 min = 2 max = 20 } #terrain malus
				}
				if = {
					limit = {
						location = {
							OR = {
								terrain = jungle
								terrain = steppe
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
					scaled_wealth = { value = -0.02 min = -2 max = -20 } #terrain bonus
				}
			}
			guilds_shopping_item_b_3 = {
				add_artifact = guilds_item_steel
				custom_tooltip = { text = guilds_item_steel_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.30 min = -30 max = -300 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.35 min = -35 max = -350 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.40 min = -40 max = -400 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.45 min = -45 max = -450 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.50 min = -50 max = -500 } }
				}					
				if = {
					limit = { 
						has_dlc = "Reapers"
						location = {
							NOR = {
								has_province_modifier = prosperity_modifier_1
								has_province_modifier = prosperity_modifier_2
								has_province_modifier = prosperity_modifier_3
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = 0.05 min = 5 max = 50 } #prosperity malus
				}
				if = {
					limit = {
						location = {
							OR = {
								terrain = farmlands
								terrain = plains
								terrain = forest
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
					scaled_wealth = { value = -0.05 min = -5 max = -50 } #terrain bonus
				}
				if = {
					limit = { location = { owner = { war = yes } } }
					custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
					scaled_wealth = { value = -0.1 min = -10 max = -100 } #war bonus
				}
			}
			guilds_shopping_item_c_3 = {
				add_artifact = guilds_item_gem
				custom_tooltip = { text = guilds_item_gem_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.55 min = -55 max = -550 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.60 min = -60 max = -600 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.65 min = -65 max = -650 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.70 min = -70 max = -700 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.75 min = -75 max = -750 } }
				}					
					if = { 
						limit = { 
							has_dlc = "Reapers"
							location = { 
								has_province_modifier = prosperity_modifier_2 
							} 
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity bonus
					}
					if = { 
						limit = { 
							has_dlc = "Reapers"
							location = { 
								OR = {
									has_province_modifier = prosperity_modifier_3
									has_province_modifier = prosperity_modifier_1
								}
							} 
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.05 min = -5 max = -50 } #prosperity bonus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = hills
									terrain = mountain
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.125 min = 12 max = 125 } #terrain malus
					}
					if = {
						limit = { location = { has_epidemic = yes } }
						custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
						scaled_wealth = { value = -0.05 min = -5 max = -50 } #epidemic bonus
					}
			}
			guilds_shopping_item_d_3 = {
				add_artifact = guilds_item_silver
				custom_tooltip = { text = guilds_item_silver_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.80 min = -80 max = -800 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.85 min = -85 max = -850 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.90 min = -90 max = -900 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.95 min = -95 max = -950 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -1 min = -100 max = -1000 } }
				}					
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.2 min = 20 max = 200 } #prosperity malus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								NOR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
									has_province_modifier = prosperity_modifier_1
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = hills
									terrain = mountain
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.15 min = 15 max = 150 } #terrain malus
					}
					if = {
						limit = { location = { has_epidemic = yes } }
						custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
						scaled_wealth = { value = -0.20 min = -20 max = -200 } #epidemic bonus
					}
			}
			guilds_shopping_item_e_3 = {
				add_artifact = guilds_item_gold
				custom_tooltip = { text = guilds_item_gold_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_5 = { scaled_wealth = { value = -1.05 min = -105 max = -1050 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -1.1 min = -110 max = -1100 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -1.15 min = -115 max = -1150 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -1.2 min = -120 max = -1200 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -1.25 min = -125 max = -1250 } }
				}					
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.35 min = 350 max = 350 } #prosperity malus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity bonus
					}
					if = {
						limit = { location = { has_epidemic = yes } }
						custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #epidemic malus
					}
					if = {
						limit = { location = { owner = { war = yes } } }
						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = 0.2 min = 20 max = 200 } #war malus
					}
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		name = EVTOPTZ_SNW_1310
		ai_chance = {
		factor = 0.5
		}

	}
	after = { 
	clr_character_flag = guilds_shopping_price_1
	clr_character_flag = guilds_shopping_price_2
	clr_character_flag = guilds_shopping_price_3
	clr_character_flag = guilds_shopping_price_4
	clr_character_flag = guilds_shopping_price_5
	clr_character_flag = guilds_shopping_item_a_1
	clr_character_flag = guilds_shopping_item_b_1
	clr_character_flag = guilds_shopping_item_c_1
	clr_character_flag = guilds_shopping_item_d_1
	clr_character_flag = guilds_shopping_item_e_1
	clr_character_flag = guilds_shopping_item_a_2
	clr_character_flag = guilds_shopping_item_b_2
	clr_character_flag = guilds_shopping_item_c_2
	clr_character_flag = guilds_shopping_item_d_2
	clr_character_flag = guilds_shopping_item_e_2
	clr_character_flag = guilds_shopping_item_a_3
	clr_character_flag = guilds_shopping_item_b_3
	clr_character_flag = guilds_shopping_item_c_3
	clr_character_flag = guilds_shopping_item_d_3
	clr_character_flag = guilds_shopping_item_e_3
	}
}

#Shopping buy vegetal
character_event = {
	id = SNW.1311
	desc = EVTDESC_SNW_1311
	picture = GFX_evt_market
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

		immediate = {
		random_list = { #A
			20 = {
				set_character_flag = guilds_shopping_item_a_1
			}
			20 = {
				set_character_flag = guilds_shopping_item_b_1
			}
			20 = {
				set_character_flag = guilds_shopping_item_c_1
			}
			20 = {
				set_character_flag = guilds_shopping_item_d_1
			}
			20 = {
				set_character_flag = guilds_shopping_item_e_1
			}
		}
		random_list = { #B
			20 = {
				set_character_flag = guilds_shopping_item_a_2
			}
			20 = {
				set_character_flag = guilds_shopping_item_b_2
			}
			20 = {
				set_character_flag = guilds_shopping_item_c_2
			}
			20 = {
				set_character_flag = guilds_shopping_item_d_2
			}
			20 = {
				set_character_flag = guilds_shopping_item_e_2
			}
		}
		random_list = { #C
			20 = {
				set_character_flag = guilds_shopping_item_a_3
			}
			20 = {
				set_character_flag = guilds_shopping_item_b_3
			}
			20 = {
				set_character_flag = guilds_shopping_item_c_3
			}
			20 = {
				set_character_flag = guilds_shopping_item_d_3
			}
			20 = {
				set_character_flag = guilds_shopping_item_e_3
			}
		}
		random_list = { #prices
			20 = {
				set_character_flag = guilds_shopping_price_1
			}
			20 = {
				set_character_flag = guilds_shopping_price_2
			}
			20 = {
				set_character_flag = guilds_shopping_price_3
			}
			20 = {
				set_character_flag = guilds_shopping_price_4
			}
			20 = {
				set_character_flag = guilds_shopping_price_5
			}
		}
	}
	
	option = { 
		name = {
			text = EVTOPTA_SNW_1311
				trigger = { has_character_flag = guilds_shopping_item_a_1 }
		}
		name = {
			text = EVTOPTB_SNW_1311
				trigger = { has_character_flag = guilds_shopping_item_b_1 }
		}
		name = {
			text = EVTOPTC_SNW_1311
				trigger = { has_character_flag = guilds_shopping_item_c_1 }
		}
		name = {
			text = EVTOPTD_SNW_1311
				trigger = { has_character_flag = guilds_shopping_item_d_1 }
		}
		name = {
			text = EVTOPTE_SNW_1311
				trigger = { has_character_flag = guilds_shopping_item_e_1 }
		}
		ai_chance = {
		factor = 1
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 0.25
					wealth = 25
				}
			has_character_flag = guilds_shopping_item_a_1
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 0.50
					wealth = 50
				}
			has_character_flag = guilds_shopping_item_b_1
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 0.75
					wealth = 75
				}
			has_character_flag = guilds_shopping_item_c_1
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 1
					wealth = 100
				}
			has_character_flag = guilds_shopping_item_d_1
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 1.25
					wealth = 125
				}
			has_character_flag = guilds_shopping_item_e_1
			}
		}
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_shopping_item_a_1 = {
				add_artifact = guilds_item_grain
				custom_tooltip = { text = guilds_item_grain_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.05 min = -5 max = -50 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.10 min = -10 max = -100 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.15 min = -15 max = -150 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.20 min = -20 max = -200 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.25 min = -25 max = -250 } }
				}					
					if = {
						limit = {
							has_dlc = "Reapers"
							location = { 
								OR = { 
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.10 min = -10 max = -100 } #prosperity bonus
					}
					if = {
						limit = {
							location = {
								terrain = farmlands
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.015 min = 1 max = 15 } #terrain malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = plains
									terrain = steppe 
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.01 min = 1 max = 10 } #terrain malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = desert
									terrain = mountain
									terrain = arctic
									is_winter = yes
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.015 min = -1 max = -15 } #terrain bonus
					}
					if = {
						limit = { location = { owner = { war = yes } } }
						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = -0.025 min = -2 max = -25 } #war bonus
					}
					if = {
						limit = { 
							location = { 
								owner = {
									or = {
										has_character_modifier = guilds_buff_feast
										has_character_modifier = fabulous_feast
										has_character_modifier = holding_large_feast
										has_character_modifier = holding_diwali_feast 
										has_character_modifier = holding_kali_puja_feast
										has_character_modifier = holding_zun_feast
										has_character_flag = holding_blot
										has_character_flag = holding_ukon_juhla
										has_character_flag = holding_uzgavenes
										has_character_flag = holding_jarilo
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_festivitie_tooltip }
						scaled_wealth = { value = -0.02 min = -2 max = -20 } #festivitie bonus
					}
			}
			guilds_shopping_item_b_1 = {
				add_artifact = guilds_item_lumber
				custom_tooltip = { text = guilds_item_lumber_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.30 min = -30 max = -300 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.35 min = -35 max = -350 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.40 min = -40 max = -400 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.45 min = -45 max = -450 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.50 min = -50 max = -500 } }
				}					
					if = {
						limit = { location = { has_settlement_construction = yes } }
						custom_tooltip = { text = guilds_goods_bonus_construction_tooltip }
						scaled_wealth = { value = -0.075 min = -7 max = -75 } #construction bonus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = jungle
									terrain = forest
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #terrain malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = desert
									terrain = steppe
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.05 min = -5 max = -50 } #terrain bonus
					}
			}
			guilds_shopping_item_c_1 = {
				add_artifact = guilds_item_linen
				custom_tooltip = { text = guilds_item_linen_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.55 min = -55 max = -550 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.60 min = -60 max = -600 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.65 min = -65 max = -650 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.70 min = -70 max = -700 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.75 min = -75 max = -750 } }
				}					
					if = {
						limit = { location = { has_province_modifier = guilds_buff_dye } }
						custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
						scaled_wealth = { value = -0.10 min = -10 max = -100 } #goods bonus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = { 
								OR = {
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_3
								}
							} 
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity bonus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = farmlands
									terrain = jungle
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #terrain malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = desert
									terrain = arctic
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.05 min = -5 max = -50 } #terrain bonus
					}
			}
			guilds_shopping_item_d_1 = {
				add_artifact = guilds_item_incense
				custom_tooltip = { text = guilds_item_incense_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.80 min = -80 max = -800 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.85 min = -85 max = -850 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.90 min = -90 max = -900 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.95 min = -95 max = -950 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -1 min = -100 max = -1000 } }
				}					
					if = {
						limit = { 
							location = { 
								owner = { 
									or = {
										has_character_modifier = holding_diwali_feast 
										has_character_modifier = holding_kali_puja_feast
	
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_festivitie_tooltip }
						scaled_wealth = { value = -0.15 min = -15 max = -150 } #festivitie bonus
					}
					if = {
						limit = { location = { has_epidemic = yes } }
						custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
						scaled_wealth = { value = -0.10 min = -10 max = -100 } #epidemic bonus
					}
					if = {
						limit = {
							location = {
								capital_holding = {
									holding_type = temple
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #terrain bonus
					}
			}
			guilds_shopping_item_e_1 = {
				add_artifact = guilds_item_spices
				custom_tooltip = { text = guilds_item_spices_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = -1.05 min = -105 max = -1050 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -1.1 min = -110 max = -1100 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -1.15 min = -115 max = -1150 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -1.2 min = -120 max = -1200 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -1.25 min = -125 max = -1250 } }
				}					
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.20 min = 200 max = 200 } #prosperity malus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity bonus
					}
					if = {
						limit = { 
							location = { 
								owner = {
									or = {
										has_character_modifier = guilds_buff_feast
										has_character_modifier = fabulous_feast
										has_character_modifier = holding_large_feast
										has_character_modifier = holding_diwali_feast 
										has_character_modifier = holding_kali_puja_feast
										has_character_modifier = holding_zun_feast
										has_character_flag = holding_blot
										has_character_flag = holding_ukon_juhla
										has_character_flag = holding_uzgavenes
										has_character_flag = holding_jarilo
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_festivitie_tooltip }
						scaled_wealth = { value = -0.05 min = -5 max = -50 } #festivitie bonus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = jungle
									terrain = desert
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.15 min = 15 max = 150 } #terrain malus
					}
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		name = {
			text = EVTOPTA_SNW_1311
				trigger = { has_character_flag = guilds_shopping_item_a_2 }
		}
		name = {
			text = EVTOPTB_SNW_1311
				trigger = { has_character_flag = guilds_shopping_item_b_2 }
		}
		name = {
			text = EVTOPTC_SNW_1311
				trigger = { has_character_flag = guilds_shopping_item_c_2 }
		}
		name = {
			text = EVTOPTD_SNW_1311
				trigger = { has_character_flag = guilds_shopping_item_d_2 }
		}
		name = {
			text = EVTOPTE_SNW_1311
				trigger = { has_character_flag = guilds_shopping_item_e_2 }
		}
		ai_chance = {
		factor = 1
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 0.25
					wealth = 25
				}
			has_character_flag = guilds_shopping_item_a_2
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 0.50
					wealth = 50
				}
			has_character_flag = guilds_shopping_item_b_2
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 0.75
					wealth = 75
				}
			has_character_flag = guilds_shopping_item_c_2
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 1
					wealth = 100
				}
			has_character_flag = guilds_shopping_item_d_2
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 1.25
					wealth = 125
				}
			has_character_flag = guilds_shopping_item_e_2
			}
		}
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_shopping_item_a_2 = {
				add_artifact = guilds_item_grain
				custom_tooltip = { text = guilds_item_grain_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.05 min = -5 max = -50 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.10 min = -10 max = -100 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.15 min = -15 max = -150 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.20 min = -20 max = -200 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.25 min = -25 max = -250 } }
				}					
					if = {
						limit = {
							has_dlc = "Reapers"
							location = { 
								OR = { 
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.10 min = -10 max = -100 } #prosperity bonus
					}
					if = {
						limit = {
							location = {
								terrain = farmlands
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.015 min = 1 max = 15 } #terrain malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = plains
									terrain = steppe 
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.01 min = 1 max = 10 } #terrain malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = desert
									terrain = mountain
									terrain = arctic
									is_winter = yes
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.015 min = -1 max = -15 } #terrain bonus
					}
					if = {
						limit = { location = { owner = { war = yes } } }
						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = -0.025 min = -2 max = -25 } #war bonus
					}
					if = {
						limit = { 
							location = { 
								owner = {
									or = {
										has_character_modifier = guilds_buff_feast
										has_character_modifier = fabulous_feast
										has_character_modifier = holding_large_feast
										has_character_modifier = holding_diwali_feast 
										has_character_modifier = holding_kali_puja_feast
										has_character_modifier = holding_zun_feast
										has_character_flag = holding_blot
										has_character_flag = holding_ukon_juhla
										has_character_flag = holding_uzgavenes
										has_character_flag = holding_jarilo
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_festivitie_tooltip }
						scaled_wealth = { value = -0.02 min = -2 max = -20 } #festivitie bonus
					}
			}
			guilds_shopping_item_b_2 = {
				add_artifact = guilds_item_lumber
				custom_tooltip = { text = guilds_item_lumber_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.30 min = -30 max = -300 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.35 min = -35 max = -350 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.40 min = -40 max = -400 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.45 min = -45 max = -450 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.50 min = -50 max = -500 } }
				}					
					if = {
						limit = { location = { has_settlement_construction = yes } }
						custom_tooltip = { text = guilds_goods_bonus_construction_tooltip }
						scaled_wealth = { value = -0.075 min = -7 max = -75 } #construction bonus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = jungle
									terrain = forest
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #terrain malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = desert
									terrain = steppe
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.05 min = -5 max = -50 } #terrain bonus
					}
			}
			guilds_shopping_item_c_2 = {
				add_artifact = guilds_item_linen
				custom_tooltip = { text = guilds_item_linen_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.55 min = -55 max = -550 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.60 min = -60 max = -600 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.65 min = -65 max = -650 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.70 min = -70 max = -700 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.75 min = -75 max = -750 } }
				}					
					if = {
						limit = { location = { has_province_modifier = guilds_buff_dye } }
						custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
						scaled_wealth = { value = -0.10 min = -10 max = -100 } #goods bonus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = { 
								OR = {
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_3
								}
							} 
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity bonus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = farmlands
									terrain = jungle
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #terrain malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = desert
									terrain = arctic
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.05 min = -5 max = -50 } #terrain bonus
					}
			}
			guilds_shopping_item_d_2 = {
				add_artifact = guilds_item_incense
				custom_tooltip = { text = guilds_item_incense_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.80 min = -80 max = -800 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.85 min = -85 max = -850 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.90 min = -90 max = -900 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.95 min = -95 max = -950 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -1 min = -100 max = -1000 } }
				}					
					if = {
						limit = { 
							location = { 
								owner = { 
									or = {
										has_character_modifier = holding_diwali_feast 
										has_character_modifier = holding_kali_puja_feast
	
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_festivitie_tooltip }
						scaled_wealth = { value = -0.15 min = -15 max = -150 } #festivitie bonus
					}
					if = {
						limit = { location = { has_epidemic = yes } }
						custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
						scaled_wealth = { value = -0.10 min = -10 max = -100 } #epidemic bonus
					}
					if = {
						limit = {
							location = {
								capital_holding = {
									holding_type = temple
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #terrain bonus
					}
			}
			guilds_shopping_item_e_2 = {
				add_artifact = guilds_item_spices
				custom_tooltip = { text = guilds_item_spices_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_3 = { scaled_wealth = { value = -1.05 min = -105 max = -1050 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -1.1 min = -110 max = -1100 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -1.15 min = -115 max = -1150 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -1.2 min = -120 max = -1200 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -1.25 min = -125 max = -1250 } }
				}					
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.20 min = 200 max = 200 } #prosperity malus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity bonus
					}
					if = {
						limit = { 
							location = { 
								owner = {
									or = {
										has_character_modifier = guilds_buff_feast
										has_character_modifier = fabulous_feast
										has_character_modifier = holding_large_feast
										has_character_modifier = holding_diwali_feast 
										has_character_modifier = holding_kali_puja_feast
										has_character_modifier = holding_zun_feast
										has_character_flag = holding_blot
										has_character_flag = holding_ukon_juhla
										has_character_flag = holding_uzgavenes
										has_character_flag = holding_jarilo
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_festivitie_tooltip }
						scaled_wealth = { value = -0.05 min = -5 max = -50 } #festivitie bonus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = jungle
									terrain = desert
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.15 min = 15 max = 150 } #terrain malus
					}
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		name = {
			text = EVTOPTA_SNW_1311
				trigger = { has_character_flag = guilds_shopping_item_a_3 }
		}
		name = {
			text = EVTOPTB_SNW_1311
				trigger = { has_character_flag = guilds_shopping_item_b_3 }
		}
		name = {
			text = EVTOPTC_SNW_1311
				trigger = { has_character_flag = guilds_shopping_item_c_3 }
		}
		name = {
			text = EVTOPTD_SNW_1311
				trigger = { has_character_flag = guilds_shopping_item_d_3 }
		}
		name = {
			text = EVTOPTE_SNW_1311
				trigger = { has_character_flag = guilds_shopping_item_e_3 }
		}
		ai_chance = {
		factor = 1
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 0.25
					wealth = 25
				}
			has_character_flag = guilds_shopping_item_a_3
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 0.50
					wealth = 50
				}
			has_character_flag = guilds_shopping_item_b_3
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 0.75
					wealth = 75
				}
			has_character_flag = guilds_shopping_item_c_3
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 1
					wealth = 100
				}
			has_character_flag = guilds_shopping_item_d_3
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 1.25
					wealth = 125
				}
			has_character_flag = guilds_shopping_item_e_3
			}
		}
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_shopping_item_a_3 = {
				add_artifact = guilds_item_grain
				custom_tooltip = { text = guilds_item_grain_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.05 min = -5 max = -50 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.10 min = -10 max = -100 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.15 min = -15 max = -150 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.20 min = -20 max = -200 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.25 min = -25 max = -250 } }
				}					
					if = {
						limit = {
							has_dlc = "Reapers"
							location = { 
								OR = { 
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.10 min = -10 max = -100 } #prosperity bonus
					}
					if = {
						limit = {
							location = {
								terrain = farmlands
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.015 min = 1 max = 15 } #terrain malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = plains
									terrain = steppe 
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.01 min = 1 max = 10 } #terrain malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = desert
									terrain = mountain
									terrain = arctic
									is_winter = yes
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.015 min = -1 max = -15 } #terrain bonus
					}
					if = {
						limit = { location = { owner = { war = yes } } }
						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = -0.025 min = -2 max = -25 } #war bonus
					}
					if = {
						limit = { 
							location = { 
								owner = {
									or = {
										has_character_modifier = guilds_buff_feast
										has_character_modifier = fabulous_feast
										has_character_modifier = holding_large_feast
										has_character_modifier = holding_diwali_feast 
										has_character_modifier = holding_kali_puja_feast
										has_character_modifier = holding_zun_feast
										has_character_flag = holding_blot
										has_character_flag = holding_ukon_juhla
										has_character_flag = holding_uzgavenes
										has_character_flag = holding_jarilo
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_festivitie_tooltip }
						scaled_wealth = { value = -0.02 min = -2 max = -20 } #festivitie bonus
					}
			}
			guilds_shopping_item_b_3 = {
				add_artifact = guilds_item_lumber
				custom_tooltip = { text = guilds_item_lumber_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.30 min = -30 max = -300 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.35 min = -35 max = -350 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.40 min = -40 max = -400 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.45 min = -45 max = -450 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.50 min = -50 max = -500 } }
				}					
					if = {
						limit = { location = { has_settlement_construction = yes } }
						custom_tooltip = { text = guilds_goods_bonus_construction_tooltip }
						scaled_wealth = { value = -0.075 min = -7 max = -75 } #construction bonus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = jungle
									terrain = forest
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #terrain malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = desert
									terrain = steppe
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.05 min = -5 max = -50 } #terrain bonus
					}
			}
			guilds_shopping_item_c_3 = {
				add_artifact = guilds_item_linen
				custom_tooltip = { text = guilds_item_linen_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.55 min = -55 max = -550 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.60 min = -60 max = -600 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.65 min = -65 max = -650 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.70 min = -70 max = -700 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.75 min = -75 max = -750 } }
				}					
					if = {
						limit = { location = { has_province_modifier = guilds_buff_dye } }
						custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
						scaled_wealth = { value = -0.10 min = -10 max = -100 } #goods bonus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = { 
								OR = {
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_3
								}
							} 
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity bonus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = farmlands
									terrain = jungle
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #terrain malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = desert
									terrain = arctic
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.05 min = -5 max = -50 } #terrain bonus
					}
			}
			guilds_shopping_item_d_3 = {
				add_artifact = guilds_item_incense
				custom_tooltip = { text = guilds_item_incense_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.80 min = -80 max = -800 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.85 min = -85 max = -850 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.90 min = -90 max = -900 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.95 min = -95 max = -950 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -1 min = -100 max = -1000 } }
				}					
					if = {
						limit = { 
							location = { 
								owner = { 
									or = {
										has_character_modifier = holding_diwali_feast 
										has_character_modifier = holding_kali_puja_feast
	
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_festivitie_tooltip }
						scaled_wealth = { value = -0.15 min = -15 max = -150 } #festivitie bonus
					}
					if = {
						limit = { location = { has_epidemic = yes } }
						custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
						scaled_wealth = { value = -0.10 min = -10 max = -100 } #epidemic bonus
					}
					if = {
						limit = {
							location = {
								capital_holding = {
									holding_type = temple
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #terrain bonus
					}
			}
			guilds_shopping_item_e_3 = {
				add_artifact = guilds_item_spices
				custom_tooltip = { text = guilds_item_spices_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_5 = { scaled_wealth = { value = -1.05 min = -105 max = -1050 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -1.1 min = -110 max = -1100 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -1.15 min = -115 max = -1150 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -1.2 min = -120 max = -1200 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -1.25 min = -125 max = -1250 } }
				}					
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.20 min = 200 max = 200 } #prosperity malus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity bonus
					}
					if = {
						limit = { 
							location = { 
								owner = {
									or = {
										has_character_modifier = guilds_buff_feast
										has_character_modifier = fabulous_feast
										has_character_modifier = holding_large_feast
										has_character_modifier = holding_diwali_feast 
										has_character_modifier = holding_kali_puja_feast
										has_character_modifier = holding_zun_feast
										has_character_flag = holding_blot
										has_character_flag = holding_ukon_juhla
										has_character_flag = holding_uzgavenes
										has_character_flag = holding_jarilo
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_festivitie_tooltip }
						scaled_wealth = { value = -0.05 min = -5 max = -50 } #festivitie bonus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = jungle
									terrain = desert
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.15 min = 15 max = 150 } #terrain malus
					}
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		name = EVTOPTZ_SNW_1311
		ai_chance = {
		factor = 0.5
		}

	}
	after = { 
	clr_character_flag = guilds_shopping_price_1
	clr_character_flag = guilds_shopping_price_2
	clr_character_flag = guilds_shopping_price_3
	clr_character_flag = guilds_shopping_price_4
	clr_character_flag = guilds_shopping_price_5
	clr_character_flag = guilds_shopping_item_a_1
	clr_character_flag = guilds_shopping_item_b_1
	clr_character_flag = guilds_shopping_item_c_1
	clr_character_flag = guilds_shopping_item_d_1
	clr_character_flag = guilds_shopping_item_e_1
	clr_character_flag = guilds_shopping_item_a_2
	clr_character_flag = guilds_shopping_item_b_2
	clr_character_flag = guilds_shopping_item_c_2
	clr_character_flag = guilds_shopping_item_d_2
	clr_character_flag = guilds_shopping_item_e_2
	clr_character_flag = guilds_shopping_item_a_3
	clr_character_flag = guilds_shopping_item_b_3
	clr_character_flag = guilds_shopping_item_c_3
	clr_character_flag = guilds_shopping_item_d_3
	clr_character_flag = guilds_shopping_item_e_3
	}
}

#Shopping buy animal
character_event = {
	id = SNW.1312
	desc = EVTDESC_SNW_1312
	picture = GFX_evt_market
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

		immediate = {
		random_list = { #A
			20 = {
				set_character_flag = guilds_shopping_item_a_1
			}
			20 = {
				set_character_flag = guilds_shopping_item_b_1
			}
			20 = {
				set_character_flag = guilds_shopping_item_c_1
			}
			20 = {
				set_character_flag = guilds_shopping_item_d_1
			}
			20 = {
				set_character_flag = guilds_shopping_item_e_1
			}
		}
		random_list = { #B
			20 = {
				set_character_flag = guilds_shopping_item_a_2
			}
			20 = {
				set_character_flag = guilds_shopping_item_b_2
			}
			20 = {
				set_character_flag = guilds_shopping_item_c_2
			}
			20 = {
				set_character_flag = guilds_shopping_item_d_2
			}
			20 = {
				set_character_flag = guilds_shopping_item_e_2
			}
		}
		random_list = { #C
			20 = {
				set_character_flag = guilds_shopping_item_a_3
			}
			20 = {
				set_character_flag = guilds_shopping_item_b_3
			}
			20 = {
				set_character_flag = guilds_shopping_item_c_3
			}
			20 = {
				set_character_flag = guilds_shopping_item_d_3
			}
			20 = {
				set_character_flag = guilds_shopping_item_e_3
			}
		}
		random_list = { #prices
			20 = {
				set_character_flag = guilds_shopping_price_1
			}
			20 = {
				set_character_flag = guilds_shopping_price_2
			}
			20 = {
				set_character_flag = guilds_shopping_price_3
			}
			20 = {
				set_character_flag = guilds_shopping_price_4
			}
			20 = {
				set_character_flag = guilds_shopping_price_5
			}
		}
	}
	
	option = { 
		name = {
			text = EVTOPTA_SNW_1312
				trigger = { has_character_flag = guilds_shopping_item_a_1 }
		}
		name = {
			text = EVTOPTB_SNW_1312
				trigger = { has_character_flag = guilds_shopping_item_b_1 }
		}
		name = {
			text = EVTOPTC_SNW_1312
				trigger = { has_character_flag = guilds_shopping_item_c_1 }
		}
		name = {
			text = EVTOPTD_SNW_1312
				trigger = { has_character_flag = guilds_shopping_item_d_1 }
		}
		name = {
			text = EVTOPTE_SNW_1312
				trigger = { has_character_flag = guilds_shopping_item_e_1 }
		}
		ai_chance = {
		factor = 1
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 0.25
					wealth = 25
				}
			has_character_flag = guilds_shopping_item_a_1
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 0.50
					wealth = 50
				}
			has_character_flag = guilds_shopping_item_b_1
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 0.75
					wealth = 75
				}
			has_character_flag = guilds_shopping_item_c_1
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 1
					wealth = 100
				}
			has_character_flag = guilds_shopping_item_d_1
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 1.25
					wealth = 125
				}
			has_character_flag = guilds_shopping_item_e_1
			}
		}
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_shopping_item_a_1 = {
				add_artifact = guilds_item_meat
				custom_tooltip = { text = guilds_item_meat_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.05 min = -5 max = -50 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.10 min = -10 max = -100 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.15 min = -15 max = -150 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.20 min = -20 max = -200 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.25 min = -25 max = -250 } }
				}					
					if = {
						limit = {
							has_dlc = "Reapers"
							location = { 
								OR = { 
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.10 min = -10 max = -100 } #prosperity bonus
					}
					if = {
						limit = { location = { owner = { war = yes } } }
						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = -0.025 min = -2 max = -25 } #war bonus
					}
					if = {
						limit = { 
							location = {
								owner = {
									or = {
										has_character_modifier = guilds_buff_feast
										has_character_modifier = fabulous_feast
										has_character_modifier = holding_large_feast
										has_character_modifier = holding_diwali_feast 
										has_character_modifier = holding_kali_puja_feast
										has_character_modifier = holding_zun_feast
										has_character_flag = holding_blot
										has_character_flag = holding_ukon_juhla
										has_character_flag = holding_uzgavenes
										has_character_flag = holding_jarilo
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_festivitie_tooltip }
						scaled_wealth = { value = -0.02 min = -2 max = -20 } #festivitie bonus
					}
					if = {
						limit = { location = { has_province_modifier = guilds_buff_spices } }
						custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
						scaled_wealth = { value = -0.02 min = -2 max = -20 } #goods bonus
					}
			}
			guilds_shopping_item_b_1 = {
				add_artifact = guilds_item_wool
				custom_tooltip = { text = guilds_item_wool_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.30 min = -30 max = -300 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.35 min = -35 max = -350 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.40 min = -40 max = -400 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.45 min = -45 max = -450 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.50 min = -50 max = -500 } }
				}
				if = {
					limit = { location = { has_province_modifier = guilds_buff_dye } }
					custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
					scaled_wealth = { value = -0.10 min = -10 max = -100 } #goods bonus
				}				
				if = {
					limit = {
						location = {
							OR = {
								terrain = farmlands
								terrain = plains
								terrain = steppe 
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
					scaled_wealth = { value = 0.05 min = 5 max = 50 } #terrain malus
				}
				if = {
					limit = {
						location = {
							OR = {
								terrain = arctic
								is_winter = yes
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
					scaled_wealth = { value = -0.1 min = -10 max = -100 } #terrain bonus
				}
				if = {
					limit = { 
						has_dlc = "Reapers"
						location = { 
							OR = {
								has_province_modifier = prosperity_modifier_2
								has_province_modifier = prosperity_modifier_3
							}
						} 
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = 0.05 min = 5 max = 50 } #prosperity malus
				}
			}
			guilds_shopping_item_c_1 = {
				add_artifact = guilds_item_hide
				custom_tooltip = { text = guilds_item_hide_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.55 min = -55 max = -550 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.60 min = -60 max = -600 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.65 min = -65 max = -650 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.70 min = -70 max = -700 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.75 min = -75 max = -750 } }
				}					
					if = {
						limit = { location = { owner = { war = yes } } }
						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #war bonus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = farmlands
									terrain = plains
									terrain = forest
									terrain = jungle
									terrain = steppe
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #terrain malus
					}
					if = {
						limit = { location = { has_epidemic = yes } }
						custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #epidemic malus
					}
			}
			guilds_shopping_item_d_1 = {
				add_artifact = guilds_item_ivory
				custom_tooltip = { text = guilds_item_ivory_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.80 min = -80 max = -800 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.85 min = -85 max = -850 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.90 min = -90 max = -900 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.95 min = -95 max = -950 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -1 min = -100 max = -1000 } }
				}					
				if = {
					limit = {
						location = {
							OR = {
								terrain = jungle
								terrain = arctic
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
					scaled_wealth = { value = 0.1 min = 10 max = 100 } #terrain malus
				}
				if = {
					limit = { 
						has_dlc = "Reapers"
						location = {
							OR = {
								has_province_modifier = prosperity_modifier_3
								has_province_modifier = prosperity_modifier_2
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = -0.05 min = -5 max = -50 } #prosperity bonus
				}
				if = {
					limit = { 
						has_dlc = "Reapers"
						location = {
							OR = {
								has_province_modifier = depopulated_1
								has_province_modifier = depopulated_2
								has_province_modifier = depopulated_3
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity malus - changed from 0.3 due to high inverted value
				}
				if = {
					limit = { 
						has_dlc = "Reapers"
						location = {
							NOR = {
								has_province_modifier = prosperity_modifier_3
								has_province_modifier = prosperity_modifier_2
								has_province_modifier = prosperity_modifier_1
								has_province_modifier = depopulated_1
								has_province_modifier = depopulated_2
								has_province_modifier = depopulated_3
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity malus
				}
				if = {
					limit = { location = { has_epidemic = yes } }
					custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
					scaled_wealth = { value = 0.05 min = 5 max = 50 } #epidemic malus
				}
			}
			guilds_shopping_item_e_1 = {
				add_artifact = guilds_item_silk
				custom_tooltip = { text = guilds_item_silk_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = -1.05 min = -105 max = -1050 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -1.1 min = -110 max = -1100 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -1.15 min = -115 max = -1150 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -1.2 min = -120 max = -1200 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -1.25 min = -125 max = -1250 } }
				}					
				if = {
					limit = { location = { has_province_modifier = guilds_buff_dye } }
					custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
					scaled_wealth = { value = -0.10 min = -10 max = -100 } #goods bonus
				}
				if = {
					limit = { 
						has_dlc = "Reapers"
						location = {
							OR = {
								has_province_modifier = prosperity_modifier_3
								has_province_modifier = prosperity_modifier_2
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = -0.05 min = -5 max = -50 } #prosperity bonus
				}
				if = {
					limit = { 
						has_dlc = "Reapers"
						location = {
							OR = {
								has_province_modifier = depopulated_1
								has_province_modifier = depopulated_2
								has_province_modifier = depopulated_3
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = 0.15 min = 15 max = 150 } #prosperity malus
				}
				if = {
					limit = { 
						has_dlc = "Reapers"
						location = {
							NOR = {
								has_province_modifier = prosperity_modifier_3
								has_province_modifier = prosperity_modifier_2
								has_province_modifier = prosperity_modifier_1
								has_province_modifier = depopulated_1
								has_province_modifier = depopulated_2
								has_province_modifier = depopulated_3
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity malus
				}
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		name = {
			text = EVTOPTA_SNW_1312
				trigger = { has_character_flag = guilds_shopping_item_a_2 }
		}
		name = {
			text = EVTOPTB_SNW_1312
				trigger = { has_character_flag = guilds_shopping_item_b_2 }
		}
		name = {
			text = EVTOPTC_SNW_1312
				trigger = { has_character_flag = guilds_shopping_item_c_2 }
		}
		name = {
			text = EVTOPTD_SNW_1312
				trigger = { has_character_flag = guilds_shopping_item_d_2 }
		}
		name = {
			text = EVTOPTE_SNW_1312
				trigger = { has_character_flag = guilds_shopping_item_e_2 }
		}
		ai_chance = {
		factor = 1
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 0.25
					wealth = 25
				}
			has_character_flag = guilds_shopping_item_a_2
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 0.50
					wealth = 50
				}
			has_character_flag = guilds_shopping_item_b_2
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 0.75
					wealth = 75
				}
			has_character_flag = guilds_shopping_item_c_2
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 1
					wealth = 100
				}
			has_character_flag = guilds_shopping_item_d_2
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 1.25
					wealth = 125
				}
			has_character_flag = guilds_shopping_item_e_2
			}
		}
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_shopping_item_a_2 = {
				add_artifact = guilds_item_meat
				custom_tooltip = { text = guilds_item_meat_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.05 min = -5 max = -50 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.10 min = -10 max = -100 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.15 min = -15 max = -150 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.20 min = -20 max = -200 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.25 min = -25 max = -250 } }
				}					
					if = {
						limit = {
							has_dlc = "Reapers"
							location = { 
								OR = { 
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.10 min = -10 max = -100 } #prosperity bonus
					}
					if = {
						limit = { location = { owner = { war = yes } } }
						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = -0.025 min = -2 max = -25 } #war bonus
					}
					if = {
						limit = { 
							location = {
								owner = {
									or = {
										has_character_modifier = guilds_buff_feast
										has_character_modifier = fabulous_feast
										has_character_modifier = holding_large_feast
										has_character_modifier = holding_diwali_feast 
										has_character_modifier = holding_kali_puja_feast
										has_character_modifier = holding_zun_feast
										has_character_flag = holding_blot
										has_character_flag = holding_ukon_juhla
										has_character_flag = holding_uzgavenes
										has_character_flag = holding_jarilo
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_festivitie_tooltip }
						scaled_wealth = { value = -0.02 min = -2 max = -20 } #festivitie bonus
					}
					if = {
						limit = { location = { has_province_modifier = guilds_buff_spices } }
						custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
						scaled_wealth = { value = -0.02 min = -2 max = -20 } #goods bonus
					}
			}
			guilds_shopping_item_b_2 = {
				add_artifact = guilds_item_wool
				custom_tooltip = { text = guilds_item_wool_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.30 min = -30 max = -300 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.35 min = -35 max = -350 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.40 min = -40 max = -400 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.45 min = -45 max = -450 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.50 min = -50 max = -500 } }
				}
				if = {
					limit = { location = { has_province_modifier = guilds_buff_dye } }
					custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
					scaled_wealth = { value = -0.10 min = -10 max = -100 } #goods bonus
				}				
				if = {
					limit = {
						location = {
							OR = {
								terrain = farmlands
								terrain = plains
								terrain = steppe 
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
					scaled_wealth = { value = 0.05 min = 5 max = 50 } #terrain malus
				}
				if = {
					limit = {
						location = {
							OR = {
								terrain = arctic
								is_winter = yes
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
					scaled_wealth = { value = -0.1 min = -10 max = -100 } #terrain bonus
				}
				if = {
					limit = { 
						has_dlc = "Reapers"
						location = { 
							OR = {
								has_province_modifier = prosperity_modifier_2
								has_province_modifier = prosperity_modifier_3
							}
						} 
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = 0.05 min = 5 max = 50 } #prosperity malus
				}
			}
			guilds_shopping_item_c_2 = {
				add_artifact = guilds_item_hide
				custom_tooltip = { text = guilds_item_hide_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.55 min = -55 max = -550 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.60 min = -60 max = -600 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.65 min = -65 max = -650 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.70 min = -70 max = -700 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.75 min = -75 max = -750 } }
				}					
					if = {
						limit = { location = { owner = { war = yes } } }
						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #war bonus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = farmlands
									terrain = plains
									terrain = forest
									terrain = jungle
									terrain = steppe
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #terrain malus
					}
					if = {
						limit = { location = { has_epidemic = yes } }
						custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #epidemic malus
					}
			}
			guilds_shopping_item_d_2 = {
				add_artifact = guilds_item_ivory
				custom_tooltip = { text = guilds_item_ivory_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.80 min = -80 max = -800 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.85 min = -85 max = -850 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.90 min = -90 max = -900 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.95 min = -95 max = -950 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -1 min = -100 max = -1000 } }
				}					
				if = {
					limit = {
						location = {
							OR = {
								terrain = jungle
								terrain = arctic
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
					scaled_wealth = { value = 0.1 min = 10 max = 100 } #terrain malus
				}
				if = {
					limit = { 
						has_dlc = "Reapers"
						location = {
							OR = {
								has_province_modifier = prosperity_modifier_3
								has_province_modifier = prosperity_modifier_2
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = -0.05 min = -5 max = -50 } #prosperity bonus
				}
				if = {
					limit = { 
						has_dlc = "Reapers"
						location = {
							OR = {
								has_province_modifier = depopulated_1
								has_province_modifier = depopulated_2
								has_province_modifier = depopulated_3
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity malus - changed from 0.3 due to high inverted value
				}
				if = {
					limit = { 
						has_dlc = "Reapers"
						location = {
							NOR = {
								has_province_modifier = prosperity_modifier_3
								has_province_modifier = prosperity_modifier_2
								has_province_modifier = prosperity_modifier_1
								has_province_modifier = depopulated_1
								has_province_modifier = depopulated_2
								has_province_modifier = depopulated_3
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity malus
				}
				if = {
					limit = { location = { has_epidemic = yes } }
					custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
					scaled_wealth = { value = 0.05 min = 5 max = 50 } #epidemic malus
				}
			}
			guilds_shopping_item_e_2 = {
				add_artifact = guilds_item_silk
				custom_tooltip = { text = guilds_item_silk_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_3 = { scaled_wealth = { value = -1.05 min = -105 max = -1050 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -1.1 min = -110 max = -1100 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -1.15 min = -115 max = -1150 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -1.2 min = -120 max = -1200 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -1.25 min = -125 max = -1250 } }
				}					
				if = {
					limit = { location = { has_province_modifier = guilds_buff_dye } }
					custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
					scaled_wealth = { value = -0.10 min = -10 max = -100 } #goods bonus
				}
				if = {
					limit = { 
						has_dlc = "Reapers"
						location = {
							OR = {
								has_province_modifier = prosperity_modifier_3
								has_province_modifier = prosperity_modifier_2
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = -0.05 min = -5 max = -50 } #prosperity bonus
				}
				if = {
					limit = { 
						has_dlc = "Reapers"
						location = {
							OR = {
								has_province_modifier = depopulated_1
								has_province_modifier = depopulated_2
								has_province_modifier = depopulated_3
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = 0.15 min = 15 max = 150 } #prosperity malus
				}
				if = {
					limit = { 
						has_dlc = "Reapers"
						location = {
							NOR = {
								has_province_modifier = prosperity_modifier_3
								has_province_modifier = prosperity_modifier_2
								has_province_modifier = prosperity_modifier_1
								has_province_modifier = depopulated_1
								has_province_modifier = depopulated_2
								has_province_modifier = depopulated_3
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity malus
				}
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		name = {
			text = EVTOPTA_SNW_1312
				trigger = { has_character_flag = guilds_shopping_item_a_3 }
		}
		name = {
			text = EVTOPTB_SNW_1312
				trigger = { has_character_flag = guilds_shopping_item_b_3 }
		}
		name = {
			text = EVTOPTC_SNW_1312
				trigger = { has_character_flag = guilds_shopping_item_c_3 }
		}
		name = {
			text = EVTOPTD_SNW_1312
				trigger = { has_character_flag = guilds_shopping_item_d_3 }
		}
		name = {
			text = EVTOPTE_SNW_1312
				trigger = { has_character_flag = guilds_shopping_item_e_3 }
		}
		ai_chance = {
		factor = 1
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 0.25
					wealth = 25
				}
			has_character_flag = guilds_shopping_item_a_3
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 0.50
					wealth = 50
				}
			has_character_flag = guilds_shopping_item_b_3
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 0.75
					wealth = 75
				}
			has_character_flag = guilds_shopping_item_c_3
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 1
					wealth = 100
				}
			has_character_flag = guilds_shopping_item_d_3
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 1.25
					wealth = 125
				}
			has_character_flag = guilds_shopping_item_e_3
			}
		}
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_shopping_item_a_3 = {
				add_artifact = guilds_item_meat
				custom_tooltip = { text = guilds_item_meat_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.05 min = -5 max = -50 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.10 min = -10 max = -100 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.15 min = -15 max = -150 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.20 min = -20 max = -200 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.25 min = -25 max = -250 } }
				}					
					if = {
						limit = {
							has_dlc = "Reapers"
							location = { 
								OR = { 
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.10 min = -10 max = -100 } #prosperity bonus
					}
					if = {
						limit = { location = { owner = { war = yes } } }
						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = -0.025 min = -2 max = -25 } #war bonus
					}
					if = {
						limit = { 
							location = {
								owner = {
									or = {
										has_character_modifier = guilds_buff_feast
										has_character_modifier = fabulous_feast
										has_character_modifier = holding_large_feast
										has_character_modifier = holding_diwali_feast 
										has_character_modifier = holding_kali_puja_feast
										has_character_modifier = holding_zun_feast
										has_character_flag = holding_blot
										has_character_flag = holding_ukon_juhla
										has_character_flag = holding_uzgavenes
										has_character_flag = holding_jarilo
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_festivitie_tooltip }
						scaled_wealth = { value = -0.02 min = -2 max = -20 } #festivitie bonus
					}
					if = {
						limit = { location = { has_province_modifier = guilds_buff_spices } }
						custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
						scaled_wealth = { value = -0.02 min = -2 max = -20 } #goods bonus
					}
			}
			guilds_shopping_item_b_3 = {
				add_artifact = guilds_item_wool
				custom_tooltip = { text = guilds_item_wool_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.30 min = -30 max = -300 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.35 min = -35 max = -350 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.40 min = -40 max = -400 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.45 min = -45 max = -450 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.50 min = -50 max = -500 } }
				}
				if = {
					limit = { location = { has_province_modifier = guilds_buff_dye } }
					custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
					scaled_wealth = { value = -0.10 min = -10 max = -100 } #goods bonus
				}
				if = {
					limit = {
						location = {
							OR = {
								terrain = farmlands
								terrain = plains
								terrain = steppe 
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
					scaled_wealth = { value = 0.05 min = 5 max = 50 } #terrain malus
				}
				if = {
					limit = {
						location = {
							OR = {
								terrain = arctic
								is_winter = yes
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
					scaled_wealth = { value = -0.1 min = -10 max = -100 } #terrain bonus
				}
				if = {
					limit = { 
						has_dlc = "Reapers"
						location = { 
							OR = {
								has_province_modifier = prosperity_modifier_2
								has_province_modifier = prosperity_modifier_3
							}
						} 
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = 0.05 min = 5 max = 50 } #prosperity malus
				}
			}
			guilds_shopping_item_c_3 = {
				add_artifact = guilds_item_hide
				custom_tooltip = { text = guilds_item_hide_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.55 min = -55 max = -550 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.60 min = -60 max = -600 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.65 min = -65 max = -650 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.70 min = -70 max = -700 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.75 min = -75 max = -750 } }
				}					
					if = {
						limit = { location = { owner = { war = yes } } }
						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #war bonus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = farmlands
									terrain = plains
									terrain = forest
									terrain = jungle
									terrain = steppe
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #terrain malus
					}
					if = {
						limit = { location = { has_epidemic = yes } }
						custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #epidemic malus
					}
			}
			guilds_shopping_item_d_3 = {
				add_artifact = guilds_item_ivory
				custom_tooltip = { text = guilds_item_ivory_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.80 min = -80 max = -800 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.85 min = -85 max = -850 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.90 min = -90 max = -900 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.95 min = -95 max = -950 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -1 min = -100 max = -1000 } }
				}					
				if = {
					limit = {
						location = {
							OR = {
								terrain = jungle
								terrain = arctic
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
					scaled_wealth = { value = 0.1 min = 10 max = 100 } #terrain malus
				}
				if = {
					limit = { 
						has_dlc = "Reapers"
						location = {
							OR = {
								has_province_modifier = prosperity_modifier_3
								has_province_modifier = prosperity_modifier_2
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = -0.05 min = -5 max = -50 } #prosperity bonus
				}
				if = {
					limit = { 
						has_dlc = "Reapers"
						location = {
							OR = {
								has_province_modifier = depopulated_1
								has_province_modifier = depopulated_2
								has_province_modifier = depopulated_3
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity malus - changed from 0.3 due to high inverted value
				}
				if = {
					limit = { 
						has_dlc = "Reapers"
						location = {
							NOR = {
								has_province_modifier = prosperity_modifier_3
								has_province_modifier = prosperity_modifier_2
								has_province_modifier = prosperity_modifier_1
								has_province_modifier = depopulated_1
								has_province_modifier = depopulated_2
								has_province_modifier = depopulated_3
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity malus
				}
				if = {
					limit = { location = { has_epidemic = yes } }
					custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
					scaled_wealth = { value = 0.05 min = 5 max = 50 } #epidemic malus
				}
			}
			guilds_shopping_item_e_3 = {
				add_artifact = guilds_item_silk
				custom_tooltip = { text = guilds_item_silk_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_5 = { scaled_wealth = { value = -1.05 min = -105 max = -1050 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -1.1 min = -110 max = -1100 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -1.15 min = -115 max = -1150 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -1.2 min = -120 max = -1200 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -1.25 min = -125 max = -1250 } }
				}
				if = {
					limit = { location = { has_province_modifier = guilds_buff_dye } }
					custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
					scaled_wealth = { value = -0.10 min = -10 max = -100 } #goods bonus
				}
				if = {
					limit = { 
						has_dlc = "Reapers"
						location = {
							OR = {
								has_province_modifier = prosperity_modifier_3
								has_province_modifier = prosperity_modifier_2
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = -0.05 min = -5 max = -50 } #prosperity bonus
				}
				if = {
					limit = { 
						has_dlc = "Reapers"
						location = {
							OR = {
								has_province_modifier = depopulated_1
								has_province_modifier = depopulated_2
								has_province_modifier = depopulated_3
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = 0.15 min = 15 max = 150 } #prosperity malus
				}
				if = {
					limit = { 
						has_dlc = "Reapers"
						location = {
							NOR = {
								has_province_modifier = prosperity_modifier_3
								has_province_modifier = prosperity_modifier_2
								has_province_modifier = prosperity_modifier_1
								has_province_modifier = depopulated_1
								has_province_modifier = depopulated_2
								has_province_modifier = depopulated_3
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity malus
				}			
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		name = EVTOPTZ_SNW_1312
		ai_chance = {
		factor = 0.5
		}

	}
	after = { 
	clr_character_flag = guilds_shopping_price_1
	clr_character_flag = guilds_shopping_price_2
	clr_character_flag = guilds_shopping_price_3
	clr_character_flag = guilds_shopping_price_4
	clr_character_flag = guilds_shopping_price_5
	clr_character_flag = guilds_shopping_item_a_1
	clr_character_flag = guilds_shopping_item_b_1
	clr_character_flag = guilds_shopping_item_c_1
	clr_character_flag = guilds_shopping_item_d_1
	clr_character_flag = guilds_shopping_item_e_1
	clr_character_flag = guilds_shopping_item_a_2
	clr_character_flag = guilds_shopping_item_b_2
	clr_character_flag = guilds_shopping_item_c_2
	clr_character_flag = guilds_shopping_item_d_2
	clr_character_flag = guilds_shopping_item_e_2
	clr_character_flag = guilds_shopping_item_a_3
	clr_character_flag = guilds_shopping_item_b_3
	clr_character_flag = guilds_shopping_item_c_3
	clr_character_flag = guilds_shopping_item_d_3
	clr_character_flag = guilds_shopping_item_e_3
	}
}

#Shopping buy goods
character_event = {
	id = SNW.1313
	desc = EVTDESC_SNW_1313
	picture = GFX_evt_market
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

		immediate = {
		random_list = { #A
			20 = {
				set_character_flag = guilds_shopping_item_a_1
			}
			20 = {
				set_character_flag = guilds_shopping_item_b_1
			}
			20 = {
				set_character_flag = guilds_shopping_item_c_1
			}
			20 = {
				set_character_flag = guilds_shopping_item_d_1
			}
			20 = {
				set_character_flag = guilds_shopping_item_e_1
			}
		}
		random_list = { #B
			20 = {
				set_character_flag = guilds_shopping_item_a_2
			}
			20 = {
				set_character_flag = guilds_shopping_item_b_2
			}
			20 = {
				set_character_flag = guilds_shopping_item_c_2
			}
			20 = {
				set_character_flag = guilds_shopping_item_d_2
			}
			20 = {
				set_character_flag = guilds_shopping_item_e_2
			}
		}
		random_list = { #C
			20 = {
				set_character_flag = guilds_shopping_item_a_3
			}
			20 = {
				set_character_flag = guilds_shopping_item_b_3
			}
			20 = {
				set_character_flag = guilds_shopping_item_c_3
			}
			20 = {
				set_character_flag = guilds_shopping_item_d_3
			}
			20 = {
				set_character_flag = guilds_shopping_item_e_3
			}
		}
		random_list = { #prices
			20 = {
				set_character_flag = guilds_shopping_price_1
			}
			20 = {
				set_character_flag = guilds_shopping_price_2
			}
			20 = {
				set_character_flag = guilds_shopping_price_3
			}
			20 = {
				set_character_flag = guilds_shopping_price_4
			}
			20 = {
				set_character_flag = guilds_shopping_price_5
			}
		}
	}
	
	option = { 
		name = {
			text = EVTOPTA_SNW_1313
				trigger = { has_character_flag = guilds_shopping_item_a_1 }
		}
		name = {
			text = EVTOPTB_SNW_1313
				trigger = { has_character_flag = guilds_shopping_item_b_1 }
		}
		name = {
			text = EVTOPTC_SNW_1313
				trigger = { has_character_flag = guilds_shopping_item_c_1 }
		}
		name = {
			text = EVTOPTD_SNW_1313
				trigger = { has_character_flag = guilds_shopping_item_d_1 }
		}
		name = {
			text = EVTOPTE_SNW_1313
				trigger = { has_character_flag = guilds_shopping_item_e_1 }
		}
		ai_chance = {
		factor = 1
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 0.25
					wealth = 25
				}
			has_character_flag = guilds_shopping_item_a_1
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 0.50
					wealth = 50
				}
			has_character_flag = guilds_shopping_item_b_1
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 0.75
					wealth = 75
				}
			has_character_flag = guilds_shopping_item_c_1
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 1
					wealth = 100
				}
			has_character_flag = guilds_shopping_item_d_1
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 1.25
					wealth = 125
				}
			has_character_flag = guilds_shopping_item_e_1
			}
		}
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_shopping_item_a_1 = {
				add_artifact = guilds_item_pottery
				custom_tooltip = { text = guilds_item_pottery_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.05 min = -5 max = -50 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.10 min = -10 max = -100 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.15 min = -15 max = -150 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.20 min = -20 max = -200 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.25 min = -25 max = -250 } }
				}					
				if = {
					limit = {
						has_dlc = "Reapers"
						location = { 
							NOR = { 
								has_province_modifier = prosperity_modifier_2
								has_province_modifier = prosperity_modifier_3
								has_province_modifier = depopulated_2
								has_province_modifier = depopulated_3
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = -0.01 min = -1 max = -10 } #prosperity bonus
				}
				if = {
					limit = { 
						location = { 
							OR = {
								has_province_modifier = guilds_buff_alcohol 
								has_province_modifier = guilds_buff_grain
								has_province_modifier = guilds_buff_meat
							} 
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
					scaled_wealth = { value = -0.015 min = -1 max = -15 } #goods bonus
				}
			}
			guilds_shopping_item_b_1 = {
				add_artifact = guilds_item_alcohol
				custom_tooltip = { text = guilds_item_alcohol_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.30 min = -30 max = -300 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.35 min = -35 max = -350 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.40 min = -40 max = -400 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.45 min = -45 max = -450 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.50 min = -50 max = -500 } }
				}					
				if = {
					limit = {
						has_dlc = "Reapers"
						location = { 
							OR = {
								has_province_modifier = prosperity_modifier_1
								has_province_modifier = prosperity_modifier_2
								has_province_modifier = prosperity_modifier_3
								has_province_modifier = depopulated_2
								has_province_modifier = depopulated_3
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = -0.05 min = -5 max = -50 } #prosperity bonus
				}
				if = {
					limit = {
						has_dlc = "Reapers"
						location = { 
							OR = {
								has_province_modifier = depopulated_1
								has_province_modifier = depopulated_2
								has_province_modifier = depopulated_3
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity bonus
				}
				if = {
					limit = { location = { owner = { war = yes } } }
					custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
					scaled_wealth = { value = -0.075 min = -7 max = -75 } #war bonus
				}
				if = { limit = { location = { is_winter = yes } }
					custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
					scaled_wealth = { value = -0.1 min = -10 max = -100 } #terrain bonus
				}
			}
			guilds_shopping_item_c_1 = {
				add_artifact = guilds_item_armor
				custom_tooltip = { text = guilds_item_armor_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.55 min = -55 max = -550 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.60 min = -60 max = -600 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.65 min = -65 max = -650 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.70 min = -70 max = -700 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.75 min = -75 max = -750 } }
				}					
					if = {
						limit = { location = { owner = { war = yes } } }
						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = -0.20 min = -20 max = -200 } #At war bonus
					}
					if = {
						limit = { location = { owner = { war = no } } }
 						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = 0.10 min = 10 max = 100 } #At war malus
					}
					if = {
						limit = {
							location = {
								owner = {
									or = {
										has_character_flag = tournament_begins
										has_character_flag = tournament_begins_furusiyya
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_festivitie_tooltip }
						scaled_wealth = { value = 0.1 min = 1 max = 100 } #festivitie bonus
					}
			}
			guilds_shopping_item_d_1 = {
				add_artifact = guilds_item_jewelry
				custom_tooltip = { text = guilds_item_jewelry_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.80 min = -80 max = -800 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.85 min = -85 max = -850 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.90 min = -90 max = -900 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.95 min = -95 max = -950 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -1 min = -100 max = -1000 } }
				}					
					if = { 
						limit = { 
							has_dlc = "Reapers"
							location = { 
								has_province_modifier = prosperity_modifier_1
							} 
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.05 min = -5 max = -50 } #prosperity bonus
					}
					if = { 
						limit = { 
							has_dlc = "Reapers"
							location = { 
								OR = {
									has_province_modifier = prosperity_modifier_3
									has_province_modifier = prosperity_modifier_2
								}
							} 
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity bonus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.2 min = 20 max = 200 } #prosperity malus
					}
					if = {
						limit = { 
							location = { 
								OR = {
									has_province_modifier = guilds_buff_gem
									has_province_modifier = guilds_buff_silver 
									has_province_modifier = guilds_buff_gold 
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #goods malus
					}
			}
			guilds_shopping_item_e_1 = {
				add_artifact = guilds_item_book
				custom_tooltip = { text = guilds_item_book_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = -1.05 min = -105 max = -1050 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -1.1 min = -110 max = -1100 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -1.15 min = -115 max = -1150 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -1.2 min = -120 max = -1200 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -1.25 min = -125 max = -1250 } }
				}					
				if = { 
					limit = { 
						has_dlc = "Reapers"
						location = { 
							has_province_modifier = prosperity_modifier_1
						} 
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = -0.05 min = -5 max = -50 } #prosperity bonus
				}
				if = { 
					limit = { 
						has_dlc = "Reapers"
						location = { 
							OR = {
								has_province_modifier = prosperity_modifier_3
								has_province_modifier = prosperity_modifier_2
							}
						} 
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity bonus
				}
				if = {
					limit = { 
						has_dlc = "Reapers"
						location = {
							OR = {
								has_province_modifier = depopulated_1
								has_province_modifier = depopulated_2
								has_province_modifier = depopulated_3
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = 0.2 min = 20 max = 200 } #prosperity malus
				}
				if = {
					limit = {
						location = {
							capital_holding = {
								OR = {
									holding_type = temple
									holding_type = city 
								}
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
					scaled_wealth = { value = -0.1 min = -10 max = -100 } #terrain bonus
				}
				if = {
					limit = { 
						location = {
							capital_holding = {
								OR = {
									holding_type = tribal
									holding_type = nomad
								}
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
					scaled_wealth = { value = 0.15 min = 15 max = 150 } #terrain malus - changed from 0.3 due to high inverted value
				}
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		name = {
			text = EVTOPTA_SNW_1313
				trigger = { has_character_flag = guilds_shopping_item_a_2 }
		}
		name = {
			text = EVTOPTB_SNW_1313
				trigger = { has_character_flag = guilds_shopping_item_b_2 }
		}
		name = {
			text = EVTOPTC_SNW_1313
				trigger = { has_character_flag = guilds_shopping_item_c_2 }
		}
		name = {
			text = EVTOPTD_SNW_1313
				trigger = { has_character_flag = guilds_shopping_item_d_2 }
		}
		name = {
			text = EVTOPTE_SNW_1313
				trigger = { has_character_flag = guilds_shopping_item_e_2 }
		}
		ai_chance = {
		factor = 1
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 0.25
					wealth = 25
				}
			has_character_flag = guilds_shopping_item_a_2
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 0.50
					wealth = 50
				}
			has_character_flag = guilds_shopping_item_b_2
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 0.75
					wealth = 75
				}
			has_character_flag = guilds_shopping_item_c_2
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 1
					wealth = 100
				}
			has_character_flag = guilds_shopping_item_d_2
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 1.25
					wealth = 125
				}
			has_character_flag = guilds_shopping_item_e_2
			}
		}
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_shopping_item_a_2 = {
				add_artifact = guilds_item_pottery
				custom_tooltip = { text = guilds_item_pottery_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.05 min = -5 max = -50 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.10 min = -10 max = -100 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.15 min = -15 max = -150 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.20 min = -20 max = -200 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.25 min = -25 max = -250 } }
				}					
				if = {
					limit = {
						has_dlc = "Reapers"
						location = { 
							NOR = { 
								has_province_modifier = prosperity_modifier_2
								has_province_modifier = prosperity_modifier_3
								has_province_modifier = depopulated_2
								has_province_modifier = depopulated_3
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = -0.01 min = -1 max = -10 } #prosperity bonus
				}
				if = {
					limit = { 
						location = { 
							OR = {
								has_province_modifier = guilds_buff_alcohol 
								has_province_modifier = guilds_buff_grain
								has_province_modifier = guilds_buff_meat
							} 
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
					scaled_wealth = { value = -0.015 min = -1 max = -15 } #goods bonus
				}
			}
			guilds_shopping_item_b_2 = {
				add_artifact = guilds_item_alcohol
				custom_tooltip = { text = guilds_item_alcohol_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.30 min = -30 max = -300 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.35 min = -35 max = -350 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.40 min = -40 max = -400 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.45 min = -45 max = -450 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.50 min = -50 max = -500 } }
				}					
				if = {
					limit = {
						has_dlc = "Reapers"
						location = { 
							OR = {
								has_province_modifier = prosperity_modifier_1
								has_province_modifier = prosperity_modifier_2
								has_province_modifier = prosperity_modifier_3
								has_province_modifier = depopulated_2
								has_province_modifier = depopulated_3
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = -0.05 min = -5 max = -50 } #prosperity bonus
				}
				if = {
					limit = {
						has_dlc = "Reapers"
						location = { 
							OR = {
								has_province_modifier = depopulated_1
								has_province_modifier = depopulated_2
								has_province_modifier = depopulated_3
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity bonus
				}
				if = {
					limit = { location = { owner = { war = yes } } }
					custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
					scaled_wealth = { value = -0.075 min = -7 max = -75 } #war bonus
				}
				if = { limit = { location = { is_winter = yes } }
					custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
					scaled_wealth = { value = -0.1 min = -10 max = -100 } #terrain bonus
				}
			}
			guilds_shopping_item_c_2 = {
				add_artifact = guilds_item_armor
				custom_tooltip = { text = guilds_item_armor_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.55 min = -55 max = -550 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.60 min = -60 max = -600 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.65 min = -65 max = -650 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.70 min = -70 max = -700 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.75 min = -75 max = -750 } }
				}					
					if = {
						limit = { location = { owner = { war = yes } } }
						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = -0.20 min = -20 max = -200 } #At war bonus
					}
					if = {
						limit = { location = { owner = { war = no } } }
 						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = 0.10 min = 10 max = 100 } #At war malus
					}
					if = {
						limit = {
							location = {
								owner = {
									or = {
										has_character_flag = tournament_begins
										has_character_flag = tournament_begins_furusiyya
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_festivitie_tooltip }
						scaled_wealth = { value = 0.1 min = 1 max = 100 } #festivitie bonus
					}
			}
			guilds_shopping_item_d_2 = {
				add_artifact = guilds_item_jewelry
				custom_tooltip = { text = guilds_item_jewelry_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.80 min = -80 max = -800 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.85 min = -85 max = -850 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.90 min = -90 max = -900 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.95 min = -95 max = -950 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -1 min = -100 max = -1000 } }
				}					
					if = { 
						limit = { 
							has_dlc = "Reapers"
							location = { 
								has_province_modifier = prosperity_modifier_1
							} 
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.05 min = -5 max = -50 } #prosperity bonus
					}
					if = { 
						limit = { 
							has_dlc = "Reapers"
							location = { 
								OR = {
									has_province_modifier = prosperity_modifier_3
									has_province_modifier = prosperity_modifier_2
								}
							} 
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity bonus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.2 min = 20 max = 200 } #prosperity malus
					}
					if = {
						limit = { 
							location = { 
								OR = {
									has_province_modifier = guilds_buff_gem
									has_province_modifier = guilds_buff_silver 
									has_province_modifier = guilds_buff_gold 
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #goods malus
					}
			}
			guilds_shopping_item_e_2 = {
				add_artifact = guilds_item_book
				custom_tooltip = { text = guilds_item_book_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_3 = { scaled_wealth = { value = -1.05 min = -105 max = -1050 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -1.1 min = -110 max = -1100 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -1.15 min = -115 max = -1150 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -1.2 min = -120 max = -1200 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -1.25 min = -125 max = -1250 } }
				}					
				if = { 
					limit = { 
						has_dlc = "Reapers"
						location = { 
							has_province_modifier = prosperity_modifier_1
						} 
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = -0.05 min = -5 max = -50 } #prosperity bonus
				}
				if = { 
					limit = { 
						has_dlc = "Reapers"
						location = { 
							OR = {
								has_province_modifier = prosperity_modifier_3
								has_province_modifier = prosperity_modifier_2
							}
						} 
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity bonus
				}
				if = {
					limit = { 
						has_dlc = "Reapers"
						location = {
							OR = {
								has_province_modifier = depopulated_1
								has_province_modifier = depopulated_2
								has_province_modifier = depopulated_3
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = 0.2 min = 20 max = 200 } #prosperity malus
				}
				if = {
					limit = {
						location = {
							capital_holding = {
								OR = {
									holding_type = temple
									holding_type = city 
								}
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
					scaled_wealth = { value = -0.1 min = -10 max = -100 } #terrain bonus
				}
				if = {
					limit = { 
						location = {
							capital_holding = {
								OR = {
									holding_type = tribal
									holding_type = nomad
								}
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
					scaled_wealth = { value = 0.15 min = 15 max = 150 } #terrain malus - changed from 0.3 due to high inverted value
				}
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		name = {
			text = EVTOPTA_SNW_1313
				trigger = { has_character_flag = guilds_shopping_item_a_3 }
		}
		name = {
			text = EVTOPTB_SNW_1313
				trigger = { has_character_flag = guilds_shopping_item_b_3 }
		}
		name = {
			text = EVTOPTC_SNW_1313
				trigger = { has_character_flag = guilds_shopping_item_c_3 }
		}
		name = {
			text = EVTOPTD_SNW_1313
				trigger = { has_character_flag = guilds_shopping_item_d_3 }
		}
		name = {
			text = EVTOPTE_SNW_1313
				trigger = { has_character_flag = guilds_shopping_item_e_3 }
		}
		ai_chance = {
		factor = 1
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 0.25
					wealth = 25
				}
			has_character_flag = guilds_shopping_item_a_3
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 0.50
					wealth = 50
				}
			has_character_flag = guilds_shopping_item_b_3
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 0.75
					wealth = 75
				}
			has_character_flag = guilds_shopping_item_c_3
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 1
					wealth = 100
				}
			has_character_flag = guilds_shopping_item_d_3
			}
			modifier = {
			factor = 0.1
				NAND = {
					scaled_wealth = 1.25
					wealth = 125
				}
			has_character_flag = guilds_shopping_item_e_3
			}
		}
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_shopping_item_a_3 = {
				add_artifact = guilds_item_pottery
				custom_tooltip = { text = guilds_item_pottery_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.05 min = -5 max = -50 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.10 min = -10 max = -100 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.15 min = -15 max = -150 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.20 min = -20 max = -200 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.25 min = -25 max = -250 } }
				}					
				if = {
					limit = {
						has_dlc = "Reapers"
						location = { 
							NOR = { 
								has_province_modifier = prosperity_modifier_2
								has_province_modifier = prosperity_modifier_3
								has_province_modifier = depopulated_2
								has_province_modifier = depopulated_3
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = -0.01 min = -1 max = -10 } #prosperity bonus
				}
				if = {
					limit = { 
						location = { 
							OR = {
								has_province_modifier = guilds_buff_alcohol 
								has_province_modifier = guilds_buff_grain
								has_province_modifier = guilds_buff_meat
							} 
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
					scaled_wealth = { value = -0.015 min = -1 max = -15 } #goods bonus
				}
			}
			guilds_shopping_item_b_3 = {
				add_artifact = guilds_item_alcohol
				custom_tooltip = { text = guilds_item_alcohol_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.30 min = -30 max = -300 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.35 min = -35 max = -350 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.40 min = -40 max = -400 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.45 min = -45 max = -450 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.50 min = -50 max = -500 } }
				}					
				if = {
					limit = {
						has_dlc = "Reapers"
						location = { 
							OR = {
								has_province_modifier = prosperity_modifier_1
								has_province_modifier = prosperity_modifier_2
								has_province_modifier = prosperity_modifier_3
								has_province_modifier = depopulated_2
								has_province_modifier = depopulated_3
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = -0.05 min = -5 max = -50 } #prosperity bonus
				}
				if = {
					limit = {
						has_dlc = "Reapers"
						location = { 
							OR = {
								has_province_modifier = depopulated_1
								has_province_modifier = depopulated_2
								has_province_modifier = depopulated_3
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity bonus
				}
				if = {
					limit = { location = { owner = { war = yes } } }
					custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
					scaled_wealth = { value = -0.075 min = -7 max = -75 } #war bonus
				}
				if = { limit = { location = { is_winter = yes } }
					custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
					scaled_wealth = { value = -0.1 min = -10 max = -100 } #terrain bonus
				}
			}
			guilds_shopping_item_c_3 = {
				add_artifact = guilds_item_armor
				custom_tooltip = { text = guilds_item_armor_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.55 min = -55 max = -550 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -0.60 min = -60 max = -600 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.65 min = -65 max = -650 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.70 min = -70 max = -700 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.75 min = -75 max = -750 } }
				}					
					if = {
						limit = { location = { owner = { war = yes } } }
						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = -0.20 min = -20 max = -200 } #At war bonus
					}
					if = {
						limit = { location = { owner = { war = no } } }
 						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = 0.10 min = 10 max = 100 } #At war malus
					}
					if = {
						limit = {
							location = {
								owner = {
									or = {
										has_character_flag = tournament_begins
										has_character_flag = tournament_begins_furusiyya
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_festivitie_tooltip }
						scaled_wealth = { value = 0.1 min = 1 max = 100 } #festivitie bonus
					}
			}
			guilds_shopping_item_d_3 = {
				add_artifact = guilds_item_jewelry
				custom_tooltip = { text = guilds_item_jewelry_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_2 = { scaled_wealth = { value = -0.80 min = -80 max = -800 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = -0.85 min = -85 max = -850 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -0.90 min = -90 max = -900 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -0.95 min = -95 max = -950 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -1 min = -100 max = -1000 } }
				}					
					if = { 
						limit = { 
							has_dlc = "Reapers"
							location = { 
								has_province_modifier = prosperity_modifier_1
							} 
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.05 min = -5 max = -50 } #prosperity bonus
					}
					if = { 
						limit = { 
							has_dlc = "Reapers"
							location = { 
								OR = {
									has_province_modifier = prosperity_modifier_3
									has_province_modifier = prosperity_modifier_2
								}
							} 
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity bonus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.2 min = 20 max = 200 } #prosperity malus
					}
					if = {
						limit = { 
							location = { 
								OR = {
									has_province_modifier = guilds_buff_gem
									has_province_modifier = guilds_buff_silver 
									has_province_modifier = guilds_buff_gold 
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #goods malus
					}
			}
			guilds_shopping_item_e_3 = {
				add_artifact = guilds_item_book
				custom_tooltip = { text = guilds_item_book_tooltip }
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_5 = { scaled_wealth = { value = -1.05 min = -105 max = -1050 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = -1.1 min = -110 max = -1100 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = -1.15 min = -115 max = -1150 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = -1.2 min = -120 max = -1200 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = -1.25 min = -125 max = -1250 } }
				}					
				if = { 
					limit = { 
						has_dlc = "Reapers"
						location = { 
							has_province_modifier = prosperity_modifier_1
						} 
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = -0.05 min = -5 max = -50 } #prosperity bonus
				}
				if = { 
					limit = { 
						has_dlc = "Reapers"
						location = { 
							OR = {
								has_province_modifier = prosperity_modifier_3
								has_province_modifier = prosperity_modifier_2
							}
						} 
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity bonus
				}
				if = {
					limit = { 
						has_dlc = "Reapers"
						location = {
							OR = {
								has_province_modifier = depopulated_1
								has_province_modifier = depopulated_2
								has_province_modifier = depopulated_3
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
					scaled_wealth = { value = 0.2 min = 20 max = 200 } #prosperity malus
				}
				if = {
					limit = {
						location = {
							capital_holding = {
								OR = {
									holding_type = temple
									holding_type = city 
								}
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
					scaled_wealth = { value = -0.1 min = -10 max = -100 } #terrain bonus
				}
				if = {
					limit = { 
						location = {
							capital_holding = {
								OR = {
									holding_type = tribal
									holding_type = nomad
								}
							}
						}
					}
					custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
					scaled_wealth = { value = 0.15 min = 15 max = 150 } #terrain malus - changed from 0.3 due to high inverted value
				}
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		name = EVTOPTZ_SNW_1313
		ai_chance = {
		factor = 0.5
		}

	}
	after = { 
	clr_character_flag = guilds_shopping_price_1
	clr_character_flag = guilds_shopping_price_2
	clr_character_flag = guilds_shopping_price_3
	clr_character_flag = guilds_shopping_price_4
	clr_character_flag = guilds_shopping_price_5
	clr_character_flag = guilds_shopping_item_a_1
	clr_character_flag = guilds_shopping_item_b_1
	clr_character_flag = guilds_shopping_item_c_1
	clr_character_flag = guilds_shopping_item_d_1
	clr_character_flag = guilds_shopping_item_e_1
	clr_character_flag = guilds_shopping_item_a_2
	clr_character_flag = guilds_shopping_item_b_2
	clr_character_flag = guilds_shopping_item_c_2
	clr_character_flag = guilds_shopping_item_d_2
	clr_character_flag = guilds_shopping_item_e_2
	clr_character_flag = guilds_shopping_item_a_3
	clr_character_flag = guilds_shopping_item_b_3
	clr_character_flag = guilds_shopping_item_c_3
	clr_character_flag = guilds_shopping_item_d_3
	clr_character_flag = guilds_shopping_item_e_3
	}
}

#Shopping Sell
character_event = {
	id = SNW.1315
	desc = EVTDESC_SNW_1315
	picture = GFX_evt_market
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	immediate = { set_character_flag = guilds_is_using_goods }
	
	option = { #Metal
		name = EVTOPTA_SNW_1315
		character_event = { id = SNW.1316 }
	}
	option = { #Vegetal
		name = EVTOPTB_SNW_1315
		character_event = { id = SNW.1317 }
	}
	option = { #Animal
		name = EVTOPTC_SNW_1315
		character_event = { id = SNW.1318 }
	}
	option = { #Goods
		name = EVTOPTD_SNW_1315
		character_event = { id = SNW.1319 }
	}
}

#Shopping sell metal
character_event = {
	id = SNW.1316
	desc = EVTDESC_SNW_1316
	picture = GFX_evt_market
	border = GFX_event_normal_frame_economy_guilds
		
	is_triggered_only = yes

		immediate = {
		random_list = { #A
			20 = {
				set_character_flag = guilds_shopping_item_a_1
				modifier = {
					factor = 2
					has_artifact = guilds_item_stone
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_b_1
				modifier = {
					factor = 2
					has_artifact = guilds_item_steel
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_c_1
				modifier = {
					factor = 2
					has_artifact = guilds_item_gem
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_d_1
				modifier = {
					factor = 2
					has_artifact = guilds_item_silver
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_e_1
				modifier = {
					factor = 2
					has_artifact = guilds_item_gold
				}
			}
		}
		random_list = { #B
			20 = {
				set_character_flag = guilds_shopping_item_a_2
				modifier = {
					factor = 2
					has_artifact = guilds_item_stone
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_b_2
				modifier = {
					factor = 2
					has_artifact = guilds_item_steel
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_c_2
				modifier = {
					factor = 2
					has_artifact = guilds_item_gem
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_d_2
				modifier = {
					factor = 2
					has_artifact = guilds_item_silver
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_e_2
				modifier = {
					factor = 2
					has_artifact = guilds_item_gold
				}
			}
		}
		random_list = { #C
			20 = {
				set_character_flag = guilds_shopping_item_a_3
				modifier = {
					factor = 2
					has_artifact = guilds_item_stone
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_b_3
				modifier = {
					factor = 2
					has_artifact = guilds_item_steel
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_c_3
				modifier = {
					factor = 2
					has_artifact = guilds_item_gem
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_d_3
				modifier = {
					factor = 2
					has_artifact = guilds_item_silver
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_e_3
				modifier = {
					factor = 2
					has_artifact = guilds_item_gold
				}
			}
		}
		random_list = { #prices
			20 = {
				set_character_flag = guilds_shopping_price_1
			}
			20 = {
				set_character_flag = guilds_shopping_price_2
			}
			20 = {
				set_character_flag = guilds_shopping_price_3
			}
			20 = {
				set_character_flag = guilds_shopping_price_4
			}
			20 = {
				set_character_flag = guilds_shopping_price_5
			}
		}
	}
	
	option = {
		trigger = {
			OR = {
				AND = {
					has_character_flag = guilds_shopping_item_a_1
					has_artifact = guilds_item_stone
				}
				AND = {
					has_character_flag = guilds_shopping_item_b_1
					has_artifact = guilds_item_steel
				}
				AND = {
					has_character_flag = guilds_shopping_item_c_1
					has_artifact = guilds_item_gem
				}
				AND = {
					has_character_flag = guilds_shopping_item_d_1
					has_artifact = guilds_item_silver
				}
				AND = {
					has_character_flag = guilds_shopping_item_e_1
					has_artifact = guilds_item_gold
				}
			}
		}
		name = {
			text = EVTOPTA_SNW_1316
				trigger = { has_character_flag = guilds_shopping_item_a_1 }
		}
		name = {
			text = EVTOPTB_SNW_1316
				trigger = { has_character_flag = guilds_shopping_item_b_1 }
		}
		name = {
			text = EVTOPTC_SNW_1316
				trigger = { has_character_flag = guilds_shopping_item_c_1 }
		}
		name = {
			text = EVTOPTD_SNW_1316
				trigger = { has_character_flag = guilds_shopping_item_d_1 }
		}
		name = {
			text = EVTOPTE_SNW_1316
				trigger = { has_character_flag = guilds_shopping_item_e_1 }
		}
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_shopping_item_a_1 = {
				if = { limit = { has_artifact = guilds_item_stone } 
				destroy_artifact = guilds_item_stone
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.05 min = 5 max = 50 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.10 min = 10 max = 100 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.15 min = 15 max = 150 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.20 min = 20 max = 200 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.25 min = 25 max = 250 } }
				}
					if = {
						limit = { location = { has_settlement_construction = yes } }
						custom_tooltip = { text = guilds_goods_bonus_construction_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #construction bonus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = hills
									terrain = mountain
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.02 min = -2 max = -20 } #terrain malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = jungle
									terrain = steppe
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.02 min = 2 max = 20 } #terrain bonus
					}
				}
			}
			guilds_shopping_item_b_1 = {
				if = { limit = { has_artifact = guilds_item_steel } 
				destroy_artifact = guilds_item_steel
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.30 min = 30 max = 300 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.35 min = 35 max = 350 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.40 min = 40 max = 400 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.45 min = 45 max = 450 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.50 min = 50 max = 500 } }
				}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								NOR = {
									has_province_modifier = prosperity_modifier_1
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.05 min = -5 max = -50 } #prosperity malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = farmlands
									terrain = plains
									terrain = forest
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #terrain bonus
					}
					if = {
						limit = { location = { owner = { war = yes } } }
						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #war bonus
					}
				}
			}
			guilds_shopping_item_c_1 = {
				if = { limit = { has_artifact = guilds_item_gem } 
				destroy_artifact = guilds_item_gem
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.55 min = 55 max = 550 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.60 min = 60 max = 600 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.65 min = 65 max = 650 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.70 min = 70 max = 700 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.75 min = 75 max = 750 } }
				}
					if = { 
						limit = { 
							has_dlc = "Reapers"
							location = { 
								has_province_modifier = prosperity_modifier_2 
							} 
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity bonus
					}
					if = { 
						limit = { 
							has_dlc = "Reapers"
							location = { 
								OR = {
									has_province_modifier = prosperity_modifier_3
									has_province_modifier = prosperity_modifier_1
								}
							} 
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #prosperity bonus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = hills
									terrain = mountain
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.125 min = -12 max = -125 } #terrain malus
					}
					if = {
						limit = { location = { has_epidemic = yes } }
						custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #epidemic bonus
					}
				}
			}
			guilds_shopping_item_d_1 = {
				if = { limit = { has_artifact = guilds_item_silver } 
				destroy_artifact = guilds_item_silver
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.80 min = 80 max = 800 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.85 min = 85 max = 850 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.90 min = 90 max = 900 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.95 min = 95 max = 950 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 1 min = 100 max = 1000 } }
				}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.2 min = -20 max = -200 } #prosperity malus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								NOR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
									has_province_modifier = prosperity_modifier_1
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = hills
									terrain = mountain
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.15 min = -15 max = -150 } #terrain malus
					}
					if = {
						limit = { location = { has_epidemic = yes } }
						custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
						scaled_wealth = { value = 0.20 min = 20 max = 200 } #epidemic bonus
					}
				}
			}
			guilds_shopping_item_e_1 = {
				if = { limit = { has_artifact = guilds_item_gold } 
				destroy_artifact = guilds_item_gold
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = 1.05 min = 105 max = 1050 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 1.1 min = 110 max = 1100 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 1.15 min = 115 max = 1150 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 1.2 min = 120 max = 1200 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 1.25 min = 125 max = 1250 } }
				}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.35 min = -350 max = -350 } #prosperity malus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity bonus
					}
					if = {
						limit = { location = { has_epidemic = yes } }
						custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #epidemic malus
					}
					if = {
						limit = { location = { owner = { war = yes } } }
						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = -0.2 min = -20 max = -200 } #war malus
					}
				}
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		trigger = {
			OR = {
				AND = {
					has_character_flag = guilds_shopping_item_a_2
					has_artifact = guilds_item_stone
				}
				AND = {
					has_character_flag = guilds_shopping_item_b_2
					has_artifact = guilds_item_steel
				}
				AND = {
					has_character_flag = guilds_shopping_item_c_2
					has_artifact = guilds_item_gem
				}
				AND = {
					has_character_flag = guilds_shopping_item_d_2
					has_artifact = guilds_item_silver
				}
				AND = {
					has_character_flag = guilds_shopping_item_e_2
					has_artifact = guilds_item_gold
				}
			}
		}
		name = {
			text = EVTOPTA_SNW_1316
				trigger = { has_character_flag = guilds_shopping_item_a_2 }
		}
		name = {
			text = EVTOPTB_SNW_1316
				trigger = { has_character_flag = guilds_shopping_item_b_2 }
		}
		name = {
			text = EVTOPTC_SNW_1316
				trigger = { has_character_flag = guilds_shopping_item_c_2 }
		}
		name = {
			text = EVTOPTD_SNW_1316
				trigger = { has_character_flag = guilds_shopping_item_d_2 }
		}
		name = {
			text = EVTOPTE_SNW_1316
				trigger = { has_character_flag = guilds_shopping_item_e_2 }
		}
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_shopping_item_a_2 = {
				if = { limit = { has_artifact = guilds_item_stone } 
				destroy_artifact = guilds_item_stone
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.05 min = 5 max = 50 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.10 min = 10 max = 100 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.15 min = 15 max = 150 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.20 min = 20 max = 200 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.25 min = 25 max = 250 } }
				}
					if = {
						limit = { location = { has_settlement_construction = yes } }
						custom_tooltip = { text = guilds_goods_bonus_construction_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #construction bonus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = hills
									terrain = mountain
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.02 min = -2 max = -20 } #terrain malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = jungle
									terrain = steppe
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.02 min = 2 max = 20 } #terrain bonus
					}
				}
			}
			guilds_shopping_item_b_2 = {
				if = { limit = { has_artifact = guilds_item_steel } 
				destroy_artifact = guilds_item_steel
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.30 min = 30 max = 300 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.35 min = 35 max = 350 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.40 min = 40 max = 400 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.45 min = 45 max = 450 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.50 min = 50 max = 500 } }
				}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								NOR = {
									has_province_modifier = prosperity_modifier_1
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.05 min = -5 max = -50 } #prosperity malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = farmlands
									terrain = plains
									terrain = forest
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #terrain bonus
					}
					if = {
						limit = { location = { owner = { war = yes } } }
						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #war bonus
					}
				}
			}
			guilds_shopping_item_c_2 = {
				if = { limit = { has_artifact = guilds_item_gem } 
				destroy_artifact = guilds_item_gem
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.55 min = 55 max = 550 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.60 min = 60 max = 600 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.65 min = 65 max = 650 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.70 min = 70 max = 700 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.75 min = 75 max = 750 } }
				}
					if = { 
						limit = { 
							has_dlc = "Reapers"
							location = { 
								has_province_modifier = prosperity_modifier_2 
							} 
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity bonus
					}
					if = { 
						limit = { 
							has_dlc = "Reapers"
							location = { 
								OR = {
									has_province_modifier = prosperity_modifier_3
									has_province_modifier = prosperity_modifier_1
								}
							} 
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #prosperity bonus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = hills
									terrain = mountain
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.125 min = -12 max = -125 } #terrain malus
					}
					if = {
						limit = { location = { has_epidemic = yes } }
						custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #epidemic bonus
					}
				}
			}
			guilds_shopping_item_d_2 = {
				if = { limit = { has_artifact = guilds_item_silver } 
				destroy_artifact = guilds_item_silver
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.80 min = 80 max = 800 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.85 min = 85 max = 850 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.90 min = 90 max = 900 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.95 min = 95 max = 950 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 1 min = 100 max = 1000 } }
				}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.2 min = -20 max = -200 } #prosperity malus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								NOR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
									has_province_modifier = prosperity_modifier_1
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = hills
									terrain = mountain
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.15 min = -15 max = -150 } #terrain malus
					}
					if = {
						limit = { location = { has_epidemic = yes } }
						custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
						scaled_wealth = { value = 0.20 min = 20 max = 200 } #epidemic bonus
					}
				}
			}
			guilds_shopping_item_e_2 = {
				if = { limit = { has_artifact = guilds_item_gold } 
				destroy_artifact = guilds_item_gold
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_3 = { scaled_wealth = { value = 1.05 min = 105 max = 1050 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 1.1 min = 110 max = 1100 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 1.15 min = 115 max = 1150 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 1.2 min = 120 max = 1200 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 1.25 min = 125 max = 1250 } }
				}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.35 min = -350 max = -350 } #prosperity malus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity bonus
					}
					if = {
						limit = { location = { has_epidemic = yes } }
						custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #epidemic malus
					}
					if = {
						limit = { location = { owner = { war = yes } } }
						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = -0.2 min = -20 max = -200 } #war malus
					}
				}
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		trigger = {
			OR = {
				AND = {
					has_character_flag = guilds_shopping_item_a_3
					has_artifact = guilds_item_stone
				}
				AND = {
					has_character_flag = guilds_shopping_item_b_3
					has_artifact = guilds_item_steel
				}
				AND = {
					has_character_flag = guilds_shopping_item_c_3
					has_artifact = guilds_item_gem
				}
				AND = {
					has_character_flag = guilds_shopping_item_d_3
					has_artifact = guilds_item_silver
				}
				AND = {
					has_character_flag = guilds_shopping_item_e_3
					has_artifact = guilds_item_gold
				}
			}
		}
		name = {
			text = EVTOPTA_SNW_1316
				trigger = { has_character_flag = guilds_shopping_item_a_3 }
		}
		name = {
			text = EVTOPTB_SNW_1316
				trigger = { has_character_flag = guilds_shopping_item_b_3 }
		}
		name = {
			text = EVTOPTC_SNW_1316
				trigger = { has_character_flag = guilds_shopping_item_c_3 }
		}
		name = {
			text = EVTOPTD_SNW_1316
				trigger = { has_character_flag = guilds_shopping_item_d_3 }
		}
		name = {
			text = EVTOPTE_SNW_1316
				trigger = { has_character_flag = guilds_shopping_item_e_3 }
		}
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_shopping_item_a_3 = {
				if = { limit = { has_artifact = guilds_item_stone } 
				destroy_artifact = guilds_item_stone
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.05 min = 5 max = 50 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.10 min = 10 max = 100 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.15 min = 15 max = 150 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.20 min = 20 max = 200 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.25 min = 25 max = 250 } }
				}
					if = {
						limit = { location = { has_settlement_construction = yes } }
						custom_tooltip = { text = guilds_goods_bonus_construction_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #construction bonus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = hills
									terrain = mountain
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.02 min = -2 max = -20 } #terrain malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = jungle
									terrain = steppe
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.02 min = 2 max = 20 } #terrain bonus
					}
				}
			}
			guilds_shopping_item_b_3 = {
				if = { limit = { has_artifact = guilds_item_steel } 
				destroy_artifact = guilds_item_steel
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.30 min = 30 max = 300 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.35 min = 35 max = 350 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.40 min = 40 max = 400 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.45 min = 45 max = 450 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.50 min = 50 max = 500 } }
				}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								NOR = {
									has_province_modifier = prosperity_modifier_1
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.05 min = -5 max = -50 } #prosperity malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = farmlands
									terrain = plains
									terrain = forest
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #terrain bonus
					}
					if = {
						limit = { location = { owner = { war = yes } } }
						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #war bonus
					}
				}
			}
			guilds_shopping_item_c_3 = {
				if = { limit = { has_artifact = guilds_item_gem } 
				destroy_artifact = guilds_item_gem
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.55 min = 55 max = 550 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.60 min = 60 max = 600 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.65 min = 65 max = 650 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.70 min = 70 max = 700 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.75 min = 75 max = 750 } }
				}
					if = { 
						limit = { 
							has_dlc = "Reapers"
							location = { 
								has_province_modifier = prosperity_modifier_2 
							} 
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity bonus
					}
					if = { 
						limit = { 
							has_dlc = "Reapers"
							location = { 
								OR = {
									has_province_modifier = prosperity_modifier_3
									has_province_modifier = prosperity_modifier_1
								}
							} 
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #prosperity bonus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = hills
									terrain = mountain
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.125 min = -12 max = -125 } #terrain malus
					}
					if = {
						limit = { location = { has_epidemic = yes } }
						custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #epidemic bonus
					}
				}
			}
			guilds_shopping_item_d_3 = {
				if = { limit = { has_artifact = guilds_item_silver } 
				destroy_artifact = guilds_item_silver
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.80 min = 80 max = 800 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.85 min = 85 max = 850 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.90 min = 90 max = 900 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.95 min = 95 max = 950 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 1 min = 100 max = 1000 } }
				}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.2 min = -20 max = -200 } #prosperity malus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								NOR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
									has_province_modifier = prosperity_modifier_1
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = hills
									terrain = mountain
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.15 min = -15 max = -150 } #terrain malus
					}
					if = {
						limit = { location = { has_epidemic = yes } }
						custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
						scaled_wealth = { value = 0.20 min = 20 max = 200 } #epidemic bonus
					}
				}
			}
			guilds_shopping_item_e_3 = {
				if = { limit = { has_artifact = guilds_item_gold } 
				destroy_artifact = guilds_item_gold
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_5 = { scaled_wealth = { value = 1.05 min = 105 max = 1050 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 1.1 min = 110 max = 1100 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 1.15 min = 115 max = 1150 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 1.2 min = 120 max = 1200 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 1.25 min = 125 max = 1250 } }
				}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.35 min = -350 max = -350 } #prosperity malus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity bonus
					}
					if = {
						limit = { location = { has_epidemic = yes } }
						custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #epidemic malus
					}
					if = {
						limit = { location = { owner = { war = yes } } }
						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = -0.2 min = -20 max = -200 } #war malus
					}
				}
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		name = EVTOPTZ_SNW_1316
	}
	after = { 
	clr_character_flag = guilds_shopping_price_1
	clr_character_flag = guilds_shopping_price_2
	clr_character_flag = guilds_shopping_price_3
	clr_character_flag = guilds_shopping_price_4
	clr_character_flag = guilds_shopping_price_5
	clr_character_flag = guilds_shopping_item_a_1
	clr_character_flag = guilds_shopping_item_b_1
	clr_character_flag = guilds_shopping_item_c_1
	clr_character_flag = guilds_shopping_item_d_1
	clr_character_flag = guilds_shopping_item_e_1
	clr_character_flag = guilds_shopping_item_a_2
	clr_character_flag = guilds_shopping_item_b_2
	clr_character_flag = guilds_shopping_item_c_2
	clr_character_flag = guilds_shopping_item_d_2
	clr_character_flag = guilds_shopping_item_e_2
	clr_character_flag = guilds_shopping_item_a_3
	clr_character_flag = guilds_shopping_item_b_3
	clr_character_flag = guilds_shopping_item_c_3
	clr_character_flag = guilds_shopping_item_d_3
	clr_character_flag = guilds_shopping_item_e_3
	clr_character_flag = guilds_is_using_goods
	}
}

#Shopping sell vegetal
character_event = {
	id = SNW.1317
	desc = EVTDESC_SNW_1317
	picture = GFX_evt_market
	border = GFX_event_normal_frame_economy_guilds
		
	is_triggered_only = yes

		immediate = {
		random_list = { #A
			20 = {
				set_character_flag = guilds_shopping_item_a_1
				modifier = {
					factor = 2
					has_artifact = guilds_item_grain
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_b_1
				modifier = {
					factor = 2
					has_artifact = guilds_item_lumber
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_c_1
				modifier = {
					factor = 2
					has_artifact = guilds_item_linen
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_d_1
				modifier = {
					factor = 2
					has_artifact = guilds_item_incense
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_e_1
				modifier = {
					factor = 2
					has_artifact = guilds_item_spices
				}
			}
		}
		random_list = { #B
			20 = {
				set_character_flag = guilds_shopping_item_a_2
				modifier = {
					factor = 2
					has_artifact = guilds_item_grain
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_b_2
				modifier = {
					factor = 2
					has_artifact = guilds_item_lumber
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_c_2
				modifier = {
					factor = 2
					has_artifact = guilds_item_linen
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_d_2
				modifier = {
					factor = 2
					has_artifact = guilds_item_incense
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_e_2
				modifier = {
					factor = 2
					has_artifact = guilds_item_spices
				}
			}
		}
		random_list = { #C
			20 = {
				set_character_flag = guilds_shopping_item_a_3
				modifier = {
					factor = 2
					has_artifact = guilds_item_grain
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_b_3
				modifier = {
					factor = 2
					has_artifact = guilds_item_lumber
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_c_3
				modifier = {
					factor = 2
					has_artifact = guilds_item_linen
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_d_3
				modifier = {
					factor = 2
					has_artifact = guilds_item_incense
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_e_3
				modifier = {
					factor = 2
					has_artifact = guilds_item_spices
				}
			}
		}
		random_list = { #prices
			20 = {
				set_character_flag = guilds_shopping_price_1
			}
			20 = {
				set_character_flag = guilds_shopping_price_2
			}
			20 = {
				set_character_flag = guilds_shopping_price_3
			}
			20 = {
				set_character_flag = guilds_shopping_price_4
			}
			20 = {
				set_character_flag = guilds_shopping_price_5
			}
		}
	}
	
	option = { 
		trigger = {
			OR = {
				AND = {
					has_character_flag = guilds_shopping_item_a_1
					has_artifact = guilds_item_grain
				}
				AND = {
					has_character_flag = guilds_shopping_item_b_1
					has_artifact = guilds_item_lumber
				}
				AND = {
					has_character_flag = guilds_shopping_item_c_1
					has_artifact = guilds_item_linen
				}
				AND = {
					has_character_flag = guilds_shopping_item_d_1
					has_artifact = guilds_item_incense
				}
				AND = {
					has_character_flag = guilds_shopping_item_e_1
					has_artifact = guilds_item_spices
				}
			}
		}
		name = {
			text = EVTOPTA_SNW_1317
				trigger = { has_character_flag = guilds_shopping_item_a_1 }
		}
		name = {
			text = EVTOPTB_SNW_1317
				trigger = { has_character_flag = guilds_shopping_item_b_1 }
		}
		name = {
			text = EVTOPTC_SNW_1317
				trigger = { has_character_flag = guilds_shopping_item_c_1 }
		}
		name = {
			text = EVTOPTD_SNW_1317
				trigger = { has_character_flag = guilds_shopping_item_d_1 }
		}
		name = {
			text = EVTOPTE_SNW_1317
				trigger = { has_character_flag = guilds_shopping_item_e_1 }
		}
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_shopping_item_a_1 = {
				if = { limit = { has_artifact = guilds_item_grain } 
				destroy_artifact = guilds_item_grain
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.05 min = 5 max = 50 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.10 min = 10 max = 100 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.15 min = 15 max = 150 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.20 min = 20 max = 200 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.25 min = 25 max = 250 } }
				}
					if = {
						limit = {
							has_dlc = "Reapers"
							location = { 
								OR = { 
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.10 min = 10 max = 100 } #prosperity bonus
					}
					if = {
						limit = {
							location = {
								terrain = farmlands
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.015 min = -1 max = -15 } #terrain malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = plains
									terrain = steppe 
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.01 min = -1 max = -10 } #terrain malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = desert
									terrain = mountain
									terrain = arctic
									is_winter = yes
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.015 min = 1 max = 15 } #terrain bonus
					}
					if = {
						limit = { location = { owner = { war = yes } } }
						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = 0.025 min = 2 max = 25 } #war bonus
					}
					if = {
						limit = { 
							location = { 
								owner = {
									or = {
										has_character_modifier = guilds_buff_feast
										has_character_modifier = fabulous_feast
										has_character_modifier = holding_large_feast
										has_character_modifier = holding_diwali_feast 
										has_character_modifier = holding_kali_puja_feast
										has_character_modifier = holding_zun_feast
										has_character_flag = holding_blot
										has_character_flag = holding_ukon_juhla
										has_character_flag = holding_uzgavenes
										has_character_flag = holding_jarilo
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_festivitie_tooltip }
						scaled_wealth = { value = 0.02 min = 2 max = 20 } #festivitie bonus
					}
				}
			}
			guilds_shopping_item_b_1 = {
				if = { limit = { has_artifact = guilds_item_lumber } 
				destroy_artifact = guilds_item_lumber
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.30 min = 30 max = 300 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.35 min = 35 max = 350 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.40 min = 40 max = 400 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.45 min = 45 max = 450 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.50 min = 50 max = 500 } }
				}
					if = {
						limit = { location = { has_settlement_construction = yes } }
						custom_tooltip = { text = guilds_goods_bonus_construction_tooltip }
						scaled_wealth = { value = 0.075 min = 7 max = 75 } #construction bonus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = jungle
									terrain = forest
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.05 min = -5 max = -50 } #terrain malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = desert
									terrain = steppe
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #terrain bonus
					}
				}
			}
			guilds_shopping_item_c_1 = {
				if = { limit = { has_artifact = guilds_item_linen } 
				destroy_artifact = guilds_item_linen
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.55 min = 55 max = 550 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.60 min = 60 max = 600 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.65 min = 65 max = 650 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.70 min = 70 max = 700 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.75 min = 75 max = 750 } }
				}
					if = {
						limit = { location = { has_province_modifier = guilds_buff_dye } }
						custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
						scaled_wealth = { value = 0.10 min = 10 max = 100 } #goods bonus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = { 
								OR = {
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_3
								}
							} 
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity bonus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = farmlands
									terrain = jungle
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.05 min = -5 max = -50 } #terrain malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = desert
									terrain = arctic
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #terrain bonus
					}
				}
			}
			guilds_shopping_item_d_1 = {
				if = { limit = { has_artifact = guilds_item_incense } 
				destroy_artifact = guilds_item_incense
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.80 min = 80 max = 800 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.85 min = 85 max = 850 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.90 min = 90 max = 900 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.95 min = 95 max = 950 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 1 min = 100 max = 1000 } }
				}
					if = {
						limit = { 
							location = { 
								owner = { 
									or = {
										has_character_modifier = holding_diwali_feast 
										has_character_modifier = holding_kali_puja_feast
	
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_festivitie_tooltip }
						scaled_wealth = { value = 0.15 min = 15 max = 150 } #festivitie bonus
					}
					if = {
						limit = { location = { has_epidemic = yes } }
						custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
						scaled_wealth = { value = 0.10 min = 10 max = 100 } #epidemic bonus
					}
					if = {
						limit = {
							location = {
								capital_holding = {
									holding_type = temple
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #terrain bonus
					}
				}
			}
			guilds_shopping_item_e_1 = {
				if = { limit = { has_artifact = guilds_item_spices } 
				destroy_artifact = guilds_item_spices
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = 1.05 min = 105 max = 1050 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 1.1 min = 110 max = 1100 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 1.15 min = 115 max = 1150 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 1.2 min = 120 max = 1200 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 1.25 min = 125 max = 1250 } }
				}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.20 min = -200 max = -200 } #prosperity malus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity bonus
					}
					if = {
						limit = { 
							location = { 
								owner = {
									or = {
										has_character_modifier = guilds_buff_feast
										has_character_modifier = fabulous_feast
										has_character_modifier = holding_large_feast
										has_character_modifier = holding_diwali_feast 
										has_character_modifier = holding_kali_puja_feast
										has_character_modifier = holding_zun_feast
										has_character_flag = holding_blot
										has_character_flag = holding_ukon_juhla
										has_character_flag = holding_uzgavenes
										has_character_flag = holding_jarilo
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_festivitie_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #festivitie bonus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = jungle
									terrain = desert
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.15 min = -15 max = -150 } #terrain malus
					}
				}
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		trigger = {
			OR = {
				AND = {
					has_character_flag = guilds_shopping_item_a_2
					has_artifact = guilds_item_grain
				}
				AND = {
					has_character_flag = guilds_shopping_item_b_2
					has_artifact = guilds_item_lumber
				}
				AND = {
					has_character_flag = guilds_shopping_item_c_2
					has_artifact = guilds_item_linen
				}
				AND = {
					has_character_flag = guilds_shopping_item_d_2
					has_artifact = guilds_item_incense
				}
				AND = {
					has_character_flag = guilds_shopping_item_e_2
					has_artifact = guilds_item_spices
				}
			}
		}
		name = {
			text = EVTOPTA_SNW_1317
				trigger = { has_character_flag = guilds_shopping_item_a_2 }
		}
		name = {
			text = EVTOPTB_SNW_1317
				trigger = { has_character_flag = guilds_shopping_item_b_2 }
		}
		name = {
			text = EVTOPTC_SNW_1317
				trigger = { has_character_flag = guilds_shopping_item_c_2 }
		}
		name = {
			text = EVTOPTD_SNW_1317
				trigger = { has_character_flag = guilds_shopping_item_d_2 }
		}
		name = {
			text = EVTOPTE_SNW_1317
				trigger = { has_character_flag = guilds_shopping_item_e_2 }
		}
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_shopping_item_a_2 = {
				if = { limit = { has_artifact = guilds_item_grain } 
				destroy_artifact = guilds_item_grain
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.05 min = 5 max = 50 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.10 min = 10 max = 100 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.15 min = 15 max = 150 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.20 min = 20 max = 200 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.25 min = 25 max = 250 } }
				}
					if = {
						limit = {
							has_dlc = "Reapers"
							location = { 
								OR = { 
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.10 min = 10 max = 100 } #prosperity bonus
					}
					if = {
						limit = {
							location = {
								terrain = farmlands
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.015 min = -1 max = -15 } #terrain malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = plains
									terrain = steppe 
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.01 min = -1 max = -10 } #terrain malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = desert
									terrain = mountain
									terrain = arctic
									is_winter = yes
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.015 min = 1 max = 15 } #terrain bonus
					}
					if = {
						limit = { location = { owner = { war = yes } } }
						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = 0.025 min = 2 max = 25 } #war bonus
					}
					if = {
						limit = { 
							location = { 
								owner = {
									or = {
										has_character_modifier = guilds_buff_feast
										has_character_modifier = fabulous_feast
										has_character_modifier = holding_large_feast
										has_character_modifier = holding_diwali_feast 
										has_character_modifier = holding_kali_puja_feast
										has_character_modifier = holding_zun_feast
										has_character_flag = holding_blot
										has_character_flag = holding_ukon_juhla
										has_character_flag = holding_uzgavenes
										has_character_flag = holding_jarilo
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_festivitie_tooltip }
						scaled_wealth = { value = 0.02 min = 2 max = 20 } #festivitie bonus
					}
				}
			}
			guilds_shopping_item_b_2 = {
				if = { limit = { has_artifact = guilds_item_lumber } 
				destroy_artifact = guilds_item_lumber
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.30 min = 30 max = 300 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.35 min = 35 max = 350 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.40 min = 40 max = 400 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.45 min = 45 max = 450 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.50 min = 50 max = 500 } }
				}
					if = {
						limit = { location = { has_settlement_construction = yes } }
						custom_tooltip = { text = guilds_goods_bonus_construction_tooltip }
						scaled_wealth = { value = 0.075 min = 7 max = 75 } #construction bonus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = jungle
									terrain = forest
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.05 min = -5 max = -50 } #terrain malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = desert
									terrain = steppe
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #terrain bonus
					}
				}
			}
			guilds_shopping_item_c_2 = {
				if = { limit = { has_artifact = guilds_item_linen } 
				destroy_artifact = guilds_item_linen
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.55 min = 55 max = 550 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.60 min = 60 max = 600 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.65 min = 65 max = 650 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.70 min = 70 max = 700 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.75 min = 75 max = 750 } }
				}
					if = {
						limit = { location = { has_province_modifier = guilds_buff_dye } }
						custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
						scaled_wealth = { value = 0.10 min = 10 max = 100 } #goods bonus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = { 
								OR = {
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_3
								}
							} 
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity bonus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = farmlands
									terrain = jungle
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.05 min = -5 max = -50 } #terrain malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = desert
									terrain = arctic
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #terrain bonus
					}
				}
			}
			guilds_shopping_item_d_2 = {
				if = { limit = { has_artifact = guilds_item_incense } 
				destroy_artifact = guilds_item_incense
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.80 min = 80 max = 800 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.85 min = 85 max = 850 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.90 min = 90 max = 900 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.95 min = 95 max = 950 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 1 min = 100 max = 1000 } }
				}
					if = {
						limit = { 
							location = { 
								owner = { 
									or = {
										has_character_modifier = holding_diwali_feast 
										has_character_modifier = holding_kali_puja_feast
	
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_festivitie_tooltip }
						scaled_wealth = { value = 0.15 min = 15 max = 150 } #festivitie bonus
					}
					if = {
						limit = { location = { has_epidemic = yes } }
						custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
						scaled_wealth = { value = 0.10 min = 10 max = 100 } #epidemic bonus
					}
					if = {
						limit = {
							location = {
								capital_holding = {
									holding_type = temple
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #terrain bonus
					}
				}
			}
			guilds_shopping_item_e_2 = {
				if = { limit = { has_artifact = guilds_item_spices } 
				destroy_artifact = guilds_item_spices
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_3 = { scaled_wealth = { value = 1.05 min = 105 max = 1050 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 1.1 min = 110 max = 1100 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 1.15 min = 115 max = 1150 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 1.2 min = 120 max = 1200 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 1.25 min = 125 max = 1250 } }
				}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.20 min = -200 max = -200 } #prosperity malus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity bonus
					}
					if = {
						limit = { 
							location = { 
								owner = {
									or = {
										has_character_modifier = guilds_buff_feast
										has_character_modifier = fabulous_feast
										has_character_modifier = holding_large_feast
										has_character_modifier = holding_diwali_feast 
										has_character_modifier = holding_kali_puja_feast
										has_character_modifier = holding_zun_feast
										has_character_flag = holding_blot
										has_character_flag = holding_ukon_juhla
										has_character_flag = holding_uzgavenes
										has_character_flag = holding_jarilo
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_festivitie_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #festivitie bonus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = jungle
									terrain = desert
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.15 min = -15 max = -150 } #terrain malus
					}
				}
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		trigger = {
			OR = {
				AND = {
					has_character_flag = guilds_shopping_item_a_3
					has_artifact = guilds_item_grain
				}
				AND = {
					has_character_flag = guilds_shopping_item_b_3
					has_artifact = guilds_item_lumber
				}
				AND = {
					has_character_flag = guilds_shopping_item_c_3
					has_artifact = guilds_item_linen
				}
				AND = {
					has_character_flag = guilds_shopping_item_d_3
					has_artifact = guilds_item_incense
				}
				AND = {
					has_character_flag = guilds_shopping_item_e_3
					has_artifact = guilds_item_spices
				}
			}
		}
		name = {
			text = EVTOPTA_SNW_1317
				trigger = { has_character_flag = guilds_shopping_item_a_3 }
		}
		name = {
			text = EVTOPTB_SNW_1317
				trigger = { has_character_flag = guilds_shopping_item_b_3 }
		}
		name = {
			text = EVTOPTC_SNW_1317
				trigger = { has_character_flag = guilds_shopping_item_c_3 }
		}
		name = {
			text = EVTOPTD_SNW_1317
				trigger = { has_character_flag = guilds_shopping_item_d_3 }
		}
		name = {
			text = EVTOPTE_SNW_1317
				trigger = { has_character_flag = guilds_shopping_item_e_3 }
		}
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_shopping_item_a_3 = {
				if = { limit = { has_artifact = guilds_item_grain } 
				destroy_artifact = guilds_item_grain
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.05 min = 5 max = 50 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.10 min = 10 max = 100 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.15 min = 15 max = 150 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.20 min = 20 max = 200 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.25 min = 25 max = 250 } }
				}
					if = {
						limit = {
							has_dlc = "Reapers"
							location = { 
								OR = { 
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.10 min = 10 max = 100 } #prosperity bonus
					}
					if = {
						limit = {
							location = {
								terrain = farmlands
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.015 min = -1 max = -15 } #terrain malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = plains
									terrain = steppe 
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.01 min = -1 max = -10 } #terrain malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = desert
									terrain = mountain
									terrain = arctic
									is_winter = yes
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.015 min = 1 max = 15 } #terrain bonus
					}
					if = {
						limit = { location = { owner = { war = yes } } }
						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = 0.025 min = 2 max = 25 } #war bonus
					}
					if = {
						limit = { 
							location = { 
								owner = {
									or = {
										has_character_modifier = guilds_buff_feast
										has_character_modifier = fabulous_feast
										has_character_modifier = holding_large_feast
										has_character_modifier = holding_diwali_feast 
										has_character_modifier = holding_kali_puja_feast
										has_character_modifier = holding_zun_feast
										has_character_flag = holding_blot
										has_character_flag = holding_ukon_juhla
										has_character_flag = holding_uzgavenes
										has_character_flag = holding_jarilo
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_festivitie_tooltip }
						scaled_wealth = { value = 0.02 min = 2 max = 20 } #festivitie bonus
					}
				}
			}
			guilds_shopping_item_b_3 = {
				if = { limit = { has_artifact = guilds_item_lumber } 
				destroy_artifact = guilds_item_lumber
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.30 min = 30 max = 300 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.35 min = 35 max = 350 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.40 min = 40 max = 400 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.45 min = 45 max = 450 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.50 min = 50 max = 500 } }
				}
					if = {
						limit = { location = { has_settlement_construction = yes } }
						custom_tooltip = { text = guilds_goods_bonus_construction_tooltip }
						scaled_wealth = { value = 0.075 min = 7 max = 75 } #construction bonus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = jungle
									terrain = forest
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.05 min = -5 max = -50 } #terrain malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = desert
									terrain = steppe
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #terrain bonus
					}
				}
			}
			guilds_shopping_item_c_3 = {
				if = { limit = { has_artifact = guilds_item_linen } 
				destroy_artifact = guilds_item_linen
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.55 min = 55 max = 550 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.60 min = 60 max = 600 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.65 min = 65 max = 650 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.70 min = 70 max = 700 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.75 min = 75 max = 750 } }
				}
					if = {
						limit = { location = { has_province_modifier = guilds_buff_dye } }
						custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
						scaled_wealth = { value = 0.10 min = 10 max = 100 } #goods bonus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = { 
								OR = {
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_3
								}
							} 
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity bonus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = farmlands
									terrain = jungle
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.05 min = -5 max = -50 } #terrain malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = desert
									terrain = arctic
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #terrain bonus
					}
				}
			}
			guilds_shopping_item_d_3 = {
				if = { limit = { has_artifact = guilds_item_incense } 
				destroy_artifact = guilds_item_incense
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.80 min = 80 max = 800 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.85 min = 85 max = 850 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.90 min = 90 max = 900 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.95 min = 95 max = 950 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 1 min = 100 max = 1000 } }
				}
					if = {
						limit = { 
							location = { 
								owner = { 
									or = {
										has_character_modifier = holding_diwali_feast 
										has_character_modifier = holding_kali_puja_feast
	
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_festivitie_tooltip }
						scaled_wealth = { value = 0.15 min = 15 max = 150 } #festivitie bonus
					}
					if = {
						limit = { location = { has_epidemic = yes } }
						custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
						scaled_wealth = { value = 0.10 min = 10 max = 100 } #epidemic bonus
					}
					if = {
						limit = {
							location = {
								capital_holding = {
									holding_type = temple
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #terrain bonus
					}
				}
			}
			guilds_shopping_item_e_3 = {
				if = { limit = { has_artifact = guilds_item_spices } 
				destroy_artifact = guilds_item_spices
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_5 = { scaled_wealth = { value = 1.05 min = 105 max = 1050 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 1.1 min = 110 max = 1100 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 1.15 min = 115 max = 1150 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 1.2 min = 120 max = 1200 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 1.25 min = 125 max = 1250 } }
				}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.20 min = -200 max = -200 } #prosperity malus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity bonus
					}
					if = {
						limit = { 
							location = { 
								owner = {
									or = {
										has_character_modifier = guilds_buff_feast
										has_character_modifier = fabulous_feast
										has_character_modifier = holding_large_feast
										has_character_modifier = holding_diwali_feast 
										has_character_modifier = holding_kali_puja_feast
										has_character_modifier = holding_zun_feast
										has_character_flag = holding_blot
										has_character_flag = holding_ukon_juhla
										has_character_flag = holding_uzgavenes
										has_character_flag = holding_jarilo
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_festivitie_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #festivitie bonus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = jungle
									terrain = desert
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.15 min = -15 max = -150 } #terrain malus
					}
				}
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		name = EVTOPTZ_SNW_1317
	}
	after = { 
	clr_character_flag = guilds_shopping_price_1
	clr_character_flag = guilds_shopping_price_2
	clr_character_flag = guilds_shopping_price_3
	clr_character_flag = guilds_shopping_price_4
	clr_character_flag = guilds_shopping_price_5
	clr_character_flag = guilds_shopping_item_a_1
	clr_character_flag = guilds_shopping_item_b_1
	clr_character_flag = guilds_shopping_item_c_1
	clr_character_flag = guilds_shopping_item_d_1
	clr_character_flag = guilds_shopping_item_e_1
	clr_character_flag = guilds_shopping_item_a_2
	clr_character_flag = guilds_shopping_item_b_2
	clr_character_flag = guilds_shopping_item_c_2
	clr_character_flag = guilds_shopping_item_d_2
	clr_character_flag = guilds_shopping_item_e_2
	clr_character_flag = guilds_shopping_item_a_3
	clr_character_flag = guilds_shopping_item_b_3
	clr_character_flag = guilds_shopping_item_c_3
	clr_character_flag = guilds_shopping_item_d_3
	clr_character_flag = guilds_shopping_item_e_3
	clr_character_flag = guilds_is_using_goods
	}
}

#Shopping sell animal
character_event = {
	id = SNW.1318
	desc = EVTDESC_SNW_1318
	picture = GFX_evt_market
	border = GFX_event_normal_frame_economy_guilds
		
	is_triggered_only = yes

		immediate = {
		random_list = { #A
			20 = {
				set_character_flag = guilds_shopping_item_a_1
				modifier = {
					factor = 2
					has_artifact = guilds_item_meat
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_b_1
				modifier = {
					factor = 2
					has_artifact = guilds_item_wool
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_c_1
				modifier = {
					factor = 2
					has_artifact = guilds_item_hide
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_d_1
				modifier = {
					factor = 2
					has_artifact = guilds_item_ivory
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_e_1
				modifier = {
					factor = 2
					has_artifact = guilds_item_silk
				}
			}
		}
		random_list = { #B
			20 = {
				set_character_flag = guilds_shopping_item_a_2
				modifier = {
					factor = 2
					has_artifact = guilds_item_meat
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_b_2
				modifier = {
					factor = 2
					has_artifact = guilds_item_wool
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_c_2
				modifier = {
					factor = 2
					has_artifact = guilds_item_hide
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_d_2
				modifier = {
					factor = 2
					has_artifact = guilds_item_ivory
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_e_2
				modifier = {
					factor = 2
					has_artifact = guilds_item_silk
				}
			}
		}
		random_list = { #C
			20 = {
				set_character_flag = guilds_shopping_item_a_3
				modifier = {
					factor = 2
					has_artifact = guilds_item_meat
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_b_3
				modifier = {
					factor = 2
					has_artifact = guilds_item_wool
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_c_3
				modifier = {
					factor = 2
					has_artifact = guilds_item_hide
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_d_3
				modifier = {
					factor = 2
					has_artifact = guilds_item_ivory
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_e_3
				modifier = {
					factor = 2
					has_artifact = guilds_item_silk
				}
			}
		}
		random_list = { #prices
			20 = {
				set_character_flag = guilds_shopping_price_1
			}
			20 = {
				set_character_flag = guilds_shopping_price_2
			}
			20 = {
				set_character_flag = guilds_shopping_price_3
			}
			20 = {
				set_character_flag = guilds_shopping_price_4
			}
			20 = {
				set_character_flag = guilds_shopping_price_5
			}
		}
	}
	
	option = { 
		trigger = {
			OR = {
				AND = {
					has_character_flag = guilds_shopping_item_a_1
					has_artifact = guilds_item_meat
				}
				AND = {
					has_character_flag = guilds_shopping_item_b_1
					has_artifact = guilds_item_wool
				}
				AND = {
					has_character_flag = guilds_shopping_item_c_1
					has_artifact = guilds_item_hide
				}
				AND = {
					has_character_flag = guilds_shopping_item_d_1
					has_artifact = guilds_item_ivory
				}
				AND = {
					has_character_flag = guilds_shopping_item_e_1
					has_artifact = guilds_item_silk
				}
			}
		}
		name = {
			text = EVTOPTA_SNW_1318
				trigger = { has_character_flag = guilds_shopping_item_a_1 }
		}
		name = {
			text = EVTOPTB_SNW_1318
				trigger = { has_character_flag = guilds_shopping_item_b_1 }
		}
		name = {
			text = EVTOPTC_SNW_1318
				trigger = { has_character_flag = guilds_shopping_item_c_1 }
		}
		name = {
			text = EVTOPTD_SNW_1318
				trigger = { has_character_flag = guilds_shopping_item_d_1 }
		}
		name = {
			text = EVTOPTE_SNW_1318
				trigger = { has_character_flag = guilds_shopping_item_e_1 }
		}
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_shopping_item_a_1 = {
				if = { limit = { has_artifact = guilds_item_meat } 
				destroy_artifact = guilds_item_meat
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.05 min = 5 max = 50 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.10 min = 10 max = 100 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.15 min = 15 max = 150 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.20 min = 20 max = 200 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.25 min = 25 max = 250 } }
				}
					if = {
						limit = {
							has_dlc = "Reapers"
							location = { 
								OR = { 
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.10 min = 10 max = 100 } #prosperity bonus
					}
					if = {
						limit = { location = { owner = { war = yes } } }
						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = 0.025 min = 2 max = 25 } #war bonus
					}
					if = {
						limit = { 
							location = {
								owner = {
									or = {
										has_character_modifier = guilds_buff_feast
										has_character_modifier = fabulous_feast
										has_character_modifier = holding_large_feast
										has_character_modifier = holding_diwali_feast 
										has_character_modifier = holding_kali_puja_feast
										has_character_modifier = holding_zun_feast
										has_character_flag = holding_blot
										has_character_flag = holding_ukon_juhla
										has_character_flag = holding_uzgavenes
										has_character_flag = holding_jarilo
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_festivitie_tooltip }
						scaled_wealth = { value = 0.02 min = 2 max = 20 } #festivitie bonus
					}
					if = {
						limit = { location = { has_province_modifier = guilds_buff_spices } }
						custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
						scaled_wealth = { value = 0.02 min = 2 max = 20 } #goods bonus
					}
				}
			}
			guilds_shopping_item_b_1 = {
				if = { limit = { has_artifact = guilds_item_wool } 
				destroy_artifact = guilds_item_wool
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.30 min = 30 max = 300 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.35 min = 35 max = 350 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.40 min = 40 max = 400 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.45 min = 45 max = 450 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.50 min = 50 max = 500 } }
				}
				if = {
					limit = { location = { has_province_modifier = guilds_buff_dye } }
					custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
					scaled_wealth = { value = 0.10 min = 10 max = 100 } #goods bonus
				}
					if = {
						limit = {
							location = {
								OR = {
									terrain = farmlands
									terrain = plains
									terrain = steppe 
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.05 min = -5 max = -50 } #terrain malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = arctic
									is_winter = yes
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #terrain bonus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = { 
								OR = {
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_3
								}
							} 
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.05 min = -5 max = -50 } #prosperity malus
					}
				}
			}
			guilds_shopping_item_c_1 = {
				if = { limit = { has_artifact = guilds_item_hide } 
				destroy_artifact = guilds_item_hide
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.55 min = 55 max = 550 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.60 min = 60 max = 600 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.65 min = 65 max = 650 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.70 min = 70 max = 700 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.75 min = 75 max = 750 } }
				}
					if = {
						limit = { location = { owner = { war = yes } } }
						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #war bonus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = farmlands
									terrain = plains
									terrain = forest
									terrain = jungle
									terrain = steppe
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.05 min = -5 max = -50 } #terrain malus
					}
					if = {
						limit = { location = { has_epidemic = yes } }
						custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #epidemic malus
					}
				}
			}
			guilds_shopping_item_d_1 = {
				if = { limit = { has_artifact = guilds_item_ivory } 
				destroy_artifact = guilds_item_ivory
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.80 min = 80 max = 800 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.85 min = 85 max = 850 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.90 min = 90 max = 900 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.95 min = 95 max = 950 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 1 min = 100 max = 1000 } }
				}
					if = {
						limit = {
							location = {
								OR = {
									terrain = jungle
									terrain = arctic
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #terrain malus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = prosperity_modifier_3
									has_province_modifier = prosperity_modifier_2
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #prosperity bonus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.3 min = -30 max = -300 } #prosperity malus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								NOR = {
									has_province_modifier = prosperity_modifier_3
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_1
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity malus
					}
					if = {
						limit = { location = { has_epidemic = yes } }
						custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
						scaled_wealth = { value = -0.05 min = -5 max = -50 } #epidemic malus
					}
				}
			}
			guilds_shopping_item_e_1 = {
				if = { limit = { has_artifact = guilds_item_silk } 
				destroy_artifact = guilds_item_silk
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = 1.05 min = 105 max = 1050 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 1.1 min = 110 max = 1100 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 1.15 min = 115 max = 1150 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 1.2 min = 120 max = 1200 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 1.25 min = 125 max = 1250 } }
				}
					if = {
						limit = { location = { has_province_modifier = guilds_buff_dye } }
						custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
						scaled_wealth = { value = 0.10 min = 10 max = 100 } #goods bonus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = prosperity_modifier_3
									has_province_modifier = prosperity_modifier_2
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #prosperity bonus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.15 min = -15 max = -150 } #prosperity malus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								NOR = {
									has_province_modifier = prosperity_modifier_3
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_1
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity malus
					}
				}
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		trigger = {
			OR = {
				AND = {
					has_character_flag = guilds_shopping_item_a_2
					has_artifact = guilds_item_meat
				}
				AND = {
					has_character_flag = guilds_shopping_item_b_2
					has_artifact = guilds_item_wool
				}
				AND = {
					has_character_flag = guilds_shopping_item_c_2
					has_artifact = guilds_item_hide
				}
				AND = {
					has_character_flag = guilds_shopping_item_d_2
					has_artifact = guilds_item_ivory
				}
				AND = {
					has_character_flag = guilds_shopping_item_e_2
					has_artifact = guilds_item_silk
				}
			}
		}
		name = {
			text = EVTOPTA_SNW_1318
				trigger = { has_character_flag = guilds_shopping_item_a_2 }
		}
		name = {
			text = EVTOPTB_SNW_1318
				trigger = { has_character_flag = guilds_shopping_item_b_2 }
		}
		name = {
			text = EVTOPTC_SNW_1318
				trigger = { has_character_flag = guilds_shopping_item_c_2 }
		}
		name = {
			text = EVTOPTD_SNW_1318
				trigger = { has_character_flag = guilds_shopping_item_d_2 }
		}
		name = {
			text = EVTOPTE_SNW_1318
				trigger = { has_character_flag = guilds_shopping_item_e_2 }
		}
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_shopping_item_a_2 = {
				if = { limit = { has_artifact = guilds_item_meat } 
				destroy_artifact = guilds_item_meat
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.05 min = 5 max = 50 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.10 min = 10 max = 100 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.15 min = 15 max = 150 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.20 min = 20 max = 200 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.25 min = 25 max = 250 } }
				}
					if = {
						limit = {
							has_dlc = "Reapers"
							location = { 
								OR = { 
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.10 min = 10 max = 100 } #prosperity bonus
					}
					if = {
						limit = { location = { owner = { war = yes } } }
						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = 0.025 min = 2 max = 25 } #war bonus
					}
					if = {
						limit = { 
							location = {
								owner = {
									or = {
										has_character_modifier = guilds_buff_feast
										has_character_modifier = fabulous_feast
										has_character_modifier = holding_large_feast
										has_character_modifier = holding_diwali_feast 
										has_character_modifier = holding_kali_puja_feast
										has_character_modifier = holding_zun_feast
										has_character_flag = holding_blot
										has_character_flag = holding_ukon_juhla
										has_character_flag = holding_uzgavenes
										has_character_flag = holding_jarilo
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_festivitie_tooltip }
						scaled_wealth = { value = 0.02 min = 2 max = 20 } #festivitie bonus
					}
					if = {
						limit = { location = { has_province_modifier = guilds_buff_spices } }
						custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
						scaled_wealth = { value = 0.02 min = 2 max = 20 } #goods bonus
					}
				}
			}
			guilds_shopping_item_b_2 = {
				if = { limit = { has_artifact = guilds_item_wool } 
				destroy_artifact = guilds_item_wool
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.30 min = 30 max = 300 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.35 min = 35 max = 350 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.40 min = 40 max = 400 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.45 min = 45 max = 450 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.50 min = 50 max = 500 } }
				}
				if = {
					limit = { location = { has_province_modifier = guilds_buff_dye } }
					custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
					scaled_wealth = { value = 0.10 min = 10 max = 100 } #goods bonus
				}
					if = {
						limit = {
							location = {
								OR = {
									terrain = farmlands
									terrain = plains
									terrain = steppe 
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.05 min = -5 max = -50 } #terrain malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = arctic
									is_winter = yes
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #terrain bonus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = { 
								OR = {
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_3
								}
							} 
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.05 min = -5 max = -50 } #prosperity malus
					}
				}
			}
			guilds_shopping_item_c_2 = {
				if = { limit = { has_artifact = guilds_item_hide } 
				destroy_artifact = guilds_item_hide
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.55 min = 55 max = 550 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.60 min = 60 max = 600 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.65 min = 65 max = 650 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.70 min = 70 max = 700 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.75 min = 75 max = 750 } }
				}
					if = {
						limit = { location = { owner = { war = yes } } }
						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #war bonus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = farmlands
									terrain = plains
									terrain = forest
									terrain = jungle
									terrain = steppe
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.05 min = -5 max = -50 } #terrain malus
					}
					if = {
						limit = { location = { has_epidemic = yes } }
						custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #epidemic malus
					}
				}
			}
			guilds_shopping_item_d_2 = {
				if = { limit = { has_artifact = guilds_item_ivory } 
				destroy_artifact = guilds_item_ivory
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.80 min = 80 max = 800 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.85 min = 85 max = 850 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.90 min = 90 max = 900 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.95 min = 95 max = 950 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 1 min = 100 max = 1000 } }
				}
					if = {
						limit = {
							location = {
								OR = {
									terrain = jungle
									terrain = arctic
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #terrain malus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = prosperity_modifier_3
									has_province_modifier = prosperity_modifier_2
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #prosperity bonus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.3 min = -30 max = -300 } #prosperity malus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								NOR = {
									has_province_modifier = prosperity_modifier_3
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_1
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity malus
					}
					if = {
						limit = { location = { has_epidemic = yes } }
						custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
						scaled_wealth = { value = -0.05 min = -5 max = -50 } #epidemic malus
					}
				}
			}
			guilds_shopping_item_e_2 = {
				if = { limit = { has_artifact = guilds_item_silk } 
				destroy_artifact = guilds_item_silk
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_3 = { scaled_wealth = { value = 1.05 min = 105 max = 1050 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 1.1 min = 110 max = 1100 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 1.15 min = 115 max = 1150 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 1.2 min = 120 max = 1200 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 1.25 min = 125 max = 1250 } }
				}
					if = {
						limit = { location = { has_province_modifier = guilds_buff_dye } }
						custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
						scaled_wealth = { value = 0.10 min = 10 max = 100 } #goods bonus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = prosperity_modifier_3
									has_province_modifier = prosperity_modifier_2
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #prosperity bonus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.15 min = -15 max = -150 } #prosperity malus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								NOR = {
									has_province_modifier = prosperity_modifier_3
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_1
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity malus
					}
				}
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		trigger = {
			OR = {
				AND = {
					has_character_flag = guilds_shopping_item_a_3
					has_artifact = guilds_item_meat
				}
				AND = {
					has_character_flag = guilds_shopping_item_b_3
					has_artifact = guilds_item_wool
				}
				AND = {
					has_character_flag = guilds_shopping_item_c_3
					has_artifact = guilds_item_hide
				}
				AND = {
					has_character_flag = guilds_shopping_item_d_3
					has_artifact = guilds_item_ivory
				}
				AND = {
					has_character_flag = guilds_shopping_item_e_3
					has_artifact = guilds_item_silk
				}
			}
		}
		name = {
			text = EVTOPTA_SNW_1318
				trigger = { has_character_flag = guilds_shopping_item_a_3 }
		}
		name = {
			text = EVTOPTB_SNW_1318
				trigger = { has_character_flag = guilds_shopping_item_b_3 }
		}
		name = {
			text = EVTOPTC_SNW_1318
				trigger = { has_character_flag = guilds_shopping_item_c_3 }
		}
		name = {
			text = EVTOPTD_SNW_1318
				trigger = { has_character_flag = guilds_shopping_item_d_3 }
		}
		name = {
			text = EVTOPTE_SNW_1318
				trigger = { has_character_flag = guilds_shopping_item_e_3 }
		}
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_shopping_item_a_3 = {
				if = { limit = { has_artifact = guilds_item_meat } 
				destroy_artifact = guilds_item_meat
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.05 min = 5 max = 50 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.10 min = 10 max = 100 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.15 min = 15 max = 150 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.20 min = 20 max = 200 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.25 min = 25 max = 250 } }
				}
					if = {
						limit = {
							has_dlc = "Reapers"
							location = { 
								OR = { 
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.10 min = 10 max = 100 } #prosperity bonus
					}
					if = {
						limit = { location = { owner = { war = yes } } }
						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = 0.025 min = 2 max = 25 } #war bonus
					}
					if = {
						limit = { 
							location = {
								owner = {
									or = {
										has_character_modifier = guilds_buff_feast
										has_character_modifier = fabulous_feast
										has_character_modifier = holding_large_feast
										has_character_modifier = holding_diwali_feast 
										has_character_modifier = holding_kali_puja_feast
										has_character_modifier = holding_zun_feast
										has_character_flag = holding_blot
										has_character_flag = holding_ukon_juhla
										has_character_flag = holding_uzgavenes
										has_character_flag = holding_jarilo
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_festivitie_tooltip }
						scaled_wealth = { value = 0.02 min = 2 max = 20 } #festivitie bonus
					}
					if = {
						limit = { location = { has_province_modifier = guilds_buff_spices } }
						custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
						scaled_wealth = { value = 0.02 min = 2 max = 20 } #goods bonus
					}
				}
			}
			guilds_shopping_item_b_3 = {
				if = { limit = { has_artifact = guilds_item_wool } 
				destroy_artifact = guilds_item_wool
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.30 min = 30 max = 300 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.35 min = 35 max = 350 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.40 min = 40 max = 400 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.45 min = 45 max = 450 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.50 min = 50 max = 500 } }
				}
				if = {
					limit = { location = { has_province_modifier = guilds_buff_dye } }
					custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
					scaled_wealth = { value = 0.10 min = 10 max = 100 } #goods bonus
				}
					if = {
						limit = {
							location = {
								OR = {
									terrain = farmlands
									terrain = plains
									terrain = steppe 
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.05 min = -5 max = -50 } #terrain malus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = arctic
									is_winter = yes
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #terrain bonus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = { 
								OR = {
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_3
								}
							} 
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.05 min = -5 max = -50 } #prosperity malus
					}
				}
			}
			guilds_shopping_item_c_3 = {
				if = { limit = { has_artifact = guilds_item_hide } 
				destroy_artifact = guilds_item_hide
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.55 min = 55 max = 550 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.60 min = 60 max = 600 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.65 min = 65 max = 650 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.70 min = 70 max = 700 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.75 min = 75 max = 750 } }
				}
					if = {
						limit = { location = { owner = { war = yes } } }
						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #war bonus
					}
					if = {
						limit = {
							location = {
								OR = {
									terrain = farmlands
									terrain = plains
									terrain = forest
									terrain = jungle
									terrain = steppe
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.05 min = -5 max = -50 } #terrain malus
					}
					if = {
						limit = { location = { has_epidemic = yes } }
						custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #epidemic malus
					}
				}
			}
			guilds_shopping_item_d_3 = {
				if = { limit = { has_artifact = guilds_item_ivory } 
				destroy_artifact = guilds_item_ivory
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.80 min = 80 max = 800 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.85 min = 85 max = 850 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.90 min = 90 max = 900 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.95 min = 95 max = 950 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 1 min = 100 max = 1000 } }
				}
					if = {
						limit = {
							location = {
								OR = {
									terrain = jungle
									terrain = arctic
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #terrain malus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = prosperity_modifier_3
									has_province_modifier = prosperity_modifier_2
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #prosperity bonus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.3 min = -30 max = -300 } #prosperity malus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								NOR = {
									has_province_modifier = prosperity_modifier_3
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_1
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity malus
					}
					if = {
						limit = { location = { has_epidemic = yes } }
						custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
						scaled_wealth = { value = -0.05 min = -5 max = -50 } #epidemic malus
					}
				}
			}
			guilds_shopping_item_e_3 = {
				if = { limit = { has_artifact = guilds_item_silk } 
				destroy_artifact = guilds_item_silk
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_5 = { scaled_wealth = { value = 1.05 min = 105 max = 1050 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 1.1 min = 110 max = 1100 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 1.15 min = 115 max = 1150 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 1.2 min = 120 max = 1200 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 1.25 min = 125 max = 1250 } }
				}

					if = {
						limit = { location = { has_province_modifier = guilds_buff_dye } }
						custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
						scaled_wealth = { value = 0.10 min = 10 max = 100 } #goods bonus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = prosperity_modifier_3
									has_province_modifier = prosperity_modifier_2
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #prosperity bonus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.15 min = -15 max = -150 } #prosperity malus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								NOR = {
									has_province_modifier = prosperity_modifier_3
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_1
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity malus
					}
				}
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		name = EVTOPTZ_SNW_1318
	}
	after = { 
	clr_character_flag = guilds_shopping_price_1
	clr_character_flag = guilds_shopping_price_2
	clr_character_flag = guilds_shopping_price_3
	clr_character_flag = guilds_shopping_price_4
	clr_character_flag = guilds_shopping_price_5
	clr_character_flag = guilds_shopping_item_a_1
	clr_character_flag = guilds_shopping_item_b_1
	clr_character_flag = guilds_shopping_item_c_1
	clr_character_flag = guilds_shopping_item_d_1
	clr_character_flag = guilds_shopping_item_e_1
	clr_character_flag = guilds_shopping_item_a_2
	clr_character_flag = guilds_shopping_item_b_2
	clr_character_flag = guilds_shopping_item_c_2
	clr_character_flag = guilds_shopping_item_d_2
	clr_character_flag = guilds_shopping_item_e_2
	clr_character_flag = guilds_shopping_item_a_3
	clr_character_flag = guilds_shopping_item_b_3
	clr_character_flag = guilds_shopping_item_c_3
	clr_character_flag = guilds_shopping_item_d_3
	clr_character_flag = guilds_shopping_item_e_3
	clr_character_flag = guilds_is_using_goods
	}
}

#Shopping sell goods
character_event = {
	id = SNW.1319
	desc = EVTDESC_SNW_1319
	picture = GFX_evt_market
	border = GFX_event_normal_frame_economy_guilds
		
	is_triggered_only = yes

		immediate = {
		random_list = { #A
			20 = {
				set_character_flag = guilds_shopping_item_a_1
				modifier = {
					factor = 2
					has_artifact = guilds_item_pottery
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_b_1
				modifier = {
					factor = 2
					has_artifact = guilds_item_alcohol
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_c_1
				modifier = {
					factor = 2
					has_artifact = guilds_item_armor
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_d_1
				modifier = {
					factor = 2
					has_artifact = guilds_item_jewelry
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_e_1
				modifier = {
					factor = 2
					has_artifact = guilds_item_book
				}
			}
		}
		random_list = { #B
			20 = {
				set_character_flag = guilds_shopping_item_a_2
				modifier = {
					factor = 2
					has_artifact = guilds_item_pottery
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_b_2
				modifier = {
					factor = 2
					has_artifact = guilds_item_alcohol
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_c_2
				modifier = {
					factor = 2
					has_artifact = guilds_item_armor
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_d_2
				modifier = {
					factor = 2
					has_artifact = guilds_item_jewelry
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_e_2
				modifier = {
					factor = 2
					has_artifact = guilds_item_book
				}
			}
		}
		random_list = { #C
			20 = {
				set_character_flag = guilds_shopping_item_a_3
				modifier = {
					factor = 2
					has_artifact = guilds_item_pottery
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_b_3
				modifier = {
					factor = 2
					has_artifact = guilds_item_alcohol
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_c_3
				modifier = {
					factor = 2
					has_artifact = guilds_item_armor
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_d_3
				modifier = {
					factor = 2
					has_artifact = guilds_item_jewelry
				}
			}
			20 = {
				set_character_flag = guilds_shopping_item_e_3
				modifier = {
					factor = 2
					has_artifact = guilds_item_book
				}
			}
		}
		random_list = { #prices
			20 = {
				set_character_flag = guilds_shopping_price_1
			}
			20 = {
				set_character_flag = guilds_shopping_price_2
			}
			20 = {
				set_character_flag = guilds_shopping_price_3
			}
			20 = {
				set_character_flag = guilds_shopping_price_4
			}
			20 = {
				set_character_flag = guilds_shopping_price_5
			}
		}
	}
	
	option = { 
		trigger = {
			OR = {
				AND = {
					has_character_flag = guilds_shopping_item_a_1
					has_artifact = guilds_item_pottery
				}
				AND = {
					has_character_flag = guilds_shopping_item_b_1
					has_artifact = guilds_item_alcohol
				}
				AND = {
					has_character_flag = guilds_shopping_item_c_1
					has_artifact = guilds_item_armor
				}
				AND = {
					has_character_flag = guilds_shopping_item_d_1
					has_artifact = guilds_item_jewelry
				}
				AND = {
					has_character_flag = guilds_shopping_item_e_1
					has_artifact = guilds_item_book
				}
			}
		}
		name = {
			text = EVTOPTA_SNW_1319
				trigger = { has_character_flag = guilds_shopping_item_a_1 }
		}
		name = {
			text = EVTOPTB_SNW_1319
				trigger = { has_character_flag = guilds_shopping_item_b_1 }
		}
		name = {
			text = EVTOPTC_SNW_1319
				trigger = { has_character_flag = guilds_shopping_item_c_1 }
		}
		name = {
			text = EVTOPTD_SNW_1319
				trigger = { has_character_flag = guilds_shopping_item_d_1 }
		}
		name = {
			text = EVTOPTE_SNW_1319
				trigger = { has_character_flag = guilds_shopping_item_e_1 }
		}
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_shopping_item_a_1 = {
				if = { limit = { has_artifact = guilds_item_pottery } 
				destroy_artifact = guilds_item_pottery
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.05 min = 5 max = 50 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.10 min = 10 max = 100 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.15 min = 15 max = 150 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.20 min = 20 max = 200 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.25 min = 25 max = 250 } }
				}
					if = {
						limit = {
							has_dlc = "Reapers"
							location = { 
								NOR = { 
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_3
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.01 min = 1 max = 10 } #prosperity bonus
					}
					if = {
						limit = { 
							location = { 
								OR = {
									has_province_modifier = guilds_buff_alcohol 
									has_province_modifier = guilds_buff_grain
									has_province_modifier = guilds_buff_meat
								} 
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
						scaled_wealth = { value = 0.015 min = 1 max = 15 } #goods bonus
					}
				}
			}
			guilds_shopping_item_b_1 = {
				if = { limit = { has_artifact = guilds_item_alcohol } 
				destroy_artifact = guilds_item_alcohol
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.30 min = 30 max = 300 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.35 min = 35 max = 350 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.40 min = 40 max = 400 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.45 min = 45 max = 450 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.50 min = 50 max = 500 } }
				}
					if = {
						limit = {
							has_dlc = "Reapers"
							location = { 
								OR = {
									has_province_modifier = prosperity_modifier_1
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_3
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #prosperity bonus
					}
					if = {
						limit = {
							has_dlc = "Reapers"
							location = { 
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity bonus
					}
					if = {
						limit = { location = { owner = { war = yes } } }
						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = 0.075 min = 7 max = 75 } #war bonus
					}
					if = { limit = { location = { is_winter = yes } }
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #terrain bonus
					}
				}
			}
			guilds_shopping_item_c_1 = {
				if = { limit = { has_artifact = guilds_item_armor } 
				destroy_artifact = guilds_item_armor
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.55 min = 55 max = 550 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.60 min = 60 max = 600 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.65 min = 65 max = 650 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.70 min = 70 max = 700 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.75 min = 75 max = 750 } }
				}
					if = {
						limit = { location = { owner = { war = yes } } }
						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = 0.20 min = 20 max = 200 } #At war bonus
					}
					if = {
						limit = { location = { owner = { war = no } } }
 						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = -0.10 min = -10 max = -100 } #At war malus
					}
					if = {
						limit = {
							location = {
								owner = {
									or = {
										has_character_flag = tournament_begins
										has_character_flag = tournament_begins_furusiyya
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_festivitie_tooltip }
						scaled_wealth = { value = 0.1 min = 1 max = 100 } #festivitie bonus
					}
				}
			}
			guilds_shopping_item_d_1 = {
				if = { limit = { has_artifact = guilds_item_jewelry } 
				destroy_artifact = guilds_item_jewelry
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.80 min = 80 max = 800 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.85 min = 85 max = 850 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.90 min = 90 max = 900 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.95 min = 95 max = 950 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 1 min = 100 max = 1000 } }
				}
					if = { 
						limit = { 
							has_dlc = "Reapers"
							location = { 
								has_province_modifier = prosperity_modifier_1
							} 
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #prosperity bonus
					}
					if = { 
						limit = { 
							has_dlc = "Reapers"
							location = { 
								OR = {
									has_province_modifier = prosperity_modifier_3
									has_province_modifier = prosperity_modifier_2
								}
							} 
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity bonus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.2 min = -20 max = -200 } #prosperity malus
					}
					if = {
						limit = { 
							location = { 
								OR = {
									has_province_modifier = guilds_buff_gem
									has_province_modifier = guilds_buff_silver 
									has_province_modifier = guilds_buff_gold 
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #goods malus
					}
				}
			}
			guilds_shopping_item_e_1 = {
				if = { limit = { has_artifact = guilds_item_book } 
				destroy_artifact = guilds_item_book
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_1 = { scaled_wealth = { value = 1.05 min = 105 max = 1050 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 1.1 min = 110 max = 1100 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 1.15 min = 115 max = 1150 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 1.2 min = 120 max = 1200 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 1.25 min = 125 max = 1250 } }
				}
					if = { 
						limit = { 
							has_dlc = "Reapers"
							location = { 
								has_province_modifier = prosperity_modifier_1
							} 
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #prosperity bonus
					}
					if = { 
						limit = { 
							has_dlc = "Reapers"
							location = { 
								OR = {
									has_province_modifier = prosperity_modifier_3
									has_province_modifier = prosperity_modifier_2
								}
							} 
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity bonus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.2 min = -20 max = -200 } #prosperity malus
					}
					if = {
						limit = {
							location = {
								capital_holding = {
									OR = {
										holding_type = temple
										holding_type = city 
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #terrain bonus
					}
					if = {
						limit = { 
							location = {
								capital_holding = {
									OR = {
										holding_type = tribal
										holding_type = nomad
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.3 min = -30 max = -300 } #terrain malus
					}
				}
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		trigger = {
			OR = {
				AND = {
					has_character_flag = guilds_shopping_item_a_2
					has_artifact = guilds_item_pottery
				}
				AND = {
					has_character_flag = guilds_shopping_item_b_2
					has_artifact = guilds_item_alcohol
				}
				AND = {
					has_character_flag = guilds_shopping_item_c_2
					has_artifact = guilds_item_armor
				}
				AND = {
					has_character_flag = guilds_shopping_item_d_2
					has_artifact = guilds_item_jewelry
				}
				AND = {
					has_character_flag = guilds_shopping_item_e_2
					has_artifact = guilds_item_book
				}
			}
		}
		name = {
			text = EVTOPTA_SNW_1319
				trigger = { has_character_flag = guilds_shopping_item_a_2 }
		}
		name = {
			text = EVTOPTB_SNW_1319
				trigger = { has_character_flag = guilds_shopping_item_b_2 }
		}
		name = {
			text = EVTOPTC_SNW_1319
				trigger = { has_character_flag = guilds_shopping_item_c_2 }
		}
		name = {
			text = EVTOPTD_SNW_1319
				trigger = { has_character_flag = guilds_shopping_item_d_2 }
		}
		name = {
			text = EVTOPTE_SNW_1319
				trigger = { has_character_flag = guilds_shopping_item_e_2 }
		}
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_shopping_item_a_2 = {
				if = { limit = { has_artifact = guilds_item_pottery } 
				destroy_artifact = guilds_item_pottery
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.05 min = 5 max = 50 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.10 min = 10 max = 100 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.15 min = 15 max = 150 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.20 min = 20 max = 200 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.25 min = 25 max = 250 } }
				}
					if = {
						limit = {
							has_dlc = "Reapers"
							location = { 
								NOR = { 
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_3
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.01 min = 1 max = 10 } #prosperity bonus
					}
					if = {
						limit = { 
							location = { 
								OR = {
									has_province_modifier = guilds_buff_alcohol 
									has_province_modifier = guilds_buff_grain
									has_province_modifier = guilds_buff_meat
								} 
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
						scaled_wealth = { value = 0.015 min = 1 max = 15 } #goods bonus
					}
				}
			}
			guilds_shopping_item_b_2 = {
				if = { limit = { has_artifact = guilds_item_alcohol } 
				destroy_artifact = guilds_item_alcohol
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.30 min = 30 max = 300 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.35 min = 35 max = 350 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.40 min = 40 max = 400 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.45 min = 45 max = 450 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.50 min = 50 max = 500 } }
				}
					if = {
						limit = {
							has_dlc = "Reapers"
							location = { 
								OR = {
									has_province_modifier = prosperity_modifier_1
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_3
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #prosperity bonus
					}
					if = {
						limit = {
							has_dlc = "Reapers"
							location = { 
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity bonus
					}
					if = {
						limit = { location = { owner = { war = yes } } }
						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = 0.075 min = 7 max = 75 } #war bonus
					}
					if = { limit = { location = { is_winter = yes } }
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #terrain bonus
					}
				}
			}
			guilds_shopping_item_c_2 = {
				if = { limit = { has_artifact = guilds_item_armor } 
				destroy_artifact = guilds_item_armor
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.55 min = 55 max = 550 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.60 min = 60 max = 600 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.65 min = 65 max = 650 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.70 min = 70 max = 700 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.75 min = 75 max = 750 } }
				}
					if = {
						limit = { location = { owner = { war = yes } } }
						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = 0.20 min = 20 max = 200 } #At war bonus
					}
					if = {
						limit = { location = { owner = { war = no } } }
 						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = -0.10 min = -10 max = -100 } #At war malus
					}
					if = {
						limit = {
							location = {
								owner = {
									or = {
										has_character_flag = tournament_begins
										has_character_flag = tournament_begins_furusiyya
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_festivitie_tooltip }
						scaled_wealth = { value = 0.1 min = 1 max = 100 } #festivitie bonus
					}
				}
			}
			guilds_shopping_item_d_2 = {
				if = { limit = { has_artifact = guilds_item_jewelry } 
				destroy_artifact = guilds_item_jewelry
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.80 min = 80 max = 800 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.85 min = 85 max = 850 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.90 min = 90 max = 900 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.95 min = 95 max = 950 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 1 min = 100 max = 1000 } }
				}
					if = { 
						limit = { 
							has_dlc = "Reapers"
							location = { 
								has_province_modifier = prosperity_modifier_1
							} 
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #prosperity bonus
					}
					if = { 
						limit = { 
							has_dlc = "Reapers"
							location = { 
								OR = {
									has_province_modifier = prosperity_modifier_3
									has_province_modifier = prosperity_modifier_2
								}
							} 
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity bonus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.2 min = -20 max = -200 } #prosperity malus
					}
					if = {
						limit = { 
							location = { 
								OR = {
									has_province_modifier = guilds_buff_gem
									has_province_modifier = guilds_buff_silver 
									has_province_modifier = guilds_buff_gold 
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #goods malus
					}
				}
			}
			guilds_shopping_item_e_2 = {
				if = { limit = { has_artifact = guilds_item_book } 
				destroy_artifact = guilds_item_book
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_3 = { scaled_wealth = { value = 1.05 min = 105 max = 1050 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 1.1 min = 110 max = 1100 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 1.15 min = 115 max = 1150 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 1.2 min = 120 max = 1200 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 1.25 min = 125 max = 1250 } }
				}
					if = { 
						limit = { 
							has_dlc = "Reapers"
							location = { 
								has_province_modifier = prosperity_modifier_1
							} 
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #prosperity bonus
					}
					if = { 
						limit = { 
							has_dlc = "Reapers"
							location = { 
								OR = {
									has_province_modifier = prosperity_modifier_3
									has_province_modifier = prosperity_modifier_2
								}
							} 
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity bonus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.2 min = -20 max = -200 } #prosperity malus
					}
					if = {
						limit = {
							location = {
								capital_holding = {
									OR = {
										holding_type = temple
										holding_type = city 
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #terrain bonus
					}
					if = {
						limit = { 
							location = {
								capital_holding = {
									OR = {
										holding_type = tribal
										holding_type = nomad
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.3 min = -30 max = -300 } #terrain malus
					}
				}
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		trigger = {
			OR = {
				AND = {
					has_character_flag = guilds_shopping_item_a_3
					has_artifact = guilds_item_pottery
				}
				AND = {
					has_character_flag = guilds_shopping_item_b_3
					has_artifact = guilds_item_alcohol
				}
				AND = {
					has_character_flag = guilds_shopping_item_c_3
					has_artifact = guilds_item_armor
				}
				AND = {
					has_character_flag = guilds_shopping_item_d_3
					has_artifact = guilds_item_jewelry
				}
				AND = {
					has_character_flag = guilds_shopping_item_e_3
					has_artifact = guilds_item_book
				}
			}
		}
		name = {
			text = EVTOPTA_SNW_1319
				trigger = { has_character_flag = guilds_shopping_item_a_3 }
		}
		name = {
			text = EVTOPTB_SNW_1319
				trigger = { has_character_flag = guilds_shopping_item_b_3 }
		}
		name = {
			text = EVTOPTC_SNW_1319
				trigger = { has_character_flag = guilds_shopping_item_c_3 }
		}
		name = {
			text = EVTOPTD_SNW_1319
				trigger = { has_character_flag = guilds_shopping_item_d_3 }
		}
		name = {
			text = EVTOPTE_SNW_1319
				trigger = { has_character_flag = guilds_shopping_item_e_3 }
		}
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_shopping_item_a_3 = {
				if = { limit = { has_artifact = guilds_item_pottery } 
				destroy_artifact = guilds_item_pottery
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.05 min = 5 max = 50 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.10 min = 10 max = 100 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.15 min = 15 max = 150 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.20 min = 20 max = 200 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.25 min = 25 max = 250 } }
				}
					if = {
						limit = {
							has_dlc = "Reapers"
							location = { 
								NOR = { 
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_3
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.01 min = 1 max = 10 } #prosperity bonus
					}
					if = {
						limit = { 
							location = { 
								OR = {
									has_province_modifier = guilds_buff_alcohol 
									has_province_modifier = guilds_buff_grain
									has_province_modifier = guilds_buff_meat
								} 
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
						scaled_wealth = { value = 0.015 min = 1 max = 15 } #goods bonus
					}
				}
			}
			guilds_shopping_item_b_3 = {
				if = { limit = { has_artifact = guilds_item_alcohol } 
				destroy_artifact = guilds_item_alcohol
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.30 min = 30 max = 300 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.35 min = 35 max = 350 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.40 min = 40 max = 400 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.45 min = 45 max = 450 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.50 min = 50 max = 500 } }
				}
					if = {
						limit = {
							has_dlc = "Reapers"
							location = { 
								OR = {
									has_province_modifier = prosperity_modifier_1
									has_province_modifier = prosperity_modifier_2
									has_province_modifier = prosperity_modifier_3
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #prosperity bonus
					}
					if = {
						limit = {
							has_dlc = "Reapers"
							location = { 
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity bonus
					}
					if = {
						limit = { location = { owner = { war = yes } } }
						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = 0.075 min = 7 max = 75 } #war bonus
					}
					if = { limit = { location = { is_winter = yes } }
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #terrain bonus
					}
				}
			}
			guilds_shopping_item_c_3 = {
				if = { limit = { has_artifact = guilds_item_armor } 
				destroy_artifact = guilds_item_armor
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.55 min = 55 max = 550 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 0.60 min = 60 max = 600 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.65 min = 65 max = 650 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.70 min = 70 max = 700 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.75 min = 75 max = 750 } }
				}
					if = {
						limit = { location = { owner = { war = yes } } }
						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = 0.20 min = 20 max = 200 } #At war bonus
					}
					if = {
						limit = { location = { owner = { war = no } } }
 						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = -0.10 min = -10 max = -100 } #At war malus
					}
					if = {
						limit = {
							location = {
								owner = {
									or = {
										has_character_flag = tournament_begins
										has_character_flag = tournament_begins_furusiyya
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_festivitie_tooltip }
						scaled_wealth = { value = 0.1 min = 1 max = 100 } #festivitie bonus
					}
				}
			}
			guilds_shopping_item_d_3 = {
				if = { limit = { has_artifact = guilds_item_jewelry } 
				destroy_artifact = guilds_item_jewelry
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_2 = { scaled_wealth = { value = 0.80 min = 80 max = 800 } }
					guilds_shopping_price_5 = { scaled_wealth = { value = 0.85 min = 85 max = 850 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 0.90 min = 90 max = 900 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 0.95 min = 95 max = 950 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 1 min = 100 max = 1000 } }
				}
					if = { 
						limit = { 
							has_dlc = "Reapers"
							location = { 
								has_province_modifier = prosperity_modifier_1
							} 
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #prosperity bonus
					}
					if = { 
						limit = { 
							has_dlc = "Reapers"
							location = { 
								OR = {
									has_province_modifier = prosperity_modifier_3
									has_province_modifier = prosperity_modifier_2
								}
							} 
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity bonus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.2 min = -20 max = -200 } #prosperity malus
					}
					if = {
						limit = { 
							location = { 
								OR = {
									has_province_modifier = guilds_buff_gem
									has_province_modifier = guilds_buff_silver 
									has_province_modifier = guilds_buff_gold 
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #goods malus
					}
				}
			}
			guilds_shopping_item_e_3 = {
				if = { limit = { has_artifact = guilds_item_book } 
				destroy_artifact = guilds_item_book
				trigger_switch = {
					on_trigger = has_character_flag
					guilds_shopping_price_5 = { scaled_wealth = { value = 1.05 min = 105 max = 1050 } }
					guilds_shopping_price_2 = { scaled_wealth = { value = 1.1 min = 110 max = 1100 } }
					guilds_shopping_price_1 = { scaled_wealth = { value = 1.15 min = 115 max = 1150 } }
					guilds_shopping_price_3 = { scaled_wealth = { value = 1.2 min = 120 max = 1200 } }
					guilds_shopping_price_4 = { scaled_wealth = { value = 1.25 min = 125 max = 1250 } }
				}
					if = { 
						limit = { 
							has_dlc = "Reapers"
							location = { 
								has_province_modifier = prosperity_modifier_1
							} 
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #prosperity bonus
					}
					if = { 
						limit = { 
							has_dlc = "Reapers"
							location = { 
								OR = {
									has_province_modifier = prosperity_modifier_3
									has_province_modifier = prosperity_modifier_2
								}
							} 
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity bonus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							location = {
								OR = {
									has_province_modifier = depopulated_1
									has_province_modifier = depopulated_2
									has_province_modifier = depopulated_3
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.2 min = -20 max = -200 } #prosperity malus
					}
					if = {
						limit = {
							location = {
								capital_holding = {
									OR = {
										holding_type = temple
										holding_type = city 
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #terrain bonus
					}
					if = {
						limit = { 
							location = {
								capital_holding = {
									OR = {
										holding_type = tribal
										holding_type = nomad
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.3 min = -30 max = -300 } #terrain malus
					}
				}
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		name = EVTOPTZ_SNW_1319
	}
	after = { 
	clr_character_flag = guilds_shopping_price_1
	clr_character_flag = guilds_shopping_price_2
	clr_character_flag = guilds_shopping_price_3
	clr_character_flag = guilds_shopping_price_4
	clr_character_flag = guilds_shopping_price_5
	clr_character_flag = guilds_shopping_item_a_1
	clr_character_flag = guilds_shopping_item_b_1
	clr_character_flag = guilds_shopping_item_c_1
	clr_character_flag = guilds_shopping_item_d_1
	clr_character_flag = guilds_shopping_item_e_1
	clr_character_flag = guilds_shopping_item_a_2
	clr_character_flag = guilds_shopping_item_b_2
	clr_character_flag = guilds_shopping_item_c_2
	clr_character_flag = guilds_shopping_item_d_2
	clr_character_flag = guilds_shopping_item_e_2
	clr_character_flag = guilds_shopping_item_a_3
	clr_character_flag = guilds_shopping_item_b_3
	clr_character_flag = guilds_shopping_item_c_3
	clr_character_flag = guilds_shopping_item_d_3
	clr_character_flag = guilds_shopping_item_e_3
	clr_character_flag = guilds_is_using_goods
	}
}

#Impulse Buy/sell
character_event = {
	id = SNW.160
	picture = GFX_evt_courtiers_talking
	# desc = EVTDESC_SNW_160
	border = GFX_event_normal_frame_economy_guilds
		
	is_triggered_only = yes

	immediate = {
		set_character_flag = guilds_is_using_goods
		
		if = {
			limit = {
				any_artifact = { has_artifact_flag = goods }
			}
			random_list = {
				50 = { set_character_flag = guilds_can_sell }
				50 = { set_character_flag = guilds_cannot_sell }
			}
		}
		if = {
			limit = {
				NOT = {
					any_artifact = { has_artifact_flag = goods }
				}
			}
			set_character_flag = guilds_cannot_sell
		}
	}
	
	desc = {
		trigger = { has_character_flag = guilds_cannot_sell }
		text = EVTDESC_SNW_160_A
	}
	desc = {
		trigger = { has_character_flag = guilds_can_sell }
		text = EVTDESC_SNW_160_B
	}
	option = { #Ok
		trigger = { has_character_flag = guilds_cannot_sell }
		name = EVTOPTA_SNW_160
		scaled_wealth = { value = -0.65 min = -65 max = -650 }
		hidden_effect = {
			random_list = {
				50 = {
					add_artifact = guilds_item_stone
				}
				# 50 = {
					# add_artifact = guilds_item_iron
				# }
				50 = {
					add_artifact = guilds_item_steel
				}
				50 = {
					add_artifact = guilds_item_gem
				}
				50 = {
					add_artifact = guilds_item_silver
				}
				50 = {
					add_artifact = guilds_item_gold
				}
				50 = {
					add_artifact = guilds_item_grain
				}
				50 = {
					add_artifact = guilds_item_linen
				}
				50 = {
					add_artifact = guilds_item_lumber
				}
				50 = {
					add_artifact = guilds_item_incense
				}
				50 = {
					add_artifact = guilds_item_spices
				}
				50 = {
					add_artifact = guilds_item_meat
				}
				50 = {
					add_artifact = guilds_item_wool
				}
				50 = {
					add_artifact = guilds_item_hide
				}
				50 = {
					add_artifact = guilds_item_ivory
				}
				50 = {
					add_artifact = guilds_item_silk
				}
				50 = {
					add_artifact = guilds_item_pottery
				}
				50 = {
					add_artifact = guilds_item_alcohol
				}
				50 = {
					add_artifact = guilds_item_armor
				}
				50 = {
					add_artifact = guilds_item_jewelry
				}
				50 = {
					add_artifact = guilds_item_book
				}
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = { #Sell
		trigger = { has_character_flag = guilds_can_sell }
		name = EVTOPTB_SNW_160
		scaled_wealth = { value = 0.65 min = 65 max = 650 }
		hidden_effect = {
			random_artifact = {
				limit = { has_artifact_flag = goods }
				destroy_artifact = yes
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = { #Refuse
		name = EVTOPTC_SNW_160
		character_event = { id = SNW.1300 }
		custom_tooltip = { text = guilds_go_market_tt }
	}
	after = {
	clr_character_flag = guilds_cannot_sell
	clr_character_flag = guilds_can_sell
	clr_character_flag = guilds_is_using_goods
	}
}

#Too good of a deal start
character_event = {
	id = SNW.170
	picture = GFX_evt_relaxed_ruler
	border = GFX_event_normal_frame_economy_guilds
		
	is_triggered_only = yes

	desc = {
		trigger = { has_character_flag = guilds_scam_gold }
		text = EVTDESC_SNW_170_A
	}
	desc = {
		trigger = { has_character_flag = guilds_scam_spices }
		text = EVTDESC_SNW_170_B
	}
	desc = {
		trigger = { has_character_flag = guilds_scam_silk }
		text = EVTDESC_SNW_170_C
	}
	desc = {
		trigger = { has_character_flag = guilds_scam_book }
		text = EVTDESC_SNW_170_D
	}
	
	immediate = {
		random_list = {
			50 = { set_character_flag = guilds_scam }
			50 = {}
		}
		random_list = {
			25 = { set_character_flag = guilds_scam_gold }
			25 = { set_character_flag = guilds_scam_spices }
			25 = { set_character_flag = guilds_scam_silk }
			25 = { set_character_flag = guilds_scam_book }
		}
	}


	option = { #Pay Real
		trigger = { NOT = { has_character_flag = guilds_scam } }
		name = EVTOPTA_SNW_170
		scaled_wealth = { value = -1.15 min = -115 max = -1150 }
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_scam_gold = {
				custom_tooltip = { text = EVTOPTA_SNW_170_TTA }
				hidden_effect = {
					add_artifact = guilds_item_gold
					add_artifact = guilds_item_gold
				}
			}
			guilds_scam_spices = {
				custom_tooltip = { text = EVTOPTA_SNW_170_TTB }
				hidden_effect = {
					add_artifact = guilds_item_spices
					add_artifact = guilds_item_spices
				}
			}
			guilds_scam_silk = {
				custom_tooltip = { text = EVTOPTA_SNW_170_TTC }
				hidden_effect = {
					add_artifact = guilds_item_silk
					add_artifact = guilds_item_silk
				}
			}
			guilds_scam_book = {
				custom_tooltip = { text = EVTOPTA_SNW_170_TTD }
				hidden_effect = {
					add_artifact = guilds_item_book
					add_artifact = guilds_item_book
				}
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
		clr_character_flag = guilds_scam_gold
		clr_character_flag = guilds_scam_spices
		clr_character_flag = guilds_scam_silk
		clr_character_flag = guilds_scam_book
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 1.15
					wealth = 115
				}
			}
		}
	}
	option = { #Confront Real
		trigger = { NOT = { has_character_flag = guilds_scam } }
		name = EVTOPTB_SNW_170
		character_event = { id = SNW.1700 days = 1 }
		clr_character_flag = guilds_scam_gold
		clr_character_flag = guilds_scam_spices
		clr_character_flag = guilds_scam_silk
		clr_character_flag = guilds_scam_book
	}
	option = { #Pay Fake
		trigger = { has_character_flag = guilds_scam }
		name = EVTOPTC_SNW_170
		scaled_wealth = { value = -1.15 min = -115 max = -1150 }
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_scam_gold = {
				custom_tooltip = { text = EVTOPTA_SNW_170_TTA }
				hidden_effect = {
					add_artifact = guilds_item_gold
				}
			}
			guilds_scam_spices = {
				custom_tooltip = { text = EVTOPTA_SNW_170_TTB }
				hidden_effect = {
					add_artifact = guilds_item_spices
				}
			}
			guilds_scam_silk = {
				custom_tooltip = { text = EVTOPTA_SNW_170_TTC }
				hidden_effect = {
					add_artifact = guilds_item_silk
				}
			}
			guilds_scam_book = {
				custom_tooltip = { text = EVTOPTA_SNW_170_TTD }
				hidden_effect = {
					add_artifact = guilds_item_book
				}
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
		clr_character_flag = guilds_scam_gold
		clr_character_flag = guilds_scam_spices
		clr_character_flag = guilds_scam_silk
		clr_character_flag = guilds_scam_book
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 1.15
					wealth = 115
				}
			}
		}
	}
	option = { #Confront Fake
		trigger = { has_character_flag = guilds_scam }
		name = EVTOPTD_SNW_170
		character_event = { id = SNW.1701 days = 1 }
	}
	option = { #Has to be a scam.
		name = EVTOPTE_SNW_170
		clr_character_flag = guilds_scam_gold
		clr_character_flag = guilds_scam_spices
		clr_character_flag = guilds_scam_silk
		clr_character_flag = guilds_scam_book
		character_event = { id = SNW.1300 }
		custom_tooltip = { text = guilds_go_market_tt }
		ai_chance = {
			factor = 1

			modifier = {
				factor = 1.5
				NAND = {
					scaled_wealth = 1
					wealth = 100
				}
			}
		}
	}
	after = { clr_character_flag = guilds_scam  }
}

#Too good of a deal start - Missjudged
character_event = {
	id = SNW.1700
	desc = EVTDESC_SNW_1700 
	picture = GFX_evt_scandal
	border = GFX_event_normal_frame_economy_guilds
		
	is_triggered_only = yes
	
	option = { 
		name = EVTOPTA_SNW_1700
		detract_society_currency_trivial_effect = yes
	}
}

#Too good of a deal start - Busted
character_event = {
	id = SNW.1701
	desc = EVTDESC_SNW_1701
	picture = GFX_evt_stressed_ruler
	border = GFX_event_normal_frame_economy_guilds
		
	is_triggered_only = yes
	
	option = { #Ask for your due
		name = EVTOPTA_SNW_1701
		scaled_wealth = { value = -1.15 min = -115 max = -1150 }
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_scam_gold = {
				add_artifact = guilds_item_gold
				add_artifact = guilds_item_gold
			}
			guilds_scam_spices = {
				add_artifact = guilds_item_spices
				add_artifact = guilds_item_spices
			}
			guilds_scam_silk = {
				add_artifact = guilds_item_silk
				add_artifact = guilds_item_silk
			}
			guilds_scam_book = {
				add_artifact = guilds_item_book
				add_artifact = guilds_item_book
			}
		}
		add_society_currency_minor_effect = yes
		ai_chance = {
			factor = 1
	
			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 1.15
					wealth = 115
				}
			}
		}
		clr_character_flag = guilds_scam_gold
		clr_character_flag = guilds_scam_spices
		clr_character_flag = guilds_scam_silk
		clr_character_flag = guilds_scam_book
	}
	option = { #Threaten to report
		name = EVTOPTB_SNW_1701
		character_event = { id = SNW.1702 days = 1 }
	}
}

#Too good of a deal - Bribe
character_event = {
	id = SNW.1702
	desc = EVTDESC_SNW_1702
	picture = GFX_evt_stressed_ruler
	border = GFX_event_normal_frame_economy_guilds
		
	is_triggered_only = yes
	
	option = { #Ask for your due
		name = EVTOPTA_SNW_1702
		scaled_wealth = { value = -1.15 min = -115 max = -1150 }
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_scam_gold = {
				add_artifact = guilds_item_gold
				add_artifact = guilds_item_gold
			}
			guilds_scam_spices = {
				add_artifact = guilds_item_spices
				add_artifact = guilds_item_spices
			}
			guilds_scam_silk = {
				add_artifact = guilds_item_silk
				add_artifact = guilds_item_silk
			}
			guilds_scam_book = {
				add_artifact = guilds_item_book
				add_artifact = guilds_item_book
			}
		}
		add_society_currency_minor_effect = yes
		ai_chance = {
			factor = 1
	
			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 1.15
					wealth = 115
				}
			}
		}
	}
	option = { #Accept on credit
		name = EVTOPTB_SNW_1702
		character_event = { id = SNW.1703 days = 1 }
		add_artifact = guilds_item_armor_fake
		add_artifact = guilds_item_armor_fake
		add_artifact = guilds_item_armor_fake
		add_artifact = guilds_item_armor_fake
		# wealth = -1000
	}
	option = { #Still report him
		name = EVTOPTC_SNW_1702
		add_society_currency_medium_effect = yes
	}
	after = {
		clr_character_flag = guilds_scam_gold
		clr_character_flag = guilds_scam_spices
		clr_character_flag = guilds_scam_silk
		clr_character_flag = guilds_scam_book
	}
}

#Too good of a deal - Scammed
character_event = {
	id = SNW.1703
	desc = EVTDESC_SNW_1703
	picture = GFX_evt_bad_news
	border = GFX_event_normal_frame_economy_guilds
		
	is_triggered_only = yes
	
	option = { #Ask the guild to buy them
		name = EVTOPTA_SNW_1703
		wealth = 300
		destroy_artifact = guilds_item_armor_fake
		destroy_artifact = guilds_item_armor_fake
		destroy_artifact = guilds_item_armor_fake
		destroy_artifact = guilds_item_armor_fake
		character_event = { id = SNW.1704 days = 1 }
	}
	option = { #Scam someone back
		trigger = { has_society_currency_minor_trigger = yes }
		name = EVTOPTB_SNW_1703
		wealth = 600
		destroy_artifact = guilds_item_armor_fake
		destroy_artifact = guilds_item_armor_fake
		destroy_artifact = guilds_item_armor_fake
		destroy_artifact = guilds_item_armor_fake
		detract_society_currency_minor_effect = yes
		character_event = { id = SNW.1704 days = 1 }
	}
}

#Too good of a deal - Solutions
character_event = {
	id = SNW.1704
	desc = EVTDESC_SNW_1704
	picture = GFX_evt_bad_news
	border = GFX_event_normal_frame_economy_guilds
		
	is_triggered_only = yes
	
	option = { #Smuggle gold
		name = EVTOPTA_SNW_1704
		character_event = { id = SNW.1705 days = 1 }
	}
	option = { #Beg for loan
		name = EVTOPTB_SNW_1704
		character_event = { id = SNW.1706 days = 5 }
		wealth = 500
		add_character_modifier = {
			modifier = guilds_beggar
			months = 12
		}
	}
	option = { #Loan from the guild
		trigger = { has_society_currency_minor_trigger = yes }
		name = EVTOPTC_SNW_1704
		character_event = { id = SNW.1706 days = 5 }
		wealth = 500
		detract_society_currency_minor_effect = yes
	}
}

#Too good of a deal - Smuggle
character_event = {
	id = SNW.1705
	desc = EVTDESC_SNW_1705
	picture = GFX_evt_whispers
	border = GFX_event_normal_frame_economy_guilds
		
	is_triggered_only = yes
	
	immediate = {
		random_list = {
			50 = { set_character_flag = guilds_scam }
			50 = {}
		}
	}
	
	option = { #Success
		trigger = { NOT = { has_character_flag = guilds_scam } }
		name = EVTOPTA_SNW_1705
		wealth = 700
		character_event = { id = SNW.1706 days = 1 }
	}
	option = { #Smuggler ring
		trigger = { has_character_flag = guilds_scam }
		name = EVTOPTB_SNW_1705
		wealth = 700
		# add_character_modifier = {
			# name = guilds_smugglers
			# months = 12
		# }
		character_event = { id = SNW.1706 days = 5 }
		character_event = { id = SNW.1707 days = 2}
	}
	after = {
	clr_character_flag = guilds_scam
	}
}

#Too good of a deal - Pay
character_event = {
	id = SNW.1706
	desc = EVTDESC_SNW_1706
	picture = GFX_evt_relaxed_ruler
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_SNW_1706
		wealth = -1000
	}
}

#Too good of a deal - Smugglers
character_event = {
	id = SNW.1707
	desc = EVTDESC_SNW_1707
	picture = GFX_evt_bandits
	border = GFX_event_normal_frame_economy_guilds
	
	# notification = yes
	
	is_triggered_only = yes
	
	immediate = {
	}
	option = {
		name = EVTOPTA_SNW_1707
		location = {
			random_list = {
				50 = { }
				50 = {
					add_province_modifier = {
						name = guilds_smugglers_ring_metal
						months = 24
					}
				}
			}
		}
		location = {
			random_list = {
				50 = { }
				50 = {
					add_province_modifier = {
						name = guilds_smugglers_ring_vegetal
						months = 24
					}
				}
			}
		}
		location = {
			random_list = {
				50 = { }
				50 = {
					add_province_modifier = {
						name = guilds_smugglers_ring_animal
						months = 24
					}
				}
			}
		}
		location = {
			random_list = {
				50 = { }
				50 = {
					add_province_modifier = {
						name = guilds_smugglers_ring_final
						months = 24
					}
				}
			}
		}
	}
}

#Investment Metal
character_event = {
	id = SNW.140
	picture = GFX_evt_throne_room
	border = GFX_event_normal_frame_economy_guilds

	is_triggered_only = yes

	desc = {
		trigger = { has_character_flag = guilds_invest_a }
		text = EVTDESC_SNW_140_A
	}
	desc = {
		trigger = { has_character_flag = guilds_invest_b }
		text = EVTDESC_SNW_140_B
	}
	desc = {
		trigger = { has_character_flag = guilds_invest_c }
		text = EVTDESC_SNW_140_C
	}
	desc = {
		trigger = { has_character_flag = guilds_invest_d }
		text = EVTDESC_SNW_140_D
	}
	desc = {
		trigger = { has_character_flag = guilds_invest_e }
		text = EVTDESC_SNW_140_E
	}
	
	immediate = {
		random_list = {
			20 = { set_character_flag = guilds_invest_a }
			20 = { set_character_flag = guilds_invest_b }
			20 = { set_character_flag = guilds_invest_c }
			20 = { set_character_flag = guilds_invest_d }
			20 = { set_character_flag = guilds_invest_e }
		}
	}

	option = { #Invest Minor
		name = EVTOPTA_SNW_140
		trigger_switch = {
			on_trigger = has_character_flag
				guilds_invest_a = { scaled_wealth = { value = -0.15 min = -15 max = -150 } custom_tooltip = { text = guilds_item_stone_tooltip } }
				guilds_invest_b = { scaled_wealth = { value = -0.40 min = -40 max = -400 } custom_tooltip = { text = guilds_item_steel_tooltip } }
				guilds_invest_c = { scaled_wealth = { value = -0.65 min = -65 max = -650 } custom_tooltip = { text = guilds_item_gem_tooltip } }
				guilds_invest_d = { scaled_wealth = { value = -0.90 min = -90 max = -900 } custom_tooltip = { text = guilds_item_silver_tooltip } }
				guilds_invest_e = { scaled_wealth = { value = -1.15 min = -115 max = -1150 } custom_tooltip = { text = guilds_item_gold_tooltip } }
		}
		random_list = {
			10 = { 
				character_event = { id = SNW.145 days = 365 }
				custom_tooltip = { text = EVTOPTA_SNW_140_TT }
			} #fail
			60 = { 
				set_character_flag = guilds_invest_minor 
				character_event = { id = SNW.1401 days = 365 }
				custom_tooltip = { text = EVTOPTB_SNW_140_TT }
			}
			20 = { 
				set_character_flag = guilds_invest_medium
				character_event = { id = SNW.1401 days = 365 }
				custom_tooltip = { text = EVTOPTC_SNW_140_TT }
			}
			10 = { 
				set_character_flag = guilds_invest_major
				character_event = { id = SNW.1401 days = 365 }
				custom_tooltip = { text = EVTOPTD_SNW_140_TT }
			}
		}
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 1
					wealth = 100
				}
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}	

	option = { #Invest Medium
		name = EVTOPTB_SNW_140
		trigger_switch = {
			on_trigger = has_character_flag
				guilds_invest_a = { scaled_wealth = { value = -0.225 min = -22 max = -225 } custom_tooltip = { text = guilds_item_stone_tooltip } }
				guilds_invest_b = { scaled_wealth = { value = -0.60 min = -60 max = -600 } custom_tooltip = { text = guilds_item_steel_tooltip } }
				guilds_invest_c = { scaled_wealth = { value = -0.975 min = -97 max = -975 } custom_tooltip = { text = guilds_item_gem_tooltip } }
				guilds_invest_d = { scaled_wealth = { value = -1.35 min = -135 max = -1350 } custom_tooltip = { text = guilds_item_silver_tooltip } }
				guilds_invest_e = { scaled_wealth = { value = -1.725 min = -172 max = -1725 } custom_tooltip = { text = guilds_item_gold_tooltip } }
		}
		random_list = {
			10 = { 
				character_event = { id = SNW.145 days = 365 }
			custom_tooltip = { text = EVTOPTA_SNW_140_TT }	
			} #fail
			20 = { 
				set_character_flag = guilds_invest_minor 
				character_event = { id = SNW.1401 days = 365 }
				custom_tooltip = { text = EVTOPTB_SNW_140_TT }
			}
			50 = { 
				set_character_flag = guilds_invest_medium
				character_event = { id = SNW.1401 days = 365 }
				custom_tooltip = { text = EVTOPTC_SNW_140_TT }
			}
			20 = { 
				set_character_flag = guilds_invest_major
				character_event = { id = SNW.1401 days = 365 }
				custom_tooltip = { text = EVTOPTD_SNW_140_TT }
			}
		}
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 1.5
					wealth = 150
				}
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	
	option = { #Invest Major
		name = EVTOPTC_SNW_140
		trigger_switch = {
			on_trigger = has_character_flag
				guilds_invest_a = { scaled_wealth = { value = -0.30 min = -30 max = -300 } custom_tooltip = { text = guilds_item_stone_tooltip } }
				guilds_invest_b = { scaled_wealth = { value = -0.80 min = -80 max = -800 } custom_tooltip = { text = guilds_item_steel_tooltip } }
				guilds_invest_c = { scaled_wealth = { value = -1.30 min = -130 max = -1300 } custom_tooltip = { text = guilds_item_gem_tooltip } }
				guilds_invest_d = { scaled_wealth = { value = -1.80 min = -180 max = -1800 } custom_tooltip = { text = guilds_item_silver_tooltip } }
				guilds_invest_e = { scaled_wealth = { value = -2.30 min = -230 max = -2300 } custom_tooltip = { text = guilds_item_gold_tooltip } }
		}
		random_list = {
			10 = { 
				character_event = { id = SNW.145 days = 365 }
			custom_tooltip = { text = EVTOPTA_SNW_140_TT }	
			} #fail
			10 = { 
				set_character_flag = guilds_invest_minor 
				character_event = { id = SNW.1401 days = 365 }
				custom_tooltip = { text = EVTOPTB_SNW_140_TT }
			}
			20 = { 
				set_character_flag = guilds_invest_medium
				character_event = { id = SNW.1401 days = 365 }
				custom_tooltip = { text = EVTOPTC_SNW_140_TT }
			}
			60 = { 
				set_character_flag = guilds_invest_major
				character_event = { id = SNW.1401 days = 365 }
				custom_tooltip = { text = EVTOPTD_SNW_140_TT }
			}
		}
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 2
					wealth = 200
				}
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
		
	option = { #Cancel
		name = EVTOPTZ_SNW_140
		character_event = { id = SNW.1300 }
		custom_tooltip = { text = guilds_go_market_tt }
		clr_character_flag = guilds_invested
		clr_character_flag = guilds_invest_a
		clr_character_flag = guilds_invest_c
		clr_character_flag = guilds_invest_b
		clr_character_flag = guilds_invest_d
		clr_character_flag = guilds_invest_e
		clr_character_flag = guilds_invest_minor 
		clr_character_flag = guilds_invest_medium 
		clr_character_flag = guilds_invest_major
	}
}

#Investment Metal End
character_event = {
	id = SNW.1401
	desc = EVTDESC_SNW_1401
	picture = GFX_evt_throne_room
	border = GFX_event_normal_frame_economy_guilds

	is_triggered_only = yes
	
	option = { #Invest Minor
		name = EVTOPTA_SNW_1401
		trigger = { has_character_flag = guilds_invest_minor }
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_invest_a = { add_artifact = guilds_item_stone }
			guilds_invest_b = { add_artifact = guilds_item_steel }
			guilds_invest_c = { add_artifact = guilds_item_gem }
			guilds_invest_d = { add_artifact = guilds_item_silver }
			guilds_invest_e = { add_artifact = guilds_item_gold }
		}
	}
	option = { #Invest Medium
		name = EVTOPTB_SNW_1401
		trigger = { has_character_flag = guilds_invest_medium }
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_invest_a = { 
				add_artifact = guilds_item_stone 
				add_artifact = guilds_item_stone 
			}
			guilds_invest_b = { 
				add_artifact = guilds_item_steel 
				add_artifact = guilds_item_steel 
			}
			guilds_invest_c = { 
				add_artifact = guilds_item_gem 
				add_artifact = guilds_item_gem 
			}
			guilds_invest_d = { 
				add_artifact = guilds_item_silver 
				add_artifact = guilds_item_silver 
			}
			guilds_invest_e = { 
				add_artifact = guilds_item_gold 
				add_artifact = guilds_item_gold 
			}
		}
	}
	option = { #Invest Major
		name = EVTOPTC_SNW_1401
		trigger = { has_character_flag = guilds_invest_major }
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_invest_a = { 
			add_artifact = guilds_item_stone 
			add_artifact = guilds_item_stone 
			add_artifact = guilds_item_stone 
			}
			guilds_invest_b = { 
			add_artifact = guilds_item_steel 
			add_artifact = guilds_item_steel 
			add_artifact = guilds_item_steel 
			}
			guilds_invest_c = { 
			add_artifact = guilds_item_gem 
			add_artifact = guilds_item_gem 
			add_artifact = guilds_item_gem 
			}
			guilds_invest_d = { 
			add_artifact = guilds_item_silver 
			add_artifact = guilds_item_silver 
			add_artifact = guilds_item_silver 
			}
			guilds_invest_e = { 
			add_artifact = guilds_item_gold 
			add_artifact = guilds_item_gold 
			add_artifact = guilds_item_gold 
			}
		}
	}
	after = {
	clr_character_flag = guilds_invested
	clr_character_flag = guilds_invest_a
	clr_character_flag = guilds_invest_c
	clr_character_flag = guilds_invest_b
	clr_character_flag = guilds_invest_d
	clr_character_flag = guilds_invest_e
	clr_character_flag = guilds_invest_minor 
	clr_character_flag = guilds_invest_medium 
	clr_character_flag = guilds_invest_major
	}
}

#Investment Vegetal
character_event = {
	id = SNW.141
	picture = GFX_evt_throne_room
	border = GFX_event_normal_frame_economy_guilds

	is_triggered_only = yes

	desc = {
		trigger = { has_character_flag = guilds_invest_a }
		text = EVTDESC_SNW_141_A
	}
	desc = {
		trigger = { has_character_flag = guilds_invest_b }
		text = EVTDESC_SNW_141_B
	}
	desc = {
		trigger = { has_character_flag = guilds_invest_c }
		text = EVTDESC_SNW_141_C
	}
	desc = {
		trigger = { has_character_flag = guilds_invest_d }
		text = EVTDESC_SNW_141_D
	}
	desc = {
		trigger = { has_character_flag = guilds_invest_e }
		text = EVTDESC_SNW_141_E
	}
	
	immediate = {
		random_list = {
			20 = { set_character_flag = guilds_invest_a }
			20 = { set_character_flag = guilds_invest_b }
			20 = { set_character_flag = guilds_invest_c }
			20 = { set_character_flag = guilds_invest_d }
			20 = { set_character_flag = guilds_invest_e }
		}
	}

	option = { #Invest Minor
		name = EVTOPTA_SNW_141
		trigger_switch = {
			on_trigger = has_character_flag
				guilds_invest_a = { scaled_wealth = { value = -0.15 min = -15 max = -150 } custom_tooltip = { text = guilds_item_grain_tooltip } }
				guilds_invest_b = { scaled_wealth = { value = -0.40 min = -40 max = -400 } custom_tooltip = { text = guilds_item_lumber_tooltip } }
				guilds_invest_c = { scaled_wealth = { value = -0.65 min = -65 max = -650 } custom_tooltip = { text = guilds_item_linen_tooltip } }
				guilds_invest_d = { scaled_wealth = { value = -0.90 min = -90 max = -900 } custom_tooltip = { text = guilds_item_incense_tooltip } }
				guilds_invest_e = { scaled_wealth = { value = -1.15 min = -115 max = -1150 } custom_tooltip = { text = guilds_item_spices_tooltip } }
		}
		random_list = {
			10 = { 
				character_event = { id = SNW.145 days = 365 }
				custom_tooltip = { text = EVTOPTA_SNW_140_TT }
			} #fail
			60 = { 
				set_character_flag = guilds_invest_minor 
				character_event = { id = SNW.1411 days = 365 }
				custom_tooltip = { text = EVTOPTB_SNW_140_TT }
			}
			20 = { 
				set_character_flag = guilds_invest_medium
				character_event = { id = SNW.1411 days = 365 }
				custom_tooltip = { text = EVTOPTC_SNW_140_TT }
			}
			10 = { 
				set_character_flag = guilds_invest_major
				character_event = { id = SNW.1411 days = 365 }
				custom_tooltip = { text = EVTOPTD_SNW_140_TT }
			}
		}
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 1
					wealth = 100
				}
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}	

	option = { #Invest Medium
		name = EVTOPTB_SNW_141
		trigger_switch = {
			on_trigger = has_character_flag
				guilds_invest_a = { scaled_wealth = { value = -0.225 min = -22 max = -225 } custom_tooltip = { text = guilds_item_grain_tooltip } }
				guilds_invest_b = { scaled_wealth = { value = -0.60 min = -60 max = -600 } custom_tooltip = { text = guilds_item_lumber_tooltip } }
				guilds_invest_c = { scaled_wealth = { value = -0.975 min = -97 max = -975 } custom_tooltip = { text = guilds_item_linen_tooltip } }
				guilds_invest_d = { scaled_wealth = { value = -1.35 min = -135 max = -1350 } custom_tooltip = { text = guilds_item_incense_tooltip } }
				guilds_invest_e = { scaled_wealth = { value = -1.725 min = -172 max = -1725 } custom_tooltip = { text = guilds_item_spices_tooltip } }
		}
		random_list = {
			10 = { 
				character_event = { id = SNW.145 days = 365 }
			custom_tooltip = { text = EVTOPTA_SNW_140_TT }	
			} #fail
			20 = { 
				set_character_flag = guilds_invest_minor 
				character_event = { id = SNW.1411 days = 365 }
				custom_tooltip = { text = EVTOPTB_SNW_140_TT }
			}
			50 = { 
				set_character_flag = guilds_invest_medium
				character_event = { id = SNW.1411 days = 365 }
				custom_tooltip = { text = EVTOPTC_SNW_140_TT }
			}
			20 = { 
				set_character_flag = guilds_invest_major
				character_event = { id = SNW.1411 days = 365 }
				custom_tooltip = { text = EVTOPTD_SNW_140_TT }
			}
		}
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 1.5
					wealth = 150
				}
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	
	option = { #Invest Major
		name = EVTOPTC_SNW_141
		trigger_switch = {
			on_trigger = has_character_flag
				guilds_invest_a = { scaled_wealth = { value = -0.30 min = -30 max = -300 } custom_tooltip = { text = guilds_item_grain_tooltip } }
				guilds_invest_b = { scaled_wealth = { value = -0.80 min = -80 max = -800 } custom_tooltip = { text = guilds_item_lumber_tooltip } }
				guilds_invest_c = { scaled_wealth = { value = -1.30 min = -130 max = -1300 } custom_tooltip = { text = guilds_item_linen_tooltip } }
				guilds_invest_d = { scaled_wealth = { value = -1.80 min = -180 max = -1800 } custom_tooltip = { text = guilds_item_incense_tooltip } }
				guilds_invest_e = { scaled_wealth = { value = -2.30 min = -230 max = -2300 } custom_tooltip = { text = guilds_item_spices_tooltip } }
		}
		random_list = {
			10 = { 
				character_event = { id = SNW.145 days = 365 }
			custom_tooltip = { text = EVTOPTA_SNW_140_TT }	
			} #fail
			10 = { 
				set_character_flag = guilds_invest_minor 
				character_event = { id = SNW.1411 days = 365 }
				custom_tooltip = { text = EVTOPTB_SNW_140_TT }
			}
			20 = { 
				set_character_flag = guilds_invest_medium
				character_event = { id = SNW.1411 days = 365 }
				custom_tooltip = { text = EVTOPTC_SNW_140_TT }
			}
			60 = { 
				set_character_flag = guilds_invest_major
				character_event = { id = SNW.1411 days = 365 }
				custom_tooltip = { text = EVTOPTD_SNW_140_TT }
			}
		}
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 2
					wealth = 200
				}
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	
	option = { #Cancel
		name = EVTOPTZ_SNW_140
		character_event = { id = SNW.1300 }
		custom_tooltip = { text = guilds_go_market_tt }
		clr_character_flag = guilds_invested
		clr_character_flag = guilds_invest_a
		clr_character_flag = guilds_invest_c
		clr_character_flag = guilds_invest_b
		clr_character_flag = guilds_invest_d
		clr_character_flag = guilds_invest_e
		clr_character_flag = guilds_invest_minor 
		clr_character_flag = guilds_invest_medium 
		clr_character_flag = guilds_invest_major
	}
}

#Investment Vegetal End
character_event = {
	id = SNW.1411
	desc = EVTDESC_SNW_1411
	picture = GFX_evt_throne_room
	border = GFX_event_normal_frame_economy_guilds

	is_triggered_only = yes
	
	option = { #Invest Minor
		name = EVTOPTA_SNW_1411
		trigger = { has_character_flag = guilds_invest_minor }
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_invest_a = { add_artifact = guilds_item_grain }
			guilds_invest_b = { add_artifact = guilds_item_lumber }
			guilds_invest_c = { add_artifact = guilds_item_linen }
			guilds_invest_d = { add_artifact = guilds_item_incense }
			guilds_invest_e = { add_artifact = guilds_item_spices }
		}
	}
	option = { #Invest Medium
		name = EVTOPTB_SNW_1411
		trigger = { has_character_flag = guilds_invest_medium }
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_invest_a = { 
				add_artifact = guilds_item_grain 
				add_artifact = guilds_item_grain 
			}
			guilds_invest_b = { 
				add_artifact = guilds_item_lumber 
				add_artifact = guilds_item_lumber 
			}
			guilds_invest_c = { 
				add_artifact = guilds_item_linen 
				add_artifact = guilds_item_linen 
			}
			guilds_invest_d = { 
				add_artifact = guilds_item_incense 
				add_artifact = guilds_item_incense 
			}
			guilds_invest_e = { 
				add_artifact = guilds_item_spices 
				add_artifact = guilds_item_spices 
			}
		}
	}
	option = { #Invest Major
		name = EVTOPTC_SNW_1411
		trigger = { has_character_flag = guilds_invest_major }
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_invest_a = { 
			add_artifact = guilds_item_grain 
			add_artifact = guilds_item_grain 
			add_artifact = guilds_item_grain 
			}
			guilds_invest_b = { 
			add_artifact = guilds_item_lumber 
			add_artifact = guilds_item_lumber 
			add_artifact = guilds_item_lumber 
			}
			guilds_invest_c = { 
			add_artifact = guilds_item_linen 
			add_artifact = guilds_item_linen 
			add_artifact = guilds_item_linen 
			}
			guilds_invest_d = { 
			add_artifact = guilds_item_incense 
			add_artifact = guilds_item_incense 
			add_artifact = guilds_item_incense 
			}
			guilds_invest_e = { 
			add_artifact = guilds_item_spices 
			add_artifact = guilds_item_spices 
			add_artifact = guilds_item_spices 
			}
		}
	}
	after = {
	clr_character_flag = guilds_invested
	clr_character_flag = guilds_invest_a
	clr_character_flag = guilds_invest_c
	clr_character_flag = guilds_invest_b
	clr_character_flag = guilds_invest_d
	clr_character_flag = guilds_invest_e
	clr_character_flag = guilds_invest_minor 
	clr_character_flag = guilds_invest_medium 
	clr_character_flag = guilds_invest_major
	}
}

#Investment Animal
character_event = {
	id = SNW.142
	picture = GFX_evt_throne_room
	border = GFX_event_normal_frame_economy_guilds

	is_triggered_only = yes

	desc = {
		trigger = { has_character_flag = guilds_invest_a }
		text = EVTDESC_SNW_142_A
	}
	desc = {
		trigger = { has_character_flag = guilds_invest_b }
		text = EVTDESC_SNW_142_B
	}
	desc = {
		trigger = { has_character_flag = guilds_invest_c }
		text = EVTDESC_SNW_142_C
	}
	desc = {
		trigger = { has_character_flag = guilds_invest_d }
		text = EVTDESC_SNW_142_D
	}
	desc = {
		trigger = { has_character_flag = guilds_invest_e }
		text = EVTDESC_SNW_142_E
	}
	
	immediate = {
		random_list = {
			20 = { set_character_flag = guilds_invest_a }
			20 = { set_character_flag = guilds_invest_b }
			20 = { set_character_flag = guilds_invest_c }
			20 = { set_character_flag = guilds_invest_d }
			20 = { set_character_flag = guilds_invest_e }
		}
	}

	option = { #Invest Minor
		name = EVTOPTA_SNW_142
		trigger_switch = {
			on_trigger = has_character_flag
				guilds_invest_a = { scaled_wealth = { value = -0.15 min = -15 max = -150 } custom_tooltip = { text = guilds_item_meat_tooltip } }
				guilds_invest_b = { scaled_wealth = { value = -0.40 min = -40 max = -400 } custom_tooltip = { text = guilds_item_wool_tooltip } }
				guilds_invest_c = { scaled_wealth = { value = -0.65 min = -65 max = -650 } custom_tooltip = { text = guilds_item_hide_tooltip } }
				guilds_invest_d = { scaled_wealth = { value = -0.90 min = -90 max = -900 } custom_tooltip = { text = guilds_item_ivory_tooltip } }
				guilds_invest_e = { scaled_wealth = { value = -1.15 min = -115 max = -1150 } custom_tooltip = { text = guilds_item_silk_tooltip } }
		}
		random_list = {
			10 = { 
				character_event = { id = SNW.145 days = 365 }
				custom_tooltip = { text = EVTOPTA_SNW_140_TT }
			} #fail
			60 = { 
				set_character_flag = guilds_invest_minor 
				character_event = { id = SNW.1421 days = 365 }
				custom_tooltip = { text = EVTOPTB_SNW_140_TT }
			}
			20 = { 
				set_character_flag = guilds_invest_medium
				character_event = { id = SNW.1421 days = 365 }
				custom_tooltip = { text = EVTOPTC_SNW_140_TT }
			}
			10 = { 
				set_character_flag = guilds_invest_major
				character_event = { id = SNW.1421 days = 365 }
				custom_tooltip = { text = EVTOPTD_SNW_140_TT }
			}
		}
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 1
					wealth = 100
				}
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}	

	option = { #Invest Medium
		name = EVTOPTB_SNW_142
		trigger_switch = {
			on_trigger = has_character_flag
				guilds_invest_a = { scaled_wealth = { value = -0.225 min = -22 max = -225 } custom_tooltip = { text = guilds_item_meat_tooltip } }
				guilds_invest_b = { scaled_wealth = { value = -0.60 min = -60 max = -600 } custom_tooltip = { text = guilds_item_wool_tooltip } }
				guilds_invest_c = { scaled_wealth = { value = -0.975 min = -97 max = -975 } custom_tooltip = { text = guilds_item_hide_tooltip } }
				guilds_invest_d = { scaled_wealth = { value = -1.35 min = -135 max = -1350 } custom_tooltip = { text = guilds_item_ivory_tooltip } }
				guilds_invest_e = { scaled_wealth = { value = -1.725 min = -172 max = -1725 } custom_tooltip = { text = guilds_item_silk_tooltip } }
		}
		random_list = {
			10 = { 
				character_event = { id = SNW.145 days = 365 }
			custom_tooltip = { text = EVTOPTA_SNW_140_TT }	
			} #fail
			20 = { 
				set_character_flag = guilds_invest_minor 
				character_event = { id = SNW.1421 days = 365 }
				custom_tooltip = { text = EVTOPTB_SNW_140_TT }
			}
			50 = { 
				set_character_flag = guilds_invest_medium
				character_event = { id = SNW.1421 days = 365 }
				custom_tooltip = { text = EVTOPTC_SNW_140_TT }
			}
			20 = { 
				set_character_flag = guilds_invest_major
				character_event = { id = SNW.1421 days = 365 }
				custom_tooltip = { text = EVTOPTD_SNW_140_TT }
			}
		}
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 1.5
					wealth = 150
				}
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	
	option = { #Invest Major
		name = EVTOPTC_SNW_142
		trigger_switch = {
			on_trigger = has_character_flag
				guilds_invest_a = { scaled_wealth = { value = -0.30 min = -30 max = -300 } custom_tooltip = { text = guilds_item_meat_tooltip } }
				guilds_invest_b = { scaled_wealth = { value = -0.80 min = -80 max = -800 } custom_tooltip = { text = guilds_item_wool_tooltip } }
				guilds_invest_c = { scaled_wealth = { value = -1.30 min = -130 max = -1300 } custom_tooltip = { text = guilds_item_hide_tooltip } }
				guilds_invest_d = { scaled_wealth = { value = -1.80 min = -180 max = -1800 } custom_tooltip = { text = guilds_item_ivory_tooltip } }
				guilds_invest_e = { scaled_wealth = { value = -2.30 min = -230 max = -2300 } custom_tooltip = { text = guilds_item_silk_tooltip } }
		}
		random_list = {
			10 = { 
				character_event = { id = SNW.145 days = 365 }
			custom_tooltip = { text = EVTOPTA_SNW_140_TT }	
			} #fail
			10 = { 
				set_character_flag = guilds_invest_minor 
				character_event = { id = SNW.1421 days = 365 }
				custom_tooltip = { text = EVTOPTB_SNW_140_TT }
			}
			20 = { 
				set_character_flag = guilds_invest_medium
				character_event = { id = SNW.1421 days = 365 }
				custom_tooltip = { text = EVTOPTC_SNW_140_TT }
			}
			60 = { 
				set_character_flag = guilds_invest_major
				character_event = { id = SNW.1421 days = 365 }
				custom_tooltip = { text = EVTOPTD_SNW_140_TT }
			}
		}
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 2
					wealth = 200
				}
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	
	option = { #Cancel
		name = EVTOPTZ_SNW_140
		character_event = { id = SNW.1300 }
		custom_tooltip = { text = guilds_go_market_tt }
		clr_character_flag = guilds_invested
		clr_character_flag = guilds_invest_a
		clr_character_flag = guilds_invest_c
		clr_character_flag = guilds_invest_b
		clr_character_flag = guilds_invest_d
		clr_character_flag = guilds_invest_e
		clr_character_flag = guilds_invest_minor 
		clr_character_flag = guilds_invest_medium 
		clr_character_flag = guilds_invest_major
	}
}

#Investment Animal End
character_event = {
	id = SNW.1421
	desc = EVTDESC_SNW_1421
	picture = GFX_evt_throne_room
	border = GFX_event_normal_frame_economy_guilds

	is_triggered_only = yes
	
	option = { #Invest Minor
		name = EVTOPTA_SNW_1421
		trigger = { has_character_flag = guilds_invest_minor }
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_invest_a = { add_artifact = guilds_item_meat }
			guilds_invest_b = { add_artifact = guilds_item_wool }
			guilds_invest_c = { add_artifact = guilds_item_hide }
			guilds_invest_d = { add_artifact = guilds_item_ivory }
			guilds_invest_e = { add_artifact = guilds_item_silk }
		}
	}
	option = { #Invest Medium
		name = EVTOPTB_SNW_1421
		trigger = { has_character_flag = guilds_invest_medium }
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_invest_a = { 
				add_artifact = guilds_item_meat 
				add_artifact = guilds_item_meat 
			}
			guilds_invest_b = { 
				add_artifact = guilds_item_wool 
				add_artifact = guilds_item_wool 
			}
			guilds_invest_c = { 
				add_artifact = guilds_item_hide 
				add_artifact = guilds_item_hide 
			}
			guilds_invest_d = { 
				add_artifact = guilds_item_ivory 
				add_artifact = guilds_item_ivory 
			}
			guilds_invest_e = { 
				add_artifact = guilds_item_silk 
				add_artifact = guilds_item_silk 
			}
		}
	}
	option = { #Invest Major
		name = EVTOPTC_SNW_1421
		trigger = { has_character_flag = guilds_invest_major }
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_invest_a = { 
			add_artifact = guilds_item_meat 
			add_artifact = guilds_item_meat 
			add_artifact = guilds_item_meat 
			}
			guilds_invest_b = { 
			add_artifact = guilds_item_wool 
			add_artifact = guilds_item_wool 
			add_artifact = guilds_item_wool 
			}
			guilds_invest_c = { 
			add_artifact = guilds_item_hide 
			add_artifact = guilds_item_hide 
			add_artifact = guilds_item_hide 
			}
			guilds_invest_d = { 
			add_artifact = guilds_item_ivory 
			add_artifact = guilds_item_ivory 
			add_artifact = guilds_item_ivory 
			}
			guilds_invest_e = { 
			add_artifact = guilds_item_silk 
			add_artifact = guilds_item_silk 
			add_artifact = guilds_item_silk 
			}
		}
	}
	after = {
	clr_character_flag = guilds_invested
	clr_character_flag = guilds_invest_a
	clr_character_flag = guilds_invest_c
	clr_character_flag = guilds_invest_b
	clr_character_flag = guilds_invest_d
	clr_character_flag = guilds_invest_e
	clr_character_flag = guilds_invest_minor 
	clr_character_flag = guilds_invest_medium 
	clr_character_flag = guilds_invest_major
	}
}

#Investment Finished Goods
character_event = {
	id = SNW.143
	picture = GFX_evt_throne_room
	border = GFX_event_normal_frame_economy_guilds

	is_triggered_only = yes

	desc = {
		trigger = { has_character_flag = guilds_invest_a }
		text = EVTDESC_SNW_143_A
	}
	desc = {
		trigger = { has_character_flag = guilds_invest_b }
		text = EVTDESC_SNW_143_B
	}
	desc = {
		trigger = { has_character_flag = guilds_invest_c }
		text = EVTDESC_SNW_143_C
	}
	desc = {
		trigger = { has_character_flag = guilds_invest_d }
		text = EVTDESC_SNW_143_D
	}
	desc = {
		trigger = { has_character_flag = guilds_invest_e }
		text = EVTDESC_SNW_143_E
	}
	
	immediate = {
		random_list = {
			20 = { set_character_flag = guilds_invest_a }
			20 = { set_character_flag = guilds_invest_b }
			20 = { set_character_flag = guilds_invest_c }
			20 = { set_character_flag = guilds_invest_d }
			20 = { set_character_flag = guilds_invest_e }
		}
	}

	option = { #Invest Minor
		name = EVTOPTA_SNW_143
		trigger_switch = {
			on_trigger = has_character_flag
				guilds_invest_a = { scaled_wealth = { value = -0.15 min = -15 max = -150 } custom_tooltip = { text = guilds_item_pottery_tooltip } }
				guilds_invest_b = { scaled_wealth = { value = -0.40 min = -40 max = -400 } custom_tooltip = { text = guilds_item_alcohol_tooltip } }
				guilds_invest_c = { scaled_wealth = { value = -0.65 min = -65 max = -650 } custom_tooltip = { text = guilds_item_armor_tooltip } }
				guilds_invest_d = { scaled_wealth = { value = -0.90 min = -90 max = -900 } custom_tooltip = { text = guilds_item_jewelry_tooltip } }
				guilds_invest_e = { scaled_wealth = { value = -1.15 min = -115 max = -1150 } custom_tooltip = { text = guilds_item_book_tooltip } }
		}
		random_list = {
			10 = { 
				character_event = { id = SNW.145 days = 365 }
				custom_tooltip = { text = EVTOPTA_SNW_140_TT }
			} #fail
			60 = { 
				set_character_flag = guilds_invest_minor 
				character_event = { id = SNW.1431 days = 365 }
				custom_tooltip = { text = EVTOPTB_SNW_140_TT }
			}
			20 = { 
				set_character_flag = guilds_invest_medium
				character_event = { id = SNW.1431 days = 365 }
				custom_tooltip = { text = EVTOPTC_SNW_140_TT }
			}
			10 = { 
				set_character_flag = guilds_invest_major
				character_event = { id = SNW.1431 days = 365 }
				custom_tooltip = { text = EVTOPTD_SNW_140_TT }
			}
		}
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 1
					wealth = 100
				}
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}	

	option = { #Invest Medium
		name = EVTOPTB_SNW_143
		trigger_switch = {
			on_trigger = has_character_flag
				guilds_invest_a = { scaled_wealth = { value = -0.225 min = -22 max = -225 } custom_tooltip = { text = guilds_item_pottery_tooltip } }
				guilds_invest_b = { scaled_wealth = { value = -0.60 min = -60 max = -600 } custom_tooltip = { text = guilds_item_alcohol_tooltip } }
				guilds_invest_c = { scaled_wealth = { value = -0.975 min = -97 max = -975 } custom_tooltip = { text = guilds_item_armor_tooltip } }
				guilds_invest_d = { scaled_wealth = { value = -1.35 min = -135 max = -1350 } custom_tooltip = { text = guilds_item_jewelry_tooltip } }
				guilds_invest_e = { scaled_wealth = { value = -1.725 min = -172 max = -1725 } custom_tooltip = { text = guilds_item_book_tooltip } }
		}
		random_list = {
			10 = { 
				character_event = { id = SNW.145 days = 365 }
			custom_tooltip = { text = EVTOPTA_SNW_140_TT }	
			} #fail
			20 = { 
				set_character_flag = guilds_invest_minor 
				character_event = { id = SNW.1431 days = 365 }
				custom_tooltip = { text = EVTOPTB_SNW_140_TT }
			}
			50 = { 
				set_character_flag = guilds_invest_medium
				character_event = { id = SNW.1431 days = 365 }
				custom_tooltip = { text = EVTOPTC_SNW_140_TT }
			}
			20 = { 
				set_character_flag = guilds_invest_major
				character_event = { id = SNW.1431 days = 365 }
				custom_tooltip = { text = EVTOPTD_SNW_140_TT }
			}
		}
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 1.5
					wealth = 150
				}
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	
	option = { #Invest Major
		name = EVTOPTC_SNW_143
		trigger_switch = {
			on_trigger = has_character_flag
				guilds_invest_a = { scaled_wealth = { value = -0.30 min = -30 max = -300 } custom_tooltip = { text = guilds_item_pottery_tooltip } }
				guilds_invest_b = { scaled_wealth = { value = -0.80 min = -80 max = -800 } custom_tooltip = { text = guilds_item_alcohol_tooltip } }
				guilds_invest_c = { scaled_wealth = { value = -1.30 min = -130 max = -1300 } custom_tooltip = { text = guilds_item_armor_tooltip } }
				guilds_invest_d = { scaled_wealth = { value = -1.80 min = -180 max = -1800 } custom_tooltip = { text = guilds_item_jewelry_tooltip } }
				guilds_invest_e = { scaled_wealth = { value = -2.30 min = -230 max = -2300 } custom_tooltip = { text = guilds_item_book_tooltip } }
		}
		random_list = {
			10 = { 
				character_event = { id = SNW.145 days = 365 }
			custom_tooltip = { text = EVTOPTA_SNW_140_TT }	
			} #fail
			10 = { 
				set_character_flag = guilds_invest_minor 
				character_event = { id = SNW.1431 days = 365 }
				custom_tooltip = { text = EVTOPTB_SNW_140_TT }
			}
			20 = { 
				set_character_flag = guilds_invest_medium
				character_event = { id = SNW.1431 days = 365 }
				custom_tooltip = { text = EVTOPTC_SNW_140_TT }
			}
			60 = { 
				set_character_flag = guilds_invest_major
				character_event = { id = SNW.1431 days = 365 }
				custom_tooltip = { text = EVTOPTD_SNW_140_TT }
			}
		}
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 2
					wealth = 200
				}
			}
		}
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	
	option = { #Cancel
		name = EVTOPTZ_SNW_140
		character_event = { id = SNW.1300 }
		custom_tooltip = { text = guilds_go_market_tt }
		clr_character_flag = guilds_invested
		clr_character_flag = guilds_invest_a
		clr_character_flag = guilds_invest_c
		clr_character_flag = guilds_invest_b
		clr_character_flag = guilds_invest_d
		clr_character_flag = guilds_invest_e
		clr_character_flag = guilds_invest_minor 
		clr_character_flag = guilds_invest_medium 
		clr_character_flag = guilds_invest_major
	}
}

#Investment Finished Goods End
character_event = {
	id = SNW.1431
	desc = EVTDESC_SNW_1431
	picture = GFX_evt_throne_room
	border = GFX_event_normal_frame_economy_guilds

	is_triggered_only = yes
	
	option = { #Invest Minor
		name = EVTOPTA_SNW_1431
		trigger = { has_character_flag = guilds_invest_minor }
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_invest_a = { add_artifact = guilds_item_pottery }
			guilds_invest_b = { add_artifact = guilds_item_alcohol }
			guilds_invest_c = { add_artifact = guilds_item_armor }
			guilds_invest_d = { add_artifact = guilds_item_jewelry }
			guilds_invest_e = { add_artifact = guilds_item_book }
		}
	}
	option = { #Invest Medium
		name = EVTOPTB_SNW_1431
		trigger = { has_character_flag = guilds_invest_medium }
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_invest_a = { 
				add_artifact = guilds_item_pottery 
				add_artifact = guilds_item_pottery 
			}
			guilds_invest_b = { 
				add_artifact = guilds_item_alcohol 
				add_artifact = guilds_item_alcohol 
			}
			guilds_invest_c = { 
				add_artifact = guilds_item_armor 
				add_artifact = guilds_item_armor 
			}
			guilds_invest_d = { 
				add_artifact = guilds_item_jewelry 
				add_artifact = guilds_item_jewelry 
			}
			guilds_invest_e = { 
				add_artifact = guilds_item_book 
				add_artifact = guilds_item_book 
			}
		}
	}
	option = { #Invest Major
		name = EVTOPTC_SNW_1431
		trigger = { has_character_flag = guilds_invest_major }
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_invest_a = { 
			add_artifact = guilds_item_pottery 
			add_artifact = guilds_item_pottery 
			add_artifact = guilds_item_pottery 
			}
			guilds_invest_b = { 
			add_artifact = guilds_item_alcohol 
			add_artifact = guilds_item_alcohol 
			add_artifact = guilds_item_alcohol 
			}
			guilds_invest_c = { 
			add_artifact = guilds_item_armor 
			add_artifact = guilds_item_armor 
			add_artifact = guilds_item_armor 
			}
			guilds_invest_d = { 
			add_artifact = guilds_item_jewelry 
			add_artifact = guilds_item_jewelry 
			add_artifact = guilds_item_jewelry 
			}
			guilds_invest_e = { 
			add_artifact = guilds_item_book 
			add_artifact = guilds_item_book 
			add_artifact = guilds_item_book 
			}
		}
	}
	after = {
	clr_character_flag = guilds_invested
	clr_character_flag = guilds_invest_a
	clr_character_flag = guilds_invest_c
	clr_character_flag = guilds_invest_b
	clr_character_flag = guilds_invest_d
	clr_character_flag = guilds_invest_e
	clr_character_flag = guilds_invest_minor 
	clr_character_flag = guilds_invest_medium 
	clr_character_flag = guilds_invest_major
	}
}

#Investment Failure
character_event = {
	id = SNW.145
	desc = EVTDESC_SNW_145
	picture = GFX_evt_throne_room
	border = GFX_event_normal_frame_economy_guilds
	
	# notification = yes
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_SNW_145
		clr_character_flag = guilds_invested
		clr_character_flag = guilds_invest_a
		clr_character_flag = guilds_invest_c
		clr_character_flag = guilds_invest_b
		clr_character_flag = guilds_invest_d
		clr_character_flag = guilds_invest_e
		clr_character_flag = guilds_invest_minor 
		clr_character_flag = guilds_invest_medium 
		clr_character_flag = guilds_invest_major
	}
}

#Loan
character_event = {
    id = SNW.150
	# hide_window = yes
	desc = EVTDESC_SNW_150
	picture = GFX_evt_poke_king_in_chest
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes
	
	trigger = {
		OR = {
			has_character_modifier = guilds_loan_one
			has_character_modifier = guilds_loan_two
			has_character_modifier = guilds_loan_three
		}
	}
	
	immediate = { 
		set_character_flag = guilds_is_using_goods
		if = {
			limit = {
				any_artifact = { has_artifact_flag = goods }
			}
			set_character_flag = guilds_can_sell
		}
	}

	option = { #pay
		name = EVTOPTA_SNW_150
		trigger = { wealth = 120 }
		wealth = -120
	}
	option = { #debt
		name = EVTOPTB_SNW_150
		trigger = { NOT = { wealth = 120 } }
		wealth = -120
	}
	option = { #seize
		name = EVTOPTC_SNW_150
		trigger = { has_character_flag = guilds_can_sell }
		
		random_artifact = {
			limit = { has_artifact_flag = goods }
			destroy_artifact = yes
		}
	}
	option = { #Refuse Rank Down
		name = EVTOPTD_SNW_150
		trigger = { 
			NOT = { society_rank == 1 } 
			is_in_society = yes
		}
		society_rank_down = 1
	}
	option = { #Refuse Leave
		name = EVTOPTE_SNW_150
		trigger = { society_rank == 1 }
		leave_society = yes
		set_character_flag = guilds_traitor
		custom_tooltip = { text = guilds_antagonize_trade_league }
		}
	after = {
	clr_character_flag = guilds_can_sell
	clr_character_flag = guilds_is_using_goods
	}
}

#Loan normal ping 1
character_event = {
    id = SNW.1501
    hide_window = yes
    is_triggered_only = yes

    immediate = {
    	random_society_member = {
    		limit = {
				is_landed = yes
				society_member_of = the_guilds
				NOT = { character = ROOT }
				prisoner = no
    		}
    		character_event = { id = SNW.1502 }
    	}
    }
}

#Loan normal ping 2
character_event = {
    id = SNW.1502
    hide_window = yes
    is_triggered_only = yes

    immediate = {
		FROM = { character_event = { id = SNW.150 } }
    }
}

#Loan cheap
character_event = {
    id = SNW.151
	# hide_window = yes
	desc = EVTDESC_SNW_151
	picture = GFX_evt_poke_king_in_chest
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes
	
	immediate = { 
		set_character_flag = guilds_is_using_goods 
		if = {
			limit = {
				any_artifact = { has_artifact_flag = goods }
			}
			set_character_flag = guilds_can_sell
		}
	}

	trigger = {
		OR = {
			has_character_modifier = guilds_loan_one
			has_character_modifier = guilds_loan_two
			has_character_modifier = guilds_loan_three
		}
	}
	
	option = { #pay
		name = EVTOPTA_SNW_151
		trigger = { wealth = 100 }
		wealth = -100
	}
	option = { #debt
		name = EVTOPTB_SNW_151
		trigger = { NOT = { wealth = 100 } }
		wealth = -100
	}
	option = { #seize
		name = EVTOPTC_SNW_151
		trigger = { has_character_flag = guilds_can_sell }
		
		random_artifact = {
			limit = { has_artifact_flag = goods }
			destroy_artifact = yes
		}
	}
	option = { #Refuse Rank Down
		name = EVTOPTD_SNW_151
		trigger = { 
			NOT = { society_rank == 1 } 
			is_in_society = yes
		}
		ai_chance = {
			factor 0.2
		}
		guilds_add_influence_very_bad_deal = yes
		society_rank_down = 1
	}
	option = { #Refuse Leave
		name = EVTOPTE_SNW_151
		trigger = { society_rank == 1 }
		ai_chance = {
			factor 0.2
		}
		guilds_add_influence_very_bad_deal = yes
		leave_society = yes
		set_character_flag = guilds_traitor
		custom_tooltip = { text = guilds_antagonize_trade_league }
	}
	after = {
	clr_character_flag = guilds_can_sell
	clr_character_flag = guilds_is_using_goods
	}
}

#Loan cheap ping 1
character_event = {
    id = SNW.1511
    hide_window = yes
    is_triggered_only = yes

    immediate = {
    	random_society_member = {
    		limit = {
				is_landed = yes
				society_member_of = the_guilds
				NOT = { character = ROOT }
				prisoner = no
    		}
    		character_event = { id = SNW.1512 }
    	}
    }
}

#Loan cheap ping 2
character_event = {
    id = SNW.1512
    hide_window = yes
    is_triggered_only = yes

    immediate = {
		FROM = { character_event = { id = SNW.151 } }
	}
}

#Loan death
character_event = {
	id = SNW.152

	hide_window = yes
	
	is_triggered_only = yes
	
	trigger = {
		has_character_modifier = guilds_loan_three
	}

	immediate = {
		current_heir = {
			character_event = { id = SNW.1551 days = 15 }
		}
	}
}
character_event = {
	id = SNW.153

	hide_window = yes
	
	is_triggered_only = yes
	
	trigger = {
		has_character_modifier = guilds_loan_one
	}

	immediate = {
		current_heir = {
			character_event = { id = SNW.1551 days = 5 }
		}
	}
}
character_event = {
	id = SNW.154

	hide_window = yes
	
	is_triggered_only = yes
	
	trigger = {
		has_character_modifier = guilds_loan_two
	}

	immediate = {
		current_heir = {
			character_event = { id = SNW.1551 days = 10 }
		}
	}
}

#Loan death ping 1
character_event = {
    id = SNW.1551
    hide_window = yes
    is_triggered_only = yes

    immediate = {
    	random_society_member = {
    		limit = {
				is_landed = yes
				society_member_of = the_guilds
				NOT = { character = ROOT }
				prisoner = no
    		}
    		character_event = { id = SNW.1552 }
    	}
    }
}

#Loan death ping 2
character_event = {
    id = SNW.1552
    hide_window = yes
    is_triggered_only = yes

    immediate = {
		FROM = { character_event = { id = SNW.155 } }
	}
}

#Loan pay parents debt
character_event = {
    id = SNW.155
	# hide_window = yes
	desc = EVTDESC_SNW_155
	picture = GFX_evt_poke_king_in_chest
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes
	
	immediate = { 
		set_character_flag = guilds_is_using_goods
		if = {
			limit = {
				any_artifact = { has_artifact_flag = goods }
			}
			set_character_flag = guilds_can_sell
		}
	}

	option = { #pay
		name = EVTOPTA_SNW_155
		trigger = { wealth = 100 }
		wealth = -100
	}
	option = { #debt
		name = EVTOPTB_SNW_155
		trigger = { NOT = { wealth = 100 } }
		wealth = -100
	}
	option = { #seize
		name = EVTOPTC_SNW_155
		trigger = { has_character_flag = guilds_can_sell }
		
		random_artifact = {
			limit = { has_artifact_flag = goods }
			destroy_artifact = yes
		}
	}
	option = { #Refuse Rank Down
		name = EVTOPTD_SNW_155
		trigger = { 
			society_member_of = the_guilds
			NOT = { society_rank == 1 }
		}
		society_rank_down = 1
	}
	option = { #Refuse Leave
		name = EVTOPTE_SNW_155
		trigger = { 
			society_rank == 1 
			society_member_of = the_guilds
		}
		leave_society = yes
		set_character_flag = guilds_traitor
		custom_tooltip = { text = guilds_antagonize_trade_league }
	}
	option = { #fight
		name = EVTOPTF_SNW_155
		random_list = {
			50 = { #win
				prestige = 100
				FROM = {
					add_trait_wounded_effect = yes
				}
			}
			50 = { #lose
				modifier = {
					factor = 0.5
					combat_rating = 30
				}
				modifier = {
					factor = 0.5
					combat_rating = 10
				}
				modifier = {
					factor = 1.5
					NOT = { combat_rating = 10 }
				}
				modifier = {
					factor = 1.5
					NOT = { combat_rating = 0 }
				}
				if = {
					limit = {
						trait = wounded
					}
					add_trait_severely_injured_effect = yes
				}
				if = {
					limit = {
						NOT  = { trait = wounded }
					}
					add_trait_wounded_effect = yes
				}
				wealth = -100
				if = {
					limit = {
						society_member_of = the_guilds
					}
					leave_society = yes
				}
			}
		}
		set_character_flag = guilds_traitor
		custom_tooltip = { text = guilds_antagonize_trade_league }
	}
	after = {
		clr_character_flag = guilds_can_sell
		clr_character_flag = guilds_is_using_goods
	}
}

#Caravan Buy
character_event = {
    id = SNW.181
	desc = EVTDESC_SNW_181
	picture = GFX_evt_market
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { 
		name = EVTOPTA_SNW_181
		add_artifact = guilds_item_shop_stall
		scaled_wealth = { value = -0.5 min = -50 max = -500 }
		ai_chance = {
			factor = 5
			modifier = {
				factor = 0
				has_artifact = guilds_item_shop_stall
			}
		}
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
	}
	option = { 
		name = EVTOPTB_SNW_181
		add_artifact = guilds_item_shop_caravan
		scaled_wealth = { value = -0.5 min = -50 max = -500 }
		ai_chance = {
			factor = 5
			modifier = {
				factor = 0
				has_artifact = guilds_item_shop_caravan
			}
		}
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
	}
	option = { #sell
		name = EVTOPTD_SNW_181
		trigger = {
			or = {
				has_artifact = guilds_item_shop_stall
				has_artifact = guilds_item_shop_caravan
			}
		}
		character_event = { id = SNW.182 }
		ai_chance = {
			factor = 0.2
			modifier = {
				OR = {
					has_artifact = guilds_item_shop_stall
					has_artifact = guilds_item_shop_caravan
				}
			}
		}
	}
	option = { 
		name = EVTOPTC_SNW_181
		ai_chance = {
			factor = 2
			modifier = {
				factor = 10
				has_artifact = guilds_item_shop_stall
				has_artifact = guilds_item_shop_caravan
			}
		}
	}
}

#Caravan sell
character_event = {
    id = SNW.182
	desc = EVTDESC_SNW_182
	picture = GFX_evt_market
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	immediate = {
		set_character_flag = guilds_is_using_goods
	}
	
	option = { 
		name = EVTOPTA_SNW_182
		trigger = {
			has_artifact = guilds_item_shop_stall
		}
		destroy_artifact = guilds_item_shop_stall
		scaled_wealth = { value = 0.25 min = 25 max = 250 }
	}
	option = { 
		name = EVTOPTB_SNW_182
		trigger = {
			has_artifact = guilds_item_shop_caravan
		}
		destroy_artifact = guilds_item_shop_caravan
		scaled_wealth = { value = 0.25 min = 25 max = 250 }
	}
	option = { #buy
		name = EVTOPTD_SNW_182
		character_event = { id = SNW.181 }
		ai_chance = {
			factor = 0
		}
	}
	option = { 
		name = EVTOPTC_SNW_182
	}
	after = {
		clr_character_flag = guilds_is_using_goods
	}
}

#Caravan / Receive stall back
character_event = {
    id = SNW.180
	desc = EVTDESC_SNW_180
	picture = GFX_evt_market
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { 
		name = EVTOPTA_SNW_180
		add_artifact = guilds_item_shop_stall
	}
}

#Caravan is back
character_event = {
    id = SNW.190
	desc = EVTDESC_SNW_190
	picture = GFX_evt_merchant_caravan
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { 
		name = EVTOPTA_SNW_190
		add_artifact = guilds_item_shop_caravan
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
	}
}

#Caravan investment
character_event = {
    id = SNW.191
	desc = EVTDESC_SNW_191
	picture = GFX_evt_merchant_caravan
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #none
		name = EVTOPTA_SNW_191
		character_event = { id = SNW.192 }
	}
	option = { #small
		name = EVTOPTB_SNW_191
		scaled_wealth = { value = -0.33 min = -30 max = -300 }
		set_character_flag = guilds_caravan_investment_small
		character_event = { id = SNW.192 }
	}
	option = { #large
		name = EVTOPTC_SNW_191
		scaled_wealth = { value = -0.66 min = -60 max = -600 }
		set_character_flag = guilds_caravan_investment_large
		character_event = { id = SNW.192 }
	}
}

#Caravan security
character_event = {
    id = SNW.192
	desc = EVTDESC_SNW_192
	picture = GFX_evt_merchant_caravan
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #none
		name = EVTOPTA_SNW_192
	}
	option = { #yes
		name = EVTOPTB_SNW_192
		scaled_wealth = { value = -0.5 min = -50 max = -500 }
		set_character_flag = guilds_caravan_investment_security
	}
	option = { #send levy, cant send if already sent
		name = EVTOPTC_SNW_192
		trigger = {
			OR = {
				capital_holding  = { NOT = { has_holding_modifier = guilds_caravan_escort } }
				capital_holding  = { NOT = { has_holding_modifier = guilds_caravan_escort_timed } }
			}
		}
		capital_holding  = {
			add_holding_modifier = {
			name = guilds_caravan_escort
			duration = -1
			}
		}
		set_character_flag = guilds_caravan_investment_security
	
	}
	after = {
	clr_character_flag = guilds_preparing_caravan 
	set_character_flag = guilds_prepared_caravan
	}
}

#Caravan Missing
character_event = {
    id = SNW.193
	desc = EVTDESC_SNW_193
	picture = GFX_evt_bandits
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = {
		name = EVTOPTA_SNW_193
	}
}

#Caravan stone
character_event = {
    id = SNW.1901
	desc = EVTDESC_SNW_1901
	picture = GFX_evt_merchant_caravan
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #Buy
		name = EVTOPTA_SNW_1900
		add_artifact = guilds_item_stone
		custom_tooltip = { text = guilds_item_stone_tooltip }
		scaled_wealth = { value = -0.025 min = -2 max = -25 }
		if = {
			limit = { FROM = { location = { has_settlement_construction = yes } } }
			custom_tooltip = { text = guilds_goods_bonus_construction_tooltip }
			ROOT = { scaled_wealth = { value = -0.05 min = -5 max = -50 } } #construction bonus
		}
		if = {
			limit = {
				FROM = {
					location = {
						OR = {
							terrain = hills
							terrain = mountain
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
			ROOT = { scaled_wealth = { value = 0.02 min = 2 max = 20 } } #terrain malus
		}
		if = {
			limit = {
				FROM = {
					location = {
						OR = {
							terrain = jungle
							terrain = steppe
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
			ROOT = { scaled_wealth = { value = -0.02 min = -2 max = -20 } } #terrain bonus
		}
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 0.025
					wealth = 10
				}
			}
		}
	}
	option = { #Dont
		name = EVTOPTB_SNW_1900
		add_society_currency_trivial_effect = yes
	}
}

#Caravan steel
character_event = {
    id = SNW.1902
	desc = EVTDESC_SNW_1902
	picture = GFX_evt_merchant_caravan
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #Buy
		name = EVTOPTA_SNW_1900
		add_artifact = guilds_item_steel
		custom_tooltip = { text = guilds_item_steel_tooltip }
		scaled_wealth = { value = -0.15 min = -15 max = -150 }
		if = {
			limit = { 
				has_dlc = "Reapers"
				FROM = {
					location = {
						NOR = {
							has_province_modifier = prosperity_modifier_1
							has_province_modifier = prosperity_modifier_2
							has_province_modifier = prosperity_modifier_3
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			ROOT = { scaled_wealth = { value = 0.05 min = 5 max = 50 } } #prosperity malus
		}
		if = {
			limit = {
				FROM = {
					location = {
						OR = {
							terrain = farmlands
							terrain = plains
							terrain = forest
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
			ROOT = { scaled_wealth = { value = -0.05 min = -5 max = -50 } } #terrain bonus
		}
		if = {
			limit = { FROM = { owner = { war = yes } } }
			custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
			ROOT = { scaled_wealth = { value = -0.1 min = -10 max = -100 } } #war bonus
		}
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 0.15
					wealth = 15
				}
			}
		}
	}
	option = { #Dont
		name = EVTOPTB_SNW_1900
		add_society_currency_trivial_effect = yes
	}
}

#Caravan gem
character_event = {
    id = SNW.1903
	desc = EVTDESC_SNW_1903
	picture = GFX_evt_merchant_caravan
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #Buy
		name = EVTOPTA_SNW_1900
		add_artifact = guilds_item_gem
		custom_tooltip = { text = guilds_item_gem_tooltip }
		scaled_wealth = { value = -0.27 min = -27 max = -275 }
		if = { 
			limit = { 
				has_dlc = "Reapers"
				FROM = {
					location = { 
						has_province_modifier = prosperity_modifier_2 
					} 
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity bonus
		}
		if = { 
			limit = { 
				has_dlc = "Reapers"
				FROM = {
					location = { 
						OR = {
							has_province_modifier = prosperity_modifier_3
							has_province_modifier = prosperity_modifier_1
						}
					} 
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = -0.05 min = -5 max = -50 } #prosperity bonus
		}
		if = {
			limit = { 
				has_dlc = "Reapers"
				FROM = {
					location = {
						OR = {
							has_province_modifier = depopulated_1
							has_province_modifier = depopulated_2
							has_province_modifier = depopulated_3
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity malus
		}
		if = {
			limit = {
				FROM = {
					location = {
						OR = {
							terrain = hills
							terrain = mountain
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
			scaled_wealth = { value = 0.125 min = 12 max = 125 } #terrain malus
		}
		if = {
			limit = { FROM = { location = { has_epidemic = yes } } }
			custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
			scaled_wealth = { value = -0.05 min = -5 max = -50 } #epidemic bonus
		}
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 0.27
					wealth = 30
				}
			}
		}
	}
	option = { #Dont
		name = EVTOPTB_SNW_1900
		add_society_currency_trivial_effect = yes
	}
}

#Caravan silver
character_event = {
    id = SNW.1904
	desc = EVTDESC_SNW_1904
	picture = GFX_evt_merchant_caravan
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #Buy
		name = EVTOPTA_SNW_1900
		add_artifact = guilds_item_silver
		custom_tooltip = { text = guilds_item_silver_tooltip }
		scaled_wealth = { value = -0.40 min = -40 max = -400 }
		if = {
			limit = { 
				has_dlc = "Reapers"
				FROM = {
					location = {
						OR = {
							has_province_modifier = depopulated_1
							has_province_modifier = depopulated_2
							has_province_modifier = depopulated_3
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = 0.2 min = 20 max = 200 } #prosperity malus
		}
		if = {
			limit = { 
				has_dlc = "Reapers"
				FROM = {
					location = {
						NOR = {
							has_province_modifier = depopulated_1
							has_province_modifier = depopulated_2
							has_province_modifier = depopulated_3
							has_province_modifier = prosperity_modifier_1
							has_province_modifier = prosperity_modifier_2
							has_province_modifier = prosperity_modifier_3
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity malus
		}
		if = {
			limit = {
				FROM = {
					location = {
						OR = {
							terrain = hills
							terrain = mountain
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
			scaled_wealth = { value = 0.15 min = 15 max = 150 } #terrain malus
		}
		if = {
			limit = { FROM = { location = { has_epidemic = yes } } }
			custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
			scaled_wealth = { value = -0.20 min = -20 max = -200 } #epidemic bonus
		}
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 0.40
					wealth = 40
				}
			}
		}
	}
	option = { #Dont
		name = EVTOPTB_SNW_1900
		add_society_currency_trivial_effect = yes
	}
}

#Caravan gold
character_event = {
    id = SNW.1905
	desc = EVTDESC_SNW_1905
	picture = GFX_evt_merchant_caravan
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #Buy
		name = EVTOPTA_SNW_1900
		add_artifact = guilds_item_gold
		custom_tooltip = { text = guilds_item_gold_tooltip }
		scaled_wealth = { value = -0.525 min = -52 max = -525 }
					if = {
						limit = { 
							has_dlc = "Reapers"
							FROM = {
								location = {
									OR = {
										has_province_modifier = depopulated_1
										has_province_modifier = depopulated_2
										has_province_modifier = depopulated_3
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = 0.35 min = 350 max = 350 } #prosperity malus
					}
					if = {
						limit = { 
							has_dlc = "Reapers"
							FROM = {
								location = {
									OR = {
										has_province_modifier = prosperity_modifier_2
										has_province_modifier = prosperity_modifier_3
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
						scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity bonus
					}
					if = {
						limit = { FROM = { location = { has_epidemic = yes } } }
						custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
						scaled_wealth = { value = 0.1 min = 10 max = 100 } #epidemic malus
					}
					if = {
						limit = { FROM = { owner = { war = yes } } }
						custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
						scaled_wealth = { value = 0.2 min = 20 max = 200 } #war malus
					}
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 0.525
					wealth = 60
				}
			}
		}
	}
	option = { #Dont
		name = EVTOPTB_SNW_1900
		add_society_currency_trivial_effect = yes
	}
}

#Caravan grain
character_event = {
    id = SNW.1906
	desc = EVTDESC_SNW_1906
	picture = GFX_evt_merchant_caravan
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #Buy
		name = EVTOPTA_SNW_1900
		add_artifact = guilds_item_grain
		custom_tooltip = { text = guilds_item_grain_tooltip }
		scaled_wealth = { value = -0.025 min = -2 max = -25 }
		if = {
			limit = {
				has_dlc = "Reapers"
				FROM = {
					location = { 
						OR = { 
							has_province_modifier = depopulated_1
							has_province_modifier = depopulated_2
							has_province_modifier = depopulated_3
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = -0.10 min = -10 max = -100 } #prosperity bonus
		}
		if = {
			limit = {
				FROM = {
					location = {
						terrain = farmlands
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
			scaled_wealth = { value = 0.015 min = 1 max = 15 } #terrain malus
		}
		if = {
			limit = {
				FROM = {
					location = {
						OR = {
							terrain = plains
							terrain = steppe 
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
			scaled_wealth = { value = 0.01 min = 1 max = 10 } #terrain malus
		}
		if = {
			limit = {
				FROM = {
					location = {
						OR = {
							terrain = desert
							terrain = mountain
							terrain = arctic
							is_winter = yes
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
			scaled_wealth = { value = -0.015 min = -1 max = -15 } #terrain bonus
		}
		if = {
			limit = { FROM = { owner = { war = yes } } }
			custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
			scaled_wealth = { value = -0.025 min = -2 max = -25 } #war bonus
		}
		if = {
			limit = { 
				FROM = { 
					owner = {
						or = {
							has_character_modifier = guilds_buff_feast
							has_character_modifier = fabulous_feast
							has_character_modifier = holding_large_feast
							has_character_modifier = holding_diwali_feast 
							has_character_modifier = holding_kali_puja_feast
							has_character_modifier = holding_zun_feast
							has_character_flag = holding_blot
							has_character_flag = holding_ukon_juhla
							has_character_flag = holding_uzgavenes
							has_character_flag = holding_jarilo
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_festivitie_tooltip }
			scaled_wealth = { value = -0.02 min = -2 max = -20 } #festivitie bonus
		}
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 0.025
					wealth = 10
				}
			}
		}
	}
	option = { #Dont
		name = EVTOPTB_SNW_1900
		add_society_currency_trivial_effect = yes
	}
}

#Caravan lumber
character_event = {
    id = SNW.1907
	desc = EVTDESC_SNW_1907
	picture = GFX_evt_merchant_caravan
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #Buy
		name = EVTOPTA_SNW_1900
		add_artifact = guilds_item_lumber
		custom_tooltip = { text = guilds_item_lumber_tooltip }
		scaled_wealth = { value = -0.15 min = -15 max = -150 }
					if = {
						limit = { FROM = { location = { has_settlement_construction = yes } } }
						custom_tooltip = { text = guilds_goods_bonus_construction_tooltip }
						scaled_wealth = { value = -0.075 min = -7 max = -75 } #construction bonus
					}
					if = {
						limit = {
							FROM = { 
								location = {
									OR = {
										terrain = jungle
										terrain = forest
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = 0.05 min = 5 max = 50 } #terrain malus
					}
					if = {
						limit = {
							FROM = { 
								location = {
									OR = {
										terrain = desert
										terrain = steppe
									}
								}
							}
						}
						custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
						scaled_wealth = { value = -0.05 min = -5 max = -50 } #terrain bonus
					}
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 0.15
					wealth = 15
				}
			}
		}
	}
	option = { #Dont
		name = EVTOPTB_SNW_1900
		add_society_currency_trivial_effect = yes
	}
}

#Caravan linen
character_event = {
    id = SNW.1908
	desc = EVTDESC_SNW_1908
	picture = GFX_evt_merchant_caravan
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #Buy
		name = EVTOPTA_SNW_1900
		add_artifact = guilds_item_linen
		custom_tooltip = { text = guilds_item_linen_tooltip }
		scaled_wealth = { value = -0.27 min = -27 max = -275 }
		if = {
			limit = { FROM = { location = { has_province_modifier = guilds_buff_dye } } }
			custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
			scaled_wealth = { value = -0.10 min = -10 max = -100 } #goods bonus
		}
		if = {
			limit = { 
				has_dlc = "Reapers"
				FROM = { 
					location = { 
						OR = {
							has_province_modifier = prosperity_modifier_2
							has_province_modifier = prosperity_modifier_3
						}
					} 
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity bonus
		}
		if = {
			limit = { 
				has_dlc = "Reapers"
				FROM = { 
					location = {
						OR = {
							has_province_modifier = depopulated_1
							has_province_modifier = depopulated_2
							has_province_modifier = depopulated_3
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity malus
		}
		if = {
			limit = {
				FROM = { 
					location = {
						OR = {
							terrain = farmlands
							terrain = jungle
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
			scaled_wealth = { value = 0.05 min = 5 max = 50 } #terrain malus
		}
		if = {
			limit = {
				FROM = { 
					location = {
						OR = {
							terrain = desert
							terrain = arctic
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
			scaled_wealth = { value = -0.05 min = -5 max = -50 } #terrain bonus
		}
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 0.27
					wealth = 30
				}
			}
		}
	}
	option = { #Dont
		name = EVTOPTB_SNW_1900
		add_society_currency_trivial_effect = yes
	}
}

#Caravan incense
character_event = {
    id = SNW.1909
	desc = EVTDESC_SNW_1909
	picture = GFX_evt_merchant_caravan
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #Buy
		name = EVTOPTA_SNW_1900
		add_artifact = guilds_item_incense
		custom_tooltip = { text = guilds_item_incense_tooltip }
		scaled_wealth = { value = -0.40 min = -40 max = -400 }
		if = {
			limit = { 
				FROM = { 
					owner = { 
						or = {
							has_character_modifier = holding_diwali_feast 
							has_character_modifier = holding_kali_puja_feast
	
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_festivitie_tooltip }
			scaled_wealth = { value = -0.15 min = -15 max = -150 } #festivitie bonus
		}
		if = {
			limit = { FROM ={ location = { has_epidemic = yes } } }
			custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
			scaled_wealth = { value = -0.10 min = -10 max = -100 } #epidemic bonus
		}
		if = {
			limit = {
				FROM = {
					holding_type = temple 
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
			scaled_wealth = { value = -0.1 min = -10 max = -100 } #terrain bonus
		}
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 0.40
					wealth = 40
				}
			}
		}
	}
	option = { #Dont
		name = EVTOPTB_SNW_1900
		add_society_currency_trivial_effect = yes
	}
}

#Caravan spices
character_event = {
    id = SNW.1910
	desc = EVTDESC_SNW_1910
	picture = GFX_evt_merchant_caravan
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #Buy
		name = EVTOPTA_SNW_1900
		add_artifact = guilds_item_spices
		custom_tooltip = { text = guilds_item_spices_tooltip }
		scaled_wealth = { value = -0.525 min = -52 max = -525 }
		if = {
			limit = { 
				has_dlc = "Reapers"
				FROM = {
					location = {
						OR = {
							has_province_modifier = depopulated_1
							has_province_modifier = depopulated_2
							has_province_modifier = depopulated_3
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = 0.20 min = 200 max = 200 } #prosperity malus
		}
		if = {
			limit = { 
				has_dlc = "Reapers"
				FROM = {
					location = {
						OR = {
							has_province_modifier = prosperity_modifier_2
							has_province_modifier = prosperity_modifier_3
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity bonus
		}
		if = {
			limit = { 
				FROM = {
					owner = {
						or = {
							has_character_modifier = guilds_buff_feast
							has_character_modifier = fabulous_feast
							has_character_modifier = holding_large_feast
							has_character_modifier = holding_diwali_feast 
							has_character_modifier = holding_kali_puja_feast
							has_character_modifier = holding_zun_feast
							has_character_flag = holding_blot
							has_character_flag = holding_ukon_juhla
							has_character_flag = holding_uzgavenes
							has_character_flag = holding_jarilo
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_festivitie_tooltip }
			scaled_wealth = { value = -0.05 min = -5 max = -50 } #festivitie bonus
		}
		if = {
			limit = {
				FROM = {
					location = {
						OR = {
							terrain = jungle
							terrain = desert
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
			scaled_wealth = { value = 0.15 min = 15 max = 150 } #terrain malus
		}
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 0.525
					wealth = 60
				}
			}
		}
	}
	option = { #Dont
		name = EVTOPTB_SNW_1900
		add_society_currency_trivial_effect = yes
	}
}

#Caravan meat
character_event = {
    id = SNW.1911
	desc = EVTDESC_SNW_1911
	picture = GFX_evt_merchant_caravan
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #Buy
		name = EVTOPTA_SNW_1900
		add_artifact = guilds_item_meat
		custom_tooltip = { text = guilds_item_meat_tooltip }
		scaled_wealth = { value = -0.025 min = -2 max = -25 }
		if = {
			limit = {
				has_dlc = "Reapers"
				FROM = {
					location = { 
						OR = { 
							has_province_modifier = depopulated_1
							has_province_modifier = depopulated_2
							has_province_modifier = depopulated_3
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = -0.10 min = -10 max = -100 } #prosperity bonus
		}
		if = {
			limit = { FROM = { owner = { war = yes } } }
			custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
			scaled_wealth = { value = -0.025 min = -2 max = -25 } #war bonus
		}
		if = {
			limit = { 
				FROM = {
					owner = {
						or = {
							has_character_modifier = guilds_buff_feast
							has_character_modifier = fabulous_feast
							has_character_modifier = holding_large_feast
							has_character_modifier = holding_diwali_feast 
							has_character_modifier = holding_kali_puja_feast
							has_character_modifier = holding_zun_feast
							has_character_flag = holding_blot
							has_character_flag = holding_ukon_juhla
							has_character_flag = holding_uzgavenes
							has_character_flag = holding_jarilo
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_festivitie_tooltip }
			scaled_wealth = { value = -0.02 min = -2 max = -20 } #festivitie bonus
		}
		if = {
			limit = { FROM = { location = { has_province_modifier = guilds_buff_spices } } }
			custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
			scaled_wealth = { value = -0.02 min = -2 max = -20 } #goods bonus
		}
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 0.025
					wealth = 10
				}
			}
		}
	}
	option = { #Dont
		name = EVTOPTB_SNW_1900
		add_society_currency_trivial_effect = yes
	}
}

#Caravan wool
character_event = {
    id = SNW.1912
	desc = EVTDESC_SNW_1912
	picture = GFX_evt_merchant_caravan
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #Buy
		name = EVTOPTA_SNW_1900
		add_artifact = guilds_item_wool
		custom_tooltip = { text = guilds_item_wool_tooltip }
		scaled_wealth = { value = -0.15 min = -15 max = -150 }
		if = {
			limit = { FROM = { location = { has_province_modifier = guilds_buff_dye } } }
			custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
			scaled_wealth = { value = -0.10 min = -10 max = -100 } #goods bonus
		}
		if = {
			limit = {
				FROM = {
					location = {
						OR = {
							terrain = farmlands
							terrain = plains
							terrain = steppe 
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
			scaled_wealth = { value = 0.05 min = 5 max = 50 } #terrain malus
		}
		if = {
			limit = {
				FROM = {
					location = {
						OR = {
							terrain = arctic
							is_winter = yes
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
			scaled_wealth = { value = -0.1 min = -10 max = -100 } #terrain bonus
		}
		if = {
			limit = { 
				has_dlc = "Reapers"
				FROM = {
				location = { 
						OR = {
							has_province_modifier = prosperity_modifier_2
							has_province_modifier = prosperity_modifier_3
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = 0.05 min = 5 max = 50 } #prosperity malus
		}
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 0.15
					wealth = 15
				}
			}
		}
	}
	option = { #Dont
		name = EVTOPTB_SNW_1900
		add_society_currency_trivial_effect = yes
	}
}

#Caravan hide
character_event = {
    id = SNW.1913
	desc = EVTDESC_SNW_1913
	picture = GFX_evt_merchant_caravan
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #Buy
		name = EVTOPTA_SNW_1900
		add_artifact = guilds_item_hide
		custom_tooltip = { text = guilds_item_hide_tooltip }
		scaled_wealth = { value = -0.27 min = -27 max = -275 }
		if = {
			limit = { FROM = { owner = { war = yes } } }
			custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
			scaled_wealth = { value = -0.1 min = -10 max = -100 } #war bonus
		}
		if = {
			limit = {
				FROM = {
					location = {
						OR = {
							terrain = farmlands
							terrain = plains
							terrain = forest
							terrain = jungle
							terrain = steppe
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
			scaled_wealth = { value = 0.05 min = 5 max = 50 } #terrain malus
		}
		if = {
			limit = { FROM = { location = { has_epidemic = yes } } }
			custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
			scaled_wealth = { value = 0.1 min = 10 max = 100 } #epidemic malus
		}
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 0.27
					wealth = 30
				}
			}
		}
	}
	option = { #Dont
		name = EVTOPTB_SNW_1900
		add_society_currency_trivial_effect = yes
	}
}

#Caravan ivory
character_event = {
    id = SNW.1914
	desc = EVTDESC_SNW_1914
	picture = GFX_evt_merchant_caravan
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #Buy
		name = EVTOPTA_SNW_1900
		add_artifact = guilds_item_ivory
		custom_tooltip = { text = guilds_item_ivory_tooltip }
		scaled_wealth = { value = -0.40 min = -40 max = -400 }
		if = {
			limit = {
				FROM = {
					location = {
						OR = {
							terrain = jungle
							terrain = arctic
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
			scaled_wealth = { value = 0.1 min = 10 max = 100 } #terrain malus
		}
		if = {
			limit = { 
				has_dlc = "Reapers"
				FROM = {
					location = {
						OR = {
							has_province_modifier = prosperity_modifier_3
							has_province_modifier = prosperity_modifier_2
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = -0.05 min = -5 max = -50 } #prosperity bonus
		}
		if = {
			limit = { 
				has_dlc = "Reapers"
				FROM = {
					location = {
						OR = {
							has_province_modifier = depopulated_1
							has_province_modifier = depopulated_2
							has_province_modifier = depopulated_3
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = 0.10 min = 10 max = 100 } #prosperity malus - changed from 0.3 due to high inverted value
		}
		if = {
			limit = { 
				has_dlc = "Reapers"
				FROM = {
					location = {
						NOR = {
							has_province_modifier = prosperity_modifier_3
							has_province_modifier = prosperity_modifier_2
							has_province_modifier = prosperity_modifier_1
							has_province_modifier = depopulated_1
							has_province_modifier = depopulated_2
							has_province_modifier = depopulated_3
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity malus
		}
		if = {
			limit = { FROM = { location = { has_epidemic = yes } } }
			custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
			scaled_wealth = { value = 0.05 min = 5 max = 50 } #epidemic malus
		}
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 0.40
					wealth = 40
				}
			}
		}
	}
	option = { #Dont
		name = EVTOPTB_SNW_1900
		add_society_currency_trivial_effect = yes
	}
}

#Caravan silk
character_event = {
    id = SNW.1915
	desc = EVTDESC_SNW_1915
	picture = GFX_evt_merchant_caravan
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #Buy
		name = EVTOPTA_SNW_1900
		add_artifact = guilds_item_silk
		custom_tooltip = { text = guilds_item_silk_tooltip }
		scaled_wealth = { value = -0.525 min = -52 max = -525 }
		if = {
			limit = { FROM = { location = { has_province_modifier = guilds_buff_dye } } }
			custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
			scaled_wealth = { value = 0.10 min = 10 max = 100 } #goods bonus
		}
		if = {
			limit = { 
				has_dlc = "Reapers"
				FROM = {
					location = {
						OR = {
							has_province_modifier = prosperity_modifier_3
							has_province_modifier = prosperity_modifier_2
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = 0.05 min = 5 max = 50 } #prosperity bonus
		}
		if = {
			limit = { 
				has_dlc = "Reapers"
				FROM = {
					location = {
						OR = {
							has_province_modifier = depopulated_1
							has_province_modifier = depopulated_2
							has_province_modifier = depopulated_3
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = -0.15 min = -15 max = -150 } #prosperity malus
		}
		if = {
			limit = { 
				has_dlc = "Reapers"
				FROM = {
					location = {
						NOR = {
							has_province_modifier = prosperity_modifier_3
							has_province_modifier = prosperity_modifier_2
							has_province_modifier = prosperity_modifier_1
							has_province_modifier = depopulated_1
							has_province_modifier = depopulated_2
							has_province_modifier = depopulated_3
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity malus
		}
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 0.525
					wealth = 60
				}
			}
		}
	}
	option = { #Dont
		name = EVTOPTB_SNW_1900
		add_society_currency_trivial_effect = yes
	}
}

#Caravan pottery
character_event = {
    id = SNW.1916
	desc = EVTDESC_SNW_1916
	picture = GFX_evt_merchant_caravan
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #Buy
		name = EVTOPTA_SNW_1900
		add_artifact = guilds_item_pottery
		custom_tooltip = { text = guilds_item_pottery_tooltip }
		scaled_wealth = { value = -0.025 min = -2 max = -25 }
		if = {
			limit = {
				has_dlc = "Reapers"
				FROM = {
					location = { 
						NOR = { 
							has_province_modifier = prosperity_modifier_2
							has_province_modifier = prosperity_modifier_3
							has_province_modifier = depopulated_2
							has_province_modifier = depopulated_3
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = -0.01 min = -1 max = -10 } #prosperity bonus
		}
		if = {
			limit = { 
				FROM = {
					location = { 
						OR = {
							has_province_modifier = guilds_buff_alcohol 
							has_province_modifier = guilds_buff_grain
							has_province_modifier = guilds_buff_meat
						} 
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
			scaled_wealth = { value = -0.015 min = -1 max = -15 } #goods bonus
		}
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 0.025
					wealth = 10
				}
			}
		}
	}
	option = { #Dont
		name = EVTOPTB_SNW_1900
		add_society_currency_trivial_effect = yes
	}
}

#Caravan alcohol
character_event = {
    id = SNW.1917
	desc = EVTDESC_SNW_1917
	picture = GFX_evt_merchant_caravan
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #Buy
		name = EVTOPTA_SNW_1900
		add_artifact = guilds_item_alcohol
		custom_tooltip = { text = guilds_item_alcohol_tooltip }
		scaled_wealth = { value = -0.15 min = -15 max = -150 }
		if = {
			limit = {
				has_dlc = "Reapers"
				FROM = {
					location = { 
						OR = {
							has_province_modifier = prosperity_modifier_1
							has_province_modifier = prosperity_modifier_2
							has_province_modifier = prosperity_modifier_3
							has_province_modifier = depopulated_2
							has_province_modifier = depopulated_3
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = -0.05 min = -5 max = -50 } #prosperity bonus
		}
		if = {
			limit = {
				has_dlc = "Reapers"
				FROM = {
					location = { 
						OR = {
							has_province_modifier = depopulated_1
							has_province_modifier = depopulated_2
							has_province_modifier = depopulated_3
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity bonus
		}
		if = {
			limit = { FROM = { owner = { war = yes } } }
			custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
			scaled_wealth = { value = -0.075 min = -7 max = -75 } #war bonus
		}
		if = { limit = { FROM = { location = { is_winter = yes } } }
			custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
			scaled_wealth = { value = -0.1 min = -10 max = -100 } #terrain bonus
		}
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 0.15
					wealth = 15
				}
			}
		}
	}
	option = { #Dont
		name = EVTOPTB_SNW_1900
		add_society_currency_trivial_effect = yes
	}
}

#Caravan armor
character_event = {
    id = SNW.1918
	desc = EVTDESC_SNW_1918
	picture = GFX_evt_merchant_caravan
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #Buy
		name = EVTOPTA_SNW_1900
		add_artifact = guilds_item_armor
		custom_tooltip = { text = guilds_item_armor_tooltip }
		scaled_wealth = { value = -0.27 min = -27 max = -275 }
		if = {
			limit = { FROM = { owner = { war = yes } } }
			custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
			scaled_wealth = { value = -0.20 min = -20 max = -200 } #At war bonus
		}
		if = {
			limit = { FROM = { owner = { war = no } } }
 			custom_tooltip = { text = guilds_goods_bonus_war_tooltip }
			scaled_wealth = { value = 0.10 min = 10 max = 100 } #At war malus
		}
		if = {
			limit = {
				FROM = {
					owner = {
						or = {
							has_character_flag = tournament_begins
							has_character_flag = tournament_begins_furusiyya
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_festivitie_tooltip }
			scaled_wealth = { value = 0.1 min = 1 max = 100 } #festivitie bonus
		}
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 0.27
					wealth = 30
				}
			}
		}
	}
	option = { #Dont
		name = EVTOPTB_SNW_1900
		add_society_currency_trivial_effect = yes
	}
}

#Caravan jewelry
character_event = {
    id = SNW.1919
	desc = EVTDESC_SNW_1919
	picture = GFX_evt_merchant_caravan
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #Buy
		name = EVTOPTA_SNW_1900
		add_artifact = guilds_item_jewelry
		custom_tooltip = { text = guilds_item_jewelry_tooltip }
		scaled_wealth = { value = -0.40 min = -40 max = -400 }
		if = { 
			limit = { 
				has_dlc = "Reapers"
				FROM = {
					location = { 
						has_province_modifier = prosperity_modifier_1
					}
				} 
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = -0.05 min = -5 max = -50 } #prosperity bonus
		}
		if = { 
			limit = { 
				has_dlc = "Reapers"
				FROM = {
					location = { 
						OR = {
							has_province_modifier = prosperity_modifier_3
							has_province_modifier = prosperity_modifier_2
						}
					} 
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity bonus
		}
		if = {
			limit = { 
				has_dlc = "Reapers"
				FROM = {
					location = {
						OR = {
							has_province_modifier = depopulated_1
							has_province_modifier = depopulated_2
							has_province_modifier = depopulated_3
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = 0.2 min = 20 max = 200 } #prosperity malus
		}
		if = {
			limit = { 
				FROM = {
					location = { 
						OR = {
							has_province_modifier = guilds_buff_gem
							has_province_modifier = guilds_buff_silver 
							has_province_modifier = guilds_buff_gold 
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
			scaled_wealth = { value = 0.1 min = 10 max = 100 } #goods malus
		}
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 0.40
					wealth = 40
				}
			}
		}
	}
	option = { #Dont
		name = EVTOPTB_SNW_1900
		add_society_currency_trivial_effect = yes
	}
}

#Caravan book
character_event = {
    id = SNW.1920
	desc = EVTDESC_SNW_1920
	picture = GFX_evt_merchant_caravan
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #Buy
		name = EVTOPTA_SNW_1900
		add_artifact = guilds_item_book
		custom_tooltip = { text = guilds_item_book_tooltip }
		scaled_wealth = { value = -0.525 min = -52 max = -525 }
		if = { 
			limit = { 
				has_dlc = "Reapers"
				FROM = {
					location = { 
						has_province_modifier = prosperity_modifier_1
					}
				} 
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = -0.05 min = -5 max = -50 } #prosperity bonus
		}
		if = { 
			limit = { 
				has_dlc = "Reapers"
				FROM = {
					location = { 
						OR = {
							has_province_modifier = prosperity_modifier_3
							has_province_modifier = prosperity_modifier_2
						}
					} 
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity bonus
		}
		if = {
			limit = { 
				has_dlc = "Reapers"
				FROM = {
					location = {
						OR = {
							has_province_modifier = depopulated_1
							has_province_modifier = depopulated_2
							has_province_modifier = depopulated_3
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = 0.2 min = 20 max = 200 } #prosperity malus
		}
		if = {
			limit = {
				FROM = {
					OR = {
						holding_type = temple
						holding_type = city 
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
			scaled_wealth = { value = -0.1 min = -10 max = -100 } #terrain bonus
		}
		if = {
			limit = { 
				FROM = {
					OR = {
						holding_type = tribal
						holding_type = nomad
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
			scaled_wealth = { value = 0.15 min = 15 max = 150 } #terrain malus - changed from 0.3 due to high inverted value
		}
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 0.525
					wealth = 60
				}
			}
		}
	}
	option = { #Dont
		name = EVTOPTB_SNW_1900
		add_society_currency_trivial_effect = yes
	}
}

#Caravan statue
character_event = {
    id = SNW.1921
	desc = EVTDESC_SNW_1921
	picture = GFX_evt_merchant_caravan
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #Buy
		name = EVTOPTA_SNW_1900
		add_artifact = guilds_item_statue
		custom_tooltip = { text = guilds_item_statue_tooltip }
		scaled_wealth = { value = -0.15 min = -15 max = -150 }
		if = {
			limit = { FROM = { location = { has_settlement_construction = yes } } }
			custom_tooltip = { text = guilds_goods_bonus_construction_tooltip }
			scaled_wealth = { value = -0.05 min = -5 max = -50 } #construction bonus
		}
		if = { 
			limit = { 
				has_dlc = "Reapers"
				FROM = {
					location = { 
						has_province_modifier = prosperity_modifier_1
					} 
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = -0.05 min = -5 max = -50 } #prosperity bonus
		}
		if = { 
			limit = { 
				has_dlc = "Reapers"
				FROM = {
					location = { 
						has_province_modifier = prosperity_modifier_2
					} 
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity bonus
		}
		if = { 
			limit = { 
				has_dlc = "Reapers"
				FROM = {
					location = { 
						has_province_modifier = prosperity_modifier_3
					} 
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = -0.15 min = -15 max = 150 } #prosperity bonus
		}
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 0.15
					wealth = 15
				}
			}
		}
	}
	option = { #Dont
		name = EVTOPTB_SNW_1900
		add_society_currency_trivial_effect = yes
	}
}

#Caravan music
character_event = {
    id = SNW.1922
	desc = EVTDESC_SNW_1922
	picture = GFX_evt_merchant_caravan
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #Buy
		name = EVTOPTA_SNW_1900
		add_artifact = guilds_item_music
		custom_tooltip = { text = guilds_item_music_tooltip }
		scaled_wealth = { value = -0.40 min = -40 max = -400 }
		if = {
			limit = { 
				FROM = { 
					owner = {
						or = {
							has_character_modifier = guilds_buff_feast
							has_character_modifier = fabulous_feast
							has_character_modifier = holding_large_feast
							has_character_modifier = holding_diwali_feast 
							has_character_modifier = holding_kali_puja_feast
							has_character_modifier = holding_zun_feast
							has_character_flag = holding_blot
							has_character_flag = holding_ukon_juhla
							has_character_flag = holding_uzgavenes
							has_character_flag = holding_jarilo
							has_character_modifier = holding_summer_fair
							has_character_flag = tournament_begins
							has_character_flag = tournament_begins_furusiyya
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_festivitie_tooltip }
			scaled_wealth = { value = -0.15 min = -15 max = -150 } #festivitie bonus
		}
		if = {
			limit = {
				has_dlc = "Reapers"
				FROM = {
					location = { 
						OR = {
							has_province_modifier = depopulated_1
							has_province_modifier = depopulated_2
							has_province_modifier = depopulated_3
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity malus
		}
		if = {
			limit = { FROM = { location = { has_epidemic = yes } } }
			custom_tooltip = { text = guilds_goods_bonus_epidemic_tooltip }
			scaled_wealth = { value = 0.05 min = 5 max = 50 } #epidemic malus
		}
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 0.40
					wealth = 40
				}
			}
		}
	}
	option = { #Dont
		name = EVTOPTB_SNW_1900
		add_society_currency_trivial_effect = yes
	}
}

#Caravan glassware
character_event = {
    id = SNW.1923
	desc = EVTDESC_SNW_1923
	picture = GFX_evt_merchant_caravan
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #Buy
		name = EVTOPTA_SNW_1900
		add_artifact = guilds_item_glassware
		custom_tooltip = { text = guilds_item_glassware_tooltip }
		scaled_wealth = { value = -0.40 min = -40 max = -400 }
		if = {
			limit = { FROM = { location = { has_settlement_construction = yes } } }
			custom_tooltip = { text = guilds_goods_bonus_construction_tooltip }
			scaled_wealth = { value = -0.10 min = -10 max = -100 } #construction bonus
		}
		if = {
			limit = { 
				has_dlc = "Reapers"
				FROM = { 
					location = {
						NOR = {
							has_province_modifier = depopulated_1
							has_province_modifier = depopulated_2
							has_province_modifier = depopulated_3
							has_province_modifier = prosperity_modifier_1
							has_province_modifier = prosperity_modifier_2
							has_province_modifier = prosperity_modifier_3
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = 0.05 min = 5 max = 50 } #prosperity malus
		}
		if = { 
			limit = { 
				has_dlc = "Reapers"
				FROM = { 
					location = { 
						has_province_modifier = prosperity_modifier_2
					} 
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity bonus
		}
		if = { 
			limit = { 
				has_dlc = "Reapers"
				FROM = { 
					location = { 
						has_province_modifier = prosperity_modifier_3
					} 
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = -0.15 min = -15 max = -150 } #prosperity bonus
		}
		if = {
			limit = { 
				has_dlc = "Reapers"
				FROM = { 
					location = {
						OR = {
							has_province_modifier = depopulated_1
							has_province_modifier = depopulated_2
							has_province_modifier = depopulated_3
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = 0.10 min = 10 max = 100 } #prosperity malus
		}
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 0.40
					wealth = 40
				}
			}
		}
	}
	option = { #Dont
		name = EVTOPTB_SNW_1900
		add_society_currency_trivial_effect = yes
	}
}

#Caravan dye
character_event = {
    id = SNW.1924
	desc = EVTDESC_SNW_1924
	picture = GFX_evt_merchant_caravan
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #Buy
		name = EVTOPTA_SNW_1900
		add_artifact = guilds_item_dye
		custom_tooltip = { text = guilds_item_dye_tooltip }
		scaled_wealth = { value = -0.525 min = -52 max = -525 }
		if = {
			limit = { 
				FROM = { 
					owner = {
						OR = {
							has_character_modifier = holding_diwali_feast 
							has_character_modifier = holding_kali_puja_feast
							has_character_modifier = holding_summer_fair
							has_character_flag = tournament_begins
							has_character_flag = tournament_begins_furusiyya
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_festivitie_tooltip }
			scaled_wealth = { value = -0.1 min = -10 max = -100 } #festivitie bonus
		}
		if = {
			limit = {
				has_dlc = "Reapers"
				FROM = {
					location = { 
						OR = {
							has_province_modifier = depopulated_1
							has_province_modifier = depopulated_2
							has_province_modifier = depopulated_3
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = 0.15 min = 15 max = 150 } #prosperity malus
		}
		if = { 
			limit = { 
				has_dlc = "Reapers"
				FROM = {
					location = { 
						OR = {
							has_province_modifier = prosperity_modifier_2
							has_province_modifier = prosperity_modifier_3
						}
					} 
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = -0.05 min = -5 max = -50 } #prosperity bonus
		}
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 0.525
					wealth = 60
				}
			}
		}
	}
	option = { #Dont
		name = EVTOPTB_SNW_1900
		add_society_currency_trivial_effect = yes
	}
}

#Caravan velvet
character_event = {
    id = SNW.1925
	desc = EVTDESC_SNW_1925
	picture = GFX_evt_merchant_caravan
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #Buy
		name = EVTOPTA_SNW_1900
		add_artifact = guilds_item_velvet
		custom_tooltip = { text = guilds_item_velvet_tooltip }
		scaled_wealth = { value = -0.40 min = -40 max = -400 }
		if = {
			limit = { FROM = { location = { has_province_modifier = guilds_buff_dye } } }
			custom_tooltip = { text = guilds_goods_bonus_goods_tooltip }
			scaled_wealth = { value = -0.10 min = -10 max = -100 } #goods bonus
		}
		if = {
			limit = { 
				has_dlc = "Reapers"
				FROM = { 
					location = {
						has_province_modifier = prosperity_modifier_3
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = -0.1 min = -10 max = -100 } #prosperity bonus
		}
		if = {
			limit = { 
				has_dlc = "Reapers"
				FROM = { 
					location = {
						OR = {
							has_province_modifier = depopulated_1
							has_province_modifier = depopulated_2
							has_province_modifier = depopulated_3
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = 0.2 min = 20 max = 200 } #prosperity malus
		}
		if = {
			limit = { 
				has_dlc = "Reapers"
				FROM = { 
					location = {
						NOR = {
							has_province_modifier = prosperity_modifier_3
							has_province_modifier = prosperity_modifier_2
							has_province_modifier = depopulated_1
							has_province_modifier = depopulated_2
							has_province_modifier = depopulated_3
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = 0.1 min = 10 max = 100 } #prosperity malus
		}
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 0.40
					wealth = 40
				}
			}
		}
	}
	option = { #Dont
		name = EVTOPTB_SNW_1900
		add_society_currency_trivial_effect = yes
	}
}

#Caravan fur
character_event = {
    id = SNW.1926
	desc = EVTDESC_SNW_1926
	picture = GFX_evt_merchant_caravan
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #Buy
		name = EVTOPTA_SNW_1900
		add_artifact = guilds_item_fur
		custom_tooltip = { text = guilds_item_fur_tooltip }
		scaled_wealth = { value = -0.40 min = -40 max = -400 }
		if = {
			limit = { FROM = { location = { is_winter = yes } } }
			custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
			scaled_wealth = { value = -0.20 min = -20 max = -200 } #terrain bonus
		}
		if = {
			limit = {
				FROM = { 
					location = {
						OR = {
							terrain = forest
							terrain = arctic
							terrain = steppe 
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_terrain_tooltip }
			scaled_wealth = { value = 0.05 min = 5 max = 50 } #terrain malus
		}
		if = {
			limit = { 
				has_dlc = "Reapers"
				FROM = { 
					location = { 
						has_province_modifier = prosperity_modifier_1
					} 
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = -0.05 min = -5 max = -50 } #prosperity bonus
		}
		if = {
			limit = { 
				has_dlc = "Reapers"
				FROM = { 
					location = { 
						has_province_modifier = prosperity_modifier_2
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = -0.075 min = -7 max =  -75 } #prosperity bonus
		}
		if = {
			limit = { 
				has_dlc = "Reapers"
				FROM = { 
					location = { 
						has_province_modifier = prosperity_modifier_3
					} 
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_prosperity_tooltip }
			scaled_wealth = { value = -0.10 min = -10 max = -100 } #prosperity bonus
		}
		if = {
			limit = { 
				FROM = {
					owner = {
						OR = {
							has_character_flag = holding_blot
							has_character_flag = holding_ukon_juhla
							has_character_flag = holding_uzgavenes
							has_character_flag = holding_jarilo
						}
					}
				}
			}
			custom_tooltip = { text = guilds_goods_bonus_festivitie_tooltip }
			scaled_wealth = { value = -0.05 min = -5 max = -50 } #festivitie bonus
		}
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
		ai_chance = {
			factor = 1

			modifier = {
				factor = 0.1
				NAND = {
					scaled_wealth = 0.40
					wealth = 40
				}
			}
		}
	}
	option = { #Dont
		name = EVTOPTB_SNW_1900
		add_society_currency_trivial_effect = yes
	}
}

#Caravan security Death fix
character_event = {
	id = SNW.195

	hide_window = yes
	
	is_triggered_only = yes
	ai = no
	trigger = {
		any_realm_province = {
			any_province_holding = { 
				owner = { character = ROOT }
				has_holding_modifier = guilds_caravan_escort 
			}
		}
	}

	immediate = {
		any_realm_province = {
			any_province_holding = { 
				limit = { owner = { character = ROOT } }
				remove_holding_modifier = guilds_caravan_escort 
			}
		}
	}
}

#Caravan clr flag
character_event = {
    id = SNW.199
    hide_window = yes
	
	is_triggered_only = yes

	immediate = {
	clr_character_flag = guilds_caravan_investment_large
	clr_character_flag = guilds_caravan_investment_small
	clr_character_flag = guilds_caravan_investment_security
	}
}

#Sell when not in trade league
character_event = {
    id = SNW.200
	# hide_window = yes
	desc = EVTDESC_SNW_200
	picture = GFX_evt_courtiers_talking
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes
	only_rulers = yes
	
	
	trigger = {
		is_inaccessible_trigger = no
		OR = {
			any_artifact = { has_artifact_flag = goods }
			any_artifact = { has_artifact_flag = shop }
		}
		NOT = { society_member_of = the_guilds }
		NOT = { has_character_flag = guilds_never_sell }
	}
	
	immediate = { set_character_flag = guilds_is_using_goods }
	
	
	option = { #sell
		name = EVTOPTA_SNW_200
		scaled_wealth = 0.3
		random_artifact = {
			limit = {
				OR = {
					has_artifact_flag = goods 
					has_artifact_flag = shop
				}
			}
			destroy_artifact = yes
		}
	}
	
	option = { #Don't
		name = EVTOPTB_SNW_200
	}
	
	option = { #Never ask me
		name = EVTOPTC_SNW_200
		set_character_flag = guilds_never_sell
		ai_chance = {
			factor = 0
		}
	}
	
	after = {
		clr_character_flag = guilds_is_using_goods
	}
}

#Sell when not in trade hermetics
character_event = {
    id = SNW.201
	# hide_window = yes
	desc = EVTDESC_SNW_201
	picture = GFX_evt_courtiers_talking
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes
	only_rulers = yes
	
	trigger = {
		is_inaccessible_trigger = no
		any_artifact = { has_artifact_flag = ingredient }
		NOT = { society_member_of = hermetics }
		NOT = { has_character_flag = guilds_never_sell }
	}

	option = { #sell
		name = EVTOPTA_SNW_201
		scaled_wealth = 0.15
		random_artifact = {
			limit = { has_artifact_flag = ingredient }
			destroy_artifact = yes
		}
	}
	
	option = { #Don't
		name = EVTOPTB_SNW_201
	}
	
	option = { #Never ask me
		name = EVTOPTC_SNW_201
		set_character_flag = guilds_never_sell
	}
	
}

#Trader Trait apprentice
character_event = {
    id = SNW.250
	# hide_window = yes
	desc = EVTDESC_SNW_250
	picture = GFX_evt_relaxed_ruler
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #upgrade
		name = EVTOPTA_SNW_250
		add_trait = guilds_trait_apprentice
	}
	
	option = { #Never
		name = EVTOPTB_SNW_250
		set_character_flag = guilds_refuse_traits
		custom_tooltip = { text = EVTOPTB_SNW_250_TT }
		ai_chance = {
			factor = 0
		}
	}
}

#Trader Trait trader
character_event = {
    id = SNW.251
	# hide_window = yes
	desc = EVTDESC_SNW_251
	picture = GFX_evt_relaxed_ruler
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #upgrade
		name = EVTOPTA_SNW_251
		remove_trait = guilds_trait_apprentice
		add_trait = guilds_trait_trader
	}
	
	option = { #Never
		name = EVTOPTB_SNW_251
		set_character_flag = guilds_refuse_traits
		custom_tooltip = { text = EVTOPTB_SNW_250_TT }
		ai_chance = {
			factor = 0
		}
	}
}

#Trader Trait master
character_event = {
    id = SNW.252
	# hide_window = yes
	desc = EVTDESC_SNW_252
	picture = GFX_evt_relaxed_ruler
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #upgrade
		name = EVTOPTA_SNW_252
		remove_trait = guilds_trait_trader
		add_trait = guilds_trait_master
	}
	
	option = { #Never
		name = EVTOPTB_SNW_252
		set_character_flag = guilds_refuse_traits
		custom_tooltip = { text = EVTOPTB_SNW_250_TT }
		ai_chance = {
			factor = 0
		}
	}
}

#Master Trader Start
character_event = { #AI choose a quest or request funds from liege
    id = SNW.260
	hide_window = yes
	
	is_triggered_only = yes

	
	immediate = {
		if = { #stop being the trade master
			limit = {
				OR = {
					liege = { society_member_of = the_guilds }
					NOT = { has_minor_title = title_guilds_master }
				}
				NOT = { liege = { character = ROOT } }
			}
			liege = { character_event = { id = SNW.265 } }
			remove_title = title_guilds_master
			clr_character_flag = guilds_trade_master_flag
			leave_society = yes
			break = yes
		}
		if = { #Set up criminal activities to fence his goods
			limit = {
				NOT = { opinion = { who = liege value = 0 } }
			}
			wealth = 50
			liege = {
				random_demesne_province = {
					random_list = {
						5 = { 
							location = {
								add_province_modifier = { 					
									name = smugglers_ring
									duration = -1
								}
							}
						}
						5 = { 
							location = {
								add_province_modifier = { 					
									name = highway_robber_band
									duration = -1
								}
							}
						}
						5 = { 
							location = {
								add_province_modifier = { 					
									name = thieves_guild
									duration = -1
								}
							}
						}
					}
				}
			}
		}
		if = { #He flee with your goods if he hate you
			limit = {
				NOR = {
					opinion = { who = liege value = -20 }
					any_spouse = { is_ruler = yes }
					has_character_flag = eternal_life_mystic
					has_character_flag = immortal_rival
				}
			}
			any_playable_ruler = {
				limit = {
					is_within_diplo_range = ROOT
					their_opinion = { who = ROOT value = 10 }
					NOT = { character = liege }
				}
				save_event_target_as = new_court
			}
			leave_society = yes
			move_character = event_target:new_court
			any_spouse = {
				# limit = {
					# liege = { character = FROM }
				# }
				move_character = event_target:new_court
			}
			clr_character_flag = guilds_trade_master_flag
			break = yes
		}
		if = { #ask for funds liege -100 yearly
			limit = {
				liege = { NOT = { yearly_income = 100 } }
				liege = { wealth = 80 }
				NOT = { wealth = 50 }
				NOT = { has_character_flag = guilds_trade_master_stop }
			}
			liege = { character_event = { id = SNW.2610 } }
		}
		else_if = { #ask for funds liege 100-500 yearly
			limit = {
				liege = { yearly_income = 100 }
				liege = { NOT = { yearly_income = 500 } }
				liege = { wealth = 200 }
				NOT = { wealth = 125 }
				NOT = { has_character_flag = guilds_trade_master_stop }
			}
			liege = { character_event = { id = SNW.2611 } }
		}
		else_if = { #ask for funds liege 500+ yearly
			limit = {
				liege = { yearly_income = 500 }
				liege = { wealth = 400 }
				NOT = { wealth = 250 }
				NOT = { has_character_flag = guilds_trade_master_stop }
			}
			liege = { character_event = { id = SNW.2612 } }
		}
		random_list = {
			20 = { #Buy
				modifier = {
					factor = 4
					OR = {
						AND = {
							liege = { NOT = { yearly_income = 100 } }
							wealth = 100
						}
						AND = {
							liege = { yearly_income = 100 }
							liege = { NOT = { yearly_income = 500 } }
							wealth = 250
						}
						AND = {
							liege = { yearly_income = 500 }
							wealth = 500
						}
					}
				}
				modifier = {
					factor = 0.5
					any_artifact = { has_artifact_flag = goods }
				}
				modifier = {
					factor = 0.5
					OR = {
						has_character_flag = guilds_trader_master_profit_focus
						has_character_flag = guilds_trader_master_invest_focus
					}
				}
				modifier = {
					factor = 0
					NOT = { wealth = 0 }
				}
				character_event = { id = SNW.262 days = 1 }
			}
			20 = { #Sell
				modifier = {
					factor = 0
					NOT = {
						any_artifact = { has_artifact_flag = goods }
					}
				}
				modifier = {
					factor = 0
					has_character_flag = guilds_trader_master_invest_focus
				}
				modifier = {
					factor = 2
					any_artifact = {
						count = 3
						has_artifact_flag = goods
					}
				}
				character_event = { id = SNW.263 days = 1 }
			}
			20 = { #Spend in liege province
				modifier = {
					factor = 0
					NOT = {
						any_artifact = { has_artifact_flag = goods }
					}
				}
				modifier = {
					factor = 0
					has_character_flag = guilds_trader_master_profit_focus
				}
				modifier = {
					factor = 2
					any_artifact = {
						count = 3
						has_artifact_flag = goods
					}
				}
				character_event = { id = SNW.264 days = 1 }
			}
		}
	}
	after = {
		if = {
			limit = {
				has_minor_title = title_guilds_master
			}
			character_event = { id = SNW.260 days = 180 }
		}
	}
}

#Trade Master Buy
character_event = {
	id = SNW.262
	hide_window = yes
	
	is_triggered_only = yes

	immediate = {
		if = {
			limit = {
				liege = { NOT = { yearly_income = 100 } }
			}
			random_list = {
				20 = {
					wealth = -5
					random_list = {
						25 = { add_artifact = guilds_item_stone }
						25 = { add_artifact = guilds_item_grain }
						25 = { add_artifact = guilds_item_meat }
						25 = { add_artifact = guilds_item_pottery }
					}
				}
				20 = {
					wealth = -30
					random_list = {
						25 = { add_artifact = guilds_item_steel }
						25 = { add_artifact = guilds_item_lumber }
						25 = { add_artifact = guilds_item_wool }
						25 = { add_artifact = guilds_item_alcohol }
					}
				}
				20 = {
					wealth = -55
					random_list = {
						25 = { add_artifact = guilds_item_gem }
						25 = { add_artifact = guilds_item_linen }
						25 = { add_artifact = guilds_item_hide }
						25 = { add_artifact = guilds_item_armor }
					}
				}
				20 = {
					wealth = -80
					random_list = {
						25 = { add_artifact = guilds_item_silver }
						25 = { add_artifact = guilds_item_incense }
						25 = { add_artifact = guilds_item_ivory }
						25 = { add_artifact = guilds_item_jewelry }
					}
				}
				20 = {
					wealth = -105
					random_list = {
						25 = { add_artifact = guilds_item_gold }
						25 = { add_artifact = guilds_item_spices }
						25 = { add_artifact = guilds_item_silk }
						25 = { add_artifact = guilds_item_book }
					}
				}
			}
		}
		if = {
			limit = {
				liege = { yearly_income = 100 }
				liege = { NOT = { yearly_income = 500 } }
			}
			random_list = {
				20 = {
					wealth = -15
					random_list = {
						25 = { add_artifact = guilds_item_stone }
						25 = { add_artifact = guilds_item_grain }
						25 = { add_artifact = guilds_item_meat }
						25 = { add_artifact = guilds_item_pottery }
					}
				}
				20 = {
					wealth = -90
					random_list = {
						25 = { add_artifact = guilds_item_steel }
						25 = { add_artifact = guilds_item_lumber }
						25 = { add_artifact = guilds_item_wool }
						25 = { add_artifact = guilds_item_alcohol }
					}
				}
				20 = {
					wealth = -165
					random_list = {
						25 = { add_artifact = guilds_item_gem }
						25 = { add_artifact = guilds_item_linen }
						25 = { add_artifact = guilds_item_hide }
						25 = { add_artifact = guilds_item_armor }
					}
				}
				20 = {
					wealth = -240
					random_list = {
						25 = { add_artifact = guilds_item_silver }
						25 = { add_artifact = guilds_item_incense }
						25 = { add_artifact = guilds_item_ivory }
						25 = { add_artifact = guilds_item_jewelry }
					}
				}
				20 = {
					wealth = -315
					random_list = {
						25 = { add_artifact = guilds_item_gold }
						25 = { add_artifact = guilds_item_spices }
						25 = { add_artifact = guilds_item_silk }
						25 = { add_artifact = guilds_item_book }
					}
				}
			}
		}
		if = {
			limit = {
				liege = { yearly_income = 500 }
			}
			random_list = {
				20 = {
					wealth = -25
					random_list = {
						25 = { add_artifact = guilds_item_stone }
						25 = { add_artifact = guilds_item_grain }
						25 = { add_artifact = guilds_item_meat }
						25 = { add_artifact = guilds_item_pottery }
					}
				}
				20 = {
					wealth = -150
					random_list = {
						25 = { add_artifact = guilds_item_steel }
						25 = { add_artifact = guilds_item_lumber }
						25 = { add_artifact = guilds_item_wool }
						25 = { add_artifact = guilds_item_alcohol }
					}
				}
				20 = {
					wealth = -275
					random_list = {
						25 = { add_artifact = guilds_item_gem }
						25 = { add_artifact = guilds_item_linen }
						25 = { add_artifact = guilds_item_hide }
						25 = { add_artifact = guilds_item_armor }
					}
				}
				20 = {
					wealth = -400
					random_list = {
						25 = { add_artifact = guilds_item_silver }
						25 = { add_artifact = guilds_item_incense }
						25 = { add_artifact = guilds_item_ivory }
						25 = { add_artifact = guilds_item_jewelry }
					}
				}
				20 = {
					wealth = -515
					random_list = {
						25 = { add_artifact = guilds_item_gold }
						25 = { add_artifact = guilds_item_spices }
						25 = { add_artifact = guilds_item_silk }
						25 = { add_artifact = guilds_item_book }
					}
				}
			}
		}
	}
}

#Trade Master Sell
character_event = {
	id = SNW.263
	hide_window = yes
	
	is_triggered_only = yes

	immediate = {
		random_list = {
			100 = {
				if = {
					limit = {
						liege = { NOT = { yearly_income = 100 } }
					}
					random_list = {
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_stone
								}
							}
							wealth = 15
							destroy_artifact = guilds_item_stone
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_grain
								}
							}
							wealth = 15
							destroy_artifact = guilds_item_grain
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_meat
								}
							}
							wealth = 15
							destroy_artifact = guilds_item_meat
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_pottery
								}
							}
							wealth = 15
							destroy_artifact = guilds_item_pottery
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_steel
								}
							}
							wealth = 50
							destroy_artifact = guilds_item_steel
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_lumber
								}
							}
							wealth = 50
							destroy_artifact = guilds_item_lumber
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_wool
								}
							}
							wealth = 50
							destroy_artifact = guilds_item_wool
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_alcohol
								}
							}
							wealth = 50
							destroy_artifact = guilds_item_alcohol
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_gem
								}
							}
							wealth = 75
							destroy_artifact = guilds_item_gem
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_linen
								}
							}
							wealth = 75
							destroy_artifact = guilds_item_linen
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_hide
								}
							}
							wealth = 75
							destroy_artifact = guilds_item_hide
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_armor
								}
							}
							wealth = 75
							destroy_artifact = guilds_item_armor
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_silver
								}
							}
							wealth = 100
							destroy_artifact = guilds_item_silver
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_incense
								}
							}
							wealth = 100
							destroy_artifact = guilds_item_incense
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_ivory
								}
							}
							wealth = 100
							destroy_artifact = guilds_item_ivory
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_jewelry
								}
							}
							wealth = 100
							destroy_artifact = guilds_item_jewelry
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_gold
								}
							}
							wealth = 125
							destroy_artifact = guilds_item_gold
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_spices
								}
							}
							wealth = 125
							destroy_artifact = guilds_item_spices
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_silk
								}
							}
							wealth = 125
							destroy_artifact = guilds_item_silk
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_book
								}
							}
							wealth = 125
							destroy_artifact = guilds_item_book
						}
					}
				}
				if = {
					limit = {
						liege = { yearly_income = 100 }
						liege = { NOT = { yearly_income = 500 } }
					}
					random_list = {
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_stone
								}
							}
							wealth = 40
							destroy_artifact = guilds_item_stone
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_grain
								}
							}
							wealth = 40
							destroy_artifact = guilds_item_grain
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_meat
								}
							}
							wealth = 40
							destroy_artifact = guilds_item_meat
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_pottery
								}
							}
							wealth = 40
							destroy_artifact = guilds_item_pottery
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_steel
								}
							}
							wealth = 120
							destroy_artifact = guilds_item_steel
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_lumber
								}
							}
							wealth = 120
							destroy_artifact = guilds_item_lumber
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_wool
								}
							}
							wealth = 120
							destroy_artifact = guilds_item_wool
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_alcohol
								}
							}
							wealth = 120
							destroy_artifact = guilds_item_alcohol
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_gem
								}
							}
							wealth = 200
							destroy_artifact = guilds_item_gem
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_linen
								}
							}
							wealth = 200
							destroy_artifact = guilds_item_linen
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_hide
								}
							}
							wealth = 200
							destroy_artifact = guilds_item_hide
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_armor
								}
							}
							wealth = 200
							destroy_artifact = guilds_item_armor
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_silver
								}
							}
							wealth = 280
							destroy_artifact = guilds_item_silver
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_incense
								}
							}
							wealth = 280
							destroy_artifact = guilds_item_incense
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_ivory
								}
							}
							wealth = 280
							destroy_artifact = guilds_item_ivory
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_jewelry
								}
							}
							wealth = 280
							destroy_artifact = guilds_item_jewelry
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_gold
								}
							}
							wealth = 340
							destroy_artifact = guilds_item_gold
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_spices
								}
							}
							wealth = 340
							destroy_artifact = guilds_item_spices
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_silk
								}
							}
							wealth = 340
							destroy_artifact = guilds_item_silk
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_book
								}
							}
							wealth = 340
							destroy_artifact = guilds_item_book
						}
					}
				}
				if = {
					limit = {
						liege = { yearly_income = 500 }
					}
					random_list = {
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_stone
								}
							}
							wealth = 60
							destroy_artifact = guilds_item_stone
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_grain
								}
							}
							wealth = 60
							destroy_artifact = guilds_item_grain
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_meat
								}
							}
							wealth = 60
							destroy_artifact = guilds_item_meat
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_pottery
								}
							}
							wealth = 60
							destroy_artifact = guilds_item_pottery
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_steel
								}
							}
							wealth = 190
							destroy_artifact = guilds_item_steel
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_lumber
								}
							}
							wealth = 190
							destroy_artifact = guilds_item_lumber
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_wool
								}
							}
							wealth = 190
							destroy_artifact = guilds_item_wool
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_alcohol
								}
							}
							wealth = 190
							destroy_artifact = guilds_item_alcohol
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_gem
								}
							}
							wealth = 310
							destroy_artifact = guilds_item_gem
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_linen
								}
							}
							wealth = 310
							destroy_artifact = guilds_item_linen
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_hide
								}
							}
							wealth = 310
							destroy_artifact = guilds_item_hide
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_armor
								}
							}
							wealth = 310
							destroy_artifact = guilds_item_armor
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_silver
								}
							}
							wealth = 450
							destroy_artifact = guilds_item_silver
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_incense
								}
							}
							wealth = 450
							destroy_artifact = guilds_item_incense
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_ivory
								}
							}
							wealth = 450
							destroy_artifact = guilds_item_ivory
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_jewelry
								}
							}
							wealth = 450
							destroy_artifact = guilds_item_jewelry
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_gold
								}
							}
							wealth = 550
							destroy_artifact = guilds_item_gold
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_spices
								}
							}
							wealth = 550
							destroy_artifact = guilds_item_spices
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_silk
								}
							}
							wealth = 550
							destroy_artifact = guilds_item_silk
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_book
								}
							}
							wealth = 550
							destroy_artifact = guilds_item_book
						}
					}
				}
			}
			100 = {
				modifier = {
					factor = 0
					stewardship = 20
				}
				modifier = {
					factor = 0.4
					stewardship = 17
				}
				modifier = {
					factor = 0.5
					stewardship = 14
				}
				modifier = {
					factor = 0.6
					stewardship = 11
				}
				modifier = {
					factor = 0.7
					stewardship = 8
				}
				modifier = {
					factor = 0.8
					stewardship = 5
				}
				modifier = {
					factor = 0.9
					stewardship = 2
				}
				modifier = {
					factor = 10
					NOT = { stewardship = 1 }
				}
			}
		}
	}
}

#Trade Master Invest
character_event = {
	id = SNW.264
	hide_window = yes
	
	is_triggered_only = yes

	immediate = {
		random_list = {
			100 = {
				if = {
					limit = {
						liege = { NOT = { yearly_income = 100 } }
					}
					random_list = {
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_stone
								}
							}
							wealth = 10
							destroy_artifact = guilds_item_stone
							location = {
								add_province_modifier = {
									name = guilds_buff_stone
									months = 12
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_grain
								}
							}
							wealth = 10
							destroy_artifact = guilds_item_grain
							location = {
								add_province_modifier = {
									name = guilds_buff_grain
									months = 12
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_meat
								}
							}
							wealth = 10
							destroy_artifact = guilds_item_meat
							location = {
								add_province_modifier = {
									name = guilds_buff_meat
									months = 12
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_pottery
								}
							}
							wealth = 10
							destroy_artifact = guilds_item_pottery
							location = {
								add_province_modifier = {
									name = guilds_buff_pottery
									months = 12
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_steel
								}
							}
							wealth = 25
							destroy_artifact = guilds_item_steel
							location = {
								add_province_modifier = {
									name = guilds_buff_steel
									months = 24
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_lumber
								}
							}
							wealth = 25
							destroy_artifact = guilds_item_lumber
							location = {
								add_province_modifier = {
									name = guilds_buff_lumber
									months = 24
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_wool
								}
							}
							wealth = 25
							destroy_artifact = guilds_item_wool
							location = {
								add_province_modifier = {
									name = guilds_buff_wool
									months = 24
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_alcohol
								}
							}
							wealth = 25
							destroy_artifact = guilds_item_alcohol
							location = {
								add_province_modifier = {
									name = guilds_buff_alcohol
									months = 24
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_gem
								}
							}
							wealth = 38
							destroy_artifact = guilds_item_gem
							location = {
								add_province_modifier = {
									name = guilds_buff_gem
									months = 36
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_linen
								}
							}
							wealth = 38
							destroy_artifact = guilds_item_linen
							location = {
								add_province_modifier = {
									name = guilds_buff_linen
									months = 36
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_hide
								}
							}
							wealth = 38
							destroy_artifact = guilds_item_hide
							location = {
								add_province_modifier = {
									name = guilds_buff_hide
									months = 36
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_armor
								}
							}
							wealth = 38
							destroy_artifact = guilds_item_armor
							location = {
								add_province_modifier = {
									name = guilds_buff_armor
									months = 36
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_silver
								}
							}
							wealth = 50
							destroy_artifact = guilds_item_silver
							location = {
								add_province_modifier = {
									name = guilds_buff_silver
									months = 48
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_incense
								}
							}
							wealth = 50
							destroy_artifact = guilds_item_incense
							location = {
								add_province_modifier = {
									name = guilds_buff_incense
									months = 48
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_ivory
								}
							}
							wealth = 50
							destroy_artifact = guilds_item_ivory
							location = {
								add_province_modifier = {
									name = guilds_buff_ivory
									months = 48
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_jewelry
								}
							}
							wealth = 50
							destroy_artifact = guilds_item_jewelry
							location = {
								add_province_modifier = {
									name = guilds_buff_jewelry
									months = 48
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_gold
								}
							}
							wealth = 63
							destroy_artifact = guilds_item_gold
							location = {
								add_province_modifier = {
									name = guilds_buff_gold
									months = 60
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_spices
								}
							}
							wealth = 63
							destroy_artifact = guilds_item_spices
							location = {
								add_province_modifier = {
									name = guilds_buff_spices
									months = 60
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_silk
								}
							}
							wealth = 63
							destroy_artifact = guilds_item_silk
							location = {
								add_province_modifier = {
									name = guilds_buff_silk
									months = 60
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_book
								}
							}
							wealth = 63
							destroy_artifact = guilds_item_book
							location = {
								add_province_modifier = {
									name = guilds_buff_book
									months = 60
								}
							}
						}
					}
				}
				if = {
					limit = {
						liege = { yearly_income = 100 }
						liege = { NOT = { yearly_income = 500 } }
					}
					random_list = {
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_stone
								}
							}
							wealth = 20
							destroy_artifact = guilds_item_stone
							location = {
								add_province_modifier = {
									name = guilds_buff_stone
									months = 12
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_grain
								}
							}
							wealth = 20
							destroy_artifact = guilds_item_grain
							location = {
								add_province_modifier = {
									name = guilds_buff_grain
									months = 12
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_meat
								}
							}
							wealth = 20
							destroy_artifact = guilds_item_meat
							location = {
								add_province_modifier = {
									name = guilds_buff_meat
									months = 12
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_pottery
								}
							}
							wealth = 20
							destroy_artifact = guilds_item_pottery
							location = {
								add_province_modifier = {
									name = guilds_buff_pottery
									months = 12
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_steel
								}
							}
							wealth = 75
							destroy_artifact = guilds_item_steel
							location = {
								add_province_modifier = {
									name = guilds_buff_steel
									months = 24
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_lumber
								}
							}
							wealth = 75
							destroy_artifact = guilds_item_lumber
							location = {
								add_province_modifier = {
									name = guilds_buff_lumber
									months = 24
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_wool
								}
							}
							wealth = 75
							destroy_artifact = guilds_item_wool
							location = {
								add_province_modifier = {
									name = guilds_buff_wool
									months = 24
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_alcohol
								}
							}
							wealth = 75
							destroy_artifact = guilds_item_alcohol
							location = {
								add_province_modifier = {
									name = guilds_buff_alcohol
									months = 24
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_gem
								}
							}
							wealth = 113
							destroy_artifact = guilds_item_gem
							location = {
								add_province_modifier = {
									name = guilds_buff_gem
									months = 36
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_linen
								}
							}
							wealth = 113
							destroy_artifact = guilds_item_linen
							location = {
								add_province_modifier = {
									name = guilds_buff_linen
									months = 36
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_hide
								}
							}
							wealth = 113
							destroy_artifact = guilds_item_hide
							location = {
								add_province_modifier = {
									name = guilds_buff_hide
									months = 36
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_armor
								}
							}
							wealth = 113
							destroy_artifact = guilds_item_armor
							location = {
								add_province_modifier = {
									name = guilds_buff_armor
									months = 36
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_silver
								}
							}
							wealth = 150
							destroy_artifact = guilds_item_silver
							location = {
								add_province_modifier = {
									name = guilds_buff_silver
									months = 48
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_incense
								}
							}
							wealth = 150
							destroy_artifact = guilds_item_incense
							location = {
								add_province_modifier = {
									name = guilds_buff_incense
									months = 48
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_ivory
								}
							}
							wealth = 150
							destroy_artifact = guilds_item_ivory
							location = {
								add_province_modifier = {
									name = guilds_buff_ivory
									months = 48
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_jewelry
								}
							}
							wealth = 150
							destroy_artifact = guilds_item_jewelry
							location = {
								add_province_modifier = {
									name = guilds_buff_jewelry
									months = 48
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_gold
								}
							}
							wealth = 188
							destroy_artifact = guilds_item_gold
							location = {
								add_province_modifier = {
									name = guilds_buff_gold
									months = 60
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_spices
								}
							}
							wealth = 188
							destroy_artifact = guilds_item_spices
							location = {
								add_province_modifier = {
									name = guilds_buff_spices
									months = 60
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_silk
								}
							}
							wealth = 188
							destroy_artifact = guilds_item_silk
							location = {
								add_province_modifier = {
									name = guilds_buff_silk
									months = 60
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_book
								}
							}
							wealth = 188
							destroy_artifact = guilds_item_book
							location = {
								add_province_modifier = {
									name = guilds_buff_book
									months = 60
								}
							}
						}
					}
				}
				if = {
					limit = {
						liege = { yearly_income = 500 }
					}
					random_list = {
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_stone
								}
							}
							wealth = 31
							destroy_artifact = guilds_item_stone
							location = {
								add_province_modifier = {
									name = guilds_buff_stone
									months = 12
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_grain
								}
							}
							wealth = 31
							destroy_artifact = guilds_item_grain
							location = {
								add_province_modifier = {
									name = guilds_buff_grain
									months = 12
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_meat
								}
							}
							wealth = 31
							destroy_artifact = guilds_item_meat
							location = {
								add_province_modifier = {
									name = guilds_buff_meat
									months = 12
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_pottery
								}
							}
							wealth = 31
							destroy_artifact = guilds_item_pottery
							location = {
								add_province_modifier = {
									name = guilds_buff_pottery
									months = 12
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_steel
								}
							}
							wealth = 100
							destroy_artifact = guilds_item_steel
							location = {
								add_province_modifier = {
									name = guilds_buff_steel
									months = 24
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_lumber
								}
							}
							wealth = 100
							destroy_artifact = guilds_item_lumber
							location = {
								add_province_modifier = {
									name = guilds_buff_lumber
									months = 24
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_wool
								}
							}
							wealth = 100
							destroy_artifact = guilds_item_wool
							location = {
								add_province_modifier = {
									name = guilds_buff_wool
									months = 24
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_alcohol
								}
							}
							wealth = 100
							destroy_artifact = guilds_item_alcohol
							location = {
								add_province_modifier = {
									name = guilds_buff_alcohol
									months = 24
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_gem
								}
							}
							wealth = 155
							destroy_artifact = guilds_item_gem
							location = {
								add_province_modifier = {
									name = guilds_buff_gem
									months = 36
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_linen
								}
							}
							wealth = 155
							destroy_artifact = guilds_item_linen
							location = {
								add_province_modifier = {
									name = guilds_buff_linen
									months = 36
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_hide
								}
							}
							wealth = 155
							destroy_artifact = guilds_item_hide
							location = {
								add_province_modifier = {
									name = guilds_buff_hide
									months = 36
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_armor
								}
							}
							wealth = 155
							destroy_artifact = guilds_item_armor
							location = {
								add_province_modifier = {
									name = guilds_buff_armor
									months = 36
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_silver
								}
							}
							wealth = 225
							destroy_artifact = guilds_item_silver
							location = {
								add_province_modifier = {
									name = guilds_buff_silver
									months = 48
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_incense
								}
							}
							wealth = 225
							destroy_artifact = guilds_item_incense
							location = {
								add_province_modifier = {
									name = guilds_buff_incense
									months = 48
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_ivory
								}
							}
							wealth = 225
							destroy_artifact = guilds_item_ivory
							location = {
								add_province_modifier = {
									name = guilds_buff_ivory
									months = 48
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_jewelry
								}
							}
							wealth = 225
							destroy_artifact = guilds_item_jewelry
							location = {
								add_province_modifier = {
									name = guilds_buff_jewelry
									months = 48
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_gold
								}
							}
							wealth = 300
							destroy_artifact = guilds_item_gold
							location = {
								add_province_modifier = {
									name = guilds_buff_gold
									months = 60
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_spices
								}
							}
							wealth = 300
							destroy_artifact = guilds_item_spices
							location = {
								add_province_modifier = {
									name = guilds_buff_spices
									months = 60
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_silk
								}
							}
							wealth = 300
							destroy_artifact = guilds_item_silk
							location = {
								add_province_modifier = {
									name = guilds_buff_silk
									months = 60
								}
							}
						}
						20 = {
							modifier = {
								factor = 0
								NOT = {
									has_artifact = guilds_item_book
								}
							}
							wealth = 300
							destroy_artifact = guilds_item_book
							location = {
								add_province_modifier = {
									name = guilds_buff_book
									months = 60
								}
							}
						}
					}
				}
			}
			100 = {
				modifier = {
					factor = 0
					stewardship = 20
				}
				modifier = {
					factor = 0.4
					stewardship = 17
				}
				modifier = {
					factor = 0.5
					stewardship = 14
				}
				modifier = {
					factor = 0.6
					stewardship = 11
				}
				modifier = {
					factor = 0.7
					stewardship = 8
				}
				modifier = {
					factor = 0.8
					stewardship = 5
				}
				modifier = {
					factor = 0.9
					stewardship = 2
				}
				modifier = {
					factor = 10
					NOT = { stewardship = 1 }
				}
			}
		}
	}
}

#Trade Master Over
character_event = {
    id = SNW.265
	# hide_window = yes
	desc = EVTDESC_SNW_265
	picture = GFX_evt_throne_room
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	trigger = {
		 NOT = { FROM = { character = ROOT } }
	}
	
	option = { #give goods to liege
		name = EVTOPTA_SNW_265
		FROM = {
			any_artifact = {
				limit = {
					has_artifact_flag = goods 
				}
				transfer_artifact = {
					from = FROM
					to = ROOT
				}
			}
		}
		if = {
			limit = {
				FROM = { wealth = 0 }
			}
			wealth = FROM
			FROM = { clear_wealth = yes }
		}
	}
}

#Trade Master dead
character_event = {
    id = SNW.2651
	hide_window = yes
	
	is_triggered_only = yes

	trigger = {
		has_minor_title = title_guilds_master
	}
	
	immediate = { #give goods to liege
		name = EVTOPTA_SNW_265
		any_artifact = {
			limit = {
				has_artifact_flag = goods 
			}
			transfer_artifact = { #forget test and add to over, test warehouse stuff
				from = ROOT
				to = liege
			}
		}
		liege = { wealth = ROOT }
		clear_wealth = yes
	}
}

#Trade Master ask 100
character_event = {
    id = SNW.2610
	desc = EVTDESC_SNW_2610
	picture = GFX_evt_throne_room
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #give 100
		name = EVTOPTA_SNW_2610
		wealth = -100
		from = { wealth = 100 }
		ai_chance = {
			factor = 1
			modifier = {
				factor = 0
				not = { wealth = 200 }
			}
		}
	}
	
	option = { #Not now
		name = EVTOPTB_SNW_2610
	}
	
	option = {
		name = EVTOPTC_SNW_2610
		FROM = { set_character_flag = guilds_trade_master_stop }
		custom_tooltip = { text = guilds_trade_master_stop_tt }
	}
}

#Trade Master ask 250
character_event = {
    id = SNW.2611
	desc = EVTDESC_SNW_2611
	picture = GFX_evt_throne_room
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #give 250
		name = EVTOPTA_SNW_2611
		wealth = -250
		from = { wealth = 250 }
		ai_chance = {
			factor = 1
			modifier = {
				factor = 0
				not = { wealth = 400 }
			}
		}
	}
	
	option = { #Not now
		name = EVTOPTB_SNW_2611
	}
	
	option = {
		name = EVTOPTC_SNW_2610
		FROM = { set_character_flag = guilds_trade_master_stop }
		custom_tooltip = { text = guilds_trade_master_stop_tt }
	}
}

#Trade Master ask 500
character_event = {
    id = SNW.2612
	desc = EVTDESC_SNW_2612
	picture = GFX_evt_throne_room
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #give 500
		name = EVTOPTA_SNW_2612
		wealth = -500
		from = { wealth = 500 }
		ai_chance = {
			factor = 1
			modifier = {
				factor = 0
				not = { wealth = 700 }
			}
		}
	}
	
	option = { #Not now
		name = EVTOPTB_SNW_2612
	}
	
	option = {
		name = EVTOPTC_SNW_2610
		FROM = { set_character_flag = guilds_trade_master_stop }
		custom_tooltip = { text = guilds_trade_master_stop_tt }
	}
}

#Trade Master fake steel/hide shipment removal
character_event = {
	id = SNW.267
	hide_window = yes
	
	is_triggered_only = yes
	
	only_rulers = yes

	immediate = { 
		any_realm_province = {
			# limit = { owner = { character = ROOT } }
			remove_province_modifier = guilds_buff_steel_empty
			remove_province_modifier = guilds_buff_hide_empty
		}	
	}
}

#Trade Master imprisonned
character_event = {
	id = SNW.268
	hide_window = yes
	
	is_triggered_only = yes
	
	trigger = {
		has_minor_title = title_guilds_master 
	}

	immediate = { 
		FROM = { set_character_flag = guilds_traitor }	
		custom_tooltip = { text = guilds_antagonize_trade_league }
	}
}

#Artisans start + food
character_event = { 
    id = SNW.270
	desc = EVTDESC_SNW_270
	picture = GFX_evt_busy_trading_dock_republic
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes
	
	immediate = { set_character_flag = guilds_is_using_goods }
	
	option = { #make alcohol
		name = EVTOPTA_SNW_270
		trigger = {
			society_currency >= 75
			has_artifact = guilds_item_grain
			has_artifact = guilds_item_pottery
		}
		custom_tooltip = { text = guilds_item_alcohol_tooltip }
		character_event = { id = SNW.2700 days = 60 random = 30 }
		change_society_currency = -75
		clr_character_flag = guilds_is_using_goods
		destroy_artifact = guilds_item_grain
		destroy_artifact = guilds_item_pottery
	}
	option = { #make feast
		name = EVTOPTB_SNW_270
		trigger = {
			society_currency >= 75
			has_artifact = guilds_item_meat
			has_artifact = guilds_item_spices
		}
		custom_tooltip = { text = guilds_item_feast_tooltip }
		character_event = { id = SNW.2701 days = 60 random = 30 }
		change_society_currency = -75
		clr_character_flag = guilds_is_using_goods
		destroy_artifact = guilds_item_meat
		destroy_artifact = guilds_item_spices
	}
	option = { #make sheep
		name = EVTOPTC_SNW_270
		trigger = {
			society_currency >= 75
			any_artifact = {
				count = 4
				artifact_type = guilds_item_grain
			}
		}
		custom_tooltip = { text = guilds_grain_sheep_tooltip }
		custom_tooltip = { text = guilds_item_meat_tooltip }
		custom_tooltip = { text = guilds_item_wool_tooltip }
		custom_tooltip = { text = guilds_item_hide_tooltip }
		character_event = { id = SNW.2702 days = 60 random = 30 }
		change_society_currency = -75
		clr_character_flag = guilds_is_using_goods
		destroy_artifact = guilds_item_grain
		destroy_artifact = guilds_item_grain
		destroy_artifact = guilds_item_grain
		destroy_artifact = guilds_item_grain
	}
	option = { #Next to prospector
		name = EVTOPTD_SNW_270
		character_event = { id = SNW.271 }
	}
}

#Artisans prospect
character_event = {
    id = SNW.271
	desc = EVTDESC_SNW_271
	picture = GFX_evt_busy_trading_dock_republic
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #make gem
		name = EVTOPTA_SNW_271
		trigger = {
			society_currency >= 75
			any_artifact = {
				count = 3
				artifact_type = guilds_item_stone
			}
		}
		custom_tooltip = { text = guilds_item_gem_tooltip }
		character_event = { id = SNW.2703 days = 60 random = 30 }
		change_society_currency = -75
		clr_character_flag = guilds_is_using_goods
		destroy_artifact = guilds_item_stone
		destroy_artifact = guilds_item_stone
		destroy_artifact = guilds_item_stone
	}
	option = { #make silver
		name = EVTOPTB_SNW_271
		trigger = {
			society_currency >= 75
			any_artifact = {
				count = 5
				artifact_type = guilds_item_stone
			}
		}
		custom_tooltip = { text = guilds_item_silver_tooltip }
		character_event = { id = SNW.2704 days = 60 random = 30 }
		change_society_currency = -75
		clr_character_flag = guilds_is_using_goods
		destroy_artifact = guilds_item_stone
		destroy_artifact = guilds_item_stone
		destroy_artifact = guilds_item_stone
		destroy_artifact = guilds_item_stone
		destroy_artifact = guilds_item_stone
	}
	option = { #make gold
		name = EVTOPTC_SNW_271
		trigger = {
			society_currency >= 75
			any_artifact = {
				count = 6
				artifact_type = guilds_item_stone
			}
		}
		custom_tooltip = { text = guilds_item_gold_tooltip }
		character_event = { id = SNW.2705 days = 60 random = 30 }
		change_society_currency = -75
		clr_character_flag = guilds_is_using_goods
		destroy_artifact = guilds_item_stone
		destroy_artifact = guilds_item_stone
		destroy_artifact = guilds_item_stone
		destroy_artifact = guilds_item_stone
		destroy_artifact = guilds_item_stone
		destroy_artifact = guilds_item_stone
	}
	option = { #Next to crafter
		name = EVTOPTD_SNW_271
		character_event = { id = SNW.272 }
	}
}

#Artisans crafter
character_event = {
    id = SNW.272
	desc = EVTDESC_SNW_272
	picture = GFX_evt_busy_trading_dock_republic
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #make statue
		name = EVTOPTA_SNW_272
		trigger = {
			society_currency >= 75
			any_artifact = {
				count = 2
				artifact_type = guilds_item_stone
			}
		}
		custom_tooltip = { text = guilds_item_statue_tooltip }
		custom_tooltip = { text = guilds_only_province_tooltip }
		character_event = { id = SNW.2706 days = 60 random = 30 }
		change_society_currency = -75
		clr_character_flag = guilds_is_using_goods
		destroy_artifact = guilds_item_stone
		destroy_artifact = guilds_item_stone
	}
	option = { #make music
		name = EVTOPTB_SNW_272
		trigger = {
			society_currency >= 75
			has_artifact = guilds_item_hide
			has_artifact = guilds_item_lumber
		}
		custom_tooltip = { text = guilds_item_music_tooltip }
		custom_tooltip = { text = guilds_only_province_tooltip }
		character_event = { id = SNW.2707 days = 60 random = 30 }
		change_society_currency = -75
		clr_character_flag = guilds_is_using_goods
		destroy_artifact = guilds_item_lumber
		destroy_artifact = guilds_item_hide
	}
	option = { #make glassware
		name = EVTOPTC_SNW_272
		trigger = {
			society_currency >= 75
			has_artifact = guilds_item_stone
			has_artifact = guilds_item_lumber
			has_artifact = guilds_item_silver
		}
		custom_tooltip = { text = guilds_item_glassware_tooltip }
		custom_tooltip = { text = guilds_only_province_tooltip }
		character_event = { id = SNW.2708 days = 60 random = 30 }
		change_society_currency = -75
		clr_character_flag = guilds_is_using_goods
		destroy_artifact = guilds_item_stone
		destroy_artifact = guilds_item_lumber
		destroy_artifact = guilds_item_silver

	}
	option = { #Next to jeweler
		name = EVTOPTD_SNW_272
		character_event = { id = SNW.273 }
	}
}

#Artisans jeweler
character_event = { 
    id = SNW.273
	desc = EVTDESC_SNW_273
	picture = GFX_evt_busy_trading_dock_republic
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #make jewelry
		name = EVTOPTA_SNW_273
		trigger = {
			society_currency >= 75
			has_artifact = guilds_item_gold
			has_artifact = guilds_item_gem
		}
		custom_tooltip = { text = guilds_item_jewelry_tooltip }
		character_event = { id = SNW.2709 days = 60 random = 30 }
		change_society_currency = -75
		clr_character_flag = guilds_is_using_goods
		destroy_artifact = guilds_item_gem
		destroy_artifact = guilds_item_gold
	}
	option = { #make crown
		name = EVTOPTB_SNW_273
		trigger = {
			OR = {
				has_dlc = "Mystics"
				has_dlc = "Jade Dragon"
			}
			society_currency >= 75
			has_artifact = guilds_item_gold
			has_artifact = guilds_item_silver
		}
		custom_tooltip = { text = guilds_item_crown_tooltip }
		character_event = { id = SNW.2710 days = 60 random = 30 }
		change_society_currency = -75
		clr_character_flag = guilds_is_using_goods
		destroy_artifact = guilds_item_gold
		destroy_artifact = guilds_item_silver
	}
	option = { #make neck/wrist
		name = EVTOPTC_SNW_273
		trigger = {
			OR = {
				has_dlc = "Mystics"
				has_dlc = "Jade Dragon"
			}
			society_currency >= 75
			has_artifact = guilds_item_gold
			has_artifact = guilds_item_jewelry
		}
		custom_tooltip = { text = guilds_item_neck_tooltip }
		character_event = { id = SNW.2711 days = 60 random = 30 }
		change_society_currency = -75
		clr_character_flag = guilds_is_using_goods
		destroy_artifact = guilds_item_gold
		destroy_artifact = guilds_item_jewelry
	}
	option = { #Next to cloth
		name = EVTOPTD_SNW_273
		character_event = { id = SNW.274 }
	}
}

#Artisans cloth
character_event = { 
    id = SNW.274
	desc = EVTDESC_SNW_274
	picture = GFX_evt_busy_trading_dock_republic
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #make dye
		name = EVTOPTA_SNW_274
		trigger = {
			society_currency >= 75
			has_artifact = guilds_item_lumber
			has_artifact = guilds_item_grain
			has_artifact = guilds_item_meat
		}
		custom_tooltip = { text = guilds_item_dye_tooltip }
		character_event = { id = SNW.2712 days = 60 random = 30 }
		change_society_currency = -75
		clr_character_flag = guilds_is_using_goods
		destroy_artifact = guilds_item_lumber
		destroy_artifact = guilds_item_grain
		destroy_artifact = guilds_item_meat
	}
	option = { #make velvet
		name = EVTOPTB_SNW_274
		trigger = {
			society_currency >= 75
			has_artifact = guilds_item_linen
			has_artifact = guilds_item_wool
			has_artifact = guilds_item_silk
		}
		custom_tooltip = { text = guilds_item_velvet_tooltip }
		custom_tooltip = { text = guilds_only_province_tooltip }
		character_event = { id = SNW.2713 days = 60 random = 30 }
		change_society_currency = -75
		clr_character_flag = guilds_is_using_goods
		destroy_artifact = guilds_item_linen
		destroy_artifact = guilds_item_wool
		destroy_artifact = guilds_item_silk
	}
	option = { #fur
		name = EVTOPTC_SNW_274
		trigger = {
			society_currency >= 75
			has_artifact = guilds_item_hide
			has_artifact = guilds_item_lumber
		}
		custom_tooltip = { text = guilds_item_fur_tooltip }
		custom_tooltip = { text = guilds_only_province_tooltip }
		character_event = { id = SNW.2714 days = 60 random = 30 }
		change_society_currency = -75
		clr_character_flag = guilds_is_using_goods
		destroy_artifact = guilds_item_hide
		destroy_artifact = guilds_item_lumber
	}
	option = { #Next to blacksmith
		name = EVTOPTD_SNW_274
		character_event = { id = SNW.275 }
	}
}

#Artisans Blacksmith
character_event = {
    id = SNW.275
	desc = EVTDESC_SNW_275
	picture = GFX_evt_busy_trading_dock_republic
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #make armor
		name = EVTOPTA_SNW_275
		trigger = {
			society_currency >= 75
			OR = {
				has_dlc = "Mystics"
				has_dlc = "Jade Dragon"
			}
			has_artifact = guilds_item_steel
			has_artifact = guilds_item_hide
		}
		custom_tooltip = { text = guilds_item_armor_tooltip }
		custom_tooltip = { text = guilds_item_actualarmor_tooltip }
		character_event = { id = SNW.2715 days = 60 random = 30 }
		change_society_currency = -75
		clr_character_flag = guilds_is_using_goods
		destroy_artifact = guilds_item_steel
		destroy_artifact = guilds_item_hide
	}
	option = { #make weapon
		name = EVTOPTB_SNW_275
		trigger = {
			society_currency >= 75
			OR = {
				has_dlc = "Mystics"
				has_dlc = "Jade Dragon"
			}
			has_artifact = guilds_item_steel
			has_artifact = guilds_item_lumber
		}
		custom_tooltip = { text = guilds_item_armor_tooltip }
		custom_tooltip = { text = guilds_item_weapon_tooltip }
		character_event = { id = SNW.2716 days = 60 random = 30 }
		change_society_currency = -75
		clr_character_flag = guilds_is_using_goods
		destroy_artifact = guilds_item_lumber
		destroy_artifact = guilds_item_steel
	}
	option = { #make ceremonial
		name = EVTOPTC_SNW_275
		trigger = {
			society_currency >= 75
			OR = {
				has_dlc = "Mystics"
				has_dlc = "Jade Dragon"
			}
			has_artifact = guilds_item_steel
			has_artifact = guilds_item_gem
		}
		custom_tooltip = { text = guilds_item_armor_tooltip }
		custom_tooltip = { text = guilds_item_ceremonial_tooltip }
		character_event = { id = SNW.2717 days = 60 random = 30 }
		change_society_currency = -75
		clr_character_flag = guilds_is_using_goods
		destroy_artifact = guilds_item_steel
		destroy_artifact = guilds_item_gem
	}
	option = { #Next book/pot
		name = EVTOPTD_SNW_275
		character_event = { id = SNW.276 }
	}
}

#Artisans book/pottery
character_event = {
    id = SNW.276
	desc = EVTDESC_SNW_276
	picture = GFX_evt_busy_trading_dock_republic
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #make book
		name = EVTOPTA_SNW_276
		trigger = {
			society_currency >= 75
			has_artifact = guilds_item_stone
		}
		custom_tooltip = { text = guilds_item_pottery_tooltip }
		character_event = { id = SNW.2718 days = 60 random = 30 }
		change_society_currency = -75
		scaled_wealth = { value = -0.15 min = -25 max = -150 }
		clr_character_flag = guilds_is_using_goods
		destroy_artifact = guilds_item_stone
	}
	option = { #make pottery
		name = EVTOPTB_SNW_276
		trigger = {
			society_currency >= 75
			any_artifact = {
				count = 2
				artifact_type = guilds_item_hide
			}
		}
		custom_tooltip = { text = guilds_item_book_tooltip }
		character_event = { id = SNW.2719 days = 60 random = 30 }
		change_society_currency = -75
		piety = -100
		clr_character_flag = guilds_is_using_goods
		destroy_artifact = guilds_item_hide
		destroy_artifact = guilds_item_hide
	}
	option = { #return
		name = EVTOPTC_SNW_276
		custom_tooltip = { text = guilds_return_artisans_tt }
		character_event = { id = SNW.270 }
	}
	option = { #Next to nothing
		name = EVTOPTD_SNW_276
		custom_tooltip = { text = guilds_end_artisans_tt }
		# character_event = { id = SNW.275 }
		clr_character_flag = guilds_is_using_goods
	}
}

#Artisans make alcohol
character_event = { 
    id = SNW.2700
	desc = EVTDESC_SNW_2700
	picture = GFX_evt_busy_trading_dock_republic
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_SNW_2700
		add_artifact = guilds_item_alcohol
		add_artifact = guilds_item_alcohol
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
	}
}

#Artisans make feast
character_event = { 
    id = SNW.2701
	desc = EVTDESC_SNW_2701
	picture = GFX_evt_busy_trading_dock_republic
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_SNW_2701
		add_character_modifier = {
			name = guilds_buff_feast
			months = 36
		}
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
	}
}

#Artisans make sheep
character_event = { 
    id = SNW.2702
	desc = EVTDESC_SNW_2702
	picture = GFX_evt_busy_trading_dock_republic
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_SNW_2702
		add_artifact = guilds_item_meat
		add_artifact = guilds_item_wool
		add_artifact = guilds_item_hide
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
	}
}

#Artisans make gem
character_event = { 
    id = SNW.2703
	desc = EVTDESC_SNW_2703
	picture = GFX_evt_busy_trading_dock_republic
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_SNW_2703
		add_artifact = guilds_item_gem
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
	}
}

#Artisans make silver
character_event = { 
    id = SNW.2704
	desc = EVTDESC_SNW_2704
	picture = GFX_evt_busy_trading_dock_republic
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_SNW_2704
		add_artifact = guilds_item_silver
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
	}
}

#Artisans make gold
character_event = { 
    id = SNW.2705
	desc = EVTDESC_SNW_2705
	picture = GFX_evt_busy_trading_dock_republic
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_SNW_2705
		add_artifact = guilds_item_gold
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
	}
}

#Artisans make statue
character_event = { 
    id = SNW.2706
	desc = EVTDESC_SNW_2706
	picture = GFX_evt_busy_trading_dock_republic
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_SNW_2706
		add_artifact = guilds_item_statue
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
	}
}

#Artisans make music
character_event = { 
    id = SNW.2707
	desc = EVTDESC_SNW_2707
	picture = GFX_evt_busy_trading_dock_republic
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_SNW_2707
		add_artifact = guilds_item_music
		add_artifact = guilds_item_music
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
	}
}

#Artisans make glassware
character_event = { 
    id = SNW.2708
	desc = EVTDESC_SNW_2708
	picture = GFX_evt_busy_trading_dock_republic
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_SNW_2708
		add_artifact = guilds_item_glassware
		add_artifact = guilds_item_glassware
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
	}
}

#Artisans make jewelry
character_event = { 
    id = SNW.2709
	desc = EVTDESC_SNW_2709
	picture = GFX_evt_busy_trading_dock_republic
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_SNW_2709
		add_artifact = guilds_item_jewelry
		add_artifact = guilds_item_jewelry
		scaled_wealth = { value = 0.30 min = 30 max = 300 }
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
	}
}

#Artisans make crown
character_event = { 
    id = SNW.2710
	desc = EVTDESC_SNW_2710
	picture = GFX_evt_busy_trading_dock_republic
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_SNW_2710
		random_list = {
			10 = { add_artifact = crown_of_majesty }
			10 = { add_artifact = circlet_of_the_heavens }
			10 = { add_artifact = crown_of_crows }
			10 = { add_artifact = heros_crown }
			10 = { add_artifact = crown_of_pearls }
			10 = { add_artifact = circlet_of_the_heavens }
			10 = { add_artifact = crown_of_the_sea }
			10 = { add_artifact = amber_crown }
			10 = { add_artifact = the_lily_crown }
			10 = { add_artifact = circlet_of_twilight }
			10 = { add_artifact = iron_crown }
			10 = { add_artifact = engraved_crown }
		}
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
	}
}

#Artisans make neck/wirst
character_event = { 
    id = SNW.2711
	desc = EVTDESC_SNW_2711
	picture = GFX_evt_busy_trading_dock_republic
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_SNW_2711
		random_list = {
			10 = { add_artifact = ruby_bracelets }
			10 = { add_artifact = celestial_necklace }
			10 = { add_artifact = golden_bracelets }
			10 = { add_artifact = necklace_of_radiance }
			10 = { add_artifact = collar_of_pearls }
			10 = { add_artifact = silver_bracelets }
		}
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
	}
}

#Artisans make dye
character_event = { 
    id = SNW.2712
	desc = EVTDESC_SNW_2712
	picture = GFX_evt_busy_trading_dock_republic
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_SNW_2712
		add_artifact = guilds_item_dye
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
	}
}

#Artisans make velvet
character_event = { 
    id = SNW.2713
	desc = EVTDESC_SNW_2713
	picture = GFX_evt_busy_trading_dock_republic
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_SNW_2713
		add_artifact = guilds_item_velvet
		add_artifact = guilds_item_velvet
		add_artifact = guilds_item_velvet
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
	}
}

#Artisans make fur
character_event = { 
    id = SNW.2714
	desc = EVTDESC_SNW_2714
	picture = GFX_evt_busy_trading_dock_republic
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_SNW_2714
		add_artifact = guilds_item_fur
		add_artifact = guilds_item_fur
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
	}
}

#Artisans make armor
character_event = { 
    id = SNW.2715
	desc = EVTDESC_SNW_2715
	picture = GFX_evt_busy_trading_dock_republic
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_SNW_2715
		trigger = {
			NOT = { trait = lunatic }
		}
		add_artifact = guilds_item_armor
		random_list = {
			30 = { add_artifact = armor_tier_1 }
			20 = { add_artifact = armor_tier_2 }
			10 = { add_artifact = armor_tier_3_champion }
			10 = { add_artifact = armor_tier_3_warden }
			10 = { add_artifact = armor_tier_3_guardian }
		}
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
	}
	
	option = {
		name = EVTOPTB_SNW_2715
		trigger = {
			trait = lunatic
		}
		add_artifact = guilds_item_armor
		random_list = {
			10 = { add_artifact = armor_tier_1 }
			10 = { add_artifact = armor_tier_2 }
			10 = { add_artifact = armor_tier_3_champion }
			10 = { add_artifact = armor_tier_3_warden }
			10 = { add_artifact = armor_tier_3_guardian }
			10 = { add_artifact = horse_armor_tier_1 }
			10 = { add_artifact = horse_armor_tier_2 }
			10 = { add_artifact = horse_armor_tier_3_ornate_steed }
		}
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
	}
}

#Artisans make weapon
character_event = { 
    id = SNW.2716
	desc = EVTDESC_SNW_2716
	picture = GFX_evt_busy_trading_dock_republic
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_SNW_2716
		add_artifact = guilds_item_armor
		random_list = {
			10 = { add_artifact = sword_tier_3_heartseeker }
			10 = { add_artifact = scimitar_tier_3_golden }
			10 = { add_artifact = lance_tier_3_impaler }
			10 = { add_artifact = axe_tier_3_cleaver }
			10 = { add_artifact = mace_tier_3_foe_hammer }
			10 = { add_artifact = bow_tier_3_silent_wind }
			10 = { add_artifact = sword_tier_3_vengeance }
			10 = { add_artifact = scimitar_tier_3_fortune }
			10 = { add_artifact = lance_tier_3_trident }
			10 = { add_artifact = axe_tier_3_ravager }
			10 = { add_artifact = mace_tier_3_bone_breaker }
			10 = { add_artifact = bow_tier_3_lightning }
			10 = { add_artifact = sword_tier_3_fury }
			10 = { add_artifact = scimitar_tier_3_conquest }
			10 = { add_artifact = lance_tier_3_piercer }
			10 = { add_artifact = axe_tier_3_marauder }
			10 = { add_artifact = mace_tier_3_shatterer }
			10 = { add_artifact = bow_tier_3_eagle }
			10 = { add_artifact = sword_tier_2_new }
			10 = { add_artifact = scimitar_tier_2_new }
			10 = { add_artifact = lance_tier_2_new }
			10 = { add_artifact = axe_tier_2_new }
			10 = { add_artifact = mace_tier_2_new }
			10 = { add_artifact = bow_tier_2_new }
			10 = { add_artifact = sword_tier_1_new }
			10 = { add_artifact = scimitar_tier_1_new }
			10 = { add_artifact = lance_tier_1_new }
			10 = { add_artifact = axe_tier_1_new }
			10 = { add_artifact = mace_tier_1_new }
			10 = { add_artifact = bow_tier_1_new }
		}
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
	}
}

#Artisans make ceremonial
character_event = { 
    id = SNW.2717
	desc = EVTDESC_SNW_2717
	picture = GFX_evt_busy_trading_dock_republic
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_SNW_2717
		add_artifact = guilds_item_armor
		random_list = {
			10 = { add_artifact = sword_of_heroes }
			10 = { add_artifact = dagger_of_glory }
			10 = { add_artifact = staff_of_majesty }
			10 = { add_artifact = axe_of_the_ancestors }
			10 = { add_artifact = emerald_scepter }
			10 = { add_artifact = ruby_scepter }
			10 = { add_artifact = golden_sword }
			10 = { add_artifact = bejeweled_dagger }
			10 = { add_artifact = golden_staff }
			10 = { add_artifact = obsidian_axe }
			10 = { add_artifact = noble_scepter }
			10 = { add_artifact = engraved_sword }
			10 = { add_artifact = engraved_dagger }
			10 = { add_artifact = silver_staff }
			10 = { add_artifact = ceremonial_axe }
		}
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
	}
}

#Artisans make pottery
character_event = { 
    id = SNW.2718
	desc = EVTDESC_SNW_2718
	picture = GFX_evt_busy_trading_dock_republic
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_SNW_2718
		add_artifact = guilds_item_pottery
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
	}
}

#Artisans make book
character_event = { 
    id = SNW.2719
	desc = EVTDESC_SNW_2719
	picture = GFX_evt_busy_trading_dock_republic
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_SNW_2719
		add_artifact = guilds_item_book
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
	}
}

#Intro Tutorial
narrative_event = { 
    id = SNW.280
	title = EVTITLE_SNW_280
	desc = EVTDESC_SNW_280
	picture = GFX_evt_relaxed_ruler
	border = GFX_event_narrative_frame_economy_guilds
	
	is_triggered_only = yes
	
	trigger = {
		NOT = { has_global_flag = the_great_trade_league_active }
	}
	ai = no
	
	option = {
		name = EVTOPTA_SNW_280
		set_global_flag = the_great_trade_league_active
		# set_global_flag = guilds_enabled_trade_master
	}
	# option = { #no trade master
		# name = EVTOPTB_SNW_280
		# set_global_flag = the_great_trade_league_active
		# clr_global_flag = guilds_enabled_trade_master
	# }
	
}

#Intro Fix warehouse to buildings #disabled
character_event  = { 
    id = SNW.281
	hide_window = yes
	
	is_triggered_only = yes
	
	
	trigger = {
		NOT = { has_global_flag = guilds_warehouse_fixed_again }
		is_landed = yes
		is_save_game = yes
	}
	
	immediate = {
		set_global_flag = guilds_warehouse_fixed_again
		IF = {
			limit = { 
				has_artifact = guilds_warehouse_none
			}
			destroy_artifact = guilds_warehouse_none
		}
		IF = {
			limit = { 
				has_artifact = guilds_warehouse_rented
			}
			capital_holding = { 
				trigger_switch = {
					on_trigger = holding_type
					city = { add_building = guilds_warehouse_1_city }
					castle = { add_building = guilds_warehouse_1_castle }
					temple = { add_building = guilds_warehouse_1_temple }
					tribal = { add_building = guilds_warehouse_1_tribal }
					nomad = { add_building = guilds_warehouse_1_nomad }
				}
			}
			destroy_artifact = guilds_warehouse_rented
		}
		IF = {
			limit = {
				OR = {
					has_artifact = guilds_warehouse_custom
					has_artifact = guilds_warehouse_gold
					has_artifact = guilds_warehouse_silk
					has_artifact = guilds_warehouse_book
					has_artifact = guilds_warehouse_incense
				}
			}
			capital_holding = { 
				trigger_switch = {
					on_trigger = holding_type
					city = { add_building = guilds_warehouse_1_city }
					castle = { add_building = guilds_warehouse_1_castle }
					temple = { add_building = guilds_warehouse_1_temple }
					tribal = { add_building = guilds_warehouse_1_tribal }
					nomad = { add_building = guilds_warehouse_1_nomad }
				}
			}
			capital_holding = { 
				trigger_switch = {
					on_trigger = holding_type
					city = { add_building = guilds_warehouse_2_city }
					castle = { add_building = guilds_warehouse_2_castle }
					temple = { add_building = guilds_warehouse_2_temple }
					tribal = { add_building = guilds_warehouse_2_tribal }
					nomad = { add_building = guilds_warehouse_2_nomad }
				}
			}
			destroy_artifact = guilds_warehouse_custom
		}
		IF = {
			limit = {
				has_artifact guilds_warehouse_guard
			}
			capital_holding = { 
				trigger_switch = {
					on_trigger = holding_type
					city = { add_building = guilds_warehouse_1_city }
					castle = { add_building = guilds_warehouse_1_castle }
					temple = { add_building = guilds_warehouse_1_temple }
					tribal = { add_building = guilds_warehouse_1_tribal }
					nomad = { add_building = guilds_warehouse_1_nomad }
				}
			}
			capital_holding = { 
				trigger_switch = {
					on_trigger = holding_type
					city = { add_building = guilds_warehouse_2_city }
					castle = { add_building = guilds_warehouse_2_castle }
					temple = { add_building = guilds_warehouse_2_temple }
					tribal = { add_building = guilds_warehouse_2_tribal }
					nomad = { add_building = guilds_warehouse_2_nomad }
				}
			}
			capital_holding = { 
				trigger_switch = {
					on_trigger = holding_type
					city = { add_building = guilds_warehouse_3_city }
					castle = { add_building = guilds_warehouse_3_castle }
					temple = { add_building = guilds_warehouse_3_temple }
					tribal = { add_building = guilds_warehouse_3_tribal }
					nomad = { add_building = guilds_warehouse_3_nomad }
				}
			}
			destroy_artifact = guilds_warehouse_guard
		}
	}
}

#Destroy extra warehouse
# character_event  = { 
    # id = SNW.282
	# hide_window = yes
	
	# is_triggered_only = yes
	
	# ai = yes	
	
	# trigger = {
		# has_artifact = guilds_warehouse_none
	# }
	
	# immediate = {
		# destroy_artifact = guilds_warehouse_none
		# if = {
			# limit = {
				# any_artifact = { 
					# count = 2
					# has_artifact_flag = warehouse 
				# }
			# }
			# destroy_artifact = guilds_warehouse_rented
		# }
	# }
# }

#Holo SNW.290

############################BAD STUFF###########################

#Looting province + center of trade
character_event = {
    id = SNW.210
	hide_window = yes
	
	is_triggered_only = yes

	trigger = {
		ROOT = { NOT = { society_member_of = the_guilds } }
		OR = {
			FROM = {
				location = {
					OR = {
						has_province_modifier = guilds_buff_stone
						has_province_modifier = guilds_buff_steel
						has_province_modifier = guilds_buff_gem
						has_province_modifier = guilds_buff_silver
						has_province_modifier = guilds_buff_gold
						has_province_modifier = guilds_buff_grain
						has_province_modifier = guilds_buff_lumber
						has_province_modifier = guilds_buff_linen
						has_province_modifier = guilds_buff_incense
						has_province_modifier = guilds_buff_spices
						has_province_modifier = guilds_buff_meat
						has_province_modifier = guilds_buff_wool
						has_province_modifier = guilds_buff_hide
						has_province_modifier = guilds_buff_ivory
						has_province_modifier = guilds_buff_silk
						has_province_modifier = guilds_buff_pottery
						has_province_modifier = guilds_buff_alcohol
						has_province_modifier = guilds_buff_armor
						has_province_modifier = guilds_buff_jewelry
						has_province_modifier = guilds_buff_book
						has_province_modifier = guilds_buff_statue
						has_province_modifier = guilds_buff_music
						has_province_modifier = guilds_buff_glassware
						has_province_modifier = guilds_buff_dye
						has_province_modifier = guilds_buff_velvet
						has_province_modifier = guilds_buff_fur
					}
				}
			}
			FROM = {
				has_holding_modifier = guilds_center_trade 
			}
			FROM = {
				OR = {
					has_building = guilds_warehouse_1_city
					has_building = guilds_warehouse_1_castle
					has_building = guilds_warehouse_1_temple
					has_building = guilds_warehouse_1_tribal
					has_building = guilds_warehouse_1_nomad
					has_building = guilds_warehouse_2_city
					has_building = guilds_warehouse_2_castle
					has_building = guilds_warehouse_2_temple
					has_building = guilds_warehouse_2_tribal
					has_building = guilds_warehouse_2_nomad
					has_building = guilds_warehouse_3_city
					has_building = guilds_warehouse_3_castle
					has_building = guilds_warehouse_3_temple
					has_building = guilds_warehouse_3_tribal
					has_building = guilds_warehouse_3_nomad
				}
			}
		}
	}
	
	immediate = {
		FROM = {
			location = {
				if = {
					limit = {
						has_province_modifier = guilds_buff_stone
					}
						random_list = {
							50 = { 
								ROOT = { add_artifact = guilds_item_stone }
								remove_province_modifier = guilds_buff_stone
							}
							50 = { }
						}
				}
				if = {
					limit = {
						has_province_modifier = guilds_buff_steel
					}
						random_list = {
							50 = { 
								ROOT = { add_artifact = guilds_item_steel }
								remove_province_modifier = guilds_buff_steel
							}
							50 = { }
						}
				}
				if = {
					limit = {
						has_province_modifier = guilds_buff_gem
					}
						random_list = {
							50 = { 
								ROOT = { add_artifact = guilds_item_gem }
								remove_province_modifier = guilds_buff_gem
							}
							50 = { }
						}
				}
				if = {
					limit = {
						has_province_modifier = guilds_buff_silver
					}
						random_list = {
							50 = { 
								ROOT = { add_artifact = guilds_item_silver }
								remove_province_modifier = guilds_buff_silver
							}
							50 = { }
						}
				}
				if = {
					limit = {
						has_province_modifier = guilds_buff_gold
					}
						random_list = {
							50 = { 
								ROOT = { add_artifact = guilds_item_gold }
								remove_province_modifier = guilds_buff_gold
							}
							50 = { }
						}
				}
				if = {
					limit = {
						has_province_modifier = guilds_buff_grain
					}
						random_list = {
							50 = { 
								ROOT = { add_artifact = guilds_item_grain }
								remove_province_modifier = guilds_buff_grain
							}
							50 = { }
						}
				}
				if = {
					limit = {
						has_province_modifier = guilds_buff_lumber
					}
						random_list = {
							50 = { 
								ROOT = { add_artifact = guilds_item_lumber }
								remove_province_modifier = guilds_buff_lumber
							}
							50 = { }
						}
				}
				if = {
					limit = {
						has_province_modifier = guilds_buff_linen
					}
						random_list = {
							50 = { 
								ROOT = { add_artifact = guilds_item_linen }
								remove_province_modifier = guilds_buff_linen
							}
							50 = { }
						}
				}
				if = {
					limit = {
						has_province_modifier = guilds_buff_incense
					}
						random_list = {
							50 = { 
								ROOT = { add_artifact = guilds_item_incense }
								remove_province_modifier = guilds_buff_incense
							}
							50 = { }
						}
				}
				if = {
					limit = {
						has_province_modifier = guilds_buff_spices
					}
						random_list = {
							50 = { 
								ROOT = { add_artifact = guilds_item_spices }
								remove_province_modifier = guilds_buff_spices
							}
							50 = { }
						}
				}
				if = {
					limit = {
						has_province_modifier = guilds_buff_meat
					}
						random_list = {
							50 = { 
								ROOT = { add_artifact = guilds_item_meat }
								remove_province_modifier = guilds_buff_meat
							}
							50 = { }
						}
				}
				if = {
					limit = {
						has_province_modifier = guilds_buff_wool
					}
						random_list = {
							50 = { 
								ROOT = { add_artifact = guilds_item_wool }
								remove_province_modifier = guilds_buff_wool
							}
							50 = { }
						}
				}
				if = {
					limit = {
						has_province_modifier = guilds_buff_hide
					}
						random_list = {
							50 = { 
								ROOT = { add_artifact = guilds_item_hide }
								remove_province_modifier = guilds_buff_hide
							}
							50 = { }
						}
				}
				if = {
					limit = {
						has_province_modifier = guilds_buff_ivory
					}
						random_list = {
							50 = { 
								ROOT = { add_artifact = guilds_item_ivory }
								remove_province_modifier = guilds_buff_ivory
							}
							50 = { }
						}
				}
				if = {
					limit = {
						has_province_modifier = guilds_buff_silk
					}
						random_list = {
							50 = { 
								ROOT = { add_artifact = guilds_item_silk } 
								remove_province_modifier = guilds_buff_silk
							}
							50 = { }
						}
				}
				if = {
					limit = {
						has_province_modifier = guilds_buff_pottery
					}
						random_list = {
							50 = { 
								ROOT = { add_artifact = guilds_item_pottery }
								remove_province_modifier = guilds_buff_pottery
							}
							50 = { }
						}
				}
				if = {
					limit = {
						has_province_modifier = guilds_buff_alcohol
					}
						random_list = {
							50 = { 
								ROOT = { add_artifact = guilds_item_alcohol }
								remove_province_modifier = guilds_buff_alcohol
							}
							50 = { }
						}
				}
				if = {
					limit = {
						has_province_modifier = guilds_buff_armor
					}
						random_list = {
							50 = { 
								ROOT = { add_artifact = guilds_item_armor }
								remove_province_modifier = guilds_buff_armor
							}
							50 = { }
						}
				}
				if = {
					limit = {
						has_province_modifier = guilds_buff_jewelry
					}
						random_list = {
							50 = { 
								ROOT = { add_artifact = guilds_item_jewelry }
								remove_province_modifier = guilds_buff_jewelry
							}
							50 = { }
						}
				}
				if = {
					limit = {
						has_province_modifier = guilds_buff_book
					}
						random_list = {
							50 = { 
								ROOT = { add_artifact = guilds_item_book }
								remove_province_modifier = guilds_buff_book
							}
							50 = { }
						}
				}
				if = {
					limit = {
						has_province_modifier = guilds_buff_statue
					}
						random_list = {
							50 = { 
								ROOT = { add_artifact = guilds_item_statue }
								remove_province_modifier = guilds_buff_statue
							}
							50 = { }
						}
				}
				if = {
					limit = {
						has_province_modifier = guilds_buff_music
					}
						random_list = {
							50 = { 
								ROOT = { add_artifact = guilds_item_music }
								remove_province_modifier = guilds_buff_music
							}
							50 = { }
						}
				}
				if = {
					limit = {
						has_province_modifier = guilds_buff_glassware
					}
						random_list = {
							50 = { 
								ROOT = { add_artifact = guilds_item_glassware }
								remove_province_modifier = guilds_buff_glassware
							}
							50 = { }
						}
				}
				if = {
					limit = {
						has_province_modifier = guilds_buff_dye
					}
						random_list = {
							50 = { 
								ROOT = { add_artifact = guilds_item_dye }
								remove_province_modifier = guilds_buff_dye
							}
							50 = { }
						}
				}
				if = {
					limit = {
						has_province_modifier = guilds_buff_velvet
					}
						random_list = {
							50 = { 
								ROOT = { add_artifact = guilds_item_velvet }
								remove_province_modifier = guilds_buff_velvet
							}
							50 = { }
						}
				}
				if = {
					limit = {
						has_province_modifier = guilds_buff_fur
					}
						random_list = {
							50 = { 
								ROOT = { add_artifact = guilds_item_fur }
								remove_province_modifier = guilds_buff_fur
							}
							50 = { }
						}
				}
			}
		}		
		FROM = {
			if = {
				limit = {
					has_holding_modifier = guilds_center_trade 
				}
				remove_holding_modifier = guilds_center_trade
				add_holding_modifier = {
					name = guilds_center_trade_sieged
					duration = 365
				}
				owner = { character_event = { id = SNW.344 } }
				ROOT = {
					random_list = {
						33 = {
							add_artifact = guilds_item_gem
							add_artifact = guilds_item_incense
							add_artifact = guilds_item_silk
						}
						33 = {
							add_artifact = guilds_item_lumber
							add_artifact = guilds_item_ivory
							add_artifact = guilds_item_gold
						}
						33 = {
							add_artifact = guilds_item_hide
							add_artifact = guilds_item_silver
							add_artifact = guilds_item_spices
						}
					}
				}
			}
		}
		FROM = {
			if = {
				limit = {	
					OR = {
						has_building = guilds_warehouse_1_city
						has_building = guilds_warehouse_1_castle
						has_building = guilds_warehouse_1_temple
						has_building = guilds_warehouse_1_tribal
						has_building = guilds_warehouse_1_nomad
						has_building = guilds_warehouse_2_city
						has_building = guilds_warehouse_2_castle
						has_building = guilds_warehouse_2_temple
						has_building = guilds_warehouse_2_tribal
						has_building = guilds_warehouse_2_nomad
					}
					NOR = {
						has_building = guilds_warehouse_3_city
						has_building = guilds_warehouse_3_castle
						has_building = guilds_warehouse_3_temple
						has_building = guilds_warehouse_3_tribal
						has_building = guilds_warehouse_3_nomad
					}
				}
				random = {
					chance = 30
					owner = { character_event = { id = SNW.212 } }
					remove_building = guilds_warehouse_1_city
					remove_building = guilds_warehouse_1_castle
					remove_building = guilds_warehouse_1_temple
					remove_building = guilds_warehouse_1_tribal
					remove_building = guilds_warehouse_1_nomad
					remove_building = guilds_warehouse_2_city
					remove_building = guilds_warehouse_2_castle
					remove_building = guilds_warehouse_2_temple
					remove_building = guilds_warehouse_2_tribal
					remove_building = guilds_warehouse_2_nomad	
				}
			}
			else_if = {
				limit = {	
					OR = {
						has_building = guilds_warehouse_3_city
						has_building = guilds_warehouse_3_castle
						has_building = guilds_warehouse_3_temple
						has_building = guilds_warehouse_3_tribal
						has_building = guilds_warehouse_3_nomad
					}
				}
				random = {
					chance = 15
					owner = { character_event = { id = SNW.212 }}
					remove_building = guilds_warehouse_1_city
					remove_building = guilds_warehouse_1_castle
					remove_building = guilds_warehouse_1_temple
					remove_building = guilds_warehouse_1_tribal
					remove_building = guilds_warehouse_1_nomad
					remove_building = guilds_warehouse_2_city
					remove_building = guilds_warehouse_2_castle
					remove_building = guilds_warehouse_2_temple
					remove_building = guilds_warehouse_2_tribal
					remove_building = guilds_warehouse_2_nomad	
					remove_building = guilds_warehouse_3_city
					remove_building = guilds_warehouse_3_castle
					remove_building = guilds_warehouse_3_temple
					remove_building = guilds_warehouse_3_tribal
					remove_building = guilds_warehouse_3_nomad
				}
			}
		}
	}
}

#Removing extra looted warehouse
# character_event = {
    # id = SNW.211
	# hide_window = yes
	
	# is_triggered_only = yes

	# trigger = {
		# any_artifact = {
			# count = 2
			# has_artifact_flag = warehouse
		# }
	# }
	
	# immediate = {
		# if = {
			# limit = {
				# any_artifact = {
					# quality = 1
					# has_artifact_flag = warehouse
				# }
				# any_artifact = {
					# quality >= 2
					# has_artifact_flag = warehouse
				# }
			# }
			# random_artifact = {
				# limit = { 
					# has_artifact_flag = warehouse 
					# quality = 1
				# }
			# destroy_artifact = yes
			# }
		# }
		# else_if = {
			# limit = {
				# any_artifact = {
					# quality = 2
					# has_artifact_flag = warehouse
				# }
				# any_artifact = {
					# quality >= 3
					# has_artifact_flag = warehouse
				# }
			# }
			# random_artifact = {
				# limit = { 
					# has_artifact_flag = warehouse 
					# quality = 2
				# }
			# destroy_artifact = yes
			# }
		# }
		# else_if = {
			# limit = {
				# any_artifact = {
					# quality = 3
					# has_artifact_flag = warehouse
				# }
				# any_artifact = {
					# quality >= 4
					# has_artifact_flag = warehouse
				# }
			# }
			# random_artifact = {
				# limit = { 
					# has_artifact_flag = warehouse 
					# quality = 3
				# }
			# destroy_artifact = yes
			# }
		# }
		# else_if = {
			# limit = {
				# any_artifact = {
					# quality = 4
					# has_artifact_flag = warehouse
				# }
				# any_artifact = {
					# quality = 5
					# has_artifact_flag = warehouse
				# }
			# }
			# random_artifact = {
				# limit = { 
					# has_artifact_flag = warehouse 
					# quality = 4
				# }
			# destroy_artifact = yes
			# }
			# scaled_wealth = { value = 1 min = 100 max = 1000 }	
		# }
		# else = { #maybe not optimal
			# random_artifact = {
				# limit = { 
					# has_artifact_flag = warehouse 
					# quality = 5
				# }
			# destroy_artifact = yes
			# }
			# scaled_wealth = { value = 1.50 min = 150 max = 1500 }	
		# }
	# }
# }

#Sieging warehouse
character_event = {
	id = SNW.212
	desc = EVTDESC_SNW_212
	picture = GFX_evt_eavesdropping
	
	notification = yes
	
	is_triggered_only = yes
	# hide_from = yes
	
	option = {
		name = OK 
	}
}

#Thieves guild modifier trigger
character_event = {
    id = SNW.220
	# hide_window = yes
	desc = EVTDESC_SNW_220
	picture = GFX_evt_bandits
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes
	
	only_rulers = yes
	min_age = 16
	capable_only = yes
	prisoner = no
	
	# mean_time_to_happen = { months = 12 }
	
	trigger = {
		any_demesne_province = { has_province_modifier = thieves_guild }
		society_member_of = the_guilds
		NOT = { has_character_modifier = guilds_thieves_guild_cooldown }
	}
	
	immediate = { set_character_flag = guilds_is_using_goods }
	

	option = { #Ignore it
		name = EVTOPTA_SNW_220
		add_character_modifier = {
			name = guilds_thieves_guild
			months = 24
			inherit = yes
		}
	}
	
	option = { #Pay with levy
		name = EVTOPTB_SNW_220
		any_demesne_province = {
			add_province_modifier = {
				name = guilds_thieves_guild_military
				months = 24
			}
		}
	}
	
	option = { #Hire bounty hunters
		name = EVTOPTC_SNW_220
		trigger = { society_currency >= 200 }
		detract_society_currency_minor_effect = yes
		scaled_wealth = { value = -1 min = -100 }
	}
	
	after = {
		add_character_modifier = {
			name = guilds_thieves_guild_cooldown
			months = 24
			hidden = yes
			inherit = yes
		}
		clr_character_flag = guilds_is_using_goods
	}
}

#Thieves guild modifier shopping
character_event = {
    id = SNW.2200
	# hide_window = yes
	desc = EVTDESC_SNW_2200
	picture = GFX_evt_bandits
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes
	immediate = { set_character_flag = guilds_is_using_goods }
	
	option = { #Ignore it
		name = EVTOPTA_SNW_2200
		add_character_modifier = {
			name = guilds_thieves_guild
			months = 24
			inherit = yes
		}
	}
	
	option = { #Pay with levy
		name = EVTOPTB_SNW_2200
		any_demesne_province = {
			add_province_modifier = {
				name = guilds_thieves_guild_military
				months = 24
			}
		}
	}
	
	option = { #Hire bounty hunters
		name = EVTOPTC_SNW_2200
		trigger = { society_currency >= 200 }
		detract_society_currency_minor_effect = yes
		scaled_wealth = { value = -1 min = -100 }
	}
	
	after = {
		add_character_modifier = {
			name = guilds_thieves_guild_cooldown
			months = 24
			hidden = yes
			inherit = yes
		}
		clr_character_flag = guilds_is_using_goods
	}
}

#highway_robber_band trigger
character_event = {
    id = SNW.221
	# hide_window = yes
	desc = EVTDESC_SNW_221
	picture = GFX_evt_bandits
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes
	
	only_rulers = yes
	min_age = 16
	capable_only = yes
	prisoner = no

	# mean_time_to_happen = { months = 12 }
	
	trigger = {
		any_demesne_province = { has_province_modifier = highway_robber_band }
		society_member_of = the_guilds
		NOT = { has_character_modifier = guilds_highway_robber_band_cooldown }
	}
	
	immediate = { set_character_flag = guilds_robber_caravan }

	option = { #Blockaded
		name = EVTOPTA_SNW_221
		add_character_modifier = {
			name = guilds_highway_robber_band
			months = 24
			inherit = yes
		}
	}
	
	option = { #Pay extra for guards
		name = EVTOPTB_SNW_221
		add_character_modifier = {
			name = guilds_highway_robber_band_military
			months = 24
			inherit = yes
		}
		custom_tooltip = { text = EVTOPTB_SNW_221_TT }
	}
	
	option = { #Send them anyways
		name = EVTOPTC_SNW_221
		add_character_modifier = {
			name = guilds_highway_robber_band_dare
			months = 36
			inherit = yes
		}
	}
	
	after = {
		add_character_modifier = {
			name = guilds_highway_robber_band_cooldown
			months = 24
			hidden = yes
			inherit = yes
		}
		clr_character_flag = guilds_robber_caravan
	}
}

#highway_robber_band shopping
character_event = {
    id = SNW.2210
	# hide_window = yes
	desc = EVTDESC_SNW_2210
	picture = GFX_evt_bandits
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes
	
	immediate = { set_character_flag = guilds_robber_caravan }
	
	option = { #Blockaded
		name = EVTOPTA_SNW_2210
		add_character_modifier = {
			name = guilds_highway_robber_band
			months = 24
			inherit = yes
		}
	}
	
	option = { #Pay extra for guards
		name = EVTOPTB_SNW_2210
		add_character_modifier = {
			name = guilds_highway_robber_band_military
			months = 24
			inherit = yes
		}
		custom_tooltip = { text = EVTOPTB_SNW_221_TT }
	}
	
	option = { #Send them anyways
		name = EVTOPTC_SNW_2210
		add_character_modifier = {
			name = guilds_highway_robber_band_dare
			months = 36
			inherit = yes
		}
	}
	
	after = {
		add_character_modifier = {
			name = guilds_highway_robber_band_cooldown
			months = 24
			hidden = yes
			inherit = yes
		}
		clr_character_flag = guilds_robber_caravan
	}
}

#smugglers_ring trigger
character_event = {
    id = SNW.222
	# hide_window = yes
	desc = EVTDESC_SNW_222
	picture = GFX_evt_bandits
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes
	
	only_rulers = yes
	min_age = 16
	capable_only = yes
	prisoner = no

	# mean_time_to_happen = { months = 12 }
	
	trigger = {
		any_demesne_province = { has_province_modifier = smugglers_ring }
		society_member_of = the_guilds
		NOT = { has_character_modifier = guilds_smugglers_ring_cooldown }
	}
	
	immediate = { set_character_flag = guilds_is_using_goods }

	option = { #Free goods!
		name = EVTOPTA_SNW_222
		any_demesne_province = {
			random_list = {
				50 = { }
				50 = {
					add_province_modifier = {
						name = guilds_smugglers_ring_metal
						months = 24
					}
				}
			}
		}
		any_demesne_province = {
			random_list = {
				50 = { }
				50 = {
					add_province_modifier = {
						name = guilds_smugglers_ring_vegetal
						months = 24
					}
				}
			}
		}
		any_demesne_province = {
			random_list = {
				50 = { }
				50 = {
					add_province_modifier = {
						name = guilds_smugglers_ring_animal
						months = 24
					}
				}
			}
		}
		any_demesne_province = {
			random_list = {
				50 = { }
				50 = {
					add_province_modifier = {
						name = guilds_smugglers_ring_final
						months = 24
					}
				}
			}
		}
	}
	
	option = { #Increase the guard
		name = EVTOPTB_SNW_222
		any_demesne_province = {
			add_province_modifier = {
				name = guilds_smugglers_ring_military
				months = 24
			}
		}
	}
	
	after = {
		add_character_modifier = {
			name = guilds_smugglers_ring_cooldown
			months = 24
			hidden = yes
			inherit = yes
		}
		clr_character_flag = guilds_is_using_goods
	}
}

#smugglers_ring shopping
character_event = {
    id = SNW.2220
	# hide_window = yes
	desc = EVTDESC_SNW_2220
	picture = GFX_evt_bandits
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes
	
	immediate = { set_character_flag = guilds_is_using_goods }

	option = { #Free goods!
		name = EVTOPTA_SNW_2220
		any_demesne_province = {
			random_list = {
				50 = { }
				50 = {
					add_province_modifier = {
						name = guilds_smugglers_ring_metal
						months = 24
					}
				}
			}
		}
		any_demesne_province = {
			random_list = {
				50 = { }
				50 = {
					add_province_modifier = {
						name = guilds_smugglers_ring_vegetal
						months = 24
					}
				}
			}
		}
		any_demesne_province = {
			random_list = {
				50 = { }
				50 = {
					add_province_modifier = {
						name = guilds_smugglers_ring_animal
						months = 24
					}
				}
			}
		}
		any_demesne_province = {
			random_list = {
				50 = { }
				50 = {
					add_province_modifier = {
						name = guilds_smugglers_ring_final
						months = 24
					}
				}
			}
		}
	}
	
	option = { #Increase the guard
		name = EVTOPTB_SNW_2220
		any_demesne_province = {
			add_province_modifier = {
				name = guilds_smugglers_ring_military
				months = 24
			}
		}
	}
	
	after = {
		add_character_modifier = {
			name = guilds_smugglers_ring_cooldown
			months = 24
			hidden = yes
			inherit = yes
		}
		clr_character_flag = guilds_is_using_goods
	}
}

#Warehouse thief start trigger
character_event = {
    id = SNW.2300
	hide_window = yes

	is_triggered_only = yes
	
	only_rulers = yes
	min_age = 16
	capable_only = yes
	prisoner = no	

	trigger = {
		any_artifact = {
			has_artifact_flag = goods
		}
		NOT = { has_character_modifier = guilds_warehouse_thief_timer }
		society_member_of = the_guilds
	}
	
	immediate = {
		random_list = {
			100 = { #there's a thief
				modifier = {
					factor = 1.1
					any_artifact = {
						count = 1
						has_artifact_flag = goods
					}
					NOT = {
						any_artifact = {
							count = 2
							has_artifact_flag = goods
						}
					}
				}
				modifier = {
					factor = 1.2
					any_artifact = {
						count = 2
						has_artifact_flag = goods
					}
					NOT = {
						any_artifact = {
							count = 3
							has_artifact_flag = goods
						}
					}
				}
				modifier = {
					factor = 1.3
					any_artifact = {
						count = 3
						has_artifact_flag = goods
					}
					NOT = {
						any_artifact = {
							count = 4
							has_artifact_flag = goods
						}
					}
				}
				modifier = {
					factor = 1.4
					any_artifact = {
						count = 4
						has_artifact_flag = goods
					}
					NOT = {
						any_artifact = {
							count = 5
							has_artifact_flag = goods
						}
					}
				}
				modifier = {
					factor = 1.5
					any_artifact = {
						count = 5
						has_artifact_flag = goods
					}
					NOT = {
						any_artifact = {
							count = 6
							has_artifact_flag = goods
						}
					}
				}
				modifier = {
					factor = 1.6
					any_artifact = {
						count = 6
						has_artifact_flag = goods
					}
				}
				character_event = { id = SNW.230 days = 100 random = 100 }
			}
			200 = { #there's not
				modifier = {
					factor = 1.5
					has_any_warehouse = yes
				}
				modifier = {
					factor = 1.25
					has_safe_warehouse = yes
				}
			}
		}
	}
}

#Warehouse thief
character_event = {
    id = SNW.230
	picture = GFX_evt_stressed_ruler
	border = GFX_event_normal_frame_economy_guilds
	
	desc = {
		trigger = {
			has_no_warehouse = yes
		}
		text = EVTDESC_SNW_230_A
	}
	desc = {
		trigger = { 
			has_any_warehouse = yes
		}
		text = EVTDESC_SNW_230_B
	}
	
	is_triggered_only = yes
	
	immediate = { 
		set_character_flag = guilds_is_using_goods
		add_character_modifier = {
			name = guilds_warehouse_thief_timer
			duration = 1000
			hidden = yes
		}	
	}

	option = { #Intercept yourself no warehouse
		name = EVTOPTA_SNW_230
		trigger = {
			has_no_warehouse = yes
		}
		ai_chance = {
			factor = 0.1
		}
		character_event = { id = SNW.231 }
	}
	option = { #Intercept yourself others
		name = EVTOPTB_SNW_230
		trigger = { 
			has_any_warehouse = yes
		}
		ai_chance = {
			factor = 0.1
		}
		character_event = { id = SNW.232 }
	}
	option = { #Intercept guards
		name = EVTOPTC_SNW_230 
		trigger = { has_safe_warehouse = yes }
		custom_tooltip = { text = EVTOPTC_SNW_230_TT }
	}
	option = { #Ignore it, there is items
		name = EVTOPTD_SNW_230
		trigger = {
			any_artifact = { has_artifact_flag = goods }
		}
		hidden_effect = {
			random_artifact = {
				limit = { has_artifact_flag = goods }
				destroy_artifact = yes
			}
		}
		ai_chance = {
			factor = 0
		}
	}
	option = { #Ignore it its empty
		name = EVTOPTE_SNW_230
		trigger = {
			NOT = { any_artifact = { has_artifact_flag = goods } }
			NOR = {
				has_artifact = guilds_warehouse_gold 
				has_artifact = guilds_warehouse_silk 
				has_artifact = guilds_warehouse_incense 
				has_artifact = guilds_warehouse_book
				has_artifact = guilds_warehouse_guilds
			}
		}
		clr_character_flag = guilds_is_using_goods
		ai_chance = {
			factor = 0
		}
	}
	option = { #Ignore it, woops
		name = EVTOPTF_SNW_230
		trigger = {
			NOT = { any_artifact = { has_artifact_flag = goods } }
			OR = {
				has_artifact = guilds_warehouse_gold 
				has_artifact = guilds_warehouse_silk 
				has_artifact = guilds_warehouse_incense 
				has_artifact = guilds_warehouse_book
				has_artifact = guilds_warehouse_guilds
			}
		}
		character_event = { id = SNW.235 }
		ai_chance = {
			factor = 0
		}
	}
	after = {
		clr_character_flag = guilds_is_using_goods
	}
}

#Warehouse thief no warehouse
character_event = {
    id = SNW.231
	picture = GFX_evt_stressed_ruler
	border = GFX_event_normal_frame_economy_guilds
	
	desc = {
		trigger = { has_character_flag = guilds_thief_child }
		text = EVTDESC_SNW_231_A
	}
	desc = {
		trigger = { has_character_flag = guilds_thief_man }
		text = EVTDESC_SNW_231_B
	}
	desc = {
		trigger = { has_character_flag = guilds_thief_men }
		text = EVTDESC_SNW_231_C
	}
	
	immediate = { 
		set_character_flag = guilds_is_using_goods
		random_list	= {
			20 = {
				set_character_flag = guilds_thief_child
			}
			10 = {
				modifier = {
					factor = 2
					has_character_flag = guilds_doom_child
				}
				modifier = {
					factor = 2
					any_artifact = {
						count = 2
						has_artifact_flag = goods
					}
				}
				set_character_flag = guilds_thief_man
			}
			5 = {
				modifier = {
					factor = 1.5
					has_character_flag = guilds_doom_child
				}  
				modifier = {
					factor = 2
					any_artifact = {
						count = 4
						has_artifact_flag = goods
					}
				}
				set_character_flag = guilds_thief_men
			}
		}
	}
	
	is_triggered_only = yes

	option = { #Catch the child
		name = EVTOPTA_SNW_231
		trigger = { has_character_flag = guilds_thief_child }
		random_list = {
			60 = {
				custom_tooltip = { text = EVTOPTA_SNW_231_TT }
				set_character_flag = guilds_caught_child
				modifier = {
					factor = 1.5
					is_strong_trigger = yes
				}
			}
			40 = { 	
				custom_tooltip = { text = EVTOPTA_SNW_231_TTT } 
				modifier = {
					factor = 1.5
					OR = { 
						has_injury_trigger = yes
						has_disease_trigger = yes
						is_weak_trigger = yes
					}
				}
				modifier = {
					factor = 2
					OR = { 
						has_medium_disability_trigger = yes
						has_severe_disability_trigger = yes
					}
				}
			}
		}
		random_list = {
			70 = { }
			30 = { add_trait_wounded_effect = yes }
		}
		character_event = { id = SNW.2301 }
	}
	option = { #Ignore the kid
		name = EVTOPTB_SNW_231
		trigger = { has_character_flag = guilds_thief_child }
		set_character_flag = guilds_doom_child
		wealth = -1
	}
	option = { #Fight the man
		name = EVTOPTC_SNW_231
		trigger = { has_character_flag = guilds_thief_man }
		random_list = {
			50 = { #hes not armed
				custom_tooltip = { text = EVTOPTC_SNW_231_TT }
				set_character_flag = guilds_man_advantage
			}
			50 = { #he is armed
				custom_tooltip = { text = EVTOPTC_SNW_231_TTT }
			}
		}
		set_character_flag = guilds_man_fight
		clr_character_flag = guilds_doom_child
		character_event = { id = SNW.2302 }
	}
	option = { #Try to sneak
		name = EVTOPTD_SNW_231
		trigger = { has_character_flag = guilds_thief_man }
		random_list = {
			50 = { #good sneak
				custom_tooltip = { text = EVTOPTD_SNW_231_TT }
				set_character_flag = guilds_man_advantage
				modifier = {
					factor = 2
					intrigue = 10
				}
			}
			50 = { #bad sneak
				custom_tooltip = { text = EVTOPTD_SNW_231_TTT }
				modifier = {
					factor = 2
					NOT = { intrigue = 10 }
				}
			}
		}
		set_character_flag = guilds_man_sneak
		character_event = { id = SNW.2302 }
		clr_character_flag = guilds_doom_child
	}
	option = { #Not worth the risk
		name = EVTOPTE_SNW_231
		trigger = { has_character_flag = guilds_thief_man }
		custom_tooltip = { text = EVTOPT_SNW_lose_two_goods }
		hidden_effect = {
			random_artifact = {
				limit = { has_artifact_flag = goods }
				destroy_artifact = yes
			}
			random_artifact = {
				limit = { has_artifact_flag = goods }
				destroy_artifact = yes
			}
		}
		clr_character_flag = guilds_doom_child
	}
	option = { #Fight the men
		name = EVTOPTF_SNW_231
		trigger = { has_character_flag = guilds_thief_men }
		character_event = { id = SNW.2303 }
		clr_character_flag = guilds_doom_child
	}
	option = { #Not worth the risk
		name = EVTOPTG_SNW_231
		trigger = { has_character_flag = guilds_thief_men }
		custom_tooltip = { text = EVTOPT_SNW_lose_three_goods }
		hidden_effect = {
			random_artifact = {
				limit = { has_artifact_flag = goods }
				destroy_artifact = yes
			}
			random_artifact = {
				limit = { has_artifact_flag = goods }
				destroy_artifact = yes
			}
			random_artifact = {
				limit = { has_artifact_flag = goods }
				destroy_artifact = yes
			}
		}
	}
	after = {
		clr_character_flag = guilds_is_using_goods
		clr_character_flag = guilds_thief_child
		clr_character_flag = guilds_thief_man
		clr_character_flag = guilds_thief_men
	}
}

#Warehouse thief has warehouse
character_event = {
    id = SNW.232
	picture = GFX_evt_stressed_ruler
	border = GFX_event_normal_frame_economy_guilds
	
	desc = {
		trigger = { has_character_flag = guilds_thief_child }
		text = EVTDESC_SNW_232_A
	}
	desc = {
		trigger = { has_character_flag = guilds_thief_man }
		text = EVTDESC_SNW_232_B
	}
	desc = {
		trigger = { has_character_flag = guilds_thief_men }
		text = EVTDESC_SNW_232_C
	}
	
	immediate = { 
		set_character_flag = guilds_is_using_goods
		random_list	= {
			20 = {
				set_character_flag = guilds_thief_child
			}
			10 = {
				modifier = {
					factor = 2
					has_character_flag = guilds_doom_child
				}
				modifier = {
					factor = 2
					any_artifact = {
						count = 2
						has_artifact_flag = goods
					}
				}
				set_character_flag = guilds_thief_man
			}
			5 = {
				modifier = {
					factor = 1.5
					has_character_flag = guilds_doom_child
				}  
				modifier = {
					factor = 2
					any_artifact = {
						count = 4
						has_artifact_flag = goods
					}
				}
				set_character_flag = guilds_thief_men
			}
		}
	}
	
	is_triggered_only = yes

	option = { #Catch the child
		name = EVTOPTA_SNW_232
		trigger = { has_character_flag = guilds_thief_child }
		random_list = {
			60 = {
				custom_tooltip = { text = EVTOPTA_SNW_231_TT }
				set_character_flag = guilds_caught_child
				modifier = {
					factor = 1.5
					is_strong_trigger = yes
				}
			}
			40 = { 	
				custom_tooltip = { text = EVTOPTA_SNW_231_TTT } 
				modifier = {
					factor = 1.5
					OR = { 
						has_injury_trigger = yes
						has_disease_trigger = yes
						is_weak_trigger = yes
					}
				}
				modifier = {
					factor = 2
					OR = { 
						has_medium_disability_trigger = yes
						has_severe_disability_trigger = yes
					}
				}
			}
		}
		random_list = {
			70 = { }
			30 = { add_trait_wounded_effect = yes }
		}
		character_event = { id = SNW.2301 }
	}
	option = { #Ignore the kid
		name = EVTOPTB_SNW_232
		trigger = { has_character_flag = guilds_thief_child }
		set_character_flag = guilds_doom_child
		wealth = -1
	}
	option = { #Fight the man
		name = EVTOPTC_SNW_232
		trigger = { has_character_flag = guilds_thief_man }
		random_list = {
			50 = { #hes not armed
				custom_tooltip = { text = EVTOPTC_SNW_231_TT }
				set_character_flag = guilds_man_advantage
			}
			50 = { #he is armed
				custom_tooltip = { text = EVTOPTC_SNW_231_TTT }
			}
		}
		set_character_flag = guilds_man_fight
		character_event = { id = SNW.2302 }
		clr_character_flag = guilds_doom_child
	}
	option = { #Try to sneak
		name = EVTOPTD_SNW_231
		trigger = { has_character_flag = guilds_thief_man }
		random_list = {
			50 = { #good sneak
				custom_tooltip = { text = EVTOPTD_SNW_231_TT }
				set_character_flag = guilds_man_advantage
				modifier = {
					factor = 2
					intrigue = 10
				}
			}
			50 = { #bad sneak
				custom_tooltip = { text = EVTOPTD_SNW_231_TTT }
				modifier = {
					factor = 2
					NOT = { intrigue = 10 }
				}
			}
		}
		set_character_flag = guilds_man_sneak
		character_event = { id = SNW.2302 }
		clr_character_flag = guilds_doom_child
	}
	option = { #Not worth the risk
		name = EVTOPTE_SNW_231
		trigger = { has_character_flag = guilds_thief_man }
		custom_tooltip = { text = EVTOPT_SNW_lose_two_goods }
		hidden_effect = {
			random_artifact = {
				limit = { has_artifact_flag = goods }
				destroy_artifact = yes
			}
			random_artifact = {
				limit = { has_artifact_flag = goods }
				destroy_artifact = yes
			}
		}
		clr_character_flag = guilds_doom_child
	}
	option = { #Fight the men
		name = EVTOPTF_SNW_231
		trigger = { has_character_flag = guilds_thief_men }
		character_event = { id = SNW.2303 }
		clr_character_flag = guilds_doom_child
	}
	option = { #Not worth the risk
		name = EVTOPTG_SNW_231
		trigger = { has_character_flag = guilds_thief_men }
		custom_tooltip = { text = EVTOPT_SNW_lose_three_goods }
		hidden_effect = {
			random_artifact = {
				limit = { has_artifact_flag = goods }
				destroy_artifact = yes
			}
			random_artifact = {
				limit = { has_artifact_flag = goods }
				destroy_artifact = yes
			}
			random_artifact = {
				limit = { has_artifact_flag = goods }
				destroy_artifact = yes
			}
		}
		clr_character_flag = guilds_doom_child
	}
	after = {
		clr_character_flag = guilds_is_using_goods
		clr_character_flag = guilds_thief_child
		clr_character_flag = guilds_thief_man
		clr_character_flag = guilds_thief_men
	}
}

#Warehouse thief woops
character_event = {
    id = SNW.235
	desc = EVTDESC_SNW_235
	picture = GFX_evt_bad_news
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes
	
	immediate = { set_character_flag = guilds_is_using_goods }
	
	option = { #lose warehouse decoration
		name = EVTOPTA_SNW_235
		destroy_artifact = guilds_warehouse_gold
		destroy_artifact = guilds_warehouse_incense
		destroy_artifact = guilds_warehouse_silk
		destroy_artifact = guilds_warehouse_book
		destroy_artifact = guilds_warehouse_guilds
	}
	after = {
		clr_character_flag = guilds_is_using_goods
	}
}

#Warehouse thief kid results
character_event = {
    id = SNW.2301
	picture = GFX_evt_child_bully
	border = GFX_event_normal_frame_economy_guilds
	
	desc = {
		trigger = { has_character_flag = guilds_caught_child }
		text = EVTDESC_SNW_2301_A
	}
	desc = {
		trigger = { NOT = { has_character_flag = guilds_caught_child } }
		text = EVTDESC_SNW_2301_B
	}
	
	immediate = { 
		set_character_flag = guilds_is_using_goods
	}
	
	is_triggered_only = yes

	option = { #Kill the child
		name = EVTOPTA_SNW_2301
		trigger = { has_character_flag = guilds_caught_child }
		random_list = {
			50 = { add_trait_arbitrary_effect = yes }
			50 = { }
		}
	}
	option = { #Let him go
		name = EVTOPTB_SNW_2301
		trigger = { has_character_flag = guilds_caught_child }
		random_list = {
			50 = { add_trait_kind_effect = yes }
			50 = { }
		}
		hidden_effect = {
			random_list = {
				50 = { set_character_flag = guilds_doom_child }
				50 = { }
			}
		}
	}
	option = { #Hand removal
		name = EVTOPTC_SNW_2301
		trigger = { has_character_flag = guilds_caught_child }
		random_list = {
			50 = { add_trait = just }
			50 = { }
		}
		hidden_effect = {
			random_list = {
				50 = { set_character_flag = guilds_doom_child }
				50 = { }
			}
		}
	}
	option = { #Child fleed
		name = EVTOPTD_SNW_2301
		trigger = { NOT = { has_character_flag = guilds_caught_child } }
		set_character_flag = guilds_doom_child
		wealth = -1
	}
	after = {
		clr_character_flag = guilds_is_using_goods
		clr_character_flag = guilds_caught_child
	}
}

#Warehouse thief man results
character_event = {
    id = SNW.2302
	picture = GFX_evt_hiding_from_pursuers
	border = GFX_event_normal_frame_economy_guilds
	
	desc = {
		trigger = { 
			has_character_flag = guilds_man_advantage 
			has_character_flag = guilds_man_fight 
		}
		text = EVTDESC_SNW_2302_A
	}
	desc = {
		trigger = { 
			NOT = { has_character_flag = guilds_man_advantage } 
			has_character_flag = guilds_man_fight 
		}
		text = EVTDESC_SNW_2302_B
	}
	desc = {
		trigger = { 
			has_character_flag = guilds_man_advantage 
			has_character_flag = guilds_man_sneak 
		}
		text = EVTDESC_SNW_2302_C
	}
	desc = {
		trigger = { 
			NOT = { has_character_flag = guilds_man_advantage } 
			has_character_flag = guilds_man_sneak 
		}
		text = EVTDESC_SNW_2302_D
	}
	
	immediate = { 
		set_character_flag = guilds_is_using_goods
	}
	
	is_triggered_only = yes

	option = { #Fight
		name = EVTOPTA_SNW_2302
		trigger = { 
			OR = { 
				has_character_flag = guilds_man_fight 
				AND = {
					has_character_flag = guilds_man_sneak
					NOT = { has_character_flag = guilds_man_advantage }
				}
			}
		}
		random_list = {
			50 = { #win
				modifier = {
					factor = 2
					has_character_flag = guilds_man_advantage
				}
				prestige = 100
				add_society_currency_minor_effect = yes
			}
			50 = { #lose 
				modifier = {
					factor = 0.5
					combat_rating = 40
				}
				modifier = {
					factor = 0.5
					combat_rating = 30
				}
				modifier = {
					factor = 0.5
					combat_rating = 20
				}
				modifier = {
					factor = 0.5
					combat_rating = 10
				}
				modifier = {
					factor = 1.5
					NOT = { combat_rating = 10 }
				}
				modifier = {
					factor = 1.5
					NOT = { combat_rating = 0 }
				}
				if = {
					limit = {
						trait = wounded
					}
					add_trait_severely_injured_effect = yes
				}
				if = {
					limit = {
						NOT  = { trait = wounded }
					}
					add_trait_wounded_effect = yes
				}
				custom_tooltip = { text = EVTOPT_SNW_lose_two_goods }
				hidden_effect = {
					random_artifact = {
						limit = { has_artifact_flag = goods }
						destroy_artifact = yes
					}
					random_artifact = {
						limit = { has_artifact_flag = goods }
						destroy_artifact = yes
					}
				}
				character_event = { id = SNW.236 }
			}
		}
	}
	option = { #Sneak attack
		name = EVTOPTB_SNW_2302
		trigger = { 
			has_character_flag = guilds_man_sneak 
			has_character_flag = guilds_man_advantage
		}
		add_society_currency_minor_effect = yes
	}
	option = { #Flee
		name = EVTOPTC_SNW_2302
		# trigger = { has_character_flag = guilds_man_fight }
		random_list = {
			50 = { add_trait_craven_effect = yes }
			50 = { }
		}
		custom_tooltip = { text = EVTOPT_SNW_lose_two_goods }
		hidden_effect = {
			random_artifact = {
				limit = { has_artifact_flag = goods }
				destroy_artifact = yes
			}
			random_artifact = {
				limit = { has_artifact_flag = goods }
				destroy_artifact = yes
			}
		}
		character_event = { id = SNW.236 }
	}
	after = {
		clr_character_flag = guilds_is_using_goods
		clr_character_flag = guilds_man_fight
		clr_character_flag = guilds_man_sneak
		clr_character_flag = guilds_man_advantage
		clr_character_flag = guilds_doom_child
	}
}

#Warehouse thief men results
character_event = {
    id = SNW.2303
	picture = GFX_evt_eavesdropping
	border = GFX_event_normal_frame_economy_guilds
	
	desc = {
		trigger = { 
			has_character_flag = guilds_men_caught 
		}
		text = EVTDESC_SNW_2303_A
	}
	desc = {
		trigger = { 
			NOT = { has_character_flag = guilds_men_caught } 
		}
		text = EVTDESC_SNW_2303_B
	}
	
	immediate = { 
		set_character_flag = guilds_is_using_goods
		random_list = {
		50 = { set_character_flag = guilds_men_caught }
		50 = {  }
		}
	}
	
	is_triggered_only = yes

	option = { #Fight
		name = EVTOPTA_SNW_2303
		random_list = {
			20 = { #win
				modifier = {
					factor = 2
					NOT = { has_character_flag = guilds_men_caught }
				}
				prestige = 250
				add_society_currency_medium_effect = yes
			}
			100 = { #lose
				modifier = {
					factor = 0.5
					combat_rating = 40
				}
				modifier = {
					factor = 0.5
					combat_rating = 30
				}
				modifier = {
					factor = 0.5
					combat_rating = 20
				}
				modifier = {
					factor = 0.5
					combat_rating = 10
				}
				modifier = {
					factor = 1.5
					NOT = { combat_rating = 10 }
				}
				modifier = {
					factor = 1.5
					NOT = { combat_rating = 0 }
				}
				add_trait_wounded_effect = yes
				custom_tooltip = { text = EVTOPT_SNW_lose_three_goods }
				hidden_effect = {
					random_artifact = {
						limit = { has_artifact_flag = goods }
						destroy_artifact = yes
					}
					random_artifact = {
						limit = { has_artifact_flag = goods }
						destroy_artifact = yes
					}
					random_artifact = {
						limit = { has_artifact_flag = goods }
						destroy_artifact = yes
					}
				}
				character_event = { id = SNW.236 }
			}
		}
	}
	option = { #Flee
		name = EVTOPTB_SNW_2303
		# trigger = { has_character_flag = guilds_man_fight }
		custom_tooltip = { text = EVTOPT_SNW_lose_three_goods }
		hidden_effect = {
			random_artifact = {
				limit = { has_artifact_flag = goods }
				destroy_artifact = yes
			}
			random_artifact = {
				limit = { has_artifact_flag = goods }
				destroy_artifact = yes
			}
			random_artifact = {
				limit = { has_artifact_flag = goods }
				destroy_artifact = yes
			}
		}
		character_event = { id = SNW.236 }
	}
	after = {
		clr_character_flag = guilds_is_using_goods
		clr_character_flag = guilds_men_caught
		clr_character_flag = guilds_doom_child
	}
}

#Warehouse thief notification
character_event = {
	id = SNW.236
	desc = EVTDESC_SNW_236
	picture = GFX_evt_eavesdropping
	
	notification = yes
	
	is_triggered_only = yes
	# hide_from = yes
	
	option = {
		name = OK 
	}
}

#sabotage faked trigger
character_event = {
	id = SNW.240
	hide_window = yes

	is_triggered_only = yes
	
	is_in_society = yes
	only_rulers = yes
	ai = yes
	
	trigger = {
		society_member_of = the_guilds
		society_rank >= 3
	}
	
	immediate = {
		if = {
			limit = { 
				FROM = {
					# ai = no 
					NOT = { society_member_of = the_guilds }
				}
			}
			FROM = { character_event = { id = SNW.241 } }
		}
		if = {
			limit = { 
				ROOT = { 
					# ai = no 
					NOT = { society_member_of = the_guilds }
				}
			}
			ROOT = { character_event = { id = SNW.241 } }
		}
	}
}

#sabotage faked player ping
character_event = { #non member
	id = SNW.241
	hide_window = yes

	is_triggered_only = yes
	
	immediate = {
		FROM = { character_event = { id = SNW.242 } }
	}
}

#sabotage faked AI choice
character_event = { #member
    id = SNW.242
	desc = EVTDESC_SNW_242
	picture = GFX_evt_large_army
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes
	
	trigger = {
		society_member_of = the_guilds
		war_with = FROM
	}
	
	option = { #supply
		name = EVTOPTA_SNW_242
		trigger = { 
			FROM = { 
				any_demesne_province = { 
					NOT = { 
						has_province_modifier = guilds_sabotage_supply
					}
				}
			}
		}
		scaled_wealth = -0.5
		detract_society_currency_minor_effect = yes
		FROM = {
			any_demesne_province = {
				add_province_modifier = {
					name = guilds_sabotage_supply
					months = 12
				}
			}
		}
		FROM = { character_event = { id = SNW.241 days = 200 } }
		FROM = { character_event = { id = SNW.243 } }
		ai_chance = {
			factor = 10
			modifier = {
				factor = 0
				FROM = { any_demesne_province = { has_province_modifier = guilds_sabotage_supply } }
				NOT = { society_currency >= 200 }
				NOT = { scaled_wealth = 1 }
			}
		}
	}
	
	option = { #economy
		name = EVTOPTB_SNW_242
		trigger = { 
			FROM = { 
				any_demesne_province = { 
					NOT = { 
						has_province_modifier = guilds_sabotage_economy
					}
				}
			}
		}
		scaled_wealth = -0.5
		detract_society_currency_minor_effect = yes
		FROM = {
			any_demesne_province = {
				add_province_modifier = {
					name = guilds_sabotage_economy
					months = 12
				}
			}
		}
		FROM = { character_event = { id = SNW.241 days = 200 } }
		FROM = { character_event = { id = SNW.244 } }
		ai_chance = {
			factor = 10
			modifier = {
				factor = 0
				FROM = { any_demesne_province = { has_province_modifier = guilds_sabotage_economy } }
				NOT = { society_currency >= 200 }
				NOT = { scaled_wealth = 1 }
			}
		}
	}
	
	option = { #propaganda
		name = EVTOPTC_SNW_242
		trigger = { 
			FROM = { 
				any_demesne_province = { 
					NOT = { 
						has_province_modifier = guilds_sabotage_propaganda
					}
				}
			}
		}
		scaled_wealth = -0.5
		detract_society_currency_minor_effect = yes
		FROM = {
			any_demesne_province = {
				add_province_modifier = {
					name = guilds_sabotage_propaganda
					months = 12
				}
			}
		}
		FROM = { character_event = { id = SNW.241 days = 200 } }
		FROM = { character_event = { id = SNW.245 } }
		ai_chance = {
			factor = 10
			modifier = {
				factor = 0
				FROM = { any_demesne_province = { has_province_modifier = guilds_sabotage_propaganda } }
				NOT = { society_currency >= 200 }
				NOT = { scaled_wealth = 1 }
			}
		}
	}
	
	option = { #nothing
		name = EVTOPTD_SNW_242
		FROM = { character_event = { id = SNW.241 days = 200 } }
	}
}

#sabotage faked supply
character_event = {
    id = SNW.243
	desc = EVTDESC_SNW_243
	picture = GFX_evt_large_army
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = {
		name = EVTOPTA_SNW_243
	}
}

#sabotage faked economy
character_event = {
    id = SNW.244
	desc = EVTDESC_SNW_244
	picture = GFX_evt_large_army
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = {
		name = EVTOPTA_SNW_244
	}
}

#sabotage faked propaganda
character_event = {
    id = SNW.245
	desc = EVTDESC_SNW_245
	picture = GFX_evt_large_army
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = {
		name = EVTOPTA_SNW_245
	}
}

#################################MISSIONS######################################

#Mission tombola
character_event = {
    id = SNW.300
    hide_window = yes

    is_triggered_only = yes
    
	is_in_society = yes

	trigger = {
		society_member_of = the_guilds
		has_any_quest = no
		NOT = { has_character_modifier = quest_cooldown_timer }
		NOT = { is_inaccessible_trigger = yes }
		prisoner = no
		society = {
			any_society_member = {
				NOT = { character = ROOT }
				prisoner = no
				is_within_diplo_range = ROOT
				opinion = { who = ROOT value = 0 }
			}
		}
	}

    immediate = {
    	#Picks out mission giver
    	random_list = {
    		20 = { #International society member
    			society = {
    				random_society_member = {
    					limit = { 	
							NOT = { character = ROOT }
							prisoner = no
    						is_within_diplo_range = ROOT
							opinion = { who = ROOT value = 0 }
    					}
    					save_event_target_as = guilds_collaborator
    				}
    			}
    		}
    		40 = { #Realm society member
    			trigger = {
    				society = {
    					any_society_member = {
    						NOT = { character = ROOT }
    						prisoner = no
    						is_within_diplo_range = ROOT
							opinion = { who = ROOT value = 0 }
							same_realm = ROOT
    					}
    				}
    			}
    			society = {
    				random_society_member = {
    					limit = { 	
    						NOT = { character = ROOT }
    						prisoner = no
    						is_within_diplo_range = ROOT
							opinion = { who = ROOT value = 0 }
							same_realm = ROOT
    					}
    					save_event_target_as = guilds_collaborator
    				}
    			}
    		}
    		40 = { #Apprentice
    			trigger = {
    				any_courtier_or_vassal = { has_minor_title =  title_guilds_apprentice prisoner = no }
					society_member_of = the_guilds
    			}
    			random_courtier_or_vassal = {
    				limit = { has_minor_title =  title_guilds_apprentice }
    				save_event_target_as = guilds_collaborator
    			}
    		}
    	}


    	#Randomizes mission
    	random_list = {
		#Ideas: Donations, train member,
    		40 = { #Find an apprentice
    			trigger = {
    				NOT = { any_courtier_or_vassal = { has_minor_title =  title_guilds_apprentice } }
    				ai = no
    			}
    			event_target:guilds_collaborator = { character_event = { id = SNW.310 days = 7 random = 7 } }
    		}
			
			40 = { #Build a warehouse
				trigger = {
					NOT = { has_character_flag = guilds_building_warehouse }
					has_no_warehouse = yes
					# OR = {
    					# ai = no
    					# society_rank >= 3
    				# }
					is_landed = yes
				}
				event_target:guilds_collaborator = { character_event = { id = SNW.320 days = 7 random = 7 } }
			}
			
    		30 = { #deliver goods
				trigger = {
					OR = {
						is_landed = yes
						is_patrician = yes
					}
				}
				clr_character_flag = guilds_delivery_stone
				clr_character_flag = guilds_delivery_steel
				clr_character_flag = guilds_delivery_gem
				clr_character_flag = guilds_delivery_silver
				clr_character_flag = guilds_delivery_gold
				clr_character_flag = guilds_delivery_grain
				clr_character_flag = guilds_delivery_lumber
				clr_character_flag = guilds_delivery_linen
				clr_character_flag = guilds_delivery_incense
				clr_character_flag = guilds_delivery_spices
				clr_character_flag = guilds_delivery_meat
				clr_character_flag = guilds_delivery_wool
				clr_character_flag = guilds_delivery_hide
				clr_character_flag = guilds_delivery_ivory
				clr_character_flag = guilds_delivery_silk
				clr_character_flag = guilds_delivery_pottery
				clr_character_flag = guilds_delivery_alcohol
				clr_character_flag = guilds_delivery_armor
				clr_character_flag = guilds_delivery_jewelry
				clr_character_flag = guilds_delivery_book
    			event_target:guilds_collaborator = { character_event = { id = SNW.330 days = 7 random = 7 } }
    		}
			
			10 = { #build city
				trigger = {
					is_playable = yes
					any_demesne_province = {
						num_of_empty_holdings = 1			
					}
				}
				modifier = {
					factor = 0 
					OR = {
						is_tribal = yes
						is_nomadic = yes
					}
				}
				modifier = { 
					factor = 0 
					is_playable = no
				}
				event_target:guilds_collaborator = { character_event = { id = SNW.360 days = 7 random = 7 } }
			}
			
			30 = { #Pick business focus
				trigger = {
					society_member_of = the_guilds
					has_dlc = "Way of Life"
					is_landed = yes #courtier can't focus
					ROOT = { NOT = { has_focus = focus_business } }
				}
				event_target:guilds_collaborator = { character_event = { id = SNW.410 days = 7 random = 7 } }
			}
			
			30 = { #send caravan
				trigger = {
					society_member_of = the_guilds
					society_rank = 3
					is_landed = yes
				}
				event_target:guilds_collaborator = { character_event = { id = SNW.420 days = 7 random = 7 } }
			}
			
			105 = { # AI bypasses missions at times
				modifier = {
					factor = 0
					ai = no
				}
				random_list = {
					80 = {
						guilds_add_influence_good_deal = yes
						modifier = {
							factor = 1.5
							has_global_flag = guilds_trade_good_years 
						}
					}
					40 = { 
						modifier = {
							factor = 2
							has_global_flag = guilds_market_crashed_dealflag 
						}
						modifier = {
							factor = 2
							has_global_flag = guilds_trade_bad_years 
						}
						guilds_add_influence_bad_deal = yes
						if = {
							limit = {
								had_global_flag = { flag = guilds_market_crashed_dealflag days = 5400 } #15 years of extra bad trade
							}
							clr_global_flag = guilds_market_crashed_dealflag
						}
					}
				}
				random_list = {
					80 = {
						random = {
							chance = 5
							clr_global_flag = guilds_trade_bad_years
							clr_global_flag = guilds_trade_good_years
						}
					}
					10 = { 
						trigger = {
							NOT = { has_global_flag = guilds_trade_bad_years }
							NOT = { has_global_flag = guilds_trade_good_years }
							NOT = { has_global_flag = guilds_market_crashed_dealflag }
						}
						set_global_flag = guilds_trade_bad_years
					}
					10 = { 
						trigger = {
							NOT = { has_global_flag = guilds_trade_bad_years }
							NOT = { has_global_flag = guilds_trade_good_years }
							NOT = { has_global_flag = guilds_market_crashed_dealflag }
						}
						set_global_flag = guilds_trade_good_years
					}
				}
				random_list = { #stalling
					100 = {
					}
					25 = {
						# modifier = {
							# factor = 0 #no inflation under 40% unless the market crashed
							# society_influence <= 40
							# NOT = { has_global_flag = guilds_market_crashed_dealflag  }
						# }
						# modifier = {
							# factor = 1.5
							# society_influence >= 20
							# has_global_flag = guilds_market_crashed_dealflag
						# }
						# modifier = {
							# factor = 1.5
							# society_influence >= 30
							# has_global_flag = guilds_market_crashed_dealflag
						# }
						# modifier = {
							# factor = 1.5
							# society_influence >= 40
							# has_global_flag = guilds_market_crashed_dealflag
						# }
						# modifier = {
							# factor = 2
						trigger = {
							OR = {
								society_influence >= 50
								has_global_flag = guilds_market_crashed_dealflag
							}
						}
						modifier = {
							factor = 2
							society_influence >= 60
						}
						modifier = {
							factor = 1.5
							society_influence >= 70
						}
						modifier = {
							factor = 1.35
							society_influence >= 80
						}
						modifier = {
							factor = 1.2
							society_influence >= 90
						}
						modifier = {
							factor = 2
							society_influence = 100
						}
						guilds_add_influence_inflation = yes
					}
				}
			}
			
			100 = { #Do nothing for AI
				modifier = {
					factor = 0
					ai = no
				}
				# modifier = {
					# factor = 2
						# society_influence >= 50
						# society_influence <= 60
				# }
				modifier = {
					factor = 2.5
					has_global_flag = guilds_market_stable_dealflag
				}
				if = {
					limit = {
						had_global_flag = { flag = guilds_market_stable_dealflag days = 5400 } #15 years of staleness
					}
					clr_global_flag = guilds_market_stable_dealflag
				}
			}
    	}
    }
}

#Mission: Find an apprentice
character_event = {
    id = SNW.310
    hide_window = yes
    is_triggered_only = yes
    immediate = { FROM = { society_quest_event = { id = SNW.311 days = 7 random = 7 } } }
}

#Apprentice
society_quest_event = {
    id = SNW.311
    desc = EVTDESC_SNW_311

    is_triggered_only = yes
   
    option = {
		name = ACCEPT

		set_quest = quest_guilds_find_apprentice

		hidden_effect = { character_event = { id = SNW.312 days = 150 random = 50 } } 
	}

	option = {
		name = DECLINE
		custom_tooltip = { text = decline_quest_tooltip }

		add_character_modifier = {
			name = quest_cooldown_timer
			hidden = yes
			days = 1000
		}

		ai_chance = { factor = 0 }
	}
}

#Apprentice #Still no apprentice? Make one
character_event = {
    id = SNW.312
    hide_window = yes
    is_triggered_only = yes
    trigger = { has_quest = quest_guilds_find_apprentice }
    immediate = { 
    	random_list = {
    		50 = {
    			modifier = {
    				is_female = no
    				factor = 1.5
    			}
    			create_random_steward = {
    				random_traits = yes
    				dynasty = none
    				female = yes
    				age = 28
    			}
    			new_character = {
    				save_event_target_as = apprentice_candidate
    			}
    		}
    		50 = {
    			modifier = {
    				is_female = yes
    				factor = 1.5
    			}
    			create_random_steward = {
    				random_traits = yes
    				dynasty = none
    				female = no
    				age = 28
    			}
    			new_character = {
    				save_event_target_as = apprentice_candidate
    			}
    		}
    	}

    	event_target:apprentice_candidate = {
    		remove_trait = slow
    		remove_trait = imbecile
    		remove_trait = inbred
    		remove_trait = dull
    		remove_trait = zealous
    		remove_trait = cynical
    		remove_trait = genius
    		remove_trait = quick
    		remove_trait = shrewd
    		remove_trait = slothful

    		#Add great trait
    		random_list = {
    			10 = { add_trait = genius }
    			10 = { add_trait = quick }
    			10 = { add_trait = shrewd }
    			# 10 = { trigger = { NOT = { religion_group = muslim } } add_trait = scholar }
    			# 10 = { trigger = { religion_group = muslim } add_trait = faqih }
    			10 = { add_trait = architect }
    			10 = { add_trait = administrator }
    			# 10 = { trigger = { has_dlc = Reapers} add_trait = physician }
    			40 = { } #Nothing
    		}

    		#Add good trait 
    		random_list = {
    			10 = { 
					add_trait = gregarious 
					remove_trait = shy
				}
    			10 = { add_trait = diligent }
    			10 = { 
    				add_trait = patient 
    				remove_trait = wroth
    			}
    			10 = {
    				add_trait = greedy
    				remove_trait = charitable
    			}
    			30 = {
    				add_trait = ambitious
    				remove_trait = content
    			}
    		}

    		while = {
    			limit = { NOT = { stewardship = 10 } }
    			change_stewardship = 1
    		}

    		character_event = { id = SNW.313 }
    	}
    }
}

#Apprentice
character_event = {
    id = SNW.313
    hide_window = yes
    is_triggered_only = yes
    immediate = { FROM = { character_event = { id = SNW.314 } } }
}

#Apprentice What about this servant?
character_event = {
    id = SNW.314
    desc = EVTDESC_SNW_314
    picture = GFX_evt_throne_room
    border = GFX_event_normal_frame_economy_guilds

    is_triggered_only = yes

    immediate = {

    }

    option = { 
        name = EVTOPTA_SNW_314

 		FROM = { give_minor_title = title_guilds_apprentice }

 		clr_quest = quest_guilds_find_apprentice
		add_guilds_mission_succeed_influence_effect = yes
		sound_effect = monastic_orders_donate_charity
 		add_society_currency_minor_effect = yes
    }

    option = {
        name = EVTOPTB_SNW_314
        custom_tooltip = { text = EVTOPTB_SNW_314_TT }
    }
}

#Apprentice You completed the quest by assigning someone the title
character_event = {
    id = SNW.315
    desc = EVTDESC_SNW_315
    picture = GFX_evt_throne_room
    border = GFX_event_normal_frame_economy_guilds

    is_triggered_only = yes

    option = { 
        name = EVTOPTA_SNW_315

        clr_quest = quest_guilds_find_apprentice
		sound_effect = monastic_orders_donate_charity

        if = {
        	limit = { FROM = { NOT = { stewardship = 12 } } }
 			add_society_currency_minor_effect = yes
        }
        if = {
        	limit = { FROM = { stewardship = 12 } }
 			add_society_currency_medium_effect = yes
        }
		add_guilds_mission_succeed_influence_effect = yes
    }
}

#Apprentice Ping event for apprenticeship completion
character_event = {
    id = SNW.316
    hide_window = yes
    is_triggered_only = yes
    trigger = { 
    	liege = {
    		character = FROMFROM
    		is_alive = yes
    		society_member_of = the_guilds
    	}
    	has_minor_title = title_guilds_apprentice

    }
    immediate = { FROMFROM = { character_event = { id = SNW.317 } } }
}

#Apprenticeship completion
character_event = {
    id = SNW.317
    desc = EVTDESC_SNW_317
    picture = GFX_evt_noble_in_castle
    border = GFX_event_normal_frame_economy_guilds

    is_triggered_only = yes
    
    option = { 
		name = EVTOPTA_SNW_317

        add_society_currency_major_effect = yes

        FROM = { 
        	set_character_flag = completed_apprenticeship 
        	remove_title = title_guilds_apprentice
        	add_trait = guilds_trait_apprentice
			hidden_effect = {
				set_variable = { which = guildsxp value = 20 }
			}
        }
    }
}

#Apprentice died
character_event = {
    id = SNW.318
    hide_window = yes
    is_triggered_only = yes

    is_in_society = yes
    ai = yes

    trigger = {
    	society_member_of = the_guilds
    	has_minor_title = title_guilds_apprentice
    }

    immediate = {
    	liege = { character_event = { id = SNW.319 } }
    }
}

#Apprentice Notification of dead apprentice
character_event = {
    id = SNW.319
    picture = GFX_evt_death
    border = GFX_event_normal_frame_economy_guilds

    desc = {
    	trigger = {
    		NOR = {
    			NOT = { opinion = { value = 0 who = FROM } }
    			NOT = { FROM = { stewardship = 12 } }
    		}
    	}
    	text = EVTDESC_SNW_319_A
    }
    desc = {
    	trigger = {
    		OR = {
    			NOT = { opinion = { value = 0 who = FROM } }
    			NOT = { FROM = { stewardship = 12 } }
    		}
    	}
    	text = EVTDESC_SNW_319_B
    }

    is_triggered_only = yes
    
    option = { 
        name = EVTOPTA_SNW_319
    }
}

#Apprentice's master died
character_event = {
    id = SNW.3190
    hide_window = yes
    is_triggered_only = yes

    is_in_society = yes
	only_playable = yes

    is_triggered_only = yes
    

    trigger = {
    	society_member_of = the_guilds
    	has_minor_title = title_guilds_apprentice
    }
	
    immediate = {
		any_courtier = {
			limit = { has_minor_title = title_guilds_apprentice }
			remove_title = title_guilds_apprentice
		}
    }
}

#Mission: Build a Warehouse
character_event = {
    id = SNW.320
    hide_window = yes
    is_triggered_only = yes
    immediate = {
		FROM = {
			society_quest_event = { id = SNW.321 days = 7 random = 7 }
		}
	}
}

#Warehouse quest giver give
society_quest_event = {
    id = SNW.321

	desc = {
		text = EVTDESC_SNW_321
		trigger = { 
			event_target:guilds_collaborator = {
				NOT = { has_minor_title = title_guilds_apprentice }
			}
		}
	}
	desc = {
		text = EVTDESC_SNW_321_apprentice
		trigger = { 
			event_target:guilds_collaborator = {
				has_minor_title = title_guilds_apprentice
			}
		}
	}

    is_triggered_only = yes
   
    option = {
		name = ACCEPT
		ai_chance = { factor = 100 }
		set_quest = quest_guilds_build_warehouse
	}

	option = {
		name = DECLINE
		ai_chance = { factor = 0 }
		custom_tooltip = { text = decline_quest_tooltip }
		add_character_modifier = {
			name = quest_cooldown_timer
			hidden = yes
			days = 1000
		}
	}
}

#Warehouse start
character_event = {
	id = SNW.322
	desc = EVTDESC_SNW_322
	picture = GFX_evt_castle_construction
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	# immediate = { 
		# destroy_artifact = guilds_warehouse_none
		# destroy_artifact = guilds_warehouse_rented
	# }
	
	option = { #Lets make one myself
		name = EVTOPTA_SNW_322
		character_event = { id = SNW.323 days = 7 }
		# hidden_effect = {
			# destroy_artifact = guilds_warehouse_none
			# destroy_artifact = guilds_warehouse_rented
		# }
	}
	option = { #Rent
		name = EVTOPTB_SNW_322
		custom_tooltip = { text = guilds_warehouse_noquest }
		capital_holding = { 
			trigger_switch = {
				on_trigger = holding_type
				city = { add_building = guilds_warehouse_1_city }
				castle = { add_building = guilds_warehouse_1_castle }
				temple = { add_building = guilds_warehouse_1_temple }
				tribal = { add_building = guilds_warehouse_1_tribal }
				nomad = { add_building = guilds_warehouse_1_nomad }
			}
		}
		# add_artifact = guilds_warehouse_rented
		# hidden_effect = {
			# destroy_artifact = guilds_warehouse_none
		# }
		clr_character_flag = guilds_building_warehouse
		ai_chance = { factor = 0.5 }
	}
	option = { #Lets dump it all in the basement
		name = EVTOPTC_SNW_322
		custom_tooltip = { text = guilds_warehouse_noquest }
		# add_artifact = guilds_warehouse_none
		# hidden_effect = {
			# destroy_artifact = guilds_warehouse_rented
		# }
		clr_character_flag = guilds_building_warehouse
		wealth = 50
		ai_chance = { factor = 0 }
	}
}

#Warehouse custom choice
character_event = {
	id = SNW.323
	desc = EVTDESC_SNW_323
	picture = GFX_evt_construction_site
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	immediate = { set_character_flag = guilds_is_using_goods }
	
	option = { #has both
		name = EVTOPTA_SNW_323
		trigger = { 
			has_artifact = guilds_item_stone
			has_artifact = guilds_item_lumber
		}
		destroy_artifact = guilds_item_stone
		destroy_artifact = guilds_item_lumber
		hidden_tooltip = {
			character_event = { id = SNW.324 days = 120 }
		}
	}
	option = { #has stone only
		name = EVTOPTB_SNW_323
		trigger = { 
			has_artifact = guilds_item_stone
			NOT = { has_artifact = guilds_item_lumber }
		}
		destroy_artifact = guilds_item_stone
		scaled_wealth = { value = -0.50 min = -50 max = -500 }
		hidden_tooltip = {
			character_event = { id = SNW.324 days = 180 }
		}
	}
	option = { #has wood only
		name = EVTOPTC_SNW_323
		trigger = { 
			NOT = { has_artifact = guilds_item_stone }
			has_artifact = guilds_item_lumber
		}
		destroy_artifact = guilds_item_lumber
		scaled_wealth = { value = -0.25 min = -25 max = -250 }
		hidden_tooltip = {
			character_event = { id = SNW.324 days = 180 }
		}
	}
	option = { #has nothing
		name = EVTOPTD_SNW_323
		trigger = { 
			NOT = { has_artifact = guilds_item_stone }
			NOT = { has_artifact = guilds_item_lumber }
		}
		scaled_wealth = { value = -0.75 min = -75 max = -750 }
		hidden_tooltip = {
			character_event = { id = SNW.324 days = 240 }
		}
	}
	option = { #Screw it
		name = EVTOPTE_SNW_323
		clr_character_flag = guilds_building_warehouse
		# add_artifact = guilds_warehouse_none
		wealth = 25
	}
	
	after = {
	clr_character_flag = guilds_is_using_goods
	}
}

#Warehouse custom done
character_event = {
	id = SNW.324
	desc = EVTDESC_SNW_324
	picture = GFX_evt_construction_site
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #Go customise quest done
		name = EVTOPTA_SNW_324
		hidden_tooltip = {
			character_event = { id = SNW.325 }
		}
		hidden_tooltip = {
			capital_holding = { 
				trigger_switch = {
					on_trigger = holding_type
					city = { add_building = guilds_warehouse_1_city }
					castle = { add_building = guilds_warehouse_1_castle }
					temple = { add_building = guilds_warehouse_1_temple }
					tribal = { add_building = guilds_warehouse_1_tribal }
					nomad = { add_building = guilds_warehouse_1_nomad }
				}
			}
		}
		capital_holding = { 
			trigger_switch = {
				on_trigger = holding_type
				city = { add_building = guilds_warehouse_2_city }
				castle = { add_building = guilds_warehouse_2_castle }
				temple = { add_building = guilds_warehouse_2_temple }
				tribal = { add_building = guilds_warehouse_2_tribal }
				nomad = { add_building = guilds_warehouse_2_nomad }
			}
		}
		if = {
			limit = {
				has_quest = quest_guilds_build_warehouse
			}
			clr_quest = quest_guilds_build_warehouse
			sound_effect = monastic_orders_donate_charity
			add_society_currency_minor_effect = yes
			add_guilds_mission_succeed_influence_effect = yes
		}
	}
	option = { #Dont customise quest done
		name = EVTOPTB_SNW_324
		# add_artifact = guilds_warehouse_custom
		hidden_tooltip = {
			capital_holding = { 
				trigger_switch = {
					on_trigger = holding_type
					city = { add_building = guilds_warehouse_1_city }
					castle = { add_building = guilds_warehouse_1_castle }
					temple = { add_building = guilds_warehouse_1_temple }
					tribal = { add_building = guilds_warehouse_1_tribal }
					nomad = { add_building = guilds_warehouse_1_nomad }
				}
			}
		}
		capital_holding = { 
			trigger_switch = {
				on_trigger = holding_type
				city = { add_building = guilds_warehouse_2_city }
				castle = { add_building = guilds_warehouse_2_castle }
				temple = { add_building = guilds_warehouse_2_temple }
				tribal = { add_building = guilds_warehouse_2_tribal }
				nomad = { add_building = guilds_warehouse_2_nomad }
			}
		}
		clr_character_flag = guilds_building_warehouse
		if = {
			limit = {
				has_quest = quest_guilds_build_warehouse
			}
			clr_quest = quest_guilds_build_warehouse
			sound_effect = monastic_orders_donate_charity
			add_society_currency_minor_effect = yes
			add_guilds_mission_succeed_influence_effect = yes
		}
	}
}

#Warehouse decoration choices
character_event = {
	id = SNW.325
	desc = EVTDESC_SNW_325
	picture = GFX_evt_construction_site
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	immediate = { 
		set_character_flag = guilds_building_warehouse 
		set_character_flag = guilds_is_using_goods	
		# destroy_artifact = guilds_warehouse_custom
	}
	
	option = { #Gold
		name = EVTOPTA_SNW_325
		trigger = { 
			has_artifact = guilds_item_gold
			NOT = { has_artifact = guilds_warehouse_gold }
		}
		destroy_artifact = guilds_item_gold
		add_artifact = guilds_warehouse_gold
	}
	option = { #Incense
		name = EVTOPTB_SNW_325
		trigger = { 
			has_artifact = guilds_item_incense
			NOT = { has_artifact = guilds_warehouse_incense }
		}
		destroy_artifact = guilds_item_incense
		add_artifact = guilds_warehouse_incense
	}
	option = { #Silk
		name = EVTOPTC_SNW_325
		trigger = { 
			has_artifact = guilds_item_silk
			NOT = { has_artifact = guilds_warehouse_silk }
		}
		destroy_artifact = guilds_item_silk
		add_artifact = guilds_warehouse_silk
	}
	option = { #Book
		name = EVTOPTD_SNW_325
		trigger = { 
			has_artifact = guilds_item_book
			NOT = { has_artifact = guilds_warehouse_book }
		}
		destroy_artifact = guilds_item_book
		add_artifact = guilds_warehouse_book
	}
	option = { #nothing
		name = EVTOPTE_SNW_325
		trigger = { 
			NAND = { 
				has_artifact = guilds_item_gold
				has_artifact = guilds_item_incense
				has_artifact = guilds_item_silk
				has_artifact = guilds_item_book
			}		
		}
		# add_artifact = guilds_warehouse_custom
	}
	after = {
		clr_character_flag = guilds_building_warehouse
		clr_character_flag = guilds_is_using_goods
	}
}

#Warehouse decoration selling
character_event = {
	id = SNW.326
	desc = EVTDESC_SNW_326
	picture = GFX_evt_construction_site
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	immediate = { 
		set_character_flag = guilds_building_warehouse 
		set_character_flag = guilds_is_using_goods	
		# destroy_artifact = guilds_warehouse_custom
	}
	
	option = { #Gold
		name = EVTOPTA_SNW_326
		trigger = { has_artifact = guilds_warehouse_gold }
		destroy_artifact = guilds_warehouse_gold
		scaled_wealth = { value = 0.6 min = 60 max = 600 }	
	}
	option = { #Incense
		name = EVTOPTB_SNW_326
		trigger = { has_artifact = guilds_warehouse_incense }
		destroy_artifact = guilds_warehouse_incense
		scaled_wealth = { value = 0.6 min = 60 max = 600 }	
	}
	option = { #Silk
		name = EVTOPTC_SNW_326
		trigger = { has_artifact = guilds_warehouse_silk }
		destroy_artifact = guilds_warehouse_silk
		scaled_wealth = { value = 0.6 min = 60 max = 600 }	
	}
	option = { #Book
		name = EVTOPTD_SNW_326
		trigger = { has_artifact = guilds_warehouse_book }
		destroy_artifact = guilds_warehouse_book
		scaled_wealth = { value = 0.6 min = 60 max = 600 }	
	}
	option = { #Papers
		name = EVTOPTE_SNW_326
		trigger = { has_artifact = guilds_warehouse_guilds }
		destroy_artifact = guilds_warehouse_guilds
		scaled_wealth = { value = 0.3 min = 30 max = 300 }	
		ai_chance = {
			factor = 10
		}
	}
	option = { #nothing
		name = EVTOPTF_SNW_326
		trigger = { 
			NAND = { 
				has_artifact = guilds_warehouse_gold
				has_artifact = guilds_warehouse_incense
				has_artifact = guilds_warehouse_silk
				has_artifact = guilds_warehouse_book
			}		
		}
		# add_artifact = guilds_warehouse_custom
		ai_chance = {
			factor = 0.1
		}
	}
	after = {
		clr_character_flag = guilds_building_warehouse
		clr_character_flag = guilds_is_using_goods
	}
}
        	
#Mission: Deliver Artifacts
character_event = {
    id = SNW.330
    hide_window = yes
    is_triggered_only = yes
    immediate = {
		FROM = {
			society_quest_event = { id = SNW.331 days = 7 random = 7 }
		}
	}
}

#Delivery start
society_quest_event = {
    id = SNW.331

	desc = {
		text = EVTDESC_SNW_331_stone
		trigger = {
			has_character_flag = guilds_delivery_stone
		}
	}
	desc = {
		text = EVTDESC_SNW_331_steel
		trigger = {
			has_character_flag = guilds_delivery_steel
		}
	}
	desc = {
		text = EVTDESC_SNW_331_gem
		trigger = {
			has_character_flag = guilds_delivery_gem
		}
	}
	desc = {
		text = EVTDESC_SNW_331_silver
		trigger = {
			has_character_flag = guilds_delivery_silver
		}
	}
	desc = {
		text = EVTDESC_SNW_331_gold
		trigger = {
			has_character_flag = guilds_delivery_gold
		}
	}
	desc = {
		text = EVTDESC_SNW_331_grain
		trigger = {
			has_character_flag = guilds_delivery_grain
		}
	}
	desc = {
		text = EVTDESC_SNW_331_lumber
		trigger = {
			has_character_flag = guilds_delivery_lumber
		}
	}
	desc = {
		text = EVTDESC_SNW_331_linen
		trigger = {
			has_character_flag = guilds_delivery_linen
		}
	}
	desc = {
		text = EVTDESC_SNW_331_incense
		trigger = {
			has_character_flag = guilds_delivery_incense
		}
	}
	desc = {
		text = EVTDESC_SNW_331_spices
		trigger = {
			has_character_flag = guilds_delivery_spices
		}
	}
	desc = {
		text = EVTDESC_SNW_331_meat
		trigger = {
			has_character_flag = guilds_delivery_meat
		}
	}
	desc = {
		text = EVTDESC_SNW_331_wool
		trigger = {
			has_character_flag = guilds_delivery_wool
		}
	}
	desc = {
		text = EVTDESC_SNW_331_hide
		trigger = {
			has_character_flag = guilds_delivery_hide
		}
	}
	desc = {
		text = EVTDESC_SNW_331_ivory
		trigger = {
			has_character_flag = guilds_delivery_ivory
		}
	}
	desc = {
		text = EVTDESC_SNW_331_silk
		trigger = {
			has_character_flag = guilds_delivery_silk
		}
	}
	desc = {
		text = EVTDESC_SNW_331_pottery
		trigger = {
			has_character_flag = guilds_delivery_pottery
		}
	}
	desc = {
		text = EVTDESC_SNW_331_alcohol
		trigger = {
			has_character_flag = guilds_delivery_alcohol
		}
	}
	desc = {
		text = EVTDESC_SNW_331_armor
		trigger = {
			has_character_flag = guilds_delivery_armor
		}
	}
	desc = {
		text = EVTDESC_SNW_331_jewelry
		trigger = {
			has_character_flag = guilds_delivery_jewelry
		}
	}
	desc = {
		text = EVTDESC_SNW_331_book
		trigger = {
			has_character_flag = guilds_delivery_book
		}
	}

    is_triggered_only = yes
	
	immediate = {
		clr_character_flag = guilds_delivery_stone
		clr_character_flag = guilds_delivery_steel
		clr_character_flag = guilds_delivery_gem
		clr_character_flag = guilds_delivery_silver
		clr_character_flag = guilds_delivery_gold
		clr_character_flag = guilds_delivery_grain
		clr_character_flag = guilds_delivery_lumber
		clr_character_flag = guilds_delivery_linen
		clr_character_flag = guilds_delivery_incense
		clr_character_flag = guilds_delivery_spices
		clr_character_flag = guilds_delivery_meat
		clr_character_flag = guilds_delivery_wool
		clr_character_flag = guilds_delivery_hide
		clr_character_flag = guilds_delivery_ivory
		clr_character_flag = guilds_delivery_silk
		clr_character_flag = guilds_delivery_pottery
		clr_character_flag = guilds_delivery_alcohol
		clr_character_flag = guilds_delivery_armor
		clr_character_flag = guilds_delivery_jewelry
		clr_character_flag = guilds_delivery_book
		random_list = {
			50 = {
				set_character_flag = guilds_delivery_stone
			}
			50 = {
				set_character_flag = guilds_delivery_steel
			}
			50 = {
				set_character_flag = guilds_delivery_gem
			}
			50 = {
				set_character_flag = guilds_delivery_silver
			}
			50 = {
				set_character_flag = guilds_delivery_gold
			}
			50 = {
				set_character_flag = guilds_delivery_grain
			}
			50 = {
				set_character_flag = guilds_delivery_linen
			}
			50 = {
				set_character_flag = guilds_delivery_lumber
			}
			50 = {
				set_character_flag = guilds_delivery_incense
			}
			50 = {
				set_character_flag = guilds_delivery_spices
			}
			50 = {
				set_character_flag = guilds_delivery_meat
			}
			50 = {
				set_character_flag = guilds_delivery_wool
			}
			50 = {
				set_character_flag = guilds_delivery_hide
			}
			50 = {
				set_character_flag = guilds_delivery_ivory
			}
			50 = {
				set_character_flag = guilds_delivery_silk
			}
			50 = {
				set_character_flag = guilds_delivery_pottery
			}
			50 = {
				set_character_flag = guilds_delivery_alcohol
			}
			50 = {
				set_character_flag = guilds_delivery_armor
			}
			50 = {
				set_character_flag = guilds_delivery_jewelry
			}
			50 = {
				set_character_flag = guilds_delivery_book
			}
		}
	}

    option = {
		name = ACCEPT
		ai_chance = { factor = 100 }
		set_quest = quest_guilds_delivery
	}

	option = {
		name = DECLINE
		ai_chance = { factor = 0 }
		custom_tooltip = { text = decline_quest_tooltip }
		add_character_modifier = {
			name = quest_cooldown_timer
			hidden = yes
			days = 1000
		}
		clr_character_flag = guilds_delivery_stone
		clr_character_flag = guilds_delivery_steel
		clr_character_flag = guilds_delivery_gem
		clr_character_flag = guilds_delivery_silver
		clr_character_flag = guilds_delivery_gold
		clr_character_flag = guilds_delivery_grain
		clr_character_flag = guilds_delivery_lumber
		clr_character_flag = guilds_delivery_linen
		clr_character_flag = guilds_delivery_incense
		clr_character_flag = guilds_delivery_spices
		clr_character_flag = guilds_delivery_meat
		clr_character_flag = guilds_delivery_wool
		clr_character_flag = guilds_delivery_hide
		clr_character_flag = guilds_delivery_ivory
		clr_character_flag = guilds_delivery_silk
		clr_character_flag = guilds_delivery_pottery
		clr_character_flag = guilds_delivery_alcohol
		clr_character_flag = guilds_delivery_armor
		clr_character_flag = guilds_delivery_jewelry
		clr_character_flag = guilds_delivery_book
	}
	after = {
		clr_character_flag = guilds_delivering
	}
}

#Delivery End
character_event = {
    id = SNW.332
    # desc = EVTDESC_SNW_332
    picture = GFX_evt_noble_in_castle
    border = GFX_event_normal_frame_economy_guilds

	desc = {
		text = EVTDESC_SNW_332_stone
		trigger = {
			has_character_flag = guilds_delivery_stone
		}
	}
	desc = {
		text = EVTDESC_SNW_332_steel
		trigger = {
			has_character_flag = guilds_delivery_steel
		}
	}
	desc = {
		text = EVTDESC_SNW_332_gem
		trigger = {
			has_character_flag = guilds_delivery_gem
		}
	}
	desc = {
		text = EVTDESC_SNW_332_silver
		trigger = {
			has_character_flag = guilds_delivery_silver
		}
	}
	desc = {
		text = EVTDESC_SNW_332_gold
		trigger = {
			has_character_flag = guilds_delivery_gold
		}
	}
	desc = {
		text = EVTDESC_SNW_332_grain
		trigger = {
			has_character_flag = guilds_delivery_grain
		}
	}
	desc = {
		text = EVTDESC_SNW_332_lumber
		trigger = {
			has_character_flag = guilds_delivery_lumber
		}
	}
	desc = {
		text = EVTDESC_SNW_332_linen
		trigger = {
			has_character_flag = guilds_delivery_linen
		}
	}
	desc = {
		text = EVTDESC_SNW_332_incense
		trigger = {
			has_character_flag = guilds_delivery_incense
		}
	}
	desc = {
		text = EVTDESC_SNW_332_spices
		trigger = {
			has_character_flag = guilds_delivery_spices
		}
	}
	desc = {
		text = EVTDESC_SNW_332_meat
		trigger = {
			has_character_flag = guilds_delivery_meat
		}
	}
	desc = {
		text = EVTDESC_SNW_332_wool
		trigger = {
			has_character_flag = guilds_delivery_wool
		}
	}
	desc = {
		text = EVTDESC_SNW_332_hide
		trigger = {
			has_character_flag = guilds_delivery_hide
		}
	}
	desc = {
		text = EVTDESC_SNW_332_ivory
		trigger = {
			has_character_flag = guilds_delivery_ivory
		}
	}
	desc = {
		text = EVTDESC_SNW_332_silk
		trigger = {
			has_character_flag = guilds_delivery_silk
		}
	}
	desc = {
		text = EVTDESC_SNW_332_pottery
		trigger = {
			has_character_flag = guilds_delivery_pottery
		}
	}
	desc = {
		text = EVTDESC_SNW_332_alcohol
		trigger = {
			has_character_flag = guilds_delivery_alcohol
		}
	}
	desc = {
		text = EVTDESC_SNW_332_armor
		trigger = {
			has_character_flag = guilds_delivery_armor
		}
	}
	desc = {
		text = EVTDESC_SNW_332_jewelry
		trigger = {
			has_character_flag = guilds_delivery_jewelry
		}
	}
	desc = {
		text = EVTDESC_SNW_332_book
		trigger = {
			has_character_flag = guilds_delivery_book
		}
	}
	
    is_triggered_only = yes

	option = {
		name = EVTOPT_SNW_332_stone
		trigger = {
			ai = no
			has_character_flag = guilds_delivery_stone
			has_artifact = guilds_item_stone
		}
		destroy_artifact = guilds_item_stone
		scaled_wealth = { value = 0.25 min = 25 max = 250 }
 		clr_quest = quest_guilds_delivery
		clr_character_flag = guilds_delivery_stone
		sound_effect = monastic_orders_donate_charity
 		add_society_currency_minor_effect = yes
		add_guilds_mission_succeed_influence_effect = yes
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		name = EVTOPT_SNW_332_steel
		trigger = {
			ai = no
			has_character_flag = guilds_delivery_steel
			has_artifact = guilds_item_steel
		}
		destroy_artifact = guilds_item_steel
		scaled_wealth = { value = 0.50 min = 50 max = 500 }
 		clr_quest = quest_guilds_delivery
		clr_character_flag = guilds_delivery_steel
		sound_effect = monastic_orders_donate_charity
 		add_society_currency_minor_effect = yes
		add_guilds_mission_succeed_influence_effect = yes
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		name = EVTOPT_SNW_332_gem
		trigger = {
			ai = no
			has_character_flag = guilds_delivery_gem
			has_artifact = guilds_item_gem
		}
		destroy_artifact = guilds_item_gem
		scaled_wealth = { value = 0.75 min = 75 max = 750 }
 		clr_quest = quest_guilds_delivery
		clr_character_flag = guilds_delivery_gem
		sound_effect = monastic_orders_donate_charity
 		add_society_currency_minor_effect = yes
		add_guilds_mission_succeed_influence_effect = yes
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		name = EVTOPT_SNW_332_silver
		trigger = {
			ai = no
			has_character_flag = guilds_delivery_silver
			has_artifact = guilds_item_silver
		}
		destroy_artifact = guilds_item_silver
		scaled_wealth = { value = 1 min = 100 max = 1000 }
 		clr_quest = quest_guilds_delivery
		clr_character_flag = guilds_delivery_silver
		sound_effect = monastic_orders_donate_charity
 		add_society_currency_minor_effect = yes
		add_guilds_mission_succeed_influence_effect = yes
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		name = EVTOPT_SNW_332_gold
		trigger = {
			ai = no
			has_character_flag = guilds_delivery_gold
			has_artifact = guilds_item_gold
		}
		destroy_artifact = guilds_item_gold
		scaled_wealth = { value = 1.25 min = 125 max = 1250 }
 		clr_quest = quest_guilds_delivery
		clr_character_flag = guilds_delivery_gold
		sound_effect = monastic_orders_donate_charity
 		add_society_currency_minor_effect = yes
		add_guilds_mission_succeed_influence_effect = yes
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		name = EVTOPT_SNW_332_grain
		trigger = {
			ai = no
			has_character_flag = guilds_delivery_grain
			has_artifact = guilds_item_grain
		}
		destroy_artifact = guilds_item_grain
		scaled_wealth = { value = 0.25 min = 25 max = 250 }
 		clr_quest = quest_guilds_delivery
		clr_character_flag = guilds_delivery_grain
		sound_effect = monastic_orders_donate_charity
 		add_society_currency_minor_effect = yes
		add_guilds_mission_succeed_influence_effect = yes
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		name = EVTOPT_SNW_332_lumber
		trigger = {
			ai = no
			has_character_flag = guilds_delivery_lumber
			has_artifact = guilds_item_lumber
		}
		destroy_artifact = guilds_item_lumber
		scaled_wealth = { value = 0.50 min = 50 max = 500 }
 		clr_quest = quest_guilds_delivery
		clr_character_flag = guilds_delivery_lumber
		sound_effect = monastic_orders_donate_charity
 		add_society_currency_minor_effect = yes
		add_guilds_mission_succeed_influence_effect = yes
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		name = EVTOPT_SNW_332_linen
		trigger = {
			ai = no
			has_character_flag = guilds_delivery_linen
			has_artifact = guilds_item_linen
		}
		destroy_artifact = guilds_item_linen
		scaled_wealth = { value = 0.75 min = 75 max = 750 }
 		clr_quest = quest_guilds_delivery
		clr_character_flag = guilds_delivery_linen
		sound_effect = monastic_orders_donate_charity
 		add_society_currency_minor_effect = yes
		add_guilds_mission_succeed_influence_effect = yes
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		name = EVTOPT_SNW_332_incense
		trigger = {
			ai = no
			has_character_flag = guilds_delivery_incense
			has_artifact = guilds_item_incense
		}
		destroy_artifact = guilds_item_incense
		scaled_wealth = { value = 1 min = 100 max = 1000 }
 		clr_quest = quest_guilds_delivery
		clr_character_flag = guilds_delivery_incense
		sound_effect = monastic_orders_donate_charity
 		add_society_currency_minor_effect = yes
		add_guilds_mission_succeed_influence_effect = yes
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		name = EVTOPT_SNW_332_spices
		trigger = {
			ai = no
			has_character_flag = guilds_delivery_spices
			has_artifact = guilds_item_spices
		}
		destroy_artifact = guilds_item_spices
		scaled_wealth = { value = 1.25 min = 125 max = 1250 }
 		clr_quest = quest_guilds_delivery
		clr_character_flag = guilds_delivery_spices
		sound_effect = monastic_orders_donate_charity
 		add_society_currency_minor_effect = yes
		add_guilds_mission_succeed_influence_effect = yes
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		name = EVTOPT_SNW_332_meat
		trigger = {
			ai = no
			has_character_flag = guilds_delivery_meat
			has_artifact = guilds_item_meat
		}
		destroy_artifact = guilds_item_meat
		scaled_wealth = { value = 0.25 min = 25 max = 250 }
 		clr_quest = quest_guilds_delivery
		clr_character_flag = guilds_delivery_meat
		sound_effect = monastic_orders_donate_charity
 		add_society_currency_minor_effect = yes
		add_guilds_mission_succeed_influence_effect = yes
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		name = EVTOPT_SNW_332_wool
		trigger = {
			ai = no
			has_character_flag = guilds_delivery_wool
			has_artifact = guilds_item_wool
		}
		destroy_artifact = guilds_item_wool
		scaled_wealth = { value = 0.50 min = 50 max = 500 }
 		clr_quest = quest_guilds_delivery
		clr_character_flag = guilds_delivery_wool
		sound_effect = monastic_orders_donate_charity
 		add_society_currency_minor_effect = yes
		add_guilds_mission_succeed_influence_effect = yes
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		name = EVTOPT_SNW_332_hide
		trigger = {
			ai = no
			has_character_flag = guilds_delivery_hide
			has_artifact = guilds_item_hide
		}
		destroy_artifact = guilds_item_hide
		scaled_wealth = { value = 0.75 min = 75 max = 750 }
 		clr_quest = quest_guilds_delivery
		clr_character_flag = guilds_delivery_hide
		sound_effect = monastic_orders_donate_charity
 		add_society_currency_minor_effect = yes
		add_guilds_mission_succeed_influence_effect = yes
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		name = EVTOPT_SNW_332_ivory
		trigger = {
			ai = no
			has_character_flag = guilds_delivery_ivory
			has_artifact = guilds_item_ivory
		}
		destroy_artifact = guilds_item_ivory
		scaled_wealth = { value = 1 min = 100 max = 1000 }
 		clr_quest = quest_guilds_delivery
		clr_character_flag = guilds_delivery_ivory
		sound_effect = monastic_orders_donate_charity
 		add_society_currency_minor_effect = yes
		add_guilds_mission_succeed_influence_effect = yes
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		name = EVTOPT_SNW_332_silk
		trigger = {
			ai = no
			has_character_flag = guilds_delivery_silk
			has_artifact = guilds_item_silk
		}
		destroy_artifact = guilds_item_silk
		scaled_wealth = { value = 1.25 min = 125 max = 1250 }
 		clr_quest = quest_guilds_delivery
		clr_character_flag = guilds_delivery_silk
		sound_effect = monastic_orders_donate_charity
 		add_society_currency_minor_effect = yes
		add_guilds_mission_succeed_influence_effect = yes
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		name = EVTOPT_SNW_332_pottery
		trigger = {
			ai = no
			has_character_flag = guilds_delivery_pottery
			has_artifact = guilds_item_pottery
		}
		destroy_artifact = guilds_item_pottery
		scaled_wealth = { value = 0.25 min = 25 max = 250}
 		clr_quest = quest_guilds_delivery
		clr_character_flag = guilds_delivery_pottery
		sound_effect = monastic_orders_donate_charity
 		add_society_currency_minor_effect = yes
		add_guilds_mission_succeed_influence_effect = yes
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		name = EVTOPT_SNW_332_alcohol
		trigger = {
			ai = no
			has_character_flag = guilds_delivery_alcohol
			has_artifact = guilds_item_alcohol
		}
		destroy_artifact = guilds_item_alcohol
		scaled_wealth = { value = 0.50 min = 50 max = 500 }
 		clr_quest = quest_guilds_delivery
		clr_character_flag = guilds_delivery_alcohol
		sound_effect = monastic_orders_donate_charity
 		add_society_currency_minor_effect = yes
		add_guilds_mission_succeed_influence_effect = yes
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		name = EVTOPT_SNW_332_armor
		trigger = {
			ai = no
			has_character_flag = guilds_delivery_armor
			has_artifact = guilds_item_armor
		}
		destroy_artifact = guilds_item_armor
		scaled_wealth = { value = 0.75 min = 75 max = 750 }
 		clr_quest = quest_guilds_delivery
		clr_character_flag = guilds_delivery_armor
		sound_effect = monastic_orders_donate_charity
 		add_society_currency_minor_effect = yes
		add_guilds_mission_succeed_influence_effect = yes
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		name = EVTOPT_SNW_332_jewelry
		trigger = {
			ai = no
			has_character_flag = guilds_delivery_jewelry
			has_artifact = guilds_item_jewelry
		}
		destroy_artifact = guilds_item_jewelry
		scaled_wealth = { value = 1 min = 100 max = 1000 }
 		clr_quest = quest_guilds_delivery
		clr_character_flag = guilds_delivery_jewelry
		sound_effect = monastic_orders_donate_charity
 		add_society_currency_minor_effect = yes
		add_guilds_mission_succeed_influence_effect = yes
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = {
		name = EVTOPT_SNW_332_book
		trigger = {
			ai = no
			has_character_flag = guilds_delivery_book
			has_artifact = guilds_item_book
		}
		destroy_artifact = guilds_item_book
		scaled_wealth = { value = 1.25 min = 125 max = 1250 }
 		clr_quest = quest_guilds_delivery
		clr_character_flag = guilds_delivery_book
		sound_effect = monastic_orders_donate_charity
 		add_society_currency_minor_effect = yes
		add_guilds_mission_succeed_influence_effect = yes
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = { #nothing
		name = EVTOPTA_SNW_332
		ai_chance = {
			factor = 2
			modifier = {
				factor = 2 #trying to balance spam
				OR = {
					society_influence = {
						society = the_guilds
						value >= 60
					}
					has_global_flag = guilds_market_crashed_dealflag 
				}
			}
		}
	}
	option = { #AI win
		name = EVTOPTB_SNW_332
		trigger = {
			ai = yes
		}
		wealth = 25
		add_guilds_mission_succeed_influence_effect = yes
		ROOT = {
			change_variable = { which = guildsxp value = 1 }
		}
		add_society_currency_minor_effect = yes
		clr_quest = quest_guilds_delivery
		clr_character_flag = guilds_delivery_stone
		clr_character_flag = guilds_delivery_steel
		clr_character_flag = guilds_delivery_gem
		clr_character_flag = guilds_delivery_silver
		clr_character_flag = guilds_delivery_gold
		clr_character_flag = guilds_delivery_grain
		clr_character_flag = guilds_delivery_lumber
		clr_character_flag = guilds_delivery_linen
		clr_character_flag = guilds_delivery_incense
		clr_character_flag = guilds_delivery_spices
		clr_character_flag = guilds_delivery_meat
		clr_character_flag = guilds_delivery_wool
		clr_character_flag = guilds_delivery_hide
		clr_character_flag = guilds_delivery_ivory
		clr_character_flag = guilds_delivery_silk
		clr_character_flag = guilds_delivery_pottery
		clr_character_flag = guilds_delivery_alcohol
		clr_character_flag = guilds_delivery_armor
		clr_character_flag = guilds_delivery_jewelry
		clr_character_flag = guilds_delivery_book
		ai_chance = {
			factor = 5
		}
	}
	option = { #AI lose
		name = EVTOPTC_SNW_332
		trigger = {
			ai = yes
		}
		clr_quest = quest_guilds_delivery
		add_guilds_mission_fail_influence_effect = yes
		clr_character_flag = guilds_delivery_stone
		clr_character_flag = guilds_delivery_steel
		clr_character_flag = guilds_delivery_gem
		clr_character_flag = guilds_delivery_silver
		clr_character_flag = guilds_delivery_gold
		clr_character_flag = guilds_delivery_grain
		clr_character_flag = guilds_delivery_lumber
		clr_character_flag = guilds_delivery_linen
		clr_character_flag = guilds_delivery_incense
		clr_character_flag = guilds_delivery_spices
		clr_character_flag = guilds_delivery_meat
		clr_character_flag = guilds_delivery_wool
		clr_character_flag = guilds_delivery_hide
		clr_character_flag = guilds_delivery_ivory
		clr_character_flag = guilds_delivery_silk
		clr_character_flag = guilds_delivery_pottery
		clr_character_flag = guilds_delivery_alcohol
		clr_character_flag = guilds_delivery_armor
		clr_character_flag = guilds_delivery_jewelry
		clr_character_flag = guilds_delivery_book
		ai_chance = {
			factor = 5
		}
	}
	after = {
		clr_character_flag = guilds_delivering
	}
}

#Delivery End clear flag safeguard
character_event = {
    id = SNW.333
	is_triggered_only = yes
	hide_window = yes
	
    is_triggered_only = yes

	immediate = {
		clr_character_flag = guilds_delivering
	}
}

#Center of trade creation
character_event = {
    id = SNW.340
    desc = EVTDESC_SNW_340
	picture = GFX_evt_council_agreement_unused
	border = GFX_event_normal_frame_economy_guilds
	
    is_triggered_only = yes

    option = {
        name = EVTOPTA_SNW_340
		capital_holding = {
			add_holding_modifier = {
				name = guilds_center_trade
				duration = -1
			}
		}
    }
}

#Center of trade Yearly pay out
character_event = {
    id = SNW.341
	hide_window = yes

    is_triggered_only = yes
	only_rulers = yes	
	
	trigger = {
		any_demesne_province = {
			any_province_holding = { 
				owner = { character = ROOT }
				has_holding_modifier = guilds_center_trade 
			}
		}
	}
	
	immediate = { 
		random_list = {
			1 = { 
				random_list = {
					50 = {
						add_artifact = guilds_item_stone
					}
					50 = {
						add_artifact = guilds_item_steel
					}
					50 = {
						add_artifact = guilds_item_gem
					}
					50 = {
						add_artifact = guilds_item_silver
					}
					50 = {
						add_artifact = guilds_item_gold
					}
					50 = {
						add_artifact = guilds_item_grain
					}
					50 = {
						add_artifact = guilds_item_linen
					}
					50 = {
						add_artifact = guilds_item_lumber
					}
					50 = {
						add_artifact = guilds_item_incense
					}
					50 = {
						add_artifact = guilds_item_spices
					}
					50 = {
						add_artifact = guilds_item_meat
					}
					50 = {
						add_artifact = guilds_item_wool
					}
					50 = {
						add_artifact = guilds_item_hide
					}
					50 = {
						add_artifact = guilds_item_ivory
					}
					50 = {
						add_artifact = guilds_item_silk
					}
					50 = {
						add_artifact = guilds_item_pottery
					}
					50 = {
						add_artifact = guilds_item_alcohol
					}
					50 = {
						add_artifact = guilds_item_armor
					}
					50 = {
						add_artifact = guilds_item_jewelry
					}
					50 = {
						add_artifact = guilds_item_book
					}
				}
			}
			2 = {
				capital_scope = {
					random_list = {
						50 = {
							add_province_modifier = {
								name = guilds_buff_stone
								months = 12
							}
						}
						50 = {
							add_province_modifier = { 
								name = guilds_buff_steel
								months = 24
							}
						}
						50 = {
							add_province_modifier = { 
								name = guilds_buff_gem
								months = 36
							}
						}
						50 = {
							add_province_modifier = { 
								name = guilds_buff_silver
								months = 48
							}
						}
						50 = {
							add_province_modifier = { 
								name = guilds_buff_gold
								months = 60
							}
						}
						50 = {
							add_province_modifier = { 
								name = guilds_buff_grain
								months = 12
							}
						}
						50 = {
							add_province_modifier = { 
								name = guilds_buff_linen
								months = 24
							}
						}
						50 = {
							add_province_modifier = { 
								name = guilds_buff_lumber
								months = 36
							}
						}
						50 = {
							add_province_modifier = { 
								name = guilds_buff_incense
								months = 48
							}
						}
						50 = {
							add_province_modifier = { 
								name = guilds_buff_spices
								months = 60
							}
						}
						50 = {
							add_province_modifier = { 
								name = guilds_buff_meat
								months = 12
							}
						}
						50 = {
							add_province_modifier = { 
								name = guilds_buff_wool
								months = 24
							}
						}
						50 = {
							add_province_modifier = { 
								name = guilds_buff_hide
								months = 36
							}
						}
						50 = {
							add_province_modifier = { 
								name = guilds_buff_ivory
								months = 48
							}
						}
						50 = {
							add_province_modifier = { 
								name = guilds_buff_silk
								months = 60
							}
						}
						50 = {
							add_province_modifier = { 
								name = guilds_buff_pottery
								months = 12
							}
						}
						50 = {
							add_province_modifier = { 
								name = guilds_buff_alcohol
								months = 24
							}
						}
						50 = {
							add_province_modifier = { 
								name = guilds_buff_armor
								months = 36
							}
						}
						50 = {
							add_province_modifier = { 
								name = guilds_buff_jewelry
								months = 48
							}
						}
						50 = {
							add_province_modifier = { 
								name = guilds_buff_book
								months = 60
							}
						}
					}
				}
			}
			3 = {
				trigger = {
					has_character_flag = guilds_center_debt
				}
			}
		}
	}
}

#Center of trade 5 year problem
character_event = {
    id = SNW.342
	picture = GFX_evt_council_quarrelling_unused
	border = GFX_event_normal_frame_economy_guilds

	desc = {
		trigger = { has_character_flag = guilds_center_asset }
		text = EVTDESC_SNW_342_A
	}
	desc = {
		trigger = { has_character_flag = guilds_center_gold }
		text = EVTDESC_SNW_342_B
	}
	desc = {
		trigger = { has_character_flag = guilds_center_goods }
		text = EVTDESC_SNW_342_C
	}
	
    is_triggered_only = yes
	only_rulers = yes	
	
	trigger = {
		any_demesne_province = {
			any_province_holding = { 
				owner = { character = ROOT }
				has_holding_modifier = guilds_center_trade 
			}
		}
	}
	
	immediate = {
		set_character_flag = guilds_is_using_goods
		random_list = {
			1 = { 
				set_character_flag = guilds_center_asset
			}
			1 = {
				set_character_flag = guilds_center_gold
			}
			1 = {
				set_character_flag = guilds_center_goods
			}
		}
	}
	
    option = {#cheaper asset
        name = EVTOPTA_SNW_342
		trigger = {
			society_currency >= 250
			has_character_flag = guilds_center_asset
			society_member_of = the_guilds
		}
		change_society_currency = -250
    }
    option = {#normal asset
        name = EVTOPTB_SNW_342
		trigger = {
			society_currency >= 500
			NOT = { has_character_flag = guilds_center_asset }
			society_member_of = the_guilds
		}
		change_society_currency = -500
    }
    option = {#gold
        name = EVTOPTC_SNW_342
		if = {
			limit = {
				has_character_flag = guilds_center_gold
			}
			scaled_wealth = { value = -1 min = -100 max = -1000 }
		}
		if = {
			limit = {
				NOT = { has_character_flag = guilds_center_gold }
			}
			scaled_wealth = { value = -2 min = -200 max = -2000 }
		}
    }
    option = {#cheaper goods
        name = EVTOPTD_SNW_342
		trigger = {
			any_artifact = {
				count == 1
				has_artifact_flag = goods
				quality >= 3
			}
			has_character_flag = guilds_center_goods
		}
		random_artifact = {
			limit = { 
				has_artifact_flag = goods 
				quality >= 3
			}
			destroy_artifact = yes
		}
    }
    option = {#normal goods
        name = EVTOPTE_SNW_342
		trigger = {
			any_artifact = {
				count = 2
				has_artifact_flag = goods
				quality >= 3
			}
			NOT = { has_character_flag = guilds_center_goods }
		}
		random_artifact = {
			limit = { 
				has_artifact_flag = goods 
				quality >= 3
			}
			destroy_artifact = yes
		}
		random_artifact = {
			limit = { 
				has_artifact_flag = goods 
				quality >= 3
			}
			destroy_artifact = yes
		}
    }
    option = {#no_goods
        name = EVTOPTG_SNW_342
		trigger = {
			NAND = {
				AND = {
					any_artifact = {
						count == 1
						has_artifact_flag = goods
						quality >= 3
					}
					has_character_flag = guilds_center_goods
				}
				AND = {
					any_artifact = {
						count = 2
						has_artifact_flag = goods
						quality >= 3
					}
					NOT = { has_character_flag = guilds_center_goods }
				}
			}
		}
		set_character_flag = guilds_center_debt
		character_event = { id = SNW.343 days = 720 }
		custom_tooltip = { text = guilds_center_trade_goods }
    }
    option = {#not paying
        name = EVTOPTF_SNW_342
		set_character_flag = guilds_center_debt
		character_event = { id = SNW.343 days = 720 }
	}
	after = {
		clr_character_flag = guilds_is_using_goods
		clr_character_flag = guilds_center_asset
		clr_character_flag = guilds_center_gold
		clr_character_flag = guilds_center_goods
	}
}

#Center of trade last chance
character_event = {
    id = SNW.343
    desc = EVTDESC_SNW_343
	picture = GFX_evt_leaving_table_angrily_unused
	border = GFX_event_normal_frame_economy_guilds
	
    is_triggered_only = yes

	immediate = {
		set_character_flag = guilds_is_using_goods
	}

    option = {#asset
        name = EVTOPTA_SNW_343
		trigger = {
			society_currency >= 500
			society_member_of = the_guilds
		}
		change_society_currency = -500
    }
    option = {#gold
        name = EVTOPTB_SNW_343
		scaled_wealth = -2
    }
    option = {#goods
        name = EVTOPTC_SNW_343
		trigger = {
			any_artifact = {
				count = 2
				has_artifact_flag = goods
				quality >= 3
			}
		}
		random_artifact = {
			limit = { 
				has_artifact_flag = goods 
				quality >= 3
			}
			destroy_artifact = yes
		}
		random_artifact = {
			limit = { 
				has_artifact_flag = goods 
				quality >= 3
			}
			destroy_artifact = yes
		}
    }
    option = {#let it go
        name = EVTOPTD_SNW_343
		hidden_tooltip = {
			any_realm_province = {
				any_province_holding = { 
					limit = { owner = { character = ROOT } }
					remove_holding_modifier = guilds_center_trade 
				}
			}
		}
    }
	after = {
		clr_character_flag = guilds_is_using_goods
		clr_character_flag = guilds_center_debt
	}
}

#Center of trade pillaged
character_event = {
    id = SNW.344
    desc = EVTDESC_SNW_344
	picture = GFX_evt_burning_house
	border = GFX_event_normal_frame_economy_guilds
	
    is_triggered_only = yes


    option = {
        name = EVTOPTA_SNW_344
    }
	after = {
		clr_character_flag = guilds_center_debt
	}
}

#AI-Request Ask for gold or assets 
character_event = {
	id = SNW.350
	hide_window = yes

	only_rulers = yes
	ai = yes
	is_triggered_only = yes
	
	trigger = { society_member_of = the_guilds }
	
	immediate = {
		if = {
			limit = {
				society_currency <= 200
				wealth = 300
			}
			random_society_member = {
				limit = {
					same_society_as = ROOT
					is_inaccessible_trigger = no
				}
				letter_event = { id = SNW.351 days = 100 random = 30 } #request asset
			}
		}
		if = {
			limit = {
				society_currency >= 300
				NOT = { wealth = 100 }
			}
			random_society_member = {
				limit = {
					same_society_as = ROOT
					is_inaccessible_trigger = no
				}
				letter_event = { id = SNW.352 days = 100 random = 30 } #request gold
			}
		}
	}
}

#AI-Request for asset
letter_event = {
	id = SNW.351
    desc = EVTDESC_SNW_351
	# picture = GFX_evt_throne_room
	border = GFX_event_letter_frame_economy_guilds
	
	is_triggered_only = yes
	
    option = {#accept
        name = EVTOPTA_SNW_351
		trigger = {
			society_currency >= 200
		}
		change_society_currency = -200
		wealth = 250
		FROM = { character_event = { id = SNW.3511 } }
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
		ai_chance = {
			factor = 1
			modifier = {
				factor = 2
				NOT = {
					wealth = 100
				}
			}
			modifier = {
				factor = 0.5
				NOT = {
					society_currency >= 300
				}
			}
		}
    }
    option = {#refuse
        name = EVTOPTB_SNW_351
		trigger = {
			society_currency >= 200
		}
    }
    option = {#Cannot
        name = EVTOPTC_SNW_351
		trigger = {
			NOT = { society_currency = 200 }
		}
    }
}

#AI-Request receive asset
character_event = {
	id = SNW.3511
	hide_window = yes

	is_triggered_only = yes
	
	immediate = {
		change_society_currency = 200
		wealth = -250
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
}

#AI-Request for gold
letter_event = {
	id = SNW.352
    desc = EVTDESC_SNW_352
	# picture = GFX_evt_throne_room
	border = GFX_event_letter_frame_economy_guilds
	
	is_triggered_only = yes
	
    option = {#accept
        name = EVTOPTA_SNW_352
		change_society_currency = 250
		wealth = -200
		FROM = { character_event = { id = SNW.3522 } }
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
		ai_chance = {
			factor = 1
			modifier = {
				factor = 2
				NOT = {
					society_currency = 100
				}
			}
			modifier = {
				factor = 0.5
				NOT = {
					wealth = 200
				}
			}
			modifier = {
				factor = 0
				NOT = {
					wealth = 0
				}
			}
		}
    }
    option = {#refuse
        name = EVTOPTB_SNW_352
    }
}

#AI-Request receive gold
character_event = {
	id = SNW.3522
	hide_window = yes

	is_triggered_only = yes
	
	immediate = {
		change_society_currency = -250
		wealth = 200
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
}

#Force AI to sell goods since they cannot spend on province.
character_event = {
	id = SNW.353
	hide_window = yes
	
	is_triggered_only = yes
	
	only_rulers = yes
	ai = yes
	
	trigger = {
		society_member_of = the_guilds
		OR = {
			society_rank == 1
			AND = {
				is_landed = no
				is_patrician = yes
			}
			any_artifact = {
				count = 5
				has_artifact_flag = goods
			}
			AND = {
				any_artifact = {
					count = 3
					has_artifact_flag = goods
				}
				tier = baron
			}
		}
		any_artifact = {
			has_artifact_flag = goods
		}
	}
	
	immediate = {
		random_list = {
			50 = { }
			50 = { change_variable = { which = guildsxp value = 1 } }
		}
		if = {
			limit = {
				NOT = { yearly_income = 100 }
			}
			random_list = {
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_stone
						}
					}
					wealth = 25
					destroy_artifact = guilds_item_stone
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_grain
						}
					}
					wealth = 25
					destroy_artifact = guilds_item_grain
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_meat
						}
					}
					wealth = 25
					destroy_artifact = guilds_item_meat
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_pottery
						}
					}
					wealth = 25
					destroy_artifact = guilds_item_pottery
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_steel
						}
					}
					wealth = 50
					destroy_artifact = guilds_item_steel
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_lumber
						}
					}
					wealth = 50
					destroy_artifact = guilds_item_lumber
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_wool
						}
					}
					wealth = 50
					destroy_artifact = guilds_item_wool
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_alcohol
						}
					}
					wealth = 50
					destroy_artifact = guilds_item_alcohol
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_gem
						}
					}
					wealth = 75
					destroy_artifact = guilds_item_gem
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_linen
						}
					}
					wealth = 75
					destroy_artifact = guilds_item_linen
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_hide
						}
					}
					wealth = 75
					destroy_artifact = guilds_item_hide
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_armor
						}
					}
					wealth = 75
					destroy_artifact = guilds_item_armor
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_silver
						}
					}
					wealth = 100
					destroy_artifact = guilds_item_silver
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_incense
						}
					}
					wealth = 100
					destroy_artifact = guilds_item_incense
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_ivory
						}
					}
					wealth = 100
					destroy_artifact = guilds_item_ivory
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_jewelry
						}
					}
					wealth = 100
					destroy_artifact = guilds_item_jewelry
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_gold
						}
					}
					wealth = 125
					destroy_artifact = guilds_item_gold
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_spices
						}
					}
					wealth = 125
					destroy_artifact = guilds_item_spices
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_silk
						}
					}
					wealth = 125
					destroy_artifact = guilds_item_silk
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_book
						}
					}
					wealth = 125
					destroy_artifact = guilds_item_book
				}
			}
		}
		if = {
			limit = {
				yearly_income = 100
				NOT = { yearly_income = 500 }
			}
			random_list = {
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_stone
						}
					}
					wealth = 75
					destroy_artifact = guilds_item_stone
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_grain
						}
					}
					wealth = 75
					destroy_artifact = guilds_item_grain
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_meat
						}
					}
					wealth = 75
					destroy_artifact = guilds_item_meat
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_pottery
						}
					}
					wealth = 75
					destroy_artifact = guilds_item_pottery
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_steel
						}
					}
					wealth = 150
					destroy_artifact = guilds_item_steel
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_lumber
						}
					}
					wealth = 150
					destroy_artifact = guilds_item_lumber
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_wool
						}
					}
					wealth = 150
					destroy_artifact = guilds_item_wool
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_alcohol
						}
					}
					wealth = 150
					destroy_artifact = guilds_item_alcohol
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_gem
						}
					}
					wealth = 225
					destroy_artifact = guilds_item_gem
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_linen
						}
					}
					wealth = 225
					destroy_artifact = guilds_item_linen
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_hide
						}
					}
					wealth = 225
					destroy_artifact = guilds_item_hide
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_armor
						}
					}
					wealth = 225
					destroy_artifact = guilds_item_armor
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_silver
						}
					}
					wealth = 300
					destroy_artifact = guilds_item_silver
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_incense
						}
					}
					wealth = 300
					destroy_artifact = guilds_item_incense
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_ivory
						}
					}
					wealth = 300
					destroy_artifact = guilds_item_ivory
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_jewelry
						}
					}
					wealth = 300
					destroy_artifact = guilds_item_jewelry
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_gold
						}
					}
					wealth = 375
					destroy_artifact = guilds_item_gold
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_spices
						}
					}
					wealth = 375
					destroy_artifact = guilds_item_spices
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_silk
						}
					}
					wealth = 375
					destroy_artifact = guilds_item_silk
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_book
						}
					}
					wealth = 375
					destroy_artifact = guilds_item_book
				}
			}
		}
		if = {
			limit = {
				yearly_income = 500
			}
			random_list = {
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_stone
						}
					}
					wealth = 125
					destroy_artifact = guilds_item_stone
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_grain
						}
					}
					wealth = 125
					destroy_artifact = guilds_item_grain
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_meat
						}
					}
					wealth = 125
					destroy_artifact = guilds_item_meat
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_pottery
						}
					}
					wealth = 125
					destroy_artifact = guilds_item_pottery
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_steel
						}
					}
					wealth = 250
					destroy_artifact = guilds_item_steel
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_lumber
						}
					}
					wealth = 250
					destroy_artifact = guilds_item_lumber
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_wool
						}
					}
					wealth = 250
					destroy_artifact = guilds_item_wool
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_alcohol
						}
					}
					wealth = 250
					destroy_artifact = guilds_item_alcohol
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_gem
						}
					}
					wealth = 375
					destroy_artifact = guilds_item_gem
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_linen
						}
					}
					wealth = 375
					destroy_artifact = guilds_item_linen
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_hide
						}
					}
					wealth = 375
					destroy_artifact = guilds_item_hide
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_armor
						}
					}
					wealth = 375
					destroy_artifact = guilds_item_armor
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_silver
						}
					}
					wealth = 500
					destroy_artifact = guilds_item_silver
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_incense
						}
					}
					wealth = 500
					destroy_artifact = guilds_item_incense
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_ivory
						}
					}
					wealth = 500
					destroy_artifact = guilds_item_ivory
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_jewelry
						}
					}
					wealth = 500
					destroy_artifact = guilds_item_jewelry
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_gold
						}
					}
					wealth = 625
					destroy_artifact = guilds_item_gold
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_spices
						}
					}
					wealth = 625
					destroy_artifact = guilds_item_spices
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_silk
						}
					}
					wealth = 625
					destroy_artifact = guilds_item_silk
				}
				20 = {
					modifier = {
						factor = 0
						NOT = {
							has_artifact = guilds_item_book
						}
					}
					wealth = 625
					destroy_artifact = guilds_item_book
				}
			}
		}
	}
}

#Mission: Build a City
character_event = {
    id = SNW.360
    hide_window = yes
    is_triggered_only = yes
    immediate = { FROM = { society_quest_event = { id = SNW.361 days = 7 random = 7 } } }
}

#Build a city
society_quest_event = {
    id = SNW.361
    desc = EVTDESC_SNW_361

    is_triggered_only = yes
   
    option = {
		name = ACCEPT

		set_quest = quest_guilds_build_city

		hidden_effect = { character_event = { id = SNW.3621 days = 720 random = 50 } }
	}

	option = {
		name = DECLINE
		custom_tooltip = { text = decline_quest_tooltip }

		add_character_modifier = {
			name = quest_cooldown_timer
			hidden = yes
			days = 1000
		}

		ai_chance = { factor = 0 }
	}
}

#Build a city PRE PING to give wood 
character_event = {
    id = SNW.3621
    hide_window = yes
    is_triggered_only = yes

	trigger = {
		has_quest = quest_guilds_build_city
	}
	
    immediate = {
		society = {
    		random_society_member = {
    			limit = { 	
					NOT = { character = ROOT }
					prisoner = no
    				is_within_diplo_range = ROOT
					opinion = { who = ROOT value = 0 }
    			}
    			character_event = { id = SNW.362 }
    		}
    	}
    }
}

#Build a city PING to give wood
character_event = {
    id = SNW.362
    hide_window = yes
    is_triggered_only = yes

    immediate = {
		FROM = { character_event = { id = SNW.363 } }
    }
}

#Build a city receive wood
character_event = {
    id = SNW.363
    desc = EVTDESC_SNW_363
	picture = GFX_evt_council
	border = GFX_event_normal_frame_economy_guilds

    is_triggered_only = yes

	trigger = {
		any_demesne_province = {
			has_settlement_construction = no			
		}
	}
	
	option = { #Get Wood
		name = EVTOPTA_SNW_363
		trigger = {
			society_currency >= 150
		}
		change_society_currency = -150
		add_artifact = guilds_item_lumber
		hidden_tooltip = {
			ROOT = {
				change_variable = { which = guildsxp value = 1 }
			}
		}
	}
	option = { #Nothing
		name = EVTOPTB_SNW_363
		trigger = {
			society_currency >= 150
		}
	}
	option = { #No asset
		name = EVTOPTC_SNW_363
		trigger = {
			NOT = { society_currency >= 150 }
		}
	}
}

#Build a city constructed
character_event = {
	id = SNW.364
	is_triggered_only = yes
	hide_window = yes
	
	trigger = {
		has_quest = quest_guilds_build_city
		FROM = {
			holding_type = city
		}
	}
	
	immediate = {
		FROM = { save_event_target_as = guilds_new_city }
		society = {
			random_society_member = {
				limit = {
					NOT = { character = ROOT }
					# same_society_as = ROOT
					society_rank = 4
				}
				character_event = { id = SNW.365 }
			}
		}
	}
}

#Build a city PING city done
character_event = {
	id = SNW.365
	is_triggered_only = yes
	hide_window = yes

	immediate = {
		FROM = {
			letter_event = { id = SNW.366 }
		}
	}
}

#Build a city completed
letter_event = {
	id = SNW.366
	desc = EVTDESC_SNW_366
	border = GFX_event_letter_frame_economy_guilds

	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_SNW_366
		clr_quest = quest_guilds_build_city
		sound_effect = monastic_orders_donate_charity
		add_society_currency_major_effect = yes
		event_target:guilds_new_city = {
			add_holding_modifier = {
				name = guilds_bustling_new_city
				years = 20
			}
			
		}
	}
}

#Mapmode Society membership
letter_event = {
    id = SNW.370
    desc = EVTDESC_SNW_370
	# picture = GFX_evt_riots_byzantine
	border = GFX_event_letter_frame_economy_guilds
	
    is_triggered_only = yes

    option = {
        name = EVTOPTA_SNW_370
		hidden_tooltip = {
			any_province  = {
				remove_province_modifier = guilds_mapmode_yes
				remove_province_modifier = guilds_mapmode_no
				remove_province_modifier = guilds_mapmode_caravan
			}
			clr_character_flag = guilds_mapmode
		}
    }
}

#Market Crash start check
character_event = {
    id = SNW.380
	hide_window = yes
    is_triggered_only = yes
	
	ai = no
	
	trigger = {
		has_game_rule = {
			name = guilds_rule_war
			value = default
		}
		society_influence = {
			society = the_guilds
			value >= 75
		}
		OR = {
			had_global_flag = { flag = guilds_market_crash_check days = 3600 } #10 years
			NOT = { has_global_flag = guilds_market_crash_check }
		}
		OR = {
			had_global_flag = { flag = guilds_market_crash_cooldown days = 18000 } #50 years 
			NOT = { has_global_flag = guilds_market_crash_cooldown }
		}
		NOT = { has_global_flag = guilds_market_crash_start }
	}
	
    immediate = {
		set_global_flag = guilds_market_crash_check
    	character_event = { id = SNW.381 days = 180 }
    }
}

#Market Crash start check ping
character_event = {
    id = SNW.381
	hide_window = yes
    is_triggered_only = yes
	
	ai = no
	
	trigger = {
		NOT = { has_global_flag = guilds_market_crash_start }
	}
	
    immediate = {
		random_list = {
			30 = { #nothing, recheck
				trigger = {
					society_influence = {
						society = the_guilds
						value >= 60
					}
				}
				character_event = { id = SNW.381 days = 180 }
			}
			10 = { #crash avoided
				trigger = {
					society_influence = {
						society = the_guilds
						value <= 69
					}
				}
				clr_global_flag = guilds_market_crash_check
			}
			20 = { #trade war
				trigger = {
					society_influence = {
						society = the_guilds
						value >= 70
					}
				}
				modifier = {
					factor = 1.2
					society_influence = {
						society = the_guilds
						value >= 75
					}
				}
				modifier = {
					factor = 1.2
					society_influence = {
						society = the_guilds
						value >= 80
					}
				}
				modifier = {
					factor = 1.2
					society_influence = {
						society = the_guilds
						value >= 85
					}
				}
				modifier = {
					factor = 1.2
					society_influence = {
						society = the_guilds
						value >= 90
					}
				}
				modifier = {
					factor = 1.2
					society_influence = {
						society = the_guilds
						value >= 95
					}
				}
				modifier = {
					factor = 1.2
					society_influence = {
						society = the_guilds
						value >= 100
					}
				}
				any_player = {
					narrative_event = { id = SNW.382 }
				}
				clr_global_flag = guilds_market_crash_check
				set_global_flag = guilds_market_crash_start
			}
		}
    }
}

#Market Crash start announcement
narrative_event = { 
    id = SNW.382
	title = EVTITLE_SNW_382
	# desc = EVTDESC_SNW_382
	picture = GFX_evt_council_quarrelling_unused
	border = GFX_event_narrative_frame_economy_guilds
	
	is_triggered_only = yes
	
	AI = NO
	
	desc = {
		trigger = { society_member_of = the_guilds }
		text = EVTDESC_SNW_382_MEMBER
	}
	desc = {
		trigger = { NOT = { society_member_of = the_guilds } }
		text = EVTDESC_SNW_382_OUTSIDER
	}
	
	option = { #member fight
		trigger = { society_member_of = the_guilds }
		name = EVTOPTA_SNW_382
	}
	option = { #outsider fight
		trigger = { NOT = { society_member_of = the_guilds } }
		name = EVTOPTB_SNW_382
	}
	option = { #stay out
		name = EVTOPTC_SNW_382
		set_character_flag = guilds_market_crash_refuse
	}	
	after = {
		add_character_modifier = {
			modifier = guilds_market_crash_tracker
			months = 120
			inherit = yes
		}
		hidden_tooltip = {
			set_variable = { which = "global_guilds_var_league" value = 50 } 
			set_variable = { which = "global_guilds_var_outsider" value = 50 }
			clr_global_flag = guilds_market_stable_dealflag 
			clr_global_flag = guilds_market_crashed_dealflag 
		}
	}
}

#Market Crash spend ...
character_event = {
    id = SNW.383
    # desc = EVTDESC_SNW_383
	picture = GFX_evt_council_quarrelling_unused
	border = GFX_event_normal_frame_economy_guilds

	desc = {
		trigger = { society_member_of = the_guilds }
		text = EVTDESC_SNW_383_MEMBER
	}
	desc = {
		trigger = { NOT = { society_member_of = the_guilds } }
		text = EVTDESC_SNW_383_OUTSIDER
	}
	
    is_triggered_only = yes
	only_rulers = yes
	has_global_flag = guilds_market_crash_start

	trigger = {
		OR = {
			ai = no
			society_member_of = the_guilds
			higher_tier_than = duke
		}
		NOT = { has_character_flag = guilds_market_crash_refuse }
	}
	
	option = { #gold
		name = EVTOPTA_SNW_383
		character_event = { id = SNW.3831 }
		ai_chance = {
			factor = 1
			modifier = {
				factor = 0
				NOT = { scaled_wealth = { value = 0.33 min = 100 } }
			}
		}
	}
	option = { #society currency
		name = EVTOPTB_SNW_383
		trigger = {
			society_currency >= 100
		}
		character_event = { id = SNW.3832 }
		ai_chance = {
			factor = 1
			modifier = {
				factor = 0
				society_currency <= 200
			}
		}
	}
	option = { #prestige
		name = EVTOPTC_SNW_383
		trigger = {
			prestige >= 100
		}
		character_event = { id = SNW.3833 }
		ai_chance = {
			factor = 1
			modifier = {
				factor = 0
				prestige <= 150
			}
		}
	}
	option = { #nothing
		name = EVTOPTD_SNW_383
		ai_chance = {
			factor = 3
			modifier = {
				factor = 2.5
				society_member_of = the_guilds
			}
			modifier = { #try to keep em close
				factor = 1.5
				society_member_of = the_guilds
				check_variable = { which = "global_guilds_var_league" value >= 65 }
			}
			modifier = {
				factor = 1.5
				NOT = { society_member_of = the_guilds }
				check_variable = { which = "global_guilds_var_outsider" value >= 65 }
			}
		}
	}
}

#Market Crash spend gold
character_event = {
    id = SNW.3831
    desc = EVTDESC_SNW_3831
	picture = GFX_evt_council_quarrelling_unused
	border = GFX_event_normal_frame_economy_guilds
	
    is_triggered_only = yes
	
	option = { 
		name = EVTOPTA_SNW_3831
		scaled_wealth = { value = -0.33 min = -100 max = -200 }
		set_character_flag = guilds_market_crash_invested
		hidden_tooltip = {
			if = {
				limit = {
					society_member_of = the_guilds
				}
				change_variable = { which = global_guilds_var_league value = 1 }
				change_variable = { which = global_guilds_var_outsider value = -1 }
			}
			else = {
				change_variable = { which = global_guilds_var_outsider value = 1 }
				change_variable = { which = global_guilds_var_league value = -1 }
			}
		}
		character_event = { id = SNW.384 days = 1 }
	}
	option = {
		name = EVTOPTB_SNW_3831
		trigger = { 
			OR = {
				AI = no
				scaled_wealth = 0.5
			}
		}
		scaled_wealth = { value = -0.66 min = -200 max = -400 }
		set_character_flag = guilds_market_crash_invested
		hidden_tooltip = {
			if = {
				limit = {
					society_member_of = the_guilds
				}
				change_variable = { which = global_guilds_var_league value = 3 }
				change_variable = { which = global_guilds_var_outsider value = -3 }
				guilds_add_influence_inflation = yes
			}
			else = {
				change_variable = { which = global_guilds_var_outsider value = 3 }
				change_variable = { which = global_guilds_var_league value = -3 }
			}
		}
		character_event = { id = SNW.384 days = 1 }
		ai_chance = {
			factor = 1
			modifier = {
				factor = 0
				NOT = { scaled_wealth = { value = 0.66 min = 200 } }
			}
			modifier = {
				factor = 0.5
				NOT = { scaled_wealth = { value = 1 min = 300 } }
			}
		}
	}
	option = { 
		name = EVTOPTC_SNW_3831
		trigger = { 
			OR = {
				AI = no
				scaled_wealth = 0.75
			}
		}
		scaled_wealth = { value = -1 min = -300 max = -600 }
		set_character_flag = guilds_market_crash_invested
		hidden_tooltip = {
			if = {
				limit = {
					society_member_of = the_guilds
				}
				change_variable = { which = global_guilds_var_league value = 5 }
				change_variable = { which = global_guilds_var_outsider value = -5 }
				guilds_add_influence_inflation_long = yes
			}
			else = {
				change_variable = { which = global_guilds_var_outsider value = 5 }
				change_variable = { which = global_guilds_var_league value = -5 }
			}
		}
		character_event = { id = SNW.384 days = 1 }
		ai_chance = {
			factor = 1
			modifier = {
				factor = 0
				NOT = { scaled_wealth = { value = 1 min = 300 } }
			}
			modifier = {
				factor = 0.5
				NOT = { scaled_wealth = { value = 1.5 min = 500 } }
			}
		}
	}
	option = { #return
		name = EVTOPTD_SNW_3831
		character_event = { id = SNW.383 }
		ai_chance = {
			factor = 0
		}
	}
}

#Market Crash spend society
character_event = {
    id = SNW.3832
    desc = EVTDESC_SNW_3832
	picture = GFX_evt_council_quarrelling_unused
	border = GFX_event_normal_frame_economy_guilds
	
    is_triggered_only = yes
	
	option = { 
		name = EVTOPTA_SNW_3832
		change_society_currency = -100
		set_character_flag = guilds_market_crash_invested
		hidden_tooltip = {
			if = {
				limit = {
					society_member_of = the_guilds
				}
				change_variable = { which = global_guilds_var_league value = 1 }
				change_variable = { which = global_guilds_var_outsider value = -1 }
			}
			else = {
				change_variable = { which = global_guilds_var_outsider value = 1 }
				change_variable = { which = global_guilds_var_league value = -1 }
			}
		}
		character_event = { id = SNW.384 days = 1 }
	}
	option = {
		name = EVTOPTB_SNW_3832
		trigger = {
			society_currency >= 250
		}
		change_society_currency = -250
		set_character_flag = guilds_market_crash_invested
		hidden_tooltip = {
			if = {
				limit = {
					society_member_of = the_guilds
				}
				change_variable = { which = global_guilds_var_league value = 3 }
				change_variable = { which = global_guilds_var_outsider value = -3 }
				guilds_add_influence_inflation = yes
			}
			else = {
				change_variable = { which = global_guilds_var_outsider value = 3 }
				change_variable = { which = global_guilds_var_league value = -3 }
			}
		}
		character_event = { id = SNW.384 days = 1 }
	}
	option = {
		name = EVTOPTC_SNW_3832
		trigger = {
			society_currency >= 500
		}
		change_society_currency = -500
		set_character_flag = guilds_market_crash_invested
		hidden_tooltip = {
			if = {
				limit = {
					society_member_of = the_guilds
				}
				change_variable = { which = global_guilds_var_league value = 5 }
				change_variable = { which = global_guilds_var_outsider value = -5 }
				guilds_add_influence_inflation_long = yes
			}
			else = {
				change_variable = { which = global_guilds_var_outsider value = 5 }
				change_variable = { which = global_guilds_var_league value = -5 }
			}
		}
		character_event = { id = SNW.384 days = 1 }
	}
	option = { #return
		name = EVTOPTD_SNW_3832
		character_event = { id = SNW.383 }
		ai_chance = {
			factor = 0
		}
	}
}

#Market Crash spend prestige
character_event = {
    id = SNW.3833
    desc = EVTDESC_SNW_3833
	picture = GFX_evt_council_quarrelling_unused
	border = GFX_event_normal_frame_economy_guilds
	
    is_triggered_only = yes
	
	option = {
		name = EVTOPTA_SNW_3833
		prestige = -100
		set_character_flag = guilds_market_crash_invested
		hidden_tooltip = {
			if = {
				limit = {
					society_member_of = the_guilds
				}
				change_variable = { which = global_guilds_var_league value = 1 }
				change_variable = { which = global_guilds_var_outsider value = -1 }
			}
			else = {
				change_variable = { which = global_guilds_var_outsider value = 1 }
				change_variable = { which = global_guilds_var_league value = -1 }
			}
		}
		character_event = { id = SNW.384 days = 1 }
	}
	option = {
		name = EVTOPTB_SNW_3833
		prestige = -250
		set_character_flag = guilds_market_crash_invested
		hidden_tooltip = {
			if = {
				limit = {
					society_member_of = the_guilds
				}
				change_variable = { which = global_guilds_var_league value = 3 }
				change_variable = { which = global_guilds_var_outsider value = -3 }
				guilds_add_influence_inflation = yes
			}
			else = {
				change_variable = { which = global_guilds_var_outsider value = 3 }
				change_variable = { which = global_guilds_var_league value = -3 }
			}
		}
		character_event = { id = SNW.384 days = 1 }
		ai_chance = {
			factor = 1
			modifier = {
				factor = 0
				prestige <= 250
			}
			modifier = {
				factor = 0.5
				prestige >= 251
				prestige <= 500
			}
		}
	}
	option = {
		name = EVTOPTC_SNW_3833
		prestige = -500
		set_character_flag = guilds_market_crash_invested
		hidden_tooltip = {
			if = {
				limit = {
					society_member_of = the_guilds
				}
				change_variable = { which = global_guilds_var_league value = 5 }
				change_variable = { which = global_guilds_var_outsider value = -5 }
				guilds_add_influence_inflation_long = yes
			}
			else = {
				change_variable = { which = global_guilds_var_outsider value = 5 }
				change_variable = { which = global_guilds_var_league value = -5 }
			}
		}
		character_event = { id = SNW.384 days = 1 }
		ai_chance = {
			factor = 1
			modifier = {
				factor = 0
				prestige <= 500
			}
			modifier = {
				factor = 0.5
				prestige >= 501
				prestige <= 750
			}
		}
	}
	option = {
		name = EVTOPTD_SNW_3833
		character_event = { id = SNW.383 }
		ai_chance = {
			factor = 0
		}
	}
}

#Market Crash end check
character_event = {
    id = SNW.384
	hide_window = yes
    is_triggered_only = yes
	
	
	# ai = no
	has_global_flag = guilds_market_crash_start
	
	trigger = {
		OR = {
			society_influence = {
				society = the_guilds
				value <= 40
			}
			check_variable = { which = "global_guilds_var_outsider" value >= 75 }
			check_variable = { which = "global_guilds_var_league" value >= 75 }
		}
	}
	
    immediate = {
		if = {
			limit = { #crash averted
				society_influence = {
					society = the_guilds
					value <= 40
				}
			}
			set_global_flag = guilds_market_stable_dealflag 
			any_character = {
				limit = {
					NOT = { has_character_flag = guilds_market_crash_refuse }
					OR = {
						ai = no
						society_member_of = the_guilds
						higher_tier_than = duke
					}
				}
				narrative_event = { id = SNW.385 } #days = 100 }
			}
			any_player = { 
				limit = {
					has_character_flag = guilds_market_crash_refuse
				}
				remove_character_modifier = guilds_market_crash_tracker
				clr_character_flag = guilds_market_crash_invested
				clr_character_flag = guilds_market_crash_refuse
				hidden_tooltip = {
					set_variable = { which = "global_guilds_var_league" value = 0 }
					set_variable = { which = "global_guilds_var_outsider" value = 0 }
				}
			}
		}
		else_if = {
			limit = { #outsiders won
				check_variable = { which = "global_guilds_var_outsider" value >= 75 }
			}
			random_society_member = {
				limit = { society_member_of = the_guilds }
				guilds_add_influence_market_crash = yes #try to target society itself maybe
			}
			set_global_flag = guilds_market_crashed_dealflag 
			any_character = {
				limit = {
					NOT = { has_character_flag = guilds_market_crash_refuse }
					OR = {
						ai = no
						society_member_of = the_guilds
						higher_tier_than = duke
					}
				}
				narrative_event = { id = SNW.386 } #days = 100 }
			}
			any_player = { 
				limit = {
					has_character_flag = guilds_market_crash_refuse
				}
				remove_character_modifier = guilds_market_crash_tracker
				clr_character_flag = guilds_market_crash_invested
				clr_character_flag = guilds_market_crash_refuse
				hidden_tooltip = {
					set_variable = { which = "global_guilds_var_league" value = 0 }
					set_variable = { which = "global_guilds_var_outsider" value = 0 }
				}
			}
		}
		else_if = {
			limit = { #league won
				check_variable = { which = "global_guilds_var_league" value >= 75 }
			}
			random_society_member = {
				limit = { society_member_of = the_guilds }
				guilds_add_influence_market_boom = yes
			}
			any_character = {
				limit = {
					NOT = { has_character_flag = guilds_market_crash_refuse }
					OR = {
						ai = no
						society_member_of = the_guilds
						higher_tier_than = duke
					}
				}
				narrative_event = { id = SNW.387 } #days = 100 }
			}
			any_player = { 
				limit = {
					has_character_flag = guilds_market_crash_refuse
				}
				remove_character_modifier = guilds_market_crash_tracker
				clr_character_flag = guilds_market_crash_invested
				clr_character_flag = guilds_market_crash_refuse
				hidden_tooltip = {
					set_variable = { which = "global_guilds_var_league" value = 0 }
					set_variable = { which = "global_guilds_var_outsider" value = 0 }
				}
			}
		}
    }
	after = {
		clr_global_flag = guilds_market_crash_start
		clr_global_flag = guilds_market_crash_check
		clr_global_flag = guilds_market_crash_cooldown
		set_global_flag = guilds_market_crash_cooldown
	}
}

#Market Crash end stabilise
narrative_event = { 
    id = SNW.385
	title = EVTITLE_SNW_385
	# desc = EVTDESC_SNW_385
	picture = GFX_evt_council_agreement_unused
	border = GFX_event_narrative_frame_economy_guilds
	
	is_triggered_only = yes
	
	desc = {
		trigger = { society_member_of = the_guilds }
		text = EVTDESC_SNW_385_MEMBER
		picture = GFX_evt_leaving_table_angrily_unused
	}
	desc = {
		trigger = { NOT = { society_member_of = the_guilds } }
		text = EVTDESC_SNW_385_OUTSIDER
		picture = GFX_evt_council_agreement_unused
	}
	
	option = { #trader
		trigger = { 
			society_member_of = the_guilds
			has_character_flag = guilds_market_crash_invested 
		}
		name = EVTOPTA_SNW_385
	}
	option = { #trader ignored
		trigger = { 
			society_member_of = the_guilds
			NOT = { has_character_flag = guilds_market_crash_invested }
		}
		name = EVTOPTB_SNW_385
	}
	option = { #king
		trigger = { 
			NOT = { society_member_of = the_guilds } 
			has_character_flag = guilds_market_crash_invested 
		}
		name = EVTOPTC_SNW_385
	}
	option = { #king ignored
		trigger = { 
			NOT = { society_member_of = the_guilds } 
			NOT = { has_character_flag = guilds_market_crash_invested }
		}
		name = EVTOPTD_SNW_385
	}
	after = {
		clr_character_flag = guilds_market_crash_invested
		clr_character_flag = guilds_market_crash_refuse
		hidden_tooltip = {
			set_variable = { which = "global_guilds_var_league" value = 0 }
			set_variable = { which = "global_guilds_var_outsider" value = 0 }
		}
		hidden_tooltip = {
			any_player = {
				remove_character_modifier = guilds_market_crash_tracker
			}
		}
	}
}

#Market Crash end crash
narrative_event = { 
    id = SNW.386
	title = EVTITLE_SNW_386
	# desc = EVTDESC_SNW_386
	picture = GFX_evt_leaving_table_angrily_unused
	border = GFX_event_narrative_frame_economy_guilds
	
	is_triggered_only = yes
	
	desc = {
		trigger = { society_member_of = the_guilds }
		text = EVTDESC_SNW_386_MEMBER
		picture = GFX_evt_leaving_table_angrily_unused
	}
	desc = {
		trigger = { NOT = { society_member_of = the_guilds } }
		text = EVTDESC_SNW_386_OUTSIDER
		picture = GFX_evt_council_agreement_unused
	}
	
	option = { #trader lost
		trigger = { 
			society_member_of = the_guilds
			has_character_flag = guilds_market_crash_invested 
		}
		name = EVTOPTA_SNW_386
		add_character_modifier = {
			modifier = guilds_market_crash_trader_malus
			months = 240
			inherit = yes
		}
	}
	option = { #trader ignored
		trigger = { 
			society_member_of = the_guilds
			NOT = { has_character_flag = guilds_market_crash_invested }
		}
		name = EVTOPTB_SNW_386
		add_character_modifier = {
			modifier = guilds_market_crash_trader_malus
			months = 240
			inherit = yes
		}
		change_society_currency = -300
	}
	option = { #king won
		trigger = { 
			NOT = { society_member_of = the_guilds } 
			has_character_flag = guilds_market_crash_invested 
		}
		name = EVTOPTC_SNW_386
		add_character_modifier = {
			modifier = guilds_market_crash_king_bonus
			months = 240
			inherit = yes
		}
		prestige = 300
		scaled_wealth = { value = 2 min = 500 max = 1000 }
	}
	option = { #king ignored
		trigger = { 
			NOT = { society_member_of = the_guilds } 
			NOT = { has_character_flag = guilds_market_crash_invested }
		}
		name = EVTOPTD_SNW_386
		add_character_modifier = {
			modifier = guilds_market_crash_king_bonus
			months = 240
			inherit = yes
		}
	}
	after = {
		clr_character_flag = guilds_market_crash_invested
		clr_character_flag = guilds_market_crash_refuse
		hidden_tooltip = {
			set_variable = { which = "global_guilds_var_league" value = 0 }
			set_variable = { which = "global_guilds_var_outsider" value = 0 }
		}
		hidden_tooltip = {
			any_player = {
				remove_character_modifier = guilds_market_crash_tracker
			}
		}
	}
}

#Market Crash end boom
narrative_event = { 
    id = SNW.387
	title = EVTITLE_SNW_387
	# desc = EVTDESC_SNW_387
	picture = GFX_evt_council_agreement_unused
	border = GFX_event_narrative_frame_economy_guilds
	
	is_triggered_only = yes
	
	desc = {
		trigger = { society_member_of = the_guilds }
		text = EVTDESC_SNW_387_MEMBER
		picture = GFX_evt_council_agreement_unused
	}
	desc = {
		trigger = { NOT = { society_member_of = the_guilds } }
		text = EVTDESC_SNW_387_OUTSIDER
		picture = GFX_evt_leaving_table_angrily_unused
	}
	
	option = { #trader won
		trigger = { 
			society_member_of = the_guilds
			has_character_flag = guilds_market_crash_invested 
		}
		name = EVTOPTA_SNW_387
		add_character_modifier = {
			modifier = guilds_market_crash_trader_bonus
			months = 240
			inherit = yes
		}
		change_society_currency = 300
		scaled_wealth = { value = 2 min = 500 max = 1000 }
		set_character_flag = guilds_market_crash_won_flag
	}
	option = { #trader ignored
		trigger = { 
			society_member_of = the_guilds
			NOT = { has_character_flag = guilds_market_crash_invested }
		}
		name = EVTOPTB_SNW_387
		add_character_modifier = {
			modifier = guilds_market_crash_trader_bonus
			months = 240
			inherit = yes
		}
	}
	option = { #king lost
		trigger = { 
			NOT = { society_member_of = the_guilds } 
			has_character_flag = guilds_market_crash_invested 
		}
		name = EVTOPTC_SNW_387
		add_character_modifier = {
			modifier = guilds_market_crash_king_malus
			months = 240
			inherit = yes
		}
	}
	option = { #king ignored
		trigger = { 
			NOT = { society_member_of = the_guilds } 
			NOT = { has_character_flag = guilds_market_crash_invested }
		}
		name = EVTOPTD_SNW_387
		add_character_modifier = {
			modifier = guilds_market_crash_king_malus
			months = 240
			inherit = yes
		}
		prestige = -300
	}
	after = {
		clr_character_flag = guilds_market_crash_invested
		clr_character_flag = guilds_market_crash_refuse
		hidden_tooltip = {
			set_variable = { which = "global_guilds_var_league" value = 0 }
			set_variable = { which = "global_guilds_var_outsider" value = 0 }
		}
		hidden_tooltip = {
			any_player = {
				remove_character_modifier = guilds_market_crash_tracker
			}
		}
	}
}

#Resource - start up
character_event = {
    id = SNW.390
	hide_window = yes
    is_triggered_only = yes
	
	ai = no
	only_playable = yes

    trigger = {
		NOT = { has_global_flag = guilds_resources_set }
		has_game_rule = {
			name = guilds_rule_resource
			value = default
		}
    }
    immediate = {
		any_province = {
			limit = {
				NOR = {
					has_province_modifier = guilds_res_stone
					has_province_modifier = guilds_res_steel
					has_province_modifier = guilds_res_gem
					has_province_modifier = guilds_res_silver
					has_province_modifier = guilds_res_gold
					has_province_modifier = guilds_res_grain
					has_province_modifier = guilds_res_lumber
					has_province_modifier = guilds_res_linen
					has_province_modifier = guilds_res_incense
					has_province_modifier = guilds_res_spices
					has_province_modifier = guilds_res_meat
					has_province_modifier = guilds_res_wool
					has_province_modifier = guilds_res_hide
					has_province_modifier = guilds_res_ivory
					has_province_modifier = guilds_res_silk
				}
			}
			random_list = {
				400 = { }
				25 = {
					modifier = {
						factor = 2
						OR = {
							terrain = hills
							terrain = mountain
						}
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = forest
							terrain = jungle
						}
					}
					add_province_modifier = {
						name = guilds_res_stone
						duration = -1
						hidden = yes
					}
					province_event = { id = SNW.391 }
				}
				25 = {
					modifier = {
						factor = 3
						terrain = farmlands
					}
					modifier = {
						factor = 1.5
						OR = {
							terrain = plains
							terrain = steppe
						}
					}
					modifier = {
						factor = 0.75
						OR = {
							terrain = hills
							terrain = forest
						}
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = jungle
							terrain = desert
						}
					}
					modifier = {
						factor = 0.1
						terrain = arctic
						terrain = mountain
					}
					modifier = {
						factor = 1.5
						OR = {
							borders_lake = yes
							borders_major_river = yes
						}
					}
					add_province_modifier = {
						name = guilds_res_grain
						duration = -1
						hidden = yes
					}
					province_event = { id = SNW.391 }
				}
				25 = {
					modifier = {
						factor = 2
						terrain = farmlands
					}
					modifier = {
						factor = 1.5
						OR = {
							port = yes
							terrain = forest
						}
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = mountain
							terrain = desert
						}
					}
					add_province_modifier = {
						name = guilds_res_meat
						duration = -1
						hidden = yes
					}
					province_event = { id = SNW.391 }
				}
				20 = {
					modifier = {
						factor = 2
						OR = {
							terrain = hills
							terrain = mountain
						}
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = forest
							terrain = jungle
						}
					}
					add_province_modifier = {
						name = guilds_res_steel
						duration = -1
						hidden = yes
					}
					province_event = { id = SNW.391 }
				}
				20 = {
					modifier = {
						factor = 3
						OR = {
							terrain = forest
							terrain = jungle
						}
					}
					modifier = {
						factor = 0.75
						OR = {
							terrain = farmlands
							terrain = steppe
						}
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = mountain
							terrain = arctic
						}
					}
					modifier = {
						factor = 0.1
						terrain = desert
					}
					add_province_modifier = {
						name = guilds_res_lumber
						duration = -1
						hidden = yes
					}
					province_event = { id = SNW.391 }
				}
				20 = {
					modifier = {
						factor = 2
						OR = {
							terrain = plains
							terrain = steppe
						}
					}
					modifier = {
						factor = 1.5
						OR = {
							terrain = farmlands
							terrain = hills
						}
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = mountain
							terrain = forest
							terrain = jungle
							terrain = arctic
						}
					}
					add_province_modifier = {
						name = guilds_res_wool
						duration = -1
						hidden = yes
					}
					province_event = { id = SNW.391 }
				}
				15 = {
					modifier = {
						factor = 2
						OR = {
							terrain = hills
							terrain = mountain
						}
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = forest
							terrain = jungle
						}
					}
					add_province_modifier = {
						name = guilds_res_gem
						duration = -1
						hidden = yes
					}
					province_event = { id = SNW.391 }
				}
				15 = {
					modifier = {
						factor = 3
						terrain = farmlands
					}
					modifier = {
						factor = 1.5
						OR = {
							terrain = plains
							terrain = steppe
						}
					}
					modifier = {
						factor = 0.75
						OR = {
							terrain = hills
							terrain = forest
						}
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = jungle
							terrain = mountain
						}
					}
					modifier = {
						factor = 0.25
						OR = {
							terrain = arctic
							terrain = desert
						}
					}
					modifier = {
						factor = 1.5
						OR = {
							borders_lake = yes
							borders_major_river = yes
						}
					}
					add_province_modifier = {
						name = guilds_res_linen
						duration = -1
						hidden = yes
					}
					province_event = { id = SNW.391 }
				}
				15 = {
					modifier = {
						factor = 1.5
						OR = {
							terrain = farmlands
							terrain = forest
							terrain = steppe
						}
					}
					modifier = {
						factor = 0.75
						terrain = hills
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = jungle
							terrain = mountain
							terrain = desert
						}
					}
					add_province_modifier = {
						name = guilds_res_hide
						duration = -1
						hidden = yes
					}
					province_event = { id = SNW.391 }
				}
				10 = {
					modifier = {
						factor = 2
						OR = {
							terrain = hills
							terrain = mountain
						}
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = forest
							terrain = jungle
						}
					}
					add_province_modifier = {
						name = guilds_res_silver
						duration = -1
						hidden = yes
					}
					province_event = { id = SNW.391 }
				}
				10 = {
					modifier = {
						factor = 3
						OR = {
							terrain = jungle
							terrain = desert
						}
					}
					modifier = {
						factor = 0.50
						OR = {
							terrain = forest
							terrain = hills
							terrain = farmlands
							terrain = plains
						}
					}
					modifier = {
						factor = 0.25
						terrain = mountain
					}
					modifier = {
						factor = 0.1
						terrain = arctic
					}
					add_province_modifier = {
						name = guilds_res_incense
						duration = -1
						hidden = yes
					}
					province_event = { id = SNW.391 }
				}
				10 = {
					modifier = {
						factor = 3
						OR = {
							terrain = jungle
							terrain = desert
						}
					}
					modifier = {
						factor = 2
						terrain = arctic
						port = yes
					}
					modifier = {
						factor = 1.25
						terrain = arctic
						port = no
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = forest
							terrain = farmlands
							terrain = plains
							terrain = steppe
						}
					}
					modifier = {
						factor = 0.25
						OR = {
							terrain = mountain
							terrain = hills
						}
					}
					add_province_modifier = {
						name = guilds_res_ivory
						duration = -1
						hidden = yes
					}
					province_event = { id = SNW.391 }
				}
				5 = {
					modifier = {
						factor = 2
						OR = {
							terrain = hills
							terrain = mountain
						}
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = forest
							terrain = jungle
						}
					}
					modifier = {
						factor = 4
						trade_route = trans_saharan_trade_route
					}
					add_province_modifier = {
						name = guilds_res_gold
						duration = -1
						hidden = yes
					}
					province_event = { id = SNW.391 }
				}
				5 = {
					modifier = {
						factor = 3
						OR = {
							terrain = jungle
							terrain = desert
						}
					}
					modifier = {
						factor = 0.75
						OR = {
							terrain = plains
							terrain = steppe
						}
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = forest
							terrain = hills
						}
					}
					modifier = {
						factor = 0.1
						OR = {
							terrain = mountain
							terrain = arctic
						}
					}
					add_province_modifier = {
						name = guilds_res_spices
						duration = -1
						hidden = yes
					}
					province_event = { id = SNW.391 }
				}
				5 = {
					modifier = {
						factor = 5
						trade_route = silk_road
					}
					modifier = {
						factor = 0.75
						OR = {
							terrain = forest
							terrain = hills
						}
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = mountain
							terrain = arctic
						}
					}
					add_province_modifier = {
						name = guilds_res_silk
						duration = -1
						hidden = yes
					}
					province_event = { id = SNW.391 }
				}
			}
		}
		set_global_flag = guilds_resources_set
    }
}

#Resource - maintenace - province ping to ping
province_event = {
    id = SNW.391
	is_triggered_only = yes
	hide_window = yes

	trigger = { #will stop the event circle if the province's resource vanish/is moved.
		OR = {
			has_province_modifier = guilds_res_stone
			has_province_modifier = guilds_res_steel
			has_province_modifier = guilds_res_gem
			has_province_modifier = guilds_res_silver
			has_province_modifier = guilds_res_gold
			has_province_modifier = guilds_res_grain
			has_province_modifier = guilds_res_lumber
			has_province_modifier = guilds_res_linen
			has_province_modifier = guilds_res_incense
			has_province_modifier = guilds_res_spices
			has_province_modifier = guilds_res_meat
			has_province_modifier = guilds_res_wool
			has_province_modifier = guilds_res_hide
			has_province_modifier = guilds_res_ivory
			has_province_modifier = guilds_res_silk
		}
	}
	
    immediate = {
		province_event = { id = SNW.392 days = 600 random = 200 }
    }
}

#Resource - maintenace - province ping to character
province_event = {
    id = SNW.392
	is_triggered_only = yes
	hide_window = yes

	
	trigger = {
		capital_holding = {
			OR = {
				holding_type = tribal
				holding_type = temple
				holding_type = castle
				holding_type = city
				holding_type = nomad
			}
		}
	}
	
	fail_trigger_effect = { #restart, dormant resource for empty nomad
		province_event = { id = SNW.391 }
		# trigger_switch = {
			# on_trigger = has_province_modifier
			# guilds_res_stone = { 
				# remove_province_modifier = guilds_res_stone
			# }
			# guilds_res_grain = {
				# remove_province_modifier = guilds_res_grain
			# }
			# guilds_res_meat = { 
				# remove_province_modifier = guilds_res_meat
			# }
			# guilds_res_steel = {
				# remove_province_modifier = guilds_res_steel
			# }
			# guilds_res_lumber = { 
				# remove_province_modifier = guilds_res_lumber
			# }
			# guilds_res_wool = {
				# remove_province_modifier = guilds_res_wool
			# }
			# guilds_res_gem = {
				# remove_province_modifier = guilds_res_gem
			# }
			# guilds_res_linen = {
				# remove_province_modifier = guilds_res_linen
			# }
			# guilds_res_hide = { 
				# remove_province_modifier = guilds_res_hide
			# }
			# guilds_res_silver = { 
				# remove_province_modifier = guilds_res_silver
			# }
			# guilds_res_incense = {
				# remove_province_modifier = guilds_res_incense
			# }
			# guilds_res_ivory = { 
				# remove_province_modifier = guilds_res_ivory
			# }
			# guilds_res_gold = {
				# remove_province_modifier = guilds_res_gold
			# }
			# guilds_res_spices = {
				# remove_province_modifier = guilds_res_spices
			# }
			# guilds_res_silk = { 
				# remove_province_modifier = guilds_res_silk
			# }
		# }
	}
	
    immediate = {
		owner = { 
			random_list = {
				75 = { character_event = { id = SNW.3921 } } #get good
				10 = { character_event = { id = SNW.3922 } } #help money/asset
				10 = { character_event = { id = SNW.3923 } } #bountiful
				4 = { character_event = { id = SNW.3924 } } #help or destroyed
				2 = { character_event = { id = SNW.3925 } } #destroyed
			}
		}
    }
}

#Resource - maintenace - get good
character_event = {
    id = SNW.3921
	is_triggered_only = yes
	hide_window = yes

    immediate = {
		FROM = {
			trigger_switch = {
				on_trigger = has_province_modifier
				guilds_res_stone = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_stone
						}
						else = {
							scaled_wealth = { value = 0.10 min = 10 max = 100 }
						}
					}
				}
				guilds_res_grain = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_grain
						}
						else = {
							scaled_wealth = { value = 0.05 min = 5 max = 50 }
						}
					}
				}
				guilds_res_meat = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_meat
						}
						else = {
							scaled_wealth = { value = 0.05 min = 5 max = 50 }
						}
					}
				}
				guilds_res_steel = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_steel
						}
						else = {
							scaled_wealth = { value = 0.30 min = 30 max = 300 }
						}
					}
				}
				guilds_res_lumber = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_lumber
						}
						else = {
							scaled_wealth = { value = 0.30 min = 30 max = 300 }
						}
					}
				}
				guilds_res_wool = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_wool
						}
						else = {
							scaled_wealth = { value = 0.30 min = 30 max = 300 }
						}
					}
				}
				guilds_res_gem = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_gem
						}
						else = {
							scaled_wealth = { value = 0.55 min = 55 max = 550 }
						}
					}
				}
				guilds_res_linen = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_linen
						}
						else = {
							scaled_wealth = { value = 0.55 min = 55 max = 550 }
						}
					}
				}
				guilds_res_hide = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_hide
						}
						else = {
							scaled_wealth = { value = 0.55 min = 55 max = 550 }
						}
					}
				}
				guilds_res_silver = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_silver
						}
						else = {
							scaled_wealth = { value = 0.80 min = 80 max = 800 }
						}
					}
				}
				guilds_res_incense = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_incense
						}
						else = {
							scaled_wealth = { value = 0.80 min = 80 max = 800 }
						}
					}
				}
				guilds_res_ivory = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_ivory
						}
						else = {
							scaled_wealth = { value = 0.80 min = 80 max = 800 }
						}
					}
				}
				guilds_res_gold = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_gold
						}
						else = {
							scaled_wealth = { value = 1.05 min = 105 max = 1050 }
						}
					}
				}
				guilds_res_spices = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_spices
						}
						else = {
							scaled_wealth = { value = 1.05 min = 105 max = 1050 }
						}
					}
				}
				guilds_res_silk = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_silk
						}
						else = {
							scaled_wealth = { value = 1.05 min = 105 max = 1050 }
						}
					}
				}
			}
			province_event = { id = SNW.391 }
		}
		if = {
			limit = {
				FROM = {
					OR = {
						has_province_modifier = guilds_res_stone
						has_province_modifier = guilds_res_grain
						has_province_modifier = guilds_res_meat
					}
					has_province_modifier = guilds_res_help
				}
			}
			scaled_wealth = { value = -0.05 min = -5 max = -50 }
		}
		else_if = {
			limit = {
				FROM = {
					OR = {
						has_province_modifier = guilds_res_steel
						has_province_modifier = guilds_res_lumber
						has_province_modifier = guilds_res_wool
					}
					has_province_modifier = guilds_res_help
				}
			}
			scaled_wealth = { value = -0.15 min = -15 max = -150 }
		}
		else_if = {
			limit = {
				FROM = {
					OR = {
						has_province_modifier = guilds_res_gem
						has_province_modifier = guilds_res_linen
						has_province_modifier = guilds_res_hide
					}
					has_province_modifier = guilds_res_help
				}
			}
			scaled_wealth = { value = -0.27 min = -27 max = -275 }
		}
		else_if = {
			limit = {
				FROM = {
					OR = {
						has_province_modifier = guilds_res_silver
						has_province_modifier = guilds_res_incense
						has_province_modifier = guilds_res_ivory
					}
					has_province_modifier = guilds_res_help
				}
			}
			scaled_wealth = { value = -0.40 min = -40 max = -400 }
		}
		else_if = {
			limit = {
				FROM = {
					OR = {
						has_province_modifier = guilds_res_gold
						has_province_modifier = guilds_res_spices
						has_province_modifier = guilds_res_silk
					}
					has_province_modifier = guilds_res_help
				}
			}
			scaled_wealth = { value = -0.52 min = -52 max = -525 }
		}
    }
}

#Resource - maintenace - spend for return
character_event = {
    id = SNW.3922
    desc = EVTDESC_SNW_3922
	picture = GFX_evt_stressed_ruler
	border = GFX_event_normal_frame_economy_guilds
	
    is_triggered_only = yes
	
	show_root = yes
	
	option = { #prestige name
		name = EVTOPTA_SNW_3922
		# trigger = { 
			# NOT = { society_member_of = the_guilds }
		# }
		if = {
			limit = {
				OR = {
					tier = emperor
					tier = king
				}
			}
			prestige = -300 #maybe
		}
		else = {
			prestige = -100
		}
		if = {
			limit = {
				society_member_of = the_guilds
			}
			change_society_currency = -100
		}
		random = {
			chance = 80
			FROM = {
				trigger_switch = {
					on_trigger = has_province_modifier
					guilds_res_stone = { 
						ROOT = {
							if = {
								limit = {
									society_member_of = the_guilds
								}
								add_artifact = guilds_item_stone
							}
							else = {
								scaled_wealth = { value = 0.10 min = 10 max = 100 }
							}
						}
					}
					guilds_res_grain = { 
						ROOT = {
							if = {
								limit = {
									society_member_of = the_guilds
								}
								add_artifact = guilds_item_grain
							}
							else = {
								scaled_wealth = { value = 0.05 min = 5 max = 50 }
							}
						}
					}
					guilds_res_meat = { 
						ROOT = {
							if = {
								limit = {
									society_member_of = the_guilds
								}
								add_artifact = guilds_item_meat
							}
							else = {
								scaled_wealth = { value = 0.05 min = 5 max = 50 }
							}
						}
					}
					guilds_res_steel = { 
						ROOT = {
							if = {
								limit = {
									society_member_of = the_guilds
								}
								add_artifact = guilds_item_steel
							}
							else = {
								scaled_wealth = { value = 0.30 min = 30 max = 300 }
							}
						}
					}
					guilds_res_lumber = { 
						ROOT = {
							if = {
								limit = {
									society_member_of = the_guilds
								}
								add_artifact = guilds_item_lumber
							}
							else = {
								scaled_wealth = { value = 0.30 min = 30 max = 300 }
							}
						}
					}
					guilds_res_wool = { 
						ROOT = {
							if = {
								limit = {
									society_member_of = the_guilds
								}
								add_artifact = guilds_item_wool
							}
							else = {
								scaled_wealth = { value = 0.30 min = 30 max = 300 }
							}
						}
					}
					guilds_res_gem = { 
						ROOT = {
							if = {
								limit = {
									society_member_of = the_guilds
								}
								add_artifact = guilds_item_gem
							}
							else = {
								scaled_wealth = { value = 0.55 min = 55 max = 550 }
							}
						}
					}
					guilds_res_linen = { 
						ROOT = {
							if = {
								limit = {
									society_member_of = the_guilds
								}
								add_artifact = guilds_item_linen
							}
							else = {
								scaled_wealth = { value = 0.55 min = 55 max = 550 }
							}
						}
					}
					guilds_res_hide = { 
						ROOT = {
							if = {
								limit = {
									society_member_of = the_guilds
								}
								add_artifact = guilds_item_hide
							}
							else = {
								scaled_wealth = { value = 0.55 min = 55 max = 550 }
							}
						}
					}
					guilds_res_silver = { 
						ROOT = {
							if = {
								limit = {
									society_member_of = the_guilds
								}
								add_artifact = guilds_item_silver
							}
							else = {
								scaled_wealth = { value = 0.80 min = 80 max = 800 }
							}
						}
					}
					guilds_res_incense = { 
						ROOT = {
							if = {
								limit = {
									society_member_of = the_guilds
								}
								add_artifact = guilds_item_incense
							}
							else = {
								scaled_wealth = { value = 0.80 min = 80 max = 800 }
							}
						}
					}
					guilds_res_ivory = { 
						ROOT = {
							if = {
								limit = {
									society_member_of = the_guilds
								}
								add_artifact = guilds_item_ivory
							}
							else = {
								scaled_wealth = { value = 0.80 min = 80 max = 800 }
							}
						}
					}
					guilds_res_gold = { 
						ROOT = {
							if = {
								limit = {
									society_member_of = the_guilds
								}
								add_artifact = guilds_item_gold
							}
							else = {
								scaled_wealth = { value = 1.05 min = 105 max = 1050 }
							}
						}
					}
					guilds_res_spices = { 
						ROOT = {
							if = {
								limit = {
									society_member_of = the_guilds
								}
								add_artifact = guilds_item_spices
							}
							else = {
								scaled_wealth = { value = 1.05 min = 105 max = 1050 }
							}
						}
					}
					guilds_res_silk = { 
						ROOT = {
							if = {
								limit = {
									society_member_of = the_guilds
								}
								add_artifact = guilds_item_silk
							}
							else = {
								scaled_wealth = { value = 1.05 min = 105 max = 1050 }
							}
						}
					}
				}
			}
			if = {
				limit = {
					FROM = {
						OR = {
							has_province_modifier = guilds_res_stone
							has_province_modifier = guilds_res_grain
							has_province_modifier = guilds_res_meat
						}
						has_province_modifier = guilds_res_help
					}
				}
				custom_tooltip = { text = guilds_resource_tax }
				scaled_wealth = { value = -0.05 min = -5 max = -5 }
			}
			else_if = {
				limit = {
					FROM = {
						OR = {
							has_province_modifier = guilds_res_steel
							has_province_modifier = guilds_res_lumber
							has_province_modifier = guilds_res_wool
						}
						has_province_modifier = guilds_res_help
					}
				}
				custom_tooltip = { text = guilds_resource_tax } 
				scaled_wealth = { value = -0.15 min = -15 max = -150 }
			}
			else_if = {
				limit = {
					FROM = {
						OR = {
							has_province_modifier = guilds_res_gem
							has_province_modifier = guilds_res_linen
							has_province_modifier = guilds_res_hide
						}
						has_province_modifier = guilds_res_help
					}
				}
				custom_tooltip = { text = guilds_resource_tax } 
				scaled_wealth = { value = -0.27 min = -27 max = -275 }
			}
			else_if = {
				limit = {
					FROM = {
						OR = {
							has_province_modifier = guilds_res_silver
							has_province_modifier = guilds_res_incense
							has_province_modifier = guilds_res_ivory
						}
						has_province_modifier = guilds_res_help
					}
				}
				custom_tooltip = { text = guilds_resource_tax } 
				scaled_wealth = { value = -0.40 min = -40 max = -400 }
			}
			else_if = {
				limit = {
					FROM = {
						OR = {
							has_province_modifier = guilds_res_gold
							has_province_modifier = guilds_res_spices
							has_province_modifier = guilds_res_silk
						}
						has_province_modifier = guilds_res_help
					}
				}
				custom_tooltip = { text = guilds_resource_tax } 
				scaled_wealth = { value = -0.52 min = -52 max = -525 }
			}
		}
	}
	option = { #asset
		name = EVTOPTB_SNW_3922
		trigger = { 
			society_member_of = the_guilds 
			society_currency = 200
		}
		change_society_currency = -200
		FROM = {
			trigger_switch = {
				on_trigger = has_province_modifier
				guilds_res_stone = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_stone
						}
						else = {
							scaled_wealth = { value = 0.05 min = 5 max = 50 }
						}
					}
				}
				guilds_res_grain = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_grain
						}
						else = {
							scaled_wealth = { value = 0.05 min = 5 max = 50 }
						}
					}
				}
				guilds_res_meat = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_meat
						}
						else = {
							scaled_wealth = { value = 0.05 min = 5 max = 50 }
						}
					}
				}
				guilds_res_steel = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_steel
						}
						else = {
							scaled_wealth = { value = 0.30 min = 30 max = 300 }
						}
					}
				}
				guilds_res_lumber = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_lumber
						}
						else = {
							scaled_wealth = { value = 0.30 min = 30 max = 300 }
						}
					}
				}
				guilds_res_wool = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_wool
						}
						else = {
							scaled_wealth = { value = 0.30 min = 30 max = 300 }
						}
					}
				}
				guilds_res_gem = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_gem
						}
						else = {
							scaled_wealth = { value = 0.55 min = 55 max = 550 }
						}
					}
				}
				guilds_res_linen = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_linen
						}
						else = {
							scaled_wealth = { value = 0.55 min = 55 max = 550 }
						}
					}
				}
				guilds_res_hide = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_hide
						}
						else = {
							scaled_wealth = { value = 0.55 min = 55 max = 550 }
						}
					}
				}
				guilds_res_silver = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_silver
						}
						else = {
							scaled_wealth = { value = 0.80 min = 80 max = 800 }
						}
					}
				}
				guilds_res_incense = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_incense
						}
						else = {
							scaled_wealth = { value = 0.80 min = 80 max = 800 }
						}
					}
				}
				guilds_res_ivory = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_ivory
						}
						else = {
							scaled_wealth = { value = 0.80 min = 80 max = 800 }
						}
					}
				}
				guilds_res_gold = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_gold
						}
						else = {
							scaled_wealth = { value = 1.05 min = 105 max = 1050 }
						}
					}
				}
				guilds_res_spices = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_spices
						}
						else = {
							scaled_wealth = { value = 1.05 min = 105 max = 1050 }
						}
					}
				}
				guilds_res_silk = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_silk
						}
						else = {
							scaled_wealth = { value = 1.05 min = 105 max = 1050 }
						}
					}
				}
			}
		}
		if = {
			limit = {
				FROM = {
					OR = {
						has_province_modifier = guilds_res_stone
						has_province_modifier = guilds_res_grain
						has_province_modifier = guilds_res_meat
					}
					has_province_modifier = guilds_res_help
				}
			}
			custom_tooltip = { text = guilds_resource_tax }
			scaled_wealth = { value = -0.025 min = -3 max = -25 }
		}
		else_if = {
			limit = {
				FROM = {
					OR = {
						has_province_modifier = guilds_res_steel
						has_province_modifier = guilds_res_lumber
						has_province_modifier = guilds_res_wool
					}
					has_province_modifier = guilds_res_help
				}
			}
			custom_tooltip = { text = guilds_resource_tax } 
			scaled_wealth = { value = -0.15 min = -15 max = -150 }
		}
		else_if = {
			limit = {
				FROM = {
					OR = {
						has_province_modifier = guilds_res_gem
						has_province_modifier = guilds_res_linen
						has_province_modifier = guilds_res_hide
					}
					has_province_modifier = guilds_res_help
				}
			}
			custom_tooltip = { text = guilds_resource_tax } 
			scaled_wealth = { value = -0.27 min = -27 max = -275 }
		}
		else_if = {
			limit = {
				FROM = {
					OR = {
						has_province_modifier = guilds_res_silver
						has_province_modifier = guilds_res_incense
						has_province_modifier = guilds_res_ivory
					}
					has_province_modifier = guilds_res_help
				}
			}
			custom_tooltip = { text = guilds_resource_tax } 
			scaled_wealth = { value = -0.40 min = -40 max = -400 }
		}
		else_if = {
			limit = {
				FROM = {
					OR = {
						has_province_modifier = guilds_res_gold
						has_province_modifier = guilds_res_spices
						has_province_modifier = guilds_res_silk
					}
					has_province_modifier = guilds_res_help
				}
			}
			custom_tooltip = { text = guilds_resource_tax } 
			scaled_wealth = { value = -0.52 min = -52 max = -525 }
		}
	}
	option = { #nothing
		name = EVTOPTC_SNW_3922
	}
	after = {
		FROM = { province_event = { id = SNW.391 } }
	}
}

#Resource - maintenace - bountiful
character_event = {
    id = SNW.3923
    desc = EVTDESC_SNW_3923
	picture = GFX_evt_relaxed_ruler
	border = GFX_event_normal_frame_economy_guilds
	
    is_triggered_only = yes
	
	show_root = yes
	
	option = {
		name = EVTOPTA_SNW_3923
		FROM = {
			trigger_switch = {
				on_trigger = has_province_modifier
				guilds_res_stone = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_stone
						}
						else = {
							scaled_wealth = { value = 0.10 min = 10 max = 100 }
						}
					}
				}
				guilds_res_grain = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_grain
						}
						else = {
							scaled_wealth = { value = 0.05 min = 5 max = 50 }
						}
					}
				}
				guilds_res_meat = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_meat
						}
						else = {
							scaled_wealth = { value = 0.05 min = 5 max = 50 }
						}
					}
				}
				guilds_res_steel = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_steel
						}
						else = {
							scaled_wealth = { value = 0.30 min = 30 max = 300 }
						}
					}
				}
				guilds_res_lumber = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_lumber
						}
						else = {
							scaled_wealth = { value = 0.30 min = 30 max = 300 }
						}
					}
				}
				guilds_res_wool = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_wool
						}
						else = {
							scaled_wealth = { value = 0.30 min = 30 max = 300 }
						}
					}
				}
				guilds_res_gem = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_gem
						}
						else = {
							scaled_wealth = { value = 0.55 min = 55 max = 550 }
						}
					}
				}
				guilds_res_linen = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_linen
						}
						else = {
							scaled_wealth = { value = 0.55 min = 55 max = 550 }
						}
					}
				}
				guilds_res_hide = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_hide
						}
						else = {
							scaled_wealth = { value = 0.55 min = 55 max = 550 }
						}
					}
				}
				guilds_res_silver = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_silver
						}
						else = {
							scaled_wealth = { value = 0.80 min = 80 max = 800 }
						}
					}
				}
				guilds_res_incense = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_incense
						}
						else = {
							scaled_wealth = { value = 0.80 min = 80 max = 800 }
						}
					}
				}
				guilds_res_ivory = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_ivory
						}
						else = {
							scaled_wealth = { value = 0.80 min = 80 max = 800 }
						}
					}
				}
				guilds_res_gold = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_gold
						}
						else = {
							scaled_wealth = { value = 1.05 min = 105 max = 1050 }
						}
					}
				}
				guilds_res_spices = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_spices
						}
						else = {
							scaled_wealth = { value = 1.05 min = 105 max = 1050 }
						}
					}
				}
				guilds_res_silk = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_silk
						}
						else = {
							scaled_wealth = { value = 1.05 min = 105 max = 1050 }
						}
					}
				}
			}
			trigger_switch = {
				on_trigger = has_province_modifier
				guilds_res_stone = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_stone
						}
						else = {
							scaled_wealth = { value = 0.10 min = 10 max = 100 }
						}
					}
				}
				guilds_res_grain = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_grain
						}
						else = {
							scaled_wealth = { value = 0.05 min = 5 max = 50 }
						}
					}
				}
				guilds_res_meat = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_meat
						}
						else = {
							scaled_wealth = { value = 0.05 min = 5 max = 50 }
						}
					}
				}
				guilds_res_steel = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_steel
						}
						else = {
							scaled_wealth = { value = 0.30 min = 30 max = 300 }
						}
					}
				}
				guilds_res_lumber = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_lumber
						}
						else = {
							scaled_wealth = { value = 0.30 min = 30 max = 300 }
						}
					}
				}
				guilds_res_wool = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_wool
						}
						else = {
							scaled_wealth = { value = 0.30 min = 30 max = 300 }
						}
					}
				}
				guilds_res_gem = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_gem
						}
						else = {
							scaled_wealth = { value = 0.55 min = 55 max = 550 }
						}
					}
				}
				guilds_res_linen = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_linen
						}
						else = {
							scaled_wealth = { value = 0.55 min = 55 max = 550 }
						}
					}
				}
				guilds_res_hide = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_hide
						}
						else = {
							scaled_wealth = { value = 0.55 min = 55 max = 550 }
						}
					}
				}
				guilds_res_silver = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_silver
						}
						else = {
							scaled_wealth = { value = 0.80 min = 80 max = 800 }
						}
					}
				}
				guilds_res_incense = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_incense
						}
						else = {
							scaled_wealth = { value = 0.80 min = 80 max = 800 }
						}
					}
				}
				guilds_res_ivory = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_ivory
						}
						else = {
							scaled_wealth = { value = 0.80 min = 80 max = 800 }
						}
					}
				}
				guilds_res_gold = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_gold
						}
						else = {
							scaled_wealth = { value = 1.05 min = 105 max = 1050 }
						}
					}
				}
				guilds_res_spices = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_spices
						}
						else = {
							scaled_wealth = { value = 1.05 min = 105 max = 1050 }
						}
					}
				}
				guilds_res_silk = { 
					ROOT = {
						if = {
							limit = {
								society_member_of = the_guilds
							}
							add_artifact = guilds_item_silk
						}
						else = {
							scaled_wealth = { value = 1.05 min = 105 max = 1050 }
						}
					}
				}
			}
		}
		if = {
			limit = {
				FROM = {
					OR = {
						has_province_modifier = guilds_res_stone
						has_province_modifier = guilds_res_grain
						has_province_modifier = guilds_res_meat
					}
					has_province_modifier = guilds_res_help
				}
			}
			custom_tooltip = { text = guilds_resource_tax }
			scaled_wealth = { value = -0.10 min = -10 max = -100 }
		}
		else_if = {
			limit = {
				FROM = {
					OR = {
						has_province_modifier = guilds_res_steel
						has_province_modifier = guilds_res_lumber
						has_province_modifier = guilds_res_wool
					}
					has_province_modifier = guilds_res_help
				}
			}
			custom_tooltip = { text = guilds_resource_tax } 
			scaled_wealth = { value = -0.3 min = -30 max = -300 }
		}
		else_if = {
			limit = {
				FROM = {
					OR = {
						has_province_modifier = guilds_res_gem
						has_province_modifier = guilds_res_linen
						has_province_modifier = guilds_res_hide
					}
					has_province_modifier = guilds_res_help
				}
			}
			custom_tooltip = { text = guilds_resource_tax } 
			scaled_wealth = { value = -0.55 min = -55 max = -550 }
		}
		else_if = {
			limit = {
				FROM = {
					OR = {
						has_province_modifier = guilds_res_silver
						has_province_modifier = guilds_res_incense
						has_province_modifier = guilds_res_ivory
					}
					has_province_modifier = guilds_res_help
				}
			}
			custom_tooltip = { text = guilds_resource_tax } 
			scaled_wealth = { value = -0.80 min = -80 max = -800 }
		}
		else_if = {
			limit = {
				FROM = {
					OR = {
						has_province_modifier = guilds_res_gold
						has_province_modifier = guilds_res_spices
						has_province_modifier = guilds_res_silk
					}
					has_province_modifier = guilds_res_help
				}
			}
			custom_tooltip = { text = guilds_resource_tax } 
			scaled_wealth = { value = -1.05 min = -105 max = -1050 }
		}
	}
	
	after = {
		FROM = { province_event = { id = SNW.391 } }
	}
}

#Resource - maintenace - spend or lose
character_event = {
    id = SNW.3924
    desc = EVTDESC_SNW_3924
	picture = GFX_evt_stressed_ruler
	border = GFX_event_normal_frame_economy_guilds
	
    is_triggered_only = yes
	
	show_root = yes
	
	option = { #gold
		name = EVTOPTA_SNW_3924
		if = {
			limit = {
				FROM = {
					OR = {
						has_province_modifier = guilds_res_stone
						has_province_modifier = guilds_res_grain
						has_province_modifier = guilds_res_meat
					}
				}
			}
			scaled_wealth = { value = -0.10 min = -10 max = -100 }
		}
		else_if = {
			limit = {
				FROM = {
					OR = {
						has_province_modifier = guilds_res_steel
						has_province_modifier = guilds_res_lumber
						has_province_modifier = guilds_res_wool
					}
				}
			}
			scaled_wealth = { value = -0.3 min = -30 max = -300 }
		}
		else_if = {
			limit = {
				FROM = {
					OR = {
						has_province_modifier = guilds_res_gem
						has_province_modifier = guilds_res_linen
						has_province_modifier = guilds_res_hide
					}
				}
			}
			scaled_wealth = { value = -0.55 min = -55 max = -550 }
		}
		else_if = {
			limit = {
				FROM = {
					OR = {
						has_province_modifier = guilds_res_silver
						has_province_modifier = guilds_res_ivory
						has_province_modifier = guilds_res_incense
					}
				}
			}
			scaled_wealth = { value = -0.80 min = -80 max = -800 }
		}
		else = {
			scaled_wealth = { value = -1.05 min = -105 max = -1050 }
		}
		FROM = { province_event = { id = SNW.391 } }
	}
	option = { #asset r1
		name = EVTOPTB_SNW_3924
		trigger = { 
			FROM = {
				OR = {
					has_province_modifier = guilds_res_stone
					has_province_modifier = guilds_res_grain
					has_province_modifier = guilds_res_meat
				}
			}
			society_member_of = the_guilds 
			society_currency = 300
		}
		change_society_currency = -300
		FROM = { province_event = { id = SNW.391 } }
	}
	option = { #asset r2
		name = EVTOPTC_SNW_3924
		trigger = { 
			FROM = {
				OR = {
					has_province_modifier = guilds_res_steel
					has_province_modifier = guilds_res_lumber
					has_province_modifier = guilds_res_wool
				}
			}
			society_member_of = the_guilds 
			society_currency = 400
		}
		change_society_currency = -400
		FROM = { province_event = { id = SNW.391 } }
	}
	option = { #asset r3
		name = EVTOPTD_SNW_3924
		trigger = { 
			FROM = {
				OR = {
					has_province_modifier = guilds_res_gem
					has_province_modifier = guilds_res_linen
					has_province_modifier = guilds_res_hide
				}
			}
			society_member_of = the_guilds 
			society_currency = 500
		}
		change_society_currency = -500
		FROM = { province_event = { id = SNW.391 } }
	}
	option = { #asset r4
		name = EVTOPTE_SNW_3924
		trigger = { 
			FROM = {
				OR = {
					has_province_modifier = guilds_res_silver
					has_province_modifier = guilds_res_incense
					has_province_modifier = guilds_res_ivory
				}
			}
			society_member_of = the_guilds 
			society_currency = 600
		}
		change_society_currency = -600
		FROM = { province_event = { id = SNW.391 } }
	}
	option = { #asset r5
		name = EVTOPTF_SNW_3924
		trigger = { 
			FROM = {
				OR = {
					has_province_modifier = guilds_res_gold
					has_province_modifier = guilds_res_spices
					has_province_modifier = guilds_res_silk
				}
			}
			society_member_of = the_guilds 
			society_currency = 700
		}
		change_society_currency = -700
		FROM = { province_event = { id = SNW.391 } }
	}
	option = { #nothing
		name = EVTOPTG_SNW_3924
		hidden_tooltip = {
		FROM = {
				trigger_switch = {
					on_trigger = has_province_modifier
					guilds_res_stone = { 
						remove_province_modifier = guilds_res_stone
					}
					guilds_res_grain = {
						remove_province_modifier = guilds_res_grain
					}
					guilds_res_meat = { 
						remove_province_modifier = guilds_res_meat
					}
					guilds_res_steel = {
						remove_province_modifier = guilds_res_steel
					}
					guilds_res_lumber = { 
						remove_province_modifier = guilds_res_lumber
					}
					guilds_res_wool = {
						remove_province_modifier = guilds_res_wool
					}
					guilds_res_gem = {
						remove_province_modifier = guilds_res_gem
					}
					guilds_res_linen = {
						remove_province_modifier = guilds_res_linen
					}
					guilds_res_hide = { 
						remove_province_modifier = guilds_res_hide
					}
					guilds_res_silver = { 
						remove_province_modifier = guilds_res_silver
					}
					guilds_res_incense = {
						remove_province_modifier = guilds_res_incense
					}
					guilds_res_ivory = { 
						remove_province_modifier = guilds_res_ivory
					}
					guilds_res_gold = {
						remove_province_modifier = guilds_res_gold
					}
					guilds_res_spices = {
						remove_province_modifier = guilds_res_spices
					}
					guilds_res_silk = { 
						remove_province_modifier = guilds_res_silk
					}
				}
			}
		}
	}
}

#Resource - maintenace - spent
character_event = {
    id = SNW.3925
    desc = EVTDESC_SNW_3925
	picture = GFX_evt_stressed_ruler
	border = GFX_event_normal_frame_economy_guilds
	
    is_triggered_only = yes
	
	show_root = yes
	
	option = { #no more resources
		name = EVTOPTA_SNW_3925
		hidden_tooltip = {
			FROM = {
				trigger_switch = {
					on_trigger = has_province_modifier
					guilds_res_stone = { 
						remove_province_modifier = guilds_res_stone
					}
					guilds_res_grain = {
						remove_province_modifier = guilds_res_grain
					}
					guilds_res_meat = { 
						remove_province_modifier = guilds_res_meat
					}
					guilds_res_steel = {
						remove_province_modifier = guilds_res_steel
					}
					guilds_res_lumber = { 
						remove_province_modifier = guilds_res_lumber
					}
					guilds_res_wool = {
						remove_province_modifier = guilds_res_wool
					}
					guilds_res_gem = {
						remove_province_modifier = guilds_res_gem
					}
					guilds_res_linen = {
						remove_province_modifier = guilds_res_linen
					}
					guilds_res_hide = { 
						remove_province_modifier = guilds_res_hide
					}
					guilds_res_silver = { 
						remove_province_modifier = guilds_res_silver
					}
					guilds_res_incense = {
						remove_province_modifier = guilds_res_incense
					}
					guilds_res_ivory = { 
						remove_province_modifier = guilds_res_ivory
					}
					guilds_res_gold = {
						remove_province_modifier = guilds_res_gold
					}
					guilds_res_spices = {
						remove_province_modifier = guilds_res_spices
					}
					guilds_res_silk = { 
						remove_province_modifier = guilds_res_silk
					}
				}
			}
		}
	}
}

#Resource - search - start
character_event = {
    id = SNW.393
    desc = EVTDESC_SNW_393
	picture = GFX_evt_magnificent_castle
	border = GFX_event_normal_frame_economy_guilds
	
    is_triggered_only = yes
	
	option = { #start
		name = EVTOPTA_SNW_393
		hidden_tooltip = {
			set_variable = { which = "resource_variable" value = 0 }
		}
		hidden_tooltip = {
			random_list = {
				10 = { character_event = { id = SNW.3940 days = 250 random = 50 } } #church land
				10 = { character_event = { id = SNW.3941 days = 250 random = 50 } } #bandits
				10 = { character_event = { id = SNW.3942 days = 250 random = 50 } } #farmland
				10 = { character_event = { id = SNW.3943 days = 250 random = 50 } } #borders
				10 = { character_event = { id = SNW.3944 days = 250 random = 50 } } #temparature
				10 = { character_event = { id = SNW.3945 days = 250 random = 50 } } #superstition
			}
		}
	}
	option = { #abort
		name = EVTOPTB_SNW_393
		custom_tooltip = {
			text = abort_resource_early_tooltip
			# remove_character_modifier = guilds_resources_timer
			clr_character_flag = guilds_resource_flag_herd
		}
		ai_chance = {
			factor = 0
		}
	}
}

#Resource - search - church
character_event = {
    id = SNW.3940
    desc = EVTDESC_SNW_3940
	picture = GFX_evt_stone_church
	border = GFX_event_normal_frame_economy_guilds
	
    is_triggered_only = yes
	
	option = { #spend
		name = EVTOPTA_SNW_3940
		piety = -250
		scaled_wealth = { value = -0.45 min = -45 max = -450 }
		hidden_tooltip = {
			change_variable = { which = "resource_variable" value = 1 }
		}
		if = {
			limit = { check_variable = { which = "resource_variable" value = 5 } }
			character_event = { id = SNW.395 days = 150 random = 50 }
		}
		else = {
			hidden_tooltip = {
				random_list = {
					# 10 = { character_event = { id = SNW.3940 days = 250 random = 50 } } #church land
					10 = { character_event = { id = SNW.3941 days = 250 random = 50 } } #bandits
					10 = { character_event = { id = SNW.3942 days = 250 random = 50 } } #farmland
					10 = { character_event = { id = SNW.3943 days = 250 random = 50 } } #borders
					10 = { character_event = { id = SNW.3944 days = 250 random = 50 } } #temparature
					10 = { character_event = { id = SNW.3945 days = 250 random = 50 } } #superstition
				}
			}
		}
	}
	option = { #councillor
		name = EVTOPTB_SNW_3940
		trigger = { 
			NAND = {
				society_member_of = the_guilds
				society_currency = 250
			}
			any_courtier = {
				has_job_title = job_spiritual
				NOT = { has_character_modifier = guilds_busy_spiritual }
			}
		}
		any_courtier = {
			limit = { has_job_title = job_spiritual }
			add_character_modifier = {
				name = guilds_busy_spiritual
				duration = 1100
			}
		}
		scaled_wealth = { value = -0.45 min = -45 max = -450 }
		hidden_tooltip = {
			change_variable = { which = "resource_variable" value = 1 }
		}
		if = {
			limit = { check_variable = { which = "resource_variable" value = 5 } }
			character_event = { id = SNW.395 days = 150 random = 50 }
		}
		else = {
			hidden_tooltip = {
				random_list = {
					# 10 = { character_event = { id = SNW.3940 days = 250 random = 50 } } #church land
					10 = { character_event = { id = SNW.3941 days = 250 random = 50 } } #bandits
					10 = { character_event = { id = SNW.3942 days = 250 random = 50 } } #farmland
					10 = { character_event = { id = SNW.3943 days = 250 random = 50 } } #borders
					10 = { character_event = { id = SNW.3944 days = 250 random = 50 } } #temparature
					10 = { character_event = { id = SNW.3945 days = 250 random = 50 } } #superstition
				}
			}
		}
	}
	option = { #asset
		name = EVTOPTC_SNW_3940
		trigger = {  
			society_member_of = the_guilds
			society_currency = 250
		}
		change_society_currency = -250
		hidden_tooltip = {
			change_variable = { which = "resource_variable" value = 1 }
		}
		if = {
			limit = { check_variable = { which = "resource_variable" value = 5 } }
			character_event = { id = SNW.395 days = 150 random = 50 }
		}
		else = {
			hidden_tooltip = {
				random_list = {
					# 10 = { character_event = { id = SNW.3940 days = 250 random = 50 } } #church land
					10 = { character_event = { id = SNW.3941 days = 250 random = 50 } } #bandits
					10 = { character_event = { id = SNW.3942 days = 250 random = 50 } } #farmland
					10 = { character_event = { id = SNW.3943 days = 250 random = 50 } } #borders
					10 = { character_event = { id = SNW.3944 days = 250 random = 50 } } #temparature
					10 = { character_event = { id = SNW.3945 days = 250 random = 50 } } #superstition
				}
			}
		}
	}
	option = { #skip
		name = EVTOPTD_SNW_3940
			hidden_tooltip = {
				random_list = {
					# 10 = { character_event = { id = SNW.3940 days = 250 random = 50 } } #church land
					10 = { character_event = { id = SNW.3941 days = 250 random = 50 } } #bandits
					10 = { character_event = { id = SNW.3942 days = 250 random = 50 } } #farmland
					10 = { character_event = { id = SNW.3943 days = 250 random = 50 } } #borders
					10 = { character_event = { id = SNW.3944 days = 250 random = 50 } } #temparature
					10 = { character_event = { id = SNW.3945 days = 250 random = 50 } } #superstition
				}
			}
	}
	option = { #abort
		name = EVTOPTE_SNW_3940
		custom_tooltip = {
			text = abort_resource_tooltip
			set_variable = { which = "resource_variable" value = 0 }
			# remove_character_modifier = guilds_resources_timer
			add_character_modifier = {
				name = guilds_resources_timer
				duration = 1825
				hidden = yes
			}
			clr_character_flag = guilds_resource_flag_herd
		}
		ai_chance = {
			factor = 0
		}
	}
}

#Resource - search - bandit
character_event = {
    id = SNW.3941
    desc = EVTDESC_SNW_3941
	picture = GFX_evt_bandits
	border = GFX_event_normal_frame_economy_guilds
	
    is_triggered_only = yes
	
	option = { #spend
		name = EVTOPTA_SNW_3941
		random_demesne_province = {
			add_province_modifier = {
				name = guilds_thieves_guild_military
				months = 24
			}
		}
		scaled_wealth = { value = -0.45 min = -45 max = -450 }
		hidden_tooltip = {
			change_variable = { which = "resource_variable" value = 1 }
		}
		if = {
			limit = { check_variable = { which = "resource_variable" value = 5 } }
			character_event = { id = SNW.395 days = 150 random = 50 }
		}
		else = {
			hidden_tooltip = {
				random_list = {
					10 = { character_event = { id = SNW.3940 days = 250 random = 50 } } #church land
					# 10 = { character_event = { id = SNW.3941 days = 250 random = 50 } } #bandits
					10 = { character_event = { id = SNW.3942 days = 250 random = 50 } } #farmland
					10 = { character_event = { id = SNW.3943 days = 250 random = 50 } } #borders
					10 = { character_event = { id = SNW.3944 days = 250 random = 50 } } #temparature
					10 = { character_event = { id = SNW.3945 days = 250 random = 50 } } #superstition
				}
			}
		}
	}
	option = { #councillor
		name = EVTOPTB_SNW_3941
		trigger = { 
			NAND = {
				society_member_of = the_guilds
				society_currency = 250
			}
			any_courtier = {
				has_job_title = job_marshal
				NOT = { has_character_modifier = guilds_busy_marshal }
			}
		}
		any_courtier = {
			limit = { has_job_title = job_marshal }
			add_character_modifier = {
				name = guilds_busy_marshal
				duration = 1100
			}
		}
		scaled_wealth = { value = -0.45 min = -45 max = -450 }
		hidden_tooltip = {
			change_variable = { which = "resource_variable" value = 1 }
		}
		if = {
			limit = { check_variable = { which = "resource_variable" value = 5 } }
			character_event = { id = SNW.395 days = 150 random = 50 }
		}
		else = {
			hidden_tooltip = {
				random_list = {
					10 = { character_event = { id = SNW.3940 days = 250 random = 50 } } #church land
					# 10 = { character_event = { id = SNW.3941 days = 250 random = 50 } } #bandits
					10 = { character_event = { id = SNW.3942 days = 250 random = 50 } } #farmland
					10 = { character_event = { id = SNW.3943 days = 250 random = 50 } } #borders
					10 = { character_event = { id = SNW.3944 days = 250 random = 50 } } #temparature
					10 = { character_event = { id = SNW.3945 days = 250 random = 50 } } #superstition
				}
			}
		}
	}
	option = { #asset
		name = EVTOPTC_SNW_3941
		trigger = {  
			society_member_of = the_guilds
			society_currency = 250
		}
		change_society_currency = -250
		hidden_tooltip = {
			change_variable = { which = "resource_variable" value = 1 }
		}
		if = {
			limit = { check_variable = { which = "resource_variable" value = 5 } }
			character_event = { id = SNW.395 days = 150 random = 50 }
		}
		else = {
			hidden_tooltip = {
				random_list = {
					10 = { character_event = { id = SNW.3940 days = 250 random = 50 } } #church land
					# 10 = { character_event = { id = SNW.3941 days = 250 random = 50 } } #bandits
					10 = { character_event = { id = SNW.3942 days = 250 random = 50 } } #farmland
					10 = { character_event = { id = SNW.3943 days = 250 random = 50 } } #borders
					10 = { character_event = { id = SNW.3944 days = 250 random = 50 } } #temparature
					10 = { character_event = { id = SNW.3945 days = 250 random = 50 } } #superstition
				}
			}
		}
	}
	option = { #skip
		name = EVTOPTD_SNW_3941
			hidden_tooltip = {
				random_list = {
					10 = { character_event = { id = SNW.3940 days = 250 random = 50 } } #church land
					# 10 = { character_event = { id = SNW.3941 days = 250 random = 50 } } #bandits
					10 = { character_event = { id = SNW.3942 days = 250 random = 50 } } #farmland
					10 = { character_event = { id = SNW.3943 days = 250 random = 50 } } #borders
					10 = { character_event = { id = SNW.3944 days = 250 random = 50 } } #temparature
					10 = { character_event = { id = SNW.3945 days = 250 random = 50 } } #superstition
				}
			}
	}
	option = { #abort
		name = EVTOPTE_SNW_3941
		custom_tooltip = {
			text = abort_resource_tooltip
			set_variable = { which = "resource_variable" value = 0 }
			# remove_character_modifier = guilds_resources_timer
			add_character_modifier = {
				name = guilds_resources_timer
				duration = 1825
				hidden = yes
			}
			clr_character_flag = guilds_resource_flag_herd
		}
		ai_chance = {
			factor = 0
		}
	}
}

#Resource - search - farms
character_event = {
    id = SNW.3942
    desc = EVTDESC_SNW_3942
	picture = GFX_evt_noble_haughty_talking_to_peasants
	border = GFX_event_normal_frame_economy_guilds
	
    is_triggered_only = yes
	
	option = { #spend
		name = EVTOPTA_SNW_3942
		random_demesne_province = {
			add_province_modifier = {
				name = guilds_tax_break
				months = 24
			}
		}
		scaled_wealth = { value = -0.45 min = -45 max = -450 }
		hidden_tooltip = {
			change_variable = { which = "resource_variable" value = 1 }
		}
		if = {
			limit = { check_variable = { which = "resource_variable" value = 5 } }
			character_event = { id = SNW.395 days = 150 random = 50 }
		}
		else = {
			hidden_tooltip = {
				random_list = {
					10 = { character_event = { id = SNW.3940 days = 250 random = 50 } } #church land
					10 = { character_event = { id = SNW.3941 days = 250 random = 50 } } #bandits
					# 10 = { character_event = { id = SNW.3942 days = 250 random = 50 } } #farmland
					10 = { character_event = { id = SNW.3943 days = 250 random = 50 } } #borders
					10 = { character_event = { id = SNW.3944 days = 250 random = 50 } } #temparature
					10 = { character_event = { id = SNW.3945 days = 250 random = 50 } } #superstition
				}
			}
		}
	}
	option = { #councillor
		name = EVTOPTB_SNW_3942
		trigger = { 
			NAND = {
				society_member_of = the_guilds
				society_currency = 250
			}
			any_courtier = {
				has_job_title = job_treasurer
				NOT = { has_character_modifier = guilds_busy_treasurer }
			}
		}
		any_courtier = {
			limit = { has_job_title = job_treasurer }
			add_character_modifier = {
				name = guilds_busy_treasurer
				duration = 1100
			}
		}
		scaled_wealth = { value = -0.45 min = -45 max = -450 }
		hidden_tooltip = {
			change_variable = { which = "resource_variable" value = 1 }
		}
		if = {
			limit = { check_variable = { which = "resource_variable" value = 5 } }
			character_event = { id = SNW.395 days = 150 random = 50 }
		}
		else = {
			hidden_tooltip = {
				random_list = {
					10 = { character_event = { id = SNW.3940 days = 250 random = 50 } } #church land
					10 = { character_event = { id = SNW.3941 days = 250 random = 50 } } #bandits
					# 10 = { character_event = { id = SNW.3942 days = 250 random = 50 } } #farmland
					10 = { character_event = { id = SNW.3943 days = 250 random = 50 } } #borders
					10 = { character_event = { id = SNW.3944 days = 250 random = 50 } } #temparature
					10 = { character_event = { id = SNW.3945 days = 250 random = 50 } } #superstition
				}
			}
		}
	}
	option = { #asset
		name = EVTOPTC_SNW_3942
		trigger = {  
			society_member_of = the_guilds
			society_currency = 250
		}
		change_society_currency = -250
		hidden_tooltip = {
			change_variable = { which = "resource_variable" value = 1 }
		}
		if = {
			limit = { check_variable = { which = "resource_variable" value = 5 } }
			character_event = { id = SNW.395 days = 150 random = 50 }
		}
		else = {
			hidden_tooltip = {
				random_list = {
					10 = { character_event = { id = SNW.3940 days = 250 random = 50 } } #church land
					10 = { character_event = { id = SNW.3941 days = 250 random = 50 } } #bandits
					# 10 = { character_event = { id = SNW.3942 days = 250 random = 50 } } #farmland
					10 = { character_event = { id = SNW.3943 days = 250 random = 50 } } #borders
					10 = { character_event = { id = SNW.3944 days = 250 random = 50 } } #temparature
					10 = { character_event = { id = SNW.3945 days = 250 random = 50 } } #superstition
				}
			}
		}
	}
	option = { #skip
		name = EVTOPTD_SNW_3942
			hidden_tooltip = {
				random_list = {
					10 = { character_event = { id = SNW.3940 days = 250 random = 50 } } #church land
					10 = { character_event = { id = SNW.3941 days = 250 random = 50 } } #bandits
					# 10 = { character_event = { id = SNW.3942 days = 250 random = 50 } } #farmland
					10 = { character_event = { id = SNW.3943 days = 250 random = 50 } } #borders
					10 = { character_event = { id = SNW.3944 days = 250 random = 50 } } #temparature
					10 = { character_event = { id = SNW.3945 days = 250 random = 50 } } #superstition
				}
			}
	}
	option = { #abort
		name = EVTOPTE_SNW_3942
		custom_tooltip = {
			text = abort_resource_tooltip
			set_variable = { which = "resource_variable" value = 0 }
			# remove_character_modifier = guilds_resources_timer
			add_character_modifier = {
				name = guilds_resources_timer
				duration = 1825
				hidden = yes
			}
			clr_character_flag = guilds_resource_flag_herd
		}
		ai_chance = {
			factor = 0
		}
	}
}

#Resource - search - border
character_event = {
    id = SNW.3943
    desc = EVTDESC_SNW_3943
	picture = GFX_evt_diplomatic_greeting
	border = GFX_event_normal_frame_economy_guilds
	
    is_triggered_only = yes
	
	option = { #spend
		name = EVTOPTA_SNW_3943
		prestige = -250
		scaled_wealth = { value = -0.45 min = -45 max = -450 }
		hidden_tooltip = {
			change_variable = { which = "resource_variable" value = 1 }
		}
		if = {
			limit = { check_variable = { which = "resource_variable" value = 5 } }
			character_event = { id = SNW.395 days = 150 random = 50 }
		}
		else = {
			hidden_tooltip = {
				random_list = {
					10 = { character_event = { id = SNW.3940 days = 250 random = 50 } } #church land
					10 = { character_event = { id = SNW.3941 days = 250 random = 50 } } #bandits
					10 = { character_event = { id = SNW.3942 days = 250 random = 50 } } #farmland
					# 10 = { character_event = { id = SNW.3943 days = 250 random = 50 } } #borders
					10 = { character_event = { id = SNW.3944 days = 250 random = 50 } } #temparature
					10 = { character_event = { id = SNW.3945 days = 250 random = 50 } } #superstition
				}
			}
		}
	}
	option = { #councillor
		name = EVTOPTB_SNW_3943
		trigger = { 
			NAND = {
				society_member_of = the_guilds
				society_currency = 250
			}
			any_courtier = {
				has_job_title = job_chancellor
				NOT = { has_character_modifier = guilds_busy_chancellor }
			}
		}
		any_courtier = {
			limit = { has_job_title = job_chancellor }
			add_character_modifier = {
				name = guilds_busy_chancellor
				duration = 1100
			}
		}
		scaled_wealth = { value = -0.45 min = -45 max = -450 }
		hidden_tooltip = {
			change_variable = { which = "resource_variable" value = 1 }
		}
		if = {
			limit = { check_variable = { which = "resource_variable" value = 5 } }
			character_event = { id = SNW.395 days = 150 random = 50 }
		}
		else = {
			hidden_tooltip = {
				random_list = {
					10 = { character_event = { id = SNW.3940 days = 250 random = 50 } } #church land
					10 = { character_event = { id = SNW.3941 days = 250 random = 50 } } #bandits
					10 = { character_event = { id = SNW.3942 days = 250 random = 50 } } #farmland
					# 10 = { character_event = { id = SNW.3943 days = 250 random = 50 } } #borders
					10 = { character_event = { id = SNW.3944 days = 250 random = 50 } } #temparature
					10 = { character_event = { id = SNW.3945 days = 250 random = 50 } } #superstition
				}
			}
		}
	}
	option = { #asset
		name = EVTOPTC_SNW_3943
		trigger = {  
			society_member_of = the_guilds
			society_currency = 250
		}
		change_society_currency = -250
		hidden_tooltip = {
			change_variable = { which = "resource_variable" value = 1 }
		}
		if = {
			limit = { check_variable = { which = "resource_variable" value = 5 } }
			character_event = { id = SNW.395 days = 150 random = 50 }
		}
		else = {
			hidden_tooltip = {
				random_list = {
					10 = { character_event = { id = SNW.3940 days = 250 random = 50 } } #church land
					10 = { character_event = { id = SNW.3941 days = 250 random = 50 } } #bandits
					10 = { character_event = { id = SNW.3942 days = 250 random = 50 } } #farmland
					# 10 = { character_event = { id = SNW.3943 days = 250 random = 50 } } #borders
					10 = { character_event = { id = SNW.3944 days = 250 random = 50 } } #temparature
					10 = { character_event = { id = SNW.3945 days = 250 random = 50 } } #superstition
				}
			}
		}
	}
	option = { #skip
		name = EVTOPTD_SNW_3943
			hidden_tooltip = {
				random_list = {
					10 = { character_event = { id = SNW.3940 days = 250 random = 50 } } #church land
					10 = { character_event = { id = SNW.3941 days = 250 random = 50 } } #bandits
					10 = { character_event = { id = SNW.3942 days = 250 random = 50 } } #farmland
					# 10 = { character_event = { id = SNW.3943 days = 250 random = 50 } } #borders
					10 = { character_event = { id = SNW.3944 days = 250 random = 50 } } #temparature
					10 = { character_event = { id = SNW.3945 days = 250 random = 50 } } #superstition
				}
			}
	}
	option = { #abort
		name = EVTOPTE_SNW_3943
		custom_tooltip = {
			text = abort_resource_tooltip
			set_variable = { which = "resource_variable" value = 0 }
			remove_character_modifier = guilds_resources_timer
			add_character_modifier = {
				name = guilds_resources_timer
				duration = 1825
				hidden = yes
			}
			clr_character_flag = guilds_resource_flag_herd
		}
		ai_chance = {
			factor = 0
		}
	}
}

#Resource - search - temperature
character_event = {
    id = SNW.3944
    desc = EVTDESC_SNW_3944
	picture = GFX_evt_trade_post_republic
	border = GFX_event_normal_frame_economy_guilds
	
    is_triggered_only = yes
	
	option = { #spend little get delay
		name = EVTOPTA_SNW_3944
		custom_tooltip = { text = resourse_temperature }
		scaled_wealth = { value = -0.45 min = -45 max = -450 }
		hidden_tooltip = {
			change_variable = { which = "resource_variable" value = 1 }
		}
		if = {
			limit = { check_variable = { which = "resource_variable" value = 5 } }
			character_event = { id = SNW.395 days = 150 random = 50 }
		}
		else = {
			hidden_tooltip = {
				random_list = {
					10 = { character_event = { id = SNW.3940 days = 500 random = 50 } } #church land
					10 = { character_event = { id = SNW.3941 days = 500 random = 50 } } #bandits
					10 = { character_event = { id = SNW.3942 days = 500 random = 50 } } #farmland
					10 = { character_event = { id = SNW.3943 days = 500 random = 50 } } #borders
					# 10 = { character_event = { id = SNW.3944 days = 500 random = 50 } } #temparature
					10 = { character_event = { id = SNW.3945 days = 500 random = 50 } } #superstition
				}
			}
		}
	}
	option = { #big spend no delay
		name = EVTOPTB_SNW_3944
		trigger = { 
			NAND = {
				society_member_of = the_guilds
				society_currency = 250
			}
		}
		scaled_wealth = { value = -0.70 min = -70 max = -700 }
		hidden_tooltip = {
			change_variable = { which = "resource_variable" value = 1 }
		}
		if = {
			limit = { check_variable = { which = "resource_variable" value = 5 } }
			character_event = { id = SNW.395 days = 150 random = 50 }
		}
		else = {
			hidden_tooltip = {
				random_list = {
					10 = { character_event = { id = SNW.3940 days = 250 random = 50 } } #church land
					10 = { character_event = { id = SNW.3941 days = 250 random = 50 } } #bandits
					10 = { character_event = { id = SNW.3942 days = 250 random = 50 } } #farmland
					10 = { character_event = { id = SNW.3943 days = 250 random = 50 } } #borders
					# 10 = { character_event = { id = SNW.3944 days = 250 random = 50 } } #temparature
					10 = { character_event = { id = SNW.3945 days = 250 random = 50 } } #superstition
				}
			}
		}
	}
	option = { #asset
		name = EVTOPTC_SNW_3944
		trigger = {  
			society_member_of = the_guilds
			society_currency = 250
		}
		change_society_currency = -250
		hidden_tooltip = {
			change_variable = { which = "resource_variable" value = 1 }
		}
		if = {
			limit = { check_variable = { which = "resource_variable" value = 5 } }
			character_event = { id = SNW.395 days = 150 random = 50 }
		}
		else = {
			hidden_tooltip = {
				random_list = {
					10 = { character_event = { id = SNW.3940 days = 250 random = 50 } } #church land
					10 = { character_event = { id = SNW.3941 days = 250 random = 50 } } #bandits
					10 = { character_event = { id = SNW.3942 days = 250 random = 50 } } #farmland
					10 = { character_event = { id = SNW.3943 days = 250 random = 50 } } #borders
					# 10 = { character_event = { id = SNW.3944 days = 250 random = 50 } } #temparature
					10 = { character_event = { id = SNW.3945 days = 250 random = 50 } } #superstition
				}
			}
		}
	}
	option = { #skip
		name = EVTOPTD_SNW_3944
			hidden_tooltip = {
				random_list = {
					10 = { character_event = { id = SNW.3940 days = 250 random = 50 } } #church land
					10 = { character_event = { id = SNW.3941 days = 250 random = 50 } } #bandits
					10 = { character_event = { id = SNW.3942 days = 250 random = 50 } } #farmland
					10 = { character_event = { id = SNW.3943 days = 250 random = 50 } } #borders
					# 10 = { character_event = { id = SNW.3944 days = 250 random = 50 } } #temparature
					10 = { character_event = { id = SNW.3945 days = 250 random = 50 } } #superstition
				}
			}
	}
	option = { #abort
		name = EVTOPTE_SNW_3944
		custom_tooltip = {
			text = abort_resource_tooltip
			set_variable = { which = "resource_variable" value = 0 }
			# remove_character_modifier = guilds_resources_timer
			add_character_modifier = {
				name = guilds_resources_timer
				duration = 1825
				hidden = yes
			}
			clr_character_flag = guilds_resource_flag_herd
		}
		ai_chance = {
			factor = 0
		}
	}
}

#Resource - search - superstition
character_event = {
    id = SNW.3945
    desc = EVTDESC_SNW_3945
	picture = GFX_evt_tribal_lands
	border = GFX_event_normal_frame_economy_guilds
	
    is_triggered_only = yes
	
	option = { #spend
		name = EVTOPTA_SNW_3945
		add_character_modifier = {
			name = guilds_cursed
			duration = 1100
		}
		scaled_wealth = { value = -0.45 min = -45 max = -450 }
		hidden_tooltip = {
			change_variable = { which = "resource_variable" value = 1 }
		}
		if = {
			limit = { check_variable = { which = "resource_variable" value = 5 } }
			character_event = { id = SNW.395 days = 150 random = 50 }
		}
		else = {
			hidden_tooltip = {
				random_list = {
					10 = { character_event = { id = SNW.3940 days = 250 random = 50 } } #church land
					10 = { character_event = { id = SNW.3941 days = 250 random = 50 } } #bandits
					10 = { character_event = { id = SNW.3942 days = 250 random = 50 } } #farmland
					10 = { character_event = { id = SNW.3943 days = 250 random = 50 } } #borders
					10 = { character_event = { id = SNW.3944 days = 250 random = 50 } } #temparature
					# 10 = { character_event = { id = SNW.3945 days = 250 random = 50 } } #superstition
				}
			}
		}
	}
	option = { #councillor
		name = EVTOPTB_SNW_3945
		trigger = { 
			NAND = {
				society_member_of = the_guilds
				society_currency = 250
			}
			any_courtier = {
				has_job_title = job_spymaster
				NOT = { has_character_modifier = guilds_busy_spymaster }
			}
		}
		any_courtier = {
			limit = { has_job_title = job_spymaster }
			add_character_modifier = {
				name = guilds_busy_spymaster
				duration = 1100
			}
		}
		scaled_wealth = { value = -0.45 min = -45 max = -450 }
		hidden_tooltip = {
			change_variable = { which = "resource_variable" value = 1 }
		}
		if = {
			limit = { check_variable = { which = "resource_variable" value = 5 } }
			character_event = { id = SNW.395 days = 150 random = 50 }
		}
		else = {
			hidden_tooltip = {
				random_list = {
					10 = { character_event = { id = SNW.3940 days = 250 random = 50 } } #church land
					10 = { character_event = { id = SNW.3941 days = 250 random = 50 } } #bandits
					10 = { character_event = { id = SNW.3942 days = 250 random = 50 } } #farmland
					10 = { character_event = { id = SNW.3943 days = 250 random = 50 } } #borders
					10 = { character_event = { id = SNW.3944 days = 250 random = 50 } } #temparature
					# 10 = { character_event = { id = SNW.3945 days = 250 random = 50 } } #superstition
				}
			}
		}
	}
	option = { #asset
		name = EVTOPTC_SNW_3945
		trigger = {  
			society_member_of = the_guilds
			society_currency = 250
		}
		change_society_currency = -250
		hidden_tooltip = {
			change_variable = { which = "resource_variable" value = 1 }
		}
		if = {
			limit = { check_variable = { which = "resource_variable" value = 5 } }
			character_event = { id = SNW.395 days = 150 random = 50 }
		}
		else = {
			hidden_tooltip = {
				random_list = {
					10 = { character_event = { id = SNW.3940 days = 250 random = 50 } } #church land
					10 = { character_event = { id = SNW.3941 days = 250 random = 50 } } #bandits
					10 = { character_event = { id = SNW.3942 days = 250 random = 50 } } #farmland
					10 = { character_event = { id = SNW.3943 days = 250 random = 50 } } #borders
					10 = { character_event = { id = SNW.3944 days = 250 random = 50 } } #temparature
					# 10 = { character_event = { id = SNW.3945 days = 250 random = 50 } } #superstition
				}
			}
		}
	}
	option = { #skip
		name = EVTOPTD_SNW_3945
			hidden_tooltip = {
				random_list = {
					10 = { character_event = { id = SNW.3940 days = 250 random = 50 } } #church land
					10 = { character_event = { id = SNW.3941 days = 250 random = 50 } } #bandits
					10 = { character_event = { id = SNW.3942 days = 250 random = 50 } } #farmland
					10 = { character_event = { id = SNW.3943 days = 250 random = 50 } } #borders
					10 = { character_event = { id = SNW.3944 days = 250 random = 50 } } #temparature
					# 10 = { character_event = { id = SNW.3945 days = 250 random = 50 } } #superstition
				}
			}
	}
	option = { #abort
		name = EVTOPTE_SNW_3945
		custom_tooltip = {
			text = abort_resource_tooltip
			set_variable = { which = "resource_variable" value = 0 }
			# remove_character_modifier = guilds_resources_timer
			add_character_modifier = {
				name = guilds_resources_timer
				duration = 1825
				hidden = yes
			}
			clr_character_flag = guilds_resource_flag_herd
		}
		ai_chance = {
			factor = 0
		}
	}
}

#Resource - exploit - start
character_event = {
    id = SNW.395
    desc = EVTDESC_SNW_395
	picture = GFX_evt_magnificent_castle
	border = GFX_event_normal_frame_economy_guilds
	
    is_triggered_only = yes
	
	immediate = {
		random_demesne_province = {
			limit = {
				capital_holding = {
					OR = {
						holding_type = tribal
						holding_type = temple
						holding_type = castle
						holding_type = city
						holding_type = nomad
					}
				}
				NOR = {
					has_province_modifier = guilds_res_stone
					has_province_modifier = guilds_res_steel
					has_province_modifier = guilds_res_gem
					has_province_modifier = guilds_res_silver
					has_province_modifier = guilds_res_gold
					has_province_modifier = guilds_res_grain
					has_province_modifier = guilds_res_lumber
					has_province_modifier = guilds_res_linen
					has_province_modifier = guilds_res_incense
					has_province_modifier = guilds_res_spices
					has_province_modifier = guilds_res_meat
					has_province_modifier = guilds_res_wool
					has_province_modifier = guilds_res_hide
					has_province_modifier = guilds_res_ivory
					has_province_modifier = guilds_res_silk
				}
			}
			save_event_target_as = resourcefull_province
			random_list = {
				25 = {
					modifier = {
						factor = 4
						OR = {
							terrain = hills
							terrain = mountain
						}
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = forest
							terrain = jungle
						}
					}
					ROOT = { set_character_flag = guilds_resource_flag_stone }
				}
				25 = {
					modifier = {
						factor = 6
						terrain = farmlands
					}
					modifier = {
						factor = 3
						OR = {
							terrain = plains
							terrain = steppe
						}
					}
					modifier = {
						factor = 0.75
						OR = {
							terrain = hills
							terrain = forest
						}
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = jungle
							terrain = desert
						}
					}
					modifier = {
						factor = 0.1
						terrain = arctic
						terrain = mountain
					}
					modifier = {
						factor = 2
						OR = {
							borders_lake = yes
							borders_major_river = yes
						}
					}
					ROOT = { set_character_flag = guilds_resource_flag_grain }
				}
				25 = {
					modifier = {
						factor = 4
						terrain = farmlands
					}
					modifier = {
						factor = 3
						OR = {
							port = yes
							terrain = forest
						}
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = mountain
							terrain = desert
						}
					}
					modifier = {
						factor = 2
						ROOT = { is_nomadic = yes }
					}
					ROOT = { set_character_flag = guilds_resource_flag_meat }
				}
				20 = {
					modifier = {
						factor = 4
						OR = {
							terrain = hills
							terrain = mountain
						}
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = forest
							terrain = jungle
						}
					}
					modifier = {
						factor = 0.5
						ROOT = { is_nomadic = yes }
					}
					ROOT = { set_character_flag = guilds_resource_flag_steel }
				}
				20 = {
					modifier = {
						factor = 6
						OR = {
							terrain = forest
							terrain = jungle
						}
					}
					modifier = {
						factor = 0.75
						OR = {
							terrain = farmlands
							terrain = steppe
						}
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = mountain
							terrain = arctic
						}
					}
					modifier = {
						factor = 0.1
						terrain = desert
					}
					modifier = {
						factor = 0.5
						ROOT = { is_nomadic = yes }
					}
					ROOT = { set_character_flag = guilds_resource_flag_lumber }
				}
				20 = {
					modifier = {
						factor = 4
						OR = {
							terrain = plains
							terrain = steppe
						}
					}
					modifier = {
						factor = 2.5
						OR = {
							terrain = farmlands
							terrain = hills
						}
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = mountain
							terrain = forest
							terrain = jungle
							terrain = arctic
						}
					}
					modifier = {
						factor = 2
						ROOT = { is_nomadic = yes }
					}
					ROOT = { set_character_flag = guilds_resource_flag_wool }
				}
				15 = {
					modifier = {
						factor = 3.5
						OR = {
							terrain = hills
							terrain = mountain
						}
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = forest
							terrain = jungle
						}
					}
					modifier = {
						factor = 0.5
						ROOT = { is_nomadic = yes }
					}
					ROOT = { set_character_flag = guilds_resource_flag_gem }
				}
				15 = {
					modifier = {
						factor = 5
						terrain = farmlands
					}
					modifier = {
						factor = 2.5
						OR = {
							terrain = plains
							terrain = steppe
						}
					}
					modifier = {
						factor = 0.75
						OR = {
							terrain = hills
							terrain = forest
						}
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = jungle
							terrain = mountain
						}
					}
					modifier = {
						factor = 0.25
						OR = {
							terrain = arctic
							terrain = desert
						}
					}
					modifier = {
						factor = 1.5
						OR = {
							borders_lake = yes
							borders_major_river = yes
						}
					}
					modifier = {
						factor = 0.5
						ROOT = { is_nomadic = yes }
					}
					ROOT = { set_character_flag = guilds_resource_flag_linen }
				}
				15 = {
					modifier = {
						factor = 3
						OR = {
							terrain = farmlands
							terrain = forest
							terrain = steppe
						}
					}
					modifier = {
						factor = 0.75
						terrain = hills
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = jungle
							terrain = mountain
							terrain = desert
						}
					}
					modifier = {
						factor = 2
						ROOT = { is_nomadic = yes }
					}
					ROOT = { set_character_flag = guilds_resource_flag_hide }
				}
				10 = {
					modifier = {
						factor = 4
						OR = {
							terrain = hills
							terrain = mountain
						}
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = forest
							terrain = jungle
						}
					}
					ROOT = { set_character_flag = guilds_resource_flag_silver }
				}
				10 = {
					modifier = {
						factor = 6
						OR = {
							terrain = jungle
							terrain = desert
						}
					}
					modifier = {
						factor = 0.50
						OR = {
							terrain = forest
							terrain = hills
							terrain = farmlands
							terrain = plains
						}
					}
					modifier = {
						factor = 0.25
						terrain = mountain
					}
					modifier = {
						factor = 0.1
						terrain = arctic
					}
					ROOT = { set_character_flag = guilds_resource_flag_incense }
				}
				10 = {
					modifier = {
						factor = 6
						OR = {
							terrain = jungle
							terrain = desert
						}
					}
					modifier = {
						factor = 3.5
						terrain = arctic
						port = yes
					}
					modifier = {
						factor = 1.5
						terrain = arctic
						port = no
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = forest
							terrain = farmlands
							terrain = plains
							terrain = steppe
						}
					}
					modifier = {
						factor = 0.25
						OR = {
							terrain = mountain
							terrain = hills
						}
					}
					modifier = {
						factor = 2
						ROOT = { is_nomadic = yes }
					}
					ROOT = { set_character_flag = guilds_resource_flag_ivory }
				}
				5 = {
					modifier = {
						factor = 4
						trade_route = trans_saharan_trade_route
					}
					modifier = {
						factor = 4
						OR = {
							terrain = hills
							terrain = mountain
						}
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = forest
							terrain = jungle
						}
					}
					modifier = {
						factor = 0.5
						ROOT = { is_nomadic = yes }
					}
					ROOT = { set_character_flag = guilds_resource_flag_gold }
				}
				5 = {
					modifier = {
						factor = 6
						OR = {
							terrain = jungle
							terrain = desert
						}
					}
					modifier = {
						factor = 0.75
						OR = {
							terrain = plains
							terrain = steppe
						}
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = forest
							terrain = hills
						}
					}
					modifier = {
						factor = 0.1
						OR = {
							terrain = mountain
							terrain = arctic
						}
					}
					modifier = {
						factor = 0.5
						ROOT = { is_nomadic = yes }
					}
					ROOT = { set_character_flag = guilds_resource_flag_spices }
				}
				5 = {
					modifier = {
						factor = 10
						trade_route = silk_road
					}
					modifier = {
						factor = 0.75
						OR = {
							terrain = forest
							terrain = hills
						}
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = mountain
							terrain = arctic
						}
					}
					modifier = {
						factor = 0.5
						ROOT = { is_nomadic = yes }
					}
					ROOT = { set_character_flag = guilds_resource_flag_silk }
				}
			}
		}
	}
	
	option = { #exploit it, non league
		name = EVTOPTA_SNW_395
		trigger = {
			NOT = { society_member_of = the_guilds }
		}
		if = {
			limit = {
				OR = {
					has_character_flag = guilds_resource_flag_stone
					has_character_flag = guilds_resource_flag_grain
					has_character_flag = guilds_resource_flag_meat
				}
			}
			scaled_wealth = { value = -1 min = -100 max = -1000 }
		}
		else_if = {
			limit = {
				OR = {
					has_character_flag = guilds_resource_flag_steel
					has_character_flag = guilds_resource_flag_lumber
					has_character_flag = guilds_resource_flag_wool
				}
			}
			scaled_wealth = { value = -1.5 min = -150 max = -1500 }
		}
		else_if = {
			limit = {
				OR = {
					has_character_flag = guilds_resource_flag_gem
					has_character_flag = guilds_resource_flag_linen
					has_character_flag = guilds_resource_flag_hide
				}
			}
			scaled_wealth = { value = -2 min = -200 max = -2000 }
		}
		else_if = {
			limit = {
				OR = {
					has_character_flag = guilds_resource_flag_silver
					has_character_flag = guilds_resource_flag_incense
					has_character_flag = guilds_resource_flag_ivory
				}
			}
			scaled_wealth = { value = -2.5 min = -250 max = -2500 }
		}
		else = {
			scaled_wealth = { value = -3 min = -300 max = -3000 }
		}
		character_event = { id = SNW.396 days = 600 random = 200 }
	}
	option = { #ask for help
		name = EVTOPTB_SNW_395
		trigger = {
			NOT = { society_member_of = the_guilds }
			NOT = { has_character_flag = guilds_traitor }
		}
		custom_tooltip = { text = resource_help_tooltip }
		if = {
			limit = {
				OR = {
					has_character_flag = guilds_resource_flag_stone
					has_character_flag = guilds_resource_flag_grain
					has_character_flag = guilds_resource_flag_meat
				}
			}
			scaled_wealth = { value = -0.5 min = -50 max = -500 }
		}
		else_if = {
			limit = {
				OR = {
					has_character_flag = guilds_resource_flag_steel
					has_character_flag = guilds_resource_flag_lumber
					has_character_flag = guilds_resource_flag_wool
				}
			}
			scaled_wealth = { value = -0.75 min = -75 max = -750 }
		}
		else_if = {
			limit = {
				OR = {
					has_character_flag = guilds_resource_flag_gem
					has_character_flag = guilds_resource_flag_linen
					has_character_flag = guilds_resource_flag_hide
				}
			}
			scaled_wealth = { value = -1 min = -100 max = -1000 }
		}
		else_if = {
			limit = {
				OR = {
					has_character_flag = guilds_resource_flag_silver
					has_character_flag = guilds_resource_flag_incense
					has_character_flag = guilds_resource_flag_ivory
				}
			}
			scaled_wealth = { value = -1.25 min = -125 max = -1250 }
		}
		else = {
			scaled_wealth = { value = -1.5 min = -150 max = -1500 }
		}
		set_character_flag = guilds_resource_flag_help
		character_event = { id = SNW.396 days = 600 random = 200 }
	}
	option = { #exploit it, league
		name = EVTOPTC_SNW_395
		trigger = {
			society_member_of = the_guilds
		}
		if = {
			limit = {
				OR = {
					has_character_flag = guilds_resource_flag_stone
					has_character_flag = guilds_resource_flag_grain
					has_character_flag = guilds_resource_flag_meat
				}
			}
			scaled_wealth = { value = -1 min = -100 max = -1000 }
		}
		else_if = {
			limit = {
				OR = {
					has_character_flag = guilds_resource_flag_steel
					has_character_flag = guilds_resource_flag_lumber
					has_character_flag = guilds_resource_flag_wool
				}
			}
			scaled_wealth = { value = -1.5 min = -150 max = -1500 }
		}
		else_if = {
			limit = {
				OR = {
					has_character_flag = guilds_resource_flag_gem
					has_character_flag = guilds_resource_flag_linen
					has_character_flag = guilds_resource_flag_hide
				}
			}
			scaled_wealth = { value = -2 min = -200 max = -2000 }
		}
		else_if = {
			limit = {
				OR = {
					has_character_flag = guilds_resource_flag_silver
					has_character_flag = guilds_resource_flag_incense
					has_character_flag = guilds_resource_flag_ivory
				}
			}
			scaled_wealth = { value = -2.5 min = -250 max = -2500 }
		}
		else = {
			scaled_wealth = { value = -3 min = -300 max = -3000 }
		}
		character_event = { id = SNW.396 days = 600 random = 200 }
	}
	option = { #exploit it, asset
		name = EVTOPTD_SNW_395
		trigger = {  
			society_member_of = the_guilds
			society_currency = 400
		}
		change_society_currency = -500
		if = {
			limit = {
				OR = {
					has_character_flag = guilds_resource_flag_stone
					has_character_flag = guilds_resource_flag_grain
					has_character_flag = guilds_resource_flag_meat
				}
			}
			scaled_wealth = { value = -0.5 min = -50 max = -500 }
		}
		else_if = {
			limit = {
				OR = {
					has_character_flag = guilds_resource_flag_steel
					has_character_flag = guilds_resource_flag_lumber
					has_character_flag = guilds_resource_flag_wool
				}
			}
			scaled_wealth = { value = -0.75 min = -75 max = -750 }
		}
		else_if = {
			limit = {
				OR = {
					has_character_flag = guilds_resource_flag_gem
					has_character_flag = guilds_resource_flag_linen
					has_character_flag = guilds_resource_flag_hide
				}
			}
			scaled_wealth = { value = -1 min = -100 max = -1000 }
		}
		else_if = {
			limit = {
				OR = {
					has_character_flag = guilds_resource_flag_silver
					has_character_flag = guilds_resource_flag_incense
					has_character_flag = guilds_resource_flag_ivory
				}
			}
			scaled_wealth = { value = -1.25 min = -125 max = -1250 }
		}
		else = {
			scaled_wealth = { value = -1.5 min = -150 max = -1500 }
		}
		character_event = { id = SNW.396 days = 600 random = 200 }
	}
	option = { #i do not want this
		name = EVTOPTE_SNW_395
		clr_character_flag = guilds_resource_flag_stone
		clr_character_flag = guilds_resource_flag_grain
		clr_character_flag = guilds_resource_flag_meat
		clr_character_flag = guilds_resource_flag_steel
		clr_character_flag = guilds_resource_flag_lumber
		clr_character_flag = guilds_resource_flag_wool
		clr_character_flag = guilds_resource_flag_gem
		clr_character_flag = guilds_resource_flag_linen
		clr_character_flag = guilds_resource_flag_hide
		clr_character_flag = guilds_resource_flag_silver
		clr_character_flag = guilds_resource_flag_incense
		clr_character_flag = guilds_resource_flag_ivory
		clr_character_flag = guilds_resource_flag_gold
		clr_character_flag = guilds_resource_flag_spices
		clr_character_flag = guilds_resource_flag_silk
		custom_tooltip = { 
			text = resource_back_tooltip
			random_list = {
				10 = { set_variable = { which = "resource_variable" value = 4 } }
				10 = { set_variable = { which = "resource_variable" value = 3 } }
				10 = { set_variable = { which = "resource_variable" value = 2 } }
			}
			random_list = {
				10 = { character_event = { id = SNW.3940 days = 250 random = 50 } } #church land
				10 = { character_event = { id = SNW.3941 days = 250 random = 50 } } #bandits
				10 = { character_event = { id = SNW.3942 days = 250 random = 50 } } #farmland
				10 = { character_event = { id = SNW.3943 days = 250 random = 50 } } #borders
				10 = { character_event = { id = SNW.3944 days = 250 random = 50 } } #temparature
				10 = { character_event = { id = SNW.3945 days = 250 random = 50 } } #superstition
			}
		}
	}
	option = { #I give up
		name = EVTOPTF_SNW_395
		custom_tooltip = {
			text = abort_resource_tooltip
			set_variable = { which = "resource_variable" value = 0 }
			# remove_character_modifier = guilds_resources_timer
			add_character_modifier = {
				name = guilds_resources_timer
				duration = 1825
				hidden = yes
			}
			clear_event_target = resourcefull_province
			clr_character_flag = guilds_resource_flag_stone
			clr_character_flag = guilds_resource_flag_grain
			clr_character_flag = guilds_resource_flag_meat
			clr_character_flag = guilds_resource_flag_steel
			clr_character_flag = guilds_resource_flag_lumber
			clr_character_flag = guilds_resource_flag_wool
			clr_character_flag = guilds_resource_flag_gem
			clr_character_flag = guilds_resource_flag_linen
			clr_character_flag = guilds_resource_flag_hide
			clr_character_flag = guilds_resource_flag_silver
			clr_character_flag = guilds_resource_flag_incense
			clr_character_flag = guilds_resource_flag_ivory
			clr_character_flag = guilds_resource_flag_gold
			clr_character_flag = guilds_resource_flag_spices
			clr_character_flag = guilds_resource_flag_silk
			clr_character_flag = guilds_resource_flag_herd
		}
		ai_chance = {
			factor = 0
		}
	}
}

#Resource - exploit - end
character_event = {
    id = SNW.396
    desc = EVTDESC_SNW_396
	picture = GFX_evt_relaxed_ruler
	border = GFX_event_normal_frame_economy_guilds
	
    is_triggered_only = yes
	
	option = { #DONE
		name = EVTOPTA_SNW_396
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_resource_flag_stone = { 
				event_target:resourcefull_province = {
					add_province_modifier = {
						name = guilds_res_stone
						duration = -1
						hidden = yes
					}
				}
			}
			guilds_resource_flag_grain = { 
				event_target:resourcefull_province = {
					add_province_modifier = {
						name = guilds_res_grain
						duration = -1
						hidden = yes
					}
				}
			}
			guilds_resource_flag_meat = { 
				event_target:resourcefull_province = {
					add_province_modifier = {
						name = guilds_res_meat
						duration = -1
						hidden = yes
					}
				}
			}
			guilds_resource_flag_steel = { 
				event_target:resourcefull_province = {
					add_province_modifier = {
						name = guilds_res_steel
						duration = -1
						hidden = yes
					}
				}
			}
			guilds_resource_flag_lumber = { 
				event_target:resourcefull_province = {
					add_province_modifier = {
						name = guilds_res_lumber
						duration = -1
						hidden = yes
					}
				}
			}
			guilds_resource_flag_wool = { 
				event_target:resourcefull_province = {
					add_province_modifier = {
						name = guilds_res_wool
						duration = -1
						hidden = yes
					}
				}
			}
			guilds_resource_flag_gem = { 
				event_target:resourcefull_province = {
					add_province_modifier = {
						name = guilds_res_gem
						duration = -1
						hidden = yes
					}
				}
			}
			guilds_resource_flag_linen = { 
				event_target:resourcefull_province = {
					add_province_modifier = {
						name = guilds_res_linen
						duration = -1
						hidden = yes
					}
				}
			}
			guilds_resource_flag_hide = { 
				event_target:resourcefull_province = {
					add_province_modifier = {
						name = guilds_res_hide
						duration = -1
						hidden = yes
					}
				}
			}
			guilds_resource_flag_silver = { 
				event_target:resourcefull_province = {
					add_province_modifier = {
						name = guilds_res_silver
						duration = -1
						hidden = yes
					}
				}
			}
			guilds_resource_flag_incense = { 
				event_target:resourcefull_province = {
					add_province_modifier = {
						name = guilds_res_incense
						duration = -1
						hidden = yes
					}
				}
			}
			guilds_resource_flag_ivory = { 
				event_target:resourcefull_province = {
					add_province_modifier = {
						name = guilds_res_ivory
						duration = -1
						hidden = yes
					}
				}
			}
			guilds_resource_flag_gold = { 
				event_target:resourcefull_province = {
					add_province_modifier = {
						name = guilds_res_gold
						duration = -1
						hidden = yes
					}
				}
			}
			guilds_resource_flag_spices = { 
				event_target:resourcefull_province = {
					add_province_modifier = {
						name = guilds_res_spices
						duration = -1
						hidden = yes
					}
				}
			}
			guilds_resource_flag_silk = { 
				event_target:resourcefull_province = {
					add_province_modifier = {
						name = guilds_res_silk
						duration = -1
						hidden = yes
					}
				}
			}
		}
		hidden_tooltip = {
			event_target:resourcefull_province = { 
				province_event = { id = SNW.391 }
				if = {
					limit = {
						ROOT = { has_character_flag = guilds_resource_flag_help }
					}
					add_province_modifier = {
						name = guilds_res_help
						duration = 3650 #10 years
						hidden = yes
					}
				}
			}
			set_character_flag = guilds_got_resources_flag
			set_variable = { which = "resource_variable" value = 0 }
			# remove_character_modifier = guilds_resources_timer
			add_character_modifier = {
				name = guilds_resources_timer
				duration = 1825
				hidden = yes
			}
		}
		if = {
			limit = {
				NOT = { society_member_of = the_guilds }
			}
			custom_tooltip = { text = guilds_resource_income_tt }
			tooltip = {
				if = {
					limit = {
						OR = {
							has_character_flag = guilds_resource_flag_stone
							has_character_flag = guilds_resource_flag_grain
							has_character_flag = guilds_resource_flag_meat
						}
					}
					scaled_wealth = { value = 0.10 min = 10 max = 100 }
				}
				else_if = {
					limit = {
						OR = {
							has_character_flag = guilds_resource_flag_steel
							has_character_flag = guilds_resource_flag_lumber
							has_character_flag = guilds_resource_flag_wool
						}
					}
					scaled_wealth = { value = 0.30 min = 30 max = 300 }
				}
				else_if = {
					limit = {
						OR = {
							has_character_flag = guilds_resource_flag_gem
							has_character_flag = guilds_resource_flag_linen
							has_character_flag = guilds_resource_flag_hide
						}
					}
					scaled_wealth = { value = 0.55 min = 55 max = 550 }
				}
				else_if = {
					limit = {
						OR = {
							has_character_flag = guilds_resource_flag_silver
							has_character_flag = guilds_resource_flag_incense
							has_character_flag = guilds_resource_flag_ivory
						}
					}
					scaled_wealth = { value = 0.80 min = 80 max = 800 }
				}
				else = {
					scaled_wealth = { value = 1.05 min = 105 max = 1050 }
				}
			}
		}
		if = {
			limit = {
				has_character_flag = guilds_resource_flag_help
			}
			custom_tooltip = { text = guilds_resource_guildtax_tt }
			tooltip = {
				if = {
					limit = {
						OR = {
							has_character_flag = guilds_resource_flag_stone
							has_character_flag = guilds_resource_flag_grain
							has_character_flag = guilds_resource_flag_meat
						}
					}
					scaled_wealth = { value = -0.05 min = -5 max = -50 }
				}
				else_if = {
					limit = {
						OR = {
							has_character_flag = guilds_resource_flag_steel
							has_character_flag = guilds_resource_flag_lumber
							has_character_flag = guilds_resource_flag_wool
						}
					}
					scaled_wealth = { value = -0.15 min = -15 max = -150 }
				}
				else_if = {
					limit = {
						OR = {
							has_character_flag = guilds_resource_flag_gem
							has_character_flag = guilds_resource_flag_linen
							has_character_flag = guilds_resource_flag_hide
						}
					}
					scaled_wealth = { value = -0.27 min = -27 max = -275 }
				}
				else_if = {
					limit = {
						OR = {
							has_character_flag = guilds_resource_flag_silver
							has_character_flag = guilds_resource_flag_incense
							has_character_flag = guilds_resource_flag_ivory
						}
					}
					scaled_wealth = { value = -0.40 min = -40 max = -400 }
				}
				else = {
					scaled_wealth = { value = -0.52 min = -52 max = -525 }
				}
			}
		}
	}
	option = { #Betray the league
		name = EVTOPTB_SNW_396
		trigger = {
			NOT = { society_member_of = the_guilds }
			has_character_flag = guilds_resource_flag_help
			AI = no
		}
		custom_tooltip = { text = guilds_antagonize_trade_league }
		trigger_switch = {
			on_trigger = has_character_flag
			guilds_resource_flag_stone = { 
				event_target:resourcefull_province = {
					add_province_modifier = {
						name = guilds_res_stone
						duration = -1
						hidden = yes
					}
				}
			}
			guilds_resource_flag_grain = { 
				event_target:resourcefull_province = {
					add_province_modifier = {
						name = guilds_res_grain
						duration = -1
						hidden = yes
					}
				}
			}
			guilds_resource_flag_meat = { 
				event_target:resourcefull_province = {
					add_province_modifier = {
						name = guilds_res_meat
						duration = -1
						hidden = yes
					}
				}
			}
			guilds_resource_flag_steel = { 
				event_target:resourcefull_province = {
					add_province_modifier = {
						name = guilds_res_steel
						duration = -1
						hidden = yes
					}
				}
			}
			guilds_resource_flag_lumber = { 
				event_target:resourcefull_province = {
					add_province_modifier = {
						name = guilds_res_lumber
						duration = -1
						hidden = yes
					}
				}
			}
			guilds_resource_flag_wool = { 
				event_target:resourcefull_province = {
					add_province_modifier = {
						name = guilds_res_wool
						duration = -1
						hidden = yes
					}
				}
			}
			guilds_resource_flag_gem = { 
				event_target:resourcefull_province = {
					add_province_modifier = {
						name = guilds_res_gem
						duration = -1
						hidden = yes
					}
				}
			}
			guilds_resource_flag_linen = { 
				event_target:resourcefull_province = {
					add_province_modifier = {
						name = guilds_res_linen
						duration = -1
						hidden = yes
					}
				}
			}
			guilds_resource_flag_hide = { 
				event_target:resourcefull_province = {
					add_province_modifier = {
						name = guilds_res_hide
						duration = -1
						hidden = yes
					}
				}
			}
			guilds_resource_flag_silver = { 
				event_target:resourcefull_province = {
					add_province_modifier = {
						name = guilds_res_silver
						duration = -1
						hidden = yes
					}
				}
			}
			guilds_resource_flag_incense = { 
				event_target:resourcefull_province = {
					add_province_modifier = {
						name = guilds_res_incense
						duration = -1
						hidden = yes
					}
				}
			}
			guilds_resource_flag_ivory = { 
				event_target:resourcefull_province = {
					add_province_modifier = {
						name = guilds_res_ivory
						duration = -1
						hidden = yes
					}
				}
			}
			guilds_resource_flag_gold = { 
				event_target:resourcefull_province = {
					add_province_modifier = {
						name = guilds_res_gold
						duration = -1
						hidden = yes
					}
				}
			}
			guilds_resource_flag_spices = { 
				event_target:resourcefull_province = {
					add_province_modifier = {
						name = guilds_res_spices
						duration = -1
						hidden = yes
					}
				}
			}
			guilds_resource_flag_silk = { 
				event_target:resourcefull_province = {
					add_province_modifier = {
						name = guilds_res_silk
						duration = -1
						hidden = yes
					}
				}
			}
		}
		hidden_tooltip = {
			event_target:resourcefull_province = { 
				province_event = { id = SNW.391 }
				# if = { #no money for the guild
					# limit = {
						# ROOT = { has_character_flag = guilds_resource_flag_help }
					# }
					# add_province_modifier = {
						# name = guilds_res_help
						# duration = 3650 #10 years
						# hidden = yes
					# }
				# }
			}
			set_character_flag = guilds_traitor
			set_character_flag = guilds_got_resources_flag
			set_variable = { which = "resource_variable" value = 0 }
			# remove_character_modifier = guilds_resources_timer
			add_character_modifier = {
				name = guilds_resources_timer
				duration = 1825
				hidden = yes
			}
		}
		if = {
			limit = {
				NOT = { society_member_of = the_guilds }
			}
			custom_tooltip = { text = guilds_resource_income_tt }
			tooltip = {
				if = {
					limit = {
						OR = {
							has_character_flag = guilds_resource_flag_stone
							has_character_flag = guilds_resource_flag_grain
							has_character_flag = guilds_resource_flag_meat
						}
					}
					scaled_wealth = { value = 0.10 min = 10 max = 100 }
				}
				else_if = {
					limit = {
						OR = {
							has_character_flag = guilds_resource_flag_steel
							has_character_flag = guilds_resource_flag_lumber
							has_character_flag = guilds_resource_flag_wool
						}
					}
					scaled_wealth = { value = 0.30 min = 30 max = 300 }
				}
				else_if = {
					limit = {
						OR = {
							has_character_flag = guilds_resource_flag_gem
							has_character_flag = guilds_resource_flag_linen
							has_character_flag = guilds_resource_flag_hide
						}
					}
					scaled_wealth = { value = 0.55 min = 55 max = 550 }
				}
				else_if = {
					limit = {
						OR = {
							has_character_flag = guilds_resource_flag_silver
							has_character_flag = guilds_resource_flag_incense
							has_character_flag = guilds_resource_flag_ivory
						}
					}
					scaled_wealth = { value = 0.80 min = 80 max = 800 }
				}
				else = {
					scaled_wealth = { value = 1.05 min = 105 max = 1050 }
				}
			}
		}
	}
	after = {
		clear_event_target = resourcefull_province
		clr_character_flag = guilds_resource_flag_stone
		clr_character_flag = guilds_resource_flag_grain
		clr_character_flag = guilds_resource_flag_meat
		clr_character_flag = guilds_resource_flag_steel
		clr_character_flag = guilds_resource_flag_lumber
		clr_character_flag = guilds_resource_flag_wool
		clr_character_flag = guilds_resource_flag_gem
		clr_character_flag = guilds_resource_flag_linen
		clr_character_flag = guilds_resource_flag_hide
		clr_character_flag = guilds_resource_flag_silver
		clr_character_flag = guilds_resource_flag_incense
		clr_character_flag = guilds_resource_flag_ivory
		clr_character_flag = guilds_resource_flag_gold
		clr_character_flag = guilds_resource_flag_spices
		clr_character_flag = guilds_resource_flag_silk
		clr_character_flag = guilds_resource_flag_help
		clr_character_flag = guilds_resource_flag_herd
	}
}

#Resource - debug test
character_event = {
    id = SNW.399
    desc = EVTDESC_SNW_396
	picture = GFX_evt_council_quarrelling_unused
	border = GFX_event_normal_frame_economy_guilds
	
    is_triggered_only = yes
	
	option = {
		name = EVTOPTA_SNW_396
		location = {
			random_list = {
				25 = {
					modifier = {
						factor = 4
						OR = {
							terrain = hills
							terrain = mountain
						}
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = forest
							terrain = jungle
						}
					}
					add_province_modifier = {
						name = guilds_res_stone
						duration = -1
						hidden = yes
					}
					province_event = { id = SNW.391 }
				}
				25 = {
					modifier = {
						factor = 6
						terrain = farmlands
					}
					modifier = {
						factor = 3
						OR = {
							terrain = plains
							terrain = steppe
						}
					}
					modifier = {
						factor = 0.75
						OR = {
							terrain = hills
							terrain = forest
						}
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = jungle
							terrain = desert
						}
					}
					modifier = {
						factor = 0.1
						terrain = arctic
						terrain = mountain
					}
					modifier = {
						factor = 2
						OR = {
							borders_lake = yes
							borders_major_river = yes
						}
					}
					add_province_modifier = {
						name = guilds_res_grain
						duration = -1
						hidden = yes
					}
					province_event = { id = SNW.391 }
				}
				25 = {
					modifier = {
						factor = 4
						terrain = farmlands
					}
					modifier = {
						factor = 3
						OR = {
							port = yes
							terrain = forest
						}
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = mountain
							terrain = desert
						}
					}
					add_province_modifier = {
						name = guilds_res_meat
						duration = -1
						hidden = yes
					}
					province_event = { id = SNW.391 }
				}
				20 = {
					modifier = {
						factor = 4
						OR = {
							terrain = hills
							terrain = mountain
						}
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = forest
							terrain = jungle
						}
					}
					add_province_modifier = {
						name = guilds_res_steel
						duration = -1
						hidden = yes
					}
					province_event = { id = SNW.391 }
				}
				20 = {
					modifier = {
						factor = 6
						OR = {
							terrain = forest
							terrain = jungle
						}
					}
					modifier = {
						factor = 0.75
						OR = {
							terrain = farmlands
							terrain = steppe
						}
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = mountain
							terrain = arctic
						}
					}
					modifier = {
						factor = 0.1
						terrain = desert
					}
					add_province_modifier = {
						name = guilds_res_lumber
						duration = -1
						hidden = yes
					}
					province_event = { id = SNW.391 }
				}
				20 = {
					modifier = {
						factor = 4
						OR = {
							terrain = plains
							terrain = steppe
						}
					}
					modifier = {
						factor = 2.5
						OR = {
							terrain = farmlands
							terrain = hills
						}
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = mountain
							terrain = forest
							terrain = jungle
							terrain = arctic
						}
					}
					add_province_modifier = {
						name = guilds_res_wool
						duration = -1
						hidden = yes
					}
					province_event = { id = SNW.391 }
				}
				15 = {
					modifier = {
						factor = 3.5
						OR = {
							terrain = hills
							terrain = mountain
						}
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = forest
							terrain = jungle
						}
					}
					add_province_modifier = {
						name = guilds_res_gem
						duration = -1
						hidden = yes
					}
					province_event = { id = SNW.391 }
				}
				15 = {
					modifier = {
						factor = 5
						terrain = farmlands
					}
					modifier = {
						factor = 2.5
						OR = {
							terrain = plains
							terrain = steppe
						}
					}
					modifier = {
						factor = 0.75
						OR = {
							terrain = hills
							terrain = forest
						}
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = jungle
							terrain = mountain
						}
					}
					modifier = {
						factor = 0.25
						OR = {
							terrain = arctic
							terrain = desert
						}
					}
					modifier = {
						factor = 1.5
						OR = {
							borders_lake = yes
							borders_major_river = yes
						}
					}
					add_province_modifier = {
						name = guilds_res_linen
						duration = -1
						hidden = yes
					}
					province_event = { id = SNW.391 }
				}
				15 = {
					modifier = {
						factor = 3
						OR = {
							terrain = farmlands
							terrain = forest
							terrain = steppe
						}
					}
					modifier = {
						factor = 0.75
						terrain = hills
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = jungle
							terrain = mountain
							terrain = desert
						}
					}
					add_province_modifier = {
						name = guilds_res_hide
						duration = -1
						hidden = yes
					}
					province_event = { id = SNW.391 }
				}
				10 = {
					modifier = {
						factor = 4
						OR = {
							terrain = hills
							terrain = mountain
						}
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = forest
							terrain = jungle
						}
					}
					add_province_modifier = {
						name = guilds_res_silver
						duration = -1
						hidden = yes
					}
					province_event = { id = SNW.391 }
				}
				10 = {
					modifier = {
						factor = 6
						OR = {
							terrain = jungle
							terrain = desert
						}
					}
					modifier = {
						factor = 0.50
						OR = {
							terrain = forest
							terrain = hills
							terrain = farmlands
							terrain = plains
						}
					}
					modifier = {
						factor = 0.25
						terrain = mountain
					}
					modifier = {
						factor = 0.1
						terrain = arctic
					}
					add_province_modifier = {
						name = guilds_res_incense
						duration = -1
						hidden = yes
					}
					province_event = { id = SNW.391 }
				}
				10 = {
					modifier = {
						factor = 6
						OR = {
							terrain = jungle
							terrain = desert
						}
					}
					modifier = {
						factor = 3.5
						terrain = arctic
						port = yes
					}
					modifier = {
						factor = 1.5
						terrain = arctic
						port = no
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = forest
							terrain = farmlands
							terrain = plains
							terrain = steppe
						}
					}
					modifier = {
						factor = 0.25
						OR = {
							terrain = mountain
							terrain = hills
						}
					}
					add_province_modifier = {
						name = guilds_res_ivory
						duration = -1
						hidden = yes
					}
					province_event = { id = SNW.391 }
				}
				5 = {
					modifier = {
						factor = 4
						OR = {
							terrain = hills
							terrain = mountain
						}
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = forest
							terrain = jungle
						}
					}
					add_province_modifier = {
						name = guilds_res_gold
						duration = -1
						hidden = yes
					}
					province_event = { id = SNW.391 }
				}
				5 = {
					modifier = {
						factor = 6
						OR = {
							terrain = jungle
							terrain = desert
						}
					}
					modifier = {
						factor = 0.75
						OR = {
							terrain = plains
							terrain = steppe
						}
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = forest
							terrain = hills
						}
					}
					modifier = {
						factor = 0.1
						OR = {
							terrain = mountain
							terrain = arctic
						}
					}
					add_province_modifier = {
						name = guilds_res_spices
						duration = -1
						hidden = yes
					}
					province_event = { id = SNW.391 }
				}
				5 = {
					modifier = {
						factor = 8
						trade_route = silk_road
					}
					modifier = {
						factor = 0.75
						OR = {
							terrain = forest
							terrain = hills
						}
					}
					modifier = {
						factor = 0.5
						OR = {
							terrain = mountain
							terrain = arctic
						}
					}
					add_province_modifier = {
						name = guilds_res_silk
						duration = -1
						hidden = yes
					}
					province_event = { id = SNW.391 }
				}
			}
		}
	}
}

#Apprentice Flavor start
character_event = {
    id = SNW.400
	hide_window = yes
    is_triggered_only = yes
	
	ai = no #only humans have apprentice to not flood the society with landless characters
	
	trigger = {
		society_member_of = the_guilds
		any_courtier = { has_minor_title = title_guilds_apprentice }
	}
	
    immediate = {
		any_courtier = {
			limit = { has_minor_title = title_guilds_apprentice }
			character_event = { id = SNW.401 days = 80 random = 40 }
		}
    }
}

#Apprentice Flavor ping
character_event = {
    id = SNW.401
	hide_window = yes
    is_triggered_only = yes
	
    immediate = {
		FROM = {
			random_list = {
				10 = { #gain assets
					letter_event = { id = SNW.402 }
				}
				5 = { #lose assets
					modifier = {
						factor = 2
						ROOT = {
							OR = {
								NOR = { 
									stewardship = 10
									is_adult = no
								}
								NOR = { 
									stewardship = 5
									is_adult = yes
								}
							}
						}
					}
					modifier = {
						factor = 2
						ROOT = {
							OR = {
								NOR = { 
									stewardship = 6
									is_adult = no
								}
								NOR = { 
									stewardship = 3
									is_adult = yes
								}
							}
						}
					}
					letter_event = { id = SNW.403 }
				}
				10 = { #gain gold
					letter_event = { id = SNW.404 }
				}
				5 = { #lose gold
					modifier = {
						factor = 2
						ROOT = {
							OR = {
								NOR = { 
									stewardship = 10
									is_adult = no
								}
								NOR = { 
									stewardship = 5
									is_adult = yes
								}
							}
						}
					}
					modifier = {
						factor = 2
						ROOT = {
							OR = {
								NOR = { 
									stewardship = 6
									is_adult = no
								}
								NOR = { 
									stewardship = 3
									is_adult = yes
								}
							}
						}
					}
					letter_event = { id = SNW.405 }
				}
				10 = { #grain gold
					trigger = {
						ROOT = { NOT = { has_artifact = guilds_item_grain } }
					}
					letter_event = { id = SNW.406 }
				}
				5 = { #stole
					modifier = {
						factor = 2
						ROOT = {
							OR = {
								trait = deceitful
								trait = haughty
							}
						}
					}
					modifier = {
						factor = 2
						ROOT = {
							OR = {
								NOR = { 
									stewardship = 10
									is_adult = no
								}
								NOR = { 
									stewardship = 5
									is_adult = yes
								}
							}
						}
					}
					modifier = {
						factor = 2
						ROOT = {
							OR = {
								NOR = { 
									stewardship = 6
									is_adult = no
								}
								NOR = { 
									stewardship = 3
									is_adult = yes
								}
							}
						}
					}
					letter_event = { id = SNW.407 }
				}
				10 = { #too gentle
					letter_event = { id = SNW.408 }
					modifier = {
						factor = 2
						ROOT = {
							OR = {
								trait = affectionate
								trait = kind
								trait = charitable
							}
						}
					}
				}
				10 = { #random crafted
					modifier = {
						factor = 2
						ROOT = {
							OR = {
								OR = { 
									stewardship = 10
									is_adult = yes
								}
								OR = { 
									stewardship = 5
									is_adult = no
								}
							}
						}
					}
					letter_event = { id = SNW.409 }
				}
			}
		}
    }
}

#Apprentice Flavor gain asset
letter_event = {
    id = SNW.402
    desc = EVTDESC_SNW_402
	border = GFX_event_letter_frame_economy_guilds
	
    is_triggered_only = yes

    option = { #praise into proud
        name = EVTOPTA_SNW_402
		change_society_currency = 50
		FROM = {
			if = {
				limit = {
					trait = humble
				}
				random = {
					chance = 75
					remove_trait = humble
				}
			}
			else_if = {
				limit = {
					trait = haughty
				}
				random = {
					chance = 75
					remove_trait = haughty
					add_trait = proud
				}
			}
			else_if = {
				limit = {
					NOR = { 
						trait = humble
						trait = proud
					}
				}
				random = {
					chance = 75
					add_trait = proud
				}
			}
			else_if = {
				limit = {
					trait = content
				}
				random = {
					chance = 75
					remove_trait = content
				}
			}
			else_if = {
				limit = {
					NOR = { 
						trait = content
						trait = ambitious
					}
				}
				random = {
					chance = 75
					add_trait = ambitious
				}
			}
		}
    }
    option = { #warn about over confidence
        name = EVTOPTB_SNW_402
		change_society_currency = 50
		FROM = {
			if = {
				limit = {
					trait = timid
				}
				random = {
					chance = 75
					remove_trait = timid
					add_trait = shy
				}
			}
			else_if = {
				limit = {
					NOR = { 
						trait = gregarious
						trait = shy
					}
				}
				random = {
					chance = 75
					add_trait = shy
				}
			}
			else_if = {
				limit = {
					NOR = {
						trait = patient
						trait = wroth
					}
				}
				random = {
					chance = 75
					add_trait = patient
				}
			}
		}
    }
}

#Apprentice Flavor lose asset
letter_event = {
    id = SNW.403
    desc = EVTDESC_SNW_403
	border = GFX_event_letter_frame_economy_guilds
	
    is_triggered_only = yes

    option = { #discipline
        name = EVTOPTA_SNW_403
		change_society_currency = -50
		FROM = {
			if = {
				limit = {
					trait = lustful
				}
				random = {
					chance = 75
					remove_trait = lustful
				}
			}
			else_if = {
				limit = {
					trait = conscientious
				}
				random = {
					chance = 75
					remove_trait = conscientious
					add_trait = cynical
				}
			}
			if = {
				limit = {
					trait = trusting
				}
				random = {
					chance = 75
					remove_trait = trusting
				}
			}
			else_if = {
				limit = {
					NOR = { 
						trait = paranoid
						trait = trusting
					}
				}
				random = {
					chance = 75
					add_trait = paranoid
				}
			}
			else_if = {
				limit = {
					NOR = { 
						trait = brave
						trait = craven
					}
				}
				random = {
					chance = 25
					add_trait = craven
				}
			}
		}
    }
    option = { #teach
        name = EVTOPTB_SNW_403
		change_society_currency = -50
		FROM = {
			if = {
				limit = {
					trait = gluttonous
				}
				random = {
					chance = 75
					remove_trait = gluttonous
				}
			}
			else_if = {
				limit = {
					trait = conscientious
				}
				random = {
					chance = 75
					remove_trait = conscientious
					add_trait = temperate
				}
			}
			else_if = {
				limit = {
					NOR = {
						trait = paranoid
						trait = trusting
					}
				}
				random = {
					chance = 75
					add_trait = paranoid
				}
			}
			else_if = {
				limit = {
					NOR = {
						trait = gluttonous
						trait = temperate
					}
				}
				random = {
					chance = 75
					add_trait = temperate
				}
			}
			if = {
				limit = {
					trait = lustful
				}
				random = {
					chance = 75
					remove_trait = lustful
				}
			}
		}
    }
}

#Apprentice Flavor gain gold
letter_event = {
    id = SNW.404
    desc = EVTDESC_SNW_404
	border = GFX_event_letter_frame_economy_guilds
	
    is_triggered_only = yes

    option = { #pocket and praise
        name = EVTOPTA_SNW_404
		wealth = 30
		FROM = {
			if = {
				limit = {
					trait = trusting
				}
				random = {
					chance = 75
					remove_trait = trusting
				}
			}
			else_if = {
				limit = {
					trait = brooding
				}
				random = {
					chance = 75
					remove_trait = brooding
					add_trait = envious 
				}
			}
			else_if = {
				limit = {
					NOR = { 
						trait = envious
						trait = kind
					}
				}
				random = {
					chance = 75
					add_trait = envious
				}
			}
			else_if = {
				limit = {
					NOR = { 
						trait = zealous
						trait = cynical
					}
				}
				random = {
					chance = 75
					add_trait = cynical
				}
			}
		}
    }
    option = { #teach how in invest
        name = EVTOPTB_SNW_404
		FROM = { wealth = 30 }
		FROM = {
			if = {
				limit = {
					NOR = {
						trait = wroth
						trait = patient
					}
				}
				random = {
					chance = 75
					add_trait = patient
				}
			}
			else_if = {
				limit = {
					trait = brooding
				}
				random = {
					chance = 75
					remove_trait = brooding
					add_trait = diligent
				}
			}
			else_if = {
				limit = {
					NOR = {
						trait = paranoid
						trait = trusting
					}
				}
				random = {
					chance = 75
					add_trait = trusting
				}
			}
			else_if = {
				limit = {
					NOR = {
						trait = charitable
						trait = greedy
					}
				}
				random = {
					chance = 75
					add_trait = greedy
				}
			}
		}
    }
}

#Apprentice Flavor lose gold
letter_event = {
    id = SNW.405
    desc = EVTDESC_SNW_405
	border = GFX_event_letter_frame_economy_guilds
	
    is_triggered_only = yes

    option = { #anger
        name = EVTOPTA_SNW_405
		FROM = { wealth = -30 }
		FROM = {
			if = {
				limit = {
					trait = trusting
				}
				random = {
					chance = 75
					remove_trait = trusting
				}
			}
			else_if = {
				limit = {
					trait = rowdy
				}
				random = {
					chance = 75
					remove_trait = rowdy
					add_trait = wroth 
				}
			}
			else_if = {
				limit = {
					trait = brave
				}
				random = {
					chance = 75
					remove_trait = brave
				}
			}
			else_if = {
				limit = {
					NOR = { 
						trait = brave
						trait = craven
					}
				}
				random = {
					chance = 75
					add_trait = craven
				}
			}
		}
    }
    option = { #teach how to not fail
        name = EVTOPTB_SNW_405
		wealth = -30
		FROM = {
			if = {
				limit = {
					trait = paranoid
				}
				random = {
					chance = 75
					remove_trait = paranoid
				}
			}
			else_if = {
				limit = {
					trait = affectionate
				}
				random = {
					chance = 75
					remove_trait = affectionate
					add_trait = kind
				}
			}
			else_if = {
				limit = {
					trait = greedy
				}
				random = {
					chance = 75
					remove_trait = greedy
				}
			}
			else_if = {
				limit = {
					NOR = {
						trait = charitable
						trait = greedy
					}
				}
				random = {
					chance = 75
					add_trait = charitable
				}
			}
		}
    }
}

#Apprentice Flavor fake gold
letter_event = {
    id = SNW.406
    desc = EVTDESC_SNW_406
	border = GFX_event_letter_frame_economy_guilds
	
    is_triggered_only = yes

    option = { #facepalm
        name = EVTOPTA_SNW_406
		random = {
			chance = 33
			add_trait = stressed
		}
		FROM = { add_artifact = guilds_item_grain }
		FROM = {
			if = {
				limit = {
					trait = paranoid
				}
				random = {
					chance = 75
					remove_trait = paranoid
				}
			}
			else_if = {
				limit = {
					trait = indolent
				}
				random = {
					chance = 75
					remove_trait = indolent
					add_trait = trusting 
				}
			}
			else_if = {
				limit = {
					NOR = { 
						trait = paranoid
						trait = trusting
					}
				}
				random = {
					chance = 75
					add_trait = trusting
				}
			}
			else_if = {
				limit = {
					trait = deceitful
				}
				random = {
					chance = 75
					remove_trait = deceitful
				}
			}
			else_if = {
				limit = {
					NOR = { 
						trait = deceitful
						trait = honest
					}
				}
				random = {
					chance = 75
					add_trait = honest
				}
			}
		}
    }
    option = { #sell it to me!
        name = EVTOPTB_SNW_406
		scaled_wealth = { value = -0.35 min = -35 max = -350 }
		add_artifact = guilds_item_grain
		FROM = {
			if = {
				limit = {
					trait = honest
				}
				random = {
					chance = 75
					remove_trait = honest
				}
			}
			else_if = {
				limit = {
					trait = playful
				}
				random = {
					chance = 75
					remove_trait = playful
					add_trait = deceitful
				}
			}
			else_if = {
				limit = {
					NOR = {
						trait = honest
						trait = deceitful
					}
				}
				random = {
					chance = 75
					add_trait = deceitful
				}
			}
			else_if = {
				limit = {
					trait = humble
				}
				random = {
					chance = 75
					remove_trait = humble
				}
			}
			else_if = {
				limit = {
					NOR = {
						trait = humble
						trait = proud
					}
				}
				random = {
					chance = 75
					add_trait = proud
				}
			}
		}
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
    }
}

#Apprentice Flavor stolen
letter_event = {
    id = SNW.407
    desc = EVTDESC_SNW_407
	border = GFX_event_letter_frame_economy_guilds
	
    is_triggered_only = yes

    option = { #punish
        name = EVTOPTA_SNW_407
		wealth = -50
		FROM = {
			random = {
				chance = 25
				add_trait_wounded_effect = yes
			}
			if = {
				limit = {
					trait = honest
				}
				random = {
					chance = 75
					remove_trait = honest
				}
			}
			else_if = {
				limit = {
					NOR = { 
						trait = honest
						trait = deceitful
					}
				}
				random = {
					chance = 75
					add_trait = deceitful
				}
			}
			else_if = {
				limit = {
					trait = indolent
				}
				random = {
					chance = 75
					remove_trait = indolent
					add_trait = deceitful 
				}
			}
			else_if = {
				limit = {
					trait = just
				}
				random = {
					chance = 75
					remove_trait = just
				}
			}
			else_if = {
				limit = {
					NOR = { 
						trait = just
						trait = arbitrary
					}
				}
				random = {
					chance = 75
					add_trait = arbitrary
				}
			}
		}
    }
    option = { #un-apprentice
        name = EVTOPTB_SNW_407
		wealth = -50
        FROM = { 
        	set_character_flag = completed_apprenticeship 
        	remove_title = title_guilds_apprentice
			leave_society = yes
			if = {
				limit = {
					trait = temperate
				}
				random = {
					chance = 75
					remove_trait = temperate
				}
			}
			else_if = {
				limit = {
					trait = indolent
				}
				random = {
					chance = 75
					remove_trait = indolent
					add_trait = gluttonous 
				}
			}
			else_if = {
				limit = {
					NOR = { 
						trait = temperate
						trait = gluttonous
					}
				}
				random = {
					chance = 75
					add_trait = gluttonous
				}
			}
			else_if = {
				limit = {
					trait = just
				}
				random = {
					chance = 75
					remove_trait = just
				}
			}

			else_if = {
				limit = {
					NOR = { 
						trait = just
						trait = arbitrary
					}
				}
				random = {
					chance = 75
					add_trait = arbitrary
				}
			}
		}
    }
}

#Apprentice Flavor too nice
letter_event = {
    id = SNW.408
    desc = EVTDESC_SNW_408
	border = GFX_event_letter_frame_economy_guilds
	
    is_triggered_only = yes

    option = { #teach how to be less nice
        name = EVTOPTA_SNW_408
		FROM = {
			if = {
				limit = {
					trait = kind
				}
				random = {
					chance = 75
					remove_trait = kind
				}
			}
			else_if = {
				limit = {
					trait = affectionate
				}
				random = {
					chance = 75
					remove_trait = affectionate
					add_trait = envious 
				}
			}
			else_if = {
				limit = {
					NOR = { 
						trait = kind
						trait = envious
					}
				}
				random = {
					chance = 75
					add_trait = envious
				}
			}
			else_if = {
				limit = {
					trait = trusting
				}
				random = {
					chance = 75
					remove_trait = trusting
				}
			}
			else_if = {
				limit = {
					NOR = { 
						trait = trusting
						trait = paranoid
					}
				}
				random = {
					chance = 75
					add_trait = paranoid
				}
			}
		}
    }
    option = { #teach how to be greedy
        name = EVTOPTB_SNW_408
		FROM = {
			if = {
				limit = {
					trait = charitable
				}
				random = {
					chance = 75
					remove_trait = charitable
				}
			}
			else_if = {
				limit = {
					trait = affectionate
				}
				random = {
					chance = 75
					remove_trait = affectionate
					add_trait = greedy 
				}
			}
			else_if = {
				limit = {
					NOR = { 
						trait = charitable
						trait = greedy
					}
				}
				random = {
					chance = 75
					add_trait = greedy
				}
			}
			else_if = {
				limit = {
					trait = honest
				}
				random = {
					chance = 75
					remove_trait = honest
				}
			}
			else_if = {
				limit = {
					NOR = { 
						trait = honest
						trait = deceitful
					}
				}
				random = {
					chance = 75
					add_trait = deceitful
				}
			}
		}
    }
}

#Apprentice Flavor artisans
letter_event = {
    id = SNW.409
    desc = EVTDESC_SNW_409
	border = GFX_event_letter_frame_economy_guilds
	
    is_triggered_only = yes

    option = { #glass
        name = EVTOPTA_SNW_409
		scaled_wealth = { value = -0.90 min = -90 max = -900 }
		add_artifact = guilds_item_glassware
		custom_tooltip = { text = guilds_item_glassware_tooltip }
		FROM = {
			if = {
				limit = {
					trait = arbitrary
				}
				random = {
					chance = 75
					remove_trait = arbitrary
				}
			}
			else_if = {
				limit = {
					trait = slothful
				}
				random = {
					chance = 75
					remove_trait = slothful
				}
			}
			else_if = {
				limit = {
					trait = conscientious
				}
				random = {
					chance = 75
					remove_trait = conscientious
					add_trait = diligent 
				}
			}
			else_if = {
				limit = {
					NOR = { 
						trait = slothful
						trait = diligent
					}
				}
				random = {
					chance = 75
					add_trait = diligent
				}
			}
			else_if = {
				limit = {
					trait = shy
				}
				random = {
					chance = 75
					remove_trait = shy
				}
			}
			else_if = {
				limit = {
					NOR = { 
						trait = shy
						trait = gregarious
					}
				}
				random = {
					chance = 75
					add_trait = gregarious
				}
			}
		}
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
    }
    option = { #music
        name = EVTOPTB_SNW_409
		scaled_wealth = { value = -0.90 min = -90 max = -900 }
		add_artifact = guilds_item_music
		custom_tooltip = { text = guilds_item_music_tooltip }
		FROM = {
			if = {
				limit = {
					trait = arbitrary
				}
				random = {
					chance = 75
					remove_trait = arbitrary
				}
			}
			else_if = {
				limit = {
					trait = slothful
				}
				random = {
					chance = 75
					remove_trait = slothful
				}
			}
			else_if = {
				limit = {
					trait = conscientious
				}
				random = {
					chance = 75
					remove_trait = conscientious
					add_trait = diligent 
				}
			}
			else_if = {
				limit = {
					NOR = { 
						trait = slothful
						trait = diligent
					}
				}
				random = {
					chance = 75
					add_trait = diligent
				}
			}
			else_if = {
				limit = {
					trait = shy
				}
				random = {
					chance = 75
					remove_trait = shy
				}
			}
			else_if = {
				limit = {
					NOR = { 
						trait = shy
						trait = gregarious
					}
				}
				random = {
					chance = 75
					add_trait = gregarious
				}
			}
		}
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
    }
    option = { #velvet
        name = EVTOPTC_SNW_409
		scaled_wealth = { value = -0.90 min = -90 max = -900 }
		add_artifact = guilds_item_velvet
		custom_tooltip = { text = guilds_item_velvet_tooltip }
		FROM = {
			if = {
				limit = {
					trait = arbitrary
				}
				random = {
					chance = 75
					remove_trait = arbitrary
				}
			}
			else_if = {
				limit = {
					trait = slothful
				}
				random = {
					chance = 75
					remove_trait = slothful
				}
			}
			else_if = {
				limit = {
					trait = conscientious
				}
				random = {
					chance = 75
					remove_trait = conscientious
					add_trait = diligent 
				}
			}
			else_if = {
				limit = {
					NOR = { 
						trait = slothful
						trait = diligent
					}
				}
				random = {
					chance = 75
					add_trait = diligent
				}
			}
			else_if = {
				limit = {
					trait = shy
				}
				random = {
					chance = 75
					remove_trait = shy
				}
			}
			else_if = {
				limit = {
					NOR = { 
						trait = shy
						trait = gregarious
					}
				}
				random = {
					chance = 75
					add_trait = gregarious
				}
			}
		}
		hidden_tooltip = {
			change_variable = { which = guildsxp value = 1 }
		}
    }
    option = { #nothing
        name = EVTOPTD_SNW_409
		FROM = {
			if = {
				limit = {
					trait = arbitrary
				}
				random = {
					chance = 75
					remove_trait = arbitrary
				}
			}
			else_if = {
				limit = {
					trait = slothful
				}
				random = {
					chance = 75
					remove_trait = slothful
				}
			}
			else_if = {
				limit = {
					trait = conscientious
				}
				random = {
					chance = 75
					remove_trait = conscientious
					add_trait = diligent 
				}
			}
			else_if = {
				limit = {
					NOR = { 
						trait = slothful
						trait = diligent
					}
				}
				random = {
					chance = 75
					add_trait = diligent
				}
			}
			else_if = {
				limit = {
					trait = shy
				}
				random = {
					chance = 75
					remove_trait = shy
				}
			}
			else_if = {
				limit = {
					NOR = { 
						trait = shy
						trait = gregarious
					}
				}
				random = {
					chance = 75
					add_trait = gregarious
				}
			}
		}
    }
}

#Mission: Focus on Business
character_event = {
    id = SNW.410
    hide_window = yes
    is_triggered_only = yes
	
    immediate = {
		FROM = {
			society_quest_event = { id = SNW.411 days = 7 random = 7 }
		}
	}
}

#Focus business
society_quest_event = {
	id = SNW.411
	# desc = EVTDESC_CHI_411

	desc = {
		text = EVTDESC_SNW_411
		trigger = { 
			event_target:guilds_collaborator = {
				NOT = { has_minor_title = title_guilds_apprentice }
			}
		}
	}
	desc = {
		text = EVTDESC_SNW_411_apprentice
		trigger = { 
			event_target:guilds_collaborator = {
				has_minor_title = title_guilds_apprentice
			}
		}
	}
	
	is_triggered_only = yes

	trigger = {
		NOR = {
			has_focus = focus_business
			has_any_quest = yes
		}
	}
	
	option = { 
		name = ACCEPT

		set_quest = quest_guilds_focus
		
		if = {
			limit = { #Force ai to pick focus or not.
				ai = yes
			}
			character_event = { id = SNW.4111 days = 100 random = 30 }
		}

	}

	option = {
		name = DECLINE
		custom_tooltip = { text = decline_quest_tooltip }

		add_character_modifier = {
			name = quest_cooldown_timer
			hidden = yes
			days = 1000
		}

		ai_chance = { factor = 0 }
	}
}

#Focus business AI end
character_event = {
	id = SNW.4111
	is_triggered_only = yes
	hide_window = yes
	
	immediate = {
		if = {
			limit = {
				has_quest = quest_guilds_focus
			}
			set_focus = focus_business
		}
	}
}

#Focus business on_action ping
character_event = {
	id = SNW.412
	is_triggered_only = yes
	hide_window = yes

	
	trigger = {
		society_member_of = the_guilds
		has_focus = focus_business
		has_quest = quest_guilds_focus
	}
	
	immediate = {
		society = {
			random_society_member = {
				limit = {
					NOT = { character = ROOT }
					society_rank = 4
				}
				character_event = {
					id = SNW.413
				}
			}
		}
	}
}

#Focus business completion ping
character_event = {
	id = SNW.413
	is_triggered_only = yes
	hide_window = yes

	immediate = {
		FROM = { letter_event = { id = SNW.414 } }
	}
}

#Focus business completion
letter_event = {
	id = SNW.414
	desc = EVTDESC_SNW_414
	border = GFX_event_letter_frame_economy_guilds

	is_triggered_only = yes

	option = { #Quest will success
		name = EVTOPTA_SNW_414
		clr_quest = quest_guilds_focus
		sound_effect = monastic_orders_donate_charity
		add_guilds_mission_succeed_influence_effect = yes
		change_society_currency = 150
	}
}

#Mission: Send Caravan
character_event = {
    id = SNW.420
    hide_window = yes
    is_triggered_only = yes
	
    immediate = {
		FROM = {
			society_quest_event = { id = SNW.421 days = 7 random = 7 }
		}
	}
}

#Send Caravan
society_quest_event = {
	id = SNW.421
	# desc = EVTDESC_CHI_421

	desc = {
		text = EVTDESC_SNW_421
		trigger = { 
			event_target:guilds_collaborator = {
				NOT = { has_minor_title = title_guilds_apprentice }
			}
		}
	}
	desc = {
		text = EVTDESC_SNW_421_apprentice
		trigger = { 
			event_target:guilds_collaborator = {
				has_minor_title = title_guilds_apprentice
			}
		}
	}
	
	is_triggered_only = yes

	trigger = {
		has_any_quest = no
	}
	
	option = { 
		name = ACCEPT

		set_quest = quest_guilds_caravan

	}

	option = {
		name = DECLINE
		custom_tooltip = { text = decline_quest_tooltip }

		add_character_modifier = {
			name = quest_cooldown_timer
			hidden = yes
			days = 1000
		}

		ai_chance = { factor = 0 }
	}
}

#Send Caravan ping
character_event = {
	id = SNW.422
	is_triggered_only = yes
	hide_window = yes

	trigger = {
		society_member_of = the_guilds
		has_quest = quest_guilds_caravan
	}
	
	immediate = {
		society = {
			random_society_member = {
				limit = {
					NOT = { character = ROOT }
					society_rank = 4
				}
				character_event = {
					id = SNW.423
				}
			}
		}
	}
}

#Send Caravan completion ping
character_event = {
	id = SNW.423
	is_triggered_only = yes
	hide_window = yes

	immediate = {
		FROM = { letter_event = { id = SNW.424 } }
	}
}

#Send Caravan completion
letter_event = {
	id = SNW.424
	desc = EVTDESC_SNW_424
	border = GFX_event_letter_frame_economy_guilds

	is_triggered_only = yes

	option = { #Quest will success
		name = EVTOPTA_SNW_424
		clr_quest = quest_guilds_caravan
		sound_effect = monastic_orders_donate_charity
		add_guilds_mission_succeed_influence_effect = yes
		change_society_currency = 150
	}
}

#Send Caravan on_action ping fail
character_event = {
	id = SNW.425
	is_triggered_only = yes
	hide_window = yes

	
	trigger = {
		society_member_of = the_guilds
		has_quest = quest_guilds_caravan
	}
	
	immediate = {
		society = {
			random_society_member = {
				limit = {
					NOT = { character = ROOT }
					society_rank = 4
				}
				character_event = {
					id = SNW.426
				}
			}
		}
	}
}

#Send Caravan completion ping fail
character_event = {
	id = SNW.426
	is_triggered_only = yes
	hide_window = yes

	immediate = {
		FROM = { letter_event = { id = SNW.427 } }
	}
}

#Send Caravan completion fail
letter_event = {
	id = SNW.427
	desc = EVTDESC_SNW_427
	border = GFX_event_letter_frame_economy_guilds

	is_triggered_only = yes

	option = { #Quest will success
		name = EVTOPTA_SNW_427
		clr_quest = quest_guilds_caravan
		sound_effect = monastic_orders_donate_charity
		add_guilds_mission_fail_influence_effect = yes
		scaled_wealth = { value = 0.5 min = 50 max = 500 }
	}
}

#Liege republic reaction
character_event = {
	id = SNW.430
	desc = EVTDESC_SNW_430
	picture = GFX_evt_busy_trading_dock_republic
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #traitor
		name = EVTOPTA_SNW_430
		custom_tooltip = { text = guilds_call_traitor }
		tooltip = {
			opinion = { modifier = opinion_traitor who = FROM }
		}
		FROM = { letter_event = { id = SNW.431 } }
		ai_chance = {
			factor = 0.2
			modifier = {
				factor = 5
				NOT = { opinion = { who = FROM value = 0 } } 
			}
		}
	}
	option = { #add claims
		name = EVTOPTB_SNW_430
		custom_tooltip = { text = guilds_give_claims }
		FROM = { letter_event = { id = SNW.432 } }
		ai_chance = {
			factor = 0.5
		}
	}
	option = { #bribe
		name = EVTOPTC_SNW_430
		custom_tooltip = { text = guilds_ask_bribe }
		FROM = { letter_event = { id = SNW.433 } }
		ai_chance = {
			factor = 1
			modifier = {
				factor = 5
				trait = greedy
			}
		}
	}
	option = { #ignore
		name = EVTOPTD_SNW_430
		ai_chance = {
			factor = 0.2
			modifier = {
				factor = 5
				opinion = { who = FROM value = 0 } 
			}
			modifier = {
				factor = 2
				opinion = { who = FROM value = 25 } 
			}
		}
	}
}

#Liege republic called traitor
letter_event = {
	id = SNW.431
	desc = EVTDESC_SNW_431
	border = GFX_event_letter_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #traitor
		name = EVTOPTA_SNW_431
		FROM = { opinion = { modifier = opinion_traitor who = ROOT } }
	}
}

#Liege republic gave claims
letter_event = {
	id = SNW.432
	desc = EVTDESC_SNW_432
	border = GFX_event_letter_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #random AIs get claims
		name = EVTOPTA_SNW_432
		# primary_title = { save_event_target_as = republic_primary }
		capital_holding = { save_event_target_as = republic_capital }
		liege = {
			any_vassal = {
				count = 3
				limit = {
					higher_tier_than = count
					NOT = { character = ROOT }
					is_incapable = no
					prisoner = no
					NOT = { has_non_aggression_pact_with = ROOT }
					is_adult = yes
					is_republic = no
					NOT = { society_member_of = the_guilds }
				}
				# add_claim = event_target:republic_primary
				add_claim = event_target:republic_capital
			}
		}
	}
}

#Liege republic asked bribe
letter_event = {
	id = SNW.433
	desc = EVTDESC_SNW_433
	border = GFX_event_letter_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #offer bribe and favor
		name = EVTOPTA_SNW_433
		wealth = -200
		any_vassal = {
			limit = { is_patrician = yes }
			wealth = -200
		}
		FROM = { letter_event = { id = SNW.435 } }
	}
	
	option = { #refuse
		name = EVTOPTB_SNW_433
		custom_tooltip = { text = guilds_refuse_to_bribe }
		FROM = { letter_event = { id = SNW.434 } }
		ai_chance = {
			factor = 0.5
		}
	}
}

#Liege republic bribe refused
letter_event = {
	id = SNW.434
	desc = EVTDESC_SNW_434
	border = GFX_event_letter_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #traitor
		name = EVTOPTA_SNW_434
		custom_tooltip = { text = guilds_call_traitor }
		tooltip = {
			opinion = { modifier = opinion_traitor who = FROM }
		}
	}
	option = { #add claims
		name = EVTOPTB_SNW_434
		custom_tooltip = { text = guilds_give_claims }
	}
}

#Liege republic bribe accepted
letter_event = {
	id = SNW.435
	desc = EVTDESC_SNW_435
	border = GFX_event_letter_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #
		name = EVTOPTA_SNW_435
		wealth = 1000
	}
}

#Offer to buy start
character_event = {
	id = SNW.440
	desc = EVTDESC_SNW_440
	picture = GFX_evt_bribe_accepted
	border = GFX_event_normal_frame_economy_guilds
	
	is_triggered_only = yes

	immediate = {
		FROMFROMFROM = {
			save_event_target_as = guilds_the_goods_target
		}
	}
	
	option = { #above
		name = EVTOPTA_SNW_440
		if = {
			limit = { event_target:guilds_the_goods_target = { quality == 1 } }
			custom_tooltip = { text = guilds_your_offer }
			tooltip = { scaled_wealth = { value = -0.35 min = -35 max = -350 } }
		}
		else_if = {
			limit = { event_target:guilds_the_goods_target = { quality == 2 } }
			custom_tooltip = { text = guilds_your_offer }
			tooltip = { scaled_wealth = { value = -0.60 min = -60 max = -600  } }
		}
		else_if = {
			limit = { event_target:guilds_the_goods_target = { quality == 3 } }
			custom_tooltip = { text = guilds_your_offer }
			tooltip = { scaled_wealth = { value = -0.85 min = -85 max = -850 } }
		}
		else_if = {
			limit = { event_target:guilds_the_goods_target = { quality == 4 } }
			custom_tooltip = { text = guilds_your_offer }
			tooltip = { scaled_wealth = { value = -1.1 min = -110 max = -1100 } }
		}
		else_if = {
			limit = { event_target:guilds_the_goods_target = { quality == 5 } }
			custom_tooltip = { text = guilds_your_offer }
			tooltip = { scaled_wealth = { value = -1.35 min = -135 max = -1350 } }
		}
		set_character_flag = guilds_offer_buy_above
		FROM = { letter_event = { id = SNW.441 } }
		ai_chance = {
			factor = 0.5
		}
	}
	option = { #market
		name = EVTOPTB_SNW_440
		if = {
			limit = { event_target:guilds_the_goods_target = { quality == 1 } }
			custom_tooltip = { text = guilds_your_offer }
			tooltip = { scaled_wealth = { value = -0.15 min = -15 max = -150 } }
		}
		else_if = {
			limit = { event_target:guilds_the_goods_target = { quality == 2 } }
			custom_tooltip = { text = guilds_your_offer }
			tooltip = { scaled_wealth = { value = -0.40 min = -40 max = -400  } }
		}
		else_if = {
			limit = { event_target:guilds_the_goods_target = { quality == 3 } }
			custom_tooltip = { text = guilds_your_offer }
			tooltip = { scaled_wealth = { value = -0.65 min = -65 max = -650 } }
		}
		else_if = {
			limit = { event_target:guilds_the_goods_target = { quality == 4 } }
			custom_tooltip = { text = guilds_your_offer }
			tooltip = { scaled_wealth = { value = -0.90 min = -90 max = -900 } }
		}
		else_if = {
			limit = { event_target:guilds_the_goods_target = { quality == 5 } }
			custom_tooltip = { text = guilds_your_offer }
			tooltip = { scaled_wealth = { value = -1.15 min = -115 max = -1150 } }
		}
		set_character_flag = guilds_offer_buy_market
		FROM = { letter_event = { id = SNW.441 } }
		ai_chance = {
			factor = 1
		}
	}
	option = { #bellow
		name = EVTOPTC_SNW_440
		if = {
			limit = { event_target:guilds_the_goods_target = { quality == 1 } }
			custom_tooltip = { text = guilds_your_offer }
			tooltip = { scaled_wealth = { value = -0.05 min = -5 max = -50 } }
		}
		else_if = {
			limit = { event_target:guilds_the_goods_target = { quality == 2 } }
			custom_tooltip = { text = guilds_your_offer }
			tooltip = { scaled_wealth = { value = -0.25 min = -25 max = -250  } }
		}
		else_if = {
			limit = { event_target:guilds_the_goods_target = { quality == 3 } }
			custom_tooltip = { text = guilds_your_offer }
			tooltip = { scaled_wealth = { value = -0.50 min = -50 max = -500 } }
		}
		else_if = {
			limit = { event_target:guilds_the_goods_target = { quality == 4 } }
			custom_tooltip = { text = guilds_your_offer }
			tooltip = { scaled_wealth = { value = -0.75 min = -75 max = -750 } }
		}
		else_if = {
			limit = { event_target:guilds_the_goods_target = { quality == 5 } }
			custom_tooltip = { text = guilds_your_offer }
			tooltip = { scaled_wealth = { value = -1 min = -100 max = -1000 } }
		}
		set_character_flag = guilds_offer_buy_bellow
		FROM = { letter_event = { id = SNW.441 } }
		ai_chance = {
			factor = 0.5
		}
	}
	option = { #nevermind
		name = EVTOPTD_SNW_440
		hidden_tooltip = {
			clr_character_flag = guilds_is_using_goods
			FROM = { clr_character_flag = guilds_is_using_goods }
			clear_event_target = guilds_the_goods_target
		}
		ai_chance = {
			factor = 0
		}
	}
}

#Offer to buy seller
letter_event = {
	id = SNW.441
	desc = EVTDESC_SNW_441
	border = GFX_event_letter_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #buy
		name = EVTOPTA_SNW_441
		if = {
			limit = {
				FROM = { has_character_flag = guilds_offer_buy_above }
			}
			if = {
				limit = { event_target:guilds_the_goods_target = { quality == 1 } }
				scaled_wealth = { value = 0.35 min = 35 max = 350 }
			}
			else_if = {
				limit = { event_target:guilds_the_goods_target = { quality == 2 } }
				scaled_wealth = { value = 0.60 min = 60 max = 600 }
			}
			else_if = {
				limit = { event_target:guilds_the_goods_target = { quality == 3 } }
				scaled_wealth = { value = 0.85 min = 85 max = 850 }
			}
			else_if = {
				limit = { event_target:guilds_the_goods_target = { quality == 4 } }
				scaled_wealth = { value = 1.1 min = 110 max = 1100 }
			}
			else_if = {
				limit = { event_target:guilds_the_goods_target = { quality == 5 } }
				scaled_wealth = { value = 1.35 min = 135 max = 1350 }
			}
		}
		else_if = {
			limit = {
				FROM = { has_character_flag = guilds_offer_buy_market }
			}
			if = {
				limit = { event_target:guilds_the_goods_target = { quality == 1 } }
				scaled_wealth = { value = 0.15 min = 15 max = 150 }
			}
			else_if = {
				limit = { event_target:guilds_the_goods_target = { quality == 2 } }
				scaled_wealth = { value = 0.40 min = 40 max = 400  }
			}
			else_if = {
				limit = { event_target:guilds_the_goods_target = { quality == 3 } }
				scaled_wealth = { value = 0.65 min = 65 max = 650 }
			}
			else_if = {
				limit = { event_target:guilds_the_goods_target = { quality == 4 } }
				scaled_wealth = { value = 0.90 min = 90 max = 900 }
			}
			else_if = {
				limit = { event_target:guilds_the_goods_target = { quality == 5 } }
				scaled_wealth = { value = 1.15 min = 115 max = 1150 }
			}
		}
		else_if = {
			limit = {
				FROM = { has_character_flag = guilds_offer_buy_bellow }
			}
			if = {
				limit = { event_target:guilds_the_goods_target = { quality == 1 } }
				scaled_wealth = { value = 0.05 min = 5 max = 50 }
			}
			else_if = {
				limit = { event_target:guilds_the_goods_target = { quality == 2 } }
				scaled_wealth = { value = 0.25 min = 25 max = 250 } 
			}
			else_if = {
				limit = { event_target:guilds_the_goods_target = { quality == 3 } }
				scaled_wealth = { value = 0.50 min = 50 max = 500 }
			}
			else_if = {
				limit = { event_target:guilds_the_goods_target = { quality == 4 } }
				scaled_wealth = { value = 0.75 min = 75 max = 750 }
			}
			else_if = {
				limit = { event_target:guilds_the_goods_target = { quality == 5 } }
				scaled_wealth = { value = 1 min = 100 max = 1000 }
			}
		}
		tooltip = {
			event_target:guilds_the_goods_target = { transfer_artifact = { from = ROOT to = FROM } }
		}
		FROM = { letter_event = { id = SNW.442 } }
		ai_chance = {
			factor = 20
			modifier = {
				factor = 4
				FROM = { has_character_flag = guilds_offer_buy_above }
			}
			modifier = {
				factor = 0.25
				FROM = { has_character_flag = guilds_offer_buy_bellow }
			}
			modifier = { #not sure maybe
				factor = 0.80
				FROM = { has_character_flag = guilds_offer_buy_market }
			}
			modifier = {
				factor = 2
				# FROM = { has_character_flag = guilds_offer_buy_above }
				OR = {
					AND = {
						FROM = { 
							OR = {
								trait = guilds_trait_trader
								trait = guilds_trait_master
								trait = guilds_trait_apprentice
							}
						}
						ROOT = { 
							NOR = {
								trait = guilds_trait_trader
								trait = guilds_trait_master
								trait = guilds_trait_apprentice
							}
						}
					}
					AND = {
						FROM = { 
							OR = {
								trait = guilds_trait_trader
								trait = guilds_trait_master
							}
						}
						ROOT = { trait = guilds_trait_apprentice }
					}
					AND = {
						FROM = { trait = guilds_trait_master }
						ROOT = { trait = guilds_trait_trader }
					}
				}
			}
			modifier = {
				factor = 2
				# FROM = { NOT = { has_character_flag = guilds_offer_buy_above } }
				OR = {
					ROOT = { 
						NOT = { society_member_of = the_guilds }
					}
					AND = {
						FROM = { 
							society_member_of = the_guilds
							society_rank >= 2
						}
						ROOT = {
							society_member_of = the_guilds
							society_rank == 1
						}
					}
					AND = {
						FROM = { 
							society_member_of = the_guilds
							society_rank >= 3
						}
						ROOT = {
							society_member_of = the_guilds
							society_rank <= 2
						}
					}
					AND = {
						FROM = { 
							society_member_of = the_guilds
							society_rank == 4
						}
						ROOT = {
							society_member_of = the_guilds
							society_rank <= 3
						}
					}
				}
			}
			modifier = {
				factor = 1.5
				# FROM = { NOT = { has_character_flag = guilds_offer_buy_above } }
				opinion = { who = FROM value = 25 } 
			}
			modifier = {
				factor = 1.5
				# FROM = { NOT = { has_character_flag = guilds_offer_buy_above } }
				opinion = { who = FROM value = 50 } 
			}
			modifier = {
				factor = 1.5
				# FROM = { NOT = { has_character_flag = guilds_offer_buy_above } }
				opinion = { who = FROM value = 75 } 
			}
		}
	}
	option = { #dont
		name = EVTOPTB_SNW_441
		FROM = { letter_event = { id = SNW.443 } }
		ai_chance = {
			factor = 20
			modifier = {
				factor = 2
				NOT = { opinion = { who = FROM value = 0 } }
			}
			modifier = {
				factor = 0.25
				NOT = { wealth = 0 }
			}
			modifier = {
				factor = 0.5
				is_adult = no
			}
			modifier = {
				factor = 0.5
				is_dumb_trigger = yes
			}
		}
	}
}

#Offer to buy bought
letter_event = {
	id = SNW.442
	desc = EVTDESC_SNW_442
	border = GFX_event_letter_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #receive good
		name = EVTOPTA_SNW_442
		# change_society_currency = -50
		influence_cost_buying_effect = yes
		if = {
			limit = {
				has_character_flag = guilds_offer_buy_above
			}
			if = {
				limit = { event_target:guilds_the_goods_target = { quality == 1 } }
				scaled_wealth = { value = -0.35 min = -35 max = -350 }
			}
			else_if = {
				limit = { event_target:guilds_the_goods_target = { quality == 2 } }
				scaled_wealth = { value = -0.60 min = -60 max = -600 }
			}
			else_if = {
				limit = { event_target:guilds_the_goods_target = { quality == 3 } }
				scaled_wealth = { value = -0.85 min = -85 max = -850 }
			}
			else_if = {
				limit = { event_target:guilds_the_goods_target = { quality == 4 } }
				scaled_wealth = { value = -1.1 min = -110 max = -1100 }
			}
			else_if = {
				limit = { event_target:guilds_the_goods_target = { quality == 5 } }
				scaled_wealth = { value = -1.35 min = -135 max = -1350 }
			}
		}
		else_if = {
			limit = {
				has_character_flag = guilds_offer_buy_market
			}
			if = {
				limit = { event_target:guilds_the_goods_target = { quality == 1 } }
				scaled_wealth = { value = -0.15 min = -15 max = -150 }
			}
			else_if = {
				limit = { event_target:guilds_the_goods_target = { quality == 2 } }
				scaled_wealth = { value = -0.40 min = -40 max = -400  }
			}
			else_if = {
				limit = { event_target:guilds_the_goods_target = { quality == 3 } }
				scaled_wealth = { value = -0.65 min = -65 max = -650 }
			}
			else_if = {
				limit = { event_target:guilds_the_goods_target = { quality == 4 } }
				scaled_wealth = { value = -0.90 min = -90 max = -900 }
			}
			else_if = {
				limit = { event_target:guilds_the_goods_target = { quality == 5 } }
				scaled_wealth = { value = -1.15 min = -115 max = -1150 }
			}
		}
		else_if = {
			limit = {
				has_character_flag = guilds_offer_buy_bellow
			}
			if = {
				limit = { event_target:guilds_the_goods_target = { quality == 1 } }
				scaled_wealth = { value = -0.05 min = -5 max = -50 }
			}
			else_if = {
				limit = { event_target:guilds_the_goods_target = { quality == 2 } }
				scaled_wealth = { value = -0.25 min = -25 max = -250 }
			}
			else_if = {
				limit = { event_target:guilds_the_goods_target = { quality == 3 } }
				scaled_wealth = { value = -0.50 min = -50 max = -500 }
			}
			else_if = {
				limit = { event_target:guilds_the_goods_target = { quality == 4 } }
				scaled_wealth = { value = -0.75 min = -75 max = -750 }
			}
			else_if = {
				limit = { event_target:guilds_the_goods_target = { quality == 5 } }
				scaled_wealth = { value = -1 min = -100 max = -1000 }
			}
		}
		event_target:guilds_the_goods_target = { transfer_artifact = { from = FROM to = ROOT } }
		if = {
			limit = {
				NOT = { society_member_of = the_guilds }
				any_owned_bloodline = {
					has_bloodline_flag = the_guilds
				}
			}
			custom_tooltip = { 
				text = guilds_buy_timer_golden_TT   
				add_character_modifier = {
					name = guilds_buy_timer_golden
					duration = 180
					hidden = yes
				}
			}
		}
	}
	after = {
		hidden_tooltip = {
			ROOT = { change_variable = { which = guildsxp value = 1 } }
			FROM = { change_variable = { which = guildsxp value = 1 } }
			clr_character_flag = guilds_offer_buy_above
			clr_character_flag = guilds_offer_buy_market
			clr_character_flag = guilds_offer_buy_bellow
			clr_character_flag = guilds_is_using_goods
			FROM = { clr_character_flag = guilds_is_using_goods }
			clear_event_target = guilds_the_goods_target
			FROM = {
				add_character_modifier = {
					name = guilds_buy_timer
					duration = 90
					hidden = yes
				}
			}
		}
	}
}

#Offer to buy refused
letter_event = {
	id = SNW.443
	desc = EVTDESC_SNW_443
	border = GFX_event_letter_frame_economy_guilds
	
	is_triggered_only = yes

	option = { #receive nothing
		name = EVTOPTA_SNW_443
	}
	after = {
		hidden_tooltip = {
			clr_character_flag = guilds_offer_buy_above
			clr_character_flag = guilds_offer_buy_market
			clr_character_flag = guilds_offer_buy_bellow
			clr_character_flag = guilds_is_using_goods
			FROM = { clr_character_flag = guilds_is_using_goods }
			clear_event_target = guilds_the_goods_target
			if = {
				FROM = {
					add_character_modifier = {
						name = guilds_buy_timer
						duration = 90
						hidden = yes
					}
				}
			}
		}
	}
}

#Remove traitor
character_event = {
    id = SNW.450
    desc = EVTDESC_SNW_450
	picture = GFX_evt_bribe_accepted
	border = GFX_event_normal_frame_economy_guilds
	
    is_triggered_only = yes
	
	option = { 
		name = EVTOPTA_SNW_450
		clr_character_flag = guilds_traitor
		custom_tooltip = { text = guilds_unantagonize_trade_league }
		any_society_member = {
			limit = {
				society_rank = 4
				society_member_of = the_guilds
				NOT = { character = ROOT }
				NOT = { their_opinion = { who = ROOT value = 25 } }
			}
			ROOT = { transfer_scaled_wealth = { to = PREV value = 0.33 min = 100 } }
		}
	}
	option = {
		name = EVTOPTB_SNW_450
	}
}

#Debug +500 society currency (rip990)

#Debug society rank up (rip991)

#Debug society rank down (rip992)

#Debug quest modifiers counter
character_event = {
	id = SNW.6666
	
	hide_window = yes

	trigger = {
		society_member_of = the_guilds
	}
	
	is_triggered_only = yes

	option = {
		name = EXCELLENT
		# remove_society_modifier = successful_mission
		add_society_modifier = 	{
			modifier = failed_guilds_mission_counter
			years = 10
		}
	}
}


#Debug random holo event
character_event = {
    id = SNW.993
	is_triggered_only = yes
	hide_window = yes

    immediate = {
		any_courtier = {
			limit = { has_character_flag = guilds_is_holo }
			hidden_tooltip = { character_event = { id = SNW.291 } }
		}
    }
}

#Debug check market crash
character_event = {
    id = SNW.994
	picture = GFX_evt_council
	border = GFX_event_normal_frame_economy_guilds

	desc = {
		trigger = { society_member_of = the_guilds }
		text = EVTDESC_SNW_383_MEMBER
	}
	desc = {
		trigger = { NOT = { society_member_of = the_guilds } }
		text = EVTDESC_SNW_383_OUTSIDER
	}
	
    is_triggered_only = yes

	option = { #nothing
		name = EVTOPTD_SNW_383
	}
}

#Debug start market crash
character_event = {
    id = SNW.995
	is_triggered_only = yes
	hide_window = yes
	
    is_triggered_only = yes

	immediate = { #nothing
		any_player = {
			narrative_event = { id = SNW.382 }
			add_character_modifier = {
				modifier = guilds_market_crash_tracker
				months = 120
				inherit = yes
			}
		}
		clr_global_flag = guilds_market_crash_check
		set_global_flag = guilds_market_crash_start
	}
}

#Debug test opinion distance liege
# character_event = {
    # id = SNW.996
	# is_triggered_only = yes
	# hide_window = yes
	
    # is_triggered_only = yes

	# only_playable = yes
	
	# trigger = {
		# higher_tier_than = count
	# }
	
	# immediate = {
		# capital_scope = { save_event_target_as = liege_capital }
		# any_vassal = {
			# limit = {
				# higher_tier_than = baron
			# }
			# remove_opinion = { modifier = opinion_distance_one who = ROOT }
			# remove_opinion = { modifier = opinion_distance_two who = ROOT }
			# remove_opinion = { modifier = opinion_distance_three who = ROOT }
			# remove_opinion = { modifier = opinion_distance_four who = ROOT }
			# remove_opinion = { modifier = opinion_distance_five who = ROOT }
			# remove_opinion = { modifier = opinion_distance_six who = ROOT }
			# if = {
				# limit = {
					# capital_scope = {
						# distance = { who = event_target:liege_capital value = 1250 }
					# }
				# }
				# opinion = { modifier = opinion_distance_six who = ROOT years = 2 } 
			# }
			# else_if = {
				# limit = {
					# capital_scope = {
						# distance = { who = event_target:liege_capital value = 1000 }
					# }
				# }
				# opinion = { modifier = opinion_distance_five who = ROOT years = 2 } 
			# }
			# else_if = {
				# limit = {
					# capital_scope = {
						# distance = { who = event_target:liege_capital value = 750 }
					# }
				# }
				# opinion = { modifier = opinion_distance_four who = ROOT years = 2 } 
			# }
			# else_if = {
				# limit = {
					# capital_scope = {
						# distance = { who = event_target:liege_capital value = 500 }
					# }
				# }
				# opinion = { modifier = opinion_distance_three who = ROOT years = 2 } 
			# }
			# else_if = {
				# limit = {
					# capital_scope = {
						# distance = { who = event_target:liege_capital value = 250 }
					# }
				# }
				# opinion = { modifier = opinion_distance_two who = ROOT years = 2 } 
			# }
			# else_if = {
				# limit = {
					# capital_scope = {
						# distance = { who = event_target:liege_capital value = 100 }
					# }
				# }
				# opinion = { modifier = opinion_distance_one who = ROOT years = 2 } 
			# }
		# }
	# }
# }