本文整理汇总了C#中TShockAPI.GetDataHandlerArgs类的典型用法代码示例。如果您正苦于以下问题:C# GetDataHandlerArgs类的具体用法?C# GetDataHandlerArgs怎么用?C# GetDataHandlerArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GetDataHandlerArgs类属于TShockAPI命名空间,在下文中一共展示了GetDataHandlerArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: HandlePlayerHp
public static bool HandlePlayerHp(GetDataHandlerArgs args)
{
var plr = args.Data.ReadInt8();
var cur = args.Data.ReadInt16();
var max = args.Data.ReadInt16();
if (OnPlayerHP(plr, cur, max) || cur <= 0 || max <= 0 || args.Player.IgnoreSSCPackets)
return true;
if (max > TShock.Config.MaxHP && !args.Player.Group.HasPermission(Permissions.ignorehp))
{
args.Player.Disable("Maximum HP beyond limit", DisableFlags.WriteToLogAndConsole);
return true;
}
if (args.Player.IsLoggedIn)
{
args.Player.TPlayer.statLife = cur;
args.Player.TPlayer.statLifeMax = max;
args.Player.PlayerData.maxHealth = max;
}
if (args.Player.GodMode && (cur < max))
{
args.Player.Heal(args.TPlayer.statLifeMax2);
}
return false;
}
开发者ID:CXUtk,项目名称:TShock,代码行数:28,代码来源:GetDataHandlers.cs
示例2: HandleSync
private static bool HandleSync(GetDataHandlerArgs args)
{
return TShock.Config.EnableAntiLag;
}
开发者ID:char213,项目名称:TShock,代码行数:4,代码来源:GetDataHandlers.cs
示例3: HandleTileKill
private static bool HandleTileKill(GetDataHandlerArgs args)
{
int tilex = args.Data.ReadInt32();
int tiley = args.Data.ReadInt32();
if (tilex < 0 || tilex >= Main.maxTilesX || tiley < 0 || tiley >= Main.maxTilesY)
return false;
if (Main.tile[tilex, tiley].type != 0x15 && (!Tools.MaxChests() && Main.tile[tilex, tiley].type != 0)) //Chest
{
Log.Debug(string.Format("TileKill(TileXY:{0}_{1}, Type:{2})",
tilex, tiley, Main.tile[tilex, tiley].type));
Tools.ForceKick(args.Player, string.Format(TShock.Config.TileKillAbuseReason, Main.tile[tilex, tiley].type));
return true;
}
if (!args.Player.Group.HasPermission(Permissions.canbuild))
{
args.Player.SendMessage("You do not have permission to build!", Color.Red);
args.Player.SendTileSquare(tilex, tiley);
return true;
}
if (!args.Player.Group.HasPermission(Permissions.editspawn) && !TShock.Regions.CanBuild(tilex, tiley, args.Player) && TShock.Regions.InArea(tilex, tiley))
{
args.Player.SendMessage("Region protected from changes.", Color.Red);
args.Player.SendTileSquare(tilex, tiley);
return true;
}
if (TShock.Config.DisableBuild)
{
if (!args.Player.Group.HasPermission(Permissions.editspawn))
{
args.Player.SendMessage("World protected from changes.", Color.Red);
args.Player.SendTileSquare(tilex, tiley);
return true;
}
}
if (TShock.Config.SpawnProtection)
{
if (!args.Player.Group.HasPermission(Permissions.editspawn))
{
var flag = TShock.CheckSpawn(tilex, tiley);
if (flag)
{
args.Player.SendMessage("Spawn protected from changes.", Color.Red);
args.Player.SendTileSquare(tilex, tiley);
return true;
}
}
}
return false;
}
开发者ID:char213,项目名称:TShock,代码行数:50,代码来源:GetDataHandlers.cs
示例4: HandleSendSection
private static bool HandleSendSection(GetDataHandlerArgs args)
{
return Tools.HandleGriefer(args.Player, TShock.Config.SendSectionAbuseReason);
}
开发者ID:char213,项目名称:TShock,代码行数:4,代码来源:GetDataHandlers.cs
示例5: HandleSign
private static bool HandleSign(GetDataHandlerArgs args)
{
var id = args.Data.ReadInt16();
var x = args.Data.ReadInt32();
var y = args.Data.ReadInt32();
if (TShock.Config.RangeChecks && ((Math.Abs(args.Player.TileX - x) > 32) || (Math.Abs(args.Player.TileY - y) > 32)))
{
return Tools.HandleGriefer(args.Player, TShock.Config.RangeCheckBanReason);
}
return false;
}
开发者ID:char213,项目名称:TShock,代码行数:11,代码来源:GetDataHandlers.cs
示例6: HandlePlayerKillMe
private static bool HandlePlayerKillMe(GetDataHandlerArgs args)
{
byte id = args.Data.ReadInt8();
if (id != args.Player.Index)
{
return Tools.HandleGriefer(args.Player, TShock.Config.KillMeAbuseReason);
}
args.Player.LastDeath = DateTime.Now;
if (args.Player.Difficulty != 2)
args.Player.ForceSpawn = true;
return false;
}
开发者ID:char213,项目名称:TShock,代码行数:12,代码来源:GetDataHandlers.cs
示例7: HandlePlayerUpdate
private static bool HandlePlayerUpdate(GetDataHandlerArgs args)
{
byte plr = args.Data.ReadInt8();
byte control = args.Data.ReadInt8();
byte item = args.Data.ReadInt8();
float posx = args.Data.ReadSingle();
float posy = args.Data.ReadSingle();
float velx = args.Data.ReadSingle();
float vely = args.Data.ReadSingle();
if (Main.verboseNetplay)
Debug.WriteLine("Update: {{{0},{1}}} {{{2}, {3}}}", (int)posx, (int)posy, (int)velx, (int)vely);
if (plr != args.Player.Index)
{
return Tools.HandleGriefer(args.Player, TShock.Config.UpdatePlayerAbuseReason);
}
if (item < 0 || item >= args.TPlayer.inventory.Length)
{
Tools.HandleGriefer(args.Player, TShock.Config.UpdatePlayerAbuseReason);
return true;
}
return false;
}
开发者ID:char213,项目名称:TShock,代码行数:26,代码来源:GetDataHandlers.cs
示例8: HandleDoorUse
private static bool HandleDoorUse(GetDataHandlerArgs args)
{
byte type = (byte)args.Data.ReadByte();
short x = args.Data.ReadInt16();
short y = args.Data.ReadInt16();
args.Data.ReadByte(); //Ignore direction
if (x >= Main.maxTilesX || y >= Main.maxTilesY || x < 0 || y < 0) // Check for out of range
{
return true;
}
if (type < 0 || type > 5)
{
return true;
}
ushort tileType = Main.tile[x, y].type;
if (tileType != TileID.ClosedDoor && tileType != TileID.OpenDoor
&& tileType != TileID.TallGateClosed && tileType != TileID.TallGateOpen
&& tileType != TileID.TrapdoorClosed && tileType != TileID.TrapdoorOpen)
{
return true;
}
return false;
}
开发者ID:CXUtk,项目名称:TShock,代码行数:28,代码来源:GetDataHandlers.cs
示例9: HandleGetSection
private static bool HandleGetSection(GetDataHandlerArgs args)
{
if (args.Player.RequestedSection)
return true;
args.Player.RequestedSection = true;
if (String.IsNullOrEmpty(args.Player.Name))
{
TShock.Utils.ForceKick(args.Player, "Blank name.", true);
return true;
}
if (!args.Player.Group.HasPermission(Permissions.ignorestackhackdetection))
{
TShock.HackedInventory(args.Player);
}
if (TShock.Utils.ActivePlayers() + 1 > TShock.Config.MaxSlots &&
!args.Player.Group.HasPermission(Permissions.reservedslot))
{
TShock.Utils.ForceKick(args.Player, TShock.Config.ServerFullReason, true);
return true;
}
NetMessage.SendData((int) PacketTypes.TimeSet, -1, -1, "", Main.dayTime ? 1 : 0, (int)Main.time, Main.sunModY, Main.moonModY);
return false;
}
开发者ID:CXUtk,项目名称:TShock,代码行数:26,代码来源:GetDataHandlers.cs
示例10: HandleCompleteAnglerQuest
private static bool HandleCompleteAnglerQuest(GetDataHandlerArgs args)
{
// Since packet 76 is NEVER sent to us, we actually have to rely on this to get the true count
args.TPlayer.anglerQuestsFinished++;
return false;
}
开发者ID:CXUtk,项目名称:TShock,代码行数:6,代码来源:GetDataHandlers.cs
示例11: HandleConnecting
private static bool HandleConnecting(GetDataHandlerArgs args)
{
var user = TShock.Users.GetUserByName(args.Player.Name);
if (user != null && !TShock.Config.DisableUUIDLogin)
{
if (user.UUID == args.Player.UUID)
{
if (args.Player.State == 1)
args.Player.State = 2;
NetMessage.SendData((int)PacketTypes.WorldInfo, args.Player.Index);
args.Player.PlayerData = TShock.CharacterDB.GetPlayerData(args.Player, user.ID);
var group = TShock.Utils.GetGroup(user.Group);
if (Main.ServerSideCharacter)
{
if (!group.HasPermission(Permissions.bypassssc))
{
args.Player.PlayerData.RestoreCharacter(args.Player);
}
}
args.Player.LoginFailsBySsi = false;
if (group.HasPermission(Permissions.ignorestackhackdetection))
args.Player.IgnoreActionsForCheating = "none";
if (group.HasPermission(Permissions.usebanneditem))
args.Player.IgnoreActionsForDisabledArmor = "none";
args.Player.Group = group;
args.Player.tempGroup = null;
args.Player.User = user;
args.Player.IsLoggedIn = true;
args.Player.IgnoreActionsForInventory = "none";
if (!args.Player.IgnoreActionsForClearingTrashCan && Main.ServerSideCharacter)
{
args.Player.PlayerData.CopyCharacter(args.Player);
TShock.CharacterDB.InsertPlayerData(args.Player);
}
args.Player.SendSuccessMessage("Authenticated as " + user.Name + " successfully.");
TShock.Log.ConsoleInfo(args.Player.Name + " authenticated successfully as user " + args.Player.Name + ".");
Hooks.PlayerHooks.OnPlayerPostLogin(args.Player);
return true;
}
}
else if (user != null && !TShock.Config.DisableLoginBeforeJoin)
{
args.Player.RequiresPassword = true;
NetMessage.SendData((int) PacketTypes.PasswordRequired, args.Player.Index);
return true;
}
else if (!string.IsNullOrEmpty(TShock.Config.ServerPassword))
{
args.Player.RequiresPassword = true;
NetMessage.SendData((int) PacketTypes.PasswordRequired, args.Player.Index);
return true;
}
if (args.Player.State == 1)
args.Player.State = 2;
NetMessage.SendData((int) PacketTypes.WorldInfo, args.Player.Index);
return true;
}
开发者ID:CXUtk,项目名称:TShock,代码行数:66,代码来源:GetDataHandlers.cs
示例12: HandleChestOpen
private static bool HandleChestOpen(GetDataHandlerArgs args)
{
var x = args.Data.ReadInt16();
var y = args.Data.ReadInt16();
if (OnChestOpen(x, y, args.Player))
return true;
if (TShock.CheckIgnores(args.Player))
{
return true;
}
if (TShock.CheckRangePermission(args.Player, x, y))
{
return true;
}
if (TShock.CheckTilePermission(args.Player, x, y) && TShock.Config.RegionProtectChests)
{
return true;
}
int id = Chest.FindChest(x, y);
args.Player.ActiveChest = id;
return false;
}
开发者ID:CXUtk,项目名称:TShock,代码行数:28,代码来源:GetDataHandlers.cs
示例13: HandleChestItem
private static bool HandleChestItem(GetDataHandlerArgs args)
{
var id = args.Data.ReadInt16();
var slot = args.Data.ReadInt8();
var stacks = args.Data.ReadInt16();
var prefix = args.Data.ReadInt8();
var type = args.Data.ReadInt16();
if (OnChestItemChange(id, slot, stacks, prefix, type))
return true;
if (args.TPlayer.chest != id)
{
return false;
}
if (TShock.CheckIgnores(args.Player))
{
args.Player.SendData(PacketTypes.ChestItem, "", id, slot);
return true;
}
Item item = new Item();
item.netDefaults(type);
if (stacks > item.maxStack || TShock.Itembans.ItemIsBanned(item.name, args.Player))
{
return false;
}
if (TShock.CheckTilePermission(args.Player, Main.chest[id].x, Main.chest[id].y) && TShock.Config.RegionProtectChests)
{
return false;
}
if (TShock.CheckRangePermission(args.Player, Main.chest[id].x, Main.chest[id].y))
{
return false;
}
return false;
}
开发者ID:CXUtk,项目名称:TShock,代码行数:41,代码来源:GetDataHandlers.cs
示例14: HandleChestActive
private static bool HandleChestActive(GetDataHandlerArgs args)
{
//chest ID
var id = args.Data.ReadInt16();
//chest x
var x = args.Data.ReadInt16();
//chest y
var y = args.Data.ReadInt16();
//chest name length
var nameLen = args.Data.ReadInt8();
if (nameLen != 0 && nameLen <= 20)
args.Data.ReadString(); // Ignore the name
args.Player.ActiveChest = id;
if (TShock.CheckTilePermission(args.Player, x, y) && TShock.Config.RegionProtectChests)
{
args.Player.SendData(PacketTypes.ChestOpen, "", -1);
return true;
}
return false;
}
开发者ID:CXUtk,项目名称:TShock,代码行数:24,代码来源:GetDataHandlers.cs
示例15: HandlePlayerDamage
private static bool HandlePlayerDamage(GetDataHandlerArgs args)
{
byte playerid = args.Data.ReadInt8();
if (TShock.Players[playerid] == null)
return true;
return !TShock.Players[playerid].TPlayer.hostile;
}
开发者ID:char213,项目名称:TShock,代码行数:8,代码来源:GetDataHandlers.cs
示例16: HandleItemDrop
private static bool HandleItemDrop(GetDataHandlerArgs args)
{
var id = args.Data.ReadInt16();
var pos = new Vector2(args.Data.ReadSingle(), args.Data.ReadSingle());
var vel = new Vector2(args.Data.ReadSingle(), args.Data.ReadSingle());
var stacks = args.Data.ReadInt16();
var prefix = args.Data.ReadInt8();
var noDelay = args.Data.ReadInt8() == 1;
var type = args.Data.ReadInt16();
if (OnItemDrop(id, pos, vel, stacks, prefix, noDelay, type))
return true;
// player is attempting to crash clients
if (type < -48 || type >= Main.maxItemTypes)
{
args.Player.SendData(PacketTypes.ItemDrop, "", id);
return true;
}
if (prefix > Item.maxPrefixes) //make sure the prefix is a legit value
{
args.Player.SendData(PacketTypes.ItemDrop, "", id);
return true;
}
if (type == 0) //Item removed, let client do this to prevent item duplication client side (but only if it passed the range check)
{
if (TShock.CheckRangePermission(args.Player, (int)(Main.item[id].position.X / 16f), (int)(Main.item[id].position.Y / 16f)))
{
args.Player.SendData(PacketTypes.ItemDrop, "", id);
return true;
}
return false;
}
if (TShock.CheckRangePermission(args.Player, (int)(pos.X / 16f), (int)(pos.Y / 16f)))
{
args.Player.SendData(PacketTypes.ItemDrop, "", id);
return true;
}
if (Main.item[id].active && Main.item[id].netID != type) //stop the client from changing the item type of a drop but only if the client isn't picking up the item
{
args.Player.SendData(PacketTypes.ItemDrop, "", id);
return true;
}
Item item = new Item();
item.netDefaults(type);
if ((stacks > item.maxStack || stacks <= 0) || (TShock.Itembans.ItemIsBanned(item.name, args.Player) && !args.Player.Group.HasPermission(Permissions.allowdroppingbanneditems)))
{
args.Player.SendData(PacketTypes.ItemDrop, "", id);
return true;
}
if ((Main.ServerSideCharacter) && (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond - args.Player.LoginMS < TShock.ServerSideCharacterConfig.LogonDiscardThreshold))
{
//Player is probably trying to sneak items onto the server in their hands!!!
TShock.Log.ConsoleInfo("Player {0} tried to sneak {1} onto the server!", args.Player.Name, item.name);
args.Player.SendData(PacketTypes.ItemDrop, "", id);
return true;
}
if (TShock.CheckIgnores(args.Player))
{
args.Player.SendData(PacketTypes.ItemDrop, "", id);
return true;
}
return false;
}
开发者ID:CXUtk,项目名称:TShock,代码行数:72,代码来源:GetDataHandlers.cs
示例17: HandlePlayerInfo
private static bool HandlePlayerInfo(GetDataHandlerArgs args)
{
byte playerid = args.Data.ReadInt8();
byte hair = args.Data.ReadInt8();
byte male = args.Data.ReadInt8();
args.Data.Position += 21;
byte difficulty = args.Data.ReadInt8();
string name = Encoding.ASCII.GetString(args.Data.ReadBytes((int)(args.Data.Length - args.Data.Position - 1)));
if (hair >= Main.maxHair)
{
Tools.ForceKick(args.Player, "Hair crash exploit.");
return true;
}
if (!Tools.ValidString(name))
{
Tools.ForceKick(args.Player, "Unprintable character in name");
return true;
}
if (name.Length > 32)
{
Tools.ForceKick(args.Player, "Name exceeded 32 characters.");
return true;
}
if (name.Trim().Length == 0)
{
Tools.ForceKick(args.Player, "Empty Name.");
return true;
}
var ban = TShock.Bans.GetBanByName(name);
if (ban != null)
{
Tools.ForceKick(args.Player, string.Format("You are banned: {0}", ban.Reason));
return true;
}
if (args.Player.ReceivedInfo)
{
return Tools.HandleGriefer(args.Player, "Sent client info more than once");
}
if (TShock.Config.MediumcoreOnly && difficulty < 1)
{
Tools.ForceKick(args.Player, "Server is set to mediumcore and above characters only!");
return true;
}
if (TShock.Config.HardcoreOnly && difficulty < 2)
{
Tools.ForceKick(args.Player, "Server is set to hardcore characters only!");
return true;
}
args.Player.Difficulty = difficulty;
args.Player.ReceivedInfo = true;
return false;
}
开发者ID:char213,项目名称:TShock,代码行数:53,代码来源:GetDataHandlers.cs
示例18: HandleItemOwner
private static bool HandleItemOwner(GetDataHandlerArgs args)
{
var id = args.Data.ReadInt16();
var owner = args.Data.ReadInt8();
if (id < 0 || id > 400)
return true;
if (id == 400 && owner == 255)
{
args.Player.IgnoreSSCPackets = false;
return true;
}
return false;
}
开发者ID:CXUtk,项目名称:TShock,代码行数:16,代码来源:GetDataHandlers.cs
示例19: HandlePlayerSlot
private static bool HandlePlayerSlot(GetDataHandlerArgs args)
{
int plr = args.Data.ReadInt8();
int slot = args.Data.ReadInt8();
int stack = args.Data.ReadInt8();
int namelength = (int)(args.Data.Length - args.Data.Position - 1);
if (namelength > 0)
{
string itemname = Encoding.ASCII.GetString(args.Data.ReadBytes(namelength));
if (!args.Player.Group.HasPermission(Permissions.usebanneditem) && TShock.Itembans.ItemIsBanned(itemname))
args.Player.Disconnect("Using banned item: " + itemname + ", remove it and rejoin");
if (itemname == "KANNIBALE BLADE"
|| itemname == "Super Gel")
return Tools.HandleCheater(args.Player, string.Format(TShock.Config.GriefClientReason, "KANNIBALE"));
if (Tools.GetItemByName(itemname).Count == 0 && !args.Player.Group.HasPermission(Permissions.ignorecheatdetection)
&& TShock.Config.KickCustomItems)
args.Player.Disconnect("Using custom item: " + itemname + ", remove it and region");
}
return false;
}
开发者ID:char213,项目名称:TShock,代码行数:23,代码来源:GetDataHandlers.cs
示例20: HandleLiquidSet
private static bool HandleLiquidSet(GetDataHandlerArgs args)
{
int tileX = args.Data.ReadInt16();
int tileY = args.Data.ReadInt16();
byte amount = args.Data.ReadInt8();
byte type = args.Data.ReadInt8();
if (OnLiquidSet(tileX, tileY, amount, type))
return true;
if (!TShock.Utils.TilePlacementValid(tileX, tileY) || (args.Player.Dead && TShock.Config.PreventDeadModification))
return true;
if (TShock.CheckIgnores(args.Player))
{
args.Player.SendTileSquare(tileX, tileY, 1);
return true;
}
if (args.Player.TileLiquidThreshold >= TShock.Config.TileLiquidThreshold)
{
args.Player.Disable("Reached TileLiquid threshold.", DisableFlags.WriteToLogAndConsole);
args.Player.SendTileSquare(tileX, tileY, 1);
return true;
}
if (!args.Player.Group.HasPermission(Permissions.ignoreliquidsetdetection))
{
args.Player.TileLiquidThreshold++;
}
if (amount != 0)
{
int bucket = -1;
if (args.TPlayer.inventory[args.TPlayer.selectedItem].type == 205)
{
bucket = 0;
}
else if (args.TPlayer.inventory[args.TPlayer.selectedItem].type == 206)
{
bucket = 1;
}
else if (args.TPlayer.inventory[args.TPlayer.selectedItem].type == 207)
{
bucket = 2;
}
else if (args.TPlayer.inventory[args.TPlayer.selectedItem].type == 1128)
{
bucket = 3;
}
else if (args.TPlayer.inventory[args.TPlayer.selectedItem].type == 3031 ||
args.TPlayer.inventory[args.TPlayer.selectedItem].type == 3032)
{
bucket = 4;
}
if (type == 1 && !(bucket == 2 || bucket == 0))
{
args.Player.SendErrorMessage("You do not have permission to perform this action.");
args.Player.Disable("Spreading lava without holding a lava bucket", DisableFlags.WriteToLogAndConsole);
args.Player.SendTileSquare(tileX, tileY, 1);
return true;
}
if (type == 1 && TShock.Itembans.ItemIsBanned("Lava Bucket", args.Player))
{
args.Player.SendErrorMessage("You do not have permission to perform this action.");
args.Player.Disable("Using banned lava bucket without permissions", DisableFlags.WriteToLogAndConsole);
args.Player.SendTileSquare(tileX, tileY, 1);
return true;
}
if (type == 0 && !(bucket == 1 || bucket == 0 || bucket == 4))
{
args.Player.SendErrorMessage("You do not have permission to perform this action.");
args.Player.Disable("Spreading water without holding a water bucket", DisableFlags.WriteToLogAndConsole);
args.Player.SendTileSquare(tileX, tileY, 1);
return true;
}
if (type == 0 && TShock.Itembans.ItemIsBanned("Water Bucket", args.Player))
{
args.Player.SendErrorMessage("You do not have permission to perform this action.");
args.Player.Disable("Using banned water bucket without permissions", DisableFlags.WriteToLogAndConsole);
args.Player.SendTileSquare(tileX, tileY, 1);
return true;
}
if (type == 2 && !(bucket == 3 || bucket == 0))
{
args.Player.SendErrorMessage("You do not have permission to perform this action.");
args.Player.Disable("Spreading honey without holding a honey bucket", DisableFlags.WriteToLogAndConsole);
args.Player.SendTileSquare(tileX, tileY, 1);
return true;
}
if (type == 2 && TShock.Itembans.ItemIsBanned("Honey Bucket", args.Player))
{
args.Player.SendErrorMessage("You do not have permission to perform this action.");
args.Player.Disable("Using banned honey bucket without permissions", DisableFlags.WriteToLogAndConsole);
args.Player.SendTileSquare(tileX, tileY, 1);
//.........这里部分代码省略.........
开发者ID:CXUtk,项目名称:TShock,代码行数:101,代码来源:GetDataHandlers.cs
注:本文中的TShockAPI.GetDataHandlerArgs类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论