예제 #1
0
        private void refreshStats(Monster mon, Stats cur)
        {
            statName.Text = mon.Name;
            statID.Text = mon.ID.ToString();
            statLevel.Text = mon.level.ToString();

            // read a bunch of numbers
            foreach (var stat in statNames)
            {
                var ctrlBase = (Label)groupBox1.Controls.Find(stat + "Base", true).FirstOrDefault();
                ctrlBase.Text = mon[stat].ToString();

                var ctrlBonus = (Label)groupBox1.Controls.Find(stat + "Bonus", true).FirstOrDefault();
                var ctrlTotal = (TextBox)groupBox1.Controls.Find(stat + "Total", true).FirstOrDefault();

                ctrlTotal.Tag = new KeyValuePair<Label, Label>(ctrlBase, ctrlBonus);

                var ctrlCurrent = groupBox1.Controls.Find(stat + "Current", true).FirstOrDefault();
                ctrlCurrent.Text = cur[stat].ToString();

                var ctrlWorth = groupBox1.Controls.Find(stat + "Worth", true).FirstOrDefault();

                var ctrlThresh = groupBox1.Controls.Find(stat + "Thresh", true).FirstOrDefault();

                var ctrlMax = groupBox1.Controls.Find(stat + "Max", true).FirstOrDefault();

                if (build.Minimum[stat] > 0)
                    ctrlTotal.Text = build.Minimum[stat].ToString();
                if (build.Sort[stat] != 0)
                    ctrlWorth.Text = build.Sort[stat].ToString();
                if (build.Maximum[stat] != 0)
                    ctrlMax.Text = build.Maximum[stat].ToString();
                if (build.Threshold[stat] != 0)
                    ctrlThresh.Text = build.Threshold[stat].ToString();

            }

            foreach (var extra in extraNames)
            {
                var ctrlBase = (Label)groupBox1.Controls.Find(extra + "Base", true).FirstOrDefault();
                ctrlBase.Text = mon.ExtraValue(extra).ToString();

                var ctrlBonus = (Label)groupBox1.Controls.Find(extra + "Bonus", true).FirstOrDefault();
                var ctrlTotal = (TextBox)groupBox1.Controls.Find(extra + "Total", true).FirstOrDefault();

                ctrlTotal.Tag = new KeyValuePair<Label, Label>(ctrlBase, ctrlBonus);

                var ctrlCurrent = groupBox1.Controls.Find(extra + "Current", true).FirstOrDefault();
                ctrlCurrent.Text = cur.ExtraValue(extra).ToString();

                var ctrlWorth = groupBox1.Controls.Find(extra + "Worth", true).FirstOrDefault();

                var ctrlThresh = groupBox1.Controls.Find(extra + "Thresh", true).FirstOrDefault();

                var ctrlMax = groupBox1.Controls.Find(extra + "Max", true).FirstOrDefault();

                if (build.Minimum.ExtraGet(extra) > 0)
                    ctrlTotal.Text = build.Minimum.ExtraGet(extra).ToString();
                if (build.Sort.ExtraGet(extra) != 0)
                    ctrlWorth.Text = build.Sort.ExtraGet(extra).ToString();
                if (build.Maximum.ExtraGet(extra) != 0)
                    ctrlMax.Text = build.Maximum.ExtraGet(extra).ToString();
                if (build.Threshold.ExtraGet(extra) != 0)
                    ctrlThresh.Text = build.Threshold.ExtraGet(extra).ToString();
            }
        }
예제 #2
0
 private double GetPoints(Stats Cur, Action<string, int> w = null)
 {
     double pts = 0;
     double p;
     int i = 1;
     foreach (var stat in statNames)
     {
         string str = Cur[stat].ToString();
         if (build.Sort[stat] != 0)
         {
             p = Cur[stat] / build.Sort[stat];
             if (build.Threshold[stat] != 0)
                 p -= Math.Max(0, Cur[stat] - build.Threshold[stat]) / build.Sort[stat];
             str = p.ToString("0.#") + " (" + Cur[stat].ToString() + ")";
             pts += p;
         }
         w.Invoke(str, i);
         i++;
     }
     foreach (var extra in extraNames)
     {
         string str = Cur.ExtraValue(extra).ToString();
         if (build.Sort.ExtraGet(extra) != 0)
         {
             p = Cur.ExtraValue(extra) / build.Sort.ExtraGet(extra);
             if (build.Threshold.ExtraGet(extra) != 0)
                 p -= Math.Max(0, Cur.ExtraValue(extra) - build.Threshold.ExtraGet(extra)) / build.Sort.ExtraGet(extra);
             str = p.ToString("0.#") + " (" + Cur.ExtraValue(extra).ToString() + ")";
             pts += p;
         }
         w.Invoke(str, i);
         i++;
     }
     return pts;
 }