Beispiel #1
0
        // Gets the player information for the specified runtime player instance.
        public Player GetPlayer(OpenRA.Player runtimePlayer)
        {
            Player player;

            playersByRuntime.TryGetValue(runtimePlayer, out player);

            return(player);
        }
Beispiel #2
0
        public void PickBit(OpenRA.Player player)
        {
            if (!bitPickers.ContainsKey(player))
            {
                bitPickers.Add(player, 0);
            }

            bitPickers[player]++;
        }
Beispiel #3
0
        /// <summary>Adds the player information at start-up.</summary>
        public void AddPlayer(OpenRA.Player runtimePlayer, Session lobbyInfo)
        {
            if (runtimePlayer == null)
            {
                throw new ArgumentNullException(nameof(runtimePlayer));
            }

            if (lobbyInfo == null)
            {
                throw new ArgumentNullException(nameof(lobbyInfo));
            }

            // We don't care about spectators and map players
            if (runtimePlayer.NonCombatant || !runtimePlayer.Playable)
            {
                return;
            }

            // Find the lobby client that created the runtime player
            var client = lobbyInfo.ClientWithIndex(runtimePlayer.ClientIndex);

            if (client == null)
            {
                return;
            }

            var player = new Player
            {
                ClientIndex        = runtimePlayer.ClientIndex,
                Name               = runtimePlayer.PlayerName,
                IsHuman            = !runtimePlayer.IsBot,
                IsBot              = runtimePlayer.IsBot,
                FactionName        = runtimePlayer.Faction.Name,
                FactionId          = runtimePlayer.Faction.InternalName,
                DisplayFactionName = runtimePlayer.DisplayFaction.Name,
                DisplayFactionId   = runtimePlayer.DisplayFaction.InternalName,
                Color              = runtimePlayer.Color,
                Team               = client.Team,
                Handicap           = client.Handicap,
                SpawnPoint         = runtimePlayer.SpawnPoint,
                IsRandomFaction    = runtimePlayer.Faction.InternalName != client.Faction,
                IsRandomSpawnPoint = runtimePlayer.DisplaySpawnPoint == 0,
                Fingerprint        = client.Fingerprint
            };

            playersByRuntime.Add(runtimePlayer, player);
            Players.Add(player);
        }
Beispiel #4
0
        // Adds the player information at start-up.
        public void AddPlayer(OpenRA.Player runtimePlayer, Session lobbyInfo)
        {
            if (runtimePlayer == null)
            {
                throw new ArgumentNullException("runtimePlayer");
            }

            if (lobbyInfo == null)
            {
                throw new ArgumentNullException("lobbyInfo");
            }

            // We don't care about spectators and map players
            if (runtimePlayer.NonCombatant || !runtimePlayer.Playable)
            {
                return;
            }

            // Find the lobby client that created the runtime player
            var client = lobbyInfo.ClientWithIndex(runtimePlayer.ClientIndex);

            if (client == null)
            {
                return;
            }

            var player = new Player
            {
                ClientIndex        = runtimePlayer.ClientIndex,
                Name               = runtimePlayer.PlayerName,
                IsHuman            = !runtimePlayer.IsBot,
                IsBot              = runtimePlayer.IsBot,
                FactionName        = runtimePlayer.Country.Name,
                FactionId          = runtimePlayer.Country.Race,
                Color              = runtimePlayer.Color,
                Team               = client.Team,
                SpawnPoint         = runtimePlayer.SpawnPoint,
                IsRandomFaction    = runtimePlayer.Country.Race != client.Country,
                IsRandomSpawnPoint = runtimePlayer.SpawnPoint != client.SpawnPoint
            };

            playersByRuntime.Add(runtimePlayer, player);
            Players.Add(player);
        }