Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of ValheimCreatureCollector v1.0.0
plugins/ValheimCreatureCollector.dll
Decompiled 10 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using Newtonsoft.Json; using Splatform; using TMPro; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.InputSystem.Utilities; using UnityEngine.Rendering; using UnityEngine.TextCore; using UnityEngine.U2D; using UnityEngine.UI; using VCC.Battle; using VCC.Breeding; using VCC.Care; using VCC.Catching; using VCC.Companions; using VCC.Core; using VCC.Data; using VCC.Dev; using VCC.Net; using VCC.Patches; using VCC.UI; using VCC.Wild; using Valheim.SettingsGui; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("assembly_guiutils")] [assembly: IgnoresAccessChecksTo("assembly_utils")] [assembly: IgnoresAccessChecksTo("assembly_valheim")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("ValheimCreatureCollector")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+a7efeed25a36e8e470eb1dd61674d67b98f8386a")] [assembly: AssemblyProduct("ValheimCreatureCollector")] [assembly: AssemblyTitle("ValheimCreatureCollector")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace VCC { [BepInPlugin("com.noxious.valheimcreaturecollector", "ValheimCreatureCollector", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [SynchronizationMode(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string PluginGuid = "com.noxious.valheimcreaturecollector"; public const string PluginName = "ValheimCreatureCollector"; public const string PluginVersion = "1.0.0"; private Harmony _harmony; private static readonly (string name, Action tick)[] Ticks = new(string, Action)[18] { ("Deferred work", Defer.Run), ("Companions", CompanionManager.Tick), ("Battles", BattleManager.Tick), ("Roster", Roster.Tick), ("Stats", delegate { PlayerStats.Tick(Time.deltaTime); }), ("Mercy Charm", MercyCharm.Tick), ("Shiny Charm", ShinyCharm.Tick), ("Passives", Passives.Tick), ("Growing up", Growth.Tick), ("Hugin", HuginTips.Tick), ("Shiny pins", ShinyPins.Tick), ("Tower Defense", Compat.Tick), ("Champions", Champions.Tick), ("Trading", Trading.Tick), ("Options", OptionsTab.Tick), ("Typing", TextEntry.Tick), ("Keys", Keys), ("Controller", PadNav.Tick) }; public static Plugin Instance { get; private set; } private void Awake() { //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Expected O, but got Unknown //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) Instance = this; VccLog.Init(((BaseUnityPlugin)this).Logger); VccConfig.Bind(((BaseUnityPlugin)this).Config); ((BaseUnityPlugin)this).Config.SaveOnConfigSet = false; ((BaseUnityPlugin)this).Config.Save(); ((BaseUnityPlugin)this).Config.SettingChanged += delegate { OptionsTab.MarkChanged(); }; VccConfig.ShowAllHuds.SettingChanged += delegate { Patch_EnemyHudRange.Apply(); }; VccConfig.HudRange.SettingChanged += delegate { Patch_EnemyHudRange.Apply(); }; VccConfig.ChampionPlacement.SettingChanged += delegate { ChampionPlaces.Replace(); }; VccConfig.ChampionsOn.SettingChanged += delegate { ChampionPlaces.Replace(); }; _harmony = new Harmony("com.noxious.valheimcreaturecollector"); _harmony.PatchAll(typeof(Plugin).Assembly); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new VccCommand()); CatchSkill.Register(); PrefabManager.OnVanillaPrefabsAvailable += OnVanillaPrefabsAvailable; if (VccConfig.EnableBridge.Value) { ((Component)this).gameObject.AddComponent<DevBridge>(); } VccLog.Info(string.Format("{0} {1} awake. Collector: {2}, summon: {3}, command: {4}", "ValheimCreatureCollector", "1.0.0", VccConfig.MenuKey.Value, VccConfig.SummonKey.Value, VccConfig.CommandKey.Value)); } private static void OnVanillaPrefabsAvailable() { PrefabManager.OnVanillaPrefabsAvailable -= OnVanillaPrefabsAvailable; Orbs.Register(); CareItems.Register(); Essence.Register(); MercyCharm.Register(); ShinyCharm.Register(); StunArrow.Register(); SeersLens.Register(); Mounts.Register(); DenPiece.Register(); } private void Update() { (string, Action)[] ticks = Ticks; for (int i = 0; i < ticks.Length; i++) { var (what, action) = ticks[i]; Safe.Run(what, action); } } private static void Keys() { Keyboard kb = Keyboard.current; Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } if (Keybinds.Active) { Keybinds.Update(); if (!Keybinds.Active) { OptionsTab.MarkChanged(); } } else { if (Console.IsVisible() || TextInput.IsVisible() || Minimap.InTextInput() || Hud.Typing || Menu.IsVisible() || Compat.TowerDefenseMode || ((Object)(object)Chat.instance != (Object)null && Chat.instance.HasFocus())) { return; } bool flag = Hit(VccConfig.MenuKey) || PadBinds.Pressed(VccConfig.PadMenu); bool flag2 = Hit(VccConfig.CompendiumKey) || PadBinds.Pressed(VccConfig.PadCompendium); bool flag3 = Hit(VccConfig.SummonKey) || PadBinds.Pressed(VccConfig.PadSummon); if (BattleManager.Active) { if (flag || flag3 || flag2) { ((Character)localPlayer).Message((MessageType)2, "Not during a battle.", 0, (Sprite)null, false); } return; } if (flag) { CollectorPanel.Toggle(); } else if (flag2) { if (CollectorPanel.Open && CollectorPanel.Tab == 1) { CollectorPanel.Close(); } else { CollectorPanel.Show(1); } } if (!Hud.Modal && !InventoryGui.IsVisible() && !StoreGui.IsVisible()) { if (flag3) { CompanionManager.Toggle(); } if (Hit(VccConfig.CommandKey) || PadBinds.Pressed(VccConfig.PadCommand)) { CompanionManager.CycleMode(); } if (Hit(VccConfig.AbilityKey) || PadBinds.Pressed(VccConfig.PadAbility)) { Abilities.UseNext(); } if (Hit(VccConfig.BattleKey) || PadBinds.Pressed(VccConfig.PadBattle)) { BattleManager.ChallengeHovered(); } if (Hit(VccConfig.NextMemberKey) || PadBinds.Pressed(VccConfig.PadNextMember)) { CompanionManager.CycleMember(1); } if (Hit(VccConfig.PrevMemberKey)) { CompanionManager.CycleMember(-1); } } } bool Hit(ConfigEntry<Key> k) { if (kb != null) { return Keybinds.Pressed(kb, k); } return false; } } private void OnGUI() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) try { Hud.Draw(); } catch (Exception e) { Safe.Report("Drawing the mod's windows", e); GUI.matrix = Matrix4x4.identity; GUI.color = Color.white; GUI.enabled = true; } } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } } public enum ChampionPlace { BossAltars, StartTemple } public static class VccConfig { public static ConfigEntry<Key> MenuKey; public static ConfigEntry<Key> SummonKey; public static ConfigEntry<Key> CommandKey; public static ConfigEntry<Key> CompendiumKey; public static ConfigEntry<Key> BattleKey; public static ConfigEntry<Key> NextMemberKey; public static ConfigEntry<Key> PrevMemberKey; public static ConfigEntry<bool> PadModifier; public static ConfigEntry<PadButton> PadMenu; public static ConfigEntry<PadButton> PadSummon; public static ConfigEntry<PadButton> PadCommand; public static ConfigEntry<PadButton> PadBattle; public static ConfigEntry<PadButton> PadNextMember; public static ConfigEntry<PadButton> PadCompendium; public static ConfigEntry<PadButton> PadAbility; public static ConfigEntry<Key> AbilityKey; public static ConfigEntry<bool> AbilitiesOn; public static ConfigEntry<bool> PassivesOn; public static ConfigEntry<float> AbilityCooldownScale; public static ConfigEntry<float> AbilityPowerScale; public static ConfigEntry<int> ShinyOdds; public static ConfigEntry<int> MaxActiveCompanions; public static ConfigEntry<int> MaxCompanionLevel; public static ConfigEntry<int> RosterCapacity; public static ConfigEntry<float> FaintCooldownSeconds; public static ConfigEntry<float> RosterHealSeconds; public static ConfigEntry<float> CareCooldownSeconds; public static ConfigEntry<float> CatchChanceMultiplier; public static ConfigEntry<float> BossCatchMultiplier; public static ConfigEntry<float> UnawareCatchBonus; public static ConfigEntry<float> CatchXp; public static ConfigEntry<float> StunCatchBonus; public static ConfigEntry<float> CatchSkillCatchBonus; public static ConfigEntry<float> CatchSkillThrowBonus; public static ConfigEntry<bool> BedHealsCompanions; public static ConfigEntry<bool> CatchLoot; public static ConfigEntry<bool> AllowBossCatch; public static ConfigEntry<bool> AllowBossCompanions; public static ConfigEntry<bool> CompanionsHuntAnimals; public static ConfigEntry<float> WildStatsPerLevel; public static ConfigEntry<float> CompanionStatsPerLevel; public static ConfigEntry<float> ShinyStatBonus; public static ConfigEntry<float> ShareXp; public static ConfigEntry<float> LeashDistance; public static ConfigEntry<float> StatVariation; public static ConfigEntry<float> BloodlineGrowth; public static ConfigEntry<float> ArmorPerLevel; public static ConfigEntry<float> SpeedPerLevel; public static ConfigEntry<float> SpeedMaxBonus; public static ConfigEntry<float> BloodlineInheritChance; public static ConfigEntry<float> SpawnRateMultiplier; public static ConfigEntry<float> StarChanceMultiplier; public static ConfigEntry<float> XpMultiplier; public static ConfigEntry<float> ShinyComboBonus; public static ConfigEntry<float> BiomeCompleteShinyBonus; public static ConfigEntry<float> ShinyCharmMultiplier; public static ConfigEntry<float> ShinyCharmRange; public static ConfigEntry<int> ShinyComboLength; public static ConfigEntry<bool> InfiniteOrbs; public static ConfigEntry<bool> InfiniteCareItems; public static ConfigEntry<bool> MercyHits; public static ConfigEntry<float> BreedingMinutes; public static ConfigEntry<float> BreedShinyMultiplier; public static ConfigEntry<float> BreedStarInheritChance; public static ConfigEntry<bool> AllowBossBreeding; public static ConfigEntry<bool> HatchYoung; public static ConfigEntry<bool> AllowTrading; public static ConfigEntry<float> TradeRange; public static ConfigEntry<bool> ChampionsOn; public static ConfigEntry<bool> BossCatchNeedsRune; public static ConfigEntry<bool> ChampionRematches; public static ConfigEntry<ChampionPlace> ChampionPlacement; public static ConfigEntry<int> ChampionLevelOffset; public static ConfigEntry<float> ChampionRematchMinutes; public static ConfigEntry<float> ChampionXp; public static ConfigEntry<float> ChampionPriceMultiplier; public static ConfigEntry<int> GrowUpLevels; public static ConfigEntry<bool> AllowBattles; public static ConfigEntry<bool> BossBattles; public static ConfigEntry<bool> AutoBattleRaids; public static ConfigEntry<float> BattleDamageScale; public static ConfigEntry<float> BattleMinHit; public static ConfigEntry<float> BattleMaxHit; public static ConfigEntry<float> BattleTurnSeconds; public static ConfigEntry<float> BattleRunChance; public static ConfigEntry<float> BattleTeamXpShare; public static ConfigEntry<int> BattleMaxTurns; public static ConfigEntry<int> BattleMoveEvery; public static ConfigEntry<float> BattleIdleMinutes; public static ConfigEntry<bool> AutoBattles; public static ConfigEntry<bool> FullBattleScreen; public static ConfigEntry<bool> BattleCamera; public static ConfigEntry<bool> BattleHints; public static ConfigEntry<float> BattleSpeed; public static ConfigEntry<bool> ShowAllHuds; public static ConfigEntry<bool> ShowCatchChance; public static ConfigEntry<bool> ShowCaughtIcon; public static ConfigEntry<bool> ShinyAlert; public static ConfigEntry<bool> ShinyPins; public static ConfigEntry<bool> ShowCompanionHud; public static ConfigEntry<bool> KeyHints; public static ConfigEntry<bool> HuginTips; public static ConfigEntry<bool> ShowAdvancedOptions; public static ConfigEntry<float> HudRange; public static ConfigEntry<float> UiScale; public static ConfigEntry<bool> EnableBridge; public static ConfigEntry<bool> DebugLogging; public static void Bind(ConfigFile cfg) { //IL_0d69: Unknown result type (might be due to invalid IL or missing references) //IL_0d73: Expected O, but got Unknown //IL_0e5e: Unknown result type (might be due to invalid IL or missing references) //IL_0e68: Expected O, but got Unknown //IL_0f1d: Unknown result type (might be due to invalid IL or missing references) //IL_0f27: Expected O, but got Unknown MenuKey = cfg.Bind<Key>("Keys", "MenuKey", (Key)24, "Opens the Collector: your Party and the Compendium."); SummonKey = cfg.Bind<Key>("Keys", "SummonKey", (Key)22, "Summons your chosen companion, or recalls the one that's out."); CommandKey = cfg.Bind<Key>("Keys", "CommandKey", (Key)25, "Gives your companion its next command: Defend, Attack, Stay, Do nothing (press again for the next)."); CompendiumKey = cfg.Bind<Key>("Keys", "CompendiumKey", (Key)26, "Opens the Collector straight on the Compendium (None = no key)."); BattleKey = cfg.Bind<Key>("Keys", "BattleKey", (Key)28, "With a companion out, point at a wild creature and press this to challenge it to a turn-based battle (None = no key)."); NextMemberKey = cfg.Bind<Key>("Keys", "NextMemberKey", (Key)35, "Swaps the companion that's out for the next one on your battle team (or in your Party), or picks the next one to summon."); PrevMemberKey = cfg.Bind<Key>("Keys", "PrevMemberKey", (Key)39, "The same, back to the previous one."); PadModifier = cfg.Bind<bool>("Controller", "HoldLT", true, "The mod's controller buttons work while you hold LT (Valheim's alt button), so they don't get in the way of the game's own."); PadMenu = cfg.Bind<PadButton>("Controller", "Collector", PadButton.Y, "Opens the Collector."); PadSummon = cfg.Bind<PadButton>("Controller", "Summon", PadButton.X, "Summons your chosen companion, or recalls the one that's out."); PadCommand = cfg.Bind<PadButton>("Controller", "Command", PadButton.RB, "Gives your companion its next command."); AbilityKey = cfg.Bind<Key>("Keys", "AbilityKey", (Key)40, "Your companion uses its ability (with several out, each press goes to the next one that's ready)."); PadAbility = cfg.Bind<PadButton>("Controller", "Ability", PadButton.LB, "Your companion uses its ability."); PadBattle = cfg.Bind<PadButton>("Controller", "Challenge", PadButton.DPadRight, "Challenges the wild creature you're pointing at to a turn-based battle."); AbilitiesOn = Admin(cfg, "Abilities", "AbilitiesOn", value: true, "Companions have an ability you set off with the ability key."); PassivesOn = Admin(cfg, "Abilities", "PassivesOn", value: true, "Each companion that's out gives you its kind's perk (carry weight, swim speed, resistances...)."); AbilityCooldownScale = Admin(cfg, "Abilities", "AbilityCooldownScale", 1f, "Multiplies how long abilities rest between uses (0.5 = twice as often).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 5f)); AbilityPowerScale = Admin(cfg, "Abilities", "AbilityPowerScale", 1f, "Multiplies how strong passives and abilities are, on top of a companion's rarity.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 5f)); PadNextMember = cfg.Bind<PadButton>("Controller", "NextMember", PadButton.RightStick, "Swaps the companion that's out for the next one (or picks the next one to summon)."); PadCompendium = cfg.Bind<PadButton>("Controller", "Compendium", PadButton.None, "Opens the Collector straight on the Compendium (in the Collector, RB moves between its tabs)."); ShinyOdds = Admin(cfg, "Gameplay", "ShinyOdds", 250, "One wild creature in this many is a shiny (a rare colour swap, at any star level).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100000)); MaxActiveCompanions = Admin(cfg, "Gameplay", "MaxActiveCompanions", 1, "How many companions can be out at once.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 5)); MaxCompanionLevel = Admin(cfg, "Gameplay", "MaxCompanionLevel", 100, "The highest level a companion can reach.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 500)); RosterCapacity = Admin(cfg, "Gameplay", "RosterCapacity", 200, "How many caught creatures a character can keep. Catches past this still count in the Compendium but you're asked to release some.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 2000)); FaintCooldownSeconds = Admin(cfg, "Gameplay", "FaintCooldownSeconds", 300f, "How long a fainted creature rests before it can come out again (in seconds). A Revival Draught wakes it at once.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 7200f)); RosterHealSeconds = Admin(cfg, "Gameplay", "RosterHealSeconds", 600f, "How long a creature resting in your Party takes to heal from nothing to full (in seconds).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 36000f)); CareCooldownSeconds = Admin(cfg, "Gameplay", "CareCooldownSeconds", 8f, "How long to wait between Mending Salves on the same creature (in seconds).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 120f)); CatchChanceMultiplier = Admin(cfg, "Gameplay", "CatchChanceMultiplier", 1f, "Multiplies every catch chance (capped at 95%).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 20f)); BossCatchMultiplier = Admin(cfg, "Gameplay", "BossCatchMultiplier", 1f, "Multiplies the catch chance of bosses only.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 50f)); UnawareCatchBonus = Admin(cfg, "Gameplay", "UnawareCatchBonus", 1.3f, "Catch chance bonus for a creature that hasn't spotted you yet (no red eye over it, as for a sneak attack). A sleeping one gets x1.5 instead. 1 = no bonus.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 3f)); CatchLoot = Admin(cfg, "Gameplay", "CatchLoot", value: true, "A catch gives you the creature's loot, as if you'd beaten it (bosses always drop theirs where they stood)."); StunCatchBonus = Admin(cfg, "Gameplay", "StunCatchBonus", 0.1f, "Catch chance bonus while a creature is stunned or slowed by a Stun Arrow. 0.1 = +10%, 0 = none.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f)); CatchSkillCatchBonus = Admin(cfg, "Gameplay", "CatchSkillCatchBonus", 0.1f, "Catch chance bonus at Catching skill 100 (less on the way up). 0.1 = +10%, 0 = none.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f)); CatchSkillThrowBonus = Admin(cfg, "Gameplay", "CatchSkillThrowBonus", 0.4f, "How much faster (and so farther) orbs fly at Catching skill 100. 0.4 = 40% faster, 0 = no change.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f)); BedHealsCompanions = Admin(cfg, "Gameplay", "BedHealsCompanions", value: true, "Sleeping through the night heals your whole Party to full and wakes the ones that fainted."); CatchXp = Admin(cfg, "Gameplay", "CatchXp", 1f, "Catching a creature gives your companions out XP, as if they'd beaten it. 100% = the same XP as beating it, 50% = half, 0 = none.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 5f)); AllowBossCatch = Admin(cfg, "Gameplay", "AllowBossCatch", value: true, "Bosses can be caught (at legendary odds). Catching one counts as defeating it."); AllowBossCompanions = Admin(cfg, "Gameplay", "AllowBossCompanions", value: true, "Caught bosses can be summoned as companions."); CompanionsHuntAnimals = Admin(cfg, "Gameplay", "CompanionsHuntAnimals", value: false, "Companions attack peaceful animals (deer, hares, boars that leave you alone) on their own, not only when you do."); GrowUpLevels = Admin(cfg, "Gameplay", "GrowUpLevels", 10, "A young companion (a piglet, a cub, a calf) grows up into its adult after this many levels. 0 = they stay young.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 50)); WildStatsPerLevel = Admin(cfg, "Gameplay", "WildStatsPerLevel", 0.03f, "Wild creatures' extra health and damage for each level above the bottom of their biome's range (0.03 = +3%). 0 makes levels display-only.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f)); StatVariation = Admin(cfg, "Stats", "StatVariation", 0.1f, "How much two creatures of the same kind and level can differ: each stat is rolled once, up to this much above or below (0.1 = ±10%).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 0.5f)); BloodlineGrowth = Admin(cfg, "Stats", "BloodlineGrowth", 0.2f, "A bloodline's favoured stat grows this much faster per level, its weak stat this much slower (0.2 = ±20%).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 0.9f)); ArmorPerLevel = Admin(cfg, "Stats", "ArmorPerLevel", 0.25f, "Armor a creature gains for each level above the bottom of its biome's range (before its bloodline).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 5f)); SpeedPerLevel = Admin(cfg, "Stats", "SpeedPerLevel", 0.005f, "Speed a creature gains for each level above the bottom of its biome's range (0.005 = +0.5%), up to the most below.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 0.05f)); SpeedMaxBonus = Admin(cfg, "Stats", "SpeedMaxBonus", 0.3f, "The most speed levels can add (0.3 = +30%), before its own variation.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f)); BloodlineInheritChance = Admin(cfg, "Stats", "BloodlineInheritChance", 0.9f, "Chance a bred young takes one of its parents' bloodlines (otherwise it's a new one). Its stats are always near its parents' average.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f)); CompanionStatsPerLevel = Admin(cfg, "Gameplay", "CompanionStatsPerLevel", 0.05f, "Companions' extra health and damage for each level above the bottom of their biome's range (0.05 = +5%).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f)); ShinyStatBonus = Admin(cfg, "Gameplay", "ShinyStatBonus", 0f, "Extra health and damage for shinies (0.1 = +10%).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 5f)); ShareXp = Admin(cfg, "Gameplay", "ShareXp", 0.5f, "The share of the XP from your own kills that your companion out gets.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f)); LeashDistance = Admin(cfg, "Gameplay", "LeashDistance", 40f, "A companion further than this from you (in metres) is brought back to your side.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(15f, 200f)); SpawnRateMultiplier = Admin(cfg, "World", "SpawnRateMultiplier", 1f, "How often wild creatures spawn, and how many can be around (2 = twice as many, more to catch). Raids are left alone.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f)); StarChanceMultiplier = Admin(cfg, "World", "StarChanceMultiplier", 1f, "Multiplies the chance a wild creature spawns with stars (1- and 2-star creatures are the Uncommon and Rare catches).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f)); ShinyComboLength = Admin(cfg, "World", "ShinyComboLength", 5, "Catch the same kind this many times in a row and its shinies get likelier, until you catch another kind. 0 = off.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100)); ShinyComboBonus = Admin(cfg, "World", "ShinyComboBonus", 0.1f, "How much likelier a kind's shinies are during its catch combo (0.1 = +10%).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f)); BiomeCompleteShinyBonus = Admin(cfg, "World", "BiomeCompleteShinyBonus", 0.5f, "Once you've caught every creature of a biome (bosses aside), shinies there are this much likelier, for good (0.5 = +50%).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f)); ShinyCharmMultiplier = Admin(cfg, "World", "ShinyCharmMultiplier", 3f, "Carrying the Shiny Charm (earned by completing the Compendium) makes shinies spawning near you this many times likelier.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10f)); ShinyCharmRange = Admin(cfg, "World", "ShinyCharmRange", 100f, "How near the Shiny Charm's carrier a creature must spawn for the charm to count (in metres).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 500f)); XpMultiplier = Admin(cfg, "Gameplay", "XpMultiplier", 1f, "Multiplies all the XP companions earn.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 20f)); InfiniteOrbs = Admin(cfg, "Cheats", "InfiniteOrbs", value: false, "Capture orbs you have are never used up when thrown (craft one of each to have it for good)."); InfiniteCareItems = Admin(cfg, "Cheats", "InfiniteCareItems", value: false, "Mending Salves and Revival Draughts you have are never used up (craft one of each to have it for good)."); MercyHits = Admin(cfg, "Cheats", "MercyHits", value: false, "Everyone's hits leave a catchable wild creature at 1 health instead of killing it, as if they wore a Mercy Charm."); BreedingMinutes = Admin(cfg, "Breeding", "BreedingMinutes", 20f, "How long two creatures take in a Breeding Den to make an egg, in game time (in minutes).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 600f)); BreedShinyMultiplier = Admin(cfg, "Breeding", "BreedShinyMultiplier", 8f, "Each shiny parent makes a shiny young this many times likelier than in the wild.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 100f)); BreedStarInheritChance = Admin(cfg, "Breeding", "BreedStarInheritChance", 0.5f, "The chance each parent passes on its stars (the young gets the most it's given).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f)); AllowBossBreeding = Admin(cfg, "Breeding", "AllowBossBreeding", value: false, "Caught bosses can breed (two of the same boss)."); HatchYoung = Admin(cfg, "Breeding", "HatchYoung", value: true, "A pair whose kind has a young (boars, wolves, lox, hens...) hatches the young, which grows up with levels. Off: the young hatches as its parents' kind."); AllowTrading = Admin(cfg, "Trading", "AllowTrading", value: true, "Players can trade caught creatures with each other (from the Party tab)."); TradeRange = Admin(cfg, "Trading", "TradeRange", 10f, "How near another player must be to trade with them (in metres).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(3f, 50f)); ChampionsOn = Admin(cfg, "Champions", "ChampionsOn", value: true, "A champion for each biome stands in the world: talk to them for a battle against their team, and earn their biome's Rune."); ChampionPlacement = Admin(cfg, "Champions", "ChampionPlacement", ChampionPlace.BossAltars, "Where the champions stand: beside each biome's boss altar, or all together by the starting stones."); BossCatchNeedsRune = Admin(cfg, "Champions", "BossCatchNeedsRune", value: true, "A biome's boss can only be caught by a player who has that biome's Rune (beat its champion first)."); ChampionRematches = Admin(cfg, "Champions", "ChampionRematches", value: true, "A champion you've beaten can be battled again (their team a little stronger each time) for spirit essence."); ChampionRematchMinutes = Admin(cfg, "Champions", "ChampionRematchMinutes", 60f, "How long a champion waits before a rematch (in minutes).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1440f)); ChampionLevelOffset = Admin(cfg, "Champions", "ChampionLevelOffset", 0, "Levels added to (or taken from) every champion's team.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-20, 20)); ChampionXp = Admin(cfg, "Champions", "ChampionXp", 1.5f, "XP for beating a champion's creature, compared with beating a wild one (1.5 = half as much again).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f)); ChampionPriceMultiplier = Admin(cfg, "Champions", "ChampionPriceMultiplier", 1f, "Multiplies the spirit essence the champions ask for their wares.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f)); AllowBattles = Admin(cfg, "Battles", "AllowBattles", value: true, "Turn-based battles can be started (with the battle key, or Auto battles)."); BossBattles = Admin(cfg, "Battles", "BossBattles", value: false, "Bosses can be battled turn by turn (their summons and area attacks don't fit turns well)."); AutoBattleRaids = Admin(cfg, "Battles", "AutoBattleRaids", value: false, "With Auto battles on, raid creatures start battles too (off: raids are fought in real time, so your base is defended)."); BattleDamageScale = Admin(cfg, "Battles", "BattleDamageScale", 1f, "How hard battle hits land: higher means shorter battles.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 5f)); BattleMinHit = Admin(cfg, "Battles", "BattleMinHit", 0.06f, "The least a damaging battle hit takes, as a share of the target's health (before its resistances).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 0.5f)); BattleMaxHit = Admin(cfg, "Battles", "BattleMaxHit", 0.4f, "The most one battle hit can take, as a share of the target's health (before its resistances): no one-shots.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.05f, 1f)); BattleTurnSeconds = Admin(cfg, "Battles", "BattleTurnSeconds", 2f, "How many seconds of burning, poison and other lingering effects pass each turn.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f)); BattleMaxTurns = Admin(cfg, "Battles", "TurnLimit", 0, "A battle still going after this many turns ends in a draw. 0 = no limit (it goes on until someone wins, is caught or gets away).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 500)); BattleIdleMinutes = Admin(cfg, "Battles", "IdleMinutes", 0f, "A battle where you don't choose anything for this many minutes ends in a draw. 0 = never (it waits for you).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 60f)); BattleRunChance = Admin(cfg, "Battles", "BattleRunChance", 0.5f, "The chance to get away from an opponent as fast as yours (being faster helps, and each try adds 15%).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f)); BattleTeamXpShare = Admin(cfg, "Battles", "BattleTeamXpShare", 0.5f, "The share of a win's XP that each other team member who fought (and didn't faint) gets.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f)); BattleMoveEvery = Admin(cfg, "Battles", "BattleMoveEvery", 4, "Levels between the moves a creature learns (it starts with two).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 30)); ShowAllHuds = cfg.Bind<bool>("Visuals", "ShowAllHuds", true, "Show the name, level and health bar of every creature near you, not only the ones you've looked at."); HudRange = cfg.Bind<float>("Visuals", "HudRange", 20f, new ConfigDescription("How near a creature must be for its name and level to show, with Show every nearby creature on (in metres; vanilla shows 10).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 60f), Array.Empty<object>())); ShowCatchChance = cfg.Bind<bool>("Visuals", "ShowCatchChance", true, "While you hold a capture orb, show each creature's catch chance next to its name."); ShowCaughtIcon = cfg.Bind<bool>("Visuals", "ShowCaughtIcon", true, "When you point at a creature, an orb icon by its name: lit with how many of its kind you've caught, or dark if you've never caught one."); ShinyAlert = cfg.Bind<bool>("Visuals", "ShinyAlert", true, "A message and a sound when a shiny comes near."); ShinyPins = cfg.Bind<bool>("Visuals", "ShinyPins", true, "A shiny that sets off the alert is marked on your map (and the minimap) until it's caught or gone."); ShowCompanionHud = cfg.Bind<bool>("Visuals", "ShowCompanionHud", true, "Show your companion's health, level and XP on screen while it is out."); KeyHints = cfg.Bind<bool>("Visuals", "KeyHints", true, "Under the companion panel, the keys (or controller buttons) for what you can do right now."); HuginTips = cfg.Bind<bool>("Visuals", "HuginTips", true, "Hugin, the raven, gives a short tip the first time you meet each part of the mod (the game's own Tutorials setting turns them off too)."); UiScale = cfg.Bind<float>("Visuals", "UiScale", 1f, new ConfigDescription("How big the mod's windows and panels are (never bigger than fits your screen).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.75f, 2f), Array.Empty<object>())); ShowAdvancedOptions = cfg.Bind<bool>("Visuals", "ShowAdvancedOptions", false, "The Options tab shows every setting, the fine-tuning ones too. A search always looks through them all."); AutoBattles = cfg.Bind<bool>("Battles", "AutoBattles", false, "Every fight your companion would get into (something coming at you or it, or it going for something) becomes a turn-based battle."); FullBattleScreen = cfg.Bind<bool>("Battles", "FullBattleScreen", false, "Battles fill the screen: the battle camera on the fight, framed top and bottom, with the game's HUD out of the way until it's over."); BattleCamera = cfg.Bind<bool>("Battles", "BattleCamera", true, "In the world, the camera frames the two fighters during a battle."); BattleHints = cfg.Bind<bool>("Battles", "BattleHints", true, "Show how well each move would work on the opponent (super effective, resisted...)."); BattleSpeed = cfg.Bind<float>("Battles", "BattleSpeed", 1f, new ConfigDescription("How fast battles play (2 = twice as fast).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 3f), Array.Empty<object>())); EnableBridge = cfg.Bind<bool>("Dev", "EnableBridge", false, "Poll BepInEx/config/ValheimCreatureCollector/commands.txt and run each line as a console command. For development."); DebugLogging = cfg.Bind<bool>("Dev", "DebugLogging", false, "Write extra diagnostics (catch rolls, levels, companions) to the BepInEx log."); } private static ConfigEntry<T> Admin<T>(ConfigFile cfg, string section, string key, T value, string desc, AcceptableValueBase range = null) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown return cfg.Bind<T>(section, key, value, new ConfigDescription(desc + " (Server-synced.)", range, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); } } } namespace VCC.Wild { public static class Bloodlines { private static List<BloodlineDef> _all; private static Dictionary<string, BloodlineDef> _byId; private static readonly BloodlineDef Builtin = new BloodlineDef { id = "common", name = "Commonblood", weight = 1f }; public static List<BloodlineDef> All { get { if (_all != null) { return _all; } _all = (Tables.Stats.bloodlines ?? new List<BloodlineDef>()).Where((BloodlineDef b) => b != null && !string.IsNullOrEmpty(b.id)).ToList(); if (_all.Count == 0) { _all.Add(Builtin); } _byId = new Dictionary<string, BloodlineDef>(); foreach (BloodlineDef item in _all) { _byId[item.id] = item; } return _all; } } public static int MaxVar => Mathf.Clamp(Mathf.RoundToInt(VccConfig.StatVariation.Value * 100f), 0, 50); public static void Clear() { _all = null; _byId = null; } public static BloodlineDef Get(string id) { if (string.IsNullOrEmpty(id)) { return null; } _ = All; if (!_byId.TryGetValue(id, out var value)) { return null; } return value; } public static Stat? Up(BloodlineDef b) { if (b == null) { return null; } return BloodlineMath.Parse(b.up); } public static Stat? Down(BloodlineDef b) { if (b == null) { return null; } return BloodlineMath.Parse(b.down); } public static float Growth(BloodlineDef b, Stat s) { return BloodlineMath.Growth(s, Up(b), Down(b), VccConfig.BloodlineGrowth.Value); } public static BloodlineDef Roll(Func<double> rng) { List<BloodlineDef> all = All; float num = all.Sum((BloodlineDef b) => Mathf.Max(0f, b.weight)); if (num <= 0f) { return all[0]; } double num2 = rng() * (double)num; foreach (BloodlineDef item in all) { num2 -= (double)Mathf.Max(0f, item.weight); if (num2 < 0.0) { return item; } } return all[all.Count - 1]; } private static double UnityRandom() { return (double)Random.value * 0.999999; } public static void RollInto(ZDO zdo) { if (zdo != null) { zdo.Set(ZdoKeys.Bloodline, Roll(UnityRandom).id); zdo.Set(ZdoKeys.Variation, BloodlineMath.Pack(BloodlineMath.Roll(UnityRandom, MaxVar)), false); } } public static bool Rolled(ZDO zdo) { if (zdo != null && !string.IsNullOrEmpty(zdo.GetString(ZdoKeys.Bloodline, ""))) { return zdo.GetInt(ZdoKeys.Variation, 0) != 0; } return false; } public static bool Ensure(RosterEntry e) { if (e == null) { return false; } bool result = false; if (Get(e.bloodline) == null) { e.bloodline = Roll(BloodlineMath.SeededFrom(e.id + "/bl")).id; result = true; } if (e.vars == 0) { e.vars = BloodlineMath.Pack(BloodlineMath.Roll(BloodlineMath.SeededFrom(e.id + "/var"), MaxVar)); result = true; } return result; } public static void Inherit(RosterEntry young, RosterEntry a, RosterEntry b) { if (young != null) { Ensure(a); Ensure(b); List<BloodlineDef> list = All; int a2 = Mathf.Max(0, list.FindIndex((BloodlineDef x) => x.id == a?.bloodline)); int b2 = Mathf.Max(0, list.FindIndex((BloodlineDef x) => x.id == b?.bloodline)); int num = BloodlineMath.InheritBloodline(a2, b2, VccConfig.BloodlineInheritChance.Value, UnityRandom, () => list.IndexOf(Roll(UnityRandom))); young.bloodline = list[Mathf.Clamp(num, 0, list.Count - 1)].id; int maxVar = MaxVar; young.vars = BloodlineMath.Pack(BloodlineMath.InheritVariation(BloodlineMath.Unpack(a?.vars ?? 0), BloodlineMath.Unpack(b?.vars ?? 0), UnityRandom, Mathf.Max(1, maxVar / 2), maxVar)); } } public static string Short(BloodlineDef b) { Stat? stat = Up(b); Stat? stat2 = Down(b); string text = ""; if (stat.HasValue) { text = text + "+" + BloodlineMath.StatShort[(int)stat.Value]; } if (stat2.HasValue) { text = text + ((text.Length > 0) ? " " : "") + "-" + BloodlineMath.StatShort[(int)stat2.Value]; } return text; } public static string Describe(BloodlineDef b) { Stat? stat = Up(b); Stat? stat2 = Down(b); if (!stat.HasValue && !stat2.HasValue) { return "no stat favoured"; } if (stat.HasValue && stat2.HasValue) { return BloodlineMath.StatNames[(int)stat.Value] + " grows faster, " + BloodlineMath.StatNames[(int)stat2.Value] + " slower"; } if (!stat.HasValue) { return BloodlineMath.StatNames[(int)stat2.Value] + " grows slower"; } return BloodlineMath.StatNames[(int)stat.Value] + " grows faster"; } } public static class ShinyBoost { public static float MultiplierFor(string speciesKey, Vector3 pos) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) VCC.Data.StatsFile now = PlayerStats.Now; int combo = ((now != null && now.comboSpecies == speciesKey) ? now.combo : 0); string text = BiomeAt(pos); return ShinyMath.Multiplier(ShinyMath.ComboActive(combo, VccConfig.ShinyComboLength.Value), VccConfig.ShinyComboBonus.Value, text != null && IsComplete(text), VccConfig.BiomeCompleteShinyBonus.Value, ShinyCharm.Near(pos) ? VccConfig.ShinyCharmMultiplier.Value : 1f); } public static string BiomeAt(Vector3 pos) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) return CreatureCatalog.BandFor(Heightmap.FindBiome(pos))?.biome; } public static bool IsComplete(string biome) { if (string.IsNullOrEmpty(biome)) { return false; } bool result = false; foreach (Species item in CreatureCatalog.Listed) { if (!item.Boss && item.Band != null && !(item.Band.biome != biome)) { result = true; DexEntry dexEntry = Compendium.Get(item.Key); if (dexEntry == null || dexEntry.caught <= 0) { return false; } } } return result; } public static int CompleteCount() { return Tables.Bands.biomes.Count((BandDef b) => IsComplete(b.biome)); } public static void OnCatch(Player p, string speciesKey, bool biomeWasComplete) { VCC.Data.StatsFile now = PlayerStats.Now; if (now == null) { return; } string comboSpecies = now.comboSpecies; int combo = now.combo; int next = ShinyMath.NextCombo(comboSpecies, combo, speciesKey); PlayerStats.Add(delegate(VCC.Data.StatsFile st) { st.comboSpecies = speciesKey; st.combo = next; if (next > st.bestCombo) { st.bestCombo = next; st.bestComboSpecies = speciesKey; } }); int value = VccConfig.ShinyComboLength.Value; string text = CreatureNames.Name(speciesKey); float value2 = VccConfig.ShinyComboBonus.Value; if (next == 1 && combo >= 2 && !string.IsNullOrEmpty(comboSpecies)) { ((Character)p).Message((MessageType)1, $"Your {CreatureNames.Name(comboSpecies)} combo ({combo}) is broken.", 0, (Sprite)null, false); } if (value > 0 && value2 > 0f && next >= 2) { if (next < value) { ((Character)p).Message((MessageType)1, $"Catch combo: {next} {text} in a row. {value - next} more and shiny {text} turn up more often.", 0, (Sprite)null, false); } else if (next == value) { ((Character)p).Message((MessageType)1, string.Format("<color={0}>Catch combo {1}! Shiny {2} are {3:0%} likelier while it lasts.</color>", "#ff9ef5", next, text, value2), 0, (Sprite)null, false); } else { ((Character)p).Message((MessageType)1, string.Format("Catch combo: {0} {1} <color={2}>(shinies +{3:0%})</color>.", next, text, "#ff9ef5", value2), 0, (Sprite)null, false); } } Species species = CreatureCatalog.Get(speciesKey); string text2 = ((species == null || species.Boss) ? null : species.Band?.biome); if (text2 != null && !biomeWasComplete && IsComplete(text2) && VccConfig.BiomeCompleteShinyBonus.Value > 0f) { ((Character)p).Message((MessageType)1, string.Format("<color={0}>{1} complete!</color>\nShinies are {2:0%} likelier in the {3} from now on.", "#ff9ef5", species.BiomeName, VccConfig.BiomeCompleteShinyBonus.Value, species.BiomeName), 0, (Sprite)null, false); } } } public class ShinyBurst : MonoBehaviour { private const float Seconds = 3f; private static Material _material; private static bool _materialLooked; private Light _light; private float _t0; private static readonly Color Pink = new Color(1f, 0.62f, 0.96f); private static readonly Color Gold = new Color(1f, 0.85f, 0.45f); public static void Play(Vector3 pos, float size) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) size = Mathf.Clamp(size, 0.6f, 4f); Material val = SparkleMaterial(); GameObject val2 = new GameObject("VCC shiny burst"); val2.transform.position = pos; if ((Object)(object)val != (Object)null) { Burst(val2.transform, val, size); Twinkles(val2.transform, val, size); } val2.AddComponent<ShinyBurst>().Setup(size); Fx.Local(Tables.Items.fx.shinySummon, pos); Fx.Local(Tables.Items.fx.shinySparkle, pos); Object.Destroy((Object)(object)val2, 3.5f); } private void Setup(float size) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) _t0 = Time.time; _light = ((Component)this).gameObject.AddComponent<Light>(); _light.type = (LightType)2; _light.color = Pink; _light.range = 4f * size; _light.intensity = 3f; _light.shadows = (LightShadows)0; } private void Update() { if ((Object)(object)_light != (Object)null) { _light.intensity = Mathf.Lerp(3f, 0f, (Time.time - _t0) / 0.9f); } } private static Material SparkleMaterial() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown if (_materialLooked) { return _material; } _materialLooked = true; Shader val = Shader.Find("Legacy Shaders/Particles/Additive") ?? Shader.Find("Legacy Shaders/Particles/Alpha Blended") ?? Shader.Find("Sprites/Default"); if ((Object)(object)val == (Object)null) { VccLog.Warn("Shiny burst: no particle shader found; shinies arrive without their sparkles."); return null; } _material = new Material(val) { name = "VCC shiny sparkle", mainTexture = (Texture)(object)Glyphs.SparkleTexture }; return _material; } private static Gradient Colours() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) Gradient val = new Gradient(); val.SetKeys((GradientColorKey[])(object)new GradientColorKey[3] { new GradientColorKey(Pink, 0f), new GradientColorKey(Color.white, 0.5f), new GradientColorKey(Gold, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[2] { new GradientAlphaKey(1f, 0f), new GradientAlphaKey(1f, 1f) }); return val; } private static ParticleSystem NewSystem(Transform parent, string name, Material mat) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.transform.SetParent(parent, false); ParticleSystem val2 = val.AddComponent<ParticleSystem>(); val2.Stop(true, (ParticleSystemStopBehavior)0); ParticleSystemRenderer component = val.GetComponent<ParticleSystemRenderer>(); ((Renderer)component).material = mat; component.renderMode = (ParticleSystemRenderMode)0; ((Renderer)component).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)component).receiveShadows = false; return val2; } private static void Burst(Transform parent, Material mat, float size) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Expected O, but got Unknown //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Expected O, but got Unknown //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) ParticleSystem val = NewSystem(parent, "burst", mat); MainModule main = val.main; ((MainModule)(ref main)).duration = 0.6f; ((MainModule)(ref main)).loop = false; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.8f, 1.6f); ((MainModule)(ref main)).startSpeed = new MinMaxCurve(1.5f * size, 4f * size); ((MainModule)(ref main)).startSize = new MinMaxCurve(0.12f * size, 0.32f * size); ((MainModule)(ref main)).startRotation = new MinMaxCurve(0f, (float)Math.PI * 2f); MinMaxGradient startColor = default(MinMaxGradient); ((MinMaxGradient)(ref startColor))..ctor(Colours()); ((MinMaxGradient)(ref startColor)).mode = (ParticleSystemGradientMode)4; ((MainModule)(ref main)).startColor = startColor; ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(-0.12f); ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).maxParticles = 200; EmissionModule emission = val.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f); ((EmissionModule)(ref emission)).SetBursts((Burst[])(object)new Burst[2] { new Burst(0f, (short)45), new Burst(0.25f, (short)25) }); ShapeModule shape = val.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0; ((ShapeModule)(ref shape)).radius = 0.4f * size; LimitVelocityOverLifetimeModule limitVelocityOverLifetime = val.limitVelocityOverLifetime; ((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).enabled = true; ((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).dampen = 0.15f; ((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).limit = MinMaxCurve.op_Implicit(0.5f * size); SizeOverLifetimeModule sizeOverLifetime = val.sizeOverLifetime; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, new AnimationCurve((Keyframe[])(object)new Keyframe[3] { new Keyframe(0f, 0.6f), new Keyframe(0.15f, 1.2f), new Keyframe(1f, 0f) })); RotationOverLifetimeModule rotationOverLifetime = val.rotationOverLifetime; ((RotationOverLifetimeModule)(ref rotationOverLifetime)).enabled = true; ((RotationOverLifetimeModule)(ref rotationOverLifetime)).z = new MinMaxCurve(-3f, 3f); ColorOverLifetimeModule colorOverLifetime = val.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true; Gradient val2 = new Gradient(); val2.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(Color.white, 0f), new GradientColorKey(Color.white, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[3] { new GradientAlphaKey(1f, 0f), new GradientAlphaKey(1f, 0.6f), new GradientAlphaKey(0f, 1f) }); ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(val2); val.Play(); } private static void Twinkles(Transform parent, Material mat, float size) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Expected O, but got Unknown //IL_013d: Unknown result type (might be due to invalid IL or missing references) ParticleSystem val = NewSystem(parent, "twinkles", mat); MainModule main = val.main; ((MainModule)(ref main)).duration = 1.6f; ((MainModule)(ref main)).loop = false; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.35f, 0.6f); ((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0f); ((MainModule)(ref main)).startSize = new MinMaxCurve(0.4f * size, 0.8f * size); ((MainModule)(ref main)).startRotation = new MinMaxCurve(-0.3f, 0.3f); MinMaxGradient startColor = default(MinMaxGradient); ((MinMaxGradient)(ref startColor))..ctor(Colours()); ((MinMaxGradient)(ref startColor)).mode = (ParticleSystemGradientMode)4; ((MainModule)(ref main)).startColor = startColor; ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; EmissionModule emission = val.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(14f); ShapeModule shape = val.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0; ((ShapeModule)(ref shape)).radius = 0.9f * size; SizeOverLifetimeModule sizeOverLifetime = val.sizeOverLifetime; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, new AnimationCurve((Keyframe[])(object)new Keyframe[3] { new Keyframe(0f, 0f), new Keyframe(0.35f, 1f), new Keyframe(1f, 0f) })); val.Play(); } } public static class ShinyLook { private static readonly Dictionary<(int, float), Material> _tinted = new Dictionary<(int, float), Material>(); public static void Apply(VccCreature vc) { if (!((Object)(object)vc == (Object)null) && !((Object)(object)((Component)vc).GetComponent<ShinySparkle>() != (Object)null)) { TintObject(((Component)vc).gameObject, vc.PrefabName); ((Component)vc).gameObject.AddComponent<ShinySparkle>(); } } public static void TintObject(GameObject go, string prefabName) { //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) float hue = CreatureCatalog.Get(prefabName)?.ShinyHue ?? 0.3f; Renderer[] componentsInChildren = go.GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { if (val is TrailRenderer || val is LineRenderer) { continue; } bool flag = val is ParticleSystemRenderer; Material[] sharedMaterials = val.sharedMaterials; bool flag2 = false; for (int j = 0; j < sharedMaterials.Length; j++) { Material val2 = (flag ? TintedGlow(sharedMaterials[j], hue) : Tinted(sharedMaterials[j], hue)); if (!((Object)(object)val2 == (Object)(object)sharedMaterials[j])) { sharedMaterials[j] = val2; flag2 = true; } } if (flag2) { val.sharedMaterials = sharedMaterials; } } ParticleSystem[] componentsInChildren2 = go.GetComponentsInChildren<ParticleSystem>(true); for (int i = 0; i < componentsInChildren2.Length; i++) { MainModule main = componentsInChildren2[i].main; ((MainModule)(ref main)).startColor = Shift(((MainModule)(ref main)).startColor, hue); } Light[] componentsInChildren3 = go.GetComponentsInChildren<Light>(true); foreach (Light val3 in componentsInChildren3) { if (((Object)((Component)val3).gameObject).name != "VCC shiny light") { val3.color = Shift(val3.color, hue); } } } private static Material Tinted(Material m, float hue) { //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Expected O, but got Unknown //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Expected O, but got Unknown if ((Object)(object)m == (Object)null) { return null; } (int, float) key = (((Object)m).GetInstanceID(), hue); if (_tinted.TryGetValue(key, out var value) && (Object)(object)value != (Object)null) { return value; } value = m; if (m.HasProperty("_Hue") && m.HasProperty("_Saturation") && m.HasProperty("_Value")) { value = new Material(m) { name = ((Object)m).name + " (VCC shiny)" }; value.SetFloat("_Hue", m.GetFloat("_Hue") + hue); value.SetFloat("_Saturation", m.GetFloat("_Saturation") + 0.15f); value.SetFloat("_Value", m.GetFloat("_Value") + 0.05f); } else if (m.HasProperty("_Color")) { value = new Material(m) { name = ((Object)m).name + " (VCC shiny)" }; float num = default(float); float num2 = default(float); float num3 = default(float); Color.RGBToHSV(m.GetColor("_Color"), ref num, ref num2, ref num3); Color val = Color.HSVToRGB(Mathf.Repeat(num + hue, 1f), Mathf.Clamp01(num2 + 0.25f), Mathf.Clamp01(num3 + 0.1f)); val.a = m.GetColor("_Color").a; value.SetColor("_Color", val); } if (m.HasProperty("_EmissionColor") && Lit(m.GetColor("_EmissionColor"))) { if ((Object)(object)value == (Object)(object)m) { value = new Material(m) { name = ((Object)m).name + " (VCC shiny)" }; } value.SetColor("_EmissionColor", Shift(m.GetColor("_EmissionColor"), hue)); } return _tinted[key] = value; } private static Material TintedGlow(Material m, float hue) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown if ((Object)(object)m == (Object)null) { return null; } (int, float) key = (((Object)m).GetInstanceID(), hue + 10f); if (_tinted.TryGetValue(key, out var value) && (Object)(object)value != (Object)null) { return value; } value = m; string[] array = new string[3] { "_TintColor", "_Color", "_EmissionColor" }; foreach (string text in array) { if (m.HasProperty(text) && Lit(m.GetColor(text))) { if ((Object)(object)value == (Object)(object)m) { value = new Material(m) { name = ((Object)m).name + " (VCC shiny)" }; } value.SetColor(text, Shift(m.GetColor(text), hue)); } } return _tinted[key] = value; } private static bool Lit(Color c) { return ((Color)(ref c)).maxColorComponent > 0.02f; } private static Color Shift(Color c, float hue) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Max(1f, ((Color)(ref c)).maxColorComponent); float num2 = default(float); float num3 = default(float); float num4 = default(float); Color.RGBToHSV(c / num, ref num2, ref num3, ref num4); Color result = Color.HSVToRGB(Mathf.Repeat(num2 + hue, 1f), Mathf.Clamp01(num3 + 0.15f), num4) * num; result.a = c.a; return result; } private static MinMaxGradient Shift(MinMaxGradient g, float hue) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected I4, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) ParticleSystemGradientMode mode = ((MinMaxGradient)(ref g)).mode; switch ((int)mode) { case 0: return new MinMaxGradient(Shift(((MinMaxGradient)(ref g)).color, hue)); case 2: return new MinMaxGradient(Shift(((MinMaxGradient)(ref g)).colorMin, hue), Shift(((MinMaxGradient)(ref g)).colorMax, hue)); case 1: return new MinMaxGradient(Shift(((MinMaxGradient)(ref g)).gradient, hue)); case 3: return new MinMaxGradient(Shift(((MinMaxGradient)(ref g)).gradientMin, hue), Shift(((MinMaxGradient)(ref g)).gradientMax, hue)); case 4: { MinMaxGradient result = default(MinMaxGradient); ((MinMaxGradient)(ref result))..ctor(Shift(((MinMaxGradient)(ref g)).gradient, hue)); ((MinMaxGradient)(ref result)).mode = (ParticleSystemGradientMode)4; return result; } default: return g; } } private static Gradient Shift(Gradient g, float hue) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown if (g == null) { return null; } Gradient val = new Gradient { mode = g.mode }; val.SetKeys(((IEnumerable<GradientColorKey>)g.colorKeys).Select((Func<GradientColorKey, GradientColorKey>)((GradientColorKey k) => new GradientColorKey(Shift(k.color, hue), k.time))).ToArray(), g.alphaKeys); return val; } } public class ShinySparkle : MonoBehaviour { private static readonly HashSet<ZDOID> _alerted = new HashSet<ZDOID>(); private float _nextSparkle; private float _nextCheck; private Character _character; private void Start() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) _character = ((Component)this).GetComponent<Character>(); GameObject val = new GameObject("VCC shiny light"); val.transform.SetParent(((Component)this).transform, false); val.transform.localPosition = Vector3.up * 1.2f; Light obj = val.AddComponent<Light>(); obj.type = (LightType)2; obj.color = new Color(1f, 0.85f, 1f); obj.range = 4f; obj.intensity = 1.2f; obj.shadows = (LightShadows)0; _nextSparkle = Time.time + Random.Range(0.5f, 3f); } private void Update() { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_character == (Object)null || _character.IsDead() || CaptureHide.IsHidden(_character)) { return; } if (Time.time >= _nextSparkle) { _nextSparkle = Time.time + Random.Range(2.5f, 4.5f); Fx.Local(Tables.Items.fx.shinySparkle, _character.GetCenterPoint()); } if (Time.time < _nextCheck) { return; } _nextCheck = Time.time + 1f; Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || !VccConfig.ShinyAlert.Value || Stats.IsCompanion(Stats.ZdoOf(_character))) { return; } ZDOID zDOID = _character.GetZDOID(); if (!_alerted.Contains(zDOID) && !(Vector3.Distance(((Component)localPlayer).transform.position, ((Component)this).transform.position) > 45f)) { _alerted.Add(zDOID); PlayerStats.Add(delegate(VCC.Data.StatsFile s) { s.shiniesSeen++; }); string prefabName = Utils.GetPrefabName(((Component)this).gameObject); string text = CreatureNames.Name(CreatureCatalog.Get(prefabName)?.Key ?? prefabName); bool value = VccConfig.ShinyPins.Value; ((Character)localPlayer).Message((MessageType)2, "<color=#ff9ef5>Something rare is near... a shiny " + text + "!</color>" + (value ? " <size=80%>(marked on your map)</size>" : ""), 0, (Sprite)null, false); ShinyPins.Add(_character, text); HuginTips.Show("shiny"); Fx.Local(Tables.Items.fx.catchStart, ((Component)localPlayer).transform.position + Vector3.up); } } } public class VccCreature : MonoBehaviour { public static readonly HashSet<VccCreature> All = new HashSet<VccCreature>(); private bool _ready; private bool _shinyDone; private bool _prepared; private bool _speedDone; private float _next; private float _born; private float _walk; private float _jog; private float _run; private float _swim; private float _flySlow; private float _flyFast; private bool _haveSpeeds; public float RideFactor = 1f; public Character Character { get; private set; } public ZNetView View { get; private set; } public string PrefabName { get; private set; } public ZDO Zdo { get { if (!((Object)(object)View != (Object)null) || !View.IsValid()) { return null; } return View.GetZDO(); } } public int Level => Stats.Level(Zdo); public bool IsCompanion => Stats.IsCompanion(Zdo); public bool IsShiny => Stats.IsShiny(Zdo); public float BaseRunSpeed { get { if (!_haveSpeeds) { if (!((Object)(object)Character != (Object)null)) { return 0f; } return Character.m_runSpeed; } return _run; } } private void Awake() { Character = ((Component)this).GetComponent<Character>(); View = ((Component)this).GetComponent<ZNetView>(); PrefabName = Utils.GetPrefabName(((Component)this).gameObject); _born = Time.time; if ((Object)(object)Character != (Object)null && Stats.IsCompanion(Zdo)) { Character.m_boss = false; } } private void OnEnable() { All.Add(this); } private void OnDisable() { All.Remove(this); } private void Start() { Tick(); } private void Update() { if (!_ready && !(Time.time < _next)) { _next = Time.time + 0.5f; Tick(); } } private void Tick() { ZDO zdo = Zdo; if (zdo == null || (Object)(object)Character == (Object)null) { return; } if (Compat.Foreign(zdo)) { _ready = true; return; } if (!_prepared && zdo.GetInt(ZdoKeys.Role, 0) == 1) { CompanionPrep.Apply(this); _prepared = true; } else if (!_prepared && zdo.GetInt(ZdoKeys.Role, 0) == 3) { CompanionPrep.Strip(this); _prepared = true; } if (zdo.GetInt(ZdoKeys.Level, 0) <= 0) { if (!View.IsOwner()) { return; } if (CreatureCatalog.Get(PrefabName) == null || Character.IsTamed()) { _ready = true; return; } WildInit.Roll(this); } else if (!Bloodlines.Rolled(zdo) && !IsCompanion && View.IsOwner()) { WildInit.RollBloodline(this); } if (!_speedDone) { if (!Bloodlines.Rolled(zdo) && !(Time.time - _born > 15f)) { return; } ApplySpeed(); } if (!_shinyDone) { if (Time.time - _born < 0.4f) { return; } if (zdo.GetBool(ZdoKeys.Shiny, false)) { ShinyLook.Apply(this); } _shinyDone = true; } _ready = true; } public void ApplySpeed() { Character character = Character; if (!((Object)(object)character == (Object)null)) { if (!_haveSpeeds) { _walk = character.m_walkSpeed; _jog = character.m_speed; _run = character.m_runSpeed; _swim = character.m_swimSpeed; _flySlow = character.m_flySlowSpeed; _flyFast = character.m_flyFastSpeed; _haveSpeeds = true; } float num = Mathf.Clamp(Stats.SpeedMult(Stats.Of(Zdo, PrefabName)) * RideFactor, 0.3f, 4f); character.m_walkSpeed = _walk * num; character.m_speed = _jog * num; character.m_runSpeed = _run * num; character.m_swimSpeed = _swim * num; character.m_flySlowSpeed = _flySlow * num; character.m_flyFastSpeed = _flyFast * num; _speedDone = true; } } } public static class WildInit { public static void Roll(VccCreature vc) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) Character character = vc.Character; ZDO zdo = vc.Zdo; if (!((Object)(object)character == (Object)null) && zdo != null) { Species species = CreatureCatalog.Get(vc.PrefabName); int num; int num2; if (species != null && species.Boss) { num = (num2 = species.BandMin); } else { BandDef bandDef = species?.Band ?? CreatureCatalog.BandFor(Heightmap.FindBiome(((Component)character).transform.position)) ?? CreatureCatalog.DefaultBand; num = Random.Range(bandDef.min, bandDef.max + 1); num2 = bandDef.min; } bool num3 = species != null && Random.value < ShinyMath.Chance(VccConfig.ShinyOdds.Value, ShinyBoost.MultiplierFor(species.Key, ((Component)character).transform.position)); bool flag = character.GetHealth() >= character.GetMaxHealth() - 0.01f; zdo.Set(ZdoKeys.Level, num, false); zdo.Set(ZdoKeys.Floor, num2, false); if (num3) { zdo.Set(ZdoKeys.Shiny, true); } Bloodlines.RollInto(zdo); character.SetMaxHealth(Stats.MaxHealth(character, zdo)); if (flag) { character.SetHealth(character.GetMaxHealth()); } vc.ApplySpeed(); if (num3) { VccLog.Info($"A shiny {vc.PrefabName} appeared (Lv {num}) at {((Component)character).transform.position}"); } VccLog.Debug($"Wild {vc.PrefabName}: Lv {num} (floor {num2}), stars {Stats.Stars(character)}, hp {character.GetMaxHealth():0}"); } } public static void Force(Character c, int level, int stars, bool? shiny) { ZNetView nview = c.m_nview; if ((Object)(object)nview == (Object)null || !nview.IsValid()) { return; } if (!nview.IsOwner()) { nview.ClaimOwnership(); } ZDO zDO = nview.GetZDO(); if (stars >= 0) { c.SetLevel(stars + 1); } if (level > 0) { zDO.Set(ZdoKeys.Level, level, false); if (zDO.GetInt(ZdoKeys.Floor, 0) <= 0) { zDO.Set(ZdoKeys.Floor, CreatureCatalog.Get(Utils.GetPrefabName(((Component)c).gameObject))?.BandMin ?? 1, false); } } if (shiny.HasValue) { zDO.Set(ZdoKeys.Shiny, shiny.Value); } if (!Bloodlines.Rolled(zDO)) { Bloodlines.RollInto(zDO); } c.SetMaxHealth(Stats.MaxHealth(c, zDO)); c.SetHealth(c.GetMaxHealth()); ((Component)c).GetComponent<VccCreature>()?.ApplySpeed(); } public static void RollBloodline(VccCreature vc) { Character character = vc.Character; ZDO zdo = vc.Zdo; if (!((Object)(object)character == (Object)null) && zdo != null && !Bloodlines.Rolled(zdo)) { float healthPercentage = character.GetHealthPercentage(); Bloodlines.RollInto(zdo); character.SetMaxHealth(Stats.MaxHealth(character, zdo)); character.SetHealth(character.GetMaxHealth() * healthPercentage); } } } } namespace VCC.UI { public static class BattleHud { private static GUIStyle _hint; public static void Draw(BattleSession s) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) float w = Hud.W; float h = Hud.H; float num = Mathf.Min(1000f, w - 40f); float num2 = (w - num) / 2f; float num3 = h - 220f - 21f; BattleUi.LogLine(new Rect(num2, num3 - 54f, num, 48f), s); Styles.Box(new Rect(num2, num3, num, 220f)); BattleUi.Card(new Rect(num2 + 12f, num3 + 12f, 310f, 120f), s.Mine, wild: false); BattleUi.TeamStrip(new Rect(num2 + 12f, num3 + 142f, 310f, 64f), s); BattleUi.MenuArea(new Rect(num2 + 336f, num3 + 14f, num - 350f, 192f), s); float num4 = Mathf.Min(400f, w * 0.32f); BattleUi.Card(new Rect(w - num4 - 24f, 70f, num4, 132f), s.Wild, wild: true); if (BattleCamera.Active) { CameraHint(PadBinds.Using ? new Rect(num2, num3 - 54f - 30f, num, 26f) : new Rect(num2, num3 + 220f + 1f, num, 19f)); } } private static void CameraHint(Rect r) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Expected O, but got Unknown //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) if (_hint == null) { _hint = new GUIStyle(Styles.Body) { fontSize = 14, alignment = (TextAnchor)4, wordWrap = false }; _hint.normal.textColor = new Color(Theme.Beige.r, Theme.Beige.g, Theme.Beige.b, 0.8f); } if (!PadBinds.Using) { GUI.Label(r, "Right-drag or A / D, W / S: turn the camera" + (BattleCamera.Turned ? " · Middle-click: back to the usual view" : ""), _hint); return; } List<(string, string)> list = new List<(string, string)> { ("rightStick", "turn the camera") }; if (BattleCamera.Turned) { list.Add(("rightStickPress", "back to the usual view")); } float h = ((Rect)(ref r)).height; GUIStyle left = new GUIStyle(_hint) { alignment = (TextAnchor)3 }; List<float> list2 = list.Select<(string, string), float>(((string icon, string text) p) => PadIcons.Width(new string[1] { p.icon }, h) + 4f + left.CalcSize(new GUIContent(p.text)).x).ToList(); float num = ((Rect)(ref r)).x + (((Rect)(ref r)).width - list2.Sum() - 24f * (float)(list.Count - 1)) / 2f; for (int num2 = 0; num2 < list.Count; num2++) { float num3 = PadIcons.Draw(new Rect(num, ((Rect)(ref r)).y, 60f, h), new string[1] { list[num2].Item1 }, left); GUI.Label(new Rect(num + num3 + 4f, ((Rect)(ref r)).y, list2[num2], h), list[num2].Item2, left); num += list2[num2] + 24f; } } } public static class BattleScreen { private static bool _hidHud; public static void Enter() { if (VccConfig.FullBattleScreen.Value) { HideHud(); } } public static void Leave() { if (_hidHud) { _hidHud = false; if ((Object)(object)Hud.instance != (Object)null) { Hud.instance.m_userHidden = false; } } } private static void HideHud() { Hud instance = Hud.instance; if (!((Object)(object)instance == (Object)null) && !instance.m_userHidden) { instance.m_userHidden = true; _hidHud = true; } } public static void Draw(BattleSession s) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Invalid comparison between Unknown and I4 //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) HideHud(); float w = Hud.W; float h = Hud.H; if ((int)Event.current.type == 7) { Bar(new Rect(0f, 0f, w, h * 0.07f), top: true); Bar(new Rect(0f, h - h * 0.07f, w, h * 0.07f), top: false); } BattleHud.Draw(s); } private static void Bar(Rect r, bool top) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) Color color = GUI.color; GUI.color = new Color(0f, 0f, 0f, 0.92f); GUI.DrawTexture(r, (Texture)(object)Texture2D.whiteTexture); float num = ((Rect)(ref r)).height * 0.6f; for (int i = 0; i < 8; i++) { float num2 = 0.92f * (1f - (float)(i + 1) / 9f); GUI.color = new Color(0f, 0f, 0f, num2 * 0.5f); float num3 = (top ? (((Rect)(ref r)).yMax + (float)i * num / 8f) : (((Rect)(ref r)).y - (float)(i + 1) * num / 8f)); GUI.DrawTexture(new Rect(((Rect)(ref r)).x, num3, ((Rect)(ref r)).width, num / 8f), (Texture)(object)Texture2D.whiteTexture); } GUI.color = color; } } public static class BattleUi { private enum Menu { Main, Fight, Bag, BagTarget, Team, GiveUp } private static Menu _menu; private static (Menu, bool, int, BattleSession.Phase) _padScreen; private static int _careIndex; private static BattleSession _for; private static int _turn; private static BattleSession.Phase _phase; private static string _flash; private static float _flashUntil; private static readonly Dictionary<Character, float> _shownHp = new Dictionary<Character, float>(); private static GUIStyle _name; private static GUIStyle _small; private static GUIStyle _line; private static GUIStyle _chip; private static GUIStyle _banner; private static GUIStyle _moveName; private static GUIStyle _moveInfo; private static GUIStyle _teamLabel; private static GUIStyle _back; private static readonly Regex Tags = new Regex("<.*?>"); private static string BackTip { get { if (!PadBinds.Using) { return "Back (Escape or Backspace)."; } return "Back (B)."; } } private static string FoeName(Battler b) { Foe foe = BattleManager.Current?.Foe; if (foe == null || foe.Kind == FoeKind.Wild) { return "Wild " + b.Name; } string text = foe.Title(b.Name); return char.ToUpperInvariant(text[0]) + text.Substring(1); } private static void FoeTeam(Rect r, BattleSession s) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Invalid comparison between Unknown and I4 //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) Foe foe = s?.Foe; if (foe != null && foe.Kind == FoeKind.Champion && foe.Team.Count != 0 && (int)Event.current.type == 7) { int count = foe.Team.Count; int left = foe.Left; string text = ((left >= count) ? $"Team of {count}" : ((left <= 1) ? "Last one" : $"{left} of {count} left")); float num = (float)count * 21f - 5f; Color color = GUI.color; Rect val = default(Rect); for (int i = 0; i < count; i++) { FoeMember foeMember = foe.Team[i]; ((Rect)(ref val))..ctor(((Rect)(ref r)).xMax - num + (float)i * 21f, ((Rect)(ref r)).y + (((Rect)(ref r)).height - 16f) / 2f, 16f, 16f); GUI.color = new Color(0.08f, 0.05f, 0.03f, 0.95f); GUI.DrawTexture(val, (Texture)(object)Glyphs.Dot); GUI.color = (foeMember.Fainted ? new Color(0.3f, 0.25f, 0.22f) : ((i == foe.Index) ? new Color(1f, 0.78f, 0.3f) : new Color(0.95f, 0.9f, 0.8f))); GUI.DrawTexture(new Rect(((Rect)(ref val)).x + 2.5f, ((Rect)(ref val)).y + 2.5f, 11f, 11f), (Texture)(object)Glyphs.Dot); } GUI.color = color; GUI.Label(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width - num - 8f, ((Rect)(ref r)).height), text, _teamLabel); } } public static bool Back() { if (!BattleManager.Active) { return false; } if (_menu == Menu.BagTarget) { _menu = Menu.Bag; return true; } if (_menu == Menu.GiveUp) { BattleSession current = BattleManager.Current; _menu = ((current != null && current.Now == BattleSession.Phase.ForcedSwitch) ? Menu.Team : Menu.Main); return true; } if (_menu != Menu.Main) { BattleSession current2 = BattleManager.Current; if (current2 == null || current2.Now != BattleSession.Phase.ForcedSwitch) { _menu = Menu.Main; return true; } } return false; } public static void Draw() { BattleSession current = BattleManager.Current; if (current == null) { return; } Ensure(); if (current != _for || current.Turn != _turn || current.Now != _phase) { if (current.Now == BattleSession.Phase.ForcedSwitch) { _menu = Menu.Team; } else if (current != _for || current.Turn != _turn) { _menu = Menu.Main; } _for = current; _turn = current.Turn; _phase = current.Now; } (Menu, bool, int, BattleSession.Phase) padScreen = (_menu, current.WaitingForPlayer, current.Turn, current.Now); if (!padScreen.Equals(_padScreen)) { _padScreen = padScreen; PadNav.Restart(); } Keys(current); if (VccConfig.FullBattleScreen.Value) { BattleScreen.Draw(current); } else { BattleHud.Draw(current); } } private static void Ensure() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Expected O, but got Unknown //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Expected O, but got Unknown //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Expected O, but got Unknown //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Expected O, but got Unknown if (_name == null) { _name = new GUIStyle(Styles.Heading) { fontSize = 20, richText = true, alignment = (TextAnchor)3 }; _small = new GUIStyle(Styles.Body) { fontSize = 15, richText = true, wordWrap = true }; _line = new GUIStyle(Styles.Body) { fontSize = 20, richText = true, wordWrap = true, alignment = (TextAnchor)3 }; _chip = new GUIStyle(Styles.Body) { fontSize = 14, richText = true, alignment = (TextAnchor)5 }; _banner = new GUIStyle(Styles.Title) { fontSize = 34, alignment = (TextAnchor)4, richText = true }; _moveName = new GUIStyle(Styles.Heading) { fontSize = 18, richText = true, alignment = (TextAnchor)0 }; _moveInfo = new GUIStyle(Styles.Body) { fontSize = 14, richText = true, alignment = (TextAnchor)6 }; _teamLabel = new GUIStyle(_small) { alignment = (TextAnchor)5, wordWrap = false }; _back = new GUIStyle(Styles.Small) { fontSize = 15 }; } } public static void Card(Rect r, Battler b, bool wild) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Expected O, but got Unknown //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) Styles.Box(r); if (b == null) { return; } float num = ((Rect)(ref r)).x + 12f; float num2 = ((Rect)(ref r)).width - 24f; string text = (b.Shiny ? "<color=#ff9ef5>Shiny</color> " : ""); Styles.Fit(new Rect(num, ((Rect)(ref r)).y + 6f, num2 - 76f, 28f), text + (wild ? FoeName(b) : b.Name), _name, 14); GUI.Label(new Rect(num + num2 - 76f, ((Rect)(ref r)).y + 6f, 76f, 28f), string.Format("<color={0}>Lv {1}</color>", "#ffd966", b.Level), new GUIStyle(_name) { alignment = (TextAnchor)5 }); if (b.Stars > 0) { Glyphs.Stars(num, ((Rect)(ref r)).y + 34f, 12f, b.Stars); } float num3 = b.HpFrac; Character c = b.C; if ((Object)(object)c != (Object)null) { if (!_shownHp.TryGetValue(c, out var value)) { value = num3; } value = Mathf.MoveTowards(value, num3, Time.unscaledDeltaTime * 0.8f); _shownHp[c] = value; num3 = value; } Glyphs.Bar(new Rect(num, ((Rect)(ref r)).y + 50f, num2, 12f), num3, Glyphs.HealthColor(num3)); string text2 = ((!((Object)(object)b.C != (Object)null)) ? "" : (wild ? $"{num3:0%}" : $"{Mathf.CeilToInt(b.C.GetHealth())} / {Mathf.CeilToInt(b.C.GetMaxHealth())}")); GUI.Label(new Rect(num, ((Rect)(ref r)).y + 64f, num2, 20f), text2, _small); if (wild) { FoeTeam(new Rect(num, ((Rect)(ref r)).y + 64f, num2, 20f), BattleManager.Current); } string text3 = Ailments(b); if (wild && VccConfig.BattleHints.Value) { string text4 = Resistances(b); if (text4.Length > 0) { text3 = ((text3.Length > 0) ? (text3 + " " + text4) : text4); } } if (text3.Length > 0) { GUI.Label(new Rect(num, ((Rect)(ref r)).y + 86f, num2, Mathf.Max(20f, ((Rect)(ref r)).height - 90f)), text3, _small); } } private static string Ailments(Battler b) { if ((Object)(object)b?.C == (Object)null) { return ""; } SEMan sEMan = b.C.GetSEMan(); List<string> list = new List<string>(); if (sEMan.HaveStatusEffect(SEMan.s_statusEffectBurning)) { list.Add("<color=#ff8a4a>Burning</color>"); } if (sEMan.HaveStatusEffect(SEMan.s_statusEffectPoison)) { list.Add("<color=#9fe05a>Poisoned</color>"); } if (sEMan.HaveStatusEffect(SEMan.s_statusEffectFrost)) { list.Add("<color=#9fdcff>Frozen</color>"); } if (sEMan.HaveStatusEffect(SEMan.s_statusEffectLightning)) { list.Add("<color=#ffe24a>Shocked</color>"); } if (sEMan.HaveStatusEffect(SEMan.s_statusEffectWet)) { list.Add("<color=#7fb0ff>Wet</color>"); } return string.Join(" ", list); } private static string Resistances(Battler b) { int[] array = b.Mods(); List<string> list = new List<string>(); List<string> list2 = new List<string>(); List<string> list3 = new List<string>(); for (int i = 0; i < array.Length; i++) { if (i != 3 && i != 4) { float num = BattleMath.ModMult(array[i]); string item = "<color=" + MoveNames.TypeColor(i) + ">" + MoveNames.TypeLabel(i) + "</color>"; if (num <= 0.001f) { list3.Add(item); } else if (num > 1.001f) { list.Add(item); } else if (num < 0.999f) { list2.Add(item); } } } List<string> list4 = new List<string>(); if (list.Count > 0) { list4.Add("Weak: " + string.Join(", ", list)); }