Exemplo n.º 1
0
        public static XmlFile XmlFileFromCache(string filename)
        {
            if (string.IsNullOrEmpty(filename))
            {
                return(null);
            }

            // Cache all XML files opened with XmlFileFromCache in a
            // dictionary then reuse them.  This prevents having to re-read
            // the file data constantly by creating a new XmlFile then
            // releasing it.
            XmlFile xml;

            if (XmlCache.TryGetValue(filename, out xml))
            {
                return(xml);
            }

            // If its not in the cache then open from disk and add to cache
            xml = new XmlFile(filename);
            XmlCache.Add(filename, xml);
            return(xml);
        }
Exemplo n.º 2
0
        // 2 references
        public static List <string> GetPartSection(string part)
        {
            string Database = part.Before('.');

            if (Database == "")
            {
                return(null);
            }

            string PartName = part.After('.');

            string DbFileName = XmlPath + Database + ".xml";

            if (!System.IO.File.Exists(DbFileName))
            {
                return(null);
            }

            XmlFile DataFile = XmlFile.XmlFileFromCache(DbFileName);

            List <string> section = DataFile.XmlReadSection(PartName);

            return(section);
        }
Exemplo n.º 3
0
        // 27 references - Fetch a given attribute from a part
        public static string GetPartAttribute(string part, string AttributeName)
        {
            string Database = part.Before('.');

            if (Database == "")
            {
                return("");
            }

            string PartName = part.After('.');

            string DbFileName = DataPath + Database + ".txt";

            if (!System.IO.File.Exists(DbFileName))
            {
                return("");
            }

            XmlFile DataFile = XmlFile.XmlFileFromCache(DbFileName);

            string ComponentText = DataFile.XmlReadValue(PartName, AttributeName);

            return(ComponentText);
        }
Exemplo n.º 4
0
        // 3 references - read name from xml of 12+13 weapon or 7+8 item, analyze 1 weapon or 2 item for class - output is class + name
        public string GetName(XmlFile xml, List<string> PartArray, int NumberOfSubParts, string INIValueToRetrieve, string Itemtype)
        {
            string Name = "";
            string itemtypeprefix = "";
            for (int build = 0; build < NumberOfSubParts; build++)
            {

                // Get the Weapontype from part0 (Itemgrade)
                //gd_itemgrades.Weapons_Eridan.ItemGrade_Eridan_SMG_Blaster
                if ((Itemtype == "Item") && (build == 1))
                {
                    //Type in Part2 -> strParts[2]
                    itemtypeprefix = PartArray[build].Substring(PartArray[build].LastIndexOf(".") + 1);
                    itemtypeprefix = itemtypeprefix.Substring(itemtypeprefix.IndexOf("_") + 1) + " ";
                }

                if ((Itemtype == "Weapon") && (build == 0))
                {
                    //Type in Part1 -> strParts[1]

                    itemtypeprefix = PartArray[build].Substring(PartArray[build].LastIndexOf(".") + 1);
                    itemtypeprefix = itemtypeprefix.Substring(itemtypeprefix.IndexOf("_") + 1) + " ";
                    if (itemtypeprefix.StartsWith("Weapon_"))
                        itemtypeprefix = itemtypeprefix.Substring(7);
                }

                // Names in Weapons only in Build 12,13 Items only in 7,8
                if (((Itemtype == "Weapon") && (build == 12 || build == 13)) || ((Itemtype == "Item") && (build == 7 || build == 8)))
                {
                    string iniReadvalue = xml.XmlReadValue(PartArray[build], INIValueToRetrieve);

                    if (Name == "" && iniReadvalue != "")
                        Name = iniReadvalue;
                    else if (iniReadvalue != null && iniReadvalue != "")
                        Name = (Name + " " + iniReadvalue);
                }
            }

            return itemtypeprefix + Name;
        }
Exemplo n.º 5
0
        private void QuestProgress_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                XmlFile Quests = new XmlFile(AppDir + "\\Data\\Quests.ini");
                if (QuestTree.SelectedNode.Name == "PT1" && Clicked == true)
                {
                    if (CurrentWSG.PT1Values[QuestTree.SelectedNode.Index, 0] == 4 && QuestProgress.SelectedIndex < 3)
                    {
                        Objectives.Items.Clear();
                        int TotalObjectives = 0;

                        //string curTxt;
                        for (int Progress = 0; Progress < 5; Progress++)
                        {
                            //curTxt = Quests.IniReadValue(QuestString.Text, "Objectives[" + Progress + "]");
                            if (Quests.XmlReadValue(QuestString.Text, "Objectives" + Progress) == "") break;
                            else TotalObjectives = Progress + 1;
                        }
                        CurrentWSG.PT1Values[QuestTree.SelectedNode.Index, 3] = TotalObjectives;
                        for (int Progress = 0; Progress < 5; Progress++)
                            CurrentWSG.PT1Subfolders[QuestTree.SelectedNode.Index, Progress] = "None";
                        NumberOfObjectives.Value = TotalObjectives;
                        if (TotalObjectives > 0)
                            for (int Progress = 0; Progress < TotalObjectives; Progress++)
                                Objectives.Items.Add(Quests.XmlReadValue(QuestString.Text, "Objectives" + Progress));
                        ObjectiveValue.Value = 0;
                        CurrentWSG.PT1Values[QuestTree.SelectedNode.Index, 0] = QuestProgress.SelectedIndex;
                        CurrentWSG.PT1Values[QuestTree.SelectedNode.Index, 3] = TotalObjectives;
                        for (int Progress = 0; Progress < 5; Progress++)
                            CurrentWSG.PT1Subfolders[QuestTree.SelectedNode.Index, Progress] = "None";
                    }
                    else if (CurrentWSG.PT1Values[QuestTree.SelectedNode.Index, 0] != 4 && QuestProgress.SelectedIndex == 3)
                    {
                        Objectives.Items.Clear();
                        CurrentWSG.PT1Values[QuestTree.SelectedNode.Index, 0] = 4;
                        CurrentWSG.PT1Values[QuestTree.SelectedNode.Index, 3] = 0;
                    }
                    else if (CurrentWSG.PT1Values[QuestTree.SelectedNode.Index, 0] != 4 && QuestProgress.SelectedIndex < 3)
                        CurrentWSG.PT1Values[QuestTree.SelectedNode.Index, 0] = QuestProgress.SelectedIndex;
                }
                else if (QuestTree.SelectedNode.Name == "PT2" && Clicked == true)
                {
                    if (CurrentWSG.PT2Values[QuestTree.SelectedNode.Index, 0] == 4 && QuestProgress.SelectedIndex < 3)
                    {
                        Objectives.Items.Clear();
                        int TotalObjectives = 0;
                        for (int Progress = 0; Progress < 5; Progress++)
                            if (Quests.XmlReadValue(QuestString.Text, "Objectives" + Progress) == "") break;
                            else TotalObjectives = Progress + 1;
                        CurrentWSG.PT2Values[QuestTree.SelectedNode.Index, 3] = TotalObjectives;
                        for (int Progress = 0; Progress < 5; Progress++)
                            CurrentWSG.PT2Subfolders[QuestTree.SelectedNode.Index, Progress] = "None";
                        NumberOfObjectives.Value = TotalObjectives;
                        if (NumberOfObjectives.Value > 0)
                            for (int Progress = 0; Progress < NumberOfObjectives.Value; Progress++)
                                Objectives.Items.Add(Quests.XmlReadValue(QuestString.Text, "Objectives" + Progress));
                        ObjectiveValue.Value = 0;
                        CurrentWSG.PT2Values[QuestTree.SelectedNode.Index, 0] = QuestProgress.SelectedIndex;
                        CurrentWSG.PT2Values[QuestTree.SelectedNode.Index, 3] = TotalObjectives;
                    }
                    else if (CurrentWSG.PT2Values[QuestTree.SelectedNode.Index, 0] != 4 && QuestProgress.SelectedIndex == 3)
                    {
                        Objectives.Items.Clear();
                        CurrentWSG.PT2Values[QuestTree.SelectedNode.Index, 0] = 4;
                        CurrentWSG.PT2Values[QuestTree.SelectedNode.Index, 3] = 0;
                        //for (int Progress = 0; Progress < 5; Progress++)
                        //    CurrentWSG.PT2Subfolders[QuestTree.SelectedNode.Index, Progress] = "None";
                    }
                    else if (CurrentWSG.PT2Values[QuestTree.SelectedNode.Index, 0] != 4 && QuestProgress.SelectedIndex < 3)
                        CurrentWSG.PT2Values[QuestTree.SelectedNode.Index, 0] = QuestProgress.SelectedIndex;

                }
            }
            catch { }
        }
Exemplo n.º 6
0
        private void SaveToFile(string filename)
        {
            //Ini.IniFile Locations = new Ini.IniFile(AppDir + "\\Data\\Locations.ini");
            XmlFile Locations = new XmlFile(AppDir + "\\Data\\Locations.ini");

            if (BankSpace.Enabled)
                CurrentWSG.DLC.BankSize = (int)BankSpace.Value;

            if (Class.SelectedIndex == 0) CurrentWSG.Class = "gd_Roland.Character.CharacterClass_Roland";
            else if (Class.SelectedIndex == 1) CurrentWSG.Class = "gd_lilith.Character.CharacterClass_Lilith";
            else if (Class.SelectedIndex == 2) CurrentWSG.Class = "gd_mordecai.Character.CharacterClass_Mordecai";
            else if (Class.SelectedIndex == 3) CurrentWSG.Class = "gd_Brick.Character.CharacterClass_Brick";
            CurrentWSG.CharacterName = CharacterName.Text;
            CurrentWSG.Level = (int)Level.Value;
            CurrentWSG.Experience = (int)Experience.Value;
            CurrentWSG.SkillPoints = (int)SkillPoints.Value;
            CurrentWSG.FinishedPlaythrough1 = PT2Unlocked.SelectedIndex;
            CurrentWSG.Cash = (int)Cash.Value;
            CurrentWSG.BackpackSize = (int)BackpackSpace.Value;
            CurrentWSG.EquipSlots = (int)EquipSlots.Value;
            CurrentWSG.SaveNumber = (int)SaveNumber.Value;
            if (CurrentLocation.SelectedText != "" && CurrentLocation.SelectedText != null)
                CurrentWSG.CurrentLocation = Locations.stListSectionNames()[CurrentLocation.SelectedIndex];

            if (CurrentWSG.Platform == "PS3" || CurrentWSG.Platform == "PC")
            {
                using (BinaryWriter Save = new BinaryWriter(new FileStream(filename, FileMode.Create)))
                {
                    Save.Write(CurrentWSG.SaveWSG());
                }
            }

            else if (CurrentWSG.Platform == "X360")
            {
                string tempSaveName = filename + ".temp";
                using (BinaryWriter Save = new BinaryWriter(new FileStream(tempSaveName, FileMode.Create)))
                {
                    Save.Write(CurrentWSG.SaveWSG());
                }

                BuildXboxPackage(filename, tempSaveName);
                File.Delete(tempSaveName);
            }
            CurrentWSG.OpenedWSG = filename;
        }
Exemplo n.º 7
0
        private void LocationsList_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {

                XmlFile Locations = new XmlFile(AppDir + "\\Data\\Locations.ini");
                int SelectedItem = LocationsList.SelectedIndex;
                CurrentWSG.TotalLocations = CurrentWSG.TotalLocations + 1;
                ResizeArrayLarger(ref CurrentWSG.LocationStrings, CurrentWSG.TotalLocations);
                CurrentWSG.LocationStrings[CurrentWSG.TotalLocations - 1] = Locations.stListSectionNames()[SelectedItem];
                DoLocationTree();

            }
            catch { }
        }
Exemplo n.º 8
0
        private void PartCategories_AfterNodeSelect(object sender, AdvTreeNodeEventArgs e)
        {
            WeaponPartInfo.Clear();
            try
            {
                // Read ALL subsections of a given XML section
                // File: (AppDir + "\\Data\\" + PartCategories.SelectedNode.Parent.Text + ".txt")
                XmlFile Category = new XmlFile(AppDir + "\\Data\\" + PartCategories.SelectedNode.Parent.Text + ".txt");

                // XML Section: PartCategories.SelectedNode.Text
                List<string> xmlSection = Category.XmlReadSection(PartCategories.SelectedNode.Text);

                WeaponPartInfo.Lines = xmlSection.ToArray();
                /*
                if (File.Exists(AppDir + "\\Data\\" + PartCategories.SelectedNode.Parent.Text + ".txt"))
                {
                    string[] InText = File.ReadAllLines(AppDir + "\\Data\\" + PartCategories.SelectedNode.Parent.Text + ".txt");
                    int start = 0;
                    int end = 1;
                    string search = "[" + PartCategories.SelectedNode.Text + "]";
                    ArrayList Lines = new ArrayList();
                    for (int i1 = 0; i1 < InText.Length; i1++)
                    {
                        if (InText[i1].Contains(search))
                        {
                            start = i1;
                            i1 = InText.Length;
                        }
                    }
                    for (int i2 = start + 1; i2 < InText.Length; i2++)
                    {
                        if (InText[i2].Contains("[") == true && InText[i2].Contains("=") == false)
                        {
                            end = i2;
                            i2 = InText.Length;
                        }
                    }
                    if(start > end)
                        for (start++; start < InText.Length; start++)
                        {

                                InText[start].Replace("=", ": ");
                                Lines.Add(InText[start]);

                        }
                    else
                    for (start++; start < end; start++)
                    {

                            InText[start].Replace("=", ": ");
                            Lines.Add(InText[start]);

                    }
                    WeaponPartInfo.Lines = (string[])Lines.ToArray(typeof(string));

                }*/
            }
            catch { }
        }
Exemplo n.º 9
0
        private void ImportQuests_Click(object sender, EventArgs e)
        {
            try
            {
                if (QuestTree.SelectedNode.Name == "PT2")
                {
                    OpenFileDialog tempImport = new OpenFileDialog();
                    tempImport.DefaultExt = "*.quests";
                    tempImport.Filter = "Quest Data(*.quests)|*.quests";

                    tempImport.FileName = CurrentWSG.CharacterName + "'s PT2 Quests.quests";
                    if (tempImport.ShowDialog() == DialogResult.OK)
                    {
                        //Ini.IniFile ImportQuests = new Ini.IniFile(tempImport.FileName);
                        XmlFile ImportQuests = new XmlFile(tempImport.FileName);
                        string[] TempQuestStrings = new string[ImportQuests.stListSectionNames().Count];
                        int[,] TempQuestValues = new int[ImportQuests.stListSectionNames().Count, 10];
                        string[,] TempQuestSubfolders = new string[ImportQuests.stListSectionNames().Count, 7];
                        for (int Progress = 0; Progress < ImportQuests.stListSectionNames().Count; Progress++)
                        {
                            TempQuestStrings[Progress] = ImportQuests.stListSectionNames()[Progress];
                            TempQuestValues[Progress, 0] = Convert.ToInt32(ImportQuests.XmlReadValue(ImportQuests.stListSectionNames()[Progress], "Progress"));
                            TempQuestValues[Progress, 1] = Convert.ToInt32(ImportQuests.XmlReadValue(ImportQuests.stListSectionNames()[Progress], "DLCValue1"));
                            TempQuestValues[Progress, 2] = Convert.ToInt32(ImportQuests.XmlReadValue(ImportQuests.stListSectionNames()[Progress], "DLCValue2"));
                            TempQuestValues[Progress, 3] = Convert.ToInt32(ImportQuests.XmlReadValue(ImportQuests.stListSectionNames()[Progress], "Objectives"));
                            for (int Folders = 0; Folders < TempQuestValues[Progress, 3]; Folders++)
                            {
                                TempQuestValues[Progress, Folders + 4] = Convert.ToInt32(ImportQuests.XmlReadValue(ImportQuests.stListSectionNames()[Progress], "FolderValue" + Folders));
                                TempQuestSubfolders[Progress, Folders] = ImportQuests.XmlReadValue(ImportQuests.stListSectionNames()[Progress], "FolderName" + Folders);
                            }
                        }
                        CurrentWSG.PT2Strings = TempQuestStrings;
                        CurrentWSG.PT2Values = TempQuestValues;
                        CurrentWSG.PT2Subfolders = TempQuestSubfolders;
                        CurrentWSG.TotalPT2Quests = ImportQuests.stListSectionNames().Count;
                        DoQuestTree();
                    }
                }
                else if (QuestTree.SelectedNode.Name == "PT1")
                {
                    OpenFileDialog tempImport = new OpenFileDialog();
                    tempImport.DefaultExt = "*.quests";
                    tempImport.Filter = "Quest Data(*.quests)|*.quests";

                    tempImport.FileName = CurrentWSG.CharacterName + "'s PT1 Quests.quests";
                    if (tempImport.ShowDialog() == DialogResult.OK)
                    {
                        XmlFile ImportQuests = new XmlFile(tempImport.FileName);
                        string[] TempQuestStrings = new string[ImportQuests.stListSectionNames().Count];
                        int[,] TempQuestValues = new int[ImportQuests.stListSectionNames().Count, 10];
                        string[,] TempQuestSubfolders = new string[ImportQuests.stListSectionNames().Count, 7];
                        for (int Progress = 0; Progress < ImportQuests.stListSectionNames().Count; Progress++)
                        {
                            TempQuestStrings[Progress] = ImportQuests.stListSectionNames()[Progress];
                            TempQuestValues[Progress, 0] = Convert.ToInt32(ImportQuests.XmlReadValue(ImportQuests.stListSectionNames()[Progress], "Progress"));
                            TempQuestValues[Progress, 1] = Convert.ToInt32(ImportQuests.XmlReadValue(ImportQuests.stListSectionNames()[Progress], "DLCValue1"));
                            TempQuestValues[Progress, 2] = Convert.ToInt32(ImportQuests.XmlReadValue(ImportQuests.stListSectionNames()[Progress], "DLCValue2"));
                            TempQuestValues[Progress, 3] = Convert.ToInt32(ImportQuests.XmlReadValue(ImportQuests.stListSectionNames()[Progress], "Objectives"));
                            for (int Folders = 0; Folders < TempQuestValues[Progress, 3]; Folders++)
                            {
                                TempQuestValues[Progress, Folders + 4] = Convert.ToInt32(ImportQuests.XmlReadValue(ImportQuests.stListSectionNames()[Progress], "FolderValue" + Folders));
                                TempQuestSubfolders[Progress, Folders] = ImportQuests.XmlReadValue(ImportQuests.stListSectionNames()[Progress], "FolderName" + Folders);
                            }
                        }
                        CurrentWSG.PT1Strings = TempQuestStrings;
                        CurrentWSG.PT1Values = TempQuestValues;
                        CurrentWSG.PT1Subfolders = TempQuestSubfolders;
                        CurrentWSG.TotalPT1Quests = ImportQuests.stListSectionNames().Count;
                        DoQuestTree();
                    }
                }
            }
            catch { MessageBox.Show("Select a playthrough to replace first."); }
        }
Exemplo n.º 10
0
        private void ImportWeaponsFromXml_Click(object sender, EventArgs e)
        {
            OpenFileDialog tempImport = new OpenFileDialog();
            tempImport.DefaultExt = "*.xml";
            tempImport.Filter = "WillowTree Locker(*.xml)|*.xml";

            tempImport.FileName = CurrentWSG.CharacterName + "'s Weapons.xml";
            if (tempImport.ShowDialog() == DialogResult.OK)
            {
                //Ini.IniFile ImportWTL = new Ini.IniFile(tempImport.FileName);
                XmlFile ImportWTL = new XmlFile(tempImport.FileName);
                if (IsDLCWeaponMode)
                {

                    for (int Progress = 0; Progress < ImportWTL.stListSectionNames("Weapon").Count; Progress++)
                    {
                        CurrentWSG.DLC.WeaponParts.Add(new List<string>());
                        for (int ProgressStrings = 0; ProgressStrings < 14; ProgressStrings++)
                            CurrentWSG.DLC.WeaponParts[CurrentWSG.DLC.WeaponParts.Count - 1].Add(ImportWTL.XmlReadValue(ImportWTL.stListSectionNames("Weapon")[Progress], "Part" + (ProgressStrings + 1)));

                        CurrentWSG.DLC.WeaponAmmo.Add(0);
                        CurrentWSG.DLC.WeaponQuality.Add(0);
                        CurrentWSG.DLC.WeaponLevel.Add(0);
                        CurrentWSG.DLC.WeaponEquippedSlot.Add(0);
                        CurrentWSG.DLC.TotalWeapons++;
                    }
                    DoDLCWeaponTree();
                }

                else
                {
                    for (int Progress = 0; Progress < ImportWTL.stListSectionNames("Weapon").Count; Progress++)
                    {
                        List<String> wpnstrings = new List<string>();
                        List<int> wpnvalues = new List<int>();
                        try
                        {
                            for (int ProgressStrings = 0; ProgressStrings < 14; ProgressStrings++)
                            {
                                string part = ImportWTL.XmlReadValue(ImportWTL.stListSectionNames("Weapon")[Progress], "Part" + (ProgressStrings + 1));
                                ThrowExceptionIfIntString(part);
                                wpnstrings.Add(part);
                            }

                            wpnvalues.Add(Int32FromString(ImportWTL.XmlReadValue(ImportWTL.stListSectionNames("Weapon")[Progress], "RemAmmo_Quantity"),0));
                            wpnvalues.Add(Int32FromString(ImportWTL.XmlReadValue(ImportWTL.stListSectionNames("Weapon")[Progress], "Quality"),0));
                            wpnvalues.Add(0); // set equipped slot to 0
                            wpnvalues.Add(Int32FromString(ImportWTL.XmlReadValue(ImportWTL.stListSectionNames("Weapon")[Progress], "Level"),0));
                        }
                        catch
                        {
                            MessageBox.Show("Error reading XML file.  Skipping item.");
                            continue;
                        }

                        CurrentWSG.WeaponStrings.Add(wpnstrings);
                        CurrentWSG.WeaponValues.Add(wpnvalues);
                        CurrentWSG.NumberOfWeapons++;
                    }

                    DoWeaponTree();
                }
            }
        }
Exemplo n.º 11
0
 public void DoLocationsList()
 {
     LocationsList.Items.Clear();
     CurrentLocation.Items.Clear();
     //Ini.IniFile Locations = new Ini.IniFile(AppDir + "\\Data\\Locations.ini");
     XmlFile Locations = new XmlFile(AppDir + "\\Data\\Locations.ini");
     foreach (string section in Locations.stListSectionNames())
     {
         string outpostname = Locations.XmlReadValue(section, "OutpostDisplayName");
         LocationsList.Items.Add(outpostname);
         CurrentLocation.Items.Add(outpostname);
     }
 }
Exemplo n.º 12
0
        public void DoLocationTree()
        {
            //Ini.IniFile PartList = new Ini.IniFile(AppDir + "\\Data\\Locations.ini");
            XmlFile PartList = new XmlFile(AppDir + "\\Data\\Locations.ini");
            //Ini.IniFile PartList = new Ini.IniFile(AppDir + "\\Data\\Locations.ini");
            LocationTree.Nodes.Clear();

            for (int build = 0; build < CurrentWSG.TotalLocations; build++)
            {
                //string name = PartList.IniReadValue(CurrentWSG.LocationStrings[build], "OutpostDisplayName");
                string name = PartList.XmlReadValue(CurrentWSG.LocationStrings[build], "OutpostDisplayName");
                Node TempNode = new Node();
                if (name != "")
                    TempNode.Text = name;
                else TempNode.Text = CurrentWSG.LocationStrings[build];

                LocationTree.Nodes.Add(TempNode);

            }
        }
Exemplo n.º 13
0
        /*public string GetName(Ini.IniFile INI, string[] PartArray, int DesiredPart, string INIValueToRetrieve)
        {
            string Name = "";

            Name = (INI.IniReadValue(PartArray[DesiredPart], INIValueToRetrieve));

            return Name;
        }*/
        // 29 references - Fetch single xml value from name in part array
        public string GetName(XmlFile xml, string[] PartArray, int DesiredPart, string INIValueToRetrieve)
        {
            string Name = "";

            Name = (xml.XmlReadValue(PartArray[DesiredPart], INIValueToRetrieve));

            return Name;
        }
Exemplo n.º 14
0
        //Grabs the name of a weapon/item from an INI.
        /*public string GetName(Ini.IniFile INI, string[,] PartArray, int DesiredPart, int NumberOfSubParts, string INIValueToRetrieve)
        {
            string Name = "";
            for (int build = 0; build < NumberOfSubParts; build++)
            {

                string readValue = INI.IniReadValue(PartArray[DesiredPart, build], INIValueToRetrieve);

                if (Name == "" && readValue != null)
                    Name = readValue;
                else if (readValue != null && readValue != "")
                    Name = (Name + " " + readValue);
            }

            return Name;
        }*/
        // 0 references - Build composite string from xmlvalues in string array.  Looks up xmlvalue of every part not just 12+13 or 7+8.  Don't need to specify item type. output is name only, no prefix
        public string GetName(XmlFile xml, string[,] PartArray, int DesiredPart, int NumberOfSubParts, string INIValueToRetrieve)
        {
            string Name = "";
            for (int build = 0; build < NumberOfSubParts; build++)
            {

                string readValue = xml.XmlReadValue(PartArray[DesiredPart, build], INIValueToRetrieve);

                if (Name == "" && readValue != null)
                    Name = readValue;
                else if (readValue != null && readValue != "")
                    Name = (Name + " " + readValue);
            }

            return Name;
        }
Exemplo n.º 15
0
        public string GetLongName(XmlFile xml, string CategoryPart, string PrefixPart, string NamePart)
        {
            string category = xml.XmlReadValue(CategoryPart, "Prefix");
            string prefix = xml.XmlReadValue(PrefixPart, "PartName");
            string name = xml.XmlReadValue(NamePart, "PartName");

            if (prefix != "")
                name = prefix + " " + name;
            if (category != "")
                name = category + " " + name;
            return name;
        }
Exemplo n.º 16
0
        public void DoSkillTree()
        {
            List<string> filestoconvert = new List<string>();
            filestoconvert.Add(AppDir + "\\Data\\gd_skills_common.txt");
            filestoconvert.Add(AppDir + "\\Data\\gd_Skills2_Roland.txt");
            filestoconvert.Add(AppDir + "\\Data\\gd_Skills2_Lilith.txt");
            filestoconvert.Add(AppDir + "\\Data\\gd_skills2_Mordecai.txt");
            filestoconvert.Add(AppDir + "\\Data\\gd_Skills2_Brick.txt");

            XmlFile AllSkills = new XmlFile(filestoconvert, AppDir + "\\Data\\xml\\gd_skills.xml");

            /*
                        XmlFile Common = new XmlFile();
                        Common.XmlFilename(AppDir + "\\Data\\gd_skills_common.txt");
                        XmlFile Roland = new XmlFile();
                        Roland.XmlFilename(AppDir + "\\Data\\gd_Skills2_Roland.txt");
                        XmlFile Lilith = new XmlFile();
                        Lilith.XmlFilename(AppDir + "\\Data\\gd_Skills2_Lilith.txt");
                        XmlFile Mordecai = new XmlFile();
                        Mordecai.XmlFilename(AppDir + "\\Data\\gd_skills2_Mordecai.txt");
                        XmlFile Brick = new XmlFile();
                        Brick.XmlFilename(AppDir + "\\Data\\gd_Skills2_Brick.txt");
            */
            //Ini.IniFile Common = new Ini.IniFile(AppDir + "\\Data\\gd_skills_common.txt");
            //Ini.IniFile Roland = new Ini.IniFile(AppDir + "\\Data\\gd_Skills2_Roland.txt");
            //Ini.IniFile Lilith = new Ini.IniFile(AppDir + "\\Data\\gd_Skills2_Lilith.txt");
            //Ini.IniFile Mordecai = new Ini.IniFile(AppDir + "\\Data\\gd_skills2_Mordecai.txt");
            //Ini.IniFile Brick = new Ini.IniFile(AppDir + "\\Data\\gd_Skills2_Brick.txt");
            SkillTree.Nodes.Clear();
            SkillLevel.Value = 0;
            SkillExp.Value = 0;
            SkillActive.SelectedItem = "No";
            for (int build = 0; build < CurrentWSG.NumberOfSkills; build++)
            {
                Node TempNode = new Node();
                if (AllSkills.XmlReadValue(CurrentWSG.SkillNames[build], "SkillName") != "")
                    TempNode.Text = AllSkills.XmlReadValue(CurrentWSG.SkillNames[build], "SkillName");
                else
                    TempNode.Text = CurrentWSG.SkillNames[build];

                /*                if (Common.XmlReadValue(CurrentWSG.SkillNames[build], "SkillName") != "")
                                    TempNode.Text = Common.XmlReadValue(CurrentWSG.SkillNames[build], "SkillName");
                                else if (Roland.XmlReadValue(CurrentWSG.SkillNames[build], "SkillName") != "")
                                    TempNode.Text = Roland.XmlReadValue(CurrentWSG.SkillNames[build], "SkillName");
                                else if (Lilith.XmlReadValue(CurrentWSG.SkillNames[build], "SkillName") != "")
                                    TempNode.Text = Lilith.XmlReadValue(CurrentWSG.SkillNames[build], "SkillName");
                                else if (Mordecai.XmlReadValue(CurrentWSG.SkillNames[build], "SkillName") != "")
                                    TempNode.Text = Mordecai.XmlReadValue(CurrentWSG.SkillNames[build], "SkillName");
                                else if (Brick.XmlReadValue(CurrentWSG.SkillNames[build], "SkillName") != "")
                                    TempNode.Text = Brick.XmlReadValue(CurrentWSG.SkillNames[build], "SkillName");
                                else
                                    TempNode.Text = CurrentWSG.SkillNames[build];
                */
                SkillTree.Nodes.Add(TempNode);

            }
        }
Exemplo n.º 17
0
 public void DoSkillList()
 {
     SkillList.Items.Clear();
     if ((string)Class.SelectedItem == "Soldier")
     {
         //Ini.IniFile SkillINI = new Ini.IniFile(AppDir + "\\Data\\gd_skills2_Roland.txt");
         XmlFile SkillXML = new XmlFile(AppDir + "\\Data\\gd_skills2_Roland.txt");
         foreach (string section in SkillXML.stListSectionNames())
             SkillList.Items.Add((string)SkillXML.XmlReadValue(section, "SkillName"));
     }
     else if ((string)Class.SelectedItem == "Siren")
     {
         //Ini.IniFile SkillINI = new Ini.IniFile(AppDir + "\\Data\\gd_Skills2_Lilith.txt");
         XmlFile SkillXML = new XmlFile(AppDir + "\\Data\\gd_Skills2_Lilith.txt");
         foreach (string section in SkillXML.stListSectionNames())
             SkillList.Items.Add((string)SkillXML.XmlReadValue(section, "SkillName"));
     }
     else if ((string)Class.SelectedItem == "Hunter")
     {
         //Ini.IniFile SkillINI = new Ini.IniFile(AppDir + "\\Data\\gd_skills2_Mordecai.txt");
         XmlFile SkillXML = new XmlFile(AppDir + "\\Data\\gd_skills2_Mordecai.txt");
         foreach (string section in SkillXML.stListSectionNames())
             SkillList.Items.Add((string)SkillXML.XmlReadValue(section, "SkillName"));
     }
     else if ((string)Class.SelectedItem == "Berserker")
     {
         //Ini.IniFile SkillINI = new Ini.IniFile(AppDir + "\\Data\\gd_Skills2_Brick.txt");
         XmlFile SkillXML = new XmlFile(AppDir + "\\Data\\gd_Skills2_Brick.txt");
         foreach (string section in SkillXML.stListSectionNames())
             SkillList.Items.Add((string)SkillXML.XmlReadValue(section, "SkillName"));
     }
     else
     {
         //Ini.IniFile SkillINI = new Ini.IniFile(AppDir + "\\Data\\gd_skills_common.txt");
         XmlFile SkillXML = new XmlFile(AppDir + "\\Data\\gd_skills_common.txt");
         foreach (string section in SkillXML.stListSectionNames())
             SkillList.Items.Add((string)SkillXML.XmlReadValue(section, "SkillName"));
     }
 }
Exemplo n.º 18
0
        private void ExportWeapons_Click(object sender, EventArgs e)
        {
            SaveFileDialog tempExport = new SaveFileDialog();
            tempExport.DefaultExt = "*.xml";
            tempExport.Filter = "WillowTree Locker(*.xml)|*.xml";

            tempExport.FileName = CurrentWSG.CharacterName + "'s Weapons.xml";
            //string ExportText = "";
            if (tempExport.ShowDialog() == DialogResult.OK)
            {
                // Create empty xml file
                XmlTextWriter writer = new XmlTextWriter(tempExport.FileName, new System.Text.ASCIIEncoding());
                writer.Formatting = Formatting.Indented;
                writer.Indentation = 2;
                writer.WriteStartDocument();
                writer.WriteStartElement("INI");
                writer.WriteEndElement();
                writer.WriteEndDocument();
                writer.Flush();
                writer.Close();

                XmlFile LockerSave = new XmlFile(tempExport.FileName);
                List<string> itemparts = new List<string>();
                List<int> itemvalues = new List<int>();

                if (IsDLCWeaponMode)
                    for (int Progress = 0; Progress < CurrentWSG.DLC.WeaponParts.Count; Progress++)
                    {
                        itemparts.Clear();
                        //ExportText = ExportText + "[" + WeaponTree.Nodes[Progress].Text + "]\r\nType=Weapon\r\nRating=0\r\nDescription=Type in a description for the weapon here.\r\n";
                        for (int PartProgress = 0; PartProgress < 14; PartProgress++)
                            itemparts.Add(CurrentWSG.DLC.WeaponParts[Progress][PartProgress]);
                        //ExportText = ExportText + "Part" + (PartProgress + 1) + "=" + CurrentWSG.DLC.WeaponParts[Progress][PartProgress] + "\r\n";

                        itemvalues.Add(CurrentWSG.DLC.WeaponAmmo[Progress]);
                        itemvalues.Add(CurrentWSG.DLC.WeaponQuality[Progress]);
                        itemvalues.Add(CurrentWSG.DLC.WeaponEquippedSlot[Progress]);
                        itemvalues.Add(CurrentWSG.DLC.WeaponLevel[Progress]);

                        LockerSave.AddItem(WeaponTree.Nodes[Progress].Text, "Weapon", itemparts, itemvalues);
                    }
                else
                    for (int Progress = 0; Progress < CurrentWSG.NumberOfWeapons; Progress++)
                    {
                        itemparts.Clear();
                        itemvalues.Clear();
                        for (int PartProgress = 0; PartProgress < 14; PartProgress++)
                            itemparts.Add(CurrentWSG.WeaponStrings[Progress][PartProgress]);

                        for (int PartProgress = 0; PartProgress < 4; PartProgress++)
                            itemvalues.Add(CurrentWSG.WeaponValues[Progress][PartProgress]);

                        LockerSave.AddItem(WeaponTree.Nodes[Progress].Text, "Weapon", itemparts, itemvalues);
                    }
            }
        }
Exemplo n.º 19
0
        public int GetWeaponDamage(string[] WeaponParts, double Itemgrade)
        {
            try
            {
                string ItemGradeFile = WeaponParts[0].Substring(0, WeaponParts[0].IndexOf(".")) + ".txt";
                string ItemGradePart = WeaponParts[0].Substring(WeaponParts[0].IndexOf(".") + 1);
                string Manufacturer = WeaponParts[1].Substring(WeaponParts[1].LastIndexOf(".") + 1);
                XmlFile ItemGrade = new XmlFile(AppDir + "\\Data\\" + ItemGradeFile);
                double ExtraDamage = 0;
                double Multiplier = Conversion.Val(new XmlFile(AppDir + "\\Data\\" + WeaponParts[2].Substring(0, WeaponParts[2].IndexOf(".")) + ".txt").XmlReadValue(WeaponParts[2].Substring(WeaponParts[2].IndexOf(".") + 1), "WeaponDamageFormulaMultiplier")); ;
                double Level = Itemgrade;
                double Power = 1.3;
                double Offset = 9;
                for (int i = 3; i < 14; i++)
                    if (WeaponParts[i].Contains("."))
                        ExtraDamage = ExtraDamage + Conversion.Val(new XmlFile(AppDir + "\\Data\\" + WeaponParts[i].Substring(0, WeaponParts[i].IndexOf(".")) + ".txt").XmlReadValue(WeaponParts[i].Substring(WeaponParts[i].IndexOf(".") + 1), "WeaponDamage"));

                return (int)(ExtraDamage * (Multiplier * (Math.Pow(Level, Power) + Offset))) + (int)(Multiplier * (Math.Pow(Level, Power) + Offset));
            }
            catch
            {
                return 1337;
            }
        }
Exemplo n.º 20
0
        private void ImportEchoes_Click(object sender, EventArgs e)
        {
            //try
            //{
            if (EchoTree.SelectedNode == null)
            {
                MessageBox.Show("Select a playthrough to import first.");
                return;
            }
            OpenFileDialog tempImport = new OpenFileDialog();
            if (EchoTree.SelectedNode.Name == "PT2" || EchoTree.SelectedNode.Text == "Playthrough 2 Echo Logs")
            {

                tempImport.DefaultExt = "*.echologs";
                tempImport.Filter = "Echo Logs(*.echologs)|*.echologs";

                tempImport.FileName = CurrentWSG.CharacterName + "'s PT2 Echo Logs.echologs";
                if (tempImport.ShowDialog() == DialogResult.OK)
                {
                    if (EchoTree.SelectedNode.Name == "PT2" || EchoTree.SelectedNode.Text == "Playthrough 2 Echo Logs")
                    {
                        //Ini.IniFile ImportLogs = new Ini.IniFile(tempImport.FileName);
                        XmlFile ImportLogs = new XmlFile(tempImport.FileName);
                        string[] TempEchoStrings = new string[ImportLogs.stListSectionNames().Count];
                        int[,] TempEchoValues = new int[ImportLogs.stListSectionNames().Count, 10];
                        for (int Progress = 0; Progress < ImportLogs.stListSectionNames().Count; Progress++)
                        {
                            TempEchoStrings[Progress] = ImportLogs.stListSectionNames()[Progress];
                            TempEchoValues[Progress, 0] = Convert.ToInt32(ImportLogs.XmlReadValue(ImportLogs.stListSectionNames()[Progress], "DLCValue1"));
                            TempEchoValues[Progress, 1] = Convert.ToInt32(ImportLogs.XmlReadValue(ImportLogs.stListSectionNames()[Progress], "DLCValue2"));

                        }
                        CurrentWSG.EchoStringsPT2 = TempEchoStrings;
                        CurrentWSG.EchoValuesPT2 = TempEchoValues;
                        CurrentWSG.NumberOfEchosPT2 = ImportLogs.stListSectionNames().Count;
                        DoEchoTree();
                    }
                }
            }
            else if (EchoTree.SelectedNode.Name == "PT1" || EchoTree.SelectedNode.Text == "Playthrough 1 Echo Logs")
            {
                tempImport.DefaultExt = "*.echologs";
                tempImport.Filter = "Echo Logs(*.echologs)|*.echologs";

                tempImport.FileName = CurrentWSG.CharacterName + "'s PT1 Echo Logs.echologs";

                if (tempImport.ShowDialog() == DialogResult.OK)
                {
                    //Ini.IniFile ImportLogs = new Ini.IniFile(tempImport.FileName);
                    XmlFile ImportLogs = new XmlFile(tempImport.FileName);
                    string[] TempEchoStrings = new string[ImportLogs.stListSectionNames().Count];
                    int[,] TempEchoValues = new int[ImportLogs.stListSectionNames().Count, 10];
                    for (int Progress = 0; Progress < ImportLogs.stListSectionNames().Count; Progress++)
                    {
                        TempEchoStrings[Progress] = ImportLogs.stListSectionNames()[Progress];
                        TempEchoValues[Progress, 0] = Convert.ToInt32(ImportLogs.XmlReadValue(ImportLogs.stListSectionNames()[Progress], "DLCValue1"));
                        TempEchoValues[Progress, 1] = Convert.ToInt32(ImportLogs.XmlReadValue(ImportLogs.stListSectionNames()[Progress], "DLCValue2"));

                    }
                    CurrentWSG.EchoStrings = TempEchoStrings;
                    CurrentWSG.EchoValues = TempEchoValues;
                    CurrentWSG.NumberOfEchos = ImportLogs.stListSectionNames().Count;
                    DoEchoTree();
                }

            }

            try
            {
            }
            catch { MessageBox.Show("Select a playthrough to import first."); }
        }
Exemplo n.º 21
0
        public void DoEchoList()
        {
            //Ini.IniFile PartList = new Ini.IniFile(AppDir + "\\Data\\Echos.ini");
            XmlFile PartList = new XmlFile(AppDir + "\\Data\\Echos.ini");

            foreach (string section in PartList.stListSectionNames())
            {
                string name = PartList.XmlReadValue(section, "Subject");
                if (name != "")
                    EchoList.Items.Add(name);
                else
                    EchoList.Items.Add(section);
            }

            //for (int Progress = 0; Progress < PartList.stListSectionNames().Count; Progress++)
            //{
            //    string name = PartList.XmlReadValue(PartList.stListSectionNames()[Progress], "Subject");
            //    if (name != "")
            //        EchoList.Items.Add(name);
            //    else EchoList.Items.Add(PartList.stListSectionNames()[Progress]);
            //}
        }
Exemplo n.º 22
0
        private void ImportSkills_Click(object sender, EventArgs e)
        {
            OpenFileDialog tempImport = new OpenFileDialog();
            tempImport.DefaultExt = "*.skills";
            tempImport.Filter = "Skills Data(*.skills)|*.skills";

            tempImport.FileName = CurrentWSG.CharacterName + "'s Skills.skills";
            if (tempImport.ShowDialog() == DialogResult.OK)
            {

                //Ini.IniFile ImportSkills = new Ini.IniFile(tempImport.FileName);
                XmlFile ImportSkills = new XmlFile(tempImport.FileName);
                string[] TempSkillNames = new string[ImportSkills.stListSectionNames().Count];
                int[] TempSkillLevels = new int[ImportSkills.stListSectionNames().Count];
                int[] TempSkillExp = new int[ImportSkills.stListSectionNames().Count];
                int[] TempSkillInUse = new int[ImportSkills.stListSectionNames().Count];
                for (int Progress = 0; Progress < ImportSkills.stListSectionNames().Count; Progress++)
                {
                    TempSkillNames[Progress] = ImportSkills.stListSectionNames()[Progress];
                    TempSkillLevels[Progress] = Convert.ToInt32(ImportSkills.XmlReadValue(ImportSkills.stListSectionNames()[Progress], "Level"));
                    TempSkillExp[Progress] = Convert.ToInt32(ImportSkills.XmlReadValue(ImportSkills.stListSectionNames()[Progress], "Experience"));
                    TempSkillInUse[Progress] = Convert.ToInt32(ImportSkills.XmlReadValue(ImportSkills.stListSectionNames()[Progress], "InUse"));
                }
                CurrentWSG.SkillNames = TempSkillNames;
                CurrentWSG.LevelOfSkills = TempSkillLevels;
                CurrentWSG.ExpOfSkills = TempSkillExp;
                CurrentWSG.InUse = TempSkillInUse;
                CurrentWSG.NumberOfSkills = ImportSkills.stListSectionNames().Count;
                DoSkillTree();
            }
        }
Exemplo n.º 23
0
        private void EchoList_Click(object sender, EventArgs e)
        {
            XmlFile Echoes = new XmlFile(AppDir + "\\Data\\Echos.ini");
            if (EchoTree.SelectedNode.Name == "PT1" || EchoTree.SelectedNode.Text == "Playthrough 1 Echo Logs")
            {

                if (CheckIfNull(CurrentWSG.EchoStrings) == true)
                {
                    CurrentWSG.EchoStrings = new string[1];
                    CurrentWSG.EchoStrings[0] = Echoes.stListSectionNames()[EchoList.SelectedIndex];
                    CurrentWSG.EchoValues = new int[1, 2];
                    CurrentWSG.NumberOfEchos = 1;
                }
                else
                {
                    CurrentWSG.NumberOfEchos = CurrentWSG.NumberOfEchos + 1;
                    ResizeArrayLarger(ref CurrentWSG.EchoStrings, CurrentWSG.NumberOfEchos);
                    ResizeArrayLarger(ref CurrentWSG.EchoValues, CurrentWSG.NumberOfEchos, 2);
                    CurrentWSG.EchoStrings[CurrentWSG.NumberOfEchos - 1] = Echoes.stListSectionNames()[EchoList.SelectedIndex];

                }
                DoEchoTree();
                EchoTree.Nodes[0].Expand();
                EchoTree.SelectedNode = EchoTree.Nodes[0];
            }
            else if (EchoTree.SelectedNode.Name == "PT2" || EchoTree.SelectedNode.Text == "Playthrough 2 Echo Logs")
            {

                if (CheckIfNull(CurrentWSG.EchoStringsPT2) == true)
                {
                    if (CurrentWSG.TotalPT2Quests > 1)
                    {
                        CurrentWSG.EchoStringsPT2 = new string[1];
                        CurrentWSG.EchoStringsPT2[0] = Echoes.stListSectionNames()[EchoList.SelectedIndex];
                        CurrentWSG.EchoValuesPT2 = new int[1, 2];
                        CurrentWSG.NumberOfEchosPT2 = 1;
                    }
                    else
                        MessageBox.Show("You must have more than just the default quest.");
                }
                else
                {
                    CurrentWSG.NumberOfEchosPT2 = CurrentWSG.NumberOfEchosPT2 + 1;
                    ResizeArrayLarger(ref CurrentWSG.EchoStringsPT2, CurrentWSG.NumberOfEchosPT2);
                    ResizeArrayLarger(ref CurrentWSG.EchoValuesPT2, CurrentWSG.NumberOfEchosPT2, 2);
                    CurrentWSG.EchoStringsPT2[CurrentWSG.NumberOfEchosPT2 - 1] = Echoes.stListSectionNames()[EchoList.SelectedIndex];

                }
                DoEchoTree();
                EchoTree.Nodes[1].Expand();
                EchoTree.SelectedNode = EchoTree.Nodes[1];
            }
            //try
            //{ }
            //catch { MessageBox.Show("Could not add new echo log"); }
        }
Exemplo n.º 24
0
        private void InsertItemsFromXml_Click(object sender, EventArgs e)
        {
            OpenFileDialog tempImport = new OpenFileDialog();
            tempImport.DefaultExt = "*.xml";
            tempImport.Filter = "WillowTree Locker(*.xml)|*.xml";

            tempImport.FileName = CurrentWSG.CharacterName + "'s Items.xml";
            if (tempImport.ShowDialog() == DialogResult.OK)
            {
                //Ini.IniFile ImportWTL = new Ini.IniFile(tempImport.FileName);
                XmlFile ImportWTL = new XmlFile(tempImport.FileName);
                if (IsDLCItemMode)
                {

                    for (int Progress = 0; Progress < ImportWTL.stListSectionNames("Item").Count; Progress++)
                    {
                        CurrentWSG.DLC.ItemParts.Add(new List<string>());

                        for (int ProgressStrings = 0; ProgressStrings < 9; ProgressStrings++)
                            CurrentWSG.DLC.ItemParts[CurrentWSG.DLC.ItemParts.Count - 1].Add(ImportWTL.XmlReadValue(ImportWTL.stListSectionNames("Item")[Progress], "Part" + (ProgressStrings + 1)));

                        CurrentWSG.DLC.ItemQuantity.Add(1);
                        CurrentWSG.DLC.ItemQuality.Add(0);
                        CurrentWSG.DLC.ItemLevel.Add(0);
                        CurrentWSG.DLC.ItemEquipped.Add(0);
                        CurrentWSG.DLC.TotalItems++;
                    }
                    DoDLCItemTree();
                }

                else
                {
                    for (int Progress = 0; Progress < ImportWTL.stListSectionNames("Item").Count; Progress++)
                    {
                        List<string> itemstrings = new List<string>();
                        List<int> itemvalues = new List<int>();

                        try
                        {
                            for (int ProgressStrings = 0; ProgressStrings < 9; ProgressStrings++)
                            {
                                string part = ImportWTL.XmlReadValue(ImportWTL.stListSectionNames("Item")[Progress], "Part" + (ProgressStrings + 1));
                                ThrowExceptionIfIntString(part);
                                itemstrings.Add(part);
                            }

                            itemvalues.Add(Int32FromString(ImportWTL.XmlReadValue(ImportWTL.stListSectionNames("Item")[Progress], "RemAmmo_Quantity"),0));
                            itemvalues.Add(Int32FromString(ImportWTL.XmlReadValue(ImportWTL.stListSectionNames("Item")[Progress], "Quality"),0));
                            itemvalues.Add(0); // set equipped slot to 0
                            itemvalues.Add(Int32FromString(ImportWTL.XmlReadValue(ImportWTL.stListSectionNames("Item")[Progress], "Level"),0));
                        }
                        catch
                        {
                            MessageBox.Show("Error reading XML file.  Some items were not read.");
                            break;
                        }

                        CurrentWSG.ItemStrings.Add(itemstrings);
                        CurrentWSG.ItemValues.Add(itemvalues);
                        CurrentWSG.NumberOfItems++;
                    }
                    DoItemTree();
                }
            }
        }
Exemplo n.º 25
0
        private void ExportEchoes_Click(object sender, EventArgs e)
        {
            try
            {
                if (EchoTree.SelectedNode.Name == "PT2" || EchoTree.SelectedNode.Text == "Playthrough 2 Echo Logs")
                {
                    SaveFileDialog tempExport = new SaveFileDialog();
                    //string ExportText = "";
                    tempExport.DefaultExt = "*.echologs";
                    tempExport.Filter = "Echo Logs(*.echologs)|*.echologs";

                    tempExport.FileName = CurrentWSG.CharacterName + "'s PT2 Echo Logs.echologs";

                    if (tempExport.ShowDialog() == DialogResult.OK)
                    {
                        // Create empty xml file
                        XmlTextWriter writer = new XmlTextWriter(tempExport.FileName, new System.Text.ASCIIEncoding());
                        writer.Formatting = Formatting.Indented;
                        writer.Indentation = 2;
                        writer.WriteStartDocument();
                        writer.WriteStartElement("INI");
                        writer.WriteEndElement();
                        writer.WriteEndDocument();
                        writer.Flush();
                        writer.Close();

                        XmlFile Echos = new XmlFile(tempExport.FileName);
                        List<string> subsectionnames = new List<string>();
                        List<string> subsectionvalues = new List<string>();

                        for (int Progress = 0; Progress < CurrentWSG.NumberOfEchosPT2; Progress++)
                        {
                            subsectionnames.Clear();
                            subsectionvalues.Clear();
                            subsectionnames.Add("DLCValue1");
                            subsectionnames.Add("DLCValue2");
                            subsectionvalues.Add(CurrentWSG.EchoValuesPT2[Progress, 0].ToString());
                            subsectionvalues.Add(CurrentWSG.EchoValuesPT2[Progress, 1].ToString());

                            //ExportText = ExportText + "[" + CurrentWSG.EchoStringsPT2[Progress] + "]" + "\r\nDLCValue1=" + CurrentWSG.EchoValuesPT2[Progress, 0] + "\r\nDLCValue2=" + CurrentWSG.EchoValuesPT2[Progress, 1] + "\r\n";
                            Echos.AddSection(CurrentWSG.EchoStringsPT2[Progress], subsectionnames, subsectionvalues);
                        }
                        //File.WriteAllText(tempExport.FileName + "s", ExportText);
                    }
                }
                else if (EchoTree.SelectedNode.Name == "PT1" || EchoTree.SelectedNode.Text == "Playthrough 1 Echo Logs")
                {
                    SaveFileDialog tempExport = new SaveFileDialog();
                    //string ExportText = "";
                    tempExport.DefaultExt = "*.echologs";
                    tempExport.Filter = "Echo Logs(*.echologs)|*.echologs";

                    tempExport.FileName = CurrentWSG.CharacterName + "'s PT1 Echo Logs.echologs";

                    if (tempExport.ShowDialog() == DialogResult.OK)
                    {
                        // Create empty xml file
                        XmlTextWriter writer = new XmlTextWriter(tempExport.FileName, new System.Text.ASCIIEncoding());
                        writer.Formatting = Formatting.Indented;
                        writer.Indentation = 2;
                        writer.WriteStartDocument();
                        writer.WriteStartElement("INI");
                        writer.WriteEndElement();
                        writer.WriteEndDocument();
                        writer.Flush();
                        writer.Close();

                        XmlFile Echos = new XmlFile(tempExport.FileName);
                        List<string> subsectionnames = new List<string>();
                        List<string> subsectionvalues = new List<string>();

                        for (int Progress = 0; Progress < CurrentWSG.NumberOfEchos; Progress++)
                        {
                            subsectionnames.Clear();
                            subsectionvalues.Clear();
                            subsectionnames.Add("DLCValue1");
                            subsectionnames.Add("DLCValue2");
                            subsectionvalues.Add(CurrentWSG.EchoValues[Progress, 0].ToString());
                            subsectionvalues.Add(CurrentWSG.EchoValues[Progress, 1].ToString());

                            //ExportText = ExportText + "[" + CurrentWSG.EchoStrings[Progress] + "]" + "\r\nDLCValue1=" + CurrentWSG.EchoValues[Progress, 0] + "\r\nDLCValue2=" + CurrentWSG.EchoValues[Progress, 1] + "\r\n";
                            Echos.AddSection(CurrentWSG.EchoStrings[Progress], subsectionnames, subsectionvalues);

                        }
                        //File.WriteAllText(tempExport.FileName + "s", ExportText);
                    }

                }
            }
            catch { MessageBox.Show("Select a playthrough to export first."); }
        }
Exemplo n.º 26
0
        private void Open_Click(object sender, EventArgs e)
        {
            textBox1.Clear();

            OpenFileDialog tempOpen = new OpenFileDialog();
            tempOpen.DefaultExt = "*.sav";
            tempOpen.Filter = "WillowSaveGame(*.sav)|*.sav";

            if (tempOpen.ShowDialog() == DialogResult.OK)
                try
                {
                    BankSpace.Enabled = false;
                    BankSpace.Value = 0;
                    CurrentWSG = new WillowSaveGame();
                    CurrentWSG.OpenWSG(tempOpen.FileName);
                    //Ini.IniFile Locations = new Ini.IniFile(AppDir + "\\Data\\Locations.ini");
                    XmlFile Locations = new XmlFile(AppDir + "\\Data\\Locations.ini");
                    setXPchart();
                    textBox1.AppendText(CurrentWSG.Platform);
                    CharacterName.Text = CurrentWSG.CharacterName;
                    try
                    {
                        //Experience.Maximum = XPChart[(int)Level.Value];
                        if (CurrentWSG.Level <= Level.Maximum)
                            Level.Value = CurrentWSG.Level;
                        else
                            Level.Value = Level.Maximum;

                    }
                    catch (ArgumentOutOfRangeException)
                    {
                        MessageBox.Show("The level value was outside the acceptable range. Adjust your level and experience to their correct values.\r\nLevel: " + CurrentWSG.Level + "\r\nExperience: " + CurrentWSG.Experience);
                        Level.Value = 1;
                        Experience.Value = 0;
                    }
                    try
                    {
                        //Experience.Maximum = XPChart[(int)Level.Value];

                        if (CurrentWSG.Experience >= Experience.Minimum)
                            Experience.Value = CurrentWSG.Experience;
                        else
                            Experience.Value = Experience.Minimum;

                    }
                    catch (ArgumentOutOfRangeException)
                    {
                        MessageBox.Show("The experience value was outside the acceptable range. Adjust your level and experience to their correct values.\r\nLevel: " + CurrentWSG.Level + "\r\nExperience: " + CurrentWSG.Experience);

                        Experience.Value = Experience.Minimum;
                    }
                    if (CurrentWSG.SkillPoints <= SkillPoints.Maximum)
                        SkillPoints.Value = CurrentWSG.SkillPoints;
                    else
                        SkillPoints.Value = SkillPoints.Maximum;
                    PT2Unlocked.SelectedIndex = CurrentWSG.FinishedPlaythrough1;
                    try
                    {
                        Cash.Value = CurrentWSG.Cash;
                    }
                    catch (ArgumentOutOfRangeException)
                    {
                        Cash.Value = Cash.Maximum;
                        MessageBox.Show("This save has $" + CurrentWSG.Cash + ", which is outside of WillowTree#'s limits and can cause in-game issues. Because of this, your cash has been lowered. It is suggested that you further reduce your cash to prevent future problems.");
                    }
                    BackpackSpace.Value = CurrentWSG.BackpackSize;
                    EquipSlots.Value = CurrentWSG.EquipSlots;
                    SaveNumber.Value = CurrentWSG.SaveNumber;
                    CurrentLocation.SelectedItem = Locations.XmlReadValue(CurrentWSG.CurrentLocation, "OutpostDisplayName");
                    if (CurrentWSG.Class == "gd_Roland.Character.CharacterClass_Roland") Class.SelectedIndex = 0;
                    else if (CurrentWSG.Class == "gd_lilith.Character.CharacterClass_Lilith") Class.SelectedIndex = 1;
                    else if (CurrentWSG.Class == "gd_mordecai.Character.CharacterClass_Mordecai") Class.SelectedIndex = 2;
                    else if (CurrentWSG.Class == "gd_Brick.Character.CharacterClass_Brick") Class.SelectedIndex = 3;
                    textBox1.AppendText("\r\nHeader: " + CurrentWSG.MagicHeader + "\r\nVersion: " + CurrentWSG.VersionNumber + "\r\nPlyr String: " + CurrentWSG.PLYR + "\r\nRevision Number: " + CurrentWSG.RevisionNumber + "\r\nClass: " + CurrentWSG.Class + "\r\nLevel: " + CurrentWSG.Level + "\r\nExp: " + CurrentWSG.Experience + "\r\nSkill Points: " + CurrentWSG.SkillPoints + "\r\nunknown1: " + CurrentWSG.Unknown1 + "\r\nMoney: " + CurrentWSG.Cash + "\r\nFinished Game: " + CurrentWSG.FinishedPlaythrough1 + "\r\nNumber of skills: " + CurrentWSG.NumberOfSkills + "\r\nCurrent Quest: " + CurrentWSG.CurrentQuest + "\r\nTotal PT1 Quests: " + CurrentWSG.TotalPT1Quests + "\r\nSecondary Quest: " + CurrentWSG.SecondaryQuest + "\r\nTotal PT2 Quests: " + CurrentWSG.TotalPT2Quests + "\r\nUnknown PT1 Quest Value: " + CurrentWSG.UnknownPT1QuestValue);
                    ActivePT1Quest.Text = CurrentWSG.CurrentQuest;
                    ActivePT2Quest.Text = CurrentWSG.SecondaryQuest;
                    DoQuestTree();
                    DoLocationTree();
                    DoSkillTree();
                    DoEchoTree();
                    DoAmmoTree();
                    DoWeaponTree();
                    DoItemTree();
                    DoSkillList();

                    GeneralTab.Enabled = true;
                    AmmoTab.Enabled = true;
                    SkillsTab.Enabled = true;
                    EchosTab.Enabled = true;
                    WTLTab.Enabled = true;
                    ExportToBackpack.Enabled = true;
                    ImportAllFromItems.Enabled = true;
                    ImportAllFromWeapons.Enabled = true;
                    WeaponsTab.Enabled = true;
                    ItemsTab.Enabled = true;
                    QuestsTab.Enabled = true;
                    Save.Enabled = true;
                    SaveAs.Enabled = true;
                    SelectFormat.Enabled = true;

                    if (CurrentWSG.DLC.BankSize > 0)
                    {
                        BankSpace.Value = CurrentWSG.DLC.BankSize;
                        BankSpace.Enabled = true;
                    }
                    DoWindowTitle();
                }
                //if (VersionFromServer == "f")
                //try {
                //  DoAmmoTree();
                //}
                catch
                {

                    if (CurrentWSG.EchoStringsPT2 == null && CurrentWSG.NumberOfEchosPT2 > 0 && CurrentWSG.TotalPT2Quests > 1 && CurrentWSG.NumberOfEchosPT2 < 300)
                        MessageBox.Show("Error reading PT2 echo logs.");
                    else
                        MessageBox.Show("Could not open save.");
                    BankSpace.Enabled = false;
                    BankSpace.Value = 0;
                    GeneralTab.Enabled = false;
                    AmmoTab.Enabled = false;
                    SkillsTab.Enabled = false;
                    EchosTab.Enabled = false;
                    //WTLTab.Enabled = false;
                    ExportToBackpack.Enabled = false;
                    ImportAllFromItems.Enabled = false;
                    ImportAllFromWeapons.Enabled = false;
                    WeaponsTab.Enabled = false;
                    ItemsTab.Enabled = false;
                    QuestsTab.Enabled = false;
                    Save.Enabled = false;
                    SaveAs.Enabled = false;
                    MainTab.Select();
                    textBox1.AppendText("\r\nHeader: " + CurrentWSG.MagicHeader + "\r\nVersion: " + CurrentWSG.VersionNumber + "\r\nPlyr String: " + CurrentWSG.PLYR + "\r\nRevision Number: " + CurrentWSG.RevisionNumber + "\r\nClass: " + CurrentWSG.Class + "\r\nLevel: " + CurrentWSG.Level + "\r\nExp: " + CurrentWSG.Experience + "\r\nSkill Points: " + CurrentWSG.SkillPoints + "\r\nunknown1: " + CurrentWSG.Unknown1 + "\r\nMoney: " + CurrentWSG.Cash + "\r\nFinished Game: " + CurrentWSG.FinishedPlaythrough1 + "\r\nNumber of skills: " + CurrentWSG.NumberOfSkills + "\r\nCurrent Quest: " + CurrentWSG.CurrentQuest + "\r\nTotal PT1 Quests: " + CurrentWSG.TotalPT1Quests + "\r\nSecondary Quest: " + CurrentWSG.SecondaryQuest + "\r\nTotal PT2 Quests: " + CurrentWSG.TotalPT2Quests + "\r\nUnknown PT1 Quest Value: " + CurrentWSG.UnknownPT1QuestValue);
                }
        }
Exemplo n.º 27
0
        public void DoEchoTree()
        {
            EchoTree.Nodes.Clear();
            //Ini.IniFile Echos = new Ini.IniFile(AppDir + "\\Data\\Echos.ini");
            XmlFile Echos = new XmlFile(AppDir + "\\Data\\Echos.ini");
            Node PT1 = new Node();
            PT1.Text = "Playthrough 1 Echo Logs";
            Node PT2 = new Node();
            PT2.Text = "Playthrough 2 Echo Logs";
            EchoTree.Nodes.Add(PT1);
            EchoTree.Nodes.Add(PT2);
            for (int build = 0; build < CurrentWSG.NumberOfEchos; build++)
            {
                Node TempNode = new Node();
                TempNode.Name = "PT1";
                TempNode.Text = GetName(Echos, CurrentWSG.EchoStrings, build, "Subject");
                if (TempNode.Text == null || TempNode.Text == "") TempNode.Text = "Unknown Echo";
                PT1.Nodes.Add(TempNode);
            }
            if (CurrentWSG.NumberOfEchosPT2 > 0 && CurrentWSG.TotalPT2Quests > 1 && CurrentWSG.NumberOfEchosPT2 < 300)
                for (int build2 = 0; build2 < CurrentWSG.NumberOfEchosPT2; build2++)
                {
                    Node TempNode = new Node();
                    TempNode.Name = "PT2";
                    TempNode.Text = GetName(Echos, CurrentWSG.EchoStringsPT2, build2, "Subject");
                    if (TempNode.Text == null || TempNode.Text == "") TempNode.Text = "Unknown Echo";

                    PT2.Nodes.Add(TempNode);
                }
        }
Exemplo n.º 28
0
        private void QuestList_SelectedIndexChanged(object sender, EventArgs e)
        {
            int SelectedItem = QuestList.SelectedIndex;
            NewQuest.ClosePopup();
            try
            {
                //Ini.IniFile Quests = new Ini.IniFile(AppDir + "\\Data\\Quests.ini");
                XmlFile Quests = new XmlFile(AppDir + "\\Data\\Quests.ini");
                if (QuestTree.SelectedNode.Name == "PT1" || QuestTree.SelectedNode == QuestTree.Nodes[0])
                {
                    int TotalObjectives = 0;
                    CurrentWSG.TotalPT1Quests = CurrentWSG.TotalPT1Quests + 1;
                    ResizeArrayLarger(ref CurrentWSG.PT1Strings, CurrentWSG.TotalPT1Quests);
                    ResizeArrayLarger(ref CurrentWSG.PT1Values, CurrentWSG.TotalPT1Quests, 9);
                    ResizeArrayLarger(ref CurrentWSG.PT1Subfolders, CurrentWSG.TotalPT1Quests, 5);
                    CurrentWSG.PT1Strings[CurrentWSG.TotalPT1Quests - 1] = Quests.stListSectionNames()[SelectedItem];
                    CurrentWSG.PT1Values[CurrentWSG.TotalPT1Quests - 1, 0] = 1;
                    for (int Progress = 0; Progress < 5; Progress++)
                        if (Quests.XmlReadValue(Quests.stListSectionNames()[SelectedItem], "Objectives" + Progress) == "") break;
                        else TotalObjectives = Progress + 1;
                    CurrentWSG.PT1Values[CurrentWSG.TotalPT1Quests - 1, 3] = TotalObjectives;
                    for (int Progress = 0; Progress < 5; Progress++)
                        CurrentWSG.PT1Subfolders[CurrentWSG.TotalPT1Quests - 1, Progress] = "None";

                    DoQuestTree();
                    QuestTree.SelectedNode = QuestTree.Nodes[0].Nodes[CurrentWSG.TotalPT1Quests - 1];
                }
                if (QuestTree.SelectedNode.Name == "PT2" || QuestTree.SelectedNode.Text == "Playthrough 2 Quests")
                {
                    int TotalObjectives = 0;
                    CurrentWSG.TotalPT2Quests = CurrentWSG.TotalPT2Quests + 1;
                    ResizeArrayLarger(ref CurrentWSG.PT2Strings, CurrentWSG.TotalPT2Quests);
                    ResizeArrayLarger(ref CurrentWSG.PT2Values, CurrentWSG.TotalPT2Quests, 9);
                    ResizeArrayLarger(ref CurrentWSG.PT2Subfolders, CurrentWSG.TotalPT2Quests, 5);
                    CurrentWSG.PT2Strings[CurrentWSG.TotalPT2Quests - 1] = Quests.stListSectionNames()[SelectedItem];
                    CurrentWSG.PT2Values[CurrentWSG.TotalPT2Quests - 1, 0] = 1;
                    for (int Progress = 0; Progress < 5; Progress++)
                        if (Quests.XmlReadValue(Quests.stListSectionNames()[SelectedItem], "Objectives[" + Progress + "]") == "") break;
                        else TotalObjectives = Progress + 1;
                    CurrentWSG.PT2Values[CurrentWSG.TotalPT2Quests - 1, 3] = TotalObjectives;
                    for (int Progress = 0; Progress < 5; Progress++)
                        CurrentWSG.PT2Subfolders[CurrentWSG.TotalPT2Quests - 1, Progress] = "None";

                    DoQuestTree();
                    QuestTree.SelectedNode = QuestTree.Nodes[1].Nodes[CurrentWSG.TotalPT2Quests - 1];
                }
            }
            catch { }
        }
Exemplo n.º 29
0
        private void ExportItems_Click(object sender, EventArgs e)
        {
            SaveFileDialog tempExport = new SaveFileDialog();
            tempExport.DefaultExt = "*.xml";
            tempExport.Filter = "WillowTree Locker(*.xml)|*.xml";

            tempExport.FileName = CurrentWSG.CharacterName + "'s Items.xml";
            //string ExportText = "";
            if (tempExport.ShowDialog() == DialogResult.OK)
            {
                // Create empty xml file
                XmlTextWriter writer = new XmlTextWriter(tempExport.FileName, new System.Text.ASCIIEncoding());
                writer.Formatting = Formatting.Indented;
                writer.Indentation = 2;
                writer.WriteStartDocument();
                writer.WriteStartElement("INI");
                writer.WriteEndElement();
                writer.WriteEndDocument();
                writer.Flush();
                writer.Close();

                XmlFile LockerSave = new XmlFile(tempExport.FileName);
                List<string> itemparts = new List<string>();
                List<int> itemvalues = new List<int>();

                if (IsDLCItemMode)
                {
                    for (int Progress = 0; Progress < CurrentWSG.DLC.ItemParts.Count; Progress++)
                    {
                        itemparts.Clear();
                        for (int PartProgress = 0; PartProgress < 9; PartProgress++)
                            itemparts.Add(CurrentWSG.DLC.ItemParts[Progress][PartProgress]);

                        itemvalues.Add(CurrentWSG.DLC.WeaponAmmo[Progress]);
                        itemvalues.Add(CurrentWSG.DLC.WeaponQuality[Progress]);
                        itemvalues.Add(CurrentWSG.DLC.WeaponEquippedSlot[Progress]);
                        itemvalues.Add(CurrentWSG.DLC.WeaponLevel[Progress]);

                        LockerSave.AddItem(ItemTree.Nodes[Progress].Text, "Item", itemparts, itemvalues);
                    }
                }
                else
                {
                    for (int Progress = 0; Progress < CurrentWSG.NumberOfItems; Progress++)
                    {
                        itemparts.Clear();
                        itemvalues.Clear();
                        for (int PartProgress = 0; PartProgress < 9; PartProgress++)
                            itemparts.Add(CurrentWSG.ItemStrings[Progress][PartProgress]);

                        for (int PartProgress = 0; PartProgress < 4; PartProgress++)
                            itemvalues.Add(CurrentWSG.ItemValues[Progress][PartProgress]);

                        LockerSave.AddItem(ItemTree.Nodes[Progress].Text, "Item", itemparts, itemvalues);
                    }
                }
            }
        }
Exemplo n.º 30
0
        //  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< QUESTS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>  \\
        private void QuestTree_AfterNodeSelect(object sender, AdvTreeNodeEventArgs e)
        {
            Clicked = false;
            try
            {
                SelectedQuestGroup.Text = QuestTree.SelectedNode.Text;
                //if (QuestTree.SelectedNode.Parent.Text == "Playthrough 1 Quests" && QuestTree.SelectedNode.HasChildNodes == false)

                //else if (QuestTree.SelectedNode.Parent.Text == "Playthrough 2 Quests" && QuestTree.SelectedNode.HasChildNodes == false)
                if (QuestTree.SelectedNode.Name == "PT1")
                {

                    QuestString.Text = CurrentWSG.PT1Strings[QuestTree.SelectedNode.Index];
                    if (CurrentWSG.PT1Values[QuestTree.SelectedNode.Index, 0] > 2)
                        QuestProgress.SelectedIndex = 3;
                    else QuestProgress.SelectedIndex = CurrentWSG.PT1Values[QuestTree.SelectedNode.Index, 0];
                    NumberOfObjectives.Value = CurrentWSG.PT1Values[QuestTree.SelectedNode.Index, 3];
                    Objectives.Items.Clear();
                    XmlFile Quest = new XmlFile(AppDir + "\\Data\\Quests.ini");
                    if (NumberOfObjectives.Value > 0)
                        for (int Progress = 0; Progress < NumberOfObjectives.Value; Progress++)
                            Objectives.Items.Add(Quest.XmlReadValue(QuestString.Text, "Objectives" + Progress));
                    ObjectiveValue.Value = 0;
                    QuestSummary.Text = Quest.XmlReadValue(QuestString.Text, "MissionSummary");
                    QuestDescription.Text = Quest.XmlReadValue(QuestString.Text, "MissionDescription");
                }
                else if (QuestTree.SelectedNode.Name == "PT2")
                {
                    QuestString.Text = CurrentWSG.PT2Strings[QuestTree.SelectedNode.Index];
                    if (CurrentWSG.PT2Values[QuestTree.SelectedNode.Index, 0] > 2)
                        QuestProgress.SelectedIndex = 3;
                    else QuestProgress.SelectedIndex = CurrentWSG.PT2Values[QuestTree.SelectedNode.Index, 0];
                    NumberOfObjectives.Value = CurrentWSG.PT2Values[QuestTree.SelectedNode.Index, 3];
                    Objectives.Items.Clear();
                    XmlFile Quest = new XmlFile(AppDir + "\\Data\\Quests.ini");
                    if (NumberOfObjectives.Value > 0)
                        for (int Progress = 0; Progress < NumberOfObjectives.Value; Progress++)
                            Objectives.Items.Add(Quest.XmlReadValue(QuestString.Text, "Objectives" + Progress));
                    ObjectiveValue.Value = 0;
                    QuestSummary.Text = Quest.XmlReadValue(QuestString.Text, "MissionSummary");
                    QuestDescription.Text = Quest.XmlReadValue(QuestString.Text, "MissionDescription");
                }
            }
            catch { QuestString.Text = ""; Objectives.Items.Clear(); NumberOfObjectives.Value = 0; ObjectiveValue.Value = 0; QuestProgress.SelectedIndex = 0; }
        }
Exemplo n.º 31
0
        private void ExportQuests_Click(object sender, EventArgs e)
        {
            try
            {
                if (QuestTree.SelectedNode.Name == "PT2")
                {
                    SaveFileDialog tempExport = new SaveFileDialog();
                    //string ExportText = "";
                    tempExport.DefaultExt = "*.quests";
                    tempExport.Filter = "Quest Data(*.quests)|*.quests";

                    tempExport.FileName = CurrentWSG.CharacterName + "'s PT2 Quests.quests";

                    if (tempExport.ShowDialog() == DialogResult.OK)
                    {
                        // Create empty xml file
                        XmlTextWriter writer = new XmlTextWriter(tempExport.FileName, new System.Text.ASCIIEncoding());
                        writer.Formatting = Formatting.Indented;
                        writer.Indentation = 2;
                        writer.WriteStartDocument();
                        writer.WriteStartElement("INI");
                        writer.WriteEndElement();
                        writer.WriteEndDocument();
                        writer.Flush();
                        writer.Close();

                        XmlFile Quests = new XmlFile(tempExport.FileName);
                        List<string> subsectionnames = new List<string>();
                        List<string> subsectionvalues = new List<string>();

                        for (int Progress = 0; Progress < CurrentWSG.TotalPT2Quests; Progress++)
                        {
                            subsectionnames.Clear();
                            subsectionvalues.Clear();

                            subsectionnames.Add("Progress");
                            subsectionnames.Add("DLCValue1");
                            subsectionnames.Add("DLCValue2");
                            subsectionnames.Add("Objectives");

                            for (int i = 0; i < 4; i++)
                                subsectionvalues.Add(CurrentWSG.PT2Values[Progress, i].ToString());

                            //ExportText = ExportText + "[" + CurrentWSG.PT2Strings[Progress] + "]\r\nProgress=" + CurrentWSG.PT2Values[Progress, 0] + "\r\nDLCValue1=" + CurrentWSG.PT2Values[Progress, 1] + "\r\nDLCValue2=" + CurrentWSG.PT2Values[Progress, 2] + "\r\nObjectives=" + CurrentWSG.PT2Values[Progress, 3] + "\r\n";
                            for (int Folders = 0; Folders < CurrentWSG.PT2Values[Progress, 3]; Folders++)
                            {
                                subsectionnames.Add("FolderName" + Folders);
                                subsectionvalues.Add(CurrentWSG.PT2Subfolders[Progress, Folders]);
                                subsectionnames.Add("FolderValue" + Folders);
                                subsectionvalues.Add(CurrentWSG.PT2Values[Progress, Folders + 4].ToString());

                                //ExportText = ExportText + "FolderName" + Folders + "=" + CurrentWSG.PT2Subfolders[Progress, Folders] + "\r\nFolderValue" + Folders + "=" + CurrentWSG.PT2Values[Progress, Folders + 4] + "\r\n";
                            }
                            Quests.AddSection(CurrentWSG.PT2Strings[Progress], subsectionnames, subsectionvalues);
                        }
                    }
                }
                else if (QuestTree.SelectedNode.Name == "PT1")
                {
                    SaveFileDialog tempExport = new SaveFileDialog();
                    //string ExportText = "";
                    tempExport.DefaultExt = "*.quests";
                    tempExport.Filter = "Quest Data(*.quests)|*.quests";

                    tempExport.FileName = CurrentWSG.CharacterName + "'s PT1 Quests.quests";

                    if (tempExport.ShowDialog() == DialogResult.OK)
                    {
                        // Create empty xml file
                        XmlTextWriter writer = new XmlTextWriter(tempExport.FileName, new System.Text.ASCIIEncoding());
                        writer.Formatting = Formatting.Indented;
                        writer.Indentation = 2;
                        writer.WriteStartDocument();
                        writer.WriteStartElement("INI");
                        writer.WriteEndElement();
                        writer.WriteEndDocument();
                        writer.Flush();
                        writer.Close();

                        XmlFile Quests = new XmlFile(tempExport.FileName);
                        List<string> subsectionnames = new List<string>();
                        List<string> subsectionvalues = new List<string>();

                        for (int Progress = 0; Progress < CurrentWSG.TotalPT1Quests; Progress++)
                        {
                            subsectionnames.Clear();
                            subsectionvalues.Clear();

                            subsectionnames.Add("Progress");
                            subsectionnames.Add("DLCValue1");
                            subsectionnames.Add("DLCValue2");
                            subsectionnames.Add("Objectives");

                            for (int i = 0; i < 4; i++)
                                subsectionvalues.Add(CurrentWSG.PT1Values[Progress, i].ToString());
                            //ExportText = ExportText + "[" + CurrentWSG.PT1Strings[Progress] + "]\r\nProgress=" + CurrentWSG.PT1Values[Progress, 0] + "\r\nDLCValue1=" + CurrentWSG.PT1Values[Progress, 1] + "\r\nDLCValue2=" + CurrentWSG.PT1Values[Progress, 2] + "\r\nObjectives=" + CurrentWSG.PT1Values[Progress, 3] + "\r\n";

                            for (int Folders = 0; Folders < CurrentWSG.PT1Values[Progress, 3]; Folders++)
                            {
                                subsectionnames.Add("FolderName" + Folders);
                                subsectionvalues.Add(CurrentWSG.PT1Subfolders[Progress, Folders]);
                                subsectionnames.Add("FolderValue" + Folders);
                                subsectionvalues.Add(CurrentWSG.PT1Values[Progress, Folders + 4].ToString());

                                //ExportText = ExportText + "FolderName" + Folders + "=" + CurrentWSG.PT1Subfolders[Progress, Folders] + "\r\nFolderValue" + Folders + "=" + CurrentWSG.PT1Values[Progress, Folders + 4] + "\r\n";
                            }
                            Quests.AddSection(CurrentWSG.PT1Strings[Progress], subsectionnames, subsectionvalues);
                        }
                    }
                }

            }
            catch { MessageBox.Show("Select a playthrough to extract first."); }
        }
Exemplo n.º 32
0
        private void SkillList_Click(object sender, EventArgs e)
        {
            try
            {
                XmlFile SkillINI = new XmlFile(AppDir + "\\Data\\gd_skills_common.txt");
                if ((string)Class.SelectedItem == "Soldier")
                    SkillINI = new XmlFile(AppDir + "\\Data\\gd_skills2_Roland.txt");

                else if ((string)Class.SelectedItem == "Siren")
                    SkillINI = new XmlFile(AppDir + "\\Data\\gd_Skills2_Lilith.txt");

                else if ((string)Class.SelectedItem == "Hunter")
                    SkillINI = new XmlFile(AppDir + "\\Data\\gd_skills2_Mordecai.txt");

                else if ((string)Class.SelectedItem == "Berserker")
                    SkillINI = new XmlFile(AppDir + "\\Data\\gd_Skills2_Brick.txt");

                CurrentWSG.NumberOfSkills = CurrentWSG.NumberOfSkills + 1;
                ResizeArrayLarger(ref CurrentWSG.SkillNames, CurrentWSG.NumberOfSkills);
                ResizeArrayLarger(ref CurrentWSG.LevelOfSkills, CurrentWSG.NumberOfSkills);
                ResizeArrayLarger(ref CurrentWSG.ExpOfSkills, CurrentWSG.NumberOfSkills);
                ResizeArrayLarger(ref CurrentWSG.InUse, CurrentWSG.NumberOfSkills);
                CurrentWSG.InUse[CurrentWSG.NumberOfSkills - 1] = -1;
                CurrentWSG.SkillNames[CurrentWSG.NumberOfSkills - 1] = SkillINI.stListSectionNames()[SkillList.SelectedIndex];
                DoSkillTree();
            }
            catch { MessageBox.Show("Could not add new Skill."); }
        }
Exemplo n.º 33
0
        private void ExportSkills_Click(object sender, EventArgs e)
        {
            SaveFileDialog tempExport = new SaveFileDialog();
            //string ExportText = "";
            tempExport.DefaultExt = "*.skills";
            tempExport.Filter = "Skills Data(*.skills)|*.skills";

            tempExport.FileName = CurrentWSG.CharacterName + "'s Skills.skills";

            if (tempExport.ShowDialog() == DialogResult.OK)
            {
                // Create empty xml file
                XmlTextWriter writer = new XmlTextWriter(tempExport.FileName, new System.Text.ASCIIEncoding());
                writer.Formatting = Formatting.Indented;
                writer.Indentation = 2;
                writer.WriteStartDocument();
                writer.WriteStartElement("INI");
                writer.WriteEndElement();
                writer.WriteEndDocument();
                writer.Flush();
                writer.Close();

                XmlFile Skills = new XmlFile(tempExport.FileName);
                List<string> subsectionnames = new List<string>();
                List<string> subsectionvalues = new List<string>();

                for (int Progress = 0; Progress < CurrentWSG.NumberOfSkills; Progress++)
                {
                    subsectionnames.Clear();
                    subsectionvalues.Clear();

                    subsectionnames.Add("Level");
                    subsectionnames.Add("Experience");
                    subsectionnames.Add("InUse");
                    subsectionvalues.Add(CurrentWSG.LevelOfSkills[Progress].ToString());
                    subsectionvalues.Add(CurrentWSG.ExpOfSkills[Progress].ToString());
                    subsectionvalues.Add(CurrentWSG.InUse[Progress].ToString());

                    //ExportText = ExportText + "[" + CurrentWSG.SkillNames[Progress] + "]\r\nLevel=" + CurrentWSG.LevelOfSkills[Progress] + "\r\nExperience=" + CurrentWSG.ExpOfSkills[Progress] + "\r\nInUse=" + CurrentWSG.InUse[Progress] + "\r\n";
                    Skills.AddSection(CurrentWSG.SkillNames[Progress], subsectionnames, subsectionvalues);
                }
                //File.WriteAllText(tempExport.FileName + "s", ExportText);
            }
        }