コード例 #1
0
        private void MultiShopCardUtils_OnPurchase(On.RoR2.Items.MultiShopCardUtils.orig_OnPurchase orig, CostTypeDef.PayCostContext context, int moneyCost)
        {
            orig(context, moneyCost);
            CharacterMaster activatorMaster = context.activatorMaster;

            if (activatorMaster && activatorMaster.hasBody && activatorMaster.inventory && activatorMaster.inventory.GetItemCount(MysticsItemsContent.Items.MysticsItems_KeepShopTerminalOpen) > 0 && context.purchasedObject)
            {
                ShopTerminalBehavior shopTerminalBehavior = context.purchasedObject.GetComponent <ShopTerminalBehavior>();
                if (shopTerminalBehavior && shopTerminalBehavior.serverMultiShopController)
                {
                    shopTerminalBehavior.serverMultiShopController.SetCloseOnTerminalPurchase(context.purchasedObject.GetComponent <PurchaseInteraction>(), false);
                    activatorMaster.inventory.RemoveItem(MysticsItemsContent.Items.MysticsItems_KeepShopTerminalOpen);
                    activatorMaster.inventory.GiveItem(MysticsItemsContent.Items.MysticsItems_KeepShopTerminalOpenConsumed);

                    RoR2.Audio.PointSoundManager.EmitSoundServer(KeepShopTerminalOpen.sfx.index, shopTerminalBehavior.transform.position);

                    shopTerminalBehavior.serverMultiShopController.Networkcost = (int)(shopTerminalBehavior.serverMultiShopController.Networkcost * (1f - discount / 100f));
                    foreach (var terminal in shopTerminalBehavior.serverMultiShopController.terminalGameObjects)
                    {
                        if (terminal)
                        {
                            var purchaseInteraction = terminal.GetComponent <PurchaseInteraction>();
                            if (purchaseInteraction)
                            {
                                purchaseInteraction.Networkcost = (int)(purchaseInteraction.Networkcost * (1f - discount / 100f));
                            }
                        }
                    }
                }
            }
        }
コード例 #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);
        }
コード例 #3
0
        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));
            }
        }
コード例 #4
0
        /// <summary>
        /// Adds text labels for various interactables to a <see cref="PingIndicator"/>
        /// </summary>
        /// <param name="pingIndicator">Target <see cref="PingIndicator"/> that should have the text added</param>
        private static void AddLootText(RoR2.UI.PingIndicator pingIndicator)
        {
            const string         textStart    = "<size=70%>\n";
            string               price        = GetPrice(pingIndicator.pingTarget);
            ShopTerminalBehavior shopTerminal = pingIndicator.pingTarget.GetComponent <ShopTerminalBehavior>();

            if (shopTerminal && _config.ShowShopText.Value)
            {
                string      text        = textStart;
                PickupIndex pickupIndex = shopTerminal.CurrentPickupIndex();
                PickupDef   pickup      = PickupCatalog.GetPickupDef(pickupIndex);
                text += shopTerminal.pickupIndexIsHidden
                    ? "?"
                    : $"{Language.GetString(pickup.nameToken)}";
                pingIndicator.pingText.text += $"{text} ({price})";
                return;
            }

            GenericPickupController pickupController = pingIndicator.pingTarget.GetComponent <GenericPickupController>();

            if (pickupController && _config.ShowPickupText.Value)
            {
                PickupDef pickup = PickupCatalog.GetPickupDef(pickupController.pickupIndex);
                pingIndicator.pingText.text += $"{textStart}{Language.GetString(pickup.nameToken)}";
            }

            ChestBehavior chest = pingIndicator.pingTarget.GetComponent <ChestBehavior>();

            if (chest && _config.ShowChestText.Value)
            {
                pingIndicator.pingText.text += $"{textStart}{Util.GetBestBodyName(pingIndicator.pingTarget)} ({price})";
                return;
            }

            string name = "";

            PurchaseInteraction purchaseInteraction = pingIndicator.pingTarget.GetComponent <PurchaseInteraction>();

            if (purchaseInteraction)
            {
                name = Language.GetString(purchaseInteraction.displayNameToken);
            }

            // Drones
            SummonMasterBehavior summonMaster = pingIndicator.pingTarget.GetComponent <SummonMasterBehavior>();

            if (summonMaster && _config.ShowDroneText.Value)
            {
                pingIndicator.pingText.text += $"{textStart}{name} ({price})";
                return;
            }

            if (_config.ShowShrineText.Value)
            {
                pingIndicator.pingText.text += $"{textStart}{name}";
            }
        }
コード例 #5
0
ファイル: PingPainter.cs プロジェクト: pixeldesu/Cloudburst
        /// <summary>
        /// Method to get the interactable tier color from a ping target
        /// </summary>
        /// <param name="gameObject">The ping target</param>
        /// <returns>An Color instance of the tier color</returns>
        private Color GetTargetTierColor(GameObject gameObject)
        {
            Color color = Color.black;

            ShopTerminalBehavior shopTerminal = gameObject.GetComponent <ShopTerminalBehavior>();

            if (shopTerminal)
            {
                PickupIndex pickupIndex = shopTerminal.CurrentPickupIndex();
                PickupDef   pickup      = PickupCatalog.GetPickupDef(pickupIndex);

                if (pickup != null)
                {
                    color = pickup.baseColor;
                }
            }

            GenericPickupController pickupController = gameObject.GetComponent <GenericPickupController>();

            if (pickupController)
            {
                PickupDef pickup = PickupCatalog.GetPickupDef(pickupController.pickupIndex);

                if (pickup != null)
                {
                    color = pickup.baseColor;
                }
            }

            PurchaseInteraction purchaseInteraction = gameObject.GetComponent <PurchaseInteraction>();

            if (purchaseInteraction)
            {
                CostTypeDef costType = CostTypeCatalog.GetCostTypeDef(purchaseInteraction.costType);
                color = ColorCatalog.GetColor(costType.colorIndex);
            }

            PickupIndexNetworker pickupIndexNetworker = gameObject.GetComponent <PickupIndexNetworker>();

            if (pickupIndexNetworker)
            {
                PickupDef pickup = PickupCatalog.GetPickupDef(pickupIndexNetworker.NetworkpickupIndex);

                if (pickup != null)
                {
                    color = pickup.baseColor;
                }
            }

            if (color == Color.black)
            {
                color = _colors["InteractablePingColor"];
            }

            return(color);
        }
コード例 #6
0
        public LunarCauldronData(ShopTerminalBehavior lunarCauldron)
        {
            var purchaseInteraction = lunarCauldron.GetComponent <PurchaseInteraction>();

            transform = new SerializableTransform(lunarCauldron.transform);
            cost      = purchaseInteraction.cost;
            costType  = (int)purchaseInteraction.costType;
            tier      = (int)lunarCauldron.itemTier;
            itemIndex = (int)lunarCauldron.CurrentPickupIndex().value;
        }
コード例 #7
0
ファイル: BazaarPodData.cs プロジェクト: Sparse/RoR2-projects
        public BazaarPodData(ShopTerminalBehavior pod)
        {
            transform = new SerializableTransform(pod.transform);

            var purchaseInteraction = pod.GetComponent <PurchaseInteraction>();

            available = purchaseInteraction.available;
            itemIndex = (int)pod.CurrentPickupIndex().value;
            cost      = purchaseInteraction.cost;
        }
コード例 #8
0
        //public bool available;

        //public int cost;
        //public int costType;

        //public int tier;
        //public int itemIndex;

        public ShrineCleanseData(ShopTerminalBehavior shrineCleanse)
        {
            //var purchaseInteraction = shrineCleanse.GetComponent<PurchaseInteraction>();
            //var purchaseInteraction = shrineCleanse;

            transform = new SerializableTransform(shrineCleanse.transform);
            //cost = purchaseInteraction.cost;
            //costType = (int)purchaseInteraction.costType;
            //tier = (int)shrineCleanse.itemTier;
            //itemIndex = (int)shrineCleanse.CurrentPickupIndex().value;
            //available = purchaseInteraction.available;
        }
コード例 #9
0
ファイル: BazaarPodData.cs プロジェクト: Sparse/RoR2-projects
        IEnumerator WaitForStart(ShopTerminalBehavior pod)
        {
            yield return(null);

            if (itemIndex >= (int)ItemIndex.Count)
            {
                pod.SetPickupIndex(new PickupIndex((EquipmentIndex)itemIndex - (int)ItemIndex.Count));
            }
            else
            {
                pod.SetPickupIndex(new PickupIndex((ItemIndex)itemIndex));
            }
        }
コード例 #10
0
        public static string ShopTerminalMessage(ShopTerminalBehavior STB)
        {
            PickupIndex         pickupIdx = STB.CurrentPickupIndex();
            PurchaseInteraction PI        = STB.GetComponent <PurchaseInteraction>();
            string cost          = $"<color={PI.GetColorFromPurchasableType()}>{PI.GetTextFromPurchasableType()}</color>";
            string tierColor     = $"#{ColorUtility.ToHtmlStringRGB(pickupIdx.GetPickupColor())}";
            string tierColorDark = $"#{ColorUtility.ToHtmlStringRGB(pickupIdx.GetPickupColorDark())}";

            if (STB.pickupIndexIsHidden)
            {
                string message = $"<color={tierColor}>??? ({cost}): <color={tierColorDark}>???</color>";
                return(message);
            }
            return(ItemMessage(pickupIdx, cost));
        }
コード例 #11
0
        private void MultiShopController_on_CreateTerminals1(On.RoR2.MultiShopController.orig_CreateTerminals orig, RoR2.MultiShopController self)
        {
            orig(self);
            int  count   = 0;
            bool allSame = true;

            GameObject[]         terminals = self.GetFieldValue <GameObject[]>("terminalGameObjects");
            ShopTerminalBehavior lastSTB   = null;

            foreach (GameObject terminal in terminals)
            {
                var stb = terminal.GetComponent <ShopTerminalBehavior>();
                if (stb)
                {
                    if (stb.pickupIndexIsHidden)
                    {
                        count++;
                    }
                    if (allSame && lastSTB && lastSTB.CurrentPickupIndex() != stb.CurrentPickupIndex())
                    {
                        allSame = false;
                    }
                    lastSTB = stb;
                }
                else
                {
                    count   = -1;
                    allSame = false;
                    base.Logger.LogError("Something was wrong with a terminal, aborting.");
                    break;
                }
            }
            if (count == terminals.Length && lastSTB)
            {
                var pre  = lastSTB.CurrentPickupIndex();
                var pre2 = lastSTB.pickupIndexIsHidden;
                lastSTB.SetPickupIndex(lastSTB.CurrentPickupIndex(), false);
                Logger.LogMessage(string.Format("All question marks. Unhiding the last terminal. ({0},{1} -> {2},{3})", pre, pre2, lastSTB.CurrentPickupIndex(), lastSTB.pickupIndexIsHidden));
            }
            if (allSame && lastSTB)
            {
                var pre  = lastSTB.CurrentPickupIndex();
                var pre2 = lastSTB.pickupIndexIsHidden;
                lastSTB.selfGeneratePickup = true;
                lastSTB.Start();
                Logger.LogMessage(string.Format("All same. Making the last terminal reroll itself. ({0},{1} -> {2},{3})", pre, pre2, lastSTB.CurrentPickupIndex(), lastSTB.pickupIndexIsHidden));
            }
        }
コード例 #12
0
        IEnumerator WaitForStart(ShopTerminalBehavior lunarCauldron)
        {
            yield return(null);

            var purchaseInteraction = lunarCauldron.GetComponent <PurchaseInteraction>();

            lunarCauldron.itemTier = (ItemTier)tier;
            if (itemIndex >= (int)ItemIndex.Count)
            {
                lunarCauldron.SetPickupIndex(new PickupIndex((EquipmentIndex)itemIndex - (int)ItemIndex.Count));
            }
            else
            {
                lunarCauldron.SetPickupIndex(new PickupIndex((ItemIndex)itemIndex));
            }

            purchaseInteraction.Networkcost = cost;
            purchaseInteraction.costType    = (CostTypeIndex)costType;
        }
コード例 #13
0
        public void SetUnlockedItemNotification(RoR2.UI.PingIndicator pingIndicator)
        {
            GenericPickupController pickupController = pingIndicator.pingTarget.GetComponent <GenericPickupController>();

            if (pickupController && _config.ShowItemNotification.Value)
            {
                BuildNotification(pickupController.pickupIndex, pingIndicator);
            }

            PurchaseInteraction purchaseInteraction = pingIndicator.pingTarget.GetComponent <PurchaseInteraction>();

            if (purchaseInteraction && _config.ShowItemNotification.Value)
            {
                ShopTerminalBehavior shopTerminalBehavior = purchaseInteraction.GetComponent <ShopTerminalBehavior>();
                if (shopTerminalBehavior && !shopTerminalBehavior.pickupIndexIsHidden)
                {
                    BuildNotification(shopTerminalBehavior.CurrentPickupIndex(), pingIndicator);
                }
            }
        }
コード例 #14
0
            // Token: 0x0600261B RID: 9755 RVA: 0x000B0334 File Offset: 0x000AE534
            private void OnItemSpentOnPurchase(PurchaseInteraction purchaseInteraction, Interactor interactor)
            {
                CharacterBody currentBody = this.serverAchievementTracker.networkUser.GetCurrentBody();

                if (currentBody && currentBody.GetComponent <Interactor>() == interactor && purchaseInteraction.gameObject.name.Contains("Duplicator"))
                {
                    ShopTerminalBehavior component = purchaseInteraction.GetComponent <ShopTerminalBehavior>();
                    if (component)
                    {
                        ItemIndex itemIndex = component.CurrentPickupIndex().itemIndex;
                        if (this.trackingItemIndex != itemIndex)
                        {
                            this.trackingItemIndex = itemIndex;
                            this.progress          = 0;
                        }
                        this.progress++;
                        if (this.progress >= 7)
                        {
                            base.Grant();
                        }
                    }
                }
            }
コード例 #15
0
ファイル: ExtraInfo.cs プロジェクト: Grantimatter/RoR2Mods
 private void Terminal_DropPickup(On.RoR2.ShopTerminalBehavior.orig_DropPickup o, ShopTerminalBehavior s)
 {
     o(s);
     terminalsUsed++;
     //if(s.)
     UpdateTextArea(StageStatsTextAreaName);
 }
コード例 #16
0
ファイル: PrinterData.cs プロジェクト: Sparse/RoR2-projects
        IEnumerator WaitForStart(ShopTerminalBehavior printer)
        {
            yield return(new WaitWhile(() => printer.CurrentPickupIndex().value != -1));

            printer.SetPickupIndex(new PickupIndex((ItemIndex)itemIndex));
        }
コード例 #17
0
        private static void OnPurchaseDrop(On.RoR2.ShopTerminalBehavior.orig_DropPickup orig, ShopTerminalBehavior self)
        {
            if (!NetworkServer.active)
            {
                orig(self);
                return;
            }

            var costType = self.GetComponent <PurchaseInteraction>().costType;

            if (!GeneralHooks.IsMultiplayer() || // is not multiplayer
                !IsValidItemPickup(self.CurrentPickupIndex()) || // item is not shared
                !ShareSuite.PrinterCauldronFixEnabled.Value || // dupe fix isn't enabled
                self.itemTier == ItemTier.Lunar ||
                costType == CostTypeIndex.Money)
            {
                orig(self);
            }
        }
コード例 #18
0
 public void Awake()
 {
     purchaseInteraction  = gameObject.GetComponent <PurchaseInteraction>();
     shopTerminalBehavior = gameObject.GetComponent <ShopTerminalBehavior>();
 }
コード例 #19
0
 private static void ShopTerminalBehavior_SetPickupIndex(On.RoR2.ShopTerminalBehavior.orig_SetPickupIndex orig, ShopTerminalBehavior self, PickupIndex newPickupIndex, bool newHidden)
 {
     if (newPickupIndex != PickupIndex.none && MysticsRisky2Utils.Utils.TrimCloneFromString(self.gameObject.name).Contains("LunarShopTerminal"))
     {
         if (newPickupIndex != tonicPickupIndex && newPickupIndex != gesturePickupIndex)
         {
             newPickupIndex = (lunarBudIndex % 5) == 0 ? tonicPickupIndex : gesturePickupIndex;
             lunarBudIndex++;
         }
     }
     orig(self, newPickupIndex, newHidden);
 }
コード例 #20
0
 private static void ShopTerminalBehavior_Start(On.RoR2.ShopTerminalBehavior.orig_Start orig, ShopTerminalBehavior self)
 {
     orig(self);
     if (MysticsRisky2Utils.Utils.TrimCloneFromString(self.gameObject.name).Contains("LunarShopTerminal"))
     {
         self.SetPickupIndex((lunarBudIndex % 5) == 0 ? tonicPickupIndex : gesturePickupIndex);
         lunarBudIndex++;
         var purchaseInteraction = self.GetComponent <PurchaseInteraction>();
         if (purchaseInteraction)
         {
             purchaseInteraction.onPurchase.AddListener((interactor) =>
             {
                 if (!finished)
                 {
                     if (interactor)
                     {
                         var body = interactor.GetComponent <CharacterBody>();
                         if (body && body.master && body.master.playerCharacterMasterController)
                         {
                             var pcmc = body.master.playerCharacterMasterController;
                             if (pcmc.networkUser)
                             {
                                 pcmc.networkUser.AwardLunarCoins((uint)purchaseInteraction.cost);
                             }
                         }
                     }
                     finishTimer = 5f;
                 }
             });
         }
     }
 }
コード例 #21
0
ファイル: UIAMain.cs プロジェクト: DestroyedClone/PoseHelper
 private void DisableTerminalOnPurchase(On.RoR2.ShopTerminalBehavior.orig_SetHasBeenPurchased orig, ShopTerminalBehavior self, bool newHasBeenPurchased)
 {
     orig(self, newHasBeenPurchased);
     if (newHasBeenPurchased && self.NetworkhasBeenPurchased == newHasBeenPurchased)
     {
         var com = self.GetComponent <PurchaseInteraction>();
         com.costType    = CostTypeIndex.VolatileBattery;
         com.Networkcost = 2;
     }
 }
コード例 #22
0
        private void MultiShopController_on_CreateTerminals1(On.RoR2.MultiShopController.orig_CreateTerminals orig, RoR2.MultiShopController self)
        {
            orig(self);

            int questionCount          = 0;
            int sameCount              = 0;
            List <PickupIndex> pickups = new List <PickupIndex>();

            Xoroshiro128Plus rng = self.GetFieldValue <Xoroshiro128Plus>("rng");

            GameObject[]           terminals = self.GetFieldValue <GameObject[]>("terminalGameObjects");
            ShopTerminalBehavior[] behaviors = new ShopTerminalBehavior[3];
            for (int i = 0; i < 3; i++)
            {
                GameObject           terminal = terminals[i];
                ShopTerminalBehavior stb      = terminal.GetComponent <ShopTerminalBehavior>();

                behaviors[i] = stb;
                if (stb)
                {
                    bool shopDirty = false;
                    bool hidden    = stb.pickupIndexIsHidden;
                    if (hidden)
                    {
                        questionCount++;
                        if (questionCount > maxQuestions.Value)
                        {
                            hidden     = false;
                            shopDirty |= true;
                        }
                    }
                    PickupIndex pickupIndex = stb.CurrentPickupIndex();
                    if (pickups.Contains(pickupIndex))
                    {
                        sameCount++;
                        if (sameCount > maxSame.Value)
                        {
                            shopDirty |= true;
                            switch (self.itemTier)
                            {
                            case ItemTier.Tier1:
                                pickupIndex = rng.NextElementUniform(Run.instance.availableTier1DropList);
                                break;

                            case ItemTier.Tier2:
                                pickupIndex = rng.NextElementUniform(Run.instance.availableTier2DropList);
                                break;

                            case ItemTier.Tier3:
                                pickupIndex = rng.NextElementUniform(Run.instance.availableTier3DropList);
                                break;

                            case ItemTier.Lunar:
                                pickupIndex = rng.NextElementUniform(Run.instance.availableLunarDropList);
                                break;
                            }
                        }
                    }
                    pickups.Add(pickupIndex);

                    if (shopDirty)
                    {
                        stb.SetPickupIndex(pickupIndex, hidden);
                    }
                }
                else
                {
                    TweakLogger.LogWarning("MultiShopImprovements", "Something was wrong with a terminal, aborting.");
                    return;
                }
            }
            while (questionCount > maxQuestions.Value)
            {
                questionCount--;
                behaviors[questionCount].SetPickupIndex(pickups[questionCount], false);
            }
            if (sameCount > maxSame.Value)
            {
            }
        }
コード例 #23
0
ファイル: UIAMain.cs プロジェクト: DestroyedClone/PoseHelper
        private void ShopTerminalBehavior_GenerateNewPickupServer(On.RoR2.ShopTerminalBehavior.orig_GenerateNewPickupServer orig, ShopTerminalBehavior self)
        {
            bool tierAvailable = ItemTierAvailable(self.itemTier);

            if (tierAvailable)
            {
                orig(self);
            }
        }
コード例 #24
0
        private static void OnPurchaseDrop(On.RoR2.ShopTerminalBehavior.orig_DropPickup orig, ShopTerminalBehavior self)
        {
            if (!NetworkServer.active)
            {
                orig(self);
                return;
            }

            var costType = self.GetComponent <PurchaseInteraction>().costType;

            //If is valid drop and dupe fix not enabled, true -> we want the item to pop
            //if is valid drop and dupe fix is enabled, false -> item IS shared, we don't want the item to pop, PrinterCauldronFix should deal with this
            //if is not valid drop and dupe fix is not enabled, true -> item ISN'T shared, and dupe fix isn't enabled, we want to pop
            //if is not valid drop and dupe fix is enabled, false -> item ISN'T shared, dupe fix should catch, we don't want to pop

            if (!GeneralHooks.IsMultiplayer() || // is not multiplayer
                (!IsValidItemPickup(self.CurrentPickupIndex()) && !ShareSuite.PrinterCauldronFixEnabled.Value)
                //if it's not a valid drop AND the dupe fix isn't enabled
                || self.itemTier == ItemTier.Lunar ||
                costType == CostTypeIndex.Money ||
                costType == CostTypeIndex.None)
            {
                orig(self);
            }
            else if (!ShareSuite.PrinterCauldronFixEnabled.Value && printerCosts.Contains(costType))
            {
                orig(self);
            }
        }
コード例 #25
0
            void GenerateNewPickupServer(On.RoR2.ShopTerminalBehavior.orig_GenerateNewPickupServer orig, ShopTerminalBehavior shopTerminalBehavior)
            {
                List <PickupIndex> shopList = new List <PickupIndex>();

                if (shopTerminalBehavior.itemTier == ItemTier.Tier1)
                {
                    shopList = Run.instance.availableTier1DropList;
                }
                else if (shopTerminalBehavior.itemTier == ItemTier.Tier2)
                {
                    shopList = Run.instance.availableTier2DropList;
                }
                else if (shopTerminalBehavior.itemTier == ItemTier.Tier3)
                {
                    shopList = Run.instance.availableTier3DropList;
                }
                else if (shopTerminalBehavior.itemTier == ItemTier.Boss)
                {
                    shopList = Run.instance.availableBossDropList;
                }
                else if (shopTerminalBehavior.itemTier == ItemTier.Lunar)
                {
                    shopList = Run.instance.availableLunarDropList;
                }
                if (shopList.Count > 0)
                {
                    orig(shopTerminalBehavior);
                }
                else
                {
                    shopTerminalBehavior.SetNoPickup();
                    RoR2.PurchaseInteraction purchaseInteraction = shopTerminalBehavior.GetComponent <RoR2.PurchaseInteraction>();
                    if (purchaseInteraction != null)
                    {
                        purchaseInteraction.SetAvailable(false);
                    }
                }
            }
コード例 #26
0
ファイル: PrinterData.cs プロジェクト: Sparse/RoR2-projects
 public PrinterData(ShopTerminalBehavior printer)
 {
     transform = new SerializableTransform(printer.transform);
     itemIndex = (int)printer.CurrentPickupIndex().itemIndex;
     name      = printer.name.Replace("(Clone)", "");
 }
コード例 #27
0
        // Token: 0x06002342 RID: 9026 RVA: 0x000A5E0C File Offset: 0x000A400C
        public void RebuildPing()
        {
            base.transform.rotation = Util.QuaternionSafeLookRotation(this.pingNormal);
            base.transform.parent   = (this.pingTarget ? this.pingTarget.transform : null);
            base.transform.position = (this.pingTarget ? this.pingTarget.transform.position : this.pingOrigin);
            this.positionIndicator.targetTransform = (this.pingTarget ? this.pingTarget.transform : null);
            this.positionIndicator.defaultPosition = base.transform.position;
            IDisplayNameProvider componentInParent = base.GetComponentInParent <IDisplayNameProvider>();
            ModelLocator         modelLocator      = null;

            this.pingType = PingIndicator.PingType.Default;
            this.pingObjectScaleCurve.enabled = false;
            this.pingObjectScaleCurve.enabled = true;
            GameObject[] array = this.defaultPingGameObjects;
            for (int i = 0; i < array.Length; i++)
            {
                array[i].SetActive(false);
            }
            array = this.enemyPingGameObjects;
            for (int i = 0; i < array.Length; i++)
            {
                array[i].SetActive(false);
            }
            array = this.interactablePingGameObjects;
            for (int i = 0; i < array.Length; i++)
            {
                array[i].SetActive(false);
            }
            if (this.pingTarget)
            {
                Debug.LogFormat("Ping target {0}", new object[]
                {
                    this.pingTarget
                });
                modelLocator = this.pingTarget.GetComponent <ModelLocator>();
                if (componentInParent != null)
                {
                    CharacterBody component = this.pingTarget.GetComponent <CharacterBody>();
                    if (component)
                    {
                        this.pingType           = PingIndicator.PingType.Enemy;
                        base.transform.parent   = component.coreTransform;
                        base.transform.position = component.coreTransform.position;
                    }
                    else
                    {
                        this.pingType = PingIndicator.PingType.Interactable;
                    }
                }
            }
            string displayName = this.pingOwner.GetComponent <PlayerCharacterMasterController>().GetDisplayName();
            string text        = (componentInParent != null) ? componentInParent.GetDisplayName() : "";

            this.pingText.enabled = true;
            this.pingText.text    = displayName;
            switch (this.pingType)
            {
            case PingIndicator.PingType.Default:
                this.pingColor          = this.defaultPingColor;
                this.pingDuration       = this.defaultPingDuration;
                this.pingHighlight.isOn = false;
                array = this.defaultPingGameObjects;
                for (int i = 0; i < array.Length; i++)
                {
                    array[i].SetActive(true);
                }
                Chat.AddMessage(string.Format(Language.GetString("PLAYER_PING_DEFAULT"), displayName));
                break;

            case PingIndicator.PingType.Enemy:
                this.pingColor    = this.enemyPingColor;
                this.pingDuration = this.enemyPingDuration;
                array             = this.enemyPingGameObjects;
                for (int i = 0; i < array.Length; i++)
                {
                    array[i].SetActive(true);
                }
                if (modelLocator)
                {
                    Transform modelTransform = modelLocator.modelTransform;
                    if (modelTransform)
                    {
                        CharacterModel component2 = modelTransform.GetComponent <CharacterModel>();
                        if (component2)
                        {
                            bool flag = false;
                            foreach (CharacterModel.RendererInfo rendererInfo in component2.rendererInfos)
                            {
                                if (!rendererInfo.ignoreOverlays && !flag)
                                {
                                    this.pingHighlight.highlightColor = Highlight.HighlightColor.teleporter;
                                    this.pingHighlight.targetRenderer = rendererInfo.renderer;
                                    this.pingHighlight.strength       = 1f;
                                    this.pingHighlight.isOn           = true;
                                    flag = true;
                                }
                            }
                        }
                    }
                    Chat.AddMessage(string.Format(Language.GetString("PLAYER_PING_ENEMY"), displayName, text));
                }
                break;

            case PingIndicator.PingType.Interactable:
            {
                this.pingColor    = this.interactablePingColor;
                this.pingDuration = this.interactablePingDuration;
                this.pingTargetPurchaseInteraction = this.pingTarget.GetComponent <PurchaseInteraction>();
                Sprite               sprite     = Resources.Load <Sprite>("Textures/MiscIcons/texInventoryIconOutlined");
                SpriteRenderer       component3 = this.interactablePingGameObjects[0].GetComponent <SpriteRenderer>();
                ShopTerminalBehavior component4 = this.pingTarget.GetComponent <ShopTerminalBehavior>();
                if (component4)
                {
                    PickupIndex pickupIndex = component4.CurrentPickupIndex();
                    text = string.Format(CultureInfo.InvariantCulture, "{0} ({1})", text, component4.pickupIndexIsHidden ? "?" : Language.GetString(pickupIndex.GetPickupNameToken()));
                }
                else if (this.pingTarget.gameObject.name.Contains("Shrine"))
                {
                    sprite = Resources.Load <Sprite>("Textures/MiscIcons/texShrineIconOutlined");
                }
                else if (this.pingTarget.GetComponent <GenericPickupController>())
                {
                    sprite            = Resources.Load <Sprite>("Textures/MiscIcons/texLootIconOutlined");
                    this.pingDuration = 60f;
                }
                else if (this.pingTarget.GetComponent <TeleporterInteraction>())
                {
                    sprite            = Resources.Load <Sprite>("Textures/MiscIcons/texTeleporterIconOutlined");
                    this.pingDuration = 60f;
                }
                else if (this.pingTarget.GetComponent <SummonMasterBehavior>())
                {
                    sprite = Resources.Load <Sprite>("Textures/MiscIcons/texDroneIconOutlined");
                }
                array = this.interactablePingGameObjects;
                for (int i = 0; i < array.Length; i++)
                {
                    array[i].SetActive(true);
                }
                base.transform.parent.GetComponentInChildren <Renderer>();
                Renderer componentInChildren;
                if (modelLocator)
                {
                    componentInChildren = modelLocator.modelTransform.GetComponentInChildren <Renderer>();
                }
                else
                {
                    componentInChildren = base.transform.parent.GetComponentInChildren <Renderer>();
                }
                if (componentInChildren)
                {
                    this.pingHighlight.highlightColor = Highlight.HighlightColor.interactive;
                    this.pingHighlight.targetRenderer = componentInChildren;
                    this.pingHighlight.strength       = 1f;
                    this.pingHighlight.isOn           = true;
                }
                component3.sprite = sprite;
                Chat.AddMessage(string.Format(Language.GetString("PLAYER_PING_INTERACTABLE"), displayName, text));
                break;
            }
            }
            this.pingText.color = this.textBaseColor * this.pingColor;
            this.fixedTimer     = this.pingDuration;
        }