private void LoadSprites()
        {
            LoadComplete = false;

            foreach (KeyValuePair <string, CustomKnight.CustomKnightTexture> pair in CustomKnight.Textures)
            {
                CustomKnight.CustomKnightTexture texture = pair.Value;
                if (!texture.missing)
                {
                    byte[] texBytes = File.ReadAllBytes((CustomKnight.DATA_DIR + "/" + CustomKnight.SKIN_FOLDER + "/" + texture.fileName).Replace("\\", "/"));
                    if (texture.tex != null)
                    {
                        Destroy(texture.tex);
                    }

                    texture.tex = new Texture2D(2, 2);
                    texture.tex.LoadImage(texBytes, true);
                }
            }

            ModifyHeroTextures();

            LoadComplete = true;
            Destroy(gameObject);
        }
        private static void DestroyObjects()
        {
            foreach (KeyValuePair <string, CustomKnight.CustomKnightTexture> pair in CustomKnight.Textures)
            {
                CustomKnight.CustomKnightTexture texture = pair.Value;
                if (texture.tex != null)
                {
                    Destroy(texture.tex);
                }
            }

            LoadComplete = false;
        }
        private static IEnumerator SetHeroTex()
        {
            yield return(new WaitWhile(() =>
                                       !LoadComplete || HeroController.instance == null || CharmIconList.Instance == null));

            if (!pulledDefaultTexturesAlready)
            {
                Log("Pulling Default Textures");
                PullDefaultTextures();
            }


            _knightMat.mainTexture = CustomKnight.Textures["Knight"].missing
                ? CustomKnight.Textures["Knight"].defaultTex
                : CustomKnight.Textures["Knight"].tex;
            _sprintMat.mainTexture = CustomKnight.Textures["Sprint"].missing
                ? CustomKnight.Textures["Sprint"].defaultTex
                : CustomKnight.Textures["Sprint"].tex;
            _unnMat.mainTexture = CustomKnight.Textures["Unn"].missing
                ? CustomKnight.Textures["Unn"].defaultTex
                : CustomKnight.Textures["Unn"].tex;

            _shadeMat.mainTexture = CustomKnight.Textures["Shade"].missing
                ? CustomKnight.Textures["Shade"].defaultTex
                : CustomKnight.Textures["Shade"].tex;

            _shadeOrbMat.mainTexture = CustomKnight.Textures["ShadeOrb"].missing
                ? CustomKnight.Textures["ShadeOrb"].defaultTex
                : CustomKnight.Textures["ShadeOrb"].tex;

            _shadeOrbReformMat.mainTexture = _shadeOrbMat.mainTexture;

            _shadeOrbRetreatMat.mainTexture = _shadeOrbMat.mainTexture;

            _shadeOrbChargeMat.mainTexture = _shadeOrbMat.mainTexture;

            _shadeOrbDepartMat.mainTexture = _shadeOrbMat.mainTexture;

            _shadeOrbQuakeMat.mainTexture = _shadeOrbMat.mainTexture;

            if (CustomKnight.settings.Preloads)
            {
                _cloakMat.mainTexture = CustomKnight.Textures["Cloak"].missing
                    ? CustomKnight.Textures["Cloak"].defaultTex
                    : CustomKnight.Textures["Cloak"].tex;
                _shriekMat.mainTexture = CustomKnight.Textures["Shriek"].missing
                    ? CustomKnight.Textures["Shriek"].defaultTex
                    : CustomKnight.Textures["Shriek"].tex;
                _wingsMat.mainTexture = CustomKnight.Textures["Wings"].missing
                    ? CustomKnight.Textures["Wings"].defaultTex
                    : CustomKnight.Textures["Wings"].tex;
                _quirrelMat.mainTexture = CustomKnight.Textures["Quirrel"].missing
                    ? CustomKnight.Textures["Quirrel"].defaultTex
                    : CustomKnight.Textures["Quirrel"].tex;
                _webbedMat.mainTexture = CustomKnight.Textures["Webbed"].missing
                    ? CustomKnight.Textures["Webbed"].defaultTex
                    : CustomKnight.Textures["Webbed"].tex;
                _dreamMat.mainTexture = CustomKnight.Textures["DreamArrival"].missing
                    ? CustomKnight.Textures["DreamArrival"].defaultTex
                    : CustomKnight.Textures["DreamArrival"].tex;
                _dnMat.mainTexture = CustomKnight.Textures["Dreamnail"].missing
                    ? CustomKnight.Textures["Dreamnail"].defaultTex
                    : CustomKnight.Textures["Dreamnail"].tex;
                _hornetMat.mainTexture = CustomKnight.Textures["Hornet"].missing
                    ? CustomKnight.Textures["Hornet"].defaultTex
                    : CustomKnight.Textures["Hornet"].tex;
                _birthMat.mainTexture = CustomKnight.Textures["Birthplace"].missing
                    ? CustomKnight.Textures["Birthplace"].defaultTex
                    : CustomKnight.Textures["Birthplace"].tex;
            }

            _baldurMat.mainTexture = CustomKnight.Textures["Baldur"].missing
                ? CustomKnight.Textures["Baldur"].defaultTex
                : CustomKnight.Textures["Baldur"].tex;
            _flukeMat.mainTexture = CustomKnight.Textures["Fluke"].missing
                ? CustomKnight.Textures["Fluke"].defaultTex
                : CustomKnight.Textures["Fluke"].tex;
            _grimmMat.mainTexture = CustomKnight.Textures["Grimm"].missing
                ? CustomKnight.Textures["Grimm"].defaultTex
                : CustomKnight.Textures["Grimm"].tex;
            _shieldMat.mainTexture = CustomKnight.Textures["Shield"].missing
                ? CustomKnight.Textures["Shield"].defaultTex
                : CustomKnight.Textures["Shield"].tex;
            _weaverMat.mainTexture = CustomKnight.Textures["Weaver"].missing
                ? CustomKnight.Textures["Weaver"].defaultTex
                : CustomKnight.Textures["Weaver"].tex;
            _wombMat.mainTexture = CustomKnight.Textures["Hatchling"].missing
                ? CustomKnight.Textures["Hatchling"].defaultTex
                : CustomKnight.Textures["Hatchling"].tex;

            foreach (Transform child in HeroController.instance.gameObject.transform)
            {
                if (child.name == "Spells")
                {
                    foreach (Transform spellsChild in child)
                    {
                        if (spellsChild.name == "Scr Heads" || spellsChild.name == "Scr Base")
                        {
                            _wraithsMat.mainTexture = CustomKnight.Textures["Wraiths"].missing
                                ? CustomKnight.Textures["Wraiths"].defaultTex
                                : CustomKnight.Textures["Wraiths"].tex;
                        }
                        else if (spellsChild.name == "Scr Heads 2" || spellsChild.name == "Scr Base 2")
                        {
                            _voidMat.mainTexture = CustomKnight.Textures["VoidSpells"].missing
                                ? CustomKnight.Textures["VoidSpells"].defaultTex
                                : CustomKnight.Textures["VoidSpells"].tex;
                        }
                    }
                }
                else if (child.name == "Focus Effects")
                {
                    foreach (Transform focusChild in child)
                    {
                        if (focusChild.name == "Heal Anim")
                        {
                            _vsMat.mainTexture = CustomKnight.Textures["VS"].missing
                                ? CustomKnight.Textures["VS"].defaultTex
                                : CustomKnight.Textures["VS"].tex;
                            break;
                        }
                    }
                }
            }

            _hudMat.mainTexture = CustomKnight.Textures["Hud"].missing
                ? CustomKnight.Textures["Hud"].defaultTex
                : CustomKnight.Textures["Hud"].tex;

            foreach (SpriteRenderer i in GameCameras.instance.hudCanvas.GetComponentsInChildren <SpriteRenderer>(true))
            {
                if (i.name == "Orb Full")
                {
                    Texture2D tex = CustomKnight.Textures["OrbFull"].missing
                        ? CustomKnight.Textures["OrbFull"].defaultTex
                        : CustomKnight.Textures["OrbFull"].tex;
                    i.sprite = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), new Vector2(0.5f, 0.5f));
                }
                else if (i.name == "Pulse Sprite")
                {
                    if (i.gameObject != null)
                    {
                        Destroy(i.gameObject);
                    }
                }
            }

            CustomKnight.CustomKnightTexture invTexture = CustomKnight.Textures["Inventory"];
            Texture2D    invTex       = invTexture.missing ? invTexture.defaultTex : invTexture.tex;
            PlayMakerFSM updateSprite = GameManager.instance.inventoryFSM.gameObject.FindGameObjectInChildren("Detail Sprite").LocateMyFSM("Update Sprite");

            for (int charmNum = 1; charmNum <= 40; charmNum++)
            {
                IEnumerable <Vector2> charmCoords;
                float  charmX, charmY;
                Sprite charmSprite;
                Sprite newCharmSprite;

                float offsetX = 0.0f;
                float offsetY = 0.0f;
                float shrinkX = 2.0f;
                float shrinkY = 2.0f;

                PlayMakerFSM charmShowIfCollected;

                switch (charmNum)
                {
                case 23:
                    // Fixed Fragile Heart
                    offsetX        = 0;
                    offsetY        = 0;
                    shrinkX        = 0;
                    shrinkY        = 0;
                    charmSprite    = CharmIconList.Instance.spriteList[charmNum];
                    charmCoords    = charmSprite.uv.Select(uv => ConvertUVToPixelCoordinates(uv, charmSprite.texture.width, charmSprite.texture.height));
                    charmX         = charmCoords.Min(uv => uv.x);
                    charmY         = charmCoords.Min(uv => uv.y);
                    newCharmSprite = Sprite.Create(invTex, new Rect(charmX + offsetX, charmY + offsetY, charmSprite.rect.width - shrinkX, charmSprite.rect.height - shrinkY), new Vector2(0.5f, 0.5f));
                    CharmIconList.Instance.spriteList[charmNum] = newCharmSprite;

                    // Broken Fragile Heart
                    offsetX = 0;
                    offsetY = 0;
                    shrinkX = 0;
                    shrinkY = 0;
                    charmShowIfCollected = GameCameras.instance.hudCamera.gameObject.FindGameObjectInChildren(charmNum.ToString()).LocateMyFSM("charm_show_if_collected");
                    charmSprite          = charmShowIfCollected.GetAction <SetSpriteRendererSprite>("Glass HP", 2).sprite.Value as Sprite;
                    charmCoords          = charmSprite.uv.Select(uv => ConvertUVToPixelCoordinates(uv, charmSprite.texture.width, charmSprite.texture.height));
                    charmX         = charmCoords.Min(uv => uv.x);
                    charmY         = charmCoords.Min(uv => uv.y);
                    newCharmSprite = Sprite.Create(invTex, new Rect(charmX + offsetX, charmY + offsetY, charmSprite.rect.width - shrinkX, charmSprite.rect.height - shrinkY), new Vector2(0.5f, 0.5f));
                    charmShowIfCollected.GetAction <SetSpriteRendererSprite>("Glass HP", 2).sprite.Value = newCharmSprite;
                    updateSprite.GetAction <SetSpriteRendererSprite>("Glass HP", 2).sprite.Value         = newCharmSprite;

                    // Unbreakable Heart
                    offsetX        = 0;
                    offsetY        = 0;
                    shrinkX        = 0;
                    shrinkY        = 0;
                    charmSprite    = CharmIconList.Instance.unbreakableHeart;
                    charmCoords    = charmSprite.uv.Select(uv => ConvertUVToPixelCoordinates(uv, charmSprite.texture.width, charmSprite.texture.height));
                    charmX         = charmCoords.Min(uv => uv.x);
                    charmY         = charmCoords.Min(uv => uv.y);
                    newCharmSprite = Sprite.Create(invTex, new Rect(charmX + offsetX, charmY + offsetY, charmSprite.rect.width - shrinkX, charmSprite.rect.height - shrinkY), new Vector2(0.5f, 0.5f));
                    CharmIconList.Instance.unbreakableHeart = newCharmSprite;

                    break;

                case 24:
                    // Fixed Fragile Greed
                    offsetX        = 0;
                    offsetY        = 0;
                    shrinkX        = 0;
                    shrinkY        = 0;
                    charmSprite    = CharmIconList.Instance.spriteList[charmNum];
                    charmCoords    = charmSprite.uv.Select(uv => ConvertUVToPixelCoordinates(uv, charmSprite.texture.width, charmSprite.texture.height));
                    charmX         = charmCoords.Min(uv => uv.x);
                    charmY         = charmCoords.Min(uv => uv.y);
                    newCharmSprite = Sprite.Create(invTex, new Rect(charmX + offsetX, charmY + offsetY, charmSprite.rect.width - shrinkX, charmSprite.rect.height - shrinkY), new Vector2(0.5f, 0.5f));
                    CharmIconList.Instance.spriteList[charmNum] = newCharmSprite;

                    // Broken Fragile Greed
                    offsetX = 0;
                    offsetY = 0;
                    shrinkX = 0;
                    shrinkY = 0;
                    charmShowIfCollected = GameCameras.instance.hudCamera.gameObject.FindGameObjectInChildren(charmNum.ToString()).LocateMyFSM("charm_show_if_collected");
                    charmSprite          = charmShowIfCollected.GetAction <SetSpriteRendererSprite>("Glass Geo", 2).sprite.Value as Sprite;
                    charmCoords          = charmSprite.uv.Select(uv => ConvertUVToPixelCoordinates(uv, charmSprite.texture.width, charmSprite.texture.height));
                    charmX         = charmCoords.Min(uv => uv.x);
                    charmY         = charmCoords.Min(uv => uv.y);
                    newCharmSprite = Sprite.Create(invTex, new Rect(charmX + offsetX, charmY + offsetY, charmSprite.rect.width - shrinkX, charmSprite.rect.height - shrinkY), new Vector2(0.5f, 0.5f));
                    charmShowIfCollected.GetAction <SetSpriteRendererSprite>("Glass Geo", 2).sprite.Value = newCharmSprite;
                    updateSprite.GetAction <SetSpriteRendererSprite>("Glass Geo", 2).sprite.Value         = newCharmSprite;

                    // Unbreakable Greed
                    offsetX        = 0;
                    offsetY        = 0;
                    shrinkX        = 0;
                    shrinkY        = 0;
                    charmSprite    = CharmIconList.Instance.unbreakableGreed;
                    charmCoords    = charmSprite.uv.Select(uv => ConvertUVToPixelCoordinates(uv, charmSprite.texture.width, charmSprite.texture.height));
                    charmX         = charmCoords.Min(uv => uv.x);
                    charmY         = charmCoords.Min(uv => uv.y);
                    newCharmSprite = Sprite.Create(invTex, new Rect(charmX + offsetX, charmY + offsetY, charmSprite.rect.width - shrinkX, charmSprite.rect.height - shrinkY), new Vector2(0.5f, 0.5f));
                    CharmIconList.Instance.unbreakableGreed = newCharmSprite;

                    break;

                case 25:
                    // Fixed Fragile Strength
                    offsetX        = 0;
                    offsetY        = 0;
                    shrinkX        = 0;
                    shrinkY        = 0;
                    charmSprite    = CharmIconList.Instance.spriteList[charmNum];
                    charmCoords    = charmSprite.uv.Select(uv => ConvertUVToPixelCoordinates(uv, charmSprite.texture.width, charmSprite.texture.height));
                    charmX         = charmCoords.Min(uv => uv.x);
                    charmY         = charmCoords.Min(uv => uv.y);
                    newCharmSprite = Sprite.Create(invTex, new Rect(charmX + offsetX, charmY + offsetY, charmSprite.rect.width - shrinkX, charmSprite.rect.height - shrinkY), new Vector2(0.5f, 0.5f));
                    CharmIconList.Instance.spriteList[charmNum] = newCharmSprite;

                    // Broken Fragile Strength
                    offsetX = 0;
                    offsetY = 0;
                    shrinkX = 0;
                    shrinkY = 0;
                    charmShowIfCollected = GameCameras.instance.hudCamera.gameObject.FindGameObjectInChildren(charmNum.ToString()).LocateMyFSM("charm_show_if_collected");
                    charmSprite          = charmShowIfCollected.GetAction <SetSpriteRendererSprite>("Glass Attack", 2).sprite.Value as Sprite;
                    charmCoords          = charmSprite.uv.Select(uv => ConvertUVToPixelCoordinates(uv, charmSprite.texture.width, charmSprite.texture.height));
                    charmX         = charmCoords.Min(uv => uv.x);
                    charmY         = charmCoords.Min(uv => uv.y);
                    newCharmSprite = Sprite.Create(invTex, new Rect(charmX + offsetX, charmY + offsetY, charmSprite.rect.width - shrinkX, charmSprite.rect.height - shrinkY), new Vector2(0.5f, 0.5f));
                    charmShowIfCollected.GetAction <SetSpriteRendererSprite>("Glass Attack", 2).sprite.Value = newCharmSprite;
                    updateSprite.GetAction <SetSpriteRendererSprite>("Glass Attack", 2).sprite.Value         = newCharmSprite;

                    // Unbreakable Strength
                    offsetX        = 0;
                    offsetY        = 0;
                    shrinkX        = 0;
                    shrinkY        = 0;
                    charmSprite    = CharmIconList.Instance.unbreakableStrength;
                    charmCoords    = charmSprite.uv.Select(uv => ConvertUVToPixelCoordinates(uv, charmSprite.texture.width, charmSprite.texture.height));
                    charmX         = charmCoords.Min(uv => uv.x);
                    charmY         = charmCoords.Min(uv => uv.y);
                    newCharmSprite = Sprite.Create(invTex, new Rect(charmX + offsetX, charmY + offsetY, charmSprite.rect.width - shrinkX, charmSprite.rect.height - shrinkY), new Vector2(0.5f, 0.5f));
                    CharmIconList.Instance.unbreakableStrength = newCharmSprite;

                    break;

                case 36:
                    charmShowIfCollected = GameCameras.instance.hudCamera.gameObject.FindGameObjectInChildren(charmNum.ToString()).LocateMyFSM("charm_show_if_collected");
                    updateSprite         = GameManager.instance.inventoryFSM.gameObject.FindGameObjectInChildren("Detail Sprite").LocateMyFSM("Update Sprite");

                    offsetX        = 7;
                    offsetY        = 0;
                    shrinkX        = 54;
                    shrinkY        = 0;
                    charmSprite    = charmShowIfCollected.GetAction <SetSpriteRendererSprite>("R Queen", 0).sprite.Value as Sprite;
                    charmCoords    = charmSprite.uv.Select(uv => ConvertUVToPixelCoordinates(uv, charmSprite.texture.width, charmSprite.texture.height));
                    charmX         = charmCoords.Min(uv => uv.x);
                    charmY         = charmCoords.Min(uv => uv.y);
                    newCharmSprite = Sprite.Create(invTex, new Rect(charmX + offsetX, charmY + offsetY, charmSprite.rect.width - shrinkX, charmSprite.rect.height - shrinkY), new Vector2(0.5f, 0.5f));
                    charmShowIfCollected.GetAction <SetSpriteRendererSprite>("R Queen", 0).sprite.Value = newCharmSprite;
                    updateSprite.GetAction <SetSpriteRendererSprite>("R Queen", 0).sprite.Value         = newCharmSprite;

                    offsetX = 0;
                    offsetY = 0;
                    shrinkX = 0;
                    shrinkY = 0;
                    charmShowIfCollected = GameCameras.instance.hudCamera.gameObject.FindGameObjectInChildren(charmNum.ToString()).LocateMyFSM("charm_show_if_collected");
                    charmSprite          = charmShowIfCollected.GetAction <SetSpriteRendererSprite>("R King", 0).sprite.Value as Sprite;
                    charmCoords          = charmSprite.uv.Select(uv => ConvertUVToPixelCoordinates(uv, charmSprite.texture.width, charmSprite.texture.height));
                    charmX         = charmCoords.Min(uv => uv.x);
                    charmY         = charmCoords.Min(uv => uv.y);
                    newCharmSprite = Sprite.Create(invTex, new Rect(charmX + offsetX, charmY + offsetY, charmSprite.rect.width - shrinkX, charmSprite.rect.height - shrinkY), new Vector2(0.5f, 0.5f));
                    charmShowIfCollected.GetAction <SetSpriteRendererSprite>("R King", 0).sprite.Value = newCharmSprite;
                    updateSprite.GetAction <SetSpriteRendererSprite>("R King", 0).sprite.Value         = newCharmSprite;

                    offsetX        = 0;
                    offsetY        = -3;
                    shrinkX        = 0;
                    shrinkY        = 8;
                    charmSprite    = charmShowIfCollected.GetAction <SetSpriteRendererSprite>("R Final", 0).sprite.Value as Sprite;
                    charmCoords    = charmSprite.uv.Select(uv => ConvertUVToPixelCoordinates(uv, charmSprite.texture.width, charmSprite.texture.height));
                    charmX         = charmCoords.Min(uv => uv.x);
                    charmY         = charmCoords.Min(uv => uv.y);
                    newCharmSprite = Sprite.Create(invTex, new Rect(charmX + offsetX, charmY + offsetY, charmSprite.rect.width - shrinkX, charmSprite.rect.height - shrinkY), new Vector2(0.5f, 0.5f));
                    charmShowIfCollected.GetAction <SetSpriteRendererSprite>("R Final", 0).sprite.Value = newCharmSprite;
                    updateSprite.GetAction <SetSpriteRendererSprite>("R Final", 0).sprite.Value         = newCharmSprite;

                    offsetX        = 0;
                    offsetY        = -5;
                    shrinkX        = 0;
                    shrinkY        = 12;
                    charmSprite    = charmShowIfCollected.GetAction <SetSpriteRendererSprite>("R Shade", 0).sprite.Value as Sprite;
                    charmCoords    = charmSprite.uv.Select(uv => ConvertUVToPixelCoordinates(uv, charmSprite.texture.width, charmSprite.texture.height));
                    charmX         = charmCoords.Min(uv => uv.x);
                    charmY         = charmCoords.Min(uv => uv.y);
                    newCharmSprite = Sprite.Create(invTex, new Rect(charmX + offsetX, charmY + offsetY, charmSprite.rect.width - shrinkX, charmSprite.rect.height - shrinkY), new Vector2(0.5f, 0.5f));
                    charmShowIfCollected.GetAction <SetSpriteRendererSprite>("R Shade", 0).sprite.Value = newCharmSprite;
                    updateSprite.GetAction <SetSpriteRendererSprite>("R Shade", 0).sprite.Value         = newCharmSprite;

                    break;

                case 40:
                    offsetX        = -12;
                    offsetY        = 0;
                    shrinkX        = 20;
                    shrinkY        = 10;
                    charmSprite    = CharmIconList.Instance.grimmchildLevel1;
                    charmCoords    = charmSprite.uv.Select(uv => ConvertUVToPixelCoordinates(uv, charmSprite.texture.width, charmSprite.texture.height));
                    charmX         = charmCoords.Min(uv => uv.x);
                    charmY         = charmCoords.Min(uv => uv.y);
                    newCharmSprite = Sprite.Create(invTex, new Rect(charmX + offsetX, charmY + offsetY, charmSprite.rect.width - shrinkX, charmSprite.rect.height - shrinkY), new Vector2(0.5f, 0.5f));
                    CharmIconList.Instance.grimmchildLevel1 = newCharmSprite;

                    offsetX        = -6;
                    offsetY        = 4;
                    shrinkX        = 28;
                    shrinkY        = 16;
                    charmSprite    = CharmIconList.Instance.grimmchildLevel2;
                    charmCoords    = charmSprite.uv.Select(uv => ConvertUVToPixelCoordinates(uv, charmSprite.texture.width, charmSprite.texture.height));
                    charmX         = charmCoords.Min(uv => uv.x);
                    charmY         = charmCoords.Min(uv => uv.y);
                    newCharmSprite = Sprite.Create(invTex, new Rect(charmX + offsetX, charmY + offsetY, charmSprite.rect.width - shrinkX, charmSprite.rect.height - shrinkY), new Vector2(0.5f, 0.5f));
                    CharmIconList.Instance.grimmchildLevel2 = newCharmSprite;

                    offsetX        = -14;
                    offsetY        = 0;
                    shrinkX        = 0;
                    shrinkY        = 0;
                    charmSprite    = CharmIconList.Instance.grimmchildLevel3;
                    charmCoords    = charmSprite.uv.Select(uv => ConvertUVToPixelCoordinates(uv, charmSprite.texture.width, charmSprite.texture.height));
                    charmX         = charmCoords.Min(uv => uv.x);
                    charmY         = charmCoords.Min(uv => uv.y);
                    newCharmSprite = Sprite.Create(invTex, new Rect(charmX + offsetX, charmY + offsetY, charmSprite.rect.width - shrinkX, charmSprite.rect.height - shrinkY), new Vector2(0.5f, 0.5f));
                    CharmIconList.Instance.grimmchildLevel3 = newCharmSprite;

                    offsetX        = -18;
                    offsetY        = 0;
                    shrinkX        = 0;
                    shrinkY        = 0;
                    charmSprite    = CharmIconList.Instance.grimmchildLevel4;
                    charmCoords    = charmSprite.uv.Select(uv => ConvertUVToPixelCoordinates(uv, charmSprite.texture.width, charmSprite.texture.height));
                    charmX         = charmCoords.Min(uv => uv.x);
                    charmY         = charmCoords.Min(uv => uv.y);
                    newCharmSprite = Sprite.Create(invTex, new Rect(charmX + offsetX, charmY + offsetY, charmSprite.rect.width - shrinkX, charmSprite.rect.height - shrinkY), new Vector2(0.5f, 0.5f));
                    CharmIconList.Instance.grimmchildLevel4 = newCharmSprite;

                    offsetX        = 0;
                    offsetY        = 0;
                    shrinkX        = 0;
                    shrinkY        = 0;
                    charmSprite    = CharmIconList.Instance.nymmCharm;
                    charmCoords    = charmSprite.uv.Select(uv => ConvertUVToPixelCoordinates(uv, charmSprite.texture.width, charmSprite.texture.height));
                    charmX         = charmCoords.Min(uv => uv.x);
                    charmY         = charmCoords.Min(uv => uv.y);
                    newCharmSprite = Sprite.Create(invTex, new Rect(charmX + offsetX, charmY + offsetY, charmSprite.rect.width - shrinkX, charmSprite.rect.height - shrinkY), new Vector2(0.5f, 0.5f));
                    CharmIconList.Instance.nymmCharm = newCharmSprite;

                    break;

                default:
                    // Fringe cases where charm rect positions and sizes are incorrect
                    switch (charmNum)
                    {
                    // Fury of the Fallen
                    case 6:
                        offsetY = -5;
                        shrinkY = 10;
                        break;

                    // Defender's Crest
                    case 10:
                        offsetX = -2;
                        offsetY = 0;
                        shrinkX = 20;
                        shrinkY = 10;
                        break;

                    // Shape of Unn
                    case 28:
                        offsetX = -8;
                        offsetY = -4;
                        shrinkX = 40;
                        shrinkY = 10;
                        break;

                    // Dashmaster
                    case 31:
                        offsetX = 0;
                        offsetY = 0;
                        shrinkX = 10;
                        shrinkY = 6;
                        break;

                    // Quick Slash
                    case 32:
                        offsetX = 2;
                        offsetY = 2;
                        shrinkY = 2;
                        break;

                    // Deep Focus
                    case 34:
                        shrinkY = 6;
                        break;
                    }

                    charmSprite    = CharmIconList.Instance.spriteList[charmNum];
                    charmCoords    = charmSprite.uv.Select(uv => ConvertUVToPixelCoordinates(uv, charmSprite.texture.width, charmSprite.texture.height));
                    charmX         = charmCoords.Min(uv => uv.x);
                    charmY         = charmCoords.Min(uv => uv.y);
                    newCharmSprite = Sprite.Create(invTex,
                                                   new Rect(charmX + offsetX, charmY + offsetY, charmSprite.rect.width - shrinkX,
                                                            charmSprite.rect.height - shrinkY), new Vector2(0.5f, 0.5f));
                    CharmIconList.Instance.spriteList[charmNum] = newCharmSprite;

                    break;
                }
            }

            texRoutineRunning = false;
        }