Color GetColorForHero(CharacterMaster master) { var survivor = SurvivorCatalog.FindSurvivorDefFromBody(master.bodyPrefab); Color survivorColor; if (survivor != null) { survivorColor = survivor.primaryColor; } else { survivorColor = Color.red; } return(Darken(survivorColor, .2f)); }
private void SendMessageOnFungusPickup(On.RoR2.GenericPickupController.orig_SendPickupMessage orig, CharacterMaster master, PickupIndex pickupIndex) { if (EngineerInGame && RoR2.PickupCatalog.GetPickupDef(pickupIndex).itemIndex == ItemIndex.Mushroom) { if (master.GetBody().bodyIndex == SurvivorCatalog.GetBodyIndexFromSurvivorIndex(SurvivorIndex.Engi)) { Message.SendToAll("Mmmm! That is a tasty fungus!", Colours.Green); } else { Message.SendToAll("This m**********r stole a motherfucking fungus!", Colours.Red); } } orig(master, pickupIndex); }
public void UpdateHook(On.RoR2.UI.SkillIcon.orig_Update orig, SkillIcon self) { orig.Invoke(self); if (self.targetSkill && self.targetSkillSlot == SkillSlot.Primary) { SurvivorIndex survivorIndex = SurvivorCatalog.GetSurvivorIndexFromBodyIndex(self.targetSkill.characterBody.bodyIndex); if (survivorIndex == SurvivorIndex.Captain) { self.stockText.gameObject.SetActive(true); self.stockText.fontSize = 12f; self.stockText.SetText(fireMode.ToString()); } } }
public static void SpawnRandomPlayerbots(CharacterMaster owner, int amount) { int lastCharacterType = -1; for (int i = 0; i < amount; i++) { int randomSurvivorIndex = -1; do { randomSurvivorIndex = random.Next(0, RandomSurvivorsList.Count); }while ((randomSurvivorIndex == lastCharacterType || !SurvivorCatalog.GetSurvivorDef((SurvivorIndex)RandomSurvivorsList[randomSurvivorIndex]).CheckRequiredExpansionEnabled()) && RandomSurvivorsList.Count > 1); SpawnPlayerbot(owner, RandomSurvivorsList[randomSurvivorIndex]); lastCharacterType = randomSurvivorIndex; } }
public void RandomizeLoadout() { if (!PreGameController.instance || !characterSelectController) { return; } var bodyIndex = SurvivorCatalog.GetBodyIndexFromSurvivorIndex(characterSelectController.selectedSurvivorIndex); var bodySkills = BodyCatalog.GetBodyPrefabSkillSlots(bodyIndex); var bodySkins = BodyCatalog.GetBodySkins(bodyIndex); var localUser = ((MPEventSystem)EventSystem.current).localUser; var loadout = new Loadout(); localUser.userProfile.CopyLoadout(loadout); for (var i = 0; i < bodySkills.Length; i++) { var skill = bodySkills[i]; var unlockedVariants = new List <uint>(); for (uint j = 0; j < skill.skillFamily.variants.Length; j++) { if (localUser.userProfile.HasUnlockable(skill.skillFamily.variants[j].unlockableDef)) { unlockedVariants.Add(j); } } loadout.bodyLoadoutManager.SetSkillVariant(bodyIndex, i, unlockedVariants[UnityEngine.Random.Range(0, unlockedVariants.Count)]); } var unlockedSkins = new List <uint>(); for (uint j = 0; j < bodySkins.Length; j++) { if (localUser.userProfile.HasUnlockable(bodySkins[j].unlockableDef)) { unlockedSkins.Add(j); } } loadout.bodyLoadoutManager.SetSkinIndex(bodyIndex, unlockedSkins[UnityEngine.Random.Range(0, unlockedSkins.Count)]); localUser.userProfile.SetLoadout(loadout); }
// Token: 0x0600259A RID: 9626 RVA: 0x000A39F4 File Offset: 0x000A1BF4 private void Rebuild() { SurvivorDef survivorDef = SurvivorCatalog.GetSurvivorDef(this.survivorIndex); if (survivorDef != null) { GameObject bodyPrefab = survivorDef.bodyPrefab; if (bodyPrefab) { CharacterBody component = bodyPrefab.GetComponent <CharacterBody>(); if (component) { if (this.survivorIcon) { this.survivorIcon.texture = component.portraitIcon; } string viewableName = string.Format(CultureInfo.InvariantCulture, "/Survivors/{0}", this.survivorIndex.ToString()); if (this.viewableTag) { this.viewableTag.viewableName = viewableName; this.viewableTag.Refresh(); } if (this.loadoutViewableTag) { this.loadoutViewableTag.viewableName = string.Format(CultureInfo.InvariantCulture, "/Loadout/Bodies/{0}/", BodyCatalog.GetBodyName(SurvivorCatalog.GetBodyIndexFromSurvivorIndex(this.survivorIndex))); this.loadoutViewableTag.Refresh(); } if (this.viewableTrigger) { this.viewableTrigger.viewableName = viewableName; } if (this.tooltipProvider) { UnlockableDef unlockableDef = UnlockableCatalog.GetUnlockableDef(survivorDef.unlockableName); if (unlockableDef != null) { this.tooltipProvider.titleToken = "UNIDENTIFIED"; this.tooltipProvider.titleColor = Color.gray; this.tooltipProvider.overrideBodyText = unlockableDef.getHowToUnlockString(); } } } } } }
private void Stage_Start(On.RoR2.Stage.orig_Start orig, Stage self) { orig(self); if (RoR2.Run.instance && NetworkUser.readOnlyInstancesList .Select(x => x.GetCurrentBody()) .Where(x => x.bodyIndex == SurvivorCatalog.GetBodyIndexFromSurvivorIndex(SurvivorIndex.Engi)) .Any()) { EngineerInGame = true; Message.SendToAll("Give yo' motherfucking fungus to the motherfucking Engineer motherfuckers", Colours.LightBlue); } else { EngineerInGame = false; Logger.LogInfo("No Engineer in party."); } }
// Token: 0x06000002 RID: 2 RVA: 0x00002184 File Offset: 0x00000384 public static void addSurvivors() { Debug.LogFormat("[ROR2ML] Attempting to load {0} mod survivors.", new object[] { BaseFramework.SurvivorMods.Count }); foreach (SurvivorModInfo survivorModInfo in BaseFramework.SurvivorMods) { int index = SurvivorMods.IndexOf(survivorModInfo); Debug.LogFormat("[ROR2ML] Adding mod survivor... (Body: {0}, Index Order: {1})", new object[] { survivorModInfo.bodyPrefabString, index }); SurvivorCatalog.RegisterSurvivor((SurvivorIndex)VanillaSurvivorCount + index, survivorModInfo.RegisterModSurvivor()); } }
private static void SaveFile(RunReport report, WeeklyRun run) { String time = ((Int32)Math.Ceiling((Double)report.runStopwatchValue / 1000.0)).ToString(); var cycle = WeeklyRun.GetCurrentSeedCycle(); var cycleStart = WeeklyRun.GetSeedCycleStartDateTime(WeeklyRun.GetCurrentSeedCycle()); String cycleDate = cycleStart.ToShortDateString(); var body = BodyCatalog.GetBodyPrefab(NetworkUser.readOnlyLocalPlayersList[0].bodyIndexPreference); if (body == null) { instance.Logger.LogError("Invalid body selected"); return; } var survivorDef = SurvivorCatalog.FindSurvivorDefFromBody(body); if (survivorDef == null) { instance.Logger.LogError("Selected body is not in survivorcatalog"); return; } String character = Language.GetString(survivorDef.displayNameToken); instance.Logger.LogMessage("Your character was: " + character); instance.Logger.LogMessage("Your time was: " + time); instance.Logger.LogMessage("Score send aborted, saving run report to disk instead."); instance.Logger.LogMessage("In the future, there may be a leaderboard set up such that you can upload the file to submit a run"); String directory = "\\ModdedTrials\\" + cycleStart + "\\" + character + "\\"; String directoryGlobal = getRunReportsFolder() + directory; System.IO.Directory.CreateDirectory(directoryGlobal); String fileBaseName = time; Int32 i = 0; while (System.IO.File.Exists(directoryGlobal + fileBaseName + (i != 0 ? "(" + i + ")" : String.Empty))) { ++i; } RunReport.Save(report, directory + fileBaseName); }
private static void ShowEndgameText(ConCommandArgs args) { if (args.GetArgString(0).ToLower() == "custom") { flavorText = args.GetArgString(1); } else { var bodyIndex = BodyCatalog.FindBodyIndexCaseInsensitive(args.GetArgString(0)); if (bodyIndex < 0) { Debug.Log("Couldn't find body index!"); return; } var survivorIndex = SurvivorCatalog.GetSurvivorIndexFromBodyIndex(bodyIndex); if (survivorIndex < 0) { Debug.Log("Couldn't find survivor index!"); return; } SurvivorDef survivorDef = SurvivorCatalog.GetSurvivorDef(survivorIndex); if (!survivorDef) { Debug.Log("SurvivorDef not found!"); return; } bool isWinQuote = true; if (args.Count == 2) { if (args.GetArgString(1).ToLower() == "fail") { isWinQuote = false; } } flavorText = GetOutroText(survivorDef, isWinQuote); } Debug.Log("Outro Text: " + flavorText); Debug.Log(Language.GetString(flavorText)); RoR2.Console.instance.SubmitCmd(null, "set_scene outro", false); }
public void Awake() { if (!characterBody) { characterBody = gameObject.GetComponent <CharacterBody>(); } isNetwork = NetworkServer.active; this.localUser = LocalUserManager.readOnlyLocalUsersList[0]; foreach (var entityStateMachine in gameObject.GetComponents <EntityStateMachine>()) { if (entityStateMachine.customName == "Body") { outer = entityStateMachine; break; } } survivorDef = SurvivorCatalog.GetSurvivorDef(SurvivorCatalog.GetSurvivorIndexFromBodyIndex(characterBody.bodyIndex)); }
public static bool TryGetSurvivorIndexByBodyPrefabName(string bodyPrefabName, out SurvivorIndex index) { index = SurvivorIndex.None; GameObject bodyPrefab = BodyCatalog.FindBodyPrefab(bodyPrefabName); if (bodyPrefab == null) { return(false); } SurvivorDef def = SurvivorCatalog.FindSurvivorDefFromBody(bodyPrefab); if (def == null) { return(false); } index = def.survivorIndex; return(true); }
public void OnContentLoad() { // Set survivor dict SurvivorDict.Add("mult", SurvivorCatalog.FindSurvivorIndex("Toolbot")); SurvivorDict.Add("mul-t", SurvivorCatalog.FindSurvivorIndex("Toolbot")); SurvivorDict.Add("toolbot", SurvivorCatalog.FindSurvivorIndex("Toolbot")); SurvivorDict.Add("hunt", SurvivorCatalog.FindSurvivorIndex("Huntress")); SurvivorDict.Add("huntress", SurvivorCatalog.FindSurvivorIndex("Huntress")); SurvivorDict.Add("engi", SurvivorCatalog.FindSurvivorIndex("Engi")); SurvivorDict.Add("engineer", SurvivorCatalog.FindSurvivorIndex("Engi")); SurvivorDict.Add("mage", SurvivorCatalog.FindSurvivorIndex("Mage")); SurvivorDict.Add("arti", SurvivorCatalog.FindSurvivorIndex("Mage")); SurvivorDict.Add("artificer", SurvivorCatalog.FindSurvivorIndex("Mage")); SurvivorDict.Add("merc", SurvivorCatalog.FindSurvivorIndex("Merc")); SurvivorDict.Add("mercenary", SurvivorCatalog.FindSurvivorIndex("Merc")); SurvivorDict.Add("rex", SurvivorCatalog.FindSurvivorIndex("Treebot")); SurvivorDict.Add("treebot", SurvivorCatalog.FindSurvivorIndex("Treebot")); SurvivorDict.Add("croco", SurvivorCatalog.FindSurvivorIndex("Croco")); SurvivorDict.Add("capt", SurvivorCatalog.FindSurvivorIndex("Captain")); SurvivorDict.Add("captain", SurvivorCatalog.FindSurvivorIndex("Captain")); // SoTV survivors SurvivorDict.Add("railgunner", SurvivorCatalog.FindSurvivorIndex("Railgunner")); SurvivorDict.Add("rail", SurvivorCatalog.FindSurvivorIndex("Railgunner")); SurvivorDict.Add("void", SurvivorCatalog.FindSurvivorIndex("VoidSurvivor")); SurvivorDict.Add("voidfiend", SurvivorCatalog.FindSurvivorIndex("VoidSurvivor")); SurvivorDict.Add("voidsurvivor", SurvivorCatalog.FindSurvivorIndex("VoidSurvivor")); // Add skill helpers AiSkillHelperCatalog.Populate(); // Config InitialBots = new ConfigEntry <int> [RandomSurvivorsList.Count]; for (int i = 0; i < RandomSurvivorsList.Count; i++) { string name = BodyCatalog.GetBodyName(SurvivorCatalog.GetBodyIndexFromSurvivorIndex(RandomSurvivorsList[i])).Replace("\'", ""); InitialBots[i] = Config.Bind("Starting Bots", "StartingBots." + name, 0, "Starting amount of bots to spawn at the start of a run. (" + name + ")"); } }
public static GameObject CreateDisplay(string bodyPrefabName, Vector3 position, Vector3 rotation, Transform parent = null) { var bodyPrefab = GetBodyPrefab(bodyPrefabName); SurvivorDef survivorDef = SurvivorCatalog.FindSurvivorDefFromBody(bodyPrefab); GameObject displayPrefab = survivorDef.displayPrefab; var gameObject = UnityEngine.Object.Instantiate <GameObject>(displayPrefab, position, Quaternion.Euler(rotation), parent); switch (bodyPrefabName) { case "Croco": gameObject.transform.Find("mdlCroco")?.transform.Find("Spawn")?.transform.Find("FloorMesh")?.gameObject.SetActive(false); break; case "RobEnforcer": break; case "HANDOverclocked": GameObject.Find("HANDTeaser").SetActive(false); break; } return(gameObject); }
public static void CacheDisplays() { foreach (var survivor in SurvivorCatalog.allSurvivorDefs) { var bodyPrefab = survivor.bodyPrefab; SurvivorDef survivorDef = SurvivorCatalog.FindSurvivorDefFromBody(bodyPrefab); if (survivorDef != null) { continue; } GameObject displayPrefab = survivorDef.displayPrefab; displayPrefabs.Add(displayPrefab); for (int i = 0; i < displayPrefab.transform.childCount; i++) { var child = displayPrefab.transform.GetChild(i); if (child.gameObject.name.Substring(0, 3).ToLower() == "mdl") { runtimeAnimatorControllers.Add(child.GetComponent <Animator>().runtimeAnimatorController); } } } }
//update character preview private void UpdateCharacterPreview(On.RoR2.UI.CharacterSelectController.orig_OnNetworkUserLoadoutChanged orig, RoR2.UI.CharacterSelectController self, NetworkUser networkUser) { orig(self, networkUser); int num = self.GetSortedNetworkUsersList().IndexOf(networkUser); if (num != -1) { RoR2.UI.CharacterSelectController.CharacterPad safe = HG.ArrayUtils.GetSafe <RoR2.UI.CharacterSelectController.CharacterPad>(self.characterDisplayPads, num); if (safe.displayInstance) { Loadout loadout = new Loadout(); networkUser.networkLoadout.CopyLoadout(loadout); int bodyIndexFromSurvivorIndex = SurvivorCatalog.GetBodyIndexFromSurvivorIndex(safe.displaySurvivorIndex); int skinIndex = (int)loadout.bodyLoadoutManager.GetSkinIndex(bodyIndexFromSurvivorIndex); SkinDef safe2 = HG.ArrayUtils.GetSafe <SkinDef>(BodyCatalog.GetBodySkins(bodyIndexFromSurvivorIndex), skinIndex); CharacterModel componentInChildren = safe.displayInstance.GetComponentInChildren <CharacterModel>(); if (componentInChildren && safe2 != null) { safe2.Apply(componentInChildren.gameObject); } } } }
private static void ReconstructSurvivors() { SurvivorDefinitions.GroupBy(x => x.survivorIndex).Where(x => x.Count() > 1).ToList().ForEach(x => { R2API.Logger.LogError($"{CenterText("!ERROR!")}"); R2API.Logger.LogError($"{CenterText($"One of your mods assigns a duplicate SurvivorIndex for \"{x.Key}\"")}"); R2API.Logger.LogError($"{CenterText("Please ask the author to fix their mod.")}"); }); SurvivorCatalog.survivorMaxCount = Math.Max((int)SurvivorDefinitions.Select(x => x.survivorIndex).Max() + 1, 10); SurvivorCatalog.idealSurvivorOrder = SurvivorDefinitions.Select(x => x.survivorIndex).ToArray(); // Only contains not null survivors typeof(SurvivorCatalog).SetFieldValue("_allSurvivorDefs", SurvivorDefinitions .OrderBy(x => x.survivorIndex) .ToArray() ); // Contains null for index with no survivor typeof(SurvivorCatalog).SetFieldValue("survivorDefs", Enumerable.Range(0, SurvivorCatalog.survivorMaxCount) .Select(i => SurvivorDefinitions.FirstOrDefault(x => x.survivorIndex == (SurvivorIndex)i) ?? new SurvivorDef { survivorIndex = (SurvivorIndex)i }) .OrderBy(x => x.survivorIndex) .Select(x => x.bodyPrefab == null ? null : x) .ToArray() ); var bodyIndexToSurvivorIndex = new SurvivorIndex[BodyCatalog.bodyCount]; var survivorIndexToBodyIndex = new int[SurvivorCatalog.survivorMaxCount]; foreach (var survivorDef in SurvivorDefinitions) { int bodyIndex = survivorDef.bodyPrefab.GetComponent <CharacterBody>().bodyIndex; bodyIndexToSurvivorIndex[bodyIndex] = survivorDef.survivorIndex; survivorIndexToBodyIndex[(int)survivorDef.survivorIndex] = bodyIndex; } typeof(SurvivorCatalog).SetFieldValue("bodyIndexToSurvivorIndex", bodyIndexToSurvivorIndex); typeof(SurvivorCatalog).SetFieldValue("survivorIndexToBodyIndex", survivorIndexToBodyIndex); var parent = ViewablesCatalog.FindNode("/Survivors/") ?? new ViewablesCatalog.Node("Survivors", true); if (parent.parent == null) { ViewablesCatalog.AddNodeToRoot(parent); } foreach (var survivor in SurvivorDefinitions) { var name = survivor.survivorIndex.ToString(); var child = ViewablesCatalog.FindNode(parent.fullName + name) ?? new ViewablesCatalog.Node(name, false, parent); child.shouldShowUnviewed = userProfile => !string.IsNullOrEmpty(survivor.unlockableName) && survivor.survivorIndex < SurvivorIndex.Count && userProfile.HasSurvivorUnlocked(survivor.survivorIndex) && !userProfile.HasViewedViewable(child.fullName) ; } Debug.Log("Re-setting all survivor nodes, duplicates may occur. This is no problem."); ViewablesCatalog.AddNodeToRoot(parent); Debug.Log("Re-setting survivor nodes complete."); // Survivors over the builtin limit will be returned as null from SurvivorCatalog.GetSurvivorDef // This is a quick check if the MonoMod component is installed correctly. var overLimit = SurvivorDefinitions.FirstOrDefault(x => x.survivorIndex >= SurvivorIndex.Count); if (overLimit == null || SurvivorCatalog.GetSurvivorDef(overLimit.survivorIndex) != null) { return; } R2API.Logger.LogError($"{CenterText("!ERROR!")}"); R2API.Logger.LogError($"{CenterText("MonoMod component of R2API is not installed correctly!")}"); R2API.Logger.LogError($"{CenterText("Please copy Assembly-CSharp.R2API.mm.dll to BepInEx/monomod.")}"); }
public static GenericSkill GetSkill(ExpandedSkillSlot expandedSlot, SurvivorIndex survivor) { GameObject survivorbodyPrefab = SurvivorCatalog.GetSurvivorDef(survivor).bodyPrefab; return(GetSkill(expandedSlot, survivorbodyPrefab)); }
// A hacky method. Don't ask questions. private static void SpawnPlayerbotAsSummon(CharacterMaster owner, SurvivorIndex survivorIndex) { SurvivorDef def = SurvivorCatalog.GetSurvivorDef(survivorIndex); if (def == null) { return; } GameObject bodyPrefab = def.bodyPrefab; if (bodyPrefab == null) { return; } // Get card SpawnCard card = (SpawnCard)Resources.Load("SpawnCards/CharacterSpawnCards/cscBeetleGuardAlly"); // Spawn request DirectorSpawnRequest spawnRequest = new DirectorSpawnRequest(card, new DirectorPlacementRule { placementMode = DirectorPlacementRule.PlacementMode.Approximate, minDistance = 3f, maxDistance = 40f, spawnOnTarget = owner.GetBody().transform }, RoR2Application.rng); spawnRequest.ignoreTeamMemberLimit = true; spawnRequest.teamIndexOverride = new TeamIndex?(TeamIndex.Player); //spawnRequest.summonerBodyObject = owner.GetBody().gameObject; // Spawn GameObject gameObject = DirectorCore.instance.TrySpawnObject(spawnRequest); if (gameObject) { CharacterMaster master = gameObject.GetComponent <CharacterMaster>(); AIOwnership aiOwnership = gameObject.AddComponent <AIOwnership>() as AIOwnership; BaseAI ai = gameObject.GetComponent <BaseAI>(); if (master) { master.name = "PlayerBot"; master.bodyPrefab = bodyPrefab; SetRandomSkin(master, bodyPrefab); master.Respawn(master.GetBody().transform.position, master.GetBody().transform.rotation); master.teamIndex = TeamIndex.Player; master.GiveMoney(owner.money); master.inventory.CopyItemsFrom(owner.inventory); master.inventory.GiveItem(ItemIndex.DrizzlePlayerHelper, 1); // Allow the bots to spawn in the next stage master.destroyOnBodyDeath = false; master.gameObject.AddComponent <SetDontDestroyOnLoad>(); } if (aiOwnership) { aiOwnership.ownerMaster = owner; } if (ai) { ai.name = "PlayerBot"; ai.leader.gameObject = owner.GetBody().gameObject; ai.fullVision = true; ai.aimVectorDampTime = .01f; ai.aimVectorMaxSpeed = 180f; } InjectSkillDrivers(gameObject, ai, survivorIndex); if (AutoPurchaseItems.Value) { // Add item manager ItemManager itemManager = gameObject.AddComponent <ItemManager>() as ItemManager; } // Add to playerbot list playerbots.Add(gameObject); } }
private static void SpawnPlayerbotAsPlayer(CharacterMaster owner, SurvivorIndex survivorIndex) { SurvivorDef def = SurvivorCatalog.GetSurvivorDef(survivorIndex); if (def == null) { return; } GameObject bodyPrefab = def.bodyPrefab; if (bodyPrefab == null) { return; } // Card PlayerBotSpawnCard card = ScriptableObject.CreateInstance <PlayerBotSpawnCard>(); card.hullSize = HullClassification.Human; card.nodeGraphType = MapNodeGroup.GraphType.Ground; card.occupyPosition = false; card.sendOverNetwork = true; card.forbiddenFlags = NodeFlags.NoCharacterSpawn; card.prefab = Resources.Load <GameObject>("prefabs/charactermasters/CommandoMaster"); card.playerbotName = bodyPrefab.GetComponent <CharacterBody>().GetDisplayName(); card.bodyPrefab = bodyPrefab; // Spawn DirectorSpawnRequest spawnRequest = new DirectorSpawnRequest(card, new DirectorPlacementRule { placementMode = DirectorPlacementRule.PlacementMode.Approximate, minDistance = 3f, maxDistance = 40f, spawnOnTarget = owner.GetBody().transform }, RoR2Application.rng); spawnRequest.ignoreTeamMemberLimit = true; //spawnRequest.summonerBodyObject = owner.GetBody().gameObject; spawnRequest.teamIndexOverride = new TeamIndex?(TeamIndex.Player); GameObject gameObject = DirectorCore.instance.TrySpawnObject(spawnRequest); if (gameObject) { // Add components EntityStateMachine stateMachine = gameObject.AddComponent <PlayerBotStateMachine>() as EntityStateMachine; BaseAI ai = gameObject.AddComponent <PlayerBotBaseAI>() as BaseAI; AIOwnership aiOwnership = gameObject.AddComponent <AIOwnership>() as AIOwnership; aiOwnership.ownerMaster = owner; CharacterMaster master = gameObject.GetComponent <CharacterMaster>(); PlayerCharacterMasterController playerMaster = gameObject.GetComponent <PlayerCharacterMasterController>(); // Random skin SetRandomSkin(master, bodyPrefab); // Set commponent values master.SetFieldValue("aiComponents", gameObject.GetComponents <BaseAI>()); master.GiveMoney(owner.money); master.inventory.CopyItemsFrom(owner.inventory); master.inventory.GiveItem(ItemIndex.DrizzlePlayerHelper, 1); master.destroyOnBodyDeath = false; // Allow the bots to spawn in the next stage playerMaster.name = master.GetBody().GetDisplayName(); // Add custom skills InjectSkillDrivers(gameObject, ai, survivorIndex); if (AutoPurchaseItems.Value) { // Add item manager ItemManager itemManager = gameObject.AddComponent <ItemManager>() as ItemManager; } // Add to playerbot list playerbots.Add(gameObject); // Cleanup Destroy(card); } }
public void RandomizeCharacter() { if ((!PreGameController.instance || !PreGameController.instance.IsCharacterSwitchingCurrentlyAllowed() || !characterSelectController) && !eclipseRunScreenController) { return; } var localUser = ((MPEventSystem)EventSystem.current).localUser; var currentIndex = characterSelectController?.selectedSurvivorIndex ?? (SurvivorIndex)EclipseRun.cvEclipseSurvivorIndex.value; var canSelectSameCharacter = ConfigHelper.CanSelectSameCharacter.Value; var survivors = SurvivorCatalog.orderedSurvivorDefs.Where(survivorDef => (canSelectSameCharacter || currentIndex != survivorDef.survivorIndex) && !survivorDef.hidden && SurvivorCatalog.SurvivorIsUnlockedOnThisClient(survivorDef.survivorIndex)); var randomIndex = survivors.ElementAt(UnityEngine.Random.Range(0, survivors.Count())).survivorIndex; if (characterSelectController) { characterSelectController.SelectSurvivor(randomIndex); characterSelectController.SetSurvivorInfoPanelActive(true); } if (eclipseRunScreenController) { eclipseRunScreenController.SelectSurvivor(randomIndex); } if (RandomCharacterSelectionPlugin.ScrollableLobbyUILoaded) { ScrollableLobbyUISelectCharacter(randomIndex); } localUser.currentNetworkUser?.CallCmdSetBodyPreference(BodyCatalog.FindBodyIndex(SurvivorCatalog.GetSurvivorDef(randomIndex).bodyPrefab)); }
private static SkillLocator FindSkillLocator(SurvivorIndex survivor) { SkillLocator locator = SurvivorCatalog.GetSurvivorDef(survivor)?.bodyPrefab.GetComponent <SkillLocator>(); return(locator); }
// Token: 0x060020F1 RID: 8433 RVA: 0x0009ABA4 File Offset: 0x00098DA4 private void Update() { this.SetEventSystem(this.eventSystemLocator.eventSystem); if (this.previousSurvivorIndex != this.selectedSurvivorIndex) { this.RebuildLocal(); this.previousSurvivorIndex = this.selectedSurvivorIndex; } if (this.characterDisplayPads.Length != 0) { for (int i = 0; i < this.characterDisplayPads.Length; i++) { CharacterSelectController.CharacterPad characterPad = this.characterDisplayPads[i]; NetworkUser networkUser = null; List <NetworkUser> list = new List <NetworkUser>(NetworkUser.readOnlyInstancesList.Count); list.AddRange(NetworkUser.readOnlyLocalPlayersList); for (int j = 0; j < NetworkUser.readOnlyInstancesList.Count; j++) { NetworkUser item = NetworkUser.readOnlyInstancesList[j]; if (!list.Contains(item)) { list.Add(item); } } if (i < list.Count) { networkUser = list[i]; } if (networkUser) { GameObject bodyPrefab = BodyCatalog.GetBodyPrefab(networkUser.bodyIndexPreference); SurvivorDef survivorDef = SurvivorCatalog.FindSurvivorDefFromBody(bodyPrefab); if (survivorDef != null) { SurvivorDef survivorDef2 = SurvivorCatalog.GetSurvivorDef(characterPad.displaySurvivorIndex); bool flag = true; if (survivorDef2 != null && survivorDef2.bodyPrefab == bodyPrefab) { flag = false; } if (flag) { GameObject displayPrefab = survivorDef.displayPrefab; this.ClearPadDisplay(characterPad); if (displayPrefab) { characterPad.displayInstance = UnityEngine.Object.Instantiate <GameObject>(displayPrefab, characterPad.padTransform.position, characterPad.padTransform.rotation, characterPad.padTransform); } characterPad.displaySurvivorIndex = survivorDef.survivorIndex; } } else { this.ClearPadDisplay(characterPad); } } else { this.ClearPadDisplay(characterPad); } if (!characterPad.padTransform) { return; } this.characterDisplayPads[i] = characterPad; if (this.characterDisplayPads[i].padTransform) { this.characterDisplayPads[i].padTransform.gameObject.SetActive(this.characterDisplayPads[i].displayInstance != null); } } } if (!RoR2Application.isInSinglePlayer) { bool flag2 = this.IsClientReady(); this.readyButton.gameObject.SetActive(!flag2); this.unreadyButton.gameObject.SetActive(flag2); } }
// Token: 0x06002219 RID: 8729 RVA: 0x000936D8 File Offset: 0x000918D8 private void Update() { this.SetEventSystem(this.eventSystemLocator.eventSystem); if (this.previousSurvivorIndex != this.selectedSurvivorIndex) { this.RebuildLocal(); this.previousSurvivorIndex = this.selectedSurvivorIndex; } if (this.characterDisplayPads.Length != 0) { List <NetworkUser> sortedNetworkUsersList = this.GetSortedNetworkUsersList(); for (int i = 0; i < this.characterDisplayPads.Length; i++) { ref CharacterSelectController.CharacterPad ptr = ref this.characterDisplayPads[i]; NetworkUser networkUser = null; if (i < sortedNetworkUsersList.Count) { networkUser = sortedNetworkUsersList[i]; } if (networkUser) { GameObject bodyPrefab = BodyCatalog.GetBodyPrefab(networkUser.bodyIndexPreference); SurvivorDef survivorDef = SurvivorCatalog.FindSurvivorDefFromBody(bodyPrefab); if (survivorDef != null) { SurvivorDef survivorDef2 = SurvivorCatalog.GetSurvivorDef(ptr.displaySurvivorIndex); bool flag = true; if (survivorDef2 != null && survivorDef2.bodyPrefab == bodyPrefab) { flag = false; } if (flag) { GameObject displayPrefab = survivorDef.displayPrefab; this.ClearPadDisplay(ptr); if (displayPrefab) { ptr.displayInstance = UnityEngine.Object.Instantiate <GameObject>(displayPrefab, ptr.padTransform.position, ptr.padTransform.rotation, ptr.padTransform); } ptr.displaySurvivorIndex = survivorDef.survivorIndex; this.OnNetworkUserLoadoutChanged(networkUser); } } else { this.ClearPadDisplay(ptr); } } else { this.ClearPadDisplay(ptr); } if (!ptr.padTransform) { return; } if (this.characterDisplayPads[i].padTransform) { this.characterDisplayPads[i].padTransform.gameObject.SetActive(this.characterDisplayPads[i].displayInstance != null); } } }
private void Awake() { Instance = this; logbookBodyOptions = MapBodiesToOptions( SurvivorCatalog.orderedSurvivorDefs.Select(survivorDef => BodyCatalog.GetBodyPrefabBodyComponent(SurvivorCatalog.GetBodyIndexFromSurvivorIndex(survivorDef.survivorIndex))) .Union(BodyCatalog.allBodyPrefabBodyBodyComponents.Where(characterBody => characterBody && characterBody.GetComponent <DeathRewards>()?.logUnlockableDef))); allBodyOptions = MapBodiesToOptions(BodyCatalog.allBodyPrefabBodyBodyComponents); dropdown.Options = logbookBodyOptions; (dropdown.OnItemSelected ?? (dropdown.OnItemSelected = new SearchableDropdown.DropdownEvent())).AddListener(SelectModel); List <SearchableDropdown.OptionData> MapBodiesToOptions(IEnumerable <CharacterBody> bodies) { return(bodies .Select(characterBody => (characterBody, characterModel: characterBody.GetComponentInChildren <CharacterModel>())) .Where(el => el.characterModel) .Select(el => { var modelInfo = new ModelPrefabInfo { modelPrefab = el.characterModel.gameObject, bodyName = el.characterBody.name, modelName = el.characterModel.name, localizedBodyName = Language.GetString(el.characterBody.baseNameToken), characterBody = el.characterBody }; return new SearchableDropdown.OptionData(modelInfo, $"{modelInfo.localizedBodyName} || {modelInfo.bodyName} || {modelInfo.modelName}"); }) .ToList()); } }
public void AddSkin(SurvivorDef def, string SkinFolder, ConfigFile config) { GameObject gameObject = def.bodyPrefab; LoadoutAPI.SkinDefInfo skinDefInfo = new LoadoutAPI.SkinDefInfo(); skinDefInfo.BaseSkins = new SkinDef[0]; skinDefInfo.Icon = LoadoutAPI.CreateSkinIcon(config.Bind <Color>("", "IconColorTop", Color.magenta).Value, config.Bind <Color>("", "IconColorRight", Color.black).Value, config.Bind <Color>("", "IconColorBottom", Color.magenta).Value, config.Bind <Color>("", "IconColorLeft", Color.black).Value); skinDefInfo.NameToken = config.Bind <string>("", "SkinName", "DefaultName").Value; skinDefInfo.UnlockableName = config.Bind <string>("", "UnlockableName", "").Value; skinDefInfo.RootObject = def.bodyPrefab.GetComponent <ModelLocator>().modelTransform.gameObject; skinDefInfo.RendererInfos = new CharacterModel.RendererInfo[0]; skinDefInfo.MeshReplacements = new SkinDef.MeshReplacement[0]; skinDefInfo.GameObjectActivations = new SkinDef.GameObjectActivation[0]; skinDefInfo.Name = "SKIN_" + gameObject.name + "_DEFAULT"; int MeshReplacementIndex = config.Bind <int>("", "MeshReplacementIndex", 0).Value; if (MeshReplacementIndex != -1) { skinDefInfo.MeshReplacements = gameObject.GetComponent <ModelLocator>().modelTransform.GetComponent <ModelSkinController>().skins[MeshReplacementIndex].meshReplacements; skinDefInfo.RendererInfos = gameObject.GetComponent <ModelLocator>().modelTransform.GetComponent <ModelSkinController>().skins[MeshReplacementIndex].rendererInfos; } CharacterModel.RendererInfo[] rendererInfos = skinDefInfo.RendererInfos; CharacterModel.RendererInfo[] array = new CharacterModel.RendererInfo[rendererInfos.Length]; rendererInfos.CopyTo(array, 0); foreach (string MaterialFolder in Directory.EnumerateDirectories(SkinFolder)) { string[] MaterialIndexVs = MaterialFolder.Split(new string[] { @"\" }, StringSplitOptions.None); string RendererName = MaterialIndexVs[MaterialIndexVs.Length - 1]; int index = Array.IndexOf(array, array.FirstOrDefault(x => x.renderer.name == RendererName)); Material defaultMaterial = array[index].defaultMaterial; if (defaultMaterial) { defaultMaterial = UnityEngine.Object.Instantiate <Material>(defaultMaterial); foreach (string FilePath in Directory.EnumerateFiles(MaterialFolder)) { if (FilePath.EndsWith(".PNG") || FilePath.EndsWith(".png")) { string[] FilePathVs = FilePath.Split(new string[] { @"\" }, StringSplitOptions.None); string FileName = FilePathVs[FilePathVs.Length - 1].Replace(".PNG", ""); Texture2D savedTex = new Texture2D(1, 1, TextureFormat.RGBAFloat, false, true); ImageConversion.LoadImage(savedTex, System.IO.File.ReadAllBytes(FilePath)); savedTex.Apply(); if (defaultMaterial.HasProperty(FileName)) { defaultMaterial.enableInstancing = true; defaultMaterial.SetTexture(FileName, GetReadableTextureCopy(savedTex)); } } else if (FilePath.EndsWith(".cfg")) { string[] ConfigPathVs = FilePath.Split(new string[] { @"\" }, StringSplitOptions.None); string ConfigName = @"BepInEx\skins\" + ConfigPathVs[ConfigPathVs.Length - 4] + @"\" + ConfigPathVs[ConfigPathVs.Length - 3] + @"\" + ConfigPathVs[ConfigPathVs.Length - 2] + @"\" + ConfigPathVs[ConfigPathVs.Length - 1]; BepInEx.Configuration.ConfigFile perMatConfig = new ConfigFile(ConfigName, true); { foreach (string value in floatProperties) { if (defaultMaterial.HasProperty(value)) { defaultMaterial.SetFloat(value, perMatConfig.Bind <float>("", value, defaultMaterial.GetFloat(value), new ConfigDescription("Sets the value for " + value)).Value); } } foreach (string value in colorProperties) { if (defaultMaterial.HasProperty(value)) { defaultMaterial.SetColor(value, perMatConfig.Bind <Color>("", value, defaultMaterial.GetColor(value), new ConfigDescription("Sets the value for " + value)).Value); } } foreach (string value in defaultMaterial.shaderKeywords) { bool isEnabled = perMatConfig.Bind <bool>("", value, defaultMaterial.IsKeywordEnabled(value), new ConfigDescription("Sets the value for " + value)).Value; if (isEnabled) { defaultMaterial.EnableKeyword(value); } else { defaultMaterial.DisableKeyword(value); } } } } else if (FilePath.EndsWith(".obj")) { Mesh holderMesh = new Mesh(); ObjImporter newMesh = new ObjImporter(); holderMesh = newMesh.ImportFile(FilePath); if (array[index].renderer.gameObject.GetComponent <MeshFilter>()) { Array.Resize(ref skinDefInfo.MeshReplacements, skinDefInfo.MeshReplacements.Length + 1); skinDefInfo.MeshReplacements[skinDefInfo.MeshReplacements.Length - 1].mesh = holderMesh; skinDefInfo.MeshReplacements[skinDefInfo.MeshReplacements.Length - 1].renderer = array[index].renderer; (skinDefInfo.MeshReplacements[skinDefInfo.MeshReplacements.Length - 1].renderer as SkinnedMeshRenderer).sharedMesh = holderMesh; } } else { base.Logger.LogError("Unsupported file found in material folder: " + FilePath); } } array[index].defaultMaterial = defaultMaterial; } } base.Logger.LogInfo("Added new skin to " + def.bodyPrefab.name + " with name " + skinDefInfo.NameToken); skinDefInfo.RendererInfos = array; LoadoutAPI.AddSkinToCharacter(def.bodyPrefab, skinDefInfo); SkinDef[] skins = def.bodyPrefab.GetComponent <ModelLocator>().modelTransform.GetComponent <ModelSkinController>().skins; SkinDef[][] newSkins = typeof(BodyCatalog).GetFieldValue <SkinDef[][]>("skins"); newSkins[SurvivorCatalog.GetBodyIndexFromSurvivorIndex(def.survivorIndex)] = skins; typeof(BodyCatalog).SetFieldValue <SkinDef[][]>("skins", newSkins); }
public virtual void AssignPodPrefab() { var survivorDef = SurvivorCatalog.FindSurvivorDefFromBody(BodyCatalog.FindBodyPrefab(BodyName)); survivorDef.bodyPrefab.GetComponent <CharacterBody>().preferredPodPrefab = CreatePod(); }
// Token: 0x06002560 RID: 9568 RVA: 0x000A2874 File Offset: 0x000A0A74 private void Update() { if (this.targetSkill) { if (this.tooltipProvider) { Color color = Color.gray; SurvivorIndex survivorIndexFromBodyIndex = SurvivorCatalog.GetSurvivorIndexFromBodyIndex(this.targetSkill.characterBody.bodyIndex); if (survivorIndexFromBodyIndex != SurvivorIndex.None) { color = SurvivorCatalog.GetSurvivorDef(survivorIndexFromBodyIndex).primaryColor; float h; float s; float num; Color.RGBToHSV(color, out h, out s, out num); num = ((num > 0.7f) ? 0.7f : num); color = Color.HSVToRGB(h, s, num); } this.tooltipProvider.titleColor = color; this.tooltipProvider.titleToken = this.targetSkill.skillNameToken; this.tooltipProvider.bodyToken = this.targetSkill.skillDescriptionToken; } float cooldownRemaining = this.targetSkill.cooldownRemaining; float num2 = this.targetSkill.CalculateFinalRechargeInterval(); int stock = this.targetSkill.stock; bool flag = stock > 0 || cooldownRemaining == 0f; bool flag2 = this.targetSkill.IsReady(); if (this.previousStock < stock) { Util.PlaySound("Play_UI_cooldownRefresh", RoR2Application.instance.gameObject); } if (this.animator) { if (this.targetSkill.maxStock > 1) { this.animator.SetBool(this.animatorStackString, true); } else { this.animator.SetBool(this.animatorStackString, false); } } if (this.isReadyPanelObject) { this.isReadyPanelObject.SetActive(flag2); } if (!this.wasReady && flag && this.flashPanelObject) { this.flashPanelObject.SetActive(true); } if (this.cooldownText) { if (flag) { this.cooldownText.gameObject.SetActive(false); } else { SkillIcon.sharedStringBuilder.Clear(); SkillIcon.sharedStringBuilder.AppendInt(Mathf.CeilToInt(cooldownRemaining), 0U, uint.MaxValue); this.cooldownText.SetText(SkillIcon.sharedStringBuilder); this.cooldownText.gameObject.SetActive(true); } } if (this.iconImage) { this.iconImage.enabled = true; this.iconImage.color = (flag2 ? Color.white : Color.gray); this.iconImage.sprite = this.targetSkill.icon; } if (this.cooldownRemapPanel) { float num3 = 1f; if (num2 >= Mathf.Epsilon) { num3 = 1f - cooldownRemaining / num2; } float num4 = num3; this.cooldownRemapPanel.enabled = (num4 < 1f); this.cooldownRemapPanel.color = new Color(1f, 1f, 1f, num3); } if (this.stockText) { if (this.targetSkill.maxStock > 1) { this.stockText.gameObject.SetActive(true); SkillIcon.sharedStringBuilder.Clear(); SkillIcon.sharedStringBuilder.AppendInt(this.targetSkill.stock, 0U, uint.MaxValue); this.stockText.SetText(SkillIcon.sharedStringBuilder); } else { this.stockText.gameObject.SetActive(false); } } this.wasReady = flag; this.previousStock = stock; return; } if (this.tooltipProvider) { this.tooltipProvider.bodyColor = Color.gray; this.tooltipProvider.titleToken = ""; this.tooltipProvider.bodyToken = ""; } if (this.cooldownText) { this.cooldownText.gameObject.SetActive(false); } if (this.stockText) { this.stockText.gameObject.SetActive(false); } if (this.iconImage) { this.iconImage.enabled = false; this.iconImage.sprite = null; } }
// Token: 0x06002210 RID: 8720 RVA: 0x0009325C File Offset: 0x0009145C private void RebuildLocal() { Loadout loadout = new Loadout(); LocalUser localUser = this.localUser; if (localUser != null) { UserProfile userProfile = localUser.userProfile; if (userProfile != null) { userProfile.CopyLoadout(loadout); } } SurvivorDef survivorDef = SurvivorCatalog.GetSurvivorDef(this.selectedSurvivorIndex); int bodyIndexFromSurvivorIndex = SurvivorCatalog.GetBodyIndexFromSurvivorIndex(this.selectedSurvivorIndex); Color color = Color.white; string text = string.Empty; string text2 = string.Empty; string viewableName = string.Empty; if (survivorDef != null) { color = survivorDef.primaryColor; text = Language.GetString(survivorDef.displayNameToken); text2 = Language.GetString(survivorDef.descriptionToken); } List <CharacterSelectController.StripDisplayData> list = new List <CharacterSelectController.StripDisplayData>(); if (bodyIndexFromSurvivorIndex != -1) { GameObject bodyPrefab = BodyCatalog.GetBodyPrefab(bodyIndexFromSurvivorIndex); SkillLocator component = bodyPrefab.GetComponent <SkillLocator>(); if (component.passiveSkill.enabled) { list.Add(new CharacterSelectController.StripDisplayData { enabled = true, primaryColor = color, icon = component.passiveSkill.icon, titleString = Language.GetString(component.passiveSkill.skillNameToken), descriptionString = Language.GetString(component.passiveSkill.skillDescriptionToken) }); } GenericSkill[] components = bodyPrefab.GetComponents <GenericSkill>(); for (int i = 0; i < components.Length; i++) { uint skillVariant = loadout.bodyLoadoutManager.GetSkillVariant(bodyIndexFromSurvivorIndex, i); SkillDef skillDef = components[i].skillFamily.variants[(int)skillVariant].skillDef; list.Add(new CharacterSelectController.StripDisplayData { enabled = true, primaryColor = color, icon = skillDef.icon, titleString = Language.GetString(skillDef.skillNameToken), descriptionString = Language.GetString(skillDef.skillDescriptionToken) }); } viewableName = "/Loadout/Bodies/" + BodyCatalog.GetBodyName(bodyIndexFromSurvivorIndex) + "/"; } this.skillStripAllocator.AllocateElements(list.Count); for (int j = 0; j < list.Count; j++) { this.RebuildStrip(this.skillStripAllocator.elements[j], list[j]); } this.survivorName.SetText(text); this.survivorDescription.SetText(text2); Image[] array = this.primaryColorImages; for (int k = 0; k < array.Length; k++) { array[k].color = color; } TextMeshProUGUI[] array2 = this.primaryColorTexts; for (int k = 0; k < array2.Length; k++) { array2[k].color = color; } this.loadoutViewableTag.viewableName = viewableName; }
internal static void Init() { On.RoR2.Console.Awake += (orig, self) => { CommandHelper.AddToConsoleWhenReady(); orig(self); }; On.RoR2.HuntressTracker.Awake += (orig, self) => { orig(self); Variables.DefaultHuntressTrackingDistance = self.maxTrackingDistance; }; On.RoR2.CharacterBody.OnInventoryChanged += (orig, self) => { orig(self); if (self.isPlayerControlled && Variables.MyCharacterIndex == 6) { self.GetComponent <HuntressTracker>().maxTrackingDistance = Variables.DefaultHuntressTrackingDistance + (15 * self.inventory.GetItemCount(Assets.MagnifingGlassItemDef.itemIndex)); } if (self.isPlayerControlled && Variables.MyCharacterIndex == 0) { SkillLocator locator = self.GetComponent <SkillLocator>(); locator.primary.SetBonusStockFromBody((self.inventory.GetItemCount(Assets.ExtendedMagItemDef.itemIndex))); locator.primary.stock = locator.primary.maxStock; } }; On.RoR2.Run.Start += (orig, self) => { foreach (var playerCharacterMasterControllerInstance in PlayerCharacterMasterController.instances) { if (playerCharacterMasterControllerInstance.isLocalPlayer) { Variables.MyBody = playerCharacterMasterControllerInstance.master.bodyPrefab.GetComponent <CharacterBody>(); break; } } orig(self); }; On.RoR2.Run.BuildDropTable += (orig, self) => { if (!Variables.HasHuntress) { self.availableItems.Remove(Assets.MagnifingGlassItemDef.itemIndex); } if (!Variables.HasBandit) { self.availableItems.Remove(Assets.ExtendedMagItemDef.itemIndex); } orig(self); }; On.RoR2.GenericPickupController.GetInteractability += (orig, self, activator) => { if (PickupCatalog.GetPickupDef(self.pickupIndex).itemIndex == Assets.MagnifingGlassItemDef.itemIndex && Variables.MyCharacterIndex != 6) { return(Interactability.ConditionsNotMet); } if (PickupCatalog.GetPickupDef(self.pickupIndex).itemIndex == Assets.ExtendedMagItemDef.itemIndex && Variables.MyCharacterIndex != 0) { return(Interactability.ConditionsNotMet); } return(orig(self, activator)); }; On.RoR2.GenericPickupController.OnTriggerStay += (orig, self, other) => { if (PickupCatalog.GetPickupDef(self.pickupIndex).itemIndex == Assets.MagnifingGlassItemDef.itemIndex && Variables.MyCharacterIndex != 6) { return; } if (PickupCatalog.GetPickupDef(self.pickupIndex).itemIndex == Assets.ExtendedMagItemDef.itemIndex && Variables.MyCharacterIndex != 0) { return; } orig(self, other); }; On.RoR2.SceneDirector.PopulateScene += (orig, self) => { self.interactableCredit = (int)(self.interactableCredit * Variables.interactableMultiplier.Value); orig(self); }; On.RoR2.CharacterMaster.GiveMoney += (orig, self, amount) => { amount = (uint)(amount * Variables.moneyMultiplier.Value); orig(self, amount); }; On.RoR2.PreGameController.StartRun += (orig, self) => { int count = NetworkUser.readOnlyInstancesList.Count; for (int i = 0; i < count; i++) { var body = BodyCatalog.GetBodyPrefab(NetworkUser.readOnlyInstancesList[i].bodyIndexPreference); int index = (int)SurvivorCatalog.FindSurvivorDefFromBody(body).survivorIndex; //Stores your survivor index if (i == 0) { Variables.MyCharacterIndex = index; } if (index == 0) { Variables.HasBandit = true; } if (index == 6) { Variables.HasHuntress = true; } } orig(self); }; }