public void MinusSkill(object sender)
 {
     // Find Sending Row
     for (var vis = sender as Visual; vis != null; vis = VisualTreeHelper.GetParent(vis) as Visual)
     {
         if (vis is DataGridRow row)
         {
             // Get sent attribute
             StatRow tar = (StatRow)row.Item;
             // Value cant go below zero
             if (tar.StatValue > 0)
             {
                 //Find target attribute in current character
                 foreach (StatRow r in this.SkillRows)
                 {
                     if (r.StatName == tar.StatName)
                     {
                         r.StatValue--; //Update attribute value
                         break;
                     }
                 }
             }
             break;
         }
     }
 }
Exemple #2
0
 public void MinusAttribute(object sender)
 {
     // Find Sending Row
     for (var vis = sender as Visual; vis != null; vis = VisualTreeHelper.GetParent(vis) as Visual)
     {
         if (vis is DataGridRow row)
         {
             // Get sent attribute
             StatRow tar = (StatRow)row.Item;
             // Value cant go below zero or starting value
             if (tar.StatValue > 0 && tar.StatValue > tar.StartingValue)
             {
                 //Find target attribute in current character
                 foreach (StatRow r in this.AttributeRows)
                 {
                     if (r.StatName == tar.StatName)
                     {
                         r.StatValue--; //Update attribute value
                         this.AttributePointsToDistribute++;
                         break;
                     }
                 }
             }
             break;
         }
     }
 }
        public ActionResult StatisticsContent(int school, int year)
        {
            var existingFees = db.fees
                               .Where(x => x.duedate.Year == year && x.user.classes_students_allocateds
                                      .First(y => y.year == year)
                                      .school_class.schoolid == school)
                               .GroupBy(z => z.fees_type);

            var viewmodel = new StatisticsViewModel()
            {
                statname = string.Format("{0}  {1} Student Fee Statistics", year, db.schools.Single(x => x.id == school).name)
            };

            foreach (var ftype in existingFees.OrderBy(x => x.Key.name))
            {
                var byschoolyears = ftype.GroupBy(x => x.user.classes_students_allocateds.First(y => y.year == year).school_class.school_year);

                var feestat = new FeeRow()
                {
                    feename = ftype.Key == null
                                              ? string.Join(", ", ftype.Select(x => x.name).ToArray())
                                              : ftype.Key.name
                };

                foreach (var byschoolyear in byschoolyears.OrderBy(x => x.Key.name))
                {
                    var stat = new StatRow
                    {
                        schoolyear = byschoolyear.Key.name,
                        paid       = byschoolyear.Count(x => x.status == FeePaymentStatus.PAID.ToDescriptionString()),
                        unpaid     = byschoolyear.Count(x => x.status == FeePaymentStatus.UNPAID.ToDescriptionString() &&
                                                        x.duedate > DateTime.UtcNow),
                        overdue = byschoolyear.Count(x => x.status == FeePaymentStatus.UNPAID.ToDescriptionString() &&
                                                     x.duedate < DateTime.UtcNow)
                    };
                    feestat.entries.Add(stat);
                }

                viewmodel.feetypes.Add(feestat);
            }

            return(View(viewmodel));
        }
 public void PlusAttribute(object sender)
 {
     // Find Sending Row
     for (var vis = sender as Visual; vis != null; vis = VisualTreeHelper.GetParent(vis) as Visual)
     {
         if (vis is DataGridRow row)
         {
             // Get sent attribute
             StatRow tar = (StatRow)row.Item;
             //Find target attribute in current character
             foreach (StatRow r in this.AttributeRows)
             {
                 if (r.StatName == tar.StatName)
                 {
                     r.StatValue++; //Update attribute value
                     break;
                 }
             }
             break;
         }
     }
 }
Exemple #5
0
        public Create(Build bb)
        {
            InitializeComponent();

            SuspendLayout();
            groupBox1.SuspendLayout();

            this.SetDoubleBuffered();
            // when show, check we have stuff

            if (bb == null)
            {
                MessageBox.Show("Build is null", "Create Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                DialogResult = DialogResult.Cancel;
                Close();
                return;
            }

            Build = bb;

            // declare the truthyness of the groups and track them
            setList.Groups[1].Tag = true;
            rsInc = setList.Groups[1];
            setList.Groups[2].Tag = false;
            rsExc = setList.Groups[2];
            setList.Groups[0].Tag = false;
            rsReq = setList.Groups[0];

            if (leadTypes != null)
            {
                leaderTypeBox.Items.AddRange(leadTypes);
            }

            // for each runeset, put it in the list as excluded
            foreach (var rs in Enum.GetNames(typeof(RuneSet)))
            {
                if (rs != "Null" && rs != "Broken" && rs != "Unknown" && rs[0] != '_')
                {
                    ListViewItem li = new ListViewItem(rs);
                    li.Name  = rs;
                    li.Tag   = Enum.Parse(typeof(RuneSet), rs);
                    li.Group = setList.Groups[2];
                    setList.Items.Add(li);
                }
            }

            tBtnSetLess.Tag = 0;
            addAttrsToEvens();

            //Control textBox;

            // make a grid for the monsters base, min/max stats and the scoring

            int x = 0;
            int y = 94;

            int colWidth  = 50;
            int rowHeight = 24;

            var comb = Build.StatAll;

            int genX = 0;

            int dlCheckX = 0;
            int dlBtnX   = 0;

            Program.LineLog.Debug("comb " + comb.Length + " " + string.Join(",", comb));

            #region Statbox
            foreach (var attr in comb)
            {
                statRows[attr] = new StatRow();
                string strStat = attr.ToShortForm();
                x = 4;
                statRows[attr].Label = groupBox1.Controls.MakeControl <Label>(strStat, "Label", x, y, 50, 20, strStat);
                x += colWidth;

                statRows[attr].Base = groupBox1.Controls.MakeControl <Label>(strStat, "Base", x, y, 50, 20, strStat);
                dlCheckX            = x;
                x += colWidth;

                statRows[attr].Bonus = groupBox1.Controls.MakeControl <Label>(strStat, "Bonus", x, y, 50, 20, strStat);
                x += colWidth;

                statRows[attr].Min              = groupBox1.Controls.MakeControl <TextBox>(strStat, "Total", x, y, 40, 20);
                statRows[attr].Min.TextChanged += global_TextChanged;
                statRows[attr].Min.TextChanged += Total_TextChanged;
                dlBtnX = x;
                x     += colWidth;

                statRows[attr].Current = groupBox1.Controls.MakeControl <Label>(strStat, "Current", x, y, 50, 20, strStat);
                x += colWidth;

                statRows[attr].Goal              = groupBox1.Controls.MakeControl <TextBox>(strStat, "Goal", x, y, 40, 20);
                statRows[attr].Goal.TextChanged += global_TextChanged;
                x += colWidth;


                genX = x;

                statRows[attr].Worth              = groupBox1.Controls.MakeControl <TextBox>(strStat, "Worth", x, y, 40, 20);
                statRows[attr].Worth.TextChanged += global_TextChanged;
                x += colWidth;

                statRows[attr].CurrentPts = groupBox1.Controls.MakeControl <Label>(strStat, "CurrentPts", x, y, (int)(50 * 0.8), 20, strStat);
                x += (int)(colWidth * 0.8);

                statRows[attr].Thresh              = groupBox1.Controls.MakeControl <TextBox>(strStat, "Thresh", x, y, 40, 20);
                statRows[attr].Thresh.TextChanged += global_TextChanged;
                x += colWidth;

                statRows[attr].Max              = groupBox1.Controls.MakeControl <TextBox>(strStat, "Max", x, y, 40, 20);
                statRows[attr].Max.TextChanged += global_TextChanged;

                y += rowHeight;
            }
            #endregion

            Build.Mon.GetStats();

            for (int i = 0; i < 4; i++)
            {
                if (Build?.Mon?.SkillsFunction?[i] != null)
                {
                    statRows[Attr.Skill1 + i] = new StatRow();

                    //var ff = build.mon.SkillFunc[i]; build.mon.GetSkillDamage(Attr.AverageDamage, i);
                    string stat = "Skill" + i;
                    x = 4;
                    statRows[Attr.Skill1 + i].Label = groupBox1.Controls.MakeControl <Label>(stat, "Label", x, y, 50, 20, "Skill " + (i + 1));
                    x += colWidth;

                    double aa = Build.Mon.GetSkillDamage(Attr.AverageDamage, i);            //ff(build.mon);
                    double cc = Build.Mon.GetStats().GetSkillDamage(Attr.AverageDamage, i); //ff(build.mon.GetStats());

                    statRows[Attr.Skill1 + i].Base = groupBox1.Controls.MakeControl <Label>(stat, "Base", x, y, 50, 20, aa.ToString());
                    x += colWidth;

                    statRows[Attr.Skill1 + i].Bonus = groupBox1.Controls.MakeControl <Label>(stat, "Bonus", x, y, 50, 20, (cc - aa).ToString());
                    x += colWidth;

                    statRows[Attr.Skill1 + i].Min              = groupBox1.Controls.MakeControl <TextBox>(stat, "Total", x, y, 40, 20);
                    statRows[Attr.Skill1 + i].Min.TextChanged += global_TextChanged;
                    statRows[Attr.Skill1 + i].Min.TextChanged += Total_TextChanged;
                    x += colWidth;

                    statRows[Attr.Skill1 + i].Current = groupBox1.Controls.MakeControl <Label>(stat, "Current", x, y, 50, 20, cc.ToString());
                    x += colWidth;

                    statRows[Attr.Skill1 + i].Goal              = groupBox1.Controls.MakeControl <TextBox>(stat, "Goal", x, y, 40, 20);
                    statRows[Attr.Skill1 + i].Goal.TextChanged += global_TextChanged;
                    x += colWidth;

                    genX = x;

                    statRows[Attr.Skill1 + i].Worth              = groupBox1.Controls.MakeControl <TextBox>(stat, "Worth", x, y, 40, 20);
                    statRows[Attr.Skill1 + i].Worth.TextChanged += global_TextChanged;
                    x += colWidth;

                    statRows[Attr.Skill1 + i].CurrentPts = groupBox1.Controls.MakeControl <Label>(stat, "CurrentPts", x, y, (int)(50 * 0.8), 20, "0");
                    x += (int)(colWidth * 0.8);

                    statRows[Attr.Skill1 + i].Thresh              = groupBox1.Controls.MakeControl <TextBox>(stat, "Thresh", x, y, 40, 20);
                    statRows[Attr.Skill1 + i].Thresh.TextChanged += global_TextChanged;
                    x += colWidth;

                    statRows[Attr.Skill1 + i].Max              = groupBox1.Controls.MakeControl <TextBox>(stat, "Max", x, y, 40, 20);
                    statRows[Attr.Skill1 + i].Max.TextChanged += global_TextChanged;

                    y += rowHeight;
                }
            }

            testBuildButton.Location = new Point(genX, y);

            /*
             * btnDL6star.Location = new Point(dlBtnX, y);
             * checkDL6star.Location = new Point(dlCheckX, y + 2);
             *
             * btnDLawake.Location = new Point(dlBtnX, y + rowHeight);
             * checkDLawake.Location = new Point(dlCheckX, y + rowHeight + 2);
             */

            genTabRuneGrid(ref x, ref y, ref colWidth, ref rowHeight);


            var types = AppDomain.CurrentDomain.GetAssemblies()
                        .SelectMany(asm => asm.GetTypes()
                                    .Where(t => typeof(IBuildStrategyDefinition).IsAssignableFrom(t) && !t.IsAbstract && !t.IsInterface))
                        .Select(t => (IBuildStrategyDefinition)Activator.CreateInstance(t))
                        .OrderBy(t => t.Order)
                        .ToList();

            cbBuildStrat.Items.AddRange(types.ToArray());
            var ind = types.FindIndex(bs => bs.GetType().AssemblyQualifiedName == Build.BuildStrategy);
            cbBuildStrat.SelectedIndex = ind;

            ResumeLayout();
            groupBox1.ResumeLayout();
        }
Exemple #6
0
 private void AddRow(StatRow data)
 {
     dgvData.Rows.Add(data.Num, data.Name, data.Code, data.PlanB, data.PlanP, data.SumB, data.SumP, data.ConcB, data.ConcP);
 }