Beispiel #1
0
        private void baserace_savePLayer(BRPlayer racer, Base Base)
        {
            SSPlayer ssp = this.m_Players.PlayerList.Find(item => item.PlayerName == racer.PlayerName);

            if (ssp == null || !(ssp.SubspaceId > 0))
            {
                psyGame.SafeSend(msg.chan(1, "SSPlayer not found - Filedatabase - baserace_savePLayer."));
                return;
            }

            // Create Deva player profile folder if it isnt created
            System.IO.Directory.CreateDirectory(this.m_HomeDir + "Players" + Path.DirectorySeparatorChar + ssp.SubspaceId.ToString());

            // Check deva profile - create profile if not created
            if (!this.playerHasDevaProfile(ssp))
            {
                this.createDevaPlayerProfile(ssp);
            }

            string racerDir = this.m_HomeDir + "BaseRace" + Path.DirectorySeparatorChar + "Racers" + Path.DirectorySeparatorChar + ssp.SubspaceId.ToString();

            // Create racer folder if it isnt created
            System.IO.Directory.CreateDirectory(racerDir);

            // Check Race profile - create profile if not created
            if (!this.playerHasRaceProfile(ssp, racerDir))
            {
                this.createRaceProfile(ssp, racerDir);
            }

            // Store race time for player
            using (StreamWriter w = File.AppendText(racerDir + Path.DirectorySeparatorChar + "base" + Base.BaseID.ToString().PadLeft(3, '0') + ".times"))
            {
                w.WriteLine("Player:" + ssp.PlayerName);
                w.WriteLine("Ship:" + racer.Ship);
                w.WriteLine("Time:" + racer.Time);
                w.WriteLine("Date:" + DateTime.Now.ToShortDateString());
            }

            string baseDir = this.m_HomeDir + "BaseRace" + Path.DirectorySeparatorChar + "Bases" + Path.DirectorySeparatorChar;

            using (StreamWriter w = File.AppendText(baseDir + "base" + Base.BaseID.ToString().PadLeft(3, '0') + ".times"))
            {
                w.WriteLine("Player:" + ssp.PlayerName);
                w.WriteLine("Ship:" + racer.Ship);
                w.WriteLine("Time:" + racer.Time);
                w.WriteLine("Date:" + DateTime.Now.ToShortDateString());
            }

            //need to store match if player count > 1
        }
Beispiel #2
0
        // send spam to devastation chat and zone
        private void command_SpamZone(ChatEvent e)
        {
            if (e.ModLevel != ModLevels.Sysop)
            {
                if ((DateTime.Now - m_SpamZoneTimeStamp).TotalMinutes < m_SpamZoneTimeLimit)
                {
                    psyGame.Send(msg.pm(e.PlayerName, "This command can only be used every " + m_SpamZoneTimeLimit + " minutes. You have " + Math.Floor(m_SpamZoneTimeLimit - (DateTime.Now - m_SpamZoneTimeStamp).TotalMinutes) + "m:" + Math.Floor((double)60 - (DateTime.Now - m_SpamZoneTimeStamp).Seconds).ToString().PadLeft(2, '0') + "s before it can use it again."));
                    return;
                }
            }

            // update timestamp
            m_SpamZoneTimeStamp = DateTime.Now;

            // Send message out - maybe add option to what gets sent out - option to change
            string message = "A BaseDuel game is about to begin. Come to Devastation and join the battle!   Arena:[ ?go " + m_ArenaName + " ]     -" + e.PlayerName;

            psyGame.Send(msg.zone(message));
            psyGame.SafeSend(msg.chan(2, message));
        }