
#GREETINGS MY LOVER
GreetingToLover = {
	type = character

	text = {
		trigger = {
			scope:second = {
				object_of_importance_exist_trigger = {
					LOVER = root
				}
			}
		}
		localization_key = greeting_lover_object
	}

	text = {
		localization_key = greeting_lover_fallback
	}
}

#GREETINGS MY LIEGE
GreetingToLiege = {
	type = character

	text = {
		trigger = {
			opinion = {
				target = scope:second
				value >= 20
			}
		}
		localization_key = greeting_liege_positive
	}

	text = {
		trigger = {
			opinion = {
				target = scope:second
				value <= -40
			}
		}
		localization_key = greeting_liege_negative
	}

	text = {
		trigger = {
			scope:second = { tgp_is_ceremonial_regent_trigger = yes }
		}
		localization_key = greeting_ceremonial_liege_fallback
	}

	text = {
		localization_key = greeting_liege_fallback
	}
}

GreetingToLiegePositive = {
	type = character

	text = {
		trigger = {
			scope:second = { tgp_is_ceremonial_regent_trigger = yes }
		}
		localization_key = greeting_ceremonial_regent_liked
	}

	text = {
		localization_key = greeting_liege_liked
	}
}

GreetingToLiegeNegative = {
	type = character

	text = {
		trigger = {
			scope:second = { tgp_is_ceremonial_regent_trigger = yes }
		}
		localization_key = greeting_ceremonial_regent_dislike
	}

	text = {
		localization_key = greeting_liege_dislike
	}
}

GreetingToLiegeNeutral = {
	type = character

	text = {
		trigger = {
			scope:second = { tgp_is_ceremonial_regent_trigger = yes }
		}
		localization_key = greeting_liege_neutral_regent
	}

	text = {
		localization_key = greeting_liege_neutral
	}
}


#GREETINGS MY VASSAL
GreetingToVassal = {
	type = character

	text = {
		trigger = {
			OR = {
				AND = {
					is_close_or_extended_family_of = scope:second
					opinion = {
						target = scope:second
						value >= 10
					}	
				}
				opinion = {
					target = scope:second
					value >= 30
				}	
			}

		}
		localization_key = greeting_vassal_positive
	}

	text = {
		trigger = {
			opinion = {
				target = scope:second
				value <= -40
			}
		}
		localization_key = greeting_vassal_negative
	}

	text = {
		localization_key = greeting_vassal_fallback
	}
}

GreetingToVassalPositive = {
	type = character

	text = {
		trigger = {
			tgp_is_ceremonial_regent_trigger = yes
			scope:second = { tgp_is_ceremonial_liege_trigger = no }
		}
		localization_key = greeting_vassal_liked_regent
	}

	text = {
		trigger = {
			tgp_is_ceremonial_regent_trigger = yes
			scope:second = { tgp_is_ceremonial_liege_trigger = yes }
		}
		localization_key = greeting_vassal_liked_ceremonial_liege
	}

	text = {
		trigger = {
			is_close_or_extended_family_of = scope:second
		}
		localization_key = greeting_vassal_relative_liked
	}

	text = {
		localization_key = greeting_vassal_liked
	}
}

GreetingToVassalNegative = {
	type = character

	text = {
		trigger = {
			tgp_is_ceremonial_regent_trigger = yes
			scope:second = { tgp_is_ceremonial_liege_trigger = no }
		}
		localization_key = greeting_vassal_dislike_regent
	}

	text = {
		trigger = {
			tgp_is_ceremonial_regent_trigger = yes
			scope:second = { tgp_is_ceremonial_liege_trigger = yes }
		}
		localization_key = greeting_vassal_dislike_ceremonial_liege
	}

	text = {
		localization_key = greeting_vassal_dislike
	}
}

GreetingToVassalNeutral = {
	type = character

	text = {
		trigger = {
			tgp_is_ceremonial_regent_trigger = yes
			scope:second = { tgp_is_ceremonial_liege_trigger = no }
		}
		localization_key = greeting_vassal_neutral_regent
	}

	text = {
		trigger = {
			tgp_is_ceremonial_regent_trigger = yes
			scope:second = { tgp_is_ceremonial_liege_trigger = yes }
		}
		localization_key = greeting_vassal_neutral_ceremonial_liege
	}

	text = {
		localization_key = greeting_vassal_neutral
	}
}



#GREETINGS MY CLOSE_RELATIVE
GreetingToFamily = {
	type = character

	text = {
		trigger = {
			opinion = {
				target = scope:second
				value >= 40
			}
		}
		localization_key = greeting_family_positive
	}

	text = {
		trigger = {
			opinion = {
				target = scope:second
				value <= -20
			}
		}
		localization_key = greeting_family_negative
	}

	text = {
		localization_key = greeting_family_fallback
	}
}

GreetingToFamilyPositive = {
	type = character

	text = {
		localization_key = greeting_family_liked
	}
}

GreetingToFamilyNegative = {
	type = character

	text = {
		localization_key = greeting_family_fallback
	}
}


#GREETINGS FOREIGN RULER
GreetingToForeignRuler = {
	type = character

	text = {
		trigger = {
			opinion = {
				target = scope:second
				value >= 40
			}
		}
		localization_key = greeting_foreign_ruler_positive
	}

	text = {
		trigger = {
			opinion = {
				target = scope:second
				value <= -20
			}
		}
		localization_key = greeting_foreign_ruler_negative
	}

	text = {
		localization_key = greeting_foreign_ruler
	}
}

GreetingToForeignRulerPositive = {
	type = character

	text = {
		localization_key = greeting_foreign_ruler_positive
	}
}

GreetingToForeignRulerNegative = {
	type = character

	text = {
		localization_key = greeting_foreign_ruler_negative
	}
}


#GENERIC GREETING
GreetingToGeneric = {
	type = character

	text = {
		trigger = {
			opinion = {
				target = scope:second
				value >= 40
			}
		}
		localization_key = greeting_generic_positive
	}

	text = {
		trigger = {
			opinion = {
				target = scope:second
				value <= -40
			}
		}
		localization_key = greeting_generic_negative
	}

	text = {
		localization_key = greeting_generic
	}
}

GreetingToGenericPositive = {
	type = character

	text = {
		localization_key = greeting_generic_positive
	}	
}

GreetingToGenericNegative = {
	type = character
	
	text = {
		localization_key = greeting_generic_negative
	}
}


#APPROPRIATE GREETING
# ROOT is the character doing the greeting, scope:second is the character being greeted.
AppropriateGreeting = {
	type = character

	text = {
		trigger = { has_relation_lover = scope:second }
		localization_key = greeting_appropriate_lover
	}

	text = {
		trigger = { is_vassal_of = scope:second }
		localization_key = greeting_appropriate_liege
	}

	text = {
		trigger = {
			scope:second = { is_vassal_of = root }
		}
		localization_key = greeting_appropriate_vassal
	}

	text = {
		trigger = {
			OR = {
				is_close_or_extended_family_of = scope:second
				has_relation_friend = scope:second
			}
		}
		localization_key = greeting_appropriate_family
	}

	text = {
		trigger = {
			scope:second = { top_liege = this }
			top_liege != scope:second.top_liege
		}
		localization_key = greeting_appropriate_foreign_ruler
	}

	text = {
		localization_key = greeting_appropriate_fallback
	}
}

AppropriateGreetingPositive = {
	type = character

	text = {
		trigger = { has_relation_lover = scope:second }
		localization_key = greeting_appropriate_lover
	}

	text = {
		trigger = { is_vassal_of = scope:second }
		localization_key = greeting_appropriate_positive_liege
	}

	text = {
		trigger = {
			scope:second = { is_vassal_of = root }
		}
		localization_key = greeting_appropriate_positive_vassal
	}

	text = {
		trigger = {
			is_close_or_extended_family_of = scope:second
		}
		localization_key = greeting_appropriate_positive_family
	}

	text = {
		trigger = {
			scope:second = { top_liege = this }
			top_liege != scope:second.top_liege
		}
		localization_key = greeting_appropriate_positive_foreign_ruler
	}

	text = {
		localization_key = greeting_appropriate_positive_fallback
	}
}

AppropriateGreetingNegative = {
	type = character


	text = {
		trigger = { is_vassal_of = scope:second }
		localization_key = greeting_appropriate_negative_liege
	}

	text = {
		trigger = {
			scope:second = { is_vassal_of = root }
		}
		localization_key = greeting_appropriate_negative_vassal
	}

	text = {
		trigger = {
			is_close_or_extended_family_of = scope:second
		}
		localization_key = greeting_appropriate_negative_family
	}

	text = {
		trigger = {
			scope:second = { top_liege = this }
			top_liege != scope:second.top_liege
		}
		localization_key = greeting_appropriate_negative_foreign_ruler
	}

	text = {
		localization_key = greeting_appropriate_negative_fallback
	}
}


# Can be called after an appropriate greeting to add character and flavor to the address.
AppropriateSupplimentaryGreeting = {
	type = character

	text = {
		trigger = {
			NOT = {
				target_is_liege_or_above = scope:second
			}
			opinion = {
				target = scope:second
				value <= -10
			}
		}
		localization_key = greeting_supplimentary.negative
	}

	text = {
		trigger = {
			OR = {
				target_is_liege_or_above = scope:second
				opinion = {
					target = scope:second
					value > -10
				}
			}
		}
		localization_key = greeting_supplimentary.positive
	}
}

NegativeSupplimentaryGreeting = {
	type = character
	random_valid = yes

	
	text = { # Your misdeeds are told from Ireland to Cathay
		trigger = {
			# Must be in Western or Northern Europe
			location = {
				OR = {
					geographical_region = world_europe_west
					geographical_region = world_europe_north
				}
			}
		}
		localization_key =  greeting_supplimentary.negative.tales
	}

	text = { # Your low character is the subject of Greek plays.
		trigger = {
			# Must be in Western or Northern Europe
			location = {
				OR = {
					geographical_region = world_europe_east
					geographical_region = world_europe_south
					geographical_region = world_asia_minor
					geographical_region = world_middle_east_jerusalem
					geographical_region = world_africa_north
				}
			}
		}
		localization_key =  greeting_supplimentary.negative.greek
	}	

	text = { # May your humors rot in your living body.
		localization_key =  greeting_supplimentary.negative.insult.1
	}	

	text = { # May your years be short and miserable.
		localization_key =  greeting_supplimentary.negative.insult.2
	}	

	text = { # May wisdom ever elude you.
		trigger = {
			scope:second = {
				learning < high_skill_rating
			}
		}
		localization_key = greeting_supplimentary.negative.insult.3
	}	

	text = { # Damn your seventh grandfather.
		trigger = {
			faith = {
				religion_tag = islam_religion
			}
		}
		localization_key =  greeting_supplimentary.negative.insult_muslim.1
	}	

	text = { # May you be sewn up alive in the belly of a dead camel.
		trigger = {
			faith = {
				religion_tag = islam_religion
			}
		}
		localization_key =  greeting_supplimentary.negative.insult_muslim.2
	}	

	text = { # May Allah destroy your house.
		trigger = {
			faith = {
				religion_tag = islam_religion
			}
		}
		localization_key =  greeting_supplimentary.negative.insult_muslim.3
	}	

	text = { # You child of a mangy dog.
		trigger = {
			faith = {
				religion_tag = islam_religion
			}
		}
		localization_key =  greeting_supplimentary.negative.insult_muslim.4
	}	
}

PositiveSupplimentaryGreeting = {
	type = character

	random_valid = yes

	text = { # Blessings upon you and your House.
		localization_key =  greeting_supplimentary.positive.flattery.1
	}	

	text = { # Your wisdom and mercy are legendary.
		trigger = {
			scope:second = {
				NOR = {
					has_trait = sadistic
					has_trait = callous
				}
			}
		}
		localization_key =  greeting_supplimentary.positive.flattery.2
	}	

	text = { # Peace be with you.
		trigger = {
			scope:second = {
				NOR = {
					has_trait = vengeful
					has_trait = wrathful
					faith = {
						has_doctrine = tenet_warmonger
						has_doctrine = tenet_human_sacrifice
					}
				}
			}
		}
		localization_key =  greeting_supplimentary.positive.flattery.3
	}	

	text = { # May you live in harmony and contentment.
		trigger = {
			scope:second = {
				NOR = {
					has_trait = ambitious
					has_trait = arrogant
					has_trait = sadistic
				}
			}
		}
		localization_key =  greeting_supplimentary.positive.flattery.4
	}

	text = { # Your ruthlessness is enviable.
		trigger = {
			scope:second = {
				OR = {
					has_trait = sadistic
					has_trait = callous
				}
			}
		}
		localization_key =  greeting_supplimentary.positive.flattery.5
	}

	text = { # Your great appetites are renowned throughout the world.
		trigger = {
			scope:second = {
				OR = {
					has_trait = gluttonous
					has_trait = greedy
					has_trait = ambitious
				}
			}
		}
		localization_key =  greeting_supplimentary.positive.flattery.6
	}
}

FormOfAddressForLiege = {
	type = character
	random_valid = yes
	text = {
		trigger = {
			OR = {
				highest_held_title_tier <= tier_duchy
				AND = {
					highest_held_title_tier = tier_kingdom
					prestige_level < high_prestige_level
				}
			}
			is_governor = no
			tgp_is_ceremonial_regent_trigger = no
		}
		localization_key = form_of_address_my_ladylord
	}
	text = {
		trigger = {
			is_governor = yes
			tgp_is_ceremonial_regent_trigger = no
		}
		localization_key = form_of_address_your_excellency
	}
	text = {
		trigger = {
			is_governor = yes
			tgp_is_ceremonial_regent_trigger = no
		}
		localization_key = form_of_address_excellency
	}
	text = {
		trigger = {
			OR = {
				government_has_flag = government_is_tribal
				government_has_flag = government_is_nomadic
				government_has_flag = government_is_landless_adventurer
			}
			tgp_is_ceremonial_regent_trigger = no
		}
		localization_key = form_of_address_liege_title
	}
	text = {
		trigger = {
			OR = {
				government_has_flag = government_is_tribal
				government_has_flag = government_is_nomadic
			}
			highest_held_title_tier >= tier_empire
			prestige_level >= high_prestige_level
			tgp_is_ceremonial_regent_trigger = no
		}
		localization_key = form_of_address_great_liege_title
	}
	text = {
		trigger = {
			highest_held_title_tier = tier_kingdom
			is_governor = no
			tgp_is_ceremonial_regent_trigger = no
		}
		localization_key = form_of_address_my_liege_title
	}
	text = {
		trigger = {
			highest_held_title_tier = tier_kingdom
			NOR = {
				government_has_flag = government_is_tribal
				government_has_flag = government_is_nomadic
			}
			prestige_level >= high_prestige_level
			is_governor = no
			tgp_is_ceremonial_regent_trigger = no
		}
		localization_key = form_of_address_your_highness
	}
	text = {
		trigger = {
			highest_held_title_tier = tier_kingdom
			NOR = {
				government_has_flag = government_is_tribal
				government_has_flag = government_is_nomadic
			}
			is_governor = no
			tgp_is_ceremonial_regent_trigger = no
		}
		localization_key = form_of_address_highness
	}
	text = {
		trigger = {
			highest_held_title_tier >= tier_empire
			NOR = {
				government_has_flag = government_is_tribal
				government_has_flag = government_is_nomadic
			}
			is_independent_ruler = yes
			tgp_is_ceremonial_regent_trigger = no
		}
		localization_key = form_of_address_your_majesty
	}
	text = {
		trigger = {
			highest_held_title_tier = tier_hegemony
			NOR = {
				government_has_flag = government_is_tribal
				government_has_flag = government_is_nomadic
			}
			is_independent_ruler = yes
			tgp_is_ceremonial_regent_trigger = no
		}
		localization_key = form_of_address_my_sovereign_ladylord
	}
	text = {
		trigger = {
			any_held_title = {
				is_head_of_faith = yes
			}
			OR = { faith.religion = religion:protestant_religion faith.religion = religion:catholic_religion faith.religion = religion:eastern_orthodox_religion }
		}
		localization_key = form_of_address_your_holiness
	}
	text = {
		trigger = {
			tgp_is_ceremonial_regent_trigger = yes
		}
		localization_key = form_of_address_liege_title
	}
	text = {
		trigger = {
			top_participant_group:dynastic_cycle ?= {
				participant_group_type = hegemon_ruler
			}
		}
		localization_key = form_of_address_son_of_heaven
	}
	text = {
		trigger = {
			government_has_flag = government_is_mandala
		}
		localization_key = form_of_address_your_radiance
	}
}
