private void ClearNearbyProjectiles() { float num = cfgHoustonRadius.Value; float num2 = num * num; List <ProjectileController> instancesList = InstanceTracker.GetInstancesList <ProjectileController>(); List <ProjectileController> list = new List <ProjectileController>(); int i = 0; int count = instancesList.Count; while (i < count) { ProjectileController projectileController = instancesList[i]; if (projectileController.teamFilter.teamIndex != teamIndex && (projectileController.transform.position - characterMaster.GetBody().corePosition).sqrMagnitude < num2) { list.Add(projectileController); } i++; } int j = 0; int count2 = list.Count; while (j < count2) { ProjectileController projectileController2 = list[j]; if (projectileController2) { UnityEngine.Object.Destroy(projectileController2.gameObject); } j++; } }
public void CreateTemporaryNetworkUsers() { if (!debug) { return; } GameObject meUser = LocalUserManager.GetFirstLocalUser().currentNetworkUser.gameObject; List <string> bodyNamesToCopy = new List <string>(DD2LobbySetupComponent.debug_characters); bodyNamesToCopy.RemoveAt(0); foreach (string bodyName in bodyNamesToCopy) { if (InstanceTracker.GetInstancesList <FakeNetworkUserMarker>().Count == 3) { break; } var copy = Instantiate(meUser); var nU = copy.GetComponent <NetworkUser>(); nU.SetBodyPreference(BodyCatalog.FindBodyIndex(bodyName)); nU.id = new NetworkUserId() { value = GetNetworkName(bodyName) }; copy.name = bodyName; copy.AddComponent <FakeNetworkUserMarker>(); Debug.Log($"Adding fake NetworkUser as {bodyName}"); } }
private void Stage_onStageStartGlobal(Stage stage) { foreach (var component in InstanceTracker.GetInstancesList <MysticsItemsOmarHackToolBehaviour>()) { component.usesLeft = component.maxUses; } }
// Token: 0x060021BC RID: 8636 RVA: 0x00091FF4 File Offset: 0x000901F4 private static void SetHudDisplayingArenaInfoPanel(HUD hud, bool shouldDisplay) { List <ArenaInfoPanel> instancesList = InstanceTracker.GetInstancesList <ArenaInfoPanel>(); ArenaInfoPanel arenaInfoPanel = null; for (int i = 0; i < instancesList.Count; i++) { ArenaInfoPanel arenaInfoPanel2 = instancesList[i]; if (arenaInfoPanel2.hud == hud) { arenaInfoPanel = arenaInfoPanel2; break; } } if (arenaInfoPanel != shouldDisplay) { if (!arenaInfoPanel) { Transform parent = (RectTransform)hud.GetComponent <ChildLocator>().FindChild("RightInfoBar"); UnityEngine.Object.Instantiate <GameObject>(ArenaInfoPanel.panelPrefab, parent).GetComponent <ArenaInfoPanel>().hud = hud; return; } UnityEngine.Object.Destroy(arenaInfoPanel.gameObject); } }
//method is only called by server private bool ThrowFruit(EquipmentSlot equipmentSlot) { if (InstanceTracker.GetInstancesList <FoodPickup>()?.Count < maxAmount) { GameObject pickup = UnityEngine.Object.Instantiate <GameObject>(fruitPickup, equipmentSlot.characterBody.transform.position, UnityEngine.Random.rotation); pickup.GetComponent <TeamFilter>().teamIndex = equipmentSlot.teamComponent.teamIndex; FoodPickup foodPickup = pickup.GetComponentInChildren <FoodPickup>(); foodPickup.owner = equipmentSlot.characterBody; pickup.transform.localScale = new Vector3(1f, 1f, 1f); Vector3 direction; if (equipmentSlot.characterBody.inputBank) { Ray aimRay = equipmentSlot.characterBody.inputBank.GetAimRay(); direction = aimRay.direction; pickup.transform.position = aimRay.origin; //set position to aimray if aimray is found } else { direction = equipmentSlot.transform.forward; } Rigidbody component = pickup.GetComponent <Rigidbody>(); component.velocity = Vector3.up * 5f + (direction * 20f); // please fine tune pickup.transform.eulerAngles = Vector3.zero; NetworkServer.Spawn(pickup); return(true); } return(false); }
public static void TriggerFlashForBody(CharacterBody body) { foreach (var itemDisplayHelper in InstanceTracker.GetInstancesList <MysticsItemsJudgementCutItemDisplayHelper>().Where(x => x.body == body)) { itemDisplayHelper.TriggerFlash(); } }
private static void CCUpdateDelay(ConCommandArgs args) { if (args.Count > 0) { var newValue = args.GetArgFloat(0); if (newValue < 0) { Debug.LogWarning("[BossDropRewardDelay] Can't set delay to less than 0!"); } else { var maxValueWarning = 5f; if (newValue > maxValueWarning) { Debug.LogWarning($"[BossDropRewardDelay] Warning: reward delay set to larger than {maxValueWarning} seconds ({newValue}), rewards may take a long time to complete!"); } spawnDelay = newValue; foreach (var bossDropRewardDelayComponent in InstanceTracker.GetInstancesList <DelayedBossRewards>()) { if (bossDropRewardDelayComponent) { bossDropRewardDelayComponent.delay = spawnDelay; bossDropRewardDelayComponent.age = 0; } } } } else { Debug.Log($"[BossDropRewardDelay] {spawnDelay} seconds."); } }
public void Update() { // Clear and update this.interactablesItem.Clear(); this.interactablesBarrel = InstanceTracker.GetInstancesList <BarrelInteraction>(); // Process multishops MultiShopController[] multishops = GameObject.FindObjectsOfType <MultiShopController>(); foreach (MultiShopController multishop in multishops) { GameObject[] terminalGameObjects = multishop.GetFieldValue <GameObject[]>("terminalGameObjects"); if (terminalGameObjects != null) { foreach (GameObject terminal in terminalGameObjects) { ShopTerminalBehavior shop = terminal.GetComponent <ShopTerminalBehavior>(); PickupIndex pickup = shop.GetFieldValue <PickupIndex>("pickupIndex"); // TODO: Check if pickup is higher priority // FILLER this.interactablesItem.Add(new BotInteractable <PurchaseInteraction>(terminal.gameObject)); } } } // Process chests ChestBehavior[] chests = GameObject.FindObjectsOfType <ChestBehavior>(); foreach (ChestBehavior chest in chests) { interactablesItem.Add(new BotInteractable <PurchaseInteraction>(chest.gameObject)); } }
public static void TriggerBlinkForBody(CharacterBody body) { foreach (var itemDisplayHelper in InstanceTracker.GetInstancesList <MysticsItemsMysticSwordItemDisplayHelper>().Where(x => x.body == body)) { itemDisplayHelper.TriggerBlink(); } }
private void RecordDamage(GameObject attackerObject, CharacterBody victimBody, float damageDealt) { bool shouldBreak = false; foreach (var tracker in InstanceTracker.GetInstancesList <BossDamageTracker>()) { foreach (var bossMaster in tracker.bossGroup.combatSquad.membersList) { if (bossMaster.GetBody() == victimBody) { var attackerBody = attackerObject.GetComponent <CharacterBody>(); if (attackerBody && attackerBody.master) { tracker.AddDamage(attackerBody.master, damageDealt); } shouldBreak = true; break; } } if (shouldBreak) { break; } } }
// Token: 0x06002322 RID: 8994 RVA: 0x00099A50 File Offset: 0x00097C50 private void FixedUpdate() { List <BossGroup> instancesList = InstanceTracker.GetInstancesList <BossGroup>(); int num = 0; for (int i = 0; i < instancesList.Count; i++) { if (instancesList[i].shouldDisplayHealthBarOnHud) { num++; } } this.SetListeningForClientDamageNotified(num > 1); if (num == 1) { for (int j = 0; j < instancesList.Count; j++) { if (instancesList[j].shouldDisplayHealthBarOnHud) { this.currentBossGroup = instancesList[j]; return; } } return; } if (instancesList.Count == 0) { this.currentBossGroup = null; } }
public static void UpdateAllItemDisplays() { foreach (var itemDisplayHelper in InstanceTracker.GetInstancesList <MysticsItemsOmarHackToolItemDisplayHelper>()) { itemDisplayHelper.UpdateItemDisplay(); } }
private void CharacterSelectController_OnDisable(On.RoR2.UI.CharacterSelectController.orig_OnDisable orig, CharacterSelectController self) { orig(self); var netUsers = InstanceTracker.GetInstancesList <FakeNetworkUserMarker>(); foreach (var user in netUsers.ToList()) { Destroy(user.gameObject); } }
public static void CalculateCountdownForAll() { if (!NetworkServer.active) { return; } foreach (var component in InstanceTracker.GetInstancesList <MysticsItemsRiftLensBehaviour>()) { component.CalculateCountdown(); } }
private void AlertEnemiesUponUncloak(On.RoR2.CharacterBody.orig_RemoveBuff_BuffIndex orig, CharacterBody self, BuffIndex buffType) { orig(self, buffType); if (buffType == RoR2Content.Buffs.Cloak.buffIndex || buffType == RoR2Content.Buffs.AffixHauntedRecipient.buffIndex) { foreach (var baseAI in InstanceTracker.GetInstancesList <RoR2.CharacterAI.BaseAI>()) { baseAI.targetRefreshTimer = 0; } } }
////// Hooks ////// protected override bool PerformEquipmentAction(EquipmentSlot slot) { float sqrad = range * range; foreach (var tcpt in GameObject.FindObjectsOfType <TeamComponent>()) { var deltaPos = tcpt.transform.position - slot.transform.position; if (deltaPos.sqrMagnitude <= sqrad) { bool isSurvivor = tcpt.teamIndex == TeamIndex.Player; if (tcpt.body && tcpt.body.skillLocator) { var stsd = tcpt.body.gameObject.GetComponent <ServerTimedSkillDisable>(); if (!stsd) { stsd = tcpt.body.gameObject.AddComponent <ServerTimedSkillDisable>(); } if (!isSurvivor) { stsd.ServerApply(duration, SkillSlot.Primary); } stsd.ServerApply(duration, SkillSlot.Secondary); stsd.ServerApply(duration, SkillSlot.Utility); stsd.ServerApply(duration, SkillSlot.Special); } } } EffectManager.SpawnEffect(LegacyResourcesAPI.Load <GameObject>("Prefabs/Effects/ImpactEffects/FusionCellExplosion"), new EffectData { origin = slot.characterBody ? slot.characterBody.corePosition : slot.transform.position, scale = range, color = Color.cyan }, true); var myTeam = slot.teamComponent.teamIndex; var toDelete = new List <ProjectileController>(); foreach (var projectile in InstanceTracker.GetInstancesList <ProjectileController>()) { if (!projectile.cannotBeDeleted && projectile.teamFilter.teamIndex != myTeam && (projectile.transform.position - (slot.characterBody ? slot.characterBody.corePosition : slot.transform.position)).sqrMagnitude < sqrad) { toDelete.Add(projectile); } } for (int i = toDelete.Count - 1; i >= 0; i--) { GameObject.Destroy(toDelete[i].gameObject); } return(true); }
static BossGroup CurrentBossGroup(BossGroup inp) { if (!InstanceTracker.Any <BossGroup>()) { return(null); } BossGroup a = null; List <BossGroup> instancesList = InstanceTracker.GetInstancesList <BossGroup>(); int num = 0; //if (instancesList.Count == 0) //{ // bossInfo = null; // return; //} for (int i = 0; i < instancesList.Count; i++) { if (instancesList[i].shouldDisplayHealthBarOnHud) { num++; } } if (inp) { if (!inp.shouldDisplayHealthBarOnHud) { a = null; } } if (num > 0) { if (num != 1 && inp != null) { a = null; } for (int i = 0; i < instancesList.Count; i++) { if (instancesList[i].shouldDisplayHealthBarOnHud) { a = instancesList[i]; break; } } } else { a = null; } return(a); }
public static List <CharacterBody> GetMarkedBodiesForTeam(TeamIndex teamIndex) { var list = new List <CharacterBody>(); foreach (var component in InstanceTracker.GetInstancesList <MysticsItemsDeathCeremonyMark>()) { if (TeamComponent.GetObjectTeam(component.gameObject) == teamIndex && component.markTimer > 0f) { var body = component.GetComponent <CharacterBody>(); list.Add(body); } } return(list); }
public void PickupItems() { if (!master.inventory) { return; } List <GenericPickupController> pickups = InstanceTracker.GetInstancesList <GenericPickupController>(); for (int i = 0; i < pickups.Count; i++) { GenericPickupController pickup = pickups[i]; // Skip lunar coins if (PickupCatalog.GetPickupDef(pickup.pickupIndex).coinValue > 0) { continue; } // Skip these ItemDef def = ItemCatalog.GetItemDef(PickupCatalog.GetPickupDef(pickup.pickupIndex).itemIndex); if (def != null && def.tier == ItemTier.Lunar) { continue; } EquipmentIndex equipmentIndex = PickupCatalog.GetPickupDef(pickup.pickupIndex).equipmentIndex; if (equipmentIndex != EquipmentIndex.None) { if (EquipmentCatalog.GetEquipmentDef(equipmentIndex).isLunar) { continue; } if (master.inventory.currentEquipmentIndex != EquipmentIndex.None) { continue; } } if (pickup.GetInteractability(this.bodyInteractor) == Interactability.Available) { // Move to pickup item if within 60 meters float dist = PlayerBotUtils.GetFastDist(master.GetBody().transform.position, pickup.gameObject.transform.position); if (dist <= (60f * 60f)) { this.ai.customTarget.gameObject = pickup.gameObject; return; } } } }
private void PickupPickerController_SubmitChoice(On.RoR2.PickupPickerController.orig_SubmitChoice orig, PickupPickerController self, int choiceIndex) { var CommandCubes = InstanceTracker.GetInstancesList <PickupPickerController>(); CommandCubes.Remove(self); var displayToken = self.GetComponent <GenericDisplayNameProvider>().displayToken; var isModifying = Input.GetKey(ModifierKey.Value); if (isModifying) { Debug.Log("we are modifying"); if (!NetworkServer.active) { Debug.Log("We are a client!"); var i = 0; foreach (var cube in CommandCubes.ToList()) { Debug.Log("Entered foreach loop with cube # " + i); if (Vector3.Distance(self.gameObject.transform.position, cube.gameObject.transform.position) <= Radius.Value) { Debug.Log("Cube is in distance"); if (cube.GetComponent <GenericDisplayNameProvider>()?.displayToken == displayToken) { Debug.Log("The display token is valid, Writing the network options."); NetworkWriter networkWriter = cube.networkUIPromptController.BeginMessageToServer(); networkWriter.Write(0); networkWriter.Write(choiceIndex); cube.networkUIPromptController.FinishMessageToServer(networkWriter); } } //get rid of the return or it wont work in multiplayer i++; } } else { foreach (var cube in CommandCubes.ToList()) { if (Vector3.Distance(self.gameObject.transform.position, cube.gameObject.transform.position) <= Radius.Value) { if (cube.GetComponent <GenericDisplayNameProvider>()?.displayToken == displayToken) { cube.HandlePickupSelected(choiceIndex); } } } } } Debug.Log("We've exited."); orig(self, choiceIndex); }
//IMPORTANT //AAAAAAAAA //CURRENTLY DOESN'T WORK IN HIDDEN REALMS //WHILE IS UP TO CHOICE IF IT DOES OR NOT WHAT I MEAN BY THIS IS THAT IT THROWS A NULL EXCEPTION!!!!!!!! //We could probably do this via the game's own SceneExitController but some stages such as the Ambry doesn't have one so we'll create one. protected override bool ActivateEquipment(EquipmentSlot slot) { if (Stage.instance.sceneDef.isFinalStage || UnityEngine.SceneManagement.SceneManager.GetActiveScene().name == "moon") { #if DEBUG Chat.AddMessage("Turbo Edition: " + EquipmentName + " this is a final stage, won't skip!"); #endif return(false); } if (!(SceneCatalog.mostRecentSceneDef.sceneType == SceneType.Stage)) { #if DEBUG Chat.AddMessage("Turbo Edition: " + EquipmentName + " current scene is not a stage, won't skip!"); #endif return(false); } int sceneExitCount = InstanceTracker.GetInstancesList <SceneExitController>().Count; #if DEBUG TurboEdition._logger.LogWarning("sceneExitCount: " + sceneExitCount); #endif if (TeleporterInteraction.instance || !SceneExitController.isRunning) { //Makes sure that theres only the game's own controller, if theres none at least it wont create more than three //Increased to two since Bazaar has two if (sceneExitCount <= 2) { if (TeleporterInteraction.instance.chargeFraction >= 0.99 || Reflection.GetFieldValue <bool>(TeleporterInteraction.instance, "monstersCleared")) { SceneExitController sceneExitController = explicitSceneExitController; if (!sceneExitController) { sceneExitController = InstanceTracker.FirstOrNull <SceneExitController>(); #if DEBUG TurboEdition._logger.LogWarning("TE instanceTracker.FirstOrNull: " + sceneExitController); #endif } SkipStage(sceneExitController); return(true); } } } #if DEBUG Chat.AddMessage("Turbo Edition: " + EquipmentName + " couldn't skip stage, see log for details."); TurboEdition._logger.LogWarning("TE chargeFraction: " + TeleporterInteraction.instance.chargeFraction); TurboEdition._logger.LogWarning("TE monstersCleared: " + Reflection.GetFieldValue <bool>(TeleporterInteraction.instance, "monstersCleared")); TurboEdition._logger.LogWarning("TE isRunning: " + SceneExitController.isRunning); #endif return(false); }
private IEnumerator delayedPriceChangeLunarShop() { yield return(new WaitForSeconds(2f)); var purchaseInteractions = InstanceTracker.GetInstancesList <PurchaseInteraction>(); foreach (PurchaseInteraction purchaseInteraction in purchaseInteractions) { if (purchaseInteraction.name.StartsWith("LunarShopTerminal") && purchaseInteraction.cost == 2) { purchaseInteraction.Networkcost = ModConfig.lunarBudLunarCost.Value; } ; } }
public static void ObjectivePanelController_collectObjectiveSources(CharacterMaster master, List <ObjectivePanelController.ObjectiveSourceDescriptor> objectiveSourcesList) { foreach (MysticsItemsRiftLensBehaviour component in InstanceTracker.GetInstancesList <MysticsItemsRiftLensBehaviour>()) { if (component.stack > 0 && component.body && component.riftsLeft > 0 && LocalUserManager.readOnlyLocalUsersList.Any(x => x.cachedBody == component.body)) { objectiveSourcesList.Add(new ObjectivePanelController.ObjectiveSourceDescriptor { master = master, objectiveType = typeof(RiftLensObjectiveTracker), source = component }); } } }
private void FindNearby() { Vector3 vector = gameObject.transform.position; float diameterDistance = 9 * 9; List <ProjectileController> instancesList = InstanceTracker.GetInstancesList <ProjectileController>(); List <ProjectileController> list = new List <ProjectileController>(); int num3 = 0; int count = instancesList.Count; while (num3 < count) { ProjectileController enemyProjectileController = instancesList[num3]; if (enemyProjectileController.owner == projectileController.owner && (projectileController.transform.position - vector).sqrMagnitude < diameterDistance && projectileController.gameObject.GetComponent <PoisonSplatController>()) { list.Add(projectileController); } num3++; } bool result = count > 0; int i = 0; int count2 = list.Count; while (i < count2) { ProjectileController projectileController2 = list[i]; if (projectileController2) { PoisonSplatController poisonSplatController = projectileController2.GetComponent <PoisonSplatController>(); if (poisonSplatController) { poisonSplatController.AddStack(); } } i++; } if (result) { Destroy(gameObject); } }
public void Awake() { holdoutZoneController.onCharged = new HoldoutZoneController.HoldoutZoneControllerChargedUnityEvent(); holdoutZoneController.onCharged.AddListener((zone) => { RunOnTeleporterChargedGlobal(GetComponent <TeleporterInteraction>()); zone.enabled = false; delay = delayMax; Util.PlaySound("Play_loader_shift_release", gameObject); ShakeEmitter.CreateSimpleShakeEmitter(transform.position, new Wave { amplitude = 7f, frequency = 2.4f }, 0.1f, zone.currentRadius, true); if (NetworkServer.active) { foreach (var purchaseInteraction in InstanceTracker.GetInstancesList <PurchaseInteraction>().Where(x => x.setUnavailableOnTeleporterActivated)) { purchaseInteraction.SetAvailable(true); } } }); holdoutZoneController.calcChargeRate += HoldoutZoneController_calcChargeRate; waveCombatDirector.currentSpawnTarget = gameObject; monsterCredit = baseMonsterCredit /* * (Run.instance ? Run.instance.difficultyCoefficient : 1f)*/; if (Physics.Raycast(transform.position, Vector3.down, out var raycastHit, 500f, LayerIndex.world.mask)) { transform.position = raycastHit.point; transform.up = raycastHit.normal; } ForceEnd(); instance = this; Util.PlaySound("MysticsItems_Play_item_use_sirenpole", gameObject); if (poleTransform) { poleTransformLocalPositionTarget = poleTransform.localPosition; poleTransform.localPosition = Vector3.zero; } ShakeEmitter.CreateSimpleShakeEmitter(transform.position, new Wave { amplitude = 0.5f, frequency = 10f }, 0.1f, 15f, true); }
public void CheckMasterRoundEventResult(ItemIndex itemIndex) { bool success = true; foreach (var component in InstanceTracker.GetInstancesList <MasterRoundComponent>()) { Chat.AddMessage(component.currentHits + " / " + component.allowedHits); if (component.currentHits > component.allowedHits) { success = false; break; } } if (success) { HelperUtil.GiveItemToPlayers(itemIndex, true, 1); } }
public void UpdateLock() { if (purchaseInteraction && purchaseInteraction.lockGameObject) { var name = MysticsRisky2Utils.Utils.TrimCloneFromString(purchaseInteraction.lockGameObject.name); switch (name) { case "PurchaseLockVoid": foreach (var component in InstanceTracker.GetInstancesList <MysticsItemsRiftLensBehaviour>().Where(x => !x.voidCampLockedBonusAdded)) { component.voidCampLockedBonusAdded = true; component.countdownTimer += 100f; component.maxCountdown += 100f; } return; } purchaseInteraction.lockGameObject = null; } }
public static void CheckMasterRoundEventResult() { bool success = true; foreach (var component in InstanceTracker.GetInstancesList <MasterRoundComponent>()) { Chat.AddMessage(component.currentHits + " / " + component.allowedHits); if (component.currentHits > component.allowedHits) { success = false; break; } } if (success) { var currentStage = Run.instance.stageClearCount; var MasterRoundToGive = MasterRoundDefs[GetTrueMasterRoundNumber(currentStage)]; Utils.ItemHelpers.GiveItemToPlayers(MasterRoundToGive, true, 1); } }
public void OnReceived() { if (!NetworkServer.active) { return; } var CommandCubes = InstanceTracker.GetInstancesList <PickupPickerController>(); var cut = cubeIndices.Split(','); foreach (var sub in cut) { var index = int.Parse(sub); var cube = CommandCubes[index]; //var network = cube.networkUIPromptController; //network.currentParticipantMaster = self.networkUIPromptController.currentParticipantMaster; cube.HandlePickupSelected(choiceIndex); } }
public void FixedUpdate() { if (shouldDestroy) { return; } if (UnityEngine.Networking.NetworkServer.active) { if (pingIndicator) { if (pingIndicator.pingTarget && pingIndicator.pingTarget.GetComponent <CharacterBody>() && pingIndicator.pingTarget.GetComponent <CharacterBody>().hasCloakBuff) { var index = InstanceTracker.GetInstancesList <KillPingerIfCloaked>().IndexOf(this); new Networking.SendToClientsToDeleteIndicator(index).Send(NetworkDestination.Clients); shouldDestroy = true; } } } }