当前位置: 首页>>代码示例>>C#>>正文


C# TSPlayer.SendMessage方法代码示例

本文整理汇总了C#中TShockAPI.TSPlayer.SendMessage方法的典型用法代码示例。如果您正苦于以下问题:C# TSPlayer.SendMessage方法的具体用法?C# TSPlayer.SendMessage怎么用?C# TSPlayer.SendMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TShockAPI.TSPlayer的用法示例。


在下文中一共展示了TSPlayer.SendMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DisplaySearchResults

 public static void DisplaySearchResults(TSPlayer Player, List<object> Results, int Page)
 {
     if (Results[0] is Item)
         Player.SendInfoMessage("Item Search:");
     else if (Results[0] is NPC)
         Player.SendInfoMessage("NPC Search:");
     var sb = new StringBuilder();
     if (Results.Count > (8 * (Page - 1)))
     {
         for (int j = (8 * (Page - 1)); j < (8 * Page); j++)
         {
             if (sb.Length != 0)
                 sb.Append(" | ");
             if (Results[j] is Item)
                 sb.Append(((Item)Results[j]).netID).Append(": ").Append(((Item)Results[j]).name);
             else if (Results[j] is NPC)
                 sb.Append(((NPC)Results[j]).netID).Append(": ").Append(((NPC)Results[j]).name);
             if (j == Results.Count - 1)
             {
                 Player.SendMessage(sb.ToString(), Color.MediumSeaGreen);
                 break;
             }
             if ((j + 1) % 2 == 0)
             {
                 Player.SendMessage(sb.ToString(), Color.MediumSeaGreen);
                 sb.Clear();
             }
         }
     }
     if (Results.Count > (8 * Page))
     {
         Player.SendMessage(string.Format("Type /spage {0} for more Results.", (Page + 1)), Color.Yellow);
     }
 }
开发者ID:veryslowking,项目名称:Essentials-SignCommands,代码行数:34,代码来源:esUtils.cs

示例2: NotifyAdministrator

 private static void NotifyAdministrator(TSPlayer player, string[] changes)
 {
     player.SendMessage("The server is out of date.", Color.Red);
     for (int j = 0; j < changes.Length; j++)
     {
         player.SendMessage(changes[j], Color.Red);
     }
 }
开发者ID:kalaikaqu,项目名称:TShock,代码行数:8,代码来源:UpdateManager.cs

示例3: NotifyAdministrator

 private void NotifyAdministrator(TSPlayer player, string[] changes)
 {
     player.SendMessage("您现在使用的版本为 TshockCn beta 5 (Tshock 4.3.12)\r\n正在检测服务器版本是否有更新,请稍后!\r\n少女祈祷中...\r\n检测成功,请注意版本信息!: ", Color.Red);
     for (int j = 0; j < changes.Length; j++)
     {
         player.SendMessage(changes[j], Color.Red);
     }
 }
开发者ID:sylar605,项目名称:TshockCN,代码行数:8,代码来源:UpdateManager.cs

示例4: GetBalance

        public void GetBalance(TSPlayer player)
        {
            BankManager manager = new BankManager(TShock.DB);

            var account = manager.GetBalance(player.UserAccountName);

            player.SendMessage(string.Format("Your account has a balance of: {0}", account.Amount), Color.Green);
        }
开发者ID:middas,项目名称:ExtendedAdmin,代码行数:8,代码来源:BankHandler.cs

示例5: Info

 public static void Info(TSPlayer to, string message)
 {
     if (to is TSServerPlayer)
     {
         to.SendInfoMessage(message);
         return;
     }
     to.SendMessage(message, Color.Yellow);
 }
开发者ID:Brunban2,项目名称:Essentials-SignCommands,代码行数:9,代码来源:Send.cs

示例6: Error

 public static void Error(TSPlayer to, string message)
 {
     if (to is TSServerPlayer)
     {
         to.SendErrorMessage(message);
         return;
     }
     to.SendMessage(message, Color.OrangeRed);
 }
开发者ID:Brunban2,项目名称:Essentials-SignCommands,代码行数:9,代码来源:Send.cs

示例7: Success

 public static void Success(TSPlayer to, string message)
 {
     if (to is TSServerPlayer)
     {
         to.SendSuccessMessage(message);
         return;
     }
     to.SendMessage(message, Color.MediumSeaGreen);
 }
开发者ID:Brunban2,项目名称:Essentials-SignCommands,代码行数:9,代码来源:Send.cs

示例8: Deposit

        public void Deposit(TSPlayer player, int amount)
        {
            if (!CheckInRegion(player))
            {
                return;
            }

            BankManager manager = new BankManager(TShock.DB);

            var account = manager.GetBalance(player.UserAccountName);

            //// piggy back on the raffle manager to get shards
            //RaffleManager raffleManager = new RaffleManager(TShock.DB);

            //var shards = raffleManager.GetServerPointAccounts(player.UserAccountName);
            try
            {
                var ePlayer = ServerPointSystem.ServerPointSystem.EPRPlayers.Single(p => p.TSPlayer == player);

                if (ePlayer.DisplayAccount < amount)
                {
                    player.SendMessage("You do not have the required shards.", Color.Red);
                }
                else
                {
                    manager.Deposit(player.UserAccountName, amount);

                    ServerPointSystem.EPREvents.PointOperate(ePlayer, -amount, ServerPointSystem.PointOperateReason.Deduct);

                    //ServerPointSystem.ServerPointSystem.Deduct(new CommandArgs("deduct", player, new List<string>()
                    //{
                    //    player.UserAccountName,
                    //    amount.ToString()
                    //}));

                    player.SendMessage("You have successfully deposited into your account.", Color.Green);
                }
            }
            catch (Exception ex)
            {
                player.SendMessage("Could not deposit at this time.", Color.Red);
            }
        }
开发者ID:middas,项目名称:ExtendedAdmin,代码行数:43,代码来源:BankHandler.cs

示例9: giveItems

        public void giveItems(TSPlayer ply)
        {
            foreach (KitItem i in items)
            {
                Item item = TShock.Utils.GetItemById(i.id);
                int amount = Math.Min(item.maxStack, i.amt);
                if (item != null)
                    ply.GiveItem(item.type, item.name, item.width, item.height, amount);
            }

            ply.SendMessage(String.Format("{0} kit given. Enjoy!", name), Color.Green);
        }
开发者ID:stevenh,项目名称:Essentials-SignCommands,代码行数:12,代码来源:scKits.cs

示例10: communicate

 public static void communicate(int what, TSPlayer to, string parameter)
 {
     switch(what)
     {
     case InvalidSyntax:
         to.SendMessage("Invalid syntax. Proper syntax: " + Commands.SLASH_COMMAND + " " + parameter, Color.Red);
         break;
     case NoPermission:
         to.SendMessage("No permissions for box: " + parameter, Color.Red);
         break;
     case BoxNotFound:
         to.SendMessage("Box not found: " + parameter, Color.Red);
         break;
     case PlayerNotFound:
         to.SendMessage("Player not found: " + parameter, Color.Red);
         break;
     case GroupNotFound:
         to.SendMessage("Group not found: " + parameter, Color.Red);
         break;
     case TypeForMore:
         to.SendMessage("Type " + Commands.SLASH_COMMAND + " list " + parameter + " for more boxes.");
         break;
     case CustomError:
         to.SendMessage(parameter, Color.Red);
         break;
     case CustomSuccess:
         to.SendMessage(parameter, Color.LightGreen);
         break;
     case CustomInfo:
         to.SendMessage(parameter, Color.Azure);
         break;
     case CustomWarning:
         to.SendMessage(parameter, Color.Yellow);
         break;
     }
 }
开发者ID:mawize,项目名称:Boxes,代码行数:36,代码来源:ChatHandler.cs

示例11: Withdraw

        public void Withdraw(TSPlayer player, int amount)
        {
            if (!CheckInRegion(player))
            {
                return;
            }

            BankManager manager = new BankManager(TShock.DB);

            var account = manager.GetBalance(player.UserAccountName);

            if (account.Amount - amount < 0)
            {
                player.SendMessage("You do not have enough to withdraw that amount.", Color.Red);
            }
            else
            {
                try
                {
                    var ePlayer = ServerPointSystem.ServerPointSystem.EPRPlayers.Single(p => p.TSPlayer == player);

                    manager.Withdraw(player.UserAccountName, amount);

                    ServerPointSystem.EPREvents.PointOperate(ePlayer, amount, ServerPointSystem.PointOperateReason.Award);

                    //ServerPointSystem.ServerPointSystem.Award(new CommandArgs("award", player, new List<string>()
                    //{
                    //    player.Name,
                    //    amount.ToString()
                    //}));

                    player.SendMessage("You have successfully withdrawn from your account.", Color.Green);
                }
                catch (Exception ex)
                {
                    player.SendMessage("Could not withdraw shards at this time.", Color.Red);
                }
            }
        }
开发者ID:middas,项目名称:ExtendedAdmin,代码行数:39,代码来源:BankHandler.cs

示例12: giveItems

        public void giveItems( TSPlayer ply)
        {
            foreach( KitItem i in items )
            {
                List<Item> itemList = TShock.Utils.GetItemByIdOrName(i.id);
                if (itemList.Count == 0)
                {
                    Log.ConsoleError(String.Format("The specified item does not exist: {0}", i.id) );
                    continue;
                }
                else if( itemList.Count > 1 )
                {
                    Log.ConsoleError(String.Format("The specified item has multiple entries: {0}.\n Using the first item.", i.id));
                }

                Item item = itemList[0];

                int amount = Math.Min(item.maxStack, i.amt);
                if( item != null )
                    ply.GiveItem(item.type, item.name, item.width, item.height, amount);
            }

            ply.SendMessage( String.Format("{0} kit given. Enjoy!", name), Color.Green );
        }
开发者ID:Olink,项目名称:Kits,代码行数:24,代码来源:Kit.cs

示例13: HackedInventory

        public static bool HackedInventory(TSPlayer player)
        {
            bool check = false;

            Item[] inventory = player.TPlayer.inventory;
            Item[] armor = player.TPlayer.armor;
            for (int i = 0; i < NetItem.maxNetInventory; i++)
            {
                if (i < 49)
                {
                    Item item = new Item();
                    if (inventory[i] != null && inventory[i].netID != 0)
                    {
                        item.netDefaults(inventory[i].netID);
                        item.Prefix(inventory[i].prefix);
                        item.AffixName();
                        if (inventory[i].stack > item.maxStack)
                        {
                            check = true;
                            player.SendMessage(
                                String.Format("Stack cheat detected. Remove item {0} ({1}) and then rejoin", item.name, inventory[i].stack),
                                Color.Cyan);
                        }
                    }
                }
                else
                {
                    Item item = new Item();
                    if (armor[i - 48] != null && armor[i - 48].netID != 0)
                    {
                        item.netDefaults(armor[i - 48].netID);
                        item.Prefix(armor[i - 48].prefix);
                        item.AffixName();
                        if (armor[i - 48].stack > item.maxStack)
                        {
                            check = true;
                            player.SendMessage(
                                String.Format("Stack cheat detected. Remove armor {0} ({1}) and then rejoin", item.name, armor[i - 48].stack),
                                Color.Cyan);
                        }
                    }
                }
            }

            return check;
        }
开发者ID:InanZen,项目名称:TShock,代码行数:46,代码来源:TShock.cs

示例14: CheckTilePermission

        public static bool CheckTilePermission(TSPlayer player, int tileX, int tileY)
        {
            if (!player.Group.HasPermission(Permissions.canbuild))
            {

            if (((DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) - player.BPm) > 2000){
                    player.SendMessage("You do not have permission to build!", Color.Red);
                    player.BPm=DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
                    }
                return true;
            }

            if (!player.Group.HasPermission(Permissions.editspawn) && !Regions.CanBuild(tileX, tileY, player) &&
                Regions.InArea(tileX, tileY))
            {

            if (((DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) - player.RPm) > 2000){
                        player.SendMessage("Region protected from changes.", Color.Red);
                        player.RPm=DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
                        }
                return true;
            }

            if (Config.DisableBuild)
            {
                if (!player.Group.HasPermission(Permissions.editspawn))
                {
                if (((DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) - player.WPm) > 2000){
                        player.SendMessage("World protected from changes.", Color.Red);
                        player.WPm=DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
                        }
                    return true;
                }
            }
            if (Config.SpawnProtection)
            {
                if (!player.Group.HasPermission(Permissions.editspawn))
                {
                    var flag = CheckSpawn(tileX, tileY);
                    if (flag)
                    {
                    if (((DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) - player.SPm) > 1000){
                        player.SendMessage("Spawn protected from changes.", Color.Red);
                        player.SPm=DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;

                        }

                        return true;
                    }
                }
            }
            return false;
        }
开发者ID:InanZen,项目名称:TShock,代码行数:53,代码来源:TShock.cs

示例15: CheckInventory

        public static bool CheckInventory(TSPlayer player)
        {
            PlayerData playerData = player.PlayerData;
            bool check = true;

            if (player.TPlayer.statLifeMax > playerData.maxHealth)
            {
                player.SendMessage("Error: Your max health exceeded (" + playerData.maxHealth + ") which is stored on server",
                                   Color.Cyan);
                check = false;
            }

            Item[] inventory = player.TPlayer.inventory;
            Item[] armor = player.TPlayer.armor;
            for (int i = 0; i < NetItem.maxNetInventory; i++)
            {
                if (i < 49)
                {
                    Item item = new Item();
                    Item serverItem = new Item();
                    if (inventory[i] != null && inventory[i].netID != 0)
                    {
                        if (playerData.inventory[i].netID != inventory[i].netID)
                        {
                            item.netDefaults(inventory[i].netID);
                            item.Prefix(inventory[i].prefix);
                            item.AffixName();
                            player.SendMessage(player.IgnoreActionsForInventory = "Your item (" + item.name + ") needs to be deleted.",
                                               Color.Cyan);
                            check = false;
                        }
                        else if (playerData.inventory[i].prefix != inventory[i].prefix)
                        {
                            item.netDefaults(inventory[i].netID);
                            item.Prefix(inventory[i].prefix);
                            item.AffixName();
                            player.SendMessage(player.IgnoreActionsForInventory = "Your item (" + item.name + ") needs to be deleted.",
                                               Color.Cyan);
                            check = false;
                        }
                        else if (inventory[i].stack > playerData.inventory[i].stack)
                        {
                            item.netDefaults(inventory[i].netID);
                            item.Prefix(inventory[i].prefix);
                            item.AffixName();
                            player.SendMessage(
                                player.IgnoreActionsForInventory =
                                "Your item (" + item.name + ") (" + inventory[i].stack + ") needs to have it's stack decreased to (" +
                                playerData.inventory[i].stack + ").", Color.Cyan);
                            check = false;
                        }
                    }
                }
                else
                {
                    Item item = new Item();
                    Item serverItem = new Item();
                    if (armor[i - 48] != null && armor[i - 48].netID != 0)
                    {
                        if (playerData.inventory[i].netID != armor[i - 48].netID)
                        {
                            item.netDefaults(armor[i - 48].netID);
                            item.Prefix(armor[i - 48].prefix);
                            item.AffixName();
                            player.SendMessage(player.IgnoreActionsForInventory = "Your armor (" + item.name + ") needs to be deleted.",
                                               Color.Cyan);
                            check = false;
                        }
                        else if (playerData.inventory[i].prefix != armor[i - 48].prefix)
                        {
                            item.netDefaults(armor[i - 48].netID);
                            item.Prefix(armor[i - 48].prefix);
                            item.AffixName();
                            player.SendMessage(player.IgnoreActionsForInventory = "Your armor (" + item.name + ") needs to be deleted.",
                                               Color.Cyan);
                            check = false;
                        }
                        else if (armor[i - 48].stack > playerData.inventory[i].stack)
                        {
                            item.netDefaults(armor[i - 48].netID);
                            item.Prefix(armor[i - 48].prefix);
                            item.AffixName();
                            player.SendMessage(
                                player.IgnoreActionsForInventory =
                                "Your armor (" + item.name + ") (" + inventory[i].stack + ") needs to have it's stack decreased to (" +
                                playerData.inventory[i].stack + ").", Color.Cyan);
                            check = false;
                        }
                    }
                }
            }

            return check;
        }
开发者ID:InanZen,项目名称:TShock,代码行数:94,代码来源:TShock.cs


注:本文中的TShockAPI.TSPlayer.SendMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。