--Various DATA
------------------------------------------------------------------------------------------------------- 
------------------------------------------------------------------------------------------------------- 
-- last modification:  M56_b
if not versionDCE then versionDCE = {} end
versionDCE["UTIL_Data.lua"] = "1.7.30"
------------------------------------------------------------------------------------------------------- 
-- updateData_b						(b: add plane TaskByPlane)
-- cleanCode_						(en attente d utilisation)
-- adjustment_b						(b: Syria nnTimeZone +3 & GudautaGPS )
-- miguel21 modification M56_b		AssignCallnameSquad (b: callsignId)
-- Miguel21 modification M54_a		revoir CustomTaskScript et TaskBombing (a: TaskByPlane)
-- miguel21 modification M50_b		Records landings (b: add data file payload)
-- Miguel21 modification M11A_t		Multiplayer (t: AltitudeFloor)
-- Miguel21 modification M01_b		Ajout datalink (b: UTIL_Data file)
------------------------------------------------------------------------------------------------------- 

-- if flight[f].type == "E-2C" or flight[f].type == "E-3A" or flight[f].type == "F-15C" or flight[f].type == "F-15E" or flight[f].type == "F-16C bl.52d" 
--or flight[f].type == "FA-18C_hornet" or flight[f].type == "F/A-18C" or flight[f].type = "A-10C_2", then


EPLRS_Capacity = {
	["E-2C"] = true,
	["E-3A"] = true,
	["F-15C"] = true,
	["F-15E"] = true,
	["F-16C bl.52d"] = true,
	["FA-18C_hornet"] = true,
	["F/A-18C"] = true,
	["A-10C"] = true,
	["A-10C_2"] = true,
}

 payloadType = {
	["C-17A"] = 70000,					--max 77000 mais longue piste à prévoir
	["C-130"] = 19000,					--Kg
	["Hercules"] = 19000,
	
	["CH-47D"] = 10000,
	["CH-53E"] = 14000,					--16000 en externe
	["SH-60B"] = 1800,
	["UH-60A"] = 1100,					--4000 en externe
	["UH-1H"] = 1500,

	["An-30M"] = 5000,
	["An-26B"] = 5500,
	["IL-76MD"] = 40000,
	["Yak-40"] = 2700,	

	["Ka-27"] = 4000,
	["Mi-8MT"] = 4000,
	["Mi-24V"] = 2400,
 }
 

-- altitude plancher pour spawner des avions recovery client (sera surement utiliser pour spawn IA aussi, mais plus tard)
-- Il est possible d'imbriquer les zones, l'avion spawnera à l'altitude la plus haute qu'il trouve.
-- A priori, le nombre de point de polygone n'est pas limité... a tester


-- floor altitude to spawn client recovery aircraft (will probably be used to spawn AI too, but later)
-- It is possible to nest the zones, the plane will spawn at the high
altitudeFloor = {
	["caucasus"] = {											--name of map
		[5700] = {												--altidue floor (the highest point of this area) 5700
			[1] = {
				x =	-32544.321442457,
				y = 436114.53574692,
			},
			[2] = {
				x =	-143882.59745569,
				y = 900463.74376419,
			},
			[3] = {
				x =	-323817.91556239,
				y = 917876.83906484,
			},
			[4] = {
				x =	-164989.3796383,
				y = 463025.68302973,
			},
			-- [5] = {
				-- x =	-124921,
				-- y = 760428,
			-- },
		},
	},
}

  -- Where:  nLatitude    = latitude
  --         nLongitude   = longitude
  --         nTimeZone    = timezone offset for the location of interest (in hours)
  --         nTimestamp   = timestamp for location of interest (Windows timestamp)
  --         nShiftTz     = "true" to shift timestamp to the timezone of the location of interest*
  --         nTimeLZero   = 0 (no leading zeros on hour), 1 (leading zeros on hour)
  --         nTimeStyle   = 0 (12-hour clock) 1 (24-hour clock)
  --         sSunrise     = (optional) name of string meter to display sunrise time
  --         sSunset      = (optional) name of string meter to display sunset time
  --         sMoonrise    = (optional) name of string meter to display moonrise time
  --         sMoonset     = (optional) name of string meter to display moonset time
  --         sDayLength   = (optional) name of string meter to display day length
  --         sSunAngle    = (optional) name of variable to hold sun angle (in degrees)

locationForEphemeris = {
	["caucasus"] = {								--gudauta
		nnLatitude = 43.10195,
		nnLongitude = 40.62242,
		nnTimeZone = 4,
		nnShiftTz =  false,
		nnTimeLZero = 0,
		nnTimeStyle = 1,
	},
	["persiangulf"] = {
		nnLatitude = 24.568892,
		nnLongitude = 54.756338,
		nnTimeZone = 4,
		nnShiftTz =  false,
		nnTimeLZero = 0,
		nnTimeStyle = 1,
	},
	["syria"] = {
		nnLatitude = 33.497162,
		nnLongitude = 36.316573,
		nnTimeZone = 3,								--2
		nnShiftTz =  false,
		nnTimeLZero = 0,
		nnTimeStyle = 1,
	},
	["normandy"] = {								--Caen
		nnLatitude = 49.184171, 					--49.18417106729151, -0.36709560270994507
		nnLongitude = -0.367095,
		nnTimeZone = 0,								--2
		nnShiftTz =  false,
		nnTimeLZero = 0,
		nnTimeStyle = 1,
	},
}

--CustomTasksScript:
--CAS						AttackGroup		AttackUnit			AttackUnit(Static)
--Pinpoint Strike			Bombing 		AttackMapObject
--Ground Attack				Bombing 		AttackMapObject		CarpetBombing
--Runway Attack				Bombing			AttackMapObject		BombingRunway


--CustomTasksScript:
--							Bombing			AttackGroup		AttackUnit		AttackMapObject		BombingRunway		CarpetBombing
--CAS											X				X (&Static)
--Pinpoint Strike				X													X
--Ground Attack					X													X										X
--Runway Attack					X													X					X


--pb F18	"Pinpoint Strike" + AttackGroup  (pas prévu)
--pb Mi24	"GroundAttack" + AttackUnit (pas prévu)
groupTask = {
	["CAS"] = {
		["AttackGroup"] = true,
		["AttackUnit"] = true,
	},
	["Pinpoint Strike"] = {
		["Bombing"] = true,
		["AttackMapObject"] = true,
	},
	["Ground Attack"] = {
		["Bombing"] = true,
		["AttackMapObject"] = true,
		["CarpetBombing"] = true,		
	},
	["Runway Attack"] = {
		["Bombing"] = true,
		["AttackMapObject"] = true,
		["BombingRunway"] = true,	
	},
}
--							Bombing			AttackGroup		AttackUnit		AttackMapObject		BombingRunway		CarpetBombing
--CAS											X				X (&Static)
--Pinpoint Strike				X													X
--Ground Attack					X													X										X
--Runway Attack					X													X					X

strikeDegradedMode = {
	["CAS"] = {
		["AttackGroup"] = true,
		["AttackUnit"] = true,
	},
	["Pinpoint Strike"] = {
		["Bombing"] = true,
	},
	["Ground Attack"] = {
		["Bombing"] = true,
	},
	["Runway Attack"] = {
		["Bombing"] = true,
	},
	["Antiship Strike"] = {
		["AttackGroup"] = true,
		["AttackUnit"] = true,
	},	
}
	
	
groupTaskByTypeTarget = {
	["DynamicGroup"] = {
		["CAS"] = {
			["AttackGroup"] = true,
			["AttackUnit"] = true,
		},
		-- ["Pinpoint Strike"] = {
			-- ["Bombing"] = true,
		-- },
		-- ["Ground Attack"] = {
			-- ["Bombing"] = true,
		-- },
		-- ["Runway Attack"] = {
			-- ["Bombing"] = true,
		-- },
	},
	["Static"] = {
		["CAS"] = {
			["AttackUnit"] = true,
		},
		["Pinpoint Strike"] = {
			["Bombing"] = true,
		},
		["Ground Attack"] = {
			["Bombing"] = true,
		},
		-- ["Runway Attack"] = {
			-- ["Bombing"] = true,
		-- },
	},
	["MapObject"] = {
		["Pinpoint Strike"] = {
			["AttackMapObject"] = true,
		},
		["Ground Attack"] = {
			["AttackMapObject"] = true,
		},
		["Runway Attack"] = {
			["AttackMapObject"] = true,
		},
	},
	["Runway"] = {
		["Runway Attack"] = {
			["BombingRunway"] = true,
		},
	},
	["Ship"] = {
		
		["Antiship Strike"] = {
			["AttackGroup"] = true,
			["AttackUnit"] = true,
		},		
		-- ["CAS"] = {
			-- ["AttackGroup"] = true,
			-- ["AttackUnit"] = true,
		-- },
		-- ["Pinpoint Strike"] = {
			-- ["Bombing"] = true,
		-- },
		-- ["Ground Attack"] = {
			-- ["Bombing"] = true,
		-- },
		-- ["Runway Attack"] = {
			-- ["Bombing"] = true,
		-- },
	},
	-- ["AA"] = {		
		-- ["Fighter Sweep"] = {
			-- ["EngageTargetsInZone"] = true,
		-- },		
		-- ["CAP"] = {
			-- ["EngageTargetsInZone"] = true,
			-- ["AttackUnit"] = true,
		-- },
		-- ["Escort"] = {
			-- ["EngageTargetsInZone"] = true,
		-- },
		-- ["Intercept"] = {
			-- ["EngageTargetsInZone"] = true,
		-- },
	-- },
	
	["Fighter Sweep"] = {		
		["Fighter Sweep"] = {
			["EngageTargetsInZone"] = true,
		},
	},
	["CAP"] = {
		["CAP"] = {
			["EngageTargetsInZone"] = true,
			["AttackUnit"] = true,
		},
	},
	["Escort"] = {
		["Escort"] = {
			["EngageTargetsInZone"] = true,
		},
	},
	["Intercept"] = {
		["Intercept"] = {
			["EngageTargetsInZone"] = true,
		},
	},
	
	["SEAD"] = {		
		["SEAD"] = {
			["EngageTargets"] = true,
		},
	},
	["AWACS"] = {		
		["AWACS"] = {
			["AWACS"] = true,
		},
	},
	["Transport"] = {		
		["Transport"] = {
			["Transport"] = true,
		},
	},
	["Reconnaissance"] = {		
		["Reconnaissance"] = {
			["Reconnaissance"] = true,
		},
	},
	["Refueling"] = {		
		["Refueling"] = {
			["Tanker"] = true,
		},
	},
	["Laser Illumination"] = {		
		["AFAC"] = {
			["EngageTargetsInZone"] = true,
		},
	},	
	

}

TaskByPlane = {
	["AFAC"] = {
	
		["F-16C_50"] = true,
		["F-16C bl.52d"] = true,
		["Su-24M"] = true,
		
		["Mi-24P"] = true,
		

	},
	["CAS"] = {
		
		["A-10C_2"] = true,
		
		["AJS37"] = true,
		["AV8BNA"] = true,
		
		
		["B-1B"] = true,
		["B-52H"] = true,
		
		["F-86F Sabre"] = true,
		
		["F-4E"] = true,
		["F-5E-3"] = true,
		["F-14B"] = true,		
		["F-14A-135-GR"] = true,
		["F-15E"] = true,
		["F-16C_50"] = true,
		["F-16C bl.52d"] = true,
		["FA-18C_hornet"] = true,
		
		["M-2000C"] = true,
		
		["AH-1W"] = true,
		["UH-1H"] = true,
		["SA342M"] = true,
		
		
		["MiG-19P"] = true,
		["MiG-21Bis"] = true,	
		["MiG-23MLD"] = true,
		["MiG-27K"] = true,
		["MiG-29A"] = true,
		
		
		["Su-17M4"] = true,
		["Su-24M"] = true,
		["Su-25"] = true,		
		["Su-25T"] = true,
		["Su-27"] = true,
		
		
		
		["Mi-8MT"] = true,
		["Mi-24V"] = true,
		["Mi-24P"] = true,
		

	},

	["Antiship Strike"] = {
		["A-10C_2"] = true,
		["AJS37"] = true,
		["AV8BNA"] = true,
		["B-52H"] = true,
		
		["F-86F Sabre"] = true,
		
		["F-4E"] = true,
		["F-5E-3"] = true,
		["F-14A-135-GR"] = true,
		["F-14B"] = true,
		["F-16C_50"] = true,
		["F-16C bl.52d"] = true,
		["FA-18C_hornet"] = true,				
		
		["MirageF1CT"] = true,			--TODO must be confirmed
		
		["AH-1W"] = true,
		
		["MiG-19P"] = true,
		["MiG-27K"] = true,
		["MiG-29A"] = true,
		["Su-17M4"] = true,
		["Su-24M"] = true,		
		["Su-25"] = true,
		["Su-25T"] = true,
		["Su-25TM"] = true,
	
		["Su-27"] = true,
		
		["Tu-22M3"] = true,		
		["Tu-142"] = true,

		
		["Mi-8MT"] = true,
		["Mi-24V"] = true,
		["Mi-24P"] = true,


	},

	["Ground Attack"] = {
		["A-10C_2"] = true,
		["AJS37"] = true,
		["AV8BNA"] = true,
		
		["B-1B"] = true,
		["B-52H"] = true,
		
		["F-86F Sabre"] = true,
		
		["F-4E"] = true,
		["F-5E-3"] = true,
		["F-14A-135-GR"] = true,
		["F-14B"] = true,
		["F-15E"] = true,
		["F-16C_50"] = true,
		["F-16C bl.52d"] = true,
		["FA-18C_hornet"] = true,
		
		["MirageF1"] = true,			--TODO must be confirmed
		["MirageF1CT"] = true,			--TODO must be confirmed
		["M-2000C"] = true,
		
		["AH-1W"] = true,
		["UH-1H"] = true,
		["SA342M"] = true,
		
		["MiG-19P"] = true,
		["MiG-21Bis"] = true,
		["MiG-23MLD"] = true,
		["MiG-25RBT"] = true,
		["MiG-27K"] = true,
		["MiG-29A"] = true,
		
		["Su-17M4"] = true,
		["Su-24M"] = true,
		["Su-25"] = true,
		["Su-25T"] = true,
		["Su-27"] = true,
		["Tu-22M3"] = true,
		
		["Mi-8MT"] = true,
		["Mi-24V"] = true,
		["Mi-24P"] = true,
		
		
		
	},
	
	["Runway Attack"] = {
		["A-10C_2"] = true,
		["AJS37"] = true,
		["AV8BNA"] = true,
		
		["B-1B"] = true,
		["B-52H"] = true,
		["F-14A-135-GR"] = true,
		["F-14B"] = true,
		["F-15E"] = true,
		["F-16C_50"] = true,
		["F-16C bl.52d"] = true,
		["FA-18C_hornet"] = true,
		["M-2000C"] = true,
		
		["Su-17M4"] = true,
		["Su-24M"] = true,
		["Su-25"] = true,
		["Su-25T"] = true,
		["Su-27"] = true,
		["MiG-29A"] = true,
		["Tu-22M3"] = true,
		["MiG-27K"] = true,


	},
	
	["Escort"] = {
		["AV8BNA"] = true,
		
		
		["F-86F Sabre"] = true,
		["F-4E"] = true,
		["F-5E-3"] = true,
		["F-14A-135-GR"] = true,
		["F-14B"] = true,		
		["F-15C"] = true,
		["F-15E"] = true,
		["F-16C_50"] = true,
		["F-16C bl.52d"] = true,
		["FA-18C_hornet"] = true,
		
		["MirageF1"] = true,			--TODO must be confirmed
		["M-2000C"] = true,
		
		["AH-1W"] = true,
		["SA342M"] = true,
		
		
		["MiG-19P"] = true,
		["MiG-21Bis"] = true,
		["MiG-23MLD"] = true,
		["MiG-25PD"] = true,
		["MiG-29A"] = true,
		["MiG-31"] = true,
		
		["Su-27"] = true,
		
		["Mi-24P"] = true,
		



	},
	
	["Pinpoint Strike"] = {
		["AJS37"] = true,
		["AV8BNA"] = true,
		
		["B-1B"] = true,
		["B-52H"] = true,
		["F-4E"] = true,
		["F-5E-3"] = true,
		["F-14A-135-GR"] = true,
		["F-14B"] = true,
		["F-15E"] = true,
		["F-16C_50"] = true,
		["F-16C bl.52d"] = true,
		["FA-18C_hornet"] = true,
		["F-117A"] = true,
	
		
		["M-2000C"] = true,
		
		["MiG-27K"] = true,
		["Su-17M4"] = true,
		["Su-24M"] = true,
		["Su-25"] = true,
		["Su-25T"] = true,

	},

	["Intercept"] = {
		["AJS37"] = true,
		
		["F-86F Sabre"] = true,
		
		["F-4E"] = true,
		["F-5E-3"] = true,
		["F-14A-135-GR"] = true,		
		["F-14B"] = true,		
		["F-15C"] = true,
		["F-15E"] = true,
		["F-16C_50"] = true,
		["F-16C bl.52d"] = true,
		["FA-18C_hornet"] = true,
		
		["MirageF1"] = true,			--TODO must be confirmed
		["M-2000C"] = true,
		
		["MiG-19P"] = true,
		["MiG-21Bis"] = true,
		["MiG-23MLD"] = true,
		["MiG-25PD"] = true,
		["MiG-29A"] = true,
		["MiG-31"] = true,
		["Su-27"] = true,


	},

	["CAP"] = {
		["AJS37"] = true,
		
		["F-86F Sabre"] = true,
		
		["F-4E"] = true,
		["F-5E-3"] = true,
		["F-14A-135-GR"] = true,
		["F-14B"] = true,	
		["F-15C"] = true,
		["F-15E"] = true,
		["F-16C_50"] = true,
		["F-16C bl.52d"] = true,
		["FA-18C_hornet"] = true,
		
		["MirageF1"] = true,			--TODO must be confirmed
		["M-2000C"] = true,
		
		["MiG-19P"] = true,
		["MiG-21Bis"] = true,
		["MiG-23MLD"] = true,
		["MiG-25PD"] = true,
		["MiG-29A"] = true,
		["MiG-31"] = true,
		["Su-27"] = true,


	},

	["Fighter Sweep"] = {
		["AJS37"] = true,
		
		["F-86F Sabre"] = true,
		
		["F-4E"] = true,
		["F-5E-3"] = true,
		["F-14A-135-GR"] = true,
		["F-14B"] = true,
		["F-15C"] = true,
		["F-15E"] = true,
		["F-16C_50"] = true,
		["F-16C bl.52d"] = true,
		["FA-18C_hornet"] = true,
		
		["MirageF1"] = true,			--TODO must be confirmed
		["M-2000C"] = true,
		
		["MiG-19P"] = true,
		["MiG-23MLD"] = true,
		["MiG-25PD"] = true,
		["MiG-29A"] = true,
		["MiG-31"] = true,
		["Su-27"] = true,


	},

	
	["Reconnaissance"] = {
		["AJS37"] = true,
		["F-4E"] = true,
		["F-15E"] = true,
		["F-16C_50"] = true,
		["F-16C bl.52d"] = true,
		["FA-18C_hornet"] = true,
		
		["SA342M"] = true,
		
		["MiG-25RBT"] = true,
		["Su-24MR"] = true,
		["Tu-142"] = true,
	},
	
	
	["Refueling"] = {		
		["S-3B Tanker"] = true,
		["KC135MPRS"] = true,
		["KC-135"] = true,	
		["KC130"] = true,
		["IL-78M"] = true,
	},
	
	["AWACS"] = {		
		["E-3A"] = true,
		["E-2C"] = true,
		["A-50"] = true,	
	},

	["SEAD"] = {
		["AJS37"] = true,
		["AV8BNA"] = true,
		["F-4E"] = true,
		["F-16C_50"] = true,
		["F-16C bl.52d"] = true,
		
		["FA-18C_hornet"] = true,
		
		["Su-17M4"] = true,
		["Su-24M"] = true,
		["Su-25T"] = true,
		["MiG-27K"] = true,


	},
	
	["Transport"] = {
		["C-130"] = true,
		
		
		["UH-1H"] = true,
		["CH-47D"] = true,
		
		
		
		["An-26B"] = true,
		
		["Mi-8MT"] = true,
		["Mi-24V"] = true,
		["Mi-24P"] = true,


	},

}

WestCallsign = {	
	["Australia"] = "west", 
	["Belgium"] = "west",
	["Canada"] = "west", 
	["CJTF Blue"] = "west",
	-- ["CJTF Red"] = "west",			
	["Croatia"] = "west",
	["Cyprus"] = "west",

	["Denmark"] = "west",			
	["France"] = "west", 
	["Georgia"] = "west",
	["Greece"] = "west",
	
	["India"] = "west",
	["Iran"] = "west",
	["Israel"] = "west",
	["Italy"] = "west", 
	
	["Norway"] = "west", 
	["Pakistan"] = "west",

	["South Korea"] = "west", 
	["Spain"] = "west", 
	["Sweden"] = "west",
	
	["The Netherlands"] = "west", 
	["Turkey"] = "west",
	
	["UK"] = "west",
	["United Arab Emirates"] = "west",
	["USA"] = "west", 
	["USAF Aggressors"] = "west", 
}

callsign_west = {
	generic = {
		[1] = "Enfield",
		[2] = "Springfield",
		[3] = "Uzi",
		[4] = "Colt",
		[5] = "Dodge",
		[6] = "Ford",
		[7] = "Chevy",
		[8] = "Pontiac",
	},
	AWACS = {
		[1] = "Overlord",
		[2] = "Magic",
		[3] = "Wizard",
		[4] = "Focus",
		[5] = "Darkstar",
	},
	tanker = {
		[1] = "Texaco",
		[2] = "Arco",
		[3] = "Shell",
	}
}

--https://wiki.hoggitworld.com/view/DCS_enum_callsigns
SpecificCallnames = {
	["FA-18C_hornet"] = {
		["USA"] = {
			[9] = 'Hornet',
			[10] = 'Squid',
			[11] = 'Ragin',
			[12] = 'Roman',
			[13] = 'Sting',
			[14] = 'Jury',
			[15] = 'Joker',
			[16] = 'Ram',
			[17] = 'Hawk',
			[18] = 'Devil',
			[19] = 'Check',
			[20] = 'Snake',
		},
	},
	["F-16C_50"] = {
		["USA"] = {
			[9] = 'Viper',
			[10] = 'Venom',
			[11] = 'Lobo',
			[12] = 'Cowboy',
			[13] = 'Python',
			[14] = 'Rattler',
			[15] = 'Panther',
			[16] = 'Wolf',
			[17] = 'Weasel',
			[18] = 'Wild',
			[19] = 'Ninja',
			[20] = 'Jedi',
		},
	},
	["A-10A"] = {
		["USA"] = {
			[9] = 'Hawg',
			[10] = 'Boar',
			[11] = 'Pig',
			[12] = 'Tusk',
		},
	},
	["A-10C"] = {
		["USA"] = {
			[9] = 'Hawg',
			[10] = 'Boar',
			[11] = 'Pig',
			[12] = 'Tusk',
		},
	},
	["A-10C_2"] = {
		["USA"] = {
			[9] = 'Hawg',
			[10] = 'Boar',
			[11] = 'Pig',
			[12] = 'Tusk',
		},
	},
	["B-1B"] = {
		["USA"] = {
			[9] = 'Bone',
			[10] = 'Dark',
			[11] = 'Vader',
		},
	},
	["B-52"] = {
		["USA"] = {
			[9] = 'Buff',
			[10] = 'Dump',
			[11] = 'Kenworth',
		},
	},
	["C-130"] = {
		["USA"] = {
			[9] = 'Heavy',
			[10] = 'Trash',
			[11] = 'Cargo',
			[12] = 'Ascot',
		},
	},
	["C-17A"] = {
		["USA"] = {
			[9] = 'Heavy',
			[10] = 'Trash',
			[11] = 'Cargo',
			[12] = 'Ascot',
		},
	},
	["C-47"] = {
		["USA"] = {
			[9] = 'Heavy',
			[10] = 'Trash',
			[11] = 'Cargo',
			[12] = 'Ascot',
		},
	},
}
