Пример #1
0
            protected override void OnTarget(Mobile src, object targ)
            {
                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;
                }

                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;
                                }

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

                    inRange.Free();

                    bool faction = Faction.Find(src) != null;
                    bool vvv     = ViceVsVirtueSystem.IsVvV(src);

                    if (faction || vvv)
                    {
                        IPooledEnumerable itemsInRange = src.Map.GetItemsInRange(p, range);

                        foreach (Item item in itemsInRange)
                        {
                            if (faction && 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;
                                }
                            }
                            else if (vvv && (item is VvVSigil || item is VvVTrap) && Utility.Random(100) <= srcSkill)
                            {
                                if (item is VvVTrap && item.ItemID == VvVTrap.HiddenID)
                                {
                                    ((VvVTrap)item).OnRevealed(src);
                                }
                                else if (!item.Visible)
                                {
                                    item.Visible = true;
                                }
                            }
                        }

                        itemsInRange.Free();
                    }
                }

                if (!foundAnyone)
                {
                    src.SendLocalizedMessage(500817); // You can see nothing hidden there.
                }
            }
            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.
                }
            }
Пример #3
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.
                }
            }
Пример #4
0
            protected override void OnTick()
            {
                List <Mobile> mobilesFound = new List <Mobile>();

                Point3D p = m_From.Location;

                double srcSkill = m_From.Skills[SkillName.DetectHidden].Base;
                int    range    = (int)(srcSkill / 3.3);

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

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

                    foreach (Mobile trg in inRange)
                    {
                        if (trg.Hidden)
                        {
                            if (m_From.AccessLevel >= trg.AccessLevel)
                            {
                                if (trg is ShadowKnight && (trg.X != p.X || trg.Y != p.Y))
                                {
                                    continue;
                                }

                                trg.RevealingAction();
                                if (trg is PlayerMobile && (trg as PlayerMobile).HiddenWithSpell)
                                {
                                    (trg as PlayerMobile).HiddenWithSpell = false;
                                    trg.RevealingAction();
                                }
                                trg.SendAsciiMessage("You have been revealed!");

                                mobilesFound.Add(trg);
                            }
                        }
                    }

                    inRange.Free();

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

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

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

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

                        itemsInRange.Free();
                    }

                    if (mobilesFound.Count <= 0)
                    {
                        m_From.SendAsciiMessage("You can see nothing hidden there.");
                    }
                    else
                    {
                        foreach (Mobile s in mobilesFound)
                        {
                            m_From.SendAsciiMessage(string.Format("You find {0}.", s.Name));
                        }
                    }
                }
                else
                {
                    m_From.SendAsciiMessage("You can see nothing hidden there.");
                }

                if (m_From is PlayerMobile)
                {
                    ((PlayerMobile)m_From).EndPlayerAction();
                }
            }
Пример #5
0
            protected override void OnTarget(Mobile src, object targ)
            {
                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    = 1 + (int)(srcSkill / 20.0);

                // *** Teiravon Light Level & Feat Checks
                srcSkill *= 0.5;

                if (src.LightLevel < 10)
                {
                    srcSkill += (Math.Abs(src.LightLevel - 10)) * 2.5;
                }
                else if (src.LightLevel > 10)
                {
                    srcSkill -= (src.LightLevel - 10) * 2.5;
                }

                //if ( targ is TeiravonMobile && ((TeiravonMobile)targ).HasFeat( TeiravonMobile.Feats.AdvancedStealth ) )
                //	skill *= 0.3;

                if (srcSkill < 0.0)
                {
                    srcSkill = 0.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 distance = trg.GetDistanceToSqrt(p);

                            double ss = srcSkill + (80 - (20 * distance));
                            double ts = trg.Skills[SkillName.Stealth].Value + Utility.Random(21) - 10;

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

                            if (src.AccessLevel >= trg.AccessLevel && (ss >= ts || (inHouse && house.IsInside(trg))))
                            {
                                if (!src.CanSee(trg))
                                {
                                    continue;
                                }

                                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.
                }
            }