예제 #1
0
        public bool PurchasedTreasureMap(int interval, Heightmap.Biome biome, Vector3 position, Vector3 circleOffset)
        {
            if (!DebugMode)
            {
                if (HasPurchasedTreasureMap(interval, biome))
                {
                    EpicLoot.LogError($"Player has already purchased treasure map! (interval={interval} biome={biome})");
                    return(false);
                }
            }
            else if (IntervalOverride != 0)
            {
                interval = IntervalOverride;
            }

            TreasureMaps.Add(new TreasureMapChestInfo()
            {
                Interval            = interval,
                Biome               = biome,
                State               = TreasureMapState.Purchased,
                Position            = position,
                MinimapCircleOffset = circleOffset,
            });

            NumberOfTreasureMapsOrBountiesStarted++;

            return(true);
        }
예제 #2
0
        private bool IsCorrectBiome(Vector3 p, Heightmap.Biome biome)
        {
            Heightmap heightmap = Heightmap.FindHeightmap(p);

            return(heightmap &&
                   (heightmap.GetBiome(p) & biome) != 0);
        }
예제 #3
0
 // Token: 0x06000A21 RID: 2593 RVA: 0x00049640 File Offset: 0x00047840
 private void UpdateAmbientMusic(Heightmap.Biome biome, EnvSetup currentEnv, float dt)
 {
     this.m_ambientMusicTimer += dt;
     if (this.m_ambientMusicTimer > 2f)
     {
         this.m_ambientMusicTimer = 0f;
         this.m_ambientMusic      = null;
         BiomeEnvSetup biomeEnvSetup = this.GetBiomeEnvSetup(biome);
         if (this.IsDay())
         {
             if (currentEnv.m_musicDay.Length > 0)
             {
                 this.m_ambientMusic = currentEnv.m_musicDay;
                 return;
             }
             if (biomeEnvSetup.m_musicDay.Length > 0)
             {
                 this.m_ambientMusic = biomeEnvSetup.m_musicDay;
                 return;
             }
         }
         else
         {
             if (currentEnv.m_musicNight.Length > 0)
             {
                 this.m_ambientMusic = currentEnv.m_musicNight;
                 return;
             }
             if (biomeEnvSetup.m_musicNight.Length > 0)
             {
                 this.m_ambientMusic = biomeEnvSetup.m_musicNight;
             }
         }
     }
 }
예제 #4
0
            static Color GetMaskColor(float wx, float wy, float height, Heightmap.Biome biome)
            {
                var noForest = new Color(0f, 0f, 0f, 0f);
                var forest   = new Color(1f, 0f, 0f, 0f);

                if (height < ZoneSystem.instance.m_waterLevel)
                {
                    return(noForest);
                }
                if (biome == Heightmap.Biome.Meadows)
                {
                    if (!WorldGenerator.InForest(new Vector3(wx, 0f, wy)))
                    {
                        return(noForest);
                    }
                    return(forest);
                }
                else if (biome == Heightmap.Biome.Plains)
                {
                    if (WorldGenerator.GetForestFactor(new Vector3(wx, 0f, wy)) >= 0.8f)
                    {
                        return(noForest);
                    }
                    return(forest);
                }
                else
                {
                    if (biome == Heightmap.Biome.BlackForest || biome == Heightmap.Biome.Mistlands)
                    {
                        return(forest);
                    }
                    return(noForest);
                }
            }
예제 #5
0
    public static Heightmap.Biome ExtractBiomeMask(this SpawnConfiguration config)
    {
        //Well, since you bastards were packing enums before, lets return the gesture (not really, <3 you devs!)
        Heightmap.Biome biome = Heightmap.Biome.None;

        var biomeArray = config.Biomes?.Value?.SplitByComma() ?? new List <string>(0);

        if (biomeArray.Count == 0)
        {
            //Set all biomes allowed.
            biome = (Heightmap.Biome) 1023;
        }

        foreach (var requiredBiome in biomeArray)
        {
            if (Enum.TryParse(requiredBiome, true, out Heightmap.Biome reqBiome))
            {
                biome |= reqBiome;
            }
            else
            {
                Log.LogWarning($"Unable to parse biome '{requiredBiome}' of spawner config {config.Index}");
            }
        }

        return(biome);
    }
예제 #6
0
        public void Setup(Player player, Heightmap.Biome biome, int treasureMapInterval)
        {
            Reinitialize(biome, treasureMapInterval, false, player.GetPlayerID());

            var container = GetComponent <Container>();
            var zdo       = container?.m_nview.GetZDO();

            if (container != null && zdo != null && zdo.IsValid())
            {
                container.GetInventory().RemoveAll();

                zdo.Set("TreasureMapChest.Interval", Interval);
                zdo.Set("TreasureMapChest.Biome", Biome.ToString());
                zdo.Set("creator", player.GetPlayerID());

                var items = LootRoller.RollLootTable(LootTableName, 1, LootTableName, transform.position);
                items.ForEach(item => container.m_inventory.AddItem(item));

                var biomeConfig = AdventureDataManager.Config.TreasureMap.BiomeInfo.Find(x => x.Biome == biome);
                if (biomeConfig?.ForestTokens > 0)
                {
                    container.m_inventory.AddItem("ForestToken", biomeConfig.ForestTokens, 1, 0, 0, "");
                }

                container.Save();
            }
            else
            {
                EpicLoot.LogError($"Trying to set up TreasureMapChest ({biome} {treasureMapInterval}) but there was no Container component!");
            }
        }
        private static List <Heightmap.Biome> SplitBiome(Heightmap.Biome bitmaskedBiome)
        {
            List <Heightmap.Biome> results = new();

            foreach (var b in Enum.GetValues(typeof(Heightmap.Biome)))
            {
                if (b is Heightmap.Biome biome && biome != Heightmap.Biome.BiomesMax)
                {
                    if (biome == 0 && bitmaskedBiome == 0)
                    {
                        results.Add(biome);
                    }
                    else if (biome != Heightmap.Biome.None)
                    {
                        var filteredBiome = biome & bitmaskedBiome;

                        if (filteredBiome > 0)
                        {
                            results.Add(filteredBiome);
                        }
                    }
                }
            }

            return(results);
        }
예제 #8
0
    public static Color32 GetBiomeColor(Heightmap.Biome biome)
    {
        switch (biome)
        {
        case Heightmap.Biome.Swamp:
            return(new Color32(byte.MaxValue, (byte)0, (byte)0, (byte)0));

        case Heightmap.Biome.Mountain:
            return(new Color32((byte)0, byte.MaxValue, (byte)0, (byte)0));

        case Heightmap.Biome.BlackForest:
            return(new Color32((byte)0, (byte)0, byte.MaxValue, (byte)0));

        case Heightmap.Biome.Plains:
            return(new Color32((byte)0, (byte)0, (byte)0, byte.MaxValue));

        case Heightmap.Biome.AshLands:
            return(new Color32(byte.MaxValue, (byte)0, (byte)0, byte.MaxValue));

        case Heightmap.Biome.DeepNorth:
            return(new Color32((byte)0, byte.MaxValue, (byte)0, (byte)0));

        case Heightmap.Biome.Mistlands:
            return(new Color32((byte)0, (byte)0, byte.MaxValue, byte.MaxValue));

        default:
            return(new Color32((byte)0, (byte)0, (byte)0, (byte)0));
        }
    }
예제 #9
0
    // Token: 0x06000A28 RID: 2600 RVA: 0x00049964 File Offset: 0x00047B64
    private void UpdateEnvironment(long sec, Heightmap.Biome biome)
    {
        string environmentOverride = this.GetEnvironmentOverride();

        if (!string.IsNullOrEmpty(environmentOverride))
        {
            this.m_environmentPeriod = -1L;
            this.m_currentBiome      = this.GetBiome();
            this.QueueEnvironment(environmentOverride);
            return;
        }
        long num = sec / this.m_environmentDuration;

        if (this.m_environmentPeriod != num || this.m_currentBiome != biome)
        {
            this.m_environmentPeriod = num;
            this.m_currentBiome      = biome;
            UnityEngine.Random.State state = UnityEngine.Random.state;
            UnityEngine.Random.InitState((int)num);
            List <EnvEntry> availableEnvironments = this.GetAvailableEnvironments(biome);
            if (availableEnvironments != null && availableEnvironments.Count > 0)
            {
                EnvSetup env = this.SelectWeightedEnvironment(availableEnvironments);
                this.QueueEnvironment(env);
            }
            UnityEngine.Random.state = state;
        }
    }
예제 #10
0
 //util funcs
 static float GetSpeedyPathModifier(Player player)
 {
     if (!player.IsSwiming() && !player.InInterior())
     {
         GroundType groundtype = GetGroundType(player);
         if (_speedModifiers.ContainsKey(groundtype))
         {
             _activeStatusText = _groundTypeStrings[groundtype].Value;
             return(_speedModifiers[groundtype].Value);
         }
         //fallback to biome speed
         Heightmap.Biome playerBiome = player.GetCurrentBiome();
         //Handle new biomes "gracefully"
         if (!_untamedSpeedModifiers.ContainsKey(playerBiome))
         {
             Logger.LogWarning($"New biome {playerBiome.ToString()}. Unsure how to Handle. Falling back to None.");
             playerBiome = Heightmap.Biome.None;
         }
         _activeStatusText = "$biome_" + playerBiome.ToString().ToLower();
         if (_biomeTypeStrings.ContainsKey(playerBiome) && _biomeTypeStrings[playerBiome].Value != "default")
         {
             _activeStatusText = _biomeTypeStrings[playerBiome].Value;
         }
         return(_untamedSpeedModifiers[playerBiome].Value);
     }
     return(1.0f);
 }
예제 #11
0
    public void ReadBiomeData(ref ZPackage package)
    {
        // mountain
        minMountainHeight = package.ReadSingle();

        // ashlands/deepnorth
        minAshlandsDist  = package.ReadSingle();
        minDeepNorthDist = package.ReadSingle();

        // swamp
        swampBiomeScaleX = package.ReadSingle();
        swampBiomeScaleY = package.ReadSingle();
        minSwampNoise    = package.ReadSingle();
        minSwampDist     = package.ReadSingle();
        maxSwampDist     = package.ReadSingle();
        minSwampHeight   = package.ReadSingle();
        maxSwampHeight   = package.ReadSingle();

        // mistlands
        mistlandsBiomeScaleX = package.ReadSingle();
        mistlandsBiomeScaleY = package.ReadSingle();
        minMistlandsNoise    = package.ReadSingle();
        minMistlandsDist     = package.ReadSingle();
        maxMistlandsDist     = package.ReadSingle();

        // plains
        plainsBiomeScaleX = package.ReadSingle();
        plainsBiomeScaleY = package.ReadSingle();
        minPlainsNoise    = package.ReadSingle();
        minPlainsDist     = package.ReadSingle();
        maxPlainsDist     = package.ReadSingle();

        // black forest
        blackForestBiomeScaleX = package.ReadSingle();
        blackForestBiomeScaleY = package.ReadSingle();
        minBlackForestNoise    = package.ReadSingle();
        minBlackForestDist     = package.ReadSingle();
        maxBlackForestDist     = package.ReadSingle();

        // switches
        meadowsSwitch     = (Heightmap.Biome)package.ReadInt();
        blackForestSwitch = (Heightmap.Biome)package.ReadInt();
        swampSwitch       = (Heightmap.Biome)package.ReadInt();
        mountainSwitch    = (Heightmap.Biome)package.ReadInt();
        plainsSwitch      = (Heightmap.Biome)package.ReadInt();
        mistlandsSwitch   = (Heightmap.Biome)package.ReadInt();
        ashlandsSwitch    = (Heightmap.Biome)package.ReadInt();
        deepNorthSwitch   = (Heightmap.Biome)package.ReadInt();

        // river
        riverMultipleMaxDistance = package.ReadSingle();
        riverExtremeMaxDistance  = package.ReadSingle();
        riverMaxHeight           = package.ReadSingle();
        riverWidthMaxLowerRange  = package.ReadSingle();
        riverWidthMaxUpperRange  = package.ReadSingle();
        riverWidthMinLowerRange  = package.ReadSingle();
        riverCurveWidth          = package.ReadSingle();
        riverWavelength          = package.ReadSingle();
    }
예제 #12
0
        /// <summary>
        ///     Return a <see cref="Heightmap.Biome"/> that matches any of the provided Biomes
        /// </summary>
        /// <param name="biomes">Biomes that should match</param>
#pragma warning disable S3265 // Non-flags enums should not be used in bitwise operations
        public static Heightmap.Biome AnyBiomeOf(params Heightmap.Biome[] biomes)
        {
            Heightmap.Biome result = Heightmap.Biome.None;
            foreach (var biome in biomes)
            {
                result |= biome;
            }
            return(result);
        }
예제 #13
0
        private static float GetBiomeOrder(Heightmap.Biome biome)
        {
            if (biome == Heightmap.Biome.BlackForest)
            {
                return(1.5f);
            }

            return((float)biome);
        }
예제 #14
0
 // Token: 0x06000BDB RID: 3035 RVA: 0x00054B9C File Offset: 0x00052D9C
 public void GetSpawners(Heightmap.Biome biome, List <SpawnSystem.SpawnData> spawners)
 {
     foreach (SpawnSystem.SpawnData spawnData in this.m_spawners)
     {
         if ((spawnData.m_biome & biome) != Heightmap.Biome.None || spawnData.m_biome == biome)
         {
             spawners.Add(spawnData);
         }
     }
 }
예제 #15
0
    // Token: 0x06000A2A RID: 2602 RVA: 0x00049A58 File Offset: 0x00047C58
    private List <EnvEntry> GetAvailableEnvironments(Heightmap.Biome biome)
    {
        BiomeEnvSetup biomeEnvSetup = this.GetBiomeEnvSetup(biome);

        if (biomeEnvSetup != null)
        {
            return(biomeEnvSetup.m_environments);
        }
        return(null);
    }
예제 #16
0
 // Token: 0x06000A07 RID: 2567 RVA: 0x00048A44 File Offset: 0x00046C44
 private AudioMan.BiomeAmbients GetBiomeAmbients(Heightmap.Biome biome)
 {
     foreach (AudioMan.BiomeAmbients biomeAmbients in this.m_randomAmbients)
     {
         if ((biomeAmbients.m_biome & biome) != Heightmap.Biome.None)
         {
             return(biomeAmbients);
         }
     }
     return(null);
 }
예제 #17
0
 // Token: 0x06000A29 RID: 2601 RVA: 0x000499FC File Offset: 0x00047BFC
 private BiomeEnvSetup GetBiomeEnvSetup(Heightmap.Biome biome)
 {
     foreach (BiomeEnvSetup biomeEnvSetup in this.m_biomes)
     {
         if (biomeEnvSetup.m_biome == biome)
         {
             return(biomeEnvSetup);
         }
     }
     return(null);
 }
예제 #18
0
 // Token: 0x06000C9F RID: 3231 RVA: 0x0005A280 File Offset: 0x00058480
 private Heightmap.Biome GetPatchBiomes(Vector3 center, float halfSize)
 {
     Heightmap.Biome biome  = Heightmap.FindBiomeClutter(new Vector3(center.x - halfSize, 0f, center.z - halfSize));
     Heightmap.Biome biome2 = Heightmap.FindBiomeClutter(new Vector3(center.x + halfSize, 0f, center.z - halfSize));
     Heightmap.Biome biome3 = Heightmap.FindBiomeClutter(new Vector3(center.x - halfSize, 0f, center.z + halfSize));
     Heightmap.Biome biome4 = Heightmap.FindBiomeClutter(new Vector3(center.x + halfSize, 0f, center.z + halfSize));
     if (biome == Heightmap.Biome.None || biome2 == Heightmap.Biome.None || biome3 == Heightmap.Biome.None || biome4 == Heightmap.Biome.None)
     {
         return(Heightmap.Biome.None);
     }
     return(biome | biome2 | biome3 | biome4);
 }
예제 #19
0
        private static Tuple <float, float> GetTreasureMapSpawnRadiusRange(Heightmap.Biome biome, AdventureSaveData saveData)
        {
            var biomeInfoConfig  = GetBiomeInfoConfig(biome);
            var minRadius        = biomeInfoConfig?.MinRadius ?? 0;
            var maxRadius        = biomeInfoConfig?.MaxRadius ?? 6000;
            var numberOfBounties = AdventureDataManager.CheatNumberOfBounties >= 0 ? AdventureDataManager.CheatNumberOfBounties : saveData.NumberOfTreasureMapsOrBountiesStarted;
            var increments       = numberOfBounties / AdventureDataManager.Config.TreasureMap.IncreaseRadiusCount;
            var min = Mathf.Min(AdventureDataManager.Config.TreasureMap.StartRadiusMin + increments * AdventureDataManager.Config.TreasureMap.RadiusInterval, minRadius);
            var max = Mathf.Min(AdventureDataManager.Config.TreasureMap.StartRadiusMax + increments * AdventureDataManager.Config.TreasureMap.RadiusInterval, maxRadius);

            return(new Tuple <float, float>(min, max));
        }
예제 #20
0
        public bool FoundTreasureChest(int interval, Heightmap.Biome biome)
        {
            var treasureMap = GetTreasureMapChestInfo(interval, biome);

            if (treasureMap != null && treasureMap.State == TreasureMapState.Purchased)
            {
                treasureMap.State = TreasureMapState.Found;
                return(true);
            }

            return(false);
        }
예제 #21
0
        private string GetBiome(Heightmap.Biome biome)
        {
            StringBuilder biomeAreas = new StringBuilder("<ul>");

            foreach (Heightmap.Biome area in ZoneManager.GetMatchingBiomes(biome))
            {
                biomeAreas.Append($"<li>{area}</li>");
            }

            biomeAreas.Append("</ul>");

            return(biomeAreas.ToString());
        }
            private static bool GetBiomeHeightPrefix(WorldGenerator __instance, Heightmap.Biome biome, float wx, float wy, ref float __result, World ___m_world)
            {
                if (!Settings.EnabledForThisWorld || ___m_world.m_menu || Settings.Version <= 6)
                {
                    return(true);
                }

                switch (biome)
                {
                case Heightmap.Biome.Meadows:
                    __result = GetMeadowsHeight(__instance, wx, wy);
                    break;

                case Heightmap.Biome.Mistlands:
                    __result = GetMistlandsHeight(__instance, wx, wy);
                    break;

                case Heightmap.Biome.Mountain:
                    __result = GetMountainHeight(__instance, wx, wy);
                    break;

                case Heightmap.Biome.Ocean:
                    __result = GetOceanHeight(__instance, wx, wy);
                    break;

                case Heightmap.Biome.Plains:
                    __result = GetPlainsHeight(__instance, wx, wy);
                    break;

                case Heightmap.Biome.Swamp:
                    __result = GetSwampHeight(__instance, wx, wy);
                    break;

                case Heightmap.Biome.AshLands:
                    __result = GetAshLandsHeight(__instance, wx, wy);
                    break;

                case Heightmap.Biome.BlackForest:
                    __result = GetBlackForestHeight(__instance, wx, wy);
                    break;

                case Heightmap.Biome.DeepNorth:
                    __result = GetDeepNorthHeight(__instance, wx, wy);
                    break;
                }

                __result *= 200f;

                return(false);
            }
            private static bool GetBiomePrefix(float wx, float wy, ref Heightmap.Biome __result, World ___m_world)
            {
                if (!Settings.EnabledForThisWorld || ___m_world.m_menu || !Settings.HasBiomemap)
                {
                    return(true);
                }
                else
                {
                    var normalized = WorldToNormalized(wx, wy);
                    __result = Settings.GetBiomeOverride(normalized.x, normalized.y);

                    return(false);
                }
            }
예제 #24
0
            /*
             *      Clear
             *      Twilight_Clear
             *      Misty
             *      Darklands_dark
             *      Heath clear
             *      DeepForest Mist
             *      GDKing
             *      Rain
             *      LightRain
             *      ThunderStorm
             *      Eikthyr
             *      GoblinKing
             *      nofogts
             *      SwampRain
             *      Bonemass
             *      Snow
             *      Twilight_Snow
             *      Twilight_SnowStorm
             *      SnowStorm
             *      Moder
             *      Ashrain
             *      Crypt
             *      SunkenCrypt
             */

            public static string GetWorstWeatherForBiome(Heightmap.Biome biome)
            {
                switch (biome)
                {
                case Heightmap.Biome.Mountain:
                case Heightmap.Biome.DeepNorth:
                    return("SnowStorm");

                case Heightmap.Biome.AshLands:
                    return("Ashrain");

                default:
                    return("Thunderstorm");
                }
            }
예제 #25
0
        /// <summary>
        ///     Returns a list of all <see cref="Heightmap.Biome"/> that match <paramref name="biome"/>
        /// </summary>
        /// <param name="biome"></param>
        /// <returns></returns>
        public static List <Heightmap.Biome> GetMatchingBiomes(Heightmap.Biome biome)
        {
            List <Heightmap.Biome> biomes = new List <Heightmap.Biome>();

            foreach (Heightmap.Biome area in Enum.GetValues(typeof(Heightmap.Biome)))
            {
                if (area == Heightmap.Biome.BiomesMax || (biome & area) == 0)
                {
                    continue;
                }

                biomes.Add(area);
            }
            return(biomes);
        }
예제 #26
0
            public static bool Prefix(EnvMan __instance, long sec, Heightmap.Biome biome)
            {
                if (HasEnvChanged(Helheim.HelheimLevel, biome, __instance.GetCurrentEnvironment().m_name))
                {
                    Helheim.Log($"Helheim: {Helheim.HelheimLevel}, Biome: {biome}, Current: {__instance.GetCurrentEnvironment().m_name}, Wet: {__instance.IsWet()}, Freezing: {__instance.IsFreezing()}");
                }

                var allowBaseMethod = true;
                var forceSwitch     = Helheim.HelheimLevel != PreviousHelheimLevel;

                __instance.m_firstEnv = forceSwitch;

                if (Helheim.HelheimLevel > 0)
                {
                    var num = sec / __instance.m_environmentDuration;
                    if (!forceSwitch && __instance.m_currentEnv.m_name.StartsWith("Helheim") && __instance.m_environmentPeriod == num && __instance.m_currentBiome == biome)
                    {
                        return(false);
                    }

                    __instance.m_environmentPeriod = num;
                    __instance.m_currentBiome      = biome;
                    var state = Random.state;
                    Random.InitState((int)num);
                    var availableEnvironments = __instance.GetAvailableEnvironments(biome);
                    if (availableEnvironments != null && availableEnvironments.Count > 0)
                    {
                        var biomeEnv   = __instance.SelectWeightedEnvironment(availableEnvironments);
                        var helheimEnv = GetHelheimEnvironment(__instance, biomeEnv, Helheim.HelheimLevel);
                        __instance.QueueEnvironment(helheimEnv);
                        Helheim.LogWarning($"Changing Environment: {helheimEnv.m_name}");
                    }
                    Random.state    = state;
                    allowBaseMethod = false;
                }
                else
                {
                    if (forceSwitch)
                    {
                        __instance.m_currentBiome = Heightmap.Biome.None;
                    }
                }

                PreviousHelheimLevel = Helheim.HelheimLevel;
                PreviousBiome        = biome;
                PreviousEnvName      = __instance.GetCurrentEnvironment().m_name;
                return(allowBaseMethod);
            }
예제 #27
0
    // Token: 0x06000A1E RID: 2590 RVA: 0x00049338 File Offset: 0x00047538
    private void FixedUpdate()
    {
        this.UpdateTimeSkip(Time.fixedDeltaTime);
        this.m_totalSeconds = ZNet.instance.GetTimeSeconds();
        long   num  = (long)this.m_totalSeconds;
        double num2 = this.m_totalSeconds * 1000.0;
        long   num3 = this.m_dayLengthSec * 1000L;
        float  num4 = Mathf.Clamp01((float)(num2 % (double)num3 / 1000.0) / (float)this.m_dayLengthSec);

        num4 = this.RescaleDayFraction(num4);
        float smoothDayFraction = this.m_smoothDayFraction;
        float t = Mathf.LerpAngle(this.m_smoothDayFraction * 360f, num4 * 360f, 0.01f);

        this.m_smoothDayFraction = Mathf.Repeat(t, 360f) / 360f;
        if (this.m_debugTimeOfDay)
        {
            this.m_smoothDayFraction = this.m_debugTime;
        }
        float num5 = Mathf.Pow(Mathf.Max(1f - Mathf.Clamp01(this.m_smoothDayFraction / 0.25f), Mathf.Clamp01((this.m_smoothDayFraction - 0.75f) / 0.25f)), 0.5f);
        float num6 = Mathf.Pow(Mathf.Clamp01(1f - Mathf.Abs(this.m_smoothDayFraction - 0.5f) / 0.25f), 0.5f);
        float num7 = Mathf.Min(Mathf.Clamp01(1f - (this.m_smoothDayFraction - 0.26f) / -this.m_sunHorizonTransitionL), Mathf.Clamp01(1f - (this.m_smoothDayFraction - 0.26f) / this.m_sunHorizonTransitionH));
        float num8 = Mathf.Min(Mathf.Clamp01(1f - (this.m_smoothDayFraction - 0.74f) / -this.m_sunHorizonTransitionH), Mathf.Clamp01(1f - (this.m_smoothDayFraction - 0.74f) / this.m_sunHorizonTransitionL));
        float num9 = 1f / (num5 + num6 + num7 + num8);

        num5 *= num9;
        num6 *= num9;
        num7 *= num9;
        num8 *= num9;
        Heightmap.Biome biome = this.GetBiome();
        this.UpdateTriggers(smoothDayFraction, this.m_smoothDayFraction, biome, Time.fixedDeltaTime);
        this.UpdateEnvironment(num, biome);
        this.InterpolateEnvironment(Time.fixedDeltaTime);
        this.UpdateWind(num, Time.fixedDeltaTime);
        if (!string.IsNullOrEmpty(this.m_forceEnv))
        {
            EnvSetup env = this.GetEnv(this.m_forceEnv);
            if (env != null)
            {
                this.SetEnv(env, num6, num5, num7, num8, Time.fixedDeltaTime);
                return;
            }
        }
        else
        {
            this.SetEnv(this.m_currentEnv, num6, num5, num7, num8, Time.fixedDeltaTime);
        }
    }
예제 #28
0
        public IEnumerator SpawnTreasureChest(Heightmap.Biome biome, Player player, Action <bool, Vector3> callback)
        {
            player.Message(MessageHud.MessageType.Center, "$mod_epicloot_treasuremap_locatingmsg");
            var saveData = player.GetAdventureSaveData();

            yield return(GetRandomPointInBiome(biome, saveData, (success, spawnPoint, normal) =>
            {
                if (success)
                {
                    CreateTreasureChest(biome, player, spawnPoint, normal, saveData, callback);
                }
                else
                {
                    callback?.Invoke(false, Vector3.zero);
                }
            }));
        }
예제 #29
0
 // Token: 0x06001061 RID: 4193 RVA: 0x00073A00 File Offset: 0x00071C00
 public Heightmap.BiomeArea GetBiomeArea(Vector3 point)
 {
     Heightmap.Biome biome  = this.GetBiome(point);
     Heightmap.Biome biome2 = this.GetBiome(point - new Vector3(-64f, 0f, -64f));
     Heightmap.Biome biome3 = this.GetBiome(point - new Vector3(64f, 0f, -64f));
     Heightmap.Biome biome4 = this.GetBiome(point - new Vector3(64f, 0f, 64f));
     Heightmap.Biome biome5 = this.GetBiome(point - new Vector3(-64f, 0f, 64f));
     Heightmap.Biome biome6 = this.GetBiome(point - new Vector3(-64f, 0f, 0f));
     Heightmap.Biome biome7 = this.GetBiome(point - new Vector3(64f, 0f, 0f));
     Heightmap.Biome biome8 = this.GetBiome(point - new Vector3(0f, 0f, -64f));
     Heightmap.Biome biome9 = this.GetBiome(point - new Vector3(0f, 0f, 64f));
     if (biome == biome2 && biome == biome3 && biome == biome4 && biome == biome5 && biome == biome6 && biome == biome7 && biome == biome8 && biome == biome9)
     {
         return(Heightmap.BiomeArea.Median);
     }
     return(Heightmap.BiomeArea.Edge);
 }
예제 #30
0
    // Token: 0x06000D8A RID: 3466 RVA: 0x000605D4 File Offset: 0x0005E7D4
    public static Color32 GetBiomeColor(Heightmap.Biome biome)
    {
        if (biome <= Heightmap.Biome.Plains)
        {
            switch (biome)
            {
            case Heightmap.Biome.Meadows:
            case (Heightmap.Biome) 3:
                break;

            case Heightmap.Biome.Swamp:
                return(new Color32(byte.MaxValue, 0, 0, 0));

            case Heightmap.Biome.Mountain:
                return(new Color32(0, byte.MaxValue, 0, 0));

            default:
                if (biome == Heightmap.Biome.BlackForest)
                {
                    return(new Color32(0, 0, byte.MaxValue, 0));
                }
                if (biome == Heightmap.Biome.Plains)
                {
                    return(new Color32(0, 0, 0, byte.MaxValue));
                }
                break;
            }
        }
        else
        {
            if (biome == Heightmap.Biome.AshLands)
            {
                return(new Color32(byte.MaxValue, 0, 0, byte.MaxValue));
            }
            if (biome == Heightmap.Biome.DeepNorth)
            {
                return(new Color32(0, byte.MaxValue, 0, 0));
            }
            if (biome == Heightmap.Biome.Mistlands)
            {
                return(new Color32(0, 0, byte.MaxValue, byte.MaxValue));
            }
        }
        return(new Color32(0, 0, 0, 0));
    }