public static bool TeleportToGlobalMapPoint(BlueprintGlobalMapPoint destination) { if (GlobalMapView.Instance != null) { var globalMapController = Game.Instance.GlobalMapController; GlobalMapUI globalMapUI = Game.Instance.UI.GlobalMapUI; GlobalMapView globalMapView = GlobalMapView.Instance; GlobalMapState globalMapState = Game.Instance.Player.GetGlobalMap(destination.GlobalMap); GlobalMapPointState pointState = Game.Instance.Player.GetGlobalMap(destination.GlobalMap).GetPointState(destination); pointState.EdgesOpened = true; pointState.Reveal(); GlobalMapPointView pointView = globalMapView.GetPointView(destination); if ((bool)(UnityEngine.Object)globalMapView) { if ((bool)(UnityEngine.Object)pointView) { globalMapView.RevealLocation(pointView); } } foreach (var edge in pointState.Edges) { edge.UpdateExplored(1f, 1); globalMapView.GetEdgeView(edge.Blueprint).UpdateRenderers(); } globalMapController.StartTravels(); EventBus.RaiseEvent <IGlobalMapPlayerTravelHandler>((Action <IGlobalMapPlayerTravelHandler>)(h => h.HandleGlobalMapPlayerTravelStarted((IGlobalMapTraveler)globalMapView.State.Player))); globalMapView.State.Player.SetCurrentPosition(new GlobalMapPosition(destination)); globalMapView.GetPointView(destination)?.OpenOutgoingEdges((GlobalMapPointView)null); globalMapView.UpdatePawnPosition(); globalMapController.Stop(); EventBus.RaiseEvent <IGlobalMapPlayerTravelHandler>((Action <IGlobalMapPlayerTravelHandler>)(h => h.HandleGlobalMapPlayerTravelStopped((IGlobalMapTraveler)globalMapView.State.Player))); globalMapView.PlayerPawn.m_Compass.TryClear(); globalMapView.PlayerPawn.m_Compass.TrySet(); #if false globalMapView.TeleportParty(globalMapPoint); globalMapUI.HandleGlobalMapPlayerTravelStopped(globalMapState.Player); GlobalMapPointState pointState = Game.Instance.Player.GlobalMap.GetPointState(globalMapPoint); pointState.EdgesOpened = true; pointState.Reveal(); GlobalMapPointView pointView = globalMapView.GetPointView(globalMapPoint); pointView?.OpenOutgoingEdges((GlobalMapPointView)null); globalMapView.RevealLocation(pointView); if ((bool)(UnityEngine.Object)globalMapView) { if ((bool)(UnityEngine.Object)pointView) { globalMapView.RevealLocation(pointView); } } globalMapView.UpdatePawnPosition(); pointState.LastVisited = Game.Instance.TimeController.GameTime; #endif return(true); } return(false); }
public static void Prefix( GlobalMapState state, GlobalMapView view, IGlobalMapTraveler traveler, ref float visualStepDistance) { // TODO - can we get rid of the other map movement multipliers and do them all here? if (traveler is GlobalMapArmyState armyState && armyState.Data.Faction == ArmyFaction.Crusaders) { var speedMultiplier = Mathf.Clamp(settings.travelSpeedMultiplier, 0.1f, 100f); visualStepDistance = speedMultiplier * visualStepDistance; } }
private static void UpdateMap(GlobalMapRules instance, GlobalMapState globalMap, IEnumerable <BlueprintMapEdge> blueprintMapEdgeSet) { foreach (var blueprint in blueprintMapEdgeSet) { try { globalMap.GetEdgeData(blueprint).UpdateExplored(1f, 1); if ((bool)instance) { instance.GetEdgeObject(blueprint).UpdateRenderers(); } } catch (Exception ex) { modLogger.Log(ex.ToString()); } } }
public void mod_Tick() { if (!KingmakerPatchSettings.Cheats.Abracadabra) { this.source_Tick(); return; } GlobalMapState globalMap = Kingmaker.Game.Instance.Player.GlobalMap; Dictionary <BlueprintLocation, LocationData> .ValueCollection locations = globalMap.Locations.Values; // don't run foreach on tick if we don't have to // this will return true until all locations, except hidden locations and waypoints, are revealed bool canRevealLocations = locations.Any(l => !l.IsRevealed && !IsHiddenOrWaypoint(l)); if (!canRevealLocations) { return; } // removed distance checks foreach (LocationData locationData in locations) { if (locationData.IsRevealed) { continue; } GlobalMapLocation locationObject = GlobalMapRules.Instance.GetLocationObject(locationData.Blueprint); if (!locationObject) { continue; } ConditionsChecker possibleToRevealCondition = locationData.Blueprint.PossibleToRevealCondition; LocationType type = locationData.Blueprint.Type; switch (type) { case LocationType.Location: case LocationType.Landmark: if (!possibleToRevealCondition.HasConditions || possibleToRevealCondition.Check()) { GlobalMapRules.Instance.RevealLocation(locationObject); } break; default: if (type != LocationType.HiddenLocation) { continue; } if (possibleToRevealCondition.HasConditions && !possibleToRevealCondition.Check()) { continue; } GlobalMapRules.Instance.RevealLocation(locationObject); break; } } }