# Instance Release

## Description
"Instance Release" is a QoL module for AzerothCore that changes where a player ends
up after releasing their spirit while dead inside a dungeon or raid instance.

By default, `Player::RepopAtGraveyard()` falls back to the nearest graveyard linked to
the instance's parent zone, which is usually outside the instance — forcing a long walk
back in after every death. This module instead redirects the release-spirit teleport to
the instance's own entrance point (the same coordinates AzerothCore's LFG teleport-in
logic uses, via `ObjectMgr::GetMapEntranceTrigger`), so ghosts land just inside the door.

## Features
- Hooks `PlayerScript::OnPlayerCanRepopAtGraveyard` to veto the vanilla graveyard lookup
  and teleport the player to the instance entrance instead, whenever they die and release
  spirit on a dungeon or raid map.
- Falls back to vanilla behavior (nearest graveyard) if no entrance trigger is found for
  the map, so it never leaves a player stranded.
- Optionally resurrects the player on the spot (full health/mana, no resurrection
  sickness) instead of leaving them as a ghost that still has to walk to their corpse.
- Plays the same "beam of light" resurrection visual the battleground spirit-heal
  system uses, purely cosmetic, when auto-resurrecting.
- Plays a second, separately-toggleable "teleport in" flash on the player once they've
  actually landed and are back in control at the entrance (deferred slightly so it
  doesn't visually fire at the old death spot mid-teleport).
- Separately toggleable for dungeons and raids.

## Configuration
See `conf/mod_instance_release.conf.dist` (rename to `mod_instance_release.conf` to use):

```ini
InstanceRelease.Enable = 1
InstanceRelease.IncludeDungeons = 1
InstanceRelease.IncludeRaids = 1
InstanceRelease.AutoResurrect = 1
InstanceRelease.ResurrectionVisual = 1
InstanceRelease.ArrivalVisual = 1
```

## Notes
- Battlegrounds and arenas are untouched — `Map::IsDungeon()` only covers 5-player
  dungeons and raids, so BG/arena release logic is unaffected.
- Instances with multiple entrances (e.g. some multi-wing dungeons) redirect to whichever
  entrance trigger `ObjectMgr::GetMapEntranceTrigger` returns first; this is the same
  behavior AzerothCore's own LFG system relies on.
- With `AutoResurrect` off, players are left as a ghost at the entrance and still need to
  find their corpse (or a spirit healer, if one happens to exist nearby) to resurrect —
  same as vanilla release-spirit, just closer to where the fight is.