using UnityEngine;
using GadgetCore.API;
using GadgetCore.Util;
using GadgetCore.API.ConfigMenu;

namespace MonsterNests
{
  [Gadget("MonsterNests")]
  public class MonsterNests : Gadget<MonsterNests>
  {
    public const string MOD_VERSION = "1.0"; // Set this to the version of your mod.
    public const string CONFIG_VERSION = "1.0"; // Increment this whenever you change your mod's config file.

    protected override void LoadConfig()
    {
      Config.Load();

      string fileVersion = Config.ReadString("ConfigVersion", CONFIG_VERSION, comments: "The Config Version (not to be confused with mod version)");

      if (fileVersion != CONFIG_VERSION)
      {
        Config.Reset();
        Config.WriteString("ConfigVersion", CONFIG_VERSION, comments: "The Config Version (not to be confused with mod version)");
      }

      Config.Reset();
      Config.Save();
    }
    public override IGadgetConfigMenu GetConfigMenu() { return null; }

    public override string GetModDescription()
    {
      return "A mod that adds some monster nests.";
    }

    protected override void Initialize()
    {
      Logger.Log("Monster Nests v" + Info.Mod.Version);
      Core.logger = Logger;

      Texture2D textureBugspotBig = GadgetCoreAPI.LoadTexture2D("bugspotBig.png");
      Texture2D textureSpikePlant = GadgetCoreAPI.LoadTexture2D("spikePlant.png");
      Texture2D textureSpikePlantCM = GadgetCoreAPI.LoadTexture2D("spikePlantCM.png");
      Texture2D textureSpiderEgg = GadgetCoreAPI.LoadTexture2D("spiderEgg.png");
      Texture2D textureSpiderEggCM = GadgetCoreAPI.LoadTexture2D("spiderEggCM.png");
      Texture2D textureGoldenShroom = GadgetCoreAPI.LoadTexture2D("goldenShroom.png");
      Texture2D textureAncientCrystal = GadgetCoreAPI.LoadTexture2D("ancientCrystal.png");
      Texture2D textureAncientCrystalCM = GadgetCoreAPI.LoadTexture2D("ancientCrystalCM.png");
      Texture2D texturePlagueNest = GadgetCoreAPI.LoadTexture2D("plagueNest.png");
      Texture2D textureFrozenWisp = GadgetCoreAPI.LoadTexture2D("frozenWisp.png");
      Texture2D textureMolten = GadgetCoreAPI.LoadTexture2D("frozenWisp.png");

      Core.objectBugspotBig = new ObjectInfo(ObjectType.BUGSPOT, new Item(31, 1, 0, 0, 0, new int[3], new int[3]), 16, textureBugspotBig).Register("bugspotBig");
      Core.objectSpikePlant = new ObjectInfo(ObjectType.PLANT, new Item(11, 1, 0, 0, 0, new int[3], new int[3]), 16, textureSpikePlant).Register("spikePlant");
      Core.objectSpikePlantCM = new ObjectInfo(ObjectType.PLANT, new Item(11, 1, 0, 0, 0, new int[3], new int[3]), 16, textureSpikePlantCM).Register("spikePlantCM");
      Core.objectSpiderEgg = new ObjectInfo(ObjectType.ORE, new Item(2, 1, 0, 0, 0, new int[3], new int[3]), 16, textureSpiderEgg).Register("spiderEgg");
      Core.objectSpiderEggCM = new ObjectInfo(ObjectType.ORE, new Item(2, 1, 0, 0, 0, new int[3], new int[3]), 16, textureSpiderEggCM).Register("spiderEggCM");
      Core.objectGoldenShroom = new ObjectInfo(ObjectType.PLANT, new Item(12, 1, 0, 0, 0, new int[3], new int[3]), 16, textureGoldenShroom).Register("goldenShroom");
      Core.objectAncientCrystal = new ObjectInfo(ObjectType.ORE, new Item(57, 1, 0, 0, 0, new int[3], new int[3]), 106, textureAncientCrystal).Register("ancientCrystal");
      Core.objectAncientCrystalCM = new ObjectInfo(ObjectType.ORE, new Item(57, 1, 0, 0, 0, new int[3], new int[3]), 106, textureAncientCrystalCM).Register("ancientCrystalCM");
      Core.objectPlagueNest = new ObjectInfo(ObjectType.TREE, new Item(51, 1, 0, 0, 0, new int[3], new int[3]), 106, texturePlagueNest).Register("plagueNest");
      Core.objectFrozenWisp = new ObjectInfo(ObjectType.ORE, new Item(3, 1, 0, 0, 0, new int[3], new int[3]), 16, textureFrozenWisp).Register("frozenWisp");

    }
  }
}
