public static void OnMapChange(WorldObject obj) { PhaseShift phaseShift = obj.GetPhaseShift(); PhaseShift suppressedPhaseShift = obj.GetSuppressedPhaseShift(); ConditionSourceInfo srcInfo = new ConditionSourceInfo(obj); obj.GetPhaseShift().VisibleMapIds.Clear(); obj.GetPhaseShift().UiMapPhaseIds.Clear(); obj.GetSuppressedPhaseShift().VisibleMapIds.Clear(); foreach (var pair in Global.ObjectMgr.GetTerrainSwaps()) { if (Global.ConditionMgr.IsObjectMeetingNotGroupedConditions(ConditionSourceType.TerrainSwap, pair.Value.Id, srcInfo)) { if (pair.Key == obj.GetMapId()) { phaseShift.AddVisibleMapId(pair.Value.Id, pair.Value); } // ui map is visible on all maps foreach (uint uiMapPhaseId in pair.Value.UiMapPhaseIDs) { phaseShift.AddUiMapPhaseId(uiMapPhaseId); } } else { suppressedPhaseShift.AddVisibleMapId(pair.Value.Id, pair.Value); } } UpdateVisibilityIfNeeded(obj, false, true); }
public static void OnMapChange(WorldObject obj) { PhaseShift phaseShift = obj.GetPhaseShift(); PhaseShift suppressedPhaseShift = obj.GetSuppressedPhaseShift(); ConditionSourceInfo srcInfo = new ConditionSourceInfo(obj); obj.GetPhaseShift().VisibleMapIds.Clear(); obj.GetPhaseShift().UiWorldMapAreaIdSwaps.Clear(); obj.GetSuppressedPhaseShift().VisibleMapIds.Clear(); var visibleMapIds = Global.ObjectMgr.GetTerrainSwapsForMap(obj.GetMapId()); if (!visibleMapIds.Empty()) { foreach (TerrainSwapInfo visibleMapInfo in visibleMapIds) { if (Global.ConditionMgr.IsObjectMeetingNotGroupedConditions(ConditionSourceType.TerrainSwap, visibleMapInfo.Id, srcInfo)) { phaseShift.AddVisibleMapId(visibleMapInfo.Id, visibleMapInfo); foreach (uint uiWorldMapAreaIdSwap in visibleMapInfo.UiWorldMapAreaIDSwaps) { phaseShift.AddUiWorldMapAreaIdSwap(uiWorldMapAreaIdSwap); } } else { suppressedPhaseShift.AddVisibleMapId(visibleMapInfo.Id, visibleMapInfo); } } } UpdateVisibilityIfNeeded(obj, false, true); }