Example #1
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_BookSrc.Deleted)
                {
                    return;
                }

                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, 1.0))
                    {
                        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.
                    }
                }
            }
 protected override void OnTargetFinish(Mobile from)
 {
     Inscribe.CancelUser(m_BookSrc);
 }
Example #3
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.");
                }
            }
Example #4
0
 protected override void OnTargetFinish(Mobile from)
 {
     Inscribe.CancelUser(m_BookSrc);
     from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(10.0);
 }
Example #5
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);
                    }
                }
            }