static void Postfix(PLWarpDriveProgram __instance, PLShipStats inStats)//The devs were sill and added every number nececary but forgot to actually change the shield numbers { if (Time.time - (float)__instance.GetType().GetField("SuperShieldBooster_LastActivationTime", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance) < (float)__instance.GetType().GetField("SuperShieldBooster_ActiveTime", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance)) { //PulsarPluginLoader.Utilities.Logger.Info("Working"); float DontReflectOnItTooMuch = (float)__instance.GetType().GetField("SuperShieldBooster_BoostAmount", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance); inStats.ShieldsChargeRate += DontReflectOnItTooMuch; inStats.ShieldsChargeRateMax += DontReflectOnItTooMuch; } }
public static PLWarpDriveProgram CreateWarpDriveProgram(int Subtype, int level) { PLWarpDriveProgram InWarpDriveProgram; if (Subtype >= Instance.VanillaWarpDriveProgramMaxType) { InWarpDriveProgram = new PLWarpDriveProgram(EWarpDriveProgramType.SHIELD_BOOSTER, level); int subtypeformodded = Subtype - Instance.VanillaWarpDriveProgramMaxType; if (Global.DebugLogging) { Logger.Info($"Subtype for modded is {subtypeformodded}"); } if (subtypeformodded <= Instance.WarpDriveProgramTypes.Count && subtypeformodded > -1) { if (Global.DebugLogging) { Logger.Info("Creating WarpDriveProgram from list info"); } WarpDriveProgramPlugin WarpDriveProgramType = Instance.WarpDriveProgramTypes[Subtype - Instance.VanillaWarpDriveProgramMaxType]; InWarpDriveProgram.SubType = Subtype; InWarpDriveProgram.Name = WarpDriveProgramType.Name; InWarpDriveProgram.Desc = WarpDriveProgramType.Description; InWarpDriveProgram.MaxLevelCharges = WarpDriveProgramType.MaxLevelCharges; InWarpDriveProgram.GetType().GetField("m_IconTexture", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(InWarpDriveProgram, WarpDriveProgramType.IconTexture); InWarpDriveProgram.ShortName = WarpDriveProgramType.ShortName; InWarpDriveProgram.GetType().GetField("ShieldBooster_BoostAmount", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(InWarpDriveProgram, 0f); InWarpDriveProgram.GetType().GetField("m_MarketPrice", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(InWarpDriveProgram, (ObscuredInt)WarpDriveProgramType.MarketPrice); InWarpDriveProgram.CargoVisualPrefabID = WarpDriveProgramType.CargoVisualID; InWarpDriveProgram.CanBeDroppedOnShipDeath = WarpDriveProgramType.CanBeDroppedOnShipDeath; InWarpDriveProgram.Experimental = WarpDriveProgramType.Experimental; InWarpDriveProgram.Unstable = WarpDriveProgramType.Unstable; InWarpDriveProgram.Contraband = WarpDriveProgramType.Contraband; InWarpDriveProgram.GetType().GetField("Price_LevelMultiplierExponent", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(InWarpDriveProgram, (ObscuredFloat)WarpDriveProgramType.Price_LevelMultiplierExponent); if (PhotonNetwork.isMasterClient) { InWarpDriveProgram.Level = InWarpDriveProgram.MaxLevelCharges; } } } else { InWarpDriveProgram = new PLWarpDriveProgram((EWarpDriveProgramType)Subtype, level); } return(InWarpDriveProgram); }
static void Postfix(PLWarpDriveProgram __instance, ref float __result) { int subtypeformodded = __instance.SubType - WarpDriveProgramPluginManager.Instance.VanillaWarpDriveProgramMaxType; if (subtypeformodded > -1 && subtypeformodded < WarpDriveProgramPluginManager.Instance.WarpDriveProgramTypes.Count) { __result = Mathf.Clamp01((Time.time - (float)__instance.GetType().GetField("ShieldBooster_LastActivationTime", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance)) / WarpDriveProgramPluginManager.Instance.WarpDriveProgramTypes[subtypeformodded].ActiveTime); } }
static void Prefix(PLWarpDriveProgram __instance) { int subtypeformodded = __instance.SubType - WarpDriveProgramPluginManager.Instance.VanillaWarpDriveProgramMaxType; if (subtypeformodded > -1 && subtypeformodded < WarpDriveProgramPluginManager.Instance.WarpDriveProgramTypes.Count) { if (WarpDriveProgramPluginManager.Instance.WarpDriveProgramTypes[subtypeformodded].IsVirus) { PLServer.Instance.photonView.RPC("AddToSendQueue", PhotonTargets.All, new object[] { __instance.ShipStats.Ship.ShipID, __instance.ShipStats.Ship.VirusSendQueueCounter + 1, WarpDriveProgramPluginManager.Instance.WarpDriveProgramTypes[subtypeformodded].VirusSubtype, PLServer.Instance.GetEstimatedServerMs() }); PulsarPluginLoader.Utilities.Messaging.Notification($"{WarpDriveProgramPluginManager.Instance.WarpDriveProgramTypes[subtypeformodded].VirusSubtype}"); } else { __instance.GetType().GetField("ShieldBooster_LastActivationTime", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, Time.time); WarpDriveProgramPluginManager.Instance.WarpDriveProgramTypes[subtypeformodded].Execute(__instance); } } }
static void Postfix(PLWarpDriveProgram __instance) { int subtypeformodded = __instance.SubType - WarpDriveProgramPluginManager.Instance.VanillaWarpDriveProgramMaxType; if (subtypeformodded > -1 && subtypeformodded < WarpDriveProgramPluginManager.Instance.WarpDriveProgramTypes.Count && Time.time - (float)__instance.GetType().GetField("ShieldBooster_LastActivationTime", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance) < WarpDriveProgramPluginManager.Instance.WarpDriveProgramTypes[subtypeformodded].ActiveTime) { WarpDriveProgramPluginManager.Instance.WarpDriveProgramTypes[subtypeformodded].FinalLateAddStats(__instance); } }