supernova72611
Sorceror
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
and
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
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