using System.Linq;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using HarmonyLib.Tools;

namespace DustlandDelivery {
    [BepInPlugin(pluginGuid, pluginName, pluginVersion)]
    public class Main : BaseUnityPlugin {
        private const string pluginGuid = "CykaMod";
        private const string pluginName = "CykaMod";
        private const string pluginVersion = "1.0.0";

        public static ConfigEntry<float> SellPriceMultiplier;
        public static ConfigEntry<float> XPMultiplier;
        public static ConfigEntry<float> BookCostMultiplier;

        public void Awake() {
            SellPriceMultiplier = Config.Bind("General", "SellMultiplier", 1F,
                new ConfigDescription("SellMultiplier", new AcceptableValueRange<float>(1, 512)));
            XPMultiplier = Config.Bind("General", "XPMultiplier", 1F,
                new ConfigDescription("XPMultiplier", new AcceptableValueRange<float>(1, 512)));
            BookCostMultiplier = Config.Bind("General", "BookCostMultiplier", 1F,
                new ConfigDescription("BookCostMultiplier", new AcceptableValueRange<float>(0.01F, 512)));

            Logger.LogInfo("Cyka mod loaded");
            HarmonyFileLog.Enabled = true;
            Harmony harmony = new Harmony(pluginGuid);
            harmony.PatchAll();
            var originalMethods = harmony.GetPatchedMethods();
            Logger.LogInfo("Patched " + originalMethods.Count() + " methods");
        }
    }
}
