﻿############################################################################################################
# Expert AI mod - background events
############################################################################################################

### For delayed update effects

add_namespace = EAI_daily_update

country_event = {
	id = EAI_daily_update.0
	hidden = yes
	is_triggered_only = yes
	immediate = {
		
		EAI_daily_update = yes
	}
	option = {}
}

###

add_namespace = EAI_weekly_update

country_event = {
	id = EAI_weekly_update.0
	hidden = yes
	is_triggered_only = yes
	immediate = {
		
		EAI_weekly_update = yes
	}
	option = {}
}

###

add_namespace = EAI_bimonthly_update

country_event = {
	id = EAI_bimonthly_update.0
	hidden = yes
	is_triggered_only = yes
	immediate = {
		
		EAI_bimonthly_update = yes
	}
	option = {}
}

###

add_namespace = EAI_monthly_update

country_event = {
	id = EAI_monthly_update.0
	hidden = yes
	is_triggered_only = yes
	immediate = {
		
		EAI_monthly_update = yes
	}
	option = {}
}

### Hourly update

add_namespace = EAI_hourly_update

country_event = {
	id = EAI_hourly_update.0
	is_triggered_only = yes
	hidden = yes

	immediate = {
		EAI_hourly_update = yes
		add_to_variable = { global.EAI_hourly_tick = 1 }

		if = { limit = { check_variable = { global.EAI_hourly_tick < 24 } }

			country_event = { id = EAI_hourly_update.1 hours = 2 }
		}
	}

	option = {}
}

country_event = {
	id = EAI_hourly_update.1
	is_triggered_only = yes
	hidden = yes

	immediate = {
		EAI_hourly_update = yes
		add_to_variable = { global.EAI_hourly_tick = 1 }

		if = { limit = { check_variable = { global.EAI_hourly_tick < 24 } }

			country_event = { id = EAI_hourly_update.0 hours = 2 }
		}
	}

	option = {}
}

############################################################################################################
# Expert AI mod - config events
############################################################################################################

add_namespace = EAI

country_event = { # message when the config has been opened by someone
	id = EAI.4
	title = EAI.4.t
	desc = EAI.4.d
	picture = GFX_report_event_expert_ai
	is_triggered_only = yes
	option = { name = "OK" }
}

country_event = {
	id = EAI.1000
	hidden = yes
	is_triggered_only = yes
	immediate = {}
	option = {}
}

country_event = { # Player using the wrong HOI4 version
	id = EAI.5
	title = "Wrong HOI4 version"
	desc = "Use the HOI4 open beta with this mod."
	picture = GFX_report_event_expert_ai
	is_triggered_only = yes
	option = { name = "OK" }
}

country_event = { # Profiling
	id = EAI.6
	hidden = yes
	is_triggered_only = yes
	immediate = {
		EAI_test_effect = yes
	}
	option = { name = "OK" }
}

country_event = { # Player switching the country mid-game
	id = EAI.7
	title = "Playing an EAI initialized country"
	desc = "This mod does not support changing your country mid-game."
	picture = GFX_report_event_expert_ai
	mean_time_to_happen = { days = 2 }
	trigger = {
		is_ai = no
		has_country_flag = EAI_flagged_as_AI_country
		NOT = { has_country_flag = EAI_flagged_as_AI_country_warning }
	}
	immediate = { 
		set_country_flag = EAI_flagged_as_AI_country_warning
	}
	option = { name = "OK" }
}

country_event = { # Missing DLCs
	id = EAI.8
	title = "Missing DLCs"
	desc = "Missing necessary DLCs for this mod to function."
	picture = GFX_report_event_expert_ai
	mean_time_to_happen = { days = 2 }
	trigger = {
		is_ai = no
		OR = {
			NOT = { has_dlc = "By Blood Alone" }
			NOT = { has_dlc = "Man the Guns" }
			NOT = { has_dlc = "No Step Back" }
		}
		NOT = { has_country_flag = EAI_dlc_warning }
	}
	immediate = {
		set_country_flag = EAI_dlc_warning
	}
	option = { name = "OK" }
}