Exemplo n.º 1
0
        public override void OnRemoved(object parent)
        {
            base.OnRemoved(parent);

            if (parent is Mobile m)
            {
                for (var index = 0; index < m.Items.Count; index++)
                {
                    Item armor = m.Items[index];

                    if (armor is IEpiphanyArmor)
                    {
                        armor.InvalidateProperties();
                    }
                }
            }
        }
Exemplo n.º 2
0
            public override void OnResponse(Server.Network.NetState state, RelayInfo info)
            {
                if (m_Tool == null || m_Tool.Deleted || m_Target == null || m_Target.Deleted)
                {
                    return;
                }

                if (info.ButtonID == (int)Buttons.Okay)
                {
                    TextRelay relay = info.GetTextEntry((int)Buttons.Text);

                    if (relay != null)
                    {
                        if (relay.Text == null || relay.Text.Equals(""))
                        {
                            ((IEngravable)m_Target).EngravedText = null;
                            state.Mobile.SendLocalizedMessage(1072362);                               // You remove the engraving from the object.
                        }
                        else
                        {
                            if (relay.Text.Length > 40)
                            {
                                ((IEngravable)m_Target).EngravedText = relay.Text.Substring(0, 40);
                            }
                            else
                            {
                                ((IEngravable)m_Target).EngravedText = relay.Text;
                            }

                            state.Mobile.SendLocalizedMessage(1072361);                               // You engraved the object.
                            m_Target.InvalidateProperties();
                            m_Tool.UsesRemaining -= 1;
                            m_Tool.InvalidateProperties();

                            if (m_Tool.UsesRemaining < 1)
                            {
                                m_Tool.Delete();
                                state.Mobile.SendLocalizedMessage(1044038);                                   // You have worn out your tool!
                            }
                        }
                    }
                }
            }
Exemplo n.º 3
0
        public override bool OnEquip(Mobile from)
        {
            bool canEquip = base.OnEquip(from);

            if (canEquip)
            {
                for (var index = 0; index < from.Items.Count; index++)
                {
                    Item armor = from.Items[index];

                    if (armor is IEpiphanyArmor)
                    {
                        armor.InvalidateProperties();
                    }
                }
            }

            return(canEquip);
        }
Exemplo n.º 4
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (!base.OnDragDrop(from, dropped))
            {
                return(false);
            }
            if (dropped is Gold)
            {
                return(false);
            }
            if (dropped is BaseContainer)
            {
                seachbag(dropped, from);
            }

            m_Points += dropped.Amount;
            dropped.Delete();

            dropped.InvalidateProperties();
            return(true);
        }
Exemplo n.º 5
0
        public override bool OnDragDropInto(Mobile from, Item item, Point3D p)
        {
            if (!base.OnDragDropInto(from, item, p))
            {
                return(false);
            }
            if (item is Gold)
            {
                return(false);
            }
            if (item.CheckNewbied() || item.Insured || item.PayedInsurance)
            {
                return(false);
            }
            if (item is BaseContainer)
            {
                seachbag(item, from);
            }
            m_Points += item.Amount;
            item.Delete();

            item.InvalidateProperties();
            return(true);
        }
Exemplo n.º 6
0
 public override void OnResponse(int hue)
 {
     m_Mixture.Hue = hue;
     m_Mixture.InvalidateProperties();
 }
Exemplo n.º 7
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                Item target = ((Item)targeted);

                Container pack = from.Backpack;

                if (pack == null)
                {
                    from.SendMessage("Please ensure you have a pack.");
                    return;
                }

                if (target == null || target.Deleted || !(target is Runebook) || ((Runebook)target).Entries.Count > 0)
                {
                    from.SendMessage("You can only copy to an empty runebook.");
                    return;
                }

                if (target.RootParent != from)
                {
                    from.SendMessage("The runebook you wish to write to must be in your backpack.");
                    return;
                }

                if (ConsumeTotal(pack, ((Runebook)m_Source).Entries.Count, true) > -1)
                {
                    from.SendMessage("This operation requires unmarked recall runes and mark scrolls.");
                    from.SendMessage("Total of each needed: {0}.", ((Runebook)m_Source).Entries.Count);
                    return;
                }

                Type t = typeof(Runebook);

                ConstructorInfo c = t.GetConstructor(Type.EmptyTypes);

                if (c != null)
                {
                    try
                    {
                        from.SendMessage("Writing Copy...");

                        object o = c.Invoke(null);

                        if (o != null && o is Item)
                        {
                            Item newItem = (Item)o;
                            Dupe.CopyProperties(newItem, m_Source);
                            m_Source.OnAfterDuped(newItem);
                            newItem.Parent = null;
                            pack.DropItem(newItem);

                            newItem.InvalidateProperties();
                            from.SendMessage("Done");
                            m_Pen.UsesRemaining -= 1;
                            m_Pen.InvalidateProperties();
                            target.Delete();
                        }
                    }
                    catch
                    {
                        from.SendMessage("Error, please notify a GM!");
                    }
                }
            }