/// <summary> /// Set the transition bitmap of a player; this should only be called in area /// transition scripts. This action should be run by the person "clicking" the /// area transition via AssignCommand. /// - nPredefinedAreaTransition: /// -> To use a predefined area transition bitmap, use one of AREA_TRANSITION_* /// -> To use a custom, user-defined area transition bitmap, use /// AREA_TRANSITION_USER_DEFINED and specify the filename in the second /// parameter /// - sCustomAreaTransitionBMP: this is the filename of a custom, user-defined /// area transition bitmap /// </summary> public static void SetAreaTransitionBMP(AreaTransitionType nPredefinedAreaTransition, string sCustomAreaTransitionBMP = "") { Internal.NativeFunctions.StackPushStringUTF8(sCustomAreaTransitionBMP); Internal.NativeFunctions.StackPushInteger(nPredefinedAreaTransition.InternalValue); Internal.NativeFunctions.CallBuiltIn(203); }
public static (bool, AreaTransitionInfo) HasValidAreaTransitionByType(AreaTransitionType transitionType) { int currentIslandId = WillBot.Mover.GetZoneMap()?.GetSubMap(GameController.Player.GridPos)?.IslandId ?? -1; if (currentIslandId == -1) { WillBot.LogMessageCombo($"Unable to get any island id when trying to get area transition."); return(false, null); } var closestAreaTransitionsWithinCurrentIsland = WillBot.Mover.GetZoneMap().FoundAreaTransitions.Where(x => x.Value.locatedInIslandWithId == currentIslandId)?. OrderBy(x => x.Value.areaTransitionGridPosition.DistanceSquared(GameController.Player.GridPos))?.ToList(); if (closestAreaTransitionsWithinCurrentIsland == null) { return(false, null); } foreach (var transition in closestAreaTransitionsWithinCurrentIsland) { switch (transitionType) { case AreaTransitionType.Normal: break; case AreaTransitionType.Local: if (transition.Value.hasBeenEntered == false && transition.Value.leadsToIslandWithId < 1) { WillBot.LogMessageCombo($"Found transition which has not been entered and no valid leads to island id"); return(true, transition.Value); } // if transition leads to island with less explored than current -> go else if (transition.Value.leadsToIslandWithId > 0 && transition.Value.leadsToIslandWithId != currentIslandId) { float currentSubMapExploration = WillBot.Mover.GetPercentOfCurrentSubMapExplored(); // float currentSubMapExploration = WillBot.Mover.GetZoneMap().GetSubMap(currentIslandId)?.Exploration?.ExploredFactor ?? 0; float transitionSubMapExploration = WillBot.Mover.GetZoneMap().GetSubMap(transition.Value.leadsToIslandWithId)?.Exploration?.ExploredFactor ?? 0; if (transitionSubMapExploration < currentSubMapExploration && currentSubMapExploration > 80) { WillBot.LogMessageCombo($"Found transition that leads to a less exlored submap {transitionSubMapExploration} than current {currentSubMapExploration} "); return(true, transition.Value); } } break; case AreaTransitionType.NormalToCorrupted: if (transition.Value.hasBeenEntered == false) { WillBot.LogMessageCombo($"Entering corrupted zone which has not been entered before"); return(true, transition.Value); } break; case AreaTransitionType.CorruptedToNormal: // Exit the corrupted zone after some goals have been accomplished... // Perhaps check for monsters remaining == 0 ? float currentZoneExplored = WillBot.Mover.GetPercentOfZoneExplored(); if (currentZoneExplored > 94) { return(true, transition.Value); } break; } } return(false, null); }