using Il2CppSteamworks;

namespace DevourClient.Hacks
{
    public class Unlock
    {
        public static void Achievements()
        {
            //Il2Cpp.AchievementHelpers ah = UnityEngine.Object.FindObjectOfType<Il2Cpp.AchievementHelpers>();

            string[] achievements = { "ACH_WON_Manor_NIGHTMARE_SP", "ACH_WON_NIGHTMARE_", "ACH_WON_TOWN_HARD", "ACH_WON_MANOR_NIGHTMARE_SP", "ACH_WON_INN_HARD_SP", "ACH_WON_SLAUGHTERHOUSE_COOP", "ACH_ALL_FEATHERS", "ACH_WON_INN_HARD", "ACH_ALL_BARBED_WIRES", "ACH_ALL_HORSESHOES", "ACH_WON_MOLLY_HARD", "ACH_WON_TOWN_NIGHTMARE_SP", "ACH_WON_MOLLY_HARD_SP", "ACH_WON_INN_SP", "ACH_100_GASOLINE_USED", "ACH_WON_MANOR_HARD_SP", "ACH_WON_MOLLY_SP", "ACH_100_EGGS_DESTROYED", "ACH_1000_PIGS_DESTROYED", "ACH_WON_TOWN_COOP", "ACH_WON_SLAUGHTERHOUSE_HARD_SP", "ACH_WON_MOLLY_COOP", "ACH_100_FUSES_USED", "ACH_1000_BOOKS_DESTROYED", "ACH_WON_MOLLY_NIGHTMARE_SP", "ACH_WON_SLAUGHTERHOUSE_SP", "ACH_ALL_PATCHES", "ACH_WON_INN_COOP", "ACH_WON_TOWN_NIGHTMARE", "ACH_ALL_CHERRY_BLOSSOM", "ACH_WON_MOLLY_NIGHTMARE", "ACH_WON_TOWN_HARD_SP", "ACH_ALL_ROSES", "ACH_WON_INN_NIGHTMARE_SP", "ACH_1000_HEADS_BURIED", "ACH_WON_SLAUGHTERHOUSE_NIGHTMARE_SP", "ACH_WON_TOWN_SP", "ACH_WON_INN_NIGHTMARE", "ACH_WON_SLAUGHTERHOUSE_HARD", "ACH_WON_MANOR_COOP", "ACH_WON_MANOR_HARD", "ACH_WON_SLAUGHTERHOUSE_NIGHTMARE", "ACH_WON_MANOR_SP", "ACH_WON_MANOR_NIGHTMARE", "ACH_ALL_CLIPBOARDS_READ", "ACH_ALL_NOTES_READ", "ACH_UNLOCKED_ATTIC_CAGE", "ACH_UNLOCKED_CAGE", "ACH_CALMED_ANNA", "ACH_FRIED_RAT", "ACH_BURNT_GOAT", "ACH_KNOCKED_OUT_BY_ANNA", "ACH_KNOCKOUT_OUT_BY_DEMON", "ACH_KNOCKED_OUT_IN_HIDING", "STAT_NUM_BLEACH_USED", "ACH_WON_SP", "ACH_WIN_NIGHTMARE", "ACH_WON_HARD_SP", "ACH_WON_COOP", "ACH_WON_HARD", "ACH_WIN_NIGHTMARE_SP", "ACH_LOST", "ACH_NEVER_KNOCKED_OUT", "ACH_ONLY_ONE_KNOCKED_OUT", "ACH_WON_HARD_NO_MEDKITS", "ACH_WON_NO_MEDKITS", "ACH_WON_NO_BATTERIES", "ACH_WON_NIGHTMARE_NO_MEDKITS", "ACH_WON_NO_KNOCKOUT_COOP", "ACH_WON_HARD_NO_BATTERIES", "ACH_WON_HARD_{0}", "ACH_WON_NIGHTMARE_{0}", "ACH_WON_NIGHTMARE_NO_BATTERIES", "ACH_SURVIVED_TO_7_GOATS", "ACH_SURVIVED_TO_5_GOATS", "ACH_SURVIVED_TO_3_GOATS", };
            string[] stats = { "STAT_ROSES_COLLECTED", "STAT_BARBED_WIRES_COLLECTED", "STAT_HORSESHOES_COLLECTED", "STAT_PATCHES_COLLECTED", "STAT_CHERRY_BLOSSOM_COLLECTED", "STAT_FEATHERS_COLLECTED", "STAT_NUM_CORPSES_FRIED", "STAT_NUM_GHOSTS_FRIED", "STAT_NUM_MOLLY_CALMED_DOWN", "STAT_NUM_ANNA_CALMED_DOWN", "STAT_NUM_ANNA_STAGGERS", "STAT_NUM_NATHAN_STAGGERS", "STAT_NUM_APRIL_STAGGERS", "STAT_NUM_ZARA_STAGGERS", "STAT_NUM_SAM_STAGGERS", "STAT_NUM_MOLLY_STAGGERS", "STAT_NUM_CROWS_FRIED", "STAT_NUM_BOARS_FRIED", "STAT_NUM_SPIDERS_FRIED", "STAT_NUM_INMATES_FRIED", "STAT_NUM_DEMONS_FRIED", "STAT_NUM_KNOCKOUTS", "STAT_KNOCKOUTS_BY_", "STAT_NUM_BOOKS_CURSED", "STAT_NUM_ALCOHOL_USED", "STAT_NUM_BLEACH_USED", "STAT_NUM_HEADS_BURIED", "STAT_POOPS_SEARCHED", "STAT_EXP", "STAT_NUM_PIGS_DESTROYED", "STAT_NUM_WON_HARD", "STAT_NUM_WON_NIGHTMARE", "STAT_NUM_WON", "STAT_NUM_BOOKS_DESTROYED", "STAT_NUM_GASOLINE_USED", "STAT_NUM_GOATS_DESTROYED", "STAT_NUM_RATS_DESTROYED", "STAT_NUM_FUSES_USED", "STAT_KNOCKOUTS_BY_NATHAN", "STAT_KNOCKOUTS_BY_GHOST", "STAT_INMATES", "STAT_NUM_REVIVES", "STAT_GHOSTS", "STAT_HEADS", "STAT_GOATS_LURED", "STAT_KNOCKOUTS_BY_MOLLY", "STAT_KNOCKOUTS_BY_BOAR", "STAT_NUM_EGGS_DESTROYED", "STAT_DEMONS", "STAT_KNOCKOUTS_BY_SPIDER", "STAT_CATEGORY_MISC", "STAT_BOOKS", "STAT_CATEGORY_WINS", "STAT_KNOCKOUTS_BY_SAM", "STAT_HEADS_CLEANSED", "STAT_BOARS", "STAT_KNOCKOUTS_BY_APRIL", "STAT_RATS", "STAT_HEADS_LURED", "STAT_CATEGORY_MINIONS_BANISHED", "STAT_CROWS", "STAT_PIGS", "STAT_PIGS_LURED", "STAT_CATEGORY_AZAZEL_STAGGERS", "STAT_GOATS", "STAT_KNOCKOUTS_BY_ZARA", "STAT_KNOCKOUTS_BY_DEMON", "STAT_KNOCKOUTS_BY_ANNA", "STAT_EGGS", "STAT_CATEGORY_ANIMALS_LURED", "STAT_CORPSES_FREED", "STAT_KNOCKOUTS_BY_INMATE", "STAT_SPIDERS", "STAT_RATS_LURED", "STAT_CATEGORY_RITUAL_ITEMS_DESTROYED", "STAT_CATEGORY_ITEMS_USED", "STAT_KNOCKOUTS_BY_CROW", "STAT_CATEGORY_KNOCKOUTS", "STAT_NUM_WON_NORMAL", "STAT_TOTAL", "STAT_TRASH_CANS_KICKED", };
            for (int i = 0; i < achievements.Length; i++)
            {
                Il2CppSteamworks.SteamUserStats.SetAchievement(achievements[i]);
                //ah.Unlock(achievements[i]);
            }

            for (int j = 0; j < stats.Length; j++)
            {
                Il2CppSteamworks.SteamUserStats.SetStat(stats[j], 666);
            }

            MelonLoader.MelonLogger.Warning("You need to restart your game for the achievements to be unlocked !!!");
            MelonLoader.MelonLogger.Warning("You need to restart your game for the achievements to be unlocked !!!");
            MelonLoader.MelonLogger.Warning("You need to restart your game for the achievements to be unlocked !!!");
            MelonLoader.MelonLogger.Warning("You need to restart your game for the achievements to be unlocked !!!");
        }

        public static void Doors()
        {
            //Pour chaques portes, on les ouvre
            foreach (Il2CppHorror.DoorBehaviour doorBehaviour in UnityEngine.Object.FindObjectsOfType<Il2CppHorror.DoorBehaviour>())
            {
                doorBehaviour.state.Locked = false;
                if (doorBehaviour.IsOpen())
                {
                    doorBehaviour.m_DoorGraphUpdate.DoorOpening();
                }
                else
                {
                    doorBehaviour.m_DoorGraphUpdate.DoorClosed();
                }
                doorBehaviour.Unlock();
            }
        }
    }
}
