From 10318f032a894e38be27ec9ef00a5eda7be273bb Mon Sep 17 00:00:00 2001 From: stacey <57187883+moisterrific@users.noreply.github.com> Date: Wed, 12 May 2021 12:09:11 -0400 Subject: [PATCH 1/4] Improve HealOtherPlayer 0.2 check Since this check is based on damage and healing amount is based on 20% of the damage, it makes more sense to skip the check if the player has ignoredamagecap (trustedadmin and higher). --- TShockAPI/Bouncer.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/TShockAPI/Bouncer.cs b/TShockAPI/Bouncer.cs index c2ea252e..e61019df 100644 --- a/TShockAPI/Bouncer.cs +++ b/TShockAPI/Bouncer.cs @@ -1605,10 +1605,13 @@ namespace TShockAPI // and the healing you can do with that is 20% of your damage. if (amount >= TShock.Config.Settings.MaxDamage * 0.2) { + if (!args.Player.HasPermission(Permissions.ignoredamagecap) + { TShock.Log.ConsoleDebug("Bouncer / OnHealOtherPlayer 0.2 check from {0}", args.Player.Name); args.Player.Disable("HealOtherPlayer cheat attempt!", DisableFlags.WriteToLogAndConsole); args.Handled = true; return; + } } if (args.Player.HealOtherThreshold >= TShock.Config.Settings.HealOtherThreshold) From 708b455d6b990e85ce8aa5fb51b61e9254f19a9b Mon Sep 17 00:00:00 2001 From: stacey <57187883+moisterrific@users.noreply.github.com> Date: Wed, 12 May 2021 12:13:23 -0400 Subject: [PATCH 2/4] Add HealOtherCheck to changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 034d09c9..580245a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin ## Upcoming changes * Added permissions for using Teleportation Potions, Magic Conch, and Demon Conch. (@drunderscore) * `tshock.tp.tppotion`, `tshock.tp.magicconch`, and `tshock.tp.demonconch` respectively. +* Updated HealOtherPlayer damage check to make more sense by respecting `ignoredamagecap` permission. (@moisterrific) ## TShock 4.5.2 * Added preliminary support for Terraria 1.4.2.2. (@hakusaro) From e7807f6378f8d98512f6f01e25e37b169e349ee1 Mon Sep 17 00:00:00 2001 From: stacey <57187883+moisterrific@users.noreply.github.com> Date: Wed, 12 May 2021 12:18:53 -0400 Subject: [PATCH 3/4] improved the code --- TShockAPI/Bouncer.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/TShockAPI/Bouncer.cs b/TShockAPI/Bouncer.cs index e61019df..849bc722 100644 --- a/TShockAPI/Bouncer.cs +++ b/TShockAPI/Bouncer.cs @@ -1603,15 +1603,12 @@ namespace TShockAPI // Why 0.2? // @bartico6: Because heal other player only happens when you are using the spectre armor with the hood, // and the healing you can do with that is 20% of your damage. - if (amount >= TShock.Config.Settings.MaxDamage * 0.2) + if (amount >= TShock.Config.Settings.MaxDamage * 0.2 && !args.Player.HasPermission(Permissions.ignoredamagecap) { - if (!args.Player.HasPermission(Permissions.ignoredamagecap) - { TShock.Log.ConsoleDebug("Bouncer / OnHealOtherPlayer 0.2 check from {0}", args.Player.Name); args.Player.Disable("HealOtherPlayer cheat attempt!", DisableFlags.WriteToLogAndConsole); args.Handled = true; return; - } } if (args.Player.HealOtherThreshold >= TShock.Config.Settings.HealOtherThreshold) From b98c6aa282e5e7f5f635fb1ec7f48012fec69b23 Mon Sep 17 00:00:00 2001 From: stacey <57187883+moisterrific@users.noreply.github.com> Date: Wed, 12 May 2021 12:35:15 -0400 Subject: [PATCH 4/4] fix typo oops sorry --- TShockAPI/Bouncer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TShockAPI/Bouncer.cs b/TShockAPI/Bouncer.cs index 849bc722..ed4c031a 100644 --- a/TShockAPI/Bouncer.cs +++ b/TShockAPI/Bouncer.cs @@ -1603,7 +1603,7 @@ namespace TShockAPI // Why 0.2? // @bartico6: Because heal other player only happens when you are using the spectre armor with the hood, // and the healing you can do with that is 20% of your damage. - if (amount >= TShock.Config.Settings.MaxDamage * 0.2 && !args.Player.HasPermission(Permissions.ignoredamagecap) + if (amount >= TShock.Config.Settings.MaxDamage * 0.2 && !args.Player.HasPermission(Permissions.ignoredamagecap)) { TShock.Log.ConsoleDebug("Bouncer / OnHealOtherPlayer 0.2 check from {0}", args.Player.Name); args.Player.Disable("HealOtherPlayer cheat attempt!", DisableFlags.WriteToLogAndConsole);