// End Other

        public SpellIconDBC(MainWindow window, SpellDBC spellDBC)
        {
            main = window;
            spell = spellDBC;

            for (UInt32 i = 0; i < header.RecordCount; ++i)
            {
                body.records[i].ID = new UInt32();
                body.records[i].Name = new UInt32();
            }
        }
        // End DBCs
        public SpellDuration(MainWindow window, SpellDBC spellDBC)
        {
            main = window;
            spell = spellDBC;

            for (UInt32 i = 0; i < header.RecordCount; ++i)
            {
                body.records[i].ID = new UInt32();
                body.records[i].BaseDuration = new Int32();
                body.records[i].PerLevel = new Int32();
                body.records[i].MaximumDuration = new Int32();
            }

            if (!File.Exists("DBC/SpellDuration.dbc"))
            {
                main.HandleErrorMessage("SpellDuration.dbc was not found!");

                return;
            }

            FileStream fileStream = new FileStream("DBC/SpellDuration.dbc", FileMode.Open);
            int count = Marshal.SizeOf(typeof(DBC_Header));
            byte[] readBuffer = new byte[count];
            BinaryReader reader = new BinaryReader(fileStream);
            readBuffer = reader.ReadBytes(count);
            GCHandle handle = GCHandle.Alloc(readBuffer, GCHandleType.Pinned);
            header = (DBC_Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(DBC_Header));
            handle.Free();
            body.records = new SpellDurationRecord[header.RecordCount];

            for (UInt32 i = 0; i < header.RecordCount; ++i)
            {
                count = Marshal.SizeOf(typeof(SpellDurationRecord));
                readBuffer = new byte[count];
                reader = new BinaryReader(fileStream);
                readBuffer = reader.ReadBytes(count);
                handle = GCHandle.Alloc(readBuffer, GCHandleType.Pinned);
                body.records[i] = (SpellDurationRecord)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(SpellDurationRecord));
                handle.Free();
            }

            reader.Close();
            fileStream.Close();

            body.lookup = new List<SpellDurationLookup>();

            int boxIndex = 1;

            main.Duration.Items.Add(0);

            SpellDurationLookup t;

            t.ID = 0;
            t.comboBoxIndex = 0;

            body.lookup.Add(t);

            for (UInt32 i = 0; i < header.RecordCount; ++i)
            {
                int baseDuration = (int)body.records[i].BaseDuration;

                SpellDurationLookup temp;

                temp.ID = (int)body.records[i].ID;
                temp.comboBoxIndex = boxIndex;

                main.Duration.Items.Add(baseDuration);

                body.lookup.Add(temp);

                boxIndex++;
            }
        }
        // End DBCs
        public SpellRange(MainWindow window, SpellDBC spellDBC)
        {
            main = window;
            spell = spellDBC;

            for (UInt32 i = 0; i < header.RecordCount; ++i)
            {
                body.records[i].ID = new UInt32();
                body.records[i].MinimumRangeHostile = new float();
                body.records[i].MinimumRangeFriend = new float();
                body.records[i].MaximumRangeHostile = new float();
                body.records[i].MaximumRangeFriend = new float();
                body.records[i].Type = new Int32();
                body.records[i].Name = new UInt32[16];
                body.records[i].NameFlags = new UInt32();
                body.records[i].ShortName = new UInt32[16];
                body.records[i].ShortNameFlags = new UInt32();
            }

            if (!File.Exists("DBC/SpellRange.dbc"))
            {
                main.HandleErrorMessage("SpellRange.dbc was not found!");

                return;
            }

            FileStream fileStream = new FileStream("DBC/SpellRange.dbc", FileMode.Open);
            int count = Marshal.SizeOf(typeof(DBC_Header));
            byte[] readBuffer = new byte[count];
            BinaryReader reader = new BinaryReader(fileStream);
            readBuffer = reader.ReadBytes(count);
            GCHandle handle = GCHandle.Alloc(readBuffer, GCHandleType.Pinned);
            header = (DBC_Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(DBC_Header));
            handle.Free();

            body.records = new SpellRange_DBC_Record[header.RecordCount];

            for (UInt32 i = 0; i < header.RecordCount; ++i)
            {
                count = Marshal.SizeOf(typeof(SpellRange_DBC_Record));
                readBuffer = new byte[count];
                reader = new BinaryReader(fileStream);
                readBuffer = reader.ReadBytes(count);
                handle = GCHandle.Alloc(readBuffer, GCHandleType.Pinned);
                body.records[i] = (SpellRange_DBC_Record)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(SpellRange_DBC_Record));
                handle.Free();
            }

            body.StringBlock = Encoding.UTF8.GetString(reader.ReadBytes(header.StringBlockSize));

            reader.Close();
            fileStream.Close();

            body.lookup = new List<SpellRangeLookup>();

            int boxIndex = 0;

            for (UInt32 i = 0; i < header.RecordCount; ++i)
            {
                int offset = (int)body.records[i].Name[0];
                int MinimumRangeHostile = (int)body.records[i].MinimumRangeHostile;
                int MaximumRangeHostile = (int)body.records[i].MaximumRangeHostile;
                int MinimumRangeFriend = (int)body.records[i].MinimumRangeFriend;
                int MaximumRangeFriend = (int)body.records[i].MaximumRangeFriend;

                if (offset == 0) { continue; }

                int returnValue = offset;

                string toAdd = "";

                while (body.StringBlock[offset] != 0) { toAdd += body.StringBlock[offset++]; }

                SpellRangeLookup temp;

                temp.ID = (int)body.records[i].ID;
                temp.comboBoxIndex = boxIndex;

                main.Range.Items.Add(toAdd + "\t\t - " + "Hostile: " + MinimumRangeHostile + " - " + MaximumRangeHostile + "\t Friend: " + MinimumRangeFriend + " - " + MaximumRangeFriend);

                body.lookup.Add(temp);

                boxIndex++;
            }
        }
        // End DBCs
        public SpellFocusObject(MainWindow window, SpellDBC spellDBC)
        {
            main = window;
            spell = spellDBC;

            for (UInt32 i = 0; i < header.RecordCount; ++i)
            {
                body.records[i].ID = new UInt32();
                body.records[i].Name = new UInt32[16];
                body.records[i].Flags = new UInt32();
            }

            if (!File.Exists("DBC/SpellFocusObject.dbc"))
            {
                main.HandleErrorMessage("SpellFocusObject.dbc was not found!");

                return;
            }

            FileStream fileStream = new FileStream("DBC/SpellFocusObject.dbc", FileMode.Open);
            int count = Marshal.SizeOf(typeof(DBC_Header));
            byte[] readBuffer = new byte[count];
            BinaryReader reader = new BinaryReader(fileStream);
            readBuffer = reader.ReadBytes(count);
            GCHandle handle = GCHandle.Alloc(readBuffer, GCHandleType.Pinned);
            header = (DBC_Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(DBC_Header));
            handle.Free();

            body.records = new SpellFocusObject_DBC_Record[header.RecordCount];

            for (UInt32 i = 0; i < header.RecordCount; ++i)
            {
                count = Marshal.SizeOf(typeof(SpellFocusObject_DBC_Record));
                readBuffer = new byte[count];
                reader = new BinaryReader(fileStream);
                readBuffer = reader.ReadBytes(count);
                handle = GCHandle.Alloc(readBuffer, GCHandleType.Pinned);
                body.records[i] = (SpellFocusObject_DBC_Record)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(SpellFocusObject_DBC_Record));
                handle.Free();
            }

            body.StringBlock = Encoding.UTF8.GetString(reader.ReadBytes(header.StringBlockSize));

            reader.Close();
            fileStream.Close();

            body.lookup = new List<SpellFocusObjectLookup>();

            int boxIndex = 1;

            main.RequiresSpellFocus.Items.Add("None");

            SpellFocusObjectLookup t;

            t.ID = 0;
            t.offset = 0;
            t.stringHash = "None".GetHashCode();
            t.comboBoxIndex = 0;

            body.lookup.Add(t);

            for (UInt32 i = 0; i < header.RecordCount; ++i)
            {
                int offset = (int)body.records[i].Name[0];

                if (offset == 0) { continue; }

                int returnValue = offset;

                string toAdd = "";

                while (body.StringBlock[offset] != '\0') { toAdd += body.StringBlock[offset++]; }

                SpellFocusObjectLookup temp;

                temp.ID = (int)body.records[i].ID;
                temp.offset = returnValue;
                temp.stringHash = toAdd.GetHashCode();
                temp.comboBoxIndex = boxIndex;

                main.RequiresSpellFocus.Items.Add(toAdd);

                body.lookup.Add(temp);

                boxIndex++;
            }
        }
        // End DBCs
        public AreaGroup(MainWindow window, SpellDBC spellDBC)
        {
            main = window;
            spell = spellDBC;

            for (UInt32 i = 0; i < header.RecordCount; ++i)
            {
                body.records[i].ID = new UInt32();
                body.records[i].AreaID = new UInt32[6];
                body.records[i].NextGroup = new UInt32();
            }

            if (!File.Exists("DBC/AreaGroup.dbc"))
            {
                main.HandleErrorMessage("AreaGroup.dbc was not found!");

                return;
            }

            FileStream fileStream = new FileStream("DBC/AreaGroup.dbc", FileMode.Open);
            int count = Marshal.SizeOf(typeof(DBC_Header));
            byte[] readBuffer = new byte[count];
            BinaryReader reader = new BinaryReader(fileStream);
            readBuffer = reader.ReadBytes(count);
            GCHandle handle = GCHandle.Alloc(readBuffer, GCHandleType.Pinned);
            header = (DBC_Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(DBC_Header));
            handle.Free();

            body.records = new AreaGroup_DBC_Record[header.RecordCount];

            for (UInt32 i = 0; i < header.RecordCount; ++i)
            {
                count = Marshal.SizeOf(typeof(AreaGroup_DBC_Record));
                readBuffer = new byte[count];
                reader = new BinaryReader(fileStream);
                readBuffer = reader.ReadBytes(count);
                handle = GCHandle.Alloc(readBuffer, GCHandleType.Pinned);
                body.records[i] = (AreaGroup_DBC_Record)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(AreaGroup_DBC_Record));
                handle.Free();
            }

            reader.Close();
            fileStream.Close();

            body.lookup = new List<AreaGroupLookup>();

            int boxIndex = 1;

            main.AreaGroup.Items.Add(0);

            AreaGroupLookup t;

            t.ID = 0;
            t.comboBoxIndex = 0;

            body.lookup.Add(t);

            for (UInt32 i = 0; i < header.RecordCount; ++i)
            {
                int id = (int)body.records[i].ID;

                AreaGroupLookup temp;

                temp.ID = id;
                temp.comboBoxIndex = boxIndex;

                main.AreaGroup.Items.Add(id);

                body.lookup.Add(temp);

                boxIndex++;
            }
        }