Exemplo n.º 1
0
        private void selfGod_SelectedIndexChanged(object sender, EventArgs e)
        {
            GodStat god = (GodStat)selfGod.SelectedItem;
            calculations.SelfGod = god;
            if(god.PowerType == GodType.Physical) {
                selfPhysical.Checked = true;
            } else {
                selfMagical.Checked = true;
            }

            ItemStat item1 = (ItemStat)selfItem1.SelectedItem;
            ItemStat item2 = (ItemStat)selfItem2.SelectedItem;
            ItemStat item3 = (ItemStat)selfItem3.SelectedItem;
            ItemStat item4 = (ItemStat)selfItem4.SelectedItem;
            ItemStat item5 = (ItemStat)selfItem5.SelectedItem;
            ItemStat item6 = (ItemStat)selfItem6.SelectedItem;

            selfItem1.Items.Clear();
            selfItem2.Items.Clear();
            selfItem3.Items.Clear();
            selfItem4.Items.Clear();
            selfItem5.Items.Clear();
            selfItem6.Items.Clear();

            foreach(ItemStat item in items) {
                if(item.Name == "Empty") emptyItem = item;

                if(item.ItemType != ItemType.Both && item.ItemType.ToString() != god.PowerType.ToString()) continue;
                if(god.Name != "Ratatoskr" && (item.Name == "Opal Acorn" || item.Name == "Sapphire Acorn")) continue;

                selfItem1.Items.Add(item);
                selfItem2.Items.Add(item);
                selfItem3.Items.Add(item);
                selfItem4.Items.Add(item);
                selfItem5.Items.Add(item);
                selfItem6.Items.Add(item);

                if(item == item1) selfItem1.SelectedItem = item;
                if(item == item2) selfItem2.SelectedItem = item;
                if(item == item3) selfItem3.SelectedItem = item;
                if(item == item4) selfItem4.SelectedItem = item;
                if(item == item5) selfItem5.SelectedItem = item;
                if(item == item6) selfItem6.SelectedItem = item;
            }

            if(selfItem1.SelectedItem == null) selfItem1.SelectedItem = emptyItem;
            if(selfItem2.SelectedItem == null) selfItem2.SelectedItem = emptyItem;
            if(selfItem3.SelectedItem == null) selfItem3.SelectedItem = emptyItem;
            if(selfItem4.SelectedItem == null) selfItem4.SelectedItem = emptyItem;
            if(selfItem5.SelectedItem == null) selfItem5.SelectedItem = emptyItem;
            if(selfItem6.SelectedItem == null) selfItem6.SelectedItem = emptyItem;

            selfSteroid1Drop.Items.Clear();
            selfSteroid1Drop.Invalidate();

            selfSteroid2Drop.Items.Clear();
            selfSteroid2Drop.Invalidate();

            selfSteroid1Drop.Enabled = god.FirstSteroid != null;
            if(selfSteroid1Drop.Enabled) {
                if(!String.IsNullOrEmpty(god.FirstSteroid.Enabled)) selfSteroid1Drop.Items.Add(god.FirstSteroid.Enabled);
                if(!String.IsNullOrEmpty(god.FirstSteroid.Disabled)) selfSteroid1Drop.Items.Add(god.FirstSteroid.Disabled);

                selfSteroid1Drop.SelectedIndex = 0;
            } else {
                calculations.SelfSteroid1 = "";
            }

            selfSteroid2Drop.Enabled = god.SecondSteroid != null;
            if(selfSteroid2Drop.Enabled) {
                if(!String.IsNullOrEmpty(god.SecondSteroid.Enabled)) selfSteroid2Drop.Items.Add(god.SecondSteroid.Enabled);
                if(!String.IsNullOrEmpty(god.SecondSteroid.Disabled)) selfSteroid2Drop.Items.Add(god.SecondSteroid.Disabled);

                selfSteroid2Drop.SelectedIndex = 0;
            } else {
                calculations.SelfSteroid2 = "";
            }

            selfSteroid1Stacks.Enabled = !String.IsNullOrEmpty(god.Extra);
            selfSteroid1StacksLabel.Text = selfSteroid1Stacks.Enabled ? god.Extra : "Unused";

            selfSteroid2Stacks.Enabled = god.Name == "Bakasura" || god.Name == "Ah Puch";
            if(selfSteroid2Stacks.Enabled) {
                selfSteroid2StacksLabel.Text = god.Name == "Bakasura" ? "Insatiable Hunger Stacks? 0-3" : "Antiheal Stacks? 0-10";
            } else {
                selfSteroid2StacksLabel.Text = "Unused";
            }

            selfBellonaStance.Enabled = god.Name == "Bellona";

            CalculateSelf();
        }
Exemplo n.º 2
0
        private void targetGod_SelectedIndexChanged(object sender, EventArgs e)
        {
            GodStat god = (GodStat)targetGod.SelectedItem;
            calculations.TargetGod = god;
            if(god.PowerType == GodType.Physical) {
                targetPhysical.Checked = true;
            } else {
                targetMagical.Checked = true;
            }

            ItemStat item1 = (ItemStat)targetItem1.SelectedItem;
            ItemStat item2 = (ItemStat)targetItem2.SelectedItem;
            ItemStat item3 = (ItemStat)targetItem3.SelectedItem;
            ItemStat item4 = (ItemStat)targetItem4.SelectedItem;
            ItemStat item5 = (ItemStat)targetItem5.SelectedItem;
            ItemStat item6 = (ItemStat)targetItem6.SelectedItem;

            targetItem1.Items.Clear();
            targetItem2.Items.Clear();
            targetItem3.Items.Clear();
            targetItem4.Items.Clear();
            targetItem5.Items.Clear();
            targetItem6.Items.Clear();

            foreach(ItemStat item in items) {
                if(item.Name == "Empty") emptyItem = item;

                if(item.ItemType != ItemType.Both && item.ItemType.ToString() != god.PowerType.ToString()) continue;
                if(god.Name != "Ratatoskr" && (item.Name == "Opal Acorn" || item.Name == "Sapphire Acorn")) continue;

                targetItem1.Items.Add(item);
                targetItem2.Items.Add(item);
                targetItem3.Items.Add(item);
                targetItem4.Items.Add(item);
                targetItem5.Items.Add(item);
                targetItem6.Items.Add(item);

                if(item == item1) targetItem1.SelectedItem = item;
                if(item == item2) targetItem2.SelectedItem = item;
                if(item == item3) targetItem3.SelectedItem = item;
                if(item == item4) targetItem4.SelectedItem = item;
                if(item == item5) targetItem5.SelectedItem = item;
                if(item == item6) targetItem6.SelectedItem = item;
            }

            if(targetItem1.SelectedItem == null) targetItem1.SelectedItem = emptyItem;
            if(targetItem2.SelectedItem == null) targetItem2.SelectedItem = emptyItem;
            if(targetItem3.SelectedItem == null) targetItem3.SelectedItem = emptyItem;
            if(targetItem4.SelectedItem == null) targetItem4.SelectedItem = emptyItem;
            if(targetItem5.SelectedItem == null) targetItem5.SelectedItem = emptyItem;
            if(targetItem6.SelectedItem == null) targetItem6.SelectedItem = emptyItem;

            CalculateTarget();
        }
Exemplo n.º 3
0
        public static List<ItemStat> ParseItems(string file)
        {
            List<ItemStat> items = new List<ItemStat>();

            using(StringReader reader = new StringReader(client.DownloadString(file))) {
                using(TextFieldParser parser = new TextFieldParser(reader)) {
                    parser.TextFieldType = FieldType.Delimited;
                    parser.SetDelimiters(",");
                    parser.ReadLine();

                    while(!parser.EndOfData) {
                        int i = 0;
                        string[] fields = parser.ReadFields();
                        if(fields == null) throw new ArgumentException("not a valid file", "file");

                        ItemStat item = new ItemStat();
                        item.Name = fields[i++];

                        if(item.Name == "") continue;

                        item.Cost = Double.Parse(fields[i++], CultureInfo.InvariantCulture);

                        string itemtype = fields[i++];
                        item.ItemType = (ItemType)Enum.Parse(typeof(ItemType), itemtype == "" ? "Both" : itemtype, true);
                        item.Health = Double.Parse("0" + fields[i++], CultureInfo.InvariantCulture);
                        item.PhysicalProtection = Double.Parse("0" + fields[i++], CultureInfo.InvariantCulture);
                        item.MagicalProtection = Double.Parse("0" + fields[i++], CultureInfo.InvariantCulture);
                        item.Power = Double.Parse("0" + fields[i++], CultureInfo.InvariantCulture);
                        item.AttackSpeed = Double.Parse("0" + fields[i++], CultureInfo.InvariantCulture);
                        item.PercentPenetration = Double.Parse("0" + fields[i++], CultureInfo.InvariantCulture);
                        item.FlatPenetration = Double.Parse("0" + fields[i++], CultureInfo.InvariantCulture);
                        item.CritChance = Double.Parse("0" + fields[i++], CultureInfo.InvariantCulture);
                        item.CooldownReduction = Double.Parse("0" + fields[i++], CultureInfo.InvariantCulture);
                        item.Lifesteal = Double.Parse("0" + fields[i++], CultureInfo.InvariantCulture);
                        item.Mana = Double.Parse("0" + fields[i++], CultureInfo.InvariantCulture);
                        item.Passive = fields[i++];
                        item.Hp5 = Double.Parse("0" + fields[i++], CultureInfo.InvariantCulture);
                        item.MoveSpeed = Double.Parse("0" + fields[i], CultureInfo.InvariantCulture);

                        items.Add(item);
                    }
                }
            }

            return items;
        }