Example #1
0
        public override void OnAttach()
        {
            Configured c = new Configured();

            base.OnAttach();
            if (AttachedTo is PlayerMobile)
            {
                XMLPlayerLevelAtt xmlplayer = (XMLPlayerLevelAtt)XmlAttach.FindAttachment(((PlayerMobile)AttachedTo), typeof(XMLPlayerLevelAtt));
                if (xmlplayer == null)
                {
                    return;
                }
                else
                {
                    if (xmlplayer.Levell < c.WhatLevelToDelete)
                    {
                        ((PlayerMobile)AttachedTo).AddStatMod(new StatMod(StatType.Dex, "XmlDex" + Name, c.StatBonusDex, TimeSpan.Zero));
                        ((PlayerMobile)AttachedTo).AddStatMod(new StatMod(StatType.Str, "XmlStr" + Name, c.StatBonusStr, TimeSpan.Zero));
                        ((PlayerMobile)AttachedTo).AddStatMod(new StatMod(StatType.Int, "XmlInt" + Name, c.StatBonusInt, TimeSpan.Zero));
                        InvalidateParentProperties();
                    }
                    else
                    {
                        Delete();
                    }
                }
            }
            else
            {
                Delete();
            }
        }
        public override bool CanEquip(Mobile from)
        {
            bool allowequip = true;

            if (from is PlayerMobile)
            {
                XMLPlayerLevelAtt xmlplayer = (XMLPlayerLevelAtt)XmlAttach.FindAttachment(from, typeof(XMLPlayerLevelAtt));

                if (xmlplayer == null)
                {
                    return(false);
                }
                /* If return false, the weapon cannot be equiped */

                if (this.AttachedTo is BaseArmor)
                {
                    ((BaseArmor)this.AttachedTo).InvalidateProperties();
                }

                if (this.AttachedTo is BaseWeapon)
                {
                    ((BaseWeapon)this.AttachedTo).InvalidateProperties();

                    var Level1Higher = TypeLevel1Higher(((BaseWeapon)this.AttachedTo).GetType());
                    if (Level1Higher)
                    {
                        if (xmlplayer.Levell >= 1)
                        {
                            return(allowequip);
                        }
                        else
                        {
                            from.SendMessage("You must be at level 1 or higher to use this!");
                            return(false);
                        }
                    }
                    var Level20Higher = TypeLevel20Higher(((BaseWeapon)this.AttachedTo).GetType());
                    if (Level20Higher)
                    {
                        if (xmlplayer.Levell >= 20)
                        {
                            return(allowequip);
                        }
                        else
                        {
                            from.SendMessage("You must be at level 20 or higher to use this!");
                            return(false);
                        }
                    }
                    var Level40Higher = TypeLevel40Higher(((BaseWeapon)this.AttachedTo).GetType());
                    if (Level40Higher)
                    {
                        if (xmlplayer.Levell >= 40)
                        {
                            return(allowequip);
                        }
                        else
                        {
                            from.SendMessage("You must be at level 40 or higher to use this!");
                            return(false);
                        }
                    }
                    var Level60Higher = TypeLevel60Higher(((BaseWeapon)this.AttachedTo).GetType());
                    if (Level60Higher)
                    {
                        if (xmlplayer.Levell >= 60)
                        {
                            return(allowequip);
                        }
                        else
                        {
                            from.SendMessage("You must be at level 60 or higher to use this!");
                            return(false);
                        }
                    }
                    var Level80Higher = TypeLevel80Higher(((BaseWeapon)this.AttachedTo).GetType());
                    if (Level80Higher)
                    {
                        if (xmlplayer.Levell >= 80)
                        {
                            return(allowequip);
                        }
                        else
                        {
                            from.SendMessage("You must be at level 80 or higher to use this!");
                            return(false);
                        }
                    }
                    var Level100Higher = TypeLevel100Higher(((BaseWeapon)this.AttachedTo).GetType());
                    if (Level100Higher)
                    {
                        if (xmlplayer.Levell >= 100)
                        {
                            return(allowequip);
                        }
                        else
                        {
                            from.SendMessage("You must be at level 100 or higher to use this!");
                            return(false);
                        }
                    }
                }
            }

            return(allowequip);
        }
        public override void OnMovement(MovementEventArgs e)
        {
            base.OnMovement(e);
            ConfiguredPetXML  cp        = new ConfiguredPetXML();
            XMLPetLevelAtt    petxml    = (XMLPetLevelAtt)XmlAttach.FindAttachment(((BaseCreature)this.AttachedTo), typeof(XMLPetLevelAtt));
            Mobile            master    = ((BaseCreature)this.AttachedTo).ControlMaster;
            XMLPlayerLevelAtt xmlplayer = (XMLPlayerLevelAtt)XmlAttach.FindAttachment(master, typeof(XMLPlayerLevelAtt));

            if (e.Mobile == null)
            {
                return;
            }

            if (petxml == null)
            {
                return;
            }

            if (AuraStatBoost == true)
            {
                if (cp.AuraStatBoost == false)
                {
                    return;
                }
                if (petxml.Levell < cp.AuraStatBoostReq)
                {
                    return;
                }
                if (xmlplayer == null)
                {
                    return;
                }
                BonusStatAtt10  aurastatboost10  = (BonusStatAtt10)XmlAttach.FindAttachment(master, typeof(BonusStatAtt10));
                BonusStatAtt20  aurastatboost20  = (BonusStatAtt20)XmlAttach.FindAttachment(master, typeof(BonusStatAtt20));
                BonusStatAtt30  aurastatboost30  = (BonusStatAtt30)XmlAttach.FindAttachment(master, typeof(BonusStatAtt30));
                BonusStatAtt40  aurastatboost40  = (BonusStatAtt40)XmlAttach.FindAttachment(master, typeof(BonusStatAtt40));
                BonusStatAtt50  aurastatboost50  = (BonusStatAtt50)XmlAttach.FindAttachment(master, typeof(BonusStatAtt50));
                BonusStatAtt60  aurastatboost60  = (BonusStatAtt60)XmlAttach.FindAttachment(master, typeof(BonusStatAtt60));
                BonusStatAtt70  aurastatboost70  = (BonusStatAtt70)XmlAttach.FindAttachment(master, typeof(BonusStatAtt70));
                BonusStatAtt80  aurastatboost80  = (BonusStatAtt80)XmlAttach.FindAttachment(master, typeof(BonusStatAtt80));
                BonusStatAtt90  aurastatboost90  = (BonusStatAtt90)XmlAttach.FindAttachment(master, typeof(BonusStatAtt90));
                BonusStatAtt100 aurastatboost100 = (BonusStatAtt100)XmlAttach.FindAttachment(master, typeof(BonusStatAtt100));
                BonusStatAtt140 aurastatboost140 = (BonusStatAtt140)XmlAttach.FindAttachment(master, typeof(BonusStatAtt140));
                BonusStatAtt160 aurastatboost160 = (BonusStatAtt160)XmlAttach.FindAttachment(master, typeof(BonusStatAtt160));
                BonusStatAtt180 aurastatboost180 = (BonusStatAtt180)XmlAttach.FindAttachment(master, typeof(BonusStatAtt180));
                BonusStatAtt200 aurastatboost200 = (BonusStatAtt200)XmlAttach.FindAttachment(master, typeof(BonusStatAtt200));
                BonusStatAtt201 aurastatboost201 = (BonusStatAtt201)XmlAttach.FindAttachment(master, typeof(BonusStatAtt201));

                if (xmlplayer.Levell <= 10 && aurastatboost10 == null)
                {
                    XmlAttach.AttachTo(master, new BonusStatAtt10());
                }
                else if (xmlplayer.Levell > 10 && xmlplayer.Levell <= 20 && aurastatboost20 == null)
                {
                    XmlAttach.AttachTo(master, new BonusStatAtt20());
                }
                else if (xmlplayer.Levell > 20 && xmlplayer.Levell <= 30 && aurastatboost30 == null)
                {
                    XmlAttach.AttachTo(master, new BonusStatAtt30());
                }
                else if (xmlplayer.Levell > 30 && xmlplayer.Levell <= 40 && aurastatboost40 == null)
                {
                    XmlAttach.AttachTo(master, new BonusStatAtt40());
                }
                else if (xmlplayer.Levell > 40 && xmlplayer.Levell <= 50 && aurastatboost50 == null)
                {
                    XmlAttach.AttachTo(master, new BonusStatAtt50());
                }
                else if (xmlplayer.Levell > 50 && xmlplayer.Levell <= 60 && aurastatboost60 == null)
                {
                    XmlAttach.AttachTo(master, new BonusStatAtt60());
                }
                else if (xmlplayer.Levell > 60 && xmlplayer.Levell <= 70 && aurastatboost70 == null)
                {
                    XmlAttach.AttachTo(master, new BonusStatAtt70());
                }
                else if (xmlplayer.Levell > 70 && xmlplayer.Levell <= 80 && aurastatboost80 == null)
                {
                    XmlAttach.AttachTo(master, new BonusStatAtt80());
                }
                else if (xmlplayer.Levell > 80 && xmlplayer.Levell <= 90 && aurastatboost90 == null)
                {
                    XmlAttach.AttachTo(master, new BonusStatAtt90());
                }
                else if (xmlplayer.Levell > 90 && xmlplayer.Levell <= 100 && aurastatboost100 == null)
                {
                    XmlAttach.AttachTo(master, new BonusStatAtt100());
                }
                else if (xmlplayer.Levell > 100 && xmlplayer.Levell <= 140 && aurastatboost140 == null)
                {
                    XmlAttach.AttachTo(master, new BonusStatAtt140());
                }
                else if (xmlplayer.Levell > 140 && xmlplayer.Levell <= 160 && aurastatboost160 == null)
                {
                    XmlAttach.AttachTo(master, new BonusStatAtt160());
                }
                else if (xmlplayer.Levell > 160 && xmlplayer.Levell <= 180 && aurastatboost180 == null)
                {
                    XmlAttach.AttachTo(master, new BonusStatAtt180());
                }
                else if (xmlplayer.Levell > 180 && xmlplayer.Levell <= 200 && aurastatboost200 == null)
                {
                    XmlAttach.AttachTo(master, new BonusStatAtt200());
                }
                else if (xmlplayer.Levell > 200 && aurastatboost201 == null)
                {
                    XmlAttach.AttachTo(master, new BonusStatAtt201());
                }
            }

            switch (Utility.RandomMinMax(1, 6))
            {
            case 1: if (TeleportToTarget && cp.TelePortToTarChance >= Utility.RandomDouble())                     // 0.5 is 50% , 0.05 is 5%
                {
                    if (cp.TelePortToTarget == false)
                    {
                        return;
                    }
                    if (petxml.Levell < cp.TelePortToTargetReq)
                    {
                        return;
                    }
                    if (((BaseCreature)this.AttachedTo).Combatant == null)
                    {
                        return;
                    }
                    TeleToTarget(((BaseCreature)this.AttachedTo), e.Mobile);
                }
                break;

            case 2: if (MassProvoke && cp.MassProvokeChance >= Utility.RandomDouble())
                {
                    if (cp.MassProvokeToAtt == false)
                    {
                        return;
                    }
                    if (petxml.Levell < cp.MassProvokeToAttReq)
                    {
                        return;
                    }
                    if (((BaseCreature)this.AttachedTo).Combatant == null)
                    {
                        return;
                    }
                    MassProvokeXML(((BaseCreature)this.AttachedTo), e.Mobile);
                }
                ;      break;

            case 3: if (MassPeace && cp.MassPeaceChance >= Utility.RandomDouble())
                {
                    if (cp.MassPeaceArea == false)
                    {
                        return;
                    }
                    if (petxml.Levell < cp.MassPeaceReq)
                    {
                        return;
                    }
                    if (((BaseCreature)this.AttachedTo).Combatant == null)
                    {
                        return;
                    }
                    MassPeaceXML(((BaseCreature)this.AttachedTo), e.Mobile);
                }
                ;      break;

            case 4: if (SuperHeal && cp.SuperHealChance >= Utility.RandomDouble())
                {
                    if (cp.SuperHeal == false)
                    {
                        return;
                    }
                    if (petxml.Levell < cp.SuperHealReq)
                    {
                        return;
                    }
                    if (cp.PetShouldBeBonded == true)
                    {
                        if (((BaseCreature)this.AttachedTo).IsBonded == false)
                        {
                            return;
                        }
                        else
                        {
                            SuperHealXML(((BaseCreature)this.AttachedTo), e.Mobile);
                            break;
                        }
                    }
                    SuperHealXML(((BaseCreature)this.AttachedTo), e.Mobile);
                }
                ;      break;

            case 5: if (BlessedPower && cp.BlessedPowerChance >= Utility.RandomDouble())
                {
                    if (cp.BlessedPower == false)
                    {
                        return;
                    }
                    if (petxml.Levell < cp.BlessedPowerReq)
                    {
                        return;
                    }
                    if (((BaseCreature)this.AttachedTo).Combatant == null)
                    {
                        return;
                    }
                    BlessedXML(((BaseCreature)this.AttachedTo), e.Mobile);
                }
                ;      break;
//				case 6:
//				case 7: from.Hue = 0x7F7; break;
//				case 8: from.Hue = 0x7F8; break;
//				case 9: from.Hue = 0x7F9; break;
            }

            if (AttachedTo is BaseCreature && Utility.InRange(e.Mobile.Location, ((BaseCreature)this.AttachedTo).Location, proximityrange))
            {
                OnTrigger(null, e.Mobile);
            }
            else
            {
                return;
            }
        }
        // disable the default use of the target
        public override bool BlockDefaultOnUse(Mobile from, object target)
        {
            ConfiguredPetXML c = new ConfiguredPetXML();

            if (c.EnableLvLMountChkonPetAtt == false)
            {
                return(false);
            }

            var mount2 = ((BaseCreature)this.AttachedTo);
            XMLPlayerLevelAtt xmlplayer = (XMLPlayerLevelAtt)XmlAttach.FindAttachment(from, typeof(XMLPlayerLevelAtt));

            if (xmlplayer == null)
            {
                return(false);
            }

            if (mount2 is BaseMount)
            {
                BaseMount mount = (BaseMount)mount2;
                if (mount is Beetle)
                {
                    if (xmlplayer.Levell >= c.Beetle)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.Beetle);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is DesertOstard)
                {
                    if (xmlplayer.Levell >= c.DesertOstard)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.DesertOstard);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is FireSteed)
                {
                    if (xmlplayer.Levell >= c.FireSteed)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.FireSteed);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is ForestOstard)
                {
                    if (xmlplayer.Levell >= c.ForestOstard)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.ForestOstard);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is FrenziedOstard)
                {
                    if (xmlplayer.Levell >= c.FrenziedOstard)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.FrenziedOstard);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is HellSteed)
                {
                    if (xmlplayer.Levell >= c.HellSteed)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.HellSteed);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is Hiryu)
                {
                    if (xmlplayer.Levell >= c.Hiryu)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.Hiryu);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is Horse)
                {
                    if (xmlplayer.Levell >= c.Horse)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.Horse);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is Kirin)
                {
                    if (xmlplayer.Levell >= c.Kirin)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.Kirin);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is LesserHiryu)
                {
                    if (xmlplayer.Levell >= c.LesserHiryu)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.LesserHiryu);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is Nightmare)
                {
                    if (xmlplayer.Levell >= c.Nightmare)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.Nightmare);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is RidableLlama)
                {
                    if (xmlplayer.Levell >= c.RidableLlama)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.RidableLlama);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is Ridgeback)
                {
                    if (xmlplayer.Levell >= c.Ridgeback)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.Ridgeback);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is SavageRidgeback)
                {
                    if (xmlplayer.Levell >= c.SavageRidgeback)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.SavageRidgeback);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is ScaledSwampDragon)
                {
                    if (xmlplayer.Levell >= c.ScaledSwampDragon)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.ScaledSwampDragon);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is SeaHorse)
                {
                    if (xmlplayer.Levell >= c.SeaHorse)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.SeaHorse);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is SilverSteed)
                {
                    if (xmlplayer.Levell >= c.SilverSteed)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.SilverSteed);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is SkeletalMount)
                {
                    if (xmlplayer.Levell >= c.SkeletalMount)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.SkeletalMount);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is SwampDragon)
                {
                    if (xmlplayer.Levell >= c.SwampDragon)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.SwampDragon);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is Unicorn)
                {
                    if (xmlplayer.Levell >= c.Unicorn)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.Unicorn);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is Reptalon)
                {
                    if (xmlplayer.Levell >= c.Reptalon)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.Reptalon);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is WildTiger)
                {
                    if (xmlplayer.Levell >= c.WildTiger)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.WildTiger);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is Windrunner)
                {
                    if (xmlplayer.Levell >= c.Windrunner)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.Windrunner);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is Lasher)
                {
                    if (xmlplayer.Levell >= c.Lasher)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.Lasher);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is Eowmu)
                {
                    if (xmlplayer.Levell >= c.Eowmu)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.Eowmu);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is DreadWarhorse)
                {
                    if (xmlplayer.Levell >= c.DreadWarhorse)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.DreadWarhorse);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is CuSidhe)
                {
                    if (xmlplayer.Levell >= c.CuSidhe)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.CuSidhe);
                        return(BlockDefaultUse);
                    }
                }
                else
                {
                    /*	If mount isn't on the list and has an attachment it will hit this return
                     *      statement. Add it to this list and also add an entry to configuration file. */
                    return(false);
                }
            }
            if (mount2 is BaseCreature)
            {
                return(false);
            }

            from.SendMessage("You are not at the right Level to ride me!");
            return(BlockDefaultUse);  //Fail catch for Creatures on this list but have the attachment
        }
        public override void OnWeaponHit(Mobile attacker, Mobile defender, BaseWeapon weapon, int damageGiven)
        {
            ConfiguredPetXML  cp        = new ConfiguredPetXML();
            Mobile            master    = ((BaseCreature)this.AttachedTo).ControlMaster;
            XMLPlayerLevelAtt xmlplayer = (XMLPlayerLevelAtt)XmlAttach.FindAttachment(master, typeof(XMLPlayerLevelAtt));
            XMLPetLevelAtt    petxml    = (XMLPetLevelAtt)XmlAttach.FindAttachment(((BaseCreature)this.AttachedTo), typeof(XMLPetLevelAtt));

            if (attacker == null)
            {
                return;
            }

            if (petxml == null)
            {
                return;
            }

            switch (Utility.RandomMinMax(1, 3))
            {
            case 1: if (AreaFireBlast && cp.AreaFireBlastChance >= Utility.RandomDouble())                     // 0.5 is 50% , 0.05 is 5%
                {
                    if (cp.AreaFireBlast == false)
                    {
                        return;
                    }
                    if (petxml.Levell < cp.AreaFireBlastReq)
                    {
                        return;
                    }
                    AreaFireBlastXML(((BaseCreature)this.AttachedTo), defender, master);
                }
                break;

            case 2: if (AreaIceBlast && cp.AreaIceBlastChance >= Utility.RandomDouble())
                {
                    if (cp.AreaIceBlast == false)
                    {
                        return;
                    }
                    if (petxml.Levell < cp.AreaIceBlastReq)
                    {
                        return;
                    }
                    AreaIceBlastXML(((BaseCreature)this.AttachedTo), defender, master);
                }
                ;      break;

            case 3: if (AreaAirBlast && cp.AreaAirBlastChance >= Utility.RandomDouble())
                {
                    if (cp.AreaAirBlast == false)
                    {
                        return;
                    }
                    if (petxml.Levell < cp.AreaAirBlastReq)
                    {
                        return;
                    }
                    AreaAirBlastXML(((BaseCreature)this.AttachedTo), defender, master);
                }
                ;      break;
            }
        }