Пример #1
0
 public void Register(object o)
 {
     if (Objects.FirstOrDefault(t => t.Item1 == o) == null)
     {
         Objects.Add(new Tuple <object, int>(o, Imbuing.GetAttributeName(o)));
     }
 }
Пример #2
0
        // =========== Check if Choosen Attribute Replaces Another =================
        public static int WhatReplacesWhat(int mod, Item item)
        {
            if (Imbuing.GetValueForMod(item, mod) > 0)
            {
                return(Imbuing.GetAttributeName(mod));
            }

            if (item is BaseWeapon)
            {
                BaseWeapon i = item as BaseWeapon;

                // Slayers replace Slayers
                if (mod >= 101 && mod <= 127)
                {
                    if (i.Slayer != SlayerName.None)
                    {
                        return(GetNameForAttribute(i.Slayer));
                    }

                    if (i.Slayer2 != SlayerName.None)
                    {
                        return(GetNameForAttribute(i.Slayer2));
                    }
                }
                // OnHitEffect replace OnHitEffect
                if (mod >= 35 && mod <= 39)
                {
                    if (i.WeaponAttributes.HitMagicArrow > 0)
                    {
                        return(GetNameForAttribute(AosWeaponAttribute.HitMagicArrow));
                    }
                    else if (i.WeaponAttributes.HitHarm > 0)
                    {
                        return(GetNameForAttribute(AosWeaponAttribute.HitHarm));
                    }
                    else if (i.WeaponAttributes.HitFireball > 0)
                    {
                        return(GetNameForAttribute(AosWeaponAttribute.HitFireball));
                    }
                    else if (i.WeaponAttributes.HitLightning > 0)
                    {
                        return(GetNameForAttribute(AosWeaponAttribute.HitLightning));
                    }
                    else if (i.WeaponAttributes.HitDispel > 0)
                    {
                        return(GetNameForAttribute(AosWeaponAttribute.HitDispel));
                    }
                }
                // OnHitArea replace OnHitArea
                if (mod >= 30 && mod <= 34)
                {
                    if (i.WeaponAttributes.HitPhysicalArea > 0)
                    {
                        return(GetNameForAttribute(AosWeaponAttribute.HitPhysicalArea));
                    }
                    else if (i.WeaponAttributes.HitColdArea > 0)
                    {
                        return(GetNameForAttribute(AosWeaponAttribute.HitFireArea));
                    }
                    else if (i.WeaponAttributes.HitFireArea > 0)
                    {
                        return(GetNameForAttribute(AosWeaponAttribute.HitColdArea));
                    }
                    else if (i.WeaponAttributes.HitPoisonArea > 0)
                    {
                        return(GetNameForAttribute(AosWeaponAttribute.HitPoisonArea));
                    }
                    else if (i.WeaponAttributes.HitEnergyArea > 0)
                    {
                        return(GetNameForAttribute(AosWeaponAttribute.HitEnergyArea));
                    }
                }
            }
            if (item is BaseJewel)
            {
                BaseJewel i = item as BaseJewel;

                // SkillGroup1 replace SkillGroup1
                if (mod >= 151 && mod <= 155)
                {
                    if (i.SkillBonuses.GetBonus(0) > 0)
                    {
                        foreach (SkillName sk in Imbuing.PossibleSkills)
                        {
                            if (i.SkillBonuses.GetSkill(0) == sk)
                            {
                                return(GetNameForAttribute(sk));
                            }
                        }
                    }
                }
                // SkillGroup2 replace SkillGroup2
                if (mod >= 156 && mod <= 160)
                {
                    if (i.SkillBonuses.GetBonus(1) > 0)
                    {
                        foreach (SkillName sk in Imbuing.PossibleSkills)
                        {
                            if (i.SkillBonuses.GetSkill(1) == sk)
                            {
                                return(GetNameForAttribute(sk));
                            }
                        }
                    }
                }
                // SkillGroup3 replace SkillGroup3
                if (mod >= 161 && mod <= 166)
                {
                    if (i.SkillBonuses.GetBonus(2) > 0)
                    {
                        foreach (SkillName sk in Imbuing.PossibleSkills)
                        {
                            if (i.SkillBonuses.GetSkill(2) == sk)
                            {
                                return(GetNameForAttribute(sk));
                            }
                        }
                    }
                }
                // SkillGroup4 replace SkillGroup4
                if (mod >= 167 && mod <= 172)
                {
                    if (i.SkillBonuses.GetBonus(3) > 0)
                    {
                        foreach (SkillName sk in Imbuing.PossibleSkills)
                        {
                            if (i.SkillBonuses.GetSkill(3) == sk)
                            {
                                return(GetNameForAttribute(sk));
                            }
                        }
                    }
                }
                // SkillGroup5 replace SkillGroup5
                if (mod >= 173 && mod <= 178)
                {
                    if (i.SkillBonuses.GetBonus(4) > 0)
                    {
                        foreach (SkillName sk in Imbuing.PossibleSkills)
                        {
                            if (i.SkillBonuses.GetSkill(4) == sk)
                            {
                                return(GetNameForAttribute(sk));
                            }
                        }
                    }
                }
            }

            return(-1);
        }