Esempio n. 1
0
        //----------------------------------------------------------------------//
        //                         Commands                                     //
        //----------------------------------------------------------------------//
        /// <summary>
        /// <para>All commands used for baserace send through here.</para>
        /// <para>Syntax: !baserace command    Example !baserace settings  or  .baserace start</para>
        /// <para>If you want to make compatible commands, register them in devastation main</para>
        /// <para>and change the command to make it compatible with !baseduel command</para>
        /// <para>then send it here. BaseRace.Commands(e);</para>
        /// </summary>
        /// <param name="p">Deva Player</param>
        /// <param name="e">Command sent</param>
        /// <returns></returns>
        public void Commands(ChatEvent e)
        {
            if (m_BlockedList.Contains(e.PlayerName))
            {
                return;
            }

            // store command here if all checks out
            string command;

            // making sure command is formatted properly
            if (isCommand(e, out command))
            {
                SSPlayer p = m_Players.GetPlayer(e.PlayerName);

                switch (command)
                {
                case ".baserace":
                    e.Message = "!help baserace";
                    psyGame.CoreSend(e);
                    return;

                case "start":
                    cmd_RaceFreq(e);
                    return;

                case "commands":
                    e.Message = "!help baserace commands";
                    psyGame.CoreSend(e);
                    return;

                case "info":
                    psyGame.Send(msg.arena("show info message"));
                    return;

                case "left":
                    cmd_left(e);
                    return;

                case "toggle":
                    if (player_isMod(e, ModLevels.Mod))
                    {
                        cmd_toggle(e.PlayerName);
                    }
                    return;
                }
            }
        }
Esempio n. 2
0
        //----------------------------------------------------------------------//
        //                       Commands                                       //
        //----------------------------------------------------------------------//
        public void command_PlayGame(SSPlayer p, ChatEvent e)
        {
            if (!this.allowedCommandUsage(p))
            {
                return;
            }

            if (e.Message.Contains(' '))
            {
                string[] data = e.Message.Split(' ');
                int      num;

                if (int.TryParse(data[1], out num) || int.TryParse(data[1], out num))
                {
                    if (!this.m_BaseManager.CheckBaseSafe(num))
                    {
                        psyGame.Send(msg.pm(p.PlayerName, "Base[ " + num + " ] is an invalid base. It is either too close to another base that is in use or the base number is too high. Please select a base from 1 to " + m_BaseManager.Bases.Count() + "."));
                        return;
                    }

                    this.loadBase(num);
                    e.Message = ".race";
                    psyGame.CoreSend(e);
                }
                return;
            }

            if (!this.m_Timer.Enabled)
            {
                timer_startRaceTimer();
            }
            if (this.m_Status == RaceState.InProgress)
            {
                psyGame.Send(msg.pm(p.PlayerName, "?|setfreq " + m_Freq + (p.Ship == ShipTypes.Spectator ? "|setship 1" : "|prize warp") + "|prize fullcharge|a A race is currently in progress. Please wait here. Once next race starts you will be inlcuded and warped."));
                return;
            }

            psyGame.Send(msg.pm(p.PlayerName, "?|setfreq " + m_Freq + (p.Ship == ShipTypes.Spectator ? "|setship 1" : "|prize warp") + "|prize fullcharge|a Please select the ship you wish to race in. A race will begin shortly."));
        }