public void Start()
            {
                RoR2.EntityLogic.DelayedEvent delayedEvent = GetComponent <RoR2.EntityLogic.DelayedEvent>();
                delayedEvent.action = new UnityEvent();
                delayedEvent.action.AddListener(() =>
                {
                    AddShrineStack(purchaseInteraction.lastActivator);
                });
                delayedEvent.timeStepType = RoR2.EntityLogic.DelayedEvent.TimeStepType.FixedTime;

                purchaseInteraction = GetComponent <PurchaseInteraction>();
                purchaseInteraction.onPurchase.AddListener((interactor) =>
                {
                    purchaseInteraction.SetAvailable(false);
                    delayedEvent.CallDelayed(1.5f);
                });

                availableItems = new List <ItemIndex>();
                if (NetworkServer.active)
                {
                    rng = new Xoroshiro128Plus(Run.instance.stageRng.nextUlong);
                    foreach (PickupIndex pickupIndex in Run.instance.availableTier3DropList)
                    {
                        availableItems.Add(PickupCatalog.GetPickupDef(pickupIndex).itemIndex);
                    }
                }
            }
Пример #2
0
        public override bool OnUse(EquipmentSlot equipmentSlot)
        {
            MysticsRisky2UtilsEquipmentTarget targetInfo = equipmentSlot.GetComponent <MysticsRisky2UtilsEquipmentTarget>();

            if (targetInfo)
            {
                if (targetInfo.obj)
                {
                    PurchaseInteraction purchaseInteraction = targetInfo.obj.GetComponent <MysticsItemsDuplicatorLocator>().purchaseInteraction;
                    purchaseInteraction.SetAvailable(false);
                    purchaseInteraction.lockGameObject = null;
                    ShopTerminalBehavior shopTerminalBehavior = targetInfo.obj.GetComponent <MysticsItemsDuplicatorLocator>().shopTerminalBehavior;
                    EffectManager.SimpleEffect(LegacyResourcesAPI.Load <GameObject>("Prefabs/Effects/OmniEffect/OmniRecycleEffect"), shopTerminalBehavior.pickupDisplay.transform.position, Quaternion.identity, true);
                    shopTerminalBehavior.SetHasBeenPurchased(true);
                    for (var i = 0; i < amount; i++)
                    {
                        PickupDropletController.CreatePickupDroplet(
                            shopTerminalBehavior.pickupIndex,
                            (shopTerminalBehavior.dropTransform ? shopTerminalBehavior.dropTransform : shopTerminalBehavior.transform).position,
                            shopTerminalBehavior.transform.TransformVector(shopTerminalBehavior.dropVelocity)
                            );
                    }
                    shopTerminalBehavior.SetNoPickup();
                    targetInfo.Invalidate();
                    return(true);
                }
            }
            return(false);
        }
        // Token: 0x06000606 RID: 1542 RVA: 0x0001BC5C File Offset: 0x00019E5C
        protected void SetReady(bool ready)
        {
            Transform modelTransform = base.GetModelTransform();

            if (modelTransform)
            {
                PrintController component = modelTransform.GetComponent <PrintController>();
                component.paused = !ready;
                if (!ready)
                {
                    component.age = 0f;
                }
                ChildLocator component2 = modelTransform.GetComponent <ChildLocator>();
                if (component2)
                {
                    component2.FindChild("Purchased").gameObject.SetActive(ready);
                }
            }
            PurchaseInteraction component3 = base.GetComponent <PurchaseInteraction>();

            if (component3)
            {
                component3.SetAvailable(!ready);
            }
            HologramProjector component4 = base.GetComponent <HologramProjector>();

            if (component4)
            {
                component4.hologramPivot.gameObject.SetActive(!ready);
            }
        }
Пример #4
0
        /*
         * protected override bool ActivateEquipment(EquipmentSlot slot)
         * {
         *  //Hacking Main State
         *  SphereSearch sphereSearch = new SphereSearch
         *  {
         *      origin = slot.characterBody.footPosition,
         *      mask = LayerIndex.CommonMasks.interactable,
         *      queryTriggerInteraction = QueryTriggerInteraction.Collide,
         *      radius = 3f
         *  };
         *
         *  List<Collider> list = CollectionPool<Collider, List<Collider>>.RentCollection();
         *  sphereSearch.ClearCandidates();
         *  sphereSearch.RefreshCandidates();
         *  sphereSearch.FilterCandidatesByColliderEntities();
         *  sphereSearch.OrderCandidatesByDistance();
         *  sphereSearch.FilterCandidatesByDistinctColliderEntities();
         *  sphereSearch.GetColliders(list);
         *  PurchaseInteraction result = null;
         *  int i = 0;
         *  int count = list.Count;
         *  int keyAmount = 0;
         *  while (i < count)
         *  {
         *      PurchaseInteraction component = list[i].GetComponent<EntityLocator>().entity.GetComponent<PurchaseInteraction>();
         *      if (EntityStates.CaptainSupplyDrop.HackingMainState.PurchaseInteractionIsValidTarget(component))
         *      {
         *          switch (component.displayNameToken)
         *          {
         *              case "CHEST1_NAME":
         *              case "CHEST1_STEALTHED_NAME":
         *                  keyAmount = cfgNormalKeys.Value;
         *                  break;
         *              case "CHEST2_NAME":
         *                  keyAmount = cfgMediumKeys.Value;
         *                  break;
         *              case "GOLDCHEST_NAME":
         *                  keyAmount = cfgLegendaryKeys.Value;
         *                  break;
         *              default:
         *                  continue;
         *          };
         *          result = component;
         *          break;
         *      }
         *      i++;
         *  }
         *  CollectionPool<Collider, List<Collider>>.ReturnCollection(list);
         *
         *  ScrapChest(result, keyAmount);
         *
         *
         *  return false;
         * }
         */
        private void ScrapChest(PurchaseInteraction purchaseInteraction, int keyAmount)
        {
            purchaseInteraction.SetAvailable(false);

            PickupIndex pickupIndex2 = PickupCatalog.FindPickupIndex(RoR2Content.Items.TreasureCache.itemIndex);

            for (int i = 0; i < keyAmount; i++)
            {
                PickupDropletController.CreatePickupDroplet(pickupIndex2, purchaseInteraction.transform.position, Vector3.up * i);
            }
        }
 public void FixedUpdate()
 {
     if (waitingForRefresh)
     {
         refreshTimer -= Time.fixedDeltaTime;
         if (refreshTimer <= 0f && purchaseCount < maxPurchaseCount)
         {
             purchaseInteraction.SetAvailable(true);
             purchaseInteraction.Networkcost = (int)(100f * (1f - Mathf.Pow(1f - (float)purchaseInteraction.cost / 100f, costMultiplierPerPurchase)));
             waitingForRefresh = false;
         }
     }
 }
        public void Update()
        {
            //BetterShrines.Print(Run.instance.difficultyCoefficient);

            if (timesUsed < maxUses)
            {
                if (inUse)
                {
                    stopwatch -= Time.deltaTime;
                    if (stopwatch < 0)
                    {
                        inUse = false;
                    }
                }
                else
                {
                    if (IsAnyoneDead())
                    {
                        symbolTransform.gameObject.SetActive(true);
                        isAvailable = true;
                        //if (NetworkServer.active)
                        //{
                        //purchaseInteraction.SetAvailable(true);
                        //	Debug.Log("Someone is dead.");
                        //}
                    }
                    else
                    {
                        symbolTransform.gameObject.SetActive(false);
                        isAvailable = false;
                        //if (NetworkServer.active)
                        //{
                        //purchaseInteraction.SetAvailable(false);
                        //	Debug.Log("No one is dead.");
                        //}
                    }
                }
            }
            else
            {
                symbolTransform.gameObject.SetActive(false);
                isAvailable = false;
                if (NetworkServer.active)
                {
                    purchaseInteraction.SetAvailable(false);
                }
            }
        }
Пример #7
0
 public void FixedUpdate()
 {
     if (delay > 0f)
     {
         delay -= Time.fixedDeltaTime;
         if (delay <= 0f)
         {
             purchaseInteraction.Networkcost = 0;
             purchaseInteraction.SetAvailable(true);
             if (interactor)
             {
                 interactor.AttemptInteraction(purchaseInteraction.gameObject);
             }
         }
     }
 }
Пример #8
0
            public void Awake()
            {
                purchaseInteraction            = GetComponent <PurchaseInteraction>();
                purchaseInteraction.onPurchase = new PurchaseEvent();
                purchaseInteraction.onPurchase.AddListener((interactor) =>
                {
                    purchaseInteraction.SetAvailable(false);
                    GetComponent <ChestBehavior>().ItemDrop();
                    DestroyThingsOnOpen();
                });

                positionIndicator = Object.Instantiate <GameObject>(riftPositionIndicator, transform.position, Quaternion.identity).GetComponent <PositionIndicator>();
                positionIndicator.targetTransform = transform;

                UpdateLock();
            }
Пример #9
0
        private void Interactor_PerformInteraction(On.RoR2.Interactor.orig_PerformInteraction orig, Interactor self, GameObject interactableObject)
        {
            PurchaseInteraction purchaseInteraction = interactableObject.GetComponent <PurchaseInteraction>();

            if (purchaseInteraction)
            {
                TrustyLockpicksComponent component = interactableObject.GetComponent <TrustyLockpicksComponent>();
                if (!component || (component && !component.failed))
                {
                    CharacterBody characterBody = self.GetComponent <CharacterBody>();
                    if (characterBody)
                    {
                        Inventory inventory = characterBody.inventory;
                        if (inventory)
                        {
                            int InventoryCount = characterBody.inventory.GetItemCount(catalogIndex);
                            if (InventoryCount > 0)
                            {
                                purchaseInteraction.GetInteractability(self);

                                if (purchaseInteraction.isShrine == false && purchaseInteraction.available && purchaseInteraction.costType == CostTypeIndex.Money) //if not shrine, is available, and is not a lunar pod
                                {
                                    purchaseInteraction.SetAvailable(false);
                                    purchaseInteraction.Networkavailable = false;

                                    purchaseInteraction.gameObject.GetComponent <ChestBehavior>().Open();

                                    //purchaseInteraction.cost = 0;
                                    //purchaseInteraction.Networkcost = 0;

                                    purchaseInteraction.onPurchase.Invoke(self);
                                    purchaseInteraction.lastActivator = self;

                                    inventory.RemoveItem(catalogIndex);
                                }
                            }
                        }
                    }
                }
            }
            orig(self, interactableObject);
        }
Пример #10
0
        private bool AttemptUnlock(GameObject chestObject, InteractionDriver interactionDriver, float UnlockChance)
        {
            if (!interactionDriver)
            {
                return(false);
            }
            Highlight           highlight           = chestObject.GetComponent <Highlight>();
            PurchaseInteraction purchaseInteraction = chestObject.GetComponent <PurchaseInteraction>();

            if (!highlight || !purchaseInteraction)
            {
                return(false);
            }
            BulletstormChestInteractorComponent chestComponent = chestObject.GetComponent <BulletstormChestInteractorComponent>();

            if (chestComponent && chestComponent.hasUsedLockpicks)
            {
                return(false);
            }

            GameObject selectedEffect = UnlockEffect;
            Vector3    offset         = Vector3.up * 1f;


            if (!purchaseInteraction.isShrine && purchaseInteraction.available && purchaseInteraction.costType == CostTypeIndex.Money)
            {
                Interactor interactor = interactionDriver.interactor;
                //interactionDriver.interactor.AttemptInteraction(chestObject);
                if (Util.CheckRoll(UnlockChance))
                {
                    purchaseInteraction.SetAvailable(false);
                    //purchaseInteraction.Networkavailable = false;

                    purchaseInteraction.gameObject.GetComponent <ChestBehavior>().Open();

                    //purchaseInteraction.cost = 0;
                    //purchaseInteraction.Networkcost = 0;

                    purchaseInteraction.onPurchase.Invoke(interactor);
                    purchaseInteraction.lastActivator = interactor;
                    Util.PlaySound(UnlockSound, interactor.gameObject);
                    EffectManager.SimpleEffect(UnlockEffect, chestObject.transform.position + offset, Quaternion.identity, true);
                }
                else
                {
                    purchaseInteraction.cost = Mathf.CeilToInt(purchaseInteraction.cost * cfgPriceMultiplier.Value);
                    //https://discord.com/channels/562704639141740588/562704639569428506/916819003064864788
                    purchaseInteraction.Networkcost = purchaseInteraction.cost; //weaver generated shit ^
                    selectedEffect = Fail_LockEffect;

                    //purchaseInteraction.displayNameToken = (prefix + purchaseInteraction.displayNameToken);
                    chestObject.AddComponent <BulletstormChestInteractorComponent>().hasUsedLockpicks = true; //does this even work? lol
                    EffectManager.SimpleEffect(selectedEffect, chestObject.transform.position + offset, Quaternion.identity, true);
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
        private bool AttemptUnlock(GameObject chestObject, InteractionDriver interactionDriver, float UnlockChance)
        {
            Highlight           highlight           = chestObject.GetComponent <Highlight>();
            PurchaseInteraction purchaseInteraction = chestObject.GetComponent <PurchaseInteraction>();

            if (!highlight)
            {
                return(false);
            }
            if (!purchaseInteraction)
            {
                return(false);
            }
            TrustyLockpicksComponent component = chestObject.GetComponent <TrustyLockpicksComponent>();

            if (component && component.failed)
            {
                return(false);
            }
            if (!interactionDriver)
            {
                return(false);
            }

            GameObject selectedEffect;
            Vector3    offset = Vector3.up * 1f;


            if (!purchaseInteraction.isShrine && purchaseInteraction.available && purchaseInteraction.costType == CostTypeIndex.Money)
            {
                Interactor interactor = interactionDriver.interactor;
                //interactionDriver.interactor.AttemptInteraction(chestObject);
                if (Util.CheckRoll(UnlockChance))
                {
                    purchaseInteraction.SetAvailable(false);
                    purchaseInteraction.Networkavailable = false;

                    purchaseInteraction.gameObject.GetComponent <ChestBehavior>().Open();

                    //purchaseInteraction.cost = 0;
                    //purchaseInteraction.Networkcost = 0;

                    purchaseInteraction.onPurchase.Invoke(interactor);
                    purchaseInteraction.lastActivator = interactor;
                    Util.PlaySound(unlockSound, interactor.gameObject);
                    EffectManager.SimpleEffect(UnlockEffect, chestObject.transform.position + offset, Quaternion.identity, true);
                }
                else
                {
                    //var displaynamecomponent = chestObject.GetComponent<GenericDisplayNameProvider>();
                    //if (displaynamecomponent) displaynamecomponent.displayToken = prefix + displaynamecomponent.displayToken;
                    if (TrustyLockpicks_KillChest)
                    {
                        purchaseInteraction.costType = CostTypeIndex.None;
                        purchaseInteraction.SetAvailable(false);

                        selectedEffect = Fail_DestroyEffect;
                    }
                    else
                    {
                        purchaseInteraction.cost        = Mathf.CeilToInt(purchaseInteraction.cost * TrustyLockpicks_PriceHike);
                        purchaseInteraction.Networkcost = purchaseInteraction.cost;
                        selectedEffect = Fail_LockEffect;
                    }
                    purchaseInteraction.displayNameToken = (prefix + purchaseInteraction.displayNameToken);
                    chestObject.AddComponent <TrustyLockpicksComponent>().failed = true; //does this even work? lol
                    EffectManager.SimpleEffect(selectedEffect, chestObject.transform.position + offset, Quaternion.identity, true);
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }