Exemplo n.º 1
0
        public static PLPolytechModule CreatePolytechModule(int Subtype, int level)
        {
            PLPolytechModule InPolytechModule;

            if (Subtype >= Instance.VanillaPolytechModuleMaxType)
            {
                InPolytechModule = new PLPolytechModule(EPolytechModuleType.E_MAX, level);
                int subtypeformodded = Subtype - Instance.VanillaPolytechModuleMaxType;
                if (subtypeformodded <= Instance.PolytechModuleTypes.Count && subtypeformodded > -1)
                {
                    PolytechModuleMod PolytechModuleType = Instance.PolytechModuleTypes[Subtype - Instance.VanillaPolytechModuleMaxType];
                    InPolytechModule.SubType                       = Subtype;
                    InPolytechModule.Name                          = PolytechModuleType.Name;
                    InPolytechModule.Desc                          = PolytechModuleType.Description;
                    InPolytechModule.m_IconTexture                 = PolytechModuleType.IconTexture;
                    InPolytechModule.m_MarketPrice                 = PolytechModuleType.MarketPrice;
                    InPolytechModule.CargoVisualPrefabID           = PolytechModuleType.CargoVisualID;
                    InPolytechModule.CanBeDroppedOnShipDeath       = PolytechModuleType.CanBeDroppedOnShipDeath;
                    InPolytechModule.Experimental                  = PolytechModuleType.Experimental;
                    InPolytechModule.Unstable                      = PolytechModuleType.Unstable;
                    InPolytechModule.Contraband                    = PolytechModuleType.Contraband;
                    InPolytechModule.Price_LevelMultiplierExponent = PolytechModuleType.Price_LevelMultiplierExponent;
                    InPolytechModule.m_MaxPowerUsage_Watts         = PolytechModuleType.MaxPowerUsage_Watts;
                }
            }
            else
            {
                InPolytechModule = new PLPolytechModule((EPolytechModuleType)Subtype, level);
            }
            return(InPolytechModule);
        }
Exemplo n.º 2
0
        static void Postfix(PLPolytechModule __instance)
        {
            int subtypeformodded = __instance.SubType - PolytechModuleModManager.Instance.VanillaPolytechModuleMaxType;

            if (subtypeformodded > -1 && subtypeformodded < PolytechModuleModManager.Instance.PolytechModuleTypes.Count && __instance.ShipStats != null)
            {
                PolytechModuleModManager.Instance.PolytechModuleTypes[subtypeformodded].FinalLateAddStats(__instance);
            }
        }
        static void Postfix(PLPolytechModule __instance)
        {
            int subtypeformodded = __instance.SubType - PolytechModulePluginManager.Instance.VanillaPolytechModuleMaxType;

            if (subtypeformodded > -1 && subtypeformodded < PolytechModulePluginManager.Instance.PolytechModuleTypes.Count && __instance.ShipStats != null && __instance.IsEquipped)
            {
                PolytechModulePluginManager.Instance.PolytechModuleTypes[subtypeformodded].Tick(__instance);
            }
        }
        public static PLPolytechModule CreatePolytechModule(int Subtype, int level)
        {
            PLPolytechModule InPolytechModule;

            if (Subtype >= Instance.VanillaPolytechModuleMaxType)
            {
                InPolytechModule = new PLPolytechModule(EPolytechModuleType.E_MAX, level);
                int subtypeformodded = Subtype - Instance.VanillaPolytechModuleMaxType;
                if (Global.DebugLogging)
                {
                    Logger.Info($"Subtype for modded is {subtypeformodded}");
                }
                if (subtypeformodded <= Instance.PolytechModuleTypes.Count && subtypeformodded > -1)
                {
                    if (Global.DebugLogging)
                    {
                        Logger.Info("Creating PolytechModule from list info");
                    }
                    PolytechModulePlugin PolytechModuleType = Instance.PolytechModuleTypes[Subtype - Instance.VanillaPolytechModuleMaxType];
                    InPolytechModule.SubType = Subtype;
                    InPolytechModule.Name    = PolytechModuleType.Name;
                    InPolytechModule.Desc    = PolytechModuleType.Description;
                    InPolytechModule.GetType().GetField("m_IconTexture", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(InPolytechModule, PolytechModuleType.IconTexture);
                    InPolytechModule.GetType().GetField("m_MarketPrice", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(InPolytechModule, (ObscuredInt)PolytechModuleType.MarketPrice);
                    InPolytechModule.CargoVisualPrefabID     = PolytechModuleType.CargoVisualID;
                    InPolytechModule.CanBeDroppedOnShipDeath = PolytechModuleType.CanBeDroppedOnShipDeath;
                    InPolytechModule.Experimental            = PolytechModuleType.Experimental;
                    InPolytechModule.Unstable   = PolytechModuleType.Unstable;
                    InPolytechModule.Contraband = PolytechModuleType.Contraband;
                    InPolytechModule.GetType().GetField("Price_LevelMultiplierExponent", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(InPolytechModule, (ObscuredFloat)PolytechModuleType.Price_LevelMultiplierExponent);
                }
            }
            else
            {
                InPolytechModule = new PLPolytechModule((EPolytechModuleType)Subtype, level);
            }
            return(InPolytechModule);
        }