diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index b495f0f9..faeba046 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -1514,25 +1514,26 @@ namespace TShockAPI var dmg = args.Data.ReadInt16(); var owner = args.Data.ReadInt8(); var type = args.Data.ReadInt8(); - - var index = TShock.Utils.SearchProjectile(ident); + owner = (byte)args.Player.Index; + var index = TShock.Utils.SearchProjectile(ident, owner); if (OnNewProjectile(ident, pos, vel, knockback, dmg, owner, type, index)) return true; if (index > Main.maxProjectiles || index < 0) { - return true; + return false; } - if (args.Player.Index != owner) + // Server now checks owner + ident, if owner is different, server will create new projectile. + /*if (args.Player.Index != owner) { args.Player.Disable("Owner and player ID does not match to update projectile"); args.Player.RemoveProjectile(ident, owner); return true; - } + }*/ - if (dmg > TShock.Config.MaxProjDamage) + if (dmg > TShock.Config.MaxProjDamage && !args.Player.Group.HasPermission(Permissions.ignoredamagecap)) { args.Player.Disable(String.Format("Projectile damage is higher than {0}", TShock.Config.MaxProjDamage)); args.Player.RemoveProjectile(ident, owner); @@ -1577,22 +1578,23 @@ namespace TShockAPI { var ident = args.Data.ReadInt16(); var owner = args.Data.ReadInt8(); - - var index = TShock.Utils.SearchProjectile(ident); + owner = (byte)args.Player.Index; + var index = TShock.Utils.SearchProjectile(ident, owner); if (index > Main.maxProjectiles || index < 0) { - return true; + return false; } var type = Main.projectile[index].type; - if (args.Player.Index != Main.projectile[index].owner && type != 102 && type != 100 && !TShock.Config.IgnoreProjKill) // workaround for skeletron prime projectiles + // Players can no longer destroy projectiles that are not theirs as of 1.1.2 + /*if (args.Player.Index != Main.projectile[index].owner && type != 102 && type != 100 && !TShock.Config.IgnoreProjKill) // workaround for skeletron prime projectiles { args.Player.Disable("Owner and player ID does not match to kill projectile"); args.Player.RemoveProjectile(ident, owner); return true; - } + }*/ if (TShock.CheckIgnores(args.Player)) { @@ -2025,7 +2027,7 @@ namespace TShockAPI if (TShock.Players[id] == null) return true; - if (dmg > TShock.Config.MaxDamage) + if (dmg > TShock.Config.MaxDamage && !args.Player.Group.HasPermission(Permissions.ignoredamagecap)) { args.Player.Disable(String.Format("Player damage exceeded {0}", TShock.Config.MaxDamage ) ); args.Player.SendData(PacketTypes.PlayerHp, "", id); @@ -2078,7 +2080,7 @@ namespace TShockAPI if (Main.npc[id] == null) return true; - if (dmg > TShock.Config.MaxDamage) + if (dmg > TShock.Config.MaxDamage && !args.Player.Group.HasPermission(Permissions.ignoredamagecap)) { args.Player.Disable(String.Format("NPC damage exceeded {0}", TShock.Config.MaxDamage ) ); args.Player.SendData(PacketTypes.NpcUpdate, "", id); @@ -2093,7 +2095,7 @@ namespace TShockAPI if (Main.npc[id].townNPC && !args.Player.Group.HasPermission(Permissions.movenpc)) { - args.Player.SendMessage( "What?", Color.Yellow); + args.Player.SendMessage( "You don't have permission to move the NPC", Color.Yellow); args.Player.SendData(PacketTypes.NpcUpdate, "", id); return true; } diff --git a/TShockAPI/Permissions.cs b/TShockAPI/Permissions.cs index 93df1ca0..97d6e7e4 100644 --- a/TShockAPI/Permissions.cs +++ b/TShockAPI/Permissions.cs @@ -63,6 +63,9 @@ namespace TShockAPI [Description("Prevents you from being kicked by hacked health detection")] public static readonly string ignorestathackdetection; + [Description("Prevents your actions from being ignored if damage is too high")] public static readonly string + ignoredamagecap; + [Description("Specific log messages are sent to users with this permission")] public static readonly string logs; [Description("Allows you to bypass the max slots for up to 5 slots above your max")] public static readonly string diff --git a/TShockAPI/Properties/AssemblyInfo.cs b/TShockAPI/Properties/AssemblyInfo.cs index 138251a1..668f2082 100644 --- a/TShockAPI/Properties/AssemblyInfo.cs +++ b/TShockAPI/Properties/AssemblyInfo.cs @@ -48,5 +48,5 @@ using System.Runtime.InteropServices; // Build Number // MMdd of the build -[assembly: AssemblyVersion("3.4.5.0118")] -[assembly: AssemblyFileVersion("3.4.5.0118")] +[assembly: AssemblyVersion("3.4.5.0120")] +[assembly: AssemblyFileVersion("3.4.5.0120")] diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 4f782588..f135033a 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -1068,7 +1068,7 @@ namespace TShockAPI return true; } - if (proj.hostile) + if (Main.projHostile[type]) { //player.SendMessage( proj.name, Color.Yellow); return true; diff --git a/TShockAPI/Utils.cs b/TShockAPI/Utils.cs index c93ebb11..f75013b5 100644 --- a/TShockAPI/Utils.cs +++ b/TShockAPI/Utils.cs @@ -624,14 +624,14 @@ namespace TShockAPI return true; } - public int SearchProjectile(short identity) + public int SearchProjectile(short identity, int owner) { for (int i = 0; i < Main.maxProjectiles; i++) { - if (Main.projectile[i].identity == identity) + if (Main.projectile[i].identity == identity && Main.projectile[i].owner == owner) return i; } - return 1001; + return 1000; } public string SanitizeString(string str)