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


C# TSPlayer.SendInfoMessage方法代码示例

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


在下文中一共展示了TSPlayer.SendInfoMessage方法的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: 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

示例3: DisplaySearchResults

 public static void DisplaySearchResults(TSPlayer Player, string type, Dictionary<string, int> Results, int Page)
 {
     Player.SendInfoMessage(type + " 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(" | ");
       sb.Append(Results.ElementAt(j).Key).Append(": ").Append(Results.ElementAt(j).Value);
       if (j == Results.Count - 1) {
     Player.SendSuccessMessage(sb.ToString());
     break;
       }
       if ((j + 1) % 2 == 0) {
     Player.SendSuccessMessage(sb.ToString());
     sb.Clear();
       }
     }
       }
       if (Results.Count > (8 * Page)) {
     Player.SendInfoMessage("Type /spage {0} for more Results.", Page + 1);
       }
 }
开发者ID:Stealownz,项目名称:Essentials-SignCommands-1,代码行数:23,代码来源:esUtils.cs

示例4: StartShareCommandInteraction

        private void StartShareCommandInteraction(
            TSPlayer player, bool isPersistent, bool isShareOrUnshare, bool isGroup, bool isShareAll,
            object shareTarget = null, string shareTargetName = null
            )
        {
            CommandInteraction interaction = this.StartOrResetCommandInteraction(player);
              interaction.DoesNeverComplete = isPersistent;
              interaction.TileEditCallback += (playerLocal, editType, tileId, location, objectStyle) => {
            if (
              editType != TileEditType.PlaceTile ||
              editType != TileEditType.PlaceWall ||
              editType != TileEditType.DestroyWall ||
              editType != TileEditType.PlaceActuator
            ) {
              this.TryAlterProtectionShare(playerLocal, location, isShareOrUnshare, isGroup, isShareAll, shareTarget, shareTargetName);

              playerLocal.SendTileSquare(location);
              return new CommandInteractionResult { IsHandled = true, IsInteractionCompleted = true };
            }

            playerLocal.SendTileSquare(location);
            return new CommandInteractionResult { IsHandled = false, IsInteractionCompleted = false };
              };
              Func<TSPlayer,DPoint,CommandInteractionResult> usageCallbackFunc = (playerLocal, location) => {
            this.TryAlterProtectionShare(playerLocal, location, isShareOrUnshare, isGroup, isShareAll, shareTarget, shareTargetName);
            playerLocal.SendTileSquare(location, 3);

            return new CommandInteractionResult { IsHandled = true, IsInteractionCompleted = true };
              };
              interaction.SignReadCallback += usageCallbackFunc;
              interaction.ChestOpenCallback += usageCallbackFunc;
              interaction.HitSwitchCallback += usageCallbackFunc;
              interaction.SignEditCallback += (playerLocal, signIndex, location, newText) => {
            this.TryAlterProtectionShare(playerLocal, location, isShareOrUnshare, isGroup, isShareAll, shareTarget, shareTargetName);
            return new CommandInteractionResult { IsHandled = true, IsInteractionCompleted = true };
              };

              interaction.TimeExpiredCallback += (playerLocal) => {
            if (isShareOrUnshare)
              playerLocal.SendMessage("Waited too long. No protection will be shared.", Color.Red);
            else
              playerLocal.SendMessage("Waited too long. No protection will be unshared.", Color.Red);
              };

              if (isShareOrUnshare)
            player.SendInfoMessage("Hit or use the protected object or block you want to share.");
              else
            player.SendInfoMessage("Hit or use the protected object or block you want to unshare.");
        }
开发者ID:CoderCow,项目名称:Protector-Plugin,代码行数:49,代码来源:UserInteractionHandler.cs

示例5: EnsureProtectionData

        public void EnsureProtectionData(TSPlayer player)
        {
            int invalidProtectionsCount;
              int invalidRefillChestCount;
              int invalidBankChestCount;

              this.ProtectionManager.EnsureProtectionData(
            false, out invalidProtectionsCount, out invalidRefillChestCount, out invalidBankChestCount);

              if (player != TSPlayer.Server) {
            if (invalidProtectionsCount > 0)
              player.SendWarningMessage("{0} invalid protections removed.", invalidProtectionsCount);
            if (invalidRefillChestCount > 0)
              player.SendWarningMessage("{0} invalid refill chests removed.", invalidRefillChestCount);
            if (invalidBankChestCount > 0)
              player.SendWarningMessage("{0} invalid bank chest instances removed.", invalidBankChestCount);

            player.SendInfoMessage("Finished ensuring protection data.");
              }

              if (invalidProtectionsCount > 0)
            this.PluginTrace.WriteLineWarning("{0} invalid protections removed.", invalidProtectionsCount);
              if (invalidRefillChestCount > 0)
            this.PluginTrace.WriteLineWarning("{0} invalid refill chests removed.", invalidRefillChestCount);
              if (invalidBankChestCount > 0)
            this.PluginTrace.WriteLineWarning("{0} invalid bank chest instances removed.", invalidBankChestCount);

              this.PluginTrace.WriteLineInfo("Finished ensuring protection data.");
        }
开发者ID:CoderCow,项目名称:Protector-Plugin,代码行数:29,代码来源:UserInteractionHandler.cs

示例6: searchQuotes

        private void searchQuotes(TSPlayer player, string searchterm)
        {
            List<int> quoteresults = new List<int>();

            for (int i = 0; i < quotelist.Count; i++)
            {
                if (quotelist[i].qquote.ToLower().Contains(searchterm.ToLower()))
                {
                    quoteresults.Add(i);
                }
            }

            if (quoteresults.Count < 1)
            {
                player.SendInfoMessage("No quotes matched your search.");
            }
            else if (quoteresults.Count > 1)
            {
                string outputresults = string.Join(", ", quoteresults.Select(p => (p+1).ToString()));
                player.SendInfoMessage("Multiple quotes matched your search: " + outputresults);
            }
            else
            {
                    QuoteClass readQuote = quotelist[quoteresults[0]];
                    if (!readQuote.qdeleted)
                        player.SendMessage("[" + readQuote.qtime + "] Quote #" + (quoteresults[0] + 1).ToString() + " by " + readQuote.qauthor + ": " + readQuote.qquote, Color.LawnGreen);
                    else
                        player.SendErrorMessage("No quotes matched your search.");
            }
        }
开发者ID:Zaicon,项目名称:Quotes,代码行数:30,代码来源:Quotes.cs

示例7: Update


//.........这里部分代码省略.........
            }
            if (regionStorage.flags.Contains("PRIVATE") && !bypassFlag)
            {
                if (!gotWarnMessage)
                {
                    player.Teleport(lastPos.X, lastPos.Y, 1);
                    player.SendErrorMessage("No permission to enter private region!");
                    gotWarnMessage = true;
                }
            }
            if (regionStorage.flags.Contains("PVP") && !bypassFlag)
            {
                if (!player.TPlayer.hostile)
                {
                    player.SendSuccessMessage("PVP arena entered, pvp enabled.");
                    player.TPlayer.hostile = true;
                    NetMessage.SendData((int)PacketTypes.TogglePvp, -1, -1, "", player.Index);
                }
            }
            if (regionStorage.flags.Contains("NOPVP") && !bypassFlag)
            {
                if (player.TPlayer.hostile)
                {
                    player.SendSuccessMessage("PVP arena entered, pvp disabled.");
                    player.TPlayer.hostile = false;
                    NetMessage.SendData((int)PacketTypes.TogglePvp, -1, -1, "", player.Index);
                }
            }
            if (regionStorage.flags.Contains("TEMPGROUP") && !bypassFlag)
            {
                if (!groupset)
                {
                    player.tempGroup = regionStorage.tempgroup;
                    player.SendSuccessMessage("Your group has been temporarily set to \"{0}\"!", regionStorage.tempgroup.Name);
                    groupset = true;
                }
            }
            if (regionStorage.flags.Contains("DEATH") && !bypassFlag)
            {
                if (!killed)
                {
                    player.DamagePlayer(1200);
                    player.SendErrorMessage("You entered a death zone! RIP");
                    killed = true;
                }
            }
            if (regionStorage.flags.Contains("HURT") && !bypassFlag)
            {
                if (regionStorage.damageinterval < 0 || regionStorage.damageamount< 0)
                    return;
                if ((DateTime.Now - lastDamageUpdate).TotalSeconds >= regionStorage.damageinterval)
                {
                    lastDamageUpdate = DateTime.Now;
                    player.DamagePlayer(regionStorage.damageamount);
                }
            }
            if (regionStorage.flags.Contains("COMMAND") && !bypassFlag)
            {
                if (!executedcommand)
                {
                    if (regionStorage.command != null && regionStorage.command != "")
                    {
                        Commands.HandleCommand(TSPlayer.Server, "/" + regionStorage.command);
                        executedcommand = true;
                    }
                }
            }
            if (regionStorage.flags.Contains("PROMOTE") && !bypassFlag)
            {
                if (!promoted)
                {
                    if (player.Group == TShock.Groups.GetGroupByName(regionStorage.fromgroup) || regionStorage.fromgroup == "*")
                    {
                        player.Group = TShock.Groups.GetGroupByName(regionStorage.togroup);
                        player.SendInfoMessage("You have been promoted to group \"{0}\"", regionStorage.togroup);
                        promoted = true;
                    }
                }
            }
            if (regionStorage.flags.Contains("GROUPONLY"))
            {
                if (!gotWarnMessage && !regionStorage.groupOnly.Contains(player.Group.Name) && !bypassFlag)
                {
                    player.Teleport(lastPos.X, lastPos.Y, 1);
                    player.SendErrorMessage("No permission to enter private region!");
                    gotWarnMessage = true;
                }
            }
            if (regionStorage.flags.Contains("MESSAGE"))
            {
                if (!gotmessage)
                {
                    if (regionStorage.message != null && regionStorage.message != "")
                    {
                        player.SendInfoMessage(regionStorage.message);
                        gotmessage = true;
                    }
                }
            }
        }
开发者ID:loohney,项目名称:RegionEvent,代码行数:101,代码来源:PlayerStorage.cs

示例8: HandleTileEdit

        public override bool HandleTileEdit(TSPlayer player, TileEditType editType, BlockType blockType, DPoint location, int objectStyle)
        {
            if (this.IsDisposed)
            return false;
              if (base.HandleTileEdit(player, editType, blockType, location, objectStyle))
            return true;

              if (editType == TileEditType.PlaceTile)
            return this.HandleTilePlace(player, blockType, location, objectStyle);
              if (editType == TileEditType.TileKill || editType == TileEditType.TileKillNoItem)
            return this.HandleTileDestruction(player, location);
              if (editType == TileEditType.PlaceWire || editType == TileEditType.PlaceWireBlue || editType == TileEditType.PlaceWireGreen)
            return this.HandleWirePlace(player, location);

              #if DEBUG || Testrun
              if (editType == TileEditType.DestroyWire) {
            player.SendMessage(location.ToString(), Color.Aqua);

            if (!TerrariaUtils.Tiles[location].active())
              return false;

            ObjectMeasureData measureData = TerrariaUtils.Tiles.MeasureObject(location);
            player.SendInfoMessage(string.Format(
              "X: {0}, Y: {1}, FrameX: {2}, FrameY: {3}, Origin X: {4}, Origin Y: {5}, Active State: {6}",
              location.X, location.Y, TerrariaUtils.Tiles[location].frameX, TerrariaUtils.Tiles[location].frameY,
              measureData.OriginTileLocation.X, measureData.OriginTileLocation.Y,
              TerrariaUtils.Tiles.ObjectHasActiveState(measureData)
            ));
              }
              #endif

              return false;
        }
开发者ID:CoderCow,项目名称:AdvancedCircuits-Plugin,代码行数:33,代码来源:UserInteractionHandler.cs

示例9: RollCommand

 private void RollCommand(TSPlayer sender, string[] arr)
 {
     if (arr.Length > 1)
     {
         switch (arr[1].ToLower())
         {
             case "on":
                 rollOnLoot = true;
                 TSPlayer.All.SendMessage(string.Format("{0} set loot rules to roll-off.", sender.Name), Color.SeaGreen);
                 break;
             case "off":
                 rollOnLoot = false;
                 TSPlayer.All.SendMessage(string.Format("{0} set loot rules to free-for-all.", sender.Name), Color.SeaGreen);
                 break;
             case "list":
                 StringBuilder sb = new StringBuilder();
                 sb.Append("Loot list: ");
                 foreach (var item in itemsToRoll)
                 {
                     sb.Append(string.Format("{0} ({1}),", item.AffixName(),item.stack));
                 }
                 sb.Remove(sb.Length - 1, 1);
                 sender.SendMessage(sb.ToString(), Color.GreenYellow);
                 sb = new StringBuilder();
                 var inQueue = winQueue.Where(q => q.PlayerID == sender.Index).ToList();
                 if (inQueue.Count > 0)
                 {
                     sb = new StringBuilder();
                     sb.Append("Items Won Awaiting space: ");
                     foreach (var item in inQueue)
                     {
                         sb.Append(string.Format("{0} ({1}),",item.Item.AffixName(),item.Item.stack));
                     }
                     sb.Remove(sb.Length - 1, 1);
                     sender.SendMessage(sb.ToString(), Color.Teal);
                 }
                 break;
             case "idle":
                 if (arr.Length < 3)
                     sender.SendInfoMessage("Correct use is /roll idle pass|roll.");
                 else
                 {
                     Player player = players.Where(p => p.Index == sender.Index).FirstOrDefault();
                     switch (arr[2].ToLower())
                     {
                         case "pass":
                             player.PassOnIdle = true;
                             sender.SendInfoMessage("You have chosen to automatically pass on loot if you do not respond.");
                             break;
                         case "roll":
                             player.PassOnIdle = false;
                             sender.SendInfoMessage("You have chosen to automatically roll on loot if you do not respond.");
                             break;
                         default:
                             sender.SendErrorMessage("Proper use is /roll idle pass|roll.");
                             break;
                     }
                 }
                 break;
             case "?":
             case "help":
                 sender.SendInfoMessage("/roll on|off - Toggles loot rolling on item drops.");
                 sender.SendInfoMessage("/roll list - Shows list of items to roll on, and any items awaiting for space in your inventory.");
                 sender.SendInfoMessage("/roll idle pass|roll - Set whether to roll or pass if you're idle on loot rolls.");
                 break;
             default:
                 sender.SendInfoMessage("Invalid use. Proper use is /roll on|off|list|help|?");
                 break;
         }
     }
     else
     {
         if (itemsToRoll.Count <= 0)
         {
             sender.SendWarningMessage("No items to roll on. Type /roll ? or /roll help for more info.");
         }
         else
         {
             Player player = players.Where(p => p.Index == sender.Index).FirstOrDefault();
             if (player.Roll == -1)
                 sender.SendWarningMessage("You already passed on this item!");
             else if (player.Roll != 0)
                 sender.SendWarningMessage(string.Format("You already rolled a {0} on this item! Stop rolling!", player.Roll));
             else
             {
                 Random rnd = new Random();
                 player.Roll = (sbyte)rnd.Next(1, 101);
                 TSPlayer.All.SendInfoMessage(string.Format("{0} rolled a {1}.", player.Name, player.Roll));
                 CheckLootRoll();
             }
         }
     }
 }
开发者ID:sokie,项目名称:LootWhore,代码行数:93,代码来源:LootWhore.cs

示例10: LootCommand

 private void LootCommand(TSPlayer sender, string[] arr)
 {
     if (arr.Length > 1)
     {
         switch (arr[1].ToLower())
         {
             case "help":
             case "?":
                 sender.SendInfoMessage("/items|loot - Shows your loot information");
                 sender.SendInfoMessage("/items|loot playerName - Show another player's loot info.");
                 break;
             default:
                 Player player = players.Where(p => p.Name.ToLower().Contains(arr[1].ToLower())).FirstOrDefault();
                 if (player != null)
                 {
                     sender.SendMessage(string.Format("{0}'s loots: {1:n0} Precious: {2:n0} Rolls Won: {3:n0}", player.Name, player.ItemsCollected, player.PreciousItemsLooted, player.RollsWon), Color.Blue);
                     sender.SendMessage(player.LootHistory, Color.Blue);
                     sender.SendMessage(string.Format("Coins Looted: {0}", FormatCoins(player.Money)), Color.LightGreen);
                 }
                 else
                     sender.SendInfoMessage("No player with name containing " + arr[1]);
                 break;
         }
     }
     else
     {
         Player player = players.Where(p => p.Index == sender.Index).FirstOrDefault();
         if (player != null)
         {
             sender.SendMessage(string.Format("Your loots: {0:n0} Precious: {1:n0} Rolls Won: {2:n0}", player.ItemsCollected,player.PreciousItemsLooted,player.RollsWon), Color.Blue);
             sender.SendMessage(player.LootHistory, Color.Blue);
             sender.SendMessage(string.Format("Coins Looted: {0}", FormatCoins(player.Money)), Color.LightGreen);
         }
     }
 }
开发者ID:sokie,项目名称:LootWhore,代码行数:35,代码来源:LootWhore.cs

示例11: notify

 void notify(TSPlayer ts, string spawned)
 {
     ts.SendInfoMessage("You succesfully generated a " + spawned);
 }
开发者ID:948872003,项目名称:AIO,代码行数:4,代码来源:main.cs

示例12: PrintCurrentRecipe

        public static void PrintCurrentRecipe(TSPlayer tsplr)
        {
            var player = CommandRecipes.RPlayers[tsplr.Index];

              if (player.activeRecipe == null)
            return;

              List<string> inglist = Utils.ListIngredients(player.activeRecipe.ingredients);
              tsplr.SendInfoMessage("The {0} recipe requires: ", string.Concat("[i:", player.activeRecipe.name, "]"));
              tsplr.SendMessage(string.Format("Ingredients: {0}", String.Join(", ", inglist.ToArray(), 0, inglist.Count)), Color.LightGray);
              if (SEconomyPlugin.Instance != null) {
            string money = SEconomyPlugin.Instance.Configuration.MoneyConfiguration.MoneyName;
            tsplr.SendMessage(string.Format("Cost: {0} {1}", player.activeRecipe.SEconomyCost, money), Color.LightGray);
              }
              tsplr.SendInfoMessage("Type \"/craft -confirm\" to craft, or \"/craft -quit\" to quit");
        }
开发者ID:Stealownz,项目名称:CommandRecipes,代码行数:16,代码来源:Utils.cs

示例13: Build

        public bool Build(TSPlayer tsPlayer, int X, int Y)
        {
            int count = 0;
            for (int ch = 0; ch < 1000; ch++)
            {
                if (Main.chest[ch] != null)
                    count++;
            }
            if (count > (1000 - MaxChests))
            {
                tsPlayer.SendInfoMessage("Creating this chestroom would exceed the chest limit, chestroom cancelled.");
                return false;
            }
            bool first = true;
            int placed = ChestsPerRow * MaxRows;
            int chestitem = Main.maxItemTypes - 1;

            for (int y = RowHeight - 1; y >= 0; y--)
            {
                for (int x = RowWidth - 1; x >= 0; x--)
                {
                    if (x > 0 && x < RowWidth - 1 && y > 0 && y < RowHeight - 1)
                    {
                        Main.tile[x + X, y + Y] = new Tile() { wall = BackWall };
                    }
                    if (x == 0 || x == RowWidth - 1 || y == 0 || y == RowHeight - 1)
                    {
                        Main.tile[x + X, y + Y] = new Tile() { type = TileId };
                        Main.tile[x + X, y + Y].active(true);
                    }
                    if (y % 5 == 0 && y > 0 && y < RowHeight - 1)
                    {
                        Main.tile[x + X, y + Y].active(true);
                        if ((x % 4 == 2 || x % 4 == 3 || x == 1 || x == RowWidth - 2))
                        {
                            Main.tile[x + X, y + Y].type = TileId;
                        }
                        else if ((x % 4 == 0 || x % 4 == 1) && x > 1 && x < RowWidth - 2)
                        {
                            Main.tile[x + X, y + Y].type = (byte)19;
                            Main.tile[x + X, y + Y].frameY =PlatformFrameY;
                        }
                    }
                    if (y % 5 == 1 && (x == 1 || x == RowWidth - 2))
                    {
                        Main.tile[x + X, y + Y].active(true);
                        Main.tile[x + X, y + Y].type = 4;
                        Main.tile[x + X, y + Y].frameY = TorchFrameY;
                    }
                    if (y % 5 == 2 && x % 4 == 3 && x > 0 && x < RowWidth - 2)
                    {
                        placed--;
                        if (placed < MaxChests)
                        {
                            WorldGen.AddBuriedChest(x + X, y + Y, 1, false, ChestId);
                            if (Main.chest[count] != null)
                            {
                                for (int i = 39; i >= 0; i--)
                                {
                                    while(Utils.ExcludeItem(chestitem))
                                        chestitem--;

                                    if (chestitem < -48)
                                        break;

                                    if (first)
                                    {
                                        i -= 40 - (ActualMaxItems + 1) % 40;
                                        first = false;
                                    }
                                    Item itm = TShock.Utils.GetItemById(chestitem);
                                    itm.stack = itm.maxStack;
                                    Main.chest[count].item[i] = itm;
                                    chestitem--;
                                }
                            }
                            count++;
                        }
                    }
                }
            }
            if (main.usinginfchests)
                Utils.ConvertToAutoRefill(count - MaxChests, MaxChests);
            return true;
        }
开发者ID:UB1AFU,项目名称:Chestroom,代码行数:85,代码来源:Chestroom.cs

示例14: SendPage

        public static void SendPage(
			TSPlayer player, int pageNumber, Dictionary<string, int> dictionary, int dataToPaginateCount,
			FormatSettings settings = null)
        {
            if (settings == null)
                settings = new FormatSettings();

            if (dataToPaginateCount == 0)
            {
                if (settings.NothingToDisplayString != null)
                {
                    if (!player.RealPlayer)
                        player.SendSuccessMessage(settings.NothingToDisplayString);
                    else
                        player.SendMessage(settings.NothingToDisplayString, settings.HeaderTextColor);
                }
                return;
            }

            var pageCount = ((dataToPaginateCount - 1)/settings.MaxLinesPerPage) + 1;
            if (settings.PageLimit > 0 && pageCount > settings.PageLimit)
                pageCount = settings.PageLimit;
            if (pageNumber > pageCount)
                pageNumber = pageCount;

            if (settings.IncludeHeader)
            {
                if (!player.RealPlayer)
                    player.SendSuccessMessage(string.Format(settings.HeaderFormat, pageNumber, pageCount));
                else
                    player.SendMessage(string.Format(settings.HeaderFormat, pageNumber, pageCount),
                        settings.HeaderTextColor);
            }

            var listOffset = (pageNumber - 1)*settings.MaxLinesPerPage;
            var offsetCounter = 0;
            var lineCounter = 0;

            foreach (var lineData in dictionary)
            {
                if (offsetCounter++ < listOffset)
                    continue;
                if (lineCounter++ == settings.MaxLinesPerPage)
                    break;

                var lineColor = Color.Yellow;
                var hsName = lineData.Key;
                var hsScore = lineData.Value;
                var index = dictionary.Keys.ToList().IndexOf(hsName) + 1;

                if (index == 1)
                    lineColor = Color.Cyan;
                if (index == 2)
                    lineColor = Color.ForestGreen;
                if (index == 3)
                    lineColor = Color.OrangeRed;

                if (string.Equals(hsName, player.UserAccountName, StringComparison.CurrentCultureIgnoreCase))
                    lineColor = Color.White;

                if (!string.IsNullOrEmpty(hsName))
                {
                    if (!player.RealPlayer)
                        player.SendInfoMessage("{0}. {1} with {2} point{3}",
                            index, hsName, hsScore, hsScore.Suffix());
                    else
                        player.SendMessage(string.Format("{0}. {1} with {2} point{3}",
                            index, hsName, hsScore, hsScore.Suffix()), lineColor);
                }
            }

            if (lineCounter == 0)
            {
                if (settings.NothingToDisplayString != null)
                {
                    if (!player.RealPlayer)
                        player.SendSuccessMessage(settings.NothingToDisplayString);
                    else
                        player.SendMessage(settings.NothingToDisplayString, settings.HeaderTextColor);
                }
            }
            else if (settings.IncludeFooter && pageNumber + 1 <= pageCount)
            {
                if (!player.RealPlayer)
                    player.SendInfoMessage(string.Format(settings.FooterFormat, pageNumber + 1, pageNumber, pageCount));
                else
                    player.SendMessage(string.Format(settings.FooterFormat, pageNumber + 1, pageNumber, pageCount),
                        settings.FooterTextColor);
            }
        }
开发者ID:CrazyLegsSteph,项目名称:Statistics,代码行数:90,代码来源:HsPagination.cs

示例15: InflictDamage

        public void InflictDamage(TSPlayer player, NpcStrikeEventArgs args)
        {
            int bonusdmg = Level / 5;

            if (player.SelectedItem.melee)
            {
                melee.XP++;
                bonusdmg += melee.Level;

                if (melee.XP >= melee.getAttackLevelXp(MeleeAttackMultiplier, XpFormat.Integer))
                {
                    melee.XP = 0;
                    melee.Level++;
                    player.SendInfoMessage(VocationPlugin.Resources.INFO_LEVELUP_ATTACK, "melee", melee.Level);
                }
            }
            else if (player.SelectedItem.magic)
            {
                magic.XP++;
                bonusdmg += magic.Level;

                if (magic.XP >= magic.getAttackLevelXp(MagicAttackMultiplier, XpFormat.Integer))
                {
                    magic.XP = 0;
                    magic.Level++;
                    player.SendInfoMessage(VocationPlugin.Resources.INFO_LEVELUP_ATTACK, "magic", magic.Level);
                }
            }
            else if (player.SelectedItem.ranged)
            {
                ranged.XP++;
                bonusdmg += ranged.Level;

                if (ranged.XP >= ranged.getAttackLevelXp(RangedAttackMultiplier, XpFormat.Integer))
                {
                    ranged.XP = 0;
                    ranged.Level++;
                    player.SendInfoMessage(VocationPlugin.Resources.INFO_LEVELUP_ATTACK, "ranged", ranged.Level);
                }
            }

            if (bonusdmg > 0)
            {
                args.Damage += bonusdmg;
                var color = Convert.ToInt32(Color.Gold.PackedValue);
                var msgType = Convert.ToInt32(PacketTypes.CreateCombatText);
                NetMessage.SendData(msgType, -1, -1, "+" + bonusdmg, color, args.Npc.position.X, args.Npc.position.Y);
            }
        }
开发者ID:hastinbe,项目名称:VocationPlugin,代码行数:49,代码来源:Vocation.cs


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