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


C# TShockAPI.TSPlayer类代码示例

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


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

示例1: SendChestItem

        public static void SendChestItem(TSPlayer player, int chestIndex, IList<ItemData> items)
        {
            const int TerrariaPacketHeaderSize = 3;
              const int ChestItemPacketSizeNoHeader = 8;
              const short PacketSize = TerrariaPacketHeaderSize + ChestItemPacketSizeNoHeader;

              using (MemoryStream packetData = new MemoryStream(new byte[PacketSize])) {
            BinaryWriter writer = new BinaryWriter(packetData);

            // Header
            writer.Write(PacketSize); // Packet size
            writer.Write((byte)PacketTypes.ChestItem);

            writer.Write((short)chestIndex);

            // Re-write item data for each item and send the packet
            for (int i = 0; i < items.Count; i++) {
              ItemData item = items[i];

              writer.Write((byte)i);
              writer.Write((short)item.StackSize);
              writer.Write((byte)item.Prefix);
              writer.Write((short)item.Type);

              player.SendRawData(packetData.ToArray());

              // Rewind to write the item data of another item
              packetData.Position -= ChestItemPacketSizeNoHeader;
            }
              }
        }
开发者ID:CoderCow,项目名称:Protector-Plugin,代码行数:31,代码来源:PacketUtils.cs

示例2: InvokeChannelCreated

        public static void InvokeChannelCreated(TSPlayer ts, Channel channel)
        {
            if (OnChannelCreate == null)
                return;

            OnChannelCreate(new ChannelEventArgs() { TSPlayer = ts, Channel = channel });
        }
开发者ID:Jewsus,项目名称:ChatChannels,代码行数:7,代码来源:ChatChannelsHooks.cs

示例3: InvokeChannelLogout

        public static void InvokeChannelLogout(TSPlayer ts, Channel channel)
        {
            if (OnChannelLogout == null)
                return;

            OnChannelLogout(new ChannelEventArgs() { TSPlayer = ts, Channel = channel });
        }
开发者ID:Jewsus,项目名称:ChatChannels,代码行数:7,代码来源:ChatChannelsHooks.cs

示例4: ProcessCircuit

    private CircuitProcessingResult ProcessCircuit(TSPlayer triggerer, DPoint tileLocation, SignalType? overrideSignal = null, bool switchSender = true) {
      CircuitProcessor processor = new CircuitProcessor(this.PluginTrace, this, tileLocation);
      CircuitProcessingResult result = processor.ProcessCircuit(triggerer, overrideSignal, switchSender);

      this.NotifyPlayer(result);
      return result;
    }
开发者ID:romirom,项目名称:AdvancedCircuits-Plugin,代码行数:7,代码来源:CircuitHandler.cs

示例5: DataStorage

 public DataStorage(int _ID, int _style, TSPlayer _tsplayer, bool _isAuto)
 {
     ID = _ID;
     style = _style;
     tsplayer = _tsplayer;
     isAuto = _isAuto;
 }
开发者ID:Tygra,项目名称:Unplaceables,代码行数:7,代码来源:Plugin.cs

示例6: CanCreate

 public static bool CanCreate(TSPlayer player, scSign sign)
 {
     foreach (scCommand cmd in sign.Commands)
         if (!player.Group.HasPermission(string.Concat("essentials.signs.create.", cmd.command)))
             return false;
     return true;
 }
开发者ID:Tygra,项目名称:Essentials-SignCommands,代码行数:7,代码来源:scUtils.cs

示例7: CommandArgs

		public CommandArgs(string message, bool silent, TSPlayer ply, List<string> args)
		{
			Message = message;
			Player = ply;
			Parameters = args;
			Silent = silent;
		}
开发者ID:sliekasirdis79,项目名称:TShock,代码行数:7,代码来源:Commands.cs

示例8: SendEmail

        public static void SendEmail(TSPlayer player, string email, User user)
        {
            MailMessage mail = new MailMessage(AccountRecovery.Config.EmailFrom, email);
            SmtpClient client = new SmtpClient();
            client.Timeout = 15000;
            client.Host = AccountRecovery.Config.HostSMTPServer;
            client.Port = AccountRecovery.Config.HostPort;
            client.DeliveryMethod = SmtpDeliveryMethod.Network;
            client.UseDefaultCredentials = false;
            client.Credentials = new System.Net.NetworkCredential(AccountRecovery.Config.ServerEmailAddress, AccountRecovery.Config.ServerEmailPassword);
            client.EnableSsl = true;
            //client.ServicePoint.MaxIdleTime = 1;
            mail.Subject = AccountRecovery.Config.EmailSubjectLine;
            mail.Body = AccountRecovery.Config.EmailBodyLine;
            mail.IsBodyHtml = AccountRecovery.Config.UseHTML;

            string passwordGenerated = GeneratePassword(AccountRecovery.Config.GeneratedPasswordLength);
            TShock.Users.SetUserPassword(user, passwordGenerated);
            TShock.Log.ConsoleInfo("{0} has requested a new password succesfully.", user.Name);

            mail.Body = string.Format(mail.Body.Replace("$NEW_PASSWORD", passwordGenerated));
            mail.Body = string.Format(mail.Body.Replace("$USERNAME", user.Name));

            client.Send(mail);
            client.Dispose();
            player.SendSuccessMessage("A new password has been generated and sent to {0} for {1}.", email, user.Name);
            TShock.Log.ConsoleInfo("A new password has been generated and sent to {0} for {1}.", email, user.Name);
        }
开发者ID:Marcus101RR,项目名称:AccountRecovery,代码行数:28,代码来源:Utilities.cs

示例9: OnClanCreated

        public static void OnClanCreated(TSPlayer ts, string clanname)
        {
            if (ClanCreated == null)
                return;

            ClanCreated(new ClanCreatedEventArgs() { TSplayer = ts, ClanName = clanname });
        }
开发者ID:MichaelMan57,项目名称:Clans,代码行数:7,代码来源:ClanHooks.cs

示例10: ChestModifySlotEventArgs

 public ChestModifySlotEventArgs(TSPlayer player, int chestIndex, int slotIndex, ItemData newItem)
     : base(player)
 {
     this.ChestIndex = chestIndex;
       this.SlotIndex = slotIndex;
       this.NewItem = newItem;
 }
开发者ID:Enerdy,项目名称:PluginCommonLibrary,代码行数:7,代码来源:ChestModifySlotEventArgs.cs

示例11: calculateArea

        /// <summary>Calculates what part of the region border to show for a large region.</summary>
        public void calculateArea(TSPlayer tPlayer)
        {
            this.showArea = this.area;

            // If the region is large, only part of its border will be shown.
            if (this.showArea.Width >= MaximumSize) {
                this.showArea.X = (int) (tPlayer.X / 16) - MaximumSize / 2;
                this.showArea.Width = MaximumSize - 1;
                if (this.showArea.Left < this.area.Left) this.showArea.X = this.area.Left;
                else if (this.showArea.Right > this.area.Right) this.showArea.X = this.area.Right - (MaximumSize - 1);
            }
            if (this.showArea.Height >= MaximumSize) {
                this.showArea.Y = (int) (tPlayer.Y / 16) - MaximumSize / 2;
                this.showArea.Height = MaximumSize - 1;
                if (this.showArea.Top < this.area.Top) this.showArea.Y = this.area.Top;
                else if (this.showArea.Bottom > this.area.Bottom) this.showArea.Y = this.area.Bottom - (MaximumSize - 1);
            }

            // Ensure the region boundary is within the world.
            if (this.showArea.Left < 1) this.showArea.X = 1;
            else if (this.showArea.Left >= Main.maxTilesX - 1) this.showArea.X = Main.maxTilesX - 1;

            if (this.showArea.Top < 1) this.showArea.Y = 1;
            else if (this.showArea.Top >= Main.maxTilesY - 1) this.showArea.Y = Main.maxTilesY - 1;

            if (this.showArea.Right >= Main.maxTilesX - 1) this.showArea.Width = Main.maxTilesX - this.showArea.X - 2;
            if (this.showArea.Bottom >= Main.maxTilesY - 1) this.showArea.Height = Main.maxTilesY - this.showArea.Y - 2;
        }
开发者ID:Tygra,项目名称:Region-Vision,代码行数:29,代码来源:Region.cs

示例12: InvalidNewBountyUsage

 public static void InvalidNewBountyUsage(TSPlayer player)
 {
     player.SendErrorMessage("Invalid usage! Proper usages:");
     player.SendErrorMessage("/nbty <bounty name> <target>");
     player.SendErrorMessage("/nbty <-setrewards> [SEconomy currency amount]");
     player.SendErrorMessage("/nbty <-confirm/-cancel>");
 }
开发者ID:bippity,项目名称:BountyHunt,代码行数:7,代码来源:Utils.cs

示例13: InfoCommand

 public InfoCommand(string account, int time, int radius, TSPlayer sender)
     : base(sender)
 {
     this.account = account;
     this.time = time;
     this.radius = radius;
 }
开发者ID:Zaicon,项目名称:History,代码行数:7,代码来源:InfoCommand.cs

示例14: 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

示例15: 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


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