static Shop()
        {
            bottomFrames = new[]
            {
                AreaRando.GetSprite("Anim.Shop.BottomFleur.2"),
                AreaRando.GetSprite("Anim.Shop.BottomFleur.3"),
                AreaRando.GetSprite("Anim.Shop.BottomFleur.4"),
                AreaRando.GetSprite("Anim.Shop.BottomFleur.5"),
                AreaRando.GetSprite("Anim.Shop.BottomFleur.6"),
                AreaRando.GetSprite("Anim.Shop.BottomFleur.7"),
                AreaRando.GetSprite("Anim.Shop.BottomFleur.8")
            };

            topFrames = new[]
            {
                AreaRando.GetSprite("Anim.Shop.TopFleur.0"),
                AreaRando.GetSprite("Anim.Shop.TopFleur.1"),
                AreaRando.GetSprite("Anim.Shop.TopFleur.2"),
                AreaRando.GetSprite("Anim.Shop.TopFleur.3"),
                AreaRando.GetSprite("Anim.Shop.TopFleur.4"),
                AreaRando.GetSprite("Anim.Shop.TopFleur.5"),
                AreaRando.GetSprite("Anim.Shop.TopFleur.6"),
                AreaRando.GetSprite("Anim.Shop.TopFleur.7"),
                AreaRando.GetSprite("Anim.Shop.TopFleur.8")
            };
        }
        public void Start()
        {
            geoSprite = type == ShopType.Geo
                ? AreaRando.GetSprite("UI.Shop.Geo")
                : AreaRando.GetSprite("UI.Shop.Essence");

            StartCoroutine(ShowShop());
        }
Ejemplo n.º 3
0
 static BigItemPopup()
 {
     Frames = new[]
     {
         AreaRando.GetSprite("Anim.BigItemFleur.0"),
         AreaRando.GetSprite("Anim.BigItemFleur.1"),
         AreaRando.GetSprite("Anim.BigItemFleur.2"),
         AreaRando.GetSprite("Anim.BigItemFleur.3"),
         AreaRando.GetSprite("Anim.BigItemFleur.4"),
         AreaRando.GetSprite("Anim.BigItemFleur.5"),
         AreaRando.GetSprite("Anim.BigItemFleur.6"),
         AreaRando.GetSprite("Anim.BigItemFleur.7"),
         AreaRando.GetSprite("Anim.BigItemFleur.8")
     };
 }
        private bool IsValid(ShopItemDef item)
        {
            PlayerData pd = Ref.PD;

            // These ones can't be empty
            if (string.IsNullOrEmpty(item.PlayerDataBoolName) || string.IsNullOrEmpty(item.NameConvo) ||
                string.IsNullOrEmpty(item.DescConvo) || string.IsNullOrEmpty(item.SpriteName))
            {
                return(false);
            }

            if (AreaRando.GetSprite(item.SpriteName) == null)
            {
                return(false);
            }

            // These ones are fine to be empty, replacing null with empty since they're mostly the same thing in this context
            // No harm changing structs around since they're value types
            if (item.RequiredPlayerDataBool == null)
            {
                item.RequiredPlayerDataBool = string.Empty;
            }

            if (item.RemovalPlayerDataBool == null)
            {
                item.RemovalPlayerDataBool = string.Empty;
            }

            if (item.NotchCostBool == null)
            {
                item.NotchCostBool = string.Empty;
            }

            if (pd.GetBool(item.PlayerDataBoolName) || pd.GetBool(item.RemovalPlayerDataBool) ||
                item.RequiredPlayerDataBool != string.Empty && !pd.GetBool(item.RequiredPlayerDataBool))
            {
                return(false);
            }

            if (item.Cost < 0)
            {
                return(false);
            }

            return(true);
        }
        private void BuildItemImages()
        {
            if (itemImages != null && itemImages.Length > 0)
            {
                foreach (GameObject obj in itemImages)
                {
                    Destroy(obj);
                }
            }

            itemImages = new GameObject[validItems.Length, 4];

            for (int i = 0; i < itemImages.GetLength(0); i++)
            {
                itemImages[i, 0] = CanvasUtil.CreateImagePanel(gameObject,
                                                               AreaRando.GetSprite(items[validItems[i]].SpriteName),
                                                               new CanvasUtil.RectData(new Vector2(90, 90), Vector2.zero, new Vector2(0.525f, 0f),
                                                                                       new Vector2(0.525f, 0f)));
                itemImages[i, 1] = CanvasUtil.CreateImagePanel(gameObject, geoSprite,
                                                               new CanvasUtil.RectData(new Vector2(50, 50), Vector2.zero, new Vector2(0.57f, 0f),
                                                                                       new Vector2(0.57f, 0f)));

                int cost = (int)(items[validItems[i]].Cost * (items[validItems[i]].DungDiscount ? 0.75f : 1));
                itemImages[i, 2] = CanvasUtil.CreateTextPanel(gameObject, cost.ToString(), 34, TextAnchor.MiddleCenter,
                                                              new CanvasUtil.RectData(new Vector2(1920, 1080), Vector2.zero, new Vector2(0.61f, 0f),
                                                                                      new Vector2(0.61f, 0f)), Fonts.Get("Perpetua"));

                if (type == ShopType.Geo && cost > Ref.PD.geo ||
                    type == ShopType.Essence && cost > Ref.PD.dreamOrbs)
                {
                    itemImages[i, 3] = CanvasUtil.CreateImagePanel(gameObject, blackPixel,
                                                                   new CanvasUtil.RectData(new Vector2(300, 100), Vector2.zero, new Vector2(0.57f, 0f),
                                                                                           new Vector2(0.57f, 0f)));
                    itemImages[i, 3].GetComponent <Image>().preserveAspect = false;
                }
            }

            foreach (GameObject obj in itemImages)
            {
                obj.SetActive(false);
            }
        }
Ejemplo n.º 6
0
        public static GameObject Show(string spriteKey, string takeKey, string nameKey, string buttonKey,
                                      string descOneKey, string descTwoKey, GameObject fsmObj = null, string eventName = null)
        {
            // Create base canvas
            GameObject canvas = CanvasUtil.CreateCanvas(RenderMode.ScreenSpaceOverlay, new Vector2(1920, 1080));

            // Add popup component, set values
            BigItemPopup popup = canvas.AddComponent <BigItemPopup>();

            popup._imagePrompt = AreaRando.GetSprite(spriteKey);
            popup._takeText    = Language.Language.Get(takeKey, "Prompts").Replace("<br>", " ");
            popup._nameText    = Language.Language.Get(nameKey, "UI").Replace("<br>", " ");
            popup._buttonText  = Language.Language.Get(buttonKey, "Prompts").Replace("<br>", " ");
            popup._descOneText = Language.Language.Get(descOneKey, "Prompts").Replace("<br>", " ");
            popup._descTwoText = Language.Language.Get(descTwoKey, "Prompts").Replace("<br>", " ");
            popup._fsmObj      = fsmObj;
            popup._fsmEvent    = eventName;

            return(canvas);
        }
        private IEnumerator ShowShop()
        {
            GameObject background = CanvasUtil.CreateImagePanel(gameObject,
                                                                AreaRando.GetSprite("UI.Shop.Background"),
                                                                new CanvasUtil.RectData(new Vector2(810, 813), Vector2.zero, new Vector2(0.675f, 0.525f),
                                                                                        new Vector2(0.675f, 0.525f)));

            GameObject bottomFleur = CanvasUtil.CreateImagePanel(gameObject,
                                                                 AreaRando.GetSprite("Anim.Shop.BottomFleur.0"),
                                                                 new CanvasUtil.RectData(new Vector2(811, 241), Vector2.zero, new Vector2(0.675f, 0.3f),
                                                                                         new Vector2(0.675f, 0.3f)));

            StartCoroutine(AnimateImage(bottomFleur, bottomFrames, 12));
            StartCoroutine(TweenY(bottomFleur, 0.3f, 0.2f, 60, 15));

            GameObject topFleur = CanvasUtil.CreateImagePanel(gameObject,
                                                              AreaRando.GetSprite("Anim.Shop.TopFleur.0"),
                                                              new CanvasUtil.RectData(new Vector2(808, 198), Vector2.zero, new Vector2(0.675f, 0.6f),
                                                                                      new Vector2(0.675f, 0.6f)));

            StartCoroutine(AnimateImage(topFleur, topFrames, 12));
            StartCoroutine(TweenY(topFleur, 0.6f, 0.85f, 60, 15));

            yield return(StartCoroutine(CanvasUtil.FadeInCanvasGroup(background.AddComponent <CanvasGroup>())));

            CanvasUtil.CreateImagePanel(gameObject, AreaRando.GetSprite("UI.Shop.Selector"),
                                        new CanvasUtil.RectData(new Vector2(340, 113), Vector2.zero, new Vector2(0.57f, 0.5825f),
                                                                new Vector2(0.57f, 0.5825f)));
            CanvasUtil.CreateImagePanel(gameObject, AreaRando.GetSprite("UI.Shop.Shitpost"),
                                        new CanvasUtil.RectData(new Vector2(112, 112), Vector2.zero, new Vector2(0.6775f, 0.92f),
                                                                new Vector2(0.6775f, 0.92f)));

            ResetItems();

            StartCoroutine(ListenForInput());
        }
Ejemplo n.º 8
0
        private IEnumerator ShowPopup()
        {
            // Check for skipping popup
            Coroutine skipCoroutine = StartCoroutine(LookForShowInstantly());

            // Begin dimming the scene
            GameObject dimmer = CanvasUtil.CreateImagePanel(gameObject, BlackPixel,
                                                            new CanvasUtil.RectData(Vector2.zero, Vector2.zero, Vector2.zero, Vector2.one));

            dimmer.GetComponent <Image>().preserveAspect = false;
            CanvasGroup dimmerCG = dimmer.AddComponent <CanvasGroup>();

            dimmerCG.blocksRaycasts = false;
            dimmerCG.interactable   = false;
            dimmerCG.alpha          = 0;

            StartCoroutine(FadeInCanvasGroup(dimmerCG));

            yield return(WaitForSeconds(0.1f));

            // Aim for 400 high prompt image
            float   scaler = _imagePrompt.texture.height / 400f;
            Vector2 size   = new Vector2(_imagePrompt.texture.width / scaler, _imagePrompt.texture.height / scaler);

            // Begin fading in the top bits of the popup
            GameObject topImage = CanvasUtil.CreateImagePanel(gameObject, _imagePrompt,
                                                              new CanvasUtil.RectData(size, Vector2.zero, new Vector2(0.5f, 0.75f), new Vector2(0.5f, 0.8f)));
            GameObject topTextOne = CanvasUtil.CreateTextPanel(gameObject, _takeText, 34, TextAnchor.MiddleCenter,
                                                               new CanvasUtil.RectData(new Vector2(1920, 100), Vector2.zero, new Vector2(0.5f, 0.55f),
                                                                                       new Vector2(0.5f, 0.55f)), Fonts.Get("Perpetua"));
            GameObject topTextTwo = CanvasUtil.CreateTextPanel(gameObject, _nameText, 76, TextAnchor.MiddleCenter,
                                                               new CanvasUtil.RectData(new Vector2(1920, 300), Vector2.zero, new Vector2(0.5f, 0.49f),
                                                                                       new Vector2(0.5f, 0.49f)));

            CanvasGroup topImageCG   = topImage.AddComponent <CanvasGroup>();
            CanvasGroup topTextOneCG = topTextOne.AddComponent <CanvasGroup>();
            CanvasGroup topTextTwoCG = topTextTwo.AddComponent <CanvasGroup>();

            topImageCG.blocksRaycasts = false;
            topImageCG.interactable   = false;
            topImageCG.alpha          = 0;

            topTextOneCG.blocksRaycasts = false;
            topTextOneCG.interactable   = false;
            topTextOneCG.alpha          = 0;

            topTextTwoCG.blocksRaycasts = false;
            topTextTwoCG.interactable   = false;
            topTextTwoCG.alpha          = 0;

            StartCoroutine(FadeInCanvasGroup(topImageCG));
            StartCoroutine(FadeInCanvasGroup(topTextOneCG));
            yield return(StartCoroutine(FadeInCanvasGroup(topTextTwoCG)));

            // Animate the middle fleur
            GameObject fleur = CanvasUtil.CreateImagePanel(gameObject, Frames[0],
                                                           new CanvasUtil.RectData(new Vector2(Frames[0].texture.width / 1.6f, Frames[0].texture.height / 1.6f),
                                                                                   Vector2.zero, new Vector2(0.5f, 0.4125f), new Vector2(0.5f, 0.4125f)));

            yield return(StartCoroutine(AnimateFleur(fleur, 12)));

            yield return(WaitForSeconds(0.25f));

            // Fade in the remaining text
            GameObject botTextOne = CanvasUtil.CreateTextPanel(gameObject, _buttonText, 34, TextAnchor.MiddleCenter,
                                                               new CanvasUtil.RectData(new Vector2(1920, 100), Vector2.zero, new Vector2(0.5f, 0.335f),
                                                                                       new Vector2(0.5f, 0.335f)), Fonts.Get("Perpetua"));
            GameObject botTextTwo = CanvasUtil.CreateTextPanel(gameObject, _descOneText, 34, TextAnchor.MiddleCenter,
                                                               new CanvasUtil.RectData(new Vector2(1920, 100), Vector2.zero, new Vector2(0.5f, 0.26f),
                                                                                       new Vector2(0.5f, 0.26f)), Fonts.Get("Perpetua"));
            GameObject botTextThree = CanvasUtil.CreateTextPanel(gameObject, _descTwoText, 34, TextAnchor.MiddleCenter,
                                                                 new CanvasUtil.RectData(new Vector2(1920, 100), Vector2.zero, new Vector2(0.5f, 0.205f),
                                                                                         new Vector2(0.5f, 0.205f)), Fonts.Get("Perpetua"));

            CanvasGroup botTextOneCG   = botTextOne.AddComponent <CanvasGroup>();
            CanvasGroup botTextTwoCG   = botTextTwo.AddComponent <CanvasGroup>();
            CanvasGroup botTextThreeCG = botTextThree.AddComponent <CanvasGroup>();

            botTextOneCG.blocksRaycasts = false;
            botTextOneCG.interactable   = false;
            botTextOneCG.alpha          = 0;

            botTextTwoCG.blocksRaycasts = false;
            botTextTwoCG.interactable   = false;
            botTextTwoCG.alpha          = 0;

            botTextThreeCG.blocksRaycasts = false;
            botTextThreeCG.interactable   = false;
            botTextThreeCG.alpha          = 0;

            yield return(StartCoroutine(FadeInCanvasGroup(botTextOneCG)));

            StartCoroutine(FadeInCanvasGroup(botTextTwoCG));
            yield return(StartCoroutine(FadeInCanvasGroup(botTextThreeCG)));

            yield return(WaitForSeconds(1.5f));

            // Can I offer you an egg in this trying time?
            GameObject egg = CanvasUtil.CreateImagePanel(gameObject, AreaRando.GetSprite("UI.egg"),
                                                         new CanvasUtil.RectData(
                                                             new Vector2(AreaRando.GetSprite("UI.egg").texture.width / 1.65f,
                                                                         AreaRando.GetSprite("UI.egg").texture.height / 1.65f), Vector2.zero,
                                                             new Vector2(0.5f, 0.1075f), new Vector2(0.5f, 0.1075f)));
            CanvasGroup eggCG = egg.AddComponent <CanvasGroup>();

            eggCG.blocksRaycasts = false;
            eggCG.interactable   = false;
            eggCG.alpha          = 0;

            // Should wait for one fade in, don't want to poll input immediately
            yield return(FadeInCanvasGroup(eggCG));

            // Stop doing things instantly before polling input
            if (!_showInstantly)
            {
                StopCoroutine(skipCoroutine);
            }

            _showInstantly = false;

            // Save the coroutine to stop it later
            Coroutine coroutine = StartCoroutine(BlinkCanvasGroup(eggCG));

            // Wait for the user to cancel the menu
            while (true)
            {
                HeroActions actions = Ref.Input.inputActions;
                if (actions.jump.WasPressed || actions.attack.WasPressed || actions.menuCancel.WasPressed)
                {
                    break;
                }

                yield return(new WaitForEndOfFrame());
            }

            // Fade out the full popup
            yield return(FadeOutCanvasGroup(gameObject.GetComponent <CanvasGroup>()));

            // Small delay before hero control
            yield return(WaitForSeconds(0.75f));

            // Optionally send FSM event after finishing
            if (_fsmObj != null && _fsmEvent != null)
            {
                FSMUtility.SendEventToGameObject(_fsmObj, _fsmEvent);
            }

            // Stop the egg routine and destroy everything
            StopCoroutine(coroutine);
            Destroy(gameObject);
        }
Ejemplo n.º 9
0
        public override void Process(string scene, UnityEngine.Object changeObj)
        {
            if (scene != _sceneName || !(changeObj is PlayMakerFSM fsm) || fsm.FsmName != _fsmName ||
                fsm.gameObject.name != _objectName)
            {
                return;
            }


            FsmState pdBool      = fsm.GetState("PD Bool?");
            FsmState charm       = fsm.GetState("Charm?");
            FsmState trinkFlash  = fsm.GetState("Trink Flash");
            FsmState giveTrinket = fsm.GetState("Store Key");

            // Remove actions that stop shiny from spawning
            pdBool.RemoveActionsOfType <PlayerDataBoolTest>();
            pdBool.RemoveActionsOfType <StringCompare>();

            // Add our own check to stop the shiny from being grabbed twice
            pdBool.AddAction(new RandomizerBoolTest(_boolName, null, "COLLECTED", true));

            // Force the FSM to follow the path for the correct trinket
            charm.ClearTransitions();

            charm.AddTransition("FINISHED", "Trink Flash");
            trinkFlash.ClearTransitions();
            fsm.GetState("Trinket Type").ClearTransitions();
            trinkFlash.AddTransition("FINISHED", "Store Key");

            giveTrinket.AddFirstAction(new RandomizerExecuteLambda(() => AreaRando.Instance.Settings.UpdateObtainedProgressionByBoolName(_boolName)));
            giveTrinket.AddAction(new RandomizerExecuteLambda(() => RandoLogger.LogItemToTrackerByBoolName(_boolName, _location)));
            giveTrinket.AddAction(new RandomizerExecuteLambda(() => RandoLogger.UpdateHelperLog()));
            giveTrinket.GetActionsOfType <SetPlayerDataBool>().First().boolName = _boolName;

            // Makes sure the correct icon and text appear
            switch (_trinketNum)
            {
            case 1:
                giveTrinket.GetActionsOfType <GetLanguageString>().First().convName     = "INV_NAME_TRINKET1";
                giveTrinket.GetActionsOfType <SetSpriteRendererSprite>().First().sprite = AreaRando.GetSprite("ShopIcons.WanderersJournal");
                break;

            case 2:
                giveTrinket.GetActionsOfType <GetLanguageString>().First().convName     = "INV_NAME_TRINKET2";
                giveTrinket.GetActionsOfType <SetSpriteRendererSprite>().First().sprite = AreaRando.GetSprite("ShopIcons.HallownestSeal");
                break;

            case 3:
                giveTrinket.GetActionsOfType <GetLanguageString>().First().convName     = "INV_NAME_TRINKET3";
                giveTrinket.GetActionsOfType <SetSpriteRendererSprite>().First().sprite = AreaRando.GetSprite("ShopIcons.KingsIdol");
                break;

            case 4:
                giveTrinket.GetActionsOfType <GetLanguageString>().First().convName     = "INV_NAME_TRINKET4";
                giveTrinket.GetActionsOfType <SetSpriteRendererSprite>().First().sprite = AreaRando.GetSprite("ShopIcons.ArcaneEgg");
                break;

            case 6:
                giveTrinket.GetActionsOfType <GetLanguageString>().First().convName     = "INV_NAME_TRAM_PASS";
                giveTrinket.GetActionsOfType <SetSpriteRendererSprite>().First().sprite = AreaRando.GetSprite("ShopIcons.TramPass");
                break;

            case 8:
                giveTrinket.GetActionsOfType <GetLanguageString>().First().convName     = "INV_NAME_STOREKEY";
                giveTrinket.GetActionsOfType <SetSpriteRendererSprite>().First().sprite = AreaRando.GetSprite("ShopIcons.ShopkeepersKey");
                break;

            case 9:
                giveTrinket.GetActionsOfType <GetLanguageString>().First().convName     = "INV_NAME_CITYKEY";
                giveTrinket.GetActionsOfType <SetSpriteRendererSprite>().First().sprite = AreaRando.GetSprite("ShopIcons.CityKey");
                break;

            case 10:
                giveTrinket.GetActionsOfType <GetLanguageString>().First().convName     = "INV_NAME_LOVEKEY";
                giveTrinket.GetActionsOfType <SetSpriteRendererSprite>().First().sprite = AreaRando.GetSprite("ShopIcons.LoveKey");
                break;

            case 11:
                giveTrinket.GetActionsOfType <GetLanguageString>().First().convName     = "INV_NAME_RANCIDEGG";
                giveTrinket.GetActionsOfType <SetSpriteRendererSprite>().First().sprite = AreaRando.GetSprite("ShopIcons.RancidEgg");
                break;

            case 12:
                giveTrinket.GetActionsOfType <GetLanguageString>().First().convName     = "INV_NAME_SIMPLEKEY";
                giveTrinket.GetActionsOfType <SetSpriteRendererSprite>().First().sprite = AreaRando.GetSprite("ShopIcons.SimpleKey");
                break;

            case 13:
                giveTrinket.GetActionsOfType <GetLanguageString>().First().convName     = "RANDOMIZER_NAME_CHARM_NOTCH";
                giveTrinket.GetActionsOfType <SetSpriteRendererSprite>().First().sprite = AreaRando.GetSprite("ShopIcons.CharmNotch");
                break;

            case 14:
                giveTrinket.GetActionsOfType <GetLanguageString>().First().convName     = "RANDOMIZER_NAME_PALE_ORE";
                giveTrinket.GetActionsOfType <SetSpriteRendererSprite>().First().sprite = AreaRando.GetSprite("ShopIcons.PaleOre");
                break;

            case 20:     //lantern
                giveTrinket.GetActionsOfType <GetLanguageString>().First().convName     = "INV_NAME_LANTERN";
                giveTrinket.GetActionsOfType <SetSpriteRendererSprite>().First().sprite = AreaRando.GetSprite("ShopIcons.Lantern");
                break;

            case 21:     //elegant key
                giveTrinket.GetActionsOfType <GetLanguageString>().First().convName     = "INV_NAME_WHITEKEY";
                giveTrinket.GetActionsOfType <SetSpriteRendererSprite>().First().sprite = AreaRando.GetSprite("ShopIcons.ElegantKey");
                break;

            case 22:     //mask shards
                giveTrinket.GetActionsOfType <GetLanguageString>().First().convName     = "RANDOMIZER_NAME_MASK_SHARD";
                giveTrinket.GetActionsOfType <SetSpriteRendererSprite>().First().sprite = AreaRando.GetSprite("ShopIcons.MaskShard");
                break;

            case 23:     //vessel fragments
                giveTrinket.GetActionsOfType <GetLanguageString>().First().convName     = "RANDOMIZER_NAME_VESSEL_FRAGMENT";
                giveTrinket.GetActionsOfType <SetSpriteRendererSprite>().First().sprite = AreaRando.GetSprite("ShopIcons.VesselFragment");
                break;
            }
        }
        public override void Process(string scene, Object changeObj)
        {
            if (scene != SceneName)
            {
                return;
            }



            // Find the shop and save an item for use later
            GameObject    shopObj    = GameObject.Find(ObjectName);
            ShopMenuStock shop       = shopObj.GetComponent <ShopMenuStock>();
            GameObject    itemPrefab = Object.Instantiate(shop.stock[0]);

            itemPrefab.SetActive(false);

            // Remove all charm type items from the store
            List <GameObject> newStock = new List <GameObject>();

            foreach (ShopItemDef itemDef in _items)
            {
                // Create a new shop item for this item def
                GameObject newItemObj = Object.Instantiate(itemPrefab);
                newItemObj.SetActive(false);

                // Apply all the stored values
                ShopItemStats stats = newItemObj.GetComponent <ShopItemStats>();
                stats.playerDataBoolName     = itemDef.PlayerDataBoolName;
                stats.nameConvo              = itemDef.NameConvo;
                stats.descConvo              = itemDef.DescConvo;
                stats.requiredPlayerDataBool = itemDef.RequiredPlayerDataBool;
                stats.removalPlayerDataBool  = itemDef.RemovalPlayerDataBool;
                stats.dungDiscount           = itemDef.DungDiscount;
                stats.notchCostBool          = itemDef.NotchCostBool;
                stats.cost = itemDef.Cost;

                // Need to set all these to make sure the item doesn't break in one of various ways
                stats.priceConvo     = string.Empty;
                stats.specialType    = 2;
                stats.charmsRequired = 0;
                stats.relic          = false;
                stats.relicNumber    = 0;
                stats.relicPDInt     = string.Empty;

                // Apply the sprite for the UI
                stats.transform.Find("Item Sprite").gameObject.GetComponent <SpriteRenderer>().sprite =
                    AreaRando.GetSprite(itemDef.SpriteName);

                newStock.Add(newItemObj);
            }

            // Save unchanged list for potential alt stock
            List <GameObject> altStock = new List <GameObject>();

            altStock.AddRange(newStock);

            // Update normal stock
            //specialType: 0 = lantern, elegant key, quill; 1 = mask, 2 = charm, 3 = vessel, 4-7 = relics, 8 = notch, 9 = map, 10 = simple key, 11 = egg, 12-14 = repair fragile, 15 = salubra blessing, 16 = map pin, 17 = map marker
            foreach (GameObject item in shop.stock)
            {
                // It would be cleaner to destroy the unused objects, but that breaks the shop on subsequent loads
                // TC must be reusing the shop items rather than destroying them on load
                List <int> randomizedTypes = new List <int>()
                {
                    0, 1, 2, 3, 8, 10, 11
                };
                if (!randomizedTypes.Contains(item.GetComponent <ShopItemStats>().specialType))
                {
                    newStock.Add(item);
                }
                else if (item.GetComponent <ShopItemStats>().nameConvo == "INV_NAME_LANTERN" && !AreaRando.Instance.Settings.RandomizeKeys && !AreaRando.Instance.Settings.MiscSkips)
                {
                    // Easiest way to handle lantern on easy mode. Lantern is given automatically on new game load
                }
                else if (item.GetComponent <ShopItemStats>().specialType == 2 && !AreaRando.Instance.Settings.RandomizeCharms)
                {
                    newStock.Add(item);
                }
                else if ((item.GetComponent <ShopItemStats>().specialType == 0 || item.GetComponent <ShopItemStats>().specialType == 10) && !AreaRando.Instance.Settings.RandomizeKeys)
                {
                    newStock.Add(item);
                }
                else if (item.GetComponent <ShopItemStats>().nameConvo == "INV_NAME_QUILL" && AreaRando.Instance.Settings.RandomizeKeys)
                {
                    newStock.Add(item); //Special case: only nonrandomized item of special type 0
                }
                else if (item.GetComponent <ShopItemStats>().specialType == 1 && !AreaRando.Instance.Settings.RandomizeMaskShards)
                {
                    newStock.Add(item);
                }
                else if (item.GetComponent <ShopItemStats>().specialType == 3 && !AreaRando.Instance.Settings.RandomizeVesselFragments)
                {
                    newStock.Add(item);
                }
                else if (item.GetComponent <ShopItemStats>().specialType == 8 && !AreaRando.Instance.Settings.RandomizeCharmNotches)
                {
                    newStock.Add(item);
                }
                else if (item.GetComponent <ShopItemStats>().specialType == 11 && !AreaRando.Instance.Settings.RandomizeRancidEggs)
                {
                    newStock.Add(item);
                }
            }

            shop.stock = newStock.ToArray();

            // Update alt stock
            if (shop.stockAlt != null)
            {
                foreach (GameObject item in shop.stockAlt)
                {
                    // note we just have to handle the vanilla item types sly sells here
                    List <int> randomizedTypes = new List <int>()
                    {
                        0, 1, 2, 3, 8, 10, 11
                    };
                    if (!randomizedTypes.Contains(item.GetComponent <ShopItemStats>().specialType))
                    {
                        altStock.Add(item);
                    }
                    else if (item.GetComponent <ShopItemStats>().nameConvo == "INV_NAME_LANTERN" && !AreaRando.Instance.Settings.RandomizeKeys && !AreaRando.Instance.Settings.MiscSkips)
                    {
                        // Easiest way to handle lantern on easy mode. Lantern is given automatically on new game load
                    }
                    else if (item.GetComponent <ShopItemStats>().specialType == 2 && !AreaRando.Instance.Settings.RandomizeCharms)
                    {
                        altStock.Add(item);
                    }
                    else if ((item.GetComponent <ShopItemStats>().specialType == 0 || item.GetComponent <ShopItemStats>().specialType == 10) && !AreaRando.Instance.Settings.RandomizeKeys)
                    {
                        altStock.Add(item);
                    }
                    else if (item.GetComponent <ShopItemStats>().specialType == 1 && !AreaRando.Instance.Settings.RandomizeMaskShards)
                    {
                        altStock.Add(item);
                    }
                    else if (item.GetComponent <ShopItemStats>().specialType == 3 && !AreaRando.Instance.Settings.RandomizeVesselFragments)
                    {
                        altStock.Add(item);
                    }
                    else if (item.GetComponent <ShopItemStats>().specialType == 11 && !AreaRando.Instance.Settings.RandomizeRancidEggs)
                    {
                        altStock.Add(item);
                    }
                }

                shop.stockAlt = altStock.ToArray();
            }
        }