![]() |
|
IL-2 Sturmovik: Cliffs of Dover Latest instalment in the acclaimed IL-2 Sturmovik series from award-winning developer Maddox Games. |
![]() |
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
![]()
Furbs, you should be ashamed. Below is a small sample script of getting co-op to work.It is actually much larger but there is a 50,000 character limit here.
As you can clearly see, it practically writes itself! Not sure why this would discourage any newcomers to the COD family. #region Settings private int missionPendingTime = 5; private int missionCycleTime = 15; private int missionDuration = 60; private bool forceRandom = false; /// <summary> /// The names of the players that have hosting permissions. /// </summary> /// <remarks> /// Add the names of the player that have admin rights. /// </remarks> private List<string> hostPlayers = new List<string> { //"41Sqn_Skipper", }; /// <summary> /// The sub folder that contains the available missions. /// </summary> /// <remarks> /// The folder must be below "C:\Users\*username*\Documents\1C SoftClub\il-2 sturmovik cliffs of dover\missions". /// </remarks> /// <example> /// Set "" to make all missions available. /// </example> private const string missionsSubFolder = @""; // e.g. "\Custom\Server\Kanalkampf" /// <summary> /// The name of the map of the lobby mission. /// </summary> /// <remarks> /// Only missions that stage on the same map can be loaded from the lobby mission. /// </remarks> private string mapName = "Land$English_Channel_1940"; #endregion /// <summary> /// The ids of the different OrderMissionMenus. /// </summary> private enum MainMenuID { HostMainMenu, ClientMainMenu, OpenMissionMenu, CloseMissionMenu, StartMissionMenu, SelectMissionMenu, SelectAircraftMenu, PlayerMenu, } private class CoopMission { public enum MissionState { None, Pending, Running, Finished, } public CoopMission(string missionFileName) { this.MissionFileName = missionFileName; this.State = MissionState.None; } public MissionState State { get; set; } public int MissionNumber { get; set; } public string MissionFileName { get; set; } public string DisplayName { get { if (State == MissionState.None) { return createMissionFileDisplayName(this.MissionFileName) ; } else { return createMissionFileDisplayName(this.MissionFileName) + " (" + State.ToString() + ")"; } } } public List<string> ForcedIdleAirGroups { get { return this.forcedIdleAirGroups; } } private List<string> forcedIdleAirGroups = new List<string>(); public Dictionary<string, Player> AircraftPlaceSelections { get { return this.aircraftPlaceSelections; } } Dictionary<string, Player> aircraftPlaceSelections = new Dictionary<string, Player>(); public List<AiActor> AiActors { get { return this.aiActors; } } List<AiActor> aiActors = new List<AiActor>(); } private Random rand = new Random(); private List<CoopMission> missions = new List<CoopMission>(); private Dictionary<Player, CoopMission> missionSelections = new Dictionary<Player, CoopMission>(); private Dictionary<Player, int> menuOffsets = new Dictionary<Player, int>(); private static string createMissionFileDisplayName(string missionFileName) { return missionFileName.Replace(Environment.GetFolderPath( Environment.SpecialFolder.MyDocuments) + @"\1C SoftClub\il-2 sturmovik cliffs of dover\missions" + missionsSubFolder, ""); } private List<string> getMissionFileNames() { string missionsFolderPath = Environment.GetFolderPath(Environment.SpecialFolde r.MyDocuments) + @"\1C SoftClub\il-2 sturmovik cliffs of dover\missions" + missionsSubFolder; string[] tempMissionFileNames = Directory.GetFiles(missionsFolderPath, "*.mis", SearchOption.AllDirectories); List<string> missionFileNames = new List<string>(); foreach (string tempMissionFileName in tempMissionFileNames) { if (tempMissionFileName.EndsWith(".mis")) { ISectionFile tempMissionFile = GamePlay.gpLoadSectionFile(tempMissionFileName); if (tempMissionFile.get("MAIN", "MAP") == mapName) { missionFileNames.Add(tempMissionFileName); } } } return missionFileNames; } private List<string> getAircraftPlaceDisplayNames(Player player) { List<string> aircraftPlaceDisplayNames = new List<string>(); if(missionSelections.ContainsKey(player)) { CoopMission mission = missionSelections[player]; if (mission.State == CoopMission.MissionState.Pending) { ISectionFile selectedMissionFile = GamePlay.gpLoadSectionFile(mission.MissionFileName ); for (int airGroupIndex = 0; airGroupIndex < selectedMissionFile.lines("AirGroups"); airGroupIndex++) { string key; string value; selectedMissionFile.get("AirGroups", airGroupIndex, out key, out value); string aircraftType = selectedMissionFile.get(key, "Class"); // Remove the flight mask string airGroupName = key.Substring(0, key.Length - 1); for (int flightIndex = 0; flightIndex < 4; flightIndex++) { if (selectedMissionFile.exist(key, "Flight" + flightIndex.ToString(System.Globalization.CultureI nfo.InvariantCulture.NumberFormat))) { string acNumberLine = selectedMissionFile.get(key, "Flight" + flightIndex.ToString(System.Globalization.CultureI nfo.InvariantCulture.NumberFormat)); string[] acNumberList = acNumberLine.Split(new char[] { ' ' }); if (acNumberList != null && acNumberList.Length > 0) { for (int aircraftIndex = 0; aircraftIndex < acNumberList.Length; aircraftIndex++) { string aircraft = airGroupName + flightIndex.ToString(System.Globalization.CultureI nfo.InvariantCulture.NumberFormat) + aircraftIndex.ToString(System.Globalization.Cultur eInfo.InvariantCulture.NumberFormat); if (getPlaces(aircraftType) != null) { int placeIndex = 0; foreach (string place in getPlaces(aircraftType)) { string aircraftPlaceDisplayName = key + " " + aircraftType + " " + place; placeIndex++; aircraftPlaceDisplayNames.Add(aircraftPlaceDisplay Name); } } } } } } } } else if (mission.State == CoopMission.MissionState.Running) { if (GamePlay.gpArmies() != null && GamePlay.gpArmies().Length > 0) { foreach (int armyIndex in GamePlay.gpArmies()) { if (GamePlay.gpAirGroups(armyIndex) != null && GamePlay.gpAirGroups(armyIndex).Length > 0) { foreach (AiAirGroup airGroup in GamePlay.gpAirGroups(armyIndex)) { if (airGroup.Name().StartsWith(mission.MissionNumber + ":")) { if (airGroup.GetItems() != null && airGroup.GetItems().Length > 0) { foreach (AiActor actor in airGroup.GetItems()) { if (actor is AiAircraft) { AiAircraft aircraft = actor as AiAircraft; if (aircraft.Places() > 0) { for (int placeIndex = 0; placeIndex < aircraft.Places(); placeIndex++) { if (aircraft.ExistCabin(placeIndex)) { string aircraftPlaceDisplayName = airGroup.Name().Replace(mission.MissionNumber + ":", "") + " " + aircraft.InternalTypeName() + " " + aircraft.CrewFunctionPlace(placeIndex).ToString(); aircraftPlaceDisplayNames.Add(aircraftPlaceDisplay Name); } } } } } } } } } } } } } return aircraftPlaceDisplayNames; } private string getAircraftPlaceDisplayName(Player player, string aircraftPlace) { if (missionSelections.ContainsKey(player)) { CoopMission mission = missionSelections[player]; if (mission.State == CoopMission.MissionState.Pending) { ISectionFile selectedMissionFile = GamePlay.gpLoadSectionFile(mission.MissionFileName ); for (int airGroupIndex = 0; airGroupIndex < selectedMissionFile.lines("AirGroups"); airGroupIndex++) { string key; string value; selectedMissionFile.get("AirGroups", airGroupIndex, out key, out value); string aircraftType = selectedMissionFile.get(key, "Class"); // Remove the flight mask string airGroupName = key.Substring(0, key.Length - 1); for (int flightIndex = 0; flightIndex < 4; flightIndex++) { if (selectedMissionFile.exist(key, "Flight" + flightIndex.ToString(System.Globalization.CultureI nfo.InvariantCulture.NumberFormat))) { string acNumberLine = selectedMissionFile.get(key, "Flight" + flightIndex.ToString(System.Globalization.CultureI nfo.InvariantCulture.NumberFormat)); string[] acNumberList = acNumberLine.Split(new char[] { ' ' }); if (acNumberList != null && acNumberList.Length > 0) { for (int aircraftIndex = 0; aircraftIndex < acNumberList.Length; aircraftIndex++) { string aircraft = airGroupName + flightIndex.ToString(System.Globalization.CultureI nfo.InvariantCulture.NumberFormat) + aircraftIndex.ToString(System.Globalization.Cultur eInfo.InvariantCulture.NumberFormat); if (getPlaces(aircraftType) != null) { uint placeIndex = 0; foreach (string place in getPlaces(aircraftType)) { if (aircraftPlace == aircraft + "@" + placeIndex) { return key + " " + aircraftType + " " + place; } placeIndex++; } } } } } } } } else if (mission.State == CoopMission.MissionState.Running) { if (GamePlay.gpArmies() != null && GamePlay.gpArmies().Length > 0) { foreach (int armyIndex in GamePlay.gpArmies()) { if (GamePlay.gpAirGroups(armyIndex) != null && GamePlay.gpAirGroups(armyIndex).Length > 0) { foreach (AiAirGroup airGroup in GamePlay.gpAirGroups(armyIndex)) { if (airGroup.Name().StartsWith(mission.MissionNumber + ":")) { if (airGroup.GetItems() != null && airGroup.GetItems().Length > 0) { foreach (AiActor actor in airGroup.GetItems()) { if (actor is AiAircraft) { AiAircraft aircraft = actor as AiAircraft; if (aircraft.Places() > 0) { for (int placeIndex = 0; placeIndex < aircraft.Places(); placeIndex++) { if (aircraft.ExistCabin(placeIndex)) { if (aircraftPlace == aircraft.Name().Replace(mission.MissionNumber + ":", "") + "@" + placeIndex) { return airGroup.Name().Replace(mission.MissionNumber + ":", "") + " " + aircraft.InternalTypeName().Replace("bob:", "") + " " + aircraft.CrewFunctionPlace(placeIndex).ToString(); } } } } } } } } } } } } } } return ""; } private List<string> getAircraftPlaces(Player player) { List<string> aircraftPlaces = new List<string>(); if (missionSelections.ContainsKey(player)) { CoopMission mission = missionSelections[player]; if (mission.State == CoopMission.MissionState.Pending) { ISectionFile selectedMissionFile = GamePlay.gpLoadSectionFile(mission.MissionFileName ); for (int airGroupIndex = 0; airGroupIndex < selectedMissionFile.lines("AirGroups"); airGroupIndex++) { string key; string value; selectedMissionFile.get("AirGroups", airGroupIndex, out key, out value); string aircraftType = selectedMissionFile.get(key, "Class"); // Remove the flight mask string airGroupName = key.Substring(0, key.Length - 1); for (int flightIndex = 0; flightIndex < 4; flightIndex++) { if (selectedMissionFile.exist(key, "Flight" + flightIndex.ToString(System.Globalization.CultureI nfo.InvariantCulture.NumberFormat))) { string acNumberLine = selectedMissionFile.get(key, "Flight" + flightIndex.ToString(System.Globalization.CultureI nfo.InvariantCulture.NumberFormat)); string[] acNumberList = acNumberLine.Split(new char[] { ' ' }); if (acNumberList != null && acNumberList.Length > 0) { for (int aircraftIndex = 0; aircraftIndex < acNumberList.Length; aircraftIndex++) { string aircraft = airGroupName + flightIndex.ToString(System.Globalization.CultureI nfo.InvariantCulture.NumberFormat) + aircraftIndex.ToString(System.Globalization.Cultur eInfo.InvariantCulture.NumberFormat); if (getPlaces(aircraftType) != null) { uint placeIndex = 0; foreach (string place in getPlaces(aircraftType)) { string aircraftPlace = aircraft + "@" + placeIndex; placeIndex++; aircraftPlaces.Add(aircraftPlace); } } } } } } } } else if (mission.State == CoopMission.MissionState.Running) { if (GamePlay.gpArmies() != null && GamePlay.gpArmies().Length > 0) { foreach (int armyIndex in GamePlay.gpArmies()) { if (GamePlay.gpAirGroups(armyIndex) != null && GamePlay.gpAirGroups(armyIndex).Length > 0) { foreach (AiAirGroup airGroup in GamePlay.gpAirGroups(armyIndex)) { if (airGroup.Name().StartsWith(mission.MissionNumber + ":")) { if (airGroup.GetItems() != null && airGroup.GetItems().Length > 0) { foreach (AiActor actor in airGroup.GetItems()) { if (actor is AiAircraft) { AiAircraft aircraft = actor as AiAircraft; if (aircraft.Places() > 0) { for (int placeIndex = 0; placeIndex < aircraft.Places(); placeIndex++) { if (aircraft.ExistCabin(placeIndex)) { string aircraftPlace = aircraft.Name().Replace(mission.MissionNumber + ":", "") + "@" + placeIndex; aircraftPlaces.Add(aircraftPlace); } } } } } } } } } } } } } return aircraftPlaces; } public override void OnBattleStarted() { base.OnBattleStarted(); MissionNumberListener = -1; if (GamePlay.gpIsServerDedicated() == true || forceRandom == true) { openRandomMission(); } } private void openRandomMission() { List<string> missionFileNames = getMissionFileNames(); int missionFileIndex = rand.Next(0, missionFileNames.Count); string missionFileName = missionFileNames[missionFileIndex]; CoopMission coopMission = new CoopMission(missionFileName); missions.Add(coopMission); openMission(coopMission); List<Player> players = new List<Player>(); if (GamePlay.gpPlayer() != null) { players.Add(GamePlay.gpPlayer()); } if (GamePlay.gpRemotePlayers() != null && GamePlay.gpRemotePlayers().Length > 0) { players.AddRange(GamePlay.gpRemotePlayers()); } GamePlay.gpLogServer(players.ToArray(), "New random mission.", null); Timeout((missionPendingTime * 60), () => { startMission(coopMission); }); Timeout((missionDuration * 60), () => { closeMission(coopMission); }); Timeout((missionCycleTime * 60), () => { openRandomMission(); }); } public override void OnActorCreated(int missionNumber, string shortName, AiActor actor) { base.OnActorCreated(missionNumber, shortName, actor); foreach (CoopMission mission in missions) { if (mission.MissionNumber == missionNumber) { foreach (string aircraftSelection in mission.AircraftPlaceSelections.Keys) { string aircraftName = aircraftSelection.Remove(aircraftSelection.IndexOf ("@"), aircraftSelection.Length - aircraftSelection.IndexOf("@")); if (missionNumber.ToString(System.Globalization.Cultu reInfo.InvariantCulture.NumberFormat) + ":" + aircraftName == actor.Name()) { Timeout(3.0, () => { placePlayer(mission.AircraftPlaceSelections[aircraftSelection]); }); } } mission.AiActors.Add(actor); } } } public override void OnOrderMissionMenuSelected(Player player, int ID, int menuItemIndex) { if (ID == (int)MainMenuID.HostMainMenu) { if (menuItemIndex == 1) { setOpenMissionMenu(player); } if (menuItemIndex == 2) { setCloseMissionMenu(player); } else if (menuItemIndex == 3) { setStartMissionMenu(player); } if (menuItemIndex == 4) { setSelectMissionMenu(player); } if (menuItemIndex == 5) { setSelectAircraftMenu(player); } else if (menuItemIndex == 6) { setPlayerMenu(player); } } else if (ID == (int)MainMenuID.ClientMainMenu) { if (menuItemIndex == 1) { setSelectMissionMenu(player); } if (menuItemIndex == 2) { setSelectAircraftMenu(player); } else if (menuItemIndex == 3) { setPlayerMenu(player); } } else if (ID == (int)MainMenuID.SelectMissionMenu) { if (menuItemIndex == 0) { setMainMenu(player); } else { if (menuItemIndex == ![]() { menuOffsets[player] = menuOffsets[player] - 1; setSelectMissionMenu(player); } else if (menuItemIndex == 9) { menuOffsets[player] = menuOffsets[player] + 1; setSelectMissionMenu(player); } else { if (menuItemIndex - 1 + (menuOffsets[player] * 7) < missions.Count) { CoopMission mission = missions[menuItemIndex - 1 + (menuOffsets[player] * 7)]; missionSelections[player] = mission; setMainMenu(player); } else { // No handling needed as menu item is not displayed. } } } } else if (ID == (int)MainMenuID.SelectAircraftMenu) { if (menuItemIndex == 0) { setMainMenu(player); } else { if (menuItemIndex == ![]() { menuOffsets[player] = menuOffsets[player] - 1; setSelectAircraftMenu(player); } else if (menuItemIndex == 9) { menuOffsets[player] = menuOffsets[player] + 1; setSelectAircraftMenu(player); } else { if (menuItemIndex - 1 + (menuOffsets[player] * 7) < getAircraftPlaces(player).Count) { if(missionSelections.ContainsKey(player)) { CoopMission mission = missionSelections[player]; List<string> aircraftPlaces = getAircraftPlaces(player); List<string> aircraftPlaceDisplayNames = getAircraftPlaceDisplayNames(player); if (!mission.AircraftPlaceSelections.ContainsKey(airc raftPlaces[menuItemIndex - 1 + (menuOffsets[player] * 7)])) { foreach(string aircraftPlace in mission.AircraftPlaceSelections.Keys) { if(mission.AircraftPlaceSelections[aircraftPlace] == player) { mission.AircraftPlaceSelections.Remove(aircraftPla ce); break; } } mission.AircraftPlaceSelections[aircraftPlaces[menuItemIndex - 1 + (menuOffsets[player] * 7)]] = player; placePlayer(player); GamePlay.gpLogServer(new Player[] { player }, "Aircraft selected: " + aircraftPlaceDisplayNames[menuItemIndex - 1 + (menuOffsets[player] * 7)], null); setMainMenu(player); } else { GamePlay.gpLogServer(new Player[] { player }, "Aircraft is already occupied.", null); setSelectAircraftMenu(player); } } else { // No handling needed as menu item is not displayed. } } else { // No handling needed as menu item is not displayed. } } } } else if (ID == (int)MainMenuID.PlayerMenu) { if (menuItemIndex == 0) { setMainMenu(player); } else { if (menuItemIndex == ![]() { menuOffsets[player] = menuOffsets[player] - 1; setPlayerMenu(player); } else if (menuItemIndex == 9) { menuOffsets[player] = menuOffsets[player] + 1; setPlayerMenu(player); } else { setPlayerMenu(player); } } } else if (ID == (int)MainMenuID.OpenMissionMenu) { if (menuItemIndex == 0) { setMainMenu(player); } else { if (menuItemIndex == ![]() { menuOffsets[player] = menuOffsets[player] - 1; setOpenMissionMenu(player); } else if (menuItemIndex == 9) { menuOffsets[player] = menuOffsets[player] + 1; setOpenMissionMenu(player); } else { List<string> missionFileNames = getMissionFileNames(); if (menuItemIndex - 1 + (menuOffsets[player] * 7) < missionFileNames.Count) { string missionFileName = missionFileNames[menuItemIndex - 1 + (menuOffsets[player] * 7)]; CoopMission mission = new CoopMission(missionFileName); missions.Add(mission); openMission(mission); GamePlay.gpLogServer(new Player[] { player }, "Mission pending: " + mission.DisplayName, null); setMainMenu(player); } else { // No handling needed as menu item is not displayed. } } } } else if (ID == (int)MainMenuID.CloseMissionMenu) { if (menuItemIndex == 0) { setMainMenu(player); } else { if (menuItemIndex == ![]() { menuOffsets[player] = menuOffsets[player] - 1; setCloseMissionMenu(player); } else if (menuItemIndex == 9) { menuOffsets[player] = menuOffsets[player] + 1; setCloseMissionMenu(player); } else { if (menuItemIndex - 1 + (menuOffsets[player] * 7) < missions.Count) { CoopMission mission = missions[menuItemIndex - 1 + (menuOffsets[player] * 7)]; closeMission(mission); GamePlay.gpLogServer(new Player[] { player }, "Mission closed: " + mission.DisplayName, null); setMainMenu(player); } else { // No handling needed as menu item is not displayed. } } } } else if (ID == (int)MainMenuID.StartMissionMenu) { if (menuItemIndex == 0) { setMainMenu(player); } else { if (menuItemIndex == ![]() { menuOffsets[player] = menuOffsets[player] - 1; setStartMissionMenu(player); } else if (menuItemIndex == 9) { menuOffsets[player] = menuOffsets[player] + 1; setStartMissionMenu(player); } else { if (menuItemIndex - 1 + (menuOffsets[player] * 7) < missions.Count) { CoopMission mission = missions[menuItemIndex - 1 + (menuOffsets[player] * 7)]; startMission(mission); GamePlay.gpLogServer(new Player[] { player }, "Mission started: " + mission.DisplayName, null); setMainMenu(player); } else { // No handling needed as menu item is not displayed. } } } } } public override void OnPlayerDisconnected(Player player, string diagnostic) { base.OnPlayerDisconnected(player, diagnostic); if (missionSelections.ContainsKey(player)) { foreach (string aircraftSelection in missionSelections[player].AircraftPlaceSelections.Keys) { if (missionSelections[player].AircraftPlaceSelections[aircraftSelection] == player) { missionSelections[player].AircraftPlaceSelections.Remove(aircraftSelection) ; break; } } } missionSelections.Remove(player); } public override void OnPlayerArmy(Player player, int army) { base.OnPlayerArmy(player, army); assignToLobbyAircraft(player); } public override void OnActorDestroyed(int missionNumber, string shortName, AiActor actor) { base.OnActorDestroyed(missionNumber, shortName, actor); assignPlayersOfActorToLobbyAircraft(actor); } public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex) { base.OnPlaceEnter(player, actor, placeIndex); setMainMenu(player); } /// <summary> /// Assigns all players that occupy a place of the actor to one of the lobby aircrafts. /// </summary> /// <param name="actor">The actor that might be occupied by players.</param> private void assignPlayersOfActorToLobbyAircraft(AiActor actor) { if (actor is AiAircraft) { AiAircraft aircraft = actor as AiAircraft; for (int placeIndex = 0; placeIndex < aircraft.Places(); placeIndex++) { if (aircraft.Player(placeIndex) != null) { Player player = aircraft.Player(placeIndex); assignToLobbyAircraft(player); } } } } /// <summary> /// Assigns a player to an unoccupied place in one of the lobby aircrafts. /// </summary> /// <param name="player">The player that is assigned to a lobby aircraft.</param> private void assignToLobbyAircraft(Player player) { if (GamePlay.gpAirGroups(player.Army()) != null && GamePlay.gpAirGroups(player.Army()).Length > 0) { foreach (AiAirGroup airGroup in GamePlay.gpAirGroups(player.Army())) { // Lobby aircrafts always have the mission index 0. if (airGroup.Name().StartsWith("0:")) { if (airGroup.GetItems() != null && airGroup.GetItems().Length > 0) { foreach (AiActor actor in airGroup.GetItems()) { if (actor is AiAircraft) { AiAircraft aircraft = actor as AiAircraft; for (int placeIndex = 0; placeIndex < aircraft.Places(); placeIndex++) { if (aircraft.Player(placeIndex) == null) { player.PlaceEnter(aircraft, placeIndex); // Place found. return; } } } } } } } } else { GamePlay.gpLogServer(new Player[] { player }, "No unoccupied place available in the lobby aircrafts.", null); } } /// <summary> /// Sets the main menu for a player. /// </summary> /// <param name="player">The player that gets the main menu set.</param> private void setMainMenu(Player player) { menuOffsets[player] = 0; string aircraftPlaceDisplyName = "None"; if ((GamePlay.gpPlayer() != null && player == GamePlay.gpPlayer()) || (player.Name() != null && player.Name() != "" && hostPlayers.Contains(player.Name()))) { // Set host menu. string[] entry = new string[] { "", "", "", "", "", "" }; bool[] hasSubEntry = new bool[] { true, true, true, true, true, true }; entry[0] = "Open Mission"; entry[1] = "Close Mission"; entry[2] = "Start Mission"; if(!missionSelections.ContainsKey(player)) { entry[3] = "Select Mission (Selected Mission: None)"; } else { CoopMission mission = missionSelections[player]; foreach (string aircraftPlace in missionSelections[player].AircraftPlaceSelections.Keys) { if (missionSelections[player].AircraftPlaceSelections[aircraftPlace] == player) { aircraftPlaceDisplyName = getAircraftPlaceDisplayName(player, aircraftPlace); break; } } entry[3] = "Select Mission (Selected Mission: " + mission.DisplayName + ")"; entry[4] = "Select Aircraft (Selected Aircraft: " + aircraftPlaceDisplyName + ")"; entry[5] = "Players"; } GamePlay.gpSetOrderMissionMenu(player, false, (int)MainMenuID.HostMainMenu, entry, hasSubEntry); } else { // Set client menu. string[] entry = new string[] { "", "", "" }; bool[] hasSubEntry = new bool[] { true, true, true }; if (!missionSelections.ContainsKey(player)) { entry[0] = "Select Mission (Selected Mission: None)"; } else { CoopMission mission = missionSelections[player]; foreach (string aircraftPlace in mission.AircraftPlaceSelections.Keys) { if (missionSelections[player].AircraftPlaceSelections[aircraftPlace] == player) { aircraftPlaceDisplyName = getAircraftPlaceDisplayName(player, aircraftPlace); break; } } entry[0] = "Select Mission (Selected Mission: " + mission.DisplayName + ")"; entry[1] = "Select Aircraft (Selected Aircraft: " + aircraftPlaceDisplyName + ")"; entry[2] = "Players"; } GamePlay.gpSetOrderMissionMenu(player, false, (int)MainMenuID.ClientMainMenu, entry, hasSubEntry); } } private void setSelectMissionMenu(Player player) { if (menuOffsets[player] < 0) { menuOffsets[player] = (int)missions.Count / 7; } else if ((menuOffsets[player] * 7) > missions.Count) { menuOffsets[player] = 0; } int entryCount = 9; string[] entry = new string[entryCount]; bool[] hasSubEntry = new bool[entryCount]; for (int entryIndex = 0; entryIndex < entryCount; entryIndex++) { if (entryIndex == entryCount - 2) { entry[entryIndex] = "Page up"; hasSubEntry[entryIndex] = true; } else if (entryIndex == entryCount - 1) { entry[entryIndex] = "Page down"; hasSubEntry[entryIndex] = true; } else { if (entryIndex + (menuOffsets[player] * 7) < missions.Count) { entry[entryIndex] = createMissionFileDisplayName(missions[entryIndex + (menuOffsets[player] * 7)].DisplayName); hasSubEntry[entryIndex] = true; } else { entry[entryIndex] = ""; hasSubEntry[entryIndex] = true; } } } GamePlay.gpSetOrderMissionMenu(player, true, (int)MainMenuID.SelectMissionMenu, entry, hasSubEntry); } private void setSelectAircraftMenu(Player player) { int entryCount = 9; string[] entry = new string[entryCount]; bool[] hasSubEntry = new bool[entryCount]; if (missionSelections.ContainsKey(player)) { CoopMission mission = missionSelections[player]; List<string> aircraftPlaceDisplayNames = getAircraftPlaceDisplayNames(player); List<string> aircraftPlaces = getAircraftPlaces(player); if (menuOffsets[player] < 0) { menuOffsets[player] = (int)aircraftPlaceDisplayNames.Count / 7; } else if ((menuOffsets[player] * 7) > aircraftPlaceDisplayNames.Count) { menuOffsets[player] = 0; } for (int entryIndex = 0; entryIndex < entryCount; entryIndex++) { if (entryIndex == entryCount - 2) { entry[entryIndex] = "Page up"; hasSubEntry[entryIndex] = true; } else if (entryIndex == entryCount - 1) { entry[entryIndex] = "Page down"; hasSubEntry[entryIndex] = true; } else { if (entryIndex + (menuOffsets[player] * 7) < aircraftPlaceDisplayNames.Count) { if (mission.AircraftPlaceSelections.ContainsKey(aircr aftPlaces[entryIndex + (menuOffsets[player] * 7)])) { entry[entryIndex] = aircraftPlaceDisplayNames[entryIndex + (menuOffsets[player] * 7)] + ": " + mission.AircraftPlaceSelections[aircraftPlaces[entryIndex + (menuOffsets[player] * 7)]].Name(); hasSubEntry[entryIndex] = true; } else { entry[entryIndex] = aircraftPlaceDisplayNames[entryIndex + (menuOffsets[player] * 7)]; hasSubEntry[entryIndex] = true; } } else { entry[entryIndex] = ""; hasSubEntry[entryIndex] = true; } } } } GamePlay.gpSetOrderMissionMenu(player, true, (int)MainMenuID.SelectAircraftMenu, entry, hasSubEntry); } private void setPlayerMenu(Player player) { int entryCount = 9; string[] entry = new string[entryCount]; bool[] hasSubEntry = new bool[entryCount]; if (missionSelections.ContainsKey(player)) { CoopMission playerMission = missionSelections[player]; List<Player> players = new List<Player>(); foreach (Player otherPlayer in missionSelections.Keys) { if (missionSelections[otherPlayer] == missionSelections[player]) { players.Add(otherPlayer); } } if (menuOffsets[player] < 0) { menuOffsets[player] = (int)players.Count / 7; } else if ((menuOffsets[player] * 7) > players.Count) { menuOffsets[player] = 0; } for (int entryIndex = 0; entryIndex < entryCount; entryIndex++) { if (entryIndex == entryCount - 2) { entry[entryIndex] = "Page up"; hasSubEntry[entryIndex] = true; } else if (entryIndex == entryCount - 1) { entry[entryIndex] = "Page down"; hasSubEntry[entryIndex] = true; } else { if (entryIndex + (menuOffsets[player] * 7) < players.Count) { string aircraftPlaceDisplyName = "None"; foreach (string aircraftPlace in missionSelections[player].AircraftPlaceSelections.Keys) { if (missionSelections[player].AircraftPlaceSelections[aircraftPlace] == players[entryIndex + (menuOffsets[player] * 7)]) { aircraftPlaceDisplyName = getAircraftPlaceDisplayName(player, aircraftPlace); break; } } entry[entryIndex] = players[entryIndex + (menuOffsets[player] * 7)].Name() + " (" + aircraftPlaceDisplyName + ")"; hasSubEntry[entryIndex] = true; } else { entry[entryIndex] = ""; hasSubEntry[entryIndex] = true; } } } } GamePlay.gpSetOrderMissionMenu(player, true, (int)MainMenuID.PlayerMenu, entry, hasSubEntry); } private void setOpenMissionMenu(Player player) { List<string> missionFileNames = getMissionFileNames(); if (menuOffsets[player] < 0) { menuOffsets[player] = (int)missionFileNames.Count / 7; } else if ((menuOffsets[player] * 7) > missionFileNames.Count) { menuOffsets[player] = 0; } int entryCount = 9; string[] entry = new string[entryCount]; bool[] hasSubEntry = new bool[entryCount]; for (int entryIndex = 0; entryIndex < entryCount; entryIndex++) { if (entryIndex == entryCount - 2) { entry[entryIndex] = "Page up"; hasSubEntry[entryIndex] = true; } else if (entryIndex == entryCount - 1) { entry[entryIndex] = "Page down"; hasSubEntry[entryIndex] = true; } else { if (entryIndex + (menuOffsets[player] * 7) < missionFileNames.Count) { entry[entryIndex] = createMissionFileDisplayName(missionFileNames[entryIndex + (menuOffsets[player] * 7)]); hasSubEntry[entryIndex] = true; } else { entry[entryIndex] = ""; hasSubEntry[entryIndex] = true; } } } GamePlay.gpSetOrderMissionMenu(player, true, (int)MainMenuID.OpenMissionMenu, entry, hasSubEntry); } private void setCloseMissionMenu(Player player) { if (menuOffsets[player] < 0) { menuOffsets[player] = (int)missions.Count / 7; } else if ((menuOffsets[player] * 7) > missions.Count) { menuOffsets[player] = 0; } int entryCount = 9; string[] entry = new string[entryCount]; bool[] hasSubEntry = new bool[entryCount]; |
#2
|
|||
|
|||
![]()
Force10, you totally.. and I mean totally ignore all the positives that come with the new CoD missions ... It is evident from your example that you don't even want to read those few self explaining crystal clear fool proof C# lines. I'm disgusted ...
![]() |
#3
|
||||
|
||||
![]()
Dont forget that quite a few things that were avaílable in old IL2, and now are requested here for CoD, were done by enthusiastic flightsimmers after old Il2 was on the scene a few years already.
Now here with CoD, where much is different, you want it done instantly by MG, which never did it in first place.
__________________
Win 7/64 Ult.; Phenom II X6 1100T; ASUS Crosshair IV; 16 GB DDR3/1600 Corsair; ASUS EAH6950/2GB; Logitech G940 & the usual suspects ![]() |
#4
|
|||
|
|||
![]()
I'm not taking away anything from the person who created the script. If anything, it shows how much work he put into it and he should be applauded for his efforts for the community. But the crowd who is telling us "Just make it yourself" and that it's "easy" are the ones taking away from the guy who created it.
|
#5
|
||||
|
||||
![]() Quote:
Robtek, instantly? ![]() So again, were not allowed to ask?
__________________
Furbs, Tree and Falstaff...The COD killers... ![]() Last edited by furbs; 03-26-2012 at 09:59 PM. |
#6
|
||||
|
||||
![]()
It does no harm to ask, in fact it would be very easy for them to add it, I think/unknown...I just would like to hear from someone who is using this coop now. Maybe others would try it then, and have fun with it.
__________________
GigaByteBoard...64bit...FX 4300 3.8, G. Skill sniper 1866 32GB, EVGA GTX 660 ti 3gb, Raptor 64mb cache, Planar 120Hz 2ms, CH controls, Tir5 |
#7
|
||||
|
||||
![]() Quote:
I hope the team can offer up what some old school designers want but your example is just the point of the whole argument...some kind sole has already made that coop for anyone and all to use. All that is needed is to edit any change that you would like to see implemented, or use it as is, till skills are developed amongst the squad for C#. Coops is not like going out to get a burger ![]()
__________________
GigaByteBoard...64bit...FX 4300 3.8, G. Skill sniper 1866 32GB, EVGA GTX 660 ti 3gb, Raptor 64mb cache, Planar 120Hz 2ms, CH controls, Tir5 Last edited by SlipBall; 03-26-2012 at 10:57 PM. |
![]() |
|
|