Example #1
0
            public override void OnClick()
            {
                var from = Owner.From;

                if (!m_Obsidian.Deleted && m_Obsidian.Quantity >= m_Partial && m_Obsidian.Quantity < m_Completed &&
                    m_Obsidian.IsChildOf(from.Backpack) && from.CheckAlive())
                {
                    for (var i = 0; i < m_Obsidian.Quantity - 1; i++)
                    {
                        from.AddToBackpack(new Obsidian());
                    }

                    m_Obsidian.Quantity = 1;
                }
            }
Example #2
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                var targ = targeted as Item;

                if (m_Obsidian.Deleted || m_Obsidian.Quantity >= m_Completed || targ == null)
                {
                    return;
                }

                if (m_Obsidian.IsChildOf(from.Backpack) && targ.IsChildOf(from.Backpack) && targ is Obsidian &&
                    targ != m_Obsidian)
                {
                    var targObsidian = (Obsidian)targ;
                    if (targObsidian.Quantity < m_Completed)
                    {
                        if (targObsidian.Quantity + m_Obsidian.Quantity <= m_Completed)
                        {
                            targObsidian.Quantity += m_Obsidian.Quantity;
                            m_Obsidian.Delete();
                        }
                        else
                        {
                            var delta = m_Completed - targObsidian.Quantity;
                            targObsidian.Quantity += delta;
                            m_Obsidian.Quantity   -= delta;
                        }

                        if (targObsidian.Quantity >= m_Completed)
                        {
                            targObsidian.StatueName = RandomName(from);
                        }

                        from.Send(new AsciiMessage(targObsidian.Serial, targObsidian.ItemID, MessageType.Regular, 0x59,
                                                   3, m_Obsidian.Name, "Something Happened."));

                        return;
                    }
                }

                from.Send(new MessageLocalized(m_Obsidian.Serial, m_Obsidian.ItemID, MessageType.Regular, 0x2C, 3,
                                               500309, m_Obsidian.Name, "")); // Nothing Happens.
            }