Ejemplo n.º 1
0
        private XElement GetLivePlayerListPlayerElement(PlayerListEntry playerEntry, double currentY, byte rowIndex, IList <LivePlayerListRowAction?> actions)
        {
            const byte livePlayerAreaID = (byte)Area.LivePlayersArea;

            return(XElement.Parse
                   (
                       FormatMessage
                       (
                           LivePlayerSettings.EntryTemplate,
                           "Y", currentY.ToString(CultureInfo.InvariantCulture),
                           "Position", playerEntry.Position.ToString(CultureInfo.InvariantCulture),
                           "Nickname", SecurityElement.Escape(playerEntry.Nickname ?? "[" + playerEntry.Login + "]"),
                           "Login", SecurityElement.Escape(playerEntry.Login),

                           "IgnoreText", actions[1] == LivePlayerListRowAction.IgnorePlayer ? LivePlayerSettings.IgnoreText : LivePlayerSettings.UnIgnoreText,
                           "BanText", actions[3] == LivePlayerListRowAction.BanPlayer ? LivePlayerSettings.BanText : LivePlayerSettings.UnBanText,
                           "BlackListText", actions[4] == LivePlayerListRowAction.BlackListPlayer ? LivePlayerSettings.AddToBlackListText : LivePlayerSettings.RemoveFromBlackListText,
                           "GuestText", actions[5] == LivePlayerListRowAction.AddGuest ? LivePlayerSettings.AddGuestText : LivePlayerSettings.RemoveGuestText,
                           "SpectatorText", actions[6] == LivePlayerListRowAction.ForceSpectator ? LivePlayerSettings.ForceSpectatorText : LivePlayerSettings.SpectatorText,

                           "WarnAction", TMAction.CalculateActionID(ID, livePlayerAreaID, rowIndex, (byte)actions[0]).ToString(CultureInfo.InvariantCulture),
                           "IgnoreAction", TMAction.CalculateActionID(ID, livePlayerAreaID, rowIndex, (byte)actions[1]).ToString(CultureInfo.InvariantCulture),
                           "KickAction", TMAction.CalculateActionID(ID, livePlayerAreaID, rowIndex, (byte)actions[2]).ToString(CultureInfo.InvariantCulture),
                           "BanAction", TMAction.CalculateActionID(ID, livePlayerAreaID, rowIndex, (byte)actions[3]).ToString(CultureInfo.InvariantCulture),
                           "BlackListAction", TMAction.CalculateActionID(ID, livePlayerAreaID, rowIndex, (byte)actions[4]).ToString(CultureInfo.InvariantCulture),
                           "GuestAction", TMAction.CalculateActionID(ID, livePlayerAreaID, rowIndex, (byte)actions[5]).ToString(CultureInfo.InvariantCulture),
                           "SpectatorAction", actions[6] == null ? "-" : TMAction.CalculateActionID(ID, livePlayerAreaID, rowIndex, (byte)actions[6]).ToString(CultureInfo.InvariantCulture)
                       )
                   ));
        }
Ejemplo n.º 2
0
        public string[] GetReplaceParameters(params KeyValuePair <string, byte>[] actionNameValuePairs)
        {
            List <string> commands = new List <string>();

            commands.Add("CloseActionID");
            commands.Add(CloseActionID.ToString(CultureInfo.InvariantCulture));

            commands.Add("FirstPageActionID");
            commands.Add(FirstPageActionID.ToString(CultureInfo.InvariantCulture));

            commands.Add("PrevPageActionID");
            commands.Add(PrevPageActionID.ToString(CultureInfo.InvariantCulture));

            commands.Add("NextPageActionID");
            commands.Add(NextPageActionID.ToString(CultureInfo.InvariantCulture));

            commands.Add("LastPageActionID");
            commands.Add(LastPageActionID.ToString(CultureInfo.InvariantCulture));

            if (actionNameValuePairs != null)
            {
                foreach (KeyValuePair <string, byte> nameValuePair in actionNameValuePairs)
                {
                    commands.Add(nameValuePair.Key);
                    commands.Add(TMAction.CalculateActionID(PluginID, AreaID, nameValuePair.Value).ToString(CultureInfo.InvariantCulture));
                }
            }

            return(commands.ToArray());
        }
Ejemplo n.º 3
0
        private string GetOwnVoteManiaLinkPageContent(double?voteValue)
        {
            if (!voteValue.HasValue)
            {
                voteValue = -1;
            }

            List <string> replaceValues = new List <string> {
                "ManiaLinkID", _ownVoteRatingManiaLinkPageID
            };

            for (int i = 0; i < 9; i++)
            {
                replaceValues.Add(i.ToString());
                replaceValues.Add(i <= voteValue ? Settings.ActiveVoteStyle : Settings.InactiveVoteStyle);
            }

            const byte areaID = (byte)RatingArea.MainArea;

            for (int i = 0; i < 9; i++)
            {
                replaceValues.Add("A" + i);
                replaceValues.Add(TMAction.CalculateActionID(ID, areaID, Convert.ToByte(i + 1)).ToString());
            }

            return(ReplaceMessagePlaceHolders(Settings.OwnVoteTemplate, replaceValues.ToArray()));
        }
Ejemplo n.º 4
0
        public PagedDialogActions(ushort pluginID, byte areaID, byte closeAction, byte firstPageAction, byte prevPageAction, byte nextPageAction, byte lastPageAction)
        {
            PluginID = pluginID;
            AreaID   = areaID;

            CloseActionID     = TMAction.CalculateActionID(pluginID, areaID, closeAction);
            FirstPageActionID = TMAction.CalculateActionID(pluginID, areaID, firstPageAction);
            PrevPageActionID  = TMAction.CalculateActionID(pluginID, areaID, prevPageAction);
            NextPageActionID  = TMAction.CalculateActionID(pluginID, areaID, nextPageAction);
            LastPageActionID  = TMAction.CalculateActionID(pluginID, areaID, lastPageAction);
        }
Ejemplo n.º 5
0
 private XElement GetBanListPlayerElement(PlayerListEntry playerEntry, double currentY, byte rowIndex)
 {
     return(XElement.Parse
            (
                FormatMessage
                (
                    BanListSettings.EntryTemplate,
                    "Y", currentY.ToString(CultureInfo.InvariantCulture),
                    "Position", playerEntry.Position.ToString(CultureInfo.InvariantCulture),
                    "Nickname", SecurityElement.Escape(playerEntry.Nickname ?? "[" + playerEntry.Login + "]"),
                    "Login", SecurityElement.Escape(playerEntry.Login),
                    "RemoveActionID", TMAction.CalculateActionID(ID, (byte)Area.BanListArea, rowIndex, (byte)BanListRowAction.RemovePlayer).ToString(CultureInfo.InvariantCulture)
                )
            ));
 }
Ejemplo n.º 6
0
        private string GetAdminPlayerManiaLinkPage()
        {
            string result = ReplaceMessagePlaceHolders
                            (
                UITemplates.PlayerTemplate,
                "ManiaLinkID", PLAYER_PANEL_ID,
                MainAreaAction.RestartTrackImmediately.ToString(), TMAction.CalculateActionID(ID, (int)Area.MainArea, (int)MainAreaAction.RestartTrackImmediately).ToString(),
                MainAreaAction.KickSpectators.ToString(), TMAction.CalculateActionID(ID, (int)Area.MainArea, (int)MainAreaAction.KickSpectators).ToString(),
                MainAreaAction.SwitchToNextTrack.ToString(), TMAction.CalculateActionID(ID, (int)Area.MainArea, (int)MainAreaAction.SwitchToNextTrack).ToString(),
                MainAreaAction.ShowLivePlayerList.ToString(), TMAction.CalculateActionID(ID, (int)Area.MainArea, (int)MainAreaAction.ShowLivePlayerList).ToString(),
                MainAreaAction.ShowGuestList.ToString(), TMAction.CalculateActionID(ID, (int)Area.MainArea, (int)MainAreaAction.ShowGuestList).ToString(),
                MainAreaAction.ShowIgnoreList.ToString(), TMAction.CalculateActionID(ID, (int)Area.MainArea, (int)MainAreaAction.ShowIgnoreList).ToString(),
                MainAreaAction.ShowBanList.ToString(), TMAction.CalculateActionID(ID, (int)Area.MainArea, (int)MainAreaAction.ShowBanList).ToString(),
                MainAreaAction.ShowBlackList.ToString(), TMAction.CalculateActionID(ID, (int)Area.MainArea, (int)MainAreaAction.ShowBlackList).ToString(),
                MainAreaAction.KickMySpectators.ToString(), TMAction.CalculateActionID(ID, (int)Area.MainArea, (int)MainAreaAction.KickMySpectators).ToString()
                            );

            return(result);
        }