示例#1
0
            private void UnlockDoor(Item item, Mobile from)
            {
                if (!(item is BaseDoor))
                {
                    from.SendMessage("That is not a door.");
                    Target.Cancel(from);
                    return;
                }

                BaseDoor door = (BaseDoor)item;

                if (!door.Locked)
                {
                    from.SendMessage("That door is not locked.");
                    Target.Cancel(from);
                    return;
                }

                double requiredLockpicking = 100.0;
                double requiredTinkering   = 20.0;

                double hayDoorSkill              = 00.0;
                double lightWoodDoorSkill        = 10.0;
                double unbracedDarkwoodDoorSkill = 20.0;
                double bracedDarkwoodDoorSkill   = 40.0;
                double metalDoorSkill            = 80.0;

                int id = door.ClosedID;

                if (id == 1685 || id == 1687 || id == 1693 || id == 1695)
                {
                    requiredTinkering = hayDoorSkill;
                }
                else if (id == 1749 || id == 1751 || id == 1757 || id == 1759)
                {
                    requiredTinkering = lightWoodDoorSkill;
                }
                else if (id == 1701 || id == 1703 || id == 1709 || id == 1711)
                {
                    requiredTinkering = unbracedDarkwoodDoorSkill;
                }
                else if (id == 1765 || id == 1767 || id == 1773 || id == 1775)
                {
                    requiredTinkering = bracedDarkwoodDoorSkill;
                }
                else if (id == 1653 || id == 1655 || id == 1661 || id == 1663)
                {
                    requiredTinkering = metalDoorSkill;
                }

                if (from.Skills[SkillName.Lockpicking].Value < requiredLockpicking)
                {
                    from.SendMessage("You try to pick the door's lock, but you have no idea what you're doing.");
                    Target.Cancel(from);
                    return;
                }

                if (from.Skills[SkillName.Tinkering].Value < requiredTinkering)
                {
                    from.SendMessage("You do not have enough tinkering ability to pick this type of lock.");
                    Target.Cancel(from);
                    return;
                }

                if (Utility.RandomMinMax(1, 10) == 1)
                {
                    from.SendMessage("You successfully pick the lock.");
                    door.Locked = false;
                    m_Decorator.Consume();
                }
                else
                {
                    from.SendMessage("You try to pick the lock, but accidentally break the pick.");
                    from.PlaySound(0x3A4);
                    m_Decorator.Consume();
                }

                Target.Cancel(from);
            }