Пример #1
0
 private int Verify(LockableContainer container)
 {
     if (container == null || container.KeyValue == 0)
     {
         return(1005638); // You can only trap lockable chests.
     }
     if (this.From.Map != container.Map || !this.From.InRange(container.GetWorldLocation(), 2))
     {
         return(500446); // That is too far away.
     }
     if (!container.Movable)
     {
         return(502944); // You cannot trap this item because it is locked down.
     }
     if (!container.IsAccessibleTo(this.From))
     {
         return(502946); // That belongs to someone else.
     }
     if (container.Locked)
     {
         return(502943); // You can only trap an unlocked object.
     }
     if (container.TrapType != TrapType.None)
     {
         return(502945); // You can only place one trap on an object at a time.
     }
     return(0);
 }
Пример #2
0
        public void Target(LockableContainer targ)
        {
            if (Multis.BaseHouse.CheckLockedDownOrSecured(targ))
            {
                // You cannot cast this on a locked down item.
                Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 501761);
            }
            else if (targ.Locked || targ.LockLevel == 0)
            {
                // Target must be an unlocked chest.
                Caster.SendLocalizedMessage(501762);
            }
            else if (CheckSequence())
            {
                SpellHelper.Turn(Caster, targ);

                Point3D loc = targ.GetWorldLocation();

                Effects.SendLocationParticles(
                    EffectItem.Create(loc, targ.Map, EffectItem.DefaultDuration),
                    0x376A, 9, 32, 5020);

                Effects.PlaySound(loc, targ.Map, 0x1FA);

                // The chest is now locked!
                Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 501763);

                targ.LockLevel = -255;                 // signal magic lock
                targ.Locked    = true;
            }

            FinishSequence();
        }
Пример #3
0
        public void Target(LockableContainer targ)
        {
            if (targ.Locked || targ.LockLevel == 0 || targ.MaxLockLevel == 0)
            {
                Caster.SendLocalizedMessage(501762);                   // Target must be an unlocked chest.
            }
            else if (targ.MaxLockLevel > 65)
            {
                Caster.SendAsciiMessage("This chest cannot be magically locked.");
            }
            else if (CheckSequence())
            {
                SpellHelper.Turn(Caster, targ);

                Point3D loc = targ.GetWorldLocation();

                Effects.SendLocationParticles(
                    EffectItem.Create(loc, targ.Map, EffectItem.DefaultDuration),
                    0x376A, 9, 32, 5020);

                Effects.PlaySound(loc, targ.Map, 0x1FA);

                // The chest is now locked!
                Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 501763);

                targ.LockLevel = -255;                 // signal magic lock
                targ.Locked    = true;
            }

            FinishSequence();
        }
Пример #4
0
        public void Target(LockableContainer targ)
        {
            if (Multis.BaseHouse.CheckSecured(targ))
            {
                Caster.SendAsciiMessage("You cannot cast this on a secure item.");
            }
            else if (CheckSequence())
            {
                SpellHelper.Turn(Caster, targ);

                Point3D loc = targ.GetWorldLocation();

                Effects.SendLocationParticles(
                    EffectItem.Create(loc, targ.Map, EffectItem.DefaultDuration),
                    0x376A, 9, 32, 5024);

                Effects.PlaySound(loc, targ.Map, 0x1FF);

                if (targ.Locked && targ.LockLevel != 0)
                {
                    double magery = Caster.Skills[SkillName.Magery].Value;
                    int    level  = (int)(magery * 0.8) - 4;

                    if (level >= targ.RequiredSkill && !(targ is TreasureMapChest && ((TreasureMapChest)targ).Level > 2) && !(targ is BaseTreasureChest && ((BaseTreasureChest)targ).Level > (BaseTreasureChest.TreasureLevel) 1))
                    {
                        targ.Locked = false;

                        if (targ.LockLevel == -255)
                        {
                            targ.LockLevel = targ.RequiredSkill - 10;
                        }

                        if (targ.LockLevel == 0)
                        {
                            targ.LockLevel = -1;
                        }

                        if (targ is BaseTreasureChest)
                        {
                            ((BaseTreasureChest)targ).UnlockSpell();
                        }
                    }
                    else
                    {
                        // My spell does not seem to have an effect on that lock.
                        Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503099);
                    }
                }
                else
                {
                    // That did not need to be unlocked.
                    Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503101);
                }
            }

            FinishSequence();
        }
Пример #5
0
        public void Target(LockableContainer targ)
        {
            if (Multis.BaseHouse.CheckSecured(targ))
            {
                // You cannot cast this on a secure item.
                Caster.SendLocalizedMessage(503098);
            }
            else if (CheckSequence())
            {
                SpellHelper.Turn(Caster, targ);

                Point3D loc = targ.GetWorldLocation();

                Effects.SendLocationParticles(
                    EffectItem.Create(loc, targ.Map, EffectItem.DefaultDuration),
                    0x376A, 9, 32, 5024);

                Effects.PlaySound(loc, targ.Map, 0x1FF);

                if (targ.Locked /* && targ.LockLevel != 0 */)
                {
                    double level = Caster.Skills[SkillName.Animisme].Value;

                    level = SpellHelper.AdjustValue(Caster, level);

                    if ((int)level >= targ.RequiredSkill)
                    {
                        targ.Locked = false;

                        if (targ.LockLevel == -255)
                        {
                            targ.LockLevel = targ.RequiredSkill - 10;
                        }

                        if (targ.LockLevel == 0)
                        {
                            targ.LockLevel = -1;
                        }
                    }
                    else
                    {
                        // My spell does not seem to have an effect on that lock.
                        Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503099);
                    }
                }
                else
                {
                    // That did not need to be unlocked.
                    Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503101);
                }
            }

            FinishSequence();
        }
Пример #6
0
        public void Target(LockableContainer targ)
        {
            if (CheckSequence())
            {
                SpellHelper.Turn(Caster, targ);

                Point3D loc = targ.GetWorldLocation();

                Effects.SendLocationParticles(
                    EffectItem.Create(loc, targ.Map, EffectItem.DefaultDuration),
                    0x376A, 9, 32, 5024);

                Effects.PlaySound(loc, targ.Map, 0x1FF);

                if (targ.Locked)
                {
                    if (targ.LockLevel != 0 && (targ.LockLevel == -255 || (targ.MaxLockLevel <= 50 && Caster.Skills[SkillName.Magery].Value > targ.RequiredSkill)))
                    {
                        targ.Locked = false;

                        if (targ.LockLevel == -255)
                        {
                            targ.LockLevel = targ.MaxLockLevel - 30;

                            if (targ.RequiredSkill < targ.LockLevel)
                            {
                                targ.LockLevel = targ.RequiredSkill;
                            }

                            if (targ.LockLevel < 1)
                            {
                                targ.LockLevel = 1;
                            }
                        }
                    }
                    else
                    {
                        // My spell does not seem to have an effect on that lock.
                        Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503099);
                    }
                }
                else
                {
                    // That did not need to be unlocked.
                    Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503101);
                }
            }

            FinishSequence();
        }
Пример #7
0
        public void Target(LockableContainer targ)
        {
            if (Multis.BaseHouse.CheckSecured(targ))
            {
                // You cannot cast this on a secure item.
                Caster.SendLocalizedMessage(503098);
            }
            else if (CheckSequence())
            {
                SpellHelper.Turn(Caster, targ);

                Point3D loc = targ.GetWorldLocation();

                Effects.SendLocationParticles(
                    EffectItem.Create(loc, targ.Map, EffectItem.DefaultDuration),
                    0x376A, 9, 32, 5024);

                Effects.PlaySound(loc, targ.Map, 0x1FF);

                if (targ.Locked && targ.LockLevel == -255)
                {
                    double level = Caster.Skills[CastSkill].Value;

                    level = SpellHelper.AdjustValue(Caster, level);

                    if ((int)level >= targ.RequiredSkill)
                    {
                        targ.Locked = false;
                    }
                    else
                    {
                        Caster.SendMessage("Vous n'êtes pas assez compétent pour ouvrir ce coffre !");
                    }
                }
                else
                {
                    // My spell does not seem to have an effect on that lock.
                    Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503099);
                }
            }

            FinishSequence();
        }
Пример #8
0
        private int Verify(LockableContainer container)
        {
            if (container == null || container.KeyValue == 0)
            {
                return(1005638); // You can only trap lockable chests.
            }
            if (From.Map != container.Map || !From.InRange(container.GetWorldLocation(), 2))
            {
                return(500446); // That is too far away.
            }
            if (!container.IsAccessibleTo(From))
            {
                return(502946); // That belongs to someone else.
            }
            if (container.Locked)
            {
                return(502943); // You can only trap an unlocked object.
            }
            //return 502945; // You can only place one trap on an object at a time.

            return(0);
        }
Пример #9
0
        private int Verify(LockableContainer container)
        {
            if (container == null || container.KeyValue == 0)
            {
                From.SendAsciiMessage("You can only trap lockable chests.");
                return(1005638); // You can only trap lockable chests.
            }
            if (From.Map != container.Map || !From.InRange(container.GetWorldLocation(), 2))
            {
                int OldHue = From.SpeechHue;
                From.SpeechHue = 0;
                From.SayTo(From, true, "I can't reach that.");
                From.SpeechHue = OldHue;
                return(500446); // That is too far away.
            }
            if (!container.Movable)
            {
                return(502944); // You cannot trap this item because it is locked down.
            }
            if (!container.IsAccessibleTo(From))
            {
                From.SendAsciiMessage("That belongs to someone else.");
                return(502946); // That belongs to someone else.
            }
            if (container.Locked)
            {
                From.SendAsciiMessage("You can only trap an unlocked object.");
                return(502943); // You can only trap an unlocked object.
            }
            if (container.TrapType != TrapType.None)
            {
                From.SendAsciiMessage("You can only place one trap on an object at a time.");
                return(502945); // You can only place one trap on an object at a time.
            }

            return(0);
        }
Пример #10
0
        public void Target(object o)
        {
            if (o is Item)
            {
                Item targ = (Item)o;

                if (targ is LockableContainer)
                {
                    LockableContainer box = (LockableContainer)targ;
                    if (Multis.BaseHouse.CheckLockedDownOrSecured(box))
                    {
                        // You cannot cast this on a locked down item.
                        Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 501761);
                    }
                    else if (box.Locked || box.LockLevel == 0 || box is ParagonChest)
                    {
                        // Target must be an unlocked chest.
                        Caster.SendLocalizedMessage(501762);
                    }
                    else if (CheckSequence())
                    {
                        SpellHelper.Turn(Caster, box);

                        Point3D loc = box.GetWorldLocation();

                        Effects.SendLocationParticles(
                            EffectItem.Create(loc, box.Map, EffectItem.DefaultDuration),
                            0x376A, 9, 32, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 0), 0, 5020, 0);

                        Effects.PlaySound(loc, box.Map, 0x1FA);

                        // The chest is now locked!
                        Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 501763);

                        box.LockLevel = (int)(Caster.Skills[SkillName.Magery].Value);
                        if (box.LockLevel > 90)
                        {
                            box.LockLevel = 90;
                        }
                        if (box.LockLevel < 0)
                        {
                            box.LockLevel = 0;
                        }
                        box.MaxLockLevel  = box.LockLevel + 20;
                        box.RequiredSkill = box.LockLevel;

                        //box.LockLevel = -255; // signal magic lock
                        box.Locked = true;
                    }
                }
                else if (targ is BaseDoor)
                {
                    BaseDoor door = (BaseDoor)targ;
                    if (Server.Items.DoorType.IsDungeonDoor(door))
                    {
                        if (door.Locked == true)
                        {
                            Caster.SendMessage("That door is already locked!");
                        }
                        else
                        {
                            SpellHelper.Turn(Caster, door);

                            Point3D loc = door.GetWorldLocation();

                            Effects.SendLocationParticles(
                                EffectItem.Create(loc, door.Map, EffectItem.DefaultDuration),
                                0x376A, 9, 32, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 0), 0, 5020, 0);

                            Effects.PlaySound(loc, door.Map, 0x1FA);

                            Caster.SendMessage("That door is now locked!");

                            door.Locked = true;
                            Server.Items.DoorType.LockDoors(door);

                            new InternalTimer(door, Caster).Start();
                        }
                    }
                    else
                    {
                        Caster.SendMessage("This spell has no effect on that!");
                    }
                }
                else
                {
                    Caster.SendMessage("This spell has no effect on that!");
                }
            }
            else if (o is PlayerMobile)
            {
                Caster.SendMessage("That soul seems too strong to trap in the flask!");
            }
            else if (o is BaseCreature)
            {
                BaseCreature bc = (BaseCreature)o;

                if (!bc.Alive)
                {
                    Caster.SendMessage("You cannot trap something that is dead!");
                }
                else if (bc.Controlled is LockedCreature)
                {
                    Caster.SendMessage("That creature cannot be trapped again!");
                }
                else if (bc.Controlled == true)
                {
                    Caster.SendMessage("That is under the control of another!");
                }
                else if (bc.EmoteHue == 505 || bc.ControlSlots >= 100)                   // SUMMON QUEST AND QUEST MONSTERS
                {
                    Server.Misc.IntelligentAction.FizzleSpell(Caster);
                    Caster.SendMessage("You are not powerful enough to trap that!");
                }
                else if (Caster.Backpack.FindItemByType(typeof(IronFlask)) == null)
                {
                    Caster.SendMessage("You need an empty iron flask to trap them!");
                }
                else
                {
                    int level  = Server.Misc.DifficultyLevel.GetCreatureLevel((Mobile)o) + 10;
                    int magery = (int)(Caster.Skills[SkillName.Magery].Value);

                    if (magery >= level)
                    {
                        int success = 10 + (magery - level);

                        if (Utility.RandomMinMax(1, 100) > success)
                        {
                            Server.Misc.IntelligentAction.FizzleSpell(Caster);
                            Caster.SendMessage("You fail to trap them in the flask!");
                        }
                        else
                        {
                            Item flask = Caster.Backpack.FindItemByType(typeof(IronFlask));
                            if (flask != null)
                            {
                                flask.Consume();
                            }

                            Caster.SendMessage("You trap " + bc.Name + " in the flask!");

                            IronFlaskFilled bottle = new IronFlaskFilled();

                            int hitpoison = 0;

                            if (bc.HitPoison == Poison.Lesser)
                            {
                                hitpoison = 1;
                            }
                            else if (bc.HitPoison == Poison.Regular)
                            {
                                hitpoison = 2;
                            }
                            else if (bc.HitPoison == Poison.Greater)
                            {
                                hitpoison = 3;
                            }
                            else if (bc.HitPoison == Poison.Deadly)
                            {
                                hitpoison = 4;
                            }
                            else if (bc.HitPoison == Poison.Lethal)
                            {
                                hitpoison = 5;
                            }

                            int immune = 0;

                            if (bc.PoisonImmune == Poison.Lesser)
                            {
                                immune = 1;
                            }
                            else if (bc.PoisonImmune == Poison.Regular)
                            {
                                immune = 2;
                            }
                            else if (bc.PoisonImmune == Poison.Greater)
                            {
                                immune = 3;
                            }
                            else if (bc.PoisonImmune == Poison.Deadly)
                            {
                                immune = 4;
                            }
                            else if (bc.PoisonImmune == Poison.Lethal)
                            {
                                immune = 5;
                            }

                            bottle.TrappedName        = bc.Name;
                            bottle.TrappedTitle       = bc.Title;
                            bottle.TrappedBody        = bc.Body;
                            bottle.TrappedBaseSoundID = bc.BaseSoundID;
                            bottle.TrappedHue         = bc.Hue;

                            // TURN HUMANOIDS TO GHOSTS SO I DON'T NEED TO WORRY ABOUT CLOTHES AND GEAR
                            if (bc.Body == 400 || bc.Body == 401 || bc.Body == 605 || bc.Body == 606)
                            {
                                bottle.TrappedBody        = 0x3CA;
                                bottle.TrappedHue         = 0x9C4;
                                bottle.TrappedBaseSoundID = 0x482;
                            }

                            bottle.TrappedAI = 2; if (bc.AI == AIType.AI_Mage)
                            {
                                bottle.TrappedAI = 1;
                            }
                            bottle.TrappedStr          = bc.RawStr;
                            bottle.TrappedDex          = bc.RawDex;
                            bottle.TrappedInt          = bc.RawInt;
                            bottle.TrappedHits         = bc.HitsMax;
                            bottle.TrappedStam         = bc.StamMax;
                            bottle.TrappedMana         = bc.ManaMax;
                            bottle.TrappedDmgMin       = bc.DamageMin;
                            bottle.TrappedDmgMax       = bc.DamageMax;
                            bottle.TrappedColdDmg      = bc.ColdDamage;
                            bottle.TrappedEnergyDmg    = bc.EnergyDamage;
                            bottle.TrappedFireDmg      = bc.FireDamage;
                            bottle.TrappedPhysicalDmg  = bc.PhysicalDamage;
                            bottle.TrappedPoisonDmg    = bc.PoisonDamage;
                            bottle.TrappedColdRst      = bc.ColdResistSeed;
                            bottle.TrappedEnergyRst    = bc.EnergyResistSeed;
                            bottle.TrappedFireRst      = bc.FireResistSeed;
                            bottle.TrappedPhysicalRst  = bc.PhysicalResistanceSeed;
                            bottle.TrappedPoisonRst    = bc.PoisonResistSeed;
                            bottle.TrappedVirtualArmor = bc.VirtualArmor;
                            bottle.TrappedCanSwim      = bc.CanSwim;
                            bottle.TrappedCantWalk     = bc.CantWalk;
                            bottle.TrappedSkills       = level + 5;
                            bottle.TrappedPoison       = hitpoison;
                            bottle.TrappedImmune       = immune;
                            bottle.TrappedAngerSound   = bc.GetAngerSound();
                            bottle.TrappedIdleSound    = bc.GetIdleSound();
                            bottle.TrappedDeathSound   = bc.GetDeathSound();
                            bottle.TrappedAttackSound  = bc.GetAttackSound();
                            bottle.TrappedHurtSound    = bc.GetHurtSound();

                            Caster.BoltEffect(0);
                            Caster.PlaySound(0x665);

                            Caster.AddToBackpack(bottle);

                            bc.BoltEffect(0);
                            bc.PlaySound(0x665);
                            bc.Delete();
                        }
                    }
                    else
                    {
                        Server.Misc.IntelligentAction.FizzleSpell(Caster);
                        Caster.SendMessage("You are not powerful enough to trap that!");
                    }
                }
            }

            FinishSequence();
        }