Beispiel #1
0
        //----------------------------------------------------------------------//
        //                     Game Functions                                   //
        //----------------------------------------------------------------------//
        private void BaseDuel_Load(string PlayerName)
        {
            // Create the list
            m_Games = new List <Classes.BaseGame>();

            // Config main bd game
            Classes.BaseGame pubGame = new Classes.BaseGame(msg, psyGame, m_Players, m_BaseManager, m_MultiGame, m_Games.Count + 1);
            pubGame.setFreqs(0, 1);
            pubGame.setSpamMeList(this.m_SpamMeList);
            pubGame.setArchive(m_ArchivedGames);
            m_Games.Add(pubGame);

            if (this.m_MultiGame)
            {
                Classes.BaseGame pubGame2 = new Classes.BaseGame(msg, psyGame, m_Players, m_BaseManager, m_MultiGame, m_Games.Count + 1);
                pubGame2.setFreqs(10, 11);
                pubGame2.setSpamMeList(this.m_SpamMeList);
                pubGame2.setArchive(m_ArchivedGames);
                m_Games.Add(pubGame2);
            }

            // load and configure stuff to start baseduel module
            psyGame.Send(msg.arena("[ BaseDuel ] Module Loaded - " + PlayerName));
            psyGame.Send(msg.arena("[ BaseDuel ] MultiGame Toggle: [ " + (this.m_MultiGame?"On":"Off") + " ]"));
        }
Beispiel #2
0
        //----------------------------------------------------------------------//
        //                       Race Game Function                             //
        //----------------------------------------------------------------------//
        private void race_EndRace()
        {
            if (this.m_Timer.Enabled)
            {
                this.m_Timer.Stop();
            }

            if (this.m_RacerRecords != null && this.m_RacerRecords.Count > 0)
            {
                psyGame.Send(msg.team_pm(this.m_Freq, "?a Saving Race Scores . . . . ".PadRight(60)));
                this.m_FakeDB.BaseRace_SavePlayerTimes(this.m_RacerRecords, this.m_CurrentBase);
                psyGame.Send(msg.team_pm(this.m_Freq, "?a Scores Saved. ".PadRight(60)));

                if (this.m_RacerRecords.Count > 1)
                {
                    psyGame.Send(msg.team_pm(this.m_Freq, "+---------------------------------------------------------------------+"));
                    psyGame.Send(msg.team_pm(this.m_Freq, "|   BaseID [ " + this.m_CurrentBase.BaseID.ToString().PadLeft(2, '0') + " ]                                                     |"));
                    psyGame.Send(msg.team_pm(this.m_Freq, "+---------------------------------------------------------------------+"));
                    for (int i = 0; i < this.m_RacerRecords.Count; i++)
                    {
                        psyGame.Send(msg.team_pm(this.m_Freq, "| " + (i + 1).ToString().PadLeft(2, '0') + ". " +
                                                 m_RacerRecords[i].PlayerName.PadRight(22) + this.getFormattedTime(m_RacerRecords[i].Time).PadRight(27) +
                                                 m_RacerRecords[i].Ship.ToString().PadRight(15) + "|"));
                    }
                    psyGame.Send(msg.team_pm(this.m_Freq, "+---------------------------------------------------------------------+"));
                    psyGame.Send(msg.team_pm(this.m_Freq, "|   To get all times for this base type :             .br baseinfo " + this.m_CurrentBase.BaseID.ToString().PadLeft(2, '0') + " |"));
                    psyGame.Send(msg.team_pm(this.m_Freq, "+---------------------------------------------------------------------+"));
                }
                else
                {
                    List <BRPlayer> baseInfo = this.m_FakeDB.GetBaseRecords(m_CurrentBase.BaseID);

                    psyGame.Send(msg.team_pm(this.m_Freq, "+---------------------------------------------------------------------+"));
                    psyGame.Send(msg.team_pm(this.m_Freq, "|              Base ID Number " + this.m_CurrentBase.BaseID.ToString().PadLeft(2, '0') + "                 Top Times            |"));
                    psyGame.Send(msg.team_pm(this.m_Freq, "+---------------------------------------------------------------------+"));
                    psyGame.Send(msg.team_pm(this.m_Freq, "|   Player".PadRight(25) + "Time".PadRight(22) + "Ship".PadRight(13) + "Date".PadRight(10) + "|"));
                    psyGame.Send(msg.team_pm(this.m_Freq, "+----------------------^---------------------^------------^-----------+"));
                    int i = 1;
                    foreach (BRPlayer b in baseInfo)
                    {
                        psyGame.Send(msg.team_pm(this.m_Freq, (i++).ToString().PadLeft(2, '0') + ". " + b.PlayerName.PadRight(20) + this.getFormattedTime(b.Time).ToString().PadRight(22) + b.Ship.ToString().PadRight(13) + b.Date.ToShortDateString()));
                    }
                    psyGame.Send(msg.team_pm(this.m_Freq, "+---------------------------------------------------------------------+"));
                    psyGame.Send(msg.team_pm(this.m_Freq, "| To race in the next base,            type:  !race   or   .race      |"));
                    psyGame.Send(msg.team_pm(this.m_Freq, "+---------------------------------------------------------------------+"));
                }
            }
            else
            {
                psyGame.Send(msg.arena("Race cancelled."));
            }
            this.race_Reset();
        }
Beispiel #3
0
        public void doConnect(ChatEvent e)
        {
            if (e.ModLevel < ModLevels.Sysop)
            {
                return;
            }
            try
            {
                connection.Open();
                Game(msg.arena("Connected Successfully."));
                return;
            }
            catch (MySqlException ex)
            {
                //When handling errors, you can your application's response based
                //on the error number.
                //The two most common error numbers when connecting are as follows:
                //0: Cannot connect to server.
                //1045: Invalid user name and/or password.
                switch (ex.Number)
                {
                case 0:
                    Game(msg.arena("Cannot connect to server.  Contact administrator"));
                    return;

                case 1045:
                    Game(msg.arena("Invalid username/password, please try again"));
                    return;

                default:
                    Game(msg.arena("Error: Num[" + ex.Number + "]"));
                    return;
                }
            }
        }
Beispiel #4
0
        //----------------------------------------------------------------------//
        //                         Commands                                     //
        //----------------------------------------------------------------------//
        public void doToggleDebug(ChatEvent e)
        {
            if (!m_Initialized)
            {
                return;
            }

            if (!IsMod(e, ModLevels.Mod))
            {
                return;
            }

            msg.DebugMode = !msg.DebugMode;

            Game(msg.arena("[ Deva Main ] Debug mode has been toggled " + (msg.DebugMode?"On":"Off") + " by staff - " + e.PlayerName));
        }
Beispiel #5
0
        private void doTest(SSPlayer p, ChatEvent e)
        {
            int num;

            if (e.Message.Contains(' ') && e.Message.Split(' ').Count() == 3 && int.TryParse(e.Message.Split(' ')[2], out num))
            {
                if (num == 666)
                {
                    m_GFX.RefreshDisplay_Player(p);
                    return;
                }

                m_GFX.ScoreChange_Public("TestBoard", num);
                return;
            }

            psyGame.Send(msg.arena("Parse fail. [ " + e.Message.Split(' ')[2] + " ]"));
        }
Beispiel #6
0
        public void DoHelpCommand(ChatEvent c)
        {
            string cmd = c.Message.Trim().ToLower().Remove(0, 1);

            if (cmd == "help" || cmd == "halp")
            {
                PrintHelpMessage(c.PlayerName, "overview");
                return;
            }
            else if (c.Message.Contains(" ") || c.Message.Length > 5)
            {
                string command = c.Message.Remove(0, 5).Trim().ToLower();
                PrintHelpMessage(c.PlayerName, command);
                return;
            }

            // Code shouldnt get here.
            Game(msg.arena("I wear a pink tutu with orange socks."));
        }
Beispiel #7
0
        //----------------------------------------------------------------------//
        //                       Commands                                       //
        //----------------------------------------------------------------------//
        public void command_GameStart(SSPlayer p)
        {
            if (this.m_Timer.Enabled || this.m_Status != Misc.BaseGameStatus.NotStarted)
            {
                psyGame.Send(msg.pm(p.PlayerName, "The game has already been started."));
                return;
            }

            // Get freq counts
            int aCount = this.m_Players.PlayerList.FindAll(item => item.Frequency == this.m_AlphaFreq && item.Ship != ShipTypes.Spectator).Count;
            int bCount = this.m_Players.PlayerList.FindAll(item => item.Frequency == this.m_BravoFreq && item.Ship != ShipTypes.Spectator).Count;

            if (aCount > 0 && bCount > 0)
            {
                this.freqDump(this.m_AlphaFreq, this.m_CurrentPoint.AlphaTeam(), true);
                this.freqDump(this.m_BravoFreq, this.m_CurrentPoint.BravoTeam(), false);

                psyGame.Send(msg.arena("[ BaseDuel ] A game will begin in " + this.m_StartGameDelay + " seconds. [ " + this.m_CurrentPoint.AlphaCount() + " vs " + this.m_CurrentPoint.BravoCount() + " ]" + (this.m_MultiOn ? "      - " + this.m_GameTag + " -" : ".")));
                psyGame.Send(msg.team_pm(this.m_AlphaFreq, "Welcome to Team: " + this.m_ATeamName + ". Good Luck!"));
                psyGame.Send(msg.team_pm(this.m_BravoFreq, "Welcome to Team: " + this.m_BTeamName + ". Good Luck!"));

                this.timer_Setup(Misc.TimerType.GameStart);
                return;
            }

            // Need one player on opfor
            psyGame.Send(msg.pm(p.PlayerName, "You need to have at least 1 player on each team to start. Please find an opponent and have them join Freq= " + (aCount == 0 ? this.m_AlphaFreq : this.m_BravoFreq) + "."));
        }
Beispiel #8
0
        public void ConnectIRC(ChatEvent c)
        {
            //Setup
            irc.Encoding             = System.Text.Encoding.UTF8;
            irc.SendDelay            = IRCSendDelay * 3;
            irc.AutoRetry            = true;
            irc.ActiveChannelSyncing = true;

            //Event Handlers
            irc.OnJoin          += new JoinEventHandler(irc_OnJoin);
            irc.OnError         += new Meebey.SmartIrc4net.ErrorEventHandler(irc_OnError);
            irc.OnConnected     += new EventHandler(irc_OnConnected);
            irc.OnRawMessage    += new IrcEventHandler(OnRawMessage);
            irc.OnDisconnecting += new EventHandler(OnDisco);
            irc.OnQuit          += new QuitEventHandler(OnQuit);
            irc.OnKick          += new KickEventHandler(irc_OnKick);
            irc.OnBan           += new BanEventHandler(irc_OnKick);
            irc.OnUnban         += new UnbanEventHandler(irc_OnKick);

            try
            {
                //Connect, log in
                irc.Connect(MyServer, MyPort);
                irc.Login(MyNick, MyDescription);
                Game(msg.arena("IRC Connected."));
                IRCJoinChan();

                m_IRCTimer.Interval = 250;
                m_IRCTimer.Start();
            }
            catch (Exception e)
            {
                Game(msg.arena("IRC Login: "******"Could not connect, exception:" + Environment.NewLine
                               + e.Message + Environment.NewLine
                               + e.ToString()));
            }
        }
Beispiel #9
0
        //----------------------------------------------------------------------//
        //                     Game Functions                                   //
        //----------------------------------------------------------------------//
        public void GameOver(Boolean msgz)
        {
            if (msgz == true)
            {
                psyGame.Send(msg.arena("Game Over", SoundCodes.Hallellula));
                psyGame.Send(msg.arena("Type  [ !br start ]  to join again!"));
                //   }
            }

            if (m_RaceData.isThereReach() == true)
            {
                psyGame.Send(msg.arena("+------+--------------+-----------------+"));
                psyGame.Send(msg.arena("| Rank | Player       |     Time        |"));
                psyGame.Send(msg.arena("+------+--------------+-----------------+"));
                // getTopPlayers();
                for (int i = 0; i < 11; ++i)
                {
                    if (i >= 1 && i <= 10)
                    {
                        if (m_RaceData.top10[i] != "")
                        {
                            RaceData.Race racer = m_RaceData.getRacer(m_RaceData.top10[i]);
                            string        rankz = "" + racer.rank;
                            string        name  = racer.name;
                            string        time  = racer.ctime;
                            psyGame.Send(msg.arena(String.Format("| {0,-4} | {1,-12} | {2,15} |", rankz, name, time)));
                            //Game(msg.arena("| " + rankz.PadRight(4) + " | " + name.PadRight((getStringLen("+--------------+")-(name.Length+1))) + "|" + time.PadRight(getStringLen("+------+--------------+-----------------")) + "|"));
                        }
                    }
                }
                psyGame.Send(msg.arena("+------+--------------+-----------------+"));
            }
            this.loadNextBase();
            game_status = false;
            if (m_Timer.Enabled)
            {
                m_Timer.Stop();
            }
            second           = -1;
            m_RaceData.top10 = new string[11] {
                "", "", "", "", "", "", "", "", "", "", ""
            };
            rank = 0;
            m_RaceData.RaceItems.Clear();
        }