private void CloneFromSaveEchoes_Click(object sender, EventArgs e)
        {
            int index = GetSelectedEchoList();

            if (index == -1)
            {
                MessageBox.Show("Select a single echo list to import to first.");
                return;
            }

            Util.WTOpenFileDialog tempOpen = new Util.WTOpenFileDialog("sav", "");

            if (tempOpen.ShowDialog() == DialogResult.OK)
            {
                WillowSaveGame OtherSave = new WillowSaveGame();

                try
                {
                    OtherSave.LoadWsg(tempOpen.FileName());
                }
                catch { MessageBox.Show("Couldn't open the other save file."); return; }

                if (OtherSave.NumberOfEchoLists - 1 < index)
                {
                    MessageBox.Show("The echo list does not exist in the other savegame file.");
                    return;
                }

                // Replace the old entries in the echo table with the new ones
                CurrentWSG.EchoLists[index] = OtherSave.EchoLists[index];

                WillowSaveGame.EchoTable et = CurrentWSG.EchoLists[index];

                EchoTree.BeginUpdate();
                TreeNodeAdv parent = EchoTree.Root.Children[index];

                // Remove the old entries from the tree view
                TreeNodeAdv[] children = parent.Children.ToArray();
                foreach (TreeNodeAdv child in children)
                {
                    child.Remove();
                }

                // Add the new entries to the tree view
                foreach (WillowSaveGame.EchoEntry ee in et.Echoes)
                {
                    string name = ee.Name;

                    ColoredTextNode node = new ColoredTextNode();
                    node.Tag  = name;
                    node.Text = EchoesXml.XmlReadValue(name, "Subject");
                    if (node.Text == "")
                    {
                        node.Text = "(" + name + ")";
                    }
                    parent.AddNode(node);
                }
                EchoTree.EndUpdate();
            }
        }
        private void EchoList_Click(object sender, EventArgs e)
        {
            newToolStripMenuItem1.HideDropDown();

            if (EchoList.SelectedIndex == -1)
            {
                return;
            }

            int index = GetSelectedEchoList();

            if (index == -1)
            {
                MessageBox.Show("Select an echo list first.");
                return;
            }

            string name = EchoesXml.stListSectionNames()[EchoList.SelectedIndex];

            // Create a new echo entry and populate it
            WillowSaveGame.EchoEntry ee = new WillowSaveGame.EchoEntry();
            ee.Name = name;
            // TODO: These values shouldn't always be zero, but the data doesn't
            // exist in the data files yet.  When the proper data is in the data
            // file then it needs to be looked up here.
            ee.DlcValue1 = 0;
            ee.DlcValue2 = 0;

            // Add the new echo to the echo list
            WillowSaveGame.EchoTable et = CurrentWSG.EchoLists[index];
            et.Echoes.Add(ee);
            et.TotalEchoes++;

            // Add the new echo to the echo tree view
            ColoredTextNode treeNode = new ColoredTextNode();

            treeNode.Tag  = name;
            treeNode.Text = EchoesXml.XmlReadValue(name, "Subject");
            if (treeNode.Text == "")
            {
                treeNode.Text = "(" + treeNode.Tag as string + ")";
            }
            TreeNodeAdv parent = EchoTree.Root.Children[index];

            parent.AddNode(treeNode);

            // Select the newly added node so the user will know it was added
            EchoTree.SelectedNode = parent.Children[parent.Children.Count - 1];
            EchoTree.EnsureVisible(EchoTree.SelectedNode);
        }
Esempio n. 3
0
        private void ImportFromSaveQuests_Click(object sender, EventArgs e)
        {
            int index = GetSelectedQuestList();

            if (index == -1)
            {
                MessageBox.Show("Select a playthrough to import to first.");
                return;
            }

            Util.WTOpenFileDialog tempOpen = new Util.WTOpenFileDialog("sav", "");

            if (tempOpen.ShowDialog() == DialogResult.OK)
            {
                WillowSaveGame OtherSave = new WillowSaveGame();

                try
                {
                    OtherSave.LoadWsg(tempOpen.FileName());
                }
                catch { return; }

                if (OtherSave.NumberOfQuestLists - 1 < index)
                {
                    MessageBox.Show("This quest list does not exist in the other savegame file.");
                    return;
                }

                // Note that when you set lists equal to one another like this it doesn't copy
                // the elements, only the pointer to the list.  This is only safe here because
                // OtherSave will be disposed of right away and not modify the values.  If OtherSave
                // was being used actively then a new copy of all the elements in the quest list
                // would have to be made or else changes to one would affect the quest
                // list of the other.

                // Replace the old entries in the quest table with the new ones
                CurrentWSG.QuestLists[index] = OtherSave.QuestLists[index];

                WillowSaveGame.QuestTable qt = CurrentWSG.QuestLists[index];

                QuestTree.BeginUpdate();
                TreeNodeAdv parent = QuestTree.Root.Children[index];

                // Remove the old entries from the tree view
                TreeNodeAdv[] children = parent.Children.ToArray();
                foreach (TreeNodeAdv child in children)
                {
                    child.Remove();
                }

                // Add the new entries to the tree view
                foreach (WillowSaveGame.QuestEntry qe in qt.Quests)
                {
                    string nodeName = qe.Name;

                    ColoredTextNode node = new ColoredTextNode();
                    node.Tag  = nodeName;
                    node.Text = QuestsXml.XmlReadValue(nodeName, "MissionName");
                    if (node.Text == "")
                    {
                        node.Text = "(" + node.Tag as string + ")";
                    }
                    parent.AddNode(node);
                }
                QuestTree.EndUpdate();
            }
        }
Esempio n. 4
0
        private void QuestList_SelectedIndexChanged(object sender, EventArgs e)
        {
            int index = GetSelectedQuestList();

            if (index == -1)
            {
                MessageBox.Show("Select a playthrough to add to first.");
                return;
            }

            int SelectedItem = QuestList.SelectedIndex;

            NewQuest.HideDropDown();
            try
            {
                if (SelectedItem != -1)
                {
                    WillowSaveGame.QuestTable qt = CurrentWSG.QuestLists[index];

                    List <string> sectionNames = QuestsXml.stListSectionNames();

                    WillowSaveGame.QuestEntry qe = new WillowSaveGame.QuestEntry();
                    string name = sectionNames[SelectedItem];
                    qe.Name     = name;
                    qe.Progress = 1;
                    // TODO: These should not always be zero.  They are non-zero for
                    // missions that are from the DLCs.  The data files dont
                    // contain the values they should be yet, so once that data
                    // is added to the data files these should be changed.
                    qe.DlcValue1 = 0;
                    qe.DlcValue2 = 0;

                    List <WillowSaveGame.QuestObjective> objectives = new List <WillowSaveGame.QuestObjective>();

                    int objectiveCount;

                    XmlNode questXmlNode = QuestsXml.XmlReadNode(name);
                    System.Diagnostics.Debug.Assert(questXmlNode != null);

                    for (objectiveCount = 0; ; objectiveCount++)
                    {
                        WillowSaveGame.QuestObjective objective;

                        string desc = questXmlNode.GetElement("Objectives" + objectiveCount, "");
                        if (desc == "")
                        {
                            break;
                        }

                        objective.Description = desc;
                        objective.Progress    = 0;
                        objectives.Add(objective);
                    }

                    qe.NumberOfObjectives = objectiveCount;
                    qe.Objectives         = objectives.ToArray();

                    qt.Quests.Add(qe);
                    qt.TotalQuests++;

                    ColoredTextNode treeNode = new ColoredTextNode();
                    treeNode.Tag  = name;
                    treeNode.Text = questXmlNode.GetElement("MissionName", "");

                    if (treeNode.Text == "")
                    {
                        treeNode.Text = "(" + name + ")";
                    }

                    TreeNodeAdv parent = QuestTree.Root.Children[index];
                    parent.AddNode(treeNode);
                    QuestTree.SelectedNode = parent.Children[parent.Children.Count - 1];
                }
            }
            catch { }
        }
Esempio n. 5
0
        public TreeNodeAdv CreateNavigationNodes(InventoryEntry entry)
        {
            int[] sortmodes = IEComparisonEngine.CurrentComparer().comparisons;
            int   loopcount = (NavigationLayers < sortmodes.Length) ? NavigationLayers : sortmodes.Length;

            TreeNodeAdv navnode   = null;
            TreeNodeAdv newbranch = null;
            string      currentcategory;
            string      categorytext;

            for (int i = 0; i < loopcount; i++)
            {
                // 0: Name
                // 1: Rarity
                // 2: Category
                // 3: Title
                // 4: Prefix
                // 5: Model
                // 6: Manufacturer
                // 7: Level
                // 8: Key

                switch (sortmodes[i])
                {
                case 2:
                    currentcategory = entry.Category;
                    if (currentcategory == "")
                    {
                        currentcategory = "none";
                    }
                    if (!CategoryLookup.TryGetValue(currentcategory, out categorytext))
                    {
                        currentcategory = "(Unknown)";
                        categorytext    = "(Unknown)";
                    }
                    break;

                case 6:
                    currentcategory = entry.NameParts[0];
                    if (currentcategory == "")
                    {
                        currentcategory = "No Manufacturer";
                    }
                    categorytext = currentcategory;
                    break;

                case 7:
                    currentcategory = "Level " + entry.EffectiveLevel.ToString();
                    categorytext    = currentcategory;
                    break;

                case 3:
                    currentcategory = entry.NameParts[3];
                    if (currentcategory == "")
                    {
                        currentcategory = "No Title";
                    }
                    categorytext = currentcategory;
                    break;

                case 4:
                    currentcategory = entry.NameParts[2];
                    if (currentcategory == "")
                    {
                        currentcategory = "No Prefix";
                    }
                    categorytext = currentcategory;
                    break;

                case 5:
                    currentcategory = entry.NameParts[1];
                    if (currentcategory == "")
                    {
                        currentcategory = "No Model";
                    }
                    categorytext = currentcategory;
                    break;

                case 1:
                    currentcategory = entry.Name;
                    categorytext    = currentcategory;
                    break;

                default:
                    return(navnode);
                }

                //Debugger.Break();
                //if (navnode == null)
                //    newbranch = Tree.FindFirstNodeByTag(currentcategory, false);
                //else
                if (navnode != null)
                {
                    newbranch = navnode.FindFirstByTag(currentcategory, false);
                }
                else
                {
                    newbranch = Tree.Root.FindFirstByTag(currentcategory, false);
                }

                if (newbranch == null)
                {
                    // This category does not exist yet.  Create a node for it.
                    ColoredTextNode data = new ColoredTextNode();
                    data.Tag       = currentcategory;
                    data.ForeColor = Color.LightSkyBlue;
                    if (GlobalSettings.UseColor)
                    {
                        data.Text = categorytext;
                    }
                    else
                    {
                        data.Text = "--- " + categorytext + " ---";
                    }

                    if (navnode == null)
                    {
                        (Tree.Model as TreeModel).Nodes.Add(data);
                        navnode = Tree.Root;
                    }
                    else
                    {
                        navnode.AddNode(data);
                    }

                    newbranch = navnode.Children[navnode.Children.Count - 1];
                    //newbranch = navnode.FindFirstByTag(currentcategory, false);

                    //if (navnode == null)
                    //{
                    //    (Tree.Model as TreeModel).Nodes.Add(data);
                    //    newbranch = Tree.FindNodeByTag(data).Tag as Node;
                    //}
                    //else
                    //    navnode.Nodes.Add(newbranch);
                }
                // Update the navnode then iterate again for the next tier of
                // category nodes until all category nodes are present
                navnode = newbranch;
            }
            return(navnode);
        }