Example #1
0
 private void InsertEmptyTabRow(MyClasses.MetaViewWrappers.IList tab)
 {
     MyClasses.MetaViewWrappers.IListRow row = tab.Add();
     row[SpellList.Icon][1]        = AegisRedIcon;
     row[SpellList.Name][0]        = EmptyTabString;
     row[SpellList.SpellId][0]     = "-1";
     row[SpellList.OrigSpellId][0] = "-1";
 }
Example #2
0
 private void InsertSpellRow(MyClasses.MetaViewWrappers.IList tab, int index, Spell spell)
 {
     MyClasses.MetaViewWrappers.IListRow row = (index >= tab.RowCount) ? tab.Add() : tab.Insert(index);
     UpdateSpellRow(row, index, spell);
 }
Example #3
0
 private bool IsEmptyTab(MyClasses.MetaViewWrappers.IList tab)
 {
     return(tab.RowCount == 0 ||
            (tab.RowCount == 1 && (string)tab[0][SpellList.Name][0] == EmptyTabString));
 }
        private void CharacterFilter_ChangeSpellbar(object sender, ChangeSpellbarEventArgs e)
        {
            try
            {
                MyClasses.MetaViewWrappers.IList list = lstSpells[e.Tab];
                switch (e.Type)
                {
                case AddRemoveEventType.Add:
                    // Update spellbar structure
                    Spell spell = mFS.SpellTable.GetById(e.SpellId);
                    if (spell != null)
                    {
                        try
                        {
                            mSpellTabs[e.Tab].Insert(e.Slot, spell);
                        }
                        catch (Exception ex)
                        {
                            Util.Debug("List size: " + mSpellTabs[e.Tab] + "; Slot: " + e.Slot + "; Spell: " + spell.Name);
                            throw;
                        }

                        // Update spell list if <Current> is selected
                        if (IsDisplayingCurrentChar)
                        {
                            if (mSpellTabs[e.Tab].Count == 1)
                            {
                                // This was the first spell added to this tab
                                list.Clear();
                            }

                            InsertSpellRow(list, e.Slot, spell);

                            // Update the slot numbers on all of the following spells
                            for (int r = e.Slot + 1; r < list.RowCount; r++)
                            {
                                UpdateSpellRow(list[r], r);
                            }
                        }
                    }
                    break;

                case AddRemoveEventType.Delete:
                    // Update spellbar structure
                    for (int i = 0; i < mSpellTabs[e.Tab].Count; i++)
                    {
                        if (mSpellTabs[e.Tab][i].Id == e.SpellId)
                        {
                            mSpellTabs[e.Tab].RemoveAt(i);

                            // Update spell list if <Current> is selected
                            if (IsDisplayingCurrentChar)
                            {
                                list.Delete(i);

                                if (mSpellTabs[e.Tab].Count == 0)
                                {
                                    InsertEmptyTabRow(list);
                                }
                                else
                                {
                                    for (int r = i; r < list.RowCount; r++)
                                    {
                                        // Update the slot numbers on all of the following spells
                                        UpdateSpellRow(list[r], r);
                                    }
                                }
                            }
                            break;
                        }
                    }
                    break;
                }
            }
            catch (Exception ex) { Util.HandleException(ex); }
        }