public static bool LoopRunPrefix(RunCtrl __instance) { CustomZoneUtil.TriggerZoneEvent("Loop"); if (__instance.currentRun != null) { __instance.currentRun.unvisitedWorldNames.Clear(); } if (CustomZoneUtil.currentCampaign != "Default") { __instance.currentRun.visitedWorldNames.Clear(); ++__instance.currentRun.loopNum; CustomZoneUtil.GenerateCampaignWorlds(); __instance.currentRun.Loop(); if (__instance.ctrl.currentPlayer.beingObj.tags.Contains(Tag.Shopkeeper)) { __instance.currentRun.yamiObtained = true; } __instance.ResetWorld(__instance.currentWorld.nameString); __instance.StartZone(__instance.currentRun.zoneNum, __instance.currentZoneDot, true); if (__instance.currentRun.loopNum > SaveDataCtrl.Get <int>("MostLoops")) { SaveDataCtrl.Set <int>("MostLoops", __instance.currentRun.loopNum); } if (__instance.currentRun.loopNum > SaveDataCtrl.Get <int>(__instance.ctrl.currentHeroObj.nameString + "MostLoops")) { SaveDataCtrl.Set <int>(__instance.ctrl.currentHeroObj.nameString + "MostLoops", __instance.currentRun.loopNum); } return(false); } return(true); }
public static bool CreateRunPrefix(RunCtrl __instance, int zoneNum, int worldTierNum, bool campaign, string seed = "") { CustomZoneUtil.TriggerZoneEvent("Start"); var heroID = __instance.ctrl.currentHeroObj.beingID; CustomZoneUtil.currentCampaign = CustomZoneUtil.customCampaignCharacters.ContainsKey(heroID) ? CustomZoneUtil.customCampaignCharacters[heroID] : "Default"; if (CustomZoneUtil.customCampaignCharacters.ContainsKey(heroID) && CustomZoneUtil.currentCampaign != "Default") { __instance.currentRun = new Run("Run"); __instance.currentRun.beingID = heroID; __instance.currentRun.animName = __instance.ctrl.currentHeroObj.animName; if (!string.IsNullOrEmpty(seed)) { __instance.currentRun.seed = seed; __instance.currentRun.seedWasPredefined = true; } else if (__instance.useRandomSeed) { __instance.currentRun.seed = Mathf.Abs(Environment.TickCount).ToString(); } else if (__instance.testSeed != null) { __instance.currentRun.seed = __instance.testSeed; } __instance.pseudoRandom = new System.Random(__instance.currentRun.seed.GetHashCode()); __instance.pseudoRandomWorld = new System.Random(__instance.currentRun.seed.GetHashCode()); __instance.worldBar.seedText.text = ScriptLocalization.UI.Worldbar_Seed + " " + __instance.currentRun.seed; CustomZoneUtil.GenerateCampaignWorlds(); __instance.currentRun.zoneNum = zoneNum; __instance.currentRun.worldTierNum = worldTierNum; __instance.currentRun.hellPassNum = __instance.currentHellPassNum; __instance.currentRun.hellPasses = new List <int>((IEnumerable <int>)__instance.currentHellPasses); __instance.idCtrl.heroNameText.text = __instance.ctrl.currentHeroObj.localizedName; __instance.idCtrl.heroLevelText.text = string.Format(ScriptLocalization.UI.TopNav_LevelShort + " {0}", (object)1); if (__instance.heCtrl.gameMode == GameMode.CoOp) { __instance.currentRun.coOp = true; } __instance.ctrl.deCtrl.deckScreen.ResetValues(); return(false); } return(true); }