namespace = xgi-goldshare

character_event = {
	id = xgi-goldshare.001
	desc = xgi-goldsharefam
	picture = "xgi-familyculti-event"

	is_triggered_only = yes


	trigger={
		NOT = { has_character_flag = xgi-hide-this-fm }
		wealth = 170

	}
	
	
	option = {
		name = "Sweet"

		any_courtier = {
			limit = {
				NOT = { 
					has_character_flag = xgi-NotFunding 
					has_character_modifier = xgi-Immornk1
					has_character_modifier = xgi-Immornk2
					has_character_modifier = xgi-Immornk3
					has_character_modifier = xgi-Immornk4
					has_character_modifier = xgi-Immornk5
				}
				prisoner = no
				ai = yes
				OR = {
					is_child_of = liege
					is_married = liege
					any_spouse = { character = liege }
					is_lover = liege
					is_close_relative = liege 
					dynasty = liege
					is_friend = ROOT
				ROOT = {
					has_character_modifier = xgi-clanmember-modifier
				}
				}
			}

		ROOT = { wealth = -25 }
		ROOT = { prestige = 2 }
		wealth = 25

		}


	}

	option = {
		name = "Sweet"

		trigger={
			ai = yes
		}

		any_courtier = {
			limit = {
				NOT = { 
					has_character_flag = xgi-NotFunding 
					has_character_modifier = xgi-Immornk1
					has_character_modifier = xgi-Immornk2
					has_character_modifier = xgi-Immornk3
					has_character_modifier = xgi-Immornk4
					has_character_modifier = xgi-Immornk5
				}
				prisoner = no
				ai = yes
				OR = {
					is_child_of = liege
					is_married = liege
					any_spouse = { character = liege }
					is_lover = liege
					is_close_relative = liege 
					dynasty = liege
					is_friend = ROOT
				ROOT = {
					has_character_modifier = xgi-clanmember-modifier
				}
				}
			}

		ROOT = { wealth = -25 }
		ROOT = { prestige = 2 }
		wealth = 25

		}


	}

	option = {
		name = "Don't show this again. (Beneficiaries keeps receiving gold)."
		trigger={
			ai = no
		}
		any_courtier = {
			limit = {
				NOT = { 
					has_character_flag = xgi-NotFunding 
					has_character_modifier = xgi-Immornk1
					has_character_modifier = xgi-Immornk2
					has_character_modifier = xgi-Immornk3
					has_character_modifier = xgi-Immornk4
					has_character_modifier = xgi-Immornk5
				}
				prisoner = no
				OR = {
					is_child_of = liege
					is_married = liege
					any_spouse = { character = liege }
					is_lover = liege
					is_close_relative = liege 
					dynasty = ROOT
				ROOT = {
					has_character_modifier = xgi-clanmember-modifier
				}
				}
			}
		wealth = 25
		}
		ROOT = { set_character_flag = xgi-hide-this-fm }
		ROOT = { wealth = -25 }
		ROOT = { prestige = 2 }


	}

	option = {
		name = "Sorry, but next time"
		trigger={
			OR = {
				ai = no
			}
		}
		prestige = -5

	}

}

character_event = {
	id = xgi-goldshare.002
	is_triggered_only = yes
	hide_window = yes


	trigger={
		ai = no
		has_character_flag = xgi-hide-this-fm
		is_ruler = yes
		wealth = 1500

	}
	
	
	immediate = {

		any_courtier = {
			limit = {
				NOT = { 
					has_character_flag = xgi-NotFunding 
					has_character_modifier = xgi-Immornk1
					has_character_modifier = xgi-Immornk2
					has_character_modifier = xgi-Immornk3
					has_character_modifier = xgi-Immornk4
					has_character_modifier = xgi-Immornk5
				}
				prisoner = no
				OR = {
					is_child_of = liege
					is_married = liege
					any_spouse = { character = liege }
					is_lover = liege
					is_close_relative = liege 
					dynasty = liege
					is_friend = FROM
				ROOT = {
					has_character_modifier = xgi-clanmember-modifier
					dynasty = FROM
				}
				}
			}

		FROM = { wealth = -25 }
		FROM = { prestige = 20 }
		wealth = 25

		}


	}

}

character_event = {
	id = xgi-goldshare.003
	desc = xgi-Lord-demands-text
	picture = "xgi-liege-event"
	
	is_triggered_only = yes

	trigger={
		independent = no
		prisoner = no
		NOT = { is_rival = liege }
		wealth = 20
		is_ruler = yes
	}
	
	option = {
		name = "Sweet"
		trigger = {
			opinion = { who = liege value = 2 }
			is_ruler = yes
		}
		liege = { wealth = 20 }
		liege = {
				opinion = {
					modifier = xgi-love
					who = ROOT
					months = 7
				}
		}
	 	wealth = -20
		prestige = 5
	}

	option = {
		name = "Sweet"
		trigger = {
			ai = yes
			opinion = { who = liege value = 2 }
			is_ruler = yes
		}
		liege = { wealth = 20 }
		liege = {
				opinion = {
					modifier = xgi-love
					who = ROOT
					months = 7
				}
		}
	 	wealth = -20
		prestige = 5
	}

	option = {
		name = "F*ck you! (Offend the liege)"
		trigger = {
			NOT = { opinion = { who = liege value = 2 } }
			is_ruler = yes
		}
		liege = { add_rival = ROOT }
		liege = { character_event = { id = xgi-goldshare.004 } }
		liege = {
				opinion = {
					modifier = opinion_disrespects_me
					who = ROOT
					years = 9999
				}

				opinion = {
					modifier = immortal_hate
					who = ROOT
					years = 9999
				}

				opinion = {
					modifier = opinion_hate
					who = ROOT
					years = 9999
				}

				opinion = {
					modifier = opinion_nemesis
					who = ROOT
					years = 9999
				}
		}
	}

	option = {
		name = "I have no choice"
		trigger = {
			ai = no
			is_ruler = yes
		}
		liege = { 
			wealth = 20
				opinion = {
					modifier = opinion_disrespects_me
					who = ROOT
					months = 7
				}
				opinion = {
					modifier = xgi-hate
					who = ROOT
					months = 7
				}
		}
		liege = { ROOT = { wealth = -20 } }
	}

	option = {
		name = "I am penniless"
		trigger = {
			ai = no
			is_ruler = yes
		}
		prestige = -50
		liege = { 
				opinion = {
					modifier = opinion_hate
					who = ROOT
					months = 1
				}
				opinion = {
					modifier = opinion_disrespects_me
					who = ROOT
					months = 9
				}
		}
	}
}

character_event = { # refusing to pay yearly gold to liege

	id = xgi-goldshare.004
	ai = no
	desc  = xgi-refusing-to-pay
	picture = "xgi-arrog-dis-event"

	is_triggered_only = yes

	
	option = {
		name = "Damnit!"
		add_rival = FROM
	}
}

character_event = {
	id = xgi-goldshare.005
	desc = "Congratulations! You have purchased a pill with the efficacy to increase your spiritul energy and prestige in the world."
	picture = "xgi-pavillion-event"
	is_triggered_only = yes

	mean_time_to_happen = {
		days = 6
	}

	option = {
	        name = "Consume..."
		clr_character_flag = xgi-spiritualenergypill
		FROM = { 
			random_list = {
		 		6 = { piety = 1000 prestige = 100 }
		 		5 = { piety = 2000 prestige = 200 }
		 		4 = { piety = 3000 prestige = 300 }
		 		3 = { piety = 4000 prestige = 400 }
		 		2 = { piety = 5000 prestige = 500 }
		 		1 = { piety = 6000 prestige = 600 }
			}
		}
		add_character_modifier = {
			name = xgi-pillconsumed-modifier
			duration = 46
			hidden = no
		}
			
	}
}

character_event = {
	id = xgi-goldshare.006
	desc = "Congratulations! You have purchased the Heaven Avoiding pill. With this pill, you can temporarily hide from the very heavens when entering the higher stage of cultivation."
	picture = "xgi-pavillion-event"
	is_triggered_only = yes

	mean_time_to_happen = {
		days = 6
	}

	option = {
	        name = "Sweet..."
			
	}
}

character_event = {
	id = xgi-goldshare.007
	desc = "Congratulations! You have purchased a Nascent Soul pill to gift to this person."
	picture = "xgi-pavillion-event"
	is_triggered_only = yes

	mean_time_to_happen = {
		days = 3
	}

	option = {
	        name = "Sweet..."
			
	}
}

character_event = {
	id = xgi-goldshare.008
	desc = "Vassals are preparing the yearly gold coins for their liege."
	picture = "xgi-gold-event"
	is_triggered_only = yes

	trigger={
		ai = no
		is_ruler = yes

	}

	option = {
	        name = "Sweet..."
			any_character = {
				limit = {
					is_ruler = yes
				}
				character_event = { id = xgi-goldshare.003  days = 5 }
				character_event = { id = xgi-goldshare.001  days = 6 }
				character_event = { id = xgi-goldshare.002  days = 6 }
			}
			
	}
}