| CODE |
using System; using System.Collections; namespace Server.Items { public enum CraftResource { None = 0, Iron = 1, DullCopper, ShadowIron, Copper, Bronze, Gold, Agapite, Verite, Valorite, RegularLeather = 101, SpinedLeather, HornedLeather, BarbedLeather, Log, Chene } public enum CraftResourceType { None, Metal, Leather, Buche } public class CraftAttributeInfo { private int m_WeaponFireDamage; private int m_WeaponColdDamage; private int m_WeaponPoisonDamage; private int m_WeaponEnergyDamage; private int m_WeaponDurability; private int m_WeaponLuck; private int m_WeaponGoldIncrease; private int m_WeaponLowerRequirements; private int m_ArmorPhysicalResist; private int m_ArmorFireResist; private int m_ArmorColdResist; private int m_ArmorPoisonResist; private int m_ArmorEnergyResist; private int m_ArmorDurability; private int m_ArmorLuck; private int m_ArmorGoldIncrease; private int m_ArmorLowerRequirements; private int m_RunicMinAttributes; private int m_RunicMaxAttributes; private int m_RunicMinIntensity; private int m_RunicMaxIntensity; public int WeaponFireDamage{ get{ return m_WeaponFireDamage; } set{ m_WeaponFireDamage = value; } } public int WeaponColdDamage{ get{ return m_WeaponColdDamage; } set{ m_WeaponColdDamage = value; } } public int WeaponPoisonDamage{ get{ return m_WeaponPoisonDamage; } set{ m_WeaponPoisonDamage = value; } } public int WeaponEnergyDamage{ get{ return m_WeaponEnergyDamage; } set{ m_WeaponEnergyDamage = value; } } public int WeaponDurability{ get{ return m_WeaponDurability; } set{ m_WeaponDurability = value; } } public int WeaponLuck{ get{ return m_WeaponLuck; } set{ m_WeaponLuck = value; } } public int WeaponGoldIncrease{ get{ return m_WeaponGoldIncrease; } set{ m_WeaponGoldIncrease = value; } } public int WeaponLowerRequirements{ get{ return m_WeaponLowerRequirements; } set{ m_WeaponLowerRequirements = value; } } public int ArmorPhysicalResist{ get{ return m_ArmorPhysicalResist; } set{ m_ArmorPhysicalResist = value; } } public int ArmorFireResist{ get{ return m_ArmorFireResist; } set{ m_ArmorFireResist = value; } } public int ArmorColdResist{ get{ return m_ArmorColdResist; } set{ m_ArmorColdResist = value; } } public int ArmorPoisonResist{ get{ return m_ArmorPoisonResist; } set{ m_ArmorPoisonResist = value; } } public int ArmorEnergyResist{ get{ return m_ArmorEnergyResist; } set{ m_ArmorEnergyResist = value; } } public int ArmorDurability{ get{ return m_ArmorDurability; } set{ m_ArmorDurability = value; } } public int ArmorLuck{ get{ return m_ArmorLuck; } set{ m_ArmorLuck = value; } } public int ArmorGoldIncrease{ get{ return m_ArmorGoldIncrease; } set{ m_ArmorGoldIncrease = value; } } public int ArmorLowerRequirements{ get{ return m_ArmorLowerRequirements; } set{ m_ArmorLowerRequirements = value; } } public int RunicMinAttributes{ get{ return m_RunicMinAttributes; } set{ m_RunicMinAttributes = value; } } public int RunicMaxAttributes{ get{ return m_RunicMaxAttributes; } set{ m_RunicMaxAttributes = value; } } public int RunicMinIntensity{ get{ return m_RunicMinIntensity; } set{ m_RunicMinIntensity = value; } } public int RunicMaxIntensity{ get{ return m_RunicMaxIntensity; } set{ m_RunicMaxIntensity = value; } } public CraftAttributeInfo() { } public static readonly CraftAttributeInfo Blank, DullCopper, ShadowIron, Copper, Bronze, Golden, Agapite, Verite, Valorite, Spined, Horned, Barbed, Log, CheneLog; static CraftAttributeInfo() { Blank = new CraftAttributeInfo(); CraftAttributeInfo dullCopper = DullCopper = new CraftAttributeInfo(); dullCopper.ArmorPhysicalResist = 6; dullCopper.ArmorDurability = 50; dullCopper.ArmorLowerRequirements = 20; dullCopper.WeaponDurability = 100; dullCopper.WeaponLowerRequirements = 50; dullCopper.RunicMinAttributes = 1; dullCopper.RunicMaxAttributes = 2; dullCopper.RunicMinIntensity = 10; dullCopper.RunicMaxIntensity = 35; CraftAttributeInfo shadowIron = ShadowIron = new CraftAttributeInfo(); shadowIron.ArmorPhysicalResist = 2; shadowIron.ArmorFireResist = 1; shadowIron.ArmorEnergyResist = 5; shadowIron.ArmorDurability = 100; shadowIron.WeaponColdDamage = 20; shadowIron.WeaponDurability = 50; shadowIron.RunicMinAttributes = 2; shadowIron.RunicMaxAttributes = 2; shadowIron.RunicMinIntensity = 20; shadowIron.RunicMaxIntensity = 45; CraftAttributeInfo copper = Copper = new CraftAttributeInfo(); copper.ArmorPhysicalResist = 1; copper.ArmorFireResist = 1; copper.ArmorPoisonResist = 5; copper.ArmorEnergyResist = 2; copper.WeaponPoisonDamage = 10; copper.WeaponEnergyDamage = 20; copper.RunicMinAttributes = 2; copper.RunicMaxAttributes = 3; copper.RunicMinIntensity = 25; copper.RunicMaxIntensity = 50; CraftAttributeInfo bronze = Bronze = new CraftAttributeInfo(); bronze.ArmorPhysicalResist = 3; bronze.ArmorColdResist = 5; bronze.ArmorPoisonResist = 1; bronze.ArmorEnergyResist = 1; bronze.WeaponFireDamage = 40; bronze.RunicMinAttributes = 3; bronze.RunicMaxAttributes = 3; bronze.RunicMinIntensity = 30; bronze.RunicMaxIntensity = 65; CraftAttributeInfo golden = Golden = new CraftAttributeInfo(); golden.ArmorPhysicalResist = 1; golden.ArmorFireResist = 1; golden.ArmorColdResist = 2; golden.ArmorEnergyResist = 2; golden.ArmorLuck = 40; golden.ArmorLowerRequirements = 30; golden.WeaponLuck = 40; golden.WeaponLowerRequirements = 50; golden.RunicMinAttributes = 3; golden.RunicMaxAttributes = 4; golden.RunicMinIntensity = 35; golden.RunicMaxIntensity = 75; CraftAttributeInfo agapite = Agapite = new CraftAttributeInfo(); agapite.ArmorPhysicalResist = 2; agapite.ArmorFireResist = 3; agapite.ArmorColdResist = 2; agapite.ArmorPoisonResist = 2; agapite.ArmorEnergyResist = 2; agapite.WeaponColdDamage = 30; agapite.WeaponEnergyDamage = 20; agapite.RunicMinAttributes = 4; agapite.RunicMaxAttributes = 4; agapite.RunicMinIntensity = 40; agapite.RunicMaxIntensity = 80; CraftAttributeInfo verite = Verite = new CraftAttributeInfo(); verite.ArmorPhysicalResist = 3; verite.ArmorFireResist = 3; verite.ArmorColdResist = 2; verite.ArmorPoisonResist = 3; verite.ArmorEnergyResist = 1; verite.WeaponPoisonDamage = 40; verite.WeaponEnergyDamage = 20; verite.RunicMinAttributes = 4; verite.RunicMaxAttributes = 5; verite.RunicMinIntensity = 45; verite.RunicMaxIntensity = 90; CraftAttributeInfo valorite = Valorite = new CraftAttributeInfo(); valorite.ArmorPhysicalResist = 4; valorite.ArmorColdResist = 3; valorite.ArmorPoisonResist = 3; valorite.ArmorEnergyResist = 3; valorite.ArmorDurability = 50; valorite.WeaponFireDamage = 10; valorite.WeaponColdDamage = 20; valorite.WeaponPoisonDamage = 10; valorite.WeaponEnergyDamage = 20; valorite.RunicMinAttributes = 5; valorite.RunicMaxAttributes = 5; valorite.RunicMinIntensity = 50; valorite.RunicMaxIntensity = 100; CraftAttributeInfo spined = Spined = new CraftAttributeInfo(); spined.ArmorPhysicalResist = 5; spined.ArmorLuck = 40; spined.RunicMinAttributes = 1; spined.RunicMaxAttributes = 3; spined.RunicMinIntensity = 20; spined.RunicMaxIntensity = 40; CraftAttributeInfo horned = Horned = new CraftAttributeInfo(); horned.ArmorPhysicalResist = 2; horned.ArmorFireResist = 3; horned.ArmorColdResist = 2; horned.ArmorPoisonResist = 2; horned.ArmorEnergyResist = 2; horned.RunicMinAttributes = 3; horned.RunicMaxAttributes = 4; horned.RunicMinIntensity = 30; horned.RunicMaxIntensity = 70; CraftAttributeInfo barbed = Barbed = new CraftAttributeInfo(); barbed.ArmorPhysicalResist = 2; barbed.ArmorFireResist = 1; barbed.ArmorColdResist = 2; barbed.ArmorPoisonResist = 3; barbed.ArmorEnergyResist = 4; barbed.RunicMinAttributes = 4; barbed.RunicMaxAttributes = 5; barbed.RunicMinIntensity = 40; barbed.RunicMaxIntensity = 100; CraftAttributeInfo log = Log = new CraftAttributeInfo(); CraftAttributeInfo cheneLog = CheneLog = new CraftAttributeInfo(); cheneLog.WeaponFireDamage = 10; cheneLog.WeaponColdDamage = 20; cheneLog.WeaponPoisonDamage = 30; cheneLog.WeaponEnergyDamage = 40; cheneLog.WeaponDurability = 50; cheneLog.WeaponLowerRequirements = 60; } } public class CraftResourceInfo { private int m_Hue; private int m_Number; private string m_Name; private CraftAttributeInfo m_AttributeInfo; private CraftResource m_Resource; private Type[] m_ResourceTypes; public int Hue{ get{ return m_Hue; } } public int Number{ get{ return m_Number; } } public string Name{ get{ return m_Name; } } public CraftAttributeInfo AttributeInfo{ get{ return m_AttributeInfo; } } public CraftResource Resource{ get{ return m_Resource; } } public Type[] ResourceTypes{ get{ return m_ResourceTypes; } } public CraftResourceInfo( int hue, int number, string name, CraftAttributeInfo attributeInfo, CraftResource resource, params Type[] resourceTypes ) { m_Hue = hue; m_Number = number; m_Name = name; m_AttributeInfo = attributeInfo; m_Resource = resource; m_ResourceTypes = resourceTypes; for ( int i = 0; i < resourceTypes.Length; ++i ) CraftResources.RegisterType( resourceTypes[i], resource ); } } public class CraftResources { private static CraftResourceInfo[] m_MetalInfo = new CraftResourceInfo[] { new CraftResourceInfo( 0x000, 1053109, "Iron", CraftAttributeInfo.Blank, CraftResource.Iron, typeof( IronIngot ), typeof( IronOre ), typeof( Granite ) ), new CraftResourceInfo( 0x973, 1053108, "Dull Copper", CraftAttributeInfo.DullCopper, CraftResource.DullCopper, typeof( DullCopperIngot ), typeof( DullCopperOre ), typeof( DullCopperGranite ) ), new CraftResourceInfo( 0x966, 1053107, "Shadow Iron", CraftAttributeInfo.ShadowIron, CraftResource.ShadowIron, typeof( ShadowIronIngot ), typeof( ShadowIronOre ), typeof( ShadowIronGranite ) ), new CraftResourceInfo( 0x96D, 1053106, "Copper", CraftAttributeInfo.Copper, CraftResource.Copper, typeof( CopperIngot ), typeof( CopperOre ), typeof( CopperGranite ) ), new CraftResourceInfo( 0x972, 1053105, "Bronze", CraftAttributeInfo.Bronze, CraftResource.Bronze, typeof( BronzeIngot ), typeof( BronzeOre ), typeof( BronzeGranite ) ), new CraftResourceInfo( 0x8A5, 1053104, "Gold", CraftAttributeInfo.Golden, CraftResource.Gold, typeof( GoldIngot ), typeof( GoldOre ), typeof( GoldGranite ) ), new CraftResourceInfo( 0x979, 1053103, "Agapite", CraftAttributeInfo.Agapite, CraftResource.Agapite, typeof( AgapiteIngot ), typeof( AgapiteOre ), typeof( AgapiteGranite ) ), new CraftResourceInfo( 0x89F, 1053102, "Verite", CraftAttributeInfo.Verite, CraftResource.Verite, typeof( VeriteIngot ), typeof( VeriteOre ), typeof( VeriteGranite ) ), new CraftResourceInfo( 0x8AB, 1053101, "Valorite", CraftAttributeInfo.Valorite, CraftResource.Valorite, typeof( ValoriteIngot ), typeof( ValoriteOre ), typeof( ValoriteGranite ) ), }; private static CraftResourceInfo[] m_LeatherInfo = new CraftResourceInfo[] { new CraftResourceInfo( 0x000, 1049353, "Normal", CraftAttributeInfo.Blank, CraftResource.RegularLeather, typeof( Leather ), typeof( Hides ) ), new CraftResourceInfo( 0x283, 1049354, "Spined", CraftAttributeInfo.Spined, CraftResource.SpinedLeather, typeof( SpinedLeather ), typeof( SpinedHides ) ), new CraftResourceInfo( 0x227, 1049355, "Horned", CraftAttributeInfo.Horned, CraftResource.HornedLeather, typeof( HornedLeather ), typeof( HornedHides ) ), new CraftResourceInfo( 0x1C1, 1049356, "Barbed", CraftAttributeInfo.Barbed, CraftResource.BarbedLeather, typeof( BarbedLeather ), typeof( BarbedHides ) ) }; private static CraftResourceInfo[] m_AOSLeatherInfo = new CraftResourceInfo[] { new CraftResourceInfo( 0x000, 1049353, "Normal", CraftAttributeInfo.Blank, CraftResource.RegularLeather, typeof( Leather ), typeof( Hides ) ), new CraftResourceInfo( 0x8AC, 1049354, "Spined", CraftAttributeInfo.Spined, CraftResource.SpinedLeather, typeof( SpinedLeather ), typeof( SpinedHides ) ), new CraftResourceInfo( 0x845, 1049355, "Horned", CraftAttributeInfo.Horned, CraftResource.HornedLeather, typeof( HornedLeather ), typeof( HornedHides ) ), new CraftResourceInfo( 0x851, 1049356, "Barbed", CraftAttributeInfo.Barbed, CraftResource.BarbedLeather, typeof( BarbedLeather ), typeof( BarbedHides ) ), }; private static CraftResourceInfo[] m_BucheInfo = new CraftResourceInfo[] { new CraftResourceInfo( 0x000, 0, "Log", CraftAttributeInfo.Log, CraftResource.Log, typeof( Log ), typeof( Board ) ), new CraftResourceInfo( 0x227, 0, "Chene", CraftAttributeInfo.CheneLog, CraftResource.Chene, typeof( CheneLog ) ), }; private static CraftResourceInfo[] m_AOSBucheInfo = new CraftResourceInfo[] { new CraftResourceInfo( 0x000, 0, "Log", CraftAttributeInfo.Log, CraftResource.Log, typeof( Log ), typeof( Board ) ), new CraftResourceInfo( 0x097, 0, "Chene", CraftAttributeInfo.CheneLog, CraftResource.Chene, typeof( CheneLog ) ), }; /// <summary> /// Returns true if '<paramref name="resource"/>' is None, Iron, or RegularLeather. False if otherwise. /// </summary> public static bool IsStandard( CraftResource resource ) { return ( resource == CraftResource.None || resource == CraftResource.Iron || resource == CraftResource.RegularLeather || resource == CraftResource.Log); } private static Hashtable m_TypeTable; /// <summary> /// Registers that '<paramref name="resourceType"/>' uses '<paramref name="resource"/>' so that it can later be queried by <see cref="CraftResources.GetFromType"/> /// </summary> public static void RegisterType( Type resourceType, CraftResource resource ) { if ( m_TypeTable == null ) m_TypeTable = new Hashtable(); m_TypeTable[resourceType] = resource; } /// <summary> /// Returns the <see cref="CraftResource"/> value for which '<paramref name="resourceType"/>' uses -or- CraftResource.None if an unregistered type was specified. /// </summary> public static CraftResource GetFromType( Type resourceType ) { if ( m_TypeTable == null ) return CraftResource.None; object obj = m_TypeTable[resourceType]; if ( !(obj is CraftResource) ) return CraftResource.None; return (CraftResource)obj; } /// <summary> /// Returns a <see cref="CraftResourceInfo"/> instance describing '<paramref name="resource"/>' -or- null if an invalid resource was specified. /// </summary> public static CraftResourceInfo GetInfo( CraftResource resource ) { CraftResourceInfo[] list = null; switch ( GetType( resource ) ) { case CraftResourceType.Metal: list = m_MetalInfo; break; case CraftResourceType.Leather: list = Core.AOS ? m_AOSLeatherInfo : m_LeatherInfo; break; case CraftResourceType.Buche: list = Core.AOS ? m_AOSBucheInfo : m_BucheInfo; break; } if ( list != null ) { int index = GetIndex( resource ); if ( index >= 0 && index < list.Length ) return list[index]; } return null; } /// <summary> /// Returns a <see cref="CraftResourceType"/> value indiciating the type of '<paramref name="resource"/>'. /// </summary> public static CraftResourceType GetType( CraftResource resource ) { if ( resource >= CraftResource.Iron && resource <= CraftResource.Valorite ) return CraftResourceType.Metal; if ( resource >= CraftResource.RegularLeather && resource <= CraftResource.BarbedLeather ) return CraftResourceType.Leather; if ( resource >= CraftResource.Log && resource <= CraftResource.Chene ) return CraftResourceType.Buche; return CraftResourceType.None; } /// <summary> /// Returns the first <see cref="CraftResource"/> in the series of resources for which '<paramref name="resource"/>' belongs. /// </summary> public static CraftResource GetStart( CraftResource resource ) { switch ( GetType( resource ) ) { case CraftResourceType.Metal: return CraftResource.Iron; case CraftResourceType.Leather: return CraftResource.RegularLeather; case CraftResourceType.Buche: return CraftResource.Log; } return CraftResource.None; } /// <summary> /// Returns the index of '<paramref name="resource"/>' in the seriest of resources for which it belongs. /// </summary> public static int GetIndex( CraftResource resource ) { CraftResource start = GetStart( resource ); if ( start == CraftResource.None ) return 0; return (int)(resource - start); } /// <summary> /// Returns the <see cref="CraftResourceInfo.Number"/> property of '<paramref name="resource"/>' -or- 0 if an invalid resource was specified. /// </summary> public static int GetLocalizationNumber( CraftResource resource ) { CraftResourceInfo info = GetInfo( resource ); return ( info == null ? 0 : info.Number ); } /// <summary> /// Returns the <see cref="CraftResourceInfo.Hue"/> property of '<paramref name="resource"/>' -or- 0 if an invalid resource was specified. /// </summary> public static int GetHue( CraftResource resource ) { CraftResourceInfo info = GetInfo( resource ); return ( info == null ? 0 : info.Hue ); } /// <summary> /// Returns the <see cref="CraftResourceInfo.Name"/> property of '<paramref name="resource"/>' -or- an empty string if the resource specified was invalid. /// </summary> public static string GetName( CraftResource resource ) { CraftResourceInfo info = GetInfo( resource ); return ( info == null ? String.Empty : info.Name ); } /// <summary> /// Returns the <see cref="CraftResource"/> value which represents '<paramref name="info"/>' -or- CraftResource.None if unable to convert. /// </summary> public static CraftResource GetFromOreInfo( OreInfo info ) { if ( info.Name.IndexOf( "Spined" ) >= 0 ) return CraftResource.SpinedLeather; else if ( info.Name.IndexOf( "Horned" ) >= 0 ) return CraftResource.HornedLeather; else if ( info.Name.IndexOf( "Barbed" ) >= 0 ) return CraftResource.BarbedLeather; else if ( info.Name.IndexOf( "Leather" ) >= 0 ) return CraftResource.RegularLeather; if ( info.Name.IndexOf( "Log" ) >= 0 ) return CraftResource.Log; else if ( info.Name.IndexOf( "Chene" ) >= 0 ) return CraftResource.Chene; if ( info.Level == 0 ) return CraftResource.Iron; else if ( info.Level == 1 ) return CraftResource.DullCopper; else if ( info.Level == 2 ) return CraftResource.ShadowIron; else if ( info.Level == 3 ) return CraftResource.Copper; else if ( info.Level == 4 ) return CraftResource.Bronze; else if ( info.Level == 5 ) return CraftResource.Gold; else if ( info.Level == 6 ) return CraftResource.Agapite; else if ( info.Level == 7 ) return CraftResource.Verite; else if ( info.Level == 8 ) return CraftResource.Valorite; return CraftResource.None; } /// <summary> /// Returns the <see cref="CraftResource"/> value which represents '<paramref name="info"/>', using '<paramref name="material"/>' to help resolve leather OreInfo instances. /// </summary> public static CraftResource GetFromOreInfo( OreInfo info, ArmorMaterialType material ) { if ( material == ArmorMaterialType.Studded || material == ArmorMaterialType.Leather || material == ArmorMaterialType.Spined || material == ArmorMaterialType.Horned || material == ArmorMaterialType.Barbed ) { if ( info.Level == 0 ) return CraftResource.RegularLeather; else if ( info.Level == 1 ) return CraftResource.SpinedLeather; else if ( info.Level == 2 ) return CraftResource.HornedLeather; else if ( info.Level == 3 ) return CraftResource.BarbedLeather; return CraftResource.None; } return GetFromOreInfo( info ); } } // NOTE: This class is only for compatability with very old RunUO versions. // No changes to it should be required for custom resources. public class OreInfo { public static readonly OreInfo Iron = new OreInfo( 0, 0x000, "Iron" ); public static readonly OreInfo DullCopper = new OreInfo( 1, 0x973, "Dull Copper" ); public static readonly OreInfo ShadowIron = new OreInfo( 2, 0x966, "Shadow Iron" ); public static readonly OreInfo Copper = new OreInfo( 3, 0x96D, "Copper" ); public static readonly OreInfo Bronze = new OreInfo( 4, 0x972, "Bronze" ); public static readonly OreInfo Gold = new OreInfo( 5, 0x8A5, "Gold" ); public static readonly OreInfo Agapite = new OreInfo( 6, 0x979, "Agapite" ); public static readonly OreInfo Verite = new OreInfo( 7, 0x89F, "Verite" ); public static readonly OreInfo Valorite = new OreInfo( 8, 0x8AB, "Valorite" ); private int m_Level; private int m_Hue; private string m_Name; public OreInfo( int level, int hue, string name ) { m_Level = level; m_Hue = hue; m_Name = name; } public int Level { get { return m_Level; } } public int Hue { get { return m_Hue; } } public string Name { get { return m_Name; } } } } |
| CODE |
using System; using Server.Items; using Server.Network; using Server.Targeting; using Server.Engines.Craft; namespace Server.Items { public abstract class BaseBuche : Item, ICommodity { private CraftResource m_Resource; [CommandProperty( AccessLevel.GameMaster )] public CraftResource Resource { get{ return m_Resource; } set{ m_Resource = value; InvalidateProperties(); } } string ICommodity.Description { get { return String.Format( Amount == 1 ? "{0} Logs" : "{0} Logs", Amount ); } } public override void Serialize( GenericWriter writer ) { base.Serialize( writer ); writer.Write( (int) 1 ); // version writer.Write( (int) m_Resource ); } public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); switch ( version ) { case 1: { m_Resource = (CraftResource)reader.ReadInt(); break; } case 0: { OreInfo info = new OreInfo( reader.ReadInt(), reader.ReadInt(), reader.ReadString() ); m_Resource = CraftResources.GetFromOreInfo( info ); break; } } } public BaseBuche( CraftResource resource ) : this( resource, 1 ) { } public BaseBuche( CraftResource resource, int amount ) : base( 0x1bdd ) { Stackable = true; Weight = 2.0; Amount = amount; Hue = CraftResources.GetHue( resource ); m_Resource = resource; } public BaseBuche( Serial serial ) : base( serial ) { } public override void AddNameProperty( ObjectPropertyList list ) { if ( Amount > 1 ) list.Add( 1021217, "{0}\t#{1}", Amount, 1021217 ); // ~1_NUMBER~ ~2_ITEMNAME~ else list.Add( 1021217 ); // rondins de bois; } public override void GetProperties( ObjectPropertyList list ) { base.GetProperties( list ); if ( !CraftResources.IsStandard( m_Resource ) ) { int num = CraftResources.GetLocalizationNumber( m_Resource ); if ( num > 0 ) list.Add( num ); else list.Add( CraftResources.GetName( m_Resource ) ); } } public override int LabelNumber { get { return 1021217; // rondins de bois; } } } [FlipableAttribute( 0x1bdd, 0x1be0 )] public class Log : BaseBuche { [Constructable] public Log() : this( 1 ) { } [Constructable] public Log( int amount ) : base( CraftResource.Log, amount ) { } public Log( Serial serial ) : base( serial ) { } public override void Serialize( GenericWriter writer ) { base.Serialize( writer ); writer.Write( (int) 0 ); // version } public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); } public override Item Dupe( int amount ) { return base.Dupe( new Log( amount ), amount ); } } [FlipableAttribute( 0x1bdd, 0x1be0 )] public class CheneLog : BaseBuche { [Constructable] public CheneLog() : this( 1 ) { } [Constructable] public CheneLog( int amount ) : base( CraftResource.Chene, amount ) { } public CheneLog( Serial serial ) : base( serial ) { } public override void Serialize( GenericWriter writer ) { base.Serialize( writer ); writer.Write( (int) 0 ); // version } public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); } public override Item Dupe( int amount ) { return base.Dupe( new CheneLog( amount ), amount ); } } } |
| CODE |
using System; using Server; using Server.Items; namespace Server.Engines.Harvest { public class Lumberjacking : HarvestSystem { private static Lumberjacking m_System; public static Lumberjacking System { get { if ( m_System == null ) m_System = new Lumberjacking(); return m_System; } } private HarvestDefinition m_Definition; public HarvestDefinition Definition { get{ return m_Definition; } } private Lumberjacking() { HarvestResource[] res; HarvestVein[] veins; #region Lumberjacking HarvestDefinition lumber = new HarvestDefinition(); // Resource banks are every 4x3 tiles lumber.BankWidth = 4; lumber.BankHeight = 3; // Every bank holds from 20 to 45 logs lumber.MinTotal = 20; lumber.MaxTotal = 45; // A resource bank will respawn its content every 20 to 30 minutes lumber.MinRespawn = TimeSpan.FromMinutes( 20.0 ); lumber.MaxRespawn = TimeSpan.FromMinutes( 30.0 ); // Skill checking is done on the Lumberjacking skill lumber.Skill = SkillName.Lumberjacking; // Set the list of harvestable tiles lumber.Tiles = m_TreeTiles; // Players must be within 2 tiles to harvest lumber.MaxRange = 2; // Ten logs per harvest action lumber.ConsumedPerHarvest = 10; lumber.ConsumedPerFeluccaHarvest = 20; // The chopping effect lumber.EffectActions = new int[]{ 13 }; lumber.EffectSounds = new int[]{ 0x13E }; lumber.EffectCounts = new int[]{ 1, 2, 2, 2, 3 }; lumber.EffectDelay = TimeSpan.FromSeconds( 1.6 ); lumber.EffectSoundDelay = TimeSpan.FromSeconds( 0.9 ); lumber.NoResourcesMessage = 500493; // There's not enough wood here to harvest. lumber.FailMessage = 500495; // You hack at the tree for a while, but fail to produce any useable wood. lumber.OutOfRangeMessage = 500446; // That is too far away. lumber.PackFullMessage = 500497; // You can't place any wood into your backpack! lumber.ToolBrokeMessage = 500499; // You broke your axe. res = new HarvestResource[] { new HarvestResource( 00.0, 00.0, 50.0, 500498, typeof( Log ) ), new HarvestResource( 00.0, 00.0, 50.0, 500498, typeof( CheneLog ) ), }; veins = new HarvestVein[] { new HarvestVein( 50.0, 0.0, res[0], null ), new HarvestVein( 50.0, 0.5, res[1], res[0] ), }; lumber.Resources = res; lumber.Veins = veins; m_Definition = lumber; Definitions.Add( lumber ); #endregion } public override bool CheckHarvest( Mobile from, Item tool ) { if ( !base.CheckHarvest( from, tool ) ) return false; if ( tool.Parent != from ) { from.SendLocalizedMessage( 500487 ); // The axe must be equipped for any serious wood chopping. return false; } return true; } public override bool CheckHarvest( Mobile from, Item tool, HarvestDefinition def, object toHarvest ) { if ( !base.CheckHarvest( from, tool, def, toHarvest ) ) return false; if ( tool.Parent != from ) { from.SendLocalizedMessage( 500487 ); // The axe must be equipped for any serious wood chopping. return false; } return true; } public override void OnBadHarvestTarget( Mobile from, Item tool, object toHarvest ) { from.SendLocalizedMessage( 500489 ); // You can't use an axe on that. } public static void Initialize() { Array.Sort( m_TreeTiles ); } #region Tile lists private static int[] m_TreeTiles = new int[] { 0x4CCA, 0x4CCB, 0x4CCC, 0x4CCD, 0x4CD0, 0x4CD3, 0x4CD6, 0x4CD8, 0x4CDA, 0x4CDD, 0x4CE0, 0x4CE3, 0x4CE6, 0x4CF8, 0x4CFB, 0x4CFE, 0x4D01, 0x4D41, 0x4D42, 0x4D43, 0x4D44, 0x4D57, 0x4D58, 0x4D59, 0x4D5A, 0x4D5B, 0x4D6E, 0x4D6F, 0x4D70, 0x4D71, 0x4D72, 0x4D84, 0x4D85, 0x4D86, 0x52B5, 0x52B6, 0x52B7, 0x52B8, 0x52B9, 0x52BA, 0x52BB, 0x52BC, 0x52BD, 0x4CCE, 0x4CCF, 0x4CD1, 0x4CD2, 0x4CD4, 0x4CD5, 0x4CD7, 0x4CD9, 0x4CDB, 0x4CDC, 0x4CDE, 0x4CDF, 0x4CE1, 0x4CE2, 0x4CE4, 0x4CE5, 0x4CE7, 0x4CE8, 0x4CF9, 0x4CFA, 0x4CFC, 0x4CFD, 0x4CFF, 0x4D00, 0x4D02, 0x4D03, 0x4D45, 0x4D46, 0x4D47, 0x4D48, 0x4D49, 0x4D4A, 0x4D4B, 0x4D4C, 0x4D4D, 0x4D4E, 0x4D4F, 0x4D50, 0x4D51, 0x4D52, 0x4D53, 0x4D5C, 0x4D5D, 0x4D5E, 0x4D5F, 0x4D60, 0x4D61, 0x4D62, 0x4D63, 0x4D64, 0x4D65, 0x4D66, 0x4D67, 0x4D68, 0x4D69, 0x4D73, 0x4D74, 0x4D75, 0x4D76, 0x4D77, 0x4D78, 0x4D79, 0x4D7A, 0x4D7B, 0x4D7C, 0x4D7D, 0x4D7E, 0x4D7F, 0x4D87, 0x4D88, 0x4D89, 0x4D8A, 0x4D8B, 0x4D8C, 0x4D8D, 0x4D8E, 0x4D8F, 0x4D90, 0x4D95, 0x4D96, 0x4D97, 0x4D99, 0x4D9A, 0x4D9B, 0x4D9D, 0x4D9E, 0x4D9F, 0x4DA1, 0x4DA2, 0x4DA3, 0x4DA5, 0x4DA6, 0x4DA7, 0x4DA9, 0x4DAA, 0x4DAB, 0x52BE, 0x52BF, 0x52C0, 0x52C1, 0x52C2, 0x52C3, 0x52C4, 0x52C5, 0x52C6, 0x52C7 }; #endregion } } |
| CODE |
using System; using Server.Items; namespace Server.Engines.Craft { public class DefBowFletching : CraftSystem { public override SkillName MainSkill { get { return SkillName.Fletching; } } public override int GumpTitleNumber { get { return 1044006; } // <CENTER>BOWCRAFT AND FLETCHING MENU</CENTER> } private static CraftSystem m_CraftSystem; public static CraftSystem CraftSystem { get { if ( m_CraftSystem == null ) m_CraftSystem = new DefBowFletching(); return m_CraftSystem; } } public override double GetChanceAtMin( CraftItem item ) { return 0.5; // 50% } private DefBowFletching() : base( 1, 2, 1.7 ) { } public override int CanCraft( Mobile from, BaseTool tool, Type itemType ) { if ( tool.Deleted || tool.UsesRemaining < 0 ) return 1044038; // You have worn out your tool! return 0; } public override void PlayCraftEffect( Mobile from ) { if ( from.Body.Type == BodyType.Human && !from.Mounted ) from.Animate( 33, 5, 1, true, false, 0 ); from.PlaySound( 0x55 ); } public override int PlayEndingEffect( Mobile from, bool failed, bool lostMaterial, bool toolBroken, int quality, bool makersMark, CraftItem item ) { if ( toolBroken ) from.SendLocalizedMessage( 1044038 ); // You have worn out your tool if ( failed ) { if ( lostMaterial ) return 1044043; // You failed to create the item, and some of your materials are lost. else return 1044157; // You failed to create the item, but no materials were lost. } else { if ( quality == 0 ) return 502785; // You were barely able to make this item. It's quality is below average. else if ( makersMark && quality == 2 ) return 1044156; // You create an exceptional quality item and affix your maker's mark. else if ( quality == 2 ) return 1044155; // You create an exceptional quality item. else return 1044154; // You create the item. } } public override CraftECA ECA{ get{ return CraftECA.FiftyPercentChanceMinusTenPercent; } } public override void InitCraftList() { int index = -1; // Materials AddCraft( typeof( Kindling ), 1044457, 1023553, 0.0, 00.0, typeof( Log ), 1044041, 1, 1044351 ); index = AddCraft( typeof( Shaft ), 1044457, 1027124, 0.0, 40.0, typeof( Log ), 1044041, 1, 1044351 ); SetUseAllRes( index, true ); // Ammunition index = AddCraft( typeof( Arrow ), 1044565, 1023903, 0.0, 40.0, typeof( Shaft ), 1044560, 1, 1044561 ); AddRes( index, typeof( Feather ), 1044562, 1, 1044563 ); SetUseAllRes( index, true ); index = AddCraft( typeof( Bolt ), 1044565, 1027163, 0.0, 40.0, typeof( Shaft ), 1044560, 1, 1044561 ); AddRes( index, typeof( Feather ), 1044562, 1, 1044563 ); SetUseAllRes( index, true ); // Weapons AddCraft( typeof( Bow ), 1044566, 1025042, 30.0, 70.0, typeof( Log ), 1044041, 7, 1044351 ); AddCraft( typeof( Crossbow ), 1044566, 1023919, 60.0, 100.0, typeof( Log ), 1044041, 7, 1044351 ); AddCraft( typeof( HeavyCrossbow ), 1044566, 1025117, 80.0, 120.0, typeof( Log ), 1044041, 10, 1044351 ); AddCraft( typeof( PlateArms ), 1011078, 1025136, 66.3, 116.0, typeof( Log ), 1044041, 1, 1044037 ); AddCraft( typeof( PlateGloves ), 1011078, 1025140, 58.9, 108.9, typeof( Log ), 1044041, 1, 1044037 ); AddCraft( typeof( PlateGorget ), 1011078, 1025139, 56.4, 106.4, typeof( Log ), 1044041, 1, 1044037 ); AddCraft( typeof( PlateLegs ), 1011078, 1025137, 68.8, 118.8, typeof( Log ), 1044041, 1, 1044037 ); AddCraft( typeof( PlateChest ), 1011078, 1046431, 75.0, 125.0, typeof( Log ), 1044041, 1, 1044037 ); AddCraft( typeof( FemalePlateChest ), 1011078, 1046430, 44.1, 94.1, typeof( Log ), 1044041, 1, 1044037 ); if ( Core.AOS ) { AddCraft( typeof( CompositeBow ), 1044566, 1029922, 70.0, 110.0, typeof( Log ), 1044041, 10, 1044351 ); AddCraft( typeof( RepeatingCrossbow ), 1044566, 1029923, 90.0, 130.0, typeof( Log ), 1044041, 10, 1044351 ); } SetSubRes( typeof( Log ), 1044041 ); AddSubRes( typeof( CheneLog ), "Chene", 80.0, "Vous ne savez pas travailler ce bois" ); MarkOption = true; Repair = Core.AOS; } } } |
| QUOTE (Nezumi @ Sep 3 2004, 11:13 AM) |
| et comment faire que le chêne soit buchable que sur des chêne et pas sur des sapins ? |
| CODE |
| #region Tile lists private static int[] m_TreeTiles = new int[] { 0x4CCA, 0x4CCB, 0x4CCC, 0x4CCD, 0x4CD0, 0x4CD3, 0x4CD6, 0x4CD8, 0x4CDA, 0x4CDD, 0x4CE0, 0x4CE3, 0x4CE6, 0x4CF8, 0x4CFB, 0x4CFE, 0x4D01, 0x4D41, 0x4D42, 0x4D43, 0x4D44, 0x4D57, 0x4D58, 0x4D59, 0x4D5A, 0x4D5B, 0x4D6E, 0x4D6F, 0x4D70, 0x4D71, 0x4D72, 0x4D84, 0x4D85, 0x4D86, 0x52B5, 0x52B6, 0x52B7, 0x52B8, 0x52B9, 0x52BA, 0x52BB, 0x52BC, 0x52BD, 0x4CCE, 0x4CCF, 0x4CD1, 0x4CD2, 0x4CD4, 0x4CD5, 0x4CD7, 0x4CD9, 0x4CDB, 0x4CDC, 0x4CDE, 0x4CDF, 0x4CE1, 0x4CE2, 0x4CE4, 0x4CE5, 0x4CE7, 0x4CE8, 0x4CF9, 0x4CFA, 0x4CFC, 0x4CFD, 0x4CFF, 0x4D00, 0x4D02, 0x4D03, 0x4D45, 0x4D46, 0x4D47, 0x4D48, 0x4D49, 0x4D4A, 0x4D4B, 0x4D4C, 0x4D4D, 0x4D4E, 0x4D4F, 0x4D50, 0x4D51, 0x4D52, 0x4D53, 0x4D5C, 0x4D5D, 0x4D5E, 0x4D5F, 0x4D60, 0x4D61, 0x4D62, 0x4D63, 0x4D64, 0x4D65, 0x4D66, 0x4D67, 0x4D68, 0x4D69, 0x4D73, 0x4D74, 0x4D75, 0x4D76, 0x4D77, 0x4D78, 0x4D79, 0x4D7A, 0x4D7B, 0x4D7C, 0x4D7D, 0x4D7E, 0x4D7F, 0x4D87, 0x4D88, 0x4D89, 0x4D8A, 0x4D8B, 0x4D8C, 0x4D8D, 0x4D8E, 0x4D8F, 0x4D90, 0x4D95, 0x4D96, 0x4D97, 0x4D99, 0x4D9A, 0x4D9B, 0x4D9D, 0x4D9E, 0x4D9F, 0x4DA1, 0x4DA2, 0x4DA3, 0x4DA5, 0x4DA6, 0x4DA7, 0x4DA9, 0x4DAA, 0x4DAB, 0x52BE, 0x52BF, 0x52C0, 0x52C1, 0x52C2, 0x52C3, 0x52C4, 0x52C5, 0x52C6, 0x52C7 }; #endregion } } |
| QUOTE |
private static int[] m_CedreTiles = new int[] { 0x4CD8, 0x4CD6 }; private static int[] m_NoyerTiles = new int[] { 0x4CE0, 0x4CE3 }; private static int[] m_CheneTiles = new int[] { 0x4CDA, 0x4CDD }; private static int[] m_SauleTiles = new int[] { 0x4CE6 }; |
| QUOTE (Belladonne @ Sep 4 2004, 10:14 PM) |
| je suis en train de cherche ses numéros :) je vous les ajoutent ici ces que je les ai il faut aussi penser a les enlever de la liste du m_treetiles aussi si je ferais probablement une copie de ma fin de script pour vous faciliter la vie ;) |
| QUOTE (Belladonne @ Sep 4 2004, 11:29 PM) |
| donc par exemple j'ai trouver pour les noyers : 0x4CE0,0x4CE1,0x4CE2, 0x4CE3, 0x4CE4, 0x4CE5 je devrais mettres dans mon script 0xCE0,0xCE1,0xCE2, 0xCE3, 0xCE4, 0xCE5 ?? |