Beispiel #1
0
        private string player_getRank(BRPlayer racer)
        {
            string[] m_Places = new string[] { "st", "nd", "rd", "th" };
            int      rIndex   = m_RacerRecords.IndexOf(racer);

            return((rIndex + 1).ToString() + m_Places[rIndex > 3?3:rIndex]);
        }
Beispiel #2
0
        //----------------------------------------------------------------------//
        //                             Event                                    //
        //----------------------------------------------------------------------//
        public void Event_PlayerPosition(SSPlayer ssp)
        {
            if (this.m_Status != RaceState.InProgress)
            {
                if (m_Timer.Enabled && this.m_TimerCountdown < 10 && this.player_InRegion(ssp.Position, this.m_Lobby.BaseDimension))
                {
                    string warpto     = "|warpto " + this.m_CurrentBase.AlphaStartX + " " + this.m_CurrentBase.AlphaStartY;
                    string prepPlayer = "|prize fullcharge|prize -engineshutdown";

                    psyGame.Send(msg.pm(ssp.PlayerName, "?" + warpto + prepPlayer));
                }
                return;
            }

            if (this.player_InRegion(ssp.Position, this.m_Lobby.BaseDimension))
            {
                this.race_PlayerLeaving(ssp);
            }
            else if (this.player_InRegion(ssp.Position, this.m_CurrentBase.BravoSafe, 10) && this.m_Racers.Contains(ssp.PlayerName))
            {
                if (this.m_RacerRecords == null)
                {
                    this.m_RacerRecords = new List <BRPlayer>();
                }

                // Store player info
                BRPlayer racer = new BRPlayer();
                racer.PlayerName = ssp.PlayerName;
                racer.Ship       = ssp.Ship;
                racer.Time       = DateTime.Now - this.m_StartTime;
                this.m_RacerRecords.Add(racer);

                psyGame.Send(msg.pm(ssp.PlayerName, "?|prize warp|a " + ("Congratulations you placed: " + this.player_getRank(racer) + "- Time " + this.getFormattedTime(racer.Time)).PadRight(57)));

                // Remove him from race list
                this.m_Racers.Remove(ssp.PlayerName);

                if (this.m_Racers.Count <= 0)
                {
                    race_EndRace();
                }
            }
        }