예제 #1
0
 public override void OnTowerLoaded(Tower tower, TowerSaveDataModel saveData)
 {
     if (saveData.metaData.ContainsKey("InstaMonkeyRework"))
     {
         SavedPlacedInstas[tower.Id] = saveData.metaData["InstaMonkeyRework"];
     }
 }
예제 #2
0
            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";
                    }
                }
            }
예제 #3
0
 public override void OnTowerSaved(Tower tower, TowerSaveDataModel saveData)
 {
     if (SavedPlacedInstas.ContainsKey(tower.Id))
     {
         saveData.metaData["InstaMonkeyRework"] = SavedPlacedInstas[tower.Id];
     }
 }
예제 #4
0
            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);
                }
            }
예제 #5
0
 internal static void Postfix(Tower __instance, TowerSaveDataModel towerData)
 {
     MelonMain.PerformHook(mod => mod.OnTowerLoaded(__instance, towerData));
 }
예제 #6
0
 /// <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)
 {
 }
예제 #7
0
 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));
 }