Fulqrum Publishing Home   |   Register   |   Today Posts   |   Members   |   UserCP   |   Calendar   |   Search   |   FAQ

Go Back   Official Fulqrum Publishing forum > Fulqrum Publishing > IL-2 Sturmovik: Cliffs of Dover

IL-2 Sturmovik: Cliffs of Dover Latest instalment in the acclaimed IL-2 Sturmovik series from award-winning developer Maddox Games.

Reply
 
Thread Tools Display Modes
  #131  
Old 03-26-2012, 07:23 PM
ACE-OF-ACES's Avatar
ACE-OF-ACES ACE-OF-ACES is offline
Approved Member
 
Join Date: May 2010
Location: NM
Posts: 2,248
Default

Quote:
Originally Posted by furbs View Post
ACE if a proper IL2 COOP was added would CLOD be better or worse?
First the argument was NO coops..

Than someone wrote the script that allowed coops..

Now the argument is PROPER coops..

Which only proves to me that if 1C did include a coop like menu 'someone' would still find issues with it

But to answer your question, I would welcome it and love it if they could provide both the old DF/COOP along with the new MISSION methods.. But not if it meant we had to give up some of the new features the new MISSION methods provide.. Why? Well because I like the idea of having more immersive missions to play.. I am one that welcomes advancements and not stuck in one way of doing things
__________________
Theres a reason for instrumenting a plane for test..
That being a pilots's 'perception' of what is going on can be very different from what is 'actually' going on.
Reply With Quote
  #132  
Old 03-26-2012, 07:32 PM
furbs's Avatar
furbs furbs is offline
Approved Member
 
Join Date: Apr 2008
Posts: 2,039
Default

Quote:
Originally Posted by addman View Post
It's just their opinions, it doesn't mean they are right. I think both would be good, the devs could simply add some more preset triggers/scripts to the ones we already have in the FMB to choose from. Also implementing a coop interface for those who likes that couldn't be so hard since CloD has a .net framework. I'm all for the new possibilities with the "mixed" dogfight/coop servers like ATAG, I fly on that more than ever now but I also like the old style coops, why can't one have/like both? It's not like anyone wants to take anything away here. Time will tell how many people will migrate to CloD and also how quickly with the current online framework that the game has.

P.S If luthier is serious about "crushing" the competition he'd better start making user friendly interfaces because the competition has thousands of online players and they're all used to click on the single "instant battle" button. Free advice for you luthier, "instant action" = instant cash.
Exactly, were asking for the COOP GUI for CLOD.
We want the ease of use of the GUI menus with the triggers and fancy stuff of CLOD.
__________________
Furbs, Tree and Falstaff...The COD killers...
Reply With Quote
  #133  
Old 03-26-2012, 07:36 PM
41Sqn_Banks 41Sqn_Banks is offline
Approved Member
 
Join Date: Oct 2007
Posts: 644
Default

Quote:
Originally Posted by furbs View Post
Sorry, we used to fly COOPs in IL2 but not any more.

The stats were created at the end of a mission in a file that held all the info, that file could be uploaded to a website that then could be viewed by all the pilots that took part.

In VEF online war the stats would be added after each mission and your pilot history would be kept up to date with kills, deaths, missions, ground kills and time flown.

you really wanted to keep your pilot alive and keep and it made you fly much more like real life.
Back in the days someone had to write the code to parse the log file for statistics. Now you need someone who that creates the mission script to write the log file on his own and than parse it for statistics.
I can assure you, every programmer is happy if he doesn't need to parse the predefined log file but is able to create his own, with his own content and format. That makes the parsing much more easy. Writing the log really is the easiest part of it.

Problem is that there are to few people that get creative and produce "customer created content" for the sim. People are spoilt and spent more time complaining in the forum instead of getting creative and finds ways to work around the issues and enjoy the good parts.
Reply With Quote
  #134  
Old 03-26-2012, 07:41 PM
furbs's Avatar
furbs furbs is offline
Approved Member
 
Join Date: Apr 2008
Posts: 2,039
Default

I dont get it, are people saying we shouldn't be asking for useful features that would help CLOD be more popular?
__________________
Furbs, Tree and Falstaff...The COD killers...
Reply With Quote
  #135  
Old 03-26-2012, 08:01 PM
41Sqn_Banks 41Sqn_Banks is offline
Approved Member
 
Join Date: Oct 2007
Posts: 644
Default

No, we should ask. But then we have to go on and use what we got so far. You want and online war that features a cooperative gameplay style and statics? Go for it and create one. There are so many ways to cope with the missing coop interface or missing statistics. Just do it.
Reply With Quote
  #136  
Old 03-26-2012, 08:11 PM
SlipBall's Avatar
SlipBall SlipBall is offline
Approved Member
 
Join Date: Oct 2007
Location: down Island, NY
Posts: 2,719
Default

Quote:
Originally Posted by 41Sqn_Banks View Post
No, we should ask. But then we have to go on and use what we got so far. You want and online war that features a cooperative gameplay style and statics? Go for it and create one. There are so many ways to cope with the missing coop interface or missing statistics. Just do it.

Inspiring! ...I guess just jump in, get your feet wet and do it. It's not like a person would need to make more than one of them, to meet his needs for many years of use.
__________________



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
Reply With Quote
  #137  
Old 03-26-2012, 08:14 PM
Insuber Insuber is offline
Approved Member
 
Join Date: Oct 2007
Location: Paris - France
Posts: 1,406
Default

Quote:
Originally Posted by furbs View Post
I dont get it, are people saying we shouldn't be asking for useful features that would help CLOD be more popular?
Not "people", just "someone"
Reply With Quote
  #138  
Old 03-26-2012, 08:19 PM
ATAG_MajorBorris's Avatar
ATAG_MajorBorris ATAG_MajorBorris is offline
Approved Member
 
Join Date: Mar 2010
Location: Minnesota, USA
Posts: 342
Default

First and foremost, they need to redue the graphics engine then we can get to cool coop gui but Im not sure we need Hyperlobby anymore(I liked it too but why load up somthing CoD allready does..but it might help get the old il2 guys back)

The scoring system, now we need to be able to work with that as well, the old il2 scoring system was much better for full real servers and was condusive to realistic sim play>> 100 points for a kill if you made it home safe--10 points if not--pilots and planes for victory conditions.
__________________
ASUS Sabertooth MB--Intel 2600k@4.7--EVGA GTX580 3GB--Corasir 1200 watt psu--Corsair 16gb 1866--Corsair H70 cooler--Corsair 650d case--OCZ Vertex 3--Track IR5--CH Eclipse Yoke--CH Trottle Quadrant--CH MFP--CH Rudders-MSFF2
Reply With Quote
  #139  
Old 03-26-2012, 08:53 PM
furbs's Avatar
furbs furbs is offline
Approved Member
 
Join Date: Apr 2008
Posts: 2,039
Default

Quote:
Originally Posted by 41Sqn_Banks View Post
No, we should ask. But then we have to go on and use what we got so far. You want and online war that features a cooperative gameplay style and statics? Go for it and create one. There are so many ways to cope with the missing coop interface or missing statistics. Just do it.

Sorry banks but i just dont have the skills, wish i did.
__________________
Furbs, Tree and Falstaff...The COD killers...
Reply With Quote
  #140  
Old 03-26-2012, 09:11 PM
Force10 Force10 is offline
Approved Member
 
Join Date: Sep 2011
Posts: 371
Default

Quote:
Originally Posted by furbs View Post
Sorry banks but i just dont have the skills, wish i did.
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];
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:03 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.