namespace = accolade

#Accolade rank gain notification
# by Jason Cantalini
accolade.0001 = {
	hidden = yes

	trigger = {
		exists = acclaimed_knight
		has_dlc_feature = accolades
	}

	immediate = {
		scope:changing_accolade = {
			acclaimed_knight = {
				save_scope_as = acclaimed_knight
			}
		}
		if = {
			limit = {
				scope:changing_accolade = {
					accolade_rank >= 5
				}
			}
			send_interface_message = {
				type = msg_accolade_gained_rank
				title = accolade.0001.notification_high
				desc = accolade_rank_unlock_notification_tooltip_high
				left_icon = scope:acclaimed_knight
			}
		}
		else = {
			send_interface_message = {
				type = msg_accolade_gained_rank
				title = accolade.0001.notification_low
				desc = accolade_rank_unlock_notification_tooltip_low
				left_icon = scope:acclaimed_knight
			}
		}
	}
}

#Accolade rank loss notification
# by Jason Cantalini
accolade.0002 = {
	hidden = yes

	trigger = {
		has_dlc_feature = accolades
	}

	immediate = {
		if = {
			limit = {
				exists = scope:changing_accolade.acclaimed_knight
			}
			scope:changing_accolade = {
				acclaimed_knight = {
					save_scope_as = acclaimed_knight
				}
			}
			if = {
				limit = {
					scope:changing_accolade = {
						accolade_rank >= 5
					}
				}
				send_interface_message = {
					type = msg_accolade_lost_rank
					title = accolade.0002.notification_high
					left_icon = scope:acclaimed_knight
					desc = {
						first_valid = {
							triggered_desc = {
								trigger = {
									scope:acclaimed_knight = {
										is_alive = yes
									}
								}
								desc = accolade_rank_loss_notification_tooltip_high
							}
							desc = accolade_rank_loss_notification_tooltip_high_dead
						}
					}
				}
			}
			else_if = {
				limit = {
					scope:changing_accolade = {
						accolade_rank >= 1
					}
				}
				send_interface_message = {
					type = msg_accolade_lost_rank
					title = accolade.0002.notification_low
					left_icon = scope:acclaimed_knight
					desc = {
						first_valid = {
							triggered_desc = {
								trigger = {
									scope:acclaimed_knight = {
										is_alive = yes
									}
								}
								desc = accolade_rank_loss_notification_tooltip_low
							}
							desc = accolade_rank_loss_notification_tooltip_low_dead
						}
					}
				}
			}
			else = {
				send_interface_message = {
					type = msg_accolade_lost_rank
					title = accolade.0002.notification_low
					left_icon = scope:acclaimed_knight
					desc = {
						first_valid = {
							triggered_desc = {
								trigger = {
									scope:acclaimed_knight = {
										is_alive = yes
									}
								}
								desc = accolade_rank_loss_notification_tooltip_no_rank
							}
							desc = accolade_rank_loss_notification_tooltip_no_rank_dead
						}
					}
				}
			}
		}
		else_if = {
			limit = {
				NOT = { exists = scope:changing_accolade.acclaimed_knight }
				scope:changing_accolade = { accolade_rank >= 1 }
			}
			send_interface_message = {
				type = msg_accolade_lost_rank
				title = accolade.0002.notification_empty
				desc = accolade_rank_loss_notification_tooltip_empty
			}
		}
		else = {
			send_interface_message = {
				type = msg_accolade_lost_rank
				title = accolade.0002.notification_low
				desc = accolade_rank_loss_notification_tooltip_empty_no_rank
			}
		}
	}
}
