internal static void OnRegionChange(Mobile m, Region oldRegion, Region newRegion) { if (newRegion != null && m.NetState != null) { m.CheckLightLevels(false); if (oldRegion == null || oldRegion.Music != newRegion.Music) { m.Send(PlayMusic.GetInstance(newRegion.Music)); } } Region oldR = oldRegion; Region newR = newRegion; while (oldR != newR) { int oldRChild = (oldR != null ? oldR.ChildLevel : -1); int newRChild = (newR != null ? newR.ChildLevel : -1); if (oldRChild >= newRChild) { oldR.OnExit(m); oldR = oldR.Parent; } if (newRChild >= oldRChild) { newR.OnEnter(m); newR = newR.Parent; } } }