Jump to content

[patch] Ressurect to teleport in instance


Recommended Posts

Posted

For 11426 revision.

diff --git a/src/game/AuctionHouseMgr.cpp b/src/game/AuctionHouseMgr.cpp
diff --git a/src/game/MapManager.cpp b/src/game/MapManager.cpp
index cece28f..5930b1e 100644
--- a/src/game/MapManager.cpp
+++ b/src/game/MapManager.cpp
@@ -173,11 +173,14 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player)
                Group* group = player->GetGroup();
                if (!group || !group->isRaidGroup())
                {
-                    // probably there must be special opcode, because client has this string constant in GlobalStrings.lua
-                    // TODO: this is not a good place to send the message
-                    player->GetSession()->SendAreaTriggerMessage("You must be in a raid group to enter %s instance", mapName);
-                    DEBUG_LOG("MAP: Player '%s' must be in a raid group to enter instance of '%s'", player->GetName(), mapName);
-                    return false;
+                    if (player->isAlive())      // no area message for ghost player
+                    {
+                        // probably there must be special opcode, because client has this string constant in GlobalStrings.lua
+                        // TODO: this is not a good place to send the message
+                        player->GetSession()->SendAreaTriggerMessage("You must be in a raid group to enter %s instance", mapName);
+                        DEBUG_LOG("MAP: Player '%s' must be in a raid group to enter instance of '%s'", player->GetName(), mapName);
+                        return false;
+                    }
                }
            }
        }
diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp
index d03cb8f..3d70e41 100644
--- a/src/game/MiscHandler.cpp
+++ b/src/game/MiscHandler.cpp
@@ -806,6 +806,49 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data)
                GetPlayer()->SendTransferAborted(at->target_mapId, TRANSFER_ABORT_DIFFICULTY, GetPlayer()->GetDifficulty(mapEntry->IsRaid()));
            return;
        }
+
+        // ressurect to teleport in instance
+        if (mapEntry->IsDungeon() || mapEntry->IsRaid())
+        {
+            if (!GetPlayer()->isAlive())
+            {
+                Group* group = GetPlayer()->GetGroup();
+                Corpse* corpse = GetPlayer()->GetCorpse();
+                uint32 corpsemapid = corpse->GetMapId();
+                MapEntry const* corpseMapEntry = sMapStore.LookupEntry(corpsemapid);
+
+                if (group)
+                {
+                    if (corpsemapid != GetPlayer()->GetMapId())
+                    {
+                        if (corpseMapEntry->IsDungeon() && corpseMapEntry->ghost_entrance_map >= 0)
+                        {
+                            GetPlayer()->ResurrectPlayer(0.5f);
+                            GetPlayer()->SpawnCorpseBones();
+
+                            // not area message
+                            if (!group->isRaidGroup() && mapEntry->IsRaid())
+                                return;
+                        }
+                    }
+                }
+                else
+                {
+                    if (corpsemapid != GetPlayer()->GetMapId())
+                    {
+                        if (corpseMapEntry->IsDungeon() && corpseMapEntry->ghost_entrance_map >= 0)
+                        {
+                            GetPlayer()->ResurrectPlayer(0.5f);
+                            GetPlayer()->SpawnCorpseBones();
+
+                            // not area message
+                            if (mapEntry->IsRaid())
+                                return;
+                        }
+                    }
+                }
+            }
+        }
    }

    GetPlayer()->TeleportTo(at->target_mapId, at->target_X, at->target_Y, at->target_Z, at->target_Orientation, TELE_TO_NOT_LEAVE_TRANSPORT);
diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp
index 7ecd4bd..ea77930 100644
--- a/src/game/MovementHandler.cpp
+++ b/src/game/MovementHandler.cpp
@@ -169,17 +169,6 @@ void WorldSession::HandleMoveWorldportAckOpcode()
        GetPlayer()->m_taxi.ClearTaxiDestinations();
    }

-    // resurrect character at enter into instance where his corpse exist after add to map
-    Corpse *corpse = GetPlayer()->GetCorpse();
-    if (corpse && corpse->GetType() != CORPSE_BONES && corpse->GetMapId() == GetPlayer()->GetMapId())
-    {
-        if( mEntry->IsDungeon() )
-        {
-            GetPlayer()->ResurrectPlayer(0.5f);
-            GetPlayer()->SpawnCorpseBones();
-        }
-    }
-
    if (mInstance)
    {
        Difficulty diff = GetPlayer()->GetDifficulty(mEntry->IsRaid());
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index b3bf4c0..d455b41 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -4446,13 +4446,6 @@ void Player::BuildPlayerRepop()
    // there must be SMSG.STOP_MIRROR_TIMER
    // there we must send 888 opcode

-    // the player cannot have a corpse already, only bones which are not returned by GetCorpse
-    if(GetCorpse())
-    {
-        sLog.outError("BuildPlayerRepop: player %s(%d) already has a corpse", GetName(), GetGUIDLow());
-        MANGOS_ASSERT(false);
-    }
-
    // create a corpse and place it at the player's location
    Corpse *corpse = CreateCorpse();
    if(!corpse)

×
×
  • 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