Inheritance: Server.Items.Item, ICommodity
Esempio n. 1
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.");
            }
        }
		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 ) );
		}
        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);
            }
        }
Esempio n. 4
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.");
            }
        }
Esempio n. 6
0
        public static SpellScroll MakeMaster(SpellScroll scroll)
        {
            if (scroll == null)
            {
                return(null);
            }

            scroll.MasterStatus = 1;

            return(scroll);
        }
Esempio n. 7
0
		public void Charge( Mobile from, SpellScroll scroll )
		{
			if ( m_Effect != StaffEffect.None )
				from.SendLocalizedMessage( 1010379 ); // This staff has already been charged - you may not recharge it!
			else
			{
				m_Effect = (StaffEffect)scroll.SpellID;
				Charges = MaxCharges;
				scroll.Consume();
				from.SendLocalizedMessage( 1010380 ); // The staff is now charged
			}
		}
        public bool IsFifthCircleOrAbove(Mobile from, SpellScroll scroll)
        {
            MagerySpell spell = SpellRegistry.NewSpell(scroll.SpellID, from, scroll) as MagerySpell;

            if (spell != null && spell.Circle > SpellCircle.Fourth)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 9
0
 public void Charge(Mobile from, SpellScroll scroll)
 {
     if (m_Effect != StaffEffect.None)
     {
         from.SendLocalizedMessage(1010379);                   // This staff has already been charged - you may not recharge it!
     }
     else
     {
         m_Effect = (StaffEffect)scroll.SpellID;
         Charges  = MaxCharges;
         scroll.Consume();
         from.SendLocalizedMessage(1010380);                   // The staff is now charged
     }
 }
Esempio n. 10
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);
            }
        }
Esempio n. 11
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);
            }
        }
Esempio n. 12
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);
        }
Esempio n. 13
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();
            }
        }
Esempio n. 14
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));
            }
        }
        public void EndCombine(Mobile from, object o)
        {
            if (!IsChildOf(from.Backpack) && !IsChildOf(from.BankBox))
            {
                from.SendMessage("This must be in your backpack or bankbox to use.");
                return;
            }

            if (!(o is SpellScroll))
            {
                from.SendMessage(32, "That isn't a Scroll");
                return;
            }

            SpellScroll scroll = (SpellScroll)o;

            if (!scroll.IsChildOf(from.Backpack) && !scroll.IsChildOf(from.BankBox))
            {
                from.SendMessage("That scroll must be in your backpack or bankbox for you to store it in the tome.");
                return;
            }

            AddScroll(scroll, from, true);
        }
Esempio n. 16
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);
            }
        }
Esempio n. 17
0
        public static string ComputeName(SpellScroll ss)
        {
            string name = string.IsNullOrEmpty(ss.Name) ? CliLoc.LocToString(ss.LabelNumber) : ss.Name;

            return (name + " scroll");
        }
Esempio n. 18
0
 public SpellScrollTarget(SpellScroll scroll)
     : base(12, false, TargetFlags.None)
 {
     m_Scroll = scroll;
 }
Esempio n. 19
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 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.");
            }
        }
Esempio n. 21
0
        public void EjectScroll(Mobile from, Type spellType, bool removeAll)
        {
            if (from == null || spellType == null)
            {
                return;
            }

            MasterScrollLibraryEntry entry = GetEntryDetail(spellType);

            if (entry == null)
            {
                return;
            }

            if (entry.Charges == 0)
            {
                from.SendMessage("You do not have any charges of that spell currently stored within this library.");
                return;
            }

            if (from.Backpack == null)
            {
                return;
            }

            if (from.Backpack.TotalItems == from.Backpack.MaxItems)
            {
                from.SendMessage("Your backpack is at capacity. Please remove some items and try again.");
                return;
            }

            int baseCharges = 50;

            if (removeAll)
            {
                int scrollCount = 0;

                for (int a = 0; a < 1000; a++)
                {
                    if (entry.Charges == 0)
                    {
                        break;
                    }

                    if (from.Backpack.TotalItems == from.Backpack.MaxItems)
                    {
                        break;
                    }

                    int charges = baseCharges;

                    if (entry.Charges < charges)
                    {
                        charges = entry.Charges;
                    }

                    SpellScroll spellScroll = (SpellScroll)Activator.CreateInstance(entry.SpellType);

                    if (spellScroll != null)
                    {
                        spellScroll.MasterStatus  = 1;
                        spellScroll.UsesRemaining = charges;

                        entry.Charges -= charges;

                        from.Backpack.DropItem(spellScroll);
                        scrollCount++;
                    }
                }

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

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

                else
                {
                    from.SendMessage("You do not have any scrolls of that in the library.");
                }
            }

            else
            {
                int charges = baseCharges;

                if (entry.Charges < charges)
                {
                    charges = entry.Charges;
                }

                SpellScroll spellScroll = (SpellScroll)Activator.CreateInstance(entry.SpellType);

                if (spellScroll != null)
                {
                    spellScroll.MasterStatus  = 1;
                    spellScroll.UsesRemaining = charges;

                    entry.Charges -= charges;

                    from.Backpack.DropItem(spellScroll);
                    from.SendMessage("You retrieve a master scroll from the library.");
                    from.SendSound(addItemSound);
                }
            }
        }
 public InternalTarget( SpellScroll scroll )
     : base(3, false, TargetFlags.None)
 {
     m_Scroll = scroll;
 }
Esempio n. 23
0
 public FreezeSpell(Mobile caster, Server.Items.SpellScroll scroll) : base(caster, scroll, m_Info)
 {
 }
Esempio n. 24
0
        public static SpellScroll GetRandomSpellScroll(int level)
        {
            SpellScroll spellScroll = null;

            List <Type> m_PotentialTypes = new List <Type>();

            #region Spell Levels

            if (level == 1)
            {
                m_PotentialTypes.Add(typeof(ReactiveArmorScroll));
                m_PotentialTypes.Add(typeof(ClumsyScroll));
                m_PotentialTypes.Add(typeof(CreateFoodScroll));
                m_PotentialTypes.Add(typeof(FeeblemindScroll));
                m_PotentialTypes.Add(typeof(HealScroll));
                m_PotentialTypes.Add(typeof(MagicArrowScroll));
                m_PotentialTypes.Add(typeof(NightSightScroll));
                m_PotentialTypes.Add(typeof(WeakenScroll));
            }

            if (level == 2)
            {
                m_PotentialTypes.Add(typeof(AgilityScroll));
                m_PotentialTypes.Add(typeof(CunningScroll));
                m_PotentialTypes.Add(typeof(CureScroll));
                m_PotentialTypes.Add(typeof(HarmScroll));
                m_PotentialTypes.Add(typeof(MagicTrapScroll));
                m_PotentialTypes.Add(typeof(MagicUnTrapScroll));
                m_PotentialTypes.Add(typeof(ProtectionScroll));
                m_PotentialTypes.Add(typeof(StrengthScroll));
            }

            if (level == 3)
            {
                m_PotentialTypes.Add(typeof(BlessScroll));
                m_PotentialTypes.Add(typeof(FireballScroll));
                m_PotentialTypes.Add(typeof(MagicLockScroll));
                m_PotentialTypes.Add(typeof(PoisonScroll));
                m_PotentialTypes.Add(typeof(TelekinisisScroll));
                m_PotentialTypes.Add(typeof(TeleportScroll));
                m_PotentialTypes.Add(typeof(UnlockScroll));
                m_PotentialTypes.Add(typeof(WallOfStoneScroll));
            }

            if (level == 4)
            {
                m_PotentialTypes.Add(typeof(ArchCureScroll));
                m_PotentialTypes.Add(typeof(ArchProtectionScroll));
                m_PotentialTypes.Add(typeof(CurseScroll));
                m_PotentialTypes.Add(typeof(FireFieldScroll));
                m_PotentialTypes.Add(typeof(GreaterHealScroll));
                m_PotentialTypes.Add(typeof(LightningScroll));
                m_PotentialTypes.Add(typeof(ManaDrainScroll));
                m_PotentialTypes.Add(typeof(RecallScroll));
            }

            if (level == 5)
            {
                m_PotentialTypes.Add(typeof(BladeSpiritsScroll));
                m_PotentialTypes.Add(typeof(DispelFieldScroll));
                m_PotentialTypes.Add(typeof(IncognitoScroll));
                m_PotentialTypes.Add(typeof(MagicReflectScroll));
                m_PotentialTypes.Add(typeof(MindBlastScroll));
                m_PotentialTypes.Add(typeof(ParalyzeScroll));
                m_PotentialTypes.Add(typeof(PoisonFieldScroll));
                m_PotentialTypes.Add(typeof(SummonCreatureScroll));
            }

            if (level == 6)
            {
                m_PotentialTypes.Add(typeof(DispelScroll));
                m_PotentialTypes.Add(typeof(EnergyBoltScroll));
                m_PotentialTypes.Add(typeof(ExplosionScroll));
                m_PotentialTypes.Add(typeof(InvisibilityScroll));
                m_PotentialTypes.Add(typeof(MarkScroll));
                m_PotentialTypes.Add(typeof(MassCurseScroll));
                m_PotentialTypes.Add(typeof(ParalyzeFieldScroll));
                m_PotentialTypes.Add(typeof(RevealScroll));
            }

            if (level == 7)
            {
                m_PotentialTypes.Add(typeof(ChainLightningScroll));
                m_PotentialTypes.Add(typeof(EnergyFieldScroll));
                m_PotentialTypes.Add(typeof(FlamestrikeScroll));
                m_PotentialTypes.Add(typeof(GateTravelScroll));
                m_PotentialTypes.Add(typeof(ManaVampireScroll));
                m_PotentialTypes.Add(typeof(MassDispelScroll));
                m_PotentialTypes.Add(typeof(MeteorSwarmScroll));
                m_PotentialTypes.Add(typeof(PolymorphScroll));
            }

            if (level == 8)
            {
                m_PotentialTypes.Add(typeof(EarthquakeScroll));
                m_PotentialTypes.Add(typeof(EnergyVortexScroll));
                m_PotentialTypes.Add(typeof(ResurrectionScroll));
                m_PotentialTypes.Add(typeof(SummonAirElementalScroll));
                m_PotentialTypes.Add(typeof(SummonDaemonScroll));
                m_PotentialTypes.Add(typeof(SummonEarthElementalScroll));
                m_PotentialTypes.Add(typeof(SummonFireElementalScroll));
                m_PotentialTypes.Add(typeof(SummonWaterElementalScroll));
            }

            #endregion

            if (m_PotentialTypes.Count == 0)
            {
                return(null);
            }

            spellScroll = (SpellScroll)Activator.CreateInstance(m_PotentialTypes[Utility.RandomMinMax(0, m_PotentialTypes.Count - 1)]);

            return(spellScroll);
        }
        public void EjectScroll(Mobile from, Type spellType, bool ejectAll)
        {
            if (from == null)
            {
                return;
            }

            SpellScrollLibraryEntry entry = GetLibraryEntry(spellType);

            if (entry == null)
            {
                return;
            }

            if (entry.Count == 0)
            {
                from.SendMessage("You do not have any copies of that spell currently stored within this library.");
                return;
            }

            if (from.Backpack == null)
            {
                return;
            }

            if (from.Backpack.TotalItems == from.Backpack.MaxItems)
            {
                from.SendMessage("Your backpack is at maximum capacity. Please remove some items and try again.");
                return;
            }

            if (ejectAll)
            {
                int amount = entry.Count;

                SpellScroll spellScroll = (SpellScroll)Activator.CreateInstance(entry.SpellType);

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

                    from.Backpack.DropItem(spellScroll);
                }

                else
                {
                    amount = 0;
                }

                if (amount > 1)
                {
                    from.SendMessage("You retrieve several spell scrolls from the library.");
                    from.SendSound(addItemSound);
                }

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

                else
                {
                    from.SendMessage("You do not have any scrolls of that in the library.");
                }
            }

            else
            {
                SpellScroll spellScroll = (SpellScroll)Activator.CreateInstance(entry.SpellType);

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

                    from.Backpack.DropItem(spellScroll);
                    from.SendSound(addItemSound);
                    from.SendMessage("You retrieve a spell scroll from the library.");
                }

                else
                {
                    from.SendMessage("You do not have any scrolls of that in the library.");
                }
            }
        }
Esempio n. 26
0
			public SpellScrollTarget(SpellScroll scroll)
				: base(12, false, TargetFlags.None)
			{
				m_Scroll = scroll;
			}
Esempio n. 27
0
 public IceStrikeSpell(Mobile caster, Server.Items.SpellScroll scroll) : base(caster, scroll, m_Info)
 {
 }
Esempio n. 28
0
 public bool IsFifthCircleOrAbove( Mobile from, SpellScroll scroll )
 {
     MagerySpell spell = SpellRegistry.NewSpell( scroll.SpellID, from, scroll ) as MagerySpell;
     if ( spell != null && spell.Circle > SpellCircle.Fourth )
         return true;
     else
         return false;
 }