public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (dropped is SpellScroll)
            {
                SpellScroll spellScroll = dropped as SpellScroll;

                SpellScrollLibraryEntry entry = GetLibraryEntry(spellScroll.GetType());

                if (entry != null)
                {
                    entry.Count += spellScroll.Amount;

                    if (spellScroll.Amount == 1)
                    {
                        from.SendMessage("You add a spell scroll to the library.");
                    }
                    else
                    {
                        from.SendMessage("You add a " + spellScroll.Amount.ToString() + " spell scrolls to the library.");
                    }

                    from.SendSound(addItemSound);

                    spellScroll.Delete();
                }

                return(true);
            }

            else
            {
                return(false);
            }
        }
예제 #2
0
        public void AddAllScrollsInPack(Mobile from)
        {
            if (from == null)
            {
                return;
            }
            if (from.Backpack == null)
            {
                return;
            }

            List <SpellScroll> m_MasterScrolls = from.Backpack.FindItemsByType <SpellScroll>();

            int totalCount = 0;

            Queue m_Queue = new Queue();

            foreach (SpellScroll spellScroll in m_MasterScrolls)
            {
                if (spellScroll.MasterStatus != 1)
                {
                    continue;
                }

                m_Queue.Enqueue(spellScroll);
            }

            while (m_Queue.Count > 0)
            {
                SpellScroll spellScroll        = (SpellScroll)m_Queue.Dequeue();
                MasterScrollLibraryEntry entry = GetEntryDetail(spellScroll.GetType());

                if (entry == null)
                {
                    continue;
                }

                entry.Charges += spellScroll.UsesRemaining;

                totalCount++;
                spellScroll.Delete();
            }

            if (totalCount > 1)
            {
                from.SendMessage("You add " + totalCount.ToString() + " master scrolls to the library.");
                from.SendSound(addItemSound);
            }

            else if (totalCount == 1)
            {
                from.SendMessage("You add a master scroll to the library.");
                from.SendSound(addItemSound);
            }

            else
            {
                from.SendMessage("You do not have any master scrolls in your backpack.");
            }
        }
예제 #3
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (dropped is SpellScroll && dropped.Amount == 1)
            {
                SpellScroll scroll = (SpellScroll)dropped;

                if (scroll.MasterStatus > 0)
                {
                    return(false);
                }

                SpellbookType type = GetTypeForSpell(scroll.SpellID);

                if (type != this.SpellbookType)
                {
                    return(false);
                }

                else if (scroll.MasterStatus > 0)
                {
                    from.SendMessage("That is a Master Scroll.");
                    return(false);
                }

                else if (HasSpell(scroll.SpellID))
                {
                    from.SendLocalizedMessage(500179); // That spell is already present in that spellbook.
                    return(false);
                }

                else
                {
                    int val = scroll.SpellID - BookOffset;

                    if (val >= 0 && val < BookCount)
                    {
                        m_Content |= (ulong)1 << val;
                        ++m_Count;

                        InvalidateProperties();

                        scroll.Delete();

                        from.Send(new PlaySound(0x249, GetWorldLocation()));

                        return(true);
                    }

                    return(false);
                }
            }

            else
            {
                return(false);
            }
        }
        public void AddAllScrollsInPack(Mobile from)
        {
            if (from == null)
            {
                return;
            }
            if (from.Backpack == null)
            {
                return;
            }

            List <SpellScroll> m_SpellScrolls = from.Backpack.FindItemsByType <SpellScroll>();

            int totalCount = 0;

            Queue m_Queue = new Queue();

            foreach (SpellScroll spellScroll in m_SpellScrolls)
            {
                m_Queue.Enqueue(spellScroll);
            }

            while (m_Queue.Count > 0)
            {
                SpellScroll             spellScroll = (SpellScroll)m_Queue.Dequeue();
                SpellScrollLibraryEntry entry       = GetLibraryEntry(spellScroll.GetType());

                if (entry == null)
                {
                    continue;
                }

                entry.Count += spellScroll.Amount;

                totalCount += spellScroll.Amount;
                spellScroll.Delete();
            }

            if (totalCount > 1)
            {
                from.SendMessage("You add " + totalCount.ToString() + " spells scrolls to the library.");
                from.SendSound(addItemSound);
            }

            else if (totalCount == 1)
            {
                from.SendMessage("You add a spell scroll to the library.");
                from.SendSound(addItemSound);
            }

            else
            {
                from.SendMessage("You do not have any spell scrolls in your backpack.");
            }
        }
예제 #5
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (dropped is SpellScroll && dropped.Amount == 1)
            {
                SpellScroll scroll = (SpellScroll)dropped;

                SpellbookType type = GetTypeForSpell(scroll.SpellID);

                if (type != this.SpellbookType)
                {
                    return(false);
                }
                else if (HasSpell(scroll.SpellID))
                {
                    from.SendLocalizedMessage(500179);                       // That spell is already present in that spellbook.
                    return(false);
                }
                else
                {
                    int val = scroll.SpellID - BookOffset;

                    if (val >= 0 && val < BookCount)
                    {
                        m_Content |= (ulong)1 << val;
                        ++m_Count;

                        InvalidateProperties();

                        scroll.Delete();

                        from.Send(new PlaySound(0x249, GetWorldLocation()));
                        return(true);
                    }

                    return(false);
                }
            }
            else
            {
                // Adam: anything other than a scroll will get dropped into your backpack
                // (so your best sword doesn't get dropped on the ground.)
                from.AddToBackpack(dropped);
                //	For richness, we add the drop sound of the item dropped.
                from.PlaySound(dropped.GetDropSound());
                return(true);
            }
        }
예제 #6
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (dropped is SpellScroll && dropped.Amount == 1)
            {
                SpellScroll scroll = (SpellScroll)dropped;

                SpellbookType type = GetTypeForSpell(scroll.SpellID);

                if (type != this.SpellbookType)
                {
                    return(false);
                }
                else if (HasSpell(scroll.SpellID))
                {
                    from.SendLocalizedMessage(500179);                       // That spell is already present in that spellbook.
                    return(false);
                }
                else if (IsFifthCircleOrAbove(from, scroll))                     // Can only drop level 4 or above
                {
                    from.SendMessage("The illusory lettering of the scroll evades your attempts at transcription.");
                    return(false);
                }
                else
                {
                    int val = scroll.SpellID - BookOffset;

                    if (val >= 0 && val < BookCount)
                    {
                        m_Content |= (ulong)1 << val;
                        ++m_Count;

                        InvalidateProperties();

                        scroll.Delete();

                        from.Send(new PlaySound(0x249, GetWorldLocation()));
                        return(true);
                    }

                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
예제 #7
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (dropped is SpellScroll && !(dropped is SpellStone))
            {
                SpellScroll scroll = (SpellScroll)dropped;

                SpellbookType type = GetTypeForSpell(scroll.SpellID);

                if (type != SpellbookType)
                {
                    return(false);
                }
                else if (HasSpell(scroll.SpellID))
                {
                    from.SendLocalizedMessage(500179);                     // That spell is already present in that spellbook.
                    return(false);
                }
                else
                {
                    int val = scroll.SpellID - BookOffset;

                    if (val >= 0 && val < BookCount)
                    {
                        from.Send(new PlaySound(0x249, GetWorldLocation()));

                        m_Content |= (ulong)1 << val;
                        ++m_Count;

                        if (dropped.Amount > 1)
                        {
                            dropped.Amount--;
                            return(base.OnDragDrop(from, dropped));
                        }
                        else
                        {
                            InvalidateProperties();
                            scroll.Delete();
                            return(true);
                        }
                    }
                    return(false);
                }
            }
            return(false);
        }
예제 #8
0
        public void AddScroll(Spellbook spellbook, SpellScroll scroll)
        {
            if (spellbook == null || scroll == null)
            {
                return;
            }

            int val = scroll.SpellID - BookOffset;

            if (val >= 0 && val < BookCount)
            {
                spellbook.Content |= (ulong)1 << val;
                ++m_Count;

                InvalidateProperties();

                scroll.Delete();
            }
        }
예제 #9
0
        public void AddScroll(SpellScroll sps, Mobile from, bool gump)
        {
            if (al_GlobalEntry == null)
            {
                InitArray();
            }
            int sid = sps.SpellID;

            if (sid >= 100 && sid <= 115)
            {
                sid -= 36;
            }
            else if (sid > 64)
            {
                from.SendMessage(33, "You can't add this scroll");
                return;
            }
            if (((ScrollEntry)al_GlobalEntry[sid]).Amount >= 60000)
            {
                from.SendMessage(33, "You can't add more charges, the limit is 60,000.");
                return;
            }
            else if (((ScrollEntry)al_GlobalEntry[sid]).Amount + sps.Amount > 60000)
            {
                sps.Amount = (((ScrollEntry)al_GlobalEntry[sid]).Amount + sps.Amount) - 60000;
                ((ScrollEntry)al_GlobalEntry[sid]).Amount = 60000;
            }
            else
            {
                ((ScrollEntry)al_GlobalEntry[sid]).Amount += sps.Amount;
                sps.Delete();
            }
            if (((ScrollEntry)al_GlobalEntry[sid]).SItemID == 1)
            {
                ((ScrollEntry)al_GlobalEntry[sid]).SItemID = sps.ItemID;
            }
            from.SendMessage(88, "You added the scrolls.");
            if (gump)
            {
                from.SendGump(new ScribersTomeGump(from, this));
            }
        }
예제 #10
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (dropped is SpellScroll && dropped.Amount == 1)
            {
                SpellScroll scroll = (SpellScroll)dropped;


                if (HasSpell(scroll.SpellID))
                {
                    from.SendLocalizedMessage(500179); // That spell is already present in that spellbook.
                    return(false);
                }
                else
                {
                    int val = scroll.SpellID;

                    /*if (val >= 600)
                     * {*/
                    //Console.WriteLine(val);

                    Contents.Add(val);

                    scroll.Delete();

                    from.Send(new PlaySound(0x249, GetWorldLocation()));
                    return(true);
                    //}

                    //return false;
                }
            }
            else
            {
                return(false);
            }
        }
        public void CollectFromBackpack(Mobile from, bool showMessage)
        {
            if (!from.Alive)
            {
                return;
            }
            if (!this.IsChildOf(from.Backpack) && !this.IsChildOf(from.BankBox))
            {
                from.SendMessage("That scribe's tomb has to be in your backpack or bankbox for you to use it.");
                return;
            }

            if (al_GlobalEntry == null)
            {
                InitArray();
            }

            Item[] scrolls = from.Backpack.FindItemsByType(typeof(SpellScroll), true);

            for (int i = 0; i < scrolls.Length; i++)
            {
                SpellScroll sps = (SpellScroll)scrolls[i];
                if (!sps.Movable)
                {
                    continue;
                }

                int sid = sps.SpellID;
                if (sid >= 100 && sid <= 115)
                {
                    sid -= 36;
                }
                else if (sid > 64)
                {
                    continue;
                }

                if (((ScrollEntry)al_GlobalEntry[sid]).Amount >= m_Capacity)
                {
                    continue;
                }
                else if (((ScrollEntry)al_GlobalEntry[sid]).Amount + sps.Amount > m_Capacity)
                {
                    sps.Amount = (((ScrollEntry)al_GlobalEntry[sid]).Amount + sps.Amount) - m_Capacity;
                    ((ScrollEntry)al_GlobalEntry[sid]).Amount = m_Capacity;
                }
                else
                {
                    ((ScrollEntry)al_GlobalEntry[sid]).Amount += sps.Amount;
                    sps.Delete();
                }
                if (((ScrollEntry)al_GlobalEntry[sid]).SItemID == 1)
                {
                    ((ScrollEntry)al_GlobalEntry[sid]).SItemID = sps.ItemID;
                }
            }

            if (showMessage)
            {
                from.SendMessage("Scrolls are collected from your backpack into that tome, subject to storage limit.");
            }
        }
예제 #12
0
            protected override void OnTarget(Mobile from, object target)
            {
                if (!SpecialAbilities.Exists(from))
                {
                    return;
                }
                if (from.Backpack == null)
                {
                    return;
                }

                if (!(target is Spellbook))
                {
                    from.SendMessage("That is not a spellbook.");
                    return;
                }

                Spellbook spellbook = target as Spellbook;

                Item item = from.FindItemOnLayer(Layer.FirstValid);

                if (!(spellbook.IsChildOf(from.Backpack) || item == spellbook))
                {
                    from.SendMessage("You may only target spellbooks you have equipped or in your backpack.");
                    return;
                }

                List <SpellScroll> m_Scrolls = from.Backpack.FindItemsByType <SpellScroll>();

                int totalCount = 0;

                Queue m_Queue = new Queue();

                foreach (SpellScroll spellScroll in m_Scrolls)
                {
                    SpellbookType type = GetTypeForSpell(spellScroll.SpellID);

                    if (type != spellbook.SpellbookType)
                    {
                        continue;
                    }

                    if (spellbook.HasSpell(spellScroll.SpellID))
                    {
                        continue;
                    }

                    m_Queue.Enqueue(spellScroll);
                }

                while (m_Queue.Count > 0)
                {
                    SpellScroll spellScroll = (SpellScroll)m_Queue.Dequeue();

                    if (spellbook.HasSpell(spellScroll.SpellID))
                    {
                        continue;
                    }

                    int val = spellScroll.SpellID - spellbook.BookOffset;

                    if (val >= 0 && val < spellbook.BookCount)
                    {
                        totalCount++;

                        spellbook.m_Content |= (ulong)1 << val;
                        ++spellbook.m_Count;

                        spellbook.InvalidateProperties();

                        if (spellScroll.Amount > 1)
                        {
                            spellScroll.Amount--;
                        }

                        else
                        {
                            spellScroll.Delete();
                        }
                    }
                }

                if (totalCount > 0)
                {
                    from.SendSound(0x249);
                    from.SendMessage("You add " + totalCount.ToString() + " spells into the spellbook.");
                }

                else
                {
                    if (m_Scrolls.Count == 0)
                    {
                        from.SendMessage("You do not have any spell scrolls in your backpack.");
                    }

                    else
                    {
                        from.SendMessage("That spellbook already has those spells present within.");
                    }
                }
            }
 public void AddScroll(SpellScroll sps, Mobile from, bool gump)
 {
     if (al_GlobalEntry == null)
         InitArray();
     int sid = sps.SpellID;
     if (sid >= 100 && sid <= 115)
         sid -= 36;
     else if (sid > 64)
     {
         from.SendMessage(33, "You can't add this scroll");
         return;
     }
     if (((ScrollEntry)al_GlobalEntry[sid]).Amount >= 60000)
     {
         from.SendMessage(33, "You can't add more charges, the limit is 60,000.");
         return;
     }
     else if (((ScrollEntry)al_GlobalEntry[sid]).Amount + sps.Amount > 60000)
     {
         sps.Amount = (((ScrollEntry)al_GlobalEntry[sid]).Amount + sps.Amount) - 60000;
         ((ScrollEntry)al_GlobalEntry[sid]).Amount = 60000;
     }
     else
     {
         ((ScrollEntry)al_GlobalEntry[sid]).Amount += sps.Amount;
         sps.Delete();
     }
     if (((ScrollEntry)al_GlobalEntry[sid]).SItemID == 1)
         ((ScrollEntry)al_GlobalEntry[sid]).SItemID = sps.ItemID;
     from.SendMessage(88, "You added the scrolls.");
     if (gump)
         from.SendGump(new ResourceStorageKeyScribersTomeGump(from, this));
 }