View Full Version: Traduction de la creation de metaux custom

RunUO.FR Support > Tutorial en Français > Traduction de la creation de metaux custom


Title: Traduction de la creation de metaux custom
Description: par Alexandra Catalonia


crystal - June 22, 2003 10:11 AM (GMT)
1.D'abord commencez par faire une liste des metaux que vous voulez en partant du plus courant jusqu'au plus rare.

2.Dans le \scripts\misc\oreinfo.cs trouvez la section qui ressemble a celle-ci:
CODE


namespace Server.Items
{
  public enum CraftResource
  {
     None = 0,
     Iron = 1,
     DullCopper,
     ShadowIron,
     Copper,
     Bronze,
     Sandstone,


Editez cette liste en fonction des metaux desiré et ce ,tout en respectant la mise en page.Continuez de faire defiler le script jusqu'a cette section:

CODE


public static readonly CraftAttributeInfo Blank, DullCopper, ShadowIron, Copper, Bronze, Sandstone,


Inserez y vos metaux...
Un peu plus bas vous allez trouvez ceci:

CODE

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;



Chacun de vos metaux doit etre defini comme ci-dessus sinon il sera forger avec les attributs du fer,servez vous du bloc d'information placez au dessus de ces section pour editez les proprieté selon votre bon plaisir.

Plus bas dans le script vous allez trouvez ce gros bloc:

CODE


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( 0x8AB, 0, "Sandstone",      CraftAttributeInfo.Sandstone,   CraftResource.Sandstone,      typeof( SandstoneIngot ),   typeof( SandstoneOre ),      typeof( SandstoneGranite ) ),


Decomposons une partie:
CODE

new CraftResourceInfo( 0x96D, 1053106, "Copper",      CraftAttributeInfo.Copper,   CraftResource.Copper,         typeof( CopperIngot ),      typeof( CopperOre ),      typeof( CopperGranite ) ),



Cela donne :"nouveaux type de ressource ( couleur, CliLocName, Nom normal, reference attribut, reference ressource, TypeLingot, TypeMinerai, TypeGranite)"

Vous devez rajouter une ligne semblable pour chaque metal,et utilisez 0 pour le cliloc name pour que le serveur utilise le nom normal a la place

Plus bas vous trouverez:
CODE

public static CraftResourceType GetType( CraftResource resource )
     {
        if ( resource >= CraftResource.Iron && resource <= CraftResource.Valorite )
           return CraftResourceType.Metal;


Vous devez remplacer "Valorite" par le dernier de vos metaux

Ensuite:
CODE

     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.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.Sandstone;
        else if ( info.Level == 6 )


Placez vos metaux ici en respectant l'ordre et la mise en page
Et enfin:

CODE
// 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 Sandstone   = new OreInfo( 5, 0x8A5, "Sandstone" );


Idem qu'avant,placez vos metaux dans l'ordre et en respectant la mise en page

Sauvegardez votre script,on passe au suivant :roll:

3.Ouvrez le Mining.cs dans \script\engines\harvest\ et rendez vous a cette section:
CODE


res = new HarvestResource[]
           {
              new HarvestResource( 00.0, 00.0, 100.0, 1007072, typeof( IronOre ),      typeof( Granite ) ),//0
              new HarvestResource( 30.0, 25.0, 105.0, 1007073, typeof( DullCopperOre ),   typeof( DullCopperGranite ),      typeof( DullCopperElemental ) ),//1
              new HarvestResource( 35.0, 30.0, 110.0, 1007074, typeof( ShadowIronOre ),   typeof( ShadowIronGranite ),      typeof( ShadowIronElemental ) ),//2
              new HarvestResource( 40.0, 35.0, 115.0, 1007075, typeof( CopperOre ),      typeof( CopperGranite ),      typeof( CopperElemental ) ),//3
              new HarvestResource( 42.0, 40.0, 120.0, 1007076, typeof( BronzeOre ),      typeof( BronzeGranite ),      typeof( BronzeElemental ) ),//4
              new new HarvestResource( 44.0, 45.0, 125.0, "you dig some sandstone ore and put it in your backpack", typeof( SandstoneOre ),   typeof( SandstoneGranite ),      typeof( SandstoneElemental ) ),//5


En traduit ca donne:
Ressourced'extraction=(skill neccessaire pour trouvez,skill min pour reussir,skill max pour reussir,message de reussite,type de minerai, type de granite, monstre associer)

Creer une ligne similaire pour chacun de vos metaux.

la partie suivante concerne les pourcentage de trouvez les minerai:

CODE


veins = new HarvestVein[]
           {
              new HarvestVein( 16.0, res[0], null   ), // Iron
              new HarvestVein( 7.0, res[1], res[0] ), // Dull Copper
              new HarvestVein( 6.0, res[2], res[0] ), // Shadow Iron
              new HarvestVein( 5.0, res[3], res[0] ), // Copper
              new HarvestVein( 5.0, res[4], res[0] ), // Bronze
              new HarvestVein( 4.5, res[5], res[0] ), // Sandstone


Rajoutez vos metaux en vous assurant qu'au final le pourcentage ne depasse pas 100.
Sauvegardez le tout.La visite continue.

4.Ouvrez le Ore.cs dans \scripts\items\resources\blacksmithing\

CODE


case 0:
           {
              OreInfo info;

              switch ( reader.ReadInt() )
              {
                 case 0: info = OreInfo.Iron; break;
                 case 1: info = OreInfo.DullCopper; break;
                 case 2: info = OreInfo.ShadowIron; break;
                 case 3: info = OreInfo.Copper; break;
                 case 4: info = OreInfo.Bronze; break;
                 case 5: info = OreInfo.Sandstone; break;


une fois encore ,rajoutez vos metaux en respectant l'ordre et la mise en page

ensuite trouvez cette section:
CODE

     public override int LabelNumber
     {
        get
        {
           if ( m_Resource >= CraftResource.DullCopper && m_Resource <= CraftResource.Valorite )
              return 1042845 + (int)(m_Resource - CraftResource.DullCopper);


Remplacez "Valorite" par votre dernier metal

CODE

if ( targeted.GetType().IsDefined( typeof( ForgeAttribute ), false ) )
           {
              double maxSkill = 50 * ( 1 + ( (double)CraftResources.GetIndex( m_Ore.Resource ) / 32 ) );
              double minSkill = maxSkill - 50;


Voici la partie qui calcule les chance de reussite des fontes ,modifier les parametre jusqu'a obtention du taux de reussite desiré

la section suivante definit vos minerais
CODE


public class DullCopperOre : BaseOre
  {
     [Constructable]
     public DullCopperOre() : this( 1 )
     {
     }

     [Constructable]
     public DullCopperOre( int amount ) : base( CraftResource.DullCopper, amount )
     {
     }

     public DullCopperOre( 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 DullCopperOre( amount ), amount );
     }

     public override BaseIngot GetIngot()
     {
        return new DullCopperIngot();
     }


Il vous suffit de copier coller cette section en remplacant a chaque fois le dullcopper par le minerai desiré .
Vous sauvegardez.

5.ouvrez le Ingots.cs dans \scripts\items\resources\blacksmithing\
Ce fichier est similaire au Ore.cs ,refaite la meme chose que pour celui-ci pour definir les lingots

6.ouvrez le Granite.cs dans \scripts\items\resources\masonry
Idem que pour le Ore.cs

7.Elementaire lié a vos metaux

ouvrez le \scripts\mobiles\monster\Ore elementals\ et copier coller un des elementaire deja present, editez le selon votre inspiration...

8.le menu BS

CODE

        // Add every material you want the player to be able to chose from
        // This will overide the overidable material
        AddSubRes( typeof( IronIngot ),         "IRON", 00.0, 1044267 );
        AddSubRes( typeof( DullCopperIngot ),      "DULLCOPPER", 20.0, 1044268 );
        AddSubRes( typeof( ShadowIronIngot ),      "SHADOWIRON", 35.0, 1044268 );
        AddSubRes( typeof( CopperIngot ),      "COPPER", 40.0, 1044268 );
        AddSubRes( typeof( BronzeIngot ),      "BRONZE", 45.0, 1044268 );
        AddSubRes( typeof( SandstoneIngot ),      "SANDSTONE", 50.0, 1044268 );


rajoutez vos metaux en respectant l'ordre et la mise en page.

Voila à present tout devrait se compiler normalement et votre jeu sera agrementer d'un nouveau metal

ps:ce tutorial est la traduction (approximative)d'un post du forum RunUO

OuRoBoRos83 - July 8, 2003 01:34 AM (GMT)
CODE

8.le menu BS

CODE  

       // Add every material you want the player to be able to chose from
       // This will overide the overidable material
       AddSubRes( typeof( IronIngot ),         "IRON", 00.0, 1044267 );
       AddSubRes( typeof( DullCopperIngot ),      "DULLCOPPER", 20.0, 1044268 );
       AddSubRes( typeof( ShadowIronIngot ),      "SHADOWIRON", 35.0, 1044268 );
       AddSubRes( typeof( CopperIngot ),      "COPPER", 40.0, 1044268 );
       AddSubRes( typeof( BronzeIngot ),      "BRONZE", 45.0, 1044268 );
       AddSubRes( typeof( SandstoneIngot ),      "SANDSTONE", 50.0, 1044268 );




L'es ou le menu BS?? :huh:

Shandalar - July 8, 2003 01:51 PM (GMT)
DefBlacksmithy.cs, dans Engines/Craft

Kaervek - September 12, 2003 12:30 PM (GMT)
Super tutorial :D
Merci ;)
*Débute*
Le seul "hic" c'est que j'ai pas pu mettre des noms comme toi... J'ai été obligé de mettre ca pour que la compile marche:
QUOTE
AddSubRes( typeof( IronIngot ),   1044022, 00.0, 1044036, 1044267 );
   AddSubRes( typeof( DullCopperIngot ), 1044023, 40.0, 1044036, 1044268 );
   AddSubRes( typeof( ShadowIronIngot ), 1044024, 50.0, 1044036, 1044268 );
   AddSubRes( typeof( CopperIngot ),  1044025, 60.0, 1044036, 1044268 );
   AddSubRes( typeof( BronzeIngot ),  1044026, 70.0, 1044036, 1044268 );
   AddSubRes( typeof( GoldIngot ),   1044027, 75.0, 1044036, 1044268 );
   AddSubRes( typeof( AgapiteIngot ),  1044028, 80.0, 1044036, 1044268 );
   AddSubRes( typeof( VeriteIngot ),  1044029, 85.0, 1044036, 1044268 );
   AddSubRes( typeof( ValoriteIngot ),  1044030, 90.0, 1044036, 1044268 );
   AddSubRes( typeof( FlamiteIngot ),  1044031, 95.0, 1044036, 1044268 );
   AddSubRes( typeof( GlaminiteIngot ),    1044032, 95.0, 1044036, 1044268 );
   AddSubRes( typeof( EnergiteIngot ),  1044033, 95.0, 1044036, 1044268 );
   AddSubRes( typeof( PoisuniteIngot ), 1044034, 95.0, 1044036, 1044268 );


Soit les chiffres:1044031, 1044032, 1044033, 1044034
au lieu de "FLAMITE", "GLAMINITE", "ENERGITE", "POISUNITE"
Ce qui est tout de meme génant pour le menu de ferronnerie lors du choix du metal... :(

Kaervek - September 13, 2003 06:38 AM (GMT)
UN autre probleme est survenu... En fait, mes metaux semblent avoir els caracteristiques du fer et non celles que je leur ai données...
Je mets le code entier, au cas où vous pourriez déceler une erreur quelquepart... :(

QUOTE
using System;
using System.Collections;

namespace Server.Items
{
public enum CraftResource
{
  None = 0,
  Iron = 1,
  DullCopper,
  ShadowIron,
  Copper,
  Bronze,
  Gold,
  Agapite,
  Verite,
  Valorite,
  Flamite,
  Glaminite,
  Energite,
  Poisunite,
 
 
  RegularLeather = 101,
  SpinedLeather,
  HornedLeather,
  BarbedLeather
}

public enum CraftResourceType
{
  None,
  Metal,
  Leather
}

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, Flamite, Glaminite, Energite, Poisunite, Spined, Horned, Barbed;

  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 flamite = Flamite = new CraftAttributeInfo();

  valorite.ArmorPhysicalResist = 10;
  valorite.ArmorFireResist = 10;
  valorite.ArmorColdResist = 5;
  valorite.ArmorPoisonResist = 5;
  valorite.ArmorEnergyResist = 5;
  valorite.ArmorDurability = 100;
  valorite.WeaponFireDamage = 50;
  valorite.RunicMinAttributes = 5;
  valorite.RunicMaxAttributes = 5;
  valorite.RunicMinIntensity = 50;
  valorite.RunicMaxIntensity = 100;
 
  CraftAttributeInfo glaminite = Glaminite = new CraftAttributeInfo();

  valorite.ArmorPhysicalResist = 10;
  valorite.ArmorFireResist = 5;
  valorite.ArmorColdResist = 10;
  valorite.ArmorPoisonResist = 5;
  valorite.ArmorEnergyResist = 5;
  valorite.ArmorDurability = 100;
  valorite.WeaponColdDamage = 50;
  valorite.RunicMinAttributes = 5;
  valorite.RunicMaxAttributes = 5;
  valorite.RunicMinIntensity = 50;
  valorite.RunicMaxIntensity = 100;
 
  CraftAttributeInfo Energite = Energite = new CraftAttributeInfo();

  valorite.ArmorPhysicalResist = 10;
  valorite.ArmorFireResist = 5;
  valorite.ArmorColdResist = 5;
  valorite.ArmorPoisonResist = 5;
  valorite.ArmorEnergyResist = 10;
  valorite.ArmorDurability = 100;
  valorite.WeaponEnergyDamage = 50;
  valorite.RunicMinAttributes = 5;
  valorite.RunicMaxAttributes = 5;
  valorite.RunicMinIntensity = 50;
  valorite.RunicMaxIntensity = 100;
 
  CraftAttributeInfo Poisunite = Poisunite = new CraftAttributeInfo();

  valorite.ArmorPhysicalResist = 10;
  valorite.ArmorFireResist = 5;
  valorite.ArmorColdResist = 5;
  valorite.ArmorPoisonResist = 10;
  valorite.ArmorEnergyResist = 5;
  valorite.ArmorDurability = 100;
  valorite.WeaponPoisonDamage = 50;
  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;
  }
}

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 ) ),
      new CraftResourceInfo( 37, 0, "Flamite",          CraftAttributeInfo.Flamite,    CraftResource.Flamite,  typeof( FlamiteIngot ), typeof( FlamiteOre ),  typeof( FlamiteGranite ) ),
      new CraftResourceInfo( 1152, 0, "Glaminite",      CraftAttributeInfo.Glaminite, CraftResource.Glaminite,  typeof( GlaminiteIngot ), typeof( GlaminiteOre ),  typeof( GlaminiteGranite ) ),
      new CraftResourceInfo( 1153, 0, "Energite",        CraftAttributeInfo.Energite, CraftResource.Energite,  typeof( EnergiteIngot ), typeof( EnergiteOre ),  typeof( EnergiteGranite ) ),
      new CraftResourceInfo( 1158, 0, "Poisunite",      CraftAttributeInfo.Poisunite, CraftResource.Poisunite,  typeof( PoisuniteIngot ), typeof( PoisuniteOre ),  typeof( PoisuniteGranite ) ),
  };

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

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

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

  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.Poisunite )
    return CraftResourceType.Metal;

  if ( resource >= CraftResource.RegularLeather && resource <= CraftResource.BarbedLeather )
    return CraftResourceType.Leather;

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

  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.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;
  else if ( info.Level == 9 )
    return CraftResource.Flamite;
  else if ( info.Level == 10 )
    return CraftResource.Glaminite;
  else if ( info.Level == 11 )
    return CraftResource.Energite;
  else if ( info.Level == 12 )
    return CraftResource.Poisunite;

  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" );
  public static readonly OreInfo Flamite  = new OreInfo( 8, 37, "Flamite" );
  public static readonly OreInfo Glaminite = new OreInfo( 8, 1152, "Glaminite" );
  public static readonly OreInfo Energite  = new OreInfo( 8, 1153, "Energite" );
  public static readonly OreInfo Poisunite = new OreInfo( 8, 1158, "Poisunite" );

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

CoolDev - September 13, 2003 10:07 AM (GMT)
Oui c'est normal, tu n'a fait que modifier les paramètre de la valorite
CODE
 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 flamite = Flamite = new CraftAttributeInfo();

 valorite.ArmorPhysicalResist = 10;
 valorite.ArmorFireResist = 10;
 valorite.ArmorColdResist = 5;
 valorite.ArmorPoisonResist = 5;
 valorite.ArmorEnergyResist = 5;
 valorite.ArmorDurability = 100;
 valorite.WeaponFireDamage = 50;
 valorite.RunicMinAttributes = 5;
 valorite.RunicMaxAttributes = 5;
 valorite.RunicMinIntensity = 50;
 valorite.RunicMaxIntensity = 100;
 
 CraftAttributeInfo glaminite = Glaminite = new CraftAttributeInfo();

 valorite.ArmorPhysicalResist = 10;
 valorite.ArmorFireResist = 5;
 valorite.ArmorColdResist = 10;
 valorite.ArmorPoisonResist = 5;
 valorite.ArmorEnergyResist = 5;
 valorite.ArmorDurability = 100;
 valorite.WeaponColdDamage = 50;
 valorite.RunicMinAttributes = 5;
 valorite.RunicMaxAttributes = 5;
 valorite.RunicMinIntensity = 50;
 valorite.RunicMaxIntensity = 100;
 
 CraftAttributeInfo Energite = Energite = new CraftAttributeInfo();

 valorite.ArmorPhysicalResist = 10;
 valorite.ArmorFireResist = 5;
 valorite.ArmorColdResist = 5;
 valorite.ArmorPoisonResist = 5;
 valorite.ArmorEnergyResist = 10;
 valorite.ArmorDurability = 100;
 valorite.WeaponEnergyDamage = 50;
 valorite.RunicMinAttributes = 5;
 valorite.RunicMaxAttributes = 5;
 valorite.RunicMinIntensity = 50;
 valorite.RunicMaxIntensity = 100;
 
 CraftAttributeInfo Poisunite = Poisunite = new CraftAttributeInfo();

 valorite.ArmorPhysicalResist = 10;
 valorite.ArmorFireResist = 5;
 valorite.ArmorColdResist = 5;
 valorite.ArmorPoisonResist = 10;
 valorite.ArmorEnergyResist = 5;
 valorite.ArmorDurability = 100;
 valorite.WeaponPoisonDamage = 50;
 valorite.RunicMinAttributes = 5;
 valorite.RunicMaxAttributes = 5;
 valorite.RunicMinIntensity = 50;
 valorite.RunicMaxIntensity = 100;


Remplace Valorite par Flamite, Glaminite, Energite ou Poisunite tout simplement :)

Kaervek - September 13, 2003 10:16 AM (GMT)
lol! comment j'ai pu louper un truc pareil :rolleyes:

Dire que j'ai cherché des heures sans le voir :blink:
Enfin, je devais etre fatigué on va dire *ange*

Merci beaucoup en tout cas ;)

Kaervek - September 21, 2003 06:45 PM (GMT)
J'ai encore un probleme...
Apres des tests, il semblerait que les joueurs ne trouvent que du fer (j'ai testé avec mon gm avec 500 en mining et ca faisait pareil)
Quelqu'un a-t-il une idée d'où cela pourrait venir?


Edit: J'ai bidouillé pendant un bout de temps et par magie ca refocntionne normalement, j'ai tous les minerais :D

Stromgol - January 30, 2004 10:53 PM (GMT)
Il m'envoit une erreur soit de token, de sturcture, de invalid spacename :S et je comprends pas !


CODE
public class CraftResources
{
 private static CraftResourceInfo[] m_MetalInfo = new CraftResourceInfo[]
  {
   new CraftResourceInfo( 0x45D, 0, "Pyrsite",   CraftAttributeInfo.Blank,  CraftResource.Pyrsite,    typeof( PyrsiteIngot ),  typeof( PyrsiteOre ),   typeof( PyrsiteGranite ) ),
   new CraftResourceInfo( 0x5EE, 0, "Crusite", CraftAttributeInfo.Crusite, CraftResource.Crusite,  typeof( CrusiteIngot ), typeof( CrusiteOre ), typeof( CrusiteGranite ) ),
   new CraftResourceInfo( 1343, 0, "Acier", CraftAttributeInfo.Acier, CraftResource.Acier,  typeof( AcierIngot ), typeof( AcierOre ), typeof( AcierGranite ) ),
   new CraftResourceInfo( 1298, 0, "Myrantine",  CraftAttributeInfo.Myrantine,  CraftResource.Myrantine,   typeof( MyrantineIngot ),  typeof( MyrantineOre ),  typeof( MyrantineGranite ) ),
   new CraftResourceInfo( 1300, 0, "Miozine",   CraftAttributeInfo.Miozine,  CraftResource.Miozine,    typeof( MiozineIngot ),  typeof( MiozineOre ),   typeof( MiozineGranite ) ),
   new CraftResourceInfo( 1293, 0, "Oxium",  CraftAttributeInfo.Oxium,  CraftResource.Oxium,   typeof( OxiumIngot ),  typeof( OxiumOre ),  typeof( OxiumGranite ) ),
   new CraftResourceInfo( 1189, 0, "Amystant",  CraftAttributeInfo.Amystant,  CraftResource.Amystant,   typeof( AmystantIngot ),  typeof( AmystantOre ),  typeof( AmystantGranite ) ),
   new CraftResourceInfo( 1184, 0, "Trinittium",  CraftAttributeInfo.Trinittium, CraftResource.Trinittium,   typeof( TrinittiumIngot ), typeof( TrinittiumOre ),  typeof( TrinittiumGranite ) ),
   new CraftResourceInfo( 1194, 0, "Korangar",  CraftAttributeInfo.Korangar, CraftResource.Korangar,   typeof( KorangarIngot ), typeof( KorangarOre ),  typeof( KorangarGranite ) ),
   new CraftResourceInfo( 1191, 0, "Hematite",  CraftAttributeInfo.Hematite, CraftResource.Hematite,   typeof(HematiteIngot ), typeof( HematiteOre ), HematiteOre ),  typeof( HematiteGranite ) ),
   new CraftResourceInfo( 1197, 0, "Orichalcum",  CraftAttributeInfo.Orichalcum, CraftResource.Orichalcum,   typeof( OrichalcumIngot ), typeof( OrichalcumOre ),  typeof( OrichalcumGranite ) ),
   new CraftResourceInfo( 1185, 0, "Alterkium",  CraftAttributeInfo.Alterkium, CraftResource.Alterkium,   typeof( AlterkiumIngot ), typeof( AlterkiumOre ),  typeof( AlterkiumGranite ) ),
   new CraftResourceInfo( 1200, 0, "Cosmos",  CraftAttributeInfo.Cosmos, CraftResource.Cosmos,   typeof( CosmosIngot ), typeof( CosmosOre ),  typeof( CosmosGranite ) ),
   new CraftResourceInfo( 1192, 0, "MatiereBlanche",  CraftAttributeInfo.MatiereBlanche, CraftResource.MatiereBlanche,   typeof( MatiereBlancheIngot ), typeof( MatiereBlancheOre ),  typeof( MatiereBlancheGranite ) ),
   new CraftResourceInfo( 1187, 0, "MatiereNoire",  CraftAttributeInfo.MatiereNoire, CraftResource.MatiereNoire,   typeof( MatiereNoireIngot ), typeof( MatiereNoireOre ),  typeof( MatiereNoireGranite ) ),
  };

Shariz - January 31, 2004 01:22 PM (GMT)
Je ne vois pas d'où vient l'erreur.
Est-ce que tu as bien laisser les minerais de bases, avant ceux que tu as rajouter?
Essaie de mettre le premier chiffre en Hexadecimal.

Sinon post ce qui est ecrit dans la console, ce seras pllus facile pour comprendre l'erreur, elle peut venir d'ailleur.

Signé : Shariz l'ami des plus petits.

Stromgol - January 31, 2004 05:12 PM (GMT)
hum je crois en fait que c'est que le tuto est vieux, que la nouvelle version prend des choses de plus ( tels des = ) et j'ai downloader un modèle de minerais directement sur les forum de RunUo et il n'y avait pas derreur comme l'autre mais seulement des erreurs de liens puisqu'il y a une vingtaine de minerais et je n,en veux que 15.


CODE
using System;
using System.Collections;

namespace Server.Items
{
public enum CraftResource
{
 None = 0,
 Iron = 1,
 DullCopper,
 ShadowIron,
 Copper,
 Bronze,
 Gold,
 Agapite,
 Verite,
 Valorite,
 Titanio,
 Platina,
 Emerald,
 Firen,
 FrozenStone,
 MoonStone,
 DeathRock,

 RegularLeather = 101,
 SpinedLeather,
 HornedLeather,
 BarbedLeather,

 RedScales = 201,
 YellowScales,
 BlackScales,
 GreenScales,
 WhiteScales,
 BlueScales
}

public enum CraftResourceType
{
 None,
 Metal,
 Leather,
 Wood,
 Scales
}

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;
 public static readonly CraftAttributeInfo DullCopper, ShadowIron, Copper, Bronze, Golden, Agapite, Verite, Valorite, Titanio, Platina, Emerald, Firen, FrozenStone, MoonStone, DeathRock;
 public static readonly CraftAttributeInfo Spined, Horned, Barbed;
 public static readonly CraftAttributeInfo Pine, Cedar, Maple, Wallnut, Yew, Elven, Elder, Death;
 public static readonly CraftAttributeInfo RedScales, YellowScales, BlackScales, GreenScales, WhiteScales, BlueScales;

 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 = 16;
  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 = 8;
  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 = 20;
  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 = 30;
  golden.ArmorLowerRequirements = 30;
  golden.WeaponLuck = 30;
  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 = 13;
  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 = 10;
  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 = 7;
  valorite.WeaponColdDamage = 8;
  valorite.WeaponEnergyDamage = 10;
  valorite.RunicMinAttributes = 5;
  valorite.RunicMaxAttributes = 5;
  valorite.RunicMinIntensity = 50;
  valorite.RunicMaxIntensity = 100;

  CraftAttributeInfo titanio = Titanio = new CraftAttributeInfo();

  titanio.ArmorPhysicalResist = 20;
  titanio.ArmorDurability = 50;
  titanio.ArmorFireResist = 5;
  titanio.ArmorColdResist = 6;
  titanio.ArmorPoisonResist = 6;
  titanio.ArmorEnergyResist = 2;
  titanio.WeaponDurability = 100;
  titanio.RunicMinAttributes = 5;
  titanio.RunicMaxAttributes = 6;
  titanio.RunicMinIntensity = 50;
  titanio.RunicMaxIntensity = 100;

  CraftAttributeInfo platina = Platina = new CraftAttributeInfo();

  platina.ArmorPhysicalResist = 4;
  platina.ArmorDurability = 90;
  platina.ArmorFireResist = 7;
  platina.ArmorColdResist = 7;
  platina.ArmorPoisonResist = 5;
  platina.ArmorEnergyResist = 3;
  platina.WeaponDurability = 90;
  platina.RunicMinAttributes = 5;
  platina.RunicMaxAttributes = 6;
  platina.RunicMinIntensity = 50;
  platina.RunicMaxIntensity = 100;

  CraftAttributeInfo emerald = Emerald = new CraftAttributeInfo();

  emerald.ArmorPhysicalResist = 5;
  emerald.ArmorDurability = 80;
  emerald.ArmorFireResist = 8;
  emerald.ArmorColdResist = 8;
  emerald.ArmorPoisonResist = 8;
  emerald.ArmorEnergyResist = 8;
  emerald.ArmorLuck = 60;
  emerald.WeaponDurability = 80;
  emerald.WeaponLuck = 60;
  emerald.RunicMinAttributes = 5;
  emerald.RunicMaxAttributes = 6;
  emerald.RunicMinIntensity = 50;
  emerald.RunicMaxIntensity = 100;

  CraftAttributeInfo firen = Firen = new CraftAttributeInfo();

  firen.ArmorPhysicalResist = 8;
  firen.ArmorDurability = 70;
  firen.ArmorFireResist = 16;
  firen.ArmorColdResist = -4;
  firen.ArmorPoisonResist = 3;
  firen.ArmorEnergyResist = 5;
  firen.WeaponDurability = 70;
  firen.WeaponFireDamage = 65;
  firen.RunicMinAttributes = 5;
  firen.RunicMaxAttributes = 6;
  firen.RunicMinIntensity = 50;
  firen.RunicMaxIntensity = 100;

  CraftAttributeInfo frozenstone = FrozenStone = new CraftAttributeInfo();

  frozenstone.ArmorPhysicalResist = 9;
  frozenstone.ArmorDurability = 70;
  frozenstone.ArmorFireResist = -5;
  frozenstone.ArmorColdResist = 16;
  frozenstone.ArmorPoisonResist = 6;
  frozenstone.ArmorEnergyResist = 4;
  frozenstone.WeaponDurability = 70;
  frozenstone.WeaponColdDamage = 65;
  frozenstone.RunicMinAttributes = 5;
  frozenstone.RunicMaxAttributes = 6;
  frozenstone.RunicMinIntensity = 50;
  frozenstone.RunicMaxIntensity = 100;

  CraftAttributeInfo moonstone = MoonStone = new CraftAttributeInfo();

  moonstone.ArmorPhysicalResist = 2;
  moonstone.ArmorDurability = 50;
  moonstone.ArmorFireResist = 6;
  moonstone.ArmorColdResist = 4;
  moonstone.ArmorPoisonResist = 2;
  moonstone.ArmorEnergyResist = 18;
  moonstone.WeaponDurability = 50;
  moonstone.WeaponEnergyDamage = 80;
  moonstone.RunicMinAttributes = 5;
  moonstone.RunicMaxAttributes = 6;
  moonstone.RunicMinIntensity = 50;
  moonstone.RunicMaxIntensity = 100;

  CraftAttributeInfo deathrock = DeathRock = new CraftAttributeInfo();

  deathrock.ArmorPhysicalResist = 3;
  deathrock.ArmorDurability = 100;
  deathrock.ArmorFireResist = 5;
  deathrock.ArmorColdResist = 5;
  deathrock.ArmorPoisonResist = 20;
  deathrock.ArmorEnergyResist = 2;
  deathrock.WeaponDurability = 100;
  deathrock.WeaponPoisonDamage = 90;
  deathrock.RunicMinAttributes = 5;
  deathrock.RunicMaxAttributes = 6;
  deathrock.RunicMinIntensity = 50;
  deathrock.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 pine = Pine = new CraftAttributeInfo();

  pine.WeaponDurability = 200;
  pine.WeaponLowerRequirements = 50;
  pine.RunicMinAttributes = 1;
  pine.RunicMaxAttributes = 3;
  pine.RunicMinIntensity = 5;
  pine.RunicMaxIntensity = 30;

  CraftAttributeInfo cedar = Cedar = new CraftAttributeInfo();

  cedar.WeaponDurability = 200;
  cedar.WeaponLowerRequirements = 50;
  cedar.RunicMinAttributes = 1;
  cedar.RunicMaxAttributes = 3;
  cedar.RunicMinIntensity = 5;
  cedar.RunicMaxIntensity = 30;

  CraftAttributeInfo maple = Maple = new CraftAttributeInfo();

  maple.WeaponDurability = 200;
  maple.WeaponLowerRequirements = 50;
  maple.RunicMinAttributes = 1;
  maple.RunicMaxAttributes = 3;
  maple.RunicMinIntensity = 5;
  maple.RunicMaxIntensity = 30;

  CraftAttributeInfo wallnut = Wallnut = new CraftAttributeInfo();

  wallnut.WeaponDurability = 200;
  wallnut.WeaponLowerRequirements = 50;
  wallnut.RunicMinAttributes = 1;
  wallnut.RunicMaxAttributes = 3;
  wallnut.RunicMinIntensity = 5;
  wallnut.RunicMaxIntensity = 30;

  CraftAttributeInfo yew = Yew = new CraftAttributeInfo();

  yew.WeaponDurability = 200;
  yew.WeaponLowerRequirements = 50;
  yew.RunicMinAttributes = 1;
  yew.RunicMaxAttributes = 3;
  yew.RunicMinIntensity = 5;
  yew.RunicMaxIntensity = 30;

  CraftAttributeInfo elven = Elven = new CraftAttributeInfo();

  elven.WeaponDurability = 100;
  elven.WeaponLowerRequirements = 50;
  elven.RunicMinAttributes = 2;
  elven.RunicMaxAttributes = 4;
  elven.RunicMinIntensity = 10;
  elven.RunicMaxIntensity = 40;

  CraftAttributeInfo elder = Elder = new CraftAttributeInfo();

  elder.WeaponDurability = 100;
  elder.WeaponLowerRequirements = 50;
  elder.RunicMinAttributes = 2;
  elder.RunicMaxAttributes = 4;
  elder.RunicMinIntensity = 10;
  elder.RunicMaxIntensity = 40;

  CraftAttributeInfo death = Death = new CraftAttributeInfo();

  death.WeaponDurability = 100;
  death.WeaponLowerRequirements = 50;
  death.RunicMinAttributes = 3;
  death.RunicMaxAttributes = 5;
  death.RunicMinIntensity = 15;
  death.RunicMaxIntensity = 50;
 
  CraftAttributeInfo red = RedScales = new CraftAttributeInfo();

  red.ArmorFireResist = 10;
  red.ArmorColdResist = -3;

  CraftAttributeInfo yellow = YellowScales = new CraftAttributeInfo();

  yellow.ArmorPhysicalResist = -3;
  yellow.ArmorLuck = 20;

  CraftAttributeInfo black = BlackScales = new CraftAttributeInfo();

  black.ArmorPhysicalResist = 10;
  black.ArmorEnergyResist = -3;

  CraftAttributeInfo green = GreenScales = new CraftAttributeInfo();

  green.ArmorFireResist = -3;
  green.ArmorPoisonResist = 10;

  CraftAttributeInfo white = WhiteScales = new CraftAttributeInfo();

  white.ArmorPhysicalResist = -3;
  white.ArmorColdResist = 10;

  CraftAttributeInfo blue = BlueScales = new CraftAttributeInfo();

  blue.ArmorPoisonResist = -3;
  blue.ArmorEnergyResist = 10;
 }
}

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 ) ),
   new CraftResourceInfo( 0x758, 0, "Titanio",  CraftAttributeInfo.Titanio,  CraftResource.Titanio,   typeof( TitanioIngot ),  typeof( TitanioOre ),  typeof( TitanioGranite ) ),
   new CraftResourceInfo( 0x777, 0, "Platina",  CraftAttributeInfo.Platina,  CraftResource.Platina,   typeof( PlatinaIngot ),  typeof( PlatinaOre ),  typeof( PlatinaGranite ) ),
   new CraftResourceInfo( 0x4F4, 0, "Emerald",  CraftAttributeInfo.Emerald,  CraftResource.Emerald,   typeof( EmeraldIngot ),  typeof( EmeraldOre ),  typeof( EmeraldGranite ) ),
   new CraftResourceInfo( 0x842, 0, "Firen",  CraftAttributeInfo.Firen,  CraftResource.Firen,   typeof( FirenIngot ),  typeof( FirenOre ),  typeof( FirenGranite ) ),
   new CraftResourceInfo( 0x84c, 0, "FrozenStone",  CraftAttributeInfo.FrozenStone,  CraftResource.FrozenStone,   typeof( FrozenStoneIngot ),  typeof( FrozenStoneOre ),  typeof( FrozenStoneGranite ) ),
   new CraftResourceInfo( 0x77C, 0, "MoonStone",  CraftAttributeInfo.MoonStone,  CraftResource.MoonStone,   typeof( MoonStoneIngot ),  typeof( MoonStoneOre ),  typeof( MoonStoneGranite ) ),
   new CraftResourceInfo( 0x485, 0, "DeathRock",  CraftAttributeInfo.DeathRock,  CraftResource.DeathRock,   typeof( DeathRockIngot ),  typeof( DeathRockOre ),  typeof( DeathRockGranite ) ),
   
  };

 private static CraftResourceInfo[] m_WoodInfo = new CraftResourceInfo[]
  {
   new CraftResourceInfo( 0x844, 0, "Pine",  CraftAttributeInfo.Pine,  CraftResource.Pine,    typeof( PineLog ) ),
   new CraftResourceInfo( 0x74F, 0, "Cedar",  CraftAttributeInfo.Cedar,  CraftResource.Cedar,   typeof( CedarLog ) ),
   new CraftResourceInfo( 0x1b1, 0, "Maple",  CraftAttributeInfo.Maple,  CraftResource.Maple,   typeof( MapleLog ) ),
   new CraftResourceInfo( 0x48C, 0, "Wallnut",  CraftAttributeInfo.Wallnut,  CraftResource.Wallnut,   typeof( WallnutLog ) ),
   new CraftResourceInfo( 0x8A5, 0, "Yew",   CraftAttributeInfo.Yew,   CraftResource.Yew,    typeof( YewLog ) ),
   new CraftResourceInfo( 0x4F4, 0, "Elven",  CraftAttributeInfo.Elven,  CraftResource.Elven,   typeof( ElvenLog ) ),
   new CraftResourceInfo( 0x903, 0, "Elder",  CraftAttributeInfo.Elder,  CraftResource.Elder,   typeof( ElderLog ) ),
   new CraftResourceInfo( 0x486, 0, "Death",  CraftAttributeInfo.Death,  CraftResource.Death,   typeof( DeathLog ) ),
  };
             
 private static CraftResourceInfo[] m_ScaleInfo = new CraftResourceInfo[]
  {
   new CraftResourceInfo( 0x66D, 1053129, "Red Scales", CraftAttributeInfo.RedScales,  CraftResource.RedScales,  typeof( RedScales ) ),
   new CraftResourceInfo( 0x8A8, 1053130, "Yellow Scales", CraftAttributeInfo.YellowScales, CraftResource.YellowScales,  typeof( YellowScales ) ),
   new CraftResourceInfo( 0x455, 1053131, "Black Scales", CraftAttributeInfo.BlackScales,  CraftResource.BlackScales,  typeof( BlackScales ) ),
   new CraftResourceInfo( 0x851, 1053132, "Green Scales", CraftAttributeInfo.GreenScales,  CraftResource.GreenScales,  typeof( GreenScales ) ),
   new CraftResourceInfo( 0x8FD, 1053133, "White Scales", CraftAttributeInfo.WhiteScales,  CraftResource.WhiteScales,  typeof( WhiteScales ) ),
   new CraftResourceInfo( 0x8B0, 1053134, "Blue Scales", CraftAttributeInfo.BlueScales,  CraftResource.BlueScales,  typeof( BlueScales ) )
  };

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

 /// <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.Pine  );
 }

 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.Wood: list = m_WoodInfo; break;
   case CraftResourceType.Scales: list = m_ScaleInfo; 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.DeathRock )
   return CraftResourceType.Metal;

  if ( resource >= CraftResource.RegularLeather && resource <= CraftResource.BarbedLeather )
   return CraftResourceType.Leather;

  if ( resource >= CraftResource.Pine && resource <= CraftResource.Death )
   return CraftResourceType.Wood;

  if ( resource >= CraftResource.RedScales && resource <= CraftResource.BlueScales )
   return CraftResourceType.Scales;

  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.Wood: return CraftResource.Pine;
   case CraftResourceType.Scales: return CraftResource.RedScales;
  }

  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.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;
  else if ( info.Level == 9 )
   return CraftResource.Titanio;
  else if ( info.Level == 10 )
   return CraftResource.Platina;
  else if ( info.Level == 11 )
   return CraftResource.Emerald;
  else if ( info.Level == 12 )
   return CraftResource.Firen;
  else if ( info.Level == 13 )
   return CraftResource.FrozenStone;
  else if ( info.Level == 14 )
   return CraftResource.MoonStone;

  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" );
 public static readonly OreInfo Titanio  = new OreInfo( 9, 0x758, "Titanio" );
 public static readonly OreInfo Platina   = new OreInfo( 10, 0x777, "Platina" );
 public static readonly OreInfo Emerald   = new OreInfo( 11, 0x4F4, "Emerald" );
 public static readonly OreInfo Firen  = new OreInfo( 12, 0x842, "Firen" );
 public static readonly OreInfo FrozenStone  = new OreInfo( 13, 0x84C, "Frozen Stone" );
 public static readonly OreInfo MoonStone  = new OreInfo( 14, 0x77C, "Moon Stone" );

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



Bon ok ya lair d emanquer quelques choses quand on regarde le script, c'est que je le modifie en ce moment, update plus tard ;)

Injall - March 2, 2004 04:29 PM (GMT)
C'est génial, j'ai réussis a ajouter une ressource grace a ce super tutorial, mais je note quelques prolèmes :

-Les armures/armes chez moi ne porte pas le nom du minerais ajouté choisis.
-Comme dit plus haut, on ne est obligé de mettre 104403X en guise de nom dans defBlacksmithy.cs, du coup ce n'est pas le nom du minerai qui aparait dans le menus, mais "Make1".
-Je sais pas trop où se trouvent les "body des NPCs", et du coup les elementaires des resources ajoutés ont la couleur de celui de valorite.

s'il vous plait si quelqu'un connait une solution pour résoudre ces 3 problèmes aidez moi :unsure:

EDIT: pour le nom des métaux dans DefBlacksmithy.cs, il suffit de mettre par exemple
AddSubRes( typeof( ArgentIngot ), "ARGENT", 99.0, 1044268 );

au lieu de
AddSubRes( typeof( ArgentIngot ), 1044031, 1044036, 99.0, 1044268 );

blackeye - March 11, 2004 12:16 AM (GMT)
Moi j'ai toute faite comme vous aver dit pis quand je part mon sertveur sa me done plein d'erreur dans Ore.cs et ingo.cs pis j'ai rechecker pis sa marche pas plus att je vous les donne

ORE.CS

QUOTE
using System;
using Server.Items;
using Server.Network;
using Server.Targeting;
using Server.Engines.Craft;

namespace Server.Items
{
public abstract class BaseOre : 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( "{0} {1} ore", Amount, CraftResources.GetName( m_Resource ).ToLower() );
  }
  }

  public abstract BaseIngot GetIngot();

  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;

    switch ( reader.ReadInt() )
    {
      case 0: info = OreInfo.Iron; break;
      case 1: info = OreInfo.DullCopper; break;
      case 2: info = OreInfo.ShadowIron; break;
      case 3: info = OreInfo.Copper; break;
      case 4: info = OreInfo.Bronze; break;
      case 5: info = OreInfo.Gold; break;
      case 6: info = OreInfo.Agapite; break;
      case 7: info = OreInfo.Verite; break;
      case 8: info = OreInfo.Valorite; break;
      case 9: info = OreInfo.Titanium; break;
      default: info = null; break;
    }

    m_Resource = CraftResources.GetFromOreInfo( info );
    break;
    }
  }
  }

  public BaseOre( CraftResource resource ) : this( resource, 1 )
  {
  }

  public BaseOre( CraftResource resource, int amount ) : base( 0x19B9 )
  {
  Stackable = true;
  Weight = 12.0;
  Amount = amount;
  Hue = CraftResources.GetHue( resource );

  m_Resource = resource;
  }

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

  public override void AddNameProperty( ObjectPropertyList list )
  {
  if ( Amount > 1 )
    list.Add( 1050039, "{0}\t#{1}", Amount, 1026583 ); // ~1_NUMBER~ ~2_ITEMNAME~
  else
    list.Add( 1026583 ); // ore
  }

  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
  {
    if ( m_Resource >= CraftResource.DullCopper && m_Resource <= CraftResource.Titanium )
    return 1042845 + (int)(m_Resource - CraftResource.DullCopper);

    return 1042853; // iron ore;
  }
  }

  public override void OnDoubleClick( Mobile from )
  {
  if ( !Movable )
    return;

  if ( from.InRange( this.GetWorldLocation(), 2 ) )
  {
    from.SendLocalizedMessage( 501971 ); // Select the forge on which to smelt the ore, or another pile of ore with which to combine it.
    from.Target = new InternalTarget( this );
  }
  else
  {
    from.SendLocalizedMessage( 501976 ); // The ore is too far away.
  }
  }

  private class InternalTarget : Target
  {
  private BaseOre m_Ore;

  public InternalTarget( BaseOre ore ) :  base ( 2, false, TargetFlags.None )
  {
    m_Ore = ore;
  }

  private bool IsForge( object obj )
  {
    if ( obj.GetType().IsDefined( typeof( ForgeAttribute ), false ) )
    return true;

    int itemID = 0;

    if ( obj is Item )
    itemID = ((Item)obj).ItemID;
    else if ( obj is StaticTarget )
    itemID = ((StaticTarget)obj).ItemID & 0x3FFF;

    return ( itemID == 4017 || (itemID >= 6522 && itemID <= 6569) );
  }

  protected override void OnTarget( Mobile from, object targeted )
  {
    if ( m_Ore.Deleted )
    return;

    if ( !from.InRange( m_Ore.GetWorldLocation(), 2 ) )
    {
    from.SendLocalizedMessage( 501976 ); // The ore is too far away.
    return;
    }

    if ( IsForge( targeted ) )
    {
    double difficulty;

    switch ( m_Ore.Resource )
    {
      default: difficulty = 50.0; break;
      case CraftResource.DullCopper: difficulty = 65.0; break;
      case CraftResource.ShadowIron: difficulty = 70.0; break;
      case CraftResource.Copper: difficulty = 75.0; break;
      case CraftResource.Bronze: difficulty = 80.0; break;
      case CraftResource.Gold: difficulty = 85.0; break;
      case CraftResource.Agapite: difficulty = 90.0; break;
      case CraftResource.Verite: difficulty = 95.0; break;
      case CraftResource.Valorite: difficulty = 99.0; break;
      case CraftResource.Titanium: difficulty = 100.0; break;
    }

    double minSkill = difficulty - 25.0;
    double maxSkill = difficulty + 25.0;
   
    if ( difficulty > 50.0 && difficulty > from.Skills[SkillName.Mining].Value )
    {
      from.SendLocalizedMessage( 501986 ); // You have no idea how to smelt this strange ore!
      return;
    }

    if ( from.CheckTargetSkill( SkillName.Mining, targeted, minSkill, maxSkill ) )
    {
      int toConsume = m_Ore.Amount;

      if ( toConsume <= 0 )
      {
      from.SendLocalizedMessage( 501987 ); // There is not enough metal-bearing ore in this pile to make an ingot.
      }
      else
      {
      if ( toConsume > 30000 )
        toConsume = 30000;

      BaseIngot ingot = m_Ore.GetIngot();
      ingot.Amount = toConsume * 2;

      m_Ore.Consume( toConsume );
      from.AddToBackpack( ingot );
      //from.PlaySound( 0x57 );


      from.SendLocalizedMessage( 501988 ); // You smelt the ore removing the impurities and put the metal in your backpack.
      }
    }
    else if ( m_Ore.Amount < 2 )
    {
      from.SendLocalizedMessage( 501989 ); // You burn away the impurities but are left with no useable metal.
      m_Ore.Delete();
    }
    else
    {
      from.SendLocalizedMessage( 501990 ); // You burn away the impurities but are left with less useable metal.
      m_Ore.Amount /= 2;
    }
    }
  }
  }
}

public class IronOre : BaseOre
{
  [Constructable]
  public IronOre() : this( 1 )
  {
  }

  [Constructable]
  public IronOre( int amount ) : base( CraftResource.Iron, amount )
  {
  }

  public IronOre( 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 IronOre( amount ), amount );
  }

  public override BaseIngot GetIngot()
  {
  return new IronIngot();
  }
}

public class DullCopperOre : BaseOre
{
  [Constructable]
  public DullCopperOre() : this( 1 )
  {
  }

  [Constructable]
  public DullCopperOre( int amount ) : base( CraftResource.DullCopper, amount )
  {
  }

  public DullCopperOre( 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 DullCopperOre( amount ), amount );
  }

  public override BaseIngot GetIngot()
  {
  return new DullCopperIngot();
  }
}

public class ShadowIronOre : BaseOre
{
  [Constructable]
  public ShadowIronOre() : this( 1 )
  {
  }

  [Constructable]
  public ShadowIronOre( int amount ) : base( CraftResource.ShadowIron, amount )
  {
  }

  public ShadowIronOre( 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 ShadowIronOre( amount ), amount );
  }

  public override BaseIngot GetIngot()
  {
  return new ShadowIronIngot();
  }
}

public class CopperOre : BaseOre
{
  [Constructable]
  public CopperOre() : this( 1 )
  {
  }

  [Constructable]
  public CopperOre( int amount ) : base( CraftResource.Copper, amount )
  {
  }

  public CopperOre( 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 CopperOre( amount ), amount );
  }

  public override BaseIngot GetIngot()
  {
  return new CopperIngot();
  }
}

public class BronzeOre : BaseOre
{
  [Constructable]
  public BronzeOre() : this( 1 )
  {
  }

  [Constructable]
  public BronzeOre( int amount ) : base( CraftResource.Bronze, amount )
  {
  }

  public BronzeOre( 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 BronzeOre( amount ), amount );
  }

  public override BaseIngot GetIngot()
  {
  return new BronzeIngot();
  }
}

public class GoldOre : BaseOre
{
  [Constructable]
  public GoldOre() : this( 1 )
  {
  }

  [Constructable]
  public GoldOre( int amount ) : base( CraftResource.Gold, amount )
  {
  }

  public GoldOre( 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 GoldOre( amount ), amount );
  }

  public override BaseIngot GetIngot()
  {
  return new GoldIngot();
  }
}

public class AgapiteOre : BaseOre
{
  [Constructable]
  public AgapiteOre() : this( 1 )
  {
  }

  [Constructable]
  public AgapiteOre( int amount ) : base( CraftResource.Agapite, amount )
  {
  }

  public AgapiteOre( 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 AgapiteOre( amount ), amount );
  }

  public override BaseIngot GetIngot()
  {
  return new AgapiteIngot();
  }
}

public class VeriteOre : BaseOre
{
  [Constructable]
  public VeriteOre() : this( 1 )
  {
  }

  [Constructable]
  public VeriteOre( int amount ) : base( CraftResource.Verite, amount )
  {
  }

  public VeriteOre( 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 VeriteOre( amount ), amount );
  }

  public override BaseIngot GetIngot()
  {
  return new VeriteIngot();
  }
}

public class ValoriteOre : BaseOre
{
  [Constructable]
  public ValoriteOre() : this( 1 )
  {
  }

  [Constructable]
  public ValoriteOre( int amount ) : base( CraftResource.Valorite, amount )
  {
  }

  public ValoriteOre( 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 ValoriteOre( amount ), amount );
  }

  public override BaseIngot GetIngot()
  {
  return new ValoriteIngot();
  }
}
public class Titanium : BaseOre
{
  [Constructable]
  public TitaniumOre() : this( 1 )
  {
  }

  [Constructable]
  public TitaniumOre( int amount ) : base( CraftResource.Titanium, amount )
  {
  }

  public TitaniumOre( 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 TitaniumOre( amount ), amount );
  }

  public override BaseIngot GetIngot()
  {
  return new TitaniumIngot();
  }
}

}

blackeye - March 11, 2004 12:23 AM (GMT)
et ingo.cs


QUOTE

using System;
using Server.Items;
using Server.Network;

namespace Server.Items
{
public abstract class BaseIngot : 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} {1} ingot" : "{0} {1} ingots", Amount, CraftResources.GetName( m_Resource ).ToLower() );
   }
  }

  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;

     switch ( reader.ReadInt() )
     {
      case 0: info = OreInfo.Iron; break;
      case 1: info = OreInfo.DullCopper; break;
      case 2: info = OreInfo.ShadowIron; break;
      case 3: info = OreInfo.Copper; break;
      case 4: info = OreInfo.Bronze; break;
      case 5: info = OreInfo.Gold; break;
      case 6: info = OreInfo.Agapite; break;
      case 7: info = OreInfo.Verite; break;
      case 8: info = OreInfo.Valorite; break;
      case 9: info = OreInfo.Titanium; break;
      default: info = null; break;
     }

     m_Resource = CraftResources.GetFromOreInfo( info );
     break;
    }
   }
  }

  public BaseIngot( CraftResource resource ) : this( resource, 1 )
  {
  }

  public BaseIngot( CraftResource resource, int amount ) : base( 0x1BF2 )
  {
   Stackable = true;
   Weight = 0.1;
   Amount = amount;
   Hue = CraftResources.GetHue( resource );

   m_Resource = resource;
  }

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

  public override void AddNameProperty( ObjectPropertyList list )
  {
   if ( Amount > 1 )
    list.Add( 1050039, "{0}\t#{1}", Amount, 1027154 ); // ~1_NUMBER~ ~2_ITEMNAME~
   else
    list.Add( 1027154 ); // ingots
  }

  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
   {
    if ( m_Resource >= CraftResource.DullCopper && m_Resource <= CraftResource.Titanium )
     return 1042684 + (int)(m_Resource - CraftResource.DullCopper);

    return 1042692;
   }
  }
}

[FlipableAttribute( 0x1BF2, 0x1BEF )]
public class IronIngot : BaseIngot
{
  [Constructable]
  public IronIngot() : this( 1 )
  {
  }

  [Constructable]
  public IronIngot( int amount ) : base( CraftResource.Iron, amount )
  {
  }

  public IronIngot( 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 IronIngot( amount ), amount );
  }
}

[FlipableAttribute( 0x1BF2, 0x1BEF )]
public class DullCopperIngot : BaseIngot
{
  [Constructable]
  public DullCopperIngot() : this( 1 )
  {
  }

  [Constructable]
  public DullCopperIngot( int amount ) : base( CraftResource.DullCopper, amount )
  {
  }

  public DullCopperIngot( 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 DullCopperIngot( amount ), amount );
  }
}

[FlipableAttribute( 0x1BF2, 0x1BEF )]
public class ShadowIronIngot : BaseIngot
{
  [Constructable]
  public ShadowIronIngot() : this( 1 )
  {
  }

  [Constructable]
  public ShadowIronIngot( int amount ) : base( CraftResource.ShadowIron, amount )
  {
  }

  public ShadowIronIngot( 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 ShadowIronIngot( amount ), amount );
  }
}

[FlipableAttribute( 0x1BF2, 0x1BEF )]
public class CopperIngot : BaseIngot
{
  [Constructable]
  public CopperIngot() : this( 1 )
  {
  }

  [Constructable]
  public CopperIngot( int amount ) : base( CraftResource.Copper, amount )
  {
  }

  public CopperIngot( 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 CopperIngot( amount ), amount );
  }
}

[FlipableAttribute( 0x1BF2, 0x1BEF )]
public class BronzeIngot : BaseIngot
{
  [Constructable]
  public BronzeIngot() : this( 1 )
  {
  }

  [Constructable]
  public BronzeIngot( int amount ) : base( CraftResource.Bronze, amount )
  {
  }

  public BronzeIngot( 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 BronzeIngot( amount ), amount );
  }
}

[FlipableAttribute( 0x1BF2, 0x1BEF )]
public class GoldIngot : BaseIngot
{
  [Constructable]
  public GoldIngot() : this( 1 )
  {
  }

  [Constructable]
  public GoldIngot( int amount ) : base( CraftResource.Gold, amount )
  {
  }

  public GoldIngot( 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 GoldIngot( amount ), amount );
  }
}

[FlipableAttribute( 0x1BF2, 0x1BEF )]
public class AgapiteIngot : BaseIngot
{
  [Constructable]
  public AgapiteIngot() : this( 1 )
  {
  }

  [Constructable]
  public AgapiteIngot( int amount ) : base( CraftResource.Agapite, amount )
  {
  }

  public AgapiteIngot( 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 AgapiteIngot( amount ), amount );
  }
}

[FlipableAttribute( 0x1BF2, 0x1BEF )]
public class VeriteIngot : BaseIngot
{
  [Constructable]
  public VeriteIngot() : this( 1 )
  {
  }

  [Constructable]
  public VeriteIngot( int amount ) : base( CraftResource.Verite, amount )
  {
  }

  public VeriteIngot( 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 VeriteIngot( amount ), amount );
  }
}

[FlipableAttribute( 0x1BF2, 0x1BEF )]
public class ValoriteIngot : BaseIngot
{
  [Constructable]
  public ValoriteIngot() : this( 1 )
  {
  }

  [Constructable]
  public ValoriteIngot( int amount ) : base( CraftResource.Valorite, amount )
  {
  }

  public ValoriteIngot( 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 ValoriteIngot( amount ), amount );
  }
}
[FlipableAttribute( 0x1BF2, 0x1BEF )]
public class IronIngot : BaseIngot
{
  [Constructable]
  public TitaniumIngot() : this( 1 )
  {
  }

  [Constructable]
  public TitaniumIngot( int amount ) : base( CraftResource.Titanium, amount )
  {
  }

  public TitaniumIngot( 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 TitaniumIngot( amount ), amount );
  }
}

}


merci d'avance de votre aide

Injall - March 11, 2004 03:42 PM (GMT)
mh si tu veux mon avis poster comme ca une copie de tes fichiers ne sert absolument a rien a part flooder ce forum :huh:

pour commencer regarde dans ta console quand elle t'énonce les erreurs, les lignes correspondantes ou en général l'origine de l'erreur te sont donnés. Donc il te faut aller a la ligne correspondante et essayer de trouver (vérifier qu'il y ai bien ";" par exemple). Aprés si tu as des difficultés bien tu peux copier la ligne en question et quelqu'un tentera de t'aider je pense.

bonne chance en tout cas :)

blackeye - March 11, 2004 11:18 PM (GMT)
ok merci mais je comprend pas ce que sa veut dire les erreurs

Kilvan - March 18, 2004 11:56 PM (GMT)
Déja dans Ingos.cs dans la description du Titanium tu a laisser celui du fer :rolleyes:.

sinon si tu as des problemes envoie moi un mp avec ton adresse msn (si tu as, ou icq) et on essaira de voir sa ensemble :)

Fengal - March 21, 2004 03:28 PM (GMT)
J'ai scripter tous mes minerais ils marchent et tout, mais des que j'essaye de les forger le serveur crash.

je vois pas pourquoi sa fait cela a moin qu'il faut comem pour sphere scripter toutes les armures, mais j'ai vus que les autres minerais (valorite et tt) étaient scripter.

c'est pour cela que je vous demande comment faire

thx d'avance

Kaervek - May 28, 2004 04:19 PM (GMT)
Quelqu'un a eu des problemes avec ses metaux depuis la derniere version de RUnUo?
Pcq quand je mine, parfois le serveur crash <_<

Rapport:
CODE
Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
  at Server.Engines.Harvest.HarvestSystem.FinishHarvesting(Mobile from, Item tool, HarvestDefinition def, Object toHarvest, Object locked)
  at Server.Engines.Harvest.HarvestSoundTimer.OnTick()
  at Server.Timer.Slice()
  at Server.Core.Main(String[] args)

Kilvan - May 28, 2004 05:32 PM (GMT)
je ne suis pas sur, et il me semble que tu n'est pas le seul.

je croit que sa devait etre sur runuo qu'un personne avait poster un correctif sur les systeme de matériaux, mais sa fait un moment de cela.

soit c'est sur runuo, soit j'ai oublier et j'suis désolé.

Belladonne - July 26, 2004 10:32 AM (GMT)
Pour resoudre le probleme du menu de ferronerie il faut ajouter deux fonctions

dans Craftsysteme.cs: ( script/engine/craft/core)

QUOTE
public void AddSubRes( Type type, string name, double reqSkill, int genericName, object message )
  {
  CraftSubRes craftSubRes = new CraftSubRes( type, name, reqSkill, genericName, message );
  m_CraftSubRes.Add( craftSubRes );
  }

et dans CraftSubRes.cs (meme endroit)

QUOTE
public CraftSubRes( Type type, string name, double reqSkill, int genericNameNumber, object message )
  {
  m_Type = type;
  m_NameString = name;
  m_ReqSkill = reqSkill;
  m_GenericNameNumber = genericNameNumber;
  m_Message = message;
  }

Vortal - September 14, 2004 02:22 AM (GMT)
J'ai une question toute bête, à quoi sert les attributs :

CODE
 verite.RunicMinAttributes = 4;
verite.RunicMaxAttributes = 5;
verite.RunicMinIntensity = 45;
verite.RunicMaxIntensity = 90;


Dans le fichier scripts\misc\OreInfo.cs ?


Merci :)

Injall - September 14, 2004 06:09 PM (GMT)
à confirmer, mais selon moi :

CODE
x.RunicMinAttributes = 4;

Minimum d'aptitudes pouvant être ajoutés lorsque l'on craft une arme avec un runic hammer.

CODE
x.RunicMinIntensity = 45;

Minimum de points que peut avoir cette aptitude ( exemple : Hit Harm 45 )




* Hosted for free by InvisionFree