コード例 #1
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Spellbook)
                {
                    if (from.CheckAlive() && !m_Scroll.Deleted && m_Scroll.Movable && m_Scroll.Amount >= 1)
                    {
                        Spellbook book = (Spellbook)targeted;

                        SpellbookType type = Spellbook.GetTypeForSpell(m_Scroll.SpellID);

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

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

                                m_Scroll.Consume();

                                from.Send(new Network.PlaySound(0x249, book.GetWorldLocation()));
                            }
                        }
                    }
                }
            }
コード例 #2
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (dropped is SpellScroll scroll && scroll.Amount == 1)
            {
                SpellbookType type = GetTypeForSpell(scroll.SpellEntry);

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

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

                        scroll.Delete();

                        from.SendSound(0x249, GetWorldLocation());
                        return(true);
                    }

                    return(false);
                }
            }
コード例 #3
0
        public static SpellScroll RandomScroll(int minIndex, int maxIndex, SpellbookType type)
        {
            Type[] types;

            switch (type)
            {
            default:
                //case SpellbookType.Regular:
                types = m_RegularScrollTypes;
                break;

            case SpellbookType.Necromancer:
                types = (Core.SE ? m_SENecromancyScrollTypes : m_NecromancyScrollTypes);
                break;

            case SpellbookType.Paladin:
                types = m_PaladinScrollTypes;
                break;

            case SpellbookType.Arcanist:
                types = m_ArcanistScrollTypes;
                break;

            case SpellbookType.Mystic:
                types = m_MysticismScrollTypes;
                break;
            }

            return(Construct(types, Utility.RandomMinMax(minIndex, maxIndex)) as SpellScroll);
        }
コード例 #4
0
        public static Spellbook FindSpellbookInList(List <Spellbook> list, Mobile from, SpellEntry spellId,
                                                    SpellbookType type)
        {
            Container pack = from.Backpack;

            for (int i = list.Count - 1; i >= 0; --i)
            {
                if (i >= list.Count)
                {
                    continue;
                }

                Spellbook book = list[i];

                if (!book.Deleted && (book.Parent == from || pack != null && book.Parent == pack) &&
                    ValidateSpellbook(book, spellId, type))
                {
                    return(book);
                }

                list.RemoveAt(i);
            }

            return(null);
        }
コード例 #5
0
ファイル: Loot.cs プロジェクト: ygtkms/ServUO
        public static SpellScroll RandomScroll(int minIndex, int maxIndex, SpellbookType type)
        {
            Type[] types;

            switch (type)
            {
            default:
                types = m_MageryScrollTypes;
                break;

            case SpellbookType.Necromancer:
                types = m_NecromancyScrollTypes;
                break;

            case SpellbookType.Arcanist:
                types = m_ArcanistScrollTypes;
                break;

            case SpellbookType.Mystic:
                types = m_MysticismScrollTypes;
                break;
            }

            return(Construct(types, Utility.RandomMinMax(minIndex, maxIndex)) as SpellScroll);
        }
コード例 #6
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);
            }
        }
コード例 #7
0
 public static SpellScroll RandomScroll(int minIndex, int maxIndex, SpellbookType type)
 {
     Type[] types = type switch
     {
         SpellbookType.Necromancer => (Core.SE ? SENecromancyScrollTypes : NecromancyScrollTypes),
         SpellbookType.Paladin => PaladinScrollTypes,
         SpellbookType.Arcanist => ArcanistScrollTypes,
         _ => RegularScrollTypes,
     };
     return(Construct(types, Utility.RandomMinMax(minIndex, maxIndex)) as SpellScroll);
 }
コード例 #8
0
        public static SpellScroll RandomScroll(int minIndex, int maxIndex, SpellbookType type)
        {
            Type[] types;

            switch (type)
            {
            default:
            case SpellbookType.Regular: types = m_RegularScrollTypes; break;
            }

            return(Construct(types, Utility.RandomMinMax(minIndex, maxIndex)) as SpellScroll);
        }
コード例 #9
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);
            }
        }
コード例 #10
0
ファイル: Spellbook.cs プロジェクト: zerodowned/angelisland
        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);
            }
        }
コード例 #11
0
ファイル: Spellbook.cs プロジェクト: ironclad88/ServZH
        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);
        }
コード例 #12
0
ファイル: Spellbook.cs プロジェクト: zerodowned/vivre-uo
        public static Spellbook Find(Mobile from, int spellID, SpellbookType type)
        {
            if (from == null)
            {
                return(null);
            }

            if (from.Deleted)
            {
                m_Table.Remove(from);
                return(null);
            }

            List <Spellbook> list = null;

            m_Table.TryGetValue(from, out list);

            bool searchAgain = false;

            if (list == null)
            {
                m_Table[from] = list = FindAllSpellbooks(from);
            }
            else
            {
                searchAgain = true;
            }

            Spellbook book = FindSpellbookInList(list, from, spellID, type);

            // Scriptiz : Si le bouquin contenant le sort n'est pas le bouquin équippé, on refait une recherche !
            // Ajout :  || (GetTypeForSpell(spellID) != SpellbookType.Regular && book != FindEquippedSpellbook(from))
            // Scriptiz edit 24/04/12 : on retire les modifs dégueu
            if ((book == null && searchAgain))// || (GetTypeForSpell(spellID) != SpellbookType.Regular && book != FindEquippedSpellbook(from)))
            {
                m_Table[from] = list = FindAllSpellbooks(from);

                book = FindSpellbookInList(list, from, spellID, type);
            }

            return(book);
        }
コード例 #13
0
        public static Spellbook Find(Mobile from, int spellID, SpellbookType type)
        {
            if (from == null)
            {
                return(null);
            }

            if (from.Deleted)
            {
                m_Table.Remove(from);
                return(null);
            }

            List <Spellbook> list = null;

            m_Table.TryGetValue(from, out list);

            bool searchAgain = false;

            if (list == null)
            {
                m_Table[from] = list = FindAllSpellbooks(from);
            }

            else
            {
                searchAgain = true;
            }

            Spellbook book = FindSpellbookInList(list, from, spellID, type);

            if (book == null && searchAgain)
            {
                m_Table[from] = list = FindAllSpellbooks(from);

                book = FindSpellbookInList(list, from, spellID, type);
            }

            return(book);
        }
コード例 #14
0
		public static Spellbook FindSpellbookInList( ArrayList list, Mobile from, int spellID, SpellbookType type )
		{
			Container pack = from.Backpack;

			for ( int i = list.Count - 1; i >= 0; --i )
			{
				if ( i >= list.Count )
					continue;

				Spellbook book = (Spellbook)list[i];

				if ( !book.Deleted && (book.Parent == from || (pack != null && book.Parent == pack)) && ValidateSpellbook( book, spellID, type ) )
					return book;

				list.Remove( i );
			}

			return null;
		}
コード例 #15
0
		public static Spellbook Find( Mobile from, int spellID, SpellbookType type )
		{
			if ( from == null )
				return null;

			ArrayList list = (ArrayList)m_Table[from];

			if ( from.Deleted )
			{
				m_Table.Remove( from );
				return null;
			}

			bool searchAgain = false;

			if ( list == null )
				m_Table[from] = list = FindAllSpellbooks( from );
			else
				searchAgain = true;

			Spellbook book = FindSpellbookInList( list, from, spellID, type );

			if ( book == null && searchAgain )
			{
				m_Table[from] = list = FindAllSpellbooks( from );

				book = FindSpellbookInList( list, from, spellID, type );
			}

			return book;
		}
コード例 #16
0
 public static bool ValidateSpellbook(Spellbook book, int spellID, SpellbookType type)
 {
     return(book.SpellbookType == type && (spellID == -1 || book.HasSpell(spellID)));
 }
コード例 #17
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.");
                    }
                }
            }
コード例 #18
0
ファイル: Spellbook.cs プロジェクト: greeduomacro/vivre-uo
		public static Spellbook Find( Mobile from, int spellID, SpellbookType type )
		{
			if ( from == null )
				return null;

			if ( from.Deleted )
			{
				m_Table.Remove( from );
				return null;
			}

			List<Spellbook> list = null;

			m_Table.TryGetValue( from, out list );

			bool searchAgain = false;

			if ( list == null )
				m_Table[from] = list = FindAllSpellbooks( from );
			else
				searchAgain = true;

			Spellbook book = FindSpellbookInList( list, from, spellID, type );

            // Scriptiz : Si le bouquin contenant le sort n'est pas le bouquin équippé, on refait une recherche !
            // Ajout :  || (GetTypeForSpell(spellID) != SpellbookType.Regular && book != FindEquippedSpellbook(from))
            // Scriptiz edit 24/04/12 : on retire les modifs dégueu
            if ((book == null && searchAgain))// || (GetTypeForSpell(spellID) != SpellbookType.Regular && book != FindEquippedSpellbook(from)))
			{
				m_Table[from] = list = FindAllSpellbooks( from );

				book = FindSpellbookInList( list, from, spellID, type );
			}

			return book;
		}
コード例 #19
0
ファイル: Spellbook.cs プロジェクト: Delphi79/RunUO-2.0-RC1
        public static Spellbook FindSpellbookInList(ArrayList list, Mobile from, int spellID, SpellbookType type)
        {
            Container pack = from.Backpack;

            for (int i = list.Count - 1; i >= 0; --i)
            {
                if (i >= list.Count)
                {
                    continue;
                }

                Spellbook book = (Spellbook)list[i];

                if (!book.Deleted && (book.Parent == from || (pack != null && book.Parent == pack)) && ValidateSpellbook(book, spellID, type))
                {
                    return(book);
                }

                list.Remove(i);
            }

            return(null);
        }
コード例 #20
0
        public static SpellScroll RandomScroll(int minIndex, int maxIndex, SpellbookType type)
        {
            Type[] types = m_RegularScrollTypes;

            return(Construct(types, Utility.RandomMinMax(minIndex, maxIndex)) as SpellScroll);
        }
コード例 #21
0
        private static void CreateItem(PilferFlags pilfer, SuccessRating rating, Mobile from)
        {
            switch (pilfer)
            {
            case PilferFlags.ArcheryWeapon:
            {
                Item item = Loot.RandomRangedWeapon();
                if (item == null || !from.AddToBackpack(item))
                {
                    from.SendMessage("Unable to add item to backpack.");
                }
                else
                {
                    from.SendMessage("You pilfer {0} {1}.", StartsWithVowel(item.DefaultName) ? "an" : "a", item.DefaultName);
                }
                break;
            }

            case PilferFlags.Armor:
            {
                Item item = Loot.RandomArmorOrHat();
                if (item == null || !from.AddToBackpack(item))
                {
                    from.SendMessage("Unable to add item to backpack.");
                }
                else
                {
                    from.SendMessage("You pilfer {0} {1}.", StartsWithVowel(item.DefaultName) ? "an" : "a", item.DefaultName);
                }
                break;
            }

            case PilferFlags.Clothes:
            {
                Item item = Loot.RandomClothing(from.Map == Map.Tokuno, true);
                if (item == null || !from.AddToBackpack(item))
                {
                    from.SendMessage("Unable to add item to backpack.");
                }
                else
                {
                    from.SendMessage("You pilfer {0} {1}.", StartsWithVowel(item.DefaultName) ? "an" : "a", item.DefaultName);
                }
                break;
            }

            case PilferFlags.Food:
            {
                Item item = RandomFood();
                if (item == null || !from.AddToBackpack(item))
                {
                    from.SendMessage("Unable to add item to backpack.");
                }
                else
                {
                    from.SendMessage("You pilfer {0} {1}.", StartsWithVowel(item.DefaultName) ? "an" : "a", item.DefaultName);
                }
                break;
            }

            case PilferFlags.Jewel:
            {
                Item item = Loot.RandomJewelry();
                if (item == null || !from.AddToBackpack(item))
                {
                    from.SendMessage("Unable to add item to backpack.");
                }
                else
                {
                    from.SendMessage("You pilfer {0} {1}.", StartsWithVowel(item.DefaultName) ? "an" : "a", item.DefaultName);
                }
                break;
            }

            case PilferFlags.MetalWeapon:
            {
                Item item = Loot.RandomWeapon();
                if (item == null || !from.AddToBackpack(item))
                {
                    from.SendMessage("Unable to add item to backpack.");
                }
                else
                {
                    from.SendMessage("You pilfer {0} {1}.", StartsWithVowel(item.DefaultName) ? "an" : "a", item.DefaultName);
                }
                break;
            }

            case PilferFlags.Potion:
            {
                Item item = Loot.RandomPotion();
                if (item == null || !from.AddToBackpack(item))
                {
                    from.SendMessage("Unable to add item to backpack.");
                }
                else
                {
                    from.SendMessage("You pilfer {0} {1}.", StartsWithVowel(item.DefaultName) ? "an" : "a", item.DefaultName);
                }
                break;
            }

            case PilferFlags.Reagent:
            {
                Item item = Loot.RandomPossibleReagent();
                if (item == null || !from.AddToBackpack(item))
                {
                    from.SendMessage("Unable to add item to backpack.");
                }
                else
                {
                    from.SendMessage("You pilfer {0} {1}.", StartsWithVowel(item.DefaultName) ? "an" : "a", item.DefaultName);
                }
                break;
            }

            case PilferFlags.Scroll:
            {
                int           max  = 0;
                SpellbookType book = (SpellbookType)Utility.Random(2);
                if (book == SpellbookType.Regular)
                {
                    max = Loot.RegularScrollTypes.Length;
                    switch (rating)
                    {
                    case SuccessRating.PartialSuccess: { max /= 8; break; }

                    case SuccessRating.Success: { max /= 4; break; }

                    case SuccessRating.CompleteSuccess: { max /= 2; break; }

                    case SuccessRating.ExceptionalSuccess: { break; }
                    }
                }
                if (book == SpellbookType.Necromancer)
                {
                    max = Loot.SENecromancyScrollTypes.Length;
                }
                Item item = Loot.RandomScroll(0, max, book);
                if (item == null || !from.AddToBackpack(item))
                {
                    from.SendMessage("Unable to add item to backpack.");
                }
                else
                {
                    from.SendMessage("You pilfer {0} {1}.", StartsWithVowel(item.DefaultName) ? "an" : "a", item.DefaultName);
                }
                break;
            }

            case PilferFlags.Spellbook:
            {
                Item item = RandomSpellbook(rating);
                if (item == null || !from.AddToBackpack(item))
                {
                    from.SendMessage("Unable to add item to backpack.");
                }
                else
                {
                    from.SendMessage("You pilfer {0} {1}.", StartsWithVowel(item.DefaultName) ? "an" : "a", item.DefaultName);
                }
                break;
            }

            case PilferFlags.Wand:
            {
                BaseWand item = Loot.RandomWand();
                if (item == null || !from.AddToBackpack(item))
                {
                    from.SendMessage("Unable to add item to backpack.");
                }
                else
                {
                    from.SendMessage("You pilfer {0} {1}.", StartsWithVowel(item.Effect.ToString()) ? "an" : "a", item.Effect.ToString());
                }
                break;
            }
            }
        }
コード例 #22
0
 public static bool ValidateSpellbook(Spellbook book, SpellEntry spellId, SpellbookType type)
 {
     return(book.SpellbookType == type && (spellId == SpellEntry.None || book.HasSpell(spellId)));
 }
コード例 #23
0
 public CollectionSpellbook(SpellbookType type, int itemID, int tooltip, double points) : base(typeof(Spellbook), itemID, tooltip, 0x0, points)
 {
     m_Type = type;
 }
コード例 #24
0
 public CollectionSpellbook(SpellbookType type, int itemID, int tooltip, double points)
     : base(typeof(Spellbook), itemID, tooltip, 0x0, points)
 {
     this.m_Type = type;
 }
コード例 #25
0
ファイル: Spellbook.cs プロジェクト: zerodowned/vivre-uo
        public static Spellbook FindSpellbookInList(List <Spellbook> list, Mobile from, int spellID, SpellbookType type)
        {
            // Scriptiz 25/04/12 : on fait un check propre pour voir si il y a un spellbook équippé, si oui, et s'il s'agit
            // d'un spellbook du même type que le sort casté, il faut trouvé le sort uniquement dans ce livre équippé !
            Spellbook sb = FindEquippedSpellbook(from);

            if (sb != null && sb.SpellbookType == GetTypeForSpell(spellID))
            {
                return(sb);
            }

            Container pack = from.Backpack;

            for (int i = list.Count - 1; i >= 0; --i)
            {
                if (i >= list.Count)
                {
                    continue;
                }

                Spellbook book = list[i];

                if (!book.Deleted && (book.Parent == from || (pack != null && book.Parent == pack)) && ValidateSpellbook(book, spellID, type))
                {
                    return(book);
                }

                list.RemoveAt(i);
            }

            return(null);
        }
コード例 #26
0
ファイル: Spellbook.cs プロジェクト: greeduomacro/vivre-uo
		public static Spellbook FindSpellbookInList( List<Spellbook> list, Mobile from, int spellID, SpellbookType type )
		{
            // Scriptiz 25/04/12 : on fait un check propre pour voir si il y a un spellbook équippé, si oui, et s'il s'agit
            // d'un spellbook du même type que le sort casté, il faut trouvé le sort uniquement dans ce livre équippé !
            Spellbook sb = FindEquippedSpellbook(from);
            if (sb != null && sb.SpellbookType == GetTypeForSpell(spellID))
                return sb;

			Container pack = from.Backpack;

			for ( int i = list.Count - 1; i >= 0; --i )
			{
				if ( i >= list.Count )
					continue;

				Spellbook book = list[i];

				if ( !book.Deleted && (book.Parent == from || (pack != null && book.Parent == pack)) && ValidateSpellbook( book, spellID, type ) )
					return book;

				list.RemoveAt( i );
			}

			return null;
		}
コード例 #27
0
		public static bool ValidateSpellbook( Spellbook book, int spellID, SpellbookType type )
		{
			return ( book.SpellbookType == type && ( spellID == -1 || book.HasSpell( spellID ) ) );
		}
コード例 #28
0
ファイル: Spellbook.cs プロジェクト: mtPrimo/ServUO
		public static Spellbook Find(Mobile from, int spellID, SpellbookType type)
		{
			if (from == null)
			{
				return null;
			}

			if (from.Deleted)
			{
				m_Table.Remove(from);
				return null;
			}

			List<Spellbook> list = null;

			m_Table.TryGetValue(from, out list);

			bool searchAgain = false;

			if (list == null)
			{
				m_Table[from] = list = FindAllSpellbooks(from);
			}
			else
			{
				searchAgain = true;
			}

			Spellbook book = FindSpellbookInList(list, from, spellID, type);

			if (book == null && searchAgain)
			{
				m_Table[from] = list = FindAllSpellbooks(from);

				book = FindSpellbookInList(list, from, spellID, type);
			}

			return book;
		}
コード例 #29
0
ファイル: Loot.cs プロジェクト: nick12344356/The-Basement
		public static SpellScroll RandomScroll( int minIndex, int maxIndex, SpellbookType type )
		{
			Type[] types;

			switch ( type )
			{
				default:
				case SpellbookType.Regular: types = m_RegularScrollTypes; break;
				case SpellbookType.Necromancer: types = (Core.SE ? m_SENecromancyScrollTypes : m_NecromancyScrollTypes ); break;
				case SpellbookType.Paladin: types = m_PaladinScrollTypes; break;
				case SpellbookType.Arcanist: types = m_ArcaneScrollTypes; break;
			}

			return Construct( types, Utility.RandomMinMax( minIndex, maxIndex ) ) as SpellScroll;
		}
コード例 #30
0
ファイル: Loot.cs プロジェクト: ITLongwell/Ulmeta
        public static SpellScroll RandomScroll( int minIndex, int maxIndex, SpellbookType type )
        {
            Type[] types;

            switch( type )
            {
                default:
                case SpellbookType.Regular: types = m_RegularScrollTypes; break;
            }

            return Construct(types, Utility.RandomMinMax(minIndex, maxIndex)) as SpellScroll;
        }