public static SpecialityType FromProfileProperty(ProfilePropertyType type)
        {
            int val = (int)type;

            if (val >= 4 && val <= 10)
            {
                return((SpecialityType)(val - 4));
            }

            return(SpecialityType.Invalid);
        }
Пример #2
0
 public int CreateProfileProperty(string propertyName, ProfilePropertyType type, out string Response)
 {
     string responseString = "";
     int output;
     using (TransactionScope scope = new TransactionScope())
     {
         output = UserRepository.CreateProfileProperty(propertyName, type, out responseString);
         scope.Complete();
     }
     Response = responseString;
     return output;
 }
        //
        private static Bitmap GetImageForPropertyType(ProfilePropertyType propertyType, int index, bool forceAllCreatures)
        {
            if (index >= 0)
            {
                if (propertyType == ProfilePropertyType.Creature)
                {
                    int realIndex = CreatureManager.OnlyActiveCreatures[index].CreatureIndex;
                    return(CreatureManager.GetImage(Heroes3Master.Master, realIndex));
                }
                if (propertyType == ProfilePropertyType.SecondarySkill)
                {
                    return(SecondarySkill.AllSkills[index / 3].GetImage(Heroes3Master.Master, 1 + index % 3));
                }

                if (propertyType == ProfilePropertyType.Spell)
                {
                    return(Spell.AllSpells[index].GetImage(Heroes3Master.Master));
                }

                if (propertyType == ProfilePropertyType.SpecCreature || propertyType == ProfilePropertyType.SpecCreatureStatic)
                {
                    return(CreatureManager.GetImage(Heroes3Master.Master, CreatureManager.IndexesOfFirstLevelCreatures[index]));
                }

                if (propertyType == ProfilePropertyType.SpecCreatureUpgrade)
                {
                    if (!forceAllCreatures)
                    {
                        return(CreatureManager.GetImage(Heroes3Master.Master, CreatureManager.IndexesOfFirstLevelCreatures[index]));
                    }

                    int realIndex = CreatureManager.OnlyActiveCreatures[index].CreatureIndex;
                    return(CreatureManager.GetImage(Heroes3Master.Master, realIndex));
                }

                if (propertyType == ProfilePropertyType.SpecSpell)
                {
                    return(Spell.GetSpellByIndex(Spell.SpecSpellIndexes[index]).GetImage(Heroes3Master.Master));
                }

                if (propertyType == ProfilePropertyType.SpecSecondarySkill)
                {
                    return(SecondarySkill.GetImage(Heroes3Master.Master, SecondarySkill.IndexesOfAllSpecSkills[index], 1));
                }

                if (propertyType == ProfilePropertyType.SpecResource)
                {
                    return(Resource.GetImage(Heroes3Master.Master, index));
                }
            }
            return(null);
        }
        private static Bitmap GetBackgroundImageForPropertyType(ProfilePropertyType propertyType, bool forceAllCreatures)
        {
            if (Heroes3Master.Master != null)
            {
                if (propertyType == ProfilePropertyType.Creature)
                {
                    return(new Bitmap(CreatureManager.GetAllCreaturesBitmapParallel(Heroes3Master.Master)));
                }

                if (propertyType == ProfilePropertyType.SecondarySkill)
                {
                    return(new Bitmap(SecondarySkill.GetSkillTree(Heroes3Master.Master)));
                }

                if (propertyType == ProfilePropertyType.Spell)
                {
                    return(new Bitmap(Spell.GetAllSpells(Heroes3Master.Master)));
                }

                if (propertyType == ProfilePropertyType.SpecCreature || propertyType == ProfilePropertyType.SpecCreatureStatic)
                {
                    return(CreatureManager.GetAllBasicCreatures(Heroes3Master.Master));
                }
                if (propertyType == ProfilePropertyType.SpecCreatureUpgrade)
                {
                    if (forceAllCreatures)
                    {
                        return(new Bitmap(CreatureManager.GetAllCreaturesBitmapParallel(Heroes3Master.Master)));
                    }
                    return(CreatureManager.GetAllBasicCreatures(Heroes3Master.Master));
                }
                if (propertyType == ProfilePropertyType.SpecSecondarySkill)
                {
                    return(SecondarySkill.GetSkillsForSpeciality(Heroes3Master.Master));
                }

                if (propertyType == ProfilePropertyType.SpecSpell)
                {
                    return(Spell.GetAvailableSpellsForSpeciality(Heroes3Master.Master));
                }

                if (propertyType == ProfilePropertyType.SpecResource)
                {
                    return(Resource.GetAllResources(Heroes3Master.Master));
                }
            }
            return(null);
        }
 private static void GetDimensionsForPropertyType(ProfilePropertyType propertyType, out int cellWidth, out int cellHeight, out int itemsPerRow)
 {
     if (propertyType == ProfilePropertyType.Creature || propertyType == ProfilePropertyType.SpecCreature || propertyType == ProfilePropertyType.SpecCreatureStatic || propertyType == ProfilePropertyType.SpecCreatureUpgrade)
     {
         cellWidth   = 59;
         cellHeight  = 65;
         itemsPerRow = 14;
     }
     else if (propertyType == ProfilePropertyType.SecondarySkill)
     {
         cellWidth   = 45;
         cellHeight  = 45;
         itemsPerRow = 12;
     }
     else if (propertyType == ProfilePropertyType.SpecSecondarySkill)
     {
         cellWidth   = 45;
         cellHeight  = 45;
         itemsPerRow = 7;
     }
     else if (propertyType == ProfilePropertyType.Spell)
     {
         cellWidth   = 59;
         cellHeight  = 65;
         itemsPerRow = 10;
     }
     else if (propertyType == ProfilePropertyType.SpecSpell)
     {
         cellWidth   = 59;
         cellHeight  = 65;
         itemsPerRow = 6;
     }
     else if (propertyType == ProfilePropertyType.SpecResource)
     {
         cellWidth   = 83;
         cellHeight  = 93;
         itemsPerRow = 7;
     }
     else
     {
         cellWidth   = 1;
         cellHeight  = 1;
         itemsPerRow = 1;
     }
 }
Пример #6
0
        private void HpcHeroProfile_PropertyClicked(int heroIndex, ProfilePropertyType type, int relativeIndex, int currentValue)
        {
            if (type == ProfilePropertyType.HeroClass)
            {
                heroClassDataControl.HeroClass = HeroClass.AllHeroClasses[heroMainDataControl.SelectedHeroIndex / 8];
                tabsMain.SelectedTab           = tabHeroClass;
                heroClassDataControl.GoToPrimarySkills();
            }
            else
            {
                heroPropertyForm.HeroIndex     = heroIndex;
                heroPropertyForm.PropertyType  = type;
                heroPropertyForm.CurrentIndex  = relativeIndex;
                heroPropertyForm.SelectedValue = currentValue;

                heroPropertyForm.ShowDialog(this);
            }
        }
        private void PictureBox_MouseClick(object sender, MouseEventArgs e)
        {
            if (Hero != null && HeroIndex >= 0 && lastRectIndex >= 0 && PropertyClicked != null)
            {
                if (e.Button == MouseButtons.Left)
                {
                    ProfilePropertyType type = ProfilePropertyType.Other;
                    int index        = 0;
                    int currentValue = 0;

                    if (lastRectIndex == 0)
                    {
                        //type = "Portrait";
                        return;
                    }
                    else if (lastRectIndex == 1)
                    {
                        //type = "Name";
                        return;
                    }
                    else if (lastRectIndex == 2)
                    {
                        type         = Speciality.ToProfilePropertyType(Hero.Spec.Type);
                        currentValue = Hero.Spec.ObjectId;
                    }
                    else if (lastRectIndex <= 4)
                    {
                        type         = ProfilePropertyType.SecondarySkill;
                        index        = lastRectIndex - 3;
                        currentValue = (index == 0 ? (3 * Hero.FirstSkillIndex + Hero.FirstSkillLevel) : (3 * Hero.SecondSkillIndex + Hero.SecondSkillLevel)) - 1;
                    }
                    else if (lastRectIndex <= 7)
                    {
                        type         = ProfilePropertyType.Creature;
                        index        = lastRectIndex - 5;
                        currentValue = index == 0 ? Hero.Unit1Index : (index == 1 ? Hero.Unit2Index : Hero.Unit3Index);
                    }
                    else if (lastRectIndex == 8)
                    {
                        type         = ProfilePropertyType.Spell;
                        currentValue = Hero.SpellIndex;
                    }
                    else if (lastRectIndex == 9)
                    {
                        type = ProfilePropertyType.HeroClass;
                    }

                    PropertyClicked(Hero.Index, type, index, currentValue);
                }
                else if (e.Button == MouseButtons.Right)
                {
                    if (lastRectIndex == 0)
                    {
                    }
                    else if (lastRectIndex == 1)
                    {
                    }
                    else if (lastRectIndex == 2)
                    {
                    }
                    else if (lastRectIndex <= 4)
                    {
                        if (lastRectIndex == 3)
                        {
                            if (Hero.SecondSkillIndex != -1)
                            {
                                Hero.FirstSkillIndex  = Hero.SecondSkillIndex;
                                Hero.FirstSkillLevel  = Hero.SecondSkillLevel;
                                Hero.SecondSkillIndex = -1;
                            }
                            else
                            {
                                Hero.FirstSkillIndex = -1;
                            }
                        }
                        else
                        {
                            Hero.SecondSkillIndex = -1;
                        }
                        LoadHero(Hero.Index, Heroes3Master.Master);
                    }
                    else if (lastRectIndex <= 7)
                    {
                        /*  type = "Creature";
                         * index = lastRectIndex - 5;
                         * currentValue = index == 0 ? Hero.Unit1Index : (index == 1 ? Hero.Unit2Index : Hero.Unit3Index);*/
                    }
                    else if (lastRectIndex == 8)
                    {
                        Hero.SpellBook  = 0;
                        Hero.SpellIndex = -1;
                        LoadHero(Hero.Index, Heroes3Master.Master);
                    }
                }
            }
        }
Пример #8
0
        private void HeroPropertyForm_ItemSelected(int selIndex, int arg1, int arg2, int arg3)
        {
            ProfilePropertyType type = heroPropertyForm.PropertyType;
            var hpcHeroProfile       = heroMainDataControl.HeroProfileControl;
            var hero = hpcHeroProfile.Hero;

            if (type == ProfilePropertyType.Creature)
            {
                int realIndex = CreatureManager.OnlyActiveCreatures[selIndex].CreatureIndex;
                hero.HasChanged = true;
                switch (heroPropertyForm.CurrentIndex)
                {
                case 0: hero.Unit1Index = realIndex; break;

                case 1: hero.Unit2Index = realIndex; break;

                case 2: hero.Unit3Index = realIndex; break;
                }
                hpcHeroProfile.LoadHero(hpcHeroProfile.HeroIndex, Heroes3Master.Master);
            }
            else if (type == ProfilePropertyType.SecondarySkill)
            {
                int skill = selIndex / 3;
                int level = 1 + selIndex % 3;

                hero.HasChanged = true;
                if (heroPropertyForm.CurrentIndex == 0)
                {
                    hero.FirstSkillIndex = skill;
                    hero.FirstSkillLevel = level;
                }
                else
                {
                    hero.SecondSkillIndex = skill;
                    hero.SecondSkillLevel = level;
                }
                hpcHeroProfile.LoadHero(hpcHeroProfile.HeroIndex, Heroes3Master.Master);
            }
            else if (type == ProfilePropertyType.Spell)
            {
                hero.HasChanged = true;
                hero.SpellBook  = 1;
                hero.SpellIndex = selIndex;
                hpcHeroProfile.LoadHero(hpcHeroProfile.HeroIndex, Heroes3Master.Master);
            }
            else
            {
                var specType = Speciality.FromProfileProperty(type);
                if (specType != SpecialityType.Invalid)
                {
                    Speciality.UpdateSpecialityData(specType, hero.Index, selIndex, arg1, arg2, arg3);
                    hero.HasChanged = true;

                    var hs = HeroesManager.AllHeroes[hero.Index];
                    SpecialityBuilder.TryUpdateSpecialityImageAndText(Heroes3Master.Master, hero);
                    heroMainDataControl.Speciality = hs.Speciality;

                    HeroesManager.AnyChanges = true;
                    hpcHeroProfile.LoadHero(hpcHeroProfile.HeroIndex, Heroes3Master.Master);
                }
                //hpcHeroProfile
            }
        }
Пример #9
0
 public int CreateProfileProperty(string propertyName, ProfilePropertyType type, out string response)
 {
     throw new NotImplementedException();
 }