diff --git a/TShockAPI/Bouncer.cs b/TShockAPI/Bouncer.cs index 2cae6ca0..8d1c9d93 100644 --- a/TShockAPI/Bouncer.cs +++ b/TShockAPI/Bouncer.cs @@ -945,6 +945,7 @@ namespace TShockAPI byte owner = args.Owner; short type = args.Type; int index = args.Index; + float[] ai = args.Ai; if (index > Main.maxProjectiles) { @@ -1082,6 +1083,20 @@ namespace TShockAPI return; } + if ( + (Projectile_MaxValuesAI.ContainsKey(type) && + (ai[0] > Projectile_MaxValuesAI[type] || ai[0] < Projectile_MinValuesAI[type])) || + + (Projectile_MaxValuesAI2.ContainsKey(type) && + (ai[1] > Projectile_MaxValuesAI2[type] || ai[1] < Projectile_MaxValuesAI2[type])) + ) + { + TShock.Log.ConsoleDebug("Bouncer / OnNewProjectile rejected from bouncer modified AI from {0}.", args.Player.Name); + args.Player.RemoveProjectile(ident, owner); + args.Handled = true; + return; + } + if (!args.Player.HasPermission(Permissions.ignoreprojectiledetection)) { if (type == ProjectileID.CrystalShard && TShock.Config.Settings.ProjIgnoreShrapnel) // Ignore crystal shards @@ -2496,5 +2511,45 @@ namespace TShockAPI { ProjectileID.GoldShortswordStab, ItemID.GoldShortsword }, { ProjectileID.PlatinumShortswordStab, ItemID.PlatinumShortsword } }; + + private Dictionary Projectile_MinValuesAI = new Dictionary { + { 611, -1 }, + + { 950, 0 } + }; + private Dictionary Projectile_MaxValuesAI = new Dictionary { + { 611, 1 }, + + { 950, 0 } + }; + + private Dictionary Projectile_MinValuesAI2 = new Dictionary { + { 405, 0 }, + { 410, 0 }, + + { 424, 0 }, + { 425, 0 }, + { 426, 0 }, + + { 612, 0 }, + { 953, 0 }, + + { 756, 0 }, + { 522, 0 } + }; + private Dictionary Projectile_MaxValuesAI2 = new Dictionary { + { 405, 2 }, + { 410, 2 }, + + { 424, 1 }, + { 425, 1 }, + { 426, 1 }, + + { 612, 2 }, + { 953, 2 }, + + { 756, 1 }, + { 522, 0 } + }; } }