Exemplo n.º 1
0
        protected override void OnTick()
        {
            if (Chest.Deleted)
            {
                RemoveTrap.EndChestDisarmTimer(From);
            }
            if (!From.Alive)
            {
                From.SendLocalizedMessage(1159061); // Your ghostly fingers cannot manipulate the mechanism...
                RemoveTrap.EndChestDisarmTimer(From);
            }
            else if (!From.InRange(Chest.GetWorldLocation(), 16) || Chest.Deleted)
            {
                From.SendLocalizedMessage(1159058); // You are too far away from the chest to manipulate the trigger mechanism.
                RemoveTrap.EndChestDisarmTimer(From);
            }
            else if (GMRemover)
            {
                From.RevealingAction();

                if (SafetyEndTime < DateTime.UtcNow)
                {
                    DisarmTrap();
                }
                else
                {
                    if (From.CheckTargetSkill(SkillName.RemoveTrap, Chest, 80, 120 + (Chest.Level * 10)))
                    {
                        DisarmTrap();
                    }
                    else
                    {
                        Chest.SpawnAncientGuardian(From);
                    }
                }

                RemoveTrap.EndChestDisarmTimer(From);
            }
            else
            {
                From.RevealingAction();

                var min = (double)Math.Ceiling(From.Skills[SkillName.RemoveTrap].Value * .75);

                if (From.CheckTargetSkill(SkillName.RemoveTrap, Chest, min, min > 50 ? min + 50 : 100))
                {
                    DisarmTrap();
                    RemoveTrap.EndChestDisarmTimer(From);
                }
                else
                {
                    Chest.SpawnAncientGuardian(From);

                    if (From.Alive)
                    {
                        From.PrivateOverheadMessage(MessageType.Regular, 1150, 1159057, From.NetState); // *You delicately manipulate the trigger mechanism...*
                    }
                }
            }
        }