public void StartFastTravel(ContentReader.MapSummary destinationSummary)
        {
            DFLocation targetLocation;

            if (DaggerfallUnity.Instance.ContentReader.GetLocation(
                    destinationSummary.RegionIndex, destinationSummary.MapIndex, out targetLocation))
            {
                destinationName          = targetLocation.Name;
                travelUi.DestinationName = destinationName;
            }
            else
            {
                throw new ArgumentException("TediousTravel destination not found!");
            }

            playerAutopilot            = new PlayerAutoPilot(destinationSummary);
            playerAutopilot.OnArrival += () =>
            {
                travelUi.CancelWindow();
                DaggerfallUI.Instance.DaggerfallHUD.SetMidScreenText("You have arrived at your destination", 5f);
            };

            this.destinationSummary = destinationSummary;
            DisableAnnoyingSounds();
            DisableWeather();
            SetTimeScale(travelUi.TimeCompressionSetting);
            diseaseCount = GameManager.Instance.PlayerEffectManager.DiseaseCount;

            Debug.Log("started tedious travel");
        }
Exemple #2
0
        public PlayerAutoPilot(ContentReader.MapSummary destinationSummary, float travelSpeedMultiplier = 1f)
        {
            this.destinationSummary    = destinationSummary;
            this.travelSpeedMultiplier = travelSpeedMultiplier;
            InitDestination();

            lastPlayerMapPixel = new DFPosition(int.MaxValue, int.MaxValue);
        }
        protected override bool checkLocationDiscovered(ContentReader.MapSummary summary)
        {
            // If ports filter is on, only return true if it's a port
            if (portsFilter && !HasPort(summary))
            {
                return(false);
            }

            return(base.checkLocationDiscovered(summary));
        }
        public static Rect GetLocationRect(ContentReader.MapSummary mapSummary)
        {
            DFLocation targetLocation;

            if (!DaggerfallUnity.Instance.ContentReader.GetLocation(
                    mapSummary.RegionIndex, mapSummary.MapIndex, out targetLocation))
            {
                throw new ArgumentException("TediousTravel destination not found!");
            }
            return(DaggerfallLocation.GetLocationRect(targetLocation));
        }
        public TravelInfo CalculateTravelInfo(ContentReader.MapSummary locationSummary, DFPosition destination)
        {
            // travel time calculator (unfortunately) has side-effects. You must calculate the
            // travel time and then calculate the costs using the same instance.
            TravelTimeCalculator travelTimeCalculator = new TravelTimeCalculator();
            var travelTimeMinutes = travelTimeCalculator.CalculateTravelTime(destination,
                                                                             false, useInns, true, PlayerOwnsHorse(), PlayerHasCart());

            bool playerOwnsShip = DaggerfallWorkshop.Game.Banking.DaggerfallBankManager.OwnsShip;

            travelTimeCalculator.CalculateTripCost(travelTimeMinutes, useInns, playerOwnsShip, true);
            var tripCost = travelTimeCalculator.TotalCost;

            return(new TravelInfo(travelTimeMinutes, tripCost));
        }
Exemple #6
0
        /// <summary>
        /// Gets map pixel data for any location in world.
        /// </summary>
        public static MapPixelData GetMapPixelData(ContentReader contentReader, int mapPixelX, int mapPixelY)
        {
            // Read general data from world maps
            int worldHeight  = contentReader.WoodsFileReader.GetHeightMapValue(mapPixelX, mapPixelY);
            int worldClimate = contentReader.MapFileReader.GetClimateIndex(mapPixelX, mapPixelY);
            int worldPolitic = contentReader.MapFileReader.GetPoliticIndex(mapPixelX, mapPixelY);

            // Get location if present
            int    id = -1, regionIndex = -1, mapIndex = -1;
            string locationName = string.Empty;

            ContentReader.MapSummary mapSummary = new ContentReader.MapSummary();
            bool hasLocation = contentReader.HasLocation(mapPixelX, mapPixelY, out mapSummary);

            if (hasLocation)
            {
                id          = mapSummary.ID;
                regionIndex = mapSummary.RegionIndex;
                mapIndex    = mapSummary.MapIndex;
                DFLocation location = contentReader.MapFileReader.GetLocation(regionIndex, mapIndex);
                locationName = location.Name;
            }

            // Create map pixel data
            MapPixelData mapPixel = new MapPixelData()
            {
                inWorld          = true,
                mapPixelX        = mapPixelX,
                mapPixelY        = mapPixelY,
                worldHeight      = worldHeight,
                worldClimate     = worldClimate,
                worldPolitic     = worldPolitic,
                hasLocation      = hasLocation,
                mapRegionIndex   = regionIndex,
                mapLocationIndex = mapIndex,
                locationID       = id,
                locationName     = locationName,
                LocationType     = mapSummary.LocationType
            };

            return(mapPixel);
        }
        public void BeginTravel(ContentReader.MapSummary destinationSummary, bool speedCautious = false)
        {
            DFLocation targetLocation;

            if (DaggerfallUnity.Instance.ContentReader.GetLocation(destinationSummary.RegionIndex, destinationSummary.MapIndex, out targetLocation))
            {
                DestinationName = targetLocation.Name;
                travelControlUI.SetDestination(targetLocation.Name);
                DestinationSummary  = destinationSummary;
                DestinationCautious = speedCautious;
                if (alwaysUseStartingAccel)
                {
                    travelControlUI.TimeAcceleration = defaultStartingAccel;
                }
                BeginTravel();
                beginTime = DaggerfallUnity.Instance.WorldTime.Now.ToClassicDaggerfallTime();
            }
            else
            {
                throw new Exception("TravelOptions: destination not found!");
            }
        }
Exemple #8
0
        protected override bool checkLocationDiscovered(ContentReader.MapSummary summary)
        {
            // If ports filter is on, only return true if it's a port
            if (portsFilter && !HasPort(summary))
            {
                return(false);
            }

            // Hidden Map Locations: Reveal ports if setting enabled.
            if (TravelOptionsMod.Instance.HiddenMapLocationsEnabled)
            {
                if (TravelOptionsMod.Instance.HiddenMapLocationsRevealPorts && HasPort(summary))
                {
                    return(true);
                }
                else
                {
                    return(discoveredMapSummaries.Contains(summary) || revealedLocationTypes.Contains(summary.LocationType));
                }
            }

            return(base.checkLocationDiscovered(summary));
        }
        public TravelInfo CalculateTravelInfo(ContentReader.MapSummary locationSummary, DFPosition destination)
        {
            bool playerOwnsShip = DaggerfallWorkshop.Game.Banking.DaggerfallBankManager.OwnsShip;
            var  travelTime     = travelTimeCalculator.CalculateTravelTime(destination, false, false, true, false, false);

            if (!playerOwnsShip)
            {
                travelTime = (int)Math.Round((float)travelTime * GetLocationTraveltimeModifier(
                                                 GameManager.Instance.PlayerGPS.CurrentLocationType,
                                                 locationSummary.LocationType));
            }

            var days = (int)Math.Ceiling((float)travelTime / 1440);

            var tripCost = 0;

            if (!playerOwnsShip && !GameManager.Instance.GuildManager.FreeShipTravel())
            {
                tripCost = days * 15;
            }

            return(new TravelInfo(travelTime, tripCost));
        }
Exemple #10
0
 public static bool HasPort(ContentReader.MapSummary mapSummary)
 {
     return(HasPort(mapSummary.ID));
 }
 public static bool HasPort(ContentReader.MapSummary mapSummary)
 {
     return(Array.Exists(portLocationIds, n => n == mapSummary.ID));
 }
 public PlayerAutoPilot(ContentReader.MapSummary destinationSummary)
 {
     this.destinationSummary = destinationSummary;
     Init();
 }
Exemple #13
0
 public PlayerAutoPilot(ContentReader.MapSummary destinationSummary, float travelSpeedMultiplier = 1f)
 {
     this.destinationSummary    = destinationSummary;
     this.travelSpeedMultiplier = travelSpeedMultiplier;
     Init();
 }