コード例 #1
1
        public static void Ghost(CommandArgs args)
        {
            int tempTeam = args.Player.TPlayer.team;
            args.Player.TPlayer.team = 0;
            NetMessage.SendData(45, -1, -1, "", args.Player.Index);
            args.Player.TPlayer.team = tempTeam;
            if (!isGhost[args.Player.Index])
            {

                args.Player.SendMessage("Ghost Mode activated!");

            }
            else
            {

                args.Player.SendMessage("Ghost Mode deactivated!");

            }
            isGhost[args.Player.Index] = !isGhost[args.Player.Index];
            args.Player.TPlayer.position.X = 0;
            args.Player.TPlayer.position.Y = 0;
            cansend = true;
            NetMessage.SendData(13, -1, -1, "", args.Player.Index);
            cansend = false;
        }
コード例 #2
1
        public static void CancelVote(CommandArgs args)
        {
            if (C3Mod.VoteRunning)
            {
                C3Mod.VoteRunning = false;
                C3Tools.BroadcastMessageToGametype("", args.Player.Name + " stopped the current vote!", Color.DarkCyan);

                switch (C3Mod.VoteType)
                {
                    case "ctf":
                        {
                            foreach (C3Player player in C3Mod.C3Players)
                            {
                                if(player.GameType == "ctf")
                                {
                                    player.GameType = "";
                                    player.Team = 0;
                                }
                            }
                            break;
                        }
                }
            }
            else
                args.Player.SendMessage("No vote running!", Color.DarkCyan);
        }
コード例 #3
1
        private void AddTile(CommandArgs args)
        {
            if( args.Parameters.Count < 1 )
            {
                args.Player.SendMessage("You must specify a tile to add.", Color.Red);
                return;
            }
            string tile = args.Parameters[0];
            int id;
            if( !int.TryParse(tile, out id) )
            {
                args.Player.SendMessage(String.Format("Tile id '{0}' is not a valid number.", id), Color.Red);
                return;
            }

            String query = "INSERT INTO BlacklistedTiles (ID, Type) VALUES (@0,@1);";

            if(db.Query(query, id,0) != 1)
            {
                TShock.Log.ConsoleError("Inserting into the database has failed!");
                args.Player.SendMessage(String.Format("Inserting into the database has failed!", id), Color.Red);
            }
            else
            {
                args.Player.SendMessage(String.Format("Successfully banned {0}",id), Color.Red);
                blacklistedTiles.Add(id);
            }
        }
コード例 #4
1
ファイル: ChangeName.cs プロジェクト: Patrikkk/ChangeName
        private void ChanName(CommandArgs args)
        {
            if (args.Player == null) return;

            if (args.Parameters.Count < 2)
            {
                args.Player.SendErrorMessage("Invalid syntax! Proper syntax: /chname [player] [newname]");
                return;
            }

            var foundplr = TShock.Utils.FindPlayer(args.Parameters[0]);
            if (foundplr.Count == 0)
            {
                args.Player.SendErrorMessage("Invalid player!");
                return;
            }
            else if (foundplr.Count > 1)
            {
                args.Player.SendErrorMessage(string.Format("More than one ({0}) player matched!", args.Parameters.Count));
                return;
            }

            string newName = args.Parameters[1];
            bool hidden = args.Parameters.Count > 2;

            var plr = foundplr[0];
            string oldName = plr.TPlayer.name;
            if (!hidden) TShock.Utils.Broadcast(string.Format("{0} has changed {1}'s name to {2}.", args.Player.Name, oldName, newName), Color.DeepPink);
            else args.Player.SendMessage(string.Format("You have secretly changed {0}'s name to {1}.", oldName, newName), Color.DeepPink);
            plr.TPlayer.name = newName;
            NetMessage.SendData((int)PacketTypes.PlayerInfo, -1, -1, plr.TPlayer.name, args.Player.Index, 0, 0, 0, 0);
            oldNames[newName] = oldName;
        }
コード例 #5
1
ファイル: Protect.cs プロジェクト: mawize/Boxes
 public override void Execute(CommandArgs args)
 {
     if (args.Parameters.Count == 3)
     {
         string boxName = args.Parameters[1];
         if(IsOwner(args.Player,boxman.GetBoxByName(boxName)))
         {
             if (args.Parameters[2].ToLower() == "true")
             {
                 if (boxman.SetBoxProtected(boxName, true))
                     ChatHandler.communicate(ChatHandler.CustomSuccess, args.Player, "Box " + boxName + " protected");
                 else
                     ChatHandler.communicate(ChatHandler.BoxNotFound, args.Player, boxName);
             }
             else if (args.Parameters[2].ToLower() == "false")
             {
                 if (boxman.SetBoxProtected(boxName, false))
                     ChatHandler.communicate(ChatHandler.CustomWarning, args.Player, "Box " + boxName + " unprotected");
                 else
                     ChatHandler.communicate(ChatHandler.BoxNotFound, args.Player, boxName);
             }
             else
                 ChatHandler.communicate(ChatHandler.InvalidSyntax, args.Player, "protect [name] [true/false]");
         }
         else
             ChatHandler.communicate(ChatHandler.NoPermission, args.Player, boxName);
     }
     else
         ChatHandler.communicate(ChatHandler.InvalidSyntax, args.Player, "protect [name] [true/false]");
 }
コード例 #6
1
 private static void CmdMore(CommandArgs args)
 {
     if (args.Parameters.Count > 0 && args.Parameters[0].ToLower() == "all") {
     var full = true;
     foreach (var item in args.TPlayer.inventory) {
       if (item == null || item.stack == 0) continue;
       var amtToAdd = item.maxStack - item.stack;
       if (item.stack > 0 && amtToAdd > 0 && !item.name.ToLower().Contains("coin")) {
     full = false;
     args.Player.GiveItem(item.type, item.name, item.width, item.height, amtToAdd);
       }
     }
     if (!full)
       args.Player.SendSuccessMessage("Filled all your items.");
     else
       args.Player.SendErrorMessage("Your inventory is already full.");
       }
       else {
     var holding = args.Player.TPlayer.inventory[args.TPlayer.selectedItem];
     var amtToAdd = holding.maxStack - holding.stack;
     if (holding.stack > 0 && amtToAdd > 0)
       args.Player.GiveItem(holding.type, holding.name, holding.width, holding.height, amtToAdd);
     if (amtToAdd == 0)
       args.Player.SendErrorMessage("Your {0} is already full.", holding.name);
     else
       args.Player.SendSuccessMessage("Filled up your {0}.", holding.name);
       }
 }
コード例 #7
1
ファイル: DayRegions.cs プロジェクト: Enerdy/DayRegions
 public static void DayregionCommand(CommandArgs args)
 {
     if (args.Parameters.Count > 1)
     {
         var region = TShock.Regions.GetRegionByName(args.Parameters[1]);
         if (region != null && region.Name != "")
         {
             if (args.Parameters[0] == "add" && DayRegions_Add(region.Name))
             {
                 RegionList.Add(region);
                 args.Player.SendMessage(String.Format("Region '{0}' added to Day Region list", region.Name), Color.BurlyWood);
                 return;
             }
             else if (args.Parameters[0] == "del")
             {
                 DayRegions_Delete(region);
                 args.Player.SendMessage(String.Format("Region '{0}' deleted from Day Region list", region.Name), Color.BurlyWood);
                 return;
             }
             return;
         }
         else
         {
             args.Player.SendMessage(String.Format("Region '{0}' not found", args.Parameters[1]), Color.Red);
             return;
         }
     }
     args.Player.SendMessage("Syntax: /dayregion [add | del] \"region name\"", Color.Red);
 }
コード例 #8
1
ファイル: Commands.cs プロジェクト: HySpeed/Chest-Control
 private static void SetPasswordChest(CommandArgs args)
 {
     if (ChestControl.Players[args.Player.Index].GetState() == SettingState.PasswordSetting ||
         ChestControl.Players[args.Player.Index].GetState() == SettingState.PasswordUnSetting)
     {
         ChestControl.Players[args.Player.Index].SetState(SettingState.None);
         args.Player.SendMessage("You are no longer selecting a chest.", Color.BlueViolet);
     }
     else
     {
         if (args.Parameters.Count != 1)
         {
             args.Player.SendMessage(
                 "You must enter password! Or use \"remove\" as password to remove password.", Color.Red);
             return;
         }
         if (args.Parameters[0] == "del" || args.Parameters[0] == "delete" || args.Parameters[0] == "rm" ||
             args.Parameters[0] == "remove" || args.Parameters[0] == "unlock" || args.Parameters[0] == "unset")
         {
             ChestControl.Players[args.Player.Index].SetState(SettingState.PasswordUnSetting);
             args.Player.SendMessage("Open a chest to remove password.", Color.BlueViolet);
         }
         else
         {
             ChestControl.Players[args.Player.Index].PasswordForChest = args.Parameters[0];
             ChestControl.Players[args.Player.Index].SetState(SettingState.PasswordSetting);
             args.Player.SendMessage("Open a chest to set password.", Color.BlueViolet);
         }
     }
 }
コード例 #9
1
ファイル: Commands.cs プロジェクト: HySpeed/PlayerInfo
        // PlayerInfo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        public static void PlayerInfo( CommandArgs args )
        {
            if ( args.Parameters.Count <= 1 )
              {
            args.Player.SendMessage( "Invalid syntax. Proper Syntax: /pinfo <player> [ Life | Buffs ]", Color.Red );
              } // if
              else if ( args.Parameters.Count > 1 )
              {
            TShockAPI.TSPlayer player;
            string action;

            player = findPlayer( args, args.Parameters[0] );
            if ( player != null )
            {
              action = args.Parameters[1].ToUpper();

               if ( action.StartsWith( "L" ) ) { showLifeMana( args, player ); } // if
              else if ( action.StartsWith( "B" ) ) { showBuffs(    args, player ); } // if
              else
              {
            args.Player.SendMessage( string.Format( "Invalid action: {0}. Proper Syntax: /pinfo <player> [ Life | Buffs ]", action ), Color.Red );
              } // else

            } // if
              } // else if
        }
コード例 #10
1
ファイル: main.cs プロジェクト: CrazyLegsSteph/Freeze
 public void freeze(CommandArgs args)
 {
     if (args.Player != null)
     {
         if (args.Parameters.Count != 1)
         {
             args.Player.SendErrorMessage("Invalid syntax! Proper syntax: /freeze [player]");
             return;
         }
         var foundplr = TShock.Utils.FindPlayer(args.Parameters[0]);
         if (foundplr.Count == 0)
         {
             args.Player.SendErrorMessage("Invalid player!");
             return;
         }
         else if (foundplr.Count > 1)
         {
             args.Player.SendErrorMessage(string.Format("More than one ({0}) player matched!", args.Parameters.Count));
             return;
         }
         var plr = foundplr[0];
         if (FrozenPlayers.FindIndex(p => p.Index == plr.Index) < 0)
         {
             FrozenPlayers.Add(new FrozenPlayer(plr.Index));
             TSPlayer.All.SendInfoMessage(string.Format("{0} froze {1}", args.Player.Name, plr.Name));
             return;
         }
         else
         {
             FrozenPlayers.RemoveAll(p => p.Index == plr.Index);
             TSPlayer.All.SendInfoMessage(string.Format("{0} unfroze {1}", args.Player.Name, plr.Name));
             return;
         }
     }
 }
コード例 #11
1
ファイル: Commands.cs プロジェクト: ARTdrakon/TShock
 public static void DebugConfiguration(CommandArgs args)
 {
     int ply = args.PlayerID;
     var commands = TShock.commandList;
     if (TShock.players[ply].IsAdmin())
         commands = TShock.admincommandList;
     Tools.SendMessage(ply, "TShock Config:");
     string lineOne = "";
     lineOne += "KickCheater : " + ConfigurationManager.kickCheater + ", ";
     lineOne += "BanCheater : " + ConfigurationManager.banCheater + ", ";
     lineOne += "KickGriefer : " + ConfigurationManager.kickGriefer + ", ";
     lineOne += "BanGriefer : " + ConfigurationManager.banGriefer;
     Tools.SendMessage(ply, lineOne, new float[] { 255f, 255f, 0f });
     string lineTwo = "";
     lineTwo += "BanTnt : " + ConfigurationManager.banTnt + ", ";
     lineTwo += "KickTnt : " + ConfigurationManager.kickTnt + ", ";
     lineTwo += "BanBoom : " + ConfigurationManager.banBoom + ", ";
     lineTwo += "KickBoom : " + ConfigurationManager.kickBoom;
     Tools.SendMessage(ply, lineTwo, new float[] { 255f, 255f, 0f });
     string lineThree = "";
     lineThree += "InvMultiplier : " + ConfigurationManager.invasionMultiplier + ", ";
     lineThree += "ProtectS : " + ConfigurationManager.spawnProtect + ", ";
     lineThree += "ProtectR : " + ConfigurationManager.spawnProtectRadius + ", ";
     lineThree += "DMS : " + ConfigurationManager.defaultMaxSpawns + ", ";
     lineThree += "SpawnRate: " + ConfigurationManager.defaultSpawnRate + ", ";
     Tools.SendMessage(ply, lineThree, new float[] { 255f, 255f, 0f});
 }
コード例 #12
1
ファイル: QCommands.cs プロジェクト: Ijwu/TShock-Quest-System
 public static void LoadQuestData(CommandArgs args)
 {
     QTools.LoadPlayers();
     QTools.LoadQuests();
     QTools.LoadRegions();
     args.Player.SendMessage("Successfully reloaded QuestSystem data.", Color.Yellow);
 }
コード例 #13
1
ファイル: Commands.cs プロジェクト: bippity/Sign-Control
 private static void CancelSet(CommandArgs args)
 {
     SignControl.Players[args.Player.Index].PasswordForSign = "";
     SignControl.Players[args.Player.Index].WarpForSign = "";
     SignControl.Players[args.Player.Index].SetState(SettingState.None);
     args.Player.SendMessage(Messages.stopSelecting, Color.BlueViolet);
 }
コード例 #14
0
        public static void AutoKill(CommandArgs args)
        {
            if (args.Parameters.Count > 0)
            {
                var plyList = TShockAPI.TShock.Utils.FindPlayer(args.Parameters[0]);

                if (plyList.Count > 1)
                    TShock.Utils.SendMultipleMatchError(args.Player, plyList.Select(p => p.Name));
                else if (plyList.Count < 1)
                    args.Player.SendErrorMessage(plyList.Count.ToString() + " players matched.");

                else
                    if (!plyList[0].Group.HasPermission("mac.kill") || args.Player == plyList[0])
                    {
                        var player = Utils.GetPlayers(plyList[0].Index);

                        player.autoKill = !player.autoKill;

                        args.Player.SendSuccessMessage(string.Format("{0}abled auto-killed on {1}",
                            player.autoKill ? "En" : "Dis", player.name));
                        player.TSPlayer.SendInfoMessage(string.Format("You are {0} being auto-killed",
                            player.autoKill ? "now" : "no longer"));

                        if (player.autoKill)
                        {
                            if (!updateTimers.autoKillTimer.Enabled)
                                updateTimers.autoKillTimer.Enabled = true;
                        }
                    }
                    else
                        args.Player.SendErrorMessage("You cannot autokill this player!");
            }
            else
                args.Player.SendErrorMessage("Invalid syntax: {0}autokill <playerName>", (args.Silent ? TShock.Config.CommandSilentSpecifier : TShock.Config.CommandSpecifier));
        }
コード例 #15
0
ファイル: BuildMode.cs プロジェクト: PizzaStix423/BuildMode
 void BuildModeCmd(CommandArgs e)
 {
     Build[e.Player.Index] = !Build[e.Player.Index];
     e.Player.SendMessage(string.Format((Build[e.Player.Index] ? "En" : "Dis") + "abled build mode."), Color.Cyan);
     // Time
     NetMessage.SendData(7, e.Player.Index);
     // NPCs
     for (int i = 0; i < 200; i++)
     {
         if (!Main.npc[i].friendly)
             e.Player.SendData(PacketTypes.NpcUpdate, "", i);
     }
     // Projectiles
     for (int i = 0; i < 1000; i++)
     {
         if (!Main.projectile[i].friendly)
             e.Player.SendData(PacketTypes.ProjectileNew, "", i);
     }
     // PvP
     if (e.TPlayer.hostile)
     {
         e.TPlayer.hostile = false;
         e.Player.SendData(PacketTypes.TogglePvp, "", e.Player.Index);
     }
 }
コード例 #16
0
ファイル: Commands.cs プロジェクト: HySpeed/Chest-Control
 private static void Set(CommandArgs args)
 {
     if (ChestControl.Players[args.Player.Index].GetState() == SettingState.Setting ||
         ChestControl.Players[args.Player.Index].GetState() == SettingState.PublicSetting)
     {
         ChestControl.Players[args.Player.Index].SetState(SettingState.None);
         args.Player.SendMessage("You are no longer selecting a chest.", Color.BlueViolet);
     }
     else if (args.Parameters.Count == 1)
         switch (args.Parameters[0])
         {
             case "public":
                 ChestControl.Players[args.Player.Index].SetState(SettingState.PublicSetting);
                 args.Player.SendMessage("Open a chest to protect it (public).", Color.BlueViolet);
                 break;
             case "private":
                 ChestControl.Players[args.Player.Index].SetState(SettingState.Setting);
                 args.Player.SendMessage("Open a chest to protect it (private).", Color.BlueViolet);
                 break;
             default:
                 args.Player.SendMessage("Wrong subcommand, use \"public\" or \"private\".", Color.BlueViolet);
                 break;
         }
     else
     {
         ChestControl.Players[args.Player.Index].SetState(SettingState.Setting);
         args.Player.SendMessage("Open a chest to protect it.", Color.BlueViolet);
     }
 }
コード例 #17
0
ファイル: Define.cs プロジェクト: mawize/Boxes
        public override void Execute(CommandArgs args)
        {
            if (args.Parameters.Count > 1)
                if (!args.Player.TempPoints.Any(p => p == Point.Zero))
            {
                string boxName = String.Join(" ", args.Parameters.GetRange(1, args.Parameters.Count - 1));
                var x = Math.Min(args.Player.TempPoints[0].X, args.Player.TempPoints[1].X);
                var y = Math.Min(args.Player.TempPoints[0].Y, args.Player.TempPoints[1].Y);
                var width = Math.Abs(args.Player.TempPoints[0].X - args.Player.TempPoints[1].X);
                var height = Math.Abs(args.Player.TempPoints[0].Y - args.Player.TempPoints[1].Y);

                if(args.Player.Group.HasPermission("boxes.admin") || Hooks.BoxesHooks.AskOnDefineHooks(args))
                    if (boxman.AddBox(x, y, width, height, boxName, args.Player.UserAccountName, Main.worldID.ToString()))
                    {
                        args.Player.TempPoints[0] = Point.Zero;
                        args.Player.TempPoints[1] = Point.Zero;
                        ChatHandler.communicate(ChatHandler.CustomSuccess, args.Player, "Box " + boxName + " successfully created");
                        ChatHandler.communicate(ChatHandler.CustomSuccess, args.Player, "Box " + boxName + " protected");
                    }
                    else
                        ChatHandler.communicate(ChatHandler.CustomError, args.Player, "Box " + boxName + " already exists");
                else
                    ChatHandler.communicate(ChatHandler.CustomError, args.Player, "Box " + boxName + " could not be created");
            }
            else
            {
                ChatHandler.communicate(ChatHandler.CustomError, args.Player, "Points not set up yet.");
            }
            else
                ChatHandler.communicate(ChatHandler.InvalidSyntax, args.Player, "define [name]");
        }
コード例 #18
0
 //^String Builder
 public static void BCsearchitem(CommandArgs args, List<Item> list, int page)
 {
     args.Player.SendMessage("Item Search:", Color.Yellow);
     var sb = new StringBuilder();
     if (list.Count > (8 * (page - 1)))
     {
         for (int j = (8 * (page - 1)); j < (8 * page); j++)
         {
             if (sb.Length != 0)
                 sb.Append(" | ");
             sb.Append(list[j].netID).Append(": ").Append(list[j].name);
             if (j == list.Count - 1)
             {
                 args.Player.SendMessage(sb.ToString(), Color.MediumSeaGreen);
                 break;
             }
             if ((j + 1) % 2 == 0)
             {
                 args.Player.SendMessage(sb.ToString(), Color.MediumSeaGreen);
                 sb.Clear();
             }
         }
     }
     if (list.Count > (8 * page))
     {
         args.Player.SendMessage(string.Format("Type /spage {0} for more Results.", (page + 1)), Color.Yellow);
     }
 }
コード例 #19
0
ファイル: QCommands.cs プロジェクト: Olink/Twitchys-Quest-Mod
        public static void ListQuest(CommandArgs args)
        {
            QPlayer Player = QTools.GetPlayerByID(args.Player.Index);
            if (Player.IsLoggedIn)
            {
                Rectangle ply = new Rectangle((int)args.Player.X / 16, (int)args.Player.Y / 16, 1, 1);
                string availquests = "Available Quests: ";
                foreach (QuestRegion qr in QMain.QuestRegions)
                {
                    if (ply.Intersects(qr.Area))
                    {
                        foreach (Quest q in qr.Quests)
                        {
                            QuestPlayerData data = QTools.GetPlayerQuestData(q.Name, Player);

                            if (QTools.AbleToRunQuest(q) && (q.MinQuestsNeeded == 0 || q.MinQuestsNeeded <= QTools.GetQuestsCompleted(Player.MyDBPlayer.QuestPlayerData)) && (q.MaxAttemps == 0 || data == null || QTools.GetPlayerQuestData(q.Name, Player).Attempts < q.MaxAttemps))
                            {
                                availquests = availquests + q.Name + ", ";
                            }
                        }
                    }
                }

                if (availquests != "Available Quests: ")
                {
                    availquests = availquests.Substring(0, availquests.Length - 2);
                    Player.TSPlayer.SendMessage(availquests, Color.Magenta);
                    Player.TSPlayer.SendMessage("Use /startquest [Quest Name], to begin that quest", Color.Magenta);
                }
                else
                    Player.TSPlayer.SendMessage("No Available Quests", Color.Red);
            }
            else
                Player.TSPlayer.SendMessage("You are not Logged in", Color.Red);
        }
コード例 #20
0
ファイル: main.cs プロジェクト: CrazyLegsSteph/LastOnline
        private void Check(CommandArgs args)
        {
            if (args.Parameters.Count < 1)
            {
                args.Player.SendErrorMessage("Invalid syntax! proper syntax: /lo <username>");
                return;
            }
            string name = string.Join(" ", args.Parameters);
            TShockAPI.DB.User DbUser = new UserManager(TShock.DB).GetUserByName(name);
            if (DbUser == null)
            {
                args.Player.SendErrorMessage("Player not found! (Doesn't exist? Also Case Sensitivity is important)");
                return;
            }
            foreach (TSPlayer ts in TShock.Players)
            {
                if (ts == null)
                    continue;

                if (ts.Name == DbUser.Name)
                {
                    args.Player.SendErrorMessage("This player is still online!");
                    return;
                }
            }
            TimeSpan t = DateTime.UtcNow.Subtract(DateTime.Parse(DbUser.LastAccessed));
            args.Player.SendInfoMessage(string.Format("{0} was last seen online {1} ago", DbUser.Name, GetTimeFormat(t)));
        }
コード例 #21
0
ファイル: STime.cs プロジェクト: srcanseco/STime
        private void SilentTime(CommandArgs args)
        {
            if (args.Parameters.Count == 0)
            {
                double time = Main.time / 3600.0;
                time += 4.5;
                if (!Main.dayTime)
                    time += 15.0;
                time = time % 24.0;
                args.Player.SendInfoMessage("The current time is {0}:{1:D2}.", (int)Math.Floor(time), (int)Math.Round((time % 1.0) * 60.0));
                return;
            }

            switch (args.Parameters[0].ToLower())
            {
                case "day":
                    TSPlayer.Server.SetTime(true, 0.0);
                    break;
                case "night":
                    TSPlayer.Server.SetTime(false, 0.0);
                    break;
                case "noon":
                    TSPlayer.Server.SetTime(true, 27000.0);
                    break;
                case "midnight":
                    TSPlayer.Server.SetTime(false, 16200.0);
                    break;
                default:
                    string[] array = args.Parameters[0].Split(':');
                    if (array.Length != 2)
                    {
                        args.Player.SendErrorMessage("Invalid time string! Proper format: hh:mm, in 24-hour time.");
                        return;
                    }

                    int hours;
                    int minutes;
                    if (!int.TryParse(array[0], out hours) || hours < 0 || hours > 23
                        || !int.TryParse(array[1], out minutes) || minutes < 0 || minutes > 59)
                    {
                        args.Player.SendErrorMessage("Invalid time string! Proper format: hh:mm, in 24-hour time.");
                        return;
                    }

                    decimal time = hours + (minutes / 60.0m);
                    time -= 4.50m;
                    if (time < 0.00m)
                        time += 24.00m;

                    if (time >= 15.00m)
                    {
                        TSPlayer.Server.SetTime(false, (double)((time - 15.00m) * 3600.0m));
                    }
                    else
                    {
                        TSPlayer.Server.SetTime(true, (double)(time * 3600.0m));
                    }
                    break;
            }
        }
コード例 #22
0
ファイル: Clear.cs プロジェクト: mawize/Boxes
 public override void Execute(CommandArgs args)
 {
     args.Player.TempPoints[0] = Point.Zero;
     args.Player.TempPoints[1] = Point.Zero;
     ChatHandler.communicate(ChatHandler.CustomSuccess, args.Player, "Cleared temp area");
     args.Player.AwaitingTempPoint = 0;
 }
コード例 #23
0
        public static void ChangeLock(CommandArgs args)
        {
            if (args.Parameters.Count > 0)
            {
                string houseName = "";

                for (int i = 0; i < args.Parameters.Count; i++)
                {
                    if (houseName == "")
                    {
                        houseName = args.Parameters[i];
                    }
                    else
                    {
                        houseName = houseName + " " + args.Parameters[i];
                    }
                }

                if (HTools.OwnsHouse(args.Player.UserID.ToString(), houseName))
                {
                    bool locked = HouseTools.ChangeLock(houseName);

                    if (locked)
                        args.Player.SendMessage("House: " + houseName + " locked", Color.Yellow);
                    else
                        args.Player.SendMessage("House: " + houseName + " unlocked", Color.Yellow);
                }
                else
                    args.Player.SendMessage("You do not own House: " + houseName, Color.Yellow);
            }
            else
                args.Player.SendMessage("Invalid syntax! Proper syntax: /changelock [house]", Color.Red);
        }
コード例 #24
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} €");
        }
コード例 #25
0
ファイル: Commands.cs プロジェクト: mawize/Boxes
        public void BoxesQuota(CommandArgs args)
        {
            string cmd = "help";
            if (args.Parameters.Count > 0)
            {
                cmd = args.Parameters[0].ToLower();
            }

            switch (cmd)
            {
            case "show":
                // NOT IMPLEMENTED
                // show quota usage of a specific player
            case "extend":
                // NOT IMPLEMENTED
                // extend quota limit of a specific player
            case "shrink":
                // NOT IMPLEMENTED
                // reduce quota limit of a specific player
            case "help":
            default:
                int boxed = boxman.GetUsersBoxedTiles(args.Player.Name);
                int limit;
                int.TryParse(BoxesQuotaPlugin.getConfig.UserTilesQuota, out limit);
                args.Player.SendMessage(string.Format ("{0}", limit));
                args.Player.SendMessage(string.Format ("AlreadyBoxed: {0}, Limit: {1}", boxed, limit));
                break;
            }
        }
コード例 #26
0
ファイル: Commands.cs プロジェクト: HySpeed/TerrariaPlugins
        // IrcInfo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        public static void IrcInfo( CommandArgs args )
        {
            if ( args.Parameters.Count <= 1 )
            {
              TerrariaIRC.sendIRCMessage( "Invalid syntax. Proper Syntax: /iinfo <player> [ Life | Buffs ]" );
            } // if
            else if ( args.Parameters.Count > 1 )
            {
              TShockAPI.TSPlayer player;
              string playerName, action;
              playerName = args.Parameters[0];

              player = findPlayer( playerName );
              if ( player != null )
              {
            action = args.Parameters[1].ToUpper();

                 if ( action.StartsWith( "L" ) ) { showLifeMana( player ); } // if
            else if ( action.StartsWith( "B" ) ) { showBuffs( player );    } // if
            else
            {
                TerrariaIRC.sendIRCMessage( string.Format( "Invalid action: {0}. Proper Syntax: /iinfo <player> [ Life | Buffs ]", action ) );
            } // else

              } // if
            } // else if
        }
コード例 #27
0
ファイル: main.cs プロジェクト: CAWCAWCAW/Poll
        public static void open(CommandArgs args)
        {
            if (args.Player is TShockAPI.TSServerPlayer)
            {
                if (FormOpen)
                {
                    args.Player.SendErrorMessage("Window is already open!");
                    return;
                }
                Thread t = new Thread(() =>
                {

                    Gui f = new Gui();
                    try
                    {
                        FormOpen = true;
                        System.Timers.Timer tim = new System.Timers.Timer(15000);
                        tim.Elapsed += new System.Timers.ElapsedEventHandler(Poll.Gui.tim_Elapsed);
                        f.ShowDialog();
                    }
                    catch (Exception ex)
                    {
                        Log.ConsoleError("window closed because it crashed: " + ex.ToString());
                    }
                    TShockAPI.Log.ConsoleInfo("window closed");
                    FormOpen = false;
                });
                t.SetApartmentState(ApartmentState.STA);
                t.Start();
            }
            else
                args.Player.SendErrorMessage("Only the console can do that.");
        }
コード例 #28
0
        public static void GetPlayTime(TShockAPI.CommandArgs args)
        {
            string text = null;

            if (args.Parameters.Count > 0)
            {
                text = args.Parameters[0].ToLower();
            }
            if (text != null)
            {
                List <TSPlayer> list = TSPlayer.FindByNameOrID(text);
                if (list.Count < 1)
                {
                    args.Player.SendErrorMessage("Nie mozna bylo znalezc gracza {0}.", args.Parameters[0]);
                    return;
                }
                TimeSpan timeSpan = TimeSpan.FromSeconds(SurvivalCore.SrvPlayers[list[0].Index].PlayTime + (long)SurvivalCore.PlayTime[(byte)list[0].Index].Elapsed.TotalSeconds);
                string   text2    = (timeSpan.Seconds == 1) ? "sekunde" : ((timeSpan.Seconds <= 1 || timeSpan.Seconds >= 5) ? "sekund" : "sekundy");
                string   text3    = (timeSpan.Minutes == 1) ? "minute" : ((timeSpan.Minutes <= 1 || timeSpan.Minutes >= 5) ? "minut" : "minuty");
                string   text4    = ((int)timeSpan.TotalHours == 1) ? "godzine" : (((int)timeSpan.TotalHours <= 1 || (int)timeSpan.TotalHours >= 5) ? "godzin" : "godziny");
                args.Player.SendInfoMessage($"{list[0].Name} lacznie na serwerze spedzil {(int)timeSpan.TotalHours} {text4}, {timeSpan.Minutes} {text3}, {timeSpan.Seconds} {text2}.");
            }
            else
            {
                TimeSpan timeSpan2 = TimeSpan.FromSeconds(SurvivalCore.SrvPlayers[args.Player.Index].PlayTime + (long)SurvivalCore.PlayTime[(byte)args.Player.Index].Elapsed.TotalSeconds);
                string   text5     = (timeSpan2.Seconds == 1) ? "sekunde" : ((timeSpan2.Seconds <= 1 || timeSpan2.Seconds >= 5) ? "sekund" : "sekundy");
                string   text6     = (timeSpan2.Minutes == 1) ? "minute" : ((timeSpan2.Minutes <= 1 || timeSpan2.Minutes >= 5) ? "minut" : "minuty");
                string   text7     = ((int)timeSpan2.TotalHours == 1) ? "godzine" : (((int)timeSpan2.TotalHours <= 1 || (int)timeSpan2.TotalHours >= 5) ? "godzin" : "godziny");
                args.Player.SendInfoMessage($"Lacznie na serwerze spedziles {(int)timeSpan2.TotalHours} {text7}, {timeSpan2.Minutes} {text6}, {timeSpan2.Seconds} {text5}.");
            }
        }
コード例 #29
0
ファイル: Commands.cs プロジェクト: HySpeed/PlayerInfo
        // PlayerInv +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        public static void PlayerInv( CommandArgs args )
        {
            if ( args.Parameters.Count <= 1 )
              {
            args.Player.SendMessage( "Invalid syntax. Proper Syntax: /pinv <player> [ INV <row> | ACC | AMM | ARM ]", Color.Red );
              } // if
              else if ( args.Parameters.Count > 1 )
              {
            TShockAPI.TSPlayer player;
            string action;

            player = findPlayer( args, args.Parameters[0] );
            if ( player != null )
            {
              action = args.Parameters[1].ToUpper();

               if ( action.StartsWith( "AC" ) ) { showAccArm( args, player, true  ); } // if
              else if ( action.StartsWith( "AR" ) ) { showAccArm( args, player, false ); } // if
              else if ( action.StartsWith( "AM" ) ) { showAmm( args, player ); } // if
              else if ( action.StartsWith( "IN" ) ) { showInv( args, player ); } // if
              else
              {
            args.Player.SendMessage( string.Format( "Invalid action: {0}", action ), Color.Red );
            args.Player.SendMessage( "Invalid syntax. Proper Syntax: /pinv <player> [ INV <row> | ACC | AMM | ARM ]", Color.Orange );
              } // else

            } // if

              } // else if
        }
コード例 #30
0
ファイル: TCsay.cs プロジェクト: UB1AFU/TerraClans
 public static void CMDtcsay(CommandArgs args)
 {
     if (TCutils.AlreadyInClan(args.Player.UserAccountName))
     {
         //tcsay <msg>
         string msg = "";
         if (args.Parameters.Count > 0)
         {
             for (int i = 0; i < args.Parameters.Count; i++)
             {
                 msg = msg + " " + args.Parameters[i];
             }
             TCutils.ClanMsg(args.Player.UserAccountName, msg, 0, false);
         }
         else
         {
             args.Player.SendMessage("TerraClans.", Color.Red);
             args.Player.SendMessage("/tcsay <message>; /c <message> - sends message to your clan chat.", Color.Red);
         }
     }
     else
     {
         args.Player.SendMessage("You are not in clan!", Color.Red);
     }
 }
コード例 #31
0
ファイル: Commands.cs プロジェクト: 3Dmax/TShock
 public static void Ban(CommandArgs args)
 {
     string input = args.Message.Remove(0, 4).Trim();
     string plStr = "";
     string reason = "";
     int splitIndex = input.StartsWith("\"") ? splitIndex = input.IndexOf('"', 1) : splitIndex = input.IndexOf(' ', 0);
     if (splitIndex == -1)
     {
         plStr = input;
     }
     else
     {
         plStr = input.Substring(0, splitIndex).Trim().TrimEnd('"').TrimStart('"');
         reason = input.Substring(splitIndex + 1).Trim().TrimEnd('"').TrimStart('"');
     }
     int ply = args.PlayerID;
     if (plStr.Length != 0)
     {
         int player = Tools.FindPlayer(plStr);
         if (player == -1)
             Tools.SendMessage(ply, "Invalid player!", new[] { 255f, 0f, 0f });
         else if (player == -2)
             Tools.SendMessage(ply, "More than one player matched!", new[] { 255f, 0f, 0f });
         else
         {
             if (!Tools.Ban(player, reason.Length != 0 ? reason : "Misbehaviour."))
             {
                 Tools.SendMessage(ply, "You can't ban another admin!", new[] { 255f, 0f, 0f });
             }
         }
     }
     else
         Tools.SendMessage(ply, "Invalid syntax! Proper syntax: /ban <player> [reason]",
                           new[] { 255f, 0f, 0f });
 }
コード例 #32
0
ファイル: Commands.cs プロジェクト: mawize/Boxes
        public void Boxes(CommandArgs args)
        {
            string cmd = "help";
            if (args.Parameters.Count > 0)
            {
                cmd = args.Parameters[0].ToLower();
            }

            switch (cmd)
            {
            case "name":
                new Name().Execute(args);
                break;
            case "info":
                new Info().Execute(args);
                break;
            case "set":
                new Set().Execute(args);
                break;
            case "clear":
                new Clear().Execute(args);
                break;
            case "define":
                new Define().Execute(args);
                break;
            case "delete":
                new Delete().Execute(args);
                break;
            case "protect":
                new Protect().Execute(args);
                break;
            case "allow":
                new Allow().Execute(args);
                break;
            case "remove":
                new Remove().Execute(args);
                break;
            case "allowg":
                new AllowG().Execute(args);
                break;
            case "removeg":
                new RemoveG().Execute(args);
                break;
            case "list":
                new List().Execute(args);
                break;
            case "resize":
            case "expand":
                new Resize().Execute(args);
                break;
            case "z":
                new Z().Execute(args);
                break;
            case "help":
            default:
                new Help().Execute(args);
                break;
            }
        }
コード例 #33
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} €");
        }
コード例 #34
0
 public static void DeathMessages(TShockAPI.CommandArgs args)
 {
     if (!SurvivalCore.IsDeathMessage[args.Player.Index])
     {
         SurvivalCore.IsDeathMessage[args.Player.Index] = true;
         args.Player.SendSuccessMessage("Powiadomienia o zgonach zostaly wlaczone.");
     }
     else
     {
         SurvivalCore.IsDeathMessage[args.Player.Index] = false;
         args.Player.SendSuccessMessage("Powiadomienia o zgonach zostaly wylaczone.");
     }
 }
コード例 #35
0
        public static void StaffChat(TShockAPI.CommandArgs args)
        {
            string text = string.Join(" ", args.Parameters);

            if (text == null || text == "")
            {
                args.Player.SendErrorMessage("Uzycie: /s <wiadomosc>");
                return;
            }
            foreach (TSPlayer item in TShock.Players.Where((TSPlayer p) => p?.HasPermission("server.jmod") ?? false))
            {
                item.SendMessage("[i:549] [c/595959:;] [c/2ECC71:Kadra] [c/595959:;] [c/" + PowelderAPI.Utils.GetGroupColor(args.Player.Group.Name) + ":" + args.Player.Name + "]: " + text, new Color(136, 255, 77));
            }
        }
コード例 #36
0
        public static void HelpOp(TShockAPI.CommandArgs args)
        {
            string text = string.Join(" ", args.Parameters);

            if (text == null || text == "")
            {
                args.Player.SendErrorMessage("Uzycie: /adminhelp <wiadomosc>");
                return;
            }
            foreach (TSPlayer item in TShock.Players.Where((TSPlayer p) => p?.HasPermission("server.jmod") ?? false))
            {
                item.SendMessage("[i:548] [c/595959:;] [c/1072F6:AdminHelp] [c/595959:;] [c/" + PowelderAPI.Utils.GetGroupColor(args.Player.Group.Name) + ":" + args.Player.Name + "]: " + text, new Color(75, 171, 255));
            }
            args.Player.SendSuccessMessage("Pomyslne wyslano wiadomosc do wszystkich czlonkow kadry!");
        }
コード例 #37
0
        public static void ClearChat(TShockAPI.CommandArgs args)
        {
            string str = string.Join(" ", args.Parameters);
            int    num = 0;

            do
            {
                TSPlayer.All.SendInfoMessage(" ");
                num++;
            }while (num != 450);
            if (args.Parameters.Count > 0)
            {
                TSPlayer.All.SendInfoMessage("Czat zostal wyczyszczony - " + str);
            }
            else
            {
                TSPlayer.All.SendInfoMessage("Czat zostal wyczyszczony.");
            }
        }
コード例 #38
0
ファイル: CmdAlias.cs プロジェクト: afornes/SEconomy
        protected async void ChatCommand_GeneralCommand(TShockAPI.CommandArgs args)
        {
            if (args.Parameters.Count >= 1 && args.Parameters[0].Equals("reload", StringComparison.CurrentCultureIgnoreCase) && args.Player.Group.HasPermission("aliascmd.reloadconfig"))
            {
                args.Player.SendInfoMessage("aliascmd: Reloading configuration file.");

                try {
                    await ReloadConfigAfterDelayAsync(1);

                    args.Player.SendInfoMessage("aliascmd: reloading complete.");
                } catch (Exception ex) {
                    args.Player.SendErrorMessage("aliascmd: reload failed.  You need to check the server console to find out what went wrong.");
                    TShock.Log.ConsoleError("aliascmd reload: Cannot load configuration: {0}", ex.Message);
                }
            }
            else
            {
                args.Player.SendErrorMessage("aliascmd: usage: /aliascmd reload: reloads the AliasCmd configuration file.");
            }
        }
コード例 #39
0
        /// <summary>
        /// Occurs when someone executes an alias command
        /// </summary>
        internal void ChatCommand_AliasExecuted(TShockAPI.CommandArgs e)
        {
            string commandIdentifier = e.Message;

            if (!string.IsNullOrEmpty(e.Message))
            {
                commandIdentifier = e.Message.Split(' ').FirstOrDefault();
            }

            if (AliasExecuted != null)
            {
                AliasExecutedEventArgs args = new AliasExecutedEventArgs()
                {
                    CommandIdentifier = commandIdentifier,
                    CommandArgs       = e
                };

                AliasExecuted(this, args);
            }
        }
コード例 #40
0
        protected async void Chat_BankCommand(TShockAPI.CommandArgs args)
        {
            IBankAccount selectedAccount = Parent.GetBankAccount(args.Player);
            IBankAccount callerAccount   = Parent.GetBankAccount(args.Player);
            string       namePrefix      = "Your";

            if (args.Parameters.Count == 0)
            {
                args.Player.SendInfoMessage(SEconomyPlugin.Locale.StringOrDefault(28, "This server is running {0} by Wolfje"), Parent.PluginInstance.GetVersionString());
                args.Player.SendInfoMessage(SEconomyPlugin.Locale.StringOrDefault(29, "Download here: http://plugins.tw.id.au"));
                args.Player.SendInfoMessage(SEconomyPlugin.Locale.StringOrDefault(230, "You can:"));

                args.Player.SendInfoMessage(SEconomyPlugin.Locale.StringOrDefault(31, "* View your balance with /bank bal"));

                if (args.Player.Group.HasPermission("bank.transfer"))
                {
                    args.Player.SendInfoMessage(SEconomyPlugin.Locale.StringOrDefault(32, "* Trade players with /bank pay <player> <amount>"));
                }

                if (args.Player.Group.HasPermission("bank.viewothers"))
                {
                    args.Player.SendInfoMessage(SEconomyPlugin.Locale.StringOrDefault(33, "* View other people's balance with /bank bal <player>"));
                }

                if (args.Player.Group.HasPermission("bank.worldtransfer"))
                {
                    args.Player.SendInfoMessage(SEconomyPlugin.Locale.StringOrDefault(34, "* Spawn/delete money with /bank give|take <player> <amount>"));
                }

                if (args.Player.Group.HasPermission("bank.mgr"))
                {
                    args.Player.SendInfoMessage(SEconomyPlugin.Locale.StringOrDefault(35, "* Spawn the account manager GUI on the server with /bank mgr"));
                }

                if (args.Player.Group.HasPermission("bank.savejournal"))
                {
                    args.Player.SendInfoMessage(SEconomyPlugin.Locale.StringOrDefault(36, "* Save the journal with /bank savejournal"));
                }

                if (args.Player.Group.HasPermission("bank.loadjournal"))
                {
                    args.Player.SendInfoMessage(SEconomyPlugin.Locale.StringOrDefault(37, "* Load the journal with /bank loadjournal"));
                }

                if (args.Player.Group.HasPermission("bank.squashjournal"))
                {
                    args.Player.SendInfoMessage(SEconomyPlugin.Locale.StringOrDefault(38, "* Compress the journal with /bank squashjournal"));
                }

                return;
            }

            if (args.Parameters[0].Equals("reset", StringComparison.CurrentCultureIgnoreCase))
            {
                if (args.Player.Group.HasPermission("seconomy.reset"))
                {
                    if (args.Parameters.Count >= 2 && !string.IsNullOrEmpty(args.Parameters[1]))
                    {
                        IBankAccount targetAccount = Parent.GetPlayerBankAccount(args.Parameters[1]);

                        if (targetAccount != null)
                        {
                            args.Player.SendInfoMessage(string.Format(SEconomyPlugin.Locale.StringOrDefault(39, "seconomy reset: Resetting {0}'s account."), args.Parameters[1]));
                            targetAccount.Transactions.Clear();
                            await targetAccount.SyncBalanceAsync();

                            args.Player.SendInfoMessage(SEconomyPlugin.Locale.StringOrDefault(40, "seconomy reset:  Reset complete."));
                        }
                        else
                        {
                            args.Player.SendErrorMessage(string.Format(SEconomyPlugin.Locale.StringOrDefault(41, "seconomy reset: Cannot find player \"{0}\" or no bank account found."), args.Parameters[1]));
                        }
                    }
                }
                else
                {
                    args.Player.SendErrorMessage(SEconomyPlugin.Locale.StringOrDefault(42, "seconomy reset: You do not have permission to perform this command."));
                }
            }

            //Bank balance
            if (args.Parameters[0].Equals("bal", StringComparison.CurrentCultureIgnoreCase) ||
                args.Parameters[0].Equals("balance", StringComparison.CurrentCultureIgnoreCase))
            {
                //The command supports viewing other people's balance if the caller has permission
                if (args.Player.Group.HasPermission("bank.viewothers"))
                {
                    if (args.Parameters.Count >= 2)
                    {
                        selectedAccount = Parent.GetPlayerBankAccount(args.Parameters[1]);
                        namePrefix      = args.Parameters[1] + "'s";
                    }
                }

                if (selectedAccount != null)
                {
                    if (!selectedAccount.IsAccountEnabled && !args.Player.Group.HasPermission("bank.viewothers"))
                    {
                        args.Player.SendErrorMessage(SEconomyPlugin.Locale.StringOrDefault(43, "bank balance: your account is disabled"));
                    }
                    else
                    {
                        args.Player.SendInfoMessage(SEconomyPlugin.Locale.StringOrDefault(44, "balance: {0} {1}"), selectedAccount.Balance.ToLongString(true),
                                                    selectedAccount.IsAccountEnabled ? "" : SEconomyPlugin.Locale.StringOrDefault(45, "(disabled)"));
                    }
                }
                else
                {
                    args.Player.SendInfoMessage(SEconomyPlugin.Locale.StringOrDefault(46, "bank balance: Cannot find player or no bank account."));
                }
            }
            else if (args.Parameters[0].Equals("mgr"))
            {
                if (args.Player.Group.HasPermission("bank.mgr"))
                {
                    if (args.Player is TShockAPI.TSServerPlayer)
                    {
                        Thread t = new Thread(() => {
                            Forms.CAccountManagementWnd wnd = new Forms.CAccountManagementWnd(Parent);
                            TShock.Log.ConsoleInfo(SEconomyPlugin.Locale.StringOrDefault(47, "seconomy mgr: opening bank manager window"));

                            //writing the journal is not possible when you're f*****g with it in the manager
                            //last thing you want is for half baked changes to be pushed to disk
                            Parent.RunningJournal.BackupsEnabled = false;

                            try {
                                wnd.ShowDialog();
                            } catch (Exception ex) {
                                TShock.Log.ConsoleError(SEconomyPlugin.Locale.StringOrDefault(48, "seconomy mgr: Window closed because it crashed: ") + ex.ToString());
                            }

                            Parent.RunningJournal.BackupsEnabled = true;
                            TShock.Log.ConsoleInfo(SEconomyPlugin.Locale.StringOrDefault(49, "seconomy management: window closed"));
                        });

                        t.SetApartmentState(ApartmentState.STA);
                        t.Start();
                    }
                    else
                    {
                        args.Player.SendErrorMessage(SEconomyPlugin.Locale.StringOrDefault(50, "Only the console can do that."));
                    }
                }
            }
            else if (args.Parameters[0].Equals("savejournal"))
            {
                if (args.Player.Group.HasPermission("bank.savejournal"))
                {
                    args.Player.SendInfoMessage(SEconomyPlugin.Locale.StringOrDefault(51, "seconomy xml: Backing up transaction journal."));

                    await Parent.RunningJournal.SaveJournalAsync();
                }
            }
            else if (args.Parameters[0].Equals("loadjournal"))
            {
                if (args.Player.Group.HasPermission("bank.loadjournal"))
                {
                    args.Player.SendInfoMessage(SEconomyPlugin.Locale.StringOrDefault(52, "seconomy xml: Loading transaction journal from file"));

                    await Parent.RunningJournal.LoadJournalAsync();
                }
            }
            else if (args.Parameters[0].Equals("squashjournal", StringComparison.CurrentCultureIgnoreCase))
            {
                if (args.Player.Group.HasPermission("bank.squashjournal"))
                {
                    await Parent.RunningJournal.SquashJournalAsync();

                    await Parent.RunningJournal.SaveJournalAsync();
                }
                else
                {
                    args.Player.SendErrorMessage(SEconomyPlugin.Locale.StringOrDefault(53, "bank squashjournal: You do not have permission to perform this command."));
                }
            }
            else if (args.Parameters[0].Equals("pay", StringComparison.CurrentCultureIgnoreCase) ||
                     args.Parameters[0].Equals("transfer", StringComparison.CurrentCultureIgnoreCase) ||
                     args.Parameters[0].Equals("tfr", StringComparison.CurrentCultureIgnoreCase))
            {
                //Player-to-player transfer

                if (args.Player.Group.HasPermission("bank.transfer"))
                {
                    // /bank pay wolfje 1p
                    if (args.Parameters.Count >= 3)
                    {
                        selectedAccount = Parent.GetPlayerBankAccount(args.Parameters[1]);
                        Money amount = 0;

                        if (selectedAccount == null)
                        {
                            args.Player.SendErrorMessage(SEconomyPlugin.Locale.StringOrDefault(54, "Cannot find player by the name of {0}."), args.Parameters[1]);
                        }
                        else
                        {
                            if (Money.TryParse(args.Parameters[2], out amount))
                            {
                                if (callerAccount == null)
                                {
                                    args.Player.SendErrorMessage("bank pay: Bank account error.");
                                    return;
                                }
                                //Instruct the world bank to give the player money.
                                await callerAccount.TransferToAsync(selectedAccount, amount,
                                                                    Journal.BankAccountTransferOptions.AnnounceToReceiver
                                                                    | Journal.BankAccountTransferOptions.AnnounceToSender
                                                                    | Journal.BankAccountTransferOptions.IsPlayerToPlayerTransfer,
                                                                    "",
                                                                    string.Format("SE: tfr: {0} to {1} for {2}", args.Player.Name, args.Parameters[1], amount.ToString()));
                            }
                            else
                            {
                                args.Player.SendErrorMessage(SEconomyPlugin.Locale.StringOrDefault(55, "bank give: \"{0}\" isn't a valid amount of money."), args.Parameters[2]);
                            }
                        }
                    }
                    else
                    {
                        args.Player.SendErrorMessage(SEconomyPlugin.Locale.StringOrDefault(56, "Usage: /bank pay [Player] [Amount]"));
                    }
                }
                else
                {
                    args.Player.SendErrorMessage(SEconomyPlugin.Locale.StringOrDefault(57, "bank pay: You don't have permission to do that."));
                }
            }
            else if (args.Parameters[0].Equals("give", StringComparison.CurrentCultureIgnoreCase) ||
                     args.Parameters[0].Equals("take", StringComparison.CurrentCultureIgnoreCase))
            {
                //World-to-player transfer

                if (args.Player.Group.HasPermission("bank.worldtransfer"))
                {
                    // /bank give wolfje 1p
                    if (args.Parameters.Count >= 3)
                    {
                        selectedAccount = Parent.GetPlayerBankAccount(args.Parameters[1]);
                        Money amount = 0;

                        if (selectedAccount == null)
                        {
                            args.Player.SendErrorMessage(SEconomyPlugin.Locale.StringOrDefault(54, "Cannot find player by the name of {0}."), args.Parameters[1]);
                        }
                        else
                        {
                            if (Money.TryParse(args.Parameters[2], out amount))
                            {
                                //eliminate a double-negative.  saying "take Player -1p1c" will give them 1 plat 1 copper!
                                if (args.Parameters[0].Equals("take", StringComparison.CurrentCultureIgnoreCase) && amount > 0)
                                {
                                    amount = -amount;
                                }

                                //Instruct the world bank to give the player money.
                                Parent.WorldAccount.TransferTo(selectedAccount, amount, Journal.BankAccountTransferOptions.AnnounceToReceiver, "", string.Format("SE: pay: {0} to {1} ", amount.ToString(), args.Parameters[1]));
                            }
                            else
                            {
                                args.Player.SendErrorMessage(SEconomyPlugin.Locale.StringOrDefault(55, "bank give: \"{0}\" isn't a valid amount of money."), args.Parameters[2]);
                            }
                        }
                    }
                    else
                    {
                        args.Player.SendErrorMessage(SEconomyPlugin.Locale.StringOrDefault(58, "Usage: /bank give|take [Player] [Amount]"));
                    }
                }
                else
                {
                    args.Player.SendErrorMessage(SEconomyPlugin.Locale.StringOrDefault(57, "bank give: You don't have permission to do that."));
                }
            }
        }
コード例 #41
0
ファイル: SEconomyPlugin.cs プロジェクト: pcgamerz/SEconomy
        protected async void TShock_CommandExecuted(TShockAPI.CommandArgs args)
        {
            if (args.Parameters.Count == 0)
            {
                args.Player.SendInfoMessage(string.Format(Locale.StringOrDefault(3, "{0} by Wolfje"), GetVersionString()));
                args.Player.SendInfoMessage(" * http://plugins.tw.id.au");
                args.Player.SendInfoMessage(Locale.StringOrDefault(5, " * /sec[onomy] reload|rl - Reloads SEconomy"));
                args.Player.SendInfoMessage(Locale.StringOrDefault(6, " * /sec[onomy] stop - Stops and unloads SEconomy"));
                args.Player.SendInfoMessage(Locale.StringOrDefault(7, " * /sec[onomy] start - Starts SEconomy"));
                return;
            }

            if ((args.Parameters[0].Equals("reload", StringComparison.CurrentCultureIgnoreCase) ||
                 args.Parameters[0].Equals("rl", StringComparison.CurrentCultureIgnoreCase)) &&
                args.Player.Group.HasPermission("seconomy.command.reload") == true)
            {
                try {
                    await Task.Run(async() => {
                        if (Instance != null)
                        {
                            Instance.Dispose();
                            Instance = null;
                            RaiseUnloadedEvent();
                        }

                        try {
                            Instance = new SEconomy(this);
                            if (Instance.LoadSEconomy() < 0)
                            {
                                throw new Exception("LoadSEconomy() failed.");
                            }
                            await Instance.BindToWorldAsync();
                            RaiseLoadedEvent();
                        } catch {
                            Instance = null;
                            TShock.Log.ConsoleError(genericErrorMessage);
                            throw;
                        }
                    });
                } catch {
                    RaiseUnloadedEvent();
                    args.Player.SendErrorMessage(Locale.StringOrDefault(12, "SEconomy failed to initialize, and will be unavailable for this session."));
                    return;
                }
                args.Player.SendSuccessMessage(Locale.StringOrDefault(8, "SEconomy is reloaded."));
            }
            else if (args.Parameters[0].Equals("stop", StringComparison.CurrentCultureIgnoreCase) &&
                     args.Player.Group.HasPermission("seconomy.command.stop") == true)
            {
                if (Instance == null)
                {
                    args.Player.SendErrorMessage(Locale.StringOrDefault(9, "seconomy stop: SEconomy is already stopped. Use /sec start to start"));
                    return;
                }

                await Task.Run(() => {
                    Instance.Dispose();
                    Instance = null;
                });

                args.Player.SendSuccessMessage(Locale.StringOrDefault(10, "SEconomy is stopped."));
                RaiseUnloadedEvent();
            }
            else if (args.Parameters[0].Equals("start", StringComparison.CurrentCultureIgnoreCase) &&
                     args.Player.Group.HasPermission("seconomy.command.start") == true)
            {
                if (Instance != null)
                {
                    args.Player.SendErrorMessage(Locale.StringOrDefault(11, "seconomy stop: SEconomy is already started. Use /sec stop to stop."));
                    return;
                }
                try {
                    await Task.Run(async() => {
                        try {
                            Instance = new SEconomy(this);
                            if (Instance.LoadSEconomy() < 0)
                            {
                                throw new Exception("LoadSEconomy() failed.");
                            }
                            await Instance.BindToWorldAsync();
                        } catch {
                            RaiseUnloadedEvent();
                            Instance = null;
                            TShock.Log.ConsoleError(genericErrorMessage);
                            throw;
                        }
                    });
                } catch {
                    args.Player.SendErrorMessage(Locale.StringOrDefault(12, "SEconomy failed to initialize, and will be unavailable for this session."));
                    return;
                }

                args.Player.SendSuccessMessage(Locale.StringOrDefault(13, "SEconomy has started."));
                RaiseLoadedEvent();
            }
            else if ((args.Parameters[0].Equals("multi", StringComparison.CurrentCultureIgnoreCase) ||
                      args.Parameters[0].Equals("multiplier", StringComparison.CurrentCultureIgnoreCase)) &&
                     args.Player.Group.HasPermission("seconomy.command.multi") == true)
            {
                RaiseUnloadedEvent();
                int multi = 0;

                if (args.Parameters.Count == 1)
                {
                    args.Player.SendInfoMessage("sec multi: Reward multiplier: {0}", SEconomyPlugin.Instance.WorldEc.CustomMultiplier);
                    return;
                }

                if (int.TryParse(args.Parameters[1], out multi) == false ||
                    multi < 0 ||
                    multi > 100)
                {
                    args.Player.SendErrorMessage("sec multi: Syntax: /sec multi[plier] 1-100");
                    return;
                }

                SEconomyPlugin.Instance.WorldEc.CustomMultiplier = multi;
                args.Player.SendInfoMessage("sec multi: Multiplier of {0} set successfully.", multi);
            }
        }
コード例 #42
0
        public static void StatusOptions(TShockAPI.CommandArgs args)
        {
            string text = null;

            if (args.Parameters.Count > 0)
            {
                text = args.Parameters[0].ToLower();
            }
            switch (text)
            {
            default:
                args.Player.SendErrorMessage("Uzycie: /status <opcja>");
                args.Player.SendInfoMessage("Opcje: cale, online, ping, konto, zgony, pvp, waznosc, postep");
                break;

            case "cale":
                if (SavingFormat.IsTrue(SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions, 0))
                {
                    SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions = SavingFormat.Change(SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions, 0, false);
                    args.Player.SendSuccessMessage("Status zostal calkowice wylaczony.");
                    args.Player.SendData(PacketTypes.Status);
                }
                else
                {
                    SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions = SavingFormat.Change(SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions, 0, true);
                    args.Player.SendSuccessMessage("Status zostal wlaczony.");
                }
                break;

            case "online":
                if (SavingFormat.IsTrue(SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions, 1))
                {
                    SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions = SavingFormat.Change(SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions, 1, false);
                    args.Player.SendSuccessMessage("Online w statusie zostal wylaczony.");
                }
                else
                {
                    SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions = SavingFormat.Change(SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions, 1, true);
                    args.Player.SendSuccessMessage("Online w statusie zostal wlaczony.");
                }
                break;

            case "konto":
                if (SavingFormat.IsTrue(SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions, 2))
                {
                    SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions = SavingFormat.Change(SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions, 2, false);
                    args.Player.SendSuccessMessage("Konto w statusie zostalo wylaczone.");
                }
                else
                {
                    SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions = SavingFormat.Change(SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions, 2, true);
                    args.Player.SendSuccessMessage("Konto w statusie zostalo wlaczone.");
                }
                break;

            case "zgony":
                if (SavingFormat.IsTrue(SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions, 3))
                {
                    SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions = SavingFormat.Change(SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions, 3, false);
                    args.Player.SendSuccessMessage("Zgony w statusie zostaly wylaczone.");
                }
                else
                {
                    SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions = SavingFormat.Change(SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions, 3, true);
                    args.Player.SendSuccessMessage("Zgony w statusie zostaly wlaczone.");
                }
                break;

            case "waznosc":
                if (SavingFormat.IsTrue(SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions, 4))
                {
                    SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions = SavingFormat.Change(SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions, 4, false);
                    args.Player.SendSuccessMessage("Waznosc w statusie zostala wylaczona.");
                }
                else
                {
                    SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions = SavingFormat.Change(SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions, 4, true);
                    args.Player.SendSuccessMessage("Waznosc w statusie zostala wlaczona.");
                }
                break;

            case "Postep":
                if (SavingFormat.IsTrue(SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions, 5))
                {
                    SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions = SavingFormat.Change(SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions, 5, false);
                    args.Player.SendSuccessMessage("Postep w statusie zostal wylaczony.");
                }
                else
                {
                    SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions = SavingFormat.Change(SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions, 5, true);
                    args.Player.SendSuccessMessage("Postep w statusie zostal wlaczony.");
                }
                break;

            case "pvp":
                if (SavingFormat.IsTrue(SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions, 6))
                {
                    SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions = SavingFormat.Change(SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions, 6, false);
                    args.Player.SendSuccessMessage("PVP w statusie zostalo wylaczone.");
                }
                else
                {
                    SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions = SavingFormat.Change(SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions, 6, true);
                    args.Player.SendSuccessMessage("PVP w statusie zostalo wlaczone.");
                }
                break;

            case "ping":
                if (SavingFormat.IsTrue(SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions, 7))
                {
                    SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions = SavingFormat.Change(SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions, 7, false);
                    args.Player.SendSuccessMessage("Ping w statusie zostal wylaczony.");
                }
                else
                {
                    SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions = SavingFormat.Change(SurvivalCore.SrvPlayers[args.Player.Index].StatusOptions, 7, true);
                    args.Player.SendSuccessMessage("Ping w statusie zostal wlaczony.");
                }
                break;
            }
        }
コード例 #43
0
        public static void Top(TShockAPI.CommandArgs args)
        {
            string text = null;

            if (args.Parameters.Count > 0)
            {
                text = args.Parameters[0].ToLower();
            }

            switch (text)
            {
            default:
                args.Player.SendErrorMessage("Uzycie: /top <kasa/pvp/czasgry/zgony>");
                break;

            case "kasa":
            {
                Dictionary <string, int> topKasa = QueryPlr.GetTopKasa(args.Player.Name);
                int   num3   = 1;
                Color color3 = Color.Gold;
                args.Player.SendMessage("               [c/595959:«]Top 5 - Kasa[c/595959:»]", Color.LightGray);
                foreach (string key in topKasa.Keys)
                {
                    args.Player.SendMessage(
                        string.Format("{0}# [c/595959:-] {1} [c/595959:(]{2} €[c/595959:)]", num3, key,
                                      topKasa[key].ToString("N0")), color3);
                    num3++;
                    switch (num3)
                    {
                    case 2:
                        color3 = Color.Silver;
                        break;

                    case 3:
                        color3 = new Color(205, 127, 50);
                        break;

                    default:
                        color3 = Color.Gray;
                        break;
                    }
                }

                break;
            }

            case "pvp":
            {
                Dictionary <string, double[]> topPvp = DataBase.GetTopPvp(args.Player.Name);
                int   num2   = 1;
                Color color2 = Color.Gold;
                args.Player.SendMessage("              [c/595959:«]Top 5 - PvP[c/595959:»]", Color.LightGray);
                foreach (string key2 in topPvp.Keys)
                {
                    args.Player.SendMessage(
                        $"{num2}# [c/595959:-] {key2} [c/595959:(]{topPvp[key2][0]}/{topPvp[key2][1]} | {topPvp[key2][2]}[c/595959:)]",
                        color2);
                    num2++;
                    switch (num2)
                    {
                    case 2:
                        color2 = Color.Silver;
                        break;

                    case 3:
                        color2 = new Color(205, 127, 50);
                        break;

                    default:
                        color2 = Color.Gray;
                        break;
                    }
                }

                break;
            }

            case "czasgry":
            {
                Dictionary <string, TimeSpan> topCzasGry = DataBase.GetTopCzasGry(args.Player.Name);
                int   num   = 1;
                Color color = Color.Gold;
                args.Player.SendMessage("             [c/595959:«]Top 5 - Czas Gry[c/595959:»]", Color.LightGray);
                foreach (string key3 in topCzasGry.Keys)
                {
                    args.Player.SendMessage(
                        $"{num}# [c/595959:-] {key3} [c/595959:(]{Math.Round(topCzasGry[key3].TotalHours, 1)} h[c/595959:)]",
                        color);
                    num++;
                    switch (num)
                    {
                    case 2:
                        color = Color.Silver;
                        break;

                    case 3:
                        color = new Color(205, 127, 50);
                        break;

                    default:
                        color = Color.Gray;
                        break;
                    }
                }

                break;
            }

            case "zgony":
            {
                Dictionary <string, int> topZgony = DataBase.GetTopZgony(args.Player.Name);
                int   num   = 1;
                Color color = Color.Gold;
                args.Player.SendMessage("               [c/595959:«]Top 5 - Zgony[c/595959:»]", Color.LightGray);
                foreach (string key in topZgony.Keys)
                {
                    args.Player.SendMessage(
                        $"{num}# [c/595959:-] {key} [c/595959:(]{topZgony[key]}[c/595959:)]",
                        color);
                    num++;
                    switch (num)
                    {
                    case 2:
                        color = Color.Silver;
                        break;

                    case 3:
                        color = new Color(205, 127, 50);
                        break;

                    default:
                        color = Color.Gray;
                        break;
                    }
                }

                break;
            }
            }
        }
コード例 #44
0
        public static void Przywolywanie(TShockAPI.CommandArgs args)
        {
            string text  = null;
            string text2 = null;

            if (args.Parameters.Count > 0)
            {
                text = args.Parameters[0].ToLower();
            }

            if (args.Parameters.Count > 1)
            {
                text2 = args.Parameters[1].ToLower();
            }

            if ((SurvivalCore.SrvPlayers[args.Player.Index].BossCooldown - DateTime.Now).TotalSeconds > 0)
            {
                args.Player.SendErrorMessage($"Musisz odczekac jakis czas, aby moc zrespic kolejnego bossa. Mozliwe to bedzie za {PowelderAPI.Utils.ExpireCountDown(SurvivalCore.SrvPlayers[args.Player.Index].BossCooldown)}");
                return;
            }

            switch (text)
            {
            default:
                args.Player.SendErrorMessage("Uzycie: /przywolaj <co>");
                break;

            case "wof":
            case "wall of flesh":
            {
                Item itemById = TShock.Utils.GetItemById(267);
                if (PowelderAPI.Utils.PlayerItemCount(args.Player, itemById) < 1)
                {
                    args.Player.SendErrorMessage("Nie masz wymaganych materialow w ekwipunku.");
                    args.Player.SendErrorMessage("Wymagane:  [i:267]");
                    break;
                }

                if (!Goals.IsDone(113))
                {
                    args.Player.SendErrorMessage("Ten boss w tej chwili jest zablokowany.");
                    return;
                }

                if (Main.wofNPCIndex >= 0)
                {
                    args.Player.SendErrorMessage("Wall of Flesh juz jest na swiecie.");
                    break;
                }

                if (args.Player.Y / 16f < (float)(Main.maxTilesY - 205))
                {
                    args.Player.SendErrorMessage("Musisz byc w piekle, aby przywolac Wall of Flesha.");
                    break;
                }

                PowelderAPI.Utils.PlayerRemoveItems(args.Player, itemById, 1);
                NPC.SpawnWOF(new Vector2(args.Player.X, args.Player.Y));
                TSPlayer.All.SendInfoMessage("{0} przywolal Wall of Flesha.", args.Player.Name);
                break;
            }

            case "lunatic":
            case "Lun":
            case "lc":
            case "lunatic cultist":
            {
                NPC nPc2 = new NPC();
                nPc2.SetDefaults(439);
                if (!NPC.downedGolemBoss)
                {
                    args.Player.SendErrorMessage("Przywolanie bedzie mozliwe po pokonaniu Golema.");
                    break;
                }

                if (!Goals.IsDone(439))
                {
                    args.Player.SendErrorMessage("Ten boss w tej chwili jest zablokowany.");
                    return;
                }

                if (PowelderAPI.Utils.IsNpcOnWorld(nPc2.type))
                {
                    args.Player.SendErrorMessage("Lunatic Cultist juz jest na swiecie.");
                    break;
                }


                if (PowelderAPI.Utils.PlayerItemCount(args.Player, TShock.Utils.GetItemById(1274)) < 1 ||
                    PowelderAPI.Utils.PlayerItemCount(args.Player, TShock.Utils.GetItemById(148)) < 5)
                {
                    args.Player.SendErrorMessage("Nie masz wymaganych materialow w ekwipunku.");
                    args.Player.SendErrorMessage("Wymagane:  [i:1274] [i/s5:148]");
                    break;
                }

                PowelderAPI.Utils.PlayerRemoveItems(args.Player, TShock.Utils.GetItemById(1274), 1);
                PowelderAPI.Utils.PlayerRemoveItems(args.Player, TShock.Utils.GetItemById(148), 5);
                TSPlayer.Server.SpawnNPC(nPc2.type, nPc2.FullName, 1, args.Player.TileX, args.Player.TileY);
                break;
            }

            case "martians":
            case "martian madness":
            case "mm":
            case "martian":
            {
                if (!NPC.downedGolemBoss)
                {
                    args.Player.SendErrorMessage("Przywolanie bedzie mozliwe po pokonaniu Golema.");
                    break;
                }

                if (Main.invasionType != 0)
                {
                    args.Player.SendErrorMessage("Na swiecie juz jest jakas inwazja.");
                    break;
                }

                int cost = Utils.CostCalc(args.Player, 3500);
                if (SurvivalCore.SrvPlayers[args.Player.Index].Money < cost)
                {
                    args.Player.SendErrorMessage("Nie stac Cie na rozpoczecie tego eventu. Koszt to {0} €", cost);
                    break;
                }

                if (PowelderAPI.Utils.PlayerItemCount(args.Player, TShock.Utils.GetItemById(3118)) < 1 ||
                    PowelderAPI.Utils.PlayerItemCount(args.Player, TShock.Utils.GetItemById(530)) < 95)
                {
                    args.Player.SendErrorMessage("Nie masz wymaganych materialow w ekwipunku.");
                    args.Player.SendErrorMessage("Wymagane:  [i:3118] [i/s5:148]");
                }
                else
                {
                    PowelderAPI.Utils.PlayerRemoveItems(args.Player, TShock.Utils.GetItemById(3118), 1);
                    PowelderAPI.Utils.PlayerRemoveItems(args.Player, TShock.Utils.GetItemById(530), 95);
                }

                break;
            }

            case "skeletron":
            case "skele":
            {
                NPC nPc = new NPC();
                nPc.SetDefaults(35);
                if (!NPC.downedBoss3)
                {
                    args.Player.SendErrorMessage("Przywolanie bedzie mozliwe po pierwszym pokonaniu Skeletrona.");
                    break;
                }

                if (PowelderAPI.Utils.IsNpcOnWorld(nPc.type))
                {
                    args.Player.SendErrorMessage("Skeletron juz jest na swiecie.");
                    break;
                }

                if (Main.dayTime)
                {
                    args.Player.SendErrorMessage("Przywolanie jest mozliwe tylko w nocy.");
                    break;
                }


                if (PowelderAPI.Utils.PlayerItemCount(args.Player, TShock.Utils.GetItemById(1307)) < 1)
                {
                    args.Player.SendErrorMessage("Nie masz wymaganych materialow w ekwipunku.");
                    args.Player.SendErrorMessage("Wymagane:  [i:1307]");
                    break;
                }

                PowelderAPI.Utils.PlayerRemoveItems(args.Player, TShock.Utils.GetItemById(1307), 1);
                TSPlayer.Server.SpawnNPC(nPc.type, nPc.FullName, 1, args.Player.TileX, args.Player.TileY);
                TSPlayer.All.SendInfoMessage("{0} przywolal Skeletrona.", args.Player.Name);
                break;
            }
            }
        }