• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

Fix totem going through walls

Neth

BETA Tester
Hi, this little diff will fix totem going through LoS (useful in arena)

I adapted it for newest TC ( as of we speak )

Code:
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index a26c035..97507fc 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -1454,10 +1454,19 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplici
         dist = objSize + (dist - objSize) * (float)rand_norm();
 
     Position pos;
-    if (targetType.GetTarget() == TARGET_DEST_CASTER_FRONT_LEAP)
-        m_caster->GetFirstCollisionPosition(pos, dist, angle);
-    else
-        m_caster->GetNearPosition(pos, dist, angle);
+    switch (targetType.GetTarget())
+    {
+        case TARGET_DEST_CASTER_FRONT_LEAP:
+        case TARGET_DEST_CASTER_FRONT_LEFT:
+        case TARGET_DEST_CASTER_BACK_LEFT:
+        case TARGET_DEST_CASTER_BACK_RIGHT:
+        case TARGET_DEST_CASTER_FRONT_RIGHT:
+            m_caster->GetFirstCollisionPosition(pos, dist, angle);
+            break;
+        default:
+            m_caster->GetNearPosition(pos, dist, angle);
+            break;
+    }
     m_targets.SetDst(*m_caster);
     m_targets.ModDst(pos);
 }
 

Parranoia

Insane Member
Anywho, for what it's worth this is what I used to solve the issue.
Only downside is that it is setup to only work in arenas.

Still neat to see how others accomplished it :)

Code:
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index ec6a3e5..bcecf38 100644
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -2233,6 +2233,13 @@ TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropert
         default:
             return NULL;
     }
+    
+    float x = pos.GetPositionX(), y = pos.GetPositionY(), z = pos.GetPositionZ();
+    float floor_z = GetHeight(phase, x, y, z);
+    float ground_z = GetHeight(phase, x, y, MAX_HEIGHT);
+    
+    if (summoner && ground_z == floor_z && IsBattleArena())
+      summoner->GetPosition(x, y, z); // If we are in an arena and the position is inside a wall, make the position the same as the players
 
     if (!summon->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), this, phase, entry, vehId, team, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()))
     {
 

Tommy

Founder
Anywho, for what it's worth this is what I used to solve the issue.
Only downside is that it is setup to only work in arenas.

Still neat to see how others accomplished it :)

Code:
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index ec6a3e5..bcecf38 100644
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -2233,6 +2233,13 @@ TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropert
         default:
             return NULL;
     }
+    
+    float x = pos.GetPositionX(), y = pos.GetPositionY(), z = pos.GetPositionZ();
+    float floor_z = GetHeight(phase, x, y, z);
+    float ground_z = GetHeight(phase, x, y, MAX_HEIGHT);
+    
+    if (summoner && ground_z == floor_z && IsBattleArena())
+      summoner->GetPosition(x, y, z); // If we are in an arena and the position is inside a wall, make the position the same as the players
 
     if (!summon->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), this, phase, entry, vehId, team, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()))
     {

Indeed, I enjoy looking at what people can come up with! Thanks for that diff as well. <3
 
Top