Exemple #1
0
        public static void CommandPrefixItem(TShockAPI.CommandArgs args)
        {
            int money = SurvivalCore.SrvPlayers[args.Player.Index].Money;

            if (args.Player.TPlayer.inventory[args.Player.TPlayer.selectedItem].type == 0)
            {
                args.Player.SendErrorMessage("Nie znaleziono itemu.");
                return;
            }
            int cost = 8500;

            cost = Utils.CostCalc(args.Player, cost);
            if (money < cost)
            {
                args.Player.SendErrorMessage("Nie stac cie na zmiane itemu w prefixie. Koszt {0} €", cost);
                return;
            }
            object[] data = new object[2]
            {
                cost,
                args.Player.TPlayer.inventory[args.Player.TPlayer.selectedItem].type
            };
            Chat.AddAcceptation((byte)args.Player.Index, Action_CommandItem, data);
            string msg = string.Format(
                ChatFormat,
                args.Player.TPlayer.inventory[args.Player.TPlayer.selectedItem].type, PowelderAPI.Utils.GetGroupColor(args.Player.Group.Name),
                (args.Player.Group.Name == "Xedlefix" || args.Player.Group.Name == "Iwobos") ? "Zalozyciel" : args.Player.Group.Name,
                SurvivalCore.SrvPlayers[args.Player.Index].NickColor ?? PowelderAPI.Utils.GetGroupColor(args.Player.Group.Name),
                args.Player.Name,
                "Przykladowa wiadomosc.");

            args.Player.SendMessage(msg, Color.White);
            args.Player.SendInfoMessage($"Czy zgadzasz sie na zmiane? Wpisz [c/66ff66:/tak] lub [c/ff6666:/nie]. Koszt {cost} €");
        }
Exemple #2
0
        public static void CommandNickColor(TShockAPI.CommandArgs args)
        {
            int    money = SurvivalCore.SrvPlayers[args.Player.Index].Money;
            string text  = "0:0=1";

            if (args.Parameters.Count > 0)
            {
                text = args.Parameters[0].ToLower();
            }
            if (text == "list")
            {
                List <string> list = new List <string>();
                foreach (string key in Colors.Keys)
                {
                    list.Add($"[c/{Colors[key]}:{key}]");
                }
                args.Player.SendMessage($"[c/00ff00:Lista dostepnych kolorow:]", new Color(0, 0, 0));
                PaginationTools.SendPage(args.Player, 0, PaginationTools.BuildLinesFromTerms(list, null, ", ", 140), new PaginationTools.Settings
                {
                    IncludeHeader          = false,
                    LineTextColor          = new Color(255, 255, 255),
                    IncludeFooter          = false,
                    NothingToDisplayString = "Error 404."
                });
                return;
            }
            if (!Colors.ContainsKey(text))
            {
                args.Player.SendErrorMessage("Nie znaleziono podanego koloru.");
                args.Player.SendInfoMessage($"Wpisz /ncolor list, aby otrzymac liste dostepnych kolorow.");
                return;
            }
            int cost = 14500;

            cost = Utils.CostCalc(args.Player, cost);
            if (money < cost)
            {
                args.Player.SendErrorMessage("Nie stac cie na zmiane koloru nicku. Koszt {0} €", cost);
                return;
            }
            object[] data = new object[2]
            {
                cost,
                text
            };
            Chat.AddAcceptation((byte)args.Player.Index, Action_CommandNick, data);
            string msg = string.Format(ChatFormat, (
                                           SurvivalCore.SrvPlayers[args.Player.Index].PrefixItem == -1) ? PowelderAPI.Utils.GetGroupItem(args.Player.Group.Name) : SurvivalCore.SrvPlayers[args.Player.Index].PrefixItem,
                                       PowelderAPI.Utils.GetGroupColor(args.Player.Group.Name), (args.Player.Group.Name == "Xedlefix" || args.Player.Group.Name == "Iwobos") ? "Zalozyciel" : args.Player.Group.Name,
                                       Colors[text],
                                       args.Player.Name,
                                       "Przykladowa wiadomosc.");

            args.Player.SendMessage(msg, Color.White);
            args.Player.SendInfoMessage($"Czy zgadzasz sie na zmiane? Wpisz [c/66ff66:/tak] lub [c/ff6666:/nie] Koszt {cost} €");
        }