RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

PowerScroll help plz

PowerScroll help plz

Ok what it is im trying to do is, the scrolls i made i want them to drop random. inside the powerscroll.cs there is a list of skill scrolls and im trying to get new ones add in but im not sure how to do this and need a little help, and im not sure it can be done that way but any way here is ps.cs and one of the scroll i put together any help or a lead in right direction would be great.thank you all who help ahead of time

Code:
using System;
using Server;
using Server.Gumps;
using Server.Network;

namespace Server.Items
{
	public class PowerScroll : Item
	{
		private SkillName m_Skill;
		private double m_Value;

		private static SkillName[] m_Skills = new SkillName[]
			{
				SkillName.Blacksmith,
				SkillName.Tailoring,
				SkillName.Swords,
				SkillName.Fencing,
				SkillName.Macing,
				SkillName.Archery,
				SkillName.Wrestling,
				SkillName.Parry,
				SkillName.Tactics,
				SkillName.Anatomy,
				SkillName.Healing,
				SkillName.Magery,
				SkillName.Meditation,
				SkillName.EvalInt,
				SkillName.MagicResist,
				SkillName.AnimalTaming,
				SkillName.AnimalLore,
				SkillName.Veterinary,
				SkillName.Musicianship,
				SkillName.Provocation,
				SkillName.Discordance,
				SkillName.Peacemaking
			};

		private static SkillName[] m_AOSSkills = new SkillName[]
			{
				SkillName.Blacksmith,
				SkillName.Tailoring,
				SkillName.Swords,
				SkillName.Fencing,
				SkillName.Macing,
				SkillName.Archery,
				SkillName.Wrestling,
				SkillName.Parry,
				SkillName.Tactics,
				SkillName.Anatomy,
				SkillName.Healing,
				SkillName.Magery,
				SkillName.Meditation,
				SkillName.EvalInt,
				SkillName.MagicResist,
				SkillName.AnimalTaming,
				SkillName.AnimalLore,
				SkillName.Veterinary,
				SkillName.Musicianship,
				SkillName.Provocation,
				SkillName.Discordance,
				SkillName.Peacemaking,
				SkillName.Chivalry,
				SkillName.Focus,
				SkillName.Necromancy,
				SkillName.Stealing,
				SkillName.Stealth,
				SkillName.SpiritSpeak
			};

		private static SkillName[] m_SESkills = new SkillName[]
			{
				SkillName.Blacksmith,
				SkillName.Tailoring,
				SkillName.Swords,
				SkillName.Fencing,
				SkillName.Macing,
				SkillName.Archery,
				SkillName.Wrestling,
				SkillName.Parry,
				SkillName.Tactics,
				SkillName.Anatomy,
				SkillName.Healing,
				SkillName.Magery,
				SkillName.Meditation,
				SkillName.EvalInt,
				SkillName.MagicResist,
				SkillName.AnimalTaming,
				SkillName.AnimalLore,
				SkillName.Veterinary,
				SkillName.Musicianship,
				SkillName.Provocation,
				SkillName.Discordance,
				SkillName.Peacemaking,
				SkillName.Chivalry,
				SkillName.Focus,
				SkillName.Necromancy,
				SkillName.Stealing,
				SkillName.Stealth,
				SkillName.SpiritSpeak,
				SkillName.Ninjitsu,
				SkillName.Bushido
			};

		public static SkillName[] Skills{ get{ return ( Core.SE ? m_SESkills : Core.AOS ? m_AOSSkills : m_Skills ); } }

		public static PowerScroll CreateRandom( int min, int max )
		{
			min /= 5;
			max /= 5;

			SkillName[] skills = PowerScroll.Skills;

			return new PowerScroll( skills[Utility.Random( skills.Length )], 100 + (Utility.RandomMinMax( min, max ) * 5));
		}

		public static PowerScroll CreateRandomNoCraft( int min, int max )
		{
			min /= 5;
			max /= 5;

			SkillName[] skills = PowerScroll.Skills;
			SkillName skillName;

			do
			{
				skillName = skills[Utility.Random( skills.Length )];
			} while ( skillName == SkillName.Blacksmith || skillName == SkillName.Tailoring );

			return new PowerScroll( skillName, 100 + (Utility.RandomMinMax( min, max ) * 5));
		}

		[Constructable]
		public PowerScroll( SkillName skill, double value ) : base( 0x14F0 )
		{
			base.Hue = 0x481;
			base.Weight = 1.0;


			m_Skill = skill;
			m_Value = value;
			if ( m_Value > 105.0 )
				LootType = LootType.Cursed;
		}

		public PowerScroll( Serial serial ) : base( serial )
		{
		}

		[CommandProperty( AccessLevel.GameMaster )]
		public SkillName Skill
		{
			get
			{
				return m_Skill;
			}
			set
			{
				m_Skill = value;
			}
		}

		[CommandProperty( AccessLevel.GameMaster )]
		public double Value
		{
			get
			{
				return m_Value;
			}
			set
			{
				m_Value = value;
			}
		}

		private string GetNameLocalized()
		{
			return String.Concat( "#", (1044060 + (int)m_Skill).ToString() );
		}

		private string GetName()
		{
			int index = (int)m_Skill;
			SkillInfo[] table = SkillInfo.Table;

			if ( index >= 0 && index < table.Length )
				return table[index].Name.ToLower();
			else
				return "???";
		}

		public override void AddNameProperty(ObjectPropertyList list)
		{
			if ( m_Value == 105.0 )
				list.Add( 1049639, GetNameLocalized() ); // a wonderous scroll of ~1_type~ (105 Skill)
			else if ( m_Value == 110.0 )
				list.Add( 1049640, GetNameLocalized() ); // an exalted scroll of ~1_type~ (110 Skill)
			else if ( m_Value == 115.0 )
				list.Add( 1049641, GetNameLocalized() ); // a mythical scroll of ~1_type~ (115 Skill)
			else if ( m_Value == 120.0 )
				list.Add( 1049642, GetNameLocalized() ); // a legendary scroll of ~1_type~ (120 Skill)
			else
				list.Add( "a power scroll of {0} ({1} Skill)", GetName(), m_Value );
		}

		public override void OnSingleClick( Mobile from )
		{
			if ( m_Value == 105.0 )
				base.LabelTo( from, 1049639, GetNameLocalized() ); // a wonderous scroll of ~1_type~ (105 Skill)
			else if ( m_Value == 110.0 )
				base.LabelTo( from, 1049640, GetNameLocalized() ); // an exalted scroll of ~1_type~ (110 Skill)
			else if ( m_Value == 115.0 )
				base.LabelTo( from, 1049641, GetNameLocalized() ); // a mythical scroll of ~1_type~ (115 Skill)
			else if ( m_Value == 120.0 )
				base.LabelTo( from, 1049642, GetNameLocalized() ); // a legendary scroll of ~1_type~ (120 Skill)
			else
				base.LabelTo( from, "a power scroll of {0} ({1} Skill)", GetName(), m_Value );
		}

		public void Use( Mobile from, bool firstStage )
		{
			if ( Deleted )
				return;

			if ( IsChildOf( from.Backpack ) )
			{
				Skill skill = from.Skills[m_Skill];

				if ( skill != null )
				{
					if ( skill.Cap >= m_Value )
					{
						from.SendLocalizedMessage( 1049511, GetNameLocalized() ); // Your ~1_type~ is too high for this power scroll.
					}
					else
					{
						if ( firstStage )
						{
							from.CloseGump( typeof( StatCapScroll.InternalGump ) );
							from.CloseGump( typeof( PowerScroll.InternalGump ) );
							from.SendGump( new InternalGump( from, this ) );
						}
						else
						{
							from.SendLocalizedMessage( 1049513, GetNameLocalized() ); // You feel a surge of magic as the scroll enhances your ~1_type~!

							skill.Cap = m_Value;

							Effects.SendLocationParticles( EffectItem.Create( from.Location, from.Map, EffectItem.DefaultDuration ), 0, 0, 0, 0, 0, 5060, 0 );
							Effects.PlaySound( from.Location, from.Map, 0x243 );

							Effects.SendMovingParticles( new Entity( Serial.Zero, new Point3D( from.X - 6, from.Y - 6, from.Z + 15 ), from.Map ), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100 );
							Effects.SendMovingParticles( new Entity( Serial.Zero, new Point3D( from.X - 4, from.Y - 6, from.Z + 15 ), from.Map ), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100 );
							Effects.SendMovingParticles( new Entity( Serial.Zero, new Point3D( from.X - 6, from.Y - 4, from.Z + 15 ), from.Map ), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100 );

							Effects.SendTargetParticles( from, 0x375A, 35, 90, 0x00, 0x00, 9502, (EffectLayer)255, 0x100 );

							Delete();
						}
					}
				}
			}
			else
			{
				from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
			}
		}

		public override void OnDoubleClick( Mobile from )
		{
			Use( from, true );
		}

		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );

			writer.Write( (int) 0 ); // version

			writer.Write( (int) m_Skill );
			writer.Write( (double) m_Value );
		}

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
				case 0:
				{
					m_Skill = (SkillName)reader.ReadInt();
					m_Value = reader.ReadDouble();

					break;
				}
			}

			if ( m_Value == 105.0 )
			{
				LootType = LootType.Regular;
			}
			else
			{
				LootType = LootType.Cursed;

				if ( Insured )
					Insured = false;
			}
		}

		public class InternalGump : Gump
		{
			private Mobile m_Mobile;
			private PowerScroll m_Scroll;

			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 );
			}

			public override void OnResponse( NetState state, RelayInfo info )
			{
				if ( info.ButtonID == 1 )
					m_Scroll.Use( m_Mobile, false );
			}
		}
	}
}

and

Code:
using System;
using Server;
using Server.Network;
using Server.Prompts;
using Server.Items;
using Server.Targeting;

namespace Server.Items
{
	public class ArmorBonusHitRegenTarget : Target // Create our targeting class (which we derive from the base target class)
	{
		private ArmorBonusHitRegenModDeed m_Deed;
		
		public ArmorBonusHitRegenTarget( ArmorBonusHitRegenModDeed deed ) : base( 1, false, TargetFlags.None )
		{
			m_Deed = deed;
			
		}

		protected override void OnTarget( Mobile from, object target ) // Override the protected OnTarget() for our feature
		{
			
		
			
			
			int i_bonus;			
			
			if ( m_Deed.Deleted )
				return;

			if ( target is BaseShield )
			{
				from.SendMessage ( "You cannot enhance that with this type of deed!" );
				return;
			}				

			if ( target is BaseArmor )
			{
			
	
				BaseArmor armor = (BaseArmor)target;
				
				
			int i_count;
			i_count = 0;

			if ( armor.SkillBonuses.Skill_1_Value != 0 )
				i_count = i_count + 1;

			if ( armor.SkillBonuses.Skill_2_Value != 0 )
				i_count = i_count + 1;
			
			if ( armor.SkillBonuses.Skill_3_Value != 0 )
				i_count = i_count + 1;

			if ( armor.SkillBonuses.Skill_4_Value != 0 )
				i_count = i_count + 1;

			if ( armor.SkillBonuses.Skill_5_Value != 0 )
				i_count = i_count + 1;
			
			if ( armor.Attributes.WeaponDamage != 0 )
				i_count = i_count + 1; // damage increase ~1_val~%

			if ( armor.Attributes.DefendChance != 0 )
				i_count = i_count + 1; // defense chance increase ~1_val~%

			if ( armor.Attributes.BonusDex != 0 )
				i_count = i_count + 1; // dexterity bonus ~1_val~

			if ( armor.Attributes.EnhancePotions != 0 )
				i_count = i_count + 1; // enhance potions ~1_val~%

			if ( armor.Attributes.CastRecovery != 0 )
				i_count = i_count + 1; // faster cast recovery ~1_val~

			if ( armor.Attributes.CastSpeed == 1 )
				i_count = i_count + 1; // faster casting ~1_val~

			if ( armor.Attributes.AttackChance != 0 )
				i_count = i_count + 1; // hit chance increase ~1_val~%
			
			if ( armor.Attributes.BonusHits != 0 )
				i_count = i_count + 1; // hit point increase ~1_val~

			if ( armor.Attributes.BonusInt != 0 )
				i_count = i_count + 1; // intelligence bonus ~1_val~

			if ( armor.Attributes.LowerManaCost != 0 )
				i_count = i_count + 1; // lower mana cost ~1_val~%

			if ( armor.Attributes.LowerRegCost != 0 )
				i_count = i_count + 1; // lower reagent cost ~1_val~%

			if ( armor.Attributes.Luck != 0 )
				i_count = i_count + 1; // luck ~1_val~

			if ( armor.ArmorAttributes.MageArmor != 0 )
				i_count = i_count + 1; // mage armor -~1_val~ skill

			if ( armor.Attributes.BonusMana != 0 )
				i_count = i_count + 1; // mana increase ~1_val~

			if ( armor.Attributes.RegenMana != 0 )
				i_count = i_count + 1; // mana regeneration ~1_val~

			if ( armor.Attributes.NightSight != 0 )
				i_count = i_count + 1; // night sight

			if ( armor.Attributes.ReflectPhysical != 0 )
				i_count = i_count + 1; // reflect physical damage ~1_val~%

			if ( armor.Attributes.RegenStam != 0 )
				i_count = i_count + 1; // stamina regeneration ~1_val~

			if ( armor.Attributes.RegenHits != 0 )
				i_count = i_count + 1; // hit point regeneration ~1_val~

			if ( armor.ArmorAttributes.SelfRepair != 0 )
				i_count = i_count + 1; // self repair ~1_val~

			if ( armor.Attributes.SpellChanneling != 0 )
				i_count = i_count + 1; // spell channeling
			
			if ( armor.Attributes.SpellDamage != 0 )
				i_count = i_count + 1; // spell damage increase ~1_val~%

			if ( armor.Attributes.BonusStam != 0 )
				i_count = i_count + 1; // stamina increase ~1_val~

			if ( armor.Attributes.BonusStr != 0 )
				i_count = i_count + 1; // strength bonus ~1_val~

			if ( armor.Attributes.WeaponSpeed != 0 )
				i_count = i_count + 1; // swing speed increase ~1_val~%

			
				if( armor.RootParent != from ) // Make sure its in their pack or they are wearing it
				{
					from.SendMessage( "It needs to be on your person or in your backpack!" ); 
				}
				else
				{
					if ( armor.Attributes.RegenHits == 0 )
					{
						if ( i_count > 9  )
							{
							from.SendMessage( "This item cannot be enhanced further!" ); 
							return;
							}
					}


					
					if ( armor.Attributes.RegenHits  > 1 )
					{
						from.SendMessage( "This armor already has the maximum hit point regeneration bonus!" );						
						return;
					}
					else
					{
						i_bonus = armor.Attributes.RegenHits + m_Deed.Value;
						if ( i_bonus > 2 )
							i_bonus =  2; 
												
						armor.Attributes.RegenHits = i_bonus;
						from.SendMessage( "You enhance the armor!" );
						m_Deed.Delete(); // Delete the deed
					}
						
					
				}
			}

		
			else from.SendMessage ( "You cannot enhance that with this type of deed!" );



			
			
		}
	}


	public class ArmorBonusHitRegenModDeed : Item // Create the item class which is derived from the base item class
	{
	
	public int i_Value;

	[CommandProperty( AccessLevel.GameMaster )]
	public int Value { get{ return i_Value; } set{ i_Value = value; InvalidateProperties(); } }
	
	
		[Constructable]
		public ArmorBonusHitRegenModDeed() : this ( 1 )
		{
		}
		

		[Constructable]
		public ArmorBonusHitRegenModDeed( int Value ) : base( 0x14F0 )
		{

			i_Value = Value;
			Weight = 1.0;
			Hue = 1150;
			Name = "armor";
			
		}

		public override void GetProperties( ObjectPropertyList list )
		{
			base.GetProperties( list );

			
			

			list.Add( 1060444, i_Value.ToString() );


		}

		
		public override void AddNameProperty( ObjectPropertyList list )
		{

			list.Add("An {0} enhancment scroll", Name);
			

			if ( IsSecure )
				AddSecureProperty( list );
			else if ( IsLockedDown )
				AddLockedDownProperty( list );

		}

		



		public ArmorBonusHitRegenModDeed( Serial serial ) : base( serial )
		{
		}

		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );

			writer.Write( (int) 0 ); // version
			writer.Write( (int) i_Value );
		}

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			
			int version = reader.ReadInt();
			i_Value = reader.ReadInt();
		}

		
		public override void OnDoubleClick( Mobile from ) // Override double click of the deed to call our target
		{
			if ( !IsChildOf( from.Backpack ) ) // Make sure its in their pack
			{
				 from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
			}
			else
			{
				 from.Target = new ArmorBonusHitRegenTarget( this ); // Call our target
			 }
		}	
	}
}

Now what i want to now is is there a way to make a table in the ps.cs to handle these because the only give like a 5% o point difference in addin bounes to weapons and armor and if not here where would be nice thanks
 

Codeus

Wanderer
Maybe I'm missing something, but why are you trying to add this deed to the PowerScroll class? Are you wanting them to be dropped by champions or whatever else that your shard uses to drop powerscrolls?
 

Malaperth

Wanderer
Well, if I'm not mistaken, you will have to make it a PowerScroll type object, or radically change the code that drops the scrolls since you are using a completely different class type.
 
Malaperth;642929 said:
Well, if I'm not mistaken, you will have to make it a PowerScroll type object, or radically change the code that drops the scrolls since you are using a completely different class type.

would there already be anything for a refence to go by or is this going to be a total build from ground up
 

Malaperth

Wanderer
Well, there are drop methods for random chances for all monsters to drop items, but the PowerScroll code is type specific, and if you wanted your deeds included in the PowerScroll drop chance, I think that would be a large task, but I admit I haven't thought it all the way through.
 
Malaperth;642936 said:
Well, there are drop methods for random chances for all monsters to drop items, but the PowerScroll code is type specific, and if you wanted your deeds included in the PowerScroll drop chance, I think that would be a large task, but I admit I haven't thought it all the way through.

ok thanks for input on it
 

Malaperth

Wanderer
Hmmm... Now that I think about it, you could just put in code in the drop powerscroll stuff that creates a random chance then either drops a powerscroll OR drops one of your deeds.
 
Malaperth;642943 said:
Hmmm... Now that I think about it, you could just put in code in the drop powerscroll stuff that creates a random chance then either drops a powerscroll OR drops one of your deeds.

what you mean can you give example plz,, still think i would have to change this into some sort of type then list in the drop
 

Malaperth

Wanderer
Well, find the part where it drops a scroll into the players pack and add something like:

Code:
if(Utility.RandomDouble() <= 0.20)
   from.AddToPack(new MyDeed());
else
   from.AddToPack(powerscroll);
 
Malaperth;642951 said:
Well, find the part where it drops a scroll into the players pack and add something like:

Code:
if(Utility.RandomDouble() <= 0.20)
   from.AddToPack(new MyDeed());
else
   from.AddToPack(powerscroll);

so then this would be in the champ its self and not through ps.cs right


Code:
		public void GivePowerScrolls()
		{
			//if ( Map != Map.Felucca )
				//return;

            ArrayList toGive = new ArrayList(); //no idea :(

            List<AggressorInfo> list = Aggressors; //I think it add list players that attacked it

            for (int i = 0; i < list.Count; ++i)
            {
                AggressorInfo info = (AggressorInfo)list[i];

                if (info.Attacker.Player && info.Attacker.Alive && (DateTime.Now - info.LastCombatTime) < TimeSpan.FromSeconds(30.0) && !toGive.Contains(info.Attacker))
                    toGive.Add(info.Attacker);
            }

            list = Aggressed; //I think it add list of players it attacked
            for (int i = 0; i < list.Count; ++i)
            {
                AggressorInfo info = (AggressorInfo)list[i];

                if (info.Defender.Player && info.Defender.Alive && (DateTime.Now - info.LastCombatTime) < TimeSpan.FromSeconds(30.0) && !toGive.Contains(info.Defender))
                    toGive.Add(info.Defender);
            }
            if (toGive.Count == 0)//if nobody attacked it and it didn't attack anybody then break operation and no ps MUAH
                return;

			// Randomize
			for ( int i = 0; i < toGive.Count; ++i )
			{
				int rand = Utility.Random( toGive.Count );
				object hold = toGive[i];
				toGive[i] = toGive[rand];
				toGive[rand] = hold;
			}

			for ( int i = 0; i < 6; ++i )
			{
				int level;
				double random = Utility.RandomDouble();

				if ( 0.20 >= random )
					level = 20;

				else if ( 0.40 >= random )
					level = 15;
				else
					level = 10;

				Mobile m = (Mobile)toGive[i % toGive.Count];

				PowerScroll ps = PowerScroll.CreateRandom( level, level );

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

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

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

						if ( prot.Map != m.Map || prot.Kills >= 5 || prot.Criminal )
							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!
							prot.AddToBackpack( new PowerScroll( ps.Skill, ps.Value ) );
						}
					}
				}
			}
		}
 
Malaperth;642960 said:
correct, I believe it is in BaseChampion.

Ok not sure of my self here so

Code:
		public void GivePowerScrolls()
		{
			/*if ( Map != Map.Felucca )
				return;*/

			ArrayList toGive = new ArrayList();
			List<DamageStore> rights = BaseCreature.GetLootingRights( this.DamageEntries, this.HitsMax );

			for ( int i = rights.Count - 1; i >= 0; --i )
			{
				DamageStore ds = rights[i];

				if ( ds.m_HasRight )
					toGive.Add( ds.m_Mobile );
			}

			if ( toGive.Count == 0 )
				return;

			for( int i = 0; i < toGive.Count; i++ )
			{
				Mobile m = (Mobile)toGive[i];

				if( !(m is PlayerMobile) )
					continue;

				bool gainedPath = false;

				int pointsToGain = 800;

				if( VirtueHelper.Award( m, VirtueName.Valor, pointsToGain, ref gainedPath ) )
				{
					if( gainedPath )
						m.SendLocalizedMessage( 1054032 ); // You have gained a path in Valor!
					else
						m.SendLocalizedMessage( 1054030 ); // You have gained in Valor!

					//No delay on Valor gains
				}
			}

			// Randomize
			for ( int i = 0; i < toGive.Count; ++i )
			{
				int rand = Utility.Random( toGive.Count );
				object hold = toGive[i];
				toGive[i] = toGive[rand];
				toGive[rand] = hold;
			}

			for ( int i = 0; i < 6; ++i )
			{
				Mobile m = (Mobile)toGive[i % toGive.Count];

				PowerScroll ps = CreateRandomPowerScroll();

				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 )
						((Container)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 = (Mobile)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 ) )
						{
							ps = CreateRandomPowerScroll();

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

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

not sure which spot you are ref. to but had a thought

Code:
for ( int i = 0; i < 6; ++i )
			{
				int level;
				double random = Utility.RandomDouble();

				if ( 0.20 >= random )
					level = 20;
				else if ( 0.40 >= random )
					level = 15;
				else
					level = 10;
can we not reword this spot to cover what i want with a limit of two to drop , and there are like twenty or so to add lol
 

Malaperth

Wanderer
No, that part only decided what level of powerscroll will be created. The code that actually drops the scroll is this:

Code:
				if ( !Core.SE || m.Alive )
					m.AddToBackpack( ps );
 
Malaperth;642967 said:
No, that part only decided what level of powerscroll will be created. The code that actually drops the scroll is this:

Code:
				if ( !Core.SE || m.Alive )
					m.AddToBackpack( ps );

will i have to add in each or just make a list in base champ. and run cases
 
Malaperth;642969 said:
a switch would work find I think.

this is what i put in , but with having so many to add i will have to list each in there right
sorry this just my first really big add in if all goes ok i will post it and give you credit for the help and much karma to you for your help thanks

Code:
if ( !Core.SE || m.Alive )
					m.AddToBackpack( ps );
                    if(Utility.RandomDouble() <= 0.20)
                             from.AddToPack(new MyDeed());
                        else
                             from.AddToPack(powerscroll);
				   
				{
 

Malaperth

Wanderer
Code:
if ( !Core.SE || m.Alive )
{					
   if(Utility.RandomDouble() <= 0.20)
       m.AddToBackpack(new MyDeed());
   else
       m.AddToBackpack( ps );
}

that would be more like what you want, and if there are a lot, you can add a method like CreateRandomMyDeed() that does what the CreateRandomPowerScroll method does but returns one of your deeds.
 
Malaperth;642983 said:
Code:
if ( !Core.SE || m.Alive )
{					
   if(Utility.RandomDouble() <= 0.20)
       m.AddToBackpack(new MyDeed());
   else
       m.AddToBackpack( ps );
}

that would be more like what you want, and if there are a lot, you can add a method like CreateRandomMyDeed() that does what the CreateRandomPowerScroll method does but returns one of your deeds.

ok need one more thing i think cand you give me a hand with a convert of this to make it read like a powerscroll

Code:
using System;
using Server;
using Server.Network;
using Server.Prompts;
using Server.Items;
using Server.Targeting;

namespace Server.Items
{
	public class ArmorBonusHitRegenTarget : Target // Create our targeting class (which we derive from the base target class)
	{
		private ArmorBonusHitRegenModDeed m_Deed;
		
		public ArmorBonusHitRegenTarget( ArmorBonusHitRegenModDeed deed ) : base( 1, false, TargetFlags.None )
		{
			m_Deed = deed;
			
		}

		protected override void OnTarget( Mobile from, object target ) // Override the protected OnTarget() for our feature
		{
			
		
			
			
			int i_bonus;			
			
			if ( m_Deed.Deleted )
				return;

			if ( target is BaseShield )
			{
				from.SendMessage ( "You cannot enhance that with this type of deed!" );
				return;
			}				

			if ( target is BaseArmor )
			{
			
	
				BaseArmor armor = (BaseArmor)target;
				
				
			int i_count;
			i_count = 0;

			if ( armor.SkillBonuses.Skill_1_Value != 0 )
				i_count = i_count + 1;

			if ( armor.SkillBonuses.Skill_2_Value != 0 )
				i_count = i_count + 1;
			
			if ( armor.SkillBonuses.Skill_3_Value != 0 )
				i_count = i_count + 1;

			if ( armor.SkillBonuses.Skill_4_Value != 0 )
				i_count = i_count + 1;

			if ( armor.SkillBonuses.Skill_5_Value != 0 )
				i_count = i_count + 1;
			
			if ( armor.Attributes.WeaponDamage != 0 )
				i_count = i_count + 1; // damage increase ~1_val~%

			if ( armor.Attributes.DefendChance != 0 )
				i_count = i_count + 1; // defense chance increase ~1_val~%

			if ( armor.Attributes.BonusDex != 0 )
				i_count = i_count + 1; // dexterity bonus ~1_val~

			if ( armor.Attributes.EnhancePotions != 0 )
				i_count = i_count + 1; // enhance potions ~1_val~%

			if ( armor.Attributes.CastRecovery != 0 )
				i_count = i_count + 1; // faster cast recovery ~1_val~

			if ( armor.Attributes.CastSpeed == 1 )
				i_count = i_count + 1; // faster casting ~1_val~

			if ( armor.Attributes.AttackChance != 0 )
				i_count = i_count + 1; // hit chance increase ~1_val~%
			
			if ( armor.Attributes.BonusHits != 0 )
				i_count = i_count + 1; // hit point increase ~1_val~

			if ( armor.Attributes.BonusInt != 0 )
				i_count = i_count + 1; // intelligence bonus ~1_val~

			if ( armor.Attributes.LowerManaCost != 0 )
				i_count = i_count + 1; // lower mana cost ~1_val~%

			if ( armor.Attributes.LowerRegCost != 0 )
				i_count = i_count + 1; // lower reagent cost ~1_val~%

			if ( armor.Attributes.Luck != 0 )
				i_count = i_count + 1; // luck ~1_val~

			if ( armor.ArmorAttributes.MageArmor != 0 )
				i_count = i_count + 1; // mage armor -~1_val~ skill

			if ( armor.Attributes.BonusMana != 0 )
				i_count = i_count + 1; // mana increase ~1_val~

			if ( armor.Attributes.RegenMana != 0 )
				i_count = i_count + 1; // mana regeneration ~1_val~

			if ( armor.Attributes.NightSight != 0 )
				i_count = i_count + 1; // night sight

			if ( armor.Attributes.ReflectPhysical != 0 )
				i_count = i_count + 1; // reflect physical damage ~1_val~%

			if ( armor.Attributes.RegenStam != 0 )
				i_count = i_count + 1; // stamina regeneration ~1_val~

			if ( armor.Attributes.RegenHits != 0 )
				i_count = i_count + 1; // hit point regeneration ~1_val~

			if ( armor.ArmorAttributes.SelfRepair != 0 )
				i_count = i_count + 1; // self repair ~1_val~

			if ( armor.Attributes.SpellChanneling != 0 )
				i_count = i_count + 1; // spell channeling
			
			if ( armor.Attributes.SpellDamage != 0 )
				i_count = i_count + 1; // spell damage increase ~1_val~%

			if ( armor.Attributes.BonusStam != 0 )
				i_count = i_count + 1; // stamina increase ~1_val~

			if ( armor.Attributes.BonusStr != 0 )
				i_count = i_count + 1; // strength bonus ~1_val~

			if ( armor.Attributes.WeaponSpeed != 0 )
				i_count = i_count + 1; // swing speed increase ~1_val~%

			
				if( armor.RootParent != from ) // Make sure its in their pack or they are wearing it
				{
					from.SendMessage( "It needs to be on your person or in your backpack!" ); 
				}
				else
				{
					if ( armor.Attributes.RegenHits == 0 )
					{
						if ( i_count > 9  )
							{
							from.SendMessage( "This item cannot be enhanced further!" ); 
							return;
							}
					}


					
					if ( armor.Attributes.RegenHits  > 1 )
					{
						from.SendMessage( "This armor already has the maximum hit point regeneration bonus!" );						
						return;
					}
					else
					{
						i_bonus = armor.Attributes.RegenHits + m_Deed.Value;
						if ( i_bonus > 2 )
							i_bonus =  2; 
												
						armor.Attributes.RegenHits = i_bonus;
						from.SendMessage( "You enhance the armor!" );
						m_Deed.Delete(); // Delete the deed
					}
						
					
				}
			}

		
			else from.SendMessage ( "You cannot enhance that with this type of deed!" );



			
			
		}
	}


	public class ArmorBonusHitRegenModDeed : Item // Create the item class which is derived from the base item class
	{
	
	public int i_Value;

	[CommandProperty( AccessLevel.GameMaster )]
	public int Value { get{ return i_Value; } set{ i_Value = value; InvalidateProperties(); } }
	
	
		[Constructable]
		public ArmorBonusHitRegenModDeed() : this ( 1 )
		{
		}
		

		[Constructable]
		public ArmorBonusHitRegenModDeed( int Value ) : base( 0x14F0 )
		{

			i_Value = Value;
			Weight = 1.0;
			Hue = 1150;
			Name = "armor";
			
		}

		public override void GetProperties( ObjectPropertyList list )
		{
			base.GetProperties( list );

			
			

			list.Add( 1060444, i_Value.ToString() );


		}

		
		public override void AddNameProperty( ObjectPropertyList list )
		{

			list.Add("An {0} enhancment scroll", Name);
			

			if ( IsSecure )
				AddSecureProperty( list );
			else if ( IsLockedDown )
				AddLockedDownProperty( list );

		}





        public ArmorBonusHitRegenModDeed(Serial serial)
            : base(serial)
		{
		}

		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );

			writer.Write( (int) 0 ); // version
			writer.Write( (int) i_Value );
		}

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			
			int version = reader.ReadInt();
			i_Value = reader.ReadInt();
		}

		
		public override void OnDoubleClick( Mobile from ) // Override double click of the deed to call our target
		{
			if ( !IsChildOf( from.Backpack ) ) // Make sure its in their pack
			{
				 from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
			}
			else
			{
				 from.Target = new ArmorBonusHitRegenTarget( this ); // Call our target
			 }
		}	
	}
}
 

Malaperth

Wanderer
Well, I don't think you need to change that class any as long as you aren't trying to add it into the PowerScroll list. Unless, of course, you discover that it doesn't work :)
 
Top