Esempio n. 1
0
        public void Command_Admins(Client player)
        {
            Character charData = Account.GetPlayerData(player);

            if (charData == null)
            {
                return;
            }

            List <DialogColumn> dialogColumns = new List <DialogColumn>
            {
                new DialogColumn("ID", 15),
                new DialogColumn("Nick", 35),
                new DialogColumn("Ranga", 40)
            };

            List <DialogRow> dialogRows = new List <DialogRow>();

            foreach (KeyValuePair <int, Character> entry in Account.GetAllPlayers())
            {
                if (entry.Value.AdminLevel < 1 || !entry.Value.HasAdminDuty)
                {
                    continue;
                }

                RankInfo rankInfo = Library.GetAdminRankInfo(entry.Value.AdminLevel);

                dialogRows.Add(new DialogRow(null,
                                             new[]
                {
                    entry.Value.ServerId.ToString(),
                    Player.GetPlayerOocName(entry.Value),
                    $"<span style=\"color: #{rankInfo.Color}; font-weight: bold;\">{rankInfo.Name}</span>"
                }));
            }

            string[] dialogButtons = { "Zamknij" };

            if (dialogRows.Count == 0)
            {
                Ui.ShowInfo(player, "Nie ma żadnego administratora na służbie.");
                return;
            }


            Dialogs.Library.CreateDialog(player, DialogId.None, "Administratorzy online", dialogColumns, dialogRows,
                                         dialogButtons);
        }
Esempio n. 2
0
        public void Command_As(Client player, string args = "")
        {
            Character charData = Account.GetPlayerData(player);

            if (charData == null)
            {
                return;
            }

            if (charData.AdminLevel <= 0)
            {
                Ui.ShowError(player, "Nie posiadasz odpowiednich uprawnień do użycia tej komendy.");
                return;
            }


            string[] arguments = Command.GetCommandArguments(args);
            if (arguments.Length < 1)
            {
                Ui.ShowUsage(player, "/as [treść wiadomości]");
                return;
            }

            RankInfo rankInfo = Library.GetAdminRankInfo(charData.AdminLevel);

            string outputMessage =
                $"!{{#CC925F}}[AS] !{{#FFA490}}(( !{{#{rankInfo.Color}}}{rankInfo.Name} " +
                $"!{{#FFA490}}{Player.GetPlayerOocName(charData, true)}: " +
                $"{Command.UpperFirst(Command.GetConcatString(arguments))}))";

            foreach (KeyValuePair <int, Character> target in Account.GetAllPlayers())
            {
                if (target.Value.AdminLevel == 0)
                {
                    continue;                               // Tylko dla administratorów
                }
                NAPI.Chat.SendChatMessageToPlayer(target.Value.PlayerHandle, outputMessage);
            }

            // TODO: logi
        }
Esempio n. 3
0
        public void Command_Glob(Client player, string args = "")
        {
            Character charData = Account.GetPlayerData(player);

            if (charData == null)
            {
                return;
            }

            if (!Library.DoesPlayerHasAdminPerm(charData, Permissions.CoreGlob))
            {
                Ui.ShowError(player, "Nie posiadasz odpowiednich uprawnień do użycia tej komendy.");
                return;
            }

            string[] arguments = Command.GetCommandArguments(args);
            if (arguments.Length < 1)
            {
                Ui.ShowUsage(player, "/glob [treść wiadomości]");
                return;
            }

            RankInfo rankInfo = Library.GetAdminRankInfo(charData.AdminLevel);

            string outputMessage =
                $"!{{#FFFFFF}}(( !{{#{rankInfo.Color}}}{rankInfo.Name} " +
                $"!{{#FFFFFF}}{Player.GetPlayerOocName(charData, true)}: " +
                $"{Command.UpperFirst(Command.GetConcatString(arguments))}))";

            foreach (KeyValuePair <int, Character> target in Account.GetAllPlayers())
            {
                NAPI.Chat.SendChatMessageToPlayer(target.Value.PlayerHandle, outputMessage);
            }

            // TODO: logi
        }