IsEmpty() public static méthode

public static IsEmpty ( BaseBook book ) : bool
book Server.Items.BaseBook
Résultat bool
            protected override void OnTarget(Mobile from, object targeted)
            {
                BaseBook book = targeted as BaseBook;

                if (book == null)
                {
                    from.SendLocalizedMessage(1046296);                       // That is not a book
                }
                else if (Inscribe.IsEmpty(book))
                {
                    from.SendLocalizedMessage(501611);                       // Can't copy an empty book.
                }
                else if (Inscribe.GetUser(book) != null)
                {
                    from.SendLocalizedMessage(501621);                       // Someone else is inscribing that item.
                }
                else
                {
                    Target target = new InternalTargetDst(book);
                    from.Target = target;
                    from.SendLocalizedMessage(501612);                       // Select a book to copy this to.
                    target.BeginTimeout(from, TimeSpan.FromMinutes(1.0));
                    Inscribe.SetUser(book, from);
                }
            }
Exemple #2
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is BlankScroll)
                {
                    new Engines.Craft.InscribeSystem((BlankScroll)targeted).Begin(from, null);
                    return;
                }

                BaseBook book = targeted as BaseBook;

                if (book == null)
                {
                    from.SendLocalizedMessage(1046296);                       // That is not a book
                }
                else if (Inscribe.IsEmpty(book))
                {
                    from.SendLocalizedMessage(501611);                       // Can't copy an empty book.
                }
                else if (Inscribe.GetUser(book) != null)
                {
                    from.SendLocalizedMessage(501621);                       // Someone else is inscribing that item.
                }
                else
                {
                    from.Target = new InternalTargetDst(book);
                    from.SendLocalizedMessage(501612);                       // Select a book to copy this to.
                    Inscribe.SetUser(book, from);
                }
            }
Exemple #3
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                IEntity entity = targeted as IEntity; if (XmlScript.HasTrigger(entity, TriggerName.onTargeted) && UberScriptTriggers.Trigger(entity, from, TriggerName.onTargeted, null, null, null, 0, null, SkillName.Inscribe, from.Skills[SkillName.Inscribe].Value))
                {
                    return;
                }

                BaseBook book = targeted as BaseBook;

                if (book == null)
                {
                    from.SendLocalizedMessage(1046296);                       // That is not a book
                }
                else if (Inscribe.IsEmpty(book))
                {
                    from.SendLocalizedMessage(501611);                       // Can't copy an empty book.
                }
                else if (Inscribe.GetUser(book) != null)
                {
                    from.SendLocalizedMessage(501621);                       // Someone else is inscribing that item.
                }
                else
                {
                    Target target = new InternalTargetDst(book);
                    from.Target = target;
                    from.SendLocalizedMessage(501612);                       // Select a book to copy this to.
                    target.BeginTimeout(from, TimeSpan.FromMinutes(1.0));
                    Inscribe.SetUser(book, from);
                }
            }
Exemple #4
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is RecallRune)
                {
                    RecallRune rune = (RecallRune)targeted;

                    if (!rune.Marked)
                    {
                        from.SendMessage("You cannot copy an unmarked recall rune.");
                    }
                    else if (Inscribe.GetUser(rune) != null)
                    {
                        from.SendLocalizedMessage(501621);                         // Someone else is inscribing that item.
                    }
                    else
                    {
                        Target target = new InternalTargetDst(rune);
                        from.Target = target;
                        from.SendMessage("Select a moonstone to copy that to.");                         // reword
                        target.BeginTimeout(from, TimeSpan.FromMinutes(1.0));
                        Inscribe.SetUser(rune, from);
                    }
                }
                else if (targeted is BaseBook)
                {
                    BaseBook book = (BaseBook)targeted;

                    if (Inscribe.IsEmpty(book))
                    {
                        from.SendLocalizedMessage(501611);                         // Can't copy an empty book.
                    }
                    else if (Inscribe.GetUser(book) != null)
                    {
                        from.SendLocalizedMessage(501621);                         // Someone else is inscribing that item.
                    }
                    else if (!book.Copyable)
                    {
                        from.SendAsciiMessage("That book is not copyable.");
                    }
                    else
                    {
                        Target target = new InternalTargetDst(book);
                        from.Target = target;
                        from.SendLocalizedMessage(501612);                         // Select a book to copy this to.
                        target.BeginTimeout(from, TimeSpan.FromMinutes(1.0));
                        Inscribe.SetUser(book, from);
                    }
                }
                else
                {
                    from.SendMessage("You cannot copy that.");
                }
            }
Exemple #5
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_BookSrc.Deleted)
                {
                    return;
                }

                EventSink.InvokeSkillUsed(new SkillUsedEventArgs(from, from.Skills[SkillName.Inscribe]));

                BaseBook bookDst = targeted as BaseBook;

                if (bookDst == null)
                {
                    from.SendLocalizedMessage(1046296); // That is not a book
                }
                else if (Inscribe.IsEmpty(m_BookSrc))
                {
                    from.SendLocalizedMessage(501611); // Can't copy an empty book.
                }
                else if (bookDst == m_BookSrc)
                {
                    from.SendLocalizedMessage(501616); // Cannot copy a book onto itself.
                }
                else if (!bookDst.Writable)
                {
                    from.SendLocalizedMessage(501614); // Cannot write into that book.
                }
                else if (Inscribe.GetUser(bookDst) != null)
                {
                    from.SendLocalizedMessage(501621); // Someone else is inscribing that item.
                }
                else
                {
                    if (from.CheckTargetSkill(SkillName.Inscribe, bookDst, 0, 50))
                    {
                        Inscribe.Copy(m_BookSrc, bookDst);

                        from.SendLocalizedMessage(501618); // You make a copy of the book.
                        from.PlaySound(0x249);
                    }
                    else
                    {
                        from.SendLocalizedMessage(501617); // You fail to make a copy of the book.
                    }
                }
            }
Exemple #6
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_BookSrc.Deleted)
                {
                    return;
                }

                BaseBook bookDst = targeted as BaseBook;

                if (bookDst == null)
                {
                    from.SendAsciiMessage("That is not a book."); // That is not a book
                }
                else if (Inscribe.IsEmpty(m_BookSrc))
                {
                    from.SendAsciiMessage("Can't copy an empty book."); // Can't copy an empty book.
                }
                else if (bookDst == m_BookSrc)
                {
                    from.SendAsciiMessage("Cannot copy a book onto itself."); // Cannot copy a book onto itself.
                }
                else if (!bookDst.Writable)
                {
                    from.SendAsciiMessage("Cannot write into that book."); // Cannot write into that book.
                }
                else if (Inscribe.GetUser(bookDst) != null)
                {
                    from.SendAsciiMessage("Someone else is inscribing that item."); // Someone else is inscribing that item.
                }
                else
                {
                    if (from.CheckTargetSkill(SkillName.Inscribe, bookDst, 0, 50))
                    {
                        Inscribe.Copy(m_BookSrc, bookDst);

                        from.SendAsciiMessage("You make a copy of the book."); // You make a copy of the book.
                        from.PlaySound(0x249);
                    }
                    else
                    {
                        from.SendAsciiMessage("You fail to make a copy of the book."); // You fail to make a copy of the book.
                    }
                }
            }
Exemple #7
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_ItemSrc.Deleted)
                {
                    return;
                }

                if (targeted is Moonstone)
                {
                    Moonstone stone = (Moonstone)targeted;

                    if (!(m_ItemSrc is RecallRune))
                    {
                        from.SendMessage("You cannot copy that to a moonstone.");
                    }
                    else if (!((RecallRune)m_ItemSrc).Marked)
                    {
                        from.SendMessage("You cannot copy an unmarked recall rune.");
                    }
                    else if (Inscribe.GetUser(stone) != null)
                    {
                        from.SendLocalizedMessage(501621);                              // Someone else is inscribing that item.
                    }
                    else
                    {
                        if (from.Mana < 20)
                        {
                            from.SendMessage("You have insufficient mana to copy the recall rune.");
                            return;
                        }

                        Container pack = from.Backpack;
                        if (pack == null)
                        {
                            from.SendMessage("You have no backpack! Contact a GM immediately.");
                            return;
                        }
                        if (pack.ConsumeUpTo(typeof(PowderOfTranslocation), 1) != 1)
                        {
                            from.SendMessage("You must have some powder of translocation to mark the moonstone.");
                            return;
                        }

                        from.Mana -= 20;

                        if (Utility.RandomDouble() * 100 >= (100.0 - ((from.Skills[SkillName.Inscribe].Value + from.Skills[SkillName.Magery].Value) / 2.0)) * 2.0)
                        {
                            RecallRune rune = (RecallRune)m_ItemSrc;
                            stone.Marked      = true;
                            stone.Description = "a moonstone for " + rune.Description;
                            stone.Destination = rune.Target;

                            from.SendMessage("You copy the rune.");

                            from.PlaySound(0x1FA);
                            Effects.SendLocationEffect(rune, rune.Map, 14201, 16);
                            Effects.SendLocationEffect(stone, stone.Map, 14201, 16);
                        }
                        else
                        {
                            from.SendMessage("You fail to copy the recall rune.");
                        }
                    }
                }
                else if (targeted is BaseBook)
                {
                    BaseBook bookDst = (BaseBook)targeted;

                    if (!(m_ItemSrc is BaseBook))
                    {
                        from.SendMessage("You cannot copy that to a book.");
                    }
                    else if (Inscribe.IsEmpty(m_ItemSrc as BaseBook))
                    {
                        from.SendLocalizedMessage(501611);                         // Can't copy an empty book.
                    }
                    else if (bookDst == m_ItemSrc)
                    {
                        from.SendLocalizedMessage(501616);                         // Cannot copy a book onto itself.
                    }
                    else if (!bookDst.Writable)
                    {
                        from.SendLocalizedMessage(501614);                         // Cannot write into that book.
                    }
                    else if (Inscribe.GetUser(bookDst) != null)
                    {
                        from.SendLocalizedMessage(501621);                         // Someone else is inscribing that item.
                    }
                    else
                    {
                        if (from.CheckTargetSkill(SkillName.Inscribe, bookDst, 0, 50))
                        {
                            Inscribe.CopyBook(m_ItemSrc as BaseBook, bookDst);

                            from.SendLocalizedMessage(501618);                             // You make a copy of the book.
                            from.PlaySound(0x249);
                        }
                        else
                        {
                            from.SendLocalizedMessage(501617);                             // You fail to make a copy of the book.
                        }
                    }
                }
                else
                {
                    from.SendMessage("You are unable to copy those two items.");
                }
            }
Exemple #8
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                BaseBook  book = targeted as BaseBook;
                Container pack = from.Backpack;

                if (targeted is BlankScroll)
                {
                    Item item = (Item)targeted;

                    if (item.RootParent != from)
                    {
                        from.SendAsciiMessage("That must be in your pack for you to use it.");
                    }
                    else
                    {
                        if (pack != null)
                        {
                            if (pack.FindItemByType(typeof(Spellbook)) == null)
                            {
                                from.SendAsciiMessage("You don't have a spellbook.");
                            }
                            else if (((Spellbook)pack.FindItemByType(typeof(Spellbook))).SpellCount == 0)
                            {
                                from.SendAsciiMessage("You can't inscribe any spells.");
                            }
                            else
                            {
                                BaseTool m_Pen = new ScribesPen();
                                from.SendMenu(new InscriptionMenu(from, InscriptionMenu.Main(from), "Main", m_Pen));
                                if (m_Pen != null)
                                {
                                    m_Pen.Delete();
                                }
                            }
                        }
                    }
                }
                else
                {
                    if (book == null)
                    {
                        from.SendAsciiMessage("Can't inscribe that item.");
                    }
                    else if (Inscribe.IsEmpty(book))
                    {
                        from.SendAsciiMessage("Can't copy an empty book."); // Can't copy an empty book.
                    }
                    else if (Inscribe.GetUser(book) != null)
                    {
                        from.SendAsciiMessage("Someone else is inscribing that item."); // Someone else is inscribing that item.
                    }
                    else
                    {
                        Target target = new InternalTargetDst(book);
                        from.Target = target;
                        from.SendAsciiMessage("Select a book to copy this to."); // Select a book to copy this to.
                        target.BeginTimeout(from, TimeSpan.FromMinutes(1.0));
                        Inscribe.SetUser(book, from);
                    }
                }
            }