예제 #1
0
        private static void AllCrafts_OnTarget(Mobile from, object target)
        {
            if (target is BookOfSpellCrafts)
            {
                BookOfSpellCrafts book = target as BookOfSpellCrafts;

                book.Content = ulong.MaxValue;
                book.InvalidateProperties();
                from.SendMessage("Book filled.");
            }
            else
            {
                from.SendMessage("That is not a Book of Spellcrafts.");
            }
        }
예제 #2
0
        private static void AddCraft_OnTarget(Mobile from, object target, object state)
        {
            int num = (int)state;

            if (target is BookOfSpellCrafts)
            {
                BookOfSpellCrafts book = target as BookOfSpellCrafts;

                if (book.HasCraft(num))
                {
                    from.SendMessage("The book already has this craft.");
                }
                else
                {
                    book.Content |= (ulong)1 << num;
                    book.InvalidateProperties();
                    from.SendMessage("The spellcraft has been added to the book.");
                }
            }
            else
            {
                from.SendMessage("That is not a Book of Spellcrafts.");
            }
        }
예제 #3
0
        private static void UseMagicJewels( Mobile from, BookOfSpellCrafts book, Item item, int amount )
        {
            // Consume the jewel possibly destroying the item and/or causing damage to the spell caster.

            if ( SpellCraftConfig.UseCharges && book.Charges >= amount )
            {
                book.Charges -= amount;
            }
            else if ( !from.Backpack.ConsumeTotal( typeof( MagicJewel ), amount ) )
                throw new SpellCraftException( MsgNums.NotEnoughJewels );

            if ( Utility.RandomDouble() < SpellCraftConfig.ExplodeChance )
            {
                from.FixedParticles( 0x36BD, 20, 10, 5044, EffectLayer.Head );
                from.PlaySound( 0x307 );
                from.Damage( Utility.RandomMinMax( SpellCraftConfig.ExplodeMinDmg, SpellCraftConfig.ExplodeMaxDmg ) );

                if ( Utility.RandomDouble() < SpellCraftConfig.DestroyChance )
                {
                    item.Delete();
                    throw new SpellCraftException( MsgNums.ItemDestoyed );
                }
                throw new SpellCraftException( MsgNums.ItemIntact );
            }

            // Success effects
            from.PlaySound( 0x387 );
            from.FixedParticles( 0x36E4, 20, 10, 5044, EffectLayer.Head );
            from.PlaySound( 0x1E5 );
            from.SendMessage( MessageList[ (int)(MsgNums.Success) ] );
        }
예제 #4
0
        public SpellCraftBook( Mobile owner, BookOfSpellCrafts book, int currentPage )
            : base(10, 10)
        {
            int totalCrafts = book.Count;

            owner.CloseGump( typeof( SpellCraftBook ) );

            m_Book = book;
            Resizable = false;
            Closable = Disposable = Dragable = true;

            // Lay out the index page and then add all of the content pages. The order of
            // the index items is always the same but the order of the content pages can
            // vary since the book must re-open to the last viewed page when using a craft.

            // Create a list of page numbers then put the current page at the head.
            // One more entry than needed as page numbers begin at one.

            int [] pageOrder = new int[ kTotalPages + 1 ] { 0, 1, 2, 3, 4, 5, 6, 7 };

            if ( 1 != currentPage && currentPage > 0 && currentPage <= kTotalPages )
            {
                int temp = pageOrder[ 1 ];
                pageOrder[ 1 ] = pageOrder[ currentPage ];
                pageOrder[ currentPage ] = temp;
            }

            // Layout page zero with the index entries on it.

            AddImage( 50, 50, 0x1F4 );
            AddHtml( 76, 60, 185, 20, "<center>Spellcraft Index</center", false, false );
            m_GumpY = 85;

            for( int i = 1; i <= kTotalPages; i++ )
            {
                AddButton( 85, m_GumpY, 0x1523, 0x1523, 100 + i, GumpButtonType.Page, pageOrder[ i ] );
                AddLabel( 100, m_GumpY, 0, m_PageTitles[ i ] );
                m_GumpY += 20;
            }
            AddLabel( 85, 235, 0, "Total Spellcrafts:" );
            AddHtml( 170, 235, 80, 20,
                String.Format( "<div align=right>{0} of {1}</div>", totalCrafts, SpellCraftConfig.LastAosCraftID + 1 ), false, false );

            // Abracadabra!
            Candle candle = owner.FindItemOnLayer( Layer.TwoHanded ) as Candle;
            if ( m_ShowHiddenText = ( candle != null && candle.Burning ))
            {
                owner.SendMessage( kRevealText );
                owner.SendMessage( kRevealText2 );
            }

            // Add all of the content pages according to the order list
            for( int i = 1; i <= kTotalPages; i++ )
            {
                switch ( pageOrder[ i ] )
                {
                    case 1: AddCastingPage( i, 1 ); break;
                    case 2: AddResistPage( i, 2 ); break;
                    case 3: AddStatPage( i, 3 ); break;
                    case 4: AddWeaponPageOne( i, 4 ); break;
                    case 5: AddWeaponPageTwo( i, 5 ); break;
                    case 6: AddWeaponPageThree( i, 6 ); break;
                    case 7: AddMiscellaneousPage( i, 7 ); break;
                }
            }
        }
예제 #5
0
 public static void ApplySlayerAttribute( Mobile from, BookOfSpellCrafts book, int craftId, BaseInstrument instrument )
 {
     CheckItem( from, instrument );
     UseMagicJewels( from, book, instrument, SpellCraftConfig.MagicJewelRequirements[craftId] );
     do
     {
         instrument.Slayer = GetRandomSlayer( ComputeSkillScalar( from ) );
     }
     while ( instrument.Slayer == SlayerName.None );
     MarkInstrument( from, instrument );
 }
예제 #6
0
 public CraftState( BookOfSpellCrafts book, int i  )
 {
     Book = book; Id = i;
 }
예제 #7
0
 public static void ApplyResistance( Mobile from, BookOfSpellCrafts book, int craftId, BaseArmor armor, ResistanceType resistance, int minimum, int maximum )
 {
     CheckItem( from, armor, false );
     UseMagicJewels( from, book, armor, SpellCraftConfig.MagicJewelRequirements[craftId] );
     int scalar = ComputeSkillScalar( from );
     ApplyResistance( armor, SpellCraftConfig.MinimumIntensity * scalar, SpellCraftConfig.MaximumIntensity * scalar, resistance, minimum, maximum );
     MarkArmor( from, armor );
 }
예제 #8
0
 public static void ApplySlayerAttribute( Mobile from, BookOfSpellCrafts book, int craftId, BaseWeapon weapon )
 {
     CheckItem( from, weapon, ( weapon.Slayer == 0 ) );
     UseMagicJewels( from, book, weapon, SpellCraftConfig.MagicJewelRequirements[craftId] );
     do
     {
         weapon.Slayer = GetRandomSlayer( ComputeSkillScalar( from ) );
     }
     while ( weapon.Slayer == SlayerName.None );
     MarkWeapon( from, weapon );
 }
예제 #9
0
 public static void ApplyAttribute( Mobile from, BookOfSpellCrafts book, int craftId, BaseJewel jewel, AosElementAttribute attribute, int minimum, int maximum )
 {
     CheckItem( from, jewel, ( jewel.Resistances[ attribute ] == 0 ) );
     UseMagicJewels( from, book, jewel, SpellCraftConfig.MagicJewelRequirements[craftId] );
     int scalar = ComputeSkillScalar( from );
     ApplyAttribute( jewel.Resistances, SpellCraftConfig.MinimumIntensity * scalar, SpellCraftConfig.MaximumIntensity * scalar, attribute, minimum, maximum );
 }
예제 #10
0
 public static void ApplyAttribute( Mobile from, BookOfSpellCrafts book, int craftId, BaseHat hat, AosArmorAttribute attribute, int minimum, int maximum, int scale )
 {
     CheckItem( from, hat, ( hat.ClothingAttributes[ attribute ] == 0 ) );
     UseMagicJewels( from, book, hat, SpellCraftConfig.MagicJewelRequirements[craftId] );
     int scalar = ComputeSkillScalar( from );
     ApplyAttribute( hat.ClothingAttributes, SpellCraftConfig.MinimumIntensity * scalar, SpellCraftConfig.MaximumIntensity * scalar, attribute, minimum, maximum, scale );
     MarkHat( from, hat );
 }
예제 #11
0
 public static void ApplyAttribute( Mobile from, BookOfSpellCrafts book, int craftId, BaseWeapon weapon, AosWeaponAttribute attribute, int minimum, int maximum, int scale )
 {
     CheckItem( from, weapon, ( weapon.WeaponAttributes[ attribute ] == 0 ) );
     UseMagicJewels( from, book, weapon, SpellCraftConfig.MagicJewelRequirements[craftId] );
     int scalar = ComputeSkillScalar( from );
     ApplyAttribute( weapon.WeaponAttributes, SpellCraftConfig.MinimumIntensity * scalar, SpellCraftConfig.MaximumIntensity * scalar, attribute, minimum, maximum, scale );
     MarkWeapon( from, weapon );
 }
예제 #12
0
 public static void ApplyAttribute( Mobile from, BookOfSpellCrafts book, int craftId, BaseShield shield, AosAttribute attribute, int minimum, int maximum, int scale )
 {
     CheckItem( from, shield, ( shield.Attributes[ attribute ] == 0 ) );
     UseMagicJewels( from, book, shield, SpellCraftConfig.MagicJewelRequirements[craftId] );
     int scalar = ComputeSkillScalar( from );
     ApplyAttribute( shield.Attributes, SpellCraftConfig.MinimumIntensity * scalar, SpellCraftConfig.MaximumIntensity * scalar, attribute, minimum, maximum, scale );
     MarkArmor( from, shield );
 }
예제 #13
0
 public static void ApplyAttribute( Mobile from, BookOfSpellCrafts book, int craftId, BaseArmor armor, AosArmorAttribute attribute, int minimum, int maximum )
 {
     CheckItem( from, armor, ( armor.ArmorAttributes[ attribute ] == 0 ) );
     UseMagicJewels( from, book, armor, SpellCraftConfig.MagicJewelRequirements[craftId] );
     int scalar = ComputeSkillScalar( from );
     SpellCraft.ApplyAttribute( armor.ArmorAttributes, SpellCraftConfig.MinimumIntensity * scalar, SpellCraftConfig.MaximumIntensity * scalar, attribute, minimum, maximum );
     MarkArmor( from, armor );
 }