Exemple #1
0
        private void EditLevelAllGears_Click(object sender, EventArgs e)
        {
            int level;
            int levelindex;

            string levelText = Microsoft.VisualBasic.Interaction.InputBox("All of the " + gearTextName + "s in your backpack will be adjusted to the following level:", "Edit All Levels", "", 10, 10);

            try
            {
                level      = Parse.AsInt(levelText);
                levelindex = level + 2;
            }
            catch (FormatException) { return; }

            foreach (InventoryEntry gear in GearTL.Sorted)
            {
                gear.EffectiveLevel = level;
                gear.NameParts[5]   = "(L" + level + ")";
                gear.LevelIndex     = levelindex;
            }

            GearTL.UpdateNames();

            LevelIndexGear.Value = levelindex;
        }
        private void ImportFromFileSkills_Click(object sender, EventArgs e)
        {
            Util.WTOpenFileDialog tempImport = new Util.WTOpenFileDialog("skills", CurrentWSG.CharacterName + ".skills");

            if (tempImport.ShowDialog() == DialogResult.OK)
            {
                XmlFile       ImportSkills = new XmlFile(tempImport.FileName());
                List <string> sectionNames = ImportSkills.stListSectionNames();

                int sectionCount = sectionNames.Count;

                string[] TempSkillNames  = new string[sectionCount];
                int[]    TempSkillLevels = new int[sectionCount];
                int[]    TempSkillExp    = new int[sectionCount];
                int[]    TempSkillInUse  = new int[sectionCount];
                for (int Progress = 0; Progress < sectionCount; Progress++)
                {
                    string name = sectionNames[Progress];

                    TempSkillNames[Progress]  = name;
                    TempSkillLevels[Progress] = Parse.AsInt(ImportSkills.XmlReadValue(name, "Level"));
                    TempSkillExp[Progress]    = Parse.AsInt(ImportSkills.XmlReadValue(name, "Experience"));
                    TempSkillInUse[Progress]  = Parse.AsInt(ImportSkills.XmlReadValue(name, "InUse"));
                }
                CurrentWSG.SkillNames     = TempSkillNames;
                CurrentWSG.LevelOfSkills  = TempSkillLevels;
                CurrentWSG.ExpOfSkills    = TempSkillExp;
                CurrentWSG.InUse          = TempSkillInUse;
                CurrentWSG.NumberOfSkills = sectionCount;
                DoSkillTree();
            }
        }
Exemple #3
0
        public static InventoryEntry ImportFromText(string text, byte inType)
        {
            List <string> InOutParts = new List <string>();

            InOutParts.AddRange(text.Split(new string[] { "\r\n" }, StringSplitOptions.None));

            // Create new lists
            List <string> parts  = new List <string>();
            List <int>    values = new List <int>();

            try
            {
                int tempInt;
                int Progress;
                for (Progress = 0; Progress < InOutParts.Count; Progress++)
                {
                    if (int.TryParse(InOutParts[Progress], out tempInt))
                    {
                        break;
                    }
                    parts.Add(InOutParts[Progress]);
                }

                if (!(inType == InventoryType.Item || inType == InventoryType.Weapon))
                {                      // Figure out if it an item or a weapon by the number of string values counted
                    if (Progress == 9) // item
                    {
                        inType = InventoryType.Item;
                    }
                    else if (Progress == 14) // weapon
                    {
                        inType = InventoryType.Weapon;
                    }
                    else
                    {
                        throw new FormatException();
                    }
                }

                for (int i = 0; i < 4; i++)
                {
                    values.Add(Parse.AsInt(InOutParts[Progress + i]));
                }
                values[2] = 0;  // set equipped slot to 0
            }
            catch (FormatException)
            {
                MessageBox.Show("Imported data is invalid.  Not inserted.");
                return(null);
            }

            return(new InventoryEntry(inType, parts, values));
        }
Exemple #4
0
        private void EditQualityAllGears_Click(object sender, EventArgs e)
        {
            int    quality;
            string qualityText = Microsoft.VisualBasic.Interaction.InputBox("All of the " + gearTextName + "s in your backpack will be adjusted to the following level:", "Edit All Qualitys", "", 10, 10);

            try
            {
                quality = Parse.AsInt(qualityText);
            }
            catch (FormatException) { return; }

            foreach (InventoryEntry gear in GearTL.Sorted)
            {
                gear.QualityIndex = quality;
            }

            QualityGear.Value = quality;
        }
        private int GetSelectedEchoList()
        {
            int index = -1;

            if (EchoTree.SelectedNode == null)
            {
                // Do nothing, fall through to the feedback message below
            }
            else if (EchoTree.SelectedNode.Parent != EchoTree.Root)
            {
                index = Parse.AsInt(EchoTree.SelectedNode.Parent.GetKey(), -1);
            }
            else
            {
                // This is a category node not an echo.  If there is exactly one
                // selected then choose it as the location for import, otherwise
                // do nothing and let the feedback message below take effect.
                if (EchoTree.SelectedNodes.Count == 1)
                {
                    index = Parse.AsInt(EchoTree.SelectedNode.GetKey());
                }
            }
            return(index);
        }
Exemple #6
0
        private int GetSelectedQuestList()
        {
            int index = -1;

            if (QuestTree.SelectedNode == null)
            {
                // Do nothing, fall through to return -1 for failure.
            }
            else if (QuestTree.SelectedNode.Parent != QuestTree.Root)
            {
                index = Parse.AsInt(QuestTree.SelectedNode.Parent.GetKey(), -1);
            }
            else
            {
                // This is a category node not a quest.  If there is exactly one
                // selected then choose it as the location for import, otherwise
                // fall through and return -1 for failure.
                if (QuestTree.SelectedNodes.Count == 1)
                {
                    index = Parse.AsInt(QuestTree.SelectedNode.GetKey());
                }
            }
            return(index);
        }
        public static InventoryEntry ImportFromText(string text, byte inType)
        {
            List <string> InOutParts = new List <string>();

            InOutParts.AddRange(text.Split(new string[] { "\r\n" }, StringSplitOptions.None));

            // Create new lists
            List <string> parts  = new List <string>();
            List <int>    values = new List <int>();

            try
            {
                int tempInt;
                int Progress;
                for (Progress = 0; Progress < InOutParts.Count; Progress++)
                {
                    if (int.TryParse(InOutParts[Progress], out tempInt))
                    {
                        break;
                    }
                    parts.Add(InOutParts[Progress]);
                }

                if (Progress != 9 && Progress != 14)
                {
                    throw new FormatException();
                }

                byte t = Progress == 9 ? InventoryType.Item : InventoryType.Weapon;

                if (t != inType)
                {
                    MessageBox.Show(inType == InventoryType.Item
                        ? @"You are try to import weapon into item's backpack!"
                        : @"You are try to import item into weapon's backpack!");
                    return(null);
                }

                if (InOutParts.Count == Progress + WillowSaveGame.ExportValuesCount)
                {
                    for (int i = 0; i < WillowSaveGame.ExportValuesCount; i++)
                    {
                        values.Add(Parse.AsInt(InOutParts[Progress + i]));
                    }
                    if (values.Count > 4)
                    {
                        values[4] = (values[4] != 0 && values[4] != 1) ? 0 : values[4];
                        values[5] = (values[5] != 0 && values[5] != 1) ? 0 : values[5];
                    }
                }
                else if (InOutParts.Count < Progress + 4)
                {
                    throw new FormatException();
                }
                else
                {
                    string            message = "Item is in old format, do you want to convert it to the new format?";
                    string            caption = "Ignoring imported item";
                    MessageBoxButtons buttons = MessageBoxButtons.YesNo;
                    DialogResult      result;

                    // Displays the MessageBox.
                    result = MessageBox.Show(message, caption, buttons);
                    if (result == System.Windows.Forms.DialogResult.Yes)
                    {
                        for (int i = 0; i < 4; i++)
                        {
                            values.Add(Parse.AsInt(InOutParts[Progress + i]));
                        }
                        values.Add(0);
                        values.Add(0);
                    }
                    else
                    {
                        return(null);
                    }
                }

                values[2] = 0;  // set equipped slot to 0
            }
            catch (FormatException)
            {
                MessageBox.Show("Imported data is invalid.  Not inserted.");
                return(null);
            }

            return(new InventoryEntry(inType, parts, values));
        }
        public void RecalculateDataWeapon()
        {   // There is a variety of data used for various methods of sorting
            // and naming items that is determined from the parts and values.
            // This function is used to fetch them all.

            string BodyText     = db.GetName(this.Parts[3]);                                    // Body text
            string MaterialText = db.GetName(this.Parts[11]);                                   // Material text

            int Model = Parse.AsInt(db.GetPartAttribute(this.Parts[8], "PartNumberAddend"), 0); // Number from stock

            Model += Parse.AsInt(db.GetPartAttribute(this.Parts[5], "PartNumberAddend"), 0);    // Number from mag

            this.Rarity = Parse.AsInt(db.GetPartAttribute(this.Parts[2], "BaseRarity"), 0);
            for (int i = 3; i < 14; i++)
            {
                int partrarity = db.GetPartRarity(this.Parts[i]);
                // There are several parts that dont use the part rarity that I found
                // in the data.  This attempts to detect them and deal with them.
                if ((partrarity == 50) && (i < 10) && (Parts[i].StartsWith("dlc3") == false))
                {
                    partrarity = 5;
                }
                //else if ((Parts[i] == "dlc3_gd_weap_UniqueParts.SniperRifle.sight4_Jakobs_Bessie") ||
                //   (Parts[i] == "dlc3_gd_weap_UniqueParts.MachinePistol.barrel4_VladofStalker") ||
                //   (Parts[i] == "dlc3_gd_weap_UniqueParts.EridanRifle.Cannon.barrel5_MegaCannon") ||
                //   (Parts[i] == "dlc3_gd_weap_UniqueParts.CombatShotgun.barrel3_DahlJackal") ||
                //   (Parts[i] == "dlc3_gd_weap_UniqueParts.EridanRifle.ElementalRifle.barrel2_Firebomb") ||
                //   (Parts[i] == "dlc3_gd_weap_UniqueParts.EridanRifle.ElementalRifle.barrel2_StampedingSpattergun") ||

                //    false)
                //    partrarity = 50;
                //else if (
                //    (Parts[i] == "gd_weap_repeater_pistol.Sight.sight5_Hyperion_Invader") ||
                //    (Parts[i] == "gd_weap_machine_pistol.mag.mag3_SandS_Thanatos") ||
                //    (Parts[i] == "gd_weap_sniper_rifle.Sight.sight5_Atlas_Cyclops") ||
                //    false)

                //    partrarity = 5;
                //else if ((partrarity == 50) && ((i == 7) || (i == 5)))
                //    partrarity = 5;
                //else if ((partrarity == 50) && (i == 6))
                //    partrarity = 50;
                //else if ((partrarity == 50) && (i < 10))
                //    partrarity = 5;
                this.Rarity += partrarity;
            }
            this.Color = db.RarityToColorWeapon(this.Rarity);
            //                if ((GetPartRarity(this.Parts[8]) == 0) || (GetPartRarity(this.Parts[5]) == 0))
            //                   Model = Model / 10;

            if ((db.GetPartRarity(this.Parts[8]) != 0) && (db.GetPartRarity(this.Parts[5]) != 0))
            {
                Model = Model * 10;
            }

            string ModelText = (Model != 0 ? Model.ToString() : "");

            string MfgText   = db.GetName(this.Parts[1]); // Mfg Name
            string ModelName = BodyText + ModelText + MaterialText;
            string Prefix    = db.GetName(this.Parts[12]);
            string Title     = db.GetName(this.Parts[13]);

            this.Category = db.GetPartAttribute(this.Parts[2], "Presentation");
            if (this.Category == "")
            {
                this.Category = "none";
            }
            this.EffectiveLevel = db.GetEffectiveLevelWeapon(this.Parts.ToArray(), this.QualityIndex, this.LevelIndex);
            // If the order or format of the level string changes, be sure to change it
            // in EditLevelAllWeapons_Click as well.
            this.NameParts = new string[]
            {
                MfgText,
                ModelName,
                Prefix,
                Title,
                "(R" + Rarity + ")",
                "(L" + EffectiveLevel + ")"
            };
        }
        public void RecalculateDataItem()
        {   // There is a variety of data used for various methods of sorting
            // and naming items that is determined from the parts and values.
            // This function is used to fetch them all.

            string BodyText     = db.GetName(this.Parts[5]);                                    // Body text
            string MaterialText = db.GetName(this.Parts[2]);                                    // Material text

            int Model = Parse.AsInt(db.GetPartAttribute(this.Parts[4], "PartNumberAddend"), 0); // Number from stock

            Model += Parse.AsInt(db.GetPartAttribute(this.Parts[3], "PartNumberAddend"), 0);    // Number from mag

            this.Rarity = Parse.AsInt(db.GetPartAttribute(this.Parts[1], "BaseRarity"), 0);
            for (int i = 2; i < 9; i++)
            {
                int partrarity = db.GetPartRarity(this.Parts[i]);
                //                    if ((partrarity == 50) && (i < 10) && (Parts[i].StartsWith("dlc3") == false))
                //                        partrarity = 5;
                //else if ((Parts[i] == "dlc3_gd_weap_UniqueParts.SniperRifle.sight4_Jakobs_Bessie") ||
                //   (Parts[i] == "dlc3_gd_weap_UniqueParts.MachinePistol.barrel4_VladofStalker") ||
                //   (Parts[i] == "dlc3_gd_weap_UniqueParts.EridanRifle.Cannon.barrel5_MegaCannon") ||
                //   (Parts[i] == "dlc3_gd_weap_UniqueParts.CombatShotgun.barrel3_DahlJackal") ||
                //   (Parts[i] == "dlc3_gd_weap_UniqueParts.EridanRifle.ElementalRifle.barrel2_Firebomb") ||
                //   (Parts[i] == "dlc3_gd_weap_UniqueParts.EridanRifle.ElementalRifle.barrel2_StampedingSpattergun") ||

                //    false)
                //    partrarity = 50;
                //else if (
                //    (Parts[i] == "gd_weap_repeater_pistol.Sight.sight5_Hyperion_Invader") ||
                //    (Parts[i] == "gd_weap_machine_pistol.mag.mag3_SandS_Thanatos") ||
                //    (Parts[i] == "gd_weap_sniper_rifle.Sight.sight5_Atlas_Cyclops") ||
                //    false)

                //    partrarity = 5;
                //else if ((partrarity == 50) && ((i == 7) || (i == 5)))
                //    partrarity = 5;
                //else if ((partrarity == 50) && (i == 6))
                //    partrarity = 50;
                //                    if ((partrarity == 10) && (i < 7))
                //                        partrarity = 5;
                this.Rarity += partrarity;
            }
            this.Color = db.RarityToColorItem(this.Rarity);
            //                if ((GetPartRarity(this.Parts[8]) == 0) || (GetPartRarity(this.Parts[5]) == 0))
            //                   Model = Model / 10;

            if ((db.GetPartRarity(this.Parts[4]) != 0) && (db.GetPartRarity(this.Parts[3]) != 0))
            {
                Model = Model * 10;
            }

            string ModelText = (Model != 0 ? Model.ToString() : "");

            string MfgText = db.GetPartAttribute(this.Parts[6], "Manufacturer"); // Mfg Name

            if (MfgText == "")
            {
                MfgText = db.GetPartAttribute(this.Parts[1], "NoManufacturerName");
            }
            string ModelName = BodyText + ModelText + MaterialText;

            string Prefix = db.GetName(this.Parts[7]);
            string Title  = db.GetName(this.Parts[8]);

            if ((Title == "") && (Prefix == ""))
            {
                Title = db.GetPartAttribute(this.Parts[1], "ItemName");
                if (Name == "")
                {
                    Name = "Unknown Item";
                }
            }

            this.Category = db.GetPartAttribute(this.Parts[1], "Presentation");
            if (this.Category == "")
            {
                this.Category = "none";
            }
            this.EffectiveLevel = db.GetEffectiveLevelItem(this.Parts.ToArray(), this.QualityIndex, this.LevelIndex);

            this.NameParts = new string[]
            {
                MfgText,
                ModelName,
                Prefix,
                Title,
                "(R" + Rarity + ")",
                "(L" + EffectiveLevel + ")"
            };
        }