Terraria.Chest.Unlock C# (CSharp) Method

Unlock() public static method

public static Unlock ( int X, int Y ) : bool
X int
Y int
return bool
        public static bool Unlock(int X, int Y)
        {
            if (Main.tile[X, Y] == null)
                return false;
            short num;
            int Type;
            switch (Main.tile[X, Y].frameX / 36)
            {
                case 2:
                    num = 36;
                    Type = 11;
                    AchievementsHelper.NotifyProgressionEvent(19);
                    break;
                case 4:
                    num = 36;
                    Type = 11;
                    break;
                case 23:
                case 24:
                case 25:
                case 26:
                case 27:
                    if (!NPC.downedPlantBoss)
                        return false;
                    num = 180;
                    Type = 11;
                    AchievementsHelper.NotifyProgressionEvent(20);
                    break;
                case 36:
                case 38:
                case 40:
                    num = 36;
                    Type = 11;
                    break;
                default:
                    return false;
            }
            Main.PlaySound(22, X * 16, Y * 16, 1);
            for (int index1 = X; index1 <= X + 1; ++index1)
            {
                for (int index2 = Y; index2 <= Y + 1; ++index2)
                {
                    Main.tile[index1, index2].frameX -= num;
                    for (int index3 = 0; index3 < 4; ++index3)
                        Dust.NewDust(new Vector2((index1 * 16), (index2 * 16)), 16, 16, Type, 0.0f, 0.0f, 0, new Color(), 1f);
                }
            }
            return true;
        }