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 FlyingShips v0.1.2
FlyingShips/FlyingShips.dll
Decompiled 2 months 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.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using FlyingShips.Components; using FlyingShips.Config; using FlyingShips.Flight; using FlyingShips.Prefabs; using FlyingShips.UI; using HarmonyLib; using Jotunn; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using UnityEngine; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("My Monsters")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Monsters")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] namespace FlyingShips { [BepInPlugin("pl.jungle.flyingships", "Flying Ships", "0.0.4")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class FlyingShipsMod : BaseUnityPlugin { public const string ModGUID = "pl.jungle.flyingships"; public const string ModName = "Flying Ships"; public const string ModVersion = "0.0.4"; public const string FlightCoreItem = "SurtlingCore"; public const int FlightCoreAmount = 5; public const string AscendButton = "FlyingShips_Ascend"; public const string DescendButton = "FlyingShips_Descend"; public const string FlightFuelPrefab = "FlyingShipFuel"; public const string FlightFuelName = "Esencja Lotu"; private Harmony _harmony; private CustomLocalization _localization; private float _hudCheckTimer; private void Awake() { //IL_04a4: Unknown result type (might be due to invalid IL or missing references) //IL_04a9: Unknown result type (might be due to invalid IL or missing references) //IL_04b5: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04d2: Expected O, but got Unknown //IL_04dd: Unknown result type (might be due to invalid IL or missing references) //IL_04e2: Unknown result type (might be due to invalid IL or missing references) //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_04fa: Unknown result type (might be due to invalid IL or missing references) //IL_050b: Expected O, but got Unknown //IL_0543: Unknown result type (might be due to invalid IL or missing references) //IL_054d: Expected O, but got Unknown //IL_0552: Unknown result type (might be due to invalid IL or missing references) //IL_0558: Expected O, but got Unknown Logger.LogInfo((object)"Flying Ships 0.0.4 loading..."); FlightConfig.Bind(((BaseUnityPlugin)this).Config); _localization = LocalizationManager.Instance.GetLocalization(); CustomLocalization localization = _localization; string text = "Polish"; localization.AddTranslation(ref text, new Dictionary<string, string> { { "item_esencja_lotu", "Esencja Lotu" }, { "item_esencja_lotu_desc", "Magiczne paliwo do latajacych statkow." }, { "flyingships_ascend", "Wznieś statek" }, { "flyingships_descend", "Opusc statek" }, { "fs_controls", "Tryb lotu: PageUp start/gora, PageDown dol/ladowanie, W/S przod/tyl, A/D skret" }, { "fs_no_fuel", "Brak paliwa: Esencja Lotu" }, { "fs_flight_on", "Tryb lotu wlaczony" }, { "fs_flight_off", "Ladowanie zakonczone" }, { "fs_fuel_only_inventory", "Paliwo tylko w ekwipunku - w razie potrzeby wyladujesz awaryjnie" }, { "fs_no_backup_fuel", "Brak zapasowego paliwa - w razie potrzeby wyladujesz awaryjnie" }, { "fs_fuel_burned", "Spalono Esencje Lotu" }, { "fs_last_fuel", "To byla ostatnia Esencja Lotu!" }, { "fs_fuel_out", "Paliwo sie skonczylo! Statek schodzi awaryjnie..." }, { "fs_emergency_landed", "Wyladowano awaryjnie. Uzupelnij Esencje Lotu." }, { "fs_ship_req", "Wymaga" }, { "fs_ship_controls", "PageUp start/gora, PageDown dol/ladowanie. Wymaga paliwa: Esencja Lotu." }, { "fs_ship_storage", "Ma wlasny schowek pokladowy." }, { "fs_ship_storage_name", "schowek" }, { "item_esencja_lotu_5x", "Esencja Lotu x5" }, { "item_esencja_lotu_weak", "Słaba Esencja Lotu" }, { "item_esencja_lotu_weak_desc", "Słabe paliwo do latających statków. Krótki czas lotu." }, { "item_esencja_lotu_pure", "Czysta Esencja Lotu" }, { "item_esencja_lotu_pure_desc", "Potężne paliwo do latających statków. Długi czas lotu." }, { "fs_fuel_burned_weak", "Spalono Słabą Esencję Lotu" }, { "fs_fuel_burned_pure", "Spalono Czystą Esencję Lotu" }, { "fs_ship_fuel_slot", "Esencja – schowek" }, { "item_flight_core_1", "Rdzeń Lotu I" }, { "item_flight_core_1_desc", "Podstawowy rdzeń. +15% prędkości, +25 m wysokości, -10% spalania paliwa." }, { "item_flight_core_2", "Rdzeń Lotu II" }, { "item_flight_core_2_desc", "Ulepszony rdzeń. +30% prędkości, +50 m wysokości, -20% spalania paliwa." }, { "item_flight_core_3", "Rdzeń Lotu III" }, { "item_flight_core_3_desc", "Mistrzowski rdzeń. +50% prędkości, +100 m wysokości, -35% spalania paliwa." } }); CustomLocalization localization2 = _localization; text = "English"; localization2.AddTranslation(ref text, new Dictionary<string, string> { { "item_esencja_lotu", "Flight Essence" }, { "item_esencja_lotu_desc", "Magic fuel for flying ships." }, { "flyingships_ascend", "Ascend ship" }, { "flyingships_descend", "Descend ship" }, { "fs_controls", "Flight mode: PageUp start/up, PageDown down/land, W/S forward/back, A/D turn" }, { "fs_no_fuel", "No fuel: Flight Essence" }, { "fs_flight_on", "Flight mode enabled" }, { "fs_flight_off", "Landing complete" }, { "fs_fuel_only_inventory", "Fuel only in inventory - you'll land in emergency if needed" }, { "fs_no_backup_fuel", "No backup fuel - you'll land in emergency if needed" }, { "fs_fuel_burned", "Burned Flight Essence" }, { "fs_last_fuel", "That was the last Flight Essence!" }, { "fs_fuel_out", "Fuel depleted! Ship descending in emergency..." }, { "fs_emergency_landed", "Emergency landing. Refill Flight Essence." }, { "fs_ship_req", "Requires" }, { "fs_ship_controls", "PageUp start/up, PageDown down/land. Requires fuel: Flight Essence." }, { "fs_ship_storage", "Has its own onboard storage." }, { "fs_ship_storage_name", "storage" }, { "item_esencja_lotu_5x", "Flight Essence x5" }, { "item_esencja_lotu_weak", "Weak Flight Essence" }, { "item_esencja_lotu_weak_desc", "Weak fuel for flying ships. Short flight time." }, { "item_esencja_lotu_pure", "Pure Flight Essence" }, { "item_esencja_lotu_pure_desc", "Powerful fuel for flying ships. Long flight time." }, { "fs_fuel_burned_weak", "Burned Weak Flight Essence" }, { "fs_fuel_burned_pure", "Burned Pure Flight Essence" }, { "fs_ship_fuel_slot", "Essence Storage" }, { "item_flight_core_1", "Flight Core I" }, { "item_flight_core_1_desc", "Basic core. +15% speed, +25 m max height, -10% fuel consumption." }, { "item_flight_core_2", "Flight Core II" }, { "item_flight_core_2_desc", "Upgraded core. +30% speed, +50 m max height, -20% fuel consumption." }, { "item_flight_core_3", "Flight Core III" }, { "item_flight_core_3_desc", "Master core. +50% speed, +100 m max height, -35% fuel consumption." } }); InputManager.Instance.AddButton("pl.jungle.flyingships", new ButtonConfig { Name = "FlyingShips_Ascend", Key = (KeyCode)280, HintToken = "$flyingships_ascend" }); InputManager.Instance.AddButton("pl.jungle.flyingships", new ButtonConfig { Name = "FlyingShips_Descend", Key = (KeyCode)281, HintToken = "$flyingships_descend" }); FlightStatusEffect.Register(); FlightCoreStatusEffect.Register(); PrefabManager.OnVanillaPrefabsAvailable += CreateFlyingShips; ItemManager.OnItemsRegistered += FixDropPrefabs; try { _harmony = new Harmony("pl.jungle.flyingships"); Harmony val = new Harmony("twoj.mod.id"); Type[] types = Assembly.GetExecutingAssembly().GetTypes(); foreach (Type type in types) { if (type.IsDefined(typeof(HarmonyPatch), inherit: false) || type.GetCustomAttributes(typeof(HarmonyPatch), inherit: true).Length != 0) { try { val.CreateClassProcessor(type).Patch(); } catch (Exception ex) { Logger.LogError((object)("Nie udało się załadować patcha " + type.Name + ", pomijam go: " + ex.Message)); } } } } catch (Exception arg) { Logger.LogError((object)$"Harmony patch failed, ale lodki nadal sprobuja sie dodac: {arg}"); } } private void CreateFlyingShips() { PrefabManager.OnVanillaPrefabsAvailable -= CreateFlyingShips; FlightFuelFactory.Create(); FlightCoreFactory.Create(); FlyingShipFactory.CreateAll(); } private void FixDropPrefabs() { RegisterItemInObjectDB("FlyingShipFuel"); RegisterItemInObjectDB("FlyingShipFuel_5x"); } private void RegisterItemInObjectDB(string prefabName) { GameObject prefab = PrefabManager.Instance.GetPrefab(prefabName); if ((Object)(object)prefab == (Object)null) { Logger.LogWarning((object)("RegisterItemInObjectDB: brak prefabu '" + prefabName + "'")); } else { ItemManager.Instance.RegisterItemInObjectDB(prefab); } } private void SetDropPrefab(string prefabName) { GameObject prefab = PrefabManager.Instance.GetPrefab(prefabName); if (!((Object)(object)prefab == (Object)null)) { ItemDrop component = prefab.GetComponent<ItemDrop>(); if (!((Object)(object)component == (Object)null)) { component.m_itemData.m_dropPrefab = prefab; } } } private void RegisterInObjectDB(string prefabName) { if ((Object)(object)ObjectDB.instance == (Object)null || (Object)(object)ObjectDB.instance.GetItemPrefab(prefabName) != (Object)null) { return; } GameObject prefab = PrefabManager.Instance.GetPrefab(prefabName); if (!((Object)(object)prefab == (Object)null)) { FieldInfo fieldInfo = AccessTools.Field(typeof(ObjectDB), "m_itemByPrefab"); if (!(fieldInfo == null) && fieldInfo.GetValue(ObjectDB.instance) is Dictionary<string, GameObject> dictionary) { dictionary[prefabName] = prefab; } } } private void OnDestroy() { PrefabManager.OnVanillaPrefabsAvailable -= CreateFlyingShips; ItemManager.OnItemsRegistered -= FixDropPrefabs; Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void Update() { _hudCheckTimer += Time.deltaTime; if (!(_hudCheckTimer < 1f)) { _hudCheckTimer = 0f; Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null) && (Object)(object)((Component)localPlayer).GetComponent<FuelHud>() == (Object)null) { ((Component)localPlayer).gameObject.AddComponent<FuelHud>(); } } } } } namespace FlyingShips.UI { public class FuelHud : MonoBehaviour { private const float UpdateInterval = 0.25f; private const int MaxFuel = 20; private float _timer; private GUIStyle _style; private int _fuelCount; private bool _visible; private Color _color = Color.white; private Texture2D _bgTexture; private Texture2D _fillTexture; private void Update() { _timer += Time.deltaTime; if (!(_timer < 0.25f)) { _timer = 0f; RefreshState(); } } private void RefreshState() { //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_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0119: 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) //IL_0171: 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_017d: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { _visible = false; return; } Ship controlledShip = localPlayer.GetControlledShip(); if ((Object)(object)controlledShip == (Object)null) { _visible = false; return; } FlightController component = ((Component)controlledShip).GetComponent<FlightController>(); if ((Object)(object)component == (Object)null || !component.IsFlying) { _visible = false; return; } int num = FlightFuel.CountFuel(FlightFuel.GetShipInventory(controlledShip)); int num2 = FlightFuel.CountFuel(((Humanoid)localPlayer).GetInventory()); _fuelCount = num + num2; _visible = true; if (_fuelCount <= 1) { _color = new Color(1f, 0.2f, 0.2f); } else if (_fuelCount <= 3) { _color = new Color(1f, 0.55f, 0.1f); } else if (_fuelCount <= 6) { _color = new Color(1f, 0.9f, 0.2f); } else { _color = new Color(0.9f, 0.95f, 1f); } if (_fuelCount <= 1) { float num3 = 0.6f + Mathf.PingPong(Time.time * 2f, 0.4f); _color *= num3; } } private Texture2D MakeTexture(Color color) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_000c: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(1, 1); val.SetPixel(0, 0, color); val.Apply(); return val; } private void EnsureTextures() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_bgTexture == (Object)null) { _bgTexture = MakeTexture(new Color(0f, 0f, 0f, 0.6f)); } if ((Object)(object)_fillTexture == (Object)null) { _fillTexture = MakeTexture(Color.white); } } private void OnGUI() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_00a2: 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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0165: 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_003c: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown if (_visible) { EnsureTextures(); if (_style == null) { _style = new GUIStyle(GUI.skin.label) { fontSize = 16, fontStyle = (FontStyle)1, alignment = (TextAnchor)3 }; } _style.normal.textColor = _color; float num = 65f; float num2 = 160f; GUI.DrawTexture(new Rect(num, num2, 200f, 18f), (Texture)(object)_bgTexture); Color color = GUI.color; GUI.color = _color; float num3 = Mathf.Clamp01((float)_fuelCount / 20f); float num4 = 200f * num3; GUI.DrawTexture(new Rect(num, num2, num4, 18f), (Texture)(object)_fillTexture); GUI.color = color; GUI.DrawTexture(new Rect(num, num2, 200f, 1f), (Texture)(object)_fillTexture); GUI.DrawTexture(new Rect(num, num2 + 18f - 1f, 200f, 1f), (Texture)(object)_fillTexture); GUI.DrawTexture(new Rect(num, num2, 1f, 18f), (Texture)(object)_fillTexture); GUI.DrawTexture(new Rect(num + 200f - 1f, num2, 1f, 18f), (Texture)(object)_fillTexture); } } } } namespace FlyingShips.Prefabs { public static class FlightCoreFactory { public const string CorePrefabI = "FlightCore_I"; public const string CorePrefabII = "FlightCore_II"; public const string CorePrefabIII = "FlightCore_III"; public static void Create() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)PrefabManager.Instance.GetPrefab("FlightCore_I") != (Object)null)) { CreateCore("FlightCore_I", "$item_flight_core_1", "$item_flight_core_1_desc", new Color(0.3f, 0.9f, 0.4f)); CreateCore("FlightCore_II", "$item_flight_core_2", "$item_flight_core_2_desc", new Color(0.3f, 0.6f, 1f)); CreateCore("FlightCore_III", "$item_flight_core_3", "$item_flight_core_3_desc", new Color(1f, 0.8f, 0.2f)); } } private static void CreateCore(string prefabName, string nameToken, string descToken, Color color) { //IL_0036: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Expected O, but got Unknown //IL_01be: 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) GameObject val = PrefabManager.Instance.CreateClonedPrefab(prefabName, "SurtlingCore"); if ((Object)(object)val == (Object)null) { Logger.LogError((object)("FlightCoreFactory: nie udało się sklonować " + prefabName)); return; } ItemConfig val2 = new ItemConfig { Name = nameToken, Description = descToken, Amount = 1, CraftingStation = "forge" }; switch (prefabName) { case "FlightCore_I": val2.AddRequirement("SurtlingCore", 5, 0); val2.AddRequirement("Bronze", 20, 0); val2.AddRequirement("Resin", 20, 0); break; case "FlightCore_II": val2.AddRequirement("FlightCore_I", 1, 0); val2.AddRequirement("Obsidian", 10, 0); val2.AddRequirement("DragonTear", 5, 0); break; case "FlightCore_III": val2.AddRequirement("FlightCore_II", 1, 0); val2.AddRequirement("BlackMetal", 20, 0); val2.AddRequirement("Crystal", 10, 0); break; } CustomItem val3 = new CustomItem(val, true, val2); ItemManager.Instance.AddItem(val3); ItemDrop component = val.GetComponent<ItemDrop>(); if ((Object)(object)component != (Object)null) { component.m_itemData.m_dropPrefab = val; component.m_itemData.m_shared.m_name = nameToken; component.m_itemData.m_shared.m_description = descToken; component.m_itemData.m_shared.m_icons = (Sprite[])(object)new Sprite[1] { CoreVisuals.CreateCoreIcon(color) }; component.m_itemData.m_shared.m_maxStackSize = 1; component.m_itemData.m_shared.m_weight = 2f; } FuelVisuals.Tint(val, color); } } public static class CoreVisuals { public static Sprite CreateCoreIcon(Color coreColor) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0013: 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_0029: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008f: 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_00a6: 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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: 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_0108: 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_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_014e: 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_015c: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: 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_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: 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_0195: 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) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0227: 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_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(64, 64, (TextureFormat)4, false); ((Object)val).name = $"FlightCoreIcon_{coreColor.r:F2}_{coreColor.g:F2}_{coreColor.b:F2}"; Color val2 = default(Color); ((Color)(ref val2))..ctor(0f, 0f, 0f, 0f); Color val3 = default(Color); ((Color)(ref val3))..ctor(0.05f, 0.05f, 0.08f, 1f); Color val4 = default(Color); ((Color)(ref val4))..ctor(coreColor.r * 0.25f, coreColor.g * 0.25f, coreColor.b * 0.25f, 1f); Color val5 = Color.Lerp(coreColor, Color.white, 0.7f); Color white = Color.white; Vector2 val6 = default(Vector2); ((Vector2)(ref val6))..ctor(32f, 32f); Vector2 val7 = default(Vector2); for (int i = 0; i < 64; i++) { for (int j = 0; j < 64; j++) { ((Vector2)(ref val7))..ctor((float)j + 0.5f, (float)i + 0.5f); float num = Vector2.Distance(val7, val6); Color val8 = val2; if (num <= 27f && num >= 24f) { val8 = val3; } else if (num < 24f) { float num2 = num / 24f; val8 = Color.Lerp(val4, val2, num2 * 0.6f); } else if (num > 27f && num < 30f) { float num3 = (num - 27f) / 3f; ((Color)(ref val8))..ctor(coreColor.r, coreColor.g, coreColor.b, (1f - num3) * 0.7f); } if (num < 13f) { float num4 = num / 13f; val8 = Color.Lerp(val5, coreColor, num4); } if (num < 4f) { val8 = white; } for (int k = 0; k < 4; k++) { float num5 = (float)k * 90f * ((float)Math.PI / 180f) + (float)Math.PI / 4f; Vector2 val9 = val6 + new Vector2(Mathf.Cos(num5), Mathf.Sin(num5)) * 20f; if (Vector2.Distance(val7, val9) < 2f) { val8 = white; } } for (int l = 0; l < 4; l++) { float num6 = (float)l * 90f * ((float)Math.PI / 180f); Vector2 val10 = val6 + new Vector2(Mathf.Cos(num6), Mathf.Sin(num6)) * 20f; if (Vector2.Distance(val7, val10) < 1.5f) { val8 = val5; } } val.SetPixel(j, i, val8); } } val.Apply(); return Sprite.Create(val, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f), 100f); } } public static class FlightFuelFactory { public static void Create() { if (!((Object)(object)PrefabManager.Instance.GetPrefab("FlyingShipFuel") != (Object)null)) { CreateWeakFuel(); CreateNormalFuel(); CreatePureFuel(); CreateBatchFuel(); } } private static void CreateWeakFuel() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //IL_011e: 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) GameObject val = PrefabManager.Instance.CreateClonedPrefab("FlyingShipFuel_Weak", "SurtlingCore"); if (!((Object)(object)val == (Object)null)) { ItemConfig val2 = new ItemConfig { Name = "$item_esencja_lotu_weak", Description = "$item_esencja_lotu_weak_desc", Amount = 1, CraftingStation = "forge" }; val2.AddRequirement("GreydwarfEye", 1, 0); val2.AddRequirement("Resin", 5, 0); CustomItem val3 = new CustomItem(val, true, val2); ItemManager.Instance.AddItem(val3); ItemDrop component = val.GetComponent<ItemDrop>(); if ((Object)(object)component != (Object)null) { component.m_itemData.m_dropPrefab = val; component.m_itemData.m_shared.m_name = "$item_esencja_lotu_weak"; component.m_itemData.m_shared.m_description = "$item_esencja_lotu_weak_desc"; component.m_itemData.m_shared.m_icons = (Sprite[])(object)new Sprite[1] { FuelVisuals.CreateIcon((Color?)new Color(0.4f, 0.8f, 0.5f)) }; } FuelVisuals.Tint(val, (Color?)new Color(0.4f, 0.8f, 0.5f)); } } private static void CreateNormalFuel() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown //IL_010f: 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) GameObject val = PrefabManager.Instance.CreateClonedPrefab("FlyingShipFuel", "SurtlingCore"); if (!((Object)(object)val == (Object)null)) { ItemConfig val2 = new ItemConfig { Name = "$item_esencja_lotu", Description = "$item_esencja_lotu_desc", Amount = 1, CraftingStation = "forge" }; val2.AddRequirement("GreydwarfEye", 1, 0); val2.AddRequirement("Bronze", 2, 0); val2.AddRequirement("Resin", 10, 0); CustomItem val3 = new CustomItem(val, true, val2); ItemManager.Instance.AddItem(val3); ItemDrop component = val.GetComponent<ItemDrop>(); if ((Object)(object)component != (Object)null) { component.m_itemData.m_dropPrefab = val; component.m_itemData.m_shared.m_name = "$item_esencja_lotu"; component.m_itemData.m_shared.m_description = "$item_esencja_lotu_desc"; component.m_itemData.m_shared.m_icons = (Sprite[])(object)new Sprite[1] { FuelVisuals.CreateIcon(FuelVisuals.FlightBlue) }; } FuelVisuals.Tint(val, FuelVisuals.FlightBlue); } } private static void CreatePureFuel() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) GameObject val = PrefabManager.Instance.CreateClonedPrefab("FlyingShipFuel_Pure", "SurtlingCore"); if (!((Object)(object)val == (Object)null)) { ItemConfig val2 = new ItemConfig { Name = "$item_esencja_lotu_pure", Description = "$item_esencja_lotu_pure_desc", Amount = 1, CraftingStation = "forge" }; val2.AddRequirement("GreydwarfEye", 5, 0); val2.AddRequirement("Bronze", 5, 0); val2.AddRequirement("Resin", 20, 0); val2.AddRequirement("Iron", 2, 0); CustomItem val3 = new CustomItem(val, true, val2); ItemManager.Instance.AddItem(val3); ItemDrop component = val.GetComponent<ItemDrop>(); if ((Object)(object)component != (Object)null) { component.m_itemData.m_dropPrefab = val; component.m_itemData.m_shared.m_name = "$item_esencja_lotu_pure"; component.m_itemData.m_shared.m_description = "$item_esencja_lotu_pure_desc"; component.m_itemData.m_shared.m_icons = (Sprite[])(object)new Sprite[1] { FuelVisuals.CreateIcon((Color?)new Color(0.7f, 0.4f, 1f)) }; } FuelVisuals.Tint(val, (Color?)new Color(0.7f, 0.4f, 1f)); } } private static void CreateSingleFuel() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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_0051: 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_0066: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown GameObject val = PrefabManager.Instance.CreateClonedPrefab("FlyingShipFuel", "SurtlingCore"); if ((Object)(object)val == (Object)null) { Logger.LogError((object)"Nie udało się sklonować prefabu SurtlingCore dla FlyingShipFuel."); return; } ItemConfig val2 = new ItemConfig { Name = "$item_esencja_lotu", Description = "$item_esencja_lotu_desc", Amount = 1, CraftingStation = "forge" }; val2.AddRequirement("GreydwarfEye", 1, 0); val2.AddRequirement("Bronze", 2, 0); val2.AddRequirement("Resin", 10, 0); CustomItem val3 = new CustomItem(val, true, val2); ItemManager.Instance.AddItem(val3); ItemDrop component = val.GetComponent<ItemDrop>(); if ((Object)(object)component != (Object)null) { component.m_itemData.m_dropPrefab = val; component.m_itemData.m_shared.m_name = "$item_esencja_lotu"; component.m_itemData.m_shared.m_description = "$item_esencja_lotu_desc"; component.m_itemData.m_shared.m_icons = (Sprite[])(object)new Sprite[1] { FuelVisuals.CreateIcon() }; } FuelVisuals.Tint(val); } private static void CreateBatchFuel() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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_0051: 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_0066: Expected O, but got Unknown //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown GameObject val = PrefabManager.Instance.CreateClonedPrefab("$item_esencja_lotu_5x", "SurtlingCore"); if ((Object)(object)val == (Object)null) { Logger.LogError((object)"Nie udało się sklonować prefabu SurtlingCore dla FlyingShipFuel_5x."); return; } ItemConfig val2 = new ItemConfig { Name = "$item_esencja_lotu_5x", Description = "$item_esencja_lotu_desc", Amount = 5, CraftingStation = "forge" }; val2.AddRequirement("GreydwarfEye", 5, 0); val2.AddRequirement("Bronze", 20, 0); val2.AddRequirement("Resin", 50, 0); CustomItem val3 = new CustomItem(val, true, val2); ItemManager.Instance.AddItem(val3); ItemDrop component = val.GetComponent<ItemDrop>(); if ((Object)(object)component != (Object)null) { component.m_itemData.m_dropPrefab = val; component.m_itemData.m_shared.m_name = "$item_esencja_lotu"; component.m_itemData.m_shared.m_description = "$item_esencja_lotu_desc"; component.m_itemData.m_shared.m_icons = (Sprite[])(object)new Sprite[1] { FuelVisuals.CreateIcon() }; } FuelVisuals.Tint(val); } } public static class FlightFuelPrefabSetup { public static void Setup() { GameObject prefab = PrefabManager.Instance.GetPrefab("FlyingShipFuel"); if ((Object)(object)prefab == (Object)null) { Logger.LogWarning((object)"FlightFuelPrefabSetup: brak prefabu FlyingShipFuel!"); return; } ItemDrop component = prefab.GetComponent<ItemDrop>(); if ((Object)(object)component == (Object)null) { Logger.LogWarning((object)"FlightFuelPrefabSetup: brak ItemDrop na FlyingShipFuel!"); } else { component.m_itemData.m_dropPrefab = prefab; } } } public static class FlyingShipFactory { private static readonly (string source, string newName, string displayName, int storageWidth, int storageHeight, int flightCoreCost, string type)[] ShipVariants = new(string, string, string, int, int, int, string)[3] { ("Raft", "FlyingRaft", "Latajaca Tratwa", 3, 2, 5, "FlyingShipFuel_Weak"), ("Karve", "FlyingKarve", "Latajaca Karave", 4, 3, 10, "FlyingShipFuel"), ("VikingShip", "FlyingVikingShip", "Latajacy Langskip", 6, 4, 15, "FlyingShipFuel_Pure") }; public static void CreateAll() { (string, string, string, int, int, int, string)[] shipVariants = ShipVariants; for (int i = 0; i < shipVariants.Length; i++) { (string, string, string, int, int, int, string) tuple = shipVariants[i]; try { Create(tuple.Item1, tuple.Item2, tuple.Item3, tuple.Item4, tuple.Item5, tuple.Item6, tuple.Item7); } catch (Exception arg) { Logger.LogError((object)$"Blad przy tworzeniu {tuple.Item2} z {tuple.Item1}: {arg}"); } } } private static void Create(string sourceName, string newName, string displayName, int storageWidth, int storageHeight, int flightCoreCost, string type) { //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: 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) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Expected O, but got Unknown //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Expected O, but got Unknown //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: 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_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Expected O, but got Unknown //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Expected O, but got Unknown GameObject prefab = PrefabManager.Instance.GetPrefab(sourceName); if ((Object)(object)prefab == (Object)null) { Logger.LogWarning((object)("Nie znaleziono prefaba: " + sourceName)); } else { if ((Object)(object)PrefabManager.Instance.GetPrefab(newName) != (Object)null) { return; } Piece component = prefab.GetComponent<Piece>(); if ((Object)(object)component == (Object)null) { Logger.LogWarning((object)(sourceName + ": brak komponentu Piece")); return; } GameObject val = PrefabManager.Instance.CreateClonedPrefab(newName, prefab); Piece component2 = val.GetComponent<Piece>(); component2.m_waterPiece = false; component2.m_groundOnly = false; component2.m_noInWater = false; component2.m_name = displayName; component2.m_description = (component.m_description ?? string.Empty) + $"\n<color=#8be9fd>$fs_ship_req {flightCoreCost} $item_esencja_lotu</color>" + "\n<color=#8be9fd>$fs_ship_controls</color>\n<color=#8be9fd>$fs_ship_storage</color>"; List<Requirement> list = new List<Requirement>(); Requirement[] resources = component.m_resources; foreach (Requirement val2 in resources) { if ((Object)(object)val2.m_resItem != (Object)null) { list.Add(new Requirement { m_resItem = val2.m_resItem, m_amount = val2.m_amount, m_recover = val2.m_recover }); } } GameObject prefab2 = PrefabManager.Instance.GetPrefab(type); if ((Object)(object)prefab2 == (Object)null) { Logger.LogWarning((object)(newName + ": nie znaleziono prefabu '" + type + "', brak wymagania Esencji Lotu.")); } else { ItemDrop component3 = prefab2.GetComponent<ItemDrop>(); if ((Object)(object)component3 == (Object)null) { Logger.LogWarning((object)(newName + ": '" + type + "' nie ma komponentu ItemDrop.")); } else { list.Add(new Requirement { m_resItem = component3, m_amount = flightCoreCost, m_recover = true }); } } component2.m_resources = list.ToArray(); PieceConfig val3 = new PieceConfig { Name = displayName, Description = component2.m_description, PieceTable = "_HammerPieceTable", Icon = component.m_icon }; CustomPiece val4 = new CustomPiece(val, false, val3); PieceManager.Instance.AddPiece(val4); FlightController flightController = val.GetComponent<FlightController>(); if ((Object)(object)flightController == (Object)null) { flightController = val.AddComponent<FlightController>(); } FlightController flightController2 = flightController; if (1 == 0) { } float fuelEfficiency = newName switch { "FlyingRaft" => 1f, "FlyingKarve" => 0.7f, "FlyingVikingShip" => 0.5f, _ => 1f, }; if (1 == 0) { } flightController2.FuelEfficiency = fuelEfficiency; FlightController flightController3 = flightController; if (1 == 0) { } fuelEfficiency = newName switch { "FlyingRaft" => 20f, "FlyingKarve" => 40f, "FlyingVikingShip" => 80f, _ => 250f, }; if (1 == 0) { } flightController3.BaseMaxHeight = fuelEfficiency; } } } public static class FuelVisuals { public static readonly Color FlightBlue = new Color(0.15f, 0.75f, 1f, 1f); public static readonly Color FlightBlueGlow = new Color(0.05f, 0.65f, 1f, 1f); public static void Tint(GameObject fuelPrefab, Color? tintColor = null) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Expected O, but got Unknown //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Expected O, but got Unknown //IL_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_03ba: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_0412: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) Color val = (Color)(((??)tintColor) ?? FlightBlue); Color val2 = (Color)(tintColor.HasValue ? new Color(tintColor.Value.r * 0.7f, tintColor.Value.g * 0.7f, tintColor.Value.b * 0.7f, 1f) : FlightBlueGlow); Transform val3 = fuelPrefab.transform.Find("FlyingShipFuelBlueVisual"); if ((Object)(object)val3 != (Object)null) { Object.DestroyImmediate((Object)(object)((Component)val3).gameObject); } Renderer[] componentsInChildren = fuelPrefab.GetComponentsInChildren<Renderer>(true); foreach (Renderer val4 in componentsInChildren) { val4.enabled = false; } Light[] componentsInChildren2 = fuelPrefab.GetComponentsInChildren<Light>(true); foreach (Light val5 in componentsInChildren2) { ((Behaviour)val5).enabled = false; } ParticleSystem[] componentsInChildren3 = fuelPrefab.GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem val6 in componentsInChildren3) { val6.Stop(true, (ParticleSystemStopBehavior)0); ((Component)val6).gameObject.SetActive(false); } TrailRenderer[] componentsInChildren4 = fuelPrefab.GetComponentsInChildren<TrailRenderer>(true); foreach (TrailRenderer val7 in componentsInChildren4) { ((Renderer)val7).enabled = false; } GameObject val8 = new GameObject("FlyingShipFuelBlueVisual"); val8.transform.SetParent(fuelPrefab.transform); val8.transform.localPosition = Vector3.zero; val8.transform.localRotation = Quaternion.identity; val8.transform.localScale = Vector3.one; GameObject val9 = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)val9).name = "BlueEssenceCube"; val9.transform.SetParent(val8.transform); val9.transform.localPosition = Vector3.zero; val9.transform.localRotation = Quaternion.Euler(18f, 35f, 12f); val9.transform.localScale = new Vector3(0.42f, 0.42f, 0.42f); Collider component = val9.GetComponent<Collider>(); if ((Object)(object)component != (Object)null) { Object.DestroyImmediate((Object)(object)component); } Renderer component2 = val9.GetComponent<Renderer>(); if ((Object)(object)component2 != (Object)null) { Material material = component2.material; SetMaterialColor(material, "_Color", val); SetMaterialColor(material, "_BaseColor", val); SetMaterialColor(material, "_EmissionColor", val2 * 4f); material.color = val; component2.material = material; } Light val10 = val8.AddComponent<Light>(); val10.type = (LightType)2; val10.color = val2; val10.range = 7f; val10.intensity = 3.5f; ParticleSystem val11 = val8.AddComponent<ParticleSystem>(); MainModule main = val11.main; ((MainModule)(ref main)).startColor = new MinMaxGradient(val2); ((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(0.8f); ((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0.25f); ((MainModule)(ref main)).startSize = MinMaxCurve.op_Implicit(0.18f); ((MainModule)(ref main)).maxParticles = 40; ((MainModule)(ref main)).loop = true; ((MainModule)(ref main)).playOnAwake = true; EmissionModule emission = val11.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(18f); ShapeModule shape = val11.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0; ((ShapeModule)(ref shape)).radius = 0.28f; ColorOverLifetimeModule colorOverLifetime = val11.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true; Gradient val12 = new Gradient(); val12.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(val2, 0f), new GradientColorKey(val, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[2] { new GradientAlphaKey(0.9f, 0f), new GradientAlphaKey(0f, 1f) }); ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(val12); } private static void SetMaterialColor(Material material, string propertyName, Color color) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) if (material.HasProperty(propertyName)) { if (propertyName == "_EmissionColor") { material.EnableKeyword("_EMISSION"); } material.SetColor(propertyName, color); } } public static Sprite CreateIcon(Color? tintColor = null) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown //IL_00a2: 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_00ba: 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_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_00de: 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_025f: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0115: 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_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: 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_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) Color val = (Color)(((??)tintColor) ?? FlightBlue); Color val2 = (Color)(tintColor.HasValue ? new Color(tintColor.Value.r * 0.7f, tintColor.Value.g * 0.7f, tintColor.Value.b * 0.7f, 1f) : FlightBlueGlow); Texture2D val3 = new Texture2D(64, 64, (TextureFormat)4, false); ((Object)val3).name = "FlyingShipFuelIcon"; Color val4 = default(Color); ((Color)(ref val4))..ctor(0f, 0f, 0f, 0f); Color val5 = default(Color); ((Color)(ref val5))..ctor(val.r * 0.2f, val.g * 0.35f, val.b * 0.6f, 1f); Color val6 = val; Color val7 = Color.Lerp(val, Color.white, 0.75f); Vector2 val8 = default(Vector2); ((Vector2)(ref val8))..ctor(31.5f, 31.5f); Vector2 val9 = default(Vector2); for (int i = 0; i < 64; i++) { for (int j = 0; j < 64; j++) { ((Vector2)(ref val9))..ctor((float)j, (float)i); float num = Mathf.Abs(val9.x - val8.x) + Mathf.Abs(val9.y - val8.y); float num2 = Vector2.Distance(val9, val8); if (num < 22f) { float num3 = Mathf.Clamp01(num / 22f); Color val10 = Color.Lerp(val6, val5, num3); if (j < 30 && i > 35 && num < 13f) { val10 = Color.Lerp(val10, val7, 0.65f); } val3.SetPixel(j, i, val10); } else if (num2 < 30f) { float num4 = Mathf.Clamp01((30f - num2) / 30f) * 0.35f; val3.SetPixel(j, i, new Color(val2.r, val2.g, val2.b, num4)); } else { val3.SetPixel(j, i, val4); } } } val3.Apply(); return Sprite.Create(val3, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f), 100f); } } public static class ShipStorageHelper { public static void Ensure(GameObject clone, string storageNameToken, int storageWidth, int storageHeight) { //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) Container[] componentsInChildren = clone.GetComponentsInChildren<Container>(true); Container[] array = componentsInChildren; foreach (Container val in array) { Object.DestroyImmediate((Object)(object)((Component)val).gameObject); } GameObject prefab = PrefabManager.Instance.GetPrefab("piece_chest_wood"); if ((Object)(object)prefab == (Object)null) { Logger.LogWarning((object)"ShipStorageHelper: nie znaleziono piece_chest_wood!"); return; } GameObject val2 = Object.Instantiate<GameObject>(prefab); ((Object)val2).name = "ShipStorage"; val2.transform.SetParent(clone.transform); val2.transform.localPosition = new Vector3(0f, 0f, 0f); val2.transform.localRotation = Quaternion.identity; val2.transform.localScale = Vector3.one; ZNetView component = val2.GetComponent<ZNetView>(); if ((Object)(object)component != (Object)null) { Object.DestroyImmediate((Object)(object)component); } Container component2 = val2.GetComponent<Container>(); if ((Object)(object)component2 != (Object)null) { component2.m_name = storageNameToken; component2.m_width = storageWidth; component2.m_height = storageHeight; component2.m_autoDestroyEmpty = false; } Piece component3 = val2.GetComponent<Piece>(); if ((Object)(object)component3 != (Object)null) { Object.DestroyImmediate((Object)(object)component3); } WearNTear component4 = val2.GetComponent<WearNTear>(); if ((Object)(object)component4 != (Object)null) { component4.m_health = 9999f; component4.m_noSupportWear = true; } } } } namespace FlyingShips.Patches { [HarmonyPatch(typeof(InventoryGui), "DoCrafting")] public static class CraftFuelDiagnosticPatch { private static void Postfix(Player player) { if (!((Object)(object)player == (Object)null)) { Inventory inventory = ((Humanoid)player).GetInventory(); ItemData val = ((IEnumerable<ItemData>)inventory.GetAllItems()).FirstOrDefault((Func<ItemData, bool>)((ItemData i) => i?.m_shared?.m_name == "$item_esencja_lotu")); if (val == null) { } } } } [HarmonyPatch(typeof(InventoryGui), "DoCrafting")] public static class CraftFuelRepairPatch { private static void Postfix(Player player) { if ((Object)(object)player == (Object)null) { return; } Inventory inventory = ((Humanoid)player).GetInventory(); IEnumerable<ItemData> enumerable = from i in inventory.GetAllItems() where i?.m_shared != null && IsAnyFuel(i) select i; foreach (ItemData item in enumerable) { if (!((Object)(object)item.m_dropPrefab == (Object)null)) { continue; } string prefabNameFor = GetPrefabNameFor(item); if (prefabNameFor != null) { GameObject prefab = PrefabManager.Instance.GetPrefab(prefabNameFor); if ((Object)(object)prefab != (Object)null) { item.m_dropPrefab = prefab; } } } } private static bool IsAnyFuel(ItemData item) { string name = item.m_shared.m_name; int result; switch (name) { default: result = ((name == "$item_flight_core_3") ? 1 : 0); break; case "$item_esencja_lotu_weak": case "$item_esencja_lotu": case "$item_esencja_lotu_pure": case "$item_esencja_lotu_5x": case "$item_flight_core_1": case "$item_flight_core_2": result = 1; break; } return (byte)result != 0; } private static string GetPrefabNameFor(ItemData item) { return item.m_shared.m_name switch { "$item_esencja_lotu_weak" => "FlyingShipFuel_Weak", "$item_esencja_lotu" => "FlyingShipFuel", "$item_esencja_lotu_pure" => "FlyingShipFuel_Pure", "$item_esencja_lotu_5x" => "FlyingShipFuel_5x", "$item_flight_core_1" => "FlightCore_I", "$item_flight_core_2" => "FlightCore_II", "$item_flight_core_3" => "FlightCore_III", _ => null, }; } } [HarmonyPatch(typeof(Inventory), "AddItem", new Type[] { typeof(ItemData) })] public static class CustomItemDropPrefabFixPatch { private static void Postfix(Inventory __instance, ItemData item, bool __result) { if (!__result || item == null || (Object)(object)item.m_dropPrefab != (Object)null) { return; } string prefabNameFor = GetPrefabNameFor(item); if (prefabNameFor != null) { GameObject prefab = PrefabManager.Instance.GetPrefab(prefabNameFor); if ((Object)(object)prefab != (Object)null) { item.m_dropPrefab = prefab; } } } private static string GetPrefabNameFor(ItemData item) { if (item.m_shared == null) { return null; } string name = item.m_shared.m_name; if (name == "$item_esencja_lotu_weak") { return "FlyingShipFuel_Weak"; } if (name == "$item_esencja_lotu") { return "FlyingShipFuel"; } if (name == "$item_esencja_lotu_pure") { return "FlyingShipFuel_Pure"; } if (name == "$item_esencja_lotu_5x") { return "FlyingShipFuel_5x"; } if (name == "$item_flight_core_1") { return "FlightCore_I"; } if (name == "$item_flight_core_2") { return "FlightCore_II"; } if (name == "$item_flight_core_3") { return "FlightCore_III"; } return name switch { "$item_esencja_lotu_weak" => "FlyingShipFuel_Weak", "$item_esencja_lotu" => "FlyingShipFuel", "$item_esencja_lotu_pure" => "FlyingShipFuel_Pure", "$item_esencja_lotu_5x" => "FlyingShipFuel_5x", "$item_flight_core_1" => "FlightCore_I", "$item_flight_core_2" => "FlightCore_II", "$item_flight_core_3" => "FlightCore_III", _ => null, }; } } [HarmonyPatch(typeof(ZNetScene), "Awake")] public static class FlightFuelDropPatch { } [HarmonyPatch(typeof(Inventory), "AddItem", new Type[] { typeof(ItemData) })] public static class FuelDropPrefabFixPatch { private static void Postfix(Inventory __instance, ItemData item, bool __result) { if (!__result || item == null || (Object)(object)item.m_dropPrefab != (Object)null) { return; } FuelTier tier = FlightFuel.GetTier(item); if (tier == FuelTier.None) { return; } if (1 == 0) { } string text = tier switch { FuelTier.Weak => "FlyingShipFuel_Weak", FuelTier.Normal => "FlyingShipFuel", FuelTier.Pure => "FlyingShipFuel_Pure", _ => null, }; if (1 == 0) { } string text2 = text; if (text2 != null) { GameObject prefab = PrefabManager.Instance.GetPrefab(text2); if ((Object)(object)prefab != (Object)null) { item.m_dropPrefab = prefab; } } } } [HarmonyPatch] public static class InventoryFuelRepairPatch { private static MethodBase TargetMethod() { return AccessTools.GetDeclaredMethods(typeof(Inventory)).FirstOrDefault((MethodInfo m) => m.Name == "Load" && m.GetParameters().Length == 1 && m.GetParameters()[0].ParameterType == typeof(ZPackage)); } private static void Postfix(Inventory __instance) { if (__instance == null) { return; } foreach (ItemData allItem in __instance.GetAllItems()) { if (allItem?.m_shared == null || (Object)(object)allItem.m_dropPrefab != (Object)null) { continue; } string prefabNameFor = GetPrefabNameFor(allItem); if (prefabNameFor != null) { GameObject prefab = PrefabManager.Instance.GetPrefab(prefabNameFor); if ((Object)(object)prefab != (Object)null) { allItem.m_dropPrefab = prefab; } } } } private static string GetPrefabNameFor(ItemData item) { return item.m_shared.m_name switch { "$item_esencja_lotu_weak" => "FlyingShipFuel_Weak", "$item_esencja_lotu" => "FlyingShipFuel", "$item_esencja_lotu_pure" => "FlyingShipFuel_Pure", "$item_esencja_lotu_5x" => "FlyingShipFuel_5x", "$item_flight_core_1" => "FlightCore_I", "$item_flight_core_2" => "FlightCore_II", "$item_flight_core_3" => "FlightCore_III", _ => null, }; } } [HarmonyPatch(typeof(Inventory), "Save")] public static class InventorySaveDiagnostic { private static void Prefix(Inventory __instance) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || __instance != ((Humanoid)localPlayer).GetInventory()) { return; } List<ItemData> allItems = __instance.GetAllItems(); foreach (ItemData item in allItems) { if (item != null) { string text = ((item.m_shared != null) ? item.m_shared.m_name : "?"); string text2 = (((Object)(object)item.m_dropPrefab != (Object)null) ? ((Object)item.m_dropPrefab).name : "NULL"); } } } } [HarmonyPatch(typeof(ItemDrop), "Awake")] public static class ItemDropAwakePatch { private static void Postfix(ItemDrop __instance) { if (__instance.m_itemData != null && (Object)(object)__instance.m_itemData.m_dropPrefab == (Object)null) { __instance.m_itemData.m_dropPrefab = ((Component)__instance).gameObject; } } } [HarmonyPatch(typeof(WearNTear), "Damage")] public static class LandingDamagePatch { private static bool Prefix(WearNTear __instance) { //IL_005b: 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_008a: Unknown result type (might be due to invalid IL or missing references) Ship component = ((Component)__instance).GetComponent<Ship>(); if ((Object)(object)component == (Object)null) { return true; } FlightController component2 = ((Component)component).GetComponent<FlightController>(); if ((Object)(object)component2 == (Object)null) { return true; } if (component2.ForcedDescent) { return false; } if (component2.IsFlying) { float num = ((Component)component).transform.position.y - 1000f; if ((Object)(object)ZoneSystem.instance != (Object)null) { num = ZoneSystem.instance.GetGroundHeight(((Component)component).transform.position); } float num2 = ((Component)component).transform.position.y - num; if (num2 < 5f && component2.CurrentVerticalSpeed < 0f) { return false; } } return true; } } [HarmonyPatch(typeof(ObjectDB), "Awake")] public static class ObjectDBAwakePatch { private static void Postfix(ObjectDB __instance) { if ((Object)(object)PrefabManager.Instance.GetPrefab("SurtlingCore") != (Object)null) { FlightFuelFactory.Create(); FlightCoreFactory.Create(); } ForceRegisterAndFix(__instance, "FlyingShipFuel"); ForceRegisterAndFix(__instance, "FlightCore_I"); ForceRegisterAndFix(__instance, "FlightCore_II"); ForceRegisterAndFix(__instance, "FlightCore_III"); } private static void ForceRegisterAndFix(ObjectDB db, string prefabName) { GameObject prefab = PrefabManager.Instance.GetPrefab(prefabName); if (!((Object)(object)prefab == (Object)null)) { if (!db.m_items.Contains(prefab)) { db.m_items.Add(prefab); } ItemDrop component = prefab.GetComponent<ItemDrop>(); if ((Object)(object)component != (Object)null && (Object)(object)component.m_itemData.m_dropPrefab == (Object)null) { component.m_itemData.m_dropPrefab = prefab; } } } } [HarmonyPatch(typeof(ObjectDB), "GetItemPrefab", new Type[] { typeof(string) })] public static class ObjectDBGetItemPrefabPatch { private static void Postfix(string name, ref GameObject __result) { if (!((Object)(object)__result != (Object)null)) { CustomItem item = ItemManager.Instance.GetItem(name); if (item != null && (Object)(object)item.ItemPrefab != (Object)null) { __result = item.ItemPrefab; } } } } [HarmonyPatch(typeof(Player), "OnSpawned")] public static class PlayerSpawnFuelRepairPatch { private static void Postfix(Player __instance) { ((MonoBehaviour)__instance).StartCoroutine(RepairAfterDelay(__instance)); } private static IEnumerator RepairAfterDelay(Player player) { yield return (object)new WaitForSeconds(2f); Inventory inv = ((Humanoid)player).GetInventory(); if (inv == null) { yield break; } foreach (ItemData item in inv.GetAllItems()) { if (item?.m_shared == null || (Object)(object)item.m_dropPrefab != (Object)null) { continue; } string prefabName = GetPrefabNameFor(item); if (prefabName != null) { GameObject prefab = PrefabManager.Instance.GetPrefab(prefabName); if ((Object)(object)prefab != (Object)null) { item.m_dropPrefab = prefab; } } } } private static string GetPrefabNameFor(ItemData item) { return item.m_shared.m_name switch { "$item_esencja_lotu_weak" => "FlyingShipFuel_Weak", "$item_esencja_lotu" => "FlyingShipFuel", "$item_esencja_lotu_pure" => "FlyingShipFuel_Pure", "$item_esencja_lotu_5x" => "FlyingShipFuel_5x", "$item_flight_core_1" => "FlightCore_I", "$item_flight_core_2" => "FlightCore_II", "$item_flight_core_3" => "FlightCore_III", _ => null, }; } } [HarmonyPatch(typeof(Ship), "UpdateSail")] public static class SailBlockPatch { private static readonly FieldRef<Ship, float> SailPositionRef = AccessTools.FieldRefAccess<Ship, float>("m_sailPosition"); private static void Postfix(Ship __instance, float dt) { FlightController component = ((Component)__instance).GetComponent<FlightController>(); if (!((Object)(object)component == (Object)null) && component.IsFlying) { SailPositionRef.Invoke(__instance) = 0f; } } } [HarmonyPatch] public static class ShipFlightPatch { private static MethodBase _targetMethod; private static readonly FieldInfo SemanField = AccessTools.Field(typeof(Character), "m_seman"); private static bool _childrenLogged = false; private static bool Prepare() { _targetMethod = AccessTools.Method(typeof(Ship), "CustomFixedUpdate", (Type[])null, (Type[])null) ?? AccessTools.Method(typeof(Ship), "FixedUpdate", (Type[])null, (Type[])null) ?? AccessTools.Method(typeof(Ship), "Update", (Type[])null, (Type[])null); if (_targetMethod == null) { Logger.LogWarning((object)"FlyingShips: nie znaleziono metody Ship do patchowania."); return false; } return true; } private static MethodBase TargetMethod() { return _targetMethod; } private static void Postfix(Ship __instance) { //IL_06fa: Unknown result type (might be due to invalid IL or missing references) //IL_073c: Unknown result type (might be due to invalid IL or missing references) //IL_0729: Unknown result type (might be due to invalid IL or missing references) //IL_0447: Unknown result type (might be due to invalid IL or missing references) //IL_044e: Expected O, but got Unknown //IL_0997: Unknown result type (might be due to invalid IL or missing references) //IL_09a4: Unknown result type (might be due to invalid IL or missing references) //IL_0956: Unknown result type (might be due to invalid IL or missing references) //IL_095b: Unknown result type (might be due to invalid IL or missing references) //IL_096c: Unknown result type (might be due to invalid IL or missing references) //IL_0d52: Unknown result type (might be due to invalid IL or missing references) //IL_0d7b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null) { return; } FlightController component = ((Component)__instance).GetComponent<FlightController>(); if ((Object)(object)component == (Object)null) { return; } Inventory shipInventory = FlightFuel.GetShipInventory(__instance); Player localPlayer = Player.m_localPlayer; Inventory playerInv = ((localPlayer != null) ? ((Humanoid)localPlayer).GetInventory() : null); FlightCoreTier tier = FlightCore.GetTier(shipInventory, playerInv); if (tier != component.CoreTier) { component.CoreTier = tier; component.CoreSpeedMultiplier = FlightCore.GetSpeedMultiplier(tier); component.CoreHeightBonus = FlightCore.GetHeightBonus(tier); component.CoreFuelMultiplier = FlightCore.GetFuelMultiplier(tier); if (tier != FlightCoreTier.None && (Object)(object)MessageHud.instance != (Object)null) { if (1 == 0) { } string text = tier switch { FlightCoreTier.TierI => "Rdzeń Lotu I aktywny", FlightCoreTier.TierII => "Rdzeń Lotu II aktywny", FlightCoreTier.TierIII => "Rdzeń Lotu III aktywny", _ => null, }; if (1 == 0) { } string text2 = text; if (text2 != null) { MessageHud.instance.ShowMessage((MessageType)1, text2, 0, (Sprite)null, false, true); } } } if (component.BaseMaxHeight <= 0f || component.BaseMaxHeight == 250f) { string text3 = ((Object)__instance).name.ToLower(); if (text3.Contains("raft")) { component.BaseMaxHeight = 20f; } else if (text3.Contains("karve")) { component.BaseMaxHeight = 40f; } else if (text3.Contains("vikingship") || text3.Contains("longship")) { component.BaseMaxHeight = 80f; } } ZNetView component2 = ((Component)__instance).GetComponent<ZNetView>(); if ((Object)(object)component2 != (Object)null && (!component2.IsValid() || component2.GetZDO() == null)) { return; } FlightEffects flightEffects = ((Component)__instance).GetComponent<FlightEffects>(); if ((Object)(object)flightEffects == (Object)null) { flightEffects = ((Component)__instance).gameObject.AddComponent<FlightEffects>(); } ZNetView component3 = ((Component)__instance).GetComponent<ZNetView>(); Player localPlayer2 = Player.m_localPlayer; if ((Object)(object)localPlayer2 != (Object)null && FlightStatusEffect.Effect != null) { object? obj = SemanField?.GetValue(localPlayer2); SEMan val = (SEMan)((obj is SEMan) ? obj : null); if (val != null) { if (component.IsFlying) { val.AddStatusEffect(FlightStatusEffect.Effect.StatusEffect.NameHash(), true, 1, 1f, (short)(-1)); if (FlightCoreStatusEffect.Effect != null && component.CoreTier != FlightCoreTier.None) { FlightCoreStatusEffect.UpdateForTier(component.CoreTier); val.AddStatusEffect(FlightCoreStatusEffect.Effect.StatusEffect.NameHash(), true, 1, 1f, (short)(-1)); } else { val.RemoveStatusEffect(FlightCoreStatusEffect.Effect.StatusEffect.NameHash(), false); } } else { val.RemoveStatusEffect(FlightStatusEffect.Effect.StatusEffect.NameHash(), false); val.RemoveStatusEffect(FlightCoreStatusEffect.Effect.StatusEffect.NameHash(), false); } } } Player localPlayer3 = Player.m_localPlayer; if ((Object)(object)localPlayer3 == (Object)null || (Object)(object)localPlayer3.GetControlledShip() != (Object)(object)__instance) { FlightZdo.SyncFlightFromZdo(component3, component); return; } ShipBob shipBob = ((Component)__instance).GetComponent<ShipBob>(); if ((Object)(object)shipBob == (Object)null) { shipBob = ((Component)__instance).gameObject.AddComponent<ShipBob>(); Transform val2 = null; string[] array = new string[10] { "ship", "Ship", "karve", "Karve", "raft", "Raft", "VikingShip", "viking_ship", "hull", "Hull" }; string[] array2 = array; foreach (string text4 in array2) { Transform val3 = ((Component)__instance).transform.Find(text4); if ((Object)(object)val3 != (Object)null) { val2 = val3; break; } } if ((Object)(object)val2 == (Object)null) { foreach (Transform item2 in ((Component)__instance).transform) { Transform val4 = item2; if ((Object)(object)((Component)val4).GetComponentInChildren<Renderer>() != (Object)null) { val2 = val4; break; } } } if ((Object)(object)val2 == (Object)(object)((Component)__instance).transform) { val2 = null; } shipBob.visualRoot = val2; if ((Object)(object)val2 == (Object)null) { Logger.LogWarning((object)"FlyingShips: nie znaleziono wizualnego roota statku, bujanie wylaczone."); } } Rigidbody val5 = ((Component)__instance).GetComponent<Rigidbody>() ?? ((Component)__instance).GetComponentInChildren<Rigidbody>(); if ((Object)(object)val5 == (Object)null) { return; } if (!component.HasShownControls && (Object)(object)MessageHud.instance != (Object)null) { component.HasShownControls = true; MessageHud.instance.ShowMessage((MessageType)2, "$fs_controls", 0, (Sprite)null, false, true); } if ((Object)(object)component3 != (Object)null && component3.IsValid() && component3.GetZDO() != null && !component3.IsOwner()) { try { component3.ClaimOwnership(); } catch (Exception ex) { Logger.LogDebug((object)("FlyingShips: ClaimOwnership pominięte: " + ex.Message)); } } bool flag = Input.GetKey((KeyCode)280) || (ZInput.instance != null && ZInput.GetButton("FlyingShips_Ascend")); bool flag2 = flag && !component.AscendWasDown; component.AscendWasDown = flag; bool flag3 = Input.GetKey((KeyCode)281) || (ZInput.instance != null && ZInput.GetButton("FlyingShips_Descend")); bool flag4 = Input.GetKey((KeyCode)119) || (ZInput.instance != null && ZInput.GetButton("Forward")); bool flag5 = Input.GetKey((KeyCode)115) || (ZInput.instance != null && ZInput.GetButton("Backward")); bool flag6 = Input.GetKey((KeyCode)97) || (ZInput.instance != null && ZInput.GetButton("Left")); bool flag7 = Input.GetKey((KeyCode)100) || (ZInput.instance != null && ZInput.GetButton("Right")); float num = 0f; if (flag) { num += 1f; } if (flag3) { num -= 1f; } float num2 = 0f; if (flag4) { num2 += 1f; } if (flag5) { num2 -= 1f; } float num3 = 0f; if (flag6) { num3 -= 1f; } if (flag7) { num3 += 1f; } float num4 = ((Component)__instance).transform.position.y - 1000f; if ((Object)(object)ZoneSystem.instance != (Object)null) { num4 = ZoneSystem.instance.GetGroundHeight(((Component)__instance).transform.position); } float num5 = ((Component)__instance).transform.position.y - num4; bool flag8 = num5 < 0.5f; if (!component.IsFlying) { val5.useGravity = true; FlightZdo.SetFlightState(component3, component, isFlying: false, 0f, engineOn: false); if (!flag2 || component.ForcedDescent) { return; } if (!FlightFuel.HasFuel(__instance, localPlayer3)) { MessageHud instance = MessageHud.instance; if (instance != null) { instance.ShowMessage((MessageType)2, "$fs_no_fuel", 0, (Sprite)null, false, true); } return; } flightEffects.PlayStartBurst(); component.IsFlying = true; component.FuelTimer = 0f; FuelTier nextConsumableTier = FlightFuel.GetNextConsumableTier(__instance, localPlayer3); component.FuelDuration = ((nextConsumableTier != FuelTier.None) ? FuelTiers.GetDuration(nextConsumableTier) : 60f); FlightZdo.SetFlightState(component3, component, isFlying: true, 0f, engineOn: true); component.CurrentForwardSpeed = 0f; component.CurrentVerticalSpeed = 0f; component.LastForwardSpeed = 0f; component.CurrentBank = 0f; component.CurrentPitch = 0f; component.ForcedDescent = false; component.HasWarnedLowFuel = false; MessageHud instance2 = MessageHud.instance; if (instance2 != null) { instance2.ShowMessage((MessageType)2, "$fs_flight_on", 0, (Sprite)null, false, true); } Inventory shipInventory2 = FlightFuel.GetShipInventory(__instance); bool flag9 = FlightFuel.InventoryHasFlightFuel(shipInventory2); bool flag10 = ((Humanoid)localPlayer3).GetInventory() != null && FlightFuel.InventoryHasFlightFuel(((Humanoid)localPlayer3).GetInventory()); if (!flag9) { if (flag10) { MessageHud instance3 = MessageHud.instance; if (instance3 != null) { instance3.ShowMessage((MessageType)2, "$fs_fuel_only_inventory", 0, (Sprite)null, false, true); } } else { MessageHud instance4 = MessageHud.instance; if (instance4 != null) { instance4.ShowMessage((MessageType)2, "$fs_no_backup_fuel", 0, (Sprite)null, false, true); } } } } if (component.IsFlying && flag3 && num5 < 5f) { float num6 = -1f; if (component.CurrentVerticalSpeed < num6) { component.CurrentVerticalSpeed = Mathf.MoveTowards(component.CurrentVerticalSpeed, num6, 6f * Time.fixedDeltaTime); Vector3 linearVelocity = val5.linearVelocity; linearVelocity.y = component.CurrentVerticalSpeed; val5.linearVelocity = linearVelocity; } } if (component.IsFlying && flag3 && flag8) { val5.useGravity = true; val5.linearVelocity = Vector3.zero; val5.angularVelocity = Vector3.zero; component.CurrentForwardSpeed = 0f; component.CurrentVerticalSpeed = 0f; component.LastForwardSpeed = 0f; component.CurrentBank = 0f; component.CurrentPitch = 0f; FlightZdo.SetFlightState(component3, component, isFlying: false, 0f, engineOn: false); MessageHud instance5 = MessageHud.instance; if (instance5 != null) { instance5.ShowMessage((MessageType)2, "$fs_flight_off", 0, (Sprite)null, false, true); } return; } if (component.IsFlying) { component.FuelTimer += Time.fixedDeltaTime; float num7 = ((component.FuelDuration > 0f) ? component.FuelDuration : 60f); float num8 = ((component.FuelEfficiency > 0f) ? component.FuelEfficiency : 1f); float num9 = num7 * num8 * component.CoreFuelMultiplier / Mathf.Max(0.1f, FlightConfig.FuelPerMinute.Value); if (component.FuelTimer >= num9) { Logger.LogInfo((object)($"[FUEL-TIMING] Spalono esencję po {num9:F1} s. " + $"Tier={component.FuelDuration}, Efficiency={component.FuelEfficiency}, " + $"FuelPerMinute={FlightConfig.FuelPerMinute.Value}")); flightEffects.PlayFuelSpark(); component.FuelTimer = 0f; FlightZdo.SetFuelTimer(component3, component, 0f); (bool, FuelTier) tuple = FlightFuel.ConsumeFuelTiered(__instance, localPlayer3); if (tuple.Item1) { Inventory shipInventory3 = FlightFuel.GetShipInventory(__instance); if (!FlightFuel.InventoryHasFlightFuel(shipInventory3) && (((Humanoid)localPlayer3).GetInventory() == null || !FlightFuel.InventoryHasFlightFuel(((Humanoid)localPlayer3).GetInventory()))) { component.HasWarnedLowFuel = true; component.ForcedDescent = true; MessageHud instance6 = MessageHud.instance; if (instance6 != null) { instance6.ShowMessage((MessageType)2, "$fs_last_fuel", 0, (Sprite)null, false, true); } MessageHud instance7 = MessageHud.instance; if (instance7 != null) { instance7.ShowMessage((MessageType)2, "$fs_fuel_out", 0, (Sprite)null, false, true); } FlightZdo.SetEngineOn(component3, component, engineOn: false); } else { component.FuelDuration = FuelTiers.GetDuration(tuple.Item2); FuelTier item = tuple.Item2; if (1 == 0) { } string text = item switch { FuelTier.Weak => "$fs_fuel_burned_weak", FuelTier.Normal => "$fs_fuel_burned", FuelTier.Pure => "$fs_fuel_burned_pure", _ => "$fs_fuel_burned", }; if (1 == 0) { } string text5 = text; MessageHud instance8 = MessageHud.instance; if (instance8 != null) { instance8.ShowMessage((MessageType)1, text5, 0, (Sprite)null, false, true); } FlightZdo.SetEngineOn(component3, component, engineOn: true); } } else if (!component.ForcedDescent) { component.ForcedDescent = true; MessageHud instance9 = MessageHud.instance; if (instance9 != null) { instance9.ShowMessage((MessageType)2, "$fs_fuel_out", 0, (Sprite)null, false, true); } FlightZdo.SetEngineOn(component3, component, engineOn: false); } } } FlightZdo.SetFuelTimer(component3, component, component.FuelTimer); val5.useGravity = false; val5.isKinematic = false; FlightInput input = new FlightInput { Vertical = num, Move = num2, Turn = num3, GroundHeight = num4, HeightAboveGround = num5 }; FlightPhysics.Apply(__instance, val5, component, input, component3); if ((Object)(object)shipBob != (Object)null) { bool flag11 = Mathf.Abs(num2) < 0.01f && Mathf.Abs(num3) < 0.01f && Mathf.Abs(num) < 0.01f; shipBob.shouldBob = component.IsFlying && flag11; float num10 = ((Component)__instance).transform.position.y - (((Object)(object)ZoneSystem.instance != (Object)null) ? ZoneSystem.instance.GetGroundHeight(((Component)__instance).transform.position) : 0f); shipBob.ampPos = Mathf.Lerp(0.08f, 0.25f, Mathf.InverseLerp(20f, 100f, num10)); } Transform val6 = ((Component)__instance).transform.Find("ControlGui"); if ((Object)(object)val6 != (Object)null) { ((Component)val6).gameObject.SetActive(!component.IsFlying); } float speedRatio = Mathf.Clamp01(Mathf.Abs(component.CurrentForwardSpeed) / FlightConfig.ForwardSpeed.Value); flightEffects.SetTrailActive(component.IsFlying, speedRatio); val5.WakeUp(); } } } namespace FlyingShips.Flight { public enum FlightCoreTier { None, TierI, TierII, TierIII } public static class FlightCore { public const string CoreNameI = "$item_flight_core_1"; public const string CoreNameII = "$item_flight_core_2"; public const string CoreNameIII = "$item_flight_core_3"; public static FlightCoreTier GetTier(Inventory shipInv, Inventory playerInv = null) { FlightCoreTier flightCoreTier = FlightCoreTier.None; if (shipInv != null) { flightCoreTier = GetHighestTierIn(shipInv); } if (playerInv != null) { FlightCoreTier highestTierIn = GetHighestTierIn(playerInv); if (highestTierIn > flightCoreTier) { flightCoreTier = highestTierIn; } } return flightCoreTier; } private static FlightCoreTier GetHighestTierIn(Inventory inv) { FlightCoreTier flightCoreTier = FlightCoreTier.None; foreach (ItemData allItem in inv.GetAllItems()) { if (allItem?.m_shared != null) { string name = allItem.m_shared.m_name; if (name == "$item_flight_core_3") { return FlightCoreTier.TierIII; } if (name == "$item_flight_core_2" && flightCoreTier < FlightCoreTier.TierII) { flightCoreTier = FlightCoreTier.TierII; } if (name == "$item_flight_core_1" && flightCoreTier < FlightCoreTier.TierI) { flightCoreTier = FlightCoreTier.TierI; } } } return flightCoreTier; } public static float GetSpeedMultiplier(FlightCoreTier t) { if (1 == 0) { } float result = t switch { FlightCoreTier.TierI => 1.15f, FlightCoreTier.TierII => 1.3f, FlightCoreTier.TierIII => 1.5f, _ => 1f, }; if (1 == 0) { } return result; } public static float GetHeightBonus(FlightCoreTier t) { if (1 == 0) { } float result = t switch { FlightCoreTier.TierI => 25f, FlightCoreTier.TierII => 50f, FlightCoreTier.TierIII => 100f, _ => 0f, }; if (1 == 0) { } return result; } public static float GetFuelMultiplier(FlightCoreTier t) { if (1 == 0) { } float result = t switch { FlightCoreTier.TierI => 0.9f, FlightCoreTier.TierII => 0.8f, FlightCoreTier.TierIII => 0.65f, _ => 1f, }; if (1 == 0) { } return result; } } public static class FlightCoreStatusEffect { public const string EffectName = "FlyingShipCore"; private static FlightCoreTier _lastTier; public static CustomStatusEffect Effect { get; private set; } public static void Register() { //IL_0039: 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_0051: 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) //IL_0062: Expected O, but got Unknown StatusEffect val = ScriptableObject.CreateInstance<StatusEffect>(); ((Object)val).name = "FlyingShipCore"; val.m_ttl = 0f; val.m_name = "Rdzeń Lotu"; val.m_icon = CoreVisuals.CreateCoreIcon(new Color(0.3f, 0.9f, 0.4f)); val.m_startMessageType = (MessageType)1; val.m_stopMessageType = (MessageType)1; Effect = new CustomStatusEffect(val, false); ItemManager.Instance.AddStatusEffect(Effect); } public static void UpdateForTier(FlightCoreTier tier) { //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_0079: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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_0109: Unknown result type (might be due to invalid IL or missing references) CustomStatusEffect effect = Effect; if (!((Object)(object)((effect != null) ? effect.StatusEffect : null) == (Object)null) && _lastTier != tier) { _lastTier = tier; if (1 == 0) { } Color val = (Color)(tier switch { FlightCoreTier.TierI => new Color(0.3f, 0.9f, 0.4f), FlightCoreTier.TierII => new Color(0.3f, 0.6f, 1f), FlightCoreTier.TierIII => new Color(1f, 0.8f, 0.2f), _ => Color.white, }); if (1 == 0) { } Color coreColor = val; if (1 == 0) { } string text = tier switch { FlightCoreTier.TierI => "Rdzeń Lotu I", FlightCoreTier.TierII => "Rdzeń Lotu II", FlightCoreTier.TierIII => "Rdzeń Lotu III", _ => "Rdzeń Lotu", }; if (1 == 0) { } string name = text; Effect.StatusEffect.m_name = name; Effect.StatusEffect.m_icon = CoreVisuals.CreateCoreIcon(coreColor); } } } public static class FlightFuel { public static bool ConsumeFuel(Ship ship, Player player) { Inventory shipInventory = GetShipInventory(ship); if (TryConsumeOneFuelFromInventory(shipInventory)) { return true; } Inventory sourceInventory = (((Object)(object)player != (Object)null) ? ((Humanoid)player).GetInventory() : null); if (TryConsumeOneFuelFromInventory(sourceInventory)) { return true; } return false; } public static bool HasFuel(Ship ship, Player player) { Inventory shipInventory = GetShipInventory(ship); if (InventoryHasFlightFuel(shipInventory)) { return true; } Inventory sourceInventory = (((Object)(object)player != (Object)null) ? ((Humanoid)player).GetInventory() : null); return InventoryHasFlightFuel(sourceInventory); } public static int CountFuel(Inventory inv) { if (inv == null) { return 0; } int num = 0; foreach (ItemData allItem in inv.GetAllItems()) { if (IsFlightFuel(allItem)) { num += allItem.m_stack; } } return num; } public static int CountFuelByTier(Inventory inv, FuelTier tier) { if (inv == null) { return 0; } int num = 0; foreach (ItemData allItem in inv.GetAllItems()) { if (GetTier(allItem) == tier) { num += allItem.m_stack; } } return num; } public static (bool success, FuelTier tier) ConsumeFuelTiered(Ship ship, Player player) { Inventory shipInventory = GetShipInventory(ship); (bool, FuelTier) result = TryConsumeByPriority(shipInventory); if (result.Item1) { return result; } Inventory inv = (((Object)(object)player != (Object)null) ? ((Humanoid)player).GetInventory() : null); return TryConsumeByPriority(inv); } private static (bool success, FuelTier tier) TryConsumeByPriority(Inventory inv) { if (inv == null) { return (success: false, tier: FuelTier.None); } FuelTier[] consumptionPriority = FuelTiers.ConsumptionPriority; foreach (FuelTier fuelTier in consumptionPriority) { foreach (ItemData item in inv.GetAllItems().ToList()) { if (GetTier(item) != fuelTier) { continue; } inv.RemoveItem(item, 1); return (success: true, tier: fuelTier); } } return (success: false, tier: FuelTier.None); } public static bool InventoryHasFlightFuel(Inventory sourceInventory) { if (sourceInventory == null) { return false; } return sourceInventory.GetAllItems().Any(IsFlightFuel); } private static bool TryConsumeOneFuelFromInventory(Inventory sourceInventory) { if (sourceInventory == null) { return false; } foreach (ItemData item in sourceInventory.GetAllItems().ToList()) { if (!IsFlightFuel(item)) { continue; } sourceInventory.RemoveItem(item, 1); return true; } return false; } public static bool IsFlightFuel(ItemData item) { return GetTier(item) != FuelTier.None; } public static Inventory GetShipInventory(Ship ship) { if ((Object)(object)ship == (Object)null) { return null; } Container val = ((Component)ship).GetComponent<Container>() ?? ((Component)ship).GetComponentInChildren<Container>(); return (val != null) ? val.GetInventory() : null; } public static FuelTier GetTier(ItemData item) { if (item?.m_shared == null) { return FuelTier.None; } switch (item.m_shared.m_name) { case "$item_esencja_lotu_weak": return FuelTier.Weak; case "$item_esencja_lotu": return FuelTier.Normal; case "$item_esencja_lotu_pure": return FuelTier.Pure; default: if ((Object)(object)item.m_dropPrefab != (Object)null) { switch (((Object)item.m_dropPrefab).name) { case "FlyingShipFuel_Weak": return FuelTier.Weak; case "FlyingShipFuel": return FuelTier.Normal; case "FlyingShipFuel_Pure": return FuelTier.Pure; } } return FuelTier.None; } } public static FuelTier GetNextConsumableTier(Ship ship, Player player) { Inventory shipInventory = GetShipInventory(ship); FuelTier fuelTier = FindHighestPriorityTier(shipInventory); if (fuelTier != FuelTier.None) { return fuelTier; } Inventory inv = (((Object)(object)player != (Object)null) ? ((Humanoid)player).GetInventory() : null); return FindHighestPriorityTier(inv); } private static FuelTier FindHighestPriorityTier(Inventory inv) { if (inv == null) { return FuelTier.None; } FuelTier[] consumptionPriority = FuelTiers.ConsumptionPriority; foreach (FuelTier fuelTier in consumptionPriority) { foreach (ItemData allItem in inv.GetAllItems()) { if (GetTier(allItem) == fuelTier) { return fuelTier; } } } return FuelTier.None; } } public struct FlightInput { public float Vertical; public float Move; public float Turn; public float GroundHeight; public float HeightAboveGround; } public static class FlightPhysics { public static void Apply(Ship ship, Rigidbody body, FlightController flight, FlightInput input, ZNetView znv) { //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_0406: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_041b: Unknown result type (might be due to invalid IL or missing references) //IL_0420: Unknown result type (might be due to invalid IL or missing references) //IL_042e: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Unknown result type (might be due to invalid IL or missing references) //IL_0441: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) float fixedDeltaTime = Time.fixedDeltaTime; float num = input.Vertical; float move = input.Move; float num2 = input.Turn; float heightAboveGround = input.HeightAboveGround; if (flight.ForcedDescent) { num = -1f; num2 *= 0.6f; if (heightAboveGround < 3f) { body.useGravity = true; flight.ForcedDescent = false; flight.CurrentForwardSpeed = 0f; flight.CurrentVerticalSpeed = 0f; flight.LastForwardSpeed = 0f; flight.CurrentBank = 0f; flight.CurrentPitch = 0f; FlightZdo.SetFlightState(znv, flight, isFlying: false, 0f, engineOn: false); MessageHud instance = MessageHud.instance; if (instance != null) { instance.ShowMessage((MessageType)2, "$fs_emergency_landed", 0, (Sprite)null, false, true); } return; } flight.CurrentVerticalSpeed = Mathf.MoveTowards(flight.CurrentVerticalSpeed, 0f - FlightConfig.EmergencyDescentSpeed.Value, FlightConfig.AccelVertical.Value * fixedDeltaTime); flight.CurrentForwardSpeed = Mathf.MoveTowards(flight.CurrentForwardSpeed, 0f, FlightConfig.DecelForward.Value * fixedDeltaTime); } float num3 = move * FlightConfig.ForwardSpeed.Value * flight.CoreSpeedMultiplier; if (Mathf.Abs(num3) > 0.01f) { flight.CurrentForwardSpeed = Mathf.MoveTowards(flight.CurrentForwardSpeed, num3, FlightConfig.AccelForward.Value * fixedDeltaTime); } else { flight.CurrentForwardSpeed = Mathf.MoveTowards(flight.CurrentForwardSpeed, 0f, FlightConfig.DecelForward.Value * fixedDeltaTime); } if (!flight.ForcedDescent) { if (num != 0f) { float num4 = num * FlightConfig.VerticalSpeed.Value; flight.CurrentVerticalSpeed = Mathf.MoveTowards(flight.CurrentVerticalSpeed, num4, FlightConfig.AccelVertical.Value * fixedDeltaTime); } else { flight.CurrentVerticalSpeed = Mathf.MoveTowards(flight.CurrentVerticalSpeed, 0f, FlightConfig.DecelVertical.Value * fixedDeltaTime); } } float num5 = ((Component)ship).transform.position.y - input.GroundHeight; float num6 = flight.BaseMaxHeight + flight.CoreHeightBonus; if (num5 >= num6) { float num7 = num5 - num6; if (flight.CurrentVerticalSpeed > 0f) { flight.CurrentVerticalSpeed = 0f; } if (num7 > 0.5f) { flight.CurrentVerticalSpeed = Mathf.Min