Trinitycore: Going too small in size will make character levitating

Created on 5 Jan 2020  路  24Comments  路  Source: TrinityCore/TrinityCore

Description:
When a character goes too small in size, it becomes levitating

Here is the video demonstrating how to reproduce and what is happening exactly
https://mega.nz/#!CxlG3QyY!h-Sx_K-LXelp6Z5DR9TZRwfwLXZUSNBNMtukmvfFo0Q

When character becomes too small, the character is actually looks "up side down", I think it is something became a negative number when calculating the position or whatever.

Expected behaviour:
Character does not go too small or levitate

Steps to reproduce the problem:

  1. Add item 43480 (Small Feast) and eat it
  2. Add item 8529 (Noggenfogger Elixir) and drink it until you become smaller
  3. Add item 44228 (Baby Spice) and throw it on yourself
  4. At this point you are now underground (character looks up side down)
  5. Summon a mount, it may dismount itself or you will be on mount still, hit space bar to jump and you are levitating

Branch(es):
3.3.5

TC rev. hash/commit:
commit 465db82cd96a05ca3b2a1b5ecf59e4287968e3fe

Operating system:
Debian 10.2.0

Branch-3.3.5a Comp-Core Feedback-PatchFix Sub-Spells

Most helpful comment

what about just leaving the old code and applying a std::max(0.1f, scale); with 0.1f being whatever minimum scale allowed ?

All 24 comments

Negative scale. Additive aura stacking. Broken since c69a7d1223b2ce108a221e5cc70f76cd80ae6675

are % mods supposed to be added instead of being multiplied ?

can we add an exception for scaling there that it can never reach a negative value?

so i revered it for the scaling system to the old state

works fine for me - you no longer get negative size

```diff
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index f8773b7c7f..924c6beae4 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -2123,7 +2123,9 @@ void AuraEffect::HandleAuraModScale(AuraApplication const* aurApp, uint8 mode, b
Unit* target = aurApp->GetTarget();

 float scale = target->GetObjectScale();

- scale += CalculatePct(1.0f, apply ? GetAmount() : -GetAmount());
+ if (scale == -100.0f) // prevent size to become zero
+ scale = -99.99f;
+ scale *= (apply ? (100.0f + float(GetAmount())) / 100.0f : 100.0f / (100.0f + float(GetAmount())));
target->SetObjectScale(scale);
}
```

This is the old funtion for it:

inline void ApplyPercentModFloatVar(float& var, float val, bool apply)
{
    if (val == -100.0f)     // prevent set var to zero
        val = -99.99f;
    var *= (apply ? (100.0f + val) / 100.0f : 100.0f / (100.0f + val));
}

what about just leaving the old code and applying a std::max(0.1f, scale); with 0.1f being whatever minimum scale allowed ?

that sounds better!

any idea about what smallest scale to allow ?

With the command .mod scale you cannot use a value lower than 0.1 so it's probably the limit

Make it 0.01, there are auras that have value -99 (since basepoints are int, theres nothing between -100 and -99)

There are also some auras with ridiculous value too... 42969

sooo

diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index e975e43e40..1190b1cceb 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -2124,7 +2124,10 @@ void AuraEffect::HandleAuraModScale(AuraApplication const* aurApp, uint8 mode, b

     float scale = target->GetObjectScale();
     scale += CalculatePct(1.0f, apply ? GetAmount() : -GetAmount());
-    target->SetObjectScale(scale);
+    if (target->GetTypeId() == TYPEID_PLAYER)
+        target->SetObjectScale(std::max((0.1f), scale));
+    else
+        target->SetObjectScale(std::max((0.01f), scale));
 }

 void AuraEffect::HandleAuraCloneCaster(AuraApplication const* aurApp, uint8 mode, bool apply) const

but i would also suggest 0.1 since 0.01 will make player invisible again :/

The entire point of the aura I gave as example is to make a creature invisible...

@Rushor could you please PR that ?

But Well then people will still be invisible by applying multiple size auras. Sooo it was intended to be invisible with multiple size auras on retail?

Maybe shouldn't stack those auras and only get the higher effect

No they stack, but it could be the limit for npcs and players is not the same

okay so f.ex: ID - 42969 Explosion Fade Away should only target npcs? we can add a check for player and creature here

It looks like the spell 42969 go beyond the minimum value, if you .cast 42969 you will shrink then grow back flipped https://imgur.com/a/VAcqtqO

Maybe that is intended. Should that spell only target creatures?

Spell=42969 : Explosion Fade Away : Turns the caster invisible and increases its movement speed by 0% for until cancelled.
It not used by any script, and found in sniffs, but probably used by an npc trigger.

Still relevant for 7c91c42. Maybe use a @Rushor script? It works quite efficiently.

@Rushor, can you open PR?

No, his patch is bad because it breaks unapply case

Was this page helpful?
0 / 5 - 0 ratings

Related issues

funjoker picture funjoker  路  3Comments

Tatara902 picture Tatara902  路  3Comments

Jildor picture Jildor  路  3Comments

Rushor picture Rushor  路  3Comments

cbcs picture cbcs  路  3Comments