Exemplo n.º 1
0
        private void load_hero_build(HabProperties hpsHero)
        {
            // set level
            Current.unit.Level = hpsHero.GetIntValue("Level");

            // set stats
            Current.unit.set_naked_attr(PrimAttrType.Str, hpsHero.GetIntValue("Str"));
            Current.unit.set_naked_attr(PrimAttrType.Agi, hpsHero.GetIntValue("Agi"));
            Current.unit.set_naked_attr(PrimAttrType.Int, hpsHero.GetIntValue("Int"));

            // get aquisition order
            HabPropertiesCollection hpcAcquisition = hpsHero.GetHpcValue("acquisition");

            // items
            List <string> items = hpsHero.GetStringListValue("items");

            // abilities
            List <string> abilities = hpsHero.GetStringListValue("abilities");

            // process acquisition order

            // make sure triggers will not screw things up
            Current.unit.Inventory.DisableMessages();

            for (int i = 0; i < hpcAcquisition.Count; i++)
            {
                HabProperties hpsAcquired = hpcAcquisition[i + ""];

                string codeID = hpsAcquired.GetStringValue("codeID");

                if (items.Contains(codeID))
                {
                    Current.unit.Inventory.put_item(new item(codeID), hpsAcquired.GetIntValue("slot"));
                }
                else
                if (abilities.Contains(codeID))
                {
                    DBABILITY ability = Current.unit.heroAbilities.GetByAlias(codeID);

                    int level = hpsAcquired.GetIntValue("level");
                    for (int j = 1; j <= level; j++)
                    {
                        ability.Level = j;
                    }
                }
            }

            // restore original state
            Current.unit.Inventory.EnableMessages();

            UpdateHeroLeveling();
        }
Exemplo n.º 2
0
        private void creepsCmbB_SelectedIndexChanged(object sender, EventArgs e)
        {
            HabProperties hpsProfile = (sender as ComboBox).SelectedItem as HabProperties;

            if (hpsProfile != null)
            {
                creepArtPanel.BackgroundImage = DHRC.GetImage(hpsProfile.GetStringValue("Art"));

                HabProperties hpsBalance = hpcBalance[hpsProfile.name];

                int dice  = hpsBalance.GetIntValue("bountydice");
                int sides = hpsBalance.GetIntValue("bountysides");
                int plus  = hpsBalance.GetIntValue("bountyplus");

                creepGoldTextBox.Text  = "" + (dice + plus) + " - " + (dice * sides + plus);
                creepLevelTextBox.Text = hpsBalance.GetStringValue("level");
            }
            else
            {
                creepArtPanel.BackgroundImage = null;
                creepGoldTextBox.Text         = "";
                creepLevelTextBox.Text        = "";
            }
        }
Exemplo n.º 3
0
            internal DBUPGRADE(HabProperties hps)
            {
                hpsInitialData = hps.GetCopy();

                ////////////////////////
                //  get alias
                ////////////////////////

                this.name = hps.name;

                ////////////////////////
                //  get max level
                ////////////////////////

                this.max_level = hpsInitialData.GetIntValue("maxlevel");

                ////////////////////////
                //  get effects
                ////////////////////////

                effects = new List <DBEFFECT>(4);

                string effectID;

                for (int i = 1; i <= 4; i++)
                {
                    if ((effectID = hps.GetStringValue("effect" + i)) != "_")
                    {
                        DBEFFECT e = DBEFFECT.InitProperEffect(effectID,
                                                               hps.GetDoubleValue("base" + i),
                                                               hps.GetDoubleValue("mod" + i));

                        if (e != null)
                        {
                            effects.Add(e);
                        }
                    }
                }
            }
Exemplo n.º 4
0
        internal int GetGoldCost(HabProperties hpsItem)
        {
            if (ComplexItemCosts == null)
            {
                ComplexItemCosts = new Dictionary <string, int>(ComplexItems.Count);
            }

            int result = 0;

            if (ComplexItemCosts.TryGetValue(hpsItem.name, out result))
            {
                return(result);
            }

            List <List <string> > componentsList;

            if (!ComplexItems.TryGetValue(hpsItem.name, out componentsList))
            {
                return(DHLOOKUP.hpcItemData[hpsItem.name].GetIntValue("goldcost"));
            }

            List <string> components = componentsList[0];

            foreach (string codeID in components)
            {
                string originalCodeID;
                if (!MorphingItems.TryGetValue(codeID, out originalCodeID))
                {
                    originalCodeID = codeID;
                }

                HabProperties hpsComponent = DHLOOKUP.hpcItemData[originalCodeID];
                result += hpsComponent.GetIntValue("GoldCost");
            }

            ComplexItemCosts.Add(hpsItem.name, result);

            return(result);
        }
Exemplo n.º 5
0
        private void load_hero_build(HabProperties hpsHero)
        {
            // set level
            Current.unit.Level = hpsHero.GetIntValue("Level");

            // set stats
            Current.unit.set_naked_attr(PrimAttrType.Str, hpsHero.GetIntValue("Str"));
            Current.unit.set_naked_attr(PrimAttrType.Agi, hpsHero.GetIntValue("Agi"));
            Current.unit.set_naked_attr(PrimAttrType.Int, hpsHero.GetIntValue("Int"));

            // get aquisition order
            HabPropertiesCollection hpcAcquisition = hpsHero.GetHpcValue("acquisition");

            // items
            List<string> items = hpsHero.GetStringListValue("items");

            // abilities
            List<string> abilities = hpsHero.GetStringListValue("abilities");

            // process acquisition order

            // make sure triggers will not screw things up
            Current.unit.Inventory.DisableMessages();

            for (int i = 0; i < hpcAcquisition.Count; i++)
            {
                HabProperties hpsAcquired = hpcAcquisition[i + ""];

                string codeID = hpsAcquired.GetStringValue("codeID");

                if (items.Contains(codeID))
                    Current.unit.Inventory.put_item(new item(codeID), hpsAcquired.GetIntValue("slot"));
                else
                    if (abilities.Contains(codeID))
                    {
                        DBABILITY ability = Current.unit.heroAbilities.GetByAlias(codeID);

                        int level = hpsAcquired.GetIntValue("level");
                        for (int j = 1; j <= level; j++)
                            ability.Level = j;
                    }
            }

            // restore original state
            Current.unit.Inventory.EnableMessages();

            UpdateHeroLeveling();
        }
Exemplo n.º 6
0
        internal int GetGoldCost(item item)
        {
            string originalCodeID;

            if (ComplexItems == null)
            {
                if (MorphingItems.TryGetValue(item.codeID, out originalCodeID))
                {
                    if (DHHELPER.IsNewVersionItem(originalCodeID))
                    {
                        return(DHMpqDatabase.UnitSlkDatabase["UnitBalance"][originalCodeID].GetIntValue("GoldCost"));
                    }
                    else
                    {
                        return(DHLOOKUP.hpcItemData[originalCodeID].GetIntValue("GoldCost"));
                    }
                }
                else
                {
                    return(item.goldCost);
                }
            }

            if (ComplexItemCosts == null)
            {
                ComplexItemCosts = new Dictionary <string, int>(ComplexItems.Count);
            }

            int result = 0;

            if (ComplexItemCosts.TryGetValue(item.codeID, out result))
            {
                return(result);
            }

            List <List <string> > componentsList;

            if (!ComplexItems.TryGetValue(item.codeID, out componentsList))
            {
                if (MorphingItems.TryGetValue(item.codeID, out originalCodeID))
                {
                    return(DHLOOKUP.hpcItemData[originalCodeID].GetIntValue("GoldCost"));
                }
                else
                {
                    return(item.goldCost);
                }
            }

            List <string> components = componentsList[0];

            foreach (string codeID in components)
            {
                if (!MorphingItems.TryGetValue(codeID, out originalCodeID))
                {
                    originalCodeID = codeID;
                }

                HabProperties hpsComponent = DHLOOKUP.hpcItemData[originalCodeID];
                result += hpsComponent.GetIntValue("GoldCost");
            }

            ComplexItemCosts.Add(item.codeID, result);

            return(result);
        }