public override void OnTowerLoaded(Tower tower, TowerSaveDataModel saveData) { if (saveData.metaData.ContainsKey("InstaMonkeyRework")) { SavedPlacedInstas[tower.Id] = saveData.metaData["InstaMonkeyRework"]; } }
public static void Postfix(ref TowerSaveDataModel __result, Tower __instance) { if (InGame.instance.IsCoop) { return; } if (CurrentTowerIDs.Contains(__instance.Id)) { __result.metaData["AbilityChoice"] = "Yup"; } if (CurrentBoostIDs.ContainsKey(__instance.Id)) { __result.metaData["AbilityChoiceBoosting"] = "" + CurrentBoostIDs[__instance.Id]; } var mutator = __instance.GetMutatorById("Ultraboost"); if (mutator != null) { var stacks = mutator.mutator.Cast <OverclockPermanentModel.OverclockPermanentMutator>().stacks; __result.metaData["AbilityChoiceStacks"] = "" + stacks; } if (__instance.towerModel.baseId == "PermaPhoenix" || __instance.towerModel.baseId == "LordPhoenix") { var id = __instance.parentTowerId; var tower = InGame.instance.GetTowerManager().GetTowerById(id); if (CurrentTowerIDs.Contains(id) && (__instance.towerModel.baseId == "LordPhoenix" || tower.towerModel.tier < 5)) { __result.metaData["AbilityChoicePhoenix"] = "Yup"; } } }
public override void OnTowerSaved(Tower tower, TowerSaveDataModel saveData) { if (SavedPlacedInstas.ContainsKey(tower.Id)) { saveData.metaData["InstaMonkeyRework"] = SavedPlacedInstas[tower.Id]; } }
public static void Postfix(Tower __instance, TowerSaveDataModel towerData) { if (InGame.instance.IsCoop) { return; } if (towerData.metaData.ContainsKey("AbilityChoice")) { EnableForTower(__instance, __instance.towerModel); } if (towerData.metaData.ContainsKey("AbilityChoiceBoosting")) { var id = int.Parse(towerData.metaData["AbilityChoiceBoosting"]); var tower = InGame.instance.GetTowerManager().GetTowerByIdLastSave(id); CurrentBoostIDs[__instance.Id] = tower.Id; } if (towerData.metaData.ContainsKey("AbilityChoiceStacks")) { int stacks = int.Parse(towerData.metaData["AbilityChoiceStacks"]); Overclock.UltraBoostFixes[__instance] = stacks; } if (towerData.metaData.ContainsKey("AbilityChoicePhoenix")) { var phoenix = __instance.towerModel.Duplicate(); phoenix.behaviors = phoenix.behaviors.RemoveItemOfType <Model, TowerExpireModel>(); foreach (var weaponModel in phoenix.GetWeapons()) { weaponModel.rate *= 3f; } __instance.SetTowerModel(phoenix); } }
internal static void Postfix(Tower __instance, TowerSaveDataModel towerData) { MelonMain.PerformHook(mod => mod.OnTowerLoaded(__instance, towerData)); }
/// <summary> /// Called when you load a save file and a Tower's save data get loaded for the tower /// /// Use saveData.metaData to load custom information /// /// Equivalent to a HarmonyPostFix on Tower.SetSavedData /// </summary> public virtual void OnTowerLoaded(Tower tower, TowerSaveDataModel saveData) { }
internal static void Postfix(Tower __instance, TowerSaveDataModel __result) { MelonMain.PerformHook(mod => mod.OnTowerSaved(__instance, __result)); }
internal static void Postfix(Tower __instance, TowerSaveDataModel towerData) { MelonMain.DoPatchMethods(mod => mod.OnTowerLoaded(__instance, towerData)); }
internal static void Postfix(Tower __instance, TowerSaveDataModel __result) { MelonMain.DoPatchMethods(mod => mod.OnTowerSaved(__instance, __result)); }