Exemple #1
0
        /// <summary>
        /// Queries environment information from a player
        /// </summary>
        static public void environment(Player player, Player recipient, string payload, int bong)
        {               //Send him an environment packet!
            SC_Environment env = new SC_Environment();
            bool           limit;

            if (String.IsNullOrEmpty(payload))
            {
                limit = false;
            }
            else
            {
                limit = true;
            }

            env.bLimitLength = limit;

            recipient.setVar("envReq", player);
            recipient._client.sendReliable(env);
        }
Exemple #2
0
        /// <summary>
        /// Called when a new player is entering our arena
        /// </summary>
        public void newPlayer(Player player)
        {       ///////////////////////////////////////////////
            // Prepare the player state
            ///////////////////////////////////////////////

            //We're entering the arena..
            player._arena = this;

            RecallPlayerStats(player);
            player.resetVars();

            player._ipAddress = player._client._ipe.Address;

            //TODO: Check rules for whether player enters in spec
            //_server._zoneConfig.arena.startInSpectator
            player._bSpectator = true;
            player._team       = _teams["spec"];

            //Find his natural vehicle id and prepare the class
            Player.SkillItem baseSkill = player._skills.Values.FirstOrDefault(skill => skill.skill.DefaultVehicleId != -1);
            int     baseVehicleID      = (baseSkill == null) ? _server._zoneConfig.publicProfile.defaultVItemId : baseSkill.skill.DefaultVehicleId;
            Vehicle baseVehicle        = new Vehicle(_server._assets.getVehicleByID(baseVehicleID), this);

            baseVehicle._bBaseVehicle = true;
            baseVehicle._id           = player._id;
            baseVehicle._state        = player._state;  //Player and basevehicle share same state

            player._baseVehicle = baseVehicle;

            //Run the initial events
            if (_server.IsStandalone)
            {
                player.firstTimeEvents();
            }

            if (player.firstTimePlayer)
            {
                Logic_Assets.RunEvent(player, _server._zoneConfig.EventInfo.firstTimeSkillSetup);
                Logic_Assets.RunEvent(player, _server._zoneConfig.EventInfo.firstTimeInvSetup);
                if (player._bIngame)
                {
                    player.firstTimePlayer = false;
                }
            }

            //Create our new spam filter list
            player._msgTimeStamps = new List <DateTime>();

            ///////////////////////////////////////////////
            // Send the player state
            ///////////////////////////////////////////////
            //Make sure he's receiving ingame packets
            player._client.sendReliable(new SC_SetIngame());

            //Add him to our list of players. We want to do this now so he doesn't lose
            //info about anything happening until then.
            if (!_players.Contains(player))
            {
                _players.Add(player);
            }

            //Check his processes quick
            SC_Environment env = new SC_Environment();

            env.bLimitLength = false;
            player._client.sendReliable(env);

            //Lets check his level and set watchMod
            if (player.PermissionLevel >= Data.PlayerPermission.ArenaMod)
            {
                player._watchMod = true;
            }

            //Check if we can use him as a reliable player [check if mod]
            if (player.PermissionLevel >= Data.PlayerPermission.ArenaMod)
            {
                player.setVar("reliable", player);
            }

            //Send a security check for their client asset checksum
            SC_SecurityCheck cs = new SC_SecurityCheck();

            cs.key     = 1015;       //Key we are using
            cs.unknown = 0;          // Unknown, send as 0
            player._client.send(cs); //Send it

            //Define the player's self object
            Helpers.Object_Players(player, player);

            //Make sure the player is aware of every player in the arena
            List <Player> audience = Players.ToList();

            //Check first for stealthed mods
            //Note: this is for any other players joining while there is a stealthed mod
            foreach (Player p in audience)
            {
                //Check their levels with the players level
                if (p != player)
                {
                    if (!p.IsStealth)
                    {
                        Helpers.Object_Players(player, p);
                    }
                    if (p.IsStealth && player.PermissionLevel >= p.PermissionLevel)
                    {
                        Helpers.Object_Players(player, p);
                    }
                }
            }

            //Load the arena's item state
            Helpers.Object_Items(player, _items.Values);

            //Load the arena's various lio objects
            Helpers.Object_Flags(player, _flags.Values);
            Helpers.Object_LIOs(player, _switches.Values);

            //Load the vehicles in the arena
            if (_vehicles.Count > 0)
            {
                Helpers.Object_Vehicles(player, _vehicles);
            }

            //Load the ball state if any
            if (_balls.Count > 0)
            {
                Helpers.Object_Ball(player, _balls);
            }

            //Suspend his stats if it's a private arena
            if (_bIsPublic)
            {
                player.restoreStats();
                player.suspendCalled = false;
            }
            else if (!player.suspendCalled)
            {
                player.suspendStats();
                player.suspendCalled = true;
            }

            //Is this a private arena and are we the first one?
            if (!player._arena._name.StartsWith("Public", StringComparison.OrdinalIgnoreCase) && player._arena.TotalPlayerCount == 1)
            {
                //Give player required privileges
                player._arena._owner.Add(player._alias);
                if (player.PermissionLevel < Data.PlayerPermission.ArenaMod)
                {
                    player._permissionTemp = Data.PlayerPermission.ArenaMod;
                    player._watchMod       = true;
                }
            }

            //Are we zone silenced or arena silenced?
            if (!this._server._playerSilenced.ContainsKey(player._ipAddress))
            {   //Since we are not in the zone list, check the arena list
                if (!this._silencedPlayers.ContainsKey(player._alias))
                {
                    player._bSilenced = false;
                }
                else
                {
                    player._bSilenced = true;
                }
            }

            //Initialize the player's state
            Helpers.Player_StateInit(player,
                                     delegate()
            {
                //Check for stealthing/cloaking mods first
                //Note: this is for the stealthed person entering
                if (!player.IsStealth)
                {
                    //Make sure everyone is aware of him
                    Helpers.Object_Players(audience, player);
                }
                else
                {     //Check their level vs people in the room
                    foreach (Player person in audience)
                    {
                        //Their level is the same or greater, allow them to see him/her
                        if (person != player && person.PermissionLevel >= player.PermissionLevel)
                        {
                            Helpers.Object_Players(person, player);
                        }
                    }
                }

                //Consider him loaded!
                player.spec();
                player.setIngame();

                //Load the tickers
                Helpers.Arena_Message(player, _tickers.Values);

                //Load all the banners
                Helpers.Social_UpdateBanner(player);                        //Players banner
                Helpers.Social_ArenaBanners(player._arena.Players, player); //Inform arena of his banner
                Helpers.Social_ArenaBanners(player, this);                  //Get all banners in arena
                //Set able to receive banners
                player._bAllowBanner = true;

                //Trigger our event for player entering arena
                callsync("Player.EnterArena", false, player);

                //Temporary player message, remove this later. This is just here to get old accounts to update their information
                player.sendMessage(-3, "[Notice] Welcome to Infantry! To get support simply use the discord link located on the top right of the infantry launcher. Enjoy your stay!");

                //Mod notice
                if (player.PermissionLevelLocal >= Data.PlayerPermission.ArenaMod && !player._arena.IsPrivate)
                {
                    player.sendMessage(-3, "$[Mod Notice] To see a list of commands, type *help. To specifically get info on a command type *help <command name>");
                }
            }
                                     );
        }