private void Dungeon_Update(On.Dungeon.orig_Update orig, Dungeon self) { orig(self); float increment = incrementWrapper.Value; KeyCode iKey = (KeyCode)Enum.Parse(typeof(KeyCode), indKeyWrapper.Value); if (Input.GetKeyDown(iKey)) { mod.Log("Adding: " + increment + " industry!"); Player.LocalPlayer.AddIndustry(increment); } KeyCode sKey = (KeyCode)Enum.Parse(typeof(KeyCode), sciKeyWrapper.Value); if (Input.GetKeyDown(sKey)) { mod.Log("Adding: " + increment + " science!"); Player.LocalPlayer.AddScience(increment); } KeyCode fKey = (KeyCode)Enum.Parse(typeof(KeyCode), foodKeyWrapper.Value); if (Input.GetKeyDown(fKey)) { mod.Log("Adding: " + increment + " food!"); Player.LocalPlayer.AddFood(increment); } KeyCode dKey = (KeyCode)Enum.Parse(typeof(KeyCode), dustKeyWrapper.Value); if (Input.GetKeyDown(dKey)) { mod.Log("Adding: " + increment + " dust!"); self.AddDust(increment); } }
public void PopQueue(Hero h, bool remove = true) { // Then need to apply the action at the top of the queue (which should be index 0) // To do this, first we need to set the selected heroes to be the hero that has the action in the queue List <Hero> prevSelected = Hero.SelectedHeroes; var field = typeof(Hero).GetField("selectedHeroes", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic); // Now call the original action from the queue mod.Log("Setting Selected Heroes"); field.SetValue(null, new List <Hero>() { h }); mod.Log("Attempting to call QueueCallOrig!"); if (queue[h][0] == null) { mod.Log("QueueData is null!"); } queue[h][0].CallOrig(); // Reset the selected heroes mod.Log("Setting Previous Heroes back to Selected!"); field.SetValue(null, prevSelected); // Remove the action so that it isn't called again if (remove) { queue[h].RemoveAt(0); } mod.Log("Hero with name: " + h.LocalizedName + " is now moving using their most recent Queued Action, with: " + queue[h].Count + " actions in their queue!"); }
public override void Init() { mod.Initialize(); mod.settings.ReadSettings(); mod.Log("Initialized!"); }
public override void Init() { mod.BepinPluginReference = this; mod.Initialize(); mod.settings.ReadSettings(); mod.Log("Initialized!"); }
private bool Room_CanBeUnpowered(On.Room.orig_CanBeUnpowered orig, Room self, bool checkCrystalState, bool checkPoweringPlayer, bool checkPowerChangeCooldown, bool ignoreShipConfig, bool displayError) { if (checkCrystalState) { mod.Log("Making sure checkCrystalState is false..."); return(orig(self, false, checkPoweringPlayer, checkPowerChangeCooldown, ignoreShipConfig, displayError)); } return(orig(self, checkCrystalState, checkPoweringPlayer, checkPowerChangeCooldown, ignoreShipConfig, displayError)); }
public override void Init() { mod.BepinPluginReference = this; mod.Initialize(); mod.settings.ReadSettings(); comparator = new SeedComparatorType((SeedComparatorType.ComparatorType)Enum.Parse(typeof(SeedComparatorType.ComparatorType), (mod.settings as SeedFinderSettings).ComparatorType)); mod.Log("Initialized!"); }
public override void Init() { mod.BepinPluginReference = this; mod.Initialize(); // Setup default values for config if (!mod.settings.Exists()) { DustGeneratorSettings temp = mod.settings as DustGeneratorSettings; temp.DustPerDoor = 10; temp.DustFromProducing = true; temp.DustFromRoom = false; } mod.settings.ReadSettings(); mod.Log("Initialized!"); }
private void Dungeon_Update(On.Dungeon.orig_Update orig, Dungeon self) { orig(self); List <Hero> heroes = Hero.GetAllPlayersActiveRecruitedHeroes(); if (!CompletedSkip && self.Level == 1 && levelTargetWrapper.Value >= 2 && self.ShipConfig != null && self.RoomCount != 0 && self.StartRoom != null && heroes != null && heroes.Count > 0 && heroes[0] != null && heroes[0].RoomElement != null) { Room exit = self.StartRoom; var method = typeof(Dungeon).GetMethod("SpawnExit", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); if (method.Equals(null)) { mod.Log("SpawnExit method is null!"); return; } if (Services.GetService <IAudioLayeredMusicService>() == null) { // Waiting for music! mod.Log("Music does not exist!"); return; } mod.Log("Calling SpawnExit!"); method.Invoke(self, new object[] { self.StartRoom }); mod.Log("Attempting to plug exit and end level immediately!"); self.NotifyCrystalStateChanged(CrystalState.Unplugged); self.ExitRoom = exit; //new DynData<Dungeon>(self).Set("ExitRoom", exit); mod.Log("Setting heroes to contain crystal and be in exit room!"); typeof(Hero).GetProperty("HasCrystal").SetValue(heroes[0], true, null); //new DynData<Hero>(heroes[0]).Set("HasCrystal", true); foreach (Hero h in heroes) { h.RoomElement.SetParentRoom(exit); h.WasInExitRoomAtExitTime = true; } // Must be greater than 0! float delay = 1f; new DynData <Dungeon>(self).Set("vistoryScreenDisplayDelay", delay); mod.Log("Attempting to end level with wait delay of: " + delay); self.LevelOver(true); self.OnCrystalPlugged(); CompletedSkip = true; } }
private void InputManager_Update(On.InputManager.orig_Update orig, InputManager self) { orig(self); Dungeon d = SingletonManager.Get <Dungeon>(false); if (!overwriteWrapper.Value) { SeedCollection.UnLoad(); } else { if (!SeedCollection.Loaded) { mod.Log("Reinitializing SeedCollection because it isn't loaded!"); SeedCollection.ReadAll(); } } if (d == null) { return; } if (Input.GetKeyUp((KeyCode)Enum.Parse(typeof(KeyCode), saveKeyWrapper.Value))) { mod.Log("Saving SeedData to SeedCollection!"); SeedCollection best = SeedCollection.GetMostCurrentSeeds(d.ShipName, d.Level); if (best == null) { mod.Log("Creating new SeedCollection because there were no matching SeedCollections!"); best = SeedCollection.Create(); } SeedData data = new SeedData(); d.EnqueueNotification("Saved SeedData: " + data + " to: " + best.ReadFrom); best.Add(d.ShipName, d.Level, data); SeedCollection.WriteAll(); mod.Log("Wrote SeedCollection to: " + best.ReadFrom); } if (Input.GetKeyUp((KeyCode)Enum.Parse(typeof(KeyCode), createNewSeedKeyWrapper.Value))) { mod.Log("Created new SeedCollection!"); SeedCollection best = SeedCollection.Create(); SeedData data = new SeedData(); best.Add(d.ShipName, d.Level, data); SeedCollection.WriteAll(); d.EnqueueNotification("Saved SeedData: " + data + " to new: " + best.ReadFrom); mod.Log("Wrote SeedCollection to: " + best.ReadFrom); } }
public override void Init() { mod.BepinPluginReference = this; mod.Initialize(); // Setup default values for config mod.settings.ReadSettings(); ReadRanks(); mod.Log("Initialized!"); }
private void Dungeon_SpawnExit(On.Dungeon.orig_SpawnExit orig, Dungeon self, Room spawnRoom) { orig(self, spawnRoom); mod.Log("Called a SpawnExit function!"); }
private System.Collections.IEnumerator DungeonGenerator2_GenerateDungeonCoroutine(On.DungeonGenerator2.orig_GenerateDungeonCoroutine orig, DungeonGenerator2 self, int level, Amplitude.StaticString shipName) { if (new DynData <DungeonGenerator2>(self).Get <bool>("IsGeneratingForRuntime")) { GameConfig c = GameConfig.GetGameConfig(); if (capRoomsWrapper.Value && (int)c.DungeonRoomCountMax.GetValue() != maxRoomWrapper.Value) { mod.Log("Setting DungeonRoomCountMax to: " + maxRoomWrapper.Value); CurveDefinedValue v = c.DungeonRoomCountMax; mod.Log("Original: " + v.GetValue()); CurveOperation op = v.CurveOperation; mod.Log("Setting Max for CurveOperation..."); typeof(CurveOperation).GetProperty("Max").SetValue(op, (float)maxRoomWrapper.Value, null); //new DynData<CurveOperation>(op).Set<float>("Max", maxRoomWrapper.Value); mod.Log("Setting curveoperation..."); mod.Log("CurveOperation Max: " + op.Max); //new DynData<CurveDefinedValue>(v).Set("CurveOperation", op); typeof(CurveDefinedValue).GetProperty("CurveOperation").SetValue(v, op, null); mod.Log("CurveDefinedValue.CurveOperation.Max: " + v.CurveOperation.Max); mod.Log("Setting DungeonRoomCountMax..."); //new DynData<GameConfig>(c).Set("DungeonRoomCountMax", v); typeof(GameConfig).GetProperty("DungeonRoomCountMax").SetValue(c, v, null); mod.Log("Final value: " + c.DungeonRoomCountMax.GetValue()); // Need to also set min to be the same... mod.Log("Setting DungeonRoomCountMin to: " + maxRoomWrapper.Value); CurveDefinedValue m = c.DungeonRoomCountMin; mod.Log("Original min: " + m.GetValue()); CurveOperation op2 = m.CurveOperation; typeof(CurveOperation).GetProperty("Max").SetValue(op2, (float)maxRoomWrapper.Value, null); typeof(CurveDefinedValue).GetProperty("CurveOperation").SetValue(m, op2, null); typeof(GameConfig).GetProperty("DungeonRoomCountMin").SetValue(c, m, null); mod.Log("Final min: " + c.DungeonRoomCountMin.GetValue()); } } yield return(orig(self, level, shipName)); }
private void Hero_MoveToRoom(On.Hero.orig_MoveToRoom orig, Hero self, Room room, bool allowMoveInterruption, bool isMoveOrderedByPlayer, bool triggerTutorialEvent) { orig(self, room, allowMoveInterruption, isMoveOrderedByPlayer, triggerTutorialEvent); mod.Log("Currently attempting to move to a room!"); }
private void GameSelectionPanel_RefreshContent(On.GameSelectionPanel.orig_RefreshContent orig, GameSelectionPanel self) { if (!run) { // Set GameConfig SetGameConfig(); // Need to AT LEAST alter the following: // GameSelectionPanel.Display --> NullReference // Lift.Show() --> IndexOutOfBounds // GameSelectionPanel.Display --> NullReference var d = new DynData <GameSelectionPanel>(self); mod.Log("Before set:"); mod.Log("GameSelectionPanel.maxHeroCount: " + d.Get <int>("maxHeroCount")); mod.Log("GameSelectionPanel.competitorsTable: " + d.Get <AgeTransform>("competitorsTable")); mod.Log("GameSelectionPanel.competitorSlots: " + d.Get <List <CompetitorSlot> >("competitorSlots")); d.Set <int>("maxHeroCount", maxHeroShipCountWrapper.Value); mod.Log("After set:"); mod.Log("GameSelectionPanel.maxHeroCount: " + d.Get <int>("maxHeroCount")); run = true; } orig(self); }
private IEnumerator DungeonGenerator2_GenerateDungeonCoroutine(On.DungeonGenerator2.orig_GenerateDungeonCoroutine orig, DungeonGenerator2 self, int level, Amplitude.StaticString shipName) { SeedData seeds = TASInput.seeds.GetSeedForShipLevel(shipName, level); if (seeds != null) { // Then we need to set the seed accordingly! seeds.SetSeedData(); mod.Log("Set seed to: " + seeds + " for level: " + level); } else { // Add the seed! SeedData data = new SeedData(); mod.Log("Creating new SeedData for level: " + level + " with data: " + data); TASInput.AddSeed(level, data); } yield return(orig(self, level, shipName)); }