Beispiel #1
0
        public void DoneClick(object sender, System.EventArgs e)
        {
            ErrorForm errorWindow;

            try
            {
                Monster newMonster = new Monster(this.NameInput.Text, this.SizeList.Text, int.Parse(this.ACInput.Text), Stats[0], Stats[1], Stats[2], Stats[3], Stats[4], Stats[5],
                                                 int.Parse(this.HealthInput.Text), int.Parse(this.HealthInput.Text), this.SpeedInput.Text, this.Skillswindow.Athletics, this.Skillswindow.Acrobatics,
                                                 this.Skillswindow.Sleight, this.Skillswindow.Stealth, this.Skillswindow.Arcana, this.Skillswindow.History, this.Skillswindow.Investigation,
                                                 this.Skillswindow.Nature, this.Skillswindow.Religion, this.Skillswindow.Animal, this.Skillswindow.Insight, this.Skillswindow.Medicine,
                                                 this.Skillswindow.Perception, this.Skillswindow.Survival, this.Skillswindow.Deception, this.Skillswindow.Intimidation, this.Skillswindow.Performance,
                                                 this.Skillswindow.Persuasion, this.Languages, this.Resistance, this.Immunities, this.sensewindow.output, this.MonsterType, this.Alignment, this.Condition);

                newMonster.EnterDatabase();
            }
            catch (Exception error)
            {
                errorWindow = new ErrorForm(error, "Creating Monster Error");
                errorWindow.Show();
            }
            this.Close();
        }
Beispiel #2
0
        private void DoneClick(object sender, System.EventArgs e)
        {
            if (!Loaded)
            {
                if ((this.PageNum.Text != "" && this.NameInput.Text != "" && this.CastInput.Text != "" && this.RangeInput.Text != "" &&
                     this.DurationInput.Text != "" && this.School.Text != "" && this.InfoInput.Text != "") &&
                    (this.VerbalInput.Checked || this.SomaticInput.Checked || this.MaterialCheck.Checked))
                {
                    Spells newSpell = new Spells(int.Parse(this.PageNum.Text), this.NameInput.Text, this.SpellLevel, this.CastInput.Text,
                                                 this.RangeInput.Text, this.MaterialInput.Text, this.VerbalInput.Checked, this.SomaticInput.Checked,
                                                 this.RitualInput.Checked, this.Concentration.Checked, this.DurationInput.Text, this.School.Text,
                                                 this.InfoInput.Text);

                    if (this.LevelList.Text == "Cantrip")
                    {
                        Slots[0] = -1;
                    }

                    AllActions.AddSpells(newSpell, this.SpellLevel);
                    AllActions.AddSlots(this.Slots);
                    if (this.ModInput.Text != "" && this.DCInput.Text != "")
                    {
                        AllActions.AddSpellMod(int.Parse(this.ModInput.Text), int.Parse(this.DCInput.Text));
                    }


                    newData.AddSpell(newSpell, true);
                    this.Close();
                }
                else
                {
                    if (this.PageNum.Text == "")
                    {
                        err = new ErrorForm(new Exception("Page number not filled"), "Please enter a number");
                    }
                    else if (this.NameInput.Text == "")
                    {
                        err = new ErrorForm(new Exception("Name not filled"), "Please enter a name");
                    }
                    else if (this.CastInput.Text == "")
                    {
                        err = new ErrorForm(new Exception("Cast time not filled"), "Please enter a cast time");
                    }
                    else if (this.RangeInput.Text == "")
                    {
                        err = new ErrorForm(new Exception("Range not filled"), "Please enter a range");
                    }
                    else if (this.DurationInput.Text == "")
                    {
                        err = new ErrorForm(new Exception("Duration not filled"), "Please enter a duration");
                    }
                    else if (this.School.Text == "")
                    {
                        err = new ErrorForm(new Exception("School not filled"), "Please enter a school");
                    }
                    else if (this.InfoInput.Text == "")
                    {
                        err = new ErrorForm(new Exception("Info not filled"), "Please enter additional info");
                    }
                    else if (!this.VerbalInput.Checked && !this.SomaticInput.Checked && !this.MaterialCheck.Checked)
                    {
                        err = new ErrorForm(new Exception("Component not filled"), "Please check either verbal, somatic or material");
                    }

                    err.Show();
                }

                //SpellDisplayForm test = new SpellDisplayForm(newSpell);
                //test.Show();
            }
        }
Beispiel #3
0
        private void DoneClick(object sender, System.EventArgs e)
        {
            if (!Loaded)
            {
                if ((this.PageNum.Text != "" && this.NameInput.Text != "" && this.CastInput.Text != "" && this.RangeInput.Text != "" &&
                     this.DurationInput.Text != "" && this.School.Text != "" && this.InfoInput.Text != "") &&
                    (this.VerbalInput.Checked || this.SomaticInput.Checked || this.MaterialCheck.Checked))
                {
                    Spells newSpell = new Spells(int.Parse(this.PageNum.Text), this.NameInput.Text, this.SpellLevel, this.CastInput.Text,
                        this.RangeInput.Text, this.MaterialInput.Text, this.VerbalInput.Checked, this.SomaticInput.Checked,
                        this.RitualInput.Checked, this.Concentration.Checked, this.DurationInput.Text, this.School.Text,
                        this.InfoInput.Text);

                    if (this.LevelList.Text == "Cantrip")
                    {
                        Slots[0] = -1;
                    }

                    AllActions.AddSpells(newSpell, this.SpellLevel);
                    AllActions.AddSlots(this.Slots);
                    if (this.ModInput.Text != "" && this.DCInput.Text != "")
                    {
                        AllActions.AddSpellMod(int.Parse(this.ModInput.Text), int.Parse(this.DCInput.Text));
                    }


                    newData.AddSpell(newSpell, true);
                    this.Close();
                }
                else
                {
                    if (this.PageNum.Text == "")
                    {
                        err = new ErrorForm(new Exception("Page number not filled"), "Please enter a number");
                    }
                    else if (this.NameInput.Text == "")
                    {
                        err = new ErrorForm(new Exception("Name not filled"), "Please enter a name");
                    }
                    else if (this.CastInput.Text == "")
                    {
                        err = new ErrorForm(new Exception("Cast time not filled"), "Please enter a cast time");
                    }
                    else if (this.RangeInput.Text == "")
                    {
                        err = new ErrorForm(new Exception("Range not filled"), "Please enter a range");
                    }
                    else if (this.DurationInput.Text == "")
                    {
                        err = new ErrorForm(new Exception("Duration not filled"), "Please enter a duration");
                    }
                    else if (this.School.Text == "")
                    {
                        err = new ErrorForm(new Exception("School not filled"), "Please enter a school");
                    }
                    else if (this.InfoInput.Text == "")
                    {
                        err = new ErrorForm(new Exception("Info not filled"), "Please enter additional info");
                    }
                    else if (!this.VerbalInput.Checked && !this.SomaticInput.Checked && !this.MaterialCheck.Checked)
                    {
                        err = new ErrorForm(new Exception("Component not filled"), "Please check either verbal, somatic or material");
                    }

                    err.Show();
                }

                //SpellDisplayForm test = new SpellDisplayForm(newSpell);
                //test.Show();
            }
        }
        public void DoneClick(object sender, System.EventArgs e)
        {
            ErrorForm errorWindow;
            try
            {
                Monster newMonster = new Monster(this.NameInput.Text, this.SizeList.Text, int.Parse(this.ACInput.Text), Stats[0], Stats[1], Stats[2], Stats[3], Stats[4], Stats[5],
                    int.Parse(this.HealthInput.Text), int.Parse(this.HealthInput.Text), this.SpeedInput.Text, this.Skillswindow.Athletics, this.Skillswindow.Acrobatics,
                    this.Skillswindow.Sleight, this.Skillswindow.Stealth, this.Skillswindow.Arcana, this.Skillswindow.History, this.Skillswindow.Investigation,
                    this.Skillswindow.Nature, this.Skillswindow.Religion, this.Skillswindow.Animal, this.Skillswindow.Insight, this.Skillswindow.Medicine,
                    this.Skillswindow.Perception, this.Skillswindow.Survival, this.Skillswindow.Deception, this.Skillswindow.Intimidation, this.Skillswindow.Performance,
                    this.Skillswindow.Persuasion, this.Languages, this.Resistance, this.Immunities, this.sensewindow.output, this.MonsterType, this.Alignment, this.Condition);

                newMonster.EnterDatabase();
            }
            catch(Exception error)
            {
                errorWindow = new ErrorForm(error, "Creating Monster Error");
                errorWindow.Show();
            }
            this.Close();
        }
Beispiel #5
0
        public void LoadDatabaseSpells()
        {
            StreamReader file = new StreamReader("Spells.txt");
            SpellLoad = true;
            int location = 1;

            string line = file.ReadLine();

            while (line!=null)
            {
                int PageNum = 0;
                string Name = "";
                int Level = 0;
                string CastTime = "";
                string Range = "";
                string Material = "";
                bool Verbal = false;
                bool Somatic = false;
                bool Ritual = false;
                bool Concentration = false;
                string Duration = "";
                string School = "";
                string Info = "";

                if (line == "New Spell")
                {
                    location++;
                    line = file.ReadLine();
                    Name = line;
                    location++;
                    line = file.ReadLine();
                }
                else
                {
                    err = new ErrorForm(new Exception("Error in line " + location),
                        "Expected New Spell line.");
                    err.Show();
                    while (line != null)
                    {
                        if (line == "New Spell")
                        {
                            break;
                        }

                        Info += line + " ";
                        location++;
                        line = file.ReadLine();
                    }
                }

                if (line.Contains("Page Number"))
                {
                    PageNum = int.Parse(line.Substring(13));
                    location++;
                    line = file.ReadLine();
                }
                else if (line != "New Spell")
                {
                    err = new ErrorForm(new Exception("Error in line " + location + "\nAt spell: " + Name),
                         "Expected Page Number line.");
                    err.Show();
                    while (line != null)
                    {
                        if (line == "New Spell")
                        {
                            break;
                        }

                        Info += line + " ";
                        location++;
                        line = file.ReadLine();
                    }
                }

                line = line.ToLower();
                if (line.Contains("level") || line.Contains("cantrip"))
                {
                    if (line.Contains("ritual"))
                    {
                        Level = int.Parse(line.Substring(0, 1));
                        School = line.Substring(8);
                    }
                    else
                    {
                        if (line.Contains("cantrip"))
                        {
                            Level = 0;
                            School = line.Substring(0, line.IndexOf("cantrip"));
                        }
                        else
                        {
                            int schoolLength = line.Length - 16;
                            Level = int.Parse(line.Substring(0, 1));
                            School = line.Substring(8, schoolLength);
                            Ritual = true;
                        }
                    }
                    location++;
                    line = file.ReadLine();
                }
                else if (line != "New Spell")
                {
                    err = new ErrorForm(new Exception("Error in line " + location + "\nAt spell: " + Name),
                         "Expected Level and School.");
                    err.Show();
                    while (line != null)
                    {
                        if (line == "New Spell")
                        {
                            break;
                        }

                        Info += line + " ";
                        location++;
                        line = file.ReadLine();
                    }
                }

                if (line.Contains("Cast Time"))
                {
                    CastTime = line.Substring(11);
                    location++;
                    line = file.ReadLine();
                }
                else if (line != "New Spell")
                {
                    err = new ErrorForm(new Exception("Error in line " + location + "\nAt spell: " + Name),
                         "Expected Cast Time line.");
                    err.Show();
                    while (line != null)
                    {
                        if (line == "New Spell")
                        {
                            break;
                        }

                        Info += line + " ";
                        location++;
                        line = file.ReadLine();
                    }
                }

                if (line.Contains("Range"))
                {
                    Range = line.Substring(7);
                    location++;
                    line = file.ReadLine();
                }
                else if (line != "New Spell")
                {
                    err = new ErrorForm(new Exception("Error in line " + location),
                         "Expected Range line.");
                    err.Show();
                    while (line != null)
                    {
                        if (line == "New Spell")
                        {
                            break;
                        }

                        Info += line + " ";
                        location++;
                        line = file.ReadLine();
                    }
                }

                if (line.Contains("Components"))
                {
                    if (line.Substring(10).Contains(" V"))
                    {
                        Verbal = true;
                    }
                    if(line.Substring(10).Contains(" S"))
                    {
                        Somatic = true;
                    }
                    if(line.Contains(", M"))
                    {
                        Material = line.Substring(line.IndexOf("(") + 3);
                        Material = Material.Substring(0, Material.Length - 1);
                    }
                    location++;
                    line = file.ReadLine();
                }
                else if (line != "New Spell")
                {
                    err = new ErrorForm(new Exception("Error in line " + location + "\nAt spell: " + Name),
                         "Expected Components line.");
                    err.Show();
                    while (line != null)
                    {
                        if (line == "New Spell")
                        {
                            break;
                        }

                        Info += line + " ";
                        location++;
                        line = file.ReadLine();
                    }
                }

                if (line.Contains("Duration"))
                {
                    if (line.Contains("Concentration"))
                    {
                        Concentration = true;
                        Duration = line.Substring(25);
                    }
                    else
                    {
                        Duration = line.Substring(10);
                    }
                    location++;
                    line = file.ReadLine();
                }
                else if (line != "New Spell")
                {
                    err = new ErrorForm(new Exception("Error in line " + location + "\nAt spell: " + Name),
                         "Expected Duration line.");
                    err.Show();
                    while (line != null)
                    {
                        if (line == "New Spell")
                        {
                            break;
                        }

                        Info += line + " ";
                        location++;
                        line = file.ReadLine();
                    }
                }

                while (line != null)
                {
                    if (line == "New Spell")
                    {
                        break;
                    }

                    Info += line + " ";
                    location++;
                    line = file.ReadLine();
                }

                Spells newSpell = new Spells(PageNum, Name, Level, CastTime, Range, Material, Verbal, Somatic, Ritual, Concentration, Duration, School, Info);
                AddSpell(newSpell, false);
            }

            file.Close();
        }
Beispiel #6
0
        public void LoadDatabaseSpells()
        {
            StreamReader file = new StreamReader("Spells.txt");

            SpellLoad = true;
            int location = 1;

            string line = file.ReadLine();

            while (line != null)
            {
                int    PageNum       = 0;
                string Name          = "";
                int    Level         = 0;
                string CastTime      = "";
                string Range         = "";
                string Material      = "";
                bool   Verbal        = false;
                bool   Somatic       = false;
                bool   Ritual        = false;
                bool   Concentration = false;
                string Duration      = "";
                string School        = "";
                string Info          = "";

                if (line == "New Spell")
                {
                    location++;
                    line = file.ReadLine();
                    Name = line;
                    location++;
                    line = file.ReadLine();
                }
                else
                {
                    err = new ErrorForm(new Exception("Error in line " + location),
                                        "Expected New Spell line.");
                    err.Show();
                    while (line != null)
                    {
                        if (line == "New Spell")
                        {
                            break;
                        }

                        Info += line + " ";
                        location++;
                        line = file.ReadLine();
                    }
                }

                if (line.Contains("Page Number"))
                {
                    PageNum = int.Parse(line.Substring(13));
                    location++;
                    line = file.ReadLine();
                }
                else if (line != "New Spell")
                {
                    err = new ErrorForm(new Exception("Error in line " + location + "\nAt spell: " + Name),
                                        "Expected Page Number line.");
                    err.Show();
                    while (line != null)
                    {
                        if (line == "New Spell")
                        {
                            break;
                        }

                        Info += line + " ";
                        location++;
                        line = file.ReadLine();
                    }
                }

                line = line.ToLower();
                if (line.Contains("level") || line.Contains("cantrip"))
                {
                    if (line.Contains("ritual"))
                    {
                        Level  = int.Parse(line.Substring(0, 1));
                        School = line.Substring(8);
                    }
                    else
                    {
                        if (line.Contains("cantrip"))
                        {
                            Level  = 0;
                            School = line.Substring(0, line.IndexOf("cantrip"));
                        }
                        else
                        {
                            int schoolLength = line.Length - 16;
                            Level  = int.Parse(line.Substring(0, 1));
                            School = line.Substring(8, schoolLength);
                            Ritual = true;
                        }
                    }
                    location++;
                    line = file.ReadLine();
                }
                else if (line != "New Spell")
                {
                    err = new ErrorForm(new Exception("Error in line " + location + "\nAt spell: " + Name),
                                        "Expected Level and School.");
                    err.Show();
                    while (line != null)
                    {
                        if (line == "New Spell")
                        {
                            break;
                        }

                        Info += line + " ";
                        location++;
                        line = file.ReadLine();
                    }
                }

                if (line.Contains("Cast Time"))
                {
                    CastTime = line.Substring(11);
                    location++;
                    line = file.ReadLine();
                }
                else if (line != "New Spell")
                {
                    err = new ErrorForm(new Exception("Error in line " + location + "\nAt spell: " + Name),
                                        "Expected Cast Time line.");
                    err.Show();
                    while (line != null)
                    {
                        if (line == "New Spell")
                        {
                            break;
                        }

                        Info += line + " ";
                        location++;
                        line = file.ReadLine();
                    }
                }

                if (line.Contains("Range"))
                {
                    Range = line.Substring(7);
                    location++;
                    line = file.ReadLine();
                }
                else if (line != "New Spell")
                {
                    err = new ErrorForm(new Exception("Error in line " + location),
                                        "Expected Range line.");
                    err.Show();
                    while (line != null)
                    {
                        if (line == "New Spell")
                        {
                            break;
                        }

                        Info += line + " ";
                        location++;
                        line = file.ReadLine();
                    }
                }

                if (line.Contains("Components"))
                {
                    if (line.Substring(10).Contains(" V"))
                    {
                        Verbal = true;
                    }
                    if (line.Substring(10).Contains(" S"))
                    {
                        Somatic = true;
                    }
                    if (line.Contains(", M"))
                    {
                        Material = line.Substring(line.IndexOf("(") + 3);
                        Material = Material.Substring(0, Material.Length - 1);
                    }
                    location++;
                    line = file.ReadLine();
                }
                else if (line != "New Spell")
                {
                    err = new ErrorForm(new Exception("Error in line " + location + "\nAt spell: " + Name),
                                        "Expected Components line.");
                    err.Show();
                    while (line != null)
                    {
                        if (line == "New Spell")
                        {
                            break;
                        }

                        Info += line + " ";
                        location++;
                        line = file.ReadLine();
                    }
                }

                if (line.Contains("Duration"))
                {
                    if (line.Contains("Concentration"))
                    {
                        Concentration = true;
                        Duration      = line.Substring(25);
                    }
                    else
                    {
                        Duration = line.Substring(10);
                    }
                    location++;
                    line = file.ReadLine();
                }
                else if (line != "New Spell")
                {
                    err = new ErrorForm(new Exception("Error in line " + location + "\nAt spell: " + Name),
                                        "Expected Duration line.");
                    err.Show();
                    while (line != null)
                    {
                        if (line == "New Spell")
                        {
                            break;
                        }

                        Info += line + " ";
                        location++;
                        line = file.ReadLine();
                    }
                }

                while (line != null)
                {
                    if (line == "New Spell")
                    {
                        break;
                    }

                    Info += line + " ";
                    location++;
                    line = file.ReadLine();
                }

                Spells newSpell = new Spells(PageNum, Name, Level, CastTime, Range, Material, Verbal, Somatic, Ritual, Concentration, Duration, School, Info);
                AddSpell(newSpell, false);
            }

            file.Close();
        }