예제 #1
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.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
                }
            }
예제 #2
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
                }
            }