Пример #1
0
        public static void GivePowerScrollTo( Mobile m, PowerScroll ps )
        {
            if( ps == null || m == null )	//sanity
                return;

            m.SendLocalizedMessage( 1049524 ); // You have received a scroll of power!

            if( !Core.SE || m.Alive )
                m.AddToBackpack( ps );
            else
            {
                if( m.Corpse != null && !m.Corpse.Deleted )
                    m.Corpse.DropItem( ps );
                else
                    m.AddToBackpack( ps );
            }

            if( m is PlayerMobile )
            {
                PlayerMobile pm = (PlayerMobile)m;

                for( int j = 0; j < pm.JusticeProtectors.Count; ++j )
                {
                    Mobile prot = pm.JusticeProtectors[j];

                    if( prot.Map != m.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion( m, prot ) )
                        continue;

                    int chance = 0;

                    switch( VirtueHelper.GetLevel( prot, VirtueName.Justice ) )
                    {
                        case VirtueLevel.Seeker: chance = 60; break;
                        case VirtueLevel.Follower: chance = 80; break;
                        case VirtueLevel.Knight: chance = 100; break;
                    }

                    if( chance > Utility.Random( 100 ) )
                    {
                        PowerScroll powerScroll = new PowerScroll( ps.Skill, ps.Value );

                        prot.SendLocalizedMessage( 1049368 ); // You have been rewarded for your dedication to Justice!

                        if( !Core.SE || prot.Alive )
                            prot.AddToBackpack( powerScroll );
                        else
                        {
                            if( prot.Corpse != null && !prot.Corpse.Deleted )
                                prot.Corpse.DropItem( powerScroll );
                            else
                                prot.AddToBackpack( powerScroll );
                        }
                    }
                }
            }
        }
Пример #2
0
        public static void GivePowerScrollTo(Mobile m, PowerScroll ps)
        {
            if (m == null || ps == null) //sanity
            {
                return;
            }

            m.SendLocalizedMessage(1049524); // You have received a scroll of power!

            m.AddToBackpack(ps);
        }
Пример #3
0
		public override void Deserialize(GenericReader reader)
		{
			base.Deserialize(reader);

			int version = reader.ReadInt();

			int count = reader.ReadEncodedInt();

			m_Entries = new ArrayList( count );

			for ( int i = 0; i < count; ++i )
			{
				SkillName skill = (SkillName)reader.ReadEncodedInt();
				double amount = reader.ReadDouble();
				PowerScroll scroll = new PowerScroll(skill,amount);
				m_Entries.Add(scroll);
			}
		}
Пример #4
0
        public static void GivePowerScrollFelTo(Mobile killer, PowerScroll PS)
        {
            if (PS == null || killer == null)	//sanity
                return;

            killer.SendLocalizedMessage(1049524); // You have received a scroll of power!

            if (killer.Alive)
                killer.AddToBackpack(PS);
            else
            {
                if (killer.Corpse != null && !killer.Corpse.Deleted)
                    killer.Corpse.DropItem(PS);
                else
                    killer.AddToBackpack(PS);
            }

            // Justice reward
            PlayerMobile pm = (PlayerMobile)killer;
            for (int j = 0; j < pm.JusticeProtectors.Count; ++j)
            {
                Mobile prot = (Mobile)pm.JusticeProtectors[j];
                if (prot.Map != killer.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion(killer, prot))
                    continue;

                int chance = 0;

                switch (VirtueHelper.GetLevel(prot, VirtueName.Justice))
                {
                    case VirtueLevel.Seeker: chance = 60; break;
                    case VirtueLevel.Follower: chance = 80; break;
                    case VirtueLevel.Knight: chance = 100; break;
                }

                if (chance > Utility.Random(100))
                {
                    prot.SendLocalizedMessage(1049368); // You have been rewarded for your dedication to Justice!
                    PowerScroll PSduplicate = new PowerScroll(PS.Skill, PS.Value);
                    prot.AddToBackpack(PSduplicate);
                }
            }
        }
Пример #5
0
        public override void GiveRewards()
        {
            base.GiveRewards();

            Backpack pack = new Backpack();
            PowerScroll ps = new PowerScroll( SkillName.Imbuing, 110.0 );
            pack.Hue = Utility.RandomDyedHue();
            ps.LootType = LootType.Regular;
            pack.AddItem( ps );

            Owner.AddToBackpack( pack );
            Owner.SendLocalizedMessage( 1074360, "backpack" ); // You receive a reward: backpack
        }
Пример #6
0
            public InternalGump( Mobile mobile, PowerScroll scroll )
                : base(25, 50)
            {
                m_Mobile = mobile;
                m_Scroll = scroll;

                AddPage( 0 );

                AddBackground( 25, 10, 420, 200, 5054 );

                AddImageTiled( 33, 20, 401, 181, 2624 );
                AddAlphaRegion( 33, 20, 401, 181 );

                AddHtmlLocalized( 40, 48, 387, 100, 1049469, true, true ); /* Using a scroll increases the maximum amount of a specific skill or your maximum statistics.
                                                                            * When used, the effect is not immediately seen without a gain of points with that skill or statistics.
                                                                            * You can view your maximum skill values in your skills window.
                                                                            * You can view your maximum statistic value in your statistics window.
                                                                            */

                AddHtmlLocalized( 125, 148, 200, 20, 1049478, 0xFFFFFF, false, false ); // Do you wish to use this scroll?

                AddButton( 100, 172, 4005, 4007, 1, GumpButtonType.Reply, 0 );
                AddHtmlLocalized( 135, 172, 120, 20, 1046362, 0xFFFFFF, false, false ); // Yes

                AddButton( 275, 172, 4005, 4007, 0, GumpButtonType.Reply, 0 );
                AddHtmlLocalized( 310, 172, 120, 20, 1046363, 0xFFFFFF, false, false ); // No

                double value = scroll.m_Value;

                if ( value == 105.0 )
                    AddHtmlLocalized( 40, 20, 260, 20, 1049635, 0xFFFFFF, false, false ); // Wonderous Scroll (105 Skill):
                else if ( value == 110.0 )
                    AddHtmlLocalized( 40, 20, 260, 20, 1049636, 0xFFFFFF, false, false ); // Exalted Scroll (110 Skill):
                else if ( value == 115.0 )
                    AddHtmlLocalized( 40, 20, 260, 20, 1049637, 0xFFFFFF, false, false ); // Mythical Scroll (115 Skill):
                else if ( value == 120.0 )
                    AddHtmlLocalized( 40, 20, 260, 20, 1049638, 0xFFFFFF, false, false ); // Legendary Scroll (120 Skill):
                else
                    AddHtml( 40, 20, 260, 20, String.Format( "<basefont color=#FFFFFF>Power Scroll ({0} Skill):</basefont>", value ), false, false );

                AddHtmlLocalized( 310, 20, 120, 20, 1044060 + (int)scroll.m_Skill, 0xFFFFFF, false, false );
            }
Пример #7
0
		private Item CreatePowerScroll(int type, int level)
		{
			PowerScroll ps = null;
			SkillName[] skillNames = new SkillName[]
			{ SkillName.Bushido, SkillName.Ninjitsu, SkillName.Necromancy, SkillName.Chivalry, SkillName.Focus,
                SkillName.Magery, SkillName.Swords, SkillName.Fencing, SkillName.Macing, SkillName.Archery,
                SkillName.Blacksmith, SkillName.Musicianship, SkillName.AnimalTaming};
			//10923,10924,10925,10926,10927,10928,10929,10930,10931,10932,10933,10934,10935
			try
			{
				if (type == 10927)
					ps = PowerScroll.CreateRandomNoCraft(level, level);
				else
				{
					SkillName skillName = skillNames[type - 10923];
					ps = new PowerScroll(skillName, 100 + level);
				}
			}
			catch { return null; }
			return (Item)ps;
		}
 public PowerScrollBookEntry(PowerScroll ps)
 {
     m_Skill = ps.Skill;
     m_SkillValue = (int)ps.Value;
 }
Пример #9
0
        public void OnTarget(Mobile from, object targeted)
        {
            if (targeted is Item && !((Item)targeted).IsChildOf(from.Backpack))
            {
                from.SendMessage("The scroll must be in your backpack to bind.");
                return;
            }

            switch (m_BinderType)
            {
            case BinderType.None:
            {
                if (targeted is PowerScroll)
                {
                    PowerScroll ps = (PowerScroll)targeted;

                    if (ps.Value >= 120)
                    {
                        from.SendLocalizedMessage(1113144);                                     //This scroll is already the highest of its type and cannot be bound.
                    }
                    else
                    {
                        double value  = ps.Value;
                        int    needed = 0;
                        if (value == 105)
                        {
                            needed = 8;
                        }
                        else if (value == 110)
                        {
                            needed = 12;
                        }
                        else if (value == 115)
                        {
                            needed = 10;
                        }
                        else
                        {
                            return;
                        }

                        m_Value      = value;
                        m_Needed     = needed;
                        m_Has        = 1;
                        m_Skill      = ps.Skill;
                        m_BinderType = BinderType.PowerScroll;
                        ps.Delete();
                        from.SendMessage("Binding Powerscroll.");
                        from.PlaySound(0x249);
                    }
                }
                else if (targeted is StatCapScroll)
                {
                    StatCapScroll ps = (StatCapScroll)targeted;

                    if (ps.Value >= 250)
                    {
                        from.SendLocalizedMessage(1113144);                                     //This scroll is already the highest of its type and cannot be bound.
                    }
                    else
                    {
                        double value  = ps.Value;
                        int    needed = 0;
                        if (value == 230)
                        {
                            needed = 6;
                        }
                        else if (value == 235)
                        {
                            needed = 8;
                        }
                        else if (value == 240)
                        {
                            needed = 8;
                        }
                        else if (value == 245)
                        {
                            needed = 5;
                        }
                        else
                        {
                            return;
                        }

                        m_Value      = value;
                        m_Needed     = needed;
                        m_Has        = 1;
                        m_BinderType = BinderType.StatScroll;
                        ps.Delete();
                        from.SendMessage("Binding Stat Scroll.");
                        from.PlaySound(0x249);
                    }
                }
                else if (targeted is ScrollOfTranscendence)
                {
                    ScrollOfTranscendence sot = (ScrollOfTranscendence)targeted;

                    m_Skill      = sot.Skill;
                    m_BinderType = BinderType.SOT;
                    m_Needed     = 5;
                    m_Has        = sot.Value;
                    sot.Delete();
                    from.SendLocalizedMessage(1113146);         //Binding Scrolls of Transcendence
                    from.PlaySound(0x249);
                }
                else
                {
                    from.SendLocalizedMessage(1113142);                                     //You may only bind powerscrolls, stats scrolls or scrolls of transcendence.
                }
                break;
            }

            case BinderType.PowerScroll:
            {
                if (targeted is PowerScroll)
                {
                    PowerScroll ps = (PowerScroll)targeted;

                    if (ps.Value == m_Value)
                    {
                        if (ps.Skill == m_Skill)
                        {
                            m_Has++;

                            if (m_Has >= m_Needed)
                            {
                                GiveItem(from, new PowerScroll(m_Skill, m_Value + 5));
                                from.SendLocalizedMessage(1113145);                                                 //You've completed your binding and received an upgraded version of your scroll!
                                ps.Delete();
                                Delete();
                            }
                            else
                            {
                                ps.Delete();
                                from.PlaySound(0x249);
                                from.SendMessage("Binding Powerscroll.");
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(1113143);         //This scroll does not match the type currently being bound.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1113143);                                         //This scroll does not match the type currently being bound.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1113143);                                     //This scroll does not match the type currently being bound.
                }
                break;
            }

            case BinderType.StatScroll:
            {
                if (targeted is StatCapScroll)
                {
                    StatCapScroll stat = (StatCapScroll)targeted;

                    if (stat.Value == m_Value)
                    {
                        m_Has++;

                        if (m_Has >= m_Needed)
                        {
                            GiveItem(from, new StatCapScroll((int)m_Value + 5));
                            from.SendLocalizedMessage(1113145);                                             //You've completed your binding and received an upgraded version of your scroll!
                            stat.Delete();
                            Delete();
                        }
                        else
                        {
                            from.SendMessage("Binding Stat Scroll.");
                            from.PlaySound(0x249);
                            stat.Delete();
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1113143);                                         //This scroll does not match the type currently being bound.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1113143);                                 //This scroll does not match the type currently being bound.
                }
                break;
            }

            case BinderType.SOT:
            {
                if (targeted is ScrollOfTranscendence)
                {
                    ScrollOfTranscendence sot = (ScrollOfTranscendence)targeted;

                    if (sot.Skill == m_Skill)
                    {
                        double newValue = sot.Value + m_Has;

                        if (newValue == m_Needed)
                        {
                            GiveItem(from, new ScrollOfTranscendence(m_Skill, m_Needed));
                            from.SendLocalizedMessage(1113145);                                             //You've completed your binding and received an upgraded version of your scroll!
                            Delete();
                        }
                        else if (newValue > m_Needed)
                        {
                            from.SendGump(new BinderWarningGump(newValue, this, sot, m_Needed));
                        }
                        else
                        {
                            m_Has += sot.Value;
                            sot.Delete();
                            from.PlaySound(0x249);
                            from.SendLocalizedMessage(1113146);         //Binding Scrolls of Transcendence
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1113143);                                         //This scroll does not match the type currently being bound.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1113143);         //This scroll does not match the type currently being bound.
                }
                break;
            }
            }

            InvalidateProperties();
        }
Пример #10
0
        public void OnTarget(Mobile from, object targeted)
        {
            if (targeted is Item && !((Item)targeted).IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1060640); // The item must be in your backpack to use it.
                return;
            }

            switch (BinderType)
            {
            case BinderType.None:
            {
                if (targeted is PowerScroll)
                {
                    PowerScroll ps = (PowerScroll)targeted;

                    if (ps.Value >= 120)
                    {
                        from.SendLocalizedMessage(1113144);         // This scroll is already the highest of its type and cannot be bound.
                        return;
                    }

                    double value  = ps.Value;
                    int    needed = 0;

                    if (value == 105)
                    {
                        needed = 8;
                    }
                    else if (value == 110)
                    {
                        needed = 12;
                    }
                    else if (value == 115)
                    {
                        needed = 10;
                    }
                    else
                    {
                        return;
                    }

                    Value      = value;
                    Needed     = needed;
                    Has        = 1;
                    Skill      = ps.Skill;
                    BinderType = BinderType.PowerScroll;
                    ps.Delete();
                }
                else if (targeted is StatCapScroll)
                {
                    StatCapScroll ss = (StatCapScroll)targeted;

                    if (ss.Value >= 250)
                    {
                        from.SendLocalizedMessage(1113144);         //This scroll is already the highest of its type and cannot be bound.
                        return;
                    }

                    double value  = ss.Value;
                    int    needed = 0;

                    if (value == 230)
                    {
                        needed = 6;
                    }
                    else if (value == 235)
                    {
                        needed = 8;
                    }
                    else if (value == 240)
                    {
                        needed = 8;
                    }
                    else if (value == 245)
                    {
                        needed = 5;
                    }
                    else
                    {
                        return;
                    }

                    Value      = value;
                    Needed     = needed;
                    Has        = 1;
                    BinderType = BinderType.StatScroll;
                    ss.Delete();
                }
                else if (targeted is ScrollOfTranscendence)
                {
                    ScrollOfTranscendence sot = (ScrollOfTranscendence)targeted;

                    if (sot.Value >= 5.0)
                    {
                        from.SendLocalizedMessage(1113144);         //This scroll is already the highest of its type and cannot be bound.
                        return;
                    }

                    Skill      = sot.Skill;
                    BinderType = BinderType.SOT;
                    Needed     = 2;
                    Has        = sot.Value;
                    sot.Delete();
                }
                else
                {
                    from.SendLocalizedMessage(1113142);         // You may only bind powerscrolls, stats scrolls or scrolls of transcendence.
                }

                break;
            }

            case BinderType.PowerScroll:
            {
                if (targeted is PowerScroll)
                {
                    PowerScroll ps = (PowerScroll)targeted;

                    if (ps.Skill != Skill || ps.Value != Value)
                    {
                        from.SendLocalizedMessage(1113143);         // This scroll does not match the type currently being bound.
                        return;
                    }

                    Has++;

                    if (Has >= Needed)
                    {
                        GiveItem(from, new PowerScroll(Skill, Value + 5));
                        from.SendLocalizedMessage(1113145);         // You've completed your binding and received an upgraded version of your scroll!
                        ps.Delete();
                        Delete();
                    }
                    else
                    {
                        ps.Delete();
                    }
                }
                else if (targeted is ScrollBinderDeed)
                {
                    ScrollBinderDeed sb = (ScrollBinderDeed)targeted;

                    if (sb == this)
                    {
                        return;
                    }

                    if (sb.BinderType != BinderType || sb.Value != Value || sb.Skill != Skill)
                    {
                        from.SendLocalizedMessage(1113143);         // This scroll does not match the type currently being bound.
                        return;
                    }

                    Has += sb.Has;

                    double rest = Has - Needed;

                    if (Has >= Needed)
                    {
                        GiveItem(from, new PowerScroll(Skill, Value + 5));
                        from.SendLocalizedMessage(1113145);         // You've completed your binding and received an upgraded version of your scroll!
                        Delete();
                    }

                    if (rest > 0)
                    {
                        sb.Has = rest;
                    }
                    else
                    {
                        sb.Delete();
                    }
                }
                break;
            }

            case BinderType.StatScroll:
            {
                if (targeted is StatCapScroll)
                {
                    StatCapScroll ss = (StatCapScroll)targeted;

                    if (ss.Value != Value)
                    {
                        from.SendLocalizedMessage(1113143);         // This scroll does not match the type currently being bound.
                        return;
                    }

                    Has++;

                    if (Has >= Needed)
                    {
                        GiveItem(from, new StatCapScroll((int)Value + 5));
                        from.SendLocalizedMessage(1113145);         // You've completed your binding and received an upgraded version of your scroll!
                        ss.Delete();
                        Delete();
                    }
                    else
                    {
                        ss.Delete();
                    }
                }
                else if (targeted is ScrollBinderDeed)
                {
                    ScrollBinderDeed sb = (ScrollBinderDeed)targeted;

                    if (sb == this)
                    {
                        return;
                    }

                    if (sb.BinderType != BinderType || sb.Value != Value)
                    {
                        from.SendLocalizedMessage(1113143);         // This scroll does not match the type currently being bound.
                        return;
                    }

                    Has += sb.Has;

                    double rest = Has - Needed;

                    if (Has >= Needed)
                    {
                        GiveItem(from, new StatCapScroll((int)Value + 5));
                        from.SendLocalizedMessage(1113145);         // You've completed your binding and received an upgraded version of your scroll!
                        Delete();
                    }

                    if (rest > 0)
                    {
                        sb.Has = rest;
                    }
                    else
                    {
                        sb.Delete();
                    }
                }
                break;
            }

            case BinderType.SOT:
            {
                if (targeted is ScrollOfTranscendence)
                {
                    ScrollOfTranscendence sot = (ScrollOfTranscendence)targeted;

                    if (sot.Skill != Skill)
                    {
                        from.SendLocalizedMessage(1113143);         // This scroll does not match the type currently being bound.
                        return;
                    }

                    if (sot.Value >= 5.0)
                    {
                        from.SendLocalizedMessage(1113144);         // This scroll is already the highest of its type and cannot be bound.
                        return;
                    }

                    double newValue = sot.Value + Has;

                    if (newValue > 2 && Needed == 2)
                    {
                        Needed = 5;
                    }

                    if (newValue == Needed)
                    {
                        GiveItem(from, new ScrollOfTranscendence(Skill, Needed));
                        from.SendLocalizedMessage(1113145);         // You've completed your binding and received an upgraded version of your scroll!
                        Delete();
                    }
                    else if (newValue > Needed)
                    {
                        from.SendGump(new BinderWarningGump(newValue, this, sot, Needed));
                    }
                    else
                    {
                        Has += sot.Value;
                        sot.Delete();
                    }
                }
                else if (targeted is ScrollBinderDeed)
                {
                    ScrollBinderDeed sb = (ScrollBinderDeed)targeted;

                    if (sb == this)
                    {
                        return;
                    }

                    if (sb.BinderType != BinderType || sb.Skill != Skill)
                    {
                        from.SendLocalizedMessage(1113143);         // This scroll does not match the type currently being bound.
                        return;
                    }

                    double newValue = sb.Has + Has;

                    if (newValue > 2 && Needed == 2)
                    {
                        Needed = 5;
                    }

                    Has = newValue;

                    double rest = Has - Needed;

                    if (Has >= Needed)
                    {
                        GiveItem(from, new ScrollOfTranscendence(Skill, Needed));
                        from.SendLocalizedMessage(1113145);         // You've completed your binding and received an upgraded version of your scroll!
                        Delete();
                    }

                    if (rest > 0)
                    {
                        sb.Has = rest;
                    }
                    else
                    {
                        sb.Delete();
                    }
                }
                break;
            }
            }
        }
Пример #11
0
        public override void DoTransmute(Mobile from, Recipe r)
        {
            if (r == null || from == null)
            {
                return;
            }

            Recipes rid = (Recipes)r.RecipeID;

            switch (rid)
            {
            case Recipes.PowerScrollSkillChange:
            {
                // get the target value from one of the powerscrolls
                Item[] slist = this.FindItemsByType(typeof(PowerScroll), true);

                double value = 0;
                // make sure they are all of the same value
                foreach (Item s in slist)
                {
                    if (value == 0)
                    {
                        value = ((PowerScroll)s).Value;
                    }
                    else
                    {
                        if (value != ((PowerScroll)s).Value)
                        {
                            from.SendMessage("All powerscrolls must be of the same level");
                            return;
                        }
                    }
                }

                PowerScroll newps = PowerScroll.CreateRandom((int)(value - 100), (int)(value - 100));

                // consume ingredients
                this.ConsumeAll();

                // add the new powerscroll
                this.DropItem(newps);

                break;
            }

            case Recipes.SmallBODChange:
            {
                // get the target value from one of the powerscrolls
                Item[] slist = this.FindItemsByType(typeof(SmallBOD), true);

                Type t = null;
                // make sure they are all of the same type
                foreach (Item s in slist)
                {
                    if (t == null)
                    {
                        t = ((SmallBOD)s).GetType();
                    }
                    else
                    {
                        if (t != ((SmallBOD)s).GetType())
                        {
                            from.SendMessage("All BODs must be of the same type");
                            return;
                        }
                    }
                }

                SmallBOD newbod = null;

                if (t == typeof(SmallTailorBOD))
                {
                    newbod = new SmallTailorBOD();
                }
                else if (t == typeof(SmallSmithBOD))
                {
                    newbod = new SmallSmithBOD();
                }
                else
                {
                    from.SendMessage("Cannot transmute those BODs");
                    return;
                }

                if (newbod == null)
                {
                    return;
                }

                // consume ingredients
                this.ConsumeAll();

                // add the new powerscroll
                this.DropItem(newbod);

                break;
            }

            case Recipes.LargeBODChange:
            {
                // get the target value from one of the powerscrolls
                Item[] slist = this.FindItemsByType(typeof(LargeBOD), true);

                Type t = null;
                // make sure they are all of the same type
                foreach (Item s in slist)
                {
                    if (t == null)
                    {
                        t = ((LargeBOD)s).GetType();
                    }
                    else
                    {
                        if (t != ((LargeBOD)s).GetType())
                        {
                            from.SendMessage("All BODs must be of the same type");
                            return;
                        }
                    }
                }

                LargeBOD newbod = null;

                if (t == typeof(LargeTailorBOD))
                {
                    newbod = new LargeTailorBOD();
                }
                else if (t == typeof(LargeSmithBOD))
                {
                    newbod = new LargeSmithBOD();
                }
                else
                {
                    from.SendMessage("Cannot transmute those BODs");
                    return;
                }

                if (newbod == null)
                {
                    return;
                }

                // consume ingredients
                this.ConsumeAll();

                // add the new powerscroll
                this.DropItem(newbod);

                break;
            }

            case Recipes.UpgradeAncientAugment:
            {
                // check what type of augment is being upgraded
                BaseSocketAugmentation augment = null;
                if (this.Items.Count > 0)
                {
                    augment = this.Items[0] as BaseSocketAugmentation;
                }

                if (augment == null)
                {
                    return;
                }

                // make sure they are all the same
                foreach (Item i in this.Items)
                {
                    if (augment.GetType() != i.GetType())
                    {
                        return;
                    }
                }

                // take the ingredients
                this.ConsumeAll();
                // and add the result
                if (augment is AncientDiamond)
                {
                    this.DropItem(new LegendaryDiamond());
                }
                else if (augment is AncientSapphire)
                {
                    this.DropItem(new LegendarySapphire());
                }
                else if (augment is AncientSkull)
                {
                    this.DropItem(new LegendarySkull());
                }
                else if (augment is AncientTourmaline)
                {
                    this.DropItem(new LegendaryTourmaline());
                }
                else if (augment is AncientWood)
                {
                    this.DropItem(new LegendaryWood());
                }
                else if (augment is AncientRuby)
                {
                    this.DropItem(new LegendaryRuby());
                }
                else if (augment is AncientEmerald)
                {
                    this.DropItem(new LegendaryEmerald());
                }
                else if (augment is AncientAmethyst)
                {
                    this.DropItem(new LegendaryAmethyst());
                }

                break;
            }

            case Recipes.UpgradeLegendaryAugment:
            {
                // check what type of augment is being upgraded
                BaseSocketAugmentation augment = null;
                if (this.Items.Count > 0)
                {
                    augment = this.Items[0] as BaseSocketAugmentation;
                }

                if (augment == null)
                {
                    return;
                }

                // make sure they are all the same
                foreach (Item i in this.Items)
                {
                    if (augment.GetType() != i.GetType())
                    {
                        return;
                    }
                }

                // take the ingredients
                this.ConsumeAll();

                // and add the result
                if (augment is LegendaryDiamond)
                {
                    this.DropItem(new MythicDiamond());
                }
                else if (augment is LegendarySapphire)
                {
                    this.DropItem(new MythicSapphire());
                }
                else if (augment is LegendarySkull)
                {
                    this.DropItem(new MythicSkull());
                }
                else if (augment is LegendaryTourmaline)
                {
                    this.DropItem(new MythicTourmaline());
                }
                else if (augment is LegendaryWood)
                {
                    this.DropItem(new MythicWood());
                }
                else if (augment is LegendaryRuby)
                {
                    this.DropItem(new MythicRuby());
                }
                else if (augment is LegendaryEmerald)
                {
                    this.DropItem(new MythicEmerald());
                }
                else if (augment is LegendaryAmethyst)
                {
                    this.DropItem(new MythicAmethyst());
                }

                break;
            }

            case Recipes.UpgradeCrystalAugment:
            {
                // check what type of augment is being upgraded
                BaseSocketAugmentation augment = null;
                if (this.Items.Count > 0)
                {
                    augment = this.Items[0] as BaseSocketAugmentation;
                }

                if (augment == null)
                {
                    return;
                }

                // make sure they are all the same
                foreach (Item i in this.Items)
                {
                    if (augment.GetType() != i.GetType())
                    {
                        return;
                    }
                }

                // take the ingredients
                this.ConsumeAll();

                // and add the result
                if (augment is RhoCrystal)
                {
                    this.DropItem(new RadiantRhoCrystal());
                }
                else if (augment is RysCrystal)
                {
                    this.DropItem(new RadiantRysCrystal());
                }
                else if (augment is WyrCrystal)
                {
                    this.DropItem(new RadiantWyrCrystal());
                }
                else if (augment is FreCrystal)
                {
                    this.DropItem(new RadiantFreCrystal());
                }
                else if (augment is TorCrystal)
                {
                    this.DropItem(new RadiantTorCrystal());
                }
                else if (augment is VelCrystal)
                {
                    this.DropItem(new RadiantVelCrystal());
                }
                else if (augment is XenCrystal)
                {
                    this.DropItem(new RadiantXenCrystal());
                }
                else if (augment is PolCrystal)
                {
                    this.DropItem(new RadiantPolCrystal());
                }
                else if (augment is WolCrystal)
                {
                    this.DropItem(new RadiantWolCrystal());
                }
                else if (augment is BalCrystal)
                {
                    this.DropItem(new RadiantBalCrystal());
                }
                else if (augment is TalCrystal)
                {
                    this.DropItem(new RadiantTalCrystal());
                }
                else if (augment is JalCrystal)
                {
                    this.DropItem(new RadiantJalCrystal());
                }
                else if (augment is RalCrystal)
                {
                    this.DropItem(new RadiantRalCrystal());
                }
                else if (augment is KalCrystal)
                {
                    this.DropItem(new RadiantKalCrystal());
                }

                break;
            }

            case Recipes.RecoverAugmentation:
            {
                // does item have any sockets on it?
                Item b = this.FindItemByType(typeof(BaseArmor), true);
                if (b == null)
                {
                    b = this.FindItemByType(typeof(BaseWeapon), true);
                }
                if (b == null)
                {
                    b = this.FindItemByType(typeof(BaseJewel), true);
                }

                XmlSockets a = XmlAttach.FindAttachment(b, typeof(XmlSockets)) as XmlSockets;
                if (a == null)
                {
                    // if so then forget it
                    from.SendMessage("This item is not socketed.");
                    return;
                }

                if (a.NSockets == 0)
                {
                    from.SendMessage("This item is has no sockets.");
                    return;
                }

                BaseSocketAugmentation augment = a.RecoverRandomAugmentation(from, b);

                if (augment != null)
                {
                    // consume the crystal
                    this.ConsumeTotal(typeof(AncientRuby), 1, true);

                    // put the recovered augment in the container
                    this.DropItem(augment);

                    from.SendMessage("Recovered a {0} augmentation.", augment.Name);

                    // update the sockets gump
                    a.OnIdentify(from);
                }
                else
                {
                    from.SendMessage("Failed to recover augmentation.");
                }

                break;
            }

            case Recipes.HammerOfRecovery:
            {
                // consume ingredients
                this.ConsumeAll();

                // add the hammer
                this.DropItem(new HammerOfRecovery(1));

                break;
            }

            case Recipes.ExceptionalSocketHammer:
            {
                // consume ingredients
                this.ConsumeAll();

                // add the hammer
                this.DropItem(new ExceptionalSocketHammer(1));

                break;
            }

            case Recipes.SocketWeapon:
            {
                // does the weapon already have any sockets on it?
                Item          b = this.FindItemByType(typeof(BaseWeapon), true);
                XmlAttachment a = XmlAttach.FindAttachment(b, typeof(XmlSockets));
                if (a != null)
                {
                    // if so then forget it
                    from.SendMessage("Weapon already socketed.");
                    return;
                }
                // otherwise add the socket
                XmlAttach.AttachTo(b, new XmlSockets(1));
                // consume the crystal
                this.ConsumeTotal(typeof(RadiantRhoCrystal), 1, true);
                break;
            }

            case Recipes.SocketArmor:
            {
                // does the armor already have any sockets on it?
                Item          b = this.FindItemByType(typeof(BaseArmor), true);
                XmlAttachment a = XmlAttach.FindAttachment(b, typeof(XmlSockets));
                if (a != null)
                {
                    // if so then forget it
                    from.SendMessage("Armor already socketed.");
                    return;
                }
                // otherwise add the socket
                XmlAttach.AttachTo(b, new XmlSockets(1));
                // consume the crystal
                this.ConsumeTotal(typeof(RadiantRhoCrystal), 1, true);
                break;
            }

                // Uncomment the follow recipes if you have XmlMobFactions installed and you would like to allow faction gain through these recipes
            #if (XMLMOBFACTIONS)
            case Recipes.UndeadFaction:
            {
                // how much gold is being offered
                Item b     = FindItemByType(typeof(Gold), true);
                int  value = 0;
                if (b != null)
                {
                    value = b.Amount / 10;
                }
                // take the ingredients
                ConsumeAll();
                // add the faction
                XmlAttach.AttachTo(from, new XmlAddFaction("Undead", value));
                break;
            }

            case Recipes.AbyssFaction:
            {
                // how much gold is being offered
                Item b     = FindItemByType(typeof(Gold), true);
                int  value = 0;
                if (b != null)
                {
                    value = b.Amount / 10;
                }
                // take the ingredients
                ConsumeAll();
                // add the faction
                XmlAttach.AttachTo(from, new XmlAddFaction("Abyss", value));
                break;
            }

            case Recipes.HumanoidFaction:
            {
                // how much gold is being offered
                Item b     = FindItemByType(typeof(Gold), true);
                int  value = 0;
                if (b != null)
                {
                    value = b.Amount / 10;
                }
                // take the ingredients
                ConsumeAll();
                // add the faction
                XmlAttach.AttachTo(from, new XmlAddFaction("Humanoid", value));
                break;
            }

            case Recipes.ReptilianFaction:
            {
                // how much gold is being offered
                Item b     = FindItemByType(typeof(Gold), true);
                int  value = 0;
                if (b != null)
                {
                    value = b.Amount / 10;
                }
                // take the ingredients
                ConsumeAll();
                // add the faction
                XmlAttach.AttachTo(from, new XmlAddFaction("Reptilian", value));
                break;
            }

            case Recipes.ArachnidFaction:
            {
                // how much gold is being offered
                Item b     = FindItemByType(typeof(Gold), true);
                int  value = 0;
                if (b != null)
                {
                    value = b.Amount / 10;
                }
                // take the ingredients
                ConsumeAll();
                // add the faction
                XmlAttach.AttachTo(from, new XmlAddFaction("Arachnid", value));
                break;
            }

            case Recipes.ElementalFaction:
            {
                // how much gold is being offered
                Item b     = FindItemByType(typeof(Gold), true);
                int  value = 0;
                if (b != null)
                {
                    value = b.Amount / 10;
                }
                // take the ingredients
                ConsumeAll();
                // add the faction
                XmlAttach.AttachTo(from, new XmlAddFaction("Elemental", value));
                break;
            }

            case Recipes.UnderworldFaction:
            {
                // how much gold is being offered
                Item b     = FindItemByType(typeof(Gold), true);
                int  value = 0;
                if (b != null)
                {
                    value = b.Amount / 10;
                }
                // take the ingredients
                ConsumeAll();
                // add the faction
                XmlAttach.AttachTo(from, new XmlAddFaction("Underworld", value));
                break;
            }
// end of commented-out XmlMobFactions recipes
            #endif
            }

            // give effects for successful transmutation
            from.PlaySound(503);

            base.DoTransmute(from, r);
        }
 public PowerScrollBookEntry(PowerScroll ps)
 {
     m_Skill      = ps.Skill;
     m_SkillValue = (int)ps.Value;
 }
Пример #13
0
        public void CreateLoot()
        {
            int chance = Utility.Random( 100 );
            Item m_Reward = null;
            if ( chance < 3 )
                m_Reward = new NameChangeDeed();
            else if ( chance < 33 )
                m_Reward = new PowerScroll( PowerScroll.Skills[Utility.Random(PowerScroll.Skills.Count)], (100+(Utility.Random(3)+2)*5) );
            else if ( chance < 50 )
                m_Reward = new StatCapScroll( (225+(Utility.Random(2)+1)*5) );
            else if ( chance < 55 )
                m_Reward = new MagicSewingKit();
            else if ( chance < 60 )
                m_Reward = new ClothingBlessDeed();
            else if ( chance < 70 )
                m_Reward = new RunicSewingKit(CraftResource.BarbedLeather, ( Utility.Random( 2 ) + 3 ) );
            else {
                int amount = Utility.RandomMinMax( 5, 10 )*10000;
                m_Reward = new BankCheck(amount);
            }

            PackItem( new CopperBar(Utility.Random( 2 ) + 2) );
            if (m_Reward != null)
            {
                PackItem( m_Reward );
                Timer m_TimerCursed = new CursedArtifactSystem.CursedTimer( m_Reward, 6 );
                m_TimerCursed.Start();
            }
        }
Пример #14
0
            public override void OnResponse(NetState sender, RelayInfo info)
            {
                if (m_Deed.Deleted)
                {
                    return;
                }

                PowerScroll scroll = null;

                switch (info.ButtonID)
                {
                case 0: return;

                case 1: scroll = new PowerScroll(SkillName.Alchemy, m_DeedLevel); break;

                case 2: scroll = new PowerScroll(SkillName.Anatomy, m_DeedLevel); break;

                case 3: scroll = new PowerScroll(SkillName.AnimalLore, m_DeedLevel); break;

                case 4: scroll = new PowerScroll(SkillName.AnimalTaming, m_DeedLevel); break;

                case 5: scroll = new PowerScroll(SkillName.Archery, m_DeedLevel); break;

                case 6: scroll = new PowerScroll(SkillName.ArmsLore, m_DeedLevel); break;

                case 7: scroll = new PowerScroll(SkillName.Begging, m_DeedLevel); break;

                case 8: scroll = new PowerScroll(SkillName.Blacksmith, m_DeedLevel); break;

                case 9: scroll = new PowerScroll(SkillName.Bushido, m_DeedLevel); break;

                case 10: scroll = new PowerScroll(SkillName.Camping, m_DeedLevel); break;

                case 11: scroll = new PowerScroll(SkillName.Carpentry, m_DeedLevel); break;

                case 12: scroll = new PowerScroll(SkillName.Cartography, m_DeedLevel); break;

                case 13: scroll = new PowerScroll(SkillName.Chivalry, m_DeedLevel); break;

                case 14: scroll = new PowerScroll(SkillName.Cooking, m_DeedLevel); break;

                case 15: scroll = new PowerScroll(SkillName.DetectHidden, m_DeedLevel); break;

                case 16: scroll = new PowerScroll(SkillName.Discordance, m_DeedLevel); break;

                case 17: scroll = new PowerScroll(SkillName.EvalInt, m_DeedLevel); break;

                case 18: scroll = new PowerScroll(SkillName.Fencing, m_DeedLevel); break;

                case 19: scroll = new PowerScroll(SkillName.Fletching, m_DeedLevel); break;

                case 20: scroll = new PowerScroll(SkillName.Focus, m_DeedLevel); break;

                case 21: scroll = new PowerScroll(SkillName.Forensics, m_DeedLevel); break;

                case 22: scroll = new PowerScroll(SkillName.Healing, m_DeedLevel); break;

                case 23: scroll = new PowerScroll(SkillName.Herding, m_DeedLevel); break;

                case 24: scroll = new PowerScroll(SkillName.Hiding, m_DeedLevel); break;

                case 25: scroll = new PowerScroll(SkillName.Inscribe, m_DeedLevel); break;

                case 26: scroll = new PowerScroll(SkillName.ItemID, m_DeedLevel); break;

                case 27: scroll = new PowerScroll(SkillName.Lockpicking, m_DeedLevel); break;

                case 28: scroll = new PowerScroll(SkillName.Lumberjacking, m_DeedLevel); break;

                case 29: scroll = new PowerScroll(SkillName.Macing, m_DeedLevel); break;

                case 30: scroll = new PowerScroll(SkillName.Magery, m_DeedLevel); break;

                case 31: scroll = new PowerScroll(SkillName.MagicResist, m_DeedLevel); break;

                case 32: scroll = new PowerScroll(SkillName.Meditation, m_DeedLevel); break;

                case 33: scroll = new PowerScroll(SkillName.Mining, m_DeedLevel); break;

                case 34: scroll = new PowerScroll(SkillName.Musicianship, m_DeedLevel); break;

                case 35: scroll = new PowerScroll(SkillName.Fishing, m_DeedLevel); break;

                case 36: scroll = new PowerScroll(SkillName.Necromancy, m_DeedLevel); break;

                case 37: scroll = new PowerScroll(SkillName.Ninjitsu, m_DeedLevel); break;

                case 38: scroll = new PowerScroll(SkillName.Parry, m_DeedLevel); break;

                case 39: scroll = new PowerScroll(SkillName.Peacemaking, m_DeedLevel); break;

                case 40: scroll = new PowerScroll(SkillName.Poisoning, m_DeedLevel); break;

                case 41: scroll = new PowerScroll(SkillName.Provocation, m_DeedLevel); break;

                case 42: scroll = new PowerScroll(SkillName.RemoveTrap, m_DeedLevel); break;

                case 43: scroll = new PowerScroll(SkillName.Snooping, m_DeedLevel); break;

                case 44: scroll = new PowerScroll(SkillName.Spellweaving, m_DeedLevel); break;

                case 45: scroll = new PowerScroll(SkillName.SpiritSpeak, m_DeedLevel); break;

                case 46: scroll = new PowerScroll(SkillName.Stealing, m_DeedLevel); break;

                case 47: scroll = new PowerScroll(SkillName.Stealth, m_DeedLevel); break;

                case 48: scroll = new PowerScroll(SkillName.Swords, m_DeedLevel); break;

                case 49: scroll = new PowerScroll(SkillName.Tactics, m_DeedLevel); break;

                case 50: scroll = new PowerScroll(SkillName.Tailoring, m_DeedLevel); break;

                case 51: scroll = new PowerScroll(SkillName.TasteID, m_DeedLevel); break;

                case 52: scroll = new PowerScroll(SkillName.Tinkering, m_DeedLevel); break;

                case 53: scroll = new PowerScroll(SkillName.Tracking, m_DeedLevel); break;

                case 54: scroll = new PowerScroll(SkillName.Veterinary, m_DeedLevel); break;

                case 55: scroll = new PowerScroll(SkillName.Wrestling, m_DeedLevel); break;

                case 56: return;
                }

                if (scroll != null)
                {
                    m_From.Backpack.DropItem(scroll);
                    m_From.SendMessage("A" + m_DeedLevel + " Powerscroll has been added to your backpack!");
                    m_Deed.Delete();
                }
            }
Пример #15
0
        public static void Fill(LockableContainer cont, int level)
        {
            cont.Movable = false;
            cont.Locked  = true;

            if (level == 0)
            {
                cont.LockLevel = 0;                 // Can't be unlocked

                cont.DropItem(new Gold(Utility.RandomMinMax(200, 300)));

                if (Utility.RandomDouble() < 0.75)
                {
                    cont.DropItem(new TreasureMap(0, Map.Felucca));
                }
            }
            else
            {
                cont.TrapType  = TrapType.ExplosionTrap;
                cont.TrapPower = level * 25;
                cont.TrapLevel = level;

                switch (level)
                {
                case 1: cont.RequiredSkill = 35; break;

                case 2: cont.RequiredSkill = 50; break;

                case 3: cont.RequiredSkill = 75; break;

                case 4: cont.RequiredSkill = 90; break;

                case 5: cont.RequiredSkill = 98; break;

                case 6: cont.RequiredSkill = 100; break;
                }

                cont.LockLevel    = cont.RequiredSkill - 10;
                cont.MaxLockLevel = cont.RequiredSkill + 40;

                var gold = new Gold(level * 500);
                if (level == 6)
                {
                    gold.Amount = 5000;
                }

                cont.DropItem(gold);

                int reagents = level == 0 ? 4 : 8;

                for (int i = 0; i < reagents; i++)
                {
                    Item item = Loot.RandomPossibleReagent();
                    item.Amount = RegsPerLevel[level];
                    cont.DropItem(item);
                }

                for (int i = 0; i < level * 3; ++i)
                {
                    cont.DropItem(Loot.RandomScroll(0, Math.Min(47, (level + 1) * 8 - 1), SpellbookType.Regular));
                }

                int minimumMod = 1;
                int maximumMod = MaxModPerLevel[level];

                //Luthius Expansion
                double craftingComponentLoops = 4;
                double prestigeScrollLoops    = 3;
                double spellHueDeedLoops      = 1;

                double craftingComponentChance = .02;
                double prestigeScrollChance    = .1;
                double spellHueDeedChance      = .005;

                switch (level)
                {
                case 1:
                    craftingComponentChance = .10;
                    prestigeScrollChance    = .1;
                    spellHueDeedChance      = .005;
                    break;

                case 2:
                    craftingComponentChance = .15;
                    prestigeScrollChance    = .2;
                    spellHueDeedChance      = .01;
                    break;

                case 3:
                    craftingComponentChance = .20;
                    prestigeScrollChance    = .3;
                    spellHueDeedChance      = .015;
                    break;

                case 4:
                    craftingComponentChance = .25;
                    prestigeScrollChance    = .4;
                    spellHueDeedChance      = .02;
                    break;

                case 5:
                    craftingComponentChance = .30;
                    prestigeScrollChance    = .5;
                    spellHueDeedChance      = .025;
                    break;

                case 6:
                    craftingComponentChance = .40;
                    prestigeScrollChance    = .6;
                    spellHueDeedChance      = .03;
                    break;
                }

                for (int a = 0; a < craftingComponentLoops; a++)
                {
                    if (Utility.RandomDouble() <= craftingComponentChance)
                    {
                        cont.DropItem(CraftingComponent.GetRandomCraftingComponent(1));
                    }
                }

                for (int a = 0; a < prestigeScrollLoops; a++)
                {
                    if (Utility.RandomDouble() <= prestigeScrollChance)
                    {
                        cont.DropItem(new PrestigeScroll());
                    }
                }

                for (int a = 0; a < spellHueDeedLoops; a++)
                {
                    if (Utility.RandomDouble() <= spellHueDeedChance)
                    {
                        cont.DropItem(new SpellHueDeed());
                    }
                }

                for (int i = 0; i < ItemsPerLevel[level]; ++i)
                {
                    if (Utility.RandomDouble() < 0.30)
                    {
                        BaseWeapon weapon = Loot.RandomWeapon();
                        weapon.DamageLevel     = (WeaponDamageLevel)Utility.RandomMinMax(minimumMod, maximumMod);
                        weapon.AccuracyLevel   = (WeaponAccuracyLevel)Utility.RandomMinMax(minimumMod, maximumMod);
                        weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.RandomMinMax(minimumMod, maximumMod);

                        cont.DropItem(weapon);
                    }
                    else
                    {
                        BaseArmor armor = Loot.RandomArmorOrShield();
                        armor.ProtectionLevel = (ArmorProtectionLevel)Utility.RandomMinMax(minimumMod, maximumMod);
                        armor.DurabilityLevel = (ArmorDurabilityLevel)Utility.RandomMinMax(minimumMod, maximumMod);

                        cont.DropItem(armor);
                    }
                }
            }

            for (int i = 0; i < level; i++)
            {
                Item item = Loot.RandomGem();
                item.Amount = GemsPerLevel[level];
                cont.DropItem(item);
            }

            // rares
            if (level == 6 && Utility.Random(50) == 0)
            {
                cont.DropItem(new SpecialHairDye());
            }

            switch (level)
            {
            case 6:
                if (Utility.RandomDouble() < 0.09)
                {
                    cont.DropItem(PowerScroll.CreateRandom(5, 10));
                }
                break;

            case 5:
                if (Utility.RandomDouble() < 0.06)
                {
                    cont.DropItem(new RareSandals());
                }
                break;

            case 4:
                if (Utility.RandomDouble() < 0.03)
                {
                    cont.DropItem(new BossCloth());
                }
                break;

            default:
                if (Utility.RandomDouble() < RareChancePerLevel[level])
                {
                    int index = Utility.Random(LootPack.RareCraftingIngredients.Length);
                    var rare  = LootPack.RareCraftingIngredients[index].Construct();
                    cont.DropItem(rare);
                }
                break;
            }

            int chance = 610 - (100 * level);

            if (Utility.Random(chance) == 0)
            {
                cont.DropItem(new RareCloth());
            }
        }
Пример #16
0
		public override void OnResponse( Server.Network.NetState sender, RelayInfo info )
		{
			int bp;//button pushed
			switch(info.ButtonID)
			{
				case 1:bp = 0;break;
				case 2:bp = 1;break;
				case 3:bp = 2;break;
				case 4:bp = 3;break;
				case 5:bp = 4;break;
				case 6:bp = 5;break;
				case 7:bp = 6;break;
				case 8:bp = 7;break;
				case 9:bp = 8;break;
				case 10:bp = 9;break;
				case 11:bp = 10;break;
				case 12:bp = 11;break;
				case 13:bp = 12;break;
				case 14:bp = 13;break;
				case 15:bp = 14;break;
				case 16:bp = 15;break;
				case 17:bp = 16;break;
				case 18:bp = 17;break;
				case 19:bp = 18;break;
				case 20:bp = 19;break;
				default: return;
			}

			PowerScroll scroll = m_Book.Entries[bp] as PowerScroll;
			SkillName sklnm = scroll.Skill;
			double sklval = scroll.Value;
			PowerScroll newScroll = new PowerScroll(sklnm, sklval);
			m_From.AddToBackpack(newScroll);
			m_Book.Entries.RemoveAt(bp);
			m_Book.InvalidateProperties();
		}