Beispiel #1
0
        public void Target(TrapableContainer item)
        {
            Item checkBackpack = Caster.Backpack.FindItemByType(typeof(TrapableContainer));

            if (!Caster.CanSee(item))
            {
                Caster.SendLocalizedMessage(500237); // Target can not be seen.
            }
            else if (!CheckLineOfSight(item) && checkBackpack == null)
            {
                this.DoFizzle();
                Caster.SendAsciiMessage("Target is not in line of sight");
            }
            else if (item.TrapType != TrapType.None && item.TrapType != TrapType.MagicTrap)
            {
                base.DoFizzle();
            }
            else if (CheckSequence())
            {
                SpellHelper.Turn(Caster, item);

                Point3D loc = item.GetWorldLocation();

                Effects.SendLocationParticles(EffectItem.Create(loc, item.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5015);
                Effects.PlaySound(loc, item.Map, 0x1F0);

                item.TrapType  = TrapType.None;
                item.TrapPower = 0;
                item.TrapLevel = 0;
            }

            FinishSequence();
        }
Beispiel #2
0
        public void Target(TrapableContainer item)
        {
            if (!Caster.CanSee(item))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (item.TrapLevel > (int)(Caster.Skills[SkillName.Necromancy].Value))
            {
                base.DoFizzle();
            }
            else if (item.TrapType == TrapType.None)
            {
                Caster.PrivateOverheadMessage(MessageType.Regular, 0x14C, false, "That does not seem to be trapped.", Caster.NetState);
            }
            else if (CheckSequence())
            {
                SpellHelper.Turn(Caster, item);

                Point3D loc = item.GetWorldLocation();

                Effects.SendLocationParticles(EffectItem.Create(loc, item.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5015);
                Effects.PlaySound(loc, item.Map, 0x37D);

                item.TrapType  = TrapType.None;
                item.TrapPower = 0;
                item.TrapLevel = 0;
            }

            FinishSequence();
        }
Beispiel #3
0
        public void Target(TrapableContainer item)
        {
            if (!Caster.CanSee(item))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (item.TrapType != TrapType.None && item.TrapType != TrapType.MagicTrap)
            {
                base.DoFizzle();
            }
            else if (CheckSequence())
            {
                SpellHelper.Turn(Caster, item);

                Point3D loc = item.GetWorldLocation();

                Effects.SendLocationParticles(EffectItem.Create(loc, item.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5015);
                Effects.PlaySound(loc, item.Map, 0x1F0);

                TreasureMapChest chest = item as TreasureMapChest;

                double skill = Caster.Skills[SkillName.Magery].Value;

                if ((chest != null && skill >= 100.0 && chest.TrapLevel <= 2) || (chest == null && ((item.TrapCreator == null && item.TrapLevel <= (int)(skill / 33.3)) || (item.TrapCreator != null && item.TrapLevel <= (int)(skill / 20.0)))))
                {
                    //Treasure Chests: Must be GM, up to level 2
                    //Non Treasure Chests:  Up to level 3, Player constructed, up to level 5.
                    item.TrapType  = TrapType.None;
                    item.TrapPower = 0;
                    item.TrapLevel = 0;
                }
            }

            FinishSequence();
        }
Beispiel #4
0
        public void Target(TrapableContainer item)
        {
            if (!Caster.CanSee(item))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (CheckSequence())
            {
                int nTrapLevel = item.TrapLevel * 12;

                if ((int)(Caster.Skills[SkillName.Magery].Value) > nTrapLevel)
                {
                    Point3D loc = item.GetWorldLocation();

                    Effects.SendLocationParticles(EffectItem.Create(loc, item.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 0), 0, 5015, 0);
                    Effects.PlaySound(loc, item.Map, 0x1F0);

                    Caster.SendMessage("Any traps on that container are now disabled.");

                    item.TrapType  = TrapType.None;
                    item.TrapPower = 0;
                    item.TrapLevel = 0;
                }
                else
                {
                    Caster.SendMessage("That trap seems to complicated to be affected by your magic.");
                    base.DoFizzle();
                }
            }
            FinishSequence();
        }
Beispiel #5
0
        public void Target(TrapableContainer item)
        {
            if (!Caster.CanSee(item))
            {
                Caster.SendLocalizedMessage(500237); // Target can not be seen.
            }
            else if (item.TrapType != TrapType.None && item.TrapType != TrapType.MagicTrap)
            {
                base.DoFizzle();
            }
            else if (CheckSequence())
            {
                SpellHelper.Turn(Caster, item);

                item.TrapType  = TrapType.MagicTrap;
                item.TrapPower = Core.AOS ? Utility.RandomMinMax(10, 50) : 1;
                item.TrapLevel = 0;

                Point3D loc = item.GetWorldLocation();

                Effects.SendLocationParticles(EffectItem.Create(new Point3D(loc.X + 1, loc.Y, loc.Z), item.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 9502);
                Effects.SendLocationParticles(EffectItem.Create(new Point3D(loc.X, loc.Y - 1, loc.Z), item.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 9502);
                Effects.SendLocationParticles(EffectItem.Create(new Point3D(loc.X - 1, loc.Y, loc.Z), item.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 9502);
                Effects.SendLocationParticles(EffectItem.Create(new Point3D(loc.X, loc.Y + 1, loc.Z), item.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 9502);
                Effects.SendLocationParticles(EffectItem.Create(new Point3D(loc.X, loc.Y, loc.Z), item.Map, EffectItem.DefaultDuration), 0, 0, 0, 5014);

                Effects.PlaySound(loc, item.Map, 0x1EF);
            }

            FinishSequence();
        }
Beispiel #6
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Mobile)
                {
                    from.SendLocalizedMessage(502816);                       // You feel that such an action would be inappropriate
                }
                else if (targeted is TrapableContainer)
                {
                    TrapableContainer targ = (TrapableContainer)targeted;

                    from.Direction = from.GetDirectionTo(targ);

                    if (!targ.Trapped)
                    {
                        from.SendLocalizedMessage(502373);                           // That doesn't appear to be trapped
                        return;
                    }

                    from.PlaySound(0x241);

                    if (from.CheckTargetSkill(SkillName.RemoveTrap, targ, targ.TrapPower, targ.TrapPower + 30))
                    {
                        targ.Trapped = false;
                        from.SendLocalizedMessage(502377);                           // You successfully render the trap harmless
                    }
                    else
                    {
                        from.SendLocalizedMessage(502372);                           // You fail to disarm the trap... but you don't set it off
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502373);                       // That does'nt appear to be trapped
                }
            }
        public void Target(TrapableContainer item)
        {
            if (!Caster.CanSee(item))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (item.Trapped && item.TrapType != TrapType.MagicTrap)
            {
                base.DoFizzle();
            }
            else if (CheckSequence())
            {
                SpellHelper.Turn(Caster, item);

                Point3D loc = item.GetWorldLocation();

                Effects.SendLocationParticles(EffectItem.Create(loc, item.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5015);
                Effects.PlaySound(loc, item.Map, 0x1F0);

                item.TrapType  = TrapType.None;
                item.Trapped   = false;
                item.TrapPower = 0;
            }

            FinishSequence();
        }
Beispiel #8
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Mobile)
                {
                    from.SendLocalizedMessage(502816); // You feel that such an action would be inappropriate
                }
                else if (targeted is TrapableContainer)
                {
                    TrapableContainer targ = (TrapableContainer)targeted;

                    from.Direction = from.GetDirectionTo(targ);

                    if (targ.TrapType == TrapType.None)
                    {
                        from.SendLocalizedMessage(502373); // That doesn't appear to be trapped
                        return;
                    }

                    from.PlaySound(0x241);

                    if (from.CheckTargetSkill(SkillName.RemoveTrap, targ, targ.TrapPower, targ.TrapPower + 30))
                    {
                        targ.TrapPower = 0;
                        targ.TrapLevel = 0;
                        targ.TrapType  = TrapType.None;
                        from.SendLocalizedMessage(502377); // You successfully render the trap harmless
                    }
                    else
                    {
                        from.SendLocalizedMessage(502372); // You fail to disarm the trap... but you don't set it off
                    }
                }
                else if (targeted is BaseDoor && ((BaseDoor)targeted).TrapAvailable)
                {
                    if (from.CheckTargetSkill(SkillName.RemoveTrap, targeted, (targeted is BaseHouseDoor ? 95.0 : 75.0), (targeted is BaseHouseDoor ? 120.0 : 100.0)))
                    {
                        from.SendLocalizedMessage(502377); //You successfully render the trap harmless.
                        ((BaseDoor)targeted).RemoveTrap();
                    }
                    else
                    {
                        if (0.20 >= Utility.RandomDouble())
                        {
                            from.SendMessage("You fail to disarm the trap, and accidentally set it off!");
                            ((BaseDoor)targeted).DoorTrap.Trigger(from);
                        }
                        else
                        {
                            from.SendLocalizedMessage(502372);
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502373); // That does'nt appear to be trapped
                }

                EventSink.InvokeSkillUsed(new SkillUsedEventArgs(from, from.Skills[SkillName.RemoveTrap]));
            }
Beispiel #9
0
        public void Target(TrapableContainer item)
        {
            if (!Caster.CanSee(item))
            {
                Caster.SendLocalizedMessage(500237);                 // Target can not be seen.
            }
            else if (item.TrapType != TrapType.None && item.TrapType != TrapType.MagicTrap)
            {
                base.DoFizzle();
            }
            else if (CheckSequence())
            {
                SpellHelper.Turn(Caster, item);

                var pouch = item as ChargeableTrapPouch;

                if (pouch != null)
                {
                    if (pouch.Charges == 0)
                    {
                        item.TrapType  = TrapType.MagicTrap;
                        item.TrapPower = Caster.EraAOS ? Utility.RandomMinMax(10, 50) : 4; //Change to depend on magery skill?
                        item.TrapLevel = 0;
                        pouch.Charges++;
                    }
                    else if (pouch.Charges < 30)
                    {
                        pouch.Charges++;
                    }
                    else
                    {
                        Caster.SendMessage(54, "This pouch can only hold 30 charges.");
                    }
                }
                else
                {
                    item.TrapType  = TrapType.MagicTrap;
                    item.TrapPower = Caster.EraAOS ? Utility.RandomMinMax(10, 50) : 4; //Change to depend on magery skill?
                    item.TrapLevel = 0;
                }

                Point3D loc = item.GetWorldLocation();

                Effects.SendLocationParticles(
                    EffectItem.Create(new Point3D(loc.X + 1, loc.Y, loc.Z), item.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 9502);
                Effects.SendLocationParticles(
                    EffectItem.Create(new Point3D(loc.X, loc.Y - 1, loc.Z), item.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 9502);
                Effects.SendLocationParticles(
                    EffectItem.Create(new Point3D(loc.X - 1, loc.Y, loc.Z), item.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 9502);
                Effects.SendLocationParticles(
                    EffectItem.Create(new Point3D(loc.X, loc.Y + 1, loc.Z), item.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 9502);
                Effects.SendLocationParticles(
                    EffectItem.Create(new Point3D(loc.X, loc.Y, loc.Z), item.Map, EffectItem.DefaultDuration), 0, 0, 0, 5014);

                Effects.PlaySound(loc, item.Map, 0x1EF);
            }

            FinishSequence();
        }
Beispiel #10
0
            private void RemoveTrap(Mobile from, TrapableContainer targ)
            {
                targ.TrapPower = 0;
                targ.TrapLevel = 0;
                targ.TrapType  = TrapType.None;
                targ.Trapper   = null;

                from.PlaySound(0x5AC);

                from.SendLocalizedMessage(502377); // You successfully render the trap harmless
            }
Beispiel #11
0
            public InternalTimer(Mobile from, TrapableContainer targeted)
                : base(TimeSpan.FromSeconds(5.0))
            {
                m_From     = from;
                m_Targeted = targeted;

                if (from is PlayerMobile)
                {
                    ((PlayerMobile)from).ResetPlayerAction(this);
                }
            }
Beispiel #12
0
        public void Target(TrapableContainer item)
        {
            if (!Caster.CanSee(item))
            {
                Caster.SendLocalizedMessage(500237); // Target can not be seen.
            }
            else if (item.TrapType != TrapType.None && item.TrapType != TrapType.MagicTrap)
            {
                base.DoFizzle();
            }
            else if (Core.AOS && !item.IsChildOf(Caster.Backpack))
            {
                Caster.SendLocalizedMessage(1045158); // You must have the item in your backpack to target it.
            }
            else if (CheckSequence())
            {
                Point3D loc;

                SpellHelper.Turn(Caster, item);

                item.TrapType  = TrapType.MagicTrap;
                item.TrapPower = Core.AOS ? Utility.RandomMinMax(10, 50) : 1;
                item.TrapLevel = 0;

                if (!item.IsChildOf(Caster.Backpack))
                {
                    loc = item.GetWorldLocation();
                }
                else
                {
                    loc = Caster.Location;
                }

                loc.X++;
                NewTimer(item, loc, Caster.Map, 0);
                loc.X--;
                loc.Y--;
                NewTimer(item, loc, Caster.Map, .75);
                loc.X--;
                loc.Y++;
                NewTimer(item, loc, Caster.Map, 1.5);
                loc.X++;
                loc.Y++;
                NewTimer(item, loc, Caster.Map, 2.25);
                Effects.PlaySound(loc, item.Map, 0x1EF);
            }
            FinishSequence();
        }
Beispiel #13
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                bool releaseLock = true;

                if (targeted is Mobile)
                {
                    from.SendLocalizedMessage(502816);                       // You feel that such an action would be inappropriate
                }
                else if (targeted is TrapableContainer)
                {
                    TrapableContainer targ = (TrapableContainer)targeted;

                    from.Direction = from.GetDirectionTo(targ);

                    if (targ.TrapType == TrapType.None)
                    {
                        from.SendLocalizedMessage(502373); // That doesn't appear to be trapped
                    }

                    else
                    {
                        from.PlaySound(0x241);
                        from.SendAsciiMessage("You begin removing the trap");
                        releaseLock = false;
                        new InternalTimer(from, targ).Start();
                    }
                }
                //Taran: Not using factions

                /*else if ( targeted is BaseFactionTrap )
                 * {
                 *  BaseFactionTrap trap = (BaseFactionTrap) targeted;
                 *  Faction faction = Faction.Find( from );
                 *
                 *  FactionTrapRemovalKit kit = ( from.Backpack == null ? null : from.Backpack.FindItemByType( typeof( FactionTrapRemovalKit ) ) as FactionTrapRemovalKit );
                 *
                 *  bool isOwner = ( trap.Placer == from || ( trap.Faction != null && trap.Faction.IsCommander( from ) ) );
                 *
                 *  if ( faction == null )
                 *  {
                 *      from.SendLocalizedMessage( 1010538 ); // You may not disarm faction traps unless you are in an opposing faction
                 *  }
                 *  else if ( faction == trap.Faction && trap.Faction != null && !isOwner )
                 *  {
                 *      from.SendLocalizedMessage( 1010537 ); // You may not disarm traps set by your own faction!
                 *  }
                 *  else if ( !isOwner && kit == null )
                 *  {
                 *      from.SendLocalizedMessage( 1042530 ); // You must have a trap removal kit at the base level of your pack to disarm a faction trap.
                 *  }
                 *  else
                 *  {
                 *      if ( (Core.ML && isOwner) || (from.CheckTargetSkill( SkillName.RemoveTrap, trap, 80.0, 100.0 ) && from.CheckTargetSkill( SkillName.Tinkering, trap, 80.0, 100.0 )) )
                 *      {
                 *          from.PrivateOverheadMessage( MessageType.Regular, trap.MessageHue, trap.DisarmMessage, from.NetState );
                 *
                 *          if ( !isOwner )
                 *          {
                 *              int silver = faction.AwardSilver( from, trap.SilverFromDisarm );
                 *
                 *              if ( silver > 0 )
                 *                  from.SendLocalizedMessage( 1008113, true, silver.ToString( "N0" ) ); // You have been granted faction silver for removing the enemy trap :
                 *          }
                 *
                 *          trap.Delete();
                 *      }
                 *      else
                 *      {
                 *          from.SendLocalizedMessage( 502372 ); // You fail to disarm the trap... but you don't set it off
                 *      }
                 *
                 *      if ( !isOwner && kit != null )
                 *          kit.ConsumeCharge( from );
                 *  }
                 * }*/
                else
                {
                    from.SendLocalizedMessage(502373);                       // That doesn't appear to be trapped
                }

                if (releaseLock && from is PlayerMobile)
                {
                    ((PlayerMobile)from).EndPlayerAction();
                }
            }
Beispiel #14
0
        public static void Container_Snoop(Container cont, Mobile from)
        {
            if (from.AccessLevel > AccessLevel.Player || from.InRange(cont.GetWorldLocation(), 1))
            {
                Mobile root = cont.RootParent as Mobile;

                if (root != null && !root.Alive)
                {
                    return;
                }

                if (root != null && root.AccessLevel > AccessLevel.Player && from.AccessLevel == AccessLevel.Player)
                {
                    from.SendLocalizedMessage(500209); // You can not peek into the container.
                    return;
                }

                if (root != null && from.AccessLevel == AccessLevel.Player && !CheckSnoopAllowed(from, root))
                {
                    from.SendLocalizedMessage(1001018); // You cannot perform negative acts on your target.
                    return;
                }

                if (root != null && from.AccessLevel == AccessLevel.Player && from.Skills[SkillName.Snooping].Value < Utility.Random(100))
                {
                    Map map = from.Map;

                    if (map != null)
                    {
                        string message = String.Format("You notice {0} attempting to peek into {1}'s belongings.", from.Name, root.Name);

                        IPooledEnumerable eable = map.GetClientsInRange(from.Location, 8);

                        System.Collections.ArrayList list = new System.Collections.ArrayList();

                        foreach (NetState ns in eable)
                        {
                            list.Add(ns);
                        }

                        eable.Free();

                        foreach (NetState ns in list)
                        {
                            if (ns == root.NetState)
                            {
                                root.SendAsciiMessage("You notice {0} attempting to peek into your belongings!", from.Name);
                            }
                            else if (ns != from.NetState)
                            {
                                ns.Mobile.SendAsciiMessage(message);
                            }
                        }
                    }
                }

                // custom change: only lose karma when snooping good guys
                if (from.AccessLevel == AccessLevel.Player && root != null && root.Karma > 0)
                {
                    Titles.AwardKarma(from, -5, true);
                }

                if (from.AccessLevel > AccessLevel.Player || from.CheckTargetSkill(SkillName.Snooping, cont, 0.0, 100.0))
                {
                    TrapableContainer tc = cont as TrapableContainer;

                    if (from.AccessLevel == AccessLevel.Player && tc != null && tc.Trapped && tc.TrapType == TrapType.MagicTrap)
                    {
                        tc.ExecuteTrap(from);
                    }
                    cont.DisplayTo(from);
                }
                else
                {
                    from.SendLocalizedMessage(500210); // You failed to peek into the container.
                }
            }
            else
            {
                from.SendLocalizedMessage(500446); // That is too far away.
            }
        }
Beispiel #15
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (from.Region is UOACZRegion)
                {
                    if (targeted is UOACZScavengeContainer || targeted is UOACZScavengeDebris)
                    {
                        UOACZBaseScavengeObject scavengeObject = targeted as UOACZBaseScavengeObject;

                        scavengeObject.RemoveTrap(from);
                    }

                    else
                    {
                        from.SendMessage("That cannot be trapped.");
                    }

                    return;
                }

                if (targeted is Mobile)
                {
                    from.SendLocalizedMessage(502816);                       // You feel that such an action would be inappropriate
                }
                else if (targeted is TrapableContainer)
                {
                    TrapableContainer targ = (TrapableContainer)targeted;

                    from.Direction = from.GetDirectionTo(targ);

                    if (targ.TrapType == TrapType.None)
                    {
                        from.SendLocalizedMessage(502373);                           // That doesn't appear to be trapped
                        return;
                    }

                    from.PlaySound(0x4D3); //0x241

                    if (targ is BaseTreasureChest)
                    {
                        BaseTreasureChest tchest = targ as BaseTreasureChest;

                        double minSkill = 35.0 + ((int)tchest.Level * 10.0); // 45, 55, 65, 75, 85, 95
                        double maxSkill = 60.0 + ((int)tchest.Level * 10.0); // 70, 80, 90, 100, 110, 120

                        // chance to open l5 at gm: 60%
                        // chance to open l6 at gm: 20%

                        if (from.Skills.RemoveTrap.Value < minSkill && (int)tchest.Level == 1)
                        {
                            from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.RemoveTrapCooldown * 1000);

                            from.CheckTargetSkill(SkillName.RemoveTrap, targ, 0, 100, 1.0);
                            from.SendMessage("You fail to safely remove the trap.");

                            return;
                        }

                        else if (from.Skills.RemoveTrap.Value < minSkill)
                        {
                            from.SendMessage("You do not have sufficient skill to attempt the removal of that trap.");
                            return;
                        }

                        from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.RemoveTrapCooldown * 1000);

                        if (from.CheckTargetSkill(SkillName.RemoveTrap, targ, minSkill, maxSkill, 1.0))
                        {
                            RemoveTrap(from, targ);
                        }

                        else
                        {
                            from.SendLocalizedMessage(502372);                           // You fail to disarm the trap... but you don't set it off
                        }
                    }


                    else if (targ is TreasureMapChest)
                    {
                        TreasureMapChest tchest = targ as TreasureMapChest;

                        double minSkill = TreasureMapChest.RemoveTrapSkillRequiredPerLevel[tchest.Level];
                        double maxSkill = TreasureMapChest.RemoveTrapSkillMaxPerLevel[tchest.Level];

                        if (from.Skills.RemoveTrap.Value < minSkill)
                        {
                            from.SendMessage("You do not have sufficient skill to attempt the removal of that trap.");
                            return;
                        }

                        from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.RemoveTrapCooldown * 1000);

                        if (from.CheckTargetSkill(SkillName.RemoveTrap, targ, minSkill, maxSkill, 1.0))
                        {
                            RemoveTrap(from, targ);
                        }

                        else
                        {
                            from.SendLocalizedMessage(502372);                           // You fail to disarm the trap... but you don't set it off
                        }
                    }

                    else if (from.CheckTargetSkill(SkillName.RemoveTrap, targ, targ.TrapPower, targ.TrapPower + 40, 1.0))
                    {
                        RemoveTrap(from, targ);
                        from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.RemoveTrapCooldown * 1000);
                    }

                    else
                    {
                        from.SendLocalizedMessage(502372); // You fail to disarm the trap... but you don't set it off
                        from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.RemoveTrapCooldown * 1000);
                    }
                }

                else
                {
                    from.SendLocalizedMessage(502373);                       // That does'nt appear to be trapped
                }
            }
Beispiel #16
0
        public override bool OnDoubleClick(Mobile m, object o)
        {
            if (!Controller.InUse)
            {
                return(false);
            }

            if (o is Item)
            {
            }
            else
            {
                return(base.OnDoubleClick(m, o));
            }

            Item item = (Item)o;

            if (item is Corpse)
            {
                m.SendMessage("You may not loot here.");
                return(false);
            }

            if (item is BasePotion && !Controller.Handeling.Potions)
            {
                m.SendMessage("The use of potions is not allowed.");
                return(false);
            }

            if (item is Bandage && !Controller.Handeling.Bandages)
            {
                m.SendMessage("The use of bandages is not allowed.");
                return(false);
            }

            if (item is TrapableContainer && !Controller.Handeling.TrappedContainers)
            {
                TrapableContainer cont = (TrapableContainer)item;
                if (cont.TrapType != TrapType.None)
                {
                    m.SendMessage("The use of trapped containers is not allowed.");
                    return(false);
                }
            }

            if (item is Bola && !Controller.Handeling.Bolas)
            {
                m.SendMessage("The use of bolas is not allowed.");
                return(false);
            }

            if (item is EtherealMount && !Controller.Handeling.Mounts)
            {
                m.SendMessage("The use of mounts is not allowed.");
                return(false);
            }

            if (item is SkillBall || item is StatBall)
            {
                m.SendMessage("The use of skill/stat balls are not allowed here.");
                return(false);
            }

            return(base.OnDoubleClick(m, o));
        }
Beispiel #17
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Mobile)
                {
                    from.SendLocalizedMessage(502816); // You feel that such an action would be inappropriate
                }
                else if (targeted is IRemoveTrapTrainingKit)
                {
                    ((IRemoveTrapTrainingKit)targeted).OnRemoveTrap(from);
                }
                else if (targeted is LockableContainer && ((LockableContainer)targeted).Locked)
                {
                    from.SendLocalizedMessage(501283); // That is locked.
                }
                else if (targeted is TrapableContainer)
                {
                    TrapableContainer targ = (TrapableContainer)targeted;

                    from.Direction = from.GetDirectionTo(targ);

                    if (targ.TrapType == Server.Items.TrapType.None)
                    {
                        from.SendLocalizedMessage(502373); // That doesn't appear to be trapped
                    }
                    else if (targ is TreasureMapChest && TreasureMapInfo.NewSystem)
                    {
                        var tChest = (TreasureMapChest)targ;

                        if (tChest.Owner != from)
                        {
                            from.SendLocalizedMessage(1159010); // That is not your chest!
                        }
                        else if (IsDisarming(from, tChest))
                        {
                            from.SendLocalizedMessage(1159059); // You are already manipulating the trigger mechanism...
                        }
                        else if (IsBeingDisarmed(tChest))
                        {
                            from.SendLocalizedMessage(1159063); // That trap is already being disarmed.
                        }
                        else if (tChest.AncientGuardians.Any(g => !g.Deleted))
                        {
                            from.PrivateOverheadMessage(MessageType.Regular, 1150, 1159060, from.NetState); // *Your attempt fails as the the mechanism jams and you are attacked by an Ancient Chest Guardian!*
                        }
                        else
                        {
                            from.PlaySound(0x241);

                            from.PrivateOverheadMessage(MessageType.Regular, 1150, 1159057, from.NetState); // *You delicately manipulate the trigger mechanism...*

                            StartChestDisarmTimer(from, tChest);
                        }
                    }
                    else
                    {
                        from.PlaySound(0x241);

                        if (from.CheckTargetSkill(SkillName.RemoveTrap, targ, targ.TrapPower - 10, targ.TrapPower + 10))
                        {
                            targ.TrapPower = 0;
                            targ.TrapLevel = 0;
                            targ.TrapType  = TrapType.None;
                            targ.InvalidateProperties();
                            from.SendLocalizedMessage(502377); // You successfully render the trap harmless
                        }
                        else
                        {
                            from.SendLocalizedMessage(502372); // You fail to disarm the trap... but you don't set it off
                        }
                    }
                }
                else if (targeted is VvVTrap)
                {
                    VvVTrap trap = targeted as VvVTrap;

                    if (!ViceVsVirtueSystem.IsVvV(from))
                    {
                        from.SendLocalizedMessage(1155496); // This item can only be used by VvV participants!
                    }
                    else
                    {
                        if (from == trap.Owner || ((from.Skills[SkillName.RemoveTrap].Value - 80.0) / 20.0) > Utility.RandomDouble())
                        {
                            VvVTrapKit kit = new VvVTrapKit(trap.TrapType);
                            trap.Delete();

                            if (!from.AddToBackpack(kit))
                            {
                                kit.MoveToWorld(from.Location, from.Map);
                            }

                            if (trap.Owner != null && from != trap.Owner)
                            {
                                Guild fromG  = from.Guild as Guild;
                                Guild ownerG = trap.Owner.Guild as Guild;

                                if (fromG != null && fromG != ownerG && !fromG.IsAlly(ownerG) && ViceVsVirtueSystem.Instance != null &&
                                    ViceVsVirtueSystem.Instance.Battle != null && ViceVsVirtueSystem.Instance.Battle.OnGoing)
                                {
                                    ViceVsVirtueSystem.Instance.Battle.Update(from, UpdateType.Disarm);
                                }
                            }

                            from.PrivateOverheadMessage(Server.Network.MessageType.Regular, 1154, 1155413, from.NetState);
                        }
                        else if (.1 > Utility.RandomDouble())
                        {
                            trap.Detonate(from);
                        }
                    }
                }
                else if (targeted is GoblinFloorTrap)
                {
                    GoblinFloorTrap targ = (GoblinFloorTrap)targeted;

                    if (from.InRange(targ.Location, 3))
                    {
                        from.Direction = from.GetDirectionTo(targ);

                        if (targ.Owner == null)
                        {
                            Item item = new FloorTrapComponent();

                            if (from.Backpack == null || !from.Backpack.TryDropItem(from, item, false))
                            {
                                item.MoveToWorld(from.Location, from.Map);
                            }
                        }

                        targ.Delete();
                        from.SendLocalizedMessage(502377); // You successfully render the trap harmless
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502373); // That does'nt appear to be trapped
                }
            }
Beispiel #18
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                IEntity entity = targeted as IEntity; if (XmlScript.HasTrigger(entity, TriggerName.onTargeted) && UberScriptTriggers.Trigger(entity, from, TriggerName.onTargeted, null, null, null, 0, null, SkillName.RemoveTrap, from.Skills[SkillName.RemoveTrap].Value))

                {
                    return;
                }

                if (targeted is Mobile)
                {
                    from.SendLocalizedMessage(502816);                       // You feel that such an action would be inappropriate
                }
                else if (targeted is TrapableContainer)
                {
                    TrapableContainer targ = (TrapableContainer)targeted;

                    from.Direction = from.GetDirectionTo(targ);

                    if (targ.TrapType == TrapType.None)
                    {
                        from.SendLocalizedMessage(502373);                           // That doesn't appear to be trapped
                        return;
                    }

                    from.PlaySound(0x241);
                    // treasurechestlevel6 TrapPower is 6 x (20 to 54) = min 120, max 324
                    // treasurechestlevel5 TrapPower is 5 x (20 to 54) = min 100, max 270
                    // treasurechestlevel4 TrapPower is 4 x (10 to 34) = min 40, max 136
                    // treasurechestLevel3 TrapPower is 3 x (1 to 24) = min 3, max 72
                    // treasurechestLevel2 TrapPower is 2 x (1 to 24) = min 2, max 48
                    //... I don't think trap power is the way to go here, I think we have to handle
                    // each type of trap separately
                    double minSkill = targ.TrapPower;
                    double maxSkill = targ.TrapPower + 30.0;
                    if (targ is TreasureChestLevel6)
                    {
                        minSkill = 95; maxSkill = 110;
                    }                                                                   // 1/3 chance at GM
                    else if (targ is TreasureChestLevel5)
                    {
                        minSkill = 95; maxSkill = 102;
                    }                                                                        // 2/3 chance at GM
                    else if (targ is TreasureChestLevel4)
                    {
                        minSkill = 80; maxSkill = 105;
                    }                                                                        // 4/5 chance at GM
                    else if (targ is TreasureMapChest && ((TreasureMapChest)targ).Level >= 4)
                    {
                        int level = ((TreasureMapChest)targ).Level;
                        if (level >= 6)
                        {
                            minSkill = 95; maxSkill = 110;
                        }                                                  // 1/3 chance at GM
                        else if (level == 5)
                        {
                            minSkill = 95; maxSkill = 102;
                        }                                                       // 2/3 chance at GM
                        else if (level == 4)
                        {
                            minSkill = 80; maxSkill = 105;
                        }                                                       // 4/5 chance at GM
                    }
                    else // any other trapable thing, GM remove traps will always get it
                    {
                        if (minSkill > 95.0)
                        {
                            minSkill = 95.0;
                        }
                        if (maxSkill > 100.0)
                        {
                            maxSkill = 100.0;
                        }
                    }

                    //if ( from.CheckTargetSkill( SkillName.RemoveTrap, targ, targ.TrapPower, targ.TrapPower + 30 ) ) // lol, with this formula, many level 4's and all level 5 and 6: removetrap = useless
                    if (from.CheckTargetSkill(SkillName.RemoveTrap, targ, minSkill, maxSkill))
                    {
                        targ.TrapPower = 0;
                        targ.TrapLevel = 0;
                        if (targ.TrapType == TrapType.ExplosionTrap)
                        {
                            from.SendLocalizedMessage(502374); // You carefully remove the trigger for the purple potion.
                        }
                        else if (targ.TrapType == TrapType.DartTrap)
                        {
                            from.SendLocalizedMessage(502375); // You carefully remove the dart from the firing mechanism.
                        }
                        else if (targ.TrapType == TrapType.PoisonTrap)
                        {
                            from.SendLocalizedMessage(502376); // The poison leaks harmlessly away due to your deft touch.
                        }
                        else
                        {
                            from.SendLocalizedMessage(502377); // You successfully render the trap harmless.
                        }
                        targ.TrapType = TrapType.None;
                    }
                    else
                    {
                        from.SendLocalizedMessage(502372);                           // You fail to disarm the trap... but you don't set it off
                    }
                }
                else if (targeted is BaseFactionTrap)
                {
                    BaseFactionTrap trap    = (BaseFactionTrap)targeted;
                    Faction         faction = Faction.Find(from);

                    FactionTrapRemovalKit kit = (from.Backpack == null ? null : from.Backpack.FindItemByType(typeof(FactionTrapRemovalKit)) as FactionTrapRemovalKit);

                    bool isOwner = (trap.Placer == from || (trap.Faction != null && trap.Faction.IsCommander(from)));

                    if (faction == null)
                    {
                        from.SendLocalizedMessage(1010538);                           // You may not disarm faction traps unless you are in an opposing faction
                    }
                    else if (faction == trap.Faction && trap.Faction != null && !isOwner)
                    {
                        from.SendLocalizedMessage(1010537);                           // You may not disarm traps set by your own faction!
                    }
                    else if (!isOwner && kit == null)
                    {
                        from.SendLocalizedMessage(1042530);                           // You must have a trap removal kit at the base level of your pack to disarm a faction trap.
                    }
                    else
                    {
                        //if ( (Core.ML && isOwner) || (from.CheckTargetSkill( SkillName.RemoveTrap, trap, 0.0, 100.0 ))) // && from.CheckTargetSkill( SkillName.Tinkering, trap, 80.0, 100.0 )) )
                        if (Utility.RandomDouble() < 0.25 || from.CheckTargetSkill(SkillName.RemoveTrap, trap, 1.0, 100.0)) // 25% chance or if they have remove trap skill, use that
                        {
                            from.PrivateOverheadMessage(MessageType.Regular, trap.MessageHue, trap.DisarmMessage, from.NetState);

                            if (!isOwner)
                            {
                                //int silver = faction.AwardSilver( from, trap.SilverFromDisarm );

                                //if ( silver > 0 )
                                //	from.SendLocalizedMessage( 1008113, true, silver.ToString( "N0" ) ); // You have been granted faction silver for removing the enemy trap :
                            }

                            trap.Delete();
                        }
                        else
                        {
                            from.SendLocalizedMessage(502372);                               // You fail to disarm the trap... but you don't set it off
                        }
                        if (!isOwner && kit != null)
                        {
                            kit.ConsumeCharge(from);
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502373);                       // That doesn't appear to be trapped
                }
            }
Beispiel #19
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Mobile)
                {
                    from.SendLocalizedMessage(502816); // You feel that such an action would be inappropriate
                }
                else if (targeted is TrapableContainer)
                {
                    TrapableContainer targ = (TrapableContainer)targeted;

                    from.Direction = from.GetDirectionTo(targ);

                    if (targ.TrapType == Server.Items.TrapType.None)
                    {
                        from.SendLocalizedMessage(502373); // That doesn't appear to be trapped
                        return;
                    }

                    from.PlaySound(0x241);

                    if (from.CheckTargetSkill(SkillName.RemoveTrap, targ, targ.TrapPower, targ.TrapPower + 30))
                    {
                        targ.TrapPower = 0;
                        targ.TrapLevel = 0;
                        targ.TrapType  = Server.Items.TrapType.None;
                        from.SendLocalizedMessage(502377); // You successfully render the trap harmless
                    }
                    else
                    {
                        from.SendLocalizedMessage(502372); // You fail to disarm the trap... but you don't set it off
                    }
                }
                else if (targeted is BaseFactionTrap)
                {
                    BaseFactionTrap trap    = (BaseFactionTrap)targeted;
                    Faction         faction = Faction.Find(from);

                    FactionTrapRemovalKit kit = (from.Backpack == null ? null : from.Backpack.FindItemByType(typeof(FactionTrapRemovalKit)) as FactionTrapRemovalKit);

                    bool isOwner = (trap.Placer == from || (trap.Faction != null && trap.Faction.IsCommander(from)));

                    if (faction == null)
                    {
                        from.SendLocalizedMessage(1010538); // You may not disarm faction traps unless you are in an opposing faction
                    }
                    else if (faction == trap.Faction && trap.Faction != null && !isOwner)
                    {
                        from.SendLocalizedMessage(1010537); // You may not disarm traps set by your own faction!
                    }
                    else if (!isOwner && kit == null)
                    {
                        from.SendLocalizedMessage(1042530); // You must have a trap removal kit at the base level of your pack to disarm a faction trap.
                    }
                    else
                    {
                        if ((Core.ML && isOwner) || (from.CheckTargetSkill(SkillName.RemoveTrap, trap, 80.0, 100.0) && from.CheckTargetSkill(SkillName.Tinkering, trap, 80.0, 100.0)))
                        {
                            from.PrivateOverheadMessage(MessageType.Regular, trap.MessageHue, trap.DisarmMessage, from.NetState);

                            if (!isOwner)
                            {
                                int silver = faction.AwardSilver(from, trap.SilverFromDisarm);

                                if (silver > 0)
                                {
                                    from.SendLocalizedMessage(1008113, true, silver.ToString("N0")); // You have been granted faction silver for removing the enemy trap :
                                }
                            }

                            trap.Delete();
                        }
                        else
                        {
                            from.SendLocalizedMessage(502372); // You fail to disarm the trap... but you don't set it off
                        }

                        if (!isOwner && kit != null)
                        {
                            kit.ConsumeCharge(from);
                        }
                    }
                }
                else if (targeted is VvVTrap)
                {
                    VvVTrap trap = targeted as VvVTrap;

                    if (!ViceVsVirtueSystem.IsVvV(from))
                    {
                        from.SendLocalizedMessage(1155496); // This item can only be used by VvV participants!
                    }
                    else
                    {
                        if (from == trap.Owner || ((from.Skills[SkillName.RemoveTrap].Value - 80.0) / 20.0) > Utility.RandomDouble())
                        {
                            VvVTrapKit kit = new VvVTrapKit(trap.TrapType);
                            trap.Delete();

                            if (!from.AddToBackpack(kit))
                            {
                                kit.MoveToWorld(from.Location, from.Map);
                            }

                            if (trap.Owner != null && from != trap.Owner)
                            {
                                Guild fromG  = from.Guild as Guild;
                                Guild ownerG = trap.Owner.Guild as Guild;

                                if (fromG != null && fromG != ownerG && !fromG.IsAlly(ownerG) && ViceVsVirtueSystem.Instance != null &&
                                    ViceVsVirtueSystem.Instance.Battle != null && ViceVsVirtueSystem.Instance.Battle.OnGoing)
                                {
                                    ViceVsVirtueSystem.Instance.Battle.Update(from, UpdateType.Disarm);
                                }
                            }

                            from.PrivateOverheadMessage(Server.Network.MessageType.Regular, 1154, 1155413, from.NetState);
                        }
                        else if (.1 > Utility.RandomDouble())
                        {
                            trap.Detonate(from);
                        }
                    }
                }
                else if (targeted is GoblinFloorTrap)
                {
                    GoblinFloorTrap targ = (GoblinFloorTrap)targeted;

                    if (from.InRange(targ.Location, 3))
                    {
                        from.Direction = from.GetDirectionTo(targ);

                        if (targ.Owner == null)
                        {
                            Item item = new FloorTrapComponent();

                            if (from.Backpack == null || !from.Backpack.TryDropItem(from, item, false))
                            {
                                item.MoveToWorld(from.Location, from.Map);
                            }
                        }

                        targ.Delete();
                        from.SendLocalizedMessage(502377); // You successfully render the trap harmless
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502373); // That does'nt appear to be trapped
                }
            }
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Mobile)
                {
                    from.SendLocalizedMessage(502816);                     // You feel that such an action would be inappropriate
                }
                else if (targeted is TrapableContainer)
                {
                    TrapableContainer targ = (TrapableContainer)targeted;

                    from.Direction = from.GetDirectionTo(targ);

                    if (targ.TrapType == TrapType.None)
                    {
                        from.SendLocalizedMessage(502373);                         // That doesn't appear to be trapped
                        return;
                    }

                    from.PlaySound(0x241);

                    double minskill = targ.TrapPower;
                    //modify minskill with detect hidden skill
                    if (from.Skills[SkillName.DetectHidden].Base > 50.0)
                    {
                        minskill -= (from.Skills[SkillName.DetectHidden].Base - 50.0);
                    }
                    double maxskill = minskill + 50;

                    //What this means is that with a trappower of 125 (level 5 tmap) and
                    //GM DH, min RT skill to unlock is 75 and max is 100, OR, rather,
                    //DH and RT need to be above a combined 175 to have a chance at disarming
                    //the trap.
                    //Level 4 power (100), they need to have above 150 total to have a chance.

                    if (from.AccessLevel >= AccessLevel.GameMaster)                        //This line added by Old Salty
                    {
                        from.SendMessage(string.Format("minskill is {0}, maxskill is {1}", minskill, maxskill));
                    }

                    if (from.CheckTargetSkill(SkillName.RemoveTrap, targ, minskill, maxskill))
                    {
                        targ.TrapPower = 0;
                        targ.TrapLevel = 0;
                        targ.TrapType  = TrapType.None;
                        from.SendLocalizedMessage(502377);                         // You successfully render the trap harmless
                    }
                    else
                    {
                        //chance to set off trap...
                        if (targ.OnFailDisarm(from))
                        {
                        }
                        else
                        {
                            from.SendLocalizedMessage(502372);                             // You fail to disarm the trap... but you don't set it off
                        }
                    }

                    //pla: set 10 second delay before next skill use
                    from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(10.0);
                }
                else if (targeted is BaseFactionTrap)
                {
                    BaseFactionTrap trap    = (BaseFactionTrap)targeted;
                    Faction         faction = Faction.Find(from);

                    FactionTrapRemovalKit kit = (from.Backpack == null ? null : from.Backpack.FindItemByType(typeof(FactionTrapRemovalKit)) as FactionTrapRemovalKit);

                    bool isOwner = (trap.Placer == from || (trap.Faction != null && trap.Faction.IsCommander(from)));

                    if (faction == null)
                    {
                        from.SendLocalizedMessage(1010538);                         // You may not disarm faction traps unless you are in an opposing faction
                    }
                    else if (faction == trap.Faction && trap.Faction != null && !isOwner)
                    {
                        from.SendLocalizedMessage(1010537);                         // You may not disarm traps set by your own faction!
                    }
                    else if (!isOwner && kit == null)
                    {
                        from.SendLocalizedMessage(1042530);                         // You must have a trap removal kit at the base level of your pack to disarm a faction trap.
                    }
                    else
                    {
                        if (from.CheckTargetSkill(SkillName.RemoveTrap, trap, 80.0, 100.0) && from.CheckTargetSkill(SkillName.Tinkering, trap, 80.0, 100.0))
                        {
                            from.PrivateOverheadMessage(MessageType.Regular, trap.MessageHue, trap.DisarmMessage, from.NetState);

                            if (!isOwner)
                            {
                                int silver = faction.AwardSilver(from, trap.SilverFromDisarm);

                                if (silver > 0)
                                {
                                    from.SendLocalizedMessage(1008113, true, silver.ToString("N0"));                                     // You have been granted faction silver for removing the enemy trap :
                                }
                            }

                            trap.Delete();
                        }
                        else
                        {
                            from.SendLocalizedMessage(502372);                             // You fail to disarm the trap... but you don't set it off
                        }

                        if (!isOwner && kit != null)
                        {
                            kit.ConsumeCharge(from);
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502373);                     // That does'nt appear to be trapped
                }
            }
Beispiel #21
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Mobile)
                {
                    from.SendLocalizedMessage(502816);                       // You feel that such an action would be inappropriate
                }
                else if (targeted is TrapableContainer)
                {
                    TrapableContainer targ = (TrapableContainer)targeted;

                    from.Direction = from.GetDirectionTo(targ);

                    if (targ.TrapType == TrapType.None)
                    {
                        from.SendLocalizedMessage(502373);                           // That doesn't appear to be trapped
                        return;
                    }

                    from.PlaySound(0x241);

                    if (from.CheckTargetSkill(SkillName.RemoveTrap, targ, targ.TrapPower, targ.TrapPower + 30))
                    {
                        switch (targ.TrapType)
                        {
                        case TrapType.ExplosionTrap:
                            from.LocalOverheadMessage(Network.MessageType.Regular, 0x78, 502374);                                       // You carefully remove the trigger for the purple potion.
                            break;

                        case TrapType.DartTrap:
                            from.LocalOverheadMessage(Network.MessageType.Regular, 0x62, 502375);                                       // You carefully remove the dart from the firing mechanism.
                            break;

                        case TrapType.PoisonTrap:
                            from.LocalOverheadMessage(Network.MessageType.Regular, 0x44, 502376);                                       // The poison leaks harmlessly away due to your deft touch.
                            break;

                        default:
                            from.LocalOverheadMessage(Network.MessageType.Regular, 0x53, 502377);                                       // You successfully render the trap harmless
                            break;
                        }

                        targ.TrapEnabled = false;
                        targ.TrapPower   = 0;
                        targ.TrapLevel   = 0;
                        targ.TrapType    = TrapType.None;
                    }
                    else
                    {
                        if (Utility.RandomDouble() <= 0.2)
                        {
                            from.SendLocalizedMessage(502370);                               // Oops.

                            targ.ExecuteTrap(from);
                        }
                        else
                        {
                            from.SendLocalizedMessage(502371);                               // You breathe a sigh of relief, as you fail to disarm the trap, but don't set it off.
                        }
                    }
                }
                else if (targeted is BaseFactionTrap)
                {
                    BaseFactionTrap trap    = (BaseFactionTrap)targeted;
                    Faction         faction = Faction.Find(from);

                    FactionTrapRemovalKit kit = (from.Backpack == null ? null : from.Backpack.FindItemByType(typeof(FactionTrapRemovalKit)) as FactionTrapRemovalKit);

                    bool isOwner = (trap.Placer == from || (trap.Faction != null && trap.Faction.IsCommander(from)));

                    if (faction == null)
                    {
                        from.SendLocalizedMessage(1010538);                           // You may not disarm faction traps unless you are in an opposing faction
                    }
                    else if (faction == trap.Faction && trap.Faction != null && !isOwner)
                    {
                        from.SendLocalizedMessage(1010537);                           // You may not disarm traps set by your own faction!
                    }
                    else if (!isOwner && kit == null)
                    {
                        from.SendLocalizedMessage(1042530);                           // You must have a trap removal kit at the base level of your pack to disarm a faction trap.
                    }
                    else
                    {
                        if (isOwner || (from.CheckTargetSkill(SkillName.RemoveTrap, trap, 80.0, 100.0) && from.CheckTargetSkill(SkillName.Tinkering, trap, 80.0, 100.0)))
                        {
                            from.PrivateOverheadMessage(MessageType.Regular, trap.MessageHue, trap.DisarmMessage, from.Client);

                            if (!isOwner)
                            {
                                int silver = faction.AwardSilver(from, trap.SilverFromDisarm);

                                if (silver > 0)
                                {
                                    from.SendLocalizedMessage(1008113, true, silver.ToString("N0"));                                         // You have been granted faction silver for removing the enemy trap :
                                }
                            }

                            trap.Delete();
                        }
                        else
                        {
                            from.SendLocalizedMessage(502372);                               // You fail to disarm the trap... but you don't set it off
                        }

                        if (!isOwner && kit != null)
                        {
                            kit.ConsumeCharge(from);
                        }
                    }
                }
                else if (targeted is GoblinTrap)
                {
                    GoblinTrap targ = (GoblinTrap)targeted;

                    from.Direction = from.GetDirectionTo(targ);
                    from.PlaySound(0x241);

                    if (from.CheckTargetSkill(SkillName.RemoveTrap, targ, 0.0, 100.0))
                    {
                        from.LocalOverheadMessage(Network.MessageType.Regular, 0x53, 502377);                           // You successfully render the trap harmless
                        GoblinTrapGenerator.DisableTrap(from, targ);
                    }
                    else
                    {
                        if (Utility.RandomDouble() <= 0.2)
                        {
                            from.SendLocalizedMessage(502370);                               // Oops.
                            targ.ExecuteTrap(from);
                        }
                        else
                        {
                            from.SendLocalizedMessage(502371);                               // You breathe a sigh of relief, as you fail to disarm the trap, but don't set it off.
                        }
                    }
                }
                else if (targeted is FloorTrap)
                {
                    FloorTrap targ = (FloorTrap)targeted;

                    from.Direction = from.GetDirectionTo(targ);
                    from.PlaySound(0x241);

                    if (from.CheckTargetSkill(SkillName.RemoveTrap, targ, targ.TinkerLevel, 110.0))
                    {
                        new FloorTrapKit().MoveToWorld(targ.Location, targ.Map);

                        from.LocalOverheadMessage(Network.MessageType.Regular, 0x53, 502377);                           // You successfully render the trap harmless
                        targ.Expire();
                    }
                    else
                    {
                        if (Utility.RandomDouble() <= 0.2)
                        {
                            from.SendLocalizedMessage(502370);                               // Oops.
                            targ.ExecuteTrap(from);
                        }
                        else
                        {
                            targ.FailedRemoveTrapAttempt();
                            from.SendLocalizedMessage(502371);                               // You breathe a sigh of relief, as you fail to disarm the trap, but don't set it off.
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502373);                       // That does'nt appear to be trapped
                }
            }
Beispiel #22
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Mobile)
                {
                    from.SendLocalizedMessage(502816);                       // You feel that such an action would be inappropriate
                }
                else if (targeted is TrapableContainer)
                {
                    TrapableContainer targ = (TrapableContainer)targeted;

                    from.Direction = from.GetDirectionTo(targ);

                    if (targ.TrapType == TrapType.None)
                    {
                        from.SendLocalizedMessage(502373);                           // That doesn't appear to be trapped
                        return;
                    }

                    from.PlaySound(0x241);

                    double minskill = targ.TrapPower;
                    //modify minskill with detect hidden skill
                    if (from.Skills[SkillName.DetectHidden].Base > 50.0)
                    {
                        minskill -= (from.Skills[SkillName.DetectHidden].Base - 50.0);
                    }
                    double maxskill = minskill + 50;

                    //What this means is that with a trappower of 125 (level 5 tmap) and
                    //GM DH, min RT skill to unlock is 75 and max is 100, OR, rather,
                    //DH and RT need to be above a combined 175 to have a chance at disarming
                    //the trap.
                    //Level 4 power (100), they need to have above 150 total to have a chance.

                    if (from.AccessLevel >= AccessLevel.GameMaster)                          //This line added by Old Salty
                    {
                        from.SendMessage(string.Format("minskill is {0}, maxskill is {1}", minskill, maxskill));
                    }

                    if (from.CheckTargetSkill(
                            SkillName.RemoveTrap,
                            targ,
                            minskill,
                            maxskill))
                    {
                        targ.TrapPower = 0;
                        targ.TrapType  = TrapType.None;
                        from.SendLocalizedMessage(502377);                           // You successfully render the trap harmless
                    }
                    else
                    {
                        //chance to set off trap...
                        if (targ.OnFailDisarm(from))
                        {
                        }
                        else
                        {
                            from.SendLocalizedMessage(502372);                               // You fail to disarm the trap... but you don't set it off
                        }
                    }

                    //pla: set 10 second delay before next skill use
                    from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(10.0);
                }
                else
                {
                    from.SendLocalizedMessage(502373);                       // That does'nt appear to be trapped
                }
            }
Beispiel #23
0
        private void OnTrapTarget(TrapType type, object target)
        {
            if (m_Mobile.Deleted || !m_Mobile.Alive || !CheckTool())
            {
                End();
                return;
            }

            if (!HasResources(1, typeof(TrapableContainer)))
            {
                OnNotEnoughResources();
                End();
                return;
            }

            if (target is TrapableContainer && !(target is Pouch))
            {
                TrapableContainer cont = (TrapableContainer)target;
                if (cont.RootParent != m_Mobile && cont.RootParent != null)
                {
                    End();
                    m_Mobile.SendAsciiMessage("That does not belong to you.");
                    return;
                }
                else if (!m_Mobile.InRange(cont.GetWorldLocation(), 1))
                {
                    End();
                    m_Mobile.SendAsciiMessage("That is too far away.");
                    return;
                }
                else if (cont.Trapped)
                {
                    End();
                    m_Mobile.SendAsciiMessage("You can only place one trap at a time.");
                    return;
                }
                else if (cont is LockableContainer && ((LockableContainer)cont).Locked)
                {
                    End();
                    m_Mobile.SendAsciiMessage("You cannot trap a locked container.");
                    return;
                }

                Container pack = m_Mobile.Backpack;
                if (pack == null)
                {
                    End();
                    m_Mobile.SendAsciiMessage("You need additional resources to create the trap.");
                    return;
                }

                Item xres = null;
                switch (type)
                {
                case TrapType.DartTrap:
                    xres = pack.FindItemByType(typeof(Bolt));
                    if (xres == null)
                    {
                        m_Mobile.SendAsciiMessage("You need a crossbow bolt to make that trap.");
                    }
                    else
                    {
                        cont.TrapPower = (int)(m_Mobile.Skills[SkillName.Tinkering].Value / 10.0);
                    }
                    break;

                case TrapType.PoisonTrap:
                    xres = pack.FindItemByType(typeof(BasePoisonPotion));
                    if (xres == null)
                    {
                        m_Mobile.SendAsciiMessage("You need a green potion to make that trap.");
                    }
                    else
                    {
                        cont.TrapPower = ((BasePoisonPotion)xres).Poison.Level + 1;
                    }
                    break;

                case TrapType.ExplosionTrap:
                    xres = pack.FindItemByType(typeof(BaseExplosionPotion));
                    if (xres == null)
                    {
                        m_Mobile.SendAsciiMessage("You need a purple potion to make that trap.");
                    }
                    else
                    {
                        //BaseExplosionPotion pot = (BaseExplosionPotion)xres;
                        //cont.TrapPower = (int)(Utility.RandomMinMax( pot.MinDamage, pot.MaxDamage ) * ( m_Mobile.Skills[SkillName.Tinkering].Value / 10.0 ));
                        if (xres is ExplosionPotion)
                        {
                            cont.TrapPower = 3;
                        }
                        else if (xres is GreaterExplosionPotion)
                        {
                            cont.TrapPower = 5;
                        }
                        else                                 //if ( xres is LesserExplosionPotion )
                        {
                            cont.TrapPower = 1;
                        }
                    }
                    break;
                }

                if (xres == null || xres.Amount < 1 || !ConsumeResources(1, typeof(TrapableContainer)))
                {
                    OnNotEnoughResources();
                    End();
                    return;
                }
                xres.Consume(1);

                if (m_Mobile.CheckSkill(SkillName.Tinkering, 0, 100))
                {
                    cont.TrapType = type;
                    cont.Trapped  = true;
                    cont.Trapper  = m_Mobile;
                    m_Mobile.SendAsciiMessage("You carefully set a trap on the container...");
                }
                else
                {
                    cont.TrapPower = 0;
                    m_Mobile.SendAsciiMessage("You failed to set the trap.");
                }
            }
            else
            {
                m_Mobile.SendAsciiMessage("You can't trap that.");
            }
            End();
        }
Beispiel #24
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Mobile)
                {
                    from.SendLocalizedMessage(502816);                       // You feel that such an action would be inappropriate
                }
                else if (targeted is TrapableContainer)
                {
                    TrapableContainer targ = (TrapableContainer)targeted;

                    from.Direction = from.GetDirectionTo(targ);

                    int nTrapLevel = targ.TrapLevel * 10;

                    if (targ.TrapType == TrapType.None)
                    {
                        from.SendLocalizedMessage(502373);                           // That doesn't appear to be trapped
                        return;
                    }

                    if ((int)(from.Skills[SkillName.RemoveTrap].Value) < nTrapLevel)
                    {
                        from.SendMessage("This trap looks too complicated for you.");
                        return;
                    }

                    from.PlaySound(0x241);

                    // if ( from.CheckTargetSkill( SkillName.RemoveTrap, targ, targ.TrapPower, targ.TrapPower + 30 ) )
                    nTrapLevel = nTrapLevel + 20;
                    if (from.CheckTargetSkill(SkillName.RemoveTrap, targ, 0, nTrapLevel))
                    {
                        targ.TrapPower = 0;
                        targ.TrapLevel = 0;
                        targ.TrapType  = TrapType.None;
                        from.SendLocalizedMessage(502377);                           // You successfully render the trap harmless
                    }
                    else
                    {
                        from.SendLocalizedMessage(502372);                           // You fail to disarm the trap... but you don't set it off
                    }
                }
                else if (targeted is BaseFactionTrap)
                {
                    BaseFactionTrap trap    = (BaseFactionTrap)targeted;
                    Faction         faction = Faction.Find(from);

                    FactionTrapRemovalKit kit = (from.Backpack == null ? null : from.Backpack.FindItemByType(typeof(FactionTrapRemovalKit)) as FactionTrapRemovalKit);

                    bool isOwner = (trap.Placer == from || (trap.Faction != null && trap.Faction.IsCommander(from)));

                    if (faction == null)
                    {
                        from.SendLocalizedMessage(1010538);                           // You may not disarm faction traps unless you are in an opposing faction
                    }
                    else if (faction == trap.Faction && trap.Faction != null && !isOwner)
                    {
                        from.SendLocalizedMessage(1010537);                           // You may not disarm traps set by your own faction!
                    }
                    else if (!isOwner && kit == null)
                    {
                        from.SendLocalizedMessage(1042530);                           // You must have a trap removal kit at the base level of your pack to disarm a faction trap.
                    }
                    else
                    {
                        if ((Core.ML && isOwner) || (from.CheckTargetSkill(SkillName.RemoveTrap, trap, 80.0, 125.0) && from.CheckTargetSkill(SkillName.Tinkering, trap, 80.0, 100.0)))
                        {
                            from.PrivateOverheadMessage(MessageType.Regular, trap.MessageHue, trap.DisarmMessage, from.NetState);

                            if (!isOwner)
                            {
                                int silver = faction.AwardSilver(from, trap.SilverFromDisarm);

                                if (silver > 0)
                                {
                                    from.SendLocalizedMessage(1008113, true, silver.ToString("N0"));                                         // You have been granted faction silver for removing the enemy trap :
                                }
                            }

                            trap.Delete();
                        }
                        else
                        {
                            from.SendLocalizedMessage(502372);                               // You fail to disarm the trap... but you don't set it off
                        }

                        if (!isOwner && kit != null)
                        {
                            kit.ConsumeCharge(from);
                        }
                    }
                }
                else if (targeted is Item)
                {
                    if ((Item)targeted is HiddenTrap)
                    {
                        from.PlaySound(0x241);

                        if (from.CheckSkill(SkillName.RemoveTrap, 0, 125))
                        {
                            Item HideTrap = (Item)targeted;
                            HideTrap.Delete();
                            from.SendLocalizedMessage(502377);                               // You successfully render the trap harmless
                        }
                        else
                        {
                            from.SendLocalizedMessage(502372);                               // You fail to disarm the trap... but you don't set it off
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(502373);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502373);                       // That does'nt appear to be trapped
                }
            }
            protected override void OnTarget(Mobile src, object targ)
            {
                bool foundAnything = false;

                double  srcSkill = src.Skills[SkillName.DetectHidden].Value;
                Point3D p;

                if (targ is Mobile)
                {
                    p = ((Mobile)targ).Location;
                }
                else if (targ is Item)
                {
                    p = ((Item)targ).Location;
                }
                else if (targ is IPoint3D)
                {
                    p = new Point3D((IPoint3D)targ);
                }
                else
                {
                    p = src.Location;
                }

                double skillLevel = src.Skills.DetectHidden.Value;

                bool success = src.CheckSkill(SkillName.DetectHidden, 0.0, 100.0);
                int  range   = ((int)Math.Min(100.0, skillLevel)) / 25;

                BaseHouse house   = BaseHouse.FindHouseAt(p, src.Map, 16);
                bool      inHouse = (house != null && house.IsFriend(src));

                if (success || inHouse)
                {
                    IPooledEnumerable inRange = src.Map.GetMobilesInRange(p, inHouse ? 22 : range);
                    foreach (Mobile trg in inRange)
                    {
                        if (trg.Hidden && src != trg)
                        {
                            double ss = srcSkill + Utility.RandomMinMax(-20, 20);
                            double ts = trg.Skills[SkillName.Hiding].Value + Utility.RandomMinMax(-20, 20);
                            if (src.AccessLevel >= trg.AccessLevel && (!inHouse && ss >= ts || inHouse && house.IsInside(trg)))
                            {
                                trg.RevealingAction();
                                trg.SendLocalizedMessage(500814); // You have been revealed!
                                foundAnything = true;
                            }
                        }
                    }
                    inRange.Free();



                    inRange = src.Map.GetItemsInRange(p, range);
                    foreach (Item trg in inRange)
                    {
                        if (!(trg is TrapableContainer))
                        {
                            continue;
                        }
                        TrapableContainer cont = (TrapableContainer)trg;
                        if (cont.Visible && cont.Trapped && Utility.RandomDouble() * 100 < skillLevel)
                        {
                            int hue;
                            switch (cont.TrapType)
                            {
                            case TrapType.DartTrap:
                                hue = 123;
                                break;

                            case TrapType.ExplosionTrap:
                            case TrapType.MagicTrap:
                                hue = 0x7D;
                                break;

                            case TrapType.PoisonTrap:
                                hue = 90;
                                break;

                            default:
                                hue = 0x3B2;
                                break;
                            }
                            src.Send(new Server.Network.MessageLocalized(cont.Serial, cont.ItemID, Server.Network.MessageType.Regular, hue, 3, 500813, "", "")); // [trapped]
                            foundAnything = true;
                        }
                    }
                    inRange.Free();
                }

                if (!foundAnything)
                {
                    src.SendLocalizedMessage(500817); // You can see nothing hidden there.
                }
            }
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Mobile)
                {
                    from.SendLocalizedMessage(502816);                       // You feel that such an action would be inappropriate
                }
                else if (targeted is TrapableContainer)
                {
                    if (from.Skills[SkillName.Lockpicking].Value < 50)
                    {
                        from.SendLocalizedMessage(502366);                           // You do not know enough about locks.  Become better at picking locks.
                        return;
                    }
                    else if (from.Skills[SkillName.DetectHidden].Value < 50)
                    {
                        from.SendLocalizedMessage(502367);                           // You are not perceptive enough.  Become better at detect hidden.
                        return;
                    }

                    TrapableContainer targ = (TrapableContainer)targeted;

                    from.Direction = from.GetDirectionTo(targ);

                    if (targ.TrapType == TrapType.None)
                    {
                        from.SendLocalizedMessage(502373);                           // That doesn't appear to be trapped
                        return;
                    }

                    from.PlaySound(0x241);

                    int minskill;
                    int maxskill;
                    LockableContainer lc = targ as LockableContainer;
                    if (lc != null && (targ.TrapType == TrapType.ExplosionTrap || targ.TrapType == TrapType.PoisonTrap))
                    {
                        // values used for tinkertraps
                        maxskill = targ.TrapPower;
                        minskill = (int)(targ.TrapPower * 0.8);
                    }
                    else                     // original values
                    {
                        maxskill = targ.TrapPower + 30;
                        minskill = targ.TrapPower;
                    }

                    if (from.CheckTargetSkill(SkillName.RemoveTrap, targ, minskill, maxskill))
                    {
                        targ.TrapPower = 0;
                        targ.TrapLevel = 0;
                        targ.TrapType  = TrapType.None;
                        from.SendLocalizedMessage(502377);                           // You successfully render the trap harmless
                    }
                    else
                    {
                        from.SendLocalizedMessage(502372);                           // You fail to disarm the trap... but you don't set it off
                    }
                }
                else if (targeted is BaseFactionTrap)
                {
                    BaseFactionTrap trap    = (BaseFactionTrap)targeted;
                    Faction         faction = Faction.Find(from);

                    FactionTrapRemovalKit kit = (from.Backpack == null ? null : from.Backpack.FindItemByType(typeof(FactionTrapRemovalKit)) as FactionTrapRemovalKit);

                    bool commander = trap.Faction != null && trap.Faction.IsCommander(from);

                    bool isOwner = (trap.Placer == from || commander);


                    if (!commander && from.Skills[SkillName.Lockpicking].Value < 50)
                    {
                        from.SendLocalizedMessage(502366);                           // You do not know enough about locks.  Become better at picking locks.
                    }
                    else if (!commander && from.Skills[SkillName.DetectHidden].Value < 50)
                    {
                        from.SendLocalizedMessage(502367);                           // You are not perceptive enough.  Become better at detect hidden.
                    }
                    else if (faction == null)
                    {
                        from.SendLocalizedMessage(1010538);                           // You may not disarm faction traps unless you are in an opposing faction
                    }
                    else if (faction == trap.Faction /*&& trap.Faction != null*/ && !isOwner)
                    {
                        from.SendLocalizedMessage(1010537);                           // You may not disarm traps set by your own faction!
                    }
                    else if (trap.Faction != null && kit == null)
                    {
                        from.SendLocalizedMessage(1042530);                           // You must have a trap removal kit at the base level of your pack to disarm a faction trap.
                    }
                    else
                    {
                        if (from.CheckTargetSkill(SkillName.RemoveTrap, trap, 80.0, 100.0) || commander)
                        {
                            from.PrivateOverheadMessage(MessageType.Regular, trap.MessageHue, trap.DisarmMessage, from.NetState);

                            if (!isOwner)
                            {
                                int silver = faction.AwardSilver(from, trap.SilverFromDisarm);

                                if (silver > 0)
                                {
                                    from.SendLocalizedMessage(1008113, true, silver.ToString("N0"));                                         // You have been granted faction silver for removing the enemy trap :
                                }
                            }

                            trap.Delete();
                        }
                        else
                        {
                            from.SendLocalizedMessage(502372);                               // You fail to disarm the trap... but you don't set it off
                        }
                        if (!isOwner && kit != null)
                        {
                            kit.ConsumeCharge(from);
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502373);                       // That doesn't appear to be trapped
                }
            }
            protected override void OnTarget(Mobile src, object targ)
            {
                bool foundAnyone = true;

                Point3D p;

                if (targ is Mobile)
                {
                    p = ((Mobile)targ).Location;
                }
                else if (targ is Item)
                {
                    p = ((Item)targ).Location;
                }
                else if (targ is IPoint3D)
                {
                    p = new Point3D((IPoint3D)targ);
                }
                else
                {
                    p = src.Location;
                }

                //Added functionality for assessing whether a container is trapped,
                //and how likely the player will be to disarm it. (Old Salty, 8/15/04)
                if (targ is TrapableContainer)
                {
                    TrapableContainer trap = (TrapableContainer)targ;
                    if (trap.TrapType == TrapType.None)
                    {
                        src.SendLocalizedMessage(502373);                         // That doesn't appear to be trapped
                        return;
                    }
                    else if (trap.TrapType != TrapType.None && src.CheckSkill(SkillName.DetectHidden, 0.0, 100.0))
                    {
                        string level = "unknown";
                        switch (trap.TrapPower / 25)
                        {
                        case 1:
                            level = "It appears to be protected by a simple and obvious trap."; break;

                        case 2:
                            level = "It seems to be guarded by a somewhat clever trap."; break;

                        case 3:
                            level = "It is protected by a respectably complex trap."; break;

                        case 4:
                            level = "It appears to be guarded by an impressively devious trap."; break;

                        case 5:
                            level = "It is defended by a dauntingly intricate and dangerous trap."; break;
                        }
                        src.LocalOverheadMessage(0, 33, false, level);

                        double minskill = trap.TrapPower;
                        //modify minskill with detect hidden skill
                        if (src.Skills[SkillName.DetectHidden].Base > 50.0)
                        {
                            minskill -= (src.Skills[SkillName.DetectHidden].Base - 50.0);
                        }
                        double maxskill = minskill + 50;
                        double RTskill  = src.Skills[SkillName.RemoveTrap].Value;

                        if (RTskill <= minskill)
                        {
                            src.SendMessage("You are baffled by the complexity of this trap.");
                        }
                        else if (RTskill > minskill && RTskill < maxskill)
                        {
                            if (RTskill - minskill <= maxskill - RTskill)
                            {
                                src.SendMessage("You have a fair chance at disarming this trap.");
                            }
                            else if (RTskill - minskill > maxskill - RTskill)
                            {
                                src.SendMessage("You have a very good chance at disarming this trap.");
                            }
                        }
                        else
                        {
                            src.SendMessage("You could disable this trap with ease.");
                        }
                    }

                    return;
                }
                //end addition by OldSalty

                double srcSkill = src.Skills[SkillName.DetectHidden].Value;
                int    range    = (int)(srcSkill / 10.0);

                if (!src.CheckSkill(SkillName.DetectHidden, 0.0, 100.0))
                {
                    range /= 2;
                }

                //pla: remove house stuff from here as it's now implelemted additonally after the standard distance DH check


                //BaseHouse house = BaseHouse.FindHouseAt( p, src.Map, 16 );
                //bool inHouse = ( house != null && house.IsFriend( src ) );

                //if ( inHouse )
                //	range = 22;

                if (range > 0)
                {
                    IPooledEnumerable inRange = src.Map.GetMobilesInRange(p, range);

                    foreach (Mobile trg in inRange)
                    {
                        if (trg.Hidden && src != trg)
                        {
                            double ss = srcSkill + Utility.Random(21) - 10;
                            double ts = trg.Skills[SkillName.Hiding].Value + Utility.Random(21) - 10;

                            //pla: removed house bits from this check too
                            if (src.AccessLevel >= trg.AccessLevel && (ss >= ts))
                            {
                                trg.RevealingAction();
                                trg.SendLocalizedMessage(500814);                                 // You have been revealed!
                                foundAnyone = true;
                            }
                        }
                    }
                    inRange.Free();
                }

                //pla: if the mobile is in a friended house and targets a spot within the same house
                //then reveal all mobiles within the housing region regardless of skill checks
                BaseHouse house = BaseHouse.FindHouseAt(p, src.Map, 16);

                if (house != null && house.IsInside(src) && house.IsFriend(src))
                {
                    foreach (Mobile m in house.Region.Mobiles.Values)
                    {
                        if (m.Hidden && m != src)
                        {
                            m.RevealingAction();
                            m.SendLocalizedMessage(500814);                             // You have been revealed!
                            foundAnyone = true;
                        }
                    }
                }

                if (!foundAnyone)
                {
                    src.SendLocalizedMessage(500817);                     // You can see nothing hidden there.
                }
            }
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is BaseCreature)
                {
                    BaseCreature creature = (BaseCreature)targeted;

                    if (from.CheckTargetSkill(SkillName.RemoveTrap, creature, 30, 100))
                    {
                        if (creature is Turret)
                        {
                            creature.Kill();
                            from.SendMessage("You have disarmed the trap.");
                        }
                        else
                        {
                            from.SendLocalizedMessage(502816);                               // You feel that such an action would be inappropriate
                        }
                    }
                }
                else if (targeted is BoulderTrap)
                {
                    BoulderTrap bouldertrap = (BoulderTrap)targeted;

                    if (from.Skills.RemoveTrap.Base >= 75.0)
                    {
                        bouldertrap.Delete();
                        from.PlaySound(0x5CE);
                        from.SendMessage("You have disarmed the trap.");
                    }
                    else if (from.CheckTargetSkill(SkillName.RemoveTrap, bouldertrap, 50, 85))
                    {
                        bouldertrap.Delete();
                        from.PlaySound(0x5CE);
                        from.SendMessage("You have disarmed the trap.");
                        from.Skills.RemoveTrap.Base += 1;
                    }
                    else
                    {
                        from.SendMessage("You fail to disarm the trap.");
                    }
                }
                else if (targeted is BoulderTrap2)
                {
                    BoulderTrap2 bouldertrap2 = (BoulderTrap2)targeted;

                    if (from.Skills.RemoveTrap.Base >= 75.0)
                    {
                        bouldertrap2.Delete();
                        from.PlaySound(0x5CE);
                        from.SendMessage("You have disarmed the trap.");
                    }
                    else if (from.CheckTargetSkill(SkillName.RemoveTrap, bouldertrap2, 50, 85))
                    {
                        bouldertrap2.Delete();
                        from.PlaySound(0x5CE);
                        from.SendMessage("You have disarmed the trap.");
                        from.Skills.RemoveTrap.Base += 1;
                    }
                    else
                    {
                        from.SendMessage("You fail to disarm the trap.");
                    }
                }
                else if (targeted is MovingTrap)
                {
                    MovingTrap movingtrap = (MovingTrap)targeted;

                    if (from.Skills.RemoveTrap.Base >= 30.0)
                    {
                        movingtrap.Delete();
                        from.PlaySound(0x5CE);
                        from.SendMessage("You have disarmed the trap.");
                    }
                    else if (from.CheckTargetSkill(SkillName.RemoveTrap, movingtrap, 0, 30))
                    {
                        movingtrap.Delete();
                        from.PlaySound(0x5CE);
                        from.SendMessage("You have disarmed the trap.");
                        from.Skills.RemoveTrap.Base += 1;
                    }
                    else
                    {
                        from.SendMessage("You fail to disarm the trap.");
                    }
                }
                else if (targeted is MovingTrap2)
                {
                    MovingTrap2 movingtrap2 = (MovingTrap2)targeted;

                    if (from.Skills.RemoveTrap.Base >= 30.0)
                    {
                        movingtrap2.Delete();
                        from.PlaySound(0x5CE);
                        from.SendMessage("You have disarmed the trap.");
                    }

                    else if (from.CheckTargetSkill(SkillName.RemoveTrap, movingtrap2, 0, 30))
                    {
                        movingtrap2.Delete();
                        from.PlaySound(0x5CE);
                        from.SendMessage("You have disarmed the trap.");
                        from.Skills.RemoveTrap.Base += 1;
                    }
                    else
                    {
                        from.SendMessage("You fail to disarm the trap.");
                    }
                }
                else if (targeted is MovingTreeTrap)
                {
                    MovingTreeTrap movingtreetrap = (MovingTreeTrap)targeted;

                    if (from.Skills.RemoveTrap.Base >= 30.0)
                    {
                        movingtreetrap.Delete();
                        from.PlaySound(0x5CE);
                        from.SendMessage("You have disarmed the trap.");
                    }
                    else if (from.CheckTargetSkill(SkillName.RemoveTrap, movingtreetrap, 15, 50))
                    {
                        movingtreetrap.Delete();
                        from.PlaySound(0x5CE);
                        from.SendMessage("You have disarmed the trap.");
                        from.Skills.RemoveTrap.Base += 1;
                    }
                    else
                    {
                        from.SendMessage("You fail to disarm the trap.");
                    }
                }
                else if (targeted is MovingTreeTrap2)
                {
                    MovingTreeTrap2 movingtreetrap2 = (MovingTreeTrap2)targeted;

                    if (from.Skills.RemoveTrap.Base >= 30.0)
                    {
                        movingtreetrap2.Delete();
                        from.PlaySound(0x5CE);
                        from.SendMessage("You have disarmed the trap.");
                    }

                    else if (from.CheckTargetSkill(SkillName.RemoveTrap, movingtreetrap2, 15, 50))
                    {
                        movingtreetrap2.Delete();
                        from.PlaySound(0x5CE);
                        from.SendMessage("You have disarmed the trap.");
                        from.Skills.RemoveTrap.Base += 1;
                    }
                    else
                    {
                        from.SendMessage("You fail to disarm the trap.");
                    }
                }

                else if (targeted is TrapableContainer)
                {
                    TrapableContainer targ = (TrapableContainer)targeted;

                    from.Direction = from.GetDirectionTo(targ);

                    if (targ.TrapType == TrapType.None)
                    {
                        from.SendLocalizedMessage(502373);                           // That doesn't appear to be trapped
                        return;
                    }

                    from.PlaySound(0x241);

                    if (from.CheckTargetSkill(SkillName.RemoveTrap, targ, targ.TrapPower, targ.TrapPower + 30))
                    {
                        targ.TrapPower = 0;
                        targ.TrapLevel = 0;
                        targ.TrapType  = TrapType.None;
                        from.SendLocalizedMessage(502377);                           // You successfully render the trap harmless
                    }
                    else
                    {
                        from.SendLocalizedMessage(502372);                           // You fail to disarm the trap... but you don't set it off
                    }
                }
                else if (targeted is BaseFactionTrap)
                {
                    BaseFactionTrap trap    = (BaseFactionTrap)targeted;
                    Faction         faction = Faction.Find(from);

                    FactionTrapRemovalKit kit = (from.Backpack == null ? null : from.Backpack.FindItemByType(typeof(FactionTrapRemovalKit)) as FactionTrapRemovalKit);

                    bool isOwner = (trap.Placer == from || (trap.Faction != null && trap.Faction.IsCommander(from)));

                    if (faction == null)
                    {
                        from.SendLocalizedMessage(1010538);                           // You may not disarm faction traps unless you are in an opposing faction
                    }
                    else if (faction == trap.Faction && trap.Faction != null && !isOwner)
                    {
                        from.SendLocalizedMessage(1010537);                           // You may not disarm traps set by your own faction!
                    }
                    else if (!isOwner && kit == null)
                    {
                        from.SendLocalizedMessage(1042530);                           // You must have a trap removal kit at the base level of your pack to disarm a faction trap.
                    }
                    else
                    {
                        if ((Core.ML && isOwner) || (from.CheckTargetSkill(SkillName.RemoveTrap, trap, 80.0, 100.0) && from.CheckTargetSkill(SkillName.Tinkering, trap, 80.0, 100.0)))
                        {
                            from.PrivateOverheadMessage(MessageType.Regular, trap.MessageHue, trap.DisarmMessage, from.NetState);

                            if (!isOwner)
                            {
                                int silver = faction.AwardSilver(from, trap.SilverFromDisarm);

                                if (silver > 0)
                                {
                                    from.SendLocalizedMessage(1008113, true, silver.ToString("N0"));                                         // You have been granted faction silver for removing the enemy trap :
                                }
                            }

                            trap.Delete();
                        }
                        else
                        {
                            from.SendLocalizedMessage(502372);                               // You fail to disarm the trap... but you don't set it off
                        }

                        if (!isOwner && kit != null)
                        {
                            kit.ConsumeCharge(from);
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502373);                       // That does'nt appear to be trapped
                }
            }
            protected override void OnTarget(Mobile src, object targ)
            {
                bool foundAnyone = false;

                if (targ is TrapableContainer)
                {
                    TrapableContainer cont = targ as TrapableContainer;

                    if (cont.Enabled && cont.TrapType != TrapType.None && cont.TrapPower > 0 && src.CheckSkill(SkillName.DetectHidden, 0.0, 100.0))
                    {
                        int hue = 0;

                        switch (cont.TrapType)
                        {
                        case TrapType.ExplosionTrap:
                            hue = 0x78;
                            break;

                        case TrapType.DartTrap:
                            hue = 0x5A;
                            break;

                        case TrapType.PoisonTrap:
                            hue = 0x44;
                            break;
                        }

                        cont.SendLocalizedMessageTo(src, 500813, hue);                           // [trapped]
                    }
                }

                Point3D p;

                if (targ is Mobile)
                {
                    p = ((Mobile)targ).Location;
                }
                else if (targ is Item)
                {
                    p = ((Item)targ).Location;
                }
                else if (targ is IPoint3D)
                {
                    p = new Point3D((IPoint3D)targ);
                }
                else
                {
                    p = src.Location;
                }

                double srcSkill = src.Skills[SkillName.DetectHidden].Value;
                int    range    = (int)(srcSkill / 10.0);

                if (!src.CheckSkill(SkillName.DetectHidden, 0.0, 100.0))
                {
                    range /= 2;
                }

                BaseHouse house = BaseHouse.FindHouseAt(p, src.Map, 16);

                bool inHouse = (house != null && house.IsFriend(src));

                if (inHouse)
                {
                    range = 22;
                }

                if (range > 0)
                {
                    IPooledEnumerable inRange = src.Map.GetMobilesInRange(p, range);

                    foreach (Mobile trg in inRange)
                    {
                        if (trg.Hidden && src != trg)
                        {
                            double ss = srcSkill + Utility.Random(21) - 10;
                            double ts = trg.Skills[SkillName.Hiding].Value + Utility.Random(21) - 10;

                            if (src.AccessLevel >= trg.AccessLevel && (ss >= ts || (inHouse && house.IsInside(trg))))
                            {
                                if (trg is Mobiles.ShadowKnight && (trg.X != p.X || trg.Y != p.Y))
                                {
                                    continue;
                                }

                                trg.RevealingAction();
                                trg.SendLocalizedMessage(500814);                                   // You have been revealed!
                                foundAnyone = true;
                            }
                        }
                    }

                    inRange.Free();

                    if (Faction.Find(src) != null)
                    {
                        IPooledEnumerable itemsInRange = src.Map.GetItemsInRange(p, range);

                        foreach (Item item in itemsInRange)
                        {
                            if (item is BaseFactionTrap)
                            {
                                BaseFactionTrap trap = (BaseFactionTrap)item;

                                if (src.CheckTargetSkill(SkillName.DetectHidden, trap, 80.0, 100.0))
                                {
                                    src.SendLocalizedMessage(1042712, true, " " + (trap.Faction == null ? "" : trap.Faction.Definition.FriendlyName));                                       // You reveal a trap placed by a faction:

                                    trap.Visible = true;
                                    trap.BeginConceal();

                                    foundAnyone = true;
                                }
                            }
                        }

                        itemsInRange.Free();
                    }
                }

                if (!foundAnyone)
                {
                    src.SendLocalizedMessage(500817);                       // You can see nothing hidden there.
                }
            }
Beispiel #30
0
            protected override void OnTarget(Mobile src, object targ)
            {
                IEntity entity = targ as IEntity;

                if (XmlScript.HasTrigger(entity, TriggerName.onTargeted) && UberScriptTriggers.Trigger(entity, src, TriggerName.onTargeted, null, null, null, 0, null, SkillName.DetectHidden, src.Skills[SkillName.DetectHidden].Value))
                {
                    return;
                }

                bool foundAnyone = false;

                Point3D p;

                if (targ is Mobile)
                {
                    p = ((Mobile)targ).Location;
                }
                else if (targ is Item)
                {
                    p = ((Item)targ).Location;
                }
                else if (targ is IPoint3D)
                {
                    p = new Point3D((IPoint3D)targ);
                }
                else
                {
                    p = src.Location;
                }

                double srcSkill = src.Skills[SkillName.DetectHidden].Value;
                int    range    = (int)(srcSkill / 10.0);

                if (!src.CheckSkill(SkillName.DetectHidden, 0.0, 100.0))
                {
                    range /= 2;
                }
                if (targ is TrapableContainer)
                {
                    TrapableContainer targeted = (TrapableContainer)targ;

                    src.Direction = src.GetDirectionTo(targeted);

                    if (targeted.TrapType == TrapType.None)
                    {
                        src.SendLocalizedMessage(502373); // That doesn't appear to be trapped
                        return;
                    }

                    src.PlaySound(0x241);

                    if (src.CheckTargetSkill(SkillName.DetectHidden, targeted, targeted.TrapPower, targeted.TrapPower + 30))
                    {
                        int traphue = 0;
                        if (targeted.TrapType == TrapType.DartTrap)
                        {
                            traphue = 0x5A;
                        }
                        if (targeted.TrapType == TrapType.ExplosionTrap)
                        {
                            traphue = 0x78;
                        }
                        if (targeted.TrapType == TrapType.MagicTrap)
                        {
                            traphue = 0x5A;
                        }
                        if (targeted.TrapType == TrapType.PoisonTrap)
                        {
                            traphue = 0x44;
                        }
                        src.SendMessage(traphue, "This container is trapped.");
                        return;
                    }
                }

                BaseHouse house = BaseHouse.FindHouseAt(p, src.Map, 16);

                bool inHouse = (house != null && house.IsFriend(src));

                if (inHouse)
                {
                    range = 22;
                }

                if (range > 0)
                {
                    IPooledEnumerable inRange = src.Map.GetMobilesInRange(p, range);

                    foreach (Mobile trg in inRange)
                    {
                        if (trg.Hidden && src != trg)
                        {
                            double ss = srcSkill + Utility.Random(21) - 10;
                            double ts = trg.Skills[SkillName.Hiding].Value + Utility.Random(21) - 10;

                            if (src.AccessLevel >= trg.AccessLevel && (ss >= ts || (inHouse && house.IsInside(trg))))
                            {
                                if (trg is ShadowKnight && (trg.X != p.X || trg.Y != p.Y))
                                {
                                    continue;
                                }

                                if (trg is LockeCole)
                                {
                                    continue;
                                }

                                if (trg is ZombieAvatar && trg.NetState == null)
                                {
                                    continue;
                                }

                                trg.RevealingAction();
                                trg.SendLocalizedMessage(500814);                                   // You have been revealed!
                                foundAnyone = true;
                            }
                        }
                    }

                    inRange.Free();

                    if (Faction.Find(src) != null)
                    {
                        IPooledEnumerable itemsInRange = src.Map.GetItemsInRange(p, range);

                        foreach (Item item in itemsInRange)
                        {
                            if (item is BaseFactionTrap)
                            {
                                BaseFactionTrap trap = (BaseFactionTrap)item;

                                if (src.CheckTargetSkill(SkillName.DetectHidden, trap, 80.0, 100.0))
                                {
                                    src.SendLocalizedMessage(1042712, true, " " + (trap.Faction == null ? "" : trap.Faction.Definition.FriendlyName));                                       // You reveal a trap placed by a faction:

                                    trap.Visible = true;
                                    trap.BeginConceal();

                                    foundAnyone = true;
                                }
                            }
                        }

                        itemsInRange.Free();
                    }
                }

                if (!foundAnyone)
                {
                    src.SendLocalizedMessage(500817);                       // You can see nothing hidden there.
                }
            }