namespace Decal.Filters;

public class Spell : IIdNameTableEntry
{
	private int mID;

	private string mName;

	private string mDesc;

	private int mIconId;

	private int mFamily;

	private int mType;

	private int mFlags;

	private SpellSchool mSchool;

	private int mDiff;

	private int mMana;

	private SpellComponentIDs mComps;

	private float mSpeed;

	private double mDuration;

	private int mCasterEffect;

	private int mTargetEffect;

	private int mTargetMask;

	private int mGen;

	private int mSort;

	private float mUnk1;

	private float mUnk2;

	private float mUnk3;

	private int mUnk4;

	private double mUnk5;

	private int mUnk6;

	private int mUnk7;

	private int mUnk8;

	private int mUnk9;

	private int mUnk10;

	public int Id => mID;

	public string Name
	{
		get
		{
			return mName;
		}
		internal set
		{
			mName = value;
		}
	}

	public string Description
	{
		get
		{
			return mDesc;
		}
		internal set
		{
			mDesc = value;
		}
	}

	public int IconId
	{
		get
		{
			return mIconId;
		}
		internal set
		{
			mIconId = value;
		}
	}

	public int Family
	{
		get
		{
			return mFamily;
		}
		internal set
		{
			mFamily = value;
		}
	}

	public int Type
	{
		get
		{
			return mType;
		}
		internal set
		{
			mType = value;
		}
	}

	public int Flags
	{
		get
		{
			return mFlags;
		}
		internal set
		{
			mFlags = value;
		}
	}

	public bool IsOffensive => (mFlags & 1) != 0;

	public bool IsIrresistible => (mFlags & 4) != 0;

	public bool IsUntargetted => (mFlags & 8) != 0;

	public bool IsDebuff => (mFlags & 0x10) != 0;

	public bool IsFellowship => (mFlags & 0x2000) != 0;

	public bool IsFastWindup => (mFlags & 0x4000) != 0;

	public SpellSchool School
	{
		get
		{
			return mSchool;
		}
		internal set
		{
			mSchool = value;
		}
	}

	public int Difficulty
	{
		get
		{
			return mDiff;
		}
		internal set
		{
			mDiff = value;
		}
	}

	public int Mana
	{
		get
		{
			return mMana;
		}
		internal set
		{
			mMana = value;
		}
	}

	public SpellComponentIDs ComponentIDs
	{
		get
		{
			return mComps;
		}
		internal set
		{
			mComps = value;
		}
	}

	public float Speed
	{
		get
		{
			return mSpeed;
		}
		internal set
		{
			mSpeed = value;
		}
	}

	public double Duration
	{
		get
		{
			return mDuration;
		}
		internal set
		{
			mDuration = value;
		}
	}

	public int CasterEffect
	{
		get
		{
			return mCasterEffect;
		}
		internal set
		{
			mCasterEffect = value;
		}
	}

	public int TargetEffect
	{
		get
		{
			return mTargetEffect;
		}
		internal set
		{
			mTargetEffect = value;
		}
	}

	public int TargetMask
	{
		get
		{
			return mTargetMask;
		}
		internal set
		{
			mTargetMask = value;
		}
	}

	public int Generation
	{
		get
		{
			return mGen;
		}
		internal set
		{
			mGen = value;
		}
	}

	public int SortKey
	{
		get
		{
			return mSort;
		}
		internal set
		{
			mSort = value;
		}
	}

	public float Unknown1
	{
		get
		{
			return mUnk1;
		}
		internal set
		{
			mUnk1 = value;
		}
	}

	public float Unknown2
	{
		get
		{
			return mUnk2;
		}
		internal set
		{
			mUnk2 = value;
		}
	}

	public float Unknown3
	{
		get
		{
			return mUnk3;
		}
		internal set
		{
			mUnk3 = value;
		}
	}

	public int Unknown4
	{
		get
		{
			return mUnk4;
		}
		internal set
		{
			mUnk4 = value;
		}
	}

	public double Unknown5
	{
		get
		{
			return mUnk5;
		}
		internal set
		{
			mUnk5 = value;
		}
	}

	public int Unknown6
	{
		get
		{
			return mUnk6;
		}
		internal set
		{
			mUnk6 = value;
		}
	}

	public int Unknown7
	{
		get
		{
			return mUnk7;
		}
		internal set
		{
			mUnk7 = value;
		}
	}

	public int Unknown8
	{
		get
		{
			return mUnk8;
		}
		internal set
		{
			mUnk8 = value;
		}
	}

	public int Unknown9
	{
		get
		{
			return mUnk9;
		}
		internal set
		{
			mUnk9 = value;
		}
	}

	public int Unknown10
	{
		get
		{
			return mUnk10;
		}
		internal set
		{
			mUnk10 = value;
		}
	}

	internal Spell(int ID)
	{
		mID = ID;
	}

	public override string ToString()
	{
		return mName;
	}

	internal static int Hash(string Name, string Description)
	{
		return Hash(Name, 303068800u) + Hash(Description, 3199061829u);
	}

	internal static int Hash(string Buffer, uint Seed)
	{
		int num = 0;
		for (int i = 0; i < Buffer.Length; i++)
		{
			num = (num << 4) + (byte)Buffer[i];
			if ((num & 0xF0000000u) != 0L)
			{
				num = (num & 0xFFFFFFF) ^ ((num >> 24) & 0xF0);
			}
		}
		return (int)(num % Seed);
	}
}
