Jump to content

[Patch] Stealth for mangos 0.12


Recommended Posts

Posted

This should fix stealth detection always visible in some case and use correct formula for stealth calculation.

This can work for mangos in master tree too.

diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 4604280..14366cb 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -3290,6 +3290,8 @@ void Aura::HandleModStealth(bool apply, bool Real)

    if (apply)
    {
+        pTarget->RemoveAllAttackers();
+
        // drop flag at stealth in bg
        if(Real && pTarget->GetTypeId()==TYPEID_PLAYER && ((Player*)pTarget)->InBattleGround())
            if(BattleGround *bg = ((Player*)pTarget)->GetBattleGround())
@@ -3376,6 +3378,7 @@ void Aura::HandleInvisibility(bool apply, bool Real)
{
    if(apply)
    {
+        m_target->RemoveAllAttackers();
        m_target->m_invisibilityMask |= (1 << m_modifier.m_miscvalue);

        if(Real && m_target->GetTypeId()==TYPEID_PLAYER)
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 743fbf3..79ed8a4 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -8833,22 +8833,28 @@ bool Unit::isVisibleForOrDetect(Unit const* u, bool detect, bool inVisibleList,
    if(!u->HasAuraType(SPELL_AURA_DETECT_STEALTH))
    {
        //Calculation if target is in front
+        //Base visible distance for every unit in stealth.
+        float visibleDistance = 10.0f;

-        //Visible distance based on stealth value (stealth rank 4 300MOD, 10.5 - 3 = 7.5)
-        float visibleDistance = 10.5f - (GetTotalAuraModifier(SPELL_AURA_MOD_STEALTH)/100.0f);
+        //Stealth Level is calculated from stealth skill lvl 70 and stealtk rank 4 = 350 skill so 5 skill point = 1 level
+        float stealthLevel = (GetTotalAuraModifier(SPELL_AURA_MOD_STEALTH)/5.0f);
+        float enemyLevel   = float(u->getLevelForTarget(this)); 

-        //Visible distance is modified by
-        //-Level Diff (every level diff = 1.0f in visible distance)
-        visibleDistance += int32(u->getLevelForTarget(this)) - int32(getLevelForTarget(u));
+        //Skill for detection of the unit that is try to detect.
+        int32 enemyDetection = u->GetTotalAuraModifier(SPELL_AURA_MOD_DETECT);
+        if(enemyDetection<0)
+            enemyDetection = 0;

-        //This allows to check talent tree and will add addition stealth dependent on used points)
-        int32 stealthMod = GetTotalAuraModifier(SPELL_AURA_MOD_STEALTH_LEVEL);
+        //Skill for mod stealth level of the unit in stealth.
+        int32 stealthMod     = GetTotalAuraModifier(SPELL_AURA_MOD_STEALTH_LEVEL);
        if(stealthMod < 0)
            stealthMod = 0;
+        
+        //Visible distance is mod by enemyDetection and stealth mod (5 skill point = 1 level )
+        visibleDistance+= (enemyDetection-stealthMod)/5.0f;

-        //-Stealth Mod(positive like Master of Deception) and Stealth Detection(negative like paranoia)
-        //based on wowwiki every 5 mod we have 1 more level diff in calculation
-        visibleDistance += (int32(u->GetTotalAuraModifier(SPELL_AURA_MOD_DETECT)) - stealthMod)/5.0f;
+        //Visibile distance is mod by level diff 
+        visibleDistance+= (enemyLevel - stealthLevel);

        if(!IsWithinDist(u,visibleDistance))
            return false;
    }


Posted

From wowwiki history page we can found

http://www.wowwiki.com/index.php?title=Stealth_(mechanic)&oldid=1697680

"When maxed, MoD is equivalent to 3 extra character levels" in 2.4.3 MoD is 5 point talent so 15 point total -> 5 point = 1 level diff.

"Detection is an innate skill that all players and mobs have, and this increases by 5 points per level" so we base our calc on level diff.

The only things that are missing (i wasnt able to found anything in internet):

- Base start range. (i set it at 10 yard)

- and the equation level per yard. (i set it at 1 level = 1 yard)

Posted

Sorry I am very new to this whole proccess. How do I apply this fix. I am running AC Web MaNGOS Hybrid with Navicat. Client build: 9901 (3.1.2)

- Core update: 7728->7838

- ScriptDev2 update: 1032->1100

Again I am very new so any help would be great. I am completely unfamiliar with SQL and C++.

Posted
Sorry I am very new to this whole proccess. How do I apply this fix. I am running AC Web MaNGOS Hybrid with Navicat. Client build: 9901 (3.1.2)

- Core update: 7728->7838

- ScriptDev2 update: 1032->1100

Again I am very new so any help would be great. I am completely unfamiliar with SQL and C++.

Save patch contents to file. Apply to source with git apply. Rebuild and run.

Posted
Save patch contents to file. Apply to source with git apply. Rebuild and run.

This is going to frustrate you to no end I'm sure. In fact you'll probably wonder why I'm even running a server if I don't know how to do these simple things but...

1. Save it as what kind of file? Copy and paste?

2. What is git? How do I get it. And how do I apply it to source.

3. How do I rebuild and what am I rebuilding?

Like I said before I am totaly new to this. Please forgive my igmorance. If you don't want to waste anymore of your time on me I will unerstand. Could you please just point me in the right direction.

Posted
This is going to frustrate you to no end I'm sure. In fact you'll probably wonder why I'm even running a server if I don't know how to do these simple things but...

1. Save it as what kind of file? Copy and paste?

2. What is git? How do I get it. And how do I apply it to source.

3. How do I rebuild and what am I rebuilding?

Like I said before I am totaly new to this. Please forgive my igmorance. If you don't want to waste anymore of your time on me I will unerstand. Could you please just point me in the right direction.

repacks are NOT supported. Read the compiling guide stickied on the forum.

Hijacking threads is bad.

Posted
This is going to frustrate you to no end I'm sure. In fact you'll probably wonder why I'm even running a server if I don't know how to do these simple things but...

1. Save it as what kind of file? Copy and paste?

2. What is git? How do I get it. And how do I apply it to source.

3. How do I rebuild and what am I rebuilding?

Like I said before I am totaly new to this. Please forgive my igmorance. If you don't want to waste anymore of your time on me I will unerstand. Could you please just point me in the right direction.

1. Any kind of file, just copy and paste it into one.

2. You need git to download the source code, unless you used a zip pack or whatever it comes in.

3. You are rebuilding the source code which you downloaded from the official git source (http://github.com/mangos/mangos) and from which you built the server with, the server which you most definitely did NOT get already compiled from a third-party and completely unsupported site.

(HINT: read the official guides in the Installation & Configuration section)

  • 3 weeks later...
Posted

Some mistake in patch?

+        //Visible distance is mod by enemyDetection and stealth mod (5 skill point = 1 level )
+        visibleDistance+= (enemyDetection-stealthMod)/5.0f;
+        //Visibile distance is mod by level diff 
+        visibleDistance+= (enemyLevel - stealthLevel);

Why visibleDistance+= twice ?

  • 5 weeks later...
Posted

recently I can say that in mangos-0.12 players in stealth are visible for all players from opposite faction without dependency of level difference or position (1lvl horde can detect 70lvl alliance)

I'll checkout patch posted and give feedback

hm, weird - with this patch when approaching enemy target I receive immediatly combat state. other stealth features are working fine. anyone can reproduce?

mangos-0.12

Re-enable in more clear way anti-crash client protection at enslave demon.

commit ea3506556d58270325d17896bfff4019991fd8f3

  • 4 months later...
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use