Пример #1
0
        private void MessageReceiver_FMD_S_AUTODONATE(ClientConnection client, AllegianceInterop.FMD_S_AUTODONATE message)
        {
            // If we are supposed to be the commander and we get an "auto-donate message", force ourselves into the commander seat!
            // This also steals all the money from all the other players.
            if (IsCommander == true && message.sidDonateTo != client.GetShip().GetObjectID())
            {
                AllegianceInterop.FMD_CS_SET_TEAM_LEADER setTeamLeader = new AllegianceInterop.FMD_CS_SET_TEAM_LEADER(client.GetSide().GetObjectID(), client.GetShip().GetObjectID());
                client.SendMessageServer(setTeamLeader);
            }

            if (IsGameController == true && message.sidDonateTo != client.GetShip().GetObjectID())
            {
                AllegianceInterop.FMD_CS_SET_MISSION_OWNER setMissionOwner = new AllegianceInterop.FMD_CS_SET_MISSION_OWNER(client.GetSide().GetObjectID(), client.GetShip().GetObjectID());
                client.SendMessageServer(setMissionOwner);
            }
        }
Пример #2
0
        private void MessageReceiver_FMD_S_JOIN_SIDE(ClientConnection client, AllegianceInterop.FMD_S_JOIN_SIDE message)
        {
            AllegianceInterop.FMD_S_PLAYERINFO playerInfo;
            if (_shipID == message.shipID)
            {
                Log($"Player joined side {message.sideID}");

                //playerInfo.iSide = message.sideID;

                if (message.sideID != SideIndex)
                {
                    AllegianceInterop.FMD_C_POSITIONREQ positionRequest = new AllegianceInterop.FMD_C_POSITIONREQ(SideIndex);
                    client.SendMessageServer(positionRequest);
                }
                else
                {
                    if (IsCommander == true)
                    {
                        AllegianceInterop.FMD_CS_SET_TEAM_LEADER setTeamLeader = new AllegianceInterop.FMD_CS_SET_TEAM_LEADER(message.sideID, message.shipID);
                        client.SendMessageServer(setTeamLeader);
                    }

                    if (IsGameController == true)
                    {
                        AllegianceInterop.FMD_CS_SET_MISSION_OWNER setMissionOwner = new AllegianceInterop.FMD_CS_SET_MISSION_OWNER(message.sideID, message.shipID);
                        client.SendMessageServer(setMissionOwner);
                    }
                }
            }

            //if (_playerInfoByShipID.ContainsKey(message.shipID) == true)
            //{
            //    // If we receive an update for our player, and our player is the game controller and was not already on the team they are joining, then reset the game parameters.
            //    //if (_isGameController == true && _playerInfoByShipID[message.shipID].CharacterName == _playerName && _playerInfoByShipID[message.shipID].iSide != message.sideID && message.sideID >= 0)
            //    //    ResetGameParameters(client);

            //    _playerInfoByShipID[message.shipID].iSide = message.sideID;
            //}
        }
Пример #3
0
        // When a bot comm is made team leader, then it should set it's team name and faction.
        private void MessageReceiver_FMD_CS_SET_TEAM_LEADER(AllegianceInterop.ClientConnection client, AllegianceInterop.FMD_CS_SET_TEAM_LEADER message)
        {
            if (message.shipID <= 0)
            {
                return;
            }

            AllegianceInterop.FMD_S_PLAYERINFO playerInfo;
            if (message.shipID == _shipID)
            {
                Log($"This player is now the team leader of side index: {message.sideID}, _hasSetTeamAndCiv: {_hasSetTeamAndCiv}");

                if (_hasSetTeamAndCiv == false)
                {
                    int noSquad = -1;

                    string[] teamNames = { "Yellow Pigs", "Blue Pigs" };
                    AllegianceInterop.FMD_CS_SET_TEAM_INFO teamInfo = new AllegianceInterop.FMD_CS_SET_TEAM_INFO(noSquad, SideIndex, teamNames[SideIndex]);
                    client.SendMessageServer(teamInfo);


                    var enumValues = Enum.GetValues(typeof(Civilization));

                    _targetCivID = (short)enumValues.GetValue(_random.Next(0, enumValues.Length));

                    AllegianceInterop.FMD_CS_CHANGE_TEAM_CIV teamCiv = new AllegianceInterop.FMD_CS_CHANGE_TEAM_CIV(SideIndex, _targetCivID, false);
                    client.SendMessageServer(teamCiv);

                    AllegianceInterop.FMD_CS_FORCE_TEAM_READY forceReady = new AllegianceInterop.FMD_CS_FORCE_TEAM_READY(SideIndex, true);
                    client.SendMessageServer(forceReady);

                    _hasSetTeamAndCiv = true;

                    //_isCurrentCommander = true;
                }
            }
            //else if (message.sideID == SideIndex) // Someone else was made the leader of our side. This is an outrage!
            //{
            //    _isCurrentCommander = false;
            //}
        }