[Instance] OnPlayerLeave Function

This is a patch to add OnPlayerLeave for instances, which can be used just like OnPlayerEnter

this calls OnPlayerLeave before removing him from the map and world, so we can perform actions on him before he leaves.

diff --git a/src/server/game/Instances/InstanceScript.h b/src/server/game/Instances/InstanceScript.h

index 71f1572..b1dfa3d 100755

-- a/src/server/game/Instances/InstanceScript.h

++ b/src/server/game/Instances/InstanceScript.h

@@ -158,6 +158,9 @@ class InstanceScript : public ZoneScript

	 //Called when a player successfully enters the instance.

	 virtual void OnPlayerEnter(Player* /*player*/) {}

+ // Called before a player is removed from the instance.

+ virtual void OnPlayerLeave(Player* /*player*/) {}	 //Handle open / close objects

	 //use HandleGameObject(0, boolen, GO); in OnObjectCreate in instance scripts

	 //use HandleGameObject(GUID, boolen, NULL); in any other script

diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp

index 162dd12..97e9417 100755

-- a/src/server/game/Maps/Map.cpp

++ b/src/server/game/Maps/Map.cpp

@@ -2509,6 +2509,10 @@ void InstanceMap::RemovePlayerFromMap(Player* player, bool remove)

+if (i_data)

+ i_data->OnPlayerLeave(player);

if (!m_unloadTimer && m_mapRefManager.getSize() == 1)

	 m_unloadTimer = m_unloadWhenEmpty ? MIN_UNLOAD_DELAY : std::max(sWorld->getIntConfig(CONFIG_INSTANCE_UNLOAD_DELAY), (uint32)MIN_UNLOAD_DELAY);

Map::RemovePlayerFromMap(player, remove);



proper spacing would be nice. Also, Pull Request…