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); }
private void Callbacks_EndRace(object sender, EndRaceEventArgs e) { RunCatchLog(() => { UpdateListTimer.Clear(); UpdateLocalRecordTimer.Clear(); if (Settings.ShowPBUserInterface) { SendEmptyManiaLinkPage(_pbManiaLinkPageID); } if (Settings.ShowLocalRecordUserInterface) { SendEmptyManiaLinkPage(_localRecordManiaLinkPageID); } if (Settings.ShowLocalRecordListUserInterface && Settings.HideRecordListUIOnFinish) { SendEmptyManiaLinkPage(_localRecordListManiaLinkPageID); } }, "Error in Callbacks_EndRace Method.", true); }