Example #1
0
        public void Sacrifice_Callback(Mobile from, object state)
        {
            Item targeted = state as Item;

            if (targeted == null || targeted.Deleted)
            {
                return;
            }

            if (from.Map != Map || !from.InRange(Location, 2))
            {
                from.SendLocalizedMessage(500446); // That is too far away.
            }
            else if (m_Key != null && !m_Key.Deleted)
            {
                SendLocalizedMessageTo(from, 502221); // Someone else is already using this item.
            }
            else if (!targeted.IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1049486); // You can only sacrifice items that are in your backpack!
            }
            else if (targeted.GetType() != m_Platform.KeyType)
            {
                from.SendAsciiMessage("I do not want that!");
                Effects.SendBoltEffect(from);
            }
            else
            {
                targeted.Movable = false;
                targeted.MoveToWorld(new Point3D(X, Y, Z + 1), Map);

                Effects.SendLocationEffect(targeted.Location, targeted.Map, 0x3728, 10);
                Effects.PlaySound(targeted.Location, targeted.Map, 0x29);

                m_Key = targeted;

                m_Platform.Summoner = from;
                m_Platform.Validate();
            }
        }