Esempio n. 1
0
 private void buildDropDowns()
 {
     // Charm Colour
     string[] charmTiers = new TH1Helper().charmTierNameArray;
     comboTier.ItemsSource = null;
     comboTier.ItemsSource = charmTiers;
 }
Esempio n. 2
0
        public static void initLoadCharList()
        {
            log("Refreshing Character List View");
            List <CharList>       lst  = loadCharList();
            List <CharListImages> lsti = new List <CharListImages>();
            TH1Helper             ca   = new TH1Helper();

            lst.Sort(delegate(CharList c1, CharList c2) { return(c1.importedon.CompareTo(c2.importedon)); });
            lst.Reverse();
            foreach (CharList cl in lst)
            {
                CharListImages il = new CharListImages();
                il.name       = cl.name;
                il.level      = cl.level;
                il.importedon = cl.importedon;
                il.exp        = cl.exp;
                il.hash       = cl.hash;
                il.path       = cl.path;
                il.cclass     = cl.cclass;
                il.bounty     = cl.bounty;
                il.image      = classToImage(Array.IndexOf(ca.classNamesArray, cl.cclass));
                il.calign     = cl.calign;
                il.lastplayed = cl.lastplayed;
                lsti.Add(il);
            }

            ObservableCollection <CharListImages> obsicol = new ObservableCollection <CharListImages>(lsti);

            obsicol.CollectionChanged += lstCharacter_OnChange;
            MainWindow._CharactersUC.lstCharacters.ItemsSource = obsicol;
        }
Esempio n. 3
0
        private void mnuCompleteSelected(object sender, RoutedEventArgs e)
        {
            EditorWindow ewin = (EditorWindow)Window.GetWindow(this);

            if (ewin == null)
            {
                return;
            }
            var _save = ewin._save;

            if (_save == null)
            {
                return;
            }

            TH1Helper _help = new TH1Helper();

            foreach (TH1CharmExt _charm in dataInventry.SelectedItems)
            {
                _charm.progress = (uint)_charm.target;
                for (int i = 0; i < _charm.runesReq.Count; i++)
                {
                    _charm.runesReq[i] = i < _charm.charm.runeList.Count;
                }
            }

            _save.charmsInventry     = (List <TH1CharmExt>)dataInventry.ItemsSource;
            dataInventry.ItemsSource = null;
            dataInventry.ItemsSource = _save.charmsInventry;
            recountCharms();
        }
Esempio n. 4
0
        private void mnuDuplicateSelected(object sender, RoutedEventArgs e)
        {
            EditorWindow ewin = (EditorWindow)Window.GetWindow(this);

            if (ewin == null)
            {
                return;
            }
            var _save = ewin._save;

            if (_save == null)
            {
                return;
            }

            TH1Helper _help = new TH1Helper();

            foreach (TH1CharmExt _charm in dataInventry.SelectedItems)
            {
                if (_save.charmsInventry.Count < _help.LIMIT_MAX_CHARMS)
                {
                    _save.charmsInventry.Add(_charm);
                }
            }

            dataInventry.ItemsSource = null;
            dataInventry.ItemsSource = _save.charmsInventry;
            recountCharms();
        }
Esempio n. 5
0
        private void btnAddRune_Click(object sender, RoutedEventArgs e)
        {
            RuneEditorWindow dlg  = new RuneEditorWindow();
            EditorWindow     ewin = (EditorWindow)Window.GetWindow(this);

            dlg.Owner          = ewin;
            dlg.runeCollection = ewin.db.runeMCollection;
            TH1Helper _help = new TH1Helper();

            if (gridRunes.Items.Count < _help.LIMIT_MAX_RUNES)
            {
                if (dlg.ShowDialog().Equals(true))
                {
                    Functions.log(string.Format("Creating New Rune [{0}]", dlg.thisRune.rune.runeString));
                    gridRunes.ItemsSource = null;
                    if ((dlg.thisRune.calcValue == 0) && (dlg.thisRune.valueModifier != 0))
                    {
                        Functions.log(string.Format("Value Modifier Caused The Rune Value To Go Out Of Bounds ({0})"), Functions.LC_WARNING);
                        dlg.thisRune.valueModifier = 0;
                    }
                    ewin._save.runes.Add(dlg.thisRune);
                    gridRunes.ItemsSource = ewin._save.runes;
                    recountRunes();
                }
                else
                {
                    Functions.log("User Cancelled");
                }
            }
            else
            {
                Functions.log("Max Rune Limit Reached, Cannot Create New Rune", Functions.LC_WARNING);
                MessageBox.Show(String.Format("You Have Reached The Maximum Number Of Runes ({0})", _help.LIMIT_MAX_RUNES), "Rune Limit Reached", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
Esempio n. 6
0
        private void showCharmEditorWindow(int index)
        {
            EditorWindow ewin  = (EditorWindow)Window.GetWindow(this);
            TH1Helper    _help = new TH1Helper();

            CharmEditorWindow dlg = new CharmEditorWindow();

            dlg.Owner           = Window.GetWindow(this);
            dlg.charmIndex      = index;
            dlg.charmCollection = ewin.db.charmCollection;

            if (index > -1)
            {
                dlg._thisCharm = (TH1CharmExt)dataInventry.Items[index];
                Functions.log(string.Format("Editing Charm #{0} ({1})", index, dlg._thisCharm.charmString), Functions.LC_PRIMARY);
            }
            else
            {
                if (ewin._save.charmsInventry.Count >= _help.LIMIT_MAX_CHARMS)
                {
                    MessageBox.Show(string.Format("You Have Reached The Maximum Number Of Charms Possible ({0})", _help.LIMIT_MAX_CHARMS));
                    Functions.log("Unable To Create New Charm As Inventry Is Full", Functions.LC_WARNING);
                    return;
                }
                Functions.log("Creating New Charm", Functions.LC_PRIMARY);
            }

            if (dlg.ShowDialog().Equals(true))
            {
                Functions.log("Saving Charm");

                /*
                 * if ((dlg.thisRune.calcValue == 0) && (dlg.thisRune.valueModifier != 0))
                 * {
                 *   Functions.log(string.Format("Value Modifier Caused The Rune Value To Go Out Of Bounds ({0})", dlg.thisRune.valueModifier), Functions.LC_WARNING);
                 *   dlg.thisRune.valueModifier = 0;
                 * }
                 */

                dataInventry.ItemsSource = null;
                // Add Or Edit
                if (index > -1)
                {
                    ewin._save.charmsInventry[dlg.charmIndex] = dlg._thisCharm;
                }
                else
                {
                    ewin._save.charmsInventry.Add(dlg._thisCharm);
                }

                dataInventry.ItemsSource = ewin._save.charmsInventry;
                recountCharms();
            }
            else
            {
                Functions.log("User Cancelled");
            }
        }
Esempio n. 7
0
        private void buildDropDowns()
        {
            // Rune Colour
            string[] colourNames = new TH1Helper().runeColourNameArray;
            comboColour.Items.Clear();
            comboColour.ItemsSource = colourNames;

            // Paint Colour
            string[] paintColours = new TH1PaintCollection().paintNameArray();
            comboPaint.Items.Clear();
            comboPaint.ItemsSource = paintColours;
        }
Esempio n. 8
0
        public static void importCharSave(TH1SaveStructure save)
        {
            bool alreadylisted = false;

            Directory.CreateDirectory("saves");

            if (save.lastError == 0)
            {
                // Generate list
                ObservableCollection <CharListImages> list = (ObservableCollection <CharListImages>)MainWindow._CharactersUC.lstCharacters.ItemsSource;
                CharListImages item = new CharListImages();
                TH1Helper      ca   = new TH1Helper();

                // Generate item
                item.hash       = BitConverter.ToString(save.hash).Replace("-", "");
                item.name       = save.character.name;
                item.exp        = save.character.exp.ToString("N0");
                item.level      = save.character.level;
                item.importedon = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                item.bounty     = save.character.bounty.ToString("N0");
                item.cclass     = ca.classNamesArray[save.character.charClass];
                item.calign     = ca.alignmentNamesArray[save.character.alignment];
                item.image      = classToImage(save.character.charClass);
                item.lastplayed = save.character.lastSave.ToString();

                // Backup save
                item.path = @"saves\" + item.hash + ".th1";
                save.writeSaveFile(item.path);

                // Check if already in the list
                for (int i = 0; i < list.Count; i++)
                {
                    if (list[i].hash == item.hash)
                    {
                        alreadylisted = true;
                        list[i]       = item;
                    }
                }

                // Save list
                if (!alreadylisted)
                {
                    list.Insert(0, item);
                }
            }
        }
Esempio n. 9
0
        public void unequipItem(int index)
        {
            // Window
            EditorWindow ewin = (EditorWindow)Window.GetWindow(this);

            if (ewin == null)
            {
                return;
            }
            // Save
            var _save = ewin._save;

            if (_save == null)
            {
                return;
            }

            TH1Helper _help = new TH1Helper();

            try
            {
                if (_save.charmsInventry.Count >= _help.LIMIT_MAX_CHARMS)
                {
                    MessageBox.Show("Your Charm Inventry Is Full - You Cannot Unequip This Charm.", "Unequip Error", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    return;
                }

                dataInventry.ItemsSource = null;
                _save.charmsActive[index].inActiveSlot = false; // No Longer Active
                _save.charmsInventry.Add(_save.charmsActive[index]);
                _save.charmsActive[index] = new TH1CharmExt(null);
                dataInventry.ItemsSource  = _save.charmsInventry;
                recountCharms();
                loadCharmsInPlace();
            } catch { MessageBox.Show("There Was An Error When Trying To Unequip This Charm", "Unequip Error", MessageBoxButton.OK, MessageBoxImage.Error); }
        }
Esempio n. 10
0
        private void setWindowTitle()
        {
            TH1Helper ca = new TH1Helper();

            this.Title = _save.character.name + ": L" + _save.character.level.ToString("N0") + " " + ca.alignmentNamesArray[_save.character.alignment] + ", " + ca.classNamesArray[_save.character.charClass];
        }