Esempio n. 1
0
        // Set all drop downs and updowns to their starting values and set events.
        private void Form1_Load(object sender, EventArgs e)
        {
            // Check for version update here.
            
            currentCR = Help.ChallengeRatings[0];
            ChallengeRatingDropDown.SelectedIndex = 0;
            AlignmentDropDown.SelectedIndex = AlignmentDropDown.Items.Count - 1;
            HitDieDropDown.SelectedIndex = 0;
            SizeDropDown.SelectedIndex = 0;
            SkillDropDown.SelectedIndex = 0;

            Monster.width = 212;
            ColumnWidthUpDown.Value = 212;

            StrUpDown.ValueChanged += modchanged_ValueChanged;
            DexUpDown.ValueChanged += modchanged_ValueChanged;
            ConUpDown.ValueChanged += modchanged_ValueChanged;
            IntUpDown.ValueChanged += modchanged_ValueChanged;
            WisUpDown.ValueChanged += modchanged_ValueChanged;
            ChaUpDown.ValueChanged += modchanged_ValueChanged;

            // StrSaveBonusUpDown.ValueChanged += savingThrowModify;
            // DexSaveBonusUpDown.ValueChanged += savingThrowModify;
            // ConSaveBonusUpDown.ValueChanged += savingThrowModify;
            // IntSaveBonusUpDown.ValueChanged += savingThrowModify;
            // WisSaveBonusUpDown.ValueChanged += savingThrowModify;
            // ChaSaveBonusUpDown.ValueChanged += savingThrowModify;

            statModList.Add(StrBonus);
            statModList.Add(DexBonus);
            statModList.Add(ConBonus);
            statModList.Add(IntBonus);
            statModList.Add(ChaBonus);
            statModList.Add(WisBonus);

            AddVulnerabilityButton.Click += addCondition;            
            DamageModificationType.SelectedIndex = 0;

            TraitsList.Sorted = true;

            CefStartup();

            browserOutput.Dock = DockStyle.Fill;
            redditOutput.Dock = DockStyle.Fill;

            this.FormClosing += (senderEnd, eEnd) => { Cef.Shutdown(); };

            if (!System.IO.File.Exists("skipupdate.dat") && !Help.CheckForDownload())
            {
                if (MessageBox.Show("New Version Available. Open Download Page?", "New Version", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                {
                    System.Diagnostics.Process.Start(@"http://thegeniusinc.com/dd-monster-maker-download/?ref=" + Help.Version);
                }
            }

            this.Text = this.Text + " v" + Help.Version;
        }       
Esempio n. 2
0
 // This updates the proficiency based on CR.
 private void crChangedUpdateProficiency(object sender, EventArgs e)
 {
     foreach (Challenge_Rating cr in Help.ChallengeRatings)
     {
         if (cr.CR == ChallengeRatingDropDown.Text)
         {
             SkillBonus.Value = cr.profBonus;
             currentCR        = cr;
             ProfBonus.Text   = "+" + cr.profBonus;
         }
     }
 }
Esempio n. 3
0
        // Set all drop downs and updowns to their starting values and set events.
        private void Form1_Load(object sender, EventArgs e)
        {
            // Check for version update here.
            currentCR = Help.ChallengeRatings[0];
            ChallengeRatingDropDown.SelectedIndex = 0;
            AlignmentDropDown.SelectedIndex = AlignmentDropDown.Items.Count - 1;
            HitDieDropDown.SelectedIndex = 0;
            SizeDropDown.SelectedIndex = 0;
            SkillDropDown.SelectedIndex = 0;

            StrUpDown.ValueChanged += modchanged_ValueChanged;
            DexUpDown.ValueChanged += modchanged_ValueChanged;
            ConUpDown.ValueChanged += modchanged_ValueChanged;
            IntUpDown.ValueChanged += modchanged_ValueChanged;
            WisUpDown.ValueChanged += modchanged_ValueChanged;
            ChaUpDown.ValueChanged += modchanged_ValueChanged;

            StrSaveBonusUpDown.ValueChanged += savingThrowModify;
            DexSaveBonusUpDown.ValueChanged += savingThrowModify;
            ConSaveBonusUpDown.ValueChanged += savingThrowModify;
            IntSaveBonusUpDown.ValueChanged += savingThrowModify;
            WisSaveBonusUpDown.ValueChanged += savingThrowModify;
            ChaSaveBonusUpDown.ValueChanged += savingThrowModify;

            AddVulnerabilityButton.Click += addCondition;
            AddResistanceButton.Click += addCondition;
            AddImmunityButton.Click += addCondition;

            TraitsList.Sorted = true;

            CefStartup();

            b.Dock = DockStyle.Fill;
            tableLayoutPanel1.Controls.Add(b, 0, 0);

            this.FormClosing += (senderEnd, eEnd) => { Cef.Shutdown(); };
            if (!Help.CheckForDownload())
            {
                if (MessageBox.Show("New Version Available. Open Download Page?", "New Version", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                {
                    System.Diagnostics.Process.Start(@"http://thegeniusinc.com/dd-monster-maker-download/");
                }
            }

            this.Text = this.Text + " v" + Help.Version;
        }       
Esempio n. 4
0
        // Set all drop downs and updowns to their starting values and set events.
        private void Form1_Load(object sender, EventArgs e)
        {
            // Check for version update here.
            currentCR = Help.ChallengeRatings[0];
            ChallengeRatingDropDown.SelectedIndex = 0;
            AlignmentDropDown.SelectedIndex       = AlignmentDropDown.Items.Count - 1;
            HitDieDropDown.SelectedIndex          = 0;
            SizeDropDown.SelectedIndex            = 0;
            SkillDropDown.SelectedIndex           = 0;

            StrUpDown.ValueChanged += modchanged_ValueChanged;
            DexUpDown.ValueChanged += modchanged_ValueChanged;
            ConUpDown.ValueChanged += modchanged_ValueChanged;
            IntUpDown.ValueChanged += modchanged_ValueChanged;
            WisUpDown.ValueChanged += modchanged_ValueChanged;
            ChaUpDown.ValueChanged += modchanged_ValueChanged;

            StrSaveBonusUpDown.ValueChanged += savingThrowModify;
            DexSaveBonusUpDown.ValueChanged += savingThrowModify;
            ConSaveBonusUpDown.ValueChanged += savingThrowModify;
            IntSaveBonusUpDown.ValueChanged += savingThrowModify;
            WisSaveBonusUpDown.ValueChanged += savingThrowModify;
            ChaSaveBonusUpDown.ValueChanged += savingThrowModify;

            AddVulnerabilityButton.Click += addCondition;
            AddResistanceButton.Click    += addCondition;
            AddImmunityButton.Click      += addCondition;

            TraitsList.Sorted = true;

            CefStartup();

            b.Dock = DockStyle.Fill;
            tableLayoutPanel1.Controls.Add(b, 0, 0);

            this.FormClosing += (senderEnd, eEnd) => { Cef.Shutdown(); };
            if (!Help.CheckForDownload())
            {
                if (MessageBox.Show("New Version Available. Open Download Page?", "New Version", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                {
                    System.Diagnostics.Process.Start(@"http://thegeniusinc.com/dd-monster-maker-download/");
                }
            }

            this.Text = this.Text + " v" + Help.Version;
        }
Esempio n. 5
0
        private void LoadData(object sender, EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();
            dialog.InitialDirectory = @"C:\";
            dialog.Filter = "mm files (*.mm)|*.mm";
            dialog.RestoreDirectory = true;

            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Data jsonMonster = new Data();
                jsonMonster = JsonConvert.DeserializeObject<Data>(System.IO.File.ReadAllText(dialog.FileName));
                TraitsList.Items.Clear();
                
                Monster.Input(jsonMonster);

                currentCR = Monster.CR;
                ChallengeRatingDropDown.Text = "";
                ChallengeRatingDropDown.SelectedText = Help.FindCRByIndex(Monster.CR.Index).CR;
                crChangedUpdateProficiency(null, null);

                AlignmentDropDown.Text = "";
                AlignmentDropDown.SelectedText = Monster.CreatureAlign;

                StrUpDown.Value = Monster.STR;
                DexUpDown.Value = Monster.DEX;
                ConUpDown.Value = Monster.CON;
                WisUpDown.Value = Monster.WIS;
                IntUpDown.Value = Monster.INT;
                ChaUpDown.Value = Monster.CHA;

                string[] speeds = Monster.Speed.Split(',');
                foreach (string speed in speeds)
                {                    
                    string check = speed.Split(':')[0].Trim();                    
                    switch (check)
                    {
                        case "Burrow":                            
                            int Burrow = 0;
                            int.TryParse(speed.Split(':')[1], out Burrow);
                            burrowUpDown.Value = Burrow;
                            break;
                        case "Climb":                            
                            int Climb = 0;
                            int.TryParse(speed.Split(':')[1], out Climb);
                            ClimbUpDown.Value = Climb;
                            break;
                        case "Fly":                            
                            int Fly = 0;                                                        
                            if (speed.Split(':')[1].Contains("(Hover)"))
                            {
                                HoverCheckBox.Checked = true;
                                int.TryParse(speed.Split(':')[1].Replace(" (Hover)", ""), out Fly);
                            }
                            else
                            {
                                int.TryParse(speed.Split(':')[1], out Fly);
                            }
                            FlyUpDown.Value = Fly;
                            break;
                        case "Swim":                            
                            int Swim = 0;
                            int.TryParse(speed.Split(':')[1], out Swim);
                            SwimUpDown.Value = Swim;
                            break;
                        default:                            
                            try
                            {
                                int temp = 0;
                                int.TryParse(check, out temp);
                                SpeedUpDown.Value = temp;
                            }
                            catch { }                            
                            break;
                    }                    
                }
                
                foreach (Ability item in Monster._Abilities)
                {
                    TraitsList.Items.Add("Ability: " + item.Title);
                }

                foreach (Ability item in Monster._Attacks)
                {
                    TraitsList.Items.Add("Attack: " + item.Title);
                }

                foreach (string language in Monster._Languages)
                {
                    TraitsList.Items.Add("Language: " + language);
                }

                foreach (string senses in Monster._Senses)
                {
                    TraitsList.Items.Add("Sense: " + senses);
                }

                foreach (string CImmunity in Monster.ConditionImmunities)
                {
                    TraitsList.Items.Add("Condition Immunity: " + CImmunity);
                }

                foreach (string DImmunities in Monster.DamageImmunities)
                {
                    TraitsList.Items.Add("Damage Immunity: " + DImmunities);
                }

                foreach (string DResistance in Monster.DamageResistances)
                {
                    TraitsList.Items.Add("Damage Resistance: " + DResistance);
                }

                foreach (string DVulnerability in Monster.DamageVulnerability)
                {
                    TraitsList.Items.Add("Damage Vulnerability: " + DVulnerability);
                }

                foreach (string SavingThrow in Monster.SavingThrowBonuses)
                {
                    string temp = SavingThrow.Split(' ')[0];
                    int tempBonus = 0;
                    int.TryParse(SavingThrow.Split('+')[1], out tempBonus);

                    switch (temp)
                    {
                        case "Str":
                            StrSaveBonusUpDown.Value = tempBonus;
                            break;
                        case "Dex":
                            DexSaveBonusUpDown.Value = tempBonus;
                            break;
                        case "Con":
                            ConSaveBonusUpDown.Value = tempBonus;
                            break;
                        case "Int":
                            IntSaveBonusUpDown.Value = tempBonus;
                            break;
                        case "Wis":
                            WisSaveBonusUpDown.Value = tempBonus;
                            break;
                        case "Cha":
                            ChaSaveBonusUpDown.Value = tempBonus;
                            break;
                    }
                }

                foreach (string SkillBonus in Monster.SkillBonuses)
                {                    
                    TraitsList.Items.Add(SkillBonus);
                }

                HitDieTextBox.Text = Monster.HP;
                try
                {
                    string hpString = Monster.HP.Split('(')[1].Replace(')', ' ').Trim().Split('+')[0];
                    int DiceSize;
                    int DiceNumber;
                    int.TryParse(hpString.Split('d')[0], out DiceNumber);
                    int.TryParse(hpString.Split('d')[1], out DiceSize);

                    HitDieUpDown.Value = DiceNumber;
                    HitDieDropDown.Text = "";
                    HitDieDropDown.SelectedText = "d" + DiceSize;
                }
                catch { }

                try
                {
                    int ACValue = 0;
                    int.TryParse(Monster.AC.Split(' ')[0], out ACValue);

                    ACUpDown.Value = ACValue;
                    ACSourceTextBox.Text = Monster.AC.Split(' ')[1];
                }
                catch { }

                MonsterNameTextBox.Text = "";
                SizeDropDown.Text = "";
                TypeDropDown.Text = "";
                TagDropDown.Text = "";

                MonsterNameTextBox.Text = Monster.CreatureName;
                SizeDropDown.SelectedText = Monster.CreatureSize;
                TypeDropDown.SelectedText = Monster.CreatureType.Split(' ')[0];
                try { TagDropDown.SelectedText = Monster.CreatureType.Split(' ')[1].Replace('(', ' ').Replace(')', ' ').Trim(); }
                catch { }

                //Monster.SkillBonuses.Clear();
                Monster.Clear();
            }
        }        
Esempio n. 6
0
 // This updates the proficiency based on CR.
 private void crChangedUpdateProficiency(object sender, EventArgs e)
 {            
     foreach (Challenge_Rating cr in Help.ChallengeRatings)
     {
         if (cr.CR == ChallengeRatingDropDown.Text)
         {
             SkillBonus.Value = cr.profBonus;                    
             currentCR = cr;
             ProfBonus.Text = "+" + cr.profBonus;
         }
     }
 }
 // Loads the monster data from data model.
 public static void Input(Data source)
 {
     Monster.Clear(true);
     _Abilities = source._Abilities;
     _Actions = source._Actions;
     _Legendaries = source._Legendaries;
     _Reactions = source._Reactions;
     _Languages = source._Languages;
     _Senses = source._Senses;
     AC = source.AC;
     CHA = source.CHA;
     CON = source.CON;
     ConditionImmunities = source.ConditionImmunities;
     CR = source.CR;
     CreatureAlign = source.CreatureAlign;
     CreatureName = source.CreatureName;
     CreatureSize = source.CreatureSize;
     CreatureType = source.CreatureType;
     DamageImmunities = source.DamageImmunities;
     DamageResistances = source.DamageResistances;
     DamageVulnerability = source.DamageVulnerability;
     DEX = source.DEX;
     HP = source.HP;
     INT = source.INT;
     //fillTarget.output = output;
     proficency = source.proficency;
     SavingThrowBonuses = source.SavingThrowBonuses;
     SkillBonuses = source.SkillBonuses;
     Speed = source.Speed;
     STR = source.STR;
     Title = source.Title;
     WIS = source.WIS;
 }
        public static void Clear(bool isNew = false)
        {
            Title = "";

            STR = 0;
            DEX = 0;
            CON = 0;
            INT = 0;
            WIS = 0;
            CHA = 0;

            Speed = "";
            AC = "";
            HP = "";
            CR = Help.ChallengeRatings[0];

            CreatureAlign = "";
            CreatureName = "";
            CreatureSize = "";
            CreatureType = "";

            output.Clear();
            output = new List<string>();

            DamageImmunities.Clear();
            DamageResistances.Clear();
            DamageVulnerability.Clear();
            ConditionImmunities.Clear();
            SavingThrowBonuses.Clear();
            SkillBonuses.Clear();

            if (isNew)
            {
                _Abilities.Clear();
                _Actions.Clear();
                _Legendaries.Clear();
                _Reactions.Clear();
            }

            _Languages.Clear();
            _Senses.Clear();
        }
Esempio n. 9
0
        // Converts JSON string to Monster, loading data.
        private void LoadData(object sender, EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();
            dialog.InitialDirectory = Help.LastDirectory;
            dialog.Filter = "mm files (*.mm)|*.mm";
            dialog.RestoreDirectory = true;

            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Help.LastDirectory = dialog.FileName;

                Data jsonMonster = new Data();
                jsonMonster = JsonConvert.DeserializeObject<Data>(System.IO.File.ReadAllText(dialog.FileName));
                TraitsList.Items.Clear();
                TraitsList.Sorted = false;

                Monster.Input(jsonMonster);                

                currentCR = Monster.CR;
                ChallengeRatingDropDown.Text = "";
                ChallengeRatingDropDown.SelectedText = Help.FindCRByIndex(Monster.CR.Index).CR;
                crChangedUpdateProficiency(null, null);
                
                AlignmentDropDown.Text = "";
                AlignmentDropDown.SelectedText = Monster.CreatureAlign;

                StrUpDown.Value = Monster.STR;
                DexUpDown.Value = Monster.DEX;
                ConUpDown.Value = Monster.CON;
                WisUpDown.Value = Monster.WIS;
                IntUpDown.Value = Monster.INT;
                ChaUpDown.Value = Monster.CHA;

                SwimUpDown.Enabled = true;
                SpeedUpDown.Enabled = true;
                ClimbUpDown.Enabled = true;
                burrowUpDown.Enabled = true;
                FlyUpDown.Enabled = true;
                HoverCheckBox.Checked = false;

                string[] speeds = Monster.Speed.Split(',');

                // Speed stuff
                #region
                foreach (string speed in speeds)
                {
                    bool custom = false;
                    string customString = "";

                    // So this checks each bit of the line for something that isn't a speed tag, ft. or hover.
                    // If that happens, it makes sure it isn't a number first. And if that's the case, then it switches custom.
                    foreach (string x in speed.Split(' '))
                    {                        
                        if (!String.IsNullOrEmpty(x) || !String.IsNullOrWhiteSpace(x))
                        {                            
                            if (x != "burrow:" && x != "fly:" && x != "climb:" && x != "swim:" && x != "ft." && x != "(hover)")
                            {                                
                                int tester = 0;
                                if (!int.TryParse(x.Trim(), out tester))
                                {                                    
                                    custom = true;
                                    customString += x + " ";
                                }
                            }
                        }
                    }

                    if (!custom)
                    {
                        string check = speed.Split(':')[0].Trim().ToLower();
                        switch (check)
                        {
                            case "burrow":
                                try
                                {
                                    int Burrow = 0;
                                    int.TryParse(speed.Split(':')[1].Replace("ft.", ""), out Burrow);
                                    burrowUpDown.Value = Burrow;
                                }
                                catch { }
                                break;
                            case "climb":
                                try
                                {
                                    int Climb = 0;
                                    int.TryParse(speed.Split(':')[1].Replace("ft.", ""), out Climb);
                                    ClimbUpDown.Value = Climb;
                                }
                                catch { }
                                break;
                            case "fly":
                                try
                                {
                                    int Fly = 0;
                                    if (speed.Split(':')[1].Contains("(hover)"))
                                    {
                                        HoverCheckBox.Checked = true;
                                        int.TryParse(speed.Split(':')[1].Replace("ft.", "").Replace(" (hover)", ""), out Fly);
                                    }
                                    else
                                    {
                                        int.TryParse(speed.Split(':')[1].Replace("ft.", ""), out Fly);
                                    }
                                    FlyUpDown.Value = Fly;
                                }
                                catch { }
                                break;
                            case "swim":
                                try
                                {
                                    int Swim = 0;
                                    int.TryParse(speed.Split(':')[1].Replace("ft.", ""), out Swim);
                                    SwimUpDown.Value = Swim;
                                }
                                catch { }
                                break;
                            default:
                                try
                                {
                                    int temp = 0;
                                    int.TryParse(check.Replace("ft.", ""), out temp);
                                    SpeedUpDown.Value = temp;
                                }
                                catch { }
                                break;
                        }
                    }
                    else
                    {
                        Console.WriteLine(speed + " is a custom speed");
                        int tester = 0;
                        string whichSpeed = "";
                        NumericUpDown target = null;
                        bool isFly = false;
                            
                        // custom Speed stuff goes here.                          
                        foreach (string x in speed.Split(' '))
                        {
                            if (target == null)
                            {                                
                                if (x == "burrow:" || x == "fly:" || x == "swim:" || x == "climb:")
                                {
                                    whichSpeed = x;                                    
                                    switch (whichSpeed)
                                    {
                                        case "speed:":
                                            target = (NumericUpDown)SpeedUpDown;
                                            break;
                                        case "swim:":
                                            target = (NumericUpDown)SwimUpDown;
                                            break;
                                        case "fly:":
                                            target = (NumericUpDown)FlyUpDown;
                                            isFly = true;
                                            break;
                                        case "burrow:":
                                            target = (NumericUpDown)burrowUpDown;
                                            break;
                                        case "climb:":
                                            target = (NumericUpDown)ClimbUpDown;
                                            break;
                                    }
                                }

                                if (target == null) {
                                    int temp = 0;
                                    if (int.TryParse(x, out temp))
                                    {
                                        target = (NumericUpDown)SpeedUpDown; whichSpeed = "speed:";
                                        Console.WriteLine("Custom speed type: " + whichSpeed + " " + target.Name);
                                    }
                                }                                
                            }


                            if (target != null)
                            {
                                if (int.TryParse(x, out tester))
                                {
                                    target.Enabled = false;
                                    target.Value = tester;

                                    if (speed.Contains("hover") && isFly)
                                    {
                                        HoverCheckBox.Checked = true;
                                    }

                                    target.Tag = customString;
                                    target = null;
                                }
                            }
                        }
                    }
                }
                #endregion

                foreach (Ability item in Monster._Abilities)
                {
                    TraitsList.Items.Add("Ability: " + item.Title);
                }

                foreach (Ability item in Monster._Actions)
                {
                    TraitsList.Items.Add("Action: " + item.Title);
                }

                foreach (Ability reaction in Monster._Reactions)
                {
                    TraitsList.Items.Add("Reaction: " + reaction.Title);
                }

                foreach (Legendary epic in Monster._Legendaries)
                {
                    TraitsList.Items.Add("Legendary: " + epic.Title);
                }
                
                foreach (string language in Monster._Languages)
                {
                    TraitsList.Items.Add("Language: " + language);
                }

                foreach (string senses in Monster._Senses)
                {
                    TraitsList.Items.Add("Sense: " + senses);
                }

                foreach (string CImmunity in Monster.ConditionImmunities)
                {
                    TraitsList.Items.Add("Condition Immunity: " + CImmunity);
                }

                foreach (string DImmunities in Monster.DamageImmunities)
                {
                    TraitsList.Items.Add("Damage Immunity: " + DImmunities);
                }

                foreach (string DResistance in Monster.DamageResistances)
                {
                    TraitsList.Items.Add("Damage Resistance: " + DResistance);
                }

                foreach (string DVulnerability in Monster.DamageVulnerability)
                {
                    TraitsList.Items.Add("Damage Vulnerability: " + DVulnerability);
                }

                foreach (string SavingThrow in Monster.SavingThrowBonuses)
                {
                    string temp = SavingThrow.Split(' ')[0];
                    int tempBonus = 0;
                    int.TryParse(SavingThrow.Split('+')[1], out tempBonus);

                    switch (temp)
                    {
                        case "Str":
                            StrSaveBonusUpDown.Value = tempBonus;
                            break;
                        case "Dex":
                            DexSaveBonusUpDown.Value = tempBonus;
                            break;
                        case "Con":
                            ConSaveBonusUpDown.Value = tempBonus;
                            break;
                        case "Int":
                            IntSaveBonusUpDown.Value = tempBonus;
                            break;
                        case "Wis":
                            WisSaveBonusUpDown.Value = tempBonus;
                            break;
                        case "Cha":
                            ChaSaveBonusUpDown.Value = tempBonus;
                            break;
                    }
                }

                foreach (string SkillBonus in Monster.SkillBonuses)
                {                    
                    TraitsList.Items.Add(SkillBonus);
                }

                HitDieTextBox.Text = Monster.HP;

                try
                {
                    string hpString = Monster.HP.Split('(')[1].Replace(')', ' ').Trim().Split('+')[0];
                    int DiceSize;
                    int DiceNumber;
                    int.TryParse(hpString.Split('d')[0], out DiceNumber);
                    int.TryParse(hpString.Split('d')[1], out DiceSize);

                    HitDieUpDown.Value = DiceNumber;
                    HitDieDropDown.Text = "";
                    HitDieDropDown.SelectedText = "d" + DiceSize;
                }
                catch { }

                try
                {
                    int ACValue = 0;
                    int.TryParse(Monster.AC.Split(' ')[0], out ACValue);

                    ACUpDown.Value = ACValue;
                    string temp = Monster.AC.Replace(ACValue.ToString(), "").Trim();
                    ACSourceTextBox.Text = temp.Substring(1, temp.Length - 2);
                }
                catch { }

                MonsterNameTextBox.Text = "";
                SizeDropDown.Text = "";
                TypeDropDown.Text = "";
                TagDropDown.Text = "";

                MonsterNameTextBox.Text = Monster.CreatureName;
                SizeDropDown.SelectedText = Monster.CreatureSize;
                TypeDropDown.Text = Monster.CreatureType.Split(' ')[0];
                try 
                {
                    TagDropDown.Text = Monster.CreatureType.Replace(TypeDropDown.Text, "").Replace('(', ' ').Replace(')', ' ').Trim();                                        
                }
                catch
                {
                    
                }
                
                Monster.Clear();
            }
        }        
Esempio n. 10
0
        // Set all drop downs and updowns to their starting values and set events.
        private void Form1_Load(object sender, EventArgs e)
        {
            currentCR = Help.ChallengeRatings[0];
            ChallengeRatingDropDown.SelectedIndex = 0;
            AlignmentDropDown.SelectedIndex = AlignmentDropDown.Items.Count - 1;
            HitDieDropDown.SelectedIndex = 0;
            SizeDropDown.SelectedIndex = 0;
            SkillDropDown.SelectedIndex = 0;

            StrUpDown.ValueChanged += modchanged_ValueChanged;
            DexUpDown.ValueChanged += modchanged_ValueChanged;
            ConUpDown.ValueChanged += modchanged_ValueChanged;
            IntUpDown.ValueChanged += modchanged_ValueChanged;
            WisUpDown.ValueChanged += modchanged_ValueChanged;
            ChaUpDown.ValueChanged += modchanged_ValueChanged;

            StrSaveBonusUpDown.ValueChanged += savingThrowModify;
            DexSaveBonusUpDown.ValueChanged += savingThrowModify;
            ConSaveBonusUpDown.ValueChanged += savingThrowModify;
            IntSaveBonusUpDown.ValueChanged += savingThrowModify;
            WisSaveBonusUpDown.ValueChanged += savingThrowModify;
            ChaSaveBonusUpDown.ValueChanged += savingThrowModify;

            AddVulnerabilityButton.Click += addCondition;
            AddResistanceButton.Click += addCondition;
            AddImmunityButton.Click += addCondition;

            TraitsList.Sorted = true;
        }
Esempio n. 11
0
        private void LoadData(object sender, EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.InitialDirectory = @"C:\";
            dialog.Filter           = "mm files (*.mm)|*.mm";
            dialog.RestoreDirectory = true;

            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Data jsonMonster = new Data();
                jsonMonster = JsonConvert.DeserializeObject <Data>(System.IO.File.ReadAllText(dialog.FileName));
                TraitsList.Items.Clear();

                Monster.Input(jsonMonster);

                currentCR = Monster.CR;
                ChallengeRatingDropDown.Text         = "";
                ChallengeRatingDropDown.SelectedText = Help.FindCRByIndex(Monster.CR.Index).CR;
                crChangedUpdateProficiency(null, null);

                AlignmentDropDown.Text         = "";
                AlignmentDropDown.SelectedText = Monster.CreatureAlign;

                StrUpDown.Value = Monster.STR;
                DexUpDown.Value = Monster.DEX;
                ConUpDown.Value = Monster.CON;
                WisUpDown.Value = Monster.WIS;
                IntUpDown.Value = Monster.INT;
                ChaUpDown.Value = Monster.CHA;

                string[] speeds = Monster.Speed.Split(',');
                foreach (string speed in speeds)
                {
                    string check = speed.Split(':')[0].Trim();
                    switch (check)
                    {
                    case "Burrow":
                        int Burrow = 0;
                        int.TryParse(speed.Split(':')[1], out Burrow);
                        burrowUpDown.Value = Burrow;
                        break;

                    case "Climb":
                        int Climb = 0;
                        int.TryParse(speed.Split(':')[1], out Climb);
                        ClimbUpDown.Value = Climb;
                        break;

                    case "Fly":
                        int Fly = 0;
                        if (speed.Split(':')[1].Contains("(Hover)"))
                        {
                            HoverCheckBox.Checked = true;
                            int.TryParse(speed.Split(':')[1].Replace(" (Hover)", ""), out Fly);
                        }
                        else
                        {
                            int.TryParse(speed.Split(':')[1], out Fly);
                        }
                        FlyUpDown.Value = Fly;
                        break;

                    case "Swim":
                        int Swim = 0;
                        int.TryParse(speed.Split(':')[1], out Swim);
                        SwimUpDown.Value = Swim;
                        break;

                    default:
                        try
                        {
                            int temp = 0;
                            int.TryParse(check, out temp);
                            SpeedUpDown.Value = temp;
                        }
                        catch { }
                        break;
                    }
                }

                foreach (Ability item in Monster._Abilities)
                {
                    TraitsList.Items.Add("Ability: " + item.Title);
                }

                foreach (Ability item in Monster._Attacks)
                {
                    TraitsList.Items.Add("Attack: " + item.Title);
                }

                foreach (string language in Monster._Languages)
                {
                    TraitsList.Items.Add("Language: " + language);
                }

                foreach (string senses in Monster._Senses)
                {
                    TraitsList.Items.Add("Sense: " + senses);
                }

                foreach (string CImmunity in Monster.ConditionImmunities)
                {
                    TraitsList.Items.Add("Condition Immunity: " + CImmunity);
                }

                foreach (string DImmunities in Monster.DamageImmunities)
                {
                    TraitsList.Items.Add("Damage Immunity: " + DImmunities);
                }

                foreach (string DResistance in Monster.DamageResistances)
                {
                    TraitsList.Items.Add("Damage Resistance: " + DResistance);
                }

                foreach (string DVulnerability in Monster.DamageVulnerability)
                {
                    TraitsList.Items.Add("Damage Vulnerability: " + DVulnerability);
                }

                foreach (string SavingThrow in Monster.SavingThrowBonuses)
                {
                    string temp      = SavingThrow.Split(' ')[0];
                    int    tempBonus = 0;
                    int.TryParse(SavingThrow.Split('+')[1], out tempBonus);

                    switch (temp)
                    {
                    case "Str":
                        StrSaveBonusUpDown.Value = tempBonus;
                        break;

                    case "Dex":
                        DexSaveBonusUpDown.Value = tempBonus;
                        break;

                    case "Con":
                        ConSaveBonusUpDown.Value = tempBonus;
                        break;

                    case "Int":
                        IntSaveBonusUpDown.Value = tempBonus;
                        break;

                    case "Wis":
                        WisSaveBonusUpDown.Value = tempBonus;
                        break;

                    case "Cha":
                        ChaSaveBonusUpDown.Value = tempBonus;
                        break;
                    }
                }

                foreach (string SkillBonus in Monster.SkillBonuses)
                {
                    TraitsList.Items.Add(SkillBonus);
                }

                HitDieTextBox.Text = Monster.HP;
                try
                {
                    string hpString = Monster.HP.Split('(')[1].Replace(')', ' ').Trim().Split('+')[0];
                    int    DiceSize;
                    int    DiceNumber;
                    int.TryParse(hpString.Split('d')[0], out DiceNumber);
                    int.TryParse(hpString.Split('d')[1], out DiceSize);

                    HitDieUpDown.Value          = DiceNumber;
                    HitDieDropDown.Text         = "";
                    HitDieDropDown.SelectedText = "d" + DiceSize;
                }
                catch { }

                try
                {
                    int ACValue = 0;
                    int.TryParse(Monster.AC.Split(' ')[0], out ACValue);

                    ACUpDown.Value       = ACValue;
                    ACSourceTextBox.Text = Monster.AC.Split(' ')[1];
                }
                catch { }

                MonsterNameTextBox.Text = "";
                SizeDropDown.Text       = "";
                TypeDropDown.Text       = "";
                TagDropDown.Text        = "";

                MonsterNameTextBox.Text   = Monster.CreatureName;
                SizeDropDown.SelectedText = Monster.CreatureSize;
                TypeDropDown.SelectedText = Monster.CreatureType.Split(' ')[0];
                try { TagDropDown.SelectedText = Monster.CreatureType.Split(' ')[1].Replace('(', ' ').Replace(')', ' ').Trim(); }
                catch { }

                //Monster.SkillBonuses.Clear();
                Monster.Clear();
            }
        }
Esempio n. 12
0
        // Set all drop downs and updowns to their starting values and set events.
        private void Form1_Load(object sender, EventArgs e)
        {
            //Monster.CreatureName = "creature";            
            currentCR = Help.FindCRByIndex(0);
            ChallengeRatingDropDown.SelectedIndex = 0;            
            AlignmentDropDown.SelectedIndex = AlignmentDropDown.Items.Count - 1;
            HitDieDropDown.SelectedIndex = 0;
            SizeDropDown.SelectedIndex = 0;
            SkillDropDown.SelectedIndex = 0;

            Monster.width = 212;
            ColumnWidthUpDown.Value = 212;

            StrUpDown.ValueChanged += modchanged_ValueChanged;
            DexUpDown.ValueChanged += modchanged_ValueChanged;
            ConUpDown.ValueChanged += modchanged_ValueChanged;
            IntUpDown.ValueChanged += modchanged_ValueChanged;
            WisUpDown.ValueChanged += modchanged_ValueChanged;
            ChaUpDown.ValueChanged += modchanged_ValueChanged;

            // StrSaveBonusUpDown.ValueChanged += savingThrowModify;
            // DexSaveBonusUpDown.ValueChanged += savingThrowModify;
            // ConSaveBonusUpDown.ValueChanged += savingThrowModify;
            // IntSaveBonusUpDown.ValueChanged += savingThrowModify;
            // WisSaveBonusUpDown.ValueChanged += savingThrowModify;
            // ChaSaveBonusUpDown.ValueChanged += savingThrowModify;

            statModList.Add(StrBonus);
            statModList.Add(DexBonus);
            statModList.Add(ConBonus);
            statModList.Add(IntBonus);
            statModList.Add(ChaBonus);
            statModList.Add(WisBonus);

            AddVulnerabilityButton.Click += addCondition;            
            DamageModificationType.SelectedIndex = 0;

            TraitsList.Sorted = true;

            CefStartup();

            browserOutput.Dock = DockStyle.Fill;
            redditOutput.Dock = DockStyle.Fill;

            this.FormClosing += (senderEnd, eEnd) => { Cef.Shutdown(); };

            if (!Help.CheckForDownload())
            {
                System.Windows.Forms.DialogResult result = MessageBox.Show("New Version Available. Open Download Page?", "New Version", MessageBoxButtons.YesNo);
                if (result == System.Windows.Forms.DialogResult.Yes)
                {
                    System.Diagnostics.Process.Start(@"http://thegeniusinc.com/dd-monster-maker-download/?ref=" + Help.Version);
                } else
                {
                    if (MessageBox.Show("Would you like to skip this version?", "Skip", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        Help.SkipVersion = Help.ParsedVersion;
                    }
                    else
                    {
                        Help.SkipVersion = "0.0.0";
                    }
                }
            }

            this.Text = this.Text + " v" + Help.Version;            
            AddSaved.Text = "Add SRD Content";            
        }       
Esempio n. 13
0
 // This updates the proficiency based on CR.
 private void crChangedUpdateProficiency(object sender, EventArgs e)
 {
     Challenge_Rating temp = Help.FindCRByIndex(ChallengeRatingDropDown.Text);
     if (temp != null)
     {
         SkillBonus.Value = temp.profBonus;
         currentCR = temp;
         ProfBonus.Text = "+" + temp.profBonus;
         Monster.CR = temp;
     }
 }