本文整理汇总了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;
}
}
}
示例2: InvokeChannelCreated
public static void InvokeChannelCreated(TSPlayer ts, Channel channel)
{
if (OnChannelCreate == null)
return;
OnChannelCreate(new ChannelEventArgs() { TSPlayer = ts, Channel = channel });
}
示例3: InvokeChannelLogout
public static void InvokeChannelLogout(TSPlayer ts, Channel channel)
{
if (OnChannelLogout == null)
return;
OnChannelLogout(new ChannelEventArgs() { TSPlayer = ts, Channel = channel });
}
示例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;
}
示例5: DataStorage
public DataStorage(int _ID, int _style, TSPlayer _tsplayer, bool _isAuto)
{
ID = _ID;
style = _style;
tsplayer = _tsplayer;
isAuto = _isAuto;
}
示例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;
}
示例7: CommandArgs
public CommandArgs(string message, bool silent, TSPlayer ply, List<string> args)
{
Message = message;
Player = ply;
Parameters = args;
Silent = silent;
}
示例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);
}
示例9: OnClanCreated
public static void OnClanCreated(TSPlayer ts, string clanname)
{
if (ClanCreated == null)
return;
ClanCreated(new ClanCreatedEventArgs() { TSplayer = ts, ClanName = clanname });
}
示例10: ChestModifySlotEventArgs
public ChestModifySlotEventArgs(TSPlayer player, int chestIndex, int slotIndex, ItemData newItem)
: base(player)
{
this.ChestIndex = chestIndex;
this.SlotIndex = slotIndex;
this.NewItem = newItem;
}
示例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;
}
示例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>");
}
示例13: InfoCommand
public InfoCommand(string account, int time, int radius, TSPlayer sender)
: base(sender)
{
this.account = account;
this.time = time;
this.radius = radius;
}
示例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;
}
示例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);
}
}