示例#1
0
 public static bool CheckForValidInteractables2()
 {
     ///Type[] validInteractables = new Type[] {  };
     foreach (var valid in allowedTypesToScan)
     {
         InstanceTracker.FindInstancesEnumerable(valid);
         if (((IInteractable)valid).ShouldShowOnScanner())
         {
             Debug.Log("interactable check 2");
             return(true);
         }
     }
     return(false);
 }
示例#2
0
 public static bool CheckForValidInteractables()
 {
     Type[] array = ChestRevealer.typesToCheck;
     for (int i = 0; i < array.Length; i++)
     {
         foreach (MonoBehaviour monoBehaviour in InstanceTracker.FindInstancesEnumerable(array[i]))
         {
             if (((IInteractable)monoBehaviour).ShouldShowOnScanner())
             {
                 //Debug.Log("interactable check 1");
                 return(true);
             }
         }
     }
     return(false);
 }
        private bool BossShrineExists(Type[] arr)
        {
            for (int i = 0; i < arr.Length; i++)
            {
                foreach (UnityEngine.MonoBehaviour instances in InstanceTracker.FindInstancesEnumerable(arr[i]))
                {
                    if (((IInteractable)instances).ShouldShowOnScanner())
                    {
                        string item = ((IInteractable)instances).ToString().ToLower();
                        if (item.Contains("shrineboss"))
                        {
                            return(true);
                        }
                    }
                }
            }

            return(false);
        }
        public void Awake()
        {
            On.RoR2.SceneDirector.PopulateScene += (orig, self) =>
            {
                orig(self);
                if (RoR2.SceneInfo.instance.sceneDef.stageOrder == 5)
                {
                    SpawnShrineOfDio(self);
                }
            };

            On.RoR2.ShrineHealingBehavior.FixedUpdate += (orig, self) =>
            {
                if (RoR2.SceneInfo.instance.sceneDef.stageOrder != 5)
                {
                    orig(self);
                    return;
                }
                orig(self);

                if (clientCost == UNINITIALIZED)
                {
                    int piCost = self.GetFieldValue <PurchaseInteraction>("purchaseInteraction").cost;
                    if (piCost != clientCost)
                    {
                        clientCost = piCost;
                        if (clientCost == BALANCED_MODE)
                        {
                            isBalancedMode = true;
                        }
                        else
                        {
                            isBalancedMode = false;
                        }
                        Type[] arr = ((IEnumerable <System.Type>) typeof(ChestRevealer).Assembly.GetTypes()).Where <System.Type>((Func <System.Type, bool>)(t => typeof(IInteractable).IsAssignableFrom(t))).ToArray <System.Type>();
                        for (int i = 0; i < arr.Length; i++)
                        {
                            foreach (UnityEngine.MonoBehaviour instances in InstanceTracker.FindInstancesEnumerable(arr[i]))
                            {
                                if (((IInteractable)instances).ShouldShowOnScanner())
                                {
                                    string item = ((IInteractable)instances).ToString().ToLower();
                                    if (item.Contains("shrinehealing"))
                                    {
                                        UpdateShrineDisplay(instances.GetComponentInParent <ShrineHealingBehavior>());
                                    }
                                }
                                ;
                            }
                        }
                    }
                }
            };

            On.RoR2.ShrineHealingBehavior.Awake += (orig, self) =>
            {
                if (RoR2.SceneInfo.instance.sceneDef.stageOrder != 5)
                {
                    orig(self);
                    return;
                }
                orig(self);

                PurchaseInteraction pi = self.GetFieldValue <PurchaseInteraction>("purchaseInteraction");
                pi.contextToken                = "Offer to the Shrine of empowered Dio";
                pi.displayNameToken            = "Shrine of empowered Dio";
                self.costMultiplierPerPurchase = 4f;



                pi.costType = CostTypeIndex.Money;
                //pi.cost = ResurrectionCost.Value * useCount;
                pi.cost = GetDifficultyScaledCost(ResurrectionCost);
            };

            On.RoR2.ShrineHealingBehavior.AddShrineStack += (orig, self, interactor) =>
            {
                if (RoR2.SceneInfo.instance.sceneDef.stageOrder != 5)
                {
                    orig(self, interactor);
                    return;
                }
                string resurrectionMessage = $"<color=#beeca1>{interactor.GetComponent<CharacterBody>().GetUserName()}</color> gained a <color=#beeca1>Dio</color>";
                Chat.SendBroadcastChat(new Chat.SimpleChatMessage
                {
                    baseToken = resurrectionMessage
                });
                self.SetFieldValue("waitingForRefresh", true);
                self.SetFieldValue("refreshTimer", 2f);
                EffectManager.SpawnEffect(Resources.Load <GameObject>("Prefabs/Effects/ShrineUseEffect"), new EffectData()
                {
                    origin   = self.transform.position,
                    rotation = Quaternion.identity,
                    scale    = 1f,
                    color    = (Color32)Color.red
                }, true);
                // dio
                CharacterBody cb = interactor.GetComponent <CharacterBody>();

                PurchaseInteraction pi = self.GetComponent <PurchaseInteraction>();
                PurchaseInteraction.CreateItemTakenOrb(cb.corePosition, pi.gameObject, RoR2.RoR2Content.Items.ExtraLife.itemIndex);
                cb.inventory.RemoveItem(RoR2.RoR2Content.Items.ExtraLifeConsumed.itemIndex, 1);
                cb.inventory.GiveItem(RoR2.RoR2Content.Items.ExtraLife.itemIndex, 1);
                useCount++;
            };

            On.RoR2.PurchaseInteraction.CanBeAffordedByInteractor += (orig, self, interactor) =>
            {
                if (self.displayNameToken.Contains("Shrine of empowered Dio"))
                {
                    if (interactor.GetComponent <CharacterBody>().inventory.GetItemCount(RoR2.RoR2Content.Items.ExtraLifeConsumed) > 0)
                    {
                        return(orig(self, interactor));
                    }
                    return(false);
                }
                return(orig(self, interactor));
            };
        }
示例#5
0
        public void Awake()
        {
            InitConfig();

            //On.RoR2.PurchaseInteraction.OnTeleporterBeginCharging += PurchaseInteraction_OnTeleporterBeginCharging;

            On.RoR2.OutsideInteractableLocker.LockPurchasable += OutsideInteractableLocker_LockPurchasable;

            On.RoR2.SceneDirector.PlaceTeleporter += (orig, self) =>
                                                     //On.RoR2.SceneDirector.PopulateScene += (orig, self) =>
            {
                orig(self);
                if (!RoR2Application.isInSinglePlayer)
                {
                    SpawnShrineOfDio(self);
                }
            };

            On.RoR2.ShrineHealingBehavior.FixedUpdate += (orig, self) =>
            {
                orig(self);
                if (!NetworkServer.active)
                {
                    if (clientCost == UNINITIALIZED)
                    {
                        int piCost = self.GetFieldValue <PurchaseInteraction>("purchaseInteraction").cost;
                        if (piCost != clientCost)
                        {
                            clientCost = piCost;
                            if (clientCost == BALANCED_MODE)
                            {
                                isBalancedMode = true;
                            }
                            else
                            {
                                isBalancedMode = false;
                            }
                            Type[] arr = ((IEnumerable <System.Type>) typeof(ChestRevealer).Assembly.GetTypes()).Where <System.Type>((Func <System.Type, bool>)(t => typeof(IInteractable).IsAssignableFrom(t))).ToArray <System.Type>();
                            for (int i = 0; i < arr.Length; i++)
                            {
                                foreach (UnityEngine.MonoBehaviour instances in InstanceTracker.FindInstancesEnumerable(arr[i]))
                                {
                                    if (((IInteractable)instances).ShouldShowOnScanner())
                                    {
                                        string item = ((IInteractable)instances).ToString().ToLower();
                                        if (item.Contains("shrinehealing"))
                                        {
                                            UpdateShrineDisplay(instances.GetComponentInParent <ShrineHealingBehavior>());
                                        }
                                    }
                                    ;
                                }
                            }
                        }
                    }
                }
            };

            On.RoR2.Stage.Start += (orig, self) =>
            {
                orig(self);
                if (!RoR2Application.isInSinglePlayer && NetworkServer.active)
                {
                    isDead.Clear();
                }
            };

            On.RoR2.ShrineHealingBehavior.Awake += (orig, self) =>
            {
                orig(self);
                if (!RoR2Application.isInSinglePlayer)
                {
                    PurchaseInteraction pi = self.GetFieldValue <PurchaseInteraction>("purchaseInteraction");
                    pi.contextToken                = "Offer to the Shrine of Dio";
                    pi.displayNameToken            = "Shrine of Dio";
                    self.costMultiplierPerPurchase = 1f;


                    if (NetworkServer.active)
                    {
                        isBalancedMode = UseBalancedMode.Value;
                        if (UseBalancedMode.Value)
                        {
                            pi.costType = CostTypeIndex.None;
                            pi.cost     = BALANCED_MODE;
                            pi.GetComponent <HologramProjector>().displayDistance   = 0f;
                            self.GetComponent <HologramProjector>().displayDistance = 0f;
                        }
                        else
                        {
                            pi.costType = CostTypeIndex.Money;
                            pi.cost     = ResurrectionCost.Value;
                        }
                    }
                    else
                    {
                        clientCost = UNINITIALIZED;
                    }
                }
            };

            On.RoR2.ShrineHealingBehavior.AddShrineStack += (orig, self, interactor) =>
            {
                if (!RoR2Application.isInSinglePlayer)
                {
                    if (NetworkServer.active)
                    {
                        PlayerCharacterMasterController deadCharacter = GetRandomDeadCharacter();
                        isDead.Remove(deadCharacter.networkUser);

                        GameObject prefab = BodyCatalog.GetBodyPrefab(deadCharacter.networkUser.NetworkbodyIndexPreference);
                        if (prefab != null)
                        {
                            deadCharacter.master.bodyPrefab = prefab;
                        }
                        deadCharacter.master.Respawn(deadCharacter.master.GetFieldValue <Vector3>("deathFootPosition"), deadCharacter.master.transform.rotation, true);

                        string resurrectionMessage = $"<color=#beeca1>{interactor.GetComponent<CharacterBody>().GetUserName()}</color> resurrected <color=#beeca1>{deadCharacter.networkUser.userName}</color>";
                        Chat.SendBroadcastChat(new Chat.SimpleChatMessage
                        {
                            baseToken = resurrectionMessage
                        });

                        GameObject spawnEffect = Resources.Load <GameObject>("Prefabs/Effects/HippoRezEffect");
                        EffectManager.SpawnEffect(spawnEffect, new EffectData
                        {
                            origin   = deadCharacter.master.GetBody().footPosition,
                            rotation = deadCharacter.master.gameObject.transform.rotation
                        }, true);
                        self.SetFieldValue("waitingForRefresh", true);
                        self.SetFieldValue("refreshTimer", 2f);
                        EffectManager.SpawnEffect(Resources.Load <GameObject>("Prefabs/Effects/ShrineUseEffect"), new EffectData()
                        {
                            origin   = self.transform.position,
                            rotation = Quaternion.identity,
                            scale    = 1f,
                            color    = (Color32)Color.green
                        }, true);
                        // dio
                        CharacterBody cb = interactor.GetComponent <CharacterBody>();
                        if (UseBalancedMode.Value)
                        {
                            PurchaseInteraction pi = self.GetComponent <PurchaseInteraction>();
                            PurchaseInteraction.CreateItemTakenOrb(cb.corePosition, pi.gameObject, ItemIndex.ExtraLife);
                            cb.inventory.RemoveItem(ItemIndex.ExtraLife, 1);
                            cb.inventory.GiveItem(ItemIndex.ExtraLifeConsumed, 1);
                        }
                    }
                }
                else
                {
                    orig(self, interactor);
                }
            };

            On.RoR2.CharacterMaster.OnBodyDeath += (orig, self, masterbody) =>
            {
                orig(self, masterbody);
                if (!RoR2Application.isInSinglePlayer)
                {
                    if (NetworkServer.active)
                    {
                        if (masterbody.isPlayerControlled)
                        {
                            PlayerCharacterMasterController player = self.GetComponent <PlayerCharacterMasterController>();
                            if (!isDead.Contains(player.networkUser))
                            {
                                isDead.Add(player.networkUser);
                            }
                        }
                    }
                }
            };

            On.RoR2.PurchaseInteraction.CanBeAffordedByInteractor += (orig, self, interactor) =>
            {
                if (!RoR2Application.isInSinglePlayer)
                {
                    if (self.displayNameToken.Contains("Shrine of Dio") || self.displayNameToken.Contains("SHRINE_HEALING"))
                    {
                        if (isBalancedMode)
                        {
                            if (interactor.GetComponent <CharacterBody>().inventory.GetItemCount(ItemIndex.ExtraLife) > 0)
                            {
                                if (IsAnyoneDead())
                                {
                                    return(true);
                                }
                            }
                            return(false);
                        }
                        else
                        {
                            if (IsAnyoneDead())
                            {
                                return(orig(self, interactor));
                            }
                            return(false);
                        }
                    }
                    return(orig(self, interactor));
                }
                return(orig(self, interactor));
            };
        }
示例#6
0
        private void AllocateMarkers()
        {
            foreach (Marker marker in markers)
            {
                Destroy(marker.gameObject);
            }
            markers.Clear();

            if (PlayerCharacterMasterController.instances.Count > 0)
            {
                try
                {
                    CharacterBody body = LocalUserManager.GetFirstLocalUser().currentNetworkUser.GetCurrentBody();
                    if (body != null)
                    {
                        center = body.transform.position;

                        Marker newMarker = UnityEngine.Object.Instantiate <GameObject>(this.markerPrefab, this.rectTranform).GetComponent <Marker>();
                        newMarker.gameObject.SetPosition(0.465f, 0.465f, 0.07f, 0.07f);
                        newMarker.GetComponent <RectTransform>().rotation = Quaternion.Euler(0, 0, 0);
                        this.GetComponent <RectTransform>().rotation      = Quaternion.Euler(0, 0, rotation);
                        newMarker.GetComponent <Image>().sprite           = Marker.PlayerSprite;
                        newMarker.GetComponent <Image>().color            = new Color(50 / 256f, 240 / 256f, 30 / 256f);
                        markers.Add(newMarker);
                    }
                }
                catch
                {
                }
            }


            foreach (PlayerCharacterMasterController other in PlayerCharacterMasterController.instances)
            {
                try
                {
                    if (other.networkUser != LocalUserManager.GetFirstLocalUser().currentNetworkUser&& other.master.GetBodyObject() != null)
                    {
                        AddMarker(other.master.GetBodyObject().transform, 2, new Color(30 / 256f, 160 / 256f, 13 / 256f));
                    }
                }
                catch
                {
                }
            }

            for (int i = 0; i < CharacterMaster.readOnlyInstancesList.Count; i++)
            {
                try
                {
                    CharacterMaster master = CharacterMaster.readOnlyInstancesList[i];
                    if (master == null || master.GetBody() == null)
                    {
                        continue;
                    }
                    CharacterBody body = master.GetBody();
                    if (!body.isPlayerControlled)
                    {
                        Color color = Color.red;
                        float size  = 1.5f;
                        if (body.isElite)
                        {
                            color = Color.blue;
                        }
                        if (body.isBoss)
                        {
                            size = 3;
                        }
                        AddMarker(body.transform, size, color);
                    }
                }
                catch
                {
                }
            }

            Type[] array = MiniMap.typesToCheck;
            for (int i = 0; i < array.Length; i++)
            {
                foreach (MonoBehaviour monoBehaviour in InstanceTracker.FindInstancesEnumerable(array[i]))
                {
                    if (((IInteractable)monoBehaviour).ShouldShowOnScanner())
                    {
                        if (monoBehaviour is PurchaseInteraction)
                        {
                            AddMarker(monoBehaviour.transform, 2, Color.yellow);
                        }
                        else
                        {
                            AddMarker(monoBehaviour.transform, 2, Color.white);
                        }
                    }
                }
            }
        }