示例#1
0
        private void HostPlugin_PlayerNewRecord(object sender, PlayerNewRecordEventArgs e)
        {
            RunCatchLog(() =>
            {
                if (!e.OldPosition.HasValue)
                {
                    if (Settings.ShowMessages)
                    {
                        string message = FormatMessage(Settings.FirstLocalRankMessage, "Nickname", StripTMColorsAndFormatting(e.Nickname), "Rank", e.NewPosition.ToString());
                        Context.RPCClient.Methods.SendNotice(message, e.Login, Convert.ToInt32(Settings.NoticeDelayInSeconds));
                        Context.RPCClient.Methods.ChatSendServerMessage(message);
                    }
                }
                else if (e.NewPosition > e.OldPosition)
                {
                    if (Settings.ShowMessages)
                    {
                        string message = FormatMessage(Settings.NewLocalRankMessage, "Nickname", StripTMColorsAndFormatting(e.Nickname), "OldRank", e.OldPosition.ToString(), "NewRank", e.NewPosition.ToString());
                        Context.RPCClient.Methods.SendNotice(message, e.Login, Convert.ToInt32(Settings.NoticeDelayInSeconds));
                        Context.RPCClient.Methods.ChatSendServerMessage(message);
                    }
                }
                else
                {
                    if (Settings.ShowMessages)
                    {
                        string message = FormatMessage(Settings.ImprovedLocalRankMessage, "Nickname", StripTMColorsAndFormatting(e.Nickname), "Rank", e.NewPosition.ToString());
                        Context.RPCClient.Methods.SendNotice(message, e.Login, Convert.ToInt32(Settings.NoticeDelayInSeconds));
                        Context.RPCClient.Methods.ChatSendServerMessage(message);
                    }
                }

                if (Settings.ShowPBUserInterface)
                {
                    SendPBManiaLinkPage(e.Login, Convert.ToUInt32(e.TimeOrScore));
                }

                if (LocalBestTimeOrScore == null || e.TimeOrScore < LocalBestTimeOrScore)
                {
                    LocalBestTimeOrScore = Convert.ToUInt32(e.TimeOrScore);

                    if (Settings.ShowLocalRecordUserInterface)
                    {
                        UpdateLocalRecordTimer.Enqueue(SendLocalRecordManiaLinkPageToAll, null);
                    }
                    //SendLocalRecordManiaLinkPageToAll();
                }

                if (Settings.ShowLocalRecordUserInterface)
                {
                    UpdateListTimer.Enqueue(SendRecordListToAllPlayers, HostPlugin.LocalRecords);
                }
                //SendRecordListToAllPlayers(HostPlugin.LocalRecords);
            }, "Error in HostPlugin_PlayerNewRecord Method.", true);
        }
示例#2
0
        private void HostPlugin_RankingsChanged(object sender, EventArgs <DedimaniaRanking[]> e)
        {
            RunCatchLog(() =>
            {
                if (Settings.ShowRecordUI)
                {
                    UpdateRecordTimer.Enqueue(SendDedimaniaRecordManiaLinkPageToAll, null);
                }
                //SendDedimaniaRecordManiaLinkPageToAll();

                if (Settings.ShowRecordListUI)
                {
                    UpdateListTimer.Enqueue(SendRecordListToAllPlayers, new List <DedimaniaRanking>(e.Value).ToArray());
                }
                //SendRecordListToAllPlayers(e.Value);
            }, "Error in HostPlugin_RankingsChanged Method.", false);
        }